From d393e401dd7e564298fe07cf345e943aca4bd388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Thu, 21 Mar 2024 17:16:22 -0400 Subject: [PATCH] v7 --- icons/default/icons.min.js | 4 +- models/dom/model.min.js | 6 +-- plugins/a11ychecker/css/annotations.css | 2 +- plugins/a11ychecker/plugin.min.js | 4 +- plugins/advcode/plugin.min.js | 6 +-- plugins/advtable/plugin.min.js | 6 +-- plugins/advtemplate/plugin.min.js | 6 +-- plugins/ai/plugin.min.js | 4 +- plugins/casechange/plugin.min.js | 2 +- plugins/checklist/plugin.min.js | 2 +- plugins/editimage/plugin.min.js | 6 +-- plugins/export/plugin.min.js | 2 +- plugins/footnotes/plugin.min.js | 2 +- plugins/formatpainter/plugin.min.js | 2 +- plugins/inlinecss/plugin.min.js | 6 +-- plugins/linkchecker/plugin.min.js | 2 +- plugins/mediaembed/content.min.css | 2 +- plugins/mediaembed/plugin.min.js | 4 +- plugins/mentions/plugin.min.js | 4 +- plugins/mergetags/plugin.min.js | 2 +- plugins/pageembed/css/empa30.css | 2 +- plugins/powerpaste/js/wordimport.js | 2 +- plugins/tinycomments/css/tinycomments.css | 2 +- .../js/tinycomments-sidebar.min.js | 4 +- plugins/tinycomments/plugin.min.js | 2 +- plugins/typography/plugin.min.js | 6 +-- skins/content/dark/content.min.css | 2 +- skins/content/default/content.min.css | 2 +- skins/content/document/content.min.css | 2 +- skins/content/tinymce-5-dark/content.min.css | 2 +- skins/content/tinymce-5/content.min.css | 2 +- skins/content/writer/content.min.css | 2 +- skins/ui/oxide-dark/content.inline.min.css | 2 +- skins/ui/oxide-dark/content.min.css | 2 +- skins/ui/oxide-dark/skin.min.css | 4 +- skins/ui/oxide-dark/skin.shadowdom.min.css | 2 +- skins/ui/oxide/content.inline.min.css | 2 +- skins/ui/oxide/content.min.css | 2 +- skins/ui/oxide/skin.min.css | 4 +- skins/ui/oxide/skin.shadowdom.min.css | 2 +- .../ui/tinymce-5-dark/content.inline.min.css | 2 +- skins/ui/tinymce-5-dark/content.min.css | 2 +- skins/ui/tinymce-5-dark/skin.min.css | 4 +- .../ui/tinymce-5-dark/skin.shadowdom.min.css | 2 +- skins/ui/tinymce-5/content.inline.min.css | 2 +- skins/ui/tinymce-5/content.min.css | 2 +- skins/ui/tinymce-5/skin.min.css | 4 +- skins/ui/tinymce-5/skin.shadowdom.min.css | 2 +- tinymce.d.ts | 42 +++++++++------ tinymce.min.js | 54 +++++++++++++------ 50 files changed, 136 insertions(+), 104 deletions(-) diff --git a/icons/default/icons.min.js b/icons/default/icons.min.js index 1ada63a..ce878bf 100644 --- a/icons/default/icons.min.js +++ b/icons/default/icons.min.js @@ -1,7 +1,7 @@ /*! * TinyMCE * - * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. + * Copyright (c) 2024 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ */ -tinymce.IconManager.add("default",{icons:{"accessibility-check":'',"accordion-toggle":'',accordion:'',"action-next":'',"action-prev":'',addtag:'',"ai-prompt":'',ai:'',"align-center":'',"align-justify":'',"align-left":'',"align-none":'',"align-right":'',"arrow-left":'',"arrow-right":'',bold:'',bookmark:'',"border-style":'',"border-width":'',brightness:'',browse:'',cancel:'',"cell-background-color":'',"cell-border-color":'',"change-case":'',"character-count":'',"checklist-rtl":'',checklist:'',checkmark:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',close:'',"code-sample":'',"color-levels":'',"color-picker":'',"color-swatch-remove-color":'',"color-swatch":'',"comment-add":'',comment:'',contrast:'',copy:'',crop:'',"cut-column":'',"cut-row":'',cut:'',"document-properties":'',drag:'',"duplicate-column":'',"duplicate-row":'',duplicate:'',"edit-block":'',"edit-image":'',"embed-page":'',embed:'',emoji:'',export:'',fill:'',"flip-horizontally":'',"flip-vertically":'',footnote:'',"format-painter":'',format:'',fullscreen:'',gallery:'',gamma:'',help:'',"highlight-bg-color":'',home:'',"horizontal-rule":'',"image-options":'',image:'',indent:'',info:'',"insert-character":'',"insert-time":'',invert:'',italic:'',language:'',"line-height":'',line:'',link:'',"list-bull-circle":'',"list-bull-default":'',"list-bull-square":'',"list-num-default-rtl":'',"list-num-default":'',"list-num-lower-alpha-rtl":'',"list-num-lower-alpha":'',"list-num-lower-greek-rtl":'',"list-num-lower-greek":'',"list-num-lower-roman-rtl":'',"list-num-lower-roman":'',"list-num-upper-alpha-rtl":'',"list-num-upper-alpha":'',"list-num-upper-roman-rtl":'',"list-num-upper-roman":'',lock:'',ltr:'',minus:'',"more-drawer":'',"new-document":'',"new-tab":'',"non-breaking":'',notice:'',"ordered-list-rtl":'',"ordered-list":'',orientation:'',outdent:'',"page-break":'',paragraph:'',"paste-column-after":'',"paste-column-before":'',"paste-row-after":'',"paste-row-before":'',"paste-text":'',paste:'',"permanent-pen":'',plus:'',preferences:'',preview:'',print:'',quote:'',redo:'',reload:'',"remove-formatting":'',remove:'',"resize-handle":'',resize:'',"restore-draft":'',"rotate-left":'',"rotate-right":'',rtl:'',save:'',search:'',"select-all":'',selected:'',send:'',settings:'',sharpen:'',sourcecode:'',"spell-check":'',"strike-through":'',subscript:'',superscript:'',"table-caption":'',"table-cell-classes":'',"table-cell-properties":'',"table-cell-select-all":'',"table-cell-select-inner":'',"table-classes":'',"table-delete-column":'',"table-delete-row":'',"table-delete-table":'',"table-insert-column-after":'',"table-insert-column-before":'',"table-insert-row-above":'',"table-insert-row-after":'',"table-left-header":'',"table-merge-cells":'',"table-row-numbering-rtl":'',"table-row-numbering":'',"table-row-properties":'',"table-split-cells":'',"table-top-header":'',table:'',"template-add":'',template:'',"temporary-placeholder":'',"text-color":'',"text-size-decrease":'',"text-size-increase":'',toc:'',translate:'',typography:'',underline:'',undo:'',unlink:'',unlock:'',"unordered-list":'',unselected:'',upload:'',user:'',"vertical-align":'',visualblocks:'',visualchars:'',warning:'',"zoom-in":'',"zoom-out":''}}); \ No newline at end of file +tinymce.IconManager.add("default",{icons:{"accessibility-check":'',"accordion-toggle":'',accordion:'',"action-next":'',"action-prev":'',addtag:'',"ai-prompt":'',ai:'',"align-center":'',"align-justify":'',"align-left":'',"align-none":'',"align-right":'',"arrow-left":'',"arrow-right":'',bold:'',bookmark:'',"border-style":'',"border-width":'',brightness:'',browse:'',cancel:'',"cell-background-color":'',"cell-border-color":'',"change-case":'',"character-count":'',"checklist-rtl":'',checklist:'',checkmark:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',close:'',"code-sample":'',"color-levels":'',"color-picker":'',"color-swatch-remove-color":'',"color-swatch":'',"comment-add":'',comment:'',contrast:'',copy:'',crop:'',"cut-column":'',"cut-row":'',cut:'',"document-properties":'',drag:'',"duplicate-column":'',"duplicate-row":'',duplicate:'',"edit-block":'',"edit-image":'',"embed-page":'',embed:'',emoji:'',export:'',fill:'',"flip-horizontally":'',"flip-vertically":'',footnote:'',"format-painter":'',format:'',fullscreen:'',gallery:'',gamma:'',help:'',"highlight-bg-color":'',home:'',"horizontal-rule":'',"image-options":'',image:'',indent:'',info:'',"insert-character":'',"insert-time":'',invert:'',italic:'',language:'',"line-height":'',line:'',link:'',"list-bull-circle":'',"list-bull-default":'',"list-bull-square":'',"list-num-default-rtl":'',"list-num-default":'',"list-num-lower-alpha-rtl":'',"list-num-lower-alpha":'',"list-num-lower-greek-rtl":'',"list-num-lower-greek":'',"list-num-lower-roman-rtl":'',"list-num-lower-roman":'',"list-num-upper-alpha-rtl":'',"list-num-upper-alpha":'',"list-num-upper-roman-rtl":'',"list-num-upper-roman":'',lock:'',ltr:'',minus:'',"more-drawer":'',"new-document":'',"new-tab":'',"non-breaking":'',notice:'',"ordered-list-rtl":'',"ordered-list":'',orientation:'',outdent:'',"page-break":'',paragraph:'',"paste-column-after":'',"paste-column-before":'',"paste-row-after":'',"paste-row-before":'',"paste-text":'',paste:'',"permanent-pen":'',plus:'',preferences:'',preview:'',print:'',quote:'',redo:'',reload:'',"remove-formatting":'',remove:'',"resize-handle":'',resize:'',"restore-draft":'',"revision-history":'',"rotate-left":'',"rotate-right":'',rtl:'',save:'',search:'',"select-all":'',selected:'',send:'',settings:'',sharpen:'',sourcecode:'',"spell-check":'',"strike-through":'',subscript:'',superscript:'',"table-caption":'',"table-cell-classes":'',"table-cell-properties":'',"table-cell-select-all":'',"table-cell-select-inner":'',"table-classes":'',"table-delete-column":'',"table-delete-row":'',"table-delete-table":'',"table-insert-column-after":'',"table-insert-column-before":'',"table-insert-row-above":'',"table-insert-row-after":'',"table-left-header":'',"table-merge-cells":'',"table-row-numbering-rtl":'',"table-row-numbering":'',"table-row-properties":'',"table-split-cells":'',"table-top-header":'',table:'',"template-add":'',template:'',"temporary-placeholder":'',"text-color":'',"text-size-decrease":'',"text-size-increase":'',toc:'',translate:'',typography:'',underline:'',undo:'',unlink:'',unlock:'',"unordered-list":'',unselected:'',upload:'',user:'',"vertical-align":'',visualblocks:'',visualchars:'',warning:'',"zoom-in":'',"zoom-out":'',"export-pdf":'',"export-word":'',"import-word":''}}); \ No newline at end of file diff --git a/models/dom/model.min.js b/models/dom/model.min.js index 9ff4921..4c7f58f 100644 --- a/models/dom/model.min.js +++ b/models/dom/model.min.js @@ -1,9 +1,9 @@ /*! * TinyMCE * - * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. + * Copyright (c) 2024 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 6.8.2 + * Version: 7.0.0 */ -!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.ModelManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(t)===e,o=e=>t=>typeof t===e,n=e=>t=>e===t,r=t("string"),s=t("object"),l=t("array"),a=n(null),c=o("boolean"),i=n(void 0),m=e=>!(e=>null==e)(e),d=o("function"),u=o("number"),f=()=>{},g=e=>()=>e,h=e=>e,p=(e,t)=>e===t;function w(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const b=e=>t=>!e(t),v=e=>e(),y=g(!1),x=g(!0);class C{constructor(e,t){this.tag=e,this.value=t}static some(e){return new C(!0,e)}static none(){return C.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?C.some(e(this.value)):C.none()}bind(e){return this.tag?e(this.value):C.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:C.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return m(e)?C.some(e):C.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}C.singletonNone=new C(!1);const S=Array.prototype.slice,T=Array.prototype.indexOf,R=Array.prototype.push,D=(e,t)=>{return o=e,n=t,T.call(o,n)>-1;var o,n},O=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),A=(e,t,o)=>(N(e,((e,n)=>{o=t(o,e,n)})),o),L=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oM(E(e,t)),P=(e,t)=>{for(let o=0,n=e.length;o{const o={};for(let n=0,r=e.length;nt>=0&&tF(e,0),$=e=>F(e,e.length-1),V=(e,t)=>{for(let o=0;o{const o=q(e);for(let n=0,r=o.length;nY(e,((e,o)=>({k:o,v:t(e,o)}))),Y=(e,t)=>{const o={};return G(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},J=(e,t)=>{const o=[];return G(e,((e,n)=>{o.push(t(e,n))})),o},Q=e=>J(e,h),X=(e,t)=>U.call(e,t),Z="undefined"!=typeof window?window:Function("return this;")(),ee=(e,t)=>((e,t)=>{let o=null!=t?t:Z;for(let t=0;t{const t=ee("ownerDocument.defaultView",e);return s(e)&&((e=>((e,t)=>{const o=((e,t)=>ee(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(te(e).constructor.name))},ne=e=>e.dom.nodeName.toLowerCase(),re=e=>e.dom.nodeType,se=e=>t=>re(t)===e,le=e=>8===re(e)||"#comment"===ne(e),ae=e=>ce(e)&&oe(e.dom),ce=se(1),ie=se(3),me=se(9),de=se(11),ue=e=>t=>ce(t)&&ne(t)===e,fe=(e,t,o)=>{if(!(r(o)||c(o)||u(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},ge=(e,t,o)=>{fe(e.dom,t,o)},he=(e,t)=>{const o=e.dom;G(t,((e,t)=>{fe(o,t,e)}))},pe=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},we=(e,t)=>C.from(pe(e,t)),be=(e,t)=>{e.dom.removeAttribute(t)},ve=e=>A(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),ye=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},xe={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return ye(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return ye(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return ye(o)},fromDom:ye,fromPoint:(e,t,o)=>C.from(e.dom.elementFromPoint(t,o)).map(ye)},Ce=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Se=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Te=(e,t)=>{const o=void 0===t?document:t.dom;return Se(o)?C.none():C.from(o.querySelector(e)).map(xe.fromDom)},Re=(e,t)=>e.dom===t.dom,De=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Oe=Ce,ke=e=>xe.fromDom(e.dom.ownerDocument),Ee=e=>me(e)?e:ke(e),Ne=e=>C.from(e.dom.parentNode).map(xe.fromDom),Be=e=>C.from(e.dom.parentElement).map(xe.fromDom),_e=(e,t)=>{const o=d(t)?t:y;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=xe.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},ze=e=>C.from(e.dom.previousSibling).map(xe.fromDom),Ae=e=>C.from(e.dom.nextSibling).map(xe.fromDom),Le=e=>E(e.dom.childNodes,xe.fromDom),We=(e,t)=>{const o=e.dom.childNodes;return C.from(o[t]).map(xe.fromDom)},Me=(e,t)=>{Ne(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},je=(e,t)=>{Ae(e).fold((()=>{Ne(e).each((e=>{Ie(e,t)}))}),(e=>{Me(e,t)}))},Pe=(e,t)=>{const o=(e=>We(e,0))(e);o.fold((()=>{Ie(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Ie=(e,t)=>{e.dom.appendChild(t.dom)},Fe=(e,t)=>{Me(e,t),Ie(t,e)},He=(e,t)=>{N(t,((o,n)=>{const r=0===n?e:t[n-1];je(r,o)}))},$e=(e,t)=>{N(t,(t=>{Ie(e,t)}))},Ve=e=>{e.dom.textContent="",N(Le(e),(e=>{qe(e)}))},qe=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Ue=e=>{const t=Le(e);t.length>0&&He(e,t),qe(e)},Ge=(e,t)=>xe.fromDom(e.dom.cloneNode(t)),Ke=e=>Ge(e,!1),Ye=e=>Ge(e,!0),Je=(e,t)=>{const o=xe.fromTag(t),n=ve(e);return he(o,n),o},Qe=["tfoot","thead","tbody","colgroup"],Xe=(e,t,o)=>({element:e,rowspan:t,colspan:o}),Ze=(e,t,o)=>({element:e,cells:t,section:o}),et=(e,t,o)=>({element:e,isNew:t,isLocked:o}),tt=(e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}),ot=d(Element.prototype.attachShadow)&&d(Node.prototype.getRootNode),nt=g(ot),rt=ot?e=>xe.fromDom(e.dom.getRootNode()):Ee,st=e=>xe.fromDom(e.dom.host),lt=e=>{const t=ie(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=rt(e);return de(o=t)&&m(o.dom.host)?C.some(t):C.none();var o})(xe.fromDom(t)).fold((()=>o.body.contains(t)),(n=lt,r=st,e=>n(r(e))));var n,r},at=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return xe.fromDom(t)},ct=(e,t)=>{let o=[];return N(Le(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(ct(e,t))})),o},it=(e,t,o)=>((e,o,n)=>_(_e(e,n),(e=>Ce(e,t))))(e,0,o),mt=(e,t)=>((e,o)=>_(Le(e),(e=>Ce(e,t))))(e),dt=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Se(o)?[]:E(o.querySelectorAll(e),xe.fromDom)})(t,e);var ut=(e,t,o,n,r)=>e(o,n)?C.some(o):d(r)&&r(o)?C.none():t(o,n,r);const ft=(e,t,o)=>{let n=e.dom;const r=d(o)?o:y;for(;n.parentNode;){n=n.parentNode;const e=xe.fromDom(n);if(t(e))return C.some(e);if(r(e))break}return C.none()},gt=(e,t,o)=>ut(((e,t)=>t(e)),ft,e,t,o),ht=(e,t,o)=>ft(e,(e=>Ce(e,t)),o),pt=(e,t)=>((e,o)=>L(e.dom.childNodes,(e=>{return o=xe.fromDom(e),Ce(o,t);var o})).map(xe.fromDom))(e),wt=(e,t)=>Te(t,e),bt=(e,t,o)=>ut(((e,t)=>Ce(e,t)),ht,e,t,o),vt=(e,t,o=p)=>e.exists((e=>o(e,t))),yt=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te?C.some(t):C.none(),Ct=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,St=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!i(n)||r+t.length<=n)},Tt=(e,t)=>Ct(e,t,0),Rt=(e,t)=>Ct(e,t,e.length-t.length),Dt=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Ot=e=>e.length>0,kt=e=>void 0!==e.style&&d(e.style.getPropertyValue),Et=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);kt(e)&&e.style.setProperty(t,o)},Nt=(e,t,o)=>{const n=e.dom;Et(n,t,o)},Bt=(e,t)=>{const o=e.dom;G(t,((e,t)=>{Et(o,t,e)}))},_t=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||lt(e)?n:zt(o,t)},zt=(e,t)=>kt(e)?e.style.getPropertyValue(t):"",At=(e,t)=>{const o=e.dom,n=zt(o,t);return C.from(n).filter((e=>e.length>0))},Lt=(e,t)=>{((e,t)=>{kt(e)&&e.style.removeProperty(t)})(e.dom,t),vt(we(e,"style").map(Dt),"")&&be(e,"style")},Wt=(e,t,o=0)=>we(e,t).map((e=>parseInt(e,10))).getOr(o),Mt=(e,t)=>Wt(e,t,1),jt=e=>ue("col")(e)?Wt(e,"span",1)>1:Mt(e,"colspan")>1,Pt=e=>Mt(e,"rowspan")>1,It=(e,t)=>parseInt(_t(e,t),10),Ft=g(10),Ht=g(10),$t=(e,t)=>Vt(e,t,x),Vt=(e,t,o)=>j(Le(e),(e=>Ce(e,t)?o(e)?[e]:[]:Vt(e,t,o))),qt=(e,t)=>((e,t,o=y)=>o(t)?C.none():D(e,ne(t))?C.some(t):ht(t,e.join(","),(e=>Ce(e,"table")||o(e))))(["td","th"],e,t),Ut=e=>$t(e,"th,td"),Gt=e=>Ce(e,"colgroup")?mt(e,"col"):j(Jt(e),(e=>mt(e,"col"))),Kt=(e,t)=>bt(e,"table",t),Yt=e=>$t(e,"tr"),Jt=e=>Kt(e).fold(g([]),(e=>mt(e,"colgroup"))),Qt=(e,t)=>E(e,(e=>{if("colgroup"===ne(e)){const t=E(Gt(e),(e=>{const t=Wt(e,"span",1);return Xe(e,1,t)}));return Ze(e,t,"colgroup")}{const o=E(Ut(e),(e=>{const t=Wt(e,"rowspan",1),o=Wt(e,"colspan",1);return Xe(e,t,o)}));return Ze(e,o,t(e))}})),Xt=e=>Ne(e).map((e=>{const t=ne(e);return(e=>D(Qe,e))(t)?t:"tbody"})).getOr("tbody"),Zt=e=>{const t=Yt(e),o=[...Jt(e),...t];return Qt(o,Xt)},eo=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},to=()=>oo(0,0),oo=(e,t)=>({major:e,minor:t}),no={nu:oo,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?to():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return oo(n(1),n(2))})(e,o)},unknown:to},ro=(e,t)=>{const o=String(t).toLowerCase();return L(e,(e=>e.search(o)))},so=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,lo=e=>t=>St(t,e),ao=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>St(e,"edge/")&&St(e,"chrome")&&St(e,"safari")&&St(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,so],search:e=>St(e,"chrome")&&!St(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>St(e,"msie")||St(e,"trident")},{name:"Opera",versionRegexes:[so,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:lo("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:lo("firefox")},{name:"Safari",versionRegexes:[so,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(St(e,"safari")||St(e,"mobile/"))&&St(e,"applewebkit")}],co=[{name:"Windows",search:lo("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>St(e,"iphone")||St(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:lo("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:lo("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:lo("linux"),versionRegexes:[]},{name:"Solaris",search:lo("sunos"),versionRegexes:[]},{name:"FreeBSD",search:lo("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:lo("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],io={browsers:g(ao),oses:g(co)},mo="Edge",uo="Chromium",fo="Opera",go="Firefox",ho="Safari",po=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(mo),isChromium:n(uo),isIE:n("IE"),isOpera:n(fo),isFirefox:n(go),isSafari:n(ho)}},wo=()=>po({current:void 0,version:no.unknown()}),bo=po,vo=(g(mo),g(uo),g("IE"),g(fo),g(go),g(ho),"Windows"),yo="Android",xo="Linux",Co="macOS",So="Solaris",To="FreeBSD",Ro="ChromeOS",Do=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(vo),isiOS:n("iOS"),isAndroid:n(yo),isMacOS:n(Co),isLinux:n(xo),isSolaris:n(So),isFreeBSD:n(To),isChromeOS:n(Ro)}},Oo=()=>Do({current:void 0,version:no.unknown()}),ko=Do,Eo=(g(vo),g("iOS"),g(yo),g(xo),g(Co),g(So),g(To),g(Ro),e=>window.matchMedia(e).matches);let No=eo((()=>((e,t,o)=>{const n=io.browsers(),r=io.oses(),s=t.bind((e=>((e,t)=>V(t.brands,(t=>{const o=t.brand.toLowerCase();return L(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:no.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>ro(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(wo,bo),l=((e,t)=>ro(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Oo,ko),a=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,l=e.isiOS()||e.isAndroid(),a=l||n("(pointer:coarse)"),c=r||!s&&l&&n("(min-device-width:768px)"),i=s||l&&!c,m=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),d=!i&&!c&&!m;return{isiPad:g(r),isiPhone:g(s),isTablet:g(c),isPhone:g(i),isTouch:g(a),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:g(m),isDesktop:g(d)}})(l,s,e,o);return{browser:s,os:l,deviceType:a}})(navigator.userAgent,C.from(navigator.userAgentData),Eo)));const Bo=()=>No(),_o=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=_t(o,e);return parseFloat(t)||0}return n},n=(e,t)=>A(t,((t,o)=>{const n=_t(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!u(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;kt(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},zo=(e,t,o)=>((e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?C.none():C.some(t)})(e).getOr(t))(_t(e,t),o),Ao=_o("width",(e=>e.dom.offsetWidth)),Lo=e=>Ao.get(e),Wo=e=>Ao.getOuter(e),Mo=e=>((e,t)=>{const o=e.dom,n=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?n:((e,t,o,n)=>t-zo(e,`padding-${o}`,0)-zo(e,`padding-${n}`,0)-zo(e,`border-${o}-width`,0)-zo(e,`border-${n}-width`,0))(e,n,"left","right")})(e,"content-box"),jo=(e,t,o)=>{const n=e.cells,r=n.slice(0,t),s=n.slice(t),l=r.concat(o).concat(s);return Fo(e,l)},Po=(e,t,o)=>jo(e,t,[o]),Io=(e,t,o)=>{e.cells[t]=o},Fo=(e,t)=>tt(e.element,t,e.section,e.isNew),Ho=(e,t)=>e.cells[t],$o=(e,t)=>Ho(e,t).element,Vo=e=>e.cells.length,qo=e=>{const t=B(e,(e=>"colgroup"===e.section));return{rows:t.fail,cols:t.pass}},Uo=(e,t,o)=>{const n=E(e.cells,o);return tt(t(e.element),n,e.section,!0)},Go="data-snooker-locked-cols",Ko=e=>we(e,Go).bind((e=>C.from(e.match(/\d+/g)))).map((e=>I(e,x))),Yo=e=>{const t=A(qo(e).rows,((e,t)=>(N(t.cells,((t,o)=>{t.isLocked&&(e[o]=!0)})),e)),{}),o=J(t,((e,t)=>parseInt(t,10)));return((e,t)=>{const o=S.call(e,0);return o.sort(void 0),o})(o)},Jo=(e,t)=>e+","+t,Qo=(e,t)=>{const o=j(e.all,(e=>e.cells));return _(o,t)},Xo=e=>{const t={},o=[],n=H(e).map((e=>e.element)).bind(Kt).bind(Ko).getOr({});let r=0,s=0,l=0;const{pass:a,fail:c}=B(e,(e=>"colgroup"===e.section));N(c,(e=>{const a=[];N(e.cells,(e=>{let o=0;for(;void 0!==t[Jo(l,o)];)o++;const r=((e,t)=>X(e,t)&&void 0!==e[t]&&null!==e[t])(n,o.toString()),c=((e,t,o,n,r,s)=>({element:e,rowspan:t,colspan:o,row:n,column:r,isLocked:s}))(e.element,e.rowspan,e.colspan,l,o,r);for(let n=0;n{const t=(e=>{const t={};let o=0;return N(e.cells,(e=>{const n=e.colspan;k(n,(r=>{const s=o+r;t[s]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,n,s)})),o+=n})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,Q(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),d=((e,t)=>({rows:e,columns:t}))(r,s);return{grid:d,access:t,all:o,columns:i,colgroups:m}},Zo=e=>{const t=Zt(e);return Xo(t)},en=Xo,tn=(e,t,o)=>C.from(e.access[Jo(t,o)]),on=(e,t,o)=>{const n=Qo(e,(e=>o(t,e.element)));return n.length>0?C.some(n[0]):C.none()},nn=Qo,rn=e=>j(e.all,(e=>e.cells)),sn=e=>Q(e.columns),ln=e=>q(e.columns).length>0,an=(e,t)=>C.from(e.columns[t]),cn=(e,t=x)=>{const o=e.grid,n=k(o.columns,h),r=k(o.rows,h);return E(n,(o=>mn((()=>j(r,(t=>tn(e,t,o).filter((e=>e.column===o)).toArray()))),(e=>1===e.colspan&&t(e.element)),(()=>tn(e,0,o)))))},mn=(e,t,o)=>{const n=e();return L(n,t).orThunk((()=>C.from(n[0]).orThunk(o))).map((e=>e.element))},dn=e=>{const t=e.grid,o=k(t.rows,h),n=k(t.columns,h);return E(o,(t=>mn((()=>j(n,(o=>tn(e,t,o).filter((e=>e.row===t)).fold(g([]),(e=>[e]))))),(e=>1===e.rowspan),(()=>tn(e,t,0)))))},un=(e,t)=>o=>"rtl"===fn(o)?t:e,fn=e=>"rtl"===_t(e,"direction")?"rtl":"ltr",gn=_o("height",(e=>{const t=e.dom;return lt(e)?t.getBoundingClientRect().height:t.offsetHeight})),hn=e=>gn.get(e),pn=e=>gn.getOuter(e),wn=(e,t)=>({left:e,top:t,translate:(o,n)=>wn(e+o,t+n)}),bn=wn,vn=(e,t)=>void 0!==e?e:void 0!==t?t:0,yn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return bn(o.offsetLeft,o.offsetTop);const s=vn(null==n?void 0:n.pageYOffset,r.scrollTop),l=vn(null==n?void 0:n.pageXOffset,r.scrollLeft),a=vn(r.clientTop,o.clientTop),c=vn(r.clientLeft,o.clientLeft);return xn(e).translate(l-c,s-a)},xn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?bn(o.offsetLeft,o.offsetTop):lt(e)?(e=>{const t=e.getBoundingClientRect();return bn(t.left,t.top)})(t):bn(0,0)},Cn=(e,t)=>({row:e,y:t}),Sn=(e,t)=>({col:e,x:t}),Tn=e=>yn(e).left+Wo(e),Rn=e=>yn(e).left,Dn=(e,t)=>Sn(e,Rn(t)),On=(e,t)=>Sn(e,Tn(t)),kn=e=>yn(e).top,En=(e,t)=>Cn(e,kn(t)),Nn=(e,t)=>Cn(e,kn(t)+pn(t)),Bn=(e,t,o)=>{if(0===o.length)return[];const n=E(o.slice(1),((t,o)=>t.map((t=>e(o,t))))),r=o[o.length-1].map((e=>t(o.length-1,e)));return n.concat([r])},_n={delta:h,positions:e=>Bn(En,Nn,e),edge:kn},zn=un({delta:h,edge:Rn,positions:e=>Bn(Dn,On,e)},{delta:e=>-e,edge:Tn,positions:e=>Bn(On,Dn,e)}),An={delta:(e,t)=>zn(t).delta(e,t),positions:(e,t)=>zn(t).positions(e,t),edge:e=>zn(e).edge(e)},Ln={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Wn=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),Mn=/(\d+(\.\d+)?)%/,jn=/(\d+(\.\d+)?)px|em/,Pn=ue("col"),In=(e,t,o)=>{const n=Be(e).getOrThunk((()=>at(ke(e))));return t(e)/o(n)*100},Fn=(e,t)=>{Nt(e,"width",t+"px")},Hn=(e,t)=>{Nt(e,"width",t+"%")},$n=(e,t)=>{Nt(e,"height",t+"px")},Vn=e=>{const t=(e=>{return zo(t=e,"height",t.dom.offsetHeight)+"px";var t})(e);return t?((e,t,o,n)=>{const r=parseFloat(e);return Rt(e,"%")&&"table"!==ne(t)?((e,t,o,n)=>{const r=Kt(e).map((e=>{const n=o(e);return Math.floor(t/100*n)})).getOr(t);return n(e,r),r})(t,r,o,n):r})(t,e,hn,$n):hn(e)},qn=(e,t)=>At(e,t).orThunk((()=>we(e,t).map((e=>e+"px")))),Un=e=>qn(e,"width"),Gn=e=>In(e,Lo,Mo),Kn=e=>{return Pn(e)?Lo(e):zo(t=e,"width",t.dom.offsetWidth);var t},Yn=e=>((e,t,o)=>o(e)/Mt(e,"rowspan"))(e,0,Vn),Jn=(e,t,o)=>{Nt(e,"width",t+o)},Qn=e=>In(e,Lo,Mo)+"%",Xn=g(Mn),Zn=ue("col"),er=e=>Un(e).getOrThunk((()=>Kn(e)+"px")),tr=e=>{return(t=e,qn(t,"height")).getOrThunk((()=>Yn(e)+"px"));var t},or=(e,t,o,n,r,s)=>e.filter(n).fold((()=>s(((e,t)=>{if(t<0||t>=e.length-1)return C.none();const o=e[t].fold((()=>{const o=(e=>{const t=S.call(e,0);return t.reverse(),t})(e.slice(0,t));return V(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:0}))),n=e[t+1].fold((()=>{const o=e.slice(t+1);return V(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:1})));return o.bind((e=>n.map((t=>{const o=t.delta+e.delta;return Math.abs(t.value-e.value)/o}))))})(o,t))),(e=>r(e))),nr=(e,t,o,n)=>{const r=cn(e),s=ln(e)?(e=>E(sn(e),(e=>C.from(e.element))))(e):r,l=[C.some(An.edge(t))].concat(E(An.positions(r,t),(e=>e.map((e=>e.x))))),a=b(jt);return E(s,((e,t)=>or(e,t,l,a,(e=>{if((e=>{const t=Bo().browser,o=t.isChromium()||t.isFirefox();return!Zn(e)||o})(e))return o(e);{const e=null!=(s=r[t])?h(s):C.none();return or(e,t,l,a,(e=>n(C.some(Lo(e)))),n)}var s}),n)))},rr=e=>e.map((e=>e+"px")).getOr(""),sr=(e,t,o)=>nr(e,t,Kn,(e=>e.getOrThunk(o.minCellWidth))),lr=(e,t,o,n,r)=>{const s=dn(e),l=[C.some(o.edge(t))].concat(E(o.positions(s,t),(e=>e.map((e=>e.y)))));return E(s,((e,t)=>or(e,t,l,b(Pt),n,r)))},ar=(e,t)=>()=>lt(e)?t(e):parseFloat(At(e,"width").getOr("0")),cr=e=>{const t=ar(e,(e=>parseFloat(Qn(e)))),o=ar(e,Lo);return{width:t,pixelWidth:o,getWidths:(t,o)=>((e,t,o)=>nr(e,t,Gn,(e=>e.fold((()=>o.minCellWidth()),(e=>e/o.pixelWidth()*100)))))(t,e,o),getCellDelta:e=>e/o()*100,singleColumnWidth:(e,t)=>[100-e],minCellWidth:()=>Ft()/o()*100,setElementWidth:Hn,adjustTableWidth:o=>{const n=t();Hn(e,n+o/100*n)},isRelative:!0,label:"percent"}},ir=e=>{const t=ar(e,Lo);return{width:t,pixelWidth:t,getWidths:(t,o)=>sr(t,e,o),getCellDelta:h,singleColumnWidth:(e,t)=>[Math.max(Ft(),e+t)-e],minCellWidth:Ft,setElementWidth:Fn,adjustTableWidth:o=>{const n=t()+o;Fn(e,n)},isRelative:!1,label:"pixel"}},mr=e=>Un(e).fold((()=>(e=>{const t=ar(e,Lo),o=g(0);return{width:t,pixelWidth:t,getWidths:(t,o)=>sr(t,e,o),getCellDelta:o,singleColumnWidth:g([0]),minCellWidth:o,setElementWidth:f,adjustTableWidth:f,isRelative:!0,label:"none"}})(e)),(t=>((e,t)=>null!==Xn().exec(t)?cr(e):ir(e))(e,t))),dr=ir,ur=cr,fr=(e,t,o)=>{const n=e[o].element,r=xe.fromTag("td");Ie(r,xe.fromTag("br")),(t?Ie:Pe)(n,r)},gr=((e,t)=>{const o=t=>e(t)?C.from(t.dom.nodeValue):C.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return o(t).getOr("")},getOption:o,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(ie),hr=e=>gr.get(e),pr=e=>gr.getOption(e),wr=(e,t)=>gr.set(e,t),br=e=>"img"===ne(e)?1:pr(e).fold((()=>Le(e).length),(e=>e.length)),vr=["img","br"],yr=e=>pr(e).filter((e=>0!==e.trim().length||e.indexOf("\xa0")>-1)).isSome()||D(vr,ne(e))||(e=>ae(e)&&"false"===pe(e,"contenteditable"))(e),xr=e=>((e,t)=>{const o=e=>{for(let n=0;nSr(e,yr),Sr=(e,t)=>{const o=e=>{const n=Le(e);for(let e=n.length-1;e>=0;e--){const r=n[e];if(t(r))return C.some(r);const s=o(r);if(s.isSome())return s}return C.none()};return o(e)},Tr={scope:["row","col"]},Rr=e=>()=>{const t=xe.fromTag("td",e.dom);return Ie(t,xe.fromTag("br",e.dom)),t},Dr=e=>()=>xe.fromTag("col",e.dom),Or=e=>()=>xe.fromTag("colgroup",e.dom),kr=e=>()=>xe.fromTag("tr",e.dom),Er=(e,t,o)=>{const n=((e,t)=>{const o=Je(e,t),n=Le(Ye(e));return $e(o,n),o})(e,t);return G(o,((e,t)=>{null===e?be(n,t):ge(n,t,e)})),n},Nr=e=>e,Br=(e,t,o)=>{const n=(e,t)=>{((e,t)=>{const o=e.dom,n=t.dom;kt(o)&&kt(n)&&(n.style.cssText=o.style.cssText)})(e.element,t),Lt(t,"height"),1!==e.colspan&&Lt(t,"width")};return{col:o=>{const r=xe.fromTag(ne(o.element),t.dom);return n(o,r),e(o.element,r),r},colgroup:Or(t),row:kr(t),cell:r=>{const s=xe.fromTag(ne(r.element),t.dom),l=o.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),a=l.length>0?((e,t,o)=>xr(e).map((n=>{const r=o.join(","),s=it(n,r,(t=>Re(t,e)));return z(s,((e,t)=>{const o=Ke(t);return Ie(e,o),o}),t)})).getOr(t))(r.element,s,l):s;return Ie(a,xe.fromTag("br")),n(r,s),((e,t)=>{G(Tr,((o,n)=>we(e,n).filter((e=>D(o,e))).each((e=>ge(t,n,e)))))})(r.element,s),e(r.element,s),s},replace:Er,colGap:Dr(t),gap:Rr(t)}},_r=e=>({col:Dr(e),colgroup:Or(e),row:kr(e),cell:Rr(e),replace:Nr,colGap:Dr(e),gap:Rr(e)}),zr=e=>t=>t.options.get(e),Ar="100%",Lr=e=>{var t;const o=e.dom,n=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return Mo(xe.fromDom(n))+"px"},Wr=e=>C.from(e.options.get("table_clone_elements")),Mr=zr("table_header_type"),jr=zr("table_column_resizing"),Pr=e=>"preservetable"===jr(e),Ir=e=>"resizetable"===jr(e),Fr=zr("table_sizing_mode"),Hr=e=>"relative"===Fr(e),$r=e=>"fixed"===Fr(e),Vr=e=>"responsive"===Fr(e),qr=zr("table_resize_bars"),Ur=zr("table_style_by_css"),Gr=zr("table_merge_content_on_paste"),Kr=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>Vr(e)||Ur(e)?t:$r(e)?{...t,width:Lr(e)}:{...t,width:Ar})(e,o)},Yr=zr("table_use_colgroups"),Jr=e=>bt(e,"[contenteditable]"),Qr=(e,t=!1)=>lt(e)?e.dom.isContentEditable:Jr(e).fold(g(t),(e=>"true"===Xr(e))),Xr=e=>e.dom.contentEditable,Zr=e=>xe.fromDom(e.getBody()),es=e=>t=>Re(t,Zr(e)),ts=e=>{be(e,"data-mce-style");const t=e=>be(e,"data-mce-style");N(Ut(e),t),N(Gt(e),t),N(Yt(e),t)},os=e=>xe.fromDom(e.selection.getStart()),ns=e=>e.getBoundingClientRect().width,rs=e=>e.getBoundingClientRect().height,ss=e=>gt(e,ue("table")).exists(Qr),ls=(e,t)=>{const o=t.column,n=t.column+t.colspan-1,r=t.row,s=t.row+t.rowspan-1;return o<=e.finishCol&&n>=e.startCol&&r<=e.finishRow&&s>=e.startRow},as=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,cs=(e,t,o)=>{const n=on(e,t,Re),r=on(e,o,Re);return n.bind((e=>r.map((t=>{return o=e,n=t,{startRow:Math.min(o.row,n.row),startCol:Math.min(o.column,n.column),finishRow:Math.max(o.row+o.rowspan-1,n.row+n.rowspan-1),finishCol:Math.max(o.column+o.colspan-1,n.column+n.colspan-1)};var o,n}))))},is=(e,t,o)=>cs(e,t,o).map((t=>{const o=nn(e,w(ls,t));return E(o,(e=>e.element))})),ms=(e,t)=>on(e,t,((e,t)=>De(t,e))).map((e=>e.element)),ds=(e,t,o)=>{const n=fs(e);return is(n,t,o)},us=(e,t,o,n,r)=>{const s=fs(e),l=Re(e,o)?C.some(t):ms(s,t),a=Re(e,r)?C.some(n):ms(s,n);return l.bind((e=>a.bind((t=>is(s,e,t)))))},fs=Zo;var gs=["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"],hs=()=>({up:g({selector:ht,closest:bt,predicate:ft,all:_e}),down:g({selector:dt,predicate:ct}),styles:g({get:_t,getRaw:At,set:Nt,remove:Lt}),attrs:g({get:pe,set:ge,remove:be,copyTo:(e,t)=>{const o=ve(e);he(t,o)}}),insert:g({before:Me,after:je,afterAll:He,append:Ie,appendAll:$e,prepend:Pe,wrap:Fe}),remove:g({unwrap:Ue,remove:qe}),create:g({nu:xe.fromTag,clone:e=>xe.fromDom(e.dom.cloneNode(!1)),text:xe.fromText}),query:g({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:ze,nextSibling:Ae}),property:g({children:Le,name:ne,parent:Ne,document:e=>Ee(e).dom,isText:ie,isComment:le,isElement:ce,isSpecial:e=>{const t=ne(e);return D(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>ce(e)?we(e,"lang"):C.none(),getText:hr,setText:wr,isBoundary:e=>!!ce(e)&&("body"===ne(e)||D(gs,ne(e))),isEmptyTag:e=>!!ce(e)&&D(["br","img","hr","input"],ne(e)),isNonEditable:e=>ce(e)&&"false"===pe(e,"contenteditable")}),eq:Re,is:Oe});const ps=(e,t,o,n)=>{const r=t(e,o);return z(n,((o,n)=>{const r=t(e,n);return ws(e,o,r)}),r)},ws=(e,t,o)=>t.bind((t=>o.filter(w(e.eq,t)))),bs=hs(),vs=(e,t)=>((e,t,o)=>o.length>0?((e,t,o,n)=>n(e,t,o[0],o.slice(1)))(e,t,o,ps):C.none())(bs,((t,o)=>e(o)),t),ys=e=>ht(e,"table"),xs=(e,t,o)=>{const n=e=>t=>void 0!==o&&o(t)||Re(t,e);return Re(e,t)?C.some({boxes:C.some([e]),start:e,finish:t}):ys(e).bind((r=>ys(t).bind((s=>{if(Re(r,s))return C.some({boxes:ds(r,e,t),start:e,finish:t});if(De(r,s)){const o=it(t,"td,th",n(r)),l=o.length>0?o[o.length-1]:t;return C.some({boxes:us(r,e,r,t,s),start:e,finish:l})}if(De(s,r)){const o=it(e,"td,th",n(s)),l=o.length>0?o[o.length-1]:e;return C.some({boxes:us(s,e,r,t,s),start:e,finish:l})}return((e,t,o)=>((e,t,o,n=y)=>{const r=[t].concat(e.up().all(t)),s=[o].concat(e.up().all(o)),l=e=>W(e,n).fold((()=>e),(t=>e.slice(0,t+1))),a=l(r),c=l(s),i=L(a,(t=>O(c,((e,t)=>w(e.eq,t))(e,t))));return{firstpath:a,secondpath:c,shared:i}})(bs,e,t,void 0))(e,t).shared.bind((l=>bt(l,"table",o).bind((o=>{const l=it(t,"td,th",n(o)),a=l.length>0?l[l.length-1]:t,c=it(e,"td,th",n(o)),i=c.length>0?c[c.length-1]:e;return C.some({boxes:us(o,e,r,t,s),start:i,finish:a})}))))}))))},Cs=(e,t)=>{const o=dt(e,t);return o.length>0?C.some(o):C.none()},Ss=(e,t,o)=>wt(e,t).bind((t=>wt(e,o).bind((e=>vs(ys,[t,e]).map((o=>({first:t,last:e,table:o}))))))),Ts=(e,t,o,n,r)=>((e,t)=>L(e,(e=>Ce(e,t))))(e,r).bind((e=>((e,t,o)=>Kt(e).bind((n=>((e,t,o,n)=>on(e,t,Re).bind((t=>{const r=o>0?t.row+t.rowspan-1:t.row,s=n>0?t.column+t.colspan-1:t.column;return tn(e,r+o,s+n).map((e=>e.element))})))(fs(n),e,t,o))))(e,t,o).bind((e=>((e,t)=>ht(e,"table").bind((o=>wt(o,t).bind((t=>xs(t,e).bind((e=>e.boxes.map((t=>({boxes:t,start:e.start,finish:e.finish}))))))))))(e,n))))),Rs=(e,t)=>Cs(e,t),Ds=(e,t,o)=>Ss(e,t,o).bind((t=>{const o=t=>Re(e,t),n="thead,tfoot,tbody,table",r=ht(t.first,n,o),s=ht(t.last,n,o);return r.bind((e=>s.bind((o=>Re(e,o)?((e,t,o)=>((e,t,o)=>cs(e,t,o).bind((t=>((e,t)=>{let o=!0;const n=w(as,t);for(let r=t.startRow;r<=t.finishRow;r++)for(let s=t.startCol;s<=t.finishCol;s++)o=o&&tn(e,r,s).exists(n);return o?C.some(t):C.none()})(e,t))))(fs(e),t,o))(t.table,t.first,t.last):C.none()))))})),Os=h,ks=e=>{const t=(e,t)=>we(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&P(e,(e=>t(e,"rowspan")||t(e,"colspan")))?C.some(e):C.none()},Es=(e,t,o)=>t.length<=1?C.none():Ds(e,o.firstSelectedSelector,o.lastSelectedSelector).map((e=>({bounds:e,cells:t}))),Ns="data-mce-selected",Bs="data-mce-first-selected",_s="data-mce-last-selected",zs="["+Ns+"]",As={selected:Ns,selectedSelector:"td["+Ns+"],th["+Ns+"]",firstSelected:Bs,firstSelectedSelector:"td["+Bs+"],th["+Bs+"]",lastSelected:_s,lastSelectedSelector:"td["+_s+"],th["+_s+"]"},Ls=(e,t,o)=>({element:o,mergable:Es(t,e,As),unmergable:ks(e),selection:Os(e)}),Ws=e=>(t,o)=>{const n=ne(t),r="col"===n||"colgroup"===n?Kt(s=t).bind((e=>Rs(e,As.firstSelectedSelector))).fold(g(s),(e=>e[0])):t;var s;return bt(r,e,o)},Ms=Ws("th,td,caption"),js=Ws("th,td"),Ps=e=>{return t=e.model.table.getSelectedCells(),E(t,xe.fromDom);var t},Is=(e,t)=>{e.on("BeforeGetContent",(t=>{const o=o=>{t.preventDefault(),(e=>Kt(e[0]).map((e=>{const t=((e,t)=>{const o=e=>Ce(e.element,t),n=Ye(e),r=Zt(n),s=mr(e),l=en(r),a=((e,t)=>{const o=e.grid.columns;let n=e.grid.rows,r=o,s=0,l=0;const a=[],c=[];return G(e.access,(e=>{if(a.push(e),t(e)){c.push(e);const t=e.row,o=t+e.rowspan-1,a=e.column,i=a+e.colspan-1;ts&&(s=o),al&&(l=i)}})),((e,t,o,n,r,s)=>({minRow:e,minCol:t,maxRow:o,maxCol:n,allCells:r,selectedCells:s}))(n,r,s,l,a,c)})(l,o),c="th:not("+t+"),td:not("+t+")",i=Vt(n,"th,td",(e=>Ce(e,c)));N(i,qe),((e,t,o,n)=>{const r=_(e,(e=>"colgroup"!==e.section)),s=t.grid.columns,l=t.grid.rows;for(let e=0;eo.maxRow||ao.maxCol||(tn(t,e,a).filter(n).isNone()?fr(r,l,e):l=!0)}})(r,l,a,o);const m=((e,t,o,n)=>{if(0===n.minCol&&t.grid.columns===n.maxCol+1)return 0;const r=sr(t,e,o),s=A(r,((e,t)=>e+t),0),l=A(r.slice(n.minCol,n.maxCol+1),((e,t)=>e+t),0),a=l/s*o.pixelWidth()-o.pixelWidth();return o.getCellDelta(a)})(e,Zo(e),s,a);return((e,t,o,n)=>{G(o.columns,(e=>{(e.columnt.maxCol)&&qe(e.element)}));const r=_($t(e,"tr"),(e=>0===e.dom.childElementCount));N(r,qe),t.minCol!==t.maxCol&&t.minRow!==t.maxRow||N($t(e,"th,td"),(e=>{be(e,"rowspan"),be(e,"colspan")})),be(e,Go),be(e,"data-snooker-col-series"),mr(e).adjustTableWidth(n)})(n,a,l,m),n})(e,zs);return ts(t),[t]})))(o).each((o=>{t.content="text"===t.format?(e=>E(e,(e=>e.dom.innerText)).join(""))(o):((e,t)=>E(t,(t=>e.selection.serializer.serialize(t.dom,{}))).join(""))(e,o)}))};if(!0===t.selection){const t=(e=>_(Ps(e),(e=>Ce(e,As.selectedSelector))))(e);t.length>=1&&o(t)}})),e.on("BeforeSetContent",(o=>{if(!0===o.selection&&!0===o.paste){const n=Ps(e);H(n).each((n=>{Kt(n).each((r=>{const s=_(((e,t)=>{const o=document.createElement("div");return o.innerHTML=e,Le(xe.fromDom(o))})(o.content),(e=>"meta"!==ne(e))),l=ue("table");if(Gr(e)&&1===s.length&&l(s[0])){o.preventDefault();const l=xe.fromDom(e.getDoc()),a=_r(l),c=((e,t,o)=>({element:e,clipboard:t,generators:o}))(n,s[0],a);t.pasteCells(r,c).each((()=>{e.focus()}))}}))}))}}))},Fs=(e,t)=>({element:e,offset:t}),Hs=(e,t,o)=>e.property().isText(t)&&0===e.property().getText(t).trim().length||e.property().isComment(t)?o(t).bind((t=>Hs(e,t,o).orThunk((()=>C.some(t))))):C.none(),$s=(e,t)=>e.property().isText(t)?e.property().getText(t).length:e.property().children(t).length,Vs=(e,t)=>{const o=Hs(e,t,e.query().prevSibling).getOr(t);if(e.property().isText(o))return Fs(o,$s(e,o));const n=e.property().children(o);return n.length>0?Vs(e,n[n.length-1]):Fs(o,$s(e,o))},qs=Vs,Us=hs(),Gs=(e,t)=>{if(!jt(e)){const o=(e=>Un(e).bind((e=>{return t=e,o=["fixed","relative","empty"],C.from(Wn.exec(t)).bind((e=>{const t=Number(e[1]),n=e[2];return((e,t)=>O(t,(t=>O(Ln[t],(t=>e===t)))))(n,o)?C.some({value:t,unit:n}):C.none()}));var t,o})))(e);o.each((o=>{const n=o.value/2;Jn(e,n,o.unit),Jn(t,n,o.unit)}))}},Ks=e=>E(e,g(0)),Ys=(e,t,o,n,r)=>r(e.slice(0,t)).concat(n).concat(r(e.slice(o))),Js=e=>(t,o,n,r)=>{if(e(n)){const e=Math.max(r,t[o]-Math.abs(n)),s=Math.abs(e-t[o]);return n>=0?s:-s}return n},Qs=Js((e=>e<0)),Xs=Js(x),Zs=()=>{const e=(e,t,o,n)=>{const r=(100+o)/100,s=Math.max(n,(e[t]+o)/r);return E(e,((e,o)=>(o===t?s:e/r)-e))},t=(t,o,n,r,s,l)=>l?e(t,o,r,s):((e,t,o,n,r)=>{const s=Qs(e,t,n,r);return Ys(e,t,o+1,[s,0],Ks)})(t,o,n,r,s);return{resizeTable:(e,t)=>e(t),clampTableDelta:Qs,calcLeftEdgeDeltas:t,calcMiddleDeltas:(e,o,n,r,s,l,a)=>t(e,n,r,s,l,a),calcRightEdgeDeltas:(t,o,n,r,s,l)=>{if(l)return e(t,n,r,s);{const e=Qs(t,n,r,s);return Ks(t.slice(0,n)).concat([e])}},calcRedestributedWidths:(e,t,o,n)=>{if(n){const n=(t+o)/t,r=E(e,(e=>e/n));return{delta:100*n-100,newSizes:r}}return{delta:o,newSizes:e}}}},el=()=>{const e=(e,t,o,n,r)=>{const s=Xs(e,n>=0?o:t,n,r);return Ys(e,t,o+1,[s,-s],Ks)};return{resizeTable:(e,t,o)=>{o&&e(t)},clampTableDelta:(e,t,o,n,r)=>{if(r){if(o>=0)return o;{const t=A(e,((e,t)=>e+t-n),0);return Math.max(-t,o)}}return Qs(e,t,o,n)},calcLeftEdgeDeltas:e,calcMiddleDeltas:(t,o,n,r,s,l)=>e(t,n,r,s,l),calcRightEdgeDeltas:(e,t,o,n,r,s)=>{if(s)return Ks(e);{const t=n/e.length;return E(e,g(t))}},calcRedestributedWidths:(e,t,o,n)=>({delta:0,newSizes:e})}},tl=e=>Zo(e).grid,ol=ue("th"),nl=e=>P(e,(e=>ol(e.element))),rl=(e,t)=>e&&t?"sectionCells":e?"section":"cells",sl=e=>{const t="thead"===e.section,o=vt(ll(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:rl(t,o)}:{type:"body"}},ll=e=>{const t=_(e,(e=>ol(e.element)));return 0===t.length?C.some("td"):t.length===e.length?C.some("th"):C.none()},al=(e,t,o)=>et(o(e.element,t),!0,e.isLocked),cl=(e,t)=>e.section!==t?tt(e.element,e.cells,t,e.isNew):e,il=()=>({transformRow:cl,transformCell:(e,t,o)=>{const n=o(e.element,t),r="td"!==ne(n)?((e,t)=>{const o=Je(e,"td");je(e,o);const n=Le(e);return $e(o,n),qe(e),o})(n):n;return et(r,e.isNew,e.isLocked)}}),ml=()=>({transformRow:cl,transformCell:al}),dl=()=>({transformRow:(e,t)=>cl(e,"thead"===t?"tbody":t),transformCell:al}),ul=il,fl=ml,gl=dl,hl=()=>({transformRow:h,transformCell:al}),pl=(e,t,o,n)=>{o===n?be(e,t):ge(e,t,o)},wl=(e,t,o)=>{$(mt(e,t)).fold((()=>Pe(e,o)),(e=>je(e,o)))},bl=(e,t)=>{const o=[],n=[],r=e=>E(e,(e=>{e.isNew&&o.push(e.element);const t=e.element;return Ve(t),N(e.cells,(e=>{e.isNew&&n.push(e.element),pl(e.element,"colspan",e.colspan,1),pl(e.element,"rowspan",e.rowspan,1),Ie(t,e.element)})),t})),s=e=>j(e,(e=>E(e.cells,(e=>(pl(e.element,"span",e.colspan,1),e.element))))),l=(t,o)=>{const n=((e,t)=>{const o=pt(e,t).getOrThunk((()=>{const o=xe.fromTag(t,ke(e).dom);return"thead"===t?wl(e,"caption,colgroup",o):"colgroup"===t?wl(e,"caption",o):Ie(e,o),o}));return Ve(o),o})(e,o),l=("colgroup"===o?s:r)(t);$e(n,l)},a=(t,o)=>{t.length>0?l(t,o):(t=>{pt(e,t).each(qe)})(o)},c=[],i=[],m=[],d=[];return N(t,(e=>{switch(e.section){case"thead":c.push(e);break;case"tbody":i.push(e);break;case"tfoot":m.push(e);break;case"colgroup":d.push(e)}})),a(d,"colgroup"),a(c,"thead"),a(i,"tbody"),a(m,"tfoot"),{newRows:o,newCells:n}},vl=(e,t)=>{if(0===e.length)return 0;const o=e[0];return W(e,(e=>!t(o.element,e.element))).getOr(e.length)},yl=(e,t)=>{const o=E(e,(e=>E(e.cells,y)));return E(e,((n,r)=>{const s=j(n.cells,((n,s)=>{if(!1===o[r][s]){const m=((e,t,o,n)=>{const r=((e,t)=>e[t])(e,t),s="colgroup"===r.section,l=vl(r.cells.slice(o),n),a=s?1:vl(((e,t)=>E(e,(e=>Ho(e,t))))(e.slice(t),o),n);return{colspan:l,rowspan:a}})(e,r,s,t);return((e,t,n,r)=>{for(let s=e;s({element:e,cells:t,section:o,isNew:n}))(n.element,s,n.section,n.isNew)}))},xl=(e,t,o)=>{const n=[];N(e.colgroups,(r=>{const s=[];for(let n=0;net(e.element,o,!1))).getOrThunk((()=>et(t.colGap(),!0,!1)));s.push(r)}n.push(tt(r.element,s,"colgroup",o))}));for(let r=0;ret(e.element,o,e.isLocked))).getOrThunk((()=>et(t.gap(),!0,!1)));s.push(l)}const l=e.all[r],a=tt(l.element,s,l.section,o);n.push(a)}return n},Cl=e=>yl(e,Re),Sl=(e,t)=>V(e.all,(e=>L(e.cells,(e=>Re(t,e.element))))),Tl=(e,t,o)=>{const n=E(t.selection,(t=>qt(t).bind((t=>Sl(e,t))).filter(o))),r=yt(n);return xt(r.length>0,r)},Rl=(e,t,o,n,r)=>(s,l,a,c)=>{const i=Zo(s),m=C.from(null==c?void 0:c.section).getOrThunk(hl);return t(i,l).map((t=>{const o=((e,t)=>xl(e,t,!1))(i,a),n=e(o,t,Re,r(a),m),s=Yo(n.grid);return{info:t,grid:Cl(n.grid),cursor:n.cursor,lockedColumns:s}})).bind((e=>{const t=bl(s,e.grid),r=C.from(null==c?void 0:c.sizing).getOrThunk((()=>mr(s))),l=C.from(null==c?void 0:c.resize).getOrThunk(el);return o(s,e.grid,e.info,{sizing:r,resize:l,section:m}),n(s),be(s,Go),e.lockedColumns.length>0&&ge(s,Go,e.lockedColumns.join(",")),C.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})}))},Dl=(e,t)=>Tl(e,t,x).map((e=>({cells:e,generators:t.generators,clipboard:t.clipboard}))),Ol=(e,t)=>Tl(e,t,x),kl=(e,t)=>Tl(e,t,(e=>!e.isLocked)),El=(e,t)=>P(t,(t=>((e,t)=>Sl(e,t).exists((e=>!e.isLocked)))(e,t))),Nl=(e,t,o,n)=>{const r=qo(e).rows;let s=!0;for(let e=0;e{const t=t=>t(e),o=g(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:x,isError:y,map:t=>zl.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>C.some(e)};return r},_l=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:y,isError:x,map:t,mapError:t=>zl.error(t(e)),bind:t,exists:y,forall:x,getOr:h,or:h,getOrThunk:v,orThunk:v,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:f,toOptional:C.none};var n;return o},zl={value:Bl,error:_l,fromOption:(e,t)=>e.fold((()=>_l(t)),Bl)},Al=(e,t)=>({rowDelta:0,colDelta:Vo(e[0])-Vo(t[0])}),Ll=(e,t)=>({rowDelta:e.length-t.length,colDelta:0}),Wl=(e,t,o,n)=>{const r="colgroup"===t.section?o.col:o.cell;return k(e,(e=>et(r(),!0,n(e))))},Ml=(e,t,o,n)=>{const r=e[e.length-1];return e.concat(k(t,(()=>{const e="colgroup"===r.section?o.colgroup:o.row,t=Uo(r,e,h),s=Wl(t.cells.length,t,o,(e=>X(n,e.toString())));return Fo(t,s)})))},jl=(e,t,o,n)=>E(e,(e=>{const r=Wl(t,e,o,y);return jo(e,n,r)})),Pl=(e,t,o)=>{const n=t.colDelta<0?jl:h,r=t.rowDelta<0?Ml:h,s=Yo(e),l=Vo(e[0]),a=O(s,(e=>e===l-1)),c=n(e,Math.abs(t.colDelta),o,a?l-1:l),i=Yo(c);return r(c,Math.abs(t.rowDelta),o,I(i,x))},Il=(e,t,o,n)=>{const r=w(n,Ho(e[t],o).element),s=e[t];return e.length>1&&Vo(s)>1&&(o>0&&r($o(s,o-1))||o0&&r($o(e[t-1],o))||t_(o,(o=>o>=e.column&&o<=Vo(t[0])+e.column)),Hl=(e,t,o,n,r)=>{((e,t,o,n)=>{t>0&&t{const r=e.cells[t-1];let s=0;const l=n();for(;e.cells.length>t+s&&o(r.element,e.cells[t+s].element);)Io(e,t+s,et(l,!0,e.cells[t+s].isLocked)),s++}))})(t,e,r,n.cell);const s=Ll(o,t),l=Pl(o,s,n),a=Ll(t,l),c=Pl(t,a,n);return E(c,((t,o)=>jo(t,e,l[o].cells)))},$l=(e,t,o,n,r)=>{((e,t,o,n)=>{const r=qo(e).rows;if(t>0&&tA(e,((e,o)=>O(e,(e=>t(e.element,o.element)))?e:e.concat([o])),[]))(r[t-1].cells,o);N(e,(e=>{let s=C.none();for(let l=t;l{Io(a,t,et(e,!0,c.isLocked))})))}}))}})(t,e,r,n.cell);const s=Yo(t),l=Al(t,o),a={...l,colDelta:l.colDelta-s.length},c=Pl(t,a,n),{cols:i,rows:m}=qo(c),d=Yo(c),u=Al(o,t),f={...u,colDelta:u.colDelta+d.length},g=(p=n,w=d,E(o,(e=>A(w,((t,o)=>{const n=Wl(1,e,p,x)[0];return Po(t,o,n)}),e)))),h=Pl(g,f,n);var p,w;return[...i,...m.slice(0,e),...h,...m.slice(e,m.length)]},Vl=(e,t,o,n,r)=>{const{rows:s,cols:l}=qo(e),a=s.slice(0,t),c=s.slice(t);return[...l,...a,((e,t,o,n)=>Uo(e,(e=>n(e,o)),t))(s[o],((e,o)=>t>0&&tE(e,(e=>{const s=t>0&&t{if("colgroup"!==o&&n)return Ho(e,t);{const t=Ho(e,r);return et(l(t.element,s),!0,!1)}})(e,t,e.section,s,o,n,r);return Po(e,t,l)})),Ul=(e,t,o,n)=>((e,t,o,n)=>void 0!==$o(e[t],o)&&t>0&&n($o(e[t-1],o),$o(e[t],o)))(e,t,o,n)||((e,t,o)=>t>0&&o($o(e,t-1),$o(e,t)))(e[t],o,n),Gl=(e,t,o,n)=>{const r=e=>(e=>"row"===e?Pt(t):jt(t))(e)?`${e}group`:e;return e?ol(t)?r(o):null:n&&ol(t)?r("row"===o?"col":"row"):null},Kl=(e,t,o)=>et(o(e.element,t),!0,e.isLocked),Yl=(e,t,o,n,r,s,l)=>E(e,((e,a)=>((e,c)=>{const i=e.cells,m=E(i,((e,c)=>{if((e=>O(t,(t=>o(e.element,t.element))))(e)){const t=l(e,a,c)?r(e,o,n):e;return s(t,a,c).each((e=>{var o,n;o=t.element,n={scope:C.from(e)},G(n,((e,t)=>{e.fold((()=>{be(o,t)}),(e=>{fe(o.dom,t,e)}))}))})),t}return e}));return tt(e.element,m,e.section,e.isNew)})(e))),Jl=(e,t,o)=>j(e,((n,r)=>Ul(e,r,t,o)?[]:[Ho(n,t)])),Ql=(e,t,o,n,r)=>{const s=qo(e).rows,l=j(t,(e=>Jl(s,e,n))),a=E(s,(e=>nl(e.cells))),c=((e,t)=>P(t,h)&&nl(e)?x:(e,o,n)=>!("th"===ne(e.element)&&t[o]))(l,a),i=((e,t)=>(o,n)=>C.some(Gl(e,o.element,"row",t[n])))(o,a);return Yl(e,l,n,r,Kl,i,c)},Xl=(e,t,o,n)=>{const r=qo(e).rows,s=E(t,(e=>Ho(r[e.row],e.column)));return Yl(e,s,o,n,Kl,C.none,x)},Zl=e=>{if(!l(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return N(e,((n,r)=>{const s=q(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],c=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!l(c))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==c.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+c.length+" ("+c+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const n=q(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!P(t,(e=>D(n,e))))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:a,params:o})}}}})),o},ea={...Zl([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},ta=(e,t,o)=>{let n=0;for(let r=e;r{const o=rn(e);return E(o,(e=>{const o=ta(e.row,e.row+e.rowspan,t);return{element:e.element,height:o,rowspan:e.rowspan}}))},na=(e,t,o)=>{const n=((e,t)=>ln(e)?((e,t)=>{const o=sn(e);return E(o,((e,o)=>({element:e.element,width:t[o],colspan:e.colspan})))})(e,t):((e,t)=>{const o=rn(e);return E(o,(e=>{const o=ta(e.column,e.column+e.colspan,t);return{element:e.element,width:o,colspan:e.colspan}}))})(e,t))(e,t);N(n,(e=>{o.setElementWidth(e.element,e.width)}))},ra=(e,t,o,n,r)=>{const s=Zo(e),l=r.getCellDelta(t),a=r.getWidths(s,r),c=o===s.grid.columns-1,i=n.clampTableDelta(a,o,l,r.minCellWidth(),c),m=((e,t,o,n,r)=>{const s=e.slice(0),l=((e,t)=>0===e.length?ea.none():1===e.length?ea.only(0):0===t?ea.left(0,1):t===e.length-1?ea.right(t-1,t):t>0&&tn.singleColumnWidth(s[e],o)),((e,t)=>r.calcLeftEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)),((e,t,l)=>r.calcMiddleDeltas(s,e,t,l,o,n.minCellWidth(),n.isRelative)),((e,t)=>r.calcRightEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)))})(a,o,i,r,n),d=E(m,((e,t)=>e+a[t]));na(s,d,r),n.resizeTable(r.adjustTableWidth,i,c)},sa=e=>A(e,((e,t)=>O(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),la=ue("col"),aa=ue("colgroup"),ca=e=>"tr"===ne(e)||aa(e),ia=e=>({element:e,colspan:Wt(e,"colspan",1),rowspan:Wt(e,"rowspan",1)}),ma=e=>we(e,"scope").map((e=>e.substr(0,3))),da=(e,t=ia)=>{const o=o=>{if(ca(o))return aa((r={element:o}).element)?e.colgroup(r):e.row(r);{const r=o,s=(t=>la(t.element)?e.col(t):e.cell(t))(t(r));return n=C.some({item:r,replacement:s}),s}var r};let n=C.none();return{getOrInit:(e,t)=>n.fold((()=>o(e)),(n=>t(e,n.item)?n.replacement:o(e)))}},ua=e=>t=>{const o=[],n=n=>{const r="td"===e?{scope:null}:{},s=t.replace(n,e,r);return o.push({item:n,sub:s}),s};return{replaceOrInit:(e,t)=>{if(ca(e)||la(e))return e;{const r=e;return((e,t)=>L(o,(o=>t(o.item,e))))(r,t).fold((()=>n(r)),(o=>t(e,o.item)?o.sub:n(r)))}}}},fa=e=>({unmerge:t=>{const o=ma(t);return o.each((e=>ge(t,"scope",e))),()=>{const n=e.cell({element:t,colspan:1,rowspan:1});return Lt(n,"width"),Lt(t,"width"),o.each((e=>ge(n,"scope",e))),n}},merge:e=>(Lt(e[0],"width"),(()=>{const t=yt(E(e,ma));if(0===t.length)return C.none();{const e=t[0],o=["row","col"];return O(t,(t=>t!==e&&D(o,t)))?C.none():C.from(e)}})().fold((()=>be(e[0],"scope")),(t=>ge(e[0],"scope",t+"group"))),g(e[0]))}),ga=["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"],ha=hs(),pa=e=>((e,t)=>{const o=e.property().name(t);return D(ga,o)})(ha,e),wa=e=>((e,t)=>{const o=e.property().name(t);return D(["ol","ul"],o)})(ha,e),ba=e=>{const t=ue("br"),o=e=>Cr(e).bind((o=>{const n=Ae(o).map((e=>!!pa(e)||!!((e,t)=>D(["br","img","hr","input"],e.property().name(t)))(ha,e)&&"img"!==ne(e))).getOr(!1);return Ne(o).map((r=>{return!0===n||("li"===ne(s=r)||ft(s,wa).isSome())||t(o)||pa(r)&&!Re(e,r)?[]:[xe.fromTag("br")];var s}))})).getOr([]),n=(()=>{const n=j(e,(e=>{const n=Le(e);return(e=>P(e,(e=>t(e)||ie(e)&&0===hr(e).trim().length)))(n)?[]:n.concat(o(e))}));return 0===n.length?[xe.fromTag("br")]:n})();Ve(e[0]),$e(e[0],n)},va=e=>Qr(e,!0),ya=e=>{0===Ut(e).length&&qe(e)},xa=(e,t)=>({grid:e,cursor:t}),Ca=(e,t,o)=>{const n=((e,t,o)=>{var n,r;const s=qo(e).rows;return C.from(null===(r=null===(n=s[t])||void 0===n?void 0:n.cells[o])||void 0===r?void 0:r.element).filter(va).orThunk((()=>(e=>V(e,(e=>V(e.cells,(e=>{const t=e.element;return xt(va(t),t)})))))(s)))})(e,t,o);return xa(e,n)},Sa=e=>A(e,((e,t)=>O(e,(e=>e.row===t.row))?e:e.concat([t])),[]).sort(((e,t)=>e.row-t.row)),Ta=(e,t)=>(o,n,r,s,l)=>{const a=Sa(n),c=E(a,(e=>e.row)),i=((e,t,o,n,r,s,l)=>{const{cols:a,rows:c}=qo(e),i=c[t[0]],m=j(t,(e=>((e,t,o)=>{const n=e[t];return j(n.cells,((n,r)=>Ul(e,t,r,o)?[]:[n]))})(c,e,r))),d=E(i.cells,((e,t)=>nl(Jl(c,t,r)))),u=[...c];N(t,(e=>{u[e]=l.transformRow(c[e],o)}));const f=[...a,...u],g=((e,t)=>P(t,h)&&nl(e.cells)?x:(e,o,n)=>!("th"===ne(e.element)&&t[n]))(i,d),p=((e,t)=>(o,n,r)=>C.some(Gl(e,o.element,"col",t[r])))(n,d);return Yl(f,m,r,s,l.transformCell,p,g)})(o,c,e,t,r,s.replaceOrInit,l);return Ca(i,n[0].row,n[0].column)},Ra=Ta("thead",!0),Da=Ta("tbody",!1),Oa=Ta("tfoot",!1),ka=(e,t,o)=>{const n=((e,t)=>Qt(e,(()=>t)))(e,o.section),r=en(n);return xl(r,t,!0)},Ea=(e,t,o,n)=>((e,t,o,n)=>{const r=en(t),s=n.getWidths(r,n);na(r,s,n)})(0,t,0,n.sizing),Na=(e,t,o,n)=>((e,t,o,n,r)=>{const s=en(t),l=n.getWidths(s,n),a=n.pixelWidth(),{newSizes:c,delta:i}=r.calcRedestributedWidths(l,a,o.pixelDelta,n.isRelative);na(s,c,n),n.adjustTableWidth(i)})(0,t,o,n.sizing,n.resize),Ba=(e,t)=>O(t,(e=>0===e.column&&e.isLocked)),_a=(e,t)=>O(t,(t=>t.column+t.colspan>=e.grid.columns&&t.isLocked)),za=(e,t)=>{const o=cn(e),n=sa(t);return A(n,((e,t)=>e+o[t.column].map(Wo).getOr(0)),0)},Aa=e=>(t,o)=>Ol(t,o).filter((o=>!(e?Ba:_a)(t,o))).map((e=>({details:e,pixelDelta:za(t,e)}))),La=e=>(t,o)=>Dl(t,o).filter((o=>!(e?Ba:_a)(t,o.cells))),Wa=ua("th"),Ma=ua("td"),ja=Rl(((e,t,o,n)=>{const r=t[0].row,s=Sa(t),l=z(s,((e,t)=>({grid:Vl(e.grid,r,t.row+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return Ca(l,r,t[0].column)}),Ol,f,f,da),Pa=Rl(((e,t,o,n)=>{const r=Sa(t),s=r[r.length-1],l=s.row+s.rowspan,a=z(r,((e,t)=>Vl(e,l,t.row,o,n.getOrInit)),e);return Ca(a,l,t[0].column)}),Ol,f,f,da),Ia=Rl(((e,t,o,n)=>{const r=t.details,s=sa(r),l=s[0].column,a=z(s,((e,t)=>({grid:ql(e.grid,l,t.column+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return Ca(a,r[0].row,l)}),Aa(!0),Na,f,da),Fa=Rl(((e,t,o,n)=>{const r=t.details,s=r[r.length-1],l=s.column+s.colspan,a=sa(r),c=z(a,((e,t)=>ql(e,l,t.column,o,n.getOrInit)),e);return Ca(c,r[0].row,l)}),Aa(!1),Na,f,da),Ha=Rl(((e,t,o,n)=>{const r=sa(t.details),s=((e,t)=>j(e,(e=>{const o=e.cells,n=z(t,((e,t)=>t>=0&&t0?[tt(e.element,n,e.section,e.isNew)]:[]})))(e,E(r,(e=>e.column))),l=s.length>0?s[0].cells.length-1:0;return Ca(s,r[0].row,Math.min(r[0].column,l))}),((e,t)=>kl(e,t).map((t=>({details:t,pixelDelta:-za(e,t)})))),Na,ya,da),$a=Rl(((e,t,o,n)=>{const r=Sa(t),s=((e,t,o)=>{const{rows:n,cols:r}=qo(e);return[...r,...n.slice(0,t),...n.slice(o+1)]})(e,r[0].row,r[r.length-1].row),l=s.length>0?s.length-1:0;return Ca(s,Math.min(t[0].row,l),t[0].column)}),Ol,f,ya,da),Va=Rl(((e,t,o,n)=>{const r=sa(t),s=E(r,(e=>e.column)),l=Ql(e,s,!0,o,n.replaceOrInit);return Ca(l,t[0].row,t[0].column)}),kl,f,f,Wa),qa=Rl(((e,t,o,n)=>{const r=sa(t),s=E(r,(e=>e.column)),l=Ql(e,s,!1,o,n.replaceOrInit);return Ca(l,t[0].row,t[0].column)}),kl,f,f,Ma),Ua=Rl(Ra,kl,f,f,Wa),Ga=Rl(Da,kl,f,f,Ma),Ka=Rl(Oa,kl,f,f,Ma),Ya=Rl(((e,t,o,n)=>{const r=Xl(e,t,o,n.replaceOrInit);return Ca(r,t[0].row,t[0].column)}),kl,f,f,Wa),Ja=Rl(((e,t,o,n)=>{const r=Xl(e,t,o,n.replaceOrInit);return Ca(r,t[0].row,t[0].column)}),kl,f,f,Ma),Qa=Rl(((e,t,o,n)=>{const r=t.cells;ba(r);const s=((e,t,o,n)=>{const r=qo(e).rows;if(0===r.length)return e;for(let e=t.startRow;e<=t.finishRow;e++)for(let o=t.startCol;o<=t.finishCol;o++){const t=r[e],s=Ho(t,o).isLocked;Io(t,o,et(n(),!1,s))}return e})(e,t.bounds,0,n.merge(r));return xa(s,C.from(r[0]))}),((e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>El(e,t.cells)))),Ea,f,fa),Xa=Rl(((e,t,o,n)=>{const r=z(t,((e,t)=>Nl(e,t,o,n.unmerge(t))),e);return xa(r,C.from(t[0]))}),((e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>El(e,t)))),Ea,f,fa),Za=Rl(((e,t,o,n)=>{const r=((e,t)=>{const o=Zo(e);return xl(o,t,!0)})(t.clipboard,t.generators);var s,l;return((e,t,o,n,r)=>{const s=Yo(t),l=((e,t,o)=>{const n=Vo(t[0]),r=qo(t).cols.length+e.row,s=k(n-e.column,(t=>t+e.column));return{row:r,column:L(s,(e=>P(o,(t=>t!==e)))).getOr(n-1)}})(e,t,s),a=qo(o).rows,c=Fl(l,a,s),i=((e,t,o)=>{if(e.row>=t.length||e.column>Vo(t[0]))return zl.error("invalid start address out of table bounds, row: "+e.row+", column: "+e.column);const n=t.slice(e.row),r=n[0].cells.slice(e.column),s=Vo(o[0]),l=o.length;return zl.value({rowDelta:n.length-l,colDelta:r.length-s})})(l,t,a);return i.map((e=>{const o={...e,colDelta:e.colDelta-c.length},s=Pl(t,o,n),i=Yo(s),m=Fl(l,a,i);return((e,t,o,n,r,s)=>{const l=e.row,a=e.column,c=l+o.length,i=a+Vo(o[0])+s.length,m=I(s,x);for(let e=l;exa(e,C.some(t.element))),(e=>Ca(e,t.row,t.column)))}),((e,t)=>qt(t.element).bind((o=>Sl(e,o).map((e=>({...e,generators:t.generators,clipboard:t.clipboard})))))),Ea,f,da),ec=Rl(((e,t,o,n)=>{const r=qo(e).rows,s=t.cells[0].column,l=r[t.cells[0].row],a=ka(t.clipboard,t.generators,l),c=Hl(s,e,a,t.generators,o);return Ca(c,t.cells[0].row,t.cells[0].column)}),La(!0),f,f,da),tc=Rl(((e,t,o,n)=>{const r=qo(e).rows,s=t.cells[t.cells.length-1].column+t.cells[t.cells.length-1].colspan,l=r[t.cells[0].row],a=ka(t.clipboard,t.generators,l),c=Hl(s,e,a,t.generators,o);return Ca(c,t.cells[0].row,t.cells[0].column)}),La(!1),f,f,da),oc=Rl(((e,t,o,n)=>{const r=qo(e).rows,s=t.cells[0].row,l=r[s],a=ka(t.clipboard,t.generators,l),c=$l(s,e,a,t.generators,o);return Ca(c,t.cells[0].row,t.cells[0].column)}),Dl,f,f,da),nc=Rl(((e,t,o,n)=>{const r=qo(e).rows,s=t.cells[t.cells.length-1].row+t.cells[t.cells.length-1].rowspan,l=r[t.cells[0].row],a=ka(t.clipboard,t.generators,l),c=$l(s,e,a,t.generators,o);return Ca(c,t.cells[0].row,t.cells[0].column)}),Dl,f,f,da),rc=(e,t)=>{const o=Zo(e);return Ol(o,t).bind((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=M(E(o.all,(e=>_(e.cells,(e=>e.column>=n&&e.column{const o=Zo(e);return Ol(o,t).bind(ll).getOr("")},lc=(e,t)=>{const o=Zo(e);return Ol(o,t).bind((e=>{const t=e[e.length-1],n=e[0].row,r=t.row+t.rowspan;return(e=>{const t=E(e,(e=>sl(e).type)),o=D(t,"header"),n=D(t,"footer");if(o||n){const e=D(t,"body");return!o||e||n?o||e||!n?C.none():C.some("footer"):C.some("header")}return C.some("body")})(o.all.slice(n,r))})).getOr("")},ac=(e,t)=>e.dispatch("NewRow",{node:t}),cc=(e,t)=>e.dispatch("NewCell",{node:t}),ic=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},mc={structure:!1,style:!0},dc={structure:!0,style:!1},uc={structure:!0,style:!0},fc=(e,t)=>Hr(e)?ur(t):$r(e)?dr(t):mr(t),gc=(e,t,o)=>{const n=e=>"table"===ne(Zr(e)),r=Wr(e),s=Ir(e)?f:Gs,l=t=>{switch(Mr(e)){case"section":return ul();case"sectionCells":return fl();case"cells":return gl();default:return((e,t)=>{var o;switch((o=Zo(e),V(o.all,(e=>{const t=sl(e);return"header"===t.type?C.from(t.subType):C.none()}))).getOr(t)){case"section":return il();case"sectionCells":return ml();case"cells":return dl()}})(t,"section")}},a=(n,s,a,c)=>(i,m,d=!1)=>{ts(i);const u=xe.fromDom(e.getDoc()),f=Br(a,u,r),g={sizing:fc(e,i),resize:Ir(e)?Zs():el(),section:l(i)};return s(i)?n(i,m,f,g).bind((n=>{t.refresh(i.dom),N(n.newRows,(t=>{ac(e,t.dom)})),N(n.newCells,(t=>{cc(e,t.dom)}));const r=((t,n)=>n.cursor.fold((()=>{const n=Ut(t);return H(n).filter(lt).map((n=>{o.clearSelectedCells(t.dom);const r=e.dom.createRng();return r.selectNode(n.dom),e.selection.setRng(r),ge(n,"data-mce-selected","1"),r}))}),(n=>{const r=qs(Us,n),s=e.dom.createRng();return s.setStart(r.element.dom,r.offset),s.setEnd(r.element.dom,r.offset),e.selection.setRng(s),o.clearSelectedCells(t.dom),C.some(s)})))(i,n);return lt(i)&&(ts(i),d||ic(e,i.dom,c)),r.map((e=>({rng:e,effect:c})))})):C.none()},c=a($a,(t=>!n(e)||tl(t).rows>1),f,dc),i=a(Ha,(t=>!n(e)||tl(t).columns>1),f,dc);return{deleteRow:c,deleteColumn:i,insertRowsBefore:a(ja,x,f,dc),insertRowsAfter:a(Pa,x,f,dc),insertColumnsBefore:a(Ia,x,s,dc),insertColumnsAfter:a(Fa,x,s,dc),mergeCells:a(Qa,x,f,dc),unmergeCells:a(Xa,x,f,dc),pasteColsBefore:a(ec,x,f,dc),pasteColsAfter:a(tc,x,f,dc),pasteRowsBefore:a(oc,x,f,dc),pasteRowsAfter:a(nc,x,f,dc),pasteCells:a(Za,x,f,uc),makeCellsHeader:a(Ya,x,f,dc),unmakeCellsHeader:a(Ja,x,f,dc),makeColumnsHeader:a(Va,x,f,dc),unmakeColumnsHeader:a(qa,x,f,dc),makeRowsHeader:a(Ua,x,f,dc),makeRowsBody:a(Ga,x,f,dc),makeRowsFooter:a(Ka,x,f,dc),getTableRowType:lc,getTableCellType:sc,getTableColType:rc}},hc=(e,t,o)=>{const n=Wt(e,t,1);1===o||n<=1?be(e,t):ge(e,t,Math.min(o,n))},pc=(e,t)=>o=>{const n=o.column+o.colspan-1,r=o.column;return n>=e&&r{const n=o.substring(0,o.length-e.length),r=parseFloat(n);return n===r.toString()?t(r):wc.invalid(o)},vc={...wc,from:e=>Rt(e,"%")?bc("%",wc.percent,e):Rt(e,"px")?bc("px",wc.pixels,e):wc.invalid(e)},yc=(e,t,o)=>{const n=vc.from(o),r=P(e,(e=>"0px"===e))?((e,t)=>{const o=e.fold((()=>g("")),(e=>g(e/t+"px")),(()=>g(100/t+"%")));return k(t,o)})(n,e.length):((e,t,o)=>e.fold((()=>t),(e=>((e,t,o)=>{const n=o/t;return E(e,(e=>vc.from(e).fold((()=>e),(e=>e*n+"px"),(e=>e/100*o+"px"))))})(t,o,e)),(e=>((e,t)=>E(e,(e=>vc.from(e).fold((()=>e),(e=>e/t*100+"%"),(e=>e+"%")))))(t,o))))(n,e,t);return Sc(r)},xc=(e,t)=>0===e.length?t:z(e,((e,t)=>vc.from(t).fold(g(0),h,h)+e),0),Cc=(e,t)=>vc.from(e).fold(g(e),(e=>e+t+"px"),(e=>e+t+"%")),Sc=e=>{if(0===e.length)return e;const t=z(e,((e,t)=>{const o=vc.from(t).fold((()=>({value:t,remainder:0})),(e=>((e,t)=>{const o=Math.floor(e);return{value:o+"px",remainder:e-o}})(e)),(e=>({value:e+"%",remainder:0})));return{output:[o.value].concat(e.output),remainder:e.remainder+o.remainder}}),{output:[],remainder:0}),o=t.output;return o.slice(0,o.length-1).concat([Cc(o[o.length-1],Math.round(t.remainder))])},Tc=vc.from,Rc=e=>Tc(e).fold(g("px"),g("px"),g("%")),Dc=(e,t,o)=>{const n=Zo(e),r=n.all,s=rn(n),l=sn(n);t.each((t=>{const o=Rc(t),r=Lo(e),a=((e,t)=>nr(e,t,er,rr))(n,e),c=yc(a,r,t);ln(n)?((e,t,o)=>{N(t,((t,n)=>{const r=xc([e[n]],Ft());Nt(t.element,"width",r+o)}))})(c,l,o):((e,t,o)=>{N(t,(t=>{const n=e.slice(t.column,t.colspan+t.column),r=xc(n,Ft());Nt(t.element,"width",r+o)}))})(c,s,o),Nt(e,"width",t)})),o.each((t=>{const o=Rc(t),l=hn(e),a=((e,t,o)=>lr(e,t,o,tr,rr))(n,e,_n);((e,t,o,n)=>{N(o,(t=>{const o=e.slice(t.row,t.rowspan+t.row),r=xc(o,Ht());Nt(t.element,"height",r+n)})),N(t,((t,o)=>{Nt(t.element,"height",e[o])}))})(yc(a,l,t),r,s,o),Nt(e,"height",t)}))},Oc=e=>Un(e).exists((e=>Mn.test(e))),kc=e=>Un(e).exists((e=>jn.test(e))),Ec=e=>Un(e).isNone(),Nc=e=>{be(e,"width")},Bc=e=>{const t=Qn(e);Dc(e,C.some(t),C.none()),Nc(e)},_c=e=>{const t=(e=>Lo(e)+"px")(e);Dc(e,C.some(t),C.none()),Nc(e)},zc=e=>{Lt(e,"width");const t=Gt(e),o=t.length>0?t:Ut(e);N(o,(e=>{Lt(e,"width"),Nc(e)})),Nc(e)},Ac={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},colGroups:!1},Lc=(e,t,o,n)=>k(e,(e=>((e,t,o,n)=>{const r=xe.fromTag("tr");for(let s=0;s{e.selection.select(t.dom,!0),e.selection.collapse(!0)},Mc=(e,t,o,n,s)=>{const l=(e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>Vr(e)||!Ur(e)?t:$r(e)?{...t,width:Lr(e)}:{...t,width:Ar})(e,o)})(e),a={styles:l,attributes:Kr(e),colGroups:Yr(e)};return e.undoManager.ignore((()=>{const r=((e,t,o,n,r,s=Ac)=>{const l=xe.fromTag("table"),a="cells"!==r;Bt(l,s.styles),he(l,s.attributes),s.colGroups&&Ie(l,(e=>{const t=xe.fromTag("colgroup");return k(e,(()=>Ie(t,xe.fromTag("col")))),t})(t));const c=Math.min(e,o);if(a&&o>0){const e=xe.fromTag("thead");Ie(l,e);const s=Lc(o,t,"sectionCells"===r?c:0,n);$e(e,s)}const i=xe.fromTag("tbody");Ie(l,i);const m=Lc(a?e-c:e,t,a?0:o,n);return $e(i,m),l})(o,t,s,n,Mr(e),a);ge(r,"data-mce-id","__mce");const l=(e=>{const t=xe.fromTag("div"),o=xe.fromDom(e.dom.cloneNode(!0));return Ie(t,o),(e=>e.dom.innerHTML)(t)})(r);e.insertContent(l),e.addVisual()})),wt(Zr(e),'table[data-mce-id="__mce"]').map((t=>($r(e)?_c(t):Vr(e)?zc(t):(Hr(e)||(e=>r(e)&&-1!==e.indexOf("%"))(l.width))&&Bc(t),ts(t),be(t,"data-mce-id"),((e,t)=>{N(dt(t,"tr"),(t=>{ac(e,t.dom),N(dt(t,"th,td"),(t=>{cc(e,t.dom)}))}))})(e,t),((e,t)=>{wt(t,"td,th").each(w(Wc,e))})(e,t),t.dom))).getOrNull()};var jc=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const Pc="x-tinymce/dom-table-",Ic=Pc+"rows",Fc=Pc+"columns",Hc=e=>{const t=jc.FakeClipboardItem(e);jc.write([t])},$c=e=>{var t;const o=null!==(t=jc.read())&&void 0!==t?t:[];return V(o,(t=>C.from(t.getType(e))))},Vc=e=>{$c(e).isSome()&&jc.clear()},qc=e=>{e.fold(Gc,(e=>Hc({[Ic]:e})))},Uc=()=>$c(Ic),Gc=()=>Vc(Ic),Kc=e=>{e.fold(Jc,(e=>Hc({[Fc]:e})))},Yc=()=>$c(Fc),Jc=()=>Vc(Fc),Qc=e=>Ms(os(e),es(e)).filter(ss),Xc=(e,t)=>{const o=es(e),n=e=>Kt(e,o),l=t=>(e=>js(os(e),es(e)).filter(ss))(e).bind((e=>n(e).map((o=>t(o,e))))),a=t=>{e.focus()},c=(t,o=!1)=>l(((n,r)=>{const s=Ls(Ps(e),n,r);t(n,s,o).each(a)})),i=()=>l(((t,o)=>((e,t,o)=>{const n=Zo(e);return Ol(n,t).bind((e=>{const t=xl(n,o,!1),r=qo(t).rows.slice(e[0].row,e[e.length-1].row+e[e.length-1].rowspan),s=j(r,(e=>{const t=_(e.cells,(e=>!e.isLocked));return t.length>0?[{...e,cells:t}]:[]})),l=Cl(s);return xt(l.length>0,l)})).map((e=>E(e,(e=>{const t=Ke(e.element);return N(e.cells,(e=>{const o=Ye(e.element);pl(o,"colspan",e.colspan,1),pl(o,"rowspan",e.rowspan,1),Ie(t,o)})),t}))))})(t,Ls(Ps(e),t,o),Br(f,xe.fromDom(e.getDoc()),C.none())))),m=()=>l(((t,o)=>((e,t)=>{const o=Zo(e);return kl(o,t).map((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=((e,t,o)=>{if(ln(e)){const n=_(sn(e),pc(t,o)),r=E(n,(e=>{const n=Ye(e.element);return hc(n,"span",o-t),n})),s=xe.fromTag("colgroup");return $e(s,r),[s]}return[]})(o,n,r),l=((e,t,o)=>E(e.all,(e=>{const n=_(e.cells,pc(t,o)),r=E(n,(e=>{const n=Ye(e.element);return hc(n,"colspan",o-t),n})),s=xe.fromTag("tr");return $e(s,r),s})))(o,n,r);return[...s,...l]}))})(t,Ls(Ps(e),t,o)))),d=(t,o)=>o().each((o=>{const n=E(o,(e=>Ye(e)));l(((o,r)=>{const s=_r(xe.fromDom(e.getDoc())),l=((e,t,o,n)=>({selection:Os(e),clipboard:o,generators:n}))(Ps(e),0,n,s);t(o,l).each(a)}))})),g=e=>(t,o)=>((e,t)=>X(e,t)?C.from(e[t]):C.none())(o,"type").each((t=>{c(e(t),o.no_events)}));G({mceTableSplitCells:()=>c(t.unmergeCells),mceTableMergeCells:()=>c(t.mergeCells),mceTableInsertRowBefore:()=>c(t.insertRowsBefore),mceTableInsertRowAfter:()=>c(t.insertRowsAfter),mceTableInsertColBefore:()=>c(t.insertColumnsBefore),mceTableInsertColAfter:()=>c(t.insertColumnsAfter),mceTableDeleteCol:()=>c(t.deleteColumn),mceTableDeleteRow:()=>c(t.deleteRow),mceTableCutCol:()=>m().each((e=>{Kc(e),c(t.deleteColumn)})),mceTableCutRow:()=>i().each((e=>{qc(e),c(t.deleteRow)})),mceTableCopyCol:()=>m().each((e=>Kc(e))),mceTableCopyRow:()=>i().each((e=>qc(e))),mceTablePasteColBefore:()=>d(t.pasteColsBefore,Yc),mceTablePasteColAfter:()=>d(t.pasteColsAfter,Yc),mceTablePasteRowBefore:()=>d(t.pasteRowsBefore,Uc),mceTablePasteRowAfter:()=>d(t.pasteRowsAfter,Uc),mceTableDelete:()=>Qc(e).each((t=>{Kt(t,o).filter(b(o)).each((t=>{const o=xe.fromText("");if(je(t,o),qe(t),e.dom.isEmpty(e.getBody()))e.setContent(""),e.selection.setCursorLocation();else{const t=e.dom.createRng();t.setStart(o.dom,0),t.setEnd(o.dom,0),e.selection.setRng(t),e.nodeChanged()}}))})),mceTableCellToggleClass:(t,o)=>{l((t=>{const n=Ps(e),r=P(n,(t=>e.formatter.match("tablecellclass",{value:o},t.dom))),s=r?e.formatter.remove:e.formatter.apply;N(n,(e=>s("tablecellclass",{value:o},e.dom))),ic(e,t.dom,mc)}))},mceTableToggleClass:(t,o)=>{l((t=>{e.formatter.toggle("tableclass",{value:o},t.dom),ic(e,t.dom,mc)}))},mceTableToggleCaption:()=>{Qc(e).each((t=>{Kt(t,o).each((o=>{pt(o,"caption").fold((()=>{const t=xe.fromTag("caption");Ie(t,xe.fromText("Caption")),((e,t,o)=>{We(e,0).fold((()=>{Ie(e,t)}),(e=>{Me(e,t)}))})(o,t),e.selection.setCursorLocation(t.dom,0)}),(n=>{ue("caption")(t)&&Te("td",o).each((t=>e.selection.setCursorLocation(t.dom,0))),qe(n)})),ic(e,o.dom,dc)}))}))},mceTableSizingMode:(t,n)=>(t=>Qc(e).each((n=>{Vr(e)||$r(e)||Hr(e)||Kt(n,o).each((o=>{"relative"!==t||Oc(o)?"fixed"!==t||kc(o)?"responsive"!==t||Ec(o)||zc(o):_c(o):Bc(o),ts(o),ic(e,o.dom,dc)}))})))(n),mceTableCellType:g((e=>"th"===e?t.makeCellsHeader:t.unmakeCellsHeader)),mceTableColType:g((e=>"th"===e?t.makeColumnsHeader:t.unmakeColumnsHeader)),mceTableRowType:g((e=>{switch(e){case"header":return t.makeRowsHeader;case"footer":return t.makeRowsFooter;default:return t.makeRowsBody}}))},((t,o)=>e.addCommand(o,t))),e.addCommand("mceInsertTable",((t,o)=>{((e,t,o,n={})=>{const r=e=>u(e)&&e>0;if(r(t)&&r(o)){const r=n.headerRows||0,s=n.headerColumns||0;return Mc(e,o,t,s,r)}console.error("Invalid values for mceInsertTable - rows and columns values are required to insert a table.")})(e,o.rows,o.columns,o.options)})),e.addCommand("mceTableApplyCellStyle",((t,o)=>{const l=e=>"tablecell"+e.toLowerCase().replace("-","");if(!s(o))return;const a=_(Ps(e),ss);if(0===a.length)return;const c=((e,t)=>{const o={};return((e,t,o,n)=>{G(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))})(e,t,(e=>(t,o)=>{e[o]=t})(o),f),o})(o,((t,o)=>e.formatter.has(l(o))&&r(t)));(e=>{for(const t in e)if(U.call(e,t))return!1;return!0})(c)||(G(c,((t,o)=>{const n=l(o);N(a,(o=>{""===t?e.formatter.remove(n,{value:null},o.dom,!0):e.formatter.apply(n,{value:t},o.dom)}))})),n(a[0]).each((t=>ic(e,t.dom,mc))))}))},Zc=Zl([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),ei={before:Zc.before,on:Zc.on,after:Zc.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(h,h,h)},ti=(e,t)=>({selection:e,kill:t}),oi=(e,t)=>{const o=e.document.createRange();return o.selectNode(t.dom),o},ni=(e,t)=>{const o=e.document.createRange();return ri(o,t),o},ri=(e,t)=>e.selectNodeContents(t.dom),si=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,o)=>{e.setEnd(t.dom,o)}),(t=>{e.setEndAfter(t.dom)}))})(n,o),n},li=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},ai=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),ci=Zl([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),ii=(e,t,o)=>t(xe.fromDom(o.startContainer),o.startOffset,xe.fromDom(o.endContainer),o.endOffset),mi=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:g(e),rtl:C.none}),relative:(t,o)=>({ltr:eo((()=>si(e,t,o))),rtl:eo((()=>C.some(si(e,o,t))))}),exact:(t,o,n,r)=>({ltr:eo((()=>li(e,t,o,n,r))),rtl:eo((()=>C.some(li(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>ci.rtl(xe.fromDom(e.endContainer),e.endOffset,xe.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>ii(0,ci.ltr,o))):ii(0,ci.ltr,o)})(0,o)},di=(e,t)=>mi(e,t).match({ltr:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},rtl:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(n.dom,r),s.setEnd(t.dom,o),s}});ci.ltr,ci.rtl;const ui=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),fi=(e,t,o,n)=>({start:ei.on(e,t),finish:ei.on(o,n)}),gi=(e,t)=>{const o=di(e,t);return ui(xe.fromDom(o.startContainer),o.startOffset,xe.fromDom(o.endContainer),o.endOffset)},hi=fi,pi=(e,t,o,n,r)=>Re(o,n)?C.none():xs(o,n,t).bind((t=>{const n=t.boxes.getOr([]);return n.length>1?(r(e,n,t.start,t.finish),C.some(ti(C.some(hi(o,0,o,br(o))),!0))):C.none()})),wi=(e,t)=>({item:e,mode:t}),bi=(e,t,o,n=vi)=>e.property().parent(t).map((e=>wi(e,n))),vi=(e,t,o,n=yi)=>o.sibling(e,t).map((e=>wi(e,n))),yi=(e,t,o,n=yi)=>{const r=e.property().children(t);return o.first(r).map((e=>wi(e,n)))},xi=[{current:bi,next:vi,fallback:C.none()},{current:vi,next:yi,fallback:C.some(bi)},{current:yi,next:yi,fallback:C.some(vi)}],Ci=(e,t,o,n,r=xi)=>L(r,(e=>e.current===o)).bind((o=>o.current(e,t,n,o.next).orThunk((()=>o.fallback.bind((o=>Ci(e,t,o,n))))))),Si=(e,t,o,n,r,s)=>Ci(e,t,n,r).bind((t=>s(t.item)?C.none():o(t.item)?C.some(t.item):Si(e,t.item,o,t.mode,r,s))),Ti=e=>t=>0===e.property().children(t).length,Ri=(e,t,o,n)=>Si(e,t,o,vi,{sibling:(e,t)=>e.query().prevSibling(t),first:e=>e.length>0?C.some(e[e.length-1]):C.none()},n),Di=(e,t,o,n)=>Si(e,t,o,vi,{sibling:(e,t)=>e.query().nextSibling(t),first:e=>e.length>0?C.some(e[0]):C.none()},n),Oi=hs(),ki=(e,t)=>((e,t,o)=>Ri(e,t,Ti(e),o))(Oi,e,t),Ei=(e,t)=>((e,t,o)=>Di(e,t,Ti(e),o))(Oi,e,t),Ni=Zl([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),Bi=e=>bt(e,"tr"),_i={...Ni,verify:(e,t,o,n,r,s,l)=>bt(n,"td,th",l).bind((o=>bt(t,"td,th",l).map((t=>Re(o,t)?Re(n,o)&&br(o)===r?s(t):Ni.none("in same cell"):vs(Bi,[o,t]).fold((()=>((e,t,o)=>{const n=e.getRect(t),r=e.getRect(o);return r.right>n.left&&r.lefts(t))))))).getOr(Ni.none("default")),cata:(e,t,o,n,r)=>e.fold(t,o,n,r)},zi=ue("br"),Ai=(e,t,o)=>t(e,o).bind((e=>ie(e)&&0===hr(e).trim().length?Ai(e,t,o):C.some(e))),Li=(e,t,o,n)=>((e,t)=>We(e,t).filter(zi).orThunk((()=>We(e,t-1).filter(zi))))(t,o).bind((t=>n.traverse(t).fold((()=>Ai(t,n.gather,e).map(n.relative)),(e=>(e=>Ne(e).bind((t=>{const o=Le(t);return((e,t)=>W(e,w(Re,t)))(o,e).map((n=>((e,t,o,n)=>({parent:e,children:t,element:o,index:n}))(t,o,e,n)))})))(e).map((e=>ei.on(e.parent,e.index))))))),Wi=(e,t)=>({left:e.left,top:e.top+t,right:e.right,bottom:e.bottom+t}),Mi=(e,t)=>({left:e.left,top:e.top-t,right:e.right,bottom:e.bottom-t}),ji=(e,t,o)=>({left:e.left+t,top:e.top+o,right:e.right+t,bottom:e.bottom+o}),Pi=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),Ii=(e,t)=>C.some(e.getRect(t)),Fi=(e,t,o)=>ce(t)?Ii(e,t).map(Pi):ie(t)?((e,t,o)=>o>=0&&o0?e.getRangedRect(t,o-1,t,o):C.none())(e,t,o).map(Pi):C.none(),Hi=(e,t)=>ce(t)?Ii(e,t).map(Pi):ie(t)?e.getRangedRect(t,0,t,br(t)).map(Pi):C.none(),$i=Zl([{none:[]},{retry:["caret"]}]),Vi=(e,t,o)=>gt(t,pa).fold(y,(t=>Hi(e,t).exists((e=>((e,t)=>e.leftt.right)(o,e))))),qi={point:e=>e.bottom,adjuster:(e,t,o,n,r)=>{const s=Wi(r,5);return Math.abs(o.bottom-n.bottom)<1||o.top>r.bottom?$i.retry(s):o.top===r.bottom?$i.retry(Wi(r,1)):Vi(e,t,r)?$i.retry(ji(s,5,0)):$i.none()},move:Wi,gather:Ei},Ui=(e,t,o,n,r)=>0===r?C.some(n):((e,t,o)=>e.elementFromPoint(t,o).filter((e=>"table"===ne(e))).isSome())(e,n.left,t.point(n))?((e,t,o,n,r)=>Ui(e,t,o,t.move(n,5),r))(e,t,o,n,r-1):e.situsFromPoint(n.left,t.point(n)).bind((s=>s.start.fold(C.none,(s=>Hi(e,s).bind((l=>t.adjuster(e,s,l,o,n).fold(C.none,(n=>Ui(e,t,o,n,r-1))))).orThunk((()=>C.some(n)))),C.none))),Gi=(e,t,o)=>{const n=e.move(o,5),r=Ui(t,e,o,n,100).getOr(n);return((e,t,o)=>e.point(t)>o.getInnerHeight()?C.some(e.point(t)-o.getInnerHeight()):e.point(t)<0?C.some(-e.point(t)):C.none())(e,r,t).fold((()=>t.situsFromPoint(r.left,e.point(r))),(o=>(t.scrollBy(0,o),t.situsFromPoint(r.left,e.point(r)-o))))},Ki={tryUp:w(Gi,{point:e=>e.top,adjuster:(e,t,o,n,r)=>{const s=Mi(r,5);return Math.abs(o.top-n.top)<1||o.bottome.getSelection().bind((n=>((e,t,o,n)=>{const r=zi(t)?((e,t,o)=>o.traverse(t).orThunk((()=>Ai(t,o.gather,e))).map(o.relative))(e,t,n):Li(e,t,o,n);return r.map((e=>({start:e,finish:e})))})(t,n.finish,n.foffset,o).fold((()=>C.some(Fs(n.finish,n.foffset))),(r=>{const s=e.fromSitus(r);return l=_i.verify(e,n.finish,n.foffset,s.finish,s.foffset,o.failure,t),_i.cata(l,(e=>C.none()),(()=>C.none()),(e=>C.some(Fs(e,0))),(e=>C.some(Fs(e,br(e)))));var l})))),Ji=(e,t,o,n,r,s)=>0===s?C.none():Zi(e,t,o,n,r).bind((l=>{const a=e.fromSitus(l),c=_i.verify(e,o,n,a.finish,a.foffset,r.failure,t);return _i.cata(c,(()=>C.none()),(()=>C.some(l)),(l=>Re(o,l)&&0===n?Qi(e,o,n,Mi,r):Ji(e,t,l,0,r,s-1)),(l=>Re(o,l)&&n===br(l)?Qi(e,o,n,Wi,r):Ji(e,t,l,br(l),r,s-1)))})),Qi=(e,t,o,n,r)=>Fi(e,t,o).bind((t=>Xi(e,r,n(t,Ki.getJumpSize())))),Xi=(e,t,o)=>{const n=Bo().browser;return n.isChromium()||n.isSafari()||n.isFirefox()?t.retry(e,o):C.none()},Zi=(e,t,o,n,r)=>Fi(e,o,n).bind((t=>Xi(e,r,t))),em=(e,t,o,n,r)=>bt(n,"td,th",t).bind((n=>bt(n,"table",t).bind((s=>((e,t)=>ft(e,(e=>Ne(e).exists((e=>Re(e,t)))),void 0).isSome())(r,s)?((e,t,o)=>Yi(e,t,o).bind((n=>Ji(e,t,n.element,n.offset,o,20).map(e.fromSitus))))(e,t,o).bind((e=>bt(e.finish,"td,th",t).map((t=>({start:n,finish:t,range:e}))))):C.none())))),tm=(e,t,o,n,r,s)=>s(n,t).orThunk((()=>em(e,t,o,n,r).map((e=>{const t=e.range;return ti(C.some(hi(t.start,t.soffset,t.finish,t.foffset)),!0)})))),om=(e,t)=>bt(e,"tr",t).bind((e=>bt(e,"table",t).bind((o=>{const n=dt(o,"tr");return Re(e,n[0])?((e,t,o)=>Ri(Oi,e,(e=>Cr(e).isSome()),o))(o,0,t).map((e=>{const t=br(e);return ti(C.some(hi(e,t,e,t)),!0)})):C.none()})))),nm=(e,t)=>bt(e,"tr",t).bind((e=>bt(e,"table",t).bind((o=>{const n=dt(o,"tr");return Re(e,n[n.length-1])?((e,t,o)=>Di(Oi,e,(e=>xr(e).isSome()),o))(o,0,t).map((e=>ti(C.some(hi(e,0,e,0)),!0))):C.none()})))),rm=(e,t,o,n,r,s,l)=>em(e,o,n,r,s).bind((e=>pi(t,o,e.start,e.finish,l))),sm=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},lm=()=>{const e=(e=>{const t=sm(C.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(C.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(C.some(e))}}})(f);return{...e,on:t=>e.get().each(t)}},am=(e,t)=>bt(e,"td,th",t),cm=e=>Be(e).exists(Qr),im={traverse:Ae,gather:Ei,relative:ei.before,retry:Ki.tryDown,failure:_i.failedDown},mm={traverse:ze,gather:ki,relative:ei.before,retry:Ki.tryUp,failure:_i.failedUp},dm=e=>t=>t===e,um=dm(38),fm=dm(40),gm=e=>e>=37&&e<=40,hm={isBackward:dm(37),isForward:dm(39)},pm={isBackward:dm(39),isForward:dm(37)},wm=Zl([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),bm={domRange:wm.domRange,relative:wm.relative,exact:wm.exact,exactFromRange:e=>wm.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>xe.fromDom(e.startContainer),relative:(e,t)=>ei.getStart(e),exact:(e,t,o,n)=>e}))(e);return xe.fromDom(Ee(t).dom.defaultView)},range:ui},vm=document.caretPositionFromPoint?(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(n,t,o)).bind((t=>{if(null===t.offsetNode)return C.none();const o=e.dom.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),C.some(o)}))}:document.caretRangeFromPoint?(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(n,t,o))}:C.none,ym=(e,t)=>{const o=ne(e);return"input"===o?ei.after(e):D(["br","img"],o)?0===t?ei.before(e):ei.after(e):ei.on(e,t)},xm=e=>C.from(e.getSelection()),Cm=(e,t)=>{xm(e).each((e=>{e.removeAllRanges(),e.addRange(t)}))},Sm=(e,t,o,n,r)=>{const s=li(e,t,o,n,r);Cm(e,s)},Tm=(e,t)=>mi(e,t).match({ltr:(t,o,n,r)=>{Sm(e,t,o,n,r)},rtl:(t,o,n,r)=>{xm(e).each((s=>{if(s.setBaseAndExtent)s.setBaseAndExtent(t.dom,o,n.dom,r);else if(s.extend)try{((e,t,o,n,r,s)=>{t.collapse(o.dom,n),t.extend(r.dom,s)})(0,s,t,o,n,r)}catch(s){Sm(e,n,r,t,o)}else Sm(e,n,r,t,o)}))}}),Rm=(e,t,o,n,r)=>{const s=((e,t,o,n)=>{const r=ym(e,t),s=ym(o,n);return bm.relative(r,s)})(t,o,n,r);Tm(e,s)},Dm=(e,t,o)=>{const n=((e,t)=>{const o=e.fold(ei.before,ym,ei.after),n=t.fold(ei.before,ym,ei.after);return bm.relative(o,n)})(t,o);Tm(e,n)},Om=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return C.some(ui(xe.fromDom(t.startContainer),t.startOffset,xe.fromDom(o.endContainer),o.endOffset))}return C.none()},km=e=>{if(null===e.anchorNode||null===e.focusNode)return Om(e);{const t=xe.fromDom(e.anchorNode),o=xe.fromDom(e.focusNode);return((e,t,o,n)=>{const r=((e,t,o,n)=>{const r=ke(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),s=Re(e,o)&&t===n;return r.collapsed&&!s})(t,e.anchorOffset,o,e.focusOffset)?C.some(ui(t,e.anchorOffset,o,e.focusOffset)):Om(e)}},Em=(e,t,o=!0)=>{const n=(o?ni:oi)(e,t);Cm(e,n)},Nm=e=>(e=>xm(e).filter((e=>e.rangeCount>0)).bind(km))(e).map((e=>bm.exact(e.start,e.soffset,e.finish,e.foffset))),Bm=e=>({elementFromPoint:(t,o)=>xe.fromPoint(xe.fromDom(e.document),t,o),getRect:e=>e.dom.getBoundingClientRect(),getRangedRect:(t,o,n,r)=>{const s=bm.exact(t,o,n,r);return((e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?C.some(o).map(ai):C.none()})(di(e,t)))(e,s)},getSelection:()=>Nm(e).map((t=>gi(e,t))),fromSitus:t=>{const o=bm.relative(t.start,t.finish);return gi(e,o)},situsFromPoint:(t,o)=>((e,t,o)=>((e,t,o)=>{const n=xe.fromDom(e.document);return vm(n,t,o).map((e=>ui(xe.fromDom(e.startContainer),e.startOffset,xe.fromDom(e.endContainer),e.endOffset)))})(e,t,o))(e,t,o).map((e=>fi(e.start,e.soffset,e.finish,e.foffset))),clearSelection:()=>{(e=>{xm(e).each((e=>e.removeAllRanges()))})(e)},collapseSelection:(t=!1)=>{Nm(e).each((o=>o.fold((e=>e.collapse(t)),((o,n)=>{const r=t?o:n;Dm(e,r,r)}),((o,n,r,s)=>{const l=t?o:r,a=t?n:s;Rm(e,l,a,l,a)}))))},setSelection:t=>{Rm(e,t.start,t.soffset,t.finish,t.foffset)},setRelativeSelection:(t,o)=>{Dm(e,t,o)},selectNode:t=>{Em(e,t,!1)},selectContents:t=>{Em(e,t)},getInnerHeight:()=>e.innerHeight,getScrollY:()=>(e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return bn(o,n)})(xe.fromDom(e.document)).top,scrollBy:(t,o)=>{((e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollBy(e,t)})(t,o,xe.fromDom(e.document))}}),_m=(e,t)=>({rows:e,cols:t}),zm=e=>gt(e,ae).exists(Qr),Am=(e,t)=>zm(e)||zm(t),Lm=e=>void 0!==e.dom.classList,Wm=(e,t)=>((e,t,o)=>{const n=((e,t)=>{const o=pe(e,t);return void 0===o||""===o?[]:o.split(" ")})(e,t).concat([o]);return ge(e,t,n.join(" ")),!0})(e,"class",t),Mm=(e,t)=>{Lm(e)?e.dom.classList.add(t):Wm(e,t)},jm=(e,t)=>Lm(e)&&e.dom.classList.contains(t),Pm=()=>({tag:"none"}),Im=e=>({tag:"multiple",elements:e}),Fm=e=>({tag:"single",element:e}),Hm=e=>{const t=xe.fromDom((e=>{if(nt()&&m(e.target)){const t=xe.fromDom(e.target);if(ce(t)&&m(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return H(t)}}return C.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=(s=n,l=o,(...e)=>s(l.apply(null,e)));var s,l;return((e,t,o,n,r,s,l)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:l}))(t,e.clientX,e.clientY,o,n,r,e)},$m=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Vm=x,qm=(e,t,o)=>((e,t,o,n)=>((e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(Hm(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:w($m,e,t,s,r)}})(e,t,o,n,!1))(e,t,Vm,o),Um=Hm,Gm=e=>!jm(xe.fromDom(e.target),"ephox-snooker-resizer-bar"),Km=(e,t)=>{const o=(r=As.selectedSelector,{get:()=>Rs(xe.fromDom(e.getBody()),r).fold((()=>js(os(e),es(e)).fold(Pm,Fm)),Im)}),n=((e,t,o)=>{const n=t=>{be(t,e.selected),be(t,e.firstSelected),be(t,e.lastSelected)},r=t=>{ge(t,e.selected,"1")},s=e=>{l(e),o()},l=t=>{const o=dt(t,`${e.selectedSelector},${e.firstSelectedSelector},${e.lastSelectedSelector}`);N(o,n)};return{clearBeforeUpdate:l,clear:s,selectRange:(o,n,l,a)=>{s(o),N(n,r),ge(l,e.firstSelected,"1"),ge(a,e.lastSelected,"1"),t(n,l,a)},selectedSelector:e.selectedSelector,firstSelectedSelector:e.firstSelectedSelector,lastSelectedSelector:e.lastSelectedSelector}})(As,((t,o,n)=>{Kt(o).each((r=>{const s=Wr(e),l=Br(f,xe.fromDom(e.getDoc()),s),a=((e,t,o)=>{const n=Zo(e);return Ol(n,t).map((e=>{const t=xl(n,o,!1),{rows:r}=qo(t),s=((e,t)=>{const o=e.slice(0,t[t.length-1].row+1),n=Cl(o);return j(n,(e=>{const o=e.cells.slice(0,t[t.length-1].column+1);return E(o,(e=>e.element))}))})(r,e),l=((e,t)=>{const o=e.slice(t[0].row+t[0].rowspan-1,e.length),n=Cl(o);return j(n,(e=>{const o=e.cells.slice(t[0].column+t[0].colspan-1,e.cells.length);return E(o,(e=>e.element))}))})(r,e);return{upOrLeftCells:s,downOrRightCells:l}}))})(r,{selection:Ps(e)},l);((e,t,o,n,r)=>{e.dispatch("TableSelectionChange",{cells:t,start:o,finish:n,otherCells:r})})(e,t,o,n,a)}))}),(()=>(e=>{e.dispatch("TableSelectionClear")})(e)));var r;return e.on("init",(o=>{const r=e.getWin(),s=Zr(e),l=es(e),a=((e,t,o,n)=>{const r=((e,t,o,n)=>{const r=lm(),s=r.clear,l=s=>{r.on((r=>{n.clearBeforeUpdate(t),am(s.target,o).each((l=>{xs(r,l,o).each((o=>{const r=o.boxes.getOr([]);if(1===r.length){const o=r[0],l="false"===Xr(o),a=vt(Jr(s.target),o,Re);l&&a&&(n.selectRange(t,r,o,o),e.selectContents(o))}else r.length>1&&(n.selectRange(t,r,o.start,o.finish),e.selectContents(l))}))}))}))};return{clearstate:s,mousedown:e=>{n.clear(t),am(e.target,o).filter(cm).each(r.set)},mouseover:e=>{l(e)},mouseup:e=>{l(e),s()}}})(Bm(e),t,o,n);return{clearstate:r.clearstate,mousedown:r.mousedown,mouseover:r.mouseover,mouseup:r.mouseup}})(r,s,l,n),c=((e,t,o,n)=>{const r=Bm(e),s=()=>(n.clear(t),C.none());return{keydown:(e,l,a,c,i,m)=>{const d=e.raw,u=d.which,f=!0===d.shiftKey,g=Cs(t,n.selectedSelector).fold((()=>(gm(u)&&!f&&n.clearBeforeUpdate(t),gm(u)&&f&&!Am(l,c)?C.none:fm(u)&&f?w(rm,r,t,o,im,c,l,n.selectRange):um(u)&&f?w(rm,r,t,o,mm,c,l,n.selectRange):fm(u)?w(tm,r,o,im,c,l,nm):um(u)?w(tm,r,o,mm,c,l,om):C.none)),(e=>{const o=o=>()=>{const s=V(o,(o=>((e,t,o,n,r)=>Ts(n,e,t,r.firstSelectedSelector,r.lastSelectedSelector).map((e=>(r.clearBeforeUpdate(o),r.selectRange(o,e.boxes,e.start,e.finish),e.boxes))))(o.rows,o.cols,t,e,n)));return s.fold((()=>Ss(t,n.firstSelectedSelector,n.lastSelectedSelector).map((e=>{const o=fm(u)||m.isForward(u)?ei.after:ei.before;return r.setRelativeSelection(ei.on(e.first,0),o(e.table)),n.clear(t),ti(C.none(),!0)}))),(e=>C.some(ti(C.none(),!0))))};return gm(u)&&f&&!Am(l,c)?C.none:fm(u)&&f?o([_m(1,0)]):um(u)&&f?o([_m(-1,0)]):m.isBackward(u)&&f?o([_m(0,-1),_m(-1,0)]):m.isForward(u)&&f?o([_m(0,1),_m(1,0)]):gm(u)&&!f?s:C.none}));return g()},keyup:(e,r,s,l,a)=>Cs(t,n.selectedSelector).fold((()=>{const c=e.raw,i=c.which;return!0===c.shiftKey&&gm(i)&&Am(r,l)?((e,t,o,n,r,s,l)=>Re(o,r)&&n===s?C.none():bt(o,"td,th",t).bind((o=>bt(r,"td,th",t).bind((n=>pi(e,t,o,n,l))))))(t,o,r,s,l,a,n.selectRange):C.none()}),C.none)}})(r,s,l,n),i=((e,t,o,n)=>{const r=Bm(e);return(e,s)=>{n.clearBeforeUpdate(t),xs(e,s,o).each((e=>{const o=e.boxes.getOr([]);n.selectRange(t,o,e.start,e.finish),r.selectContents(s),r.collapseSelection()}))}})(r,s,l,n);e.on("TableSelectorChange",(e=>i(e.start,e.finish)));const m=(t,o)=>{(e=>!0===e.raw.shiftKey)(t)&&(o.kill&&t.kill(),o.selection.each((t=>{const o=bm.relative(t.start,t.finish),n=di(r,o);e.selection.setRng(n)})))},d=e=>0===e.button,u=(()=>{const e=sm(xe.fromDom(s)),t=sm(0);return{touchEnd:o=>{const n=xe.fromDom(o.target);if(ue("td")(n)||ue("th")(n)){const r=e.get(),s=t.get();Re(r,n)&&o.timeStamp-s<300&&(o.preventDefault(),i(n,n))}e.set(n),t.set(o.timeStamp)}}})();e.on("dragstart",(e=>{a.clearstate()})),e.on("mousedown",(e=>{d(e)&&Gm(e)&&a.mousedown(Um(e))})),e.on("mouseover",(e=>{var t;void 0!==(t=e).buttons&&0==(1&t.buttons)||!Gm(e)||a.mouseover(Um(e))})),e.on("mouseup",(e=>{d(e)&&Gm(e)&&a.mouseup(Um(e))})),e.on("touchend",u.touchEnd),e.on("keyup",(t=>{const o=Um(t);if(o.raw.shiftKey&&gm(o.raw.which)){const t=e.selection.getRng(),n=xe.fromDom(t.startContainer),r=xe.fromDom(t.endContainer);c.keyup(o,n,t.startOffset,r,t.endOffset).each((e=>{m(o,e)}))}})),e.on("keydown",(o=>{const n=Um(o);t.hide();const r=e.selection.getRng(),s=xe.fromDom(r.startContainer),l=xe.fromDom(r.endContainer),a=un(hm,pm)(xe.fromDom(e.selection.getStart()));c.keydown(n,s,r.startOffset,l,r.endOffset,a).each((e=>{m(n,e)})),t.show()})),e.on("NodeChange",(()=>{const t=e.selection,o=xe.fromDom(t.getStart()),r=xe.fromDom(t.getEnd());vs(Kt,[o,r]).fold((()=>n.clear(s)),f)}))})),e.on("PreInit",(()=>{e.serializer.addTempAttr(As.firstSelected),e.serializer.addTempAttr(As.lastSelected)})),{getSelectedCells:()=>((e,t,o,n)=>{switch(e.tag){case"none":return t();case"single":return(e=>[e.dom])(e.element);case"multiple":return(e=>E(e,(e=>e.dom)))(e.elements)}})(o.get(),g([])),clearSelectedCells:e=>n.clear(xe.fromDom(e))}},Ym=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=_(t,(t=>t!==e))},trigger:(...o)=>{const n={};N(e,((e,t)=>{n[e]=o[t]})),N(t,(e=>{e(n)}))}}},Jm=e=>({registry:K(e,(e=>({bind:e.bind,unbind:e.unbind}))),trigger:K(e,(e=>e.trigger))}),Qm=e=>e.slice(0).sort(),Xm=(e,t)=>{const o=_(t,(t=>!D(e,t)));o.length>0&&(e=>{throw new Error("Unsupported keys for object: "+Qm(e).join(", "))})(o)},Zm=e=>((e,t)=>((e,t,o)=>{if(0===t.length)throw new Error("You must specify at least one required field.");return((e,t)=>{if(!l(t))throw new Error("The "+e+" fields must be an array. Was: "+t+".");N(t,(t=>{if(!r(t))throw new Error("The value "+t+" in the "+e+" fields was not a string.")}))})("required",t),(e=>{const t=Qm(e);L(t,((e,o)=>o{throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+t.join(", ")+"].")}))})(t),n=>{const r=q(n);P(t,(e=>D(r,e)))||((e,t)=>{throw new Error("All required keys ("+Qm(e).join(", ")+") were not specified. Specified keys were: "+Qm(t).join(", ")+".")})(t,r),e(t,r);const s=_(t,(e=>!o.validate(n[e],e)));return s.length>0&&((e,t)=>{throw new Error("All values need to be of type: "+t+". Keys ("+Qm(e).join(", ")+") were not.")})(s,o.label),n}})(e,t,{validate:d,label:"function"}))(Xm,e),ed=Zm(["compare","extract","mutate","sink"]),td=Zm(["element","start","stop","destroy"]),od=Zm(["forceDrop","drop","move","delayDrop"]),nd=()=>{const e=(()=>{const e=Jm({move:Ym(["info"])});return{onEvent:f,reset:f,events:e.registry}})(),t=(()=>{let e=C.none();const t=Jm({move:Ym(["info"])});return{onEvent:(o,n)=>{n.extract(o).each((o=>{const r=((t,o)=>{const n=e.map((e=>t.compare(e,o)));return e=C.some(o),n})(n,o);r.each((e=>{t.trigger.move(e)}))}))},reset:()=>{e=C.none()},events:t.registry}})();let o=e;return{on:()=>{o.reset(),o=t},off:()=>{o.reset(),o=e},isOn:()=>o===t,onEvent:(e,t)=>{o.onEvent(e,t)},events:t.events}},rd=e=>{const t=e.replace(/\./g,"-");return{resolve:e=>t+"-"+e}},sd=rd("ephox-dragster").resolve;var ld=ed({compare:(e,t)=>bn(t.left-e.left,t.top-e.top),extract:e=>C.some(bn(e.x,e.y)),sink:(e,t)=>{const o=(e=>{const t={layerClass:sd("blocker"),...e},o=xe.fromTag("div");return ge(o,"role","presentation"),Bt(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Mm(o,sd("blocker")),Mm(o,t.layerClass),{element:g(o),destroy:()=>{qe(o)}}})(t),n=qm(o.element(),"mousedown",e.forceDrop),r=qm(o.element(),"mouseup",e.drop),s=qm(o.element(),"mousemove",e.move),l=qm(o.element(),"mouseout",e.delayDrop);return td({element:o.element,start:e=>{Ie(e,o.element())},stop:()=>{qe(o.element())},destroy:()=>{o.destroy(),r.unbind(),s.unbind(),l.unbind(),n.unbind()}})},mutate:(e,t)=>{e.mutate(t.left,t.top)}});const ad=rd("ephox-snooker").resolve,cd=ad("resizer-bar"),id=ad("resizer-rows"),md=ad("resizer-cols"),dd=e=>{const t=dt(e.parent(),"."+cd);N(t,qe)},ud=(e,t,o)=>{const n=e.origin();N(t,(t=>{t.each((t=>{const r=o(n,t);Mm(r,cd),Ie(e.parent(),r)}))}))},fd=(e,t,o,n,r)=>{const s=yn(o),l=t.isResizable,a=n.length>0?_n.positions(n,o):[],c=a.length>0?((e,t)=>j(e.all,((e,o)=>t(e.element)?[o]:[])))(e,l):[];((e,t,o,n)=>{ud(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=xe.fromTag("div");return Bt(s,{position:"absolute",left:t+"px",top:o-3.5+"px",height:"7px",width:n+"px"}),he(s,{"data-row":e,role:"presentation"}),s})(t.row,o.left-e.left,t.y-e.top,n);return Mm(r,id),r}))})(t,_(a,((e,t)=>O(c,(e=>t===e)))),s,Wo(o));const i=r.length>0?An.positions(r,o):[],m=i.length>0?((e,t)=>{const o=[];return k(e.grid.columns,(n=>{an(e,n).map((e=>e.element)).forall(t)&&o.push(n)})),_(o,(o=>{const n=nn(e,(e=>e.column===o));return P(n,(e=>t(e.element)))}))})(e,l):[];((e,t,o,n)=>{ud(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=xe.fromTag("div");return Bt(s,{position:"absolute",left:t-3.5+"px",top:o+"px",height:r+"px",width:"7px"}),he(s,{"data-column":e,role:"presentation"}),s})(t.col,t.x-e.left,o.top-e.top,0,n);return Mm(r,md),r}))})(t,_(i,((e,t)=>O(m,(e=>t===e)))),s,pn(o))},gd=(e,t)=>{if(dd(e),e.isResizable(t)){const o=Zo(t),n=dn(o),r=cn(o);fd(o,e,t,n,r)}},hd=(e,t)=>{const o=dt(e.parent(),"."+cd);N(o,t)},pd=e=>{hd(e,(e=>{Nt(e,"display","none")}))},wd=e=>{hd(e,(e=>{Nt(e,"display","block")}))},bd=ad("resizer-bar-dragging"),vd=e=>{const t=(()=>{const e=Jm({drag:Ym(["xDelta","yDelta","target"])});let t=C.none();const o=(()=>{const e=Jm({drag:Ym(["xDelta","yDelta"])});return{mutate:(t,o)=>{e.trigger.drag(t,o)},events:e.registry}})();return o.events.drag.bind((o=>{t.each((t=>{e.trigger.drag(o.xDelta,o.yDelta,t)}))})),{assign:e=>{t=C.some(e)},get:()=>t,mutate:o.mutate,events:e.registry}})(),o=((e,t={})=>{var o;return((e,t,o)=>{let n=!1;const r=Jm({start:Ym([]),stop:Ym([])}),s=nd(),l=()=>{m.stop(),s.isOn()&&(s.off(),r.trigger.stop())},c=((e,t)=>{let o=null;const n=()=>{a(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...t)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,t)}),200)}}})(l);s.events.move.bind((o=>{t.mutate(e,o.info)}));const i=e=>(...t)=>{n&&e.apply(null,t)},m=t.sink(od({forceDrop:l,drop:i(l),move:i((e=>{c.cancel(),s.onEvent(e,t)})),delayDrop:i(c.throttle)}),o);return{element:m.element,go:e=>{m.start(e),s.on(),r.trigger.start()},on:()=>{n=!0},off:()=>{n=!1},isActive:()=>n,destroy:()=>{m.destroy()},events:r.registry}})(e,null!==(o=t.mode)&&void 0!==o?o:ld,t)})(t,{});let n=C.none();const r=(e,t)=>C.from(pe(e,t));t.events.drag.bind((e=>{r(e.target,"data-row").each((t=>{const o=It(e.target,"top");Nt(e.target,"top",o+e.yDelta+"px")})),r(e.target,"data-column").each((t=>{const o=It(e.target,"left");Nt(e.target,"left",o+e.xDelta+"px")}))}));const s=(e,t)=>It(e,t)-Wt(e,"data-initial-"+t,0);o.events.stop.bind((()=>{t.get().each((t=>{n.each((o=>{r(t,"data-row").each((e=>{const n=s(t,"top");be(t,"data-initial-top"),d.trigger.adjustHeight(o,n,parseInt(e,10))})),r(t,"data-column").each((e=>{const n=s(t,"left");be(t,"data-initial-left"),d.trigger.adjustWidth(o,n,parseInt(e,10))})),gd(e,o)}))}))}));const l=(n,r)=>{d.trigger.startAdjust(),t.assign(n),ge(n,"data-initial-"+r,It(n,r)),Mm(n,bd),Nt(n,"opacity","0.2"),o.go(e.parent())},c=qm(e.parent(),"mousedown",(e=>{var t;t=e.target,jm(t,id)&&l(e.target,"top"),(e=>jm(e,md))(e.target)&&l(e.target,"left")})),i=t=>Re(t,e.view()),m=qm(e.view(),"mouseover",(t=>{var r;(r=t.target,bt(r,"table",i).filter(Qr)).fold((()=>{lt(t.target)&&dd(e)}),(t=>{o.isActive()&&(n=C.some(t),gd(e,t))}))})),d=Jm({adjustHeight:Ym(["table","delta","row"]),adjustWidth:Ym(["table","delta","column"]),startAdjust:Ym([])});return{destroy:()=>{c.unbind(),m.unbind(),o.destroy(),dd(e)},refresh:t=>{gd(e,t)},on:o.on,off:o.off,hideBars:w(pd,e),showBars:w(wd,e),events:d.registry}},yd=(e,t,o)=>{const n=_n,r=An,s=vd(e),l=Jm({beforeResize:Ym(["table","type"]),afterResize:Ym(["table","type"]),startDrag:Ym([])});return s.events.adjustHeight.bind((e=>{const t=e.table;l.trigger.beforeResize(t,"row");((e,t,o,n)=>{const r=Zo(e),s=((e,t,o)=>lr(e,t,o,Yn,(e=>e.getOrThunk(Ht))))(r,e,n),l=E(s,((e,n)=>o===n?Math.max(t+e,Ht()):e)),a=oa(r,l),c=((e,t)=>E(e.all,((e,o)=>({element:e.element,height:t[o]}))))(r,l);N(c,(e=>{$n(e.element,e.height)})),N(a,(e=>{$n(e.element,e.height)}));const i=z(l,((e,t)=>e+t),0);$n(e,i)})(t,n.delta(e.delta,t),e.row,n),l.trigger.afterResize(t,"row")})),s.events.startAdjust.bind((e=>{l.trigger.startDrag()})),s.events.adjustWidth.bind((e=>{const n=e.table;l.trigger.beforeResize(n,"col");const s=r.delta(e.delta,n),a=o(n);ra(n,s,e.column,t,a),l.trigger.afterResize(n,"col")})),{on:s.on,off:s.off,refreshBars:s.refresh,hideBars:s.hideBars,showBars:s.showBars,destroy:s.destroy,events:l.registry}},xd=e=>m(e)&&"TABLE"===e.nodeName,Cd="bar-",Sd=e=>"false"!==pe(e,"data-mce-resize"),Td=e=>{const t=lm(),o=lm(),n=lm();let r,s;const l=t=>fc(e,t),a=()=>Pr(e)?el():Zs();return e.on("init",(()=>{const r=((e,t)=>e.inline?((e,t,o)=>({parent:g(t),view:g(e),origin:g(bn(0,0)),isResizable:o}))(xe.fromDom(e.getBody()),(()=>{const e=xe.fromTag("div");return Bt(e,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Ie(at(xe.fromDom(document)),e),e})(),t):((e,t)=>{const o=me(e)?(e=>xe.fromDom(Ee(e).dom.documentElement))(e):e;return{parent:g(o),view:g(e),origin:g(bn(0,0)),isResizable:t}})(xe.fromDom(e.getDoc()),t))(e,Sd);if(n.set(r),(e=>{const t=e.options.get("object_resizing");return D(t.split(","),"table")})(e)&&qr(e)){const n=a(),s=yd(r,n,l);s.on(),s.events.startDrag.bind((o=>{t.set(e.selection.getRng())})),s.events.beforeResize.bind((t=>{const o=t.table.dom;((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(e,o,ns(o),rs(o),Cd+t.type)})),s.events.afterResize.bind((o=>{const n=o.table,r=n.dom;ts(n),t.on((t=>{e.selection.setRng(t),e.focus()})),((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(e,r,ns(r),rs(r),Cd+o.type),e.undoManager.add()})),o.set(s)}})),e.on("ObjectResizeStart",(t=>{const o=t.target;if(xd(o)){const n=xe.fromDom(o);N(e.dom.select(".mce-clonedresizable"),(t=>{e.dom.addClass(t,"mce-"+jr(e)+"-columns")})),!kc(n)&&$r(e)?_c(n):!Oc(n)&&Hr(e)&&Bc(n),Ec(n)&&Tt(t.origin,Cd)&&Bc(n),r=t.width,s=Vr(e)?"":((e,t)=>{const o=e.dom.getStyle(t,"width")||e.dom.getAttrib(t,"width");return C.from(o).filter(Ot)})(e,o).getOr("")}})),e.on("ObjectResized",(t=>{const o=t.target;if(xd(o)){const n=xe.fromDom(o),c=t.origin;Tt(c,"corner-")&&((t,o,n)=>{const c=Rt(o,"e");if(""===s&&Bc(t),n!==r&&""!==s){Nt(t,"width",s);const o=a(),i=l(t),m=Pr(e)||c?(e=>tl(e).columns)(t)-1:0;ra(t,n-r,m,o,i)}else if((e=>/^(\d+(\.\d+)?)%$/.test(e))(s)){const e=parseFloat(s.replace("%",""));Nt(t,"width",n*e/r+"%")}(e=>/^(\d+(\.\d+)?)px$/.test(e))(s)&&(e=>{const t=Zo(e);ln(t)||N(Ut(e),(e=>{const t=_t(e,"width");Nt(e,"width",t),be(e,"width")}))})(t)})(n,c,t.width),ts(n),ic(e,n.dom,mc)}})),e.on("SwitchMode",(()=>{o.on((t=>{e.mode.isReadOnly()?t.hideBars():t.showBars()}))})),e.on("dragstart dragend",(e=>{o.on((t=>{"dragstart"===e.type?(t.hideBars(),t.off()):(t.on(),t.showBars())}))})),e.on("remove",(()=>{o.on((e=>{e.destroy()})),n.on((t=>{((e,t)=>{e.inline&&qe(t.parent())})(e,t)}))})),{refresh:e=>{o.on((t=>t.refreshBars(xe.fromDom(e))))},hide:()=>{o.on((e=>e.hideBars()))},show:()=>{o.on((e=>e.showBars()))}}},Rd=e=>{(e=>{const t=e.options.register;t("table_clone_elements",{processor:"string[]"}),t("table_use_colgroups",{processor:"boolean",default:!0}),t("table_header_type",{processor:e=>{const t=D(["section","cells","sectionCells","auto"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: section, cells, sectionCells or auto."}},default:"section"}),t("table_sizing_mode",{processor:"string",default:"auto"}),t("table_default_attributes",{processor:"object",default:{border:"1"}}),t("table_default_styles",{processor:"object",default:{"border-collapse":"collapse"}}),t("table_column_resizing",{processor:e=>{const t=D(["preservetable","resizetable"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be preservetable, or resizetable."}},default:"preservetable"}),t("table_resize_bars",{processor:"boolean",default:!0}),t("table_style_by_css",{processor:"boolean",default:!0}),t("table_merge_content_on_paste",{processor:"boolean",default:!0})})(e);const t=Td(e),o=Km(e,t),n=gc(e,t,o);return Xc(e,n),((e,t)=>{const o=es(e),n=t=>js(os(e)).bind((n=>Kt(n,o).map((o=>{const r=Ls(Ps(e),o,n);return t(o,r)})))).getOr("");G({mceTableRowType:()=>n(t.getTableRowType),mceTableCellType:()=>n(t.getTableCellType),mceTableColType:()=>n(t.getTableColType)},((t,o)=>e.addQueryValueHandler(o,t)))})(e,n),Is(e,n),{getSelectedCells:o.getSelectedCells,clearSelectedCells:o.clearSelectedCells}};e.add("dom",(e=>({table:Rd(e)})))}(); \ No newline at end of file +!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.ModelManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(t)===e,o=e=>t=>typeof t===e,n=e=>t=>e===t,r=t("string"),s=t("object"),l=t("array"),a=n(null),c=o("boolean"),i=n(void 0),m=e=>!(e=>null==e)(e),d=o("function"),u=o("number"),f=()=>{},g=e=>()=>e,h=e=>e,p=(e,t)=>e===t;function b(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const w=e=>t=>!e(t),v=e=>e(),y=g(!1),x=g(!0);class C{constructor(e,t){this.tag=e,this.value=t}static some(e){return new C(!0,e)}static none(){return C.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?C.some(e(this.value)):C.none()}bind(e){return this.tag?e(this.value):C.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:C.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return m(e)?C.some(e):C.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}C.singletonNone=new C(!1);const S=Array.prototype.slice,T=Array.prototype.indexOf,R=Array.prototype.push,D=(e,t)=>{return o=e,n=t,T.call(o,n)>-1;var o,n},O=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),A=(e,t,o)=>(N(e,((e,n)=>{o=t(o,e,n)})),o),L=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oM(E(e,t)),P=(e,t)=>{for(let o=0,n=e.length;o{const o={};for(let n=0,r=e.length;nt>=0&&tF(e,0),$=e=>F(e,e.length-1),V=(e,t)=>{for(let o=0;o{const o=q(e);for(let n=0,r=o.length;nY(e,((e,o)=>({k:o,v:t(e,o)}))),Y=(e,t)=>{const o={};return G(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},J=(e,t)=>{const o=[];return G(e,((e,n)=>{o.push(t(e,n))})),o},Q=e=>J(e,h),X=(e,t)=>U.call(e,t),Z="undefined"!=typeof window?window:Function("return this;")(),ee=(e,t)=>((e,t)=>{let o=null!=t?t:Z;for(let t=0;t{const t=ee("ownerDocument.defaultView",e);return s(e)&&((e=>((e,t)=>{const o=((e,t)=>ee(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(te(e).constructor.name))},ne=e=>e.dom.nodeName.toLowerCase(),re=e=>e.dom.nodeType,se=e=>t=>re(t)===e,le=e=>8===re(e)||"#comment"===ne(e),ae=e=>ce(e)&&oe(e.dom),ce=se(1),ie=se(3),me=se(9),de=se(11),ue=e=>t=>ce(t)&&ne(t)===e,fe=(e,t,o)=>{if(!(r(o)||c(o)||u(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},ge=(e,t,o)=>{fe(e.dom,t,o)},he=(e,t)=>{const o=e.dom;G(t,((e,t)=>{fe(o,t,e)}))},pe=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},be=(e,t)=>C.from(pe(e,t)),we=(e,t)=>{e.dom.removeAttribute(t)},ve=e=>A(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),ye=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},xe={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return ye(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return ye(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return ye(o)},fromDom:ye,fromPoint:(e,t,o)=>C.from(e.dom.elementFromPoint(t,o)).map(ye)},Ce=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Se=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Te=(e,t)=>{const o=void 0===t?document:t.dom;return Se(o)?C.none():C.from(o.querySelector(e)).map(xe.fromDom)},Re=(e,t)=>e.dom===t.dom,De=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Oe=Ce,ke=e=>xe.fromDom(e.dom.ownerDocument),Ee=e=>me(e)?e:ke(e),Ne=e=>C.from(e.dom.parentNode).map(xe.fromDom),Be=e=>C.from(e.dom.parentElement).map(xe.fromDom),_e=(e,t)=>{const o=d(t)?t:y;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=xe.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},ze=e=>C.from(e.dom.previousSibling).map(xe.fromDom),Ae=e=>C.from(e.dom.nextSibling).map(xe.fromDom),Le=e=>E(e.dom.childNodes,xe.fromDom),We=(e,t)=>{const o=e.dom.childNodes;return C.from(o[t]).map(xe.fromDom)},Me=(e,t)=>{Ne(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},je=(e,t)=>{Ae(e).fold((()=>{Ne(e).each((e=>{Ie(e,t)}))}),(e=>{Me(e,t)}))},Pe=(e,t)=>{const o=(e=>We(e,0))(e);o.fold((()=>{Ie(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Ie=(e,t)=>{e.dom.appendChild(t.dom)},Fe=(e,t)=>{Me(e,t),Ie(t,e)},He=(e,t)=>{N(t,((o,n)=>{const r=0===n?e:t[n-1];je(r,o)}))},$e=(e,t)=>{N(t,(t=>{Ie(e,t)}))},Ve=e=>{e.dom.textContent="",N(Le(e),(e=>{qe(e)}))},qe=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Ue=e=>{const t=Le(e);t.length>0&&He(e,t),qe(e)},Ge=(e,t)=>xe.fromDom(e.dom.cloneNode(t)),Ke=e=>Ge(e,!1),Ye=e=>Ge(e,!0),Je=(e,t)=>{const o=xe.fromTag(t),n=ve(e);return he(o,n),o},Qe=["tfoot","thead","tbody","colgroup"],Xe=(e,t,o)=>({element:e,rowspan:t,colspan:o}),Ze=(e,t,o)=>({element:e,cells:t,section:o}),et=(e,t,o)=>({element:e,isNew:t,isLocked:o}),tt=(e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}),ot=d(Element.prototype.attachShadow)&&d(Node.prototype.getRootNode),nt=g(ot),rt=ot?e=>xe.fromDom(e.dom.getRootNode()):Ee,st=e=>xe.fromDom(e.dom.host),lt=e=>{const t=ie(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=rt(e);return de(o=t)&&m(o.dom.host)?C.some(t):C.none();var o})(xe.fromDom(t)).fold((()=>o.body.contains(t)),(n=lt,r=st,e=>n(r(e))));var n,r},at=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return xe.fromDom(t)},ct=(e,t)=>{let o=[];return N(Le(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(ct(e,t))})),o},it=(e,t,o)=>((e,o,n)=>_(_e(e,n),(e=>Ce(e,t))))(e,0,o),mt=(e,t)=>((e,o)=>_(Le(e),(e=>Ce(e,t))))(e),dt=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Se(o)?[]:E(o.querySelectorAll(e),xe.fromDom)})(t,e);var ut=(e,t,o,n,r)=>e(o,n)?C.some(o):d(r)&&r(o)?C.none():t(o,n,r);const ft=(e,t,o)=>{let n=e.dom;const r=d(o)?o:y;for(;n.parentNode;){n=n.parentNode;const e=xe.fromDom(n);if(t(e))return C.some(e);if(r(e))break}return C.none()},gt=(e,t,o)=>ut(((e,t)=>t(e)),ft,e,t,o),ht=(e,t,o)=>ft(e,(e=>Ce(e,t)),o),pt=(e,t)=>((e,o)=>L(e.dom.childNodes,(e=>{return o=xe.fromDom(e),Ce(o,t);var o})).map(xe.fromDom))(e),bt=(e,t)=>Te(t,e),wt=(e,t,o)=>ut(((e,t)=>Ce(e,t)),ht,e,t,o),vt=(e,t,o=p)=>e.exists((e=>o(e,t))),yt=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te?C.some(t):C.none(),Ct=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,St=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!i(n)||r+t.length<=n)},Tt=(e,t)=>Ct(e,t,0),Rt=(e,t)=>Ct(e,t,e.length-t.length),Dt=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Ot=e=>e.length>0,kt=e=>void 0!==e.style&&d(e.style.getPropertyValue),Et=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);kt(e)&&e.style.setProperty(t,o)},Nt=(e,t,o)=>{const n=e.dom;Et(n,t,o)},Bt=(e,t)=>{const o=e.dom;G(t,((e,t)=>{Et(o,t,e)}))},_t=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||lt(e)?n:zt(o,t)},zt=(e,t)=>kt(e)?e.style.getPropertyValue(t):"",At=(e,t)=>{const o=e.dom,n=zt(o,t);return C.from(n).filter((e=>e.length>0))},Lt=(e,t)=>{((e,t)=>{kt(e)&&e.style.removeProperty(t)})(e.dom,t),vt(be(e,"style").map(Dt),"")&&we(e,"style")},Wt=(e,t,o=0)=>be(e,t).map((e=>parseInt(e,10))).getOr(o),Mt=(e,t)=>Wt(e,t,1),jt=e=>ue("col")(e)?Wt(e,"span",1)>1:Mt(e,"colspan")>1,Pt=(e,t)=>parseInt(_t(e,t),10),It=g(10),Ft=g(10),Ht=(e,t)=>$t(e,t,x),$t=(e,t,o)=>j(Le(e),(e=>Ce(e,t)?o(e)?[e]:[]:$t(e,t,o))),Vt=(e,t)=>((e,t,o=y)=>o(t)?C.none():D(e,ne(t))?C.some(t):ht(t,e.join(","),(e=>Ce(e,"table")||o(e))))(["td","th"],e,t),qt=e=>Ht(e,"th,td"),Ut=e=>Ce(e,"colgroup")?mt(e,"col"):j(Yt(e),(e=>mt(e,"col"))),Gt=(e,t)=>wt(e,"table",t),Kt=e=>Ht(e,"tr"),Yt=e=>Gt(e).fold(g([]),(e=>mt(e,"colgroup"))),Jt=(e,t)=>E(e,(e=>{if("colgroup"===ne(e)){const t=E(Ut(e),(e=>{const t=Wt(e,"span",1);return Xe(e,1,t)}));return Ze(e,t,"colgroup")}{const o=E(qt(e),(e=>{const t=Wt(e,"rowspan",1),o=Wt(e,"colspan",1);return Xe(e,t,o)}));return Ze(e,o,t(e))}})),Qt=e=>Ne(e).map((e=>{const t=ne(e);return(e=>D(Qe,e))(t)?t:"tbody"})).getOr("tbody"),Xt=e=>{const t=Kt(e),o=[...Yt(e),...t];return Jt(o,Qt)},Zt=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},eo=()=>to(0,0),to=(e,t)=>({major:e,minor:t}),oo={nu:to,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?eo():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return to(n(1),n(2))})(e,o)},unknown:eo},no=(e,t)=>{const o=String(t).toLowerCase();return L(e,(e=>e.search(o)))},ro=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,so=e=>t=>St(t,e),lo=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>St(e,"edge/")&&St(e,"chrome")&&St(e,"safari")&&St(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ro],search:e=>St(e,"chrome")&&!St(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>St(e,"msie")||St(e,"trident")},{name:"Opera",versionRegexes:[ro,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:so("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:so("firefox")},{name:"Safari",versionRegexes:[ro,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(St(e,"safari")||St(e,"mobile/"))&&St(e,"applewebkit")}],ao=[{name:"Windows",search:so("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>St(e,"iphone")||St(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:so("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:so("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:so("linux"),versionRegexes:[]},{name:"Solaris",search:so("sunos"),versionRegexes:[]},{name:"FreeBSD",search:so("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:so("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],co={browsers:g(lo),oses:g(ao)},io="Edge",mo="Chromium",uo="Opera",fo="Firefox",go="Safari",ho=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(io),isChromium:n(mo),isIE:n("IE"),isOpera:n(uo),isFirefox:n(fo),isSafari:n(go)}},po=()=>ho({current:void 0,version:oo.unknown()}),bo=ho,wo=(g(io),g(mo),g("IE"),g(uo),g(fo),g(go),"Windows"),vo="Android",yo="Linux",xo="macOS",Co="Solaris",So="FreeBSD",To="ChromeOS",Ro=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(wo),isiOS:n("iOS"),isAndroid:n(vo),isMacOS:n(xo),isLinux:n(yo),isSolaris:n(Co),isFreeBSD:n(So),isChromeOS:n(To)}},Do=()=>Ro({current:void 0,version:oo.unknown()}),Oo=Ro,ko=(g(wo),g("iOS"),g(vo),g(yo),g(xo),g(Co),g(So),g(To),e=>window.matchMedia(e).matches);let Eo=Zt((()=>((e,t,o)=>{const n=co.browsers(),r=co.oses(),s=t.bind((e=>((e,t)=>V(t.brands,(t=>{const o=t.brand.toLowerCase();return L(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:oo.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>no(e,t).map((e=>{const o=oo.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(po,bo),l=((e,t)=>no(e,t).map((e=>{const o=oo.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Do,Oo),a=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,l=e.isiOS()||e.isAndroid(),a=l||n("(pointer:coarse)"),c=r||!s&&l&&n("(min-device-width:768px)"),i=s||l&&!c,m=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),d=!i&&!c&&!m;return{isiPad:g(r),isiPhone:g(s),isTablet:g(c),isPhone:g(i),isTouch:g(a),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:g(m),isDesktop:g(d)}})(l,s,e,o);return{browser:s,os:l,deviceType:a}})(navigator.userAgent,C.from(navigator.userAgentData),ko)));const No=()=>Eo(),Bo=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=_t(o,e);return parseFloat(t)||0}return n},n=(e,t)=>A(t,((t,o)=>{const n=_t(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!u(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;kt(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},_o=(e,t,o)=>((e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?C.none():C.some(t)})(e).getOr(t))(_t(e,t),o),zo=Bo("width",(e=>e.dom.offsetWidth)),Ao=e=>zo.get(e),Lo=e=>zo.getOuter(e),Wo=e=>((e,t)=>{const o=e.dom,n=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?n:((e,t,o,n)=>t-_o(e,`padding-${o}`,0)-_o(e,`padding-${n}`,0)-_o(e,`border-${o}-width`,0)-_o(e,`border-${n}-width`,0))(e,n,"left","right")})(e,"content-box"),Mo=(e,t,o)=>{const n=e.cells,r=n.slice(0,t),s=n.slice(t),l=r.concat(o).concat(s);return Io(e,l)},jo=(e,t,o)=>Mo(e,t,[o]),Po=(e,t,o)=>{e.cells[t]=o},Io=(e,t)=>tt(e.element,t,e.section,e.isNew),Fo=(e,t)=>e.cells[t],Ho=(e,t)=>Fo(e,t).element,$o=e=>e.cells.length,Vo=e=>{const t=B(e,(e=>"colgroup"===e.section));return{rows:t.fail,cols:t.pass}},qo=(e,t,o)=>{const n=E(e.cells,o);return tt(t(e.element),n,e.section,!0)},Uo="data-snooker-locked-cols",Go=e=>be(e,Uo).bind((e=>C.from(e.match(/\d+/g)))).map((e=>I(e,x))),Ko=e=>{const t=A(Vo(e).rows,((e,t)=>(N(t.cells,((t,o)=>{t.isLocked&&(e[o]=!0)})),e)),{}),o=J(t,((e,t)=>parseInt(t,10)));return((e,t)=>{const o=S.call(e,0);return o.sort(void 0),o})(o)},Yo=(e,t)=>e+","+t,Jo=(e,t)=>{const o=j(e.all,(e=>e.cells));return _(o,t)},Qo=e=>{const t={},o=[],n=H(e).map((e=>e.element)).bind(Gt).bind(Go).getOr({});let r=0,s=0,l=0;const{pass:a,fail:c}=B(e,(e=>"colgroup"===e.section));N(c,(e=>{const a=[];N(e.cells,(e=>{let o=0;for(;void 0!==t[Yo(l,o)];)o++;const r=((e,t)=>X(e,t)&&void 0!==e[t]&&null!==e[t])(n,o.toString()),c=((e,t,o,n,r,s)=>({element:e,rowspan:t,colspan:o,row:n,column:r,isLocked:s}))(e.element,e.rowspan,e.colspan,l,o,r);for(let n=0;n{const t=(e=>{const t={};let o=0;return N(e.cells,(e=>{const n=e.colspan;k(n,(r=>{const s=o+r;t[s]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,n,s)})),o+=n})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,Q(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),d=((e,t)=>({rows:e,columns:t}))(r,s);return{grid:d,access:t,all:o,columns:i,colgroups:m}},Xo=e=>{const t=Xt(e);return Qo(t)},Zo=Qo,en=(e,t,o)=>C.from(e.access[Yo(t,o)]),tn=(e,t,o)=>{const n=Jo(e,(e=>o(t,e.element)));return n.length>0?C.some(n[0]):C.none()},on=Jo,nn=e=>j(e.all,(e=>e.cells)),rn=e=>Q(e.columns),sn=e=>q(e.columns).length>0,ln=(e,t)=>C.from(e.columns[t]),an=(e,t=x)=>{const o=e.grid,n=k(o.columns,h),r=k(o.rows,h);return E(n,(o=>cn((()=>j(r,(t=>en(e,t,o).filter((e=>e.column===o)).toArray()))),(e=>1===e.colspan&&t(e.element)),(()=>en(e,0,o)))))},cn=(e,t,o)=>{const n=e();return L(n,t).orThunk((()=>C.from(n[0]).orThunk(o))).map((e=>e.element))},mn=e=>{const t=e.grid,o=k(t.rows,h),n=k(t.columns,h);return E(o,(t=>cn((()=>j(n,(o=>en(e,t,o).filter((e=>e.row===t)).fold(g([]),(e=>[e]))))),(e=>1===e.rowspan),(()=>en(e,t,0)))))},dn=(e,t)=>o=>"rtl"===un(o)?t:e,un=e=>"rtl"===_t(e,"direction")?"rtl":"ltr",fn=Bo("height",(e=>{const t=e.dom;return lt(e)?t.getBoundingClientRect().height:t.offsetHeight})),gn=e=>fn.get(e),hn=e=>fn.getOuter(e),pn=(e,t)=>({left:e,top:t,translate:(o,n)=>pn(e+o,t+n)}),bn=pn,wn=(e,t)=>void 0!==e?e:void 0!==t?t:0,vn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return bn(o.offsetLeft,o.offsetTop);const s=wn(null==n?void 0:n.pageYOffset,r.scrollTop),l=wn(null==n?void 0:n.pageXOffset,r.scrollLeft),a=wn(r.clientTop,o.clientTop),c=wn(r.clientLeft,o.clientLeft);return yn(e).translate(l-c,s-a)},yn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?bn(o.offsetLeft,o.offsetTop):lt(e)?(e=>{const t=e.getBoundingClientRect();return bn(t.left,t.top)})(t):bn(0,0)},xn=(e,t)=>({row:e,y:t}),Cn=(e,t)=>({col:e,x:t}),Sn=e=>vn(e).left+Lo(e),Tn=e=>vn(e).left,Rn=(e,t)=>Cn(e,Tn(t)),Dn=(e,t)=>Cn(e,Sn(t)),On=e=>vn(e).top,kn=(e,t)=>xn(e,On(t)),En=(e,t)=>xn(e,On(t)+hn(t)),Nn=(e,t,o)=>{if(0===o.length)return[];const n=E(o.slice(1),((t,o)=>t.map((t=>e(o,t))))),r=o[o.length-1].map((e=>t(o.length-1,e)));return n.concat([r])},Bn={delta:h,positions:e=>Nn(kn,En,e),edge:On},_n=dn({delta:h,edge:Tn,positions:e=>Nn(Rn,Dn,e)},{delta:e=>-e,edge:Sn,positions:e=>Nn(Dn,Rn,e)}),zn={delta:(e,t)=>_n(t).delta(e,t),positions:(e,t)=>_n(t).positions(e,t),edge:e=>_n(e).edge(e)},An={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Ln=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),Wn=/(\d+(\.\d+)?)%/,Mn=/(\d+(\.\d+)?)px|em/,jn=ue("col"),Pn=ue("tr"),In=(e,t,o)=>{const n=Be(e).getOrThunk((()=>at(ke(e))));return t(e)/o(n)*100},Fn=(e,t)=>{Nt(e,"width",t+"px")},Hn=(e,t)=>{Nt(e,"width",t+"%")},$n=(e,t)=>{Nt(e,"height",t+"px")},Vn=e=>{const t=(e=>{return _o(t=e,"height",t.dom.offsetHeight)+"px";var t})(e);return t?((e,t,o,n)=>{const r=parseFloat(e);return Rt(e,"%")&&"table"!==ne(t)?((e,t,o,n)=>{const r=Gt(e).map((e=>{const n=o(e);return Math.floor(t/100*n)})).getOr(t);return n(e,r),r})(t,r,o,n):r})(t,e,gn,$n):gn(e)},qn=(e,t)=>At(e,t).orThunk((()=>be(e,t).map((e=>e+"px")))),Un=e=>qn(e,"width"),Gn=e=>In(e,Ao,Wo),Kn=e=>{return jn(e)?Ao(e):_o(t=e,"width",t.dom.offsetWidth);var t},Yn=e=>Pn(e)?gn(e):((e,t,o)=>o(e)/Mt(e,"rowspan"))(e,0,Vn),Jn=(e,t,o)=>{Nt(e,"width",t+o)},Qn=e=>In(e,Ao,Wo)+"%",Xn=g(Wn),Zn=ue("col"),er=e=>Un(e).getOrThunk((()=>Kn(e)+"px")),tr=e=>{return(t=e,qn(t,"height")).getOrThunk((()=>Yn(e)+"px"));var t},or=(e,t,o,n,r,s)=>e.filter(n).fold((()=>s(((e,t)=>{if(t<0||t>=e.length-1)return C.none();const o=e[t].fold((()=>{const o=(e=>{const t=S.call(e,0);return t.reverse(),t})(e.slice(0,t));return V(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:0}))),n=e[t+1].fold((()=>{const o=e.slice(t+1);return V(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>C.some({value:e,delta:1})));return o.bind((e=>n.map((t=>{const o=t.delta+e.delta;return Math.abs(t.value-e.value)/o}))))})(o,t))),(e=>r(e))),nr=(e,t,o,n)=>{const r=an(e),s=sn(e)?(e=>E(rn(e),(e=>C.from(e.element))))(e):r,l=[C.some(zn.edge(t))].concat(E(zn.positions(r,t),(e=>e.map((e=>e.x))))),a=w(jt);return E(s,((e,t)=>or(e,t,l,a,(e=>{if((e=>{const t=No().browser,o=t.isChromium()||t.isFirefox();return!Zn(e)||o})(e))return o(e);{const e=null!=(s=r[t])?h(s):C.none();return or(e,t,l,a,(e=>n(C.some(Ao(e)))),n)}var s}),n)))},rr=e=>e.map((e=>e+"px")).getOr(""),sr=(e,t,o)=>nr(e,t,Kn,(e=>e.getOrThunk(o.minCellWidth))),lr=(e,t,o,n)=>{const r=mn(e),s=E(e.all,(e=>C.some(e.element))),l=[C.some(Bn.edge(t))].concat(E(Bn.positions(r,t),(e=>e.map((e=>e.y)))));return E(s,((e,t)=>or(e,t,l,x,o,n)))},ar=(e,t)=>()=>lt(e)?t(e):parseFloat(At(e,"width").getOr("0")),cr=e=>{const t=ar(e,(e=>parseFloat(Qn(e)))),o=ar(e,Ao);return{width:t,pixelWidth:o,getWidths:(t,o)=>((e,t,o)=>nr(e,t,Gn,(e=>e.fold((()=>o.minCellWidth()),(e=>e/o.pixelWidth()*100)))))(t,e,o),getCellDelta:e=>e/o()*100,singleColumnWidth:(e,t)=>[100-e],minCellWidth:()=>It()/o()*100,setElementWidth:Hn,adjustTableWidth:o=>{const n=t();Hn(e,n+o/100*n)},isRelative:!0,label:"percent"}},ir=e=>{const t=ar(e,Ao);return{width:t,pixelWidth:t,getWidths:(t,o)=>sr(t,e,o),getCellDelta:h,singleColumnWidth:(e,t)=>[Math.max(It(),e+t)-e],minCellWidth:It,setElementWidth:Fn,adjustTableWidth:o=>{const n=t()+o;Fn(e,n)},isRelative:!1,label:"pixel"}},mr=e=>Un(e).fold((()=>(e=>{const t=ar(e,Ao),o=g(0);return{width:t,pixelWidth:t,getWidths:(t,o)=>sr(t,e,o),getCellDelta:o,singleColumnWidth:g([0]),minCellWidth:o,setElementWidth:f,adjustTableWidth:f,isRelative:!0,label:"none"}})(e)),(t=>((e,t)=>null!==Xn().exec(t)?cr(e):ir(e))(e,t))),dr=ir,ur=cr,fr=(e,t,o)=>{const n=e[o].element,r=xe.fromTag("td");Ie(r,xe.fromTag("br")),(t?Ie:Pe)(n,r)},gr=((e,t)=>{const o=t=>e(t)?C.from(t.dom.nodeValue):C.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return o(t).getOr("")},getOption:o,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(ie),hr=e=>gr.get(e),pr=e=>gr.getOption(e),br=(e,t)=>gr.set(e,t),wr=e=>"img"===ne(e)?1:pr(e).fold((()=>Le(e).length),(e=>e.length)),vr=["img","br"],yr=e=>pr(e).filter((e=>0!==e.trim().length||e.indexOf("\xa0")>-1)).isSome()||D(vr,ne(e))||(e=>ae(e)&&"false"===pe(e,"contenteditable"))(e),xr=e=>((e,t)=>{const o=e=>{for(let n=0;nSr(e,yr),Sr=(e,t)=>{const o=e=>{const n=Le(e);for(let e=n.length-1;e>=0;e--){const r=n[e];if(t(r))return C.some(r);const s=o(r);if(s.isSome())return s}return C.none()};return o(e)},Tr={scope:["row","col"]},Rr=e=>()=>{const t=xe.fromTag("td",e.dom);return Ie(t,xe.fromTag("br",e.dom)),t},Dr=e=>()=>xe.fromTag("col",e.dom),Or=e=>()=>xe.fromTag("colgroup",e.dom),kr=e=>()=>xe.fromTag("tr",e.dom),Er=(e,t,o)=>{const n=((e,t)=>{const o=Je(e,t),n=Le(Ye(e));return $e(o,n),o})(e,t);return G(o,((e,t)=>{null===e?we(n,t):ge(n,t,e)})),n},Nr=e=>e,Br=(e,t,o)=>{const n=(e,t)=>{((e,t)=>{const o=e.dom,n=t.dom;kt(o)&&kt(n)&&(n.style.cssText=o.style.cssText)})(e.element,t),Lt(t,"height"),1!==e.colspan&&Lt(t,"width")};return{col:o=>{const r=xe.fromTag(ne(o.element),t.dom);return n(o,r),e(o.element,r),r},colgroup:Or(t),row:kr(t),cell:r=>{const s=xe.fromTag(ne(r.element),t.dom),l=o.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),a=l.length>0?((e,t,o)=>xr(e).map((n=>{const r=o.join(","),s=it(n,r,(t=>Re(t,e)));return z(s,((e,t)=>{const o=Ke(t);return Ie(e,o),o}),t)})).getOr(t))(r.element,s,l):s;return Ie(a,xe.fromTag("br")),n(r,s),((e,t)=>{G(Tr,((o,n)=>be(e,n).filter((e=>D(o,e))).each((e=>ge(t,n,e)))))})(r.element,s),e(r.element,s),s},replace:Er,colGap:Dr(t),gap:Rr(t)}},_r=e=>({col:Dr(e),colgroup:Or(e),row:kr(e),cell:Rr(e),replace:Nr,colGap:Dr(e),gap:Rr(e)}),zr=e=>t=>t.options.get(e),Ar="100%",Lr=e=>{var t;const o=e.dom,n=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return Wo(xe.fromDom(n))+"px"},Wr=e=>C.from(e.options.get("table_clone_elements")),Mr=zr("table_header_type"),jr=zr("table_column_resizing"),Pr=e=>"preservetable"===jr(e),Ir=e=>"resizetable"===jr(e),Fr=zr("table_sizing_mode"),Hr=e=>"relative"===Fr(e),$r=e=>"fixed"===Fr(e),Vr=e=>"responsive"===Fr(e),qr=zr("table_resize_bars"),Ur=zr("table_style_by_css"),Gr=zr("table_merge_content_on_paste"),Kr=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>Vr(e)||Ur(e)?t:$r(e)?{...t,width:Lr(e)}:{...t,width:Ar})(e,o)},Yr=zr("table_use_colgroups"),Jr=e=>wt(e,"[contenteditable]"),Qr=(e,t=!1)=>lt(e)?e.dom.isContentEditable:Jr(e).fold(g(t),(e=>"true"===Xr(e))),Xr=e=>e.dom.contentEditable,Zr=e=>xe.fromDom(e.getBody()),es=e=>t=>Re(t,Zr(e)),ts=e=>{we(e,"data-mce-style");const t=e=>we(e,"data-mce-style");N(qt(e),t),N(Ut(e),t),N(Kt(e),t)},os=e=>xe.fromDom(e.selection.getStart()),ns=e=>e.getBoundingClientRect().width,rs=e=>e.getBoundingClientRect().height,ss=e=>(t,o)=>{const n=t.dom.getStyle(o,e)||t.dom.getAttrib(o,e);return C.from(n).filter(Ot)},ls=ss("width"),as=ss("height"),cs=e=>gt(e,ue("table")).exists(Qr),is=(e,t)=>{const o=t.column,n=t.column+t.colspan-1,r=t.row,s=t.row+t.rowspan-1;return o<=e.finishCol&&n>=e.startCol&&r<=e.finishRow&&s>=e.startRow},ms=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,ds=(e,t,o)=>{const n=tn(e,t,Re),r=tn(e,o,Re);return n.bind((e=>r.map((t=>{return o=e,n=t,{startRow:Math.min(o.row,n.row),startCol:Math.min(o.column,n.column),finishRow:Math.max(o.row+o.rowspan-1,n.row+n.rowspan-1),finishCol:Math.max(o.column+o.colspan-1,n.column+n.colspan-1)};var o,n}))))},us=(e,t,o)=>ds(e,t,o).map((t=>{const o=on(e,b(is,t));return E(o,(e=>e.element))})),fs=(e,t)=>tn(e,t,((e,t)=>De(t,e))).map((e=>e.element)),gs=(e,t,o)=>{const n=ps(e);return us(n,t,o)},hs=(e,t,o,n,r)=>{const s=ps(e),l=Re(e,o)?C.some(t):fs(s,t),a=Re(e,r)?C.some(n):fs(s,n);return l.bind((e=>a.bind((t=>us(s,e,t)))))},ps=Xo;var bs=["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"],ws=()=>({up:g({selector:ht,closest:wt,predicate:ft,all:_e}),down:g({selector:dt,predicate:ct}),styles:g({get:_t,getRaw:At,set:Nt,remove:Lt}),attrs:g({get:pe,set:ge,remove:we,copyTo:(e,t)=>{const o=ve(e);he(t,o)}}),insert:g({before:Me,after:je,afterAll:He,append:Ie,appendAll:$e,prepend:Pe,wrap:Fe}),remove:g({unwrap:Ue,remove:qe}),create:g({nu:xe.fromTag,clone:e=>xe.fromDom(e.dom.cloneNode(!1)),text:xe.fromText}),query:g({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:ze,nextSibling:Ae}),property:g({children:Le,name:ne,parent:Ne,document:e=>Ee(e).dom,isText:ie,isComment:le,isElement:ce,isSpecial:e=>{const t=ne(e);return D(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>ce(e)?be(e,"lang"):C.none(),getText:hr,setText:br,isBoundary:e=>!!ce(e)&&("body"===ne(e)||D(bs,ne(e))),isEmptyTag:e=>!!ce(e)&&D(["br","img","hr","input"],ne(e)),isNonEditable:e=>ce(e)&&"false"===pe(e,"contenteditable")}),eq:Re,is:Oe});const vs=(e,t,o,n)=>{const r=t(e,o);return z(n,((o,n)=>{const r=t(e,n);return ys(e,o,r)}),r)},ys=(e,t,o)=>t.bind((t=>o.filter(b(e.eq,t)))),xs=ws(),Cs=(e,t)=>((e,t,o)=>o.length>0?((e,t,o,n)=>n(e,t,o[0],o.slice(1)))(e,t,o,vs):C.none())(xs,((t,o)=>e(o)),t),Ss=e=>ht(e,"table"),Ts=(e,t,o)=>{const n=e=>t=>void 0!==o&&o(t)||Re(t,e);return Re(e,t)?C.some({boxes:C.some([e]),start:e,finish:t}):Ss(e).bind((r=>Ss(t).bind((s=>{if(Re(r,s))return C.some({boxes:gs(r,e,t),start:e,finish:t});if(De(r,s)){const o=it(t,"td,th",n(r)),l=o.length>0?o[o.length-1]:t;return C.some({boxes:hs(r,e,r,t,s),start:e,finish:l})}if(De(s,r)){const o=it(e,"td,th",n(s)),l=o.length>0?o[o.length-1]:e;return C.some({boxes:hs(s,e,r,t,s),start:e,finish:l})}return((e,t,o)=>((e,t,o,n=y)=>{const r=[t].concat(e.up().all(t)),s=[o].concat(e.up().all(o)),l=e=>W(e,n).fold((()=>e),(t=>e.slice(0,t+1))),a=l(r),c=l(s),i=L(a,(t=>O(c,((e,t)=>b(e.eq,t))(e,t))));return{firstpath:a,secondpath:c,shared:i}})(xs,e,t,void 0))(e,t).shared.bind((l=>wt(l,"table",o).bind((o=>{const l=it(t,"td,th",n(o)),a=l.length>0?l[l.length-1]:t,c=it(e,"td,th",n(o)),i=c.length>0?c[c.length-1]:e;return C.some({boxes:hs(o,e,r,t,s),start:i,finish:a})}))))}))))},Rs=(e,t)=>{const o=dt(e,t);return o.length>0?C.some(o):C.none()},Ds=(e,t,o)=>bt(e,t).bind((t=>bt(e,o).bind((e=>Cs(Ss,[t,e]).map((o=>({first:t,last:e,table:o}))))))),Os=(e,t,o,n,r)=>((e,t)=>L(e,(e=>Ce(e,t))))(e,r).bind((e=>((e,t,o)=>Gt(e).bind((n=>((e,t,o,n)=>tn(e,t,Re).bind((t=>{const r=o>0?t.row+t.rowspan-1:t.row,s=n>0?t.column+t.colspan-1:t.column;return en(e,r+o,s+n).map((e=>e.element))})))(ps(n),e,t,o))))(e,t,o).bind((e=>((e,t)=>ht(e,"table").bind((o=>bt(o,t).bind((t=>Ts(t,e).bind((e=>e.boxes.map((t=>({boxes:t,start:e.start,finish:e.finish}))))))))))(e,n))))),ks=(e,t)=>Rs(e,t),Es=(e,t,o)=>Ds(e,t,o).bind((t=>{const o=t=>Re(e,t),n="thead,tfoot,tbody,table",r=ht(t.first,n,o),s=ht(t.last,n,o);return r.bind((e=>s.bind((o=>Re(e,o)?((e,t,o)=>((e,t,o)=>ds(e,t,o).bind((t=>((e,t)=>{let o=!0;const n=b(ms,t);for(let r=t.startRow;r<=t.finishRow;r++)for(let s=t.startCol;s<=t.finishCol;s++)o=o&&en(e,r,s).exists(n);return o?C.some(t):C.none()})(e,t))))(ps(e),t,o))(t.table,t.first,t.last):C.none()))))})),Ns=h,Bs=e=>{const t=(e,t)=>be(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&P(e,(e=>t(e,"rowspan")||t(e,"colspan")))?C.some(e):C.none()},_s=(e,t,o)=>t.length<=1?C.none():Es(e,o.firstSelectedSelector,o.lastSelectedSelector).map((e=>({bounds:e,cells:t}))),zs="data-mce-selected",As="data-mce-first-selected",Ls="data-mce-last-selected",Ws="["+zs+"]",Ms={selected:zs,selectedSelector:"td["+zs+"],th["+zs+"]",firstSelected:As,firstSelectedSelector:"td["+As+"],th["+As+"]",lastSelected:Ls,lastSelectedSelector:"td["+Ls+"],th["+Ls+"]"},js=(e,t,o)=>({element:o,mergable:_s(t,e,Ms),unmergable:Bs(e),selection:Ns(e)}),Ps=e=>(t,o)=>{const n=ne(t),r="col"===n||"colgroup"===n?Gt(s=t).bind((e=>ks(e,Ms.firstSelectedSelector))).fold(g(s),(e=>e[0])):t;var s;return wt(r,e,o)},Is=Ps("th,td,caption"),Fs=Ps("th,td"),Hs=e=>{return t=e.model.table.getSelectedCells(),E(t,xe.fromDom);var t},$s=(e,t)=>{e.on("BeforeGetContent",(t=>{const o=o=>{t.preventDefault(),(e=>Gt(e[0]).map((e=>{const t=((e,t)=>{const o=e=>Ce(e.element,t),n=Ye(e),r=Xt(n),s=mr(e),l=Zo(r),a=((e,t)=>{const o=e.grid.columns;let n=e.grid.rows,r=o,s=0,l=0;const a=[],c=[];return G(e.access,(e=>{if(a.push(e),t(e)){c.push(e);const t=e.row,o=t+e.rowspan-1,a=e.column,i=a+e.colspan-1;ts&&(s=o),al&&(l=i)}})),((e,t,o,n,r,s)=>({minRow:e,minCol:t,maxRow:o,maxCol:n,allCells:r,selectedCells:s}))(n,r,s,l,a,c)})(l,o),c="th:not("+t+"),td:not("+t+")",i=$t(n,"th,td",(e=>Ce(e,c)));N(i,qe),((e,t,o,n)=>{const r=_(e,(e=>"colgroup"!==e.section)),s=t.grid.columns,l=t.grid.rows;for(let e=0;eo.maxRow||ao.maxCol||(en(t,e,a).filter(n).isNone()?fr(r,l,e):l=!0)}})(r,l,a,o);const m=((e,t,o,n)=>{if(0===n.minCol&&t.grid.columns===n.maxCol+1)return 0;const r=sr(t,e,o),s=A(r,((e,t)=>e+t),0),l=A(r.slice(n.minCol,n.maxCol+1),((e,t)=>e+t),0),a=l/s*o.pixelWidth()-o.pixelWidth();return o.getCellDelta(a)})(e,Xo(e),s,a);return((e,t,o,n)=>{G(o.columns,(e=>{(e.columnt.maxCol)&&qe(e.element)}));const r=_(Ht(e,"tr"),(e=>0===e.dom.childElementCount));N(r,qe),t.minCol!==t.maxCol&&t.minRow!==t.maxRow||N(Ht(e,"th,td"),(e=>{we(e,"rowspan"),we(e,"colspan")})),we(e,Uo),we(e,"data-snooker-col-series"),mr(e).adjustTableWidth(n)})(n,a,l,m),n})(e,Ws);return ts(t),[t]})))(o).each((o=>{t.content="text"===t.format?(e=>E(e,(e=>e.dom.innerText)).join(""))(o):((e,t)=>E(t,(t=>e.selection.serializer.serialize(t.dom,{}))).join(""))(e,o)}))};if(!0===t.selection){const t=(e=>_(Hs(e),(e=>Ce(e,Ms.selectedSelector))))(e);t.length>=1&&o(t)}})),e.on("BeforeSetContent",(o=>{if(!0===o.selection&&!0===o.paste){const n=Hs(e);H(n).each((n=>{Gt(n).each((r=>{const s=_(((e,t)=>{const o=document.createElement("div");return o.innerHTML=e,Le(xe.fromDom(o))})(o.content),(e=>"meta"!==ne(e))),l=ue("table");if(Gr(e)&&1===s.length&&l(s[0])){o.preventDefault();const l=xe.fromDom(e.getDoc()),a=_r(l),c=((e,t,o)=>({element:e,clipboard:t,generators:o}))(n,s[0],a);t.pasteCells(r,c).each((()=>{e.focus()}))}}))}))}}))},Vs=(e,t)=>({element:e,offset:t}),qs=(e,t,o)=>e.property().isText(t)&&0===e.property().getText(t).trim().length||e.property().isComment(t)?o(t).bind((t=>qs(e,t,o).orThunk((()=>C.some(t))))):C.none(),Us=(e,t)=>e.property().isText(t)?e.property().getText(t).length:e.property().children(t).length,Gs=(e,t)=>{const o=qs(e,t,e.query().prevSibling).getOr(t);if(e.property().isText(o))return Vs(o,Us(e,o));const n=e.property().children(o);return n.length>0?Gs(e,n[n.length-1]):Vs(o,Us(e,o))},Ks=Gs,Ys=ws(),Js=(e,t)=>{if(!jt(e)){const o=(e=>Un(e).bind((e=>{return t=e,o=["fixed","relative","empty"],C.from(Ln.exec(t)).bind((e=>{const t=Number(e[1]),n=e[2];return((e,t)=>O(t,(t=>O(An[t],(t=>e===t)))))(n,o)?C.some({value:t,unit:n}):C.none()}));var t,o})))(e);o.each((o=>{const n=o.value/2;Jn(e,n,o.unit),Jn(t,n,o.unit)}))}},Qs=e=>E(e,g(0)),Xs=(e,t,o,n,r)=>r(e.slice(0,t)).concat(n).concat(r(e.slice(o))),Zs=e=>(t,o,n,r)=>{if(e(n)){const e=Math.max(r,t[o]-Math.abs(n)),s=Math.abs(e-t[o]);return n>=0?s:-s}return n},el=Zs((e=>e<0)),tl=Zs(x),ol=()=>{const e=(e,t,o,n)=>{const r=(100+o)/100,s=Math.max(n,(e[t]+o)/r);return E(e,((e,o)=>(o===t?s:e/r)-e))},t=(t,o,n,r,s,l)=>l?e(t,o,r,s):((e,t,o,n,r)=>{const s=el(e,t,n,r);return Xs(e,t,o+1,[s,0],Qs)})(t,o,n,r,s);return{resizeTable:(e,t)=>e(t),clampTableDelta:el,calcLeftEdgeDeltas:t,calcMiddleDeltas:(e,o,n,r,s,l,a)=>t(e,n,r,s,l,a),calcRightEdgeDeltas:(t,o,n,r,s,l)=>{if(l)return e(t,n,r,s);{const e=el(t,n,r,s);return Qs(t.slice(0,n)).concat([e])}},calcRedestributedWidths:(e,t,o,n)=>{if(n){const n=(t+o)/t,r=E(e,(e=>e/n));return{delta:100*n-100,newSizes:r}}return{delta:o,newSizes:e}}}},nl=()=>{const e=(e,t,o,n,r)=>{const s=tl(e,n>=0?o:t,n,r);return Xs(e,t,o+1,[s,-s],Qs)};return{resizeTable:(e,t,o)=>{o&&e(t)},clampTableDelta:(e,t,o,n,r)=>{if(r){if(o>=0)return o;{const t=A(e,((e,t)=>e+t-n),0);return Math.max(-t,o)}}return el(e,t,o,n)},calcLeftEdgeDeltas:e,calcMiddleDeltas:(t,o,n,r,s,l)=>e(t,n,r,s,l),calcRightEdgeDeltas:(e,t,o,n,r,s)=>{if(s)return Qs(e);{const t=n/e.length;return E(e,g(t))}},calcRedestributedWidths:(e,t,o,n)=>({delta:0,newSizes:e})}},rl=e=>Xo(e).grid,sl=ue("th"),ll=e=>P(e,(e=>sl(e.element))),al=(e,t)=>e&&t?"sectionCells":e?"section":"cells",cl=e=>{const t="thead"===e.section,o=vt(il(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:al(t,o)}:{type:"body"}},il=e=>{const t=_(e,(e=>sl(e.element)));return 0===t.length?C.some("td"):t.length===e.length?C.some("th"):C.none()},ml=(e,t,o)=>et(o(e.element,t),!0,e.isLocked),dl=(e,t)=>e.section!==t?tt(e.element,e.cells,t,e.isNew):e,ul=()=>({transformRow:dl,transformCell:(e,t,o)=>{const n=o(e.element,t),r="td"!==ne(n)?((e,t)=>{const o=Je(e,"td");je(e,o);const n=Le(e);return $e(o,n),qe(e),o})(n):n;return et(r,e.isNew,e.isLocked)}}),fl=()=>({transformRow:dl,transformCell:ml}),gl=()=>({transformRow:(e,t)=>dl(e,"thead"===t?"tbody":t),transformCell:ml}),hl=ul,pl=fl,bl=gl,wl=()=>({transformRow:h,transformCell:ml}),vl=(e,t,o,n)=>{o===n?we(e,t):ge(e,t,o)},yl=(e,t,o)=>{$(mt(e,t)).fold((()=>Pe(e,o)),(e=>je(e,o)))},xl=(e,t)=>{const o=[],n=[],r=e=>E(e,(e=>{e.isNew&&o.push(e.element);const t=e.element;return Ve(t),N(e.cells,(e=>{e.isNew&&n.push(e.element),vl(e.element,"colspan",e.colspan,1),vl(e.element,"rowspan",e.rowspan,1),Ie(t,e.element)})),t})),s=e=>j(e,(e=>E(e.cells,(e=>(vl(e.element,"span",e.colspan,1),e.element))))),l=(t,o)=>{const n=((e,t)=>{const o=pt(e,t).getOrThunk((()=>{const o=xe.fromTag(t,ke(e).dom);return"thead"===t?yl(e,"caption,colgroup",o):"colgroup"===t?yl(e,"caption",o):Ie(e,o),o}));return Ve(o),o})(e,o),l=("colgroup"===o?s:r)(t);$e(n,l)},a=(t,o)=>{t.length>0?l(t,o):(t=>{pt(e,t).each(qe)})(o)},c=[],i=[],m=[],d=[];return N(t,(e=>{switch(e.section){case"thead":c.push(e);break;case"tbody":i.push(e);break;case"tfoot":m.push(e);break;case"colgroup":d.push(e)}})),a(d,"colgroup"),a(c,"thead"),a(i,"tbody"),a(m,"tfoot"),{newRows:o,newCells:n}},Cl=(e,t)=>{if(0===e.length)return 0;const o=e[0];return W(e,(e=>!t(o.element,e.element))).getOr(e.length)},Sl=(e,t)=>{const o=E(e,(e=>E(e.cells,y)));return E(e,((n,r)=>{const s=j(n.cells,((n,s)=>{if(!1===o[r][s]){const m=((e,t,o,n)=>{const r=((e,t)=>e[t])(e,t),s="colgroup"===r.section,l=Cl(r.cells.slice(o),n),a=s?1:Cl(((e,t)=>E(e,(e=>Fo(e,t))))(e.slice(t),o),n);return{colspan:l,rowspan:a}})(e,r,s,t);return((e,t,n,r)=>{for(let s=e;s({element:e,cells:t,section:o,isNew:n}))(n.element,s,n.section,n.isNew)}))},Tl=(e,t,o)=>{const n=[];N(e.colgroups,(r=>{const s=[];for(let n=0;net(e.element,o,!1))).getOrThunk((()=>et(t.colGap(),!0,!1)));s.push(r)}n.push(tt(r.element,s,"colgroup",o))}));for(let r=0;ret(e.element,o,e.isLocked))).getOrThunk((()=>et(t.gap(),!0,!1)));s.push(l)}const l=e.all[r],a=tt(l.element,s,l.section,o);n.push(a)}return n},Rl=e=>Sl(e,Re),Dl=(e,t)=>V(e.all,(e=>L(e.cells,(e=>Re(t,e.element))))),Ol=(e,t,o)=>{const n=E(t.selection,(t=>Vt(t).bind((t=>Dl(e,t))).filter(o))),r=yt(n);return xt(r.length>0,r)},kl=(e,t,o,n,r)=>(s,l,a,c)=>{const i=Xo(s),m=C.from(null==c?void 0:c.section).getOrThunk(wl);return t(i,l).map((t=>{const o=((e,t)=>Tl(e,t,!1))(i,a),n=e(o,t,Re,r(a),m),s=Ko(n.grid);return{info:t,grid:Rl(n.grid),cursor:n.cursor,lockedColumns:s}})).bind((e=>{const t=xl(s,e.grid),r=C.from(null==c?void 0:c.sizing).getOrThunk((()=>mr(s))),l=C.from(null==c?void 0:c.resize).getOrThunk(nl);return o(s,e.grid,e.info,{sizing:r,resize:l,section:m}),n(s),we(s,Uo),e.lockedColumns.length>0&&ge(s,Uo,e.lockedColumns.join(",")),C.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})}))},El=(e,t)=>Ol(e,t,x).map((e=>({cells:e,generators:t.generators,clipboard:t.clipboard}))),Nl=(e,t)=>Ol(e,t,x),Bl=(e,t)=>Ol(e,t,(e=>!e.isLocked)),_l=(e,t)=>P(t,(t=>((e,t)=>Dl(e,t).exists((e=>!e.isLocked)))(e,t))),zl=(e,t,o,n)=>{const r=Vo(e).rows;let s=!0;for(let e=0;e{const t=t=>t(e),o=g(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:x,isError:y,map:t=>Wl.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>C.some(e)};return r},Ll=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:y,isError:x,map:t,mapError:t=>Wl.error(t(e)),bind:t,exists:y,forall:x,getOr:h,or:h,getOrThunk:v,orThunk:v,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:f,toOptional:C.none};var n;return o},Wl={value:Al,error:Ll,fromOption:(e,t)=>e.fold((()=>Ll(t)),Al)},Ml=(e,t)=>({rowDelta:0,colDelta:$o(e[0])-$o(t[0])}),jl=(e,t)=>({rowDelta:e.length-t.length,colDelta:0}),Pl=(e,t,o,n)=>{const r="colgroup"===t.section?o.col:o.cell;return k(e,(e=>et(r(),!0,n(e))))},Il=(e,t,o,n)=>{const r=e[e.length-1];return e.concat(k(t,(()=>{const e="colgroup"===r.section?o.colgroup:o.row,t=qo(r,e,h),s=Pl(t.cells.length,t,o,(e=>X(n,e.toString())));return Io(t,s)})))},Fl=(e,t,o,n)=>E(e,(e=>{const r=Pl(t,e,o,y);return Mo(e,n,r)})),Hl=(e,t,o)=>{const n=t.colDelta<0?Fl:h,r=t.rowDelta<0?Il:h,s=Ko(e),l=$o(e[0]),a=O(s,(e=>e===l-1)),c=n(e,Math.abs(t.colDelta),o,a?l-1:l),i=Ko(c);return r(c,Math.abs(t.rowDelta),o,I(i,x))},$l=(e,t,o,n)=>{const r=b(n,Fo(e[t],o).element),s=e[t];return e.length>1&&$o(s)>1&&(o>0&&r(Ho(s,o-1))||o0&&r(Ho(e[t-1],o))||t_(o,(o=>o>=e.column&&o<=$o(t[0])+e.column)),ql=(e,t,o,n,r)=>{((e,t,o,n)=>{t>0&&t{const r=e.cells[t-1];let s=0;const l=n();for(;e.cells.length>t+s&&o(r.element,e.cells[t+s].element);)Po(e,t+s,et(l,!0,e.cells[t+s].isLocked)),s++}))})(t,e,r,n.cell);const s=jl(o,t),l=Hl(o,s,n),a=jl(t,l),c=Hl(t,a,n);return E(c,((t,o)=>Mo(t,e,l[o].cells)))},Ul=(e,t,o,n,r)=>{((e,t,o,n)=>{const r=Vo(e).rows;if(t>0&&tA(e,((e,o)=>O(e,(e=>t(e.element,o.element)))?e:e.concat([o])),[]))(r[t-1].cells,o);N(e,(e=>{let s=C.none();for(let l=t;l{Po(a,t,et(e,!0,c.isLocked))})))}}))}})(t,e,r,n.cell);const s=Ko(t),l=Ml(t,o),a={...l,colDelta:l.colDelta-s.length},c=Hl(t,a,n),{cols:i,rows:m}=Vo(c),d=Ko(c),u=Ml(o,t),f={...u,colDelta:u.colDelta+d.length},g=(p=n,b=d,E(o,(e=>A(b,((t,o)=>{const n=Pl(1,e,p,x)[0];return jo(t,o,n)}),e)))),h=Hl(g,f,n);var p,b;return[...i,...m.slice(0,e),...h,...m.slice(e,m.length)]},Gl=(e,t,o,n,r)=>{const{rows:s,cols:l}=Vo(e),a=s.slice(0,t),c=s.slice(t);return[...l,...a,((e,t,o,n)=>qo(e,(e=>n(e,o)),t))(s[o],((e,o)=>t>0&&tE(e,(e=>{const s=t>0&&t<$o(e)&&n(Ho(e,t-1),Ho(e,t)),l=((e,t,o,n,r,s,l)=>{if("colgroup"!==o&&n)return Fo(e,t);{const t=Fo(e,r);return et(l(t.element,s),!0,!1)}})(e,t,e.section,s,o,n,r);return jo(e,t,l)})),Yl=(e,t,o,n)=>((e,t,o,n)=>void 0!==Ho(e[t],o)&&t>0&&n(Ho(e[t-1],o),Ho(e[t],o)))(e,t,o,n)||((e,t,o)=>t>0&&o(Ho(e,t-1),Ho(e,t)))(e[t],o,n),Jl=(e,t,o,n)=>{const r=e=>(e=>"row"===e?(e=>Mt(e,"rowspan")>1)(t):jt(t))(e)?`${e}group`:e;return e?sl(t)?r(o):null:n&&sl(t)?r("row"===o?"col":"row"):null},Ql=(e,t,o)=>et(o(e.element,t),!0,e.isLocked),Xl=(e,t,o,n,r,s,l)=>E(e,((e,a)=>((e,c)=>{const i=e.cells,m=E(i,((e,c)=>{if((e=>O(t,(t=>o(e.element,t.element))))(e)){const t=l(e,a,c)?r(e,o,n):e;return s(t,a,c).each((e=>{var o,n;o=t.element,n={scope:C.from(e)},G(n,((e,t)=>{e.fold((()=>{we(o,t)}),(e=>{fe(o.dom,t,e)}))}))})),t}return e}));return tt(e.element,m,e.section,e.isNew)})(e))),Zl=(e,t,o)=>j(e,((n,r)=>Yl(e,r,t,o)?[]:[Fo(n,t)])),ea=(e,t,o,n,r)=>{const s=Vo(e).rows,l=j(t,(e=>Zl(s,e,n))),a=E(s,(e=>ll(e.cells))),c=((e,t)=>P(t,h)&&ll(e)?x:(e,o,n)=>!("th"===ne(e.element)&&t[o]))(l,a),i=((e,t)=>(o,n)=>C.some(Jl(e,o.element,"row",t[n])))(o,a);return Xl(e,l,n,r,Ql,i,c)},ta=(e,t,o,n)=>{const r=Vo(e).rows,s=E(t,(e=>Fo(r[e.row],e.column)));return Xl(e,s,o,n,Ql,C.none,x)},oa=e=>{if(!l(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return N(e,((n,r)=>{const s=q(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],c=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!l(c))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==c.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+c.length+" ("+c+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const n=q(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!P(t,(e=>D(n,e))))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:a,params:o})}}}})),o},na={...oa([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},ra=(e,t,o)=>{const n=((e,t)=>sn(e)?((e,t)=>{const o=rn(e);return E(o,((e,o)=>({element:e.element,width:t[o],colspan:e.colspan})))})(e,t):((e,t)=>{const o=nn(e);return E(o,(e=>{const o=((e,t,o)=>{let n=0;for(let r=e;r{o.setElementWidth(e.element,e.width)}))},sa=(e,t,o,n,r)=>{const s=Xo(e),l=r.getCellDelta(t),a=r.getWidths(s,r),c=o===s.grid.columns-1,i=n.clampTableDelta(a,o,l,r.minCellWidth(),c),m=((e,t,o,n,r)=>{const s=e.slice(0),l=((e,t)=>0===e.length?na.none():1===e.length?na.only(0):0===t?na.left(0,1):t===e.length-1?na.right(t-1,t):t>0&&tn.singleColumnWidth(s[e],o)),((e,t)=>r.calcLeftEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)),((e,t,l)=>r.calcMiddleDeltas(s,e,t,l,o,n.minCellWidth(),n.isRelative)),((e,t)=>r.calcRightEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)))})(a,o,i,r,n),d=E(m,((e,t)=>e+a[t]));ra(s,d,r),n.resizeTable(r.adjustTableWidth,i,c)},la=(e,t,o)=>{const n=Xo(e),r=((e,t)=>lr(e,t,Yn,(e=>e.getOrThunk(Ft))))(n,e),s=E(r,((e,n)=>o===n?Math.max(t+e,Ft()):e)),l=((e,t)=>E(e.all,((e,o)=>({element:e.element,height:t[o]}))))(n,s);N(l,(e=>{$n(e.element,e.height)})),N(nn(n),(e=>{(e=>{Lt(e,"height")})(e.element)}));const a=z(s,((e,t)=>e+t),0);$n(e,a)},aa=e=>A(e,((e,t)=>O(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),ca=ue("col"),ia=ue("colgroup"),ma=e=>"tr"===ne(e)||ia(e),da=e=>({element:e,colspan:Wt(e,"colspan",1),rowspan:Wt(e,"rowspan",1)}),ua=e=>be(e,"scope").map((e=>e.substr(0,3))),fa=(e,t=da)=>{const o=o=>{if(ma(o))return ia((r={element:o}).element)?e.colgroup(r):e.row(r);{const r=o,s=(t=>ca(t.element)?e.col(t):e.cell(t))(t(r));return n=C.some({item:r,replacement:s}),s}var r};let n=C.none();return{getOrInit:(e,t)=>n.fold((()=>o(e)),(n=>t(e,n.item)?n.replacement:o(e)))}},ga=e=>t=>{const o=[],n=n=>{const r="td"===e?{scope:null}:{},s=t.replace(n,e,r);return o.push({item:n,sub:s}),s};return{replaceOrInit:(e,t)=>{if(ma(e)||ca(e))return e;{const r=e;return((e,t)=>L(o,(o=>t(o.item,e))))(r,t).fold((()=>n(r)),(o=>t(e,o.item)?o.sub:n(r)))}}}},ha=e=>({unmerge:t=>{const o=ua(t);return o.each((e=>ge(t,"scope",e))),()=>{const n=e.cell({element:t,colspan:1,rowspan:1});return Lt(n,"width"),Lt(t,"width"),o.each((e=>ge(n,"scope",e))),n}},merge:e=>(Lt(e[0],"width"),(()=>{const t=yt(E(e,ua));if(0===t.length)return C.none();{const e=t[0],o=["row","col"];return O(t,(t=>t!==e&&D(o,t)))?C.none():C.from(e)}})().fold((()=>we(e[0],"scope")),(t=>ge(e[0],"scope",t+"group"))),g(e[0]))}),pa=["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"],ba=ws(),wa=e=>((e,t)=>{const o=e.property().name(t);return D(pa,o)})(ba,e),va=e=>((e,t)=>{const o=e.property().name(t);return D(["ol","ul"],o)})(ba,e),ya=e=>{const t=ue("br"),o=e=>Cr(e).bind((o=>{const n=Ae(o).map((e=>!!wa(e)||!!((e,t)=>D(["br","img","hr","input"],e.property().name(t)))(ba,e)&&"img"!==ne(e))).getOr(!1);return Ne(o).map((r=>{return!0===n||("li"===ne(s=r)||ft(s,va).isSome())||t(o)||wa(r)&&!Re(e,r)?[]:[xe.fromTag("br")];var s}))})).getOr([]),n=(()=>{const n=j(e,(e=>{const n=Le(e);return(e=>P(e,(e=>t(e)||ie(e)&&0===hr(e).trim().length)))(n)?[]:n.concat(o(e))}));return 0===n.length?[xe.fromTag("br")]:n})();Ve(e[0]),$e(e[0],n)},xa=e=>Qr(e,!0),Ca=e=>{0===qt(e).length&&qe(e)},Sa=(e,t)=>({grid:e,cursor:t}),Ta=(e,t,o)=>{const n=((e,t,o)=>{var n,r;const s=Vo(e).rows;return C.from(null===(r=null===(n=s[t])||void 0===n?void 0:n.cells[o])||void 0===r?void 0:r.element).filter(xa).orThunk((()=>(e=>V(e,(e=>V(e.cells,(e=>{const t=e.element;return xt(xa(t),t)})))))(s)))})(e,t,o);return Sa(e,n)},Ra=e=>A(e,((e,t)=>O(e,(e=>e.row===t.row))?e:e.concat([t])),[]).sort(((e,t)=>e.row-t.row)),Da=(e,t)=>(o,n,r,s,l)=>{const a=Ra(n),c=E(a,(e=>e.row)),i=((e,t,o,n,r,s,l)=>{const{cols:a,rows:c}=Vo(e),i=c[t[0]],m=j(t,(e=>((e,t,o)=>{const n=e[t];return j(n.cells,((n,r)=>Yl(e,t,r,o)?[]:[n]))})(c,e,r))),d=E(i.cells,((e,t)=>ll(Zl(c,t,r)))),u=[...c];N(t,(e=>{u[e]=l.transformRow(c[e],o)}));const f=[...a,...u],g=((e,t)=>P(t,h)&&ll(e.cells)?x:(e,o,n)=>!("th"===ne(e.element)&&t[n]))(i,d),p=((e,t)=>(o,n,r)=>C.some(Jl(e,o.element,"col",t[r])))(n,d);return Xl(f,m,r,s,l.transformCell,p,g)})(o,c,e,t,r,s.replaceOrInit,l);return Ta(i,n[0].row,n[0].column)},Oa=Da("thead",!0),ka=Da("tbody",!1),Ea=Da("tfoot",!1),Na=(e,t,o)=>{const n=((e,t)=>Jt(e,(()=>t)))(e,o.section),r=Zo(n);return Tl(r,t,!0)},Ba=(e,t,o,n)=>((e,t,o,n)=>{const r=Zo(t),s=n.getWidths(r,n);ra(r,s,n)})(0,t,0,n.sizing),_a=(e,t,o,n)=>((e,t,o,n,r)=>{const s=Zo(t),l=n.getWidths(s,n),a=n.pixelWidth(),{newSizes:c,delta:i}=r.calcRedestributedWidths(l,a,o.pixelDelta,n.isRelative);ra(s,c,n),n.adjustTableWidth(i)})(0,t,o,n.sizing,n.resize),za=(e,t)=>O(t,(e=>0===e.column&&e.isLocked)),Aa=(e,t)=>O(t,(t=>t.column+t.colspan>=e.grid.columns&&t.isLocked)),La=(e,t)=>{const o=an(e),n=aa(t);return A(n,((e,t)=>e+o[t.column].map(Lo).getOr(0)),0)},Wa=e=>(t,o)=>Nl(t,o).filter((o=>!(e?za:Aa)(t,o))).map((e=>({details:e,pixelDelta:La(t,e)}))),Ma=e=>(t,o)=>El(t,o).filter((o=>!(e?za:Aa)(t,o.cells))),ja=ga("th"),Pa=ga("td"),Ia=kl(((e,t,o,n)=>{const r=t[0].row,s=Ra(t),l=z(s,((e,t)=>({grid:Gl(e.grid,r,t.row+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return Ta(l,r,t[0].column)}),Nl,f,f,fa),Fa=kl(((e,t,o,n)=>{const r=Ra(t),s=r[r.length-1],l=s.row+s.rowspan,a=z(r,((e,t)=>Gl(e,l,t.row,o,n.getOrInit)),e);return Ta(a,l,t[0].column)}),Nl,f,f,fa),Ha=kl(((e,t,o,n)=>{const r=t.details,s=aa(r),l=s[0].column,a=z(s,((e,t)=>({grid:Kl(e.grid,l,t.column+e.delta,o,n.getOrInit),delta:e.delta+1})),{grid:e,delta:0}).grid;return Ta(a,r[0].row,l)}),Wa(!0),_a,f,fa),$a=kl(((e,t,o,n)=>{const r=t.details,s=r[r.length-1],l=s.column+s.colspan,a=aa(r),c=z(a,((e,t)=>Kl(e,l,t.column,o,n.getOrInit)),e);return Ta(c,r[0].row,l)}),Wa(!1),_a,f,fa),Va=kl(((e,t,o,n)=>{const r=aa(t.details),s=((e,t)=>j(e,(e=>{const o=e.cells,n=z(t,((e,t)=>t>=0&&t0?[tt(e.element,n,e.section,e.isNew)]:[]})))(e,E(r,(e=>e.column))),l=s.length>0?s[0].cells.length-1:0;return Ta(s,r[0].row,Math.min(r[0].column,l))}),((e,t)=>Bl(e,t).map((t=>({details:t,pixelDelta:-La(e,t)})))),_a,Ca,fa),qa=kl(((e,t,o,n)=>{const r=Ra(t),s=((e,t,o)=>{const{rows:n,cols:r}=Vo(e);return[...r,...n.slice(0,t),...n.slice(o+1)]})(e,r[0].row,r[r.length-1].row),l=Math.max(Vo(s).rows.length-1,0);return Ta(s,Math.min(t[0].row,l),t[0].column)}),Nl,f,Ca,fa),Ua=kl(((e,t,o,n)=>{const r=aa(t),s=E(r,(e=>e.column)),l=ea(e,s,!0,o,n.replaceOrInit);return Ta(l,t[0].row,t[0].column)}),Bl,f,f,ja),Ga=kl(((e,t,o,n)=>{const r=aa(t),s=E(r,(e=>e.column)),l=ea(e,s,!1,o,n.replaceOrInit);return Ta(l,t[0].row,t[0].column)}),Bl,f,f,Pa),Ka=kl(Oa,Bl,f,f,ja),Ya=kl(ka,Bl,f,f,Pa),Ja=kl(Ea,Bl,f,f,Pa),Qa=kl(((e,t,o,n)=>{const r=ta(e,t,o,n.replaceOrInit);return Ta(r,t[0].row,t[0].column)}),Bl,f,f,ja),Xa=kl(((e,t,o,n)=>{const r=ta(e,t,o,n.replaceOrInit);return Ta(r,t[0].row,t[0].column)}),Bl,f,f,Pa),Za=kl(((e,t,o,n)=>{const r=t.cells;ya(r);const s=((e,t,o,n)=>{const r=Vo(e).rows;if(0===r.length)return e;for(let e=t.startRow;e<=t.finishRow;e++)for(let o=t.startCol;o<=t.finishCol;o++){const t=r[e],s=Fo(t,o).isLocked;Po(t,o,et(n(),!1,s))}return e})(e,t.bounds,0,n.merge(r));return Sa(s,C.from(r[0]))}),((e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>_l(e,t.cells)))),Ba,f,ha),ec=kl(((e,t,o,n)=>{const r=z(t,((e,t)=>zl(e,t,o,n.unmerge(t))),e);return Sa(r,C.from(t[0]))}),((e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>_l(e,t)))),Ba,f,ha),tc=kl(((e,t,o,n)=>{const r=((e,t)=>{const o=Xo(e);return Tl(o,t,!0)})(t.clipboard,t.generators);var s,l;return((e,t,o,n,r)=>{const s=Ko(t),l=((e,t,o)=>{const n=$o(t[0]),r=Vo(t).cols.length+e.row,s=k(n-e.column,(t=>t+e.column));return{row:r,column:L(s,(e=>P(o,(t=>t!==e)))).getOr(n-1)}})(e,t,s),a=Vo(o).rows,c=Vl(l,a,s),i=((e,t,o)=>{if(e.row>=t.length||e.column>$o(t[0]))return Wl.error("invalid start address out of table bounds, row: "+e.row+", column: "+e.column);const n=t.slice(e.row),r=n[0].cells.slice(e.column),s=$o(o[0]),l=o.length;return Wl.value({rowDelta:n.length-l,colDelta:r.length-s})})(l,t,a);return i.map((e=>{const o={...e,colDelta:e.colDelta-c.length},s=Hl(t,o,n),i=Ko(s),m=Vl(l,a,i);return((e,t,o,n,r,s)=>{const l=e.row,a=e.column,c=l+o.length,i=a+$o(o[0])+s.length,m=I(s,x);for(let e=l;eSa(e,C.some(t.element))),(e=>Ta(e,t.row,t.column)))}),((e,t)=>Vt(t.element).bind((o=>Dl(e,o).map((e=>({...e,generators:t.generators,clipboard:t.clipboard})))))),Ba,f,fa),oc=kl(((e,t,o,n)=>{const r=Vo(e).rows,s=t.cells[0].column,l=r[t.cells[0].row],a=Na(t.clipboard,t.generators,l),c=ql(s,e,a,t.generators,o);return Ta(c,t.cells[0].row,t.cells[0].column)}),Ma(!0),f,f,fa),nc=kl(((e,t,o,n)=>{const r=Vo(e).rows,s=t.cells[t.cells.length-1].column+t.cells[t.cells.length-1].colspan,l=r[t.cells[0].row],a=Na(t.clipboard,t.generators,l),c=ql(s,e,a,t.generators,o);return Ta(c,t.cells[0].row,s)}),Ma(!1),f,f,fa),rc=kl(((e,t,o,n)=>{const r=Vo(e).rows,s=t.cells[0].row,l=r[s],a=Na(t.clipboard,t.generators,l),c=Ul(s,e,a,t.generators,o);return Ta(c,t.cells[0].row,t.cells[0].column)}),El,f,f,fa),sc=kl(((e,t,o,n)=>{const r=Vo(e).rows,s=t.cells[t.cells.length-1].row+t.cells[t.cells.length-1].rowspan,l=r[t.cells[0].row],a=Na(t.clipboard,t.generators,l),c=Ul(s,e,a,t.generators,o);return Ta(c,s,t.cells[0].column)}),El,f,f,fa),lc=(e,t)=>{const o=Xo(e);return Nl(o,t).bind((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=M(E(o.all,(e=>_(e.cells,(e=>e.column>=n&&e.column{const o=Xo(e);return Nl(o,t).bind(il).getOr("")},cc=(e,t)=>{const o=Xo(e);return Nl(o,t).bind((e=>{const t=e[e.length-1],n=e[0].row,r=t.row+t.rowspan;return(e=>{const t=E(e,(e=>cl(e).type)),o=D(t,"header"),n=D(t,"footer");if(o||n){const e=D(t,"body");return!o||e||n?o||e||!n?C.none():C.some("footer"):C.some("header")}return C.some("body")})(o.all.slice(n,r))})).getOr("")},ic=(e,t)=>e.dispatch("NewRow",{node:t}),mc=(e,t)=>e.dispatch("NewCell",{node:t}),dc=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},uc={structure:!1,style:!0},fc={structure:!0,style:!1},gc={structure:!0,style:!0},hc=(e,t)=>Hr(e)?ur(t):$r(e)?dr(t):mr(t),pc=(e,t,o)=>{const n=e=>"table"===ne(Zr(e)),r=Wr(e),s=Ir(e)?f:Js,l=t=>{switch(Mr(e)){case"section":return hl();case"sectionCells":return pl();case"cells":return bl();default:return((e,t)=>{var o;switch((o=Xo(e),V(o.all,(e=>{const t=cl(e);return"header"===t.type?C.from(t.subType):C.none()}))).getOr(t)){case"section":return ul();case"sectionCells":return fl();case"cells":return gl()}})(t,"section")}},a=(n,s,a,c)=>(i,m,d=!1)=>{ts(i);const u=xe.fromDom(e.getDoc()),f=Br(a,u,r),g={sizing:hc(e,i),resize:Ir(e)?ol():nl(),section:l(i)};return s(i)?n(i,m,f,g).bind((n=>{t.refresh(i.dom),N(n.newRows,(t=>{ic(e,t.dom)})),N(n.newCells,(t=>{mc(e,t.dom)}));const r=((t,n)=>n.cursor.fold((()=>{const n=qt(t);return H(n).filter(lt).map((n=>{o.clearSelectedCells(t.dom);const r=e.dom.createRng();return r.selectNode(n.dom),e.selection.setRng(r),ge(n,"data-mce-selected","1"),r}))}),(n=>{const r=Ks(Ys,n),s=e.dom.createRng();return s.setStart(r.element.dom,r.offset),s.setEnd(r.element.dom,r.offset),e.selection.setRng(s),o.clearSelectedCells(t.dom),C.some(s)})))(i,n);return lt(i)&&(ts(i),d||dc(e,i.dom,c)),r.map((e=>({rng:e,effect:c})))})):C.none()},c=a(qa,(t=>!n(e)||rl(t).rows>1),f,fc),i=a(Va,(t=>!n(e)||rl(t).columns>1),f,fc);return{deleteRow:c,deleteColumn:i,insertRowsBefore:a(Ia,x,f,fc),insertRowsAfter:a(Fa,x,f,fc),insertColumnsBefore:a(Ha,x,s,fc),insertColumnsAfter:a($a,x,s,fc),mergeCells:a(Za,x,f,fc),unmergeCells:a(ec,x,f,fc),pasteColsBefore:a(oc,x,f,fc),pasteColsAfter:a(nc,x,f,fc),pasteRowsBefore:a(rc,x,f,fc),pasteRowsAfter:a(sc,x,f,fc),pasteCells:a(tc,x,f,gc),makeCellsHeader:a(Qa,x,f,fc),unmakeCellsHeader:a(Xa,x,f,fc),makeColumnsHeader:a(Ua,x,f,fc),unmakeColumnsHeader:a(Ga,x,f,fc),makeRowsHeader:a(Ka,x,f,fc),makeRowsBody:a(Ya,x,f,fc),makeRowsFooter:a(Ja,x,f,fc),getTableRowType:cc,getTableCellType:ac,getTableColType:lc}},bc=(e,t,o)=>{const n=Wt(e,t,1);1===o||n<=1?we(e,t):ge(e,t,Math.min(o,n))},wc=(e,t)=>o=>{const n=o.column+o.colspan-1,r=o.column;return n>=e&&r{const n=o.substring(0,o.length-e.length),r=parseFloat(n);return n===r.toString()?t(r):vc.invalid(o)},xc={...vc,from:e=>Rt(e,"%")?yc("%",vc.percent,e):Rt(e,"px")?yc("px",vc.pixels,e):vc.invalid(e)},Cc=(e,t,o)=>{const n=xc.from(o),r=P(e,(e=>"0px"===e))?((e,t)=>{const o=e.fold((()=>g("")),(e=>g(e/t+"px")),(()=>g(100/t+"%")));return k(t,o)})(n,e.length):((e,t,o)=>e.fold((()=>t),(e=>((e,t,o)=>{const n=o/t;return E(e,(e=>xc.from(e).fold((()=>e),(e=>e*n+"px"),(e=>e/100*o+"px"))))})(t,o,e)),(e=>((e,t)=>E(e,(e=>xc.from(e).fold((()=>e),(e=>e/t*100+"%"),(e=>e+"%")))))(t,o))))(n,e,t);return Rc(r)},Sc=(e,t)=>0===e.length?t:z(e,((e,t)=>xc.from(t).fold(g(0),h,h)+e),0),Tc=(e,t)=>xc.from(e).fold(g(e),(e=>e+t+"px"),(e=>e+t+"%")),Rc=e=>{if(0===e.length)return e;const t=z(e,((e,t)=>{const o=xc.from(t).fold((()=>({value:t,remainder:0})),(e=>((e,t)=>{const o=Math.floor(e);return{value:o+"px",remainder:e-o}})(e)),(e=>({value:e+"%",remainder:0})));return{output:[o.value].concat(e.output),remainder:e.remainder+o.remainder}}),{output:[],remainder:0}),o=t.output;return o.slice(0,o.length-1).concat([Tc(o[o.length-1],Math.round(t.remainder))])},Dc=xc.from,Oc=(e,t,o)=>{const n=Xo(e),r=n.all,s=nn(n),l=rn(n);t.each((t=>{const o=Dc(t).fold(g("px"),g("px"),g("%")),r=Ao(e),a=((e,t)=>nr(e,t,er,rr))(n,e),c=Cc(a,r,t);sn(n)?((e,t,o)=>{N(t,((t,n)=>{const r=Sc([e[n]],It());Nt(t.element,"width",r+o)}))})(c,l,o):((e,t,o)=>{N(t,(t=>{const n=e.slice(t.column,t.colspan+t.column),r=Sc(n,It());Nt(t.element,"width",r+o)}))})(c,s,o),Nt(e,"width",t)})),o.each((t=>{const o=gn(e),l=((e,t)=>lr(e,t,tr,rr))(n,e);((e,t,o)=>{N(o,(e=>{Lt(e.element,"height")})),N(t,((t,o)=>{Nt(t.element,"height",e[o])}))})(Cc(l,o,t),r,s),Nt(e,"height",t)}))},kc=e=>Un(e).exists((e=>Wn.test(e))),Ec=e=>Un(e).exists((e=>Mn.test(e))),Nc=e=>Un(e).isNone(),Bc=e=>{we(e,"width"),we(e,"height")},_c=e=>{const t=Qn(e);Oc(e,C.some(t),C.none()),Bc(e)},zc=e=>{const t=(e=>Ao(e)+"px")(e);Oc(e,C.some(t),C.none()),Bc(e)},Ac=e=>{Lt(e,"width");const t=Ut(e),o=t.length>0?t:qt(e);N(o,(e=>{Lt(e,"width"),Bc(e)})),Bc(e)},Lc={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},colGroups:!1},Wc=(e,t,o,n)=>k(e,(e=>((e,t,o,n)=>{const r=xe.fromTag("tr");for(let s=0;s{e.selection.select(t.dom,!0),e.selection.collapse(!0)},jc=(e,t,o,n,s)=>{const l=(e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>Vr(e)||!Ur(e)?t:$r(e)?{...t,width:Lr(e)}:{...t,width:Ar})(e,o)})(e),a={styles:l,attributes:Kr(e),colGroups:Yr(e)};return e.undoManager.ignore((()=>{const r=((e,t,o,n,r,s=Lc)=>{const l=xe.fromTag("table"),a="cells"!==r;Bt(l,s.styles),he(l,s.attributes),s.colGroups&&Ie(l,(e=>{const t=xe.fromTag("colgroup");return k(e,(()=>Ie(t,xe.fromTag("col")))),t})(t));const c=Math.min(e,o);if(a&&o>0){const e=xe.fromTag("thead");Ie(l,e);const s=Wc(o,t,"sectionCells"===r?c:0,n);$e(e,s)}const i=xe.fromTag("tbody");Ie(l,i);const m=Wc(a?e-c:e,t,a?0:o,n);return $e(i,m),l})(o,t,s,n,Mr(e),a);ge(r,"data-mce-id","__mce");const l=(e=>{const t=xe.fromTag("div"),o=xe.fromDom(e.dom.cloneNode(!0));return Ie(t,o),(e=>e.dom.innerHTML)(t)})(r);e.insertContent(l),e.addVisual()})),bt(Zr(e),'table[data-mce-id="__mce"]').map((t=>($r(e)?zc(t):Vr(e)?Ac(t):(Hr(e)||(e=>r(e)&&-1!==e.indexOf("%"))(l.width))&&_c(t),ts(t),we(t,"data-mce-id"),((e,t)=>{N(dt(t,"tr"),(t=>{ic(e,t.dom),N(dt(t,"th,td"),(t=>{mc(e,t.dom)}))}))})(e,t),((e,t)=>{bt(t,"td,th").each(b(Mc,e))})(e,t),t.dom))).getOrNull()};var Pc=tinymce.util.Tools.resolve("tinymce.FakeClipboard");const Ic="x-tinymce/dom-table-",Fc=Ic+"rows",Hc=Ic+"columns",$c=e=>{const t=Pc.FakeClipboardItem(e);Pc.write([t])},Vc=e=>{var t;const o=null!==(t=Pc.read())&&void 0!==t?t:[];return V(o,(t=>C.from(t.getType(e))))},qc=e=>{Vc(e).isSome()&&Pc.clear()},Uc=e=>{e.fold(Kc,(e=>$c({[Fc]:e})))},Gc=()=>Vc(Fc),Kc=()=>qc(Fc),Yc=e=>{e.fold(Qc,(e=>$c({[Hc]:e})))},Jc=()=>Vc(Hc),Qc=()=>qc(Hc),Xc=e=>Is(os(e),es(e)).filter(cs),Zc=(e,t)=>{const o=es(e),n=e=>Gt(e,o),l=t=>(e=>Fs(os(e),es(e)).filter(cs))(e).bind((e=>n(e).map((o=>t(o,e))))),a=t=>{e.focus()},c=(t,o=!1)=>l(((n,r)=>{const s=js(Hs(e),n,r);t(n,s,o).each(a)})),i=()=>l(((t,o)=>((e,t,o)=>{const n=Xo(e);return Nl(n,t).bind((e=>{const t=Tl(n,o,!1),r=Vo(t).rows.slice(e[0].row,e[e.length-1].row+e[e.length-1].rowspan),s=j(r,(e=>{const t=_(e.cells,(e=>!e.isLocked));return t.length>0?[{...e,cells:t}]:[]})),l=Rl(s);return xt(l.length>0,l)})).map((e=>E(e,(e=>{const t=Ke(e.element);return N(e.cells,(e=>{const o=Ye(e.element);vl(o,"colspan",e.colspan,1),vl(o,"rowspan",e.rowspan,1),Ie(t,o)})),t}))))})(t,js(Hs(e),t,o),Br(f,xe.fromDom(e.getDoc()),C.none())))),m=()=>l(((t,o)=>((e,t)=>{const o=Xo(e);return Bl(o,t).map((e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,s=((e,t,o)=>{if(sn(e)){const n=_(rn(e),wc(t,o)),r=E(n,(e=>{const n=Ye(e.element);return bc(n,"span",o-t),n})),s=xe.fromTag("colgroup");return $e(s,r),[s]}return[]})(o,n,r),l=((e,t,o)=>E(e.all,(e=>{const n=_(e.cells,wc(t,o)),r=E(n,(e=>{const n=Ye(e.element);return bc(n,"colspan",o-t),n})),s=xe.fromTag("tr");return $e(s,r),s})))(o,n,r);return[...s,...l]}))})(t,js(Hs(e),t,o)))),d=(t,o)=>o().each((o=>{const n=E(o,(e=>Ye(e)));l(((o,r)=>{const s=_r(xe.fromDom(e.getDoc())),l=((e,t,o,n)=>({selection:Ns(e),clipboard:o,generators:n}))(Hs(e),0,n,s);t(o,l).each(a)}))})),g=e=>(t,o)=>((e,t)=>X(e,t)?C.from(e[t]):C.none())(o,"type").each((t=>{c(e(t),o.no_events)}));G({mceTableSplitCells:()=>c(t.unmergeCells),mceTableMergeCells:()=>c(t.mergeCells),mceTableInsertRowBefore:()=>c(t.insertRowsBefore),mceTableInsertRowAfter:()=>c(t.insertRowsAfter),mceTableInsertColBefore:()=>c(t.insertColumnsBefore),mceTableInsertColAfter:()=>c(t.insertColumnsAfter),mceTableDeleteCol:()=>c(t.deleteColumn),mceTableDeleteRow:()=>c(t.deleteRow),mceTableCutCol:()=>m().each((e=>{Yc(e),c(t.deleteColumn)})),mceTableCutRow:()=>i().each((e=>{Uc(e),c(t.deleteRow)})),mceTableCopyCol:()=>m().each((e=>Yc(e))),mceTableCopyRow:()=>i().each((e=>Uc(e))),mceTablePasteColBefore:()=>d(t.pasteColsBefore,Jc),mceTablePasteColAfter:()=>d(t.pasteColsAfter,Jc),mceTablePasteRowBefore:()=>d(t.pasteRowsBefore,Gc),mceTablePasteRowAfter:()=>d(t.pasteRowsAfter,Gc),mceTableDelete:()=>Xc(e).each((t=>{Gt(t,o).filter(w(o)).each((t=>{const o=xe.fromText("");if(je(t,o),qe(t),e.dom.isEmpty(e.getBody()))e.setContent(""),e.selection.setCursorLocation();else{const t=e.dom.createRng();t.setStart(o.dom,0),t.setEnd(o.dom,0),e.selection.setRng(t),e.nodeChanged()}}))})),mceTableCellToggleClass:(t,o)=>{l((t=>{const n=Hs(e),r=P(n,(t=>e.formatter.match("tablecellclass",{value:o},t.dom))),s=r?e.formatter.remove:e.formatter.apply;N(n,(e=>s("tablecellclass",{value:o},e.dom))),dc(e,t.dom,uc)}))},mceTableToggleClass:(t,o)=>{l((t=>{e.formatter.toggle("tableclass",{value:o},t.dom),dc(e,t.dom,uc)}))},mceTableToggleCaption:()=>{Xc(e).each((t=>{Gt(t,o).each((o=>{pt(o,"caption").fold((()=>{const t=xe.fromTag("caption");Ie(t,xe.fromText("Caption")),((e,t,o)=>{We(e,0).fold((()=>{Ie(e,t)}),(e=>{Me(e,t)}))})(o,t),e.selection.setCursorLocation(t.dom,0)}),(n=>{ue("caption")(t)&&Te("td",o).each((t=>e.selection.setCursorLocation(t.dom,0))),qe(n)})),dc(e,o.dom,fc)}))}))},mceTableSizingMode:(t,n)=>(t=>Xc(e).each((n=>{Vr(e)||$r(e)||Hr(e)||Gt(n,o).each((o=>{"relative"!==t||kc(o)?"fixed"!==t||Ec(o)?"responsive"!==t||Nc(o)||Ac(o):zc(o):_c(o),ts(o),dc(e,o.dom,fc)}))})))(n),mceTableCellType:g((e=>"th"===e?t.makeCellsHeader:t.unmakeCellsHeader)),mceTableColType:g((e=>"th"===e?t.makeColumnsHeader:t.unmakeColumnsHeader)),mceTableRowType:g((e=>{switch(e){case"header":return t.makeRowsHeader;case"footer":return t.makeRowsFooter;default:return t.makeRowsBody}}))},((t,o)=>e.addCommand(o,t))),e.addCommand("mceInsertTable",((t,o)=>{((e,t,o,n={})=>{const r=e=>u(e)&&e>0;if(r(t)&&r(o)){const r=n.headerRows||0,s=n.headerColumns||0;return jc(e,o,t,s,r)}console.error("Invalid values for mceInsertTable - rows and columns values are required to insert a table.")})(e,o.rows,o.columns,o.options)})),e.addCommand("mceTableApplyCellStyle",((t,o)=>{const l=e=>"tablecell"+e.toLowerCase().replace("-","");if(!s(o))return;const a=_(Hs(e),cs);if(0===a.length)return;const c=((e,t)=>{const o={};return((e,t,o,n)=>{G(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))})(e,t,(e=>(t,o)=>{e[o]=t})(o),f),o})(o,((t,o)=>e.formatter.has(l(o))&&r(t)));(e=>{for(const t in e)if(U.call(e,t))return!1;return!0})(c)||(G(c,((t,o)=>{const n=l(o);N(a,(o=>{""===t?e.formatter.remove(n,{value:null},o.dom,!0):e.formatter.apply(n,{value:t},o.dom)}))})),n(a[0]).each((t=>dc(e,t.dom,uc))))}))},ei=oa([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),ti={before:ei.before,on:ei.on,after:ei.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(h,h,h)},oi=(e,t)=>({selection:e,kill:t}),ni=(e,t)=>{const o=e.document.createRange();return o.selectNode(t.dom),o},ri=(e,t)=>{const o=e.document.createRange();return si(o,t),o},si=(e,t)=>e.selectNodeContents(t.dom),li=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold((e=>{r.setStartBefore(e.dom)}),((e,t)=>{r.setStart(e.dom,t)}),(e=>{r.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,o)=>{e.setEnd(t.dom,o)}),(t=>{e.setEndAfter(t.dom)}))})(n,o),n},ai=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},ci=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),ii=oa([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),mi=(e,t,o)=>t(xe.fromDom(o.startContainer),o.startOffset,xe.fromDom(o.endContainer),o.endOffset),di=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:g(e),rtl:C.none}),relative:(t,o)=>({ltr:Zt((()=>li(e,t,o))),rtl:Zt((()=>C.some(li(e,o,t))))}),exact:(t,o,n,r)=>({ltr:Zt((()=>ai(e,t,o,n,r))),rtl:Zt((()=>C.some(ai(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>ii.rtl(xe.fromDom(e.endContainer),e.endOffset,xe.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>mi(0,ii.ltr,o))):mi(0,ii.ltr,o)})(0,o)},ui=(e,t)=>di(e,t).match({ltr:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},rtl:(t,o,n,r)=>{const s=e.document.createRange();return s.setStart(n.dom,r),s.setEnd(t.dom,o),s}});ii.ltr,ii.rtl;const fi=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),gi=(e,t,o,n)=>({start:ti.on(e,t),finish:ti.on(o,n)}),hi=(e,t)=>{const o=ui(e,t);return fi(xe.fromDom(o.startContainer),o.startOffset,xe.fromDom(o.endContainer),o.endOffset)},pi=gi,bi=(e,t,o,n,r)=>Re(o,n)?C.none():Ts(o,n,t).bind((t=>{const n=t.boxes.getOr([]);return n.length>1?(r(e,n,t.start,t.finish),C.some(oi(C.some(pi(o,0,o,wr(o))),!0))):C.none()})),wi=(e,t)=>({item:e,mode:t}),vi=(e,t,o,n=yi)=>e.property().parent(t).map((e=>wi(e,n))),yi=(e,t,o,n=xi)=>o.sibling(e,t).map((e=>wi(e,n))),xi=(e,t,o,n=xi)=>{const r=e.property().children(t);return o.first(r).map((e=>wi(e,n)))},Ci=[{current:vi,next:yi,fallback:C.none()},{current:yi,next:xi,fallback:C.some(vi)},{current:xi,next:xi,fallback:C.some(yi)}],Si=(e,t,o,n,r=Ci)=>L(r,(e=>e.current===o)).bind((o=>o.current(e,t,n,o.next).orThunk((()=>o.fallback.bind((o=>Si(e,t,o,n))))))),Ti=(e,t,o,n,r,s)=>Si(e,t,n,r).bind((t=>s(t.item)?C.none():o(t.item)?C.some(t.item):Ti(e,t.item,o,t.mode,r,s))),Ri=e=>t=>0===e.property().children(t).length,Di=(e,t,o,n)=>Ti(e,t,o,yi,{sibling:(e,t)=>e.query().prevSibling(t),first:e=>e.length>0?C.some(e[e.length-1]):C.none()},n),Oi=(e,t,o,n)=>Ti(e,t,o,yi,{sibling:(e,t)=>e.query().nextSibling(t),first:e=>e.length>0?C.some(e[0]):C.none()},n),ki=ws(),Ei=(e,t)=>((e,t,o)=>Di(e,t,Ri(e),o))(ki,e,t),Ni=(e,t)=>((e,t,o)=>Oi(e,t,Ri(e),o))(ki,e,t),Bi=oa([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),_i=e=>wt(e,"tr"),zi={...Bi,verify:(e,t,o,n,r,s,l)=>wt(n,"td,th",l).bind((o=>wt(t,"td,th",l).map((t=>Re(o,t)?Re(n,o)&&wr(o)===r?s(t):Bi.none("in same cell"):Cs(_i,[o,t]).fold((()=>((e,t,o)=>{const n=e.getRect(t),r=e.getRect(o);return r.right>n.left&&r.lefts(t))))))).getOr(Bi.none("default")),cata:(e,t,o,n,r)=>e.fold(t,o,n,r)},Ai=ue("br"),Li=(e,t,o)=>t(e,o).bind((e=>ie(e)&&0===hr(e).trim().length?Li(e,t,o):C.some(e))),Wi=(e,t,o,n)=>((e,t)=>We(e,t).filter(Ai).orThunk((()=>We(e,t-1).filter(Ai))))(t,o).bind((t=>n.traverse(t).fold((()=>Li(t,n.gather,e).map(n.relative)),(e=>(e=>Ne(e).bind((t=>{const o=Le(t);return((e,t)=>W(e,b(Re,t)))(o,e).map((n=>((e,t,o,n)=>({parent:e,children:t,element:o,index:n}))(t,o,e,n)))})))(e).map((e=>ti.on(e.parent,e.index))))))),Mi=(e,t)=>({left:e.left,top:e.top+t,right:e.right,bottom:e.bottom+t}),ji=(e,t)=>({left:e.left,top:e.top-t,right:e.right,bottom:e.bottom-t}),Pi=(e,t,o)=>({left:e.left+t,top:e.top+o,right:e.right+t,bottom:e.bottom+o}),Ii=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),Fi=(e,t)=>C.some(e.getRect(t)),Hi=(e,t,o)=>ce(t)?Fi(e,t).map(Ii):ie(t)?((e,t,o)=>o>=0&&o0?e.getRangedRect(t,o-1,t,o):C.none())(e,t,o).map(Ii):C.none(),$i=(e,t)=>ce(t)?Fi(e,t).map(Ii):ie(t)?e.getRangedRect(t,0,t,wr(t)).map(Ii):C.none(),Vi=oa([{none:[]},{retry:["caret"]}]),qi=(e,t,o)=>gt(t,wa).fold(y,(t=>$i(e,t).exists((e=>((e,t)=>e.leftt.right)(o,e))))),Ui={point:e=>e.bottom,adjuster:(e,t,o,n,r)=>{const s=Mi(r,5);return Math.abs(o.bottom-n.bottom)<1||o.top>r.bottom?Vi.retry(s):o.top===r.bottom?Vi.retry(Mi(r,1)):qi(e,t,r)?Vi.retry(Pi(s,5,0)):Vi.none()},move:Mi,gather:Ni},Gi=(e,t,o,n,r)=>0===r?C.some(n):((e,t,o)=>e.elementFromPoint(t,o).filter((e=>"table"===ne(e))).isSome())(e,n.left,t.point(n))?((e,t,o,n,r)=>Gi(e,t,o,t.move(n,5),r))(e,t,o,n,r-1):e.situsFromPoint(n.left,t.point(n)).bind((s=>s.start.fold(C.none,(s=>$i(e,s).bind((l=>t.adjuster(e,s,l,o,n).fold(C.none,(n=>Gi(e,t,o,n,r-1))))).orThunk((()=>C.some(n)))),C.none))),Ki=(e,t,o)=>{const n=e.move(o,5),r=Gi(t,e,o,n,100).getOr(n);return((e,t,o)=>e.point(t)>o.getInnerHeight()?C.some(e.point(t)-o.getInnerHeight()):e.point(t)<0?C.some(-e.point(t)):C.none())(e,r,t).fold((()=>t.situsFromPoint(r.left,e.point(r))),(o=>(t.scrollBy(0,o),t.situsFromPoint(r.left,e.point(r)-o))))},Yi={tryUp:b(Ki,{point:e=>e.top,adjuster:(e,t,o,n,r)=>{const s=ji(r,5);return Math.abs(o.top-n.top)<1||o.bottome.getSelection().bind((n=>((e,t,o,n)=>{const r=Ai(t)?((e,t,o)=>o.traverse(t).orThunk((()=>Li(t,o.gather,e))).map(o.relative))(e,t,n):Wi(e,t,o,n);return r.map((e=>({start:e,finish:e})))})(t,n.finish,n.foffset,o).fold((()=>C.some(Vs(n.finish,n.foffset))),(r=>{const s=e.fromSitus(r);return l=zi.verify(e,n.finish,n.foffset,s.finish,s.foffset,o.failure,t),zi.cata(l,(e=>C.none()),(()=>C.none()),(e=>C.some(Vs(e,0))),(e=>C.some(Vs(e,wr(e)))));var l})))),Qi=(e,t,o,n,r,s)=>0===s?C.none():em(e,t,o,n,r).bind((l=>{const a=e.fromSitus(l),c=zi.verify(e,o,n,a.finish,a.foffset,r.failure,t);return zi.cata(c,(()=>C.none()),(()=>C.some(l)),(l=>Re(o,l)&&0===n?Xi(e,o,n,ji,r):Qi(e,t,l,0,r,s-1)),(l=>Re(o,l)&&n===wr(l)?Xi(e,o,n,Mi,r):Qi(e,t,l,wr(l),r,s-1)))})),Xi=(e,t,o,n,r)=>Hi(e,t,o).bind((t=>Zi(e,r,n(t,Yi.getJumpSize())))),Zi=(e,t,o)=>{const n=No().browser;return n.isChromium()||n.isSafari()||n.isFirefox()?t.retry(e,o):C.none()},em=(e,t,o,n,r)=>Hi(e,o,n).bind((t=>Zi(e,r,t))),tm=(e,t,o,n,r)=>wt(n,"td,th",t).bind((n=>wt(n,"table",t).bind((s=>((e,t)=>ft(e,(e=>Ne(e).exists((e=>Re(e,t)))),void 0).isSome())(r,s)?((e,t,o)=>Ji(e,t,o).bind((n=>Qi(e,t,n.element,n.offset,o,20).map(e.fromSitus))))(e,t,o).bind((e=>wt(e.finish,"td,th",t).map((t=>({start:n,finish:t,range:e}))))):C.none())))),om=(e,t,o,n,r,s)=>s(n,t).orThunk((()=>tm(e,t,o,n,r).map((e=>{const t=e.range;return oi(C.some(pi(t.start,t.soffset,t.finish,t.foffset)),!0)})))),nm=(e,t)=>wt(e,"tr",t).bind((e=>wt(e,"table",t).bind((o=>{const n=dt(o,"tr");return Re(e,n[0])?((e,t,o)=>Di(ki,e,(e=>Cr(e).isSome()),o))(o,0,t).map((e=>{const t=wr(e);return oi(C.some(pi(e,t,e,t)),!0)})):C.none()})))),rm=(e,t)=>wt(e,"tr",t).bind((e=>wt(e,"table",t).bind((o=>{const n=dt(o,"tr");return Re(e,n[n.length-1])?((e,t,o)=>Oi(ki,e,(e=>xr(e).isSome()),o))(o,0,t).map((e=>oi(C.some(pi(e,0,e,0)),!0))):C.none()})))),sm=(e,t,o,n,r,s,l)=>tm(e,o,n,r,s).bind((e=>bi(t,o,e.start,e.finish,l))),lm=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},am=()=>{const e=(e=>{const t=lm(C.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(C.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(C.some(e))}}})(f);return{...e,on:t=>e.get().each(t)}},cm=(e,t)=>wt(e,"td,th",t),im=e=>Be(e).exists(Qr),mm={traverse:Ae,gather:Ni,relative:ti.before,retry:Yi.tryDown,failure:zi.failedDown},dm={traverse:ze,gather:Ei,relative:ti.before,retry:Yi.tryUp,failure:zi.failedUp},um=e=>t=>t===e,fm=um(38),gm=um(40),hm=e=>e>=37&&e<=40,pm={isBackward:um(37),isForward:um(39)},bm={isBackward:um(39),isForward:um(37)},wm=oa([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),vm={domRange:wm.domRange,relative:wm.relative,exact:wm.exact,exactFromRange:e=>wm.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>xe.fromDom(e.startContainer),relative:(e,t)=>ti.getStart(e),exact:(e,t,o,n)=>e}))(e);return xe.fromDom(Ee(t).dom.defaultView)},range:fi},ym=document.caretPositionFromPoint?(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(n,t,o)).bind((t=>{if(null===t.offsetNode)return C.none();const o=e.dom.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),C.some(o)}))}:document.caretRangeFromPoint?(e,t,o)=>{var n,r;return C.from(null===(r=(n=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(n,t,o))}:C.none,xm=(e,t)=>{const o=ne(e);return"input"===o?ti.after(e):D(["br","img"],o)?0===t?ti.before(e):ti.after(e):ti.on(e,t)},Cm=e=>C.from(e.getSelection()),Sm=(e,t)=>{Cm(e).each((e=>{e.removeAllRanges(),e.addRange(t)}))},Tm=(e,t,o,n,r)=>{const s=ai(e,t,o,n,r);Sm(e,s)},Rm=(e,t)=>di(e,t).match({ltr:(t,o,n,r)=>{Tm(e,t,o,n,r)},rtl:(t,o,n,r)=>{Cm(e).each((s=>{if(s.setBaseAndExtent)s.setBaseAndExtent(t.dom,o,n.dom,r);else if(s.extend)try{((e,t,o,n,r,s)=>{t.collapse(o.dom,n),t.extend(r.dom,s)})(0,s,t,o,n,r)}catch(s){Tm(e,n,r,t,o)}else Tm(e,n,r,t,o)}))}}),Dm=(e,t,o,n,r)=>{const s=((e,t,o,n)=>{const r=xm(e,t),s=xm(o,n);return vm.relative(r,s)})(t,o,n,r);Rm(e,s)},Om=(e,t,o)=>{const n=((e,t)=>{const o=e.fold(ti.before,xm,ti.after),n=t.fold(ti.before,xm,ti.after);return vm.relative(o,n)})(t,o);Rm(e,n)},km=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return C.some(fi(xe.fromDom(t.startContainer),t.startOffset,xe.fromDom(o.endContainer),o.endOffset))}return C.none()},Em=e=>{if(null===e.anchorNode||null===e.focusNode)return km(e);{const t=xe.fromDom(e.anchorNode),o=xe.fromDom(e.focusNode);return((e,t,o,n)=>{const r=((e,t,o,n)=>{const r=ke(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),s=Re(e,o)&&t===n;return r.collapsed&&!s})(t,e.anchorOffset,o,e.focusOffset)?C.some(fi(t,e.anchorOffset,o,e.focusOffset)):km(e)}},Nm=(e,t,o=!0)=>{const n=(o?ri:ni)(e,t);Sm(e,n)},Bm=e=>(e=>Cm(e).filter((e=>e.rangeCount>0)).bind(Em))(e).map((e=>vm.exact(e.start,e.soffset,e.finish,e.foffset))),_m=e=>({elementFromPoint:(t,o)=>xe.fromPoint(xe.fromDom(e.document),t,o),getRect:e=>e.dom.getBoundingClientRect(),getRangedRect:(t,o,n,r)=>{const s=vm.exact(t,o,n,r);return((e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?C.some(o).map(ci):C.none()})(ui(e,t)))(e,s)},getSelection:()=>Bm(e).map((t=>hi(e,t))),fromSitus:t=>{const o=vm.relative(t.start,t.finish);return hi(e,o)},situsFromPoint:(t,o)=>((e,t,o)=>((e,t,o)=>{const n=xe.fromDom(e.document);return ym(n,t,o).map((e=>fi(xe.fromDom(e.startContainer),e.startOffset,xe.fromDom(e.endContainer),e.endOffset)))})(e,t,o))(e,t,o).map((e=>gi(e.start,e.soffset,e.finish,e.foffset))),clearSelection:()=>{(e=>{Cm(e).each((e=>e.removeAllRanges()))})(e)},collapseSelection:(t=!1)=>{Bm(e).each((o=>o.fold((e=>e.collapse(t)),((o,n)=>{const r=t?o:n;Om(e,r,r)}),((o,n,r,s)=>{const l=t?o:r,a=t?n:s;Dm(e,l,a,l,a)}))))},setSelection:t=>{Dm(e,t.start,t.soffset,t.finish,t.foffset)},setRelativeSelection:(t,o)=>{Om(e,t,o)},selectNode:t=>{Nm(e,t,!1)},selectContents:t=>{Nm(e,t)},getInnerHeight:()=>e.innerHeight,getScrollY:()=>(e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return bn(o,n)})(xe.fromDom(e.document)).top,scrollBy:(t,o)=>{((e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollBy(e,t)})(t,o,xe.fromDom(e.document))}}),zm=(e,t)=>({rows:e,cols:t}),Am=e=>gt(e,ae).exists(Qr),Lm=(e,t)=>Am(e)||Am(t),Wm=e=>void 0!==e.dom.classList,Mm=(e,t)=>((e,t,o)=>{const n=((e,t)=>{const o=pe(e,t);return void 0===o||""===o?[]:o.split(" ")})(e,t).concat([o]);return ge(e,t,n.join(" ")),!0})(e,"class",t),jm=(e,t)=>{Wm(e)?e.dom.classList.add(t):Mm(e,t)},Pm=(e,t)=>Wm(e)&&e.dom.classList.contains(t),Im=()=>({tag:"none"}),Fm=e=>({tag:"multiple",elements:e}),Hm=e=>({tag:"single",element:e}),$m=e=>{const t=xe.fromDom((e=>{if(nt()&&m(e.target)){const t=xe.fromDom(e.target);if(ce(t)&&m(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return H(t)}}return C.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=(s=n,l=o,(...e)=>s(l.apply(null,e)));var s,l;return((e,t,o,n,r,s,l)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:l}))(t,e.clientX,e.clientY,o,n,r,e)},Vm=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},qm=x,Um=(e,t,o)=>((e,t,o,n)=>((e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t($m(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:b(Vm,e,t,s,r)}})(e,t,o,n,!1))(e,t,qm,o),Gm=$m,Km=e=>!Pm(xe.fromDom(e.target),"ephox-snooker-resizer-bar"),Ym=(e,t)=>{const o=(r=Ms.selectedSelector,{get:()=>ks(xe.fromDom(e.getBody()),r).fold((()=>Fs(os(e),es(e)).fold(Im,Hm)),Fm)}),n=((e,t,o)=>{const n=t=>{we(t,e.selected),we(t,e.firstSelected),we(t,e.lastSelected)},r=t=>{ge(t,e.selected,"1")},s=e=>{l(e),o()},l=t=>{const o=dt(t,`${e.selectedSelector},${e.firstSelectedSelector},${e.lastSelectedSelector}`);N(o,n)};return{clearBeforeUpdate:l,clear:s,selectRange:(o,n,l,a)=>{s(o),N(n,r),ge(l,e.firstSelected,"1"),ge(a,e.lastSelected,"1"),t(n,l,a)},selectedSelector:e.selectedSelector,firstSelectedSelector:e.firstSelectedSelector,lastSelectedSelector:e.lastSelectedSelector}})(Ms,((t,o,n)=>{Gt(o).each((r=>{const s=E(t,(e=>e.dom)),l=Wr(e),a=Br(f,xe.fromDom(e.getDoc()),l),c=((e,t,o)=>{const n=Xo(e);return Nl(n,t).map((e=>{const t=Tl(n,o,!1),{rows:r}=Vo(t),s=((e,t)=>{const o=e.slice(0,t[t.length-1].row+1),n=Rl(o);return j(n,(e=>{const o=e.cells.slice(0,t[t.length-1].column+1);return E(o,(e=>e.element))}))})(r,e),l=((e,t)=>{const o=e.slice(t[0].row+t[0].rowspan-1,e.length),n=Rl(o);return j(n,(e=>{const o=e.cells.slice(t[0].column+t[0].colspan-1,e.cells.length);return E(o,(e=>e.element))}))})(r,e);return{upOrLeftCells:s,downOrRightCells:l}}))})(r,{selection:Hs(e)},a).map((e=>K(e,(e=>E(e,(e=>e.dom)))))).getOrUndefined();((e,t,o,n,r)=>{e.dispatch("TableSelectionChange",{cells:t,start:o,finish:n,otherCells:r})})(e,s,o.dom,n.dom,c)}))}),(()=>(e=>{e.dispatch("TableSelectionClear")})(e)));var r;return e.on("init",(o=>{const r=e.getWin(),s=Zr(e),l=es(e),a=((e,t,o,n)=>{const r=((e,t,o,n)=>{const r=am(),s=r.clear,l=s=>{r.on((r=>{n.clearBeforeUpdate(t),cm(s.target,o).each((l=>{Ts(r,l,o).each((o=>{const r=o.boxes.getOr([]);if(1===r.length){const o=r[0],l="false"===Xr(o),a=vt(Jr(s.target),o,Re);l&&a&&(n.selectRange(t,r,o,o),e.selectContents(o))}else r.length>1&&(n.selectRange(t,r,o.start,o.finish),e.selectContents(l))}))}))}))};return{clearstate:s,mousedown:e=>{n.clear(t),cm(e.target,o).filter(im).each(r.set)},mouseover:e=>{l(e)},mouseup:e=>{l(e),s()}}})(_m(e),t,o,n);return{clearstate:r.clearstate,mousedown:r.mousedown,mouseover:r.mouseover,mouseup:r.mouseup}})(r,s,l,n),c=((e,t,o,n)=>{const r=_m(e),s=()=>(n.clear(t),C.none());return{keydown:(e,l,a,c,i,m)=>{const d=e.raw,u=d.which,f=!0===d.shiftKey,g=Rs(t,n.selectedSelector).fold((()=>(hm(u)&&!f&&n.clearBeforeUpdate(t),hm(u)&&f&&!Lm(l,c)?C.none:gm(u)&&f?b(sm,r,t,o,mm,c,l,n.selectRange):fm(u)&&f?b(sm,r,t,o,dm,c,l,n.selectRange):gm(u)?b(om,r,o,mm,c,l,rm):fm(u)?b(om,r,o,dm,c,l,nm):C.none)),(e=>{const o=o=>()=>{const s=V(o,(o=>((e,t,o,n,r)=>Os(n,e,t,r.firstSelectedSelector,r.lastSelectedSelector).map((e=>(r.clearBeforeUpdate(o),r.selectRange(o,e.boxes,e.start,e.finish),e.boxes))))(o.rows,o.cols,t,e,n)));return s.fold((()=>Ds(t,n.firstSelectedSelector,n.lastSelectedSelector).map((e=>{const o=gm(u)||m.isForward(u)?ti.after:ti.before;return r.setRelativeSelection(ti.on(e.first,0),o(e.table)),n.clear(t),oi(C.none(),!0)}))),(e=>C.some(oi(C.none(),!0))))};return hm(u)&&f&&!Lm(l,c)?C.none:gm(u)&&f?o([zm(1,0)]):fm(u)&&f?o([zm(-1,0)]):m.isBackward(u)&&f?o([zm(0,-1),zm(-1,0)]):m.isForward(u)&&f?o([zm(0,1),zm(1,0)]):hm(u)&&!f?s:C.none}));return g()},keyup:(e,r,s,l,a)=>Rs(t,n.selectedSelector).fold((()=>{const c=e.raw,i=c.which;return!0===c.shiftKey&&hm(i)&&Lm(r,l)?((e,t,o,n,r,s,l)=>Re(o,r)&&n===s?C.none():wt(o,"td,th",t).bind((o=>wt(r,"td,th",t).bind((n=>bi(e,t,o,n,l))))))(t,o,r,s,l,a,n.selectRange):C.none()}),C.none)}})(r,s,l,n),i=((e,t,o,n)=>{const r=_m(e);return(e,s)=>{n.clearBeforeUpdate(t),Ts(e,s,o).each((e=>{const o=e.boxes.getOr([]);n.selectRange(t,o,e.start,e.finish),r.selectContents(s),r.collapseSelection()}))}})(r,s,l,n);e.on("TableSelectorChange",(e=>i(e.start,e.finish)));const m=(t,o)=>{(e=>!0===e.raw.shiftKey)(t)&&(o.kill&&t.kill(),o.selection.each((t=>{const o=vm.relative(t.start,t.finish),n=ui(r,o);e.selection.setRng(n)})))},d=e=>0===e.button,u=(()=>{const e=lm(xe.fromDom(s)),t=lm(0);return{touchEnd:o=>{const n=xe.fromDom(o.target);if(ue("td")(n)||ue("th")(n)){const r=e.get(),s=t.get();Re(r,n)&&o.timeStamp-s<300&&(o.preventDefault(),i(n,n))}e.set(n),t.set(o.timeStamp)}}})();e.on("dragstart",(e=>{a.clearstate()})),e.on("mousedown",(e=>{d(e)&&Km(e)&&a.mousedown(Gm(e))})),e.on("mouseover",(e=>{var t;void 0!==(t=e).buttons&&0==(1&t.buttons)||!Km(e)||a.mouseover(Gm(e))})),e.on("mouseup",(e=>{d(e)&&Km(e)&&a.mouseup(Gm(e))})),e.on("touchend",u.touchEnd),e.on("keyup",(t=>{const o=Gm(t);if(o.raw.shiftKey&&hm(o.raw.which)){const t=e.selection.getRng(),n=xe.fromDom(t.startContainer),r=xe.fromDom(t.endContainer);c.keyup(o,n,t.startOffset,r,t.endOffset).each((e=>{m(o,e)}))}})),e.on("keydown",(o=>{const n=Gm(o);t.hide();const r=e.selection.getRng(),s=xe.fromDom(r.startContainer),l=xe.fromDom(r.endContainer),a=dn(pm,bm)(xe.fromDom(e.selection.getStart()));c.keydown(n,s,r.startOffset,l,r.endOffset,a).each((e=>{m(n,e)})),t.show()})),e.on("NodeChange",(()=>{const t=e.selection,o=xe.fromDom(t.getStart()),r=xe.fromDom(t.getEnd());Cs(Gt,[o,r]).fold((()=>n.clear(s)),f)}))})),e.on("PreInit",(()=>{e.serializer.addTempAttr(Ms.firstSelected),e.serializer.addTempAttr(Ms.lastSelected)})),{getSelectedCells:()=>((e,t,o,n)=>{switch(e.tag){case"none":return t();case"single":return(e=>[e.dom])(e.element);case"multiple":return(e=>E(e,(e=>e.dom)))(e.elements)}})(o.get(),g([])),clearSelectedCells:e=>n.clear(xe.fromDom(e))}},Jm=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=_(t,(t=>t!==e))},trigger:(...o)=>{const n={};N(e,((e,t)=>{n[e]=o[t]})),N(t,(e=>{e(n)}))}}},Qm=e=>({registry:K(e,(e=>({bind:e.bind,unbind:e.unbind}))),trigger:K(e,(e=>e.trigger))}),Xm=e=>e.slice(0).sort(),Zm=(e,t)=>{const o=_(t,(t=>!D(e,t)));o.length>0&&(e=>{throw new Error("Unsupported keys for object: "+Xm(e).join(", "))})(o)},ed=e=>((e,t)=>((e,t,o)=>{if(0===t.length)throw new Error("You must specify at least one required field.");return((e,t)=>{if(!l(t))throw new Error("The "+e+" fields must be an array. Was: "+t+".");N(t,(t=>{if(!r(t))throw new Error("The value "+t+" in the "+e+" fields was not a string.")}))})("required",t),(e=>{const t=Xm(e);L(t,((e,o)=>o{throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+t.join(", ")+"].")}))})(t),n=>{const r=q(n);P(t,(e=>D(r,e)))||((e,t)=>{throw new Error("All required keys ("+Xm(e).join(", ")+") were not specified. Specified keys were: "+Xm(t).join(", ")+".")})(t,r),e(t,r);const s=_(t,(e=>!o.validate(n[e],e)));return s.length>0&&((e,t)=>{throw new Error("All values need to be of type: "+t+". Keys ("+Xm(e).join(", ")+") were not.")})(s,o.label),n}})(e,t,{validate:d,label:"function"}))(Zm,e),td=ed(["compare","extract","mutate","sink"]),od=ed(["element","start","stop","destroy"]),nd=ed(["forceDrop","drop","move","delayDrop"]),rd=()=>{const e=(()=>{const e=Qm({move:Jm(["info"])});return{onEvent:f,reset:f,events:e.registry}})(),t=(()=>{let e=C.none();const t=Qm({move:Jm(["info"])});return{onEvent:(o,n)=>{n.extract(o).each((o=>{const r=((t,o)=>{const n=e.map((e=>t.compare(e,o)));return e=C.some(o),n})(n,o);r.each((e=>{t.trigger.move(e)}))}))},reset:()=>{e=C.none()},events:t.registry}})();let o=e;return{on:()=>{o.reset(),o=t},off:()=>{o.reset(),o=e},isOn:()=>o===t,onEvent:(e,t)=>{o.onEvent(e,t)},events:t.events}},sd=e=>{const t=e.replace(/\./g,"-");return{resolve:e=>t+"-"+e}},ld=sd("ephox-dragster").resolve;var ad=td({compare:(e,t)=>bn(t.left-e.left,t.top-e.top),extract:e=>C.some(bn(e.x,e.y)),sink:(e,t)=>{const o=(e=>{const t={layerClass:ld("blocker"),...e},o=xe.fromTag("div");return ge(o,"role","presentation"),Bt(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),jm(o,ld("blocker")),jm(o,t.layerClass),{element:g(o),destroy:()=>{qe(o)}}})(t),n=Um(o.element(),"mousedown",e.forceDrop),r=Um(o.element(),"mouseup",e.drop),s=Um(o.element(),"mousemove",e.move),l=Um(o.element(),"mouseout",e.delayDrop);return od({element:o.element,start:e=>{Ie(e,o.element())},stop:()=>{qe(o.element())},destroy:()=>{o.destroy(),r.unbind(),s.unbind(),l.unbind(),n.unbind()}})},mutate:(e,t)=>{e.mutate(t.left,t.top)}});const cd=sd("ephox-snooker").resolve,id=cd("resizer-bar"),md=cd("resizer-rows"),dd=cd("resizer-cols"),ud=e=>{const t=dt(e.parent(),"."+id);N(t,qe)},fd=(e,t,o)=>{const n=e.origin();N(t,(t=>{t.each((t=>{const r=o(n,t);jm(r,id),Ie(e.parent(),r)}))}))},gd=(e,t,o,n,r)=>{const s=vn(o),l=t.isResizable,a=n.length>0?Bn.positions(n,o):[],c=a.length>0?((e,t)=>j(e.all,((e,o)=>t(e.element)?[o]:[])))(e,l):[];((e,t,o,n)=>{fd(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=xe.fromTag("div");return Bt(s,{position:"absolute",left:t+"px",top:o-3.5+"px",height:"7px",width:n+"px"}),he(s,{"data-row":e,role:"presentation"}),s})(t.row,o.left-e.left,t.y-e.top,n);return jm(r,md),r}))})(t,_(a,((e,t)=>O(c,(e=>t===e)))),s,Lo(o));const i=r.length>0?zn.positions(r,o):[],m=i.length>0?((e,t)=>{const o=[];return k(e.grid.columns,(n=>{ln(e,n).map((e=>e.element)).forall(t)&&o.push(n)})),_(o,(o=>{const n=on(e,(e=>e.column===o));return P(n,(e=>t(e.element)))}))})(e,l):[];((e,t,o,n)=>{fd(e,t,((e,t)=>{const r=((e,t,o,n,r)=>{const s=xe.fromTag("div");return Bt(s,{position:"absolute",left:t-3.5+"px",top:o+"px",height:r+"px",width:"7px"}),he(s,{"data-column":e,role:"presentation"}),s})(t.col,t.x-e.left,o.top-e.top,0,n);return jm(r,dd),r}))})(t,_(i,((e,t)=>O(m,(e=>t===e)))),s,hn(o))},hd=(e,t)=>{if(ud(e),e.isResizable(t)){const o=Xo(t),n=mn(o),r=an(o);gd(o,e,t,n,r)}},pd=(e,t)=>{const o=dt(e.parent(),"."+id);N(o,t)},bd=e=>{pd(e,(e=>{Nt(e,"display","none")}))},wd=e=>{pd(e,(e=>{Nt(e,"display","block")}))},vd=cd("resizer-bar-dragging"),yd=e=>{const t=(()=>{const e=Qm({drag:Jm(["xDelta","yDelta","target"])});let t=C.none();const o=(()=>{const e=Qm({drag:Jm(["xDelta","yDelta"])});return{mutate:(t,o)=>{e.trigger.drag(t,o)},events:e.registry}})();return o.events.drag.bind((o=>{t.each((t=>{e.trigger.drag(o.xDelta,o.yDelta,t)}))})),{assign:e=>{t=C.some(e)},get:()=>t,mutate:o.mutate,events:e.registry}})(),o=((e,t={})=>{var o;return((e,t,o)=>{let n=!1;const r=Qm({start:Jm([]),stop:Jm([])}),s=rd(),l=()=>{m.stop(),s.isOn()&&(s.off(),r.trigger.stop())},c=((e,t)=>{let o=null;const n=()=>{a(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...t)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,t)}),200)}}})(l);s.events.move.bind((o=>{t.mutate(e,o.info)}));const i=e=>(...t)=>{n&&e.apply(null,t)},m=t.sink(nd({forceDrop:l,drop:i(l),move:i((e=>{c.cancel(),s.onEvent(e,t)})),delayDrop:i(c.throttle)}),o);return{element:m.element,go:e=>{m.start(e),s.on(),r.trigger.start()},on:()=>{n=!0},off:()=>{n=!1},isActive:()=>n,destroy:()=>{m.destroy()},events:r.registry}})(e,null!==(o=t.mode)&&void 0!==o?o:ad,t)})(t,{});let n=C.none();const r=(e,t)=>C.from(pe(e,t));t.events.drag.bind((e=>{r(e.target,"data-row").each((t=>{const o=Pt(e.target,"top");Nt(e.target,"top",o+e.yDelta+"px")})),r(e.target,"data-column").each((t=>{const o=Pt(e.target,"left");Nt(e.target,"left",o+e.xDelta+"px")}))}));const s=(e,t)=>Pt(e,t)-Wt(e,"data-initial-"+t,0);o.events.stop.bind((()=>{t.get().each((t=>{n.each((o=>{r(t,"data-row").each((e=>{const n=s(t,"top");we(t,"data-initial-top"),d.trigger.adjustHeight(o,n,parseInt(e,10))})),r(t,"data-column").each((e=>{const n=s(t,"left");we(t,"data-initial-left"),d.trigger.adjustWidth(o,n,parseInt(e,10))})),hd(e,o)}))}))}));const l=(n,r)=>{d.trigger.startAdjust(),t.assign(n),ge(n,"data-initial-"+r,Pt(n,r)),jm(n,vd),Nt(n,"opacity","0.2"),o.go(e.parent())},c=Um(e.parent(),"mousedown",(e=>{var t;t=e.target,Pm(t,md)&&l(e.target,"top"),(e=>Pm(e,dd))(e.target)&&l(e.target,"left")})),i=t=>Re(t,e.view()),m=Um(e.view(),"mouseover",(t=>{var r;(r=t.target,wt(r,"table",i).filter(Qr)).fold((()=>{lt(t.target)&&ud(e)}),(t=>{o.isActive()&&(n=C.some(t),hd(e,t))}))})),d=Qm({adjustHeight:Jm(["table","delta","row"]),adjustWidth:Jm(["table","delta","column"]),startAdjust:Jm([])});return{destroy:()=>{c.unbind(),m.unbind(),o.destroy(),ud(e)},refresh:t=>{hd(e,t)},on:o.on,off:o.off,hideBars:b(bd,e),showBars:b(wd,e),events:d.registry}},xd=e=>m(e)&&"TABLE"===e.nodeName,Cd="bar-",Sd=e=>"false"!==pe(e,"data-mce-resize"),Td=e=>{const t=am(),o=am(),n=am();let r,s,l,a;const c=t=>hc(e,t),i=()=>Pr(e)?nl():ol(),m=(t,o,n,m)=>{const d=(e=>{return Tt(t=e,"corner-")?((e,t)=>e.substring(7))(t):t;var t})(o),u=Rt(d,"e"),f=Tt(d,"n");if(""===s&&_c(t),""===a&&(e=>{const t=(e=>gn(e)+"px")(e);Oc(e,C.none(),C.some(t)),Bc(e)})(t),n!==r&&""!==s){Nt(t,"width",s);const o=i(),l=c(t),a=Pr(e)||u?(e=>rl(e).columns)(t)-1:0;sa(t,n-r,a,o,l)}else if((e=>/^(\d+(\.\d+)?)%$/.test(e))(s)){const e=parseFloat(s.replace("%",""));Nt(t,"width",n*e/r+"%")}if((e=>/^(\d+(\.\d+)?)px$/.test(e))(s)&&(e=>{const t=Xo(e);sn(t)||N(qt(e),(e=>{const t=_t(e,"width");Nt(e,"width",t),we(e,"width")}))})(t),m!==l&&""!==a){Nt(t,"height",a);const e=f?0:(e=>rl(e).rows)(t)-1;la(t,m-l,e)}};return e.on("init",(()=>{const r=((e,t)=>e.inline?((e,t,o)=>({parent:g(t),view:g(e),origin:g(bn(0,0)),isResizable:o}))(xe.fromDom(e.getBody()),(()=>{const e=xe.fromTag("div");return Bt(e,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Ie(at(xe.fromDom(document)),e),e})(),t):((e,t)=>{const o=me(e)?(e=>xe.fromDom(Ee(e).dom.documentElement))(e):e;return{parent:g(o),view:g(e),origin:g(bn(0,0)),isResizable:t}})(xe.fromDom(e.getDoc()),t))(e,Sd);if(n.set(r),(e=>{const t=e.options.get("object_resizing");return D(t.split(","),"table")})(e)&&qr(e)){const n=((e,t,o)=>{const n=Bn,r=zn,s=yd(e),l=Qm({beforeResize:Jm(["table","type"]),afterResize:Jm(["table","type"]),startDrag:Jm([])});return s.events.adjustHeight.bind((e=>{const t=e.table;l.trigger.beforeResize(t,"row");const o=n.delta(e.delta,t);la(t,o,e.row),l.trigger.afterResize(t,"row")})),s.events.startAdjust.bind((e=>{l.trigger.startDrag()})),s.events.adjustWidth.bind((e=>{const n=e.table;l.trigger.beforeResize(n,"col");const s=r.delta(e.delta,n),a=o(n);sa(n,s,e.column,t,a),l.trigger.afterResize(n,"col")})),{on:s.on,off:s.off,refreshBars:s.refresh,hideBars:s.hideBars,showBars:s.showBars,destroy:s.destroy,events:l.registry}})(r,i(),c);n.on(),n.events.startDrag.bind((o=>{t.set(e.selection.getRng())})),n.events.beforeResize.bind((t=>{const o=t.table.dom;((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(e,o,ns(o),rs(o),Cd+t.type)})),n.events.afterResize.bind((o=>{const n=o.table,r=n.dom;ts(n),t.on((t=>{e.selection.setRng(t),e.focus()})),((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(e,r,ns(r),rs(r),Cd+o.type),e.undoManager.add()})),o.set(n)}})),e.on("ObjectResizeStart",(t=>{const o=t.target;if(xd(o)){const n=xe.fromDom(o);N(e.dom.select(".mce-clonedresizable"),(t=>{e.dom.addClass(t,"mce-"+jr(e)+"-columns")})),!Ec(n)&&$r(e)?zc(n):!kc(n)&&Hr(e)&&_c(n),Nc(n)&&Tt(t.origin,Cd)&&_c(n),r=t.width,s=Vr(e)?"":ls(e,o).getOr(""),l=t.height,a=as(e,o).getOr("")}})),e.on("ObjectResized",(t=>{const o=t.target;if(xd(o)){const n=xe.fromDom(o),r=t.origin;(e=>Tt(e,"corner-"))(r)&&m(n,r,t.width,t.height),ts(n),dc(e,n.dom,uc)}})),e.on("SwitchMode",(()=>{o.on((t=>{e.mode.isReadOnly()?t.hideBars():t.showBars()}))})),e.on("dragstart dragend",(e=>{o.on((t=>{"dragstart"===e.type?(t.hideBars(),t.off()):(t.on(),t.showBars())}))})),e.on("remove",(()=>{o.on((e=>{e.destroy()})),n.on((t=>{((e,t)=>{e.inline&&qe(t.parent())})(e,t)}))})),{refresh:e=>{o.on((t=>t.refreshBars(xe.fromDom(e))))},hide:()=>{o.on((e=>e.hideBars()))},show:()=>{o.on((e=>e.showBars()))}}},Rd=e=>{(e=>{const t=e.options.register;t("table_clone_elements",{processor:"string[]"}),t("table_use_colgroups",{processor:"boolean",default:!0}),t("table_header_type",{processor:e=>{const t=D(["section","cells","sectionCells","auto"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: section, cells, sectionCells or auto."}},default:"section"}),t("table_sizing_mode",{processor:"string",default:"auto"}),t("table_default_attributes",{processor:"object",default:{border:"1"}}),t("table_default_styles",{processor:"object",default:{"border-collapse":"collapse"}}),t("table_column_resizing",{processor:e=>{const t=D(["preservetable","resizetable"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be preservetable, or resizetable."}},default:"preservetable"}),t("table_resize_bars",{processor:"boolean",default:!0}),t("table_style_by_css",{processor:"boolean",default:!0}),t("table_merge_content_on_paste",{processor:"boolean",default:!0})})(e);const t=Td(e),o=Ym(e,t),n=pc(e,t,o);return Zc(e,n),((e,t)=>{const o=es(e),n=t=>Fs(os(e)).bind((n=>Gt(n,o).map((o=>{const r=js(Hs(e),o,n);return t(o,r)})))).getOr("");G({mceTableRowType:()=>n(t.getTableRowType),mceTableCellType:()=>n(t.getTableCellType),mceTableColType:()=>n(t.getTableColType)},((t,o)=>e.addQueryValueHandler(o,t)))})(e,n),$s(e,n),{getSelectedCells:o.getSelectedCells,clearSelectedCells:o.clearSelectedCells}};e.add("dom",(e=>({table:Rd(e)})))}(); \ No newline at end of file diff --git a/plugins/a11ychecker/css/annotations.css b/plugins/a11ychecker/css/annotations.css index 3f01e9a..964878d 100644 --- a/plugins/a11ychecker/css/annotations.css +++ b/plugins/a11ychecker/css/annotations.css @@ -4,7 +4,7 @@ * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 3.3.1-77 + * Version: 7.0.0-22 */ [data-ephox-foam-a11y-violation] { diff --git a/plugins/a11ychecker/plugin.min.js b/plugins/a11ychecker/plugin.min.js index 9a9290c..6c3f76d 100644 --- a/plugins/a11ychecker/plugin.min.js +++ b/plugins/a11ychecker/plugin.min.js @@ -4,7 +4,7 @@ * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 3.3.1-77 + * Version: 7.0.0-22 */ -!function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=o=e,(a=String).prototype.isPrototypeOf(r)||(null===(n=o.constructor)||void 0===n?void 0:n.name)===a.name)?"string":t;var r,o,a,n})(t)===e,r=e=>t=>typeof t===e,o=t("string"),a=t("object"),n=t("array"),i=r("boolean"),s=(void 0,e=>undefined===e);const l=e=>!(e=>null==e)(e),c=r("function"),u=r("number"),d=()=>{},p=e=>()=>e,h=e=>e,m=(e,t)=>e===t,y=e=>e(),g=p(!1),v=p(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return l(e)?w.some(e):w.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}w.singletonNone=new w(!1);const b=e=>parseInt(e,10),f=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},k=(e,t,r)=>({major:e,minor:t,patch:r}),x=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?k(b(t[1]),b(t[2]),b(t[3])):k(0,0,0)},A=Array.prototype.slice,C=Array.prototype.indexOf,T=Array.prototype.push,D=(e,t)=>((e,t)=>C.call(e,t))(e,t)>-1,I=(e,t)=>{for(let r=0,o=e.length;r{const r=e.length,o=new Array(r);for(let a=0;a{for(let r=0,o=e.length;r{const r=[];for(let o=0,a=e.length;o(S(e,((e,o)=>{r=t(r,e,o)})),r),O=(e,t,r)=>{for(let o=0,a=e.length;oO(e,t,g),R=(e,t)=>(e=>{const t=[];for(let r=0,o=e.length;r{const t=A.call(e,0);return t.reverse(),t},H=p("html4"),q=p("html5"),$=p("a"),G=p("aa"),P=p("aaa"),L=e=>t=>t.options.get(e),j=L("a11ychecker_css_url"),B=L("a11ychecker_level"),V=L("a11ychecker_html_version"),F=L("a11ychecker_issue_url_callback"),z=L("a11ychecker_filter_issue"),U=e=>{var t;return null!==(t=e.options.get("a11ychecker_allow_decorative_images"))&&void 0!==t?t:e.options.get("a11y_advanced_options")},K=tinymce.util.I18n,J={"a11y.d1.description":"This paragraph looks like a heading. If it is a heading, please select a heading level.","a11y.d1.repair.block.h1":"Heading 1","a11y.d1.repair.block.h2":"Heading 2","a11y.d1.repair.block.h3":"Heading 3","a11y.d1.repair.block.h4":"Heading 4","a11y.d1.repair.block.h5":"Heading 5","a11y.d1.repair.block.h6":"Heading 6","a11y.d1.repair.info":"Select a heading level:","a11y.d2.description":"Headings must be applied in sequential order. For example: Heading 1 should be followed by Heading 2, not Heading 3.","a11y.d3.description":"Adjacent links with the same URL should be merged into one link","a11y.d4.description":"The selected text appears to be a list. Lists should be formatted using a list tag.","a11y.d5a.description":"Large text must have a contrast ratio of at least 3:1","a11y.d5b.description":"Text must have a contrast ratio of at least 4.5:1","a11y.d5c.description":"Text must have a contrast ratio of at least 7:1","a11y.h93.description":"ID attribute must be unique","a11y.h93.repair.info":"Make ID unique","a11y.h93.repair.deduplicate.others":"Keep this ID and remove all others","a11y.h93.repair.deduplicate.this":"Remove this ID","a11y.h93.repair.deduplicate.all":"Remove all IDs","a11y.i1.description.decorativeAllowed":"Images must be marked as decorative or have an alternative text description","a11y.i1.description.decorativeNotAllowed":"Images must have an alternative text description. Decorative images are not allowed.","a11y.i1.repair.errors.duplicate":"Alternative text cannot be the same as the filename","a11y.i1.repair.errors.empty":"Alternative text cannot be empty","a11y.i1.repair.info.decorativeAllowed":"Or provide alternative text:","a11y.i1.repair.info.decorativeNotAllowed":"Provide alternative text:","a11y.i1.repair.checkboxlabel":"Make image decorative:","a11y.i1.repair.checkboxtext":"Image is decorative","a11y.i2.description":"Alternative text must not be the same as the image filename","a11y.i2.repair.info":"Provide alternative text:","a11y.i3.description":"Image alternative text should be less than 100 characters","a11y.i3.repair.error":"Alternative text is {0} characters","a11y.t1.description":"Tables must have captions","a11y.t1.repair.errors.duplicate":"Table caption cannot be the same as the table summary","a11y.t1.repair.errors.empty":"Caption cannot be empty","a11y.t1.repair.info":"Provide caption:","a11y.t2.description":"Complex tables should have summaries","a11y.t2.repair.errors.duplicate":"Table summary cannot be the same as the table caption","a11y.t2.repair.errors.empty":"Summary cannot be empty","a11y.t2.repair.info":"Provide table summary:","a11y.t3.description":"Table caption and summary cannot have the same value","a11y.t4a.description":"Table elements must contain TR and TD tags","a11y.t4b.description":"Tables must have at least one header cell","a11y.t4b.repair.info":"Choose table header:","a11y.t4c.description":"Table headers must be applied to a row or a column","a11y.t4c.repair.header.col":"Header column","a11y.t4c.repair.header.row":"Header row","a11y.t4c.repair.info":"Select header scope:","a11y.t4c.repair.scope.col":"Column","a11y.t4c.repair.scope.colgroup":"Column group","a11y.t4c.repair.scope.row":"Row","a11y.t4c.repair.scope.rowgroup":"Row group","a11y.widget.counter":"Issue {0} of {1}","a11y.widget.ignore":"Ignore","a11y.widget.issue.none":"No accessibility issues detected","a11y.widget.next":"Next issue","a11y.widget.previous":"Previous issue","a11y.widget.legacyrepair":"Repair issue","a11y.widget.repair":"Repair","a11y.widget.title":"Accessibility Checker","a11y.widget.help.title":"Click for more info","a11y.control.tooltip":"Accessibility checker","a11y.control.menutext":"Accessibility checker...",error:"Error",warning:"Warning",info:"Info",success:"Success"},Q=e=>J[e],X=e=>Array.isArray(e)?K.translate([Q(e[0]),...e.slice(1)]):K.translate(Q(e)),Y=Object.keys,Z=Object.hasOwnProperty,ee=(e,t)=>{const r=Y(e);for(let o=0,a=r.length;o(t,r)=>{e[r]=t},re=(e,t)=>Z.call(e,t),oe="undefined"!=typeof window?window:Function("return this;")(),ae=(e,t)=>((e,t)=>{let r=null!=t?t:oe;for(let t=0;t{const t=ae("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const r=((e,t)=>ae(e,t))(e,t);if(null==r)throw new Error(e+" not available on this browser");return r})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ne(e).constructor.name))},se=e=>t=>(e=>e.dom.nodeType)(t)===e,le=e=>ce(e)&&ie(e.dom),ce=se(1),ue=se(3),de=se(9),pe=se(11),he=e=>t=>ce(t)&&t.dom.nodeName.toLowerCase()===e,me=(e,t,r)=>{((e,t,r)=>{if(!(o(r)||i(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")})(e.dom,t,r)},ye=(e,t)=>{const r=e.dom.getAttribute(t);return null===r?void 0:r},ge=(e,t)=>w.from(ye(e,t)),ve=(e,t)=>{e.dom.removeAttribute(t)},we=(e=>{const t="ephox-foam".replace(/\./g,"-");return{resolve:e=>t+"-"+e}})().resolve,be=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},fe=(e,t)=>{const r=(t||document).createElement(e);return be(r)},ke=be,xe=(e,t)=>{const r=e.dom;if(1!==r.nodeType)return!1;{const e=r;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Ae=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ce=(e,t)=>e.dom===t.dom,Te=e=>ke(e.dom.ownerDocument),De=e=>w.from(e.dom.parentNode).map(ke),Ie=e=>w.from(e.dom.previousSibling).map(ke),_e=e=>W(((e,t)=>{const r=[],o=e=>(r.push(e),t(e));let a=t(e);do{a=a.bind(o)}while(a.isSome());return r})(e,Ie)),Se=e=>_(e.dom.childNodes,ke),Ne=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?e=>ke(e.dom.getRootNode()):e=>de(e)?e:Te(e),Me=e=>ke(e.dom.host),Oe=e=>{const t=ue(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const r=t.ownerDocument;return(e=>{const t=Ne(e);return pe(r=t)&&l(r.dom.host)?w.some(t):w.none();var r})(ke(t)).fold((()=>r.body.contains(t)),(o=Oe,a=Me,e=>o(a(e))));var o,a},Ee=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ke(t)},Re=(e,t)=>((e,r)=>N(Se(e),(e=>xe(e,t))))(e),We=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?[]:_(r.querySelectorAll(e),ke)})(t,e),He=(e,t,r)=>{me(e,t,r)},qe=(e,t,r)=>{ve(e,t),ve(e,r)},$e=e=>{const t=e.editor;return{start:t=>{((e,t,r,o,a,n)=>{S(e,(e=>{const r=((e,t,r,o)=>{switch(e){case"info":return w.some(t);case"warning":return w.some(r);case"error":return w.some(o);default:return w.none()}})(e.severity,o,a,n).toArray().concat([t]);S(r,(t=>{me(e.element,t,1)}))})),w.from(e[0]).each((e=>{He(e.element,r,e.severity)}))})(t,e.violation,e.current,e.info,e.warn,e.error)},moveTo:(r,o)=>{((e,t,r,o)=>{const a=We(e,"["+t+"]");S(a,(e=>{ve(e,t)})),He(r,t,o)})(ke(t.getBody()),e.current,r,o)},stop:()=>{((e,t,r,o,a,n)=>{const i=We(e,"["+t+"]");S(i,(e=>{S([t,r,o,a,n],(t=>{ve(e,t)})),qe(e,t,r)}))})(ke(t.getBody()),e.violation,e.current,e.info,e.warn,e.error)},exclude:t=>{qe(t,e.violation,e.current)}}},Ge="data-"+we("a11y-current-violation"),Pe="data-"+we("a11y-violation"),Le="data-"+we("a11y-severity-info"),je="data-"+we("a11y-severity-warn"),Be="data-"+we("a11y-severity-error"),Ve="data-"+we("accessibility-ignore"),Fe=p(Ve),ze=(e,t,r)=>{let o=e.dom;const a=c(r)?r:g;for(;o.parentNode;){o=o.parentNode;const e=ke(o);if(t(e))return w.some(e);if(a(e))break}return w.none()},Ue=(e,t)=>E(e.dom.childNodes,(e=>t(ke(e)))).map(ke),Ke=(e,t,r)=>ze(e,(e=>xe(e,t)),r),Je=(e,t)=>Ue(e,(e=>xe(e,t))),Qe=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?w.none():w.from(r.querySelector(e)).map(ke)})(t,e),Xe=(e,t,r)=>((e,t,r,o,a)=>((e,t)=>xe(e,t))(r,o)?w.some(r):c(a)&&a(r)?w.none():t(r,o,a))(0,Ke,e,t,r),Ye=(e,t=!1)=>{return Oe(e)?e.dom.isContentEditable:(r=e,Xe(r,"[contenteditable]")).fold(p(t),(e=>"true"===Ze(e)));var r},Ze=e=>e.dom.contentEditable,et=e=>{const t=(e=>ze(e,le).exists(Ye))(e);return t&&le(e)&&Ye(e)},tt=(e,t)=>N(e.querySelectorAll(t),(e=>et(ke(e)))),rt=(e,t,r)=>R(t,(t=>"I1"===t.id?t.check(e,r)?[{rule:t,element:e}]:[]:t.check(e)?[{rule:t,element:e}]:[])),ot=(e,t)=>{let r=[];const o=((e,t)=>{const r=[],o=[];for(let t=0,n=e.length;txe(t,e)))&&le(t)&&et(t)){const o=rt(t.dom,n,e.allowDecorativeImages);r=r.concat(o)}}const c=((e,t)=>R(t,(t=>_(t.check(e),(e=>({rule:t,element:e}))))))(t,i);return r=r.concat(c),r.sort(((e,t)=>((e,t)=>e===t?0:((e,t)=>((e,t,r)=>0!=(e.compareDocumentPosition(t)&r))(e,t,Node.DOCUMENT_POSITION_PRECEDING))(e,t)?1:-1)(e.element,t.element))),r},at=(e,t)=>Qe(e,t).isSome(),nt=p("error"),it=p("warning"),st=(e,t)=>{const r=e;return r.matches?r.matches(t):r.webkitMatchesSelector?r.webkitMatchesSelector(t):r.mozMatchesSelector?r.mozMatchesSelector(t):!!r.msMatchesSelector&&r.msMatchesSelector(t)},lt=e=>e.length>0,ct=((e,t)=>{const r=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return r(t).getOr("")},getOption:r,set:(t,r)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=r}}})(ue),ut=e=>ct.get(e),dt=e=>pt(e).isSome(),pt=e=>Ue(e,(e=>ue(e)&<(ut(e).trim()))),ht="strong,b",mt=(e,t)=>pt(e).fold((()=>((e,t)=>{for(let r=0,o=e.length;rmt(e,t)))),(e=>((e,t)=>Ke(e,ht,(e=>Ce(e,t))).isSome())(e,t))),yt={id:"D1",wcag:"1.3.1",severity:it(),desckey:"a11y.d1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H42.html",walkable:!0,check:e=>{const t=ke(e);return!(!st(e,"p")||!at(t,ht))&&mt(t,t)},levels:[$(),G(),P()],htmlversions:[H(),q()]},gt={id:"D2",wcag:"1.3.1",severity:nt(),desckey:"a11y.d2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G141.html",walkable:!1,check:e=>{const t=tt(e,"h1,h2,h3,h4,h5,h6");let r;const o=[];return S(t,(e=>{const t=parseInt(e.tagName.slice(1),10);r&&t-r>1&&o.push(e),r=t})),o},levels:[$(),G(),P()],htmlversions:[H(),q()]},vt={id:"D3",wcag:"2.4.4",severity:nt(),desckey:"a11y.d3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H2.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"a + a"),o=N(r,(e=>{const t=W(_e(e));return O(t,he("a"),(e=>{return!(ue(t=e)&&(r=ut(t).replace(/[\u200B-\u200D\uFEFF]/g,""),!lt(r)));var t,r})).exists((t=>t.dom.href===e.dom.href))&&et(e)}));return _(o,(e=>e.dom))},levels:[$(),G(),P()],htmlversions:[H(),q()]},wt=(e,t)=>{const r=e.nodeName,o=((e,t)=>{let r=e.nextSibling;for(;null!==r&&(t&&"#text"===r.nodeName||"BR"===r.nodeName);)r=r.nextSibling;return r})(e,t);return null!==o&&o.nodeName===r&&o},bt=(e,t,r)=>{const o=[];if(t(e)){o.push(e);let a=wt(e,r);for(;!1!==a&&t(a);)o.push(a),a=wt(a,r)}return o},ft=(e,t)=>{let r=-1;for(let o=0;o{const r=tt(e,"p,h1,h2,h3,h4,h5,h6"),o=[];let a=0;for(;a1){o.push(e);const t=n[n.length-1],i=ft(r,t);a=-1===i?a+1:i}else l(e.firstChild)?(bt(e.firstChild,t,!1).length>1&&o.push(e),a++):a++}return o},xt=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}([a-z1-9]|i+)\s{0,}[.)-]/gim))},At={id:"D4o",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,xt),levels:[$(),G(),P()],htmlversions:[H(),q()]},Ct=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}(\*|-)\s{0,}/gim))},Tt={id:"D4u",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,Ct),levels:[$(),G(),P()],htmlversions:[H(),q()]},Dt=(e,t)=>{const r=e.dom,o=window.getComputedStyle(r).getPropertyValue(t);return""!==o||Oe(e)?o:It(r,t)},It=(e,t)=>(e=>void 0!==e.style&&c(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"",_t=(e,t,r,o)=>({red:e,green:t,blue:r,alpha:o}),St=e=>{const t=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=e.red/255,o=e.green/255,a=e.blue/255;return.2126*t(r)+.7152*t(o)+.0722*t(a)},Nt=(e,t)=>{const r=e.alpha+t.alpha*(1-e.alpha),o=(e.red*e.alpha+t.red*t.alpha*(1-e.alpha))/r,a=(e.green*e.alpha+t.green*t.alpha*(1-e.alpha))/r,n=(e.blue*e.alpha+t.blue*t.alpha*(1-e.alpha))/r;return _t(Math.ceil(o),Math.ceil(a),Math.ceil(n),r)},Mt=e=>{const t=(e,t,r,o)=>{const a=parseInt(e,10),n=parseInt(t,10),i=parseInt(r,10),s=parseFloat(o);return w.some(_t(a,n,i,s))};if("transparent"===e)return t("0","0","0","0");const r=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/.exec(e);if(null!==r)return t(r[1],r[2],r[3],"1");const o=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/.exec(e);return null!==o?t(o[1],o[2],o[3],o[4]):w.none()},Ot=(e,t)=>{const r=parseFloat(Dt(e,"opacity"));return r<1?_t(t.red,t.green,t.blue,t.alpha*r):t},Et=(e,t)=>Rt(e).filter((e=>e{const t=(e=>{const t=Te(e),r=Ee(t),o=[e].concat(((e,t)=>{const r=c(t)?t:g;let o=e.dom;const a=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=ke(e);if(a.push(t),!0===r(t))break;o=e}return a})(e,(e=>Ce(e,r)))),a=M(o,((e,t)=>{if(1===e.alpha)return e;const r=Dt(t,"background-color");return Mt(r).bind((r=>{const o=Ot(t,r);return o.alpha>0?w.some(Nt(e,o)):w.none()})).getOr(e)}),_t(0,0,0,0));return a.alpha<1?Nt(a,_t(255,255,255,1)):a})(e);return((e,t)=>{const r=Dt(e,"color");return Mt(r).bind((r=>{const o=Ot(e,r),a=o.alpha<1?Nt(o,t):o;return w.some(a)}))})(e,t).map((e=>{const r=St(t);return((e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05))(St(e),r)}))},Wt={id:"D5c",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G17.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&Et(t,7)},levels:[P()],htmlversions:[H(),q()]},Ht=e=>{const t=Dt(e,"font-size"),r=new RegExp(".*px").test(t),o=/(\d*\.?\d*)(.*)/.exec(t);return r&&null!==o?w.some(Number(o[1])):w.none()},qt=e=>{const t=(e=>{const t=Dt(e,"font-weight");return!("bold"!==t&&"bolder"!==t)||!!/^[0-9]*$/.test(r=t)&&parseInt(r,10)>=700;var r})(e),r=Te(e),o=Ee(r),a=Ht(o);return Ht(e).fold(g,(e=>a.fold((()=>e>=24||t&&e>=19),(r=>e>=1.5*r||t&&e>=1.2*r))))},$t={id:"D5a",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G145.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&qt(t)&&Et(t,3)},levels:[G()],htmlversions:[H(),q()]},Gt={id:"D5b",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G18.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&!qt(t)&&Et(t,4.5)},levels:[G()],htmlversions:[H(),q()]},Pt={id:"H93",wcag:"4.1.1",severity:nt(),desckey:"a11y.h93.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H93.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"*[id]"),o=M(r,((e,t)=>{const r=ye(t,"id");if(void 0!==r&&et(t)){if(re(e.problems,r))return e;if(re(e.ids,r)){const t=e.ids[r];return{...e,problems:{...e.problems,[r]:t}}}return{...e,ids:{...e.ids,[r]:t.dom}}}return e}),{ids:{},problems:{}});return((e,t)=>{const r=[];return ee(e,((e,o)=>{r.push(t(e,o))})),r})(o.problems,h)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Lt=he("img"),jt={id:"I1",wcag:"1.1.1",severity:nt(),desckey:"a11y.i1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:(e,t)=>{const r=ke(e);if(!Lt(r))return!1;const o=ge(r,"alt"),a=o.isSome(),n=o.exists((e=>""===e.trim())),i=((e,t,r=m)=>e.exists((e=>r(e,t))))(ge(r,"role"),"presentation");return!a||(t?a&&n&&!i||a&&!n&&i:n||i)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Bt={id:"I2",wcag:"1.1.1",severity:nt(),desckey:"a11y.i2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:e=>(e=>st(e,"img[alt][src]"))(e)&&e.src.split("/").pop()===e.alt.split("/").pop(),levels:[$(),G(),P()],htmlversions:[H(),q()]},Vt={id:"I3",wcag:"N/A",severity:it(),desckey:"a11y.i3.description",url:"",walkable:!0,check:e=>{const t=ke(e);return!!Lt(t)&&ge(t,"alt").exists((e=>e.length>100))},levels:[$(),G(),P()],htmlversions:[H(),q()]},Ft={id:"T1",wcag:"1.3.1",severity:nt(),desckey:"a11y.t1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H39.html",walkable:!0,check:e=>{if(st(e,"table")){const t=e.querySelector("caption");return!t||st(t,":empty")}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},zt={id:"T2",wcag:"1.3.1",severity:it(),desckey:"a11y.t2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>st(e,"table")&&l(e.querySelector("[rowspan]")||e.querySelector("[colspan]"))&&!e.hasAttribute("summary"),levels:[$(),G(),P()],htmlversions:[H()]},Ut={id:"T3",wcag:"1.3.1",severity:nt(),desckey:"a11y.t3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>{if(st(e,"table")&&e.hasAttribute("summary")){const t=e.querySelectorAll("caption");return t.length>0&&e.getAttribute("summary")===t[0].innerHTML}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},Kt={id:"T4b",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>"table"===e.nodeName.toLowerCase()&&0===e.querySelectorAll("th").length,levels:[$(),G(),P()],htmlversions:[H(),q()]},Jt={id:"T4c",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H63.html",walkable:!0,check:e=>{return!("th"!==e.nodeName.toLowerCase()||(t=e).hasAttribute("scope")&&/row|col|rowgroup|colgroup/i.test(t.getAttribute("scope")));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Qt=(e,t)=>0===e.querySelectorAll(t).length,Xt={id:"T4a",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>{return"table"===e.nodeName.toLowerCase()&&(Qt(t=e,"tr")||Qt(t,"td"));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Yt=e=>({id:e.id.toUpperCase(),severity:e.severity,url:e.url,description:X(e.description),element:e.element.dom}),Zt=t=>{const r=(e=>{const t=(e=>{const t=e.options.get("a11ychecker_ignored_rules");return R(tinymce.explode(t),(e=>e.length>0?[e.toUpperCase()]:[]))})(e),r=B(e),o=V(e);return{rules:N([yt,gt,vt,At,Tt,$t,Gt,Wt,Pt,jt,Bt,Vt,Ft,zt,Ut,Jt,Xt,Kt],(e=>!D(t,e.id.toUpperCase())&&D(e.levels,r)&&D(e.htmlversions,o))),allowDecorativeImages:U(e),ignoreSelectors:["img[data-mce-placeholder]","[data-mce-bogus=all] *","[data-mce-bogus]","[data-mce-mergetag-affix]"]}})(t);(e=>{e.on("init",(()=>{S([Ve,Pe,Le,je,Be,Ge],(t=>{e.serializer.addTempAttr(t)}))}))})(t);const o=e(!1),a=(e=>$e({editor:e,violation:Pe,current:Ge,info:Le,warn:je,error:Be}))(t),n=Fe();let i=[],s=0;const l=()=>{const e=ot(r,t.getBody()),o=((e,t)=>_(t,(t=>{const r=t.rule;return{id:r.id.toUpperCase(),description:"I1"!==r.id?r.desckey:U(e)?`${r.desckey}.decorativeAllowed`:`${r.desckey}.decorativeNotAllowed`,element:ke(t.element),url:r.url,severity:r.severity}})))(t,e);return N(o,(e=>{const r=(a=e.element,ge(a,n).map((e=>e.split(" "))).getOr([])),o=z(t);var a;return!D(r,e.id)&&o(Yt(e))}))},c=e=>(s+=e,s=s<0?s+i.length:s%i.length,a.moveTo(i[s].element,i[s].severity),t.selection.scrollIntoView(i[s].element.dom),{summaryLabel:X(["a11y.widget.counter",s+1,i.length]),issue:i[s],index:s+1}),u=()=>i.length>0?w.some(c(0)):w.none(),d=()=>{o.set(!0),i=l(),s=0},p=()=>{a.stop(),o.set(!1),s=0,i=[]};return{scan:()=>(d(),a.start(i),u()),stepIssue:c,getIssues:()=>i.slice(0),getCurrent:u,getReport:()=>{const e=o.get();try{return e||d(),_(i,Yt)}finally{e||p()}},resolveCurrent:e=>(e&&((e,t,r)=>{const o=ge(e,t).map((e=>e.concat(" ",r))).getOr(r);me(e,t,o)})(i[s].element,n,i[s].id),i=l(),u()),clear:p,isAuditing:()=>o.get()}},er=(e,t)=>{const r=t.ui.registry.getAll().icons;return w.from(r[e]).orThunk((()=>w.from(r["temporary-placeholder"]))).getOr("!not found!")},tr={success:"checkmark",info:"info",warning:"notice",error:"warning"},rr=(e,t,r,o,a)=>{const n=X(r),i=X(t);return`
${er(tr[r],e)}

${n}

${i}

`+((e,t,r)=>{const o=`
${er(e,t)}
`;return"help"===e?o:`
${er(e,t)}
`})(o,e,a)+"
"},or=(e,t,r,o)=>({type:"listbox",label:t,name:e,items:_(r,(e=>({text:o(e.text),value:e.value})))}),ar=(e,t)=>({type:"input",name:e,label:t}),nr=(e,t,r)=>({type:"label",label:t,items:[{type:"checkbox",name:e,label:r}]}),ir=(e,t)=>({title:X("a11y.widget.title"),body:{type:"panel",items:[{type:"panel",classes:["tox-accessibility-issue","accessibility-issue--success"],items:[{type:"htmlpanel",html:rr(e,"a11y.widget.issue.none","success","checkmark"),presets:"presentation"}]}]},buttons:[{type:"submit",name:"ok",text:"OK",primary:!0}],onSubmit:e=>e.close(),onClose:t}),sr=(e,t,r)=>{e.redial(t),e.focus(r)};var lr;!function(e){e.Next="next",e.Prev="prev",e.Ignore="ignore",e.Ok="ok",e.Repair="repair"}(lr||(lr={}));const cr=({issue:e,summaryLabel:t},r,o,a,n,i)=>{const s=F(n),l=e=>cr(e,r,o,w.none(),n,i),c=a=>(s,{name:c})=>{if(c===lr.Next||c===lr.Prev){const e=r.stepIssue(c===lr.Next?1:-1);sr(s,l(e),c)}else c===lr.Ignore?r.resolveCurrent(!0).fold((()=>sr(s,ir(n,i),lr.Ok)),(e=>sr(s,l(e),lr.Ignore))):c===lr.Repair&&((a,s)=>{const c=s=>{sr(a,cr({issue:e,summaryLabel:t},r,o,w.some(s),n,i),lr.Repair)},u=()=>r.resolveCurrent(!1).fold((()=>r.scan().fold((()=>sr(a,ir(n,i),lr.Ok)),(e=>sr(a,l(e),lr.Ignore)))),(e=>sr(a,l(e),lr.Ignore)));s.each((t=>{t.repair(e.element,e.id,((e,t)=>{const r={},o={};return((e,t,r,o)=>{ee(e,((e,a)=>{(t(e,a)?r:o)(e,a)}))})(e,t,te(r),te(o)),{t:r,f:o}})(a.getData(),((t,r)=>{return o=r,""===(a=e.id)||o.length>=a.length&&o.substr(0,0+a.length)===a;var o,a})).t,(e=>e.fold(c,u)))}))})(s,a)},u=t=>r=>t.each((t=>{t.onChange.each((t=>t(r,r.getData(),e))),t.shouldDisableRepair.each((t=>{const o=t(r.getData(),e);r.setEnabled(lr.Repair,!o)}))})),d=(r,o,a)=>{const l="warning"===(d=e.severity)?"warn":d;var d;const p=o.map((()=>({type:"panel",classes:["accessibility-issue__repair"],items:o.map((e=>e.items)).getOr([])}))).toArray();return{title:X("a11y.widget.title"),body:{type:"panel",classes:["tox-accessibility-issue",`accessibility-issue--${l}`],items:[{type:"panel",classes:["accessibility-issue__header"],items:[{type:"htmlpanel",html:`

${t}

`,presets:"presentation"},{type:"button",name:lr.Prev,text:X("a11y.widget.previous"),icon:"action-prev",borderless:!0},{type:"button",name:lr.Next,text:X("a11y.widget.next"),icon:"action-next",borderless:!0}]},{type:"htmlpanel",html:rr(n,e.description,e.severity,"help",s(e.id)),presets:"presentation"},...p]},buttons:[{type:"custom",name:lr.Ignore,text:X("a11y.widget.ignore")},{type:"custom",name:lr.Repair,text:X("a11y.widget.repair"),enabled:!a,primary:!0}],initialData:{...o.map((e=>e.initialData)).getOr({})},onAction:c(r),onChange:u(r),onClose:i}};return o(e.id).fold((()=>d(w.none(),w.none(),!0)),(t=>{const r=((e,t,r)=>{const o=t.element;return r.fold((()=>e.ui.map((e=>e(t.id,o)))),(r=>e.ui.map((e=>{const a=e(t.id,o);return{items:a.items.concat([(n=r.errorMessage,{type:"htmlpanel",html:`
${n}
`})]),initialData:{...a.initialData,...r.repairErrorData}};var n}))))})(t,e,a),o=t.shouldDisableRepair.bind((t=>r.map((r=>t(r.initialData,e))))).getOr(!1);return d(w.some(t),r,o)}))},ur=(e,t)=>{De(e).each((r=>{r.dom.insertBefore(t.dom,e.dom)}))},dr=(e,t)=>{const r=(e=>w.from(e.dom.nextSibling).map(ke))(e);r.fold((()=>{De(e).each((e=>{pr(e,t)}))}),(e=>{ur(e,t)}))},pr=(e,t)=>{e.dom.appendChild(t.dom)},hr=(e,t)=>{S(t,(t=>{pr(e,t)}))},mr=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},yr=e=>{const t=Se(e);var r,o;t.length>0&&(r=e,S(o=t,((e,t)=>{const a=0===t?r:o[t-1];dr(a,e)}))),mr(e)},gr=e=>e.dom.innerHTML,vr=e=>{const t=t=>t(e),r=p(e),o=()=>a,a={tag:!0,inner:e,fold:(t,r)=>r(e),isValue:v,isError:g,map:t=>br.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:r,or:o,getOrThunk:r,orThunk:o,getOrDie:r,each:t=>{t(e)},toOptional:()=>w.some(e)};return a},wr=e=>{const t=()=>r,r={tag:!1,inner:e,fold:(t,r)=>t(e),isValue:g,isError:v,map:t,mapError:t=>br.error(t(e)),bind:t,exists:g,forall:v,getOr:h,or:h,getOrThunk:y,orThunk:y,getOrDie:(o=String(e),()=>{throw new Error(o)}),each:d,toOptional:w.none};var o;return r},br={value:vr,error:wr,fromOption:(e,t)=>e.fold((()=>wr(t)),vr)},fr=e=>((e,t)=>ke(e.dom.cloneNode(!0)))(e),kr=(e,t,r)=>br.error({errorMessage:t(e),repairErrorData:r}),xr=(e,t,r,o,a,n)=>0===t.length?kr(o,n,{}):Ar(e,t,r,a,n),Ar=(e,t,r,o,a)=>t===r?kr(o,a,{}):br.value(e),Cr=e=>{const t=e.split("/");return w.from(t.pop())},Tr=(e,t,r,o,a,n)=>{const i=ge(e,"src").bind(Cr).getOr(""),s=r[`${t}_textinput`];return r[`${t}_checkbox`]?(e=>(me(e,"alt",""),me(e,"role","presentation"),br.value(e)))(e):xr(e,s,i,o,a,n).map((e=>(me(e,"alt",s),"presentation"===ye(e,"role")&&ve(e,"role"),e)))},Dr=e=>e.dom.textContent,Ir=(e,t,r,o,a,n)=>{const i=ye(e,"summary");return xr(e,r[t],i,o,a,n).map((o=>{const a=Je(e,"caption").fold((()=>fe("caption")),(e=>{var t;return(t=e).dom.textContent="",S(Se(t),(e=>{mr(e)})),e}));return((e,t)=>{e.dom.textContent=t})(a,r[t]),((e,t)=>{(e=>((e,t)=>{const r=e.dom.childNodes;return w.from(r[0]).map(ke)})(e))(e).fold((()=>{pr(e,t)}),(r=>{e.dom.insertBefore(t.dom,r.dom)}))})(o,a),o}))},_r=e=>`${e}_checkbox`,Sr=e=>`${e}_textinput`,Nr=(e,t)=>{const r=t.id,o=!0===e[_r(r)],a=e[Sr(r)].length>0;return!o&&!a},Mr=(e,t,r)=>{const o=r.id,a=_r(o),n=Sr(o);!0===t[a]?(e.setEnabled(n,!1),e.setEnabled(lr.Repair,!0)):(e.setEnabled(n,!0),t[n].length>0?(e.setEnabled(lr.Repair,!0),e.setEnabled(a,!0)):(e.setEnabled(a,!0),e.setEnabled(lr.Repair,!1)))},Or=(e,t)=>{const r=ar(Sr(t),X((o="a11y.i1.repair.info",e?`${o}.decorativeAllowed`:`${o}.decorativeNotAllowed`)));var o;return e?[nr(_r(t),X("a11y.i1.repair.checkboxlabel"),X("a11y.i1.repair.checkboxtext")),r]:[r]},Er=(e,t,r)=>{const o=ye(e,"alt"),a=t?{[_r(r)]:!1}:{};return{[Sr(r)]:o||"",...a}},Rr=e=>{const t=U(e),r={H93:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.h93.repair.info"),[{text:"a11y.h93.repair.deduplicate.others",value:"others"},{text:"a11y.h93.repair.deduplicate.this",value:"this"},{text:"a11y.h93.repair.deduplicate.all",value:"all"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o)=>{const a=r[t],n="all"===a||"this"===a;if("all"===a||"others"===a){const t=ye(e,"id"),r=o.getBody(),a=ke(r),n=We(a,`*[id="${t}"]`),i=N(n,(t=>!Ce(t,e)));S(i,(e=>{ve(e,"id")}))}return n&&ve(e,"id"),br.value(e)})(t,r,o,e))}))},shouldDisableRepair:w.none(),onChange:w.none()}),I1:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Nr):w.none(),onChange:t?w.some(Mr):w.none()}),I2:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Nr):w.none(),onChange:t?w.some(Mr):w.none()}),I3:w.some({ui:w.some(((e,t)=>({items:Or(!1,e),initialData:Er(t,!1,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a)=>{const n=r[`${t}_textinput`];return((e,t,r,o,a,n=100)=>{const i=`${t}_textinput`;return r.length>n?kr([o,r.length],a,{[i]:r}):br.value(e)})(e,t,n,o,a,100).map((e=>(me(e,"alt",n),e)))})(t,r,o,"a11y.i3.repair.error",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T1:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T2:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t2.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a,n)=>{const i=Qe(e,"caption").filter(le).map(Dr).getOr("");return xr(e,r[t],i,"a11y.t2.repair.errors.empty","a11y.t2.repair.errors.duplicate",n).map((o=>(me(e,"summary",r[t]),o)))})(t,r,o,0,0,X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T3:w.some({ui:w.some(((e,t)=>{const r=Je(t,"caption").fold(p(""),gr);return{items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:r}}})),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T4A:w.none(),T4B:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4b.repair.info"),[{text:"a11y.t4c.repair.header.row",value:"row"},{text:"a11y.t4c.repair.header.col",value:"col"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{let o=[];if("row"===r[t]){const t=ke(e.dom.rows[0]);o=Re(t,"td")}else"col"===r[t]&&S(e.dom.rows,(e=>{Je(ke(e),"td").each((e=>{o.push(e)}))}));return S(o,(e=>{const t=fe("th");S(e.dom.attributes,(r=>{ge(e,r.name).each((e=>me(t,r.name,e)))})),t.dom.innerHTML=e.dom.innerHTML,dr(e,t),mr(e)})),br.value(e)})(t,r,o))}))},shouldDisableRepair:w.some(((e,t)=>!at(t.element,"td"))),onChange:w.none()}),T4C:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4c.repair.info"),[{text:"a11y.t4c.repair.scope.row",value:"row"},{text:"a11y.t4c.repair.scope.col",value:"col"},{text:"a11y.t4c.repair.scope.rowgroup",value:"rowgroup"},{text:"a11y.t4c.repair.scope.colgroup",value:"colgroup"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>(me(e,"scope",r[t]),br.value(e)))(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D1:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.d1.repair.info"),[{text:"a11y.d1.repair.block.h1",value:"h1"},{text:"a11y.d1.repair.block.h2",value:"h2"},{text:"a11y.d1.repair.block.h3",value:"h3"},{text:"a11y.d1.repair.block.h4",value:"h4"},{text:"a11y.d1.repair.block.h5",value:"h5"},{text:"a11y.d1.repair.block.h6",value:"h6"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{const o=Te(e),a=fe(r[t],o.dom),n=Se(e),i=_(n,fr);hr(a,i);const s=We(a,"b,strong");return S(s,yr),ur(e,a),mr(e),br.value(a)})(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D2:w.none(),D3:w.some({ui:w.none(),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a((e=>{const t=W(_e(e));return E(t,he("a")).fold((()=>br.error({errorMessage:"Failed to find previous link",repairErrorData:{}})),(r=>{for(const e of t){if(Ce(e,r))break;ue(e)&&mr(e)}const o=Se(e);return hr(r,o),mr(e),br.value(r)}))})(t))}))},shouldDisableRepair:w.none(),onChange:w.none()})};return e=>r.hasOwnProperty(e)?r[e]:w.none()},Wr=(t,r)=>{const o=(()=>{const t=(t=>{const r=e(w.none()),o=()=>r.get().each(t);return{clear:()=>{o(),r.set(w.none())},isSet:()=>r.get().isSome(),get:()=>r.get(),set:e=>{o(),r.set(w.some(e))}}})(d);return{...t,on:e=>t.get().each(e)}})(),a=()=>{o.clear(),r.clear()},n=()=>{const e=((e,t,r,o,a)=>t.scan().fold((()=>e(ir(o,a))),(n=>e(cr(n,t,r,w.none(),o,a)))))((e=>t.windowManager.open(e,{inline:"toolbar",ariaAttrs:!0})),r,Rr(t),t,a);o.set(e)},i=e=>e.close();return t.ui.registry.addButton("a11ycheck",{tooltip:X("a11y.control.tooltip"),icon:"accessibility-check",onAction:n}),t.ui.registry.addMenuItem("a11ycheck",{icon:"accessibility-check",text:X("a11y.control.menutext"),onAction:n}),()=>o.get().fold(n,i)};tinymce.PluginManager.requireLangPack("a11ychecker","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_PT,pt_BR,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_TW,zh_CN"),tinymce.PluginManager.add("a11ychecker",((e,t)=>{if(((e,t)=>!!e&&-1===((e,t)=>{const r=f(e.major,t.major);if(0!==r)return r;const o=f(e.minor,t.minor);if(0!==o)return o;const a=f(e.patch,t.patch);return 0!==a?a:0})((e=>x((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),x(t)))(tinymce,"6.8.0"))return console.error('The "a11ychecker" plugin requires at least version 6.8.0 of TinyMCE.'),{};((e,t)=>{const r=e.options.register;r("a11ychecker_css_url",{processor:"string",default:t+"/css/annotations.css"}),r("a11ychecker_allow_decorative_images",{processor:"boolean"});const a=[$(),G(),P()];r("a11ychecker_level",{processor:e=>o(e)&&D(a,e),default:G()});const n=[H(),q()];r("a11ychecker_html_version",{processor:e=>o(e)&&D(n,e),default:q()}),r("a11ychecker_issue_url_callback",{processor:"function",default:e=>`https://www.tiny.cloud/docs/tinymce/${tinymce.majorVersion}/a11ychecker/#${e}`}),r("a11ychecker_ignored_rules",{processor:"string",default:""}),r("a11ychecker_filter_issue",{processor:"function",default:v})})(e,t);const r=Zt(e),a=j(e),n=Wr(e,r);return e.on("init",(()=>{const t="a11ychecker/css/annotations.css";if(tinymce.Resource.has(t)){const r=tinymce.Resource.get(t);e.dom.styleSheetLoader.loadRawCss(t,r)}else e.dom.loadCSS(a)})),{getReport:r.getReport,toggleaudit:n}}))}(); \ No newline at end of file +!function(){"use strict";const e=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(r=o=e,(a=String).prototype.isPrototypeOf(r)||(null===(n=o.constructor)||void 0===n?void 0:n.name)===a.name)?"string":t;var r,o,a,n})(t)===e,r=e=>t=>typeof t===e,o=t("string"),a=t("object"),n=t("array"),i=r("boolean"),s=(void 0,e=>undefined===e);const l=e=>!(e=>null==e)(e),c=r("function"),u=r("number"),d=()=>{},p=e=>()=>e,h=e=>e,m=(e,t)=>e===t,y=e=>e(),g=p(!1),v=p(!0);class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return l(e)?w.some(e):w.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}w.singletonNone=new w(!1);const b=e=>parseInt(e,10),f=(e,t)=>{const r=e-t;return 0===r?0:r>0?1:-1},k=(e,t,r)=>({major:e,minor:t,patch:r}),x=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?k(b(t[1]),b(t[2]),b(t[3])):k(0,0,0)},A=Array.prototype.slice,C=Array.prototype.indexOf,T=Array.prototype.push,D=(e,t)=>((e,t)=>C.call(e,t))(e,t)>-1,I=(e,t)=>{for(let r=0,o=e.length;r{const r=e.length,o=new Array(r);for(let a=0;a{for(let r=0,o=e.length;r{const r=[];for(let o=0,a=e.length;o(S(e,((e,o)=>{r=t(r,e,o)})),r),O=(e,t,r)=>{for(let o=0,a=e.length;oO(e,t,g),R=(e,t)=>(e=>{const t=[];for(let r=0,o=e.length;r{const t=A.call(e,0);return t.reverse(),t},H=p("html4"),q=p("html5"),$=p("a"),G=p("aa"),P=p("aaa"),L=e=>t=>t.options.get(e),j=L("a11ychecker_css_url"),B=L("a11ychecker_level"),V=L("a11ychecker_html_version"),F=L("a11ychecker_issue_url_callback"),z=L("a11ychecker_filter_issue"),U=e=>{var t;return null!==(t=e.options.get("a11ychecker_allow_decorative_images"))&&void 0!==t?t:e.options.get("a11y_advanced_options")},K=tinymce.util.I18n,J={"a11y.d1.description":"This paragraph looks like a heading. If it is a heading, please select a heading level.","a11y.d1.repair.block.h1":"Heading 1","a11y.d1.repair.block.h2":"Heading 2","a11y.d1.repair.block.h3":"Heading 3","a11y.d1.repair.block.h4":"Heading 4","a11y.d1.repair.block.h5":"Heading 5","a11y.d1.repair.block.h6":"Heading 6","a11y.d1.repair.info":"Select a heading level:","a11y.d2.description":"Headings must be applied in sequential order. For example: Heading 1 should be followed by Heading 2, not Heading 3.","a11y.d3.description":"Adjacent links with the same URL should be merged into one link","a11y.d4.description":"The selected text appears to be a list. Lists should be formatted using a list tag.","a11y.d5a.description":"Large text must have a contrast ratio of at least 3:1","a11y.d5b.description":"Text must have a contrast ratio of at least 4.5:1","a11y.d5c.description":"Text must have a contrast ratio of at least 7:1","a11y.h93.description":"ID attribute must be unique","a11y.h93.repair.info":"Make ID unique","a11y.h93.repair.deduplicate.others":"Keep this ID and remove all others","a11y.h93.repair.deduplicate.this":"Remove this ID","a11y.h93.repair.deduplicate.all":"Remove all IDs","a11y.i1.description.decorativeAllowed":"Images must be marked as decorative or have an alternative text description","a11y.i1.description.decorativeNotAllowed":"Images must have an alternative text description. Decorative images are not allowed.","a11y.i1.repair.errors.duplicate":"Alternative text cannot be the same as the filename","a11y.i1.repair.errors.empty":"Alternative text cannot be empty","a11y.i1.repair.info.decorativeAllowed":"Or provide alternative text:","a11y.i1.repair.info.decorativeNotAllowed":"Provide alternative text:","a11y.i1.repair.checkboxlabel":"Make image decorative:","a11y.i1.repair.checkboxtext":"Image is decorative","a11y.i2.description":"Alternative text must not be the same as the image filename","a11y.i2.repair.info":"Provide alternative text:","a11y.i3.description":"Image alternative text should be less than 100 characters","a11y.i3.repair.error":"Alternative text is {0} characters","a11y.t1.description":"Tables must have captions","a11y.t1.repair.errors.duplicate":"Table caption cannot be the same as the table summary","a11y.t1.repair.errors.empty":"Caption cannot be empty","a11y.t1.repair.info":"Provide caption:","a11y.t2.description":"Complex tables should have summaries","a11y.t2.repair.errors.duplicate":"Table summary cannot be the same as the table caption","a11y.t2.repair.errors.empty":"Summary cannot be empty","a11y.t2.repair.info":"Provide table summary:","a11y.t3.description":"Table caption and summary cannot have the same value","a11y.t4a.description":"Table elements must contain TR and TD tags","a11y.t4b.description":"Tables must have at least one header cell","a11y.t4b.repair.info":"Choose table header:","a11y.t4c.description":"Table headers must be applied to a row or a column","a11y.t4c.repair.header.col":"Header column","a11y.t4c.repair.header.row":"Header row","a11y.t4c.repair.info":"Select header scope:","a11y.t4c.repair.scope.col":"Column","a11y.t4c.repair.scope.colgroup":"Column group","a11y.t4c.repair.scope.row":"Row","a11y.t4c.repair.scope.rowgroup":"Row group","a11y.widget.counter":"Issue {0} of {1}","a11y.widget.ignore":"Ignore","a11y.widget.issue.none":"No accessibility issues detected","a11y.widget.next":"Next issue","a11y.widget.previous":"Previous issue","a11y.widget.legacyrepair":"Repair issue","a11y.widget.repair":"Repair","a11y.widget.title":"Accessibility Checker","a11y.widget.help.title":"Click for more info","a11y.control.tooltip":"Accessibility checker","a11y.control.menutext":"Accessibility checker...",error:"Error",warning:"Warning",info:"Info",success:"Success"},Q=e=>J[e],X=e=>Array.isArray(e)?K.translate([Q(e[0]),...e.slice(1)]):K.translate(Q(e)),Y=Object.keys,Z=Object.hasOwnProperty,ee=(e,t)=>{const r=Y(e);for(let o=0,a=r.length;o(t,r)=>{e[r]=t},re=(e,t)=>Z.call(e,t),oe="undefined"!=typeof window?window:Function("return this;")(),ae=(e,t)=>((e,t)=>{let r=null!=t?t:oe;for(let t=0;t{const t=ae("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const r=((e,t)=>ae(e,t))(e,t);if(null==r)throw new Error(e+" not available on this browser");return r})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ne(e).constructor.name))},se=e=>t=>(e=>e.dom.nodeType)(t)===e,le=e=>ce(e)&&ie(e.dom),ce=se(1),ue=se(3),de=se(9),pe=se(11),he=e=>t=>ce(t)&&t.dom.nodeName.toLowerCase()===e,me=(e,t,r)=>{((e,t,r)=>{if(!(o(r)||i(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")})(e.dom,t,r)},ye=(e,t)=>{const r=e.dom.getAttribute(t);return null===r?void 0:r},ge=(e,t)=>w.from(ye(e,t)),ve=(e,t)=>{e.dom.removeAttribute(t)},we=(e=>{const t="ephox-foam".replace(/\./g,"-");return{resolve:e=>t+"-"+e}})().resolve,be=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},fe=(e,t)=>{const r=(t||document).createElement(e);return be(r)},ke=be,xe=(e,t)=>{const r=e.dom;if(1!==r.nodeType)return!1;{const e=r;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Ae=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ce=(e,t)=>e.dom===t.dom,Te=e=>ke(e.dom.ownerDocument),De=e=>w.from(e.dom.parentNode).map(ke),Ie=e=>w.from(e.dom.previousSibling).map(ke),_e=e=>W(((e,t)=>{const r=[],o=e=>(r.push(e),t(e));let a=t(e);do{a=a.bind(o)}while(a.isSome());return r})(e,Ie)),Se=e=>_(e.dom.childNodes,ke),Ne=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode)?e=>ke(e.dom.getRootNode()):e=>de(e)?e:Te(e),Me=e=>ke(e.dom.host),Oe=e=>{const t=ue(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const r=t.ownerDocument;return(e=>{const t=Ne(e);return pe(r=t)&&l(r.dom.host)?w.some(t):w.none();var r})(ke(t)).fold((()=>r.body.contains(t)),(o=Oe,a=Me,e=>o(a(e))));var o,a},Ee=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ke(t)},Re=(e,t)=>((e,r)=>N(Se(e),(e=>xe(e,t))))(e),We=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?[]:_(r.querySelectorAll(e),ke)})(t,e),He=(e,t,r)=>{me(e,t,r)},qe=(e,t,r)=>{ve(e,t),ve(e,r)},$e=e=>{const t=e.editor;return{start:t=>{((e,t,r,o,a,n)=>{S(e,(e=>{const r=((e,t,r,o)=>{switch(e){case"info":return w.some(t);case"warning":return w.some(r);case"error":return w.some(o);default:return w.none()}})(e.severity,o,a,n).toArray().concat([t]);S(r,(t=>{me(e.element,t,1)}))})),w.from(e[0]).each((e=>{He(e.element,r,e.severity)}))})(t,e.violation,e.current,e.info,e.warn,e.error)},moveTo:(r,o)=>{((e,t,r,o)=>{const a=We(e,"["+t+"]");S(a,(e=>{ve(e,t)})),He(r,t,o)})(ke(t.getBody()),e.current,r,o)},stop:()=>{((e,t,r,o,a,n)=>{const i=We(e,"["+t+"]");S(i,(e=>{S([t,r,o,a,n],(t=>{ve(e,t)})),qe(e,t,r)}))})(ke(t.getBody()),e.violation,e.current,e.info,e.warn,e.error)},exclude:t=>{qe(t,e.violation,e.current)}}},Ge="data-"+we("a11y-current-violation"),Pe="data-"+we("a11y-violation"),Le="data-"+we("a11y-severity-info"),je="data-"+we("a11y-severity-warn"),Be="data-"+we("a11y-severity-error"),Ve="data-"+we("accessibility-ignore"),Fe=p(Ve),ze=(e,t,r)=>{let o=e.dom;const a=c(r)?r:g;for(;o.parentNode;){o=o.parentNode;const e=ke(o);if(t(e))return w.some(e);if(a(e))break}return w.none()},Ue=(e,t)=>E(e.dom.childNodes,(e=>t(ke(e)))).map(ke),Ke=(e,t,r)=>ze(e,(e=>xe(e,t)),r),Je=(e,t)=>Ue(e,(e=>xe(e,t))),Qe=(e,t)=>((e,t)=>{const r=void 0===t?document:t.dom;return Ae(r)?w.none():w.from(r.querySelector(e)).map(ke)})(t,e),Xe=(e,t,r)=>((e,t,r,o,a)=>((e,t)=>xe(e,t))(r,o)?w.some(r):c(a)&&a(r)?w.none():t(r,o,a))(0,Ke,e,t,r),Ye=(e,t=!1)=>{return Oe(e)?e.dom.isContentEditable:(r=e,Xe(r,"[contenteditable]")).fold(p(t),(e=>"true"===Ze(e)));var r},Ze=e=>e.dom.contentEditable,et=e=>{const t=(e=>ze(e,le).exists(Ye))(e);return t&&le(e)&&Ye(e)},tt=(e,t)=>N(e.querySelectorAll(t),(e=>et(ke(e)))),rt=(e,t,r)=>R(t,(t=>"I1"===t.id?t.check(e,r)?[{rule:t,element:e}]:[]:t.check(e)?[{rule:t,element:e}]:[])),ot=(e,t)=>{let r=[];const o=((e,t)=>{const r=[],o=[];for(let t=0,n=e.length;txe(t,e)))&&le(t)&&et(t)){const o=rt(t.dom,n,e.allowDecorativeImages);r=r.concat(o)}}const c=((e,t)=>R(t,(t=>_(t.check(e),(e=>({rule:t,element:e}))))))(t,i);return r=r.concat(c),r.sort(((e,t)=>((e,t)=>e===t?0:((e,t)=>((e,t,r)=>0!=(e.compareDocumentPosition(t)&r))(e,t,Node.DOCUMENT_POSITION_PRECEDING))(e,t)?1:-1)(e.element,t.element))),r},at=(e,t)=>Qe(e,t).isSome(),nt=p("error"),it=p("warning"),st=(e,t)=>{const r=e;return r.matches?r.matches(t):r.webkitMatchesSelector?r.webkitMatchesSelector(t):r.mozMatchesSelector?r.mozMatchesSelector(t):!!r.msMatchesSelector&&r.msMatchesSelector(t)},lt=e=>e.length>0,ct=((e,t)=>{const r=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return r(t).getOr("")},getOption:r,set:(t,r)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=r}}})(ue),ut=e=>ct.get(e),dt=e=>pt(e).isSome(),pt=e=>Ue(e,(e=>ue(e)&<(ut(e).trim()))),ht="strong,b",mt=(e,t)=>pt(e).fold((()=>((e,t)=>{for(let r=0,o=e.length;rmt(e,t)))),(e=>((e,t)=>Ke(e,ht,(e=>Ce(e,t))).isSome())(e,t))),yt={id:"D1",wcag:"1.3.1",severity:it(),desckey:"a11y.d1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H42.html",walkable:!0,check:e=>{const t=ke(e);return!(!st(e,"p")||!at(t,ht))&&mt(t,t)},levels:[$(),G(),P()],htmlversions:[H(),q()]},gt={id:"D2",wcag:"1.3.1",severity:nt(),desckey:"a11y.d2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G141.html",walkable:!1,check:e=>{const t=tt(e,"h1,h2,h3,h4,h5,h6");let r;const o=[];return S(t,(e=>{const t=parseInt(e.tagName.slice(1),10);r&&t-r>1&&o.push(e),r=t})),o},levels:[$(),G(),P()],htmlversions:[H(),q()]},vt={id:"D3",wcag:"2.4.4",severity:nt(),desckey:"a11y.d3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H2.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"a + a"),o=N(r,(e=>{const t=W(_e(e));return O(t,he("a"),(e=>{return!(ue(t=e)&&(r=ut(t).replace(/[\u200B-\u200D\uFEFF]/g,""),!lt(r)));var t,r})).exists((t=>t.dom.href===e.dom.href))&&et(e)}));return _(o,(e=>e.dom))},levels:[$(),G(),P()],htmlversions:[H(),q()]},wt=(e,t)=>{const r=e.nodeName,o=((e,t)=>{let r=e.nextSibling;for(;null!==r&&(t&&"#text"===r.nodeName||"BR"===r.nodeName);)r=r.nextSibling;return r})(e,t);return null!==o&&o.nodeName===r&&o},bt=(e,t,r)=>{const o=[];if(t(e)){o.push(e);let a=wt(e,r);for(;!1!==a&&t(a);)o.push(a),a=wt(a,r)}return o},ft=(e,t)=>{let r=-1;for(let o=0;o{const r=tt(e,"p,h1,h2,h3,h4,h5,h6"),o=[];let a=0;for(;a1){o.push(e);const t=n[n.length-1],i=ft(r,t);a=-1===i?a+1:i}else l(e.firstChild)?(bt(e.firstChild,t,!1).length>1&&o.push(e),a++):a++}return o},xt=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}([a-z1-9]|i+)\s{0,}[.)-]/gim))},At={id:"D4o",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,xt),levels:[$(),G(),P()],htmlversions:[H(),q()]},Ct=e=>{var t;return l(null===(t=e.textContent)||void 0===t?void 0:t.match(/^\s{0,}(\*|-)\s{0,}/gim))},Tt={id:"D4u",wcag:"1.3.1",severity:nt(),desckey:"a11y.d4.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H48.html",walkable:!1,check:e=>kt(e,Ct),levels:[$(),G(),P()],htmlversions:[H(),q()]},Dt=(e,t)=>{const r=e.dom,o=window.getComputedStyle(r).getPropertyValue(t);return""!==o||Oe(e)?o:It(r,t)},It=(e,t)=>(e=>void 0!==e.style&&c(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"",_t=(e,t,r,o)=>({red:e,green:t,blue:r,alpha:o}),St=e=>{const t=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=e.red/255,o=e.green/255,a=e.blue/255;return.2126*t(r)+.7152*t(o)+.0722*t(a)},Nt=(e,t)=>{const r=e.alpha+t.alpha*(1-e.alpha),o=(e.red*e.alpha+t.red*t.alpha*(1-e.alpha))/r,a=(e.green*e.alpha+t.green*t.alpha*(1-e.alpha))/r,n=(e.blue*e.alpha+t.blue*t.alpha*(1-e.alpha))/r;return _t(Math.ceil(o),Math.ceil(a),Math.ceil(n),r)},Mt=e=>{const t=(e,t,r,o)=>{const a=parseInt(e,10),n=parseInt(t,10),i=parseInt(r,10),s=parseFloat(o);return w.some(_t(a,n,i,s))};if("transparent"===e)return t("0","0","0","0");const r=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/.exec(e);if(null!==r)return t(r[1],r[2],r[3],"1");const o=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/.exec(e);return null!==o?t(o[1],o[2],o[3],o[4]):w.none()},Ot=(e,t)=>{const r=parseFloat(Dt(e,"opacity"));return r<1?_t(t.red,t.green,t.blue,t.alpha*r):t},Et=(e,t)=>Rt(e).filter((e=>e{const t=(e=>{const t=Te(e),r=Ee(t),o=[e].concat(((e,t)=>{const r=c(t)?t:g;let o=e.dom;const a=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=ke(e);if(a.push(t),!0===r(t))break;o=e}return a})(e,(e=>Ce(e,r)))),a=M(o,((e,t)=>{if(1===e.alpha)return e;const r=Dt(t,"background-color");return Mt(r).bind((r=>{const o=Ot(t,r);return o.alpha>0?w.some(Nt(e,o)):w.none()})).getOr(e)}),_t(0,0,0,0));return a.alpha<1?Nt(a,_t(255,255,255,1)):a})(e);return((e,t)=>{const r=Dt(e,"color");return Mt(r).bind((r=>{const o=Ot(e,r),a=o.alpha<1?Nt(o,t):o;return w.some(a)}))})(e,t).map((e=>{const r=St(t);return((e,t)=>(Math.max(e,t)+.05)/(Math.min(e,t)+.05))(St(e),r)}))},Wt={id:"D5c",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G17.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&Et(t,7)},levels:[P()],htmlversions:[H(),q()]},Ht=e=>{const t=Dt(e,"font-size"),r=new RegExp(".*px").test(t),o=/(\d*\.?\d*)(.*)/.exec(t);return r&&null!==o?w.some(Number(o[1])):w.none()},qt=e=>{const t=(e=>{const t=Dt(e,"font-weight");return!("bold"!==t&&"bolder"!==t)||!!/^[0-9]*$/.test(r=t)&&parseInt(r,10)>=700;var r})(e),r=Te(e),o=Ee(r),a=Ht(o);return Ht(e).fold(g,(e=>a.fold((()=>e>=24||t&&e>=19),(r=>e>=1.5*r||t&&e>=1.2*r))))},$t={id:"D5a",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G145.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&qt(t)&&Et(t,3)},levels:[G()],htmlversions:[H(),q()]},Gt={id:"D5b",wcag:"1.4.3",severity:nt(),desckey:"a11y.d5b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G18.html",walkable:!0,check:e=>{const t=ke(e);return dt(t)&&!qt(t)&&Et(t,4.5)},levels:[G()],htmlversions:[H(),q()]},Pt={id:"H93",wcag:"4.1.1",severity:nt(),desckey:"a11y.h93.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H93.html",walkable:!1,check:e=>{const t=ke(e),r=We(t,"*[id]"),o=M(r,((e,t)=>{const r=ye(t,"id");if(void 0!==r&&et(t)){if(re(e.problems,r))return e;if(re(e.ids,r)){const t=e.ids[r];return{...e,problems:{...e.problems,[r]:t}}}return{...e,ids:{...e.ids,[r]:t.dom}}}return e}),{ids:{},problems:{}});return((e,t)=>{const r=[];return ee(e,((e,o)=>{r.push(t(e,o))})),r})(o.problems,h)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Lt=he("img"),jt={id:"I1",wcag:"1.1.1",severity:nt(),desckey:"a11y.i1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:(e,t)=>{const r=ke(e);if(!Lt(r))return!1;const o=ge(r,"alt"),a=o.isSome(),n=o.exists((e=>""===e.trim())),i=((e,t,r=m)=>e.exists((e=>r(e,t))))(ge(r,"role"),"presentation");return!a||(t?a&&n&&!i||a&&!n&&i:n||i)},levels:[$(),G(),P()],htmlversions:[H(),q()]},Bt={id:"I2",wcag:"1.1.1",severity:nt(),desckey:"a11y.i2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/general/G95.html",walkable:!0,check:e=>(e=>st(e,"img[alt][src]"))(e)&&e.src.split("/").pop()===e.alt.split("/").pop(),levels:[$(),G(),P()],htmlversions:[H(),q()]},Vt={id:"I3",wcag:"N/A",severity:it(),desckey:"a11y.i3.description",url:"",walkable:!0,check:e=>{const t=ke(e);return!!Lt(t)&&ge(t,"alt").exists((e=>e.length>100))},levels:[$(),G(),P()],htmlversions:[H(),q()]},Ft={id:"T1",wcag:"1.3.1",severity:nt(),desckey:"a11y.t1.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H39.html",walkable:!0,check:e=>{if(st(e,"table")){const t=e.querySelector("caption");return!t||st(t,":empty")}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},zt={id:"T2",wcag:"1.3.1",severity:it(),desckey:"a11y.t2.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>st(e,"table")&&l(e.querySelector("[rowspan]")||e.querySelector("[colspan]"))&&!e.hasAttribute("summary"),levels:[$(),G(),P()],htmlversions:[H()]},Ut={id:"T3",wcag:"1.3.1",severity:nt(),desckey:"a11y.t3.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H73.html",walkable:!0,check:e=>{if(st(e,"table")&&e.hasAttribute("summary")){const t=e.querySelectorAll("caption");return t.length>0&&e.getAttribute("summary")===t[0].innerHTML}return!1},levels:[$(),G(),P()],htmlversions:[H(),q()]},Kt={id:"T4b",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4b.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>"table"===e.nodeName.toLowerCase()&&0===e.querySelectorAll("th").length,levels:[$(),G(),P()],htmlversions:[H(),q()]},Jt={id:"T4c",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4c.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H63.html",walkable:!0,check:e=>{return!("th"!==e.nodeName.toLowerCase()||(t=e).hasAttribute("scope")&&/row|col|rowgroup|colgroup/i.test(t.getAttribute("scope")));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Qt=(e,t)=>0===e.querySelectorAll(t).length,Xt={id:"T4a",wcag:"1.3.1",severity:nt(),desckey:"a11y.t4a.description",url:"https://www.w3.org/WAI/WCAG21/Techniques/html/H51.html",walkable:!0,check:e=>{return"table"===e.nodeName.toLowerCase()&&(Qt(t=e,"tr")||Qt(t,"td"));var t},levels:[$(),G(),P()],htmlversions:[H(),q()]},Yt=e=>({id:e.id.toUpperCase(),severity:e.severity,url:e.url,description:X(e.description),element:e.element.dom}),Zt=t=>{const r=(e=>{const t=(e=>{const t=e.options.get("a11ychecker_ignored_rules");return R(tinymce.explode(t),(e=>e.length>0?[e.toUpperCase()]:[]))})(e),r=B(e),o=V(e);return{rules:N([yt,gt,vt,At,Tt,$t,Gt,Wt,Pt,jt,Bt,Vt,Ft,zt,Ut,Jt,Xt,Kt],(e=>!D(t,e.id.toUpperCase())&&D(e.levels,r)&&D(e.htmlversions,o))),allowDecorativeImages:U(e),ignoreSelectors:["img[data-mce-placeholder]","[data-mce-bogus=all] *","[data-mce-bogus]","[data-mce-mergetag-affix]"]}})(t);(e=>{e.on("init",(()=>{S([Ve,Pe,Le,je,Be,Ge],(t=>{e.serializer.addTempAttr(t)}))}))})(t);const o=e(!1),a=(e=>$e({editor:e,violation:Pe,current:Ge,info:Le,warn:je,error:Be}))(t),n=Fe();let i=[],s=0;const l=()=>{const e=ot(r,t.getBody()),o=((e,t)=>_(t,(t=>{const r=t.rule;return{id:r.id.toUpperCase(),description:"I1"!==r.id?r.desckey:U(e)?`${r.desckey}.decorativeAllowed`:`${r.desckey}.decorativeNotAllowed`,element:ke(t.element),url:r.url,severity:r.severity}})))(t,e);return N(o,(e=>{const r=(a=e.element,ge(a,n).map((e=>e.split(" "))).getOr([])),o=z(t);var a;return!D(r,e.id)&&o(Yt(e))}))},c=e=>(s+=e,s=s<0?s+i.length:s%i.length,a.moveTo(i[s].element,i[s].severity),t.selection.scrollIntoView(i[s].element.dom),{summaryLabel:X(["a11y.widget.counter",s+1,i.length]),issue:i[s],index:s+1}),u=()=>i.length>0?w.some(c(0)):w.none(),d=()=>{o.set(!0),i=l(),s=0},p=()=>{a.stop(),o.set(!1),s=0,i=[]};return{scan:()=>(d(),a.start(i),u()),stepIssue:c,getIssues:()=>i.slice(0),getCurrent:u,getReport:()=>{const e=o.get();try{return e||d(),_(i,Yt)}finally{e||p()}},resolveCurrent:e=>(e&&((e,t,r)=>{const o=ge(e,t).map((e=>e.concat(" ",r))).getOr(r);me(e,t,o)})(i[s].element,n,i[s].id),i=l(),u()),clear:p,isAuditing:()=>o.get()}},er=(e,t)=>{const r=t.ui.registry.getAll().icons;return w.from(r[e]).orThunk((()=>w.from(r["temporary-placeholder"]))).getOr("!not found!")},tr={success:"checkmark",info:"info",warning:"notice",error:"warning"},rr=(e,t,r,o,a)=>{const n=X(r),i=X(t);return`
${er(tr[r],e)}

${n}

${i}

`+((e,t,r)=>{const o=`
${er(e,t)}
`;return"help"===e?o:`
${er(e,t)}
`})(o,e,a)+"
"},or=(e,t,r,o)=>({type:"listbox",label:t,name:e,items:_(r,(e=>({text:o(e.text),value:e.value})))}),ar=(e,t)=>({type:"input",name:e,label:t}),nr=(e,t,r)=>({type:"label",label:t,items:[{type:"checkbox",name:e,label:r}]}),ir=(e,t)=>({title:X("a11y.widget.title"),body:{type:"panel",items:[{type:"panel",classes:["tox-accessibility-issue","accessibility-issue--success"],items:[{type:"htmlpanel",html:rr(e,"a11y.widget.issue.none","success","checkmark"),presets:"presentation"}]}]},buttons:[{type:"submit",name:"ok",text:"OK",primary:!0}],onSubmit:e=>e.close(),onClose:t}),sr=(e,t,r)=>{e.redial(t),e.focus(r)};var lr;!function(e){e.Next="next",e.Prev="prev",e.Ignore="ignore",e.Ok="ok",e.Repair="repair"}(lr||(lr={}));const cr=({issue:e,summaryLabel:t},r,o,a,n,i)=>{const s=F(n),l=e=>cr(e,r,o,w.none(),n,i),c=a=>(s,{name:c})=>{if(c===lr.Next||c===lr.Prev){const e=r.stepIssue(c===lr.Next?1:-1);sr(s,l(e),c)}else c===lr.Ignore?r.resolveCurrent(!0).fold((()=>sr(s,ir(n,i),lr.Ok)),(e=>sr(s,l(e),lr.Ignore))):c===lr.Repair&&((a,s)=>{const c=s=>{sr(a,cr({issue:e,summaryLabel:t},r,o,w.some(s),n,i),lr.Repair)},u=()=>r.resolveCurrent(!1).fold((()=>r.scan().fold((()=>sr(a,ir(n,i),lr.Ok)),(e=>sr(a,l(e),lr.Ignore)))),(e=>sr(a,l(e),lr.Ignore)));s.each((t=>{t.repair(e.element,e.id,((e,t)=>{const r={},o={};return((e,t,r,o)=>{ee(e,((e,a)=>{(t(e,a)?r:o)(e,a)}))})(e,t,te(r),te(o)),{t:r,f:o}})(a.getData(),((t,r)=>{return o=r,""===(a=e.id)||o.length>=a.length&&o.substr(0,0+a.length)===a;var o,a})).t,(e=>e.fold(c,u)))}))})(s,a)},u=t=>r=>t.each((t=>{t.onChange.each((t=>t(r,r.getData(),e))),t.shouldDisableRepair.each((t=>{const o=t(r.getData(),e);r.setEnabled(lr.Repair,!o)}))})),d=(r,o,a)=>{const l="warning"===(d=e.severity)?"warn":d;var d;const p=o.map((()=>({type:"panel",classes:["accessibility-issue__repair"],items:o.map((e=>e.items)).getOr([])}))).toArray();return{title:X("a11y.widget.title"),body:{type:"panel",classes:["tox-accessibility-issue",`accessibility-issue--${l}`],items:[{type:"panel",classes:["accessibility-issue__header"],items:[{type:"htmlpanel",html:`

${t}

`,presets:"presentation"},{type:"button",name:lr.Prev,text:X("a11y.widget.previous"),icon:"action-prev",borderless:!0},{type:"button",name:lr.Next,text:X("a11y.widget.next"),icon:"action-next",borderless:!0}]},{type:"htmlpanel",html:rr(n,e.description,e.severity,"help",s(e.id)),presets:"presentation"},...p]},buttons:[{type:"custom",name:lr.Ignore,text:X("a11y.widget.ignore")},{type:"custom",name:lr.Repair,text:X("a11y.widget.repair"),enabled:!a,primary:!0}],initialData:{...o.map((e=>e.initialData)).getOr({})},onAction:c(r),onChange:u(r),onClose:i}};return o(e.id).fold((()=>d(w.none(),w.none(),!0)),(t=>{const r=((e,t,r)=>{const o=t.element;return r.fold((()=>e.ui.map((e=>e(t.id,o)))),(r=>e.ui.map((e=>{const a=e(t.id,o);return{items:a.items.concat([(n=r.errorMessage,{type:"htmlpanel",html:`
${n}
`})]),initialData:{...a.initialData,...r.repairErrorData}};var n}))))})(t,e,a),o=t.shouldDisableRepair.bind((t=>r.map((r=>t(r.initialData,e))))).getOr(!1);return d(w.some(t),r,o)}))},ur=(e,t)=>{De(e).each((r=>{r.dom.insertBefore(t.dom,e.dom)}))},dr=(e,t)=>{const r=(e=>w.from(e.dom.nextSibling).map(ke))(e);r.fold((()=>{De(e).each((e=>{pr(e,t)}))}),(e=>{ur(e,t)}))},pr=(e,t)=>{e.dom.appendChild(t.dom)},hr=(e,t)=>{S(t,(t=>{pr(e,t)}))},mr=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},yr=e=>{const t=Se(e);var r,o;t.length>0&&(r=e,S(o=t,((e,t)=>{const a=0===t?r:o[t-1];dr(a,e)}))),mr(e)},gr=e=>e.dom.innerHTML,vr=e=>{const t=t=>t(e),r=p(e),o=()=>a,a={tag:!0,inner:e,fold:(t,r)=>r(e),isValue:v,isError:g,map:t=>br.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:r,or:o,getOrThunk:r,orThunk:o,getOrDie:r,each:t=>{t(e)},toOptional:()=>w.some(e)};return a},wr=e=>{const t=()=>r,r={tag:!1,inner:e,fold:(t,r)=>t(e),isValue:g,isError:v,map:t,mapError:t=>br.error(t(e)),bind:t,exists:g,forall:v,getOr:h,or:h,getOrThunk:y,orThunk:y,getOrDie:(o=String(e),()=>{throw new Error(o)}),each:d,toOptional:w.none};var o;return r},br={value:vr,error:wr,fromOption:(e,t)=>e.fold((()=>wr(t)),vr)},fr=e=>((e,t)=>ke(e.dom.cloneNode(!0)))(e),kr=(e,t,r)=>br.error({errorMessage:t(e),repairErrorData:r}),xr=(e,t,r,o,a,n)=>0===t.length?kr(o,n,{}):Ar(e,t,r,a,n),Ar=(e,t,r,o,a)=>t===r?kr(o,a,{}):br.value(e),Cr=e=>{const t=e.split("/");return w.from(t.pop())},Tr=(e,t,r,o,a,n)=>{const i=ge(e,"src").bind(Cr).getOr(""),s=r[`${t}_textinput`];return r[`${t}_checkbox`]?(e=>(me(e,"alt",""),me(e,"role","presentation"),br.value(e)))(e):xr(e,s,i,o,a,n).map((e=>(me(e,"alt",s),"presentation"===ye(e,"role")&&ve(e,"role"),e)))},Dr=e=>e.dom.textContent,Ir=(e,t,r,o,a,n)=>{const i=ye(e,"summary");return xr(e,r[t],i,o,a,n).map((o=>{const a=Je(e,"caption").fold((()=>fe("caption")),(e=>{var t;return(t=e).dom.textContent="",S(Se(t),(e=>{mr(e)})),e}));return((e,t)=>{e.dom.textContent=t})(a,r[t]),((e,t)=>{(e=>((e,t)=>{const r=e.dom.childNodes;return w.from(r[0]).map(ke)})(e))(e).fold((()=>{pr(e,t)}),(r=>{e.dom.insertBefore(t.dom,r.dom)}))})(o,a),o}))},_r=e=>`${e}_checkbox`,Sr=e=>`${e}_textinput`,Nr=(e,t)=>{const r=t.id,o=!0===e[_r(r)],a=e[Sr(r)].length>0;return!o&&!a},Mr=(e,t,r)=>{const o=r.id,a=_r(o),n=Sr(o);!0===t[a]?(e.setEnabled(n,!1),e.setEnabled(lr.Repair,!0)):(e.setEnabled(n,!0),t[n].length>0?(e.setEnabled(lr.Repair,!0),e.setEnabled(a,!0)):(e.setEnabled(a,!0),e.setEnabled(lr.Repair,!1)))},Or=(e,t)=>{const r=ar(Sr(t),X((o="a11y.i1.repair.info",e?`${o}.decorativeAllowed`:`${o}.decorativeNotAllowed`)));var o;return e?[nr(_r(t),X("a11y.i1.repair.checkboxlabel"),X("a11y.i1.repair.checkboxtext")),r]:[r]},Er=(e,t,r)=>{const o=ye(e,"alt"),a=t?{[_r(r)]:!1}:{};return{[Sr(r)]:o||"",...a}},Rr=e=>{const t=U(e),r={H93:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.h93.repair.info"),[{text:"a11y.h93.repair.deduplicate.others",value:"others"},{text:"a11y.h93.repair.deduplicate.this",value:"this"},{text:"a11y.h93.repair.deduplicate.all",value:"all"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o)=>{const a=r[t],n="all"===a||"this"===a;if("all"===a||"others"===a){const t=ye(e,"id"),r=o.getBody(),a=ke(r),n=We(a,`*[id="${t}"]`),i=N(n,(t=>!Ce(t,e)));S(i,(e=>{ve(e,"id")}))}return n&&ve(e,"id"),br.value(e)})(t,r,o,e))}))},shouldDisableRepair:w.none(),onChange:w.none()}),I1:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Nr):w.none(),onChange:t?w.some(Mr):w.none()}),I2:w.some({ui:w.some(((e,r)=>({items:Or(t,e),initialData:Er(r,t,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Tr(t,r,o,"a11y.i1.repair.errors.empty","a11y.i1.repair.errors.duplicate",X))}))},shouldDisableRepair:t?w.some(Nr):w.none(),onChange:t?w.some(Mr):w.none()}),I3:w.some({ui:w.some(((e,t)=>({items:Or(!1,e),initialData:Er(t,!1,e)}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a)=>{const n=r[`${t}_textinput`];return((e,t,r,o,a,n=100)=>{const i=`${t}_textinput`;return r.length>n?kr([o,r.length],a,{[i]:r}):br.value(e)})(e,t,n,o,a,100).map((e=>(me(e,"alt",n),e)))})(t,r,o,"a11y.i3.repair.error",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T1:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T2:w.some({ui:w.some(((e,t)=>({items:[ar(e,X("a11y.t2.repair.info"))],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r,o,a,n)=>{const i=Qe(e,"caption").filter(le).map(Dr).getOr("");return xr(e,r[t],i,"a11y.t2.repair.errors.empty","a11y.t2.repair.errors.duplicate",n).map((o=>(me(e,"summary",r[t]),o)))})(t,r,o,0,0,X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T3:w.some({ui:w.some(((e,t)=>{const r=Je(t,"caption").fold(p(""),gr);return{items:[ar(e,X("a11y.t1.repair.info"))],initialData:{[e]:r}}})),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(Ir(t,r,o,"a11y.t1.repair.errors.empty","a11y.t1.repair.errors.duplicate",X))}))},shouldDisableRepair:w.none(),onChange:w.none()}),T4A:w.none(),T4B:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4b.repair.info"),[{text:"a11y.t4c.repair.header.row",value:"row"},{text:"a11y.t4c.repair.header.col",value:"col"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{let o=[];if("row"===r[t]){const t=ke(e.dom.rows[0]);o=Re(t,"td")}else"col"===r[t]&&S(e.dom.rows,(e=>{Je(ke(e),"td").each((e=>{o.push(e)}))}));return S(o,(e=>{const t=fe("th");S(e.dom.attributes,(r=>{ge(e,r.name).each((e=>me(t,r.name,e)))})),t.dom.innerHTML=e.dom.innerHTML,dr(e,t),mr(e)})),br.value(e)})(t,r,o))}))},shouldDisableRepair:w.some(((e,t)=>!at(t.element,"td"))),onChange:w.none()}),T4C:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.t4c.repair.info"),[{text:"a11y.t4c.repair.scope.row",value:"row"},{text:"a11y.t4c.repair.scope.col",value:"col"},{text:"a11y.t4c.repair.scope.rowgroup",value:"rowgroup"},{text:"a11y.t4c.repair.scope.colgroup",value:"colgroup"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>(me(e,"scope",r[t]),br.value(e)))(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D1:w.some({ui:w.some(((e,t)=>({items:[or(e,X("a11y.d1.repair.info"),[{text:"a11y.d1.repair.block.h1",value:"h1"},{text:"a11y.d1.repair.block.h2",value:"h2"},{text:"a11y.d1.repair.block.h3",value:"h3"},{text:"a11y.d1.repair.block.h4",value:"h4"},{text:"a11y.d1.repair.block.h5",value:"h5"},{text:"a11y.d1.repair.block.h6",value:"h6"}],X)],initialData:{[e]:""}}))),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a(((e,t,r)=>{const o=Te(e),a=fe(r[t],o.dom),n=Se(e),i=_(n,fr);hr(a,i);const s=We(a,"b,strong");return S(s,yr),ur(e,a),mr(e),br.value(a)})(t,r,o))}))},shouldDisableRepair:w.none(),onChange:w.none()}),D2:w.none(),D3:w.some({ui:w.none(),repair:(t,r,o,a)=>{e.undoManager.transact((()=>{a((e=>{const t=W(_e(e));return E(t,he("a")).fold((()=>br.error({errorMessage:"Failed to find previous link",repairErrorData:{}})),(r=>{for(const e of t){if(Ce(e,r))break;ue(e)&&mr(e)}const o=Se(e);return hr(r,o),mr(e),br.value(r)}))})(t))}))},shouldDisableRepair:w.none(),onChange:w.none()})};return e=>r.hasOwnProperty(e)?r[e]:w.none()},Wr=(t,r)=>{const o=(()=>{const t=(t=>{const r=e(w.none()),o=()=>r.get().each(t);return{clear:()=>{o(),r.set(w.none())},isSet:()=>r.get().isSome(),get:()=>r.get(),set:e=>{o(),r.set(w.some(e))}}})(d);return{...t,on:e=>t.get().each(e)}})(),a=()=>{o.clear(),r.clear()},n=()=>{const e=((e,t,r,o,a)=>t.scan().fold((()=>e(ir(o,a))),(n=>e(cr(n,t,r,w.none(),o,a)))))((e=>t.windowManager.open(e,{inline:"toolbar",ariaAttrs:!0})),r,Rr(t),t,a);o.set(e)},i=e=>e.close();return t.ui.registry.addButton("a11ycheck",{tooltip:X("a11y.control.tooltip"),icon:"accessibility-check",onAction:n}),t.ui.registry.addMenuItem("a11ycheck",{icon:"accessibility-check",text:X("a11y.control.menutext"),onAction:n}),()=>o.get().fold(n,i)};tinymce.PluginManager.requireLangPack("a11ychecker","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_PT,pt_BR,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_TW,zh_CN"),tinymce.PluginManager.add("a11ychecker",((e,t)=>{if(((e,t)=>!!e&&-1===((e,t)=>{const r=f(e.major,t.major);if(0!==r)return r;const o=f(e.minor,t.minor);if(0!==o)return o;const a=f(e.patch,t.patch);return 0!==a?a:0})((e=>x((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),x(t)))(tinymce,"6.8.0"))return console.error('The "a11ychecker" plugin requires at least version 6.8.0 of TinyMCE.'),{};((e,t)=>{const r=e.options.register;r("a11ychecker_css_url",{processor:"string",default:t+"/css/annotations.css"}),r("a11ychecker_allow_decorative_images",{processor:"boolean"});const a=[$(),G(),P()];r("a11ychecker_level",{processor:e=>o(e)&&D(a,e),default:G()});const n=[H(),q()];r("a11ychecker_html_version",{processor:e=>o(e)&&D(n,e),default:q()}),r("a11ychecker_issue_url_callback",{processor:"function",default:e=>`https://www.tiny.cloud/docs/tinymce/${tinymce.majorVersion}/a11ychecker/#${e}`}),r("a11ychecker_ignored_rules",{processor:"string",default:""}),r("a11ychecker_filter_issue",{processor:"function",default:v})})(e,t);const r=Zt(e),a=j(e),n=Wr(e,r);return e.on("init",(()=>{const t="a11ychecker/css/annotations.css";if(tinymce.Resource.has(t)){const r=tinymce.Resource.get(t);e.dom.styleSheetLoader.loadRawCss(t,r)}else e.dom.loadCSS(a)})),{getReport:r.getReport,toggleaudit:n}}))}(); \ No newline at end of file diff --git a/plugins/advcode/plugin.min.js b/plugins/advcode/plugin.min.js index 72d8be3..d5b8141 100644 --- a/plugins/advcode/plugin.min.js +++ b/plugins/advcode/plugin.min.js @@ -1,10 +1,10 @@ /*! - * Tiny Advanced Code Editor plugin + * Tiny Enhanced Code Editor plugin * * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 3.4.0-107 + * Version: 7.0.0-22 */ -!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),r=t=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return r?o(e(r[1]),e(r[2]),e(r[3])):o(0,0,0)},n=e=>t=>typeof t===e,s=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=r=e,(n=String).prototype.isPrototypeOf(o)||(null===(s=r.constructor)||void 0===s?void 0:s.name)===n.name)?"string":t;var o,r,n,s})(e),i=n("boolean"),c=e=>!(e=>null==e)(e),a=n("function"),d=n("number");class l{constructor(e,t){this.tag=e,this.value=t}static some(e){return new l(!0,e)}static none(){return l.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?l.some(e(this.value)):l.none()}bind(e){return this.tag?e(this.value):l.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:l.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return c(e)?l.some(e):l.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}l.singletonNone=new l(!1);let u=0;const m=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return u++,e+"_"+o+u+String(t)},g=e=>t=>t.options.get(e),p=g("codemirror_script"),h=g("codemirror_css"),v=g("codemirror_linewrapping"),f=g("codemirror_linenumbers"),y=g("codemirror_foldgutter"),b=g("codemirror_gutter"),w=g("codemirror_theme"),C=e=>"rtl"===e.getBody().dir?"rtl":"ltr",S=g("advcode_headless"),_=g("advcode_inline"),k=(e,t,o)=>({customEditorScriptUrl:t+"/customeditor.min.js",codeMirrorScriptUrl:p(e),codeMirrorCssUrl:h(e),lineWrapping:v(e),lineNumbers:f(e),foldGutter:y(e),theme:w(e),direction:C(e),gutter:b(e),editorId:e.id,advcodeInstanceId:m("advcode_instance"),currentAdvStatus:o}),x=()=>{},z=()=>!1,I=(e,t)=>{for(let o=0,r=e.length;oT.call(e,t);"undefined"!=typeof window?window:Function("return this;")();const E=e=>t=>(e=>e.dom.nodeType)(t)===e,M=E(1),N=E(3),O=E(9),D=E(11),L=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},P=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return L(o.childNodes[0])},V=(e,t)=>{const o=(t||document).createElement(e);return L(o)},F=L,j=e=>O(e)?e:F(e.dom.ownerDocument),B=(e,t)=>{e.dom.appendChild(t.dom)},R=e=>D(e)&&c(e.dom.host),$=a(Element.prototype.attachShadow)&&a(Node.prototype.getRootNode)?e=>F(e.dom.getRootNode()):j,W=e=>F(e.dom.host),U=e=>{const t=N(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=$(e);return R(t)?l.some(t):l.none()})(F(t)).fold((()=>o.body.contains(t)),(r=U,n=W,e=>r(n(e))));var r,n},G=()=>H(F(document)),H=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return F(t)},q=(e,t,o)=>{let r=e.dom;const n=a(o)?o:z;for(;r.parentNode;){r=r.parentNode;const e=F(r);if(t(e))return l.some(e);if(n(e))break}return l.none()},K=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Q="\x3c!--mce_cursor--\x3e",J=(e,t)=>{const o=e.dom,r=e.selection,n=r.getBookmark(),s=(e=>A(e,"name"))(n)?o.select(n.name)[n.index]:o.select(`#${n.id}_start`)[0],i=l.from(s).map((t=>{const o=F(e.getBody());return((e,t)=>{const r=P(Q),n=F(e),s=((e,t,o)=>((e,t,o,r,n)=>r(o)?l.some(o):a(n)&&n(o)?l.none():t(o,r,n))(0,q,e,t,o))(n,(e=>((e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute("data-mce-bogus")})(e)),(e=>{return t=o,e.dom===t.dom;var t})).getOr(n);return((e,t)=>{const o=(e=>l.from(e.dom.parentNode).map(F))(e);o.each((o=>{o.dom.insertBefore(t.dom,e.dom)}))})(s,r),r})(t)})),c=t();return i.each(K),r.moveToBookmark(n),c},X=e=>{const t=(e=>{const t=e.split(/\r?\n/);return((e,t)=>{for(let o=0;o{const r=e.indexOf(Q);return(n=-1!==r,s=r,n?l.some(s):l.none()).map((r=>e===Q?0===o?{line:o,ch:0}:{line:o-1,ch:t[o-1].length}:{line:o,ch:r}));var n,s})).getOr({line:0,ch:0})})(J(e,(()=>e.getContent({source_view:!0}))));return{content:e.getContent({source_view:!0}),cursor:t}},Y=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Z=()=>{const e=(e=>{const t=Y(l.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(l.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(l.some(e))}}})(x);return{...e,on:t=>e.get().each(t)}},ee=(e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()},te=e=>{return(t=tinymce,"get",A(t,"get")?l.from(t.get):l.none()).bind((t=>l.from(t.call(tinymce,e))));var t},oe=(e,t)=>te(e).bind((e=>l.from(e.plugins.advcode))).map((e=>(e[t]||(e[t]=Z()),e[t]))),re=(e,t)=>{te(e).bind((e=>l.from(e.plugins.advcode))).each((e=>{e[t]&&delete e[t]}))},ne=(e,t)=>((e,t,o)=>{const r=((e,t)=>{const o=((e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o})(e,t);return void 0===o||""===o?[]:o.split(" ")})(e,t);return((e,t,o)=>{((e,t,o)=>{if(!(s(o)||i(o)||d(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")})(e.dom,t,o)})(e,t,r.concat([o]).join(" ")),!0})(e,"class",t),se={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},ie=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,r=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${r}))(.*)$`)})(),ce=(e,t,o,r="",n)=>{const s=(e=>{const t=te(e).map((e=>{const t=$(F(e.getElement()));return R(o=t)?o:F(j(o).dom.body);var o})).getOrThunk(G);if(M(t))return{element:t,destroy:x};{const e=V("div");return B(t,e),{element:e,destroy:()=>K(e)}}})(o.editorId),i=((e,t)=>{const o=(o,r)=>(r&&!r()||setTimeout((()=>{o.state.completionActive||o.showHint({completeSingle:!1,container:t})}),100),e.Pass);return{completeAfter:o,completeIfAfterLt:t=>o(t,(()=>{const o=t.getCursor();return"<"===t.getRange(e.Pos(o.line,o.ch-1),o)})),completeIfInTag:t=>o(t,(()=>{const o=t.getTokenAt(t.getCursor());return!!("string"!==o.type||/['"]/.test(o.string.charAt(o.string.length-1))&&1!==o.string.length)&&e.innerMode(t.getMode(),o.state).state.tagName}))}})(e,s.element.dom),c="dracula",d={lineWrapping:o.lineWrapping,lineNumbers:o.lineNumbers,foldGutter:o.foldGutter,theme:n.dark?c:o.theme,direction:o.direction,matchTags:{bothTags:!0},keyMap:"sublime",gutters:o.gutter?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[],extraKeys:{"Alt-F":"findPersistent","Ctrl-J":"toMatchingTag","Ctrl-B":"selectNextOccurrence","'<'":i.completeAfter,"'/'":i.completeIfAfterLt,"' '":i.completeIfInTag,"'='":i.completeIfInTag,"Ctrl-Q":e=>{e.foldCode(e.getCursor())}},mode:"text/html",value:r},u=e(t,d),m=e=>{27!==e.keyCode&&e.stopPropagation()};t.addEventListener("keyup",m),t.addEventListener("keydown",m),t.addEventListener("keypress",m),setTimeout((()=>{u.focus(),o.cursor&&u.doc.setCursor(o.cursor)}),0),setTimeout((()=>u.refresh()),200);const g=e=>{const t=u.getWrapperElement();e.fold((()=>{var e,o;t.classList.remove("inherit-font-size"),null===(o=null===(e=t.parentElement)||void 0===e?void 0:e.style)||void 0===o||o.removeProperty("font-size")}),(e=>{var o,r;t.classList.add("inherit-font-size"),null===(r=null===(o=t.parentElement)||void 0===o?void 0:o.style)||void 0===r||r.setProperty("font-size",e)})),u.refresh()},p={getValue:()=>u.doc.getValue(),setValue:e=>u.doc.setValue(e),setDarkMode:e=>{e?u.setOption("theme",c):u.setOption("theme",o.theme)},copyCode:()=>new Promise(((e,t)=>window.isSecureContext?e(navigator.clipboard.writeText(u.getValue())):t("context is not secure"))),setFontSize:g,changeFontSize:e=>{const t=u.getWrapperElement(),o=(d=F(t),m=".CodeMirror-scroll",((e,t)=>{const o=void 0===t?document:t.dom;return 1!==(r=o).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?l.none():l.from(o.querySelector(e)).map(F);var r})(m,d)).map((e=>((e,t)=>{const o=e.dom,r=window.getComputedStyle(o).getPropertyValue(t);return""!==r||U(e)?r:((e,t)=>(e=>void 0!==e.style&&a(e.style.getPropertyValue))(e)?e.style.getPropertyValue(t):"")(o,t)})(e,"font-size"))).getOr("0px"),r=(i=o,c=["unsupportedLength"],l.from(ie.exec(i)).bind((e=>{const t=Number(e[1]),o=e[2];return((e,t)=>I(t,(t=>I(se[t],(t=>e===t)))))(o,c)?l.some({value:t,unit:o}):l.none()}))),n=r.map((e=>e.value)).getOr(0),s=r.map((e=>e.unit)).getOr("");var i,c,d,m;let p=l.none();return"increase"===e&&(p=l.some(`${n+1}${s}`)),"decrease"===e&&(p=l.some(`${n>5?n-1:n}${s}`)),g(p),p},destroy:()=>{t.removeEventListener("keyup",m),t.removeEventListener("keydown",m),t.removeEventListener("keypress",m),re(o.editorId,o.advcodeInstanceId),s.destroy()}};return p},ae={},de=(e,t)=>{if(ae[t])return Promise.resolve();{const o=te(t),r=o.bind((e=>{var t;return l.from(null===(t=e.ui)||void 0===t?void 0:t.styleSheetLoader)})).getOr(tinymce.DOM.styleSheetLoader);return o.each((o=>{o.on("remove",(()=>{r.unload(e),delete ae[t]}))})),ae[t]=!0,((e,t)=>{const o="advcode/css/codemirror.css",r=null!=t?t:tinymce.DOM.styleSheetLoader;if(tinymce.Resource.has(o)){const t=tinymce.Resource.get(o);return r.loadRawCss(e,t),Promise.resolve()}return r.load(e)})(e,r)}},le=e=>({name:"codeview",type:"customeditor",tag:"div",scriptId:"tinymce.plugins.advcode.customeditor",scriptUrl:e.customEditorScriptUrl,settings:e}),ue=(e,t)=>{const o={dark:!1,fullscreen:!1,fontSize:l.none()};e.addCommand("mceCodeEditor",(()=>{_(e)&&!e.inline?"code"===e.mode.get()?e.mode.set("design"):e.mode.set("code"):(()=>{const r=k(e,t,o);((e,t)=>{const o=X(e),r={...t,cursor:o.cursor},n=t.currentAdvStatus,s=oe(t.editorId,t.advcodeInstanceId),i=()=>{let e=[{type:"togglebutton",name:"dark_theme_toggle",text:"Dark/light mode",tooltip:"Dark/light mode",active:n.dark,align:"start"},{type:"custom",name:"increase_font_size",text:"Increase font size",icon:"text-size-increase",align:"start"},{type:"custom",name:"decrease_font_size",text:"Decrease font size",icon:"text-size-decrease",align:"start"},{type:"cancel",name:"cancel",text:"Cancel",align:"end"},{type:"submit",name:"save",text:"Save",primary:!0,align:"end"}];return window.isSecureContext?e=[{type:"custom",name:"copy_code",text:"Copy code",align:"start"}].concat(e):console.warn("Copy code is not allowed since window.isSecureContext is false"),e},c=o=>({title:"Source Code",size:"large",body:{type:"panel",items:[le(r)]},buttons:i(),initialData:{codeview:o},onSubmit:o=>{ee(e,o.getData().codeview),re(t.editorId,t.advcodeInstanceId),o.close()},onClose:()=>{re(t.editorId,t.advcodeInstanceId)},onAction:(e,t)=>{"copy_code"===t.name&&s.each((t=>t.get().each((t=>{(async()=>{const o=setTimeout((()=>{e.block("copying")}),150);await t.copyCode(),clearTimeout(o),e.unblock()})()})))),"increase_font_size"===t.name&&s.each((e=>e.get().each((e=>{n.fontSize=e.changeFontSize("increase")})))),"decrease_font_size"===t.name&&s.each((e=>e.get().each((e=>{n.fontSize=e.changeFontSize("decrease")})))),"dark_theme_toggle"===t.name&&s.each((t=>t.get().each((t=>{t.setDarkMode(!n.dark),n.dark=!n.dark,e.redial(c(e.getData().codeview))}))))}});e.windowManager.open(c(o.content))})(e,r)})()}))},me=e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen(),ge=(e,t,o)=>{const r=Y({dark:!1,fullscreen:!1,fontSize:l.none()}),n=Y(me(e)),s=Z(),i=Y(l.none()),c={dark:!1,fullscreen:!1,fontSize:l.none()},a=()=>i.get().bind((t=>oe(e.id,t))),d=()=>{s.get().each((({destroy:t})=>{t(),r.get().fullscreen!==n.get()&&e.execCommand("mceFullScreen")})),s.clear()};e.ui.registry.addView("code",{buttons:1===o?[{type:"group",buttons:[...e.hasPlugin("fullscreen")?[{type:"togglebutton",icon:"fullscreen",tooltip:"Fullsceen",onAction:t=>{e.execCommand("mceFullScreen",void 0,void 0,{skip_focus:!0});const o=!t.isActive();r.set({...r.get(),fullscreen:o}),t.setActive(o)}}]:[],{type:"togglebutton",icon:"copy",text:"Copy code",onAction:e=>a().each((e=>e.get().each((e=>{(async()=>{await e.copyCode()})()}))))}]},{type:"group",buttons:[{type:"togglebutton",text:"Dark/light mode",tooltip:"Dark/light mode",onAction:e=>{a().each((t=>t.get().each((t=>{r.set({...r.get(),dark:!e.isActive()}),e.setActive(r.get().dark),t.setDarkMode(r.get().dark)}))))}},{type:"togglebutton",icon:"text-size-increase",tooltip:"Increase font size",onAction:e=>a().each((e=>e.get().each((e=>r.set({...r.get(),fontSize:e.changeFontSize("increase")})))))},{type:"togglebutton",icon:"text-size-decrease",tooltip:"Decrease font size",onAction:e=>a().each((e=>e.get().each((e=>r.set({...r.get(),fontSize:e.changeFontSize("decrease")})))))}]},{type:"group",buttons:[{type:"button",text:"Cancel",onAction:()=>{s.get().each((()=>{d(),e.mode.set("design")}))}},{type:"button",text:"Save code",buttonType:"primary",onAction:()=>{s.get().each((({syncWithEditor:t})=>{t(),d(),e.mode.set("design")}))}}]}]:[],onShow:a=>{const d=a.getContainer(),u=k(e,t,c);i.set(l.some(u.advcodeInstanceId)),n.set(me(e)),e.setProgressState(!0),r.get().fullscreen!==me(e)&&e.execCommand("mceFullScreen"),((e,t,o,r)=>{return Promise.all([de(t,o),("tinymce.plugins.advcode.CodeMirror",n=e,tinymce.Resource.load("tinymce.plugins.advcode.CodeMirror",n))]).then((([e,t])=>(e,o,n)=>ce(t(),e,o,n,r)));var n})(p(e),h(e),e.id,r.get()).then((t=>{e.setProgressState(!1),s.set(((e,t,o,r,n,s)=>{const i=X(o),c={...n,cursor:i.cursor},a=V("div");var d;d=a,((e,t)=>{for(let t=0,r=e.length;t{(e=>void 0!==e.dom.classList)(e)?e.dom.classList.add(t):ne(e,t)})(d,o);var o})(0===t?["tox-inline-headless-codemirror","mce-codemirror"]:["tox-custom-editor","tox-inline-codemirror","mce-codemirror"]),B(F(e),a);const{getValue:l,destroy:u,copyCode:m,changeFontSize:g,setDarkMode:p,setFontSize:h}=r(a.dom,c,i.content,s);oe(n.editorId,n.advcodeInstanceId).each((e=>e.set({copyCode:m,changeFontSize:g,setDarkMode:p,setFontSize:h}))),h(s.fontSize);const v=()=>ee(o,l());return 0===t&&o.on("BeforeGetContent",v),{syncWithEditor:v,destroy:()=>{0===t&&(o.off("BeforeGetContent",v),v()),K(a),u()}}})(d,o,e,t,u,r.get()))}))},onHide:d})};tinymce.PluginManager.requireLangPack("advcode","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_CN,zh_TW"),tinymce.PluginManager.add("advcode",((e,o)=>{((e,o)=>!!e&&-1===((e,o)=>{const r=t(e.major,o.major);if(0!==r)return r;const n=t(e.minor,o.minor);if(0!==n)return n;const s=t(e.patch,o.patch);return 0!==s?s:0})((e=>r((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),r(o)))(tinymce,"6.8.0")?console.error("The advcode plugin requires at least version 6.8.0 of TinyMCE."):((e,t)=>{((e,t)=>{const o=e.options.register;o("codemirror_script",{processor:"string",default:t+"/codemirror.min.js"}),o("codemirror_css",{processor:"string",default:t+"/codemirror.min.css"}),o("codemirror_linewrapping",{processor:"boolean",default:!0}),o("codemirror_linenumbers",{processor:"boolean",default:!0}),o("codemirror_foldgutter",{processor:"boolean",default:!0}),o("codemirror_gutter",{processor:"boolean",default:!0}),o("codemirror_theme",{processor:"string",default:"default"}),o("advcode_headless",{processor:"boolean",default:!1}),o("advcode_inline",{processor:"boolean",default:!1})})(e,t),ue(e,t),(e=>{const t="sourcecode",o=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:t,tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:t,text:"Source code",onAction:o})})(e),((e,t)=>{ge(e,t,S(e)?0:1)})(e,t),(e=>{e.mode.register("code",{activate:()=>{"code"!==e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},deactivate:()=>{"code"===e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},editorReadOnly:!1})})(e)})(e,o)}))}(); \ No newline at end of file +!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),n=t=>{const n=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return n?o(e(n[1]),e(n[2]),e(n[3])):o(0,0,0)},r=e=>t=>typeof t===e,s=("string",e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(e));const i=r("boolean"),c=r("function"),a=r("number");class d{constructor(e,t){this.tag=e,this.value=t}static some(e){return new d(!0,e)}static none(){return d.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?d.some(e(this.value)):d.none()}bind(e){return this.tag?e(this.value):d.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:d.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return null==e?d.none():d.some(e)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}d.singletonNone=new d(!1);let l=0;const u=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return l++,e+"_"+o+l+String(t)},m=e=>t=>t.options.get(e),g=m("codemirror_script"),h=m("codemirror_linewrapping"),p=m("codemirror_linenumbers"),f=m("codemirror_foldgutter"),v=m("codemirror_gutter"),y=m("advcode_headless"),b=m("advcode_inline"),_=(e,t,o)=>({customEditorScriptUrl:t+"/customeditor.min.js",codeMirrorScriptUrl:g(e),lineWrapping:h(e),lineNumbers:p(e),foldGutter:f(e),gutter:v(e),editorId:e.id,advcodeInstanceId:u("advcode_instance"),currentAdvStatus:o}),S=()=>{},w=()=>!1,C=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},k=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return C(o.childNodes[0])},x=(e,t)=>{const o=(t||document).createElement(e);return C(o)},z=C;"undefined"!=typeof window?window:Function("return this;")();const A=(e,t,o)=>{let n=e.dom;const r=c(o)?o:w;for(;n.parentNode;){n=n.parentNode;const e=z(n);if(t(e))return d.some(e);if(r(e))break}return d.none()},I=Object.hasOwnProperty,N=(e,t)=>I.call(e,t),T=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},F="\x3c!--mce_cursor--\x3e",M=(e,t)=>{const o=e.dom,n=e.selection,r=n.getBookmark(),s=(e=>N(e,"name"))(r)?o.select(r.name)[r.index]:o.select(`#${r.id}_start`)[0],i=d.from(s).map((t=>{const o=z(e.getBody());return((e,t)=>{const n=k(F),r=z(e),s=((e,t,o)=>((e,t,o,n,r)=>n(o)?d.some(o):c(r)&&r(o)?d.none():t(o,n,r))(0,A,e,t,o))(r,(e=>((e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute("data-mce-bogus")})(e)),(e=>{return t=o,e.dom===t.dom;var t})).getOr(r);return((e,t)=>{const o=(e=>d.from(e.dom.parentNode).map(z))(e);o.each((o=>{o.dom.insertBefore(t.dom,e.dom)}))})(s,n),n})(t)})),a=t();return i.each(T),n.moveToBookmark(r),a},E=e=>{const t=(e=>{const t=e.indexOf(F);return-1===t?0:t})(M(e,(()=>e.getContent({source_view:!0}))));return{content:e.getContent({source_view:!0}),cursor:t}},j=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},D=()=>{const e=(e=>{const t=j(d.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(d.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(d.some(e))}}})(S);return{...e,on:t=>e.get().each(t)}},O=(e,t)=>{e.focus(),e.undoManager.transact((()=>{e.setContent(t)})),e.selection.setCursorLocation(),e.nodeChanged()},V=e=>{return(t=tinymce,"get",N(t,"get")?d.from(t.get):d.none()).bind((t=>d.from(t.call(tinymce,e))));var t},B=(e,t)=>V(e).bind((e=>d.from(e.plugins.advcode))).map((e=>(e[t]||(e[t]=D()),e[t]))),P=(e,t)=>{V(e).bind((e=>d.from(e.plugins.advcode))).each((e=>{e[t]&&delete e[t]}))},L=e=>({name:"codeview",type:"customeditor",tag:"div",onFocus:e=>{((e,t)=>{const o=e=>{for(let t=0;t{var t;null===(t=e.dom.shadowRoot.querySelector(".cm-content"))||void 0===t||t.focus()}))},scriptId:"tinymce.plugins.advcode.customeditor",scriptUrl:e.customEditorScriptUrl,settings:e}),R=(e,t)=>{const o={dark:!1,fullscreen:!1,fontSize:d.none()};e.addCommand("mceCodeEditor",(()=>{b(e)&&!e.inline?"code"===e.mode.get()?e.mode.set("design"):e.mode.set("code"):(()=>{const n=_(e,t,o);((e,t)=>{const o=E(e),n={...t,cursor:o.cursor},r=t.currentAdvStatus,s=B(t.editorId,t.advcodeInstanceId);var i;e.windowManager.open((i=o.content,{title:"Source Code",size:"large",body:{type:"panel",items:[L(n)]},buttons:(()=>{let e=[{type:"togglebutton",name:"dark_theme_toggle",text:"Dark/light mode",active:r.dark,align:"start"},{type:"custom",name:"increase_font_size",text:"Increase font size",icon:"text-size-increase",align:"start"},{type:"custom",name:"decrease_font_size",text:"Decrease font size",icon:"text-size-decrease",align:"start"},{type:"cancel",name:"cancel",text:"Cancel",align:"end"},{type:"submit",name:"save",text:"Save",primary:!0,align:"end"}];return window.isSecureContext?e=[{type:"custom",name:"copy_code",text:"Copy code",align:"start"}].concat(e):console.warn("Copy code is not allowed since window.isSecureContext is false"),e})(),initialData:{codeview:i},onSubmit:o=>{O(e,o.getData().codeview),P(t.editorId,t.advcodeInstanceId),o.close()},onClose:()=>{P(t.editorId,t.advcodeInstanceId)},onAction:(e,t)=>{"copy_code"===t.name&&s.each((t=>t.get().each((t=>{(async()=>{const o=setTimeout((()=>{e.block("copying")}),150);await t.copyCode(),clearTimeout(o),e.unblock()})()})))),"increase_font_size"===t.name&&s.each((e=>e.get().each((e=>{r.fontSize=e.changeFontSize("increase")})))),"decrease_font_size"===t.name&&s.each((e=>e.get().each((e=>{r.fontSize=e.changeFontSize("decrease")})))),"dark_theme_toggle"===t.name&&s.each((e=>e.get().each((e=>{e.setDarkMode(!r.dark),r.dark=!r.dark}))))}}))})(e,n)})()}))},U=(e,t)=>((e,t,o)=>{const n=((e,t)=>{const o=((e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o})(e,t);return void 0===o||""===o?[]:o.split(" ")})(e,t);return((e,t,o)=>{((e,t,o)=>{if(!(s(o)||i(o)||a(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")})(e.dom,t,o)})(e,t,n.concat([o]).join(" ")),!0})(e,"class",t),q=e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen(),H=(e,t,o)=>{const n=j({dark:!1,fullscreen:!1,fontSize:d.none()}),r=j(q(e)),s=D(),i=j(d.none()),c={dark:!1,fullscreen:!1,fontSize:d.none()},a=()=>i.get().bind((t=>B(e.id,t))),l=()=>{s.get().each((({destroy:t})=>{t(),n.get().fullscreen!==r.get()&&e.execCommand("mceFullScreen")})),s.clear()};e.ui.registry.addView("code",{buttons:1===o?[{type:"group",buttons:[...e.hasPlugin("fullscreen")?[{type:"togglebutton",icon:"fullscreen",tooltip:"Fullsceen",onAction:t=>{e.execCommand("mceFullScreen",void 0,void 0,{skip_focus:!0});const o=!t.isActive();n.set({...n.get(),fullscreen:o}),t.setActive(o)}}]:[],{type:"togglebutton",icon:"copy",text:"Copy code",onAction:e=>a().each((e=>e.get().each((e=>{(async()=>{await e.copyCode()})()}))))}]},{type:"group",buttons:[{type:"togglebutton",text:"Dark/light mode",onAction:e=>{a().each((t=>t.get().each((t=>{n.set({...n.get(),dark:!e.isActive()}),e.setActive(n.get().dark),t.setDarkMode(n.get().dark)}))))}},{type:"togglebutton",icon:"text-size-increase",tooltip:"Increase font size",onAction:e=>a().each((e=>e.get().each((e=>n.set({...n.get(),fontSize:e.changeFontSize("increase")})))))},{type:"togglebutton",icon:"text-size-decrease",tooltip:"Decrease font size",onAction:e=>a().each((e=>e.get().each((e=>n.set({...n.get(),fontSize:e.changeFontSize("decrease")})))))}]},{type:"group",buttons:[{type:"button",text:"Cancel",onAction:()=>{s.get().each((()=>{l(),e.mode.set("design")}))}},{type:"button",text:"Save code",buttonType:"primary",onAction:()=>{s.get().each((({syncWithEditor:t})=>{t(),l(),e.mode.set("design")}))}}]}]:[],onShow:a=>{const l=a.getContainer(),u=_(e,t,c);i.set(d.some(u.advcodeInstanceId)),r.set(q(e)),e.setProgressState(!0),n.get().fullscreen!==q(e)&&e.execCommand("mceFullScreen"),(async e=>{var t;return(await(t=e,tinymce.Resource.load("tinymce.plugins.advcode.CodeMirror",t)))()})(g(e)).then((t=>{e.setProgressState(!1),s.set(((e,t,o,n,r,s)=>{const i=E(o),c={...r,cursor:i.cursor},a=x("div");var d;d=a,((e,t)=>{for(let t=0,n=e.length;t{(e=>void 0!==e.dom.classList)(e)?e.dom.classList.add(t):U(e,t)})(d,o);var o})(0===t?["tox-inline-headless-codemirror","mce-codemirror"]:["tox-custom-editor","tox-inline-codemirror","mce-codemirror"]),((e,t)=>{e.dom.appendChild(t.dom)})(z(e),a);const{getValue:l,destroy:u,copyCode:m,changeFontSize:g,setDarkMode:h,setFontSize:p}=n(a.dom,c,i.content,s);B(r.editorId,r.advcodeInstanceId).each((e=>e.set({copyCode:m,changeFontSize:g,setDarkMode:h,setFontSize:p}))),p(s.fontSize);const f=()=>O(o,l());return 0===t&&o.on("BeforeGetContent",f),{syncWithEditor:f,destroy:()=>{0===t&&(o.off("BeforeGetContent",f),f()),T(a),u()}}})(l,o,e,t,u,n.get()))}))},onHide:l})};tinymce.PluginManager.requireLangPack("advcode","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_CN,zh_TW"),tinymce.PluginManager.add("advcode",((e,o)=>{((e,o)=>!!e&&-1===((e,o)=>{const n=t(e.major,o.major);if(0!==n)return n;const r=t(e.minor,o.minor);if(0!==r)return r;const s=t(e.patch,o.patch);return 0!==s?s:0})((e=>n((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),n(o)))(tinymce,"6.8.0")?console.error("The advcode plugin requires at least version 6.8.0 of TinyMCE."):((e,t)=>{((e,t)=>{const o=e.options.register;o("codemirror_script",{processor:"string",default:t+"/codemirror.min.js"}),o("codemirror_linewrapping",{processor:"boolean",default:!0}),o("codemirror_linenumbers",{processor:"boolean",default:!0}),o("codemirror_foldgutter",{processor:"boolean",default:!0}),o("codemirror_gutter",{processor:"boolean",default:!0}),o("advcode_headless",{processor:"boolean",default:!1}),o("advcode_inline",{processor:"boolean",default:!1})})(e,t),R(e,t),(e=>{const t="sourcecode",o=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:t,tooltip:"Source code",onAction:o}),e.ui.registry.addMenuItem("code",{icon:t,text:"Source code",onAction:o})})(e),((e,t)=>{H(e,t,y(e)?0:1)})(e,t),(e=>{e.mode.register("code",{activate:()=>{"code"!==e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},deactivate:()=>{"code"===e.queryCommandValue("ToggleView")&&e.execCommand("ToggleView",!1,"code")},editorReadOnly:!1})})(e)})(e,o)}))}(); \ No newline at end of file diff --git a/plugins/advtable/plugin.min.js b/plugins/advtable/plugin.min.js index 4d18486..c791c01 100644 --- a/plugins/advtable/plugin.min.js +++ b/plugins/advtable/plugin.min.js @@ -1,10 +1,10 @@ /*! - * Tiny Advanced Tables plugin + * Tiny Enhanced Tables plugin * * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 2.1.0-81 + * Version: 7.0.0-22 */ -!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),n=t=>{const n=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return n?o(e(n[1]),e(n[2]),e(n[3])):o(0,0,0)},r=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(t)===e,s=e=>t=>typeof t===e,l=e=>t=>e===t,c=r("string"),i=r("object"),a=r("array"),m=l(null),u=s("boolean"),d=l(void 0),h=e=>null==e,p=e=>!h(e),g=s("function"),f=s("number");class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return p(e)?w.some(e):w.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}w.singletonNone=new w(!1);const b=()=>{},v=e=>()=>e,y=e=>e,C=(e,t)=>e===t;function x(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const S=v(!1),T=v(!0),R=Array.prototype.slice,D=Array.prototype.indexOf,O=Array.prototype.push,A=(e,t)=>{return o=e,n=t,D.call(o,n)>-1;var o,n},E=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n{if(0===e.length)return[];{let o=t(e[0]);const n=[];let r=[];for(let s=0,l=e.length;s(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),I=(e,t,o)=>(W(e,((e,n)=>{o=t(o,e,n)})),o),P=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n(e=>{const t=[];for(let o=0,n=e.length;o{for(let o=0,n=e.length;o{const o=R.call(e,0);return o.sort(t),o},$=(e,t)=>t>=0&&t$(e,0),G=e=>$(e,e.length-1),q=(e,t)=>{for(let o=0;oe.exists((e=>o(e,t))),U=(e,t,o)=>e.isSome()&&t.isSome()?w.some(o(e.getOrDie(),t.getOrDie())):w.none(),K=e=>e.bind(y),Q=(e,t)=>e?w.some(t):w.none(),X=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Y={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return X(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return X(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return X(o)},fromDom:X,fromPoint:(e,t,o)=>w.from(e.dom.elementFromPoint(t,o)).map(X)},J="undefined"!=typeof window?window:Function("return this;")(),Z=(e,t)=>((e,t)=>{let o=null!=t?t:J;for(let t=0;t{const t=Z("ownerDocument.defaultView",e);return i(e)&&((e=>((e,t)=>{const o=((e,t)=>Z(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ee(e).constructor.name))},oe=e=>e.dom.nodeName.toLowerCase(),ne=e=>e.dom.nodeType,re=e=>t=>ne(t)===e,se=e=>8===ne(e)||"#comment"===oe(e),le=re(1),ce=re(3),ie=re(9),ae=re(11),me=e=>t=>le(t)&&oe(t)===e,ue=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},de=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,he=(e,t)=>e.dom===t.dom,pe=ue,ge=e=>Y.fromDom(e.dom.ownerDocument),fe=e=>ie(e)?e:ge(e),we=e=>w.from(e.dom.parentNode).map(Y.fromDom),be=(e,t)=>{const o=g(t)?t:S;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Y.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},ve=e=>w.from(e.dom.previousSibling).map(Y.fromDom),ye=e=>w.from(e.dom.nextSibling).map(Y.fromDom),Ce=e=>N(e.dom.childNodes,Y.fromDom),xe=g(Element.prototype.attachShadow)&&g(Node.prototype.getRootNode)?e=>Y.fromDom(e.dom.getRootNode()):fe,Se=e=>Y.fromDom(e.dom.host),Te=e=>{const t=ce(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=xe(e);return ae(o=t)&&p(o.dom.host)?w.some(t):w.none();var o})(Y.fromDom(t)).fold((()=>o.body.contains(t)),(n=Te,r=Se,e=>n(r(e))));var n,r},Re=(e,t)=>{let o=[];return W(Ce(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(Re(e,t))})),o},De=(e,t,o)=>((e,o,n)=>M(be(e,n),(e=>ue(e,t))))(e,0,o),Oe=(e,t)=>((e,o)=>M(Ce(e),(e=>ue(e,t))))(e),Ae=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return de(o)?[]:N(o.querySelectorAll(e),Y.fromDom)})(t,e),Ee=(e,t,o)=>{let n=e.dom;const r=g(o)?o:S;for(;n.parentNode;){n=n.parentNode;const e=Y.fromDom(n);if(t(e))return w.some(e);if(r(e))break}return w.none()},ke=(e,t,o)=>Ee(e,(e=>ue(e,t)),o),Ne=(e,t)=>((e,o)=>P(e.dom.childNodes,(e=>{return o=Y.fromDom(e),ue(o,t);var o})).map(Y.fromDom))(e),We=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return de(o)?w.none():w.from(o.querySelector(e)).map(Y.fromDom)})(t,e),Le=(e,t,o)=>((e,t,o,n,r)=>((e,t)=>ue(e,t))(o,n)?w.some(o):g(r)&&r(o)?w.none():t(o,n,r))(0,ke,e,t,o),Me=Object.keys,je=Object.hasOwnProperty,Be=(e,t)=>{const o=Me(e);for(let n=0,r=o.length;n{const o=[];return Be(e,((e,n)=>{o.push(t(e,n))})),o},Pe=e=>Ie(e,y),ze=e=>Me(e).length,_e=(e,t)=>Fe(e,t)?w.from(e[t]):w.none(),Fe=(e,t)=>je.call(e,t),$e=e=>{for(const t in e)if(je.call(e,t))return!1;return!0},Ve=(e,t,o)=>{if(!(c(o)||u(o)||f(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},Ge=(e,t,o)=>{Ve(e.dom,t,o)},qe=(e,t)=>{const o=e.dom;Be(t,((e,t)=>{Ve(o,t,e)}))},He=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Ue=(e,t)=>w.from(He(e,t)),Ke=(e,t)=>{e.dom.removeAttribute(t)},Qe=e=>I(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),Xe=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!d(n)||r+t.length<=n)},Ye=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Je=e=>!(e=>e.length>0)(e),Ze=e=>void 0!==e.style&&g(e.style.getPropertyValue),et=(e,t,o)=>{((e,t,o)=>{if(!c(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ze(e)&&e.style.setProperty(t,o)})(e.dom,t,o)},tt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||Te(e)?n:ot(o,t)},ot=(e,t)=>Ze(e)?e.style.getPropertyValue(t):"",nt=(e,t)=>{const o=e.dom,n=ot(o,t);return w.from(n).filter((e=>e.length>0))},rt=(e,t)=>{((e,t)=>{Ze(e)&&e.style.removeProperty(t)})(e.dom,t),H(Ue(e,"style").map(Ye),"")&&Ke(e,"style")},st=(e,t,o=0)=>Ue(e,t).map((e=>parseInt(e,10))).getOr(o),lt=e=>me("col")(e)?st(e,"span",1)>1:((e,t)=>st(e,"colspan",1))(e)>1,ct=v(10),it=(e,t)=>at(e,t,T),at=(e,t,o)=>z(Ce(e),(e=>ue(e,t)?o(e)?[e]:[]:at(e,t,o))),mt=["tfoot","thead","tbody","colgroup"],ut=(e,t,o)=>({element:e,rowspan:t,colspan:o}),dt=(e,t,o)=>({element:e,cells:t,section:o}),ht=(e,t,o)=>({element:e,isNew:t,isLocked:o}),pt=(e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}),gt=(e,t)=>((e,t,o=S)=>o(t)?w.none():A(e,oe(t))?w.some(t):ke(t,e.join(","),(e=>ue(e,"table")||o(e))))(["td","th"],e,t),ft=e=>it(e,"th,td"),wt=e=>ue(e,"colgroup")?Oe(e,"col"):z(yt(e),(e=>Oe(e,"col"))),bt=(e,t)=>Le(e,"table",t),vt=e=>it(e,"tr"),yt=e=>bt(e).fold(v([]),(e=>Oe(e,"colgroup"))),Ct=e=>we(e).map((e=>{const t=oe(e);return(e=>A(mt,e))(t)?t:"tbody"})).getOr("tbody"),xt=(e,t)=>pt(e.element,t,e.section,e.isNew),St=(e,t)=>e.cells[t],Tt=(e,t)=>St(e,t).element,Rt=e=>{const t=L(e,(e=>"colgroup"===e.section));return{rows:t.fail,cols:t.pass}},Dt="data-snooker-locked-cols",Ot=e=>Ue(e,Dt).bind((e=>w.from(e.match(/\d+/g)))).map((e=>((e,t)=>{const o={};for(let n=0,r=e.length;ne+","+t,Et=e=>{const t={},o=[],n=V(e).map((e=>e.element)).bind(bt).bind(Ot).getOr({});let r=0,s=0,l=0;const{pass:c,fail:i}=L(e,(e=>"colgroup"===e.section));W(i,(e=>{const c=[];W(e.cells,(e=>{let o=0;for(;void 0!==t[At(l,o)];)o++;const r=((e,t)=>Fe(e,t)&&void 0!==e[t]&&null!==e[t])(n,o.toString()),i=((e,t,o,n,r,s)=>({element:e,rowspan:t,colspan:o,row:n,column:r,isLocked:s}))(e.element,e.rowspan,e.colspan,l,o,r);for(let n=0;n{const t=(e=>{const t={};let o=0;return W(e.cells,(e=>{const n=e.colspan;k(n,(r=>{const s=o+r;t[s]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,n,s)})),o+=n})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,Pe(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),u=((e,t)=>({rows:e,columns:t}))(r,s);return{grid:u,access:t,all:o,columns:a,colgroups:m}},kt=e=>{const t=(e=>{const t=vt(e);return o=[...yt(e),...t],n=Ct,N(o,(e=>{if("colgroup"===oe(e)){const t=N(wt(e),(e=>{const t=st(e,"span",1);return ut(e,1,t)}));return dt(e,t,"colgroup")}{const t=N(ft(e),(e=>{const t=st(e,"rowspan",1),o=st(e,"colspan",1);return ut(e,t,o)}));return dt(e,t,n(e))}}));var o,n})(e);return Et(t)},Nt=Et,Wt=(e,t,o)=>w.from(e.access[At(t,o)]),Lt=(e,t,o)=>{const n=((e,t)=>{const o=z(e.all,(e=>e.cells));return M(o,t)})(e,(e=>o(t,e.element)));return n.length>0?w.some(n[0]):w.none()},Mt=e=>Pe(e.columns),jt=e=>Me(e.columns).length>0,Bt=(e,t)=>w.from(e.columns[t]),It=e=>Y.fromDom(e.getBody()),Pt=e=>t=>he(t,It(e)),zt=e=>Y.fromDom(e.selection.getStart()),_t=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,Ft=(e,t,o)=>((e,t,o)=>{const n=Lt(e,t,he),r=Lt(e,o,he);return n.bind((e=>r.map((t=>{return o=e,n=t,{startRow:Math.min(o.row,n.row),startCol:Math.min(o.column,n.column),finishRow:Math.max(o.row+o.rowspan-1,n.row+n.rowspan-1),finishCol:Math.max(o.column+o.colspan-1,n.column+n.colspan-1)};var o,n}))))})(e,t,o).bind((t=>((e,t)=>{let o=!0;const n=x(_t,t);for(let r=t.startRow;r<=t.finishRow;r++)for(let s=t.startCol;s<=t.finishCol;s++)o=o&&Wt(e,r,s).exists(n);return o?w.some(t):w.none()})(e,t))),$t=(e,t,o)=>{const n=Vt(e);return Ft(n,t,o)},Vt=kt,Gt=(e,t)=>{we(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},qt=(e,t)=>{ye(e).fold((()=>{we(e).each((e=>{Ut(e,t)}))}),(e=>{Gt(e,t)}))},Ht=(e,t)=>{(e=>((e,t)=>{const o=e.dom.childNodes;return w.from(o[0]).map(Y.fromDom)})(e))(e).fold((()=>{Ut(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Ut=(e,t)=>{e.dom.appendChild(t.dom)},Kt=(e,t)=>{Gt(e,t),Ut(t,e)},Qt=(e,t)=>{W(t,((o,n)=>{const r=0===n?e:t[n-1];qt(r,o)}))},Xt=(e,t)=>{W(t,(t=>{Ut(e,t)}))},Yt=e=>{e.dom.textContent="",W(Ce(e),(e=>{Jt(e)}))},Jt=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Zt=e=>{const t=Ce(e);t.length>0&&Qt(e,t),Jt(e)},eo=((e,t)=>{const o=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return o(t).getOr("")},getOption:o,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(ce),to=e=>eo.get(e),oo=(e,t)=>eo.set(e,t);var no=["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"],ro=()=>({up:v({selector:ke,closest:Le,predicate:Ee,all:be}),down:v({selector:Ae,predicate:Re}),styles:v({get:tt,getRaw:nt,set:et,remove:rt}),attrs:v({get:He,set:Ge,remove:Ke,copyTo:(e,t)=>{const o=Qe(e);qe(t,o)}}),insert:v({before:Gt,after:qt,afterAll:Qt,append:Ut,appendAll:Xt,prepend:Ht,wrap:Kt}),remove:v({unwrap:Zt,remove:Jt}),create:v({nu:Y.fromTag,clone:e=>Y.fromDom(e.dom.cloneNode(!1)),text:Y.fromText}),query:v({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:ve,nextSibling:ye}),property:v({children:Ce,name:oe,parent:we,document:e=>fe(e).dom,isText:ce,isComment:se,isElement:le,isSpecial:e=>{const t=oe(e);return A(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>le(e)?Ue(e,"lang"):w.none(),getText:to,setText:oo,isBoundary:e=>!!le(e)&&("body"===oe(e)||A(no,oe(e))),isEmptyTag:e=>!!le(e)&&A(["br","img","hr","input"],oe(e)),isNonEditable:e=>le(e)&&"false"===He(e,"contenteditable")}),eq:he,is:pe});const so=(e,t,o,n)=>{const r=t(e,o);return B(n,((o,n)=>{const r=t(e,n);return lo(e,o,r)}),r)},lo=(e,t,o)=>t.bind((t=>o.filter(x(e.eq,t)))),co=ro(),io=e=>ke(e,"table"),ao=(e,t,o)=>We(e,t).bind((t=>We(e,o).bind((e=>{return(o=io,n=[t,e],((e,t,o)=>o.length>0?((e,t,o,n)=>n(e,t,o[0],o.slice(1)))(e,t,o,so):w.none())(co,((e,t)=>o(t)),n)).map((o=>({first:t,last:e,table:o})));var o,n})))),mo=y,uo=e=>{const t=(e,t)=>Ue(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&_(e,(e=>t(e,"rowspan")||t(e,"colspan")))?w.some(e):w.none()},ho=(e,t,o)=>{return t.length<=1?w.none():(n=e,r=o.firstSelectedSelector,s=o.lastSelectedSelector,ao(n,r,s).bind((e=>{const t=e=>he(n,e),o="thead,tfoot,tbody,table",r=ke(e.first,o,t),s=ke(e.last,o,t);return r.bind((t=>s.bind((o=>he(t,o)?$t(e.table,e.first,e.last):w.none()))))}))).map((e=>({bounds:e,cells:t})));var n,r,s},po="data-mce-selected",go="data-mce-first-selected",fo="data-mce-last-selected",wo={selected:po,selectedSelector:"td["+po+"],th["+po+"]",firstSelected:go,firstSelectedSelector:"td["+go+"],th["+go+"]",lastSelected:fo,lastSelectedSelector:"td["+fo+"],th["+fo+"]"},bo=e=>({element:e,mergable:w.none(),unmergable:w.none(),selection:[e]}),vo=(e,t,o)=>({element:o,mergable:ho(t,e,wo),unmergable:uo(e),selection:mo(e)}),yo=e=>(t,o)=>{const n=oe(t),r="col"===n||"colgroup"===n?bt(s=t).bind((e=>((e,t)=>((e,t)=>{const o=Ae(e,t);return o.length>0?w.some(o):w.none()})(e,t))(e,wo.firstSelectedSelector))).fold(v(s),(e=>e[0])):t;var s;return Le(r,e,o)},Co=yo("th,td,caption"),xo=yo("th,td"),So=e=>{return t=e.model.table.getSelectedCells(),N(t,Y.fromDom);var t},To=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},Ro=(e,t)=>({element:e,offset:t}),Do=(e,t,o)=>e.property().isText(t)&&0===e.property().getText(t).trim().length||e.property().isComment(t)?o(t).bind((t=>Do(e,t,o).orThunk((()=>w.some(t))))):w.none(),Oo=(e,t)=>e.property().isText(t)?e.property().getText(t).length:e.property().children(t).length,Ao=(e,t)=>{const o=Do(e,t,e.query().prevSibling).getOr(t);if(e.property().isText(o))return Ro(o,Oo(e,o));const n=e.property().children(o);return n.length>0?Ao(e,n[n.length-1]):Ro(o,Oo(e,o))},Eo=Ao,ko=ro(),No={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Wo=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),Lo=(e,t)=>w.from(Wo.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>E(t,(t=>E(No[t],(t=>e===t)))))(n,t)?w.some({value:o,unit:n}):w.none()})),Mo=(e,t,o)=>((e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?w.none():w.some(t)})(e).getOr(t))(tt(e,t),o),jo=((e,t)=>{const o=t=>{const o=(e=>e.dom.offsetWidth)(t);if(o<=0||null===o){const o=tt(t,e);return parseFloat(o)||0}return o},n=(e,t)=>I(t,((t,o)=>{const n=tt(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!f(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Ze(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}})("width"),Bo=e=>jo.get(e),Io=e=>jo.getOuter(e),Po=e=>((e,t)=>{const o=e.dom,n=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?n:((e,t,o,n)=>t-Mo(e,`padding-${o}`,0)-Mo(e,`padding-${n}`,0)-Mo(e,`border-${o}-width`,0)-Mo(e,`border-${n}-width`,0))(e,n,"left","right")})(e,"content-box"),zo=me("col"),_o=(e,t,o)=>{const n=(r=e,w.from(r.dom.parentElement).map(Y.fromDom)).getOrThunk((()=>(e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Y.fromDom(t)})(ge(e))));var r;return t(e)/o(n)*100},Fo=(e,t)=>{et(e,"width",t+"px")},$o=(e,t)=>{et(e,"width",t+"%")},Vo=e=>((e,t)=>nt(e,t).orThunk((()=>Ue(e,t).map((e=>e+"px")))))(e,"width"),Go=e=>_o(e,Bo,Po),qo=e=>{return zo(e)?Bo(e):Mo(t=e,"width",t.dom.offsetWidth);var t},Ho=(e,t,o)=>{et(e,"width",t+o)},Uo=v(/(\d+(\.\d+)?)%/),Ko=(e,t)=>{if(!lt(e)){const o=(e=>Vo(e).bind((e=>Lo(e,["fixed","relative","empty"]))))(e);o.each((o=>{const n=o.value/2;Ho(e,n,o.unit),Ho(t,n,o.unit)}))}},Qo=me("col"),Xo=me("colgroup"),Yo=e=>({element:e,colspan:st(e,"colspan",1),rowspan:st(e,"rowspan",1)}),Jo=(e,t=Yo)=>{const o=o=>{if((e=>"tr"===oe(e)||Xo(e))(o))return Xo((r={element:o}).element)?e.colgroup(r):e.row(r);{const r=o,s=(t=>Qo(t.element)?e.col(t):e.cell(t))(t(r));return n=w.some({item:r,replacement:s}),s}var r};let n=w.none();return{getOrInit:(e,t)=>n.fold((()=>o(e)),(n=>t(e,n.item)?n.replacement:o(e)))}},Zo=e=>N(e,v(0)),en=e=>(t,o,n,r)=>{if(e(n)){const e=Math.max(r,t[o]-Math.abs(n)),s=Math.abs(e-t[o]);return n>=0?s:-s}return n},tn=en((e=>e<0)),on=en(T),nn=()=>{const e=(e,t,o,n,r)=>{const s=on(e,n>=0?o:t,n,r);return((e,t,o,n,r)=>r(e.slice(0,t)).concat(n).concat(r(e.slice(o))))(e,t,o+1,[s,-s],Zo)};return{resizeTable:(e,t,o)=>{o&&e(t)},clampTableDelta:(e,t,o,n,r)=>{if(r){if(o>=0)return o;{const t=I(e,((e,t)=>e+t-n),0);return Math.max(-t,o)}}return tn(e,t,o,n)},calcLeftEdgeDeltas:e,calcMiddleDeltas:(t,o,n,r,s,l)=>e(t,n,r,s,l),calcRightEdgeDeltas:(e,t,o,n,r,s)=>{if(s)return Zo(e);{const t=n/e.length;return N(e,v(t))}},calcRedestributedWidths:(e,t,o,n)=>({delta:0,newSizes:e})}},rn=(e,t)=>Y.fromDom(e.dom.cloneNode(t)),sn=(e,t)=>{const o=((e,t)=>{const o=Y.fromTag(t),n=Qe(e);return qe(o,n),o})(e,t),n=Ce((e=>rn(e,!0))(e));return Xt(o,n),o},ln=(me("th"),(e,t,o)=>ht(o(e.element,t),!0,e.isLocked)),cn=()=>({transformRow:y,transformCell:ln}),an=()=>mn(0,0),mn=(e,t)=>({major:e,minor:t}),un={nu:mn,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?an():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return mn(n(1),n(2))})(e,o)},unknown:an},dn=(e,t)=>{const o=String(t).toLowerCase();return P(e,(e=>e.search(o)))},hn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,pn=e=>t=>Xe(t,e),gn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Xe(e,"edge/")&&Xe(e,"chrome")&&Xe(e,"safari")&&Xe(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,hn],search:e=>Xe(e,"chrome")&&!Xe(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Xe(e,"msie")||Xe(e,"trident")},{name:"Opera",versionRegexes:[hn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:pn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:pn("firefox")},{name:"Safari",versionRegexes:[hn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Xe(e,"safari")||Xe(e,"mobile/"))&&Xe(e,"applewebkit")}],fn=[{name:"Windows",search:pn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>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:pn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:pn("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:pn("linux"),versionRegexes:[]},{name:"Solaris",search:pn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:pn("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:pn("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],wn={browsers:v(gn),oses:v(fn)},bn="Edge",vn="Chromium",yn="Opera",Cn="Firefox",xn="Safari",Sn=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(bn),isChromium:n(vn),isIE:n("IE"),isOpera:n(yn),isFirefox:n(Cn),isSafari:n(xn)}},Tn=()=>Sn({current:void 0,version:un.unknown()}),Rn=Sn,Dn=(v(bn),v(vn),v("IE"),v(yn),v(Cn),v(xn),"Windows"),On="Android",An="Linux",En="macOS",kn="Solaris",Nn="FreeBSD",Wn="ChromeOS",Ln=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Dn),isiOS:n("iOS"),isAndroid:n(On),isMacOS:n(En),isLinux:n(An),isSolaris:n(kn),isFreeBSD:n(Nn),isChromeOS:n(Wn)}},Mn=()=>Ln({current:void 0,version:un.unknown()}),jn=Ln,Bn=(v(Dn),v("iOS"),v(On),v(An),v(En),v(kn),v(Nn),v(Wn),e=>window.matchMedia(e).matches);let In=To((()=>((e,t,o)=>{const n=wn.browsers(),r=wn.oses(),s=t.bind((e=>((e,t)=>q(t.brands,(t=>{const o=t.brand.toLowerCase();return P(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:un.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>dn(e,t).map((e=>{const o=un.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(Tn,Rn),l=((e,t)=>dn(e,t).map((e=>{const o=un.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Mn,jn),c=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,l=e.isiOS()||e.isAndroid(),c=l||n("(pointer:coarse)"),i=r||!s&&l&&n("(min-device-width:768px)"),a=s||l&&!i,m=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!a&&!i&&!m;return{isiPad:v(r),isiPhone:v(s),isTablet:v(i),isPhone:v(a),isTouch:v(c),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:v(m),isDesktop:v(u)}})(l,s,e,o);return{browser:s,os:l,deviceType:c}})(navigator.userAgent,w.from(navigator.userAgentData),Bn)));const Pn=(e,t=T)=>{const o=e.grid,n=k(o.columns,y),r=k(o.rows,y);return N(n,(o=>zn((()=>z(r,(t=>Wt(e,t,o).filter((e=>e.column===o)).toArray()))),(e=>1===e.colspan&&t(e.element)),(()=>Wt(e,0,o)))))},zn=(e,t,o)=>{const n=e();return P(n,t).orThunk((()=>w.from(n[0]).orThunk(o))).map((e=>e.element))},_n=(e,t)=>({left:e,top:t,translate:(o,n)=>_n(e+o,t+n)}),Fn=_n,$n=(e,t)=>void 0!==e?e:void 0!==t?t:0,Vn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Fn(o.offsetLeft,o.offsetTop);const s=$n(null==n?void 0:n.pageYOffset,r.scrollTop),l=$n(null==n?void 0:n.pageXOffset,r.scrollLeft),c=$n(r.clientTop,o.clientTop),i=$n(r.clientLeft,o.clientLeft);return Gn(e).translate(l-i,s-c)},Gn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Fn(o.offsetLeft,o.offsetTop):Te(e)?(e=>{const t=e.getBoundingClientRect();return Fn(t.left,t.top)})(t):Fn(0,0)},qn=(e,t)=>({col:e,x:t}),Hn=e=>Vn(e).left+Io(e),Un=e=>Vn(e).left,Kn=(e,t)=>qn(e,Un(t)),Qn=(e,t)=>qn(e,Hn(t)),Xn=(e,t,o)=>{if(0===o.length)return[];const n=N(o.slice(1),((t,o)=>t.map((t=>e(o,t))))),r=o[o.length-1].map((e=>t(o.length-1,e)));return n.concat([r])},Yn=(Jn={delta:y,edge:Un,positions:e=>Xn(Kn,Qn,e)},Zn={delta:e=>-e,edge:Hn,positions:e=>Xn(Qn,Kn,e)},e=>"rtl"===(e=>"rtl"===tt(e,"direction")?"rtl":"ltr")(e)?Zn:Jn);var Jn,Zn;const er=e=>Yn(e).edge(e),tr=me("col"),or=(e,t,o,n,r,s)=>e.filter(n).fold((()=>s(((e,t)=>{if(t<0||t>=e.length-1)return w.none();const o=e[t].fold((()=>{const o=(e=>{const t=R.call(e,0);return t.reverse(),t})(e.slice(0,t));return q(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>w.some({value:e,delta:0}))),n=e[t+1].fold((()=>{const o=e.slice(t+1);return q(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>w.some({value:e,delta:1})));return o.bind((e=>n.map((t=>{const o=t.delta+e.delta;return Math.abs(t.value-e.value)/o}))))})(o,t))),(e=>r(e))),nr=(e,t,o,n)=>{const r=Pn(e),s=jt(e)?(e=>N(Mt(e),(e=>w.from(e.element))))(e):r,l=[w.some(er(t))].concat(N(((e,t)=>Yn(t).positions(e,t))(r,t),(e=>e.map((e=>e.x))))),c=(i=lt,e=>!i(e));var i;return N(s,((e,t)=>or(e,t,l,c,(e=>{if((e=>{const t=In().browser,o=t.isChromium()||t.isFirefox();return!tr(e)||o})(e))return o(e);{const e=((e,t)=>null!=e?t(e):w.none())(r[t],y);return or(e,t,l,c,(e=>n(w.some(Bo(e)))),n)}}),n)))},rr=(e,t,o)=>nr(e,t,qo,(e=>e.getOrThunk(o.minCellWidth))),sr=(e,t)=>()=>Te(e)?t(e):parseFloat(nt(e,"width").getOr("0")),lr=e=>Vo(e).fold((()=>(e=>{const t=sr(e,Bo),o=v(0);return{width:t,pixelWidth:t,getWidths:(t,o)=>rr(t,e,o),getCellDelta:o,singleColumnWidth:v([0]),minCellWidth:o,setElementWidth:b,adjustTableWidth:b,isRelative:!0,label:"none"}})(e)),(t=>{return o=e,n=t,null!==Uo().exec(n)?(e=>{const t=sr(e,(e=>parseFloat((e=>_o(e,Bo,Po)+"%")(e)))),o=sr(e,Bo);return{width:t,pixelWidth:o,getWidths:(t,o)=>((e,t,o)=>nr(e,t,Go,(e=>e.fold((()=>o.minCellWidth()),(e=>e/o.pixelWidth()*100)))))(t,e,o),getCellDelta:e=>e/o()*100,singleColumnWidth:(e,t)=>[100-e],minCellWidth:()=>ct()/o()*100,setElementWidth:$o,adjustTableWidth:o=>{const n=t();$o(e,n+o/100*n)},isRelative:!0,label:"percent"}})(o):(e=>{const t=sr(e,Bo);return{width:t,pixelWidth:t,getWidths:(t,o)=>rr(t,e,o),getCellDelta:y,singleColumnWidth:(e,t)=>[Math.max(ct(),e+t)-e],minCellWidth:ct,setElementWidth:Fo,adjustTableWidth:o=>{const n=t()+o;Fo(e,n)},isRelative:!1,label:"pixel"}})(o);var o,n})),cr=(e,t,o,n)=>{o===n?Ke(e,t):Ge(e,t,o)},ir=(e,t,o)=>{G(Oe(e,t)).fold((()=>Ht(e,o)),(e=>qt(e,o)))},ar=(e,t)=>{const o=[],n=[],r=e=>N(e,(e=>{e.isNew&&o.push(e.element);const t=e.element;return Yt(t),W(e.cells,(e=>{e.isNew&&n.push(e.element),cr(e.element,"colspan",e.colspan,1),cr(e.element,"rowspan",e.rowspan,1),Ut(t,e.element)})),t})),s=e=>z(e,(e=>N(e.cells,(e=>(cr(e.element,"span",e.colspan,1),e.element))))),l=(t,o)=>{const n=((e,t)=>{const o=Ne(e,t).getOrThunk((()=>{const o=Y.fromTag(t,ge(e).dom);return"thead"===t?ir(e,"caption,colgroup",o):"colgroup"===t?ir(e,"caption",o):Ut(e,o),o}));return Yt(o),o})(e,o),l=("colgroup"===o?s:r)(t);Xt(n,l)},c=(t,o)=>{t.length>0?l(t,o):(t=>{Ne(e,t).each(Jt)})(o)},i=[],a=[],m=[],u=[];return W(t,(e=>{switch(e.section){case"thead":i.push(e);break;case"tbody":a.push(e);break;case"tfoot":m.push(e);break;case"colgroup":u.push(e)}})),c(u,"colgroup"),c(i,"thead"),c(a,"tbody"),c(m,"tfoot"),{newRows:o,newCells:n}},mr=(e,t)=>{if(0===e.length)return 0;const o=e[0],n=((e,n)=>{for(let n=0,s=e.length;n{const o=N(e,(e=>N(e.cells,S)));return N(e,((n,r)=>{const s=z(n.cells,((n,s)=>{if(!1===o[r][s]){const m=((e,t,o,n)=>{const r=((e,t)=>e[t])(e,t),s="colgroup"===r.section,l=mr(r.cells.slice(o),n),c=s?1:mr(((e,t)=>N(e,(e=>St(e,t))))(e.slice(t),o),n);return{colspan:l,rowspan:c}})(e,r,s,t);return((e,t,n,r)=>{for(let s=e;sq(e.all,(e=>P(e.cells,(e=>he(t,e.element))))),hr=(e,t,o)=>{const n=(e=>{const t=[],o=e=>{t.push(e)};for(let t=0;tgt(t).bind((t=>dr(e,t))).filter(o))));return Q(n.length>0,n)},pr=(e,t,o,n,r)=>(s,l,c,i)=>{const a=kt(s),m=w.from(null==i?void 0:i.section).getOrThunk(cn),u=t(a,l).map((t=>{const o=((e,t)=>((e,t,o)=>{const n=[];W(e.colgroups,(r=>{const s=[];for(let n=0;nht(e.element,o,!1))).getOrThunk((()=>ht(t.colGap(),!0,!1)));s.push(r)}n.push(pt(r.element,s,"colgroup",o))}));for(let r=0;rht(e.element,o,e.isLocked))).getOrThunk((()=>ht(t.gap(),!0,!1)));s.push(l)}const l=e.all[r],c=pt(l.element,s,l.section,o);n.push(c)}return n})(e,t,!1))(a,c),n=e(o,t,he,r(c),m),s=(e=>{const t=I(Rt(e).rows,((e,t)=>(W(t.cells,((t,o)=>{t.isLocked&&(e[o]=!0)})),e)),{}),o=Ie(t,((e,t)=>parseInt(t,10)));return F(o)})(n.grid);return{info:t,grid:(l=n.grid,ur(l,he)),cursor:n.cursor,lockedColumns:s};var l}));return u.bind((e=>{const t=ar(s,e.grid),r=w.from(null==i?void 0:i.sizing).getOrThunk((()=>lr(s))),l=w.from(null==i?void 0:i.resize).getOrThunk(nn);return o(s,e.grid,e.info,{sizing:r,resize:l,section:m}),n(s),Ke(s,Dt),e.lockedColumns.length>0&&Ge(s,Dt,e.lockedColumns.join(",")),w.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})}))},gr=(e,t)=>gt(t.element).bind((t=>dr(e,t))),fr=(e,t)=>hr(e,t,T),wr=(e,t)=>_(t,(t=>((e,t)=>dr(e,t).exists((e=>!e.isLocked)))(e,t))),br=(e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>wr(e,t.cells))),vr=(e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>wr(e,t))),yr=["img","br"],Cr=e=>{return(t=e,eo.getOption(t)).filter((e=>0!==e.trim().length||e.indexOf("\xa0")>-1)).isSome()||A(yr,oe(e))||(e=>{return le(t=e)&&te(t.dom)&&"false"===He(e,"contenteditable");var t})(e);var t},xr={scope:["row","col"]},Sr=e=>()=>{const t=Y.fromTag("td",e.dom);return Ut(t,Y.fromTag("br",e.dom)),t},Tr=e=>()=>Y.fromTag("col",e.dom),Rr=e=>()=>Y.fromTag("colgroup",e.dom),Dr=e=>()=>Y.fromTag("tr",e.dom),Or=(e,t,o)=>{const n=sn(e,t);return Be(o,((e,t)=>{null===e?Ke(n,t):Ge(n,t,e)})),n},Ar=(e,t,o)=>{return(n=e,((e,t)=>{const o=e=>{for(let n=0;n{const r=o.join(","),s=De(n,r,(t=>he(t,e)));return B(s,((e,t)=>{const o=rn(t,!1);return Ut(e,o),o}),t)})).getOr(t);var n},Er=(e,t,o)=>{const n=(e,t)=>{((e,t)=>{const o=e.dom,n=t.dom;Ze(o)&&Ze(n)&&(n.style.cssText=o.style.cssText)})(e.element,t),rt(t,"height"),1!==e.colspan&&rt(t,"width")};return{col:o=>{const r=Y.fromTag(oe(o.element),t.dom);return n(o,r),e(o.element,r),r},colgroup:Rr(t),row:Dr(t),cell:r=>{const s=Y.fromTag(oe(r.element),t.dom),l=o.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),c=l.length>0?Ar(r.element,s,l):s;return Ut(c,Y.fromTag("br")),n(r,s),((e,t)=>{Be(xr,((o,n)=>Ue(e,n).filter((e=>A(o,e))).each((e=>Ge(t,n,e)))))})(r.element,s),e(r.element,s),s},replace:Or,colGap:Tr(t),gap:Sr(t)}},kr=e=>kt(e).grid,Nr=(e,t=!1)=>{return Te(e)?e.dom.isContentEditable:(o=e,Le(o,"[contenteditable]")).fold(v(t),(e=>"true"===Wr(e)));var o},Wr=e=>e.dom.contentEditable,Lr=(e,t,o,n,r)=>N(e,(e=>{const s=t>0&&t{if("colgroup"!==o&&n)return St(e,t);{const t=St(e,r);return ht(l(t.element,s),!0,!1)}})(e,t,e.section,s,o,n,r);return((e,t,o)=>((e,t,o)=>{const n=e.cells,r=n.slice(0,t),s=n.slice(t),l=r.concat(o).concat(s);return xt(e,l)})(e,t,[o]))(e,t,l)})),Mr={...(e=>{if(!a(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return W(e,((n,r)=>{const s=Me(n);if(1!==s.length)throw new Error("one and only one name per case");const l=s[0],c=n[l];if(void 0!==o[l])throw new Error("duplicate key detected:"+l);if("cata"===l)throw new Error("cannot have a case named cata (sorry)");if(!a(c))throw new Error("case arguments must be an array");t.push(l),o[l]=(...o)=>{const n=o.length;if(n!==c.length)throw new Error("Wrong number of arguments to case "+l+". Expected "+c.length+" ("+c+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const n=Me(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!_(t,(e=>A(n,e))))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[l].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:l,params:o})}}}})),o})([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},jr=(e,t)=>jt(e)?((e,t)=>{const o=Mt(e);return N(o,((e,o)=>({element:e.element,width:t[o],colspan:e.colspan})))})(e,t):((e,t)=>{const o=(e=>z(e.all,(e=>e.cells)))(e);return N(o,(e=>{const o=((e,t,o)=>{let n=0;for(let r=e;r{const n=jr(e,t);W(n,(e=>{o.setElementWidth(e.element,e.width)}))},Ir=e=>I(e,((e,t)=>E(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),Pr=e=>Nr(e,!0),zr=(e,t,o)=>((e,t)=>({grid:e,cursor:t}))(e,((e,t,o)=>{var n,r;const s=Rt(e).rows;return w.from(null===(r=null===(n=s[t])||void 0===n?void 0:n.cells[o])||void 0===r?void 0:r.element).filter(Pr).orThunk((()=>(e=>q(e,(e=>q(e.cells,(e=>{const t=e.element;return Q(Pr(t),t)})))))(s)))})(e,t,o)),_r=(e,t,o,n)=>((e,t,o,n,r)=>{const s=Nt(t),l=n.getWidths(s,n),c=n.pixelWidth(),{newSizes:i,delta:a}=r.calcRedestributedWidths(l,c,o.pixelDelta,n.isRelative);Br(s,i,n),n.adjustTableWidth(a)})(0,t,o,n.sizing,n.resize),Fr=(e,t)=>{const o=Pn(e),n=Ir(t);return I(n,((e,t)=>e+o[t.column].map(Io).getOr(0)),0)},$r=pr(((e,t,o,n)=>{const r=t.detail,s=r.column,l=r.column,c=Lr(e,l,s,o,n.getOrInit);return zr(c,r.row,l)}),((e,t)=>gr(e,t).filter((e=>!E([e],(e=>0===e.column&&e.isLocked)))).map((t=>({detail:t,pixelDelta:Fr(e,[t])})))),_r,b,Jo),Vr=pr(((e,t,o,n)=>{const r=Ir(t.details),s=((e,t)=>z(e,(e=>{const o=e.cells,n=B(t,((e,t)=>t>=0&&t0?[pt(e.element,n,e.section,e.isNew)]:[]})))(e,N(r,(e=>e.column))),l=s.length>0?s[0].cells.length-1:0;return zr(s,r[0].row,Math.min(r[0].column,l))}),((e,t)=>((e,t)=>hr(e,t,(e=>!e.isLocked)))(e,t).map((t=>({details:t,pixelDelta:-Fr(e,t)})))),_r,(e=>{0===ft(e).length&&Jt(e)}),Jo),Gr=(e,t)=>{const o=He(e,t);return void 0===o||""===o?[]:o.split(" ")},qr=e=>void 0!==e.dom.classList,Hr=e=>e.dom.textContent,Ur=me("th"),Kr=(e,t)=>e&&t?"sectionCells":e?"section":"cells",Qr=e=>{const t=M(e,(e=>Ur(e.element)));return 0===t.length?w.some("td"):t.length===e.length?w.some("th"):w.none()},Xr=e=>{const t=N(e,(e=>(e=>{const t="thead"===e.section,o=H(Qr(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:Kr(t,o)}:{type:"body"}})(e).type)),o=A(t,"header"),n=A(t,"footer");if(o||n){const e=A(t,"body");return!o||e||n?o||e||!n?w.none():w.some("footer"):w.some("header")}return w.some("body")},Yr={structure:!1,style:!0},Jr={structure:!0,style:!1},Zr=(e,t,o)=>({value:t+1}),es=(e,t,o)=>{const n="A".charCodeAt(0),r=[];let s=t;for(;s>=0;)r.push(String.fromCharCode(n+s%26)),s=Math.floor(s/26)-1;return{value:r.reverse().join("")}},ts=e=>e.options.get("advtable_value_series"),os=e=>{const t=parseFloat(e);return isNaN(t)?w.none():w.some(t)},ns=(e,t)=>et?1:0,rs=(e,t)=>U(os(e),os(t),ns).getOrThunk((()=>((e,t)=>e.localeCompare(t))(e,t))),ss=e=>{const t=(e=>w.from(e.options.get("table_clone_elements")))(e),o=(o,r,s,l)=>(c,i,a,m,u=!1)=>{const d=Y.fromDom(e.getDoc()),h=Er(s,d,t);return r(c)?o(c,i,h).bind((t=>{W(t.newRows,(t=>{((e,t)=>{e.dispatch("NewRow",{node:t})})(e,t.dom)})),W(t.newCells,(t=>{((e,t)=>{e.dispatch("NewCell",{node:t})})(e,t.dom)}));const o=((t,o,r,s)=>{const l=r.filter((e=>Te(e)&&n(e))).or(o.cursor);return l.fold((()=>{const o=ft(t);return V(o).filter(Te).map((o=>{const n=e.dom.createRng();return n.selectNode(o.dom),s&&(e.model.table.clearSelectedCells(t.dom),e.selection.setRng(n),Ge(o,"data-mce-selected","1")),n}))}),(o=>{const n=e.dom.createRng(),r=Eo(ko,o);return n.setStart(r.element.dom,r.offset),n.setEnd(r.element.dom,r.offset),s&&(e.model.table.clearSelectedCells(t.dom),e.selection.setRng(n)),w.some(n)}))})(c,t,a,m);return Te(c)&&((e=>{Ke(e,"data-mce-style");const t=e=>Ke(e,"data-mce-style");W(ft(e),t),W(wt(e),t),W(vt(e),t)})(c),u||((e,t,o)=>{e.dispatch("TableModified",{...o,table:t})})(e,c.dom,l)),o.map((e=>({rng:e,effect:l})))})):w.none()},n=e=>Nr(e,!0),r=(e,t,o)=>((e,t)=>({grid:e,cursor:t}))(e,((e,t,o)=>{var r,s;const l=Rt(e).rows;return w.from(null===(s=null===(r=l[t])||void 0===r?void 0:r.cells[o])||void 0===s?void 0:s.element).filter(n).orThunk((()=>(e=>q(e,(e=>q(e.cells,(e=>{const t=e.element;return Q(n(t),t)})))))(l)))})(e,t,o)),s=(e,t,o,n)=>{const{cols:r,rows:s}=Rt(e),l=j(s,(e=>e.section)),c=N(l,(e=>j(e,(e=>{const o=St(e,t).element;return oe(o)})))),i=z(c,(e=>z(e,(e=>{const r=St(e[0],t).element;return"th"===oe(r)?e:(e=>{const r=N(e,(e=>{const o=St(e,t).element;return{row:e,text:w.from(Hr(o)).getOr("")}})),s=F(r,((e,t)=>{const r=o(e.text,t.text);return n?r:-1*r}));return N(s,(e=>e.row))})(e)}))));return[...r,...i]},l=(e,t,o,n)=>{const{cols:r,rows:s}=Rt(e),l=s[t].cells,c=N(l,(e=>{const t=e.element;return w.from(Hr(t)).getOr("")})),i=me("th"),a=N(s,(e=>{const t=N(e.cells,((e,t)=>({cell:e,column:t,reference:l[t],referenceText:c[t]})));return{...e,zippedCells:t}})),m=N(a,(e=>{const t=j(e.zippedCells,(e=>{const t=e.reference.element;return oe(t)})),r=z(t,(e=>{const t=e[0].reference.element;if(i(t))return N(e,(e=>e.cell));{const{pass:t,fail:r}=L(e,(e=>e.cell.isLocked)),s=F(r,((e,t)=>{const r=o(e.referenceText,t.referenceText);return n?r:-1*r})),l=I(t,((e,t)=>{const o=t.column,n=e.slice(0,o),r=e.slice(o);return n.concat([t]).concat(r)}),s);return N(l,(e=>e.cell))}}));return pt(e.element,r,e.section,e.isNew)}));return[...r,...m]},u=s,d=l,h=(e,t,o,n,r)=>{const{cols:s,rows:l}=Rt(e),c=l.slice(0,t),i=[...s,...l.slice(t,o+1)];return{beforeRows:c,afterRows:l.slice(o+1,e.length),selectionGridBefore:i.map((e=>({...e,cells:e.cells.slice(0,n)}))),selectionGrid:i.map((e=>({...e,cells:e.cells.slice(n,r+1)}))),selectionGridAfter:i.map((e=>({...e,cells:e.cells.slice(r+1,e.cells.length)})))}},p=(e,t)=>{const o=N(t,((t,o)=>{const n=e.selectionGridBefore[o].cells,r=e.selectionGridAfter[o].cells;return{...t,cells:n.concat(t.cells).concat(r)}})),{cols:n,rows:r}=Rt(o);return[...n,...e.beforeRows,...r,...e.afterRows]},g=(e,t,o,n,r,l,c,i)=>{const a=h(e,o,n,r,l),m=s(a.selectionGrid,t-r,c,i);return p(a,m)},C=(e,t,o,n,r,s,c,i)=>{const a=h(e,o,n,r,s),m=l(a.selectionGrid,t-o,c,i);return p(a,m)},x=e=>I(e,((e,t)=>E(e,(e=>e.row===t.row))?e:e.concat([t])),[]).sort(((e,t)=>e.row-t.row)),S=e=>I(e,((e,t)=>E(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),R=e=>I(e,((e,t)=>E(e,(e=>he(e.element,t.element)))?e:e.concat([t])),[]),D=e=>{const t=i(e.attributes)?Ie(e.attributes,((e,t)=>m(e)?e=>Ke(e,t):o=>Ge(o,t,e))):[];return[...t,...((e,t)=>{if(a(e)){for(let o=0,n=e.length;ot=>((e,t)=>{qr(e)?e.dom.classList.add(t):((e,t)=>{((e,t,o)=>{const n=Gr(e,t).concat([o]);Ge(e,t,n.join(" "))})(e,"class",t)})(e,t)})(t,e))):[],t=>{const o=Hr(t)||"",n=(r=e.value,f(r)?String(r):c(r)?r:void 0);var r;const s=c(n)?n:o;Je(s)?((e,t)=>{const o=ge(e).dom,n=Y.fromDom(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Ce(Y.fromDom(o))})(t,o);Xt(n,r),Yt(e),Ut(e,n)})(t,"
"):((e,t)=>{e.dom.textContent=t})(t,s)}]},O=(e,t,o,n,r,s,l,c)=>{let i;W(t,((t,a)=>{const m=t.element,u={sectionType:s(a),cellType:oe(m),getRowType:l(a),getColType:c(a),classes:(p=m,qr(p)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;eGr(e,"class"))(p)),prev:null==i?void 0:i.raw,direction:o},d=e(u,n(a),r(a)),h=D(d);var p;W(h,(e=>e(m))),i=d}))},A=(e,t,o,n,s)=>{const l=g(e,s,0,e.length,s,s,o,n);return r(l,t[0].row,t[0].column)},k=(e,t,o,n,s)=>{const l=x(t),c=S(t),i=g(e,s,l[0].row,l[l.length-1].row,c[0].column,c[c.length-1].column,o,n);return r(i,t[0].row,t[0].column)},M=(e,t,o,n,s)=>{const l=u(e,s,o,n);return r(l,t.row,t.column)},B=(e,t,o,n,s)=>{const l=C(e,s,s,s,0,e[t[0].row].cells.length,o,n);return r(l,t[0].row,t[0].column)},P=(e,t,o,n,s)=>{const l=x(t),c=S(t),i=C(e,s,l[0].row,l[l.length-1].row,c[0].column,c[c.length-1].column,o,n);return r(i,t[0].row,t[0].column)},_=(e,t,o,n,s)=>{const l=d(e,s,o,n);return r(l,t.row,t.column)},$=(e,t,o,n)=>{const s=Rt(e).rows,l=N(s,(e=>St(e,n))),c=R(l),i=To((()=>Qr(c).getOr("")));return O(o,c,"column",y,v(n),(e=>s[e].section),(e=>To((()=>{const t=s[e];return Xr([{cells:t.cells,section:t.section}]).getOr("")}))),(e=>i)),r(e,t.row,t.column)},G=(e,t,o,n)=>{const s=Rt(e).rows,l=s[n],c=R(l.cells),i=To((()=>Xr([{cells:l.cells,section:l.section}]).getOr("")));return O(o,c,"row",v(n),y,(e=>l.section),(e=>i),(e=>To((()=>{const t=N(s,(t=>St(t,e)));return Qr(t).getOr("")})))),r(e,t.row,t.column)},H=(e,t,o,n,r)=>(s,l,c)=>{const i=pr(((r,s)=>e(r,s,t,o,n)),r,b,b,Jo);return i(s,l,c)},U=(e,t,o,n)=>(r,s,l)=>{const c=pr(((n,r)=>e(n,r,t,o)),n,b,b,Jo);return c(r,s,l)},K=o($r,T,Ko,Jr),X=o(Vr,(t=>0==("table"===oe(It(e)))||kr(t).columns>1),b,Jr);return{sortColumnRowsAsc:e=>o(H(A,rs,!0,e,fr),T,b,Jr),sortColumnRowsDesc:e=>o(H(A,rs,!1,e,fr),T,b,Jr),sortSelectionRowsAsc:e=>o(H(k,rs,!0,e,fr),T,b,Jr),sortSelectionRowsDesc:e=>o(H(k,rs,!1,e,fr),T,b,Jr),sortTableRowsAsc:e=>o(H(M,rs,!0,e,gr),T,b,Jr),sortTableRowsDesc:e=>o(H(M,rs,!1,e,gr),T,b,Jr),sortRowColumnsAsc:e=>o(H(B,rs,!0,e,fr),T,b,Jr),sortRowColumnsDesc:e=>o(H(B,rs,!1,e,fr),T,b,Jr),sortSelectionColumnsAsc:e=>o(H(P,rs,!0,e,fr),T,b,Jr),sortSelectionColumnsDesc:e=>o(H(P,rs,!1,e,fr),T,b,Jr),sortTableColumnsAsc:e=>o(H(_,rs,!0,e,gr),T,b,Jr),sortTableColumnsDesc:e=>o(H(_,rs,!1,e,gr),T,b,Jr),insertColumnBefore:K,deleteColumn:X,populateColumn:(e,t)=>o(U($,t,e,gr),T,b,Yr),populateRow:(e,t)=>o(U(G,t,e,gr),T,b,Yr)}},ls="data-snooker-locked-cols",cs=e=>Ue(e,ls).map((e=>z(e.split(","),(e=>{const t=parseInt(e,10);return isNaN(t)?[]:[t]})))).getOr([]),is=(e,t)=>Ge(e,ls,F(t).join(",")),as=(e,t)=>{const o=cs(e);A(o,t)||is(e,o.concat([t]))},ms=(e,t)=>{const o=cs(e);is(e,M(o,(e=>t!==e)))},us="data-snooker-col-series",ds=e=>Ue(e,us),hs=(e,t)=>H(ds(e).map((e=>e.toLowerCase())),t.toLowerCase()),ps=e=>((e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)})(e,us),gs=e=>{const t=lr(e),o=kt(e),n=Wt(o,0,0).bind((e=>{const t=e.element;return Lo(tt(t,"width"),["fixed"])})).map((e=>28-e.value)).getOr(0);((e,t,o,n,r)=>{const s=kt(e),l=r.getCellDelta(t),c=r.getWidths(s,r),i=0==s.grid.columns-1,a=n.clampTableDelta(c,0,l,r.minCellWidth(),i),m=((e,t,o,n,r)=>{const s=e.slice(0),l=((e,t)=>0===e.length?Mr.none():1===e.length?Mr.only(0):0===t?Mr.left(0,1):t===e.length-1?Mr.right(t-1,t):t>0&&tn.singleColumnWidth(s[e],o)),((e,t)=>r.calcLeftEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)),((e,t,l)=>r.calcMiddleDeltas(s,e,t,l,o,n.minCellWidth(),n.isRelative)),((e,t)=>r.calcRightEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)))})(c,0,a,r,n),u=N(m,((e,t)=>e+c[t]));Br(s,u,r),n.resizeTable(r.adjustTableWidth,a,i)})(e,n,0,nn(),t)},fs=(e,t,o,n,r)=>{((e,t)=>{const o=E(cs(e),(e=>0===e));o&&ms(e,0),t(),o&&as(e,1)})(e,(()=>{o.column(0,t.insertColumnBefore,!0,!0),gs(e),ws(e,t,o,n,r)}))},ws=(e,t,o,n,r)=>{o.table(e,0,0,t.populateColumn(0,((e,t,o)=>{const n=r.generator(e,t,o);return{raw:n,value:n.value,classes:n.classes,attributes:{contenteditable:"false",...n.attributes,"data-mce-resize":!1===r.resizable?"false":null}}})),!0,!0),((e,t)=>{Ge(e,us,t)})(e,n),as(e,0)},bs=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},vs=e=>bt(zt(e),Pt(e)),ys=(e,t)=>{e.execCommand("mceTableToggleSeries",!1,t)},Cs=(e,t,o)=>t.onSetupCellOrRowToggle((()=>((e,t)=>vs(e).exists((e=>Je(t)?!ps(e):hs(e,t))))(e,o))),xs=(e,t)=>({type:"togglemenuitem",text:"None",onAction:()=>{(e=>vs(e).bind(ds))(e).each((t=>{ys(e,{name:t})}))},onSetup:Cs(e,t,"")}),Ss=(e,t,o,n,r)=>({type:"togglemenuitem",text:o,value:n,icon:r,onAction:()=>ys(e,{name:n}),onSetup:Cs(e,t,n)}),Ts=(e,t,o)=>Ie(o,((o,n)=>{const r=w.from(o.title).getOrThunk((()=>{return""===(e=n)?"":e.charAt(0).toUpperCase()+e.substring(1);var e}));return Ss(e,t,r,n)})),Rs=e=>t=>{const o=t.getData();t.close(),e.undoManager.transact((()=>{e.execCommand("mceSortTableAdvanced",!1,o),e.focus(),e.addVisual()}))},Ds=e=>{const t={type:"listbox",name:"sortby",label:"Sort by",items:[{text:"Column",value:"column"},{text:"Row",value:"row"}]},o=bs(w.none()),n=t=>({type:"listbox",name:"roworcol",label:"column"===t?"Column":"Row",items:"column"===t?(()=>{const t=o.get().getOrDie("state must be present"),n=t.limit?t.finishCol+1-t.startCol:t.columns;return k(n,(o=>{const n=t.limit?t.startCol:0,r=(e=>{let t=e,o="";for(;Math.floor(t)>0;)--t,o+=String.fromCharCode("A".charCodeAt(0)+t%26),t/=26;return o.split("").reverse().join("")})(o+n+1);return{text:e.translate(["Column {0}",r]),value:`${o+n}`}}))})():(()=>{const t=o.get().getOrDie("state must be present"),n=t.limit?t.finishRow+1-t.startRow:t.rows;return k(n,(o=>{const n=t.limit?t.startRow:0,r=(o+n+1).toString();return{text:e.translate(["Row {0}",r]),value:`${o+n}`}}))})()}),r=e=>({type:"listbox",name:"sort",label:"Sort",items:["column"===e?{text:"Column",value:"column"}:{text:"Row",value:"row"},{text:"Selection",value:"selection"},{text:"Table",value:"table"}]}),s={type:"listbox",name:"order",label:"Order",items:[{text:"Ascending",value:"ascending"},{text:"Descending",value:"descending"}]},l=e=>({type:"panel",items:[{type:"grid",columns:2,items:[t,n(e),r(e),s]}]}),c=e=>({title:"Advanced Sort",size:"normal",body:l(e),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"sort",text:"Sort",primary:!0}]}),i=()=>{o.set(w.none())},a=(t,n)=>{if("sortby"===n.name){const n=t.getData(),l=(r=n,s=o.get().getOrDie("state must be present"),"column"===r.sortby?{sortby:"column",roworcol:`${s.startCol}`,sort:"row"===r.sort?"column":r.sort,order:r.order}:{sortby:"row",roworcol:`${s.startRow}`,sort:"column"===r.sort?"row":r.sort,order:r.order}),m={...c(n.sortby),onChange:a,onClose:i,onSubmit:Rs(e),initialData:l};t.redial(m),t.focus("sortby")}var r,s};xo(zt(e)).each((t=>{bt(t,Pt(e)).each((n=>{const r=vo(So(e),n,t),s=t=>{o.set(w.some(t));const n={sortby:"column",roworcol:`${t.startCol}`,sort:"column",order:"ascending"},r={...c("column"),onChange:a,onClose:i,onSubmit:Rs(e),initialData:n};e.windowManager.open(r)},l=kr(n);r.mergable.fold((()=>{$t(n,t,t).each((e=>{const t={...e,...l,limit:!1};s(t)}))}),(e=>{const t={...e.bounds,...l,limit:!0};s(t)}))}))}))},Os=(e,t,o,n)=>{const r=e=>"selection"===e,s=e=>"ascending"===e,l=t=>bt(t,Pt(e)),i=()=>xo(zt(e),Pt(e)).bind((e=>l(e).bind((t=>$t(t,e,e))))),a=()=>i().map((e=>e.startCol)),m=()=>i().map((e=>e.startRow));e.addCommand("mceSortTableByColumnAsc",(()=>{a().each((e=>{o.selection(t.sortTableRowsAsc(e))}))})),e.addCommand("mceSortTableByColumnDesc",(()=>{a().each((e=>{o.selection(t.sortTableRowsDesc(e))}))})),e.addCommand("mceSortTableByRowAsc",(()=>{m().each((e=>{o.selection(t.sortTableColumnsAsc(e))}))})),e.addCommand("mceSortTableByRowDesc",(()=>{m().each((e=>{o.selection(t.sortTableColumnsDesc(e))}))})),e.addCommand("mceSortTableAdvanced",((e,n)=>(e=>{const n=parseInt(e.roworcol,10);"column"===e.sortby?((e,n)=>{(e=>"column"===e)(e.sort)?s(e.order)?o.selection(t.sortColumnRowsAsc(n)):o.selection(t.sortColumnRowsDesc(n)):r(e.sort)?s(e.order)?o.selection(t.sortSelectionRowsAsc(n)):o.selection(t.sortSelectionRowsDesc(n)):s(e.order)?o.selection(t.sortTableRowsAsc(n)):o.selection(t.sortTableRowsDesc(n))})(e,n):((e,n)=>{(e=>"row"===e)(e.sort)?s(e.order)?o.selection(t.sortRowColumnsAsc(n)):o.selection(t.sortRowColumnsDesc(n)):r(e.sort)?s(e.order)?o.selection(t.sortSelectionColumnsAsc(n)):o.selection(t.sortSelectionColumnsDesc(n)):s(e.order)?o.selection(t.sortTableColumnsAsc(n)):o.selection(t.sortTableColumnsDesc(n))})(e,n)})(n))),e.addCommand("mceAdvancedTableSort",(()=>Ds(e))),e.addCommand("mceTableToggleSeries",((r,s)=>{const i=w.from(s.name).filter(c),a=l(zt(e));U(i,a,((e,r)=>{hs(r,e)?((e,t,o)=>{ms(e,0),(e=>{Ke(e,us)})(e),o.column(0,t.deleteColumn,!0,!0)})(r,t,o):_e(n,e).each((n=>{(ps(r)?ws:fs)(r,t,o,e,n)}))}))}))},As=e=>{const t=bs(w.none()),o=bs([]);let n=w.none();const r=me("caption"),s=()=>Co(zt(e),Pt(e)).bind((t=>K(U(bt(t),Co((e=>Y.fromDom(e.selection.getEnd()))(e),Pt(e)).bind(bt),((o,n)=>he(o,n)?r(t)?w.some(bo(t)):w.some(vo(So(e),o,t)):w.none()))))),l=e=>bt(e.element).map((t=>{const o=kt(t),n=fr(o,e).getOr([]),r=I(n,((e,t)=>(t.isLocked&&(e.onAny=!0,0===t.column?e.onFirst=!0:t.column+t.colspan>=o.grid.columns&&(e.onLast=!0)),e)),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:br(o,e).isSome(),unmergeable:vr(o,e).isSome(),locked:r}})),c=()=>{t.set(To(s)()),n=t.get().bind(l),W(o.get(),(e=>e()))},i=e=>(e(),o.set(o.get().concat([e])),()=>{o.set(M(o.get(),(t=>t!==e)))}),a=(e,o)=>i((()=>t.get().fold((()=>{e.setEnabled(!1)}),(t=>{e.setEnabled(!o(t))}))));return e.on("NodeChange ExecCommand TableSelectorChange",c),{onSetupTable:e=>a(e,(e=>!1)),onSetupCellOrRow:e=>a(e,(e=>r(e.element))),onSetupColumn:e=>t=>a(t,(t=>r(t.element)||(e=>n.exists((t=>t.locked[e])))(e))),onSetupCellOrRowToggle:e=>o=>((e,o,n)=>i((()=>t.get().fold((()=>{e.setEnabled(!1),e.setActive(!1)}),(t=>{e.setEnabled(!(e=>r(e.element))(t)),e.setActive(n(t))})))))(o,0,e),resetTargets:c,targets:()=>t.get()}};tinymce.PluginManager.requireLangPack("advtable","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_CN,zh_TW"),tinymce.PluginManager.add("advtable",(e=>{if(((e,o)=>!!e&&-1===((e,o)=>{const n=t(e.major,o.major);if(0!==n)return n;const r=t(e.minor,o.minor);if(0!==r)return r;const s=t(e.patch,o.patch);return 0!==s?s:0})((e=>n((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),n(o)))(tinymce,"6.0.0"))return console.error("Please use Advanced Tables with TinyMCE 6.0.0 or later."),{};(e=>{(0,e.options.register)("advtable_value_series",{processor:"object",default:{numeric:{title:"Numeric",update:!0,resizable:!1,generator:Zr},alpha:{title:"Alpha",update:!0,resizable:!1,generator:es}}})})(e);const o=ss(e),r=As(e),s=(e=>{const t=t=>{e.focus()},o=t=>bt(t,Pt(e)),n=(n,r,s,l,c)=>{xo(zt(e)).each((e=>{o(e).each((o=>{const i=kt(o),a=(e,t)=>Lt(i,e,he).map((e=>e[t])),m=n.orThunk((()=>a(e,"row"))),u=r.orThunk((()=>a(e,"column"))),d=K(U(m,u,((e,t)=>Wt(i,e,t).map((e=>e.element)))));d.bind((t=>{const n=bo(t);return s(o,n,Q(l,e),!0,c)})).each(t)}))}))};return{selection:(n,r)=>{xo(zt(e)).each((s=>{o(s).each((o=>{const l=vo(So(e),o,s);n(o,l,w.none(),!0,r).each(t)}))}))},row:(e,t,o,r)=>n(w.some(e),w.none(),t,o,r),column:(e,t,o,r)=>n(w.none(),w.some(e),t,o,r),table:(o,n,r,s,l,c)=>{const i=kt(o),a=Wt(i,n,r).map((e=>e.element)),m=xo(zt(e)),u=m.bind((e=>Lt(i,e,he))).isSome(),d=a.bind((e=>{const t=bo(e),n=u&&l?m:w.none();return s(o,t,n,u,c)}));d.each(t)}}})(e),l=ts(e);return Os(e,o,s,l),((e,t,o,n)=>{const r=()=>bt(zt(e),Pt(e)),s=(s,l=T)=>{const c=ds(s),i=c.bind((e=>_e(n,e)));U(c,i,((n,c)=>{1===kt(s).grid.columns?r().exists((e=>he(s,e)))?e.execCommand("mceTableDelete"):e.undoManager.transact((()=>{Jt(s)})):!0===c.update&&l()&&ws(s,t,o,n,c)}))};e.on("TableModified",(e=>{const t=Y.fromDom(e.table);s(t,(()=>!1!==e.structure))})),e.on("PreInit",(()=>{((e,t)=>{const o=e=>{const t=[];return h(e)?t:((e=>"thead"===e.name||"tbody"===e.name||"tfoot"===e.name)(e)?t.push(...o(e.firstChild)):"tr"===e.name&&t.push(e),t.concat(o(e.next)))},n=e=>o(e.firstChild);e.parser.addAttributeFilter(us,(e=>{var o;for(const r of e)if("table"===r.name){const e=r.attr(us);if(!1===(null===(o=t[e])||void 0===o?void 0:o.resizable)){const e=n(r);for(const t of e)p(t.firstChild)&&t.firstChild.attr("data-mce-resize","false")}}}))})(e,n)})),e.on("init",(()=>{const t=()=>{const t=xo(zt(e),Pt(e));return e.selection.isCollapsed()&&t.exists((t=>e.dom.isEmpty(t.dom)))};e.on("ExecCommand",(e=>{const o=e.command.toLowerCase();"delete"!==o&&"forwarddelete"!==o||!t()||r().each(s)}),!0),e.on("keyup",(e=>{const o=e.keyCode;8!==o&&46!==o||!t()||r().each(s)}))}))})(e,o,s,l),e.hasPlugin("table")&&(((e,t)=>{const o=(t,o)=>()=>e.execCommand(t,!1,o),n=t.onSetupCellOrRow,r=[{type:"menuitem",text:"Sort table by column ascending",onAction:o("mceSortTableByColumnAsc"),onSetup:n},{type:"menuitem",text:"Sort table by column descending",onAction:o("mceSortTableByColumnDesc"),onSetup:n},{type:"separator"},{type:"menuitem",text:"Advanced sort...",onAction:()=>Ds(e),onSetup:n}];e.ui.registry.addNestedMenuItem("advtablesort",{type:"nestedmenuitem",text:"Sort",getSubmenuItems:v(r)});const s=ts(e);if(1===ze(s)){const o=Me(s)[0];e.ui.registry.addToggleMenuItem("advtablerownumbering",Ss(e,t,"Row numbering",o,"table-row-numbering"))}else $e(s)||e.ui.registry.addNestedMenuItem("advtablerownumbering",{type:"nestedmenuitem",text:"Row numbering",icon:"table-row-numbering",getSubmenuItems:()=>{const o=xs(e,t),n=Ts(e,t,s);return[o].concat(n)}})})(e,r),((e,t)=>{const o=ts(e);if(1===ze(o)){const n=Me(o)[0];e.ui.registry.addToggleButton("advtablerownumbering",{type:"togglebutton",tooltip:"Row numbering",icon:"table-row-numbering",onAction:()=>ys(e,{name:n}),onSetup:Cs(e,t,n)})}else $e(o)||e.ui.registry.addMenuButton("advtablerownumbering",{type:"menubutton",icon:"table-row-numbering",tooltip:"Row numbering",fetch:n=>{const r=xs(e,t),s=Ts(e,t,o);return n([r].concat(s))},onSetup:t.onSetupCellOrRow})})(e,r)),{}}))}(); \ No newline at end of file +!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const o=e-t;return 0===o?0:o>0?1:-1},o=(e,t,o)=>({major:e,minor:t,patch:o}),n=t=>{const n=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return n?o(e(n[1]),e(n[2]),e(n[3])):o(0,0,0)},r=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(t)===e,s=e=>t=>typeof t===e,l=e=>t=>e===t,c=r("string"),i=r("object"),a=r("array"),m=l(null),u=s("boolean"),d=l(void 0),h=e=>null==e,p=e=>!h(e),g=s("function"),f=s("number");class w{constructor(e,t){this.tag=e,this.value=t}static some(e){return new w(!0,e)}static none(){return w.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?w.some(e(this.value)):w.none()}bind(e){return this.tag?e(this.value):w.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:w.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return p(e)?w.some(e):w.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}w.singletonNone=new w(!1);const b=()=>{},v=e=>()=>e,y=e=>e,C=(e,t)=>e===t;function x(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const S=v(!1),T=v(!0),R=Array.prototype.slice,D=Array.prototype.indexOf,O=Array.prototype.push,A=(e,t)=>{return o=e,n=t,D.call(o,n)>-1;var o,n},E=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let r=0;r{for(let o=0,n=e.length;o{const o=[],n=[];for(let r=0,s=e.length;r{const o=[];for(let n=0,r=e.length;n{if(0===e.length)return[];{let o=t(e[0]);const n=[];let r=[];for(let s=0,l=e.length;s(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),I=(e,t,o)=>(W(e,((e,n)=>{o=t(o,e,n)})),o),P=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n(e=>{const t=[];for(let o=0,n=e.length;o{for(let o=0,n=e.length;o{const o=R.call(e,0);return o.sort(t),o},$=(e,t)=>t>=0&&t$(e,0),G=e=>$(e,e.length-1),q=(e,t)=>{for(let o=0;oe.exists((e=>o(e,t))),U=(e,t,o)=>e.isSome()&&t.isSome()?w.some(o(e.getOrDie(),t.getOrDie())):w.none(),K=e=>e.bind(y),Q=(e,t)=>e?w.some(t):w.none(),X=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Y={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return X(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return X(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return X(o)},fromDom:X,fromPoint:(e,t,o)=>w.from(e.dom.elementFromPoint(t,o)).map(X)},J="undefined"!=typeof window?window:Function("return this;")(),Z=(e,t)=>((e,t)=>{let o=null!=t?t:J;for(let t=0;t{const t=Z("ownerDocument.defaultView",e);return i(e)&&((e=>((e,t)=>{const o=((e,t)=>Z(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(ee(e).constructor.name))},oe=e=>e.dom.nodeName.toLowerCase(),ne=e=>e.dom.nodeType,re=e=>t=>ne(t)===e,se=e=>8===ne(e)||"#comment"===oe(e),le=re(1),ce=re(3),ie=re(9),ae=re(11),me=e=>t=>le(t)&&oe(t)===e,ue=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},de=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,he=(e,t)=>e.dom===t.dom,pe=ue,ge=e=>Y.fromDom(e.dom.ownerDocument),fe=e=>ie(e)?e:ge(e),we=e=>w.from(e.dom.parentNode).map(Y.fromDom),be=(e,t)=>{const o=g(t)?t:S;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Y.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},ve=e=>w.from(e.dom.previousSibling).map(Y.fromDom),ye=e=>w.from(e.dom.nextSibling).map(Y.fromDom),Ce=e=>N(e.dom.childNodes,Y.fromDom),xe=g(Element.prototype.attachShadow)&&g(Node.prototype.getRootNode)?e=>Y.fromDom(e.dom.getRootNode()):fe,Se=e=>Y.fromDom(e.dom.host),Te=e=>{const t=ce(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=xe(e);return ae(o=t)&&p(o.dom.host)?w.some(t):w.none();var o})(Y.fromDom(t)).fold((()=>o.body.contains(t)),(n=Te,r=Se,e=>n(r(e))));var n,r},Re=(e,t)=>{let o=[];return W(Ce(e),(e=>{t(e)&&(o=o.concat([e])),o=o.concat(Re(e,t))})),o},De=(e,t,o)=>((e,o,n)=>M(be(e,n),(e=>ue(e,t))))(e,0,o),Oe=(e,t)=>((e,o)=>M(Ce(e),(e=>ue(e,t))))(e),Ae=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return de(o)?[]:N(o.querySelectorAll(e),Y.fromDom)})(t,e),Ee=(e,t,o)=>{let n=e.dom;const r=g(o)?o:S;for(;n.parentNode;){n=n.parentNode;const e=Y.fromDom(n);if(t(e))return w.some(e);if(r(e))break}return w.none()},ke=(e,t,o)=>Ee(e,(e=>ue(e,t)),o),Ne=(e,t)=>((e,o)=>P(e.dom.childNodes,(e=>{return o=Y.fromDom(e),ue(o,t);var o})).map(Y.fromDom))(e),We=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return de(o)?w.none():w.from(o.querySelector(e)).map(Y.fromDom)})(t,e),Le=(e,t,o)=>((e,t,o,n,r)=>((e,t)=>ue(e,t))(o,n)?w.some(o):g(r)&&r(o)?w.none():t(o,n,r))(0,ke,e,t,o),Me=Object.keys,je=Object.hasOwnProperty,Be=(e,t)=>{const o=Me(e);for(let n=0,r=o.length;n{const o=[];return Be(e,((e,n)=>{o.push(t(e,n))})),o},Pe=e=>Ie(e,y),ze=e=>Me(e).length,_e=(e,t)=>Fe(e,t)?w.from(e[t]):w.none(),Fe=(e,t)=>je.call(e,t),$e=e=>{for(const t in e)if(je.call(e,t))return!1;return!0},Ve=(e,t,o)=>{if(!(c(o)||u(o)||f(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},Ge=(e,t,o)=>{Ve(e.dom,t,o)},qe=(e,t)=>{const o=e.dom;Be(t,((e,t)=>{Ve(o,t,e)}))},He=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Ue=(e,t)=>w.from(He(e,t)),Ke=(e,t)=>{e.dom.removeAttribute(t)},Qe=e=>I(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),Xe=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!d(n)||r+t.length<=n)},Ye=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Je=e=>!(e=>e.length>0)(e),Ze=e=>void 0!==e.style&&g(e.style.getPropertyValue),et=(e,t,o)=>{((e,t,o)=>{if(!c(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ze(e)&&e.style.setProperty(t,o)})(e.dom,t,o)},tt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||Te(e)?n:ot(o,t)},ot=(e,t)=>Ze(e)?e.style.getPropertyValue(t):"",nt=(e,t)=>{const o=e.dom,n=ot(o,t);return w.from(n).filter((e=>e.length>0))},rt=(e,t)=>{((e,t)=>{Ze(e)&&e.style.removeProperty(t)})(e.dom,t),H(Ue(e,"style").map(Ye),"")&&Ke(e,"style")},st=(e,t,o=0)=>Ue(e,t).map((e=>parseInt(e,10))).getOr(o),lt=e=>me("col")(e)?st(e,"span",1)>1:((e,t)=>st(e,"colspan",1))(e)>1,ct=v(10),it=(e,t)=>at(e,t,T),at=(e,t,o)=>z(Ce(e),(e=>ue(e,t)?o(e)?[e]:[]:at(e,t,o))),mt=["tfoot","thead","tbody","colgroup"],ut=(e,t,o)=>({element:e,rowspan:t,colspan:o}),dt=(e,t,o)=>({element:e,cells:t,section:o}),ht=(e,t,o)=>({element:e,isNew:t,isLocked:o}),pt=(e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}),gt=(e,t)=>((e,t,o=S)=>o(t)?w.none():A(e,oe(t))?w.some(t):ke(t,e.join(","),(e=>ue(e,"table")||o(e))))(["td","th"],e,t),ft=e=>it(e,"th,td"),wt=e=>ue(e,"colgroup")?Oe(e,"col"):z(yt(e),(e=>Oe(e,"col"))),bt=(e,t)=>Le(e,"table",t),vt=e=>it(e,"tr"),yt=e=>bt(e).fold(v([]),(e=>Oe(e,"colgroup"))),Ct=e=>we(e).map((e=>{const t=oe(e);return(e=>A(mt,e))(t)?t:"tbody"})).getOr("tbody"),xt=(e,t)=>pt(e.element,t,e.section,e.isNew),St=(e,t)=>e.cells[t],Tt=(e,t)=>St(e,t).element,Rt=e=>{const t=L(e,(e=>"colgroup"===e.section));return{rows:t.fail,cols:t.pass}},Dt="data-snooker-locked-cols",Ot=e=>Ue(e,Dt).bind((e=>w.from(e.match(/\d+/g)))).map((e=>((e,t)=>{const o={};for(let n=0,r=e.length;ne+","+t,Et=e=>{const t={},o=[],n=V(e).map((e=>e.element)).bind(bt).bind(Ot).getOr({});let r=0,s=0,l=0;const{pass:c,fail:i}=L(e,(e=>"colgroup"===e.section));W(i,(e=>{const c=[];W(e.cells,(e=>{let o=0;for(;void 0!==t[At(l,o)];)o++;const r=((e,t)=>Fe(e,t)&&void 0!==e[t]&&null!==e[t])(n,o.toString()),i=((e,t,o,n,r,s)=>({element:e,rowspan:t,colspan:o,row:n,column:r,isLocked:s}))(e.element,e.rowspan,e.colspan,l,o,r);for(let n=0;n{const t=(e=>{const t={};let o=0;return W(e.cells,(e=>{const n=e.colspan;k(n,(r=>{const s=o+r;t[s]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,n,s)})),o+=n})),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,Pe(t));return{colgroups:[o],columns:t}})).getOrThunk((()=>({colgroups:[],columns:{}}))),u=((e,t)=>({rows:e,columns:t}))(r,s);return{grid:u,access:t,all:o,columns:a,colgroups:m}},kt=e=>{const t=(e=>{const t=vt(e);return o=[...yt(e),...t],n=Ct,N(o,(e=>{if("colgroup"===oe(e)){const t=N(wt(e),(e=>{const t=st(e,"span",1);return ut(e,1,t)}));return dt(e,t,"colgroup")}{const t=N(ft(e),(e=>{const t=st(e,"rowspan",1),o=st(e,"colspan",1);return ut(e,t,o)}));return dt(e,t,n(e))}}));var o,n})(e);return Et(t)},Nt=Et,Wt=(e,t,o)=>w.from(e.access[At(t,o)]),Lt=(e,t,o)=>{const n=((e,t)=>{const o=z(e.all,(e=>e.cells));return M(o,t)})(e,(e=>o(t,e.element)));return n.length>0?w.some(n[0]):w.none()},Mt=e=>Pe(e.columns),jt=e=>Me(e.columns).length>0,Bt=(e,t)=>w.from(e.columns[t]),It=e=>Y.fromDom(e.getBody()),Pt=e=>t=>he(t,It(e)),zt=e=>Y.fromDom(e.selection.getStart()),_t=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,Ft=(e,t,o)=>((e,t,o)=>{const n=Lt(e,t,he),r=Lt(e,o,he);return n.bind((e=>r.map((t=>{return o=e,n=t,{startRow:Math.min(o.row,n.row),startCol:Math.min(o.column,n.column),finishRow:Math.max(o.row+o.rowspan-1,n.row+n.rowspan-1),finishCol:Math.max(o.column+o.colspan-1,n.column+n.colspan-1)};var o,n}))))})(e,t,o).bind((t=>((e,t)=>{let o=!0;const n=x(_t,t);for(let r=t.startRow;r<=t.finishRow;r++)for(let s=t.startCol;s<=t.finishCol;s++)o=o&&Wt(e,r,s).exists(n);return o?w.some(t):w.none()})(e,t))),$t=(e,t,o)=>{const n=Vt(e);return Ft(n,t,o)},Vt=kt,Gt=(e,t)=>{we(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},qt=(e,t)=>{ye(e).fold((()=>{we(e).each((e=>{Ut(e,t)}))}),(e=>{Gt(e,t)}))},Ht=(e,t)=>{(e=>((e,t)=>{const o=e.dom.childNodes;return w.from(o[0]).map(Y.fromDom)})(e))(e).fold((()=>{Ut(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Ut=(e,t)=>{e.dom.appendChild(t.dom)},Kt=(e,t)=>{Gt(e,t),Ut(t,e)},Qt=(e,t)=>{W(t,((o,n)=>{const r=0===n?e:t[n-1];qt(r,o)}))},Xt=(e,t)=>{W(t,(t=>{Ut(e,t)}))},Yt=e=>{e.dom.textContent="",W(Ce(e),(e=>{Jt(e)}))},Jt=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Zt=e=>{const t=Ce(e);t.length>0&&Qt(e,t),Jt(e)},eo=((e,t)=>{const o=t=>e(t)?w.from(t.dom.nodeValue):w.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return o(t).getOr("")},getOption:o,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(ce),to=e=>eo.get(e),oo=(e,t)=>eo.set(e,t);var no=["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"],ro=()=>({up:v({selector:ke,closest:Le,predicate:Ee,all:be}),down:v({selector:Ae,predicate:Re}),styles:v({get:tt,getRaw:nt,set:et,remove:rt}),attrs:v({get:He,set:Ge,remove:Ke,copyTo:(e,t)=>{const o=Qe(e);qe(t,o)}}),insert:v({before:Gt,after:qt,afterAll:Qt,append:Ut,appendAll:Xt,prepend:Ht,wrap:Kt}),remove:v({unwrap:Zt,remove:Jt}),create:v({nu:Y.fromTag,clone:e=>Y.fromDom(e.dom.cloneNode(!1)),text:Y.fromText}),query:v({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:ve,nextSibling:ye}),property:v({children:Ce,name:oe,parent:we,document:e=>fe(e).dom,isText:ce,isComment:se,isElement:le,isSpecial:e=>{const t=oe(e);return A(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>le(e)?Ue(e,"lang"):w.none(),getText:to,setText:oo,isBoundary:e=>!!le(e)&&("body"===oe(e)||A(no,oe(e))),isEmptyTag:e=>!!le(e)&&A(["br","img","hr","input"],oe(e)),isNonEditable:e=>le(e)&&"false"===He(e,"contenteditable")}),eq:he,is:pe});const so=(e,t,o,n)=>{const r=t(e,o);return B(n,((o,n)=>{const r=t(e,n);return lo(e,o,r)}),r)},lo=(e,t,o)=>t.bind((t=>o.filter(x(e.eq,t)))),co=ro(),io=e=>ke(e,"table"),ao=(e,t,o)=>We(e,t).bind((t=>We(e,o).bind((e=>{return(o=io,n=[t,e],((e,t,o)=>o.length>0?((e,t,o,n)=>n(e,t,o[0],o.slice(1)))(e,t,o,so):w.none())(co,((e,t)=>o(t)),n)).map((o=>({first:t,last:e,table:o})));var o,n})))),mo=y,uo=e=>{const t=(e,t)=>Ue(e,t).exists((e=>parseInt(e,10)>1));return e.length>0&&_(e,(e=>t(e,"rowspan")||t(e,"colspan")))?w.some(e):w.none()},ho=(e,t,o)=>{return t.length<=1?w.none():(n=e,r=o.firstSelectedSelector,s=o.lastSelectedSelector,ao(n,r,s).bind((e=>{const t=e=>he(n,e),o="thead,tfoot,tbody,table",r=ke(e.first,o,t),s=ke(e.last,o,t);return r.bind((t=>s.bind((o=>he(t,o)?$t(e.table,e.first,e.last):w.none()))))}))).map((e=>({bounds:e,cells:t})));var n,r,s},po="data-mce-selected",go="data-mce-first-selected",fo="data-mce-last-selected",wo={selected:po,selectedSelector:"td["+po+"],th["+po+"]",firstSelected:go,firstSelectedSelector:"td["+go+"],th["+go+"]",lastSelected:fo,lastSelectedSelector:"td["+fo+"],th["+fo+"]"},bo=e=>({element:e,mergable:w.none(),unmergable:w.none(),selection:[e]}),vo=(e,t,o)=>({element:o,mergable:ho(t,e,wo),unmergable:uo(e),selection:mo(e)}),yo=e=>(t,o)=>{const n=oe(t),r="col"===n||"colgroup"===n?bt(s=t).bind((e=>((e,t)=>((e,t)=>{const o=Ae(e,t);return o.length>0?w.some(o):w.none()})(e,t))(e,wo.firstSelectedSelector))).fold(v(s),(e=>e[0])):t;var s;return Le(r,e,o)},Co=yo("th,td,caption"),xo=yo("th,td"),So=e=>{return t=e.model.table.getSelectedCells(),N(t,Y.fromDom);var t},To=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},Ro=(e,t)=>({element:e,offset:t}),Do=(e,t,o)=>e.property().isText(t)&&0===e.property().getText(t).trim().length||e.property().isComment(t)?o(t).bind((t=>Do(e,t,o).orThunk((()=>w.some(t))))):w.none(),Oo=(e,t)=>e.property().isText(t)?e.property().getText(t).length:e.property().children(t).length,Ao=(e,t)=>{const o=Do(e,t,e.query().prevSibling).getOr(t);if(e.property().isText(o))return Ro(o,Oo(e,o));const n=e.property().children(o);return n.length>0?Ao(e,n[n.length-1]):Ro(o,Oo(e,o))},Eo=Ao,ko=ro(),No={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Wo=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),Lo=(e,t)=>w.from(Wo.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>E(t,(t=>E(No[t],(t=>e===t)))))(n,t)?w.some({value:o,unit:n}):w.none()})),Mo=(e,t,o)=>((e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?w.none():w.some(t)})(e).getOr(t))(tt(e,t),o),jo=((e,t)=>{const o=t=>{const o=(e=>e.dom.offsetWidth)(t);if(o<=0||null===o){const o=tt(t,e);return parseFloat(o)||0}return o},n=(e,t)=>I(t,((t,o)=>{const n=tt(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),0);return{set:(t,o)=>{if(!f(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Ze(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}})("width"),Bo=e=>jo.get(e),Io=e=>jo.getOuter(e),Po=e=>((e,t)=>{const o=e.dom,n=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?n:((e,t,o,n)=>t-Mo(e,`padding-${o}`,0)-Mo(e,`padding-${n}`,0)-Mo(e,`border-${o}-width`,0)-Mo(e,`border-${n}-width`,0))(e,n,"left","right")})(e,"content-box"),zo=me("col"),_o=(e,t,o)=>{const n=(r=e,w.from(r.dom.parentElement).map(Y.fromDom)).getOrThunk((()=>(e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Y.fromDom(t)})(ge(e))));var r;return t(e)/o(n)*100},Fo=(e,t)=>{et(e,"width",t+"px")},$o=(e,t)=>{et(e,"width",t+"%")},Vo=e=>((e,t)=>nt(e,t).orThunk((()=>Ue(e,t).map((e=>e+"px")))))(e,"width"),Go=e=>_o(e,Bo,Po),qo=e=>{return zo(e)?Bo(e):Mo(t=e,"width",t.dom.offsetWidth);var t},Ho=(e,t,o)=>{et(e,"width",t+o)},Uo=v(/(\d+(\.\d+)?)%/),Ko=(e,t)=>{if(!lt(e)){const o=(e=>Vo(e).bind((e=>Lo(e,["fixed","relative","empty"]))))(e);o.each((o=>{const n=o.value/2;Ho(e,n,o.unit),Ho(t,n,o.unit)}))}},Qo=me("col"),Xo=me("colgroup"),Yo=e=>({element:e,colspan:st(e,"colspan",1),rowspan:st(e,"rowspan",1)}),Jo=(e,t=Yo)=>{const o=o=>{if((e=>"tr"===oe(e)||Xo(e))(o))return Xo((r={element:o}).element)?e.colgroup(r):e.row(r);{const r=o,s=(t=>Qo(t.element)?e.col(t):e.cell(t))(t(r));return n=w.some({item:r,replacement:s}),s}var r};let n=w.none();return{getOrInit:(e,t)=>n.fold((()=>o(e)),(n=>t(e,n.item)?n.replacement:o(e)))}},Zo=e=>N(e,v(0)),en=e=>(t,o,n,r)=>{if(e(n)){const e=Math.max(r,t[o]-Math.abs(n)),s=Math.abs(e-t[o]);return n>=0?s:-s}return n},tn=en((e=>e<0)),on=en(T),nn=()=>{const e=(e,t,o,n,r)=>{const s=on(e,n>=0?o:t,n,r);return((e,t,o,n,r)=>r(e.slice(0,t)).concat(n).concat(r(e.slice(o))))(e,t,o+1,[s,-s],Zo)};return{resizeTable:(e,t,o)=>{o&&e(t)},clampTableDelta:(e,t,o,n,r)=>{if(r){if(o>=0)return o;{const t=I(e,((e,t)=>e+t-n),0);return Math.max(-t,o)}}return tn(e,t,o,n)},calcLeftEdgeDeltas:e,calcMiddleDeltas:(t,o,n,r,s,l)=>e(t,n,r,s,l),calcRightEdgeDeltas:(e,t,o,n,r,s)=>{if(s)return Zo(e);{const t=n/e.length;return N(e,v(t))}},calcRedestributedWidths:(e,t,o,n)=>({delta:0,newSizes:e})}},rn=(e,t)=>Y.fromDom(e.dom.cloneNode(t)),sn=(e,t)=>{const o=((e,t)=>{const o=Y.fromTag(t),n=Qe(e);return qe(o,n),o})(e,t),n=Ce((e=>rn(e,!0))(e));return Xt(o,n),o},ln=(me("th"),(e,t,o)=>ht(o(e.element,t),!0,e.isLocked)),cn=()=>({transformRow:y,transformCell:ln}),an=()=>mn(0,0),mn=(e,t)=>({major:e,minor:t}),un={nu:mn,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?an():((e,t)=>{const o=((e,t)=>{for(let o=0;oNumber(t.replace(o,"$"+e));return mn(n(1),n(2))})(e,o)},unknown:an},dn=(e,t)=>{const o=String(t).toLowerCase();return P(e,(e=>e.search(o)))},hn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,pn=e=>t=>Xe(t,e),gn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Xe(e,"edge/")&&Xe(e,"chrome")&&Xe(e,"safari")&&Xe(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,hn],search:e=>Xe(e,"chrome")&&!Xe(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Xe(e,"msie")||Xe(e,"trident")},{name:"Opera",versionRegexes:[hn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:pn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:pn("firefox")},{name:"Safari",versionRegexes:[hn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Xe(e,"safari")||Xe(e,"mobile/"))&&Xe(e,"applewebkit")}],fn=[{name:"Windows",search:pn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>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:pn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:pn("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:pn("linux"),versionRegexes:[]},{name:"Solaris",search:pn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:pn("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:pn("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],wn={browsers:v(gn),oses:v(fn)},bn="Edge",vn="Chromium",yn="Opera",Cn="Firefox",xn="Safari",Sn=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(bn),isChromium:n(vn),isIE:n("IE"),isOpera:n(yn),isFirefox:n(Cn),isSafari:n(xn)}},Tn=()=>Sn({current:void 0,version:un.unknown()}),Rn=Sn,Dn=(v(bn),v(vn),v("IE"),v(yn),v(Cn),v(xn),"Windows"),On="Android",An="Linux",En="macOS",kn="Solaris",Nn="FreeBSD",Wn="ChromeOS",Ln=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Dn),isiOS:n("iOS"),isAndroid:n(On),isMacOS:n(En),isLinux:n(An),isSolaris:n(kn),isFreeBSD:n(Nn),isChromeOS:n(Wn)}},Mn=()=>Ln({current:void 0,version:un.unknown()}),jn=Ln,Bn=(v(Dn),v("iOS"),v(On),v(An),v(En),v(kn),v(Nn),v(Wn),e=>window.matchMedia(e).matches);let In=To((()=>((e,t,o)=>{const n=wn.browsers(),r=wn.oses(),s=t.bind((e=>((e,t)=>q(t.brands,(t=>{const o=t.brand.toLowerCase();return P(e,(e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:un.nu(parseInt(t.version,10),0)})))})))(n,e))).orThunk((()=>((e,t)=>dn(e,t).map((e=>{const o=un.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(Tn,Rn),l=((e,t)=>dn(e,t).map((e=>{const o=un.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Mn,jn),c=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,l=e.isiOS()||e.isAndroid(),c=l||n("(pointer:coarse)"),i=r||!s&&l&&n("(min-device-width:768px)"),a=s||l&&!i,m=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!a&&!i&&!m;return{isiPad:v(r),isiPhone:v(s),isTablet:v(i),isPhone:v(a),isTouch:v(c),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:v(m),isDesktop:v(u)}})(l,s,e,o);return{browser:s,os:l,deviceType:c}})(navigator.userAgent,w.from(navigator.userAgentData),Bn)));const Pn=(e,t=T)=>{const o=e.grid,n=k(o.columns,y),r=k(o.rows,y);return N(n,(o=>zn((()=>z(r,(t=>Wt(e,t,o).filter((e=>e.column===o)).toArray()))),(e=>1===e.colspan&&t(e.element)),(()=>Wt(e,0,o)))))},zn=(e,t,o)=>{const n=e();return P(n,t).orThunk((()=>w.from(n[0]).orThunk(o))).map((e=>e.element))},_n=(e,t)=>({left:e,top:t,translate:(o,n)=>_n(e+o,t+n)}),Fn=_n,$n=(e,t)=>void 0!==e?e:void 0!==t?t:0,Vn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Fn(o.offsetLeft,o.offsetTop);const s=$n(null==n?void 0:n.pageYOffset,r.scrollTop),l=$n(null==n?void 0:n.pageXOffset,r.scrollLeft),c=$n(r.clientTop,o.clientTop),i=$n(r.clientLeft,o.clientLeft);return Gn(e).translate(l-i,s-c)},Gn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Fn(o.offsetLeft,o.offsetTop):Te(e)?(e=>{const t=e.getBoundingClientRect();return Fn(t.left,t.top)})(t):Fn(0,0)},qn=(e,t)=>({col:e,x:t}),Hn=e=>Vn(e).left+Io(e),Un=e=>Vn(e).left,Kn=(e,t)=>qn(e,Un(t)),Qn=(e,t)=>qn(e,Hn(t)),Xn=(e,t,o)=>{if(0===o.length)return[];const n=N(o.slice(1),((t,o)=>t.map((t=>e(o,t))))),r=o[o.length-1].map((e=>t(o.length-1,e)));return n.concat([r])},Yn=(Jn={delta:y,edge:Un,positions:e=>Xn(Kn,Qn,e)},Zn={delta:e=>-e,edge:Hn,positions:e=>Xn(Qn,Kn,e)},e=>"rtl"===(e=>"rtl"===tt(e,"direction")?"rtl":"ltr")(e)?Zn:Jn);var Jn,Zn;const er=e=>Yn(e).edge(e),tr=me("col"),or=(e,t,o,n,r,s)=>e.filter(n).fold((()=>s(((e,t)=>{if(t<0||t>=e.length-1)return w.none();const o=e[t].fold((()=>{const o=(e=>{const t=R.call(e,0);return t.reverse(),t})(e.slice(0,t));return q(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>w.some({value:e,delta:0}))),n=e[t+1].fold((()=>{const o=e.slice(t+1);return q(o,((e,t)=>e.map((e=>({value:e,delta:t+1})))))}),(e=>w.some({value:e,delta:1})));return o.bind((e=>n.map((t=>{const o=t.delta+e.delta;return Math.abs(t.value-e.value)/o}))))})(o,t))),(e=>r(e))),nr=(e,t,o,n)=>{const r=Pn(e),s=jt(e)?(e=>N(Mt(e),(e=>w.from(e.element))))(e):r,l=[w.some(er(t))].concat(N(((e,t)=>Yn(t).positions(e,t))(r,t),(e=>e.map((e=>e.x))))),c=(i=lt,e=>!i(e));var i;return N(s,((e,t)=>or(e,t,l,c,(e=>{if((e=>{const t=In().browser,o=t.isChromium()||t.isFirefox();return!tr(e)||o})(e))return o(e);{const e=((e,t)=>null!=e?t(e):w.none())(r[t],y);return or(e,t,l,c,(e=>n(w.some(Bo(e)))),n)}}),n)))},rr=(e,t,o)=>nr(e,t,qo,(e=>e.getOrThunk(o.minCellWidth))),sr=(e,t)=>()=>Te(e)?t(e):parseFloat(nt(e,"width").getOr("0")),lr=e=>Vo(e).fold((()=>(e=>{const t=sr(e,Bo),o=v(0);return{width:t,pixelWidth:t,getWidths:(t,o)=>rr(t,e,o),getCellDelta:o,singleColumnWidth:v([0]),minCellWidth:o,setElementWidth:b,adjustTableWidth:b,isRelative:!0,label:"none"}})(e)),(t=>{return o=e,n=t,null!==Uo().exec(n)?(e=>{const t=sr(e,(e=>parseFloat((e=>_o(e,Bo,Po)+"%")(e)))),o=sr(e,Bo);return{width:t,pixelWidth:o,getWidths:(t,o)=>((e,t,o)=>nr(e,t,Go,(e=>e.fold((()=>o.minCellWidth()),(e=>e/o.pixelWidth()*100)))))(t,e,o),getCellDelta:e=>e/o()*100,singleColumnWidth:(e,t)=>[100-e],minCellWidth:()=>ct()/o()*100,setElementWidth:$o,adjustTableWidth:o=>{const n=t();$o(e,n+o/100*n)},isRelative:!0,label:"percent"}})(o):(e=>{const t=sr(e,Bo);return{width:t,pixelWidth:t,getWidths:(t,o)=>rr(t,e,o),getCellDelta:y,singleColumnWidth:(e,t)=>[Math.max(ct(),e+t)-e],minCellWidth:ct,setElementWidth:Fo,adjustTableWidth:o=>{const n=t()+o;Fo(e,n)},isRelative:!1,label:"pixel"}})(o);var o,n})),cr=(e,t,o,n)=>{o===n?Ke(e,t):Ge(e,t,o)},ir=(e,t,o)=>{G(Oe(e,t)).fold((()=>Ht(e,o)),(e=>qt(e,o)))},ar=(e,t)=>{const o=[],n=[],r=e=>N(e,(e=>{e.isNew&&o.push(e.element);const t=e.element;return Yt(t),W(e.cells,(e=>{e.isNew&&n.push(e.element),cr(e.element,"colspan",e.colspan,1),cr(e.element,"rowspan",e.rowspan,1),Ut(t,e.element)})),t})),s=e=>z(e,(e=>N(e.cells,(e=>(cr(e.element,"span",e.colspan,1),e.element))))),l=(t,o)=>{const n=((e,t)=>{const o=Ne(e,t).getOrThunk((()=>{const o=Y.fromTag(t,ge(e).dom);return"thead"===t?ir(e,"caption,colgroup",o):"colgroup"===t?ir(e,"caption",o):Ut(e,o),o}));return Yt(o),o})(e,o),l=("colgroup"===o?s:r)(t);Xt(n,l)},c=(t,o)=>{t.length>0?l(t,o):(t=>{Ne(e,t).each(Jt)})(o)},i=[],a=[],m=[],u=[];return W(t,(e=>{switch(e.section){case"thead":i.push(e);break;case"tbody":a.push(e);break;case"tfoot":m.push(e);break;case"colgroup":u.push(e)}})),c(u,"colgroup"),c(i,"thead"),c(a,"tbody"),c(m,"tfoot"),{newRows:o,newCells:n}},mr=(e,t)=>{if(0===e.length)return 0;const o=e[0],n=((e,n)=>{for(let n=0,s=e.length;n{const o=N(e,(e=>N(e.cells,S)));return N(e,((n,r)=>{const s=z(n.cells,((n,s)=>{if(!1===o[r][s]){const m=((e,t,o,n)=>{const r=((e,t)=>e[t])(e,t),s="colgroup"===r.section,l=mr(r.cells.slice(o),n),c=s?1:mr(((e,t)=>N(e,(e=>St(e,t))))(e.slice(t),o),n);return{colspan:l,rowspan:c}})(e,r,s,t);return((e,t,n,r)=>{for(let s=e;sq(e.all,(e=>P(e.cells,(e=>he(t,e.element))))),hr=(e,t,o)=>{const n=(e=>{const t=[],o=e=>{t.push(e)};for(let t=0;tgt(t).bind((t=>dr(e,t))).filter(o))));return Q(n.length>0,n)},pr=(e,t,o,n,r)=>(s,l,c,i)=>{const a=kt(s),m=w.from(null==i?void 0:i.section).getOrThunk(cn),u=t(a,l).map((t=>{const o=((e,t)=>((e,t,o)=>{const n=[];W(e.colgroups,(r=>{const s=[];for(let n=0;nht(e.element,o,!1))).getOrThunk((()=>ht(t.colGap(),!0,!1)));s.push(r)}n.push(pt(r.element,s,"colgroup",o))}));for(let r=0;rht(e.element,o,e.isLocked))).getOrThunk((()=>ht(t.gap(),!0,!1)));s.push(l)}const l=e.all[r],c=pt(l.element,s,l.section,o);n.push(c)}return n})(e,t,!1))(a,c),n=e(o,t,he,r(c),m),s=(e=>{const t=I(Rt(e).rows,((e,t)=>(W(t.cells,((t,o)=>{t.isLocked&&(e[o]=!0)})),e)),{}),o=Ie(t,((e,t)=>parseInt(t,10)));return F(o)})(n.grid);return{info:t,grid:(l=n.grid,ur(l,he)),cursor:n.cursor,lockedColumns:s};var l}));return u.bind((e=>{const t=ar(s,e.grid),r=w.from(null==i?void 0:i.sizing).getOrThunk((()=>lr(s))),l=w.from(null==i?void 0:i.resize).getOrThunk(nn);return o(s,e.grid,e.info,{sizing:r,resize:l,section:m}),n(s),Ke(s,Dt),e.lockedColumns.length>0&&Ge(s,Dt,e.lockedColumns.join(",")),w.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})}))},gr=(e,t)=>gt(t.element).bind((t=>dr(e,t))),fr=(e,t)=>hr(e,t,T),wr=(e,t)=>_(t,(t=>((e,t)=>dr(e,t).exists((e=>!e.isLocked)))(e,t))),br=(e,t)=>((e,t)=>t.mergable)(0,t).filter((t=>wr(e,t.cells))),vr=(e,t)=>((e,t)=>t.unmergable)(0,t).filter((t=>wr(e,t))),yr=["img","br"],Cr=e=>{return(t=e,eo.getOption(t)).filter((e=>0!==e.trim().length||e.indexOf("\xa0")>-1)).isSome()||A(yr,oe(e))||(e=>{return le(t=e)&&te(t.dom)&&"false"===He(e,"contenteditable");var t})(e);var t},xr={scope:["row","col"]},Sr=e=>()=>{const t=Y.fromTag("td",e.dom);return Ut(t,Y.fromTag("br",e.dom)),t},Tr=e=>()=>Y.fromTag("col",e.dom),Rr=e=>()=>Y.fromTag("colgroup",e.dom),Dr=e=>()=>Y.fromTag("tr",e.dom),Or=(e,t,o)=>{const n=sn(e,t);return Be(o,((e,t)=>{null===e?Ke(n,t):Ge(n,t,e)})),n},Ar=(e,t,o)=>{return(n=e,((e,t)=>{const o=e=>{for(let n=0;n{const r=o.join(","),s=De(n,r,(t=>he(t,e)));return B(s,((e,t)=>{const o=rn(t,!1);return Ut(e,o),o}),t)})).getOr(t);var n},Er=(e,t,o)=>{const n=(e,t)=>{((e,t)=>{const o=e.dom,n=t.dom;Ze(o)&&Ze(n)&&(n.style.cssText=o.style.cssText)})(e.element,t),rt(t,"height"),1!==e.colspan&&rt(t,"width")};return{col:o=>{const r=Y.fromTag(oe(o.element),t.dom);return n(o,r),e(o.element,r),r},colgroup:Rr(t),row:Dr(t),cell:r=>{const s=Y.fromTag(oe(r.element),t.dom),l=o.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),c=l.length>0?Ar(r.element,s,l):s;return Ut(c,Y.fromTag("br")),n(r,s),((e,t)=>{Be(xr,((o,n)=>Ue(e,n).filter((e=>A(o,e))).each((e=>Ge(t,n,e)))))})(r.element,s),e(r.element,s),s},replace:Or,colGap:Tr(t),gap:Sr(t)}},kr=e=>kt(e).grid,Nr=(e,t=!1)=>{return Te(e)?e.dom.isContentEditable:(o=e,Le(o,"[contenteditable]")).fold(v(t),(e=>"true"===Wr(e)));var o},Wr=e=>e.dom.contentEditable,Lr=(e,t,o,n,r)=>N(e,(e=>{const s=t>0&&t{if("colgroup"!==o&&n)return St(e,t);{const t=St(e,r);return ht(l(t.element,s),!0,!1)}})(e,t,e.section,s,o,n,r);return((e,t,o)=>((e,t,o)=>{const n=e.cells,r=n.slice(0,t),s=n.slice(t),l=r.concat(o).concat(s);return xt(e,l)})(e,t,[o]))(e,t,l)})),Mr={...(e=>{if(!a(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return W(e,((n,r)=>{const s=Me(n);if(1!==s.length)throw new Error("one and only one name per case");const l=s[0],c=n[l];if(void 0!==o[l])throw new Error("duplicate key detected:"+l);if("cata"===l)throw new Error("cannot have a case named cata (sorry)");if(!a(c))throw new Error("case arguments must be an array");t.push(l),o[l]=(...o)=>{const n=o.length;if(n!==c.length)throw new Error("Wrong number of arguments to case "+l+". Expected "+c.length+" ("+c+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const n=Me(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!_(t,(e=>A(n,e))))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[l].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:l,params:o})}}}})),o})([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},jr=(e,t)=>jt(e)?((e,t)=>{const o=Mt(e);return N(o,((e,o)=>({element:e.element,width:t[o],colspan:e.colspan})))})(e,t):((e,t)=>{const o=(e=>z(e.all,(e=>e.cells)))(e);return N(o,(e=>{const o=((e,t,o)=>{let n=0;for(let r=e;r{const n=jr(e,t);W(n,(e=>{o.setElementWidth(e.element,e.width)}))},Ir=e=>I(e,((e,t)=>E(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),Pr=e=>Nr(e,!0),zr=(e,t,o)=>((e,t)=>({grid:e,cursor:t}))(e,((e,t,o)=>{var n,r;const s=Rt(e).rows;return w.from(null===(r=null===(n=s[t])||void 0===n?void 0:n.cells[o])||void 0===r?void 0:r.element).filter(Pr).orThunk((()=>(e=>q(e,(e=>q(e.cells,(e=>{const t=e.element;return Q(Pr(t),t)})))))(s)))})(e,t,o)),_r=(e,t,o,n)=>((e,t,o,n,r)=>{const s=Nt(t),l=n.getWidths(s,n),c=n.pixelWidth(),{newSizes:i,delta:a}=r.calcRedestributedWidths(l,c,o.pixelDelta,n.isRelative);Br(s,i,n),n.adjustTableWidth(a)})(0,t,o,n.sizing,n.resize),Fr=(e,t)=>{const o=Pn(e),n=Ir(t);return I(n,((e,t)=>e+o[t.column].map(Io).getOr(0)),0)},$r=pr(((e,t,o,n)=>{const r=t.detail,s=r.column,l=r.column,c=Lr(e,l,s,o,n.getOrInit);return zr(c,r.row,l)}),((e,t)=>gr(e,t).filter((e=>!E([e],(e=>0===e.column&&e.isLocked)))).map((t=>({detail:t,pixelDelta:Fr(e,[t])})))),_r,b,Jo),Vr=pr(((e,t,o,n)=>{const r=Ir(t.details),s=((e,t)=>z(e,(e=>{const o=e.cells,n=B(t,((e,t)=>t>=0&&t0?[pt(e.element,n,e.section,e.isNew)]:[]})))(e,N(r,(e=>e.column))),l=s.length>0?s[0].cells.length-1:0;return zr(s,r[0].row,Math.min(r[0].column,l))}),((e,t)=>((e,t)=>hr(e,t,(e=>!e.isLocked)))(e,t).map((t=>({details:t,pixelDelta:-Fr(e,t)})))),_r,(e=>{0===ft(e).length&&Jt(e)}),Jo),Gr=(e,t)=>{const o=He(e,t);return void 0===o||""===o?[]:o.split(" ")},qr=e=>void 0!==e.dom.classList,Hr=e=>e.dom.textContent,Ur=me("th"),Kr=(e,t)=>e&&t?"sectionCells":e?"section":"cells",Qr=e=>{const t=M(e,(e=>Ur(e.element)));return 0===t.length?w.some("td"):t.length===e.length?w.some("th"):w.none()},Xr=e=>{const t=N(e,(e=>(e=>{const t="thead"===e.section,o=H(Qr(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:Kr(t,o)}:{type:"body"}})(e).type)),o=A(t,"header"),n=A(t,"footer");if(o||n){const e=A(t,"body");return!o||e||n?o||e||!n?w.none():w.some("footer"):w.some("header")}return w.some("body")},Yr={structure:!1,style:!0},Jr={structure:!0,style:!1},Zr=(e,t,o)=>({value:t+1}),es=(e,t,o)=>{const n="A".charCodeAt(0),r=[];let s=t;for(;s>=0;)r.push(String.fromCharCode(n+s%26)),s=Math.floor(s/26)-1;return{value:r.reverse().join("")}},ts=e=>e.options.get("advtable_value_series"),os=e=>{const t=parseFloat(e);return isNaN(t)?w.none():w.some(t)},ns=(e,t)=>et?1:0,rs=(e,t)=>U(os(e),os(t),ns).getOrThunk((()=>((e,t)=>e.localeCompare(t))(e,t))),ss=e=>{const t=(e=>w.from(e.options.get("table_clone_elements")))(e),o=(o,r,s,l)=>(c,i,a,m,u=!1)=>{const d=Y.fromDom(e.getDoc()),h=Er(s,d,t);return r(c)?o(c,i,h).bind((t=>{W(t.newRows,(t=>{((e,t)=>{e.dispatch("NewRow",{node:t})})(e,t.dom)})),W(t.newCells,(t=>{((e,t)=>{e.dispatch("NewCell",{node:t})})(e,t.dom)}));const o=((t,o,r,s)=>{const l=r.filter((e=>Te(e)&&n(e))).or(o.cursor);return l.fold((()=>{const o=ft(t);return V(o).filter(Te).map((o=>{const n=e.dom.createRng();return n.selectNode(o.dom),s&&(e.model.table.clearSelectedCells(t.dom),e.selection.setRng(n),Ge(o,"data-mce-selected","1")),n}))}),(o=>{const n=e.dom.createRng(),r=Eo(ko,o);return n.setStart(r.element.dom,r.offset),n.setEnd(r.element.dom,r.offset),s&&(e.model.table.clearSelectedCells(t.dom),e.selection.setRng(n)),w.some(n)}))})(c,t,a,m);return Te(c)&&((e=>{Ke(e,"data-mce-style");const t=e=>Ke(e,"data-mce-style");W(ft(e),t),W(wt(e),t),W(vt(e),t)})(c),u||((e,t,o)=>{e.dispatch("TableModified",{...o,table:t})})(e,c.dom,l)),o.map((e=>({rng:e,effect:l})))})):w.none()},n=e=>Nr(e,!0),r=(e,t,o)=>((e,t)=>({grid:e,cursor:t}))(e,((e,t,o)=>{var r,s;const l=Rt(e).rows;return w.from(null===(s=null===(r=l[t])||void 0===r?void 0:r.cells[o])||void 0===s?void 0:s.element).filter(n).orThunk((()=>(e=>q(e,(e=>q(e.cells,(e=>{const t=e.element;return Q(n(t),t)})))))(l)))})(e,t,o)),s=(e,t,o,n)=>{const{cols:r,rows:s}=Rt(e),l=j(s,(e=>e.section)),c=N(l,(e=>j(e,(e=>{const o=St(e,t).element;return oe(o)})))),i=z(c,(e=>z(e,(e=>{const r=St(e[0],t).element;return"th"===oe(r)?e:(e=>{const r=N(e,(e=>{const o=St(e,t).element;return{row:e,text:w.from(Hr(o)).getOr("")}})),s=F(r,((e,t)=>{const r=o(e.text,t.text);return n?r:-1*r}));return N(s,(e=>e.row))})(e)}))));return[...r,...i]},l=(e,t,o,n)=>{const{cols:r,rows:s}=Rt(e),l=s[t].cells,c=N(l,(e=>{const t=e.element;return w.from(Hr(t)).getOr("")})),i=me("th"),a=N(s,(e=>{const t=N(e.cells,((e,t)=>({cell:e,column:t,reference:l[t],referenceText:c[t]})));return{...e,zippedCells:t}})),m=N(a,(e=>{const t=j(e.zippedCells,(e=>{const t=e.reference.element;return oe(t)})),r=z(t,(e=>{const t=e[0].reference.element;if(i(t))return N(e,(e=>e.cell));{const{pass:t,fail:r}=L(e,(e=>e.cell.isLocked)),s=F(r,((e,t)=>{const r=o(e.referenceText,t.referenceText);return n?r:-1*r})),l=I(t,((e,t)=>{const o=t.column,n=e.slice(0,o),r=e.slice(o);return n.concat([t]).concat(r)}),s);return N(l,(e=>e.cell))}}));return pt(e.element,r,e.section,e.isNew)}));return[...r,...m]},u=s,d=l,h=(e,t,o,n,r)=>{const{cols:s,rows:l}=Rt(e),c=l.slice(0,t),i=[...s,...l.slice(t,o+1)];return{beforeRows:c,afterRows:l.slice(o+1,e.length),selectionGridBefore:i.map((e=>({...e,cells:e.cells.slice(0,n)}))),selectionGrid:i.map((e=>({...e,cells:e.cells.slice(n,r+1)}))),selectionGridAfter:i.map((e=>({...e,cells:e.cells.slice(r+1,e.cells.length)})))}},p=(e,t)=>{const o=N(t,((t,o)=>{const n=e.selectionGridBefore[o].cells,r=e.selectionGridAfter[o].cells;return{...t,cells:n.concat(t.cells).concat(r)}})),{cols:n,rows:r}=Rt(o);return[...n,...e.beforeRows,...r,...e.afterRows]},g=(e,t,o,n,r,l,c,i)=>{const a=h(e,o,n,r,l),m=s(a.selectionGrid,t-r,c,i);return p(a,m)},C=(e,t,o,n,r,s,c,i)=>{const a=h(e,o,n,r,s),m=l(a.selectionGrid,t-o,c,i);return p(a,m)},x=e=>I(e,((e,t)=>E(e,(e=>e.row===t.row))?e:e.concat([t])),[]).sort(((e,t)=>e.row-t.row)),S=e=>I(e,((e,t)=>E(e,(e=>e.column===t.column))?e:e.concat([t])),[]).sort(((e,t)=>e.column-t.column)),R=e=>I(e,((e,t)=>E(e,(e=>he(e.element,t.element)))?e:e.concat([t])),[]),D=e=>{const t=i(e.attributes)?Ie(e.attributes,((e,t)=>m(e)?e=>Ke(e,t):o=>Ge(o,t,e))):[];return[...t,...((e,t)=>{if(a(e)){for(let o=0,n=e.length;ot=>((e,t)=>{qr(e)?e.dom.classList.add(t):((e,t)=>{((e,t,o)=>{const n=Gr(e,t).concat([o]);Ge(e,t,n.join(" "))})(e,"class",t)})(e,t)})(t,e))):[],t=>{const o=Hr(t)||"",n=(r=e.value,f(r)?String(r):c(r)?r:void 0);var r;const s=c(n)?n:o;Je(s)?((e,t)=>{const o=ge(e).dom,n=Y.fromDom(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Ce(Y.fromDom(o))})(t,o);Xt(n,r),Yt(e),Ut(e,n)})(t,"
"):((e,t)=>{e.dom.textContent=t})(t,s)}]},O=(e,t,o,n,r,s,l,c)=>{let i;W(t,((t,a)=>{const m=t.element,u={sectionType:s(a),cellType:oe(m),getRowType:l(a),getColType:c(a),classes:(p=m,qr(p)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;eGr(e,"class"))(p)),prev:null==i?void 0:i.raw,direction:o},d=e(u,n(a),r(a)),h=D(d);var p;W(h,(e=>e(m))),i=d}))},A=(e,t,o,n,s)=>{const l=g(e,s,0,e.length,s,s,o,n);return r(l,t[0].row,t[0].column)},k=(e,t,o,n,s)=>{const l=x(t),c=S(t),i=g(e,s,l[0].row,l[l.length-1].row,c[0].column,c[c.length-1].column,o,n);return r(i,t[0].row,t[0].column)},M=(e,t,o,n,s)=>{const l=u(e,s,o,n);return r(l,t.row,t.column)},B=(e,t,o,n,s)=>{const l=C(e,s,s,s,0,e[t[0].row].cells.length,o,n);return r(l,t[0].row,t[0].column)},P=(e,t,o,n,s)=>{const l=x(t),c=S(t),i=C(e,s,l[0].row,l[l.length-1].row,c[0].column,c[c.length-1].column,o,n);return r(i,t[0].row,t[0].column)},_=(e,t,o,n,s)=>{const l=d(e,s,o,n);return r(l,t.row,t.column)},$=(e,t,o,n)=>{const s=Rt(e).rows,l=N(s,(e=>St(e,n))),c=R(l),i=To((()=>Qr(c).getOr("")));return O(o,c,"column",y,v(n),(e=>s[e].section),(e=>To((()=>{const t=s[e];return Xr([{cells:t.cells,section:t.section}]).getOr("")}))),(e=>i)),r(e,t.row,t.column)},G=(e,t,o,n)=>{const s=Rt(e).rows,l=s[n],c=R(l.cells),i=To((()=>Xr([{cells:l.cells,section:l.section}]).getOr("")));return O(o,c,"row",v(n),y,(e=>l.section),(e=>i),(e=>To((()=>{const t=N(s,(t=>St(t,e)));return Qr(t).getOr("")})))),r(e,t.row,t.column)},H=(e,t,o,n,r)=>(s,l,c)=>{const i=pr(((r,s)=>e(r,s,t,o,n)),r,b,b,Jo);return i(s,l,c)},U=(e,t,o,n)=>(r,s,l)=>{const c=pr(((n,r)=>e(n,r,t,o)),n,b,b,Jo);return c(r,s,l)},K=o($r,T,Ko,Jr),X=o(Vr,(t=>0==("table"===oe(It(e)))||kr(t).columns>1),b,Jr);return{sortColumnRowsAsc:e=>o(H(A,rs,!0,e,fr),T,b,Jr),sortColumnRowsDesc:e=>o(H(A,rs,!1,e,fr),T,b,Jr),sortSelectionRowsAsc:e=>o(H(k,rs,!0,e,fr),T,b,Jr),sortSelectionRowsDesc:e=>o(H(k,rs,!1,e,fr),T,b,Jr),sortTableRowsAsc:e=>o(H(M,rs,!0,e,gr),T,b,Jr),sortTableRowsDesc:e=>o(H(M,rs,!1,e,gr),T,b,Jr),sortRowColumnsAsc:e=>o(H(B,rs,!0,e,fr),T,b,Jr),sortRowColumnsDesc:e=>o(H(B,rs,!1,e,fr),T,b,Jr),sortSelectionColumnsAsc:e=>o(H(P,rs,!0,e,fr),T,b,Jr),sortSelectionColumnsDesc:e=>o(H(P,rs,!1,e,fr),T,b,Jr),sortTableColumnsAsc:e=>o(H(_,rs,!0,e,gr),T,b,Jr),sortTableColumnsDesc:e=>o(H(_,rs,!1,e,gr),T,b,Jr),insertColumnBefore:K,deleteColumn:X,populateColumn:(e,t)=>o(U($,t,e,gr),T,b,Yr),populateRow:(e,t)=>o(U(G,t,e,gr),T,b,Yr)}},ls="data-snooker-locked-cols",cs=e=>Ue(e,ls).map((e=>z(e.split(","),(e=>{const t=parseInt(e,10);return isNaN(t)?[]:[t]})))).getOr([]),is=(e,t)=>Ge(e,ls,F(t).join(",")),as=(e,t)=>{const o=cs(e);A(o,t)||is(e,o.concat([t]))},ms=(e,t)=>{const o=cs(e);is(e,M(o,(e=>t!==e)))},us="data-snooker-col-series",ds=e=>Ue(e,us),hs=(e,t)=>H(ds(e).map((e=>e.toLowerCase())),t.toLowerCase()),ps=e=>((e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)})(e,us),gs=e=>{const t=lr(e),o=kt(e),n=Wt(o,0,0).bind((e=>{const t=e.element;return Lo(tt(t,"width"),["fixed"])})).map((e=>28-e.value)).getOr(0);((e,t,o,n,r)=>{const s=kt(e),l=r.getCellDelta(t),c=r.getWidths(s,r),i=0==s.grid.columns-1,a=n.clampTableDelta(c,0,l,r.minCellWidth(),i),m=((e,t,o,n,r)=>{const s=e.slice(0),l=((e,t)=>0===e.length?Mr.none():1===e.length?Mr.only(0):0===t?Mr.left(0,1):t===e.length-1?Mr.right(t-1,t):t>0&&tn.singleColumnWidth(s[e],o)),((e,t)=>r.calcLeftEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)),((e,t,l)=>r.calcMiddleDeltas(s,e,t,l,o,n.minCellWidth(),n.isRelative)),((e,t)=>r.calcRightEdgeDeltas(s,e,t,o,n.minCellWidth(),n.isRelative)))})(c,0,a,r,n),u=N(m,((e,t)=>e+c[t]));Br(s,u,r),n.resizeTable(r.adjustTableWidth,a,i)})(e,n,0,nn(),t)},fs=(e,t,o,n,r)=>{((e,t)=>{const o=E(cs(e),(e=>0===e));o&&ms(e,0),t(),o&&as(e,1)})(e,(()=>{o.column(0,t.insertColumnBefore,!0,!0),gs(e),ws(e,t,o,n,r)}))},ws=(e,t,o,n,r)=>{o.table(e,0,0,t.populateColumn(0,((e,t,o)=>{const n=r.generator(e,t,o);return{raw:n,value:n.value,classes:n.classes,attributes:{contenteditable:"false",...n.attributes,"data-mce-resize":!1===r.resizable?"false":null}}})),!0,!0),((e,t)=>{Ge(e,us,t)})(e,n),as(e,0)},bs=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},vs=e=>bt(zt(e),Pt(e)),ys=(e,t)=>{e.execCommand("mceTableToggleSeries",!1,t)},Cs=(e,t,o)=>t.onSetupCellOrRowToggle((()=>((e,t)=>vs(e).exists((e=>Je(t)?!ps(e):hs(e,t))))(e,o))),xs=(e,t)=>({type:"togglemenuitem",text:"None",onAction:()=>{(e=>vs(e).bind(ds))(e).each((t=>{ys(e,{name:t})}))},onSetup:Cs(e,t,"")}),Ss=(e,t,o,n,r)=>({type:"togglemenuitem",text:o,value:n,icon:r,onAction:()=>ys(e,{name:n}),onSetup:Cs(e,t,n)}),Ts=(e,t,o)=>Ie(o,((o,n)=>{const r=w.from(o.title).getOrThunk((()=>{return""===(e=n)?"":e.charAt(0).toUpperCase()+e.substring(1);var e}));return Ss(e,t,r,n)})),Rs=e=>t=>{const o=t.getData();t.close(),e.undoManager.transact((()=>{e.execCommand("mceSortTableAdvanced",!1,o),e.focus(),e.addVisual()}))},Ds=e=>{const t={type:"listbox",name:"sortby",label:"Sort by",items:[{text:"Column",value:"column"},{text:"Row",value:"row"}]},o=bs(w.none()),n=t=>({type:"listbox",name:"roworcol",label:"column"===t?"Column":"Row",items:"column"===t?(()=>{const t=o.get().getOrDie("state must be present"),n=t.limit?t.finishCol+1-t.startCol:t.columns;return k(n,(o=>{const n=t.limit?t.startCol:0,r=(e=>{let t=e,o="";for(;Math.floor(t)>0;)--t,o+=String.fromCharCode("A".charCodeAt(0)+t%26),t/=26;return o.split("").reverse().join("")})(o+n+1);return{text:e.translate(["Column {0}",r]),value:`${o+n}`}}))})():(()=>{const t=o.get().getOrDie("state must be present"),n=t.limit?t.finishRow+1-t.startRow:t.rows;return k(n,(o=>{const n=t.limit?t.startRow:0,r=(o+n+1).toString();return{text:e.translate(["Row {0}",r]),value:`${o+n}`}}))})()}),r=e=>({type:"listbox",name:"sort",label:"Sort",items:["column"===e?{text:"Column",value:"column"}:{text:"Row",value:"row"},{text:"Selection",value:"selection"},{text:"Table",value:"table"}]}),s={type:"listbox",name:"order",label:"Order",items:[{text:"Ascending",value:"ascending"},{text:"Descending",value:"descending"}]},l=e=>({type:"panel",items:[{type:"grid",columns:2,items:[t,n(e),r(e),s]}]}),c=e=>({title:"Advanced Sort",size:"normal",body:l(e),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"sort",text:"Sort",primary:!0}]}),i=()=>{o.set(w.none())},a=(t,n)=>{if("sortby"===n.name){const n=t.getData(),l=(r=n,s=o.get().getOrDie("state must be present"),"column"===r.sortby?{sortby:"column",roworcol:`${s.startCol}`,sort:"row"===r.sort?"column":r.sort,order:r.order}:{sortby:"row",roworcol:`${s.startRow}`,sort:"column"===r.sort?"row":r.sort,order:r.order}),m={...c(n.sortby),onChange:a,onClose:i,onSubmit:Rs(e),initialData:l};t.redial(m),t.focus("sortby")}var r,s};xo(zt(e)).each((t=>{bt(t,Pt(e)).each((n=>{const r=vo(So(e),n,t),s=t=>{o.set(w.some(t));const n={sortby:"column",roworcol:`${t.startCol}`,sort:"column",order:"ascending"},r={...c("column"),onChange:a,onClose:i,onSubmit:Rs(e),initialData:n};e.windowManager.open(r)},l=kr(n);r.mergable.fold((()=>{$t(n,t,t).each((e=>{const t={...e,...l,limit:!1};s(t)}))}),(e=>{const t={...e.bounds,...l,limit:!0};s(t)}))}))}))},Os=(e,t,o,n)=>{const r=e=>"selection"===e,s=e=>"ascending"===e,l=t=>bt(t,Pt(e)),i=()=>xo(zt(e),Pt(e)).bind((e=>l(e).bind((t=>$t(t,e,e))))),a=()=>i().map((e=>e.startCol)),m=()=>i().map((e=>e.startRow));e.addCommand("mceSortTableByColumnAsc",(()=>{a().each((e=>{o.selection(t.sortTableRowsAsc(e))}))})),e.addCommand("mceSortTableByColumnDesc",(()=>{a().each((e=>{o.selection(t.sortTableRowsDesc(e))}))})),e.addCommand("mceSortTableByRowAsc",(()=>{m().each((e=>{o.selection(t.sortTableColumnsAsc(e))}))})),e.addCommand("mceSortTableByRowDesc",(()=>{m().each((e=>{o.selection(t.sortTableColumnsDesc(e))}))})),e.addCommand("mceSortTableAdvanced",((e,n)=>(e=>{const n=parseInt(e.roworcol,10);"column"===e.sortby?((e,n)=>{(e=>"column"===e)(e.sort)?s(e.order)?o.selection(t.sortColumnRowsAsc(n)):o.selection(t.sortColumnRowsDesc(n)):r(e.sort)?s(e.order)?o.selection(t.sortSelectionRowsAsc(n)):o.selection(t.sortSelectionRowsDesc(n)):s(e.order)?o.selection(t.sortTableRowsAsc(n)):o.selection(t.sortTableRowsDesc(n))})(e,n):((e,n)=>{(e=>"row"===e)(e.sort)?s(e.order)?o.selection(t.sortRowColumnsAsc(n)):o.selection(t.sortRowColumnsDesc(n)):r(e.sort)?s(e.order)?o.selection(t.sortSelectionColumnsAsc(n)):o.selection(t.sortSelectionColumnsDesc(n)):s(e.order)?o.selection(t.sortTableColumnsAsc(n)):o.selection(t.sortTableColumnsDesc(n))})(e,n)})(n))),e.addCommand("mceAdvancedTableSort",(()=>Ds(e))),e.addCommand("mceTableToggleSeries",((r,s)=>{const i=w.from(s.name).filter(c),a=l(zt(e));U(i,a,((e,r)=>{hs(r,e)?((e,t,o)=>{ms(e,0),(e=>{Ke(e,us)})(e),o.column(0,t.deleteColumn,!0,!0)})(r,t,o):_e(n,e).each((n=>{(ps(r)?ws:fs)(r,t,o,e,n)}))}))}))},As=e=>{const t=bs(w.none()),o=bs([]);let n=w.none();const r=me("caption"),s=()=>Co(zt(e),Pt(e)).bind((t=>K(U(bt(t),Co((e=>Y.fromDom(e.selection.getEnd()))(e),Pt(e)).bind(bt),((o,n)=>he(o,n)?r(t)?w.some(bo(t)):w.some(vo(So(e),o,t)):w.none()))))),l=e=>bt(e.element).map((t=>{const o=kt(t),n=fr(o,e).getOr([]),r=I(n,((e,t)=>(t.isLocked&&(e.onAny=!0,0===t.column?e.onFirst=!0:t.column+t.colspan>=o.grid.columns&&(e.onLast=!0)),e)),{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:br(o,e).isSome(),unmergeable:vr(o,e).isSome(),locked:r}})),c=()=>{t.set(To(s)()),n=t.get().bind(l),W(o.get(),(e=>e()))},i=e=>(e(),o.set(o.get().concat([e])),()=>{o.set(M(o.get(),(t=>t!==e)))}),a=(e,o)=>i((()=>t.get().fold((()=>{e.setEnabled(!1)}),(t=>{e.setEnabled(!o(t))}))));return e.on("NodeChange ExecCommand TableSelectorChange",c),{onSetupTable:e=>a(e,(e=>!1)),onSetupCellOrRow:e=>a(e,(e=>r(e.element))),onSetupColumn:e=>t=>a(t,(t=>r(t.element)||(e=>n.exists((t=>t.locked[e])))(e))),onSetupCellOrRowToggle:e=>o=>((e,o,n)=>i((()=>t.get().fold((()=>{e.setEnabled(!1),e.setActive(!1)}),(t=>{e.setEnabled(!(e=>r(e.element))(t)),e.setActive(n(t))})))))(o,0,e),resetTargets:c,targets:()=>t.get()}};tinymce.PluginManager.requireLangPack("advtable","ar,bg_BG,ca,cs,da,de,el,es,eu,fa,fi,fr_FR,he_IL,hi,hr,hu_HU,id,it,ja,kk,ko_KR,ms,nb_NO,nl,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,sv_SE,th_TH,tr,uk,vi,zh_CN,zh_TW"),tinymce.PluginManager.add("advtable",(e=>{if(((e,o)=>!!e&&-1===((e,o)=>{const n=t(e.major,o.major);if(0!==n)return n;const r=t(e.minor,o.minor);if(0!==r)return r;const s=t(e.patch,o.patch);return 0!==s?s:0})((e=>n((e=>[e.majorVersion,e.minorVersion].join(".").split(".").slice(0,3).join("."))(e)))(e),n(o)))(tinymce,"6.0.0"))return console.error("Please use Enhanced Tables with TinyMCE 6.0.0 or later."),{};(e=>{(0,e.options.register)("advtable_value_series",{processor:"object",default:{numeric:{title:"Numeric",update:!0,resizable:!1,generator:Zr},alpha:{title:"Alpha",update:!0,resizable:!1,generator:es}}})})(e);const o=ss(e),r=As(e),s=(e=>{const t=t=>{e.focus()},o=t=>bt(t,Pt(e)),n=(n,r,s,l,c)=>{xo(zt(e)).each((e=>{o(e).each((o=>{const i=kt(o),a=(e,t)=>Lt(i,e,he).map((e=>e[t])),m=n.orThunk((()=>a(e,"row"))),u=r.orThunk((()=>a(e,"column"))),d=K(U(m,u,((e,t)=>Wt(i,e,t).map((e=>e.element)))));d.bind((t=>{const n=bo(t);return s(o,n,Q(l,e),!0,c)})).each(t)}))}))};return{selection:(n,r)=>{xo(zt(e)).each((s=>{o(s).each((o=>{const l=vo(So(e),o,s);n(o,l,w.none(),!0,r).each(t)}))}))},row:(e,t,o,r)=>n(w.some(e),w.none(),t,o,r),column:(e,t,o,r)=>n(w.none(),w.some(e),t,o,r),table:(o,n,r,s,l,c)=>{const i=kt(o),a=Wt(i,n,r).map((e=>e.element)),m=xo(zt(e)),u=m.bind((e=>Lt(i,e,he))).isSome(),d=a.bind((e=>{const t=bo(e),n=u&&l?m:w.none();return s(o,t,n,u,c)}));d.each(t)}}})(e),l=ts(e);return Os(e,o,s,l),((e,t,o,n)=>{const r=()=>bt(zt(e),Pt(e)),s=(s,l=T)=>{const c=ds(s),i=c.bind((e=>_e(n,e)));U(c,i,((n,c)=>{1===kt(s).grid.columns?r().exists((e=>he(s,e)))?e.execCommand("mceTableDelete"):e.undoManager.transact((()=>{Jt(s)})):!0===c.update&&l()&&ws(s,t,o,n,c)}))};e.on("TableModified",(e=>{const t=Y.fromDom(e.table);s(t,(()=>!1!==e.structure))})),e.on("PreInit",(()=>{((e,t)=>{const o=e=>{const t=[];return h(e)?t:((e=>"thead"===e.name||"tbody"===e.name||"tfoot"===e.name)(e)?t.push(...o(e.firstChild)):"tr"===e.name&&t.push(e),t.concat(o(e.next)))},n=e=>o(e.firstChild);e.parser.addAttributeFilter(us,(e=>{var o;for(const r of e)if("table"===r.name){const e=r.attr(us);if(!1===(null===(o=t[e])||void 0===o?void 0:o.resizable)){const e=n(r);for(const t of e)p(t.firstChild)&&t.firstChild.attr("data-mce-resize","false")}}}))})(e,n)})),e.on("init",(()=>{const t=()=>{const t=xo(zt(e),Pt(e));return e.selection.isCollapsed()&&t.exists((t=>e.dom.isEmpty(t.dom)))};e.on("ExecCommand",(e=>{const o=e.command.toLowerCase();"delete"!==o&&"forwarddelete"!==o||!t()||r().each(s)}),!0),e.on("keyup",(e=>{const o=e.keyCode;8!==o&&46!==o||!t()||r().each(s)}))}))})(e,o,s,l),e.hasPlugin("table")&&(((e,t)=>{const o=(t,o)=>()=>e.execCommand(t,!1,o),n=t.onSetupCellOrRow,r=[{type:"menuitem",text:"Sort table by column ascending",onAction:o("mceSortTableByColumnAsc"),onSetup:n},{type:"menuitem",text:"Sort table by column descending",onAction:o("mceSortTableByColumnDesc"),onSetup:n},{type:"separator"},{type:"menuitem",text:"Advanced sort...",onAction:()=>Ds(e),onSetup:n}];e.ui.registry.addNestedMenuItem("advtablesort",{type:"nestedmenuitem",text:"Sort",getSubmenuItems:v(r)});const s=ts(e);if(1===ze(s)){const o=Me(s)[0];e.ui.registry.addToggleMenuItem("advtablerownumbering",Ss(e,t,"Row numbering",o,"table-row-numbering"))}else $e(s)||e.ui.registry.addNestedMenuItem("advtablerownumbering",{type:"nestedmenuitem",text:"Row numbering",icon:"table-row-numbering",getSubmenuItems:()=>{const o=xs(e,t),n=Ts(e,t,s);return[o].concat(n)}})})(e,r),((e,t)=>{const o=ts(e);if(1===ze(o)){const n=Me(o)[0];e.ui.registry.addToggleButton("advtablerownumbering",{type:"togglebutton",tooltip:"Row numbering",icon:"table-row-numbering",onAction:()=>ys(e,{name:n}),onSetup:Cs(e,t,n)})}else $e(o)||e.ui.registry.addMenuButton("advtablerownumbering",{type:"menubutton",icon:"table-row-numbering",tooltip:"Row numbering",fetch:n=>{const r=xs(e,t),s=Ts(e,t,o);return n([r].concat(s))},onSetup:t.onSetupCellOrRow})})(e,r)),{}}))}(); \ No newline at end of file diff --git a/plugins/advtemplate/plugin.min.js b/plugins/advtemplate/plugin.min.js index c844abc..cdb6eaa 100644 --- a/plugins/advtemplate/plugin.min.js +++ b/plugins/advtemplate/plugin.min.js @@ -1,10 +1,10 @@ /*! - * Tiny Advanced Template plugin + * Tiny Templates plugin * * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * - * Version: 1.4.0-44 + * Version: 7.0.0-22 */ -!function(){"use strict";const e=e=>parseInt(e,10),t=(e,t)=>{const a=e-t;return 0===a?0:a>0?1:-1},a=(e,t,a)=>({major:e,minor:t,patch:a}),n=t=>{const n=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);return n?a(e(n[1]),e(n[2]),e(n[3])):a(0,0,0)},r=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(a=n=e,(r=String).prototype.isPrototypeOf(a)||(null===(o=n.constructor)||void 0===o?void 0:o.name)===r.name)?"string":t;var a,n,r,o})(t)===e,o=e=>t=>typeof t===e,i=r("string"),l=r("object"),s=r("array"),c=o("boolean"),m=(void 0,e=>undefined===e);const d=e=>null==e,p=e=>!d(e),u=o("function"),g=o("number"),y=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},v=()=>{},h=e=>()=>e,f=e=>e,_=e=>e(),b=h(!1),w=h(!0);class x{constructor(e,t){this.tag=e,this.value=t}static some(e){return new x(!0,e)}static none(){return x.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?x.some(e(this.value)):x.none()}bind(e){return this.tag?e(this.value):x.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:x.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return p(e)?x.some(e):x.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}x.singletonNone=new x(!1);const C=Array.prototype.slice,S=Array.prototype.indexOf,A=Array.prototype.push,E=(e,t)=>((e,t)=>S.call(e,t))(e,t)>-1,T=(e,t)=>{const a=e.length,n=new Array(a);for(let r=0;r{for(let a=0,n=e.length;a{for(let a=0,n=e.length;a(e=>{const t=[];for(let a=0,n=e.length;a{for(let a=0,n=e.length;a((e,t)=>0{const t=t=>t(e),a=h(e),n=()=>r,r={tag:!0,inner:e,fold:(t,a)=>a(e),isValue:w,isError:b,map:t=>k.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:a,or:n,getOrThunk:a,orThunk:n,getOrDie:a,each:t=>{t(e)},toOptional:()=>x.some(e)};return r},j=e=>{const t=()=>a,a={tag:!1,inner:e,fold:(t,a)=>t(e),isValue:b,isError:w,map:t,mapError:t=>k.error(t(e)),bind:t,exists:b,forall:w,getOr:f,or:f,getOrThunk:_,orThunk:_,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:v,toOptional:x.none};var n;return a},k={value:N,error:j,fromOption:(e,t)=>e.fold((()=>j(t)),N)},R=Object.keys,B=Object.hasOwnProperty,L=(e,t)=>B.call(e,t),z=e=>i(e)&&e.length>0,U=e=>z(e),V=e=>L(e,"id")&&U(e.id),K=e=>L(e,"title")&&z(e.title),q=e=>L(e,"content")&&z(e.content),F=e=>l(e)&&V(e)&&K(e)&&L(e,"items")&&G(e.items),H=e=>l(e)&&V(e)&&K(e)&&(e=>!L(e,"items")||G(e.items))(e),G=e=>s(e)&&I(e,H),W=e=>L(e,"items")&&J(e.items),Y=e=>l(e)&&K(e)&&((e=>q(e))(e)||W(e)),J=e=>s(e)&&I(e,Y),Q=(e,t)=>a=>e(a)?k.value(a):k.error(t),X=Q((e=>l(e)&&(e=>{for(const t in e)if(B.call(e,t))return!1;return!0})(e)),"response should contain empty object"),Z=Q((e=>l(e)&&V(e)),"response should contain id"),ee=Q((e=>l(e)&&V(e)&&K(e)&&q(e)),"response contains invalid template data"),te=e=>G(e)?(e=>{const t=e=>P(e,(e=>F(e)?[e.id,...t(e.items)]:[e.id])),a=t(e);return a.length===[...new Set(a)].length})(e)?k.value(e):k.error("response contains duplicated ids"):k.error("response contains invalid data"),ae=e=>t=>t.options.get(e),ne=e=>{const t=(t,a)=>{var n,r;n=t,r=(e,t)=>(...n)=>((e,t,a)=>{return l(n=a)&&u(n.then)&&u(n.catch)?a.then((a=>t(a).fold((t=>Promise.reject(new $(`${e} ${t}`))),(e=>Promise.resolve(e))))):Promise.reject(new $(`${e} should return a Promise`));var n})(e,a,t(...n)),e.options.register(n,{processor:e=>u(e)?{valid:!0,value:r(n,e)}:{valid:!1,message:"Must be a function returning promise"},default:()=>Promise.reject(new $(`${n} option is not configured`))})};t("advtemplate_create_category",Z),t("advtemplate_rename_category",X),t("advtemplate_move_category_items",X),t("advtemplate_delete_category",X),t("advtemplate_create_template",Z),t("advtemplate_rename_template",X),t("advtemplate_update_template",X),t("advtemplate_move_template",X),t("advtemplate_get_template",ee),t("advtemplate_delete_template",X),t("advtemplate_delete_all",X),t("advtemplate_list",te),e.options.register("advtemplate_templates",{processor:J})},re=ae("advtemplate_create_category"),oe=ae("advtemplate_rename_category"),ie=ae("advtemplate_move_category_items"),le=ae("advtemplate_delete_category"),se=ae("advtemplate_create_template"),ce=ae("advtemplate_rename_template"),me=ae("advtemplate_move_template"),de=ae("advtemplate_get_template"),pe=ae("advtemplate_delete_template"),ue=ae("advtemplate_list"),ge=ae("advtemplate_templates"),ye=ae("content_style"),ve=ae("body_class"),he=ae("content_css_cors"),fe=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},_e=(e,t)=>{const a=(t||document).createElement(e);return fe(a)},be=fe,we=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount;"undefined"!=typeof window?window:Function("return this;")();const xe=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Ce='data-mce-advtemplate-marker="clipboard"',Se=e=>{const t=((e,t)=>((e,t)=>{const a=void 0===t?document:t.dom;return we(a)?[]:T(a.querySelectorAll(e),be)})(t,e))(be(e.getBody()),`span[${Ce}]`);return 0===t.length?Promise.resolve():(async()=>new Promise(((e,t)=>{var a;u(null===(a=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===a?void 0:a.readText)?navigator.clipboard.readText().then((t=>{e(t)})).catch((e=>{t(e)})):t(new Error("Clipboard API not supported in this browser."))})))().then((a=>{D(t,(t=>{const n=e.dom.createRng();n.setStartAfter(t.dom),n.setEndAfter(t.dom),e.selection.setRng(n),e.insertContent(a)}))})).catch((t=>{e.notificationManager.open({text:e.translate("Failed to read clipboard content"),type:"error",timeout:2e3}),console.error(t)})).finally((()=>{D(t,(e=>{xe(e)}))}))},Ae='data-mce-advtemplate-marker="cursor"',Ee="{{mce-cursor}}",Te=new RegExp(Ee),De=new RegExp("{{mce-clipboard}}","g"),Oe='data-mce-bookmark="1"',Pe=``,Ie=``,Me=async e=>{await Se(e),(e=>{((e,t)=>((e,t)=>{const a=void 0===t?document:t.dom;return we(a)?x.none():x.from(a.querySelector(e)).map(be)})(t,e))(be(e.getBody()),`span[${Ae}]`).each((t=>{const a=e.dom.createRng();a.setStartBefore(t.dom),a.setEndBefore(t.dom),e.selection.setRng(a),e.selection.scrollIntoView(),xe(t)}))})(e)},$e=(e,t)=>de(e)(t).then((t=>{(async(e,t)=>{const a=y(!1),n=((e,t,a)=>{const n=tinymce.html.DomParser(void 0,e.schema);n.addNodeFilter("#text",(e=>t=>{let a,n=!1;for(const e of t){let t=!1;x.from(e.value).each((r=>{let o=r;if(!n){const e=o.match(Te);p(e)&&(o=o.replace(Ee,Pe),n=!0,t=!0)}const i=o.match(De);if(p(i)&&(o=o.replace(De,Ie),t=!0),t){a=null!=a?a:tinymce.html.DomParser();const t=a.parse(o);e.replace(t),t.unwrap()}}))}e.set(p(a))})(a));const r=n.parse(t,{insert:!0});return a.get()?tinymce.html.Serializer({validate:!0},e.schema).serialize(r):t})(e,t,a);e.insertContent(n),a.get()&&await Me(e)})(e,t.content)})),Ne=(e,t)=>e?x.some(t):x.none(),je={text:"Uncategorized",value:""},ke=(e,t)=>{const a=((e,a)=>{const n=[];for(let a=0,o=e.length;a({text:t,value:e})))]},Re=(e,t)=>{return(a=t,n=t=>F(t)&&E(T(t.items,(({id:e})=>e)),e),((e,t,a)=>{for(let n=0,r=e.length;ne.id)).getOr(je.value);var a,n},Be=e=>Ne(e!==je.value,e).getOrUndefined(),Le=(e,t,a)=>e.options.isSet(t)?[a]:[],ze=(e,t,a)=>{const n=e=>{const n=[...Le(a,"advtemplate_rename_category",{type:"menuitem",text:"Rename...",onAction:t.renameCategory(e)}),...Le(a,"advtemplate_move_category_items",{type:"menuitem",text:"Move all items...",enabled:e.items.length>0,onAction:t.moveCategoryItems(e.id)}),...Le(a,"advtemplate_delete_category",{type:"separator"}),...Le(a,"advtemplate_delete_category",{type:"menuitem",icon:"remove",text:"Delete all",onAction:t.deleteCategory(e.id)})];return n.length>0?{menu:{type:"menubutton",icon:"image-options",fetch:e=>e(n)}}:{}},r=e=>{const n=[...Le(a,"advtemplate_rename_template",{type:"menuitem",text:"Rename...",onAction:t.renameTemplate(e)}),...Le(a,"advtemplate_move_template",{type:"menuitem",text:"Move to...",onAction:t.moveTemplate(e.id)}),...Le(a,"advtemplate_delete_template",{type:"separator"}),...Le(a,"advtemplate_delete_template",{type:"menuitem",icon:"remove",text:"Delete",onAction:t.deleteTemplate(e.id)})];return n.length>0?{menu:{type:"menubutton",icon:"image-options",fetch:e=>e(n)}}:{}};return T(e,(e=>F(e)?(e=>({type:"directory",id:e.id,title:e.title,children:ze(e.items,t,a),...n(e)}))(e):(e=>({type:"leaf",id:e.id,title:e.title,...r(e)}))(e)))},Ue=e=>{const t=(e,a)=>((e,a,n)=>(D(e,((e,a)=>{var r,o;r=n,n="directory"===(o=e).type?[o,...t(o.children,r)]:[...r,o]})),n))(e,0,a);return t(e,[])},Ve=e=>t=>{x.from(t.message).bind((e=>(console.error(e),Ne(!(e=>e instanceof $)(t),e)))).or(x.some("Operation failed")).each(e.windowManager.alert)},Ke=(e,t)=>((e,t,a)=>{const n=((e,t)=>{const a=((e,t)=>{const a=e.dom.getAttribute(t);return null===a?void 0:a})(e,t);return void 0===a||""===a?[]:a.split(" ")})(e,t);return((e,t,a)=>{((e,t,a)=>{if(!(i(a)||c(a)||g(a)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",a,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,a+"")})(e.dom,t,a)})(e,t,n.concat([a]).join(" ")),!0})(e,"class",t),qe=(e=>{let t,a=!1;return(...n)=>(a||(a=!0,t=e.apply(null,n)),t)})((()=>{const e=tinymce.Env.os.isMacOS()||tinymce.Env.os.isiOS()?e=>e.metaKey:e=>e.ctrlKey&&!e.altKey;return`