TinyMCE Advanced - Version 5.5.0

Version Description

  • Updated for WordPress 5.5 and TinyMCE 4.9.10.
  • Updated/renamed the subscript and superscript buttons as these are now in Gutenberg.
  • Minor CSS fixes and enhancements.
Download this release

Release Info

Developer azaozz
Plugin Icon 128x128 TinyMCE Advanced
Version 5.5.0
Comparing to
See all releases

Code changes from version 5.4.0 to 5.5.0

block-editor/richtext-buttons.css CHANGED
@@ -1 +1 @@
1
- .tadv-buttons-panel .components-toolbar__control.tadv-icon-button{width:38px;height:38px;padding:3px}.tadv-buttons-panel .components-toolbar__control.tadv-icon-button>svg{height:32px;width:32px;padding:5px;border-radius:4px;box-sizing:border-box;outline:none;box-shadow:none}.tadv-buttons-panel .components-toolbar{border:none;display:block}.tadv-buttons-panel div.components-toolbar>div{display:inline-block;margin:0}.tadv-mark-icon{background-color:#fff9c0;background-clip:content-box}
1
+ .tadv-buttons-panel .components-toolbar__control.tadv-icon-button>svg{box-sizing:border-box;outline:none;box-shadow:none}.tadv-buttons-panel .components-toolbar{border:none}.tadv-mark-icon{background-color:#fff9c0;background-clip:content-box}
block-editor/richtext-buttons.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){"use strict";o.r(e);const n=window.tadvBlockButtons,{wp:r}=window,{get:a}=window.lodash,{createElement:c}=r.element,{InspectorControls:l,PanelColorSettings:i}=r.blockEditor,{registerFormatType:s,applyFormat:u,removeFormat:d,getActiveFormat:v}=r.richText;function m(t){return(t=t.replace(/.*?(background-)?color:\s*/,"")).replace(/[; ]+$/,"")}const h=window.tadvBlockButtons||{},{wp:p}=window,{RichTextToolbarButton:g}=p.blockEditor,{registerFormatType:f,removeFormat:b}=p.richText,{createElement:y}=p.element,{ToolbarButton:k}=p.components,w=h.strRemoveFormatting||"Clear formatting";let F;function T(t){const e=[];return F||(F=h.formats_to_remove?h.formats_to_remove.split(","):["core/bold","core/italic","core/code","core/underline","core/strikethrough","core/text-color","tadv/sup","tadv/sub","tadv/mark","tadv/color-panel","tadv/background-color-panel"]),t.forEach(t=>{t&&t.forEach(t=>{F.indexOf(t.type)>-1&&-1===e.indexOf(t.type)&&e.push(t.type)})}),e}function C(t){let e=t.formats;if(!e.length)return t;let o=0,n=e.length;t.end>t.start&&(o=t.start,n=t.end,e=e.slice(o,n));const r=T(e);return r.length?(r.forEach(e=>{t=b(t,e,o,n)}),t):t}const{wp:x}=window,{createElement:B,Fragment:A}=(window.tadvBlockButtons,x.element),{__:N}=x.i18n,{ToolbarButton:E}=x.components,{RichTextToolbarButton:S,RichTextShortcut:_}=x.blockEditor,{registerFormatType:O,getActiveFormat:P,toggleFormat:R,applyFormat:M,removeFormat:U}=x.richText,j=N("Strikethrough");function z(t,e,o){e(R(t,{type:"core/strikethrough"})),o&&o()}const{wp:L}=window,{createElement:I,Fragment:G}=L.element,{__:H}=L.i18n,{ToolbarButton:V}=L.components,{RichTextToolbarButton:$,RichTextShortcut:q}=L.blockEditor,{registerFormatType:D,getActiveFormat:J,toggleFormat:K,remove:Q,applyFormat:W}=L.richText,X=H("Inline Code");function Y(t,e,o){e(K(t,{type:"core/code"})),o&&o()}const{wp:Z}=window,tt=window.tadvBlockButtons||{},{createElement:et,Fragment:ot}=Z.element,{__:nt}=Z.i18n,{ToolbarButton:rt}=Z.components,{RichTextToolbarButton:at,RichTextShortcut:ct}=Z.blockEditor,{Path:lt,SVG:it}=Z.components,{registerFormatType:st,getActiveFormat:ut,toggleFormat:dt,applyFormat:vt,removeFormat:mt}=Z.richText,ht=et(it,{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:"dashicon tadv-mark-icon"},et(lt,{"aria-hidden":"true",role:"img",focusable:"false",width:"20",height:"20",d:"M13.23 15h1.9L11 4H9L5 15h1.88l1.07-3h4.18zm-1.53-4.54H8.51L10 5.6z"})),pt=tt.strMark;function gt(t,e,o){e(dt(t,{type:"tadv/mark"})),o&&o()}const{wp:ft}=window,bt=window.tadvBlockButtons||{},{createElement:yt,Fragment:kt}=ft.element,{__:wt}=ft.i18n,{ToolbarButton:Ft}=ft.components,{RichTextToolbarButton:Tt,RichTextShortcut:Ct}=ft.blockEditor,{registerFormatType:xt,getActiveFormat:Bt,applyFormat:At,removeFormat:Nt}=ft.richText;function Et(t,e,o,n){if(t)o(Nt(e,"core/underline"));else{o(At(e,{type:"core/underline",attributes:{style:"text-decoration: underline"}}))}n&&n()}const{wp:St}=window,_t=window.tadvBlockButtons,{createElement:Ot,Fragment:Pt}=St.element,{registerFormatType:Rt,getActiveFormat:Mt,toggleFormat:Ut}=St.richText,{ToolbarButton:jt}=St.components,{RichTextToolbarButton:zt,RichTextShortcut:Lt}=St.blockEditor,{Path:It,SVG:Gt}=St.components,Ht=Ot(Gt,{viewBox:"-85 -985 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Ot(It,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 754v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"})),Vt=Ot(Gt,{viewBox:"-85 -975 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Ot(It,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 50v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"}));function $t(t,e,o,n){o(Ut(e,{type:t})),n&&n()}function qt({type:t,tagName:e,title:o,character:n,icon:r},a){Rt(t,{title:o,tagName:e,className:null,edit({value:e,onChange:c,onFocus:l,isActive:i}){let s=null;return a||(s=Ot(zt,{title:o,icon:r,onClick:()=>$t(t,e,c,l),isActive:i,shortcutType:"primary",shortcutCharacter:n})),Ot(Pt,null,Ot(Lt,{type:"primary",character:n,onUse:()=>$t(t,e,c)}),s)}})}const{wp:Dt}=window,{createElement:Jt}=Dt.element,{select:Kt}=Dt.data,{addFilter:Qt}=Dt.hooks,{PanelBody:Wt,Toolbar:Xt}=Dt.components,{InspectorControls:Yt}=Dt.blockEditor,{registerFormatType:Zt,unregisterFormatType:te}=Dt.richText,ee=window.tadvBlockButtons||{},oe=ee.buttons?ee.buttons.split(","):[],ne=ee.panelButtons?ee.panelButtons.split(","):[],re=ee.unusedButtons?ee.unusedButtons.split(","):[],ae={"tadv/mark":function(t){st("tadv/mark",{title:pt,tagName:"mark",className:null,edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=et(at,{title:pt,icon:ht,onClick:()=>gt(e,o,n),className:"tadv-icon-button-mark",isActive:r,shortcutType:"access",shortcutCharacter:"m"})),et(ot,null,et(ct,{type:"access",character:"m",onUse:()=>gt(e,o)}),a)}})},"tadv/removeformat":function(t){f("tadv/removeformat",{title:w,tagName:"u",className:"remove-format",edit:({value:e,onChange:o,onFocus:n,isActive:r})=>t?null:y(g,{icon:"editor-removeformatting",title:w,onClick:()=>o(C(e)),isActive:null})})},"tadv/sub":function(t){qt({type:"tadv/sub",tagName:"sub",title:_t.strSubscript,character:",",icon:Vt},t)},"tadv/sup":function(t){qt({type:"tadv/sup",tagName:"sup",title:_t.strSuperscript,character:".",icon:Ht},t)},"core/code":function(t){D("core/code",{title:X,tagName:"code",className:null,__unstableInputRule(t){const{start:e,text:o}=t;if("`"!==o.slice(e-1,e))return t;const n=o.slice(0,e-1).lastIndexOf("`");if(-1===n)return t;const r=n,a=e-2;return r===a?t:(t=Q(t,r,r+1),t=Q(t,a,a+1),t=W(t,{type:"core/code"},r,a))},edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=I($,{icon:"editor-code",title:X,onClick:()=>Y(e,o,n),isActive:r,shortcutType:"access",shortcutCharacter:"x"})),I(G,null,I(q,{type:"access",character:"x",onUse:()=>Y(e,o)}),a)}})},"core/strikethrough":function(t){O("core/strikethrough",{name:"core/strikethrough",title:j,tagName:"s",className:null,edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=B(S,{icon:"editor-strikethrough",title:j,onClick:()=>z(e,o,n),isActive:r,shortcutType:"access",shortcutCharacter:"d"})),B(A,null,B(_,{type:"access",character:"d",onUse:()=>z(e,o)}),a)}})},"core/underline":function(t){xt("core/underline",{title:bt.strUnderline,tagName:"span",className:"underline",attributes:{style:"style"},edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=yt(Tt,{title:bt.strUnderline,icon:"editor-underline",onClick:()=>Et(r,e,o,n),className:null,isActive:r,shortcutType:"primary",shortcutCharacter:"u"})),yt(kt,null,yt(Ct,{type:"primary",character:"u",onUse:()=>Et(r,e,o)}),a)}})}},ce={"core/code":function({value:t,onChange:e,onFocus:o,isActive:n}){return I(V,{key:"core/code",icon:"editor-code",className:"tadv-icon-button",isActive:J(t,"core/code"),title:X,onClick:()=>Y(t,e,o)})},"core/strikethrough":function({value:t,onChange:e,onFocus:o,isActive:n}){return B(E,{key:"core/strikethrough",icon:"editor-strikethrough",className:"tadv-icon-button",isActive:P(t,"core/strikethrough"),title:j,onClick:()=>z(t,e,o)})},"core/underline":function({value:t,onChange:e,onFocus:o,isActive:n}){const r=!!Bt(t,"core/underline");return yt(Ft,{key:"core/underline",icon:"editor-underline",className:"tadv-icon-button",isActive:r,title:bt.strUnderline,onClick:()=>Et(r,t,e,o)})},"tadv/removeformat":function({value:t,onChange:e,onFocus:o,isActive:n}){return y(k,{key:"tadv/removeformat",icon:"editor-removeformatting",className:"tadv-icon-button",title:w,onClick:()=>e(C(t))})},"tadv/mark":function({value:t,onChange:e,onFocus:o,isActive:n}){return et(rt,{key:"tadv/mark",icon:"editor-textcolor",className:"tadv-icon-button tadv-icon-button-mark",isActive:ut(t,"tadv/mark"),title:pt,onClick:()=>gt(t,e,o)})},"tadv/sup":function({value:t,onChange:e,onFocus:o,isActive:n}){return Ot(jt,{key:"tadv/sup",icon:Ht,className:"tadv-icon-button",isActive:Mt(t,"tadv/sup"),title:_t.strSuperscript,onClick:()=>$t("tadv/sup",t,e,o)})},"tadv/sub":function({value:t,onChange:e,onFocus:o,isActive:n}){return Ot(jt,{key:"tadv/sub",icon:Vt,className:"tadv-icon-button",isActive:Mt(t,"tadv/sub"),title:_t.strSubscript,onClick:()=>$t("tadv/sub",t,e,o)})}};function le(t){(function(t){const e=Kt("core/rich-text").getFormatTypes();let o=!1;return e.forEach(e=>{e.name===t&&(o=!0)}),o})(t)&&te(t)}function ie(){re.length&&re.forEach(t=>{le(t)}),oe.forEach(t=>{ae.hasOwnProperty(t)&&(le(t),ae[t].call(null))}),ne.length&&(ne.forEach(t=>{-1===oe.indexOf(t)&&ae.hasOwnProperty(t)&&(le(t),ae[t].call(null,"panel"))}),Zt("tadv/tadv-format-panel",{title:ee.strFormatting,tagName:"span",className:"tadv-format-panel",edit({value:t,onChange:e,onFocus:o,isActive:n}){const r=[];return ne.forEach(a=>{ce.hasOwnProperty(a)&&r.push(ce[a].call(null,{value:t,onChange:e,onFocus:o,isActive:n}))}),Jt(Yt,null,Jt(Wt,{title:ee.strFormatting,className:"tadv-buttons-panel"},Jt(Xt,null,r)))}})),function(){if(!n.colorPanel)return;const t=n.colorPanel.indexOf("tadv/color-panel")>-1,e=n.colorPanel.indexOf("tadv/background-color-panel")>-1;t&&s("tadv/color-panel",{title:n.strTextColor,tagName:"span",className:"tadv-color",attributes:{style:"style"},edit({isActive:t,value:o,onChange:r}){let s,h;if(t){const t=v(o,"tadv/color-panel"),e=a(t,["attributes","style"])||"",n=v(o,"tadv/background-color-panel"),r=a(n,["attributes","style"])||"";s=m(e),h=m(r)}const p=[{value:s,onChange:t=>{r(t?u(o,{type:"tadv/color-panel",attributes:{style:"color:"+t}}):d(o,"tadv/color-panel"))},label:n.strTextColorLabel}];return e&&p.push({value:h,onChange:t=>{r(t?u(o,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):d(o,"tadv/background-color-panel"))},label:n.strBackgroundColorLabel}),c(l,null,c(i,{title:n.strTextColor,initialOpen:!1,colorSettings:p}))}}),s("tadv/background-color-panel",{title:n.strBackgroundColor,tagName:"span",className:"tadv-background-color",attributes:{style:"style"},edit({isActive:o,value:r,onChange:s}){if(!e||t)return null;let h;if(o){const t=v(r,"tadv/background-color-panel");h=m(a(t,["attributes","style"])||"")}const p=[{value:h,onChange:t=>{s(t?u(r,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):d(r,"tadv/background-color-panel"))},label:n.strBackgroundColorLabel}];return c(l,null,c(i,{title:n.strTextColor,initialOpen:!1,colorSettings:p}))}})}()}let se;Qt("blocks.registerBlockType","tadv-register-formats",(function(t){return se||(ie(),se=!0),t}))}]);
1
+ !function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){"use strict";o.r(e);const r=window.tadvBlockButtons,{wp:n}=window,{get:c}=window.lodash,{createElement:a}=n.element,{InspectorControls:l,PanelColorSettings:i}=n.blockEditor,{registerFormatType:s,applyFormat:u,removeFormat:d,getActiveFormat:m}=n.richText;function p(t){return(t=t.replace(/.*?(background-)?color:\s*/,"")).replace(/[; ]+$/,"")}const h=window.tadvBlockButtons||{},{wp:v}=window,{RichTextToolbarButton:g}=v.blockEditor,{registerFormatType:f,removeFormat:b}=v.richText,{createElement:y}=v.element,{ToolbarButton:k}=v.components,w=h.strRemoveFormatting||"Clear formatting";let F;function T(t){const e=[];return F||(F=h.formats_to_remove?h.formats_to_remove.split(","):["core/bold","core/italic","core/code","core/underline","core/strikethrough","core/text-color","tadv/sup","tadv/sub","tadv/mark","tadv/color-panel","tadv/background-color-panel"]),t.forEach(t=>{t&&t.forEach(t=>{F.indexOf(t.type)>-1&&-1===e.indexOf(t.type)&&e.push(t.type)})}),e}function C(t){let e=t.formats;if(!e.length)return t;let o=0,r=e.length;t.end>t.start&&(o=t.start,r=t.end,e=e.slice(o,r));const n=T(e);return n.length?(n.forEach(e=>{t=b(t,e,o,r)}),t):t}const{wp:x}=window,{createElement:B,Fragment:A}=(window.tadvBlockButtons,x.element),{__:N}=x.i18n,{ToolbarButton:E}=x.components,{RichTextToolbarButton:S,RichTextShortcut:_}=x.blockEditor,{registerFormatType:O,getActiveFormat:P,toggleFormat:R,applyFormat:L,removeFormat:M}=x.richText,U=N("Strikethrough");function j(t,e,o){e(R(t,{type:"core/strikethrough"})),o&&o()}const{wp:z}=window,{createElement:I,Fragment:G}=z.element,{__:H}=z.i18n,{ToolbarButton:V}=z.components,{RichTextToolbarButton:$,RichTextShortcut:q}=z.blockEditor,{registerFormatType:D,getActiveFormat:J,toggleFormat:K,remove:Q,applyFormat:W}=z.richText,X=H("Inline Code");function Y(t,e,o){e(K(t,{type:"core/code"})),o&&o()}const{wp:Z}=window,tt=window.tadvBlockButtons||{},{createElement:et,Fragment:ot}=Z.element,{__:rt}=Z.i18n,{ToolbarButton:nt}=Z.components,{RichTextToolbarButton:ct,RichTextShortcut:at}=Z.blockEditor,{Path:lt,SVG:it}=Z.components,{registerFormatType:st,getActiveFormat:ut,toggleFormat:dt,applyFormat:mt,removeFormat:pt}=Z.richText,ht=et(it,{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:"dashicon tadv-mark-icon"},et(lt,{"aria-hidden":"true",role:"img",focusable:"false",width:"20",height:"20",d:"M13.23 15h1.9L11 4H9L5 15h1.88l1.07-3h4.18zm-1.53-4.54H8.51L10 5.6z"})),vt=tt.strMark;function gt(t,e,o){e(dt(t,{type:"tadv/mark"})),o&&o()}const{wp:ft}=window,bt=window.tadvBlockButtons||{},{createElement:yt,Fragment:kt}=ft.element,{__:wt}=ft.i18n,{ToolbarButton:Ft}=ft.components,{RichTextToolbarButton:Tt,RichTextShortcut:Ct}=ft.blockEditor,{registerFormatType:xt,getActiveFormat:Bt,applyFormat:At,removeFormat:Nt}=ft.richText;function Et(t,e,o,r){if(t)o(Nt(e,"core/underline"));else{o(At(e,{type:"core/underline",attributes:{style:"text-decoration: underline"}}))}r&&r()}const{wp:St}=window,_t=window.tadvBlockButtons,{createElement:Ot,Fragment:Pt}=St.element,{registerFormatType:Rt,getActiveFormat:Lt,toggleFormat:Mt}=St.richText,{ToolbarButton:Ut}=St.components,{RichTextToolbarButton:jt,RichTextShortcut:zt}=St.blockEditor,{Path:It,SVG:Gt}=St.components,Ht=Ot(Gt,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Ot(It,{"aria-hidden":"true",role:"img",focusable:"false",d:"M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"})),Vt=Ot(Gt,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Ot(It,{"aria-hidden":"true",role:"img",focusable:"false",d:"M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"}));function $t(t,e,o,r){o(Mt(e,{type:t})),r&&r()}function qt({type:t,tagName:e,title:o,character:r,icon:n},c){Rt(t,{title:o,tagName:e,className:null,edit({value:e,onChange:a,onFocus:l,isActive:i}){let s=null;return c||(s=Ot(jt,{title:o,icon:n,onClick:()=>$t(t,e,a,l),isActive:i,shortcutType:"primary",shortcutCharacter:r})),Ot(Pt,null,Ot(zt,{type:"primary",character:r,onUse:()=>$t(t,e,a)}),s)}})}const{wp:Dt}=window,{createElement:Jt}=Dt.element,{select:Kt}=Dt.data,{addFilter:Qt}=Dt.hooks,{PanelBody:Wt,Toolbar:Xt}=Dt.components,{InspectorControls:Yt}=Dt.blockEditor,{registerFormatType:Zt,unregisterFormatType:te}=Dt.richText,ee=window.tadvBlockButtons||{},oe=ee.buttons?ee.buttons.split(","):[],re=ee.panelButtons?ee.panelButtons.split(","):[],ne=ee.unusedButtons?ee.unusedButtons.split(","):[],ce={"tadv/mark":function(t){st("tadv/mark",{title:vt,tagName:"mark",className:null,edit({value:e,onChange:o,onFocus:r,isActive:n}){let c=null;return t||(c=et(ct,{title:vt,icon:ht,onClick:()=>gt(e,o,r),className:"tadv-icon-button-mark",isActive:n,shortcutType:"access",shortcutCharacter:"m"})),et(ot,null,et(at,{type:"access",character:"m",onUse:()=>gt(e,o)}),c)}})},"tadv/removeformat":function(t){f("tadv/removeformat",{title:w,tagName:"u",className:"remove-format",edit:({value:e,onChange:o,onFocus:r,isActive:n})=>t?null:y(g,{icon:"editor-removeformatting",title:w,onClick:()=>o(C(e)),isActive:null})})},"core/code":function(t){D("core/code",{title:X,tagName:"code",className:null,__unstableInputRule(t){const{start:e,text:o}=t;if("`"!==o.slice(e-1,e))return t;const r=o.slice(0,e-1).lastIndexOf("`");if(-1===r)return t;const n=r,c=e-2;return n===c?t:(t=Q(t,n,n+1),t=Q(t,c,c+1),t=W(t,{type:"core/code"},n,c))},edit({value:e,onChange:o,onFocus:r,isActive:n}){let c=null;return t||(c=I($,{icon:"editor-code",title:X,onClick:()=>Y(e,o,r),isActive:n,shortcutType:"access",shortcutCharacter:"x"})),I(G,null,I(q,{type:"access",character:"x",onUse:()=>Y(e,o)}),c)}})},"core/strikethrough":function(t){O("core/strikethrough",{name:"core/strikethrough",title:U,tagName:"s",className:null,edit({value:e,onChange:o,onFocus:r,isActive:n}){let c=null;return t||(c=B(S,{icon:"editor-strikethrough",title:U,onClick:()=>j(e,o,r),isActive:n,shortcutType:"access",shortcutCharacter:"d"})),B(A,null,B(_,{type:"access",character:"d",onUse:()=>j(e,o)}),c)}})},"core/underline":function(t){xt("core/underline",{title:bt.strUnderline,tagName:"span",className:"underline",attributes:{style:"style"},edit({value:e,onChange:o,onFocus:r,isActive:n}){let c=null;return t||(c=yt(Tt,{title:bt.strUnderline,icon:"editor-underline",onClick:()=>Et(n,e,o,r),className:null,isActive:n,shortcutType:"primary",shortcutCharacter:"u"})),yt(kt,null,yt(Ct,{type:"primary",character:"u",onUse:()=>Et(n,e,o)}),c)}})},"core/subscript":function(t){qt({type:"core/subscript",tagName:"sub",title:_t.strSubscript,character:",",icon:Vt},t)},"core/superscript":function(t){qt({type:"core/superscript",tagName:"sup",title:_t.strSuperscript,character:".",icon:Ht},t)}},ae={"tadv/mark":function({value:t,onChange:e,onFocus:o,isActive:r}){return et(nt,{key:"tadv/mark",icon:"editor-textcolor",className:"tadv-icon-button tadv-icon-button-mark",isActive:ut(t,"tadv/mark"),title:vt,onClick:()=>gt(t,e,o)})},"tadv/removeformat":function({value:t,onChange:e,onFocus:o,isActive:r}){return y(k,{key:"tadv/removeformat",icon:"editor-removeformatting",className:"tadv-icon-button",title:w,onClick:()=>e(C(t))})},"core/code":function({value:t,onChange:e,onFocus:o,isActive:r}){return I(V,{key:"core/code",icon:"editor-code",className:"tadv-icon-button",isActive:J(t,"core/code"),title:X,onClick:()=>Y(t,e,o)})},"core/strikethrough":function({value:t,onChange:e,onFocus:o,isActive:r}){return B(E,{key:"core/strikethrough",icon:"editor-strikethrough",className:"tadv-icon-button",isActive:P(t,"core/strikethrough"),title:U,onClick:()=>j(t,e,o)})},"core/underline":function({value:t,onChange:e,onFocus:o,isActive:r}){const n=!!Bt(t,"core/underline");return yt(Ft,{key:"core/underline",icon:"editor-underline",className:"tadv-icon-button",isActive:n,title:bt.strUnderline,onClick:()=>Et(n,t,e,o)})},"core/subscript":function({value:t,onChange:e,onFocus:o,isActive:r}){return Ot(Ut,{key:"core/subscript",icon:Vt,className:"tadv-icon-button",isActive:Lt(t,"core/subscript"),title:_t.strSubscript,onClick:()=>$t("core/subscript",t,e,o)})},"core/superscript":function({value:t,onChange:e,onFocus:o,isActive:r}){return Ot(Ut,{key:"core/superscript",icon:Ht,className:"tadv-icon-button",isActive:Lt(t,"core/superscript"),title:_t.strSuperscript,onClick:()=>$t("core/superscript",t,e,o)})}};function le(t){(function(t){const e=Kt("core/rich-text").getFormatTypes();let o=!1;return e.forEach(e=>{e.name===t&&(o=!0)}),o})(t)&&te(t)}function ie(){ne.length&&ne.forEach(t=>{le(t)}),oe.forEach(t=>{ce.hasOwnProperty(t)&&(le(t),ce[t].call(null))}),re.length&&(re.forEach(t=>{-1===oe.indexOf(t)&&ce.hasOwnProperty(t)&&(le(t),ce[t].call(null,"panel"))}),Zt("tadv/tadv-format-panel",{title:ee.strFormatting,tagName:"span",className:"tadv-format-panel",edit({value:t,onChange:e,onFocus:o,isActive:r}){const n=[];return re.forEach(c=>{ae.hasOwnProperty(c)&&n.push(ae[c].call(null,{value:t,onChange:e,onFocus:o,isActive:r}))}),Jt(Yt,null,Jt(Wt,{title:ee.strFormatting,className:"tadv-buttons-panel"},Jt(Xt,null,n)))}})),function(){if(!r.colorPanel)return;const t=r.colorPanel.indexOf("tadv/color-panel")>-1,e=r.colorPanel.indexOf("tadv/background-color-panel")>-1;t&&s("tadv/color-panel",{title:r.strTextColor,tagName:"span",className:"tadv-color",attributes:{style:"style"},edit({isActive:t,value:o,onChange:n}){let s,h;if(t){const t=m(o,"tadv/color-panel"),e=c(t,["attributes","style"])||"",r=m(o,"tadv/background-color-panel"),n=c(r,["attributes","style"])||"";s=p(e),h=p(n)}const v=[{value:s,onChange:t=>{n(t?u(o,{type:"tadv/color-panel",attributes:{style:"color:"+t}}):d(o,"tadv/color-panel"))},label:r.strTextColorLabel}];return e&&v.push({value:h,onChange:t=>{n(t?u(o,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):d(o,"tadv/background-color-panel"))},label:r.strBackgroundColorLabel}),a(l,null,a(i,{title:r.strTextColor,initialOpen:!1,colorSettings:v}))}}),s("tadv/background-color-panel",{title:r.strBackgroundColor,tagName:"span",className:"tadv-background-color",attributes:{style:"style"},edit({isActive:o,value:n,onChange:s}){if(!e||t)return null;let h;if(o){const t=m(n,"tadv/background-color-panel");h=p(c(t,["attributes","style"])||"")}const v=[{value:h,onChange:t=>{s(t?u(n,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):d(n,"tadv/background-color-panel"))},label:r.strBackgroundColorLabel}];return a(l,null,a(i,{title:r.strTextColor,initialOpen:!1,colorSettings:v}))}})}()}let se;Qt("blocks.registerBlockType","tadv-register-formats",(function(t){return se||(ie(),se=!0),t}))}]);
mce/table/plugin.js CHANGED
@@ -54,8 +54,6 @@ var table = (function (domGlobals) {
54
  var never = constant(false);
55
  var always = constant(true);
56
 
57
- var never$1 = never;
58
- var always$1 = always;
59
  var none = function () {
60
  return NONE;
61
  };
@@ -69,37 +67,27 @@ var table = (function (domGlobals) {
69
  var id = function (n) {
70
  return n;
71
  };
72
- var noop = function () {
73
- };
74
- var nul = function () {
75
- return null;
76
- };
77
- var undef = function () {
78
- return undefined;
79
- };
80
  var me = {
81
  fold: function (n, s) {
82
  return n();
83
  },
84
- is: never$1,
85
- isSome: never$1,
86
- isNone: always$1,
87
  getOr: id,
88
  getOrThunk: call,
89
  getOrDie: function (msg) {
90
  throw new Error(msg || 'error: getOrDie called on none.');
91
  },
92
- getOrNull: nul,
93
- getOrUndefined: undef,
94
  or: id,
95
  orThunk: call,
96
  map: none,
97
- ap: none,
98
  each: noop,
99
  bind: none,
100
- flatten: none,
101
- exists: never$1,
102
- forall: always$1,
103
  filter: none,
104
  equals: eq,
105
  equals_: eq,
@@ -114,15 +102,10 @@ var table = (function (domGlobals) {
114
  return me;
115
  }();
116
  var some = function (a) {
117
- var constant_a = function () {
118
- return a;
119
- };
120
  var self = function () {
121
  return me;
122
  };
123
- var map = function (f) {
124
- return some(f(a));
125
- };
126
  var bind = function (f) {
127
  return f(a);
128
  };
@@ -133,8 +116,8 @@ var table = (function (domGlobals) {
133
  is: function (v) {
134
  return a === v;
135
  },
136
- isSome: always$1,
137
- isNone: never$1,
138
  getOr: constant_a,
139
  getOrThunk: constant_a,
140
  getOrDie: constant_a,
@@ -142,35 +125,31 @@ var table = (function (domGlobals) {
142
  getOrUndefined: constant_a,
143
  or: self,
144
  orThunk: self,
145
- map: map,
146
- ap: function (optfab) {
147
- return optfab.fold(none, function (fab) {
148
- return some(fab(a));
149
- });
150
  },
151
  each: function (f) {
152
  f(a);
153
  },
154
  bind: bind,
155
- flatten: constant_a,
156
  exists: bind,
157
  forall: bind,
158
  filter: function (f) {
159
  return f(a) ? me : NONE;
160
  },
 
 
 
 
 
 
161
  equals: function (o) {
162
  return o.is(a);
163
  },
164
  equals_: function (o, elementEq) {
165
- return o.fold(never$1, function (b) {
166
  return elementEq(a, b);
167
  });
168
- },
169
- toArray: function () {
170
- return [a];
171
- },
172
- toString: function () {
173
- return 'some(' + a + ')';
174
  }
175
  };
176
  return me;
@@ -208,49 +187,50 @@ var table = (function (domGlobals) {
208
  var isFunction = isType('function');
209
  var isNumber = isType('number');
210
 
211
- var slice = Array.prototype.slice;
212
- var rawIndexOf = function () {
213
- var pIndexOf = Array.prototype.indexOf;
214
- var fastIndex = function (xs, x) {
215
- return pIndexOf.call(xs, x);
216
- };
217
- var slowIndex = function (xs, x) {
218
- return slowIndexOf(xs, x);
219
- };
220
- return pIndexOf === undefined ? slowIndex : fastIndex;
221
- }();
222
  var contains = function (xs, x) {
223
  return rawIndexOf(xs, x) > -1;
224
  };
225
  var exists = function (xs, pred) {
226
- return findIndex(xs, pred).isSome();
 
 
 
 
 
 
227
  };
228
  var map = function (xs, f) {
229
  var len = xs.length;
230
  var r = new Array(len);
231
  for (var i = 0; i < len; i++) {
232
  var x = xs[i];
233
- r[i] = f(x, i, xs);
234
  }
235
  return r;
236
  };
237
  var each = function (xs, f) {
238
  for (var i = 0, len = xs.length; i < len; i++) {
239
  var x = xs[i];
240
- f(x, i, xs);
241
  }
242
  };
243
  var eachr = function (xs, f) {
244
  for (var i = xs.length - 1; i >= 0; i--) {
245
  var x = xs[i];
246
- f(x, i, xs);
247
  }
248
  };
249
  var filter = function (xs, pred) {
250
  var r = [];
251
  for (var i = 0, len = xs.length; i < len; i++) {
252
  var x = xs[i];
253
- if (pred(x, i, xs)) {
254
  r.push(x);
255
  }
256
  }
@@ -271,7 +251,7 @@ var table = (function (domGlobals) {
271
  var find = function (xs, pred) {
272
  for (var i = 0, len = xs.length; i < len; i++) {
273
  var x = xs[i];
274
- if (pred(x, i, xs)) {
275
  return Option.some(x);
276
  }
277
  }
@@ -280,28 +260,19 @@ var table = (function (domGlobals) {
280
  var findIndex = function (xs, pred) {
281
  for (var i = 0, len = xs.length; i < len; i++) {
282
  var x = xs[i];
283
- if (pred(x, i, xs)) {
284
  return Option.some(i);
285
  }
286
  }
287
  return Option.none();
288
  };
289
- var slowIndexOf = function (xs, x) {
290
- for (var i = 0, len = xs.length; i < len; ++i) {
291
- if (xs[i] === x) {
292
- return i;
293
- }
294
- }
295
- return -1;
296
- };
297
- var push = Array.prototype.push;
298
  var flatten = function (xs) {
299
  var r = [];
300
  for (var i = 0, len = xs.length; i < len; ++i) {
301
  if (!isArray(xs[i])) {
302
  throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
303
  }
304
- push.apply(r, xs[i]);
305
  }
306
  return r;
307
  };
@@ -312,14 +283,14 @@ var table = (function (domGlobals) {
312
  var forall = function (xs, pred) {
313
  for (var i = 0, len = xs.length; i < len; ++i) {
314
  var x = xs[i];
315
- if (pred(x, i, xs) !== true) {
316
  return false;
317
  }
318
  }
319
  return true;
320
  };
321
  var reverse = function (xs) {
322
- var r = slice.call(xs, 0);
323
  r.reverse();
324
  return r;
325
  };
@@ -327,7 +298,7 @@ var table = (function (domGlobals) {
327
  return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
328
  };
329
  var from$1 = isFunction(Array.from) ? Array.from : function (x) {
330
- return slice.call(x);
331
  };
332
 
333
  var keys = Object.keys;
@@ -336,21 +307,21 @@ var table = (function (domGlobals) {
336
  for (var k = 0, len = props.length; k < len; k++) {
337
  var i = props[k];
338
  var x = obj[i];
339
- f(x, i, obj);
340
  }
341
  };
342
  var map$1 = function (obj, f) {
343
- return tupleMap(obj, function (x, i, obj) {
344
  return {
345
  k: i,
346
- v: f(x, i, obj)
347
  };
348
  });
349
  };
350
  var tupleMap = function (obj, f) {
351
  var r = {};
352
  each$1(obj, function (x, i) {
353
- var tuple = f(x, i, obj);
354
  r[tuple.k] = tuple.v;
355
  });
356
  return r;
@@ -3527,7 +3498,7 @@ var table = (function (domGlobals) {
3527
  var onPaste = function (warehouse, target) {
3528
  return TableLookup.cell(target.element()).bind(function (cell) {
3529
  return findInWarehouse(warehouse, cell).map(function (details) {
3530
- var value = __assign({}, details, {
3531
  generators: target.generators,
3532
  clipboard: target.clipboard
3533
  });
@@ -6882,7 +6853,7 @@ var table = (function (domGlobals) {
6882
  };
6883
  };
6884
 
6885
- function TableResize (wire, vdirection) {
6886
  var hdirection = BarPositions.height;
6887
  var manager = BarManager(wire, vdirection, hdirection);
6888
  var events = Events.create({
@@ -6913,7 +6884,8 @@ var table = (function (domGlobals) {
6913
  destroy: manager.destroy,
6914
  events: events.registry
6915
  };
6916
- }
 
6917
 
6918
  var createContainer = function () {
6919
  var container = Element.fromTag('div');
@@ -6972,7 +6944,7 @@ var table = (function (domGlobals) {
6972
  var rawWire = TableWire.get(editor);
6973
  wire = Option.some(rawWire);
6974
  if (hasObjectResizing(editor) && hasTableResizeBars(editor)) {
6975
- var sz = TableResize(rawWire, direction);
6976
  sz.on();
6977
  sz.events.startDrag.bind(function (event) {
6978
  selectionRng = Option.some(editor.selection.getRng());
@@ -7052,7 +7024,7 @@ var table = (function (domGlobals) {
7052
  }
7053
  return adt$1.none(current);
7054
  };
7055
- var CellLocation = __assign({}, adt$1, { none: none$1 });
7056
 
7057
  var detect$4 = function (current, isRoot) {
7058
  return TableLookup.table(current, isRoot).bind(function (table) {
@@ -7089,8 +7061,8 @@ var table = (function (domGlobals) {
7089
  prev: prev
7090
  };
7091
 
7092
- var create$2 = Immutable('start', 'soffset', 'finish', 'foffset');
7093
- var SimRange = { create: create$2 };
7094
 
7095
  var adt$2 = Adt.generate([
7096
  { before: ['element'] },
@@ -7656,16 +7628,16 @@ var table = (function (domGlobals) {
7656
  };
7657
  var TabContext = { handle: handle$1 };
7658
 
7659
- var create$3 = Immutable('selection', 'kill');
7660
- var Response = { create: create$3 };
7661
 
7662
- var create$4 = function (start, soffset, finish, foffset) {
7663
  return {
7664
  start: constant(Situ.on(start, soffset)),
7665
  finish: constant(Situ.on(finish, foffset))
7666
  };
7667
  };
7668
- var Situs = { create: create$4 };
7669
 
7670
  var convertToRange = function (win, selection) {
7671
  var rng = asLtrRange(win, selection);
@@ -7896,7 +7868,7 @@ var table = (function (domGlobals) {
7896
  var cata$2 = function (subject, onNone, onSuccess, onFailedUp, onFailedDown) {
7897
  return subject.fold(onNone, onSuccess, onFailedUp, onFailedDown);
7898
  };
7899
- var BeforeAfter = __assign({}, adt$5, {
7900
  verify: verify,
7901
  cata: cata$2
7902
  });
@@ -8785,6 +8757,9 @@ var table = (function (domGlobals) {
8785
  if (raw.buttons === undefined) {
8786
  return true;
8787
  }
 
 
 
8788
  return (raw.buttons & 1) !== 0;
8789
  };
8790
  var mouseDown = function (e) {
54
  var never = constant(false);
55
  var always = constant(true);
56
 
 
 
57
  var none = function () {
58
  return NONE;
59
  };
67
  var id = function (n) {
68
  return n;
69
  };
 
 
 
 
 
 
 
 
70
  var me = {
71
  fold: function (n, s) {
72
  return n();
73
  },
74
+ is: never,
75
+ isSome: never,
76
+ isNone: always,
77
  getOr: id,
78
  getOrThunk: call,
79
  getOrDie: function (msg) {
80
  throw new Error(msg || 'error: getOrDie called on none.');
81
  },
82
+ getOrNull: constant(null),
83
+ getOrUndefined: constant(undefined),
84
  or: id,
85
  orThunk: call,
86
  map: none,
 
87
  each: noop,
88
  bind: none,
89
+ exists: never,
90
+ forall: always,
 
91
  filter: none,
92
  equals: eq,
93
  equals_: eq,
102
  return me;
103
  }();
104
  var some = function (a) {
105
+ var constant_a = constant(a);
 
 
106
  var self = function () {
107
  return me;
108
  };
 
 
 
109
  var bind = function (f) {
110
  return f(a);
111
  };
116
  is: function (v) {
117
  return a === v;
118
  },
119
+ isSome: always,
120
+ isNone: never,
121
  getOr: constant_a,
122
  getOrThunk: constant_a,
123
  getOrDie: constant_a,
125
  getOrUndefined: constant_a,
126
  or: self,
127
  orThunk: self,
128
+ map: function (f) {
129
+ return some(f(a));
 
 
 
130
  },
131
  each: function (f) {
132
  f(a);
133
  },
134
  bind: bind,
 
135
  exists: bind,
136
  forall: bind,
137
  filter: function (f) {
138
  return f(a) ? me : NONE;
139
  },
140
+ toArray: function () {
141
+ return [a];
142
+ },
143
+ toString: function () {
144
+ return 'some(' + a + ')';
145
+ },
146
  equals: function (o) {
147
  return o.is(a);
148
  },
149
  equals_: function (o, elementEq) {
150
+ return o.fold(never, function (b) {
151
  return elementEq(a, b);
152
  });
 
 
 
 
 
 
153
  }
154
  };
155
  return me;
187
  var isFunction = isType('function');
188
  var isNumber = isType('number');
189
 
190
+ var nativeSlice = Array.prototype.slice;
191
+ var nativeIndexOf = Array.prototype.indexOf;
192
+ var nativePush = Array.prototype.push;
193
+ var rawIndexOf = function (ts, t) {
194
+ return nativeIndexOf.call(ts, t);
195
+ };
 
 
 
 
 
196
  var contains = function (xs, x) {
197
  return rawIndexOf(xs, x) > -1;
198
  };
199
  var exists = function (xs, pred) {
200
+ for (var i = 0, len = xs.length; i < len; i++) {
201
+ var x = xs[i];
202
+ if (pred(x, i)) {
203
+ return true;
204
+ }
205
+ }
206
+ return false;
207
  };
208
  var map = function (xs, f) {
209
  var len = xs.length;
210
  var r = new Array(len);
211
  for (var i = 0; i < len; i++) {
212
  var x = xs[i];
213
+ r[i] = f(x, i);
214
  }
215
  return r;
216
  };
217
  var each = function (xs, f) {
218
  for (var i = 0, len = xs.length; i < len; i++) {
219
  var x = xs[i];
220
+ f(x, i);
221
  }
222
  };
223
  var eachr = function (xs, f) {
224
  for (var i = xs.length - 1; i >= 0; i--) {
225
  var x = xs[i];
226
+ f(x, i);
227
  }
228
  };
229
  var filter = function (xs, pred) {
230
  var r = [];
231
  for (var i = 0, len = xs.length; i < len; i++) {
232
  var x = xs[i];
233
+ if (pred(x, i)) {
234
  r.push(x);
235
  }
236
  }
251
  var find = function (xs, pred) {
252
  for (var i = 0, len = xs.length; i < len; i++) {
253
  var x = xs[i];
254
+ if (pred(x, i)) {
255
  return Option.some(x);
256
  }
257
  }
260
  var findIndex = function (xs, pred) {
261
  for (var i = 0, len = xs.length; i < len; i++) {
262
  var x = xs[i];
263
+ if (pred(x, i)) {
264
  return Option.some(i);
265
  }
266
  }
267
  return Option.none();
268
  };
 
 
 
 
 
 
 
 
 
269
  var flatten = function (xs) {
270
  var r = [];
271
  for (var i = 0, len = xs.length; i < len; ++i) {
272
  if (!isArray(xs[i])) {
273
  throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
274
  }
275
+ nativePush.apply(r, xs[i]);
276
  }
277
  return r;
278
  };
283
  var forall = function (xs, pred) {
284
  for (var i = 0, len = xs.length; i < len; ++i) {
285
  var x = xs[i];
286
+ if (pred(x, i) !== true) {
287
  return false;
288
  }
289
  }
290
  return true;
291
  };
292
  var reverse = function (xs) {
293
+ var r = nativeSlice.call(xs, 0);
294
  r.reverse();
295
  return r;
296
  };
298
  return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
299
  };
300
  var from$1 = isFunction(Array.from) ? Array.from : function (x) {
301
+ return nativeSlice.call(x);
302
  };
303
 
304
  var keys = Object.keys;
307
  for (var k = 0, len = props.length; k < len; k++) {
308
  var i = props[k];
309
  var x = obj[i];
310
+ f(x, i);
311
  }
312
  };
313
  var map$1 = function (obj, f) {
314
+ return tupleMap(obj, function (x, i) {
315
  return {
316
  k: i,
317
+ v: f(x, i)
318
  };
319
  });
320
  };
321
  var tupleMap = function (obj, f) {
322
  var r = {};
323
  each$1(obj, function (x, i) {
324
+ var tuple = f(x, i);
325
  r[tuple.k] = tuple.v;
326
  });
327
  return r;
3498
  var onPaste = function (warehouse, target) {
3499
  return TableLookup.cell(target.element()).bind(function (cell) {
3500
  return findInWarehouse(warehouse, cell).map(function (details) {
3501
+ var value = __assign(__assign({}, details), {
3502
  generators: target.generators,
3503
  clipboard: target.clipboard
3504
  });
6853
  };
6854
  };
6855
 
6856
+ var create$2 = function (wire, vdirection) {
6857
  var hdirection = BarPositions.height;
6858
  var manager = BarManager(wire, vdirection, hdirection);
6859
  var events = Events.create({
6884
  destroy: manager.destroy,
6885
  events: events.registry
6886
  };
6887
+ };
6888
+ var TableResize = { create: create$2 };
6889
 
6890
  var createContainer = function () {
6891
  var container = Element.fromTag('div');
6944
  var rawWire = TableWire.get(editor);
6945
  wire = Option.some(rawWire);
6946
  if (hasObjectResizing(editor) && hasTableResizeBars(editor)) {
6947
+ var sz = TableResize.create(rawWire, direction);
6948
  sz.on();
6949
  sz.events.startDrag.bind(function (event) {
6950
  selectionRng = Option.some(editor.selection.getRng());
7024
  }
7025
  return adt$1.none(current);
7026
  };
7027
+ var CellLocation = __assign(__assign({}, adt$1), { none: none$1 });
7028
 
7029
  var detect$4 = function (current, isRoot) {
7030
  return TableLookup.table(current, isRoot).bind(function (table) {
7061
  prev: prev
7062
  };
7063
 
7064
+ var create$3 = Immutable('start', 'soffset', 'finish', 'foffset');
7065
+ var SimRange = { create: create$3 };
7066
 
7067
  var adt$2 = Adt.generate([
7068
  { before: ['element'] },
7628
  };
7629
  var TabContext = { handle: handle$1 };
7630
 
7631
+ var create$4 = Immutable('selection', 'kill');
7632
+ var Response = { create: create$4 };
7633
 
7634
+ var create$5 = function (start, soffset, finish, foffset) {
7635
  return {
7636
  start: constant(Situ.on(start, soffset)),
7637
  finish: constant(Situ.on(finish, foffset))
7638
  };
7639
  };
7640
+ var Situs = { create: create$5 };
7641
 
7642
  var convertToRange = function (win, selection) {
7643
  var rng = asLtrRange(win, selection);
7868
  var cata$2 = function (subject, onNone, onSuccess, onFailedUp, onFailedDown) {
7869
  return subject.fold(onNone, onSuccess, onFailedUp, onFailedDown);
7870
  };
7871
+ var BeforeAfter = __assign(__assign({}, adt$5), {
7872
  verify: verify,
7873
  cata: cata$2
7874
  });
8757
  if (raw.buttons === undefined) {
8758
  return true;
8759
  }
8760
+ if (global$2.ie && global$2.ie >= 12 && raw.buttons === 0) {
8761
+ return true;
8762
+ }
8763
  return (raw.buttons & 1) !== 0;
8764
  };
8765
  var mouseDown = function (e) {
mce/table/plugin.min.js CHANGED
@@ -1 +1 @@
1
- !function(m){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=function(){},x=function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,e))}},C=function(e){return function(){return e}},o=function(e){return e};function b(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o.concat(e);return r.apply(null,n)}}var t,n,r,i,u,g=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,e)}},f=C(!1),a=C(!0),c=f,l=a,s=function(){return d},d=(i={fold:function(e,t){return e()},is:c,isSome:c,isNone:l,getOr:r=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:r,orThunk:n,map:s,ap:s,each:function(){},bind:s,flatten:s,exists:c,forall:l,filter:s,equals:t=function(e){return e.isNone()},equals_:t,toArray:function(){return[]},toString:C("none()")},Object.freeze&&Object.freeze(i),i),h=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:l,isNone:c,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return h(e(n))},ap:function(e){return e.fold(s,function(e){return h(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:d},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(c,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},S={some:h,none:s,from:function(e){return null===e||e===undefined?d:h(e)}},p=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t}(e)===t}},v=p("string"),w=p("array"),R=p("boolean"),T=p("function"),D=p("number"),O=Array.prototype.slice,N=(u=Array.prototype.indexOf)===undefined?function(e,t){return L(e,t)}:function(e,t){return u.call(e,t)},E=function(e,t){return-1<N(e,t)},k=function(e,t){return _(e,t).isSome()},A=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o,e)}return r},P=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},I=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r,e)&&n.push(i)}return n},B=function(e,t,n){return function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n,e)}(e,function(e){n=t(n,e)}),n},W=function(e,t,n){return P(e,function(e){n=t(n,e)}),n},M=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return S.some(o)}return S.none()},_=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return S.some(n);return S.none()},L=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},F=Array.prototype.push,j=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!w(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);F.apply(t,e[n])}return t},z=function(e,t){var n=A(e,t);return j(n)},H=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},U=function(e){var t=O.call(e,0);return t.reverse(),t},q=(T(Array.from)&&Array.from,Object.keys),V=function(e,t){for(var n=q(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},G=function(e,r){return Y(e,function(e,t,n){return{k:t,v:r(e,t,n)}})},Y=function(r,o){var i={};return V(r,function(e,t){var n=o(e,t,r);i[n.k]=n.v}),i},X=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(t.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+n.length+" arguments");var r={};return P(t,function(e,t){r[e]=C(n[t])}),r}},K=function(e){return e.slice(0).sort()},J=function(e,t){throw new Error("All required keys ("+K(e).join(", ")+") were not specified. Specified keys were: "+K(t).join(", ")+".")},$=function(e){throw new Error("Unsupported keys for object: "+K(e).join(", "))},Q=function(t,e){if(!w(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");P(e,function(e){if(!v(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},Z=function(e){var n=K(e);M(n,function(e,t){return t<n.length-1&&e===n[t+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})},ee=function(o,i){var u=o.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return Q("required",o),Q("optional",i),Z(u),function(t){var n=q(t);H(o,function(e){return E(n,e)})||J(o,n);var e=I(n,function(e){return!E(u,e)});0<e.length&&$(e);var r={};return P(o,function(e){r[e]=C(t[e])}),P(i,function(e){r[e]=C(Object.prototype.hasOwnProperty.call(t,e)?S.some(t[e]):S.none())}),r}},te=(m.Node.ATTRIBUTE_NODE,m.Node.CDATA_SECTION_NODE,m.Node.COMMENT_NODE),ne=m.Node.DOCUMENT_NODE,re=(m.Node.DOCUMENT_TYPE_NODE,m.Node.DOCUMENT_FRAGMENT_NODE,m.Node.ELEMENT_NODE),oe=m.Node.TEXT_NODE,ie=(m.Node.PROCESSING_INSTRUCTION_NODE,m.Node.ENTITY_REFERENCE_NODE,m.Node.ENTITY_NODE,m.Node.NOTATION_NODE,"undefined"!=typeof m.window?m.window:Function("return this;")()),ue=function(e,t){return function(e,t){for(var n=t!==undefined&&null!==t?t:ie,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n}(e.split("."),t)},ae=function(e,t){var n=ue(e,t);if(n===undefined||null===n)throw new Error(e+" not available on this browser");return n},ce=function(e){return e.dom().nodeName.toLowerCase()},le=function(e){return e.dom().nodeType},fe=function(t){return function(e){return le(e)===t}},se=function(e){return le(e)===te||"#comment"===ce(e)},de=fe(re),me=fe(oe),ge=function(e,t,n){if(!(v(n)||R(n)||D(n)))throw m.console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},he=function(e,t,n){ge(e.dom(),t,n)},pe=function(e,t){var n=e.dom();V(t,function(e,t){ge(n,t,e)})},ve=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},be=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},we=function(e,t){e.dom().removeAttribute(t)},ye=function(e){return W(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},xe=function(e,t){return-1!==e.indexOf(t)},Ce=function(e){return e.style!==undefined&&T(e.style.getPropertyValue)},Se=function(n){var r,o=!1;return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o||(o=!0,r=n.apply(null,e)),r}},Re=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:C(e)}},Te={fromHtml:function(e,t){var n=(t||m.document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw m.console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return Re(n.childNodes[0])},fromTag:function(e,t){var n=(t||m.document).createElement(e);return Re(n)},fromText:function(e,t){var n=(t||m.document).createTextNode(e);return Re(n)},fromDom:Re,fromPoint:function(e,t,n){var r=e.dom();return S.from(r.elementFromPoint(t,n)).map(Re)}},De=function(e){var t=me(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)},Oe=Se(function(){return Ne(Te.fromDom(m.document))}),Ne=function(e){var t=e.dom().body;if(null===t||t===undefined)throw new Error("Body is not available yet");return Te.fromDom(t)},Ee=function(e,t,n){if(!v(n))throw m.console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);Ce(e)&&e.style.setProperty(t,n)},ke=function(e,t,n){var r=e.dom();Ee(r,t,n)},Ae=function(e,t){var n=e.dom();V(t,function(e,t){Ee(n,t,e)})},Pe=function(e,t){var n=e.dom(),r=m.window.getComputedStyle(n).getPropertyValue(t),o=""!==r||De(e)?r:Ie(n,t);return null===o?undefined:o},Ie=function(e,t){return Ce(e)?e.style.getPropertyValue(t):""},Be=function(e,t){var n=e.dom(),r=Ie(n,t);return S.from(r).filter(function(e){return 0<e.length})},We=function(e,t){var n,r,o=e.dom();r=t,Ce(n=o)&&n.style.removeProperty(r),be(e,"style")&&""===ve(e,"style").replace(/^\s+|\s+$/g,"")&&we(e,"style")},Me=function(){return ae("Node")},_e=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},Le=function(e,t){return _e(e,t,Me().DOCUMENT_POSITION_CONTAINED_BY)},Fe=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.test(t))return r}return undefined}(e,t);if(!n)return{major:0,minor:0};var r=function(e){return Number(t.replace(n,"$"+e))};return ze(r(1),r(2))},je=function(){return ze(0,0)},ze=function(e,t){return{major:e,minor:t}},He={nu:ze,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?je():Fe(e,n)},unknown:je},Ue="Firefox",qe=function(e,t){return function(){return t===e}},Ve=function(e){var t=e.current;return{current:t,version:e.version,isEdge:qe("Edge",t),isChrome:qe("Chrome",t),isIE:qe("IE",t),isOpera:qe("Opera",t),isFirefox:qe(Ue,t),isSafari:qe("Safari",t)}},Ge={unknown:function(){return Ve({current:undefined,version:He.unknown()})},nu:Ve,edge:C("Edge"),chrome:C("Chrome"),ie:C("IE"),opera:C("Opera"),firefox:C(Ue),safari:C("Safari")},Ye="Windows",Xe="Android",Ke="Solaris",Je="FreeBSD",$e=function(e,t){return function(){return t===e}},Qe=function(e){var t=e.current;return{current:t,version:e.version,isWindows:$e(Ye,t),isiOS:$e("iOS",t),isAndroid:$e(Xe,t),isOSX:$e("OSX",t),isLinux:$e("Linux",t),isSolaris:$e(Ke,t),isFreeBSD:$e(Je,t)}},Ze={unknown:function(){return Qe({current:undefined,version:He.unknown()})},nu:Qe,windows:C(Ye),ios:C("iOS"),android:C(Xe),linux:C("Linux"),osx:C("OSX"),solaris:C(Ke),freebsd:C(Je)},et=function(e,t){var n=String(t).toLowerCase();return M(e,function(e){return e.search(n)})},tt=function(e,n){return et(e,n).map(function(e){var t=He.detect(e.versionRegexes,n);return{current:e.name,version:t}})},nt=function(e,n){return et(e,n).map(function(e){var t=He.detect(e.versionRegexes,n);return{current:e.name,version:t}})},rt=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ot=function(t){return function(e){return xe(e,t)}},it=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return xe(e,"edge/")&&xe(e,"chrome")&&xe(e,"safari")&&xe(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,rt],search:function(e){return xe(e,"chrome")&&!xe(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return xe(e,"msie")||xe(e,"trident")}},{name:"Opera",versionRegexes:[rt,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ot("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ot("firefox")},{name:"Safari",versionRegexes:[rt,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(xe(e,"safari")||xe(e,"mobile/"))&&xe(e,"applewebkit")}}],ut=[{name:"Windows",search:ot("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return xe(e,"iphone")||xe(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ot("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:ot("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ot("linux"),versionRegexes:[]},{name:"Solaris",search:ot("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ot("freebsd"),versionRegexes:[]}],at={browsers:C(it),oses:C(ut)},ct=function(e){var t,n,r,o,i,u,a,c,l,f,s,d=at.browsers(),m=at.oses(),g=tt(d,e).fold(Ge.unknown,Ge.nu),h=nt(m,e).fold(Ze.unknown,Ze.nu);return{browser:g,os:h,deviceType:(n=g,r=e,o=(t=h).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,c=o||u||a&&!0===/mobile/i.test(r),l=t.isiOS()||t.isAndroid(),f=l&&!c,s=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:C(o),isiPhone:C(i),isTablet:C(c),isPhone:C(f),isTouch:C(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:C(s)})}},lt={detect:Se(function(){var e=m.navigator.userAgent;return ct(e)})},ft=re,st=ne,dt=function(e,t){var n=e.dom();if(n.nodeType!==ft)return!1;var r=n;if(r.matches!==undefined)return r.matches(t);if(r.msMatchesSelector!==undefined)return r.msMatchesSelector(t);if(r.webkitMatchesSelector!==undefined)return r.webkitMatchesSelector(t);if(r.mozMatchesSelector!==undefined)return r.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},mt=function(e){return e.nodeType!==ft&&e.nodeType!==st||0===e.childElementCount},gt=function(e,t){return e.dom()===t.dom()},ht=lt.detect().browser.isIE()?function(e,t){return Le(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},pt=dt,vt=function(e){return Te.fromDom(e.dom().ownerDocument)},bt=function(e){return S.from(e.dom().parentNode).map(Te.fromDom)},wt=function(e,t){for(var n=T(t)?t:f,r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=Te.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},yt=function(e){return S.from(e.dom().previousSibling).map(Te.fromDom)},xt=function(e){return S.from(e.dom().nextSibling).map(Te.fromDom)},Ct=function(e){return A(e.dom().childNodes,Te.fromDom)},St=function(e,t){var n=e.dom().childNodes;return S.from(n[t]).map(Te.fromDom)},Rt=(X("element","offset"),function(t,n){bt(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})}),Tt=function(e,t){xt(e).fold(function(){bt(e).each(function(e){Ot(e,t)})},function(e){Rt(e,t)})},Dt=function(t,n){St(t,0).fold(function(){Ot(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},Ot=function(e,t){e.dom().appendChild(t.dom())},Nt=function(e,t){Rt(e,t),Ot(t,e)},Et=function(r,o){P(o,function(e,t){var n=0===t?r:o[t-1];Tt(n,e)})},kt=function(t,e){P(e,function(e){Ot(t,e)})},At=function(e){e.dom().textContent="",P(Ct(e),function(e){Pt(e)})},Pt=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},It=function(e){var t,n=Ct(e);0<n.length&&(t=e,P(n,function(e){Rt(t,e)})),Pt(e)},Bt=(X("width","height"),X("width","height"),X("rows","columns")),Wt=X("row","column"),Mt=(X("x","y"),X("element","rowspan","colspan")),_t=X("element","rowspan","colspan","isNew"),Lt=X("element","rowspan","colspan","row","column"),Ft=X("element","cells","section"),jt=X("element","isNew"),zt=X("element","cells","section","isNew"),Ht=X("cells","section"),Ut=X("details","section"),qt=X("startRow","startCol","finishRow","finishCol"),Vt=function(e,t){var n=[];return P(Ct(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(Vt(e,t))}),n},Gt=function(e,t,n){return r=function(e){return dt(e,t)},I(wt(e,n),r);var r},Yt=function(e,t){return n=function(e){return dt(e,t)},I(Ct(e),n);var n},Xt=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),mt(o)?[]:A(o.querySelectorAll(n),Te.fromDom);var n,r,o};function Kt(e,t,n,r,o){return e(n,r)?S.some(n):T(o)&&o(n)?S.none():t(n,r,o)}var Jt,$t,Qt,Zt=function(e,t,n){for(var r=e.dom(),o=T(n)?n:C(!1);r.parentNode;){r=r.parentNode;var i=Te.fromDom(r);if(t(i))return S.some(i);if(o(i))break}return S.none()},en=function(e,t,n){return Zt(e,function(e){return dt(e,t)},n)},tn=function(e,t){return n=function(e){return dt(e,t)},M(e.dom().childNodes,function(e){return n(Te.fromDom(e))}).map(Te.fromDom);var n},nn=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),mt(o)?S.none():S.from(o.querySelector(n)).map(Te.fromDom);var n,r,o},rn=function(e,t,n){return Kt(dt,en,e,t,n)},on=function(e,t,n){return z(Ct(e),function(e){return dt(e,t)?n(e)?[e]:[]:on(e,t,n)})},un={firstLayer:function(e,t){return on(e,t,C(!0))},filterFirstLayer:on},an=function(e,t,n){return void 0===n&&(n=f),n(t)?S.none():E(e,ce(t))?S.some(t):en(t,e.join(","),function(e){return dt(e,"table")||n(e)})},cn=function(t,e){return bt(e).map(function(e){return Yt(e,t)})},ln=b(cn,"th,td"),fn=b(cn,"tr"),sn=function(e,t){return parseInt(ve(e,t),10)},dn={cell:function(e,t){return an(["td","th"],e,t)},firstCell:function(e){return nn(e,"th,td")},cells:function(e){return un.firstLayer(e,"th,td")},neighbourCells:ln,table:function(e,t){return rn(e,"table",t)},row:function(e,t){return an(["tr"],e,t)},rows:function(e){return un.firstLayer(e,"tr")},notCell:function(e,t){return an(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:fn,attr:sn,grid:function(e,t,n){var r=sn(e,t),o=sn(e,n);return Bt(r,o)}},mn=function(e){var t=dn.rows(e);return A(t,function(e){var t=e,n=bt(t).map(function(e){var t=ce(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}).getOr("tbody"),r=A(dn.cells(e),function(e){var t=be(e,"rowspan")?parseInt(ve(e,"rowspan"),10):1,n=be(e,"colspan")?parseInt(ve(e,"colspan"),10):1;return Mt(e,t,n)});return Ft(t,r,n)})},gn=function(e,n){return A(e,function(e){var t=A(dn.cells(e),function(e){var t=be(e,"rowspan")?parseInt(ve(e,"rowspan"),10):1,n=be(e,"colspan")?parseInt(ve(e,"colspan"),10):1;return Mt(e,t,n)});return Ft(e,t,n.section())})},hn=function(e,t){return e+","+t},pn=function(e,t){var n=z(e.all(),function(e){return e.cells()});return I(n,t)},vn={generate:function(e){var l={},t=[],n=e.length,f=0;P(e,function(e,a){var c=[];P(e.cells(),function(e){for(var t=0;l[hn(a,t)]!==undefined;)t++;for(var n=Lt(e.element(),e.rowspan(),e.colspan(),a,t),r=0;r<e.colspan();r++)for(var o=0;o<e.rowspan();o++){var i=t+r,u=hn(a+o,i);l[u]=n,f=Math.max(f,i+1)}c.push(n)}),t.push(Ft(e.element(),c,e.section()))});var r=Bt(n,f);return{grid:C(r),access:C(l),all:C(t)}},getAt:function(e,t,n){var r=e.access()[hn(t,n)];return r!==undefined?S.some(r):S.none()},findItem:function(e,t,n){var r=pn(e,function(e){return n(t,e.element())});return 0<r.length?S.some(r[0]):S.none()},filterItems:pn,justCells:function(e){var t=A(e.all(),function(e){return e.cells()});return j(t)}},bn=X("minRow","minCol","maxRow","maxCol"),wn=function(e,t){var n,i,r,u,a,c,l,o,f,s,d=function(e){return dt(e.element(),t)},m=mn(e),g=vn.generate(m),h=(i=d,r=(n=g).grid().columns(),u=n.grid().rows(),a=r,l=c=0,V(n.access(),function(e){if(i(e)){var t=e.row(),n=t+e.rowspan()-1,r=e.column(),o=r+e.colspan()-1;t<u?u=t:c<n&&(c=n),r<a?a=r:l<o&&(l=o)}}),bn(u,a,c,l)),p="th:not("+t+"),td:not("+t+")",v=un.filterFirstLayer(e,"th,td",function(e){return dt(e,p)});return P(v,Pt),function(e,t,n,r){for(var o,i,u,a=t.grid().columns(),c=t.grid().rows(),l=0;l<c;l++)for(var f=!1,s=0;s<a;s++)l<n.minRow()||l>n.maxRow()||s<n.minCol()||s>n.maxCol()||(vn.getAt(t,l,s).filter(r).isNone()?(o=f,i=e[l].element(),u=Te.fromTag("td"),Ot(u,Te.fromTag("br")),(o?Ot:Dt)(i,u)):f=!0)}(m,g,h,d),o=e,f=h,s=I(un.firstLayer(o,"tr"),function(e){return 0===e.dom().childElementCount}),P(s,Pt),f.minCol()!==f.maxCol()&&f.minRow()!==f.maxRow()||P(un.firstLayer(o,"th,td"),function(e){we(e,"rowspan"),we(e,"colspan")}),we(o,"width"),we(o,"height"),We(o,"width"),We(o,"height"),e},yn=(Jt=me,$t="text",{get:function(e){if(!Jt(e))throw new Error("Can only get "+$t+" value of a "+$t+" node");return Qt(e).getOr("")},getOption:Qt=function(e){return Jt(e)?S.from(e.dom().nodeValue):S.none()},set:function(e,t){if(!Jt(e))throw new Error("Can only set raw "+$t+" value of a "+$t+" node");e.dom().nodeValue=t}}),xn=function(e){return yn.get(e)},Cn=function(e){return yn.getOption(e)},Sn=function(e,t){yn.set(e,t)},Rn=function(e){return"img"===ce(e)?1:Cn(e).fold(function(){return Ct(e).length},function(e){return e.length})},Tn=["img","br"],Dn=function(e){return Cn(e).filter(function(e){return 0!==e.trim().length||-1<e.indexOf("\xa0")}).isSome()||E(Tn,ce(e))},On=function(e){return o=Dn,(i=function(e){for(var t=0;t<e.childNodes.length;t++){var n=Te.fromDom(e.childNodes[t]);if(o(n))return S.some(n);var r=i(e.childNodes[t]);if(r.isSome())return r}return S.none()})(e.dom());var o,i},Nn=function(e){return En(e,Dn)},En=function(e,i){var u=function(e){for(var t=Ct(e),n=t.length-1;0<=n;n--){var r=t[n];if(i(r))return S.some(r);var o=u(r);if(o.isSome())return o}return S.none()};return u(e)},kn=function(e,t){return Te.fromDom(e.dom().cloneNode(t))},An=function(e){return kn(e,!1)},Pn=function(e){return kn(e,!0)},In=function(e,t){var n,r,o,i,u=(n=e,r=t,o=Te.fromTag(r),i=ye(n),pe(o,i),o),a=Ct(Pn(e));return kt(u,a),u},Bn=function(){var e=Te.fromTag("td");return Ot(e,Te.fromTag("br")),e},Wn=function(e,t,n){var r=In(e,t);return V(n,function(e,t){null===e?we(r,t):he(r,t,e)}),r},Mn=function(e){return e},_n=function(e){return function(){return Te.fromTag("tr",e.dom())}},Ln=function(d,e,m){return{row:_n(e),cell:function(e){var r,o,i,t,n,u,a,c=vt(e.element()),l=Te.fromTag(ce(e.element()),c.dom()),f=m.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),s=0<f.length?(r=e.element(),o=l,i=f,On(r).map(function(e){var t=i.join(","),n=Gt(e,t,function(e){return gt(e,r)});return B(n,function(e,t){var n=An(t);return we(n,"contenteditable"),Ot(e,n),n},o)}).getOr(o)):l;return Ot(s,Te.fromTag("br")),t=e.element(),n=l,u=t.dom(),a=n.dom(),Ce(u)&&Ce(a)&&(a.style.cssText=u.style.cssText),We(l,"height"),1!==e.colspan()&&We(e.element(),"width"),d(e.element(),l),l},replace:Wn,gap:Bn}},Fn=function(e){return{row:_n(e),cell:Bn,replace:Mn,gap:Bn}},jn=function(e,t){return t.column()>=e.startCol()&&t.column()+t.colspan()-1<=e.finishCol()&&t.row()>=e.startRow()&&t.row()+t.rowspan()-1<=e.finishRow()},zn=function(e,t){var n=t.column(),r=t.column()+t.colspan()-1,o=t.row(),i=t.row()+t.rowspan()-1;return n<=e.finishCol()&&r>=e.startCol()&&o<=e.finishRow()&&i>=e.startRow()},Hn=function(e,t){for(var n=!0,r=b(jn,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&vn.getAt(e,o,i).exists(r);return n?S.some(t):S.none()},Un=function(e,t,n){var r=vn.findItem(e,t,gt),o=vn.findItem(e,n,gt);return r.bind(function(r){return o.map(function(e){return t=r,n=e,qt(Math.min(t.row(),n.row()),Math.min(t.column(),n.column()),Math.max(t.row()+t.rowspan()-1,n.row()+n.rowspan()-1),Math.max(t.column()+t.colspan()-1,n.column()+n.colspan()-1));var t,n})})},qn=Un,Vn=function(t,e,n){return Un(t,e,n).bind(function(e){return Hn(t,e)})},Gn=function(r,e,o,i){return vn.findItem(r,e,gt).bind(function(e){var t=0<o?e.row()+e.rowspan()-1:e.row(),n=0<i?e.column()+e.colspan()-1:e.column();return vn.getAt(r,t+o,n+i).map(function(e){return e.element()})})},Yn=function(n,e,t){return qn(n,e,t).map(function(e){var t=vn.filterItems(n,b(zn,e));return A(t,function(e){return e.element()})})},Xn=function(e,t){return vn.findItem(e,t,function(e,t){return ht(t,e)}).map(function(e){return e.element()})},Kn=function(e){var t=mn(e);return vn.generate(t)},Jn=function(n,r,o){return dn.table(n).bind(function(e){var t=Kn(e);return Gn(t,n,r,o)})},$n=function(e,t,n){var r=Kn(e);return Yn(r,t,n)},Qn=function(e,t,n,r,o){var i=Kn(e),u=gt(e,n)?S.some(t):Xn(i,t),a=gt(e,o)?S.some(r):Xn(i,r);return u.bind(function(t){return a.bind(function(e){return Yn(i,t,e)})})},Zn=function(e,t,n){var r=Kn(e);return Vn(r,t,n)},er=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];function tr(){return{up:C({selector:en,closest:rn,predicate:Zt,all:wt}),down:C({selector:Xt,predicate:Vt}),styles:C({get:Pe,getRaw:Be,set:ke,remove:We}),attrs:C({get:ve,set:he,remove:we,copyTo:function(e,t){var n=ye(e);pe(t,n)}}),insert:C({before:Rt,after:Tt,afterAll:Et,append:Ot,appendAll:kt,prepend:Dt,wrap:Nt}),remove:C({unwrap:It,remove:Pt}),create:C({nu:Te.fromTag,clone:function(e){return Te.fromDom(e.dom().cloneNode(!1))},text:Te.fromText}),query:C({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:yt,nextSibling:xt}),property:C({children:Ct,name:ce,parent:bt,document:function(e){return e.dom().ownerDocument},isText:me,isComment:se,isElement:de,getText:xn,setText:Sn,isBoundary:function(e){return!!de(e)&&("body"===ce(e)||E(er,ce(e)))},isEmptyTag:function(e){return!!de(e)&&E(["br","img","hr","input"],ce(e))}}),eq:gt,is:pt}}var nr=X("left","right"),rr=X("first","second","splits"),or=function(e,t,n){var r=e.property().children(t);return _(r,b(e.eq,n)).map(function(e){return{before:C(r.slice(0,e)),after:C(r.slice(e+1))}})},ir=function(r,o,e,t){var n=o(r,e);return B(t,function(e,t){var n=o(r,t);return ur(r,e,n)},n)},ur=function(t,e,n){return e.bind(function(e){return n.filter(b(t.eq,e))})},ar=function(e,t){return b(e.eq,t)},cr=function(t,e,n,r){void 0===r&&(r=f);var o=[e].concat(t.up().all(e)),i=[n].concat(t.up().all(n)),u=function(t){return _(t,r).fold(function(){return t},function(e){return t.slice(0,e+1)})},a=u(o),c=u(i),l=M(a,function(e){return k(c,ar(t,e))});return{firstpath:C(a),secondpath:C(c),shared:C(l)}},lr={sharedOne:function(e,t,n){return 0<n.length?ir(e,t,(r=n)[0],r.slice(1)):S.none();var r},subset:function(t,e,n){var r=cr(t,e,n);return r.shared().bind(function(e){return function(o,i,e,t){var u=o.property().children(i);if(o.eq(i,e[0]))return S.some([e[0]]);if(o.eq(i,t[0]))return S.some([t[0]]);var n=function(e){var t=U(e),n=_(t,ar(o,i)).getOr(-1),r=n<t.length-1?t[n+1]:t[n];return _(u,ar(o,r))},r=n(e),a=n(t);return r.bind(function(r){return a.map(function(e){var t=Math.min(r,e),n=Math.max(r,e);return u.slice(t,n+1)})})}(t,e,r.firstpath(),r.secondpath())})},ancestors:cr,breakToLeft:function(n,r,o){return or(n,r,o).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.before().concat([o])),n.insert().appendAll(r,e.after()),n.insert().before(r,t),nr(t,r)})},breakToRight:function(n,r,e){return or(n,r,e).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.after()),n.insert().after(r,t),nr(r,t)})},breakPath:function(i,e,u,a){var c=function(e,t,o){var n=rr(e,S.none(),o);return u(e)?rr(e,t,o):i.property().parent(e).bind(function(r){return a(i,r,e).map(function(e){var t=[{first:e.left,second:e.right}],n=u(r)?r:e.left();return c(n,S.some(e.right()),o.concat(t))})}).getOr(n)};return c(e,S.none(),[])}},fr=tr(),sr={sharedOne:function(n,e){return lr.sharedOne(fr,function(e,t){return n(t)},e)},subset:function(e,t){return lr.subset(fr,e,t)},ancestors:function(e,t,n){return lr.ancestors(fr,e,t,n)},breakToLeft:function(e,t){return lr.breakToLeft(fr,e,t)},breakToRight:function(e,t){return lr.breakToRight(fr,e,t)},breakPath:function(e,t,r){return lr.breakPath(fr,e,t,function(e,t,n){return r(t,n)})}},dr={create:ee(["boxes","start","finish"],[])},mr=function(e){return en(e,"table")},gr=function(a,c,r){var l=function(t){return function(e){return r!==undefined&&r(e)||gt(e,t)}};return gt(a,c)?S.some(dr.create({boxes:S.some([a]),start:a,finish:c})):mr(a).bind(function(u){return mr(c).bind(function(i){if(gt(u,i))return S.some(dr.create({boxes:$n(u,a,c),start:a,finish:c}));if(ht(u,i)){var e=0<(t=Gt(c,"td,th",l(u))).length?t[t.length-1]:c;return S.some(dr.create({boxes:Qn(u,a,u,c,i),start:a,finish:e}))}if(ht(i,u)){var t,n=0<(t=Gt(a,"td,th",l(i))).length?t[t.length-1]:a;return S.some(dr.create({boxes:Qn(i,a,u,c,i),start:a,finish:n}))}return sr.ancestors(a,c).shared().bind(function(e){return rn(e,"table",r).bind(function(e){var t=Gt(c,"td,th",l(e)),n=0<t.length?t[t.length-1]:c,r=Gt(a,"td,th",l(e)),o=0<r.length?r[r.length-1]:a;return S.some(dr.create({boxes:Qn(e,a,u,c,i),start:o,finish:n}))})})})})},hr=gr,pr=function(e,t){var n=Xt(e,t);return 0<n.length?S.some(n):S.none()},vr=function(e,t,n,r,o){return(i=e,u=o,M(i,function(e){return dt(e,u)})).bind(function(e){return Jn(e,t,n).bind(function(e){return n=r,en(t=e,"table").bind(function(e){return nn(e,n).bind(function(e){return gr(e,t).bind(function(t){return t.boxes().map(function(e){return{boxes:C(e),start:C(t.start()),finish:C(t.finish())}})})})});var t,n})});var i,u},br=function(e,t,r){return nn(e,t).bind(function(n){return nn(e,r).bind(function(t){return sr.sharedOne(mr,[n,t]).map(function(e){return{first:C(n),last:C(t),table:C(e)}})})})},wr=function(e,t){return pr(e,t)},yr=function(o,e,t){return br(o,e,t).bind(function(n){var e=function(e){return gt(o,e)},t=en(n.first(),"thead,tfoot,tbody,table",e),r=en(n.last(),"thead,tfoot,tbody,table",e);return t.bind(function(t){return r.bind(function(e){return gt(t,e)?Zn(n.table(),n.first(),n.last()):S.none()})})})},xr="data-mce-selected",Cr="data-mce-first-selected",Sr="data-mce-last-selected",Rr={selected:C(xr),selectedSelector:C("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:C("[data-mce-selected]"),firstSelected:C(Cr),firstSelectedSelector:C("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:C(Sr),lastSelectedSelector:C("td[data-mce-last-selected],th[data-mce-last-selected]")},Tr=function(u){if(!w(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],n={};return P(u,function(e,r){var t=q(e);if(1!==t.length)throw new Error("one and only one name per case");var o=t[0],i=e[o];if(n[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!w(i))throw new Error("case arguments must be an array");a.push(o),n[o]=function(){var e=arguments.length;if(e!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+e);for(var n=new Array(e),t=0;t<n.length;t++)n[t]=arguments[t];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[r].apply(null,n)},match:function(e){var t=q(e);if(a.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+t.join(","));if(!H(a,function(e){return E(t,e)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+a.join(", "));return e[o].apply(null,n)},log:function(e){m.console.log(e,{constructors:a,constructor:o,params:n})}}}}),n},Dr=Tr([{none:[]},{multiple:["elements"]},{single:["selection"]}]),Or={cata:function(e,t,n,r){return e.fold(t,n,r)},none:Dr.none,multiple:Dr.multiple,single:Dr.single},Nr=function(e,t){return Or.cata(t.get(),C([]),o,C([e]))},Er=function(n,e){return Or.cata(e.get(),S.none,function(t,e){return 0===t.length?S.none():yr(n,Rr.firstSelectedSelector(),Rr.lastSelectedSelector()).bind(function(e){return 1<t.length?S.some({bounds:C(e),cells:C(t)}):S.none()})},S.none)},kr=function(e,t){var n=Nr(e,t);return 0<n.length&&H(n,function(e){return be(e,"rowspan")&&1<parseInt(ve(e,"rowspan"),10)||be(e,"colspan")&&1<parseInt(ve(e,"colspan"),10)})?S.some(n):S.none()},Ar=Nr,Pr=function(e){return{element:C(e),mergable:S.none,unmergable:S.none,selection:C([e])}},Ir=X("element","clipboard","generators"),Br={noMenu:Pr,forMenu:function(e,t,n){return{element:C(n),mergable:C(Er(t,e)),unmergable:C(kr(n,e)),selection:C(Ar(n,e))}},notCell:function(e){return Pr(e)},paste:Ir,pasteRows:function(e,t,n,r,o){return{element:C(n),mergable:S.none,unmergable:S.none,selection:C(Ar(n,e)),clipboard:C(r),generators:C(o)}}},Wr=function(f,e,s,d){f.on("BeforeGetContent",function(n){!0===n.selection&&Or.cata(e.get(),y,function(e){var t;n.preventDefault(),(t=e,dn.table(t[0]).map(Pn).map(function(e){return[wn(e,Rr.attributeSelector())]})).each(function(e){var t;n.content="text"===n.format?A(e,function(e){return e.dom().innerText}).join(""):(t=f,A(e,function(e){return t.selection.serializer.serialize(e.dom(),{})}).join(""))})},y)}),f.on("BeforeSetContent",function(l){!0===l.selection&&!0===l.paste&&S.from(f.dom.getParent(f.selection.getStart(),"th,td")).each(function(e){var c=Te.fromDom(e);dn.table(c).each(function(t){var e,n,r,o=I((e=l.content,(r=(n||m.document).createElement("div")).innerHTML=e,Ct(Te.fromDom(r))),function(e){return"meta"!==ce(e)});if(1===o.length&&"table"===ce(o[0])){l.preventDefault();var i=Te.fromDom(f.getDoc()),u=Fn(i),a=Br.paste(c,o[0],u);s.pasteCells(t,a).each(function(e){f.selection.setRng(e),f.focus(),d.clear(t)})}})})})};function Mr(r,o){var e=function(e){var t=o(e);if(t<=0||null===t){var n=Pe(e,r);return parseFloat(n)||0}return t},i=function(o,e){return W(e,function(e,t){var n=Pe(o,t),r=n===undefined?0:parseInt(n,10);return isNaN(r)?e:e+r},0)};return{set:function(e,t){if(!D(t)&&!t.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+t);var n=e.dom();Ce(n)&&(n.style[r]=t+"px")},get:e,getOuter:e,aggregate:i,max:function(e,t,n){var r=i(e,n);return r<t?t-r:0}}}var _r=Mr("height",function(e){var t=e.dom();return De(e)?t.getBoundingClientRect().height:t.offsetHeight}),Lr=function(e){return _r.get(e)},Fr=function(e){return _r.getOuter(e)},jr=Mr("width",function(e){return e.dom().offsetWidth}),zr=function(e){return jr.get(e)},Hr=function(e){return jr.getOuter(e)},Ur=lt.detect(),qr=function(e,t,n){return r=Pe(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},Vr=function(e){return Ur.browser.isIE()||Ur.browser.isEdge()?(n=qr(t=e,"padding-top",0),r=qr(t,"padding-bottom",0),o=qr(t,"border-top-width",0),i=qr(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===Pe(t,"box-sizing")?u:u-n-r-(o+i)):qr(e,"height",Lr(e));var t,n,r,o,i,u},Gr=/(\d+(\.\d+)?)(\w|%)*/,Yr=/(\d+(\.\d+)?)%/,Xr=/(\d+(\.\d+)?)px|em/,Kr=function(e,t){ke(e,"height",t+"px")},Jr=function(e,t,n,r){var o,i,u,a,c,l,f,s,d,m=parseInt(e,10);return s=l="%",d=(f=e).length-l.length,""!==s&&(f.length<s.length||f.substr(d,d+s.length)!==s)||"table"===ce(t)?m:(o=t,i=m,u=n,a=r,c=dn.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),a(o,c),c)},$r=function(e){var t,n=Be(t=e,"height").getOrThunk(function(){return Vr(t)+"px"});return n?Jr(n,e,Lr,Kr):Lr(e)},Qr=function(e,t){return be(e,t)?parseInt(ve(e,t),10):1},Zr=function(e){return Be(e,"width").fold(function(){return S.from(ve(e,"width"))},function(e){return S.some(e)})},eo=function(e,t){return e/t.pixelWidth()*100},to={percentageBasedSizeRegex:C(Yr),pixelBasedSizeRegex:C(Xr),setPixelWidth:function(e,t){ke(e,"width",t+"px")},setPercentageWidth:function(e,t){ke(e,"width",t+"%")},setHeight:Kr,getPixelWidth:function(t,n){return Zr(t).fold(function(){return zr(t)},function(e){return function(e,t,n){var r=Xr.exec(t);if(null!==r)return parseInt(r[1],10);var o=Yr.exec(t);if(null!==o){var i=parseFloat(o[1]);return i/100*n.pixelWidth()}return zr(e)}(t,e,n)})},getPercentageWidth:function(t,n){return Zr(t).fold(function(){var e=zr(t);return eo(e,n)},function(e){return function(e,t,n){var r=Yr.exec(t);if(null!==r)return parseFloat(r[1]);var o=zr(e);return eo(o,n)}(t,e,n)})},getGenericWidth:function(e){return Zr(e).bind(function(e){var t=Gr.exec(e);return null!==t?S.some({width:C(parseFloat(t[1])),unit:C(t[3])}):S.none()})},setGenericWidth:function(e,t,n){ke(e,"width",t+n)},getHeight:function(e){return n="rowspan",$r(t=e)/Qr(t,n);var t,n},getRawWidth:Zr},no=function(n,r){to.getGenericWidth(n).each(function(e){var t=e.width()/2;to.setGenericWidth(n,t,e.unit()),to.setGenericWidth(r,t,e.unit())})},ro=function(n,r){return{left:C(n),top:C(r),translate:function(e,t){return ro(n+e,r+t)}}},oo=ro,io=function(e,t){return e!==undefined?e:t!==undefined?t:0},uo=function(e){var t=e.dom().ownerDocument,n=t.body,r=t.defaultView,o=t.documentElement,i=io(r.pageYOffset,o.scrollTop),u=io(r.pageXOffset,o.scrollLeft),a=io(o.clientTop,n.clientTop),c=io(o.clientLeft,n.clientLeft);return ao(e).translate(u-c,i-a)},ao=function(e){var t,n=e.dom(),r=n.ownerDocument.body;return r===n?oo(r.offsetLeft,r.offsetTop):De(e)?(t=n.getBoundingClientRect(),oo(t.left,t.top)):oo(0,0)},co=X("row","y"),lo=X("col","x"),fo=function(e){return uo(e).left()+Hr(e)},so=function(e){return uo(e).left()},mo=function(e,t){return lo(e,so(t))},go=function(e,t){return lo(e,fo(t))},ho=function(e){return uo(e).top()},po=function(e,t){return co(e,ho(t))},vo=function(e,t){return co(e,ho(t)+Fr(t))},bo=function(n,t,r){if(0===r.length)return[];var e=A(r.slice(1),function(e,t){return e.map(function(e){return n(t,e)})}),o=r[r.length-1].map(function(e){return t(r.length-1,e)});return e.concat([o])},wo={height:{delta:o,positions:function(e){return bo(po,vo,e)},edge:ho},rtl:{delta:function(e){return-e},edge:fo,positions:function(e){return bo(go,mo,e)}},ltr:{delta:o,edge:so,positions:function(e){return bo(mo,go,e)}}},yo={ltr:wo.ltr,rtl:wo.rtl};function xo(t){var n=function(e){return t(e).isRtl()?yo.rtl:yo.ltr};return{delta:function(e,t){return n(t).delta(e,t)},edge:function(e){return n(e).edge(e)},positions:function(e,t){return n(t).positions(e,t)}}}var Co=function(e){var t=mn(e);return vn.generate(t).grid()},So=function(){return(So=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Ro=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},To=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return S.none()},Do=function(e,t,n,r){n===r?we(e,t):he(e,t,n)},Oo=function(o,e){var i=[],u=[],t=function(e,t){0<e.length?function(e,t){var n=tn(o,t).getOrThunk(function(){var e=Te.fromTag(t,vt(o).dom());return Ot(o,e),e});At(n);var r=A(e,function(e){e.isNew()&&i.push(e.element());var t=e.element();return At(t),P(e.cells(),function(e){e.isNew()&&u.push(e.element()),Do(e.element(),"colspan",e.colspan(),1),Do(e.element(),"rowspan",e.rowspan(),1),Ot(t,e.element())}),t});kt(n,r)}(e,t):tn(o,t).each(Pt)},n=[],r=[],a=[];return P(e,function(e){switch(e.section()){case"thead":n.push(e);break;case"tbody":r.push(e);break;case"tfoot":a.push(e)}}),t(n,"thead"),t(r,"tbody"),t(a,"tfoot"),{newRows:C(i),newCells:C(u)}},No=function(e){return A(e,function(e){var n=An(e.element());return P(e.cells(),function(e){var t=Pn(e.element());Do(t,"colspan",e.colspan(),1),Do(t,"rowspan",e.rowspan(),1),Ot(n,t)}),n})},Eo=function(e,t){var n=ve(e,t);return n===undefined||""===n?[]:n.split(" ")},ko=function(e){return e.dom().classList!==undefined},Ao=function(e,t){return o=t,i=Eo(n=e,r="class").concat([o]),he(n,r,i.join(" ")),!0;var n,r,o,i},Po=function(e,t){return o=t,0<(i=I(Eo(n=e,r="class"),function(e){return e!==o})).length?he(n,r,i.join(" ")):we(n,r),!1;var n,r,o,i},Io=function(e,t){ko(e)?e.dom().classList.add(t):Ao(e,t)},Bo=function(e){0===(ko(e)?e.dom().classList:Eo(e,"class")).length&&we(e,"class")},Wo=function(e,t){return ko(e)&&e.dom().classList.contains(t)},Mo=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},_o=function(t,n){if(n<0||n>=t.length-1)return S.none();var e=t[n].fold(function(){var e=U(t.slice(0,n));return To(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return S.some({value:e,delta:0})}),r=t[n+1].fold(function(){var e=t.slice(n+1);return To(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return S.some({value:e,delta:1})});return e.bind(function(n){return r.map(function(e){var t=e.delta+n.delta;return Math.abs(e.value-n.value)/t})})},Lo=function(e,t,n){var r=e();return M(r,t).orThunk(function(){return S.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},Fo=function(n){var e=n.grid(),t=Mo(0,e.columns()),r=Mo(0,e.rows());return A(t,function(t){return Lo(function(){return z(r,function(e){return vn.getAt(n,e,t).filter(function(e){return e.column()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return vn.getAt(n,0,t)})})},jo=function(n){var e=n.grid(),t=Mo(0,e.rows()),r=Mo(0,e.columns());return A(t,function(t){return Lo(function(){return z(r,function(e){return vn.getAt(n,t,e).filter(function(e){return e.row()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return vn.getAt(n,t,0)})})},zo=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},Ho={resolve:zo("ephox-snooker").resolve},Uo=function(e,t,n,r,o){var i=Te.fromTag("div");return Ae(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),pe(i,{"data-column":e,role:"presentation"}),i},qo=function(e,t,n,r,o){var i=Te.fromTag("div");return Ae(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),pe(i,{"data-row":e,role:"presentation"}),i},Vo=Ho.resolve("resizer-bar"),Go=Ho.resolve("resizer-rows"),Yo=Ho.resolve("resizer-cols"),Xo=function(e){var t=Xt(e.parent(),"."+Vo);P(t,Pt)},Ko=function(n,e,r){var o=n.origin();P(e,function(e,t){e.each(function(e){var t=r(o,e);Io(t,Vo),Ot(n.parent(),t)})})},Jo=function(e,t,n,r,o,i){var u,a,c,l,f=uo(t),s=0<n.length?o.positions(n,t):[];u=e,a=s,c=f,l=Hr(t),Ko(u,a,function(e,t){var n=qo(t.row(),c.left()-e.left(),t.y()-e.top(),l,7);return Io(n,Go),n});var d,m,g,h,p=0<r.length?i.positions(r,t):[];d=e,m=p,g=f,h=Fr(t),Ko(d,m,function(e,t){var n=Uo(t.col(),t.x()-e.left(),g.top()-e.top(),7,h);return Io(n,Yo),n})},$o=function(e,t){var n=Xt(e.parent(),"."+Vo);P(n,t)},Qo=function(e,t,n,r){Xo(e);var o=mn(t),i=vn.generate(o),u=jo(i),a=Fo(i);Jo(e,t,u,a,n,r)},Zo=function(e){$o(e,function(e){ke(e,"display","none")})},ei=function(e){$o(e,function(e){ke(e,"display","block")})},ti=Xo,ni=function(e){return Wo(e,Go)},ri=function(e){return Wo(e,Yo)},oi=function(e,t){return Ht(t,e.section())},ii=function(e,t){return e.cells()[t]},ui={addCell:function(e,t,n){var r=e.cells(),o=r.slice(0,t),i=r.slice(t),u=o.concat([n]).concat(i);return oi(e,u)},setCells:oi,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:ii,getCellElement:function(e,t){return ii(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=A(n,t);return Ht(r,e.section())},cellLength:function(e){return e.cells().length}},ai=function(e,t){if(0===e.length)return 0;var n=e[0];return _(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},ci=function(e,t,n,r){var o,i,u,a,c=(o=e,i=t,o[i]).cells().slice(n),l=ai(c,r),f=(u=e,a=n,A(u,function(e){return ui.getCell(e,a)})).slice(t),s=ai(f,r);return{colspan:C(l),rowspan:C(s)}},li=function(o,i){var u=A(o,function(e,t){return A(e.cells(),function(e,t){return!1})});return A(o,function(e,r){var t=z(e.cells(),function(e,t){if(!1===u[r][t]){var n=ci(o,r,t,i);return function(e,t,n,r){for(var o=e;o<e+n;o++)for(var i=t;i<t+r;i++)u[o][i]=!0}(r,t,n.rowspan(),n.colspan()),[_t(e.element(),n.rowspan(),n.colspan(),e.isNew())]}return[]});return Ut(t,e.section())})},fi=function(e,t,n){for(var r=[],o=0;o<e.grid().rows();o++){for(var i=[],u=0;u<e.grid().columns();u++){var a=vn.getAt(e,o,u).map(function(e){return jt(e.element(),n)}).getOrThunk(function(){return jt(t.gap(),!0)});i.push(a)}var c=Ht(i,e.all()[o].section());r.push(c)}return r},si=function(e,r){return A(e,function(e){var t,n=(t=e.details(),To(t,function(e){return bt(e.element()).map(function(e){var t=bt(e).isNone();return jt(e,t)})}).getOrThunk(function(){return jt(r.row(),!0)}));return zt(n.element(),e.details(),e.section(),n.isNew())})},di=function(e,t){var n=li(e,gt);return si(n,t)},mi=function(e,t){var n=j(A(e.all(),function(e){return e.cells()}));return M(n,function(e){return gt(t,e.element())})},gi=function(a,c,l,f,s){return function(n,r,e,o,i){var t=mn(r),u=vn.generate(t);return c(u,e).map(function(e){var t=fi(u,o,!1),n=a(t,e,gt,s(o)),r=di(n.grid(),o);return{grid:C(r),cursor:n.cursor}}).fold(function(){return S.none()},function(e){var t=Oo(r,e.grid());return l(r,e.grid(),i),f(r),Qo(n,r,wo.height,i),S.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},hi=function(t,e){return dn.cell(e.element()).bind(function(e){return mi(t,e)})},pi=function(t,e){var n=A(e.selection(),function(e){return dn.cell(e).bind(function(e){return mi(t,e)})}),r=Ro(n);return 0<r.length?S.some({cells:r,generators:e.generators,clipboard:e.clipboard}):S.none()},vi=function(t,e){var n=A(e.selection(),function(e){return dn.cell(e).bind(function(e){return mi(t,e)})}),r=Ro(n);return 0<r.length?S.some(r):S.none()},bi=function(n){return{is:function(e){return n===e},isValue:a,isError:f,getOr:C(n),getOrThunk:C(n),getOrDie:C(n),or:function(e){return bi(n)},orThunk:function(e){return bi(n)},fold:function(e,t){return t(n)},map:function(e){return bi(e(n))},mapError:function(e){return bi(n)},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return S.some(n)}}},wi=function(n){return{is:f,isValue:f,isError:a,getOr:o,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(n),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return wi(n)},mapError:function(e){return wi(e(n))},each:y,bind:function(e){return wi(n)},exists:f,forall:a,toOption:S.none}},yi={value:bi,error:wi,fromOption:function(e,t){return e.fold(function(){return wi(t)},bi)}},xi=function(e,t){return A(e,function(){return jt(t.cell(),!0)})},Ci=function(t,e,n){return t.concat(function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n}(e,function(e){return ui.setCells(t[t.length-1],xi(t[t.length-1].cells(),n))}))},Si=function(e,t,n){return A(e,function(e){return ui.setCells(e,e.cells().concat(xi(Mo(0,t),n)))})},Ri=function(e,t,n){if(e.row()>=t.length||e.column()>ui.cellLength(t[0]))return yi.error("invalid start address out of table bounds, row: "+e.row()+", column: "+e.column());var r=t.slice(e.row()),o=r[0].cells().slice(e.column()),i=ui.cellLength(n[0]),u=n.length;return yi.value({rowDelta:C(r.length-u),colDelta:C(o.length-i)})},Ti=function(e,t){var n=ui.cellLength(e[0]),r=ui.cellLength(t[0]);return{rowDelta:C(0),colDelta:C(n-r)}},Di=function(e,t,n){var r=t.colDelta()<0?Si:o;return(t.rowDelta()<0?Ci:o)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},Oi=function(e,t,n,r){if(0===e.length)return e;for(var o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)ui.mutateCell(e[o],i,jt(r(),!1));return e},Ni=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<ui.cellLength(e[0]);u++){var a=n(ui.getCellElement(e[i],u),t);!0===a&&!1===o?ui.mutateCell(e[i],u,jt(r(),!0)):!0===a&&(o=!1)}return e},Ei=function(i,n,u,a){if(0<n&&n<i.length){var e=i[n-1].cells(),t=(r=u,W(e,function(e,t){return k(e,function(e){return r(e.element(),t.element())})?e:e.concat([t])},[]));P(t,function(r){for(var o=S.none(),e=function(n){for(var e=function(t){var e=i[n].cells()[t];u(e.element(),r.element())&&(o.isNone()&&(o=S.some(a())),o.each(function(e){ui.mutateCell(i[n],t,jt(e,!0))}))},t=0;t<ui.cellLength(i[0]);t++)e(t)},t=n;t<i.length;t++)e(t)})}var r;return i},ki=function(n,r,o,i,u){return Ri(n,r,o).map(function(e){var t=Di(r,e,i);return function(e,t,n,r,o){for(var i,u,a,c,l,f=e.row(),s=e.column(),d=f+n.length,m=s+ui.cellLength(n[0]),g=f;g<d;g++)for(var h=s;h<m;h++){i=t,u=g,a=h,l=c=void 0,c=b(o,ui.getCell(i[u],a).element()),l=i[u],1<i.length&&1<ui.cellLength(l)&&(0<a&&c(ui.getCellElement(l,a-1))||a<l.cells().length-1&&c(ui.getCellElement(l,a+1))||0<u&&c(ui.getCellElement(i[u-1],a))||u<i.length-1&&c(ui.getCellElement(i[u+1],a)))&&Ni(t,ui.getCellElement(t[g],h),o,r.cell);var p=ui.getCellElement(n[g-f],h-s),v=r.replace(p);ui.mutateCell(t[g],h,jt(v,!0))}return t}(n,t,o,i,u)})},Ai=function(e,t,n,r,o){Ei(t,e,o,r.cell);var i=Ti(n,t),u=Di(n,i,r),a=Ti(t,u),c=Di(t,a,r);return c.slice(0,e).concat(u).concat(c.slice(e,c.length))},Pi=function(n,r,e,o,i){var t=n.slice(0,r),u=n.slice(r),a=ui.mapCells(n[e],function(e,t){return 0<r&&r<n.length&&o(ui.getCellElement(n[r-1],t),ui.getCellElement(n[r],t))?ui.getCell(n[r],t):jt(i(e.element(),o),!0)});return t.concat([a]).concat(u)},Ii=function(e,n,r,o,i){return A(e,function(e){var t=0<n&&n<ui.cellLength(e)&&o(ui.getCellElement(e,n-1),ui.getCellElement(e,n))?ui.getCell(e,n):jt(i(ui.getCellElement(e,r),o),!0);return ui.addCell(e,n,t)})},Bi=function(e,r,o,i,u){var a=o+1;return A(e,function(e,t){var n=t===r?jt(u(ui.getCellElement(e,o),i),!0):ui.getCell(e,o);return ui.addCell(e,a,n)})},Wi=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),a=e.slice(i),c=ui.mapCells(e[t],function(e,t){return t===n?jt(o(e.element(),r),!0):e});return u.concat([c]).concat(a)},Mi=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},_i=function(e,n,r){var t=A(e,function(e){var t=e.cells().slice(0,n).concat(e.cells().slice(r+1));return Ht(t,e.section())});return I(t,function(e){return 0<e.cells().length})},Li=function(e,n,r,o){return A(e,function(e){return ui.mapCells(e,function(e){return t=e,k(n,function(e){return r(t.element(),e.element())})?jt(o(e.element(),r),!0):e;var t})})},Fi=function(e,t,n,r){return ui.getCellElement(e[t],n)!==undefined&&0<t&&r(ui.getCellElement(e[t-1],n),ui.getCellElement(e[t],n))},ji=function(e,t,n){return 0<t&&n(ui.getCellElement(e,t-1),ui.getCellElement(e,t))},zi=function(n,r,o,e){var t=z(n,function(e,t){return Fi(n,t,r,o)||ji(e,r,o)?[]:[ui.getCell(e,r)]});return Li(n,t,o,e)},Hi=function(n,r,o,e){var i=n[r],t=z(i.cells(),function(e,t){return Fi(n,r,t,o)||ji(i,t,o)?[]:[e]});return Li(n,t,o,e)},Ui=Tr([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),qi=So({},Ui),Vi=function(e,t,i,u){var n,r,a=e.slice(0),o=(r=t,0===(n=e).length?qi.none():1===n.length?qi.only(0):0===r?qi.left(0,1):r===n.length-1?qi.right(r-1,r):0<r&&r<n.length-1?qi.middle(r-1,r,r+1):qi.none()),c=function(e){return A(e,C(0))},l=C(c(a)),f=function(e,t){if(0<=i){var n=Math.max(u.minCellWidth(),a[t]-i);return c(a.slice(0,e)).concat([i,n-a[t]]).concat(c(a.slice(t+1)))}var r=Math.max(u.minCellWidth(),a[e]+i),o=a[e]-r;return c(a.slice(0,e)).concat([r-a[e],o]).concat(c(a.slice(t+1)))},s=f;return o.fold(l,function(e){return u.singleColumnWidth(a[e],i)},s,function(e,t,n){return f(t,n)},function(e,t){if(0<=i)return c(a.slice(0,t)).concat([i]);var n=Math.max(u.minCellWidth(),a[t]+i);return c(a.slice(0,t)).concat([n-a[t]])})},Gi=function(e,t){return be(e,t)&&1<parseInt(ve(e,t),10)},Yi={hasColspan:function(e){return Gi(e,"colspan")},hasRowspan:function(e){return Gi(e,"rowspan")},minWidth:C(10),minHeight:C(10),getInt:function(e,t){return parseInt(Pe(e,t),10)}},Xi=function(e,t,n){return Be(e,t).fold(function(){return n(e)+"px"},function(e){return e})},Ki=function(e,t){return Xi(e,"width",function(e){return to.getPixelWidth(e,t)})},Ji=function(e){return Xi(e,"height",to.getHeight)},$i=function(e,t,n,r,o){var i=Fo(e),u=A(i,function(e){return e.map(t.edge)});return A(i,function(e,t){return e.filter(g(Yi.hasColspan)).fold(function(){var e=_o(u,t);return r(e)},function(e){return n(e,o)})})},Qi=function(e){return e.map(function(e){return e+"px"}).getOr("")},Zi=function(e,t,n,r){var o=jo(e),i=A(o,function(e){return e.map(t.edge)});return A(o,function(e,t){return e.filter(g(Yi.hasRowspan)).fold(function(){var e=_o(i,t);return r(e)},function(e){return n(e)})})},eu={getRawWidths:function(e,t,n){return $i(e,t,Ki,Qi,n)},getPixelWidths:function(e,t,n){return $i(e,t,to.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return $i(e,t,to.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return Zi(e,t,to.getHeight,function(e){return e.getOrThunk(Yi.minHeight)})},getRawHeights:function(e,t){return Zi(e,t,Ji,Qi)}},tu=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},nu=function(e,n){var t=vn.justCells(e);return A(t,function(e){var t=tu(e.column(),e.column()+e.colspan(),n);return{element:e.element,width:C(t),colspan:e.colspan}})},ru=function(e,n){var t=vn.justCells(e);return A(t,function(e){var t=tu(e.row(),e.row()+e.rowspan(),n);return{element:e.element,height:C(t),rowspan:e.rowspan}})},ou=function(e,n){return A(e.all(),function(e,t){return{element:e.element,height:C(n[t])}})},iu=function(e){var t=o;return{width:C(e),pixelWidth:C(e),getWidths:eu.getPixelWidths,getCellDelta:t,singleColumnWidth:function(e,t){return[Math.max(Yi.minWidth(),e+t)-e]},minCellWidth:Yi.minWidth,setElementWidth:to.setPixelWidth,setTableWidth:function(e,t,n){var r=B(t,function(e,t){return e+t},0);to.setPixelWidth(e,r)}}},uu=function(e,t){var n,r,o,i,u=to.percentageBasedSizeRegex().exec(t);if(null!==u)return n=u[1],r=e,o=parseFloat(n),i=zr(r),{width:C(o),pixelWidth:C(i),getWidths:eu.getPercentageWidths,getCellDelta:function(e){return e/i*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return Yi.minWidth()/i*100},setElementWidth:to.setPercentageWidth,setTableWidth:function(e,t,n){var r=n/100*o;to.setPercentageWidth(e,o+r)}};var a=to.pixelBasedSizeRegex().exec(t);if(null!==a){var c=parseInt(a[1],10);return iu(c)}var l=zr(e);return iu(l)},au=function(t){return to.getRawWidth(t).fold(function(){var e=zr(t);return iu(e)},function(e){return uu(t,e)})},cu=function(e){return vn.generate(e)},lu=function(e){var t=mn(e);return cu(t)},fu=function(e,t,n,r){var o=au(e),i=o.getCellDelta(t),u=lu(e),a=o.getWidths(u,r,o),c=Vi(a,n,i,o),l=A(c,function(e,t){return e+a[t]}),f=nu(u,l);P(f,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},su=function(e,n,r,t){var o=lu(e),i=eu.getPixelHeights(o,t),u=A(i,function(e,t){return r===t?Math.max(n+e,Yi.minHeight()):e}),a=ru(o,u),c=ou(o,u);P(c,function(e){to.setHeight(e.element(),e.height())}),P(a,function(e){to.setHeight(e.element(),e.height())});var l=B(u,function(e,t){return e+t},0);to.setHeight(e,l)},du=function(e,t,n){var r=au(e),o=cu(t),i=r.getWidths(o,n,r),u=nu(o,i);P(u,function(e){r.setElementWidth(e.element(),e.width())}),0<u.length&&r.setTableWidth(e,i,r.getCellDelta(0))},mu=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return mu(n())}}},gu=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return Q("required",o),Z(o),function(t){var n=q(t);H(o,function(e){return E(n,e)})||J(o,n),r(o,n);var e=I(o,function(e){return!i.validate(t[e],e)});return 0<e.length&&function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+K(e).join(", ")+") were not.")}(e,i.label),t}},hu=function(t,e){var n=I(e,function(e){return!E(t,e)});0<n.length&&$(n)},pu=function(e){return gu(hu,e,{validate:T,label:"function"})},vu=pu(["cell","row","replace","gap"]),bu=function(e){var t=be(e,"colspan")?parseInt(ve(e,"colspan"),10):1,n=be(e,"rowspan")?parseInt(ve(e,"rowspan"),10):1;return{element:C(e),colspan:C(t),rowspan:C(n)}},wu=function(r,o){void 0===o&&(o=bu),vu(r);var n=mu(S.none()),i=function(e){var t,n=o(e);return t=n,r.cell(t)},u=function(e){var t=i(e);return n.get().isNone()&&n.set(S.some(t)),a=S.some({item:e,replacement:t}),t},a=S.none();return{getOrInit:function(t,n){return a.fold(function(){return u(t)},function(e){return n(t,e.item)?e.replacement:u(t)})},cursor:n.get}},yu=function(a,c){return function(r){var o=mu(S.none());vu(r);var i=[],u=function(e){var t={scope:a},n=r.replace(e,c,t);return i.push({item:e,sub:n}),o.get().isNone()&&o.set(S.some(n)),n};return{replaceOrInit:function(t,n){return(r=t,o=n,M(i,function(e){return o(e.item,r)})).fold(function(){return u(t)},function(e){return n(t,e.item)?e.sub:u(t)});var r,o},cursor:o.get}}},xu=function(n){vu(n);var e=mu(S.none());return{combine:function(t){return e.get().isNone()&&e.set(S.some(t)),function(){var e=n.cell({element:C(t),colspan:C(1),rowspan:C(1)});return We(e,"width"),We(t,"width"),e}},cursor:e.get}},Cu=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Su=function(e,t){var n=e.property().name(t);return E(Cu,n)},Ru=function(e,t){return E(["br","img","hr","input"],e.property().name(t))},Tu=Su,Du=function(e,t){var n=e.property().name(t);return E(["ol","ul"],n)},Ou=Ru,Nu=tr(),Eu=function(e){return Tu(Nu,e)},ku=function(e){return Du(Nu,e)},Au=function(e){return Ou(Nu,e)},Pu=function(e){var t,i=function(e){return"br"===ce(e)},n=function(o){return Nn(o).bind(function(n){var r=xt(n).map(function(e){return!!Eu(e)||!!Au(e)&&"img"!==ce(e)}).getOr(!1);return bt(n).map(function(e){return!0===r||"li"===ce(t=e)||Zt(t,ku).isSome()||i(n)||Eu(e)&&!gt(o,e)?[]:[Te.fromTag("br")];var t})}).getOr([])},r=0===(t=z(e,function(e){var t=Ct(e);return H(t,function(e){return i(e)||me(e)&&0===xn(e).trim().length})?[]:t.concat(n(e))})).length?[Te.fromTag("br")]:t;At(e[0]),kt(e[0],r)},Iu=function(e){0===dn.cells(e).length&&Pt(e)},Bu=X("grid","cursor"),Wu=function(e,t,n){return Mu(e,t,n).orThunk(function(){return Mu(e,0,0)})},Mu=function(e,t,n){return S.from(e[t]).bind(function(e){return S.from(e.cells()[n]).bind(function(e){return S.from(e.element())})})},_u=function(e,t,n){return Bu(e,Mu(e,t,n))},Lu=function(e){return W(e,function(e,t){return k(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},Fu=function(e){return W(e,function(e,t){return k(e,function(e){return e.column()===t.column()})?e:e.concat([t])},[]).sort(function(e,t){return e.column()-t.column()})},ju=function(e,t,n){var r=gn(e,n),o=vn.generate(r);return fi(o,t,!0)},zu=du,Hu={insertRowBefore:gi(function(e,t,n,r){var o=t.row(),i=t.row(),u=Pi(e,i,o,n,r.getOrInit);return _u(u,i,t.column())},hi,y,y,wu),insertRowsBefore:gi(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=Lu(t),a=W(u,function(e,t){return Pi(e,i,o,n,r.getOrInit)},e);return _u(a,i,t[0].column())},vi,y,y,wu),insertRowAfter:gi(function(e,t,n,r){var o=t.row(),i=t.row()+t.rowspan(),u=Pi(e,i,o,n,r.getOrInit);return _u(u,i,t.column())},hi,y,y,wu),insertRowsAfter:gi(function(e,t,n,r){var o=Lu(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),a=W(o,function(e,t){return Pi(e,u,i,n,r.getOrInit)},e);return _u(a,u,t[0].column())},vi,y,y,wu),insertColumnBefore:gi(function(e,t,n,r){var o=t.column(),i=t.column(),u=Ii(e,i,o,n,r.getOrInit);return _u(u,t.row(),i)},hi,zu,y,wu),insertColumnsBefore:gi(function(e,t,n,r){var o=Fu(t),i=o[0].column(),u=o[0].column(),a=W(o,function(e,t){return Ii(e,u,i,n,r.getOrInit)},e);return _u(a,t[0].row(),u)},vi,zu,y,wu),insertColumnAfter:gi(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=Ii(e,i,o,n,r.getOrInit);return _u(u,t.row(),i)},hi,zu,y,wu),insertColumnsAfter:gi(function(e,t,n,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=Fu(t),a=W(u,function(e,t){return Ii(e,i,o,n,r.getOrInit)},e);return _u(a,t[0].row(),i)},vi,zu,y,wu),splitCellIntoColumns:gi(function(e,t,n,r){var o=Bi(e,t.row(),t.column(),n,r.getOrInit);return _u(o,t.row(),t.column())},hi,zu,y,wu),splitCellIntoRows:gi(function(e,t,n,r){var o=Wi(e,t.row(),t.column(),n,r.getOrInit);return _u(o,t.row(),t.column())},hi,y,y,wu),eraseColumns:gi(function(e,t,n,r){var o=Fu(t),i=_i(e,o[0].column(),o[o.length-1].column()),u=Wu(i,t[0].row(),t[0].column());return Bu(i,u)},vi,zu,Iu,wu),eraseRows:gi(function(e,t,n,r){var o=Lu(t),i=Mi(e,o[0].row(),o[o.length-1].row()),u=Wu(i,t[0].row(),t[0].column());return Bu(i,u)},vi,y,Iu,wu),makeColumnHeader:gi(function(e,t,n,r){var o=zi(e,t.column(),n,r.replaceOrInit);return _u(o,t.row(),t.column())},hi,y,y,yu("row","th")),unmakeColumnHeader:gi(function(e,t,n,r){var o=zi(e,t.column(),n,r.replaceOrInit);return _u(o,t.row(),t.column())},hi,y,y,yu(null,"td")),makeRowHeader:gi(function(e,t,n,r){var o=Hi(e,t.row(),n,r.replaceOrInit);return _u(o,t.row(),t.column())},hi,y,y,yu("col","th")),unmakeRowHeader:gi(function(e,t,n,r){var o=Hi(e,t.row(),n,r.replaceOrInit);return _u(o,t.row(),t.column())},hi,y,y,yu(null,"td")),mergeCells:gi(function(e,t,n,r){var o=t.cells();Pu(o);var i=Oi(e,t.bounds(),n,C(o[0]));return Bu(i,S.from(o[0]))},function(e,t){return t.mergable()},y,y,xu),unmergeCells:gi(function(e,t,n,r){var o=B(t,function(e,t){return Ni(e,t,n,r.combine(t))},e);return Bu(o,S.from(t[0]))},function(e,t){return t.unmergable()},zu,y,xu),pasteCells:gi(function(e,n,t,r){var o,i,u,a,c=(o=n.clipboard(),i=n.generators(),u=mn(o),a=vn.generate(u),fi(a,i,!0)),l=Wt(n.row(),n.column());return ki(l,e,c,n.generators(),t).fold(function(){return Bu(e,S.some(n.element()))},function(e){var t=Wu(e,n.row(),n.column());return Bu(e,t)})},function(t,n){return dn.cell(n.element()).bind(function(e){return mi(t,e).map(function(e){return So({},e,{generators:n.generators,clipboard:n.clipboard})})})},zu,y,wu),pasteRowsBefore:gi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[0].row(),u=ju(t.clipboard(),t.generators(),o),a=Ai(i,e,u,t.generators(),n),c=Wu(a,t.cells[0].row(),t.cells[0].column());return Bu(a,c)},pi,y,y,wu),pasteRowsAfter:gi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[t.cells.length-1].row()+t.cells[t.cells.length-1].rowspan(),u=ju(t.clipboard(),t.generators(),o),a=Ai(i,e,u,t.generators(),n),c=Wu(a,t.cells[0].row(),t.cells[0].column());return Bu(a,c)},pi,y,y,wu)},Uu=function(e){return Te.fromDom(e.getBody())},qu=function(e){return e.getBoundingClientRect().width},Vu=function(e){return e.getBoundingClientRect().height},Gu=function(t){return function(e){return gt(e,Uu(t))}},Yu=function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},Xu=function(e){var t=Xt(e,"td[data-mce-style],th[data-mce-style]");we(e,"data-mce-style"),P(t,function(e){we(e,"data-mce-style")})},Ku={isRtl:C(!1)},Ju={isRtl:C(!0)},$u={directionAt:function(e){return"rtl"==("rtl"===Pe(e,"direction")?"rtl":"ltr")?Ju:Ku}},Qu=["tableprops","tabledelete","|","tableinsertrowbefore","tableinsertrowafter","tabledeleterow","|","tableinsertcolbefore","tableinsertcolafter","tabledeletecol"],Zu={"border-collapse":"collapse",width:"100%"},ea={border:"1"},ta=function(e){return e.getParam("table_cell_advtab",!0,"boolean")},na=function(e){return e.getParam("table_row_advtab",!0,"boolean")},ra=function(e){return e.getParam("table_advtab",!0,"boolean")},oa=function(e){return e.getParam("table_style_by_css",!1,"boolean")},ia=function(e){return e.getParam("table_cell_class_list",[],"array")},ua=function(e){return e.getParam("table_row_class_list",[],"array")},aa=function(e){return e.getParam("table_class_list",[],"array")},ca=function(e){return!1===e.getParam("table_responsive_width")},la=function(e,t){return e.fire("newrow",{node:t})},fa=function(e,t){return e.fire("newcell",{node:t})},sa=function(e,t,n,r){e.fire("ObjectResizeStart",{target:t,width:n,height:r})},da=function(e,t,n,r){e.fire("ObjectResized",{target:t,width:n,height:r})},ma=function(f,e){var t,n=function(e){return"table"===ce(Uu(e))},s=(t=f.getParam("table_clone_elements"),v(t)?S.some(t.split(/[ ,]/)):Array.isArray(t)?S.some(t):S.none()),r=function(u,a,c,l){return function(e,t){Xu(e);var n=l(),r=Te.fromDom(f.getDoc()),o=xo($u.directionAt),i=Ln(c,r,s);return a(e)?u(n,e,t,i,o).bind(function(e){return P(e.newRows(),function(e){la(f,e.dom())}),P(e.newCells(),function(e){fa(f,e.dom())}),e.cursor().map(function(e){var t=f.dom.createRng();return t.setStart(e.dom(),0),t.setEnd(e.dom(),0),t})}):S.none()}};return{deleteRow:r(Hu.eraseRows,function(e){var t=Co(e);return!1===n(f)||1<t.rows()},y,e),deleteColumn:r(Hu.eraseColumns,function(e){var t=Co(e);return!1===n(f)||1<t.columns()},y,e),insertRowsBefore:r(Hu.insertRowsBefore,a,y,e),insertRowsAfter:r(Hu.insertRowsAfter,a,y,e),insertColumnsBefore:r(Hu.insertColumnsBefore,a,no,e),insertColumnsAfter:r(Hu.insertColumnsAfter,a,no,e),mergeCells:r(Hu.mergeCells,a,y,e),unmergeCells:r(Hu.unmergeCells,a,y,e),pasteRowsBefore:r(Hu.pasteRowsBefore,a,y,e),pasteRowsAfter:r(Hu.pasteRowsAfter,a,y,e),pasteCells:r(Hu.pasteCells,a,y,e)}},ga=function(e,t,r){var n=mn(e),o=vn.generate(n);return vi(o,t).map(function(e){var t=fi(o,r,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),n=di(t,r);return No(n)})},ha=tinymce.util.Tools.resolve("tinymce.util.Tools"),pa=function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},va=function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},ba=function(t,n){ha.each("left center right".split(" "),function(e){t.formatter.remove("align"+e,{},n)})},wa=function(t,n){ha.each("top middle bottom".split(" "),function(e){t.formatter.remove("valign"+e,{},n)})},ya=function(o,e,i){var t;return t=function(e,t){for(var n=0;n<t.length;n++){var r=o.getStyle(t[n],i);if(void 0===e&&(e=r),e!==r)return""}return e}(t,o.select("td,th",e))},xa=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);i["border-style"]=o.borderStyle,i["border-color"]=o.borderColor,i["background-color"]=o.backgroundColor,i.width=o.width?Yu(o.width):"",i.height=o.height?Yu(o.height):"",r.find("#style").value(n.serializeStyle(n.parseStyle(n.serializeStyle(i))))},Ca=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);r.find("#borderStyle").value(i["border-style"]||""),r.find("#borderColor").value(i["border-color"]||""),r.find("#backgroundColor").value(i["background-color"]||""),r.find("#width").value(i.width||""),r.find("#height").value(i.height||"")},Sa={createStyleForm:function(n){var e=function(){var e=n.getParam("color_picker_callback");if(e)return function(t){return e.call(n,function(e){t.control.value(e).fire("change")},t.control.value())}};return{title:"Advanced",type:"form",defaults:{onchange:b(xa,n)},items:[{label:"Style",name:"style",type:"textbox",onchange:b(Ca,n)},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border style",type:"listbox",name:"borderStyle",width:90,onselect:b(xa,n),values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]},{label:"Border color",type:"colorbox",name:"borderColor",onaction:e()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:e()}]}]}},buildListItems:function(e,r,t){var o=function(e,n){return n=n||[],ha.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=o(e.menu):(t.value=e.value,r&&r(t)),n.push(t)}),n};return o(e,t||[])},updateStyleField:xa,extractAdvancedStyles:function(e,t){var n=e.parseStyle(e.getAttrib(t,"style")),r={};return n["border-style"]&&(r.borderStyle=n["border-style"]),n["border-color"]&&(r.borderColor=n["border-color"]),n["background-color"]&&(r.backgroundColor=n["background-color"]),r.style=e.serializeStyle(n),r},updateAdvancedFields:Ca,syncAdvancedStyleFields:function(e,t){t.control.rootControl.find("#style")[0].getEl().isEqualNode(m.document.activeElement)?Ca(e,t):xa(e,t)}},Ra=function(r,o,e){var i,u=r.dom;function a(e,t,n){(1===o.length||n)&&u.setAttrib(e,t,n)}function c(e,t,n){(1===o.length||n)&&u.setStyle(e,t,n)}ta(r)&&Sa.syncAdvancedStyleFields(r,e),i=e.control.rootControl.toJSON(),r.undoManager.transact(function(){ha.each(o,function(e){var t,n;a(e,"scope",i.scope),1===o.length?a(e,"style",i.style):(t=e,n=i.style,delete t.dataset.mceStyle,t.style.cssText+=";"+n),a(e,"class",i["class"]),c(e,"width",Yu(i.width)),c(e,"height",Yu(i.height)),i.type&&e.nodeName.toLowerCase()!==i.type&&(e=u.rename(e,i.type)),1===o.length&&(ba(r,e),wa(r,e)),i.align&&pa(r,e,i.align),i.valign&&va(r,e,i.valign)}),r.focus()})},Ta=function(t){var e,n,r,o=[];if(o=t.dom.select("td[data-mce-selected],th[data-mce-selected]"),e=t.dom.getParent(t.selection.getStart(),"td,th"),!o.length&&e&&o.push(e),e=e||o[0]){var i,u,a,c;1<o.length?n={width:"",height:"",scope:"","class":"",align:"",valign:"",style:"",type:e.nodeName.toLowerCase()}:(u=e,a=(i=t).dom,c={width:a.getStyle(u,"width")||a.getAttrib(u,"width"),height:a.getStyle(u,"height")||a.getAttrib(u,"height"),scope:a.getAttrib(u,"scope"),"class":a.getAttrib(u,"class"),type:u.nodeName.toLowerCase(),style:"",align:"",valign:""},ha.each("left center right".split(" "),function(e){i.formatter.matchNode(u,"align"+e)&&(c.align=e)}),ha.each("top middle bottom".split(" "),function(e){i.formatter.matchNode(u,"valign"+e)&&(c.valign=e)}),ta(i)&&ha.extend(c,Sa.extractAdvancedStyles(a,u)),n=c),0<ia(t).length&&(r={name:"class",type:"listbox",label:"Class",values:Sa.buildListItems(ia(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"td",classes:[e.value]})})})});var l={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width",onchange:b(Sa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(Sa.updateStyleField,t)},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},r]};ta(t)?t.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:n,body:[{title:"General",type:"form",items:l},Sa.createStyleForm(t)],onsubmit:b(Ra,t,o)}):t.windowManager.open({title:"Cell properties",data:n,body:l,onsubmit:b(Ra,t,o)})}};function Da(f,s,d,e){var m=f.dom;function g(e,t,n){(1===s.length||n)&&m.setAttrib(e,t,n)}na(f)&&Sa.syncAdvancedStyleFields(f,e);var h=e.control.rootControl.toJSON();f.undoManager.transact(function(){ha.each(s,function(e){var t,n,r,o,i,u,a,c,l;g(e,"scope",h.scope),g(e,"style",h.style),g(e,"class",h["class"]),t=e,n="height",r=Yu(h.height),(1===s.length||r)&&m.setStyle(t,n,r),h.type!==e.parentNode.nodeName.toLowerCase()&&(o=f.dom,i=e,u=h.type,a=o.getParent(i,"table"),c=i.parentNode,(l=o.select(u,a)[0])||(l=o.create(u),a.firstChild?"CAPTION"===a.firstChild.nodeName?o.insertAfter(l,a.firstChild):a.insertBefore(l,a.firstChild):a.appendChild(l)),l.appendChild(i),c.hasChildNodes()||o.remove(c)),h.align!==d.align&&(ba(f,e),pa(f,e,h.align))}),f.focus()})}var Oa=function(t){var e,n,r,o,i,u,a,c,l,f,s=t.dom,d=[];e=s.getParent(t.selection.getStart(),"table"),n=s.getParent(t.selection.getStart(),"td,th"),ha.each(e.rows,function(t){ha.each(t.cells,function(e){if(s.getAttrib(e,"data-mce-selected")||e===n)return d.push(t),!1})}),(r=d[0])&&(1<d.length?i={height:"",scope:"",style:"","class":"",align:"",type:r.parentNode.nodeName.toLowerCase()}:(c=r,l=(a=t).dom,f={height:l.getStyle(c,"height")||l.getAttrib(c,"height"),scope:l.getAttrib(c,"scope"),"class":l.getAttrib(c,"class"),align:"",style:"",type:c.parentNode.nodeName.toLowerCase()},ha.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),na(a)&&ha.extend(f,Sa.extractAdvancedStyles(l,c)),i=f),0<ua(t).length&&(o={name:"class",type:"listbox",label:"Class",values:Sa.buildListItems(ua(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})})}),u={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"Header",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},o]},na(t)?t.windowManager.open({title:"Row properties",data:i,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},Sa.createStyleForm(t)],onsubmit:b(Da,t,d,i)}):t.windowManager.open({title:"Row properties",data:i,body:u,onsubmit:b(Da,t,d,i)}))},Na=tinymce.util.Tools.resolve("tinymce.Env"),Ea={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},percentages:!0},ka=function(e,t,n,r,o){void 0===o&&(o=Ea);var i=Te.fromTag("table");Ae(i,o.styles),pe(i,o.attributes);var u=Te.fromTag("tbody");Ot(i,u);for(var a=[],c=0;c<e;c++){for(var l=Te.fromTag("tr"),f=0;f<t;f++){var s=c<n||f<r?Te.fromTag("th"):Te.fromTag("td");f<r&&he(s,"scope","row"),c<n&&he(s,"scope","col"),Ot(s,Te.fromTag("br")),o.percentages&&ke(s,"width",100/t+"%"),Ot(l,s)}a.push(l)}return kt(u,a),i},Aa=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},Pa=function(r,e,t){var n,o,i=r.getParam("table_default_styles",Zu,"object"),u={styles:i,attributes:(o=r,o.getParam("table_default_attributes",ea,"object")),percentages:(n=i.width,v(n)&&-1!==n.indexOf("%")&&!ca(r))},a=ka(t,e,0,0,u);he(a,"data-mce-id","__mce");var c,l,f,s=(c=a,l=Te.fromTag("div"),f=Te.fromDom(c.dom().cloneNode(!0)),Ot(l,f),l.dom().innerHTML);return r.insertContent(s),nn(Uu(r),'table[data-mce-id="__mce"]').map(function(e){var t,n;return ca(r)&&ke(e,"width",Pe(e,"width")),we(e,"data-mce-id"),t=r,P(Xt(e,"tr"),function(e){la(t,e.dom()),P(Xt(e,"th,td"),function(e){fa(t,e.dom())})}),n=r,nn(e,"td,th").each(b(Aa,n)),e.dom()}).getOr(null)};function Ia(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)e.setStyle(t,n,r);else if(t.children)for(var o=0;o<t.children.length;o++)Ia(e,t.children[o],n,r)}var Ba,Wa=function(e,t,n){var r,o,i=e.dom;ra(e)&&Sa.syncAdvancedStyleFields(e,n),!1===(o=n.control.rootControl.toJSON())["class"]&&delete o["class"],e.undoManager.transact(function(){t||(t=Pa(e,o.cols||1,o.rows||1)),function(e,t,n){var r,o=e.dom,i={},u={};if(i["class"]=n["class"],u.height=Yu(n.height),o.getAttrib(t,"width")&&!oa(e)?i.width=(r=n.width)?r.replace(/px$/,""):"":u.width=Yu(n.width),oa(e)?(u["border-width"]=Yu(n.border),u["border-spacing"]=Yu(n.cellspacing),ha.extend(i,{"data-mce-border-color":n.borderColor,"data-mce-cell-padding":n.cellpadding,"data-mce-border":n.border})):ha.extend(i,{border:n.border,cellpadding:n.cellpadding,cellspacing:n.cellspacing}),oa(e)&&t.children)for(var a=0;a<t.children.length;a++)Ia(o,t.children[a],{"border-width":Yu(n.border),"border-color":n.borderColor,padding:Yu(n.cellpadding)});n.style?ha.extend(u,o.parseStyle(n.style)):u=ha.extend({},o.parseStyle(o.getAttrib(t,"style")),u),i.style=o.serializeStyle(u),o.setAttribs(t,i)}(e,t,o),(r=i.select("caption",t)[0])&&!o.caption&&i.remove(r),!r&&o.caption&&((r=i.create("caption")).innerHTML=Na.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(r,t.firstChild)),ba(e,t),o.align&&pa(e,t,o.align),e.focus(),e.addVisual()})},Ma=function(t,e){var n,r,o,i,u,a,c,l,f,s,d=t.dom,m={};!0===e?(n=d.getParent(t.selection.getStart(),"table"))&&(c=n,l=(a=t).dom,f={width:l.getStyle(c,"width")||l.getAttrib(c,"width"),height:l.getStyle(c,"height")||l.getAttrib(c,"height"),cellspacing:l.getStyle(c,"border-spacing")||l.getAttrib(c,"cellspacing"),cellpadding:l.getAttrib(c,"data-mce-cell-padding")||l.getAttrib(c,"cellpadding")||ya(a.dom,c,"padding"),border:l.getAttrib(c,"data-mce-border")||l.getAttrib(c,"border")||ya(a.dom,c,"border"),borderColor:l.getAttrib(c,"data-mce-border-color"),caption:!!l.select("caption",c)[0],"class":l.getAttrib(c,"class")},ha.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),ra(a)&&ha.extend(f,Sa.extractAdvancedStyles(l,c)),m=f):(r={label:"Cols",name:"cols"},o={label:"Rows",name:"rows"}),0<aa(t).length&&(m["class"]&&(m["class"]=m["class"].replace(/\s*mce\-item\-table\s*/g,"")),i={name:"class",type:"listbox",label:"Class",values:Sa.buildListItems(aa(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"table",classes:[e.value]})})})}),u={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:(s=t,s.getParam("table_appearance_options",!0,"boolean")?[r,o,{label:"Width",name:"width",onchange:b(Sa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(Sa.updateStyleField,t)},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[r,o,{label:"Width",name:"width",onchange:b(Sa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(Sa.updateStyleField,t)}])},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},i]},ra(t)?t.windowManager.open({title:"Table properties",data:m,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},Sa.createStyleForm(t)],onsubmit:b(Wa,t,n)}):t.windowManager.open({title:"Table properties",data:m,body:u,onsubmit:b(Wa,t,n)})},_a=ha.each,La=function(a,t,c,l,n){var r=Gu(a),e=function(e){return function(){return S.from(a.dom.getParent(a.selection.getStart(),e)).map(Te.fromDom)}},o=e("caption"),f=e("th,td"),s=function(e){return dn.table(e,r)},d=function(e){return{width:qu(e.dom()),height:qu(e.dom())}},i=function(n){f().each(function(t){s(t).each(function(i){var e=Br.forMenu(l,i,t),u=d(i);n(i,e).each(function(e){var t,n,r,o;t=a,n=u,o=d(r=i),n.width===o.width&&n.height===o.height||(sa(t,r.dom(),n.width,n.height),da(t,r.dom(),o.width,o.height)),a.selection.setRng(e),a.focus(),c.clear(i),Xu(i)})})})},u=function(e){return f().bind(function(o){return s(o).bind(function(e){var t=Te.fromDom(a.getDoc()),n=Br.forMenu(l,e,o),r=Ln(y,t,S.none());return ga(e,n,r)})})},m=function(u){n.get().each(function(e){var i=A(e,function(e){return Pn(e)});f().each(function(o){s(o).each(function(t){var e=Te.fromDom(a.getDoc()),n=Fn(e),r=Br.pasteRows(l,t,o,i,n);u(t,r).each(function(e){a.selection.setRng(e),a.focus(),c.clear(t)})})})})};_a({mceTableSplitCells:function(){i(t.unmergeCells)},mceTableMergeCells:function(){i(t.mergeCells)},mceTableInsertRowBefore:function(){i(t.insertRowsBefore)},mceTableInsertRowAfter:function(){i(t.insertRowsAfter)},mceTableInsertColBefore:function(){i(t.insertColumnsBefore)},mceTableInsertColAfter:function(){i(t.insertColumnsAfter)},mceTableDeleteCol:function(){i(t.deleteColumn)},mceTableDeleteRow:function(){i(t.deleteRow)},mceTableCutRow:function(e){n.set(u()),i(t.deleteRow)},mceTableCopyRow:function(e){n.set(u())},mceTablePasteRowBefore:function(e){m(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){m(t.pasteRowsAfter)},mceTableDelete:function(){f().orThunk(o).each(function(e){dn.table(e,r).filter(g(r)).each(function(e){var t=Te.fromText("");Tt(e,t),Pt(e);var n=a.dom.createRng();n.setStart(t.dom(),0),n.setEnd(t.dom(),0),a.selection.setRng(n)})})}},function(e,t){a.addCommand(t,e)}),_a({mceInsertTable:b(Ma,a),mceTableProps:b(Ma,a,!0),mceTableRowProps:b(Oa,a),mceTableCellProps:b(Ta,a)},function(n,e){a.addCommand(e,function(e,t){n(t)})})},Fa=function(e){var t=S.from(e.dom().documentElement).map(Te.fromDom).getOr(e);return{parent:C(t),view:C(e),origin:C(oo(0,0))}},ja=function(e,t){return{parent:C(t),view:C(e),origin:C(oo(0,0))}},za=function(e){var r=X.apply(null,e),o=[];return{bind:function(e){if(e===undefined)throw new Error("Event bind error: undefined handler");o.push(e)},unbind:function(t){o=I(o,function(e){return e!==t})},trigger:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=r.apply(null,e);P(o,function(e){e(n)})}}},Ha={create:function(e){return{registry:G(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:G(e,function(e){return e.trigger})}}},Ua=function(m,g){return function(e){if(m(e)){var t,n,r,o,i,u,a,c=Te.fromDom(e.target),l=function(){e.stopPropagation()},f=function(){e.preventDefault()},s=x(f,l),d=(t=c,n=e.clientX,r=e.clientY,o=l,i=f,u=s,a=e,{target:C(t),x:C(n),y:C(r),stop:o,prevent:i,kill:u,raw:C(a)});g(d)}}},qa=function(e,t,n,r){return o=e,i=t,u=!1,a=Ua(n,r),o.dom().addEventListener(i,a,u),{unbind:b(Va,o,i,a,u)};var o,i,u,a},Va=function(e,t,n,r){e.dom().removeEventListener(t,n,r)},Ga=C(!0),Ya=function(e,t,n){return qa(e,t,Ga,n)},Xa=Object.prototype.hasOwnProperty,Ka=(Ba=function(e,t){return t},function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var o=e[r];for(var i in o)Xa.call(o,i)&&(n[i]=Ba(n[i],o[i]))}return n}),Ja={resolve:zo("ephox-dragster").resolve},$a=pu(["compare","extract","mutate","sink"]),Qa=pu(["element","start","stop","destroy"]),Za=pu(["forceDrop","drop","move","delayDrop"]),ec=$a({compare:function(e,t){return oo(t.left()-e.left(),t.top()-e.top())},extract:function(e){return S.some(oo(e.x(),e.y()))},sink:function(e,t){var n,r,o,i=(n=t,r=Ka({layerClass:Ja.resolve("blocker")},n),o=Te.fromTag("div"),he(o,"role","presentation"),Ae(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Io(o,Ja.resolve("blocker")),Io(o,r.layerClass),{element:function(){return o},destroy:function(){Pt(o)}}),u=Ya(i.element(),"mousedown",e.forceDrop),a=Ya(i.element(),"mouseup",e.drop),c=Ya(i.element(),"mousemove",e.move),l=Ya(i.element(),"mouseout",e.delayDrop);return Qa({element:i.element,start:function(e){Ot(e,i.element())},stop:function(){Pt(i.element())},destroy:function(){i.destroy(),a.unbind(),c.unbind(),l.unbind(),u.unbind()}})},mutate:function(e,t){e.mutate(t.left(),t.top())}});function tc(){var i=S.none(),u=Ha.create({move:za(["info"])});return{onEvent:function(e,o){o.extract(e).each(function(e){var t,n,r;(t=o,n=e,r=i.map(function(e){return t.compare(e,n)}),i=S.some(n),r).each(function(e){u.trigger.move(e)})})},reset:function(){i=S.none()},events:u.registry}}function nc(){var e={onEvent:y,reset:y},t=tc(),n=e;return{on:function(){n.reset(),n=t},off:function(){n.reset(),n=e},isOn:function(){return n===t},onEvent:function(e,t){n.onEvent(e,t)},events:t.events}}var rc=function(t,n,e){var r,o,i,u=!1,a=Ha.create({start:za([]),stop:za([])}),c=nc(),l=function(){d.stop(),c.isOn()&&(c.off(),a.trigger.stop())},f=(r=l,o=200,i=null,{cancel:function(){null!==i&&(m.clearTimeout(i),i=null)},throttle:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];null!==i&&m.clearTimeout(i),i=m.setTimeout(function(){r.apply(null,e),i=null},o)}});c.events.move.bind(function(e){n.mutate(t,e.info())});var s=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];u&&n.apply(null,e)}},d=n.sink(Za({forceDrop:l,drop:s(l),move:s(function(e){f.cancel(),c.onEvent(e,n)}),delayDrop:s(f.throttle)}),e);return{element:d.element,go:function(e){d.start(e),c.on(),a.trigger.start()},on:function(){u=!0},off:function(){u=!1},destroy:function(){d.destroy()},events:a.registry}},oc=function(e,t){void 0===t&&(t={});var n=t.mode!==undefined?t.mode:ec;return rc(e,n,t)},ic=function(){var n,r=Ha.create({drag:za(["xDelta","yDelta","target"])}),o=S.none(),e={mutate:function(e,t){n.trigger.drag(e,t)},events:(n=Ha.create({drag:za(["xDelta","yDelta"])})).registry};return e.events.drag.bind(function(t){o.each(function(e){r.trigger.drag(t.xDelta(),t.yDelta(),e)})}),{assign:function(e){o=S.some(e)},get:function(){return o},mutate:e.mutate,events:r.registry}},uc=function(e){return"true"===ve(e,"contenteditable")},ac=Ho.resolve("resizer-bar-dragging"),cc=function(o,t,i){var n=ic(),r=oc(n,{}),u=S.none(),e=function(e,t){return S.from(ve(e,t))};n.events.drag.bind(function(n){e(n.target(),"data-row").each(function(e){var t=Yi.getInt(n.target(),"top");ke(n.target(),"top",t+n.yDelta()+"px")}),e(n.target(),"data-column").each(function(e){var t=Yi.getInt(n.target(),"left");ke(n.target(),"left",t+n.xDelta()+"px")})});var a=function(e,t){return Yi.getInt(e,t)-parseInt(ve(e,"data-initial-"+t),10)};r.events.stop.bind(function(){n.get().each(function(r){u.each(function(n){e(r,"data-row").each(function(e){var t=a(r,"top");we(r,"data-initial-top"),m.trigger.adjustHeight(n,t,parseInt(e,10))}),e(r,"data-column").each(function(e){var t=a(r,"left");we(r,"data-initial-left"),m.trigger.adjustWidth(n,t,parseInt(e,10))}),Qo(o,n,i,t)})})});var c=function(e,t){m.trigger.startAdjust(),n.assign(e),he(e,"data-initial-"+t,parseInt(Pe(e,t),10)),Io(e,ac),ke(e,"opacity","0.2"),r.go(o.parent())},l=Ya(o.parent(),"mousedown",function(e){ni(e.target())&&c(e.target(),"top"),ri(e.target())&&c(e.target(),"left")}),f=function(e){return gt(e,o.view())},s=function(e){return rn(e,"table",f).filter(function(e){return(t=e,n=f,rn(t,"[contenteditable]",n)).exists(uc);var t,n})},d=Ya(o.view(),"mouseover",function(e){s(e.target()).fold(function(){De(e.target())&&ti(o)},function(e){u=S.some(e),Qo(o,e,i,t)})}),m=Ha.create({adjustHeight:za(["table","delta","row"]),adjustWidth:za(["table","delta","column"]),startAdjust:za([])});return{destroy:function(){l.unbind(),d.unbind(),r.destroy(),ti(o)},refresh:function(e){Qo(o,e,i,t)},on:r.on,off:r.off,hideBars:b(Zo,o),showBars:b(ei,o),events:m.registry}},lc=function(e,t){return e.inline?ja(Uu(e),(n=Te.fromTag("div"),Ae(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Ot(Oe(),n),n)):Fa(Te.fromDom(e.getDoc()));var n},fc=function(e,t){e.inline&&Pt(t.parent())},sc=function(c){var u,a,l=S.none(),f=S.none(),s=S.none(),d=/(\d+(\.\d+)?)%/,m=function(e){return"TABLE"===e.nodeName};return c.on("init",function(){var n,r,e,o,t,i=xo($u.directionAt),u=lc(c);if(s=S.some(u),("table"===(t=c.getParam("object_resizing",!0))||t)&&c.getParam("table_resize_bars",!0,"boolean")){var a=(e=cc(u,n=i,r=wo.height),o=Ha.create({beforeResize:za(["table"]),afterResize:za(["table"]),startDrag:za([])}),e.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=r.delta(e.delta(),e.table());su(e.table(),t,e.row(),r),o.trigger.afterResize(e.table())}),e.events.startAdjust.bind(function(e){o.trigger.startDrag()}),e.events.adjustWidth.bind(function(e){o.trigger.beforeResize(e.table());var t=n.delta(e.delta(),e.table());fu(e.table(),t,e.column(),n),o.trigger.afterResize(e.table())}),{on:e.on,off:e.off,hideBars:e.hideBars,showBars:e.showBars,destroy:e.destroy,events:o.registry});a.on(),a.events.startDrag.bind(function(e){l=S.some(c.selection.getRng())}),a.events.beforeResize.bind(function(e){var t=e.table().dom();sa(c,t,qu(t),Vu(t))}),a.events.afterResize.bind(function(e){var t=e.table(),n=t.dom();Xu(t),l.each(function(e){c.selection.setRng(e),c.focus()}),da(c,n,qu(n),Vu(n)),c.undoManager.add()}),f=S.some(a)}}),c.on("ObjectResizeStart",function(e){var t,n=e.target;m(n)&&(u=e.width,t=n,a=c.dom.getStyle(t,"width")||c.dom.getAttrib(t,"width"))}),c.on("ObjectResized",function(e){var t=e.target;if(m(t)){var n=t;if(d.test(a)){var r=parseFloat(d.exec(a)[1]),o=e.width*r/u;c.dom.setStyle(n,"width",o+"%")}else{var i=[];ha.each(n.rows,function(e){ha.each(e.cells,function(e){var t=c.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),ha.each(i,function(e){c.dom.setStyle(e.cell,"width",e.width),c.dom.setAttrib(e.cell,"width",null)})}}}),{lazyResize:function(){return f},lazyWire:function(){return s.getOr(Fa(Te.fromDom(c.getBody())))},destroy:function(){f.each(function(e){e.destroy()}),s.each(function(e){fc(c,e)})}}},dc=Tr([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),mc=So({},dc,{none:function(e){return void 0===e&&(e=undefined),dc.none(e)}}),gc=function(n,e){return dn.table(n,e).bind(function(e){var t=dn.cells(e);return _(t,function(e){return gt(n,e)}).map(function(e){return{index:C(e),all:C(t)}})})},hc=function(t,e){return gc(t,e).fold(function(){return mc.none(t)},function(e){return e.index()+1<e.all().length?mc.middle(t,e.all()[e.index()+1]):mc.last(t)})},pc=function(t,e){return gc(t,e).fold(function(){return mc.none()},function(e){return 0<=e.index()-1?mc.middle(t,e.all()[e.index()-1]):mc.first(t)})},vc={create:X("start","soffset","finish","foffset")},bc=Tr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),wc={before:bc.before,on:bc.on,after:bc.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(o,o,o)}},yc=Tr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),xc={domRange:yc.domRange,relative:yc.relative,exact:yc.exact,exactFromRange:function(e){return yc.exact(e.start(),e.soffset(),e.finish(),e.foffset())},getWin:function(e){var t,n=e.match({domRange:function(e){return Te.fromDom(e.startContainer)},relative:function(e,t){return wc.getStart(e)},exact:function(e,t,n,r){return e}});return t=n,Te.fromDom(t.dom().ownerDocument.defaultView)},range:vc.create},Cc=function(e,t){e.selectNodeContents(t.dom())},Sc=function(e,t,n){var r,o,i=e.document.createRange();return r=i,t.fold(function(e){r.setStartBefore(e.dom())},function(e,t){r.setStart(e.dom(),t)},function(e){r.setStartAfter(e.dom())}),o=i,n.fold(function(e){o.setEndBefore(e.dom())},function(e,t){o.setEnd(e.dom(),t)},function(e){o.setEndAfter(e.dom())}),i},Rc=function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},Tc=function(e){return{left:C(e.left),top:C(e.top),right:C(e.right),bottom:C(e.bottom),width:C(e.width),height:C(e.height)}},Dc=Tr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Oc=function(e,t,n){return t(Te.fromDom(n.startContainer),n.startOffset,Te.fromDom(n.endContainer),n.endOffset)},Nc=function(e,t){var o,n,r,i=(o=e,t.match({domRange:function(e){return{ltr:C(e),rtl:S.none}},relative:function(e,t){return{ltr:Se(function(){return Sc(o,e,t)}),rtl:Se(function(){return S.some(Sc(o,t,e))})}},exact:function(e,t,n,r){return{ltr:Se(function(){return Rc(o,e,t,n,r)}),rtl:Se(function(){return S.some(Rc(o,n,r,e,t))})}}}));return(r=(n=i).ltr()).collapsed?n.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return Dc.rtl(Te.fromDom(e.endContainer),e.endOffset,Te.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return Oc(0,Dc.ltr,r)}):Oc(0,Dc.ltr,r)},Ec=function(i,e){return Nc(i,e).match({ltr:function(e,t,n,r){var o=i.document.createRange();return o.setStart(e.dom(),t),o.setEnd(n.dom(),r),o},rtl:function(e,t,n,r){var o=i.document.createRange();return o.setStart(n.dom(),r),o.setEnd(e.dom(),t),o}})},kc=function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom},Ac=function(n,r,e,t,o){var i=function(e){var t=n.dom().createRange();return t.setStart(r.dom(),e),t.collapse(!0),t},u=xn(r).length,a=function(e,t,n,r,o){if(0===o)return 0;if(t===r)return o-1;for(var i=r,u=1;u<o;u++){var a=e(u),c=Math.abs(t-a.left);if(n<=a.bottom){if(n<a.top||i<c)return u-1;i=c}}return 0}(function(e){return i(e).getBoundingClientRect()},e,t,o.right,u);return i(a)},Pc=function(e,t,n,r){return me(t)?function(t,n,r,o){var e=t.dom().createRange();e.selectNode(n.dom());var i=e.getClientRects();return To(i,function(e){return kc(e,r,o)?S.some(e):S.none()}).map(function(e){return Ac(t,n,r,o,e)})}(e,t,n,r):(i=t,u=n,a=r,c=(o=e).dom().createRange(),l=Ct(i),To(l,function(e){return c.selectNode(e.dom()),kc(c.getBoundingClientRect(),u,a)?Pc(o,e,u,a):S.none()}));var o,i,u,a,c,l},Ic=function(e,t){return t-e.left<e.right-t},Bc=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},Wc=function(t,e,n){var r=t.dom().createRange();r.selectNode(e.dom());var o=r.getBoundingClientRect(),i=Ic(o,n);return(!0===i?On:Nn)(e).map(function(e){return Bc(t,e,i)})},Mc=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=Ic(r,n);return S.some(Bc(e,t,o))},_c=function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect();return function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return Pc(e,t,u,a)}(e,t,Math.max(i.left,Math.min(i.right,n)),Math.max(i.top,Math.min(i.bottom,r)))},Lc=document.caretPositionFromPoint?function(n,e,t){return S.from(n.dom().caretPositionFromPoint(e,t)).bind(function(e){if(null===e.offsetNode)return S.none();var t=n.dom().createRange();return t.setStart(e.offsetNode,e.offset),t.collapse(),S.some(t)})}:document.caretRangeFromPoint?function(e,t,n){return S.from(e.dom().caretRangeFromPoint(t,n))}:function(o,i,t){return Te.fromPoint(o,i,t).bind(function(r){var e=function(){return e=o,n=i,(0===Ct(t=r).length?Mc:Wc)(e,t,n);var e,t,n};return 0===Ct(r).length?e():_c(o,r,i,t).orThunk(e)})},Fc=function(e,t){var n=ce(e);return"input"===n?wc.after(e):E(["br","img"],n)?0===t?wc.before(e):wc.after(e):wc.on(e,t)},jc=function(e,t){var n=e.fold(wc.before,Fc,wc.after),r=t.fold(wc.before,Fc,wc.after);return xc.relative(n,r)},zc=function(e,t,n,r){var o=Fc(e,t),i=Fc(n,r);return xc.relative(o,i)},Hc=function(e,t,n,r){var o,i,u,a,c,l=(i=t,u=n,a=r,(c=vt(o=e).dom().createRange()).setStart(o.dom(),i),c.setEnd(u.dom(),a),c),f=gt(e,n)&&t===r;return l.collapsed&&!f},Uc=function(e,t){S.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},qc=function(e,t,n,r,o){var i=Rc(e,t,n,r,o);Uc(e,i)},Vc=function(s,e){return Nc(s,e).match({ltr:function(e,t,n,r){qc(s,e,t,n,r)},rtl:function(e,t,n,r){var o,i,u,a,c,l=s.getSelection();if(l.setBaseAndExtent)l.setBaseAndExtent(e.dom(),t,n.dom(),r);else if(l.extend)try{i=e,u=t,a=n,c=r,(o=l).collapse(i.dom(),u),o.extend(a.dom(),c)}catch(f){qc(s,n,r,e,t)}else qc(s,n,r,e,t)}})},Gc=function(e){var o=xc.getWin(e).dom(),t=function(e,t,n,r){return Rc(o,e,t,n,r)},n=e.match({domRange:function(e){var t=Te.fromDom(e.startContainer),n=Te.fromDom(e.endContainer);return zc(t,e.startOffset,n,e.endOffset)},relative:jc,exact:zc});return Nc(o,n).match({ltr:t,rtl:t})},Yc=function(e){var t=Te.fromDom(e.anchorNode),n=Te.fromDom(e.focusNode);return Hc(t,e.anchorOffset,n,e.focusOffset)?S.some(vc.create(t,e.anchorOffset,n,e.focusOffset)):function(e){if(0<e.rangeCount){var t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return S.some(vc.create(Te.fromDom(t.startContainer),t.startOffset,Te.fromDom(n.endContainer),n.endOffset))}return S.none()}(e)},Xc=function(e,t){var n,r,o=(n=t,r=e.document.createRange(),Cc(r,n),r);Uc(e,o)},Kc=function(e){return(t=e,S.from(t.getSelection()).filter(function(e){return 0<e.rangeCount}).bind(Yc)).map(function(e){return xc.exact(e.start(),e.soffset(),e.finish(),e.foffset())});var t},Jc=function(e,t){var n,r,o,i=Ec(e,t);return r=(n=i).getClientRects(),0<(o=0<r.length?r[0]:n.getBoundingClientRect()).width||0<o.height?S.some(o).map(Tc):S.none()},$c=function(e,t,n){return r=e,o=t,i=n,u=Te.fromDom(r.document),Lc(u,o,i).map(function(e){return vc.create(Te.fromDom(e.startContainer),e.startOffset,Te.fromDom(e.endContainer),e.endOffset)});var r,o,i,u},Qc=tinymce.util.Tools.resolve("tinymce.util.VK"),Zc=function(e,t,n,r){return rl(e,t,hc(n),r)},el=function(e,t,n,r){return rl(e,t,pc(n),r)},tl=function(e,t){var n=xc.exact(t,0,t,0);return Gc(n)},nl=function(e,t){var n,r=Xt(t,"tr");return(n=r,0===n.length?S.none():S.some(n[n.length-1])).bind(function(e){return nn(e,"td,th").map(function(e){return tl(0,e)})})},rl=function(r,e,t,o,n){return t.fold(S.none,S.none,function(e,t){return On(t).map(function(e){return tl(0,e)})},function(n){return dn.table(n,e).bind(function(e){var t=Br.noMenu(n);return r.undoManager.transact(function(){o.insertRowsAfter(e,t)}),nl(0,e)})})},ol=["table","li","dl"],il=function(t,n,r,o){if(t.keyCode===Qc.TAB){var i=Uu(n),u=function(e){var t=ce(e);return gt(e,i)||E(ol,t)},e=n.selection.getRng();if(e.collapsed){var a=Te.fromDom(e.startContainer);dn.cell(a,u).each(function(e){t.preventDefault(),(t.shiftKey?el:Zc)(n,u,e,r,o).each(function(e){n.selection.setRng(e)})})}}},ul={create:X("selection","kill")},al=function(e,t,n,r){return{start:C(wc.on(e,t)),finish:C(wc.on(n,r))}},cl={convertToRange:function(e,t){var n=Ec(e,t);return vc.create(Te.fromDom(n.startContainer),n.startOffset,Te.fromDom(n.endContainer),n.endOffset)},makeSitus:al},ll=function(n,e,r,t,o){return gt(r,t)?S.none():hr(r,t,e).bind(function(e){var t=e.boxes().getOr([]);return 0<t.length?(o(n,t,e.start(),e.finish()),S.some(ul.create(S.some(cl.makeSitus(r,0,r,Rn(r))),!0))):S.none()})},fl={sync:function(n,r,e,t,o,i,u){return gt(e,o)&&t===i?S.none():rn(e,"td,th",r).bind(function(t){return rn(o,"td,th",r).bind(function(e){return ll(n,r,t,e,u)})})},detect:ll,update:function(e,t,n,r,o){return vr(r,e,t,o.firstSelectedSelector(),o.lastSelectedSelector()).map(function(e){return o.clear(n),o.selectRange(n,e.boxes(),e.start(),e.finish()),e.boxes()})}},sl=X("item","mode"),dl=function(e,t,n,r){return void 0===r&&(r=ml),e.property().parent(t).map(function(e){return sl(e,r)})},ml=function(e,t,n,r){return void 0===r&&(r=gl),n.sibling(e,t).map(function(e){return sl(e,r)})},gl=function(e,t,n,r){void 0===r&&(r=gl);var o=e.property().children(t);return n.first(o).map(function(e){return sl(e,r)})},hl=[{current:dl,next:ml,fallback:S.none()},{current:ml,next:gl,fallback:S.some(dl)},{current:gl,next:gl,fallback:S.some(ml)}],pl=function(t,n,r,o,e){return void 0===e&&(e=hl),M(e,function(e){return e.current===r}).bind(function(e){return e.current(t,n,o,e.next).orThunk(function(){return e.fallback.bind(function(e){return pl(t,n,e,o)})})})},vl=function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return 0<e.length?S.some(e[e.length-1]):S.none()}}},bl=function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return 0<e.length?S.some(e[0]):S.none()}}},wl=function(t,e,n,r,o,i){return pl(t,e,r,o).bind(function(e){return i(e.item())?S.none():n(e.item())?S.some(e.item()):wl(t,e.item(),n,e.mode(),o,i)})},yl=function(t){return function(e){return 0===t.property().children(e).length}},xl=function(e,t,n,r){return wl(e,t,n,ml,vl(),r)},Cl=function(e,t,n,r){return wl(e,t,n,ml,bl(),r)},Sl=tr(),Rl=function(e,t){return r=t,xl(n=Sl,e,yl(n),r);var n,r},Tl=function(e,t){return r=t,Cl(n=Sl,e,yl(n),r);var n,r},Dl=X("element","offset"),Ol=(X("element","deltaOffset"),X("element","start","finish"),X("begin","end"),X("element","text"),Tr([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}])),Nl=function(e){return rn(e,"tr")},El=So({},Ol,{verify:function(a,e,t,n,r,c,o){return rn(n,"td,th",o).bind(function(u){return rn(e,"td,th",o).map(function(i){return gt(u,i)?gt(n,u)&&Rn(u)===r?c(i):Ol.none("in same cell"):sr.sharedOne(Nl,[u,i]).fold(function(){return t=i,n=u,r=(e=a).getRect(t),(o=e.getRect(n)).right>r.left&&o.left<r.right?Ol.success():c(i);var e,t,n,r,o},function(e){return c(i)})})}).getOr(Ol.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)}}),kl=(X("ancestor","descendants","element","index"),X("parent","children","element","index")),Al=function(e,t){return _(e,b(gt,t))},Pl=function(e){return"br"===ce(e)},Il=function(e,t,n){return t(e,n).bind(function(e){return me(e)&&0===xn(e).trim().length?Il(e,t,n):S.some(e)})},Bl=function(t,e,n,r){return(o=e,i=n,St(o,i).filter(Pl).orThunk(function(){return St(o,i-1).filter(Pl)})).bind(function(e){return r.traverse(e).fold(function(){return Il(e,r.gather,t).map(r.relative)},function(e){return(r=e,bt(r).bind(function(t){var n=Ct(t);return Al(n,r).map(function(e){return kl(t,n,r,e)})})).map(function(e){return wc.on(e.parent(),e.index())});var r})});var o,i},Wl=function(e,t,n,r){var o,i,u;return(Pl(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return Il(i,u.gather,o)}).map(u.relative)):Bl(e,t,n,r)).map(function(e){return{start:C(e),finish:C(e)}})},Ml=function(e){return El.cata(e,function(e){return S.none()},function(){return S.none()},function(e){return S.some(Dl(e,0))},function(e){return S.some(Dl(e,Rn(e)))})},_l=ee(["left","top","right","bottom"],[]),Ll={nu:_l,moveUp:function(e,t){return _l({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return _l({left:e.left(),top:e.top()+t,right:e.right(),bottom:e.bottom()+t})},moveBottomTo:function(e,t){var n=e.bottom()-e.top();return _l({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return _l({left:e.left(),top:t,right:e.right(),bottom:t+n})},getTop:function(e){return e.top()},getBottom:function(e){return e.bottom()},translate:function(e,t,n){return _l({left:e.left()+t,top:e.top()+n,right:e.right()+t,bottom:e.bottom()+n})},toString:function(e){return"("+e.left()+", "+e.top()+") -> ("+e.right()+", "+e.bottom()+")"}},Fl=function(e){return Ll.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},jl=function(e,t){return S.some(e.getRect(t))},zl=function(e,t,n){return de(t)?jl(e,t).map(Fl):me(t)?(r=e,o=t,i=n,0<=i&&i<Rn(o)?r.getRangedRect(o,i,o,i+1):0<i?r.getRangedRect(o,i-1,o,i):S.none()).map(Fl):S.none();var r,o,i},Hl=function(e,t){return de(t)?jl(e,t).map(Fl):me(t)?e.getRangedRect(t,0,t,Rn(t)).map(Fl):S.none()},Ul=Tr([{none:[]},{retry:["caret"]}]),ql=function(t,e,r){return(n=e,o=Eu,Kt(function(e,t){return t(e)},Zt,n,o,i)).fold(C(!1),function(e){return Hl(t,e).exists(function(e){return n=e,(t=r).left()<n.left()||Math.abs(n.right()-t.left())<1||t.left()>n.right();var t,n})});var n,o,i},Vl={point:Ll.getTop,adjuster:function(e,t,n,r,o){var i=Ll.moveUp(o,5);return Math.abs(n.top()-r.top())<1?Ul.retry(i):n.bottom()<o.top()?Ul.retry(i):n.bottom()===o.top()?Ul.retry(Ll.moveUp(o,1)):ql(e,t,o)?Ul.retry(Ll.translate(i,5,0)):Ul.none()},move:Ll.moveUp,gather:Rl},Gl={point:Ll.getBottom,adjuster:function(e,t,n,r,o){var i=Ll.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?Ul.retry(i):n.top()>o.bottom()?Ul.retry(i):n.top()===o.bottom()?Ul.retry(Ll.moveDown(o,1)):ql(e,t,o)?Ul.retry(Ll.translate(i,5,0)):Ul.none()},move:Ll.moveDown,gather:Tl},Yl=function(n,r,o,i,u){return 0===u?S.some(i):(c=n,l=i.left(),f=r.point(i),c.elementFromPoint(l,f).filter(function(e){return"table"===ce(e)}).isSome()?(t=i,a=u-1,Yl(n,e=r,o,e.move(t,5),a)):n.situsFromPoint(i.left(),r.point(i)).bind(function(e){return e.start().fold(S.none,function(t){return Hl(n,t).bind(function(e){return r.adjuster(n,t,e,o,i).fold(S.none,function(e){return Yl(n,r,o,e,u-1)})}).orThunk(function(){return S.some(i)})},S.none)}));var e,t,a,c,l,f},Xl=function(t,n,e){var r,o,i,u=t.move(e,5),a=Yl(n,t,e,u,100).getOr(u);return(r=t,o=a,i=n,r.point(o)>i.getInnerHeight()?S.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?S.some(-r.point(o)):S.none()).fold(function(){return n.situsFromPoint(a.left(),t.point(a))},function(e){return n.scrollBy(0,e),n.situsFromPoint(a.left(),t.point(a)-e)})},Kl={tryUp:b(Xl,Vl),tryDown:b(Xl,Gl),ieTryUp:function(e,t){return e.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(e,t){return e.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:C(5)},Jl=lt.detect(),$l=function(r,o,i,u,a,c){return 0===c?S.none():ef(r,o,i,u,a).bind(function(e){var t=r.fromSitus(e),n=El.verify(r,i,u,t.finish(),t.foffset(),a.failure,o);return El.cata(n,function(){return S.none()},function(){return S.some(e)},function(e){return gt(i,e)&&0===u?Ql(r,i,u,Ll.moveUp,a):$l(r,o,e,0,a,c-1)},function(e){return gt(i,e)&&u===Rn(e)?Ql(r,i,u,Ll.moveDown,a):$l(r,o,e,Rn(e),a,c-1)})})},Ql=function(t,e,n,r,o){return zl(t,e,n).bind(function(e){return Zl(t,o,r(e,Kl.getJumpSize()))})},Zl=function(e,t,n){return Jl.browser.isChrome()||Jl.browser.isSafari()||Jl.browser.isFirefox()||Jl.browser.isEdge()?t.otherRetry(e,n):Jl.browser.isIE()?t.ieRetry(e,n):S.none()},ef=function(t,e,n,r,o){return zl(t,n,r).bind(function(e){return Zl(t,o,e)})},tf=function(t,n,r){return(o=t,i=n,u=r,o.getSelection().bind(function(r){return Wl(i,r.finish(),r.foffset(),u).fold(function(){return S.some(Dl(r.finish(),r.foffset()))},function(e){var t=o.fromSitus(e),n=El.verify(o,r.finish(),r.foffset(),t.finish(),t.foffset(),u.failure,i);return Ml(n)})})).bind(function(e){return $l(t,n,e.element(),e.offset(),r,20).map(t.fromSitus)});var o,i,u},nf=lt.detect(),rf=function(e,t){return Zt(e,function(e){return bt(e).exists(function(e){return gt(e,t)})},n).isSome();var n},of=function(t,r,o,e,i){return rn(e,"td,th",r).bind(function(n){return rn(n,"table",r).bind(function(e){return rf(i,e)?tf(t,r,o).bind(function(t){return rn(t.finish(),"td,th",r).map(function(e){return{start:C(n),finish:C(e),range:C(t)}})}):S.none()})})},uf=function(e,t,n,r,o,i){return nf.browser.isIE()?S.none():i(r,t).orThunk(function(){return of(e,t,n,r,o).map(function(e){var t=e.range();return ul.create(S.some(cl.makeSitus(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},af=function(e,t,n,r,o,i,u){return of(e,n,r,o,i).bind(function(e){return fl.detect(t,n,e.start(),e.finish(),u)})},cf=function(e,u){return rn(e,"tr",u).bind(function(i){return rn(i,"table",u).bind(function(e){var t,n,r,o=Xt(e,"tr");return gt(i,o[0])?(t=e,n=function(e){return Nn(e).isSome()},r=u,xl(Sl,t,n,r)).map(function(e){var t=Rn(e);return ul.create(S.some(cl.makeSitus(e,t,e,t)),!0)}):S.none()})})},lf=function(e,u){return rn(e,"tr",u).bind(function(i){return rn(i,"table",u).bind(function(e){var t,n,r,o=Xt(e,"tr");return gt(i,o[o.length-1])?(t=e,n=function(e){return On(e).isSome()},r=u,Cl(Sl,t,n,r)).map(function(e){return ul.create(S.some(cl.makeSitus(e,0,e,0)),!0)}):S.none()})})},ff=function(e,t){return rn(e,"td,th",t)},sf={down:{traverse:xt,gather:Tl,relative:wc.before,otherRetry:Kl.tryDown,ieRetry:Kl.ieTryDown,failure:El.failedDown},up:{traverse:yt,gather:Rl,relative:wc.before,otherRetry:Kl.tryUp,ieRetry:Kl.ieTryUp,failure:El.failedUp}},df=function(t){return function(e){return e===t}},mf=df(38),gf=df(40),hf={ltr:{isBackward:df(37),isForward:df(39)},rtl:{isBackward:df(39),isForward:df(37)},isUp:mf,isDown:gf,isNavigation:function(e){return 37<=e&&e<=40}},pf=function(e){return{left:e.left(),top:e.top(),right:e.right(),bottom:e.bottom(),width:e.width(),height:e.height()}},vf=(lt.detect().browser.isSafari(),function(a){return{elementFromPoint:function(e,t){return Te.fromPoint(Te.fromDom(a.document),e,t)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(e,t,n,r){var o=xc.exact(e,t,n,r);return Jc(a,o).map(pf)},getSelection:function(){return Kc(a).map(function(e){return cl.convertToRange(a,e)})},fromSitus:function(e){var t=xc.relative(e.start(),e.finish());return cl.convertToRange(a,t)},situsFromPoint:function(e,t){return $c(a,e,t).map(function(e){return al(e.start(),e.soffset(),e.finish(),e.foffset())})},clearSelection:function(){a.getSelection().removeAllRanges()},setSelection:function(e){var t,n,r,o,i,u;t=a,n=e.start(),r=e.soffset(),o=e.finish(),i=e.foffset(),u=zc(n,r,o,i),Vc(t,u)},setRelativeSelection:function(e,t){var n,r;n=a,r=jc(e,t),Vc(n,r)},selectContents:function(e){Xc(a,e)},getInnerHeight:function(){return a.innerHeight},getScrollY:function(){var e,t,n,r;return(e=Te.fromDom(a.document),t=e!==undefined?e.dom():m.document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop,oo(n,r)).top()},scrollBy:function(e,t){var n,r,o;n=e,r=t,((o=Te.fromDom(a.document))!==undefined?o.dom():m.document).defaultView.scrollBy(n,r)}}}),bf=X("rows","cols"),wf={mouse:function(e,t,n,r){var o,i,u,a,c,l,f=vf(e),s=(o=f,i=t,u=n,a=r,c=S.none(),l=function(){c=S.none()},{mousedown:function(e){a.clear(i),c=ff(e.target(),u)},mouseover:function(e){c.each(function(r){a.clear(i),ff(e.target(),u).each(function(n){hr(r,n,u).each(function(e){var t=e.boxes().getOr([]);(1<t.length||1===t.length&&!gt(r,n))&&(a.selectRange(i,t,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(e){c.each(l)}});return{mousedown:s.mousedown,mouseover:s.mouseover,mouseup:s.mouseup}},keyboard:function(e,l,f,s){var d=vf(e),m=function(){return s.clear(l),S.none()};return{keydown:function(e,t,n,r,o,i){var u=e.raw(),a=u.which,c=!0===u.shiftKey;return pr(l,s.selectedSelector()).fold(function(){return hf.isDown(a)&&c?b(af,d,l,f,sf.down,r,t,s.selectRange):hf.isUp(a)&&c?b(af,d,l,f,sf.up,r,t,s.selectRange):hf.isDown(a)?b(uf,d,f,sf.down,r,t,lf):hf.isUp(a)?b(uf,d,f,sf.up,r,t,cf):S.none},function(t){var e=function(e){return function(){return To(e,function(e){return fl.update(e.rows(),e.cols(),l,t,s)}).fold(function(){return br(l,s.firstSelectedSelector(),s.lastSelectedSelector()).map(function(e){var t=hf.isDown(a)||i.isForward(a)?wc.after:wc.before;return d.setRelativeSelection(wc.on(e.first(),0),t(e.table())),s.clear(l),ul.create(S.none(),!0)})},function(e){return S.some(ul.create(S.none(),!0))})}};return hf.isDown(a)&&c?e([bf(1,0)]):hf.isUp(a)&&c?e([bf(-1,0)]):i.isBackward(a)&&c?e([bf(0,-1),bf(-1,0)]):i.isForward(a)&&c?e([bf(0,1),bf(1,0)]):hf.isNavigation(a)&&!1===c?m:S.none})()},keyup:function(n,r,o,i,u){return pr(l,s.selectedSelector()).fold(function(){var e=n.raw(),t=e.which;return 0==(!0===e.shiftKey)?S.none():hf.isNavigation(t)?fl.sync(l,f,r,o,i,u,s.selectRange):S.none()},S.none)}}}},yf=function(r,e){P(e,function(e){var t,n;n=e,ko(t=r)?t.dom().classList.remove(n):Po(t,n),Bo(t)})},xf={byClass:function(o){var t,n,i=(t=o.selected(),function(e){Io(e,t)}),r=(n=[o.selected(),o.lastSelected(),o.firstSelected()],function(e){yf(e,n)}),u=function(e){var t=Xt(e,o.selectedSelector());P(t,r)};return{clear:u,selectRange:function(e,t,n,r){u(e),P(t,i),Io(n,o.firstSelected()),Io(r,o.lastSelected())},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}},byAttr:function(o){var n=function(e){we(e,o.selected()),we(e,o.firstSelected()),we(e,o.lastSelected())},i=function(e){he(e,o.selected(),"1")},u=function(e){var t=Xt(e,o.selectedSelector());P(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),P(t,i),he(n,o.firstSelected(),"1"),he(r,o.lastSelected(),"1")},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}}},Cf=function(e){return!1===Wo(Te.fromDom(e.target),"ephox-snooker-resizer-bar")};function Sf(h,p){var v=ee(["mousedown","mouseover","mouseup","keyup","keydown"],[]),b=S.none(),w=xf.byAttr(Rr);return h.on("init",function(e){var r=h.getWin(),o=Uu(h),t=Gu(h),n=wf.mouse(r,o,t,w),a=wf.keyboard(r,o,t,w),c=function(e,t){!0===e.raw().shiftKey&&(t.kill()&&e.kill(),t.selection().each(function(e){var t=xc.relative(e.start(),e.finish()),n=Ec(r,t);h.selection.setRng(n)}))},i=function(e){var t=f(e);if(t.raw().shiftKey&&hf.isNavigation(t.raw().which)){var n=h.selection.getRng(),r=Te.fromDom(n.startContainer),o=Te.fromDom(n.endContainer);a.keyup(t,r,n.startOffset,o,n.endOffset).each(function(e){c(t,e)})}},u=function(e){var t=f(e);p().each(function(e){e.hideBars()});var n=h.selection.getRng(),r=Te.fromDom(h.selection.getStart()),o=Te.fromDom(n.startContainer),i=Te.fromDom(n.endContainer),u=$u.directionAt(r).isRtl()?hf.rtl:hf.ltr;a.keydown(t,o,n.startOffset,i,n.endOffset,u).each(function(e){c(t,e)}),p().each(function(e){e.showBars()})},l=function(e){return e.hasOwnProperty("x")&&e.hasOwnProperty("y")},f=function(e){var t=Te.fromDom(e.target),n=function(){e.stopPropagation()},r=function(){e.preventDefault()},o=x(r,n);return{target:C(t),x:C(l(e)?e.x:null),y:C(l(e)?e.y:null),stop:n,prevent:r,kill:o,raw:C(e)}},s=function(e){return 0===e.button},d=function(e){s(e)&&Cf(e)&&n.mousedown(f(e))},m=function(e){var t;(t=e).buttons!==undefined&&0==(1&t.buttons)||!Cf(e)||n.mouseover(f(e))},g=function(e){s(e)&&Cf(e)&&n.mouseup(f(e))};h.on("mousedown",d),h.on("mouseover",m),h.on("mouseup",g),h.on("keyup",i),h.on("keydown",u),h.on("nodechange",function(){var e=h.selection,t=Te.fromDom(e.getStart()),n=Te.fromDom(e.getEnd());sr.sharedOne(dn.table,[t,n]).fold(function(){w.clear(o)},y)}),b=S.some(v({mousedown:d,mouseover:m,mouseup:g,keyup:i,keydown:u}))}),{clear:w.clear,destroy:function(){b.each(function(e){})}}}var Rf=ha.each,Tf=function(t){var n=[];function e(e){return function(){t.execCommand(e)}}Rf("inserttable tableprops deletetable | cell row column".split(" "),function(e){"|"===e?n.push({text:"-"}):n.push(t.menuItems[e])}),t.addButton("table",{type:"menubutton",title:"Table",menu:n}),t.addButton("tableprops",{title:"Table properties",onclick:e("mceTableProps"),icon:"table"}),t.addButton("tabledelete",{title:"Delete table",onclick:e("mceTableDelete")}),t.addButton("tablecellprops",{title:"Cell properties",onclick:e("mceTableCellProps")}),t.addButton("tablemergecells",{title:"Merge cells",onclick:e("mceTableMergeCells")}),t.addButton("tablesplitcells",{title:"Split cell",onclick:e("mceTableSplitCells")}),t.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:e("mceTableInsertRowBefore")}),t.addButton("tableinsertrowafter",{title:"Insert row after",onclick:e("mceTableInsertRowAfter")}),t.addButton("tabledeleterow",{title:"Delete row",onclick:e("mceTableDeleteRow")}),t.addButton("tablerowprops",{title:"Row properties",onclick:e("mceTableRowProps")}),t.addButton("tablecutrow",{title:"Cut row",onclick:e("mceTableCutRow")}),t.addButton("tablecopyrow",{title:"Copy row",onclick:e("mceTableCopyRow")}),t.addButton("tablepasterowbefore",{title:"Paste row before",onclick:e("mceTablePasteRowBefore")}),t.addButton("tablepasterowafter",{title:"Paste row after",onclick:e("mceTablePasteRowAfter")}),t.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:e("mceTableInsertColBefore")}),t.addButton("tableinsertcolafter",{title:"Insert column after",onclick:e("mceTableInsertColAfter")}),t.addButton("tabledeletecol",{title:"Delete column",onclick:e("mceTableDeleteCol")})},Df=function(t){var e,n=""===(e=t.getParam("table_toolbar",Qu))||!1===e?[]:v(e)?e.split(/[ ,]/):w(e)?e:[];0<n.length&&t.addContextToolbar(function(e){return t.dom.is(e,"table")&&t.getBody().contains(e)},n.join(" "))},Of=function(o,n){var r=S.none(),i=[],u=[],a=[],c=[],l=function(e){e.disabled(!0)},f=function(e){e.disabled(!1)},e=function(){var t=this;i.push(t),r.fold(function(){l(t)},function(e){f(t)})},t=function(){var t=this;u.push(t),r.fold(function(){l(t)},function(e){f(t)})};o.on("init",function(){o.on("nodechange",function(e){var t=S.from(o.dom.getParent(o.selection.getStart(),"th,td"));(r=t.bind(function(e){var t=Te.fromDom(e);return dn.table(t).map(function(e){return Br.forMenu(n,e,t)})})).fold(function(){P(i,l),P(u,l),P(a,l),P(c,l)},function(t){P(i,f),P(u,f),P(a,function(e){e.disabled(t.mergable().isNone())}),P(c,function(e){e.disabled(t.unmergable().isNone())})})})});var s=function(e,t,n,r){var o,i,u,a,c,l=r.getEl().getElementsByTagName("table")[0],f=r.isRtl()||"tl-tr"===r.parent().rel;for(l.nextSibling.innerHTML=t+1+" x "+(n+1),f&&(t=9-t),i=0;i<10;i++)for(o=0;o<10;o++)a=l.rows[i].childNodes[o].firstChild,c=(f?t<=o:o<=t)&&i<=n,e.dom.toggleClass(a,"mce-active",c),c&&(u=a);return u.parentNode},d=!1===o.getParam("table_grid",!0,"boolean")?{text:"Table",icon:"table",context:"table",onclick:m("mceInsertTable")}:{text:"Table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),o.execCommand("mceInsertTable"))},onshow:function(){s(o,0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");o.dom.removeClass(e,"mce-active"),o.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:function(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;t<10;t++){e+="<tr>";for(var n=0;n<10;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t,n,r=e.target;"A"===r.tagName.toUpperCase()&&(t=parseInt(r.getAttribute("data-mce-x"),10),n=parseInt(r.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"===this.parent().rel)&&(t=9-t),t===this.lastX&&n===this.lastY||(s(o,t,n,e.control),this.lastX=t,this.lastY=n))},onclick:function(e){var t=this;"A"===e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),t.parent().cancel(),o.undoManager.transact(function(){Pa(o,t.lastX+1,t.lastY+1)}),o.addVisual())}}]};function m(e){return function(){o.execCommand(e)}}var g={text:"Table properties",context:"table",onPostRender:e,onclick:m("mceTableProps")},h={text:"Delete table",context:"table",onPostRender:e,cmd:"mceTableDelete"},p={text:"Row",context:"table",menu:[{text:"Insert row before",onclick:m("mceTableInsertRowBefore"),onPostRender:t},{text:"Insert row after",onclick:m("mceTableInsertRowAfter"),onPostRender:t},{text:"Delete row",onclick:m("mceTableDeleteRow"),onPostRender:t},{text:"Row properties",onclick:m("mceTableRowProps"),onPostRender:t},{text:"-"},{text:"Cut row",onclick:m("mceTableCutRow"),onPostRender:t},{text:"Copy row",onclick:m("mceTableCopyRow"),onPostRender:t},{text:"Paste row before",onclick:m("mceTablePasteRowBefore"),onPostRender:t},{text:"Paste row after",onclick:m("mceTablePasteRowAfter"),onPostRender:t}]},v={text:"Column",context:"table",menu:[{text:"Insert column before",onclick:m("mceTableInsertColBefore"),onPostRender:t},{text:"Insert column after",onclick:m("mceTableInsertColAfter"),onPostRender:t},{text:"Delete column",onclick:m("mceTableDeleteCol"),onPostRender:t}]},b={separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:m("mceTableCellProps"),onPostRender:t},{text:"Merge cells",onclick:m("mceTableMergeCells"),onPostRender:function(){var t=this;a.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.mergable().isNone())})}},{text:"Split cell",onclick:m("mceTableSplitCells"),onPostRender:function(){var t=this;c.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.unmergable().isNone())})}}]};o.addMenuItem("inserttable",d),o.addMenuItem("tableprops",g),o.addMenuItem("deletetable",h),o.addMenuItem("row",p),o.addMenuItem("column",v),o.addMenuItem("cell",b)},Nf=function(n,r){return{insertTable:function(e,t){return Pa(n,e,t)},setClipboardRows:function(e){return t=r,n=A(e,Te.fromDom),void t.set(S.from(n));var t,n},getClipboardRows:function(){return r.get().fold(function(){},function(e){return A(e,function(e){return e.dom()})})}}};e.add("table",function(t){var n,r=sc(t),e=Sf(t,r.lazyResize),o=ma(t,r.lazyWire),i=(n=t,{get:function(){var e=Uu(n);return wr(e,Rr.selectedSelector()).fold(function(){return n.selection.getStart()===undefined?Or.none():Or.single(n.selection)},function(e){return Or.multiple(e)})}}),u=mu(S.none());return La(t,o,e,i,u),Wr(t,i,o,e),Of(t,i),Tf(t),Df(t),t.on("PreInit",function(){t.serializer.addTempAttr(Rr.firstSelected()),t.serializer.addTempAttr(Rr.lastSelected())}),t.getParam("table_tab_navigation",!0,"boolean")&&t.on("keydown",function(e){il(e,t,o,r.lazyWire)}),t.on("remove",function(){r.destroy(),e.destroy()}),Nf(t,u)})}(window);
1
+ !function(m){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=function(){},x=function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,e))}},C=function(e){return function(){return e}},o=function(e){return e};function b(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o.concat(e);return r.apply(null,n)}}var t,n,r,i,g=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,e)}},f=C(!1),u=C(!0),a=function(){return c},c=(t=function(e){return e.isNone()},i={fold:function(e,t){return e()},is:f,isSome:f,isNone:u,getOr:r=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:C(null),getOrUndefined:C(undefined),or:r,orThunk:n,map:a,each:y,bind:a,exists:f,forall:u,filter:a,equals:t,equals_:t,toArray:function(){return[]},toString:C("none()")},Object.freeze&&Object.freeze(i),i),l=function(n){var e=C(n),t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:u,isNone:f,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return l(e(n))},each:function(e){e(n)},bind:r,exists:r,forall:r,filter:function(e){return e(n)?o:c},toArray:function(){return[n]},toString:function(){return"some("+n+")"},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(f,function(e){return t(n,e)})}};return o},R={some:l,none:a,from:function(e){return null===e||e===undefined?c:l(e)}},s=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t}(e)===t}},d=s("string"),h=s("array"),p=s("boolean"),v=s("function"),w=s("number"),S=Array.prototype.slice,T=Array.prototype.indexOf,D=Array.prototype.push,O=function(e,t){return n=e,r=t,-1<T.call(n,r);var n,r},N=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},E=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o)}return r},k=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)},A=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r)&&n.push(i)}return n},P=function(e,t,n){return function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n)}(e,function(e){n=t(n,e)}),n},I=function(e,t,n){return k(e,function(e){n=t(n,e)}),n},B=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n))return R.some(o)}return R.none()},W=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n))return R.some(n);return R.none()},M=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!h(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);D.apply(t,e[n])}return t},_=function(e,t){var n=E(e,t);return M(n)},L=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n))return!1;return!0},F=function(e){var t=S.call(e,0);return t.reverse(),t},j=(v(Array.from)&&Array.from,Object.keys),z=function(e,t){for(var n=j(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i)}},H=function(e,n){return U(e,function(e,t){return{k:t,v:n(e,t)}})},U=function(e,r){var o={};return z(e,function(e,t){var n=r(e,t);o[n.k]=n.v}),o},q=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(t.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+n.length+" arguments");var r={};return k(t,function(e,t){r[e]=C(n[t])}),r}},V=function(e){return e.slice(0).sort()},G=function(e,t){throw new Error("All required keys ("+V(e).join(", ")+") were not specified. Specified keys were: "+V(t).join(", ")+".")},Y=function(e){throw new Error("Unsupported keys for object: "+V(e).join(", "))},X=function(t,e){if(!h(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");k(e,function(e){if(!d(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},K=function(e){var n=V(e);B(n,function(e,t){return t<n.length-1&&e===n[t+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})},J=function(o,i){var u=o.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return X("required",o),X("optional",i),K(u),function(t){var n=j(t);L(o,function(e){return O(n,e)})||G(o,n);var e=A(n,function(e){return!O(u,e)});0<e.length&&Y(e);var r={};return k(o,function(e){r[e]=C(t[e])}),k(i,function(e){r[e]=C(Object.prototype.hasOwnProperty.call(t,e)?R.some(t[e]):R.none())}),r}},$=(m.Node.ATTRIBUTE_NODE,m.Node.CDATA_SECTION_NODE,m.Node.COMMENT_NODE),Q=m.Node.DOCUMENT_NODE,Z=(m.Node.DOCUMENT_TYPE_NODE,m.Node.DOCUMENT_FRAGMENT_NODE,m.Node.ELEMENT_NODE),ee=m.Node.TEXT_NODE,te=(m.Node.PROCESSING_INSTRUCTION_NODE,m.Node.ENTITY_REFERENCE_NODE,m.Node.ENTITY_NODE,m.Node.NOTATION_NODE,"undefined"!=typeof m.window?m.window:Function("return this;")()),ne=function(e,t){return function(e,t){for(var n=t!==undefined&&null!==t?t:te,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n}(e.split("."),t)},re=function(e,t){var n=ne(e,t);if(n===undefined||null===n)throw new Error(e+" not available on this browser");return n},oe=function(e){return e.dom().nodeName.toLowerCase()},ie=function(e){return e.dom().nodeType},ue=function(t){return function(e){return ie(e)===t}},ae=function(e){return ie(e)===$||"#comment"===oe(e)},ce=ue(Z),le=ue(ee),fe=function(e,t,n){if(!(d(n)||p(n)||w(n)))throw m.console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},se=function(e,t,n){fe(e.dom(),t,n)},de=function(e,t){var n=e.dom();z(t,function(e,t){fe(n,t,e)})},me=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},ge=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},he=function(e,t){e.dom().removeAttribute(t)},pe=function(e){return I(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},ve=function(e,t){return-1!==e.indexOf(t)},be=function(e){return e.style!==undefined&&v(e.style.getPropertyValue)},we=function(n){var r,o=!1;return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o||(o=!0,r=n.apply(null,e)),r}},ye=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:C(e)}},xe={fromHtml:function(e,t){var n=(t||m.document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw m.console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return ye(n.childNodes[0])},fromTag:function(e,t){var n=(t||m.document).createElement(e);return ye(n)},fromText:function(e,t){var n=(t||m.document).createTextNode(e);return ye(n)},fromDom:ye,fromPoint:function(e,t,n){var r=e.dom();return R.from(r.elementFromPoint(t,n)).map(ye)}},Ce=function(e){var t=le(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)},Re=we(function(){return Se(xe.fromDom(m.document))}),Se=function(e){var t=e.dom().body;if(null===t||t===undefined)throw new Error("Body is not available yet");return xe.fromDom(t)},Te=function(e,t,n){if(!d(n))throw m.console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);be(e)&&e.style.setProperty(t,n)},De=function(e,t,n){var r=e.dom();Te(r,t,n)},Oe=function(e,t){var n=e.dom();z(t,function(e,t){Te(n,t,e)})},Ne=function(e,t){var n=e.dom(),r=m.window.getComputedStyle(n).getPropertyValue(t),o=""!==r||Ce(e)?r:Ee(n,t);return null===o?undefined:o},Ee=function(e,t){return be(e)?e.style.getPropertyValue(t):""},ke=function(e,t){var n=e.dom(),r=Ee(n,t);return R.from(r).filter(function(e){return 0<e.length})},Ae=function(e,t){var n,r,o=e.dom();r=t,be(n=o)&&n.style.removeProperty(r),ge(e,"style")&&""===me(e,"style").replace(/^\s+|\s+$/g,"")&&he(e,"style")},Pe=function(){return re("Node")},Ie=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},Be=function(e,t){return Ie(e,t,Pe().DOCUMENT_POSITION_CONTAINED_BY)},We=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.test(t))return r}return undefined}(e,t);if(!n)return{major:0,minor:0};var r=function(e){return Number(t.replace(n,"$"+e))};return _e(r(1),r(2))},Me=function(){return _e(0,0)},_e=function(e,t){return{major:e,minor:t}},Le={nu:_e,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?Me():We(e,n)},unknown:Me},Fe="Firefox",je=function(e,t){return function(){return t===e}},ze=function(e){var t=e.current;return{current:t,version:e.version,isEdge:je("Edge",t),isChrome:je("Chrome",t),isIE:je("IE",t),isOpera:je("Opera",t),isFirefox:je(Fe,t),isSafari:je("Safari",t)}},He={unknown:function(){return ze({current:undefined,version:Le.unknown()})},nu:ze,edge:C("Edge"),chrome:C("Chrome"),ie:C("IE"),opera:C("Opera"),firefox:C(Fe),safari:C("Safari")},Ue="Windows",qe="Android",Ve="Solaris",Ge="FreeBSD",Ye=function(e,t){return function(){return t===e}},Xe=function(e){var t=e.current;return{current:t,version:e.version,isWindows:Ye(Ue,t),isiOS:Ye("iOS",t),isAndroid:Ye(qe,t),isOSX:Ye("OSX",t),isLinux:Ye("Linux",t),isSolaris:Ye(Ve,t),isFreeBSD:Ye(Ge,t)}},Ke={unknown:function(){return Xe({current:undefined,version:Le.unknown()})},nu:Xe,windows:C(Ue),ios:C("iOS"),android:C(qe),linux:C("Linux"),osx:C("OSX"),solaris:C(Ve),freebsd:C(Ge)},Je=function(e,t){var n=String(t).toLowerCase();return B(e,function(e){return e.search(n)})},$e=function(e,n){return Je(e,n).map(function(e){var t=Le.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Qe=function(e,n){return Je(e,n).map(function(e){var t=Le.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Ze=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,et=function(t){return function(e){return ve(e,t)}},tt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return ve(e,"edge/")&&ve(e,"chrome")&&ve(e,"safari")&&ve(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ze],search:function(e){return ve(e,"chrome")&&!ve(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return ve(e,"msie")||ve(e,"trident")}},{name:"Opera",versionRegexes:[Ze,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:et("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:et("firefox")},{name:"Safari",versionRegexes:[Ze,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(ve(e,"safari")||ve(e,"mobile/"))&&ve(e,"applewebkit")}}],nt=[{name:"Windows",search:et("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return ve(e,"iphone")||ve(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:et("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:et("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:et("linux"),versionRegexes:[]},{name:"Solaris",search:et("sunos"),versionRegexes:[]},{name:"FreeBSD",search:et("freebsd"),versionRegexes:[]}],rt={browsers:C(tt),oses:C(nt)},ot=function(e){var t,n,r,o,i,u,a,c,l,f,s,d=rt.browsers(),m=rt.oses(),g=$e(d,e).fold(He.unknown,He.nu),h=Qe(m,e).fold(Ke.unknown,Ke.nu);return{browser:g,os:h,deviceType:(n=g,r=e,o=(t=h).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,c=o||u||a&&!0===/mobile/i.test(r),l=t.isiOS()||t.isAndroid(),f=l&&!c,s=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:C(o),isiPhone:C(i),isTablet:C(c),isPhone:C(f),isTouch:C(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:C(s)})}},it={detect:we(function(){var e=m.navigator.userAgent;return ot(e)})},ut=Z,at=Q,ct=function(e,t){var n=e.dom();if(n.nodeType!==ut)return!1;var r=n;if(r.matches!==undefined)return r.matches(t);if(r.msMatchesSelector!==undefined)return r.msMatchesSelector(t);if(r.webkitMatchesSelector!==undefined)return r.webkitMatchesSelector(t);if(r.mozMatchesSelector!==undefined)return r.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},lt=function(e){return e.nodeType!==ut&&e.nodeType!==at||0===e.childElementCount},ft=function(e,t){return e.dom()===t.dom()},st=it.detect().browser.isIE()?function(e,t){return Be(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},dt=ct,mt=function(e){return xe.fromDom(e.dom().ownerDocument)},gt=function(e){return R.from(e.dom().parentNode).map(xe.fromDom)},ht=function(e,t){for(var n=v(t)?t:f,r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=xe.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},pt=function(e){return R.from(e.dom().previousSibling).map(xe.fromDom)},vt=function(e){return R.from(e.dom().nextSibling).map(xe.fromDom)},bt=function(e){return E(e.dom().childNodes,xe.fromDom)},wt=function(e,t){var n=e.dom().childNodes;return R.from(n[t]).map(xe.fromDom)},yt=(q("element","offset"),function(t,n){gt(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})}),xt=function(e,t){vt(e).fold(function(){gt(e).each(function(e){Rt(e,t)})},function(e){yt(e,t)})},Ct=function(t,n){wt(t,0).fold(function(){Rt(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},Rt=function(e,t){e.dom().appendChild(t.dom())},St=function(e,t){yt(e,t),Rt(t,e)},Tt=function(r,o){k(o,function(e,t){var n=0===t?r:o[t-1];xt(n,e)})},Dt=function(t,e){k(e,function(e){Rt(t,e)})},Ot=function(e){e.dom().textContent="",k(bt(e),function(e){Nt(e)})},Nt=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},Et=function(e){var t,n=bt(e);0<n.length&&(t=e,k(n,function(e){yt(t,e)})),Nt(e)},kt=(q("width","height"),q("width","height"),q("rows","columns")),At=q("row","column"),Pt=(q("x","y"),q("element","rowspan","colspan")),It=q("element","rowspan","colspan","isNew"),Bt=q("element","rowspan","colspan","row","column"),Wt=q("element","cells","section"),Mt=q("element","isNew"),_t=q("element","cells","section","isNew"),Lt=q("cells","section"),Ft=q("details","section"),jt=q("startRow","startCol","finishRow","finishCol"),zt=function(e,t){var n=[];return k(bt(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(zt(e,t))}),n},Ht=function(e,t,n){return r=function(e){return ct(e,t)},A(ht(e,n),r);var r},Ut=function(e,t){return n=function(e){return ct(e,t)},A(bt(e),n);var n},qt=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),lt(o)?[]:E(o.querySelectorAll(n),xe.fromDom);var n,r,o};function Vt(e,t,n,r,o){return e(n,r)?R.some(n):v(o)&&o(n)?R.none():t(n,r,o)}var Gt,Yt,Xt,Kt=function(e,t,n){for(var r=e.dom(),o=v(n)?n:C(!1);r.parentNode;){r=r.parentNode;var i=xe.fromDom(r);if(t(i))return R.some(i);if(o(i))break}return R.none()},Jt=function(e,t,n){return Kt(e,function(e){return ct(e,t)},n)},$t=function(e,t){return n=function(e){return ct(e,t)},B(e.dom().childNodes,function(e){return n(xe.fromDom(e))}).map(xe.fromDom);var n},Qt=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),lt(o)?R.none():R.from(o.querySelector(n)).map(xe.fromDom);var n,r,o},Zt=function(e,t,n){return Vt(ct,Jt,e,t,n)},en=function(e,t,n){return _(bt(e),function(e){return ct(e,t)?n(e)?[e]:[]:en(e,t,n)})},tn={firstLayer:function(e,t){return en(e,t,C(!0))},filterFirstLayer:en},nn=function(e,t,n){return void 0===n&&(n=f),n(t)?R.none():O(e,oe(t))?R.some(t):Jt(t,e.join(","),function(e){return ct(e,"table")||n(e)})},rn=function(t,e){return gt(e).map(function(e){return Ut(e,t)})},on=b(rn,"th,td"),un=b(rn,"tr"),an=function(e,t){return parseInt(me(e,t),10)},cn={cell:function(e,t){return nn(["td","th"],e,t)},firstCell:function(e){return Qt(e,"th,td")},cells:function(e){return tn.firstLayer(e,"th,td")},neighbourCells:on,table:function(e,t){return Zt(e,"table",t)},row:function(e,t){return nn(["tr"],e,t)},rows:function(e){return tn.firstLayer(e,"tr")},notCell:function(e,t){return nn(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:un,attr:an,grid:function(e,t,n){var r=an(e,t),o=an(e,n);return kt(r,o)}},ln=function(e){var t=cn.rows(e);return E(t,function(e){var t=e,n=gt(t).map(function(e){var t=oe(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}).getOr("tbody"),r=E(cn.cells(e),function(e){var t=ge(e,"rowspan")?parseInt(me(e,"rowspan"),10):1,n=ge(e,"colspan")?parseInt(me(e,"colspan"),10):1;return Pt(e,t,n)});return Wt(t,r,n)})},fn=function(e,n){return E(e,function(e){var t=E(cn.cells(e),function(e){var t=ge(e,"rowspan")?parseInt(me(e,"rowspan"),10):1,n=ge(e,"colspan")?parseInt(me(e,"colspan"),10):1;return Pt(e,t,n)});return Wt(e,t,n.section())})},sn=function(e,t){return e+","+t},dn=function(e,t){var n=_(e.all(),function(e){return e.cells()});return A(n,t)},mn={generate:function(e){var l={},t=[],n=e.length,f=0;k(e,function(e,a){var c=[];k(e.cells(),function(e){for(var t=0;l[sn(a,t)]!==undefined;)t++;for(var n=Bt(e.element(),e.rowspan(),e.colspan(),a,t),r=0;r<e.colspan();r++)for(var o=0;o<e.rowspan();o++){var i=t+r,u=sn(a+o,i);l[u]=n,f=Math.max(f,i+1)}c.push(n)}),t.push(Wt(e.element(),c,e.section()))});var r=kt(n,f);return{grid:C(r),access:C(l),all:C(t)}},getAt:function(e,t,n){var r=e.access()[sn(t,n)];return r!==undefined?R.some(r):R.none()},findItem:function(e,t,n){var r=dn(e,function(e){return n(t,e.element())});return 0<r.length?R.some(r[0]):R.none()},filterItems:dn,justCells:function(e){var t=E(e.all(),function(e){return e.cells()});return M(t)}},gn=q("minRow","minCol","maxRow","maxCol"),hn=function(e,t){var n,i,r,u,a,c,l,o,f,s,d=function(e){return ct(e.element(),t)},m=ln(e),g=mn.generate(m),h=(i=d,r=(n=g).grid().columns(),u=n.grid().rows(),a=r,l=c=0,z(n.access(),function(e){if(i(e)){var t=e.row(),n=t+e.rowspan()-1,r=e.column(),o=r+e.colspan()-1;t<u?u=t:c<n&&(c=n),r<a?a=r:l<o&&(l=o)}}),gn(u,a,c,l)),p="th:not("+t+"),td:not("+t+")",v=tn.filterFirstLayer(e,"th,td",function(e){return ct(e,p)});return k(v,Nt),function(e,t,n,r){for(var o,i,u,a=t.grid().columns(),c=t.grid().rows(),l=0;l<c;l++)for(var f=!1,s=0;s<a;s++)l<n.minRow()||l>n.maxRow()||s<n.minCol()||s>n.maxCol()||(mn.getAt(t,l,s).filter(r).isNone()?(o=f,i=e[l].element(),u=xe.fromTag("td"),Rt(u,xe.fromTag("br")),(o?Rt:Ct)(i,u)):f=!0)}(m,g,h,d),o=e,f=h,s=A(tn.firstLayer(o,"tr"),function(e){return 0===e.dom().childElementCount}),k(s,Nt),f.minCol()!==f.maxCol()&&f.minRow()!==f.maxRow()||k(tn.firstLayer(o,"th,td"),function(e){he(e,"rowspan"),he(e,"colspan")}),he(o,"width"),he(o,"height"),Ae(o,"width"),Ae(o,"height"),e},pn=(Gt=le,Yt="text",{get:function(e){if(!Gt(e))throw new Error("Can only get "+Yt+" value of a "+Yt+" node");return Xt(e).getOr("")},getOption:Xt=function(e){return Gt(e)?R.from(e.dom().nodeValue):R.none()},set:function(e,t){if(!Gt(e))throw new Error("Can only set raw "+Yt+" value of a "+Yt+" node");e.dom().nodeValue=t}}),vn=function(e){return pn.get(e)},bn=function(e){return pn.getOption(e)},wn=function(e,t){pn.set(e,t)},yn=function(e){return"img"===oe(e)?1:bn(e).fold(function(){return bt(e).length},function(e){return e.length})},xn=["img","br"],Cn=function(e){return bn(e).filter(function(e){return 0!==e.trim().length||-1<e.indexOf("\xa0")}).isSome()||O(xn,oe(e))},Rn=function(e){return o=Cn,(i=function(e){for(var t=0;t<e.childNodes.length;t++){var n=xe.fromDom(e.childNodes[t]);if(o(n))return R.some(n);var r=i(e.childNodes[t]);if(r.isSome())return r}return R.none()})(e.dom());var o,i},Sn=function(e){return Tn(e,Cn)},Tn=function(e,i){var u=function(e){for(var t=bt(e),n=t.length-1;0<=n;n--){var r=t[n];if(i(r))return R.some(r);var o=u(r);if(o.isSome())return o}return R.none()};return u(e)},Dn=function(e,t){return xe.fromDom(e.dom().cloneNode(t))},On=function(e){return Dn(e,!1)},Nn=function(e){return Dn(e,!0)},En=function(e,t){var n,r,o,i,u=(n=e,r=t,o=xe.fromTag(r),i=pe(n),de(o,i),o),a=bt(Nn(e));return Dt(u,a),u},kn=function(){var e=xe.fromTag("td");return Rt(e,xe.fromTag("br")),e},An=function(e,t,n){var r=En(e,t);return z(n,function(e,t){null===e?he(r,t):se(r,t,e)}),r},Pn=function(e){return e},In=function(e){return function(){return xe.fromTag("tr",e.dom())}},Bn=function(d,e,m){return{row:In(e),cell:function(e){var r,o,i,t,n,u,a,c=mt(e.element()),l=xe.fromTag(oe(e.element()),c.dom()),f=m.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),s=0<f.length?(r=e.element(),o=l,i=f,Rn(r).map(function(e){var t=i.join(","),n=Ht(e,t,function(e){return ft(e,r)});return P(n,function(e,t){var n=On(t);return he(n,"contenteditable"),Rt(e,n),n},o)}).getOr(o)):l;return Rt(s,xe.fromTag("br")),t=e.element(),n=l,u=t.dom(),a=n.dom(),be(u)&&be(a)&&(a.style.cssText=u.style.cssText),Ae(l,"height"),1!==e.colspan()&&Ae(e.element(),"width"),d(e.element(),l),l},replace:An,gap:kn}},Wn=function(e){return{row:In(e),cell:kn,replace:Pn,gap:kn}},Mn=function(e,t){return t.column()>=e.startCol()&&t.column()+t.colspan()-1<=e.finishCol()&&t.row()>=e.startRow()&&t.row()+t.rowspan()-1<=e.finishRow()},_n=function(e,t){var n=t.column(),r=t.column()+t.colspan()-1,o=t.row(),i=t.row()+t.rowspan()-1;return n<=e.finishCol()&&r>=e.startCol()&&o<=e.finishRow()&&i>=e.startRow()},Ln=function(e,t){for(var n=!0,r=b(Mn,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&mn.getAt(e,o,i).exists(r);return n?R.some(t):R.none()},Fn=function(e,t,n){var r=mn.findItem(e,t,ft),o=mn.findItem(e,n,ft);return r.bind(function(r){return o.map(function(e){return t=r,n=e,jt(Math.min(t.row(),n.row()),Math.min(t.column(),n.column()),Math.max(t.row()+t.rowspan()-1,n.row()+n.rowspan()-1),Math.max(t.column()+t.colspan()-1,n.column()+n.colspan()-1));var t,n})})},jn=Fn,zn=function(t,e,n){return Fn(t,e,n).bind(function(e){return Ln(t,e)})},Hn=function(r,e,o,i){return mn.findItem(r,e,ft).bind(function(e){var t=0<o?e.row()+e.rowspan()-1:e.row(),n=0<i?e.column()+e.colspan()-1:e.column();return mn.getAt(r,t+o,n+i).map(function(e){return e.element()})})},Un=function(n,e,t){return jn(n,e,t).map(function(e){var t=mn.filterItems(n,b(_n,e));return E(t,function(e){return e.element()})})},qn=function(e,t){return mn.findItem(e,t,function(e,t){return st(t,e)}).map(function(e){return e.element()})},Vn=function(e){var t=ln(e);return mn.generate(t)},Gn=function(n,r,o){return cn.table(n).bind(function(e){var t=Vn(e);return Hn(t,n,r,o)})},Yn=function(e,t,n){var r=Vn(e);return Un(r,t,n)},Xn=function(e,t,n,r,o){var i=Vn(e),u=ft(e,n)?R.some(t):qn(i,t),a=ft(e,o)?R.some(r):qn(i,r);return u.bind(function(t){return a.bind(function(e){return Un(i,t,e)})})},Kn=function(e,t,n){var r=Vn(e);return zn(r,t,n)},Jn=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];function $n(){return{up:C({selector:Jt,closest:Zt,predicate:Kt,all:ht}),down:C({selector:qt,predicate:zt}),styles:C({get:Ne,getRaw:ke,set:De,remove:Ae}),attrs:C({get:me,set:se,remove:he,copyTo:function(e,t){var n=pe(e);de(t,n)}}),insert:C({before:yt,after:xt,afterAll:Tt,append:Rt,appendAll:Dt,prepend:Ct,wrap:St}),remove:C({unwrap:Et,remove:Nt}),create:C({nu:xe.fromTag,clone:function(e){return xe.fromDom(e.dom().cloneNode(!1))},text:xe.fromText}),query:C({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:pt,nextSibling:vt}),property:C({children:bt,name:oe,parent:gt,document:function(e){return e.dom().ownerDocument},isText:le,isComment:ae,isElement:ce,getText:vn,setText:wn,isBoundary:function(e){return!!ce(e)&&("body"===oe(e)||O(Jn,oe(e)))},isEmptyTag:function(e){return!!ce(e)&&O(["br","img","hr","input"],oe(e))}}),eq:ft,is:dt}}var Qn=q("left","right"),Zn=q("first","second","splits"),er=function(e,t,n){var r=e.property().children(t);return W(r,b(e.eq,n)).map(function(e){return{before:C(r.slice(0,e)),after:C(r.slice(e+1))}})},tr=function(r,o,e,t){var n=o(r,e);return P(t,function(e,t){var n=o(r,t);return nr(r,e,n)},n)},nr=function(t,e,n){return e.bind(function(e){return n.filter(b(t.eq,e))})},rr=function(e,t){return b(e.eq,t)},or=function(t,e,n,r){void 0===r&&(r=f);var o=[e].concat(t.up().all(e)),i=[n].concat(t.up().all(n)),u=function(t){return W(t,r).fold(function(){return t},function(e){return t.slice(0,e+1)})},a=u(o),c=u(i),l=B(a,function(e){return N(c,rr(t,e))});return{firstpath:C(a),secondpath:C(c),shared:C(l)}},ir={sharedOne:function(e,t,n){return 0<n.length?tr(e,t,(r=n)[0],r.slice(1)):R.none();var r},subset:function(t,e,n){var r=or(t,e,n);return r.shared().bind(function(e){return function(o,i,e,t){var u=o.property().children(i);if(o.eq(i,e[0]))return R.some([e[0]]);if(o.eq(i,t[0]))return R.some([t[0]]);var n=function(e){var t=F(e),n=W(t,rr(o,i)).getOr(-1),r=n<t.length-1?t[n+1]:t[n];return W(u,rr(o,r))},r=n(e),a=n(t);return r.bind(function(r){return a.map(function(e){var t=Math.min(r,e),n=Math.max(r,e);return u.slice(t,n+1)})})}(t,e,r.firstpath(),r.secondpath())})},ancestors:or,breakToLeft:function(n,r,o){return er(n,r,o).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.before().concat([o])),n.insert().appendAll(r,e.after()),n.insert().before(r,t),Qn(t,r)})},breakToRight:function(n,r,e){return er(n,r,e).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.after()),n.insert().after(r,t),Qn(r,t)})},breakPath:function(i,e,u,a){var c=function(e,t,o){var n=Zn(e,R.none(),o);return u(e)?Zn(e,t,o):i.property().parent(e).bind(function(r){return a(i,r,e).map(function(e){var t=[{first:e.left,second:e.right}],n=u(r)?r:e.left();return c(n,R.some(e.right()),o.concat(t))})}).getOr(n)};return c(e,R.none(),[])}},ur=$n(),ar={sharedOne:function(n,e){return ir.sharedOne(ur,function(e,t){return n(t)},e)},subset:function(e,t){return ir.subset(ur,e,t)},ancestors:function(e,t,n){return ir.ancestors(ur,e,t,n)},breakToLeft:function(e,t){return ir.breakToLeft(ur,e,t)},breakToRight:function(e,t){return ir.breakToRight(ur,e,t)},breakPath:function(e,t,r){return ir.breakPath(ur,e,t,function(e,t,n){return r(t,n)})}},cr={create:J(["boxes","start","finish"],[])},lr=function(e){return Jt(e,"table")},fr=function(a,c,r){var l=function(t){return function(e){return r!==undefined&&r(e)||ft(e,t)}};return ft(a,c)?R.some(cr.create({boxes:R.some([a]),start:a,finish:c})):lr(a).bind(function(u){return lr(c).bind(function(i){if(ft(u,i))return R.some(cr.create({boxes:Yn(u,a,c),start:a,finish:c}));if(st(u,i)){var e=0<(t=Ht(c,"td,th",l(u))).length?t[t.length-1]:c;return R.some(cr.create({boxes:Xn(u,a,u,c,i),start:a,finish:e}))}if(st(i,u)){var t,n=0<(t=Ht(a,"td,th",l(i))).length?t[t.length-1]:a;return R.some(cr.create({boxes:Xn(i,a,u,c,i),start:a,finish:n}))}return ar.ancestors(a,c).shared().bind(function(e){return Zt(e,"table",r).bind(function(e){var t=Ht(c,"td,th",l(e)),n=0<t.length?t[t.length-1]:c,r=Ht(a,"td,th",l(e)),o=0<r.length?r[r.length-1]:a;return R.some(cr.create({boxes:Xn(e,a,u,c,i),start:o,finish:n}))})})})})},sr=fr,dr=function(e,t){var n=qt(e,t);return 0<n.length?R.some(n):R.none()},mr=function(e,t,n,r,o){return(i=e,u=o,B(i,function(e){return ct(e,u)})).bind(function(e){return Gn(e,t,n).bind(function(e){return n=r,Jt(t=e,"table").bind(function(e){return Qt(e,n).bind(function(e){return fr(e,t).bind(function(t){return t.boxes().map(function(e){return{boxes:C(e),start:C(t.start()),finish:C(t.finish())}})})})});var t,n})});var i,u},gr=function(e,t,r){return Qt(e,t).bind(function(n){return Qt(e,r).bind(function(t){return ar.sharedOne(lr,[n,t]).map(function(e){return{first:C(n),last:C(t),table:C(e)}})})})},hr=function(e,t){return dr(e,t)},pr=function(o,e,t){return gr(o,e,t).bind(function(n){var e=function(e){return ft(o,e)},t=Jt(n.first(),"thead,tfoot,tbody,table",e),r=Jt(n.last(),"thead,tfoot,tbody,table",e);return t.bind(function(t){return r.bind(function(e){return ft(t,e)?Kn(n.table(),n.first(),n.last()):R.none()})})})},vr="data-mce-selected",br="data-mce-first-selected",wr="data-mce-last-selected",yr={selected:C(vr),selectedSelector:C("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:C("[data-mce-selected]"),firstSelected:C(br),firstSelectedSelector:C("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:C(wr),lastSelectedSelector:C("td[data-mce-last-selected],th[data-mce-last-selected]")},xr=function(u){if(!h(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],n={};return k(u,function(e,r){var t=j(e);if(1!==t.length)throw new Error("one and only one name per case");var o=t[0],i=e[o];if(n[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!h(i))throw new Error("case arguments must be an array");a.push(o),n[o]=function(){var e=arguments.length;if(e!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+e);for(var n=new Array(e),t=0;t<n.length;t++)n[t]=arguments[t];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[r].apply(null,n)},match:function(e){var t=j(e);if(a.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+t.join(","));if(!L(a,function(e){return O(t,e)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+a.join(", "));return e[o].apply(null,n)},log:function(e){m.console.log(e,{constructors:a,constructor:o,params:n})}}}}),n},Cr=xr([{none:[]},{multiple:["elements"]},{single:["selection"]}]),Rr={cata:function(e,t,n,r){return e.fold(t,n,r)},none:Cr.none,multiple:Cr.multiple,single:Cr.single},Sr=function(e,t){return Rr.cata(t.get(),C([]),o,C([e]))},Tr=function(n,e){return Rr.cata(e.get(),R.none,function(t,e){return 0===t.length?R.none():pr(n,yr.firstSelectedSelector(),yr.lastSelectedSelector()).bind(function(e){return 1<t.length?R.some({bounds:C(e),cells:C(t)}):R.none()})},R.none)},Dr=function(e,t){var n=Sr(e,t);return 0<n.length&&L(n,function(e){return ge(e,"rowspan")&&1<parseInt(me(e,"rowspan"),10)||ge(e,"colspan")&&1<parseInt(me(e,"colspan"),10)})?R.some(n):R.none()},Or=Sr,Nr=function(e){return{element:C(e),mergable:R.none,unmergable:R.none,selection:C([e])}},Er=q("element","clipboard","generators"),kr={noMenu:Nr,forMenu:function(e,t,n){return{element:C(n),mergable:C(Tr(t,e)),unmergable:C(Dr(n,e)),selection:C(Or(n,e))}},notCell:function(e){return Nr(e)},paste:Er,pasteRows:function(e,t,n,r,o){return{element:C(n),mergable:R.none,unmergable:R.none,selection:C(Or(n,e)),clipboard:C(r),generators:C(o)}}},Ar=function(f,e,s,d){f.on("BeforeGetContent",function(n){!0===n.selection&&Rr.cata(e.get(),y,function(e){var t;n.preventDefault(),(t=e,cn.table(t[0]).map(Nn).map(function(e){return[hn(e,yr.attributeSelector())]})).each(function(e){var t;n.content="text"===n.format?E(e,function(e){return e.dom().innerText}).join(""):(t=f,E(e,function(e){return t.selection.serializer.serialize(e.dom(),{})}).join(""))})},y)}),f.on("BeforeSetContent",function(l){!0===l.selection&&!0===l.paste&&R.from(f.dom.getParent(f.selection.getStart(),"th,td")).each(function(e){var c=xe.fromDom(e);cn.table(c).each(function(t){var e,n,r,o=A((e=l.content,(r=(n||m.document).createElement("div")).innerHTML=e,bt(xe.fromDom(r))),function(e){return"meta"!==oe(e)});if(1===o.length&&"table"===oe(o[0])){l.preventDefault();var i=xe.fromDom(f.getDoc()),u=Wn(i),a=kr.paste(c,o[0],u);s.pasteCells(t,a).each(function(e){f.selection.setRng(e),f.focus(),d.clear(t)})}})})})};function Pr(r,o){var e=function(e){var t=o(e);if(t<=0||null===t){var n=Ne(e,r);return parseFloat(n)||0}return t},i=function(o,e){return I(e,function(e,t){var n=Ne(o,t),r=n===undefined?0:parseInt(n,10);return isNaN(r)?e:e+r},0)};return{set:function(e,t){if(!w(t)&&!t.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+t);var n=e.dom();be(n)&&(n.style[r]=t+"px")},get:e,getOuter:e,aggregate:i,max:function(e,t,n){var r=i(e,n);return r<t?t-r:0}}}var Ir=Pr("height",function(e){var t=e.dom();return Ce(e)?t.getBoundingClientRect().height:t.offsetHeight}),Br=function(e){return Ir.get(e)},Wr=function(e){return Ir.getOuter(e)},Mr=Pr("width",function(e){return e.dom().offsetWidth}),_r=function(e){return Mr.get(e)},Lr=function(e){return Mr.getOuter(e)},Fr=it.detect(),jr=function(e,t,n){return r=Ne(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},zr=function(e){return Fr.browser.isIE()||Fr.browser.isEdge()?(n=jr(t=e,"padding-top",0),r=jr(t,"padding-bottom",0),o=jr(t,"border-top-width",0),i=jr(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===Ne(t,"box-sizing")?u:u-n-r-(o+i)):jr(e,"height",Br(e));var t,n,r,o,i,u},Hr=/(\d+(\.\d+)?)(\w|%)*/,Ur=/(\d+(\.\d+)?)%/,qr=/(\d+(\.\d+)?)px|em/,Vr=function(e,t){De(e,"height",t+"px")},Gr=function(e,t,n,r){var o,i,u,a,c,l,f,s,d,m=parseInt(e,10);return s=l="%",d=(f=e).length-l.length,""!==s&&(f.length<s.length||f.substr(d,d+s.length)!==s)||"table"===oe(t)?m:(o=t,i=m,u=n,a=r,c=cn.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),a(o,c),c)},Yr=function(e){var t,n=ke(t=e,"height").getOrThunk(function(){return zr(t)+"px"});return n?Gr(n,e,Br,Vr):Br(e)},Xr=function(e,t){return ge(e,t)?parseInt(me(e,t),10):1},Kr=function(e){return ke(e,"width").fold(function(){return R.from(me(e,"width"))},function(e){return R.some(e)})},Jr=function(e,t){return e/t.pixelWidth()*100},$r={percentageBasedSizeRegex:C(Ur),pixelBasedSizeRegex:C(qr),setPixelWidth:function(e,t){De(e,"width",t+"px")},setPercentageWidth:function(e,t){De(e,"width",t+"%")},setHeight:Vr,getPixelWidth:function(t,n){return Kr(t).fold(function(){return _r(t)},function(e){return function(e,t,n){var r=qr.exec(t);if(null!==r)return parseInt(r[1],10);var o=Ur.exec(t);if(null!==o){var i=parseFloat(o[1]);return i/100*n.pixelWidth()}return _r(e)}(t,e,n)})},getPercentageWidth:function(t,n){return Kr(t).fold(function(){var e=_r(t);return Jr(e,n)},function(e){return function(e,t,n){var r=Ur.exec(t);if(null!==r)return parseFloat(r[1]);var o=_r(e);return Jr(o,n)}(t,e,n)})},getGenericWidth:function(e){return Kr(e).bind(function(e){var t=Hr.exec(e);return null!==t?R.some({width:C(parseFloat(t[1])),unit:C(t[3])}):R.none()})},setGenericWidth:function(e,t,n){De(e,"width",t+n)},getHeight:function(e){return n="rowspan",Yr(t=e)/Xr(t,n);var t,n},getRawWidth:Kr},Qr=function(n,r){$r.getGenericWidth(n).each(function(e){var t=e.width()/2;$r.setGenericWidth(n,t,e.unit()),$r.setGenericWidth(r,t,e.unit())})},Zr=function(n,r){return{left:C(n),top:C(r),translate:function(e,t){return Zr(n+e,r+t)}}},eo=Zr,to=function(e,t){return e!==undefined?e:t!==undefined?t:0},no=function(e){var t=e.dom().ownerDocument,n=t.body,r=t.defaultView,o=t.documentElement,i=to(r.pageYOffset,o.scrollTop),u=to(r.pageXOffset,o.scrollLeft),a=to(o.clientTop,n.clientTop),c=to(o.clientLeft,n.clientLeft);return ro(e).translate(u-c,i-a)},ro=function(e){var t,n=e.dom(),r=n.ownerDocument.body;return r===n?eo(r.offsetLeft,r.offsetTop):Ce(e)?(t=n.getBoundingClientRect(),eo(t.left,t.top)):eo(0,0)},oo=q("row","y"),io=q("col","x"),uo=function(e){return no(e).left()+Lr(e)},ao=function(e){return no(e).left()},co=function(e,t){return io(e,ao(t))},lo=function(e,t){return io(e,uo(t))},fo=function(e){return no(e).top()},so=function(e,t){return oo(e,fo(t))},mo=function(e,t){return oo(e,fo(t)+Wr(t))},go=function(n,t,r){if(0===r.length)return[];var e=E(r.slice(1),function(e,t){return e.map(function(e){return n(t,e)})}),o=r[r.length-1].map(function(e){return t(r.length-1,e)});return e.concat([o])},ho={height:{delta:o,positions:function(e){return go(so,mo,e)},edge:fo},rtl:{delta:function(e){return-e},edge:uo,positions:function(e){return go(lo,co,e)}},ltr:{delta:o,edge:ao,positions:function(e){return go(co,lo,e)}}},po={ltr:ho.ltr,rtl:ho.rtl};function vo(t){var n=function(e){return t(e).isRtl()?po.rtl:po.ltr};return{delta:function(e,t){return n(t).delta(e,t)},edge:function(e){return n(e).edge(e)},positions:function(e,t){return n(t).positions(e,t)}}}var bo=function(e){var t=ln(e);return mn.generate(t).grid()},wo=function(){return(wo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},yo=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},xo=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return R.none()},Co=function(e,t,n,r){n===r?he(e,t):se(e,t,n)},Ro=function(o,e){var i=[],u=[],t=function(e,t){0<e.length?function(e,t){var n=$t(o,t).getOrThunk(function(){var e=xe.fromTag(t,mt(o).dom());return Rt(o,e),e});Ot(n);var r=E(e,function(e){e.isNew()&&i.push(e.element());var t=e.element();return Ot(t),k(e.cells(),function(e){e.isNew()&&u.push(e.element()),Co(e.element(),"colspan",e.colspan(),1),Co(e.element(),"rowspan",e.rowspan(),1),Rt(t,e.element())}),t});Dt(n,r)}(e,t):$t(o,t).each(Nt)},n=[],r=[],a=[];return k(e,function(e){switch(e.section()){case"thead":n.push(e);break;case"tbody":r.push(e);break;case"tfoot":a.push(e)}}),t(n,"thead"),t(r,"tbody"),t(a,"tfoot"),{newRows:C(i),newCells:C(u)}},So=function(e){return E(e,function(e){var n=On(e.element());return k(e.cells(),function(e){var t=Nn(e.element());Co(t,"colspan",e.colspan(),1),Co(t,"rowspan",e.rowspan(),1),Rt(n,t)}),n})},To=function(e,t){var n=me(e,t);return n===undefined||""===n?[]:n.split(" ")},Do=function(e){return e.dom().classList!==undefined},Oo=function(e,t){return o=t,i=To(n=e,r="class").concat([o]),se(n,r,i.join(" ")),!0;var n,r,o,i},No=function(e,t){return o=t,0<(i=A(To(n=e,r="class"),function(e){return e!==o})).length?se(n,r,i.join(" ")):he(n,r),!1;var n,r,o,i},Eo=function(e,t){Do(e)?e.dom().classList.add(t):Oo(e,t)},ko=function(e){0===(Do(e)?e.dom().classList:To(e,"class")).length&&he(e,"class")},Ao=function(e,t){return Do(e)&&e.dom().classList.contains(t)},Po=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},Io=function(t,n){if(n<0||n>=t.length-1)return R.none();var e=t[n].fold(function(){var e=F(t.slice(0,n));return xo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return R.some({value:e,delta:0})}),r=t[n+1].fold(function(){var e=t.slice(n+1);return xo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return R.some({value:e,delta:1})});return e.bind(function(n){return r.map(function(e){var t=e.delta+n.delta;return Math.abs(e.value-n.value)/t})})},Bo=function(e,t,n){var r=e();return B(r,t).orThunk(function(){return R.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},Wo=function(n){var e=n.grid(),t=Po(0,e.columns()),r=Po(0,e.rows());return E(t,function(t){return Bo(function(){return _(r,function(e){return mn.getAt(n,e,t).filter(function(e){return e.column()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return mn.getAt(n,0,t)})})},Mo=function(n){var e=n.grid(),t=Po(0,e.rows()),r=Po(0,e.columns());return E(t,function(t){return Bo(function(){return _(r,function(e){return mn.getAt(n,t,e).filter(function(e){return e.row()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return mn.getAt(n,t,0)})})},_o=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},Lo={resolve:_o("ephox-snooker").resolve},Fo=function(e,t,n,r,o){var i=xe.fromTag("div");return Oe(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),de(i,{"data-column":e,role:"presentation"}),i},jo=function(e,t,n,r,o){var i=xe.fromTag("div");return Oe(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),de(i,{"data-row":e,role:"presentation"}),i},zo=Lo.resolve("resizer-bar"),Ho=Lo.resolve("resizer-rows"),Uo=Lo.resolve("resizer-cols"),qo=function(e){var t=qt(e.parent(),"."+zo);k(t,Nt)},Vo=function(n,e,r){var o=n.origin();k(e,function(e,t){e.each(function(e){var t=r(o,e);Eo(t,zo),Rt(n.parent(),t)})})},Go=function(e,t,n,r,o,i){var u,a,c,l,f=no(t),s=0<n.length?o.positions(n,t):[];u=e,a=s,c=f,l=Lr(t),Vo(u,a,function(e,t){var n=jo(t.row(),c.left()-e.left(),t.y()-e.top(),l,7);return Eo(n,Ho),n});var d,m,g,h,p=0<r.length?i.positions(r,t):[];d=e,m=p,g=f,h=Wr(t),Vo(d,m,function(e,t){var n=Fo(t.col(),t.x()-e.left(),g.top()-e.top(),7,h);return Eo(n,Uo),n})},Yo=function(e,t){var n=qt(e.parent(),"."+zo);k(n,t)},Xo=function(e,t,n,r){qo(e);var o=ln(t),i=mn.generate(o),u=Mo(i),a=Wo(i);Go(e,t,u,a,n,r)},Ko=function(e){Yo(e,function(e){De(e,"display","none")})},Jo=function(e){Yo(e,function(e){De(e,"display","block")})},$o=qo,Qo=function(e){return Ao(e,Ho)},Zo=function(e){return Ao(e,Uo)},ei=function(e,t){return Lt(t,e.section())},ti=function(e,t){return e.cells()[t]},ni={addCell:function(e,t,n){var r=e.cells(),o=r.slice(0,t),i=r.slice(t),u=o.concat([n]).concat(i);return ei(e,u)},setCells:ei,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:ti,getCellElement:function(e,t){return ti(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=E(n,t);return Lt(r,e.section())},cellLength:function(e){return e.cells().length}},ri=function(e,t){if(0===e.length)return 0;var n=e[0];return W(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},oi=function(e,t,n,r){var o,i,u,a,c=(o=e,i=t,o[i]).cells().slice(n),l=ri(c,r),f=(u=e,a=n,E(u,function(e){return ni.getCell(e,a)})).slice(t),s=ri(f,r);return{colspan:C(l),rowspan:C(s)}},ii=function(o,i){var u=E(o,function(e,t){return E(e.cells(),function(e,t){return!1})});return E(o,function(e,r){var t=_(e.cells(),function(e,t){if(!1===u[r][t]){var n=oi(o,r,t,i);return function(e,t,n,r){for(var o=e;o<e+n;o++)for(var i=t;i<t+r;i++)u[o][i]=!0}(r,t,n.rowspan(),n.colspan()),[It(e.element(),n.rowspan(),n.colspan(),e.isNew())]}return[]});return Ft(t,e.section())})},ui=function(e,t,n){for(var r=[],o=0;o<e.grid().rows();o++){for(var i=[],u=0;u<e.grid().columns();u++){var a=mn.getAt(e,o,u).map(function(e){return Mt(e.element(),n)}).getOrThunk(function(){return Mt(t.gap(),!0)});i.push(a)}var c=Lt(i,e.all()[o].section());r.push(c)}return r},ai=function(e,r){return E(e,function(e){var t,n=(t=e.details(),xo(t,function(e){return gt(e.element()).map(function(e){var t=gt(e).isNone();return Mt(e,t)})}).getOrThunk(function(){return Mt(r.row(),!0)}));return _t(n.element(),e.details(),e.section(),n.isNew())})},ci=function(e,t){var n=ii(e,ft);return ai(n,t)},li=function(e,t){var n=M(E(e.all(),function(e){return e.cells()}));return B(n,function(e){return ft(t,e.element())})},fi=function(a,c,l,f,s){return function(n,r,e,o,i){var t=ln(r),u=mn.generate(t);return c(u,e).map(function(e){var t=ui(u,o,!1),n=a(t,e,ft,s(o)),r=ci(n.grid(),o);return{grid:C(r),cursor:n.cursor}}).fold(function(){return R.none()},function(e){var t=Ro(r,e.grid());return l(r,e.grid(),i),f(r),Xo(n,r,ho.height,i),R.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},si=function(t,e){return cn.cell(e.element()).bind(function(e){return li(t,e)})},di=function(t,e){var n=E(e.selection(),function(e){return cn.cell(e).bind(function(e){return li(t,e)})}),r=yo(n);return 0<r.length?R.some({cells:r,generators:e.generators,clipboard:e.clipboard}):R.none()},mi=function(t,e){var n=E(e.selection(),function(e){return cn.cell(e).bind(function(e){return li(t,e)})}),r=yo(n);return 0<r.length?R.some(r):R.none()},gi=function(n){return{is:function(e){return n===e},isValue:u,isError:f,getOr:C(n),getOrThunk:C(n),getOrDie:C(n),or:function(e){return gi(n)},orThunk:function(e){return gi(n)},fold:function(e,t){return t(n)},map:function(e){return gi(e(n))},mapError:function(e){return gi(n)},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return R.some(n)}}},hi=function(n){return{is:f,isValue:f,isError:u,getOr:o,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(n),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return hi(n)},mapError:function(e){return hi(e(n))},each:y,bind:function(e){return hi(n)},exists:f,forall:u,toOption:R.none}},pi={value:gi,error:hi,fromOption:function(e,t){return e.fold(function(){return hi(t)},gi)}},vi=function(e,t){return E(e,function(){return Mt(t.cell(),!0)})},bi=function(t,e,n){return t.concat(function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n}(e,function(e){return ni.setCells(t[t.length-1],vi(t[t.length-1].cells(),n))}))},wi=function(e,t,n){return E(e,function(e){return ni.setCells(e,e.cells().concat(vi(Po(0,t),n)))})},yi=function(e,t,n){if(e.row()>=t.length||e.column()>ni.cellLength(t[0]))return pi.error("invalid start address out of table bounds, row: "+e.row()+", column: "+e.column());var r=t.slice(e.row()),o=r[0].cells().slice(e.column()),i=ni.cellLength(n[0]),u=n.length;return pi.value({rowDelta:C(r.length-u),colDelta:C(o.length-i)})},xi=function(e,t){var n=ni.cellLength(e[0]),r=ni.cellLength(t[0]);return{rowDelta:C(0),colDelta:C(n-r)}},Ci=function(e,t,n){var r=t.colDelta()<0?wi:o;return(t.rowDelta()<0?bi:o)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},Ri=function(e,t,n,r){if(0===e.length)return e;for(var o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)ni.mutateCell(e[o],i,Mt(r(),!1));return e},Si=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<ni.cellLength(e[0]);u++){var a=n(ni.getCellElement(e[i],u),t);!0===a&&!1===o?ni.mutateCell(e[i],u,Mt(r(),!0)):!0===a&&(o=!1)}return e},Ti=function(i,n,u,a){if(0<n&&n<i.length){var e=i[n-1].cells(),t=(r=u,I(e,function(e,t){return N(e,function(e){return r(e.element(),t.element())})?e:e.concat([t])},[]));k(t,function(r){for(var o=R.none(),e=function(n){for(var e=function(t){var e=i[n].cells()[t];u(e.element(),r.element())&&(o.isNone()&&(o=R.some(a())),o.each(function(e){ni.mutateCell(i[n],t,Mt(e,!0))}))},t=0;t<ni.cellLength(i[0]);t++)e(t)},t=n;t<i.length;t++)e(t)})}var r;return i},Di=function(n,r,o,i,u){return yi(n,r,o).map(function(e){var t=Ci(r,e,i);return function(e,t,n,r,o){for(var i,u,a,c,l,f=e.row(),s=e.column(),d=f+n.length,m=s+ni.cellLength(n[0]),g=f;g<d;g++)for(var h=s;h<m;h++){i=t,u=g,a=h,l=c=void 0,c=b(o,ni.getCell(i[u],a).element()),l=i[u],1<i.length&&1<ni.cellLength(l)&&(0<a&&c(ni.getCellElement(l,a-1))||a<l.cells().length-1&&c(ni.getCellElement(l,a+1))||0<u&&c(ni.getCellElement(i[u-1],a))||u<i.length-1&&c(ni.getCellElement(i[u+1],a)))&&Si(t,ni.getCellElement(t[g],h),o,r.cell);var p=ni.getCellElement(n[g-f],h-s),v=r.replace(p);ni.mutateCell(t[g],h,Mt(v,!0))}return t}(n,t,o,i,u)})},Oi=function(e,t,n,r,o){Ti(t,e,o,r.cell);var i=xi(n,t),u=Ci(n,i,r),a=xi(t,u),c=Ci(t,a,r);return c.slice(0,e).concat(u).concat(c.slice(e,c.length))},Ni=function(n,r,e,o,i){var t=n.slice(0,r),u=n.slice(r),a=ni.mapCells(n[e],function(e,t){return 0<r&&r<n.length&&o(ni.getCellElement(n[r-1],t),ni.getCellElement(n[r],t))?ni.getCell(n[r],t):Mt(i(e.element(),o),!0)});return t.concat([a]).concat(u)},Ei=function(e,n,r,o,i){return E(e,function(e){var t=0<n&&n<ni.cellLength(e)&&o(ni.getCellElement(e,n-1),ni.getCellElement(e,n))?ni.getCell(e,n):Mt(i(ni.getCellElement(e,r),o),!0);return ni.addCell(e,n,t)})},ki=function(e,r,o,i,u){var a=o+1;return E(e,function(e,t){var n=t===r?Mt(u(ni.getCellElement(e,o),i),!0):ni.getCell(e,o);return ni.addCell(e,a,n)})},Ai=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),a=e.slice(i),c=ni.mapCells(e[t],function(e,t){return t===n?Mt(o(e.element(),r),!0):e});return u.concat([c]).concat(a)},Pi=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},Ii=function(e,n,r){var t=E(e,function(e){var t=e.cells().slice(0,n).concat(e.cells().slice(r+1));return Lt(t,e.section())});return A(t,function(e){return 0<e.cells().length})},Bi=function(e,n,r,o){return E(e,function(e){return ni.mapCells(e,function(e){return t=e,N(n,function(e){return r(t.element(),e.element())})?Mt(o(e.element(),r),!0):e;var t})})},Wi=function(e,t,n,r){return ni.getCellElement(e[t],n)!==undefined&&0<t&&r(ni.getCellElement(e[t-1],n),ni.getCellElement(e[t],n))},Mi=function(e,t,n){return 0<t&&n(ni.getCellElement(e,t-1),ni.getCellElement(e,t))},_i=function(n,r,o,e){var t=_(n,function(e,t){return Wi(n,t,r,o)||Mi(e,r,o)?[]:[ni.getCell(e,r)]});return Bi(n,t,o,e)},Li=function(n,r,o,e){var i=n[r],t=_(i.cells(),function(e,t){return Wi(n,r,t,o)||Mi(i,t,o)?[]:[e]});return Bi(n,t,o,e)},Fi=xr([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),ji=wo({},Fi),zi=function(e,t,i,u){var n,r,a=e.slice(0),o=(r=t,0===(n=e).length?ji.none():1===n.length?ji.only(0):0===r?ji.left(0,1):r===n.length-1?ji.right(r-1,r):0<r&&r<n.length-1?ji.middle(r-1,r,r+1):ji.none()),c=function(e){return E(e,C(0))},l=C(c(a)),f=function(e,t){if(0<=i){var n=Math.max(u.minCellWidth(),a[t]-i);return c(a.slice(0,e)).concat([i,n-a[t]]).concat(c(a.slice(t+1)))}var r=Math.max(u.minCellWidth(),a[e]+i),o=a[e]-r;return c(a.slice(0,e)).concat([r-a[e],o]).concat(c(a.slice(t+1)))},s=f;return o.fold(l,function(e){return u.singleColumnWidth(a[e],i)},s,function(e,t,n){return f(t,n)},function(e,t){if(0<=i)return c(a.slice(0,t)).concat([i]);var n=Math.max(u.minCellWidth(),a[t]+i);return c(a.slice(0,t)).concat([n-a[t]])})},Hi=function(e,t){return ge(e,t)&&1<parseInt(me(e,t),10)},Ui={hasColspan:function(e){return Hi(e,"colspan")},hasRowspan:function(e){return Hi(e,"rowspan")},minWidth:C(10),minHeight:C(10),getInt:function(e,t){return parseInt(Ne(e,t),10)}},qi=function(e,t,n){return ke(e,t).fold(function(){return n(e)+"px"},function(e){return e})},Vi=function(e,t){return qi(e,"width",function(e){return $r.getPixelWidth(e,t)})},Gi=function(e){return qi(e,"height",$r.getHeight)},Yi=function(e,t,n,r,o){var i=Wo(e),u=E(i,function(e){return e.map(t.edge)});return E(i,function(e,t){return e.filter(g(Ui.hasColspan)).fold(function(){var e=Io(u,t);return r(e)},function(e){return n(e,o)})})},Xi=function(e){return e.map(function(e){return e+"px"}).getOr("")},Ki=function(e,t,n,r){var o=Mo(e),i=E(o,function(e){return e.map(t.edge)});return E(o,function(e,t){return e.filter(g(Ui.hasRowspan)).fold(function(){var e=Io(i,t);return r(e)},function(e){return n(e)})})},Ji={getRawWidths:function(e,t,n){return Yi(e,t,Vi,Xi,n)},getPixelWidths:function(e,t,n){return Yi(e,t,$r.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return Yi(e,t,$r.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return Ki(e,t,$r.getHeight,function(e){return e.getOrThunk(Ui.minHeight)})},getRawHeights:function(e,t){return Ki(e,t,Gi,Xi)}},$i=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},Qi=function(e,n){var t=mn.justCells(e);return E(t,function(e){var t=$i(e.column(),e.column()+e.colspan(),n);return{element:e.element,width:C(t),colspan:e.colspan}})},Zi=function(e,n){var t=mn.justCells(e);return E(t,function(e){var t=$i(e.row(),e.row()+e.rowspan(),n);return{element:e.element,height:C(t),rowspan:e.rowspan}})},eu=function(e,n){return E(e.all(),function(e,t){return{element:e.element,height:C(n[t])}})},tu=function(e){var t=o;return{width:C(e),pixelWidth:C(e),getWidths:Ji.getPixelWidths,getCellDelta:t,singleColumnWidth:function(e,t){return[Math.max(Ui.minWidth(),e+t)-e]},minCellWidth:Ui.minWidth,setElementWidth:$r.setPixelWidth,setTableWidth:function(e,t,n){var r=P(t,function(e,t){return e+t},0);$r.setPixelWidth(e,r)}}},nu=function(e,t){var n,r,o,i,u=$r.percentageBasedSizeRegex().exec(t);if(null!==u)return n=u[1],r=e,o=parseFloat(n),i=_r(r),{width:C(o),pixelWidth:C(i),getWidths:Ji.getPercentageWidths,getCellDelta:function(e){return e/i*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return Ui.minWidth()/i*100},setElementWidth:$r.setPercentageWidth,setTableWidth:function(e,t,n){var r=n/100*o;$r.setPercentageWidth(e,o+r)}};var a=$r.pixelBasedSizeRegex().exec(t);if(null!==a){var c=parseInt(a[1],10);return tu(c)}var l=_r(e);return tu(l)},ru=function(t){return $r.getRawWidth(t).fold(function(){var e=_r(t);return tu(e)},function(e){return nu(t,e)})},ou=function(e){return mn.generate(e)},iu=function(e){var t=ln(e);return ou(t)},uu=function(e,t,n,r){var o=ru(e),i=o.getCellDelta(t),u=iu(e),a=o.getWidths(u,r,o),c=zi(a,n,i,o),l=E(c,function(e,t){return e+a[t]}),f=Qi(u,l);k(f,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},au=function(e,n,r,t){var o=iu(e),i=Ji.getPixelHeights(o,t),u=E(i,function(e,t){return r===t?Math.max(n+e,Ui.minHeight()):e}),a=Zi(o,u),c=eu(o,u);k(c,function(e){$r.setHeight(e.element(),e.height())}),k(a,function(e){$r.setHeight(e.element(),e.height())});var l=P(u,function(e,t){return e+t},0);$r.setHeight(e,l)},cu=function(e,t,n){var r=ru(e),o=ou(t),i=r.getWidths(o,n,r),u=Qi(o,i);k(u,function(e){r.setElementWidth(e.element(),e.width())}),0<u.length&&r.setTableWidth(e,i,r.getCellDelta(0))},lu=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return lu(n())}}},fu=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return X("required",o),K(o),function(t){var n=j(t);L(o,function(e){return O(n,e)})||G(o,n),r(o,n);var e=A(o,function(e){return!i.validate(t[e],e)});return 0<e.length&&function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+V(e).join(", ")+") were not.")}(e,i.label),t}},su=function(t,e){var n=A(e,function(e){return!O(t,e)});0<n.length&&Y(n)},du=function(e){return fu(su,e,{validate:v,label:"function"})},mu=du(["cell","row","replace","gap"]),gu=function(e){var t=ge(e,"colspan")?parseInt(me(e,"colspan"),10):1,n=ge(e,"rowspan")?parseInt(me(e,"rowspan"),10):1;return{element:C(e),colspan:C(t),rowspan:C(n)}},hu=function(r,o){void 0===o&&(o=gu),mu(r);var n=lu(R.none()),i=function(e){var t,n=o(e);return t=n,r.cell(t)},u=function(e){var t=i(e);return n.get().isNone()&&n.set(R.some(t)),a=R.some({item:e,replacement:t}),t},a=R.none();return{getOrInit:function(t,n){return a.fold(function(){return u(t)},function(e){return n(t,e.item)?e.replacement:u(t)})},cursor:n.get}},pu=function(a,c){return function(r){var o=lu(R.none());mu(r);var i=[],u=function(e){var t={scope:a},n=r.replace(e,c,t);return i.push({item:e,sub:n}),o.get().isNone()&&o.set(R.some(n)),n};return{replaceOrInit:function(t,n){return(r=t,o=n,B(i,function(e){return o(e.item,r)})).fold(function(){return u(t)},function(e){return n(t,e.item)?e.sub:u(t)});var r,o},cursor:o.get}}},vu=function(n){mu(n);var e=lu(R.none());return{combine:function(t){return e.get().isNone()&&e.set(R.some(t)),function(){var e=n.cell({element:C(t),colspan:C(1),rowspan:C(1)});return Ae(e,"width"),Ae(t,"width"),e}},cursor:e.get}},bu=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],wu=function(e,t){var n=e.property().name(t);return O(bu,n)},yu=function(e,t){return O(["br","img","hr","input"],e.property().name(t))},xu=wu,Cu=function(e,t){var n=e.property().name(t);return O(["ol","ul"],n)},Ru=yu,Su=$n(),Tu=function(e){return xu(Su,e)},Du=function(e){return Cu(Su,e)},Ou=function(e){return Ru(Su,e)},Nu=function(e){var t,i=function(e){return"br"===oe(e)},n=function(o){return Sn(o).bind(function(n){var r=vt(n).map(function(e){return!!Tu(e)||!!Ou(e)&&"img"!==oe(e)}).getOr(!1);return gt(n).map(function(e){return!0===r||"li"===oe(t=e)||Kt(t,Du).isSome()||i(n)||Tu(e)&&!ft(o,e)?[]:[xe.fromTag("br")];var t})}).getOr([])},r=0===(t=_(e,function(e){var t=bt(e);return L(t,function(e){return i(e)||le(e)&&0===vn(e).trim().length})?[]:t.concat(n(e))})).length?[xe.fromTag("br")]:t;Ot(e[0]),Dt(e[0],r)},Eu=function(e){0===cn.cells(e).length&&Nt(e)},ku=q("grid","cursor"),Au=function(e,t,n){return Pu(e,t,n).orThunk(function(){return Pu(e,0,0)})},Pu=function(e,t,n){return R.from(e[t]).bind(function(e){return R.from(e.cells()[n]).bind(function(e){return R.from(e.element())})})},Iu=function(e,t,n){return ku(e,Pu(e,t,n))},Bu=function(e){return I(e,function(e,t){return N(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},Wu=function(e){return I(e,function(e,t){return N(e,function(e){return e.column()===t.column()})?e:e.concat([t])},[]).sort(function(e,t){return e.column()-t.column()})},Mu=function(e,t,n){var r=fn(e,n),o=mn.generate(r);return ui(o,t,!0)},_u=cu,Lu={insertRowBefore:fi(function(e,t,n,r){var o=t.row(),i=t.row(),u=Ni(e,i,o,n,r.getOrInit);return Iu(u,i,t.column())},si,y,y,hu),insertRowsBefore:fi(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=Bu(t),a=I(u,function(e,t){return Ni(e,i,o,n,r.getOrInit)},e);return Iu(a,i,t[0].column())},mi,y,y,hu),insertRowAfter:fi(function(e,t,n,r){var o=t.row(),i=t.row()+t.rowspan(),u=Ni(e,i,o,n,r.getOrInit);return Iu(u,i,t.column())},si,y,y,hu),insertRowsAfter:fi(function(e,t,n,r){var o=Bu(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),a=I(o,function(e,t){return Ni(e,u,i,n,r.getOrInit)},e);return Iu(a,u,t[0].column())},mi,y,y,hu),insertColumnBefore:fi(function(e,t,n,r){var o=t.column(),i=t.column(),u=Ei(e,i,o,n,r.getOrInit);return Iu(u,t.row(),i)},si,_u,y,hu),insertColumnsBefore:fi(function(e,t,n,r){var o=Wu(t),i=o[0].column(),u=o[0].column(),a=I(o,function(e,t){return Ei(e,u,i,n,r.getOrInit)},e);return Iu(a,t[0].row(),u)},mi,_u,y,hu),insertColumnAfter:fi(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=Ei(e,i,o,n,r.getOrInit);return Iu(u,t.row(),i)},si,_u,y,hu),insertColumnsAfter:fi(function(e,t,n,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=Wu(t),a=I(u,function(e,t){return Ei(e,i,o,n,r.getOrInit)},e);return Iu(a,t[0].row(),i)},mi,_u,y,hu),splitCellIntoColumns:fi(function(e,t,n,r){var o=ki(e,t.row(),t.column(),n,r.getOrInit);return Iu(o,t.row(),t.column())},si,_u,y,hu),splitCellIntoRows:fi(function(e,t,n,r){var o=Ai(e,t.row(),t.column(),n,r.getOrInit);return Iu(o,t.row(),t.column())},si,y,y,hu),eraseColumns:fi(function(e,t,n,r){var o=Wu(t),i=Ii(e,o[0].column(),o[o.length-1].column()),u=Au(i,t[0].row(),t[0].column());return ku(i,u)},mi,_u,Eu,hu),eraseRows:fi(function(e,t,n,r){var o=Bu(t),i=Pi(e,o[0].row(),o[o.length-1].row()),u=Au(i,t[0].row(),t[0].column());return ku(i,u)},mi,y,Eu,hu),makeColumnHeader:fi(function(e,t,n,r){var o=_i(e,t.column(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu("row","th")),unmakeColumnHeader:fi(function(e,t,n,r){var o=_i(e,t.column(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu(null,"td")),makeRowHeader:fi(function(e,t,n,r){var o=Li(e,t.row(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu("col","th")),unmakeRowHeader:fi(function(e,t,n,r){var o=Li(e,t.row(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu(null,"td")),mergeCells:fi(function(e,t,n,r){var o=t.cells();Nu(o);var i=Ri(e,t.bounds(),n,C(o[0]));return ku(i,R.from(o[0]))},function(e,t){return t.mergable()},y,y,vu),unmergeCells:fi(function(e,t,n,r){var o=P(t,function(e,t){return Si(e,t,n,r.combine(t))},e);return ku(o,R.from(t[0]))},function(e,t){return t.unmergable()},_u,y,vu),pasteCells:fi(function(e,n,t,r){var o,i,u,a,c=(o=n.clipboard(),i=n.generators(),u=ln(o),a=mn.generate(u),ui(a,i,!0)),l=At(n.row(),n.column());return Di(l,e,c,n.generators(),t).fold(function(){return ku(e,R.some(n.element()))},function(e){var t=Au(e,n.row(),n.column());return ku(e,t)})},function(t,n){return cn.cell(n.element()).bind(function(e){return li(t,e).map(function(e){return wo(wo({},e),{generators:n.generators,clipboard:n.clipboard})})})},_u,y,hu),pasteRowsBefore:fi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[0].row(),u=Mu(t.clipboard(),t.generators(),o),a=Oi(i,e,u,t.generators(),n),c=Au(a,t.cells[0].row(),t.cells[0].column());return ku(a,c)},di,y,y,hu),pasteRowsAfter:fi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[t.cells.length-1].row()+t.cells[t.cells.length-1].rowspan(),u=Mu(t.clipboard(),t.generators(),o),a=Oi(i,e,u,t.generators(),n),c=Au(a,t.cells[0].row(),t.cells[0].column());return ku(a,c)},di,y,y,hu)},Fu=function(e){return xe.fromDom(e.getBody())},ju=function(e){return e.getBoundingClientRect().width},zu=function(e){return e.getBoundingClientRect().height},Hu=function(t){return function(e){return ft(e,Fu(t))}},Uu=function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},qu=function(e){var t=qt(e,"td[data-mce-style],th[data-mce-style]");he(e,"data-mce-style"),k(t,function(e){he(e,"data-mce-style")})},Vu={isRtl:C(!1)},Gu={isRtl:C(!0)},Yu={directionAt:function(e){return"rtl"==("rtl"===Ne(e,"direction")?"rtl":"ltr")?Gu:Vu}},Xu=["tableprops","tabledelete","|","tableinsertrowbefore","tableinsertrowafter","tabledeleterow","|","tableinsertcolbefore","tableinsertcolafter","tabledeletecol"],Ku={"border-collapse":"collapse",width:"100%"},Ju={border:"1"},$u=function(e){return e.getParam("table_cell_advtab",!0,"boolean")},Qu=function(e){return e.getParam("table_row_advtab",!0,"boolean")},Zu=function(e){return e.getParam("table_advtab",!0,"boolean")},ea=function(e){return e.getParam("table_style_by_css",!1,"boolean")},ta=function(e){return e.getParam("table_cell_class_list",[],"array")},na=function(e){return e.getParam("table_row_class_list",[],"array")},ra=function(e){return e.getParam("table_class_list",[],"array")},oa=function(e){return!1===e.getParam("table_responsive_width")},ia=function(e,t){return e.fire("newrow",{node:t})},ua=function(e,t){return e.fire("newcell",{node:t})},aa=function(e,t,n,r){e.fire("ObjectResizeStart",{target:t,width:n,height:r})},ca=function(e,t,n,r){e.fire("ObjectResized",{target:t,width:n,height:r})},la=function(f,e){var t,n=function(e){return"table"===oe(Fu(e))},s=(t=f.getParam("table_clone_elements"),d(t)?R.some(t.split(/[ ,]/)):Array.isArray(t)?R.some(t):R.none()),r=function(u,a,c,l){return function(e,t){qu(e);var n=l(),r=xe.fromDom(f.getDoc()),o=vo(Yu.directionAt),i=Bn(c,r,s);return a(e)?u(n,e,t,i,o).bind(function(e){return k(e.newRows(),function(e){ia(f,e.dom())}),k(e.newCells(),function(e){ua(f,e.dom())}),e.cursor().map(function(e){var t=f.dom.createRng();return t.setStart(e.dom(),0),t.setEnd(e.dom(),0),t})}):R.none()}};return{deleteRow:r(Lu.eraseRows,function(e){var t=bo(e);return!1===n(f)||1<t.rows()},y,e),deleteColumn:r(Lu.eraseColumns,function(e){var t=bo(e);return!1===n(f)||1<t.columns()},y,e),insertRowsBefore:r(Lu.insertRowsBefore,u,y,e),insertRowsAfter:r(Lu.insertRowsAfter,u,y,e),insertColumnsBefore:r(Lu.insertColumnsBefore,u,Qr,e),insertColumnsAfter:r(Lu.insertColumnsAfter,u,Qr,e),mergeCells:r(Lu.mergeCells,u,y,e),unmergeCells:r(Lu.unmergeCells,u,y,e),pasteRowsBefore:r(Lu.pasteRowsBefore,u,y,e),pasteRowsAfter:r(Lu.pasteRowsAfter,u,y,e),pasteCells:r(Lu.pasteCells,u,y,e)}},fa=function(e,t,r){var n=ln(e),o=mn.generate(n);return mi(o,t).map(function(e){var t=ui(o,r,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),n=ci(t,r);return So(n)})},sa=tinymce.util.Tools.resolve("tinymce.util.Tools"),da=function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},ma=function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},ga=function(t,n){sa.each("left center right".split(" "),function(e){t.formatter.remove("align"+e,{},n)})},ha=function(t,n){sa.each("top middle bottom".split(" "),function(e){t.formatter.remove("valign"+e,{},n)})},pa=function(o,e,i){var t;return t=function(e,t){for(var n=0;n<t.length;n++){var r=o.getStyle(t[n],i);if(void 0===e&&(e=r),e!==r)return""}return e}(t,o.select("td,th",e))},va=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);i["border-style"]=o.borderStyle,i["border-color"]=o.borderColor,i["background-color"]=o.backgroundColor,i.width=o.width?Uu(o.width):"",i.height=o.height?Uu(o.height):"",r.find("#style").value(n.serializeStyle(n.parseStyle(n.serializeStyle(i))))},ba=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);r.find("#borderStyle").value(i["border-style"]||""),r.find("#borderColor").value(i["border-color"]||""),r.find("#backgroundColor").value(i["background-color"]||""),r.find("#width").value(i.width||""),r.find("#height").value(i.height||"")},wa={createStyleForm:function(n){var e=function(){var e=n.getParam("color_picker_callback");if(e)return function(t){return e.call(n,function(e){t.control.value(e).fire("change")},t.control.value())}};return{title:"Advanced",type:"form",defaults:{onchange:b(va,n)},items:[{label:"Style",name:"style",type:"textbox",onchange:b(ba,n)},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border style",type:"listbox",name:"borderStyle",width:90,onselect:b(va,n),values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]},{label:"Border color",type:"colorbox",name:"borderColor",onaction:e()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:e()}]}]}},buildListItems:function(e,r,t){var o=function(e,n){return n=n||[],sa.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=o(e.menu):(t.value=e.value,r&&r(t)),n.push(t)}),n};return o(e,t||[])},updateStyleField:va,extractAdvancedStyles:function(e,t){var n=e.parseStyle(e.getAttrib(t,"style")),r={};return n["border-style"]&&(r.borderStyle=n["border-style"]),n["border-color"]&&(r.borderColor=n["border-color"]),n["background-color"]&&(r.backgroundColor=n["background-color"]),r.style=e.serializeStyle(n),r},updateAdvancedFields:ba,syncAdvancedStyleFields:function(e,t){t.control.rootControl.find("#style")[0].getEl().isEqualNode(m.document.activeElement)?ba(e,t):va(e,t)}},ya=function(r,o,e){var i,u=r.dom;function a(e,t,n){(1===o.length||n)&&u.setAttrib(e,t,n)}function c(e,t,n){(1===o.length||n)&&u.setStyle(e,t,n)}$u(r)&&wa.syncAdvancedStyleFields(r,e),i=e.control.rootControl.toJSON(),r.undoManager.transact(function(){sa.each(o,function(e){var t,n;a(e,"scope",i.scope),1===o.length?a(e,"style",i.style):(t=e,n=i.style,delete t.dataset.mceStyle,t.style.cssText+=";"+n),a(e,"class",i["class"]),c(e,"width",Uu(i.width)),c(e,"height",Uu(i.height)),i.type&&e.nodeName.toLowerCase()!==i.type&&(e=u.rename(e,i.type)),1===o.length&&(ga(r,e),ha(r,e)),i.align&&da(r,e,i.align),i.valign&&ma(r,e,i.valign)}),r.focus()})},xa=function(t){var e,n,r,o=[];if(o=t.dom.select("td[data-mce-selected],th[data-mce-selected]"),e=t.dom.getParent(t.selection.getStart(),"td,th"),!o.length&&e&&o.push(e),e=e||o[0]){var i,u,a,c;1<o.length?n={width:"",height:"",scope:"","class":"",align:"",valign:"",style:"",type:e.nodeName.toLowerCase()}:(u=e,a=(i=t).dom,c={width:a.getStyle(u,"width")||a.getAttrib(u,"width"),height:a.getStyle(u,"height")||a.getAttrib(u,"height"),scope:a.getAttrib(u,"scope"),"class":a.getAttrib(u,"class"),type:u.nodeName.toLowerCase(),style:"",align:"",valign:""},sa.each("left center right".split(" "),function(e){i.formatter.matchNode(u,"align"+e)&&(c.align=e)}),sa.each("top middle bottom".split(" "),function(e){i.formatter.matchNode(u,"valign"+e)&&(c.valign=e)}),$u(i)&&sa.extend(c,wa.extractAdvancedStyles(a,u)),n=c),0<ta(t).length&&(r={name:"class",type:"listbox",label:"Class",values:wa.buildListItems(ta(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"td",classes:[e.value]})})})});var l={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width",onchange:b(wa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(wa.updateStyleField,t)},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},r]};$u(t)?t.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:n,body:[{title:"General",type:"form",items:l},wa.createStyleForm(t)],onsubmit:b(ya,t,o)}):t.windowManager.open({title:"Cell properties",data:n,body:l,onsubmit:b(ya,t,o)})}};function Ca(f,s,d,e){var m=f.dom;function g(e,t,n){(1===s.length||n)&&m.setAttrib(e,t,n)}Qu(f)&&wa.syncAdvancedStyleFields(f,e);var h=e.control.rootControl.toJSON();f.undoManager.transact(function(){sa.each(s,function(e){var t,n,r,o,i,u,a,c,l;g(e,"scope",h.scope),g(e,"style",h.style),g(e,"class",h["class"]),t=e,n="height",r=Uu(h.height),(1===s.length||r)&&m.setStyle(t,n,r),h.type!==e.parentNode.nodeName.toLowerCase()&&(o=f.dom,i=e,u=h.type,a=o.getParent(i,"table"),c=i.parentNode,(l=o.select(u,a)[0])||(l=o.create(u),a.firstChild?"CAPTION"===a.firstChild.nodeName?o.insertAfter(l,a.firstChild):a.insertBefore(l,a.firstChild):a.appendChild(l)),l.appendChild(i),c.hasChildNodes()||o.remove(c)),h.align!==d.align&&(ga(f,e),da(f,e,h.align))}),f.focus()})}var Ra=function(t){var e,n,r,o,i,u,a,c,l,f,s=t.dom,d=[];e=s.getParent(t.selection.getStart(),"table"),n=s.getParent(t.selection.getStart(),"td,th"),sa.each(e.rows,function(t){sa.each(t.cells,function(e){if(s.getAttrib(e,"data-mce-selected")||e===n)return d.push(t),!1})}),(r=d[0])&&(1<d.length?i={height:"",scope:"",style:"","class":"",align:"",type:r.parentNode.nodeName.toLowerCase()}:(c=r,l=(a=t).dom,f={height:l.getStyle(c,"height")||l.getAttrib(c,"height"),scope:l.getAttrib(c,"scope"),"class":l.getAttrib(c,"class"),align:"",style:"",type:c.parentNode.nodeName.toLowerCase()},sa.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),Qu(a)&&sa.extend(f,wa.extractAdvancedStyles(l,c)),i=f),0<na(t).length&&(o={name:"class",type:"listbox",label:"Class",values:wa.buildListItems(na(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})})}),u={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"Header",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},o]},Qu(t)?t.windowManager.open({title:"Row properties",data:i,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},wa.createStyleForm(t)],onsubmit:b(Ca,t,d,i)}):t.windowManager.open({title:"Row properties",data:i,body:u,onsubmit:b(Ca,t,d,i)}))},Sa=tinymce.util.Tools.resolve("tinymce.Env"),Ta={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},percentages:!0},Da=function(e,t,n,r,o){void 0===o&&(o=Ta);var i=xe.fromTag("table");Oe(i,o.styles),de(i,o.attributes);var u=xe.fromTag("tbody");Rt(i,u);for(var a=[],c=0;c<e;c++){for(var l=xe.fromTag("tr"),f=0;f<t;f++){var s=c<n||f<r?xe.fromTag("th"):xe.fromTag("td");f<r&&se(s,"scope","row"),c<n&&se(s,"scope","col"),Rt(s,xe.fromTag("br")),o.percentages&&De(s,"width",100/t+"%"),Rt(l,s)}a.push(l)}return Dt(u,a),i},Oa=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},Na=function(r,e,t){var n,o,i=r.getParam("table_default_styles",Ku,"object"),u={styles:i,attributes:(o=r,o.getParam("table_default_attributes",Ju,"object")),percentages:(n=i.width,d(n)&&-1!==n.indexOf("%")&&!oa(r))},a=Da(t,e,0,0,u);se(a,"data-mce-id","__mce");var c,l,f,s=(c=a,l=xe.fromTag("div"),f=xe.fromDom(c.dom().cloneNode(!0)),Rt(l,f),l.dom().innerHTML);return r.insertContent(s),Qt(Fu(r),'table[data-mce-id="__mce"]').map(function(e){var t,n;return oa(r)&&De(e,"width",Ne(e,"width")),he(e,"data-mce-id"),t=r,k(qt(e,"tr"),function(e){ia(t,e.dom()),k(qt(e,"th,td"),function(e){ua(t,e.dom())})}),n=r,Qt(e,"td,th").each(b(Oa,n)),e.dom()}).getOr(null)};function Ea(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)e.setStyle(t,n,r);else if(t.children)for(var o=0;o<t.children.length;o++)Ea(e,t.children[o],n,r)}var ka,Aa=function(e,t,n){var r,o,i=e.dom;Zu(e)&&wa.syncAdvancedStyleFields(e,n),!1===(o=n.control.rootControl.toJSON())["class"]&&delete o["class"],e.undoManager.transact(function(){t||(t=Na(e,o.cols||1,o.rows||1)),function(e,t,n){var r,o=e.dom,i={},u={};if(i["class"]=n["class"],u.height=Uu(n.height),o.getAttrib(t,"width")&&!ea(e)?i.width=(r=n.width)?r.replace(/px$/,""):"":u.width=Uu(n.width),ea(e)?(u["border-width"]=Uu(n.border),u["border-spacing"]=Uu(n.cellspacing),sa.extend(i,{"data-mce-border-color":n.borderColor,"data-mce-cell-padding":n.cellpadding,"data-mce-border":n.border})):sa.extend(i,{border:n.border,cellpadding:n.cellpadding,cellspacing:n.cellspacing}),ea(e)&&t.children)for(var a=0;a<t.children.length;a++)Ea(o,t.children[a],{"border-width":Uu(n.border),"border-color":n.borderColor,padding:Uu(n.cellpadding)});n.style?sa.extend(u,o.parseStyle(n.style)):u=sa.extend({},o.parseStyle(o.getAttrib(t,"style")),u),i.style=o.serializeStyle(u),o.setAttribs(t,i)}(e,t,o),(r=i.select("caption",t)[0])&&!o.caption&&i.remove(r),!r&&o.caption&&((r=i.create("caption")).innerHTML=Sa.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(r,t.firstChild)),ga(e,t),o.align&&da(e,t,o.align),e.focus(),e.addVisual()})},Pa=function(t,e){var n,r,o,i,u,a,c,l,f,s,d=t.dom,m={};!0===e?(n=d.getParent(t.selection.getStart(),"table"))&&(c=n,l=(a=t).dom,f={width:l.getStyle(c,"width")||l.getAttrib(c,"width"),height:l.getStyle(c,"height")||l.getAttrib(c,"height"),cellspacing:l.getStyle(c,"border-spacing")||l.getAttrib(c,"cellspacing"),cellpadding:l.getAttrib(c,"data-mce-cell-padding")||l.getAttrib(c,"cellpadding")||pa(a.dom,c,"padding"),border:l.getAttrib(c,"data-mce-border")||l.getAttrib(c,"border")||pa(a.dom,c,"border"),borderColor:l.getAttrib(c,"data-mce-border-color"),caption:!!l.select("caption",c)[0],"class":l.getAttrib(c,"class")},sa.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),Zu(a)&&sa.extend(f,wa.extractAdvancedStyles(l,c)),m=f):(r={label:"Cols",name:"cols"},o={label:"Rows",name:"rows"}),0<ra(t).length&&(m["class"]&&(m["class"]=m["class"].replace(/\s*mce\-item\-table\s*/g,"")),i={name:"class",type:"listbox",label:"Class",values:wa.buildListItems(ra(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"table",classes:[e.value]})})})}),u={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:(s=t,s.getParam("table_appearance_options",!0,"boolean")?[r,o,{label:"Width",name:"width",onchange:b(wa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(wa.updateStyleField,t)},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[r,o,{label:"Width",name:"width",onchange:b(wa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(wa.updateStyleField,t)}])},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},i]},Zu(t)?t.windowManager.open({title:"Table properties",data:m,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},wa.createStyleForm(t)],onsubmit:b(Aa,t,n)}):t.windowManager.open({title:"Table properties",data:m,body:u,onsubmit:b(Aa,t,n)})},Ia=sa.each,Ba=function(a,t,c,l,n){var r=Hu(a),e=function(e){return function(){return R.from(a.dom.getParent(a.selection.getStart(),e)).map(xe.fromDom)}},o=e("caption"),f=e("th,td"),s=function(e){return cn.table(e,r)},d=function(e){return{width:ju(e.dom()),height:ju(e.dom())}},i=function(n){f().each(function(t){s(t).each(function(i){var e=kr.forMenu(l,i,t),u=d(i);n(i,e).each(function(e){var t,n,r,o;t=a,n=u,o=d(r=i),n.width===o.width&&n.height===o.height||(aa(t,r.dom(),n.width,n.height),ca(t,r.dom(),o.width,o.height)),a.selection.setRng(e),a.focus(),c.clear(i),qu(i)})})})},u=function(e){return f().bind(function(o){return s(o).bind(function(e){var t=xe.fromDom(a.getDoc()),n=kr.forMenu(l,e,o),r=Bn(y,t,R.none());return fa(e,n,r)})})},m=function(u){n.get().each(function(e){var i=E(e,function(e){return Nn(e)});f().each(function(o){s(o).each(function(t){var e=xe.fromDom(a.getDoc()),n=Wn(e),r=kr.pasteRows(l,t,o,i,n);u(t,r).each(function(e){a.selection.setRng(e),a.focus(),c.clear(t)})})})})};Ia({mceTableSplitCells:function(){i(t.unmergeCells)},mceTableMergeCells:function(){i(t.mergeCells)},mceTableInsertRowBefore:function(){i(t.insertRowsBefore)},mceTableInsertRowAfter:function(){i(t.insertRowsAfter)},mceTableInsertColBefore:function(){i(t.insertColumnsBefore)},mceTableInsertColAfter:function(){i(t.insertColumnsAfter)},mceTableDeleteCol:function(){i(t.deleteColumn)},mceTableDeleteRow:function(){i(t.deleteRow)},mceTableCutRow:function(e){n.set(u()),i(t.deleteRow)},mceTableCopyRow:function(e){n.set(u())},mceTablePasteRowBefore:function(e){m(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){m(t.pasteRowsAfter)},mceTableDelete:function(){f().orThunk(o).each(function(e){cn.table(e,r).filter(g(r)).each(function(e){var t=xe.fromText("");xt(e,t),Nt(e);var n=a.dom.createRng();n.setStart(t.dom(),0),n.setEnd(t.dom(),0),a.selection.setRng(n)})})}},function(e,t){a.addCommand(t,e)}),Ia({mceInsertTable:b(Pa,a),mceTableProps:b(Pa,a,!0),mceTableRowProps:b(Ra,a),mceTableCellProps:b(xa,a)},function(n,e){a.addCommand(e,function(e,t){n(t)})})},Wa=function(e){var t=R.from(e.dom().documentElement).map(xe.fromDom).getOr(e);return{parent:C(t),view:C(e),origin:C(eo(0,0))}},Ma=function(e,t){return{parent:C(t),view:C(e),origin:C(eo(0,0))}},_a=function(e){var r=q.apply(null,e),o=[];return{bind:function(e){if(e===undefined)throw new Error("Event bind error: undefined handler");o.push(e)},unbind:function(t){o=A(o,function(e){return e!==t})},trigger:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=r.apply(null,e);k(o,function(e){e(n)})}}},La={create:function(e){return{registry:H(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:H(e,function(e){return e.trigger})}}},Fa=function(m,g){return function(e){if(m(e)){var t,n,r,o,i,u,a,c=xe.fromDom(e.target),l=function(){e.stopPropagation()},f=function(){e.preventDefault()},s=x(f,l),d=(t=c,n=e.clientX,r=e.clientY,o=l,i=f,u=s,a=e,{target:C(t),x:C(n),y:C(r),stop:o,prevent:i,kill:u,raw:C(a)});g(d)}}},ja=function(e,t,n,r){return o=e,i=t,u=!1,a=Fa(n,r),o.dom().addEventListener(i,a,u),{unbind:b(za,o,i,a,u)};var o,i,u,a},za=function(e,t,n,r){e.dom().removeEventListener(t,n,r)},Ha=C(!0),Ua=function(e,t,n){return ja(e,t,Ha,n)},qa=Object.prototype.hasOwnProperty,Va=(ka=function(e,t){return t},function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var o=e[r];for(var i in o)qa.call(o,i)&&(n[i]=ka(n[i],o[i]))}return n}),Ga={resolve:_o("ephox-dragster").resolve},Ya=du(["compare","extract","mutate","sink"]),Xa=du(["element","start","stop","destroy"]),Ka=du(["forceDrop","drop","move","delayDrop"]),Ja=Ya({compare:function(e,t){return eo(t.left()-e.left(),t.top()-e.top())},extract:function(e){return R.some(eo(e.x(),e.y()))},sink:function(e,t){var n,r,o,i=(n=t,r=Va({layerClass:Ga.resolve("blocker")},n),o=xe.fromTag("div"),se(o,"role","presentation"),Oe(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Eo(o,Ga.resolve("blocker")),Eo(o,r.layerClass),{element:function(){return o},destroy:function(){Nt(o)}}),u=Ua(i.element(),"mousedown",e.forceDrop),a=Ua(i.element(),"mouseup",e.drop),c=Ua(i.element(),"mousemove",e.move),l=Ua(i.element(),"mouseout",e.delayDrop);return Xa({element:i.element,start:function(e){Rt(e,i.element())},stop:function(){Nt(i.element())},destroy:function(){i.destroy(),a.unbind(),c.unbind(),l.unbind(),u.unbind()}})},mutate:function(e,t){e.mutate(t.left(),t.top())}});function $a(){var i=R.none(),u=La.create({move:_a(["info"])});return{onEvent:function(e,o){o.extract(e).each(function(e){var t,n,r;(t=o,n=e,r=i.map(function(e){return t.compare(e,n)}),i=R.some(n),r).each(function(e){u.trigger.move(e)})})},reset:function(){i=R.none()},events:u.registry}}function Qa(){var e={onEvent:y,reset:y},t=$a(),n=e;return{on:function(){n.reset(),n=t},off:function(){n.reset(),n=e},isOn:function(){return n===t},onEvent:function(e,t){n.onEvent(e,t)},events:t.events}}var Za=function(t,n,e){var r,o,i,u=!1,a=La.create({start:_a([]),stop:_a([])}),c=Qa(),l=function(){d.stop(),c.isOn()&&(c.off(),a.trigger.stop())},f=(r=l,o=200,i=null,{cancel:function(){null!==i&&(m.clearTimeout(i),i=null)},throttle:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];null!==i&&m.clearTimeout(i),i=m.setTimeout(function(){r.apply(null,e),i=null},o)}});c.events.move.bind(function(e){n.mutate(t,e.info())});var s=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];u&&n.apply(null,e)}},d=n.sink(Ka({forceDrop:l,drop:s(l),move:s(function(e){f.cancel(),c.onEvent(e,n)}),delayDrop:s(f.throttle)}),e);return{element:d.element,go:function(e){d.start(e),c.on(),a.trigger.start()},on:function(){u=!0},off:function(){u=!1},destroy:function(){d.destroy()},events:a.registry}},ec=function(e,t){void 0===t&&(t={});var n=t.mode!==undefined?t.mode:Ja;return Za(e,n,t)},tc=function(){var n,r=La.create({drag:_a(["xDelta","yDelta","target"])}),o=R.none(),e={mutate:function(e,t){n.trigger.drag(e,t)},events:(n=La.create({drag:_a(["xDelta","yDelta"])})).registry};return e.events.drag.bind(function(t){o.each(function(e){r.trigger.drag(t.xDelta(),t.yDelta(),e)})}),{assign:function(e){o=R.some(e)},get:function(){return o},mutate:e.mutate,events:r.registry}},nc=function(e){return"true"===me(e,"contenteditable")},rc=Lo.resolve("resizer-bar-dragging"),oc=function(o,t,i){var n=tc(),r=ec(n,{}),u=R.none(),e=function(e,t){return R.from(me(e,t))};n.events.drag.bind(function(n){e(n.target(),"data-row").each(function(e){var t=Ui.getInt(n.target(),"top");De(n.target(),"top",t+n.yDelta()+"px")}),e(n.target(),"data-column").each(function(e){var t=Ui.getInt(n.target(),"left");De(n.target(),"left",t+n.xDelta()+"px")})});var a=function(e,t){return Ui.getInt(e,t)-parseInt(me(e,"data-initial-"+t),10)};r.events.stop.bind(function(){n.get().each(function(r){u.each(function(n){e(r,"data-row").each(function(e){var t=a(r,"top");he(r,"data-initial-top"),m.trigger.adjustHeight(n,t,parseInt(e,10))}),e(r,"data-column").each(function(e){var t=a(r,"left");he(r,"data-initial-left"),m.trigger.adjustWidth(n,t,parseInt(e,10))}),Xo(o,n,i,t)})})});var c=function(e,t){m.trigger.startAdjust(),n.assign(e),se(e,"data-initial-"+t,parseInt(Ne(e,t),10)),Eo(e,rc),De(e,"opacity","0.2"),r.go(o.parent())},l=Ua(o.parent(),"mousedown",function(e){Qo(e.target())&&c(e.target(),"top"),Zo(e.target())&&c(e.target(),"left")}),f=function(e){return ft(e,o.view())},s=function(e){return Zt(e,"table",f).filter(function(e){return(t=e,n=f,Zt(t,"[contenteditable]",n)).exists(nc);var t,n})},d=Ua(o.view(),"mouseover",function(e){s(e.target()).fold(function(){Ce(e.target())&&$o(o)},function(e){u=R.some(e),Xo(o,e,i,t)})}),m=La.create({adjustHeight:_a(["table","delta","row"]),adjustWidth:_a(["table","delta","column"]),startAdjust:_a([])});return{destroy:function(){l.unbind(),d.unbind(),r.destroy(),$o(o)},refresh:function(e){Xo(o,e,i,t)},on:r.on,off:r.off,hideBars:b(Ko,o),showBars:b(Jo,o),events:m.registry}},ic=function(e,n){var r=ho.height,t=oc(e,n,r),o=La.create({beforeResize:_a(["table"]),afterResize:_a(["table"]),startDrag:_a([])});return t.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=r.delta(e.delta(),e.table());au(e.table(),t,e.row(),r),o.trigger.afterResize(e.table())}),t.events.startAdjust.bind(function(e){o.trigger.startDrag()}),t.events.adjustWidth.bind(function(e){o.trigger.beforeResize(e.table());var t=n.delta(e.delta(),e.table());uu(e.table(),t,e.column(),n),o.trigger.afterResize(e.table())}),{on:t.on,off:t.off,hideBars:t.hideBars,showBars:t.showBars,destroy:t.destroy,events:o.registry}},uc=function(e,t){return e.inline?Ma(Fu(e),(n=xe.fromTag("div"),Oe(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Rt(Re(),n),n)):Wa(xe.fromDom(e.getDoc()));var n},ac=function(e,t){e.inline&&Nt(t.parent())},cc=function(u){var a,c,o=R.none(),i=R.none(),l=R.none(),f=/(\d+(\.\d+)?)%/,s=function(e){return"TABLE"===e.nodeName};return u.on("init",function(){var e,t=vo(Yu.directionAt),n=uc(u);if(l=R.some(n),("table"===(e=u.getParam("object_resizing",!0))||e)&&u.getParam("table_resize_bars",!0,"boolean")){var r=ic(n,t);r.on(),r.events.startDrag.bind(function(e){o=R.some(u.selection.getRng())}),r.events.beforeResize.bind(function(e){var t=e.table().dom();aa(u,t,ju(t),zu(t))}),r.events.afterResize.bind(function(e){var t=e.table(),n=t.dom();qu(t),o.each(function(e){u.selection.setRng(e),u.focus()}),ca(u,n,ju(n),zu(n)),u.undoManager.add()}),i=R.some(r)}}),u.on("ObjectResizeStart",function(e){var t,n=e.target;s(n)&&(a=e.width,t=n,c=u.dom.getStyle(t,"width")||u.dom.getAttrib(t,"width"))}),u.on("ObjectResized",function(e){var t=e.target;if(s(t)){var n=t;if(f.test(c)){var r=parseFloat(f.exec(c)[1]),o=e.width*r/a;u.dom.setStyle(n,"width",o+"%")}else{var i=[];sa.each(n.rows,function(e){sa.each(e.cells,function(e){var t=u.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),sa.each(i,function(e){u.dom.setStyle(e.cell,"width",e.width),u.dom.setAttrib(e.cell,"width",null)})}}}),{lazyResize:function(){return i},lazyWire:function(){return l.getOr(Wa(xe.fromDom(u.getBody())))},destroy:function(){i.each(function(e){e.destroy()}),l.each(function(e){ac(u,e)})}}},lc=xr([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),fc=wo(wo({},lc),{none:function(e){return void 0===e&&(e=undefined),lc.none(e)}}),sc=function(n,e){return cn.table(n,e).bind(function(e){var t=cn.cells(e);return W(t,function(e){return ft(n,e)}).map(function(e){return{index:C(e),all:C(t)}})})},dc=function(t,e){return sc(t,e).fold(function(){return fc.none(t)},function(e){return e.index()+1<e.all().length?fc.middle(t,e.all()[e.index()+1]):fc.last(t)})},mc=function(t,e){return sc(t,e).fold(function(){return fc.none()},function(e){return 0<=e.index()-1?fc.middle(t,e.all()[e.index()-1]):fc.first(t)})},gc={create:q("start","soffset","finish","foffset")},hc=xr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),pc={before:hc.before,on:hc.on,after:hc.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(o,o,o)}},vc=xr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),bc={domRange:vc.domRange,relative:vc.relative,exact:vc.exact,exactFromRange:function(e){return vc.exact(e.start(),e.soffset(),e.finish(),e.foffset())},getWin:function(e){var t,n=e.match({domRange:function(e){return xe.fromDom(e.startContainer)},relative:function(e,t){return pc.getStart(e)},exact:function(e,t,n,r){return e}});return t=n,xe.fromDom(t.dom().ownerDocument.defaultView)},range:gc.create},wc=function(e,t){e.selectNodeContents(t.dom())},yc=function(e,t,n){var r,o,i=e.document.createRange();return r=i,t.fold(function(e){r.setStartBefore(e.dom())},function(e,t){r.setStart(e.dom(),t)},function(e){r.setStartAfter(e.dom())}),o=i,n.fold(function(e){o.setEndBefore(e.dom())},function(e,t){o.setEnd(e.dom(),t)},function(e){o.setEndAfter(e.dom())}),i},xc=function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},Cc=function(e){return{left:C(e.left),top:C(e.top),right:C(e.right),bottom:C(e.bottom),width:C(e.width),height:C(e.height)}},Rc=xr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Sc=function(e,t,n){return t(xe.fromDom(n.startContainer),n.startOffset,xe.fromDom(n.endContainer),n.endOffset)},Tc=function(e,t){var o,n,r,i=(o=e,t.match({domRange:function(e){return{ltr:C(e),rtl:R.none}},relative:function(e,t){return{ltr:we(function(){return yc(o,e,t)}),rtl:we(function(){return R.some(yc(o,t,e))})}},exact:function(e,t,n,r){return{ltr:we(function(){return xc(o,e,t,n,r)}),rtl:we(function(){return R.some(xc(o,n,r,e,t))})}}}));return(r=(n=i).ltr()).collapsed?n.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return Rc.rtl(xe.fromDom(e.endContainer),e.endOffset,xe.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return Sc(0,Rc.ltr,r)}):Sc(0,Rc.ltr,r)},Dc=function(i,e){return Tc(i,e).match({ltr:function(e,t,n,r){var o=i.document.createRange();return o.setStart(e.dom(),t),o.setEnd(n.dom(),r),o},rtl:function(e,t,n,r){var o=i.document.createRange();return o.setStart(n.dom(),r),o.setEnd(e.dom(),t),o}})},Oc=function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom},Nc=function(n,r,e,t,o){var i=function(e){var t=n.dom().createRange();return t.setStart(r.dom(),e),t.collapse(!0),t},u=vn(r).length,a=function(e,t,n,r,o){if(0===o)return 0;if(t===r)return o-1;for(var i=r,u=1;u<o;u++){var a=e(u),c=Math.abs(t-a.left);if(n<=a.bottom){if(n<a.top||i<c)return u-1;i=c}}return 0}(function(e){return i(e).getBoundingClientRect()},e,t,o.right,u);return i(a)},Ec=function(e,t,n,r){return le(t)?function(t,n,r,o){var e=t.dom().createRange();e.selectNode(n.dom());var i=e.getClientRects();return xo(i,function(e){return Oc(e,r,o)?R.some(e):R.none()}).map(function(e){return Nc(t,n,r,o,e)})}(e,t,n,r):(i=t,u=n,a=r,c=(o=e).dom().createRange(),l=bt(i),xo(l,function(e){return c.selectNode(e.dom()),Oc(c.getBoundingClientRect(),u,a)?Ec(o,e,u,a):R.none()}));var o,i,u,a,c,l},kc=function(e,t){return t-e.left<e.right-t},Ac=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},Pc=function(t,e,n){var r=t.dom().createRange();r.selectNode(e.dom());var o=r.getBoundingClientRect(),i=kc(o,n);return(!0===i?Rn:Sn)(e).map(function(e){return Ac(t,e,i)})},Ic=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=kc(r,n);return R.some(Ac(e,t,o))},Bc=function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect();return function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return Ec(e,t,u,a)}(e,t,Math.max(i.left,Math.min(i.right,n)),Math.max(i.top,Math.min(i.bottom,r)))},Wc=document.caretPositionFromPoint?function(n,e,t){return R.from(n.dom().caretPositionFromPoint(e,t)).bind(function(e){if(null===e.offsetNode)return R.none();var t=n.dom().createRange();return t.setStart(e.offsetNode,e.offset),t.collapse(),R.some(t)})}:document.caretRangeFromPoint?function(e,t,n){return R.from(e.dom().caretRangeFromPoint(t,n))}:function(o,i,t){return xe.fromPoint(o,i,t).bind(function(r){var e=function(){return e=o,n=i,(0===bt(t=r).length?Ic:Pc)(e,t,n);var e,t,n};return 0===bt(r).length?e():Bc(o,r,i,t).orThunk(e)})},Mc=function(e,t){var n=oe(e);return"input"===n?pc.after(e):O(["br","img"],n)?0===t?pc.before(e):pc.after(e):pc.on(e,t)},_c=function(e,t){var n=e.fold(pc.before,Mc,pc.after),r=t.fold(pc.before,Mc,pc.after);return bc.relative(n,r)},Lc=function(e,t,n,r){var o=Mc(e,t),i=Mc(n,r);return bc.relative(o,i)},Fc=function(e,t,n,r){var o,i,u,a,c,l=(i=t,u=n,a=r,(c=mt(o=e).dom().createRange()).setStart(o.dom(),i),c.setEnd(u.dom(),a),c),f=ft(e,n)&&t===r;return l.collapsed&&!f},jc=function(e,t){R.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},zc=function(e,t,n,r,o){var i=xc(e,t,n,r,o);jc(e,i)},Hc=function(s,e){return Tc(s,e).match({ltr:function(e,t,n,r){zc(s,e,t,n,r)},rtl:function(e,t,n,r){var o,i,u,a,c,l=s.getSelection();if(l.setBaseAndExtent)l.setBaseAndExtent(e.dom(),t,n.dom(),r);else if(l.extend)try{i=e,u=t,a=n,c=r,(o=l).collapse(i.dom(),u),o.extend(a.dom(),c)}catch(f){zc(s,n,r,e,t)}else zc(s,n,r,e,t)}})},Uc=function(e){var o=bc.getWin(e).dom(),t=function(e,t,n,r){return xc(o,e,t,n,r)},n=e.match({domRange:function(e){var t=xe.fromDom(e.startContainer),n=xe.fromDom(e.endContainer);return Lc(t,e.startOffset,n,e.endOffset)},relative:_c,exact:Lc});return Tc(o,n).match({ltr:t,rtl:t})},qc=function(e){var t=xe.fromDom(e.anchorNode),n=xe.fromDom(e.focusNode);return Fc(t,e.anchorOffset,n,e.focusOffset)?R.some(gc.create(t,e.anchorOffset,n,e.focusOffset)):function(e){if(0<e.rangeCount){var t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return R.some(gc.create(xe.fromDom(t.startContainer),t.startOffset,xe.fromDom(n.endContainer),n.endOffset))}return R.none()}(e)},Vc=function(e,t){var n,r,o=(n=t,r=e.document.createRange(),wc(r,n),r);jc(e,o)},Gc=function(e){return(t=e,R.from(t.getSelection()).filter(function(e){return 0<e.rangeCount}).bind(qc)).map(function(e){return bc.exact(e.start(),e.soffset(),e.finish(),e.foffset())});var t},Yc=function(e,t){var n,r,o,i=Dc(e,t);return r=(n=i).getClientRects(),0<(o=0<r.length?r[0]:n.getBoundingClientRect()).width||0<o.height?R.some(o).map(Cc):R.none()},Xc=function(e,t,n){return r=e,o=t,i=n,u=xe.fromDom(r.document),Wc(u,o,i).map(function(e){return gc.create(xe.fromDom(e.startContainer),e.startOffset,xe.fromDom(e.endContainer),e.endOffset)});var r,o,i,u},Kc=tinymce.util.Tools.resolve("tinymce.util.VK"),Jc=function(e,t,n,r){return el(e,t,dc(n),r)},$c=function(e,t,n,r){return el(e,t,mc(n),r)},Qc=function(e,t){var n=bc.exact(t,0,t,0);return Uc(n)},Zc=function(e,t){var n,r=qt(t,"tr");return(n=r,0===n.length?R.none():R.some(n[n.length-1])).bind(function(e){return Qt(e,"td,th").map(function(e){return Qc(0,e)})})},el=function(r,e,t,o,n){return t.fold(R.none,R.none,function(e,t){return Rn(t).map(function(e){return Qc(0,e)})},function(n){return cn.table(n,e).bind(function(e){var t=kr.noMenu(n);return r.undoManager.transact(function(){o.insertRowsAfter(e,t)}),Zc(0,e)})})},tl=["table","li","dl"],nl=function(t,n,r,o){if(t.keyCode===Kc.TAB){var i=Fu(n),u=function(e){var t=oe(e);return ft(e,i)||O(tl,t)},e=n.selection.getRng();if(e.collapsed){var a=xe.fromDom(e.startContainer);cn.cell(a,u).each(function(e){t.preventDefault(),(t.shiftKey?$c:Jc)(n,u,e,r,o).each(function(e){n.selection.setRng(e)})})}}},rl={create:q("selection","kill")},ol=function(e,t,n,r){return{start:C(pc.on(e,t)),finish:C(pc.on(n,r))}},il={convertToRange:function(e,t){var n=Dc(e,t);return gc.create(xe.fromDom(n.startContainer),n.startOffset,xe.fromDom(n.endContainer),n.endOffset)},makeSitus:ol},ul=function(n,e,r,t,o){return ft(r,t)?R.none():sr(r,t,e).bind(function(e){var t=e.boxes().getOr([]);return 0<t.length?(o(n,t,e.start(),e.finish()),R.some(rl.create(R.some(il.makeSitus(r,0,r,yn(r))),!0))):R.none()})},al={sync:function(n,r,e,t,o,i,u){return ft(e,o)&&t===i?R.none():Zt(e,"td,th",r).bind(function(t){return Zt(o,"td,th",r).bind(function(e){return ul(n,r,t,e,u)})})},detect:ul,update:function(e,t,n,r,o){return mr(r,e,t,o.firstSelectedSelector(),o.lastSelectedSelector()).map(function(e){return o.clear(n),o.selectRange(n,e.boxes(),e.start(),e.finish()),e.boxes()})}},cl=q("item","mode"),ll=function(e,t,n,r){return void 0===r&&(r=fl),e.property().parent(t).map(function(e){return cl(e,r)})},fl=function(e,t,n,r){return void 0===r&&(r=sl),n.sibling(e,t).map(function(e){return cl(e,r)})},sl=function(e,t,n,r){void 0===r&&(r=sl);var o=e.property().children(t);return n.first(o).map(function(e){return cl(e,r)})},dl=[{current:ll,next:fl,fallback:R.none()},{current:fl,next:sl,fallback:R.some(ll)},{current:sl,next:sl,fallback:R.some(fl)}],ml=function(t,n,r,o,e){return void 0===e&&(e=dl),B(e,function(e){return e.current===r}).bind(function(e){return e.current(t,n,o,e.next).orThunk(function(){return e.fallback.bind(function(e){return ml(t,n,e,o)})})})},gl=function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return 0<e.length?R.some(e[e.length-1]):R.none()}}},hl=function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return 0<e.length?R.some(e[0]):R.none()}}},pl=function(t,e,n,r,o,i){return ml(t,e,r,o).bind(function(e){return i(e.item())?R.none():n(e.item())?R.some(e.item()):pl(t,e.item(),n,e.mode(),o,i)})},vl=function(t){return function(e){return 0===t.property().children(e).length}},bl=function(e,t,n,r){return pl(e,t,n,fl,gl(),r)},wl=function(e,t,n,r){return pl(e,t,n,fl,hl(),r)},yl=$n(),xl=function(e,t){return r=t,bl(n=yl,e,vl(n),r);var n,r},Cl=function(e,t){return r=t,wl(n=yl,e,vl(n),r);var n,r},Rl=q("element","offset"),Sl=(q("element","deltaOffset"),q("element","start","finish"),q("begin","end"),q("element","text"),xr([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}])),Tl=function(e){return Zt(e,"tr")},Dl=wo(wo({},Sl),{verify:function(a,e,t,n,r,c,o){return Zt(n,"td,th",o).bind(function(u){return Zt(e,"td,th",o).map(function(i){return ft(u,i)?ft(n,u)&&yn(u)===r?c(i):Sl.none("in same cell"):ar.sharedOne(Tl,[u,i]).fold(function(){return t=i,n=u,r=(e=a).getRect(t),(o=e.getRect(n)).right>r.left&&o.left<r.right?Sl.success():c(i);var e,t,n,r,o},function(e){return c(i)})})}).getOr(Sl.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)}}),Ol=(q("ancestor","descendants","element","index"),q("parent","children","element","index")),Nl=function(e,t){return W(e,b(ft,t))},El=function(e){return"br"===oe(e)},kl=function(e,t,n){return t(e,n).bind(function(e){return le(e)&&0===vn(e).trim().length?kl(e,t,n):R.some(e)})},Al=function(t,e,n,r){return(o=e,i=n,wt(o,i).filter(El).orThunk(function(){return wt(o,i-1).filter(El)})).bind(function(e){return r.traverse(e).fold(function(){return kl(e,r.gather,t).map(r.relative)},function(e){return(r=e,gt(r).bind(function(t){var n=bt(t);return Nl(n,r).map(function(e){return Ol(t,n,r,e)})})).map(function(e){return pc.on(e.parent(),e.index())});var r})});var o,i},Pl=function(e,t,n,r){var o,i,u;return(El(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return kl(i,u.gather,o)}).map(u.relative)):Al(e,t,n,r)).map(function(e){return{start:C(e),finish:C(e)}})},Il=function(e){return Dl.cata(e,function(e){return R.none()},function(){return R.none()},function(e){return R.some(Rl(e,0))},function(e){return R.some(Rl(e,yn(e)))})},Bl=J(["left","top","right","bottom"],[]),Wl={nu:Bl,moveUp:function(e,t){return Bl({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return Bl({left:e.left(),top:e.top()+t,right:e.right(),bottom:e.bottom()+t})},moveBottomTo:function(e,t){var n=e.bottom()-e.top();return Bl({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return Bl({left:e.left(),top:t,right:e.right(),bottom:t+n})},getTop:function(e){return e.top()},getBottom:function(e){return e.bottom()},translate:function(e,t,n){return Bl({left:e.left()+t,top:e.top()+n,right:e.right()+t,bottom:e.bottom()+n})},toString:function(e){return"("+e.left()+", "+e.top()+") -> ("+e.right()+", "+e.bottom()+")"}},Ml=function(e){return Wl.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},_l=function(e,t){return R.some(e.getRect(t))},Ll=function(e,t,n){return ce(t)?_l(e,t).map(Ml):le(t)?(r=e,o=t,i=n,0<=i&&i<yn(o)?r.getRangedRect(o,i,o,i+1):0<i?r.getRangedRect(o,i-1,o,i):R.none()).map(Ml):R.none();var r,o,i},Fl=function(e,t){return ce(t)?_l(e,t).map(Ml):le(t)?e.getRangedRect(t,0,t,yn(t)).map(Ml):R.none()},jl=xr([{none:[]},{retry:["caret"]}]),zl=function(t,e,r){return(n=e,o=Tu,Vt(function(e,t){return t(e)},Kt,n,o,i)).fold(C(!1),function(e){return Fl(t,e).exists(function(e){return n=e,(t=r).left()<n.left()||Math.abs(n.right()-t.left())<1||t.left()>n.right();var t,n})});var n,o,i},Hl={point:Wl.getTop,adjuster:function(e,t,n,r,o){var i=Wl.moveUp(o,5);return Math.abs(n.top()-r.top())<1?jl.retry(i):n.bottom()<o.top()?jl.retry(i):n.bottom()===o.top()?jl.retry(Wl.moveUp(o,1)):zl(e,t,o)?jl.retry(Wl.translate(i,5,0)):jl.none()},move:Wl.moveUp,gather:xl},Ul={point:Wl.getBottom,adjuster:function(e,t,n,r,o){var i=Wl.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?jl.retry(i):n.top()>o.bottom()?jl.retry(i):n.top()===o.bottom()?jl.retry(Wl.moveDown(o,1)):zl(e,t,o)?jl.retry(Wl.translate(i,5,0)):jl.none()},move:Wl.moveDown,gather:Cl},ql=function(n,r,o,i,u){return 0===u?R.some(i):(c=n,l=i.left(),f=r.point(i),c.elementFromPoint(l,f).filter(function(e){return"table"===oe(e)}).isSome()?(t=i,a=u-1,ql(n,e=r,o,e.move(t,5),a)):n.situsFromPoint(i.left(),r.point(i)).bind(function(e){return e.start().fold(R.none,function(t){return Fl(n,t).bind(function(e){return r.adjuster(n,t,e,o,i).fold(R.none,function(e){return ql(n,r,o,e,u-1)})}).orThunk(function(){return R.some(i)})},R.none)}));var e,t,a,c,l,f},Vl=function(t,n,e){var r,o,i,u=t.move(e,5),a=ql(n,t,e,u,100).getOr(u);return(r=t,o=a,i=n,r.point(o)>i.getInnerHeight()?R.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?R.some(-r.point(o)):R.none()).fold(function(){return n.situsFromPoint(a.left(),t.point(a))},function(e){return n.scrollBy(0,e),n.situsFromPoint(a.left(),t.point(a)-e)})},Gl={tryUp:b(Vl,Hl),tryDown:b(Vl,Ul),ieTryUp:function(e,t){return e.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(e,t){return e.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:C(5)},Yl=it.detect(),Xl=function(r,o,i,u,a,c){return 0===c?R.none():$l(r,o,i,u,a).bind(function(e){var t=r.fromSitus(e),n=Dl.verify(r,i,u,t.finish(),t.foffset(),a.failure,o);return Dl.cata(n,function(){return R.none()},function(){return R.some(e)},function(e){return ft(i,e)&&0===u?Kl(r,i,u,Wl.moveUp,a):Xl(r,o,e,0,a,c-1)},function(e){return ft(i,e)&&u===yn(e)?Kl(r,i,u,Wl.moveDown,a):Xl(r,o,e,yn(e),a,c-1)})})},Kl=function(t,e,n,r,o){return Ll(t,e,n).bind(function(e){return Jl(t,o,r(e,Gl.getJumpSize()))})},Jl=function(e,t,n){return Yl.browser.isChrome()||Yl.browser.isSafari()||Yl.browser.isFirefox()||Yl.browser.isEdge()?t.otherRetry(e,n):Yl.browser.isIE()?t.ieRetry(e,n):R.none()},$l=function(t,e,n,r,o){return Ll(t,n,r).bind(function(e){return Jl(t,o,e)})},Ql=function(t,n,r){return(o=t,i=n,u=r,o.getSelection().bind(function(r){return Pl(i,r.finish(),r.foffset(),u).fold(function(){return R.some(Rl(r.finish(),r.foffset()))},function(e){var t=o.fromSitus(e),n=Dl.verify(o,r.finish(),r.foffset(),t.finish(),t.foffset(),u.failure,i);return Il(n)})})).bind(function(e){return Xl(t,n,e.element(),e.offset(),r,20).map(t.fromSitus)});var o,i,u},Zl=it.detect(),ef=function(e,t){return Kt(e,function(e){return gt(e).exists(function(e){return ft(e,t)})},n).isSome();var n},tf=function(t,r,o,e,i){return Zt(e,"td,th",r).bind(function(n){return Zt(n,"table",r).bind(function(e){return ef(i,e)?Ql(t,r,o).bind(function(t){return Zt(t.finish(),"td,th",r).map(function(e){return{start:C(n),finish:C(e),range:C(t)}})}):R.none()})})},nf=function(e,t,n,r,o,i){return Zl.browser.isIE()?R.none():i(r,t).orThunk(function(){return tf(e,t,n,r,o).map(function(e){var t=e.range();return rl.create(R.some(il.makeSitus(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},rf=function(e,t,n,r,o,i,u){return tf(e,n,r,o,i).bind(function(e){return al.detect(t,n,e.start(),e.finish(),u)})},of=function(e,u){return Zt(e,"tr",u).bind(function(i){return Zt(i,"table",u).bind(function(e){var t,n,r,o=qt(e,"tr");return ft(i,o[0])?(t=e,n=function(e){return Sn(e).isSome()},r=u,bl(yl,t,n,r)).map(function(e){var t=yn(e);return rl.create(R.some(il.makeSitus(e,t,e,t)),!0)}):R.none()})})},uf=function(e,u){return Zt(e,"tr",u).bind(function(i){return Zt(i,"table",u).bind(function(e){var t,n,r,o=qt(e,"tr");return ft(i,o[o.length-1])?(t=e,n=function(e){return Rn(e).isSome()},r=u,wl(yl,t,n,r)).map(function(e){return rl.create(R.some(il.makeSitus(e,0,e,0)),!0)}):R.none()})})},af=function(e,t){return Zt(e,"td,th",t)},cf={down:{traverse:vt,gather:Cl,relative:pc.before,otherRetry:Gl.tryDown,ieRetry:Gl.ieTryDown,failure:Dl.failedDown},up:{traverse:pt,gather:xl,relative:pc.before,otherRetry:Gl.tryUp,ieRetry:Gl.ieTryUp,failure:Dl.failedUp}},lf=function(t){return function(e){return e===t}},ff=lf(38),sf=lf(40),df={ltr:{isBackward:lf(37),isForward:lf(39)},rtl:{isBackward:lf(39),isForward:lf(37)},isUp:ff,isDown:sf,isNavigation:function(e){return 37<=e&&e<=40}},mf=function(e){return{left:e.left(),top:e.top(),right:e.right(),bottom:e.bottom(),width:e.width(),height:e.height()}},gf=(it.detect().browser.isSafari(),function(a){return{elementFromPoint:function(e,t){return xe.fromPoint(xe.fromDom(a.document),e,t)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(e,t,n,r){var o=bc.exact(e,t,n,r);return Yc(a,o).map(mf)},getSelection:function(){return Gc(a).map(function(e){return il.convertToRange(a,e)})},fromSitus:function(e){var t=bc.relative(e.start(),e.finish());return il.convertToRange(a,t)},situsFromPoint:function(e,t){return Xc(a,e,t).map(function(e){return ol(e.start(),e.soffset(),e.finish(),e.foffset())})},clearSelection:function(){a.getSelection().removeAllRanges()},setSelection:function(e){var t,n,r,o,i,u;t=a,n=e.start(),r=e.soffset(),o=e.finish(),i=e.foffset(),u=Lc(n,r,o,i),Hc(t,u)},setRelativeSelection:function(e,t){var n,r;n=a,r=_c(e,t),Hc(n,r)},selectContents:function(e){Vc(a,e)},getInnerHeight:function(){return a.innerHeight},getScrollY:function(){var e,t,n,r;return(e=xe.fromDom(a.document),t=e!==undefined?e.dom():m.document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop,eo(n,r)).top()},scrollBy:function(e,t){var n,r,o;n=e,r=t,((o=xe.fromDom(a.document))!==undefined?o.dom():m.document).defaultView.scrollBy(n,r)}}}),hf=q("rows","cols"),pf={mouse:function(e,t,n,r){var o,i,u,a,c,l,f=gf(e),s=(o=f,i=t,u=n,a=r,c=R.none(),l=function(){c=R.none()},{mousedown:function(e){a.clear(i),c=af(e.target(),u)},mouseover:function(e){c.each(function(r){a.clear(i),af(e.target(),u).each(function(n){sr(r,n,u).each(function(e){var t=e.boxes().getOr([]);(1<t.length||1===t.length&&!ft(r,n))&&(a.selectRange(i,t,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(e){c.each(l)}});return{mousedown:s.mousedown,mouseover:s.mouseover,mouseup:s.mouseup}},keyboard:function(e,l,f,s){var d=gf(e),m=function(){return s.clear(l),R.none()};return{keydown:function(e,t,n,r,o,i){var u=e.raw(),a=u.which,c=!0===u.shiftKey;return dr(l,s.selectedSelector()).fold(function(){return df.isDown(a)&&c?b(rf,d,l,f,cf.down,r,t,s.selectRange):df.isUp(a)&&c?b(rf,d,l,f,cf.up,r,t,s.selectRange):df.isDown(a)?b(nf,d,f,cf.down,r,t,uf):df.isUp(a)?b(nf,d,f,cf.up,r,t,of):R.none},function(t){var e=function(e){return function(){return xo(e,function(e){return al.update(e.rows(),e.cols(),l,t,s)}).fold(function(){return gr(l,s.firstSelectedSelector(),s.lastSelectedSelector()).map(function(e){var t=df.isDown(a)||i.isForward(a)?pc.after:pc.before;return d.setRelativeSelection(pc.on(e.first(),0),t(e.table())),s.clear(l),rl.create(R.none(),!0)})},function(e){return R.some(rl.create(R.none(),!0))})}};return df.isDown(a)&&c?e([hf(1,0)]):df.isUp(a)&&c?e([hf(-1,0)]):i.isBackward(a)&&c?e([hf(0,-1),hf(-1,0)]):i.isForward(a)&&c?e([hf(0,1),hf(1,0)]):df.isNavigation(a)&&!1===c?m:R.none})()},keyup:function(n,r,o,i,u){return dr(l,s.selectedSelector()).fold(function(){var e=n.raw(),t=e.which;return 0==(!0===e.shiftKey)?R.none():df.isNavigation(t)?al.sync(l,f,r,o,i,u,s.selectRange):R.none()},R.none)}}}},vf=function(r,e){k(e,function(e){var t,n;n=e,Do(t=r)?t.dom().classList.remove(n):No(t,n),ko(t)})},bf={byClass:function(o){var t,n,i=(t=o.selected(),function(e){Eo(e,t)}),r=(n=[o.selected(),o.lastSelected(),o.firstSelected()],function(e){vf(e,n)}),u=function(e){var t=qt(e,o.selectedSelector());k(t,r)};return{clear:u,selectRange:function(e,t,n,r){u(e),k(t,i),Eo(n,o.firstSelected()),Eo(r,o.lastSelected())},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}},byAttr:function(o){var n=function(e){he(e,o.selected()),he(e,o.firstSelected()),he(e,o.lastSelected())},i=function(e){se(e,o.selected(),"1")},u=function(e){var t=qt(e,o.selectedSelector());k(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),k(t,i),se(n,o.firstSelected(),"1"),se(r,o.lastSelected(),"1")},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}}},wf=function(e){return!1===Ao(xe.fromDom(e.target),"ephox-snooker-resizer-bar")};function yf(h,p){var v=J(["mousedown","mouseover","mouseup","keyup","keydown"],[]),b=R.none(),w=bf.byAttr(yr);return h.on("init",function(e){var r=h.getWin(),o=Fu(h),t=Hu(h),n=pf.mouse(r,o,t,w),a=pf.keyboard(r,o,t,w),c=function(e,t){!0===e.raw().shiftKey&&(t.kill()&&e.kill(),t.selection().each(function(e){var t=bc.relative(e.start(),e.finish()),n=Dc(r,t);h.selection.setRng(n)}))},i=function(e){var t=f(e);if(t.raw().shiftKey&&df.isNavigation(t.raw().which)){var n=h.selection.getRng(),r=xe.fromDom(n.startContainer),o=xe.fromDom(n.endContainer);a.keyup(t,r,n.startOffset,o,n.endOffset).each(function(e){c(t,e)})}},u=function(e){var t=f(e);p().each(function(e){e.hideBars()});var n=h.selection.getRng(),r=xe.fromDom(h.selection.getStart()),o=xe.fromDom(n.startContainer),i=xe.fromDom(n.endContainer),u=Yu.directionAt(r).isRtl()?df.rtl:df.ltr;a.keydown(t,o,n.startOffset,i,n.endOffset,u).each(function(e){c(t,e)}),p().each(function(e){e.showBars()})},l=function(e){return e.hasOwnProperty("x")&&e.hasOwnProperty("y")},f=function(e){var t=xe.fromDom(e.target),n=function(){e.stopPropagation()},r=function(){e.preventDefault()},o=x(r,n);return{target:C(t),x:C(l(e)?e.x:null),y:C(l(e)?e.y:null),stop:n,prevent:r,kill:o,raw:C(e)}},s=function(e){return 0===e.button},d=function(e){s(e)&&wf(e)&&n.mousedown(f(e))},m=function(e){var t;((t=e).buttons===undefined||Sa.ie&&12<=Sa.ie&&0===t.buttons||0!=(1&t.buttons))&&wf(e)&&n.mouseover(f(e))},g=function(e){s(e)&&wf(e)&&n.mouseup(f(e))};h.on("mousedown",d),h.on("mouseover",m),h.on("mouseup",g),h.on("keyup",i),h.on("keydown",u),h.on("nodechange",function(){var e=h.selection,t=xe.fromDom(e.getStart()),n=xe.fromDom(e.getEnd());ar.sharedOne(cn.table,[t,n]).fold(function(){w.clear(o)},y)}),b=R.some(v({mousedown:d,mouseover:m,mouseup:g,keyup:i,keydown:u}))}),{clear:w.clear,destroy:function(){b.each(function(e){})}}}var xf=sa.each,Cf=function(t){var n=[];function e(e){return function(){t.execCommand(e)}}xf("inserttable tableprops deletetable | cell row column".split(" "),function(e){"|"===e?n.push({text:"-"}):n.push(t.menuItems[e])}),t.addButton("table",{type:"menubutton",title:"Table",menu:n}),t.addButton("tableprops",{title:"Table properties",onclick:e("mceTableProps"),icon:"table"}),t.addButton("tabledelete",{title:"Delete table",onclick:e("mceTableDelete")}),t.addButton("tablecellprops",{title:"Cell properties",onclick:e("mceTableCellProps")}),t.addButton("tablemergecells",{title:"Merge cells",onclick:e("mceTableMergeCells")}),t.addButton("tablesplitcells",{title:"Split cell",onclick:e("mceTableSplitCells")}),t.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:e("mceTableInsertRowBefore")}),t.addButton("tableinsertrowafter",{title:"Insert row after",onclick:e("mceTableInsertRowAfter")}),t.addButton("tabledeleterow",{title:"Delete row",onclick:e("mceTableDeleteRow")}),t.addButton("tablerowprops",{title:"Row properties",onclick:e("mceTableRowProps")}),t.addButton("tablecutrow",{title:"Cut row",onclick:e("mceTableCutRow")}),t.addButton("tablecopyrow",{title:"Copy row",onclick:e("mceTableCopyRow")}),t.addButton("tablepasterowbefore",{title:"Paste row before",onclick:e("mceTablePasteRowBefore")}),t.addButton("tablepasterowafter",{title:"Paste row after",onclick:e("mceTablePasteRowAfter")}),t.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:e("mceTableInsertColBefore")}),t.addButton("tableinsertcolafter",{title:"Insert column after",onclick:e("mceTableInsertColAfter")}),t.addButton("tabledeletecol",{title:"Delete column",onclick:e("mceTableDeleteCol")})},Rf=function(t){var e,n=""===(e=t.getParam("table_toolbar",Xu))||!1===e?[]:d(e)?e.split(/[ ,]/):h(e)?e:[];0<n.length&&t.addContextToolbar(function(e){return t.dom.is(e,"table")&&t.getBody().contains(e)},n.join(" "))},Sf=function(o,n){var r=R.none(),i=[],u=[],a=[],c=[],l=function(e){e.disabled(!0)},f=function(e){e.disabled(!1)},e=function(){var t=this;i.push(t),r.fold(function(){l(t)},function(e){f(t)})},t=function(){var t=this;u.push(t),r.fold(function(){l(t)},function(e){f(t)})};o.on("init",function(){o.on("nodechange",function(e){var t=R.from(o.dom.getParent(o.selection.getStart(),"th,td"));(r=t.bind(function(e){var t=xe.fromDom(e);return cn.table(t).map(function(e){return kr.forMenu(n,e,t)})})).fold(function(){k(i,l),k(u,l),k(a,l),k(c,l)},function(t){k(i,f),k(u,f),k(a,function(e){e.disabled(t.mergable().isNone())}),k(c,function(e){e.disabled(t.unmergable().isNone())})})})});var s=function(e,t,n,r){var o,i,u,a,c,l=r.getEl().getElementsByTagName("table")[0],f=r.isRtl()||"tl-tr"===r.parent().rel;for(l.nextSibling.innerHTML=t+1+" x "+(n+1),f&&(t=9-t),i=0;i<10;i++)for(o=0;o<10;o++)a=l.rows[i].childNodes[o].firstChild,c=(f?t<=o:o<=t)&&i<=n,e.dom.toggleClass(a,"mce-active",c),c&&(u=a);return u.parentNode},d=!1===o.getParam("table_grid",!0,"boolean")?{text:"Table",icon:"table",context:"table",onclick:m("mceInsertTable")}:{text:"Table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),o.execCommand("mceInsertTable"))},onshow:function(){s(o,0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");o.dom.removeClass(e,"mce-active"),o.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:function(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;t<10;t++){e+="<tr>";for(var n=0;n<10;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t,n,r=e.target;"A"===r.tagName.toUpperCase()&&(t=parseInt(r.getAttribute("data-mce-x"),10),n=parseInt(r.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"===this.parent().rel)&&(t=9-t),t===this.lastX&&n===this.lastY||(s(o,t,n,e.control),this.lastX=t,this.lastY=n))},onclick:function(e){var t=this;"A"===e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),t.parent().cancel(),o.undoManager.transact(function(){Na(o,t.lastX+1,t.lastY+1)}),o.addVisual())}}]};function m(e){return function(){o.execCommand(e)}}var g={text:"Table properties",context:"table",onPostRender:e,onclick:m("mceTableProps")},h={text:"Delete table",context:"table",onPostRender:e,cmd:"mceTableDelete"},p={text:"Row",context:"table",menu:[{text:"Insert row before",onclick:m("mceTableInsertRowBefore"),onPostRender:t},{text:"Insert row after",onclick:m("mceTableInsertRowAfter"),onPostRender:t},{text:"Delete row",onclick:m("mceTableDeleteRow"),onPostRender:t},{text:"Row properties",onclick:m("mceTableRowProps"),onPostRender:t},{text:"-"},{text:"Cut row",onclick:m("mceTableCutRow"),onPostRender:t},{text:"Copy row",onclick:m("mceTableCopyRow"),onPostRender:t},{text:"Paste row before",onclick:m("mceTablePasteRowBefore"),onPostRender:t},{text:"Paste row after",onclick:m("mceTablePasteRowAfter"),onPostRender:t}]},v={text:"Column",context:"table",menu:[{text:"Insert column before",onclick:m("mceTableInsertColBefore"),onPostRender:t},{text:"Insert column after",onclick:m("mceTableInsertColAfter"),onPostRender:t},{text:"Delete column",onclick:m("mceTableDeleteCol"),onPostRender:t}]},b={separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:m("mceTableCellProps"),onPostRender:t},{text:"Merge cells",onclick:m("mceTableMergeCells"),onPostRender:function(){var t=this;a.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.mergable().isNone())})}},{text:"Split cell",onclick:m("mceTableSplitCells"),onPostRender:function(){var t=this;c.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.unmergable().isNone())})}}]};o.addMenuItem("inserttable",d),o.addMenuItem("tableprops",g),o.addMenuItem("deletetable",h),o.addMenuItem("row",p),o.addMenuItem("column",v),o.addMenuItem("cell",b)},Tf=function(n,r){return{insertTable:function(e,t){return Na(n,e,t)},setClipboardRows:function(e){return t=r,n=E(e,xe.fromDom),void t.set(R.from(n));var t,n},getClipboardRows:function(){return r.get().fold(function(){},function(e){return E(e,function(e){return e.dom()})})}}};e.add("table",function(t){var n,r=cc(t),e=yf(t,r.lazyResize),o=la(t,r.lazyWire),i=(n=t,{get:function(){var e=Fu(n);return hr(e,yr.selectedSelector()).fold(function(){return n.selection.getStart()===undefined?Rr.none():Rr.single(n.selection)},function(e){return Rr.multiple(e)})}}),u=lu(R.none());return Ba(t,o,e,i,u),Ar(t,i,o,e),Sf(t,i),Cf(t),Rf(t),t.on("PreInit",function(){t.serializer.addTempAttr(yr.firstSelected()),t.serializer.addTempAttr(yr.lastSelected())}),t.getParam("table_tab_navigation",!0,"boolean")&&t.on("keydown",function(e){nl(e,t,o,r.lazyWire)}),t.on("remove",function(){r.destroy(),e.destroy()}),Tf(t,u)})}(window);
mce/visualchars/plugin.js CHANGED
@@ -35,36 +35,8 @@ var visualchars = (function (domGlobals) {
35
  };
36
  var Events = { fireVisualChars: fireVisualChars };
37
 
38
- var charMap = {
39
- '\xA0': 'nbsp',
40
- '\xAD': 'shy'
41
- };
42
- var charMapToRegExp = function (charMap, global) {
43
- var key, regExp = '';
44
- for (key in charMap) {
45
- regExp += key;
46
- }
47
- return new RegExp('[' + regExp + ']', global ? 'g' : '');
48
- };
49
- var charMapToSelector = function (charMap) {
50
- var key, selector = '';
51
- for (key in charMap) {
52
- if (selector) {
53
- selector += ',';
54
- }
55
- selector += 'span.mce-' + charMap[key];
56
- }
57
- return selector;
58
  };
59
- var Data = {
60
- charMap: charMap,
61
- regExp: charMapToRegExp(charMap),
62
- regExpGlobal: charMapToRegExp(charMap, true),
63
- selector: charMapToSelector(charMap),
64
- charMapToRegExp: charMapToRegExp,
65
- charMapToSelector: charMapToSelector
66
- };
67
-
68
  var constant = function (value) {
69
  return function () {
70
  return value;
@@ -73,8 +45,6 @@ var visualchars = (function (domGlobals) {
73
  var never = constant(false);
74
  var always = constant(true);
75
 
76
- var never$1 = never;
77
- var always$1 = always;
78
  var none = function () {
79
  return NONE;
80
  };
@@ -88,37 +58,27 @@ var visualchars = (function (domGlobals) {
88
  var id = function (n) {
89
  return n;
90
  };
91
- var noop = function () {
92
- };
93
- var nul = function () {
94
- return null;
95
- };
96
- var undef = function () {
97
- return undefined;
98
- };
99
  var me = {
100
  fold: function (n, s) {
101
  return n();
102
  },
103
- is: never$1,
104
- isSome: never$1,
105
- isNone: always$1,
106
  getOr: id,
107
  getOrThunk: call,
108
  getOrDie: function (msg) {
109
  throw new Error(msg || 'error: getOrDie called on none.');
110
  },
111
- getOrNull: nul,
112
- getOrUndefined: undef,
113
  or: id,
114
  orThunk: call,
115
  map: none,
116
- ap: none,
117
  each: noop,
118
  bind: none,
119
- flatten: none,
120
- exists: never$1,
121
- forall: always$1,
122
  filter: none,
123
  equals: eq,
124
  equals_: eq,
@@ -133,15 +93,10 @@ var visualchars = (function (domGlobals) {
133
  return me;
134
  }();
135
  var some = function (a) {
136
- var constant_a = function () {
137
- return a;
138
- };
139
  var self = function () {
140
  return me;
141
  };
142
- var map = function (f) {
143
- return some(f(a));
144
- };
145
  var bind = function (f) {
146
  return f(a);
147
  };
@@ -152,8 +107,8 @@ var visualchars = (function (domGlobals) {
152
  is: function (v) {
153
  return a === v;
154
  },
155
- isSome: always$1,
156
- isNone: never$1,
157
  getOr: constant_a,
158
  getOrThunk: constant_a,
159
  getOrDie: constant_a,
@@ -161,35 +116,31 @@ var visualchars = (function (domGlobals) {
161
  getOrUndefined: constant_a,
162
  or: self,
163
  orThunk: self,
164
- map: map,
165
- ap: function (optfab) {
166
- return optfab.fold(none, function (fab) {
167
- return some(fab(a));
168
- });
169
  },
170
  each: function (f) {
171
  f(a);
172
  },
173
  bind: bind,
174
- flatten: constant_a,
175
  exists: bind,
176
  forall: bind,
177
  filter: function (f) {
178
  return f(a) ? me : NONE;
179
  },
 
 
 
 
 
 
180
  equals: function (o) {
181
  return o.is(a);
182
  },
183
  equals_: function (o, elementEq) {
184
- return o.fold(never$1, function (b) {
185
  return elementEq(a, b);
186
  });
187
- },
188
- toArray: function () {
189
- return [a];
190
- },
191
- toString: function () {
192
- return 'some(' + a + ')';
193
  }
194
  };
195
  return me;
@@ -223,24 +174,24 @@ var visualchars = (function (domGlobals) {
223
  };
224
  var isFunction = isType('function');
225
 
226
- var slice = Array.prototype.slice;
227
  var map = function (xs, f) {
228
  var len = xs.length;
229
  var r = new Array(len);
230
  for (var i = 0; i < len; i++) {
231
  var x = xs[i];
232
- r[i] = f(x, i, xs);
233
  }
234
  return r;
235
  };
236
  var each = function (xs, f) {
237
  for (var i = 0, len = xs.length; i < len; i++) {
238
  var x = xs[i];
239
- f(x, i, xs);
240
  }
241
  };
242
  var from$1 = isFunction(Array.from) ? Array.from : function (x) {
243
- return slice.call(x);
244
  };
245
 
246
  var fromHtml = function (html, scope) {
@@ -309,13 +260,44 @@ var visualchars = (function (domGlobals) {
309
  };
310
  var isText = isType$1(TEXT);
311
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  var wrapCharWithSpan = function (value) {
313
  return '<span data-mce-bogus="1" class="mce-' + Data.charMap[value] + '">' + value + '</span>';
314
  };
315
  var Html = { wrapCharWithSpan: wrapCharWithSpan };
316
 
317
  var isMatch = function (n) {
318
- return isText(n) && value(n) !== undefined && Data.regExp.test(value(n));
 
319
  };
320
  var filterDescendants = function (scope, predicate) {
321
  var result = [];
@@ -337,8 +319,8 @@ var visualchars = (function (domGlobals) {
337
  elm = elm.parentNode;
338
  }
339
  };
340
- var replaceWithSpans = function (html) {
341
- return html.replace(Data.regExpGlobal, Html.wrapCharWithSpan);
342
  };
343
  var Nodes = {
344
  isMatch: isMatch,
@@ -351,7 +333,7 @@ var visualchars = (function (domGlobals) {
351
  var node, div;
352
  var nodeList = Nodes.filterDescendants(Element.fromDom(rootElm), Nodes.isMatch);
353
  each(nodeList, function (n) {
354
- var withSpans = Nodes.replaceWithSpans(value(n));
355
  div = editor.dom.create('div', null, withSpans);
356
  while (node = div.lastChild) {
357
  editor.dom.insertAfter(node, n.dom());
35
  };
36
  var Events = { fireVisualChars: fireVisualChars };
37
 
38
+ var noop = function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  };
 
 
 
 
 
 
 
 
 
40
  var constant = function (value) {
41
  return function () {
42
  return value;
45
  var never = constant(false);
46
  var always = constant(true);
47
 
 
 
48
  var none = function () {
49
  return NONE;
50
  };
58
  var id = function (n) {
59
  return n;
60
  };
 
 
 
 
 
 
 
 
61
  var me = {
62
  fold: function (n, s) {
63
  return n();
64
  },
65
+ is: never,
66
+ isSome: never,
67
+ isNone: always,
68
  getOr: id,
69
  getOrThunk: call,
70
  getOrDie: function (msg) {
71
  throw new Error(msg || 'error: getOrDie called on none.');
72
  },
73
+ getOrNull: constant(null),
74
+ getOrUndefined: constant(undefined),
75
  or: id,
76
  orThunk: call,
77
  map: none,
 
78
  each: noop,
79
  bind: none,
80
+ exists: never,
81
+ forall: always,
 
82
  filter: none,
83
  equals: eq,
84
  equals_: eq,
93
  return me;
94
  }();
95
  var some = function (a) {
96
+ var constant_a = constant(a);
 
 
97
  var self = function () {
98
  return me;
99
  };
 
 
 
100
  var bind = function (f) {
101
  return f(a);
102
  };
107
  is: function (v) {
108
  return a === v;
109
  },
110
+ isSome: always,
111
+ isNone: never,
112
  getOr: constant_a,
113
  getOrThunk: constant_a,
114
  getOrDie: constant_a,
116
  getOrUndefined: constant_a,
117
  or: self,
118
  orThunk: self,
119
+ map: function (f) {
120
+ return some(f(a));
 
 
 
121
  },
122
  each: function (f) {
123
  f(a);
124
  },
125
  bind: bind,
 
126
  exists: bind,
127
  forall: bind,
128
  filter: function (f) {
129
  return f(a) ? me : NONE;
130
  },
131
+ toArray: function () {
132
+ return [a];
133
+ },
134
+ toString: function () {
135
+ return 'some(' + a + ')';
136
+ },
137
  equals: function (o) {
138
  return o.is(a);
139
  },
140
  equals_: function (o, elementEq) {
141
+ return o.fold(never, function (b) {
142
  return elementEq(a, b);
143
  });
 
 
 
 
 
 
144
  }
145
  };
146
  return me;
174
  };
175
  var isFunction = isType('function');
176
 
177
+ var nativeSlice = Array.prototype.slice;
178
  var map = function (xs, f) {
179
  var len = xs.length;
180
  var r = new Array(len);
181
  for (var i = 0; i < len; i++) {
182
  var x = xs[i];
183
+ r[i] = f(x, i);
184
  }
185
  return r;
186
  };
187
  var each = function (xs, f) {
188
  for (var i = 0, len = xs.length; i < len; i++) {
189
  var x = xs[i];
190
+ f(x, i);
191
  }
192
  };
193
  var from$1 = isFunction(Array.from) ? Array.from : function (x) {
194
+ return nativeSlice.call(x);
195
  };
196
 
197
  var fromHtml = function (html, scope) {
260
  };
261
  var isText = isType$1(TEXT);
262
 
263
+ var charMap = {
264
+ '\xA0': 'nbsp',
265
+ '\xAD': 'shy'
266
+ };
267
+ var charMapToRegExp = function (charMap, global) {
268
+ var key, regExp = '';
269
+ for (key in charMap) {
270
+ regExp += key;
271
+ }
272
+ return new RegExp('[' + regExp + ']', global ? 'g' : '');
273
+ };
274
+ var charMapToSelector = function (charMap) {
275
+ var key, selector = '';
276
+ for (key in charMap) {
277
+ if (selector) {
278
+ selector += ',';
279
+ }
280
+ selector += 'span.mce-' + charMap[key];
281
+ }
282
+ return selector;
283
+ };
284
+ var Data = {
285
+ charMap: charMap,
286
+ regExp: charMapToRegExp(charMap),
287
+ regExpGlobal: charMapToRegExp(charMap, true),
288
+ selector: charMapToSelector(charMap),
289
+ charMapToRegExp: charMapToRegExp,
290
+ charMapToSelector: charMapToSelector
291
+ };
292
+
293
  var wrapCharWithSpan = function (value) {
294
  return '<span data-mce-bogus="1" class="mce-' + Data.charMap[value] + '">' + value + '</span>';
295
  };
296
  var Html = { wrapCharWithSpan: wrapCharWithSpan };
297
 
298
  var isMatch = function (n) {
299
+ var value$1 = value(n);
300
+ return isText(n) && value$1 !== undefined && Data.regExp.test(value$1);
301
  };
302
  var filterDescendants = function (scope, predicate) {
303
  var result = [];
319
  elm = elm.parentNode;
320
  }
321
  };
322
+ var replaceWithSpans = function (text) {
323
+ return text.replace(Data.regExpGlobal, Html.wrapCharWithSpan);
324
  };
325
  var Nodes = {
326
  isMatch: isMatch,
333
  var node, div;
334
  var nodeList = Nodes.filterDescendants(Element.fromDom(rootElm), Nodes.isMatch);
335
  each(nodeList, function (n) {
336
+ var withSpans = Nodes.replaceWithSpans(editor.dom.encode(value(n)));
337
  div = editor.dom.create('div', null, withSpans);
338
  while (node = div.lastChild) {
339
  editor.dom.insertAfter(node, n.dom());
mce/visualchars/plugin.min.js CHANGED
@@ -1 +1 @@
1
- !function(r){"use strict";var n,e,t,o,u,i,c=function(n){var e=n,t=function(){return e};return{get:t,set:function(n){e=n},clone:function(){return c(t())}}},a=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=function(n){return{isEnabled:function(){return n.get()}}},d=function(n,e){return n.fire("VisualChars",{state:e})},l={"\xa0":"nbsp","\xad":"shy"},s=function(n,e){var t,r="";for(t in n)r+=t;return new RegExp("["+r+"]",e?"g":"")},m=function(n){var e,t="";for(e in n)t&&(t+=","),t+="span.mce-"+n[e];return t},N={charMap:l,regExp:s(l),regExpGlobal:s(l,!0),selector:m(l),charMapToRegExp:s,charMapToSelector:m},g=function(n){return function(){return n}},E=g(!1),h=g(!0),v=E,p=h,T=function(){return O},O=(o={fold:function(n,e){return n()},is:v,isSome:v,isNone:p,getOr:t=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:t,orThunk:e,map:T,ap:T,each:function(){},bind:T,flatten:T,exists:v,forall:p,filter:T,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:g("none()")},Object.freeze&&Object.freeze(o),o),y=function(t){var n=function(){return t},e=function(){return o},r=function(n){return n(t)},o={fold:function(n,e){return e(t)},is:function(n){return t===n},isSome:p,isNone:v,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:e,orThunk:e,map:function(n){return y(n(t))},ap:function(n){return n.fold(T,function(n){return y(n(t))})},each:function(n){n(t)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(t)?o:O},equals:function(n){return n.is(t)},equals_:function(n,e){return n.fold(v,function(n){return e(t,n)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return o},D=function(n){return null===n||n===undefined?O:y(n)},_=(u="function",function(n){return function(n){if(null===n)return"null";var e=typeof n;return"object"===e&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":e}(n)===u}),C=(Array.prototype.slice,function(n,e){for(var t=0,r=n.length;t<r;t++)e(n[t],t,n)}),w=(_(Array.from)&&Array.from,function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:g(n)}}),M={fromHtml:function(n,e){var t=(e||r.document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||1<t.childNodes.length)throw r.console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return w(t.childNodes[0])},fromTag:function(n,e){var t=(e||r.document).createElement(n);return w(t)},fromText:function(n,e){var t=(e||r.document).createTextNode(n);return w(t)},fromDom:w,fromPoint:function(n,e,t){var r=n.dom();return D(r.elementFromPoint(e,t)).map(w)}},b=(r.Node.ATTRIBUTE_NODE,r.Node.CDATA_SECTION_NODE,r.Node.COMMENT_NODE,r.Node.DOCUMENT_NODE,r.Node.DOCUMENT_TYPE_NODE,r.Node.DOCUMENT_FRAGMENT_NODE,r.Node.ELEMENT_NODE,r.Node.TEXT_NODE),k=(r.Node.PROCESSING_INSTRUCTION_NODE,r.Node.ENTITY_REFERENCE_NODE,r.Node.ENTITY_NODE,r.Node.NOTATION_NODE,"undefined"!=typeof r.window?r.window:Function("return this;")(),function(n){return n.dom().nodeValue}),S=(i=b,function(n){return n.dom().nodeType===i}),A=function(n){return'<span data-mce-bogus="1" class="mce-'+N.charMap[n]+'">'+n+"</span>"},x=function(n,e){var t=[],r=function(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var u=n[o];r[o]=e(u,o,n)}return r}(n.dom().childNodes,M.fromDom);return C(r,function(n){e(n)&&(t=t.concat([n])),t=t.concat(x(n,e))}),t},P={isMatch:function(n){return S(n)&&k(n)!==undefined&&N.regExp.test(k(n))},filterDescendants:x,findParentElm:function(n,e){for(;n.parentNode;){if(n.parentNode===e)return n;n=n.parentNode}},replaceWithSpans:function(n){return n.replace(N.regExpGlobal,A)}},R=function(t,n){var r,o,e=P.filterDescendants(M.fromDom(n),P.isMatch);C(e,function(n){var e=P.replaceWithSpans(k(n));for(o=t.dom.create("div",null,e);r=o.lastChild;)t.dom.insertAfter(r,n.dom());t.dom.remove(n.dom())})},I=function(e,n){var t=e.dom.select(N.selector,n);C(t,function(n){e.dom.remove(n,1)})},B=R,U=I,V=function(n){var e=n.getBody(),t=n.selection.getBookmark(),r=P.findParentElm(n.selection.getNode(),e);r=r!==undefined?r:e,I(n,r),R(n,r),n.selection.moveToBookmark(t)},j=function(n,e){var t,r=n.getBody(),o=n.selection;e.set(!e.get()),d(n,e.get()),t=o.getBookmark(),!0===e.get()?B(n,r):U(n,r),o.moveToBookmark(t)},q=function(n,e){n.addCommand("mceVisualChars",function(){j(n,e)})},F=tinymce.util.Tools.resolve("tinymce.util.Delay"),G=function(e,t){var r=F.debounce(function(){V(e)},300);!1!==e.settings.forced_root_block&&e.on("keydown",function(n){!0===t.get()&&(13===n.keyCode?V(e):r())})},H=function(n){return n.getParam("visualchars_default_state",!1)},L=function(e,t){e.on("init",function(){var n=!H(e);t.set(n),j(e,t)})},Y=function(t){return function(n){var e=n.control;t.on("VisualChars",function(n){e.active(n.state)})}};a.add("visualchars",function(n){var e,t=c(!1);return q(n,t),(e=n).addButton("visualchars",{active:!1,title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:Y(e)}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:Y(e),selectable:!0,context:"view",prependToContext:!0}),G(n,t),L(n,t),f(t)})}(window);
1
+ !function(r){"use strict";var n,e,t,o,i,u,c=function(n){var e=n,t=function(){return e};return{get:t,set:function(n){e=n},clone:function(){return c(t())}}},a=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=function(n){return{isEnabled:function(){return n.get()}}},d=function(n,e){return n.fire("VisualChars",{state:e})},s=function(){},l=function(n){return function(){return n}},m=l(!1),N=l(!0),g=function(){return E},E=(n=function(n){return n.isNone()},o={fold:function(n,e){return n()},is:m,isSome:m,isNone:N,getOr:t=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:l(null),getOrUndefined:l(undefined),or:t,orThunk:e,map:g,each:s,bind:g,exists:m,forall:N,filter:g,equals:n,equals_:n,toArray:function(){return[]},toString:l("none()")},Object.freeze&&Object.freeze(o),o),h=function(t){var n=l(t),e=function(){return o},r=function(n){return n(t)},o={fold:function(n,e){return e(t)},is:function(n){return t===n},isSome:N,isNone:m,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:e,orThunk:e,map:function(n){return h(n(t))},each:function(n){n(t)},bind:r,exists:r,forall:r,filter:function(n){return n(t)?o:E},toArray:function(){return[t]},toString:function(){return"some("+t+")"},equals:function(n){return n.is(t)},equals_:function(n,e){return n.fold(m,function(n){return e(t,n)})}};return o},v=function(n){return null===n||n===undefined?E:h(n)},T=(i="function",function(n){return function(n){if(null===n)return"null";var e=typeof n;return"object"===e&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":e}(n)===i}),p=(Array.prototype.slice,function(n,e){for(var t=0,r=n.length;t<r;t++)e(n[t],t)}),O=(T(Array.from)&&Array.from,function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:l(n)}}),y={fromHtml:function(n,e){var t=(e||r.document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||1<t.childNodes.length)throw r.console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return O(t.childNodes[0])},fromTag:function(n,e){var t=(e||r.document).createElement(n);return O(t)},fromText:function(n,e){var t=(e||r.document).createTextNode(n);return O(t)},fromDom:O,fromPoint:function(n,e,t){var r=n.dom();return v(r.elementFromPoint(e,t)).map(O)}},D=(r.Node.ATTRIBUTE_NODE,r.Node.CDATA_SECTION_NODE,r.Node.COMMENT_NODE,r.Node.DOCUMENT_NODE,r.Node.DOCUMENT_TYPE_NODE,r.Node.DOCUMENT_FRAGMENT_NODE,r.Node.ELEMENT_NODE,r.Node.TEXT_NODE),_=(r.Node.PROCESSING_INSTRUCTION_NODE,r.Node.ENTITY_REFERENCE_NODE,r.Node.ENTITY_NODE,r.Node.NOTATION_NODE,"undefined"!=typeof r.window?r.window:Function("return this;")(),function(n){return n.dom().nodeValue}),C=(u=D,function(n){return n.dom().nodeType===u}),w={"\xa0":"nbsp","\xad":"shy"},M=function(n,e){var t,r="";for(t in n)r+=t;return new RegExp("["+r+"]",e?"g":"")},b=function(n){var e,t="";for(e in n)t&&(t+=","),t+="span.mce-"+n[e];return t},k={charMap:w,regExp:M(w),regExpGlobal:M(w,!0),selector:b(w),charMapToRegExp:M,charMapToSelector:b},S=function(n){return'<span data-mce-bogus="1" class="mce-'+k.charMap[n]+'">'+n+"</span>"},A=function(n,e){var t=[],r=function(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var i=n[o];r[o]=e(i,o)}return r}(n.dom().childNodes,y.fromDom);return p(r,function(n){e(n)&&(t=t.concat([n])),t=t.concat(A(n,e))}),t},x={isMatch:function(n){var e=_(n);return C(n)&&e!==undefined&&k.regExp.test(e)},filterDescendants:A,findParentElm:function(n,e){for(;n.parentNode;){if(n.parentNode===e)return n;n=n.parentNode}},replaceWithSpans:function(n){return n.replace(k.regExpGlobal,S)}},P=function(t,n){var r,o,e=x.filterDescendants(y.fromDom(n),x.isMatch);p(e,function(n){var e=x.replaceWithSpans(t.dom.encode(_(n)));for(o=t.dom.create("div",null,e);r=o.lastChild;)t.dom.insertAfter(r,n.dom());t.dom.remove(n.dom())})},R=function(e,n){var t=e.dom.select(k.selector,n);p(t,function(n){e.dom.remove(n,1)})},I=P,B=R,U=function(n){var e=n.getBody(),t=n.selection.getBookmark(),r=x.findParentElm(n.selection.getNode(),e);r=r!==undefined?r:e,R(n,r),P(n,r),n.selection.moveToBookmark(t)},V=function(n,e){var t,r=n.getBody(),o=n.selection;e.set(!e.get()),d(n,e.get()),t=o.getBookmark(),!0===e.get()?I(n,r):B(n,r),o.moveToBookmark(t)},j=function(n,e){n.addCommand("mceVisualChars",function(){V(n,e)})},q=tinymce.util.Tools.resolve("tinymce.util.Delay"),F=function(e,t){var r=q.debounce(function(){U(e)},300);!1!==e.settings.forced_root_block&&e.on("keydown",function(n){!0===t.get()&&(13===n.keyCode?U(e):r())})},G=function(n){return n.getParam("visualchars_default_state",!1)},H=function(e,t){e.on("init",function(){var n=!G(e);t.set(n),V(e,t)})},L=function(t){return function(n){var e=n.control;t.on("VisualChars",function(n){e.active(n.state)})}};a.add("visualchars",function(n){var e,t=c(!1);return j(n,t),(e=n).addButton("visualchars",{active:!1,title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:L(e)}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:L(e),selectable:!0,context:"view",prependToContext:!0}),F(n,t),H(n,t),f(t)})}(window);
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === TinyMCE Advanced ===
2
  Contributors: azaozz
3
  Tags: block editor, classic editor, editor, Gutenberg, formatting, tinymce, write
4
- Requires at least: 5.4
5
- Tested up to: 5.4
6
- Stable tag: 5.4.0
7
  Requires PHP: 5.6
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -15,7 +15,7 @@ Extends and enhances the block editor (Gutenberg) and the classic editor (TinyMC
15
  TinyMCE Advanced introduces a "Classic Paragraph" block for the block editor (Gutenberg).
16
  If you are not quite ready to switch to the block editor, or have plugins that cannot be used there (yet), using the Classic Paragraph block is your best option. It lets you to continue to use the familiar TinyMCE editor for most tasks, and at the same time gives you full access to all blocks and new features in the block editor.
17
 
18
- Version 5.4 continues to improve and enhance the new features introduced in version 5.0 of TinyMCE Advanced. It includes an improved "Clear Formatting" button, several advanced settings for tables, and importing and exporting of the settings to a file.
19
 
20
  If you want to continue to use the previous ("classic") editor in WordPress 5.0 and newer, this plugin has an option to replace the new editor with the previous one. If you prefer to have access to both editors side by side or to allow your users to switch editors, it would be better to install the [Classic Editor plugin](https://wordpress.org/plugins/classic-editor/). TinyMCE Advanced is fully compatible with the classic editor plugin and similar plugins that restore use of the previous WordPress editor.
21
 
@@ -47,6 +47,11 @@ Best is to install directly from WordPress. If manual installation is required,
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
50
  = 5.4.0 =
51
  * Updated for WordPress 5.4.
52
  * Improved "Reset Table Size" to reset all table elements (tr, th, td, thead, tbody, tfoot).
1
  === TinyMCE Advanced ===
2
  Contributors: azaozz
3
  Tags: block editor, classic editor, editor, Gutenberg, formatting, tinymce, write
4
+ Requires at least: 5.5
5
+ Tested up to: 5.5
6
+ Stable tag: 5.5.0
7
  Requires PHP: 5.6
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
  TinyMCE Advanced introduces a "Classic Paragraph" block for the block editor (Gutenberg).
16
  If you are not quite ready to switch to the block editor, or have plugins that cannot be used there (yet), using the Classic Paragraph block is your best option. It lets you to continue to use the familiar TinyMCE editor for most tasks, and at the same time gives you full access to all blocks and new features in the block editor.
17
 
18
+ Version 5.5 continues to improve and enhance the new features introduced in version 5.0 of TinyMCE Advanced. It includes an improved "Clear Formatting" button, several advanced settings for tables, and importing and exporting of the settings to a file.
19
 
20
  If you want to continue to use the previous ("classic") editor in WordPress 5.0 and newer, this plugin has an option to replace the new editor with the previous one. If you prefer to have access to both editors side by side or to allow your users to switch editors, it would be better to install the [Classic Editor plugin](https://wordpress.org/plugins/classic-editor/). TinyMCE Advanced is fully compatible with the classic editor plugin and similar plugins that restore use of the previous WordPress editor.
21
 
47
 
48
  == Changelog ==
49
 
50
+ = 5.5.0 =
51
+ * Updated for WordPress 5.5 and TinyMCE 4.9.10.
52
+ * Updated/renamed the subscript and superscript buttons as these are now in Gutenberg.
53
+ * Minor CSS fixes and enhancements.
54
+
55
  = 5.4.0 =
56
  * Updated for WordPress 5.4.
57
  * Improved "Reset Table Size" to reset all table elements (tr, th, td, thead, tbody, tfoot).
tinymce-advanced.php CHANGED
@@ -3,7 +3,10 @@
3
  Plugin Name: TinyMCE Advanced
4
  Plugin URI: http://www.laptoptips.ca/projects/tinymce-advanced/
5
  Description: Extends and enhances the block editor (Gutenberg) and the classic editor (TinyMCE).
6
- Version: 5.4.0
 
 
 
7
  Author: Andrew Ozz
8
  Author URI: http://www.laptoptips.ca/
9
  License: GPL2
@@ -35,8 +38,8 @@ if ( ! class_exists( 'Tinymce_Advanced' ) ) :
35
 
36
  class Tinymce_Advanced {
37
 
38
- private $required_wp_version = '5.4-beta';
39
- private $plugin_version = 5400;
40
 
41
  private $user_settings;
42
  private $admin_settings;
@@ -75,10 +78,12 @@ class Tinymce_Advanced {
75
  'toolbar_3' => '',
76
  'toolbar_4' => '',
77
 
78
- 'toolbar_classic_block' => 'formatselect,bold,italic,blockquote,bullist,numlist,alignleft,aligncenter,alignright,link,forecolor,backcolor,table,wp_help',
79
- 'toolbar_block' => 'core/image',
80
- 'toolbar_block_side' => 'tadv/sup,tadv/sub,core/strikethrough,core/code,tadv/mark,tadv/removeformat',
81
- 'panels_block' => 'tadv/color-panel,tadv/background-color-panel',
 
 
82
  );
83
  }
84
 
@@ -153,15 +158,15 @@ class Tinymce_Advanced {
153
  // 'core/italic' => array( 'name' => 'Italic', 'icon' => '<span class="dashicons dashicons-editor-italic"></span>' ),
154
  // 'core/link' => array( 'name' => 'Insert/edit link', 'icon' => '<span class="dashicons dashicons-admin-links"></span>' ),
155
  'core/strikethrough' => array( 'name' => 'Strikethrough', 'icon' => '<span class="dashicons dashicons-editor-strikethrough"></span>' ),
156
- 'core/code' => array( 'name' => 'Code', 'icon' => '<span class="dashicons dashicons-editor-code"></span>' ),
157
 
158
- 'core/image' => array( 'name' => 'Inline Image', 'icon' => '<span class="dashicons">' . $inline_img_icon . '</span>' ),
159
  'core/text-color' => array( 'name' => 'Text Color', 'icon' => '<span class="dashicons dashicons-editor-textcolor"></span>' ),
160
 
161
- 'tadv/mark' => array( 'name' => 'Mark', 'icon' => '<span class="dashicons dashicons-editor-textcolor"></span>' ),
162
  'tadv/removeformat' => array( 'name' => 'Clear formatting', 'icon' => '<span class="dashicons dashicons-editor-removeformatting"></span>' ),
163
- 'tadv/sup' => array( 'name' => 'Superscript', 'icon' => '<span class="mce-ico mce-i-superscript"></span>' ),
164
- 'tadv/sub' => array( 'name' => 'Subscript', 'icon' => '<span class="mce-ico mce-i-subscript"></span>' ),
165
  'core/underline' => array( 'name' => 'Underline', 'icon' => '<span class="dashicons dashicons-editor-underline"></span>' ),
166
  );
167
 
@@ -179,8 +184,6 @@ class Tinymce_Advanced {
179
  }
180
 
181
  public function __construct() {
182
- register_activation_hook( __FILE__, array( $this, 'update_settings' ) );
183
-
184
  if ( is_admin() ) {
185
  add_action( 'admin_menu', array( $this, 'add_menu' ) );
186
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -400,13 +403,14 @@ class Tinymce_Advanced {
400
  return;
401
  }
402
 
403
- if ( ! $version || $version < 4000 ) {
404
  // First install or upgrade to TinyMCE 4.0
405
  $this->user_settings = $this->get_default_user_settings();
406
  $this->admin_settings = $this->get_default_admin_settings();
407
 
408
  update_option( 'tadv_settings', $this->user_settings );
409
  update_option( 'tadv_admin_settings', $this->admin_settings );
 
410
 
411
  // Clean out old options
412
  delete_option('tadv_options');
@@ -417,89 +421,112 @@ class Tinymce_Advanced {
417
  delete_option('tadv_btns3');
418
  delete_option('tadv_btns4');
419
  delete_option('tadv_allbtns');
420
- } else {
421
- $admin_settings = get_option( 'tadv_admin_settings', false );
422
- $user_settings = get_option( 'tadv_settings', false );
423
- $user_defaults = $this->get_default_user_settings();
424
-
425
- if ( $version < 5000 ) {
426
- // Update for WP 5.0
427
- $admin_5000 = ! empty( $admin_settings['options'] ) ? $admin_settings['options'] : '';
428
- $user_5000 = ! empty( $user_settings['options'] ) ? $user_settings['options'] : '';
429
-
430
- if ( empty( $admin_5000 ) ) {
431
- $admin_5000 = 'hybrid_mode,classic_paragraph_block';
432
- } elseif ( strpos( $admin_5000, 'no_hybrid_mode' ) !== false ) {
433
- $admin_5000 = str_replace( 'no_hybrid_mode', 'classic_paragraph_block', $admin_5000 );
434
- } else {
435
- $admin_5000 .= ',hybrid_mode,classic_paragraph_block';
436
- }
437
 
438
- if ( empty( $user_5000 ) ) {
439
- $user_5000 = 'menubar_block,merge_toolbars';
440
- } elseif ( strpos( $user_5000, 'no_merge_toolbars' ) !== false ) {
441
- $user_5000 = str_replace( 'no_merge_toolbars', 'menubar_block', $user_5000 );
442
- } else {
443
- $user_5000 .= ',menubar_block,merge_toolbars';
444
- }
445
 
446
- if ( empty( $user_settings['toolbar_block'] ) ) {
447
- $user_settings['toolbar_block'] = $user_defaults['toolbar_block'];
448
- $user_settings['toolbar_block_side'] = $user_defaults['toolbar_block_side'];
449
- $user_settings['panels_block'] = $user_defaults['panels_block'];
450
- }
451
 
452
- $admin_settings['options'] = $admin_5000;
453
- $user_settings['options'] = $user_5000;
 
 
 
 
 
 
 
 
 
454
  }
455
 
456
- if ( $version < 5200 ) {
457
- // Update for 5.2, table options
458
- if ( empty( $admin_settings ) || ! is_array( $admin_settings ) ) {
459
- $admin_settings = array(
460
- 'options' => 'table_resize_bars,table_grid,table_tab_navigation,table_advtab',
461
- );
462
- } elseif ( empty( $admin_settings['options'] ) || ! is_string( $admin_settings['options'] ) ) {
463
- $admin_settings['options'] = 'table_resize_bars,table_grid,table_tab_navigation,table_advtab';
464
- } else {
465
- $admin_settings['options'] .= ',table_resize_bars,table_grid,table_tab_navigation,table_advtab';
466
- }
467
 
468
- if ( ! empty( $user_settings['toolbar_block'] ) ) {
469
- // Remove previously manageable buttons...
470
- $toolbar_block_5200 = str_replace( array( 'core/bold', 'core/italic', 'core/link' ), '', $user_settings['toolbar_block'] );
471
- $user_settings['toolbar_block'] = trim( $toolbar_block_5200, ' ,' );
472
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
 
 
474
  if ( empty( $user_settings['toolbar_block'] ) ) {
475
- $user_settings['toolbar_block'] = 'core/image';
476
  } else {
477
- $user_settings['toolbar_block'] = $user_settings['toolbar_block'] . ',core/image';
478
  }
479
  }
 
480
 
481
- // Add the new text colot popup in 5.4 if 'tadv/color-panel' is not enabled.
482
- // 'core/text-color' duplicates the functionality...
483
- if ( $version < 5400 ) {
484
- if ( ! empty( $user_settings['panels_block'] ) && is_string( $user_settings['panels_block'] ) ) {
485
- $has_color_panel = ( strpos( $user_settings['panels_block'], 'tadv/color-panel' ) !== false );
486
- } else {
487
- $has_color_panel = false;
488
- }
489
 
490
- if ( ! $has_color_panel ) {
491
- if ( empty( $user_settings['toolbar_block'] ) ) {
492
- $user_settings['toolbar_block'] = 'core/text-color';
493
- } else {
494
- $user_settings['toolbar_block'] = $user_settings['toolbar_block'] . ',core/text-color';
495
- }
496
- }
497
  }
498
 
499
- update_option( 'tadv_admin_settings', $admin_settings );
500
- update_option( 'tadv_settings', $user_settings );
 
501
  }
502
 
 
 
 
503
  // Current version
504
  update_option( 'tadv_version', $this->plugin_version );
505
  }
3
  Plugin Name: TinyMCE Advanced
4
  Plugin URI: http://www.laptoptips.ca/projects/tinymce-advanced/
5
  Description: Extends and enhances the block editor (Gutenberg) and the classic editor (TinyMCE).
6
+ Version: 5.5.0
7
+ Requires at least: 5.5
8
+ Tested up to: 5.5
9
+ Requires PHP: 5.6
10
  Author: Andrew Ozz
11
  Author URI: http://www.laptoptips.ca/
12
  License: GPL2
38
 
39
  class Tinymce_Advanced {
40
 
41
+ private $required_wp_version = '5.5-alpha';
42
+ private $plugin_version = 5500;
43
 
44
  private $user_settings;
45
  private $admin_settings;
78
  'toolbar_3' => '',
79
  'toolbar_4' => '',
80
 
81
+ 'toolbar_classic_block' => 'formatselect,bold,italic,blockquote,bullist,numlist,alignleft,aligncenter,alignright,' .
82
+ 'link,forecolor,backcolor,table,wp_help',
83
+
84
+ 'toolbar_block' => 'core/code,core/image,core/strikethrough,tadv/mark,tadv/removeformat',
85
+ 'toolbar_block_side' => 'core/superscript,core/subscript,core/underline',
86
+ 'panels_block' => 'tadv/color-panel,tadv/background-color-panel',
87
  );
88
  }
89
 
158
  // 'core/italic' => array( 'name' => 'Italic', 'icon' => '<span class="dashicons dashicons-editor-italic"></span>' ),
159
  // 'core/link' => array( 'name' => 'Insert/edit link', 'icon' => '<span class="dashicons dashicons-admin-links"></span>' ),
160
  'core/strikethrough' => array( 'name' => 'Strikethrough', 'icon' => '<span class="dashicons dashicons-editor-strikethrough"></span>' ),
161
+ 'core/code' => array( 'name' => 'Code', 'icon' => '<span class="dashicons dashicons-editor-code"></span>' ),
162
 
163
+ 'core/image' => array( 'name' => 'Inline Image', 'icon' => '<span class="dashicons">' . $inline_img_icon . '</span>' ),
164
  'core/text-color' => array( 'name' => 'Text Color', 'icon' => '<span class="dashicons dashicons-editor-textcolor"></span>' ),
165
 
166
+ 'tadv/mark' => array( 'name' => 'Mark', 'icon' => '<span class="dashicons dashicons-editor-textcolor"></span>' ),
167
  'tadv/removeformat' => array( 'name' => 'Clear formatting', 'icon' => '<span class="dashicons dashicons-editor-removeformatting"></span>' ),
168
+ 'core/superscript' => array( 'name' => 'Superscript', 'icon' => '<span class="mce-ico mce-i-superscript"></span>' ),
169
+ 'core/subscript' => array( 'name' => 'Subscript', 'icon' => '<span class="mce-ico mce-i-subscript"></span>' ),
170
  'core/underline' => array( 'name' => 'Underline', 'icon' => '<span class="dashicons dashicons-editor-underline"></span>' ),
171
  );
172
 
184
  }
185
 
186
  public function __construct() {
 
 
187
  if ( is_admin() ) {
188
  add_action( 'admin_menu', array( $this, 'add_menu' ) );
189
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
403
  return;
404
  }
405
 
406
+ if ( $version < 4000 ) {
407
  // First install or upgrade to TinyMCE 4.0
408
  $this->user_settings = $this->get_default_user_settings();
409
  $this->admin_settings = $this->get_default_admin_settings();
410
 
411
  update_option( 'tadv_settings', $this->user_settings );
412
  update_option( 'tadv_admin_settings', $this->admin_settings );
413
+ update_option( 'tadv_version', $this->plugin_version );
414
 
415
  // Clean out old options
416
  delete_option('tadv_options');
421
  delete_option('tadv_btns3');
422
  delete_option('tadv_btns4');
423
  delete_option('tadv_allbtns');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
 
425
+ return;
426
+ }
 
 
 
 
 
427
 
428
+ $admin_settings = get_option( 'tadv_admin_settings', false );
429
+ $user_settings = get_option( 'tadv_settings', false );
430
+ $user_defaults = $this->get_default_user_settings();
 
 
431
 
432
+ if ( $version < 5000 ) {
433
+ // Update for WP 5.0
434
+ $admin_5000 = ! empty( $admin_settings['options'] ) ? $admin_settings['options'] : '';
435
+ $user_5000 = ! empty( $user_settings['options'] ) ? $user_settings['options'] : '';
436
+
437
+ if ( empty( $admin_5000 ) ) {
438
+ $admin_5000 = 'hybrid_mode,classic_paragraph_block';
439
+ } elseif ( strpos( $admin_5000, 'no_hybrid_mode' ) !== false ) {
440
+ $admin_5000 = str_replace( 'no_hybrid_mode', 'classic_paragraph_block', $admin_5000 );
441
+ } else {
442
+ $admin_5000 .= ',hybrid_mode,classic_paragraph_block';
443
  }
444
 
445
+ if ( empty( $user_5000 ) ) {
446
+ $user_5000 = 'menubar_block,merge_toolbars';
447
+ } elseif ( strpos( $user_5000, 'no_merge_toolbars' ) !== false ) {
448
+ $user_5000 = str_replace( 'no_merge_toolbars', 'menubar_block', $user_5000 );
449
+ } else {
450
+ $user_5000 .= ',menubar_block,merge_toolbars';
451
+ }
 
 
 
 
452
 
453
+ if ( empty( $user_settings['toolbar_block'] ) ) {
454
+ $user_settings['toolbar_block'] = $user_defaults['toolbar_block'];
455
+ $user_settings['toolbar_block_side'] = $user_defaults['toolbar_block_side'];
456
+ $user_settings['panels_block'] = $user_defaults['panels_block'];
457
+ }
458
+
459
+ $admin_settings['options'] = $admin_5000;
460
+ $user_settings['options'] = $user_5000;
461
+ }
462
+
463
+ if ( $version < 5200 ) {
464
+ // Update for 5.2, table options
465
+ if ( empty( $admin_settings ) || ! is_array( $admin_settings ) ) {
466
+ $admin_settings = array(
467
+ 'options' => 'table_resize_bars,table_grid,table_tab_navigation,table_advtab',
468
+ );
469
+ } elseif ( empty( $admin_settings['options'] ) || ! is_string( $admin_settings['options'] ) ) {
470
+ $admin_settings['options'] = 'table_resize_bars,table_grid,table_tab_navigation,table_advtab';
471
+ } else {
472
+ $admin_settings['options'] .= ',table_resize_bars,table_grid,table_tab_navigation,table_advtab';
473
+ }
474
+
475
+ if ( ! empty( $user_settings['toolbar_block'] ) ) {
476
+ // Remove previously manageable buttons...
477
+ $toolbar_block_5200 = str_replace( array( 'core/bold', 'core/italic', 'core/link' ), '', $user_settings['toolbar_block'] );
478
+ $user_settings['toolbar_block'] = trim( $toolbar_block_5200, ' ,' );
479
+ }
480
+
481
+ if ( empty( $user_settings['toolbar_block'] ) ) {
482
+ $user_settings['toolbar_block'] = 'core/image';
483
+ } else {
484
+ $user_settings['toolbar_block'] = $user_settings['toolbar_block'] . ',core/image';
485
+ }
486
+ }
487
+
488
+ // Add the new text colot popup in 5.4 if 'tadv/color-panel' is not enabled.
489
+ // 'core/text-color' duplicates the functionality...
490
+ if ( $version < 5400 ) {
491
+ if ( ! empty( $user_settings['panels_block'] ) && is_string( $user_settings['panels_block'] ) ) {
492
+ $has_color_panel = ( strpos( $user_settings['panels_block'], 'tadv/color-panel' ) !== false );
493
+ } else {
494
+ $has_color_panel = false;
495
+ }
496
 
497
+ if ( ! $has_color_panel ) {
498
  if ( empty( $user_settings['toolbar_block'] ) ) {
499
+ $user_settings['toolbar_block'] = 'core/text-color';
500
  } else {
501
+ $user_settings['toolbar_block'] = $user_settings['toolbar_block'] . ',core/text-color';
502
  }
503
  }
504
+ }
505
 
506
+ // Fix/rename 'tadv/sup', 'tadv/sub' to 'core/superscript', 'core/subscript' as these were added to Gutenberg in WP 5.5.
507
+ if ( $version < 5500 ) {
508
+ $replace = array(
509
+ 'tadv/sup',
510
+ 'tadv/sub',
511
+ );
 
 
512
 
513
+ $with = array(
514
+ 'core/superscript',
515
+ 'core/subscript',
516
+ );
517
+
518
+ if ( ! empty( $user_settings['toolbar_block'] ) ) {
519
+ $user_settings['toolbar_block'] = str_replace( $replace, $with, $user_settings['toolbar_block'] );
520
  }
521
 
522
+ if ( ! empty( $user_settings['toolbar_block_side'] ) ) {
523
+ $user_settings['toolbar_block_side'] = str_replace( $replace, $with, $user_settings['toolbar_block_side'] );
524
+ }
525
  }
526
 
527
+ update_option( 'tadv_admin_settings', $admin_settings );
528
+ update_option( 'tadv_settings', $user_settings );
529
+
530
  // Current version
531
  update_option( 'tadv_version', $this->plugin_version );
532
  }