diff --git a/THIRD_PARTY.txt b/THIRD_PARTY.txt
index d9199982..d6d2eb44 100644
--- a/THIRD_PARTY.txt
+++ b/THIRD_PARTY.txt
@@ -1331,32 +1331,32 @@ https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.10.5/skins/ui/oxide/skin.shadow
https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.10.5/themes/mobile/theme.min.js
https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.10.5/themes/silver/theme.min.js
https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.10.5/tinymce.min.js
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/icons/default/icons.min.js
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/models/dom/model.min.js
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/content/dark/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/content/default/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/content/document/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/content/tinymce-5/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/content/tinymce-5-dark/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/content/writer/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide/content.inline.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide-dark/content.inline.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide-dark/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide-dark/skin.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide-dark/skin.shadowdom.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide/skin.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/oxide/skin.shadowdom.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5/content.inline.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5-dark/content.inline.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5-dark/content.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5-dark/skin.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5-dark/skin.shadowdom.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5/skin.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/skins/ui/tinymce-5/skin.shadowdom.min.css
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/themes/silver/theme.min.js
-https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.1/tinymce.min.js
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/icons/default/icons.min.js
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/models/dom/model.min.js
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/content/dark/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/content/default/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/content/document/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/content/tinymce-5/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/content/tinymce-5-dark/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/content/writer/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide/content.inline.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide-dark/content.inline.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide-dark/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide-dark/skin.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide-dark/skin.shadowdom.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide/skin.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/oxide/skin.shadowdom.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5/content.inline.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5-dark/content.inline.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5-dark/content.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5-dark/skin.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5-dark/skin.shadowdom.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5/skin.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/skins/ui/tinymce-5/skin.shadowdom.min.css
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/themes/silver/theme.min.js
+https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/tinymce.min.js
https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css
https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js
https://cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.min.js
diff --git a/modules/internal/targets.js b/modules/internal/targets.js
index 332e785a..2a013d8e 100644
--- a/modules/internal/targets.js
+++ b/modules/internal/targets.js
@@ -449,7 +449,7 @@ targets.setLastVersion = function (type, version) {
if (type.startsWith('/tether/1.')) return '1.4.7';
if (type.startsWith('/tinymce/5.')) return '5.10.5';
if (type.startsWith('/tinymce/6.')) return '7.0.1';
- if (type.startsWith('/tinymce/7.')) return '7.1.1';
+ if (type.startsWith('/tinymce/7.')) return '7.1.2';
if (type.startsWith('/tooltipster/3.')) return '3.3.0';
if (type.startsWith('/tooltipster/4.')) return '4.2.8';
if (type.startsWith('/toastr.js/2.') || type.startsWith('/toastr.js/latest/')) return '2.1.4';
diff --git a/pages/updates/updates.html b/pages/updates/updates.html
index 6f51c708..11f8a464 100644
--- a/pages/updates/updates.html
+++ b/pages/updates/updates.html
@@ -48,6 +48,7 @@
diff --git a/resources/tinymce/7.1.1/themes/silver/theme.min.jsm b/resources/tinymce/7.1.1/themes/silver/theme.min.jsm
deleted file mode 100644
index 75cc2727..00000000
--- a/resources/tinymce/7.1.1/themes/silver/theme.min.jsm
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * TinyMCE version 7.1.1 (2024-05-22)
- */
-!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,((t,o)=>e(t)===o)))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o
{},v=e=>()=>e(),y=(e,t)=>(...o)=>e(t.apply(null,o)),x=e=>()=>e,w=e=>e,S=(e,t)=>e===t;function k(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const C=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=x(!1),E=x(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.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:A.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 g(e)?A.some(e):A.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()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,D=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>D.call(e,t),F=(e,t)=>I(e,t)>-1,R=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let s=0;s{for(let o=0,n=e.length;o{const o=[],n=[];for(let s=0,r=e.length;s{const o=[];for(let n=0,s=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),W=(e,t,o)=>(V(e,((e,n)=>{o=t(o,e,n)})),o),j=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oG(z(e,t)),Y=(e,t)=>{for(let o=0,n=e.length;o{const t=M.call(e,0);return t.reverse(),t},K=(e,t)=>P(e,(e=>!F(t,e))),J=(e,t)=>{const o={};for(let n=0,s=e.length;n[e],Q=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&tee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>M.call(e),se=(e,t)=>{for(let o=0;o{const o=re(e);for(let n=0,s=o.length;nce(e,((e,o)=>({k:o,v:t(e,o)}))),ce=(e,t)=>{const o={};return ie(e,((e,n)=>{const s=t(e,n);o[s.k]=s.v})),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ie(e,((e,s)=>{(t(e,s)?o:n)(e,s)}))},me=(e,t)=>{const o={};return ue(e,t,de(o),b),o},ge=(e,t)=>{const o=[];return ie(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=re(e);for(let n=0,s=o.length;nge(e,w),fe=(e,t)=>be(e,t)?A.from(e[t]):A.none(),be=(e,t)=>ae.call(e,t),ve=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],ye=(e,t,o=S)=>e.exists((e=>o(e,t))),xe=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te.isSome()&&t.isSome()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),Se=(e,t)=>null!=e?A.some(t(e)):A.none(),ke=(e,t)=>e?A.some(t):A.none(),Ce=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Oe=(e,t)=>Te(e,t)?((e,t)=>e.substring(t))(e,t.length):e,_e=(e,t,o=0,n)=>{const s=e.indexOf(t,o);return-1!==s&&(!!u(n)||s+t.length<=n)},Te=(e,t)=>Ce(e,t,0),Ee=(e,t)=>Ce(e,t,e.length-t.length),Ae=(Mo=/^\s+|\s+$/g,e=>e.replace(Mo,"")),Me=e=>e.length>0,De=e=>!Me(e),Be=e=>void 0!==e.style&&p(e.style.getPropertyValue),Ie=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Fe=(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 Ie(o.childNodes[0])},Re=(e,t)=>{const o=(t||document).createElement(e);return Ie(o)},Ne=(e,t)=>{const o=(t||document).createTextNode(e);return Ie(o)},Le=Ie,ze="undefined"!=typeof window?window:Function("return this;")(),Ve=(e,t)=>((e,t)=>{let o=null!=t?t:ze;for(let t=0;t{const t=Ve("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const o=((e,t)=>Ve(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(He(e).constructor.name))},Ue=e=>e.dom.nodeName.toLowerCase(),We=e=>t=>(e=>e.dom.nodeType)(t)===e,je=e=>$e(e)&&Pe(e.dom),$e=We(1),Ge=We(3),qe=We(9),Ye=We(11),Xe=e=>t=>$e(t)&&Ue(t)===e,Ke=(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")}},Je=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ze=(e,t)=>{const o=void 0===t?document:t.dom;return Je(o)?A.none():A.from(o.querySelector(e)).map(Le)},Qe=(e,t)=>e.dom===t.dom,et=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},tt=e=>Le(e.dom.ownerDocument),ot=e=>qe(e)?e:tt(e),nt=e=>Le(ot(e).dom.documentElement),st=e=>Le(ot(e).dom.defaultView),rt=e=>A.from(e.dom.parentNode).map(Le),at=e=>A.from(e.dom.parentElement).map(Le),it=e=>A.from(e.dom.offsetParent).map(Le),lt=e=>z(e.dom.childNodes,Le),ct=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(Le)},dt=e=>ct(e,0),ut=(e,t)=>({element:e,offset:t}),mt=(e,t)=>{const o=lt(e);return o.length>0&&tYe(e)&&g(e.dom.host),pt=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),ht=x(pt),ft=pt?e=>Le(e.dom.getRootNode()):ot,bt=e=>gt(e)?e:Le(ot(e).dom.body),vt=e=>{const t=ft(e);return gt(t)?A.some(t):A.none()},yt=e=>Le(e.dom.host),xt=e=>{const t=Ge(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return vt(Le(t)).fold((()=>o.body.contains(t)),(n=xt,s=yt,e=>n(s(e))));var n,s},wt=()=>St(Le(document)),St=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Le(t)},kt=(e,t,o)=>{if(!(r(o)||d(o)||h(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+"")},Ct=(e,t,o)=>{kt(e.dom,t,o)},Ot=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{kt(o,t,e)}))},_t=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Tt=(e,t)=>A.from(_t(e,t)),Et=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},At=(e,t)=>{e.dom.removeAttribute(t)},Mt=(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);Be(e)&&e.style.setProperty(t,o)},Dt=(e,t)=>{Be(e)&&e.style.removeProperty(t)},Bt=(e,t,o)=>{const n=e.dom;Mt(n,t,o)},It=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{Mt(o,t,e)}))},Ft=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{e.fold((()=>{Dt(o,t)}),(e=>{Mt(o,t,e)}))}))},Rt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||xt(e)?n:Nt(o,t)},Nt=(e,t)=>Be(e)?e.style.getPropertyValue(t):"",Lt=(e,t)=>{const o=e.dom,n=Nt(o,t);return A.from(n).filter((e=>e.length>0))},zt=e=>{const t={},o=e.dom;if(Be(o))for(let e=0;e{const n=Re(e);return Bt(n,t,o),Lt(n,t).isSome()},Ht=(e,t)=>{const o=e.dom;Dt(o,t),ye(Tt(e,"style").map(Ae),"")&&At(e,"style")},Pt=e=>e.dom.offsetWidth,Ut=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Rt(o,e);return parseFloat(t)||0}return n},n=(e,t)=>W(t,((t,o)=>{const n=Rt(e,o),s=void 0===n?0:parseInt(n,10);return isNaN(s)?t:t+s}),0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Be(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const s=n(e,o);return t>s?t-s:0}}},Wt=Ut("height",(e=>{const t=e.dom;return xt(e)?t.getBoundingClientRect().height:t.offsetHeight})),jt=e=>Wt.get(e),$t=e=>Wt.getOuter(e),Gt=(e,t)=>({left:e,top:t,translate:(o,n)=>Gt(e+o,t+n)}),qt=Gt,Yt=(e,t)=>void 0!==e?e:void 0!==t?t:0,Xt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return qt(o.offsetLeft,o.offsetTop);const r=Yt(null==n?void 0:n.pageYOffset,s.scrollTop),a=Yt(null==n?void 0:n.pageXOffset,s.scrollLeft),i=Yt(s.clientTop,o.clientTop),l=Yt(s.clientLeft,o.clientLeft);return Kt(e).translate(a-l,r-i)},Kt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?qt(o.offsetLeft,o.offsetTop):xt(e)?(e=>{const t=e.getBoundingClientRect();return qt(t.left,t.top)})(t):qt(0,0)},Jt=Ut("width",(e=>e.dom.offsetWidth)),Zt=e=>Jt.get(e),Qt=e=>Jt.getOuter(e),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},so=(e,t)=>{const o=String(t).toLowerCase();return j(e,(e=>e.search(o)))},ro=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ao=e=>t=>_e(t,e),io=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>_e(e,"edge/")&&_e(e,"chrome")&&_e(e,"safari")&&_e(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ro],search:e=>_e(e,"chrome")&&!_e(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>_e(e,"msie")||_e(e,"trident")},{name:"Opera",versionRegexes:[ro,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ao("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ao("firefox")},{name:"Safari",versionRegexes:[ro,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(_e(e,"safari")||_e(e,"mobile/"))&&_e(e,"applewebkit")}],lo=[{name:"Windows",search:ao("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>_e(e,"iphone")||_e(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ao("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:ao("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ao("linux"),versionRegexes:[]},{name:"Solaris",search:ao("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ao("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:ao("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],co={browsers:x(io),oses:x(lo)},uo="Edge",mo="Chromium",go="Opera",po="Firefox",ho="Safari",fo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(uo),isChromium:n(mo),isIE:n("IE"),isOpera:n(go),isFirefox:n(po),isSafari:n(ho)}},bo=()=>fo({current:void 0,version:no.unknown()}),vo=fo,yo=(x(uo),x(mo),x("IE"),x(go),x(po),x(ho),"Windows"),xo="Android",wo="Linux",So="macOS",ko="Solaris",Co="FreeBSD",Oo="ChromeOS",_o=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(yo),isiOS:n("iOS"),isAndroid:n(xo),isMacOS:n(So),isLinux:n(wo),isSolaris:n(ko),isFreeBSD:n(Co),isChromeOS:n(Oo)}},To=()=>_o({current:void 0,version:no.unknown()}),Eo=_o,Ao=(x(yo),x("iOS"),x(xo),x(wo),x(So),x(ko),x(Co),x(Oo),e=>window.matchMedia(e).matches);var Mo;let Do=eo((()=>((e,t,o)=>{const n=co.browsers(),s=co.oses(),r=t.bind((e=>((e,t)=>se(t.brands,(t=>{const o=t.brand.toLowerCase();return j(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)=>so(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(bo,vo),a=((e,t)=>so(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(s,e).fold(To,Eo),i=((e,t,o,n)=>{const s=e.isiOS()&&!0===/ipad/i.test(o),r=e.isiOS()&&!s,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=s||!r&&a&&n("(min-device-width:768px)"),c=r||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:x(s),isiPhone:x(r),isTablet:x(l),isPhone:x(c),isTouch:x(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:x(d),isDesktop:x(u)}})(a,r,e,o);return{browser:r,os:a,deviceType:i}})(navigator.userAgent,A.from(navigator.userAgentData),Ao)));const Bo=()=>Do(),Io=e=>{const t=Le((e=>{if(ht()&&g(e.target)){const t=Le(e.target);if($e(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return te(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=y(n,o);return((e,t,o,n,s,r,a)=>({target:e,x:t,y:o,stop:n,prevent:s,kill:r,raw:a}))(t,e.clientX,e.clientY,o,n,s,e)},Fo=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(Io(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:k(Ro,e,t,r,s)}},Ro=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},No=(e,t)=>{rt(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Lo=(e,t)=>{const o=(e=>A.from(e.dom.nextSibling).map(Le))(e);o.fold((()=>{rt(e).each((e=>{Vo(e,t)}))}),(e=>{No(e,t)}))},zo=(e,t)=>{dt(e).fold((()=>{Vo(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Vo=(e,t)=>{e.dom.appendChild(t.dom)},Ho=(e,t)=>{V(t,(t=>{Vo(e,t)}))},Po=e=>{e.dom.textContent="",V(lt(e),(e=>{Uo(e)}))},Uo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Wo=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return qt(o,n)},jo=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},$o=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Go=e=>{const t=void 0===e?window:e,o=t.document,n=Wo(Le(o));return(e=>{const t=void 0===e?window:e;return Bo().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return $o(n.left,n.top,o,s)}),(e=>$o(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},qo=()=>Le(document),Yo=(e,t)=>e.view(t).fold(x([]),(t=>{const o=e.owner(t),n=Yo(e,o);return[t].concat(n)}));var Xo=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?A.none():A.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Le)},owner:e=>tt(e)});const Ko=e=>{const t=qo(),o=Wo(t),n=((e,t)=>{const o=t.owner(e),n=Yo(t,o);return A.some(n)})(e,Xo);return n.fold(k(Xt,e),(t=>{const n=Kt(e),s=U(t,((e,t)=>{const o=Kt(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return qt(s.left+n.left+o.left,s.top+n.top+o.top)}))},Jo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Zo=e=>{const t=Xt(e),o=Qt(e),n=$t(e);return Jo(t.left,t.top,o,n)},Qo=e=>{const t=Ko(e),o=Qt(e),n=$t(e);return Jo(t.left,t.top,o,n)},en=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),s=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return Jo(o,n,s-o,r-n)},tn=()=>Go(window),on=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},nn=e=>{const t=on(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},sn=()=>nn((e=>e.unbind())),rn=()=>{const e=nn(b);return{...e,on:t=>e.get().each(t)}};var an=tinymce.util.Tools.resolve("tinymce.ThemeManager");const ln=e=>{const t=t=>t(e),o=x(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>dn.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:()=>A.some(e)};return s},cn=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>dn.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:O(String(e)),each:b,toOptional:A.none};return o},dn={value:ln,error:cn,fromOption:(e,t)=>e.fold((()=>cn(t)),ln)};var un;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(un||(un={}));const mn=(e,t,o)=>e.stype===un.Error?t(e.serror):o(e.svalue),gn=e=>({stype:un.Value,svalue:e}),pn=e=>({stype:un.Error,serror:e}),hn=gn,fn=pn,bn=mn,vn=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),yn=(e,t,o)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return o(e.newKey,e.instantiator)}},xn=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;ni(e)&&i(t)?wn(e,t):t)),Sn=xn(((e,t)=>t)),kn=e=>({tag:"defaultedThunk",process:e}),Cn=e=>kn(x(e)),On=e=>({tag:"mergeWithThunk",process:e}),_n=e=>{const t=(e=>{const t=[],o=[];return V(e,(e=>{mn(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,y(fn,G)(o)):hn(t.values);var o},Tn=e=>a(e)&&re(e).length>100?" removed due to size":JSON.stringify(e,null,2),En=(e,t)=>fn([{path:e,getErrorInfo:t}]),An=e=>({extract:(t,o)=>((e,t)=>e.stype===un.Error?t(e.serror):e)(e(o),(e=>((e,t)=>En(e,x(t)))(t,e))),toString:x("val")}),Mn=An(hn),Dn=(e,t,o,n)=>n(fe(e,t).getOrThunk((()=>o(e)))),Bn=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold((()=>hn(A.none())),(e=>((e,t)=>e.stype===un.Value?{stype:un.Value,svalue:t(e.svalue)}:e)(s.extract(t.concat([n]),e),A.some)));switch(e.tag){case"required":return((e,t,o,n)=>fe(t,o).fold((()=>((e,t,o)=>En(e,(()=>'Could not find valid *required* value for "'+t+'" in '+Tn(o))))(e,o,t)),n))(t,o,n,r);case"defaultedThunk":return Dn(o,n,e.process,r);case"option":return((e,t,o)=>o(fe(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(fe(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return Dn(o,n,x({}),(t=>{const n=wn(e.process(o),t);return r(n)}))}},In=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),Fn=e=>re(me(e,g)),Rn=e=>{const t=Nn(e),o=U(e,((e,t)=>yn(t,(t=>wn(e,{[t]:!0})),x(e))),{});return{extract:(e,n)=>{const s=d(n)?[]:Fn(n),r=P(s,(e=>!ve(o,e)));return 0===r.length?t.extract(e,n):((e,t)=>En(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,r)},toString:t.toString}},Nn=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)yn(r,((o,r,a,i)=>{const l=Bn(a,e,t,o,i);bn(l,(e=>{s.push(...e)}),(e=>{n[r]=e}))}),((e,o)=>{n[e]=o(t)}));return s.length>0?fn(s):hn(n)})(t,o,e),toString:()=>{const t=z(e,(e=>yn(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),Ln=e=>({extract:(t,o)=>{const n=z(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return _n(n)},toString:()=>"array("+e.toString()+")"}),zn=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const s=[];for(const r of e){const e=r.extract(t,n);if(e.stype===un.Value)return{stype:un.Value,svalue:o(e.svalue)};s.push(e)}return _n(s)},toString:()=>"oneOf("+z(e,(e=>e.toString())).join(", ")+")"}},Vn=(e,t)=>({extract:(o,n)=>{const s=re(n),r=((t,o)=>Ln(An(e)).extract(t,o))(o,s);return((e,t)=>e.stype===un.Value?t(e.svalue):e)(r,(e=>{const s=z(e,(e=>vn(e,e,{tag:"required",process:{}},t)));return Nn(s).extract(o,n)}))},toString:()=>"setOf("+t.toString()+")"}),Hn=y(Ln,Nn),Pn=x(Mn),Un=(e,t)=>An((o=>{const n=typeof o;return e(o)?hn(o):fn(`Expected type: ${t} but got: ${n}`)})),Wn=Un(h,"number"),jn=Un(r,"string"),$n=Un(d,"boolean"),Gn=Un(p,"function"),qn=e=>{if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every((t=>qn(e[t])));default:return!1}},Yn=An((e=>qn(e)?hn(e):fn("Expected value to be acceptable for sending via postMessage"))),Xn=(e,t)=>({extract:(o,n)=>fe(n,e).fold((()=>((e,t)=>En(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>((e,t,o,n)=>fe(o,n).fold((()=>((e,t,o)=>En(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+Tn(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))))(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+re(t)}),Kn=e=>An((t=>e(t).fold(fn,hn))),Jn=(e,t)=>Vn((t=>e(t).fold(pn,gn)),t),Zn=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===un.Error?{stype:un.Error,serror:t(e.serror)}:e)(t.extract([e],o),(e=>({input:o,errors:e}))))(e,t,o),mn(n,dn.error,dn.value);var n},Qn=e=>e.fold((e=>{throw new Error(ts(e))}),w),es=(e,t,o)=>Qn(Zn(e,t,o)),ts=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:x("... (only showing first ten failures)")}]):e;return z(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+Tn(e.input),os=(e,t)=>Xn(e,le(t,Nn)),ns=(e,t)=>((e,t)=>{const o=eo(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),ss=vn,rs=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),as=e=>Kn((t=>F(e,t)?dn.value(t):dn.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`))),is=e=>ss(e,e,{tag:"required",process:{}},Pn()),ls=(e,t)=>ss(e,e,{tag:"required",process:{}},t),cs=e=>ls(e,Wn),ds=e=>ls(e,jn),us=(e,t)=>ss(e,e,{tag:"required",process:{}},as(t)),ms=e=>ls(e,Gn),gs=(e,t)=>ss(e,e,{tag:"required",process:{}},Nn(t)),ps=(e,t)=>ss(e,e,{tag:"required",process:{}},Hn(t)),hs=(e,t)=>ss(e,e,{tag:"required",process:{}},Ln(t)),fs=e=>ss(e,e,{tag:"option",process:{}},Pn()),bs=(e,t)=>ss(e,e,{tag:"option",process:{}},t),vs=e=>bs(e,Wn),ys=e=>bs(e,jn),xs=(e,t)=>bs(e,as(t)),ws=e=>bs(e,Gn),Ss=(e,t)=>bs(e,Ln(t)),ks=(e,t)=>bs(e,Nn(t)),Cs=(e,t)=>ss(e,e,Cn(t),Pn()),Os=(e,t,o)=>ss(e,e,Cn(t),o),_s=(e,t)=>Os(e,t,Wn),Ts=(e,t)=>Os(e,t,jn),Es=(e,t,o)=>Os(e,t,as(o)),As=(e,t)=>Os(e,t,$n),Ms=(e,t)=>Os(e,t,Gn),Ds=(e,t,o)=>Os(e,t,Ln(o)),Bs=(e,t,o)=>Os(e,t,Nn(o)),Is=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 V(e,((n,s)=>{const r=re(n);if(1!==r.length)throw new Error("one and only one name per case");const a=r[0],i=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(i))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), 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[s].apply(null,o)},match:e=>{const n=re(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!Y(t,(e=>F(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};Is([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Fs=(e,t)=>((e,t)=>({[e]:t}))(e,t),Rs=e=>(e=>{const t={};return V(e,(e=>{t[e.key]=e.value})),t})(e),Ns=e=>p(e)?e:T,Ls=(e,t,o)=>{let n=e.dom;const s=Ns(o);for(;n.parentNode;){n=n.parentNode;const e=Le(n),o=t(e);if(o.isSome())return o;if(s(e))break}return A.none()},zs=(e,t,o)=>{const n=t(e),s=Ns(o);return n.orThunk((()=>s(e)?A.none():Ls(e,t,s)))},Vs=(e,t)=>Qe(e.element,t.event.target),Hs={can:E,abort:T,run:b},Ps=e=>{if(!ve(e,"can")&&!ve(e,"abort")&&!ve(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...Hs,...e}},Us=x,Ws=Us("touchstart"),js=Us("touchmove"),$s=Us("touchend"),Gs=Us("touchcancel"),qs=Us("mousedown"),Ys=Us("mousemove"),Xs=Us("mouseout"),Ks=Us("mouseup"),Js=Us("mouseover"),Zs=Us("focusin"),Qs=Us("focusout"),er=Us("keydown"),tr=Us("keyup"),or=Us("input"),nr=Us("change"),sr=Us("click"),rr=Us("transitioncancel"),ar=Us("transitionend"),ir=Us("transitionstart"),lr=Us("selectstart"),cr=e=>x("alloy."+e),dr={tap:cr("tap")},ur=cr("focus"),mr=cr("blur.post"),gr=cr("paste.post"),pr=cr("receive"),hr=cr("execute"),fr=cr("focus.item"),br=dr.tap,vr=cr("longpress"),yr=cr("sandbox.close"),xr=cr("typeahead.cancel"),wr=cr("system.init"),Sr=cr("system.touchmove"),kr=cr("system.touchend"),Cr=cr("system.scroll"),Or=cr("system.resize"),_r=cr("system.attached"),Tr=cr("system.detached"),Er=cr("system.dismissRequested"),Ar=cr("system.repositionRequested"),Mr=cr("focusmanager.shifted"),Dr=cr("slotcontainer.visibility"),Br=cr("system.external.element.scroll"),Ir=cr("change.tab"),Fr=cr("dismiss.tab"),Rr=cr("highlight"),Nr=cr("dehighlight"),Lr=(e,t)=>{Pr(e,e.element,t,{})},zr=(e,t,o)=>{Pr(e,e.element,t,o)},Vr=e=>{Lr(e,hr())},Hr=(e,t,o)=>{Pr(e,t,o,{})},Pr=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Ur=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Wr=e=>Rs(e),jr=(e,t)=>({key:e,value:Ps({abort:t})}),$r=e=>({key:e,value:Ps({run:(e,t)=>{t.event.prevent()}})}),Gr=(e,t)=>({key:e,value:Ps({run:t})}),qr=(e,t,o)=>({key:e,value:Ps({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),Yr=e=>t=>({key:e,value:Ps({run:(e,o)=>{Vs(e,o)&&t(e,o)}})}),Xr=(e,t,o)=>((e,t)=>Gr(e,((o,n)=>{o.getSystem().getByUid(t).each((t=>{Ur(t,t.element,e,n)}))})))(e,t.partUids[o]),Kr=(e,t)=>Gr(e,((e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk((()=>zs(n.target,(t=>e.getSystem().getByDom(t).toOptional()),T).getOr(e)));t(e,s,o)})),Jr=e=>Gr(e,((e,t)=>{t.cut()})),Zr=e=>Gr(e,((e,t)=>{t.stop()})),Qr=(e,t)=>Yr(e)(t),ea=Yr(_r()),ta=Yr(Tr()),oa=Yr(wr()),na=(ti=hr(),e=>Gr(ti,e)),sa=e=>z(e,(e=>Ee(e,"/*")?e.substring(0,e.length-2):e)),ra=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:sa(r)}),e},aa=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),ia=(e,t,o)=>oa(((n,s)=>{o(n,e,t)})),la=e=>({key:e,value:void 0}),ca=(e,t,o,n,s,r,a)=>{const i=e=>ve(e,o)?e[o]():A.none(),l=le(s,((e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),s=n.indexOf(")")+1,r=n.indexOf("("),a=n.substring(r+1,s-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:sa(a.slice(0,1).concat(a.slice(3)))}),e})(((n,...s)=>{const r=[n].concat(s);return n.config({name:x(e)}).fold((()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)}),(e=>{const o=Array.prototype.slice.call(r,1);return t.apply(void 0,[n,e.config,e.state].concat(o))}))}),o,t))(o,e,t))),c={...le(r,((e,t)=>ra(e,t))),...l,revoke:k(la,o),config:t=>{const n=es(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:eo((()=>es(o+"-config",e,t))),initialConfig:t,state:a}}},schema:x(t),exhibit:(e,t)=>we(i(e),fe(n,"exhibit"),((e,o)=>o(t,e.config,e.state))).getOrThunk((()=>aa({}))),name:x(o),handlers:e=>i(e).map((e=>fe(n,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return c},da={init:()=>ua({readState:x("No State required")})},ua=e=>e,ma=e=>Rs(e),ga=Rn([is("fields"),is("name"),Cs("active",{}),Cs("apis",{}),Cs("state",da),Cs("extra",{})]),pa=e=>{const t=es("Creating behaviour: "+e.name,ga,e);return((e,t,o,n,s,r)=>{const a=Rn(e),i=ks(t,[("config",l=e,bs("config",Rn(l)))]);var l;return ca(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},ha=Rn([is("branchKey"),is("branches"),is("name"),Cs("active",{}),Cs("apis",{}),Cs("state",da),Cs("extra",{})]),fa=e=>{const t=es("Creating behaviour: "+e.name,ha,e);return((e,t,o,n,s,r)=>{const a=e,i=ks(t,[bs("config",e)]);return ca(a,i,t,o,n,s,r)})(os(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},ba=x(void 0),va=(e,t)=>{const o=_t(e,t);return void 0===o||""===o?[]:o.split(" ")},ya=e=>void 0!==e.dom.classList,xa=e=>va(e,"class"),wa=(e,t)=>((e,t,o)=>{const n=va(e,t).concat([o]);return Ct(e,t,n.join(" ")),!0})(e,"class",t),Sa=(e,t)=>((e,t,o)=>{const n=P(va(e,t),(e=>e!==o));return n.length>0?Ct(e,t,n.join(" ")):At(e,t),!1})(e,"class",t),ka=(e,t)=>{ya(e)?e.dom.classList.add(t):wa(e,t)},Ca=e=>{0===(ya(e)?e.dom.classList:xa(e)).length&&At(e,"class")},Oa=(e,t)=>{ya(e)?e.dom.classList.remove(t):Sa(e,t),Ca(e)},_a=(e,t)=>ya(e)&&e.dom.classList.contains(t),Ta=(e,t)=>{V(t,(t=>{ka(e,t)}))},Ea=(e,t)=>{V(t,(t=>{Oa(e,t)}))},Aa=e=>ya(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;e{const r=e=>e+"px";return{position:e,left:t.map(r),top:o.map(r),right:n.map(r),bottom:s.map(r)}},Da=(e,t)=>{Ft(e,(e=>({...e,position:A.some(e.position)}))(t))},Ba=e=>(ye(Lt(e,"position"),"fixed")?A.none():it(e)).orThunk((()=>{const t=Re("span");return rt(e).bind((e=>{Vo(e,t);const o=it(t);return Uo(t),o}))})),Ia=e=>Ba(e).map(Xt).getOrThunk((()=>qt(0,0))),Fa=(e,t)=>{const o=e.element;ka(o,t.transitionClass),Oa(o,t.fadeOutClass),ka(o,t.fadeInClass),t.onShow(e)},Ra=(e,t)=>{const o=e.element;ka(o,t.transitionClass),Oa(o,t.fadeInClass),ka(o,t.fadeOutClass),t.onHide(e)},Na=(e,t)=>e.y>=t.y,La=(e,t)=>e.bottom<=t.bottom,za=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),Va=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),Ha=e=>e.box.x-e.win.x,Pa=(e,t,o)=>o.getInitialPos().map((o=>{const n=((e,t)=>{const o=t.optScrollEnv.fold(x(e.bounds.y),(t=>t.scrollElmTop+(e.bounds.y-t.currentScrollTop)));return qt(e.bounds.x,o)})(o,t);return{box:Jo(n.left,n.top,Zt(e),jt(e)),location:o.location}})),Ua=(e,t,o,n,s)=>{const r=((e,t)=>{const o=t.optScrollEnv.fold(x(e.y),(t=>e.y+t.currentScrollTop-t.scrollElmTop));return qt(e.x,o)})(t,o),a=Jo(r.left,r.top,t.width,t.height);n.setInitialPos({style:zt(e),position:Rt(e,"position")||"static",bounds:a,location:s.location})},Wa=(e,t,o)=>o.getInitialPos().bind((n=>{var s;switch(o.clearInitialPos(),n.position){case"static":return A.some({morph:"static"});case"absolute":const o=Ba(e).getOr(wt()),r=Zo(o),a=null!==(s=o.dom.scrollTop)&&void 0!==s?s:0;return A.some({morph:"absolute",positionCss:Ma("absolute",fe(n.style,"left").map((e=>t.x-r.x)),fe(n.style,"top").map((e=>t.y-r.y+a)),fe(n.style,"right").map((e=>r.right-t.right)),fe(n.style,"bottom").map((e=>r.bottom-t.bottom)))});default:return A.none()}})),ja=e=>{switch(e.location){case"top":return A.some({morph:"fixed",positionCss:Ma("fixed",A.some(e.leftX),A.some(e.topY),A.none(),A.none())});case"bottom":return A.some({morph:"fixed",positionCss:Ma("fixed",A.some(e.leftX),A.none(),A.none(),A.some(e.bottomY))});default:return A.none()}},$a=(e,t,o)=>{const n=e.element;return ye(Lt(n,"position"),"fixed")?((e,t,o)=>((e,t,o)=>Pa(e,t,o).filter((({box:e})=>((e,t,o)=>Y(e,(e=>{switch(e){case"bottom":return La(t,o.bounds);case"top":return Na(t,o.bounds)}})))(o.getModes(),e,t))).bind((({box:t})=>Wa(e,t,o))))(e,t,o).orThunk((()=>t.optScrollEnv.bind((n=>Pa(e,t,o))).bind((({box:e,location:o})=>{const n=tn(),s=Ha({win:n,box:e}),r="top"===o?za(n,s,t):Va(n,s,t);return ja(r)})))))(n,t,o):((e,t,o)=>{const n=Zo(e),s=tn(),r=((e,t,o)=>{const n=t.win,s=t.box,r=Ha(t);return se(e,(e=>{switch(e){case"bottom":return La(s,o.bounds)?A.none():A.some(Va(n,r,o));case"top":return Na(s,o.bounds)?A.none():A.some(za(n,r,o));default:return A.none()}})).getOr({location:"no-dock"})})(o.getModes(),{win:s,box:n},t);return"top"===r.location||"bottom"===r.location?(Ua(e,n,t,o,r),ja(r)):A.none()})(n,t,o)},Ga=(e,t,o)=>{o.setDocked(!1),V(["left","right","top","bottom","position"],(t=>Ht(e.element,t))),t.onUndocked(e)},qa=(e,t,o,n)=>{const s="fixed"===n.position;o.setDocked(s),Da(e.element,n),(s?t.onDocked:t.onUndocked)(e)},Ya=(e,t,o,n,s=!1)=>{t.contextual.each((t=>{t.lazyContext(e).each((r=>{const a=((e,t)=>e.yt.y)(r,n.bounds);a!==o.isVisible()&&(o.setVisible(a),s&&!a?(Ta(e.element,[t.fadeOutClass]),t.onHide(e)):(a?Fa:Ra)(e,t))}))}))},Xa=(e,t,o,n,s)=>{Ya(e,t,o,n,!0),qa(e,t,o,s.positionCss)},Ka=(e,t,o)=>{e.getSystem().isConnected()&&((e,t,o)=>{const n=t.lazyViewport(e);Ya(e,t,o,n),$a(e,n,o).each((s=>{((e,t,o,n,s)=>{switch(s.morph){case"static":return Ga(e,t,o);case"absolute":return qa(e,t,o,s.positionCss);case"fixed":Xa(e,t,o,n,s)}})(e,t,o,n,s)}))})(e,t,o)},Ja=(e,t,o)=>{o.isDocked()&&((e,t,o)=>{const n=e.element;o.setDocked(!1);const s=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return Pa(n,t,o).bind((({box:e})=>Wa(n,e,o)))})(e,s,o).each((n=>{switch(n.morph){case"static":Ga(e,t,o);break;case"absolute":qa(e,t,o,n.positionCss)}})),o.setVisible(!0),t.contextual.each((t=>{Ea(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)})),Ka(e,t,o)})(e,t,o)},Za=e=>(t,o,n)=>{const s=o.lazyViewport(t);((e,t,o,n)=>{const s=Zo(e),r=tn(),a=n(r,Ha({win:r,box:s}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,s)=>{n.getInitialPos().fold((()=>Ua(e,t,o,n,s)),(()=>b))})(e,s,t,o,a),ja(a)):A.none()})(t.element,s,n,e).each((e=>{Xa(t,o,n,s,e)}))},Qa=Za(za),ei=Za(Va);var ti,oi=Object.freeze({__proto__:null,refresh:Ka,reset:Ja,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:Qa,forceDockToBottom:ei}),ni=Object.freeze({__proto__:null,events:(e,t)=>Wr([Qr(ar(),((o,n)=>{e.contextual.each((e=>{_a(o.element,e.transitionClass)&&(Ea(o.element,[e.transitionClass,e.fadeInClass]),(t.isVisible()?e.onShown:e.onHidden)(o)),n.stop()}))})),Gr(Cr(),((o,n)=>{Ka(o,e,t)})),Gr(Br(),((o,n)=>{Ka(o,e,t)})),Gr(Or(),((o,n)=>{Ja(o,e,t)}))])});const si=e=>e.dom.innerHTML,ri=(e,t)=>{const o=tt(e).dom,n=Le(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,lt(Le(o))})(t,o);Ho(n,s),Po(e),Vo(e,n)},ai=(e,t)=>Le(e.dom.cloneNode(t)),ii=e=>(e=>{if(gt(e))return"#shadow-root";{const t=(e=>ai(e,!1))(e);return(e=>{const t=Re("div"),o=Le(e.dom.cloneNode(!0));return Vo(t,o),si(t)})(t)}})(e);var li;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(li||(li={}));const ci=on({}),di=["alloy/data/Fields","alloy/debugging/Debugging"],ui=(e,t,o)=>((e,t,o)=>{switch(fe(ci.get(),e).orThunk((()=>{const t=re(ci.get());return se(t,(t=>e.indexOf(t)>-1?A.some(ci.get()[t]):A.none()))})).getOr(li.NORMAL)){case li.NORMAL:return o(mi());case li.LOGGING:{const n=((e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const s=(new Date).getTime();F(["mousemove","mouseover","mouseout",wr()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:z(o,(e=>F(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ii(e.target)+")":e.outcome))})}}})(e,t),s=o(n);return n.write(),s}case li.STOP:return!0}})(e,t,o),mi=x({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),gi=x([is("menu"),is("selectedMenu")]),pi=x([is("item"),is("selectedItem")]);x(Nn(pi().concat(gi())));const hi=x(Nn(pi())),fi=gs("initSize",[is("numColumns"),is("numRows")]),bi=()=>gs("markers",[is("backgroundMenu")].concat(gi()).concat(pi())),vi=e=>gs("markers",z(e,is)),yi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");j(t,(e=>e.indexOf("alloy")>0&&!R(di,(t=>e.indexOf(t)>-1)))).getOr("unknown")}})(),ss(t,t,o,Kn((e=>dn.value(((...t)=>e.apply(void 0,t))))))),xi=e=>yi(0,e,Cn(b)),wi=e=>yi(0,e,Cn(A.none)),Si=e=>yi(0,e,{tag:"required",process:{}}),ki=e=>yi(0,e,{tag:"required",process:{}}),Ci=(e,t)=>rs(e,x(t)),Oi=e=>rs(e,w),_i=x(fi);var Ti=[ks("contextual",[ds("fadeInClass"),ds("fadeOutClass"),ds("transitionClass"),ms("lazyContext"),xi("onShow"),xi("onShown"),xi("onHide"),xi("onHidden")]),Ms("lazyViewport",(()=>({bounds:tn(),optScrollEnv:A.none()}))),Ds("modes",["top","bottom"],jn),xi("onDocked"),xi("onUndocked")];const Ei=pa({fields:Ti,name:"docking",active:ni,apis:oi,state:Object.freeze({__proto__:null,init:e=>{const t=on(!1),o=on(!0),n=rn(),s=on(e.modes);return ua({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:s.get,setModes:s.set,readState:()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${s.get().join(",")}`})}})}),Ai=Wr([((e,t)=>({key:e,value:Ps({can:(e,t)=>{const o=t.event,n=o.originator,s=o.target;return!((e,t,o)=>Qe(t,e.element)&&!Qe(t,o))(e,n,s)||(console.warn(ur()+" did not get interpreted by the desired target. \nOriginator: "+ii(n)+"\nTarget: "+ii(s)+"\nCheck the "+ur()+" event handlers"),!1)}})}))(ur())]);var Mi=Object.freeze({__proto__:null,events:Ai});let Di=0;const Bi=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return Di++,e+"_"+o+Di+String(t)},Ii=x("alloy-id-"),Fi=x("data-alloy-id"),Ri=Ii(),Ni=Fi(),Li=(e,t)=>{Object.defineProperty(e.dom,Ni,{value:t,writable:!0})},zi=e=>{const t=$e(e)?e.dom[Ni]:null;return A.from(t)},Vi=e=>Bi(e),Hi=w,Pi=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+ii(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:x("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),build:o("build"),buildOrPatch:o("buildOrPatch"),addToWorld:o("addToWorld"),removeFromWorld:o("removeFromWorld"),addToGui:o("addToGui"),removeFromGui:o("removeFromGui"),getByUid:o("getByUid"),getByDom:o("getByDom"),isConnected:T}},Ui=Pi(),Wi=Bi("alloy-premade"),ji=e=>(Object.defineProperty(e.element.dom,Wi,{value:e.uid,writable:!0}),Fs(Wi,e)),$i=e=>fe(e,Wi),Gi=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:sa(r.slice(1))}),e})(((t,...o)=>e(t.getApis(),t,...o)),e),qi=(e,t)=>{const o={};return ie(e,((e,n)=>{ie(e,((e,s)=>{const r=fe(o,s).getOr([]);o[s]=r.concat([t(n,e)])}))})),o},Yi=e=>e.cHandler,Xi=(e,t)=>({name:e,handler:t}),Ki=(e,t)=>{const o={};return V(e,(e=>{o[e.name()]=e.handlers(t)})),o},Ji=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const s=Q(o,((o,s)=>{const r=o[t],a=s[t],i=n.indexOf(r),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+r+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(n,null,2));return i(e=>{const t=((e,t)=>(...t)=>W(e,((e,o)=>e&&(e=>e.can)(o).apply(void 0,t)),!0))(e),o=((e,t)=>(...t)=>W(e,((e,o)=>e||(e=>e.abort)(o).apply(void 0,t)),!1))(e);return{can:t,abort:o,run:(...t)=>{V(e,(e=>{e.run.apply(void 0,t)}))}}})(z(e,(e=>e.handler))))):((e,t)=>dn.error(["The event ("+e+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+JSON.stringify(z(t,(e=>e.name)),null,2)]))(o,e)},Zi=(e,t)=>((e,t)=>{const o=(e=>{const t=[],o=[];return V(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{o.push(e)}))})),{errors:t,values:o}})(e);return o.errors.length>0?(n=o.errors,dn.error(G(n))):((e,t)=>0===e.length?dn.value(t):dn.value(wn(t,Sn.apply(void 0,e))))(o.values,t);var n})(ge(e,((e,o)=>(1===e.length?dn.value(e[0].handler):Ji(e,t,o)).map((n=>{const s=(e=>{const t=(e=>p(e)?{can:E,abort:T,run:e}:e)(e);return(e,o,...n)=>{const s=[e,o].concat(n);t.abort.apply(void 0,s)?o.stop():t.can.apply(void 0,s)&&t.run.apply(void 0,s)}})(n),r=e.length>1?P(t[o],(t=>R(e,(e=>e.name===t)))).join(" > "):e[0].name;return Fs(o,((e,t)=>({handler:e,purpose:t}))(s,r))})))),{}),Qi="alloy.base.behaviour",el=Nn([ss("dom","dom",{tag:"required",process:{}},Nn([is("tag"),Cs("styles",{}),Cs("classes",[]),Cs("attributes",{}),fs("value"),fs("innerHtml")])),is("components"),is("uid"),Cs("events",{}),Cs("apis",{}),ss("eventOrder","eventOrder",(bl={[hr()]:["disabling",Qi,"toggling","typeaheadevents"],[ur()]:[Qi,"focusing","keying"],[wr()]:[Qi,"disabling","toggling","representing"],[or()]:[Qi,"representing","streaming","invalidating"],[Tr()]:[Qi,"representing","item-events","toolbar-button-events","tooltipping"],[qs()]:["focusing",Qi,"item-type-events"],[Ws()]:["focusing",Qi,"item-type-events"],[Js()]:["item-type-events","tooltipping"],[pr()]:["receiving","reflecting","tooltipping"]},On(x(bl))),Pn()),fs("domModification")]),tl=e=>e.events,ol=e=>e.dom.value,nl=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},sl=(e,t,o)=>{o.fold((()=>Vo(e,t)),(e=>{Qe(e,t)||(No(e,t),Uo(e))}))},rl=(e,t,o)=>{const n=z(t,o),s=lt(e);return V(s.slice(n.length),Uo),n},al=(e,t,o,n)=>{const s=ct(e,t),r=n(o,s),a=((e,t,o)=>ct(e,t).map((e=>{if(o.exists((t=>!Qe(t,e)))){const t=o.map(Ue).getOr("span"),n=Re(t);return No(e,n),n}return e})))(e,t,s);return sl(e,r.element,a),r},il=(e,t)=>{const o=re(e),n=re(t),s=K(n,o),r=((e,o)=>{const n={},s={};return ue(e,((e,o)=>!be(t,o)||e!==t[o]),de(n),de(s)),{t:n,f:s}})(e).t;return{toRemove:s,toSet:r}},ll=(e,t)=>{const o=t.filter((t=>Ue(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>be(e.dom,Wi))(t))).bind((t=>((e,t)=>{try{const o=((e,t)=>{const{class:o,style:n,...s}=(e=>W(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))(t),{toSet:r,toRemove:a}=il(e.attributes,s),i=zt(t),{toSet:l,toRemove:c}=il(e.styles,i),d=Aa(t),u=K(d,e.classes),m=K(e.classes,d);return V(a,(e=>At(t,e))),Ot(t,r),Ta(t,m),Ea(t,u),V(c,(e=>Ht(t,e))),It(t,l),e.innerHtml.fold((()=>{const o=e.domChildren;((e,t)=>{rl(e,t,((t,o)=>{const n=ct(e,o);return sl(e,t,n),t}))})(t,o)}),(e=>{ri(t,e)})),(()=>{const o=t,n=e.value.getOrUndefined();n!==ol(o)&&nl(o,null!=n?n:"")})(),t})(e,t);return A.some(o)}catch(e){return A.none()}})(e,t))).getOrThunk((()=>(e=>{const t=Re(e.tag);Ot(t,e.attributes),Ta(t,e.classes),It(t,e.styles),e.innerHtml.each((e=>ri(t,e)));const o=e.domChildren;return Ho(t,o),e.value.each((e=>{nl(t,e)})),t})(e)));return Li(o,e.uid),o},cl=e=>{const t=(e=>{const t=fe(e,"behaviours").getOr({});return q(re(t),(e=>{const o=t[e];return g(o)?[o.me]:[]}))})(e);return((e,t)=>((e,t)=>{const o=z(t,(e=>ks(e.name(),[is("config"),Cs("state",da)]))),n=Zn("component.behaviours",Nn(o),e.behaviours).fold((t=>{throw new Error(ts(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))}),w);return{list:t,data:le(n,(e=>{const t=e.map((e=>({config:e.config,state:e.state.init(e.config)})));return x(t)}))}})(e,t))(e,t)},dl=(e,t)=>{const o=()=>m,n=on(Ui),s=Qn((e=>Zn("custom.definition",el,e))(e)),r=cl(e),a=(e=>e.list)(r),i=(e=>e.data)(r),l=((e,t,o)=>{const n={...(s=e).dom,uid:s.uid,domChildren:z(s.components,(e=>e.element))};var s;const r=(e=>e.domModification.fold((()=>aa({})),aa))(e),a={"alloy.base.modification":r},i=t.length>0?((e,t,o,n)=>{const s={...t};V(o,(t=>{s[t.name()]=t.exhibit(e,n)}));const r=qi(s,((e,t)=>({name:e,modification:t}))),a=e=>U(e,((e,t)=>({...t.modification,...e})),{}),i=U(r.classes,((e,t)=>t.modification.concat(e)),[]),l=a(r.attributes),c=a(r.styles);return aa({classes:i,attributes:l,styles:c})})(o,a,t,n):r;return l=n,c=i,{...l,attributes:{...l.attributes,...c.attributes},styles:{...l.styles,...c.styles},classes:l.classes.concat(c.classes)};var l,c})(s,a,i),c=ll(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":tl(e)};return((e,t,o,n)=>{const s=((e,t,o)=>{const n={...o,...Ki(t,e)};return qi(n,Xi)})(e,o,n);return Zi(s,t)})(o,e.eventOrder,t,n).getOrDie()})(s,a,i),u=on(s.components),m={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(p(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>p(i[e.name()]),spec:e,readState:e=>i[e]().map((e=>e.state.readState())).getOr("not enabled"),getApis:()=>s.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(Pi(o))},element:c,syncComponents:()=>{const e=lt(c),t=q(e,(e=>n.get().getByDom(e).fold((()=>[]),Z)));u.set(t)},components:u.get,events:d};return m},ul=e=>{const t=Ne(e);return ml({element:t})},ml=e=>{const t=es("external.component",Rn([is("element"),fs("uid")]),e),o=on(Pi()),n=t.uid.getOrThunk((()=>Vi("external")));Li(t.element,n);const s={uid:n,getSystem:o.get,config:A.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(Pi((()=>s)))},getApis:()=>({}),element:t.element,spec:e,readState:x("No state"),syncComponents:b,components:x([]),events:{}};return ji(s)},gl=Vi,pl=(e,t)=>$i(e).getOrThunk((()=>((e,t)=>{const{events:o,...n}=Hi(e),s=((e,t)=>{const o=fe(e,"components").getOr([]);return t.fold((()=>z(o,hl)),(e=>z(o,((t,o)=>pl(t,ct(e,o))))))})(n,t),r={...n,events:{...Mi,...o},components:s};return dn.value(dl(r,t))})((e=>be(e,"uid"))(e)?e:{uid:gl(""),...e},t).getOrDie())),hl=e=>pl(e,A.none()),fl=ji;var bl,vl=(e,t,o,n,s)=>e(o,n)?A.some(o):p(s)&&s(o)?A.none():t(o,n,s);const yl=(e,t,o)=>{let n=e.dom;const s=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=Le(n);if(t(e))return A.some(e);if(s(e))break}return A.none()},xl=(e,t,o)=>vl(((e,t)=>t(e)),yl,e,t,o),wl=(e,t)=>j(e.dom.childNodes,(e=>t(Le(e)))).map(Le),Sl=(e,t,o)=>xl(e,t,o).isSome(),kl=(e,t,o)=>yl(e,(e=>Ke(e,t)),o),Cl=(e,t)=>((e,o)=>{const n=e.dom;return n.parentNode?wl(Le(n.parentNode),(o=>!Qe(e,o)&&Ke(o,t))):A.none()})(e),Ol=(e,t)=>wl(e,(e=>Ke(e,t))),_l=(e,t)=>Ze(t,e),Tl=(e,t,o)=>vl(((e,t)=>Ke(e,t)),kl,e,t,o),El="aria-controls",Al=()=>{const e=Bi(El);return{id:e,link:t=>{Ct(t,El,e)},unlink:e=>{At(e,El)}}},Ml=(e,t)=>Sl(t,(t=>Qe(t,e.element)),T)||((e,t)=>(e=>xl(e,(e=>{if(!$e(e))return!1;const t=_t(e,"id");return void 0!==t&&t.indexOf(El)>-1})).bind((e=>{const t=_t(e,"id"),o=ft(e);return _l(o,`[${El}="${t}"]`)})))(t).exists((t=>Ml(e,t))))(e,t),Dl=(e,t,o,n,s,r,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:s,restriction:r,label:`${a}-${s}`,alwaysFit:i}),Bl=Is([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Il=Bl.southeast,Fl=Bl.southwest,Rl=Bl.northeast,Nl=Bl.northwest,Ll=Bl.south,zl=Bl.north,Vl=Bl.east,Hl=Bl.west,Pl=(e,t,o,n)=>{const s=e+t;return s>n?o:sMath.min(Math.max(e,t),o),Wl=(e,t)=>J(["left","right","top","bottom"],(o=>fe(t,o).map((t=>((e,t)=>{switch(t){case 1:return e.x;case 0:return e.x+e.width;case 2:return e.y;case 3:return e.y+e.height}})(e,t))))),jl="layout",$l=e=>e.x,Gl=(e,t)=>e.x+e.width/2-t.width/2,ql=(e,t)=>e.x+e.width-t.width,Yl=(e,t)=>e.y-t.height,Xl=e=>e.y+e.height,Kl=(e,t)=>e.y+e.height/2-t.height/2,Jl=(e,t,o)=>Dl($l(e),Xl(e),o.southeast(),Il(),"southeast",Wl(e,{left:1,top:3}),jl),Zl=(e,t,o)=>Dl(ql(e,t),Xl(e),o.southwest(),Fl(),"southwest",Wl(e,{right:0,top:3}),jl),Ql=(e,t,o)=>Dl($l(e),Yl(e,t),o.northeast(),Rl(),"northeast",Wl(e,{left:1,bottom:2}),jl),ec=(e,t,o)=>Dl(ql(e,t),Yl(e,t),o.northwest(),Nl(),"northwest",Wl(e,{right:0,bottom:2}),jl),tc=(e,t,o)=>Dl(Gl(e,t),Yl(e,t),o.north(),zl(),"north",Wl(e,{bottom:2}),jl),oc=(e,t,o)=>Dl(Gl(e,t),Xl(e),o.south(),Ll(),"south",Wl(e,{top:3}),jl),nc=(e,t,o)=>Dl((e=>e.x+e.width)(e),Kl(e,t),o.east(),Vl(),"east",Wl(e,{left:0}),jl),sc=(e,t,o)=>Dl(((e,t)=>e.x-t.width)(e,t),Kl(e,t),o.west(),Hl(),"west",Wl(e,{right:1}),jl),rc=()=>[Jl,Zl,Ql,ec,oc,tc,nc,sc],ac=()=>[Zl,Jl,ec,Ql,oc,tc,nc,sc],ic=()=>[Ql,ec,Jl,Zl,tc,oc],lc=()=>[ec,Ql,Zl,Jl,tc,oc],cc=()=>[Jl,Zl,Ql,ec,oc,tc],dc=()=>[Zl,Jl,ec,Ql,oc,tc];var uc=Object.freeze({__proto__:null,events:e=>Wr([Gr(pr(),((t,o)=>{const n=e.channels,s=re(n),r=o,a=((e,t)=>t.universal?e:P(e,(e=>F(t.channels,e))))(s,r);V(a,(e=>{const o=n[e],s=o.schema,a=es("channel["+e+"] data\nReceiver: "+ii(t.element),s,r.data);o.onReceive(t,a)}))}))])}),mc=[ls("channels",Jn(dn.value,Rn([Si("onReceive"),Cs("schema",Pn())])))];const gc=pa({fields:mc,name:"receiving",active:uc});var pc=Object.freeze({__proto__:null,exhibit:(e,t)=>aa({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const hc=(e,t=!1)=>e.dom.focus({preventScroll:t}),fc=e=>e.dom.blur(),bc=e=>{const t=ft(e).dom;return e.dom===t.activeElement},vc=(e=qo())=>A.from(e.dom.activeElement).map(Le),yc=e=>vc(ft(e)).filter((t=>e.dom.contains(t.dom))),xc=(e,t)=>{const o=ft(t),n=vc(o).bind((e=>{const o=t=>Qe(e,t);return o(t)?A.some(t):((e,t)=>{const o=e=>{for(let n=0;n{vc(o).filter((t=>Qe(t,e))).fold((()=>{hc(e)}),b)})),s},wc=Is([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Sc=(e,t,o,n,s,r)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=s-(i+a.width),d=r-(l+a.height),u=A.some(i),m=A.some(l),g=A.some(c),p=A.some(d),h=A.none();return t.direction.fold((()=>Ma(e,u,m,h,h)),(()=>Ma(e,h,m,g,h)),(()=>Ma(e,u,h,h,p)),(()=>Ma(e,h,h,g,p)),(()=>Ma(e,u,m,h,h)),(()=>Ma(e,u,h,h,p)),(()=>Ma(e,u,m,h,h)),(()=>Ma(e,h,m,g,h)))},kc=(e,t)=>e.fold((()=>{const e=t.rect;return Ma("absolute",A.some(e.x),A.some(e.y),A.none(),A.none())}),((e,o,n,s)=>Sc("absolute",t,e,o,n,s)),((e,o,n,s)=>Sc("fixed",t,e,o,n,s))),Cc=(e,t)=>{const o=k(Ko,t),n=e.fold(o,o,(()=>{const e=Wo();return Ko(t).translate(-e.left,-e.top)})),s=Qt(t),r=$t(t);return Jo(n.left,n.top,s,r)},Oc=(e,t)=>t.fold((()=>e.fold(tn,tn,Jo)),(t=>e.fold(x(t),x(t),(()=>{const o=_c(e,t.x,t.y);return Jo(o.left,o.top,t.width,t.height)})))),_c=(e,t,o)=>{const n=qt(t,o);return e.fold(x(n),x(n),(()=>{const e=Wo();return n.translate(-e.left,-e.top)}))};wc.none;const Tc=wc.relative,Ec=wc.fixed,Ac="data-alloy-placement",Mc=e=>Tt(e,Ac),Dc=Is([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),Bc=(e,t,o,n)=>{const s=e.bubble,r=s.offset,a=((e,t,o)=>{const n=(n,s)=>t[n].map((t=>{const r="top"===n||"bottom"===n,a=r?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,s)+a;return r?Ul(i,e.y,e.bottom):Ul(i,e.x,e.right)})).getOr(s),s=n("left",e.x),r=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Jo(s,r,a-s,i-r)})(n,e.restriction,r),i=e.x+r.left,l=e.y+r.top,c=Jo(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:a>=o&&a<=s&&i>=n&&i<=r,sizeInBounds:l<=s&&l>=o&&c<=r&&c>=n,visibleW:Math.min(d,a>=o?s-a:l-o),visibleH:Math.min(u,i>=n?r-i:c-n)}})(c,a),p=d&&u,h=p?c:((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,s-l),u=Math.max(n,r-c),m=Ul(a,o,d),g=Ul(i,n,u),p=Math.min(m+l,s)-m,h=Math.min(g+c,r)-g;return Jo(m,g,p,h)})(c,a),f=h.width>0&&h.height>0,{maxWidth:b,maxHeight:v}=((e,t,o)=>{const n=x(t.bottom-o.y),s=x(o.bottom-t.y),r=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,s,s,n),a=x(t.right-o.x),i=x(o.right-t.x),l=((e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n))(e,i,i,a);return{maxWidth:l,maxHeight:r}})(e.direction,h,n),y={rect:h,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:s.classesOn,off:s.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?Dc.fit(y):Dc.nofit(y,m,g,f)},Ic=E,Fc=(e,t,o)=>((e,t,o,n)=>Fo(e,t,o,n,!1))(e,t,Ic,o),Rc=(e,t,o)=>((e,t,o,n)=>Fo(e,t,o,n,!0))(e,t,Ic,o),Nc=Io,Lc=["top","bottom","right","left"],zc="data-alloy-transition-timer",Vc=(e,t,o,n,s,a)=>{const i=((e,t,o)=>o.exists((o=>{const n=e.mode;return"all"===n||o[n]!==t[n]})))(n,s,a);if(i||((e,t)=>((e,t)=>Y(t,(t=>_a(e,t))))(e,t.classes))(e,n)){Bt(e,"position",o.position);const a=Cc(t,e),l=kc(t,{...s,rect:a}),c=J(Lc,(e=>l[e]));((e,t)=>{const o=e=>parseFloat(e).toFixed(3);return pe(t,((t,n)=>!((e,t,o=S)=>we(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o)))).isSome()})(o,c)&&(Ft(e,c),i&&((e,t)=>{Ta(e,t.classes),Tt(e,zc).each((t=>{clearTimeout(parseInt(t,10)),At(e,zc)})),((e,t)=>{const o=sn(),n=sn();let s;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return Qe(t.target,e)&&De(n)&&F(Lc,t.raw.propertyName)},i=r=>{if(m(r)||a(r)){o.clear(),n.clear();const a=null==r?void 0:r.raw.type;(m(a)||a===ar())&&(clearTimeout(s),At(e,zc),Ea(e,t.classes))}},l=Fc(e,ir(),(t=>{a(t)&&(l.unbind(),o.set(Fc(e,ar(),i)),n.set(Fc(e,rr(),i)))})),c=(e=>{const t=t=>{const o=Rt(e,t).split(/\s*,\s*/);return P(o,Me)},o=e=>{if(r(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return Ee(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),s=t("transition-duration");return W(s,((e,t,s)=>{const r=o(n[s])+o(t);return Math.max(e,r)}),0)})(e);requestAnimationFrame((()=>{s=setTimeout(i,c+17),Ct(e,zc,s)}))})(e,t)})(e,n),Pt(e))}else Ea(e,n.classes)},Hc=(e,t)=>{((e,t)=>{const o=Wt.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);Bt(e,"max-height",o+"px")})(e,Math.floor(t))},Pc=x(((e,t)=>{Hc(e,t),It(e,{"overflow-x":"hidden","overflow-y":"auto"})})),Uc=x(((e,t)=>{Hc(e,t)})),Wc=(e,t,o)=>void 0===e[t]?o:e[t],jc=(e,t,o,n)=>{const s=((e,t,o,n)=>{Ht(t,"max-height"),Ht(t,"max-width");const s={width:Qt(r=t),height:$t(r)};var r;return((e,t,o,n,s,r)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,s,e,r),g=Bc(m,a,i,r);return g.fold(x(g),((e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?g:Dc.nofit(l,c,d,u)))};return W(t,((e,t)=>{const o=k(l,t);return e.fold(x(e),o)}),Dc.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:Il(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1)).fold(w,w)})(t,n.preference,e,s,o,n.bounds)})(e,t,o,n);return((e,t,o)=>{const n=kc(o.origin,t);o.transition.each((s=>{Vc(e,o.origin,n,s,t,o.lastPlacement)})),Da(e,n)})(t,s,n),((e,t)=>{((e,t)=>{Ct(e,Ac,t)})(e,t.placement)})(t,s),((e,t)=>{const o=t.classes;Ea(e,o.off),Ta(e,o.on)})(t,s),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,s,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,s,n),{layout:s.layout,placement:s.placement}},$c=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],Gc=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>fe(o,e).getOr([]),i=(e,t,o)=>{const n=K($c,o);return{offset:qt(e,t),classesOn:q(o,a),classesOff:q(n,a)}};return{southeast:()=>i(-e,t,["top","alignLeft"]),southwest:()=>i(e,t,["top","alignRight"]),south:()=>i(-e/2,t,["top","alignCentre"]),northeast:()=>i(-e,-t,["bottom","alignLeft"]),northwest:()=>i(e,-t,["bottom","alignRight"]),north:()=>i(-e/2,-t,["bottom","alignCentre"]),east:()=>i(e,-t/2,["valignCentre","left"]),west:()=>i(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>i(s,r,["top","alignLeft","inset"]),insetNorthwest:()=>i(-s,r,["top","alignRight","inset"]),insetNorth:()=>i(-s/2,r,["top","alignCentre","inset"]),insetSoutheast:()=>i(s,-r,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-s,-r,["bottom","alignRight","inset"]),insetSouth:()=>i(-s/2,-r,["bottom","alignCentre","inset"]),insetEast:()=>i(-s,-r/2,["valignCentre","right","inset"]),insetWest:()=>i(s,-r/2,["valignCentre","left","inset"])}},qc=()=>Gc(0,0,{}),Yc=w,Xc=(e,t)=>o=>"rtl"===Kc(o)?t:e,Kc=e=>"rtl"===Rt(e,"direction")?"rtl":"ltr";var Jc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Jc||(Jc={}));const Zc="data-alloy-vertical-dir",Qc=e=>Sl(e,(e=>$e(e)&&_t(e,"data-alloy-vertical-dir")===Jc.BottomToTop)),ed=()=>ks("layouts",[is("onLtr"),is("onRtl"),fs("onBottomLtr"),fs("onBottomRtl")]),td=(e,t,o,n,s,r,a)=>{const i=a.map(Qc).getOr(!1),l=t.layouts.map((t=>t.onLtr(e))),c=t.layouts.map((t=>t.onRtl(e))),d=i?t.layouts.bind((t=>t.onBottomLtr.map((t=>t(e))))).or(l).getOr(s):l.getOr(o),u=i?t.layouts.bind((t=>t.onBottomRtl.map((t=>t(e))))).or(c).getOr(r):c.getOr(n);return Xc(d,u)(e)};var od=[is("hotspot"),fs("bubble"),Cs("overrides",{}),ed(),Ci("placement",((e,t,o)=>{const n=t.hotspot,s=Cc(o,n.element),r=td(e.element,t,cc(),dc(),ic(),lc(),A.some(t.hotspot.element));return A.some(Yc({anchorBox:s,bubble:t.bubble.getOr(qc()),overrides:t.overrides,layouts:r}))}))],nd=[is("x"),is("y"),Cs("height",0),Cs("width",0),Cs("bubble",qc()),Cs("overrides",{}),ed(),Ci("placement",((e,t,o)=>{const n=_c(o,t.x,t.y),s=Jo(n.left,n.top,t.width,t.height),r=td(e.element,t,rc(),ac(),rc(),ac(),A.none());return A.some(Yc({anchorBox:s,bubble:t.bubble,overrides:t.overrides,layouts:r}))}))];const sd=Is([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),rd=e=>e.fold(w,((e,t,o)=>e.translate(-t,-o))),ad=e=>e.fold(w,w),id=e=>W(e,((e,t)=>e.translate(t.left,t.top)),qt(0,0)),ld=e=>{const t=z(e,ad);return id(t)},cd=sd.screen,dd=sd.absolute,ud=(e,t,o)=>{const n=tt(e.element),s=Wo(n),r=((e,t,o)=>{const n=st(o.root).dom;return A.from(n.frameElement).map(Le).filter((t=>{const o=tt(t),n=tt(e.element);return Qe(o,n)})).map(Xt)})(e,0,o).getOr(s);return dd(r,s.left,s.top)},md=(e,t,o,n)=>{const s=cd(qt(e,t));return A.some(((e,t,o)=>({point:e,width:t,height:o}))(s,o,n))},gd=(e,t,o,n,s)=>e.map((e=>{const r=[t,e.point],a=(i=()=>ld(r),l=()=>ld(r),c=()=>(e=>{const t=z(e,rd);return id(t)})(r),n.fold(i,l,c));var i,l,c;const d=(p=a.left,h=a.top,f=e.width,b=e.height,{x:p,y:h,width:f,height:b}),u=o.showAbove?ic():cc(),m=o.showAbove?lc():dc(),g=td(s,o,u,m,u,m,A.none());var p,h,f,b;return Yc({anchorBox:d,bubble:o.bubble.getOr(qc()),overrides:o.overrides,layouts:g})}));var pd=[is("node"),is("root"),fs("bubble"),ed(),Cs("overrides",{}),Cs("showAbove",!1),Ci("placement",((e,t,o)=>{const n=ud(e,0,t);return t.node.filter(xt).bind((s=>{const r=s.dom.getBoundingClientRect(),a=md(r.left,r.top,r.width,r.height),i=t.node.getOr(e.element);return gd(a,n,t,o,i)}))}))];const hd=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),fd=Is([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),bd=(fd.before,fd.on,fd.after,e=>e.fold(w,w,w)),vd=Is([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),yd={domRange:vd.domRange,relative:vd.relative,exact:vd.exact,exactFromRange:e=>vd.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Le(e.startContainer),relative:(e,t)=>bd(e),exact:(e,t,o,n)=>e}))(e);return st(t)},range:hd},xd=(e,t,o)=>{const n=e.document.createRange();var s;return s=n,t.fold((e=>{s.setStartBefore(e.dom)}),((e,t)=>{s.setStart(e.dom,t)}),(e=>{s.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},wd=(e,t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},Sd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),kd=Is([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Cd=(e,t,o)=>t(Le(o.startContainer),o.startOffset,Le(o.endContainer),o.endOffset),Od=(e,t)=>((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:x(e),rtl:A.none}),relative:(t,o)=>({ltr:eo((()=>xd(e,t,o))),rtl:eo((()=>A.some(xd(e,o,t))))}),exact:(t,o,n,s)=>({ltr:eo((()=>wd(e,t,o,n,s))),rtl:eo((()=>A.some(wd(e,n,s,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>kd.rtl(Le(e.endContainer),e.endOffset,Le(e.startContainer),e.startOffset))).getOrThunk((()=>Cd(0,kd.ltr,o))):Cd(0,kd.ltr,o)})(0,o)})(e,t).match({ltr:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},rtl:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(n.dom,s),r.setEnd(t.dom,o),r}});kd.ltr,kd.rtl;const _d=(e,t,o)=>P(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const s=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Le(e);if(s.push(t),!0===o(t))break;n=e}return s})(e,o),t),Td=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Je(o)?[]:z(o.querySelectorAll(e),Le)})(t,e),Ed=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(hd(Le(t.startContainer),t.startOffset,Le(o.endContainer),o.endOffset))}return A.none()},Ad=e=>{if(null===e.anchorNode||null===e.focusNode)return Ed(e);{const t=Le(e.anchorNode),o=Le(e.focusNode);return((e,t,o,n)=>{const s=((e,t,o,n)=>{const s=tt(e).dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s})(e,t,o,n),r=Qe(e,o)&&t===n;return s.collapsed&&!r})(t,e.anchorOffset,o,e.focusOffset)?A.some(hd(t,e.anchorOffset,o,e.focusOffset)):Ed(e)}},Md=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(Sd):A.none()})(Od(e,t)),Dd=((e,t)=>{const o=t=>e(t)?A.from(t.dom.nodeValue):A.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}}})(Ge),Bd=(e,t)=>({element:e,offset:t}),Id=(e,t)=>Ge(e)?Bd(e,t):((e,t)=>{const o=lt(e);if(0===o.length)return Bd(e,t);if(tDd.get(e))(e).length:lt(e).length;return Bd(e,t)}})(e,t),Fd=e=>void 0!==e.foffset,Rd=(e,t)=>t.getSelection.getOrThunk((()=>()=>(e=>(e=>A.from(e.getSelection()))(e).filter((e=>e.rangeCount>0)).bind(Ad))(e)))().map((e=>{if(Fd(e)){const t=Id(e.start,e.soffset),o=Id(e.finish,e.foffset);return yd.range(t.element,t.offset,o.element,o.offset)}return e}));var Nd=[fs("getSelection"),is("root"),fs("bubble"),ed(),Cs("overrides",{}),Cs("showAbove",!1),Ci("placement",((e,t,o)=>{const n=st(t.root).dom,s=ud(e,0,t),r=Rd(n,t).bind((e=>{if(Fd(e)){const t=((e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?A.some(t).map(Sd):A.none()})(Od(e,t)))(n,yd.exactFromRange(e)).orThunk((()=>{const t=Ne("\ufeff");No(e.start,t);const o=Md(n,yd.exact(t,0,t,1));return Uo(t),o}));return t.bind((e=>md(e.left,e.top,e.width,e.height)))}{const t=le(e,(e=>e.dom.getBoundingClientRect())),o={left:Math.min(t.firstCell.left,t.lastCell.left),right:Math.max(t.firstCell.right,t.lastCell.right),top:Math.min(t.firstCell.top,t.lastCell.top),bottom:Math.max(t.firstCell.bottom,t.lastCell.bottom)};return md(o.left,o.top,o.right-o.left,o.bottom-o.top)}})),a=Rd(n,t).bind((e=>Fd(e)?$e(e.start)?A.some(e.start):at(e.start):A.some(e.firstCell))).getOr(e.element);return gd(r,s,t,o,a)}))];const Ld="link-layout",zd=e=>e.x+e.width,Vd=(e,t)=>e.x-t.width,Hd=(e,t)=>e.y-t.height+e.height,Pd=e=>e.y,Ud=(e,t,o)=>Dl(zd(e),Pd(e),o.southeast(),Il(),"southeast",Wl(e,{left:0,top:2}),Ld),Wd=(e,t,o)=>Dl(Vd(e,t),Pd(e),o.southwest(),Fl(),"southwest",Wl(e,{right:1,top:2}),Ld),jd=(e,t,o)=>Dl(zd(e),Hd(e,t),o.northeast(),Rl(),"northeast",Wl(e,{left:0,bottom:3}),Ld),$d=(e,t,o)=>Dl(Vd(e,t),Hd(e,t),o.northwest(),Nl(),"northwest",Wl(e,{right:1,bottom:3}),Ld),Gd=()=>[Ud,Wd,jd,$d],qd=()=>[Wd,Ud,$d,jd];var Yd=[is("item"),ed(),Cs("overrides",{}),Ci("placement",((e,t,o)=>{const n=Cc(o,t.item.element),s=td(e.element,t,Gd(),qd(),Gd(),qd(),A.none());return A.some(Yc({anchorBox:n,bubble:qc(),overrides:t.overrides,layouts:s}))}))],Xd=os("type",{selection:Nd,node:pd,hotspot:od,submenu:Yd,makeshift:nd});const Kd=[hs("classes",jn),Es("mode","all",["all","layout","placement"])],Jd=[Cs("useFixed",T),fs("getBounds")],Zd=[ls("anchor",Xd),ks("transition",Kd)],Qd=(e,t,o,n,s,r)=>{const a=es("placement.info",Nn(Zd),s),i=a.anchor,l=n.element,c=o.get(n.uid);xc((()=>{Bt(l,"position","fixed");const s=Lt(l,"visibility");Bt(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return Ec(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Xt(e.element),o=e.element.dom.getBoundingClientRect();return Tc(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each((e=>{const s=r.orThunk((()=>t.getBounds.map(_))),i=((e,t,o,n,s,r)=>((e,t,o,n,s,r,a,i)=>{const l=Wc(a,"maxHeightFunction",Pc()),c=Wc(a,"maxWidthFunction",b),d=e.anchorBox,u=e.origin,m={bounds:Oc(u,r),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:s,transition:i};return jc(d,t,o,m)})(((e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t))(t.anchorBox,e),n.element,t.bubble,t.layouts,s,o,t.overrides,r))(d,e,s,n,c,a.transition);o.set(n.uid,i)})),s.fold((()=>{Ht(l,"visibility")}),(e=>{Bt(l,"visibility",e)})),Lt(l,"left").isNone()&&Lt(l,"top").isNone()&&Lt(l,"right").isNone()&&Lt(l,"bottom").isNone()&&ye(Lt(l,"position"),"fixed")&&Ht(l,"position")}),l)};var eu=Object.freeze({__proto__:null,position:(e,t,o,n,s)=>{const r=A.none();Qd(e,t,o,n,s,r)},positionWithinBounds:Qd,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const s=n.element;V(["position","left","right","top","bottom"],(e=>Ht(s,e))),(e=>{At(e,Ac)})(s),o.clear(n.uid)}});const tu=pa({fields:Jd,name:"positioning",active:pc,apis:eu,state:Object.freeze({__proto__:null,init:()=>{let e={};return ua({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>fe(e,t)})}})}),ou=e=>e.getSystem().isConnected(),nu=e=>{Lr(e,Tr());const t=e.components();V(t,nu)},su=e=>{const t=e.components();V(t,su),Lr(e,_r())},ru=(e,t)=>{e.getSystem().addToWorld(t),xt(e.element)&&su(t)},au=e=>{nu(e),e.getSystem().removeFromWorld(e)},iu=(e,t)=>{Vo(e.element,t.element)},lu=(e,t)=>{cu(e,t,Vo)},cu=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),xt(e.element)&&su(t),e.syncComponents()},du=e=>{nu(e),Uo(e.element),e.getSystem().removeFromWorld(e)},uu=e=>{const t=rt(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()));du(e),t.each((e=>{e.syncComponents()}))},mu=e=>{const t=e.components();V(t,du),Po(e.element),e.syncComponents()},gu=(e,t)=>{hu(e,t,Vo)},pu=(e,t)=>{hu(e,t,Lo)},hu=(e,t,o)=>{o(e,t.element);const n=lt(t.element);V(n,(e=>{t.getByDom(e).each(su)}))},fu=e=>{const t=lt(e.element);V(t,(t=>{e.getByDom(t).each(nu)})),Uo(e.element)},bu=(e,t,o,n)=>{o.get().each((t=>{mu(e)}));const s=t.getAttachPoint(e);lu(s,e);const r=e.getSystem().build(n);return lu(e,r),o.set(r),r},vu=(e,t,o,n)=>{const s=bu(e,t,o,n);return t.onOpen(e,s),s},yu=(e,t,o)=>{o.get().each((n=>{mu(e),uu(e),t.onClose(e,n),o.clear()}))},xu=(e,t,o)=>o.isOpen(),wu=(e,t,o)=>{const n=t.getAttachPoint(e);Bt(e.element,"position",tu.getMode(n)),((e,t,o,n)=>{Lt(e.element,t).fold((()=>{At(e.element,o)}),(t=>{Ct(e.element,o,t)})),Bt(e.element,t,"hidden")})(e,"visibility",t.cloakVisibilityAttr)},Su=(e,t,o)=>{(e=>R(["top","left","right","bottom"],(t=>Lt(e,t).isSome())))(e.element)||Ht(e.element,"position"),((e,t,o)=>{Tt(e.element,o).fold((()=>Ht(e.element,t)),(o=>Bt(e.element,t,o)))})(e,"visibility",t.cloakVisibilityAttr)};var ku=Object.freeze({__proto__:null,cloak:wu,decloak:Su,open:vu,openWhileCloaked:(e,t,o,n,s)=>{wu(e,t),vu(e,t,o,n),s(),Su(e,t)},close:yu,isOpen:xu,isPartOf:(e,t,o,n)=>xu(0,0,o)&&o.get().exists((o=>t.isPartOf(e,o,n))),getState:(e,t,o)=>o.get(),setContent:(e,t,o,n)=>o.get().map((()=>bu(e,t,o,n)))}),Cu=Object.freeze({__proto__:null,events:(e,t)=>Wr([Gr(yr(),((o,n)=>{yu(o,e,t)}))])}),Ou=[xi("onOpen"),xi("onClose"),is("isPartOf"),is("getAttachPoint"),Cs("cloakVisibilityAttr","data-precloak-visibility")],_u=Object.freeze({__proto__:null,init:()=>{const e=rn(),t=x("not-implemented");return ua({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Tu=pa({fields:Ou,name:"sandboxing",active:Cu,apis:ku,state:_u}),Eu=x("dismiss.popups"),Au=x("reposition.popups"),Mu=x("mouse.released"),Du=Rn([Cs("isExtraPart",T),ks("fireEventInstead",[Cs("event",Er())])]),Bu=e=>{const t=es("Dismissal",Du,e);return{[Eu()]:{schema:Rn([is("target")]),onReceive:(e,o)=>{Tu.isOpen(e)&&(Tu.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold((()=>Tu.close(e)),(t=>Lr(e,t.event))))}}}},Iu=Rn([ks("fireEventInstead",[Cs("event",Ar())]),ms("doReposition")]),Fu=e=>{const t=es("Reposition",Iu,e);return{[Au()]:{onReceive:e=>{Tu.isOpen(e)&&t.fireEventInstead.fold((()=>t.doReposition(e)),(t=>Lr(e,t.event)))}}}},Ru=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},Nu=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var Lu=Object.freeze({__proto__:null,onLoad:Ru,onUnload:Nu,setValue:(e,t,o,n)=>{t.store.manager.setValue(e,t,o,n)},getValue:(e,t,o)=>t.store.manager.getValue(e,t,o),getState:(e,t,o)=>o}),zu=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[ea(((o,n)=>{Ru(o,e,t)})),ta(((o,n)=>{Nu(o,e,t)}))]:[ia(e,t,Ru)];return Wr(o)}});const Vu=()=>{const e=on(null);return ua({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},Hu=()=>{const e=on({}),t=on({});return ua({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:o=>fe(e.get(),o).orThunk((()=>fe(t.get(),o))),update:o=>{const n=e.get(),s=t.get(),r={},a={};V(o,(e=>{r[e.value]=e,fe(e,"meta").each((t=>{fe(t,"text").each((t=>{a[t]=e}))}))})),e.set({...n,...r}),t.set({...s,...a})},clear:()=>{e.set({}),t.set({})}})};var Pu=Object.freeze({__proto__:null,memory:Vu,dataset:Hu,manual:()=>ua({readState:b}),init:e=>e.store.manager.state(e)});const Uu=(e,t,o,n)=>{const s=t.store;o.update([n]),s.setValue(e,n),t.onSetValue(e,n)};var Wu=[fs("initialValue"),is("getFallbackEntry"),is("getDataKey"),is("setValue"),Ci("manager",{setValue:Uu,getValue:(e,t,o)=>{const n=t.store,s=n.getDataKey(e);return o.lookup(s).getOrThunk((()=>n.getFallbackEntry(s)))},onLoad:(e,t,o)=>{t.store.initialValue.each((n=>{Uu(e,t,o,n)}))},onUnload:(e,t,o)=>{o.clear()},state:Hu})],ju=[is("getValue"),Cs("setValue",b),fs("initialValue"),Ci("manager",{setValue:(e,t,o,n)=>{t.store.setValue(e,n),t.onSetValue(e,n)},getValue:(e,t,o)=>t.store.getValue(e),onLoad:(e,t,o)=>{t.store.initialValue.each((o=>{t.store.setValue(e,o)}))},onUnload:b,state:da.init})],$u=[fs("initialValue"),Ci("manager",{setValue:(e,t,o,n)=>{o.set(n),t.onSetValue(e,n)},getValue:(e,t,o)=>o.get(),onLoad:(e,t,o)=>{t.store.initialValue.each((e=>{o.isNotSet()&&o.set(e)}))},onUnload:(e,t,o)=>{o.clear()},state:Vu})],Gu=[Os("store",{mode:"memory"},os("mode",{memory:$u,manual:ju,dataset:Wu})),xi("onSetValue"),Cs("resetOnDom",!1)];const qu=pa({fields:Gu,name:"representing",active:zu,apis:Lu,extra:{setValueFrom:(e,t)=>{const o=qu.getValue(t);qu.setValue(e,o)}},state:Pu}),Yu=(e,t)=>Bs(e,{},z(t,(t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,ss(o,o,{tag:"option",process:{}},An((e=>fn("The field: "+o+" is forbidden. "+n))));var o,n})).concat([rs("dump",w)])),Xu=e=>e.dump,Ku=(e,t)=>({...ma(t),...e.dump}),Ju=Yu,Zu=Ku,Qu="placeholder",em=Is([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),tm=e=>be(e,"uiType"),om=(e,t,o,n)=>((e,t,o,n)=>tm(o)&&o.uiType===Qu?((e,t,o,n)=>e.exists((e=>e!==o.owner))?em.single(!0,x(o)):fe(n,o.name).fold((()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+re(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))}),(e=>e.replace())))(e,0,o,n):em.single(!1,x(o)))(e,0,o,n).fold(((s,r)=>{const a=tm(o)?r(t,o.config,o.validated):r(t),i=fe(a,"components").getOr([]),l=q(i,(o=>om(e,t,o,n)));return[{...a,components:l}]}),((e,n)=>{if(tm(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)})),nm=em.single,sm=em.multiple,rm=x(Qu),am=Is([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),im=Cs("factory",{sketch:w}),lm=Cs("schema",[]),cm=is("name"),dm=ss("pname","pname",kn((e=>"")),Pn()),um=rs("schema",(()=>[fs("preprocess")])),mm=Cs("defaults",x({})),gm=Cs("overrides",x({})),pm=Nn([im,lm,cm,dm,mm,gm]),hm=Nn([im,lm,cm,mm,gm]),fm=Nn([im,lm,cm,dm,mm,gm]),bm=Nn([im,um,cm,is("unit"),dm,mm,gm]),vm=e=>e.fold(A.some,A.none,A.some,A.some),ym=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},xm=(e,t)=>o=>{const n=es("Converting part type",t,o);return e(n)},wm=xm(am.required,pm),Sm=xm(am.external,hm),km=xm(am.optional,fm),Cm=xm(am.group,bm),Om=x("entirety");var _m=Object.freeze({__proto__:null,required:wm,external:Sm,optional:km,group:Cm,asNamedPart:vm,name:ym,asCommon:e=>e.fold(w,w,w,w),original:Om});const Tm=(e,t,o,n)=>wn(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),Em=(e,t)=>{const o={};return V(t,(t=>{vm(t).each((t=>{const n=Am(e,t.pname);o[t.name]=o=>{const s=es("Part: "+t.name+" in "+e,Nn(t.schema),o);return{...n,config:o,validated:s}}}))})),o},Am=(e,t)=>({uiType:rm(),owner:e,name:t}),Mm=(e,t,o)=>({uiType:rm(),owner:e,name:t,config:o,validated:{}}),Dm=e=>q(e,(e=>e.fold(A.none,A.some,A.none,A.none).map((e=>gs(e.name,e.schema.concat([Oi(Om())])))).toArray())),Bm=e=>z(e,ym),Im=(e,t,o)=>((e,t,o)=>{const n={},s={};return V(o,(e=>{e.fold((e=>{n[e.pname]=nm(!0,((t,o,n)=>e.factory.sketch(Tm(t,e,o,n))))}),(e=>{const o=t.parts[e.name];s[e.name]=x(e.factory.sketch(Tm(t,e,o[Om()]),o))}),(e=>{n[e.pname]=nm(!1,((t,o,n)=>e.factory.sketch(Tm(t,e,o,n))))}),(e=>{n[e.pname]=sm(!0,((t,o,n)=>{const s=t[e.name];return z(s,(o=>e.factory.sketch(wn(e.defaults(t,o,n),o,e.overrides(t,o)))))}))}))})),{internals:x(n),externals:x(s)}})(0,t,o),Fm=(e,t,o)=>((e,t,o,n)=>{const s=le(n,((e,t)=>((e,t)=>{let o=!1;return{name:x(e),required:()=>t.fold(((e,t)=>e),((e,t)=>e)),used:()=>o,replace:()=>{if(o)throw new Error("Trying to use the same placeholder more than once: "+e);return o=!0,t}}})(t,e))),r=((e,t,o,n)=>q(o,(o=>om(e,t,o,n))))(e,t,o,s);return ie(s,(o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))})),r})(A.some(e),t,t.components,o),Rm=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},Nm=(e,t,o)=>Rm(e,t,o).getOrDie("Could not find part: "+o),Lm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,(e=>{n[e]=x(r.getByUid(s[e]))})),n},zm=(e,t)=>{const o=e.getSystem();return le(t.partUids,((e,t)=>x(o.getByUid(e))))},Vm=e=>re(e.partUids),Hm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,(e=>{n[e]=x(r.getByUid(s[e]).getOrDie())})),n},Pm=(e,t)=>{const o=Bm(t);return Rs(z(o,(t=>({key:t,value:e+"-"+t}))))},Um=e=>ss("partUids","partUids",On((t=>Pm(t.uid,e))),Pn());var Wm=Object.freeze({__proto__:null,generate:Em,generateOne:Mm,schemas:Dm,names:Bm,substitutes:Im,components:Fm,defaultUids:Pm,defaultUidsSchema:Um,getAllParts:zm,getAllPartNames:Vm,getPart:Rm,getPartOrDie:Nm,getParts:Lm,getPartsOrDie:Hm});const jm=(e,t,o,n,s)=>{const r=((e,t)=>(e.length>0?[gs("parts",e)]:[]).concat([is("uid"),Cs("dom",{}),Cs("components",[]),Oi("originalSpec"),Cs("debug.sketcher",{})]).concat(t))(n,s);return es(e+" [SpecSchema]",Rn(r.concat(t)),o)},$m=(e,t,o,n,s)=>{const r=Gm(s),a=Dm(o),i=Um(o),l=jm(e,t,r,a,[i]),c=Im(0,l,o);return n(l,Fm(e,l,c.internals()),r,c.externals())},Gm=e=>(e=>be(e,"uid"))(e)?e:{...e,uid:Vi("uid")},qm=Rn([is("name"),is("factory"),is("configFields"),Cs("apis",{}),Cs("extraApis",{})]),Ym=Rn([is("name"),is("factory"),is("configFields"),is("partFields"),Cs("apis",{}),Cs("extraApis",{})]),Xm=e=>{const t=es("Sketcher for "+e.name,qm,e),o=le(t.apis,Gi),n=le(t.extraApis,((e,t)=>ra(e,t)));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const s=Gm(n);return o(jm(e,t,s,[],[]),s)})(t.name,t.configFields,t.factory,e),...o,...n}},Km=e=>{const t=es("Sketcher for "+e.name,Ym,e),o=Em(t.name,t.partFields),n=le(t.apis,Gi),s=le(t.extraApis,((e,t)=>ra(e,t)));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>$m(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...s}},Jm=e=>Xe("input")(e)&&"radio"!==_t(e,"type")||Xe("textarea")(e);var Zm=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const Qm=[is("find")],eg=pa({fields:Qm,name:"composing",apis:Zm}),tg=["input","button","textarea","select"],og=(e,t,o)=>{(t.disabled()?lg:cg)(e,t)},ng=(e,t)=>!0===t.useNative&&F(tg,Ue(e.element)),sg=e=>{Ct(e.element,"disabled","disabled")},rg=e=>{At(e.element,"disabled")},ag=e=>{Ct(e.element,"aria-disabled","true")},ig=e=>{Ct(e.element,"aria-disabled","false")},lg=(e,t,o)=>{t.disableClass.each((t=>{ka(e.element,t)})),(ng(e,t)?sg:ag)(e),t.onDisabled(e)},cg=(e,t,o)=>{t.disableClass.each((t=>{Oa(e.element,t)})),(ng(e,t)?rg:ig)(e),t.onEnabled(e)},dg=(e,t)=>ng(e,t)?(e=>Et(e.element,"disabled"))(e):(e=>"true"===_t(e.element,"aria-disabled"))(e);var ug=Object.freeze({__proto__:null,enable:cg,disable:lg,isDisabled:dg,onLoad:og,set:(e,t,o,n)=>{(n?lg:cg)(e,t)}}),mg=Object.freeze({__proto__:null,exhibit:(e,t)=>aa({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>Wr([jr(hr(),((t,o)=>dg(t,e))),ia(e,t,og)])}),gg=[Ms("disabled",T),Cs("useNative",!0),fs("disableClass"),xi("onDisabled"),xi("onEnabled")];const pg=pa({fields:gg,name:"disabling",active:mg,apis:ug}),hg=(e,t,o,n)=>{const s=Td(e.element,"."+t.highlightClass);V(s,(o=>{R(n,(e=>Qe(e.element,o)))||(Oa(o,t.highlightClass),e.getSystem().getByDom(o).each((o=>{t.onDehighlight(e,o),Lr(o,Nr())})))}))},fg=(e,t,o,n)=>{hg(e,t,0,[n]),bg(e,t,o,n)||(ka(n.element,t.highlightClass),t.onHighlight(e,n),Lr(n,Rr()))},bg=(e,t,o,n)=>_a(n.element,t.highlightClass),vg=(e,t,o)=>_l(e.element,"."+t.itemClass).bind((t=>e.getSystem().getByDom(t).toOptional())),yg=(e,t,o)=>{const n=Td(e.element,"."+t.itemClass);return(n.length>0?A.some(n[n.length-1]):A.none()).bind((t=>e.getSystem().getByDom(t).toOptional()))},xg=(e,t,o,n)=>{const s=Td(e.element,"."+t.itemClass);return $(s,(e=>_a(e,t.highlightClass))).bind((t=>{const o=Pl(t,n,0,s.length-1);return e.getSystem().getByDom(s[o]).toOptional()}))},wg=(e,t,o)=>{const n=Td(e.element,"."+t.itemClass);return xe(z(n,(t=>e.getSystem().getByDom(t).toOptional())))};var Sg=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>hg(e,t,0,[]),dehighlight:(e,t,o,n)=>{bg(e,t,o,n)&&(Oa(n.element,t.highlightClass),t.onDehighlight(e,n),Lr(n,Nr()))},highlight:fg,highlightFirst:(e,t,o)=>{vg(e,t).each((n=>{fg(e,t,o,n)}))},highlightLast:(e,t,o)=>{yg(e,t).each((n=>{fg(e,t,o,n)}))},highlightAt:(e,t,o,n)=>{((e,t,o,n)=>{const s=Td(e.element,"."+t.itemClass);return A.from(s[n]).fold((()=>dn.error(new Error("No element found with index "+n))),e.getSystem().getByDom)})(e,t,0,n).fold((e=>{throw e}),(n=>{fg(e,t,o,n)}))},highlightBy:(e,t,o,n)=>{const s=wg(e,t);j(s,n).each((n=>{fg(e,t,o,n)}))},isHighlighted:bg,getHighlighted:(e,t,o)=>_l(e.element,"."+t.highlightClass).bind((t=>e.getSystem().getByDom(t).toOptional())),getFirst:vg,getLast:yg,getPrevious:(e,t,o)=>xg(e,t,0,-1),getNext:(e,t,o)=>xg(e,t,0,1),getCandidates:wg}),kg=[is("highlightClass"),is("itemClass"),xi("onHighlight"),xi("onDehighlight")];const Cg=pa({fields:kg,name:"highlighting",apis:Sg}),Og=[8],_g=[9],Tg=[13],Eg=[27],Ag=[32],Mg=[37],Dg=[38],Bg=[39],Ig=[40],Fg=(e,t,o)=>{const n=X(e.slice(0,t)),s=X(e.slice(t+1));return j(n.concat(s),o)},Rg=(e,t,o)=>{const n=X(e.slice(0,t));return j(n,o)},Ng=(e,t,o)=>{const n=e.slice(0,t),s=e.slice(t+1);return j(s.concat(n),o)},Lg=(e,t,o)=>{const n=e.slice(t+1);return j(n,o)},zg=e=>t=>{const o=t.raw;return F(e,o.which)},Vg=e=>t=>Y(e,(e=>e(t))),Hg=e=>!0===e.raw.shiftKey,Pg=e=>!0===e.raw.ctrlKey,Ug=C(Hg),Wg=(e,t)=>({matches:e,classification:t}),jg=(e,t,o)=>{t.exists((e=>o.exists((t=>Qe(t,e)))))||zr(e,Mr(),{prevFocus:t,newFocus:o})},$g=()=>{const e=e=>yc(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const s=e(t);jg(t,n,s)}}},Gg=()=>{const e=e=>Cg.getHighlighted(e).map((e=>e.element));return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(b,(e=>{Cg.highlight(t,e)}));const s=e(t);jg(t,n,s)}}};var qg;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(qg||(qg={}));const Yg=(e,t,o,n,s)=>{const r=(e,t,o,n,s)=>{return(r=o(e,t,n,s),a=t.event,j(r,(e=>e.matches(a))).map((e=>e.classification))).bind((o=>o(e,t,n,s)));var r,a},a={schema:()=>e.concat([Cs("focusManager",$g()),Os("focusInside","onFocus",Kn((e=>F(["onFocus","onEnterOrSpace","onApi"],e)?dn.value(e):dn.error("Invalid value for focusInside")))),Ci("handler",a),Ci("state",t),Ci("sendFocusIn",s)]),processKey:r,toEvents:(e,t)=>{const a=e.focusInside!==qg.OnFocusMode?A.none():s(e).map((o=>Gr(ur(),((n,s)=>{o(n,e,t),s.stop()})))),i=[Gr(er(),((n,a)=>{r(n,a,o,e,t).fold((()=>{((o,n)=>{const r=zg(Ag.concat(Tg))(n.event);e.focusInside===qg.OnEnterOrSpaceMode&&r&&Vs(o,n)&&s(e).each((s=>{s(o,e,t),n.stop()}))})(n,a)}),(e=>{a.stop()}))})),Gr(tr(),((o,s)=>{r(o,s,n,e,t).each((e=>{s.stop()}))}))];return Wr(a.toArray().concat(i))}};return a},Xg=e=>{const t=[fs("onEscape"),fs("onEnter"),Cs("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Cs("firstTabstop",0),Cs("useTabstopAt",E),fs("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind((e=>Tl(t,e))).getOr(t);return jt(o)>0},n=(e,t)=>t.focusManager.get(e).bind((e=>Tl(e,t.selector))),s=(e,t,n)=>{((e,t)=>{const n=Td(e.element,t.selector),s=P(n,(e=>o(t,e)));return A.from(s[t.firstTabstop])})(e,t).each((o=>{t.focusManager.set(e,o)}))},r=(e,t,s,r)=>{const a=Td(e.element,s.selector);return n(e,s).bind((t=>$(a,k(Qe,t)).bind((t=>((e,t,n,s,r)=>r(t,n,(e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(s,e))).fold((()=>s.cyclic?A.some(!0):A.none()),(t=>(s.focusManager.set(e,t),A.some(!0)))))(e,a,t,s,r)))))},a=(e,t,o)=>{const n=o.cyclic?Fg:Rg;return r(e,0,o,n)},i=(e,t,o)=>{const n=o.cyclic?Ng:Lg;return r(e,0,o,n)},l=x([Wg(Vg([Hg,zg(_g)]),a),Wg(zg(_g),i),Wg(Vg([Ug,zg(Tg)]),((e,t,o)=>o.onEnter.bind((o=>o(e,t)))))]),c=x([Wg(zg(Eg),((e,t,o)=>o.onEscape.bind((o=>o(e,t))))),Wg(zg(_g),((e,t,o)=>n(e,o).filter((e=>!o.useTabstopAt(e))).bind((n=>((e=>(e=>rt(e))(e).bind(dt).exists((t=>Qe(t,e))))(n)?a:i)(e,t,o)))))]);return Yg(t,da.init,l,c,(()=>A.some(s)))};var Kg=Xg(rs("cyclic",T)),Jg=Xg(rs("cyclic",E));const Zg=(e,t,o)=>Jm(o)&&zg(Ag)(t.event)?A.none():((e,t,o)=>(Hr(e,o,hr()),A.some(!0)))(e,0,o),Qg=(e,t)=>A.some(!0),ep=[Cs("execute",Zg),Cs("useSpace",!1),Cs("useEnter",!0),Cs("useControlEnter",!1),Cs("useDown",!1)],tp=(e,t,o)=>o.execute(e,t,e.element);var op=Yg(ep,da.init,((e,t,o,n)=>{const s=o.useSpace&&!Jm(e.element)?Ag:[],r=o.useEnter?Tg:[],a=o.useDown?Ig:[],i=s.concat(r).concat(a);return[Wg(zg(i),tp)].concat(o.useControlEnter?[Wg(Vg([Pg,zg(Tg)]),tp)]:[])}),((e,t,o,n)=>o.useSpace&&!Jm(e.element)?[Wg(zg(Ag),Qg)]:[]),(()=>A.none()));const np=()=>{const e=rn();return ua({readState:()=>e.get().map((e=>({numRows:String(e.numRows),numColumns:String(e.numColumns)}))).getOr({numRows:"?",numColumns:"?"}),setGridSize:(t,o)=>{e.set({numRows:t,numColumns:o})},getNumRows:()=>e.get().map((e=>e.numRows)),getNumColumns:()=>e.get().map((e=>e.numColumns))})};var sp=Object.freeze({__proto__:null,flatgrid:np,init:e=>e.state(e)});const rp=e=>(t,o,n,s)=>{const r=e(t.element);return cp(r,t,o,n,s)},ap=(e,t)=>{const o=Xc(e,t);return rp(o)},ip=(e,t)=>{const o=Xc(t,e);return rp(o)},lp=e=>(t,o,n,s)=>cp(e,t,o,n,s),cp=(e,t,o,n,s)=>n.focusManager.get(t).bind((o=>e(t.element,o,n,s))).map((e=>(n.focusManager.set(t,e),!0))),dp=lp,up=lp,mp=lp,gp=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),pp=(e,t,o)=>{const n=Td(e,o);return((e,o)=>$(e,(e=>Qe(e,t))).map((t=>({index:t,candidates:e}))))(P(n,gp))},hp=(e,t)=>$(e,(e=>Qe(t,e))),fp=(e,t,o,n)=>n(Math.floor(t/o),t%o).bind((t=>{const n=t.row*o+t.column;return n>=0&&nfp(e,t,n,((t,r)=>{const a=t===o-1?e.length-t*n:n,i=Pl(r,s,0,a-1);return A.some({row:t,column:i})})),vp=(e,t,o,n,s)=>fp(e,t,n,((t,r)=>{const a=Pl(t,s,0,o-1),i=a===o-1?e.length-a*n:n,l=Ul(r,0,i-1);return A.some({row:a,column:l})})),yp=[is("selector"),Cs("execute",Zg),wi("onEscape"),Cs("captureTab",!1),_i()],xp=(e,t,o)=>{_l(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},wp=e=>(t,o,n,s)=>pp(t,o,n.selector).bind((t=>e(t.candidates,t.index,s.getNumRows().getOr(n.initSize.numRows),s.getNumColumns().getOr(n.initSize.numColumns)))),Sp=(e,t,o)=>o.captureTab?A.some(!0):A.none(),kp=wp(((e,t,o,n)=>bp(e,t,o,n,-1))),Cp=wp(((e,t,o,n)=>bp(e,t,o,n,1))),Op=wp(((e,t,o,n)=>vp(e,t,o,n,-1))),_p=wp(((e,t,o,n)=>vp(e,t,o,n,1))),Tp=x([Wg(zg(Mg),ap(kp,Cp)),Wg(zg(Bg),ip(kp,Cp)),Wg(zg(Dg),dp(Op)),Wg(zg(Ig),up(_p)),Wg(Vg([Hg,zg(_g)]),Sp),Wg(Vg([Ug,zg(_g)]),Sp),Wg(zg(Ag.concat(Tg)),((e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind((e=>Tl(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n)))))]),Ep=x([Wg(zg(Eg),((e,t,o)=>o.onEscape(e,t))),Wg(zg(Ag),Qg)]);var Ap=Yg(yp,np,Tp,Ep,(()=>A.some(xp)));const Mp=(e,t,o,n,s)=>{const r=(e,t,o)=>s(e,t,n,0,o.length-1,o[t],(t=>{return n=o[t],"button"===Ue(n)&&"disabled"===_t(n,"disabled")?r(e,t,o):A.from(o[t]);var n}));return pp(e,o,t).bind((e=>{const t=e.index,o=e.candidates;return r(t,t,o)}))},Dp=(e,t,o,n)=>Mp(e,t,o,n,((e,t,o,n,s,r,a)=>{const i=Ul(t+o,n,s);return i===e?A.from(r):a(i)})),Bp=(e,t,o,n)=>Mp(e,t,o,n,((e,t,o,n,s,r,a)=>{const i=Pl(t,o,n,s);return i===e?A.none():a(i)})),Ip=[is("selector"),Cs("getInitial",A.none),Cs("execute",Zg),wi("onEscape"),Cs("executeOnMove",!1),Cs("allowVertical",!0),Cs("allowHorizontal",!0),Cs("cycles",!0)],Fp=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind((e=>Tl(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n))),Rp=(e,t,o)=>{t.getInitial(e).orThunk((()=>_l(e.element,t.selector))).each((o=>{t.focusManager.set(e,o)}))},Np=(e,t,o)=>(o.cycles?Bp:Dp)(e,o.selector,t,-1),Lp=(e,t,o)=>(o.cycles?Bp:Dp)(e,o.selector,t,1),zp=e=>(t,o,n,s)=>e(t,o,n,s).bind((()=>n.executeOnMove?Fp(t,o,n):A.some(!0))),Vp=x([Wg(zg(Ag),Qg),Wg(zg(Eg),((e,t,o)=>o.onEscape(e,t)))]);var Hp=Yg(Ip,da.init,((e,t,o,n)=>{const s=[...o.allowHorizontal?Mg:[]].concat(o.allowVertical?Dg:[]),r=[...o.allowHorizontal?Bg:[]].concat(o.allowVertical?Ig:[]);return[Wg(zg(s),zp(ap(Np,Lp))),Wg(zg(r),zp(ip(Np,Lp))),Wg(zg(Tg),Fp),Wg(zg(Ag),Fp)]}),Vp,(()=>A.some(Rp)));const Pp=(e,t,o)=>A.from(e[t]).bind((e=>A.from(e[o]).map((e=>({rowIndex:t,columnIndex:o,cell:e}))))),Up=(e,t,o,n)=>{const s=e[t].length,r=Pl(o,n,0,s-1);return Pp(e,t,r)},Wp=(e,t,o,n)=>{const s=Pl(o,n,0,e.length-1),r=e[s].length,a=Ul(t,0,r-1);return Pp(e,s,a)},jp=(e,t,o,n)=>{const s=e[t].length,r=Ul(o+n,0,s-1);return Pp(e,t,r)},$p=(e,t,o,n)=>{const s=Ul(o+n,0,e.length-1),r=e[s].length,a=Ul(t,0,r-1);return Pp(e,s,a)},Gp=[gs("selectors",[is("row"),is("cell")]),Cs("cycles",!0),Cs("previousSelector",A.none),Cs("execute",Zg)],qp=(e,t,o)=>{t.previousSelector(e).orThunk((()=>{const o=t.selectors;return _l(e.element,o.cell)})).each((o=>{t.focusManager.set(e,o)}))},Yp=(e,t)=>(o,n,s)=>{const r=s.cycles?e:t;return Tl(n,s.selectors.row).bind((e=>{const t=Td(e,s.selectors.cell);return hp(t,n).bind((t=>{const n=Td(o,s.selectors.row);return hp(n,e).bind((e=>{const o=((e,t)=>z(e,(e=>Td(e,t.selectors.cell))))(n,s);return r(o,e,t).map((e=>e.cell))}))}))}))},Xp=Yp(((e,t,o)=>Up(e,t,o,-1)),((e,t,o)=>jp(e,t,o,-1))),Kp=Yp(((e,t,o)=>Up(e,t,o,1)),((e,t,o)=>jp(e,t,o,1))),Jp=Yp(((e,t,o)=>Wp(e,o,t,-1)),((e,t,o)=>$p(e,o,t,-1))),Zp=Yp(((e,t,o)=>Wp(e,o,t,1)),((e,t,o)=>$p(e,o,t,1))),Qp=x([Wg(zg(Mg),ap(Xp,Kp)),Wg(zg(Bg),ip(Xp,Kp)),Wg(zg(Dg),dp(Jp)),Wg(zg(Ig),up(Zp)),Wg(zg(Ag.concat(Tg)),((e,t,o)=>yc(e.element).bind((n=>o.execute(e,t,n)))))]),eh=x([Wg(zg(Ag),Qg)]);var th=Yg(Gp,da.init,Qp,eh,(()=>A.some(qp)));const oh=[is("selector"),Cs("execute",Zg),Cs("moveOnTab",!1)],nh=(e,t,o)=>o.focusManager.get(e).bind((n=>o.execute(e,t,n))),sh=(e,t,o)=>{_l(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},rh=(e,t,o)=>Bp(e,o.selector,t,-1),ah=(e,t,o)=>Bp(e,o.selector,t,1),ih=x([Wg(zg(Dg),mp(rh)),Wg(zg(Ig),mp(ah)),Wg(Vg([Hg,zg(_g)]),((e,t,o,n)=>o.moveOnTab?mp(rh)(e,t,o,n):A.none())),Wg(Vg([Ug,zg(_g)]),((e,t,o,n)=>o.moveOnTab?mp(ah)(e,t,o,n):A.none())),Wg(zg(Tg),nh),Wg(zg(Ag),nh)]),lh=x([Wg(zg(Ag),Qg)]);var ch=Yg(oh,da.init,ih,lh,(()=>A.some(sh)));const dh=[wi("onSpace"),wi("onEnter"),wi("onShiftEnter"),wi("onLeft"),wi("onRight"),wi("onTab"),wi("onShiftTab"),wi("onUp"),wi("onDown"),wi("onEscape"),Cs("stopSpaceKeyup",!1),fs("focusIn")];var uh=Yg(dh,da.init,((e,t,o)=>[Wg(zg(Ag),o.onSpace),Wg(Vg([Ug,zg(Tg)]),o.onEnter),Wg(Vg([Hg,zg(Tg)]),o.onShiftEnter),Wg(Vg([Hg,zg(_g)]),o.onShiftTab),Wg(Vg([Ug,zg(_g)]),o.onTab),Wg(zg(Dg),o.onUp),Wg(zg(Ig),o.onDown),Wg(zg(Mg),o.onLeft),Wg(zg(Bg),o.onRight),Wg(zg(Ag),o.onSpace)]),((e,t,o)=>[...o.stopSpaceKeyup?[Wg(zg(Ag),Qg)]:[],Wg(zg(Eg),o.onEscape)]),(e=>e.focusIn));const mh=Kg.schema(),gh=Jg.schema(),ph=Hp.schema(),hh=Ap.schema(),fh=th.schema(),bh=op.schema(),vh=ch.schema(),yh=uh.schema(),xh=fa({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:mh,cyclic:gh,flow:ph,flatgrid:hh,matrix:fh,execution:bh,menu:vh,special:yh}),name:"keying",active:{events:(e,t)=>e.handler.toEvents(e,t)},apis:{focusIn:(e,t,o)=>{t.sendFocusIn(t).fold((()=>{e.getSystem().triggerFocus(e.element,e.element)}),(n=>{n(e,t,o)}))},setGridSize:(e,t,o,n,s)=>{(e=>ve(e,"setGridSize"))(o)?o.setGridSize(n,s):console.error("Layout does not support setGridSize")}},state:sp}),wh=(e,t)=>{xc((()=>{((e,t,o)=>{const n=e.components();(e=>{V(e.components(),(e=>Uo(e.element))),Po(e.element),e.syncComponents()})(e);const s=o(t),r=K(n,s);V(r,(t=>{nu(t),e.getSystem().removeFromWorld(t)})),V(s,(t=>{ou(t)?iu(e,t):(e.getSystem().addToWorld(t),iu(e,t),xt(e.element)&&su(t))})),e.syncComponents()})(e,t,(()=>z(t,e.getSystem().build)))}),e.element)},Sh=(e,t)=>{xc((()=>{((o,n,s)=>{const r=o.components(),a=q(n,(e=>$i(e).toArray()));V(r,(e=>{F(a,e)||au(e)}));const i=((e,t,o)=>rl(e,t,((t,n)=>al(e,n,t,o))))(e.element,t,e.getSystem().buildOrPatch),l=K(r,i);V(l,(e=>{ou(e)&&au(e)})),V(i,(e=>{ou(e)||ru(o,e)})),o.syncComponents()})(e,t)}),e.element)},kh=(e,t,o,n)=>{au(t);const s=al(e.element,o,n,e.getSystem().buildOrPatch);ru(e,s),e.syncComponents()},Ch=(e,t,o)=>{const n=e.getSystem().build(o);cu(e,n,t)},Oh=(e,t,o,n)=>{uu(t),Ch(e,((e,t)=>((e,t,o)=>{ct(e,o).fold((()=>{Vo(e,t)}),(e=>{No(e,t)}))})(e,t,o)),n)},_h=(e,t)=>e.components(),Th=(e,t,o,n,s)=>{const r=_h(e);return A.from(r[n]).map((o=>(s.fold((()=>uu(o)),(s=>{(t.reuseDom?kh:Oh)(e,o,n,s)})),o)))};var Eh=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Ch(e,Vo,n)},prepend:(e,t,o,n)=>{Ch(e,zo,n)},remove:(e,t,o,n)=>{const s=_h(e),r=j(s,(e=>Qe(n.element,e.element)));r.each(uu)},replaceAt:Th,replaceBy:(e,t,o,n,s)=>{const r=_h(e);return $(r,n).bind((o=>Th(e,t,0,o,s)))},set:(e,t,o,n)=>(t.reuseDom?Sh:wh)(e,n),contents:_h});const Ah=pa({fields:[As("reuseDom",!0)],name:"replacing",apis:Eh}),Mh=(e,t)=>{const o=((e,t)=>{const o=Wr(t);return pa({fields:[is("enabled")],name:e,active:{events:x(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:x({}),initialConfig:{},state:da}}},Dh=(e,t)=>{t.ignore||(hc(e.element),t.onFocus(e))};var Bh=Object.freeze({__proto__:null,focus:Dh,blur:(e,t)=>{t.ignore||fc(e.element)},isFocused:e=>bc(e.element)}),Ih=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return aa(o)},events:e=>Wr([Gr(ur(),((t,o)=>{Dh(t,e),o.stop()}))].concat(e.stopMousedown?[Gr(qs(),((e,t)=>{t.event.prevent()}))]:[]))}),Fh=[xi("onFocus"),Cs("stopMousedown",!1),Cs("ignore",!1)];const Rh=pa({fields:Fh,name:"focusing",active:Ih,apis:Bh}),Nh=(e,t,o,n)=>{const s=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each((t=>{o.get()?ka(e.element,t):Oa(e.element,t)}))})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),s!==n&&t.onToggled(e,n)},Lh=(e,t,o)=>{Nh(e,t,o,!o.get())},zh=(e,t,o)=>{Nh(e,t,o,t.selected)};var Vh=Object.freeze({__proto__:null,onLoad:zh,toggle:Lh,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{Nh(e,t,o,!0)},off:(e,t,o)=>{Nh(e,t,o,!1)},set:Nh}),Hh=Object.freeze({__proto__:null,exhibit:()=>aa({}),events:(e,t)=>{const o=(n=e,s=t,r=Lh,na((e=>{r(e,n,s)})));var n,s,r;const a=ia(e,t,zh);return Wr(G([e.toggleOnExecute?[o]:[],[a]]))}});const Ph=(e,t,o)=>{Ct(e.element,"aria-expanded",o)};var Uh=[Cs("selected",!1),fs("toggleClass"),Cs("toggleOnExecute",!0),xi("onToggled"),Os("aria",{mode:"none"},os("mode",{pressed:[Cs("syncWithExpanded",!1),Ci("update",((e,t,o)=>{Ct(e.element,"aria-pressed",o),t.syncWithExpanded&&Ph(e,0,o)}))],checked:[Ci("update",((e,t,o)=>{Ct(e.element,"aria-checked",o)}))],expanded:[Ci("update",Ph)],selected:[Ci("update",((e,t,o)=>{Ct(e.element,"aria-selected",o)}))],none:[Ci("update",b)]}))];const Wh=pa({fields:Uh,name:"toggling",active:Hh,apis:Vh,state:(!1,{init:()=>{const e=on(false);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(false),readState:()=>e.get()}}})});const jh=()=>{const e=(e,t)=>{t.stop(),Vr(e)};return[Gr(sr(),e),Gr(br(),e),Jr(Ws()),Jr(qs())]},$h=e=>Wr(G([e.map((e=>na(((t,o)=>{e(t),o.stop()})))).toArray(),jh()])),Gh="alloy.item-hover",qh="alloy.item-focus",Yh="alloy.item-toggled",Xh=e=>{(yc(e.element).isNone()||Rh.isFocused(e))&&(Rh.isFocused(e)||Rh.focus(e),zr(e,Gh,{item:e}))},Kh=e=>{zr(e,qh,{item:e})},Jh=x(Gh),Zh=x(qh),Qh=x(Yh),ef=e=>e.toggling.map((e=>e.exclusive?"menuitemradio":"menuitemcheckbox")).getOr("menuitem"),tf=[is("data"),is("components"),is("dom"),Cs("hasSubmenu",!1),fs("toggling"),Ju("itemBehaviours",[Wh,Rh,xh,qu]),Cs("ignoreFocus",!1),Cs("domModification",{}),Ci("builder",(e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:ef(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:Zu(e.itemBehaviours,[e.toggling.fold(Wh.revoke,(e=>Wh.config((e=>({aria:{mode:"checked"},...me(e,((e,t)=>"exclusive"!==t)),onToggled:(t,o)=>{p(e.onToggled)&&e.onToggled(t,o),((e,t)=>{zr(e,Yh,{item:e,state:t})})(t,o)}}))(e)))),Rh.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{Kh(e)}}),xh.config({mode:"execution"}),qu.config({store:{mode:"memory",initialValue:e.data}}),Mh("item-type-events",[...jh(),Gr(Js(),Xh),Gr(fr(),Rh.focus)])]),components:e.components,eventOrder:e.eventOrder}))),Cs("eventOrder",{})],of=[is("dom"),is("components"),Ci("builder",(e=>({dom:e.dom,components:e.components,events:Wr([Zr(fr())])})))],nf=x("item-widget"),sf=x([wm({name:"widget",overrides:e=>({behaviours:ma([qu.config({store:{mode:"manual",getValue:t=>e.data,setValue:b}})])})})]),rf=[is("uid"),is("data"),is("components"),is("dom"),Cs("autofocus",!1),Cs("ignoreFocus",!1),Ju("widgetBehaviours",[qu,Rh,xh]),Cs("domModification",{}),Um(sf()),Ci("builder",(e=>{const t=Im(nf(),e,sf()),o=Fm(nf(),e,t.internals()),n=t=>Rm(t,e,"widget").map((e=>(xh.focusIn(e),e))),s=(t,o)=>Jm(o.event.target)?A.none():e.autofocus?(o.setSource(t.element),A.none()):A.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Wr([na(((e,t)=>{n(e).each((e=>{t.stop()}))})),Gr(Js(),Xh),Gr(fr(),((t,o)=>{e.autofocus?n(t):Rh.focus(t)}))]),behaviours:Zu(e.widgetBehaviours,[qu.config({store:{mode:"memory",initialValue:e.data}}),Rh.config({ignore:e.ignoreFocus,onFocus:e=>{Kh(e)}}),xh.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:ba(),onLeft:s,onRight:s,onEscape:(t,o)=>Rh.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),A.none()):A.none():(Rh.focus(t),A.some(!0))})])}}))],af=os("type",{widget:rf,item:tf,separator:of}),lf=x([Cm({factory:{sketch:e=>{const t=es("menu.spec item",af,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>be(t,"uid")?t:{...t,uid:Vi("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),cf=x([is("value"),is("items"),is("dom"),is("components"),Cs("eventOrder",{}),Yu("menuBehaviours",[Cg,qu,eg,xh]),Os("movement",{mode:"menu",moveOnTab:!0},os("mode",{grid:[_i(),Ci("config",((e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager})))],matrix:[Ci("config",((e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager}))),is("rowSelector"),Cs("previousSelector",A.none)],menu:[Cs("moveOnTab",!0),Ci("config",((e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager})))]})),ls("markers",hi()),Cs("fakeFocus",!1),Cs("focusManager",$g()),xi("onHighlight"),xi("onDehighlight"),Cs("menuRole",!0)]),df=x("alloy.menu-focus"),uf=Km({name:"Menu",configFields:cf(),partFields:lf(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Ku(e.menuBehaviours,[Cg.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),qu.config({store:{mode:"memory",initialValue:e.value}}),eg.config({find:A.some}),xh.config(e.movement.config(e,e.movement))]),events:Wr([Gr(Zh(),((e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each((o=>{Cg.highlight(e,o),t.stop(),zr(e,df(),{menu:e,item:o})}))})),Gr(Jh(),((e,t)=>{const o=t.event.item;Cg.highlight(e,o)})),Gr(Qh(),((e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===_t(o.element,"role")&&((e,t)=>{const o=Td(e.element,'[role="menuitemradio"][aria-checked="true"]');V(o,(o=>{Qe(o,t.element)||e.getSystem().getByDom(o).each((e=>{Wh.off(e)}))}))})(e,o)}))]),components:t,eventOrder:e.eventOrder,...e.menuRole?{domModification:{attributes:{role:"menu"}}}:{}})}),mf=(e,t,o,n)=>fe(o,n).bind((n=>fe(e,n).bind((n=>{const s=mf(e,t,o,n);return A.some([n].concat(s))})))).getOr([]),gf=e=>"prepared"===e.type?A.some(e.menu):A.none(),pf=()=>{const e=on({}),t=on({}),o=on({}),n=rn(),s=on({}),r=e=>a(e).bind(gf),a=e=>fe(t.get(),e),i=t=>fe(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(r,a,i,l)=>{n.set(r),e.set(i),t.set(a),s.set(l);const c=((e,t)=>{const o={};ie(e,((e,t)=>{V(e,(e=>{o[e]=t}))}));const n=t,s=ce(t,((e,t)=>({k:e,v:t}))),r=le(s,((e,t)=>[t].concat(mf(o,n,s,t))));return le(o,(e=>fe(r,e).getOr([e])))})(l,i);o.set(c)},expand:t=>fe(e.get(),t).map((e=>{const n=fe(o.get(),t).getOr([]);return[e].concat(n)})),refresh:e=>fe(o.get(),e),collapse:e=>fe(o.get(),e).bind((e=>e.length>1?A.some(e.slice(1)):A.none())),lookupMenu:a,lookupItem:i,otherMenus:e=>{const t=s.get();return K(re(t),e)},getPrimary:()=>n.get().bind(r),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(t,s)=>{const a=P(i(t).toArray(),(e=>r(e).isSome()));return fe(o.get(),t).bind((t=>{const o=X(a.concat(t));return(e=>{const t=[];for(let o=0;o((t,o,n)=>r(t).bind((s=>(t=>pe(e.get(),((e,o)=>e===t)))(t).bind((e=>o(e).map((e=>({triggeredMenu:s,triggeringItem:e,triggeringPath:n}))))))))(t,s,o.slice(0,a+1)).fold((()=>ye(n.get(),t)?[]:[A.none()]),(e=>[A.some(e)])))))}))}}},hf=gf,ff=Bi("tiered-menu-item-highlight"),bf=Bi("tiered-menu-item-dehighlight");var vf;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(vf||(vf={}));const yf=x("collapse-item"),xf=Xm({name:"TieredMenu",configFields:[ki("onExecute"),ki("onEscape"),Si("onOpenMenu"),Si("onOpenSubmenu"),xi("onRepositionMenu"),xi("onCollapseMenu"),Cs("highlightOnOpen",vf.HighlightMenuAndItem),gs("data",[is("primary"),is("menus"),is("expansions")]),Cs("fakeFocus",!1),xi("onHighlightItem"),xi("onDehighlightItem"),xi("onHover"),bi(),is("dom"),Cs("navigateOnHover",!0),Cs("stayInDom",!1),Yu("tmenuBehaviours",[xh,Cg,eg,Ah]),Cs("eventOrder",{})],apis:{collapseMenu:(e,t)=>{e.collapseMenu(t)},highlightPrimary:(e,t)=>{e.highlightPrimary(t)},repositionMenus:(e,t)=>{e.repositionMenus(t)}},factory:(e,t)=>{const o=rn(),n=pf(),s=e=>qu.getValue(e).value,r=t=>le(e.data.menus,((e,t)=>q(e.items,(e=>"separator"===e.type?[]:[e.data.value])))),a=Cg.highlight,i=(t,o)=>{a(t,o),Cg.getHighlighted(o).orThunk((()=>Cg.getFirst(o))).each((n=>{e.fakeFocus?Cg.highlight(o,n):Hr(t,n.element,fr())}))},l=(e,t)=>xe(z(t,(t=>e.lookupMenu(t).bind((e=>"prepared"===e.type?A.some(e.menu):A.none()))))),c=(t,o,n)=>{const s=l(o,o.otherMenus(n));V(s,(o=>{Ea(o.element,[e.markers.backgroundMenu]),e.stayInDom||Ah.remove(t,o)}))},d=(t,n)=>{const r=(t=>o.get().getOrThunk((()=>{const n={},r=Td(t.element,`.${e.markers.item}`),a=P(r,(e=>"true"===_t(e,"aria-haspopup")));return V(a,(e=>{t.getSystem().getByDom(e).each((e=>{const t=s(e);n[t]=e}))})),o.set(n),n})))(t);ie(r,((e,t)=>{const o=F(n,t);Ct(e.element,"aria-expanded",o)}))},u=(t,o,n)=>A.from(n[0]).bind((s=>o.lookupMenu(s).bind((s=>{if("notbuilt"===s.type)return A.none();{const r=s.menu,a=l(o,n.slice(1));return V(a,(t=>{ka(t.element,e.markers.backgroundMenu)})),xt(r.element)||Ah.append(t,fl(r)),Ea(r.element,[e.markers.backgroundMenu]),i(t,r),c(t,o,n),A.some(r)}}))));let m;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(m||(m={}));const g=(t,o,r=m.HighlightSubmenu)=>{if(o.hasConfigured(pg)&&pg.isDisabled(o))return A.some(o);{const a=s(o);return n.expand(a).bind((s=>(d(t,s),A.from(s[0]).bind((a=>n.lookupMenu(a).bind((i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const s=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,s),s}return o.menu})(t,a,i);return xt(l.element)||Ah.append(t,fl(l)),e.onOpenSubmenu(t,o,l,X(s)),r===m.HighlightSubmenu?(Cg.highlightFirst(l),u(t,n,s)):(Cg.dehighlightAll(l),A.some(o))})))))))}},p=(t,o)=>{const r=s(o);return n.collapse(r).bind((s=>(d(t,s),u(t,n,s).map((n=>(e.onCollapseMenu(t,o,n),n))))))},h=t=>(o,n)=>Tl(n.getSource(),`.${e.markers.item}`).bind((e=>o.getSystem().getByDom(e).toOptional().bind((e=>t(o,e).map(E))))),f=Wr([Gr(df(),((e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each((()=>{const o=t.event.menu;Cg.highlight(e,o);const r=s(t.event.item);n.refresh(r).each((t=>c(e,n,t)))}))})),na(((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each((o=>{0===s(o).indexOf("collapse-item")&&p(t,o),g(t,o,m.HighlightSubmenu).fold((()=>{e.onExecute(t,o)}),b)}))})),ea(((t,o)=>{(t=>{const o=((t,o,n)=>le(n,((n,s)=>{const r=()=>uf.sketch({...n,value:s,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{zr(e,ff,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{zr(e,bf,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?Gg():$g()});return s===o?{type:"prepared",menu:t.getSystem().build(r())}:{type:"notbuilt",nbMenu:r}})))(t,e.data.primary,e.data.menus),s=r();return n.setContents(e.data.primary,o,e.data.expansions,s),n.getPrimary()})(t).each((o=>{Ah.append(t,fl(o)),e.onOpenMenu(t,o),e.highlightOnOpen===vf.HighlightMenuAndItem?i(t,o):e.highlightOnOpen===vf.HighlightJustMenu&&a(t,o)}))})),Gr(ff,((t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)})),Gr(bf,((t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)})),...e.navigateOnHover?[Gr(Jh(),((t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind((t=>(d(e,t),u(e,n,t))))})(t,r),g(t,r,m.HighlightParent),e.onHover(t,r)}))]:[]]),v=e=>Cg.getHighlighted(e).bind(Cg.getHighlighted),y={collapseMenu:e=>{v(e).each((t=>{p(e,t)}))},highlightPrimary:e=>{n.getPrimary().each((t=>{i(e,t)}))},repositionMenus:t=>{const o=n.getPrimary().bind((e=>v(t).bind((e=>{const t=s(e),o=he(n.getMenus()),r=xe(z(o,hf));return n.getTriggeringPath(t,(e=>((e,t,o)=>se(t,(e=>{if(!e.getSystem().isConnected())return A.none();const t=Cg.getCandidates(e);return j(t,(e=>s(e)===o))})))(0,r,e)))})).map((t=>({primary:e,triggeringPath:t})))));o.fold((()=>{(e=>A.from(e.components()[0]).filter((e=>"menu"===_t(e.element,"role"))))(t).each((o=>{e.onRepositionMenu(t,o,[])}))}),(({primary:o,triggeringPath:n})=>{e.onRepositionMenu(t,o,n)}))}};return{uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Ku(e.tmenuBehaviours,[xh.config({mode:"special",onRight:h(((e,t)=>Jm(t.element)?A.none():g(e,t,m.HighlightSubmenu))),onLeft:h(((e,t)=>Jm(t.element)?A.none():p(e,t))),onEscape:h(((t,o)=>p(t,o).orThunk((()=>e.onEscape(t,o).map((()=>t)))))),focusIn:(e,t)=>{n.getPrimary().each((t=>{Hr(e,t.element,fr())}))}}),Cg.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),eg.config({find:e=>Cg.getHighlighted(e)}),Ah.config({})]),eventOrder:e.eventOrder,apis:y,events:f}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:Fs(e,t),expansions:{}}),collapseItem:e=>({value:Bi(yf()),meta:{text:e}})}}),wf=Xm({name:"InlineView",configFields:[is("lazySink"),xi("onShow"),xi("onHide"),ws("onEscape"),Yu("inlineBehaviours",[Tu,qu,gc]),ks("fireDismissalEventInstead",[Cs("event",Er())]),ks("fireRepositionEventInstead",[Cs("event",Ar())]),Cs("getRelated",A.none),Cs("isExtraPart",T),Cs("eventOrder",A.none)],factory:(e,t)=>{const o=(t,o,n,s)=>{const r=e.lazySink(t).getOrDie();Tu.openWhileCloaked(t,o,(()=>tu.positionWithinBounds(r,t,n,s()))),qu.setValue(t,A.some({mode:"position",config:n,getBounds:s}))},n=(t,o,n,s)=>{const r=((e,t,o,n,s)=>{const r=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>cc(),onRtl:()=>dc()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return xf.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(Tu.close(t),e.onEscape.map((e=>e(t))),A.some(!0)),onExecute:()=>A.some(!0),onOpenMenu:(e,t)=>{tu.positionWithinBounds(r().getOrDie(),t,o,s())},onOpenSubmenu:(e,t,o,n)=>{const s=r().getOrDie();tu.position(s,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=r().getOrDie();tu.positionWithinBounds(a,t,o,s()),V(n,(e=>{const t=i(e.triggeringPath);tu.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})}))}})})(e,t,o,n,s);Tu.open(t,r),qu.setValue(t,A.some({mode:"menu",menu:r}))},s=t=>{Tu.isOpen(t)&&qu.getValue(t).each((o=>{switch(o.mode){case"menu":Tu.getState(t).each(xf.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();tu.positionWithinBounds(n,t,o.config,o.getBounds())}}))},r={setContent:(e,t)=>{Tu.setContent(e,t)},showAt:(e,t,n)=>{const s=A.none;o(e,t,n,s)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,A.none)},showMenuWithinBounds:n,hide:e=>{Tu.isOpen(e)&&(qu.setValue(e,A.none()),Tu.close(e))},getContent:e=>Tu.getState(e),reposition:s,isOpen:Tu.isOpen};return{uid:e.uid,dom:e.dom,behaviours:Ku(e.inlineBehaviours,[Tu.config({isPartOf:(t,o,n)=>Ml(o,n)||((t,o)=>e.getRelated(t).exists((e=>Ml(e,o))))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),qu.config({store:{mode:"memory",initialValue:A.none()}}),gc.config({channels:{...Bu({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...Fu({...e.fireRepositionEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({}),doReposition:s})}})]),eventOrder:e.eventOrder,apis:r}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,s)=>{e.showWithinBounds(t,o,n,s)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,s)=>{e.showMenuWithinBounds(t,o,n,s)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}});var Sf,kf,Cf=tinymce.util.Tools.resolve("tinymce.util.Delay"),Of=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),_f=tinymce.util.Tools.resolve("tinymce.EditorManager"),Tf=tinymce.util.Tools.resolve("tinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(Sf||(Sf={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(kf||(kf={}));const Ef=e=>t=>t.options.get(e),Af=e=>t=>A.from(e(t)),Mf=e=>{const t=Tf.deviceType.isPhone(),o=Tf.deviceType.isTablet()||t,n=e.options.register,s=e=>r(e)||!1===e,a=e=>r(e)||h(e);n("skin",{processor:e=>r(e)||!1===e,default:"oxide"}),n("skin_url",{processor:"string"}),n("height",{processor:a,default:Math.max(e.getElement().offsetHeight,400)}),n("width",{processor:a,default:Of.DOM.getStyle(e.getElement(),"width")}),n("min_height",{processor:"number",default:100}),n("min_width",{processor:"number"}),n("max_height",{processor:"number"}),n("max_width",{processor:"number"}),n("style_formats",{processor:"object[]"}),n("style_formats_merge",{processor:"boolean",default:!1}),n("style_formats_autohide",{processor:"boolean",default:!1}),n("line_height_formats",{processor:"string",default:"1 1.1 1.2 1.3 1.4 1.5 2"}),n("font_family_formats",{processor:"string",default:"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"}),n("font_size_formats",{processor:"string",default:"8pt 10pt 12pt 14pt 18pt 24pt 36pt"}),n("font_size_input_default_unit",{processor:"string",default:"pt"}),n("block_formats",{processor:"string",default:"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"}),n("content_langs",{processor:"object[]"}),n("removed_menuitems",{processor:"string",default:""}),n("menubar",{processor:e=>r(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||r(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),N(9,(e=>{n("toolbar"+(e+1),{processor:"string"})})),n("toolbar_mode",{processor:"string",default:o?"scrolling":"floating"}),n("toolbar_groups",{processor:"object",default:{}}),n("toolbar_location",{processor:"string",default:kf.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:s,default:"#top"}),n("anchor_bottom",{processor:s,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("promotion",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||d(e),default:!Tf.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},Df=Ef("readonly"),Bf=Ef("height"),If=Ef("width"),Ff=Af(Ef("min_width")),Rf=Af(Ef("min_height")),Nf=Af(Ef("max_width")),Lf=Af(Ef("max_height")),zf=Af(Ef("style_formats")),Vf=Ef("style_formats_merge"),Hf=Ef("style_formats_autohide"),Pf=Ef("content_langs"),Uf=Ef("removed_menuitems"),Wf=Ef("toolbar_mode"),jf=Ef("toolbar_groups"),$f=Ef("toolbar_location"),Gf=Ef("fixed_toolbar_container"),qf=Ef("fixed_toolbar_container_target"),Yf=Ef("toolbar_persist"),Xf=Ef("toolbar_sticky_offset"),Kf=Ef("menubar"),Jf=Ef("toolbar"),Zf=Ef("file_picker_callback"),Qf=Ef("file_picker_validator_handler"),eb=Ef("font_size_input_default_unit"),tb=Ef("file_picker_types"),ob=Ef("typeahead_urls"),nb=Ef("anchor_top"),sb=Ef("anchor_bottom"),rb=Ef("draggable_modal"),ab=Ef("statusbar"),ib=Ef("elementpath"),lb=Ef("branding"),cb=Ef("resize"),db=Ef("paste_as_text"),ub=Ef("sidebar_show"),mb=Ef("promotion"),gb=Ef("help_accessibility"),pb=Ef("default_font_stack"),hb=e=>!1===e.options.get("skin"),fb=e=>!1!==e.options.get("menubar"),bb=e=>{const t=e.options.get("skin_url");if(hb(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return _f.baseURL+"/skins/ui/"+t}},vb=e=>A.from(e.options.get("skin_url")),yb=e=>e.options.get("line_height_formats").split(" "),xb=e=>{const t=Jf(e),o=r(t),n=l(t)&&t.length>0;return!Sb(e)&&(n||o||!0===t)},wb=e=>{const t=N(9,(t=>e.options.get("toolbar"+(t+1)))),o=P(t,r);return ke(o.length>0,o)},Sb=e=>wb(e).fold((()=>{const t=Jf(e);return f(t,r)&&t.length>0}),E),kb=e=>$f(e)===kf.bottom,Cb=e=>{var t;if(!e.inline)return A.none();const o=null!==(t=Gf(e))&&void 0!==t?t:"";if(o.length>0)return _l(wt(),o);const n=qf(e);return g(n)?A.some(Le(n)):A.none()},Ob=e=>e.inline&&Cb(e).isSome(),_b=e=>Cb(e).getOrThunk((()=>bt(ft(Le(e.getElement()))))),Tb=e=>e.inline&&!fb(e)&&!xb(e)&&!Sb(e),Eb=e=>(e.options.get("toolbar_sticky")||e.inline)&&!Ob(e)&&!Tb(e),Ab=e=>!Ob(e)&&"split"===e.options.get("ui_mode"),Mb=e=>{const t=e.options.get("menu");return le(t,(e=>({...e,items:e.items})))};var Db=Object.freeze({__proto__:null,get ToolbarMode(){return Sf},get ToolbarLocation(){return kf},register:Mf,getSkinUrl:bb,getSkinUrlOption:vb,isReadOnly:Df,isSkinDisabled:hb,getHeightOption:Bf,getWidthOption:If,getMinWidthOption:Ff,getMinHeightOption:Rf,getMaxWidthOption:Nf,getMaxHeightOption:Lf,getUserStyleFormats:zf,shouldMergeStyleFormats:Vf,shouldAutoHideStyleFormats:Hf,getLineHeightFormats:yb,getContentLanguages:Pf,getRemovedMenuItems:Uf,isMenubarEnabled:fb,isMultipleToolbars:Sb,isToolbarEnabled:xb,isToolbarPersist:Yf,getMultipleToolbarsOption:wb,getUiContainer:_b,useFixedContainer:Ob,isSplitUiMode:Ab,getToolbarMode:Wf,isDraggableModal:rb,isDistractionFree:Tb,isStickyToolbar:Eb,getStickyToolbarOffset:Xf,getToolbarLocation:$f,isToolbarLocationBottom:kb,getToolbarGroups:jf,getMenus:Mb,getMenubar:Kf,getToolbar:Jf,getFilePickerCallback:Zf,getFilePickerTypes:tb,useTypeaheadUrls:ob,getAnchorTop:nb,getAnchorBottom:sb,getFilePickerValidatorHandler:Qf,getFontSizeInputDefaultUnit:eb,useStatusBar:ab,useElementPath:ib,promotionEnabled:mb,useBranding:lb,getResize:cb,getPasteAsText:db,getSidebarShow:ub,useHelpAccessibility:gb,getDefaultFontStack:pb});const Bb=["visible","hidden","clip"],Ib=e=>Ae(e).length>0&&!F(Bb,e),Fb=e=>{if(je(e)){const t=Rt(e,"overflow-x"),o=Rt(e,"overflow-y");return Ib(t)||Ib(o)}return!1},Rb=(e,t)=>Ab(e)?(e=>{const t=_d(e,Fb),o=0===t.length?vt(e).map(yt).map((e=>_d(e,Fb))).getOr([]):t;return te(o).map((e=>({element:e,others:o.slice(1)})))})(t):A.none(),Nb=e=>{const t=[...z(e.others,Zo),tn()];return((e,t)=>W(t,((e,t)=>en(e,t)),e))(Zo(e.element),t)},Lb=Xm({name:"Button",factory:e=>{const t=$h(e.action),o=e.dom.tag,n=t=>fe(e.dom,"attributes").bind((e=>fe(e,t)));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:Zu(e.buttonBehaviours,[Rh.config({}),xh.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:"button"===o?{type:n("type").getOr("button"),...n("role").map((e=>({role:e}))).getOr({})}:{role:e.role.getOr(n("role").getOr("button"))}},eventOrder:e.eventOrder}},configFields:[Cs("uid",void 0),is("dom"),Cs("components",[]),Ju("buttonBehaviours",[Rh,xh]),fs("action"),fs("role"),Cs("eventOrder",{})]}),zb=e=>{const t=Fe(e),o=lt(t),n=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return W(t,((e,t)=>"class"===t.name?e:{...e,[t.name]:t.value}),{})})(t),s=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),r=0===o.length?{}:{innerHtml:si(t)};return{tag:Ue(t),classes:s,attributes:n,...r}},Vb=e=>{const t=(e=>void 0!==e.uid)(e)&&ve(e,"uid")?e.uid:Vi("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}};var Hb=Object.freeze({__proto__:null,exhibit:(e,t)=>aa({attributes:Rs([{key:t.tabAttr,value:"true"}])})}),Pb=[Cs("tabAttr","data-alloy-tabstop")];const Ub=pa({fields:Pb,name:"tabstopping",active:Hb}),Wb=Bi("tooltip.exclusive"),jb=Bi("tooltip.show"),$b=Bi("tooltip.hide"),Gb=Bi("tooltip.immediateHide"),qb=Bi("tooltip.immediateShow"),Yb=(e,t,o)=>{e.getSystem().broadcastOn([Wb],{})};var Xb=Object.freeze({__proto__:null,hideAllExclusive:Yb,setComponents:(e,t,o,n)=>{o.getTooltip().each((e=>{e.getSystem().isConnected()&&Ah.set(e,n)}))}}),Kb=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each((n=>{n.getSystem().isConnected()&&(uu(n),e.onHide(o,n),t.clearTooltip())})),t.clearTimer()},n=o=>{if(!t.isShowing()){Yb(o);const n=e.lazySink(o).getOrDie(),s=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Wr("normal"===e.mode?[Gr(Js(),(e=>{Lr(o,jb)})),Gr(Xs(),(e=>{Lr(o,$b)}))]:[]),behaviours:ma([Ah.config({})])});t.setTooltip(s),lu(n,s),e.onShow(o,s),tu.position(n,s,{anchor:e.anchor(o)})}},s=o=>{t.getTooltip().each((t=>{const n=e.lazySink(o).getOrDie();tu.position(n,t,{anchor:e.anchor(o)})}))};return Wr(G([[Gr(jb,(o=>{t.resetTimer((()=>{n(o)}),e.delayForShow())})),Gr($b,(n=>{t.resetTimer((()=>{o(n)}),e.delayForHide())})),Gr(qb,(e=>{t.resetTimer((()=>{n(e)}),0)})),Gr(Gb,(e=>{t.resetTimer((()=>{o(e)}),0)})),Gr(pr(),((e,t)=>{const n=t;n.universal||F(n.channels,Wb)&&o(e)})),ta((e=>{o(e)}))],(()=>{switch(e.mode){case"normal":return[Gr(Zs(),(e=>{Lr(e,qb)})),Gr(mr(),(e=>{Lr(e,Gb)})),Gr(Js(),(e=>{Lr(e,jb)})),Gr(Xs(),(e=>{Lr(e,$b)}))];case"follow-highlight":return[Gr(Rr(),((e,t)=>{Lr(e,jb)})),Gr(Nr(),(e=>{Lr(e,$b)}))];case"children-normal":return[Gr(Zs(),((o,n)=>{yc(o.element).each((r=>{Ke(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold((()=>{Lr(o,qb)}),(n=>{t.isShowing()&&(e.onShow(o,n),s(o))}))}))})),Gr(mr(),(e=>{yc(e.element).fold((()=>{Lr(e,Gb)}),b)})),Gr(Js(),(o=>{_l(o.element,"[data-mce-tooltip]:hover").each((n=>{t.getTooltip().fold((()=>{Lr(o,jb)}),(n=>{t.isShowing()&&(e.onShow(o,n),s(o))}))}))})),Gr(Xs(),(e=>{_l(e.element,"[data-mce-tooltip]:hover").fold((()=>{Lr(e,$b)}),b)}))];default:return[Gr(Zs(),((o,n)=>{yc(o.element).each((r=>{Ke(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold((()=>{Lr(o,qb)}),(n=>{t.isShowing()&&(e.onShow(o,n),s(o))}))}))})),Gr(mr(),(e=>{yc(e.element).fold((()=>{Lr(e,Gb)}),b)}))]}})()]))}}),Jb=[is("lazySink"),is("tooltipDom"),Cs("exclusive",!0),Cs("tooltipComponents",[]),Ms("delayForShow",x(300)),Ms("delayForHide",x(300)),Es("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),Cs("anchor",(e=>({type:"hotspot",hotspot:e,layouts:{onLtr:x([oc,tc,Jl,Ql,Zl,ec]),onRtl:x([oc,tc,Jl,Ql,Zl,ec])},bubble:Gc(0,-2,{})}))),xi("onHide"),xi("onShow")],Zb=Object.freeze({__proto__:null,init:()=>{const e=rn(),t=rn(),o=()=>{e.on(clearTimeout)},n=x("not-implemented");return ua({getTooltip:t.get,isShowing:t.isSet,setTooltip:t.set,clearTooltip:t.clear,clearTimer:o,resetTimer:(t,n)=>{o(),e.set(setTimeout(t,n))},readState:n})}});const Qb=pa({fields:Jb,name:"tooltipping",active:Kb,state:Zb,apis:Xb}),{entries:ev,setPrototypeOf:tv,isFrozen:ov,getPrototypeOf:nv,getOwnPropertyDescriptor:sv}=Object;let{freeze:rv,seal:av,create:iv}=Object,{apply:lv,construct:cv}="undefined"!=typeof Reflect&&Reflect;lv||(lv=function(e,t,o){return e.apply(t,o)}),rv||(rv=function(e){return e}),av||(av=function(e){return e}),cv||(cv=function(e,t){return new e(...t)});const dv=Sv(Array.prototype.forEach),uv=Sv(Array.prototype.pop),mv=Sv(Array.prototype.push),gv=Sv(String.prototype.toLowerCase),pv=Sv(String.prototype.toString),hv=Sv(String.prototype.match),fv=Sv(String.prototype.replace),bv=Sv(String.prototype.indexOf),vv=Sv(String.prototype.trim),yv=Sv(RegExp.prototype.test),xv=(wv=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o1?o-1:0),s=1;s/gm),Vv=av(/\${[\w\W]*}/gm),Hv=av(/^data-[\-\w.\u00B7-\uFFFF]/),Pv=av(/^aria-[\-\w]+$/),Uv=av(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wv=av(/^(?:\w+script|data):/i),jv=av(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$v=av(/^html$/i);var Gv=Object.freeze({__proto__:null,MUSTACHE_EXPR:Lv,ERB_EXPR:zv,TMPLIT_EXPR:Vv,DATA_ATTR:Hv,ARIA_ATTR:Pv,IS_ALLOWED_URI:Uv,IS_SCRIPT_OR_DATA:Wv,ATTR_WHITESPACE:jv,DOCTYPE_NAME:$v});const qv=()=>"undefined"==typeof window?null:window;var Yv=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qv();const o=t=>e(t);if(o.version="3.0.5",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;const n=t.document,s=n.currentScript;let{document:r}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:p}=t,h=c.prototype,f=Ov(h,"cloneNode"),b=Ov(h,"nextSibling"),v=Ov(h,"childNodes"),y=Ov(h,"parentNode");if("function"==typeof i){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let x,w="";const{implementation:S,createNodeIterator:k,createDocumentFragment:C,getElementsByTagName:O}=r,{importNode:_}=n;let T={};o.isSupported="function"==typeof ev&&"function"==typeof y&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:E,ERB_EXPR:A,TMPLIT_EXPR:M,DATA_ATTR:D,ARIA_ATTR:B,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:F}=Gv;let{IS_ALLOWED_URI:R}=Gv,N=null;const L=kv({},[..._v,...Tv,...Ev,...Mv,...Bv]);let z=null;const V=kv({},[...Iv,...Fv,...Rv,...Nv]);let H=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),P=null,U=null,W=!0,j=!0,$=!1,G=!0,q=!1,Y=!1,X=!1,K=!1,J=!1,Z=!1,Q=!1,ee=!0,te=!1,oe=!0,ne=!1,se={},re=null;const ae=kv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=kv({},["audio","video","img","source","image","track"]);let ce=null;const de=kv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let pe=ge,he=!1,fe=null;const be=kv({},[ue,me,ge],pv);let ve;const ye=["application/xhtml+xml","text/html"];let xe,we=null;const Se=r.createElement("form"),ke=function(e){return e instanceof RegExp||e instanceof Function},Ce=function(e){if(!we||we!==e){if(e&&"object"==typeof e||(e={}),e=Cv(e),ve=ve=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,xe="application/xhtml+xml"===ve?pv:gv,N="ALLOWED_TAGS"in e?kv({},e.ALLOWED_TAGS,xe):L,z="ALLOWED_ATTR"in e?kv({},e.ALLOWED_ATTR,xe):V,fe="ALLOWED_NAMESPACES"in e?kv({},e.ALLOWED_NAMESPACES,pv):be,ce="ADD_URI_SAFE_ATTR"in e?kv(Cv(de),e.ADD_URI_SAFE_ATTR,xe):de,ie="ADD_DATA_URI_TAGS"in e?kv(Cv(le),e.ADD_DATA_URI_TAGS,xe):le,re="FORBID_CONTENTS"in e?kv({},e.FORBID_CONTENTS,xe):ae,P="FORBID_TAGS"in e?kv({},e.FORBID_TAGS,xe):{},U="FORBID_ATTR"in e?kv({},e.FORBID_ATTR,xe):{},se="USE_PROFILES"in e&&e.USE_PROFILES,W=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,$=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,Y=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Z=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,R=e.ALLOWED_URI_REGEXP||Uv,pe=e.NAMESPACE||ge,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(j=!1),Z&&(J=!0),se&&(N=kv({},[...Bv]),z=[],!0===se.html&&(kv(N,_v),kv(z,Iv)),!0===se.svg&&(kv(N,Tv),kv(z,Fv),kv(z,Nv)),!0===se.svgFilters&&(kv(N,Ev),kv(z,Fv),kv(z,Nv)),!0===se.mathMl&&(kv(N,Mv),kv(z,Rv),kv(z,Nv))),e.ADD_TAGS&&(N===L&&(N=Cv(N)),kv(N,e.ADD_TAGS,xe)),e.ADD_ATTR&&(z===V&&(z=Cv(z)),kv(z,e.ADD_ATTR,xe)),e.ADD_URI_SAFE_ATTR&&kv(ce,e.ADD_URI_SAFE_ATTR,xe),e.FORBID_CONTENTS&&(re===ae&&(re=Cv(re)),kv(re,e.FORBID_CONTENTS,xe)),oe&&(N["#text"]=!0),Y&&kv(N,["html","head","body"]),N.table&&(kv(N,["tbody"]),delete P.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw xv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw xv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=e.TRUSTED_TYPES_POLICY,w=x.createHTML("")}else void 0===x&&(x=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const s="dompurify"+(o?"#"+o:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(p,s)),null!==x&&"string"==typeof w&&(w=x.createHTML(""));rv&&rv(e),we=e}},Oe=kv({},["mi","mo","mn","ms","mtext"]),_e=kv({},["foreignobject","desc","title","annotation-xml"]),Te=kv({},["title","style","font","a","script"]),Ee=kv({},Tv);kv(Ee,Ev),kv(Ee,Av);const Ae=kv({},Mv);kv(Ae,Dv);const Me=function(e){mv(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},De=function(e,t){try{mv(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){mv(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!z[e])if(J||Z)try{Me(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Be=function(e){let t,o;if(K)e=""+e;else{const t=hv(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===ve&&pe===ge&&(e=''+e+"");const n=x?x.createHTML(e):e;if(pe===ge)try{t=(new g).parseFromString(n,ve)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(pe,"template",null);try{t.documentElement.innerHTML=he?w:n}catch(e){}}const s=t.body||t.documentElement;return e&&o&&s.insertBefore(r.createTextNode(o),s.childNodes[0]||null),pe===ge?O.call(t,Y?"html":"body")[0]:Y?t.documentElement:s},Ie=function(e){return k.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Fe=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Re=function(e,t,n){T[e]&&dv(T[e],(e=>{e.call(o,t,n,we)}))},Ne=function(e){let t;if(Re("beforeSanitizeElements",e,null),(n=e)instanceof m&&("string"!=typeof n.nodeName||"string"!=typeof n.textContent||"function"!=typeof n.removeChild||!(n.attributes instanceof u)||"function"!=typeof n.removeAttribute||"function"!=typeof n.setAttribute||"string"!=typeof n.namespaceURI||"function"!=typeof n.insertBefore||"function"!=typeof n.hasChildNodes))return Me(e),!0;var n;const s=xe(e.nodeName);if(Re("uponSanitizeElement",e,{tagName:s,allowedTags:N}),e.hasChildNodes()&&!Fe(e.firstElementChild)&&(!Fe(e.content)||!Fe(e.content.firstElementChild))&&yv(/<[/\w]/g,e.innerHTML)&&yv(/<[/\w]/g,e.textContent))return Me(e),!0;if(!N[s]||P[s]){if(!P[s]&&ze(s)){if(H.tagNameCheck instanceof RegExp&&yv(H.tagNameCheck,s))return!1;if(H.tagNameCheck instanceof Function&&H.tagNameCheck(s))return!1}if(oe&&!re[s]){const t=y(e)||e.parentNode,o=v(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n)t.insertBefore(f(o[n],!0),b(e))}return Me(e),!0}return e instanceof c&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});const o=gv(e.tagName),n=gv(t.tagName);return!!fe[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===ge?"svg"===o:t.namespaceURI===ue?"svg"===o&&("annotation-xml"===n||Oe[n]):Boolean(Ee[o]):e.namespaceURI===ue?t.namespaceURI===ge?"math"===o:t.namespaceURI===me?"math"===o&&_e[n]:Boolean(Ae[o]):e.namespaceURI===ge?!(t.namespaceURI===me&&!_e[n])&&!(t.namespaceURI===ue&&!Oe[n])&&!Ae[o]&&(Te[o]||!Ee[o]):!("application/xhtml+xml"!==ve||!fe[e.namespaceURI]))}(e)?(Me(e),!0):"noscript"!==s&&"noembed"!==s&&"noframes"!==s||!yv(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,t=fv(t,E," "),t=fv(t,A," "),t=fv(t,M," "),e.textContent!==t&&(mv(o.removed,{element:e.cloneNode()}),e.textContent=t)),Re("afterSanitizeElements",e,null),!1):(Me(e),!0)},Le=function(e,t,o){if(ee&&("id"===t||"name"===t)&&(o in r||o in Se))return!1;if(j&&!U[t]&&yv(D,t));else if(W&&yv(B,t));else if(!z[t]||U[t]){if(!(ze(e)&&(H.tagNameCheck instanceof RegExp&&yv(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&yv(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&yv(H.tagNameCheck,o)||H.tagNameCheck instanceof Function&&H.tagNameCheck(o))))return!1}else if(ce[t]);else if(yv(R,fv(o,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==bv(o,"data:")||!ie[e])if($&&!yv(I,fv(o,F,"")));else if(o)return!1;return!0},ze=function(e){return e.indexOf("-")>0},Ve=function(e){let t,o,n,s;Re("beforeSanitizeAttributes",e,null);const{attributes:r}=e;if(!r)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};for(s=r.length;s--;){t=r[s];const{name:i,namespaceURI:l}=t;o="value"===i?t.value:vv(t.value);const c=o;if(n=xe(i),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Re("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){De(i,e);continue}if(!G&&yv(/\/>/i,o)){De(i,e);continue}q&&(o=fv(o,E," "),o=fv(o,A," "),o=fv(o,M," "));const d=xe(e.nodeName);if(Le(d,n,o)){if(!te||"id"!==n&&"name"!==n||(De(i,e),o="user-content-"+o),x&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(l);else switch(p.getAttributeType(d,n)){case"TrustedHTML":o=x.createHTML(o);break;case"TrustedScriptURL":o=x.createScriptURL(o)}if(o!==c)try{l?e.setAttributeNS(l,i,o):e.setAttribute(i,o)}catch(t){De(i,e)}}else De(i,e)}Re("afterSanitizeAttributes",e,null)},He=function e(t){let o;const n=Ie(t);for(Re("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Re("uponSanitizeShadowNode",o,null),Ne(o)||(o.content instanceof a&&e(o.content),Ve(o));Re("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t,s,r,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(he=!e,he&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw xv("toString is not a function");if("string"!=typeof(e=e.toString()))throw xv("dirty is not a string, aborting")}if(!o.isSupported)return e;if(X||Ce(c),o.removed=[],"string"==typeof e&&(ne=!1),ne){if(e.nodeName){const t=xe(e.nodeName);if(!N[t]||P[t])throw xv("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Be("\x3c!----\x3e"),s=t.ownerDocument.importNode(e,!0),1===s.nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?t=s:t.appendChild(s);else{if(!J&&!q&&!Y&&-1===e.indexOf("<"))return x&&Q?x.createHTML(e):e;if(t=Be(e),!t)return J?null:Q?w:""}t&&K&&Me(t.firstChild);const d=Ie(ne?e:t);for(;r=d.nextNode();)Ne(r)||(r.content instanceof a&&He(r.content),Ve(r));if(ne)return e;if(J){if(Z)for(i=C.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(z.shadowroot||z.shadowrootmode)&&(i=_.call(n,i,!0)),i}let u=Y?t.outerHTML:t.innerHTML;return Y&&N["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&yv($v,t.ownerDocument.doctype.name)&&(u="\n"+u),q&&(u=fv(u,E," "),u=fv(u,A," "),u=fv(u,M," ")),x&&Q?x.createHTML(u):u},o.setConfig=function(e){Ce(e),X=!0},o.clearConfig=function(){we=null,X=!1},o.isValidAttribute=function(e,t,o){we||Ce({});const n=xe(e),s=xe(t);return Le(n,s,o)},o.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],mv(T[e],t))},o.removeHook=function(e){if(T[e])return uv(T[e])},o.removeHooks=function(e){T[e]&&(T[e]=[])},o.removeAllHooks=function(){T={}},o}();const Xv=e=>Yv().sanitize(e);var Kv=tinymce.util.Tools.resolve("tinymce.util.I18n");const Jv={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},Zv="temporary-placeholder",Qv=e=>()=>fe(e,Zv).getOr("!not found!"),ey=(e,t)=>{const o=e.toLowerCase();if(Kv.isRtl()){const e=((e,t)=>Ee(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return be(t,e)?e:o}return o},ty=(e,t)=>fe(t,ey(e,t)),oy=(e,t)=>{const o=t();return ty(e,o).getOrThunk(Qv(o))},ny=()=>Mh("add-focusable",[ea((e=>{Ol(e.element,"svg").each((e=>Ct(e,"focusable","false")))}))]),sy=(e,t,o,n)=>{var s,r;const a=(e=>!!Kv.isRtl()&&be(Jv,e))(t)?["tox-icon--flip"]:[],i=fe(o,ey(t,o)).or(n).getOrThunk(Qv(o));return{dom:{tag:e.tag,attributes:null!==(s=e.attributes)&&void 0!==s?s:{},classes:e.classes.concat(a),innerHtml:i},behaviours:ma([...null!==(r=e.behaviours)&&void 0!==r?r:[],ny()])}},ry=(e,t,o,n=A.none())=>sy(t,e,o(),n),ay={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},iy=Xm({name:"Notification",factory:e=>{const t=Bi("notification-text"),o=Vb({dom:zb(`${Xv(e.backstageProvider.translate(e.text))}
`),behaviours:ma([Ah.config({})])}),n=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),s=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=Vb({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(0)]},s(0)],behaviours:ma([Ah.config({})])}),a={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each((e=>{Ah.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(t)]},s(t)])}))},updateText:(e,t)=>{if(e.getSystem().isConnected()){const n=o.get(e);Ah.set(n,[ul(t)])}}},i=G([e.icon.toArray(),e.level.toArray(),e.level.bind((e=>A.from(ay[e]))).toArray()]),l=Vb(Lb.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":e.backstageProvider.translate("Close")}},components:[ry("close",{tag:"span",classes:["tox-icon"]},e.iconProvider)],buttonBehaviours:ma([Ub.config({}),Qb.config({...e.backstageProvider.tooltips.getConfig({tooltipText:e.backstageProvider.translate("Close")})})]),action:t=>{e.onAction(t)}})),c=((e,t,o)=>{const n=o(),s=j(e,(e=>be(n,ey(e,n))));return sy({tag:"div",classes:["tox-notification__icon"]},s.getOr(Zv),n,A.none())})(i,0,e.iconProvider),d=[c,{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:ma([Ah.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert","aria-labelledby":t},classes:e.level.map((e=>["tox-notification","tox-notification--in",`tox-notification--${e}`])).getOr(["tox-notification","tox-notification--in"])},behaviours:ma([Ub.config({}),Rh.config({}),xh.config({mode:"special",onEscape:t=>(e.onAction(t),A.some(!0))})]),components:d.concat(e.progress?[r.asSpec()]:[]).concat([l.asSpec()]),apis:a}},configFields:[fs("level"),is("progress"),fs("icon"),is("onAction"),is("text"),is("iconProvider"),is("backstageProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var ly=(e,t,o,n)=>{const s=t.backstage.shared,r=()=>{const t=Zo(Le(e.getContentAreaContainer()));return A.some(t)},a=e=>{r().each((t=>{V(e,(e=>{Zt(e.element)>t.width&&Bt(e.element,"width",t.width+"px")}))}))};return{open:(t,i,l)=>{const c=()=>{n.on((t=>{i();const o=l();(e=>{Ah.remove(e,d),u()})(t),((t,o)=>{0===lt(t.element).length?((t,o)=>{wf.hide(t),n.clear(),o&&e.focus()})(t,o):((e,t)=>{t&&xh.focusIn(e)})(t,o)})(t,o)}))},d=hl(iy.sketch({text:t.text,level:F(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:c,iconProvider:s.providers.icons,backstageProvider:s.providers}));if(n.isSet()){const e=fl(d);n.on((t=>{Ah.append(t,e),wf.reposition(t),Ei.refresh(t),a(t.components())}))}else{const t=hl(wf.sketch({dom:{tag:"div",classes:["tox-notifications-container"],attributes:{"aria-label":"Notifications",role:"region"}},lazySink:s.getSink,fireDismissalEventInstead:{},...s.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ma([xh.config({mode:"cyclic",selector:".tox-notification, .tox-notification a, .tox-notification button"}),Ah.config({}),...Eb(e)&&!s.header.isPositionedAtTop()?[]:[Ei.config({contextual:{lazyContext:()=>A.some(Zo(Le(e.getContentAreaContainer()))),fadeInClass:"tox-notification-container-dock-fadein",fadeOutClass:"tox-notification-container-dock-fadeout",transitionClass:"tox-notification-container-dock-transition"},modes:["top"],lazyViewport:t=>Rb(e,t.element).map((e=>({bounds:Nb(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Xt(e.element).top})}))).getOrThunk((()=>({bounds:tn(),optScrollEnv:A.none()})))})]])})),a=fl(d),i={maxHeightFunction:Uc()},l={...s.anchors.banner(),overrides:i};n.set(t),o.add(t),wf.showWithinBounds(t,a,{anchor:l},r)}h(t.timeout)&&t.timeout>0&&Cf.setEditorTimeout(e,(()=>{c()}),t.timeout);const u=()=>{n.on((e=>{wf.reposition(e),Ei.refresh(e),a(e.components())}))};return{close:c,reposition:u,text:e=>{iy.updateText(d,e)},settings:t,getEl:()=>d.element.dom,progressBar:{value:e=>{iy.updateProgress(d,e)}}}},close:e=>{e.close()},getArgs:e=>e.settings}};var cy;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(cy||(cy={}));var dy=cy;const uy="tox-menu-nav__js",my="tox-collection__item",gy="tox-swatch",py={normal:uy,color:gy},hy="tox-collection__item--enabled",fy="tox-collection__item-icon",by="tox-collection__item-label",vy="tox-collection__item-caret",yy="tox-collection__item--active",xy="tox-collection__item-container",wy="tox-collection__item-container--row",Sy=e=>fe(py,e).getOr(uy),ky=e=>"color"===e?"tox-swatches":"tox-menu",Cy=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:ky(e),tieredMenu:"tox-tiered-menu"}),Oy=e=>{const t=Cy(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:Sy(e)}},_y=(e,t,o)=>{const n=Cy(o);return{tag:"div",classes:G([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},Ty=[uf.parts.items({})],Ey=(e,t,o)=>{const n=Cy(o);return{dom:{tag:"div",classes:G([[n.tieredMenu]])},markers:Oy(o)}},Ay=x([fs("data"),Cs("inputAttributes",{}),Cs("inputStyles",{}),Cs("tag","input"),Cs("inputClasses",[]),xi("onSetValue"),Cs("styles",{}),Cs("eventOrder",{}),Yu("inputBehaviours",[qu,Rh]),Cs("selectOnFocus",!0)]),My=e=>ma([Rh.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=ol(t);t.dom.setSelectionRange(0,o.length)}:b})]),Dy=e=>({...My(e),...Ku(e.inputBehaviours,[qu.config({store:{mode:"manual",...e.data.map((e=>({initialValue:e}))).getOr({}),getValue:e=>ol(e.element),setValue:(e,t)=>{ol(e.element)!==t&&nl(e.element,t)}},onSetValue:e.onSetValue})])}),By=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),Iy=Xm({name:"Input",configFields:Ay(),factory:(e,t)=>({uid:e.uid,dom:By(e),components:[],behaviours:Dy(e),eventOrder:e.eventOrder})}),Fy=Bi("refetch-trigger-event"),Ry=Bi("redirect-menu-item-interaction"),Ny="tox-menu__searcher",Ly=e=>_l(e.element,`.${Ny}`).bind((t=>e.getSystem().getByDom(t).toOptional())),zy=Ly,Vy=e=>({fetchPattern:qu.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),Hy=e=>{const t=(e,t)=>(t.cut(),A.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return zr(e,Ry,o),A.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[my]},components:[Iy.sketch({inputClasses:[Ny,"tox-textfield"],inputAttributes:{...e.placeholder.map((t=>({placeholder:e.i18n(t)}))).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:ma([Mh(n,[Gr(or(),(e=>{Lr(e,Fy)})),Gr(er(),((e,t)=>{"Escape"===t.event.raw.key&&t.stop()}))]),xh.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,xh.name()]}})]}},Py="tox-collection--results__js",Uy=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:Bi("aria-item-search-result-id"),"aria-selected":"false"}}}:e},Wy=(e,t)=>o=>{const n=L(o,t);return z(n,(t=>({dom:e,components:t})))},jy=(e,t)=>{const o=[];let n=[];return V(e,((e,s)=>{t(e,s)?(n.length>0&&o.push(n),n=[],(be(e.dom,"innerHtml")||e.components&&e.components.length>0)&&n.push(e)):n.push(e)})),n.length>0&&o.push(n),z(o,(e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e})))},$y=(e,t,o)=>uf.parts.items({preprocess:n=>{const s=z(n,o);return"auto"!==e&&e>1?Wy({tag:"div",classes:["tox-collection__group"]},e)(s):jy(s,((e,o)=>"separator"===t[o].type))}}),Gy=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[$y(e,t,w)]}),qy=e=>R(e,(e=>"icon"in e&&void 0!==e.icon)),Yy=e=>(console.error(ts(e)),console.log(e),A.none()),Xy=(e,t,o,n,s)=>{const r=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[uf.parts.items({preprocess:e=>jy(e,((e,t)=>"separator"===a[t].type))})]});var a;return{value:e,dom:r.dom,components:r.components,items:o}},Ky=(e,t,o,n,s)=>{if("color"===s.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[uf.parts.items({preprocess:"auto"!==e?Wy({tag:"div",classes:["tox-swatches__row"]},e):w})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType&&"auto"===n){const t=Gy(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType||"searchable"===s.menuType){const t="searchable"!==s.menuType?Gy(n,o):"search-with-field"===s.searchMode.searchMode?((e,t,o)=>{const n=Bi("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[Hy({i18n:Kv.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],Py],attributes:{id:n}},components:[$y(e,t,Uy)]}]}})(n,o,s.searchMode):((e,t,o=!0)=>{const n=Bi("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",Py].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:n}},components:[$y(e,t,Uy)]}})(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===s.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[uf.parts.items({preprocess:Wy({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:_y(t,n,s.menuType),components:Ty,items:o}},Jy=ds("type"),Zy=ds("name"),Qy=ds("label"),ex=ds("text"),tx=ds("title"),ox=ds("icon"),nx=ds("value"),sx=ms("fetch"),rx=ms("getSubmenuItems"),ax=ms("onAction"),ix=ms("onItemAction"),lx=Ms("onSetup",(()=>b)),cx=ys("name"),dx=ys("text"),ux=ys("icon"),mx=ys("tooltip"),gx=ys("label"),px=ys("shortcut"),hx=ws("select"),fx=As("active",!1),bx=As("borderless",!1),vx=As("enabled",!0),yx=As("primary",!1),xx=e=>Cs("columns",e),wx=Cs("meta",{}),Sx=Ms("onAction",b),kx=e=>Ts("type",e),Cx=e=>ss("name","name",kn((()=>Bi(`${e}-name`))),jn),Ox=Nn([Jy,dx]),_x=Nn([kx("autocompleteitem"),fx,vx,wx,nx,dx,ux]),Tx=[vx,mx,ux,dx,lx],Ex=Nn([Jy,ax,px].concat(Tx)),Ax=e=>Zn("toolbarbutton",Ex,e),Mx=[fx].concat(Tx),Dx=Nn(Mx.concat([Jy,ax,px])),Bx=e=>Zn("ToggleButton",Dx,e),Ix=[Ms("predicate",T),Es("scope","node",["node","editor"]),Es("position","selection",["node","selection","line"])],Fx=Tx.concat([kx("contextformbutton"),yx,ax,rs("original",w)]),Rx=Mx.concat([kx("contextformbutton"),yx,ax,rs("original",w)]),Nx=Tx.concat([kx("contextformbutton")]),Lx=Mx.concat([kx("contextformtogglebutton")]),zx=os("type",{contextformbutton:Fx,contextformtogglebutton:Rx}),Vx=Nn([kx("contextform"),Ms("initValue",x("")),gx,hs("commands",zx),bs("launch",os("type",{contextformbutton:Nx,contextformtogglebutton:Lx}))].concat(Ix)),Hx=Nn([kx("contexttoolbar"),ds("items")].concat(Ix)),Px=[Jy,ds("src"),ys("alt"),Ds("classes",[],jn)],Ux=Nn(Px),Wx=[Jy,ex,cx,Ds("classes",["tox-collection__item-label"],jn)],jx=Nn(Wx),$x=In((()=>Xn("type",{cardimage:Ux,cardtext:jx,cardcontainer:Gx}))),Gx=Nn([Jy,Ts("direction","horizontal"),Ts("align","left"),Ts("valign","middle"),hs("items",$x)]),qx=[vx,dx,px,("menuitem",ss("value","value",kn((()=>Bi("menuitem-value"))),Pn())),wx];const Yx=Nn([Jy,gx,hs("items",$x),lx,Sx].concat(qx)),Xx=Nn([Jy,fx,ux].concat(qx)),Kx=[Jy,ds("fancytype"),Sx],Jx=[Cs("initData",{})].concat(Kx),Zx=[ws("select"),Bs("initData",{},[As("allowCustomColors",!0),Ts("storageKey","default"),Ss("colors",Pn())])].concat(Kx),Qx=os("fancytype",{inserttable:Jx,colorswatch:Zx}),ew=Nn([Jy,lx,Sx,ux].concat(qx)),tw=Nn([Jy,rx,lx,ux].concat(qx)),ow=Nn([Jy,ux,fx,lx,ax].concat(qx)),nw=(e,t,o)=>{const n=Td(e.element,"."+o);if(n.length>0){const e=$(n,(e=>{const o=e.dom.getBoundingClientRect().top,s=n[0].dom.getBoundingClientRect().top;return Math.abs(o-s)>t})).getOr(n.length);return A.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return A.none()},sw=e=>((e,t)=>ma([Mh(e,t)]))(Bi("unnamed-events"),e),rw="silver.readonly",aw=Nn([("readonly",ls("readonly",$n))]);const iw=(e,t)=>{const o=e.mainUi.outerContainer.element,n=[e.mainUi.mothership,...e.uiMotherships];t&&V(n,(e=>{e.broadcastOn([Eu()],{target:o})})),V(n,(e=>{e.broadcastOn([rw],{readonly:t})}))},lw=(e,t)=>{e.on("init",(()=>{e.mode.isReadOnly()&&iw(t,!0)})),e.on("SwitchMode",(()=>iw(t,e.mode.isReadOnly()))),Df(e)&&e.mode.set("readonly")},cw=()=>gc.config({channels:{[rw]:{schema:aw,onReceive:(e,t)=>{pg.set(e,t.readonly)}}}}),dw=e=>pg.config({disabled:e}),uw=e=>pg.config({disabled:e,disableClass:"tox-tbtn--disabled"}),mw=e=>pg.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),gw=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},pw=(e,t)=>ea((o=>{gw(e,o)((o=>{const n=e.onSetup(o);p(n)&&t.set(n)}))})),hw=(e,t)=>ta((o=>gw(e,o)(t.get()))),fw=(e,t)=>na(((o,n)=>{gw(e,o)(e.onAction),e.triggersSubmenu||t!==dy.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Lr(o,yr()),n.stop())})),bw={[hr()]:["disabling","alloy.base.behaviour","toggling","item-events"]},vw=xe,yw=(e,t,o,n)=>{const s=on(b);return{type:"item",dom:t.dom,components:vw(t.optComponents),data:e.data,eventOrder:bw,hasSubmenu:e.triggersSubmenu,itemBehaviours:ma([Mh("item-events",[fw(e,o),pw(e,s),hw(e,s)]),(r=()=>!e.enabled||n.isDisabled(),pg.config({disabled:r,disableClass:"tox-collection__item--state-disabled"})),cw(),Ah.config({})].concat(e.itemBehaviours))};var r},xw=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),ww=e=>{const t=Tf.os.isMacOS()||Tf.os.isiOS(),o=t?{alt:"\u2325",ctrl:"\u2303",shift:"\u21e7",meta:"\u2318",access:"\u2303\u2325"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),s=z(n,(e=>{const t=e.toLowerCase().trim();return be(o,t)?o[t]:e}));return t?s.join(""):s.join("+")},Sw=(e,t,o=[fy])=>ry(e,{tag:"div",classes:o},t),kw=e=>({dom:{tag:"div",classes:[by]},components:[ul(Kv.translate(e))]}),Cw=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),Ow=(e,t)=>({dom:{tag:"div",classes:[by]},components:[{dom:{tag:e.tag,styles:e.styles},components:[ul(Kv.translate(t))]}]}),_w=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[ul(ww(e))]}),Tw=e=>Sw("checkmark",e,["tox-collection__item-checkmark"]),Ew=e=>{const t=e.map((e=>({attributes:{id:Bi("menu-item"),"aria-label":Kv.translate(e)}}))).getOr({});return{tag:"div",classes:[uy,my],...t}},Aw=(e,t,o,n=A.none())=>"color"===e.presets?((e,t,o)=>{const n=e.value,s=e.iconContent.map((e=>((e,t,o)=>{const n=t();return ty(e,n).or(o).getOrThunk(Qv(n))})(e,t.icons,o))),r=e.ariaLabel.map((e=>({"aria-label":t.translate(e),"data-mce-name":e}))).getOr({});return{dom:(()=>{const e=gy,t=s.getOr(""),o={tag:"div",attributes:r,classes:[e]};return"custom"===n?{...o,tag:"button",classes:[...o.classes,"tox-swatches__picker-btn"],innerHtml:t}:"remove"===n?{...o,classes:[...o.classes,"tox-swatch--remove"],innerHtml:t}:g(n)?{...o,attributes:{...o.attributes,"data-mce-color":n},styles:{"background-color":n},innerHtml:t}:o})(),optComponents:[]}})(e,t,n):((e,t,o,n)=>{const s={tag:"div",classes:[fy]},r=o?e.iconContent.map((e=>ry(e,s,t.icons,n))).orThunk((()=>A.some({dom:s}))):A.none(),a=e.checkMark,i=A.from(e.meta).fold((()=>kw),(e=>be(e,"style")?k(Ow,e.style):kw)),l=e.htmlContent.fold((()=>e.textContent.map(i)),(e=>A.some(Cw(e,[by]))));return{dom:Ew(e.ariaLabel),optComponents:[r,l,e.shortcutContent.map(_w),a,e.caret]}})(e,t,o,n),Mw=(e,t,o)=>fe(e,"tooltipWorker").map((e=>[Qb.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:Uc}}),mode:"follow-highlight",onShow:(t,o)=>{e((e=>{Qb.setComponents(t,[ml({element:Le(e)})])}))}})])).getOrThunk((()=>o.map((e=>[Qb.config({...t.providers.tooltips.getConfig({tooltipText:e}),mode:"follow-highlight"})])).getOr([]))),Dw=(e,t)=>{const o=(e=>Of.DOM.encode(e))(Kv.translate(e));if(t.length>0){const e=new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t),"gi");return o.replace(e,(e=>`${e}`))}return o},Bw=(e,t)=>z(e,(e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":wy,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[xy,o,n,(()=>{switch(e.valign){case"top":return"tox-collection__item-container--valign-top";case"middle":return"tox-collection__item-container--valign-middle";case"bottom":return"tox-collection__item-container--valign-bottom"}})()]},components:t}})(e,Bw(e.items,t));case"cardimage":return((e,t,o)=>({dom:{tag:"img",classes:t,attributes:{src:e,alt:o.getOr("")}}}))(e.src,e.classes,e.alt);case"cardtext":const o=e.name.exists((e=>F(t.cardText.highlightOn,e))),n=o?A.from(t.cardText.matchText).getOr(""):"";return Cw(Dw(e.text,n),e.classes)}})),Iw=Em(nf(),sf()),Fw=e=>({value:zw(e)}),Rw=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Nw=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Lw=e=>Rw.test(e)||Nw.test(e),zw=e=>Oe(e,"#").toUpperCase(),Vw=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Hw=e=>{const t=Vw(e.red)+Vw(e.green)+Vw(e.blue);return Fw(t)},Pw=Math.min,Uw=Math.max,Ww=Math.round,jw=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,$w=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Gw=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),qw=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},Yw=e=>{let t,o,n;const s=(e.hue||0)%360;let r=e.saturation/100,a=e.value/100;if(r=Uw(0,Pw(r,1)),a=Uw(0,Pw(a,1)),0===r)return t=o=n=Ww(255*a),Gw(t,o,n,1);const i=s/60,l=a*r,c=l*(1-Math.abs(i%2-1)),d=a-l;switch(Math.floor(i)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=Ww(255*(t+d)),o=Ww(255*(o+d)),n=Ww(255*(n+d)),Gw(t,o,n,1)},Xw=e=>{const t=(e=>{const t=(e=>{const t=e.value.replace(Rw,((e,t,o,n)=>t+t+o+o+n+n));return{value:t}})(e),o=Nw.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o})(e),o=parseInt(t[1],16),n=parseInt(t[2],16),s=parseInt(t[3],16);return Gw(o,n,s,1)},Kw=(e,t,o,n)=>{const s=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return Gw(s,r,a,i)},Jw=e=>{if("transparent"===e)return A.some(Gw(0,0,0,0));const t=jw.exec(e);if(null!==t)return A.some(Kw(t[1],t[2],t[3],"1"));const o=$w.exec(e);return null!==o?A.some(Kw(o[1],o[2],o[3],o[4])):A.none()},Zw=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Qw=Gw(255,0,0,1),eS=(e,t)=>{e.dispatch("ResizeContent",t)},tS=(e,t)=>{e.dispatch("TextColorChange",t)},oS=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),nS=(e,t)=>()=>{e(),t()},sS=e=>aS(e,"NodeChange",(t=>{t.setEnabled(e.selection.isEditable())})),rS=(e,t)=>o=>{const n=sS(e)(o),s=((e,t)=>o=>{const n=sn(),s=()=>{o.setActive(e.formatter.match(t));const s=e.formatter.formatChanged(t,o.setActive);n.set(s)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),n.clear()}})(e,t)(o);return()=>{n(),s()}},aS=(e,t,o)=>n=>{const s=()=>o(n),r=()=>{o(n),e.on(t,s)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),e.off(t,s)}},iS=e=>t=>()=>{e.undoManager.transact((()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)}))},lS=(e,t)=>()=>e.execCommand(t);var cS=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const dS={},uS=e=>fe(dS,e).getOrThunk((()=>{const t=`tinymce-custom-colors-${e}`,o=cS.getItem(t);if(m(o)){const e=cS.getItem("tinymce-custom-colors");cS.setItem(t,g(e)?e:"[]")}const n=((e,t=10)=>{const o=cS.getItem(e),n=r(o)?JSON.parse(o):[],s=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{s.splice(e,1)};return{add:o=>{((e,t)=>{const o=I(e,t);return-1===o?A.none():A.some(o)})(s,o).each(i),s.unshift(o),s.length>t&&s.pop(),cS.setItem(e,JSON.stringify(s))},state:()=>s.slice(0)}})(t,10);return dS[e]=n,n})),mS=(e,t)=>{uS(e).add(t)},gS=(e,t,o)=>({hue:e,saturation:t,value:o}),pS=e=>{let t=0,o=0,n=0;const s=e.red/255,r=e.green/255,a=e.blue/255,i=Math.min(s,Math.min(r,a)),l=Math.max(s,Math.max(r,a));return i===l?(n=i,gS(0,0,100*n)):(t=s===i?3:a===i?1:5,t=60*(t-(s===i?r-a:a===i?s-r:a-s)/(l-i)),o=(l-i)/l,n=l,gS(Math.round(t),Math.round(100*o),Math.round(100*n)))},hS=e=>Hw(Yw(e)),fS=e=>{return(t=e,Lw(t)?A.some({value:zw(t)}):A.none()).orThunk((()=>Jw(e).map(Hw))).getOrThunk((()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,s=n[0],r=n[1],a=n[2],i=n[3];return Hw(Gw(s,r,a,i))}));var t},bS="forecolor",vS="hilitecolor",yS=e=>{const t=[];for(let o=0;ot=>t.options.get(e),wS="#000000",SS=(e,t)=>t===bS&&e.options.isSet("color_map_foreground")?xS("color_map_foreground")(e):t===vS&&e.options.isSet("color_map_background")?xS("color_map_background")(e):xS("color_map")(e),kS=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(SS(e,t).length))),CS=(e,t)=>{const o=xS("color_cols")(e),n=kS(e,t);return o===kS(e)?n:o},OS=(e,t="default")=>Math.round(t===bS?xS("color_cols_foreground")(e):t===vS?xS("color_cols_background")(e):xS("color_cols")(e)),_S=xS("custom_colors"),TS=xS("color_default_foreground"),ES=xS("color_default_background"),AS=(e,t)=>{const o=Le(e.selection.getStart()),n="hilitecolor"===t?zs(o,(e=>{if($e(e)){const t=Rt(e,"background-color");return ke(Jw(t).exists((e=>0!==e.alpha)),t)}return A.none()})).getOr("rgba(0, 0, 0, 0)"):Rt(o,"color");return Jw(n).map((e=>"#"+Hw(e).value))},MS=e=>{const t="choiceitem",o={type:t,text:"Remove color",icon:"color-swatch-remove-color",value:"remove"};return e?[o,{type:t,text:"Custom color",icon:"color-picker",value:"custom"}]:[o]},DS=(e,t,o,n)=>{"custom"===o?HS(e)((o=>{o.each((o=>{mS(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)}))}),AS(e,t).getOr(wS)):"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},BS=(e,t,o)=>e.concat((e=>z(uS(e).state(),(e=>({type:"choiceitem",text:e,icon:"checkmark",value:e}))))(t).concat(MS(o))),IS=(e,t,o)=>n=>{n(BS(e,t,o))},FS=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},RS=(e,t)=>{e.setTooltip(t)},NS=(e,t)=>o=>{const n=AS(e,t);return ye(n,o.toUpperCase())},LS=(e,t,o)=>{if(De(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",s=BS(SS(e,t),t,!1),r=j(s,(e=>e.value===o)).getOr({text:""}).text;return e.translate([n,e.translate(r)])},zS=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:LS(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:NS(e,o),columns:OS(e,o),fetch:IS(SS(e,o),o,_S(e)),onAction:t=>{DS(e,o,n.get(),b)},onItemAction:(s,r)=>{DS(e,o,r,(o=>{n.set(o),tS(e,{name:t,color:o})}))},onSetup:s=>{FS(s,t,n.get());const r=n=>{n.name===t&&(FS(s,n.name,n.color),RS(s,LS(e,o,n.color)))};return e.on("TextColorChange",r),nS(sS(e)(s),(()=>{e.off("TextColorChange",r)}))}})},VS=(e,t,o,n,s)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(RS(n,LS(e,o,s.get())),FS(n,t,s.get()),sS(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:NS(e,o),initData:{storageKey:o},onAction:n=>{DS(e,o,n.value,(o=>{s.set(o),tS(e,{name:t,color:o})}))}}]})},HS=e=>(t,o)=>{let n=!1;const s={colorpicker:o};e.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:s,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const s=o.getData().colorpicker;n?(t(A.from(s)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",s]))},onClose:b,onCancel:()=>{t(A.none())}})},PS=(e,t,o,n,s,r,a,i)=>{const l=qy(t),c=US(t,o,n,"color"!==s?"normal":"color",r,a,i);return Ky(e,l,c,n,{menuType:s})},US=(e,t,o,n,s,r,a)=>xe(z(e,(i=>{return"choiceitem"===i.type?(l=i,Zn("choicemenuitem",Xx,l)).fold(Yy,(i=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=Aw({presets:o,textContent:t?e.text:A.none(),htmlContent:A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:A.none(),checkMark:t?A.some(Tw(a.icons)):A.none(),caret:A.none(),value:e.value},a,i),c=e.text.filter(x(!t)).map((e=>Qb.config(a.tooltips.getConfig({tooltipText:a.translate(e)}))));return wn(yw({data:xw(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Wh.set(e,t)},isActive:()=>Wh.isOn(e),isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(s),b),triggersSubmenu:!1,itemBehaviours:[...c.toArray()]},l,r,a),{toggling:{toggleClass:hy,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(i,1===o,n,t,r(i.value),s,a,qy(e))))):A.none();var l}))),WS=(e,t)=>{const o=Oy(t);return 1===e?{mode:"menu",moveOnTab:!0}:"auto"===e?{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group"),previousSelector:e=>"color"===t?_l(e.element,"[aria-checked=true]"):A.none()}},jS=Bi("cell-over"),$S=Bi("cell-execute"),GS=(e,t,o)=>{const n=o=>zr(o,$S,{row:e,col:t}),s=(e,t)=>{t.stop(),n(e)};return hl({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:ma([Mh("insert-table-picker-cell",[Gr(Js(),Rh.focus),Gr(hr(),n),Gr(sr(),s),Gr(br(),s)]),Wh.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Rh.config({onFocus:o=>zr(o,jS,{row:e,col:t})})])})},qS=e=>q(e,(e=>z(e,fl))),YS=(e,t)=>ul(`${t}x${e}`),XS={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=((e,t,o)=>{const n=[];for(let t=0;t<10;t++){const o=[];for(let n=0;n<10;n++){const s=e(t+1,n+1);o.push(GS(t,n,s))}n.push(o)}return n})(o),s=YS(0,0),r=Vb({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[s],behaviours:ma([Ah.config({})])});return{type:"widget",data:{value:Bi("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Iw.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:qS(n).concat(r.asSpec()),behaviours:ma([Mh("insert-table-picker",[ea((e=>{Ah.set(r.get(e),[s])})),Kr(jS,((e,t,o)=>{const{row:s,col:a}=o.event;((e,t,o,n,s)=>{for(let n=0;n<10;n++)for(let s=0;s<10;s++)Wh.set(e[n][s],n<=t&&s<=o)})(n,s,a),Ah.set(r.get(e),[YS(s+1,a+1)])})),Kr($S,((t,o,n)=>{const{row:s,col:r}=n.event;e.onAction({numRows:s+1,numColumns:r+1}),Lr(t,yr())}))]),xh.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=((e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold((()=>BS(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o)),(e=>e.concat(MS(o))))})(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),s="color",r={...PS(Bi("menu-value"),o,(t=>{e.onAction({value:t})}),n,s,dy.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),markers:Oy(s),movement:WS(n,s),menuRole:!1};return{type:"widget",data:{value:Bi("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Iw.widget(uf.sketch(r))]}}},KS=e=>({type:"separator",dom:{tag:"div",classes:[my,"tox-collection__group-heading"]},components:e.text.map(ul).toArray()});var JS=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),ZS=[ls("others",Jn(dn.value,Pn()))],QS=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,o)=>{if(0===re(t.others).length)throw new Error("Cannot find any known coupled components");return fe(e,o)},o=x({});return ua({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk((()=>(fe(o.others,n).getOrDie("No information found for coupled component: "+n),A.none()))),getOrCreate:(o,n,s)=>t(n,s).getOrThunk((()=>{const t=fe(n.others,s).getOrDie("No information found for coupled component: "+s)(o),r=o.getSystem().build(t);return e[s]=r,r}))})}});const ek=pa({fields:ZS,name:"coupling",apis:JS,state:QS}),tk=e=>{let t=A.none(),o=[];const n=e=>{s()?r(e):o.push(e)},s=()=>t.isSome(),r=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{s()||(t=A.some(e),V(o,r),o=[])})),{get:n,map:e=>tk((t=>{n((o=>{t(e(o))}))})),isReady:s}},ok={nu:tk,pure:e=>tk((t=>{t(e)}))},nk=e=>{setTimeout((()=>{throw e}),0)},sk=e=>{const t=t=>{e().then(t,nk)};return{map:t=>sk((()=>e().then(t))),bind:t=>sk((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>sk((()=>e().then((()=>t.toPromise())))),toLazy:()=>ok.nu(t),toCached:()=>{let t=null;return sk((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},rk=e=>sk((()=>new Promise(e))),ak=e=>sk((()=>Promise.resolve(e))),ik=x("sink"),lk=x(km({name:ik(),overrides:x({dom:{tag:"div"},behaviours:ma([tu.config({useFixed:E})]),events:Wr([Jr(er()),Jr(qs()),Jr(sr())])})})),ck=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",s=e.getAnchorOverrides();return e.layouts.fold((()=>({type:n,hotspot:o,overrides:s})),(e=>({type:n,hotspot:o,overrides:s,layouts:e})))},dk=(e,t,o,n,s,r,a)=>{const i=((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=gk(n,e);return i.map((e=>e.bind((e=>A.from(xf.sketch({...r.menu(),uid:Vi(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();tu.position(n,t,{anchor:o}),Tu.decloak(s)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();tu.position(n,o,{anchor:{type:"submenu",item:t}}),Tu.decloak(s)},onRepositionMenu:(e,t,n)=>{const s=l().getOrDie();tu.position(s,t,{anchor:o}),V(n,(e=>{tu.position(s,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})}))},onEscape:()=>(Rh.focus(n),Tu.close(s),A.some(!0))}))))))})(e,t,ck(e,o),o,n,s,a);return i.map((e=>(e.fold((()=>{Tu.isOpen(n)&&Tu.close(n)}),(e=>{Tu.cloak(n),Tu.open(n,e),r(n)})),n)))},uk=(e,t,o,n,s,r,a)=>(Tu.close(n),ak(n)),mk=(e,t,o,n,s,r)=>{const a=ek.getCoupled(o,"sandbox");return(Tu.isOpen(a)?uk:dk)(e,t,o,a,n,s,r)},gk=(e,t)=>e.getSystem().getByUid(t.uid+"-"+ik()).map((e=>()=>dn.value(e))).getOrThunk((()=>t.lazySink.fold((()=>()=>dn.error(new Error("No internal sink is specified, nor could an external sink be found"))),(t=>()=>t(e))))),pk=e=>{Tu.getState(e).each((e=>{xf.repositionMenus(e)}))},hk=(e,t,o)=>{const n=Al(),s=gk(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:Zu(e.sandboxBehaviours,[qu.config({store:{mode:"memory",initialValue:t}}),Tu.config({onOpen:(s,r)=>{const a=ck(e,t);n.link(t.element),e.matchWidth&&((e,t,o)=>{const n=eg.getCurrent(t).getOr(t),s=Zt(e.element);o?Bt(n.element,"min-width",s+"px"):((e,t)=>{Jt.set(e,t)})(n.element,s)})(a.hotspot,r,e.useMinWidth),e.onOpen(a,s,r),void 0!==o&&void 0!==o.onOpen&&o.onOpen(s,r)},onClose:(e,r)=>{n.unlink(t.element),s().getOr(r).element.dom.dispatchEvent(new window.FocusEvent("focusout")),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},isPartOf:(e,o,n)=>Ml(o,n)||Ml(t,n),getAttachPoint:()=>s().getOrDie()}),eg.config({find:e=>Tu.getState(e).bind((e=>eg.getCurrent(e)))}),gc.config({channels:{...Bu({isExtraPart:T}),...Fu({doReposition:pk})}})])}},fk=e=>{const t=ek.getCoupled(e,"sandbox");pk(t)},bk=()=>[Cs("sandboxClasses",[]),Ju("sandboxBehaviours",[eg,gc,Tu,qu])],vk=x([is("dom"),is("fetch"),xi("onOpen"),wi("onExecute"),Cs("getHotspot",A.some),Cs("getAnchorOverrides",x({})),ed(),Yu("dropdownBehaviours",[Wh,ek,xh,Rh]),is("toggleClass"),Cs("eventOrder",{}),fs("lazySink"),Cs("matchWidth",!1),Cs("useMinWidth",!1),fs("role")].concat(bk())),yk=x([Sm({schema:[bi(),Cs("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),lk()]),xk=Km({name:"Dropdown",configFields:vk(),partFields:yk(),factory:(e,t,o,n)=>{const s=e=>{Tu.getState(e).each((e=>{xf.highlightPrimary(e)}))},r=(t,o,s)=>mk(e,w,t,n,o,s),a={expand:e=>{Wh.isOn(e)||r(e,b,vf.HighlightNone).get(b)},open:e=>{Wh.isOn(e)||r(e,b,vf.HighlightMenuAndItem).get(b)},refetch:t=>ek.getExistingCoupled(t,"sandbox").fold((()=>r(t,b,vf.HighlightMenuAndItem).map(b)),(o=>dk(e,w,t,o,n,b,vf.HighlightMenuAndItem).map(b))),isOpen:Wh.isOn,close:e=>{Wh.isOn(e)&&r(e,b,vf.HighlightMenuAndItem).get(b)},repositionMenus:e=>{Wh.isOn(e)&&fk(e)}},i=(e,t)=>(Vr(e),A.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.dropdownBehaviours,[Wh.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),ek.config({others:{sandbox:t=>hk(e,t,{onOpen:()=>Wh.on(t),onClose:()=>Wh.off(t)})}}),xh.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(xk.isOpen(e)){const t=ek.getCoupled(e,"sandbox");s(t)}else xk.open(e);return A.some(!0)},onEscape:(e,t)=>xk.isOpen(e)?(xk.close(e),A.some(!0)):A.none()}),Rh.config({})]),events:$h(A.some((e=>{r(e,s,vf.HighlightMenuAndItem).get(b)}))),eventOrder:{...e.eventOrder,[hr()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold((()=>({})),(e=>({role:e}))),..."button"===e.dom.tag?{type:("type",fe(e.dom,"attributes").bind((e=>fe(e,"type")))).getOr("button")}:{}}}}},apis:{open:(e,t)=>e.open(t),refetch:(e,t)=>e.refetch(t),expand:(e,t)=>e.expand(t),close:(e,t)=>e.close(t),isOpen:(e,t)=>e.isOpen(t),repositionMenus:(e,t)=>e.repositionMenus(t)}}),wk=(e,t,o)=>{zy(e).each((e=>{var n;((e,t)=>{Tt(t.element,"id").each((t=>Ct(e.element,"aria-activedescendant",t)))})(e,o),(_a((n=t).element,Py)?A.some(n.element):_l(n.element,"."+Py)).each((t=>{Tt(t,"id").each((t=>Ct(e.element,"aria-controls",t)))}))})),Ct(o.element,"aria-selected","true")},Sk=(e,t,o)=>{Ct(o.element,"aria-selected","false")},kk=e=>ek.getExistingCoupled(e,"sandbox").bind(Ly).map(Vy).map((e=>e.fetchPattern)).getOr("");var Ck;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(Ck||(Ck={}));const Ok=(e,t,o,n,s)=>{const r=o.shared.providers,a=e=>s?{...e,shortcut:A.none(),icon:e.text.isSome()?A.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,Zn("menuitem",ew,i)).fold(Yy,(e=>A.some(((e,t,o,n=!0)=>{const s=Aw({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.none(),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return yw({data:xw(e),getApi:e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o)})(a(e),t,r,n))));case"nestedmenuitem":return(e=>Zn("nestedmenuitem",tw,e))(e).fold(Yy,(e=>A.some(((e,t,o,n=!0,s=!1)=>{const r=s?(a=o.icons,Sw("chevron-down",a,[vy])):(e=>Sw("chevron-right",e,[vy]))(o.icons);var a;const i=Aw({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.some(r),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return yw({data:xw(e),getApi:e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t),setIconFill:(t,o)=>{_l(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{Ct(e,"fill",o)}))},setTooltip:t=>{const n=o.translate(t);Ct(e.element,"aria-label",n)}}),enabled:e.enabled,onAction:b,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)})(a(e),t,r,n,s))));case"togglemenuitem":return(e=>Zn("togglemenuitem",ow,e))(e).fold(Yy,(e=>A.some(((e,t,o,n=!0)=>{const s=Aw({iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,checkMark:A.some(Tw(o.icons)),caret:A.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return wn(yw({data:xw(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Wh.set(e,t)},isActive:()=>Wh.isOn(e),isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o),{toggling:{toggleClass:hy,toggleOnExecute:!1,selected:e.active}})})(a(e),t,r,n))));case"separator":return(e=>Zn("separatormenuitem",Ox,e))(e).fold(Yy,(e=>A.some(KS(e))));case"fancymenuitem":return(e=>Zn("fancymenuitem",Qx,e))(e).fold(Yy,(e=>((e,t)=>fe(XS,e.fancytype).map((o=>o(e,t))))(e,o)));default:return console.error("Unknown item in general menu",e),A.none()}var i},_k=(e,t,o,n,s,r,a)=>{const i=1===n,l=!i||qy(e);return xe(z(e,(e=>{switch(e.type){case"separator":return(n=e,Zn("Autocompleter.Separator",Ox,n)).fold(Yy,(e=>A.some(KS(e))));case"cardmenuitem":return(e=>Zn("cardmenuitem",Yx,e))(e).fold(Yy,(e=>A.some(((e,t,o,n)=>{const s={dom:Ew(e.label),optComponents:[A.some({dom:{tag:"div",classes:[xy,wy]},components:Bw(e.items,n)})]};return yw({data:xw({text:A.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>{pg.set(e,!t),V(Td(e.element,"*"),(o=>{e.getSystem().getByDom(o).each((e=>{e.hasConfigured(pg)&&pg.set(e,!t)}))}))}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:A.from(n.itemBehaviours).getOr([])},s,t,o.providers)})({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},s,r,{itemBehaviours:Mw(e.meta,r,A.none()),cardText:{matchText:t,highlightOn:a}}))));default:return(e=>Zn("Autocompleter.Item",_x,e))(e).fold(Yy,(e=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=Aw({presets:n,textContent:A.none(),htmlContent:o?e.text.map((e=>Dw(e,t))):A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:A.none(),checkMark:A.none(),caret:A.none(),value:e.value},a.providers,i,e.icon),c=e.text.filter((e=>!o&&""!==e));return yw({data:xw(e),enabled:e.enabled,getApi:x({}),onAction:t=>s(e.value,e.meta),onSetup:x(b),triggersSubmenu:!1,itemBehaviours:Mw(e,a,c)},l,r,a.providers)})(e,t,i,"normal",o,s,r,l))))}var n})))},Tk=(e,t,o,n,s,r)=>{const a=qy(t),i=xe(z(t,(e=>{const t=e=>Ok(e,o,n,(e=>s?!be(e,"text"):a)(e),s);return"nestedmenuitem"===e.type&&e.getSubmenuItems().length<=0?t({...e,enabled:!1}):t(e)}))),l=(e=>"no-search"===e.searchMode?{menuType:"normal"}:{menuType:"searchable",searchMode:e})(r);return(s?Xy:Ky)(e,a,i,1,l)},Ek=e=>xf.singleData(e.value,e),Ak=e=>hd(Le(e.startContainer),e.startOffset,Le(e.endContainer),e.endOffset),Mk=(e,t)=>{const o=Bi("autocompleter"),n=on(!1),s=on(!1),r=rn(),a=hl(wf.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:ma([Mh("dismissAutocompleter",[Gr(Er(),(()=>u())),Gr(Rr(),((t,o)=>{Tt(o.event.target,"id").each((t=>Ct(Le(e.getBody()),"aria-activedescendant",t)))}))])]),lazySink:t.getSink})),i=()=>wf.isOpen(a),l=s.get,c=()=>{if(i()){wf.hide(a),e.dom.remove(o,!1);const t=Le(e.getBody());Tt(t,"aria-owns").filter((e=>e===o)).each((()=>{At(t,"aria-owns"),At(t,"aria-activedescendant")}))}},d=()=>wf.getContent(a).bind((e=>ee(e.components(),0))),u=()=>e.execCommand("mceAutocompleterClose"),m=s=>{const i=(o=>{const s=se(o,(e=>A.from(e.columns))).getOr(1);return q(o,(o=>{const a=o.items;return _k(a,o.matchText,((t,s)=>{const a={hide:()=>u(),reload:t=>{c(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};e.execCommand("mceAutocompleterRefreshActiveRange"),r.get().each((e=>{n.set(!0),o.onAction(a,e,t,s),n.set(!1)}))}),s,dy.BUBBLE_TO_SANDBOX,t,o.highlightOn)}))})(s);i.length>0?(((t,o)=>{const n=se(t,(e=>A.from(e.columns))).getOr(1);wf.showMenuAt(a,{anchor:{type:"selection",getSelection:()=>r.get().map(Ak),root:Le(e.getBody())}},((e,t,o,n)=>{const s=WS(t,n),r=Oy(n);return{data:Ek({...e,movement:s,menuBehaviours:sw("auto"!==t?[]:[ea(((e,t)=>{nw(e,4,r.item).each((({numColumns:t,numRows:o})=>{xh.setGridSize(e,o,t)}))}))])}),menu:{markers:Oy(n),fakeFocus:o===Ck.ContentFocus}}})(Ky("autocompleter-value",!0,o,n,{menuType:"normal"}),n,Ck.ContentFocus,"normal")),d().each(Cg.highlightFirst)})(s,i),Ct(Le(e.getBody()),"aria-owns",o),e.inline||g()):c()},g=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),s=(e=>ai(e,!0))(a.element);It(s,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${n.offsetTop}px`,left:`${n.offsetLeft}px`}),e.dom.add(t,s.dom),_l(s,'[role="menu"]').each((e=>{Ht(e,"position"),Ht(e,"max-height")}))};e.on("AutocompleterStart",(({lookupData:e})=>{s.set(!0),n.set(!1),m(e)})),e.on("AutocompleterUpdate",(({lookupData:e})=>m(e))),e.on("AutocompleterUpdateActiveRange",(({range:e})=>r.set(e))),e.on("AutocompleterEnd",(()=>{c(),s.set(!1),n.set(!1),r.clear()}));((e,t)=>{const o=(e,t)=>{zr(e,er(),{raw:t})},n=()=>e.getMenu().bind(Cg.getHighlighted);t.on("keydown",(t=>{const s=t.which;e.isActive()&&(e.isMenuOpen()?13===s?(n().each(Vr),t.preventDefault()):40===s?(n().fold((()=>{e.getMenu().each(Cg.highlightFirst)}),(e=>{o(e,t)})),t.preventDefault(),t.stopImmediatePropagation()):37!==s&&38!==s&&39!==s||n().each((e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()})):13!==s&&38!==s&&40!==s||e.cancelIfNecessary())})),t.on("NodeChange",(()=>{!e.isActive()||e.isProcessingAction()||t.queryCommandState("mceAutoCompleterInRange")||e.cancelIfNecessary()}))})({cancelIfNecessary:u,isMenuOpen:i,isActive:l,isProcessingAction:n.get,getMenu:d},e)},Dk=(e,t,o)=>Tl(e,t,o).isSome(),Bk=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout((()=>{e.apply(null,n),o=null}),t)}}},Ik=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])},Fk=(e,t)=>{const o={stopBackspace:!0,...t},n=(e=>{const t=rn(),o=on(!1),n=Bk((t=>{e.triggerEvent(vr(),t),o.set(!0)}),400),s=Rs([{key:Ws(),value:e=>(Ik(e).each((s=>{n.cancel();const r={x:s.clientX,y:s.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(r)})),A.none())},{key:js(),value:e=>(n.cancel(),Ik(e).each((e=>{t.on((o=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(e,o)&&t.clear()}))})),A.none())},{key:$s(),value:s=>(n.cancel(),t.get().filter((e=>Qe(e.target,s.target))).map((t=>o.get()?(s.prevent(),!1):e.triggerEvent(br(),s))))}]);return{fireIfReady:(e,t)=>fe(s,t).bind((t=>t(e)))}})(o),s=z(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),(t=>Fc(e,t,(e=>{n.fireIfReady(e,t).each((t=>{t&&e.kill()})),o.triggerEvent(t,e)&&e.kill()})))),r=rn(),a=Fc(e,"paste",(e=>{n.fireIfReady(e,"paste").each((t=>{t&&e.kill()})),o.triggerEvent("paste",e)&&e.kill(),r.set(setTimeout((()=>{o.triggerEvent(gr(),e)}),0))})),i=Fc(e,"keydown",(e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===Og[0]&&!F(["input","textarea"],Ue(e.target))&&!Dk(e.target,'[contenteditable="true"]'))(e)&&e.prevent()})),l=Fc(e,"focusin",(e=>{o.triggerEvent("focusin",e)&&e.kill()})),c=rn(),d=Fc(e,"focusout",(e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout((()=>{o.triggerEvent(mr(),e)}),0))}));return{unbind:()=>{V(s,(e=>{e.unbind()})),i.unbind(),l.unbind(),d.unbind(),a.unbind(),r.on(clearTimeout),c.on(clearTimeout)}}},Rk=(e,t)=>{const o=fe(e,"target").getOr(t);return on(o)},Nk=Is([{stopped:[]},{resume:["element"]},{complete:[]}]),Lk=(e,t,o,n,s,r)=>{const a=e(t,n),i=((e,t)=>{const o=on(!1),n=on(!1);return{stop:()=>{o.set(!0)},cut:()=>{n.set(!0)},isStopped:o.get,isCut:n.get,event:e,setSource:t.set,getSource:t.get}})(o,s);return a.fold((()=>(r.logEventNoHandlers(t,n),Nk.complete())),(e=>{const o=e.descHandler;return Yi(o)(i),i.isStopped()?(r.logEventStopped(t,e.element,o.purpose),Nk.stopped()):i.isCut()?(r.logEventCut(t,e.element,o.purpose),Nk.complete()):rt(e.element).fold((()=>(r.logNoParent(t,e.element,o.purpose),Nk.complete())),(n=>(r.logEventResponse(t,e.element,o.purpose),Nk.resume(n))))}))},zk=(e,t,o,n,s,r)=>Lk(e,t,o,n,s,r).fold(E,(n=>zk(e,t,o,n,s,r)),T),Vk=(e,t,o,n,s)=>{const r=Rk(o,n);return zk(e,t,o,n,r,s)},Hk=()=>{const e=(()=>{const e={};return{registerId:(t,o,n)=>{ie(n,((n,s)=>{const r=void 0!==e[s]?e[s]:{};r[o]=((e,t)=>({cHandler:k.apply(void 0,[e.handler].concat(t)),purpose:e.purpose}))(n,t),e[s]=r}))},unregisterId:t=>{ie(e,((e,o)=>{be(e,t)&&delete e[t]}))},filterByType:t=>fe(e,t).map((e=>ge(e,((e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))))).getOr([]),find:(t,o,n)=>fe(e,o).bind((e=>zs(n,(t=>((e,t)=>zi(t).bind((t=>fe(e,t))).map((e=>((e,t)=>({element:e,descHandler:t}))(t,e))))(e,t)),t)))}})(),t={},o=o=>{zi(o.element).each((o=>{delete t[o],e.unregisterId(o)}))};return{find:(t,o,n)=>e.find(t,o,n),filter:t=>e.filterByType(t),register:n=>{const s=(e=>{const t=e.element;return zi(t).getOrThunk((()=>((e,t)=>{const o=Bi(Ri+"uid-");return Li(t,o),o})(0,e.element)))})(n);ve(t,s)&&((e,n)=>{const s=t[n];if(s!==e)throw new Error('The tagId "'+n+'" is already used by: '+ii(s.element)+"\nCannot use it for: "+ii(e.element)+"\nThe conflicting element is"+(xt(s.element)?" ":" not ")+"already in the DOM");o(e)})(n,s);const r=[n];e.registerId(r,s,n.events),t[s]=n},unregister:o,getById:e=>fe(t,e)}},Pk=Xm({name:"Container",factory:e=>{const{attributes:t,...o}=e.dom;return{uid:e.uid,dom:{tag:"div",attributes:{role:"presentation",...t},...o},components:e.components,behaviours:Xu(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[Cs("components",[]),Yu("containerBehaviours",[]),Cs("events",{}),Cs("domModification",{}),Cs("eventOrder",{})]}),Uk=e=>{const t=t=>rt(e.element).fold(E,(e=>Qe(t,e))),o=Hk(),n=(e,n)=>o.find(t,e,n),s=Fk(e.element,{triggerEvent:(e,t)=>ui(e,t.target,(o=>((e,t,o,n)=>Vk(e,t,o,o.target,n))(n,e,t,o)))}),r={debugInfo:x("real"),triggerEvent:(e,t,o)=>{ui(e,t,(s=>Vk(n,e,o,t,s)))},triggerFocus:(e,t)=>{zi(e).fold((()=>{hc(e)}),(o=>{ui(ur(),e,(o=>(((e,t,o,n,s)=>{const r=Rk(o,n);Lk(e,t,o,n,r,s)})(n,ur(),{originator:t,kill:b,prevent:b,target:e},e,o),!1)))}))},triggerEscape:(e,t)=>{r.triggerEvent("keydown",e.element,t.event)},getByUid:e=>p(e),getByDom:e=>h(e),build:hl,buildOrPatch:pl,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{u(e)},broadcastOn:(e,t)=>{m(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:E},a=e=>{e.connect(r),Ge(e.element)||(o.register(e),V(e.components(),a),r.triggerEvent(wr(),e.element,{target:e.element}))},i=e=>{Ge(e.element)||(V(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{lu(e,t)},c=e=>{uu(e)},d=e=>{const t=o.filter(pr());V(t,(t=>{const o=t.descHandler;Yi(o)(e)}))},u=e=>{d({universal:!0,data:e})},m=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>((e,t,o)=>{const n=(e=>{const t=on(!1);return{stop:()=>{t.set(!0)},cut:b,isStopped:t.get,isCut:T,event:e,setSource:O("Cannot set source of a broadcasted event"),getSource:O("Cannot get source of a broadcasted event")}})(t);return V(e,(e=>{const t=e.descHandler;Yi(t)(n)})),n.isStopped()})(o.filter(e),t),p=e=>o.getById(e).fold((()=>dn.error(new Error('Could not find component with uid: "'+e+'" in system.'))),dn.value),h=e=>{const t=zi(e).getOr("not found");return p(t)};return a(e),{root:e,element:e.element,destroy:()=>{s.unbind(),Uo(e.element)},add:l,remove:c,getByUid:p,getByDom:h,addToWorld:a,removeFromWorld:i,broadcast:u,broadcastOn:m,broadcastEvent:g}},Wk=x([Cs("prefix","form-field"),Yu("fieldBehaviours",[eg,qu])]),jk=x([km({schema:[is("dom")],name:"label"}),km({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[is("text")],name:"aria-descriptor"}),wm({factory:{sketch:e=>{const t=((e,t)=>{const o={};return ie(e,((e,n)=>{F(t,n)||(o[n]=e)})),o})(e,["factory"]);return e.factory.sketch(t)}},schema:[is("factory")],name:"field"})]),$k=Km({name:"FormField",configFields:Wk(),partFields:jk(),factory:(e,t,o,n)=>{const s=Ku(e.fieldBehaviours,[eg.config({find:t=>Rm(t,e,"field")}),qu.config({store:{mode:"manual",getValue:e=>eg.getCurrent(e).bind(qu.getValue),setValue:(e,t)=>{eg.getCurrent(e).each((e=>{qu.setValue(e,t)}))}}})]),r=Wr([ea(((t,o)=>{const n=Lm(t,e,["label","field","aria-descriptor"]);n.field().each((t=>{const o=Bi(e.prefix);n.label().each((e=>{Ct(e.element,"for",o),Ct(t.element,"id",o)})),n["aria-descriptor"]().each((o=>{const n=Bi(e.prefix);Ct(o.element,"id",n),Ct(t.element,"aria-describedby",n)}))}))}))]),a={getField:t=>Rm(t,e,"field"),getLabel:t=>Rm(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:s,events:r,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}});var Gk=tinymce.util.Tools.resolve("tinymce.html.Entities");const qk=(e,t,o,n)=>{const s=Yk(e,t,o,n);return $k.sketch(s)},Yk=(e,t,o,n)=>({dom:Xk(o),components:e.toArray().concat([t]),fieldBehaviours:ma(n)}),Xk=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),Kk=(e,t)=>$k.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[ul(t.translate(e))]}),Jk=Bi("form-component-change"),Zk=Bi("form-close"),Qk=Bi("form-cancel"),eC=Bi("form-action"),tC=Bi("form-submit"),oC=Bi("form-block"),nC=Bi("form-unblock"),sC=Bi("form-tabchange"),rC=Bi("form-resize"),aC=(e,t,o)=>{const n=e.label.map((e=>Kk(e,t))),s=t.icons(),r=e=>(t,o)=>{Tl(o.event.target,"[data-collection-item-value]").each((n=>{e(t,o,n,_t(n,"data-collection-item-value"))}))},a=r(((o,n,s,r)=>{n.stop(),t.isDisabled()||zr(o,eC,{name:e.name,value:r})})),i=[Gr(Js(),r(((e,t,o)=>{hc(o)}))),Gr(sr(),a),Gr(br(),a),Gr(Zs(),r(((e,t,o)=>{_l(e.element,"."+yy).each((e=>{Oa(e,yy)})),ka(o,yy)}))),Gr(Qs(),r((e=>{_l(e.element,"."+yy).each((e=>{Oa(e,yy),fc(e)}))}))),na(r(((t,o,n,s)=>{zr(t,eC,{name:e.name,value:s})})))],l=(e,t)=>z(Td(e.element,".tox-collection__item"),t),c=$k.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:w},behaviours:ma([pg.config({disabled:t.isDisabled,onDisabled:e=>{l(e,(e=>{ka(e,"tox-collection__item--state-disabled"),Ct(e,"aria-disabled",!0)}))},onEnabled:e=>{l(e,(e=>{Oa(e,"tox-collection__item--state-disabled"),At(e,"aria-disabled")}))}}),cw(),Ah.config({}),Qb.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{_l(e.element,"."+yy+"[data-mce-tooltip]").each((o=>{Tt(o,"data-mce-tooltip").each((o=>{Qb.setComponents(e,t.tooltips.getComponents({tooltipText:o}))}))}))}}),mode:"children-keyboard-focus",anchor:e=>({type:"node",node:_l(e.element,"."+yy).orThunk((()=>Ze(".tox-collection__item"))),root:e.element,layouts:{onLtr:x([oc,tc,Jl,Ql,Zl,ec]),onRtl:x([oc,tc,Jl,Ql,Zl,ec])},bubble:Gc(0,-2,{})})}),qu.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(o,n)=>{((o,n)=>{const r=z(n,(o=>{const n=Kv.translate(o.text),r=1===e.columns?`${n}
`:"",a=`${(e=>{var t;return null!==(t=s[e])&&void 0!==t?t:e})(o.icon)}
`,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,(e=>i[e]));return`${a}${r}
`})),a="auto"!==e.columns&&e.columns>1?L(r,e.columns):[r],i=z(a,(e=>`${e.join("")}
`));ri(o.element,i.join(""))})(o,n),"auto"===e.columns&&nw(o,5,"tox-collection__item").each((({numRows:e,numColumns:t})=>{xh.setGridSize(o,e,t)})),Lr(o,rC)}}),Ub.config({}),xh.config((d=e.columns,"normal",1===d?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===d?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:".tox-collection__group",cell:`.${my}`}})),Mh("collection-events",i)]),eventOrder:{[hr()]:["disabling","alloy.base.behaviour","collection-events"],[Zs()]:["collection-events","tooltipping"]}});var d;return qk(n,c,["tox-form__group--collection"],[])},iC=["input","textarea"],lC=e=>{const t=Ue(e);return F(iC,t)},cC=(e,t)=>{const o=t.getRoot(e).getOr(e.element);Oa(o,t.invalidClass),t.notify.each((t=>{lC(e.element)&&Ct(e.element,"aria-invalid",!1),t.getContainer(e).each((e=>{ri(e,t.validHtml)})),t.onValid(e)}))},dC=(e,t,o,n)=>{const s=t.getRoot(e).getOr(e.element);ka(s,t.invalidClass),t.notify.each((t=>{lC(e.element)&&Ct(e.element,"aria-invalid",!0),t.getContainer(e).each((e=>{ri(e,n)})),t.onInvalid(e,n)}))},uC=(e,t,o)=>t.validator.fold((()=>ak(dn.value(!0))),(t=>t.validate(e))),mC=(e,t,o)=>(t.notify.each((t=>{t.onValidate(e)})),uC(e,t).map((o=>e.getSystem().isConnected()?o.fold((o=>(dC(e,t,0,o),dn.error(o))),(o=>(cC(e,t),dn.value(o)))):dn.error("No longer in system"))));var gC=Object.freeze({__proto__:null,markValid:cC,markInvalid:dC,query:uC,run:mC,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return _a(o,t.invalidClass)}}),pC=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map((t=>Wr([Gr(t.onEvent,(t=>{mC(t,e).get(w)}))].concat(t.validateOnLoad?[ea((t=>{mC(t,e).get(b)}))]:[])))).getOr({})}),hC=[is("invalidClass"),Cs("getRoot",A.none),ks("notify",[Cs("aria","alert"),Cs("getContainer",A.none),Cs("validHtml",""),xi("onValid"),xi("onInvalid"),xi("onValidate")]),ks("validator",[is("validate"),Cs("onEvent","input"),Cs("validateOnLoad",!0)])];const fC=pa({fields:hC,name:"invalidating",active:pC,apis:gC,extra:{validation:e=>t=>{const o=qu.getValue(t);return ak(e(o))}}}),bC=pa({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Wr([jr(lr(),E)]),exhibit:()=>aa({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),vC=Bi("color-input-change"),yC=Bi("color-swatch-change"),xC=Bi("color-picker-cancel"),wC=km({schema:[is("dom")],name:"label"}),SC=e=>km({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold((()=>({})),(e=>({events:Wr([qr(Ws(),((t,o,n)=>e(t,n)),[t]),qr(qs(),((t,o,n)=>e(t,n)),[t]),qr(Ys(),((t,o,n)=>{n.mouseIsDown.get()&&e(t,n)}),[t])])})))}),kC=SC("top-left"),CC=SC("top"),OC=SC("top-right"),_C=SC("right"),TC=SC("bottom-right"),EC=SC("bottom"),AC=SC("bottom-left"),MC=SC("left"),DC=wm({name:"thumb",defaults:x({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Wr([Xr(Ws(),e,"spectrum"),Xr(js(),e,"spectrum"),Xr($s(),e,"spectrum"),Xr(qs(),e,"spectrum"),Xr(Ys(),e,"spectrum"),Xr(Ks(),e,"spectrum")])})}),BC=e=>Hg(e.event);var IC=[wC,MC,_C,CC,EC,kC,OC,AC,TC,DC,wm({schema:[rs("mouseIsDown",(()=>on(!1)))],name:"spectrum",overrides:e=>{const t=e.model.manager,o=(o,n)=>t.getValueFromEvent(n).map((n=>t.setValueFrom(o,e,n)));return{behaviours:ma([xh.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,BC(n)),onRight:(o,n)=>t.onRight(o,e,BC(n)),onUp:(o,n)=>t.onUp(o,e,BC(n)),onDown:(o,n)=>t.onDown(o,e,BC(n))}),Ub.config({}),Rh.config({})]),events:Wr([Gr(Ws(),o),Gr(js(),o),Gr(qs(),o),Gr(Ys(),((t,n)=>{e.mouseIsDown.get()&&o(t,n)}))])}}})];const FC=x("slider.change.value"),RC=e=>{const t=e.event.raw;if((e=>-1!==e.type.indexOf("touch"))(t)){const e=t;return void 0!==e.touches&&1===e.touches.length?A.some(e.touches[0]).map((e=>qt(e.clientX,e.clientY))):A.none()}{const e=t;return void 0!==e.clientX?A.some(e).map((e=>qt(e.clientX,e.clientY))):A.none()}},NC=e=>e.model.minX,LC=e=>e.model.minY,zC=e=>e.model.minX-1,VC=e=>e.model.minY-1,HC=e=>e.model.maxX,PC=e=>e.model.maxY,UC=e=>e.model.maxX+1,WC=e=>e.model.maxY+1,jC=(e,t,o)=>t(e)-o(e),$C=e=>jC(e,HC,NC),GC=e=>jC(e,PC,LC),qC=e=>$C(e)/2,YC=e=>GC(e)/2,XC=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,KC=e=>e.snapToGrid,JC=e=>e.snapStart,ZC=e=>e.rounded,QC=(e,t)=>void 0!==e[t+"-edge"],eO=e=>QC(e,"left"),tO=e=>QC(e,"right"),oO=e=>QC(e,"top"),nO=e=>QC(e,"bottom"),sO=e=>e.model.value.get(),rO=(e,t)=>({x:e,y:t}),aO=(e,t)=>{zr(e,FC(),{value:t})},iO=(e,t,o,n)=>eo?o:e===t?t-1:Math.max(t,e-n),lO=(e,t,o,n)=>e>o?e:eMath.max(t,Math.min(o,e)),dO=e=>{const{min:t,max:o,range:n,value:s,step:r,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:u,maxBound:m,screenRange:g}=e,p=c?t-1:t,h=d?o+1:o;if(sm)return h;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(s,u,m),c=cO(e/g*n+t,p,h);return a&&c>=t&&c<=o?((e,t,o,n,s)=>s.fold((()=>{const s=e-t,r=Math.round(s/n)*n;return cO(t+r,t-1,o+1)}),(t=>{const s=(e-t)%n,r=Math.round(s/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+r)*n;return Math.max(t,l)})))(c,t,o,r,i):l?Math.round(c):c}},uO=e=>{const{min:t,max:o,range:n,value:s,hasMinEdge:r,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return so?a?i:d:(s-t)/n*l},mO="top",gO="right",pO="bottom",hO="left",fO=e=>e.element.dom.getBoundingClientRect(),bO=(e,t)=>e[t],vO=e=>{const t=fO(e);return bO(t,hO)},yO=e=>{const t=fO(e);return bO(t,gO)},xO=e=>{const t=fO(e);return bO(t,mO)},wO=e=>{const t=fO(e);return bO(t,pO)},SO=e=>{const t=fO(e);return bO(t,"width")},kO=e=>{const t=fO(e);return bO(t,"height")},CO=(e,t,o)=>(e+t)/2-o,OO=(e,t)=>{const o=fO(e),n=fO(t),s=bO(o,hO),r=bO(o,gO),a=bO(n,hO);return CO(s,r,a)},_O=(e,t)=>{const o=fO(e),n=fO(t),s=bO(o,mO),r=bO(o,pO),a=bO(n,mO);return CO(s,r,a)},TO=(e,t)=>{zr(e,FC(),{value:t})},EO=(e,t,o)=>{const n={min:NC(t),max:HC(t),range:$C(t),value:o,step:XC(t),snap:KC(t),snapStart:JC(t),rounded:ZC(t),hasMinEdge:eO(t),hasMaxEdge:tO(t),minBound:vO(e),maxBound:yO(e),screenRange:SO(e)};return dO(n)},AO=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?lO:iO)(sO(o),NC(o),HC(o),XC(o,n));return TO(t,s),A.some(s)})(e,t,o,n).map(E),MO=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=SO(e),a=n.bind((t=>A.some(OO(t,e)))).getOr(0),i=s.bind((t=>A.some(OO(t,e)))).getOr(r),l={min:NC(t),max:HC(t),range:$C(t),value:o,hasMinEdge:eO(t),hasMaxEdge:tO(t),minBound:vO(e),minOffset:0,maxBound:yO(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return uO(l)})(t,r,o,n,s);return vO(t)-vO(e)+a},DO=AO(-1),BO=AO(1),IO=A.none,FO=A.none,RO={"top-left":A.none(),top:A.none(),"top-right":A.none(),right:A.some(((e,t)=>{aO(e,UC(t))})),"bottom-right":A.none(),bottom:A.none(),"bottom-left":A.none(),left:A.some(((e,t)=>{aO(e,zC(t))}))};var NO=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=EO(e,t,o);return TO(e,n),n},setToMin:(e,t)=>{const o=NC(t);TO(e,o)},setToMax:(e,t)=>{const o=HC(t);TO(e,o)},findValueOfOffset:EO,getValueFromEvent:e=>RC(e).map((e=>e.left)),findPositionOfValue:MO,setPositionFromValue:(e,t,o,n)=>{const s=sO(o),r=MO(e,n.getSpectrum(e),s,n.getLeftEdge(e),n.getRightEdge(e),o),a=Zt(t.element)/2;Bt(t.element,"left",r-a+"px")},onLeft:DO,onRight:BO,onUp:IO,onDown:FO,edgeActions:RO});const LO=(e,t)=>{zr(e,FC(),{value:t})},zO=(e,t,o)=>{const n={min:LC(t),max:PC(t),range:GC(t),value:o,step:XC(t),snap:KC(t),snapStart:JC(t),rounded:ZC(t),hasMinEdge:oO(t),hasMaxEdge:nO(t),minBound:xO(e),maxBound:wO(e),screenRange:kO(e)};return dO(n)},VO=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?lO:iO)(sO(o),LC(o),PC(o),XC(o,n));return LO(t,s),A.some(s)})(e,t,o,n).map(E),HO=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=kO(e),a=n.bind((t=>A.some(_O(t,e)))).getOr(0),i=s.bind((t=>A.some(_O(t,e)))).getOr(r),l={min:LC(t),max:PC(t),range:GC(t),value:o,hasMinEdge:oO(t),hasMaxEdge:nO(t),minBound:xO(e),minOffset:0,maxBound:wO(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return uO(l)})(t,r,o,n,s);return xO(t)-xO(e)+a},PO=A.none,UO=A.none,WO=VO(-1),jO=VO(1),$O={"top-left":A.none(),top:A.some(((e,t)=>{aO(e,VC(t))})),"top-right":A.none(),right:A.none(),"bottom-right":A.none(),bottom:A.some(((e,t)=>{aO(e,WC(t))})),"bottom-left":A.none(),left:A.none()};var GO=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=zO(e,t,o);return LO(e,n),n},setToMin:(e,t)=>{const o=LC(t);LO(e,o)},setToMax:(e,t)=>{const o=PC(t);LO(e,o)},findValueOfOffset:zO,getValueFromEvent:e=>RC(e).map((e=>e.top)),findPositionOfValue:HO,setPositionFromValue:(e,t,o,n)=>{const s=sO(o),r=HO(e,n.getSpectrum(e),s,n.getTopEdge(e),n.getBottomEdge(e),o),a=jt(t.element)/2;Bt(t.element,"top",r-a+"px")},onLeft:PO,onRight:UO,onUp:WO,onDown:jO,edgeActions:$O});const qO=(e,t)=>{zr(e,FC(),{value:t})},YO=(e,t)=>({x:e,y:t}),XO=(e,t)=>(o,n,s)=>((e,t,o,n,s)=>{const r=e>0?lO:iO,a=t?sO(n).x:r(sO(n).x,NC(n),HC(n),XC(n,s)),i=t?r(sO(n).y,LC(n),PC(n),XC(n,s)):sO(n).y;return qO(o,YO(a,i)),A.some(a)})(e,t,o,n,s).map(E),KO=XO(-1,!1),JO=XO(1,!1),ZO=XO(-1,!0),QO=XO(1,!0),e_={"top-left":A.some(((e,t)=>{aO(e,rO(zC(t),VC(t)))})),top:A.some(((e,t)=>{aO(e,rO(qC(t),VC(t)))})),"top-right":A.some(((e,t)=>{aO(e,rO(UC(t),VC(t)))})),right:A.some(((e,t)=>{aO(e,rO(UC(t),YC(t)))})),"bottom-right":A.some(((e,t)=>{aO(e,rO(UC(t),WC(t)))})),bottom:A.some(((e,t)=>{aO(e,rO(qC(t),WC(t)))})),"bottom-left":A.some(((e,t)=>{aO(e,rO(zC(t),WC(t)))})),left:A.some(((e,t)=>{aO(e,rO(zC(t),YC(t)))}))};var t_=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=EO(e,t,o.left),s=zO(e,t,o.top),r=YO(n,s);return qO(e,r),r},setToMin:(e,t)=>{const o=NC(t),n=LC(t);qO(e,YO(o,n))},setToMax:(e,t)=>{const o=HC(t),n=PC(t);qO(e,YO(o,n))},getValueFromEvent:e=>RC(e),setPositionFromValue:(e,t,o,n)=>{const s=sO(o),r=MO(e,n.getSpectrum(e),s.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=HO(e,n.getSpectrum(e),s.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Zt(t.element)/2,l=jt(t.element)/2;Bt(t.element,"left",r-i+"px"),Bt(t.element,"top",a-l+"px")},onLeft:KO,onRight:JO,onUp:ZO,onDown:QO,edgeActions:e_});const o_=Km({name:"Slider",configFields:[Cs("stepSize",1),Cs("speedMultiplier",10),Cs("onChange",b),Cs("onChoose",b),Cs("onInit",b),Cs("onDragStart",b),Cs("onDragEnd",b),Cs("snapToGrid",!1),Cs("rounded",!0),fs("snapStart"),ls("model",os("mode",{x:[Cs("minX",0),Cs("maxX",100),rs("value",(e=>on(e.mode.minX))),is("getInitialValue"),Ci("manager",NO)],y:[Cs("minY",0),Cs("maxY",100),rs("value",(e=>on(e.mode.minY))),is("getInitialValue"),Ci("manager",GO)],xy:[Cs("minX",0),Cs("maxX",100),Cs("minY",0),Cs("maxY",100),rs("value",(e=>on({x:e.mode.minX,y:e.mode.minY}))),is("getInitialValue"),Ci("manager",t_)]})),Yu("sliderBehaviours",[xh,qu]),rs("mouseIsDown",(()=>on(!1)))],partFields:IC,factory:(e,t,o,n)=>{const s=t=>Nm(t,e,"thumb"),r=t=>Nm(t,e,"spectrum"),a=t=>Rm(t,e,"left-edge"),i=t=>Rm(t,e,"right-edge"),l=t=>Rm(t,e,"top-edge"),c=t=>Rm(t,e,"bottom-edge"),d=e.model,u=d.manager,m=(t,o)=>{u.setPositionFromValue(t,o,e,{getLeftEdge:a,getRightEdge:i,getTopEdge:l,getBottomEdge:c,getSpectrum:r})},g=(e,t)=>{d.value.set(t);const o=s(e);m(e,o)},p=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&Rm(t,e,"thumb").each((o=>{const n=d.value.get();e.onChoose(t,o,n)}))},h=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,s(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,s(t)),p(t)},b=t=>{Rm(t,e,"spectrum").map(xh.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.sliderBehaviours,[xh.config({mode:"special",focusIn:b}),qu.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),gc.config({channels:{[Mu()]:{onReceive:p}}})]),events:Wr([Gr(FC(),((t,o)=>{((t,o)=>{g(t,o);const n=s(t);e.onChange(t,n,o),A.some(!0)})(t,o.event.value)})),ea(((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=s(t);m(t,a);const i=r(t);e.onInit(t,a,i,d.value.get())})),Gr(Ws(),h),Gr($s(),f),Gr(qs(),((e,t)=>{b(e),h(e,t)})),Gr(Ks(),f)]),apis:{resetToMin:t=>{u.setToMin(t,e)},resetToMax:t=>{u.setToMax(t,e)},setValue:g,refresh:m},domModification:{styles:{position:"relative"}}}},apis:{setValue:(e,t,o)=>{e.setValue(t,o)},resetToMin:(e,t)=>{e.resetToMin(t)},resetToMax:(e,t)=>{e.resetToMax(t)},refresh:(e,t)=>{e.refresh(t)}}}),n_=Bi("rgb-hex-update"),s_=Bi("slider-update"),r_=Bi("palette-update"),a_="form",i_=[Yu("formBehaviours",[qu])],l_=e=>"",c_=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.formBehaviours,[qu.config({store:{mode:"manual",getValue:t=>{const o=zm(t,e);return le(o,((e,t)=>e().bind((e=>{return o=eg.getCurrent(e),n=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+ii(e.element)),o.fold((()=>dn.error(n)),dn.value);var o,n})).map(qu.getValue)))},setValue:(t,o)=>{ie(o,((o,n)=>{Rm(t,e,n).each((e=>{eg.getCurrent(e).each((e=>{qu.setValue(e,o)}))}))}))}}})]),apis:{getField:(t,o)=>Rm(t,e,o).bind(eg.getCurrent)}}),d_={getField:Gi(((e,t,o)=>e.getField(t,o))),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),Mm(a_,l_(t),o)),record:x(e)}})(),o=e(t),n=t.record(),s=z(n,(e=>wm({name:e,pname:l_(e)})));return $m(a_,i_,s,c_,o)}},u_=Bi("valid-input"),m_=Bi("invalid-input"),g_=Bi("validating-input"),p_="colorcustom.rgb.",h_=(e,t,o,n)=>{const s=(o,n)=>fC.config({invalidClass:t("invalid"),notify:{onValidate:e=>{zr(e,g_,{type:o})},onValid:e=>{zr(e,u_,{type:o,value:qu.getValue(e)})},onInvalid:e=>{zr(e,m_,{type:o,value:qu.getValue(e)})}},validator:{validate:t=>{const o=qu.getValue(t),s=n(o)?dn.value(!0):dn.error(e("aria.input.invalid"));return ak(s)},validateOnLoad:!1}}),r=(o,n,r,a,i)=>{const l=e(p_+"range"),c=$k.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[ul(r)]}),d=$k.parts.field({data:i,factory:Iy,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:ma([s(n,o),Ub.config({})]),onSetValue:e=>{fC.isInvalid(e)&&fC.run(e).get(b)}}),u=[c,d],m="hex"!==n?[$k.parts["aria-descriptor"]({text:l})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:u.concat(m)}},a=(e,t)=>{const o=t.red,n=t.green,s=t.blue;qu.setValue(e,{red:o,green:n,blue:s})},i=Vb({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=(e,t)=>{i.getOpt(e).each((e=>{Bt(e.element,"background-color","#"+t.value)}))},c=Xm({factory:()=>{const s={red:on(A.some(255)),green:on(A.some(255)),blue:on(A.some(255)),hex:on(A.some("ffffff"))},c=e=>s[e].get(),d=(e,t)=>{s[e].set(t)},u=e=>{const t=e.red,o=e.green,n=e.blue;d("red",A.some(t)),d("green",A.some(o)),d("blue",A.some(n))},m=(e,t)=>{const o=t.event;"hex"!==o.type?d(o.type,A.none()):n(e)},g=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=Fw(t);d("hex",A.some(n.value));const s=Xw(n);a(e,s),u(s),zr(e,n_,{hex:n}),l(e,n)})(e,n.value):((e,t,o)=>{const n=parseInt(o,10);d(t,A.some(n)),c("red").bind((e=>c("green").bind((t=>c("blue").map((o=>Gw(e,t,o,1))))))).each((t=>{const o=((e,t)=>{const o=Hw(t);return d_.getField(e,"hex").each((t=>{Rh.isFocused(t)||qu.setValue(e,{hex:o.value})})),o})(e,t);zr(e,n_,{hex:o}),l(e,o)}))})(e,n.type,n.value)},p=t=>({label:e(p_+t+".label"),description:e(p_+t+".description")}),h=p("red"),f=p("green"),b=p("blue"),v=p("hex");return wn(d_.sketch((o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",$k.sketch(r(qw,"red",h.label,h.description,255))),o.field("green",$k.sketch(r(qw,"green",f.label,f.description,255))),o.field("blue",$k.sketch(r(qw,"blue",b.label,b.description,255))),o.field("hex",$k.sketch(r(Lw,"hex",v.label,v.description,"ffffff"))),i.asSpec()],formBehaviours:ma([fC.config({invalidClass:t("form-invalid")}),Mh("rgb-form-events",[Gr(u_,g),Gr(m_,m),Gr(g_,m)])])}))),{apis:{updateHex:(e,t)=>{qu.setValue(e,{hex:t.value}),((e,t)=>{const o=Xw(t);a(e,o),u(o)})(e,t),l(e,t)}}})},name:"RgbForm",configFields:[],apis:{updateHex:(e,t,o)=>{e.updateHex(t,o)}},extraApis:{}});return c},f_=(e,t)=>{const o=Xm({name:"ColourPicker",configFields:[is("dom"),Cs("onValidHex",b),Cs("onInvalidHex",b)],factory:o=>{const n=h_(e,t,o.onValidHex,o.onInvalidHex),s=((e,t)=>{const o=o_.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=o_.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:``}}),s=(e,t)=>{const{width:o,height:n}=e,s=e.getContext("2d");if(null===s)return;s.fillStyle=t,s.fillRect(0,0,o,n);const r=s.createLinearGradient(0,0,o,0);r.addColorStop(0,"rgba(255,255,255,1)"),r.addColorStop(1,"rgba(255,255,255,0)"),s.fillStyle=r,s.fillRect(0,0,o,n);const a=s.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),s.fillStyle=a,s.fillRect(0,0,o,n)};return Xm({factory:r=>{const a=x({x:0,y:0}),i=ma([eg.config({find:A.some}),Rh.config({})]);return o_.sketch({dom:{tag:"div",attributes:{role:"slider","aria-valuetext":e(["Saturation {0}%, Brightness {1}%",0,0])},classes:[t("sv-palette")]},model:{mode:"xy",getInitialValue:a},rounded:!1,components:[o,n],onChange:(t,o,n)=>{h(n)||Ct(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),zr(t,r_,{value:n})},onInit:(e,t,o,n)=>{s(o.element.dom,Zw(Qw))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=gS(t,100,100),r=Yw(n);s(o,Zw(r))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=pS(Xw(o));o_.setValue(t,{x:n.saturation,y:100-n.value}),Ct(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}})})(e,t),r={paletteRgba:on(Qw),paletteHue:on(0)},a=Vb(((e,t)=>{const o=o_.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=o_.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return o_.sketch({dom:{tag:"div",classes:[t("hue-slider")],attributes:{role:"slider","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":120}},rounded:!1,model:{mode:"y",getInitialValue:x(0)},components:[o,n],sliderBehaviours:ma([Rh.config({})]),onChange:(e,t,o)=>{Ct(e.element,"aria-valuenow",Math.floor(360-3.6*o)),zr(e,s_,{value:o})}})})(0,t)),i=Vb(s.sketch({})),l=Vb(n.sketch({})),c=(e,t,o)=>{i.getOpt(e).each((e=>{s.setHue(e,o)}))},d=(e,t)=>{l.getOpt(e).each((e=>{n.updateHex(e,t)}))},u=(e,t,o)=>{a.getOpt(e).each((e=>{o_.setValue(e,(e=>100-e/360*100)(o))}))},m=(e,t)=>{i.getOpt(e).each((e=>{s.setThumb(e,t)}))},g=(e,t,o,n)=>{((e,t)=>{const o=Xw(e);r.paletteRgba.set(o),r.paletteHue.set(t)})(t,o),V(n,(n=>{n(e,t,o)}))};return{uid:o.uid,dom:o.dom,components:[i.asSpec(),a.asSpec(),l.asSpec()],behaviours:ma([Mh("colour-picker-events",[Gr(n_,(()=>{const e=[c,u,m];return(t,o)=>{const n=o.event.hex,s=(e=>pS(Xw(e)))(n);g(t,n,s.hue,e)}})()),Gr(r_,(()=>{const e=[d];return(t,o)=>{const n=o.event.value,s=r.paletteHue.get(),a=gS(s,n.x,100-n.y),i=hS(a);g(t,i,s,e)}})()),Gr(s_,(()=>{const e=[c,d];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),s=r.paletteRgba.get(),a=pS(s),i=gS(n,a.saturation,a.value),l=hS(i);g(t,l,n,e)}})())]),eg.config({find:e=>l.getOpt(e)}),xh.config({mode:"acyclic"})])}}});return o},b_=()=>eg.config({find:A.some}),v_=e=>eg.config({find:t=>ct(t.element,e).bind((e=>t.getSystem().getByDom(e).toOptional()))}),y_=Nn([Cs("preprocess",w),Cs("postprocess",w)]),x_=(e,t)=>{const o=es("RepresentingConfigs.memento processors",y_,t);return qu.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),s=qu.getValue(n);return o.postprocess(s)},setValue:(t,n)=>{const s=o.preprocess(n),r=e.get(t);qu.setValue(r,s)}}})},w_=(e,t,o)=>qu.config({store:{mode:"manual",...e.map((e=>({initialValue:e}))).getOr({}),getValue:t,setValue:o}}),S_=(e,t,o)=>w_(e,(e=>t(e.element)),((e,t)=>o(e.element,t))),k_=e=>qu.config({store:{mode:"memory",initialValue:e}}),C_={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"};var O_=tinymce.util.Tools.resolve("tinymce.Resource");const __=e=>be(e,"init");var T_=tinymce.util.Tools.resolve("tinymce.util.Tools");const E_=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...s)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,s)}),t)}}},A_=Bi("alloy-fake-before-tabstop"),M_=Bi("alloy-fake-after-tabstop"),D_=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:ma([Rh.config({ignore:!0}),Ub.config({})])}),B_=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[D_([A_]),t,D_([M_])],behaviours:ma([v_(1)])}),I_=(e,t)=>{zr(e,er(),{raw:{which:9,shiftKey:t}})},F_=(e,t)=>{const o=t.element;_a(o,A_)?I_(e,!0):_a(o,M_)&&I_(e,!1)},R_=e=>Dk(e,["."+A_,"."+M_].join(","),T),N_=Bi("update-dialog"),L_=Bi("update-title"),z_=Bi("update-body"),V_=Bi("update-footer"),H_=Bi("body-send-message"),P_=Bi("dialog-focus-shifted"),U_=Bo().browser,W_=U_.isSafari(),j_=U_.isFirefox(),$_=W_||j_,G_=U_.isChromium(),q_=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,Y_=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),X_=(e,t,o)=>{const n=e.dom;A.from(n.contentDocument).fold(o,(e=>{let o=0;const s=((e,t)=>{const o=e.body;return A.from(!/^1))?o:e.documentElement)})(e,t).map((e=>(o=e.scrollTop,e))).forall(q_),r=()=>{const e=n.contentWindow;g(e)&&(s?Y_(e,"bottom"):!s&&$_&&0!==o&&Y_(e,o))};W_&&n.addEventListener("load",r,{once:!0}),e.open(),e.write(t),e.close(),W_||r()}))},K_=ke($_,W_?500:200).map((e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...s)=>{n=s,c(o)&&(o=setTimeout((()=>{const t=n;o=null,n=null,e.apply(null,t)}),t))}}})(X_,e))),J_=Bi("toolbar.button.execute"),Z_=Bi("common-button-display-events"),Q_={[hr()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[_r()]:["toolbar-button-events",Z_],[Tr()]:["toolbar-button-events","dropdown-events","tooltipping"],[qs()]:["focusing","alloy.base.behaviour",Z_]},eT=e=>Bt(e.element,"width",Rt(e.element,"width")),tT=(e,t,o)=>ry(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),oT=(e,t)=>tT(e,t,[]),nT=(e,t)=>tT(e,t,[Ah.config({})]),sT=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[ul(o.translate(e))],behaviours:ma([Ah.config({})])}),rT=Bi("update-menu-text"),aT=Bi("update-menu-icon"),iT=(e,t,o,n)=>{const s=on(b),r=e.text.map((e=>Vb(sT(e,t,o.providers)))),a=e.icon.map((e=>Vb(nT(e,o.providers.icons)))),i=(e,t)=>{const o=qu.getValue(e);return Rh.focus(o),zr(o,"keydown",{raw:t.event.raw}),xk.close(o),A.some(!0)},l=e.role.fold((()=>({})),(e=>({role:e}))),c=e.ariaLabel.fold((()=>({})),(e=>({"aria-label":o.providers.translate(e)}))),d=ry("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),u=Bi("common-button-display-events"),m="dropdown-events",p=Vb(xk.sketch({...e.uid?{uid:e.uid}:{},...l,dom:{tag:"button",classes:[t,`${t}--select`].concat(z(e.classes,(e=>`${t}--${e}`))),attributes:{...c,...g(n)?{"data-mce-name":n}:{}}},components:vw([a.map((e=>e.asSpec())),r.map((e=>e.asSpec())),A.some(d)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{zy(e).each((e=>Rh.focus(e)))})(n)},dropdownBehaviours:ma([...e.dropdownBehaviours,dw((()=>e.disabled||o.providers.isDisabled())),cw(),bC.config({}),Ah.config({}),...e.tooltip.map((e=>Qb.config(o.providers.tooltips.getConfig({tooltipText:o.providers.translate(e)})))).toArray(),Mh(m,[pw(e,s),hw(e,s)]),Mh(u,[ea(((e,t)=>eT(e)))]),Mh("menubutton-update-display-text",[Gr(rT,((e,t)=>{r.bind((t=>t.getOpt(e))).each((e=>{Ah.set(e,[ul(o.providers.translate(t.event.text))])}))})),Gr(aT,((e,t)=>{a.bind((t=>t.getOpt(e))).each((e=>{Ah.set(e,[nT(t.event.icon,o.providers.icons)])}))}))])]),eventOrder:wn(Q_,{[qs()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[_r()]:["toolbar-button-events",Qb.name(),m,u]}),sandboxBehaviours:ma([xh.config({mode:"special",onLeft:i,onRight:i}),Mh("dropdown-sandbox-events",[Gr(Fy,((e,t)=>{(e=>{const t=qu.getValue(e),o=Ly(e).map(Vy);xk.refetch(t).get((()=>{const e=ek.getCoupled(t,"sandbox");o.each((t=>Ly(e).each((e=>((e,t)=>{qu.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))))}))})(e),t.stop()})),Gr(Ry,((e,t)=>{((e,t)=>{(e=>Tu.getState(e).bind(Cg.getHighlighted).bind(Cg.getHighlighted))(e).each((o=>{((e,t,o,n)=>{const s={...n,target:t};e.getSystem().triggerEvent(o,t,s)})(e,o.element,t.event.eventType,t.event.interactionEvent)}))})(e,t),t.stop()}))])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...Ey(0,e.columns,e.presets),fakeFocus:e.searchable,onHighlightItem:wk,onCollapseMenu:(e,t,o)=>{Cg.getHighlighted(o).each((t=>{wk(e,o,t)}))},onDehighlightItem:Sk}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{Pc()(e,t-10)}}),fetch:t=>rk(k(e.fetch,t))}));return p.asSpec()},lT=e=>"separator"===e.type,cT={type:"separator"},dT=(e,t)=>{const o=((e,t)=>{const o=W(e,((e,o)=>(e=>r(e))(o)?""===o?e:"|"===o?e.length>0&&!lT(e[e.length-1])?e.concat([cT]):e:be(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o])),[]);return o.length>0&&lT(o[o.length-1])&&o.pop(),o})(r(e)?e.split(" "):e,t);return U(o,((e,o)=>{if((e=>be(e,"getSubmenuItems"))(o)){const n=(e=>{const t=fe(e,"value").getOrThunk((()=>Bi("generated-menu-item")));return wn({value:t},e)})(o),s=((e,t)=>{const o=e.getSubmenuItems(),n=dT(o,t);return{item:e,menus:wn(n.menus,{[e.value]:n.items}),expansions:wn(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:wn(e.menus,s.menus),items:[s.item,...e.items],expansions:wn(e.expansions,s.expansions)}}return{...e,items:[o,...e.items]}}),{menus:{},expansions:{},items:[]})},uT=(e,t,o,n)=>{const s=Bi("primary-menu"),r=dT(e,o.shared.providers.menuItems());if(0===r.items.length)return A.none();const a=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-field",placeholder:e.placeholder}))))(n),i=Tk(s,r.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-results"}))))(n),c=le(r.menus,((e,n)=>Tk(n,e,t,o,!1,l))),d=wn(c,Fs(s,i));return A.from(xf.tieredData(s,d,r.expansions))},mT=e=>!be(e,"items"),gT="data-value",pT=(e,t,o,n)=>z(o,(o=>mT(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{qu.setValue(e,o.value),zr(e,Jk,{name:t}),Rh.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>pT(e,t,o.items,n)})),hT=(e,t)=>se(e,(e=>mT(e)?ke(e.value===t,e):hT(e.items,t))),fT=Xm({name:"HtmlSelect",configFields:[is("options"),Yu("selectBehaviours",[Rh,qu]),Cs("selectClasses",[]),Cs("selectAttributes",{}),fs("data")],factory:(e,t)=>{const o=z(e.options,(e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}}))),n=e.data.map((e=>Fs("initialValue",e))).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:Ku(e.selectBehaviours,[Rh.config({}),qu.config({store:{mode:"manual",getValue:e=>ol(e.element),setValue:(t,o)=>{const n=te(e.options);j(e.options,(e=>e.value===o)).isSome()?nl(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each((e=>nl(t.element,e.value)))},...n}})])}}}),bT=x([Cs("field1Name","field1"),Cs("field2Name","field2"),Si("onLockedChange"),vi(["lockClass"]),Cs("locked",!1),Ju("coupledFieldBehaviours",[eg,qu])]),vT=(e,t)=>wm({factory:$k,name:e,overrides:e=>({fieldBehaviours:ma([Mh("coupled-input-behaviour",[Gr(or(),(o=>{((e,t,o)=>Rm(e,t,o).bind(eg.getCurrent))(o,e,t).each((t=>{Rm(o,e,"lock").each((n=>{Wh.isOn(n)&&e.onLockedChange(o,t,n)}))}))}))])])})}),yT=x([vT("field1","field2"),vT("field2","field1"),wm({factory:Lb,schema:[is("dom")],name:"lock",overrides:e=>({buttonBehaviours:ma([Wh.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),xT=Km({name:"FormCoupledInputs",configFields:bT(),partFields:yT(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Zu(e.coupledFieldBehaviours,[eg.config({find:A.some}),qu.config({store:{mode:"manual",getValue:t=>{const o=Hm(t,e,["field1","field2"]);return{[e.field1Name]:qu.getValue(o.field1()),[e.field2Name]:qu.getValue(o.field2())}},setValue:(t,o)=>{const n=Hm(t,e,["field1","field2"]);ve(o,e.field1Name)&&qu.setValue(n.field1(),o[e.field1Name]),ve(o,e.field2Name)&&qu.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>Rm(t,e,"field1"),getField2:t=>Rm(t,e,"field2"),getLock:t=>Rm(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),wT=e=>{const t=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(e);if(null!==t){const e=parseFloat(t[1]),o=t[2];return dn.value({value:e,unit:o})}return dn.error(e)},ST=(e,t)=>{const o={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},n=e=>be(o,e);return e.unit===t?A.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?A.some(e.value):A.some(e.value/o[e.unit]*o[t]):A.none()},kT=e=>A.none(),CT=(e,t)=>{const o=e.label.map((e=>Kk(e,t))),n=[pg.config({disabled:()=>e.disabled||t.isDisabled()}),cw(),xh.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Lr(e,tC),A.some(!0))}),Mh("textfield-change",[Gr(or(),((t,o)=>{zr(t,Jk,{name:e.name})})),Gr(gr(),((t,o)=>{zr(t,Jk,{name:e.name})}))]),Ub.config({})],s=e.validation.map((e=>fC.config({getRoot:e=>at(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=qu.getValue(t),n=e.validator(o);return ak(!0===n?dn.value(o):dn.error(n))},validateOnLoad:e.validateOnLoad}}))).toArray(),r={...e.placeholder.fold(x({}),(e=>({placeholder:t.translate(e)}))),...e.inputMode.fold(x({}),(e=>({inputmode:e})))},a=$k.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map((e=>({data:e}))).getOr({}),inputAttributes:r,inputClasses:[e.classname],inputBehaviours:ma(G([n,s])),selectOnFocus:!1,factory:Iy}),i=e.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[a]}:a,l=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),c=[pg.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{$k.getField(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable)}}),cw()];return qk(o,i,l,c)},OT=(e,t)=>t.getAnimationRoot.fold((()=>e.element),(t=>t(e))),_T=e=>e.dimension.property,TT=(e,t)=>e.dimension.getDimension(t),ET=(e,t)=>{const o=OT(e,t);Ea(o,[t.shrinkingClass,t.growingClass])},AT=(e,t)=>{Oa(e.element,t.openClass),ka(e.element,t.closedClass),Bt(e.element,_T(t),"0px"),Pt(e.element)},MT=(e,t)=>{Oa(e.element,t.closedClass),ka(e.element,t.openClass),Ht(e.element,_T(t))},DT=(e,t,o,n)=>{o.setCollapsed(),Bt(e.element,_T(t),TT(t,e.element)),ET(e,t),AT(e,t),t.onStartShrink(e),t.onShrunk(e)},BT=(e,t,o,n)=>{const s=n.getOrThunk((()=>TT(t,e.element)));o.setCollapsed(),Bt(e.element,_T(t),s),Pt(e.element);const r=OT(e,t);Oa(r,t.growingClass),ka(r,t.shrinkingClass),AT(e,t),t.onStartShrink(e)},IT=(e,t,o)=>{const n=TT(t,e.element);("0px"===n?DT:BT)(e,t,o,A.some(n))},FT=(e,t,o)=>{const n=OT(e,t),s=_a(n,t.shrinkingClass),r=TT(t,e.element);MT(e,t);const a=TT(t,e.element);(s?()=>{Bt(e.element,_T(t),r),Pt(e.element)}:()=>{AT(e,t)})(),Oa(n,t.shrinkingClass),ka(n,t.growingClass),MT(e,t),Bt(e.element,_T(t),a),o.setExpanded(),t.onStartGrow(e)},RT=(e,t,o)=>{const n=OT(e,t);return!0===_a(n,t.growingClass)},NT=(e,t,o)=>{const n=OT(e,t);return!0===_a(n,t.shrinkingClass)};var LT=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){Ht(e.element,_T(t));const o=TT(t,e.element);Bt(e.element,_T(t),o)}},grow:(e,t,o)=>{o.isExpanded()||FT(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&IT(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&DT(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:RT,isShrinking:NT,isTransitioning:(e,t,o)=>RT(e,t)||NT(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?IT:FT)(e,t,o)},disableTransitions:ET,immediateGrow:(e,t,o)=>{o.isExpanded()||(MT(e,t),Bt(e.element,_T(t),TT(t,e.element)),ET(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}}),zT=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return aa(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:Fs(t.dimension.property,"0px")})},events:(e,t)=>Wr([Qr(ar(),((o,n)=>{n.event.raw.propertyName===e.dimension.property&&(ET(o,e),t.isExpanded()&&Ht(o.element,e.dimension.property),(t.isExpanded()?e.onGrown:e.onShrunk)(o))}))])}),VT=[is("closedClass"),is("openClass"),is("shrinkingClass"),is("growingClass"),fs("getAnimationRoot"),xi("onShrunk"),xi("onStartShrink"),xi("onGrown"),xi("onStartGrow"),Cs("expanded",!1),ls("dimension",os("property",{width:[Ci("property","width"),Ci("getDimension",(e=>Zt(e)+"px"))],height:[Ci("property","height"),Ci("getDimension",(e=>jt(e)+"px"))]}))];const HT=pa({fields:VT,name:"sliding",active:zT,apis:LT,state:Object.freeze({__proto__:null,init:e=>{const t=on(e.expanded);return ua({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:k(t.set,!1),setExpanded:k(t.set,!0),readState:()=>"expanded: "+t.get()})}})}),PT=e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t),setActive:t=>{const o=e.element;t?(ka(o,"tox-tbtn--enabled"),Ct(o,"aria-pressed",!0)):(Oa(o,"tox-tbtn--enabled"),At(o,"aria-pressed"))},isActive:()=>_a(e.element,"tox-tbtn--enabled"),setText:t=>{zr(e,rT,{text:t})},setIcon:t=>zr(e,aT,{icon:t})}),UT=(e,t,o,n,s=!0,r)=>iT({text:e.text,icon:e.icon,tooltip:e.tooltip,ariaLabel:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const s={pattern:e.search.isSome()?kk(t):""};e.fetch((t=>{n(uT(t,dy.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))}),s,PT(t))},onSetup:e.onSetup,getApi:PT,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...s?[Ub.config({})]:[]]},t,o.shared,r),WT=(e,t,o)=>{const n=e=>n=>{const s=!n.isActive();n.setActive(s),e.storage.set(s),o.shared.getSink().each((o=>{t().getOpt(o).each((t=>{hc(t.element),zr(t,eC,{name:e.name,value:e.storage.get()})}))}))},s=e=>t=>{t.setActive(e.storage.get())};return t=>{t(z(e,(e=>{const t=e.text.fold((()=>({})),(e=>({text:e})));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:s(e)}})))}},jT=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":e}},components:[ul(e)]}),$T=Bi("leaf-label-event-id"),GT=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:s,backstage:r})=>{const a=e.menu.map((e=>UT(e,"tox-mbtn",r,A.none(),o))),i=[jT(e.title)];return a.each((e=>i.push(e))),Lb.sketch({dom:{tag:"div",classes:["tox-tree--leaf__label","tox-trbtn"].concat(o?["tox-tree--leaf__label--visible"]:[])},components:i,role:"treeitem",action:o=>{t(e.id),o.getSystem().broadcastOn([`update-active-item-${n}`],{value:e.id})},eventOrder:{[er()]:[$T,"keying"]},buttonBehaviours:ma([...o?[Ub.config({})]:[],Wh.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),gc.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?Wh.on:Wh.off)(t)}}}}),Mh($T,[ea(((t,o)=>{s.each((o=>{(o===e.id?Wh.on:Wh.off)(t)}))})),Gr(er(),((e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(kl(e.element,".tox-tree--directory").each((t=>{e.getSystem().getByDom(t).each((e=>{Ol(t,".tox-tree--directory__label").each((t=>{e.getSystem().getByDom(t).each(Rh.focus)}))}))})),t.stop()):n&&t.stop()}))])])})},qT=Bi("directory-label-event-id"),YT=({directory:e,visible:t,noChildren:o,backstage:n})=>{const s=e.menu.map((e=>UT(e,"tox-mbtn",n,A.none()))),r=[{dom:{tag:"div",classes:["tox-chevron"]},components:[(a="chevron-right",i=n.shared.providers.icons,((e,t,o)=>ry(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:[]},t))(a,i))]},jT(e.title)];var a,i;s.each((e=>{r.push(e)}));const l=t=>{kl(t.element,".tox-tree--directory").each((o=>{t.getSystem().getByDom(o).each((o=>{const n=!Wh.isOn(o);Wh.toggle(o),zr(t,"expand-tree-node",{expanded:n,node:e.id})}))}))};return Lb.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:r,action:l,eventOrder:{[er()]:[qT,"keying"]},buttonBehaviours:ma([...t?[Ub.config({})]:[],Mh(qT,[Gr(er(),((e,t)=>{const n="ArrowRight"===t.event.raw.code,s="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||s)&&kl(e.element,".tox-tree--directory").each((o=>{e.getSystem().getByDom(o).each((o=>{!Wh.isOn(o)&&n||Wh.isOn(o)&&s?(l(e),t.stop()):s&&!Wh.isOn(o)&&(kl(o.element,".tox-tree--directory").each((e=>{Ol(e,".tox-tree--directory__label").each((e=>{o.getSystem().getByDom(e).each(Rh.focus)}))})),t.stop())}))}))}))])])})},XT=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:s,selectedId:r,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map((e=>"leaf"===e.type?GT({leaf:e,selectedId:r,onLeafAction:t,visible:o,treeId:n,backstage:a}):JT({directory:e,expandedIds:s,selectedId:r,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a}))),behaviours:ma([HT.config({dimension:{property:"height"},closedClass:"tox-tree--directory__children--closed",openClass:"tox-tree--directory__children--open",growingClass:"tox-tree--directory__children--growing",shrinkingClass:"tox-tree--directory__children--shrinking",expanded:o}),Ah.config({})])}),KT=Bi("directory-event-id"),JT=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:s,expandedIds:r,selectedId:a})=>{const{children:i}=e,l=on(r),c=r.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[YT({directory:e,visible:o,noChildren:0===e.children.length,backstage:s}),XT({children:i,expandedIds:r,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:s})],behaviours:ma([Mh(KT,[ea(((e,t)=>{Wh.set(e,c)})),Gr("expand-tree-node",((e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter((e=>e!==n)))}))]),Wh.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const r=e.components()[1],c=(d=o,i.map((e=>"leaf"===e.type?GT({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:s}):JT({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:s}))));var d;o?HT.grow(r):HT.shrink(r),Ah.set(r,c)}})])}},ZT=Bi("tree-event-id");var QT=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Wr([Gr(e.event,o),ta((()=>t.cancel()))].concat(e.cancelEvent.map((e=>[Gr(e,(()=>t.cancel()))])).getOr([])))}});const eE=e=>{const t=on(null);return ua({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var tE=Object.freeze({__proto__:null,throttle:eE,init:e=>e.stream.streams.state(e)}),oE=[ls("stream",os("mode",{throttle:[is("delay"),Cs("stopEvent",!0),Ci("streams",{setup:(e,t)=>{const o=e.stream,n=E_(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:eE})]})),Cs("event","input"),fs("cancelEvent"),Si("onStream")];const nE=pa({fields:oE,name:"streaming",active:QT,state:tE}),sE=(e,t,o)=>{const n=qu.getValue(o);qu.setValue(t,n),aE(t)},rE=(e,t)=>{const o=e.element,n=ol(o),s=o.dom;"number"!==_t(o,"type")&&t(s,n)},aE=e=>{rE(e,((e,t)=>e.setSelectionRange(t.length,t.length)))},iE=x("alloy.typeahead.itemexecute"),lE=x([fs("lazySink"),is("fetch"),Cs("minChars",5),Cs("responseTime",1e3),xi("onOpen"),Cs("getHotspot",A.some),Cs("getAnchorOverrides",x({})),Cs("layouts",A.none()),Cs("eventOrder",{}),Bs("model",{},[Cs("getDisplayText",(e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value)),Cs("selectsOver",!0),Cs("populateFromBrowse",!0)]),xi("onSetValue"),wi("onExecute"),xi("onItemExecute"),Cs("inputClasses",[]),Cs("inputAttributes",{}),Cs("inputStyles",{}),Cs("matchWidth",!0),Cs("useMinWidth",!1),Cs("dismissOnBlur",!0),vi(["openClass"]),fs("initialData"),Yu("typeaheadBehaviours",[Rh,qu,nE,xh,Wh,ek]),rs("lazyTypeaheadComp",(()=>on(A.none))),rs("previewing",(()=>on(!0)))].concat(Ay()).concat(bk())),cE=x([Sm({schema:[bi()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each((t=>{((e,t,o)=>{if(e.selectsOver){const n=qu.getValue(t),s=e.getDisplayText(n),r=qu.getValue(o);return 0===e.getDisplayText(r).indexOf(s)?A.some((()=>{sE(0,t,o),((e,t)=>{rE(e,((e,o)=>e.setSelectionRange(t,o.length)))})(t,s.length)})):A.none()}return A.none()})(e.model,t,n).fold((()=>{e.model.selectsOver?(Cg.dehighlight(o,n),e.previewing.set(!0)):e.previewing.set(!1)}),(t=>{t(),e.previewing.set(!1)}))})):e.lazyTypeaheadComp.get().each((t=>{e.model.populateFromBrowse&&sE(e.model,t,n),Tt(n.element,"id").each((e=>Ct(t.element,"aria-activedescendant",e)))}))},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map((e=>(zr(e,iE(),{item:o}),!0))),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each((t=>{e.model.populateFromBrowse&&sE(e.model,t,o)}))}})})]),dE=Km({name:"Typeahead",configFields:lE(),partFields:cE(),factory:(e,t,o,n)=>{const s=(t,o,s)=>{e.previewing.set(!1);const r=ek.getCoupled(t,"sandbox");if(Tu.isOpen(r))eg.getCurrent(r).each((e=>{Cg.getHighlighted(e).fold((()=>{s(e)}),(()=>{Ur(r,e.element,"keydown",o)}))}));else{const o=e=>{eg.getCurrent(e).each(s)};dk(e,a(t),t,r,n,o,vf.HighlightMenuAndItem).get(b)}},r=My(e),a=e=>t=>t.map((t=>{const o=he(t.menus),n=q(o,(e=>P(e.items,(e=>"item"===e.type))));return qu.getState(e).update(z(n,(e=>e.data))),t})),i=e=>eg.getCurrent(e),l="typeaheadevents",c=[Rh.config({}),qu.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>ol(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{nl(t.element,e.model.getDisplayText(o))},...e.initialData.map((e=>Fs("initialValue",e))).getOr({})}}),nE.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const s=ek.getCoupled(t,"sandbox");if(Rh.isFocused(t)&&ol(t.element).length>=e.minChars){const o=i(s).bind((e=>Cg.getHighlighted(e).map(qu.getValue)));e.previewing.set(!0);const r=t=>{i(s).each((t=>{o.fold((()=>{e.model.selectsOver&&Cg.highlightFirst(t)}),(e=>{Cg.highlightBy(t,(t=>qu.getValue(t).value===e.value)),Cg.getHighlighted(t).orThunk((()=>(Cg.highlightFirst(t),A.none())))}))}))};dk(e,a(t),t,s,n,r,vf.HighlightJustMenu).get(b)}},cancelEvent:xr()}),xh.config({mode:"special",onDown:(e,t)=>(s(e,t,Cg.highlightFirst),A.some(!0)),onEscape:e=>{const t=ek.getCoupled(e,"sandbox");return Tu.isOpen(t)?(Tu.close(t),A.some(!0)):A.none()},onUp:(e,t)=>(s(e,t,Cg.highlightLast),A.some(!0)),onEnter:t=>{const o=ek.getCoupled(t,"sandbox"),n=Tu.isOpen(o);if(n&&!e.previewing.get())return i(o).bind((e=>Cg.getHighlighted(e))).map((e=>(zr(t,iE(),{item:e}),!0)));{const s=qu.getValue(t);return Lr(t,xr()),e.onExecute(o,t,s),n&&Tu.close(o),A.some(!0)}}}),Wh.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),ek.config({others:{sandbox:t=>hk(e,t,{onOpen:()=>Wh.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each((e=>At(e.element,"aria-activedescendant"))),Wh.off(t)}})}}),Mh(l,[ea((t=>{e.lazyTypeaheadComp.set(A.some(t))})),ta((t=>{e.lazyTypeaheadComp.set(A.none())})),na((t=>{const o=b;mk(e,a(t),t,n,o,vf.HighlightMenuAndItem).get(b)})),Gr(iE(),((t,o)=>{const n=ek.getCoupled(t,"sandbox");sE(e.model,t,o.event.item),Lr(t,xr()),e.onItemExecute(t,n,o.event.item,qu.getValue(t)),Tu.close(n),aE(t)}))].concat(e.dismissOnBlur?[Gr(mr(),(e=>{const t=ek.getCoupled(e,"sandbox");yc(t.element).isNone()&&Tu.close(t)}))]:[]))],d={[Tr()]:[qu.name(),nE.name(),l],...e.eventOrder};return{uid:e.uid,dom:By(wn(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...r,...Ku(e.typeaheadBehaviours,c)},eventOrder:d}}}),uE=e=>({...e,toCached:()=>uE(e.toCached()),bindFuture:t=>uE(e.bind((e=>e.fold((e=>ak(dn.error(e))),(e=>t(e)))))),bindResult:t=>uE(e.map((e=>e.bind(t)))),mapResult:t=>uE(e.map((e=>e.map(t)))),mapError:t=>uE(e.map((e=>e.mapError(t)))),foldResult:(t,o)=>e.map((e=>e.fold(t,o))),withTimeout:(t,o)=>uE(rk((n=>{let s=!1;const r=setTimeout((()=>{s=!0,n(dn.error(o()))}),t);e.get((e=>{s||(clearTimeout(r),n(e))}))})))}),mE=e=>uE(rk(e)),gE=(e,t,o=[],n,s,r,a)=>{const i=t.fold((()=>({})),(e=>({action:e}))),l={buttonBehaviours:ma([dw((()=>!e.enabled||a.isDisabled())),cw(),Ub.config({}),...r.map((e=>Qb.config(a.tooltips.getConfig({tooltipText:a.translate(e)})))).toArray(),Mh("button press",[$r("click"),$r("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...i},c=wn(l,{dom:n});return wn(c,{components:s})},pE=(e,t,o,n=[],s)=>{const r={tag:"button",classes:["tox-tbtn"],attributes:{...e.tooltip.map((e=>({"aria-label":o.translate(e)}))).getOr({}),"data-mce-name":s}},a=e.icon.map((e=>oT(e,o.icons))),i=vw([a]);return gE(e,t,n,r,i,e.tooltip,o)},hE=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},fE=(e,t,o,n=[],s=[])=>{const r=o.translate(e.text),a=e.icon.map((e=>oT(e,o.icons))),i=[a.getOrThunk((()=>ul(r)))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c={tag:"button",classes:[...hE(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...s],attributes:{"aria-label":r,"data-mce-name":e.text}},d=e.icon.map(x(r));return gE(e,t,n,c,i,d,o)},bE=(e,t,o,n=[],s=[])=>{const r=fE(e,A.some(t),o,n,s);return Lb.sketch(r)},vE=(e,t)=>o=>{"custom"===t?zr(o,eC,{name:e,value:{}}):"submit"===t?Lr(o,tC):"cancel"===t?Lr(o,Qk):console.error("Unknown button type: ",t)},yE=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>r,n=e,s={...e,type:"menubutton",search:A.none(),onSetup:t=>(t.setEnabled(e.enabled),b),fetch:WT(n.items,t,o)},r=Vb(UT(s,"tox-tbtn",o,A.none(),!0,e.text.or(e.tooltip).getOrUndefined()));return r.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=vE(e.name,t),s={...e,borderless:!1};return bE(s,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t,o)=>{var n,s;const r=e.icon.map((e=>nT(e,t.icons))).map(Vb),a=e.buttonType.getOr(e.primary?"primary":"secondary"),i={...e,name:null!==(n=e.name)&&void 0!==n?n:"",primary:"primary"===a,tooltip:e.tooltip,enabled:null!==(s=e.enabled)&&void 0!==s&&s,borderless:!1},l=i.tooltip.or(e.text).map((e=>({"aria-label":t.translate(e)}))).getOr({}),c=hE(null!=a?a:"secondary"),d=e.icon.isSome()&&e.text.isSome(),u={tag:"button",classes:[...c.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...d?["tox-button--icon-and-text"]:[]],attributes:{...l,...g(o)?{"data-mce-name":o}:{}}},m=t.translate(e.text.getOr("")),p=ul(m),h=[...vw([r.map((e=>e.asSpec()))]),...e.text.isSome()?[p]:[]],f=gE(i,A.some((o=>{zr(o,eC,{name:e.name,value:{setIcon:e=>{r.map((n=>n.getOpt(o).each((o=>{Ah.set(o,[nT(e,t.icons)])}))))}}})})),[],u,h,e.tooltip,t);return Lb.sketch(f)})(e,o.shared.providers,e.text.or(e.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},xE={type:"separator"},wE=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:b}),SE=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:b}),kE=(e,t)=>(e=>z(e,wE))(((e,t)=>P(t,(t=>t.type===e)))(e,t)),CE=e=>kE("header",e.targets),OE=e=>kE("anchor",e.targets),_E=e=>A.from(e.anchorTop).map((e=>SE("",e))).toArray(),TE=e=>A.from(e.anchorBottom).map((e=>SE("",e))).toArray(),EE=(e,t)=>{const o=e.toLowerCase();return P(t,(e=>{var t;const n=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,s=null!==(t=e.value)&&void 0!==t?t:"";return _e(n.toLowerCase(),o)||_e(s.toLowerCase(),o)}))},AE=Bi("aria-invalid"),ME=(e,t)=>{e.dom.checked=t},DE=e=>e.dom.checked,BE=e=>(t,o,n,s)=>fe(o,"name").fold((()=>e(o,s,A.none())),(r=>t.field(r,e(o,s,fe(n,r))))),IE={bar:BE(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:z(e.items,t.interpreter)}))(e,t.shared))),collection:BE(((e,t,o)=>aC(e,t.shared.providers,o))),alertbanner:BE(((e,t)=>((e,t)=>{const o=oy(e.icon,t.icons);return Pk.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in",`tox-notification--${e.level}`]},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:e.url?void 0:o},components:e.url?[Lb.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>zr(t,eC,{name:"alert-banner",value:e.url}),buttonBehaviours:ma([ny()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers))),input:BE(((e,t,o)=>((e,t,o)=>CT({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),textarea:BE(((e,t,o)=>((e,t,o)=>CT({name:e.name,multiline:!0,label:e.label,inputMode:A.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),label:BE(((e,t)=>((e,t)=>{const o="tox-label";return{dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"label",classes:[o,..."center"===e.align?[`${o}--center`]:[],..."end"===e.align?[`${o}--end`]:[]]},components:[ul(t.providers.translate(e.label))]},...z(e.items,t.interpreter)],behaviours:ma([b_(),Ah.config({}),(n=A.none(),S_(n,si,ri)),xh.config({mode:"acyclic"})])};var n})(e,t.shared))),iframe:(aM=(e,t,o)=>((e,t,o)=>{const n="tox-dialog__iframe",s=e.transparent?[]:[`${n}--opaque`],r=e.border?["tox-navobj-bordered"]:[],a={...e.label.map((e=>({title:e}))).getOr({}),...o.map((e=>({srcdoc:e}))).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},i=((e,t)=>{const o=on(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,s=()=>Ct(o,"srcdoc",n);t?K_.fold(x(X_),(e=>e.throttle))(o,n,s):s()}o.set(n)}}})(o,e.streamContent),l=e.label.map((e=>Kk(e,t))),c=$k.parts.field({factory:{sketch:e=>B_(A.from(r),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...s]},behaviours:ma([Ub.config({}),Rh.config({}),w_(o,i.getValue,i.setValue),gc.config({channels:{[P_]:{onReceive:(e,t)=>{t.newFocus.each((t=>{at(e.element).each((o=>{(Qe(e.element,t)?ka:Oa)(o,"tox-navobj-bordered-focus")}))}))}}}})])})}});return qk(l,c,["tox-form__group--stretched"],[])})(e,t.shared.providers,o),(e,t,o,n)=>{const s=wn(t,{source:"dynamic"});return BE(aM)(e,s,o,n)}),button:BE(((e,t)=>((e,t)=>{const o=vE(e.name,"custom");return n=A.none(),s=$k.parts.field({factory:Lb,...fE(e,A.some(o),t,[k_(""),b_()])}),qk(n,s,[],[]);var n,s})(e,t.shared.providers))),checkbox:BE(((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),A.some(!0)),s=$k.parts.field({factory:{sketch:w},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:ma([b_(),pg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{at(e.element).each((e=>ka(e,"tox-checkbox--disabled")))},onEnabled:e=>{at(e.element).each((e=>Oa(e,"tox-checkbox--disabled")))}}),Ub.config({}),Rh.config({}),S_(o,DE,ME),xh.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),Mh("checkbox-events",[Gr(nr(),((t,o)=>{zr(t,Jk,{name:e.name})}))])])}),r=$k.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[ul(t.translate(e.label))],behaviours:ma([bC.config({})])}),a=e=>ry("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=Vb({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return $k.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[s,i.asSpec(),r],fieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),cw()])})})(e,t.shared.providers,o))),colorinput:BE(((e,t,o)=>((e,t,o,n)=>{const s=$k.parts.field({factory:Iy,inputClasses:["tox-textfield"],data:n,onSetValue:e=>fC.run(e).get(b),inputBehaviours:ma([pg.config({disabled:t.providers.isDisabled}),cw(),Ub.config({}),fC.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>at(e.element),notify:{onValid:e=>{const t=qu.getValue(e);zr(e,vC,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=qu.getValue(e);if(0===t.length)return ak(dn.value(!0));{const e=Re("span");Bt(e,"background-color",t);const o=Lt(e,"background-color").fold((()=>dn.error("blah")),(e=>dn.value(t)));return ak(o)}}}})]),selectOnFocus:!1}),r=e.label.map((e=>Kk(e,t.providers))),a=(e,t)=>{zr(e,yC,{value:t})},i=Vb(((e,t)=>xk.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:ma([dw(t.providers.isDisabled),cw(),bC.config({}),Ub.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>rk((t=>e.fetch(t))).map((n=>A.from(Ek(wn(PS(Bi("menu-value"),n,(t=>{e.onItemAction(o,t)}),e.columns,e.presets,dy.CLOSE_ON_EXECUTE,T,t.providers),{movement:WS(e.columns,e.presets)}))))),parts:{menu:Ey(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[Zl,Jl,oc],onLtr:()=>[Jl,Zl,oc]},components:[],fetch:IS(o.getColors(e.storageKey),e.storageKey,o.hasCustomColors()),columns:o.getColorCols(e.storageKey),presets:"color",onItemAction:(t,n)=>{i.getOpt(t).each((t=>{"custom"===n?o.colorPicker((o=>{o.fold((()=>Lr(t,xC)),(o=>{a(t,o),mS(e.storageKey,o)}))}),"#ffffff"):a(t,"remove"===n?"":n)}))}},t));return $k.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:r.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[s,i.asSpec()]}]),fieldBehaviours:ma([Mh("form-field-events",[Gr(vC,((t,o)=>{i.getOpt(t).each((e=>{Bt(e.element,"background-color",o.event.color)})),zr(t,Jk,{name:e.name})})),Gr(yC,((e,t)=>{$k.getField(e).each((o=>{qu.setValue(o,t.event.value),eg.getCurrent(e).each(Rh.focus)}))})),Gr(xC,((e,t)=>{$k.getField(e).each((t=>{eg.getCurrent(e).each(Rh.focus)}))}))])])})})(e,t.shared,t.colorinput,o))),colorpicker:BE(((e,t,o)=>((e,t,o)=>{const n=e=>"tox-"+e,s=f_((e=>t=>r(t)?e.translate(C_[t]):e.translate(t))(t),n),a=Vb(s.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{zr(e,eC,{name:"hex-valid",value:!0})},onInvalidHex:e=>{zr(e,eC,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:ma([w_(o,(e=>{const t=a.get(e);return eg.getCurrent(t).bind((e=>qu.getValue(e).hex)).map((e=>"#"+Oe(e,"#"))).getOr("")}),((e,t)=>{const o=A.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind((e=>ee(e,1))),n=a.get(e);eg.getCurrent(n).fold((()=>{console.log("Can not find form")}),(e=>{qu.setValue(e,{hex:o.getOr("")}),d_.getField(e,"hex").each((e=>{Lr(e,or())}))}))})),b_()])}})(0,t.shared.providers,o))),dropzone:BE(((e,t,o)=>((e,t,o)=>{const n=(e,t)=>{t.stop()},s=e=>(t,o)=>{V(e,(e=>{e(t,o)}))},r=(e,t)=>{var o;if(!pg.isDisabled(e)){const n=t.event.raw;i(e,null===(o=n.dataTransfer)||void 0===o?void 0:o.files)}},a=(e,t)=>{const o=t.event.raw.target;i(e,o.files)},i=(o,n)=>{n&&(qu.setValue(o,((e,t)=>{const o=T_.explode(t.getOption("images_file_types"));return P(ne(e),(e=>R(o,(t=>Ee(e.name.toLowerCase(),`.${t.toLowerCase()}`)))))})(n,t)),zr(o,Jk,{name:e.name}))},l=Vb({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:ma([Mh("input-file-events",[Jr(sr()),Jr(br())])])}),c=e.label.map((e=>Kk(e,t))),d=$k.parts.field({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:ma([k_(o.getOr([])),b_(),pg.config({}),Wh.config({toggleClass:"dragenter",toggleOnExecute:!1}),Mh("dropzone-events",[Gr("dragenter",s([n,Wh.toggle])),Gr("dragleave",s([n,Wh.toggle])),Gr("dragover",n),Gr("drop",s([n,r])),Gr(nr(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[ul(t.translate("Drop an image here"))]},Lb.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[ul(t.translate("Browse for an image")),l.asSpec()],action:e=>{l.get(e).element.dom.click()},buttonBehaviours:ma([Ub.config({}),dw(t.isDisabled),cw()])})]}]})}});return qk(c,d,["tox-form__group--stretched"],[])})(e,t.shared.providers,o))),grid:BE(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:z(e.items,t.interpreter)}))(e,t.shared))),listbox:BE(((e,t,o)=>((e,t,o)=>{const n=t.shared.providers,s=o.bind((t=>hT(e.items,t))).orThunk((()=>te(e.items).filter(mT))),r=e.label.map((e=>Kk(e,n))),a=$k.parts.field({dom:{},factory:{sketch:o=>iT({uid:o.uid,text:s.map((e=>e.text)),icon:A.none(),tooltip:A.none(),role:A.none(),ariaLabel:e.label,fetch:(o,n)=>{const s=pT(o,e.name,e.items,qu.getValue(o));n(uT(s,dy.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:A.none()}))},onSetup:x(b),getApi:x({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[Ub.config({}),w_(s.map((e=>e.value)),(e=>_t(e.element,gT)),((t,o)=>{hT(e.items,o).each((e=>{Ct(t.element,gT,e.value),zr(t,rT,{text:e.text})}))}))]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return $k.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:G([r.toArray(),[i]]),fieldBehaviours:ma([pg.config({disabled:x(!e.enabled),onDisabled:e=>{$k.getField(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable)}})])})})(e,t,o))),selectbox:BE(((e,t,o)=>((e,t,o)=>{const n=z(e.items,(e=>({text:t.translate(e.text),value:e.value}))),s=e.label.map((e=>Kk(e,t))),r=$k.parts.field({dom:{},...o.map((e=>({data:e}))).getOr({}),selectAttributes:{size:e.size},options:n,factory:fT,selectBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),Ub.config({}),Mh("selectbox-change",[Gr(nr(),((t,o)=>{zr(t,Jk,{name:e.name})}))])])}),a=e.size>1?A.none():A.some(ry("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:G([[r],a.toArray()])};return $k.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:G([s.toArray(),[i]]),fieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{$k.getField(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable)}}),cw()])})})(e,t.shared.providers,o))),sizeinput:BE(((e,t)=>((e,t)=>{let o=kT;const n=Bi("ratio-event"),s=e=>ry(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),r=e.label.getOr("Constrain proportions"),a=t.translate(r),i=xT.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":a,"data-mce-name":r}},components:[s("lock"),s("unlock")],buttonBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),cw(),Ub.config({}),Qb.config(t.tooltips.getConfig({tooltipText:a}))])}),l=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),c=o=>$k.parts.field({factory:Iy,inputClasses:["tox-textfield"],inputBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),cw(),Ub.config({}),Mh("size-input-events",[Gr(Zs(),((e,t)=>{zr(e,n,{isField1:o})})),Gr(nr(),((t,o)=>{zr(t,Jk,{name:e.name})}))])]),selectOnFocus:!1}),d=e=>({dom:{tag:"label",classes:["tox-label"]},components:[ul(t.translate(e))]}),u=xT.parts.field1(l([$k.parts.label(d("Width")),c(!0)])),m=xT.parts.field2(l([$k.parts.label(d("Height")),c(!1)]));return xT.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[u,m,l([d("\xa0"),i])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{wT(qu.getValue(e)).each((e=>{o(e).each((e=>{qu.setValue(t,(e=>{const t={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,in:4,"%":4};let o=e.value.toFixed((n=e.unit)in t?t[n]:1);var n;return-1!==o.indexOf(".")&&(o=o.replace(/\.?0*$/,"")),o+e.unit})(e))}))}))},coupledFieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{xT.getField1(e).bind($k.getField).each(pg.disable),xT.getField2(e).bind($k.getField).each(pg.disable),xT.getLock(e).each(pg.disable)},onEnabled:e=>{xT.getField1(e).bind($k.getField).each(pg.enable),xT.getField2(e).bind($k.getField).each(pg.enable),xT.getLock(e).each(pg.enable)}}),cw(),Mh("size-input-events2",[Gr(n,((e,t)=>{const n=t.event.isField1,s=n?xT.getField1(e):xT.getField2(e),r=n?xT.getField2(e):xT.getField1(e),a=s.map(qu.getValue).getOr(""),i=r.map(qu.getValue).getOr("");o=((e,t)=>{const o=wT(e).toOptional(),n=wT(t).toOptional();return we(o,n,((e,t)=>ST(e,t.unit).map((e=>t.value/e)).map((e=>{return o=e,n=t.unit,e=>ST(e,n).map((e=>({value:e*o,unit:n})));var o,n})).getOr(kT))).getOr(kT)})(a,i)}))])])})})(e,t.shared.providers))),slider:BE(((e,t,o)=>((e,t,o)=>{const n=o_.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[ul(t.translate(e.label))]}),s=o_.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),r=o_.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return o_.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:x(o.getOrThunk((()=>(Math.abs(e.max)-Math.abs(e.min))/2)))},components:[n,s,r],sliderBehaviours:ma([b_(),Rh.config({})]),onChoose:(t,o,n)=>{zr(t,Jk,{name:e.name,value:n})}})})(e,t.shared.providers,o))),urlinput:BE(((e,t,o)=>((e,t,o,n)=>{const s=t.shared.providers,r=t=>{const n=qu.getValue(t);o.addToHistory(n.value,e.filetype)},a={...n.map((e=>({initialData:e}))).getOr({}),dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":AE,type:"url"},minChars:0,responseTime:0,fetch:n=>{const s=((e,t,o)=>{var n,s;const r=qu.getValue(t),a=null!==(s=null===(n=null==r?void 0:r.meta)||void 0===n?void 0:n.text)&&void 0!==s?s:r.value;return o.getLinkInformation().fold((()=>[]),(t=>{const n=EE(a,(e=>z(e,(e=>SE(e,e))))(o.getHistory(e)));return"file"===e?(s=[n,EE(a,CE(t)),EE(a,G([_E(t),OE(t),TE(t)]))],W(s,((e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(xE,t)),[])):n;var s}))})(e.filetype,n,o),r=uT(s,dy.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:A.none()});return ak(r)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(fC)&&fC.run(e).get(b)},typeaheadBehaviours:ma([...o.getValidationHandler().map((t=>fC.config({getRoot:e=>at(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each((e=>{Ct(e.element,"title",s.translate(t))}))}},validator:{validate:o=>{const n=qu.getValue(o);return mE((o=>{t({type:e.filetype,url:n.value},(e=>{if("invalid"===e.status){const t=dn.error(e.message);o(t)}else{const t=dn.value(e.message);o(t)}}))}))},validateOnLoad:!1}}))).toArray(),pg.config({disabled:()=>!e.enabled||s.isDisabled()}),Ub.config({}),Mh("urlinput-events",[Gr(or(),(t=>{const o=ol(t.element),n=o.trim();n!==o&&nl(t.element,n),"file"===e.filetype&&zr(t,Jk,{name:e.name})})),Gr(nr(),(t=>{zr(t,Jk,{name:e.name}),r(t)})),Gr(gr(),(t=>{zr(t,Jk,{name:e.name}),r(t)}))])]),eventOrder:{[or()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:e=>e.value,selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:t.shared.getSink,parts:{menu:Ey(0,0,"normal")},onExecute:(e,t,o)=>{zr(t,tC,{})},onItemExecute:(t,o,n,s)=>{r(t),zr(t,Jk,{name:e.name})}},i=$k.parts.field({...a,factory:dE}),l=e.label.map((e=>Kk(e,s))),c=Vb(((e,t,o=e,n=e)=>ry(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:s.translate(n),"aria-live":"polite",...t.fold((()=>({})),(e=>({id:e})))}},s.icons))("invalid",A.some(AE),"warning")),d=Vb({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),u=o.getUrlPicker(e.filetype),m=Bi("browser.url.event"),g=Vb({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:ma([pg.config({disabled:()=>!e.enabled||s.isDisabled()})])}),p=Vb(bE({name:e.name,icon:A.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:A.none(),borderless:!0},(e=>Lr(e,m)),s,[],["tox-browse-url"]));return $k.sketch({dom:Xk([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:G([[g.asSpec()],u.map((()=>p.asSpec())).toArray()])}]),fieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||s.isDisabled(),onDisabled:e=>{$k.getField(e).each(pg.disable),p.getOpt(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable),p.getOpt(e).each(pg.enable)}}),cw(),Mh("url-input-events",[Gr(m,(t=>{eg.getCurrent(t).each((o=>{const n=qu.getValue(o),s={fieldname:e.name,...n};u.each((n=>{n(s).get((n=>{qu.setValue(o,n),zr(t,Jk,{name:e.name})}))}))}))}))])])})})(e,t,t.urlinput,o))),customeditor:BE((e=>{const t=rn(),o=Vb({dom:{tag:e.tag}}),n=rn(),s=!__(e)&&e.onFocus.isSome()?[Rh.config({onFocus:t=>{e.onFocus.each((e=>{e(t.element.dom)}))}}),Ub.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:ma([Mh("custom-editor-events",[ea((s=>{o.getOpt(s).each((o=>{(__(e)?e.init(o.element.dom):O_.load(e.scriptId,e.scriptUrl).then((t=>t(o.element.dom,e.settings)))).then((e=>{n.on((t=>{e.setValue(t)})),n.clear(),t.set(e)}))}))}))]),w_(A.none(),(()=>t.get().fold((()=>n.get().getOr("")),(e=>e.getValue()))),((e,o)=>{t.get().fold((()=>n.set(o)),(e=>e.setValue(o)))})),b_()].concat(s)),components:[o.asSpec()]}})),htmlpanel:BE(((e,t)=>((e,t)=>"presentation"===e.presets?Pk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html},containerBehaviours:ma([Qb.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{_l(e.element,"[data-mce-tooltip]:hover").orThunk((()=>yc(e.element))).each((o=>{Tt(o,"data-mce-tooltip").each((o=>{Qb.setComponents(e,t.tooltips.getComponents({tooltipText:o}))}))}))}}),mode:"children-normal",anchor:e=>({type:"node",node:_l(e.element,"[data-mce-tooltip]:hover").orThunk((()=>yc(e.element).filter((e=>Tt(e,"data-mce-tooltip").isSome())))),root:e.element,layouts:{onLtr:x([oc,tc,Jl,Ql,Zl,ec]),onRtl:x([oc,tc,Jl,Ql,Zl,ec])},bubble:Gc(0,-2,{})})})])}):Pk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:ma([Ub.config({}),Rh.config({})])}))(e,t.shared.providers))),imagepreview:BE(((e,t,o)=>((e,t)=>{const o=on(t.getOr({url:""})),n=Vb({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map((e=>({src:e.url}))).getOr({})}}),s=Vb({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),r={};e.height.each((e=>r.height=e));const a=t.map((e=>({url:e.url,zoom:A.from(e.zoom),cachedWidth:A.from(e.cachedWidth),cachedHeight:A.from(e.cachedHeight)})));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:r,attributes:{role:"presentation"}},components:[s.asSpec()],behaviours:ma([b_(),w_(a,(()=>o.get()),((e,t)=>{const r={url:t.url};t.zoom.each((e=>r.zoom=e)),t.cachedWidth.each((e=>r.cachedWidth=e)),t.cachedHeight.each((e=>r.cachedHeight=e)),o.set(r);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=r;if(!u(t)&&!u(o)){if(u(n)){const n=((e,t,o)=>{const n=Zt(e),s=jt(e);return Math.min(n/t,s/o,1)})(e.element,t,o);r.zoom=n}const a=((e,t,o,n,s)=>{const r=o*s,a=n*s,i=Math.max(0,e/2-r/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:r.toString()+"px",height:a.toString()+"px"}})(Zt(e.element),jt(e.element),t,o,r.zoom);s.getOpt(e).each((e=>{It(e.element,a)}))}};n.getOpt(e).each((o=>{const n=o.element;var s;t.url!==_t(n,"src")&&(Ct(n,"src",t.url),Oa(e.element,"tox-imagepreview__loaded")),a(),(s=n,new Promise(((e,t)=>{const o=()=>{r(),e(s)},n=[Fc(s,"load",o),Fc(s,"error",(()=>{r(),t("Unable to load data from image: "+s.dom.src)}))],r=()=>V(n,(e=>e.unbind()));s.dom.complete&&o()}))).then((t=>{e.getSystem().isConnected()&&(ka(e.element,"tox-imagepreview__loaded"),r.cachedWidth=t.dom.naturalWidth,r.cachedHeight=t.dom.naturalHeight,a())}))}))}))])}})(e,o))),table:BE(((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"td",innerHtml:t.translate(e)}});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(s=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:z(s,(e=>({dom:{tag:"th",innerHtml:t.translate(e)}})))}]}),(n=e.cells,{dom:{tag:"tbody"},components:z(n,(e=>({dom:{tag:"tr"},components:z(e,o)})))})],behaviours:ma([Ub.config({}),Rh.config({})])};var n,s})(e,t.shared.providers))),tree:BE(((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(b),n=e.onToggleExpand.getOr(b),s=e.defaultExpandedIds,r=on(s),a=on(e.defaultSelectedId),i=Bi("tree-id"),l=(n,s)=>e.items.map((e=>"leaf"===e.type?GT({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):JT({directory:e,selectedId:n,onLeafAction:o,expandedIds:s,labelTabstopping:!0,treeId:i,backstage:t})));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),r.get()),behaviours:ma([xh.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),Mh(ZT,[Gr("expand-tree-node",((e,t)=>{const{expanded:o,node:s}=t.event;r.set(o?[...r.get(),s]:r.get().filter((e=>e!==s))),n(r.get(),{expanded:o,node:s})}))]),gc.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(A.some(t.value)),Ah.set(e,l(A.some(t.value),r.get()))}}}}),Ah.config({})])}})(e,t))),panel:BE(((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:z(e.items,t.shared.interpreter)}))(e,t)))},FE={field:(e,t)=>t,record:x([])},RE=(e,t,o,n)=>{const s=wn(n,{shared:{interpreter:t=>NE(e,t,o,s)}});return NE(e,t,o,s)},NE=(e,t,o,n)=>fe(IE,t.type).fold((()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t)),(s=>s(e,t,o,n))),LE=(e,t,o)=>NE(FE,e,t,o),zE="layout-inset",VE=e=>e.x,HE=(e,t)=>e.x+e.width/2-t.width/2,PE=(e,t)=>e.x+e.width-t.width,UE=e=>e.y,WE=(e,t)=>e.y+e.height-t.height,jE=(e,t)=>e.y+e.height/2-t.height/2,$E=(e,t,o)=>Dl(PE(e,t),WE(e,t),o.insetSouthwest(),Nl(),"southwest",Wl(e,{right:0,bottom:3}),zE),GE=(e,t,o)=>Dl(VE(e),WE(e,t),o.insetSoutheast(),Rl(),"southeast",Wl(e,{left:1,bottom:3}),zE),qE=(e,t,o)=>Dl(PE(e,t),UE(e),o.insetNorthwest(),Fl(),"northwest",Wl(e,{right:0,top:2}),zE),YE=(e,t,o)=>Dl(VE(e),UE(e),o.insetNortheast(),Il(),"northeast",Wl(e,{left:1,top:2}),zE),XE=(e,t,o)=>Dl(HE(e,t),UE(e),o.insetNorth(),Ll(),"north",Wl(e,{top:2}),zE),KE=(e,t,o)=>Dl(HE(e,t),WE(e,t),o.insetSouth(),zl(),"south",Wl(e,{bottom:3}),zE),JE=(e,t,o)=>Dl(PE(e,t),jE(e,t),o.insetEast(),Hl(),"east",Wl(e,{right:0}),zE),ZE=(e,t,o)=>Dl(VE(e),jE(e,t),o.insetWest(),Vl(),"west",Wl(e,{left:1}),zE),QE=e=>{switch(e){case"north":return XE;case"northeast":return YE;case"northwest":return qE;case"south":return KE;case"southeast":return GE;case"southwest":return $E;case"east":return JE;case"west":return ZE}},eA=(e,t,o,n,s)=>Mc(n).map(QE).getOr(XE)(e,t,o,n,s),tA=e=>{switch(e){case"north":return KE;case"northeast":return GE;case"northwest":return $E;case"south":return XE;case"southeast":return YE;case"southwest":return qE;case"east":return ZE;case"west":return JE}},oA=(e,t,o,n,s)=>Mc(n).map(tA).getOr(XE)(e,t,o,n,s),nA={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},sA=(e,t,o)=>{const n={maxHeightFunction:Uc()};return()=>o()?{type:"node",root:bt(ft(e())),node:A.from(e()),bubble:Gc(12,12,nA),layouts:{onRtl:()=>[YE],onLtr:()=>[qE]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:Gc(-12,12,nA),layouts:{onRtl:()=>[Jl,Zl,oc],onLtr:()=>[Zl,Jl,oc]},overrides:n}},rA=(e,t,o,n)=>{const s={maxHeightFunction:Uc()};return()=>n()?{type:"node",root:bt(ft(t())),node:A.from(t()),bubble:Gc(12,12,nA),layouts:{onRtl:()=>[XE],onLtr:()=>[XE]},overrides:s}:e?{type:"node",root:bt(ft(t())),node:A.from(t()),bubble:Gc(0,-$t(t()),nA),layouts:{onRtl:()=>[tc],onLtr:()=>[tc]},overrides:s}:{type:"hotspot",hotspot:o(),bubble:Gc(0,0,nA),layouts:{onRtl:()=>[tc],onLtr:()=>[tc]},overrides:s}},aA=(e,t,o)=>()=>o()?{type:"node",root:bt(ft(e())),node:A.from(e()),layouts:{onRtl:()=>[XE],onLtr:()=>[XE]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[oc],onLtr:()=>[oc]}},iA=(e,t)=>()=>({type:"selection",root:t(),getSelection:()=>{const t=e.selection.getRng(),o=e.model.table.getSelectedCells();if(o.length>1){const e=o[0],t=o[o.length-1],n={firstCell:Le(e),lastCell:Le(t)};return A.some(n)}return A.some(yd.range(Le(t.startContainer),t.startOffset,Le(t.endContainer),t.endOffset))}}),lA=e=>t=>({type:"node",root:e(),node:t}),cA=(e,t,o,n)=>{const s=Ob(e),r=()=>Le(e.getBody()),a=()=>Le(e.getContentAreaContainer()),i=()=>s||!n();return{inlineDialog:sA(a,t,i),inlineBottomDialog:rA(e.inline,a,o,i),banner:aA(a,t,i),cursor:iA(e,r),node:lA(r)}},dA=e=>(t,o)=>{HS(e)(t,o)},uA=e=>()=>_S(e),mA=e=>t=>SS(e,t),gA=e=>t=>OS(e,t),pA=e=>()=>rb(e),hA=e=>ve(e,"items"),fA=e=>ve(e,"format"),bA=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",format:"bold"},{title:"Italic",format:"italic"},{title:"Underline",format:"underline"},{title:"Strikethrough",format:"strikethrough"},{title:"Superscript",format:"superscript"},{title:"Subscript",format:"subscript"},{title:"Code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Align",items:[{title:"Left",format:"alignleft"},{title:"Center",format:"aligncenter"},{title:"Right",format:"alignright"},{title:"Justify",format:"alignjustify"}]}],vA=e=>W(e,((e,t)=>{if(be(t,"items")){const o=vA(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if(be(t,"inline")||(e=>be(e,"block"))(t)||(e=>be(e,"selector"))(t)){const o=`custom-${r(t.name)?t.name:t.title.toLowerCase()}`;return{customFormats:e.customFormats.concat([{name:o,format:t}]),formats:e.formats.concat([{title:t.title,format:o,icon:t.icon}])}}return{...e,formats:e.formats.concat(t)}}),{customFormats:[],formats:[]}),yA=e=>zf(e).map((t=>{const o=((e,t)=>{const o=vA(t),n=t=>{V(t,(t=>{e.formatter.has(t.name)||e.formatter.register(t.name,t.format)}))};return e.formatter?n(o.customFormats):e.on("init",(()=>{n(o.customFormats)})),o.formats})(e,t);return Vf(e)?bA.concat(o):o})).getOr(bA),xA=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),wA=(e,t,o,n)=>{const s=t=>z(t,(t=>hA(t)?(e=>{const t=s(e.items);return{...e,type:"submenu",getStyleItems:x(t)}})(t):fA(t)?(e=>xA(e,o,n))(t):(e=>{const t=re(e);return 1===t.length&&F(t,"title")})(t)?{...t,type:"separator"}:(t=>{const s=r(t.name)?t.name:Bi(t.title),a=`custom-${s}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(s,i),i})(t)));return s(t)},SA=e=>{let t=0;const o=e=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[ul(e.tooltipText)]}];return{getConfig:n=>({delayForShow:()=>t>0?60:300,delayForHide:x(300),exclusive:!0,lazySink:e,tooltipDom:{tag:"div",classes:["tox-tooltip","tox-tooltip--up"]},tooltipComponents:o(n),onShow:(e,o)=>{t++,n.onShow&&n.onShow(e,o)},onHide:()=>{t--}}),getComponents:o}},kA=T_.trim,CA=e=>t=>{if((e=>g(e)&&1===e.nodeType)(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},OA=CA("true"),_A=CA("false"),TA=(e,t,o,n,s)=>({type:e,title:t,url:o,level:n,attach:s}),EA=e=>e.innerText||e.textContent,AA=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&DA(e),MA=e=>e&&/^(H[1-6])$/.test(e.nodeName),DA=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return OA(t)}return!1})(e)&&!_A(e),BA=e=>MA(e)&&DA(e),IA=e=>{var t;const o=(e=>e.id?e.id:Bi("h"))(e);return TA("header",null!==(t=EA(e))&&void 0!==t?t:"","#"+o,(e=>MA(e)?parseInt(e.nodeName.substr(1),10):0)(e),(()=>{e.id=o}))},FA=e=>{const t=e.id||e.name,o=EA(e);return TA("anchor",o||"#"+t,"#"+t,0,b)},RA=e=>kA(e.title).length>0,NA=e=>{const t=(e=>{const t=z(Td(Le(e),"h1,h2,h3,h4,h5,h6,a:not([href])"),(e=>e.dom));return t})(e);return P((e=>z(P(e,BA),IA))(t).concat((e=>z(P(e,AA),FA))(t)),RA)},LA="tinymce-url-history",zA=e=>r(e)&&/^https?/.test(e),VA=e=>a(e)&&pe(e,(e=>{return!(l(t=e)&&t.length<=5&&Y(t,zA));var t})).isNone(),HA=()=>{const e=cS.getItem(LA);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+LA+" was not valid JSON",e),{};throw e}return VA(t)?t:(console.log("Local storage "+LA+" was not valid format",t),{})},PA=e=>{const t=HA();return fe(t,e).getOr([])},UA=(e,t)=>{if(!zA(e))return;const o=HA(),n=fe(o,t).getOr([]),s=P(n,(t=>t!==e));o[t]=[e].concat(s).slice(0,5),(e=>{if(!VA(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));cS.setItem(LA,JSON.stringify(e))})(o)},WA=e=>!!e,jA=e=>le(T_.makeMap(e,/[, ]/),WA),$A=e=>A.from(Zf(e)),GA=e=>A.from(e).filter(r).getOrUndefined(),qA=e=>({getHistory:PA,addToHistory:UA,getLinkInformation:()=>(e=>ob(e)?A.some({targets:NA(e.getBody()),anchorTop:GA(nb(e)),anchorBottom:GA(sb(e))}):A.none())(e),getValidationHandler:()=>(e=>A.from(Qf(e)))(e),getUrlPicker:t=>((e,t)=>((e,t)=>{const o=(e=>{const t=A.from(tb(e)).filter(WA).map(jA);return $A(e).fold(T,(e=>t.fold(E,(e=>re(e).length>0&&e))))})(e);return d(o)?o?$A(e):A.none():o[t]?$A(e):A.none()})(e,t).map((o=>n=>rk((s=>{const i={filetype:t,fieldname:n.fieldname,...A.from(n.meta).getOr({})};o.call(e,((e,t)=>{if(!r(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");s({value:e,meta:t})}),n.value,i)})))))(e,t)}),YA=Wm,XA=_m,KA=x([Cs("shell",!1),is("makeItem"),Cs("setupItem",b),Ju("listBehaviours",[Ah])]),JA=km({name:"items",overrides:()=>({behaviours:ma([Ah.config({})])})}),ZA=x([JA]),QA=Km({name:x("CustomList")(),configFields:KA(),partFields:ZA(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[Ah.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Ku(e.listBehaviours,s.behaviours),apis:{setItems:(t,o)=>{var n;(n=t,e.shell?A.some(n):Rm(n,e,"items")).fold((()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")}),(n=>{const s=Ah.contents(n),r=o.length,a=r-s.length,i=a>0?N(a,(()=>e.makeItem())):[],l=s.slice(r);V(l,(e=>Ah.remove(n,e))),V(i,(e=>Ah.append(n,e)));const c=Ah.contents(n);V(c,((n,s)=>{e.setupItem(t,n,o[s],s)}))}))}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),eM=x([is("dom"),Cs("shell",!0),Yu("toolbarBehaviours",[Ah])]),tM=x([km({name:"groups",overrides:()=>({behaviours:ma([Ah.config({})])})})]),oM=Km({name:"Toolbar",configFields:eM(),partFields:tM(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[Ah.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Ku(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(t,o)=>{var n;(n=t,e.shell?A.some(n):Rm(n,e,"groups")).fold((()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")}),(e=>{Ah.set(e,o)}))},refresh:b},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),nM=b,sM=T,rM=x([]);var aM,iM=Object.freeze({__proto__:null,setup:nM,isDocked:sM,getBehaviours:rM});const lM=x(Bi("toolbar-height-change")),cM={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},dM="tox-tinymce--toolbar-sticky-on",uM="tox-tinymce--toolbar-sticky-off",mM=(e,t)=>F(Ei.getModes(e),t),gM=e=>{const t=e.element;at(t).each((o=>{const n="padding-"+Ei.getModes(e)[0];if(Ei.isDocked(e)){const e=Zt(o);Bt(t,"width",e+"px"),Bt(o,n,(e=>$t(e)+(parseInt(Rt(e,"margin-top"),10)||0)+(parseInt(Rt(e,"margin-bottom"),10)||0))(t)+"px")}else Ht(t,"width"),Ht(o,n)}))},pM=(e,t)=>{t?(Oa(e,cM.fadeOutClass),Ta(e,[cM.transitionClass,cM.fadeInClass])):(Oa(e,cM.fadeInClass),Ta(e,[cM.fadeOutClass,cM.transitionClass]))},hM=(e,t)=>{const o=Le(e.getContainer());t?(ka(o,dM),Oa(o,uM)):(ka(o,uM),Oa(o,dM))},fM=(e,t)=>{const o=rn(),n=t.getSink,s=e=>{n().each((t=>e(t.element)))},r=t=>{e.inline||gM(t),hM(e,Ei.isDocked(t)),t.getSystem().broadcastOn([Au()],{}),n().each((e=>e.getSystem().broadcastOn([Au()],{})))},a=e.inline?[]:[gc.config({channels:{[lM()]:{onReceive:gM}}})];return[Rh.config({}),Ei.config({contextual:{lazyContext:t=>{const o=$t(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return A.from(n).map((n=>{const s=Zo(Le(n));return Rb(e,t.element).fold((()=>{const e=s.height-o,n=s.y+(mM(t,"top")?0:o);return Jo(s.x,n,s.width,e)}),(e=>{const n=en(s,Nb(e)),r=mM(t,"top")?n.y:n.y+o;return Jo(n.x,r,n.width,n.height-o)}))}))},onShow:()=>{s((e=>pM(e,!0)))},onShown:e=>{s((e=>Ea(e,[cM.transitionClass,cM.fadeInClass]))),o.get().each((t=>{((e,t)=>{const o=tt(t);vc(o).filter((e=>!Qe(t,e))).filter((t=>Qe(t,Le(o.dom.body))||et(e,t))).each((()=>hc(t)))})(e.element,t),o.clear()}))},onHide:e=>{((e,t)=>yc(e).orThunk((()=>t().toOptional().bind((e=>yc(e.element))))))(e.element,n).fold(o.clear,o.set),s((e=>pM(e,!1)))},onHidden:()=>{s((e=>Ea(e,[cM.transitionClass])))},...cM},lazyViewport:t=>Rb(e,t.element).fold((()=>{const o=tn(),n=Xf(e),s=o.y+(mM(t,"top")?n:0),r=o.height-(mM(t,"bottom")?n:0);return{bounds:Jo(o.x,s,o.width,r),optScrollEnv:A.none()}}),(e=>({bounds:Nb(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Xt(e.element).top})}))),modes:[t.header.getDockingMode()],onDocked:r,onUndocked:r}),...a]};var bM=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",(()=>{o().each(Ei.reset)})),e.on("ResizeWindow ResizeEditor",(()=>{o().each(gM)})),e.on("SkinLoaded",(()=>{o().each((e=>{Ei.isDocked(e)?Ei.reset(e):Ei.refresh(e)}))})),e.on("FullscreenStateChanged",(()=>{o().each(Ei.reset)}))),e.on("AfterScrollIntoView",(e=>{o().each((t=>{Ei.refresh(t);const o=t.element;gp(o)&&((e,t)=>{const o=tt(t),n=st(t).dom.innerHeight,s=Wo(o),r=Le(e.elm),a=Qo(r),i=jt(r),l=a.y,c=l+i,d=Xt(t),u=jt(t),m=d.top,g=m+u,p=Math.abs(m-s.top)<2,h=Math.abs(g-(s.top+n))<2;if(p&&lm){const e=l-n+i+u;jo(s.left,e,o)}})(e,o)}))})),e.on("PostRender",(()=>{hM(e,!1)}))},isDocked:e=>e().map(Ei.isDocked).getOr(!1),getBehaviours:fM});const vM=Nn([Jy,ls("items",zn([Hn([Zy,hs("items",jn)]),jn]))].concat(Tx)),yM=[ys("text"),ys("tooltip"),ys("icon"),Os("search",!1,zn([$n,Nn([ys("placeholder")])],(e=>d(e)?e?A.some({placeholder:A.none()}):A.none():A.some(e)))),ms("fetch"),Ms("onSetup",(()=>b))],xM=Nn([Jy,...yM]),wM=e=>Zn("menubutton",xM,e),SM=Nn([Jy,mx,ux,dx,hx,sx,lx,Es("presets","normal",["normal","color","listpreview"]),xx(1),ax,ix]);var kM=Xm({factory:(e,t)=>{const o={focus:xh.focusIn,setMenus:(e,o)=>{const n=z(o,(e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())}},n=wM(o).mapError((e=>ts(e))).getOrDie();return UT(n,"tox-mbtn",t.backstage,A.some("menuitem"))}));Ah.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:ma([Ah.config({}),Mh("menubar-events",[ea((t=>{e.onSetup(t)})),Gr(Js(),((e,t)=>{_l(e.element,".tox-mbtn--active").each((o=>{Tl(t.event.target,".tox-mbtn").each((t=>{Qe(o,t)||e.getSystem().getByDom(o).each((o=>{e.getSystem().getByDom(t).each((e=>{xk.expand(e),xk.close(o),Rh.focus(e)}))}))}))}))})),Gr(Mr(),((e,t)=>{t.event.prevFocus.bind((t=>e.getSystem().getByDom(t).toOptional())).each((o=>{t.event.newFocus.bind((t=>e.getSystem().getByDom(t).toOptional())).each((e=>{xk.isOpen(o)&&(xk.expand(e),xk.close(o))}))}))}))]),xh.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),A.some(!0))}),Ub.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[is("dom"),is("uid"),is("onEscape"),is("backstage"),Cs("onSetup",b)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const CM="container",OM=[Yu("slotBehaviours",[])],_M=e=>"",TM=(e,t)=>{const o=t=>Vm(e),n=(t,o)=>(n,s)=>Rm(n,e,s).map((e=>t(e,s))).getOr(o),s=(e,t)=>"true"!==_t(e.element,"aria-hidden"),r=n(s,!1),a=n(((e,t)=>{if(s(e)){const o=e.element;Bt(o,"display","none"),Ct(o,"aria-hidden","true"),zr(e,Dr(),{name:t,visible:!1})}})),i=(e=>(t,o)=>{V(o,(o=>e(t,o)))})(a),l=n(((e,t)=>{if(!s(e)){const o=e.element;Ht(o,"display"),At(o,"aria-hidden"),zr(e,Dr(),{name:t,visible:!0})}})),c={getSlotNames:o,getSlot:(t,o)=>Rm(t,e,o),isShowing:r,hideSlot:a,hideAllSlots:e=>i(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:Xu(e.slotBehaviours),apis:c}},EM=le({getSlotNames:(e,t)=>e.getSlotNames(t),getSlot:(e,t,o)=>e.getSlot(t,o),isShowing:(e,t,o)=>e.isShowing(t,o),hideSlot:(e,t,o)=>e.hideSlot(t,o),hideAllSlots:(e,t)=>e.hideAllSlots(t),showSlot:(e,t,o)=>e.showSlot(t,o)},(e=>Gi(e))),AM={...EM,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),Mm(CM,_M(t),o)),record:x(e)}})(),o=e(t),n=t.record(),s=z(n,(e=>wm({name:e,pname:_M(e)})));return $m(CM,OM,s,TM,o)}},MM=Nn([ux,mx,Ms("onShow",b),Ms("onHide",b),lx]),DM=e=>({element:()=>e.element.dom}),BM=(e,t)=>{const o=z(re(t),(e=>{const o=t[e],n=Qn((e=>Zn("sidebar",MM,e))(o));return{name:e,getApi:DM,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}}));return z(o,(t=>{const n=on(b);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:sw([pw(t,n),hw(t,n),Gr(Dr(),((e,t)=>{const n=t.event,s=j(o,(e=>e.name===n.name));s.each((t=>{(n.visible?t.onShow:t.onHide)(t.getApi(e))}))}))])})}))},IM=e=>AM.sketch((t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:BM(t,e),slotBehaviours:sw([ea((e=>AM.hideAllSlots(e)))])}))),FM=(e,t)=>{Ct(e,"role",t)},RM=e=>eg.getCurrent(e).bind((e=>HT.isGrowing(e)||HT.hasGrown(e)?eg.getCurrent(e).bind((e=>j(AM.getSlotNames(e),(t=>AM.isShowing(e,t))))):A.none())),NM=Bi("FixSizeEvent"),LM=Bi("AutoSizeEvent");var zM=Object.freeze({__proto__:null,block:(e,t,o,n)=>{Ct(e.element,"aria-busy",!0);const s=t.getRoot(e).getOr(e),r=ma([xh.config({mode:"special",onTab:()=>A.some(!0),onShiftTab:()=>A.some(!0)}),Rh.config({})]),a=n(s,r),i=s.getSystem().build(a);Ah.append(s,fl(i)),i.hasConfigured(xh)&&t.focus&&xh.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith((()=>Ah.remove(s,i)))},unblock:(e,t,o)=>{At(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},isBlocked:(e,t,o)=>o.isBlocked()}),VM=[Ms("getRoot",A.none),As("focus",!0),xi("onBlock"),xi("onUnblock")];const HM=pa({fields:VM,name:"blocking",apis:zM,state:Object.freeze({__proto__:null,init:()=>{const e=nn((e=>e.destroy()));return ua({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})}),PM=e=>eg.getCurrent(e).each((e=>hc(e.element,!0))),UM=(e,t,o)=>{const n=on(!1),s=rn(),r=o=>{var s;n.get()&&(!(e=>"focusin"===e.type)(s=o)||!(s.composed?te(s.composedPath()):A.from(s.target)).map(Le).filter($e).exists((e=>_a(e,"mce-pastebin"))))&&(o.preventDefault(),PM(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",(()=>{e.dom.bind(e.getWin(),"focusin",r),e.on("BeforeExecCommand",(e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&r(e)}))}));const a=s=>{s!==n.get()&&(n.set(s),((e,t,o,n)=>{const s=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;A.from(e.iframeElement).map(Le).each((e=>{t?(Tt(e,o).each((t=>Ct(e,n,t))),Ct(e,o,-1)):(At(e,o),Tt(e,n).each((t=>{Ct(e,o,t),At(e,n)})))}))})(e,o),o)HM.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:zb('')}]}))(n)),Ht(s,"display"),At(s,"aria-hidden"),e.hasFocus()&&PM(t);else{const o=eg.getCurrent(t).exists((e=>bc(e.element)));HM.unblock(t),Bt(s,"display","none"),Ct(s,"aria-hidden","true"),o&&e.focus()}})(e,t(),s,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,s))};e.on("ProgressState",(t=>{if(s.on(clearTimeout),h(t.time)){const o=Cf.setEditorTimeout(e,(()=>a(t.state)),t.time);s.set(o)}else a(t.state),s.clear()}))},WM=(e,t,o)=>({within:e,extra:t,withinWidth:o}),jM=(e,t,o)=>{const n=W(e,((e,t)=>((e,t)=>{const n=o(e);return A.some({element:e,start:t,finish:t+n,width:n})})(t,e.len).fold(x(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:0,list:[]}).list,s=P(n,(e=>e.finish<=t)),r=U(s,((e,t)=>e+t.width),0);return{within:s,extra:n.slice(s.length),withinWidth:r}},$M=e=>z(e,(e=>e.element)),GM=(e,t)=>{const o=z(t,(e=>fl(e)));oM.setGroups(e,o)},qM=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const s=Nm(e,t,"primary"),r=ek.getCoupled(e,"overflowGroup");Bt(s.element,"visibility","hidden");const a=n.concat([r]),i=se(a,(e=>yc(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()))));o([]),GM(s,a);const l=((e,t,o,n)=>{const s=((e,t,o)=>{const n=jM(t,e,o);return 0===n.extra.length?A.some(n):A.none()})(e,t,o).getOrThunk((()=>jM(t,e-o(n),o))),r=s.within,a=s.extra,i=s.withinWidth;return 1===a.length&&a[0].width<=o(n)?((e,t,o)=>{const n=$M(e.concat(t));return WM(n,[],o)})(r,a,i):a.length>=1?((e,t,o,n)=>{const s=$M(e).concat([o]);return WM(s,$M(t),n)})(r,a,n,i):((e,t,o)=>WM($M(e),[],o))(r,0,i)})(Zt(s.element),t.builtGroups.get(),(e=>Math.ceil(e.element.dom.getBoundingClientRect().width)),r);0===l.extra.length?(Ah.remove(s,r),o([])):(GM(s,l.within),o(l.extra)),Ht(s.element,"visibility"),Pt(s.element),i.each(Rh.focus)},YM=x([Yu("splitToolbarBehaviours",[ek]),rs("builtGroups",(()=>on([])))]),XM=x([vi(["overflowToggledClass"]),ws("getOverflowBounds"),is("lazySink"),rs("overflowGroups",(()=>on([]))),xi("onOpened"),xi("onClosed")].concat(YM())),KM=x([wm({factory:oM,schema:eM(),name:"primary"}),Sm({schema:eM(),name:"overflow"}),Sm({name:"overflow-button"}),Sm({name:"overflow-group"})]),JM=x(((e,t)=>{((e,t)=>{const o=Jt.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);Bt(e,"max-width",o+"px")})(e,Math.floor(t))})),ZM=x([vi(["toggledClass"]),is("lazySink"),ms("fetch"),ws("getBounds"),ks("fireDismissalEventInstead",[Cs("event",Er())]),ed(),xi("onToggled")]),QM=x([Sm({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:ma([Wh.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Sm({factory:oM,schema:eM(),name:"toolbar",overrides:e=>({toolbarBehaviours:ma([xh.config({mode:"cyclic",onEscape:t=>(Rm(t,e,"button").each(Rh.focus),A.none())})])})})]),eD=rn(),tD=(e,t)=>{const o=ek.getCoupled(e,"toolbarSandbox");Tu.isOpen(o)?Tu.close(o):Tu.open(o,t.toolbar())},oD=(e,t,o,n)=>{const s=o.getBounds.map((e=>e())),r=o.lazySink(e).getOrDie();tu.positionWithinBounds(r,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:JM()}}},s)},nD=(e,t,o,n,s)=>{oM.setGroups(t,s),oD(e,t,o,n),Wh.on(e)},sD=Km({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Lb.sketch({...n.button(),action:e=>{tD(e,n)},buttonBehaviours:Zu({dump:n.button().buttonBehaviours},[ek.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Al();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:ma([xh.config({mode:"special",onEscape:e=>(Tu.close(e),A.some(!0))}),Tu.config({onOpen:(s,r)=>{const a=eD.get().getOr(!1);o.fetch().get((s=>{nD(e,r,o,t.layouts,s),n.link(e.element),a||xh.focusIn(r)}))},onClose:()=>{Wh.off(e),eD.get().getOr(!1)||Rh.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>Ml(o,n)||Ml(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),gc.config({channels:{...Bu({isExtraPart:T,...o.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...Fu({doReposition:()=>{Tu.getState(ek.getCoupled(e,"toolbarSandbox")).each((n=>{oD(e,n,o,t.layouts)}))}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{Tu.getState(ek.getCoupled(t,"toolbarSandbox")).each((s=>{nD(t,s,e,o.layouts,n)}))},reposition:t=>{Tu.getState(ek.getCoupled(t,"toolbarSandbox")).each((n=>{oD(t,n,e,o.layouts)}))},toggle:e=>{tD(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{eD.set(!0),tD(e,t),eD.clear()})(e,n)},getToolbar:e=>Tu.getState(ek.getCoupled(e,"toolbarSandbox")),isOpen:e=>Tu.isOpen(ek.getCoupled(e,"toolbarSandbox"))}}),configFields:ZM(),partFields:QM(),apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggleWithoutFocusing(t)},getToolbar:(e,t)=>e.getToolbar(t),isOpen:(e,t)=>e.isOpen(t)}}),rD=x([is("items"),vi(["itemSelector"]),Yu("tgroupBehaviours",[xh])]),aD=x([Cm({name:"items",unit:"item"})]),iD=Km({name:"ToolbarGroup",configFields:rD(),partFields:aD(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.tgroupBehaviours,[xh.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),lD=e=>z(e,(e=>fl(e))),cD=(e,t,o)=>{qM(e,o,(n=>{o.overflowGroups.set(n),t.getOpt(e).each((e=>{sD.setGroups(e,lD(n))}))}))},dD=Km({name:"SplitFloatingToolbar",configFields:XM(),partFields:KM(),factory:(e,t,o,n)=>{const s=Vb(sD.sketch({fetch:()=>rk((t=>{t(lD(e.overflowGroups.get()))})),layouts:{onLtr:()=>[Zl,Jl],onRtl:()=>[Jl,Zl],onBottomLtr:()=>[ec,Ql],onBottomRtl:()=>[Ql,ec]},getBounds:o.getOverflowBounds,lazySink:e.lazySink,fireDismissalEventInstead:{},markers:{toggledClass:e.markers.overflowToggledClass},parts:{button:n["overflow-button"](),toolbar:n.overflow()},onToggled:(t,o)=>e[o?"onOpened":"onClosed"](t)}));return{uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.splitToolbarBehaviours,[ek.config({others:{overflowGroup:()=>iD.sketch({...n["overflow-group"](),items:[s.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(z(o,t.getSystem().build)),cD(t,s,e)},refresh:t=>cD(t,s,e),toggle:e=>{s.getOpt(e).each((e=>{sD.toggle(e)}))},toggleWithoutFocusing:e=>{s.getOpt(e).each(sD.toggleWithoutFocusing)},isOpen:e=>s.getOpt(e).map(sD.isOpen).getOr(!1),reposition:e=>{s.getOpt(e).each((e=>{sD.reposition(e)}))},getOverflow:e=>s.getOpt(e).bind(sD.getToolbar)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t),getOverflow:(e,t)=>e.getOverflow(t)}}),uD=x([vi(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),xi("onOpened"),xi("onClosed")].concat(YM())),mD=x([wm({factory:oM,schema:eM(),name:"primary"}),wm({factory:oM,schema:eM(),name:"overflow",overrides:e=>({toolbarBehaviours:ma([HT.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{Rm(t,e,"overflow-button").each((e=>{Wh.off(e)})),e.onClosed(t)},onGrown:t=>{e.onOpened(t)},onStartGrow:t=>{Rm(t,e,"overflow-button").each(Wh.on)}}),xh.config({mode:"acyclic",onEscape:t=>(Rm(t,e,"overflow-button").each(Rh.focus),A.some(!0))})])})}),Sm({name:"overflow-button",overrides:e=>({buttonBehaviours:ma([Wh.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])})}),Sm({name:"overflow-group"})]),gD=(e,t,o)=>{Rm(e,t,"overflow-button").each((n=>{Rm(e,t,"overflow").each((s=>{if(pD(e,t),HT.hasShrunk(s)){const e=t.onOpened;t.onOpened=n=>{o||xh.focusIn(s),e(n),t.onOpened=e}}else{const e=t.onClosed;t.onClosed=s=>{o||Rh.focus(n),e(s),t.onClosed=e}}HT.toggleGrow(s)}))}))},pD=(e,t)=>{Rm(e,t,"overflow").each((o=>{qM(e,t,(e=>{const t=z(e,(e=>fl(e)));oM.setGroups(o,t)})),Rm(e,t,"overflow-button").each((e=>{HT.hasGrown(o)&&Wh.on(e)})),HT.refresh(o)}))},hD=Km({name:"SplitSlidingToolbar",configFields:uD(),partFields:mD(),factory:(e,t,o,n)=>{const s="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.splitToolbarBehaviours,[ek.config({others:{overflowGroup:e=>iD.sketch({...n["overflow-group"](),items:[Lb.sketch({...n["overflow-button"](),action:t=>{Lr(e,s)}})]})}}),Mh("toolbar-toggle-events",[Gr(s,(t=>{gD(t,e,!1)}))])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=z(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),pD(t,e)},refresh:t=>pD(t,e),toggle:t=>{gD(t,e,!1)},toggleWithoutFocusing:t=>{gD(t,e,!0)},isOpen:t=>((e,t)=>Rm(e,t,"overflow").map(HT.hasGrown).getOr(!1))(t,e)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},toggle:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t)}}),fD=e=>{const t=e.title.fold((()=>({})),(e=>({attributes:{title:e}})));return{dom:{tag:"div",classes:["tox-toolbar__group"],...t},components:[iD.parts.items({})],items:e.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:ma([Ub.config({}),Rh.config({})])}},bD=e=>iD.sketch(fD(e)),vD=(e,t)=>{const o=ea((t=>{const o=z(e.initGroups,bD);oM.setGroups(t,o)}));return ma([mw(e.providers.isDisabled),cw(),xh.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Mh("toolbar-events",[o])])},yD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":fD({title:A.none(),items:[]}),"overflow-button":pE({name:"more",icon:A.some("more-drawer"),enabled:!0,tooltip:A.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:A.none(),borderless:!1},A.none(),e.providers,[],"overflow-button")},splitToolbarBehaviours:vD(e,t)}},xD=e=>{const t=yD(e),o=dD.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return dD.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=Qo(t),n=nt(t),s=Qo(n),r=Math.max(n.dom.scrollHeight,s.height);return Jo(o.x+4,s.y,o.width-8,r)},parts:{...t.parts,overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:e.attributes}}},components:[o],markers:{overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>e.onToggled(t,!0),onClosed:t=>e.onToggled(t,!1)})},wD=e=>{const t=hD.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=hD.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=yD(e);return hD.sketch({...n,components:[t,o],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>{t.getSystem().broadcastOn([lM()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([lM()],{type:"closed"}),e.onToggled(t,!1)}})},SD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return oM.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===Sf.scrolling?["tox-toolbar--scrolling"]:[])},components:[oM.parts.groups({})],toolbarBehaviours:vD(e,t)})},kD=[dx,ux,ys("tooltip"),Es("buttonType","secondary",["primary","secondary"]),As("borderless",!1),ms("onAction")],CD={button:[...kD,ex,us("type",["button"])],togglebutton:[...kD,As("active",!1),us("type",["togglebutton"])]},OD=[us("type",["group"]),Ds("buttons",[],os("type",CD))],_D=os("type",{...CD,group:OD}),TD=Nn([Ds("buttons",[],_D),ms("onShow"),ms("onHide")]),ED=(e,t)=>((e,t)=>{var o,n;const s="togglebutton"===e.type,r=e.icon.map((e=>nT(e,t.icons))).map(Vb),a={...e,name:s?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:A.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},i=hE(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),l=s?e.text.map(t.translate):A.some(t.translate(e.text)),c=l.map(ul),d=a.tooltip.or(l).map((e=>({"aria-label":t.translate(e)}))).getOr({}),u=r.map((e=>e.asSpec())),m=vw([u,c]),g=e.icon.isSome()&&c.isSome(),p={tag:"button",classes:i.concat(...e.icon.isSome()&&!g?["tox-button--icon"]:[]).concat(...g?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:d},h=gE(a,A.some((o=>{const n=e=>{r.map((n=>n.getOpt(o).each((o=>{Ah.set(o,[nT(e,t.icons)])}))))};return s?e.onAction({setIcon:n,setActive:e=>{const t=o.element;e?(ka(t,"tox-button--enabled"),Ct(t,"aria-pressed",!0)):(Oa(t,"tox-button--enabled"),At(t,"aria-pressed"))},isActive:()=>_a(o.element,"tox-button--enabled")}):"button"===e.type?e.onAction({setIcon:n}):void 0})),[],p,m,e.tooltip,t);return Lb.sketch(h)})(e,t),AD=Bo().deviceType,MD=AD.isPhone(),DD=AD.isTablet();var BD=Km({name:"silver.View",configFields:[is("viewConfig")],partFields:[km({factory:{sketch:e=>{let t=!1;const o=z(e.buttons,(o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:z(e.buttons,(e=>ED(e,t)))}))(o,e.providers)):ED(o,e.providers)));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...MD||DD?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:ma([Rh.config({}),xh.config({mode:"flow",selector:"button, .tox-button",focusInside:qg.OnEnterOrSpaceMode})]),components:t?o:[Pk.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),Pk.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[is("buttons"),is("providers")],name:"header"}),km({factory:{sketch:e=>({uid:e.uid,behaviours:ma([Rh.config({}),Ub.config({})]),dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const s={getPane:t=>YA.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,behaviours:ma([Rh.config({}),xh.config({mode:"cyclic",focusInside:qg.OnEnterOrSpaceMode})]),apis:s}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const ID=(e,t,o)=>ge(t,((t,n)=>{const s=Qn(Zn("view",TD,t));return e.slot(n,BD.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:s,components:[...s.buttons.length>0?[BD.parts.header({buttons:s.buttons,providers:o})]:[],BD.parts.pane({})]}))})),FD=(e,t)=>AM.sketch((o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:ID(o,e,t),slotBehaviours:sw([ea((e=>AM.hideAllSlots(e)))])}))),RD=e=>j(AM.getSlotNames(e),(t=>AM.isShowing(e,t))),ND=(e,t,o)=>{AM.getSlot(e,t).each((e=>{BD.getPane(e).each((t=>{var n;o(e)((n=t.element.dom,{getContainer:x(n)}))}))}))};var LD=Xm({factory:(e,t)=>{const o={setViews:(e,o)=>{Ah.set(e,[FD(o,t.backstage.shared.providers)])},whichView:e=>eg.getCurrent(e).bind(RD),toggleView:(e,t,o,n)=>eg.getCurrent(e).exists((s=>{const r=RD(s),a=r.exists((e=>n===e)),i=AM.getSlot(s,n).isSome();return i&&(AM.hideAllSlots(s),a?((e=>{const t=e.element;Bt(t,"display","none"),Ct(t,"aria-hidden","true")})(e),t()):(o(),(e=>{const t=e.element;Ht(t,"display"),At(t,"aria-hidden")})(e),AM.showSlot(s,n),((e,t)=>{ND(e,t,BD.getOnShow)})(s,n)),r.each((e=>((e,t)=>ND(e,t,BD.getOnHide))(s,e)))),i}))};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:ma([Ah.config({}),eg.config({find:e=>{const t=Ah.contents(e);return te(t)}})]),apis:o}},name:"silver.ViewWrapper",configFields:[is("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,s)=>e.toggleView(t,o,n,s),whichView:(e,t)=>e.whichView(t)}});const zD=XA.optional({factory:kM,name:"menubar",schema:[is("backstage")]}),VD=XA.optional({factory:{sketch:e=>QA.sketch({uid:e.uid,dom:e.dom,listBehaviours:ma([xh.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>SD({type:e.type,uid:Bi("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),A.some(!0))}),setupItem:(e,t,o,n)=>{oM.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[is("dom"),is("onEscape")]}),HD=XA.optional({factory:{sketch:e=>{const t=(e=>e.type===Sf.sliding?wD:e.type===Sf.floating?xD:SD)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),A.some(!0)),onToggled:(t,o)=>e.onToolbarToggled(o),cyclicKeying:!1,initGroups:[],getSink:e.getSink,providers:e.providers,moreDrawerData:{lazyToolbar:e.lazyToolbar,lazyMoreButton:e.lazyMoreButton,lazyHeader:e.lazyHeader},attributes:e.attributes})}},name:"toolbar",schema:[is("dom"),is("onEscape"),is("getSink")]}),PD=XA.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?fM:rM;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:ma(o(t,e.sharedBackstage))}}},name:"header",schema:[is("dom")]}),UD=XA.optional({factory:{sketch:e=>({uid:e.uid,dom:e.dom,components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/tinymce-self-hosted-premium-features/?utm_campaign=self_hosted_upgrade_promo&utm_source=tiny&utm_medium=referral",rel:"noopener",target:"_blank","aria-hidden":"true"},classes:["tox-promotion-link"],innerHtml:"\u26a1\ufe0fUpgrade"}}]})},name:"promotion",schema:[is("dom")]}),WD=XA.optional({name:"socket",schema:[is("dom")]}),jD=XA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"presentation"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:ma([Ub.config({}),Rh.config({}),HT.config({dimension:{property:"width"},closedClass:"tox-sidebar--sliding-closed",openClass:"tox-sidebar--sliding-open",shrinkingClass:"tox-sidebar--sliding-shrinking",growingClass:"tox-sidebar--sliding-growing",onShrunk:e=>{eg.getCurrent(e).each(AM.hideAllSlots),Lr(e,LM)},onGrown:e=>{Lr(e,LM)},onStartGrow:e=>{zr(e,NM,{width:Lt(e.element,"width").getOr("")})},onStartShrink:e=>{zr(e,NM,{width:Zt(e.element)+"px"})}}),Ah.config({}),eg.config({find:e=>{const t=Ah.contents(e);return te(t)}})])}],behaviours:ma([v_(0),Mh("sidebar-sliding-events",[Gr(NM,((e,t)=>{Bt(e.element,"width",t.event.width)})),Gr(LM,((e,t)=>{Ht(e.element,"width")}))])])})},name:"sidebar",schema:[is("dom")]}),$D=XA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:ma([Ah.config({}),HM.config({focus:!1}),eg.config({find:e=>te(e.components())})]),components:[]})},name:"throbber",schema:[is("dom")]}),GD=XA.optional({factory:LD,name:"viewWrapper",schema:[is("backstage")]}),qD=XA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var YD=Km({name:"OuterContainer",factory:(e,t,o)=>{let n=!1;const s=e=>{Cl(e,".tox-statusbar").each((e=>{"none"===Rt(e,"display")&&"true"===_t(e,"aria-hidden")?(Ht(e,"display"),At(e,"aria-hidden")):(Bt(e,"display","none"),Ct(e,"aria-hidden","true"))}))},a={getSocket:t=>YA.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{YA.getPart(t,e,"sidebar").each((e=>((e,t,o)=>{eg.getCurrent(e).each((n=>{Ah.set(n,[IM(t)]);const s=null==o?void 0:o.toLowerCase();r(s)&&be(t,s)&&eg.getCurrent(n).each((t=>{AM.showSlot(t,s),HT.immediateGrow(n),Ht(n.element,"width"),FM(e.element,"region")}))}))})(e,o,n)))},toggleSidebar:(t,o)=>{YA.getPart(t,e,"sidebar").each((e=>((e,t)=>{eg.getCurrent(e).each((o=>{eg.getCurrent(o).each((n=>{HT.hasGrown(o)?AM.isShowing(n,t)?(HT.shrink(o),FM(e.element,"presentation")):(AM.hideAllSlots(n),AM.showSlot(n,t),FM(e.element,"region")):(AM.hideAllSlots(n),AM.showSlot(n,t),HT.grow(o),FM(e.element,"region"))}))}))})(e,o)))},whichSidebar:t=>YA.getPart(t,e,"sidebar").bind(RM).getOrNull(),getHeader:t=>YA.getPart(t,e,"header"),getToolbar:t=>YA.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{YA.getPart(t,e,"toolbar").each((e=>{const t=z(o,bD);e.getApis().setGroups(e,t)}))},setToolbars:(t,o)=>{YA.getPart(t,e,"multiple-toolbar").each((e=>{const t=z(o,(e=>z(e,bD)));QA.setItems(e,t)}))},refreshToolbar:t=>{YA.getPart(t,e,"toolbar").each((e=>e.getApis().refresh(e)))},toggleToolbarDrawer:t=>{YA.getPart(t,e,"toolbar").each((e=>{Se(e.getApis().toggle,(t=>t(e)))}))},toggleToolbarDrawerWithoutFocusing:t=>{YA.getPart(t,e,"toolbar").each((e=>{Se(e.getApis().toggleWithoutFocusing,(t=>t(e)))}))},isToolbarDrawerToggled:t=>YA.getPart(t,e,"toolbar").bind((e=>A.from(e.getApis().isOpen).map((t=>t(e))))).getOr(!1),getThrobber:t=>YA.getPart(t,e,"throbber"),focusToolbar:t=>{YA.getPart(t,e,"toolbar").orThunk((()=>YA.getPart(t,e,"multiple-toolbar"))).each((e=>{xh.focusIn(e)}))},setMenubar:(t,o)=>{YA.getPart(t,e,"menubar").each((e=>{kM.setMenus(e,o)}))},focusMenubar:t=>{YA.getPart(t,e,"menubar").each((e=>{kM.focus(e)}))},setViews:(t,o)=>{YA.getPart(t,e,"viewWrapper").each((e=>{LD.setViews(e,o)}))},toggleView:(t,o)=>YA.getPart(t,e,"viewWrapper").exists((e=>LD.toggleView(e,(()=>a.showMainView(t)),(()=>a.hideMainView(t)),o))),whichView:t=>YA.getPart(t,e,"viewWrapper").bind(LD.whichView).getOrNull(),hideMainView:t=>{n=a.isToolbarDrawerToggled(t),n&&a.toggleToolbarDrawer(t),YA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;s(t),Bt(t,"display","none"),Ct(t,"aria-hidden","true")}))},showMainView:t=>{n&&a.toggleToolbarDrawer(t),YA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;s(t),Ht(t,"display"),At(t,"aria-hidden")}))}};return{uid:e.uid,dom:e.dom,components:t,apis:a,behaviours:e.behaviours}},configFields:[is("dom"),is("behaviours")],partFields:[PD,zD,HD,VD,WD,jD,UD,$D,GD,qD],apis:{getSocket:(e,t)=>e.getSocket(t),setSidebar:(e,t,o,n)=>{e.setSidebar(t,o,n)},toggleSidebar:(e,t,o)=>{e.toggleSidebar(t,o)},whichSidebar:(e,t)=>e.whichSidebar(t),getHeader:(e,t)=>e.getHeader(t),getToolbar:(e,t)=>e.getToolbar(t),setToolbar:(e,t,o)=>{e.setToolbar(t,o)},setToolbars:(e,t,o)=>{e.setToolbars(t,o)},refreshToolbar:(e,t)=>e.refreshToolbar(t),toggleToolbarDrawer:(e,t)=>{e.toggleToolbarDrawer(t)},toggleToolbarDrawerWithoutFocusing:(e,t)=>{e.toggleToolbarDrawerWithoutFocusing(t)},isToolbarDrawerToggled:(e,t)=>e.isToolbarDrawerToggled(t),getThrobber:(e,t)=>e.getThrobber(t),setMenubar:(e,t,o)=>{e.setMenubar(t,o)},focusMenubar:(e,t)=>{e.focusMenubar(t)},focusToolbar:(e,t)=>{e.focusToolbar(t)},setViews:(e,t,o)=>{e.setViews(t,o)},toggleView:(e,t,o)=>e.toggleView(t,o),whichView:(e,t)=>e.whichView(t)}});const XD={file:{title:"File",items:"newdocument restoredraft | preview | importword exportpdf exportword | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed inserttemplate codesample inserttable accordion math | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat"},tools:{title:"Tools",items:"aidialog aishortcuts | spellchecker spellcheckerlanguage | autocorrect capitalization | a11ycheck code typography wordcount addtemplate"},table:{title:"Table",items:"inserttable | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},KD=e=>e.split(" "),JD=(e,t)=>{const o={...XD,...t.menus},n=re(t.menus).length>0,s=void 0===t.menubar||!0===t.menubar?KD("file edit view insert format tools table help"):KD(!1===t.menubar?"":t.menubar),a=P(s,(e=>{const o=be(XD,e);return n?o||fe(t.menus,e).exists((e=>be(e,"items"))):o})),i=z(a,(n=>{const s=o[n];return((e,t,o)=>{const n=Uf(o).split(/[ ,]/);return{text:e.title,getItems:()=>q(e.items,(e=>{const o=e.toLowerCase();return 0===o.trim().length||R(n,(e=>e===o))?[]:"separator"===o||"|"===o?[{type:"separator"}]:t.menuItems[o]?[t.menuItems[o]]:[]}))}})({title:s.title,items:KD(s.items)},t,e)}));return P(i,(e=>e.getItems().length>0&&R(e.getItems(),(e=>r(e)||"separator"!==e.type))))},ZD=(e,t,o)=>(e.on("remove",(()=>o.unload(t))),o.load(t)),QD=(e,t,o,n)=>(e.on("remove",(()=>n.unloadRawCss(t))),n.loadRawCss(t,o)),eB=async(e,t)=>{const o="ui/"+vb(e).getOr("default")+"/skin.css",n=tinymce.Resource.get(o);if(!r(n)){const o=e.editorManager.suffix;return ZD(e,t+`/skin${o}.css`,e.ui.styleSheetLoader)}QD(e,o,n,e.ui.styleSheetLoader)},tB=async(e,t)=>{var o;if(o=Le(e.getElement()),vt(o).isSome()){const o="ui/"+vb(e).getOr("default")+"/skin.shadowdom.css",n=tinymce.Resource.get(o);if(!r(n)){const o=e.editorManager.suffix;return ZD(e,t+`/skin.shadowdom${o}.css`,Of.DOM.styleSheetLoader)}QD(e,o,n,Of.DOM.styleSheetLoader)}},oB=(e,t)=>(async(e,t)=>{const o=()=>{const o=bb(t),n=t.editorManager.suffix;o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+`${n}.css`)};vb(t).fold(o,(n=>{const s="ui/"+n+(e?"/content.inline":"/content")+".css",a=tinymce.Resource.get(s);r(a)?QD(t,s,a,t.ui.styleSheetLoader):o()}));const n=bb(t);if(!hb(t)&&r(n))return Promise.all([eB(t,n),tB(t,n)]).then()})(e,t).then((e=>{const t=()=>{e._skinLoaded=!0,(e=>{e.dispatch("SkinLoaded")})(e)};return()=>{e.initialized?t():e.on("init",t)}})(t),((e,t)=>()=>((e,t)=>{e.dispatch("SkinLoadError",t)})(e,{message:"Skin could not be loaded"}))(t)),nB=k(oB,!1),sB=k(oB,!0),rB=(e,t,o)=>De(o)?e.translate(t):e.translate([t,e.translate(o)]),aB=(e,t)=>{const o=(o,s,r,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return A.some({type:"separator",text:i});if("submenu"===o.type){const e=q(o.getStyleItems(),(e=>n(e,s,a)));return 0===s&&e.length<=0?A.none():A.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>q(o.getStyleItems(),(e=>n(e,s,a)))})}return A.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!r,onAction:t.onAction(o),...o.getStylePreview().fold((()=>({})),(e=>({meta:{style:e}})))})},n=(e,n,s)=>{const r="formatter"===e.type&&t.isInvalid(e);return 0===n?r?[]:o(e,n,!1,s).toArray():o(e,n,r,s).toArray()},s=e=>{const o=t.getCurrentValue(),s=t.shouldHide?0:1;return q(e,(e=>n(e,s,o)))};return{validateItems:s,getFetch:(e,t)=>(o,n)=>{const r=t(),a=s(r);n(uT(a,dy.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:A.none()}))}}},iB=(e,t)=>{const o=t.dataset,n="basic"===o.type?()=>z(o.data,(e=>xA(e,t.isSelectedFor,t.getPreviewFor))):o.getData;return{items:aB(e,t),getStyleItems:n}},lB=(e,t,o,n,s,r)=>{const{items:a,getStyleItems:i}=iB(t,o),l=on(o.tooltip);return iT({text:o.icon.isSome()?A.none():o.text,icon:o.icon,ariaLabel:A.some(o.tooltip),tooltip:A.none(),role:A.none(),fetch:a.getFetch(t,i),onSetup:t=>{const r=o=>t.setTooltip(rB(e,n(o.value),o.value));return e.on(s,r),nS(aS(e,"NodeChange",(t=>{const n=t.getComponent();o.updateText(n),pg.set(t.getComponent(),!e.selection.isEditable())}))(t),(()=>e.off(s,r)))},getApi:e=>({getComponent:x(e),setTooltip:o=>{const n=t.shared.providers.translate(o);Ct(e.element,"aria-label",n),l.set(o)}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[Qb.config({...t.shared.providers.tooltips.getConfig({tooltipText:t.shared.providers.translate(o.tooltip),onShow:e=>{if(o.tooltip!==l.get()){const o=t.shared.providers.translate(l.get());Qb.setComponents(e,t.shared.providers.tooltips.getComponents({tooltipText:o}))}}})})]},"tox-tbtn",t.shared,r)};var cB;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(cB||(cB={}));const dB=(e,t,o)=>{const n=(s=((e,t)=>t===cB.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o),z(s,(e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}})));var s;return{type:"basic",data:n}},uB=x("Alignment {0}"),mB="left",gB=[{title:"Left",icon:"align-left",format:"alignleft",command:"JustifyLeft"},{title:"Center",icon:"align-center",format:"aligncenter",command:"JustifyCenter"},{title:"Right",icon:"align-right",format:"alignright",command:"JustifyRight"},{title:"Justify",icon:"align-justify",format:"alignjustify",command:"JustifyFull"}],pB=e=>{const t={type:"basic",data:gB};return{tooltip:rB(e,uB(),mB),text:A.none(),icon:A.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:e=>A.none,onAction:t=>()=>j(gB,(e=>e.format===t.format)).each((t=>e.execCommand(t.command))),updateText:t=>{const o=j(gB,(t=>e.formatter.match(t.format))).fold(x(mB),(e=>e.title.toLowerCase()));zr(t,aT,{icon:`align-${o}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:o})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},hB=(e,t)=>{const o=t(),n=z(o,(e=>e.format));return A.from(e.formatter.closest(n)).bind((e=>j(o,(t=>t.format===e))))},fB=x("Block {0}"),bB="Paragraph",vB=e=>{const t=dB(e,"block_formats",cB.SemiColon);return{tooltip:rB(e,fB(),bB),text:A.some(bB),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:iS(e),updateText:o=>{const n=hB(e,(()=>t.data)).fold(x(bB),(e=>e.title));zr(o,rT,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},yB=x("Font {0}"),xB="System Font",wB=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],SB=e=>{const t=e.split(/\s*,\s*/);return z(t,(e=>e.replace(/^['"]+|['"]+$/g,"")))},kB=(e,t)=>t.length>0&&Y(t,(t=>e.indexOf(t.toLowerCase())>-1)),CB=e=>{const t=()=>{const t=e=>e?SB(e)[0]:"",n=e.queryCommandValue("FontName"),s=o.data,r=n?n.toLowerCase():"",a=pb(e),i=j(s,(e=>{const o=e.format;return o.toLowerCase()===r||t(o).toLowerCase()===t(r).toLowerCase()})).orThunk((()=>ke(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=SB(e.toLowerCase());return kB(o,wB)||kB(o,t)}return!1})(r,a),{title:xB,format:r})));return{matchOpt:i,font:n}},o=dB(e,"font_family_formats",cB.SemiColon);return{tooltip:rB(e,yB(),xB),text:A.some(xB),icon:A.none(),isSelectedFor:e=>t=>t.exists((t=>t.format===e)),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>A.some({tag:"div",styles:-1===e.indexOf("dings")?{"font-family":e}:{}}),onAction:t=>()=>{e.undoManager.transact((()=>{e.focus(),e.execCommand("FontName",!1,t.format)}))},updateText:o=>{const{matchOpt:n,font:s}=t(),r=n.fold(x(s),(e=>e.title));zr(o,rT,{text:r}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:r})},dataset:o,shouldHide:!1,isInvalid:T}},OB={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:[""]},_B=(()=>{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}))(.*)$`)})(),TB=(e,t)=>A.from(_B.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>R(t,(t=>R(OB[t],(t=>e===t)))))(n,t)?A.some({value:o,unit:n}):A.none()})),EB={tab:x(9),escape:x(27),enter:x(13),backspace:x(8),delete:x(46),left:x(37),up:x(38),right:x(39),down:x(40),space:x(32),home:x(36),end:x(35),pageUp:x(33),pageDown:x(34)},AB=x("Font size {0}"),MB="12pt",DB={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},BB={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},IB=(e,t)=>/[0-9.]+px$/.test(e)?((e,t)=>{const o=Math.pow(10,t);return Math.round(e*o)/o})(72*parseInt(e,10)/96,t||0)+"pt":fe(BB,e).getOr(e),FB=e=>fe(DB,e).getOr(""),RB=e=>{const t=()=>{let t=A.none();const o=n.data,s=e.queryCommandValue("FontSize");if(s)for(let e=3;t.isNone()&&e>=0;e--){const n=IB(s,e),r=FB(n);t=j(o,(e=>e.format===s||e.format===n||e.format===r))}return{matchOpt:t,size:s}},o=x(A.none),n=dB(e,"font_size_formats",cB.Space);return{tooltip:rB(e,AB(),MB),text:A.some(MB),icon:A.none(),isSelectedFor:e=>t=>t.exists((t=>t.format===e)),getPreviewFor:o,getCurrentValue:()=>{const{matchOpt:e}=t();return e},onAction:t=>()=>{e.undoManager.transact((()=>{e.focus(),e.execCommand("FontSize",!1,t.format)}))},updateText:o=>{const{matchOpt:n,size:s}=t(),r=n.fold(x(s),(e=>e.title));zr(o,rT,{text:r}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:r})},dataset:n,shouldHide:!1,isInvalid:T}},NB=e=>De(e)?"Formats":"Format {0}",LB=(e,t)=>{const o="Formats";return{tooltip:rB(e,NB(""),""),text:A.some(o),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:iS(e),updateText:t=>{const n=e=>hA(e)?q(e.items,n):fA(e)?[{title:e.title,format:e.format}]:[],s=q(yA(e),n),r=hB(e,x(s)).fold(x({title:o,tooltipLabel:""}),(e=>({title:e.title,tooltipLabel:e.title})));zr(t,rT,{text:r.title}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:r.tooltipLabel})},shouldHide:Hf(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},zB=x([is("toggleClass"),is("fetch"),Si("onExecute"),Cs("getHotspot",A.some),Cs("getAnchorOverrides",x({})),ed(),Si("onItemExecute"),fs("lazySink"),is("dom"),xi("onOpen"),Yu("splitDropdownBehaviours",[ek,xh,Rh]),Cs("matchWidth",!1),Cs("useMinWidth",!1),Cs("eventOrder",{}),fs("role")].concat(bk())),VB=wm({factory:Lb,schema:[is("dom")],name:"arrow",defaults:()=>({buttonBehaviours:ma([Rh.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(Vr)},buttonBehaviours:ma([Wh.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),HB=wm({factory:Lb,schema:[is("dom")],name:"button",defaults:()=>({buttonBehaviours:ma([Rh.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each((o=>{e.onExecute(o,t)}))}})}),PB=x([VB,HB,km({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[is("text")],name:"aria-descriptor"}),Sm({schema:[bi()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each((n=>{e.onItemExecute(n,t,o)}))}})}),lk()]),UB=Km({name:"SplitDropdown",configFields:zB(),partFields:PB(),factory:(e,t,o,n)=>{const s=e=>{eg.getCurrent(e).each((e=>{Cg.highlightFirst(e),xh.focusIn(e)}))},r=t=>{mk(e,w,t,n,s,vf.HighlightMenuAndItem).get(b)},a=t=>{const o=Nm(t,e,"button");return Vr(o),A.some(!0)},i={...Wr([ea(((t,o)=>{Rm(t,e,"aria-descriptor").each((e=>{const o=Bi("aria");Ct(e.element,"id",o),Ct(t.element,"aria-describedby",o)}))}))]),...$h(A.some(r))},l={repositionMenus:e=>{Wh.isOn(e)&&fk(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:l,eventOrder:{...e.eventOrder,[hr()]:["disabling","toggling","alloy.base.behaviour"]},events:i,behaviours:Ku(e.splitDropdownBehaviours,[ek.config({others:{sandbox:t=>{const o=Nm(t,e,"arrow");return hk(e,t,{onOpen:()=>{Wh.on(o),Wh.on(t)},onClose:()=>{Wh.off(o),Wh.off(t)}})}}}),xh.config({mode:"special",onSpace:a,onEnter:a,onDown:e=>(r(e),A.some(!0))}),Rh.config({}),Wh.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),WB=e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t),setText:t=>zr(e,rT,{text:t}),setIcon:t=>zr(e,aT,{icon:t})}),jB=e=>({setActive:t=>{Wh.set(e,t)},isActive:()=>Wh.isOn(e),isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t),setText:t=>zr(e,rT,{text:t}),setIcon:t=>zr(e,aT,{icon:t})}),$B=(e,t)=>e.map((e=>({"aria-label":t.translate(e)}))).getOr({}),GB=Bi("focus-button"),qB=(e,t,o,n,s,r)=>{const a=t.map((e=>Vb(sT(e,"tox-tbtn",s)))),i=e.map((e=>Vb(nT(e,s.icons))));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:{...$B(o,s),...g(r)?{"data-mce-name":r}:{}}},components:vw([i.map((e=>e.asSpec())),a.map((e=>e.asSpec()))]),eventOrder:{[qs()]:["focusing","alloy.base.behaviour",Z_],[_r()]:[Z_,"toolbar-group-button-events"]},buttonBehaviours:ma([mw(s.isDisabled),cw(),Mh(Z_,[ea(((e,t)=>eT(e))),Gr(rT,((e,t)=>{a.bind((t=>t.getOpt(e))).each((e=>{Ah.set(e,[ul(s.translate(t.event.text))])}))})),Gr(aT,((e,t)=>{i.bind((t=>t.getOpt(e))).each((e=>{Ah.set(e,[nT(t.event.icon,s.icons)])}))})),Gr(qs(),((e,t)=>{t.event.prevent(),Lr(e,GB)}))])].concat(n.getOr([])))}},YB=(e,t,o,n)=>{var s;const r=on(b),a=qB(e.icon,e.text,e.tooltip,A.none(),o,n);return Lb.sketch({dom:a.dom,components:a.components,eventOrder:Q_,buttonBehaviours:{...ma([Mh("toolbar-button-events",[(i={onAction:e.onAction,getApi:t.getApi},na(((e,t)=>{gw(i,e)((t=>{zr(e,J_,{buttonApi:t}),i.onAction(t)}))}))),pw(t,r),hw(t,r)]),...e.tooltip.map((t=>Qb.config(o.tooltips.getConfig({tooltipText:o.translate(t)+e.shortcut.map((e=>` (${ww(e)})`)).getOr("")})))).toArray(),mw((()=>!e.enabled||o.isDisabled())),cw()].concat(t.toolbarButtonBehaviours)),[Z_]:null===(s=a.buttonBehaviours)||void 0===s?void 0:s[Z_]}});var i},XB=(e,t,o,n)=>YB(e,{toolbarButtonBehaviours:o.length>0?[Mh("toolbarButtonWith",o)]:[],getApi:WB,onSetup:e.onSetup},t,n),KB=(e,t,o,n)=>YB(e,{toolbarButtonBehaviours:[Ah.config({}),Wh.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[Mh("toolbarToggleButtonWith",o)]:[]),getApi:jB,onSetup:e.onSetup},t,n),JB=(e,t,o)=>n=>rk((e=>t.fetch(e))).map((s=>A.from(Ek(wn(PS(Bi("menu-value"),s,(o=>{t.onItemAction(e(n),o)}),t.columns,t.presets,dy.CLOSE_ON_EXECUTE,t.select.getOr(T),o),{movement:WS(t.columns,t.presets),menuBehaviours:sw("auto"!==t.columns?[]:[ea(((e,o)=>{nw(e,4,Sy(t.presets)).each((({numRows:t,numColumns:o})=>{xh.setGridSize(e,t,o)}))}))])}))))),ZB=[{name:"history",items:["undo","redo"]},{name:"ai",items:["aidialog","aishortcuts"]},{name:"styles",items:["styles"]},{name:"formatting",items:["bold","italic"]},{name:"alignment",items:["alignleft","aligncenter","alignright","alignjustify"]},{name:"indentation",items:["outdent","indent"]},{name:"permanent pen",items:["permanentpen"]},{name:"comments",items:["addcomment"]}],QB=(e,t)=>(o,n,s,r)=>{const a=e(o).mapError((e=>ts(e))).getOrDie();return t(a,n,s,r)},eI={button:QB(Ax,((e,t,o,n)=>((e,t,o)=>XB(e,t,[],o))(e,t.shared.providers,n))),togglebutton:QB(Bx,((e,t,o,n)=>((e,t,o)=>KB(e,t,[],o))(e,t.shared.providers,n))),menubutton:QB(wM,((e,t,o,n)=>UT(e,"tox-tbtn",t,A.none(),!1,n))),splitbutton:QB((e=>Zn("SplitButton",SM,e)),((e,t,o,n)=>((e,t,o)=>{const n=on(e.tooltip.getOr("")),s=e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t),setIconFill:(t,o)=>{_l(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{Ct(e,"fill",o)}))},setActive:t=>{Ct(e.element,"aria-pressed",t),_l(e.element,"span").each((o=>{e.getSystem().getByDom(o).each((e=>Wh.set(e,t)))}))},isActive:()=>_l(e.element,"span").exists((t=>e.getSystem().getByDom(t).exists(Wh.isOn))),setText:t=>_l(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>zr(e,rT,{text:t}))))),setIcon:t=>_l(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>zr(e,aT,{icon:t}))))),setTooltip:o=>{const s=t.providers.translate(o);Ct(e.element,"aria-label",s),n.set(o)}}),r=on(b),a={getApi:s,onSetup:e.onSetup};return UB.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...$B(e.tooltip,t.providers),...g(o)?{"data-mce-name":o}:{}}},onExecute:t=>{const o=s(t);o.isEnabled()&&e.onAction(o)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:ma([uw(t.providers.isDisabled),cw(),Mh("split-dropdown-events",[ea(((e,t)=>eT(e))),Gr(GB,Rh.focus),pw(a,r),hw(a,r)]),bC.config({}),...e.tooltip.map((e=>Qb.config({...t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e),onShow:o=>{if(n.get()!==e){const e=t.providers.translate(n.get());Qb.setComponents(o,t.providers.tooltips.getComponents({tooltipText:e}))}}})}))).toArray()]),eventOrder:{[_r()]:["alloy.base.behaviour","split-dropdown-events","tooltipping"],[Tr()]:["split-dropdown-events","tooltipping"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:JB(s,e,t.providers),parts:{menu:Ey(0,e.columns,e.presets)},components:[UB.parts.button(qB(e.icon,e.text,A.none(),A.some([Wh.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),UB.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:oy("chevron-down",t.providers.icons)},buttonBehaviours:ma([uw(t.providers.isDisabled),cw(),ny()])}),UB.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})})(e,t.shared,n))),grouptoolbarbutton:QB((e=>Zn("GroupToolbarButton",vM,e)),((e,t,o,n)=>{const s=o.ui.registry.getAll().buttons,r={[Zc]:t.shared.header.isPositionedAtTop()?Jc.TopToBottom:Jc.BottomToTop};if(Wf(o)===Sf.floating)return((e,t,o,n,s)=>{const r=t.shared,a=on(b),i={toolbarButtonBehaviours:[],getApi:WB,onSetup:e.onSetup},l=[Mh("toolbar-group-button-events",[pw(i,a),hw(i,a)])];return sD.sketch({lazySink:r.getSink,fetch:()=>rk((t=>{t(z(o(e.items),bD))})),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:qB(e.icon,e.text,e.tooltip,A.some(l),r.providers,s),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,(e=>oI(o,{buttons:s,toolbar:e,allowToolbarGroups:!1},t,A.none())),r,n);throw new Error("Toolbar groups are only supported when using floating toolbar mode")}))},tI={styles:(e,t)=>{const o={type:"advanced",...t.styles};return lB(e,t,LB(e,o),NB,"StylesTextUpdate","styles")},fontsize:(e,t)=>lB(e,t,RB(e),AB,"FontSizeTextUpdate","fontsize"),fontsizeinput:(e,t)=>((e,t,o,n)=>{let s=A.none();const r=aS(e,"NodeChange SwitchMode",(t=>{const n=t.getComponent();s=A.some(n),o.updateInputValue(n),pg.set(n,!e.selection.isEditable())})),a=e=>({getComponent:x(e)}),i=on(b),l=Bi("custom-number-input-events"),c=(e,t,n)=>{const r=s.map((e=>qu.getValue(e))).getOr(""),a=o.getNewValue(r,e),i=r.length-`${a}`.length,l=s.map((e=>e.element.dom.selectionStart-i)),c=s.map((e=>e.element.dom.selectionEnd-i));o.onAction(a,n),s.each((e=>{qu.setValue(e,a),t&&(l.each((t=>e.element.dom.selectionStart=t)),c.each((t=>e.element.dom.selectionEnd=t)))}))},d=(e,t)=>c(((e,t)=>e-t),e,t),u=(e,t)=>c(((e,t)=>e+t),e,t),m=e=>at(e.element).fold(A.none,(e=>(hc(e),A.some(!0)))),p=e=>bc(e.element)?(dt(e.element).each((e=>hc(e))),A.some(!0)):A.none(),h=(o,n,s,r)=>{const i=on(b),l=t.shared.providers.translate(s),c=Bi("altExecuting"),d=aS(e,"NodeChange SwitchMode",(t=>{pg.set(t.getComponent(),!e.selection.isEditable())})),u=e=>{pg.isDisabled(e)||o(!0)};return Lb.sketch({dom:{tag:"button",attributes:{"aria-label":l,"data-mce-name":n},classes:r.concat(n)},components:[oT(n,t.shared.providers.icons)],buttonBehaviours:ma([pg.config({}),Qb.config(t.shared.providers.tooltips.getConfig({tooltipText:l})),Mh(c,[pw({onSetup:d,getApi:a},i),hw({getApi:a},i),Gr(er(),((e,t)=>{t.event.raw.keyCode!==EB.space()&&t.event.raw.keyCode!==EB.enter()||pg.isDisabled(e)||o(!1)})),Gr(sr(),u),Gr($s(),u)])]),eventOrder:{[er()]:[c,"keying"],[sr()]:[c,"alloy.base.behaviour"],[$s()]:[c,"alloy.base.behaviour"],[_r()]:["alloy.base.behaviour",c,"tooltipping"],[Tr()]:[c,"tooltipping"]}})},f=Vb(h((e=>d(!1,e)),"minus","Decrease font size",[])),v=Vb(h((e=>u(!1,e)),"plus","Increase font size",[])),y=Vb({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[Iy.sketch({inputBehaviours:ma([pg.config({}),Mh(l,[pw({onSetup:r,getApi:a},i),hw({getApi:a},i)]),Mh("input-update-display-text",[Gr(rT,((e,t)=>{qu.setValue(e,t.event.text)})),Gr(Qs(),(e=>{o.onAction(qu.getValue(e))})),Gr(nr(),(e=>{o.onAction(qu.getValue(e))}))]),xh.config({mode:"special",onEnter:e=>(c(w,!0,!0),A.some(!0)),onEscape:m,onUp:e=>(u(!0,!1),A.some(!0)),onDown:e=>(d(!0,!1),A.some(!0)),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})],behaviours:ma([Rh.config({}),xh.config({mode:"special",onEnter:p,onSpace:p,onEscape:m}),Mh("input-wrapper-events",[Gr(Js(),(e=>{V([f,v],(t=>{const o=Le(t.get(e).element.dom);bc(o)&&fc(o)}))}))])])});return{dom:{tag:"div",classes:["tox-number-input"],attributes:{...g(n)?{"data-mce-name":n}:{}}},components:[f.asSpec(),y.asSpec(),v.asSpec()],behaviours:ma([Rh.config({}),xh.config({mode:"flow",focusInside:qg.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>bc(e.element)?A.none():(hc(e.element),A.some(!0))})])}})(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>zr(e,rT,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{TB(o,["unsupportedLength","empty"]);const s=t(),r=TB(o,["unsupportedLength","empty"]).or(TB(s,["unsupportedLength","empty"])),a=r.map((e=>e.value)).getOr(16),i=eb(e),l=r.map((e=>e.unit)).filter((e=>""!==e)).getOr(i),c=n(a,(e=>{var t;return null!==(t={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[e])&&void 0!==t?t:{step:1}})(l).step),d=`${(e=>e>=0)(c)?c:a}${l}`;return d!==s&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e),"fontsizeinput"),fontfamily:(e,t)=>lB(e,t,CB(e),yB,"FontFamilyTextUpdate","fontfamily"),blocks:(e,t)=>lB(e,t,vB(e),fB,"BlocksTextUpdate","blocks"),align:(e,t)=>lB(e,t,pB(e),uB,"AlignTextUpdate","align")},oI=(e,t,o,n)=>{const s=(e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=z(ZB,(t=>{const o=P(t.items,(t=>be(e,t)||be(tI,t)));return{name:t.name,items:o}}));return P(t,(e=>e.items.length>0))})(o):r(t)?(e=>{const t=e.split("|");return z(t,(e=>({items:e.trim().split(" ")})))})(t):(e=>f(e,(e=>be(e,"name")&&be(e,"items"))))(t)?t:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])})(t),a=z(s,(s=>{const r=q(s.items,(s=>0===s.trim().length?[]:((e,t,o,n,s,r)=>fe(t,o.toLowerCase()).orThunk((()=>r.bind((e=>se(e,(e=>fe(t,e+o.toLowerCase()))))))).fold((()=>fe(tI,o.toLowerCase()).map((t=>t(e,s)))),(t=>"grouptoolbarbutton"!==t.type||n?((e,t,o,n)=>fe(eI,e.type).fold((()=>(console.error("skipping button defined by",e),A.none())),(s=>A.some(s(e,t,o,n)))))(t,s,e,o.toLowerCase()):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),A.none()))))(e,t.buttons,s,t.allowToolbarGroups,o,n).toArray()));return{title:A.from(e.translate(s.name)),items:r}}));return P(a,(e=>e.items.length>0))},nI=(e,t,o,n)=>{const s=t.mainUi.outerContainer,a=o.toolbar,i=o.buttons;if(f(a,r)){const t=a.map((t=>{const s={toolbar:t,buttons:i,allowToolbarGroups:o.allowToolbarGroups};return oI(e,s,n,A.none())}));YD.setToolbars(s,t)}else YD.setToolbar(s,oI(e,o,n,A.none()))},sI=Bo(),rI=sI.os.isiOS()&&sI.os.version.major<=12;var aI=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=t,i=on(0),l=r.outerContainer;nB(e);const d=Le(s.targetNode),u=bt(ft(d));pu(d,r.mothership),((e,t,o)=>{Ab(e)&&pu(o.mainUi.mothership.element,o.popupUi.mothership),gu(t,o.dialogUi.mothership)})(e,u,t),e.on("SkinLoaded",(()=>{YD.setSidebar(l,o.sidebar,ub(e)),nI(e,t,o,n),i.set(e.getWin().innerWidth),YD.setMenubar(l,JD(e,o)),YD.setViews(l,o.views),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let s=e.getWin();const r=e.getDoc().documentElement,a=on(qt(s.innerWidth,s.innerHeight)),i=on(qt(r.offsetWidth,r.offsetHeight)),l=()=>{const t=a.get();t.left===s.innerWidth&&t.top===s.innerHeight||(a.set(qt(s.innerWidth,s.innerHeight)),eS(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set(qt(t.offsetWidth,t.offsetHeight)),eS(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(s,"resize",l),n.bind(s,"scroll",d);const u=Rc(Le(e.getBody()),"load",c);e.on("hide",(()=>{V(o,(e=>{Bt(e.element,"display","none")}))})),e.on("show",(()=>{V(o,(e=>{Ht(e.element,"display")}))})),e.on("NodeChange",c),e.on("remove",(()=>{u.unbind(),n.unbind(s,"resize",l),n.unbind(s,"scroll",d),s=null}))})(e,t)}));const m=YD.getSocket(l).getOrDie("Could not find expected socket element");if(rI){It(m.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=((e,t)=>{let o=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null)},throttle:(...t)=>{c(o)&&(o=setTimeout((()=>{o=null,e.apply(null,t)}),20))}}})((()=>{e.dispatch("ScrollContent")})),o=Fc(m.element,"scroll",t.throttle);e.on("remove",o.unbind)}lw(e,t),e.addCommand("ToggleSidebar",((t,o)=>{YD.toggleSidebar(l,o),e.dispatch("ToggleSidebar")})),e.addQueryValueHandler("ToggleSidebar",(()=>{var e;return null!==(e=YD.whichSidebar(l))&&void 0!==e?e:""})),e.addCommand("ToggleView",((t,o)=>{if(YD.toggleView(l,o)){const t=l.element;r.mothership.broadcastOn([Eu()],{target:t}),V(a,(e=>{e.broadcastOn([Eu()],{target:t})})),c(YD.whichView(l))&&(e.focus(),e.nodeChanged(),YD.refreshToolbar(l))}})),e.addQueryValueHandler("ToggleView",(()=>{var e;return null!==(e=YD.whichView(l))&&void 0!==e?e:""}));const g=Wf(e);g!==Sf.sliding&&g!==Sf.floating||e.on("ResizeWindow ResizeEditor ResizeContent",(()=>{const o=e.getWin().innerWidth;o!==i.get()&&(YD.refreshToolbar(t.mainUi.outerContainer),i.set(o))}));const p={setEnabled:e=>{iw(t,!e)},isEnabled:()=>!pg.isDisabled(l)};return{iframeContainer:m.element.dom,editorContainer:l.element.dom,api:p}}});const iI=e=>/^[0-9\.]+(|px)$/i.test(""+e)?A.some(parseInt(""+e,10)):A.none(),lI=e=>h(e)?e+"px":e,cI=(e,t,o)=>{const n=t.filter((t=>ee>t));return n.or(s).getOr(e)},dI=e=>{const t=If(e),o=Ff(e),n=Nf(e);return iI(t).map((e=>cI(e,o,n)))},{ToolbarLocation:uI,ToolbarMode:mI}=Db,gI=(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=o,i=Of.DOM,l=Ob(e),c=Eb(e),d=Nf(e).or(dI(e)),u=n.shared.header,m=u.isPositionedAtTop,g=Wf(e),p=g===mI.sliding||g===mI.floating,h=on(!1),f=()=>h.get()&&!e.removed,b=e=>p?e.fold(x(0),(e=>e.components().length>1?jt(e.components()[1].element):0)):0,v=()=>{V(a,(e=>{e.broadcastOn([Au()],{})}))},y=o=>{if(!f())return;l||s.on((e=>{const o=d.getOrThunk((()=>Go().width-Kt(t).left-10));Bt(e.element,"max-width",o+"px")}));const n=Wo(),a=!(l||l||!(Xt(r.outerContainer.element).left+Qt(r.outerContainer.element)>=window.innerWidth-40||Lt(r.outerContainer.element,"width").isSome())||(Bt(r.outerContainer.element,"position","absolute"),Bt(r.outerContainer.element,"left","0px"),Ht(r.outerContainer.element,"width"),0));if(p&&YD.refreshToolbar(r.outerContainer),!l){const o=Wo(),i=ke(n.left!==o.left,n);((o,n)=>{s.on((s=>{const a=YD.getToolbar(r.outerContainer),i=b(a),l=Zo(t),c=((e,t)=>Ab(e)?Ba(t):A.none())(e,r.outerContainer.element),d=c.fold((()=>l.x),(e=>{const t=Zo(e);return Qe(e,wt())?l.x:l.x-t.x})),u=ke(o,Math.ceil(r.outerContainer.element.dom.getBoundingClientRect().width)).filter((e=>e>150)).map((e=>{const t=n.getOr(Wo()),o=window.innerWidth-(d-t.left),s=Math.max(Math.min(e,o),150);return om()?Math.max(l.y-jt(s.element)+i,0):l.bottom),(e=>{var t;const o=Zo(e),n=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,r=Qe(e,wt())?Math.max(l.y-jt(s.element)+i,0):l.y-o.y+n-jt(s.element)+i;return m()?r:l.bottom}))+"px"};It(r.outerContainer.element,{...g,...u})}))})(a,i),i.each((e=>{jo(e.left,o.top)}))}c&&s.on(o),v()},w=()=>!(l||!c||!f())&&s.get().exists((o=>{const n=u.getDockingMode(),a=(o=>{switch($f(e)){case uI.auto:const e=YD.getToolbar(r.outerContainer),n=b(e),s=jt(o.element)-n,a=Zo(t);if(a.y>s)return"top";{const e=nt(t),o=Math.max(e.dom.scrollHeight,jt(e));return a.bottom{Ei.setModes(e,[i]),u.setDockingMode(i);const t=m()?Jc.TopToBottom:Jc.BottomToTop;Ct(e.element,Zc,t)})),!0);var i}));return{isVisible:f,isPositionedAtTop:m,show:()=>{h.set(!0),Bt(r.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),V(a,(e=>{Ht(e.element,"display")})),w(),Ab(e)?y((e=>Ei.isDocked(e)?Ei.reset(e):Ei.refresh(e))):y(Ei.refresh)},hide:()=>{h.set(!1),Bt(r.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),V(a,(e=>{Bt(e.element,"display","none")}))},update:y,updateMode:()=>{w()&&y(Ei.reset)},repositionPopups:v}},pI=(e,t)=>{const o=Zo(e);return{pos:t?o.y:o.bottom,bounds:o}};var hI=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r}=t,a=rn(),i=Le(s.targetNode),l=gI(e,i,t,n,a),c=Yf(e);sB(e);const d=()=>{if(a.isSet())return void l.show();a.set(YD.getHeader(r.outerContainer).getOrDie());const s=_b(e);Ab(e)?(pu(i,r.mothership),pu(i,t.popupUi.mothership)):gu(s,r.mothership),gu(s,t.dialogUi.mothership);const d=()=>{nI(e,t,o,n),YD.setMenubar(r.outerContainer,JD(e,o)),l.show(),((e,t,o,n)=>{const s=on(pI(t,o.isPositionedAtTop())),r=n=>{const{pos:r,bounds:a}=pI(t,o.isPositionedAtTop()),{pos:i,bounds:l}=s.get(),c=a.height!==l.height||a.width!==l.width;s.set({pos:r,bounds:a}),c&&eS(e,n),o.isVisible()&&(i!==r?o.update(Ei.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",(()=>o.update(Ei.reset))),e.on("NodeChange keydown",(e=>{requestAnimationFrame((()=>r(e)))}));let a=0;const i=E_((()=>o.update(Ei.refresh)),33);e.on("ScrollWindow",(()=>{const e=Wo().left;e!==a&&(a=e,i.throttle()),o.updateMode()})),Ab(e)&&e.on("ElementScroll",(e=>{o.update(Ei.refresh)}));const l=sn();l.set(Rc(Le(e.getBody()),"load",(e=>r(e.raw)))),e.on("remove",(()=>{l.clear()}))})(e,i,l,c),e.nodeChanged()};c?e.once("SkinLoaded",d):d()};e.on("show",d),e.on("hide",l.hide),c||(e.on("focus",d),e.on("blur",l.hide)),e.on("init",(()=>{(e.hasFocus()||c)&&d()})),lw(e,t);const u={show:d,hide:l.hide,setEnabled:e=>{iw(t,!e)},isEnabled:()=>!pg.isDisabled(r.outerContainer)};return{editorContainer:r.outerContainer.element.dom,api:u}}});const fI="contexttoolbar-hide",bI=(e,t)=>Gr(J_,((o,n)=>{const s=(e=>({hide:()=>Lr(e,yr()),getValue:()=>qu.getValue(e)}))(e.get(o));t.onAction(s,n.event.buttonApi)})),vI=(e,t)=>{const o=e.label.fold((()=>({})),(e=>({"aria-label":e}))),n=Vb(Iy.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:e.initValue(),inputAttributes:o,selectOnFocus:!0,inputBehaviours:ma([xh.config({mode:"special",onEnter:e=>s.findPrimary(e).map((e=>(Vr(e),!0))),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})),s=((e,t,o)=>{const n=z(t,(t=>Vb(((e,t,o)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o)=>{const{primary:n,...s}=t.original,r=Qn(Bx({...s,type:"togglebutton",onAction:b}));return KB(r,o,[bI(e,t)])})(e,t,o):((e,t,o)=>{const{primary:n,...s}=t.original,r=Qn(Ax({...s,type:"button",onAction:b}));return XB(r,o,[bI(e,t)])})(e,t,o))(e,t,o))));return{asSpecs:()=>z(n,(e=>e.asSpec())),findPrimary:e=>se(t,((t,o)=>t.primary?A.from(n[o]).bind((t=>t.getOpt(e))).filter(C(pg.isDisabled)):A.none()))}})(n,e.commands,t);return[{title:A.none(),items:[n.asSpec()]},{title:A.none(),items:s.asSpecs()}]},yI=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,xI=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=mt(Le(e.startContainer),e.startOffset).element;return(Ge(o)?rt(o):A.some(o)).filter($e).map((e=>e.dom.getBoundingClientRect())).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=Wo();return Jo(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=Qo(Le(e.getBody()));return Jo(o.x+t.left,o.y+t.top,t.width,t.height)}},wI=(e,t,o,n=0)=>{const s=Go(window),r=Zo(Le(e.getContentAreaContainer())),a=fb(e)||xb(e)||Sb(e),{x:i,width:l}=((e,t,o)=>{const n=Math.max(e.x+o,t.x);return{x:n,width:Math.min(e.right-o,t.right)-n}})(r,s,n);if(e.inline&&!a)return Jo(i,s.y,l,s.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,s,r)=>{const a=Le(e.getContainer()),i=_l(a,".tox-editor-header").getOr(a),l=Zo(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+r,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-r,o.bottom)};const u="line"===s?Zo(a):t;return d?{y:Math.max(l.bottom+r,o.y),bottom:Math.min(u.bottom-r,o.bottom)}:{y:Math.max(u.y+r,o.y),bottom:Math.min(l.y-r,o.bottom)}})(e,r,s,a,o,n);return Jo(i,c,l,d-c)}},SI={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"],inset:["tox-pop--inset"]},kI={maxHeightFunction:Uc(),maxWidthFunction:JM()},CI=e=>"node"===e,OI=(e,t,o,n,s)=>{const r=xI(e),a=n.lastElement().exists((e=>Qe(o,e)));return((e,t)=>{const o=e.selection.getRng(),n=mt(Le(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&Qe(n.element,t)})(e,o)?a?eA:XE:a?((e,o,s)=>{const a=Lt(e,"position");Bt(e,"position",o);const i=yI(r,Zo(t),-20)&&!n.isReposition()?oA:eA;return a.each((t=>Bt(e,"position",t))),i})(t,n.getMode()):("fixed"===n.getMode()?s.y+Wo().top:s.y)+(jt(t)+12)<=r.y?XE:KE},_I=(e,t,o,n)=>{const s=t=>(n,s,r,a,i)=>({...OI(e,a,t,o,i)({...n,y:i.y,height:i.height},s,r,a,i),alwaysFit:!0}),r=e=>CI(n)?[s(e)]:[];return t?{onLtr:e=>[oc,Jl,Zl,Ql,ec,tc].concat(r(e)),onRtl:e=>[oc,Zl,Jl,ec,Ql,tc].concat(r(e))}:{onLtr:e=>[tc,oc,Ql,Jl,ec,Zl].concat(r(e)),onRtl:e=>[tc,oc,ec,Zl,Ql,Jl].concat(r(e))}},TI=(e,t)=>{const o=P(t,(t=>t.predicate(e.dom))),{pass:n,fail:s}=H(o,(e=>"contexttoolbar"===e.type));return{contextToolbars:n,contextForms:s}},EI=(e,t)=>{const o={},n=[],s=[],r={},a={},i=re(e);return V(i,(i=>{const l=e[i];"contextform"===l.type?((e,i)=>{const l=Qn(Zn("ContextForm",Vx,i));o[e]=l,l.launch.map((o=>{r["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}})),"editor"===l.scope?s.push(l):n.push(l),a[e]=l})(i,l):"contexttoolbar"===l.type&&((e,t)=>{var o;(o=t,Zn("ContextToolbar",Hx,o)).each((o=>{"editor"===t.scope?s.push(o):n.push(o),a[e]=o}))})(i,l)})),{forms:o,inNodeScope:n,inEditorScope:s,lookupTable:a,formNavigators:r}},AI=Bi("forward-slide"),MI=Bi("backward-slide"),DI=Bi("change-slide-event"),BI="tox-pop--resizing",II="tox-pop--transition",FI=(e,t,o,n)=>{const s=n.backstage,r=s.shared,a=Bo().deviceType.isTouch,i=rn(),l=rn(),c=rn(),d=hl((e=>{const t=on([]);return wf.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),wf.getContent(e).each((e=>{Ht(e.element,"visibility")})),Oa(e.element,BI),Ht(e.element,"width")},inlineBehaviours:ma([Mh("context-toolbar-events",[Qr(ar(),((e,t)=>{"width"===t.event.raw.propertyName&&(Oa(e.element,BI),Ht(e.element,"width"))})),Gr(DI,((e,t)=>{const o=e.element;Ht(o,"width");const n=Zt(o);wf.setContent(e,t.event.contents),ka(o,BI);const s=Zt(o);Bt(o,"width",n+"px"),wf.getContent(e).each((e=>{t.event.focus.bind((e=>(hc(e),yc(o)))).orThunk((()=>(xh.focusIn(e),vc(ft(o)))))})),setTimeout((()=>{Bt(e.element,"width",s+"px")}),0)})),Gr(AI,((e,o)=>{wf.getContent(e).each((o=>{t.set(t.get().concat([{bar:o,focus:vc(ft(e.element))}]))})),zr(e,DI,{contents:o.event.forwardContents,focus:A.none()})})),Gr(MI,((e,o)=>{oe(t.get()).each((o=>{t.set(t.get().slice(0,t.get().length-1)),zr(e,DI,{contents:fl(o.bar),focus:o.focus})}))}))]),xh.config({mode:"special",onEscape:o=>oe(t.get()).fold((()=>e.onEscape()),(e=>(Lr(o,MI),A.some(!0))))})]),lazySink:()=>dn.value(e.sink)})})({sink:o,onEscape:()=>(e.focus(),A.some(!0))})),u=()=>{const t=c.get().getOr("node"),o=CI(t)?1:0;return wI(e,r,t,o)},m=()=>!(e.removed||a()&&s.isContextMenuOpen()),g=()=>{if(m()){const t=u(),o=ye(c.get(),"node")?((e,t)=>t.filter((e=>xt(e)&&je(e))).map(Qo).getOrThunk((()=>xI(e))))(e,i.get()):xI(e);return t.height<=0||!yI(o,t,.01)}return!0},p=()=>{i.clear(),l.clear(),c.clear(),wf.hide(d)},h=()=>{if(wf.isOpen(d)){const e=d.element;Ht(e,"display"),g()?Bt(e,"display","none"):(l.set(0),wf.reposition(d))}},f=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:ma([xh.config({mode:"acyclic"}),Mh("pop-dialog-wrap-events",[ea((t=>{e.shortcuts.add("ctrl+F9","focus statusbar",(()=>xh.focusIn(t)))})),ta((t=>{e.shortcuts.remove("ctrl+F9")}))])])}),v=eo((()=>EI(t,(e=>{const t=y([e]);zr(d,AI,{forwardContents:f(t)})})))),y=t=>{const{buttons:o}=e.ui.registry.getAll(),s={...o,...v().formNavigators},a=Wf(e)===Sf.scrolling?Sf.scrolling:Sf.default,i=G(z(t,(t=>"contexttoolbar"===t.type?((t,o)=>oI(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,A.some(["form:"])))(s,t):((e,t)=>vI(e,t))(t,r.providers))));return SD({type:a,uid:Bi("context-toolbar"),initGroups:i,onEscape:A.none,cyclicKeying:!0,providers:r.providers})},x=(t,n)=>{if(S.cancel(),!m())return;const s=y(t),p=t[0].position,h=((t,n)=>{const s="node"===t?r.anchors.node(n):r.anchors.cursor(),c=((e,t,o,n)=>"line"===t?{bubble:Gc(12,0,SI),layouts:{onLtr:()=>[nc],onRtl:()=>[sc]},overrides:kI}:{bubble:Gc(0,12,SI,1/12),layouts:_I(e,o,n,t),overrides:kI})(e,t,a(),{lastElement:i.get,isReposition:()=>ye(l.get(),0),getMode:()=>tu.getMode(o)});return wn(s,c)})(p,n);c.set(p),l.set(1);const b=d.element;Ht(b,"display"),(e=>ye(we(e,i.get(),Qe),!0))(n)||(Oa(b,II),tu.reset(o,d)),wf.showWithinBounds(d,f(s),{anchor:h,transition:{classes:[II],mode:"placement"}},(()=>A.some(u()))),n.fold(i.clear,i.set),g()&&Bt(b,"display","none")};let w=!1;const S=E_((()=>{!e.hasFocus()||e.removed||w||(_a(d.element,II)?S.throttle():((e,t)=>{const o=Le(t.getBody()),n=e=>Qe(e,o),s=Le(t.selection.getNode());return(e=>!n(e)&&!et(o,e))(s)?A.none():((e,t,o)=>{const n=TI(e,t);if(n.contextForms.length>0)return A.some({elem:e,toolbars:[n.contextForms[0]]});{const t=TI(e,o);if(t.contextForms.length>0)return A.some({elem:e,toolbars:[t.contextForms[0]]});if(n.contextToolbars.length>0||t.contextToolbars.length>0){const o=(e=>{if(e.length<=1)return e;{const t=t=>R(e,(e=>e.position===t)),o=t=>P(e,(e=>e.position===t)),n=t("selection"),s=t("node");if(n||s){if(s&&n){const e=o("node"),t=z(o("selection"),(e=>({...e,position:"node"})));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return A.some({elem:e,toolbars:o})}return A.none()}})(s,e.inNodeScope,e.inEditorScope).orThunk((()=>((e,t,o)=>e(t)?A.none():Ls(t,(e=>{if($e(e)){const{contextToolbars:t,contextForms:n}=TI(e,o.inNodeScope),s=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>j(e,(e=>e.position===t));return t("selection").orThunk((()=>t("node"))).orThunk((()=>t("line"))).map((e=>e.position)).fold((()=>[]),(t=>P(e,(e=>e.position===t))))}})(t);return s.length>0?A.some({elem:e,toolbars:s}):A.none()}return A.none()}),e))(n,s,e)))})(v(),e).fold(p,(e=>{x(e.toolbars,A.some(e.elem))})))}),17);e.on("init",(()=>{e.on("remove",p),e.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",h),e.on("click keyup focus SetContent",S.throttle),e.on(fI,p),e.on("contexttoolbar-show",(t=>{const o=v();fe(o.lookupTable,t.toolbarKey).each((o=>{x([o],ke(t.target!==e,t.target)),wf.getContent(d).each(xh.focusIn)}))})),e.on("focusout",(t=>{Cf.setEditorTimeout(e,(()=>{yc(o.element).isNone()&&yc(d.element).isNone()&&p()}),0)})),e.on("SwitchMode",(()=>{e.mode.isReadOnly()&&p()})),e.on("ExecCommand",(({command:e})=>{"toggleview"===e.toLowerCase()&&p()})),e.on("AfterProgressState",(t=>{t.state?p():e.hasFocus()&&S.throttle()})),e.on("dragstart",(()=>{w=!0})),e.on("dragend drop",(()=>{w=!1})),e.on("NodeChange",(e=>{yc(d.element).fold(S.throttle,b)}))}))},RI=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),s=rn();return z(o,(o=>({type:"togglemenuitem",text:t.display(o),onSetup:r=>{const a=e=>{e&&(s.on((e=>e.setActive(!1))),s.set(r)),r.setActive(e)};a(ye(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{s.clear(),i()}},onAction:()=>t.setCurrent(e,o)})))};e.ui.registry.addMenuButton(t.name,{tooltip:t.text,icon:t.icon,fetch:e=>e(o()),onSetup:t.onToolbarSetup}),e.ui.registry.addNestedMenuItem(t.name,{type:"nestedmenuitem",text:t.text,getSubmenuItems:o,onSetup:t.onMenuSetup})},NI=e=>{RI(e,(e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:yb,hash:e=>((e,t)=>TB(e,["fixed","relative","empty"]).map((({value:e,unit:t})=>e+t)))(e).getOr(e),display:w,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>A.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:sS(e),onMenuSetup:sS(e)}))(e)),(e=>A.from(Pf(e)).map((t=>({name:"language",text:"Language",icon:"language",getOptions:x(t),hash:e=>u(e.customCode)?e.code:`${e.code}/${e.customCode}`,display:e=>e.title,watcher:(e,t,o)=>{var n;return e.formatter.formatChanged("lang",o,!1,{value:t.code,customValue:null!==(n=t.customCode)&&void 0!==n?n:null}).unbind},getCurrent:e=>{const t=Le(e.selection.getNode());return zs(t,(e=>A.some(e).filter($e).bind((e=>Tt(e,"lang").map((t=>({code:t,customCode:Tt(e,"data-mce-lang").getOrUndefined(),title:""})))))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=sn();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),nS(o.clear,sS(e)(t))},onMenuSetup:sS(e)}))))(e).each((t=>RI(e,t)))},LI=e=>aS(e,"NodeChange",(t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())})),zI=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),nS((()=>e.off("PastePlainTextToggle",n)),sS(e)(o))},VI=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},HI=e=>{(e=>{(e=>{T_.each([{name:"bold",text:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],((t,o)=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:rS(e,t.name),onAction:VI(e,t.name),shortcut:t.shortcut})}));for(let t=1;t<=6;t++){const o="h"+t,n=`Access+${t}`;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:rS(e,o),onAction:VI(e,o),shortcut:n})}})(e),(e=>{T_.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"help",text:"Help",action:"mceHelp",icon:"help",shortcut:"Alt+0"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],(t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:lS(e,t.action),shortcut:t.shortcut})})),T_.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],(t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:sS(e),onAction:lS(e,t.action)})}))})(e),(e=>{T_.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],(t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:lS(e,t.action),onSetup:rS(e,t.name)})}))})(e)})(e),(e=>{T_.each([{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"print",text:"Print...",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],(t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:lS(e,t.action)})})),T_.each([{name:"bold",text:"Bold",action:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",action:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",action:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",action:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],(t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onSetup:sS(e),onAction:lS(e,t.action)})})),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:sS(e),onAction:VI(e,"code")})})(e)},PI=(e,t)=>aS(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",(o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())})),UI=e=>aS(e,"VisualAid",(t=>{t.setActive(e.hasVisual)})),WI=(e,t)=>{(e=>{V([{name:"alignleft",text:"Align left",cmd:"JustifyLeft",icon:"align-left"},{name:"aligncenter",text:"Align center",cmd:"JustifyCenter",icon:"align-center"},{name:"alignright",text:"Align right",cmd:"JustifyRight",icon:"align-right"},{name:"alignjustify",text:"Justify",cmd:"JustifyFull",icon:"align-justify"}],(t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:lS(e,t.cmd),onSetup:rS(e,t.name)})})),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:sS(e),onAction:lS(e,"JustifyNone")})})(e),HI(e),((e,t)=>{((e,t)=>{const o=iB(t,pB(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:sS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=iB(t,CB(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:sS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=iB(t,LB(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:sS(e),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=iB(t,vB(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:sS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=iB(t,RB(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:sS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)})(e,t),(e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:PI(e,"hasUndo"),onAction:lS(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:PI(e,"hasRedo"),onAction:lS(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:PI(e,"hasUndo"),onAction:lS(e,"undo"),shortcut:"Meta+Z"}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:PI(e,"hasRedo"),onAction:lS(e,"redo"),shortcut:"Meta+Y"})})(e)})(e),(e=>{(e=>{e.addCommand("mceApplyTextcolor",((t,o)=>{((e,t,o)=>{e.undoManager.transact((()=>{e.focus(),e.formatter.apply(t,{value:o}),e.nodeChanged()}))})(e,t,o)})),e.addCommand("mceRemoveTextcolor",(t=>{((e,t)=>{e.undoManager.transact((()=>{e.focus(),e.formatter.remove(t,{value:null},void 0,!0),e.nodeChanged()}))})(e,t)}))})(e);const t=TS(e),o=ES(e),n=on(t),s=on(o);zS(e,"forecolor","forecolor",n),zS(e,"backcolor","hilitecolor",s),VS(e,"forecolor","forecolor","Text color",n),VS(e,"backcolor","hilitecolor","Background color",s)})(e),(e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:lS(e,"mceToggleVisualAid")})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:UI(e),onAction:lS(e,"mceToggleVisualAid")})})(e)})(e),(e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:LI(e),onAction:lS(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:sS(e),onAction:lS(e,"indent")})})(e)})(e),NI(e),(e=>{const t=on(db(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:zI(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:zI(e,t)})})(e)},jI=e=>r(e)?e.split(/[ ,]/):e,$I=e=>t=>t.options.get(e),GI=$I("contextmenu_never_use_native"),qI=$I("contextmenu_avoid_overlap"),YI=e=>{const t=e.ui.registry.getAll().contextMenus,o=e.options.get("contextmenu");return e.options.isSet("contextmenu")?o:P(o,(e=>be(t,e)))},XI=(e,t)=>({type:"makeshift",x:e,y:t}),KI=e=>"longpress"===e.type||0===e.type.indexOf("touch"),JI=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(KI(e)){const t=e.touches[0];return XI(t.pageX,t.pageY)}return XI(e.pageX,e.pageY)})(t):((e,t)=>{const o=Of.DOM.getPos(e);return((e,t,o)=>XI(e.x+t,e.y+o))(t,o.x,o.y)})(e.getContentAreaContainer(),(e=>{if(KI(e)){const t=e.touches[0];return XI(t.clientX,t.clientY)}return XI(e.clientX,e.clientY)})(t)):ZI(e),ZI=e=>({type:"selection",root:Le(e.selection.getNode())}),QI=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:A.some(Le(e.selection.getNode())),root:Le(e.getBody())}))(e);case"point":return JI(e,t);case"selection":return ZI(e)}},eF=(e,t,o,n,s,r)=>{const a=o(),i=QI(e,t,r);uT(a,dy.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:A.none()}).map((e=>{t.preventDefault(),wf.showMenuAt(s,{anchor:i},{menu:{markers:Oy("normal")},data:e})}))},tF={onLtr:()=>[oc,Jl,Zl,Ql,ec,tc,XE,KE,YE,GE,qE,$E],onRtl:()=>[oc,Zl,Jl,ec,Ql,tc,XE,KE,qE,$E,YE,GE]},oF={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"]},nF=(e,t,o,n,s,r)=>{const a=Bo(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),u=()=>{const a=o();((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>{const n=QI(e,t,o);return{bubble:Gc(0,"point"===o?12:0,oF),layouts:tF,overrides:{maxWidthFunction:JM(),maxHeightFunction:Uc()},...n}})(e,t,r);uT(o,dy.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:A.none()}).map((o=>{t.preventDefault();const l=a?vf.HighlightMenuAndItem:vf.HighlightNone;wf.showMenuWithinBounds(s,{anchor:i},{menu:{markers:Oy("normal"),highlightOnOpen:l},data:o,type:"horizontal"},(()=>A.some(wI(e,n.shared,"node"===r?"node":"selection")))),e.dispatch(fI)}))})(e,t,a,n,s,r,!(c||i||l&&d))};if((l||i)&&"node"!==r){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{Cf.setEditorTimeout(e,(()=>{e.selection.setRng(t)}),10),r()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const s=()=>r();e.once("longpresscancel",s);const r=()=>{e.off("touchend",o),e.off("longpresscancel",s),e.off("mousedown",n)}})(e),u()};((e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],s=o.getRng();return Md(e.getWin(),yd.domRange(s)).exists((e=>e.left<=n.clientX&&e.right>=n.clientX&&e.top<=n.clientY&&e.bottom>=n.clientY))}})(e,t)?o():(e.once("selectionchange",o),e.once("touchend",(()=>e.off("selectionchange",o))))}else u()},sF=e=>r(e)?"|"===e:"separator"===e.type,rF={type:"separator"},aF=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(r(e))return e;switch(e.type){case"separator":return rF;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return r(t)?t:z(t,aF)}};default:const o=e;return{type:"menuitem",...t(o),onAction:v(o.onAction)}}},iF=(e,t)=>{if(0===t.length)return e;const o=oe(e).filter((e=>!sF(e))).fold((()=>[]),(e=>[rF]));return e.concat(o).concat(t).concat([rF])},lF=(e,t)=>!(e=>"longpress"===e.type||be(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),cF=(e,t)=>lF(e,t)?e.selection.getStart(!0):t.target,dF=(e,t,o)=>{const n=Bo().deviceType.isTouch,s=hl(wf.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:ma([Mh("dismissContextMenu",[Gr(Er(),((t,o)=>{Tu.close(t),e.focus()}))])])})),a=()=>wf.hide(s),i=t=>{if(GI(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!GI(e))(e,t)||(e=>0===YI(e).length)(e))return;const a=((e,t)=>{const o=qI(e),n=lF(e,t)?"selection":"point";if(Me(o)){const s=cF(e,t);return Dk(Le(s),o)?"node":n}return n})(e,t);(n()?nF:eF)(e,t,(()=>{const o=cF(e,t),n=e.ui.registry.getAll(),s=YI(e);return((e,t,o)=>{const n=W(t,((t,n)=>fe(e,n.toLowerCase()).map((e=>{const n=e.update(o);if(r(n)&&Me(Ae(n)))return iF(t,n.split(" "));if(l(n)&&n.length>0){const e=z(n,aF);return iF(t,e)}return t})).getOrThunk((()=>t.concat([n])))),[]);return n.length>0&&sF(n[n.length-1])&&n.pop(),n})(n.contextMenus,s,o)}),o,s,a)};e.on("init",(()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)}))},uF=Is([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),mF=e=>t=>t.translate(-e.left,-e.top),gF=e=>t=>t.translate(e.left,e.top),pF=e=>(t,o)=>W(e,((e,t)=>t(e)),qt(t,o)),hF=(e,t,o)=>e.fold(pF([gF(o),mF(t)]),pF([mF(t)]),pF([])),fF=(e,t,o)=>e.fold(pF([gF(o)]),pF([]),pF([gF(t)])),bF=(e,t,o)=>e.fold(pF([]),pF([mF(o)]),pF([gF(t),mF(o)])),vF=(e,t,o)=>{const n=e.fold(((e,t)=>({position:A.some("absolute"),left:A.some(e+"px"),top:A.some(t+"px")})),((e,t)=>({position:A.some("absolute"),left:A.some(e-o.left+"px"),top:A.some(t-o.top+"px")})),((e,t)=>({position:A.some("fixed"),left:A.some(e+"px"),top:A.some(t+"px")})));return{right:A.none(),bottom:A.none(),...n}},yF=(e,t,o,n)=>{const s=(e,s)=>(r,a)=>{const i=e(t,o,n);return s(r.getOr(i.left),a.getOr(i.top))};return e.fold(s(bF,xF),s(fF,wF),s(hF,SF))},xF=uF.offset,wF=uF.absolute,SF=uF.fixed,kF=(e,t)=>{const o=_t(e,t);return u(o)?NaN:parseInt(o,10)},CF=(e,t,o,n,s,r)=>{const a=((e,t,o,n)=>((e,t)=>{const o=e.element,n=kF(o,t.leftAttr),s=kF(o,t.topAttr);return isNaN(n)||isNaN(s)?A.none():A.some(qt(n,s))})(e,t).fold((()=>o),(e=>SF(e.left+n.left,e.top+n.top))))(e,t,o,n),i=t.mustSnap?_F(e,t,a,s,r):TF(e,t,a,s,r),l=hF(a,s,r);return((e,t,o)=>{const n=e.element;Ct(n,t.leftAttr,o.left+"px"),Ct(n,t.topAttr,o.top+"px")})(e,t,l),i.fold((()=>({coord:SF(l.left,l.top),extra:A.none()})),(e=>({coord:e.output,extra:e.extra})))},OF=(e,t,o,n)=>se(e,(e=>{const s=e.sensor,r=((e,t,o,n,s,r)=>{const a=fF(e,s,r),i=fF(t,s,r);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n})(t,s,e.range.left,e.range.top,o,n);return r?A.some({output:yF(e.output,t,o,n),extra:e.extra}):A.none()})),_F=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return OF(r,o,n,s).orThunk((()=>{const e=W(r,((e,t)=>{const r=t.sensor,a=((e,t,o,n,s,r)=>{const a=fF(e,s,r),i=fF(t,s,r),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return qt(l,c)})(o,r,t.range.left,t.range.top,n,s);return e.deltas.fold((()=>({deltas:A.some(a),snap:A.some(t)})),(o=>(a.left+a.top)/2<=(o.left+o.top)/2?{deltas:A.some(a),snap:A.some(t)}:e))}),{deltas:A.none(),snap:A.none()});return e.snap.map((e=>({output:yF(e.output,o,n,s),extra:e.extra})))}))},TF=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return OF(r,o,n,s)};var EF=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const t=tt(e.element),o=Wo(t),r=Ia(s),a=((e,t,o)=>({coord:yF(e.output,e.output,t,o),extra:e.extra}))(n,o,r),i=vF(a.coord,0,r);Ft(s,i)}}});const AF="data-initial-z-index",MF=(e,t)=>{e.getSystem().addToGui(t),(e=>{rt(e.element).filter($e).each((t=>{Lt(t,"z-index").each((e=>{Ct(t,AF,e)})),Bt(t,"z-index",Rt(e.element,"z-index"))}))})(t)},DF=e=>{(e=>{rt(e.element).filter($e).each((e=>{Tt(e,AF).fold((()=>Ht(e,"z-index")),(t=>Bt(e,"z-index",t))),At(e,AF)}))})(e),e.getSystem().removeFromGui(e)},BF=(e,t,o)=>e.getSystem().build(Pk.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var IF=ks("snaps",[is("getSnapPoints"),xi("onSensor"),is("leftAttr"),is("topAttr"),Cs("lazyViewport",tn),Cs("mustSnap",!1)]);const FF=[Cs("useFixed",T),is("blockerClass"),Cs("getTarget",w),Cs("onDrag",b),Cs("repositionTarget",!0),Cs("onDrop",b),Ms("getBounds",tn),IF],RF=e=>{return(t=Lt(e,"left"),o=Lt(e,"top"),n=Lt(e,"position"),t.isSome()&&o.isSome()&&n.isSome()?A.some(((e,t,o)=>("fixed"===o?SF:xF)(parseInt(e,10),parseInt(t,10)))(t.getOrDie(),o.getOrDie(),n.getOrDie())):A.none()).getOrThunk((()=>{const t=Xt(e);return wF(t.left,t.top)}));var t,o,n},NF=(e,t)=>({bounds:e.getBounds(),height:$t(t.element),width:Qt(t.element)}),LF=(e,t,o,n,s)=>{const r=o.update(n,s),a=o.getStartData().getOrThunk((()=>NF(t,e)));r.each((o=>{((e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const r=tt(e.element),a=Wo(r),i=Ia(s),l=RF(s),c=((e,t,o,n,s,r,a)=>((e,t,o,n,s)=>{const r=s.bounds,a=fF(t,o,n),i=Ul(a.left,r.x,r.x+r.width-s.width),l=Ul(a.top,r.y,r.y+r.height-s.height),c=wF(i,l);return t.fold((()=>{const e=bF(c,o,n);return xF(e.left,e.top)}),x(c),(()=>{const e=hF(c,o,n);return SF(e.left,e.top)}))})(0,t.fold((()=>{const e=(t=o,a=r.left,i=r.top,t.fold(((e,t)=>xF(e+a,t+i)),((e,t)=>wF(e+a,t+i)),((e,t)=>SF(e+a,t+i))));var t,a,i;const l=hF(e,n,s);return SF(l.left,l.top)}),(t=>{const a=CF(e,t,o,r,n,s);return a.extra.each((o=>{t.onSensor(e,o)})),a.coord})),n,s,a))(e,t.snaps,l,a,i,n,o),d=vF(c,0,i);Ft(s,d)}t.onDrag(e,s,n)})(e,t,a,o)}))},zF=(e,t,o,n)=>{t.each(DF),o.snaps.each((t=>{((e,t)=>{((e,t)=>{const o=e.element;At(o,t.leftAttr),At(o,t.topAttr)})(e,t)})(e,t)}));const s=o.getTarget(e.element);n.reset(),o.onDrop(e,s)},VF=e=>(t,o)=>{const n=e=>{o.setStartData(NF(t,e))};return Wr([Gr(Cr(),(e=>{o.getStartData().each((()=>n(e)))})),...e(t,o,n)])};var HF=Object.freeze({__proto__:null,getData:e=>A.from(qt(e.x,e.y)),getDelta:(e,t)=>qt(t.left-e.left,t.top-e.top)});const PF=(e,t,o)=>[Gr(qs(),((n,s)=>{if(0!==s.event.raw.button)return;s.stop();const r=()=>zF(n,A.some(l),e,t),a=Bk(r,200),i={drop:r,delayDrop:a.schedule,forceDrop:r,move:o=>{a.cancel(),LF(n,e,t,HF,o)}},l=BF(n,e.blockerClass,(e=>Wr([Gr(qs(),e.forceDrop),Gr(Ks(),e.drop),Gr(Ys(),((t,o)=>{e.move(o.event)})),Gr(Xs(),e.delayDrop)]))(i));o(n),MF(n,l)}))],UF=[...FF,Ci("dragger",{handlers:VF(PF)})];var WF=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return A.some(qt(t.clientX,t.clientY))})(t):A.none()},getDelta:(e,t)=>qt(t.left-e.left,t.top-e.top)});const jF=(e,t,o)=>{const n=rn(),s=o=>{zF(o,n.get(),e,t),n.clear()};return[Gr(Ws(),((r,a)=>{a.stop();const i=()=>s(r),l={drop:i,delayDrop:b,forceDrop:i,move:o=>{LF(r,e,t,WF,o)}},c=BF(r,e.blockerClass,(e=>Wr([Gr(Ws(),e.forceDrop),Gr($s(),e.drop),Gr(Gs(),e.drop),Gr(js(),((t,o)=>{e.move(o.event)}))]))(l));n.set(c),o(r),MF(r,c)})),Gr(js(),((o,n)=>{n.stop(),LF(o,e,t,WF,n.event)})),Gr($s(),((e,t)=>{t.stop(),s(e)})),Gr(Gs(),s)]},$F=UF,GF=[...FF,Ci("dragger",{handlers:VF(jF)})],qF=[...FF,Ci("dragger",{handlers:VF(((e,t,o)=>[...PF(e,t,o),...jF(e,t,o)]))})];var YF=Object.freeze({__proto__:null,mouse:$F,touch:GF,mouseOrTouch:qF}),XF=Object.freeze({__proto__:null,init:()=>{let e=A.none(),t=A.none();const o=x({});return ua({readState:o,reset:()=>{e=A.none(),t=A.none()},update:(t,o)=>t.getData(o).bind((o=>((t,o)=>{const n=e.map((e=>t.getDelta(e,o)));return e=A.some(o),n})(t,o))),getStartData:()=>t,setStartData:e=>{t=A.some(e)}})}});const KF=fa({branchKey:"mode",branches:YF,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:A.from(e.extra)})},state:XF,apis:EF}),JF=(e,t,o,n,s,r)=>e.fold((()=>KF.snap({sensor:wF(o-20,n-20),range:qt(s,r),output:wF(A.some(o),A.some(n)),extra:{td:t}})),(e=>{const s=o-20,r=n-20,a=e.element.dom.getBoundingClientRect();return KF.snap({sensor:wF(s,r),range:qt(40,40),output:wF(A.some(o-a.width/2),A.some(n-a.height/2)),extra:{td:t}})})),ZF=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const s=n.td;((e,t)=>e.exists((e=>Qe(e,t))))(t.get(),s)||(t.set(s),o(s))},mustSnap:!0}),QF=e=>Vb(Lb.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:ma([KF.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),bC.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),eR=(e,t)=>{const o=on([]),n=on([]),s=on(!1),r=rn(),a=rn(),i=e=>{const o=Qo(e);return JF(u.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=Qo(e);return JF(m.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=ZF((()=>z(o.get(),(e=>i(e)))),r,(t=>{a.get().each((o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})}))})),d=ZF((()=>z(n.get(),(e=>l(e)))),a,(t=>{r.get().each((o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})}))})),u=QF(c),m=QF(d),g=hl(u.asSpec()),p=hl(m.asSpec()),h=(t,o,n,s)=>{const r=n(o);KF.snapTo(t,r),((t,o,n,r)=>{const a=o.dom.getBoundingClientRect();Ht(t.element,"display");const i=st(Le(e.getBody())).dom.innerHeight,l=a[s]<0,c=((e,t)=>e[s]>t)(a,i);(l||c)&&Bt(t.element,"display","none")})(t,o)},f=e=>h(g,e,i,"top"),b=e=>h(p,e,l,"bottom");if(Bo().deviceType.isTouch()){const i=e=>z(e,Le);e.on("TableSelectionChange",(e=>{s.get()||(lu(t,g),lu(t,p),s.set(!0));const l=Le(e.start),c=Le(e.finish);r.set(l),a.set(c),A.from(e.otherCells).each((e=>{o.set(i(e.upOrLeftCells)),n.set(i(e.downOrRightCells)),f(l),b(c)}))})),e.on("ResizeEditor ResizeWindow ScrollContent",(()=>{r.get().each(f),a.get().each(b)})),e.on("TableSelectionClear",(()=>{s.get()&&(uu(g),uu(p),s.set(!1)),r.clear(),a.clear()}))}},tR=(e,t,o)=>{var n;const s=null!==(n=t.delimiter)&&void 0!==n?n:"\u203a";return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:ma([xh.config({mode:"flow",selector:"div[role=button]"}),pg.config({disabled:o.isDisabled}),cw(),Ub.config({}),Ah.config({}),Mh("elementPathEvents",[ea(((t,n)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",(()=>xh.focusIn(t))),e.on("NodeChange",(n=>{const r=(t=>{const o=[];let n=t.length;for(;n-- >0;){const r=t[n];if(1===r.nodeType&&"BR"!==(s=r).nodeName&&!s.getAttribute("data-mce-bogus")&&"bookmark"!==s.getAttribute("data-mce-type")){const t=oS(e,r);if(t.isDefaultPrevented()||o.push({name:t.name,element:r}),t.isPropagationStopped())break}}var s;return o})(n.parents),a=r.length>0?W(r,((t,n,r)=>{const a=((t,n,s)=>Lb.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":s,"aria-level":s+1}},components:[ul(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:ma([dw(o.isDisabled),cw()])}))(n.name,n.element,r);return 0===r?t.concat([a]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[ul(` ${s} `)]},a])}),[]):[];Ah.set(t,a)}))}))])]),components:[]}};var oR;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(oR||(oR={}));const nR=(e,t,o)=>{const n=Le(e.getContainer()),s=((e,t,o,n,s)=>{const r={height:cI(n+t.top,Rf(e),Lf(e))};return o===oR.Both&&(r.width=cI(s+t.left,Ff(e),Nf(e))),r})(e,t,o,jt(n),Zt(n));ie(s,((e,t)=>{h(e)&&Bt(n,t,lI(e))})),(e=>{e.dispatch("ResizeEditor")})(e)},sR=(e,t,o,n)=>{const s=qt(20*o,20*n);return nR(e,s,t),A.some(!0)},rR=(e,t)=>{const o=()=>{const o=[],n=gb(e),s=ib(e),r=lb(e)||e.hasPlugin("wordcount");return s&&o.push(tR(e,{},t)),n&&o.push((()=>{const e=ww("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[ul(Kv.translate(["Press {0} for help",e]))]}})()),r&&o.push((()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>Ah.set(e,[ul(t.translate(["{0} "+n,o[n]]))]);return Lb.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:ma([dw(t.isDisabled),cw(),Ub.config({}),Ah.config({}),qu.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Mh("wordcount-events",[na((e=>{const t=qu.getValue(e),n="words"===t.mode?"characters":"words";qu.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)})),ea((t=>{e.on("wordCountUpdate",(e=>{const{mode:n}=qu.getValue(t);qu.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)}))}))])]),eventOrder:{[hr()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),lb(e)&&o.push({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v7",rel:"noopener",target:"_blank","aria-label":Kv.translate(["Powered by {0}","Tiny"])},innerHtml:'\n'.trim()},behaviours:ma([Rh.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}})()),o.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...(()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(n){const o="tox-statusbar__text-container-3-cols";return r||s?r&&!s?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[r&&!s?t:e]})()]},components:o}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const n=o(),s=((e,t)=>{const o=(e=>{const t=cb(e);return!1===t?oR.None:"both"===t?oR.Both:oR.Vertical})(e);if(o===oR.None)return A.none();const n=o===oR.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return A.some(ry("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{"aria-label":t.translate(n),"data-mce-name":"resize-handle"},behaviours:[KF.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,s)=>nR(e,s,o),blockerClass:"tox-blocker"}),xh.config({mode:"special",onLeft:()=>sR(e,o,-1,0),onRight:()=>sR(e,o,1,0),onUp:()=>sR(e,o,0,-1),onDown:()=>sR(e,o,0,1)}),Ub.config({}),Rh.config({}),Qb.config(t.tooltips.getConfig({tooltipText:t.translate("Resize")}))]},t.icons))})(e,t);return n.concat(s.toArray())})()}},aR=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),iR=(e,t)=>{const o=e.inline,n=o?hI:aI,s=Eb(e)?bM:iM,r=(()=>{const e=rn(),t=rn(),o=rn();return{dialogUi:e,popupUi:t,mainUi:o,getUiMotherships:()=>{const o=e.get().map((e=>e.mothership)),n=t.get().map((e=>e.mothership));return o.fold((()=>n.toArray()),(e=>n.fold((()=>[e]),(t=>Qe(e.element,t.element)?[e]:[e,t]))))},lazyGetInOuterOrDie:(e,t)=>()=>o.get().bind((e=>t(e.outerContainer))).getOrDie(`Could not find ${e} element in OuterContainer`)}})(),a=rn(),i=rn(),l=rn(),c=Bo().deviceType.isTouch()?["tox-platform-touch"]:[],d=kb(e),u=Wf(e),m=Vb({dom:{tag:"div",classes:["tox-anchorbar"]}}),g=Vb({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),p=()=>r.mainUi.get().map((e=>e.outerContainer)).bind(YD.getHeader),h=r.lazyGetInOuterOrDie("anchor bar",m.getOpt),f=r.lazyGetInOuterOrDie("bottom anchor bar",g.getOpt),b=r.lazyGetInOuterOrDie("toolbar",YD.getToolbar),v=r.lazyGetInOuterOrDie("throbber",YD.getThrobber),y=((e,t,o,n)=>{const s=on(!1),r=(e=>{const t=on(kb(e)?"bottom":"top");return{isPositionedAtTop:()=>"top"===t.get(),getDockingMode:t.get,setDockingMode:t.set}})(t),a={icons:()=>t.ui.registry.getAll().icons,menuItems:()=>t.ui.registry.getAll().menuItems,translate:Kv.translate,isDisabled:()=>t.mode.isReadOnly()||!t.ui.isEnabled(),getOption:t.options.get,tooltips:SA(e.dialog)},i=qA(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},n=on([]),s=on([]),r=on(!1);return e.on("PreInit",(s=>{const r=yA(e),a=wA(e,r,t,o);n.set(a)})),e.on("addStyleModifications",(n=>{const a=wA(e,n.items,t,o);s.set(a),r.set(n.replace)})),{getData:()=>{const e=r.get()?[]:n.get(),t=s.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:dA(e),hasCustomColors:uA(e),getColors:mA(e),getColorCols:gA(e)}))(t),d=(e=>({isDraggableModal:pA(e)}))(t),u={shared:{providers:a,anchors:cA(t,o,n,r.isPositionedAtTop),header:r},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>s.get(),setContextMenuState:e=>s.set(e)},m={...u,shared:{...u.shared,interpreter:e=>LE(e,{},m),getSink:e.popup}},g={...u,shared:{...u.shared,interpreter:e=>LE(e,{},g),getSink:e.dialog}};return{popup:m,dialog:g}})({popup:()=>dn.fromOption(r.popupUi.get().map((e=>e.sink)),"(popup) UI has not been rendered"),dialog:()=>dn.fromOption(r.dialogUi.get().map((e=>e.sink)),"UI has not been rendered")},e,h,f),x=()=>{const t=(()=>{const t={attributes:{[Zc]:d?Jc.BottomToTop:Jc.TopToBottom}},o=YD.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:y.popup,onEscape:()=>{e.focus()}}),n=YD.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:y.popup.shared.getSink,providers:y.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{((e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})})(e,t)},type:u,lazyToolbar:b,lazyHeader:()=>p().getOrDie("Could not find header element"),...t}),s=YD.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:y.popup.shared.providers,onEscape:()=>{e.focus()},type:u}),r=Sb(e),a=xb(e),i=fb(e),l=mb(e),c=YD.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]}}),g=r||a||i,h=l?[c,o]:[o];return YD.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(g?[]:["tox-editor-header--empty"]),...t},components:G([i?h:[],r?[s]:a?[n]:[],Ob(e)?[]:[m.asSpec()]]),sticky:Eb(e),editor:e,sharedBackstage:y.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[YD.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),YD.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},s=YD.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:y.popup}),r=YD.parts.viewWrapper({backstage:y.popup}),i=ab(e)&&!o?A.some(rR(e,y.popup.shared.providers)):A.none(),l=G([d?[]:[t],o?[]:[n],d?[t]:[]]),h=YD.parts.editorContainer({components:G([l,o?[]:[g.asSpec()]])}),f=Tb(e),v={role:"application",...Kv.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},x=hl(YD.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(o?["tox-tinymce-inline"]:[]).concat(d?["tox-tinymce--toolbar-bottom"]:[]).concat(c),styles:{visibility:"hidden",...f?{opacity:"0",border:"0"}:{}},attributes:v},components:[h,...o?[]:[r,...i.toArray()],s],behaviours:ma([cw(),pg.config({disableClass:"tox-tinymce--disabled"}),xh.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle"})])})),w=Uk(x);return a.set(w),{mothership:w,outerContainer:x}},w=t=>{const o=lI((e=>{const t=(e=>{const t=Bf(e),o=Rf(e),n=Lf(e);return iI(t).map((e=>cI(e,o,n)))})(e);return t.getOr(Bf(e))})(e)),n=lI((e=>dI(e).getOr(If(e)))(e));return e.inline||(Vt("div","width",n)&&Bt(t.element,"width",n),Vt("div","height",o)?Bt(t.element,"height",o):Bt(t.element,"height","400px")),o};return{popups:{backstage:y.popup,getMothership:()=>aR("popups",l)},dialogs:{backstage:y.dialog,getMothership:()=>aR("dialogs",i)},renderUI:()=>{const o=x(),a=(()=>{const t=_b(e),o=Qe(wt(),t)&&"grid"===Rt(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...Kv.isRtl()?{dir:"rtl"}:{}}},behaviours:ma([tu.config({useFixed:()=>s.isDocked(p)})])},r={dom:{styles:{width:document.body.clientWidth+"px"}},events:Wr([Gr(Or(),(e=>{Bt(e.element,"width",document.body.clientWidth+"px")}))])},a=hl(wn(n,o?r:{})),l=Uk(a);return i.set(l),{sink:a,mothership:l}})(),d=Ab(e)?(()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(c),attributes:{...Kv.isRtl()?{dir:"rtl"}:{}}},behaviours:ma([tu.config({useFixed:()=>s.isDocked(p),getBounds:()=>t.getPopupSinkBounds()})])},o=hl(e),n=Uk(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(a);r.dialogUi.set(a),r.popupUi.set(d),r.mainUi.set(o);return(t=>{const{mainUi:o,popupUi:r,uiMotherships:a}=t;le(jf(e),((t,o)=>{e.ui.registry.addGroupToolbarButton(o,t)}));const{buttons:i,menuItems:l,contextToolbars:c,sidebars:d,views:m}=e.ui.registry.getAll(),g=wb(e),h={menuItems:l,menus:Mb(e),menubar:Kf(e),toolbar:g.getOrThunk((()=>Jf(e))),allowToolbarGroups:u===Sf.floating,buttons:i,sidebar:d,views:m};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",(()=>{YD.focusMenubar(f)})),e.addShortcut("alt+F10","focus toolbar",(()=>{YD.focusToolbar(f)})),e.addCommand("ToggleToolbarDrawer",((e,t)=>{(null==t?void 0:t.skipFocus)?YD.toggleToolbarDrawerWithoutFocusing(f):YD.toggleToolbarDrawer(f)})),e.addQueryStateHandler("ToggleToolbarDrawer",(()=>YD.isToolbarDrawerToggled(f))),((e,t,o)=>{const n=(e,n)=>{V([t,...o],(t=>{t.broadcastEvent(e,n)}))},s=(e,n)=>{V([t,...o],(t=>{t.broadcastOn([e],n)}))},r=e=>s(Eu(),{target:e.target}),a=qo(),i=Fc(a,"touchstart",r),l=Fc(a,"touchmove",(e=>n(Sr(),e))),c=Fc(a,"touchend",(e=>n(kr(),e))),d=Fc(a,"mousedown",r),u=Fc(a,"mouseup",(e=>{0===e.raw.button&&s(Mu(),{target:e.target})})),m=e=>s(Eu(),{target:Le(e.target)}),g=e=>{0===e.button&&s(Mu(),{target:Le(e.target)})},p=()=>{V(e.editorManager.get(),(t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})}))},h=e=>n(Cr(),Nc(e)),f=e=>{s(Au(),{}),n(Or(),Nc(e))},b=ft(Le(e.getElement())),v=Rc(b,"scroll",(o=>{requestAnimationFrame((()=>{if(null!=e.getContainer()){const s=Rb(e,t.element).map((e=>[e.element,...e.others])).getOr([]);R(s,(e=>Qe(e,o.target)))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Br(),o))}}))})),y=()=>s(Au(),{}),x=t=>{t.state&&s(Eu(),{target:Le(e.getContainer())})},w=e=>{s(Eu(),{target:Le(e.relatedTarget.getContainer())})},S=t=>e.dispatch("focusin",t),k=t=>e.dispatch("focusout",t);e.on("PostRender",(()=>{e.on("click",m),e.on("tap",m),e.on("mouseup",g),e.on("mousedown",p),e.on("ScrollWindow",h),e.on("ResizeWindow",f),e.on("ResizeEditor",y),e.on("AfterProgressState",x),e.on("DismissPopups",w),V([t,...o],(e=>{e.element.dom.addEventListener("focusin",S),e.element.dom.addEventListener("focusout",k)}))})),e.on("remove",(()=>{e.off("click",m),e.off("tap",m),e.off("mouseup",g),e.off("mousedown",p),e.off("ScrollWindow",h),e.off("ResizeWindow",f),e.off("ResizeEditor",y),e.off("AfterProgressState",x),e.off("DismissPopups",w),V([t,...o],(e=>{e.element.dom.removeEventListener("focusin",S),e.element.dom.removeEventListener("focusout",k)})),d.unbind(),i.unbind(),l.unbind(),c.unbind(),u.unbind(),v.unbind()})),e.on("detach",(()=>{V([t,...o],fu),V([t,...o],(e=>e.destroy()))}))})(e,o.mothership,a),s.setup(e,y.popup.shared,p),WI(e,y.popup),dF(e,y.popup.shared.getSink,y.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();V(re(t),(o=>{const n=t[o],s=()=>ye(A.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o),t.setActive(s())},onSetup:t=>{t.setActive(s());const o=()=>t.setActive(s());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}}})}))})(e),UM(e,v,y.popup.shared),FI(e,c,r.sink,{backstage:y.popup}),eR(e,r.sink);const b={targetNode:e.getElement(),height:w(o.outerContainer)};return n.render(e,t,h,y.popup,b)})({popupUi:d,dialogUi:a,mainUi:o,uiMotherships:r.getUiMotherships()})}}},lR=x([is("lazySink"),fs("dragBlockClass"),Ms("getBounds",tn),Cs("useTabstopAt",E),Cs("firstTabstop",0),Cs("eventOrder",{}),Yu("modalBehaviours",[xh]),wi("onExecute"),ki("onEscape")]),cR={sketch:w},dR=x([km({name:"draghandle",overrides:(e,t)=>({behaviours:ma([KF.config({mode:"mouse",getTarget:e=>kl(e,'[role="dialog"]').getOr(e),blockerClass:e.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+JSON.stringify(t,null,2)).message),getBounds:e.getDragBounds})])})}),wm({schema:[is("dom")],name:"title"}),wm({factory:cR,schema:[is("dom")],name:"close"}),wm({factory:cR,schema:[is("dom")],name:"body"}),km({factory:cR,schema:[is("dom")],name:"footer"}),Sm({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[Cs("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Cs("components",[])],name:"blocker"})]),uR=Km({name:"ModalDialog",configFields:lR(),partFields:dR(),factory:(e,t,o,n)=>{const s=rn(),r=Bi("modal-events"),a={...e.eventOrder,[_r()]:[r].concat(e.eventOrder["alloy.system.attached"]||[])},i=Bo();return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{s.set(t);const o=e.lazySink(t).getOrDie(),r=n.blocker(),a=o.getSystem().build({...r,components:r.components.concat([fl(t)]),behaviours:ma([Rh.config({}),Mh("dialog-blocker-events",[Qr(Zs(),(()=>{HM.isBlocked(t)||xh.focusIn(t)}))])])});lu(o,a),xh.focusIn(t)},hide:e=>{s.clear(),rt(e.element).each((t=>{e.getSystem().getByDom(t).each((e=>{uu(e)}))}))},getBody:t=>Nm(t,e,"body"),getFooter:t=>Rm(t,e,"footer"),setIdle:e=>{HM.unblock(e)},setBusy:(e,t)=>{HM.block(e,t)}},eventOrder:a,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Ku(e.modalBehaviours,[Ah.config({}),xh.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),HM.config({getRoot:s.get}),Mh(r,[ea((t=>{const o=Nm(t,e,"title").element,n=(e=>e.dom.textContent)(o);i.os.isMacOS()&&g(n)?Ct(t.element,"aria-label",n):((e,t)=>{const o=Tt(e,"id").fold((()=>{const e=Bi("dialog-label");return Ct(t,"id",e),e}),w);Ct(e,"aria-labelledby",o)})(t.element,o)}))])])}},apis:{show:(e,t)=>{e.show(t)},hide:(e,t)=>{e.hide(t)},getBody:(e,t)=>e.getBody(t),getFooter:(e,t)=>e.getFooter(t),setBusy:(e,t,o)=>{e.setBusy(t,o)},setIdle:(e,t)=>{e.setIdle(t)}}}),mR=Nn([Jy,Zy].concat(qx)),gR=$n,pR=[Cx("button"),ux,Es("align","end",["start","end"]),yx,vx,xs("buttonType",["primary","secondary"])],hR=[...pR,ex],fR=[us("type",["submit","cancel","custom"]),...hR],bR=[us("type",["menu"]),dx,mx,ux,hs("items",mR),...pR],vR=[...pR,us("type",["togglebutton"]),mx,ux,dx,As("active",!1)],yR=os("type",{submit:fR,cancel:fR,custom:fR,menu:bR,togglebutton:vR}),xR=[Jy,ex,us("level",["info","warn","error","success"]),ox,Cs("url","")],wR=Nn(xR),SR=[Jy,ex,vx,Cx("button"),ux,bx,xs("buttonType",["primary","secondary","toolbar"]),yx],kR=Nn(SR),CR=[Jy,Zy],OR=CR.concat([gx]),_R=CR.concat([Qy,vx]),TR=Nn(_R),ER=$n,AR=OR.concat([xx("auto")]),MR=Nn(AR),DR=Hn([nx,ex,ox]),BR=OR.concat([Ts("storageKey","default")]),IR=Nn(BR),FR=jn,RR=Nn(OR),NR=jn,LR=CR.concat([Ts("tag","textarea"),ds("scriptId"),ds("scriptUrl"),ws("onFocus"),Os("settings",void 0,Yn)]),zR=CR.concat([Ts("tag","textarea"),ms("init")]),VR=Kn((e=>Zn("customeditor.old",Rn(zR),e).orThunk((()=>Zn("customeditor.new",Rn(LR),e))))),HR=jn,PR=Nn(OR),UR=Ln(Mn),WR=e=>[Jy,cs("columns"),e],jR=[Jy,ds("html"),Es("presets","presentation",["presentation","document"])],$R=Nn(jR),GR=OR.concat([As("border",!1),As("sandboxed",!0),As("streamContent",!1),As("transparent",!0)]),qR=Nn(GR),YR=jn,XR=Nn(CR.concat([ys("height")])),KR=Nn([ds("url"),vs("zoom"),vs("cachedWidth"),vs("cachedHeight")]),JR=OR.concat([ys("inputMode"),ys("placeholder"),As("maximized",!1),vx]),ZR=Nn(JR),QR=jn,eN=e=>[Jy,Qy,e,Es("align","start",["start","center","end"])],tN=[ex,nx],oN=[ex,hs("items",ns(0,(()=>nN)))],nN=zn([Nn(tN),Nn(oN)]),sN=OR.concat([hs("items",nN),vx]),rN=Nn(sN),aN=jn,iN=OR.concat([ps("items",[ex,nx]),_s("size",1),vx]),lN=Nn(iN),cN=jn,dN=OR.concat([As("constrain",!0),vx]),uN=Nn(dN),mN=Nn([ds("width"),ds("height")]),gN=CR.concat([Qy,_s("min",0),_s("max",0)]),pN=Nn(gN),hN=Wn,fN=[Jy,hs("header",jn),hs("cells",Ln(jn))],bN=Nn(fN),vN=OR.concat([ys("placeholder"),As("maximized",!1),vx]),yN=Nn(vN),xN=jn,wN=[us("type",["directory","leaf"]),tx,ds("id"),bs("menu",xM)],SN=Nn(wN),kN=wN.concat([hs("children",ns(0,(()=>Xn("type",{directory:CN,leaf:SN}))))]),CN=Nn(kN),ON=Xn("type",{directory:CN,leaf:SN}),_N=[Jy,hs("items",ON),ws("onLeafAction"),ws("onToggleExpand"),Ds("defaultExpandedIds",[],jn),ys("defaultSelectedId")],TN=Nn(_N),EN=OR.concat([Es("filetype","file",["image","media","file"]),vx,ys("picker_text")]),AN=Nn(EN),MN=Nn([nx,wx]),DN=e=>ss("items","items",{tag:"required",process:{}},Ln(Kn((t=>Zn(`Checking item of ${e}`,BN,t).fold((e=>dn.error(ts(e))),(e=>dn.value(e))))))),BN=In((()=>{return Xn("type",{alertbanner:wR,bar:Nn((e=DN("bar"),[Jy,e])),button:kR,checkbox:TR,colorinput:IR,colorpicker:RR,dropzone:PR,grid:Nn(WR(DN("grid"))),iframe:qR,input:ZR,listbox:rN,selectbox:lN,sizeinput:uN,slider:pN,textarea:yN,urlinput:AN,customeditor:VR,htmlpanel:$R,imagepreview:XR,collection:MR,label:Nn(eN(DN("label"))),table:bN,tree:TN,panel:FN});var e})),IN=[Jy,Cs("classes",[]),hs("items",BN)],FN=Nn(IN),RN=[Cx("tab"),tx,hs("items",BN)],NN=[Jy,ps("tabs",RN)],LN=Nn(NN),zN=hR,VN=yR,HN=Nn([ds("title"),ls("body",Xn("type",{panel:FN,tabpanel:LN})),Ts("size","normal"),Ds("buttons",[],VN),Cs("initialData",{}),Ms("onAction",b),Ms("onChange",b),Ms("onSubmit",b),Ms("onClose",b),Ms("onCancel",b),Ms("onTabChange",b)]),PN=Nn([us("type",["cancel","custom"]),...zN]),UN=Nn([ds("title"),ds("url"),vs("height"),vs("width"),Ss("buttons",PN),Ms("onAction",b),Ms("onCancel",b),Ms("onClose",b),Ms("onMessage",b)]),WN=e=>a(e)?[e].concat(q(he(e),WN)):l(e)?q(e,WN):[],jN=e=>r(e.type)&&r(e.name),$N={checkbox:ER,colorinput:FR,colorpicker:NR,dropzone:UR,input:QR,iframe:YR,imagepreview:KR,selectbox:cN,sizeinput:mN,slider:hN,listbox:aN,size:mN,textarea:xN,urlinput:MN,customeditor:HR,collection:DR,togglemenuitem:gR},GN=e=>{const t=(e=>P(WN(e),jN))(e),o=q(t,(e=>(e=>A.from($N[e.type]))(e).fold((()=>[]),(t=>[ls(e.name,t)]))));return Nn(o)},qN=e=>{var t;return{internalDialog:Qn(Zn("dialog",HN,e)),dataValidator:GN(e),initialData:null!==(t=e.initialData)&&void 0!==t?t:{}}},YN={open:(e,t)=>{const o=qN(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(Qn(Zn("dialog",UN,t))),redial:e=>qN(e)};var XN=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each((e=>{const s=e(o,n);t.set(s)})),e.renderComponents.each((s=>{const r=s(n,t.get());(e.reuseDom?Sh:wh)(o,r)}))};return Wr([Gr(pr(),((t,n)=>{const s=n;if(!s.universal){const n=e.channel;F(s.channels,n)&&o(t,s.data)}})),ea(((t,n)=>{e.initialData.each((e=>{o(t,e)}))}))])}}),KN=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),JN=[is("channel"),fs("renderComponents"),fs("updateState"),fs("initialData"),As("reuseDom",!0)];const ZN=pa({fields:JN,name:"reflecting",active:XN,apis:KN,state:Object.freeze({__proto__:null,init:()=>{const e=on(A.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(A.none())}}})}),QN=e=>{const t=[],o={};return ie(e,((e,n)=>{e.fold((()=>{t.push(n)}),(e=>{o[n]=e}))})),t.length>0?dn.error(t):dn.value(o)},eL=(e,t,o)=>{const n=Vb(d_.sketch((n=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:z(e.items,(e=>RE(n,e,t,o)))}))));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:ma([xh.config({mode:"acyclic",useTabstopAt:C(R_)}),(s=n,eg.config({find:s.getOpt})),x_(n,{postprocess:e=>QN(e).fold((e=>(console.error(e),{})),w)}),Mh("dialog-body-panel",[Gr(Zs(),((e,t)=>{e.getSystem().broadcastOn([P_],{newFocus:A.some(t.event.target)})}))])])};var s},tL=Xm({name:"TabButton",configFields:[Cs("uid",void 0),is("value"),ss("dom","dom",On((()=>({attributes:{role:"tab",id:Bi("aria"),"aria-selected":"false"}}))),Pn()),fs("action"),Cs("domModification",{}),Yu("tabButtonBehaviours",[Rh,xh,qu]),is("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:$h(e.action),behaviours:Ku(e.tabButtonBehaviours,[Rh.config({}),xh.config({mode:"execution",useSpace:!0,useEnter:!0}),qu.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),oL=x([is("tabs"),is("dom"),Cs("clickToDismiss",!1),Yu("tabbarBehaviours",[Cg,xh]),vi(["tabClass","selectedClass"])]),nL=Cm({factory:tL,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Cg.dehighlight(e,t),zr(e,Fr(),{tabbar:e,button:t})},o=(e,t)=>{Cg.highlight(e,t),zr(e,Ir(),{tabbar:e,button:t})};return{action:n=>{const s=n.getSystem().getByUid(e.uid).getOrDie(),r=Cg.isHighlighted(s,n);(r&&e.clickToDismiss?t:r?b:o)(s,n)},domModification:{classes:[e.markers.tabClass]}}}}),sL=x([nL]),rL=Km({name:"Tabbar",configFields:oL(),partFields:sL(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Ku(e.tabbarBehaviours,[Cg.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{Ct(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{Ct(t.element,"aria-selected","false")}}),xh.config({mode:"flow",getInitial:e=>Cg.getHighlighted(e).map((e=>e.element)),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),aL=Xm({name:"Tabview",configFields:[Yu("tabviewBehaviours",[Ah])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:Ku(e.tabviewBehaviours,[Ah.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),iL=x([Cs("selectFirst",!0),xi("onChangeTab"),xi("onDismissTab"),Cs("tabs",[]),Yu("tabSectionBehaviours",[])]),lL=wm({factory:rL,schema:[is("dom"),gs("markers",[is("tabClass"),is("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),cL=wm({factory:aL,name:"tabview"}),dL=x([lL,cL]),uL=Km({name:"TabSection",configFields:iL(),partFields:dL(),factory:(e,t,o,n)=>{const s=(t,o)=>{Rm(t,e,"tabbar").each((e=>{o(e).each(Vr)}))};return{uid:e.uid,dom:e.dom,components:t,behaviours:Xu(e.tabSectionBehaviours),events:Wr(G([e.selectFirst?[ea(((e,t)=>{s(e,Cg.getFirst)}))]:[],[Gr(Ir(),((t,o)=>{(t=>{const o=qu.getValue(t);Rm(t,e,"tabview").each((n=>{j(e.tabs,(e=>e.value===o)).each((o=>{const s=o.view();Tt(t.element,"id").each((e=>{Ct(n.element,"aria-labelledby",e)})),Ah.set(n,s),e.onChangeTab(n,t,s)}))}))})(o.event.button)})),Gr(Fr(),((t,o)=>{const n=o.event.button;e.onDismissTab(t,n)}))]])),apis:{getViewItems:t=>Rm(t,e,"tabview").map((e=>Ah.contents(e))).getOr([]),showTab:(e,t)=>{s(e,(e=>{const o=Cg.getCandidates(e);return j(o,(e=>qu.getValue(e)===t)).filter((t=>!Cg.isHighlighted(e,t)))}))}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),mL=(e,t)=>{Bt(e,"height",t+"px"),Bt(e,"flex-basis",t+"px")},gL=(e,t,o)=>{kl(e,'[role="dialog"]').each((e=>{_l(e,'[role="tablist"]').each((n=>{o.get().map((o=>(Bt(t,"height","0"),Bt(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=nt(e).dom,s=kl(e,".tox-dialog-wrap").getOr(e);let r;r="fixed"===Rt(s,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const a=jt(t),i=t.dom.offsetLeft>=o.dom.offsetLeft+Zt(o)?Math.max(jt(o),a):a,l=parseInt(Rt(e,"margin-top"),10)||0,c=parseInt(Rt(e,"margin-bottom"),10)||0;return r-(jt(e)+l+c-i)})(e,t,n))))).each((e=>{mL(t,e)}))}))}))},pL=e=>_l(e,'[role="tabpanel"]'),hL="send-data-to-section",fL="send-data-to-view",bL=(e,t,o)=>{const n=on({}),s=e=>{const t=qu.getValue(e),o=QN(t).getOr({}),s=n.get(),r=wn(s,o);n.set(r)},r=e=>{const t=n.get();qu.setValue(e,t)},a=on(null),i=z(e.tabs,(e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[ul(o.shared.providers.translate(e.title))],view:()=>[d_.sketch((n=>({dom:{tag:"div",classes:["tox-form"]},components:z(e.items,(e=>RE(n,e,t,o))),formBehaviours:ma([xh.config({mode:"acyclic",useTabstopAt:C(R_)}),Mh("TabView.form.events",[ea(r),ta(s)]),gc.config({channels:Rs([{key:hL,value:{onReceive:s}},{key:fL,value:{onReceive:r}}])})])})))]}))),l=(e=>{const t=rn(),o=[ea((o=>{const n=o.element;pL(n).each((s=>{Bt(s,"visibility","hidden"),o.getSystem().getByDom(s).toOptional().each((o=>{const n=((e,t,o)=>z(e,((n,s)=>{Ah.set(o,e[s].view());const r=t.dom.getBoundingClientRect();return Ah.set(o,[]),r.height})))(e,s,o),r=(e=>te(Q(e,((e,t)=>e>t?-1:e{te(e).each((e=>uL.showTab(t,e.value)))})(e,o),requestAnimationFrame((()=>{gL(n,s,t)}))}))})),Gr(Or(),(e=>{const o=e.element;pL(o).each((e=>{gL(o,e,t)}))})),Gr(rC,((e,o)=>{const n=e.element;pL(n).each((e=>{const o=vc(ft(e));Bt(e,"visibility","hidden");const s=Lt(e,"height").map((e=>parseInt(e,10)));Ht(e,"height"),Ht(e,"flex-basis");const r=e.dom.getBoundingClientRect().height;s.forall((e=>r>e))?(t.set(r),gL(n,e,t)):s.each((t=>{mL(e,t)})),Ht(e,"visibility"),o.each(hc)}))}))];return{extraEvents:o,selectFirst:!1}})(i);return uL.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=qu.getValue(t);zr(e,sC,{name:n,oldName:a.get()}),a.set(n)},tabs:i,components:[uL.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[rL.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:ma([Ub.config({})])}),uL.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:ma([Mh("tabpanel",l.extraEvents),xh.config({mode:"acyclic"}),eg.config({find:e=>te(uL.getViewItems(e))}),w_(A.none(),(e=>(e.getSystem().broadcastOn([hL],{}),n.get())),((e,t)=>{n.set(t),e.getSystem().broadcastOn([fL],{})}))])})},vL=(e,t,o,n,s)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map((e=>({id:e}))).getOr({}),...s?{"aria-live":"polite"}:{}}},components:[],behaviours:ma([v_(0),ZN.config({channel:`${z_}-${t}`,updateState:(e,t)=>A.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[bL(t,e.initialData,n)]:[eL(t,e.initialData,n)]},initialData:e})])}),yL=Tf.deviceType.isTouch(),xL=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),wL=(e,t)=>uR.parts.close(Lb.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:ma([Ub.config({})])})),SL=()=>uR.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),kL=(e,t)=>uR.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:zb(`${Xv(t.translate(e))}
`)}]}]}),CL=e=>uR.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),OL=(e,t)=>[Pk.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),Pk.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],_L=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",s=t+"__disable-scroll";return uR.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),A.some(!0)),useTabstopAt:e=>!R_(e),firstTabstop:e.firstTabstop,dom:{tag:"div",classes:[t].concat(e.extraClasses),styles:{position:"relative",...e.extraStyles}},components:[e.header,e.body,...e.footer.toArray()],parts:{blocker:{dom:zb(``),components:[{dom:{tag:"div",classes:yL?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:ma([Rh.config({}),Mh("dialog-events",e.dialogEvents.concat([Qr(Zs(),((e,t)=>{HM.isBlocked(e)||xh.focusIn(e)})),Gr(Mr(),((e,t)=>{e.getSystem().broadcastOn([P_],{newFocus:t.event.newFocus})}))])),Mh("scroll-lock",[ea((()=>{ka(wt(),s)})),ta((()=>{Oa(wt(),s)}))]),...e.extraBehaviours]),eventOrder:{[hr()]:["dialog-events"],[_r()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[Tr()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},TL=e=>Lb.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),"data-mce-name":"close"}},buttonBehaviours:ma([Ub.config({}),Qb.config(e.tooltips.getConfig({tooltipText:e.translate("Close")}))]),components:[ry("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{Lr(e,Qk)}}),EL=(e,t,o,n)=>({dom:{tag:"h1",classes:["tox-dialog__title"],attributes:{...o.map((e=>({id:e}))).getOr({})}},components:[],behaviours:ma([ZN.config({channel:`${L_}-${t}`,initialData:e,renderComponents:e=>[ul(n.translate(e.title))]})])}),AL=()=>({dom:zb('')}),ML=(e,t,o)=>((e,t,o)=>{const n=uR.parts.title(EL(e,t,A.none(),o)),s=uR.parts.draghandle(AL()),r=uR.parts.close(TL(o)),a=[n].concat(e.draggable?[s]:[]).concat([r]);return Pk.sketch({dom:zb(''),components:a})})({title:o.shared.providers.translate(e),draggable:o.dialog.isDraggableModal()},t,o.shared.providers),DL=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":o.translate(e)},styles:{left:"0px",right:"0px",bottom:"0px",top:`${n.getOr(0)}px`,position:"absolute"}},behaviours:t,components:[{dom:zb('')}]}),BL=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=_l(e().element,".tox-dialog__header").map((e=>jt(e)));uR.setBusy(e(),((e,s)=>DL(o.message,s,t,n)))},onUnblock:()=>{uR.setIdle(e())}}),IL="tox-dialog--fullscreen",FL="tox-dialog--width-lg",RL="tox-dialog--width-md",NL=e=>{switch(e){case"large":return A.some(FL);case"medium":return A.some(RL);default:return A.none()}},LL=(e,t)=>{const o=Le(t.element.dom);_a(o,IL)||(Ea(o,[FL,RL]),NL(e).each((e=>ka(o,e))))},zL=(e,t)=>{const o=Le(e.element.dom),n=Aa(o),s=j(n,(e=>e===FL||e===RL)).or(NL(t));((e,t)=>{V(t,(t=>{((e,t)=>{const o=ya(e)?e.dom.classList.toggle(t):((e,t)=>F(xa(e),t)?Sa(e,t):wa(e,t))(e,t);Ca(e)})(e,t)}))})(o,[IL,...s.toArray()])},VL=(e,t,o)=>hl(_L({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[k_({}),...e.extraBehaviours],onEscape:e=>{Lr(e,Qk)},dialogEvents:t,eventOrder:{[pr()]:[ZN.name(),gc.name()],[_r()]:["scroll-lock",ZN.name(),"messages","dialog-events","alloy.base.behaviour"],[Tr()]:["alloy.base.behaviour","dialog-events","messages",ZN.name(),"scroll-lock"]}})),HL=(e,t={})=>z(e,(e=>"menu"===e.type?(e=>{const o=z(e.items,(e=>{const o=fe(t,e.name).getOr(on(!1));return{...e,storage:o}}));return{...e,items:o}})(e):e)),PL=e=>W(e,((e,t)=>"menu"===t.type?W(t.items,((e,t)=>(e[t.name]=t.storage,e)),e):e),{}),UL=(e,t)=>[Kr(Zs(),F_),e(Zk,((e,o,n,s)=>{vc(ft(s.element)).fold(b,fc),t.onClose(),o.onClose()})),e(Qk,((e,t,o,n)=>{t.onCancel(e),Lr(n,Zk)})),Gr(nC,((e,o)=>t.onUnblock())),Gr(oC,((e,o)=>t.onBlock(o.event)))],WL=(e,t,o)=>{const n=(t,o)=>Gr(t,((t,n)=>{s(t,((s,r)=>{o(e(),s,n.event,t)}))})),s=(e,t)=>{ZN.getState(e).get().each((o=>{t(o.internalDialog,e)}))};return[...UL(n,t),n(tC,((e,t)=>t.onSubmit(e))),n(Jk,((e,t,o)=>{t.onChange(e,{name:o.name})})),n(eC,((e,t,n,s)=>{const r=()=>s.getSystem().isConnected()?xh.focusIn(s):void 0,a=e=>Et(e,"disabled")||Tt(e,"aria-disabled").exists((e=>"true"===e)),i=ft(s.element),l=vc(i);t.onAction(e,{name:n.name,value:n.value}),vc(i).fold(r,(e=>{a(e)||l.exists((t=>et(e,t)&&a(t)))?r():o().toOptional().filter((t=>!et(t.element,e))).each(r)}))})),n(sC,((e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})})),ta((t=>{const o=e();qu.setValue(t,o.getData())}))]},jL=(e,t)=>{const o=t.map((e=>e.footerButtons)).getOr([]),n=H(o,(e=>"start"===e.align)),s=(e,t)=>Pk.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:z(t,(e=>e.memento.asSpec()))});return[s("start",n.pass),s("end",n.fail)]},$L=(e,t,o)=>({dom:zb(''),components:[],behaviours:ma([ZN.config({channel:`${V_}-${t}`,initialData:e,updateState:(e,t)=>{const n=z(t.buttons,(e=>{const t=Vb(((e,t)=>yE(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}}));return A.some({lookupByName:t=>((e,t,o)=>j(t,(e=>e.name===o)).bind((t=>t.memento.getOpt(e))))(e,n,t),footerButtons:n})},renderComponents:jL})])}),GL=(e,t,o)=>uR.parts.footer($L(e,t,o)),qL=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=eg.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return d_.getField(o,t).orThunk((()=>{const o=e.getFooter().bind((e=>ZN.getState(e).get()));return o.bind((e=>e.lookupByName(t)))}))}return A.none()},YL=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},s={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...qu.getValue(n),...le(o,(e=>e.get()))}},setData:t=>{n((n=>{const r=s.getData(),a=wn(r,t),i=((e,t)=>{const o=e.getRoot();return ZN.getState(o).get().map((e=>Qn(Zn("data",e.dataValidator,t)))).getOr(t)})(e,a),l=e.getFormWrapper();qu.setValue(l,i),ie(o,((e,t)=>{be(a,t)&&e.set(a[t])}))}))},setEnabled:(t,o)=>{qL(e,t).each(o?pg.enable:pg.disable)},focus:t=>{qL(e,t).each(Rh.focus)},block:e=>{if(!r(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n((t=>{zr(t,oC,{message:e})}))},unblock:()=>{n((e=>{Lr(e,nC)}))},showTab:t=>{n((o=>{const n=e.getBody();ZN.getState(n).get().exists((e=>e.isTabPanel()))&&eg.getCurrent(n).each((e=>{uL.showTab(e,t)}))}))},redial:r=>{n((n=>{const a=e.getId(),i=t(r),l=HL(i.internalDialog.buttons,o);n.getSystem().broadcastOn([`${N_}-${a}`],i),n.getSystem().broadcastOn([`${L_}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${z_}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${V_}-${a}`],{...i.internalDialog,buttons:l}),s.setData(i.initialData)}))},close:()=>{n((e=>{Lr(e,Zk)}))},toggleFullscreen:e.toggleFullscreen};return s},XL=(e,t,o,n=!1,s)=>{const r=Bi("dialog"),a=Bi("dialog-label"),i=Bi("dialog-content"),l=e.internalDialog,c=on(l.size),d=NL(c.get()).toArray(),u=Vb(((e,t,o,n)=>Pk.sketch({dom:zb(''),components:[EL(e,t,A.some(o),n),AL(),TL(n)],containerBehaviours:ma([KF.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>Tl(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))({title:l.title,draggable:!0},r,a,o.shared.providers)),m=Vb(((e,t,o,n,s)=>vL(e,t,A.some(o),n,s))({body:l.body,initialData:l.initialData},r,i,o,n)),g=HL(l.buttons),p=PL(g),h=ke(0!==g.length,Vb(((e,t,o)=>$L(e,t,o))({buttons:g},r,o))),f=WL((()=>y),{onBlock:e=>{HM.block(v,((t,n)=>{const s=u.getOpt(v).map((e=>jt(e.element)));return DL(e.message,n,o.shared.providers,s)}))},onUnblock:()=>{HM.unblock(v)},onClose:()=>t.closeWindow()},o.shared.getSink),b=Bo().os,v=hl({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog",...b.isMacOS()?{"aria-label":l.title}:{"aria-labelledby":a}}},eventOrder:{[pr()]:[ZN.name(),gc.name()],[hr()]:["execute-on-form"],[_r()]:["reflecting","execute-on-form"]},behaviours:ma([xh.config({mode:"cyclic",onEscape:e=>(Lr(e,Zk),A.some(!0)),useTabstopAt:e=>!R_(e)&&("button"!==Ue(e)||"disabled"!==_t(e,"disabled")),firstTabstop:1}),ZN.config({channel:`${N_}-${r}`,updateState:(e,t)=>(c.set(t.internalDialog.size),LL(t.internalDialog.size,e),s(),A.some(t)),initialData:e}),Rh.config({}),Mh("execute-on-form",f.concat([Qr(Zs(),((e,t)=>{xh.focusIn(e)})),Gr(Mr(),((e,t)=>{e.getSystem().broadcastOn([P_],{newFocus:t.event.newFocus})}))])),HM.config({getRoot:()=>A.some(v)}),Ah.config({}),k_({})]),components:[u.asSpec(),m.asSpec(),...h.map((e=>e.asSpec())).toArray()]}),y=YL({getId:x(r),getRoot:x(v),getFooter:()=>h.map((e=>e.get(v))),getBody:()=>m.get(v),getFormWrapper:()=>{const e=m.get(v);return eg.getCurrent(e).getOr(e)},toggleFullscreen:()=>{zL(v,c.get())}},t.redial,p);return{dialog:v,instanceApi:y}};var KL=tinymce.util.Tools.resolve("tinymce.util.URI");const JL=["insertContent","setContent","execCommand","close","block","unblock"],ZL=e=>a(e)&&-1!==JL.indexOf(e.mceAction),QL=(e,t,o,n)=>{const s=Bi("dialog"),i=ML(e.title,s,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[B_(A.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:ma([Ub.config({}),Rh.config({})])})]}],behaviours:ma([xh.config({mode:"acyclic",useTabstopAt:C(R_)})])};return uR.parts.body(t)})(e),c=e.buttons.bind((e=>0===e.length?A.none():A.some(GL({buttons:e},s,n)))),u=((e,t)=>{const o=(e,t)=>Gr(e,((e,o)=>{n(e,((n,s)=>{t(x,n,o.event,e)}))})),n=(e,t)=>{ZN.getState(e).get().each((o=>{t(o,e)}))};return[...UL(o,t),o(eC,((e,t,o)=>{t.onAction(e,{name:o.name})}))]})(0,BL((()=>y),n.shared.providers,t)),m={...e.height.fold((()=>({})),(e=>({height:e+"px","max-height":e+"px"}))),...e.width.fold((()=>({})),(e=>({width:e+"px","max-width":e+"px"})))},p=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],h=new KL(e.url,{base_uri:new KL(window.location.href)}),f=`${h.protocol}://${h.host}${h.port?":"+h.port:""}`,b=sn(),v=[ZN.config({channel:`${N_}-${s}`,updateState:(e,t)=>A.some(t),initialData:e}),Mh("messages",[ea((()=>{const t=Fc(Le(window),"message",(t=>{if(h.isSameOrigin(new KL(t.raw.origin))){const n=t.raw.data;ZL(n)?((e,t,o)=>{switch(o.mceAction){case"insertContent":e.insertContent(o.content);break;case"setContent":e.setContent(o.content);break;case"execCommand":const n=!!d(o.ui)&&o.ui;e.execCommand(o.cmd,n,o.value);break;case"close":t.close();break;case"block":t.block(o.message);break;case"unblock":t.unblock()}})(o,x,n):(e=>!ZL(e)&&a(e)&&be(e,"mceAction"))(n)&&e.onMessage(x,n)}}));b.set(t)})),ta(b.clear)]),gc.config({channels:{[H_]:{onReceive:(e,t)=>{_l(e.element,"iframe").each((e=>{const o=e.dom.contentWindow;g(o)&&o.postMessage(t,f)}))}}}})],y=VL({id:s,header:i,body:l,footer:c,extraClasses:p,extraBehaviours:v,extraStyles:m},u,n),x=(e=>{const t=t=>{e.getSystem().isConnected()&&t(e)};return{block:e=>{if(!r(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t((t=>{zr(t,oC,{message:e})}))},unblock:()=>{t((e=>{Lr(e,nC)}))},close:()=>{t((e=>{Lr(e,Zk)}))},sendMessage:e=>{t((t=>{t.getSystem().broadcastOn([H_],e)}))}}})(y);return{dialog:y,instanceApi:x}},ez=(e,t)=>Qn(Zn("data",t,e)),tz=e=>Dk(e,".tox-alert-dialog")||Dk(e,".tox-confirm-dialog"),oz=(e,t,o)=>t&&o?[]:[Ei.config({contextual:{lazyContext:()=>A.some(Zo(Le(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:t=>Rb(e,t.element).map((e=>({bounds:Nb(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Xt(e.element).top})}))).getOrThunk((()=>({bounds:tn(),optScrollEnv:A.none()})))})],nz=e=>{const t=e.editor,o=Eb(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const s=()=>{uR.hide(l),n()},r=Vb(yE({name:"close-alert",text:"OK",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"cancel",e)),a=SL(),i=wL(s,t.providers),l=hl(_L({lazySink:()=>t.getSink(),header:xL(a,i),body:kL(o,t.providers),footer:A.some(CL(OL([],[r.asSpec()]))),onEscape:s,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Gr(Qk,s)],eventOrder:{}}));uR.show(l);const c=r.get(l);Rh.focus(c)}}})(e.backstages.dialog),s=(e=>{const t=e.shared;return{open:(o,n)=>{const s=e=>{uR.hide(c),n(e)},r=Vb(yE({name:"yes",text:"Yes",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"submit",e)),a=yE({name:"no",text:"No",primary:!1,buttonType:A.some("secondary"),align:"end",enabled:!0,icon:A.none()},"cancel",e),i=SL(),l=wL((()=>s(!1)),t.providers),c=hl(_L({lazySink:()=>t.getSink(),header:xL(i,l),body:kL(o,t.providers),footer:A.some(CL(OL([],[a,r.asSpec()]))),onEscape:()=>s(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Gr(Qk,(()=>s(!1))),Gr(tC,(()=>s(!0)))],eventOrder:{}}));uR.show(c);const d=r.get(c);Rh.focus(d)}}})(e.backstages.dialog),r=(t,o)=>YN.open(((t,n,s)=>{const r=n,a=((e,t,o)=>{const n=Bi("dialog"),s=e.internalDialog,r=ML(s.title,n,o),a=on(s.size),i=NL(a.get()).toArray(),l=((e,t,o)=>{const n=vL(e,t,A.none(),o,!1);return uR.parts.body(n)})({body:s.body,initialData:s.initialData},n,o),c=HL(s.buttons),d=PL(c),u=ke(0!==c.length,GL({buttons:c},n,o)),m=WL((()=>f),BL((()=>p),o.shared.providers,t),o.shared.getSink),g={id:n,header:r,body:l,footer:u,extraClasses:i,extraBehaviours:[ZN.config({channel:`${N_}-${n}`,updateState:(e,t)=>(a.set(t.internalDialog.size),LL(t.internalDialog.size,e),A.some(t)),initialData:e})],extraStyles:{}},p=VL(g,m,o),h={getId:x(n),getRoot:x(p),getBody:()=>uR.getBody(p),getFooter:()=>uR.getFooter(p),getFormWrapper:()=>{const e=uR.getBody(p);return eg.getCurrent(e).getOr(e)},toggleFullscreen:()=>{zL(p,a.get())}},f=YL(h,t.redial,d);return{dialog:p,instanceApi:f}})({dataValidator:s,initialData:r,internalDialog:t},{redial:YN.redial,closeWindow:()=>{uR.hide(a.dialog),o(a.instanceApi)}},e.backstages.dialog);return uR.show(a.dialog),a.instanceApi.setData(r),a.instanceApi}),t),a=(n,s,r,a)=>YN.open(((n,i,l)=>{const c=ez(i,l),d=rn(),u=e.backstages.popup.shared.header.isPositionedAtTop(),m=()=>d.on((e=>{wf.reposition(e),o&&u||Ei.refresh(e)})),g=XL({dataValidator:l,initialData:c,internalDialog:n},{redial:YN.redial,closeWindow:()=>{d.on(wf.hide),t.off("ResizeEditor",m),d.clear(),r(g.instanceApi)}},e.backstages.popup,a.ariaAttrs,m),p=hl(wf.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},...u?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ma([Mh("window-manager-inline-events",[Gr(Er(),((e,t)=>{Lr(g.dialog,Qk)}))]),...oz(t,o,u)]),isExtraPart:(e,t)=>tz(t)}));return d.set(p),wf.showWithinBounds(p,fl(g.dialog),{anchor:s},(()=>{const e=t.inline?wt():Le(t.getContainer()),o=Zo(e);return A.some(o)})),o&&u||(Ei.refresh(p),t.on("ResizeEditor",m)),g.instanceApi.setData(c),xh.focusIn(g.dialog),g.instanceApi}),n),i=(o,n,s,r)=>YN.open(((o,a,i)=>{const l=ez(a,i),c=rn(),d=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>c.on((e=>{wf.reposition(e),Ei.refresh(e)})),m=XL({dataValidator:i,initialData:l,internalDialog:o},{redial:YN.redial,closeWindow:()=>{c.on(wf.hide),t.off("ResizeEditor ScrollWindow ElementScroll",u),c.clear(),s(m.instanceApi)}},e.backstages.popup,r.ariaAttrs,u),g=hl(wf.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:r.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ma([Mh("window-manager-inline-events",[Gr(Er(),((e,t)=>{Lr(m.dialog,Qk)}))]),Ei.config({contextual:{lazyContext:()=>A.some(Zo(Le(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>Rb(t,e.element).map((e=>({bounds:Nb(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Xt(e.element).top})}))).getOrThunk((()=>({bounds:tn(),optScrollEnv:A.none()})))})]),isExtraPart:(e,t)=>tz(t)}));return c.set(g),wf.showWithinBounds(g,fl(m.dialog),{anchor:n},(()=>e.backstages.popup.shared.getSink().toOptional().bind((e=>{const o=Rb(t,e.element).map((e=>Nb(e))).getOr(tn()),n=Zo(Le(t.getContentAreaContainer())),s=en(n,o);return A.some(Jo(s.x,s.y,s.width,s.height-15))})))),Ei.refresh(g),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",u),m.instanceApi.setData(l),xh.focusIn(m.dialog),m.instanceApi}),o);return{open:(t,o,n)=>{if(!u(o)){if("toolbar"===o.inline)return a(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return i(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return a(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return r(t,n)},openUrl:(o,n)=>((o,n)=>YN.openUrl((o=>{const s=QL(o,{closeWindow:()=>{uR.hide(s.dialog),n(s.instanceApi)}},t,e.backstages.dialog);return uR.show(s.dialog),s.instanceApi}),o))(o,n),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{s.open(e,t)}}};an.add("silver",(e=>{(e=>{Mf(e),(e=>{const t=e.options.register,o=e=>f(e,r)?{value:yS(e),valid:!0}:{valid:!1,message:"Must be an array of strings."},n=e=>h(e)&&e>0?{value:e,valid:!0}:{valid:!1,message:"Must be a positive number."};t("color_map",{processor:o,default:["#BFEDD2","Light Green","#FBEEB8","Light Yellow","#F8CAC6","Light Red","#ECCAFA","Light Purple","#C2E0F4","Light Blue","#2DC26B","Green","#F1C40F","Yellow","#E03E2D","Red","#B96AD9","Purple","#3598DB","Blue","#169179","Dark Turquoise","#E67E23","Orange","#BA372A","Dark Red","#843FA1","Dark Purple","#236FA1","Dark Blue","#ECF0F1","Light Gray","#CED4D9","Medium Gray","#95A5A6","Gray","#7E8C8D","Dark Gray","#34495E","Navy Blue","#000000","Black","#ffffff","White"]}),t("color_map_background",{processor:o}),t("color_map_foreground",{processor:o}),t("color_cols",{processor:n,default:kS(e)}),t("color_cols_foreground",{processor:n,default:CS(e,bS)}),t("color_cols_background",{processor:n,default:CS(e,vS)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:wS}),t("color_default_background",{processor:"string",default:wS})})(e),(e=>{const t=e.options.register;t("contextmenu_avoid_overlap",{processor:"string",default:""}),t("contextmenu_never_use_native",{processor:"boolean",default:!1}),t("contextmenu",{processor:e=>!1===e?{value:[],valid:!0}:r(e)||f(e,r)?{value:jI(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)})(e);let t=()=>tn();const{dialogs:o,popups:n,renderUI:s}=iR(e,{getPopupSinkBounds:()=>t()});Mk(e,n.backstage.shared);const a=nz({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}}),i=rn();return{renderUI:()=>{const o=s();return Rb(e,n.getMothership().element).each((e=>{t=()=>Nb(e)})),o},getWindowManagerImpl:x(a),getNotificationManagerImpl:()=>ly(e,{backstage:n.backstage},n.getMothership(),i)}}))}();
\ No newline at end of file
diff --git a/resources/tinymce/7.1.1/tinymce.min.jsm b/resources/tinymce/7.1.1/tinymce.min.jsm
deleted file mode 100644
index e8ada938..00000000
--- a/resources/tinymce/7.1.1/tinymce.min.jsm
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * TinyMCE version 7.1.1 (2024-05-22)
- */
-!function(){"use strict";var e=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},t=function(e){return{eq:e}},n=t((function(e,t){return e===t})),o=function(e){return t((function(t,n){if(t.length!==n.length)return!1;for(var o=t.length,r=0;r{var o;return!!n(e,t.prototype)||(null===(o=e.constructor)||void 0===o?void 0:o.name)===t.name},l=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&i(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,d=e=>t=>typeof t===e,c=e=>t=>e===t,u=(e,t)=>f(e)&&i(e,t,((e,t)=>a(e)===t)),m=l("string"),f=l("object"),g=e=>u(e,Object),p=l("array"),h=c(null),b=d("boolean"),v=c(void 0),y=e=>null==e,C=e=>!y(e),w=d("function"),x=d("number"),E=(e,t)=>{if(p(e)){for(let n=0,o=e.length;n{},_=(e,t)=>(...n)=>e(t.apply(null,n)),S=(e,t)=>n=>e(t(n)),N=e=>()=>e,R=e=>e,A=(e,t)=>e===t;function T(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}const O=e=>t=>!e(t),B=e=>()=>{throw new Error(e)},P=e=>e(),D=e=>{e()},L=N(!1),M=N(!0);class I{constructor(e,t){this.tag=e,this.value=t}static some(e){return new I(!0,e)}static none(){return I.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?I.some(e(this.value)):I.none()}bind(e){return this.tag?e(this.value):I.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:I.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)?I.some(e):I.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()"}}I.singletonNone=new I(!1);const F=Array.prototype.slice,U=Array.prototype.indexOf,z=Array.prototype.push,j=(e,t)=>U.call(e,t),H=(e,t)=>j(e,t)>-1,$=(e,t)=>{for(let n=0,o=e.length;n{const n=e.length,o=new Array(n);for(let r=0;r{for(let n=0,o=e.length;n{for(let n=e.length-1;n>=0;n--)t(e[n],n)},K=(e,t)=>{const n=[],o=[];for(let r=0,s=e.length;r{const n=[];for(let o=0,r=e.length;o(W(e,((e,o)=>{n=t(n,e,o)})),n),X=(e,t,n)=>(q(e,((e,o)=>{n=t(n,e,o)})),n),Z=(e,t,n)=>{for(let o=0,r=e.length;oZ(e,t,L),J=(e,t)=>{for(let n=0,o=e.length;n{const t=[];for(let n=0,o=e.length;nee(V(e,t)),ne=(e,t)=>{for(let n=0,o=e.length;n{const t=F.call(e,0);return t.reverse(),t},re=(e,t)=>Y(e,(e=>!H(t,e))),se=(e,t)=>{const n={};for(let o=0,r=e.length;o{const n=F.call(e,0);return n.sort(t),n},ie=(e,t)=>t>=0&&tie(e,0),de=e=>ie(e,e.length-1),ce=w(Array.from)?Array.from:e=>F.call(e),ue=(e,t)=>{for(let n=0;n{const n=[],o=w(t)?e=>$(n,(n=>t(n,e))):e=>H(n,e);for(let t=0,r=e.length;t{const n=fe(e);for(let o=0,r=n.length;obe(e,((e,n)=>({k:n,v:t(e,n)}))),be=(e,t)=>{const n={};return pe(e,((e,o)=>{const r=t(e,o);n[r.k]=r.v})),n},ve=e=>(t,n)=>{e[n]=t},ye=(e,t,n,o)=>{pe(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))},Ce=(e,t)=>{const n={};return ye(e,t,ve(n),k),n},we=(e,t)=>{const n=[];return pe(e,((e,o)=>{n.push(t(e,o))})),n},xe=e=>we(e,R),Ee=(e,t)=>ke(e,t)?I.from(e[t]):I.none(),ke=(e,t)=>ge.call(e,t),_e=(e,t)=>ke(e,t)&&void 0!==e[t]&&null!==e[t],Se=e=>{const t={};return q(e,(e=>{t[e]={}})),fe(t)},Ne=e=>void 0!==e.length,Re=Array.isArray,Ae=(e,t,n)=>{if(!e)return!1;if(n=n||e,Ne(e)){for(let o=0,r=e.length;o{const n=[];return Ae(e,((o,r)=>{n.push(t(o,r,e))})),n},Oe=(e,t)=>{const n=[];return Ae(e,((o,r)=>{t&&!t(o,r,e)||n.push(o)})),n},Be=(e,t,n,o)=>{let r=v(n)?e[0]:n;for(let n=0;n{for(let o=0,r=e.length;oe[e.length-1],Le=e=>{let t,n=!1;return(...o)=>(n||(n=!0,t=e.apply(null,o)),t)},Me=()=>Ie(0,0),Ie=(e,t)=>({major:e,minor:t}),Fe={nu:Ie,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?Me():((e,t)=>{const n=((e,t)=>{for(let n=0;nNumber(t.replace(n,"$"+e));return Ie(o(1),o(2))})(e,n)},unknown:Me},Ue=(e,t)=>{const n=String(t).toLowerCase();return Q(e,(e=>e.search(n)))},ze=(e,t,n)=>""===t||e.length>=t.length&&e.substr(n,n+t.length)===t,je=(e,t)=>$e(e,t)?((e,t)=>e.substring(t))(e,t.length):e,He=(e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!v(o)||r+t.length<=o)},$e=(e,t)=>ze(e,t,0),Ve=(e,t)=>ze(e,t,e.length-t.length),qe=e=>t=>t.replace(e,""),We=qe(/^\s+|\s+$/g),Ke=qe(/^\s+/g),Ye=qe(/\s+$/g),Ge=e=>e.length>0,Xe=e=>!Ge(e),Ze=(e,t=10)=>{const n=parseInt(e,t);return isNaN(n)?I.none():I.some(n)},Qe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Je=e=>t=>He(t,e),et=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>He(e,"edge/")&&He(e,"chrome")&&He(e,"safari")&&He(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Qe],search:e=>He(e,"chrome")&&!He(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>He(e,"msie")||He(e,"trident")},{name:"Opera",versionRegexes:[Qe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Je("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Je("firefox")},{name:"Safari",versionRegexes:[Qe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(He(e,"safari")||He(e,"mobile/"))&&He(e,"applewebkit")}],tt=[{name:"Windows",search:Je("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>He(e,"iphone")||He(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Je("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Je("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Je("linux"),versionRegexes:[]},{name:"Solaris",search:Je("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Je("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Je("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],nt={browsers:N(et),oses:N(tt)},ot="Edge",rt="Chromium",st="Opera",at="Firefox",it="Safari",lt=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isEdge:o(ot),isChromium:o(rt),isIE:o("IE"),isOpera:o(st),isFirefox:o(at),isSafari:o(it)}},dt=()=>lt({current:void 0,version:Fe.unknown()}),ct=lt,ut=(N(ot),N(rt),N("IE"),N(st),N(at),N(it),"Windows"),mt="Android",ft="Linux",gt="macOS",pt="Solaris",ht="FreeBSD",bt="ChromeOS",vt=e=>{const t=e.current,n=e.version,o=e=>()=>t===e;return{current:t,version:n,isWindows:o(ut),isiOS:o("iOS"),isAndroid:o(mt),isMacOS:o(gt),isLinux:o(ft),isSolaris:o(pt),isFreeBSD:o(ht),isChromeOS:o(bt)}},yt=()=>vt({current:void 0,version:Fe.unknown()}),Ct=vt,wt=(N(ut),N("iOS"),N(mt),N(ft),N(gt),N(pt),N(ht),N(bt),e=>window.matchMedia(e).matches);let xt=Le((()=>((e,t,n)=>{const o=nt.browsers(),r=nt.oses(),s=t.bind((e=>((e,t)=>ue(t.brands,(t=>{const n=t.brand.toLowerCase();return Q(e,(e=>{var t;return n===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:Fe.nu(parseInt(t.version,10),0)})))})))(o,e))).orThunk((()=>((e,t)=>Ue(e,t).map((e=>{const n=Fe.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e))).fold(dt,ct),a=((e,t)=>Ue(e,t).map((e=>{const n=Fe.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e).fold(yt,Ct),i=((e,t,n,o)=>{const r=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||o("(pointer:coarse)"),l=r||!s&&a&&o("(min-device-width:768px)"),d=s||a&&!l,c=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),u=!d&&!l&&!c;return{isiPad:N(r),isiPhone:N(s),isTablet:N(l),isPhone:N(d),isTouch:N(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:N(c),isDesktop:N(u)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}})(navigator.userAgent,I.from(navigator.userAgentData),wt)));const Et=()=>xt(),kt=navigator.userAgent,_t=Et(),St=_t.browser,Nt=_t.os,Rt=_t.deviceType,At=-1!==kt.indexOf("Windows Phone"),Tt={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:St.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!St.isIE(),windowsPhone:At,browser:{current:St.current,version:St.version,isChromium:St.isChromium,isEdge:St.isEdge,isFirefox:St.isFirefox,isIE:St.isIE,isOpera:St.isOpera,isSafari:St.isSafari},os:{current:Nt.current,version:Nt.version,isAndroid:Nt.isAndroid,isChromeOS:Nt.isChromeOS,isFreeBSD:Nt.isFreeBSD,isiOS:Nt.isiOS,isLinux:Nt.isLinux,isMacOS:Nt.isMacOS,isSolaris:Nt.isSolaris,isWindows:Nt.isWindows},deviceType:{isDesktop:Rt.isDesktop,isiPad:Rt.isiPad,isiPhone:Rt.isiPhone,isPhone:Rt.isPhone,isTablet:Rt.isTablet,isTouch:Rt.isTouch,isWebView:Rt.isWebView}},Ot=/^\s*|\s*$/g,Bt=e=>y(e)?"":(""+e).replace(Ot,""),Pt=function(e,t,n,o){o=o||this,e&&(n&&(e=e[n]),Ae(e,((e,r)=>!1!==t.call(o,e,r,n)&&(Pt(e,t,n,o),!0))))},Dt={trim:Bt,isArray:Re,is:(e,t)=>t?!("array"!==t||!Re(e))||typeof e===t:void 0!==e,toArray:e=>{if(Re(e))return e;{const t=[];for(let n=0,o=e.length;n{const o=m(e)?e.split(t||","):e||[];let r=o.length;for(;r--;)n[o[r]]={};return n},each:Ae,map:Te,grep:Oe,inArray:(e,t)=>{if(e)for(let n=0,o=e.length;n{for(let n=0;n{const n=e.split(".");for(let e=0,o=n.length;ep(e)?e:""===e?[]:Te(e.split(t||","),Bt),_addCacheSuffix:e=>{const t=Tt.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},Lt=(e,t,n=A)=>e.exists((e=>n(e,t))),Mt=(e,t,n=A)=>It(e,t,n).getOr(e.isNone()&&t.isNone()),It=(e,t,n)=>e.isSome()&&t.isSome()?I.some(n(e.getOrDie(),t.getOrDie())):I.none(),Ft=(e,t)=>e?I.some(t):I.none(),Ut="undefined"!=typeof window?window:Function("return this;")(),zt=(e,t)=>((e,t)=>{let n=null!=t?t:Ut;for(let t=0;t{const t=zt("ownerDocument.defaultView",e);return f(e)&&((e=>((e,t)=>{const n=((e,t)=>zt(e,t))(e,t);if(null==n)throw new Error(e+" not available on this browser");return n})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(jt(e).constructor.name))},$t=e=>e.dom.nodeName.toLowerCase(),Vt=e=>e.dom.nodeType,qt=e=>t=>Vt(t)===e,Wt=e=>Kt(e)&&Ht(e.dom),Kt=qt(1),Yt=qt(3),Gt=qt(9),Xt=qt(11),Zt=e=>t=>Kt(t)&&$t(t)===e,Qt=(e,t,n)=>{if(!(m(n)||b(n)||x(n)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},Jt=(e,t,n)=>{Qt(e.dom,t,n)},en=(e,t)=>{const n=e.dom;pe(t,((e,t)=>{Qt(n,t,e)}))},tn=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},nn=(e,t)=>I.from(tn(e,t)),on=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},rn=(e,t)=>{e.dom.removeAttribute(t)},sn=e=>X(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}),an=(e,t)=>{const n=tn(e,t);return void 0===n||""===n?[]:n.split(" ")},ln=e=>void 0!==e.dom.classList,dn=e=>an(e,"class"),cn=(e,t)=>((e,t,n)=>{const o=an(e,t).concat([n]);return Jt(e,t,o.join(" ")),!0})(e,"class",t),un=(e,t)=>((e,t,n)=>{const o=Y(an(e,t),(e=>e!==n));return o.length>0?Jt(e,t,o.join(" ")):rn(e,t),!1})(e,"class",t),mn=(e,t)=>{ln(e)?e.dom.classList.add(t):cn(e,t)},fn=e=>{0===(ln(e)?e.dom.classList:dn(e)).length&&rn(e,"class")},gn=(e,t)=>{ln(e)?e.dom.classList.remove(t):un(e,t),fn(e)},pn=(e,t)=>ln(e)&&e.dom.classList.contains(t),hn=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},bn=(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return hn(n.childNodes[0])},vn=(e,t)=>{const n=(t||document).createElement(e);return hn(n)},yn=(e,t)=>{const n=(t||document).createTextNode(e);return hn(n)},Cn=hn,wn=(e,t,n)=>I.from(e.dom.elementFromPoint(t,n)).map(hn),xn=(e,t)=>{const n=[],o=e=>(n.push(e),t(e));let r=t(e);do{r=r.bind(o)}while(r.isSome());return n},En=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;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")}},kn=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,_n=(e,t)=>e.dom===t.dom,Sn=(e,t)=>{const n=e.dom,o=t.dom;return n!==o&&n.contains(o)},Nn=e=>Cn(e.dom.ownerDocument),Rn=e=>Gt(e)?e:Nn(e),An=e=>Cn(Rn(e).dom.defaultView),Tn=e=>I.from(e.dom.parentNode).map(Cn),On=e=>I.from(e.dom.parentElement).map(Cn),Bn=(e,t)=>{const n=w(t)?t:L;let o=e.dom;const r=[];for(;null!==o.parentNode&&void 0!==o.parentNode;){const e=o.parentNode,t=Cn(e);if(r.push(t),!0===n(t))break;o=e}return r},Pn=e=>I.from(e.dom.previousSibling).map(Cn),Dn=e=>I.from(e.dom.nextSibling).map(Cn),Ln=e=>oe(xn(e,Pn)),Mn=e=>xn(e,Dn),In=e=>V(e.dom.childNodes,Cn),Fn=(e,t)=>{const n=e.dom.childNodes;return I.from(n[t]).map(Cn)},Un=e=>Fn(e,0),zn=e=>Fn(e,e.dom.childNodes.length-1),jn=e=>e.dom.childNodes.length,Hn=e=>Xt(e)&&C(e.dom.host),$n=w(Element.prototype.attachShadow)&&w(Node.prototype.getRootNode),Vn=N($n),qn=$n?e=>Cn(e.dom.getRootNode()):Rn,Wn=e=>Hn(e)?e:(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return Cn(t)})(Rn(e)),Kn=e=>Cn(e.dom.host),Yn=e=>{if(Vn()&&C(e.target)){const t=Cn(e.target);if(Kt(t)&&Gn(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return le(t)}}return I.from(e.target)},Gn=e=>C(e.dom.shadowRoot),Xn=e=>{const t=Yt(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=qn(e);return Hn(t)?I.some(t):I.none()})(Cn(t)).fold((()=>n.body.contains(t)),S(Xn,Kn))};var Zn=(e,t,n,o,r)=>e(n,o)?I.some(n):w(r)&&r(n)?I.none():t(n,o,r);const Qn=(e,t,n)=>{let o=e.dom;const r=w(n)?n:L;for(;o.parentNode;){o=o.parentNode;const e=Cn(o);if(t(e))return I.some(e);if(r(e))break}return I.none()},Jn=(e,t,n)=>Zn(((e,t)=>t(e)),Qn,e,t,n),eo=(e,t)=>{const n=e=>{for(let o=0;oQn(e,(e=>En(e,t)),n),no=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return kn(n)?I.none():I.from(n.querySelector(e)).map(Cn)})(t,e),oo=(e,t,n)=>Zn(((e,t)=>En(e,t)),to,e,t,n),ro=(e,t=!1)=>{return Xn(e)?e.dom.isContentEditable:(n=e,oo(n,"[contenteditable]")).fold(N(t),(e=>"true"===so(e)));var n},so=e=>e.dom.contentEditable,ao=e=>void 0!==e.style&&w(e.style.getPropertyValue),io=(e,t,n)=>{if(!m(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);ao(e)&&e.style.setProperty(t,n)},lo=(e,t,n)=>{const o=e.dom;io(o,t,n)},co=(e,t)=>{const n=e.dom;pe(t,((e,t)=>{io(n,t,e)}))},uo=(e,t)=>{const n=e.dom,o=window.getComputedStyle(n).getPropertyValue(t);return""!==o||Xn(e)?o:mo(n,t)},mo=(e,t)=>ao(e)?e.style.getPropertyValue(t):"",fo=(e,t)=>{const n=e.dom,o=mo(n,t);return I.from(o).filter((e=>e.length>0))},go=e=>{const t={},n=e.dom;if(ao(n))for(let e=0;e{((e,t)=>{ao(e)&&e.style.removeProperty(t)})(e.dom,t),Lt(nn(e,"style").map(We),"")&&rn(e,"style")},ho=(e,t)=>{Tn(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},bo=(e,t)=>{Dn(e).fold((()=>{Tn(e).each((e=>{yo(e,t)}))}),(e=>{ho(e,t)}))},vo=(e,t)=>{Un(e).fold((()=>{yo(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},yo=(e,t)=>{e.dom.appendChild(t.dom)},Co=(e,t)=>{ho(e,t),yo(t,e)},wo=(e,t)=>{q(t,(t=>{yo(e,t)}))},xo=e=>{e.dom.textContent="",q(In(e),(e=>{Eo(e)}))},Eo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},ko=e=>{const t=In(e);var n,o;t.length>0&&(n=e,q(o=t,((e,t)=>{const r=0===t?n:o[t-1];bo(r,e)}))),Eo(e)},_o=e=>V(e,Cn),So=e=>e.dom.innerHTML,No=(e,t)=>{const n=Nn(e).dom,o=Cn(n.createDocumentFragment()),r=((e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,In(Cn(n))})(t,n);wo(o,r),xo(e),yo(e,o)},Ro=(e,t,n,o)=>((e,t,n,o,r)=>{const s=((e,t)=>n=>{e(n)&&t((e=>{const t=Cn(Yn(e).getOr(e.target)),n=()=>e.stopPropagation(),o=()=>e.preventDefault(),r=_(o,n);return((e,t,n,o,r,s,a)=>({target:e,x:t,y:n,stop:o,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,n,o,r,e)})(n))})(n,o);return e.dom.addEventListener(t,s,false),{unbind:T(Ao,e,t,s,false)}})(e,t,n,o),Ao=(e,t,n,o)=>{e.dom.removeEventListener(t,n,o)},To=(e,t)=>({left:e,top:t,translate:(n,o)=>To(e+n,t+o)}),Oo=To,Bo=(e,t)=>void 0!==e?e:void 0!==t?t:0,Po=e=>{const t=e.dom,n=t.ownerDocument.body;return n===t?Oo(n.offsetLeft,n.offsetTop):Xn(e)?(e=>{const t=e.getBoundingClientRect();return Oo(t.left,t.top)})(t):Oo(0,0)},Do=e=>{const t=void 0!==e?e.dom:document,n=t.body.scrollLeft||t.documentElement.scrollLeft,o=t.body.scrollTop||t.documentElement.scrollTop;return Oo(n,o)},Lo=(e,t,n)=>{const o=(void 0!==n?n.dom:document).defaultView;o&&o.scrollTo(e,t)},Mo=(e,t)=>{Et().browser.isSafari()&&w(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},Io=(e,t,n,o)=>({x:e,y:t,width:n,height:o,right:e+n,bottom:t+o}),Fo=e=>{const t=void 0===e?window:e,n=t.document,o=Do(Cn(n));return(e=>{const t=void 0===e?window:e;return Et().browser.isFirefox()?I.none():I.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,n=e.clientWidth,r=e.clientHeight;return Io(o.left,o.top,n,r)}),(e=>Io(Math.max(e.pageLeft,o.left),Math.max(e.pageTop,o.top),e.width,e.height)))},Uo=(e,t)=>{let n=[];return q(In(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(Uo(e,t))})),n},zo=(e,t)=>((e,t)=>{const n=void 0===t?document:t.dom;return kn(n)?[]:V(n.querySelectorAll(e),Cn)})(t,e),jo=(e,t,n)=>Qn(e,t,n).isSome(),Ho=(e,t)=>((e,t)=>{const n=e.dom;return n.parentNode?((e,t)=>Q(e.dom.childNodes,(e=>t(Cn(e)))).map(Cn))(Cn(n.parentNode),(n=>!_n(e,n)&&t(n))):I.none()})(e,t).isSome(),$o=(e,t)=>eo(e,t).isSome();class Vo{constructor(e,t){this.node=e,this.rootNode=t,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}current(){return this.node}next(e){return this.node=this.findSibling(this.node,"firstChild","nextSibling",e),this.node}prev(e){return this.node=this.findSibling(this.node,"lastChild","previousSibling",e),this.node}prev2(e){return this.node=this.findPreviousNode(this.node,e),this.node}findSibling(e,t,n,o){if(e){if(!o&&e[t])return e[t];if(e!==this.rootNode){let t=e[n];if(t)return t;for(let o=e.parentNode;o&&o!==this.rootNode;o=o.parentNode)if(t=o[n],t)return t}}}findPreviousNode(e,t){if(e){const n=e.previousSibling;if(this.rootNode&&n===this.rootNode)return;if(n){if(!t)for(let e=n.lastChild;e;e=e.lastChild)if(!e.lastChild)return e;return n}const o=e.parentNode;if(o&&o!==this.rootNode)return o}}}const qo="\ufeff",Wo="\xa0",Ko=e=>e===qo,Yo=/^[ \t\r\n]*$/,Go=e=>Yo.test(e),Xo=e=>"\n"===e||"\r"===e,Zo=(e,t=4,n=!0,o=!0)=>{const r=((e,t)=>t<=0?"":new Array(t+1).join(" "))(0,t),s=e.replace(/\t/g,r),a=X(s,((e,t)=>(e=>-1!==" \f\t\v".indexOf(e))(t)||t===Wo?e.pcIsSpace||""===e.str&&n||e.str.length===s.length-1&&o||((e,t)=>t=0&&Xo(e[t]))(s,e.str.length+1)?{pcIsSpace:!1,str:e.str+Wo}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:Xo(t),str:e.str+t}),{pcIsSpace:!1,str:""});return a.str},Qo=e=>t=>!!t&&t.nodeType===e,Jo=e=>!!e&&!Object.getPrototypeOf(e),er=Qo(1),tr=e=>er(e)&&Wt(Cn(e)),nr=e=>{const t=e.toLowerCase();return e=>C(e)&&e.nodeName.toLowerCase()===t},or=e=>{const t=e.map((e=>e.toLowerCase()));return e=>{if(e&&e.nodeName){const n=e.nodeName.toLowerCase();return H(t,n)}return!1}},rr=(e,t)=>{const n=t.toLowerCase().split(" ");return t=>{if(er(t)){const o=t.ownerDocument.defaultView;if(o)for(let r=0;rer(e)&&e.hasAttribute("data-mce-bogus"),ar=e=>er(e)&&"TABLE"===e.tagName,ir=e=>t=>{if(tr(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},lr=or(["textarea","input"]),dr=Qo(3),cr=Qo(4),ur=Qo(7),mr=Qo(8),fr=Qo(9),gr=Qo(11),pr=nr("br"),hr=nr("img"),br=ir("true"),vr=ir("false"),yr=or(["td","th"]),Cr=or(["td","th","caption"]),wr=or(["video","audio","object","embed"]),xr=nr("li"),Er=nr("details"),kr=nr("summary"),_r={skipBogus:!0,includeZwsp:!1,checkRootAsContent:!1},Sr=("data-mce-bookmark",e=>er(e)&&e.hasAttribute("data-mce-bookmark"));const Nr=(e,t,n,o)=>dr(e)&&!((e,t,n)=>Go(e.data)&&!((e,t,n)=>{const o=Cn(t),r=Cn(e),s=n.getWhitespaceElements();return jo(r,(e=>ke(s,$t(e))),T(_n,o))})(e,t,n))(e,t,n)&&(!o.includeZwsp||!(e=>{for(const t of e)if(!Ko(t))return!1;return!0})(e.data)),Rr=(e,t,n,o)=>w(o.isContent)&&o.isContent(t)||((e,t)=>er(e)&&ke(t.getNonEmptyElements(),e.nodeName))(t,e)||Sr(t)||(e=>er(e)&&"A"===e.nodeName&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")))(t)||Nr(t,n,e,o)||vr(t)||br(t)&&(e=>On(Cn(e)).exists((e=>!ro(e))))(t),Ar=(e,t,n)=>{const o={..._r,...n};if(o.checkRootAsContent&&Rr(e,t,t,o))return!1;let r=t.firstChild,s=0;if(!r)return!0;const a=new Vo(r,t);do{if(o.skipBogus&&er(r)){const e=r.getAttribute("data-mce-bogus");if(e){r=a.next("all"===e);continue}}if(mr(r))r=a.next(!0);else if(pr(r))s++,r=a.next();else{if(Rr(e,r,t,o))return!1;r=a.next()}}while(r);return s<=1},Tr=(e,t,n)=>Ar(e,t.dom,{checkRootAsContent:!0,...n}),Or=(e,t,n)=>Rr(e,t,t,{includeZwsp:_r.includeZwsp,...n}),Br=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Pr=e=>{const t=Br(I.none()),n=()=>t.get().each((e=>clearInterval(e)));return{clear:()=>{n(),t.set(I.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:o=>{n(),t.set(I.some(setInterval(o,e)))}}},Dr=()=>{const e=(e=>{const t=Br(I.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(I.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(I.some(e))}}})(k);return{...e,on:t=>e.get().each(t)}},Lr=e=>{const t=e.toLowerCase();return"svg"===t?"svg":"math"===t?"math":"html"},Mr=e=>"html"!==Lr(e),Ir=e=>Mr(e.nodeName),Fr=e=>Lr(e.nodeName),Ur=["svg","math"],zr="data-mce-block",jr=e=>V((e=>Y(fe(e),(e=>!/[A-Z]/.test(e))))(e),(e=>{const t=CSS.escape(e);return`${t}:`+V(Ur,(e=>`not(${e} ${t})`)).join(":")})).join(","),Hr=(e,t)=>C(t.querySelector(e))?(t.setAttribute(zr,"true"),"inline-boundary"===t.getAttribute("data-mce-selected")&&t.removeAttribute("data-mce-selected"),!0):(t.removeAttribute(zr),!1),$r=(e,t)=>{const n=jr(e.getTransparentElements()),o=jr(e.getBlockElements());return Y(t.querySelectorAll(n),(e=>Hr(o,e)))},Vr=(e,t,n)=>{var o;const r=n?"lastChild":"firstChild";for(let n=t[r];n;n=n[r])if(Ar(e,n,{checkRootAsContent:!0}))return void(null===(o=n.parentNode)||void 0===o||o.removeChild(n))},qr=(e,t,n)=>{const o=e.getBlockElements(),r=Cn(t),s=e=>$t(e)in o,a=e=>_n(e,r);q(_o(n),(t=>{Qn(t,s,a).each((n=>{const o=((t,o)=>Y(In(t),(t=>s(t)&&!e.isValidChild($t(n),$t(t)))))(t);if(o.length>0){const t=On(n);q(o,(t=>{Qn(t,s,a).each((n=>{((e,t,n)=>{const o=document.createRange(),r=t.parentNode;if(r){o.setStartBefore(t),o.setEndBefore(n);const s=o.extractContents();Vr(e,s,!0),o.setStartAfter(n),o.setEndAfter(t);const a=o.extractContents();Vr(e,a,!1),Ar(e,s,{checkRootAsContent:!0})||r.insertBefore(s,t),Ar(e,n,{checkRootAsContent:!0})||r.insertBefore(n,t),Ar(e,a,{checkRootAsContent:!0})||r.insertBefore(a,t),r.removeChild(t)}})(e,n.dom,t.dom)}))})),t.each((t=>$r(e,t.dom)))}}))}))},Wr=(e,t)=>{const n=$r(e,t);qr(e,t,n),((e,t,n)=>{q([...n,...Zr(e,t)?[t]:[]],(t=>q(zo(Cn(t),t.nodeName.toLowerCase()),(t=>{Qr(e,t.dom)&&ko(t)}))))})(e,t,n)},Kr=(e,t)=>{if(Xr(e,t)){const n=jr(e.getBlockElements());Hr(n,t)}},Yr=e=>e.hasAttribute(zr),Gr=(e,t)=>ke(e.getTransparentElements(),t),Xr=(e,t)=>er(t)&&Gr(e,t.nodeName),Zr=(e,t)=>Xr(e,t)&&Yr(t),Qr=(e,t)=>Xr(e,t)&&!Yr(t),Jr=(e,t)=>1===t.type&&Gr(e,t.name)&&m(t.attr(zr)),es=Et().browser,ts=e=>Q(e,Kt),ns=(e,t)=>e.children&&H(e.children,t),os=(e,t={})=>{let n=0;const o={},r=Cn(e),s=Rn(r),a=e=>{yo(Wn(r),e)},i=e=>{const t=Wn(r);no(t,"#"+e).each(Eo)},l=e=>Ee(o,e).getOrThunk((()=>({id:"mce-u"+n++,passed:[],failed:[],count:0}))),d=e=>new Promise(((n,r)=>{let i;const d=Dt._addCacheSuffix(e),c=l(d);o[d]=c,c.count++;const u=(e,t)=>{q(e,D),c.status=t,c.passed=[],c.failed=[],i&&(i.onload=null,i.onerror=null,i=null)},m=()=>u(c.passed,2),f=()=>u(c.failed,3);if(n&&c.passed.push(n),r&&c.failed.push(r),1===c.status)return;if(2===c.status)return void m();if(3===c.status)return void f();c.status=1;const g=vn("link",s.dom);en(g,{rel:"stylesheet",type:"text/css",id:c.id}),t.contentCssCors&&Jt(g,"crossOrigin","anonymous"),t.referrerPolicy&&Jt(g,"referrerpolicy",t.referrerPolicy),i=g.dom,i.onload=m,i.onerror=f,a(g),Jt(g,"href",d)})),c=e=>{const t=Dt._addCacheSuffix(e);Ee(o,t).each((e=>{0==--e.count&&(delete o[t],i(e.id))}))};return{load:d,loadRawCss:(e,t)=>{const n=l(e);o[e]=n,n.count++;const r=vn("style",s.dom);en(r,{rel:"stylesheet",type:"text/css",id:n.id}),r.dom.innerHTML=t,a(r)},loadAll:e=>Promise.allSettled(V(e,(e=>d(e).then(N(e))))).then((e=>{const t=K(e,(e=>"fulfilled"===e.status));return t.fail.length>0?Promise.reject(V(t.fail,(e=>e.reason))):V(t.pass,(e=>e.value))})),unload:c,unloadRawCss:e=>{Ee(o,e).each((t=>{0==--t.count&&(delete o[e],i(t.id))}))},unloadAll:e=>{q(e,(e=>{c(e)}))},_setReferrerPolicy:e=>{t.referrerPolicy=e},_setContentCssCors:e=>{t.contentCssCors=e}}},rs=(()=>{const e=new WeakMap;return{forElement:(t,n)=>{const o=qn(t).dom;return I.from(e.get(o)).getOrThunk((()=>{const t=os(o,n);return e.set(o,t),t}))}}})(),ss=(e,t)=>C(e)&&(Or(t,e)||t.isInline(e.nodeName.toLowerCase())),as=e=>(e=>"span"===e.nodeName.toLowerCase())(e)&&"bookmark"===e.getAttribute("data-mce-type"),is=(e,t,n,o)=>{var r;const s=o||t;if(er(t)&&as(t))return t;const a=t.childNodes;for(let t=a.length-1;t>=0;t--)is(e,a[t],n,s);if(er(t)){const e=t.childNodes;1===e.length&&as(e[0])&&(null===(r=t.parentNode)||void 0===r||r.insertBefore(e[0],t))}return(e=>gr(e)||fr(e))(t)||Or(n,t)||(e=>!!er(e)&&e.childNodes.length>0)(t)||((e,t,n)=>dr(e)&&e.data.length>0&&((e,t,n)=>{const o=new Vo(e,t).prev(!1),r=new Vo(e,t).next(!1),s=v(o)||ss(o,n),a=v(r)||ss(r,n);return s&&a})(e,t,n))(t,s,n)||e.remove(t),t},ls=Dt.makeMap,ds=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,cs=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,us=/[<>&\"\']/g,ms=/([a-z0-9]+);?|&([a-z0-9]+);/gi,fs={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"},gs={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},ps={"<":"<",">":">","&":"&",""":'"',"'":"'"},hs=(e,t)=>{const n={};if(e){const o=e.split(",");t=t||10;for(let e=0;ee.replace(t?ds:cs,(e=>gs[e]||e)),ys=(e,t)=>e.replace(t?ds:cs,(e=>e.length>1?""+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":gs[e]||""+e.charCodeAt(0)+";")),Cs=(e,t,n)=>{const o=n||bs;return e.replace(t?ds:cs,(e=>gs[e]||o[e]||e))},ws={encodeRaw:vs,encodeAllRaw:e=>(""+e).replace(us,(e=>gs[e]||e)),encodeNumeric:ys,encodeNamed:Cs,getEncodeFunc:(e,t)=>{const n=hs(t)||bs,o=ls(e.replace(/\+/g,","));return o.named&&o.numeric?(e,t)=>e.replace(t?ds:cs,(e=>void 0!==gs[e]?gs[e]:void 0!==n[e]?n[e]:e.length>1?""+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":""+e.charCodeAt(0)+";")):o.named?t?(e,t)=>Cs(e,t,n):Cs:o.numeric?ys:vs},decode:e=>e.replace(ms,((e,t)=>t?(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):fs[t]||String.fromCharCode(t):ps[e]||bs[e]||(e=>{const t=vn("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e})(e)))},xs=(e,t)=>(e=Dt.trim(e))?e.split(t||" "):[],Es=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),ks=e=>Object.freeze(["id","accesskey","class","dir","lang","style","tabindex","title","role",..."html4"!==e?["contenteditable","contextmenu","draggable","dropzone","hidden","spellcheck","translate","itemprop","itemscope","itemtype"]:[],..."html5-strict"!==e?["xml:lang"]:[]]),_s=e=>{let t,n;t="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",n="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==e&&(t+=" article aside details dialog figure main header footer hgroup section nav a ins del canvas map",n+=" audio canvas command data datalist mark meter output picture progress time wbr video ruby bdi keygen svg"),"html5-strict"!==e&&(n=[n,"acronym applet basefont big font strike tt"].join(" "),t=[t,"center dir isindex noframes"].join(" "));const o=[t,n].join(" ");return{blockContent:t,phrasingContent:n,flowContent:o}},Ss=e=>{const{blockContent:t,phrasingContent:n,flowContent:o}=_s(e),r=e=>Object.freeze(e.split(" "));return Object.freeze({blockContent:r(t),phrasingContent:r(n),flowContent:r(o)})},Ns={html4:Le((()=>Ss("html4"))),html5:Le((()=>Ss("html5"))),"html5-strict":Le((()=>Ss("html5-strict")))},Rs=(e,t)=>{const{blockContent:n,phrasingContent:o,flowContent:r}=Ns[e]();return"blocks"===t?I.some(n):"phrasing"===t?I.some(o):"flow"===t?I.some(r):I.none()},As=e=>I.from(/^(@?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)$/.exec(e)).map((e=>({preset:"@"===e[1],name:e[2]}))),Ts={},Os=Dt.makeMap,Bs=Dt.each,Ps=Dt.extend,Ds=Dt.explode,Ls=(e,t={})=>{const n=Os(e," ",Os(e.toUpperCase()," "));return Ps(n,t)},Ms=e=>Ls("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),Is=(e,t)=>{if(e){const n={};return m(e)&&(e={"*":e}),Bs(e,((e,o)=>{n[o]=n[o.toUpperCase()]="map"===t?Os(e,/[, ]/):Ds(e,/[, ]/)})),n}},Fs=(e={})=>{var t;const n={},o={};let r=[];const s={},a={},i=(t,n,o)=>{const r=e[t];if(r)return Os(r,/[, ]/,Os(r.toUpperCase(),/[, ]/));{let e=Ts[t];return e||(e=Ls(n,o),Ts[t]=e),e}},l=null!==(t=e.schema)&&void 0!==t?t:"html5",d=(e=>{const t=ks(e),{phrasingContent:n,flowContent:o}=_s(e),r={},s=(e,t,n)=>{r[e]={attributes:se(t,N({})),attributesOrder:t,children:se(n,N({}))}},a=(e,n="",o="")=>{const r=xs(o),a=xs(e);let i=a.length;const l=[...t,...xs(n)];for(;i--;)s(a[i],l.slice(),r)},i=(e,t)=>{const n=xs(e),o=xs(t);let s=n.length;for(;s--;){const e=r[n[s]];for(let t=0,n=o.length;t{a(e,"",n)})),q(xs("center dir isindex noframes"),(e=>{a(e,"",o)}))),a("html","manifest","head body"),a("head","","base command link meta noscript script style title"),a("title hr noscript br"),a("base","href target"),a("link","href rel media hreflang type sizes hreflang"),a("meta","name http-equiv content charset"),a("style","media type scoped"),a("script","src async defer type charset"),a("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",o),a("dd div","",o),a("address dt caption","","html4"===e?n:o),a("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",n),a("blockquote","cite",o),a("ol","reversed start type","li"),a("ul","","li"),a("li","value",o),a("dl","","dt dd"),a("a","href target rel media hreflang type","html4"===e?n:o),a("q","cite",n),a("ins del","cite datetime",o),a("img","src sizes srcset alt usemap ismap width height"),a("iframe","src name width height",o),a("embed","src type width height"),a("object","data type typemustmatch name usemap form width height",[o,"param"].join(" ")),a("param","name value"),a("map","name",[o,"area"].join(" ")),a("area","alt coords shape href target rel media hreflang type"),a("table","border","caption colgroup thead tfoot tbody tr"+("html4"===e?" col":"")),a("colgroup","span","col"),a("col","span"),a("tbody thead tfoot","","tr"),a("tr","","td th"),a("td","colspan rowspan headers",o),a("th","colspan rowspan headers scope abbr",o),a("form","accept-charset action autocomplete enctype method name novalidate target",o),a("fieldset","disabled form name",[o,"legend"].join(" ")),a("label","form for",n),a("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),a("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===e?o:n),a("select","disabled form multiple name required size","option optgroup"),a("optgroup","disabled label","option"),a("option","disabled label selected value"),a("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),a("menu","type label",[o,"li"].join(" ")),a("noscript","",o),"html4"!==e&&(a("wbr"),a("ruby","",[n,"rt rp"].join(" ")),a("figcaption","",o),a("mark rt rp bdi","",n),a("summary","",[n,"h1 h2 h3 h4 h5 h6"].join(" ")),a("canvas","width height",o),a("data","value",n),a("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[o,"track source"].join(" ")),a("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[o,"track source"].join(" ")),a("picture","","img source"),a("source","src srcset type media sizes"),a("track","kind src srclang label default"),a("datalist","",[n,"option"].join(" ")),a("article section nav aside main header footer","",o),a("hgroup","","h1 h2 h3 h4 h5 h6"),a("figure","",[o,"figcaption"].join(" ")),a("time","datetime",n),a("dialog","open",o),a("command","type label icon disabled checked radiogroup command"),a("output","for form name",n),a("progress","value max",n),a("meter","value min max low high optimum",n),a("details","open",[o,"summary"].join(" ")),a("keygen","autofocus challenge disabled form keytype name"),s("svg","id tabindex lang xml:space class style x y width height viewBox preserveAspectRatio zoomAndPan transform".split(" "),[])),"html5-strict"!==e&&(i("script","language xml:space"),i("style","xml:space"),i("object","declare classid code codebase codetype archive standby align border hspace vspace"),i("embed","align name hspace vspace"),i("param","valuetype type"),i("a","charset name rev shape coords"),i("br","clear"),i("applet","codebase archive code object alt name width height align hspace vspace"),i("img","name longdesc align border hspace vspace"),i("iframe","longdesc frameborder marginwidth marginheight scrolling align"),i("font basefont","size color face"),i("input","usemap align"),i("select"),i("textarea"),i("h1 h2 h3 h4 h5 h6 div p legend caption","align"),i("ul","type compact"),i("li","type"),i("ol dl menu dir","compact"),i("pre","width xml:space"),i("hr","align noshade size width"),i("isindex","prompt"),i("table","summary width frame rules cellspacing cellpadding align bgcolor"),i("col","width align char charoff valign"),i("colgroup","width align char charoff valign"),i("thead","align char charoff valign"),i("tr","align char charoff valign bgcolor"),i("th","axis align char charoff valign nowrap bgcolor width height"),i("form","accept"),i("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),i("tfoot","align char charoff valign"),i("tbody","align char charoff valign"),i("area","nohref"),i("body","background bgcolor text link vlink alink")),"html4"!==e&&(i("input button select textarea","autofocus"),i("input textarea","placeholder"),i("a","download"),i("link script img","crossorigin"),i("img","loading"),i("iframe","sandbox seamless allow allowfullscreen loading")),"html4"!==e&&q([r.video,r.audio],(e=>{delete e.children.audio,delete e.children.video})),q(xs("a form meter progress dfn"),(e=>{r[e]&&delete r[e].children[e]})),delete r.caption.children.table,delete r.script,r})(l);!1===e.verify_html&&(e.valid_elements="*[*]");const c=Is(e.valid_styles),u=Is(e.invalid_styles,"map"),g=Is(e.valid_classes,"map"),h=i("whitespace_elements","pre script noscript style textarea video audio iframe object code"),v=i("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),y=i("void_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),C=i("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),w="td th iframe video audio object script code",x=i("non_empty_elements",w+" pre svg textarea summary",y),E=i("move_caret_before_on_enter_elements",w+" table",y),k="h1 h2 h3 h4 h5 h6",_=i("text_block_elements",k+" p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),S=i("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary html body multicol listing",_),R=i("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp"),A=i("transparent_elements","a ins del canvas map"),T=i("wrap_block_elements","pre "+k);Bs("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),(e=>{a[e]=new RegExp(""+e+"[^>]*>","gi")}));const O=e=>{const t=I.from(n["@"]),o=/[*?+]/;q(((e,t)=>{const n=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;return te(xs(t,","),(t=>{const o=n.exec(t);if(o){const t=o[1],n=o[2],r=o[3],s=o[4],a=o[5],i={attributes:{},attributesOrder:[]};if(e.each((e=>((e,t)=>{pe(e.attributes,((e,n)=>{t.attributes[n]=e})),t.attributesOrder.push(...e.attributesOrder)})(e,i))),"#"===t?i.paddEmpty=!0:"-"===t&&(i.removeEmpty=!0),"!"===s&&(i.removeEmptyAttrs=!0),a&&((e,t)=>{const n=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,o=/[*?+]/,{attributes:r,attributesOrder:s}=t;q(xs(e,"|"),(e=>{const a=n.exec(e);if(a){const e={},n=a[1],i=a[2].replace(/[\\:]:/g,":"),l=a[3],d=a[4];if("!"===n&&(t.attributesRequired=t.attributesRequired||[],t.attributesRequired.push(i),e.required=!0),"-"===n)return delete r[i],void s.splice(Dt.inArray(s,i),1);if(l&&("="===l?(t.attributesDefault=t.attributesDefault||[],t.attributesDefault.push({name:i,value:d}),e.defaultValue=d):"~"===l?(t.attributesForced=t.attributesForced||[],t.attributesForced.push({name:i,value:d}),e.forcedValue=d):"<"===l&&(e.validValues=Dt.makeMap(d,"?"))),o.test(i)){const n=e;t.attributePatterns=t.attributePatterns||[],n.pattern=Es(i),t.attributePatterns.push(n)}else r[i]||s.push(i),r[i]=e}}))})(a,i),r&&(i.outputName=n),"@"===n){if(!e.isNone())return[];e=I.some(i)}return[r?{name:n,element:i,aliasName:r}:{name:n,element:i}]}return[]}))})(t,null!=e?e:""),(({name:e,element:t,aliasName:s})=>{if(s&&(n[s]=t),o.test(e)){const n=t;n.pattern=Es(e),r.push(n)}else n[e]=t}))},B=e=>{r=[],q(fe(n),(e=>{delete n[e]})),O(e)},P=(e,t)=>{var r,a;delete Ts.text_block_elements,delete Ts.block_elements;const i=!!t.extends&&!oe(t.extends),d=t.extends;if(o[e]=d?o[d]:{},s[e]=null!=d?d:e,x[e.toUpperCase()]={},x[e]={},i||(S[e.toUpperCase()]={},S[e]={}),d&&!n[e]&&n[d]){const t=(e=>{const t=e=>p(e)?V(e,t):(e=>f(e)&&e.source&&"[object RegExp]"===Object.prototype.toString.call(e))(e)?new RegExp(e.source,e.flags):f(e)?he(e,t):e;return t(e)})(n[d]);delete t.removeEmptyAttrs,delete t.removeEmpty,n[e]=t}else n[e]={attributesOrder:[],attributes:{}};if(p(t.attributes)){const o=e=>{s.attributesOrder.push(e),s.attributes[e]={}},s=null!==(r=n[e])&&void 0!==r?r:{};delete s.attributesDefault,delete s.attributesForced,delete s.attributePatterns,delete s.attributesRequired,s.attributesOrder=[],s.attributes={},q(t.attributes,(e=>{const t=ks(l);As(e).each((({preset:e,name:n})=>{e?"global"===n&&q(t,o):o(n)}))})),n[e]=s}if(b(t.padEmpty)){const o=null!==(a=n[e])&&void 0!==a?a:{};o.paddEmpty=t.padEmpty,n[e]=o}if(p(t.children)){const n={},r=e=>{n[e]={}},s=e=>{Rs(l,e).each((e=>{q(e,r)}))};q(t.children,(e=>{As(e).each((({preset:e,name:t})=>{e?s(t):r(t)}))})),o[e]=n}d&&pe(o,((t,n)=>{t[d]&&(o[n]=t=Ps({},o[n]),t[e]=t[d])}))},D=e=>{f(e)?pe(e,((e,t)=>P(t,e))):m(e)&&(e=>{q((e=>{const t=/^(~)?(.+)$/;return te(xs(e,","),(e=>{const n=t.exec(e);return n?[{cloneName:"~"===n[1]?"span":"div",name:n[2]}]:[]}))})(null!=e?e:""),(({name:e,cloneName:t})=>{P(e,{extends:t})}))})(e)},L=e=>{q((e=>{const t=/^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;return te(xs(e,","),(e=>{const n=t.exec(e);if(n){const e=n[1],t=e?(e=>"-"===e?"remove":"add")(e):"replace";return[{operation:t,name:n[2],validChildren:te(xs(n[3],"|"),(e=>As(e).toArray()))}]}return[]}))})(null!=e?e:""),(({operation:e,name:t,validChildren:n})=>{const r="replace"===e?{"#comment":{}}:o[t],s=t=>{"remove"===e?delete r[t]:r[t]={}};q(n,(({preset:e,name:t})=>{e?(e=>{Rs(l,e).each((e=>{q(e,s)}))})(t):s(t)})),o[t]=r}))},M=e=>{const t=n[e];if(t)return t;let o=r.length;for(;o--;){const t=r[o];if(t.pattern.test(e))return t}},F=N(c),U=N(u),z=N(g),j=N(C),H=N(S),$=N(_),W=N(R),K=N(Object.seal(y)),Y=N(v),G=N(x),X=N(E),Z=N(h),Q=N(A),J=N(T),ee=N(Object.seal(a)),ne=(e,t)=>{const n=M(e);if(n){if(!t)return!0;{if(n.attributes[t])return!0;const e=n.attributePatterns;if(e){let n=e.length;for(;n--;)if(e[n].pattern.test(t))return!0}}}return!1},oe=e=>ke(H(),e),re=e=>!$e(e,"#")&&ne(e)&&!oe(e),ae=N(s);return e.valid_elements?(B(e.valid_elements),Bs(d,((e,t)=>{o[t]=e.children}))):(Bs(d,((e,t)=>{n[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},o[t]=e.children})),Bs(xs("strong/b em/i"),(e=>{const t=xs(e,"/");n[t[1]].outputName=t[0]})),Bs(R,((t,o)=>{n[o]&&(e.padd_empty_block_inline_children&&(n[o].paddInEmptyBlock=!0),n[o].removeEmpty=!0)})),Bs(xs("ol ul blockquote a table tbody"),(e=>{n[e]&&(n[e].removeEmpty=!0)})),Bs(xs("p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary"),(e=>{n[e]&&(n[e].paddEmpty=!0)})),Bs(xs("span"),(e=>{n[e].removeEmptyAttrs=!0}))),delete n.svg,D(e.custom_elements),L(e.valid_children),O(e.extended_valid_elements),L("+ol[ul|ol],+ul[ul|ol]"),Bs({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},((e,t)=>{n[t]&&(n[t].parentsRequired=xs(e))})),e.invalid_elements&&Bs(Ds(e.invalid_elements),(e=>{n[e]&&delete n[e]})),M("span")||O("span[!data-mce-type|*]"),{type:l,children:o,elements:n,getValidStyles:F,getValidClasses:z,getBlockElements:H,getInvalidStyles:U,getVoidElements:K,getTextBlockElements:$,getTextInlineElements:W,getBoolAttrs:j,getElementRule:M,getSelfClosingElements:Y,getNonEmptyElements:G,getMoveCaretBeforeOnEnterElements:X,getWhitespaceElements:Z,getTransparentElements:Q,getSpecialElements:ee,isValidChild:(e,t)=>{const n=o[e.toLowerCase()];return!(!n||!n[t.toLowerCase()])},isValid:ne,isBlock:oe,isInline:re,isWrapper:e=>ke(J(),e)||re(e),getCustomElements:ae,addValidElements:O,setValidElements:B,addCustomElements:D,addValidChildren:L}},Us=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},zs=e=>(e=>{return{value:(t=e,je(t,"#").toUpperCase())};var t})(Us(e.red)+Us(e.green)+Us(e.blue)),js=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,Hs=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,$s=(e,t,n,o)=>({red:e,green:t,blue:n,alpha:o}),Vs=(e,t,n,o)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(n,10),i=parseFloat(o);return $s(r,s,a,i)},qs=e=>{if("transparent"===e)return I.some($s(0,0,0,0));const t=js.exec(e);if(null!==t)return I.some(Vs(t[1],t[2],t[3],"1"));const n=Hs.exec(e);return null!==n?I.some(Vs(n[1],n[2],n[3],n[4])):I.none()},Ws=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Ks=e=>qs(e).map(zs).map((e=>"#"+e.value)).getOr(e),Ys=(e={},t)=>{const n=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,o=/\s*([^:]+):\s*([^;]+);?/g,r=/\s+$/,s=/rgba *\(/i,a={};let i,l;const d=qo;t&&(i=t.getValidStyles(),l=t.getInvalidStyles());const c="\\\" \\' \\; \\: ; : \ufeff".split(" ");for(let e=0;e{const i={};let l=!1;const c=e.url_converter,m=e.url_converter_scope||u,f=(e,t,n)=>{const o=i[e+"-top"+t];if(!o)return;const r=i[e+"-right"+t];if(!r)return;const s=i[e+"-bottom"+t];if(!s)return;const a=i[e+"-left"+t];if(!a)return;const l=[o,r,s,a];let d=l.length-1;for(;d--&&l[d]===l[d+1];);d>-1&&n||(i[e+t]=-1===d?l[0]:l.join(" "),delete i[e+"-top"+t],delete i[e+"-right"+t],delete i[e+"-bottom"+t],delete i[e+"-left"+t])},g=e=>{const t=i[e];if(!t)return;const n=t.indexOf(",")>-1?[t]:t.split(" ");let o=n.length;for(;o--;)if(n[o]!==n[0])return!1;return i[e]=n[0],!0},p=e=>(l=!0,a[e]),h=(e,t)=>(l&&(e=e.replace(/\uFEFF[0-9]/g,(e=>a[e]))),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e),b=e=>String.fromCharCode(parseInt(e.slice(1),16)),v=e=>e.replace(/\\[0-9a-f]+/gi,b),y=(t,n,o,r,s,a)=>{if(s=s||a)return"'"+(s=h(s)).replace(/\'/g,"\\'")+"'";if(n=h(n||o||r||""),!e.allow_script_urls){const t=n.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(t))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(t))return""}return c&&(n=c.call(m,n,"style")),"url('"+n.replace(/\'/g,"\\'")+"')"};if(t){let a;for(t=(t=t.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,p).replace(/\"[^\"]+\"|\'[^\']+\'/g,(e=>e.replace(/[;:]/g,p)));a=o.exec(t);){o.lastIndex=a.index+a[0].length;let t=a[1].replace(r,"").toLowerCase(),c=a[2].replace(r,"");if(t&&c){if(t=v(t),c=v(c),-1!==t.indexOf(d)||-1!==t.indexOf('"'))continue;if(!e.allow_script_urls&&("behavior"===t||/expression\s*\(|\/\*|\*\//.test(c)))continue;"font-weight"===t&&"700"===c?c="bold":"color"!==t&&"background-color"!==t||(c=c.toLowerCase()),s.test(c)||qs(c).each((e=>{c=Ks(Ws(e)).toLowerCase()})),c=c.replace(n,y),i[t]=l?h(c,!0):c}}f("border","",!0),f("border","-width"),f("border","-color"),f("border","-style"),f("padding",""),f("margin",""),"border",w="border-style",x="border-color",g(C="border-width")&&g(w)&&g(x)&&(i.border=i[C]+" "+i[w]+" "+i[x],delete i[C],delete i[w],delete i[x]),"medium none"===i.border&&delete i.border,"none"===i["border-image"]&&delete i["border-image"]}var C,w,x;return i},serialize:(e,t)=>{let n="";const o=(t,o)=>{const r=o[t];if(r)for(let t=0,o=r.length;t0?" ":"")+o+": "+s+";")}};return t&&i?(o("*",i),o(t,i)):pe(e,((e,o)=>{e&&((e,t)=>{if(!l||!t)return!0;let n=l["*"];return!(n&&n[e]||(n=l[t],n&&n[e]))})(o,t)&&(n+=(n.length>0?" ":"")+o+": "+e+";")})),n}};return u},Gs={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0},Xs=(e,t)=>{const n=null!=t?t:{};for(const t in e)ke(Gs,t)||(n[t]=e[t]);return C(e.composedPath)&&(n.composedPath=()=>e.composedPath()),C(e.getModifierState)&&(n.getModifierState=t=>e.getModifierState(t)),C(e.getTargetRanges)&&(n.getTargetRanges=()=>e.getTargetRanges()),n},Zs=(e,t,n,o)=>{var r;const s=Xs(t,o);return s.type=e,y(s.target)&&(s.target=null!==(r=s.srcElement)&&void 0!==r?r:n),(e=>y(e.preventDefault)||(e=>e instanceof Event||w(e.initEvent))(e))(t)&&(s.preventDefault=()=>{s.defaultPrevented=!0,s.isDefaultPrevented=M,w(t.preventDefault)&&t.preventDefault()},s.stopPropagation=()=>{s.cancelBubble=!0,s.isPropagationStopped=M,w(t.stopPropagation)&&t.stopPropagation()},s.stopImmediatePropagation=()=>{s.isImmediatePropagationStopped=M,s.stopPropagation()},(e=>e.isDefaultPrevented===M||e.isDefaultPrevented===L)(s)||(s.isDefaultPrevented=!0===s.defaultPrevented?M:L,s.isPropagationStopped=!0===s.cancelBubble?M:L,s.isImmediatePropagationStopped=L)),s},Qs=/^(?:mouse|contextmenu)|click/,Js=(e,t,n,o)=>{e.addEventListener(t,n,o||!1)},ea=(e,t,n,o)=>{e.removeEventListener(t,n,o||!1)},ta=(e,t)=>{const n=Zs(e.type,e,document,t);if((e=>C(e)&&Qs.test(e.type))(e)&&v(e.pageX)&&!v(e.clientX)){const t=n.target.ownerDocument||document,o=t.documentElement,r=t.body,s=n;s.pageX=e.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),s.pageY=e.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)}return n},na=(e,t,n)=>{const o=e.document,r={type:"ready"};if(n.domLoaded)return void t(r);const s=()=>{ea(e,"DOMContentLoaded",s),ea(e,"load",s),n.domLoaded||(n.domLoaded=!0,t(r)),e=null};"complete"===o.readyState||"interactive"===o.readyState&&o.body?s():Js(e,"DOMContentLoaded",s),n.domLoaded||Js(e,"load",s)};class oa{constructor(){this.domLoaded=!1,this.events={},this.count=1,this.expando="mce-data-"+(+new Date).toString(32),this.hasFocusIn="onfocusin"in document.documentElement,this.count=1}bind(e,t,n,o){const r=this;let s;const a=window,i=e=>{r.executeHandlers(ta(e||a.event),l)};if(!e||dr(e)||mr(e))return n;let l;e[r.expando]?l=e[r.expando]:(l=r.count++,e[r.expando]=l,r.events[l]={}),o=o||e;const d=t.split(" ");let c=d.length;for(;c--;){let t=d[c],u=i,m=!1,f=!1;"DOMContentLoaded"===t&&(t="ready"),r.domLoaded&&"ready"===t&&"complete"===e.readyState?n.call(o,ta({type:t})):(r.hasFocusIn||"focusin"!==t&&"focusout"!==t||(m=!0,f="focusin"===t?"focus":"blur",u=e=>{const t=ta(e||a.event);t.type="focus"===t.type?"focusin":"focusout",r.executeHandlers(t,l)}),s=r.events[l][t],s?"ready"===t&&r.domLoaded?n(ta({type:t})):s.push({func:n,scope:o}):(r.events[l][t]=s=[{func:n,scope:o}],s.fakeName=f,s.capture=m,s.nativeHandler=u,"ready"===t?na(e,u,r):Js(e,f||t,u,m)))}return e=s=null,n}unbind(e,t,n){if(!e||dr(e)||mr(e))return this;const o=e[this.expando];if(o){let r=this.events[o];if(t){const o=t.split(" ");let s=o.length;for(;s--;){const t=o[s],a=r[t];if(a){if(n){let e=a.length;for(;e--;)if(a[e].func===n){const n=a.nativeHandler,o=a.fakeName,s=a.capture,i=a.slice(0,e).concat(a.slice(e+1));i.nativeHandler=n,i.fakeName=o,i.capture=s,r[t]=i}}n&&0!==a.length||(delete r[t],ea(e,a.fakeName||t,a.nativeHandler,a.capture))}}}else pe(r,((t,n)=>{ea(e,t.fakeName||n,t.nativeHandler,t.capture)})),r={};for(const e in r)if(ke(r,e))return this;delete this.events[o];try{delete e[this.expando]}catch(t){e[this.expando]=null}}return this}fire(e,t,n){return this.dispatch(e,t,n)}dispatch(e,t,n){if(!e||dr(e)||mr(e))return this;const o=ta({type:t,target:e},n);do{const t=e[this.expando];t&&this.executeHandlers(o,t),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!o.isPropagationStopped());return this}clean(e){if(!e||dr(e)||mr(e))return this;if(e[this.expando]&&this.unbind(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName){this.unbind(e);const t=e.getElementsByTagName("*");let n=t.length;for(;n--;)(e=t[n])[this.expando]&&this.unbind(e)}return this}destroy(){this.events={}}cancel(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}executeHandlers(e,t){const n=this.events[t],o=n&&n[e.type];if(o)for(let t=0,n=o.length;t{y(n)||""===n?rn(e,t):Jt(e,t,n)},da=e=>e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),ca=(e,t)=>{let n=0;if(e)for(let o=e.nodeType,r=e.previousSibling;r;r=r.previousSibling){const e=r.nodeType;(!t||!dr(r)||e!==o&&r.data.length)&&(n++,o=e)}return n},ua=(e,t)=>{const n=tn(t,"style"),o=e.serialize(e.parse(n),$t(t));la(t,aa,o)},ma=(e,t,n)=>{const o=da(t);y(n)||""===n?po(e,o):lo(e,o,((e,t)=>x(e)?ke(ia,t)?e+"":e+"px":e)(n,o))},fa=(e,t={})=>{const n={},o=window,r={};let s=0;const a=rs.forElement(Cn(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),i=[],l=t.schema?t.schema:Fs({}),d=Ys({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),c=t.ownEvents?new oa:oa.Event,u=l.getBlockElements(),f=t=>t&&e&&m(t)?e.getElementById(t):t,h=e=>{const t=f(e);return C(t)?Cn(t):null},b=(e,t,n="")=>{let o;const r=h(e);if(C(r)&&Kt(r)){const e=G[t];o=e&&e.get?e.get(r.dom,t):tn(r,t)}return C(o)?o:n},v=e=>{const t=f(e);return y(t)?[]:t.attributes},x=(e,n,o)=>{B(e,(e=>{if(er(e)){const r=Cn(e),s=""===o?null:o,a=tn(r,n),i=G[n];i&&i.set?i.set(r.dom,s,n):la(r,n,s),a!==s&&t.onSetAttrib&&t.onSetAttrib({attrElm:r.dom,attrName:n,attrValue:s})}}))},E=()=>t.root_element||e.body,_=(t,n)=>((e,t,n)=>{let o=0,r=0;const s=e.ownerDocument;if(n=n||e,t){if(n===e&&t.getBoundingClientRect&&"static"===uo(Cn(e),"position")){const n=t.getBoundingClientRect();return o=n.left+(s.documentElement.scrollLeft||e.scrollLeft)-s.documentElement.clientLeft,r=n.top+(s.documentElement.scrollTop||e.scrollTop)-s.documentElement.clientTop,{x:o,y:r}}let a=t;for(;a&&a!==n&&a.nodeType&&!ns(a,n);){const e=a;o+=e.offsetLeft||0,r+=e.offsetTop||0,a=e.offsetParent}for(a=t.parentNode;a&&a!==n&&a.nodeType&&!ns(a,n);)o-=a.scrollLeft||0,r-=a.scrollTop||0,a=a.parentNode;r+=(e=>es.isFirefox()&&"table"===$t(e)?ts(In(e)).filter((e=>"caption"===$t(e))).bind((e=>ts(Mn(e)).map((t=>{const n=t.dom.offsetTop,o=e.dom.offsetTop,r=e.dom.offsetHeight;return n<=o?-r:0})))).getOr(0):0)(Cn(t))}return{x:o,y:r}})(e.body,f(t),n),S=(e,t,n)=>{const o=f(e);var r;if(!y(o)&&(tr(o)||er(r=o)&&"http://www.w3.org/2000/svg"===r.namespaceURI))return n?uo(Cn(o),da(t)):("float"===(t=t.replace(/-(\D)/g,((e,t)=>t.toUpperCase())))&&(t="cssFloat"),o.style?o.style[t]:void 0)},R=e=>{const t=f(e);if(!t)return{w:0,h:0};let n=S(t,"width"),o=S(t,"height");return n&&-1!==n.indexOf("px")||(n="0"),o&&-1!==o.indexOf("px")||(o="0"),{w:parseInt(n,10)||t.offsetWidth||t.clientWidth,h:parseInt(o,10)||t.offsetHeight||t.clientHeight}},A=(e,t)=>{if(!e)return!1;const n=p(e)?e:[e];return $(n,(e=>En(Cn(e),t)))},T=(e,t,n,o)=>{const r=[];let s=f(e);o=void 0===o;const a=n||("BODY"!==E().nodeName?E().parentNode:null);if(m(t))if("*"===t)t=er;else{const e=t;t=t=>A(t,e)}for(;s&&!(s===a||y(s.nodeType)||fr(s)||gr(s));){if(!t||t(s)){if(!o)return[s];r.push(s)}s=s.parentNode}return o?r:null},O=(e,t,n)=>{let o=t;if(e){m(t)&&(o=e=>A(e,t));for(let t=e[n];t;t=t[n])if(w(o)&&o(t))return t}return null},B=function(e,t,n){const o=null!=n?n:this;if(p(e)){const n=[];return ra(e,((e,r)=>{const s=f(e);s&&n.push(t.call(o,s,r))})),n}{const n=f(e);return!!n&&t.call(o,n)}},P=(e,t)=>{B(e,(e=>{pe(t,((t,n)=>{x(e,n,t)}))}))},D=(e,t)=>{B(e,(e=>{const n=Cn(e);No(n,t)}))},L=(t,n,o,r,s)=>B(t,(t=>{const a=m(n)?e.createElement(n):n;return C(o)&&P(a,o),r&&(!m(r)&&r.nodeType?a.appendChild(r):m(r)&&D(a,r)),s?a:t.appendChild(a)})),M=(t,n,o)=>L(e.createElement(t),t,n,o,!0),I=ws.encodeAllRaw,F=(e,t)=>B(e,(e=>{const n=Cn(e);return t&&q(In(n),(e=>{Yt(e)&&0===e.dom.length?Eo(e):ho(n,e)})),Eo(n),n.dom})),U=(e,t,n)=>{B(e,(e=>{if(er(e)){const o=Cn(e),r=t.split(" ");q(r,(e=>{C(n)?(n?mn:gn)(o,e):((e,t)=>{const n=ln(e)?e.dom.classList.toggle(t):((e,t)=>H(dn(e),t)?un(e,t):cn(e,t))(e,t);fn(e)})(o,e)}))}}))},z=(e,t,n)=>B(t,(o=>{var r;const s=p(t)?e.cloneNode(!0):e;return n&&ra(sa(o.childNodes),(e=>{s.appendChild(e)})),null===(r=o.parentNode)||void 0===r||r.replaceChild(s,o),o})),j=()=>e.createRange(),V=(n,r,s,a)=>{if(p(n)){let e=n.length;const t=[];for(;e--;)t[e]=V(n[e],r,s,a);return t}return!t.collect||n!==e&&n!==o||i.push([n,r,s,a]),c.bind(n,r,s,a||Y)},W=(t,n,r)=>{if(p(t)){let e=t.length;const o=[];for(;e--;)o[e]=W(t[e],n,r);return o}if(i.length>0&&(t===e||t===o)){let e=i.length;for(;e--;){const[o,s,a]=i[e];t!==o||n&&n!==s||r&&r!==a||c.unbind(o,s,a)}}return c.unbind(t,n,r)},K=e=>{if(e&&tr(e)){const t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},Y={doc:e,settings:t,win:o,files:r,stdMode:!0,boxModel:!0,styleSheetLoader:a,boundEvents:i,styles:d,schema:l,events:c,isBlock:e=>m(e)?ke(u,e):er(e)&&(ke(u,e.nodeName)||Zr(l,e)),root:null,clone:(e,t)=>e.cloneNode(t),getRoot:E,getViewPort:e=>{const t=Fo(e);return{x:t.x,y:t.y,w:t.width,h:t.height}},getRect:e=>{const t=f(e),n=_(t),o=R(t);return{x:n.x,y:n.y,w:o.w,h:o.h}},getSize:R,getParent:(e,t,n)=>{const o=T(e,t,n,!1);return o&&o.length>0?o[0]:null},getParents:T,get:f,getNext:(e,t)=>O(e,t,"nextSibling"),getPrev:(e,t)=>O(e,t,"previousSibling"),select:(n,o)=>{var r,s;const a=null!==(s=null!==(r=f(o))&&void 0!==r?r:t.root_element)&&void 0!==s?s:e;return w(a.querySelectorAll)?ce(a.querySelectorAll(n)):[]},is:A,add:L,create:M,createHTML:(e,t,n="")=>{let o="<"+e;for(const e in t)_e(t,e)&&(o+=" "+e+'="'+I(t[e])+'"');return Xe(n)&&ke(l.getVoidElements(),e)?o+" />":o+">"+n+""+e+">"},createFragment:t=>{const n=e.createElement("div"),o=e.createDocumentFragment();let r;for(o.appendChild(n),t&&(n.innerHTML=t);r=n.firstChild;)o.appendChild(r);return o.removeChild(n),o},remove:F,setStyle:(e,n,o)=>{B(e,(e=>{const r=Cn(e);ma(r,n,o),t.update_styles&&ua(d,r)}))},getStyle:S,setStyles:(e,n)=>{B(e,(e=>{const o=Cn(e);pe(n,((e,t)=>{ma(o,t,e)})),t.update_styles&&ua(d,o)}))},removeAllAttribs:e=>B(e,(e=>{const t=e.attributes;for(let n=t.length-1;n>=0;n--)e.removeAttributeNode(t.item(n))})),setAttrib:x,setAttribs:P,getAttrib:b,getPos:_,parseStyle:e=>d.parse(e),serializeStyle:(e,t)=>d.serialize(e,t),addStyle:t=>{if(Y!==fa.DOM&&e===document){if(n[t])return;n[t]=!0}let o=e.getElementById("mceDefaultStyles");if(!o){o=e.createElement("style"),o.id="mceDefaultStyles",o.type="text/css";const t=e.head;t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o)}o.styleSheet?o.styleSheet.cssText+=t:o.appendChild(e.createTextNode(t))},loadCSS:e=>{e||(e=""),q(e.split(","),(e=>{r[e]=!0,a.load(e).catch(k)}))},addClass:(e,t)=>{U(e,t,!0)},removeClass:(e,t)=>{U(e,t,!1)},hasClass:(e,t)=>{const n=h(e),o=t.split(" ");return C(n)&&ne(o,(e=>pn(n,e)))},toggleClass:U,show:e=>{B(e,(e=>po(Cn(e),"display")))},hide:e=>{B(e,(e=>lo(Cn(e),"display","none")))},isHidden:e=>{const t=h(e);return C(t)&&Lt(fo(t,"display"),"none")},uniqueId:e=>(e||"mce_")+s++,setHTML:D,getOuterHTML:e=>{const t=h(e);return C(t)?er(t.dom)?t.dom.outerHTML:(e=>{const t=vn("div"),n=Cn(e.dom.cloneNode(!0));return yo(t,n),So(t)})(t):""},setOuterHTML:(e,t)=>{B(e,(e=>{er(e)&&(e.outerHTML=t)}))},decode:ws.decode,encode:I,insertAfter:(e,t)=>{const n=f(t);return B(e,(e=>{const t=null==n?void 0:n.parentNode,o=null==n?void 0:n.nextSibling;return t&&(o?t.insertBefore(e,o):t.appendChild(e)),e}))},replace:z,rename:(e,t)=>{if(e.nodeName!==t.toUpperCase()){const n=M(t);return ra(v(e),(t=>{x(n,t.nodeName,b(e,t.nodeName))})),z(n,e,!0),n}return e},findCommonAncestor:(e,t)=>{let n=e;for(;n;){let e=t;for(;e&&n!==e;)e=e.parentNode;if(n===e)break;n=n.parentNode}return!n&&e.ownerDocument?e.ownerDocument.documentElement:n},run:B,getAttribs:v,isEmpty:(e,t,n)=>{if(g(t)){const o=e=>{const n=e.nodeName.toLowerCase();return Boolean(t[n])};return Ar(l,e,{...n,isContent:o})}return Ar(l,e,n)},createRng:j,nodeIndex:ca,split:(e,t,n)=>{let o,r,s=j();if(e&&t&&e.parentNode&&t.parentNode){const a=e.parentNode;return s.setStart(a,ca(e)),s.setEnd(t.parentNode,ca(t)),o=s.extractContents(),s=j(),s.setStart(t.parentNode,ca(t)+1),s.setEnd(a,ca(e)+1),r=s.extractContents(),a.insertBefore(is(Y,o,l),e),n?a.insertBefore(n,e):a.insertBefore(t,e),a.insertBefore(is(Y,r,l),e),F(e),n||t}},bind:V,unbind:W,fire:(e,t,n)=>c.dispatch(e,t,n),dispatch:(e,t,n)=>c.dispatch(e,t,n),getContentEditable:K,getContentEditableParent:e=>{const t=E();let n=null;for(let o=e;o&&o!==t&&(n=K(o),null===n);o=o.parentNode);return n},isEditable:e=>{if(C(e)){const t=er(e)?e:e.parentElement;return C(t)&&tr(t)&&ro(Cn(t))}return!1},destroy:()=>{if(i.length>0){let e=i.length;for(;e--;){const[t,n,o]=i[e];c.unbind(t,n,o)}}pe(r,((e,t)=>{a.unload(t),delete r[t]}))},isChildOf:(e,t)=>e===t||t.contains(e),dumpRng:e=>"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},G=((e,t,n)=>{const o=t.keep_values,r={set:(e,o,r)=>{const s=Cn(e);w(t.url_converter)&&C(o)&&(o=t.url_converter.call(t.url_converter_scope||n(),String(o),r,e)),la(s,"data-mce-"+r,o),la(s,r,o)},get:(e,t)=>{const n=Cn(e);return tn(n,"data-mce-"+t)||tn(n,t)}},s={style:{set:(t,n)=>{const r=Cn(t);o&&la(r,aa,n),rn(r,"style"),m(n)&&co(r,e.parse(n))},get:t=>{const n=Cn(t),o=tn(n,aa)||tn(n,"style");return e.serialize(e.parse(o),$t(n))}}};return o&&(s.href=s.src=r),s})(d,t,N(Y));return Y};fa.DOM=fa(document),fa.nodeIndex=ca;const ga=fa.DOM;class pa{constructor(e={}){this.states={},this.queue=[],this.scriptLoadedCallbacks={},this.queueLoadedCallbacks=[],this.loading=!1,this.settings=e}_setReferrerPolicy(e){this.settings.referrerPolicy=e}loadScript(e){return new Promise(((t,n)=>{const o=ga;let r;const s=()=>{o.remove(a),r&&(r.onerror=r.onload=r=null)},a=o.uniqueId();r=document.createElement("script"),r.id=a,r.type="text/javascript",r.src=Dt._addCacheSuffix(e),this.settings.referrerPolicy&&o.setAttrib(r,"referrerpolicy",this.settings.referrerPolicy),r.onload=()=>{s(),t()},r.onerror=()=>{s(),n("Failed to load script: "+e)},(document.getElementsByTagName("head")[0]||document.body).appendChild(r)}))}isDone(e){return 2===this.states[e]}markDone(e){this.states[e]=2}add(e){const t=this;return t.queue.push(e),void 0===t.states[e]&&(t.states[e]=0),new Promise(((n,o)=>{t.scriptLoadedCallbacks[e]||(t.scriptLoadedCallbacks[e]=[]),t.scriptLoadedCallbacks[e].push({resolve:n,reject:o})}))}load(e){return this.add(e)}remove(e){delete this.states[e],delete this.scriptLoadedCallbacks[e]}loadQueue(){const e=this.queue;return this.queue=[],this.loadScripts(e)}loadScripts(e){const t=this,n=(e,n)=>{Ee(t.scriptLoadedCallbacks,n).each((t=>{q(t,(t=>t[e](n)))})),delete t.scriptLoadedCallbacks[n]},o=e=>{const t=Y(e,(e=>"rejected"===e.status));return t.length>0?Promise.reject(te(t,(({reason:e})=>p(e)?e:[e]))):Promise.resolve()},r=e=>Promise.allSettled(V(e,(e=>2===t.states[e]?(n("resolve",e),Promise.resolve()):3===t.states[e]?(n("reject",e),Promise.reject(e)):(t.states[e]=1,t.loadScript(e).then((()=>{t.states[e]=2,n("resolve",e);const s=t.queue;return s.length>0?(t.queue=[],r(s).then(o)):Promise.resolve()}),(()=>(t.states[e]=3,n("reject",e),Promise.reject(e)))))))),s=e=>(t.loading=!0,r(e).then((e=>{t.loading=!1;const n=t.queueLoadedCallbacks.shift();return I.from(n).each(D),o(e)}))),a=Se(e);return t.loading?new Promise(((e,n)=>{t.queueLoadedCallbacks.push((()=>{s(a).then(e,n)}))})):s(a)}}pa.ScriptLoader=new pa;const ha={},ba=Br("en"),va=()=>Ee(ha,ba.get()),ya={getData:()=>he(ha,(e=>({...e}))),setCode:e=>{e&&ba.set(e)},getCode:()=>ba.get(),add:(e,t)=>{let n=ha[e];n||(ha[e]=n={});const o=V(fe(t),(e=>e.toLowerCase()));pe(t,((e,r)=>{const s=r.toLowerCase();s!==r&&((e,t)=>{const n=e.indexOf(t);return-1!==n&&e.indexOf(t,n+1)>n})(o,s)?(ke(t,s)||(n[s]=e),n[r]=e):n[s]=e}))},translate:e=>{const t=va().getOr({}),n=e=>w(e)?Object.prototype.toString.call(e):o(e)?"":""+e,o=e=>""===e||null==e,r=e=>{const o=n(e);return ke(t,o)?n(t[o]):Ee(t,o.toLowerCase()).map(n).getOr(o)},s=e=>e.replace(/{context:\w+}$/,"");if(o(e))return"";if(f(a=e)&&ke(a,"raw"))return n(e.raw);var a;if((e=>p(e)&&e.length>1)(e)){const t=e.slice(1);return s(r(e[0]).replace(/\{([0-9]+)\}/g,((e,o)=>ke(t,o)?n(t[o]):e)))}return s(r(e))},isRtl:()=>va().bind((e=>Ee(e,"_dir"))).exists((e=>"rtl"===e)),hasCode:e=>ke(ha,e)},Ca=()=>{const e=[],t={},n={},o=[],r=(e,t)=>{const n=Y(o,(n=>n.name===e&&n.state===t));q(n,(e=>e.resolve()))},s=e=>ke(t,e),a=(e,n)=>{const o=ya.getCode();!o||n&&-1===(","+(n||"")+",").indexOf(","+o+",")||pa.ScriptLoader.add(t[e]+"/langs/"+o+".js")},i=(e,t="added")=>"added"===t&&(e=>ke(n,e))(e)||"loaded"===t&&s(e)?Promise.resolve():new Promise((n=>{o.push({name:e,state:t,resolve:n})}));return{items:e,urls:t,lookup:n,get:e=>{if(n[e])return n[e].instance},requireLangPack:(e,t)=>{!1!==Ca.languageLoad&&(s(e)?a(e,t):i(e,"loaded").then((()=>a(e,t))))},add:(t,o)=>(e.push(o),n[t]={instance:o},r(t,"added"),o),remove:e=>{delete t[e],delete n[e]},createUrl:(e,t)=>m(t)?m(e)?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}:t,load:(e,o)=>{if(t[e])return Promise.resolve();let s=m(o)?o:o.prefix+o.resource+o.suffix;0!==s.indexOf("/")&&-1===s.indexOf("://")&&(s=Ca.baseURL+"/"+s),t[e]=s.substring(0,s.lastIndexOf("/"));const a=()=>(r(e,"loaded"),Promise.resolve());return n[e]?a():pa.ScriptLoader.add(s).then(a)},waitFor:i}};Ca.languageLoad=!0,Ca.baseURL="",Ca.PluginManager=Ca(),Ca.ThemeManager=Ca(),Ca.ModelManager=Ca();const wa=(e,t)=>{let n=null;return{cancel:()=>{h(n)||(clearTimeout(n),n=null)},throttle:(...o)=>{h(n)&&(n=setTimeout((()=>{n=null,e.apply(null,o)}),t))}}},xa=(e,t)=>{let n=null;const o=()=>{h(n)||(clearTimeout(n),n=null)};return{cancel:o,throttle:(...r)=>{o(),n=setTimeout((()=>{n=null,e.apply(null,r)}),t)}}},Ea=N("mce-annotation"),ka=N("data-mce-annotation"),_a=N("data-mce-annotation-uid"),Sa=N("data-mce-annotation-active"),Na=N("data-mce-annotation-classes"),Ra=N("data-mce-annotation-attrs"),Aa=e=>t=>_n(t,e),Ta=(e,t)=>{const n=e.selection.getRng(),o=Cn(n.startContainer),r=Cn(e.getBody()),s=t.fold((()=>"."+Ea()),(e=>`[${ka()}="${e}"]`)),a=Fn(o,n.startOffset).getOr(o);return oo(a,s,Aa(r)).bind((t=>nn(t,`${_a()}`).bind((n=>nn(t,`${ka()}`).map((t=>{const o=Ba(e,n);return{uid:n,name:t,elements:o}}))))))},Oa=(e,t)=>on(e,"data-mce-bogus")||((e,t,n)=>to(e,'[data-mce-bogus="all"]',n).isSome())(e,0,Aa(t)),Ba=(e,t)=>{const n=Cn(e.getBody()),o=zo(n,`[${_a()}="${t}"]`);return Y(o,(e=>!Oa(e,n)))},Pa=(e,t)=>{const n=Cn(e.getBody()),o=zo(n,`[${ka()}="${t}"]`),r={};return q(o,(e=>{if(!Oa(e,n)){const t=tn(e,_a()),n=Ee(r,t).getOr([]);r[t]=n.concat([e])}})),r};let Da=0;const La=e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Math.random());return Da++,e+"_"+n+Da+String(t)},Ma=(e,t)=>Cn(e.dom.cloneNode(t)),Ia=e=>Ma(e,!1),Fa=e=>Ma(e,!0),Ua=(e,t,n=L)=>{const o=new Vo(e,t),r=e=>{let t;do{t=o[e]()}while(t&&!dr(t)&&!n(t));return I.from(t).filter(dr)};return{current:()=>I.from(o.current()).filter(dr),next:()=>r("next"),prev:()=>r("prev"),prev2:()=>r("prev2")}},za=(e,t)=>{const n=t||(t=>e.isBlock(t)||pr(t)||vr(t)),o=(e,t,n,r)=>{if(dr(e)){const n=r(e,t,e.data);if(-1!==n)return I.some({container:e,offset:n})}return n().bind((e=>o(e.container,e.offset,n,r)))};return{backwards:(t,r,s,a)=>{const i=Ua(t,null!=a?a:e.getRoot(),n);return o(t,r,(()=>i.prev().map((e=>({container:e,offset:e.length})))),s).getOrNull()},forwards:(t,r,s,a)=>{const i=Ua(t,null!=a?a:e.getRoot(),n);return o(t,r,(()=>i.next().map((e=>({container:e,offset:0})))),s).getOrNull()}}},ja=((e,t)=>{const n=t=>e(t)?I.from(t.dom.nodeValue):I.none();return{get:t=>{if(!e(t))throw new Error("Can only get text value of a text node");return n(t).getOr("")},getOption:n,set:(t,n)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=n}}})(Yt),Ha=e=>ja.get(e),$a=e=>{let t;return n=>(t=t||se(e,M),ke(t,$t(n)))},Va=e=>Kt(e)&&"br"===$t(e),qa=$a(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),Wa=$a(["ul","ol","dl"]),Ka=$a(["li","dd","dt"]),Ya=$a(["thead","tbody","tfoot"]),Ga=$a(["td","th"]),Xa=$a(["pre","script","textarea","style"]),Za=()=>{const e=vn("br");return Jt(e,"data-mce-bogus","1"),e},Qa=e=>{xo(e),yo(e,Za())},Ja=qo,ei=Ko,ti=e=>e.replace(/\uFEFF/g,""),ni=er,oi=dr,ri=e=>(oi(e)&&(e=e.parentNode),ni(e)&&e.hasAttribute("data-mce-caret")),si=e=>oi(e)&&ei(e.data),ai=e=>ri(e)||si(e),ii=e=>e.firstChild!==e.lastChild||!pr(e.firstChild),li=e=>{const t=e.container();return!!dr(t)&&(t.data.charAt(e.offset())===Ja||e.isAtStart()&&si(t.previousSibling))},di=e=>{const t=e.container();return!!dr(t)&&(t.data.charAt(e.offset()-1)===Ja||e.isAtEnd()&&si(t.nextSibling))},ci=e=>oi(e)&&e.data[0]===Ja,ui=e=>oi(e)&&e.data[e.data.length-1]===Ja,mi=e=>e&&e.hasAttribute("data-mce-caret")?((e=>{var t;const n=e.getElementsByTagName("br"),o=n[n.length-1];sr(o)&&(null===(t=o.parentNode)||void 0===t||t.removeChild(o))})(e),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("data-mce-style"),e.removeAttribute("_moz_abspos"),e):null,fi=e=>ri(e.startContainer),gi=Math.round,pi=e=>e?{left:gi(e.left),top:gi(e.top),bottom:gi(e.bottom),right:gi(e.right),width:gi(e.width),height:gi(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},hi=(e,t)=>(e=pi(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),bi=(e,t,n)=>e>=0&&e<=Math.min(t.height,n.height)/2,vi=(e,t)=>{const n=Math.min(t.height/2,e.height/2);return e.bottom-nt.bottom)&&bi(t.top-e.bottom,e,t)},yi=(e,t)=>e.top>t.bottom||!(e.bottom{const o=Math.max(Math.min(t,e.left+e.width),e.left),r=Math.max(Math.min(n,e.top+e.height),e.top);return Math.sqrt((t-o)*(t-o)+(n-r)*(n-r))},wi=e=>{const t=e.startContainer,n=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===n+1?t.childNodes[n]:null},xi=(e,t)=>{if(er(e)&&e.hasChildNodes()){const n=e.childNodes,o=((e,t,n)=>Math.min(Math.max(e,0),n))(t,0,n.length-1);return n[o]}return e},Ei=new RegExp("[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1abe\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20dd-\u20e0\u20e1\u20e2-\u20e4\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\ua670-\ua672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]"),ki=e=>m(e)&&e.charCodeAt(0)>=768&&Ei.test(e),_i=br,Si=vr,Ni=pr,Ri=dr,Ai=or(["script","style","textarea"]),Ti=or(["img","input","textarea","hr","iframe","video","audio","object","embed"]),Oi=or(["table"]),Bi=ai,Pi=e=>!Bi(e)&&(Ri(e)?!Ai(e.parentNode):Ti(e)||Ni(e)||Oi(e)||Di(e)),Di=e=>!(e=>er(e)&&"true"===e.getAttribute("unselectable"))(e)&&Si(e),Li=(e,t)=>Pi(e)&&((e,t)=>{for(let n=e.parentNode;n&&n!==t;n=n.parentNode){if(Di(n))return!1;if(_i(n))return!0}return!0})(e,t),Mi=er,Ii=Pi,Fi=rr("display","block table"),Ui=rr("float","left right"),zi=((...e)=>t=>{for(let n=0;nt<0&&er(e)&&e.hasChildNodes()?void 0:xi(e,t),Wi=e=>e?e.createRange():fa.DOM.createRng(),Ki=e=>m(e)&&/[\r\n\t ]/.test(e),Yi=e=>!!e.setStart&&!!e.setEnd,Gi=e=>{const t=e.startContainer,n=e.startOffset;if(Ki(e.toString())&&ji(t.parentNode)&&dr(t)){const e=t.data;if(Ki(e[n-1])||Ki(e[n+1]))return!0}return!1},Xi=e=>0===e.left&&0===e.right&&0===e.top&&0===e.bottom,Zi=e=>{var t;let n;const o=e.getClientRects();return n=o.length>0?pi(o[0]):pi(e.getBoundingClientRect()),!Yi(e)&&$i(e)&&Xi(n)?(e=>{const t=e.ownerDocument,n=Wi(t),o=t.createTextNode(Wo),r=e.parentNode;r.insertBefore(o,e),n.setStart(o,0),n.setEnd(o,1);const s=pi(n.getBoundingClientRect());return r.removeChild(o),s})(e):Xi(n)&&Yi(e)&&null!==(t=(e=>{const t=e.startContainer,n=e.endContainer,o=e.startOffset,r=e.endOffset;if(t===n&&dr(n)&&0===o&&1===r){const t=e.cloneRange();return t.setEndAfter(n),Zi(t)}return null})(e))&&void 0!==t?t:n},Qi=(e,t)=>{const n=hi(e,t);return n.width=1,n.right=n.left+1,n},Ji=(e,t,n)=>{const o=()=>(n||(n=(e=>{const t=[],n=e=>{var n,o;0!==e.height&&(t.length>0&&(n=e,o=t[t.length-1],n.left===o.left&&n.top===o.top&&n.bottom===o.bottom&&n.right===o.right)||t.push(e))},o=(e,t)=>{const o=Wi(e.ownerDocument);if(t0&&(o.setStart(e,t-1),o.setEnd(e,t),Gi(o)||n(Qi(Zi(o),!1))),t{const n=Wi(e.ownerDocument);return n.setStart(e,t),n.setEnd(e,t),n},getClientRects:o,isVisible:()=>o().length>0,isAtStart:()=>(Hi(e),0===t),isAtEnd:()=>Hi(e)?t>=e.data.length:t>=e.childNodes.length,isEqual:n=>n&&e===n.container()&&t===n.offset(),getNode:n=>qi(e,n?t-1:t)}};Ji.fromRangeStart=e=>Ji(e.startContainer,e.startOffset),Ji.fromRangeEnd=e=>Ji(e.endContainer,e.endOffset),Ji.after=e=>Ji(e.parentNode,Vi(e)+1),Ji.before=e=>Ji(e.parentNode,Vi(e)),Ji.isAbove=(e,t)=>It(le(t.getClientRects()),de(e.getClientRects()),vi).getOr(!1),Ji.isBelow=(e,t)=>It(de(t.getClientRects()),le(e.getClientRects()),yi).getOr(!1),Ji.isAtStart=e=>!!e&&e.isAtStart(),Ji.isAtEnd=e=>!!e&&e.isAtEnd(),Ji.isTextPosition=e=>!!e&&dr(e.container()),Ji.isElementPosition=e=>!Ji.isTextPosition(e);const el=(e,t)=>{dr(t)&&0===t.data.length&&e.remove(t)},tl=(e,t,n)=>{gr(n)?((e,t,n)=>{const o=I.from(n.firstChild),r=I.from(n.lastChild);t.insertNode(n),o.each((t=>el(e,t.previousSibling))),r.each((t=>el(e,t.nextSibling)))})(e,t,n):((e,t,n)=>{t.insertNode(n),el(e,n.previousSibling),el(e,n.nextSibling)})(e,t,n)},nl=dr,ol=sr,rl=fa.nodeIndex,sl=e=>{const t=e.parentNode;return ol(t)?sl(t):t},al=e=>e?Be(e.childNodes,((e,t)=>(ol(t)&&"BR"!==t.nodeName?e=e.concat(al(t)):e.push(t),e)),[]):[],il=e=>t=>e===t,ll=e=>(nl(e)?"text()":e.nodeName.toLowerCase())+"["+(e=>{let t,n;t=al(sl(e)),n=Pe(t,il(e),e),t=t.slice(0,n+1);const o=Be(t,((e,n,o)=>(nl(n)&&nl(t[o-1])&&e++,e)),0);return t=Oe(t,or([e.nodeName])),n=Pe(t,il(e),e),n-o})(e)+"]",dl=(e,t)=>{let n,o=[],r=t.container(),s=t.offset();if(nl(r))n=((e,t)=>{let n=e;for(;(n=n.previousSibling)&&nl(n);)t+=n.data.length;return t})(r,s);else{const e=r.childNodes;s>=e.length?(n="after",s=e.length-1):n="before",r=e[s]}o.push(ll(r));let a=((e,t,n)=>{const o=[];for(let n=t.parentNode;n&&n!==e;n=n.parentNode)o.push(n);return o})(e,r);return a=Oe(a,O(sr)),o=o.concat(Te(a,(e=>ll(e)))),o.reverse().join("/")+","+n},cl=(e,t)=>{if(!t)return null;const n=t.split(","),o=n[0].split("/"),r=n.length>1?n[1]:"before",s=Be(o,((e,t)=>{const n=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t);return n?("text()"===n[1]&&(n[1]="#text"),((e,t,n)=>{let o=al(e);return o=Oe(o,((e,t)=>!nl(e)||!nl(o[t-1]))),o=Oe(o,or([t])),o[n]})(e,n[1],parseInt(n[2],10))):null}),e);if(!s)return null;if(!nl(s)&&s.parentNode){let e;return e="after"===r?rl(s)+1:rl(s),Ji(s.parentNode,e)}return((e,t)=>{let n=e,o=0;for(;nl(n);){const r=n.data.length;if(t>=o&&t<=o+r){e=n,t-=o;break}if(!nl(n.nextSibling)){e=n,t=r;break}o+=r,n=n.nextSibling}return nl(e)&&t>e.data.length&&(t=e.data.length),Ji(e,t)})(s,parseInt(r,10))},ul=vr,ml=(e,t,n,o,r)=>{const s=r?o.startContainer:o.endContainer;let a=r?o.startOffset:o.endOffset;const i=[],l=e.getRoot();if(dr(s))i.push(n?((e,t,n)=>{let o=e(t.data.slice(0,n)).length;for(let n=t.previousSibling;n&&dr(n);n=n.previousSibling)o+=e(n.data).length;return o})(t,s,a):a);else{let t=0;const o=s.childNodes;a>=o.length&&o.length&&(t=1,a=Math.max(0,o.length-1)),i.push(e.nodeIndex(o[a],n)+t)}for(let t=s;t&&t!==l;t=t.parentNode)i.push(e.nodeIndex(t,n));return i},fl=(e,t,n)=>{let o=0;return Dt.each(e.select(t),(e=>"all"===e.getAttribute("data-mce-bogus")?void 0:e!==n&&void o++)),o},gl=(e,t)=>{let n=t?e.startContainer:e.endContainer,o=t?e.startOffset:e.endOffset;if(er(n)&&"TR"===n.nodeName){const r=n.childNodes;n=r[Math.min(t?o:o-1,r.length-1)],n&&(o=t?0:n.childNodes.length,t?e.setStart(n,o):e.setEnd(n,o))}},pl=e=>(gl(e,!0),gl(e,!1),e),hl=(e,t)=>{if(er(e)&&(e=xi(e,t),ul(e)))return e;if(ai(e)){dr(e)&&ri(e)&&(e=e.parentNode);let t=e.previousSibling;if(ul(t))return t;if(t=e.nextSibling,ul(t))return t}},bl=(e,t,n)=>{const o=n.getNode(),r=n.getRng();if("IMG"===o.nodeName||ul(o)){const e=o.nodeName;return{name:e,index:fl(n.dom,e,o)}}const s=(e=>hl(e.startContainer,e.startOffset)||hl(e.endContainer,e.endOffset))(r);if(s){const e=s.tagName;return{name:e,index:fl(n.dom,e,s)}}return((e,t,n,o)=>{const r=t.dom,s=ml(r,e,n,o,!0),a=t.isForward(),i=fi(o)?{isFakeCaret:!0}:{};return t.isCollapsed()?{start:s,forward:a,...i}:{start:s,end:ml(r,e,n,o,!1),forward:a,...i}})(e,n,t,r)},vl=(e,t,n)=>{const o={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return n?e.create("span",o,""):e.create("span",o)},yl=(e,t)=>{const n=e.dom;let o=e.getRng();const r=n.uniqueId(),s=e.isCollapsed(),a=e.getNode(),i=a.nodeName,l=e.isForward();if("IMG"===i)return{name:i,index:fl(n,i,a)};const d=pl(o.cloneRange());if(!s){d.collapse(!1);const e=vl(n,r+"_end",t);tl(n,d,e)}o=pl(o),o.collapse(!0);const c=vl(n,r+"_start",t);return tl(n,o,c),e.moveToBookmark({id:r,keep:!0,forward:l}),{id:r,forward:l}},Cl=T(bl,R,!0),wl=e=>{const t=t=>t(e),n=N(e),o=()=>r,r={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:M,isError:L,map:t=>El.value(t(e)),mapError:o,bind:t,exists:t,forall:t,getOr:n,or:o,getOrThunk:n,orThunk:o,getOrDie:n,each:t=>{t(e)},toOptional:()=>I.some(e)};return r},xl=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:L,isError:M,map:t,mapError:t=>El.error(t(e)),bind:t,exists:L,forall:M,getOr:R,or:R,getOrThunk:P,orThunk:P,getOrDie:B(String(e)),each:k,toOptional:I.none};return n},El={value:wl,error:xl,fromOption:(e,t)=>e.fold((()=>xl(t)),wl)},kl=e=>{if(!p(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=[],n={};return q(e,((o,r)=>{const s=fe(o);if(1!==s.length)throw new Error("one and only one name per case");const a=s[0],i=o[a];if(void 0!==n[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!p(i))throw new Error("case arguments must be an array");t.push(a),n[a]=(...n)=>{const o=n.length;if(o!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+o);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,n)},match:e=>{const o=fe(e);if(t.length!==o.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+o.join(","));if(!ne(t,(e=>H(o,e))))throw new Error("Not all branches were specified when using match. Specified: "+o.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:a,params:n})}}}})),n};kl([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const _l=e=>"inline-command"===e.type||"inline-format"===e.type,Sl=e=>"block-command"===e.type||"block-format"===e.type,Nl=e=>{var t;const n=t=>El.error({message:t,pattern:e}),o=(t,o,r)=>{if(void 0!==e.format){let r;if(p(e.format)){if(!ne(e.format,m))return n(t+" pattern has non-string items in the `format` array");r=e.format}else{if(!m(e.format))return n(t+" pattern has non-string `format` parameter");r=[e.format]}return El.value(o(r))}return void 0!==e.cmd?m(e.cmd)?El.value(r(e.cmd,e.value)):n(t+" pattern has non-string `cmd` parameter"):n(t+" pattern is missing both `format` and `cmd` parameters")};if(!f(e))return n("Raw pattern is not an object");if(!m(e.start))return n("Raw pattern is missing `start` parameter");if(void 0!==e.end){if(!m(e.end))return n("Inline pattern has non-string `end` parameter");if(0===e.start.length&&0===e.end.length)return n("Inline pattern has empty `start` and `end` parameters");let t=e.start,r=e.end;return 0===r.length&&(r=t,t=""),o("Inline",(e=>({type:"inline-format",start:t,end:r,format:e})),((e,n)=>({type:"inline-command",start:t,end:r,cmd:e,value:n})))}if(void 0!==e.replacement)return m(e.replacement)?0===e.start.length?n("Replacement pattern has empty `start` parameter"):El.value({type:"inline-command",start:"",end:e.start,cmd:"mceInsertContent",value:e.replacement}):n("Replacement pattern has non-string `replacement` parameter");{const r=null!==(t=e.trigger)&&void 0!==t?t:"space";return 0===e.start.length?n("Block pattern has empty `start` parameter"):o("Block",(t=>({type:"block-format",start:e.start,format:t[0],trigger:r})),((t,n)=>({type:"block-command",start:e.start,cmd:t,value:n,trigger:r})))}},Rl=e=>Y(e,Sl),Al=e=>Y(e,_l),Tl=(e,t)=>({...e,blockPatterns:Y(e.blockPatterns,(e=>((e,t)=>("block-command"===e.type||"block-format"===e.type)&&e.trigger===t)(e,t)))}),Ol=e=>{const t=(e=>{const t=[],n=[];return q(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{n.push(e)}))})),{errors:t,values:n}})(V(e,Nl));return q(t.errors,(e=>console.error(e.message,e.pattern))),t.values},Bl=Et().deviceType,Pl=Bl.isTouch(),Dl=fa.DOM,Ll=e=>u(e,RegExp),Ml=e=>t=>t.options.get(e),Il=e=>m(e)||f(e),Fl=(e,t="")=>n=>{const o=m(n);if(o){if(-1!==n.indexOf("=")){const r=(e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return X(t,((e,t)=>{const n=t.split("="),o=n[0],r=n.length>1?n[1]:o;return e[We(o)]=We(r),e}),{})})(n);return{value:Ee(r,e.id).getOr(t),valid:o}}return{value:n,valid:o}}return{valid:!1,message:"Must be a string."}},Ul=Ml("iframe_attrs"),zl=Ml("doctype"),jl=Ml("document_base_url"),Hl=Ml("body_id"),$l=Ml("body_class"),Vl=Ml("content_security_policy"),ql=Ml("br_in_pre"),Wl=Ml("forced_root_block"),Kl=Ml("forced_root_block_attrs"),Yl=Ml("newline_behavior"),Gl=Ml("br_newline_selector"),Xl=Ml("no_newline_selector"),Zl=Ml("keep_styles"),Ql=Ml("end_container_on_empty_block"),Jl=Ml("automatic_uploads"),ed=Ml("images_reuse_filename"),td=Ml("images_replace_blob_uris"),nd=Ml("icons"),od=Ml("icons_url"),rd=Ml("images_upload_url"),sd=Ml("images_upload_base_path"),ad=Ml("images_upload_credentials"),id=Ml("images_upload_handler"),ld=Ml("content_css_cors"),dd=Ml("referrer_policy"),cd=Ml("language"),ud=Ml("language_url"),md=Ml("indent_use_margin"),fd=Ml("indentation"),gd=Ml("content_css"),pd=Ml("content_style"),hd=Ml("font_css"),bd=Ml("directionality"),vd=Ml("inline_boundaries_selector"),yd=Ml("object_resizing"),Cd=Ml("resize_img_proportional"),wd=Ml("placeholder"),xd=Ml("event_root"),Ed=Ml("service_message"),kd=Ml("theme"),_d=Ml("theme_url"),Sd=Ml("model"),Nd=Ml("model_url"),Rd=Ml("inline_boundaries"),Ad=Ml("formats"),Td=Ml("preview_styles"),Od=Ml("format_empty_lines"),Bd=Ml("format_noneditable_selector"),Pd=Ml("custom_ui_selector"),Dd=Ml("inline"),Ld=Ml("hidden_input"),Md=Ml("submit_patch"),Id=Ml("add_form_submit_trigger"),Fd=Ml("add_unload_trigger"),Ud=Ml("custom_undo_redo_levels"),zd=Ml("disable_nodechange"),jd=Ml("readonly"),Hd=Ml("editable_root"),$d=Ml("content_css_cors"),Vd=Ml("plugins"),qd=Ml("external_plugins"),Wd=Ml("block_unsupported_drop"),Kd=Ml("visual"),Yd=Ml("visual_table_class"),Gd=Ml("visual_anchor_class"),Xd=Ml("iframe_aria_text"),Zd=Ml("setup"),Qd=Ml("init_instance_callback"),Jd=Ml("urlconverter_callback"),ec=Ml("auto_focus"),tc=Ml("browser_spellcheck"),nc=Ml("protect"),oc=Ml("paste_block_drop"),rc=Ml("paste_data_images"),sc=Ml("paste_preprocess"),ac=Ml("paste_postprocess"),ic=Ml("newdocument_content"),lc=Ml("paste_webkit_styles"),dc=Ml("paste_remove_styles_if_webkit"),cc=Ml("paste_merge_formats"),uc=Ml("smart_paste"),mc=Ml("paste_as_text"),fc=Ml("paste_tab_spaces"),gc=Ml("allow_html_data_urls"),pc=Ml("text_patterns"),hc=Ml("text_patterns_lookup"),bc=Ml("noneditable_class"),vc=Ml("editable_class"),yc=Ml("noneditable_regexp"),Cc=Ml("preserve_cdata"),wc=Ml("highlight_on_focus"),xc=Ml("xss_sanitization"),Ec=Ml("init_content_sync"),kc=e=>Dt.explode(e.options.get("images_file_types")),_c=Ml("table_tab_navigation"),Sc=Ml("details_initial_state"),Nc=Ml("details_serialized_state"),Rc=Ml("sandbox_iframes"),Ac=e=>e.options.get("sandbox_iframes_exclusions"),Tc=Ml("convert_unsafe_embeds"),Oc=Ml("license_key"),Bc=Ml("api_key"),Pc=er,Dc=dr,Lc=e=>{const t=e.parentNode;t&&t.removeChild(e)},Mc=e=>{const t=ti(e);return{count:e.length-t.length,text:t}},Ic=e=>{let t;for(;-1!==(t=e.data.lastIndexOf(Ja));)e.deleteData(t,1)},Fc=(e,t)=>(zc(e),t),Uc=(e,t)=>Ji.isTextPosition(t)?((e,t)=>Dc(e)&&t.container()===e?((e,t)=>{const n=Mc(e.data.substr(0,t.offset())),o=Mc(e.data.substr(t.offset()));return(n.text+o.text).length>0?(Ic(e),Ji(e,t.offset()-n.count)):t})(e,t):Fc(e,t))(e,t):((e,t)=>t.container()===e.parentNode?((e,t)=>{const n=t.container(),o=((e,t)=>{const n=j(e,t);return-1===n?I.none():I.some(n)})(ce(n.childNodes),e).map((e=>e{Pc(e)&&ai(e)&&(ii(e)?e.removeAttribute("data-mce-caret"):Lc(e)),Dc(e)&&(Ic(e),0===e.data.length&&Lc(e))},jc=vr,Hc=wr,$c=yr,Vc=(e,t,n)=>{const o=hi(t.getBoundingClientRect(),n);let r,s;if("BODY"===e.tagName){const t=e.ownerDocument.documentElement;r=e.scrollLeft||t.scrollLeft,s=e.scrollTop||t.scrollTop}else{const t=e.getBoundingClientRect();r=e.scrollLeft-t.left,s=e.scrollTop-t.top}o.left+=r,o.right+=r,o.top+=s,o.bottom+=s,o.width=1;let a=t.offsetWidth-t.clientWidth;return a>0&&(n&&(a*=-1),o.left+=a,o.right+=a),o},qc=(e,t,n,o)=>{const r=Dr();let s,a;const i=Wl(e),l=e.dom,d=()=>{(e=>{var t,n;const o=zo(Cn(e),"*[contentEditable=false],video,audio,embed,object");for(let e=0;e{l.remove(e.caret),r.clear()})),s&&(clearInterval(s),s=void 0)};return{show:(e,c)=>{let u;if(d(),$c(c))return null;if(!n(c))return a=((e,t)=>{var n;const o=(null!==(n=e.ownerDocument)&&void 0!==n?n:document).createTextNode(Ja),r=e.parentNode;if(t){const t=e.previousSibling;if(oi(t)){if(ai(t))return t;if(ui(t))return t.splitText(t.data.length-1)}null==r||r.insertBefore(o,e)}else{const t=e.nextSibling;if(oi(t)){if(ai(t))return t;if(ci(t))return t.splitText(1),t}e.nextSibling?null==r||r.insertBefore(o,e.nextSibling):null==r||r.appendChild(o)}return o})(c,e),u=c.ownerDocument.createRange(),Kc(a.nextSibling)?(u.setStart(a,0),u.setEnd(a,0)):(u.setStart(a,1),u.setEnd(a,1)),u;{const n=((e,t,n)=>{var o;const r=(null!==(o=t.ownerDocument)&&void 0!==o?o:document).createElement(e);r.setAttribute("data-mce-caret",n?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(Za().dom);const s=t.parentNode;return n?null==s||s.insertBefore(r,t):t.nextSibling?null==s||s.insertBefore(r,t.nextSibling):null==s||s.appendChild(r),r})(i,c,e),d=Vc(t,c,e);l.setStyle(n,"top",d.top),l.setStyle(n,"caret-color","transparent"),a=n;const m=l.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});l.setStyles(m,{...d}),l.add(t,m),r.set({caret:m,element:c,before:e}),e&&l.addClass(m,"mce-visual-caret-before"),s=setInterval((()=>{r.on((e=>{o()?l.toggleClass(e.caret,"mce-visual-caret-hidden"):l.addClass(e.caret,"mce-visual-caret-hidden")}))}),500),u=c.ownerDocument.createRange(),u.setStart(n,0),u.setEnd(n,0)}return u},hide:d,getCss:()=>".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}",reposition:()=>{r.on((e=>{const n=Vc(t,e.element,e.before);l.setStyles(e.caret,{...n})}))},destroy:()=>clearInterval(s)}},Wc=()=>Tt.browser.isFirefox(),Kc=e=>jc(e)||Hc(e),Yc=e=>(Kc(e)||ar(e)&&Wc())&&On(Cn(e)).exists(ro),Gc=br,Xc=vr,Zc=wr,Qc=rr("display","block table table-cell table-caption list-item"),Jc=ai,eu=ri,tu=er,nu=dr,ou=Pi,ru=e=>e>0,su=e=>e<0,au=(e,t)=>{let n;for(;n=e(t);)if(!eu(n))return n;return null},iu=(e,t,n,o,r)=>{const s=new Vo(e,o),a=Xc(e)||eu(e);let i;if(su(t)){if(a&&(i=au(s.prev.bind(s),!0),n(i)))return i;for(;i=au(s.prev.bind(s),r);)if(n(i))return i}if(ru(t)){if(a&&(i=au(s.next.bind(s),!0),n(i)))return i;for(;i=au(s.next.bind(s),r);)if(n(i))return i}return null},lu=(e,t)=>{for(;e&&e!==t;){if(Qc(e))return e;e=e.parentNode}return null},du=(e,t,n)=>lu(e.container(),n)===lu(t.container(),n),cu=(e,t)=>{if(!t)return I.none();const n=t.container(),o=t.offset();return tu(n)?I.from(n.childNodes[o+e]):I.none()},uu=(e,t)=>{var n;const o=(null!==(n=t.ownerDocument)&&void 0!==n?n:document).createRange();return e?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)),o},mu=(e,t,n)=>lu(t,e)===lu(n,e),fu=(e,t,n)=>{const o=e?"previousSibling":"nextSibling";let r=n;for(;r&&r!==t;){let e=r[o];if(e&&Jc(e)&&(e=e[o]),Xc(e)||Zc(e)){if(mu(t,e,r))return e;break}if(ou(e))break;r=r.parentNode}return null},gu=T(uu,!0),pu=T(uu,!1),hu=(e,t,n)=>{let o;const r=T(fu,!0,t),s=T(fu,!1,t),a=n.startContainer,i=n.startOffset;if(ri(a)){const e=nu(a)?a.parentNode:a,t=e.getAttribute("data-mce-caret");if("before"===t&&(o=e.nextSibling,Yc(o)))return gu(o);if("after"===t&&(o=e.previousSibling,Yc(o)))return pu(o)}if(!n.collapsed)return n;if(dr(a)){if(Jc(a)){if(1===e){if(o=s(a),o)return gu(o);if(o=r(a),o)return pu(o)}if(-1===e){if(o=r(a),o)return pu(o);if(o=s(a),o)return gu(o)}return n}if(ui(a)&&i>=a.data.length-1)return 1===e&&(o=s(a),o)?gu(o):n;if(ci(a)&&i<=1)return-1===e&&(o=r(a),o)?pu(o):n;if(i===a.data.length)return o=s(a),o?gu(o):n;if(0===i)return o=r(a),o?pu(o):n}return n},bu=(e,t)=>cu(e?0:-1,t).filter(Xc),vu=(e,t,n)=>{const o=hu(e,t,n);return-1===e?Ji.fromRangeStart(o):Ji.fromRangeEnd(o)},yu=e=>I.from(e.getNode()).map(Cn),Cu=(e,t)=>{let n=t;for(;n=e(n);)if(n.isVisible())return n;return n},wu=(e,t)=>{const n=du(e,t);return!(n||!pr(e.getNode()))||n};var xu;!function(e){e[e.Backwards=-1]="Backwards",e[e.Forwards=1]="Forwards"}(xu||(xu={}));const Eu=vr,ku=dr,_u=er,Su=pr,Nu=Pi,Ru=e=>Ti(e)||(e=>!!Di(e)&&!X(ce(e.getElementsByTagName("*")),((e,t)=>e||_i(t)),!1))(e),Au=Li,Tu=(e,t)=>e.hasChildNodes()&&t{if(ru(e)){if(Nu(t.previousSibling)&&!ku(t.previousSibling))return Ji.before(t);if(ku(t))return Ji(t,0)}if(su(e)){if(Nu(t.nextSibling)&&!ku(t.nextSibling))return Ji.after(t);if(ku(t))return Ji(t,t.data.length)}return su(e)?Su(t)?Ji.before(t):Ji.after(t):Ji.before(t)},Bu=(e,t,n)=>{let o,r,s,a;if(!_u(n)||!t)return null;if(t.isEqual(Ji.after(n))&&n.lastChild){if(a=Ji.after(n.lastChild),su(e)&&Nu(n.lastChild)&&_u(n.lastChild))return Su(n.lastChild)?Ji.before(n.lastChild):a}else a=t;const i=a.container();let l=a.offset();if(ku(i)){if(su(e)&&l>0)return Ji(i,--l);if(ru(e)&&l0&&(r=Tu(i,l-1),Nu(r)))return!Ru(r)&&(s=iu(r,e,Au,r),s)?ku(s)?Ji(s,s.data.length):Ji.after(s):ku(r)?Ji(r,r.data.length):Ji.before(r);if(ru(e)&&l{const n=t.nextSibling;return n&&Nu(n)?ku(n)?Ji(n,0):Ji.before(n):Bu(xu.Forwards,Ji.after(t),e)})(n,r):!Ru(r)&&(s=iu(r,e,Au,r),s)?ku(s)?Ji(s,0):Ji.before(s):ku(r)?Ji(r,0):Ji.after(r);o=r||a.getNode()}if(o&&(ru(e)&&a.isAtEnd()||su(e)&&a.isAtStart())&&(o=iu(o,e,M,n,!0),Au(o,n)))return Ou(e,o);r=o?iu(o,e,Au,n):o;const d=De(Y(((e,t)=>{const n=[];let o=e;for(;o&&o!==t;)n.push(o),o=o.parentNode;return n})(i,n),Eu));return!d||r&&d.contains(r)?r?Ou(e,r):null:(a=ru(e)?Ji.after(d):Ji.before(d),a)},Pu=e=>({next:t=>Bu(xu.Forwards,t,e),prev:t=>Bu(xu.Backwards,t,e)}),Du=e=>Ji.isTextPosition(e)?0===e.offset():Pi(e.getNode()),Lu=e=>{if(Ji.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}return Pi(e.getNode(!0))},Mu=(e,t)=>!Ji.isTextPosition(e)&&!Ji.isTextPosition(t)&&e.getNode()===t.getNode(!0),Iu=(e,t,n)=>{const o=Pu(t);return I.from(e?o.next(n):o.prev(n))},Fu=(e,t,n)=>Iu(e,t,n).bind((o=>du(n,o,t)&&((e,t,n)=>{return e?!Mu(t,n)&&(o=t,!(!Ji.isTextPosition(o)&&pr(o.getNode())))&&Lu(t)&&Du(n):!Mu(n,t)&&Du(t)&&Lu(n);var o})(e,n,o)?Iu(e,t,o):I.some(o))),Uu=(e,t,n,o)=>Fu(e,t,n).bind((n=>o(n)?Uu(e,t,n,o):I.some(n))),zu=(e,t)=>{const n=e?t.firstChild:t.lastChild;return dr(n)?I.some(Ji(n,e?0:n.data.length)):n?Pi(n)?I.some(e?Ji.before(n):pr(o=n)?Ji.before(o):Ji.after(o)):((e,t,n)=>{const o=e?Ji.before(n):Ji.after(n);return Iu(e,t,o)})(e,t,n):I.none();var o},ju=T(Iu,!0),Hu=T(Iu,!1),$u=T(zu,!0),Vu=T(zu,!1),qu="_mce_caret",Wu=e=>er(e)&&e.id===qu,Ku=(e,t)=>{let n=t;for(;n&&n!==e;){if(Wu(n))return n;n=n.parentNode}return null},Yu=e=>ke(e,"name"),Gu=e=>Dt.isArray(e.start),Xu=e=>!(!Yu(e)&&b(e.forward))||e.forward,Zu=(e,t)=>(er(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='
'),t),Qu=(e,t)=>Vu(e).fold(L,(e=>(t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0))),Ju=(e,t,n)=>!(!(e=>!e.hasChildNodes())(t)||!Ku(e,t)||(((e,t)=>{var n;const o=(null!==(n=e.ownerDocument)&&void 0!==n?n:document).createTextNode(Ja);e.appendChild(o),t.setStart(o,0),t.setEnd(o,0)})(t,n),0)),em=(e,t,n,o)=>{const r=n[t?"start":"end"],s=e.getRoot();if(r){let e=s,n=r[0];for(let t=r.length-1;e&&t>=1;t--){const n=e.childNodes;if(Ju(s,e,o))return!0;if(r[t]>n.length-1)return!!Ju(s,e,o)||Qu(e,o);e=n[r[t]]}dr(e)&&(n=Math.min(r[0],e.data.length)),er(e)&&(n=Math.min(r[0],e.childNodes.length)),t?o.setStart(e,n):o.setEnd(e,n)}return!0},tm=e=>dr(e)&&e.data.length>0,nm=(e,t,n)=>{const o=e.get(n.id+"_"+t),r=null==o?void 0:o.parentNode,s=n.keep;if(o&&r){let a,i;if("start"===t?s?o.hasChildNodes()?(a=o.firstChild,i=1):tm(o.nextSibling)?(a=o.nextSibling,i=0):tm(o.previousSibling)?(a=o.previousSibling,i=o.previousSibling.data.length):(a=r,i=e.nodeIndex(o)+1):(a=r,i=e.nodeIndex(o)):s?o.hasChildNodes()?(a=o.firstChild,i=1):tm(o.previousSibling)?(a=o.previousSibling,i=o.previousSibling.data.length):(a=r,i=e.nodeIndex(o)):(a=r,i=e.nodeIndex(o)),!s){const r=o.previousSibling,s=o.nextSibling;let l;for(Dt.each(Dt.grep(o.childNodes),(e=>{dr(e)&&(e.data=e.data.replace(/\uFEFF/g,""))}));l=e.get(n.id+"_"+t);)e.remove(l,!0);if(dr(s)&&dr(r)&&!Tt.browser.isOpera()){const t=r.data.length;r.appendData(s.data),e.remove(s),a=r,i=t}}return I.some(Ji(a,i))}return I.none()},om=(e,t,n)=>((e,t,n=!1)=>2===t?bl(ti,n,e):3===t?(e=>{const t=e.getRng();return{start:dl(e.dom.getRoot(),Ji.fromRangeStart(t)),end:dl(e.dom.getRoot(),Ji.fromRangeEnd(t)),forward:e.isForward()}})(e):t?(e=>({rng:e.getRng(),forward:e.isForward()}))(e):yl(e,!1))(e,t,n),rm=(e,t)=>{((e,t)=>{const n=e.dom;if(t){if(Gu(t))return((e,t)=>{const n=e.createRng();return em(e,!0,t,n)&&em(e,!1,t,n)?I.some({range:n,forward:Xu(t)}):I.none()})(n,t);if((e=>m(e.start))(t))return((e,t)=>{const n=I.from(cl(e.getRoot(),t.start)),o=I.from(cl(e.getRoot(),t.end));return It(n,o,((n,o)=>{const r=e.createRng();return r.setStart(n.container(),n.offset()),r.setEnd(o.container(),o.offset()),{range:r,forward:Xu(t)}}))})(n,t);if((e=>ke(e,"id"))(t))return((e,t)=>{const n=nm(e,"start",t),o=nm(e,"end",t);return It(n,o.or(n),((n,o)=>{const r=e.createRng();return r.setStart(Zu(e,n.container()),n.offset()),r.setEnd(Zu(e,o.container()),o.offset()),{range:r,forward:Xu(t)}}))})(n,t);if(Yu(t))return((e,t)=>I.from(e.select(t.name)[t.index]).map((t=>{const n=e.createRng();return n.selectNode(t),{range:n,forward:!0}})))(n,t);if((e=>ke(e,"rng"))(t))return I.some({range:t.rng,forward:Xu(t)})}return I.none()})(e,t).each((({range:t,forward:n})=>{e.setRng(t,n)}))},sm=e=>er(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type"),am=(im=Wo,e=>im===e);var im;const lm=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),dm=e=>!lm(e)&&!am(e)&&!Ko(e),cm=e=>{const t=[];if(e)for(let n=0;n{const n=zo(t,"td[data-mce-selected],th[data-mce-selected]");return n.length>0?n:(e=>Y((e=>te(e,(e=>{const t=wi(e);return t?[Cn(t)]:[]})))(e),Ga))(e)},mm=e=>um(cm(e.selection.getSel()),Cn(e.getBody())),fm=(e,t)=>to(e,"table",t),gm=e=>Un(e).fold(N([e]),(t=>[e].concat(gm(t)))),pm=e=>zn(e).fold(N([e]),(t=>"br"===$t(t)?Pn(t).map((t=>[e].concat(pm(t)))).getOr([]):[e].concat(pm(t)))),hm=(e,t)=>It((e=>{const t=e.startContainer,n=e.startOffset;return dr(t)?0===n?I.some(Cn(t)):I.none():I.from(t.childNodes[n]).map(Cn)})(t),(e=>{const t=e.endContainer,n=e.endOffset;return dr(t)?n===t.data.length?I.some(Cn(t)):I.none():I.from(t.childNodes[n-1]).map(Cn)})(t),((t,n)=>{const o=Q(gm(e),T(_n,t)),r=Q(pm(e),T(_n,n));return o.isSome()&&r.isSome()})).getOr(!1),bm=(e,t,n,o)=>{const r=n,s=new Vo(n,r),a=Ce(e.schema.getMoveCaretBeforeOnEnterElements(),((e,t)=>!H(["td","th","table"],t.toLowerCase())));let i=n;do{if(dr(i)&&0!==Dt.trim(i.data).length)return void(o?t.setStart(i,0):t.setEnd(i,i.data.length));if(a[i.nodeName])return void(o?t.setStartBefore(i):"BR"===i.nodeName?t.setEndBefore(i):t.setEndAfter(i))}while(i=o?s.next():s.prev());"BODY"===r.nodeName&&(o?t.setStart(r,0):t.setEnd(r,r.childNodes.length))},vm=e=>{const t=e.selection.getSel();return C(t)&&t.rangeCount>0},ym=(e,t)=>{const n=mm(e);n.length>0?q(n,(n=>{const o=n.dom,r=e.dom.createRng();r.setStartBefore(o),r.setEndAfter(o),t(r,!0)})):t(e.selection.getRng(),!1)},Cm=(e,t,n)=>{const o=yl(e,t);n(o),e.moveToBookmark(o)},wm=e=>x(null==e?void 0:e.nodeType),xm=e=>er(e)&&!sm(e)&&!Wu(e)&&!sr(e),Em=(e,t,n)=>{const{selection:o,dom:r}=e,s=o.getNode(),a=vr(s);Cm(o,!0,(()=>{t()})),a&&vr(s)&&r.isChildOf(s,e.getBody())?e.selection.select(s):n(o.getStart())&&km(r,o)},km=(e,t)=>{var n,o;const r=t.getRng(),{startContainer:s,startOffset:a}=r;if(!((e,t)=>{if(xm(t)&&!/^(TD|TH)$/.test(t.nodeName)){const n=e.getAttrib(t,"data-mce-selected"),o=parseInt(n,10);return!isNaN(o)&&o>0}return!1})(e,t.getNode())&&er(s)){const i=s.childNodes,l=e.getRoot();let d;if(a{if(e){const o=t?"nextSibling":"previousSibling";for(e=n?e:e[o];e;e=e[o])if(er(e)||!Rm(e))return e}},Sm=(e,t)=>!!e.getTextBlockElements()[t.nodeName.toLowerCase()]||Zr(e,t),Nm=(e,t,n)=>e.schema.isValidChild(t,n),Rm=(e,t=!1)=>{if(C(e)&&dr(e)){const n=t?e.data.replace(/ /g,"\xa0"):e.data;return Go(n)}return!1},Am=(e,t)=>{const n=e.dom;return xm(t)&&"false"===n.getContentEditable(t)&&((e,t)=>{const n="[data-mce-cef-wrappable]",o=Bd(e),r=Xe(o)?n:`${n},${o}`;return En(Cn(t),r)})(e,t)&&0===n.select('[contenteditable="true"]',t).length},Tm=(e,t)=>w(e)?e(t):(C(t)&&(e=e.replace(/%(\w+)/g,((e,n)=>t[n]||e))),e),Om=(e,t)=>(t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),Bm=(e,t)=>{if(y(e))return null;{let n=String(e);return"color"!==t&&"backgroundColor"!==t||(n=Ks(n)),"fontWeight"===t&&700===e&&(n="bold"),"fontFamily"===t&&(n=n.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),n}},Pm=(e,t,n)=>{const o=e.getStyle(t,n);return Bm(o,n)},Dm=(e,t)=>{let n;return e.getParent(t,(t=>!!er(t)&&(n=e.getStyle(t,"text-decoration"),!!n&&"none"!==n))),n},Lm=(e,t,n)=>e.getParents(t,n,e.getRoot()),Mm=(e,t,n)=>{const o=e.formatter.get(t);return C(o)&&$(o,n)},Im=e=>_e(e,"block"),Fm=e=>_e(e,"selector"),Um=e=>_e(e,"inline"),zm=e=>Fm(e)&&!1!==e.expand&&!Um(e),jm=e=>(e=>{const t=[];let n=e;for(;n;){if(dr(n)&&n.data!==Ja||n.childNodes.length>1)return[];er(n)&&t.push(n),n=n.firstChild}return t})(e).length>0,Hm=e=>Wu(e.dom)&&jm(e.dom),$m=sm,Vm=Lm,qm=Rm,Wm=Sm,Km=(e,t)=>{let n=t;for(;n;){if(er(n)&&e.getContentEditable(n))return"false"===e.getContentEditable(n)?n:t;n=n.parentNode}return t},Ym=(e,t,n,o)=>{const r=t.data;if(e){for(let e=n;e>0;e--)if(o(r.charAt(e-1)))return e}else for(let e=n;eYm(e,t,n,(e=>am(e)||lm(e))),Xm=(e,t,n)=>Ym(e,t,n,dm),Zm=(e,t,n,o,r,s)=>{let a;const i=e.getParent(n,e.isBlock)||t,l=(t,n,o)=>{const s=za(e),l=r?s.backwards:s.forwards;return I.from(l(t,n,((e,t)=>$m(e.parentNode)?-1:(a=e,o(r,e,t))),i))};return l(n,o,Gm).bind((e=>s?l(e.container,e.offset+(r?-1:0),Xm):I.some(e))).orThunk((()=>a?I.some({container:a,offset:r?0:a.length}):I.none()))},Qm=(e,t,n,o,r)=>{const s=o[r];dr(o)&&Xe(o.data)&&s&&(o=s);const a=Vm(e,o);for(let o=0;o{var r;let s=n;const a=e.getRoot(),i=t[0];if(Im(i)&&(s=i.wrapper?null:e.getParent(n,i.block,a)),!s){const t=null!==(r=e.getParent(n,"LI,TD,TH,SUMMARY"))&&void 0!==r?r:a;s=e.getParent(dr(n)?n.parentNode:n,(t=>t!==a&&Wm(e.schema,t)),t)}if(s&&Im(i)&&i.wrapper&&(s=Vm(e,s,"ul,ol").reverse()[0]||s),!s)for(s=n;s&&s[o]&&!e.isBlock(s[o])&&(s=s[o],!Om(s,"br")););return s||n},ef=(e,t,n,o)=>{const r=n.parentNode;return!C(n[o])&&(!(r!==t&&!y(r)&&!e.isBlock(r))||ef(e,t,r,o))},tf=(e,t,n,o,r)=>{let s=n;const a=r?"previousSibling":"nextSibling",i=e.getRoot();if(dr(n)&&!qm(n)&&(r?o>0:o$m(e.parentNode)||$m(e),of=(e,t,n,o=!1)=>{let{startContainer:r,startOffset:s,endContainer:a,endOffset:i}=t;const l=n[0];return er(r)&&r.hasChildNodes()&&(r=xi(r,s),dr(r)&&(s=0)),er(a)&&a.hasChildNodes()&&(a=xi(a,t.collapsed?i:i-1),dr(a)&&(i=a.data.length)),r=Km(e,r),a=Km(e,a),nf(r)&&(r=$m(r)?r:r.parentNode,r=t.collapsed?r.previousSibling||r:r.nextSibling||r,dr(r)&&(s=t.collapsed?r.length:0)),nf(a)&&(a=$m(a)?a:a.parentNode,a=t.collapsed?a.nextSibling||a:a.previousSibling||a,dr(a)&&(i=t.collapsed?0:a.length)),t.collapsed&&(Zm(e,e.getRoot(),r,s,!0,o).each((({container:e,offset:t})=>{r=e,s=t})),Zm(e,e.getRoot(),a,i,!1,o).each((({container:e,offset:t})=>{a=e,i=t}))),(Um(l)||l.block_expand)&&(Um(l)&&dr(r)&&0!==s||(r=tf(e,n,r,s,!0)),Um(l)&&dr(a)&&i!==a.data.length||(a=tf(e,n,a,i,!1))),zm(l)&&(r=Qm(e,n,t,r,"previousSibling"),a=Qm(e,n,t,a,"nextSibling")),(Im(l)||Fm(l))&&(r=Jm(e,n,r,"previousSibling"),a=Jm(e,n,a,"nextSibling"),Im(l)&&(e.isBlock(r)||(r=tf(e,n,r,s,!0),dr(r)&&(s=0)),e.isBlock(a)||(a=tf(e,n,a,i,!1),dr(a)&&(i=a.data.length)))),er(r)&&r.parentNode&&(s=e.nodeIndex(r),r=r.parentNode),er(a)&&a.parentNode&&(i=e.nodeIndex(a)+1,a=a.parentNode),{startContainer:r,startOffset:s,endContainer:a,endOffset:i}},rf=(e,t,n)=>{var o;const r=t.startOffset,s=xi(t.startContainer,r),a=t.endOffset,i=xi(t.endContainer,a-1),l=e=>{const t=e[0];dr(t)&&t===s&&r>=t.data.length&&e.splice(0,1);const n=e[e.length-1];return 0===a&&e.length>0&&n===i&&dr(n)&&e.splice(e.length-1,1),e},d=(e,t,n)=>{const o=[];for(;e&&e!==n;e=e[t])o.push(e);return o},c=(t,n)=>e.getParent(t,(e=>e.parentNode===n),n),u=(e,t,o)=>{const r=o?"nextSibling":"previousSibling";for(let s=e,a=s.parentNode;s&&s!==t;s=a){a=s.parentNode;const t=d(s===e?s:s[r],r);t.length&&(o||t.reverse(),n(l(t)))}};if(s===i)return n(l([s]));const m=null!==(o=e.findCommonAncestor(s,i))&&void 0!==o?o:e.getRoot();if(e.isChildOf(s,i))return u(s,m,!0);if(e.isChildOf(i,s))return u(i,m);const f=c(s,m)||s,g=c(i,m)||i;u(s,f,!0);const p=d(f===s?f:f.nextSibling,"nextSibling",g===i?g.nextSibling:g);p.length&&n(l(p)),u(i,g)},sf=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]"],af=(e,t,n,o,r,s)=>{const{uid:a=t,...i}=n;mn(e,Ea()),Jt(e,`${_a()}`,a),Jt(e,`${ka()}`,o);const{attributes:l={},classes:d=[]}=r(a,i);if(en(e,l),((e,t)=>{q(t,(t=>{mn(e,t)}))})(e,d),s){d.length>0&&Jt(e,`${Na()}`,d.join(","));const t=fe(l);t.length>0&&Jt(e,`${Ra()}`,t.join(","))}},lf=(e,t,n,o,r)=>{const s=vn("span",e);return af(s,t,n,o,r,!1),s},df=(e,t,n,o,r,s)=>{const a=[],i=lf(e.getDoc(),n,s,o,r),l=Dr(),d=()=>{l.clear()},c=e=>{q(e,u)},u=t=>{switch(((e,t,n,o)=>Tn(t).fold((()=>"skipping"),(r=>"br"===o||(e=>Yt(e)&&Ha(e)===Ja)(t)?"valid":(e=>Kt(e)&&pn(e,Ea()))(t)?"existing":Wu(t.dom)?"caret":$(sf,(e=>En(t,e)))?"valid-block":Nm(e,n,o)&&Nm(e,$t(r),n)?"valid":"invalid-child")))(e,t,"span",$t(t))){case"invalid-child":{d();const e=In(t);c(e),d();break}case"valid-block":d(),af(t,n,s,o,r,!0);break;case"valid":{const e=l.get().getOrThunk((()=>{const e=Ia(i);return a.push(e),l.set(e),e}));Co(t,e);break}}};return rf(e.dom,t,(e=>{d(),(e=>{const t=V(e,Cn);c(t)})(e)})),a},cf=e=>{const t=(()=>{const e={};return{register:(t,n)=>{e[t]={name:t,settings:n}},lookup:t=>Ee(e,t).map((e=>e.settings)),getNames:()=>fe(e)}})();((e,t)=>{const n=ka(),o=e=>I.from(e.attr(n)).bind(t.lookup),r=e=>{var t,n;e.attr(_a(),null),e.attr(ka(),null),e.attr(Sa(),null);const o=I.from(e.attr(Ra())).map((e=>e.split(","))).getOr([]),r=I.from(e.attr(Na())).map((e=>e.split(","))).getOr([]);q(o,(t=>e.attr(t,null)));const s=null!==(n=null===(t=e.attr("class"))||void 0===t?void 0:t.split(" "))&&void 0!==n?n:[],a=re(s,[Ea()].concat(r));e.attr("class",a.length>0?a.join(" "):null),e.attr(Na(),null),e.attr(Ra(),null)};e.serializer.addTempAttr(Sa()),e.serializer.addAttributeFilter(n,(e=>{for(const t of e)o(t).each((e=>{!1===e.persistent&&("span"===t.name?t.unwrap():r(t))}))}))})(e,t);const n=((e,t)=>{const n=Br({}),o=()=>({listeners:[],previous:Dr()}),r=(e,t)=>{s(e,(e=>(t(e),e)))},s=(e,t)=>{const r=n.get(),s=t(Ee(r,e).getOrThunk(o));r[e]=s,n.set(r)},a=(t,n)=>{q(Ba(e,t),(e=>{n?Jt(e,Sa(),"true"):rn(e,Sa())}))},i=xa((()=>{const n=ae(t.getNames());q(n,(t=>{s(t,(n=>{const o=n.previous.get();return Ta(e,I.some(t)).fold((()=>{o.each((e=>{(e=>{r(e,(t=>{q(t.listeners,(t=>t(!1,e)))}))})(t),n.previous.clear(),a(e,!1)}))}),(({uid:e,name:t,elements:s})=>{Lt(o,e)||(o.each((e=>a(e,!1))),((e,t,n)=>{r(e,(o=>{q(o.listeners,(o=>o(!0,e,{uid:t,nodes:V(n,(e=>e.dom))})))}))})(t,e,s),n.previous.set(e),a(e,!0))})),{previous:n.previous,listeners:n.listeners}}))}))}),30);return e.on("remove",(()=>{i.cancel()})),e.on("NodeChange",(()=>{i.throttle()})),{addListener:(e,t)=>{s(e,(e=>({previous:e.previous,listeners:e.listeners.concat([t])})))}}})(e,t),o=Zt("span"),r=e=>{q(e,(e=>{o(e)?ko(e):(e=>{gn(e,Ea()),rn(e,`${_a()}`),rn(e,`${ka()}`),rn(e,`${Sa()}`);const t=nn(e,`${Ra()}`).map((e=>e.split(","))).getOr([]),n=nn(e,`${Na()}`).map((e=>e.split(","))).getOr([]);var o;q(t,(t=>rn(e,t))),o=e,q(n,(e=>{gn(o,e)})),rn(e,`${Na()}`),rn(e,`${Ra()}`)})(e)}))};return{register:(e,n)=>{t.register(e,n)},annotate:(n,o)=>{t.lookup(n).each((t=>{((e,t,n,o)=>{e.undoManager.transact((()=>{const r=e.selection,s=r.getRng(),a=mm(e).length>0,i=La("mce-annotation");if(s.collapsed&&!a&&((e,t)=>{const n=of(e.dom,t,[{inline:"span"}]);t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset),e.selection.setRng(t)})(e,s),r.getRng().collapsed&&!a){const s=lf(e.getDoc(),i,o,t,n.decorate);No(s,Wo),r.getRng().insertNode(s.dom),r.select(s.dom)}else Cm(r,!1,(()=>{ym(e,(r=>{df(e,r,i,t,n.decorate,o)}))}))}))})(e,n,t,o)}))},annotationChanged:(e,t)=>{n.addListener(e,t)},remove:t=>{Ta(e,I.some(t)).each((({elements:t})=>{const n=e.selection.getBookmark();r(t),e.selection.moveToBookmark(n)}))},removeAll:t=>{const n=e.selection.getBookmark();pe(Pa(e,t),((e,t)=>{r(e)})),e.selection.moveToBookmark(n)},getAll:t=>{const n=Pa(e,t);return he(n,(e=>V(e,(e=>e.dom))))}}},uf=e=>({getBookmark:T(om,e),moveToBookmark:T(rm,e)});uf.isBookmarkNode=sm;const mf=(e,t,n)=>!n.collapsed&&$(n.getClientRects(),(n=>((e,t,n)=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom)(n,e,t))),ff=(e,t,n)=>{e.dispatch(t,n)},gf=(e,t,n,o)=>{e.dispatch("FormatApply",{format:t,node:n,vars:o})},pf=(e,t,n,o)=>{e.dispatch("FormatRemove",{format:t,node:n,vars:o})},hf=(e,t)=>e.dispatch("SetContent",t),bf=(e,t)=>e.dispatch("GetContent",t),vf=(e,t)=>{e.dispatch("AutocompleterUpdateActiveRange",t)},yf=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),Cf={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,ESC:27,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,modifierPressed:e=>e.shiftKey||e.ctrlKey||e.altKey||Cf.metaKeyPressed(e),metaKeyPressed:e=>Tt.os.isMacOS()||Tt.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},wf="data-mce-selected",xf=Math.abs,Ef=Math.round,kf={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},_f=(e,t)=>{const n=t.dom,o=t.getDoc(),r=document,s=t.getBody();let a,i,l,d,c,u,m,f,g,p,h,b,v,y,w;const x=e=>C(e)&&(hr(e)||n.is(e,"figure.image")),E=e=>wr(e)||n.hasClass(e,"mce-preview-object"),k=e=>{const n=e.target;((e,t)=>{if((e=>"longpress"===e.type||0===e.type.indexOf("touch"))(e)){const n=e.touches[0];return x(e.target)&&!mf(n.clientX,n.clientY,t)}return x(e.target)&&!mf(e.clientX,e.clientY,t)})(e,t.selection.getRng())&&!e.isDefaultPrevented()&&t.selection.select(n)},_=e=>n.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?[e,e.firstElementChild]:n.is(e,"figure.image")?[e.querySelector("img")]:[e],S=e=>{const o=yd(t);return!!o&&"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&(n.hasClass(e,"mce-preview-object")&&C(e.firstElementChild)?En(Cn(e.firstElementChild),o):En(Cn(e),o))},N=(e,o,r)=>{if(C(r)){const s=_(e);q(s,(e=>{e.style[o]||!t.schema.isValid(e.nodeName.toLowerCase(),o)?n.setStyle(e,o,r):n.setAttrib(e,o,""+r)}))}},R=(e,t,n)=>{N(e,"width",t),N(e,"height",n)},A=e=>{let o,r,c,C,k;o=e.screenX-u,r=e.screenY-m,b=o*d[2]+f,v=r*d[3]+g,b=b<5?5:b,v=v<5?5:v,c=(x(a)||E(a))&&!1!==Cd(t)?!Cf.modifierPressed(e):Cf.modifierPressed(e),c&&(xf(o)>xf(r)?(v=Ef(b*p),b=Ef(v/p)):(b=Ef(v/p),v=Ef(b*p))),R(i,b,v),C=d.startPos.x+o,k=d.startPos.y+r,C=C>0?C:0,k=k>0?k:0,n.setStyles(l,{left:C,top:k,display:"block"}),l.innerHTML=b+" × "+v,d[2]<0&&i.clientWidth<=b&&n.setStyle(i,"left",void 0+(f-b)),d[3]<0&&i.clientHeight<=v&&n.setStyle(i,"top",void 0+(g-v)),o=s.scrollWidth-y,r=s.scrollHeight-w,o+r!==0&&n.setStyles(l,{left:C-o,top:k-r}),h||(((e,t,n,o,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:n,height:o,origin:r})})(t,a,f,g,"corner-"+d.name),h=!0)},T=()=>{const e=h;h=!1,e&&(N(a,"width",b),N(a,"height",v)),n.unbind(o,"mousemove",A),n.unbind(o,"mouseup",T),r!==o&&(n.unbind(r,"mousemove",A),n.unbind(r,"mouseup",T)),n.remove(i),n.remove(l),n.remove(c),O(a),e&&(((e,t,n,o,r)=>{e.dispatch("ObjectResized",{target:t,width:n,height:o,origin:r})})(t,a,b,v,"corner-"+d.name),n.setAttrib(a,"style",n.getAttrib(a,"style"))),t.nodeChanged()},O=e=>{M();const h=n.getPos(e,s),C=h.x,x=h.y,k=e.getBoundingClientRect(),N=k.width||k.right-k.left,O=k.height||k.bottom-k.top;a!==e&&(P(),a=e,b=v=0);const B=t.dispatch("ObjectSelected",{target:e});S(e)&&!B.isDefaultPrevented()?pe(kf,((e,t)=>{let h=n.get("mceResizeHandle"+t);h&&n.remove(h),h=n.add(s,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),n.bind(h,"mousedown",(h=>{h.stopImmediatePropagation(),h.preventDefault(),(h=>{const b=_(a)[0];u=h.screenX,m=h.screenY,f=b.clientWidth,g=b.clientHeight,p=g/f,d=e,d.name=t,d.startPos={x:N*e[0]+C,y:O*e[1]+x},y=s.scrollWidth,w=s.scrollHeight,c=n.add(s,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),n.setStyles(c,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),i=((e,t)=>{if(E(t))return e.create("img",{src:Tt.transparentSrc});if(ar(t)){const n=$e(d.name,"n")?le:de,o=t.cloneNode(!0);return n(e.select("tr",o)).each((t=>{const n=e.select("td,th",t);e.setStyle(t,"height",null),q(n,(t=>e.setStyle(t,"height",null)))})),o}return t.cloneNode(!0)})(n,a),n.addClass(i,"mce-clonedresizable"),n.setAttrib(i,"data-mce-bogus","all"),i.contentEditable="false",n.setStyles(i,{left:C,top:x,margin:0}),R(i,N,O),i.removeAttribute(wf),s.appendChild(i),n.bind(o,"mousemove",A),n.bind(o,"mouseup",T),r!==o&&(n.bind(r,"mousemove",A),n.bind(r,"mouseup",T)),l=n.add(s,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},f+" × "+g)})(h)})),e.elm=h,n.setStyles(h,{left:N*e[0]+C-h.offsetWidth/2,top:O*e[1]+x-h.offsetHeight/2})})):P(!1)},B=wa(O,0),P=(e=!0)=>{B.cancel(),M(),a&&e&&a.removeAttribute(wf),pe(kf,((e,t)=>{const o=n.get("mceResizeHandle"+t);o&&(n.unbind(o),n.remove(o))}))},D=(e,t)=>n.isChildOf(e,t),L=o=>{if(h||t.removed||t.composing)return;const r="mousedown"===o.type?o.target:e.getNode(),a=oo(Cn(r),"table,img,figure.image,hr,video,span.mce-preview-object,details").map((e=>e.dom)).filter((e=>n.isEditable(e.parentElement)||"IMG"===e.nodeName&&n.isEditable(e))).getOrUndefined(),i=C(a)?n.getAttrib(a,wf,"1"):"1";if(q(n.select(`img[${wf}],hr[${wf}]`),(e=>{e.removeAttribute(wf)})),C(a)&&D(a,s)&&t.hasFocus()){I();const t=e.getStart(!0);if(D(t,a)&&D(e.getEnd(!0),a))return n.setAttrib(a,wf,i),void B.throttle(a)}P()},M=()=>{pe(kf,(e=>{e.elm&&(n.unbind(e.elm),delete e.elm)}))},I=()=>{try{t.getDoc().execCommand("enableObjectResizing",!1,"false")}catch(e){}};return t.on("init",(()=>{I(),t.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop",L),t.on("keyup compositionend",(e=>{a&&"TABLE"===a.nodeName&&L(e)})),t.on("hide blur",P),t.on("contextmenu longpress",k,!0)})),t.on("remove",M),{isResizable:S,showResizeRect:O,hideResizeRect:P,updateResizeRect:L,destroy:()=>{B.cancel(),a=i=c=null}}},Sf=(e,t,n)=>{const o=e.document.createRange();var r;return r=o,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,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(o,n),o},Nf=(e,t,n,o,r)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(o.dom,r),s},Rf=kl([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Af=(e,t,n)=>t(Cn(n.startContainer),n.startOffset,Cn(n.endContainer),n.endOffset);Rf.ltr,Rf.rtl;const Tf=(e,t,n,o)=>({start:e,soffset:t,finish:n,foffset:o}),Of=document.caretPositionFromPoint?(e,t,n)=>{var o,r;return I.from(null===(r=(o=e.dom).caretPositionFromPoint)||void 0===r?void 0:r.call(o,t,n)).bind((t=>{if(null===t.offsetNode)return I.none();const n=e.dom.createRange();return n.setStart(t.offsetNode,t.offset),n.collapse(),I.some(n)}))}:document.caretRangeFromPoint?(e,t,n)=>{var o,r;return I.from(null===(r=(o=e.dom).caretRangeFromPoint)||void 0===r?void 0:r.call(o,t,n))}:I.none,Bf=kl([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Pf={before:Bf.before,on:Bf.on,after:Bf.after,cata:(e,t,n,o)=>e.fold(t,n,o),getStart:e=>e.fold(R,R,R)},Df=kl([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Lf={domRange:Df.domRange,relative:Df.relative,exact:Df.exact,exactFromRange:e=>Df.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Cn(e.startContainer),relative:(e,t)=>Pf.getStart(e),exact:(e,t,n,o)=>e}))(e);return An(t)},range:Tf},Mf=(e,t)=>{const n=$t(e);return"input"===n?Pf.after(e):H(["br","img"],n)?0===t?Pf.before(e):Pf.after(e):Pf.on(e,t)},If=(e,t)=>{const n=e.fold(Pf.before,Mf,Pf.after),o=t.fold(Pf.before,Mf,Pf.after);return Lf.relative(n,o)},Ff=(e,t,n,o)=>{const r=Mf(e,t),s=Mf(n,o);return Lf.relative(r,s)},Uf=(e,t)=>{const n=(t||document).createDocumentFragment();return q(e,(e=>{n.appendChild(e.dom)})),Cn(n)},zf=e=>{const t=Lf.getWin(e).dom,n=(e,n,o,r)=>Nf(t,e,n,o,r),o=(e=>e.match({domRange:e=>{const t=Cn(e.startContainer),n=Cn(e.endContainer);return Ff(t,e.startOffset,n,e.endOffset)},relative:If,exact:Ff}))(e);return((e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:N(e),rtl:I.none}),relative:(t,n)=>({ltr:Le((()=>Sf(e,t,n))),rtl:Le((()=>I.some(Sf(e,n,t))))}),exact:(t,n,o,r)=>({ltr:Le((()=>Nf(e,t,n,o,r))),rtl:Le((()=>I.some(Nf(e,o,r,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>Rf.rtl(Cn(e.endContainer),e.endOffset,Cn(e.startContainer),e.startOffset))).getOrThunk((()=>Af(0,Rf.ltr,n))):Af(0,Rf.ltr,n)})(0,n)})(t,o).match({ltr:n,rtl:n})},jf=(e,t,n)=>((e,t,n)=>((e,t,n)=>{const o=Cn(e.document);return Of(o,t,n).map((e=>Tf(Cn(e.startContainer),e.startOffset,Cn(e.endContainer),e.endOffset)))})(e,t,n))(An(Cn(n)).dom,e,t).map((e=>{const t=n.createRange();return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),t})).getOrUndefined(),Hf=(e,t)=>C(e)&&C(t)&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,$f=(e,t,n)=>null!==((e,t,n)=>{let o=e;for(;o&&o!==t;){if(n(o))return o;o=o.parentNode}return null})(e,t,n),Vf=(e,t,n)=>$f(e,t,(e=>e.nodeName===n)),qf=(e,t)=>ai(e)&&!$f(e,t,Wu),Wf=(e,t,n)=>{const o=t.parentNode;if(o){const r=new Vo(t,e.getParent(o,e.isBlock)||e.getRoot());let s;for(;s=r[n?"prev":"next"]();)if(pr(s))return!0}return!1},Kf=(e,t,n,o,r)=>{const s=e.getRoot(),a=e.schema.getNonEmptyElements(),i=r.parentNode;let l,d;if(!i)return I.none();const c=e.getParent(i,e.isBlock)||s;if(o&&pr(r)&&t&&e.isEmpty(c))return I.some(Ji(i,e.nodeIndex(r)));const u=new Vo(r,c);for(;d=u[o?"prev":"next"]();){if("false"===e.getContentEditableParent(d)||qf(d,s))return I.none();if(dr(d)&&d.data.length>0)return Vf(d,s,"A")?I.none():I.some(Ji(d,o?d.data.length:0));if(e.isBlock(d)||a[d.nodeName.toLowerCase()])return I.none();l=d}return mr(l)?I.none():n&&l?I.some(Ji(l,0)):I.none()},Yf=(e,t,n,o)=>{const r=e.getRoot();let s,a=!1,i=n?o.startContainer:o.endContainer,l=n?o.startOffset:o.endOffset;const d=er(i)&&l===i.childNodes.length,c=e.schema.getNonEmptyElements();let u=n;if(ai(i))return I.none();if(er(i)&&l>i.childNodes.length-1&&(u=!1),fr(i)&&(i=r,l=0),i===r){if(u&&(s=i.childNodes[l>0?l-1:0],s)){if(ai(s))return I.none();if(c[s.nodeName]||ar(s))return I.none()}if(i.hasChildNodes()){if(l=Math.min(!u&&l>0?l-1:l,i.childNodes.length-1),i=i.childNodes[l],l=dr(i)&&d?i.data.length:0,!t&&i===r.lastChild&&ar(i))return I.none();if(((e,t)=>{let n=t;for(;n&&n!==e;){if(vr(n))return!0;n=n.parentNode}return!1})(r,i)||ai(i))return I.none();if(Er(i))return I.none();if(i.hasChildNodes()&&!ar(i)){s=i;const t=new Vo(i,r);do{if(vr(s)||ai(s)){a=!1;break}if(dr(s)&&s.data.length>0){l=u?0:s.data.length,i=s,a=!0;break}if(c[s.nodeName.toLowerCase()]&&!Cr(s)){l=e.nodeIndex(s),i=s.parentNode,u||l++,a=!0;break}}while(s=u?t.next():t.prev())}}}return t&&(dr(i)&&0===l&&Kf(e,d,t,!0,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),er(i)&&(s=i.childNodes[l],s||(s=i.childNodes[l-1]),!s||!pr(s)||((e,t)=>{var n;return"A"===(null===(n=e.previousSibling)||void 0===n?void 0:n.nodeName)})(s)||Wf(e,s,!1)||Wf(e,s,!0)||Kf(e,d,t,!0,s).each((e=>{i=e.container(),l=e.offset(),a=!0})))),u&&!t&&dr(i)&&l===i.data.length&&Kf(e,d,t,!1,i).each((e=>{i=e.container(),l=e.offset(),a=!0})),a&&i?I.some(Ji(i,l)):I.none()},Gf=(e,t)=>{const n=t.collapsed,o=t.cloneRange(),r=Ji.fromRangeStart(t);return Yf(e,n,!0,o).each((e=>{n&&Ji.isAbove(r,e)||o.setStart(e.container(),e.offset())})),n||Yf(e,n,!1,o).each((e=>{o.setEnd(e.container(),e.offset())})),n&&o.collapse(!0),Hf(t,o)?I.none():I.some(o)},Xf=(e,t)=>e.splitText(t),Zf=e=>{let t=e.startContainer,n=e.startOffset,o=e.endContainer,r=e.endOffset;if(t===o&&dr(t)){if(n>0&&nn){r-=n;const e=Xf(o,r).previousSibling;t=o=e,r=e.data.length,n=0}else r=0}else if(dr(t)&&n>0&&n0&&r({walk:(t,n)=>rf(e,t,n),split:Zf,expand:(t,n={type:"word"})=>{if("word"===n.type){const n=of(e,t,[{inline:"span"}]),o=e.createRng();return o.setStart(n.startContainer,n.startOffset),o.setEnd(n.endContainer,n.endOffset),o}return t},normalize:t=>Gf(e,t).fold(L,(e=>(t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0)))});Qf.compareRanges=Hf,Qf.getCaretRangeFromPoint=jf,Qf.getSelectedNode=wi,Qf.getNode=xi;const Jf=((e,t)=>{const n=t=>{const n=(e=>{const t=e.dom;return Xn(e)?t.getBoundingClientRect().height:t.offsetHeight})(t);if(n<=0||null===n){const n=uo(t,e);return parseFloat(n)||0}return n},o=(e,t)=>X(t,((t,n)=>{const o=uo(e,n),r=void 0===o?0:parseInt(o,10);return isNaN(r)?t:t+r}),0);return{set:(t,n)=>{if(!x(n)&&!n.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+n);const o=t.dom;ao(o)&&(o.style[e]=n+"px")},get:n,getOuter:n,aggregate:o,max:(e,t,n)=>{const r=o(e,n);return t>r?t-r:0}}})("height"),eg=()=>Cn(document),tg=(e,t)=>e.view(t).fold(N([]),(t=>{const n=e.owner(t),o=tg(e,n);return[t].concat(o)}));var ng=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?I.none():I.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Cn)},owner:e=>Rn(e)});const og=e=>"textarea"===$t(e),rg=(e,t)=>{const n=(e=>{const t=e.dom.ownerDocument,n=t.body,o=t.defaultView,r=t.documentElement;if(n===e.dom)return Oo(n.offsetLeft,n.offsetTop);const s=Bo(null==o?void 0:o.pageYOffset,r.scrollTop),a=Bo(null==o?void 0:o.pageXOffset,r.scrollLeft),i=Bo(r.clientTop,n.clientTop),l=Bo(r.clientLeft,n.clientLeft);return Po(e).translate(a-l,s-i)})(e),o=(e=>Jf.get(e))(e);return{element:e,bottom:n.top+o,height:o,pos:n,cleanup:t}},sg=(e,t,n,o)=>{dg(e,((r,s)=>ig(e,t,n,o)),n)},ag=(e,t,n,o,r)=>{const s={elm:o.element.dom,alignToTop:r};((e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented())(e,s)||(n(e,t,Do(t).top,o,r),((e,t)=>{e.dispatch("AfterScrollIntoView",t)})(e,s))},ig=(e,t,n,o)=>{const r=Cn(e.getBody()),s=Cn(e.getDoc());r.dom.offsetWidth;const a=((e,t)=>{const n=((e,t)=>{const n=In(e);if(0===n.length||og(e))return{element:e,offset:t};if(t\ufeff');return ho(n.element,o),rg(o,(()=>Eo(o)))})(Cn(n.startContainer),n.startOffset);ag(e,s,t,a,o),a.cleanup()},lg=(e,t,n,o)=>{const r=Cn(e.getDoc());ag(e,r,n,(e=>rg(Cn(e),k))(t),o)},dg=(e,t,n)=>{const o=n.startContainer,r=n.startOffset,s=n.endContainer,a=n.endOffset;t(Cn(o),Cn(s));const i=e.dom.createRng();i.setStart(o,r),i.setEnd(s,a),e.selection.setRng(n)},cg=(e,t,n,o,r)=>{const s=t.pos;if(o)Lo(s.left,s.top,r);else{const o=s.top-n+t.height;Lo(-e.getBody().getBoundingClientRect().left,o,r)}},ug=(e,t,n,o,r,s)=>{const a=o+n,i=r.pos.top,l=r.bottom,d=l-i>=o;ia?cg(e,r,o,d?!1!==s:!0===s,t):l>a&&!d&&cg(e,r,o,!0===s,t)},mg=(e,t,n,o,r)=>{const s=An(t).dom.innerHeight;ug(e,t,n,s,o,r)},fg=(e,t,n,o,r)=>{const s=An(t).dom.innerHeight;ug(e,t,n,s,o,r);const a=(e=>{const t=eg(),n=Do(t),o=((e,t)=>{const n=t.owner(e);return tg(t,n)})(e,ng),r=Po(e),s=G(o,((e,t)=>{const n=Po(t);return{left:e.left+n.left,top:e.top+n.top}}),{left:0,top:0});return Oo(s.left+r.left+n.left,s.top+r.top+n.top)})(o.element),i=Fo(window);a.topi.bottom&&Mo(o.element,!0===r)},gg=(e,t,n)=>sg(e,mg,t,n),pg=(e,t,n)=>lg(e,t,mg,n),hg=(e,t,n)=>sg(e,fg,t,n),bg=(e,t,n)=>lg(e,t,fg,n),vg=(e,t,n)=>{(e.inline?gg:hg)(e,t,n)},yg=(e,t=!1)=>e.dom.focus({preventScroll:t}),Cg=e=>{const t=qn(e).dom;return e.dom===t.activeElement},wg=(e=eg())=>I.from(e.dom.activeElement).map(Cn),xg=(e,t)=>{const n=Yt(t)?Ha(t).length:In(t).length+1;return e>n?n:e<0?0:e},Eg=e=>Lf.range(e.start,xg(e.soffset,e.start),e.finish,xg(e.foffset,e.finish)),kg=(e,t)=>!Jo(t.dom)&&(Sn(e,t)||_n(e,t)),_g=e=>t=>kg(e,t.start)&&kg(e,t.finish),Sg=e=>Lf.range(Cn(e.startContainer),e.startOffset,Cn(e.endContainer),e.endOffset),Ng=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),I.some(t)}catch(e){return I.none()}},Rg=e=>{const t=(e=>e.inline||Tt.browser.isFirefox())(e)?(n=Cn(e.getBody()),(e=>{const t=e.getSelection();return(t&&0!==t.rangeCount?I.from(t.getRangeAt(0)):I.none()).map(Sg)})(An(n).dom).filter(_g(n))):I.none();var n;e.bookmark=t.isSome()?t:e.bookmark},Ag=e=>(e.bookmark?e.bookmark:I.none()).bind((t=>{return n=Cn(e.getBody()),o=t,I.from(o).filter(_g(n)).map(Eg);var n,o})).bind(Ng),Tg={isEditorUIElement:e=>{const t=e.className.toString();return-1!==t.indexOf("tox-")||-1!==t.indexOf("mce-")}},Og={setEditorTimeout:(e,t,n)=>((e,t)=>(x(t)||(t=0),setTimeout(e,t)))((()=>{e.removed||t()}),n),setEditorInterval:(e,t,n)=>{const o=((e,t)=>(x(t)||(t=0),setInterval(e,t)))((()=>{e.removed?clearInterval(o):t()}),n);return o}};let Bg;const Pg=fa.DOM,Dg=e=>{const t=e.classList;return void 0!==t&&(t.contains("tox-edit-area")||t.contains("tox-edit-area__iframe")||t.contains("mce-content-body"))},Lg=(e,t)=>{const n=Pd(e),o=Pg.getParent(t,(t=>(e=>er(e)&&Tg.isEditorUIElement(e))(t)||!!n&&e.dom.is(t,n)));return null!==o},Mg=e=>{try{const t=qn(Cn(e.getElement()));return wg(t).fold((()=>document.body),(e=>e.dom))}catch(e){return document.body}},Ig=(e,t)=>{const n=t.editor;(e=>{const t=wa((()=>{Rg(e)}),0);e.on("init",(()=>{e.inline&&((e,t)=>{const n=()=>{t.throttle()};fa.DOM.bind(document,"mouseup",n),e.on("remove",(()=>{fa.DOM.unbind(document,"mouseup",n)}))})(e,t),((e,t)=>{((e,t)=>{e.on("mouseup touchend",(e=>{t.throttle()}))})(e,t),e.on("keyup NodeChange AfterSetSelectionRange",(t=>{(e=>"nodechange"===e.type&&e.selectionChange)(t)||Rg(e)}))})(e,t)})),e.on("remove",(()=>{t.cancel()}))})(n);const o=(e,t)=>{wc(e)&&!0!==e.inline&&t(Cn(e.getContainer()),"tox-edit-focus")};n.on("focusin",(()=>{const t=e.focusedEditor;Dg(Mg(n))&&o(n,mn),t!==n&&(t&&t.dispatch("blur",{focusedEditor:n}),e.setActive(n),e.focusedEditor=n,n.dispatch("focus",{blurredEditor:t}),n.focus(!0))})),n.on("focusout",(()=>{Og.setEditorTimeout(n,(()=>{const t=e.focusedEditor;Dg(Mg(n))&&t===n||o(n,gn),Lg(n,Mg(n))||t!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)}))})),Bg||(Bg=t=>{const n=e.activeEditor;n&&Yn(t).each((t=>{const o=t;o.ownerDocument===document&&(o===document.body||Lg(n,o)||e.focusedEditor!==n||(n.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null))}))},Pg.bind(document,"focusin",Bg))},Fg=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),!e.activeEditor&&Bg&&(Pg.unbind(document,"focusin",Bg),Bg=null)},Ug=(e,t)=>{((e,t)=>(e=>e.collapsed?I.from(xi(e.startContainer,e.startOffset)).map(Cn):I.none())(t).bind((t=>Ya(t)?I.some(t):Sn(e,t)?I.none():I.some(e))))(Cn(e.getBody()),t).bind((e=>$u(e.dom))).fold((()=>{e.selection.normalize()}),(t=>e.selection.setRng(t.toRange())))},zg=e=>{if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},jg=e=>e.inline?(e=>{const t=e.getBody();return t&&(n=Cn(t),Cg(n)||(o=n,wg(qn(o)).filter((e=>o.dom.contains(e.dom)))).isSome());var n,o})(e):(e=>C(e.iframeElement)&&Cg(Cn(e.iframeElement)))(e),Hg=e=>jg(e)||(e=>{const t=qn(Cn(e.getElement()));return wg(t).filter((t=>!Dg(t.dom)&&Lg(e,t.dom))).isSome()})(e),$g=e=>e.editorManager.setActive(e),Vg=(e,t)=>t.collapsed?e.isEditable(t.startContainer):e.isEditable(t.startContainer)&&e.isEditable(t.endContainer),qg=(e,t,n,o,r)=>{const s=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return I.from(s).map(Cn).map((e=>o&&t.collapsed?e:Fn(e,r(e,a)).getOr(e))).bind((e=>Kt(e)?I.some(e):Tn(e).filter(Kt))).map((e=>e.dom)).getOr(e)},Wg=(e,t,n=!1)=>qg(e,t,!0,n,((e,t)=>Math.min(jn(e),t))),Kg=(e,t,n=!1)=>qg(e,t,!1,n,((e,t)=>t>0?t-1:t)),Yg=(e,t)=>{const n=e;for(;e&&dr(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n},Gg=(e,t)=>V(t,(t=>{const n=e.dispatch("GetSelectionRange",{range:t});return n.range!==t?n.range:t})),Xg={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},Zg=(e,t,n)=>{const o=n?"lastChild":"firstChild",r=n?"prev":"next";if(e[o])return e[o];if(e!==t){let n=e[r];if(n)return n;for(let o=e.parent;o&&o!==t;o=o.parent)if(n=o[r],n)return n}},Qg=e=>{var t;const n=null!==(t=e.value)&&void 0!==t?t:"";if(!Go(n))return!1;const o=e.parent;return!o||"span"===o.name&&!o.attr("style")||!/^[ ]+$/.test(n)},Jg=e=>{const t="a"===e.name&&!e.attr("href")&&e.attr("id");return e.attr("name")||e.attr("id")&&!e.firstChild||e.attr("data-mce-bookmark")||t};class ep{static create(e,t){const n=new ep(e,Xg[e]||1);return t&&pe(t,((e,t)=>{n.attr(t,e)})),n}constructor(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}replace(e){const t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t}attr(e,t){const n=this;if(!m(e))return C(e)&&pe(e,((e,t)=>{n.attr(t,e)})),n;const o=n.attributes;if(o){if(void 0!==t){if(null===t){if(e in o.map){delete o.map[e];let t=o.length;for(;t--;)if(o[t].name===e)return o.splice(t,1),n}return n}if(e in o.map){let n=o.length;for(;n--;)if(o[n].name===e){o[n].value=t;break}}else o.push({name:e,value:t});return o.map[e]=t,n}return o.map[e]}}clone(){const e=this,t=new ep(e.name,e.type),n=e.attributes;if(n){const e=[];e.map={};for(let t=0,o=n.length;tm(e.nodeValue)&&e.nodeValue.includes(Ja),op=e=>(0===e.length?"":`${V(e,(e=>`[${e}]`)).join(",")},`)+'[data-mce-bogus="all"]',rp=e=>document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,(e=>np(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP)),sp=e=>document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>{if(np(e)){const t=e.parentNode;return t&&ke(tp,t.nodeName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_SKIP})),ap=e=>null!==rp(e).nextNode(),ip=e=>null!==sp(e).nextNode(),lp=(e,t)=>null!==t.querySelector(op(e)),dp=(e,t)=>{q(((e,t)=>t.querySelectorAll(op(e)))(e,t),(t=>{const n=Cn(t);"all"===tn(n,"data-mce-bogus")?Eo(n):q(e,(e=>{on(n,e)&&rn(n,e)}))}))},cp=e=>{let t=e.nextNode();for(;null!==t;)t.nodeValue=null,t=e.nextNode()},up=_(cp,rp),mp=_(cp,sp),fp=(e,t)=>{const n=[{condition:T(lp,t),action:T(dp,t)},{condition:ap,action:up},{condition:ip,action:mp}];let o=e,r=!1;return q(n,(({condition:t,action:n})=>{t(o)&&(r||(o=e.cloneNode(!0),r=!0),n(o))})),o},gp=e=>{const t=zo(e,"[data-mce-bogus]");q(t,(e=>{"all"===tn(e,"data-mce-bogus")?Eo(e):Va(e)?(ho(e,yn(qo)),Eo(e)):ko(e)}))},pp=e=>{const t=zo(e,"input");q(t,(e=>{rn(e,"name")}))},hp=(e,t,n)=>{let o;return o="raw"===t.format?Dt.trim(ti(fp(n,e.serializer.getTempAttrs()).innerHTML)):"text"===t.format?((e,t)=>{const n=e.getDoc(),o=qn(Cn(e.getBody())),r=vn("div",n);Jt(r,"data-mce-bogus","all"),co(r,{position:"fixed",left:"-9999999px",top:"0"}),No(r,t.innerHTML),gp(r),pp(r);const s=(e=>Hn(e)?e:Cn(Rn(e).dom.body))(o);yo(s,r);const a=ti(r.dom.innerText);return Eo(r),a})(e,n):"tree"===t.format?e.serializer.serialize(n,t):((e,t)=>{const n=Wl(e),o=new RegExp(`^(<${n}[^>]*>( | |\\s|\xa0|
|)<\\/${n}>[\r\n]*|
[\r\n]*)$`);return t.replace(o,"")})(e,e.serializer.serialize(n,t)),"text"!==t.format&&!Xa(Cn(n))&&m(o)?Dt.trim(o):o},bp=Dt.makeMap,vp=e=>{const t=[],n=(e=e||{}).indent,o=bp(e.indent_before||""),r=bp(e.indent_after||""),s=ws.getEncodeFunc(e.entity_encoding||"raw",e.entities),a="xhtml"!==e.element_format;return{start:(e,i,l)=>{if(n&&o[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}if(t.push("<",e),i)for(let e=0,n=i.length;e":" />",l&&n&&r[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}},end:e=>{let o;t.push("",e,">"),n&&r[e]&&t.length>0&&(o=t[t.length-1],o.length>0&&"\n"!==o&&t.push("\n"))},text:(e,n)=>{e.length>0&&(t[t.length]=n?e:s(e))},cdata:e=>{t.push("")},comment:e=>{t.push("\x3c!--",e,"--\x3e")},pi:(e,o)=>{o?t.push("",e," ",s(o),"?>"):t.push("",e,"?>"),n&&t.push("\n")},doctype:e=>{t.push("",n?"\n":"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},yp=(e={},t=Fs())=>{const n=vp(e);return e.validate=!("validate"in e)||e.validate,{serialize:o=>{const r=e.validate,s={3:e=>{var t;n.text(null!==(t=e.value)&&void 0!==t?t:"",e.raw)},8:e=>{var t;n.comment(null!==(t=e.value)&&void 0!==t?t:"")},7:e=>{n.pi(e.name,e.value)},10:e=>{var t;n.doctype(null!==(t=e.value)&&void 0!==t?t:"")},4:e=>{var t;n.cdata(null!==(t=e.value)&&void 0!==t?t:"")},11:e=>{let t=e;if(t=t.firstChild)do{a(t)}while(t=t.next)}};n.reset();const a=e=>{var o;const i=s[e.type];if(i)i(e);else{const s=e.name,i=s in t.getVoidElements();let l=e.attributes;if(r&&l&&l.length>1){const n=[];n.map={};const o=t.getElementRule(e.name);if(o){for(let e=0,t=o.attributesOrder.length;e{Cp.add(e)}));const wp=["font","text-decoration","text-emphasis"],xp=(e,t)=>fe(e.parseStyle(e.getAttrib(t,"style"))),Ep=(e,t,n)=>{const o=xp(e,t),r=xp(e,n),s=o=>{var r,s;const a=null!==(r=e.getStyle(t,o))&&void 0!==r?r:"",i=null!==(s=e.getStyle(n,o))&&void 0!==s?s:"";return Ge(a)&&Ge(i)&&a!==i};return $(o,(e=>{const t=t=>$(t,(t=>t===e));if(!t(r)&&t(wp)){const e=Y(r,(e=>$(wp,(t=>$e(e,t)))));return $(e,s)}return s(e)}))},kp=(e,t,n)=>I.from(n.container()).filter(dr).exists((o=>{const r=e?0:-1;return t(o.data.charAt(n.offset()+r))})),_p=T(kp,!0,lm),Sp=T(kp,!1,lm),Np=e=>{const t=e.container();return dr(t)&&(0===t.data.length||ei(t.data)&&uf.isBookmarkNode(t.parentNode))},Rp=(e,t)=>n=>cu(e?0:-1,n).filter(t).isSome(),Ap=e=>hr(e)&&"block"===uo(Cn(e),"display"),Tp=e=>vr(e)&&!(e=>er(e)&&"all"===e.getAttribute("data-mce-bogus"))(e),Op=Rp(!0,Ap),Bp=Rp(!1,Ap),Pp=Rp(!0,wr),Dp=Rp(!1,wr),Lp=Rp(!0,ar),Mp=Rp(!1,ar),Ip=Rp(!0,Tp),Fp=Rp(!1,Tp),Up=(e,t)=>((e,t,n)=>Sn(t,e)?Bn(e,(e=>n(e)||_n(e,t))).slice(0,-1):[])(e,t,L),zp=(e,t)=>[e].concat(Up(e,t)),jp=(e,t,n)=>Uu(e,t,n,Np),Hp=(e,t,n)=>Q(zp(Cn(t.container()),e),(e=>t=>e.isBlock($t(t)))(n)),$p=(e,t,n,o)=>jp(e,t.dom,n).forall((e=>Hp(t,n,o).fold((()=>!du(e,n,t.dom)),(o=>!du(e,n,t.dom)&&Sn(o,Cn(e.container())))))),Vp=(e,t,n,o)=>Hp(t,n,o).fold((()=>jp(e,t.dom,n).forall((e=>!du(e,n,t.dom)))),(t=>jp(e,t.dom,n).isNone())),qp=T(Vp,!1),Wp=T(Vp,!0),Kp=T($p,!1),Yp=T($p,!0),Gp=e=>yu(e).exists(Va),Xp=(e,t,n,o)=>{const r=Y(zp(Cn(n.container()),t),(e=>o.isBlock($t(e)))),s=le(r).getOr(t);return Iu(e,s.dom,n).filter(Gp)},Zp=(e,t,n)=>yu(t).exists(Va)||Xp(!0,e,t,n).isSome(),Qp=(e,t,n)=>(e=>I.from(e.getNode(!0)).map(Cn))(t).exists(Va)||Xp(!1,e,t,n).isSome(),Jp=T(Xp,!1),eh=T(Xp,!0),th=e=>Ji.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),nh=(e,t,n)=>{const o=Y(zp(Cn(t.container()),e),(e=>n.isBlock($t(e))));return le(o).getOr(e)},oh=(e,t,n)=>th(t)?Sp(t):Sp(t)||Hu(nh(e,t,n).dom,t).exists(Sp),rh=(e,t,n)=>th(t)?_p(t):_p(t)||ju(nh(e,t,n).dom,t).exists(_p),sh=e=>yu(e).bind((e=>Jn(e,Kt))).exists((e=>(e=>H(["pre","pre-wrap"],e))(uo(e,"white-space")))),ah=(e,t)=>n=>{return o=new Vo(n,e)[t](),C(o)&&vr(o)&&Qc(o);var o},ih=(e,t,n)=>!sh(t)&&(((e,t,n)=>((e,t)=>Hu(e.dom,t).isNone())(e,t)||((e,t)=>ju(e.dom,t).isNone())(e,t)||qp(e,t,n)||Wp(e,t,n)||Qp(e,t,n)||Zp(e,t,n))(e,t,n)||oh(e,t,n)||rh(e,t,n)),lh=(e,t,n)=>!sh(t)&&(qp(e,t,n)||Kp(e,t,n)||Qp(e,t,n)||oh(e,t,n)||((e,t)=>{const n=Hu(e.dom,t).getOr(t),o=ah(e.dom,"prev");return t.isAtStart()&&(o(t.container())||o(n.container()))})(e,t)),dh=(e,t,n)=>!sh(t)&&(Wp(e,t,n)||Yp(e,t,n)||Zp(e,t,n)||rh(e,t,n)||((e,t)=>{const n=ju(e.dom,t).getOr(t),o=ah(e.dom,"next");return t.isAtEnd()&&(o(t.container())||o(n.container()))})(e,t)),ch=(e,t,n)=>lh(e,t,n)||dh(e,(e=>{const t=e.container(),n=e.offset();return dr(t)&&nam(e.charAt(t)),mh=(e,t)=>lm(e.charAt(t)),fh=(e,t,n,o)=>{const r=t.data,s=Ji(t,0);return n||!uh(r,0)||ch(e,s,o)?!!(n&&mh(r,0)&&lh(e,s,o))&&(t.data=Wo+r.slice(1),!0):(t.data=" "+r.slice(1),!0)},gh=(e,t,n,o)=>{const r=t.data,s=Ji(t,r.length-1);return n||!uh(r,r.length-1)||ch(e,s,o)?!!(n&&mh(r,r.length-1)&&dh(e,s,o))&&(t.data=r.slice(0,-1)+Wo,!0):(t.data=r.slice(0,-1)+" ",!0)},ph=(e,t,n)=>{const o=t.container();if(!dr(o))return I.none();if((e=>{const t=e.container();return dr(t)&&He(t.data,Wo)})(t)){const r=fh(e,o,!1,n)||(e=>{const t=e.data,n=(e=>{const t=e.split("");return V(t,((e,n)=>am(e)&&n>0&&n{if(0===n)return;const r=Cn(e),s=Qn(r,(e=>o.isBlock($t(e)))).getOr(r),a=e.data.slice(t,t+n),i=t+n>=e.data.length&&dh(s,Ji(e,e.data.length),o),l=0===t&&lh(s,Ji(e,0),o);e.replaceData(t,n,Zo(a,4,l,i))},bh=(e,t,n)=>{const o=e.data.slice(t),r=o.length-Ke(o).length;hh(e,t,r,n)},vh=(e,t,n)=>{const o=e.data.slice(0,t),r=o.length-Ye(o).length;hh(e,t-r,r,n)},yh=(e,t,n,o,r=!0)=>{const s=Ye(e.data).length,a=r?e:t,i=r?t:e;return r?a.appendData(i.data):a.insertData(0,i.data),Eo(Cn(i)),o&&bh(a,s,n),a},Ch=(e,t)=>((e,t)=>{const n=e.container(),o=e.offset();return!Ji.isTextPosition(e)&&n===t.parentNode&&o>Ji.before(t).offset()})(t,e)?Ji(t.container(),t.offset()-1):t,wh=e=>{return Pi(e.previousSibling)?I.some((t=e.previousSibling,dr(t)?Ji(t,t.data.length):Ji.after(t))):e.previousSibling?Vu(e.previousSibling):I.none();var t},xh=e=>{return Pi(e.nextSibling)?I.some((t=e.nextSibling,dr(t)?Ji(t,0):Ji.before(t))):e.nextSibling?$u(e.nextSibling):I.none();var t},Eh=(e,t,n)=>((e,t,n)=>e?((e,t)=>xh(t).orThunk((()=>wh(t))).orThunk((()=>((e,t)=>ju(e,Ji.after(t)).orThunk((()=>Hu(e,Ji.before(t)))))(e,t))))(t,n):((e,t)=>wh(t).orThunk((()=>xh(t))).orThunk((()=>((e,t)=>I.from(t.previousSibling?t.previousSibling:t.parentNode).bind((t=>Hu(e,Ji.before(t)))).orThunk((()=>ju(e,Ji.after(t)))))(e,t))))(t,n))(e,t,n).map(T(Ch,n)),kh=(e,t,n)=>{n.fold((()=>{e.focus()}),(n=>{e.selection.setRng(n.toRange(),t)}))},_h=(e,t)=>t&&ke(e.schema.getBlockElements(),$t(t)),Sh=(e,t,n,o=!0,r=!1)=>{const s=Eh(t,e.getBody(),n.dom),a=Qn(n,T(_h,e),(i=e.getBody(),e=>e.dom===i));var i;const l=((e,t,n,o)=>{const r=Pn(e).filter(Yt),s=Dn(e).filter(Yt);return Eo(e),(a=r,i=s,l=t,d=(e,t,r)=>{const s=e.dom,a=t.dom,i=s.data.length;return yh(s,a,n,o),r.container()===a?Ji(s,i):r},a.isSome()&&i.isSome()&&l.isSome()?I.some(d(a.getOrDie(),i.getOrDie(),l.getOrDie())):I.none()).orThunk((()=>(o&&(r.each((e=>vh(e.dom,e.dom.length,n))),s.each((e=>bh(e.dom,0,n)))),t)));var a,i,l,d})(n,s,e.schema,((e,t)=>ke(e.schema.getTextInlineElements(),$t(t)))(e,n));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):a.bind((t=>((e,t,n)=>{if(Tr(e,t)){const e=bn('
');return n?q(In(t),(e=>{Hm(e)||Eo(e)})):xo(t),yo(t,e),I.some(Ji.before(e.dom))}return I.none()})(e.schema,t,r))).fold((()=>{o&&kh(e,t,l)}),(n=>{o&&kh(e,t,I.some(n))}))},Nh=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,Rh=(e,t)=>En(Cn(t),vd(e))&&!Zr(e.schema,t)&&e.dom.isEditable(t),Ah=e=>{var t;return"rtl"===fa.DOM.getStyle(e,"direction",!0)||(e=>Nh.test(e))(null!==(t=e.textContent)&&void 0!==t?t:"")},Th=(e,t,n)=>{const o=((e,t,n)=>Y(fa.DOM.getParents(n.container(),"*",t),e))(e,t,n);return I.from(o[o.length-1])},Oh=(e,t)=>{const n=t.container(),o=t.offset();return e?si(n)?dr(n.nextSibling)?Ji(n.nextSibling,0):Ji.after(n):li(t)?Ji(n,o+1):t:si(n)?dr(n.previousSibling)?Ji(n.previousSibling,n.previousSibling.data.length):Ji.before(n):di(t)?Ji(n,o-1):t},Bh=T(Oh,!0),Ph=T(Oh,!1),Dh=(e,t)=>{const n=e=>e.stopImmediatePropagation();e.on("beforeinput input",n,!0),e.getDoc().execCommand(t),e.off("beforeinput input",n)},Lh=e=>Dh(e,"Delete"),Mh=e=>qa(e)||Ka(e),Ih=(e,t)=>Sn(e,t)?Jn(t,Mh,(e=>t=>Lt(Tn(t),e,_n))(e)):I.none(),Fh=(e,t=!0)=>{e.dom.isEmpty(e.getBody())&&e.setContent("",{no_selection:!t})},Uh=(e,t,n)=>It($u(n),Vu(n),((o,r)=>{const s=Oh(!0,o),a=Oh(!1,r),i=Oh(!1,t);return e?ju(n,i).exists((e=>e.isEqual(a)&&t.isEqual(s))):Hu(n,i).exists((e=>e.isEqual(s)&&t.isEqual(a)))})).getOr(!0),zh=e=>{var t;return(8===Vt(t=e)||"#comment"===$t(t)?Pn(e):zn(e)).bind(zh).orThunk((()=>I.some(e)))},jh=(e,t,n,o=!0)=>{var r;t.deleteContents();const s=zh(n).getOr(n),a=Cn(null!==(r=e.dom.getParent(s.dom,e.dom.isBlock))&&void 0!==r?r:n.dom);if(a.dom===e.getBody()?Fh(e,o):Tr(e.schema,a,{checkRootAsContent:!1})&&(Qa(a),o&&e.selection.setCursorLocation(a.dom,0)),!_n(n,a)){const t=Lt(Tn(a),n)?[]:Tn(i=a).map(In).map((e=>Y(e,(e=>!_n(i,e))))).getOr([]);q(t.concat(In(n)),(t=>{_n(t,a)||Sn(t,a)||!Tr(e.schema,t)||Eo(t)}))}var i},Hh=e=>zo(e,"td,th"),$h=(e,t)=>fm(Cn(e),t),Vh=(e,t)=>({start:e,end:t}),qh=kl([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),Wh=(e,t)=>oo(Cn(e),"td,th",t),Kh=e=>!_n(e.start,e.end),Yh=(e,t)=>fm(e.start,t).bind((n=>fm(e.end,t).bind((e=>Ft(_n(n,e),n))))),Gh=e=>t=>Yh(t,e).map((e=>((e,t,n)=>({rng:e,table:t,cells:n}))(t,e,Hh(e)))),Xh=(e,t,n,o)=>{if(n.collapsed||!e.forall(Kh))return I.none();if(t.isSameTable){const t=e.bind(Gh(o));return I.some({start:t,end:t})}{const e=Wh(n.startContainer,o),t=Wh(n.endContainer,o),r=e.bind((e=>t=>fm(t,e).bind((e=>de(Hh(e)).map((e=>Vh(t,e))))))(o)).bind(Gh(o)),s=t.bind((e=>t=>fm(t,e).bind((e=>le(Hh(e)).map((e=>Vh(e,t))))))(o)).bind(Gh(o));return I.some({start:r,end:s})}},Zh=(e,t)=>J(e,(e=>_n(e,t))),Qh=e=>It(Zh(e.cells,e.rng.start),Zh(e.cells,e.rng.end),((t,n)=>e.cells.slice(t,n+1))),Jh=(e,t)=>{const{startTable:n,endTable:o}=t,r=e.cloneRange();return n.each((e=>r.setStartAfter(e.dom))),o.each((e=>r.setEndBefore(e.dom))),r},eb=(e,t)=>{const n=(e=>t=>_n(e,t))(e),o=((e,t)=>{const n=Wh(e.startContainer,t),o=Wh(e.endContainer,t);return It(n,o,Vh)})(t,n),r=((e,t)=>{const n=$h(e.startContainer,t),o=$h(e.endContainer,t),r=n.isSome(),s=o.isSome(),a=It(n,o,_n).getOr(!1);return(e=>It(e.startTable,e.endTable,((t,n)=>{const o=$o(t,(e=>_n(e,n))),r=$o(n,(e=>_n(e,t)));return o||r?{...e,startTable:o?I.none():e.startTable,endTable:r?I.none():e.endTable,isSameTable:!1,isMultiTable:!1}:e})).getOr(e))({startTable:n,endTable:o,isStartInTable:r,isEndInTable:s,isSameTable:a,isMultiTable:!a&&r&&s})})(t,n);return((e,t,n)=>e.exists((e=>((e,t)=>!Kh(e)&&Yh(e,t).exists((e=>{const t=e.dom.rows;return 1===t.length&&1===t[0].cells.length})))(e,n)&&hm(e.start,t))))(o,t,n)?o.map((e=>qh.singleCellTable(t,e.start))):r.isMultiTable?((e,t,n,o)=>Xh(e,t,n,o).bind((({start:e,end:o})=>{const r=e.bind(Qh).getOr([]),s=o.bind(Qh).getOr([]);if(r.length>0&&s.length>0){const e=Jh(n,t);return I.some(qh.multiTable(r,s,e))}return I.none()})))(o,r,t,n):((e,t,n,o)=>Xh(e,t,n,o).bind((({start:e,end:t})=>e.or(t))).bind((e=>{const{isSameTable:o}=t,r=Qh(e).getOr([]);if(o&&e.cells.length===r.length)return I.some(qh.fullTable(e.table));if(r.length>0){if(o)return I.some(qh.partialTable(r,I.none()));{const e=Jh(n,t);return I.some(qh.partialTable(r,I.some({...t,rng:e})))}}return I.none()})))(o,r,t,n)},tb=e=>q(e,(e=>{rn(e,"contenteditable"),Qa(e)})),nb=(e,t,n,o)=>{const r=n.cloneRange();o?(r.setStart(n.startContainer,n.startOffset),r.setEndAfter(t.dom.lastChild)):(r.setStartBefore(t.dom.firstChild),r.setEnd(n.endContainer,n.endOffset)),ab(e,r,t,!1).each((e=>e()))},ob=e=>{const t=mm(e),n=Cn(e.selection.getNode());yr(n.dom)&&Tr(e.schema,n)?e.selection.setCursorLocation(n.dom,0):e.selection.collapse(!0),t.length>1&&$(t,(e=>_n(e,n)))&&Jt(n,"data-mce-selected","1")},rb=(e,t,n)=>I.some((()=>{const o=e.selection.getRng(),r=n.bind((({rng:n,isStartInTable:r})=>{const s=((e,t)=>I.from(e.dom.getParent(t,e.dom.isBlock)).map(Cn))(e,r?n.endContainer:n.startContainer);n.deleteContents(),((e,t,n)=>{n.each((n=>{t?Eo(n):(Qa(n),e.selection.setCursorLocation(n.dom,0))}))})(e,r,s.filter(T(Tr,e.schema)));const a=r?t[0]:t[t.length-1];return nb(e,a,o,r),Tr(e.schema,a)?I.none():I.some(r?t.slice(1):t.slice(0,-1))})).getOr(t);tb(r),ob(e)})),sb=(e,t,n,o)=>I.some((()=>{const r=e.selection.getRng(),s=t[0],a=n[n.length-1];nb(e,s,r,!0),nb(e,a,r,!1);const i=Tr(e.schema,s)?t:t.slice(1),l=Tr(e.schema,a)?n:n.slice(0,-1);tb(i.concat(l)),o.deleteContents(),ob(e)})),ab=(e,t,n,o=!0)=>I.some((()=>{jh(e,t,n,o)})),ib=(e,t)=>I.some((()=>Sh(e,!1,t))),lb=(e,t)=>Q(zp(t,e),Ga),db=(e,t)=>Q(zp(t,e),Zt("caption")),cb=(e,t)=>I.some((()=>{Qa(t),e.selection.setCursorLocation(t.dom,0)})),ub=(e,t)=>e?Lp(t):Mp(t),mb=(e,t,n)=>{const o=Cn(e.getBody());return db(o,n).fold((()=>((e,t,n,o)=>{const r=Ji.fromRangeStart(e.selection.getRng());return lb(n,o).bind((o=>Tr(e.schema,o,{checkRootAsContent:!1})?cb(e,o):((e,t,n,o,r)=>Fu(n,e.getBody(),r).bind((e=>lb(t,Cn(e.getNode())).bind((e=>_n(e,o)?I.none():I.some(k))))))(e,n,t,o,r)))})(e,t,o,n).orThunk((()=>Ft(((e,t)=>{const n=Ji.fromRangeStart(e.selection.getRng());return ub(t,n)||Iu(t,e.getBody(),n).exists((e=>ub(t,e)))})(e,t),k)))),(n=>((e,t,n,o)=>{const r=Ji.fromRangeStart(e.selection.getRng());return Tr(e.schema,o)?cb(e,o):((e,t,n,o,r)=>Fu(n,e.getBody(),r).fold((()=>I.some(k)),(s=>((e,t,n,o)=>$u(e.dom).bind((r=>Vu(e.dom).map((e=>t?n.isEqual(r)&&o.isEqual(e):n.isEqual(e)&&o.isEqual(r))))).getOr(!0))(o,n,r,s)?((e,t)=>cb(e,t))(e,o):((e,t,n)=>db(e,Cn(n.getNode())).fold((()=>I.some(k)),(e=>Ft(!_n(e,t),k))))(t,o,s))))(e,n,t,o,r)})(e,t,o,n)))},fb=(e,t)=>{const n=Cn(e.selection.getStart(!0)),o=mm(e);return e.selection.isCollapsed()&&0===o.length?mb(e,t,n):((e,t,n)=>{const o=Cn(e.getBody()),r=e.selection.getRng();return 0!==n.length?rb(e,n,I.none()):((e,t,n,o)=>db(t,o).fold((()=>((e,t,n)=>eb(t,n).bind((t=>t.fold(T(ab,e),T(ib,e),T(rb,e),T(sb,e)))))(e,t,n)),(t=>((e,t)=>cb(e,t))(e,t))))(e,o,r,t)})(e,n,o)},gb=(e,t)=>{let n=t;for(;n&&n!==e;){if(br(n)||vr(n))return n;n=n.parentNode}return null},pb=["data-ephox-","data-mce-","data-alloy-","data-snooker-","_"],hb=Dt.each,bb=e=>{const t=e.dom,n=new Set(e.serializer.getTempAttrs()),o=e=>$(pb,(t=>$e(e,t)))||n.has(e);return{compare:(e,n)=>{if(e.nodeName!==n.nodeName||e.nodeType!==n.nodeType)return!1;const r=e=>{const n={};return hb(t.getAttribs(e),(r=>{const s=r.nodeName.toLowerCase();"style"===s||o(s)||(n[s]=t.getAttrib(e,s))})),n},s=(e,t)=>{for(const n in e)if(ke(e,n)){const o=t[n];if(v(o))return!1;if(e[n]!==o)return!1;delete t[n]}for(const e in t)if(ke(t,e))return!1;return!0};if(er(e)&&er(n)){if(!s(r(e),r(n)))return!1;if(!s(t.parseStyle(t.getAttrib(e,"style")),t.parseStyle(t.getAttrib(n,"style"))))return!1}return!sm(e)&&!sm(n)},isAttributeInternal:o}},vb=e=>["h1","h2","h3","h4","h5","h6"].includes(e.name),yb=(e,t,n,o)=>{const r=n.name;for(let t=0,s=e.length;t{const n=(e,n)=>{pe(e,(e=>{const o=ce(e.nodes);q(e.filter.callbacks,(r=>{for(let t=o.length-1;t>=0;t--){const r=o[t];(n?void 0!==r.attr(e.filter.name):r.name===e.filter.name)&&!y(r.parent)||o.splice(t,1)}o.length>0&&r(o,e.filter.name,t)}))}))};n(e.nodes,!1),n(e.attributes,!0)},wb=(e,t,n,o={})=>{const r=((e,t,n)=>{const o={nodes:{},attributes:{}};return n.firstChild&&((n,r)=>{let s=n;for(;s=s.walk();)yb(e,t,s,o)})(n),o})(e,t,n);Cb(r,o)},xb=(e,t,n,o)=>{if((e.pad_empty_with_br||t.insert)&&n(o)){const e=new ep("br",1);t.insert&&e.attr("data-mce-bogus","1"),o.empty().append(e)}else o.empty().append(new ep("#text",3)).value=Wo},Eb=(e,t)=>{const n=null==e?void 0:e.firstChild;return C(n)&&n===e.lastChild&&n.name===t},kb=(e,t,n,o)=>o.isEmpty(t,n,(t=>((e,t)=>{const n=e.getElementRule(t.name);return!0===(null==n?void 0:n.paddEmpty)})(e,t))),_b=e=>{let t;for(let n=e;n;n=n.parent){const e=n.attr("contenteditable");if("false"===e)break;"true"===e&&(t=n)}return I.from(t)},Sb=(e,t,n=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const o=e.children();for(const e of o)n&&!t.isValidChild(n.name,e.name)&&Sb(e,t,n);e.unwrap()}},Nb=(e,t,n,o=k)=>{const r=t.getTextBlockElements(),s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=Dt.makeMap("tr,td,th,tbody,thead,tfoot,table,summary"),l=new Set,d=e=>e!==n&&!i[e.name];for(let n=0;n1)if(Rb(t,i,c))Sb(i,t);else{f.reverse(),u=f[0].clone(),o(u);let e=u;for(let n=0;n0?(m=f[n].clone(),o(m),e.append(m)):m=e;for(let e=f[n].firstChild;e&&e!==f[n+1];){const t=e.next;m.append(e),e=t}e=m}kb(t,s,a,u)?c.insert(i,f[0],!0):(c.insert(u,f[0],!0),c.insert(i,u)),c=f[0],(kb(t,s,a,c)||Eb(c,"br"))&&c.empty().remove()}else if(i.parent){if("li"===i.name){let e=i.prev;if(e&&("ul"===e.name||"ol"===e.name)){e.append(i);continue}if(e=i.next,e&&("ul"===e.name||"ol"===e.name)&&e.firstChild){e.insert(i,e.firstChild,!0);continue}const t=new ep("ul",1);o(t),i.wrap(t);continue}if(t.isValidChild(i.parent.name,"div")&&t.isValidChild("div",i.name)){const e=new ep("div",1);o(e),i.wrap(e)}else Sb(i,t)}}},Rb=(e,t,n=t.parent)=>!(!n||(!e.children[t.name]||e.isValidChild(n.name,t.name))&&("a"!==t.name||!((e,t)=>{let n=e;for(;n;){if("a"===n.name)return!0;n=n.parent}return!1})(n))&&(!(e=>"summary"===e.name)(n)||!vb(t)||(null==n?void 0:n.firstChild)===t&&(null==n?void 0:n.lastChild)===t)),Ab=e=>e.collapsed?e:(e=>{const t=Ji.fromRangeStart(e),n=Ji.fromRangeEnd(e),o=e.commonAncestorContainer;return Iu(!1,o,n).map((r=>!du(t,n,o)&&du(t,r,o)?((e,t,n,o)=>{const r=document.createRange();return r.setStart(e,t),r.setEnd(n,o),r})(t.container(),t.offset(),r.container(),r.offset()):e)).getOr(e)})(e),Tb=(e,t)=>{let n=t.firstChild,o=t.lastChild;return n&&"meta"===n.name&&(n=n.next),o&&"mce_marker"===o.attr("id")&&(o=o.prev),((e,t)=>{const n=e.getNonEmptyElements();return C(t)&&(t.isEmpty(n)||((e,t)=>e.getBlockElements()[t.name]&&(e=>C(e.firstChild)&&e.firstChild===e.lastChild)(t)&&(e=>"br"===e.name||e.value===Wo)(t.firstChild))(e,t))})(e,o)&&(o=null==o?void 0:o.prev),!(!n||n!==o||"ul"!==n.name&&"ol"!==n.name)},Ob=e=>{return e.length>0&&(!(n=e[e.length-1]).firstChild||C(null==(t=n)?void 0:t.firstChild)&&t.firstChild===t.lastChild&&(e=>e.data===Wo||pr(e))(t.firstChild))?e.slice(0,-1):e;var t,n},Bb=(e,t)=>{const n=e.getParent(t,e.isBlock);return n&&"LI"===n.nodeName?n:null},Pb=(e,t)=>{const n=Ji.after(e),o=Pu(t).prev(n);return o?o.toRange():null},Db=(e,t,n,o)=>{const r=((e,t,n)=>{const o=t.serialize(n);return(e=>{var t,n;const o=e.firstChild,r=e.lastChild;return o&&"META"===o.nodeName&&(null===(t=o.parentNode)||void 0===t||t.removeChild(o)),r&&"mce_marker"===r.id&&(null===(n=r.parentNode)||void 0===n||n.removeChild(r)),e})(e.createFragment(o))})(t,e,o),s=Bb(t,n.startContainer),a=Ob((i=r.firstChild,Y(null!==(l=null==i?void 0:i.childNodes)&&void 0!==l?l:[],(e=>"LI"===e.nodeName))));var i,l;const d=t.getRoot(),c=e=>{const o=Ji.fromRangeStart(n),r=Pu(t.getRoot()),a=1===e?r.prev(o):r.next(o),i=null==a?void 0:a.getNode();return!i||Bb(t,i)!==s};return s?c(1)?((e,t,n)=>{const o=e.parentNode;return o&&Dt.each(t,(t=>{o.insertBefore(t,e)})),((e,t)=>{const n=Ji.before(e),o=Pu(t).next(n);return o?o.toRange():null})(e,n)})(s,a,d):c(2)?((e,t,n,o)=>(o.insertAfter(t.reverse(),e),Pb(t[0],n)))(s,a,d,t):((e,t,n,o)=>{const r=((e,t)=>{const n=t.cloneRange(),o=t.cloneRange();return n.setStartBefore(e),o.setEndAfter(e),[n.cloneContents(),o.cloneContents()]})(e,o),s=e.parentNode;return s&&(s.insertBefore(r[0],e),Dt.each(t,(t=>{s.insertBefore(t,e)})),s.insertBefore(r[1],e),s.removeChild(e)),Pb(t[t.length-1],n)})(s,a,d,n):null},Lb=["pre"],Mb=yr,Ib=(e,t,n)=>{var o,r;const s=e.selection,a=e.dom,i=e.parser,l=n.merge,d=yp({validate:!0},e.schema),c='';n.preserve_zwsp||(t=ti(t)),-1===t.indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,c);let u=s.getRng();const m=u.startContainer,f=e.getBody();m===f&&s.isCollapsed()&&a.isBlock(f.firstChild)&&((e,t)=>C(t)&&!e.schema.getVoidElements()[t.nodeName])(e,f.firstChild)&&a.isEmpty(f.firstChild)&&(u=a.createRng(),u.setStart(f.firstChild,0),u.setEnd(f.firstChild,0),s.setRng(u)),s.isCollapsed()||(e=>{const t=e.dom,n=Ab(e.selection.getRng());e.selection.setRng(n);const o=t.getParent(n.startContainer,Mb);((e,t,n)=>!!C(n)&&n===e.getParent(t.endContainer,Mb)&&hm(Cn(n),t))(t,n,o)?ab(e,n,Cn(o)):n.startContainer===n.endContainer&&n.endOffset-n.startOffset==1&&dr(n.startContainer.childNodes[n.startOffset])?n.deleteContents():e.getDoc().execCommand("Delete",!1)})(e);const g=s.getNode(),p={context:g.nodeName.toLowerCase(),data:n.data,insert:!0},h=i.parse(t,p);if(!0===n.paste&&Tb(e.schema,h)&&((e,t)=>!!Bb(e,t))(a,g))return u=Db(d,a,s.getRng(),h),u&&s.setRng(u),t;!0===n.paste&&((e,t,n,o)=>{var r;const s=t.firstChild,a=t.lastChild,i=s===("bookmark"===a.attr("data-mce-type")?a.prev:a),l=H(Lb,s.name);if(i&&l){const t="false"!==s.attr("contenteditable"),a=(null===(r=e.getParent(n,e.isBlock))||void 0===r?void 0:r.nodeName.toLowerCase())===s.name,i=I.from(gb(o,n)).forall(br);return t&&a&&i}return!1})(a,h,g,e.getBody())&&(null===(o=h.firstChild)||void 0===o||o.unwrap()),(e=>{let t=e;for(;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")})(h);let b=h.lastChild;if(b&&"mce_marker"===b.attr("id")){const t=b;for(b=b.prev;b;b=b.walk(!0))if(3===b.type||!a.isBlock(b.name)){b.parent&&e.schema.isValidChild(b.parent.name,"span")&&b.parent.insert(t,b,"br"===b.name);break}}if(e._selectionOverrides.showBlockCaretContainer(g),p.invalid||((e,t,n)=>{var o;return $(n.children(),vb)&&"SUMMARY"===(null===(o=e.getParent(t,e.isBlock))||void 0===o?void 0:o.nodeName)})(a,g,h)){e.selection.setContent(c);let n,o=s.getNode();const l=e.getBody();for(fr(o)?o=n=l:n=o;n&&n!==l;)o=n,n=n.parentNode;t=o===l?l.innerHTML:a.getOuterHTML(o);const u=i.parse(t),m=(e=>{for(let t=e;t;t=t.walk())if("mce_marker"===t.attr("id"))return I.some(t);return I.none()})(u),f=m.bind(_b).getOr(u);m.each((e=>e.replace(h)));const g=h.children(),p=null!==(r=h.parent)&&void 0!==r?r:u;h.unwrap();const b=Y(g,(t=>Rb(e.schema,t,p)));Nb(b,e.schema,f),wb(i.getNodeFilters(),i.getAttributeFilters(),u),t=d.serialize(u),o===l?a.setHTML(l,t):a.setOuterHTML(o,t)}else t=d.serialize(h),((e,t,n)=>{var o;if("all"===n.getAttribute("data-mce-bogus"))null===(o=n.parentNode)||void 0===o||o.insertBefore(e.dom.createFragment(t),n);else{const o=n.firstChild,r=n.lastChild;!o||o===r&&"BR"===o.nodeName?e.dom.setHTML(n,t):e.selection.setContent(t,{no_events:!0})}})(e,t,g);var v;return((e,t)=>{const n=e.schema.getTextInlineElements(),o=e.dom;if(t){const t=e.getBody(),r=bb(e);Dt.each(o.select("*[data-mce-fragment]"),(e=>{if(C(n[e.nodeName.toLowerCase()])&&((e,t)=>ne(xp(e,t),(e=>!(e=>Cp.has(e))(e))))(o,e))for(let n=e.parentElement;C(n)&&n!==t&&!Ep(o,e,n);n=n.parentElement)if(r.compare(n,e)){o.remove(e,!0);break}}))}})(e,l),((e,t)=>{var n,o,r;let s;const a=e.dom,i=e.selection;if(!t)return;i.scrollIntoView(t);const l=gb(e.getBody(),t);if(l&&"false"===a.getContentEditable(l))return a.remove(t),void i.select(l);let d=a.createRng();const c=t.previousSibling;if(dr(c)){d.setStart(c,null!==(o=null===(n=c.nodeValue)||void 0===n?void 0:n.length)&&void 0!==o?o:0);const e=t.nextSibling;dr(e)&&(c.appendData(e.data),null===(r=e.parentNode)||void 0===r||r.removeChild(e))}else d.setStartBefore(t),d.setEndBefore(t);const u=a.getParent(t,a.isBlock);if(a.remove(t),u&&a.isEmpty(u)){const t=Mb(u);xo(Cn(u)),d.setStart(u,0),d.setEnd(u,0),t||(e=>!!e.getAttribute("data-mce-fragment"))(u)||!(s=(t=>{let n=Ji.fromRangeStart(t);return n=Pu(e.getBody()).next(n),null==n?void 0:n.toRange()})(d))?a.add(u,a.create("br",t?{}:{"data-mce-bogus":"1"})):(d=s,a.remove(u))}i.setRng(d)})(e,a.get("mce_marker")),v=e.getBody(),Dt.each(v.getElementsByTagName("*"),(e=>{e.removeAttribute("data-mce-fragment")})),((e,t,n)=>{I.from(e.getParent(t,"td,th")).map(Cn).each((e=>((e,t)=>{zn(e).each((n=>{Pn(n).each((o=>{t.isBlock($t(e))&&Va(n)&&t.isBlock($t(o))&&Eo(n)}))}))})(e,n)))})(a,s.getStart(),e.schema),((e,t,n)=>{const o=Bn(Cn(n),(e=>_n(e,Cn(t))));ie(o,o.length-2).filter(Kt).fold((()=>Wr(e,t)),(t=>Wr(e,t.dom)))})(e.schema,e.getBody(),s.getStart()),t},Fb=e=>e instanceof ep,Ub=(e,t,n)=>{e.dom.setHTML(e.getBody(),t),!0!==n&&(e=>{jg(e)&&$u(e.getBody()).each((t=>{const n=t.getNode(),o=ar(n)?$u(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e)},zb=e=>w(e)?e:L,jb=(e,t,n)=>{const o=t(e),r=zb(n);return o.orThunk((()=>r(e)?I.none():((e,t,n)=>{let o=e.dom;const r=zb(n);for(;o.parentNode;){o=o.parentNode;const e=Cn(o),n=t(e);if(n.isSome())return n;if(r(e))break}return I.none()})(e,t,r)))},Hb=Om,$b=(e,t,n)=>{const o=e.formatter.get(n);if(o)for(let n=0;n{const s=e.dom.getRoot();if(t===s)return!1;const a=e.dom.getParent(t,(t=>!!$b(e,t,n)||t.parentNode===s||!!Kb(e,t,n,o,!0)));return!!Kb(e,a,n,o,r)},qb=(e,t,n)=>!(!Um(n)||!Hb(t,n.inline))||!(!Im(n)||!Hb(t,n.block))||!!Fm(n)&&er(t)&&e.is(t,n.selector),Wb=(e,t,n,o,r,s)=>{const a=n[o],i="attributes"===o;if(w(n.onmatch))return n.onmatch(t,n,o);if(a)if(Ne(a)){for(let n=0;n{const s=e.formatter.get(n),a=e.dom;if(s&&er(t))for(let n=0;n{if(o)return Vb(e,o,t,n,r);if(o=e.selection.getNode(),Vb(e,o,t,n,r))return!0;const s=e.selection.getStart();return!(s===o||!Vb(e,s,t,n,r))},Gb=Ja,Xb=e=>{if(e){const t=new Vo(e,e);for(let e=t.current();e;e=t.next())if(dr(e))return e}return null},Zb=e=>{const t=vn("span");return en(t,{id:qu,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&yo(t,yn(Gb)),t},Qb=(e,t,n)=>{const o=e.dom,r=e.selection;if(jm(t))Sh(e,!1,Cn(t),n,!0);else{const e=r.getRng(),n=o.getParent(t,o.isBlock),s=e.startContainer,a=e.startOffset,i=e.endContainer,l=e.endOffset,d=(e=>{const t=Xb(e);return t&&t.data.charAt(0)===Gb&&t.deleteData(0,1),t})(t);o.remove(t,!0),s===d&&a>0&&e.setStart(d,a-1),i===d&&l>0&&e.setEnd(d,l-1),n&&o.isEmpty(n)&&Qa(Cn(n)),r.setRng(e)}},Jb=(e,t,n)=>{const o=e.dom,r=e.selection;if(t)Qb(e,t,n);else if(!(t=Ku(e.getBody(),r.getStart())))for(;t=o.get(qu);)Qb(e,t,n)},ev=(e,t)=>(e.appendChild(t),t),tv=(e,t)=>{var n;const o=G(e,((e,t)=>ev(e,t.cloneNode(!1))),t),r=null!==(n=o.ownerDocument)&&void 0!==n?n:document;return ev(o,r.createTextNode(Gb))},nv=(e,t,n,o)=>{const a=e.dom,i=e.selection;let l=!1;const d=e.formatter.get(t);if(!d)return;const c=i.getRng(),u=c.startContainer,m=c.startOffset;let f=u;dr(u)&&(m!==u.data.length&&(l=!0),f=f.parentNode);const g=[];let h;for(;f;){if(Kb(e,f,t,n,o)){h=f;break}f.nextSibling&&(l=!0),g.push(f),f=f.parentNode}if(h)if(l){const r=i.getBookmark();c.collapse(!0);let s=of(a,c,d,!0);s=Zf(s),e.formatter.remove(t,n,s,o),i.moveToBookmark(r)}else{const l=Ku(e.getBody(),h),d=C(l)?a.getParents(h.parentNode,M,l):[],c=Zb(!1).dom;((e,t,n)=>{var o,r;const s=e.dom,a=s.getParent(n,T(Sm,e.schema));a&&s.isEmpty(a)?null===(o=n.parentNode)||void 0===o||o.replaceChild(t,n):((e=>{const t=zo(e,"br"),n=Y((e=>{const t=[];let n=e.dom;for(;n;)t.push(Cn(n)),n=n.lastChild;return t})(e).slice(-1),Va);t.length===n.length&&q(n,Eo)})(Cn(n)),s.isEmpty(n)?null===(r=n.parentNode)||void 0===r||r.replaceChild(t,n):s.insertAfter(t,n))})(e,c,null!=l?l:h);const u=((e,t,n,o,a,i)=>{const l=e.formatter,d=e.dom,c=Y(fe(l.get()),(e=>e!==o&&!He(e,"removeformat"))),u=((e,t,n)=>X(n,((n,o)=>{const r=((e,t)=>Mm(e,t,(e=>{const t=e=>w(e)||e.length>1&&"%"===e.charAt(0);return $(["styles","attributes"],(n=>Ee(e,n).exists((e=>{const n=p(e)?e:xe(e);return $(n,t)}))))})))(e,o);return e.formatter.matchNode(t,o,{},r)?n.concat([o]):n}),[]))(e,n,c);if(Y(u,(t=>!((e,t,n)=>{const o=["inline","block","selector","attributes","styles","classes"],a=e=>Ce(e,((e,t)=>$(o,(e=>e===t))));return Mm(e,t,(t=>{const o=a(t);return Mm(e,n,(e=>{const t=a(e);return((e,t,n=s)=>r(n).eq(e,t))(o,t)}))}))})(e,t,o))).length>0){const e=n.cloneNode(!1);return d.add(t,e),l.remove(o,a,e,i),d.remove(e),I.some(e)}return I.none()})(e,c,h,t,n,o),m=tv([...g,...u.toArray(),...d],c);l&&Qb(e,l,C(l)),i.setCursorLocation(m,1),a.isEmpty(h)&&a.remove(h)}},ov=e=>{const t=Zb(!1),n=tv(e,t.dom);return{caretContainer:t,caretPosition:Ji(n,0)}},rv=(e,t)=>{const{caretContainer:n,caretPosition:o}=ov(t);return ho(Cn(e),n),Eo(Cn(e)),o},sv=(e,t)=>{if(Wu(t.dom))return!1;const n=e.schema.getTextInlineElements();return ke(n,$t(t))&&!Wu(t.dom)&&!sr(t.dom)},av={},iv=or(["pre"]);((e,t)=>{av[e]||(av[e]=[]),av[e].push((e=>{if(!e.selection.getRng().collapsed){const t=e.selection.getSelectedBlocks(),n=Y(Y(t,iv),(e=>t=>{const n=t.previousSibling;return iv(n)&&H(e,n)})(t));q(n,(e=>{((e,t)=>{const n=Cn(t),o=Rn(n).dom;Eo(n),wo(Cn(e),[vn("br",o),vn("br",o),...In(n)])})(e.previousSibling,e)}))}}))})("pre");const lv=["fontWeight","fontStyle","color","fontSize","fontFamily"],dv=(e,t)=>{const n=e.get(t);return p(n)?Q(n,(e=>Um(e)&&"span"===e.inline&&(e=>f(e.styles)&&$(fe(e.styles),(e=>H(lv,e))))(e))):I.none()},cv=(e,t)=>Hu(t,Ji.fromRangeStart(e)).isNone(),uv=(e,t)=>!1===ju(t,Ji.fromRangeEnd(e)).exists((e=>!pr(e.getNode())||ju(t,e).isSome())),mv=e=>t=>xr(t)&&e.isEditable(t),fv=e=>Y(e.getSelectedBlocks(),mv(e.dom)),gv=Dt.each,pv=e=>er(e)&&!sm(e)&&!Wu(e)&&!sr(e),hv=(e,t)=>{for(let n=e;n;n=n[t]){if(dr(n)&&Ge(n.data))return e;if(er(n)&&!sm(n))return n}return e},bv=(e,t,n)=>{const o=bb(e),r=tr(t)&&e.dom.isEditable(t),s=tr(n)&&e.dom.isEditable(n);if(r&&s){const r=hv(t,"previousSibling"),s=hv(n,"nextSibling");if(o.compare(r,s)){for(let e=r.nextSibling;e&&e!==s;){const t=e;e=e.nextSibling,r.appendChild(t)}return e.dom.remove(s),Dt.each(Dt.grep(s.childNodes),(e=>{r.appendChild(e)})),r}}return n},vv=(e,t,n,o)=>{var r;if(o&&!1!==t.merge_siblings){const t=null!==(r=bv(e,_m(o),o))&&void 0!==r?r:o;bv(e,t,_m(t,!0))}},yv=(e,t,n)=>{gv(e.childNodes,(e=>{pv(e)&&(t(e)&&n(e),e.hasChildNodes()&&yv(e,t,n))}))},Cv=(e,t)=>n=>!(!n||!Pm(e,n,t)),wv=(e,t,n)=>o=>{e.setStyle(o,t,n),""===o.getAttribute("style")&&o.removeAttribute("style"),((e,t)=>{"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)})(e,o)},xv=kl([{keep:[]},{rename:["name"]},{removed:[]}]),Ev=/^(src|href|style)$/,kv=Dt.each,_v=Om,Sv=(e,t,n)=>e.isChildOf(t,n)&&t!==n&&!e.isBlock(n),Nv=(e,t,n)=>{let o=t[n?"startContainer":"endContainer"],r=t[n?"startOffset":"endOffset"];if(er(o)){const e=o.childNodes.length-1;!n&&r&&r--,o=o.childNodes[r>e?e:r]}return dr(o)&&n&&r>=o.data.length&&(o=new Vo(o,e.getBody()).next()||o),dr(o)&&!n&&0===r&&(o=new Vo(o,e.getBody()).prev()||o),o},Rv=(e,t)=>{const n=t?"firstChild":"lastChild",o=e[n];return(e=>/^(TR|TH|TD)$/.test(e.nodeName))(e)&&o?"TR"===e.nodeName&&o[n]||o:e},Av=(e,t,n,o)=>{var r;const s=e.create(n,o);return null===(r=t.parentNode)||void 0===r||r.insertBefore(s,t),s.appendChild(t),s},Tv=(e,t,n,o,r)=>{const s=Cn(t),a=Cn(e.create(o,r)),i=n?Mn(s):Ln(s);return wo(a,i),n?(ho(s,a),vo(a,s)):(bo(s,a),yo(a,s)),a.dom},Ov=(e,t,n)=>{const o=t.parentNode;let r;const s=e.dom,a=Wl(e);Im(n)&&o===s.getRoot()&&(n.list_block&&_v(t,n.list_block)||q(ce(t.childNodes),(t=>{Nm(e,a,t.nodeName.toLowerCase())?r?r.appendChild(t):(r=Av(s,t,a),s.setAttribs(r,Kl(e))):r=null}))),(e=>Fm(e)&&Um(e)&&Lt(Ee(e,"mixed"),!0))(n)&&!_v(n.inline,t)||s.remove(t,!0)},Bv=(e,t,n)=>x(e)?{name:t,value:null}:{name:e,value:Tm(t,n)},Pv=(e,t)=>{""===e.getAttrib(t,"style")&&(t.removeAttribute("style"),t.removeAttribute("data-mce-style"))},Dv=(e,t,n,o,r)=>{let s=!1;kv(n.styles,((a,i)=>{const{name:l,value:d}=Bv(i,a,o),c=Bm(d,l);(n.remove_similar||h(d)||!er(r)||_v(Pm(e,r,l),c))&&e.setStyle(t,l,""),s=!0})),s&&Pv(e,t)},Lv=(e,t,n,o,r)=>{const s=e.dom,a=bb(e),i=e.schema;if(Um(t)&&Gr(i,t.inline)&&Zr(i,o)&&o.parentElement===e.getBody())return Ov(e,o,t),xv.removed();if(!t.ceFalseOverride&&o&&"false"===s.getContentEditableParent(o))return xv.keep();if(o&&!qb(s,o,t)&&!((e,t)=>t.links&&"A"===e.nodeName)(o,t))return xv.keep();const l=o,d=t.preserve_attributes;if(Um(t)&&"all"===t.remove&&p(d)){const e=Y(s.getAttribs(l),(e=>H(d,e.name.toLowerCase())));if(s.removeAllAttribs(l),q(e,(e=>s.setAttrib(l,e.name,e.value))),e.length>0)return xv.rename("span")}if("all"!==t.remove){Dv(s,l,t,n,r),kv(t.attributes,((e,o)=>{const{name:a,value:i}=Bv(o,e,n);if(t.remove_similar||h(i)||!er(r)||_v(s.getAttrib(r,a),i)){if("class"===a){const e=s.getAttrib(l,a);if(e){let t="";if(q(e.split(/\s+/),(e=>{/mce\-\w+/.test(e)&&(t+=(t?" ":"")+e)})),t)return void s.setAttrib(l,a,t)}}if(Ev.test(a)&&l.removeAttribute("data-mce-"+a),"style"===a&&or(["li"])(l)&&"none"===s.getStyle(l,"list-style-type"))return l.removeAttribute(a),void s.setStyle(l,"list-style-type","none");"class"===a&&l.removeAttribute("className"),l.removeAttribute(a)}})),kv(t.classes,(e=>{e=Tm(e,n),er(r)&&!s.hasClass(r,e)||s.removeClass(l,e)}));const e=s.getAttribs(l);for(let t=0;tLv(e,t,n,o,o).fold(N(o),(t=>(e.dom.createFragment().appendChild(o),e.dom.rename(o,t))),N(null)),Iv=(e,t,n,o,r)=>{(o||e.selection.isEditable())&&((e,t,n,o,r)=>{const s=e.formatter.get(t),a=s[0],i=e.dom,l=e.selection,d=o=>{const i=((e,t,n,o,r)=>{let s;return t.parentNode&&q(Lm(e.dom,t.parentNode).reverse(),(t=>{if(!s&&er(t)&&"_start"!==t.id&&"_end"!==t.id){const a=Kb(e,t,n,o,r);a&&!1!==a.split&&(s=t)}})),s})(e,o,t,n,r);return((e,t,n,o,r,s,a,i)=>{var l,d;let c,u;const m=e.dom;if(n){const s=n.parentNode;for(let n=o.parentNode;n&&n!==s;n=n.parentNode){let o=m.clone(n,!1);for(let n=0;n$(s,(o=>Fv(e,o,n,t,t))),u=t=>{const n=ce(t.childNodes),o=c(t)||$(s,(e=>qb(i,t,e))),r=t.parentNode;if(!o&&C(r)&&zm(a)&&c(r),a.deep&&n.length)for(let e=0;e{er(t)&&e.dom.getStyle(t,"text-decoration")===n&&t.parentNode&&Dm(i,t.parentNode)===n&&Fv(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:n}},void 0,t)}))},m=e=>{const t=i.get(e?"_start":"_end");if(t){let n=t[e?"firstChild":"lastChild"];return(e=>sm(e)&&er(e)&&("_start"===e.id||"_end"===e.id))(n)&&(n=n[e?"firstChild":"lastChild"]),dr(n)&&0===n.data.length&&(n=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),i.remove(t,!0),n}return null},f=t=>{let n,o,r=of(i,t,s,t.collapsed);if(a.split){if(r=Zf(r),n=Nv(e,r,!0),o=Nv(e,r),n!==o){if(n=Rv(n,!0),o=Rv(o,!1),Sv(i,n,o)){const e=I.from(n.firstChild).getOr(n);return d(Tv(i,e,!0,"span",{id:"_start","data-mce-type":"bookmark"})),void m(!0)}if(Sv(i,o,n)){const e=I.from(o.lastChild).getOr(o);return d(Tv(i,e,!1,"span",{id:"_end","data-mce-type":"bookmark"})),void m(!1)}n=Av(i,n,"span",{id:"_start","data-mce-type":"bookmark"}),o=Av(i,o,"span",{id:"_end","data-mce-type":"bookmark"});const e=i.createRng();e.setStartAfter(n),e.setEndBefore(o),rf(i,e,(e=>{q(e,(e=>{sm(e)||sm(e.parentNode)||d(e)}))})),d(n),d(o),n=m(!0),o=m()}else n=o=d(n);r.startContainer=n.parentNode?n.parentNode:n,r.startOffset=i.nodeIndex(n),r.endContainer=o.parentNode?o.parentNode:o,r.endOffset=i.nodeIndex(o)+1}rf(i,r,(e=>{q(e,u)}))};if(o){if(wm(o)){const e=i.createRng();e.setStartBefore(o),e.setEndAfter(o),f(e)}else f(o);pf(e,t,o,n)}else l.isCollapsed()&&Um(a)&&!mm(e).length?nv(e,t,n,r):(Em(e,(()=>ym(e,f)),(o=>Um(a)&&Yb(e,t,n,o))),e.nodeChanged()),((e,t,n)=>{"removeformat"===t?q(fv(e.selection),(t=>{q(lv,(n=>e.dom.setStyle(t,n,""))),Pv(e.dom,t)})):dv(e.formatter,t).each((t=>{q(fv(e.selection),(o=>Dv(e.dom,o,t,n,null)))}))})(e,t,n),pf(e,t,o,n)})(e,t,n,o,r)},Fv=(e,t,n,o,r)=>Lv(e,t,n,o,r).fold(L,(t=>(e.dom.rename(o,t),!0)),M),Uv=Dt.each,zv=Dt.each,jv=(e,t,n,o)=>{if(zv(n.styles,((n,r)=>{e.setStyle(t,r,Tm(n,o))})),n.styles){const n=e.getAttrib(t,"style");n&&e.setAttrib(t,"data-mce-style",n)}},Hv=(e,t,n,o)=>{const r=e.formatter.get(t),s=r[0],a=!o&&e.selection.isCollapsed(),i=e.dom,l=e.selection,d=(e,t=s)=>{w(t.onformat)&&t.onformat(e,t,n,o),jv(i,e,t,n),zv(t.attributes,((t,o)=>{i.setAttrib(e,o,Tm(t,n))})),zv(t.classes,(t=>{const o=Tm(t,n);i.hasClass(e,o)||i.addClass(e,o)}))},c=(e,t)=>{let n=!1;return zv(e,(e=>!(!Fm(e)||("false"!==i.getContentEditable(t)||e.ceFalseOverride)&&(!C(e.collapsed)||e.collapsed===a)&&i.is(t,e.selector)&&!Wu(t)&&(d(t,e),n=!0,1)))),n},u=e=>{if(m(e)){const t=i.create(e);return d(t),t}return null},f=(o,a,i)=>{const l=[];let m=!0;const f=s.inline||s.block,g=u(f);rf(o,a,(a=>{let u;const p=a=>{let h=!1,b=m,v=!1;const y=a.parentNode,w=y.nodeName.toLowerCase(),x=o.getContentEditable(a);C(x)&&(b=m,m="true"===x,h=!0,v=Am(e,a));const E=m&&!h;if(pr(a)&&!((e,t,n,o)=>{if(Od(e)&&Um(t)&&n.parentNode){const t=Ms(e.schema),r=Ho(Cn(n),(e=>Wu(e.dom)));return _e(t,o)&&Ar(e.schema,n.parentNode,{skipBogus:!1,includeZwsp:!0})&&!r}return!1})(e,s,a,w))return u=null,void(Im(s)&&o.remove(a));if((o=>(e=>Im(e)&&!0===e.wrapper)(s)&&Kb(e,o,t,n))(a))u=null;else{if(((t,n,o)=>{const r=(e=>Im(e)&&!0!==e.wrapper)(s)&&Sm(e.schema,t)&&Nm(e,n,f);return o&&r})(a,w,E)){const e=o.rename(a,f);return d(e),l.push(e),void(u=null)}if(Fm(s)){let e=c(r,a);if(!e&&C(y)&&zm(s)&&(e=c(r,y)),!Um(s)||e)return void(u=null)}C(g)&&((t,n,r,a)=>{const l=t.nodeName.toLowerCase(),d=Nm(e,f,l)&&Nm(e,n,f),c=!i&&dr(t)&&ei(t.data),u=Wu(t),m=!Um(s)||!o.isBlock(t);return(r||a)&&d&&!c&&!u&&m})(a,w,E,v)?(u||(u=o.clone(g,!1),y.insertBefore(u,a),l.push(u)),v&&h&&(m=b),u.appendChild(a)):(u=null,q(ce(a.childNodes),p),h&&(m=b),u=null)}};q(a,p)})),!0===s.links&&q(l,(e=>{const t=e=>{"A"===e.nodeName&&d(e,s),q(ce(e.childNodes),t)};t(e)})),q(l,(a=>{const i=(e=>{let t=0;return q(e.childNodes,(e=>{(e=>C(e)&&dr(e)&&0===e.length)(e)||sm(e)||t++})),t})(a);!(l.length>1)&&o.isBlock(a)||0!==i?(Um(s)||Im(s)&&s.wrapper)&&(s.exact||1!==i||(a=(e=>{const t=Q(e.childNodes,xm).filter((e=>"false"!==o.getContentEditable(e)&&qb(o,e,s)));return t.map((t=>{const n=o.clone(t,!1);return d(n),o.replace(n,e,!0),o.remove(t,!0),n})).getOr(e)})(a)),((e,t,n,o)=>{Uv(t,(t=>{Um(t)&&Uv(e.dom.select(t.inline,o),(o=>{pv(o)&&Fv(e,t,n,o,t.exact?o:null)})),((e,t,n)=>{if(t.clear_child_styles){const o=t.links?"*:not(a)":"*";gv(e.select(o,n),(n=>{pv(n)&&e.isEditable(n)&&gv(t.styles,((t,o)=>{e.setStyle(n,o,"")}))}))}})(e.dom,t,o)}))})(e,r,n,a),((e,t,n,o,r)=>{const s=r.parentNode;Kb(e,s,n,o)&&Fv(e,t,o,r)||t.merge_with_parents&&s&&e.dom.getParent(s,(s=>!!Kb(e,s,n,o)&&(Fv(e,t,o,r),!0)))})(e,s,t,n,a),((e,t,n,o)=>{if(t.styles&&t.styles.backgroundColor){const r=Cv(e,"fontSize");yv(o,(t=>r(t)&&e.isEditable(t)),wv(e,"backgroundColor",Tm(t.styles.backgroundColor,n)))}})(o,s,n,a),((e,t,n,o)=>{const r=t=>{if(tr(t)&&er(t.parentNode)&&e.isEditable(t)){const n=Dm(e,t.parentNode);e.getStyle(t,"color")&&n?e.setStyle(t,"text-decoration",n):e.getStyle(t,"text-decoration")===n&&e.setStyle(t,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(Dt.walk(o,r,"childNodes"),r(o))})(o,s,0,a),((e,t,n,o)=>{if(Um(t)&&("sub"===t.inline||"sup"===t.inline)){const n=Cv(e,"fontSize");yv(o,(t=>n(t)&&e.isEditable(t)),wv(e,"fontSize",""));const r=Y(e.select("sup"===t.inline?"sub":"sup",o),e.isEditable);e.remove(r,!0)}})(o,s,0,a),vv(e,s,0,a)):o.remove(a,!0)}))},g=wm(o)?o:l.getNode();if("false"===i.getContentEditable(g)&&!Am(e,g))return c(r,o=g),void gf(e,t,o,n);if(s){if(o)if(wm(o)){if(!c(r,o)){const e=i.createRng();e.setStartBefore(o),e.setEndAfter(o),f(i,of(i,e,r),!0)}}else f(i,o,!0);else a&&Um(s)&&!mm(e).length?((e,t,n)=>{let o;const r=e.selection,s=e.formatter.get(t);if(!s)return;const a=r.getRng();let i=a.startOffset;const l=a.startContainer.nodeValue;o=Ku(e.getBody(),r.getStart());const d=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(l&&i>0&&i{ym(e,((e,t)=>{const n=t?e:of(i,e,r);f(i,n,!1)}))}),M),e.nodeChanged()),dv(e.formatter,t).each((t=>{q((e=>Y((e=>{const t=e.getSelectedBlocks(),n=e.getRng();if(e.isCollapsed())return[];if(1===t.length)return cv(n,t[0])&&uv(n,t[0])?t:[];{const e=le(t).filter((e=>cv(n,e))).toArray(),o=de(t).filter((e=>uv(n,e))).toArray(),r=t.slice(1,-1);return e.concat(r).concat(o)}})(e),mv(e.dom)))(e.selection),(e=>jv(i,e,t,n)))}));((e,t)=>{ke(av,e)&&q(av[e],(e=>{e(t)}))})(t,e)}gf(e,t,o,n)},$v=(e,t,n,o)=>{(o||e.selection.isEditable())&&Hv(e,t,n,o)},Vv=e=>ke(e,"vars"),qv=e=>e.selection.getStart(),Wv=(e,t,n,o,r)=>Z(t,(t=>{const s=e.formatter.matchNode(t,n,null!=r?r:{},o);return!v(s)}),(t=>!!$b(e,t,n)||!o&&C(e.formatter.matchNode(t,n,r,!0)))),Kv=(e,t)=>{const n=null!=t?t:qv(e);return Y(Lm(e.dom,n),(e=>er(e)&&!sr(e)))},Yv=(e,t,n)=>{const o=Kv(e,t);pe(n,((n,r)=>{const s=n=>{const s=Wv(e,o,r,n.similar,Vv(n)?n.vars:void 0),a=s.isSome();if(n.state.get()!==a){n.state.set(a);const e=s.getOr(t);Vv(n)?n.callback(a,{node:e,format:r,parents:o}):q(n.callbacks,(t=>t(a,{node:e,format:r,parents:o})))}};q([n.withSimilar,n.withoutSimilar],s),q(n.withVars,s)}))},Gv=Dt.explode,Xv=()=>{const e={};return{addFilter:(t,n)=>{q(Gv(t),(t=>{ke(e,t)||(e[t]={name:t,callbacks:[]}),e[t].callbacks.push(n)}))},getFilters:()=>xe(e),removeFilter:(t,n)=>{q(Gv(t),(t=>{if(ke(e,t))if(C(n)){const o=e[t],r=Y(o.callbacks,(e=>e!==n));r.length>0?o.callbacks=r:delete e[t]}else delete e[t]}))}}},Zv=(e,t,n)=>{var o;const r=Ys();t.convert_fonts_to_spans&&((e,t,n)=>{e.addNodeFilter("font",(e=>{q(e,(e=>{const o=t.parse(e.attr("style")),r=e.attr("color"),s=e.attr("face"),a=e.attr("size");r&&(o.color=r),s&&(o["font-family"]=s),a&&Ze(a).each((e=>{o["font-size"]=n[e-1]})),e.name="span",e.attr("style",t.serialize(o)),((e,t)=>{q(["color","face","size"],(t=>{e.attr(t,null)}))})(e)}))}))})(e,r,Dt.explode(null!==(o=t.font_size_legacy_values)&&void 0!==o?o:"")),((e,t,n)=>{e.addNodeFilter("strike",(e=>{const o="html4"!==t.type;q(e,(e=>{if(o)e.name="s";else{const t=n.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",n.serialize(t))}}))}))})(e,n,r)},Qv=e=>{const[t,...n]=e.split(","),o=n.join(","),r=/data:([^/]+\/[^;]+)(;.+)?/.exec(t);if(r){const e=";base64"===r[2],t=e?(e=>{const t=/([a-z0-9+\/=\s]+)/i.exec(e);return t?t[1]:""})(o):decodeURIComponent(o);return I.some({type:r[1],data:t,base64Encoded:e})}return I.none()},Jv=(e,t,n=!0)=>{let o=t;if(n)try{o=atob(t)}catch(e){return I.none()}const r=new Uint8Array(o.length);for(let e=0;enew Promise(((t,n)=>{const o=new FileReader;o.onloadend=()=>{t(o.result)},o.onerror=()=>{var e;n(null===(e=o.error)||void 0===e?void 0:e.message)},o.readAsDataURL(e)}));let ty=0;const ny=(e,t,n)=>Qv(e).bind((({data:e,type:o,base64Encoded:r})=>{if(t&&!r)return I.none();{const t=r?e:btoa(e);return n(t,o)}})),oy=(e,t,n)=>{const o=e.create("blobid"+ty++,t,n);return e.add(o),o},ry=(e,t,n=!1)=>ny(t,n,((t,n)=>I.from(e.getByData(t,n)).orThunk((()=>Jv(n,t).map((n=>oy(e,n,t))))))),sy=/^(?:(?:(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)([A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*))(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?)$/,ay=e=>I.from(e.match(sy)).bind((e=>ie(e,1))).map((e=>$e(e,"www.")?e.substring(4):e)),iy=(e,t)=>{I.from(e.attr("src")).bind(ay).forall((e=>!H(t,e)))&&e.attr("sandbox","")},ly=(e,t)=>$e(e,`${t}/`),{entries:dy,setPrototypeOf:cy,isFrozen:uy,getPrototypeOf:my,getOwnPropertyDescriptor:fy}=Object;let{freeze:gy,seal:py,create:hy}=Object,{apply:by,construct:vy}="undefined"!=typeof Reflect&&Reflect;by||(by=function(e,t,n){return e.apply(t,n)}),gy||(gy=function(e){return e}),py||(py=function(e){return e}),vy||(vy=function(e,t){return new e(...t)});const yy=Oy(Array.prototype.forEach),Cy=Oy(Array.prototype.pop),wy=Oy(Array.prototype.push),xy=Oy(String.prototype.toLowerCase),Ey=Oy(String.prototype.toString),ky=Oy(String.prototype.match),_y=Oy(String.prototype.replace),Sy=Oy(String.prototype.indexOf),Ny=Oy(String.prototype.trim),Ry=Oy(RegExp.prototype.test),Ay=(Ty=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),r=1;r/gm),Yy=py(/\${[\w\W]*}/gm),Gy=py(/^data-[\-\w.\u00B7-\uFFFF]/),Xy=py(/^aria-[\-\w]+$/),Zy=py(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Qy=py(/^(?:\w+script|data):/i),Jy=py(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),eC=py(/^html$/i);var tC=Object.freeze({__proto__:null,MUSTACHE_EXPR:Wy,ERB_EXPR:Ky,TMPLIT_EXPR:Yy,DATA_ATTR:Gy,ARIA_ATTR:Xy,IS_ALLOWED_URI:Zy,IS_SCRIPT_OR_DATA:Qy,ATTR_WHITESPACE:Jy,DOCTYPE_NAME:eC});const nC=()=>"undefined"==typeof window?null:window;var oC=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nC();const n=t=>e(t);if(n.version="3.0.5",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;const o=t.document,r=o.currentScript;let{document:s}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:d,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:f,trustedTypes:g}=t,p=d.prototype,h=Dy(p,"cloneNode"),b=Dy(p,"nextSibling"),v=Dy(p,"childNodes"),y=Dy(p,"parentNode");if("function"==typeof i){const e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let C,w="";const{implementation:x,createNodeIterator:E,createDocumentFragment:k,getElementsByTagName:_}=s,{importNode:S}=o;let N={};n.isSupported="function"==typeof dy&&"function"==typeof y&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:R,ERB_EXPR:A,TMPLIT_EXPR:T,DATA_ATTR:O,ARIA_ATTR:B,IS_SCRIPT_OR_DATA:P,ATTR_WHITESPACE:D}=tC;let{IS_ALLOWED_URI:L}=tC,M=null;const I=By({},[...Ly,...My,...Iy,...Uy,...jy]);let F=null;const U=By({},[...Hy,...$y,...Vy,...qy]);let z=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),j=null,H=null,$=!0,V=!0,q=!1,W=!0,K=!1,Y=!1,G=!1,X=!1,Z=!1,Q=!1,J=!1,ee=!0,te=!1,ne=!0,oe=!1,re={},se=null;const ae=By({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=By({},["audio","video","img","source","image","track"]);let de=null;const ce=By({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let ge=fe,pe=!1,he=null;const be=By({},[ue,me,fe],Ey);let ve;const ye=["application/xhtml+xml","text/html"];let Ce,we=null;const xe=s.createElement("form"),Ee=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){if(!we||we!==e){if(e&&"object"==typeof e||(e={}),e=Py(e),ve=ve=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ce="application/xhtml+xml"===ve?Ey:xy,M="ALLOWED_TAGS"in e?By({},e.ALLOWED_TAGS,Ce):I,F="ALLOWED_ATTR"in e?By({},e.ALLOWED_ATTR,Ce):U,he="ALLOWED_NAMESPACES"in e?By({},e.ALLOWED_NAMESPACES,Ey):be,de="ADD_URI_SAFE_ATTR"in e?By(Py(ce),e.ADD_URI_SAFE_ATTR,Ce):ce,ie="ADD_DATA_URI_TAGS"in e?By(Py(le),e.ADD_DATA_URI_TAGS,Ce):le,se="FORBID_CONTENTS"in e?By({},e.FORBID_CONTENTS,Ce):ae,j="FORBID_TAGS"in e?By({},e.FORBID_TAGS,Ce):{},H="FORBID_ATTR"in e?By({},e.FORBID_ATTR,Ce):{},re="USE_PROFILES"in e&&e.USE_PROFILES,$=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,W=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,K=e.SAFE_FOR_TEMPLATES||!1,Y=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,J=e.RETURN_TRUSTED_TYPE||!1,X=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,ne=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||Zy,ge=e.NAMESPACE||fe,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ee(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ee(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(V=!1),Q&&(Z=!0),re&&(M=By({},[...jy]),F=[],!0===re.html&&(By(M,Ly),By(F,Hy)),!0===re.svg&&(By(M,My),By(F,$y),By(F,qy)),!0===re.svgFilters&&(By(M,Iy),By(F,$y),By(F,qy)),!0===re.mathMl&&(By(M,Uy),By(F,Vy),By(F,qy))),e.ADD_TAGS&&(M===I&&(M=Py(M)),By(M,e.ADD_TAGS,Ce)),e.ADD_ATTR&&(F===U&&(F=Py(F)),By(F,e.ADD_ATTR,Ce)),e.ADD_URI_SAFE_ATTR&&By(de,e.ADD_URI_SAFE_ATTR,Ce),e.FORBID_CONTENTS&&(se===ae&&(se=Py(se)),By(se,e.FORBID_CONTENTS,Ce)),ne&&(M["#text"]=!0),Y&&By(M,["html","head","body"]),M.table&&(By(M,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Ay('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Ay('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=e.TRUSTED_TYPES_POLICY,w=C.createHTML("")}else void 0===C&&(C=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(g,r)),null!==C&&"string"==typeof w&&(w=C.createHTML(""));gy&&gy(e),we=e}},_e=By({},["mi","mo","mn","ms","mtext"]),Se=By({},["foreignobject","desc","title","annotation-xml"]),Ne=By({},["title","style","font","a","script"]),Re=By({},My);By(Re,Iy),By(Re,Fy);const Ae=By({},Uy);By(Ae,zy);const Te=function(e){wy(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Oe=function(e,t){try{wy(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){wy(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!F[e])if(Z||Q)try{Te(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Be=function(e){let t,n;if(X)e=""+e;else{const t=ky(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ve&&ge===fe&&(e=''+e+"");const o=C?C.createHTML(e):e;if(ge===fe)try{t=(new f).parseFromString(o,ve)}catch(e){}if(!t||!t.documentElement){t=x.createDocument(ge,"template",null);try{t.documentElement.innerHTML=pe?w:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(s.createTextNode(n),r.childNodes[0]||null),ge===fe?_.call(t,Y?"html":"body")[0]:Y?t.documentElement:r},Pe=function(e){return E.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},De=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Le=function(e,t,o){N[e]&&yy(N[e],(e=>{e.call(n,t,o,we)}))},Me=function(e){let t;if(Le("beforeSanitizeElements",e,null),(o=e)instanceof m&&("string"!=typeof o.nodeName||"string"!=typeof o.textContent||"function"!=typeof o.removeChild||!(o.attributes instanceof u)||"function"!=typeof o.removeAttribute||"function"!=typeof o.setAttribute||"string"!=typeof o.namespaceURI||"function"!=typeof o.insertBefore||"function"!=typeof o.hasChildNodes))return Te(e),!0;var o;const r=Ce(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:r,allowedTags:M}),e.hasChildNodes()&&!De(e.firstElementChild)&&(!De(e.content)||!De(e.content.firstElementChild))&&Ry(/<[/\w]/g,e.innerHTML)&&Ry(/<[/\w]/g,e.textContent))return Te(e),!0;if(!M[r]||j[r]){if(!j[r]&&Fe(r)){if(z.tagNameCheck instanceof RegExp&&Ry(z.tagNameCheck,r))return!1;if(z.tagNameCheck instanceof Function&&z.tagNameCheck(r))return!1}if(ne&&!se[r]){const t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t)for(let o=n.length-1;o>=0;--o)t.insertBefore(h(n[o],!0),b(e))}return Te(e),!0}return e instanceof d&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:ge,tagName:"template"});const n=xy(e.tagName),o=xy(t.tagName);return!!he[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===fe?"svg"===n:t.namespaceURI===ue?"svg"===n&&("annotation-xml"===o||_e[o]):Boolean(Re[n]):e.namespaceURI===ue?t.namespaceURI===fe?"math"===n:t.namespaceURI===me?"math"===n&&Se[o]:Boolean(Ae[n]):e.namespaceURI===fe?!(t.namespaceURI===me&&!Se[o])&&!(t.namespaceURI===ue&&!_e[o])&&!Ae[n]&&(Ne[n]||!Re[n]):!("application/xhtml+xml"!==ve||!he[e.namespaceURI]))}(e)?(Te(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Ry(/<\/no(script|embed|frames)/i,e.innerHTML)?(K&&3===e.nodeType&&(t=e.textContent,t=_y(t,R," "),t=_y(t,A," "),t=_y(t,T," "),e.textContent!==t&&(wy(n.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Te(e),!0)},Ie=function(e,t,n){if(ee&&("id"===t||"name"===t)&&(n in s||n in xe))return!1;if(V&&!H[t]&&Ry(O,t));else if($&&Ry(B,t));else if(!F[t]||H[t]){if(!(Fe(e)&&(z.tagNameCheck instanceof RegExp&&Ry(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&Ry(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Ry(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n))))return!1}else if(de[t]);else if(Ry(L,_y(n,D,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Sy(n,"data:")||!ie[e])if(q&&!Ry(P,_y(n,D,"")));else if(n)return!1;return!0},Fe=function(e){return e.indexOf("-")>0},Ue=function(e){let t,n,o,r;Le("beforeSanitizeAttributes",e,null);const{attributes:s}=e;if(!s)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F};for(r=s.length;r--;){t=s[r];const{name:i,namespaceURI:l}=t;n="value"===i?t.value:Ny(t.value);const d=n;if(o=Ce(i),a.attrName=o,a.attrValue=n,a.keepAttr=!0,a.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,a),n=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){Oe(i,e);continue}if(!W&&Ry(/\/>/i,n)){Oe(i,e);continue}K&&(n=_y(n,R," "),n=_y(n,A," "),n=_y(n,T," "));const c=Ce(e.nodeName);if(Ie(c,o,n)){if(!te||"id"!==o&&"name"!==o||(Oe(i,e),n="user-content-"+n),C&&"object"==typeof g&&"function"==typeof g.getAttributeType)if(l);else switch(g.getAttributeType(c,o)){case"TrustedHTML":n=C.createHTML(n);break;case"TrustedScriptURL":n=C.createScriptURL(n)}if(n!==d)try{l?e.setAttributeNS(l,i,n):e.setAttribute(i,n)}catch(t){Oe(i,e)}}else Oe(i,e)}Le("afterSanitizeAttributes",e,null)},ze=function e(t){let n;const o=Pe(t);for(Le("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)Le("uponSanitizeShadowNode",n,null),Me(n)||(n.content instanceof a&&e(n.content),Ue(n));Le("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t,r,s,i,d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(pe=!e,pe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!De(e)){if("function"!=typeof e.toString)throw Ay("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ay("dirty is not a string, aborting")}if(!n.isSupported)return e;if(G||ke(d),n.removed=[],"string"==typeof e&&(oe=!1),oe){if(e.nodeName){const t=Ce(e.nodeName);if(!M[t]||j[t])throw Ay("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Be("\x3c!----\x3e"),r=t.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?t=r:t.appendChild(r);else{if(!Z&&!K&&!Y&&-1===e.indexOf("<"))return C&&J?C.createHTML(e):e;if(t=Be(e),!t)return Z?null:J?w:""}t&&X&&Te(t.firstChild);const c=Pe(oe?e:t);for(;s=c.nextNode();)Me(s)||(s.content instanceof a&&ze(s.content),Ue(s));if(oe)return e;if(Z){if(Q)for(i=k.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(F.shadowroot||F.shadowrootmode)&&(i=S.call(o,i,!0)),i}let u=Y?t.outerHTML:t.innerHTML;return Y&&M["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&Ry(eC,t.ownerDocument.doctype.name)&&(u="\n"+u),K&&(u=_y(u,R," "),u=_y(u,A," "),u=_y(u,T," ")),C&&J?C.createHTML(u):u},n.setConfig=function(e){ke(e),G=!0},n.clearConfig=function(){we=null,G=!1},n.isValidAttribute=function(e,t,n){we||ke({});const o=Ce(e),r=Ce(t);return Ie(o,r,n)},n.addHook=function(e,t){"function"==typeof t&&(N[e]=N[e]||[],wy(N[e],t))},n.removeHook=function(e){if(N[e])return Cy(N[e])},n.removeHooks=function(e){N[e]&&(N[e]=[])},n.removeAllHooks=function(){N={}},n}();const rC=Dt.each,sC=Dt.trim,aC=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],iC={ftp:21,http:80,https:443,mailto:25},lC=["img","video"],dC=(e,t,n)=>{const o=(e=>{try{return decodeURIComponent(e)}catch(t){return unescape(e)}})(t).replace(/\s/g,"");return!e.allow_script_urls&&(!!/((java|vb)script|mhtml):/i.test(o)||!e.allow_html_data_urls&&(/^data:image\//i.test(o)?((e,t)=>C(e)?!e:!C(t)||!H(lC,t))(e.allow_svg_data_urls,n)&&/^data:image\/svg\+xml/i.test(o):/^data:/i.test(o)))};class cC{static parseDataUri(e){let t;const n=decodeURIComponent(e).split(","),o=/data:([^;]+)/.exec(n[0]);return o&&(t=o[1]),{type:t,data:n[1]}}static isDomSafe(e,t,n={}){if(n.allow_script_urls)return!0;{const o=ws.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!dC(n,o,t)}}static getDocumentBaseUrl(e){var t;let n;return n=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?null!==(t=e.href)&&void 0!==t?t:"":e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/")),n}constructor(e,t={}){this.path="",this.directory="",e=sC(e),this.settings=t;const n=t.base_uri,o=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(o.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(n&&n.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=n?n.path:new cC(document.location.href).directory;if(""===(null==n?void 0:n.protocol))e="//mce_host"+o.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);r&&(e=(n&&n.protocol||"http")+"://mce_host"+o.toAbsPath(t,r[1])+r[2])}}e=e.replace(/@@/g,"(mce_at)");const s=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);s&&rC(aC,((e,t)=>{let n=s[t];n&&(n=n.replace(/\(mce_at\)/g,"@@")),o[e]=n})),n&&(o.protocol||(o.protocol=n.protocol),o.userInfo||(o.userInfo=n.userInfo),o.port||"mce_host"!==o.host||(o.port=n.port),o.host&&"mce_host"!==o.host||(o.host=n.host),o.source=""),r&&(o.protocol="")}setPath(e){const t=/^(.*?)\/?(\w+)?$/.exec(e);t&&(this.path=t[0],this.directory=t[1],this.file=t[2]),this.source="",this.getURI()}toRelative(e){if("./"===e)return e;const t=new cC(e,{base_uri:this});if("mce_host"!==t.host&&this.host!==t.host&&t.host||this.port!==t.port||this.protocol!==t.protocol&&""!==t.protocol)return t.getURI();const n=this.getURI(),o=t.getURI();if(n===o||"/"===n.charAt(n.length-1)&&n.substr(0,n.length-1)===o)return n;let r=this.toRelPath(this.path,t.path);return t.query&&(r+="?"+t.query),t.anchor&&(r+="#"+t.anchor),r}toAbsolute(e,t){const n=new cC(e,{base_uri:this});return n.getURI(t&&this.isSameOrigin(n))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=this.protocol?iC[this.protocol]:null;if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let n,o,r=0,s="";const a=e.substring(0,e.lastIndexOf("/")).split("/"),i=t.split("/");if(a.length>=i.length)for(n=0,o=a.length;n=i.length||a[n]!==i[n]){r=n+1;break}if(a.length=a.length||a[n]!==i[n]){r=n+1;break}if(1===r)return t;for(n=0,o=a.length-(r-1);n{e&&a.push(e)}));const i=[];for(let e=s.length-1;e>=0;e--)0!==s[e].length&&"."!==s[e]&&(".."!==s[e]?n>0?n--:i.push(s[e]):n++);const l=a.length-n;let d;return d=l<=0?oe(i).join("/"):a.slice(0,l).join("/")+"/"+oe(i).join("/"),0!==d.indexOf("/")&&(d="/"+d),o&&d.lastIndexOf("/")!==d.length-1&&(d+=o),d}getURI(e=!1){let t;return this.source&&!e||(t="",e||(this.protocol?t+=this.protocol+"://":t+="//",this.userInfo&&(t+=this.userInfo+"@"),this.host&&(t+=this.host),this.port&&(t+=":"+this.port)),this.path&&(t+=this.path),this.query&&(t+="?"+this.query),this.anchor&&(t+="#"+this.anchor),this.source=t),this.source}}const uC=Dt.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),mC="data-mce-type";let fC=0;const gC=(e,t,n,o,r)=>{var s,a,i,l;const d=t.validate,c=n.getSpecialElements();8===e.nodeType&&!t.allow_conditional_comments&&/^\[if/i.test(null!==(s=e.nodeValue)&&void 0!==s?s:"")&&(e.nodeValue=" "+e.nodeValue);const u=null!==(a=null==r?void 0:r.tagName)&&void 0!==a?a:e.nodeName.toLowerCase();if("html"!==o&&n.isValid(o))return void(C(r)&&(r.allowedTags[u]=!0));if(1!==e.nodeType||"body"===u)return;const f=Cn(e),g=on(f,mC),p=tn(f,"data-mce-bogus");if(!g&&m(p))return void("all"===p?Eo(f):ko(f));const h=n.getElementRule(u);if(!d||h){if(C(r)&&(r.allowedTags[u]=!0),d&&h&&!g){if(q(null!==(i=h.attributesForced)&&void 0!==i?i:[],(e=>{Jt(f,e.name,"{$uid}"===e.value?"mce_"+fC++:e.value)})),q(null!==(l=h.attributesDefault)&&void 0!==l?l:[],(e=>{on(f,e.name)||Jt(f,e.name,"{$uid}"===e.value?"mce_"+fC++:e.value)})),h.attributesRequired&&!$(h.attributesRequired,(e=>on(f,e))))return void ko(f);if(h.removeEmptyAttrs&&(e=>{const t=e.dom.attributes;return null==t||0===t.length})(f))return void ko(f);h.outputName&&h.outputName!==u&&((e,t)=>{const n=((e,t)=>{const n=vn(t),o=sn(e);return en(n,o),n})(e,t);bo(e,n);const o=In(e);wo(n,o),Eo(e)})(f,h.outputName)}}else ke(c,u)?Eo(f):ko(f)},pC=(e,t,n,o,r,s)=>"html"!==n&&!Mr(o)||!(r in uC&&dC(e,s,o))&&(!e.validate||t.isValid(o,r)||$e(r,"data-")||$e(r,"aria-")),hC=(e,t)=>e.hasAttribute(mC)&&("id"===t||"class"===t||"style"===t),bC=(e,t)=>e in t.getBoolAttrs(),vC=(e,t,n,o)=>{const{attributes:r}=e;for(let s=r.length-1;s>=0;s--){const a=r[s],i=a.name,l=a.value;pC(t,n,o,e.tagName.toLowerCase(),i,l)||hC(e,i)?bC(i,n)&&e.setAttribute(i,i):e.removeAttribute(i)}},yC=(e,t,n)=>{const o=oC();return o.addHook("uponSanitizeElement",((o,r)=>{gC(o,e,t,n.track(o),r)})),o.addHook("uponSanitizeAttribute",((o,r)=>{((e,t,n,o,r)=>{const s=e.tagName.toLowerCase(),{attrName:a,attrValue:i}=r;r.keepAttr=pC(t,n,o,s,a,i),r.keepAttr?(r.allowedAttributes[a]=!0,bC(a,n)&&(r.attrValue=a),t.allow_svg_data_urls&&$e(i,"data:image/svg+xml")&&(r.forceKeepAttr=!0)):hC(e,a)&&(r.forceKeepAttr=!0)})(o,e,t,n.current(),r)})),o},CC=e=>{const t=Fr(e);if("svg"===t){const t=["type","href","role","arcrole","title","show","actuate","label","from","to"].map((e=>`xlink:${e}`)),n={IN_PLACE:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},ALLOWED_ATTR:t};oC().sanitize(e,n)}else{if("math"!==t)throw new Error("Not a namespace element");{const t={IN_PLACE:!0,USE_PROFILES:{mathMl:!0}};oC().sanitize(e,t)}}},wC=Dt.makeMap,xC=Dt.extend,EC=(e,t,n,o)=>{const r=e.name,s=r in n&&"title"!==r&&"textarea"!==r,a=t.childNodes;for(let t=0,r=a.length;t{const n=Xv(),o=Xv(),r={validate:!0,root_name:"body",sanitize:!0,...e},s=new DOMParser,a=((e,t)=>{const n=(()=>{const e=Dr(),t=()=>e.get().map(Fr).getOr("html");return{track:n=>(Ir(n)?e.set(n):e.get().exists((e=>!e.contains(n)))&&e.clear(),t()),current:t,reset:()=>{e.clear()}}})();if(e.sanitize){const o=yC(e,t,n),r=(t,r)=>{o.sanitize(t,((e,t)=>{const n={IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[]};return n.PARSER_MEDIA_TYPE=t,e.allow_script_urls?n.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(n.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),n})(e,r)),o.removed=[],n.reset()};return{sanitizeHtmlElement:r,sanitizeNamespaceElement:CC}}return{sanitizeHtmlElement:(o,r)=>{const s=document.createNodeIterator(o,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let a;for(;a=s.nextNode();){const o=n.track(a);gC(a,e,t,o),er(a)&&vC(a,e,t,o)}n.reset()},sanitizeNamespaceElement:k}})(r,t),i=n.addFilter,l=n.getFilters,d=n.removeFilter,c=o.addFilter,u=o.getFilters,f=o.removeFilter,g=(e,n)=>{const o=m(n.attr(mC)),r=1===n.type&&!ke(e,n.name)&&!Jr(t,n)&&!Mr(n.name);return 3===n.type||r&&!o},p={schema:t,addAttributeFilter:c,getAttributeFilters:u,removeAttributeFilter:f,addNodeFilter:i,getNodeFilters:l,removeNodeFilter:d,parse:(e,n={})=>{var o;const i=r.validate,d=null!==(o=n.context)&&void 0!==o?o:r.root_name,c=((e,n,o="html")=>{const r="xhtml"===o?"application/xhtml+xml":"text/html",i=ke(t.getSpecialElements(),n.toLowerCase()),l=i?`<${n}>${e}${n}>`:e,d="xhtml"===o?`${l}`:`${l}`,c=s.parseFromString(d,r).body;return a.sanitizeHtmlElement(c,r),i?c.firstChild:c})(e,d,n.format);Wr(t,c);const m=new ep(d,11);EC(m,c,t.getSpecialElements(),a.sanitizeNamespaceElement),c.innerHTML="";const[f,p]=((e,t,n,o)=>{const r=n.validate,s=t.getNonEmptyElements(),a=t.getWhitespaceElements(),i=xC(wC("script,style,head,html,body,title,meta,param"),t.getBlockElements()),l=Ms(t),d=/[ \t\r\n]+/g,c=/^[ \t\r\n]+/,u=/[ \t\r\n]+$/,m=e=>{let t=e.parent;for(;C(t);){if(t.name in a)return!0;t=t.parent}return!1},f=n=>n.name in i||Jr(t,n)||Mr(n.name)&&n.parent===e,g=(t,n)=>{const r=n?t.prev:t.next;return!C(r)&&!y(t.parent)&&f(t.parent)&&(t.parent!==e||!0===o.isRootContent)};return[e=>{var t;if(3===e.type&&!m(e)){let n=null!==(t=e.value)&&void 0!==t?t:"";n=n.replace(d," "),(((e,t)=>C(e)&&(t(e)||"br"===e.name))(e.prev,f)||g(e,!0))&&(n=n.replace(c,"")),0===n.length?e.remove():e.value=n}},e=>{var i;if(1===e.type){const i=t.getElementRule(e.name);if(r&&i){const r=kb(t,s,a,e);i.paddInEmptyBlock&&r&&(e=>{let n=e;for(;C(n);){if(n.name in l)return kb(t,s,a,n);n=n.parent}return!1})(e)?xb(n,o,f,e):i.removeEmpty&&r?f(e)?e.remove():e.unwrap():i.paddEmpty&&(r||(e=>{var t;return Eb(e,"#text")&&(null===(t=null==e?void 0:e.firstChild)||void 0===t?void 0:t.value)===Wo})(e))&&xb(n,o,f,e)}}else if(3===e.type&&!m(e)){let t=null!==(i=e.value)&&void 0!==i?i:"";(e.next&&f(e.next)||g(e,!1))&&(t=t.replace(u,"")),0===t.length?e.remove():e.value=t}}]})(m,t,r,n),h=[],b=i?e=>((e,n)=>{Rb(t,e)&&n.push(e)})(e,h):k,v={nodes:{},attributes:{}},w=e=>yb(l(),u(),e,v);if(((e,t,n)=>{const o=[];for(let n=e,r=n;n;r=n,n=n.walk()){const s=n;q(t,(e=>e(s))),y(s.parent)&&s!==e?n=r:o.push(s)}for(let e=o.length-1;e>=0;e--){const t=o[e];q(n,(e=>e(t)))}})(m,[f,w],[p,b]),h.reverse(),i&&h.length>0)if(n.context){const{pass:e,fail:o}=K(h,(e=>e.parent===m));Nb(o,t,m,w),n.invalid=e.length>0}else Nb(h,t,m,w);const x=((e,t)=>{var n;const o=null!==(n=t.forced_root_block)&&void 0!==n?n:e.forced_root_block;return!1===o?"":!0===o?"p":o})(r,n);return x&&("body"===m.name||n.isRootContent)&&((e,n)=>{const o=xC(wC("script,style,head,html,body,title,meta,param"),t.getBlockElements()),s=/^[ \t\r\n]+/,a=/[ \t\r\n]+$/;let i=e.firstChild,l=null;const d=e=>{var t,n;e&&(i=e.firstChild,i&&3===i.type&&(i.value=null===(t=i.value)||void 0===t?void 0:t.replace(s,"")),i=e.lastChild,i&&3===i.type&&(i.value=null===(n=i.value)||void 0===n?void 0:n.replace(a,"")))};if(t.isValidChild(e.name,n.toLowerCase())){for(;i;){const t=i.next;g(o,i)?(l||(l=new ep(n,1),l.attr(r.forced_root_block_attrs),e.insert(l,i)),l.append(i)):(d(l),l=null),i=t}d(l)}})(m,x),n.invalid||Cb(v,n),m}};return((e,t)=>{var n,o;const r=e.schema;e.addAttributeFilter("href",(e=>{let n=e.length;const o=e=>{const t=e?Dt.trim(e):"";return/\b(noopener)\b/g.test(t)?t:(e=>e.split(" ").filter((e=>e.length>0)).concat(["noopener"]).sort().join(" "))(t)};if(!t.allow_unsafe_link_target)for(;n--;){const t=e[n];"a"===t.name&&"_blank"===t.attr("target")&&t.attr("rel",o(t.attr("rel")))}})),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",(e=>{let t,n,o,r,s=e.length;for(;s--;)if(r=e[s],"a"===r.name&&r.firstChild&&!r.attr("href"))for(o=r.parent,t=r.lastChild;t&&o;)n=t.prev,o.insert(t,r),t=n})),t.fix_list_elements&&e.addNodeFilter("ul,ol",(e=>{let t,n,o=e.length;for(;o--;)if(t=e[o],n=t.parent,n&&("ul"===n.name||"ol"===n.name))if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{const e=new ep("li",1);e.attr("style","list-style-type: none"),t.wrap(e)}}));const s=r.getValidClasses();t.validate&&s&&e.addAttributeFilter("class",(e=>{var t;let n=e.length;for(;n--;){const o=e[n],r=null!==(t=o.attr("class"))&&void 0!==t?t:"",a=Dt.explode(r," ");let i="";for(let e=0;e{const{blob_cache:n}=t;if(n){const t=e=>{const t=e.attr("src");(e=>e.attr("src")===Tt.transparentSrc||C(e.attr("data-mce-placeholder")))(e)||(e=>C(e.attr("data-mce-bogus")))(e)||y(t)||ry(n,t,!0).each((t=>{e.attr("src",t.blobUri())}))};e.addAttributeFilter("src",(e=>q(e,t)))}})(e,t);const a=null!==(n=t.sandbox_iframes)&&void 0!==n&&n,i=me(null!==(o=t.sandbox_iframes_exclusions)&&void 0!==o?o:[]);t.convert_unsafe_embeds&&e.addNodeFilter("object,embed",(e=>q(e,(e=>{e.replace((({type:e,src:t,width:n,height:o}={},r,s)=>{const a=(e=>v(e)?"iframe":ly(e,"image")?"img":ly(e,"video")?"video":ly(e,"audio")?"audio":"iframe")(e),i=new ep(a,1);return i.attr("audio"===a?{src:t}:{src:t,width:n,height:o}),"audio"!==a&&"video"!==a||i.attr("controls",""),"iframe"===a&&r&&iy(i,s),i})({type:e.attr("type"),src:"object"===e.name?e.attr("data"):e.attr("src"),width:e.attr("width"),height:e.attr("height")},a,i))})))),a&&e.addNodeFilter("iframe",(e=>q(e,(e=>iy(e,i)))))})(p,r),((e,t,n)=>{t.inline_styles&&Zv(e,t,n)})(p,r,t),p},_C=(e,t,n)=>{const o=(e=>Fb(e)?yp({validate:!1}).serialize(e):e)(e),r=t(o);if(r.isDefaultPrevented())return r;if(Fb(e)){if(r.content!==o){const t=kC({validate:!1,forced_root_block:!1,...n}).parse(r.content,{context:e.name});return{...r,content:t}}return{...r,content:e}}return r},SC=e=>({sanitize:xc(e),sandbox_iframes:Rc(e),sandbox_iframes_exclusions:Ac(e)}),NC=(e,t)=>{if(t.no_events)return El.value(t);{const n=((e,t)=>e.dispatch("BeforeGetContent",t))(e,t);return n.isDefaultPrevented()?El.error(bf(e,{content:"",...n}).content):El.value(n)}},RC=(e,t,n)=>{if(n.no_events)return t;{const o=_C(t,(t=>bf(e,{...n,content:t})),SC(e));return o.content}},AC=(e,t)=>{if(t.no_events)return El.value(t);{const n=_C(t.content,(n=>((e,t)=>e.dispatch("BeforeSetContent",t))(e,{...t,content:n})),SC(e));return n.isDefaultPrevented()?(hf(e,n),El.error(void 0)):El.value(n)}},TC=(e,t,n)=>{n.no_events||hf(e,{...n,content:t})},OC=(e,t,n)=>({element:e,width:t,rows:n}),BC=(e,t)=>({element:e,cells:t}),PC=(e,t)=>({x:e,y:t}),DC=(e,t)=>nn(e,t).bind(Ze).getOr(1),LC=(e,t,n)=>{const o=e.rows;return!!(o[n]?o[n].cells:[])[t]},MC=e=>X(e,((e,t)=>t.cells.length>e?t.cells.length:e),0),IC=(e,t)=>{const n=e.rows;for(let e=0;e{const s=[],a=e.rows;for(let e=n;e<=r;e++){const n=a[e].cells,r=t((e,t)=>{const n=Ia(e.element),o=vn("tbody");return wo(o,t),yo(n,o),n})(e,(e=>V(e.rows,(e=>{const t=V(e.cells,(e=>{const t=Fa(e);return rn(t,"colspan"),rn(t,"rowspan"),t})),n=Ia(e.element);return wo(n,t),n})))(e)),zC=(e,t,n)=>{const o=Cn(t.commonAncestorContainer),r=zp(o,e),s=Y(r,(e=>n.isWrapper($t(e)))),a=((e,t)=>Q(e,(e=>"li"===$t(e)&&hm(e,t))).fold(N([]),(t=>(e=>Q(e,(e=>"ul"===$t(e)||"ol"===$t(e))))(e).map((e=>{const t=vn($t(e)),n=Ce(go(e),((e,t)=>$e(t,"list-style")));return co(t,n),[vn("li"),t]})).getOr([]))))(r,t),i=s.concat(a.length?a:(e=>Ka(e)?Tn(e).filter(Wa).fold(N([]),(t=>[e,t])):Wa(e)?[e]:[])(o));return V(i,Ia)},jC=()=>Uf([]),HC=(e,t)=>((e,t)=>to(t,"table",T(_n,e)))(e,t[0]).bind((e=>{const n=t[0],o=t[t.length-1],r=(e=>{const t=OC(Ia(e),0,[]);return q(zo(e,"tr"),((e,n)=>{q(zo(e,"td,th"),((o,r)=>{((e,t,n,o,r)=>{const s=DC(r,"rowspan"),a=DC(r,"colspan"),i=e.rows;for(let e=n;e{for(;LC(e,t,n);)t++;return t})(t,r,n),n,e,o)}))})),OC(t.element,MC(t.rows),t.rows)})(e);return((e,t,n)=>IC(e,t).bind((t=>IC(e,n).map((n=>((e,t,n)=>{const o=t.x,r=t.y,s=n.x,a=n.y,i=rUf([UC(e)])))})).getOrThunk(jC),$C=(e,t,n)=>{const o=um(t,e);return o.length>0?HC(e,o):((e,t,n)=>t.length>0&&t[0].collapsed?jC():((e,t,n)=>((e,t)=>{const n=X(t,((e,t)=>(yo(t,e),t)),e);return t.length>0?Uf([n]):n})(Cn(t.cloneContents()),zC(e,t,n)))(e,t[0],n))(e,t,n)},VC=(e,t)=>t>=0&&tti(e.innerText),WC=e=>er(e)?e.outerHTML:dr(e)?ws.encodeRaw(e.data,!1):mr(e)?"\x3c!--"+e.data+"--\x3e":"",KC=(e,t)=>(((e,t)=>{let n=0;q(e,(e=>{0===e[0]?n++:1===e[0]?(((e,t,n)=>{const o=(e=>{let t;const n=document.createElement("div"),o=document.createDocumentFragment();for(e&&(n.innerHTML=e);t=n.firstChild;)o.appendChild(t);return o})(t);if(e.hasChildNodes()&&n{if(e.hasChildNodes()&&t{const n=e.length+t.length+2,o=new Array(n),r=new Array(n),s=(n,o,r,a,l)=>{const d=i(n,o,r,a);if(null===d||d.start===o&&d.diag===o-a||d.end===n&&d.diag===n-r){let s=n,i=r;for(;sa-r?(l.push([2,e[s]]),++s):(l.push([1,t[i]]),++i)}else{s(n,d.start,r,d.start-d.diag,l);for(let t=d.start;t{let a=n;for(;a-o({start:e,end:t,diag:n}))(n,a,o)},i=(n,s,i,l)=>{const d=s-n,c=l-i;if(0===d||0===c)return null;const u=d-c,m=c+d,f=(m%2==0?m:m+1)/2;let g,p,h,b,v;for(o[1+f]=n,r[1+f]=s+1,g=0;g<=f;++g){for(p=-g;p<=g;p+=2){for(h=p+f,p===-g||p!==g&&o[h-1]=n&&v>=i&&e[b]===t[v];)r[h]=b--,v--;if(u%2==0&&-g<=p&&p<=g&&r[h]<=o[h+u])return a(r[h],p+n-i,s,l)}}return null},l=[];return s(0,e.length,0,t.length,l),l})(V(ce(t.childNodes),WC),e),t),t),YC=Le((()=>document.implementation.createHTMLDocument("undo"))),GC=e=>{const t=e.serializer.getTempAttrs(),n=fp(e.getBody(),t);return(e=>null!==e.querySelector("iframe"))(n)?{type:"fragmented",fragments:Y(V(ce(n.childNodes),_(ti,WC)),(e=>e.length>0)),content:"",bookmark:null,beforeBookmark:null}:{type:"complete",fragments:null,content:ti(n.innerHTML),bookmark:null,beforeBookmark:null}},XC=(e,t,n)=>{const o=n?t.beforeBookmark:t.bookmark;"fragmented"===t.type?KC(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:!C(o)||!Gu(o)||!o.isFakeCaret}),o&&(e.selection.moveToBookmark(o),e.selection.scrollIntoView())},ZC=e=>"fragmented"===e.type?e.fragments.join(""):e.content,QC=e=>{const t=vn("body",YC());return No(t,ZC(e)),q(zo(t,"*[data-mce-bogus]"),ko),So(t)},JC=(e,t)=>!(!e||!t)&&(!!((e,t)=>ZC(e)===ZC(t))(e,t)||((e,t)=>QC(e)===QC(t))(e,t)),ew=e=>0===e.get(),tw=(e,t,n)=>{ew(n)&&(e.typing=t)},nw=(e,t)=>{e.typing&&(tw(e,!1,t),e.add())},ow=e=>({init:{bindEvents:k},undoManager:{beforeChange:(t,n)=>((e,t,n)=>{ew(t)&&n.set(Cl(e.selection))})(e,t,n),add:(t,n,o,r,s,a)=>((e,t,n,o,r,s,a)=>{const i=GC(e),l=Dt.extend(s||{},i);if(!ew(o)||e.removed)return null;const d=t.data[n.get()];if(e.dispatch("BeforeAddUndo",{level:l,lastLevel:d,originalEvent:a}).isDefaultPrevented())return null;if(d&&JC(d,l))return null;t.data[n.get()]&&r.get().each((e=>{t.data[n.get()].beforeBookmark=e}));const c=Ud(e);if(c&&t.data.length>c){for(let e=0;e0?(e.setDirty(!0),e.dispatch("AddUndo",u),e.dispatch("change",u)):e.dispatch("AddUndo",u),l})(e,t,n,o,r,s,a),undo:(t,n,o)=>((e,t,n,o)=>{let r;return t.typing&&(t.add(),t.typing=!1,tw(t,!1,n)),o.get()>0&&(o.set(o.get()-1),r=t.data[o.get()],XC(e,r,!0),e.setDirty(!0),e.dispatch("Undo",{level:r})),r})(e,t,n,o),redo:(t,n)=>((e,t,n)=>{let o;return t.get()((e,t,n)=>{t.data=[],n.set(0),t.typing=!1,e.dispatch("ClearUndos")})(e,t,n),reset:e=>(e=>{e.clear(),e.add()})(e),hasUndo:(t,n)=>((e,t,n)=>n.get()>0||t.typing&&t.data[0]&&!JC(GC(e),t.data[0]))(e,t,n),hasRedo:(e,t)=>((e,t)=>t.get()((e,t,n)=>(nw(e,t),e.beforeChange(),e.ignore(n),e.add()))(e,t,n),ignore:(e,t)=>((e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}})(e,t),extra:(t,n,o,r)=>((e,t,n,o,r)=>{if(t.transact(o)){const o=t.data[n.get()].bookmark,s=t.data[n.get()-1];XC(e,s,!0),t.transact(r)&&(t.data[n.get()-1].beforeBookmark=o)}})(e,t,n,o,r)},formatter:{match:(t,n,o,r)=>Yb(e,t,n,o,r),matchAll:(t,n)=>((e,t,n)=>{const o=[],r={},s=e.selection.getStart();return e.dom.getParent(s,(s=>{for(let a=0;aKb(e,t,n,o,r),canApply:t=>((e,t)=>{const n=e.formatter.get(t),o=e.dom;if(n&&e.selection.isEditable()){const t=e.selection.getStart(),r=Lm(o,t);for(let e=n.length-1;e>=0;e--){const t=n[e];if(!Fm(t))return!0;for(let e=r.length-1;e>=0;e--)if(o.is(r[e],t.selector))return!0}}return!1})(e,t),closest:t=>((e,t)=>{const n=t=>_n(t,Cn(e.getBody()));return I.from(e.selection.getStart(!0)).bind((o=>jb(Cn(o),(n=>ue(t,(t=>((t,n)=>Kb(e,t.dom,n)?I.some(n):I.none())(n,t)))),n))).getOrNull()})(e,t),apply:(t,n,o)=>$v(e,t,n,o),remove:(t,n,o,r)=>Iv(e,t,n,o,r),toggle:(t,n,o)=>((e,t,n,o)=>{const r=e.formatter.get(t);r&&(!Yb(e,t,n,o)||"toggle"in r[0]&&!r[0].toggle?$v(e,t,n,o):Iv(e,t,n,o))})(e,t,n,o),formatChanged:(t,n,o,r,s)=>((e,t,n,o,r,s)=>(((e,t,n,o,r,s)=>{const a=t.get();q(n.split(","),(t=>{const n=Ee(a,t).getOrThunk((()=>{const e={withSimilar:{state:Br(!1),similar:!0,callbacks:[]},withoutSimilar:{state:Br(!1),similar:!1,callbacks:[]},withVars:[]};return a[t]=e,e})),i=()=>{const n=Kv(e);return Wv(e,n,t,r,s).isSome()};if(v(s)){const e=r?n.withSimilar:n.withoutSimilar;e.callbacks.push(o),1===e.callbacks.length&&e.state.set(i())}else n.withVars.push({state:Br(i()),similar:r,vars:s,callback:o})})),t.set(a)})(e,t,n,o,r,s),{unbind:()=>((e,t,n)=>{const o=e.get();q(t.split(","),(e=>Ee(o,e).each((t=>{o[e]={withSimilar:{...t.withSimilar,callbacks:Y(t.withSimilar.callbacks,(e=>e!==n))},withoutSimilar:{...t.withoutSimilar,callbacks:Y(t.withoutSimilar.callbacks,(e=>e!==n))},withVars:Y(t.withVars,(e=>e.callback!==n))}})))),e.set(o)})(t,n,o)}))(e,t,n,o,r,s)},editor:{getContent:t=>((e,t)=>I.from(e.getBody()).fold(N("tree"===t.format?new ep("body",11):""),(n=>hp(e,t,n))))(e,t),setContent:(t,n)=>((e,t,n)=>I.from(e.getBody()).map((o=>Fb(t)?((e,t,n,o)=>{wb(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),n);const r=yp({validate:!1},e.schema).serialize(n),s=ti(Xa(Cn(t))?r:Dt.trim(r));return Ub(e,s,o.no_selection),{content:n,html:s}})(e,o,t,n):((e,t,n,o)=>{if(0===(n=ti(n)).length||/^\s+$/.test(n)){const r='
';"TABLE"===t.nodeName?n=""+r+" |
":/^(UL|OL)$/.test(t.nodeName)&&(n=""+r+"");const s=Wl(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),s.toLowerCase())?(n=r,n=e.dom.createHTML(s,Kl(e),n)):n||(n=r),Ub(e,n,o.no_selection),{content:n,html:n}}{"raw"!==o.format&&(n=yp({validate:!1},e.schema).serialize(e.parser.parse(n,{isRootContent:!0,insert:!0})));const r=Xa(Cn(t))?n:Dt.trim(n);return Ub(e,r,o.no_selection),{content:r,html:r}}})(e,o,t,n))).getOr({content:t,html:Fb(n.content)?"":n.content}))(e,t,n),insertContent:(t,n)=>Ib(e,t,n),addVisual:t=>((e,t)=>{const n=e.dom,o=C(t)?t:e.getBody();q(n.select("table,a",o),(t=>{switch(t.nodeName){case"TABLE":const o=Yd(e),r=n.getAttrib(t,"border");r&&"0"!==r||!e.hasVisual?n.removeClass(t,o):n.addClass(t,o);break;case"A":if(!n.getAttrib(t,"href")){const o=n.getAttrib(t,"name")||t.id,r=Gd(e);o&&e.hasVisual?n.addClass(t,r):n.removeClass(t,r)}}})),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})})(e,t)},selection:{getContent:(t,n)=>((e,t,n={})=>{const o=((e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}))(n,t);return NC(e,o).fold(R,(t=>{const n=((e,t)=>{if("text"===t.format)return(e=>I.from(e.selection.getRng()).map((t=>{var n;const o=I.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),r=e.getBody(),s=(e=>e.map((e=>e.nodeName)).getOr("div").toLowerCase())(o),a=Cn(t.cloneContents());gp(a),pp(a);const i=e.dom.add(r,s,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},a.dom),l=qC(i),d=ti(null!==(n=i.textContent)&&void 0!==n?n:"");if(e.dom.remove(i),VC(d,0)||VC(d,d.length-1)){const e=o.getOr(r),t=qC(e),n=t.indexOf(l);return-1===n?l:(VC(t,n-1)?" ":"")+l+(VC(t,n+l.length)?" ":"")}return l})).getOr(""))(e);{const n=((e,t)=>{const n=e.selection.getRng(),o=e.dom.create("body"),r=e.selection.getSel(),s=Gg(e,cm(r)),a=t.contextual?$C(Cn(e.getBody()),s,e.schema).dom:n.cloneContents();return a&&o.appendChild(a),e.selection.serializer.serialize(o,t)})(e,t);return"tree"===t.format?n:e.selection.isCollapsed()?"":n}})(e,t);return RC(e,n,t)}))})(e,t,n)},autocompleter:{addDecoration:k,removeDecoration:k},raw:{getModel:()=>I.none()}}),rw=e=>ke(e.plugins,"rtc"),sw=e=>e.rtcInstance?e.rtcInstance:ow(e),aw=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},iw=e=>aw(e).init.bindEvents(),lw=e=>0===e.dom.length?(Eo(e),I.none()):I.some(e),dw=(e,t,n,o,r)=>{e.bind((e=>((o?vh:bh)(e.dom,o?e.dom.length:0,r),t.filter(Yt).map((t=>((e,t,n,o,r)=>{const s=e.dom,a=t.dom,i=o?s.length:a.length;o?(yh(s,a,r,!1,!o),n.setStart(a,i)):(yh(a,s,r,!1,!o),n.setEnd(a,i))})(e,t,n,o,r)))))).orThunk((()=>{const e=((e,t)=>e.filter((e=>uf.isBookmarkNode(e.dom))).bind(t?Dn:Pn))(t,o).or(t).filter(Yt);return e.map((e=>((e,t,n)=>{Tn(e).each((o=>{const r=e.dom;t&&lh(o,Ji(r,0),n)?bh(r,0,n):!t&&dh(o,Ji(r,r.length),n)&&vh(r,r.length,n)}))})(e,o,r)))}))},cw=(e,t,n)=>{if(ke(e,t)){const o=Y(e[t],(e=>e!==n));0===o.length?delete e[t]:e[t]=o}};const uw=e=>!(!e||!e.ownerDocument)&&Sn(Cn(e.ownerDocument),Cn(e)),mw=(e,t,n,o)=>{let r,s;const{selectorChangedWithUnbind:a}=((e,t)=>{let n,o;const r=(t,n)=>Q(n,(n=>e.is(n,t))),s=t=>e.getParents(t,void 0,e.getRoot());return{selectorChangedWithUnbind:(e,a)=>(n||(n={},o={},t.on("NodeChange",(e=>{const t=e.element,a=s(t),i={};pe(n,((e,t)=>{r(t,a).each((n=>{o[t]||(q(e,(e=>{e(!0,{node:n,selector:t,parents:a})})),o[t]=e),i[t]=e}))})),pe(o,((e,n)=>{i[n]||(delete o[n],q(e,(e=>{e(!1,{node:t,selector:n,parents:a})})))}))}))),n[e]||(n[e]=[]),n[e].push(a),r(e,s(t.selection.getStart())).each((()=>{o[e]=n[e]})),{unbind:()=>{cw(n,e,a),cw(o,e,a)}})}})(e,o),i=(e,t)=>((e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}))(n,t);AC(e,o).each((t=>{const n=((e,t)=>{if("raw"!==t.format){const n=e.selection.getRng(),o=e.dom.getParent(n.commonAncestorContainer,e.dom.isBlock),r=o?{context:o.nodeName.toLowerCase()}:{},s=e.parser.parse(t.content,{forced_root_block:!1,...r,...t});return yp({validate:!1},e.schema).serialize(s)}return t.content})(e,t),o=e.selection.getRng();((e,t,n)=>{const o=I.from(t.firstChild).map(Cn),r=I.from(t.lastChild).map(Cn);e.deleteContents(),e.insertNode(t);const s=o.bind(Pn).filter(Yt).bind(lw),a=r.bind(Dn).filter(Yt).bind(lw);dw(s,o,e,!0,n),dw(a,r,e,!1,n),e.collapse(!1)})(o,o.createContextualFragment(n),e.schema),e.selection.setRng(o),vg(e,o),TC(e,n,t)}))})(o,e,t),l=e=>{const t=c();t.collapse(!!e),u(t)},d=()=>t.getSelection?t.getSelection():t.document.selection,c=()=>{let n;const a=(e,t,n)=>{try{return t.compareBoundaryPoints(e,n)}catch(e){return-1}},i=t.document;if(C(o.bookmark)&&!jg(o)){const e=Ag(o);if(e.isSome())return e.map((e=>Gg(o,[e])[0])).getOr(i.createRange())}try{const e=d();e&&!Jo(e.anchorNode)&&(n=e.rangeCount>0?e.getRangeAt(0):i.createRange(),n=Gg(o,[n])[0])}catch(e){}if(n||(n=i.createRange()),fr(n.startContainer)&&n.collapsed){const t=e.getRoot();n.setStart(t,0),n.setEnd(t,0)}return r&&s&&(0===a(n.START_TO_START,n,r)&&0===a(n.END_TO_END,n,r)?n=s:(r=null,s=null)),n},u=(e,t)=>{if(!(e=>!!e&&uw(e.startContainer)&&uw(e.endContainer))(e))return;const n=d();if(e=o.dispatch("SetSelectionRange",{range:e,forward:t}).range,n){s=e;try{n.removeAllRanges(),n.addRange(e)}catch(e){}!1===t&&n.extend&&(n.collapse(e.endContainer,e.endOffset),n.extend(e.startContainer,e.startOffset)),r=n.rangeCount>0?n.getRangeAt(0):null}if(!e.collapsed&&e.startContainer===e.endContainer&&(null==n?void 0:n.setBaseAndExtent)&&e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()){const t=e.startContainer.childNodes[e.startOffset];t&&"IMG"===t.nodeName&&(n.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),n.anchorNode===e.startContainer&&n.focusNode===e.endContainer||n.setBaseAndExtent(t,0,t,1))}o.dispatch("AfterSetSelectionRange",{range:e,forward:t})},m=()=>{const t=d(),n=null==t?void 0:t.anchorNode,o=null==t?void 0:t.focusNode;if(!t||!n||!o||Jo(n)||Jo(o))return!0;const r=e.createRng(),s=e.createRng();try{r.setStart(n,t.anchorOffset),r.collapse(!0),s.setStart(o,t.focusOffset),s.collapse(!0)}catch(e){return!0}return r.compareBoundaryPoints(r.START_TO_START,s)<=0},f={dom:e,win:t,serializer:n,editor:o,expand:(t={type:"word"})=>u(Qf(e).expand(c(),t)),collapse:l,setCursorLocation:(t,n)=>{const r=e.createRng();C(t)&&C(n)?(r.setStart(t,n),r.setEnd(t,n),u(r),l(!1)):(bm(e,r,o.getBody(),!0),u(r))},getContent:e=>((e,t={})=>((e,t,n)=>aw(e).selection.getContent(t,n))(e,t.format?t.format:"html",t))(o,e),setContent:i,getBookmark:(e,t)=>g.getBookmark(e,t),moveToBookmark:e=>g.moveToBookmark(e),select:(t,n)=>(((e,t,n)=>I.from(t).bind((t=>I.from(t.parentNode).map((o=>{const r=e.nodeIndex(t),s=e.createRng();return s.setStart(o,r),s.setEnd(o,r+1),n&&(bm(e,s,t,!0),bm(e,s,t,!1)),s})))))(e,t,n).each(u),t),isCollapsed:()=>{const e=c(),t=d();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isEditable:()=>{const t=c(),n=o.getBody().querySelectorAll('[data-mce-selected="1"]');return n.length>0?ne(n,(t=>e.isEditable(t.parentElement))):Vg(e,t)},isForward:m,setNode:t=>(i(e.getOuterHTML(t)),t),getNode:()=>((e,t)=>{if(!t)return e;let n=t.startContainer,o=t.endContainer;const r=t.startOffset,s=t.endOffset;let a=t.commonAncestorContainer;t.collapsed||(n===o&&s-r<2&&n.hasChildNodes()&&(a=n.childNodes[r]),dr(n)&&dr(o)&&(n=n.length===r?Yg(n.nextSibling,!0):n.parentNode,o=0===s?Yg(o.previousSibling,!1):o.parentNode,n&&n===o&&(a=n)));const i=dr(a)?a.parentNode:a;return tr(i)?i:e})(o.getBody(),c()),getSel:d,setRng:u,getRng:c,getStart:e=>Wg(o.getBody(),c(),e),getEnd:e=>Kg(o.getBody(),c(),e),getSelectedBlocks:(t,n)=>((e,t,n,o)=>{const r=[],s=e.getRoot(),a=e.getParent(n||Wg(s,t,t.collapsed),e.isBlock),i=e.getParent(o||Kg(s,t,t.collapsed),e.isBlock);if(a&&a!==s&&r.push(a),a&&i&&a!==i){let t;const n=new Vo(a,s);for(;(t=n.next())&&t!==i;)e.isBlock(t)&&r.push(t)}return i&&a!==i&&i!==s&&r.push(i),r})(e,c(),t,n),normalize:()=>{const t=c(),n=d();if(!(cm(n).length>1)&&vm(o)){const n=Gf(e,t);return n.each((e=>{u(e,m())})),n.getOr(t)}return t},selectorChanged:(e,t)=>(a(e,t),f),selectorChangedWithUnbind:a,getScrollContainer:()=>{let t,n=e.getRoot();for(;n&&"BODY"!==n.nodeName;){if(n.scrollHeight>n.clientHeight){t=n;break}n=n.parentNode}return t},scrollIntoView:(e,t)=>{C(e)?((e,t,n)=>{(e.inline?pg:bg)(e,t,n)})(o,e,t):vg(o,c(),t)},placeCaretAt:(e,t)=>u(jf(e,t,o.getDoc())),getBoundingClientRect:()=>{const e=c();return e.collapsed?Ji.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:()=>{t=r=s=null,p.destroy()}},g=uf(f),p=_f(f,o);return f.bookmarkManager=g,f.controlSelection=p,f},fw=(e,t,n)=>{-1===Dt.inArray(t,n)&&(e.addAttributeFilter(n,((e,t)=>{let n=e.length;for(;n--;)e[n].attr(t,null)})),t.push(n))},gw=(e,t)=>{const n=["data-mce-selected"],o={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...e},r=t&&t.dom?t.dom:fa.DOM,s=t&&t.schema?t.schema:Fs(o),a=kC(o,s);return((e,t,n)=>{e.addAttributeFilter("data-mce-tabindex",((e,t)=>{let n=e.length;for(;n--;){const o=e[n];o.attr("tabindex",o.attr("data-mce-tabindex")),o.attr(t,null)}})),e.addAttributeFilter("src,href,style",((e,o)=>{const r="data-mce-"+o,s=t.url_converter,a=t.url_converter_scope;let i=e.length;for(;i--;){const t=e[i];let l=t.attr(r);void 0!==l?(t.attr(o,l.length>0?l:null),t.attr(r,null)):(l=t.attr(o),"style"===o?l=n.serializeStyle(n.parseStyle(l),t.name):s&&(l=s.call(a,l,o,t.name)),t.attr(o,l.length>0?l:null))}})),e.addAttributeFilter("class",(e=>{let t=e.length;for(;t--;){const n=e[t];let o=n.attr("class");o&&(o=o.replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),n.attr("class",o.length>0?o:null))}})),e.addAttributeFilter("data-mce-type",((e,t,n)=>{let o=e.length;for(;o--;){const t=e[o];if("bookmark"===t.attr("data-mce-type")&&!n.cleanup){const e=I.from(t.firstChild).exists((e=>{var t;return!ei(null!==(t=e.value)&&void 0!==t?t:"")}));e?t.unwrap():t.remove()}}})),e.addNodeFilter("noscript",(e=>{var t;let n=e.length;for(;n--;){const o=e[n].firstChild;o&&(o.value=ws.decode(null!==(t=o.value)&&void 0!==t?t:""))}})),e.addNodeFilter("script,style",((e,n)=>{var o;const r=e=>e.replace(/()/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let s=e.length;for(;s--;){const a=e[s],i=a.firstChild,l=null!==(o=null==i?void 0:i.value)&&void 0!==o?o:"";if("script"===n){const e=a.attr("type");e&&a.attr("type","mce-no/type"===e?null:e.replace(/^mce\-/,"")),"xhtml"===t.element_format&&i&&l.length>0&&(i.value="// ")}else"xhtml"===t.element_format&&i&&l.length>0&&(i.value="\x3c!--\n"+r(l)+"\n--\x3e")}})),e.addNodeFilter("#comment",(e=>{let o=e.length;for(;o--;){const r=e[o],s=r.value;t.preserve_cdata&&0===(null==s?void 0:s.indexOf("[CDATA["))?(r.name="#cdata",r.type=4,r.value=n.decode(s.replace(/^\[CDATA\[|\]\]$/g,""))):0===(null==s?void 0:s.indexOf("mce:protected "))&&(r.name="#text",r.type=3,r.raw=!0,r.value=unescape(s).substr(14))}})),e.addNodeFilter("xml:namespace,input",((e,t)=>{let n=e.length;for(;n--;){const o=e[n];7===o.type?o.remove():1===o.type&&("input"!==t||o.attr("type")||o.attr("type","text"))}})),e.addAttributeFilter("data-mce-type",(t=>{q(t,(t=>{"format-caret"===t.attr("data-mce-type")&&(t.isEmpty(e.schema.getNonEmptyElements())?t.remove():t.unwrap())}))})),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",((e,t)=>{let n=e.length;for(;n--;)e[n].attr(t,null)})),t.remove_trailing_brs&&((e,t,n)=>{t.addNodeFilter("br",((t,o,r)=>{const s=Dt.extend({},n.getBlockElements()),a=n.getNonEmptyElements(),i=n.getWhitespaceElements();s.body=1;const l=e=>e.name in s||Jr(n,e);for(let o=0,d=t.length;o{const i={format:"html",...n},l=((e,t,n)=>((e,t)=>C(e)&&e.hasEventListeners("PreProcess")&&!t.no_events)(e,n)?((e,t,n)=>{let o;const r=e.dom;let s=t.cloneNode(!0);const a=document.implementation;if(a.createHTMLDocument){const e=a.createHTMLDocument("");Dt.each("BODY"===s.nodeName?s.childNodes:[s],(t=>{e.body.appendChild(e.importNode(t,!0))})),s="BODY"!==s.nodeName?e.body.firstChild:e.body,o=r.doc,r.doc=e}return((e,t)=>{e.dispatch("PreProcess",t)})(e,{...n,node:s}),o&&(r.doc=o),s})(e,t,n):t)(t,e,i),d=((e,t,n)=>{const o=ti(n.getInner?t.innerHTML:e.getOuterHTML(t));return n.selection||Xa(Cn(t))?o:Dt.trim(o)})(r,l,i),c=((e,t,n)=>{const o=n.selection?{forced_root_block:!1,...n}:n,r=e.parse(t,o);return(e=>{const t=e=>"br"===(null==e?void 0:e.name),n=e.lastChild;if(t(n)){const e=n.prev;t(e)&&(n.remove(),e.remove())}})(r),r})(a,d,i);return"tree"===i.format?c:((e,t,n,o,r)=>{const s=((e,t,n)=>yp(e,t).serialize(n))(t,n,o);return((e,t,n)=>{if(!t.no_events&&e){const o=((e,t)=>e.dispatch("PostProcess",t))(e,{...t,content:n});return o.content}return n})(e,r,s)})(t,o,s,c,i)},addRules:s.addValidElements,setRules:s.setValidElements,addTempAttr:T(fw,a,n),getTempAttrs:N(n),getNodeFilters:a.getNodeFilters,getAttributeFilters:a.getAttributeFilters,removeNodeFilter:a.removeNodeFilter,removeAttributeFilter:a.removeAttributeFilter}},pw=(e,t)=>{const n=gw(e,t);return{schema:n.schema,addNodeFilter:n.addNodeFilter,addAttributeFilter:n.addAttributeFilter,serialize:n.serialize,addRules:n.addRules,setRules:n.setRules,addTempAttr:n.addTempAttr,getTempAttrs:n.getTempAttrs,getNodeFilters:n.getNodeFilters,getAttributeFilters:n.getAttributeFilters,removeNodeFilter:n.removeNodeFilter,removeAttributeFilter:n.removeAttributeFilter}},hw=(e,t,n={})=>{const o=((e,t)=>({format:"html",...e,set:!0,content:t}))(n,t);return AC(e,o).map((t=>{const n=((e,t,n)=>sw(e).editor.setContent(t,n))(e,t.content,t);return TC(e,n.html,t),n.content})).getOr(t)},bw="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists,template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),vw=[],yw="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,template,textcolor,rtc".split(","),Cw=[],ww=(e,t)=>{const n=Y(t,(t=>ke(e,t)));return ae(n)},xw=e=>{const t=ww(e,bw),n=e.forced_root_block;return!1!==n&&""!==n||t.push("forced_root_block (false only)"),ae(t)},Ew=e=>ww(e,vw),kw=(e,t)=>{const n=Dt.makeMap(e.plugins," "),o=Y(t,(e=>ke(n,e)));return ae(o)},_w=e=>kw(e,yw),Sw=e=>kw(e,Cw.map((e=>e.name))),Nw=e=>Q(Cw,(t=>t.name===e)).fold((()=>e),(t=>t.replacedWith?`${e}, replaced by ${t.replacedWith}`:e)),Rw=fa.DOM,Aw=e=>I.from(e).each((e=>e.destroy())),Tw=(()=>{const e={};return{add:(t,n)=>{e[t]=n},get:t=>e[t]?e[t]:{icons:{}},has:t=>ke(e,t)}})(),Ow=Ca.ModelManager,Bw=(e,t)=>t.dom[e],Pw=(e,t)=>parseInt(uo(t,e),10),Dw=T(Bw,"clientWidth"),Lw=T(Bw,"clientHeight"),Mw=T(Pw,"margin-top"),Iw=T(Pw,"margin-left"),Fw=e=>{const t=[],n=()=>{const t=e.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:e,close:e,getArgs:e}})()},o=()=>I.from(t[0]),r=()=>{o().each((e=>{e.reposition()}))},s=e=>{J(t,(t=>t===e)).each((e=>{t.splice(e,1)}))},a=(o,a=!0)=>e.removed||!(e=>{return(t=e.inline?e.getBody():e.getContentAreaContainer(),I.from(t).map(Cn)).map(Xn).getOr(!1);var t})(e)?{}:(a&&e.dispatch("BeforeOpenNotification",{notification:o}),Q(t,(e=>{return t=n().getArgs(e),r=o,!(t.type!==r.type||t.text!==r.text||t.progressBar||t.timeout||r.progressBar||r.timeout);var t,r})).getOrThunk((()=>{e.editorManager.setActive(e);const a=n().open(o,(()=>{s(a)}),(()=>Hg(e)));return(e=>{t.push(e)})(a),r(),e.dispatch("OpenNotification",{notification:{...a}}),a}))),i=N(t);return(e=>{e.on("SkinLoaded",(()=>{const t=Ed(e);t&&a({text:t,type:"warning",timeout:0},!1),r()})),e.on("show ResizeEditor NodeChange",(()=>{requestAnimationFrame(r)})),e.on("remove",(()=>{q(t.slice(),(e=>{n().close(e)}))})),e.addShortcut("alt+F12","Focus to notification",(()=>o().map((e=>Cn(e.getEl()))).each((e=>yg(e)))))})(e),{open:a,close:()=>{o().each((e=>{n().close(e),s(e),r()}))},getNotifications:i}},Uw=Ca.PluginManager,zw=Ca.ThemeManager,jw=e=>{let t=[];const n=()=>{const t=e.theme;return t&&t.getWindowManagerImpl?t.getWindowManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:e,openUrl:e,alert:e,confirm:e,close:e}})()},o=(e,t)=>(...n)=>t?t.apply(e,n):void 0,r=n=>{(t=>{e.dispatch("CloseWindow",{dialog:t})})(n),t=Y(t,(e=>e!==n)),0===t.length&&e.focus()},s=n=>{e.editorManager.setActive(e),Rg(e),e.ui.show();const o=n();return(n=>{t.push(n),(t=>{e.dispatch("OpenWindow",{dialog:t})})(n)})(o),o};return e.on("remove",(()=>{q(t,(e=>{n().close(e)}))})),{open:(e,t)=>s((()=>n().open(e,t,r))),openUrl:e=>s((()=>n().openUrl(e,r))),alert:(e,t,r)=>{const s=n();s.alert(e,o(r||s,t))},confirm:(e,t,r)=>{const s=n();s.confirm(e,o(r||s,t))},close:()=>{I.from(t[t.length-1]).each((e=>{n().close(e),r(e)}))}}},Hw=(e,t)=>{e.notificationManager.open({type:"error",text:t})},$w=(e,t)=>{e._skinLoaded?Hw(e,t):e.on("SkinLoaded",(()=>{Hw(e,t)}))},Vw=(e,t,n)=>{ff(e,t,{message:n}),console.error(n)},qw=(e,t,n)=>n?`Failed to load ${e}: ${n} from url ${t}`:`Failed to load ${e} url: ${t}`,Ww=(e,...t)=>{const n=window.console;n&&(n.error?n.error(e,...t):n.log(e,...t))},Kw=e=>"content/"+e+"/content.css",Yw=(e,t)=>{const n=e.editorManager.baseURL+"/skins/content",o=`content${e.editorManager.suffix}.css`;return V(t,(t=>(e=>tinymce.Resource.has(Kw(e)))(t)?t:(e=>/^[a-z0-9\-]+$/i.test(e))(t)&&!e.inline?`${n}/${t}/${o}`:e.documentBaseURI.toAbsolute(t)))},Gw=(e,t)=>{const n={};return{findAll:(o,r=M)=>{const s=Y((e=>e?ce(e.getElementsByTagName("img")):[])(o),(t=>{const n=t.src;return!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!n||n===Tt.transparentSrc)&&($e(n,"blob:")?!e.isUploaded(n)&&r(t):!!$e(n,"data:")&&r(t))})),a=V(s,(e=>{const o=e.src;if(ke(n,o))return n[o].then((t=>m(t)?t:{image:e,blobInfo:t.blobInfo}));{const r=((e,t)=>{const n=()=>Promise.reject("Invalid data URI");if($e(t,"blob:")){const s=e.getByUri(t);return C(s)?Promise.resolve(s):(o=t,$e(o,"blob:")?(e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject())).catch((()=>Promise.reject({message:`Cannot convert ${e} to Blob. Resource might not exist or is inaccessible.`,uriType:"blob"}))))(o):$e(o,"data:")?(r=o,new Promise(((e,t)=>{Qv(r).bind((({type:e,data:t,base64Encoded:n})=>Jv(e,t,n))).fold((()=>t("Invalid data URI")),e)}))):Promise.reject("Unknown URI format")).then((t=>ey(t).then((o=>ny(o,!1,(n=>I.some(oy(e,t,n)))).getOrThunk(n)))))}var o,r;return $e(t,"data:")?ry(e,t).fold(n,(e=>Promise.resolve(e))):Promise.reject("Unknown image data format")})(t,o).then((t=>(delete n[o],{image:e,blobInfo:t}))).catch((e=>(delete n[o],e)));return n[o]=r,r}}));return Promise.all(a)}}},Xw=()=>{let e={};const t=(e,t)=>({status:e,resultUri:t}),n=t=>t in e;return{hasBlobUri:n,getResultUri:t=>{const n=e[t];return n?n.resultUri:null},isPending:t=>!!n(t)&&1===e[t].status,isUploaded:t=>!!n(t)&&2===e[t].status,markPending:n=>{e[n]=t(1,null)},markUploaded:(n,o)=>{e[n]=t(2,o)},removeFailed:t=>{delete e[t]},destroy:()=>{e={}}}};let Zw=0;const Qw=(e,t)=>{const n={},o=(e,n)=>new Promise(((o,r)=>{const s=new XMLHttpRequest;s.open("POST",t.url),s.withCredentials=t.credentials,s.upload.onprogress=e=>{n(e.loaded/e.total*100)},s.onerror=()=>{r("Image upload failed due to a XHR Transport error. Code: "+s.status)},s.onload=()=>{if(s.status<200||s.status>=300)return void r("HTTP Error: "+s.status);const e=JSON.parse(s.responseText);var n,a;e&&m(e.location)?o((n=t.basePath,a=e.location,n?n.replace(/\/$/,"")+"/"+a.replace(/^\//,""):a)):r("Invalid JSON: "+s.responseText)};const a=new FormData;a.append("file",e.blob(),e.filename()),s.send(a)})),r=w(t.handler)?t.handler:o,s=(e,t)=>({url:t,blobInfo:e,status:!0}),a=(e,t)=>({url:"",blobInfo:e,status:!1,error:t}),i=(e,t)=>{Dt.each(n[e],(e=>{e(t)})),delete n[e]};return{upload:(l,d)=>t.url||r!==o?((t,o)=>(t=Dt.grep(t,(t=>!e.isUploaded(t.blobUri()))),Promise.all(Dt.map(t,(t=>e.isPending(t.blobUri())?(e=>{const t=e.blobUri();return new Promise((e=>{n[t]=n[t]||[],n[t].push(e)}))})(t):((t,n,o)=>(e.markPending(t.blobUri()),new Promise((r=>{let l,d;try{const c=()=>{l&&(l.close(),d=k)},u=n=>{c(),e.markUploaded(t.blobUri(),n),i(t.blobUri(),s(t,n)),r(s(t,n))},f=n=>{c(),e.removeFailed(t.blobUri()),i(t.blobUri(),a(t,n)),r(a(t,n))};d=e=>{e<0||e>100||I.from(l).orThunk((()=>I.from(o).map(P))).each((t=>{l=t,t.progressBar.value(e)}))},n(t,d).then(u,(e=>{f(m(e)?{message:e}:e)}))}catch(e){r(a(t,e))}}))))(t,r,o))))))(l,d):new Promise((e=>{e([])}))}},Jw=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),ex=(e,t)=>Qw(t,{url:rd(e),basePath:sd(e),credentials:ad(e),handler:id(e)}),tx=e=>{const t=(()=>{let e=[];const t=e=>{if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");const t=e.id||"blobid"+Zw+++(()=>{const e=()=>Math.round(4294967295*Math.random()).toString(36);return"s"+(new Date).getTime().toString(36)+e()+e()+e()})(),n=e.name||t,o=e.blob;var r;return{id:N(t),name:N(n),filename:N(e.filename||n+"."+(r=o.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[r.toLowerCase()]||"dat")),blob:N(o),base64:N(e.base64),blobUri:N(e.blobUri||URL.createObjectURL(o)),uri:N(e.uri)}},n=t=>Q(e,t).getOrUndefined(),o=e=>n((t=>t.id()===e));return{create:(e,n,o,r,s)=>{if(m(e))return t({id:e,name:r,filename:s,blob:n,base64:o});if(f(e))return t(e);throw new Error("Unknown input type")},add:t=>{o(t.id())||e.push(t)},get:o,getByUri:e=>n((t=>t.blobUri()===e)),getByData:(e,t)=>n((n=>n.base64()===e&&n.blob().type===t)),findFirst:n,removeByUri:t=>{e=Y(e,(e=>e.blobUri()!==t||(URL.revokeObjectURL(e.blobUri()),!1)))},destroy:()=>{q(e,(e=>{URL.revokeObjectURL(e.blobUri())})),e=[]}}})();let n,o;const r=Xw(),s=[],a=t=>n=>e.selection?t(n):[],i=(e,t,n)=>{let o=0;do{o=e.indexOf(t,o),-1!==o&&(e=e.substring(0,o)+n+e.substr(o+t.length),o+=n.length-t.length+1)}while(-1!==o);return e},l=(e,t,n)=>{const o=`src="${n}"${n===Tt.transparentSrc?' data-mce-placeholder="1"':""}`;return e=i(e,`src="${t}"`,o),i(e,'data-mce-src="'+t+'"','data-mce-src="'+n+'"')},d=(t,n)=>{q(e.undoManager.data,(e=>{"fragmented"===e.type?e.fragments=V(e.fragments,(e=>l(e,t,n))):e.content=l(e.content,t,n)}))},c=()=>(n||(n=ex(e,r)),p().then(a((o=>{const r=V(o,(e=>e.blobInfo));return n.upload(r,Jw(e)).then(a((n=>{const r=[];let s=!1;const a=V(n,((n,a)=>{const{blobInfo:i,image:l}=o[a];let c=!1;return n.status&&td(e)?(n.url&&!He(l.src,n.url)&&(s=!0),t.removeByUri(l.src),rw(e)||((t,n)=>{const o=e.convertURL(n,"src");var r;d(t.src,n),en(Cn(t),{src:ed(e)?(r=n,r+(-1===r.indexOf("?")?"?":"&")+(new Date).getTime()):n,"data-mce-src":o})})(l,n.url)):n.error&&(n.error.remove&&(d(l.src,Tt.transparentSrc),r.push(l),c=!0),((e,t)=>{$w(e,ya.translate(["Failed to upload image: {0}",t]))})(e,n.error.message)),{element:l,status:n.status,uploadUri:n.url,blobInfo:i,removed:c}}));return r.length>0&&!rw(e)?e.undoManager.transact((()=>{q(_o(r),(n=>{const o=Tn(n);Eo(n),o.each((e=>t=>{((e,t)=>e.dom.isEmpty(t.dom)&&C(e.schema.getTextBlockElements()[$t(t)]))(e,t)&&yo(t,bn('
'))})(e)),t.removeByUri(n.dom.src)}))})):s&&e.undoManager.dispatchChange(),a})))})))),u=()=>Jl(e)?c():Promise.resolve([]),g=e=>ne(s,(t=>t(e))),p=()=>(o||(o=Gw(r,t)),o.findAll(e.getBody(),g).then(a((t=>{const n=Y(t,(t=>m(t)?($w(e,t),!1):"blob"!==t.uriType));return rw(e)||q(n,(e=>{d(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")})),n})))),h=n=>n.replace(/src="(blob:[^"]+)"/g,((n,o)=>{const s=r.getResultUri(o);if(s)return'src="'+s+'"';let a=t.getByUri(o);return a||(a=X(e.editorManager.get(),((e,t)=>e||t.editorUpload&&t.editorUpload.blobCache.getByUri(o)),void 0)),a?'src="data:'+a.blob().type+";base64,"+a.base64()+'"':n}));return e.on("SetContent",(()=>{Jl(e)?u():p()})),e.on("RawSaveContent",(e=>{e.content=h(e.content)})),e.on("GetContent",(e=>{e.source_view||"raw"===e.format||"tree"===e.format||(e.content=h(e.content))})),e.on("PostRender",(()=>{e.parser.addNodeFilter("img",(e=>{q(e,(e=>{const n=e.attr("src");if(!n||t.getByUri(n))return;const o=r.getResultUri(n);o&&e.attr("src",o)}))}))})),{blobCache:t,addFilter:e=>{s.push(e)},uploadImages:c,uploadImagesAuto:u,scanForImages:p,destroy:()=>{t.destroy(),r.destroy(),o=n=null}}},nx={remove_similar:!0,inherit:!1},ox={selector:"td,th",...nx},rx={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...ox},tablecellverticalalign:{styles:{"vertical-align":"%value"},...ox},tablecellbordercolor:{styles:{borderColor:"%value"},...ox},tablecellclass:{classes:["%value"],...ox},tableclass:{selector:"table",classes:["%value"],...nx},tablecellborderstyle:{styles:{borderStyle:"%value"},...ox},tablecellborderwidth:{styles:{borderWidth:"%value"},...ox}},sx=N(rx),ax=Dt.each,ix=fa.DOM,lx=e=>C(e)&&f(e),dx=(e,t)=>{const n=t&&t.schema||Fs({}),o=e=>{const t=m(e)?{name:e,classes:[],attrs:{}}:e,n=ix.create(t.name);return((e,t)=>{t.classes.length>0&&ix.addClass(e,t.classes.join(" ")),ix.setAttribs(e,t.attrs)})(n,t),n},r=(e,t,s)=>{let a;const i=t[0],l=lx(i)?i.name:void 0,d=((e,t)=>{const o=n.getElementRule(e.nodeName.toLowerCase()),r=null==o?void 0:o.parentsRequired;return!(!r||!r.length)&&(t&&H(r,t)?t:r[0])})(e,l);if(d)l===d?(a=i,t=t.slice(1)):a=d;else if(i)a=i,t=t.slice(1);else if(!s)return e;const c=a?o(a):ix.create("div");c.appendChild(e),s&&Dt.each(s,(t=>{const n=o(t);c.insertBefore(n,e)}));const u=lx(a)?a.siblings:void 0;return r(c,t,u)},s=ix.create("div");if(e.length>0){const t=e[0],n=o(t),a=lx(t)?t.siblings:void 0;s.appendChild(r(n,e.slice(1),a))}return s},cx=e=>{let t="div";const n={name:t,classes:[],attrs:{},selector:e=Dt.trim(e)};return"*"!==e&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,((e,t,o,r,s)=>{switch(t){case"#":n.attrs.id=o;break;case".":n.classes.push(o);break;case":":-1!==Dt.inArray("checked disabled enabled read-only required".split(" "),o)&&(n.attrs[o]=o)}if("["===r){const e=s.match(/([\w\-]+)(?:\=\"([^\"]+))?/);e&&(n.attrs[e[1]]=e[2])}return""}))),n.name=t||"div",n},ux=(e,t)=>{let n="",o=Td(e);if(""===o)return"";const r=e=>m(e)?e.replace(/%(\w+)/g,""):"",s=(t,n)=>ix.getStyle(null!=n?n:e.getBody(),t,!0);if(m(t)){const n=e.formatter.get(t);if(!n)return"";t=n[0]}if("preview"in t){const e=t.preview;if(!1===e)return"";o=e||o}let a,i=t.block||t.inline||"span";const l=(d=t.selector,m(d)?(d=(d=d.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Dt.map(d.split(/(?:>|\s+(?![^\[\]]+\]))/),(e=>{const t=Dt.map(e.split(/(?:~\+|~|\+)/),cx),n=t.pop();return t.length&&(n.siblings=t),n})).reverse()):[]);var d;l.length>0?(l[0].name||(l[0].name=i),i=t.selector,a=dx(l,e)):a=dx([i],e);const c=ix.select(i,a)[0]||a.firstChild;ax(t.styles,((e,t)=>{const n=r(e);n&&ix.setStyle(c,t,n)})),ax(t.attributes,((e,t)=>{const n=r(e);n&&ix.setAttrib(c,t,n)})),ax(t.classes,(e=>{const t=r(e);ix.hasClass(c,t)||ix.addClass(c,t)})),e.dispatch("PreviewFormats"),ix.setStyles(a,{position:"absolute",left:-65535}),e.getBody().appendChild(a);const u=s("fontSize"),f=/px$/.test(u)?parseInt(u,10):0;return ax(o.split(" "),(e=>{let t=s(e,c);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=s(e),"#ffffff"===Ks(t).toLowerCase())||"color"===e&&"#000000"===Ks(t).toLowerCase())){if("font-size"===e&&/em|%$/.test(t)){if(0===f)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*f+"px"}"border"===e&&t&&(n+="padding:0 2px;"),n+=e+":"+t+";"}})),e.dispatch("AfterPreviewFormats"),ix.remove(a),n},mx=e=>{const t=(e=>{const t={},n=(e,o)=>{e&&(m(e)?(p(o)||(o=[o]),q(o,(e=>{v(e.deep)&&(e.deep=!Fm(e)),v(e.split)&&(e.split=!Fm(e)||Um(e)),v(e.remove)&&Fm(e)&&!Um(e)&&(e.remove="none"),Fm(e)&&Um(e)&&(e.mixed=!0,e.block_expand=!0),m(e.classes)&&(e.classes=e.classes.split(/\s+/))})),t[e]=o):pe(e,((e,t)=>{n(t,e)})))};return n((e=>{const t=e.dom,n=e.schema.type,o={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"left"},inherit:!1,preview:!1},{selector:"img,audio,video",collapsed:!1,styles:{float:"left"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginLeft:"0px",marginRight:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"},{selector:".mce-preview-object",ceFalseOverride:!0,styles:{display:"table",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{marginLeft:"auto",marginRight:"auto"},preview:!1}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{float:"right"},preview:"font-family font-size"},{selector:"table",collapsed:!1,styles:{marginRight:"0px",marginLeft:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"right"},preview:!1}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"justify"},inherit:!1,preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all",preserve_attributes:["class","style"]}],italic:[{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all",preserve_attributes:["class","style"]}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all",preserve_attributes:["class","style"]}],strikethrough:(()=>{const e={inline:"span",styles:{textDecoration:"line-through"},exact:!0},t={inline:"strike",remove:"all",preserve_attributes:["class","style"]},o={inline:"s",remove:"all",preserve_attributes:["class","style"]};return"html4"!==n?[o,e,t]:[e,o,t]})(),forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},lineheight:{selector:"h1,h2,h3,h4,h5,h6,p,li,td,th,div",styles:{lineHeight:"%value"}},fontsize_class:{inline:"span",attributes:{class:"%value"}},blockquote:{block:"blockquote",wrapper:!0,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:(e,t,n)=>er(e)&&e.hasAttribute("href"),onformat:(e,n,o)=>{Dt.each(o,((n,o)=>{t.setAttrib(e,o,n)}))}},lang:{inline:"span",clear_child_styles:!0,remove_similar:!0,attributes:{lang:"%value","data-mce-lang":e=>{var t;return null!==(t=null==e?void 0:e.customValue)&&void 0!==t?t:null}}},removeformat:[{selector:"b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return Dt.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd samp".split(/\s/),(e=>{o[e]={block:e,remove:"all"}})),o})(e)),n(sx()),n(Ad(e)),{get:e=>C(e)?t[e]:t,has:e=>ke(t,e),register:n,unregister:e=>(e&&t[e]&&delete t[e],t)}})(e),n=Br({});return(e=>{e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(let t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])})(e),(e=>{e.on("mouseup keydown",(t=>{var n;((e,t,n)=>{const o=e.selection,r=e.getBody();Jb(e,null,n),8!==t&&46!==t||!o.isCollapsed()||o.getStart().innerHTML!==Gb||Jb(e,Ku(r,o.getStart()),!0),37!==t&&39!==t||Jb(e,Ku(r,o.getStart()),!0)})(e,t.keyCode,(n=e.selection.getRng().endContainer,dr(n)&&Ve(n.data,Wo)))}))})(e),rw(e)||((e,t)=>{e.set({}),t.on("NodeChange",(n=>{Yv(t,n.element,e.get())})),t.on("FormatApply FormatRemove",(n=>{const o=I.from(n.node).map((e=>wm(e)?e:e.startContainer)).bind((e=>er(e)?I.some(e):I.from(e.parentElement))).getOrThunk((()=>qv(t)));Yv(t,o,e.get())}))})(n,e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(t,n,o)=>{((e,t,n,o)=>{aw(e).formatter.apply(t,n,o)})(e,t,n,o)},remove:(t,n,o,r)=>{((e,t,n,o,r)=>{aw(e).formatter.remove(t,n,o,r)})(e,t,n,o,r)},toggle:(t,n,o)=>{((e,t,n,o)=>{aw(e).formatter.toggle(t,n,o)})(e,t,n,o)},match:(t,n,o,r)=>((e,t,n,o,r)=>aw(e).formatter.match(t,n,o,r))(e,t,n,o,r),closest:t=>((e,t)=>aw(e).formatter.closest(t))(e,t),matchAll:(t,n)=>((e,t,n)=>aw(e).formatter.matchAll(t,n))(e,t,n),matchNode:(t,n,o,r)=>((e,t,n,o,r)=>aw(e).formatter.matchNode(t,n,o,r))(e,t,n,o,r),canApply:t=>((e,t)=>aw(e).formatter.canApply(t))(e,t),formatChanged:(t,o,r,s)=>((e,t,n,o,r,s)=>aw(e).formatter.formatChanged(t,n,o,r,s))(e,n,t,o,r,s),getCssText:T(ux,e)}},fx=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},gx=e=>{const t=Dr(),n=Br(0),o=Br(0),r={data:[],typing:!1,beforeChange:()=>{((e,t,n)=>{aw(e).undoManager.beforeChange(t,n)})(e,n,t)},add:(s,a)=>((e,t,n,o,r,s,a)=>aw(e).undoManager.add(t,n,o,r,s,a))(e,r,o,n,t,s,a),dispatchChange:()=>{e.setDirty(!0);const t=GC(e);t.bookmark=Cl(e.selection),e.dispatch("change",{level:t,lastLevel:ie(r.data,o.get()).getOrUndefined()})},undo:()=>((e,t,n,o)=>aw(e).undoManager.undo(t,n,o))(e,r,n,o),redo:()=>((e,t,n)=>aw(e).undoManager.redo(t,n))(e,o,r.data),clear:()=>{((e,t,n)=>{aw(e).undoManager.clear(t,n)})(e,r,o)},reset:()=>{((e,t)=>{aw(e).undoManager.reset(t)})(e,r)},hasUndo:()=>((e,t,n)=>aw(e).undoManager.hasUndo(t,n))(e,r,o),hasRedo:()=>((e,t,n)=>aw(e).undoManager.hasRedo(t,n))(e,r,o),transact:t=>((e,t,n,o)=>aw(e).undoManager.transact(t,n,o))(e,r,n,t),ignore:t=>{((e,t,n)=>{aw(e).undoManager.ignore(t,n)})(e,n,t)},extra:(t,n)=>{((e,t,n,o,r)=>{aw(e).undoManager.extra(t,n,o,r)})(e,r,o,t,n)}};return rw(e)||((e,t,n)=>{const o=Br(!1),r=e=>{tw(t,!1,n),t.add({},e)};e.on("init",(()=>{t.add()})),e.on("BeforeExecCommand",(e=>{const o=e.command;fx(o)||(nw(t,n),t.beforeChange())})),e.on("ExecCommand",(e=>{const t=e.command;fx(t)||r(e)})),e.on("ObjectResizeStart cut",(()=>{t.beforeChange()})),e.on("SaveContent ObjectResized blur",r),e.on("dragend",r),e.on("keyup",(n=>{const s=n.keyCode;if(n.isDefaultPrevented())return;const a=Tt.os.isMacOS()&&"Meta"===n.key;(s>=33&&s<=36||s>=37&&s<=40||45===s||n.ctrlKey||a)&&(r(),e.nodeChanged()),46!==s&&8!==s||e.nodeChanged(),o.get()&&t.typing&&!JC(GC(e),t.data[0])&&(e.isDirty()||e.setDirty(!0),e.dispatch("TypingUndo"),o.set(!1),e.nodeChanged())})),e.on("keydown",(e=>{const s=e.keyCode;if(e.isDefaultPrevented())return;if(s>=33&&s<=36||s>=37&&s<=40||45===s)return void(t.typing&&r(e));const a=e.ctrlKey&&!e.altKey||e.metaKey;if((s<16||s>20)&&224!==s&&91!==s&&!t.typing&&!a)return t.beforeChange(),tw(t,!0,n),t.add({},e),void o.set(!0);(Tt.os.isMacOS()?e.metaKey:e.ctrlKey&&!e.altKey)&&t.beforeChange()})),e.on("mousedown",(e=>{t.typing&&r(e)})),e.on("input",(e=>{var t;e.inputType&&("insertReplacementText"===e.inputType||"insertText"===(t=e).inputType&&null===t.data||(e=>"insertFromPaste"===e.inputType||"insertFromDrop"===e.inputType)(e))&&r(e)})),e.on("AddUndo Undo Redo ClearUndos",(t=>{t.isDefaultPrevented()||e.nodeChanged()}))})(e,r,n),(e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")})(e),r},px=[9,27,Cf.HOME,Cf.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,Cf.DOWN,Cf.UP,Cf.LEFT,Cf.RIGHT].concat(Tt.browser.isFirefox()?[224]:[]),hx="data-mce-placeholder",bx=e=>"keydown"===e.type||"keyup"===e.type,vx=e=>{const t=e.keyCode;return t===Cf.BACKSPACE||t===Cf.DELETE},yx=(e,t)=>({from:e,to:t}),Cx=(e,t)=>{const n=Cn(e),o=Cn(t.container());return Ih(n,o).map((e=>((e,t)=>({block:e,position:t}))(e,t)))},wx=(e,t)=>Jn(t,(e=>Ga(e)||br(e.dom)),(t=>_n(t,e))).filter(Kt).getOr(e),xx=(e,t)=>{const n=((e,t)=>{const n=In(e);return J(n,(e=>t.isBlock($t(e)))).fold(N(n),(e=>n.slice(0,e)))})(e,t);return q(n,Eo),n},Ex=(e,t,n)=>{const o=zp(n,t);return Q(o.reverse(),(t=>Tr(e,t))).each(Eo)},kx=(e,t,n,o,r)=>{if(Tr(o,n))return Qa(n),$u(n.dom);((e,t)=>0===Y(Ln(t),(t=>!Tr(e,t))).length)(o,r)&&Tr(o,t)&&ho(r,vn("br"));const s=Hu(n.dom,Ji.before(r.dom));return q(xx(t,o),(e=>{ho(r,e)})),Ex(o,e,t),s},_x=(e,t,n,o)=>{if(Tr(o,n)){if(Tr(o,t)){const e=e=>{const t=(e,n)=>Un(e).fold((()=>n),(e=>((e,t)=>e.isInline($t(t)))(o,e)?t(e,n.concat(Ia(e))):n));return t(e,[])},r=G(e(n),((e,t)=>(Co(e,t),t)),Za());xo(t),yo(t,r)}return Eo(n),$u(t.dom)}const r=Vu(n.dom);return q(xx(t,o),(e=>{yo(n,e)})),Ex(o,e,t),r},Sx=(e,t)=>{zu(e,t.dom).bind((e=>I.from(e.getNode()))).map(Cn).filter(Va).each(Eo)},Nx=(e,t,n,o)=>(Sx(!0,t),Sx(!1,n),((e,t)=>Sn(t,e)?((e,t)=>{const n=zp(t,e);return I.from(n[n.length-1])})(t,e):I.none())(t,n).fold(T(_x,e,t,n,o),T(kx,e,t,n,o))),Rx=(e,t,n,o,r)=>t?Nx(e,o,n,r):Nx(e,n,o,r),Ax=(e,t)=>{const n=Cn(e.getBody()),o=((e,t,n,o)=>o.collapsed?((e,t,n,o)=>{const r=Cx(t,Ji.fromRangeStart(o)),s=r.bind((o=>Iu(n,t,o.position).bind((o=>Cx(t,o).map((o=>((e,t,n,o)=>pr(o.position.getNode())&&!Tr(e,o.block)?zu(!1,o.block.dom).bind((e=>e.isEqual(o.position)?Iu(n,t,e).bind((e=>Cx(t,e))):I.some(o))).getOr(o):o)(e,t,n,o)))))));return It(r,s,yx).filter((e=>(e=>!_n(e.from.block,e.to.block))(e)&&((e,t)=>{const n=Cn(e);return _n(wx(n,t.from.block),wx(n,t.to.block))})(t,e)&&(e=>!1===vr(e.from.block.dom)&&!1===vr(e.to.block.dom))(e)&&(e=>{const t=e=>qa(e)||Yr(e.dom)||Ka(e);return t(e.from.block)&&t(e.to.block)})(e)&&(e=>!(Sn(e.to.block,e.from.block)||Sn(e.from.block,e.to.block)))(e)))})(e,t,n,o):I.none())(e.schema,n.dom,t,e.selection.getRng()).map((o=>()=>{Rx(n,t,o.from.block,o.to.block,e.schema).each((t=>{e.selection.setRng(t.toRange())}))}));return o},Tx=(e,t)=>{const n=Cn(t),o=T(_n,e);return Qn(n,Ga,o).isSome()},Ox=e=>{const t=Cn(e.getBody());return((e,t)=>{const n=Hu(e.dom,Ji.fromRangeStart(t)).isNone(),o=ju(e.dom,Ji.fromRangeEnd(t)).isNone();return!((e,t)=>Tx(e,t.startContainer)||Tx(e,t.endContainer))(e,t)&&n&&o})(t,e.selection.getRng())?(e=>I.some((()=>{e.setContent(""),e.selection.setCursorLocation()})))(e):((e,t,n)=>{const o=t.getRng();return It(Ih(e,Cn(o.startContainer)),Ih(e,Cn(o.endContainer)),((r,s)=>_n(r,s)?I.none():I.some((()=>{o.deleteContents(),Rx(e,!0,r,s,n).each((e=>{t.setRng(e.toRange())}))})))).getOr(I.none())})(t,e.selection,e.schema)},Bx=(e,t)=>e.selection.isCollapsed()?I.none():Ox(e),Px=(e,t,n,o,r)=>I.from(t._selectionOverrides.showCaret(e,n,o,r)),Dx=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?I.none():I.some((e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t})(t)),Lx=(e,t,n)=>t.collapsed?((e,t,n)=>{const o=hu(1,e.getBody(),t),r=Ji.fromRangeStart(o),s=r.getNode();if(Kc(s))return Px(1,e,s,!r.isAtEnd(),!1);const a=r.getNode(!0);if(Kc(a))return Px(1,e,a,!1,!1);const i=gb(e.dom.getRoot(),r.getNode());return Kc(i)?Px(1,e,i,!1,n):I.none()})(e,t,n).getOr(t):t,Mx=e=>Ip(e)||Pp(e),Ix=e=>Fp(e)||Dp(e),Fx=(e,t,n,o,r,s)=>{Px(o,e,s.getNode(!r),r,!0).each((n=>{if(t.collapsed){const e=t.cloneRange();r?e.setEnd(n.startContainer,n.startOffset):e.setStart(n.endContainer,n.endOffset),e.deleteContents()}else t.deleteContents();e.selection.setRng(n)})),((e,t)=>{dr(t)&&0===t.data.length&&e.remove(t)})(e.dom,n)},Ux=(e,t)=>((e,t)=>{const n=e.selection.getRng();if(!dr(n.commonAncestorContainer))return I.none();const o=t?xu.Forwards:xu.Backwards,r=Pu(e.getBody()),s=T(Cu,t?r.next:r.prev),a=t?Mx:Ix,i=vu(o,e.getBody(),n),l=s(i),d=l?Oh(t,l):l;if(!d||!wu(i,d))return I.none();if(a(d))return I.some((()=>Fx(e,n,i.getNode(),o,t,d)));const c=s(d);return c&&a(c)&&wu(d,c)?I.some((()=>Fx(e,n,i.getNode(),o,t,c))):I.none()})(e,t),zx=(e,t)=>{const n=e.getBody();return t?$u(n).filter(Ip):Vu(n).filter(Fp)},jx=e=>{const t=e.selection.getRng();return!t.collapsed&&(zx(e,!0).exists((e=>e.isEqual(Ji.fromRangeStart(t))))||zx(e,!1).exists((e=>e.isEqual(Ji.fromRangeEnd(t)))))},Hx=kl([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),$x=(e,t,n,o)=>Iu(t,e,n).bind((r=>{return s=r.getNode(),C(s)&&(Ga(Cn(s))||Ka(Cn(s)))||((e,t,n,o,r)=>{const s=t=>r.isInline(t.nodeName.toLowerCase())&&!du(n,o,e);return bu(!t,n).fold((()=>bu(t,o).fold(L,s)),s)})(e,t,n,r,o)?I.none():t&&vr(r.getNode())||!t&&vr(r.getNode(!0))?((e,t,n,o,r)=>{const s=r.getNode(!n);return Ih(Cn(t),Cn(o.getNode())).map((t=>Tr(e,t)?Hx.remove(t.dom):Hx.moveToElement(s))).orThunk((()=>I.some(Hx.moveToElement(s))))})(o,e,t,n,r):t&&Fp(n)||!t&&Ip(n)?I.some(Hx.moveToPosition(r)):I.none();var s})),Vx=(e,t)=>I.from(gb(e.getBody(),t)),qx=(e,t)=>{const n=e.selection.getNode();return Vx(e,n).filter(vr).fold((()=>((e,t,n,o)=>{const r=hu(t?1:-1,e,n),s=Ji.fromRangeStart(r),a=Cn(e);return!t&&Fp(s)?I.some(Hx.remove(s.getNode(!0))):t&&Ip(s)?I.some(Hx.remove(s.getNode())):!t&&Ip(s)&&Qp(a,s,o)?Jp(a,s,o).map((e=>Hx.remove(e.getNode()))):t&&Fp(s)&&Zp(a,s,o)?eh(a,s,o).map((e=>Hx.remove(e.getNode()))):((e,t,n,o)=>((e,t)=>{const n=t.getNode(!e),o=e?"after":"before";return er(n)&&n.getAttribute("data-mce-caret")===o})(t,n)?((e,t)=>y(t)?I.none():e&&vr(t.nextSibling)?I.some(Hx.moveToElement(t.nextSibling)):!e&&vr(t.previousSibling)?I.some(Hx.moveToElement(t.previousSibling)):I.none())(t,n.getNode(!t)).orThunk((()=>$x(e,t,n,o))):$x(e,t,n,o).bind((t=>((e,t,n)=>n.fold((e=>I.some(Hx.remove(e))),(e=>I.some(Hx.moveToElement(e))),(n=>du(t,n,e)?I.none():I.some(Hx.moveToPosition(n)))))(e,n,t))))(e,t,s,o)})(e.getBody(),t,e.selection.getRng(),e.schema).map((n=>()=>n.fold(((e,t)=>n=>(e._selectionOverrides.hideFakeCaret(),Sh(e,t,Cn(n)),!0))(e,t),((e,t)=>n=>{const o=t?Ji.before(n):Ji.after(n);return e.selection.setRng(o.toRange()),!0})(e,t),(e=>t=>(e.selection.setRng(t.toRange()),!0))(e))))),(()=>I.some(k)))},Wx=e=>{const t=e.dom,n=e.selection,o=gb(e.getBody(),n.getNode());if(br(o)&&t.isBlock(o)&&t.isEmpty(o)){const e=t.create("br",{"data-mce-bogus":"1"});t.setHTML(o,""),o.appendChild(e),n.setRng(Ji.before(e).toRange())}return!0},Kx=(e,t)=>e.selection.isCollapsed()?qx(e,t):((e,t)=>{const n=e.selection.getNode();return vr(n)&&!yr(n)?Vx(e,n.parentNode).filter(vr).fold((()=>I.some((()=>{var n;n=Cn(e.getBody()),q(zo(n,".mce-offscreen-selection"),Eo),Sh(e,t,Cn(e.selection.getNode())),Fh(e)}))),(()=>I.some(k))):jx(e)?I.some((()=>{jh(e,e.selection.getRng(),Cn(e.getBody()))})):I.none()})(e,t),Yx=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=Ji.fromRangeStart(e.selection.getRng());return Iu(t,e.getBody(),n).filter((e=>t?Op(e):Bp(e))).bind((e=>cu(t?0:-1,e))).map((t=>()=>e.selection.select(t)))})(e,t):I.none(),Gx=dr,Xx=e=>Gx(e)&&e.data[0]===Ja,Zx=e=>Gx(e)&&e.data[e.data.length-1]===Ja,Qx=e=>{var t;return(null!==(t=e.ownerDocument)&&void 0!==t?t:document).createTextNode(Ja)},Jx=(e,t)=>e?(e=>{var t;if(Gx(e.previousSibling))return Zx(e.previousSibling)||e.previousSibling.appendData(Ja),e.previousSibling;if(Gx(e))return Xx(e)||e.insertData(0,Ja),e;{const n=Qx(e);return null===(t=e.parentNode)||void 0===t||t.insertBefore(n,e),n}})(t):(e=>{var t,n;if(Gx(e.nextSibling))return Xx(e.nextSibling)||e.nextSibling.insertData(0,Ja),e.nextSibling;if(Gx(e))return Zx(e)||e.appendData(Ja),e;{const o=Qx(e);return e.nextSibling?null===(t=e.parentNode)||void 0===t||t.insertBefore(o,e.nextSibling):null===(n=e.parentNode)||void 0===n||n.appendChild(o),o}})(t),eE=T(Jx,!0),tE=T(Jx,!1),nE=(e,t)=>dr(e.container())?Jx(t,e.container()):Jx(t,e.getNode()),oE=(e,t)=>{const n=t.get();return n&&e.container()===n&&si(n)},rE=(e,t)=>t.fold((t=>{zc(e.get());const n=eE(t);return e.set(n),I.some(Ji(n,n.length-1))}),(t=>$u(t).map((t=>{if(oE(t,e)){const t=e.get();return Ji(t,1)}{zc(e.get());const n=nE(t,!0);return e.set(n),Ji(n,1)}}))),(t=>Vu(t).map((t=>{if(oE(t,e)){const t=e.get();return Ji(t,t.length-1)}{zc(e.get());const n=nE(t,!1);return e.set(n),Ji(n,n.length-1)}}))),(t=>{zc(e.get());const n=tE(t);return e.set(n),I.some(Ji(n,1))})),sE=(e,t)=>{for(let n=0;nlu(t,e)||e,lE=(e,t,n)=>{const o=Bh(n),r=iE(t,o.container());return Th(e,r,o).fold((()=>ju(r,o).bind(T(Th,e,r)).map((e=>aE.before(e)))),I.none)},dE=(e,t)=>null===Ku(e,t),cE=(e,t,n)=>Th(e,t,n).filter(T(dE,t)),uE=(e,t,n)=>{const o=Ph(n);return cE(e,t,o).bind((e=>Hu(e,o).isNone()?I.some(aE.start(e)):I.none()))},mE=(e,t,n)=>{const o=Bh(n);return cE(e,t,o).bind((e=>ju(e,o).isNone()?I.some(aE.end(e)):I.none()))},fE=(e,t,n)=>{const o=Ph(n),r=iE(t,o.container());return Th(e,r,o).fold((()=>Hu(r,o).bind(T(Th,e,r)).map((e=>aE.after(e)))),I.none)},gE=e=>!Ah(hE(e)),pE=(e,t,n)=>sE([lE,uE,mE,fE],[e,t,n]).filter(gE),hE=e=>e.fold(R,R,R,R),bE=e=>e.fold(N("before"),N("start"),N("end"),N("after")),vE=e=>e.fold(aE.before,aE.before,aE.after,aE.after),yE=e=>e.fold(aE.start,aE.start,aE.end,aE.end),CE=(e,t,n,o,r,s)=>It(Th(t,n,o),Th(t,n,r),((t,o)=>t!==o&&((e,t,n)=>{const o=lu(t,e),r=lu(n,e);return C(o)&&o===r})(n,t,o)?aE.after(e?t:o):s)).getOr(s),wE=(e,t)=>e.fold(M,(e=>{return o=t,!(bE(n=e)===bE(o)&&hE(n)===hE(o));var n,o})),xE=(e,t)=>e?t.fold(_(I.some,aE.start),I.none,_(I.some,aE.after),I.none):t.fold(I.none,_(I.some,aE.before),I.none,_(I.some,aE.end)),EE=(e,t,n)=>{const o=e?1:-1;return t.setRng(Ji(n.container(),n.offset()+o).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0};var kE;!function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"}(kE||(kE={}));const _E=(e,t)=>e===xu.Backwards?oe(t):t,SE=(e,t,n)=>e===xu.Forwards?t.next(n):t.prev(n),NE=(e,t,n,o)=>pr(o.getNode(t===xu.Forwards))?kE.Br:!1===du(n,o)?kE.Block:kE.Wrap,RE=(e,t,n,o)=>{const r=Pu(n);let s=o;const a=[];for(;s;){const n=SE(t,r,s);if(!n)break;if(pr(n.getNode(!1)))return t===xu.Forwards?{positions:_E(t,a).concat([n]),breakType:kE.Br,breakAt:I.some(n)}:{positions:_E(t,a),breakType:kE.Br,breakAt:I.some(n)};if(n.isVisible()){if(e(s,n)){const e=NE(0,t,s,n);return{positions:_E(t,a),breakType:e,breakAt:I.some(n)}}a.push(n),s=n}else s=n}return{positions:_E(t,a),breakType:kE.Eol,breakAt:I.none()}},AE=(e,t,n,o)=>t(n,o).breakAt.map((o=>{const r=t(n,o).positions;return e===xu.Backwards?r.concat(o):[o].concat(r)})).getOr([]),TE=(e,t)=>X(e,((e,n)=>e.fold((()=>I.some(n)),(o=>It(le(o.getClientRects()),le(n.getClientRects()),((e,r)=>{const s=Math.abs(t-e.left);return Math.abs(t-r.left)<=s?n:o})).or(e)))),I.none()),OE=(e,t)=>le(t.getClientRects()).bind((t=>TE(e,t.left))),BE=T(RE,Ji.isAbove,-1),PE=T(RE,Ji.isBelow,1),DE=T(AE,-1,BE),LE=T(AE,1,PE),ME=(e,t)=>BE(e,t).breakAt.isNone(),IE=(e,t)=>PE(e,t).breakAt.isNone(),FE=(e,t)=>OE(DE(e,t),t),UE=(e,t)=>OE(LE(e,t),t),zE=vr,jE=(e,t)=>Math.abs(e.left-t),HE=(e,t)=>Math.abs(e.right-t),$E=(e,t)=>Be(e,((e,n)=>{const o=Math.min(jE(e,t),HE(e,t)),r=Math.min(jE(n,t),HE(n,t));return r===o&&_e(n,"node")&&zE(n.node)||r{const t=t=>V(t,(t=>{const n=pi(t);return n.node=e,n}));if(er(e))return t(e.getClientRects());if(dr(e)){const n=e.ownerDocument.createRange();return n.setStart(e,0),n.setEnd(e,e.data.length),t(n.getClientRects())}return[]},qE=e=>te(e,VE);var WE;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(WE||(WE={}));const KE=(e,t,n,o,r,s)=>{let a=0;const i=[],l=o=>{let s=qE([o]);-1===e&&(s=s.reverse());for(let e=0;e0&&t(o,De(i))&&a++,o.line=a,r(o))return!0;i.push(o)}}return!1},d=De(s.getClientRects());if(!d)return i;const c=s.getNode();return c&&(l(c),((e,t,n,o)=>{let r=o;for(;r=iu(r,e,Li,t);)if(n(r))return})(e,o,l,c)),i},YE=T(KE,WE.Up,vi,yi),GE=T(KE,WE.Down,yi,vi),XE=e=>De(e.getClientRects()),ZE=e=>t=>((e,t)=>t.line>e)(e,t),QE=e=>t=>((e,t)=>t.line===e)(e,t),JE=(e,t)=>{e.selection.setRng(t),vg(e,e.selection.getRng())},ek=(e,t,n)=>I.some(Lx(e,t,n)),tk=(e,t,n,o,r,s)=>{const a=t===xu.Forwards,i=Pu(e.getBody()),l=T(Cu,a?i.next:i.prev),d=a?o:r;if(!n.collapsed){const o=wi(n);if(s(o))return Px(t,e,o,t===xu.Backwards,!1);if(jx(e)){const e=n.cloneRange();return e.collapse(t===xu.Backwards),I.from(e)}}const c=vu(t,e.getBody(),n);if(d(c))return Dx(e,c.getNode(!a));let u=l(c);const m=fi(n);if(!u)return m?I.some(n):I.none();if(u=Oh(a,u),d(u))return Px(t,e,u.getNode(!a),a,!1);const f=l(u);return f&&d(f)&&wu(u,f)?Px(t,e,f.getNode(!a),a,!1):m?ek(e,u.toRange(),!1):I.none()},nk=(e,t,n,o,r,s)=>{const a=vu(t,e.getBody(),n),i=De(a.getClientRects()),l=t===WE.Down,d=e.getBody();if(!i)return I.none();if(jx(e)){const e=l?Ji.fromRangeEnd(n):Ji.fromRangeStart(n);return(l?UE:FE)(d,e).orThunk((()=>I.from(e))).map((e=>e.toRange()))}const c=(l?GE:YE)(d,ZE(1),a),u=Y(c,QE(1)),m=i.left,f=$E(u,m);if(f&&s(f.node)){const n=Math.abs(m-f.left),o=Math.abs(m-f.right);return Px(t,e,f.node,n{const r=Pu(t);let s,a,i,l;const d=[];let c=0;1===e?(s=r.next,a=yi,i=vi,l=Ji.after(o)):(s=r.prev,a=vi,i=yi,l=Ji.before(o));const u=XE(l);do{if(!l.isVisible())continue;const e=XE(l);if(i(e,u))continue;d.length>0&&a(e,De(d))&&c++;const t=pi(e);if(t.position=l,t.line=c,n(t))return d;d.push(t)}while(l=s(l));return d})(t,d,ZE(1),g);let o=$E(Y(n,QE(1)),m);if(o)return ek(e,o.position.toRange(),!1);if(o=De(Y(n,QE(0))),o)return ek(e,o.position.toRange(),!1)}return 0===u.length?ok(e,l).filter(l?r:o).map((t=>Lx(e,t.toRange(),!1))):I.none()},ok=(e,t)=>{const n=e.selection.getRng(),o=t?Ji.fromRangeEnd(n):Ji.fromRangeStart(n),r=(s=o.container(),a=e.getBody(),Qn(Cn(s),(e=>Gc(e.dom)),(e=>e.dom===a)).map((e=>e.dom)).getOr(a));var s,a;if(t){const e=PE(r,o);return de(e.positions)}{const e=BE(r,o);return le(e.positions)}},rk=(e,t,n)=>ok(e,t).filter(n).exists((t=>(e.selection.setRng(t.toRange()),!0))),sk=(e,t)=>{const n=e.dom.createRng();n.setStart(t.container(),t.offset()),n.setEnd(t.container(),t.offset()),e.selection.setRng(n)},ak=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},ik=(e,t,n)=>rE(t,n).map((t=>(sk(e,t),n))),lk=(e,t,n)=>{const o=e.getBody(),r=((e,t,n)=>{const o=Ji.fromRangeStart(e);if(e.collapsed)return o;{const r=Ji.fromRangeEnd(e);return n?Hu(t,r).getOr(r):ju(t,o).getOr(o)}})(e.selection.getRng(),o,n);return((e,t,n,o)=>{const r=Oh(e,o),s=pE(t,n,r);return pE(t,n,r).bind(T(xE,e)).orThunk((()=>((e,t,n,o,r)=>{const s=Oh(e,r);return Iu(e,n,s).map(T(Oh,e)).fold((()=>o.map(vE)),(r=>pE(t,n,r).map(T(CE,e,t,n,s,r)).filter(T(wE,o)))).filter(gE)})(e,t,n,s,o)))})(n,T(Rh,e),o,r).bind((n=>ik(e,t,n)))},dk=(e,t,n)=>!!Rd(e)&&lk(e,t,n).isSome(),ck=(e,t,n)=>!!Rd(t)&&((e,t)=>{const n=t.selection.getRng(),o=e?Ji.fromRangeEnd(n):Ji.fromRangeStart(n);return!!(e=>w(e.selection.getSel().modify))(t)&&(e&&li(o)?EE(!0,t.selection,o):!(e||!di(o))&&EE(!1,t.selection,o))})(e,t),uk=e=>{const t=Br(null),n=T(Rh,e);return e.on("NodeChange",(o=>{Rd(e)&&(((e,t,n)=>{const o=V(zo(Cn(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),(e=>e.dom)),r=Y(o,e),s=Y(n,e);q(re(r,s),T(ak,!1)),q(re(s,r),T(ak,!0))})(n,e.dom,o.parents),((e,t)=>{const n=t.get();if(e.selection.isCollapsed()&&!e.composing&&n){const o=Ji.fromRangeStart(e.selection.getRng());Ji.isTextPosition(o)&&!(e=>li(e)||di(e))(o)&&(sk(e,Uc(n,o)),t.set(null))}})(e,t),((e,t,n,o)=>{if(t.selection.isCollapsed()){const r=Y(o,e);q(r,(o=>{const r=Ji.fromRangeStart(t.selection.getRng());pE(e,t.getBody(),r).bind((e=>ik(t,n,e)))}))}})(n,e,t,o.parents))})),t},mk=T(ck,!0),fk=T(ck,!1),gk=(e,t,n)=>{if(Rd(e)){const o=ok(e,t).getOrThunk((()=>{const n=e.selection.getRng();return t?Ji.fromRangeEnd(n):Ji.fromRangeStart(n)}));return pE(T(Rh,e),e.getBody(),o).exists((t=>{const o=vE(t);return rE(n,o).exists((t=>(sk(e,t),!0)))}))}return!1},pk=(e,t)=>n=>rE(t,n).map((t=>()=>sk(e,t))),hk=(e,t,n,o)=>{const r=e.getBody(),s=T(Rh,e);e.undoManager.ignore((()=>{e.selection.setRng(((e,t)=>{const n=document.createRange();return n.setStart(e.container(),e.offset()),n.setEnd(t.container(),t.offset()),n})(n,o)),Lh(e),pE(s,r,Ji.fromRangeStart(e.selection.getRng())).map(yE).bind(pk(e,t)).each(D)})),e.nodeChanged()},bk=(e,t,n)=>{if(e.selection.isCollapsed()&&Rd(e)){const o=Ji.fromRangeStart(e.selection.getRng());return((e,t,n,o)=>{const r=((e,t)=>lu(t,e)||e)(e.getBody(),o.container()),s=T(Rh,e),a=pE(s,r,o);return a.bind((e=>n?e.fold(N(I.some(yE(e))),I.none,N(I.some(vE(e))),I.none):e.fold(I.none,N(I.some(vE(e))),I.none,N(I.some(yE(e)))))).map(pk(e,t)).getOrThunk((()=>{const i=Fu(n,r,o),l=i.bind((e=>pE(s,r,e)));return It(a,l,(()=>Th(s,r,o).bind((t=>(e=>It($u(e),Vu(e),((t,n)=>{const o=Oh(!0,t),r=Oh(!1,n);return ju(e,o).forall((e=>e.isEqual(r)))})).getOr(!0))(t)?I.some((()=>{Sh(e,n,Cn(t))})):I.none())))).getOrThunk((()=>l.bind((()=>i.map((r=>()=>{n?hk(e,t,o,r):hk(e,t,r,o)}))))))}))})(e,t,n,o)}return I.none()},vk=(e,t)=>{const n=Cn(e.getBody()),o=Cn(e.selection.getStart()),r=zp(o,n);return J(r,t).fold(N(r),(e=>r.slice(0,e)))},yk=e=>1===jn(e),Ck=(e,t)=>{const n=T(sv,e);return te(t,(e=>n(e)?[e.dom]:[]))},wk=e=>{const t=(e=>vk(e,(t=>e.schema.isBlock($t(t)))))(e);return Ck(e,t)},xk=(e,t)=>{const n=Y((e=>vk(e,(t=>e.schema.isBlock($t(t))||(e=>jn(e)>1)(t))))(e),yk);return de(n).bind((o=>{const r=Ji.fromRangeStart(e.selection.getRng());return Uh(t,r,o.dom)&&!Hm(o)?I.some((()=>((e,t,n,o)=>{const r=Ck(t,o);if(0===r.length)Sh(t,e,n);else{const e=rv(n.dom,r);t.selection.setRng(e.toRange())}})(t,e,o,n))):I.none()}))},Ek=(e,t)=>{const n=e.selection.getStart(),o=((e,t)=>{const n=t.parentElement;return pr(t)&&!h(n)&&e.dom.isEmpty(n)})(e,n)||Hm(Cn(n))?rv(n,t):((e,t)=>{const{caretContainer:n,caretPosition:o}=ov(t);return e.insertNode(n.dom),o})(e.selection.getRng(),t);e.selection.setRng(o.toRange())},kk=e=>dr(e.startContainer),_k=e=>{const t=e.selection.getRng();return(e=>0===e.startOffset&&kk(e))(t)&&((e,t)=>{const n=t.startContainer.parentElement;return!h(n)&&sv(e,Cn(n))})(e,t)&&(e=>(e=>(e=>{const t=e.startContainer.parentNode,n=e.endContainer.parentNode;return!h(t)&&!h(n)&&t.isEqualNode(n)})(e)&&(e=>{const t=e.endContainer;return e.endOffset===(dr(t)?t.length:t.childNodes.length)})(e))(e)||(e=>!e.endContainer.isEqualNode(e.commonAncestorContainer))(e))(t)},Sk=(e,t)=>e.selection.isCollapsed()?xk(e,t):(e=>{if(_k(e)){const t=wk(e);return I.some((()=>{Lh(e),((e,t)=>{const n=re(t,wk(e));n.length>0&&Ek(e,n)})(e,t)}))}return I.none()})(e),Nk=e=>((e=>{const t=e.selection.getRng();return t.collapsed&&(kk(t)||e.dom.isEmpty(t.startContainer))&&!(e=>{return t=Cn(e.selection.getStart()),n=e.schema,jo(t,(e=>Wu(e.dom)),(e=>n.isBlock($t(e))));var t,n})(e)})(e)&&Ek(e,[]),!0),Rk=(e,t,n)=>C(n)?I.some((()=>{e._selectionOverrides.hideFakeCaret(),Sh(e,t,Cn(n))})):I.none(),Ak=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const n=t?Pp:Dp,o=t?xu.Forwards:xu.Backwards,r=vu(o,e.getBody(),e.selection.getRng());return n(r)?Rk(e,t,r.getNode(!t)):I.from(Oh(t,r)).filter((e=>n(e)&&wu(r,e))).bind((n=>Rk(e,t,n.getNode(!t))))})(e,t):((e,t)=>{const n=e.selection.getNode();return wr(n)?Rk(e,t,n):I.none()})(e,t),Tk=e=>Ze(null!=e?e:"").getOr(0),Ok=(e,t)=>(e||"table"===$t(t)?"margin":"padding")+("rtl"===uo(t,"direction")?"-right":"-left"),Bk=e=>{const t=Dk(e);return!e.mode.isReadOnly()&&(t.length>1||((e,t)=>ne(t,(t=>{const n=Ok(md(e),t),o=fo(t,n).map(Tk).getOr(0);return"false"!==e.dom.getContentEditable(t.dom)&&o>0})))(e,t))},Pk=e=>Wa(e)||Ka(e),Dk=e=>Y(_o(e.selection.getSelectedBlocks()),(e=>!Pk(e)&&!(e=>Tn(e).exists(Pk))(e)&&Jn(e,(e=>br(e.dom)||vr(e.dom))).exists((e=>br(e.dom))))),Lk=(e,t)=>{var n,o;const{dom:r}=e,s=fd(e),a=null!==(o=null===(n=/[a-z%]+$/i.exec(s))||void 0===n?void 0:n[0])&&void 0!==o?o:"px",i=Tk(s),l=md(e);q(Dk(e),(e=>{((e,t,n,o,r,s)=>{const a=Ok(n,Cn(s)),i=Tk(e.getStyle(s,a));if("outdent"===t){const t=Math.max(0,i-o);e.setStyle(s,a,t?t+r:"")}else{const t=i+o+r;e.setStyle(s,a,t)}})(r,t,l,i,a,e.dom)}))},Mk=e=>Lk(e,"outdent"),Ik=e=>{if(e.selection.isCollapsed()&&Bk(e)){const t=e.dom,n=e.selection.getRng(),o=Ji.fromRangeStart(n),r=t.getParent(n.startContainer,t.isBlock);if(null!==r&&qp(Cn(r),o,e.schema))return I.some((()=>Mk(e)))}return I.none()},Fk=(e,t,n)=>ue([Ik,Kx,Ux,(e,n)=>bk(e,t,n),Ax,fb,Yx,Ak,Bx,Sk],(t=>t(e,n))).filter((t=>e.selection.isEditable())),Uk=(e,t)=>{e.addCommand("delete",(()=>{((e,t)=>{Fk(e,t,!1).fold((()=>{e.selection.isEditable()&&(Lh(e),Fh(e))}),D)})(e,t)})),e.addCommand("forwardDelete",(()=>{((e,t)=>{Fk(e,t,!0).fold((()=>{e.selection.isEditable()&&(e=>{Dh(e,"ForwardDelete")})(e)}),D)})(e,t)}))},zk=e=>void 0===e.touches||1!==e.touches.length?I.none():I.some(e.touches[0]),jk=(e,t)=>ke(e,t.nodeName),Hk=(e,t)=>!!dr(t)||!!er(t)&&!(jk(e.getBlockElements(),t)||sm(t)||Zr(e,t)||Ir(t)),$k=(e,t)=>{if(dr(t)){if(0===t.data.length)return!0;if(/^\s+$/.test(t.data))return!t.nextSibling||jk(e,t.nextSibling)||Ir(t.nextSibling)}return!1},Vk=e=>e.dom.create(Wl(e),Kl(e)),qk=e=>{const t=e.dom,n=e.selection,o=e.schema,r=o.getBlockElements(),s=n.getStart(),a=e.getBody();let i,l,d=!1;const c=Wl(e);if(!s||!er(s))return;const u=a.nodeName.toLowerCase();if(!o.isValidChild(u,c.toLowerCase())||((e,t,n)=>$(Up(Cn(n),Cn(t)),(t=>jk(e,t.dom))))(r,a,s))return;const m=n.getRng(),{startContainer:f,startOffset:g,endContainer:p,endOffset:h}=m,b=jg(e);let v=a.firstChild;for(;v;)if(er(v)&&Kr(o,v),Hk(o,v)){if($k(r,v)){l=v,v=v.nextSibling,t.remove(l);continue}i||(i=Vk(e),a.insertBefore(i,v),d=!0),l=v,v=v.nextSibling,i.appendChild(l)}else i=null,v=v.nextSibling;d&&b&&(m.setStart(f,g),m.setEnd(p,h),n.setRng(m),e.nodeChanged())},Wk=(e,t,n)=>{const o=Cn(Vk(e)),r=Za();yo(o,r),n(t,o);const s=document.createRange();return s.setStartBefore(r.dom),s.setEndBefore(r.dom),s},Kk=e=>t=>-1!==(" "+t.attr("class")+" ").indexOf(e),Yk=(e,t,n)=>function(o){const r=arguments,s=r[r.length-2],a=s>0?t.charAt(s-1):"";if('"'===a)return o;if(">"===a){const e=t.lastIndexOf("<",s);if(-1!==e&&-1!==t.substring(e,s).indexOf('contenteditable="false"'))return o}return''+e.dom.encode("string"==typeof r[1]?r[1]:r[0])+""},Gk=(e,t)=>{t.hasAttribute("data-mce-caret")&&(mi(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},Xk=(e,t)=>{const n=(e=>no(Cn(e.getBody()),"*[data-mce-caret]").map((e=>e.dom)).getOrNull())(e);if(n)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void Gk(e,n)):void(ii(n)&&(Gk(e,n),e.undoManager.add()))},Zk=vr,Qk=(e,t,n)=>{const o=Pu(e.getBody()),r=T(Cu,1===t?o.next:o.prev);if(n.collapsed){const o=e.dom.getParent(n.startContainer,"PRE");if(!o)return;if(!r(Ji.fromRangeStart(n))){const n=Cn((e=>{const t=e.dom.create(Wl(e));return t.innerHTML='
',t})(e));1===t?bo(Cn(o),n):ho(Cn(o),n),e.selection.select(n.dom,!0),e.selection.collapse()}}},Jk=(e,t)=>((e,t)=>{const n=t?xu.Forwards:xu.Backwards,o=e.selection.getRng();return((e,t,n)=>tk(t,e,n,Ip,Fp,Zk))(n,e,o).orThunk((()=>(Qk(e,n,o),I.none())))})(e,((e,t)=>{const n=t?e.getEnd(!0):e.getStart(!0);return Ah(n)?!t:t})(e.selection,t)).exists((t=>(JE(e,t),!0))),e_=(e,t)=>((e,t)=>{const n=t?1:-1,o=e.selection.getRng();return((e,t,n)=>nk(t,e,n,(e=>Ip(e)||Lp(e)),(e=>Fp(e)||Mp(e)),Zk))(n,e,o).orThunk((()=>(Qk(e,n,o),I.none())))})(e,t).exists((t=>(JE(e,t),!0))),t_=(e,t)=>rk(e,t,t?Fp:Ip),n_=(e,t)=>zx(e,!t).map((n=>{const o=n.toRange(),r=e.selection.getRng();return t?o.setStart(r.startContainer,r.startOffset):o.setEnd(r.endContainer,r.endOffset),o})).exists((t=>(JE(e,t),!0))),o_=e=>H(["figcaption"],$t(e)),r_=(e,t)=>!!e.selection.isCollapsed()&&((e,t)=>{const n=Cn(e.getBody()),o=Ji.fromRangeStart(e.selection.getRng());return((e,t,n)=>{const o=T(_n,t);return Jn(Cn(e.container()),(e=>n.isBlock($t(e))),o).filter(o_)})(o,n,e.schema).exists((()=>{if(((e,t,n)=>t?IE(e.dom,n):ME(e.dom,n))(n,t,o)){const o=Wk(e,n,t?yo:vo);return e.selection.setRng(o),!0}return!1}))})(e,t),s_=(e,t)=>((e,t)=>t?I.from(e.dom.getParent(e.selection.getNode(),"details")).map((t=>((e,t)=>{const n=e.selection.getRng(),o=Ji.fromRangeStart(n);return!(e.getBody().lastChild!==t||!IE(t,o)||(e.execCommand("InsertNewBlockAfter"),0))})(e,t))).getOr(!1):I.from(e.dom.getParent(e.selection.getNode(),"summary")).bind((t=>I.from(e.dom.getParent(t,"details")).map((n=>((e,t,n)=>{const o=e.selection.getRng(),r=Ji.fromRangeStart(o);return!(e.getBody().firstChild!==t||!ME(n,r)||(e.execCommand("InsertNewBlockBefore"),0))})(e,n,t))))).getOr(!1))(e,t),a_={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},i_=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,l_=(e,...t)=>()=>e.apply(null,t),d_=(e,t)=>Q(((e,t)=>te((e=>V(e,(e=>({...a_,...e}))))(e),(e=>i_(e,t)?[e]:[])))(e,t),(e=>e.action())),c_=(e,t)=>ue(((e,t)=>te((e=>V(e,(e=>({...a_,...e}))))(e),(e=>i_(e,t)?[e]:[])))(e,t),(e=>e.action())),u_=(e,t)=>{const n=t?xu.Forwards:xu.Backwards,o=e.selection.getRng();return tk(e,n,o,Pp,Dp,wr).exists((t=>(JE(e,t),!0)))},m_=(e,t)=>{const n=t?1:-1,o=e.selection.getRng();return nk(e,n,o,Pp,Dp,wr).exists((t=>(JE(e,t),!0)))},f_=(e,t)=>rk(e,t,t?Dp:Pp),g_=kl([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),p_={...g_,none:e=>g_.none(e)},h_=(e,t,n)=>te(In(e),(e=>En(e,t)?n(e)?[e]:[]:h_(e,t,n))),b_=(e,t)=>oo(e,"table",t),v_=(e,t,n,o,r=M)=>{const s=1===o;if(!s&&n<=0)return p_.first(e[0]);if(s&&n>=e.length-1)return p_.last(e[e.length-1]);{const s=n+o,a=e[s];return r(a)?p_.middle(t,a):v_(e,t,s,o,r)}},y_=(e,t)=>b_(e,t).bind((t=>{const n=h_(t,"th,td",M);return J(n,(t=>_n(e,t))).map((e=>({index:e,all:n})))})),C_=["img","br"],w_=e=>{return(t=e,ja.getOption(t)).filter((e=>0!==e.trim().length||e.indexOf(Wo)>-1)).isSome()||H(C_,$t(e))||(e=>Wt(e)&&"false"===tn(e,"contenteditable"))(e);var t},x_=(e,t,n,o,r)=>{const s=zo(Cn(n),"td,th,caption").map((e=>e.dom)),a=Y(((e,t)=>te(t,(t=>{const n=((e,t)=>({left:e.left-t,top:e.top-t,right:e.right+-2,bottom:e.bottom+-2,width:e.width+t,height:e.height+t}))(pi(t.getBoundingClientRect()),-1);return[{x:n.left,y:e(n),cell:t},{x:n.right,y:e(n),cell:t}]})))(e,s),(e=>t(e,r)));return((e,t,n)=>X(e,((e,o)=>e.fold((()=>I.some(o)),(e=>{const r=Math.sqrt(Math.abs(e.x-t)+Math.abs(e.y-n)),s=Math.sqrt(Math.abs(o.x-t)+Math.abs(o.y-n));return I.some(se.cell))},E_=T(x_,(e=>e.bottom),((e,t)=>e.ye.top),((e,t)=>e.y>t)),__=(e,t,n)=>{const o=e(t,n);return(e=>e.breakType===kE.Wrap&&0===e.positions.length)(o)||!pr(n.getNode())&&(e=>e.breakType===kE.Br&&1===e.positions.length)(o)?!((e,t,n)=>n.breakAt.exists((n=>e(t,n).breakAt.isSome())))(e,t,o):o.breakAt.isNone()},S_=T(__,BE),N_=T(__,PE),R_=(e,t,n,o)=>{const r=e.selection.getRng(),s=t?1:-1;return!(!Wc()||!((e,t,n)=>{const o=Ji.fromRangeStart(t);return zu(!e,n).exists((e=>e.isEqual(o)))})(t,r,n)||(Px(s,e,n,!t,!1).each((t=>{JE(e,t)})),0))},A_=(e,t,n)=>{const o=((e,t)=>{const n=t.getNode(e);return ar(n)?I.some(n):I.none()})(!!t,n),r=!1===t;o.fold((()=>JE(e,n.toRange())),(o=>zu(r,e.getBody()).filter((e=>e.isEqual(n))).fold((()=>JE(e,n.toRange())),(n=>((e,t,n)=>{t.undoManager.transact((()=>{const o=e?bo:ho,r=Wk(t,Cn(n),o);JE(t,r)}))})(t,e,o)))))},T_=(e,t,n,o)=>{const r=e.selection.getRng(),s=Ji.fromRangeStart(r),a=e.getBody();if(!t&&S_(o,s)){const o=((e,t,n)=>((e,t)=>le(t.getClientRects()).bind((t=>E_(e,t.left,t.top))).bind((e=>{return OE(Vu(n=e).map((e=>BE(n,e).positions.concat(e))).getOr([]),t);var n})))(t,n).orThunk((()=>le(n.getClientRects()).bind((n=>TE(DE(e,Ji.before(t)),n.left))))).getOr(Ji.before(t)))(a,n,s);return A_(e,t,o),!0}if(t&&N_(o,s)){const o=((e,t,n)=>((e,t)=>de(t.getClientRects()).bind((t=>k_(e,t.left,t.top))).bind((e=>{return OE($u(n=e).map((e=>[e].concat(PE(n,e).positions))).getOr([]),t);var n})))(t,n).orThunk((()=>le(n.getClientRects()).bind((n=>TE(LE(e,Ji.after(t)),n.left))))).getOr(Ji.after(t)))(a,n,s);return A_(e,t,o),!0}return!1},O_=(e,t,n)=>I.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind((o=>I.from(e.dom.getParent(o,"table")).map((r=>n(e,t,r,o))))).getOr(!1),B_=(e,t)=>O_(e,t,R_),P_=(e,t)=>O_(e,t,T_),D_=(e,t,n)=>n.fold(I.none,I.none,((e,t)=>{return(n=t,eo(n,w_)).map((e=>(e=>{const t=Lf.exact(e,0,e,0);return zf(t)})(e)));var n}),(n=>(e.execCommand("mceTableInsertRowAfter"),L_(e,t,n)))),L_=(e,t,n)=>{return D_(e,t,(r=ro,y_(o=n,void 0).fold((()=>p_.none(o)),(e=>v_(e.all,o,e.index,1,r)))));var o,r},M_=(e,t,n)=>{return D_(e,t,(r=ro,y_(o=n,void 0).fold((()=>p_.none()),(e=>v_(e.all,o,e.index,-1,r)))));var o,r},I_=(e,t)=>{const n=["table","li","dl"],o=Cn(e.getBody()),r=e=>{const t=$t(e);return _n(e,o)||H(n,t)},s=e.selection.getRng();return((e,t)=>((e,t,n=L)=>n(t)?I.none():H(e,$t(t))?I.some(t):to(t,e.join(","),(e=>En(e,"table")||n(e))))(["td","th"],e,t))(Cn(t?s.endContainer:s.startContainer),r).map((n=>(b_(n,r).each((t=>{e.model.table.clearSelectedCells(t.dom)})),e.selection.collapse(!t),(t?L_:M_)(e,r,n).each((t=>{e.selection.setRng(t)})),!0))).getOr(!1)},F_=(e,t)=>({container:e,offset:t}),U_=fa.DOM,z_=e=>t=>e===t?-1:0,j_=(e,t,n)=>{if(dr(e)&&t>=0)return I.some(F_(e,t));{const o=za(U_);return I.from(o.backwards(e,t,z_(e),n)).map((e=>F_(e.container,e.container.data.length)))}},H_=(e,t,n)=>{if(!dr(e))return I.none();const o=e.data;if(t>=0&&t<=o.length)return I.some(F_(e,t));{const o=za(U_);return I.from(o.backwards(e,t,z_(e),n)).bind((e=>{const o=e.container.data;return H_(e.container,t+o.length,n)}))}},$_=(e,t,n)=>{if(!dr(e))return I.none();const o=e.data;if(t<=o.length)return I.some(F_(e,t));{const r=za(U_);return I.from(r.forwards(e,t,z_(e),n)).bind((e=>$_(e.container,t-o.length,n)))}},V_=(e,t,n,o,r)=>{const s=za(e,(e=>t=>e.isBlock(t)||H(["BR","IMG","HR","INPUT"],t.nodeName)||"false"===e.getContentEditable(t))(e));return I.from(s.backwards(t,n,o,r))},q_=e=>""!==e&&-1!==" \xa0\f\n\r\t\v".indexOf(e),W_=(e,t)=>e.substring(t.length),K_=(e,t,n,o=!1)=>{if(!(r=t).collapsed||!dr(r.startContainer))return I.none();var r;const s={text:"",offset:0},a=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return V_(e,t.startContainer,t.startOffset,((e,t,r)=>(s.text=r+s.text,s.offset+=t,((e,t,n,o=!1)=>{let r;const s=n.charAt(0);for(r=t-1;r>=0;r--){const a=e.charAt(r);if(!o&&q_(a))return I.none();if(s===a&&He(e,n,r,t))break}return I.some(r)})(s.text,s.offset,n,o).getOr(t))),a).bind((e=>{const o=t.cloneRange();if(o.setStart(e.container,e.offset),o.setEnd(t.endContainer,t.endOffset),o.collapsed)return I.none();const r=(e=>ti(e.toString().replace(/\u00A0/g," ")))(o);return 0!==r.lastIndexOf(n)?I.none():I.some({text:W_(r,n),range:o,trigger:n})}))},Y_=e=>{if((e=>3===e.nodeType)(e))return F_(e,e.data.length);{const t=e.childNodes;return t.length>0?Y_(t[t.length-1]):F_(e,t.length)}},G_=(e,t)=>{const n=e.childNodes;return n.length>0&&t0&&(e=>1===e.nodeType)(e)&&n.length===t?Y_(n[n.length-1]):F_(e,t)},X_=(e,t,n,o={})=>{var r;const s=t(),a=null!==(r=e.selection.getRng().startContainer.nodeValue)&&void 0!==r?r:"",i=Y(s.lookupByTrigger(n.trigger),(t=>n.text.length>=t.minChars&&t.matches.getOrThunk((()=>(e=>t=>{const n=G_(t.startContainer,t.startOffset);return!((e,t)=>{var n;const o=null!==(n=e.getParent(t.container,e.isBlock))&&void 0!==n?n:e.getRoot();return V_(e,t.container,t.offset,((e,t)=>0===t?-1:t),o).filter((e=>{const t=e.container.data.charAt(e.offset-1);return!q_(t)})).isSome()})(e,n)})(e.dom)))(n.range,a,n.text)));if(0===i.length)return I.none();const l=Promise.all(V(i,(e=>e.fetch(n.text,e.maxResults,o).then((t=>({matchText:n.text,items:t,columns:e.columns,onAction:e.onAction,highlightOn:e.highlightOn}))))));return I.some({lookupData:l,context:n})};var Z_;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(Z_||(Z_={}));const Q_=(e,t,n)=>e.stype===Z_.Error?t(e.serror):n(e.svalue),J_=e=>({stype:Z_.Value,svalue:e}),eS=e=>({stype:Z_.Error,serror:e}),tS=Q_,nS=e=>f(e)&&fe(e).length>100?" removed due to size":JSON.stringify(e,null,2),oS=(e,t)=>eS([{path:e,getErrorInfo:t}]),rS=(e,t)=>({extract:(n,o)=>Ee(o,e).fold((()=>((e,t)=>oS(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(n,e)),(e=>((e,t,n,o)=>Ee(n,o).fold((()=>((e,t,n)=>oS(e,(()=>'The chosen schema: "'+n+'" did not exist in branches: '+nS(t))))(e,n,o)),(n=>n.extract(e.concat(["branch: "+o]),t))))(n,o,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+fe(t)}),sS=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const n={};for(let o=0;og(e)&&g(t)?aS(e,t):t)),iS=(sS(((e,t)=>t)),e=>({tag:"defaultedThunk",process:N(e)})),lS=e=>{const t=(e=>{const t=[],n=[];return q(e,(e=>{Q_(e,(e=>n.push(e)),(e=>t.push(e)))})),{values:t,errors:n}})(e);return t.errors.length>0?(n=t.errors,_(eS,ee)(n)):J_(t.values);var n},dS=(e,t,n)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return n(e.newKey,e.instantiator)}},cS=e=>({extract:(t,n)=>{return o=e(n),r=e=>((e,t)=>oS(e,N(t)))(t,e),o.stype===Z_.Error?r(o.serror):o;var o,r},toString:N("val")}),uS=cS(J_),mS=(e,t,n,o)=>o(Ee(e,t).getOrThunk((()=>n(e)))),fS=(e,t,n,o,r)=>{const s=e=>r.extract(t.concat([o]),e),a=e=>e.fold((()=>J_(I.none())),(e=>{const n=r.extract(t.concat([o]),e);return s=n,a=I.some,s.stype===Z_.Value?{stype:Z_.Value,svalue:a(s.svalue)}:s;var s,a}));switch(e.tag){case"required":return((e,t,n,o)=>Ee(t,n).fold((()=>((e,t,n)=>oS(e,(()=>'Could not find valid *required* value for "'+t+'" in '+nS(n))))(e,n,t)),o))(t,n,o,s);case"defaultedThunk":return mS(n,o,e.process,s);case"option":return((e,t,n)=>n(Ee(e,t)))(n,o,a);case"defaultedOptionThunk":return((e,t,n,o)=>o(Ee(e,t).map((t=>!0===t?n(e):t))))(n,o,e.process,a);case"mergeWithThunk":return mS(n,o,N({}),(t=>{const o=aS(e.process(n),t);return s(o)}))}},gS=e=>({extract:(t,n)=>((e,t,n)=>{const o={},r=[];for(const s of n)dS(s,((n,s,a,i)=>{const l=fS(a,e,t,n,i);tS(l,(e=>{r.push(...e)}),(e=>{o[s]=e}))}),((e,n)=>{o[e]=n(t)}));return r.length>0?eS(r):J_(o)})(t,n,e),toString:()=>{const t=V(e,(e=>dS(e,((e,t,n,o)=>e+" -> "+o.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),pS=e=>({extract:(t,n)=>{const o=V(n,((n,o)=>e.extract(t.concat(["["+o+"]"]),n)));return lS(o)},toString:()=>"array("+e.toString()+")"}),hS=(e,t,n)=>{return o=((e,t,n)=>((e,t)=>e.stype===Z_.Error?{stype:Z_.Error,serror:t(e.serror)}:e)(t.extract([e],n),(e=>({input:n,errors:e}))))(e,t,n),Q_(o,El.error,El.value);var o},bS=(e,t)=>rS(e,he(t,gS)),vS=N(uS),yS=(e,t)=>cS((n=>{const o=typeof n;return e(n)?J_(n):eS(`Expected type: ${t} but got: ${o}`)})),CS=yS(x,"number"),wS=yS(m,"string"),xS=yS(b,"boolean"),ES=yS(w,"function"),kS=(e,t,n,o)=>({tag:"field",key:e,newKey:t,presence:n,prop:o}),_S=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),SS=(e,t)=>kS(e,e,{tag:"required",process:{}},t),NS=e=>SS(e,wS),RS=e=>SS(e,ES),AS=(e,t)=>kS(e,e,{tag:"option",process:{}},t),TS=e=>AS(e,wS),OS=(e,t,n)=>kS(e,e,iS(t),n),BS=(e,t)=>OS(e,t,CS),PS=(e,t,n)=>OS(e,t,(e=>{return t=t=>H(e,t)?El.value(t):El.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`),cS((e=>t(e).fold(eS,J_)));var t})(n)),DS=(e,t)=>OS(e,t,xS),LS=(e,t)=>OS(e,t,ES),MS=NS("type"),IS=RS("fetch"),FS=RS("onAction"),US=LS("onSetup",(()=>k)),zS=TS("text"),jS=TS("icon"),HS=TS("tooltip"),$S=TS("label"),VS=DS("active",!1),qS=DS("enabled",!0),WS=DS("primary",!1),KS=e=>((e,t)=>OS("type",t,wS))(0,e),YS=gS([MS,NS("trigger"),BS("minChars",1),(1,((e,t)=>kS(e,e,iS(1),vS()))("columns")),BS("maxResults",10),("matches",AS("matches",ES)),IS,FS,(GS=wS,OS("highlightOn",[],pS(GS)))]);var GS;const XS=[qS,HS,jS,zS,US],ZS=[VS].concat(XS),QS=[LS("predicate",L),PS("scope","node",["node","editor"]),PS("position","selection",["node","selection","line"])],JS=XS.concat([KS("contextformbutton"),WS,FS,_S("original",R)]),eN=ZS.concat([KS("contextformbutton"),WS,FS,_S("original",R)]),tN=XS.concat([KS("contextformbutton")]),nN=ZS.concat([KS("contextformtogglebutton")]),oN=bS("type",{contextformbutton:JS,contextformtogglebutton:eN});gS([KS("contextform"),LS("initValue",N("")),$S,((e,t)=>kS(e,e,{tag:"required",process:{}},pS(t)))("commands",oN),AS("launch",bS("type",{contextformbutton:tN,contextformtogglebutton:nN}))].concat(QS));const rN=e=>{const t=e.ui.registry.getAll().popups,n=he(t,(e=>{return(t=e,hS("Autocompleter",YS,t)).fold((e=>{throw new Error("Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:N("... (only showing first ten failures)")}]):e;return V(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})((t=e).errors).join("\n")+"\n\nInput object: "+nS(t.input));var t}),R);var t})),o=Se(we(n,(e=>e.trigger))),r=xe(n);return{dataset:n,triggers:o,lookupByTrigger:e=>Y(r,(t=>t.trigger===e))}},sN=e=>{const t=Dr(),n=Br(!1),o=t.isSet,r=()=>{o()&&((e=>{e.dispatch("AutocompleterEnd")})(e),n.set(!1),t.clear())},s=Le((()=>rN(e))),a=a=>{(n=>t.get().map((t=>K_(e.dom,e.selection.getRng(),t.trigger,!0).bind((t=>X_(e,s,t,n))))).getOrThunk((()=>((e,t)=>{const n=t(),o=e.selection.getRng();return((e,t,n)=>ue(n.triggers,(n=>K_(e,t,n))))(e.dom,o,n).bind((n=>X_(e,t,n)))})(e,s))))(a).fold(r,(r=>{(e=>{o()||t.set({trigger:e.trigger,matchLength:e.text.length})})(r.context),r.lookupData.then((o=>{t.get().map((s=>{const a=r.context;s.trigger===a.trigger&&(t.set({...s,matchLength:a.text.length}),n.get()?(vf(e,{range:a.range}),((e,t)=>{e.dispatch("AutocompleterUpdate",t)})(e,{lookupData:o})):(n.set(!0),vf(e,{range:a.range}),((e,t)=>{e.dispatch("AutocompleterStart",t)})(e,{lookupData:o})))}))}))}))},i=()=>t.get().bind((({trigger:t})=>{const o=e.selection.getRng();return K_(e.dom,o,t,n.get()).filter((({range:e})=>((e,t)=>{const n=e.compareBoundaryPoints(window.Range.START_TO_START,t),o=e.compareBoundaryPoints(window.Range.END_TO_END,t);return n>=0&&o<=0})(o,e))).map((({range:e})=>e))}));e.addCommand("mceAutocompleterReload",((e,t)=>{const n=f(t)?t.fetchOptions:{};a(n)})),e.addCommand("mceAutocompleterClose",r),e.addCommand("mceAutocompleterRefreshActiveRange",(()=>{i().each((t=>{vf(e,{range:t})}))})),e.editorCommands.addQueryStateHandler("mceAutoCompleterInRange",(()=>i().isSome())),((e,t)=>{const n=xa(t.load,50);e.on("input",(t=>{("insertCompositionText"!==t.inputType||e.composing)&&n.throttle()})),e.on("keydown",(e=>{const o=e.which;8===o?n.throttle():27===o?(n.cancel(),t.cancelIfNecessary()):38!==o&&40!==o||n.cancel()}),!0),e.on("remove",n.cancel)})(e,{cancelIfNecessary:r,load:a})},aN=Et().browser.isSafari(),iN=e=>Qa(Cn(e)),lN=(e,t)=>{var n;return 0===e.startOffset&&e.endOffset===(null===(n=t.textContent)||void 0===n?void 0:n.length)},dN=(e,t)=>I.from(e.getParent(t.container(),"details")),cN=(e,t)=>dN(e,t).isSome(),uN=(e,t)=>{const n=t.getNode();v(n)||e.selection.setCursorLocation(n,t.offset())},mN=(e,t,n)=>{const o=e.dom.getParent(t.container(),"details");if(o&&!o.open){const t=e.dom.select("summary",o)[0];t&&(n?$u(t):Vu(t)).each((t=>uN(e,t)))}else uN(e,t)},fN=(e,t,n)=>{const{dom:o,selection:r}=e,s=e.getBody();if("character"===n){const n=Ji.fromRangeStart(r.getRng()),a=o.getParent(n.container(),o.isBlock),i=dN(o,n),l=a&&o.isEmpty(a),d=h(null==a?void 0:a.previousSibling),c=h(null==a?void 0:a.nextSibling);return!!(l&&(t?c:d)&&Fu(!t,s,n).exists((e=>cN(o,e)&&!Mt(i,dN(o,e)))))||Fu(t,s,n).fold(L,(n=>{const r=dN(o,n);if(cN(o,n)&&!Mt(i,r)){if(t||mN(e,n,!1),a&&l){if(t&&d)return!0;if(!t&&c)return!0;mN(e,n,t),e.dom.remove(a)}return!0}return!1}))}return!1},gN=(e,t,n,o)=>{const r=e.selection.getRng(),s=Ji.fromRangeStart(r),a=e.getBody();return"selection"===o?((e,t)=>{const n=t.startSummary.exists((t=>t.contains(e.startContainer))),o=t.startSummary.exists((t=>t.contains(e.endContainer))),r=t.startDetails.forall((e=>t.endDetails.forall((t=>e!==t))));return(n||o)&&!(n&&o)||r})(r,t):n?((e,t)=>t.startSummary.exists((t=>((e,t)=>Vu(t).exists((n=>pr(n.getNode())&&Hu(t,n).exists((t=>t.isEqual(e)))||n.isEqual(e))))(e,t))))(s,t)||((e,t,n)=>n.startDetails.exists((n=>ju(e,t).forall((e=>!n.contains(e.container()))))))(a,s,t):((e,t)=>t.startSummary.exists((t=>((e,t)=>$u(t).exists((t=>t.isEqual(e))))(e,t))))(s,t)||((e,t)=>t.startDetails.exists((n=>Hu(n,e).forall((n=>t.startSummary.exists((t=>!t.contains(e.container())&&t.contains(n.container()))))))))(s,t)},pN=(e,t,n)=>((e,t,n)=>((e,t)=>{const n=I.from(e.getParent(t.startContainer,"details")),o=I.from(e.getParent(t.endContainer,"details"));if(n.isSome()||o.isSome()){const t=n.bind((t=>I.from(e.select("summary",t)[0])));return I.some({startSummary:t,startDetails:n,endDetails:o})}return I.none()})(e.dom,e.selection.getRng()).fold((()=>fN(e,t,n)),(o=>gN(e,o,t,n)||fN(e,t,n))))(e,t,n)||aN&&((e,t,n)=>{const o=e.selection,r=o.getNode(),s=o.getRng(),a=Ji.fromRangeStart(s);return!!kr(r)&&("selection"===n&&lN(s,r)||Uh(t,a,r)?iN(r):e.undoManager.transact((()=>{const s=o.getSel();let{anchorNode:a,anchorOffset:i,focusNode:l,focusOffset:d}=null!=s?s:{};const c=()=>{C(a)&&C(i)&&C(l)&&C(d)&&(null==s||s.setBaseAndExtent(a,i,l,d))},u=(e,t)=>{q(e.childNodes,(e=>{wm(e)&&t.appendChild(e)}))},m=e.dom.create("span",{"data-mce-bogus":"1"});u(r,m),r.appendChild(m),c(),"word"!==n&&"line"!==n||null==s||s.modify("extend",t?"right":"left",n),!o.isCollapsed()&&lN(o.getRng(),m)?iN(r):(e.execCommand(t?"ForwardDelete":"Delete"),a=null==s?void 0:s.anchorNode,i=null==s?void 0:s.anchorOffset,l=null==s?void 0:s.focusNode,d=null==s?void 0:s.focusOffset,u(m,r),c()),e.dom.remove(m)})),!0)})(e,t,n)?I.some(k):I.none(),hN=e=>(t,n,o={})=>{const r=t.getBody(),s={bubbles:!0,composed:!0,data:null,isComposing:!1,detail:0,view:null,target:r,currentTarget:r,eventPhase:Event.AT_TARGET,originalTarget:r,explicitOriginalTarget:r,isTrusted:!1,srcElement:r,cancelable:!1,preventDefault:k,inputType:n},a=Xs(new InputEvent(e));return t.dispatch(e,{...a,...s,...o})},bN=hN("input"),vN=hN("beforeinput"),yN=Et(),CN=yN.os,wN=CN.isMacOS()||CN.isiOS(),xN=yN.browser.isFirefox(),EN=(e,t)=>{const n=e.dom,o=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const e=(e=>{for(;e;){if(er(e)||dr(e)&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}return null})(t.firstChild);e&&/^(UL|OL|DL)$/.test(e.nodeName)&&t.insertBefore(n.doc.createTextNode(Wo),t.firstChild)}const r=n.createRng();if(t.normalize(),t.hasChildNodes()){const e=new Vo(t,t);let n,s=t;for(;n=e.current();){if(dr(n)){r.setStart(n,0),r.setEnd(n,0);break}if(o[n.nodeName.toLowerCase()]){r.setStartBefore(n),r.setEndBefore(n);break}s=n,n=e.next()}n||(r.setStart(s,0),r.setEnd(s,0))}else pr(t)?t.nextSibling&&n.isBlock(t.nextSibling)?(r.setStartBefore(t),r.setEndBefore(t)):(r.setStartAfter(t),r.setEndAfter(t)):(r.setStart(t,0),r.setEnd(t,0));e.selection.setRng(r),vg(e,r)},kN=(e,t)=>{const n=e.getRoot();let o,r=t;for(;r!==n&&r&&"false"!==e.getContentEditable(r);){if("true"===e.getContentEditable(r)){o=r;break}r=r.parentNode}return r!==n?o:n},_N=e=>I.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),SN=e=>{e.innerHTML='
'},NN=(e,t)=>{Wl(e).toLowerCase()===t.tagName.toLowerCase()&&((e,t,n)=>{const o=e.dom;I.from(n.style).map(o.parseStyle).each((e=>{const n={...go(Cn(t)),...e};o.setStyles(t,n)}));const r=I.from(n.class).map((e=>e.split(/\s+/))),s=I.from(t.className).map((e=>Y(e.split(/\s+/),(e=>""!==e))));It(r,s,((e,n)=>{const r=Y(n,(t=>!H(e,t))),s=[...e,...r];o.setAttrib(t,"class",s.join(" "))}));const a=["style","class"],i=Ce(n,((e,t)=>!H(a,t)));o.setAttribs(t,i)})(e,t,Kl(e))},RN=(e,t,n,o,r=!0,s,a)=>{const i=e.dom,l=e.schema,d=Wl(e),c=n?n.nodeName.toUpperCase():"";let u=t;const m=l.getTextInlineElements();let f;f=s||"TABLE"===c||"HR"===c?i.create(s||d,a||{}):n.cloneNode(!1);let g=f;if(r){do{if(m[u.nodeName]){if(Wu(u)||sm(u))continue;const e=u.cloneNode(!1);i.setAttrib(e,"id",""),f.hasChildNodes()?(e.appendChild(f.firstChild),f.appendChild(e)):(g=e,f.appendChild(e))}}while((u=u.parentNode)&&u!==o)}else i.setAttrib(f,"style",null),i.setAttrib(f,"class",null);return NN(e,f),SN(g),f},AN=(e,t)=>{const n=null==e?void 0:e.parentNode;return C(n)&&n.nodeName===t},TN=e=>C(e)&&/^(OL|UL|LI)$/.test(e.nodeName),ON=e=>C(e)&&/^(LI|DT|DD)$/.test(e.nodeName),BN=e=>{const t=e.parentNode;return ON(t)?t:e},PN=(e,t,n)=>{let o=e[n?"firstChild":"lastChild"];for(;o&&!er(o);)o=o[n?"nextSibling":"previousSibling"];return o===t},DN=e=>X(we(go(Cn(e)),((e,t)=>`${t}: ${e};`)),((e,t)=>e+t),""),LN=(e,t)=>t&&"A"===t.nodeName&&e.isEmpty(t),MN=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,IN=(e,t)=>C(t)&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&e.isEditable(t.parentNode)&&"false"!==e.getContentEditable(t),FN=(e,t,n)=>dr(t)?e?1===n&&t.data.charAt(n-1)===Ja?0:n:n===t.data.length-1&&t.data.charAt(n)===Ja?t.data.length:n:n,UN={insert:(e,t)=>{let n,o,r,s,a=!1;const i=e.dom,l=e.schema.getNonEmptyElements(),d=e.selection.getRng(),c=Wl(e),u=Cn(d.startContainer),f=Fn(u,d.startOffset),g=f.exists((e=>Wt(e)&&!ro(e))),p=d.collapsed&&g,b=(t,o)=>RN(e,n,_,k,Zl(e),t,o),v=e=>{const t=FN(e,n,o);if(dr(n)&&(e?t>0:t{let t;return t=/^(H[1-6]|PRE|FIGURE)$/.test(r)&&"HGROUP"!==S?b(c):b(),((e,t)=>{const n=Ql(e);return!y(t)&&(m(n)?H(Dt.explode(n),t.nodeName.toLowerCase()):n)})(e,s)&&IN(i,s)&&i.isEmpty(_,void 0,{includeZwsp:!0})?t=i.split(s,_):i.insertAfter(t,_),EN(e,t),t};Gf(i,d).each((e=>{d.setStart(e.startContainer,e.startOffset),d.setEnd(e.endContainer,e.endOffset)})),n=d.startContainer,o=d.startOffset;const x=!(!t||!t.shiftKey),E=!(!t||!t.ctrlKey);er(n)&&n.hasChildNodes()&&!p&&(a=o>n.childNodes.length-1,n=n.childNodes[Math.min(o,n.childNodes.length-1)]||n,o=a&&dr(n)?n.data.length:0);const k=kN(i,n);if(!k||((e,t)=>{const n=e.dom.getParent(t,"ol,ul,dl");return null!==n&&"false"===e.dom.getContentEditableParent(n)})(e,n))return;x||(n=((e,t,n,o,r)=>{var s,a;const i=e.dom,l=null!==(s=kN(i,o))&&void 0!==s?s:i.getRoot();let d=i.getParent(o,i.isBlock);if(!d||!IN(i,d)){if(d=d||l,!d.hasChildNodes()){const o=i.create(t);return NN(e,o),d.appendChild(o),n.setStart(o,0),n.setEnd(o,0),o}let s,c=o;for(;c&&c.parentNode!==d;)c=c.parentNode;for(;c&&!i.isBlock(c);)s=c,c=c.previousSibling;const u=null===(a=null==s?void 0:s.parentElement)||void 0===a?void 0:a.nodeName;if(s&&u&&e.schema.isValidChild(u,t.toLowerCase())){const a=s.parentNode,l=i.create(t);for(NN(e,l),a.insertBefore(l,s),c=s;c&&!i.isBlock(c);){const e=c.nextSibling;l.appendChild(c),c=e}n.setStart(o,r),n.setEnd(o,r)}}return o})(e,c,d,n,o));let _=i.getParent(n,i.isBlock)||i.getRoot();s=C(null==_?void 0:_.parentNode)?i.getParent(_.parentNode,i.isBlock):null,r=_?_.nodeName.toUpperCase():"";const S=s?s.nodeName.toUpperCase():"";if("LI"!==S||E||(_=s,s=s.parentNode,r=S),er(s)&&((e,t,n)=>!t&&n.nodeName.toLowerCase()===Wl(e)&&e.dom.isEmpty(n)&&((t,n,o)=>{let r=n;for(;r&&r!==t&&h(r.nextSibling);){const t=r.parentElement;if(!t||(s=t,!ke(e.schema.getTextBlockElements(),s.nodeName.toLowerCase())))return Er(t);r=t}var s;return!1})(e.getBody(),n))(e,x,_))return((e,t,n)=>{var o,r,s;const a=t(Wl(e)),i=((e,t)=>e.dom.getParent(t,Er))(e,n);i&&(e.dom.insertAfter(a,i),EN(e,a),(null!==(s=null===(r=null===(o=n.parentElement)||void 0===o?void 0:o.childNodes)||void 0===r?void 0:r.length)&&void 0!==s?s:0)>1&&e.dom.remove(n))})(e,b,_);if(/^(LI|DT|DD)$/.test(r)&&er(s)&&i.isEmpty(_))return void((e,t,n,o,r)=>{const s=e.dom,a=e.selection.getRng(),i=n.parentNode;if(n===e.getBody()||!i)return;var l;TN(l=n)&&TN(l.parentNode)&&(r="LI");const d=ON(o)?DN(o):void 0;let c=ON(o)&&d?t(r,{style:DN(o)}):t(r);if(PN(n,o,!0)&&PN(n,o,!1))if(AN(n,"LI")){const e=BN(n);s.insertAfter(c,e),(e=>{var t;return(null===(t=e.parentNode)||void 0===t?void 0:t.firstChild)===e})(n)?s.remove(e):s.remove(n)}else s.replace(c,n);else if(PN(n,o,!0))AN(n,"LI")?(s.insertAfter(c,BN(n)),c.appendChild(s.doc.createTextNode(" ")),c.appendChild(n)):i.insertBefore(c,n),s.remove(o);else if(PN(n,o,!1))s.insertAfter(c,BN(n)),s.remove(o);else{n=BN(n);const e=a.cloneRange();e.setStartAfter(o),e.setEndAfter(n);const t=e.extractContents();if("LI"===r&&((e,t)=>e.firstChild&&"LI"===e.firstChild.nodeName)(t)){const e=Y(V(c.children,Cn),O(Zt("br")));c=t.firstChild,s.insertAfter(t,n),q(e,(e=>vo(Cn(c),e))),d&&c.setAttribute("style",d)}else s.insertAfter(t,n),s.insertAfter(c,n);s.remove(o)}EN(e,c)})(e,b,s,_,c);if(!(p||_!==e.getBody()&&IN(i,_)))return;const N=_.parentNode;let R;if(p)R=b(c),f.fold((()=>{yo(u,Cn(R))}),(e=>{ho(e,Cn(R))})),e.selection.setCursorLocation(R,0);else if(ri(_))R=mi(_),i.isEmpty(_)&&SN(_),NN(e,R),EN(e,R);else if(v(!1))R=w();else if(v(!0)&&N){R=N.insertBefore(b(),_);const t=Cn(d.startContainer).dom.hasChildNodes()&&d.collapsed;EN(e,MN(_,"HR")||t?R:_)}else{const t=(e=>{const t=e.cloneRange();return t.setStart(e.startContainer,FN(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,FN(!1,e.endContainer,e.endOffset)),t})(d).cloneRange();t.setEndAfter(_);const n=t.extractContents();(e=>{q(Uo(Cn(e),Yt),(e=>{const t=e.dom;t.nodeValue=ti(t.data)}))})(n),(e=>{let t=e;do{dr(t)&&(t.data=t.data.replace(/^[\r\n]+/,"")),t=t.firstChild}while(t)})(n),R=n.firstChild,i.insertAfter(n,_),((e,t,n)=>{var o;const r=[];if(!n)return;let s=n;for(;s=s.firstChild;){if(e.isBlock(s))return;er(s)&&!t[s.nodeName.toLowerCase()]&&r.push(s)}let a=r.length;for(;a--;)s=r[a],(!s.hasChildNodes()||s.firstChild===s.lastChild&&""===(null===(o=s.firstChild)||void 0===o?void 0:o.nodeValue)||LN(e,s))&&e.remove(s)})(i,l,R),((e,t)=>{t.normalize();const n=t.lastChild;(!n||er(n)&&/^(left|right)$/gi.test(e.getStyle(n,"float",!0)))&&e.add(t,"br")})(i,_),i.isEmpty(_)&&SN(_),R.normalize(),i.isEmpty(R)?(i.remove(R),w()):(NN(e,R),EN(e,R))}i.setAttrib(R,"id",""),e.dispatch("NewBlock",{newBlock:R})},fakeEventName:"insertParagraph"},zN=(e,t,n)=>{const o=e.dom.createRng();n?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)),e.selection.setRng(o),vg(e,o)},jN=(e,t)=>{const n=vn("br");ho(Cn(t),n),e.undoManager.add()},HN=(e,t)=>{$N(e.getBody(),t)||bo(Cn(t),vn("br"));const n=vn("br");bo(Cn(t),n),zN(e,n.dom,!1),e.undoManager.add()},$N=(e,t)=>{return n=Ji.after(t),!!pr(n.getNode())||ju(e,Ji.after(t)).map((e=>pr(e.getNode()))).getOr(!1);var n},VN=e=>e&&"A"===e.nodeName&&"href"in e,qN=e=>e.fold(L,VN,VN,L),WN=(e,t)=>{t.fold(k,T(jN,e),T(HN,e),k)},KN={insert:(e,t)=>{const n=(e=>{const t=T(Rh,e),n=Ji.fromRangeStart(e.selection.getRng());return pE(t,e.getBody(),n).filter(qN)})(e);n.isSome()?n.each(T(WN,e)):((e,t)=>{const n=e.selection,o=e.dom,r=n.getRng();let s,a=!1;Gf(o,r).each((e=>{r.setStart(e.startContainer,e.startOffset),r.setEnd(e.endContainer,e.endOffset)}));let i=r.startOffset,l=r.startContainer;if(er(l)&&l.hasChildNodes()){const e=i>l.childNodes.length-1;l=l.childNodes[Math.min(i,l.childNodes.length-1)]||l,i=e&&dr(l)?l.data.length:0}let d=o.getParent(l,o.isBlock);const c=d&&d.parentNode?o.getParent(d.parentNode,o.isBlock):null,u=c?c.nodeName.toUpperCase():"",m=!(!t||!t.ctrlKey);"LI"!==u||m||(d=c),dr(l)&&i>=l.data.length&&(((e,t,n)=>{const o=new Vo(t,n);let r;const s=e.getNonEmptyElements();for(;r=o.next();)if(s[r.nodeName.toLowerCase()]||dr(r)&&r.length>0)return!0;return!1})(e.schema,l,d||o.getRoot())||(s=o.create("br"),r.insertNode(s),r.setStartAfter(s),r.setEndAfter(s),a=!0)),s=o.create("br"),tl(o,r,s),zN(e,s,a),e.undoManager.add()})(e,t)},fakeEventName:"insertLineBreak"},YN=(e,t)=>_N(e).filter((e=>t.length>0&&En(Cn(e),t))).isSome(),GN=kl([{br:[]},{block:[]},{none:[]}]),XN=(e,t)=>(e=>YN(e,Xl(e)))(e),ZN=e=>(t,n)=>(e=>_N(e).filter((e=>Ka(Cn(e)))).isSome())(t)===e,QN=(e,t)=>(n,o)=>{const r=(e=>_N(e).fold(N(""),(e=>e.nodeName.toUpperCase())))(n)===e.toUpperCase();return r===t},JN=e=>{const t=kN(e.dom,e.selection.getStart());return y(t)},eR=e=>QN("pre",e),tR=e=>(t,n)=>ql(t)===e,nR=(e,t)=>(e=>YN(e,Gl(e)))(e),oR=(e,t)=>t,rR=e=>{const t=Wl(e),n=kN(e.dom,e.selection.getStart());return C(n)&&e.schema.isValidChild(n.nodeName,t)},sR=e=>{const t=e.selection.getRng(),n=Cn(t.startContainer),o=Fn(n,t.startOffset).map((e=>Wt(e)&&!ro(e)));return t.collapsed&&o.getOr(!0)},aR=(e,t)=>(n,o)=>X(e,((e,t)=>e&&t(n,o)),!0)?I.some(t):I.none(),iR=(e,t,n)=>{t.selection.isCollapsed()||(e=>{e.execCommand("delete")})(t),C(n)&&vN(t,e.fakeEventName).isDefaultPrevented()||(e.insert(t,n),C(n)&&bN(t,e.fakeEventName))},lR=(e,t)=>{const n=()=>iR(KN,e,t),o=()=>iR(UN,e,t),r=((e,t)=>sE([aR([XN],GN.none()),aR([eR(!0),JN],GN.none()),aR([QN("summary",!0)],GN.br()),aR([eR(!0),tR(!1),oR],GN.br()),aR([eR(!0),tR(!1)],GN.block()),aR([eR(!0),tR(!0),oR],GN.block()),aR([eR(!0),tR(!0)],GN.br()),aR([ZN(!0),oR],GN.br()),aR([ZN(!0)],GN.block()),aR([nR],GN.br()),aR([oR],GN.br()),aR([rR],GN.block()),aR([sR],GN.block())],[e,!(!t||!t.shiftKey)]).getOr(GN.none()))(e,t);switch(Yl(e)){case"linebreak":r.fold(n,n,k);break;case"block":r.fold(o,o,k);break;case"invert":r.fold(o,n,k);break;default:r.fold(n,o,k)}},dR=Et(),cR=dR.os.isiOS()&&dR.browser.isSafari(),uR=(e,t)=>{var n;t.isDefaultPrevented()||(t.preventDefault(),(n=e.undoManager).typing&&(n.typing=!1,n.add()),e.undoManager.transact((()=>{lR(e,t)})))},mR=Et(),fR=e=>e.stopImmediatePropagation(),gR=e=>e.keyCode===Cf.PAGE_UP||e.keyCode===Cf.PAGE_DOWN,pR=(e,t,n)=>{n&&!e.get()?t.on("NodeChange",fR,!0):!n&&e.get()&&t.off("NodeChange",fR),e.set(n)},hR=(e,t)=>{const n=t.container(),o=t.offset();return dr(n)?(n.insertData(o,e),I.some(Ji(n,o+e.length))):yu(t).map((n=>{const o=yn(e);return t.isAtEnd()?bo(n,o):ho(n,o),Ji(o.dom,e.length)}))},bR=T(hR,Wo),vR=T(hR," "),yR=e=>t=>{e.selection.setRng(t.toRange()),e.nodeChanged()},CR=e=>{const t=Ji.fromRangeStart(e.selection.getRng()),n=Cn(e.getBody());if(e.selection.isCollapsed()){const o=T(Rh,e),r=Ji.fromRangeStart(e.selection.getRng());return pE(o,e.getBody(),r).bind((e=>t=>t.fold((t=>Hu(e.dom,Ji.before(t))),(e=>$u(e)),(e=>Vu(e)),(t=>ju(e.dom,Ji.after(t)))))(n)).map((o=>()=>((e,t,n)=>o=>ih(e,o,n)?bR(t):vR(t))(n,t,e.schema)(o).each(yR(e))))}return I.none()},wR=e=>{return Ft(Tt.browser.isFirefox()&&e.selection.isEditable()&&(t=e.dom,n=e.selection.getRng().startContainer,t.isEditable(t.getParent(n,"summary"))),(()=>{const t=Cn(e.getBody());e.selection.isCollapsed()||e.getDoc().execCommand("Delete"),((e,t,n)=>ih(e,t,n)?bR(t):vR(t))(t,Ji.fromRangeStart(e.selection.getRng()),e.schema).each(yR(e))}));var t,n},xR=e=>_c(e)?[{keyCode:Cf.TAB,action:l_(I_,e,!0)},{keyCode:Cf.TAB,shiftKey:!0,action:l_(I_,e,!1)}]:[],ER=e=>{if(e.addShortcut("Meta+P","","mcePrint"),sN(e),rw(e))return Br(null);{const t=uk(e);return(e=>{e.on("beforeinput",(t=>{e.selection.isEditable()&&!$(t.getTargetRanges(),(t=>!Vg(e.dom,t)))||t.preventDefault()}))})(e),(e=>{e.on("keyup compositionstart",T(Xk,e))})(e),((e,t)=>{e.on("keydown",(n=>{n.isDefaultPrevented()||((e,t,n)=>{const o=Tt.os.isMacOS()||Tt.os.isiOS();d_([{keyCode:Cf.RIGHT,action:l_(Jk,e,!0)},{keyCode:Cf.LEFT,action:l_(Jk,e,!1)},{keyCode:Cf.UP,action:l_(e_,e,!1)},{keyCode:Cf.DOWN,action:l_(e_,e,!0)},...o?[{keyCode:Cf.UP,action:l_(n_,e,!1),metaKey:!0,shiftKey:!0},{keyCode:Cf.DOWN,action:l_(n_,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:Cf.RIGHT,action:l_(B_,e,!0)},{keyCode:Cf.LEFT,action:l_(B_,e,!1)},{keyCode:Cf.UP,action:l_(P_,e,!1)},{keyCode:Cf.DOWN,action:l_(P_,e,!0)},{keyCode:Cf.UP,action:l_(P_,e,!1)},{keyCode:Cf.UP,action:l_(s_,e,!1)},{keyCode:Cf.DOWN,action:l_(s_,e,!0)},{keyCode:Cf.RIGHT,action:l_(u_,e,!0)},{keyCode:Cf.LEFT,action:l_(u_,e,!1)},{keyCode:Cf.UP,action:l_(m_,e,!1)},{keyCode:Cf.DOWN,action:l_(m_,e,!0)},{keyCode:Cf.RIGHT,action:l_(dk,e,t,!0)},{keyCode:Cf.LEFT,action:l_(dk,e,t,!1)},{keyCode:Cf.RIGHT,ctrlKey:!o,altKey:o,action:l_(mk,e,t)},{keyCode:Cf.LEFT,ctrlKey:!o,altKey:o,action:l_(fk,e,t)},{keyCode:Cf.UP,action:l_(r_,e,!1)},{keyCode:Cf.DOWN,action:l_(r_,e,!0)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))})(e,t),((e,t)=>{let n=!1;e.on("keydown",(o=>{n=o.keyCode===Cf.BACKSPACE,o.isDefaultPrevented()||((e,t,n)=>{const o=n.keyCode===Cf.BACKSPACE?"deleteContentBackward":"deleteContentForward",r=e.selection.isCollapsed(),s=r?"character":"selection",a=e=>r?e?"word":"line":"selection";c_([{keyCode:Cf.BACKSPACE,action:l_(Ik,e)},{keyCode:Cf.BACKSPACE,action:l_(Kx,e,!1)},{keyCode:Cf.DELETE,action:l_(Kx,e,!0)},{keyCode:Cf.BACKSPACE,action:l_(Ux,e,!1)},{keyCode:Cf.DELETE,action:l_(Ux,e,!0)},{keyCode:Cf.BACKSPACE,action:l_(bk,e,t,!1)},{keyCode:Cf.DELETE,action:l_(bk,e,t,!0)},{keyCode:Cf.BACKSPACE,action:l_(fb,e,!1)},{keyCode:Cf.DELETE,action:l_(fb,e,!0)},{keyCode:Cf.BACKSPACE,action:l_(pN,e,!1,s)},{keyCode:Cf.DELETE,action:l_(pN,e,!0,s)},...wN?[{keyCode:Cf.BACKSPACE,altKey:!0,action:l_(pN,e,!1,a(!0))},{keyCode:Cf.DELETE,altKey:!0,action:l_(pN,e,!0,a(!0))},{keyCode:Cf.BACKSPACE,metaKey:!0,action:l_(pN,e,!1,a(!1))}]:[{keyCode:Cf.BACKSPACE,ctrlKey:!0,action:l_(pN,e,!1,a(!0))},{keyCode:Cf.DELETE,ctrlKey:!0,action:l_(pN,e,!0,a(!0))}],{keyCode:Cf.BACKSPACE,action:l_(Yx,e,!1)},{keyCode:Cf.DELETE,action:l_(Yx,e,!0)},{keyCode:Cf.BACKSPACE,action:l_(Ak,e,!1)},{keyCode:Cf.DELETE,action:l_(Ak,e,!0)},{keyCode:Cf.BACKSPACE,action:l_(Bx,e,!1)},{keyCode:Cf.DELETE,action:l_(Bx,e,!0)},{keyCode:Cf.BACKSPACE,action:l_(Ax,e,!1)},{keyCode:Cf.DELETE,action:l_(Ax,e,!0)},{keyCode:Cf.BACKSPACE,action:l_(Sk,e,!1)},{keyCode:Cf.DELETE,action:l_(Sk,e,!0)}],n).filter((t=>e.selection.isEditable())).each((t=>{n.preventDefault(),vN(e,o).isDefaultPrevented()||(t(),bN(e,o))}))})(e,t,o)})),e.on("keyup",(t=>{t.isDefaultPrevented()||((e,t,n)=>{d_([{keyCode:Cf.BACKSPACE,action:l_(Wx,e)},{keyCode:Cf.DELETE,action:l_(Wx,e)},...wN?[{keyCode:Cf.BACKSPACE,altKey:!0,action:l_(Nk,e)},{keyCode:Cf.DELETE,altKey:!0,action:l_(Nk,e)},...n?[{keyCode:xN?224:91,action:l_(Nk,e)}]:[]]:[{keyCode:Cf.BACKSPACE,ctrlKey:!0,action:l_(Nk,e)},{keyCode:Cf.DELETE,ctrlKey:!0,action:l_(Nk,e)}]],t)})(e,t,n),n=!1}))})(e,t),(e=>{let t=I.none();e.on("keydown",(n=>{n.keyCode===Cf.ENTER&&(cR&&(e=>{if(!e.collapsed)return!1;const t=e.startContainer;if(dr(t)){const n=/^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/,o=t.data.charAt(e.startOffset-1);return n.test(o)}return!1})(e.selection.getRng())?(e=>{t=I.some(e.selection.getBookmark()),e.undoManager.add()})(e):uR(e,n))})),e.on("keyup",(n=>{n.keyCode===Cf.ENTER&&t.each((()=>((e,n)=>{e.undoManager.undo(),t.fold(k,(t=>e.selection.moveToBookmark(t))),uR(e,n),t=I.none()})(e,n)))}))})(e),(e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{c_([{keyCode:Cf.SPACEBAR,action:l_(CR,e)},{keyCode:Cf.SPACEBAR,action:l_(wR,e)}],t).each((n=>{t.preventDefault(),vN(e,"insertText",{data:" "}).isDefaultPrevented()||(n(),bN(e,"insertText",{data:" "}))}))})(e,t)}))})(e),(e=>{e.on("input",(t=>{t.isComposing||(e=>{const t=Cn(e.getBody());e.selection.isCollapsed()&&ph(t,Ji.fromRangeStart(e.selection.getRng()),e.schema).each((t=>{e.selection.setRng(t.toRange())}))})(e)}))})(e),(e=>{e.on("keydown",(t=>{t.isDefaultPrevented()||((e,t)=>{d_([...xR(e)],t).each((e=>{t.preventDefault()}))})(e,t)}))})(e),((e,t)=>{e.on("keydown",(n=>{n.isDefaultPrevented()||((e,t,n)=>{const o=Tt.os.isMacOS()||Tt.os.isiOS();d_([{keyCode:Cf.END,action:l_(t_,e,!0)},{keyCode:Cf.HOME,action:l_(t_,e,!1)},...o?[]:[{keyCode:Cf.HOME,action:l_(n_,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:Cf.END,action:l_(n_,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:Cf.END,action:l_(f_,e,!0)},{keyCode:Cf.HOME,action:l_(f_,e,!1)},{keyCode:Cf.END,action:l_(gk,e,!0,t)},{keyCode:Cf.HOME,action:l_(gk,e,!1,t)}],n).each((e=>{n.preventDefault()}))})(e,t,n)}))})(e,t),((e,t)=>{if(mR.os.isMacOS())return;const n=Br(!1);e.on("keydown",(t=>{gR(t)&&pR(n,e,!0)})),e.on("keyup",(o=>{o.isDefaultPrevented()||((e,t,n)=>{d_([{keyCode:Cf.PAGE_UP,action:l_(gk,e,!1,t)},{keyCode:Cf.PAGE_DOWN,action:l_(gk,e,!0,t)}],n)})(e,t,o),gR(o)&&n.get()&&(pR(n,e,!1),e.nodeChanged())}))})(e,t),t}};class kR{constructor(e){let t;this.lastPath=[],this.editor=e;const n=this;"onselectionchange"in e.getDoc()||e.on("NodeChange click mouseup keyup focus",(n=>{const o=e.selection.getRng(),r={startContainer:o.startContainer,startOffset:o.startOffset,endContainer:o.endContainer,endOffset:o.endOffset};"nodechange"!==n.type&&Hf(r,t)||e.dispatch("SelectionChange"),t=r})),e.on("contextmenu",(()=>{Rg(e),e.dispatch("SelectionChange")})),e.on("SelectionChange",(()=>{const t=e.selection.getStart(!0);t&&vm(e)&&!n.isSameElementPath(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})})),e.on("mouseup",(t=>{!t.isDefaultPrevented()&&vm(e)&&("IMG"===e.selection.getNode().nodeName?Og.setEditorTimeout(e,(()=>{e.nodeChanged()})):e.nodeChanged())}))}nodeChanged(e={}){const t=this.editor.selection;let n;if(this.editor.initialized&&t&&!zd(this.editor)&&!this.editor.mode.isReadOnly()){const o=this.editor.getBody();n=t.getStart(!0)||o,n.ownerDocument===this.editor.getDoc()&&this.editor.dom.isChildOf(n,o)||(n=o);const r=[];this.editor.dom.getParent(n,(e=>e===o||(r.push(e),!1))),this.editor.dispatch("NodeChange",{...e,element:n,parents:r})}}isSameElementPath(e){let t;const n=this.editor,o=oe(n.dom.getParents(e,M,n.getBody()));if(o.length===this.lastPath.length){for(t=o.length;t>=0&&o[t]===this.lastPath[t];t--);if(-1===t)return this.lastPath=o,!0}return this.lastPath=o,!1}}const _R=La("image"),SR=La("event"),NR=e=>t=>{t[SR]=e},RR=NR(0),AR=NR(2),TR=NR(1),OR=(0,e=>{const t=e;return I.from(t[SR]).exists((e=>0===e))});const BR=La("mode"),PR=e=>t=>{t[BR]=e},DR=(e,t)=>PR(t)(e),LR=PR(0),MR=PR(2),IR=PR(1),FR=e=>t=>{const n=t;return I.from(n[BR]).exists((t=>t===e))},UR=FR(0),zR=FR(1),jR=["none","copy","link","move"],HR=["none","copy","copyLink","copyMove","link","linkMove","move","all","uninitialized"],$R=()=>{const e=new window.DataTransfer;let t="move",n="all";const o={get dropEffect(){return t},set dropEffect(e){H(jR,e)&&(t=e)},get effectAllowed(){return n},set effectAllowed(e){OR(o)&&H(HR,e)&&(n=e)},get items(){return((e,t)=>({...t,get length(){return t.length},add:(n,o)=>{if(UR(e)){if(!m(n))return t.add(n);if(!v(o))return t.add(n,o)}return null},remove:n=>{UR(e)&&t.remove(n)},clear:()=>{UR(e)&&t.clear()}}))(o,e.items)},get files(){return zR(o)?Object.freeze({length:0,item:e=>null}):e.files},get types(){return e.types},setDragImage:(t,n,r)=>{var s;UR(o)&&(s={image:t,x:n,y:r},o[_R]=s,e.setDragImage(t,n,r))},getData:t=>zR(o)?"":e.getData(t),setData:(t,n)=>{UR(o)&&e.setData(t,n)},clearData:t=>{UR(o)&&e.clearData(t)}};return LR(o),o},VR=(e,t)=>e.setData("text/html",t),qR="x-tinymce/html",WR=N(qR),KR="\x3c!-- "+qR+" --\x3e",YR=e=>KR+e,GR=e=>-1!==e.indexOf(KR),XR="%MCEPASTEBIN%",ZR=e=>e.dom.get("mcepastebin"),QR=e=>C(e)&&"mcepastebin"===e.id,JR=e=>e===XR,eA=(e,t)=>(Dt.each(t,(t=>{e=u(t,RegExp)?e.replace(t,""):e.replace(t[0],t[1])})),e),tA=e=>eA(e,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/|/g,[/( ?)\u00a0<\/span>( ?)/g,(e,t,n)=>t||n?Wo:" "],/
/g,/
$/i]),nA=(e,t)=>({content:e,cancelled:t}),oA=(e,t)=>(e.insertContent(t,{merge:cc(e),paste:!0}),!0),rA=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),sA=(e,t,n)=>!(e.selection.isCollapsed()||!rA(t))&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.execCommand("mceInsertLink",!1,t)})),!0))(e,t,n),aA=(e,t,n)=>!!((e,t)=>rA(t)&&$(kc(e),(e=>Ve(t.toLowerCase(),`.${e.toLowerCase()}`))))(e,t)&&((e,t,n)=>(e.undoManager.extra((()=>{n(e,t)}),(()=>{e.insertContent('')})),!0))(e,t,n),iA=(e=>{let t=0;return()=>"mceclip"+t++})(),lA=e=>{const t=$R();return VR(t,e),MR(t),t},dA=(e,t,n,o,r)=>{const s=((e,t,n)=>((e,t,n)=>{const o=((e,t,n)=>e.dispatch("PastePreProcess",{content:t,internal:n}))(e,t,n),r=((e,t)=>{const n=kC({sanitize:xc(e),sandbox_iframes:Rc(e),sandbox_iframes_exclusions:Ac(e),convert_unsafe_embeds:Tc(e)},e.schema);n.addNodeFilter("meta",(e=>{Dt.each(e,(e=>{e.remove()}))}));const o=n.parse(t,{forced_root_block:!1,isRootContent:!0});return yp({validate:!0},e.schema).serialize(o)})(e,o.content);return e.hasEventListeners("PastePostProcess")&&!o.isDefaultPrevented()?((e,t,n)=>{const o=e.dom.create("div",{style:"display:none"},t),r=((e,t,n)=>e.dispatch("PastePostProcess",{node:t,internal:n}))(e,o,n);return nA(r.node.innerHTML,r.isDefaultPrevented())})(e,r,n):nA(r,o.isDefaultPrevented())})(e,t,n))(e,t,n);if(!s.cancelled){const t=s.content,n=()=>((e,t,n)=>{n||!uc(e)?oA(e,t):((e,t)=>{Dt.each([sA,aA,oA],(n=>!n(e,t,oA)))})(e,t)})(e,t,o);r?vN(e,"insertFromPaste",{dataTransfer:lA(t)}).isDefaultPrevented()||(n(),bN(e,"insertFromPaste")):n()}},cA=(e,t,n,o)=>{const r=n||GR(t);dA(e,(e=>e.replace(KR,""))(t),r,!1,o)},uA=(e,t,n)=>{const o=e.dom.encode(t).replace(/\r\n/g,"\n"),r=((e,t,n)=>{const o=e.split(/\n\n/),r=((e,t)=>{let n="<"+e;const o=we(t,((e,t)=>t+'="'+ws.encodeAllRaw(e)+'"'));return o.length&&(n+=" "+o.join(" ")),n+">"})(t,n),s=""+t+">",a=V(o,(e=>e.split(/\n/).join("
")));return 1===a.length?a[0]:V(a,(e=>r+e+s)).join("")})(Zo(o,fc(e)),Wl(e),Kl(e));dA(e,r,!1,!0,n)},mA=e=>{const t={};if(e&&e.types)for(let n=0;nt in e&&e[t].length>0,gA=e=>fA(e,"text/html")||fA(e,"text/plain"),pA=(e,t,n)=>{const o="paste"===t.type?t.clipboardData:t.dataTransfer;var r;if(rc(e)&&o){const s=((e,t)=>{const n=t.items?te(ce(t.items),(e=>"file"===e.kind?[e.getAsFile()]:[])):[],o=t.files?ce(t.files):[];return Y(n.length>0?n:o,(e=>{const t=kc(e);return e=>$e(e.type,"image/")&&$(t,(t=>(e=>{const t=e.toLowerCase(),n={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Dt.hasOwn(n,t)?"image/"+n[t]:"image/"+t})(t)===e.type))})(e))})(e,o);if(s.length>0)return t.preventDefault(),(r=s,Promise.all(V(r,(e=>ey(e).then((t=>({file:e,uri:t}))))))).then((t=>{n&&e.selection.setRng(n),q(t,(t=>{((e,t)=>{Qv(t.uri).each((({data:n,type:o,base64Encoded:r})=>{const s=r?n:btoa(n),a=t.file,i=e.editorUpload.blobCache,l=i.getByData(s,o),d=null!=l?l:((e,t,n,o)=>{const r=iA(),s=ed(e)&&C(n.name),a=s?((e,t)=>{const n=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return C(n)?e.dom.encode(n[1]):void 0})(e,n.name):r,i=s?n.name:void 0,l=t.create(r,n,o,a,i);return t.add(l),l})(e,i,a,s);cA(e,``,!1,!0)}))})(e,t)}))})),!0}return!1},hA=(e,t,n,o,r)=>{let s=tA(n);const a=fA(t,WR())||GR(n),i=!a&&(e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e))(s),l=rA(s);(JR(s)||!s.length||i&&!l)&&(o=!0),(o||l)&&(s=fA(t,"text/plain")&&i?t["text/plain"]:(e=>{const t=Fs(),n=kC({},t);let o="";const r=t.getVoidElements(),s=Dt.makeMap("script noscript style textarea video audio iframe object"," "),a=t.getBlockElements(),i=e=>{const n=e.name,l=e;if("br"!==n){if("wbr"!==n)if(r[n]&&(o+=" "),s[n])o+=" ";else{if(3===e.type&&(o+=e.value),!(e.name in t.getVoidElements())){let t=e.firstChild;if(t)do{i(t)}while(t=t.next)}a[n]&&l.next&&(o+="\n","p"===n&&(o+="\n"))}}else o+="\n"};return e=eA(e,[//g]),i(n.parse(e)),o})(s)),JR(s)||(o?uA(e,s,r):cA(e,s,a,r))},bA=(e,t,n)=>{((e,t,n)=>{let o;e.on("keydown",(e=>{(e=>Cf.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode)(e)&&!e.isDefaultPrevented()&&(o=e.shiftKey&&86===e.keyCode)})),e.on("paste",(r=>{if(r.isDefaultPrevented()||(e=>{var t,n;return Tt.os.isAndroid()&&0===(null===(n=null===(t=e.clipboardData)||void 0===t?void 0:t.items)||void 0===n?void 0:n.length)})(r))return;const s="text"===n.get()||o;o=!1;const a=mA(r.clipboardData);!gA(a)&&pA(e,r,t.getLastRng()||e.selection.getRng())||(fA(a,"text/html")?(r.preventDefault(),hA(e,a,a["text/html"],s,!0)):fA(a,"text/plain")&&fA(a,"text/uri-list")?(r.preventDefault(),hA(e,a,a["text/plain"],s,!0)):(t.create(),Og.setEditorTimeout(e,(()=>{const n=t.getHtml();t.remove(),hA(e,a,n,s,!1)}),0)))}))})(e,t,n),(e=>{const t=e=>$e(e,"webkit-fake-url"),n=e=>$e(e,"data:");e.parser.addNodeFilter("img",((o,r,s)=>{if(!rc(e)&&(e=>{var t;return!0===(null===(t=e.data)||void 0===t?void 0:t.paste)})(s))for(const r of o){const o=r.attr("src");m(o)&&!r.attr("data-mce-object")&&o!==Tt.transparentSrc&&(t(o)||!gc(e)&&n(o))&&r.remove()}}))})(e)},vA=(e,t,n,o)=>{((e,t,n)=>{if(!e)return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(WR(),t),!0}catch(e){return!1}})(e.clipboardData,t.html,t.text)?(e.preventDefault(),o()):n(t.html,o)},yA=e=>(t,n)=>{const{dom:o,selection:r}=e,s=o.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=o.create("div",{contenteditable:"true"},t);o.setStyles(s,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),s.appendChild(a),o.add(e.getBody(),s);const i=r.getRng();a.focus();const l=o.createRng();l.selectNodeContents(a),r.setRng(l),Og.setEditorTimeout(e,(()=>{r.setRng(i),o.remove(s),n()}),0)},CA=e=>({html:YR(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),wA=e=>!e.selection.isCollapsed()||(e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()))(e),xA=(e,t)=>{var n,o;return Qf.getCaretRangeFromPoint(null!==(n=t.clientX)&&void 0!==n?n:0,null!==(o=t.clientY)&&void 0!==o?o:0,e.getDoc())},EA=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},kA=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,_A=e=>Dt.trim(e).replace(kA,Ks).toLowerCase(),SA=(e,t,n)=>{const o=lc(e);if(n||"all"===o||!dc(e))return t;const r=o?o.split(/[, ]/):[];if(r&&"none"!==o){const n=e.dom,o=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,((e,t,s,a)=>{const i=n.parseStyle(n.decode(s)),l={};for(let e=0;e]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,((e,t,n,o)=>t+' style="'+n+'"'+o)),t},NA=e=>{const t=Br(!1),n=Br(mc(e)?"text":"html"),o=(e=>{const t=Br(null);return{create:()=>((e,t)=>{const{dom:n,selection:o}=e,r=e.getBody();t.set(o.getRng());const s=n.add(e.getBody(),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},XR);Tt.browser.isFirefox()&&n.setStyle(s,"left","rtl"===n.getStyle(r,"direction",!0)?65535:-65535),n.bind(s,"beforedeactivate focusin focusout",(e=>{e.stopPropagation()})),s.focus(),o.select(s,!0)})(e,t),remove:()=>((e,t)=>{const n=e.dom;if(ZR(e)){let o;const r=t.get();for(;o=ZR(e);)n.remove(o),n.unbind(o);r&&e.selection.setRng(r)}t.set(null)})(e,t),getEl:()=>ZR(e),getHtml:()=>(e=>{const t=e.dom,n=(e,n)=>{e.appendChild(n),t.remove(n,!0)},[o,...r]=Y(e.getBody().childNodes,QR);q(r,(e=>{n(o,e)}));const s=t.select("div[id=mcepastebin]",o);for(let e=s.length-1;e>=0;e--){const r=t.create("div");o.insertBefore(r,s[e]),n(r,s[e])}return o?o.innerHTML:""})(e),getLastRng:t.get}})(e);(e=>{(Tt.browser.isChromium()||Tt.browser.isSafari())&&((e,t)=>{e.on("PastePreProcess",(n=>{n.content=t(e,n.content,n.internal)}))})(e,SA)})(e),((e,t)=>{e.addCommand("mceTogglePlainTextPaste",(()=>{((e,t)=>{"text"===t.get()?(t.set("html"),yf(e,!1)):(t.set("text"),yf(e,!0)),e.focus()})(e,t)})),e.addCommand("mceInsertClipboardContent",((t,n)=>{n.html&&cA(e,n.html,n.internal,!1),n.text&&uA(e,n.text,!1)}))})(e,n),(e=>{const t=t=>n=>{t(e,n)},n=sc(e);w(n)&&e.on("PastePreProcess",t(n));const o=ac(e);w(o)&&e.on("PastePostProcess",t(o))})(e),e.on("PreInit",(()=>{(e=>{e.on("cut",(e=>t=>{!t.isDefaultPrevented()&&wA(e)&&e.selection.isEditable()&&vA(t,CA(e),yA(e),(()=>{if(Tt.browser.isChromium()||Tt.browser.isFirefox()){const t=e.selection.getRng();Og.setEditorTimeout(e,(()=>{e.selection.setRng(t),e.execCommand("Delete")}),0)}else e.execCommand("Delete")}))})(e)),e.on("copy",(e=>t=>{!t.isDefaultPrevented()&&wA(e)&&vA(t,CA(e),yA(e),k)})(e))})(e),((e,t)=>{oc(e)&&e.on("dragend dragover draggesture dragdrop drop drag",(e=>{e.preventDefault(),e.stopPropagation()})),rc(e)||e.on("drop",(e=>{const t=e.dataTransfer;t&&(e=>$(e.files,(e=>/^image\//.test(e.type))))(t)&&e.preventDefault()})),e.on("drop",(n=>{if(n.isDefaultPrevented())return;const o=xA(e,n);if(y(o))return;const r=mA(n.dataTransfer),s=fA(r,WR());if((!gA(r)||(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(r))&&pA(e,n,o))return;const a=r[WR()],i=a||r["text/html"]||r["text/plain"],l=((e,t,n,o)=>{const r=e.getParent(n,(e=>Zr(t,e)));if(!h(e.getParent(n,"summary")))return!0;if(r&&ke(o,"text/html")){const e=(new DOMParser).parseFromString(o["text/html"],"text/html").body;return!h(e.querySelector(r.nodeName.toLowerCase()))}return!1})(e.dom,e.schema,o.startContainer,r),d=t.get();d&&!l||i&&(n.preventDefault(),Og.setEditorTimeout(e,(()=>{e.undoManager.transact((()=>{(a||d&&l)&&e.execCommand("Delete"),EA(e,o);const t=tA(i);r["text/html"]?cA(e,t,s,!0):uA(e,t,!0)}))})))})),e.on("dragstart",(e=>{t.set(!0)})),e.on("dragover dragend",(n=>{rc(e)&&!t.get()&&(n.preventDefault(),EA(e,xA(e,n))),"dragend"===n.type&&t.set(!1)})),(e=>{e.on("input",(t=>{const n=e=>h(e.querySelector("summary"));if("deleteByDrag"===t.inputType){const t=Y(e.dom.select("details"),n);q(t,(t=>{pr(t.firstChild)&&t.firstChild.remove();const n=e.dom.create("summary");n.appendChild(Za().dom),t.prepend(n)}))}}))})(e)})(e,t),bA(e,o,n)}))},RA=pr,AA=dr,TA=e=>vr(e.dom),OA=e=>t=>_n(Cn(e),t),BA=(e,t)=>Jn(Cn(e),TA,OA(t)),PA=(e,t,n)=>{const o=new Vo(e,t),r=n?o.next.bind(o):o.prev.bind(o);let s=e;for(let t=n?e:r();t&&!RA(t);t=r())Pi(t)&&(s=t);return s},DA=e=>{const t=((e,t,n)=>{const o=Ji.fromRangeStart(e).getNode(),r=((e,t,n)=>Jn(Cn(e),(e=>(e=>br(e.dom))(e)||n.isBlock($t(e))),OA(t)).getOr(Cn(t)).dom)(o,t,n),s=PA(o,r,!1),a=PA(o,r,!0),i=document.createRange();return BA(s,r).fold((()=>{AA(s)?i.setStart(s,0):i.setStartBefore(s)}),(e=>i.setStartBefore(e.dom))),BA(a,r).fold((()=>{AA(a)?i.setEnd(a,a.data.length):i.setEndAfter(a)}),(e=>i.setEndAfter(e.dom))),i})(e.selection.getRng(),e.getBody(),e.schema);e.selection.setRng(Ab(t))};var LA;!function(e){e.Before="before",e.After="after"}(LA||(LA={}));const MA=(e,t)=>Math.abs(e.left-t),IA=(e,t)=>Math.abs(e.right-t),FA=(e,t)=>(e=>X(e,((e,t)=>e.fold((()=>I.some(t)),(e=>{const n=Math.min(t.left,e.left),o=Math.min(t.top,e.top),r=Math.max(t.right,e.right),s=Math.max(t.bottom,e.bottom);return I.some({top:o,right:r,bottom:s,left:n,width:r-n,height:s-o})}))),I.none()))(Y(e,(e=>{return(n=t)>=(o=e).top&&n<=o.bottom;var n,o}))).fold((()=>[[],e]),(t=>{const{pass:n,fail:o}=K(e,(e=>((e,t)=>{const n=((e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)))(e,t)/Math.min(e.height,t.height);return((e,t)=>e.topt.top)(e,t)&&n>.5})(e,t)));return[n,o]})),UA=(e,t,n)=>t>e.left&&t{const r=e=>Pi(e.node)?I.some(e):er(e.node)?zA(ce(e.node.childNodes),t,n,!1):I.none(),s=(e,s)=>{const a=ae(e,((e,o)=>s(e,t,n)-s(o,t,n)));return ue(a,r).map((e=>o&&!dr(e.node)&&a.length>1?((e,o,s)=>r(o).filter((o=>Math.abs(s(e,t,n)-s(o,t,n))<2&&dr(o.node))))(e,a[1],s).getOr(e):e))},[a,i]=FA(qE(e),n),{pass:l,fail:d}=K(i,(e=>e.tops(d,Ci))).orThunk((()=>s(l,Ci)))},jA=(e,t,n)=>((e,t,n)=>{const o=Cn(e),r=Rn(o),s=wn(r,t,n).filter((e=>Sn(o,e))).getOr(o);return((e,t,n,o)=>{const r=(t,s)=>{const a=Y(t.dom.childNodes,O((e=>er(e)&&e.classList.contains("mce-drag-container"))));return s.fold((()=>zA(a,n,o,!0)),(e=>{const t=Y(a,(t=>t!==e.dom));return zA(t,n,o,!0)})).orThunk((()=>(_n(t,e)?I.none():On(t)).bind((e=>r(e,I.some(t))))))};return r(t,I.none())})(o,s,t,n)})(e,t,n).filter((e=>Yc(e.node))).map((e=>((e,t)=>({node:e.node,position:MA(e,t){var t,n;const o=e.getBoundingClientRect(),r=e.ownerDocument,s=r.documentElement,a=r.defaultView;return{top:o.top+(null!==(t=null==a?void 0:a.scrollY)&&void 0!==t?t:0)-s.clientTop,left:o.left+(null!==(n=null==a?void 0:a.scrollX)&&void 0!==n?n:0)-s.clientLeft}},$A=e=>({target:e,srcElement:e}),VA=(e,t,n,o)=>{const r=((e,t)=>{const n=(e=>{const t=$R(),n=(e=>{const t=e;return I.from(t[BR])})(e);return MR(e),RR(t),t.dropEffect=e.dropEffect,t.effectAllowed=e.effectAllowed,(e=>{const t=e;return I.from(t[_R])})(e).each((e=>t.setDragImage(e.image,e.x,e.y))),q(e.types,(n=>{"Files"!==n&&t.setData(n,e.getData(n))})),q(e.files,(e=>t.items.add(e))),(e=>{const t=e;return I.from(t[SR])})(e).each((e=>{((e,t)=>{NR(t)(e)})(t,e)})),n.each((n=>{DR(e,n),DR(t,n)})),t})(e);return"dragstart"===t?(RR(n),LR(n)):"drop"===t?(AR(n),MR(n)):(TR(n),IR(n)),n})(n,e);return v(o)?((e,t,n)=>{const o=B("Function not supported on simulated event.");return{bubbles:!0,cancelBubble:!1,cancelable:!0,composed:!1,currentTarget:null,defaultPrevented:!1,eventPhase:0,isTrusted:!0,returnValue:!1,timeStamp:0,type:e,composedPath:o,initEvent:o,preventDefault:k,stopImmediatePropagation:k,stopPropagation:k,AT_TARGET:window.Event.AT_TARGET,BUBBLING_PHASE:window.Event.BUBBLING_PHASE,CAPTURING_PHASE:window.Event.CAPTURING_PHASE,NONE:window.Event.NONE,altKey:!1,button:0,buttons:0,clientX:0,clientY:0,ctrlKey:!1,metaKey:!1,movementX:0,movementY:0,offsetX:0,offsetY:0,pageX:0,pageY:0,relatedTarget:null,screenX:0,screenY:0,shiftKey:!1,x:0,y:0,detail:0,view:null,which:0,initUIEvent:o,initMouseEvent:o,getModifierState:o,dataTransfer:n,...$A(t)}})(e,t,r):((e,t,n,o)=>({...t,dataTransfer:o,type:e,...$A(n)}))(e,o,t,r)},qA=vr,WA=((...e)=>t=>{for(let n=0;n{const r=e.dom,s=t.cloneNode(!0);r.setStyles(s,{width:n,height:o}),r.setAttrib(s,"data-mce-selected",null);const a=r.create("div",{class:"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return r.setStyles(a,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:n,height:o}),r.setStyles(s,{margin:0,boxSizing:"border-box"}),a.appendChild(s),a},YA=(e,t)=>n=>()=>{const o="left"===e?n.scrollX:n.scrollY;n.scroll({[e]:o+t,behavior:"smooth"})},GA=YA("left",-32),XA=YA("left",32),ZA=YA("top",-32),QA=YA("top",32),JA=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},eT=(e,t,n,o,r)=>{"dragstart"===t&&VR(o,e.dom.getOuterHTML(n));const s=VA(t,n,o,r);return e.dispatch(t,s)},tT=(e,t)=>{const n=wa(((e,n)=>((e,t,n)=>{e._selectionOverrides.hideFakeCaret(),jA(e.getBody(),t,n).fold((()=>e.selection.placeCaretAt(t,n)),(o=>{const r=e._selectionOverrides.showCaret(1,o.node,o.position===LA.Before,!1);r?e.selection.setRng(r):e.selection.placeCaretAt(t,n)}))})(t,e,n)),0);t.on("remove",n.cancel);const o=e;return r=>e.on((e=>{const s=Math.max(Math.abs(r.screenX-e.screenX),Math.abs(r.screenY-e.screenY));if(!e.dragging&&s>10){const n=eT(t,"dragstart",e.element,e.dataTransfer,r);if(C(n.dataTransfer)&&(e.dataTransfer=n.dataTransfer),n.isDefaultPrevented())return;e.dragging=!0,t.focus()}if(e.dragging){const s=r.currentTarget===t.getDoc().documentElement,l=((e,t)=>({pageX:t.pageX-e.relX,pageY:t.pageY+5}))(e,((e,t)=>{return n=(e=>e.inline?HA(e.getBody()):{left:0,top:0})(e),o=(e=>{const t=e.getBody();return e.inline?{left:t.scrollLeft,top:t.scrollTop}:{left:0,top:0}})(e),r=((e,t)=>{if(t.target.ownerDocument!==e.getDoc()){const n=HA(e.getContentAreaContainer()),o=(e=>{const t=e.getBody(),n=e.getDoc().documentElement,o={left:t.scrollLeft,top:t.scrollTop},r={left:t.scrollLeft||n.scrollLeft,top:t.scrollTop||n.scrollTop};return e.inline?o:r})(e);return{left:t.pageX-n.left+o.left,top:t.pageY-n.top+o.top}}return{left:t.pageX,top:t.pageY}})(e,t),{pageX:r.left-n.left+o.left,pageY:r.top-n.top+o.top};var n,o,r})(t,r));a=e.ghost,i=t.getBody(),a.parentNode!==i&&i.appendChild(a),((e,t,n,o,r,s,a,i,l,d,c,u)=>{let m=0,f=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+n>r&&(m=t.pageX+n-r),t.pageY+o>s&&(f=t.pageY+o-s),e.style.width=n-m+"px",e.style.height=o-f+"px";const g=l.clientHeight,p=l.clientWidth,h=a+l.getBoundingClientRect().top,b=i+l.getBoundingClientRect().left;c.on((e=>{e.intervalId.clear(),e.dragging&&u&&(a+8>=g?e.intervalId.set(QA(d)):a-8<=0?e.intervalId.set(ZA(d)):i+8>=p?e.intervalId.set(XA(d)):i-8<=0?e.intervalId.set(GA(d)):h+16>=window.innerHeight?e.intervalId.set(QA(window)):h-16<=0?e.intervalId.set(ZA(window)):b+16>=window.innerWidth?e.intervalId.set(XA(window)):b-16<=0&&e.intervalId.set(GA(window)))}))})(e.ghost,l,e.width,e.height,e.maxX,e.maxY,r.clientY,r.clientX,t.getContentAreaContainer(),t.getWin(),o,s),n.throttle(r.clientX,r.clientY)}var a,i}))},nT=(e,t,n)=>{e.on((e=>{e.intervalId.clear(),e.dragging&&n.fold((()=>eT(t,"dragend",e.element,e.dataTransfer)),(n=>eT(t,"dragend",e.element,e.dataTransfer,n)))})),oT(e)},oT=e=>{e.on((e=>{e.intervalId.clear(),JA(e.ghost)})),e.clear()},rT=e=>{const t=Dr(),n=fa.DOM,o=document,r=((e,t)=>n=>{if((e=>0===e.button)(n)){const o=Q(t.dom.getParents(n.target),WA).getOr(null);if(C(o)&&((e,t,n)=>qA(n)&&n!==t&&e.isEditable(n.parentElement))(t.dom,t.getBody(),o)){const r=t.dom.getPos(o),s=t.getBody(),a=t.getDoc().documentElement;e.set({element:o,dataTransfer:$R(),dragging:!1,screenX:n.screenX,screenY:n.screenY,maxX:(t.inline?s.scrollWidth:a.offsetWidth)-2,maxY:(t.inline?s.scrollHeight:a.offsetHeight)-2,relX:n.pageX-r.x,relY:n.pageY-r.y,width:o.offsetWidth,height:o.offsetHeight,ghost:KA(t,o,o.offsetWidth,o.offsetHeight),intervalId:Pr(100)})}}})(t,e),s=tT(t,e),a=((e,t)=>n=>{e.on((e=>{var o;if(e.intervalId.clear(),e.dragging){if(((e,t,n)=>!y(t)&&t!==n&&!e.dom.isChildOf(t,n)&&e.dom.isEditable(t))(t,(e=>{const t=e.getSel();if(C(t)){const e=t.getRangeAt(0).startContainer;return dr(e)?e.parentNode:e}return null})(t.selection),e.element)){const r=null!==(o=t.getDoc().elementFromPoint(n.clientX,n.clientY))&&void 0!==o?o:t.getBody();eT(t,"drop",r,e.dataTransfer,n).isDefaultPrevented()||t.undoManager.transact((()=>{((e,t)=>{const n=e.getParent(t.parentNode,e.isBlock);JA(t),n&&n!==e.getRoot()&&e.isEmpty(n)&&Qa(Cn(n))})(t.dom,e.element),(e=>{const t=e.getData("text/html");return""===t?I.none():I.some(t)})(e.dataTransfer).each((e=>t.insertContent(e))),t._selectionOverrides.hideFakeCaret()}))}eT(t,"dragend",t.getBody(),e.dataTransfer,n)}})),oT(e)})(t,e),i=((e,t)=>n=>nT(e,t,I.some(n)))(t,e);e.on("mousedown",r),e.on("mousemove",s),e.on("mouseup",a),n.bind(o,"mousemove",s),n.bind(o,"mouseup",i),e.on("remove",(()=>{n.unbind(o,"mousemove",s),n.unbind(o,"mouseup",i)})),e.on("keydown",(n=>{n.keyCode===Cf.ESC&&nT(t,e,I.none())}))},sT=vr,aT=(e,t)=>gb(e.getBody(),t),iT=e=>{const t=e.selection,n=e.dom,o=e.getBody(),r=qc(e,o,n.isBlock,(()=>jg(e))),s="sel-"+n.uniqueId(),a="data-mce-selected";let i;const l=e=>e!==o&&(sT(e)||wr(e))&&n.isChildOf(e,o)&&n.isEditable(e.parentNode),d=(n,o,s,a=!0)=>e.dispatch("ShowCaret",{target:o,direction:n,before:s}).isDefaultPrevented()?null:(a&&t.scrollIntoView(o,-1===n),r.show(s,o)),c=e=>ai(e)||ci(e)||ui(e),u=e=>c(e.startContainer)||c(e.endContainer),m=t=>{const o=e.schema.getVoidElements(),r=n.createRng(),s=t.startContainer,a=t.startOffset,i=t.endContainer,l=t.endOffset;return ke(o,s.nodeName.toLowerCase())?0===a?r.setStartBefore(s):r.setStartAfter(s):r.setStart(s,a),ke(o,i.nodeName.toLowerCase())?0===l?r.setEndBefore(i):r.setEndAfter(i):r.setEnd(i,l),r},f=(r,c)=>{if(!r)return null;if(r.collapsed){if(!u(r)){const e=c?1:-1,t=vu(e,o,r),s=t.getNode(!c);if(C(s)){if(Yc(s))return d(e,s,!!c&&!t.isAtEnd(),!1);if(si(s)&&vr(s.nextSibling)){const e=n.createRng();return e.setStart(s,0),e.setEnd(s,0),e}}const a=t.getNode(c);if(C(a)){if(Yc(a))return d(e,a,!c&&!t.isAtEnd(),!1);if(si(a)&&vr(a.previousSibling)){const e=n.createRng();return e.setStart(a,1),e.setEnd(a,1),e}}}return null}let m=r.startContainer,f=r.startOffset;const g=r.endOffset;if(dr(m)&&0===f&&sT(m.parentNode)&&(m=m.parentNode,f=n.nodeIndex(m),m=m.parentNode),!er(m))return null;if(g===f+1&&m===r.endContainer){const o=m.childNodes[f];if(l(o))return(o=>{const r=o.cloneNode(!0),l=e.dispatch("ObjectSelected",{target:o,targetClone:r});if(l.isDefaultPrevented())return null;const d=((o,r)=>{const a=Cn(e.getBody()),i=e.getDoc(),l=no(a,"#"+s).getOrThunk((()=>{const e=bn('',i);return Jt(e,"id",s),yo(a,e),e})),d=n.createRng();xo(l),wo(l,[yn(Wo,i),Cn(r),yn(Wo,i)]),d.setStart(l.dom.firstChild,1),d.setEnd(l.dom.lastChild,0),co(l,{top:n.getPos(o,e.getBody()).y+"px"}),yg(l);const c=t.getSel();return c&&(c.removeAllRanges(),c.addRange(d)),d})(o,l.targetClone),c=Cn(o);return q(zo(Cn(e.getBody()),`*[${a}]`),(e=>{_n(c,e)||rn(e,a)})),n.getAttrib(o,a)||o.setAttribute(a,"1"),i=o,p(),d})(o)}return null},g=()=>{i&&i.removeAttribute(a),no(Cn(e.getBody()),"#"+s).each(Eo),i=null},p=()=>{r.hide()};return rw(e)||(e.on("click",(t=>{n.isEditable(t.target)||(t.preventDefault(),e.focus())})),e.on("blur NewBlock",g),e.on("ResizeWindow FullscreenStateChanged",r.reposition),e.on("tap",(t=>{const n=t.target,o=aT(e,n);sT(o)?(t.preventDefault(),Dx(e,o).each(f)):l(n)&&Dx(e,n).each(f)}),!0),e.on("mousedown",(r=>{const s=r.target;if(s!==o&&"HTML"!==s.nodeName&&!n.isChildOf(s,o))return;if(!((e,t,n)=>{const o=Cn(e.getBody()),r=e.inline?o:Cn(Rn(o).dom.documentElement),s=((e,t,n,o)=>{const r=(e=>e.dom.getBoundingClientRect())(t);return{x:n-(e?r.left+t.dom.clientLeft+Iw(t):0),y:o-(e?r.top+t.dom.clientTop+Mw(t):0)}})(e.inline,r,t,n);return((e,t,n)=>{const o=Dw(e),r=Lw(e);return t>=0&&n>=0&&t<=o&&n<=r})(r,s.x,s.y)})(e,r.clientX,r.clientY))return;g(),p();const a=aT(e,s);sT(a)?(r.preventDefault(),Dx(e,a).each(f)):jA(o,r.clientX,r.clientY).each((n=>{var o;r.preventDefault(),(o=d(1,n.node,n.position===LA.Before,!1))&&t.setRng(o),tr(a)?a.focus():e.getBody().focus()}))})),e.on("keypress",(e=>{Cf.modifierPressed(e)||sT(t.getNode())&&e.preventDefault()})),e.on("GetSelectionRange",(e=>{let t=e.range;if(i){if(!i.parentNode)return void(i=null);t=t.cloneRange(),t.selectNode(i),e.range=t}})),e.on("SetSelectionRange",(e=>{e.range=m(e.range);const t=f(e.range,e.forward);t&&(e.range=t)})),e.on("AfterSetSelectionRange",(e=>{const t=e.range,o=t.startContainer.parentElement;var r;u(t)||er(r=o)&&"mcepastebin"===r.id||p(),(e=>C(e)&&n.hasClass(e,"mce-offscreen-selection"))(o)||g()})),(e=>{rT(e),Wd(e)&&(e=>{const t=t=>{if(!t.isDefaultPrevented()){const n=t.dataTransfer;n&&(H(n.types,"Files")||n.files.length>0)&&(t.preventDefault(),"drop"===t.type&&$w(e,"Dropped file type is not supported"))}},n=n=>{Lg(e,n.target)&&t(n)},o=()=>{const o=fa.DOM,r=e.dom,s=document,a=e.inline?e.getBody():e.getDoc(),i=["drop","dragover"];q(i,(e=>{o.bind(s,e,n),r.bind(a,e,t)})),e.on("remove",(()=>{q(i,(e=>{o.unbind(s,e,n),r.unbind(a,e,t)}))}))};e.on("init",(()=>{Og.setEditorTimeout(e,o,0)}))})(e)})(e),(e=>{const t=wa((()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const t=e.selection.getRng();if(t.collapsed){const n=Lx(e,t,!1);e.selection.setRng(n)}}}),0);e.on("focus",(()=>{t.throttle()})),e.on("blur",(()=>{t.cancel()}))})(e),(e=>{e.on("init",(()=>{e.on("focusin",(t=>{const n=t.target;if(wr(n)){const t=gb(e.getBody(),n),o=vr(t)?t:n;e.selection.getNode()!==o&&Dx(e,o).each((t=>e.selection.setRng(t)))}}))}))})(e)),{showCaret:d,showBlockCaretContainer:e=>{e.hasAttribute("data-mce-caret")&&(mi(e),t.scrollIntoView(e))},hideFakeCaret:p,destroy:()=>{r.destroy(),i=null}}},lT=(e,t)=>{let n=t;for(let t=e.previousSibling;dr(t);t=t.previousSibling)n+=t.data.length;return n},dT=(e,t,n,o,r)=>{if(dr(n)&&(o<0||o>n.data.length))return[];const s=r&&dr(n)?[lT(n,o)]:[o];let a=n;for(;a!==t&&a.parentNode;)s.push(e.nodeIndex(a,r)),a=a.parentNode;return a===t?s.reverse():[]},cT=(e,t,n,o,r,s,a=!1)=>({start:dT(e,t,n,o,a),end:dT(e,t,r,s,a)}),uT=(e,t)=>{const n=t.slice(),o=n.pop();return x(o)?X(n,((e,t)=>e.bind((e=>I.from(e.childNodes[t])))),I.some(e)).bind((e=>dr(e)&&(o<0||o>e.data.length)?I.none():I.some({node:e,offset:o}))):I.none()},mT=(e,t)=>uT(e,t.start).bind((({node:n,offset:o})=>uT(e,t.end).map((({node:e,offset:t})=>{const r=document.createRange();return r.setStart(n,o),r.setEnd(e,t),r})))),fT=(e,t,n)=>{if(t&&e.isEmpty(t)&&!n(t)){const o=t.parentNode;e.remove(t,dr(t.firstChild)&&Go(t.firstChild.data)),fT(e,o,n)}},gT=(e,t,n,o=!0)=>{const r=t.startContainer.parentNode,s=t.endContainer.parentNode;t.deleteContents(),o&&!n(t.startContainer)&&(dr(t.startContainer)&&0===t.startContainer.data.length&&e.remove(t.startContainer),dr(t.endContainer)&&0===t.endContainer.data.length&&e.remove(t.endContainer),fT(e,r,n),r!==s&&fT(e,s,n))},pT=(e,t)=>I.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),hT=(e,t,n)=>{const o=e.dynamicPatternsLookup({text:n,block:t});return{...e,blockPatterns:Rl(o).concat(e.blockPatterns),inlinePatterns:Al(o).concat(e.inlinePatterns)}},bT=(e,t,n,o)=>{const r=e.createRng();return r.setStart(t,0),r.setEnd(n,o),r.toString()},vT=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),yT=(e,t)=>{const n=e.createRng();return n.setStartAfter(t.start),n.setEndBefore(t.end),n},CT=(e,t,n)=>{const o=mT(e.getRoot(),n).getOrDie("Unable to resolve path range"),r=o.startContainer,s=o.endContainer,a=0===o.endOffset?s:s.splitText(o.endOffset),i=0===o.startOffset?r:r.splitText(o.startOffset),l=i.parentNode;return{prefix:t,end:a.parentNode.insertBefore(vT(e,t+"-end"),a),start:l.insertBefore(vT(e,t+"-start"),i)}},wT=(e,t,n)=>{fT(e,e.get(t.prefix+"-end"),n),fT(e,e.get(t.prefix+"-start"),n)},xT=e=>0===e.start.length,ET=(e,t,n,o)=>{const r=t.start;var s;return V_(e,o.container,o.offset,(s=r,(e,t)=>{const n=e.data.substring(0,t),o=n.lastIndexOf(s.charAt(s.length-1)),r=n.lastIndexOf(s);return-1!==r?r+s.length:-1!==o?o+1:-1}),n).bind((o=>{var s,a;const i=null!==(a=null===(s=n.textContent)||void 0===s?void 0:s.indexOf(r))&&void 0!==a?a:-1;if(-1!==i&&o.offset>=i+r.length){const t=e.createRng();return t.setStart(o.container,o.offset-r.length),t.setEnd(o.container,o.offset),I.some(t)}{const s=o.offset-r.length;return H_(o.container,s,n).map((t=>{const n=e.createRng();return n.setStart(t.container,t.offset),n.setEnd(o.container,o.offset),n})).filter((e=>e.toString()===r)).orThunk((()=>ET(e,t,n,F_(o.container,0))))}}))},kT=(e,t,n,o)=>{const r=e.dom,s=r.getRoot(),a=n.pattern,i=n.position.container,l=n.position.offset;return H_(i,l-n.pattern.end.length,t).bind((d=>{const c=cT(r,s,d.container,d.offset,i,l,o);if(xT(a))return I.some({matches:[{pattern:a,startRng:c,endRng:c}],position:d});{const i=_T(e,n.remainingPatterns,d.container,d.offset,t,o),l=i.getOr({matches:[],position:d}),u=l.position,m=((e,t,n,o,r,s=!1)=>{if(0===t.start.length&&!s){const t=e.createRng();return t.setStart(n,o),t.setEnd(n,o),I.some(t)}return j_(n,o,r).bind((n=>ET(e,t,r,n).bind((e=>{var t;if(s){if(e.endContainer===n.container&&e.endOffset===n.offset)return I.none();if(0===n.offset&&(null===(t=e.endContainer.textContent)||void 0===t?void 0:t.length)===e.endOffset)return I.none()}return I.some(e)}))))})(r,a,u.container,u.offset,t,i.isNone());return m.map((e=>{const t=((e,t,n,o=!1)=>cT(e,t,n.startContainer,n.startOffset,n.endContainer,n.endOffset,o))(r,s,e,o);return{matches:l.matches.concat([{pattern:a,startRng:t,endRng:c}]),position:F_(e.startContainer,e.startOffset)}}))}}))},_T=(e,t,n,o,r,s)=>{const a=e.dom;return j_(n,o,a.getRoot()).bind((i=>{const l=bT(a,r,n,o);for(let a=0;a0)return _T(e,t,n,o-1,r,s);if(u.isSome())return u}return I.none()}))},ST=(e,t,n)=>{e.selection.setRng(n),"inline-format"===t.type?q(t.format,(t=>{e.formatter.apply(t)})):e.execCommand(t.cmd,!1,t.value)},NT=(e,t,n,o,r,s)=>{var a;return((e,t)=>{const n=ne(e,(e=>$(t,(t=>e.pattern.start===t.pattern.start&&e.pattern.end===t.pattern.end))));return e.length===t.length?n?e:t:e.length>t.length?e:t})(_T(e,r.inlinePatterns,n,o,t,s).fold((()=>[]),(e=>e.matches)),_T(e,(a=r.inlinePatterns,ae(a,((e,t)=>t.end.length-e.end.length))),n,o,t,s).fold((()=>[]),(e=>e.matches)))},RT=(e,t)=>{if(0===t.length)return;const n=e.dom,o=e.selection.getBookmark(),r=((e,t)=>{const n=La("mce_textpattern"),o=G(t,((t,o)=>{const r=CT(e,n+`_end${t.length}`,o.endRng);return t.concat([{...o,endMarker:r}])}),[]);return G(o,((t,r)=>{const s=o.length-t.length-1,a=xT(r.pattern)?r.endMarker:CT(e,n+`_start${s}`,r.startRng);return t.concat([{...r,startMarker:a}])}),[])})(n,t);q(r,(t=>{const o=n.getParent(t.startMarker.start,n.isBlock),r=e=>e===o;xT(t.pattern)?((e,t,n,o)=>{const r=yT(e.dom,n);gT(e.dom,r,o),ST(e,t,r)})(e,t.pattern,t.endMarker,r):((e,t,n,o,r)=>{const s=e.dom,a=yT(s,o),i=yT(s,n);gT(s,i,r),gT(s,a,r);const l={prefix:n.prefix,start:n.end,end:o.start},d=yT(s,l);ST(e,t,d)})(e,t.pattern,t.startMarker,t.endMarker,r),wT(n,t.endMarker,r),wT(n,t.startMarker,r)})),e.selection.moveToBookmark(o)},AT=(e,t,n)=>((e,t,n)=>{if(dr(e)&&0>=e.length)return I.some(F_(e,0));{const t=za(U_);return I.from(t.forwards(e,0,z_(e),n)).map((e=>F_(e.container,0)))}})(t,0,t).map((o=>{const r=o.container;return $_(r,n.start.length,t).each((n=>{const o=e.createRng();o.setStart(r,0),o.setEnd(n.container,n.offset),gT(e,o,(e=>e===t))})),r})),TT=e=>(t,n)=>{const o=t.dom,r=n.pattern,s=mT(o.getRoot(),n.range).getOrDie("Unable to resolve path range");return pT(t,s).each((n=>{"block-format"===r.type?((e,t)=>{const n=t.get(e);return p(n)&&le(n).exists((e=>ke(e,"block")))})(r.format,t.formatter)&&t.undoManager.transact((()=>{e(t.dom,n,r),t.formatter.apply(r.format)})):"block-command"===r.type&&t.undoManager.transact((()=>{e(t.dom,n,r),t.execCommand(r.cmd,!1,r.value)}))})),!0},OT=e=>(t,n)=>{const o=(e=>ae(e,((e,t)=>t.start.length-e.start.length)))(t),r=n.replace(Wo," ");return Q(o,(t=>e(t,n,r)))},BT=(e,t)=>(n,o,r,s,a)=>{var i;void 0===a&&(a=null!==(i=o.textContent)&&void 0!==i?i:"");const l=n.dom,d=Wl(n);return l.is(o,d)?e(r.blockPatterns,a).map((e=>t&&Dt.trim(a).length===e.start.length?[]:[{pattern:e,range:cT(l,l.getRoot(),o,0,o,0,s)}])).getOr([]):[]},PT=TT(((e,t,n)=>{AT(e,t,n).each((e=>{const t=Cn(e),n=Ha(t);/^\s[^\s]/.test(n)&&((e,t)=>{ja.set(e,t)})(t,n.slice(1))}))})),DT=OT(((e,t,n)=>0===t.indexOf(e.start)||0===n.indexOf(e.start))),LT=BT(DT,!0),MT=TT(AT),IT=OT(((e,t,n)=>t===e.start||n===e.start)),FT=BT(IT,!1),UT=(e,t,n)=>{for(let o=0;o{const t=[",",".",";",":","!","?"],n=[32],o=()=>{return t=pc(e),n=hc(e),{inlinePatterns:Al(t),blockPatterns:Rl(t),dynamicPatternsLookup:n};var t,n},r=()=>(e=>e.options.isSet("text_patterns_lookup"))(e);e.on("keydown",(t=>{if(13===t.keyCode&&!Cf.modifierPressed(t)&&e.selection.isCollapsed()){const n=Tl(o(),"enter");(n.inlinePatterns.length>0||n.blockPatterns.length>0||r())&&((e,t)=>((e,t)=>{const n=e.selection.getRng();return pT(e,n).map((o=>{var r;const s=Math.max(0,n.startOffset),a=hT(t,o,null!==(r=o.textContent)&&void 0!==r?r:"");return{inlineMatches:NT(e,o,n.startContainer,s,a,!0),blockMatches:LT(e,o,a,!0)}})).filter((({inlineMatches:e,blockMatches:t})=>t.length>0||e.length>0))})(e,t).fold(L,(({inlineMatches:t,blockMatches:n})=>(e.undoManager.add(),e.undoManager.extra((()=>{e.execCommand("mceInsertNewLine")}),(()=>{(e=>{e.insertContent(Ja,{preserve_zwsp:!0})})(e),RT(e,t),((e,t)=>{if(0===t.length)return;const n=e.selection.getBookmark();q(t,(t=>PT(e,t))),e.selection.moveToBookmark(n)})(e,n);const o=e.selection.getRng(),r=j_(o.startContainer,o.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),r.each((t=>{const n=t.container;n.data.charAt(t.offset-1)===qo&&(n.deleteData(t.offset-1,1),fT(e.dom,n.parentNode,(t=>t===e.dom.getRoot())))}))})),!0))))(e,n)&&t.preventDefault()}}),!0),e.on("keydown",(t=>{if(32===t.keyCode&&e.selection.isCollapsed()){const n=Tl(o(),"space");(n.blockPatterns.length>0||r())&&((e,t)=>((e,t)=>{const n=e.selection.getRng();return pT(e,n).map((o=>{const r=Math.max(0,n.startOffset),s=bT(e.dom,o,n.startContainer,r),a=hT(t,o,s);return FT(e,o,a,!1,s)})).filter((e=>e.length>0))})(e,t).fold(L,(t=>(e.undoManager.transact((()=>{((e,t)=>{q(t,(t=>MT(e,t)))})(e,t)})),!0))))(e,n)&&t.preventDefault()}}),!0);const s=()=>{if(e.selection.isCollapsed()){const t=Tl(o(),"space");(t.inlinePatterns.length>0||r())&&((e,t)=>{const n=e.selection.getRng();pT(e,n).map((o=>{const r=Math.max(0,n.startOffset-1),s=bT(e.dom,o,n.startContainer,r),a=hT(t,o,s),i=NT(e,o,n.startContainer,r,a,!1);i.length>0&&e.undoManager.transact((()=>{RT(e,i)}))}))})(e,t)}};e.on("keyup",(e=>{UT(n,e,((e,t)=>e===t.keyCode&&!Cf.modifierPressed(t)))&&s()})),e.on("keypress",(n=>{UT(t,n,((e,t)=>e.charCodeAt(0)===t.charCode))&&Og.setEditorTimeout(e,s)}))},jT=e=>{const t=Dt.each,n=Cf.BACKSPACE,o=Cf.DELETE,r=e.dom,s=e.selection,a=e.parser,i=Tt.browser,l=i.isFirefox(),d=i.isChromium()||i.isSafari(),c=Tt.deviceType.isiPhone()||Tt.deviceType.isiPad(),u=Tt.os.isMacOS()||Tt.os.isiOS(),m=(t,n)=>{try{e.getDoc().execCommand(t,!1,String(n))}catch(e){}},f=e=>e.isDefaultPrevented(),g=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},p=()=>{e.inline||r.bind(e.getDoc(),"mousedown mouseup",(t=>{let n;if(t.target===e.getDoc().documentElement)if(n=s.getRng(),e.getBody().focus(),"mousedown"===t.type){if(ai(n.startContainer))return;s.placeCaretAt(t.clientX,t.clientY)}else s.setRng(n)}))},h=()=>{Range.prototype.getClientRects||e.on("mousedown",(t=>{if(!f(t)&&"HTML"===t.target.nodeName){const t=e.getBody();t.blur(),Og.setEditorTimeout(e,(()=>{t.focus()}))}}))},b=()=>{const t=Gd(e);e.on("click",(n=>{const o=n.target;/^(IMG|HR)$/.test(o.nodeName)&&r.isEditable(o)&&(n.preventDefault(),e.selection.select(o),e.nodeChanged()),"A"===o.nodeName&&r.hasClass(o,t)&&0===o.childNodes.length&&r.isEditable(o.parentNode)&&(n.preventDefault(),s.select(o))}))},v=()=>{e.on("keydown",(e=>{if(!f(e)&&e.keyCode===n&&s.isCollapsed()&&0===s.getRng().startOffset){const t=s.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}return!0}))},y=()=>{jd(e)||e.on("BeforeExecCommand mousedown",(()=>{m("StyleWithCSS",!1),m("enableInlineTableEditing",!1),yd(e)||m("enableObjectResizing",!1)}))},C=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},w=()=>{e.inline||e.on("keydown",(()=>{document.activeElement===document.body&&e.getWin().focus()}))},x=()=>{e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",(t=>{let n;"HTML"===t.target.nodeName&&(n=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(n),e.selection.normalize(),e.nodeChanged())})))},E=()=>{u&&e.on("keydown",(t=>{!Cf.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))}))},_=()=>{e.on("click",(e=>{let t=e.target;do{if("A"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)})),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")},S=()=>{e.on("init",(()=>{e.dom.bind(e.getBody(),"submit",(e=>{e.preventDefault()}))}))},N=k;return rw(e)?(d&&(p(),b(),S(),g(),c&&(w(),x(),_())),l&&(h(),y(),C(),E())):(e.on("keydown",(t=>{if(f(t)||t.keyCode!==Cf.BACKSPACE)return;let n=s.getRng();const o=n.startContainer,a=n.startOffset,i=r.getRoot();let l=o;if(n.collapsed&&0===a){for(;l.parentNode&&l.parentNode.firstChild===l&&l.parentNode!==i;)l=l.parentNode;"BLOCKQUOTE"===l.nodeName&&(e.formatter.toggle("blockquote",void 0,l),n=r.createRng(),n.setStart(o,0),n.setEnd(o,0),s.setRng(n))}})),(()=>{const t=e=>{const t=r.create("body"),n=e.cloneContents();return t.appendChild(n),s.serializer.serialize(t,{format:"html"})};e.on("keydown",(s=>{const a=s.keyCode;if(!f(s)&&(a===o||a===n)&&e.selection.isEditable()){const n=e.selection.isCollapsed(),o=e.getBody();if(n&&!Ar(e.schema,o))return;if(!n&&!(n=>{const o=t(n),s=r.createRng();return s.selectNode(e.getBody()),o===t(s)})(e.selection.getRng()))return;s.preventDefault(),e.setContent(""),o.firstChild&&r.isBlock(o.firstChild)?e.selection.setCursorLocation(o.firstChild,0):e.selection.setCursorLocation(o,0),e.nodeChanged()}}))})(),Tt.windowsPhone||e.on("keyup focusin mouseup",(t=>{Cf.modifierPressed(t)||(e=>{const t=e.getBody(),n=e.selection.getRng();return n.startContainer===n.endContainer&&n.startContainer===t&&0===n.startOffset&&n.endOffset===t.childNodes.length})(e)||s.normalize()}),!0),d&&(p(),b(),e.on("init",(()=>{m("DefaultParagraphSeparator",Wl(e))})),S(),v(),a.addNodeFilter("br",(e=>{let t=e.length;for(;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()})),c?(w(),x(),_()):g()),l&&(e.on("keydown",(t=>{if(!f(t)&&t.keyCode===n){if(!e.getBody().getElementsByTagName("hr").length)return;if(s.isCollapsed()&&0===s.getRng().startOffset){const e=s.getNode(),n=e.previousSibling;if("HR"===e.nodeName)return r.remove(e),void t.preventDefault();n&&n.nodeName&&"hr"===n.nodeName.toLowerCase()&&(r.remove(n),t.preventDefault())}}})),h(),(()=>{const n=()=>{const n=r.getAttribs(s.getStart().cloneNode(!1));return()=>{const o=s.getStart();o!==e.getBody()&&(r.setAttrib(o,"style",null),t(n,(e=>{o.setAttributeNode(e.cloneNode(!0))})))}},o=()=>!s.isCollapsed()&&r.getParent(s.getStart(),r.isBlock)!==r.getParent(s.getEnd(),r.isBlock);e.on("keypress",(t=>{let r;return!(!(f(t)||8!==t.keyCode&&46!==t.keyCode)&&o()&&(r=n(),e.getDoc().execCommand("delete",!1),r(),t.preventDefault(),1))})),r.bind(e.getDoc(),"cut",(t=>{if(!f(t)&&o()){const t=n();Og.setEditorTimeout(e,(()=>{t()}))}}))})(),y(),e.on("SetContent ExecCommand",(e=>{"setcontent"!==e.type&&"mceInsertLink"!==e.command||t(r.select("a:not([data-mce-block])"),(e=>{var t;let n=e.parentNode;const o=r.getRoot();if((null==n?void 0:n.lastChild)===e){for(;n&&!r.isBlock(n);){if((null===(t=n.parentNode)||void 0===t?void 0:t.lastChild)!==n||n===o)return;n=n.parentNode}r.add(n,"br",{"data-mce-bogus":1})}}))})),C(),E(),v())),{refreshContentEditable:N,isHidden:()=>{if(!l||e.removed)return!1;const t=e.selection.getSel();return!t||!t.rangeCount||0===t.rangeCount}}},HT=fa.DOM,$T=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,VT=e=>Ce(e,(e=>!1===v(e))),qT=e=>{const t=e.options.get,n=e.editorUpload.blobCache;return VT({allow_conditional_comments:t("allow_conditional_comments"),allow_html_data_urls:t("allow_html_data_urls"),allow_svg_data_urls:t("allow_svg_data_urls"),allow_html_in_named_anchor:t("allow_html_in_named_anchor"),allow_script_urls:t("allow_script_urls"),allow_unsafe_link_target:t("allow_unsafe_link_target"),convert_unsafe_embeds:t("convert_unsafe_embeds"),convert_fonts_to_spans:t("convert_fonts_to_spans"),fix_list_elements:t("fix_list_elements"),font_size_legacy_values:t("font_size_legacy_values"),forced_root_block:t("forced_root_block"),forced_root_block_attrs:t("forced_root_block_attrs"),preserve_cdata:t("preserve_cdata"),inline_styles:t("inline_styles"),root_name:$T(e),sandbox_iframes:t("sandbox_iframes"),sandbox_iframes_exclusions:Ac(e),sanitize:t("xss_sanitization"),validate:!0,blob_cache:n,document:e.getDoc()})},WT=e=>{const t=e.options.get;return VT({custom_elements:t("custom_elements"),extended_valid_elements:t("extended_valid_elements"),invalid_elements:t("invalid_elements"),invalid_styles:t("invalid_styles"),schema:t("schema"),valid_children:t("valid_children"),valid_classes:t("valid_classes"),valid_elements:t("valid_elements"),valid_styles:t("valid_styles"),verify_html:t("verify_html"),padd_empty_block_inline_children:t("format_empty_lines")})},KT=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,YT=e=>{const t=KT(e),n=hd(e),o=e.contentCSS,r=()=>{t.unloadAll(o),e.inline||e.ui.styleSheetLoader.unloadAll(n)},s=()=>{e.removed?r():e.on("remove",r)};if(e.contentStyles.length>0){let t="";Dt.each(e.contentStyles,(e=>{t+=e+"\r\n"})),e.dom.addStyle(t)}const a=Promise.all(((e,t,n)=>{const{pass:o,fail:r}=K(t,(e=>tinymce.Resource.has(Kw(e)))),s=o.map((t=>{const n=tinymce.Resource.get(Kw(t));return m(n)?Promise.resolve(KT(e).loadRawCss(t,n)):Promise.resolve()})),a=[...s,KT(e).loadAll(r)];return e.inline?a:a.concat([e.ui.styleSheetLoader.loadAll(n)])})(e,o,n)).then(s).catch(s),i=pd(e);return i&&((e,t)=>{const n=Cn(e.getBody()),o=Wn(qn(n)),r=vn("style");Jt(r,"type","text/css"),yo(r,yn(t)),yo(o,r),e.on("remove",(()=>{Eo(r)}))})(e,i),a},GT=e=>{!0!==e.removed&&((e=>{rw(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})})(e),(e=>{e.bindPendingEventDelegates(),e.initialized=!0,(e=>{e.dispatch("Init")})(e),e.focus(!0),(e=>{const t=e.dom.getRoot();e.inline||vm(e)&&e.selection.getStart(!0)!==t||$u(t).each((t=>{const n=t.getNode(),o=ar(n)?$u(n).getOr(t):t;e.selection.setRng(o.toRange())}))})(e),e.nodeChanged({initial:!0});const t=Qd(e);w(t)&&t.call(e,e),(e=>{const t=ec(e);t&&Og.setEditorTimeout(e,(()=>{let n;n=!0===t?e:e.editorManager.get(t),n&&!n.destroyed&&(n.focus(),n.selection.scrollIntoView())}),100)})(e)})(e))},XT=e=>{const t=e.getElement();let n=e.getDoc();e.inline&&(HT.addClass(t,"mce-content-body"),e.contentDocument=n=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const o=e.getBody();o.disabled=!0,e.readonly=jd(e),e._editableRoot=Hd(e),!e.readonly&&e.hasEditableRoot()&&(e.inline&&"static"===HT.getStyle(o,"position",!0)&&(o.style.position="relative"),o.contentEditable="true"),o.disabled=!1,e.editorUpload=tx(e),e.schema=Fs(WT(e)),e.dom=fa(n,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,update_styles:!0,root_element:e.inline?e.getBody():null,collect:e.inline,schema:e.schema,contentCssCors:ld(e),referrerPolicy:dd(e),onSetAttrib:t=>{e.dispatch("SetAttrib",t)}}),e.parser=(e=>{const t=kC(qT(e),e.schema);return t.addAttributeFilter("src,href,style,tabindex",((t,n)=>{const o=e.dom,r="data-mce-"+n;let s=t.length;for(;s--;){const a=t[s];let i=a.attr(n);if(i&&!a.attr(r)){if(0===i.indexOf("data:")||0===i.indexOf("blob:"))continue;"style"===n?(i=o.serializeStyle(o.parseStyle(i),a.name),i.length||(i=null),a.attr(r,i),a.attr(n,i)):"tabindex"===n?(a.attr(r,i),a.attr(n,null)):a.attr(r,e.convertURL(i,n,a.name))}}})),t.addNodeFilter("script",(e=>{let t=e.length;for(;t--;){const n=e[t],o=n.attr("type")||"no/type";0!==o.indexOf("mce-")&&n.attr("type","mce-"+o)}})),Cc(e)&&t.addNodeFilter("#cdata",(t=>{var n;let o=t.length;for(;o--;){const r=t[o];r.type=8,r.name="#comment",r.value="[CDATA["+e.dom.encode(null!==(n=r.value)&&void 0!==n?n:"")+"]]"}})),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",(t=>{let n=t.length;const o=e.schema.getNonEmptyElements();for(;n--;){const e=t[n];e.isEmpty(o)&&0===e.getAll("br").length&&e.append(new ep("br",1))}})),t})(e),e.serializer=pw((e=>{const t=e.options.get;return{...qT(e),...WT(e),...VT({remove_trailing_brs:t("remove_trailing_brs"),pad_empty_with_br:t("pad_empty_with_br"),url_converter:t("url_converter"),url_converter_scope:t("url_converter_scope"),element_format:t("element_format"),entities:t("entities"),entity_encoding:t("entity_encoding"),indent:t("indent"),indent_after:t("indent_after"),indent_before:t("indent_before")})}})(e),e),e.selection=mw(e.dom,e.getWin(),e.serializer,e),e.annotator=cf(e),e.formatter=mx(e),e.undoManager=gx(e),e._nodeChangeDispatcher=new kR(e),e._selectionOverrides=iT(e),(e=>{const t=Dr(),n=Br(!1),o=xa((t=>{e.dispatch("longpress",{...t,type:"longpress"}),n.set(!0)}),400);e.on("touchstart",(e=>{zk(e).each((r=>{o.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};o.throttle(e),n.set(!1),t.set(s)}))}),!0),e.on("touchmove",(r=>{o.cancel(),zk(r).each((o=>{t.on((r=>{((e,t)=>{const n=Math.abs(e.clientX-t.x),o=Math.abs(e.clientY-t.y);return n>5||o>5})(o,r)&&(t.clear(),n.set(!1),e.dispatch("longpresscancel"))}))}))}),!0),e.on("touchend touchcancel",(r=>{o.cancel(),"touchcancel"!==r.type&&t.get().filter((e=>e.target.isEqualNode(r.target))).each((()=>{n.get()?r.preventDefault():e.dispatch("tap",{...r,type:"tap"})}))}),!0)})(e),(e=>{(e=>{e.on("click",(t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()}))})(e),(e=>{e.parser.addNodeFilter("details",(t=>{const n=Sc(e);q(t,(e=>{"expanded"===n?e.attr("open","open"):"collapsed"===n&&e.attr("open",null)}))})),e.serializer.addNodeFilter("details",(t=>{const n=Nc(e);q(t,(e=>{"expanded"===n?e.attr("open","open"):"collapsed"===n&&e.attr("open",null)}))}))})(e)})(e),(e=>{const t="contenteditable",n=" "+Dt.trim(vc(e))+" ",o=" "+Dt.trim(bc(e))+" ",r=Kk(n),s=Kk(o),a=yc(e);a.length>0&&e.on("BeforeSetContent",(t=>{((e,t,n)=>{let o=t.length,r=n.content;if("raw"!==n.format){for(;o--;)r=r.replace(t[o],Yk(e,r,bc(e)));n.content=r}})(e,a,t)})),e.parser.addAttributeFilter("class",(e=>{let n=e.length;for(;n--;){const o=e[n];r(o)?o.attr(t,"true"):s(o)&&o.attr(t,"false")}})),e.serializer.addAttributeFilter(t,(e=>{let n=e.length;for(;n--;){const o=e[n];(r(o)||s(o))&&(a.length>0&&o.attr("data-mce-content")?(o.name="#text",o.type=3,o.raw=!0,o.value=o.attr("data-mce-content")):o.attr(t,null))}}))})(e),rw(e)||((e=>{e.on("mousedown",(t=>{t.detail>=3&&(t.preventDefault(),DA(e))}))})(e),(e=>{zT(e)})(e));const r=ER(e);Uk(e,r),(e=>{e.on("NodeChange",T(qk,e))})(e),(e=>{var t;const n=e.dom,o=Wl(e),r=null!==(t=wd(e))&&void 0!==t?t:"",s=(t,a)=>{if((e=>{if(bx(e)){const t=e.keyCode;return!vx(e)&&(Cf.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||H(px,t))}return!1})(t))return;const i=e.getBody(),l=!(e=>bx(e)&&!(vx(e)||"keyup"===e.type&&229===e.keyCode))(t)&&((e,t,n)=>{if(e.isEmpty(t,void 0,{skipBogus:!1,includeZwsp:!0})){const o=t.firstElementChild;return!o||!e.getStyle(t.firstElementChild,"padding-left")&&!e.getStyle(t.firstElementChild,"padding-right")&&n===o.nodeName.toLowerCase()}return!1})(n,i,o);(""!==n.getAttrib(i,hx)!==l||a)&&(n.setAttrib(i,hx,l?r:null),((e,t)=>{e.dispatch("PlaceholderToggle",{state:t})})(e,l),e.on(l?"keydown":"keyup",s),e.off(l?"keyup":"keydown",s))};Ge(r)&&e.on("init",(t=>{s(t,!0),e.on("change SetContent ExecCommand",s),e.on("paste",(t=>Og.setEditorTimeout(e,(()=>s(t)))))}))})(e),NA(e);const s=(e=>{const t=e;return(e=>Ee(e.plugins,"rtc").bind((e=>I.from(e.setup))))(e).fold((()=>(t.rtcInstance=ow(e),I.none())),(e=>(t.rtcInstance=(()=>{const e=N(null),t=N("");return{init:{bindEvents:k},undoManager:{beforeChange:k,add:e,undo:e,redo:e,clear:k,reset:k,hasUndo:L,hasRedo:L,transact:e,ignore:k,extra:k},formatter:{match:L,matchAll:N([]),matchNode:N(void 0),canApply:L,closest:t,apply:k,remove:k,toggle:k,formatChanged:N({unbind:k})},editor:{getContent:t,setContent:N({content:"",html:""}),insertContent:N(""),addVisual:k},selection:{getContent:t},autocompleter:{addDecoration:k,removeDecoration:k},raw:{getModel:N(I.none())}}})(),I.some((()=>e().then((e=>(t.rtcInstance=(e=>{const t=e=>f(e)?e:{},{init:n,undoManager:o,formatter:r,editor:s,selection:a,autocompleter:i,raw:l}=e;return{init:{bindEvents:n.bindEvents},undoManager:{beforeChange:o.beforeChange,add:o.add,undo:o.undo,redo:o.redo,clear:o.clear,reset:o.reset,hasUndo:o.hasUndo,hasRedo:o.hasRedo,transact:(e,t,n)=>o.transact(n),ignore:(e,t)=>o.ignore(t),extra:(e,t,n,r)=>o.extra(n,r)},formatter:{match:(e,n,o,s)=>r.match(e,t(n),s),matchAll:r.matchAll,matchNode:r.matchNode,canApply:e=>r.canApply(e),closest:e=>r.closest(e),apply:(e,n,o)=>r.apply(e,t(n)),remove:(e,n,o,s)=>r.remove(e,t(n)),toggle:(e,n,o)=>r.toggle(e,t(n)),formatChanged:(e,t,n,o,s)=>r.formatChanged(t,n,o,s)},editor:{getContent:e=>s.getContent(e),setContent:(e,t)=>({content:s.setContent(e,t),html:""}),insertContent:(e,t)=>(s.insertContent(e),""),addVisual:s.addVisual},selection:{getContent:(e,t)=>a.getContent(t)},autocompleter:{addDecoration:i.addDecoration,removeDecoration:i.removeDecoration},raw:{getModel:()=>I.some(l.getRawModel())}}})(e),e.rtc.isRemote))))))))})(e);(e=>{const t=e.getDoc(),n=e.getBody();(e=>{e.dispatch("PreInit")})(e),tc(e)||(t.body.spellcheck=!1,HT.setAttrib(n,"spellcheck","false")),e.quirks=jT(e),(e=>{e.dispatch("PostRender")})(e);const o=bd(e);void 0!==o&&(n.dir=o);const r=nc(e);r&&e.on("BeforeSetContent",(e=>{Dt.each(r,(t=>{e.content=e.content.replace(t,(e=>"\x3c!--mce:protected "+escape(e)+"--\x3e"))}))})),e.on("SetContent",(()=>{e.addVisual(e.getBody())})),e.on("compositionstart compositionend",(t=>{e.composing="compositionstart"===t.type}))})(e),(e=>{const t=Oc(e);m(Bc(e))||!v(t)&&"INVALID"!==(e=>(e=>"gpl"===e.toLowerCase())(e)||(e=>e.length>=64&&e.length<=255)(e)?"VALID":"INVALID")(t)||console.warn("TinyMCE is running in evaluation mode. Provide a valid license key or add license_key: 'gpl' to the init config to agree to the open source license terms. Read more at https://www.tiny.cloud/license-key/")})(e),s.fold((()=>{const t=(e=>{let t=!1;const n=setTimeout((()=>{t||e.setProgressState(!0)}),500);return()=>{clearTimeout(n),t=!0,e.setProgressState(!1)}})(e);YT(e).then((()=>{GT(e),t()}))}),(t=>{e.setProgressState(!0),YT(e).then((()=>{t().then((t=>{e.setProgressState(!1),GT(e),iw(e)}),(t=>{e.notificationManager.open({type:"error",text:String(t)}),GT(e),iw(e)}))}))}))},ZT=M,QT=fa.DOM,JT=fa.DOM,eO=(e,t)=>({editorContainer:e,iframeContainer:t,api:{}}),tO=e=>{const t=e.getElement();return e.inline?eO(null):(e=>{const t=JT.create("div");return JT.insertAfter(t,e),eO(t,t)})(t)},nO=async e=>{e.dispatch("ScriptsLoaded"),(e=>{const t=Dt.trim(nd(e)),n=e.ui.registry.getAll().icons,o={...Tw.get("default").icons,...Tw.get(t).icons};pe(o,((t,o)=>{ke(n,o)||e.ui.registry.addIcon(o,t)}))})(e),(e=>{const t=kd(e);if(m(t)){const n=zw.get(t);e.theme=n(e,zw.urls[t])||{},w(e.theme.init)&&e.theme.init(e,zw.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}})(e),(e=>{const t=Sd(e),n=Ow.get(t);e.model=n(e,Ow.urls[t])})(e),(e=>{const t=[];q(Vd(e),(n=>{((e,t,n)=>{const o=Uw.get(n),r=Uw.urls[n]||e.documentBaseUrl.replace(/\/$/,"");if(n=Dt.trim(n),o&&-1===Dt.inArray(t,n)){if(e.plugins[n])return;try{const s=o(e,r)||{};e.plugins[n]=s,w(s.init)&&(s.init(e,r),t.push(n))}catch(t){((e,t,n)=>{const o=ya.translate(["Failed to initialize plugin: {0}",t]);ff(e,"PluginLoadError",{message:o}),Ww(o,n),$w(e,o)})(e,n,t)}}})(e,t,(e=>e.replace(/^\-/,""))(n))}))})(e);const t=await(e=>{const t=e.getElement();return e.orgDisplay=t.style.display,m(kd(e))?(e=>{const t=e.theme.renderUI;return t?t():tO(e)})(e):w(kd(e))?(e=>{const t=e.getElement(),n=kd(e)(e,t);return n.editorContainer.nodeType&&(n.editorContainer.id=n.editorContainer.id||e.id+"_parent"),n.iframeContainer&&n.iframeContainer.nodeType&&(n.iframeContainer.id=n.iframeContainer.id||e.id+"_iframecontainer"),n.height=n.iframeHeight?n.iframeHeight:t.offsetHeight,n})(e):tO(e)})(e);((e,t)=>{const n={show:I.from(t.show).getOr(k),hide:I.from(t.hide).getOr(k),isEnabled:I.from(t.isEnabled).getOr(M),setEnabled:n=>{e.mode.isReadOnly()||I.from(t.setEnabled).each((e=>e(n)))}};e.ui={...e.ui,...n}})(e,I.from(t.api).getOr({})),e.editorContainer=t.editorContainer,(e=>{e.contentCSS=e.contentCSS.concat((e=>Yw(e,gd(e)))(e),(e=>Yw(e,hd(e)))(e))})(e),e.inline?XT(e):((e,t)=>{((e,t)=>{const n=Tt.browser.isFirefox()?Xd(e):"Rich Text Area",o=e.translate(n),r=nn(Cn(e.getElement()),"tabindex").bind(Ze),s=((e,t,n,o)=>{const r=vn("iframe");return o.each((e=>Jt(r,"tabindex",e))),en(r,n),en(r,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),mn(r,"tox-edit-area__iframe"),r})(e.id,o,Ul(e),r).dom;s.onload=()=>{s.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=s,e.iframeHTML=(e=>{let t=zl(e)+"";jl(e)!==e.documentBaseUrl&&(t+=''),t+='';const n=Hl(e),o=$l(e),r=e.translate(Xd(e));return Vl(e)&&(t+=''),t+=`
`,t})(e),QT.add(t.iframeContainer,s)})(e,t),t.editorContainer&&(t.editorContainer.style.display=e.orgDisplay,e.hidden=QT.isHidden(t.editorContainer)),e.getElement().style.display="none",QT.setAttrib(e.id,"aria-hidden","true"),e.getElement().style.visibility=e.orgVisibility,(e=>{const t=e.iframeElement,n=()=>{e.contentDocument=t.contentDocument,XT(e)};if(Ec(e)||Tt.browser.isFirefox()){const t=e.getDoc();t.open(),t.write(e.iframeHTML),t.close(),n()}else{const r=(o=Cn(t),Ro(o,"load",ZT,(()=>{r.unbind(),n()})));t.srcdoc=e.iframeHTML}var o})(e)})(e,{editorContainer:t.editorContainer,iframeContainer:t.iframeContainer})},oO=fa.DOM,rO=e=>"-"===e.charAt(0),sO=(e,t,n)=>I.from(t).filter((e=>Ge(e)&&!Tw.has(e))).map((t=>({url:`${e.editorManager.baseURL}/icons/${t}/icons${n}.js`,name:I.some(t)}))),aO=(e,t)=>{const n=pa.ScriptLoader,o=()=>{!e.removed&&(e=>{const t=kd(e);return!m(t)||C(zw.get(t))})(e)&&(e=>{const t=Sd(e);return C(Ow.get(t))})(e)&&nO(e)};((e,t)=>{const n=kd(e);if(m(n)&&!rO(n)&&!ke(zw.urls,n)){const o=_d(e),r=o?e.documentBaseURI.toAbsolute(o):`themes/${n}/theme${t}.js`;zw.load(n,r).catch((()=>{((e,t,n)=>{Vw(e,"ThemeLoadError",qw("theme",t,n))})(e,r,n)}))}})(e,t),((e,t)=>{const n=Sd(e);if("plugin"!==n&&!ke(Ow.urls,n)){const o=Nd(e),r=m(o)?e.documentBaseURI.toAbsolute(o):`models/${n}/model${t}.js`;Ow.load(n,r).catch((()=>{((e,t,n)=>{Vw(e,"ModelLoadError",qw("model",t,n))})(e,r,n)}))}})(e,t),((e,t)=>{const n=cd(t),o=ud(t);if(!ya.hasCode(n)&&"en"!==n){const r=Ge(o)?o:`${t.editorManager.baseURL}/langs/${n}.js`;e.add(r).catch((()=>{((e,t,n)=>{Vw(e,"LanguageLoadError",qw("language",t,n))})(t,r,n)}))}})(n,e),((e,t,n)=>{const o=sO(t,"default",n),r=(e=>I.from(od(e)).filter(Ge).map((e=>({url:e,name:I.none()}))))(t).orThunk((()=>sO(t,nd(t),"")));q((e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t{e.add(n.url).catch((()=>{((e,t,n)=>{Vw(e,"IconsLoadError",qw("icons",t,n))})(t,n.url,n.name.getOrUndefined())}))}))})(n,e,t),((e,t)=>{const n=(t,n)=>{Uw.load(t,n).catch((()=>{((e,t,n)=>{Vw(e,"PluginLoadError",qw("plugin",t,n))})(e,n,t)}))};pe(qd(e),((t,o)=>{n(o,t),e.options.set("plugins",Vd(e).concat(o))})),q(Vd(e),(e=>{!(e=Dt.trim(e))||Uw.urls[e]||rO(e)||n(e,`plugins/${e}/plugin${t}.js`)}))})(e,t),n.loadQueue().then(o,o)},iO=Et().deviceType,lO=iO.isPhone(),dO=iO.isTablet(),cO=e=>{if(y(e))return[];{const t=p(e)?e:e.split(/[ ,]/),n=V(t,We);return Y(n,Ge)}},uO=(e,t)=>{const n=((t,n)=>{const o={},r={};return ye(t,((t,n)=>H(e,n)),ve(o),ve(r)),{t:o,f:r}})(t);return o=n.t,r=n.f,{sections:N(o),options:N(r)};var o,r},mO=(e,t)=>ke(e.sections(),t),fO=(e,t)=>({table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:Ee(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1,...t?{menubar:!1}:{}}),gO=(e,t)=>{var n;const o=null!==(n=t.external_plugins)&&void 0!==n?n:{};return e&&e.external_plugins?Dt.extend({},e.external_plugins,o):o},pO=(e,t,n,o,r)=>{var s;const a=e?{mobile:fO(null!==(s=r.mobile)&&void 0!==s?s:{},t)}:{},i=uO(["mobile"],aS(a,r)),l=Dt.extend(n,o,i.options(),((e,t)=>e&&mO(t,"mobile"))(e,i)?((e,t,n={})=>{const o=e.sections(),r=Ee(o,t).getOr({});return Dt.extend({},n,r)})(i,"mobile"):{},{external_plugins:gO(o,i.options())});return((e,t,n,o)=>{const r=cO(n.forced_plugins),s=cO(o.plugins),a=((e,t)=>mO(e,t)?e.sections()[t]:{})(t,"mobile"),i=((e,t,n,o)=>e&&mO(t,"mobile")?o:n)(e,t,s,a.plugins?cO(a.plugins):s),l=((e,t)=>[...cO(e),...cO(t)])(r,i);return Dt.extend(o,{forced_plugins:r,plugins:l})})(e,i,o,l)},hO=e=>{(e=>{const t=t=>()=>{q("left,center,right,justify".split(","),(n=>{t!==n&&e.formatter.remove("align"+n)})),"none"!==t&&((t,n)=>{e.formatter.toggle(t,void 0),e.nodeChanged()})("align"+t)};e.editorCommands.addCommands({JustifyLeft:t("left"),JustifyCenter:t("center"),JustifyRight:t("right"),JustifyFull:t("justify"),JustifyNone:t("none")})})(e),(e=>{const t=t=>()=>{const n=e.selection,o=n.isCollapsed()?[e.dom.getParent(n.getNode(),e.dom.isBlock)]:n.getSelectedBlocks();return $(o,(n=>C(e.formatter.matchNode(n,t))))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")})(e)},bO=(e,t)=>{const n=e.selection,o=e.dom;return/^ | $/.test(t)?((e,t,n,o)=>{const r=Cn(e.getRoot());return n=lh(r,Ji.fromRangeStart(t),o)?n.replace(/^ /," "):n.replace(/^ /," "),dh(r,Ji.fromRangeEnd(t),o)?n.replace(/( | )(
)?$/," "):n.replace(/ (
)?$/," ")})(o,n.getRng(),t,e.schema):t},vO=(e,t)=>{if(e.selection.isEditable()){const{content:n,details:o}=(e=>{if("string"!=typeof e){const t=Dt.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}})(t);AC(e,{...o,content:bO(e,n),format:"html",set:!1,selection:!0}).each((t=>{const n=((e,t,n)=>sw(e).editor.insertContent(t,n))(e,t.content,o);TC(e,n,t),e.addVisual()}))}},yO={"font-size":"size","font-family":"face"},CO=Zt("font"),wO=e=>(t,n)=>I.from(n).map(Cn).filter(Kt).bind((n=>((e,t,n)=>jb(Cn(n),(t=>(t=>fo(t,e).orThunk((()=>CO(t)?Ee(yO,e).bind((e=>nn(t,e))):I.none())))(t)),(e=>_n(Cn(t),e))))(e,t,n.dom).or(((e,t)=>I.from(fa.DOM.getStyle(t,e,!0)))(e,n.dom)))).getOr(""),xO=wO("font-size"),EO=_((e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,",")),wO("font-family")),kO=e=>$u(e.getBody()).bind((e=>{const t=e.container();return I.from(dr(t)?t.parentNode:t)})),_O=(e,t)=>((e,t)=>(e=>I.from(e.selection.getRng()).bind((t=>{const n=e.getBody();return t.startContainer===n&&0===t.startOffset?I.none():I.from(e.selection.getStart(!0))})))(e).orThunk(T(kO,e)).map(Cn).filter(Kt).bind(t))(e,S(I.some,t)),SO=(e,t)=>{if(/^[0-9.]+$/.test(t)){const n=parseInt(t,10);if(n>=1&&n<=7){const o=(e=>Dt.explode(e.options.get("font_size_style_values")))(e),r=(e=>Dt.explode(e.options.get("font_size_classes")))(e);return r.length>0?r[n-1]||t:o[n-1]||t}return t}return t},NO=e=>{const t=e.split(/\s*,\s*/);return V(t,(e=>-1===e.indexOf(" ")||$e(e,'"')||$e(e,"'")?e:`'${e}'`)).join(",")},RO=(e,t)=>{const n=e.dom,o=e.selection.getRng(),r=t?e.selection.getStart():e.selection.getEnd(),s=t?o.startContainer:o.endContainer,a=kN(n,s);if(!a||!a.isContentEditable)return;const i=t?ho:bo,l=Wl(e);((e,t,n,o)=>{const r=e.dom,s=e=>r.isBlock(e)&&e.parentElement===n,a=s(t)?t:r.getParent(o,s,n);return I.from(a).map(Cn)})(e,r,a,s).each((t=>{const n=RN(e,s,t.dom,a,!1,l);i(t,Cn(n)),e.selection.setCursorLocation(n,0),e.dispatch("NewBlock",{newBlock:n}),bN(e,"insertParagraph")}))},AO=e=>{hO(e),(e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const n=e.getDoc();let o;try{n.execCommand(t)}catch(e){o=!0}if("paste"!==t||n.queryCommandEnabled(t)||(o=!0),o||!n.queryCommandSupported(t)){let t=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");(Tt.os.isMacOS()||Tt.os.isiOS())&&(t=t.replace(/Ctrl\+/g,"\u2318+")),e.notificationManager.open({text:t,type:"error"})}}})})(e),(e=>{e.editorCommands.addCommands({mceAddUndoLevel:()=>{e.undoManager.add()},mceEndUndoLevel:()=>{e.undoManager.add()},Undo:()=>{e.undoManager.undo()},Redo:()=>{e.undoManager.redo()}})})(e),(e=>{e.editorCommands.addCommands({mceSelectNodeDepth:(t,n,o)=>{let r=0;e.dom.getParent(e.selection.getNode(),(t=>!er(t)||r++!==o||(e.selection.select(t),!1)),e.getBody())},mceSelectNode:(t,n,o)=>{e.selection.select(o)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),br);if(t){const n=e.dom.createRng();n.selectNodeContents(t),e.selection.setRng(n)}}})})(e),(e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,n,o)=>{vO(e,e.dom.createHTML("img",{src:o}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"
")},insertText:(t,n,o)=>{vO(e,e.dom.encode(o))},insertHTML:(t,n,o)=>{vO(e,o)},mceInsertContent:(t,n,o)=>{vO(e,o)},mceSetContent:(t,n,o)=>{e.setContent(o)},mceReplaceContent:(t,n,o)=>{e.execCommand("mceInsertContent",!1,o.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent(ic(e))}})})(e),(e=>{const t=(t,n,o)=>{const r=m(o)?{href:o}:o,s=e.dom.getParent(e.selection.getNode(),"a");f(r)&&m(r.href)&&(r.href=r.href.replace(/ /g,"%20"),s&&r.href||e.formatter.remove("link"),r.href&&e.formatter.apply("link",r,s))};e.editorCommands.addCommands({unlink:()=>{if(e.selection.isEditable()){if(e.selection.isCollapsed()){const t=e.dom.getParent(e.selection.getStart(),"a");return void(t&&e.dom.remove(t,!0))}e.formatter.remove("link")}},mceInsertLink:t,createLink:t})})(e),(e=>{e.editorCommands.addCommands({Indent:()=>{(e=>{Lk(e,"indent")})(e)},Outdent:()=>{Mk(e)}}),e.editorCommands.addCommands({Outdent:()=>Bk(e)},"state")})(e),(e=>{e.editorCommands.addCommands({InsertNewBlockBefore:()=>{(e=>{RO(e,!0)})(e)},InsertNewBlockAfter:()=>{(e=>{RO(e,!1)})(e)}})})(e),(e=>{e.editorCommands.addCommands({insertParagraph:()=>{iR(UN,e)},mceInsertNewLine:(t,n,o)=>{lR(e,o)},InsertLineBreak:(t,n,o)=>{iR(KN,e)}})})(e),(e=>{(e=>{const t=(t,n)=>{e.formatter.toggle(t,n),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>{t(e)},"ForeColor,HiliteColor":(e,n,o)=>{t(e,{value:o})},BackColor:(e,n,o)=>{t("hilitecolor",{value:o})},FontName:(t,n,o)=>{((e,t)=>{const n=SO(e,t);e.formatter.toggle("fontname",{value:NO(n)}),e.nodeChanged()})(e,o)},FontSize:(t,n,o)=>{((e,t)=>{e.formatter.toggle("fontsize",{value:SO(e,t)}),e.nodeChanged()})(e,o)},LineHeight:(t,n,o)=>{((e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()})(e,o)},Lang:(e,n,o)=>{var r;t(e,{value:o.code,customValue:null!==(r=o.customCode)&&void 0!==r?r:null})},RemoveFormat:t=>{e.formatter.remove(t)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(e,n,o)=>{t(m(o)?o:"p")},mceToggleFormat:(e,n,o)=>{t(o)}})})(e),(e=>{const t=t=>e.formatter.match(t);e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>t(e),mceBlockQuote:()=>t("blockquote")},"state"),e.editorCommands.addQueryValueHandler("FontName",(()=>(e=>_O(e,(t=>EO(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("FontSize",(()=>(e=>_O(e,(t=>xO(e.getBody(),t.dom))).getOr(""))(e))),e.editorCommands.addQueryValueHandler("LineHeight",(()=>(e=>_O(e,(t=>{const n=Cn(e.getBody()),o=jb(t,(e=>fo(e,"line-height")),T(_n,n));return o.getOrThunk((()=>{const e=parseFloat(uo(t,"line-height")),n=parseFloat(uo(t,"font-size"));return String(e/n)}))})).getOr(""))(e)))})(e)})(e),(e=>{e.editorCommands.addCommands({mceRemoveNode:(t,n,o)=>{const r=null!=o?o:e.selection.getNode();if(r!==e.getBody()){const t=e.selection.getBookmark();e.dom.remove(r,!0),e.selection.moveToBookmark(t)}},mcePrint:()=>{e.getWin().print()},mceFocus:(t,n,o)=>{((e,t)=>{e.removed||(t?$g(e):(e=>{const t=e.selection,n=e.getBody();let o=t.getRng();e.quirks.refreshContentEditable(),C(e.bookmark)&&!jg(e)&&Ag(e).each((t=>{e.selection.setRng(t),o=t}));const r=((e,t)=>e.dom.getParent(t,(t=>"true"===e.dom.getContentEditable(t))))(e,t.getNode());if(r&&e.dom.isChildOf(r,n))return zg(r),Ug(e,o),void $g(e);e.inline||(Tt.browser.isOpera()||zg(n),e.getWin().focus()),(Tt.browser.isFirefox()||e.inline)&&(zg(n),Ug(e,o)),$g(e)})(e))})(e,!0===o)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})})(e)},TO=["toggleview"],OO=e=>H(TO,e.toLowerCase());class BO{constructor(e){this.commands={state:{},exec:{},value:{}},this.editor=e}execCommand(e,t=!1,n,o){const r=this.editor,s=e.toLowerCase(),a=null==o?void 0:o.skip_focus;if(r.removed)return!1;if("mcefocus"!==s&&(/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(s)||a?(e=>{Ag(e).each((t=>e.selection.setRng(t)))})(r):r.focus()),r.dispatch("BeforeExecCommand",{command:e,ui:t,value:n}).isDefaultPrevented())return!1;const i=this.commands.exec[s];return!!w(i)&&(i(s,t,n),r.dispatch("ExecCommand",{command:e,ui:t,value:n}),!0)}queryCommandState(e){if(!OO(e)&&this.editor.quirks.isHidden()||this.editor.removed)return!1;const t=e.toLowerCase(),n=this.commands.state[t];return!!w(n)&&n(t)}queryCommandValue(e){if(!OO(e)&&this.editor.quirks.isHidden()||this.editor.removed)return"";const t=e.toLowerCase(),n=this.commands.value[t];return w(n)?n(t):""}addCommands(e,t="exec"){const n=this.commands;pe(e,((e,o)=>{q(o.toLowerCase().split(","),(o=>{n[t][o]=e}))}))}addCommand(e,t,n){const o=e.toLowerCase();this.commands.exec[o]=(e,o,r)=>t.call(null!=n?n:this.editor,o,r)}queryCommandSupported(e){const t=e.toLowerCase();return!!this.commands.exec[t]}addQueryStateHandler(e,t,n){this.commands.state[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}addQueryValueHandler(e,t,n){this.commands.value[e.toLowerCase()]=()=>t.call(null!=n?n:this.editor)}}const PO="data-mce-contenteditable",DO=(e,t,n)=>{try{e.getDoc().execCommand(t,!1,String(n))}catch(e){}},LO=(e,t)=>{e.dom.contentEditable=t?"true":"false"},MO=e=>e.readonly,IO=e=>{e.parser.addAttributeFilter("contenteditable",(t=>{MO(e)&&q(t,(e=>{e.attr(PO,e.attr("contenteditable")),e.attr("contenteditable","false")}))})),e.serializer.addAttributeFilter(PO,(t=>{MO(e)&&q(t,(e=>{e.attr("contenteditable",e.attr(PO))}))})),e.serializer.addTempAttr(PO)},FO=["copy"],UO=Dt.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel"," ");class zO{static isNative(e){return!!UO[e.toLowerCase()]}constructor(e){this.bindings={},this.settings=e||{},this.scope=this.settings.scope||this,this.toggleEvent=this.settings.toggleEvent||L}fire(e,t){return this.dispatch(e,t)}dispatch(e,t){const n=e.toLowerCase(),o=Zs(n,null!=t?t:{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(o);const r=this.bindings[n];if(r)for(let e=0,t=r.length;e{this.toggleEvent(t,!1),delete this.bindings[t]})),this;if(s){if(t){const e=K(s,(e=>e.func===t));s=e.fail,this.bindings[r]=s,q(e.pass,(e=>{e.removed=!0}))}else s.length=0;s.length||(this.toggleEvent(e,!1),delete this.bindings[r])}}}else pe(this.bindings,((e,t)=>{this.toggleEvent(t,!1)})),this.bindings={};return this}once(e,t,n){return this.on(e,t,n,{once:!0})}has(e){e=e.toLowerCase();const t=this.bindings[e];return!(!t||0===t.length)}}const jO=e=>(e._eventDispatcher||(e._eventDispatcher=new zO({scope:e,toggleEvent:(t,n)=>{zO.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,n)}})),e._eventDispatcher),HO={fire(e,t,n){return this.dispatch(e,t,n)},dispatch(e,t,n){const o=this;if(o.removed&&"remove"!==e&&"detach"!==e)return Zs(e.toLowerCase(),null!=t?t:{},o);const r=jO(o).dispatch(e,t);if(!1!==n&&o.parent){let t=o.parent();for(;t&&!r.isPropagationStopped();)t.dispatch(e,r,!1),t=t.parent?t.parent():void 0}return r},on(e,t,n){return jO(this).on(e,t,n)},off(e,t){return jO(this).off(e,t)},once(e,t){return jO(this).once(e,t)},hasEventListeners(e){return jO(this).has(e)}},$O=fa.DOM;let VO;const qO=(e,t)=>{if("selectionchange"===t)return e.getDoc();if(!e.inline&&/^(?:mouse|touch|click|contextmenu|drop|dragover|dragend)/.test(t))return e.getDoc().documentElement;const n=xd(e);return n?(e.eventRoot||(e.eventRoot=$O.select(n)[0]),e.eventRoot):e.getBody()},WO=(e,t,n)=>{(e=>!e.hidden&&!MO(e))(e)?e.dispatch(t,n):MO(e)&&((e,t)=>{if((e=>"click"===e.type)(t)&&!Cf.metaKeyPressed(t)){const n=Cn(t.target);((e,t)=>oo(t,"a",(t=>_n(t,Cn(e.getBody())))).bind((e=>nn(e,"href"))))(e,n).each((n=>{if(t.preventDefault(),/^#/.test(n)){const t=e.dom.select(`${n},[name="${je(n,"#")}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else window.open(n,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes")}))}else(e=>H(FO,e.type))(t)&&e.dispatch(t.type,t)})(e,n)},KO=(e,t)=>{if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const n=qO(e,t);if(xd(e)){if(VO||(VO={},e.editorManager.on("removeEditor",(()=>{e.editorManager.activeEditor||VO&&(pe(VO,((t,n)=>{e.dom.unbind(qO(e,n))})),VO=null)}))),VO[t])return;const o=n=>{const o=n.target,r=e.editorManager.get();let s=r.length;for(;s--;){const e=r[s].getBody();(e===o||$O.isChildOf(o,e))&&WO(r[s],t,n)}};VO[t]=o,$O.bind(n,t,o)}else{const o=n=>{WO(e,t,n)};$O.bind(n,t,o),e.delegates[t]=o}},YO={...HO,bindPendingEventDelegates(){const e=this;Dt.each(e._pendingNativeEvents,(t=>{KO(e,t)}))},toggleNativeEvent(e,t){const n=this;"focus"!==e&&"blur"!==e&&(n.removed||(t?n.initialized?KO(n,e):n._pendingNativeEvents?n._pendingNativeEvents.push(e):n._pendingNativeEvents=[e]:n.initialized&&n.delegates&&(n.dom.unbind(qO(n,e),e,n.delegates[e]),delete n.delegates[e])))},unbindAllNativeEvents(){const e=this,t=e.getBody(),n=e.dom;e.delegates&&(pe(e.delegates,((t,n)=>{e.dom.unbind(qO(e,n),n,t)})),delete e.delegates),!e.inline&&t&&n&&(t.onload=null,n.unbind(e.getWin()),n.unbind(e.getDoc())),n&&(n.unbind(t),n.unbind(e.getContainer()))}},GO=e=>m(e)?{value:e.split(/[ ,]/),valid:!0}:E(e,m)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},XO=(e,t)=>e+(Xe(t.message)?"":`. ${t.message}`),ZO=e=>e.valid,QO=(e,t,n="")=>{const o=t(e);return b(o)?o?{value:e,valid:!0}:{valid:!1,message:n}:o},JO=["design","readonly"],eB=(e,t,n,o)=>{const r=n[t.get()],s=n[o];try{s.activate()}catch(e){return void console.error(`problem while activating editor mode ${o}:`,e)}r.deactivate(),r.editorReadOnly!==s.editorReadOnly&&((e,t)=>{const n=Cn(e.getBody());((e,t,n)=>{pn(e,t)&&!n?gn(e,t):n&&mn(e,t)})(n,"mce-content-readonly",t),t?(e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),(e=>{I.from(e.selection.getNode()).each((e=>{e.removeAttribute("data-mce-selected")}))})(e),e.readonly=!0,LO(n,!1),q(zo(n,'*[contenteditable="true"]'),(e=>{Jt(e,PO,"true"),LO(e,!1)}))):(e.readonly=!1,e.hasEditableRoot()&&LO(n,!0),q(zo(n,`*[${PO}="true"]`),(e=>{rn(e,PO),LO(e,!0)})),DO(e,"StyleWithCSS",!1),DO(e,"enableInlineTableEditing",!1),DO(e,"enableObjectResizing",!1),Hg(e)&&e.focus(),(e=>{e.selection.setRng(e.selection.getRng())})(e),e.nodeChanged())})(e,s.editorReadOnly),t.set(o),((e,t)=>{e.dispatch("SwitchMode",{mode:t})})(e,o)},tB=Dt.each,nB=Dt.explode,oB={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},rB=Dt.makeMap("alt,ctrl,shift,meta,access"),sB=e=>{const t={},n=Tt.os.isMacOS()||Tt.os.isiOS();tB(nB(e.toLowerCase(),"+"),(e=>{(e=>e in rB)(e)?t[e]=!0:/^[0-9]{2,}$/.test(e)?t.keyCode=parseInt(e,10):(t.charCode=e.charCodeAt(0),t.keyCode=oB[e]||e.toUpperCase().charCodeAt(0))}));const o=[t.keyCode];let r;for(r in rB)t[r]?o.push(r):t[r]=!1;return t.id=o.join(","),t.access&&(t.alt=!0,n?t.ctrl=!0:t.shift=!0),t.meta&&(n?t.meta=!0:(t.ctrl=!0,t.meta=!1)),t};class aB{constructor(e){this.shortcuts={},this.pendingPatterns=[],this.editor=e;const t=this;e.on("keyup keypress keydown",(e=>{!t.hasModifier(e)&&!t.isFunctionKey(e)||e.isDefaultPrevented()||(tB(t.shortcuts,(n=>{t.matchShortcut(e,n)&&(t.pendingPatterns=n.subpatterns.slice(0),"keydown"===e.type&&t.executeShortcutAction(n))})),t.matchShortcut(e,t.pendingPatterns[0])&&(1===t.pendingPatterns.length&&"keydown"===e.type&&t.executeShortcutAction(t.pendingPatterns[0]),t.pendingPatterns.shift()))}))}add(e,t,n,o){const r=this,s=r.normalizeCommandFunc(n);return tB(nB(Dt.trim(e)),(e=>{const n=r.createShortcut(e,t,s,o);r.shortcuts[n.id]=n})),!0}remove(e){const t=this.createShortcut(e);return!!this.shortcuts[t.id]&&(delete this.shortcuts[t.id],!0)}normalizeCommandFunc(e){const t=this,n=e;return"string"==typeof n?()=>{t.editor.execCommand(n,!1,null)}:Dt.isArray(n)?()=>{t.editor.execCommand(n[0],n[1],n[2])}:n}createShortcut(e,t,n,o){const r=Dt.map(nB(e,">"),sB);return r[r.length-1]=Dt.extend(r[r.length-1],{func:n,scope:o||this.editor}),Dt.extend(r[0],{desc:this.editor.translate(t),subpatterns:r.slice(1)})}hasModifier(e){return e.altKey||e.ctrlKey||e.metaKey}isFunctionKey(e){return"keydown"===e.type&&e.keyCode>=112&&e.keyCode<=123}matchShortcut(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)}executeShortcutAction(e){return e.func?e.func.call(e.scope):null}}const iB=()=>{const e=(()=>{const e={},t={},n={},o={},r={},s={},a={},i={},l=(e,t)=>(n,o)=>{e[n.toLowerCase()]={...o,type:t}};return{addButton:l(e,"button"),addGroupToolbarButton:l(e,"grouptoolbarbutton"),addToggleButton:l(e,"togglebutton"),addMenuButton:l(e,"menubutton"),addSplitButton:l(e,"splitbutton"),addMenuItem:l(t,"menuitem"),addNestedMenuItem:l(t,"nestedmenuitem"),addToggleMenuItem:l(t,"togglemenuitem"),addAutocompleter:l(n,"autocompleter"),addContextMenu:l(r,"contextmenu"),addContextToolbar:l(s,"contexttoolbar"),addContextForm:l(s,"contextform"),addSidebar:l(a,"sidebar"),addView:l(i,"views"),addIcon:(e,t)=>o[e.toLowerCase()]=t,getAll:()=>({buttons:e,menuItems:t,icons:o,popups:n,contextMenus:r,contextToolbars:s,sidebars:a,views:i})}})();return{addAutocompleter:e.addAutocompleter,addButton:e.addButton,addContextForm:e.addContextForm,addContextMenu:e.addContextMenu,addContextToolbar:e.addContextToolbar,addIcon:e.addIcon,addMenuButton:e.addMenuButton,addMenuItem:e.addMenuItem,addNestedMenuItem:e.addNestedMenuItem,addSidebar:e.addSidebar,addSplitButton:e.addSplitButton,addToggleButton:e.addToggleButton,addGroupToolbarButton:e.addGroupToolbarButton,addToggleMenuItem:e.addToggleMenuItem,addView:e.addView,getAll:e.getAll}},lB=fa.DOM,dB=Dt.extend,cB=Dt.each;class uB{constructor(e,t,n){this.plugins={},this.contentCSS=[],this.contentStyles=[],this.loadedCSS={},this.isNotDirty=!1,this.composing=!1,this.destroyed=!1,this.hasHiddenInput=!1,this.iframeElement=null,this.initialized=!1,this.readonly=!1,this.removed=!1,this.startContent="",this._pendingNativeEvents=[],this._skinLoaded=!1,this._editableRoot=!0,this.editorManager=n,this.documentBaseUrl=n.documentBaseURL,dB(this,YO);const o=this;this.id=e,this.hidden=!1;const r=((e,t)=>pO(lO||dO,lO,t,e,t))(n.defaultOptions,t);this.options=((e,t)=>{const n={},o={},r=(e,t,n)=>{const r=QO(t,n);return ZO(r)?(o[e]=r.value,!0):(console.warn(XO(`Invalid value passed for the ${e} option`,r)),!1)},s=e=>ke(n,e);return{register:(e,s)=>{const a=(e=>m(e.processor))(s)?(e=>{const t=(()=>{switch(e){case"array":return p;case"boolean":return b;case"function":return w;case"number":return x;case"object":return f;case"string":return m;case"string[]":return GO;case"object[]":return e=>E(e,f);case"regexp":return e=>u(e,RegExp);default:return M}})();return n=>QO(n,t,`The value must be a ${e}.`)})(s.processor):s.processor,i=((e,t,n)=>{if(!v(t)){const o=QO(t,n);if(ZO(o))return o.value;console.error(XO(`Invalid default value passed for the "${e}" option`,o))}})(e,s.default,a);n[e]={...s,default:i,processor:a},Ee(o,e).orThunk((()=>Ee(t,e))).each((t=>r(e,t,a)))},isRegistered:s,get:e=>Ee(o,e).orThunk((()=>Ee(n,e).map((e=>e.default)))).getOrUndefined(),set:(e,t)=>{if(s(e)){const o=n[e];return o.immutable?(console.error(`"${e}" is an immutable option and cannot be updated`),!1):r(e,t,o.processor)}return console.warn(`"${e}" is not a registered option. Ensure the option has been registered before setting a value.`),!1},unset:e=>{const t=s(e);return t&&delete o[e],t},isSet:e=>ke(o,e)}})(0,r),(e=>{const t=e.options.register;t("id",{processor:"string",default:e.id}),t("selector",{processor:"string"}),t("target",{processor:"object"}),t("suffix",{processor:"string"}),t("cache_suffix",{processor:"string"}),t("base_url",{processor:"string"}),t("referrer_policy",{processor:"string",default:""}),t("language_load",{processor:"boolean",default:!0}),t("inline",{processor:"boolean",default:!1}),t("iframe_attrs",{processor:"object",default:{}}),t("doctype",{processor:"string",default:""}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:Fl(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:Fl(e),default:""}),t("content_security_policy",{processor:"string",default:""}),t("br_in_pre",{processor:"boolean",default:!0}),t("forced_root_block",{processor:e=>{const t=m(e)&&Ge(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),t("forced_root_block_attrs",{processor:"object",default:{}}),t("newline_behavior",{processor:e=>{const t=H(["block","linebreak","invert","default"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),t("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),t("no_newline_selector",{processor:"string",default:""}),t("keep_styles",{processor:"boolean",default:!0}),t("end_container_on_empty_block",{processor:e=>b(e)||m(e)?{valid:!0,value:e}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),t("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),t("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),t("font_size_classes",{processor:"string",default:""}),t("automatic_uploads",{processor:"boolean",default:!0}),t("images_reuse_filename",{processor:"boolean",default:!1}),t("images_replace_blob_uris",{processor:"boolean",default:!0}),t("icons",{processor:"string",default:""}),t("icons_url",{processor:"string",default:""}),t("images_upload_url",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_credentials",{processor:"boolean",default:!1}),t("images_upload_handler",{processor:"function"}),t("language",{processor:"string",default:"en"}),t("language_url",{processor:"string",default:""}),t("entity_encoding",{processor:"string",default:"named"}),t("indent",{processor:"boolean",default:!0}),t("indent_before",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_after",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_use_margin",{processor:"boolean",default:!1}),t("indentation",{processor:"string",default:"40px"}),t("content_css",{processor:e=>{const t=!1===e||m(e)||E(e,m);return t?m(e)?{value:V(e.split(","),We),valid:t}:p(e)?{value:e,valid:t}:!1===e?{value:[],valid:t}:{value:e,valid:t}:{valid:!1,message:"Must be false, a string or an array of strings."}},default:Dd(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:e=>{const t=m(e)||E(e,m);return t?{value:p(e)?e:V(e.split(","),We),valid:t}:{valid:!1,message:"Must be a string or an array of strings."}},default:[]}),t("inline_boundaries",{processor:"boolean",default:!0}),t("inline_boundaries_selector",{processor:"string",default:"a[href],code,span.mce-annotation"}),t("object_resizing",{processor:e=>{const t=b(e)||m(e);return t?!1===e||Bl.isiPhone()||Bl.isiPad()?{value:"",valid:t}:{value:!0===e?"table,img,figure.image,div,video,iframe":e,valid:t}:{valid:!1,message:"Must be boolean or a string"}},default:!Pl}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"string"}),t("service_message",{processor:"string"}),t("theme",{processor:e=>!1===e||m(e)||w(e),default:"silver"}),t("theme_url",{processor:"string"}),t("formats",{processor:"object"}),t("format_empty_lines",{processor:"boolean",default:!1}),t("format_noneditable_selector",{processor:"string",default:""}),t("preview_styles",{processor:e=>{const t=!1===e||m(e);return t?{value:!1===e?"":e,valid:t}:{valid:!1,message:"Must be false or a string"}},default:"font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"}),t("custom_ui_selector",{processor:"string",default:""}),t("hidden_input",{processor:"boolean",default:!0}),t("submit_patch",{processor:"boolean",default:!0}),t("encoding",{processor:"string"}),t("add_form_submit_trigger",{processor:"boolean",default:!0}),t("add_unload_trigger",{processor:"boolean",default:!0}),t("custom_undo_redo_levels",{processor:"number",default:0}),t("disable_nodechange",{processor:"boolean",default:!1}),t("readonly",{processor:"boolean",default:!1}),t("editable_root",{processor:"boolean",default:!0}),t("plugins",{processor:"string[]",default:[]}),t("external_plugins",{processor:"object"}),t("forced_plugins",{processor:"string[]"}),t("model",{processor:"string",default:e.hasPlugin("rtc")?"plugin":"dom"}),t("model_url",{processor:"string"}),t("block_unsupported_drop",{processor:"boolean",default:!0}),t("visual",{processor:"boolean",default:!0}),t("visual_table_class",{processor:"string",default:"mce-item-table"}),t("visual_anchor_class",{processor:"string",default:"mce-item-anchor"}),t("iframe_aria_text",{processor:"string",default:"Rich Text Area. Press ALT-0 for help."}),t("setup",{processor:"function"}),t("init_instance_callback",{processor:"function"}),t("url_converter",{processor:"function",default:e.convertURL}),t("url_converter_scope",{processor:"object",default:e}),t("urlconverter_callback",{processor:"function"}),t("allow_conditional_comments",{processor:"boolean",default:!1}),t("allow_html_data_urls",{processor:"boolean",default:!1}),t("allow_svg_data_urls",{processor:"boolean"}),t("allow_html_in_named_anchor",{processor:"boolean",default:!1}),t("allow_script_urls",{processor:"boolean",default:!1}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("convert_fonts_to_spans",{processor:"boolean",default:!0,deprecated:!0}),t("fix_list_elements",{processor:"boolean",default:!1}),t("preserve_cdata",{processor:"boolean",default:!1}),t("remove_trailing_brs",{processor:"boolean",default:!0}),t("pad_empty_with_br",{processor:"boolean",default:!1}),t("inline_styles",{processor:"boolean",default:!0,deprecated:!0}),t("element_format",{processor:"string",default:"html"}),t("entities",{processor:"string"}),t("schema",{processor:"string",default:"html5"}),t("convert_urls",{processor:"boolean",default:!0}),t("relative_urls",{processor:"boolean",default:!0}),t("remove_script_host",{processor:"boolean",default:!0}),t("custom_elements",{processor:Il}),t("extended_valid_elements",{processor:"string"}),t("invalid_elements",{processor:"string"}),t("invalid_styles",{processor:Il}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:Il}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:Il}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:e=>m(e)||!0===e}),t("browser_spellcheck",{processor:"boolean",default:!1}),t("protect",{processor:"array"}),t("images_file_types",{processor:"string",default:"jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"}),t("deprecation_warnings",{processor:"boolean",default:!0}),t("a11y_advanced_options",{processor:"boolean",default:!1}),t("api_key",{processor:"string"}),t("license_key",{processor:"string"}),t("paste_block_drop",{processor:"boolean",default:!1}),t("paste_data_images",{processor:"boolean",default:!0}),t("paste_preprocess",{processor:"function"}),t("paste_postprocess",{processor:"function"}),t("paste_webkit_styles",{processor:"string",default:"none"}),t("paste_remove_styles_if_webkit",{processor:"boolean",default:!0}),t("paste_merge_formats",{processor:"boolean",default:!0}),t("smart_paste",{processor:"boolean",default:!0}),t("paste_as_text",{processor:"boolean",default:!1}),t("paste_tab_spaces",{processor:"number",default:4}),t("text_patterns",{processor:e=>E(e,f)||!1===e?{value:Ol(!1===e?[]:e),valid:!0}:{valid:!1,message:"Must be an array of objects or false."},default:[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1",trigger:"space"},{start:"##",format:"h2",trigger:"space"},{start:"###",format:"h3",trigger:"space"},{start:"####",format:"h4",trigger:"space"},{start:"#####",format:"h5",trigger:"space"},{start:"######",format:"h6",trigger:"space"},{start:"1.",cmd:"InsertOrderedList",trigger:"space"},{start:"*",cmd:"InsertUnorderedList",trigger:"space"},{start:"-",cmd:"InsertUnorderedList",trigger:"space"},{start:">",cmd:"mceBlockQuote",trigger:"space"},{start:"---",cmd:"InsertHorizontalRule",trigger:"space"}]}),t("text_patterns_lookup",{processor:e=>{return w(e)?{value:(t=e,e=>{const n=t(e);return Ol(n)}),valid:!0}:{valid:!1,message:"Must be a single function"};var t},default:e=>[]}),t("noneditable_class",{processor:"string",default:"mceNonEditable"}),t("editable_class",{processor:"string",default:"mceEditable"}),t("noneditable_regexp",{processor:e=>E(e,Ll)?{value:e,valid:!0}:Ll(e)?{value:[e],valid:!0}:{valid:!1,message:"Must be a RegExp or an array of RegExp."},default:[]}),t("table_tab_navigation",{processor:"boolean",default:!0}),t("highlight_on_focus",{processor:"boolean",default:!0}),t("xss_sanitization",{processor:"boolean",default:!0}),t("details_initial_state",{processor:e=>{const t=H(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("details_serialized_state",{processor:e=>{const t=H(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("init_content_sync",{processor:"boolean",default:!1}),t("newdocument_content",{processor:"string",default:""}),t("sandbox_iframes",{processor:"boolean",default:!0}),t("sandbox_iframes_exclusions",{processor:"string[]",default:["youtube.com","youtu.be","vimeo.com","player.vimeo.com","dailymotion.com","embed.music.apple.com","open.spotify.com","giphy.com","dai.ly","codepen.io"]}),t("convert_unsafe_embeds",{processor:"boolean",default:!0}),e.on("ScriptsLoaded",(()=>{t("directionality",{processor:"string",default:ya.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:Dl.getAttrib(e.getElement(),"placeholder")})}))})(o);const s=this.options.get;s("deprecation_warnings")&&((e,t)=>{((e,t)=>{const n=xw(e),o=_w(t),r=o.length>0,s=n.length>0,a="mobile"===t.theme;if(r||s||a){const e="\n- ",t=a?`\n\nThemes:${e}mobile`:"",i=r?`\n\nPlugins:${e}${o.join(e)}`:"",l=s?`\n\nOptions:${e}${n.join(e)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 7.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/7/migration-from-6x/ for more information."+t+i+l)}})(e,t),((e,t)=>{const n=Ew(e),o=Sw(t),r=o.length>0,s=n.length>0;if(r||s){const e="\n- ",t=r?`\n\nPlugins:${e}${o.map(Nw).join(e)}`:"",a=s?`\n\nOptions:${e}${n.join(e)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+t+a)}})(e,t)})(t,r);const a=s("suffix");a&&(n.suffix=a),this.suffix=n.suffix;const i=s("base_url");i&&n._setBaseUrl(i),this.baseUri=n.baseURI;const l=dd(o);l&&(pa.ScriptLoader._setReferrerPolicy(l),fa.DOM.styleSheetLoader._setReferrerPolicy(l));const d=$d(o);C(d)&&fa.DOM.styleSheetLoader._setContentCssCors(d),Ca.languageLoad=s("language_load"),Ca.baseURL=n.baseURL,this.setDirty(!1),this.documentBaseURI=new cC(jl(o),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=Dd(o),this.hasVisual=Kd(o),this.shortcuts=new aB(this),this.editorCommands=new BO(this),AO(this);const c=s("cache_suffix");c&&(Tt.cacheSuffix=c.replace(/^[\?\&]+/,"")),this.ui={registry:iB(),styleSheetLoader:void 0,show:k,hide:k,setEnabled:k,isEnabled:M},this.mode=(e=>{const t=Br("design"),n=Br({design:{activate:k,deactivate:k,editorReadOnly:!1},readonly:{activate:k,deactivate:k,editorReadOnly:!0}});return(e=>{e.serializer?IO(e):e.on("PreInit",(()=>{IO(e)}))})(e),(e=>{e.on("ShowCaret",(t=>{MO(e)&&t.preventDefault()})),e.on("ObjectSelected",(t=>{MO(e)&&t.preventDefault()}))})(e),{isReadOnly:()=>MO(e),set:o=>((e,t,n,o)=>{if(o!==n.get()){if(!ke(t,o))throw new Error(`Editor mode '${o}' is invalid`);e.initialized?eB(e,n,t,o):e.on("init",(()=>eB(e,n,t,o)))}})(e,n.get(),t,o),get:()=>t.get(),register:(e,t)=>{n.set(((e,t,n)=>{if(H(JO,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...n,deactivate:()=>{try{n.deactivate()}catch(e){console.error(`problem while deactivating editor mode ${t}:`,e)}}}}})(n.get(),e,t))}}})(o),n.dispatch("SetupEditor",{editor:this});const g=Zd(o);w(g)&&g.call(o,o)}render(){(e=>{const t=e.id;ya.setCode(cd(e));const n=()=>{oO.unbind(window,"ready",n),e.render()};if(!oa.Event.domLoaded)return void oO.bind(window,"ready",n);if(!e.getElement())return;const o=Cn(e.getElement()),r=sn(o);e.on("remove",(()=>{W(o.dom.attributes,(e=>rn(o,e.name))),en(o,r)})),e.ui.styleSheetLoader=((e,t)=>rs.forElement(e,{contentCssCors:$d(t),referrerPolicy:dd(t)}))(o,e),Dd(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const s=e.getElement().form||oO.getParent(t,"form");s&&(e.formElement=s,Ld(e)&&!lr(e.getElement())&&(oO.insertAfter(oO.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=t=>{e.dispatch(t.type,t)},oO.bind(s,"submit reset",e.formEventDelegate),e.on("reset",(()=>{e.resetContent()})),!Md(e)||s.submit.nodeType||s.submit.length||s._mceOldSubmit||(s._mceOldSubmit=s.submit,s.submit=()=>(e.editorManager.triggerSave(),e.setDirty(!1),s._mceOldSubmit(s)))),e.windowManager=jw(e),e.notificationManager=Fw(e),(e=>"xml"===e.options.get("encoding"))(e)&&e.on("GetContent",(e=>{e.save&&(e.content=oO.encode(e.content))})),Id(e)&&e.on("submit",(()=>{e.initialized&&e.save()})),Fd(e)&&(e._beforeUnload=()=>{!e.initialized||e.destroyed||e.isHidden()||e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),aO(e,e.suffix)})(this)}focus(e){this.execCommand("mceFocus",!1,e)}hasFocus(){return jg(this)}translate(e){return ya.translate(e)}getParam(e,t,n){const o=this.options;return o.isRegistered(e)||(C(n)?o.register(e,{processor:n,default:t}):o.register(e,{processor:M,default:t})),o.isSet(e)||v(t)?o.get(e):t}hasPlugin(e,t){return!(!H(Vd(this),e)||t&&void 0===Uw.get(e))}nodeChanged(e){this._nodeChangeDispatcher.nodeChanged(e)}addCommand(e,t,n){this.editorCommands.addCommand(e,t,n)}addQueryStateHandler(e,t,n){this.editorCommands.addQueryStateHandler(e,t,n)}addQueryValueHandler(e,t,n){this.editorCommands.addQueryValueHandler(e,t,n)}addShortcut(e,t,n,o){this.shortcuts.add(e,t,n,o)}execCommand(e,t,n,o){return this.editorCommands.execCommand(e,t,n,o)}queryCommandState(e){return this.editorCommands.queryCommandState(e)}queryCommandValue(e){return this.editorCommands.queryCommandValue(e)}queryCommandSupported(e){return this.editorCommands.queryCommandSupported(e)}show(){const e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable="true":(lB.show(e.getContainer()),lB.hide(e.id)),e.load(),e.dispatch("show"))}hide(){const e=this;e.hidden||(e.save(),e.inline?(e.getBody().contentEditable="false",e===e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(lB.hide(e.getContainer()),lB.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.dispatch("hide"))}isHidden(){return this.hidden}setProgressState(e,t){this.dispatch("ProgressState",{state:e,time:t})}load(e={}){const t=this,n=t.getElement();if(t.removed)return"";if(n){const o={...e,load:!0},r=lr(n)?n.value:n.innerHTML,s=t.setContent(r,o);return o.no_events||t.dispatch("LoadContent",{...o,element:n}),s}return""}save(e={}){const t=this;let n=t.getElement();if(!n||!t.initialized||t.removed)return"";const o={...e,save:!0,element:n};let r=t.getContent(o);const s={...o,content:r};if(s.no_events||t.dispatch("SaveContent",s),"raw"===s.format&&t.dispatch("RawSaveContent",s),r=s.content,lr(n))n.value=r;else{!e.is_removing&&t.inline||(n.innerHTML=r);const o=lB.getParent(t.id,"form");o&&cB(o.elements,(e=>e.name!==t.id||(e.value=r,!1)))}return s.element=o.element=n=null,!1!==s.set_dirty&&t.setDirty(!1),r}setContent(e,t){return hw(this,e,t)}getContent(e){return((e,t={})=>{const n=((e,t)=>({...e,format:t,get:!0,getInner:!0}))(t,t.format?t.format:"html");return NC(e,n).fold(R,(t=>{const n=((e,t)=>sw(e).editor.getContent(t))(e,t);return RC(e,n,t)}))})(this,e)}insertContent(e,t){t&&(e=dB({content:e},t)),this.execCommand("mceInsertContent",!1,e)}resetContent(e){void 0===e?hw(this,this.startContent,{format:"raw"}):hw(this,e),this.undoManager.reset(),this.setDirty(!1),this.nodeChanged()}isDirty(){return!this.isNotDirty}setDirty(e){const t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.dispatch("dirty")}getContainer(){const e=this;return e.container||(e.container=e.editorContainer||lB.get(e.id+"_parent")),e.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=lB.get(this.id)),this.targetElm}getWin(){const e=this;if(!e.contentWindow){const t=e.iframeElement;t&&(e.contentWindow=t.contentWindow)}return e.contentWindow}getDoc(){const e=this;if(!e.contentDocument){const t=e.getWin();t&&(e.contentDocument=t.document)}return e.contentDocument}getBody(){var e,t;const n=this.getDoc();return null!==(t=null!==(e=this.bodyElement)&&void 0!==e?e:null==n?void 0:n.body)&&void 0!==t?t:null}convertURL(e,t,n){const o=this,r=o.options.get,s=Jd(o);if(w(s))return s.call(o,e,n,!0,t);if(!r("convert_urls")||"link"===n||f(n)&&"LINK"===n.nodeName||0===e.indexOf("file:")||0===e.length)return e;const a=new cC(e);return"http"!==a.protocol&&"https"!==a.protocol&&""!==a.protocol?e:r("relative_urls")?o.documentBaseURI.toRelative(e):e=o.documentBaseURI.toAbsolute(e,r("remove_script_host"))}addVisual(e){((e,t)=>{((e,t)=>{aw(e).editor.addVisual(t)})(e,t)})(this,e)}setEditableRoot(e){((e,t)=>{e._editableRoot!==t&&(e._editableRoot=t,e.readonly||(e.getBody().contentEditable=String(e.hasEditableRoot()),e.nodeChanged()),((e,t)=>{e.dispatch("EditableRootStateChange",{state:t})})(e,t))})(this,e)}hasEditableRoot(){return this._editableRoot}remove(){(e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:n}=e,o=e.getBody(),r=e.getElement();o&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&C(null==r?void 0:r.nextSibling)&&Rw.remove(r.nextSibling),(e=>{e.dispatch("remove")})(e),e.editorManager.remove(e),!e.inline&&o&&(e=>{Rw.setStyle(e.id,"display",e.orgDisplay)})(e),(e=>{e.dispatch("detach")})(e),Rw.remove(e.getContainer()),Aw(t),Aw(n),e.destroy()}})(this)}destroy(e){((e,t)=>{const{selection:n,dom:o}=e;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),Aw(n),Aw(o)),(e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,delete t._mceOldSubmit),Rw.unbind(t,"submit reset",e.formEventDelegate))})(e),(e=>{const t=e;t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null;const n=e.selection;if(n){const e=n.dom;t.selection=n.win=n.dom=e.doc=null}})(e),e.destroyed=!0):e.remove())})(this,e)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const mB=fa.DOM,fB=Dt.each;let gB,pB=!1,hB=[];const bB=e=>{const t=e.type;fB(wB.get(),(n=>{switch(t){case"scroll":n.dispatch("ScrollWindow",e);break;case"resize":n.dispatch("ResizeWindow",e)}}))},vB=e=>{if(e!==pB){const t=fa.DOM;e?(t.bind(window,"resize",bB),t.bind(window,"scroll",bB)):(t.unbind(window,"resize",bB),t.unbind(window,"scroll",bB)),pB=e}},yB=e=>{const t=hB;return hB=Y(hB,(t=>e!==t)),wB.activeEditor===e&&(wB.activeEditor=hB.length>0?hB[0]:null),wB.focusedEditor===e&&(wB.focusedEditor=null),t.length!==hB.length},CB="CSS1Compat"!==document.compatMode,wB={...HO,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"7",minorVersion:"1.1",releaseDate:"2024-05-22",i18n:ya,activeEditor:null,focusedEditor:null,setup(){const e=this;let t="",n="",o=cC.getDocumentBaseUrl(document.location);/^[^:]+:\/\/\/?[^\/]+\//.test(o)&&(o=o.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(o)||(o+="/"));const r=window.tinymce||window.tinyMCEPreInit;if(r)t=r.base||r.baseURL,n=r.suffix;else{const e=document.getElementsByTagName("script");for(let o=0;o{Ca.PluginManager.urls[t]=e}))},init(e){const t=this;let n;const o=Dt.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu"," ");let r=e=>{n=e};const s=()=>{let n=0;const a=[];let i;mB.unbind(window,"ready",s),(n=>{const o=e.onpageload;o&&o.apply(t,[])})(),i=me((e=>Tt.browser.isIE()||Tt.browser.isEdge()?(Ww("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tiny.cloud/docs/tinymce/7/support/#supportedwebbrowsers"),[]):CB?(Ww("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):m(e.selector)?mB.select(e.selector):C(e.target)?[e.target]:[])(e)),Dt.each(i,(e=>{var n;(n=t.get(e.id))&&n.initialized&&!(n.getContainer()||n.getBody()).parentNode&&(yB(n),n.unbindAllNativeEvents(),n.destroy(!0),n.removed=!0)})),i=Dt.grep(i,(e=>!t.get(e.id))),0===i.length?r([]):fB(i,(s=>{((e,t)=>e.inline&&t.tagName.toLowerCase()in o)(e,s)?Ww("Could not initialize inline editor on invalid inline target element",s):((e,o,s)=>{const l=new uB(e,o,t);a.push(l),l.on("init",(()=>{++n===i.length&&r(a)})),l.targetElm=l.targetElm||s,l.render()})((e=>{let t=e.id;return t||(t=Ee(e,"name").filter((e=>!mB.get(e))).getOrThunk(mB.uniqueId),e.setAttribute("id",t)),t})(s),e,s)}))};return mB.bind(window,"ready",s),new Promise((e=>{n?e(n):r=t=>{e(t)}}))},get(e){return 0===arguments.length?hB.slice(0):m(e)?Q(hB,(t=>t.id===e)).getOr(null):x(e)&&hB[e]?hB[e]:null},add(e){const t=this,n=t.get(e.id);return n===e||(null===n&&hB.push(e),vB(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),gB||(gB=e=>{const n=t.dispatch("BeforeUnload");if(n.returnValue)return e.preventDefault(),e.returnValue=n.returnValue,n.returnValue},window.addEventListener("beforeunload",gB))),e},createEditor(e,t){return this.add(new uB(e,t,this))},remove(e){const t=this;let n;if(e){if(!m(e))return n=e,h(t.get(n.id))?null:(yB(n)&&t.dispatch("RemoveEditor",{editor:n}),0===hB.length&&window.removeEventListener("beforeunload",gB),n.remove(),vB(hB.length>0),n);fB(mB.select(e),(e=>{n=t.get(e.id),n&&t.remove(n)}))}else for(let e=hB.length-1;e>=0;e--)t.remove(hB[e])},execCommand(e,t,n){var o;const r=this,s=f(n)?null!==(o=n.id)&&void 0!==o?o:n.index:n;switch(e){case"mceAddEditor":if(!r.get(s)){const e=n.options;new uB(s,e,r).render()}return!0;case"mceRemoveEditor":{const e=r.get(s);return e&&e.remove(),!0}case"mceToggleEditor":{const e=r.get(s);return e?(e.isHidden()?e.show():e.hide(),!0):(r.execCommand("mceAddEditor",!1,n),!0)}}return!!r.activeEditor&&r.activeEditor.execCommand(e,t,n)},triggerSave:()=>{fB(hB,(e=>{e.save()}))},addI18n:(e,t)=>{ya.add(e,t)},translate:e=>ya.translate(e),setActive(e){const t=this.activeEditor;this.activeEditor!==e&&(t&&t.dispatch("deactivate",{relatedTarget:e}),e.dispatch("activate",{relatedTarget:t})),this.activeEditor=e},_setBaseUrl(e){this.baseURL=new cC(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new cC(this.baseURL)}};wB.setup();const xB=(()=>{const e=Dr();return{FakeClipboardItem:e=>({items:e,types:fe(e),getType:t=>Ee(e,t).getOrUndefined()}),write:t=>{e.set(t)},read:()=>e.get().getOrUndefined(),clear:e.clear}})(),EB=Math.min,kB=Math.max,_B=Math.round,SB=(e,t,n)=>{let o=t.x,r=t.y;const s=e.w,a=e.h,i=t.w,l=t.h,d=(n||"").split("");return"b"===d[0]&&(r+=l),"r"===d[1]&&(o+=i),"c"===d[0]&&(r+=_B(l/2)),"c"===d[1]&&(o+=_B(i/2)),"b"===d[3]&&(r-=a),"r"===d[4]&&(o-=s),"c"===d[3]&&(r-=_B(a/2)),"c"===d[4]&&(o-=_B(s/2)),NB(o,r,s,a)},NB=(e,t,n,o)=>({x:e,y:t,w:n,h:o}),RB={inflate:(e,t,n)=>NB(e.x-t,e.y-n,e.w+2*t,e.h+2*n),relativePosition:SB,findBestRelativePosition:(e,t,n,o)=>{for(let r=0;r=n.x&&s.x+s.w<=n.w+n.x&&s.y>=n.y&&s.y+s.h<=n.h+n.y)return o[r]}return null},intersect:(e,t)=>{const n=kB(e.x,t.x),o=kB(e.y,t.y),r=EB(e.x+e.w,t.x+t.w),s=EB(e.y+e.h,t.y+t.h);return r-n<0||s-o<0?null:NB(n,o,r-n,s-o)},clamp:(e,t,n)=>{let o=e.x,r=e.y,s=e.x+e.w,a=e.y+e.h;const i=t.x+t.w,l=t.y+t.h,d=kB(0,t.x-o),c=kB(0,t.y-r),u=kB(0,s-i),m=kB(0,a-l);return o+=d,r+=c,n&&(s+=d,a+=c,o-=u,r-=m),s-=u,a-=m,NB(o,r,s-o,a-r)},create:NB,fromClientRect:e=>NB(e.left,e.top,e.width,e.height)},AB=(()=>{const e={},t={},n={};return{load:(n,o)=>{const r=`Script at URL "${o}" failed to load`,s=`Script at URL "${o}" did not call \`tinymce.Resource.add('${n}', data)\` within 1 second`;if(void 0!==e[n])return e[n];{const a=new Promise(((e,a)=>{const i=((e,t,n=1e3)=>{let o=!1,r=null;const s=e=>(...t)=>{o||(o=!0,null!==r&&(clearTimeout(r),r=null),e.apply(null,t))},a=s(e),i=s(t);return{start:(...e)=>{o||null!==r||(r=setTimeout((()=>i.apply(null,e)),n))},resolve:a,reject:i}})(e,a);t[n]=i.resolve,pa.ScriptLoader.loadScript(o).then((()=>i.start(s)),(()=>i.reject(r)))}));return e[n]=a,a}},add:(o,r)=>{void 0!==t[o]&&(t[o](r),delete t[o]),e[o]=Promise.resolve(r),n[o]=r},has:e=>e in n,get:e=>n[e],unload:t=>{delete e[t],delete n[t]}}})();let TB;try{const e="__storage_test__";TB=window.localStorage,TB.setItem(e,e),TB.removeItem(e)}catch(e){TB=(()=>{let e={},t=[];const n={getItem:t=>e[t]||null,setItem:(n,o)=>{t.push(n),e[n]=String(o)},key:e=>t[e],removeItem:n=>{t=t.filter((e=>e===n)),delete e[n]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(n,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),n})()}const OB={geom:{Rect:RB},util:{Delay:Og,Tools:Dt,VK:Cf,URI:cC,EventDispatcher:zO,Observable:HO,I18n:ya,LocalStorage:TB,ImageUploader:e=>{const t=Xw(),n=ex(e,t);return{upload:(t,o=!0)=>n.upload(t,o?Jw(e):void 0)}}},dom:{EventUtils:oa,TreeWalker:Vo,TextSeeker:za,DOMUtils:fa,ScriptLoader:pa,RangeUtils:Qf,Serializer:pw,StyleSheetLoader:os,ControlSelection:_f,BookmarkManager:uf,Selection:mw,Event:oa.Event},html:{Styles:Ys,Entities:ws,Node:ep,Schema:Fs,DomParser:kC,Writer:vp,Serializer:yp},Env:Tt,AddOnManager:Ca,Annotator:cf,Formatter:mx,UndoManager:gx,EditorCommands:BO,WindowManager:jw,NotificationManager:Fw,EditorObservable:YO,Shortcuts:aB,Editor:uB,FocusManager:Tg,EditorManager:wB,DOM:fa.DOM,ScriptLoader:pa.ScriptLoader,PluginManager:Uw,ThemeManager:zw,ModelManager:Ow,IconManager:Tw,Resource:AB,FakeClipboard:xB,trim:Dt.trim,isArray:Dt.isArray,is:Dt.is,toArray:Dt.toArray,makeMap:Dt.makeMap,each:Dt.each,map:Dt.map,grep:Dt.grep,inArray:Dt.inArray,extend:Dt.extend,walk:Dt.walk,resolve:Dt.resolve,explode:Dt.explode,_addCacheSuffix:Dt._addCacheSuffix},BB=Dt.extend(wB,OB);(e=>{window.tinymce=e,window.tinyMCE=e})(BB),(e=>{if("object"==typeof module)try{module.exports=e}catch(e){}})(BB)}();
\ No newline at end of file
diff --git a/resources/tinymce/7.1.1/icons/default/icons.min.jsm b/resources/tinymce/7.1.2/icons/default/icons.min.jsm
similarity index 100%
rename from resources/tinymce/7.1.1/icons/default/icons.min.jsm
rename to resources/tinymce/7.1.2/icons/default/icons.min.jsm
diff --git a/resources/tinymce/7.1.1/models/dom/model.min.jsm b/resources/tinymce/7.1.2/models/dom/model.min.jsm
similarity index 99%
rename from resources/tinymce/7.1.1/models/dom/model.min.jsm
rename to resources/tinymce/7.1.2/models/dom/model.min.jsm
index ddd3547f..03e2406e 100644
--- a/resources/tinymce/7.1.1/models/dom/model.min.jsm
+++ b/resources/tinymce/7.1.2/models/dom/model.min.jsm
@@ -1,4 +1,4 @@
/**
- * TinyMCE version 7.1.1 (2024-05-22)
+ * TinyMCE version 7.1.2 (TBD)
*/
!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/resources/tinymce/7.1.1/skins/content/dark/content.min.css b/resources/tinymce/7.1.2/skins/content/dark/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/content/dark/content.min.css
rename to resources/tinymce/7.1.2/skins/content/dark/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/content/default/content.min.css b/resources/tinymce/7.1.2/skins/content/default/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/content/default/content.min.css
rename to resources/tinymce/7.1.2/skins/content/default/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/content/document/content.min.css b/resources/tinymce/7.1.2/skins/content/document/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/content/document/content.min.css
rename to resources/tinymce/7.1.2/skins/content/document/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/content/tinymce-5-dark/content.min.css b/resources/tinymce/7.1.2/skins/content/tinymce-5-dark/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/content/tinymce-5-dark/content.min.css
rename to resources/tinymce/7.1.2/skins/content/tinymce-5-dark/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/content/tinymce-5/content.min.css b/resources/tinymce/7.1.2/skins/content/tinymce-5/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/content/tinymce-5/content.min.css
rename to resources/tinymce/7.1.2/skins/content/tinymce-5/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/content/writer/content.min.css b/resources/tinymce/7.1.2/skins/content/writer/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/content/writer/content.min.css
rename to resources/tinymce/7.1.2/skins/content/writer/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide-dark/content.inline.min.css b/resources/tinymce/7.1.2/skins/ui/oxide-dark/content.inline.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide-dark/content.inline.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide-dark/content.inline.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide-dark/content.min.css b/resources/tinymce/7.1.2/skins/ui/oxide-dark/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide-dark/content.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide-dark/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide-dark/skin.min.css b/resources/tinymce/7.1.2/skins/ui/oxide-dark/skin.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide-dark/skin.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide-dark/skin.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide-dark/skin.shadowdom.min.css b/resources/tinymce/7.1.2/skins/ui/oxide-dark/skin.shadowdom.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide-dark/skin.shadowdom.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide-dark/skin.shadowdom.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide/content.inline.min.css b/resources/tinymce/7.1.2/skins/ui/oxide/content.inline.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide/content.inline.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide/content.inline.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide/content.min.css b/resources/tinymce/7.1.2/skins/ui/oxide/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide/content.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide/skin.min.css b/resources/tinymce/7.1.2/skins/ui/oxide/skin.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide/skin.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide/skin.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/oxide/skin.shadowdom.min.css b/resources/tinymce/7.1.2/skins/ui/oxide/skin.shadowdom.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/oxide/skin.shadowdom.min.css
rename to resources/tinymce/7.1.2/skins/ui/oxide/skin.shadowdom.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/content.inline.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/content.inline.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/content.inline.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/content.inline.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/content.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/content.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/skin.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/skin.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/skin.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/skin.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/skin.shadowdom.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/skin.shadowdom.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5-dark/skin.shadowdom.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5-dark/skin.shadowdom.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5/content.inline.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5/content.inline.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5/content.inline.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5/content.inline.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5/content.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5/content.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5/content.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5/content.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5/skin.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5/skin.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5/skin.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5/skin.min.css
diff --git a/resources/tinymce/7.1.1/skins/ui/tinymce-5/skin.shadowdom.min.css b/resources/tinymce/7.1.2/skins/ui/tinymce-5/skin.shadowdom.min.css
similarity index 100%
rename from resources/tinymce/7.1.1/skins/ui/tinymce-5/skin.shadowdom.min.css
rename to resources/tinymce/7.1.2/skins/ui/tinymce-5/skin.shadowdom.min.css
diff --git a/resources/tinymce/7.1.2/themes/silver/theme.min.jsm b/resources/tinymce/7.1.2/themes/silver/theme.min.jsm
new file mode 100644
index 00000000..081337eb
--- /dev/null
+++ b/resources/tinymce/7.1.2/themes/silver/theme.min.jsm
@@ -0,0 +1,4 @@
+/**
+ * TinyMCE version 7.1.2 (TBD)
+ */
+!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,((t,o)=>e(t)===o)))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o{},v=e=>()=>e(),y=(e,t)=>(...o)=>e(t.apply(null,o)),x=e=>()=>e,w=e=>e,S=(e,t)=>e===t;function k(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const C=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=x(!1),E=x(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.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:A.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 g(e)?A.some(e):A.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()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,D=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>D.call(e,t),F=(e,t)=>I(e,t)>-1,R=(e,t)=>{for(let o=0,n=e.length;o{const o=[];for(let n=0;n{const o=[];for(let n=0;n{const o=e.length,n=new Array(o);for(let s=0;s{for(let o=0,n=e.length;o{const o=[],n=[];for(let s=0,r=e.length;s{const o=[];for(let n=0,s=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),W=(e,t,o)=>(V(e,((e,n)=>{o=t(o,e,n)})),o),j=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n{for(let o=0,n=e.length;o{const t=[];for(let o=0,n=e.length;oG(z(e,t)),Y=(e,t)=>{for(let o=0,n=e.length;o{const t=M.call(e,0);return t.reverse(),t},K=(e,t)=>P(e,(e=>!F(t,e))),J=(e,t)=>{const o={};for(let n=0,s=e.length;n[e],Q=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&tee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>M.call(e),se=(e,t)=>{for(let o=0;o{const o=re(e);for(let n=0,s=o.length;nce(e,((e,o)=>({k:o,v:t(e,o)}))),ce=(e,t)=>{const o={};return ie(e,((e,n)=>{const s=t(e,n);o[s.k]=s.v})),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ie(e,((e,s)=>{(t(e,s)?o:n)(e,s)}))},me=(e,t)=>{const o={};return ue(e,t,de(o),b),o},ge=(e,t)=>{const o=[];return ie(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=re(e);for(let n=0,s=o.length;nge(e,w),fe=(e,t)=>be(e,t)?A.from(e[t]):A.none(),be=(e,t)=>ae.call(e,t),ve=(e,t)=>be(e,t)&&void 0!==e[t]&&null!==e[t],ye=(e,t,o=S)=>e.exists((e=>o(e,t))),xe=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;te.isSome()&&t.isSome()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),Se=(e,t)=>null!=e?A.some(t(e)):A.none(),ke=(e,t)=>e?A.some(t):A.none(),Ce=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Oe=(e,t)=>Te(e,t)?((e,t)=>e.substring(t))(e,t.length):e,_e=(e,t,o=0,n)=>{const s=e.indexOf(t,o);return-1!==s&&(!!u(n)||s+t.length<=n)},Te=(e,t)=>Ce(e,t,0),Ee=(e,t)=>Ce(e,t,e.length-t.length),Ae=(Mo=/^\s+|\s+$/g,e=>e.replace(Mo,"")),Me=e=>e.length>0,De=e=>!Me(e),Be=e=>void 0!==e.style&&p(e.style.getPropertyValue),Ie=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Fe=(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 Ie(o.childNodes[0])},Re=(e,t)=>{const o=(t||document).createElement(e);return Ie(o)},Ne=(e,t)=>{const o=(t||document).createTextNode(e);return Ie(o)},Le=Ie,ze="undefined"!=typeof window?window:Function("return this;")(),Ve=(e,t)=>((e,t)=>{let o=null!=t?t:ze;for(let t=0;t{const t=Ve("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const o=((e,t)=>Ve(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(He(e).constructor.name))},Ue=e=>e.dom.nodeName.toLowerCase(),We=e=>t=>(e=>e.dom.nodeType)(t)===e,je=e=>$e(e)&&Pe(e.dom),$e=We(1),Ge=We(3),qe=We(9),Ye=We(11),Xe=e=>t=>$e(t)&&Ue(t)===e,Ke=(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")}},Je=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ze=(e,t)=>{const o=void 0===t?document:t.dom;return Je(o)?A.none():A.from(o.querySelector(e)).map(Le)},Qe=(e,t)=>e.dom===t.dom,et=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},tt=e=>Le(e.dom.ownerDocument),ot=e=>qe(e)?e:tt(e),nt=e=>Le(ot(e).dom.documentElement),st=e=>Le(ot(e).dom.defaultView),rt=e=>A.from(e.dom.parentNode).map(Le),at=e=>A.from(e.dom.parentElement).map(Le),it=e=>A.from(e.dom.offsetParent).map(Le),lt=e=>z(e.dom.childNodes,Le),ct=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(Le)},dt=e=>ct(e,0),ut=(e,t)=>({element:e,offset:t}),mt=(e,t)=>{const o=lt(e);return o.length>0&&tYe(e)&&g(e.dom.host),pt=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),ht=x(pt),ft=pt?e=>Le(e.dom.getRootNode()):ot,bt=e=>gt(e)?e:Le(ot(e).dom.body),vt=e=>{const t=ft(e);return gt(t)?A.some(t):A.none()},yt=e=>Le(e.dom.host),xt=e=>{const t=Ge(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return vt(Le(t)).fold((()=>o.body.contains(t)),(n=xt,s=yt,e=>n(s(e))));var n,s},wt=()=>St(Le(document)),St=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Le(t)},kt=(e,t,o)=>{if(!(r(o)||d(o)||h(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+"")},Ct=(e,t,o)=>{kt(e.dom,t,o)},Ot=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{kt(o,t,e)}))},_t=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Tt=(e,t)=>A.from(_t(e,t)),Et=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},At=(e,t)=>{e.dom.removeAttribute(t)},Mt=(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);Be(e)&&e.style.setProperty(t,o)},Dt=(e,t)=>{Be(e)&&e.style.removeProperty(t)},Bt=(e,t,o)=>{const n=e.dom;Mt(n,t,o)},It=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{Mt(o,t,e)}))},Ft=(e,t)=>{const o=e.dom;ie(t,((e,t)=>{e.fold((()=>{Dt(o,t)}),(e=>{Mt(o,t,e)}))}))},Rt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||xt(e)?n:Nt(o,t)},Nt=(e,t)=>Be(e)?e.style.getPropertyValue(t):"",Lt=(e,t)=>{const o=e.dom,n=Nt(o,t);return A.from(n).filter((e=>e.length>0))},zt=e=>{const t={},o=e.dom;if(Be(o))for(let e=0;e{const n=Re(e);return Bt(n,t,o),Lt(n,t).isSome()},Ht=(e,t)=>{const o=e.dom;Dt(o,t),ye(Tt(e,"style").map(Ae),"")&&At(e,"style")},Pt=e=>e.dom.offsetWidth,Ut=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Rt(o,e);return parseFloat(t)||0}return n},n=(e,t)=>W(t,((t,o)=>{const n=Rt(e,o),s=void 0===n?0:parseInt(n,10);return isNaN(s)?t:t+s}),0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Be(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const s=n(e,o);return t>s?t-s:0}}},Wt=Ut("height",(e=>{const t=e.dom;return xt(e)?t.getBoundingClientRect().height:t.offsetHeight})),jt=e=>Wt.get(e),$t=e=>Wt.getOuter(e),Gt=(e,t)=>({left:e,top:t,translate:(o,n)=>Gt(e+o,t+n)}),qt=Gt,Yt=(e,t)=>void 0!==e?e:void 0!==t?t:0,Xt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return qt(o.offsetLeft,o.offsetTop);const r=Yt(null==n?void 0:n.pageYOffset,s.scrollTop),a=Yt(null==n?void 0:n.pageXOffset,s.scrollLeft),i=Yt(s.clientTop,o.clientTop),l=Yt(s.clientLeft,o.clientLeft);return Kt(e).translate(a-l,r-i)},Kt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?qt(o.offsetLeft,o.offsetTop):xt(e)?(e=>{const t=e.getBoundingClientRect();return qt(t.left,t.top)})(t):qt(0,0)},Jt=Ut("width",(e=>e.dom.offsetWidth)),Zt=e=>Jt.get(e),Qt=e=>Jt.getOuter(e),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},so=(e,t)=>{const o=String(t).toLowerCase();return j(e,(e=>e.search(o)))},ro=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ao=e=>t=>_e(t,e),io=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>_e(e,"edge/")&&_e(e,"chrome")&&_e(e,"safari")&&_e(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ro],search:e=>_e(e,"chrome")&&!_e(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>_e(e,"msie")||_e(e,"trident")},{name:"Opera",versionRegexes:[ro,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ao("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ao("firefox")},{name:"Safari",versionRegexes:[ro,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(_e(e,"safari")||_e(e,"mobile/"))&&_e(e,"applewebkit")}],lo=[{name:"Windows",search:ao("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>_e(e,"iphone")||_e(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ao("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:ao("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ao("linux"),versionRegexes:[]},{name:"Solaris",search:ao("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ao("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:ao("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],co={browsers:x(io),oses:x(lo)},uo="Edge",mo="Chromium",go="Opera",po="Firefox",ho="Safari",fo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(uo),isChromium:n(mo),isIE:n("IE"),isOpera:n(go),isFirefox:n(po),isSafari:n(ho)}},bo=()=>fo({current:void 0,version:no.unknown()}),vo=fo,yo=(x(uo),x(mo),x("IE"),x(go),x(po),x(ho),"Windows"),xo="Android",wo="Linux",So="macOS",ko="Solaris",Co="FreeBSD",Oo="ChromeOS",_o=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(yo),isiOS:n("iOS"),isAndroid:n(xo),isMacOS:n(So),isLinux:n(wo),isSolaris:n(ko),isFreeBSD:n(Co),isChromeOS:n(Oo)}},To=()=>_o({current:void 0,version:no.unknown()}),Eo=_o,Ao=(x(yo),x("iOS"),x(xo),x(wo),x(So),x(ko),x(Co),x(Oo),e=>window.matchMedia(e).matches);var Mo;let Do=eo((()=>((e,t,o)=>{const n=co.browsers(),s=co.oses(),r=t.bind((e=>((e,t)=>se(t.brands,(t=>{const o=t.brand.toLowerCase();return j(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)=>so(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(n,e))).fold(bo,vo),a=((e,t)=>so(e,t).map((e=>{const o=no.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(s,e).fold(To,Eo),i=((e,t,o,n)=>{const s=e.isiOS()&&!0===/ipad/i.test(o),r=e.isiOS()&&!s,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=s||!r&&a&&n("(min-device-width:768px)"),c=r||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:x(s),isiPhone:x(r),isTablet:x(l),isPhone:x(c),isTouch:x(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:x(d),isDesktop:x(u)}})(a,r,e,o);return{browser:r,os:a,deviceType:i}})(navigator.userAgent,A.from(navigator.userAgentData),Ao)));const Bo=()=>Do(),Io=e=>{const t=Le((e=>{if(ht()&&g(e.target)){const t=Le(e.target);if($e(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return te(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=y(n,o);return((e,t,o,n,s,r,a)=>({target:e,x:t,y:o,stop:n,prevent:s,kill:r,raw:a}))(t,e.clientX,e.clientY,o,n,s,e)},Fo=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(Io(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:k(Ro,e,t,r,s)}},Ro=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},No=(e,t)=>{rt(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Lo=(e,t)=>{const o=(e=>A.from(e.dom.nextSibling).map(Le))(e);o.fold((()=>{rt(e).each((e=>{Vo(e,t)}))}),(e=>{No(e,t)}))},zo=(e,t)=>{dt(e).fold((()=>{Vo(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},Vo=(e,t)=>{e.dom.appendChild(t.dom)},Ho=(e,t)=>{V(t,(t=>{Vo(e,t)}))},Po=e=>{e.dom.textContent="",V(lt(e),(e=>{Uo(e)}))},Uo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Wo=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return qt(o,n)},jo=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},$o=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Go=e=>{const t=void 0===e?window:e,o=t.document,n=Wo(Le(o));return(e=>{const t=void 0===e?window:e;return Bo().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return $o(n.left,n.top,o,s)}),(e=>$o(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},qo=()=>Le(document),Yo=(e,t)=>e.view(t).fold(x([]),(t=>{const o=e.owner(t),n=Yo(e,o);return[t].concat(n)}));var Xo=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?A.none():A.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Le)},owner:e=>tt(e)});const Ko=e=>{const t=qo(),o=Wo(t),n=((e,t)=>{const o=t.owner(e),n=Yo(t,o);return A.some(n)})(e,Xo);return n.fold(k(Xt,e),(t=>{const n=Kt(e),s=U(t,((e,t)=>{const o=Kt(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return qt(s.left+n.left+o.left,s.top+n.top+o.top)}))},Jo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Zo=e=>{const t=Xt(e),o=Qt(e),n=$t(e);return Jo(t.left,t.top,o,n)},Qo=e=>{const t=Ko(e),o=Qt(e),n=$t(e);return Jo(t.left,t.top,o,n)},en=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),s=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return Jo(o,n,s-o,r-n)},tn=()=>Go(window),on=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},nn=e=>{const t=on(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},sn=()=>nn((e=>e.unbind())),rn=()=>{const e=nn(b);return{...e,on:t=>e.get().each(t)}};var an=tinymce.util.Tools.resolve("tinymce.ThemeManager");const ln=e=>{const t=t=>t(e),o=x(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>dn.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:()=>A.some(e)};return s},cn=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>dn.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:O(String(e)),each:b,toOptional:A.none};return o},dn={value:ln,error:cn,fromOption:(e,t)=>e.fold((()=>cn(t)),ln)};var un;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(un||(un={}));const mn=(e,t,o)=>e.stype===un.Error?t(e.serror):o(e.svalue),gn=e=>({stype:un.Value,svalue:e}),pn=e=>({stype:un.Error,serror:e}),hn=gn,fn=pn,bn=mn,vn=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),yn=(e,t,o)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return o(e.newKey,e.instantiator)}},xn=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;ni(e)&&i(t)?wn(e,t):t)),Sn=xn(((e,t)=>t)),kn=e=>({tag:"defaultedThunk",process:e}),Cn=e=>kn(x(e)),On=e=>({tag:"mergeWithThunk",process:e}),_n=e=>{const t=(e=>{const t=[],o=[];return V(e,(e=>{mn(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,y(fn,G)(o)):hn(t.values);var o},Tn=e=>a(e)&&re(e).length>100?" removed due to size":JSON.stringify(e,null,2),En=(e,t)=>fn([{path:e,getErrorInfo:t}]),An=e=>({extract:(t,o)=>((e,t)=>e.stype===un.Error?t(e.serror):e)(e(o),(e=>((e,t)=>En(e,x(t)))(t,e))),toString:x("val")}),Mn=An(hn),Dn=(e,t,o,n)=>n(fe(e,t).getOrThunk((()=>o(e)))),Bn=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold((()=>hn(A.none())),(e=>((e,t)=>e.stype===un.Value?{stype:un.Value,svalue:t(e.svalue)}:e)(s.extract(t.concat([n]),e),A.some)));switch(e.tag){case"required":return((e,t,o,n)=>fe(t,o).fold((()=>((e,t,o)=>En(e,(()=>'Could not find valid *required* value for "'+t+'" in '+Tn(o))))(e,o,t)),n))(t,o,n,r);case"defaultedThunk":return Dn(o,n,e.process,r);case"option":return((e,t,o)=>o(fe(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(fe(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return Dn(o,n,x({}),(t=>{const n=wn(e.process(o),t);return r(n)}))}},In=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),Fn=e=>re(me(e,g)),Rn=e=>{const t=Nn(e),o=U(e,((e,t)=>yn(t,(t=>wn(e,{[t]:!0})),x(e))),{});return{extract:(e,n)=>{const s=d(n)?[]:Fn(n),r=P(s,(e=>!ve(o,e)));return 0===r.length?t.extract(e,n):((e,t)=>En(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,r)},toString:t.toString}},Nn=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)yn(r,((o,r,a,i)=>{const l=Bn(a,e,t,o,i);bn(l,(e=>{s.push(...e)}),(e=>{n[r]=e}))}),((e,o)=>{n[e]=o(t)}));return s.length>0?fn(s):hn(n)})(t,o,e),toString:()=>{const t=z(e,(e=>yn(e,((e,t,o,n)=>e+" -> "+n.toString()),((e,t)=>"state("+e+")"))));return"obj{\n"+t.join("\n")+"}"}}),Ln=e=>({extract:(t,o)=>{const n=z(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return _n(n)},toString:()=>"array("+e.toString()+")"}),zn=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const s=[];for(const r of e){const e=r.extract(t,n);if(e.stype===un.Value)return{stype:un.Value,svalue:o(e.svalue)};s.push(e)}return _n(s)},toString:()=>"oneOf("+z(e,(e=>e.toString())).join(", ")+")"}},Vn=(e,t)=>({extract:(o,n)=>{const s=re(n),r=((t,o)=>Ln(An(e)).extract(t,o))(o,s);return((e,t)=>e.stype===un.Value?t(e.svalue):e)(r,(e=>{const s=z(e,(e=>vn(e,e,{tag:"required",process:{}},t)));return Nn(s).extract(o,n)}))},toString:()=>"setOf("+t.toString()+")"}),Hn=y(Ln,Nn),Pn=x(Mn),Un=(e,t)=>An((o=>{const n=typeof o;return e(o)?hn(o):fn(`Expected type: ${t} but got: ${n}`)})),Wn=Un(h,"number"),jn=Un(r,"string"),$n=Un(d,"boolean"),Gn=Un(p,"function"),qn=e=>{if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every((t=>qn(e[t])));default:return!1}},Yn=An((e=>qn(e)?hn(e):fn("Expected value to be acceptable for sending via postMessage"))),Xn=(e,t)=>({extract:(o,n)=>fe(n,e).fold((()=>((e,t)=>En(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>((e,t,o,n)=>fe(o,n).fold((()=>((e,t,o)=>En(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+Tn(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))))(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+re(t)}),Kn=e=>An((t=>e(t).fold(fn,hn))),Jn=(e,t)=>Vn((t=>e(t).fold(pn,gn)),t),Zn=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===un.Error?{stype:un.Error,serror:t(e.serror)}:e)(t.extract([e],o),(e=>({input:o,errors:e}))))(e,t,o),mn(n,dn.error,dn.value);var n},Qn=e=>e.fold((e=>{throw new Error(ts(e))}),w),es=(e,t,o)=>Qn(Zn(e,t,o)),ts=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:x("... (only showing first ten failures)")}]):e;return z(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+Tn(e.input),os=(e,t)=>Xn(e,le(t,Nn)),ns=(e,t)=>((e,t)=>{const o=eo(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),ss=vn,rs=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),as=e=>Kn((t=>F(e,t)?dn.value(t):dn.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`))),is=e=>ss(e,e,{tag:"required",process:{}},Pn()),ls=(e,t)=>ss(e,e,{tag:"required",process:{}},t),cs=e=>ls(e,Wn),ds=e=>ls(e,jn),us=(e,t)=>ss(e,e,{tag:"required",process:{}},as(t)),ms=e=>ls(e,Gn),gs=(e,t)=>ss(e,e,{tag:"required",process:{}},Nn(t)),ps=(e,t)=>ss(e,e,{tag:"required",process:{}},Hn(t)),hs=(e,t)=>ss(e,e,{tag:"required",process:{}},Ln(t)),fs=e=>ss(e,e,{tag:"option",process:{}},Pn()),bs=(e,t)=>ss(e,e,{tag:"option",process:{}},t),vs=e=>bs(e,Wn),ys=e=>bs(e,jn),xs=(e,t)=>bs(e,as(t)),ws=e=>bs(e,Gn),Ss=(e,t)=>bs(e,Ln(t)),ks=(e,t)=>bs(e,Nn(t)),Cs=(e,t)=>ss(e,e,Cn(t),Pn()),Os=(e,t,o)=>ss(e,e,Cn(t),o),_s=(e,t)=>Os(e,t,Wn),Ts=(e,t)=>Os(e,t,jn),Es=(e,t,o)=>Os(e,t,as(o)),As=(e,t)=>Os(e,t,$n),Ms=(e,t)=>Os(e,t,Gn),Ds=(e,t,o)=>Os(e,t,Ln(o)),Bs=(e,t,o)=>Os(e,t,Nn(o)),Is=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 V(e,((n,s)=>{const r=re(n);if(1!==r.length)throw new Error("one and only one name per case");const a=r[0],i=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(i))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), 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[s].apply(null,o)},match:e=>{const n=re(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!Y(t,(e=>F(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};Is([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Fs=(e,t)=>((e,t)=>({[e]:t}))(e,t),Rs=e=>(e=>{const t={};return V(e,(e=>{t[e.key]=e.value})),t})(e),Ns=e=>p(e)?e:T,Ls=(e,t,o)=>{let n=e.dom;const s=Ns(o);for(;n.parentNode;){n=n.parentNode;const e=Le(n),o=t(e);if(o.isSome())return o;if(s(e))break}return A.none()},zs=(e,t,o)=>{const n=t(e),s=Ns(o);return n.orThunk((()=>s(e)?A.none():Ls(e,t,s)))},Vs=(e,t)=>Qe(e.element,t.event.target),Hs={can:E,abort:T,run:b},Ps=e=>{if(!ve(e,"can")&&!ve(e,"abort")&&!ve(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...Hs,...e}},Us=x,Ws=Us("touchstart"),js=Us("touchmove"),$s=Us("touchend"),Gs=Us("touchcancel"),qs=Us("mousedown"),Ys=Us("mousemove"),Xs=Us("mouseout"),Ks=Us("mouseup"),Js=Us("mouseover"),Zs=Us("focusin"),Qs=Us("focusout"),er=Us("keydown"),tr=Us("keyup"),or=Us("input"),nr=Us("change"),sr=Us("click"),rr=Us("transitioncancel"),ar=Us("transitionend"),ir=Us("transitionstart"),lr=Us("selectstart"),cr=e=>x("alloy."+e),dr={tap:cr("tap")},ur=cr("focus"),mr=cr("blur.post"),gr=cr("paste.post"),pr=cr("receive"),hr=cr("execute"),fr=cr("focus.item"),br=dr.tap,vr=cr("longpress"),yr=cr("sandbox.close"),xr=cr("typeahead.cancel"),wr=cr("system.init"),Sr=cr("system.touchmove"),kr=cr("system.touchend"),Cr=cr("system.scroll"),Or=cr("system.resize"),_r=cr("system.attached"),Tr=cr("system.detached"),Er=cr("system.dismissRequested"),Ar=cr("system.repositionRequested"),Mr=cr("focusmanager.shifted"),Dr=cr("slotcontainer.visibility"),Br=cr("system.external.element.scroll"),Ir=cr("change.tab"),Fr=cr("dismiss.tab"),Rr=cr("highlight"),Nr=cr("dehighlight"),Lr=(e,t)=>{Pr(e,e.element,t,{})},zr=(e,t,o)=>{Pr(e,e.element,t,o)},Vr=e=>{Lr(e,hr())},Hr=(e,t,o)=>{Pr(e,t,o,{})},Pr=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Ur=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Wr=e=>Rs(e),jr=(e,t)=>({key:e,value:Ps({abort:t})}),$r=e=>({key:e,value:Ps({run:(e,t)=>{t.event.prevent()}})}),Gr=(e,t)=>({key:e,value:Ps({run:t})}),qr=(e,t,o)=>({key:e,value:Ps({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),Yr=e=>t=>({key:e,value:Ps({run:(e,o)=>{Vs(e,o)&&t(e,o)}})}),Xr=(e,t,o)=>((e,t)=>Gr(e,((o,n)=>{o.getSystem().getByUid(t).each((t=>{Ur(t,t.element,e,n)}))})))(e,t.partUids[o]),Kr=(e,t)=>Gr(e,((e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk((()=>zs(n.target,(t=>e.getSystem().getByDom(t).toOptional()),T).getOr(e)));t(e,s,o)})),Jr=e=>Gr(e,((e,t)=>{t.cut()})),Zr=e=>Gr(e,((e,t)=>{t.stop()})),Qr=(e,t)=>Yr(e)(t),ea=Yr(_r()),ta=Yr(Tr()),oa=Yr(wr()),na=(ti=hr(),e=>Gr(ti,e)),sa=e=>z(e,(e=>Ee(e,"/*")?e.substring(0,e.length-2):e)),ra=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:sa(r)}),e},aa=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),ia=(e,t,o)=>oa(((n,s)=>{o(n,e,t)})),la=e=>({key:e,value:void 0}),ca=(e,t,o,n,s,r,a)=>{const i=e=>ve(e,o)?e[o]():A.none(),l=le(s,((e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),s=n.indexOf(")")+1,r=n.indexOf("("),a=n.substring(r+1,s-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:sa(a.slice(0,1).concat(a.slice(3)))}),e})(((n,...s)=>{const r=[n].concat(s);return n.config({name:x(e)}).fold((()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)}),(e=>{const o=Array.prototype.slice.call(r,1);return t.apply(void 0,[n,e.config,e.state].concat(o))}))}),o,t))(o,e,t))),c={...le(r,((e,t)=>ra(e,t))),...l,revoke:k(la,o),config:t=>{const n=es(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:eo((()=>es(o+"-config",e,t))),initialConfig:t,state:a}}},schema:x(t),exhibit:(e,t)=>we(i(e),fe(n,"exhibit"),((e,o)=>o(t,e.config,e.state))).getOrThunk((()=>aa({}))),name:x(o),handlers:e=>i(e).map((e=>fe(n,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return c},da={init:()=>ua({readState:x("No State required")})},ua=e=>e,ma=e=>Rs(e),ga=Rn([is("fields"),is("name"),Cs("active",{}),Cs("apis",{}),Cs("state",da),Cs("extra",{})]),pa=e=>{const t=es("Creating behaviour: "+e.name,ga,e);return((e,t,o,n,s,r)=>{const a=Rn(e),i=ks(t,[("config",l=e,bs("config",Rn(l)))]);var l;return ca(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},ha=Rn([is("branchKey"),is("branches"),is("name"),Cs("active",{}),Cs("apis",{}),Cs("state",da),Cs("extra",{})]),fa=e=>{const t=es("Creating behaviour: "+e.name,ha,e);return((e,t,o,n,s,r)=>{const a=e,i=ks(t,[bs("config",e)]);return ca(a,i,t,o,n,s,r)})(os(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},ba=x(void 0),va=(e,t)=>{const o=_t(e,t);return void 0===o||""===o?[]:o.split(" ")},ya=e=>void 0!==e.dom.classList,xa=e=>va(e,"class"),wa=(e,t)=>((e,t,o)=>{const n=va(e,t).concat([o]);return Ct(e,t,n.join(" ")),!0})(e,"class",t),Sa=(e,t)=>((e,t,o)=>{const n=P(va(e,t),(e=>e!==o));return n.length>0?Ct(e,t,n.join(" ")):At(e,t),!1})(e,"class",t),ka=(e,t)=>{ya(e)?e.dom.classList.add(t):wa(e,t)},Ca=e=>{0===(ya(e)?e.dom.classList:xa(e)).length&&At(e,"class")},Oa=(e,t)=>{ya(e)?e.dom.classList.remove(t):Sa(e,t),Ca(e)},_a=(e,t)=>ya(e)&&e.dom.classList.contains(t),Ta=(e,t)=>{V(t,(t=>{ka(e,t)}))},Ea=(e,t)=>{V(t,(t=>{Oa(e,t)}))},Aa=e=>ya(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;e{const r=e=>e+"px";return{position:e,left:t.map(r),top:o.map(r),right:n.map(r),bottom:s.map(r)}},Da=(e,t)=>{Ft(e,(e=>({...e,position:A.some(e.position)}))(t))},Ba=e=>(ye(Lt(e,"position"),"fixed")?A.none():it(e)).orThunk((()=>{const t=Re("span");return rt(e).bind((e=>{Vo(e,t);const o=it(t);return Uo(t),o}))})),Ia=e=>Ba(e).map(Xt).getOrThunk((()=>qt(0,0))),Fa=(e,t)=>{const o=e.element;ka(o,t.transitionClass),Oa(o,t.fadeOutClass),ka(o,t.fadeInClass),t.onShow(e)},Ra=(e,t)=>{const o=e.element;ka(o,t.transitionClass),Oa(o,t.fadeInClass),ka(o,t.fadeOutClass),t.onHide(e)},Na=(e,t)=>e.y>=t.y,La=(e,t)=>e.bottom<=t.bottom,za=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),Va=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),Ha=e=>e.box.x-e.win.x,Pa=(e,t,o)=>o.getInitialPos().map((o=>{const n=((e,t)=>{const o=t.optScrollEnv.fold(x(e.bounds.y),(t=>t.scrollElmTop+(e.bounds.y-t.currentScrollTop)));return qt(e.bounds.x,o)})(o,t);return{box:Jo(n.left,n.top,Zt(e),jt(e)),location:o.location}})),Ua=(e,t,o,n,s)=>{const r=((e,t)=>{const o=t.optScrollEnv.fold(x(e.y),(t=>e.y+t.currentScrollTop-t.scrollElmTop));return qt(e.x,o)})(t,o),a=Jo(r.left,r.top,t.width,t.height);n.setInitialPos({style:zt(e),position:Rt(e,"position")||"static",bounds:a,location:s.location})},Wa=(e,t,o)=>o.getInitialPos().bind((n=>{var s;switch(o.clearInitialPos(),n.position){case"static":return A.some({morph:"static"});case"absolute":const o=Ba(e).getOr(wt()),r=Zo(o),a=null!==(s=o.dom.scrollTop)&&void 0!==s?s:0;return A.some({morph:"absolute",positionCss:Ma("absolute",fe(n.style,"left").map((e=>t.x-r.x)),fe(n.style,"top").map((e=>t.y-r.y+a)),fe(n.style,"right").map((e=>r.right-t.right)),fe(n.style,"bottom").map((e=>r.bottom-t.bottom)))});default:return A.none()}})),ja=e=>{switch(e.location){case"top":return A.some({morph:"fixed",positionCss:Ma("fixed",A.some(e.leftX),A.some(e.topY),A.none(),A.none())});case"bottom":return A.some({morph:"fixed",positionCss:Ma("fixed",A.some(e.leftX),A.none(),A.none(),A.some(e.bottomY))});default:return A.none()}},$a=(e,t,o)=>{const n=e.element;return ye(Lt(n,"position"),"fixed")?((e,t,o)=>((e,t,o)=>Pa(e,t,o).filter((({box:e})=>((e,t,o)=>Y(e,(e=>{switch(e){case"bottom":return La(t,o.bounds);case"top":return Na(t,o.bounds)}})))(o.getModes(),e,t))).bind((({box:t})=>Wa(e,t,o))))(e,t,o).orThunk((()=>t.optScrollEnv.bind((n=>Pa(e,t,o))).bind((({box:e,location:o})=>{const n=tn(),s=Ha({win:n,box:e}),r="top"===o?za(n,s,t):Va(n,s,t);return ja(r)})))))(n,t,o):((e,t,o)=>{const n=Zo(e),s=tn(),r=((e,t,o)=>{const n=t.win,s=t.box,r=Ha(t);return se(e,(e=>{switch(e){case"bottom":return La(s,o.bounds)?A.none():A.some(Va(n,r,o));case"top":return Na(s,o.bounds)?A.none():A.some(za(n,r,o));default:return A.none()}})).getOr({location:"no-dock"})})(o.getModes(),{win:s,box:n},t);return"top"===r.location||"bottom"===r.location?(Ua(e,n,t,o,r),ja(r)):A.none()})(n,t,o)},Ga=(e,t,o)=>{o.setDocked(!1),V(["left","right","top","bottom","position"],(t=>Ht(e.element,t))),t.onUndocked(e)},qa=(e,t,o,n)=>{const s="fixed"===n.position;o.setDocked(s),Da(e.element,n),(s?t.onDocked:t.onUndocked)(e)},Ya=(e,t,o,n,s=!1)=>{t.contextual.each((t=>{t.lazyContext(e).each((r=>{const a=((e,t)=>e.yt.y)(r,n.bounds);a!==o.isVisible()&&(o.setVisible(a),s&&!a?(Ta(e.element,[t.fadeOutClass]),t.onHide(e)):(a?Fa:Ra)(e,t))}))}))},Xa=(e,t,o,n,s)=>{Ya(e,t,o,n,!0),qa(e,t,o,s.positionCss)},Ka=(e,t,o)=>{e.getSystem().isConnected()&&((e,t,o)=>{const n=t.lazyViewport(e);Ya(e,t,o,n),$a(e,n,o).each((s=>{((e,t,o,n,s)=>{switch(s.morph){case"static":return Ga(e,t,o);case"absolute":return qa(e,t,o,s.positionCss);case"fixed":Xa(e,t,o,n,s)}})(e,t,o,n,s)}))})(e,t,o)},Ja=(e,t,o)=>{o.isDocked()&&((e,t,o)=>{const n=e.element;o.setDocked(!1);const s=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return Pa(n,t,o).bind((({box:e})=>Wa(n,e,o)))})(e,s,o).each((n=>{switch(n.morph){case"static":Ga(e,t,o);break;case"absolute":qa(e,t,o,n.positionCss)}})),o.setVisible(!0),t.contextual.each((t=>{Ea(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)})),Ka(e,t,o)})(e,t,o)},Za=e=>(t,o,n)=>{const s=o.lazyViewport(t);((e,t,o,n)=>{const s=Zo(e),r=tn(),a=n(r,Ha({win:r,box:s}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,s)=>{n.getInitialPos().fold((()=>Ua(e,t,o,n,s)),(()=>b))})(e,s,t,o,a),ja(a)):A.none()})(t.element,s,n,e).each((e=>{Xa(t,o,n,s,e)}))},Qa=Za(za),ei=Za(Va);var ti,oi=Object.freeze({__proto__:null,refresh:Ka,reset:Ja,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:Qa,forceDockToBottom:ei}),ni=Object.freeze({__proto__:null,events:(e,t)=>Wr([Qr(ar(),((o,n)=>{e.contextual.each((e=>{_a(o.element,e.transitionClass)&&(Ea(o.element,[e.transitionClass,e.fadeInClass]),(t.isVisible()?e.onShown:e.onHidden)(o)),n.stop()}))})),Gr(Cr(),((o,n)=>{Ka(o,e,t)})),Gr(Br(),((o,n)=>{Ka(o,e,t)})),Gr(Or(),((o,n)=>{Ja(o,e,t)}))])});const si=e=>e.dom.innerHTML,ri=(e,t)=>{const o=tt(e).dom,n=Le(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,lt(Le(o))})(t,o);Ho(n,s),Po(e),Vo(e,n)},ai=(e,t)=>Le(e.dom.cloneNode(t)),ii=e=>(e=>{if(gt(e))return"#shadow-root";{const t=(e=>ai(e,!1))(e);return(e=>{const t=Re("div"),o=Le(e.dom.cloneNode(!0));return Vo(t,o),si(t)})(t)}})(e);var li;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(li||(li={}));const ci=on({}),di=["alloy/data/Fields","alloy/debugging/Debugging"],ui=(e,t,o)=>((e,t,o)=>{switch(fe(ci.get(),e).orThunk((()=>{const t=re(ci.get());return se(t,(t=>e.indexOf(t)>-1?A.some(ci.get()[t]):A.none()))})).getOr(li.NORMAL)){case li.NORMAL:return o(mi());case li.LOGGING:{const n=((e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const s=(new Date).getTime();F(["mousemove","mouseover","mouseout",wr()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:z(o,(e=>F(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ii(e.target)+")":e.outcome))})}}})(e,t),s=o(n);return n.write(),s}case li.STOP:return!0}})(e,t,o),mi=x({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),gi=x([is("menu"),is("selectedMenu")]),pi=x([is("item"),is("selectedItem")]);x(Nn(pi().concat(gi())));const hi=x(Nn(pi())),fi=gs("initSize",[is("numColumns"),is("numRows")]),bi=()=>gs("markers",[is("backgroundMenu")].concat(gi()).concat(pi())),vi=e=>gs("markers",z(e,is)),yi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");j(t,(e=>e.indexOf("alloy")>0&&!R(di,(t=>e.indexOf(t)>-1)))).getOr("unknown")}})(),ss(t,t,o,Kn((e=>dn.value(((...t)=>e.apply(void 0,t))))))),xi=e=>yi(0,e,Cn(b)),wi=e=>yi(0,e,Cn(A.none)),Si=e=>yi(0,e,{tag:"required",process:{}}),ki=e=>yi(0,e,{tag:"required",process:{}}),Ci=(e,t)=>rs(e,x(t)),Oi=e=>rs(e,w),_i=x(fi);var Ti=[ks("contextual",[ds("fadeInClass"),ds("fadeOutClass"),ds("transitionClass"),ms("lazyContext"),xi("onShow"),xi("onShown"),xi("onHide"),xi("onHidden")]),Ms("lazyViewport",(()=>({bounds:tn(),optScrollEnv:A.none()}))),Ds("modes",["top","bottom"],jn),xi("onDocked"),xi("onUndocked")];const Ei=pa({fields:Ti,name:"docking",active:ni,apis:oi,state:Object.freeze({__proto__:null,init:e=>{const t=on(!1),o=on(!0),n=rn(),s=on(e.modes);return ua({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:s.get,setModes:s.set,readState:()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${s.get().join(",")}`})}})}),Ai=Wr([((e,t)=>({key:e,value:Ps({can:(e,t)=>{const o=t.event,n=o.originator,s=o.target;return!((e,t,o)=>Qe(t,e.element)&&!Qe(t,o))(e,n,s)||(console.warn(ur()+" did not get interpreted by the desired target. \nOriginator: "+ii(n)+"\nTarget: "+ii(s)+"\nCheck the "+ur()+" event handlers"),!1)}})}))(ur())]);var Mi=Object.freeze({__proto__:null,events:Ai});let Di=0;const Bi=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return Di++,e+"_"+o+Di+String(t)},Ii=x("alloy-id-"),Fi=x("data-alloy-id"),Ri=Ii(),Ni=Fi(),Li=(e,t)=>{Object.defineProperty(e.dom,Ni,{value:t,writable:!0})},zi=e=>{const t=$e(e)?e.dom[Ni]:null;return A.from(t)},Vi=e=>Bi(e),Hi=w,Pi=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+ii(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:x("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),build:o("build"),buildOrPatch:o("buildOrPatch"),addToWorld:o("addToWorld"),removeFromWorld:o("removeFromWorld"),addToGui:o("addToGui"),removeFromGui:o("removeFromGui"),getByUid:o("getByUid"),getByDom:o("getByDom"),isConnected:T}},Ui=Pi(),Wi=Bi("alloy-premade"),ji=e=>(Object.defineProperty(e.element.dom,Wi,{value:e.uid,writable:!0}),Fs(Wi,e)),$i=e=>fe(e,Wi),Gi=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:sa(r.slice(1))}),e})(((t,...o)=>e(t.getApis(),t,...o)),e),qi=(e,t)=>{const o={};return ie(e,((e,n)=>{ie(e,((e,s)=>{const r=fe(o,s).getOr([]);o[s]=r.concat([t(n,e)])}))})),o},Yi=e=>e.cHandler,Xi=(e,t)=>({name:e,handler:t}),Ki=(e,t)=>{const o={};return V(e,(e=>{o[e.name()]=e.handlers(t)})),o},Ji=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const s=Q(o,((o,s)=>{const r=o[t],a=s[t],i=n.indexOf(r),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+r+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(n,null,2));return i(e=>{const t=((e,t)=>(...t)=>W(e,((e,o)=>e&&(e=>e.can)(o).apply(void 0,t)),!0))(e),o=((e,t)=>(...t)=>W(e,((e,o)=>e||(e=>e.abort)(o).apply(void 0,t)),!1))(e);return{can:t,abort:o,run:(...t)=>{V(e,(e=>{e.run.apply(void 0,t)}))}}})(z(e,(e=>e.handler))))):((e,t)=>dn.error(["The event ("+e+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+JSON.stringify(z(t,(e=>e.name)),null,2)]))(o,e)},Zi=(e,t)=>((e,t)=>{const o=(e=>{const t=[],o=[];return V(e,(e=>{e.fold((e=>{t.push(e)}),(e=>{o.push(e)}))})),{errors:t,values:o}})(e);return o.errors.length>0?(n=o.errors,dn.error(G(n))):((e,t)=>0===e.length?dn.value(t):dn.value(wn(t,Sn.apply(void 0,e))))(o.values,t);var n})(ge(e,((e,o)=>(1===e.length?dn.value(e[0].handler):Ji(e,t,o)).map((n=>{const s=(e=>{const t=(e=>p(e)?{can:E,abort:T,run:e}:e)(e);return(e,o,...n)=>{const s=[e,o].concat(n);t.abort.apply(void 0,s)?o.stop():t.can.apply(void 0,s)&&t.run.apply(void 0,s)}})(n),r=e.length>1?P(t[o],(t=>R(e,(e=>e.name===t)))).join(" > "):e[0].name;return Fs(o,((e,t)=>({handler:e,purpose:t}))(s,r))})))),{}),Qi="alloy.base.behaviour",el=Nn([ss("dom","dom",{tag:"required",process:{}},Nn([is("tag"),Cs("styles",{}),Cs("classes",[]),Cs("attributes",{}),fs("value"),fs("innerHtml")])),is("components"),is("uid"),Cs("events",{}),Cs("apis",{}),ss("eventOrder","eventOrder",(bl={[hr()]:["disabling",Qi,"toggling","typeaheadevents"],[ur()]:[Qi,"focusing","keying"],[wr()]:[Qi,"disabling","toggling","representing"],[or()]:[Qi,"representing","streaming","invalidating"],[Tr()]:[Qi,"representing","item-events","toolbar-button-events","tooltipping"],[qs()]:["focusing",Qi,"item-type-events"],[Ws()]:["focusing",Qi,"item-type-events"],[Js()]:["item-type-events","tooltipping"],[pr()]:["receiving","reflecting","tooltipping"]},On(x(bl))),Pn()),fs("domModification")]),tl=e=>e.events,ol=e=>e.dom.value,nl=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},sl=(e,t,o)=>{o.fold((()=>Vo(e,t)),(e=>{Qe(e,t)||(No(e,t),Uo(e))}))},rl=(e,t,o)=>{const n=z(t,o),s=lt(e);return V(s.slice(n.length),Uo),n},al=(e,t,o,n)=>{const s=ct(e,t),r=n(o,s),a=((e,t,o)=>ct(e,t).map((e=>{if(o.exists((t=>!Qe(t,e)))){const t=o.map(Ue).getOr("span"),n=Re(t);return No(e,n),n}return e})))(e,t,s);return sl(e,r.element,a),r},il=(e,t)=>{const o=re(e),n=re(t),s=K(n,o),r=((e,o)=>{const n={},s={};return ue(e,((e,o)=>!be(t,o)||e!==t[o]),de(n),de(s)),{t:n,f:s}})(e).t;return{toRemove:s,toSet:r}},ll=(e,t)=>{const o=t.filter((t=>Ue(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>be(e.dom,Wi))(t))).bind((t=>((e,t)=>{try{const o=((e,t)=>{const{class:o,style:n,...s}=(e=>W(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))(t),{toSet:r,toRemove:a}=il(e.attributes,s),i=zt(t),{toSet:l,toRemove:c}=il(e.styles,i),d=Aa(t),u=K(d,e.classes),m=K(e.classes,d);return V(a,(e=>At(t,e))),Ot(t,r),Ta(t,m),Ea(t,u),V(c,(e=>Ht(t,e))),It(t,l),e.innerHtml.fold((()=>{const o=e.domChildren;((e,t)=>{rl(e,t,((t,o)=>{const n=ct(e,o);return sl(e,t,n),t}))})(t,o)}),(e=>{ri(t,e)})),(()=>{const o=t,n=e.value.getOrUndefined();n!==ol(o)&&nl(o,null!=n?n:"")})(),t})(e,t);return A.some(o)}catch(e){return A.none()}})(e,t))).getOrThunk((()=>(e=>{const t=Re(e.tag);Ot(t,e.attributes),Ta(t,e.classes),It(t,e.styles),e.innerHtml.each((e=>ri(t,e)));const o=e.domChildren;return Ho(t,o),e.value.each((e=>{nl(t,e)})),t})(e)));return Li(o,e.uid),o},cl=e=>{const t=(e=>{const t=fe(e,"behaviours").getOr({});return q(re(t),(e=>{const o=t[e];return g(o)?[o.me]:[]}))})(e);return((e,t)=>((e,t)=>{const o=z(t,(e=>ks(e.name(),[is("config"),Cs("state",da)]))),n=Zn("component.behaviours",Nn(o),e.behaviours).fold((t=>{throw new Error(ts(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))}),w);return{list:t,data:le(n,(e=>{const t=e.map((e=>({config:e.config,state:e.state.init(e.config)})));return x(t)}))}})(e,t))(e,t)},dl=(e,t)=>{const o=()=>m,n=on(Ui),s=Qn((e=>Zn("custom.definition",el,e))(e)),r=cl(e),a=(e=>e.list)(r),i=(e=>e.data)(r),l=((e,t,o)=>{const n={...(s=e).dom,uid:s.uid,domChildren:z(s.components,(e=>e.element))};var s;const r=(e=>e.domModification.fold((()=>aa({})),aa))(e),a={"alloy.base.modification":r},i=t.length>0?((e,t,o,n)=>{const s={...t};V(o,(t=>{s[t.name()]=t.exhibit(e,n)}));const r=qi(s,((e,t)=>({name:e,modification:t}))),a=e=>U(e,((e,t)=>({...t.modification,...e})),{}),i=U(r.classes,((e,t)=>t.modification.concat(e)),[]),l=a(r.attributes),c=a(r.styles);return aa({classes:i,attributes:l,styles:c})})(o,a,t,n):r;return l=n,c=i,{...l,attributes:{...l.attributes,...c.attributes},styles:{...l.styles,...c.styles},classes:l.classes.concat(c.classes)};var l,c})(s,a,i),c=ll(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":tl(e)};return((e,t,o,n)=>{const s=((e,t,o)=>{const n={...o,...Ki(t,e)};return qi(n,Xi)})(e,o,n);return Zi(s,t)})(o,e.eventOrder,t,n).getOrDie()})(s,a,i),u=on(s.components),m={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(p(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>p(i[e.name()]),spec:e,readState:e=>i[e]().map((e=>e.state.readState())).getOr("not enabled"),getApis:()=>s.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(Pi(o))},element:c,syncComponents:()=>{const e=lt(c),t=q(e,(e=>n.get().getByDom(e).fold((()=>[]),Z)));u.set(t)},components:u.get,events:d};return m},ul=e=>{const t=Ne(e);return ml({element:t})},ml=e=>{const t=es("external.component",Rn([is("element"),fs("uid")]),e),o=on(Pi()),n=t.uid.getOrThunk((()=>Vi("external")));Li(t.element,n);const s={uid:n,getSystem:o.get,config:A.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(Pi((()=>s)))},getApis:()=>({}),element:t.element,spec:e,readState:x("No state"),syncComponents:b,components:x([]),events:{}};return ji(s)},gl=Vi,pl=(e,t)=>$i(e).getOrThunk((()=>((e,t)=>{const{events:o,...n}=Hi(e),s=((e,t)=>{const o=fe(e,"components").getOr([]);return t.fold((()=>z(o,hl)),(e=>z(o,((t,o)=>pl(t,ct(e,o))))))})(n,t),r={...n,events:{...Mi,...o},components:s};return dn.value(dl(r,t))})((e=>be(e,"uid"))(e)?e:{uid:gl(""),...e},t).getOrDie())),hl=e=>pl(e,A.none()),fl=ji;var bl,vl=(e,t,o,n,s)=>e(o,n)?A.some(o):p(s)&&s(o)?A.none():t(o,n,s);const yl=(e,t,o)=>{let n=e.dom;const s=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=Le(n);if(t(e))return A.some(e);if(s(e))break}return A.none()},xl=(e,t,o)=>vl(((e,t)=>t(e)),yl,e,t,o),wl=(e,t)=>j(e.dom.childNodes,(e=>t(Le(e)))).map(Le),Sl=(e,t,o)=>xl(e,t,o).isSome(),kl=(e,t,o)=>yl(e,(e=>Ke(e,t)),o),Cl=(e,t)=>((e,o)=>{const n=e.dom;return n.parentNode?wl(Le(n.parentNode),(o=>!Qe(e,o)&&Ke(o,t))):A.none()})(e),Ol=(e,t)=>wl(e,(e=>Ke(e,t))),_l=(e,t)=>Ze(t,e),Tl=(e,t,o)=>vl(((e,t)=>Ke(e,t)),kl,e,t,o),El="aria-controls",Al=()=>{const e=Bi(El);return{id:e,link:t=>{Ct(t,El,e)},unlink:e=>{At(e,El)}}},Ml=(e,t)=>Sl(t,(t=>Qe(t,e.element)),T)||((e,t)=>(e=>xl(e,(e=>{if(!$e(e))return!1;const t=_t(e,"id");return void 0!==t&&t.indexOf(El)>-1})).bind((e=>{const t=_t(e,"id"),o=ft(e);return _l(o,`[${El}="${t}"]`)})))(t).exists((t=>Ml(e,t))))(e,t),Dl=(e,t,o,n,s,r,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:s,restriction:r,label:`${a}-${s}`,alwaysFit:i}),Bl=Is([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Il=Bl.southeast,Fl=Bl.southwest,Rl=Bl.northeast,Nl=Bl.northwest,Ll=Bl.south,zl=Bl.north,Vl=Bl.east,Hl=Bl.west,Pl=(e,t,o,n)=>{const s=e+t;return s>n?o:sMath.min(Math.max(e,t),o),Wl=(e,t)=>J(["left","right","top","bottom"],(o=>fe(t,o).map((t=>((e,t)=>{switch(t){case 1:return e.x;case 0:return e.x+e.width;case 2:return e.y;case 3:return e.y+e.height}})(e,t))))),jl="layout",$l=e=>e.x,Gl=(e,t)=>e.x+e.width/2-t.width/2,ql=(e,t)=>e.x+e.width-t.width,Yl=(e,t)=>e.y-t.height,Xl=e=>e.y+e.height,Kl=(e,t)=>e.y+e.height/2-t.height/2,Jl=(e,t,o)=>Dl($l(e),Xl(e),o.southeast(),Il(),"southeast",Wl(e,{left:1,top:3}),jl),Zl=(e,t,o)=>Dl(ql(e,t),Xl(e),o.southwest(),Fl(),"southwest",Wl(e,{right:0,top:3}),jl),Ql=(e,t,o)=>Dl($l(e),Yl(e,t),o.northeast(),Rl(),"northeast",Wl(e,{left:1,bottom:2}),jl),ec=(e,t,o)=>Dl(ql(e,t),Yl(e,t),o.northwest(),Nl(),"northwest",Wl(e,{right:0,bottom:2}),jl),tc=(e,t,o)=>Dl(Gl(e,t),Yl(e,t),o.north(),zl(),"north",Wl(e,{bottom:2}),jl),oc=(e,t,o)=>Dl(Gl(e,t),Xl(e),o.south(),Ll(),"south",Wl(e,{top:3}),jl),nc=(e,t,o)=>Dl((e=>e.x+e.width)(e),Kl(e,t),o.east(),Vl(),"east",Wl(e,{left:0}),jl),sc=(e,t,o)=>Dl(((e,t)=>e.x-t.width)(e,t),Kl(e,t),o.west(),Hl(),"west",Wl(e,{right:1}),jl),rc=()=>[Jl,Zl,Ql,ec,oc,tc,nc,sc],ac=()=>[Zl,Jl,ec,Ql,oc,tc,nc,sc],ic=()=>[Ql,ec,Jl,Zl,tc,oc],lc=()=>[ec,Ql,Zl,Jl,tc,oc],cc=()=>[Jl,Zl,Ql,ec,oc,tc],dc=()=>[Zl,Jl,ec,Ql,oc,tc];var uc=Object.freeze({__proto__:null,events:e=>Wr([Gr(pr(),((t,o)=>{const n=e.channels,s=re(n),r=o,a=((e,t)=>t.universal?e:P(e,(e=>F(t.channels,e))))(s,r);V(a,(e=>{const o=n[e],s=o.schema,a=es("channel["+e+"] data\nReceiver: "+ii(t.element),s,r.data);o.onReceive(t,a)}))}))])}),mc=[ls("channels",Jn(dn.value,Rn([Si("onReceive"),Cs("schema",Pn())])))];const gc=pa({fields:mc,name:"receiving",active:uc});var pc=Object.freeze({__proto__:null,exhibit:(e,t)=>aa({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const hc=(e,t=!1)=>e.dom.focus({preventScroll:t}),fc=e=>e.dom.blur(),bc=e=>{const t=ft(e).dom;return e.dom===t.activeElement},vc=(e=qo())=>A.from(e.dom.activeElement).map(Le),yc=e=>vc(ft(e)).filter((t=>e.dom.contains(t.dom))),xc=(e,t)=>{const o=ft(t),n=vc(o).bind((e=>{const o=t=>Qe(e,t);return o(t)?A.some(t):((e,t)=>{const o=e=>{for(let n=0;n{vc(o).filter((t=>Qe(t,e))).fold((()=>{hc(e)}),b)})),s},wc=Is([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Sc=(e,t,o,n,s,r)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=s-(i+a.width),d=r-(l+a.height),u=A.some(i),m=A.some(l),g=A.some(c),p=A.some(d),h=A.none();return t.direction.fold((()=>Ma(e,u,m,h,h)),(()=>Ma(e,h,m,g,h)),(()=>Ma(e,u,h,h,p)),(()=>Ma(e,h,h,g,p)),(()=>Ma(e,u,m,h,h)),(()=>Ma(e,u,h,h,p)),(()=>Ma(e,u,m,h,h)),(()=>Ma(e,h,m,g,h)))},kc=(e,t)=>e.fold((()=>{const e=t.rect;return Ma("absolute",A.some(e.x),A.some(e.y),A.none(),A.none())}),((e,o,n,s)=>Sc("absolute",t,e,o,n,s)),((e,o,n,s)=>Sc("fixed",t,e,o,n,s))),Cc=(e,t)=>{const o=k(Ko,t),n=e.fold(o,o,(()=>{const e=Wo();return Ko(t).translate(-e.left,-e.top)})),s=Qt(t),r=$t(t);return Jo(n.left,n.top,s,r)},Oc=(e,t)=>t.fold((()=>e.fold(tn,tn,Jo)),(t=>e.fold(x(t),x(t),(()=>{const o=_c(e,t.x,t.y);return Jo(o.left,o.top,t.width,t.height)})))),_c=(e,t,o)=>{const n=qt(t,o);return e.fold(x(n),x(n),(()=>{const e=Wo();return n.translate(-e.left,-e.top)}))};wc.none;const Tc=wc.relative,Ec=wc.fixed,Ac="data-alloy-placement",Mc=e=>Tt(e,Ac),Dc=Is([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),Bc=(e,t,o,n)=>{const s=e.bubble,r=s.offset,a=((e,t,o)=>{const n=(n,s)=>t[n].map((t=>{const r="top"===n||"bottom"===n,a=r?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,s)+a;return r?Ul(i,e.y,e.bottom):Ul(i,e.x,e.right)})).getOr(s),s=n("left",e.x),r=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Jo(s,r,a-s,i-r)})(n,e.restriction,r),i=e.x+r.left,l=e.y+r.top,c=Jo(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:a>=o&&a<=s&&i>=n&&i<=r,sizeInBounds:l<=s&&l>=o&&c<=r&&c>=n,visibleW:Math.min(d,a>=o?s-a:l-o),visibleH:Math.min(u,i>=n?r-i:c-n)}})(c,a),p=d&&u,h=p?c:((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,s-l),u=Math.max(n,r-c),m=Ul(a,o,d),g=Ul(i,n,u),p=Math.min(m+l,s)-m,h=Math.min(g+c,r)-g;return Jo(m,g,p,h)})(c,a),f=h.width>0&&h.height>0,{maxWidth:b,maxHeight:v}=((e,t,o)=>{const n=x(t.bottom-o.y),s=x(o.bottom-t.y),r=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,s,s,n),a=x(t.right-o.x),i=x(o.right-t.x),l=((e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n))(e,i,i,a);return{maxWidth:l,maxHeight:r}})(e.direction,h,n),y={rect:h,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:s.classesOn,off:s.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?Dc.fit(y):Dc.nofit(y,m,g,f)},Ic=E,Fc=(e,t,o)=>((e,t,o,n)=>Fo(e,t,o,n,!1))(e,t,Ic,o),Rc=(e,t,o)=>((e,t,o,n)=>Fo(e,t,o,n,!0))(e,t,Ic,o),Nc=Io,Lc=["top","bottom","right","left"],zc="data-alloy-transition-timer",Vc=(e,t,o,n,s,a)=>{const i=((e,t,o)=>o.exists((o=>{const n=e.mode;return"all"===n||o[n]!==t[n]})))(n,s,a);if(i||((e,t)=>((e,t)=>Y(t,(t=>_a(e,t))))(e,t.classes))(e,n)){Bt(e,"position",o.position);const a=Cc(t,e),l=kc(t,{...s,rect:a}),c=J(Lc,(e=>l[e]));((e,t)=>{const o=e=>parseFloat(e).toFixed(3);return pe(t,((t,n)=>!((e,t,o=S)=>we(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o)))).isSome()})(o,c)&&(Ft(e,c),i&&((e,t)=>{Ta(e,t.classes),Tt(e,zc).each((t=>{clearTimeout(parseInt(t,10)),At(e,zc)})),((e,t)=>{const o=sn(),n=sn();let s;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return Qe(t.target,e)&&De(n)&&F(Lc,t.raw.propertyName)},i=r=>{if(m(r)||a(r)){o.clear(),n.clear();const a=null==r?void 0:r.raw.type;(m(a)||a===ar())&&(clearTimeout(s),At(e,zc),Ea(e,t.classes))}},l=Fc(e,ir(),(t=>{a(t)&&(l.unbind(),o.set(Fc(e,ar(),i)),n.set(Fc(e,rr(),i)))})),c=(e=>{const t=t=>{const o=Rt(e,t).split(/\s*,\s*/);return P(o,Me)},o=e=>{if(r(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return Ee(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),s=t("transition-duration");return W(s,((e,t,s)=>{const r=o(n[s])+o(t);return Math.max(e,r)}),0)})(e);requestAnimationFrame((()=>{s=setTimeout(i,c+17),Ct(e,zc,s)}))})(e,t)})(e,n),Pt(e))}else Ea(e,n.classes)},Hc=(e,t)=>{((e,t)=>{const o=Wt.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);Bt(e,"max-height",o+"px")})(e,Math.floor(t))},Pc=x(((e,t)=>{Hc(e,t),It(e,{"overflow-x":"hidden","overflow-y":"auto"})})),Uc=x(((e,t)=>{Hc(e,t)})),Wc=(e,t,o)=>void 0===e[t]?o:e[t],jc=(e,t,o,n)=>{const s=((e,t,o,n)=>{Ht(t,"max-height"),Ht(t,"max-width");const s={width:Qt(r=t),height:$t(r)};var r;return((e,t,o,n,s,r)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,s,e,r),g=Bc(m,a,i,r);return g.fold(x(g),((e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?g:Dc.nofit(l,c,d,u)))};return W(t,((e,t)=>{const o=k(l,t);return e.fold(x(e),o)}),Dc.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:Il(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1)).fold(w,w)})(t,n.preference,e,s,o,n.bounds)})(e,t,o,n);return((e,t,o)=>{const n=kc(o.origin,t);o.transition.each((s=>{Vc(e,o.origin,n,s,t,o.lastPlacement)})),Da(e,n)})(t,s,n),((e,t)=>{((e,t)=>{Ct(e,Ac,t)})(e,t.placement)})(t,s),((e,t)=>{const o=t.classes;Ea(e,o.off),Ta(e,o.on)})(t,s),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,s,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,s,n),{layout:s.layout,placement:s.placement}},$c=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],Gc=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>fe(o,e).getOr([]),i=(e,t,o)=>{const n=K($c,o);return{offset:qt(e,t),classesOn:q(o,a),classesOff:q(n,a)}};return{southeast:()=>i(-e,t,["top","alignLeft"]),southwest:()=>i(e,t,["top","alignRight"]),south:()=>i(-e/2,t,["top","alignCentre"]),northeast:()=>i(-e,-t,["bottom","alignLeft"]),northwest:()=>i(e,-t,["bottom","alignRight"]),north:()=>i(-e/2,-t,["bottom","alignCentre"]),east:()=>i(e,-t/2,["valignCentre","left"]),west:()=>i(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>i(s,r,["top","alignLeft","inset"]),insetNorthwest:()=>i(-s,r,["top","alignRight","inset"]),insetNorth:()=>i(-s/2,r,["top","alignCentre","inset"]),insetSoutheast:()=>i(s,-r,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-s,-r,["bottom","alignRight","inset"]),insetSouth:()=>i(-s/2,-r,["bottom","alignCentre","inset"]),insetEast:()=>i(-s,-r/2,["valignCentre","right","inset"]),insetWest:()=>i(s,-r/2,["valignCentre","left","inset"])}},qc=()=>Gc(0,0,{}),Yc=w,Xc=(e,t)=>o=>"rtl"===Kc(o)?t:e,Kc=e=>"rtl"===Rt(e,"direction")?"rtl":"ltr";var Jc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Jc||(Jc={}));const Zc="data-alloy-vertical-dir",Qc=e=>Sl(e,(e=>$e(e)&&_t(e,"data-alloy-vertical-dir")===Jc.BottomToTop)),ed=()=>ks("layouts",[is("onLtr"),is("onRtl"),fs("onBottomLtr"),fs("onBottomRtl")]),td=(e,t,o,n,s,r,a)=>{const i=a.map(Qc).getOr(!1),l=t.layouts.map((t=>t.onLtr(e))),c=t.layouts.map((t=>t.onRtl(e))),d=i?t.layouts.bind((t=>t.onBottomLtr.map((t=>t(e))))).or(l).getOr(s):l.getOr(o),u=i?t.layouts.bind((t=>t.onBottomRtl.map((t=>t(e))))).or(c).getOr(r):c.getOr(n);return Xc(d,u)(e)};var od=[is("hotspot"),fs("bubble"),Cs("overrides",{}),ed(),Ci("placement",((e,t,o)=>{const n=t.hotspot,s=Cc(o,n.element),r=td(e.element,t,cc(),dc(),ic(),lc(),A.some(t.hotspot.element));return A.some(Yc({anchorBox:s,bubble:t.bubble.getOr(qc()),overrides:t.overrides,layouts:r}))}))],nd=[is("x"),is("y"),Cs("height",0),Cs("width",0),Cs("bubble",qc()),Cs("overrides",{}),ed(),Ci("placement",((e,t,o)=>{const n=_c(o,t.x,t.y),s=Jo(n.left,n.top,t.width,t.height),r=td(e.element,t,rc(),ac(),rc(),ac(),A.none());return A.some(Yc({anchorBox:s,bubble:t.bubble,overrides:t.overrides,layouts:r}))}))];const sd=Is([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),rd=e=>e.fold(w,((e,t,o)=>e.translate(-t,-o))),ad=e=>e.fold(w,w),id=e=>W(e,((e,t)=>e.translate(t.left,t.top)),qt(0,0)),ld=e=>{const t=z(e,ad);return id(t)},cd=sd.screen,dd=sd.absolute,ud=(e,t,o)=>{const n=tt(e.element),s=Wo(n),r=((e,t,o)=>{const n=st(o.root).dom;return A.from(n.frameElement).map(Le).filter((t=>{const o=tt(t),n=tt(e.element);return Qe(o,n)})).map(Xt)})(e,0,o).getOr(s);return dd(r,s.left,s.top)},md=(e,t,o,n)=>{const s=cd(qt(e,t));return A.some(((e,t,o)=>({point:e,width:t,height:o}))(s,o,n))},gd=(e,t,o,n,s)=>e.map((e=>{const r=[t,e.point],a=(i=()=>ld(r),l=()=>ld(r),c=()=>(e=>{const t=z(e,rd);return id(t)})(r),n.fold(i,l,c));var i,l,c;const d=(p=a.left,h=a.top,f=e.width,b=e.height,{x:p,y:h,width:f,height:b}),u=o.showAbove?ic():cc(),m=o.showAbove?lc():dc(),g=td(s,o,u,m,u,m,A.none());var p,h,f,b;return Yc({anchorBox:d,bubble:o.bubble.getOr(qc()),overrides:o.overrides,layouts:g})}));var pd=[is("node"),is("root"),fs("bubble"),ed(),Cs("overrides",{}),Cs("showAbove",!1),Ci("placement",((e,t,o)=>{const n=ud(e,0,t);return t.node.filter(xt).bind((s=>{const r=s.dom.getBoundingClientRect(),a=md(r.left,r.top,r.width,r.height),i=t.node.getOr(e.element);return gd(a,n,t,o,i)}))}))];const hd=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),fd=Is([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),bd=(fd.before,fd.on,fd.after,e=>e.fold(w,w,w)),vd=Is([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),yd={domRange:vd.domRange,relative:vd.relative,exact:vd.exact,exactFromRange:e=>vd.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Le(e.startContainer),relative:(e,t)=>bd(e),exact:(e,t,o,n)=>e}))(e);return st(t)},range:hd},xd=(e,t,o)=>{const n=e.document.createRange();var s;return s=n,t.fold((e=>{s.setStartBefore(e.dom)}),((e,t)=>{s.setStart(e.dom,t)}),(e=>{s.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},wd=(e,t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},Sd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),kd=Is([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Cd=(e,t,o)=>t(Le(o.startContainer),o.startOffset,Le(o.endContainer),o.endOffset),Od=(e,t)=>((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:x(e),rtl:A.none}),relative:(t,o)=>({ltr:eo((()=>xd(e,t,o))),rtl:eo((()=>A.some(xd(e,o,t))))}),exact:(t,o,n,s)=>({ltr:eo((()=>wd(e,t,o,n,s))),rtl:eo((()=>A.some(wd(e,n,s,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>kd.rtl(Le(e.endContainer),e.endOffset,Le(e.startContainer),e.startOffset))).getOrThunk((()=>Cd(0,kd.ltr,o))):Cd(0,kd.ltr,o)})(0,o)})(e,t).match({ltr:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},rtl:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(n.dom,s),r.setEnd(t.dom,o),r}});kd.ltr,kd.rtl;const _d=(e,t,o)=>P(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const s=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Le(e);if(s.push(t),!0===o(t))break;n=e}return s})(e,o),t),Td=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Je(o)?[]:z(o.querySelectorAll(e),Le)})(t,e),Ed=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(hd(Le(t.startContainer),t.startOffset,Le(o.endContainer),o.endOffset))}return A.none()},Ad=e=>{if(null===e.anchorNode||null===e.focusNode)return Ed(e);{const t=Le(e.anchorNode),o=Le(e.focusNode);return((e,t,o,n)=>{const s=((e,t,o,n)=>{const s=tt(e).dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s})(e,t,o,n),r=Qe(e,o)&&t===n;return s.collapsed&&!r})(t,e.anchorOffset,o,e.focusOffset)?A.some(hd(t,e.anchorOffset,o,e.focusOffset)):Ed(e)}},Md=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(Sd):A.none()})(Od(e,t)),Dd=((e,t)=>{const o=t=>e(t)?A.from(t.dom.nodeValue):A.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}}})(Ge),Bd=(e,t)=>({element:e,offset:t}),Id=(e,t)=>Ge(e)?Bd(e,t):((e,t)=>{const o=lt(e);if(0===o.length)return Bd(e,t);if(tDd.get(e))(e).length:lt(e).length;return Bd(e,t)}})(e,t),Fd=e=>void 0!==e.foffset,Rd=(e,t)=>t.getSelection.getOrThunk((()=>()=>(e=>(e=>A.from(e.getSelection()))(e).filter((e=>e.rangeCount>0)).bind(Ad))(e)))().map((e=>{if(Fd(e)){const t=Id(e.start,e.soffset),o=Id(e.finish,e.foffset);return yd.range(t.element,t.offset,o.element,o.offset)}return e}));var Nd=[fs("getSelection"),is("root"),fs("bubble"),ed(),Cs("overrides",{}),Cs("showAbove",!1),Ci("placement",((e,t,o)=>{const n=st(t.root).dom,s=ud(e,0,t),r=Rd(n,t).bind((e=>{if(Fd(e)){const t=((e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?A.some(t).map(Sd):A.none()})(Od(e,t)))(n,yd.exactFromRange(e)).orThunk((()=>{const t=Ne("\ufeff");No(e.start,t);const o=Md(n,yd.exact(t,0,t,1));return Uo(t),o}));return t.bind((e=>md(e.left,e.top,e.width,e.height)))}{const t=le(e,(e=>e.dom.getBoundingClientRect())),o={left:Math.min(t.firstCell.left,t.lastCell.left),right:Math.max(t.firstCell.right,t.lastCell.right),top:Math.min(t.firstCell.top,t.lastCell.top),bottom:Math.max(t.firstCell.bottom,t.lastCell.bottom)};return md(o.left,o.top,o.right-o.left,o.bottom-o.top)}})),a=Rd(n,t).bind((e=>Fd(e)?$e(e.start)?A.some(e.start):at(e.start):A.some(e.firstCell))).getOr(e.element);return gd(r,s,t,o,a)}))];const Ld="link-layout",zd=e=>e.x+e.width,Vd=(e,t)=>e.x-t.width,Hd=(e,t)=>e.y-t.height+e.height,Pd=e=>e.y,Ud=(e,t,o)=>Dl(zd(e),Pd(e),o.southeast(),Il(),"southeast",Wl(e,{left:0,top:2}),Ld),Wd=(e,t,o)=>Dl(Vd(e,t),Pd(e),o.southwest(),Fl(),"southwest",Wl(e,{right:1,top:2}),Ld),jd=(e,t,o)=>Dl(zd(e),Hd(e,t),o.northeast(),Rl(),"northeast",Wl(e,{left:0,bottom:3}),Ld),$d=(e,t,o)=>Dl(Vd(e,t),Hd(e,t),o.northwest(),Nl(),"northwest",Wl(e,{right:1,bottom:3}),Ld),Gd=()=>[Ud,Wd,jd,$d],qd=()=>[Wd,Ud,$d,jd];var Yd=[is("item"),ed(),Cs("overrides",{}),Ci("placement",((e,t,o)=>{const n=Cc(o,t.item.element),s=td(e.element,t,Gd(),qd(),Gd(),qd(),A.none());return A.some(Yc({anchorBox:n,bubble:qc(),overrides:t.overrides,layouts:s}))}))],Xd=os("type",{selection:Nd,node:pd,hotspot:od,submenu:Yd,makeshift:nd});const Kd=[hs("classes",jn),Es("mode","all",["all","layout","placement"])],Jd=[Cs("useFixed",T),fs("getBounds")],Zd=[ls("anchor",Xd),ks("transition",Kd)],Qd=(e,t,o,n,s,r)=>{const a=es("placement.info",Nn(Zd),s),i=a.anchor,l=n.element,c=o.get(n.uid);xc((()=>{Bt(l,"position","fixed");const s=Lt(l,"visibility");Bt(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return Ec(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Xt(e.element),o=e.element.dom.getBoundingClientRect();return Tc(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each((e=>{const s=r.orThunk((()=>t.getBounds.map(_))),i=((e,t,o,n,s,r)=>((e,t,o,n,s,r,a,i)=>{const l=Wc(a,"maxHeightFunction",Pc()),c=Wc(a,"maxWidthFunction",b),d=e.anchorBox,u=e.origin,m={bounds:Oc(u,r),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:s,transition:i};return jc(d,t,o,m)})(((e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t))(t.anchorBox,e),n.element,t.bubble,t.layouts,s,o,t.overrides,r))(d,e,s,n,c,a.transition);o.set(n.uid,i)})),s.fold((()=>{Ht(l,"visibility")}),(e=>{Bt(l,"visibility",e)})),Lt(l,"left").isNone()&&Lt(l,"top").isNone()&&Lt(l,"right").isNone()&&Lt(l,"bottom").isNone()&&ye(Lt(l,"position"),"fixed")&&Ht(l,"position")}),l)};var eu=Object.freeze({__proto__:null,position:(e,t,o,n,s)=>{const r=A.none();Qd(e,t,o,n,s,r)},positionWithinBounds:Qd,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const s=n.element;V(["position","left","right","top","bottom"],(e=>Ht(s,e))),(e=>{At(e,Ac)})(s),o.clear(n.uid)}});const tu=pa({fields:Jd,name:"positioning",active:pc,apis:eu,state:Object.freeze({__proto__:null,init:()=>{let e={};return ua({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>fe(e,t)})}})}),ou=e=>e.getSystem().isConnected(),nu=e=>{Lr(e,Tr());const t=e.components();V(t,nu)},su=e=>{const t=e.components();V(t,su),Lr(e,_r())},ru=(e,t)=>{e.getSystem().addToWorld(t),xt(e.element)&&su(t)},au=e=>{nu(e),e.getSystem().removeFromWorld(e)},iu=(e,t)=>{Vo(e.element,t.element)},lu=(e,t)=>{cu(e,t,Vo)},cu=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),xt(e.element)&&su(t),e.syncComponents()},du=e=>{nu(e),Uo(e.element),e.getSystem().removeFromWorld(e)},uu=e=>{const t=rt(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()));du(e),t.each((e=>{e.syncComponents()}))},mu=e=>{const t=e.components();V(t,du),Po(e.element),e.syncComponents()},gu=(e,t)=>{hu(e,t,Vo)},pu=(e,t)=>{hu(e,t,Lo)},hu=(e,t,o)=>{o(e,t.element);const n=lt(t.element);V(n,(e=>{t.getByDom(e).each(su)}))},fu=e=>{const t=lt(e.element);V(t,(t=>{e.getByDom(t).each(nu)})),Uo(e.element)},bu=(e,t,o,n)=>{o.get().each((t=>{mu(e)}));const s=t.getAttachPoint(e);lu(s,e);const r=e.getSystem().build(n);return lu(e,r),o.set(r),r},vu=(e,t,o,n)=>{const s=bu(e,t,o,n);return t.onOpen(e,s),s},yu=(e,t,o)=>{o.get().each((n=>{mu(e),uu(e),t.onClose(e,n),o.clear()}))},xu=(e,t,o)=>o.isOpen(),wu=(e,t,o)=>{const n=t.getAttachPoint(e);Bt(e.element,"position",tu.getMode(n)),((e,t,o,n)=>{Lt(e.element,t).fold((()=>{At(e.element,o)}),(t=>{Ct(e.element,o,t)})),Bt(e.element,t,"hidden")})(e,"visibility",t.cloakVisibilityAttr)},Su=(e,t,o)=>{(e=>R(["top","left","right","bottom"],(t=>Lt(e,t).isSome())))(e.element)||Ht(e.element,"position"),((e,t,o)=>{Tt(e.element,o).fold((()=>Ht(e.element,t)),(o=>Bt(e.element,t,o)))})(e,"visibility",t.cloakVisibilityAttr)};var ku=Object.freeze({__proto__:null,cloak:wu,decloak:Su,open:vu,openWhileCloaked:(e,t,o,n,s)=>{wu(e,t),vu(e,t,o,n),s(),Su(e,t)},close:yu,isOpen:xu,isPartOf:(e,t,o,n)=>xu(0,0,o)&&o.get().exists((o=>t.isPartOf(e,o,n))),getState:(e,t,o)=>o.get(),setContent:(e,t,o,n)=>o.get().map((()=>bu(e,t,o,n)))}),Cu=Object.freeze({__proto__:null,events:(e,t)=>Wr([Gr(yr(),((o,n)=>{yu(o,e,t)}))])}),Ou=[xi("onOpen"),xi("onClose"),is("isPartOf"),is("getAttachPoint"),Cs("cloakVisibilityAttr","data-precloak-visibility")],_u=Object.freeze({__proto__:null,init:()=>{const e=rn(),t=x("not-implemented");return ua({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Tu=pa({fields:Ou,name:"sandboxing",active:Cu,apis:ku,state:_u}),Eu=x("dismiss.popups"),Au=x("reposition.popups"),Mu=x("mouse.released"),Du=Rn([Cs("isExtraPart",T),ks("fireEventInstead",[Cs("event",Er())])]),Bu=e=>{const t=es("Dismissal",Du,e);return{[Eu()]:{schema:Rn([is("target")]),onReceive:(e,o)=>{Tu.isOpen(e)&&(Tu.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold((()=>Tu.close(e)),(t=>Lr(e,t.event))))}}}},Iu=Rn([ks("fireEventInstead",[Cs("event",Ar())]),ms("doReposition")]),Fu=e=>{const t=es("Reposition",Iu,e);return{[Au()]:{onReceive:e=>{Tu.isOpen(e)&&t.fireEventInstead.fold((()=>t.doReposition(e)),(t=>Lr(e,t.event)))}}}},Ru=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},Nu=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var Lu=Object.freeze({__proto__:null,onLoad:Ru,onUnload:Nu,setValue:(e,t,o,n)=>{t.store.manager.setValue(e,t,o,n)},getValue:(e,t,o)=>t.store.manager.getValue(e,t,o),getState:(e,t,o)=>o}),zu=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[ea(((o,n)=>{Ru(o,e,t)})),ta(((o,n)=>{Nu(o,e,t)}))]:[ia(e,t,Ru)];return Wr(o)}});const Vu=()=>{const e=on(null);return ua({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},Hu=()=>{const e=on({}),t=on({});return ua({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:o=>fe(e.get(),o).orThunk((()=>fe(t.get(),o))),update:o=>{const n=e.get(),s=t.get(),r={},a={};V(o,(e=>{r[e.value]=e,fe(e,"meta").each((t=>{fe(t,"text").each((t=>{a[t]=e}))}))})),e.set({...n,...r}),t.set({...s,...a})},clear:()=>{e.set({}),t.set({})}})};var Pu=Object.freeze({__proto__:null,memory:Vu,dataset:Hu,manual:()=>ua({readState:b}),init:e=>e.store.manager.state(e)});const Uu=(e,t,o,n)=>{const s=t.store;o.update([n]),s.setValue(e,n),t.onSetValue(e,n)};var Wu=[fs("initialValue"),is("getFallbackEntry"),is("getDataKey"),is("setValue"),Ci("manager",{setValue:Uu,getValue:(e,t,o)=>{const n=t.store,s=n.getDataKey(e);return o.lookup(s).getOrThunk((()=>n.getFallbackEntry(s)))},onLoad:(e,t,o)=>{t.store.initialValue.each((n=>{Uu(e,t,o,n)}))},onUnload:(e,t,o)=>{o.clear()},state:Hu})],ju=[is("getValue"),Cs("setValue",b),fs("initialValue"),Ci("manager",{setValue:(e,t,o,n)=>{t.store.setValue(e,n),t.onSetValue(e,n)},getValue:(e,t,o)=>t.store.getValue(e),onLoad:(e,t,o)=>{t.store.initialValue.each((o=>{t.store.setValue(e,o)}))},onUnload:b,state:da.init})],$u=[fs("initialValue"),Ci("manager",{setValue:(e,t,o,n)=>{o.set(n),t.onSetValue(e,n)},getValue:(e,t,o)=>o.get(),onLoad:(e,t,o)=>{t.store.initialValue.each((e=>{o.isNotSet()&&o.set(e)}))},onUnload:(e,t,o)=>{o.clear()},state:Vu})],Gu=[Os("store",{mode:"memory"},os("mode",{memory:$u,manual:ju,dataset:Wu})),xi("onSetValue"),Cs("resetOnDom",!1)];const qu=pa({fields:Gu,name:"representing",active:zu,apis:Lu,extra:{setValueFrom:(e,t)=>{const o=qu.getValue(t);qu.setValue(e,o)}},state:Pu}),Yu=(e,t)=>Bs(e,{},z(t,(t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,ss(o,o,{tag:"option",process:{}},An((e=>fn("The field: "+o+" is forbidden. "+n))));var o,n})).concat([rs("dump",w)])),Xu=e=>e.dump,Ku=(e,t)=>({...ma(t),...e.dump}),Ju=Yu,Zu=Ku,Qu="placeholder",em=Is([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),tm=e=>be(e,"uiType"),om=(e,t,o,n)=>((e,t,o,n)=>tm(o)&&o.uiType===Qu?((e,t,o,n)=>e.exists((e=>e!==o.owner))?em.single(!0,x(o)):fe(n,o.name).fold((()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+re(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))}),(e=>e.replace())))(e,0,o,n):em.single(!1,x(o)))(e,0,o,n).fold(((s,r)=>{const a=tm(o)?r(t,o.config,o.validated):r(t),i=fe(a,"components").getOr([]),l=q(i,(o=>om(e,t,o,n)));return[{...a,components:l}]}),((e,n)=>{if(tm(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)})),nm=em.single,sm=em.multiple,rm=x(Qu),am=Is([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),im=Cs("factory",{sketch:w}),lm=Cs("schema",[]),cm=is("name"),dm=ss("pname","pname",kn((e=>"")),Pn()),um=rs("schema",(()=>[fs("preprocess")])),mm=Cs("defaults",x({})),gm=Cs("overrides",x({})),pm=Nn([im,lm,cm,dm,mm,gm]),hm=Nn([im,lm,cm,mm,gm]),fm=Nn([im,lm,cm,dm,mm,gm]),bm=Nn([im,um,cm,is("unit"),dm,mm,gm]),vm=e=>e.fold(A.some,A.none,A.some,A.some),ym=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},xm=(e,t)=>o=>{const n=es("Converting part type",t,o);return e(n)},wm=xm(am.required,pm),Sm=xm(am.external,hm),km=xm(am.optional,fm),Cm=xm(am.group,bm),Om=x("entirety");var _m=Object.freeze({__proto__:null,required:wm,external:Sm,optional:km,group:Cm,asNamedPart:vm,name:ym,asCommon:e=>e.fold(w,w,w,w),original:Om});const Tm=(e,t,o,n)=>wn(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),Em=(e,t)=>{const o={};return V(t,(t=>{vm(t).each((t=>{const n=Am(e,t.pname);o[t.name]=o=>{const s=es("Part: "+t.name+" in "+e,Nn(t.schema),o);return{...n,config:o,validated:s}}}))})),o},Am=(e,t)=>({uiType:rm(),owner:e,name:t}),Mm=(e,t,o)=>({uiType:rm(),owner:e,name:t,config:o,validated:{}}),Dm=e=>q(e,(e=>e.fold(A.none,A.some,A.none,A.none).map((e=>gs(e.name,e.schema.concat([Oi(Om())])))).toArray())),Bm=e=>z(e,ym),Im=(e,t,o)=>((e,t,o)=>{const n={},s={};return V(o,(e=>{e.fold((e=>{n[e.pname]=nm(!0,((t,o,n)=>e.factory.sketch(Tm(t,e,o,n))))}),(e=>{const o=t.parts[e.name];s[e.name]=x(e.factory.sketch(Tm(t,e,o[Om()]),o))}),(e=>{n[e.pname]=nm(!1,((t,o,n)=>e.factory.sketch(Tm(t,e,o,n))))}),(e=>{n[e.pname]=sm(!0,((t,o,n)=>{const s=t[e.name];return z(s,(o=>e.factory.sketch(wn(e.defaults(t,o,n),o,e.overrides(t,o)))))}))}))})),{internals:x(n),externals:x(s)}})(0,t,o),Fm=(e,t,o)=>((e,t,o,n)=>{const s=le(n,((e,t)=>((e,t)=>{let o=!1;return{name:x(e),required:()=>t.fold(((e,t)=>e),((e,t)=>e)),used:()=>o,replace:()=>{if(o)throw new Error("Trying to use the same placeholder more than once: "+e);return o=!0,t}}})(t,e))),r=((e,t,o,n)=>q(o,(o=>om(e,t,o,n))))(e,t,o,s);return ie(s,(o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))})),r})(A.some(e),t,t.components,o),Rm=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},Nm=(e,t,o)=>Rm(e,t,o).getOrDie("Could not find part: "+o),Lm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,(e=>{n[e]=x(r.getByUid(s[e]))})),n},zm=(e,t)=>{const o=e.getSystem();return le(t.partUids,((e,t)=>x(o.getByUid(e))))},Vm=e=>re(e.partUids),Hm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return V(o,(e=>{n[e]=x(r.getByUid(s[e]).getOrDie())})),n},Pm=(e,t)=>{const o=Bm(t);return Rs(z(o,(t=>({key:t,value:e+"-"+t}))))},Um=e=>ss("partUids","partUids",On((t=>Pm(t.uid,e))),Pn());var Wm=Object.freeze({__proto__:null,generate:Em,generateOne:Mm,schemas:Dm,names:Bm,substitutes:Im,components:Fm,defaultUids:Pm,defaultUidsSchema:Um,getAllParts:zm,getAllPartNames:Vm,getPart:Rm,getPartOrDie:Nm,getParts:Lm,getPartsOrDie:Hm});const jm=(e,t,o,n,s)=>{const r=((e,t)=>(e.length>0?[gs("parts",e)]:[]).concat([is("uid"),Cs("dom",{}),Cs("components",[]),Oi("originalSpec"),Cs("debug.sketcher",{})]).concat(t))(n,s);return es(e+" [SpecSchema]",Rn(r.concat(t)),o)},$m=(e,t,o,n,s)=>{const r=Gm(s),a=Dm(o),i=Um(o),l=jm(e,t,r,a,[i]),c=Im(0,l,o);return n(l,Fm(e,l,c.internals()),r,c.externals())},Gm=e=>(e=>be(e,"uid"))(e)?e:{...e,uid:Vi("uid")},qm=Rn([is("name"),is("factory"),is("configFields"),Cs("apis",{}),Cs("extraApis",{})]),Ym=Rn([is("name"),is("factory"),is("configFields"),is("partFields"),Cs("apis",{}),Cs("extraApis",{})]),Xm=e=>{const t=es("Sketcher for "+e.name,qm,e),o=le(t.apis,Gi),n=le(t.extraApis,((e,t)=>ra(e,t)));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const s=Gm(n);return o(jm(e,t,s,[],[]),s)})(t.name,t.configFields,t.factory,e),...o,...n}},Km=e=>{const t=es("Sketcher for "+e.name,Ym,e),o=Em(t.name,t.partFields),n=le(t.apis,Gi),s=le(t.extraApis,((e,t)=>ra(e,t)));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>$m(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...s}},Jm=e=>Xe("input")(e)&&"radio"!==_t(e,"type")||Xe("textarea")(e);var Zm=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const Qm=[is("find")],eg=pa({fields:Qm,name:"composing",apis:Zm}),tg=["input","button","textarea","select"],og=(e,t,o)=>{(t.disabled()?lg:cg)(e,t)},ng=(e,t)=>!0===t.useNative&&F(tg,Ue(e.element)),sg=e=>{Ct(e.element,"disabled","disabled")},rg=e=>{At(e.element,"disabled")},ag=e=>{Ct(e.element,"aria-disabled","true")},ig=e=>{Ct(e.element,"aria-disabled","false")},lg=(e,t,o)=>{t.disableClass.each((t=>{ka(e.element,t)})),(ng(e,t)?sg:ag)(e),t.onDisabled(e)},cg=(e,t,o)=>{t.disableClass.each((t=>{Oa(e.element,t)})),(ng(e,t)?rg:ig)(e),t.onEnabled(e)},dg=(e,t)=>ng(e,t)?(e=>Et(e.element,"disabled"))(e):(e=>"true"===_t(e.element,"aria-disabled"))(e);var ug=Object.freeze({__proto__:null,enable:cg,disable:lg,isDisabled:dg,onLoad:og,set:(e,t,o,n)=>{(n?lg:cg)(e,t)}}),mg=Object.freeze({__proto__:null,exhibit:(e,t)=>aa({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>Wr([jr(hr(),((t,o)=>dg(t,e))),ia(e,t,og)])}),gg=[Ms("disabled",T),Cs("useNative",!0),fs("disableClass"),xi("onDisabled"),xi("onEnabled")];const pg=pa({fields:gg,name:"disabling",active:mg,apis:ug}),hg=(e,t,o,n)=>{const s=Td(e.element,"."+t.highlightClass);V(s,(o=>{R(n,(e=>Qe(e.element,o)))||(Oa(o,t.highlightClass),e.getSystem().getByDom(o).each((o=>{t.onDehighlight(e,o),Lr(o,Nr())})))}))},fg=(e,t,o,n)=>{hg(e,t,0,[n]),bg(e,t,o,n)||(ka(n.element,t.highlightClass),t.onHighlight(e,n),Lr(n,Rr()))},bg=(e,t,o,n)=>_a(n.element,t.highlightClass),vg=(e,t,o)=>_l(e.element,"."+t.itemClass).bind((t=>e.getSystem().getByDom(t).toOptional())),yg=(e,t,o)=>{const n=Td(e.element,"."+t.itemClass);return(n.length>0?A.some(n[n.length-1]):A.none()).bind((t=>e.getSystem().getByDom(t).toOptional()))},xg=(e,t,o,n)=>{const s=Td(e.element,"."+t.itemClass);return $(s,(e=>_a(e,t.highlightClass))).bind((t=>{const o=Pl(t,n,0,s.length-1);return e.getSystem().getByDom(s[o]).toOptional()}))},wg=(e,t,o)=>{const n=Td(e.element,"."+t.itemClass);return xe(z(n,(t=>e.getSystem().getByDom(t).toOptional())))};var Sg=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>hg(e,t,0,[]),dehighlight:(e,t,o,n)=>{bg(e,t,o,n)&&(Oa(n.element,t.highlightClass),t.onDehighlight(e,n),Lr(n,Nr()))},highlight:fg,highlightFirst:(e,t,o)=>{vg(e,t).each((n=>{fg(e,t,o,n)}))},highlightLast:(e,t,o)=>{yg(e,t).each((n=>{fg(e,t,o,n)}))},highlightAt:(e,t,o,n)=>{((e,t,o,n)=>{const s=Td(e.element,"."+t.itemClass);return A.from(s[n]).fold((()=>dn.error(new Error("No element found with index "+n))),e.getSystem().getByDom)})(e,t,0,n).fold((e=>{throw e}),(n=>{fg(e,t,o,n)}))},highlightBy:(e,t,o,n)=>{const s=wg(e,t);j(s,n).each((n=>{fg(e,t,o,n)}))},isHighlighted:bg,getHighlighted:(e,t,o)=>_l(e.element,"."+t.highlightClass).bind((t=>e.getSystem().getByDom(t).toOptional())),getFirst:vg,getLast:yg,getPrevious:(e,t,o)=>xg(e,t,0,-1),getNext:(e,t,o)=>xg(e,t,0,1),getCandidates:wg}),kg=[is("highlightClass"),is("itemClass"),xi("onHighlight"),xi("onDehighlight")];const Cg=pa({fields:kg,name:"highlighting",apis:Sg}),Og=[8],_g=[9],Tg=[13],Eg=[27],Ag=[32],Mg=[37],Dg=[38],Bg=[39],Ig=[40],Fg=(e,t,o)=>{const n=X(e.slice(0,t)),s=X(e.slice(t+1));return j(n.concat(s),o)},Rg=(e,t,o)=>{const n=X(e.slice(0,t));return j(n,o)},Ng=(e,t,o)=>{const n=e.slice(0,t),s=e.slice(t+1);return j(s.concat(n),o)},Lg=(e,t,o)=>{const n=e.slice(t+1);return j(n,o)},zg=e=>t=>{const o=t.raw;return F(e,o.which)},Vg=e=>t=>Y(e,(e=>e(t))),Hg=e=>!0===e.raw.shiftKey,Pg=e=>!0===e.raw.ctrlKey,Ug=C(Hg),Wg=(e,t)=>({matches:e,classification:t}),jg=(e,t,o)=>{t.exists((e=>o.exists((t=>Qe(t,e)))))||zr(e,Mr(),{prevFocus:t,newFocus:o})},$g=()=>{const e=e=>yc(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const s=e(t);jg(t,n,s)}}},Gg=()=>{const e=e=>Cg.getHighlighted(e).map((e=>e.element));return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(b,(e=>{Cg.highlight(t,e)}));const s=e(t);jg(t,n,s)}}};var qg;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(qg||(qg={}));const Yg=(e,t,o,n,s)=>{const r=(e,t,o,n,s)=>{return(r=o(e,t,n,s),a=t.event,j(r,(e=>e.matches(a))).map((e=>e.classification))).bind((o=>o(e,t,n,s)));var r,a},a={schema:()=>e.concat([Cs("focusManager",$g()),Os("focusInside","onFocus",Kn((e=>F(["onFocus","onEnterOrSpace","onApi"],e)?dn.value(e):dn.error("Invalid value for focusInside")))),Ci("handler",a),Ci("state",t),Ci("sendFocusIn",s)]),processKey:r,toEvents:(e,t)=>{const a=e.focusInside!==qg.OnFocusMode?A.none():s(e).map((o=>Gr(ur(),((n,s)=>{o(n,e,t),s.stop()})))),i=[Gr(er(),((n,a)=>{r(n,a,o,e,t).fold((()=>{((o,n)=>{const r=zg(Ag.concat(Tg))(n.event);e.focusInside===qg.OnEnterOrSpaceMode&&r&&Vs(o,n)&&s(e).each((s=>{s(o,e,t),n.stop()}))})(n,a)}),(e=>{a.stop()}))})),Gr(tr(),((o,s)=>{r(o,s,n,e,t).each((e=>{s.stop()}))}))];return Wr(a.toArray().concat(i))}};return a},Xg=e=>{const t=[fs("onEscape"),fs("onEnter"),Cs("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Cs("firstTabstop",0),Cs("useTabstopAt",E),fs("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind((e=>Tl(t,e))).getOr(t);return jt(o)>0},n=(e,t)=>t.focusManager.get(e).bind((e=>Tl(e,t.selector))),s=(e,t,n)=>{((e,t)=>{const n=Td(e.element,t.selector),s=P(n,(e=>o(t,e)));return A.from(s[t.firstTabstop])})(e,t).each((o=>{t.focusManager.set(e,o)}))},r=(e,t,s,r)=>{const a=Td(e.element,s.selector);return n(e,s).bind((t=>$(a,k(Qe,t)).bind((t=>((e,t,n,s,r)=>r(t,n,(e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(s,e))).fold((()=>s.cyclic?A.some(!0):A.none()),(t=>(s.focusManager.set(e,t),A.some(!0)))))(e,a,t,s,r)))))},a=(e,t,o)=>{const n=o.cyclic?Fg:Rg;return r(e,0,o,n)},i=(e,t,o)=>{const n=o.cyclic?Ng:Lg;return r(e,0,o,n)},l=x([Wg(Vg([Hg,zg(_g)]),a),Wg(zg(_g),i),Wg(Vg([Ug,zg(Tg)]),((e,t,o)=>o.onEnter.bind((o=>o(e,t)))))]),c=x([Wg(zg(Eg),((e,t,o)=>o.onEscape.bind((o=>o(e,t))))),Wg(zg(_g),((e,t,o)=>n(e,o).filter((e=>!o.useTabstopAt(e))).bind((n=>((e=>(e=>rt(e))(e).bind(dt).exists((t=>Qe(t,e))))(n)?a:i)(e,t,o)))))]);return Yg(t,da.init,l,c,(()=>A.some(s)))};var Kg=Xg(rs("cyclic",T)),Jg=Xg(rs("cyclic",E));const Zg=(e,t,o)=>Jm(o)&&zg(Ag)(t.event)?A.none():((e,t,o)=>(Hr(e,o,hr()),A.some(!0)))(e,0,o),Qg=(e,t)=>A.some(!0),ep=[Cs("execute",Zg),Cs("useSpace",!1),Cs("useEnter",!0),Cs("useControlEnter",!1),Cs("useDown",!1)],tp=(e,t,o)=>o.execute(e,t,e.element);var op=Yg(ep,da.init,((e,t,o,n)=>{const s=o.useSpace&&!Jm(e.element)?Ag:[],r=o.useEnter?Tg:[],a=o.useDown?Ig:[],i=s.concat(r).concat(a);return[Wg(zg(i),tp)].concat(o.useControlEnter?[Wg(Vg([Pg,zg(Tg)]),tp)]:[])}),((e,t,o,n)=>o.useSpace&&!Jm(e.element)?[Wg(zg(Ag),Qg)]:[]),(()=>A.none()));const np=()=>{const e=rn();return ua({readState:()=>e.get().map((e=>({numRows:String(e.numRows),numColumns:String(e.numColumns)}))).getOr({numRows:"?",numColumns:"?"}),setGridSize:(t,o)=>{e.set({numRows:t,numColumns:o})},getNumRows:()=>e.get().map((e=>e.numRows)),getNumColumns:()=>e.get().map((e=>e.numColumns))})};var sp=Object.freeze({__proto__:null,flatgrid:np,init:e=>e.state(e)});const rp=e=>(t,o,n,s)=>{const r=e(t.element);return cp(r,t,o,n,s)},ap=(e,t)=>{const o=Xc(e,t);return rp(o)},ip=(e,t)=>{const o=Xc(t,e);return rp(o)},lp=e=>(t,o,n,s)=>cp(e,t,o,n,s),cp=(e,t,o,n,s)=>n.focusManager.get(t).bind((o=>e(t.element,o,n,s))).map((e=>(n.focusManager.set(t,e),!0))),dp=lp,up=lp,mp=lp,gp=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),pp=(e,t,o)=>{const n=Td(e,o);return((e,o)=>$(e,(e=>Qe(e,t))).map((t=>({index:t,candidates:e}))))(P(n,gp))},hp=(e,t)=>$(e,(e=>Qe(t,e))),fp=(e,t,o,n)=>n(Math.floor(t/o),t%o).bind((t=>{const n=t.row*o+t.column;return n>=0&&nfp(e,t,n,((t,r)=>{const a=t===o-1?e.length-t*n:n,i=Pl(r,s,0,a-1);return A.some({row:t,column:i})})),vp=(e,t,o,n,s)=>fp(e,t,n,((t,r)=>{const a=Pl(t,s,0,o-1),i=a===o-1?e.length-a*n:n,l=Ul(r,0,i-1);return A.some({row:a,column:l})})),yp=[is("selector"),Cs("execute",Zg),wi("onEscape"),Cs("captureTab",!1),_i()],xp=(e,t,o)=>{_l(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},wp=e=>(t,o,n,s)=>pp(t,o,n.selector).bind((t=>e(t.candidates,t.index,s.getNumRows().getOr(n.initSize.numRows),s.getNumColumns().getOr(n.initSize.numColumns)))),Sp=(e,t,o)=>o.captureTab?A.some(!0):A.none(),kp=wp(((e,t,o,n)=>bp(e,t,o,n,-1))),Cp=wp(((e,t,o,n)=>bp(e,t,o,n,1))),Op=wp(((e,t,o,n)=>vp(e,t,o,n,-1))),_p=wp(((e,t,o,n)=>vp(e,t,o,n,1))),Tp=x([Wg(zg(Mg),ap(kp,Cp)),Wg(zg(Bg),ip(kp,Cp)),Wg(zg(Dg),dp(Op)),Wg(zg(Ig),up(_p)),Wg(Vg([Hg,zg(_g)]),Sp),Wg(Vg([Ug,zg(_g)]),Sp),Wg(zg(Ag.concat(Tg)),((e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind((e=>Tl(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n)))))]),Ep=x([Wg(zg(Eg),((e,t,o)=>o.onEscape(e,t))),Wg(zg(Ag),Qg)]);var Ap=Yg(yp,np,Tp,Ep,(()=>A.some(xp)));const Mp=(e,t,o,n,s)=>{const r=(e,t,o)=>s(e,t,n,0,o.length-1,o[t],(t=>{return n=o[t],"button"===Ue(n)&&"disabled"===_t(n,"disabled")?r(e,t,o):A.from(o[t]);var n}));return pp(e,o,t).bind((e=>{const t=e.index,o=e.candidates;return r(t,t,o)}))},Dp=(e,t,o,n)=>Mp(e,t,o,n,((e,t,o,n,s,r,a)=>{const i=Ul(t+o,n,s);return i===e?A.from(r):a(i)})),Bp=(e,t,o,n)=>Mp(e,t,o,n,((e,t,o,n,s,r,a)=>{const i=Pl(t,o,n,s);return i===e?A.none():a(i)})),Ip=[is("selector"),Cs("getInitial",A.none),Cs("execute",Zg),wi("onEscape"),Cs("executeOnMove",!1),Cs("allowVertical",!0),Cs("allowHorizontal",!0),Cs("cycles",!0)],Fp=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind((e=>Tl(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n))),Rp=(e,t,o)=>{t.getInitial(e).orThunk((()=>_l(e.element,t.selector))).each((o=>{t.focusManager.set(e,o)}))},Np=(e,t,o)=>(o.cycles?Bp:Dp)(e,o.selector,t,-1),Lp=(e,t,o)=>(o.cycles?Bp:Dp)(e,o.selector,t,1),zp=e=>(t,o,n,s)=>e(t,o,n,s).bind((()=>n.executeOnMove?Fp(t,o,n):A.some(!0))),Vp=x([Wg(zg(Ag),Qg),Wg(zg(Eg),((e,t,o)=>o.onEscape(e,t)))]);var Hp=Yg(Ip,da.init,((e,t,o,n)=>{const s=[...o.allowHorizontal?Mg:[]].concat(o.allowVertical?Dg:[]),r=[...o.allowHorizontal?Bg:[]].concat(o.allowVertical?Ig:[]);return[Wg(zg(s),zp(ap(Np,Lp))),Wg(zg(r),zp(ip(Np,Lp))),Wg(zg(Tg),Fp),Wg(zg(Ag),Fp)]}),Vp,(()=>A.some(Rp)));const Pp=(e,t,o)=>A.from(e[t]).bind((e=>A.from(e[o]).map((e=>({rowIndex:t,columnIndex:o,cell:e}))))),Up=(e,t,o,n)=>{const s=e[t].length,r=Pl(o,n,0,s-1);return Pp(e,t,r)},Wp=(e,t,o,n)=>{const s=Pl(o,n,0,e.length-1),r=e[s].length,a=Ul(t,0,r-1);return Pp(e,s,a)},jp=(e,t,o,n)=>{const s=e[t].length,r=Ul(o+n,0,s-1);return Pp(e,t,r)},$p=(e,t,o,n)=>{const s=Ul(o+n,0,e.length-1),r=e[s].length,a=Ul(t,0,r-1);return Pp(e,s,a)},Gp=[gs("selectors",[is("row"),is("cell")]),Cs("cycles",!0),Cs("previousSelector",A.none),Cs("execute",Zg)],qp=(e,t,o)=>{t.previousSelector(e).orThunk((()=>{const o=t.selectors;return _l(e.element,o.cell)})).each((o=>{t.focusManager.set(e,o)}))},Yp=(e,t)=>(o,n,s)=>{const r=s.cycles?e:t;return Tl(n,s.selectors.row).bind((e=>{const t=Td(e,s.selectors.cell);return hp(t,n).bind((t=>{const n=Td(o,s.selectors.row);return hp(n,e).bind((e=>{const o=((e,t)=>z(e,(e=>Td(e,t.selectors.cell))))(n,s);return r(o,e,t).map((e=>e.cell))}))}))}))},Xp=Yp(((e,t,o)=>Up(e,t,o,-1)),((e,t,o)=>jp(e,t,o,-1))),Kp=Yp(((e,t,o)=>Up(e,t,o,1)),((e,t,o)=>jp(e,t,o,1))),Jp=Yp(((e,t,o)=>Wp(e,o,t,-1)),((e,t,o)=>$p(e,o,t,-1))),Zp=Yp(((e,t,o)=>Wp(e,o,t,1)),((e,t,o)=>$p(e,o,t,1))),Qp=x([Wg(zg(Mg),ap(Xp,Kp)),Wg(zg(Bg),ip(Xp,Kp)),Wg(zg(Dg),dp(Jp)),Wg(zg(Ig),up(Zp)),Wg(zg(Ag.concat(Tg)),((e,t,o)=>yc(e.element).bind((n=>o.execute(e,t,n)))))]),eh=x([Wg(zg(Ag),Qg)]);var th=Yg(Gp,da.init,Qp,eh,(()=>A.some(qp)));const oh=[is("selector"),Cs("execute",Zg),Cs("moveOnTab",!1)],nh=(e,t,o)=>o.focusManager.get(e).bind((n=>o.execute(e,t,n))),sh=(e,t,o)=>{_l(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},rh=(e,t,o)=>Bp(e,o.selector,t,-1),ah=(e,t,o)=>Bp(e,o.selector,t,1),ih=x([Wg(zg(Dg),mp(rh)),Wg(zg(Ig),mp(ah)),Wg(Vg([Hg,zg(_g)]),((e,t,o,n)=>o.moveOnTab?mp(rh)(e,t,o,n):A.none())),Wg(Vg([Ug,zg(_g)]),((e,t,o,n)=>o.moveOnTab?mp(ah)(e,t,o,n):A.none())),Wg(zg(Tg),nh),Wg(zg(Ag),nh)]),lh=x([Wg(zg(Ag),Qg)]);var ch=Yg(oh,da.init,ih,lh,(()=>A.some(sh)));const dh=[wi("onSpace"),wi("onEnter"),wi("onShiftEnter"),wi("onLeft"),wi("onRight"),wi("onTab"),wi("onShiftTab"),wi("onUp"),wi("onDown"),wi("onEscape"),Cs("stopSpaceKeyup",!1),fs("focusIn")];var uh=Yg(dh,da.init,((e,t,o)=>[Wg(zg(Ag),o.onSpace),Wg(Vg([Ug,zg(Tg)]),o.onEnter),Wg(Vg([Hg,zg(Tg)]),o.onShiftEnter),Wg(Vg([Hg,zg(_g)]),o.onShiftTab),Wg(Vg([Ug,zg(_g)]),o.onTab),Wg(zg(Dg),o.onUp),Wg(zg(Ig),o.onDown),Wg(zg(Mg),o.onLeft),Wg(zg(Bg),o.onRight),Wg(zg(Ag),o.onSpace)]),((e,t,o)=>[...o.stopSpaceKeyup?[Wg(zg(Ag),Qg)]:[],Wg(zg(Eg),o.onEscape)]),(e=>e.focusIn));const mh=Kg.schema(),gh=Jg.schema(),ph=Hp.schema(),hh=Ap.schema(),fh=th.schema(),bh=op.schema(),vh=ch.schema(),yh=uh.schema(),xh=fa({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:mh,cyclic:gh,flow:ph,flatgrid:hh,matrix:fh,execution:bh,menu:vh,special:yh}),name:"keying",active:{events:(e,t)=>e.handler.toEvents(e,t)},apis:{focusIn:(e,t,o)=>{t.sendFocusIn(t).fold((()=>{e.getSystem().triggerFocus(e.element,e.element)}),(n=>{n(e,t,o)}))},setGridSize:(e,t,o,n,s)=>{(e=>ve(e,"setGridSize"))(o)?o.setGridSize(n,s):console.error("Layout does not support setGridSize")}},state:sp}),wh=(e,t)=>{xc((()=>{((e,t,o)=>{const n=e.components();(e=>{V(e.components(),(e=>Uo(e.element))),Po(e.element),e.syncComponents()})(e);const s=o(t),r=K(n,s);V(r,(t=>{nu(t),e.getSystem().removeFromWorld(t)})),V(s,(t=>{ou(t)?iu(e,t):(e.getSystem().addToWorld(t),iu(e,t),xt(e.element)&&su(t))})),e.syncComponents()})(e,t,(()=>z(t,e.getSystem().build)))}),e.element)},Sh=(e,t)=>{xc((()=>{((o,n,s)=>{const r=o.components(),a=q(n,(e=>$i(e).toArray()));V(r,(e=>{F(a,e)||au(e)}));const i=((e,t,o)=>rl(e,t,((t,n)=>al(e,n,t,o))))(e.element,t,e.getSystem().buildOrPatch),l=K(r,i);V(l,(e=>{ou(e)&&au(e)})),V(i,(e=>{ou(e)||ru(o,e)})),o.syncComponents()})(e,t)}),e.element)},kh=(e,t,o,n)=>{au(t);const s=al(e.element,o,n,e.getSystem().buildOrPatch);ru(e,s),e.syncComponents()},Ch=(e,t,o)=>{const n=e.getSystem().build(o);cu(e,n,t)},Oh=(e,t,o,n)=>{uu(t),Ch(e,((e,t)=>((e,t,o)=>{ct(e,o).fold((()=>{Vo(e,t)}),(e=>{No(e,t)}))})(e,t,o)),n)},_h=(e,t)=>e.components(),Th=(e,t,o,n,s)=>{const r=_h(e);return A.from(r[n]).map((o=>(s.fold((()=>uu(o)),(s=>{(t.reuseDom?kh:Oh)(e,o,n,s)})),o)))};var Eh=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Ch(e,Vo,n)},prepend:(e,t,o,n)=>{Ch(e,zo,n)},remove:(e,t,o,n)=>{const s=_h(e),r=j(s,(e=>Qe(n.element,e.element)));r.each(uu)},replaceAt:Th,replaceBy:(e,t,o,n,s)=>{const r=_h(e);return $(r,n).bind((o=>Th(e,t,0,o,s)))},set:(e,t,o,n)=>(t.reuseDom?Sh:wh)(e,n),contents:_h});const Ah=pa({fields:[As("reuseDom",!0)],name:"replacing",apis:Eh}),Mh=(e,t)=>{const o=((e,t)=>{const o=Wr(t);return pa({fields:[is("enabled")],name:e,active:{events:x(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:x({}),initialConfig:{},state:da}}},Dh=(e,t)=>{t.ignore||(hc(e.element),t.onFocus(e))};var Bh=Object.freeze({__proto__:null,focus:Dh,blur:(e,t)=>{t.ignore||fc(e.element)},isFocused:e=>bc(e.element)}),Ih=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return aa(o)},events:e=>Wr([Gr(ur(),((t,o)=>{Dh(t,e),o.stop()}))].concat(e.stopMousedown?[Gr(qs(),((e,t)=>{t.event.prevent()}))]:[]))}),Fh=[xi("onFocus"),Cs("stopMousedown",!1),Cs("ignore",!1)];const Rh=pa({fields:Fh,name:"focusing",active:Ih,apis:Bh}),Nh=(e,t,o,n)=>{const s=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each((t=>{o.get()?ka(e.element,t):Oa(e.element,t)}))})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),s!==n&&t.onToggled(e,n)},Lh=(e,t,o)=>{Nh(e,t,o,!o.get())},zh=(e,t,o)=>{Nh(e,t,o,t.selected)};var Vh=Object.freeze({__proto__:null,onLoad:zh,toggle:Lh,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{Nh(e,t,o,!0)},off:(e,t,o)=>{Nh(e,t,o,!1)},set:Nh}),Hh=Object.freeze({__proto__:null,exhibit:()=>aa({}),events:(e,t)=>{const o=(n=e,s=t,r=Lh,na((e=>{r(e,n,s)})));var n,s,r;const a=ia(e,t,zh);return Wr(G([e.toggleOnExecute?[o]:[],[a]]))}});const Ph=(e,t,o)=>{Ct(e.element,"aria-expanded",o)};var Uh=[Cs("selected",!1),fs("toggleClass"),Cs("toggleOnExecute",!0),xi("onToggled"),Os("aria",{mode:"none"},os("mode",{pressed:[Cs("syncWithExpanded",!1),Ci("update",((e,t,o)=>{Ct(e.element,"aria-pressed",o),t.syncWithExpanded&&Ph(e,0,o)}))],checked:[Ci("update",((e,t,o)=>{Ct(e.element,"aria-checked",o)}))],expanded:[Ci("update",Ph)],selected:[Ci("update",((e,t,o)=>{Ct(e.element,"aria-selected",o)}))],none:[Ci("update",b)]}))];const Wh=pa({fields:Uh,name:"toggling",active:Hh,apis:Vh,state:(!1,{init:()=>{const e=on(false);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(false),readState:()=>e.get()}}})});const jh=()=>{const e=(e,t)=>{t.stop(),Vr(e)};return[Gr(sr(),e),Gr(br(),e),Jr(Ws()),Jr(qs())]},$h=e=>Wr(G([e.map((e=>na(((t,o)=>{e(t),o.stop()})))).toArray(),jh()])),Gh="alloy.item-hover",qh="alloy.item-focus",Yh="alloy.item-toggled",Xh=e=>{(yc(e.element).isNone()||Rh.isFocused(e))&&(Rh.isFocused(e)||Rh.focus(e),zr(e,Gh,{item:e}))},Kh=e=>{zr(e,qh,{item:e})},Jh=x(Gh),Zh=x(qh),Qh=x(Yh),ef=e=>e.toggling.map((e=>e.exclusive?"menuitemradio":"menuitemcheckbox")).getOr("menuitem"),tf=[is("data"),is("components"),is("dom"),Cs("hasSubmenu",!1),fs("toggling"),Ju("itemBehaviours",[Wh,Rh,xh,qu]),Cs("ignoreFocus",!1),Cs("domModification",{}),Ci("builder",(e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:ef(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:Zu(e.itemBehaviours,[e.toggling.fold(Wh.revoke,(e=>Wh.config((e=>({aria:{mode:"checked"},...me(e,((e,t)=>"exclusive"!==t)),onToggled:(t,o)=>{p(e.onToggled)&&e.onToggled(t,o),((e,t)=>{zr(e,Yh,{item:e,state:t})})(t,o)}}))(e)))),Rh.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{Kh(e)}}),xh.config({mode:"execution"}),qu.config({store:{mode:"memory",initialValue:e.data}}),Mh("item-type-events",[...jh(),Gr(Js(),Xh),Gr(fr(),Rh.focus)])]),components:e.components,eventOrder:e.eventOrder}))),Cs("eventOrder",{})],of=[is("dom"),is("components"),Ci("builder",(e=>({dom:e.dom,components:e.components,events:Wr([Zr(fr())])})))],nf=x("item-widget"),sf=x([wm({name:"widget",overrides:e=>({behaviours:ma([qu.config({store:{mode:"manual",getValue:t=>e.data,setValue:b}})])})})]),rf=[is("uid"),is("data"),is("components"),is("dom"),Cs("autofocus",!1),Cs("ignoreFocus",!1),Ju("widgetBehaviours",[qu,Rh,xh]),Cs("domModification",{}),Um(sf()),Ci("builder",(e=>{const t=Im(nf(),e,sf()),o=Fm(nf(),e,t.internals()),n=t=>Rm(t,e,"widget").map((e=>(xh.focusIn(e),e))),s=(t,o)=>Jm(o.event.target)?A.none():e.autofocus?(o.setSource(t.element),A.none()):A.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Wr([na(((e,t)=>{n(e).each((e=>{t.stop()}))})),Gr(Js(),Xh),Gr(fr(),((t,o)=>{e.autofocus?n(t):Rh.focus(t)}))]),behaviours:Zu(e.widgetBehaviours,[qu.config({store:{mode:"memory",initialValue:e.data}}),Rh.config({ignore:e.ignoreFocus,onFocus:e=>{Kh(e)}}),xh.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:ba(),onLeft:s,onRight:s,onEscape:(t,o)=>Rh.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),A.none()):A.none():(Rh.focus(t),A.some(!0))})])}}))],af=os("type",{widget:rf,item:tf,separator:of}),lf=x([Cm({factory:{sketch:e=>{const t=es("menu.spec item",af,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>be(t,"uid")?t:{...t,uid:Vi("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),cf=x([is("value"),is("items"),is("dom"),is("components"),Cs("eventOrder",{}),Yu("menuBehaviours",[Cg,qu,eg,xh]),Os("movement",{mode:"menu",moveOnTab:!0},os("mode",{grid:[_i(),Ci("config",((e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager})))],matrix:[Ci("config",((e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager}))),is("rowSelector"),Cs("previousSelector",A.none)],menu:[Cs("moveOnTab",!0),Ci("config",((e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager})))]})),ls("markers",hi()),Cs("fakeFocus",!1),Cs("focusManager",$g()),xi("onHighlight"),xi("onDehighlight"),Cs("menuRole",!0)]),df=x("alloy.menu-focus"),uf=Km({name:"Menu",configFields:cf(),partFields:lf(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Ku(e.menuBehaviours,[Cg.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),qu.config({store:{mode:"memory",initialValue:e.value}}),eg.config({find:A.some}),xh.config(e.movement.config(e,e.movement))]),events:Wr([Gr(Zh(),((e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each((o=>{Cg.highlight(e,o),t.stop(),zr(e,df(),{menu:e,item:o})}))})),Gr(Jh(),((e,t)=>{const o=t.event.item;Cg.highlight(e,o)})),Gr(Qh(),((e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===_t(o.element,"role")&&((e,t)=>{const o=Td(e.element,'[role="menuitemradio"][aria-checked="true"]');V(o,(o=>{Qe(o,t.element)||e.getSystem().getByDom(o).each((e=>{Wh.off(e)}))}))})(e,o)}))]),components:t,eventOrder:e.eventOrder,...e.menuRole?{domModification:{attributes:{role:"menu"}}}:{}})}),mf=(e,t,o,n)=>fe(o,n).bind((n=>fe(e,n).bind((n=>{const s=mf(e,t,o,n);return A.some([n].concat(s))})))).getOr([]),gf=e=>"prepared"===e.type?A.some(e.menu):A.none(),pf=()=>{const e=on({}),t=on({}),o=on({}),n=rn(),s=on({}),r=e=>a(e).bind(gf),a=e=>fe(t.get(),e),i=t=>fe(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(r,a,i,l)=>{n.set(r),e.set(i),t.set(a),s.set(l);const c=((e,t)=>{const o={};ie(e,((e,t)=>{V(e,(e=>{o[e]=t}))}));const n=t,s=ce(t,((e,t)=>({k:e,v:t}))),r=le(s,((e,t)=>[t].concat(mf(o,n,s,t))));return le(o,(e=>fe(r,e).getOr([e])))})(l,i);o.set(c)},expand:t=>fe(e.get(),t).map((e=>{const n=fe(o.get(),t).getOr([]);return[e].concat(n)})),refresh:e=>fe(o.get(),e),collapse:e=>fe(o.get(),e).bind((e=>e.length>1?A.some(e.slice(1)):A.none())),lookupMenu:a,lookupItem:i,otherMenus:e=>{const t=s.get();return K(re(t),e)},getPrimary:()=>n.get().bind(r),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(t,s)=>{const a=P(i(t).toArray(),(e=>r(e).isSome()));return fe(o.get(),t).bind((t=>{const o=X(a.concat(t));return(e=>{const t=[];for(let o=0;o((t,o,n)=>r(t).bind((s=>(t=>pe(e.get(),((e,o)=>e===t)))(t).bind((e=>o(e).map((e=>({triggeredMenu:s,triggeringItem:e,triggeringPath:n}))))))))(t,s,o.slice(0,a+1)).fold((()=>ye(n.get(),t)?[]:[A.none()]),(e=>[A.some(e)])))))}))}}},hf=gf,ff=Bi("tiered-menu-item-highlight"),bf=Bi("tiered-menu-item-dehighlight");var vf;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(vf||(vf={}));const yf=x("collapse-item"),xf=Xm({name:"TieredMenu",configFields:[ki("onExecute"),ki("onEscape"),Si("onOpenMenu"),Si("onOpenSubmenu"),xi("onRepositionMenu"),xi("onCollapseMenu"),Cs("highlightOnOpen",vf.HighlightMenuAndItem),gs("data",[is("primary"),is("menus"),is("expansions")]),Cs("fakeFocus",!1),xi("onHighlightItem"),xi("onDehighlightItem"),xi("onHover"),bi(),is("dom"),Cs("navigateOnHover",!0),Cs("stayInDom",!1),Yu("tmenuBehaviours",[xh,Cg,eg,Ah]),Cs("eventOrder",{})],apis:{collapseMenu:(e,t)=>{e.collapseMenu(t)},highlightPrimary:(e,t)=>{e.highlightPrimary(t)},repositionMenus:(e,t)=>{e.repositionMenus(t)}},factory:(e,t)=>{const o=rn(),n=pf(),s=e=>qu.getValue(e).value,r=t=>le(e.data.menus,((e,t)=>q(e.items,(e=>"separator"===e.type?[]:[e.data.value])))),a=Cg.highlight,i=(t,o)=>{a(t,o),Cg.getHighlighted(o).orThunk((()=>Cg.getFirst(o))).each((n=>{e.fakeFocus?Cg.highlight(o,n):Hr(t,n.element,fr())}))},l=(e,t)=>xe(z(t,(t=>e.lookupMenu(t).bind((e=>"prepared"===e.type?A.some(e.menu):A.none()))))),c=(t,o,n)=>{const s=l(o,o.otherMenus(n));V(s,(o=>{Ea(o.element,[e.markers.backgroundMenu]),e.stayInDom||Ah.remove(t,o)}))},d=(t,n)=>{const r=(t=>o.get().getOrThunk((()=>{const n={},r=Td(t.element,`.${e.markers.item}`),a=P(r,(e=>"true"===_t(e,"aria-haspopup")));return V(a,(e=>{t.getSystem().getByDom(e).each((e=>{const t=s(e);n[t]=e}))})),o.set(n),n})))(t);ie(r,((e,t)=>{const o=F(n,t);Ct(e.element,"aria-expanded",o)}))},u=(t,o,n)=>A.from(n[0]).bind((s=>o.lookupMenu(s).bind((s=>{if("notbuilt"===s.type)return A.none();{const r=s.menu,a=l(o,n.slice(1));return V(a,(t=>{ka(t.element,e.markers.backgroundMenu)})),xt(r.element)||Ah.append(t,fl(r)),Ea(r.element,[e.markers.backgroundMenu]),i(t,r),c(t,o,n),A.some(r)}}))));let m;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(m||(m={}));const g=(t,o,r=m.HighlightSubmenu)=>{if(o.hasConfigured(pg)&&pg.isDisabled(o))return A.some(o);{const a=s(o);return n.expand(a).bind((s=>(d(t,s),A.from(s[0]).bind((a=>n.lookupMenu(a).bind((i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const s=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,s),s}return o.menu})(t,a,i);return xt(l.element)||Ah.append(t,fl(l)),e.onOpenSubmenu(t,o,l,X(s)),r===m.HighlightSubmenu?(Cg.highlightFirst(l),u(t,n,s)):(Cg.dehighlightAll(l),A.some(o))})))))))}},p=(t,o)=>{const r=s(o);return n.collapse(r).bind((s=>(d(t,s),u(t,n,s).map((n=>(e.onCollapseMenu(t,o,n),n))))))},h=t=>(o,n)=>Tl(n.getSource(),`.${e.markers.item}`).bind((e=>o.getSystem().getByDom(e).toOptional().bind((e=>t(o,e).map(E))))),f=Wr([Gr(df(),((e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each((()=>{const o=t.event.menu;Cg.highlight(e,o);const r=s(t.event.item);n.refresh(r).each((t=>c(e,n,t)))}))})),na(((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each((o=>{0===s(o).indexOf("collapse-item")&&p(t,o),g(t,o,m.HighlightSubmenu).fold((()=>{e.onExecute(t,o)}),b)}))})),ea(((t,o)=>{(t=>{const o=((t,o,n)=>le(n,((n,s)=>{const r=()=>uf.sketch({...n,value:s,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{zr(e,ff,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{zr(e,bf,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?Gg():$g()});return s===o?{type:"prepared",menu:t.getSystem().build(r())}:{type:"notbuilt",nbMenu:r}})))(t,e.data.primary,e.data.menus),s=r();return n.setContents(e.data.primary,o,e.data.expansions,s),n.getPrimary()})(t).each((o=>{Ah.append(t,fl(o)),e.onOpenMenu(t,o),e.highlightOnOpen===vf.HighlightMenuAndItem?i(t,o):e.highlightOnOpen===vf.HighlightJustMenu&&a(t,o)}))})),Gr(ff,((t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)})),Gr(bf,((t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)})),...e.navigateOnHover?[Gr(Jh(),((t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind((t=>(d(e,t),u(e,n,t))))})(t,r),g(t,r,m.HighlightParent),e.onHover(t,r)}))]:[]]),v=e=>Cg.getHighlighted(e).bind(Cg.getHighlighted),y={collapseMenu:e=>{v(e).each((t=>{p(e,t)}))},highlightPrimary:e=>{n.getPrimary().each((t=>{i(e,t)}))},repositionMenus:t=>{const o=n.getPrimary().bind((e=>v(t).bind((e=>{const t=s(e),o=he(n.getMenus()),r=xe(z(o,hf));return n.getTriggeringPath(t,(e=>((e,t,o)=>se(t,(e=>{if(!e.getSystem().isConnected())return A.none();const t=Cg.getCandidates(e);return j(t,(e=>s(e)===o))})))(0,r,e)))})).map((t=>({primary:e,triggeringPath:t})))));o.fold((()=>{(e=>A.from(e.components()[0]).filter((e=>"menu"===_t(e.element,"role"))))(t).each((o=>{e.onRepositionMenu(t,o,[])}))}),(({primary:o,triggeringPath:n})=>{e.onRepositionMenu(t,o,n)}))}};return{uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Ku(e.tmenuBehaviours,[xh.config({mode:"special",onRight:h(((e,t)=>Jm(t.element)?A.none():g(e,t,m.HighlightSubmenu))),onLeft:h(((e,t)=>Jm(t.element)?A.none():p(e,t))),onEscape:h(((t,o)=>p(t,o).orThunk((()=>e.onEscape(t,o).map((()=>t)))))),focusIn:(e,t)=>{n.getPrimary().each((t=>{Hr(e,t.element,fr())}))}}),Cg.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),eg.config({find:e=>Cg.getHighlighted(e)}),Ah.config({})]),eventOrder:e.eventOrder,apis:y,events:f}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:Fs(e,t),expansions:{}}),collapseItem:e=>({value:Bi(yf()),meta:{text:e}})}}),wf=Xm({name:"InlineView",configFields:[is("lazySink"),xi("onShow"),xi("onHide"),ws("onEscape"),Yu("inlineBehaviours",[Tu,qu,gc]),ks("fireDismissalEventInstead",[Cs("event",Er())]),ks("fireRepositionEventInstead",[Cs("event",Ar())]),Cs("getRelated",A.none),Cs("isExtraPart",T),Cs("eventOrder",A.none)],factory:(e,t)=>{const o=(t,o,n,s)=>{const r=e.lazySink(t).getOrDie();Tu.openWhileCloaked(t,o,(()=>tu.positionWithinBounds(r,t,n,s()))),qu.setValue(t,A.some({mode:"position",config:n,getBounds:s}))},n=(t,o,n,s)=>{const r=((e,t,o,n,s)=>{const r=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>cc(),onRtl:()=>dc()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return xf.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(Tu.close(t),e.onEscape.map((e=>e(t))),A.some(!0)),onExecute:()=>A.some(!0),onOpenMenu:(e,t)=>{tu.positionWithinBounds(r().getOrDie(),t,o,s())},onOpenSubmenu:(e,t,o,n)=>{const s=r().getOrDie();tu.position(s,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=r().getOrDie();tu.positionWithinBounds(a,t,o,s()),V(n,(e=>{const t=i(e.triggeringPath);tu.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})}))}})})(e,t,o,n,s);Tu.open(t,r),qu.setValue(t,A.some({mode:"menu",menu:r}))},s=t=>{Tu.isOpen(t)&&qu.getValue(t).each((o=>{switch(o.mode){case"menu":Tu.getState(t).each(xf.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();tu.positionWithinBounds(n,t,o.config,o.getBounds())}}))},r={setContent:(e,t)=>{Tu.setContent(e,t)},showAt:(e,t,n)=>{const s=A.none;o(e,t,n,s)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,A.none)},showMenuWithinBounds:n,hide:e=>{Tu.isOpen(e)&&(qu.setValue(e,A.none()),Tu.close(e))},getContent:e=>Tu.getState(e),reposition:s,isOpen:Tu.isOpen};return{uid:e.uid,dom:e.dom,behaviours:Ku(e.inlineBehaviours,[Tu.config({isPartOf:(t,o,n)=>Ml(o,n)||((t,o)=>e.getRelated(t).exists((e=>Ml(e,o))))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),qu.config({store:{mode:"memory",initialValue:A.none()}}),gc.config({channels:{...Bu({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...Fu({...e.fireRepositionEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({}),doReposition:s})}})]),eventOrder:e.eventOrder,apis:r}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,s)=>{e.showWithinBounds(t,o,n,s)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,s)=>{e.showMenuWithinBounds(t,o,n,s)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}});var Sf,kf,Cf=tinymce.util.Tools.resolve("tinymce.util.Delay"),Of=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),_f=tinymce.util.Tools.resolve("tinymce.EditorManager"),Tf=tinymce.util.Tools.resolve("tinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(Sf||(Sf={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(kf||(kf={}));const Ef=e=>t=>t.options.get(e),Af=e=>t=>A.from(e(t)),Mf=e=>{const t=Tf.deviceType.isPhone(),o=Tf.deviceType.isTablet()||t,n=e.options.register,s=e=>r(e)||!1===e,a=e=>r(e)||h(e);n("skin",{processor:e=>r(e)||!1===e,default:"oxide"}),n("skin_url",{processor:"string"}),n("height",{processor:a,default:Math.max(e.getElement().offsetHeight,400)}),n("width",{processor:a,default:Of.DOM.getStyle(e.getElement(),"width")}),n("min_height",{processor:"number",default:100}),n("min_width",{processor:"number"}),n("max_height",{processor:"number"}),n("max_width",{processor:"number"}),n("style_formats",{processor:"object[]"}),n("style_formats_merge",{processor:"boolean",default:!1}),n("style_formats_autohide",{processor:"boolean",default:!1}),n("line_height_formats",{processor:"string",default:"1 1.1 1.2 1.3 1.4 1.5 2"}),n("font_family_formats",{processor:"string",default:"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"}),n("font_size_formats",{processor:"string",default:"8pt 10pt 12pt 14pt 18pt 24pt 36pt"}),n("font_size_input_default_unit",{processor:"string",default:"pt"}),n("block_formats",{processor:"string",default:"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"}),n("content_langs",{processor:"object[]"}),n("removed_menuitems",{processor:"string",default:""}),n("menubar",{processor:e=>r(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||r(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),N(9,(e=>{n("toolbar"+(e+1),{processor:"string"})})),n("toolbar_mode",{processor:"string",default:o?"scrolling":"floating"}),n("toolbar_groups",{processor:"object",default:{}}),n("toolbar_location",{processor:"string",default:kf.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:s,default:"#top"}),n("anchor_bottom",{processor:s,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("promotion",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||d(e),default:!Tf.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},Df=Ef("readonly"),Bf=Ef("height"),If=Ef("width"),Ff=Af(Ef("min_width")),Rf=Af(Ef("min_height")),Nf=Af(Ef("max_width")),Lf=Af(Ef("max_height")),zf=Af(Ef("style_formats")),Vf=Ef("style_formats_merge"),Hf=Ef("style_formats_autohide"),Pf=Ef("content_langs"),Uf=Ef("removed_menuitems"),Wf=Ef("toolbar_mode"),jf=Ef("toolbar_groups"),$f=Ef("toolbar_location"),Gf=Ef("fixed_toolbar_container"),qf=Ef("fixed_toolbar_container_target"),Yf=Ef("toolbar_persist"),Xf=Ef("toolbar_sticky_offset"),Kf=Ef("menubar"),Jf=Ef("toolbar"),Zf=Ef("file_picker_callback"),Qf=Ef("file_picker_validator_handler"),eb=Ef("font_size_input_default_unit"),tb=Ef("file_picker_types"),ob=Ef("typeahead_urls"),nb=Ef("anchor_top"),sb=Ef("anchor_bottom"),rb=Ef("draggable_modal"),ab=Ef("statusbar"),ib=Ef("elementpath"),lb=Ef("branding"),cb=Ef("resize"),db=Ef("paste_as_text"),ub=Ef("sidebar_show"),mb=Ef("promotion"),gb=Ef("help_accessibility"),pb=Ef("default_font_stack"),hb=e=>!1===e.options.get("skin"),fb=e=>!1!==e.options.get("menubar"),bb=e=>{const t=e.options.get("skin_url");if(hb(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return _f.baseURL+"/skins/ui/"+t}},vb=e=>A.from(e.options.get("skin_url")),yb=e=>e.options.get("line_height_formats").split(" "),xb=e=>{const t=Jf(e),o=r(t),n=l(t)&&t.length>0;return!Sb(e)&&(n||o||!0===t)},wb=e=>{const t=N(9,(t=>e.options.get("toolbar"+(t+1)))),o=P(t,r);return ke(o.length>0,o)},Sb=e=>wb(e).fold((()=>{const t=Jf(e);return f(t,r)&&t.length>0}),E),kb=e=>$f(e)===kf.bottom,Cb=e=>{var t;if(!e.inline)return A.none();const o=null!==(t=Gf(e))&&void 0!==t?t:"";if(o.length>0)return _l(wt(),o);const n=qf(e);return g(n)?A.some(Le(n)):A.none()},Ob=e=>e.inline&&Cb(e).isSome(),_b=e=>Cb(e).getOrThunk((()=>bt(ft(Le(e.getElement()))))),Tb=e=>e.inline&&!fb(e)&&!xb(e)&&!Sb(e),Eb=e=>(e.options.get("toolbar_sticky")||e.inline)&&!Ob(e)&&!Tb(e),Ab=e=>!Ob(e)&&"split"===e.options.get("ui_mode"),Mb=e=>{const t=e.options.get("menu");return le(t,(e=>({...e,items:e.items})))};var Db=Object.freeze({__proto__:null,get ToolbarMode(){return Sf},get ToolbarLocation(){return kf},register:Mf,getSkinUrl:bb,getSkinUrlOption:vb,isReadOnly:Df,isSkinDisabled:hb,getHeightOption:Bf,getWidthOption:If,getMinWidthOption:Ff,getMinHeightOption:Rf,getMaxWidthOption:Nf,getMaxHeightOption:Lf,getUserStyleFormats:zf,shouldMergeStyleFormats:Vf,shouldAutoHideStyleFormats:Hf,getLineHeightFormats:yb,getContentLanguages:Pf,getRemovedMenuItems:Uf,isMenubarEnabled:fb,isMultipleToolbars:Sb,isToolbarEnabled:xb,isToolbarPersist:Yf,getMultipleToolbarsOption:wb,getUiContainer:_b,useFixedContainer:Ob,isSplitUiMode:Ab,getToolbarMode:Wf,isDraggableModal:rb,isDistractionFree:Tb,isStickyToolbar:Eb,getStickyToolbarOffset:Xf,getToolbarLocation:$f,isToolbarLocationBottom:kb,getToolbarGroups:jf,getMenus:Mb,getMenubar:Kf,getToolbar:Jf,getFilePickerCallback:Zf,getFilePickerTypes:tb,useTypeaheadUrls:ob,getAnchorTop:nb,getAnchorBottom:sb,getFilePickerValidatorHandler:Qf,getFontSizeInputDefaultUnit:eb,useStatusBar:ab,useElementPath:ib,promotionEnabled:mb,useBranding:lb,getResize:cb,getPasteAsText:db,getSidebarShow:ub,useHelpAccessibility:gb,getDefaultFontStack:pb});const Bb=["visible","hidden","clip"],Ib=e=>Ae(e).length>0&&!F(Bb,e),Fb=e=>{if(je(e)){const t=Rt(e,"overflow-x"),o=Rt(e,"overflow-y");return Ib(t)||Ib(o)}return!1},Rb=(e,t)=>Ab(e)?(e=>{const t=_d(e,Fb),o=0===t.length?vt(e).map(yt).map((e=>_d(e,Fb))).getOr([]):t;return te(o).map((e=>({element:e,others:o.slice(1)})))})(t):A.none(),Nb=e=>{const t=[...z(e.others,Zo),tn()];return((e,t)=>W(t,((e,t)=>en(e,t)),e))(Zo(e.element),t)},Lb=Xm({name:"Button",factory:e=>{const t=$h(e.action),o=e.dom.tag,n=t=>fe(e.dom,"attributes").bind((e=>fe(e,t)));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:Zu(e.buttonBehaviours,[Rh.config({}),xh.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:"button"===o?{type:n("type").getOr("button"),...n("role").map((e=>({role:e}))).getOr({})}:{role:e.role.getOr(n("role").getOr("button"))}},eventOrder:e.eventOrder}},configFields:[Cs("uid",void 0),is("dom"),Cs("components",[]),Ju("buttonBehaviours",[Rh,xh]),fs("action"),fs("role"),Cs("eventOrder",{})]}),zb=e=>{const t=Fe(e),o=lt(t),n=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return W(t,((e,t)=>"class"===t.name?e:{...e,[t.name]:t.value}),{})})(t),s=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),r=0===o.length?{}:{innerHtml:si(t)};return{tag:Ue(t),classes:s,attributes:n,...r}},Vb=e=>{const t=(e=>void 0!==e.uid)(e)&&ve(e,"uid")?e.uid:Vi("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}};var Hb=Object.freeze({__proto__:null,exhibit:(e,t)=>aa({attributes:Rs([{key:t.tabAttr,value:"true"}])})}),Pb=[Cs("tabAttr","data-alloy-tabstop")];const Ub=pa({fields:Pb,name:"tabstopping",active:Hb}),Wb=Bi("tooltip.exclusive"),jb=Bi("tooltip.show"),$b=Bi("tooltip.hide"),Gb=Bi("tooltip.immediateHide"),qb=Bi("tooltip.immediateShow"),Yb=(e,t,o)=>{e.getSystem().broadcastOn([Wb],{})};var Xb=Object.freeze({__proto__:null,hideAllExclusive:Yb,setComponents:(e,t,o,n)=>{o.getTooltip().each((e=>{e.getSystem().isConnected()&&Ah.set(e,n)}))}}),Kb=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each((n=>{n.getSystem().isConnected()&&(uu(n),e.onHide(o,n),t.clearTooltip())})),t.clearTimer()},n=o=>{if(!t.isShowing()){Yb(o);const n=e.lazySink(o).getOrDie(),s=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Wr("normal"===e.mode?[Gr(Js(),(e=>{Lr(o,jb)})),Gr(Xs(),(e=>{Lr(o,$b)}))]:[]),behaviours:ma([Ah.config({})])});t.setTooltip(s),lu(n,s),e.onShow(o,s),tu.position(n,s,{anchor:e.anchor(o)})}},s=o=>{t.getTooltip().each((t=>{const n=e.lazySink(o).getOrDie();tu.position(n,t,{anchor:e.anchor(o)})}))};return Wr(G([[Gr(jb,(o=>{t.resetTimer((()=>{n(o)}),e.delayForShow())})),Gr($b,(n=>{t.resetTimer((()=>{o(n)}),e.delayForHide())})),Gr(qb,(e=>{t.resetTimer((()=>{n(e)}),0)})),Gr(Gb,(e=>{t.resetTimer((()=>{o(e)}),0)})),Gr(pr(),((e,t)=>{const n=t;n.universal||F(n.channels,Wb)&&o(e)})),ta((e=>{o(e)}))],(()=>{switch(e.mode){case"normal":return[Gr(Zs(),(e=>{Lr(e,qb)})),Gr(mr(),(e=>{Lr(e,Gb)})),Gr(Js(),(e=>{Lr(e,jb)})),Gr(Xs(),(e=>{Lr(e,$b)}))];case"follow-highlight":return[Gr(Rr(),((e,t)=>{Lr(e,jb)})),Gr(Nr(),(e=>{Lr(e,$b)}))];case"children-normal":return[Gr(Zs(),((o,n)=>{yc(o.element).each((r=>{Ke(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold((()=>{Lr(o,qb)}),(n=>{t.isShowing()&&(e.onShow(o,n),s(o))}))}))})),Gr(mr(),(e=>{yc(e.element).fold((()=>{Lr(e,Gb)}),b)})),Gr(Js(),(o=>{_l(o.element,"[data-mce-tooltip]:hover").each((n=>{t.getTooltip().fold((()=>{Lr(o,jb)}),(n=>{t.isShowing()&&(e.onShow(o,n),s(o))}))}))})),Gr(Xs(),(e=>{_l(e.element,"[data-mce-tooltip]:hover").fold((()=>{Lr(e,$b)}),b)}))];default:return[Gr(Zs(),((o,n)=>{yc(o.element).each((r=>{Ke(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold((()=>{Lr(o,qb)}),(n=>{t.isShowing()&&(e.onShow(o,n),s(o))}))}))})),Gr(mr(),(e=>{yc(e.element).fold((()=>{Lr(e,Gb)}),b)}))]}})()]))}}),Jb=[is("lazySink"),is("tooltipDom"),Cs("exclusive",!0),Cs("tooltipComponents",[]),Ms("delayForShow",x(300)),Ms("delayForHide",x(300)),Es("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),Cs("anchor",(e=>({type:"hotspot",hotspot:e,layouts:{onLtr:x([oc,tc,Jl,Ql,Zl,ec]),onRtl:x([oc,tc,Jl,Ql,Zl,ec])},bubble:Gc(0,-2,{})}))),xi("onHide"),xi("onShow")],Zb=Object.freeze({__proto__:null,init:()=>{const e=rn(),t=rn(),o=()=>{e.on(clearTimeout)},n=x("not-implemented");return ua({getTooltip:t.get,isShowing:t.isSet,setTooltip:t.set,clearTooltip:t.clear,clearTimer:o,resetTimer:(t,n)=>{o(),e.set(setTimeout(t,n))},readState:n})}});const Qb=pa({fields:Jb,name:"tooltipping",active:Kb,state:Zb,apis:Xb}),{entries:ev,setPrototypeOf:tv,isFrozen:ov,getPrototypeOf:nv,getOwnPropertyDescriptor:sv}=Object;let{freeze:rv,seal:av,create:iv}=Object,{apply:lv,construct:cv}="undefined"!=typeof Reflect&&Reflect;lv||(lv=function(e,t,o){return e.apply(t,o)}),rv||(rv=function(e){return e}),av||(av=function(e){return e}),cv||(cv=function(e,t){return new e(...t)});const dv=Sv(Array.prototype.forEach),uv=Sv(Array.prototype.pop),mv=Sv(Array.prototype.push),gv=Sv(String.prototype.toLowerCase),pv=Sv(String.prototype.toString),hv=Sv(String.prototype.match),fv=Sv(String.prototype.replace),bv=Sv(String.prototype.indexOf),vv=Sv(String.prototype.trim),yv=Sv(RegExp.prototype.test),xv=(wv=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o1?o-1:0),s=1;s/gm),Vv=av(/\${[\w\W]*}/gm),Hv=av(/^data-[\-\w.\u00B7-\uFFFF]/),Pv=av(/^aria-[\-\w]+$/),Uv=av(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wv=av(/^(?:\w+script|data):/i),jv=av(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$v=av(/^html$/i);var Gv=Object.freeze({__proto__:null,MUSTACHE_EXPR:Lv,ERB_EXPR:zv,TMPLIT_EXPR:Vv,DATA_ATTR:Hv,ARIA_ATTR:Pv,IS_ALLOWED_URI:Uv,IS_SCRIPT_OR_DATA:Wv,ATTR_WHITESPACE:jv,DOCTYPE_NAME:$v});const qv=()=>"undefined"==typeof window?null:window;var Yv=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qv();const o=t=>e(t);if(o.version="3.0.5",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;const n=t.document,s=n.currentScript;let{document:r}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:p}=t,h=c.prototype,f=Ov(h,"cloneNode"),b=Ov(h,"nextSibling"),v=Ov(h,"childNodes"),y=Ov(h,"parentNode");if("function"==typeof i){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let x,w="";const{implementation:S,createNodeIterator:k,createDocumentFragment:C,getElementsByTagName:O}=r,{importNode:_}=n;let T={};o.isSupported="function"==typeof ev&&"function"==typeof y&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:E,ERB_EXPR:A,TMPLIT_EXPR:M,DATA_ATTR:D,ARIA_ATTR:B,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:F}=Gv;let{IS_ALLOWED_URI:R}=Gv,N=null;const L=kv({},[..._v,...Tv,...Ev,...Mv,...Bv]);let z=null;const V=kv({},[...Iv,...Fv,...Rv,...Nv]);let H=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),P=null,U=null,W=!0,j=!0,$=!1,G=!0,q=!1,Y=!1,X=!1,K=!1,J=!1,Z=!1,Q=!1,ee=!0,te=!1,oe=!0,ne=!1,se={},re=null;const ae=kv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=kv({},["audio","video","img","source","image","track"]);let ce=null;const de=kv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let pe=ge,he=!1,fe=null;const be=kv({},[ue,me,ge],pv);let ve;const ye=["application/xhtml+xml","text/html"];let xe,we=null;const Se=r.createElement("form"),ke=function(e){return e instanceof RegExp||e instanceof Function},Ce=function(e){if(!we||we!==e){if(e&&"object"==typeof e||(e={}),e=Cv(e),ve=ve=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,xe="application/xhtml+xml"===ve?pv:gv,N="ALLOWED_TAGS"in e?kv({},e.ALLOWED_TAGS,xe):L,z="ALLOWED_ATTR"in e?kv({},e.ALLOWED_ATTR,xe):V,fe="ALLOWED_NAMESPACES"in e?kv({},e.ALLOWED_NAMESPACES,pv):be,ce="ADD_URI_SAFE_ATTR"in e?kv(Cv(de),e.ADD_URI_SAFE_ATTR,xe):de,ie="ADD_DATA_URI_TAGS"in e?kv(Cv(le),e.ADD_DATA_URI_TAGS,xe):le,re="FORBID_CONTENTS"in e?kv({},e.FORBID_CONTENTS,xe):ae,P="FORBID_TAGS"in e?kv({},e.FORBID_TAGS,xe):{},U="FORBID_ATTR"in e?kv({},e.FORBID_ATTR,xe):{},se="USE_PROFILES"in e&&e.USE_PROFILES,W=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,$=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,Y=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Z=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,R=e.ALLOWED_URI_REGEXP||Uv,pe=e.NAMESPACE||ge,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ke(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(j=!1),Z&&(J=!0),se&&(N=kv({},[...Bv]),z=[],!0===se.html&&(kv(N,_v),kv(z,Iv)),!0===se.svg&&(kv(N,Tv),kv(z,Fv),kv(z,Nv)),!0===se.svgFilters&&(kv(N,Ev),kv(z,Fv),kv(z,Nv)),!0===se.mathMl&&(kv(N,Mv),kv(z,Rv),kv(z,Nv))),e.ADD_TAGS&&(N===L&&(N=Cv(N)),kv(N,e.ADD_TAGS,xe)),e.ADD_ATTR&&(z===V&&(z=Cv(z)),kv(z,e.ADD_ATTR,xe)),e.ADD_URI_SAFE_ATTR&&kv(ce,e.ADD_URI_SAFE_ATTR,xe),e.FORBID_CONTENTS&&(re===ae&&(re=Cv(re)),kv(re,e.FORBID_CONTENTS,xe)),oe&&(N["#text"]=!0),Y&&kv(N,["html","head","body"]),N.table&&(kv(N,["tbody"]),delete P.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw xv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw xv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=e.TRUSTED_TYPES_POLICY,w=x.createHTML("")}else void 0===x&&(x=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const s="dompurify"+(o?"#"+o:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(p,s)),null!==x&&"string"==typeof w&&(w=x.createHTML(""));rv&&rv(e),we=e}},Oe=kv({},["mi","mo","mn","ms","mtext"]),_e=kv({},["foreignobject","desc","title","annotation-xml"]),Te=kv({},["title","style","font","a","script"]),Ee=kv({},Tv);kv(Ee,Ev),kv(Ee,Av);const Ae=kv({},Mv);kv(Ae,Dv);const Me=function(e){mv(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},De=function(e,t){try{mv(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){mv(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!z[e])if(J||Z)try{Me(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Be=function(e){let t,o;if(K)e=""+e;else{const t=hv(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===ve&&pe===ge&&(e=''+e+"");const n=x?x.createHTML(e):e;if(pe===ge)try{t=(new g).parseFromString(n,ve)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(pe,"template",null);try{t.documentElement.innerHTML=he?w:n}catch(e){}}const s=t.body||t.documentElement;return e&&o&&s.insertBefore(r.createTextNode(o),s.childNodes[0]||null),pe===ge?O.call(t,Y?"html":"body")[0]:Y?t.documentElement:s},Ie=function(e){return k.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Fe=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Re=function(e,t,n){T[e]&&dv(T[e],(e=>{e.call(o,t,n,we)}))},Ne=function(e){let t;if(Re("beforeSanitizeElements",e,null),(n=e)instanceof m&&("string"!=typeof n.nodeName||"string"!=typeof n.textContent||"function"!=typeof n.removeChild||!(n.attributes instanceof u)||"function"!=typeof n.removeAttribute||"function"!=typeof n.setAttribute||"string"!=typeof n.namespaceURI||"function"!=typeof n.insertBefore||"function"!=typeof n.hasChildNodes))return Me(e),!0;var n;const s=xe(e.nodeName);if(Re("uponSanitizeElement",e,{tagName:s,allowedTags:N}),e.hasChildNodes()&&!Fe(e.firstElementChild)&&(!Fe(e.content)||!Fe(e.content.firstElementChild))&&yv(/<[/\w]/g,e.innerHTML)&&yv(/<[/\w]/g,e.textContent))return Me(e),!0;if(!N[s]||P[s]){if(!P[s]&&ze(s)){if(H.tagNameCheck instanceof RegExp&&yv(H.tagNameCheck,s))return!1;if(H.tagNameCheck instanceof Function&&H.tagNameCheck(s))return!1}if(oe&&!re[s]){const t=y(e)||e.parentNode,o=v(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n)t.insertBefore(f(o[n],!0),b(e))}return Me(e),!0}return e instanceof c&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});const o=gv(e.tagName),n=gv(t.tagName);return!!fe[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===ge?"svg"===o:t.namespaceURI===ue?"svg"===o&&("annotation-xml"===n||Oe[n]):Boolean(Ee[o]):e.namespaceURI===ue?t.namespaceURI===ge?"math"===o:t.namespaceURI===me?"math"===o&&_e[n]:Boolean(Ae[o]):e.namespaceURI===ge?!(t.namespaceURI===me&&!_e[n])&&!(t.namespaceURI===ue&&!Oe[n])&&!Ae[o]&&(Te[o]||!Ee[o]):!("application/xhtml+xml"!==ve||!fe[e.namespaceURI]))}(e)?(Me(e),!0):"noscript"!==s&&"noembed"!==s&&"noframes"!==s||!yv(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,t=fv(t,E," "),t=fv(t,A," "),t=fv(t,M," "),e.textContent!==t&&(mv(o.removed,{element:e.cloneNode()}),e.textContent=t)),Re("afterSanitizeElements",e,null),!1):(Me(e),!0)},Le=function(e,t,o){if(ee&&("id"===t||"name"===t)&&(o in r||o in Se))return!1;if(j&&!U[t]&&yv(D,t));else if(W&&yv(B,t));else if(!z[t]||U[t]){if(!(ze(e)&&(H.tagNameCheck instanceof RegExp&&yv(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&yv(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&yv(H.tagNameCheck,o)||H.tagNameCheck instanceof Function&&H.tagNameCheck(o))))return!1}else if(ce[t]);else if(yv(R,fv(o,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==bv(o,"data:")||!ie[e])if($&&!yv(I,fv(o,F,"")));else if(o)return!1;return!0},ze=function(e){return e.indexOf("-")>0},Ve=function(e){let t,o,n,s;Re("beforeSanitizeAttributes",e,null);const{attributes:r}=e;if(!r)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};for(s=r.length;s--;){t=r[s];const{name:i,namespaceURI:l}=t;o="value"===i?t.value:vv(t.value);const c=o;if(n=xe(i),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Re("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){De(i,e);continue}if(!G&&yv(/\/>/i,o)){De(i,e);continue}q&&(o=fv(o,E," "),o=fv(o,A," "),o=fv(o,M," "));const d=xe(e.nodeName);if(Le(d,n,o)){if(!te||"id"!==n&&"name"!==n||(De(i,e),o="user-content-"+o),x&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(l);else switch(p.getAttributeType(d,n)){case"TrustedHTML":o=x.createHTML(o);break;case"TrustedScriptURL":o=x.createScriptURL(o)}if(o!==c)try{l?e.setAttributeNS(l,i,o):e.setAttribute(i,o)}catch(t){De(i,e)}}else De(i,e)}Re("afterSanitizeAttributes",e,null)},He=function e(t){let o;const n=Ie(t);for(Re("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Re("uponSanitizeShadowNode",o,null),Ne(o)||(o.content instanceof a&&e(o.content),Ve(o));Re("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t,s,r,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(he=!e,he&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw xv("toString is not a function");if("string"!=typeof(e=e.toString()))throw xv("dirty is not a string, aborting")}if(!o.isSupported)return e;if(X||Ce(c),o.removed=[],"string"==typeof e&&(ne=!1),ne){if(e.nodeName){const t=xe(e.nodeName);if(!N[t]||P[t])throw xv("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Be("\x3c!----\x3e"),s=t.ownerDocument.importNode(e,!0),1===s.nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?t=s:t.appendChild(s);else{if(!J&&!q&&!Y&&-1===e.indexOf("<"))return x&&Q?x.createHTML(e):e;if(t=Be(e),!t)return J?null:Q?w:""}t&&K&&Me(t.firstChild);const d=Ie(ne?e:t);for(;r=d.nextNode();)Ne(r)||(r.content instanceof a&&He(r.content),Ve(r));if(ne)return e;if(J){if(Z)for(i=C.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(z.shadowroot||z.shadowrootmode)&&(i=_.call(n,i,!0)),i}let u=Y?t.outerHTML:t.innerHTML;return Y&&N["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&yv($v,t.ownerDocument.doctype.name)&&(u="\n"+u),q&&(u=fv(u,E," "),u=fv(u,A," "),u=fv(u,M," ")),x&&Q?x.createHTML(u):u},o.setConfig=function(e){Ce(e),X=!0},o.clearConfig=function(){we=null,X=!1},o.isValidAttribute=function(e,t,o){we||Ce({});const n=xe(e),s=xe(t);return Le(n,s,o)},o.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],mv(T[e],t))},o.removeHook=function(e){if(T[e])return uv(T[e])},o.removeHooks=function(e){T[e]&&(T[e]=[])},o.removeAllHooks=function(){T={}},o}();const Xv=e=>Yv().sanitize(e);var Kv=tinymce.util.Tools.resolve("tinymce.util.I18n");const Jv={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},Zv="temporary-placeholder",Qv=e=>()=>fe(e,Zv).getOr("!not found!"),ey=(e,t)=>{const o=e.toLowerCase();if(Kv.isRtl()){const e=((e,t)=>Ee(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return be(t,e)?e:o}return o},ty=(e,t)=>fe(t,ey(e,t)),oy=(e,t)=>{const o=t();return ty(e,o).getOrThunk(Qv(o))},ny=()=>Mh("add-focusable",[ea((e=>{Ol(e.element,"svg").each((e=>Ct(e,"focusable","false")))}))]),sy=(e,t,o,n)=>{var s,r;const a=(e=>!!Kv.isRtl()&&be(Jv,e))(t)?["tox-icon--flip"]:[],i=fe(o,ey(t,o)).or(n).getOrThunk(Qv(o));return{dom:{tag:e.tag,attributes:null!==(s=e.attributes)&&void 0!==s?s:{},classes:e.classes.concat(a),innerHtml:i},behaviours:ma([...null!==(r=e.behaviours)&&void 0!==r?r:[],ny()])}},ry=(e,t,o,n=A.none())=>sy(t,e,o(),n),ay={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},iy=Xm({name:"Notification",factory:e=>{const t=Bi("notification-text"),o=Vb({dom:zb(`${Xv(e.backstageProvider.translate(e.text))}
`),behaviours:ma([Ah.config({})])}),n=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),s=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=Vb({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(0)]},s(0)],behaviours:ma([Ah.config({})])}),a={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each((e=>{Ah.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(t)]},s(t)])}))},updateText:(e,t)=>{if(e.getSystem().isConnected()){const n=o.get(e);Ah.set(n,[ul(t)])}}},i=G([e.icon.toArray(),e.level.toArray(),e.level.bind((e=>A.from(ay[e]))).toArray()]),l=Vb(Lb.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":e.backstageProvider.translate("Close")}},components:[ry("close",{tag:"span",classes:["tox-icon"]},e.iconProvider)],buttonBehaviours:ma([Ub.config({}),Qb.config({...e.backstageProvider.tooltips.getConfig({tooltipText:e.backstageProvider.translate("Close")})})]),action:t=>{e.onAction(t)}})),c=((e,t,o)=>{const n=o(),s=j(e,(e=>be(n,ey(e,n))));return sy({tag:"div",classes:["tox-notification__icon"]},s.getOr(Zv),n,A.none())})(i,0,e.iconProvider),d=[c,{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:ma([Ah.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert","aria-labelledby":t},classes:e.level.map((e=>["tox-notification","tox-notification--in",`tox-notification--${e}`])).getOr(["tox-notification","tox-notification--in"])},behaviours:ma([Ub.config({}),Rh.config({}),xh.config({mode:"special",onEscape:t=>(e.onAction(t),A.some(!0))})]),components:d.concat(e.progress?[r.asSpec()]:[]).concat([l.asSpec()]),apis:a}},configFields:[fs("level"),is("progress"),fs("icon"),is("onAction"),is("text"),is("iconProvider"),is("backstageProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var ly=(e,t,o,n)=>{const s=t.backstage.shared,r=()=>{const t=Zo(Le(e.getContentAreaContainer()));return A.some(t)},a=e=>{r().each((t=>{V(e,(e=>{Zt(e.element)>t.width&&Bt(e.element,"width",t.width+"px")}))}))};return{open:(t,i,l)=>{const c=()=>{n.on((t=>{i();const o=l();(e=>{Ah.remove(e,d),u()})(t),((t,o)=>{0===lt(t.element).length?((t,o)=>{wf.hide(t),n.clear(),o&&e.focus()})(t,o):((e,t)=>{t&&xh.focusIn(e)})(t,o)})(t,o)}))},d=hl(iy.sketch({text:t.text,level:F(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:c,iconProvider:s.providers.icons,backstageProvider:s.providers}));if(n.isSet()){const e=fl(d);n.on((t=>{Ah.append(t,e),wf.reposition(t),Ei.refresh(t),a(t.components())}))}else{const t=hl(wf.sketch({dom:{tag:"div",classes:["tox-notifications-container"],attributes:{"aria-label":"Notifications",role:"region"}},lazySink:s.getSink,fireDismissalEventInstead:{},...s.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ma([xh.config({mode:"cyclic",selector:".tox-notification, .tox-notification a, .tox-notification button"}),Ah.config({}),...Eb(e)&&!s.header.isPositionedAtTop()?[]:[Ei.config({contextual:{lazyContext:()=>A.some(Zo(Le(e.getContentAreaContainer()))),fadeInClass:"tox-notification-container-dock-fadein",fadeOutClass:"tox-notification-container-dock-fadeout",transitionClass:"tox-notification-container-dock-transition"},modes:["top"],lazyViewport:t=>Rb(e,t.element).map((e=>({bounds:Nb(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Xt(e.element).top})}))).getOrThunk((()=>({bounds:tn(),optScrollEnv:A.none()})))})]])})),a=fl(d),i={maxHeightFunction:Uc()},l={...s.anchors.banner(),overrides:i};n.set(t),o.add(t),wf.showWithinBounds(t,a,{anchor:l},r)}h(t.timeout)&&t.timeout>0&&Cf.setEditorTimeout(e,(()=>{c()}),t.timeout);const u=()=>{n.on((e=>{wf.reposition(e),Ei.refresh(e),a(e.components())}))};return{close:c,reposition:u,text:e=>{iy.updateText(d,e)},settings:t,getEl:()=>d.element.dom,progressBar:{value:e=>{iy.updateProgress(d,e)}}}},close:e=>{e.close()},getArgs:e=>e.settings}};var cy;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(cy||(cy={}));var dy=cy;const uy="tox-menu-nav__js",my="tox-collection__item",gy="tox-swatch",py={normal:uy,color:gy},hy="tox-collection__item--enabled",fy="tox-collection__item-icon",by="tox-collection__item-label",vy="tox-collection__item-caret",yy="tox-collection__item--active",xy="tox-collection__item-container",wy="tox-collection__item-container--row",Sy=e=>fe(py,e).getOr(uy),ky=e=>"color"===e?"tox-swatches":"tox-menu",Cy=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:ky(e),tieredMenu:"tox-tiered-menu"}),Oy=e=>{const t=Cy(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:Sy(e)}},_y=(e,t,o)=>{const n=Cy(o);return{tag:"div",classes:G([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},Ty=[uf.parts.items({})],Ey=(e,t,o)=>{const n=Cy(o);return{dom:{tag:"div",classes:G([[n.tieredMenu]])},markers:Oy(o)}},Ay=x([fs("data"),Cs("inputAttributes",{}),Cs("inputStyles",{}),Cs("tag","input"),Cs("inputClasses",[]),xi("onSetValue"),Cs("styles",{}),Cs("eventOrder",{}),Yu("inputBehaviours",[qu,Rh]),Cs("selectOnFocus",!0)]),My=e=>ma([Rh.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=ol(t);t.dom.setSelectionRange(0,o.length)}:b})]),Dy=e=>({...My(e),...Ku(e.inputBehaviours,[qu.config({store:{mode:"manual",...e.data.map((e=>({initialValue:e}))).getOr({}),getValue:e=>ol(e.element),setValue:(e,t)=>{ol(e.element)!==t&&nl(e.element,t)}},onSetValue:e.onSetValue})])}),By=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),Iy=Xm({name:"Input",configFields:Ay(),factory:(e,t)=>({uid:e.uid,dom:By(e),components:[],behaviours:Dy(e),eventOrder:e.eventOrder})}),Fy=Bi("refetch-trigger-event"),Ry=Bi("redirect-menu-item-interaction"),Ny="tox-menu__searcher",Ly=e=>_l(e.element,`.${Ny}`).bind((t=>e.getSystem().getByDom(t).toOptional())),zy=Ly,Vy=e=>({fetchPattern:qu.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),Hy=e=>{const t=(e,t)=>(t.cut(),A.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return zr(e,Ry,o),A.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[my]},components:[Iy.sketch({inputClasses:[Ny,"tox-textfield"],inputAttributes:{...e.placeholder.map((t=>({placeholder:e.i18n(t)}))).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:ma([Mh(n,[Gr(or(),(e=>{Lr(e,Fy)})),Gr(er(),((e,t)=>{"Escape"===t.event.raw.key&&t.stop()}))]),xh.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,xh.name()]}})]}},Py="tox-collection--results__js",Uy=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:Bi("aria-item-search-result-id"),"aria-selected":"false"}}}:e},Wy=(e,t)=>o=>{const n=L(o,t);return z(n,(t=>({dom:e,components:t})))},jy=(e,t)=>{const o=[];let n=[];return V(e,((e,s)=>{t(e,s)?(n.length>0&&o.push(n),n=[],(be(e.dom,"innerHtml")||e.components&&e.components.length>0)&&n.push(e)):n.push(e)})),n.length>0&&o.push(n),z(o,(e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e})))},$y=(e,t,o)=>uf.parts.items({preprocess:n=>{const s=z(n,o);return"auto"!==e&&e>1?Wy({tag:"div",classes:["tox-collection__group"]},e)(s):jy(s,((e,o)=>"separator"===t[o].type))}}),Gy=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[$y(e,t,w)]}),qy=e=>R(e,(e=>"icon"in e&&void 0!==e.icon)),Yy=e=>(console.error(ts(e)),console.log(e),A.none()),Xy=(e,t,o,n,s)=>{const r=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[uf.parts.items({preprocess:e=>jy(e,((e,t)=>"separator"===a[t].type))})]});var a;return{value:e,dom:r.dom,components:r.components,items:o}},Ky=(e,t,o,n,s)=>{if("color"===s.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[uf.parts.items({preprocess:"auto"!==e?Wy({tag:"div",classes:["tox-swatches__row"]},e):w})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType&&"auto"===n){const t=Gy(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType||"searchable"===s.menuType){const t="searchable"!==s.menuType?Gy(n,o):"search-with-field"===s.searchMode.searchMode?((e,t,o)=>{const n=Bi("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[Hy({i18n:Kv.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],Py],attributes:{id:n}},components:[$y(e,t,Uy)]}]}})(n,o,s.searchMode):((e,t,o=!0)=>{const n=Bi("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",Py].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:n}},components:[$y(e,t,Uy)]}})(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===s.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[uf.parts.items({preprocess:Wy({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:_y(t,n,s.menuType),components:Ty,items:o}},Jy=ds("type"),Zy=ds("name"),Qy=ds("label"),ex=ds("text"),tx=ds("title"),ox=ds("icon"),nx=ds("value"),sx=ms("fetch"),rx=ms("getSubmenuItems"),ax=ms("onAction"),ix=ms("onItemAction"),lx=Ms("onSetup",(()=>b)),cx=ys("name"),dx=ys("text"),ux=ys("icon"),mx=ys("tooltip"),gx=ys("label"),px=ys("shortcut"),hx=ws("select"),fx=As("active",!1),bx=As("borderless",!1),vx=As("enabled",!0),yx=As("primary",!1),xx=e=>Cs("columns",e),wx=Cs("meta",{}),Sx=Ms("onAction",b),kx=e=>Ts("type",e),Cx=e=>ss("name","name",kn((()=>Bi(`${e}-name`))),jn),Ox=Nn([Jy,dx]),_x=Nn([kx("autocompleteitem"),fx,vx,wx,nx,dx,ux]),Tx=[vx,mx,ux,dx,lx],Ex=Nn([Jy,ax,px].concat(Tx)),Ax=e=>Zn("toolbarbutton",Ex,e),Mx=[fx].concat(Tx),Dx=Nn(Mx.concat([Jy,ax,px])),Bx=e=>Zn("ToggleButton",Dx,e),Ix=[Ms("predicate",T),Es("scope","node",["node","editor"]),Es("position","selection",["node","selection","line"])],Fx=Tx.concat([kx("contextformbutton"),yx,ax,rs("original",w)]),Rx=Mx.concat([kx("contextformbutton"),yx,ax,rs("original",w)]),Nx=Tx.concat([kx("contextformbutton")]),Lx=Mx.concat([kx("contextformtogglebutton")]),zx=os("type",{contextformbutton:Fx,contextformtogglebutton:Rx}),Vx=Nn([kx("contextform"),Ms("initValue",x("")),gx,hs("commands",zx),bs("launch",os("type",{contextformbutton:Nx,contextformtogglebutton:Lx}))].concat(Ix)),Hx=Nn([kx("contexttoolbar"),ds("items")].concat(Ix)),Px=[Jy,ds("src"),ys("alt"),Ds("classes",[],jn)],Ux=Nn(Px),Wx=[Jy,ex,cx,Ds("classes",["tox-collection__item-label"],jn)],jx=Nn(Wx),$x=In((()=>Xn("type",{cardimage:Ux,cardtext:jx,cardcontainer:Gx}))),Gx=Nn([Jy,Ts("direction","horizontal"),Ts("align","left"),Ts("valign","middle"),hs("items",$x)]),qx=[vx,dx,px,("menuitem",ss("value","value",kn((()=>Bi("menuitem-value"))),Pn())),wx];const Yx=Nn([Jy,gx,hs("items",$x),lx,Sx].concat(qx)),Xx=Nn([Jy,fx,ux].concat(qx)),Kx=[Jy,ds("fancytype"),Sx],Jx=[Cs("initData",{})].concat(Kx),Zx=[ws("select"),Bs("initData",{},[As("allowCustomColors",!0),Ts("storageKey","default"),Ss("colors",Pn())])].concat(Kx),Qx=os("fancytype",{inserttable:Jx,colorswatch:Zx}),ew=Nn([Jy,lx,Sx,ux].concat(qx)),tw=Nn([Jy,rx,lx,ux].concat(qx)),ow=Nn([Jy,ux,fx,lx,ax].concat(qx)),nw=(e,t,o)=>{const n=Td(e.element,"."+o);if(n.length>0){const e=$(n,(e=>{const o=e.dom.getBoundingClientRect().top,s=n[0].dom.getBoundingClientRect().top;return Math.abs(o-s)>t})).getOr(n.length);return A.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return A.none()},sw=e=>((e,t)=>ma([Mh(e,t)]))(Bi("unnamed-events"),e),rw="silver.readonly",aw=Nn([("readonly",ls("readonly",$n))]);const iw=(e,t)=>{const o=e.mainUi.outerContainer.element,n=[e.mainUi.mothership,...e.uiMotherships];t&&V(n,(e=>{e.broadcastOn([Eu()],{target:o})})),V(n,(e=>{e.broadcastOn([rw],{readonly:t})}))},lw=(e,t)=>{e.on("init",(()=>{e.mode.isReadOnly()&&iw(t,!0)})),e.on("SwitchMode",(()=>iw(t,e.mode.isReadOnly()))),Df(e)&&e.mode.set("readonly")},cw=()=>gc.config({channels:{[rw]:{schema:aw,onReceive:(e,t)=>{pg.set(e,t.readonly)}}}}),dw=e=>pg.config({disabled:e}),uw=e=>pg.config({disabled:e,disableClass:"tox-tbtn--disabled"}),mw=e=>pg.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),gw=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},pw=(e,t)=>ea((o=>{gw(e,o)((o=>{const n=e.onSetup(o);p(n)&&t.set(n)}))})),hw=(e,t)=>ta((o=>gw(e,o)(t.get()))),fw=(e,t)=>na(((o,n)=>{gw(e,o)(e.onAction),e.triggersSubmenu||t!==dy.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Lr(o,yr()),n.stop())})),bw={[hr()]:["disabling","alloy.base.behaviour","toggling","item-events"]},vw=xe,yw=(e,t,o,n)=>{const s=on(b);return{type:"item",dom:t.dom,components:vw(t.optComponents),data:e.data,eventOrder:bw,hasSubmenu:e.triggersSubmenu,itemBehaviours:ma([Mh("item-events",[fw(e,o),pw(e,s),hw(e,s)]),(r=()=>!e.enabled||n.isDisabled(),pg.config({disabled:r,disableClass:"tox-collection__item--state-disabled"})),cw(),Ah.config({})].concat(e.itemBehaviours))};var r},xw=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),ww=e=>{const t=Tf.os.isMacOS()||Tf.os.isiOS(),o=t?{alt:"\u2325",ctrl:"\u2303",shift:"\u21e7",meta:"\u2318",access:"\u2303\u2325"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),s=z(n,(e=>{const t=e.toLowerCase().trim();return be(o,t)?o[t]:e}));return t?s.join(""):s.join("+")},Sw=(e,t,o=[fy])=>ry(e,{tag:"div",classes:o},t),kw=e=>({dom:{tag:"div",classes:[by]},components:[ul(Kv.translate(e))]}),Cw=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),Ow=(e,t)=>({dom:{tag:"div",classes:[by]},components:[{dom:{tag:e.tag,styles:e.styles},components:[ul(Kv.translate(t))]}]}),_w=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[ul(ww(e))]}),Tw=e=>Sw("checkmark",e,["tox-collection__item-checkmark"]),Ew=e=>{const t=e.map((e=>({attributes:{id:Bi("menu-item"),"aria-label":Kv.translate(e)}}))).getOr({});return{tag:"div",classes:[uy,my],...t}},Aw=(e,t,o,n=A.none())=>"color"===e.presets?((e,t,o)=>{const n=e.value,s=e.iconContent.map((e=>((e,t,o)=>{const n=t();return ty(e,n).or(o).getOrThunk(Qv(n))})(e,t.icons,o))),r=e.ariaLabel.map((e=>({"aria-label":t.translate(e),"data-mce-name":e}))).getOr({});return{dom:(()=>{const e=gy,t=s.getOr(""),o={tag:"div",attributes:r,classes:[e]};return"custom"===n?{...o,tag:"button",classes:[...o.classes,"tox-swatches__picker-btn"],innerHtml:t}:"remove"===n?{...o,classes:[...o.classes,"tox-swatch--remove"],innerHtml:t}:g(n)?{...o,attributes:{...o.attributes,"data-mce-color":n},styles:{"background-color":n},innerHtml:t}:o})(),optComponents:[]}})(e,t,n):((e,t,o,n)=>{const s={tag:"div",classes:[fy]},r=o?e.iconContent.map((e=>ry(e,s,t.icons,n))).orThunk((()=>A.some({dom:s}))):A.none(),a=e.checkMark,i=A.from(e.meta).fold((()=>kw),(e=>be(e,"style")?k(Ow,e.style):kw)),l=e.htmlContent.fold((()=>e.textContent.map(i)),(e=>A.some(Cw(e,[by]))));return{dom:Ew(e.ariaLabel),optComponents:[r,l,e.shortcutContent.map(_w),a,e.caret]}})(e,t,o,n),Mw=(e,t,o)=>fe(e,"tooltipWorker").map((e=>[Qb.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:Uc}}),mode:"follow-highlight",onShow:(t,o)=>{e((e=>{Qb.setComponents(t,[ml({element:Le(e)})])}))}})])).getOrThunk((()=>o.map((e=>[Qb.config({...t.providers.tooltips.getConfig({tooltipText:e}),mode:"follow-highlight"})])).getOr([]))),Dw=(e,t)=>{const o=(e=>Of.DOM.encode(e))(Kv.translate(e));if(t.length>0){const e=new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t),"gi");return o.replace(e,(e=>`${e}`))}return o},Bw=(e,t)=>z(e,(e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":wy,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[xy,o,n,(()=>{switch(e.valign){case"top":return"tox-collection__item-container--valign-top";case"middle":return"tox-collection__item-container--valign-middle";case"bottom":return"tox-collection__item-container--valign-bottom"}})()]},components:t}})(e,Bw(e.items,t));case"cardimage":return((e,t,o)=>({dom:{tag:"img",classes:t,attributes:{src:e,alt:o.getOr("")}}}))(e.src,e.classes,e.alt);case"cardtext":const o=e.name.exists((e=>F(t.cardText.highlightOn,e))),n=o?A.from(t.cardText.matchText).getOr(""):"";return Cw(Dw(e.text,n),e.classes)}})),Iw=Em(nf(),sf()),Fw=e=>({value:zw(e)}),Rw=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Nw=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Lw=e=>Rw.test(e)||Nw.test(e),zw=e=>Oe(e,"#").toUpperCase(),Vw=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Hw=e=>{const t=Vw(e.red)+Vw(e.green)+Vw(e.blue);return Fw(t)},Pw=Math.min,Uw=Math.max,Ww=Math.round,jw=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,$w=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,Gw=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),qw=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},Yw=e=>{let t,o,n;const s=(e.hue||0)%360;let r=e.saturation/100,a=e.value/100;if(r=Uw(0,Pw(r,1)),a=Uw(0,Pw(a,1)),0===r)return t=o=n=Ww(255*a),Gw(t,o,n,1);const i=s/60,l=a*r,c=l*(1-Math.abs(i%2-1)),d=a-l;switch(Math.floor(i)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=Ww(255*(t+d)),o=Ww(255*(o+d)),n=Ww(255*(n+d)),Gw(t,o,n,1)},Xw=e=>{const t=(e=>{const t=(e=>{const t=e.value.replace(Rw,((e,t,o,n)=>t+t+o+o+n+n));return{value:t}})(e),o=Nw.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o})(e),o=parseInt(t[1],16),n=parseInt(t[2],16),s=parseInt(t[3],16);return Gw(o,n,s,1)},Kw=(e,t,o,n)=>{const s=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return Gw(s,r,a,i)},Jw=e=>{const t=jw.exec(e);if(null!==t)return A.some(Kw(t[1],t[2],t[3],"1"));const o=$w.exec(e);return null!==o?A.some(Kw(o[1],o[2],o[3],o[4])):A.none()},Zw=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Qw=Gw(255,0,0,1),eS=(e,t)=>{e.dispatch("ResizeContent",t)},tS=(e,t)=>{e.dispatch("TextColorChange",t)},oS=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),nS=(e,t)=>()=>{e(),t()},sS=e=>aS(e,"NodeChange",(t=>{t.setEnabled(e.selection.isEditable())})),rS=(e,t)=>o=>{const n=sS(e)(o),s=((e,t)=>o=>{const n=sn(),s=()=>{o.setActive(e.formatter.match(t));const s=e.formatter.formatChanged(t,o.setActive);n.set(s)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),n.clear()}})(e,t)(o);return()=>{n(),s()}},aS=(e,t,o)=>n=>{const s=()=>o(n),r=()=>{o(n),e.on(t,s)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),e.off(t,s)}},iS=e=>t=>()=>{e.undoManager.transact((()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)}))},lS=(e,t)=>()=>e.execCommand(t);var cS=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const dS={},uS=e=>fe(dS,e).getOrThunk((()=>{const t=`tinymce-custom-colors-${e}`,o=cS.getItem(t);if(m(o)){const e=cS.getItem("tinymce-custom-colors");cS.setItem(t,g(e)?e:"[]")}const n=((e,t=10)=>{const o=cS.getItem(e),n=r(o)?JSON.parse(o):[],s=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{s.splice(e,1)};return{add:o=>{((e,t)=>{const o=I(e,t);return-1===o?A.none():A.some(o)})(s,o).each(i),s.unshift(o),s.length>t&&s.pop(),cS.setItem(e,JSON.stringify(s))},state:()=>s.slice(0)}})(t,10);return dS[e]=n,n})),mS=(e,t)=>{uS(e).add(t)},gS=(e,t,o)=>({hue:e,saturation:t,value:o}),pS=e=>{let t=0,o=0,n=0;const s=e.red/255,r=e.green/255,a=e.blue/255,i=Math.min(s,Math.min(r,a)),l=Math.max(s,Math.max(r,a));return i===l?(n=i,gS(0,0,100*n)):(t=s===i?3:a===i?1:5,t=60*(t-(s===i?r-a:a===i?s-r:a-s)/(l-i)),o=(l-i)/l,n=l,gS(Math.round(t),Math.round(100*o),Math.round(100*n)))},hS=e=>Hw(Yw(e)),fS=e=>{return(t=e,Lw(t)?A.some({value:zw(t)}):A.none()).orThunk((()=>Jw(e).map(Hw))).getOrThunk((()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,s=n[0],r=n[1],a=n[2],i=n[3];return Hw(Gw(s,r,a,i))}));var t},bS="forecolor",vS="hilitecolor",yS=e=>{const t=[];for(let o=0;ot=>t.options.get(e),wS="#000000",SS=(e,t)=>t===bS&&e.options.isSet("color_map_foreground")?xS("color_map_foreground")(e):t===vS&&e.options.isSet("color_map_background")?xS("color_map_background")(e):xS("color_map")(e),kS=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(SS(e,t).length))),CS=(e,t)=>{const o=xS("color_cols")(e),n=kS(e,t);return o===kS(e)?n:o},OS=(e,t="default")=>Math.round(t===bS?xS("color_cols_foreground")(e):t===vS?xS("color_cols_background")(e):xS("color_cols")(e)),_S=xS("custom_colors"),TS=xS("color_default_foreground"),ES=xS("color_default_background"),AS=(e,t)=>{const o=Le(e.selection.getStart()),n="hilitecolor"===t?zs(o,(e=>{if($e(e)){const t=Rt(e,"background-color");return ke(Jw(t).exists((e=>0!==e.alpha)),t)}return A.none()})).getOr("rgba(0, 0, 0, 0)"):Rt(o,"color");return Jw(n).map((e=>"#"+Hw(e).value))},MS=e=>{const t="choiceitem",o={type:t,text:"Remove color",icon:"color-swatch-remove-color",value:"remove"};return e?[o,{type:t,text:"Custom color",icon:"color-picker",value:"custom"}]:[o]},DS=(e,t,o,n)=>{"custom"===o?HS(e)((o=>{o.each((o=>{mS(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)}))}),AS(e,t).getOr(wS)):"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},BS=(e,t,o)=>e.concat((e=>z(uS(e).state(),(e=>({type:"choiceitem",text:e,icon:"checkmark",value:e}))))(t).concat(MS(o))),IS=(e,t,o)=>n=>{n(BS(e,t,o))},FS=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},RS=(e,t)=>{e.setTooltip(t)},NS=(e,t)=>o=>{const n=AS(e,t);return ye(n,o.toUpperCase())},LS=(e,t,o)=>{if(De(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",s=BS(SS(e,t),t,!1),r=j(s,(e=>e.value===o)).getOr({text:""}).text;return e.translate([n,e.translate(r)])},zS=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:LS(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:NS(e,o),columns:OS(e,o),fetch:IS(SS(e,o),o,_S(e)),onAction:t=>{DS(e,o,n.get(),b)},onItemAction:(s,r)=>{DS(e,o,r,(o=>{n.set(o),tS(e,{name:t,color:o})}))},onSetup:s=>{FS(s,t,n.get());const r=n=>{n.name===t&&(FS(s,n.name,n.color),RS(s,LS(e,o,n.color)))};return e.on("TextColorChange",r),nS(sS(e)(s),(()=>{e.off("TextColorChange",r)}))}})},VS=(e,t,o,n,s)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(RS(n,LS(e,o,s.get())),FS(n,t,s.get()),sS(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:NS(e,o),initData:{storageKey:o},onAction:n=>{DS(e,o,n.value,(o=>{s.set(o),tS(e,{name:t,color:o})}))}}]})},HS=e=>(t,o)=>{let n=!1;const s={colorpicker:o};e.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:s,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const s=o.getData().colorpicker;n?(t(A.from(s)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",s]))},onClose:b,onCancel:()=>{t(A.none())}})},PS=(e,t,o,n,s,r,a,i)=>{const l=qy(t),c=US(t,o,n,"color"!==s?"normal":"color",r,a,i);return Ky(e,l,c,n,{menuType:s})},US=(e,t,o,n,s,r,a)=>xe(z(e,(i=>{return"choiceitem"===i.type?(l=i,Zn("choicemenuitem",Xx,l)).fold(Yy,(i=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=Aw({presets:o,textContent:t?e.text:A.none(),htmlContent:A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:A.none(),checkMark:t?A.some(Tw(a.icons)):A.none(),caret:A.none(),value:e.value},a,i),c=e.text.filter(x(!t)).map((e=>Qb.config(a.tooltips.getConfig({tooltipText:a.translate(e)}))));return wn(yw({data:xw(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Wh.set(e,t)},isActive:()=>Wh.isOn(e),isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(s),b),triggersSubmenu:!1,itemBehaviours:[...c.toArray()]},l,r,a),{toggling:{toggleClass:hy,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(i,1===o,n,t,r(i.value),s,a,qy(e))))):A.none();var l}))),WS=(e,t)=>{const o=Oy(t);return 1===e?{mode:"menu",moveOnTab:!0}:"auto"===e?{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group"),previousSelector:e=>"color"===t?_l(e.element,"[aria-checked=true]"):A.none()}},jS=Bi("cell-over"),$S=Bi("cell-execute"),GS=(e,t,o)=>{const n=o=>zr(o,$S,{row:e,col:t}),s=(e,t)=>{t.stop(),n(e)};return hl({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:ma([Mh("insert-table-picker-cell",[Gr(Js(),Rh.focus),Gr(hr(),n),Gr(sr(),s),Gr(br(),s)]),Wh.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Rh.config({onFocus:o=>zr(o,jS,{row:e,col:t})})])})},qS=e=>q(e,(e=>z(e,fl))),YS=(e,t)=>ul(`${t}x${e}`),XS={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=((e,t,o)=>{const n=[];for(let t=0;t<10;t++){const o=[];for(let n=0;n<10;n++){const s=e(t+1,n+1);o.push(GS(t,n,s))}n.push(o)}return n})(o),s=YS(0,0),r=Vb({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[s],behaviours:ma([Ah.config({})])});return{type:"widget",data:{value:Bi("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Iw.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:qS(n).concat(r.asSpec()),behaviours:ma([Mh("insert-table-picker",[ea((e=>{Ah.set(r.get(e),[s])})),Kr(jS,((e,t,o)=>{const{row:s,col:a}=o.event;((e,t,o,n,s)=>{for(let n=0;n<10;n++)for(let s=0;s<10;s++)Wh.set(e[n][s],n<=t&&s<=o)})(n,s,a),Ah.set(r.get(e),[YS(s+1,a+1)])})),Kr($S,((t,o,n)=>{const{row:s,col:r}=n.event;e.onAction({numRows:s+1,numColumns:r+1}),Lr(t,yr())}))]),xh.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=((e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold((()=>BS(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o)),(e=>e.concat(MS(o))))})(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),s="color",r={...PS(Bi("menu-value"),o,(t=>{e.onAction({value:t})}),n,s,dy.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),markers:Oy(s),movement:WS(n,s),menuRole:!1};return{type:"widget",data:{value:Bi("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Iw.widget(uf.sketch(r))]}}},KS=e=>({type:"separator",dom:{tag:"div",classes:[my,"tox-collection__group-heading"]},components:e.text.map(ul).toArray()});var JS=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),ZS=[ls("others",Jn(dn.value,Pn()))],QS=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,o)=>{if(0===re(t.others).length)throw new Error("Cannot find any known coupled components");return fe(e,o)},o=x({});return ua({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk((()=>(fe(o.others,n).getOrDie("No information found for coupled component: "+n),A.none()))),getOrCreate:(o,n,s)=>t(n,s).getOrThunk((()=>{const t=fe(n.others,s).getOrDie("No information found for coupled component: "+s)(o),r=o.getSystem().build(t);return e[s]=r,r}))})}});const ek=pa({fields:ZS,name:"coupling",apis:JS,state:QS}),tk=e=>{let t=A.none(),o=[];const n=e=>{s()?r(e):o.push(e)},s=()=>t.isSome(),r=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{s()||(t=A.some(e),V(o,r),o=[])})),{get:n,map:e=>tk((t=>{n((o=>{t(e(o))}))})),isReady:s}},ok={nu:tk,pure:e=>tk((t=>{t(e)}))},nk=e=>{setTimeout((()=>{throw e}),0)},sk=e=>{const t=t=>{e().then(t,nk)};return{map:t=>sk((()=>e().then(t))),bind:t=>sk((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>sk((()=>e().then((()=>t.toPromise())))),toLazy:()=>ok.nu(t),toCached:()=>{let t=null;return sk((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},rk=e=>sk((()=>new Promise(e))),ak=e=>sk((()=>Promise.resolve(e))),ik=x("sink"),lk=x(km({name:ik(),overrides:x({dom:{tag:"div"},behaviours:ma([tu.config({useFixed:E})]),events:Wr([Jr(er()),Jr(qs()),Jr(sr())])})})),ck=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",s=e.getAnchorOverrides();return e.layouts.fold((()=>({type:n,hotspot:o,overrides:s})),(e=>({type:n,hotspot:o,overrides:s,layouts:e})))},dk=(e,t,o,n,s,r,a)=>{const i=((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=gk(n,e);return i.map((e=>e.bind((e=>A.from(xf.sketch({...r.menu(),uid:Vi(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();tu.position(n,t,{anchor:o}),Tu.decloak(s)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();tu.position(n,o,{anchor:{type:"submenu",item:t}}),Tu.decloak(s)},onRepositionMenu:(e,t,n)=>{const s=l().getOrDie();tu.position(s,t,{anchor:o}),V(n,(e=>{tu.position(s,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})}))},onEscape:()=>(Rh.focus(n),Tu.close(s),A.some(!0))}))))))})(e,t,ck(e,o),o,n,s,a);return i.map((e=>(e.fold((()=>{Tu.isOpen(n)&&Tu.close(n)}),(e=>{Tu.cloak(n),Tu.open(n,e),r(n)})),n)))},uk=(e,t,o,n,s,r,a)=>(Tu.close(n),ak(n)),mk=(e,t,o,n,s,r)=>{const a=ek.getCoupled(o,"sandbox");return(Tu.isOpen(a)?uk:dk)(e,t,o,a,n,s,r)},gk=(e,t)=>e.getSystem().getByUid(t.uid+"-"+ik()).map((e=>()=>dn.value(e))).getOrThunk((()=>t.lazySink.fold((()=>()=>dn.error(new Error("No internal sink is specified, nor could an external sink be found"))),(t=>()=>t(e))))),pk=e=>{Tu.getState(e).each((e=>{xf.repositionMenus(e)}))},hk=(e,t,o)=>{const n=Al(),s=gk(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:Zu(e.sandboxBehaviours,[qu.config({store:{mode:"memory",initialValue:t}}),Tu.config({onOpen:(s,r)=>{const a=ck(e,t);n.link(t.element),e.matchWidth&&((e,t,o)=>{const n=eg.getCurrent(t).getOr(t),s=Zt(e.element);o?Bt(n.element,"min-width",s+"px"):((e,t)=>{Jt.set(e,t)})(n.element,s)})(a.hotspot,r,e.useMinWidth),e.onOpen(a,s,r),void 0!==o&&void 0!==o.onOpen&&o.onOpen(s,r)},onClose:(e,r)=>{n.unlink(t.element),s().getOr(r).element.dom.dispatchEvent(new window.FocusEvent("focusout")),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},isPartOf:(e,o,n)=>Ml(o,n)||Ml(t,n),getAttachPoint:()=>s().getOrDie()}),eg.config({find:e=>Tu.getState(e).bind((e=>eg.getCurrent(e)))}),gc.config({channels:{...Bu({isExtraPart:T}),...Fu({doReposition:pk})}})])}},fk=e=>{const t=ek.getCoupled(e,"sandbox");pk(t)},bk=()=>[Cs("sandboxClasses",[]),Ju("sandboxBehaviours",[eg,gc,Tu,qu])],vk=x([is("dom"),is("fetch"),xi("onOpen"),wi("onExecute"),Cs("getHotspot",A.some),Cs("getAnchorOverrides",x({})),ed(),Yu("dropdownBehaviours",[Wh,ek,xh,Rh]),is("toggleClass"),Cs("eventOrder",{}),fs("lazySink"),Cs("matchWidth",!1),Cs("useMinWidth",!1),fs("role")].concat(bk())),yk=x([Sm({schema:[bi(),Cs("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),lk()]),xk=Km({name:"Dropdown",configFields:vk(),partFields:yk(),factory:(e,t,o,n)=>{const s=e=>{Tu.getState(e).each((e=>{xf.highlightPrimary(e)}))},r=(t,o,s)=>mk(e,w,t,n,o,s),a={expand:e=>{Wh.isOn(e)||r(e,b,vf.HighlightNone).get(b)},open:e=>{Wh.isOn(e)||r(e,b,vf.HighlightMenuAndItem).get(b)},refetch:t=>ek.getExistingCoupled(t,"sandbox").fold((()=>r(t,b,vf.HighlightMenuAndItem).map(b)),(o=>dk(e,w,t,o,n,b,vf.HighlightMenuAndItem).map(b))),isOpen:Wh.isOn,close:e=>{Wh.isOn(e)&&r(e,b,vf.HighlightMenuAndItem).get(b)},repositionMenus:e=>{Wh.isOn(e)&&fk(e)}},i=(e,t)=>(Vr(e),A.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.dropdownBehaviours,[Wh.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),ek.config({others:{sandbox:t=>hk(e,t,{onOpen:()=>Wh.on(t),onClose:()=>Wh.off(t)})}}),xh.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(xk.isOpen(e)){const t=ek.getCoupled(e,"sandbox");s(t)}else xk.open(e);return A.some(!0)},onEscape:(e,t)=>xk.isOpen(e)?(xk.close(e),A.some(!0)):A.none()}),Rh.config({})]),events:$h(A.some((e=>{r(e,s,vf.HighlightMenuAndItem).get(b)}))),eventOrder:{...e.eventOrder,[hr()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold((()=>({})),(e=>({role:e}))),..."button"===e.dom.tag?{type:("type",fe(e.dom,"attributes").bind((e=>fe(e,"type")))).getOr("button")}:{}}}}},apis:{open:(e,t)=>e.open(t),refetch:(e,t)=>e.refetch(t),expand:(e,t)=>e.expand(t),close:(e,t)=>e.close(t),isOpen:(e,t)=>e.isOpen(t),repositionMenus:(e,t)=>e.repositionMenus(t)}}),wk=(e,t,o)=>{zy(e).each((e=>{var n;((e,t)=>{Tt(t.element,"id").each((t=>Ct(e.element,"aria-activedescendant",t)))})(e,o),(_a((n=t).element,Py)?A.some(n.element):_l(n.element,"."+Py)).each((t=>{Tt(t,"id").each((t=>Ct(e.element,"aria-controls",t)))}))})),Ct(o.element,"aria-selected","true")},Sk=(e,t,o)=>{Ct(o.element,"aria-selected","false")},kk=e=>ek.getExistingCoupled(e,"sandbox").bind(Ly).map(Vy).map((e=>e.fetchPattern)).getOr("");var Ck;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(Ck||(Ck={}));const Ok=(e,t,o,n,s)=>{const r=o.shared.providers,a=e=>s?{...e,shortcut:A.none(),icon:e.text.isSome()?A.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,Zn("menuitem",ew,i)).fold(Yy,(e=>A.some(((e,t,o,n=!0)=>{const s=Aw({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.none(),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return yw({data:xw(e),getApi:e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o)})(a(e),t,r,n))));case"nestedmenuitem":return(e=>Zn("nestedmenuitem",tw,e))(e).fold(Yy,(e=>A.some(((e,t,o,n=!0,s=!1)=>{const r=s?(a=o.icons,Sw("chevron-down",a,[vy])):(e=>Sw("chevron-right",e,[vy]))(o.icons);var a;const i=Aw({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.some(r),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return yw({data:xw(e),getApi:e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t),setIconFill:(t,o)=>{_l(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{Ct(e,"fill",o)}))},setTooltip:t=>{const n=o.translate(t);Ct(e.element,"aria-label",n)}}),enabled:e.enabled,onAction:b,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)})(a(e),t,r,n,s))));case"togglemenuitem":return(e=>Zn("togglemenuitem",ow,e))(e).fold(Yy,(e=>A.some(((e,t,o,n=!0)=>{const s=Aw({iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,checkMark:A.some(Tw(o.icons)),caret:A.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return wn(yw({data:xw(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Wh.set(e,t)},isActive:()=>Wh.isOn(e),isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o),{toggling:{toggleClass:hy,toggleOnExecute:!1,selected:e.active}})})(a(e),t,r,n))));case"separator":return(e=>Zn("separatormenuitem",Ox,e))(e).fold(Yy,(e=>A.some(KS(e))));case"fancymenuitem":return(e=>Zn("fancymenuitem",Qx,e))(e).fold(Yy,(e=>((e,t)=>fe(XS,e.fancytype).map((o=>o(e,t))))(e,o)));default:return console.error("Unknown item in general menu",e),A.none()}var i},_k=(e,t,o,n,s,r,a)=>{const i=1===n,l=!i||qy(e);return xe(z(e,(e=>{switch(e.type){case"separator":return(n=e,Zn("Autocompleter.Separator",Ox,n)).fold(Yy,(e=>A.some(KS(e))));case"cardmenuitem":return(e=>Zn("cardmenuitem",Yx,e))(e).fold(Yy,(e=>A.some(((e,t,o,n)=>{const s={dom:Ew(e.label),optComponents:[A.some({dom:{tag:"div",classes:[xy,wy]},components:Bw(e.items,n)})]};return yw({data:xw({text:A.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>{pg.set(e,!t),V(Td(e.element,"*"),(o=>{e.getSystem().getByDom(o).each((e=>{e.hasConfigured(pg)&&pg.set(e,!t)}))}))}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:A.from(n.itemBehaviours).getOr([])},s,t,o.providers)})({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},s,r,{itemBehaviours:Mw(e.meta,r,A.none()),cardText:{matchText:t,highlightOn:a}}))));default:return(e=>Zn("Autocompleter.Item",_x,e))(e).fold(Yy,(e=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=Aw({presets:n,textContent:A.none(),htmlContent:o?e.text.map((e=>Dw(e,t))):A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:A.none(),checkMark:A.none(),caret:A.none(),value:e.value},a.providers,i,e.icon),c=e.text.filter((e=>!o&&""!==e));return yw({data:xw(e),enabled:e.enabled,getApi:x({}),onAction:t=>s(e.value,e.meta),onSetup:x(b),triggersSubmenu:!1,itemBehaviours:Mw(e,a,c)},l,r,a.providers)})(e,t,i,"normal",o,s,r,l))))}var n})))},Tk=(e,t,o,n,s,r)=>{const a=qy(t),i=xe(z(t,(e=>{const t=e=>Ok(e,o,n,(e=>s?!be(e,"text"):a)(e),s);return"nestedmenuitem"===e.type&&e.getSubmenuItems().length<=0?t({...e,enabled:!1}):t(e)}))),l=(e=>"no-search"===e.searchMode?{menuType:"normal"}:{menuType:"searchable",searchMode:e})(r);return(s?Xy:Ky)(e,a,i,1,l)},Ek=e=>xf.singleData(e.value,e),Ak=e=>hd(Le(e.startContainer),e.startOffset,Le(e.endContainer),e.endOffset),Mk=(e,t)=>{const o=Bi("autocompleter"),n=on(!1),s=on(!1),r=rn(),a=hl(wf.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:ma([Mh("dismissAutocompleter",[Gr(Er(),(()=>u())),Gr(Rr(),((t,o)=>{Tt(o.event.target,"id").each((t=>Ct(Le(e.getBody()),"aria-activedescendant",t)))}))])]),lazySink:t.getSink})),i=()=>wf.isOpen(a),l=s.get,c=()=>{if(i()){wf.hide(a),e.dom.remove(o,!1);const t=Le(e.getBody());Tt(t,"aria-owns").filter((e=>e===o)).each((()=>{At(t,"aria-owns"),At(t,"aria-activedescendant")}))}},d=()=>wf.getContent(a).bind((e=>ee(e.components(),0))),u=()=>e.execCommand("mceAutocompleterClose"),m=s=>{const i=(o=>{const s=se(o,(e=>A.from(e.columns))).getOr(1);return q(o,(o=>{const a=o.items;return _k(a,o.matchText,((t,s)=>{const a={hide:()=>u(),reload:t=>{c(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};e.execCommand("mceAutocompleterRefreshActiveRange"),r.get().each((e=>{n.set(!0),o.onAction(a,e,t,s),n.set(!1)}))}),s,dy.BUBBLE_TO_SANDBOX,t,o.highlightOn)}))})(s);i.length>0?(((t,o)=>{const n=se(t,(e=>A.from(e.columns))).getOr(1);wf.showMenuAt(a,{anchor:{type:"selection",getSelection:()=>r.get().map(Ak),root:Le(e.getBody())}},((e,t,o,n)=>{const s=WS(t,n),r=Oy(n);return{data:Ek({...e,movement:s,menuBehaviours:sw("auto"!==t?[]:[ea(((e,t)=>{nw(e,4,r.item).each((({numColumns:t,numRows:o})=>{xh.setGridSize(e,o,t)}))}))])}),menu:{markers:Oy(n),fakeFocus:o===Ck.ContentFocus}}})(Ky("autocompleter-value",!0,o,n,{menuType:"normal"}),n,Ck.ContentFocus,"normal")),d().each(Cg.highlightFirst)})(s,i),Ct(Le(e.getBody()),"aria-owns",o),e.inline||g()):c()},g=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),s=(e=>ai(e,!0))(a.element);It(s,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${n.offsetTop}px`,left:`${n.offsetLeft}px`}),e.dom.add(t,s.dom),_l(s,'[role="menu"]').each((e=>{Ht(e,"position"),Ht(e,"max-height")}))};e.on("AutocompleterStart",(({lookupData:e})=>{s.set(!0),n.set(!1),m(e)})),e.on("AutocompleterUpdate",(({lookupData:e})=>m(e))),e.on("AutocompleterUpdateActiveRange",(({range:e})=>r.set(e))),e.on("AutocompleterEnd",(()=>{c(),s.set(!1),n.set(!1),r.clear()}));((e,t)=>{const o=(e,t)=>{zr(e,er(),{raw:t})},n=()=>e.getMenu().bind(Cg.getHighlighted);t.on("keydown",(t=>{const s=t.which;e.isActive()&&(e.isMenuOpen()?13===s?(n().each(Vr),t.preventDefault()):40===s?(n().fold((()=>{e.getMenu().each(Cg.highlightFirst)}),(e=>{o(e,t)})),t.preventDefault(),t.stopImmediatePropagation()):37!==s&&38!==s&&39!==s||n().each((e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()})):13!==s&&38!==s&&40!==s||e.cancelIfNecessary())})),t.on("NodeChange",(()=>{!e.isActive()||e.isProcessingAction()||t.queryCommandState("mceAutoCompleterInRange")||e.cancelIfNecessary()}))})({cancelIfNecessary:u,isMenuOpen:i,isActive:l,isProcessingAction:n.get,getMenu:d},e)},Dk=(e,t,o)=>Tl(e,t,o).isSome(),Bk=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout((()=>{e.apply(null,n),o=null}),t)}}},Ik=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])},Fk=(e,t)=>{const o={stopBackspace:!0,...t},n=(e=>{const t=rn(),o=on(!1),n=Bk((t=>{e.triggerEvent(vr(),t),o.set(!0)}),400),s=Rs([{key:Ws(),value:e=>(Ik(e).each((s=>{n.cancel();const r={x:s.clientX,y:s.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(r)})),A.none())},{key:js(),value:e=>(n.cancel(),Ik(e).each((e=>{t.on((o=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(e,o)&&t.clear()}))})),A.none())},{key:$s(),value:s=>(n.cancel(),t.get().filter((e=>Qe(e.target,s.target))).map((t=>o.get()?(s.prevent(),!1):e.triggerEvent(br(),s))))}]);return{fireIfReady:(e,t)=>fe(s,t).bind((t=>t(e)))}})(o),s=z(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),(t=>Fc(e,t,(e=>{n.fireIfReady(e,t).each((t=>{t&&e.kill()})),o.triggerEvent(t,e)&&e.kill()})))),r=rn(),a=Fc(e,"paste",(e=>{n.fireIfReady(e,"paste").each((t=>{t&&e.kill()})),o.triggerEvent("paste",e)&&e.kill(),r.set(setTimeout((()=>{o.triggerEvent(gr(),e)}),0))})),i=Fc(e,"keydown",(e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===Og[0]&&!F(["input","textarea"],Ue(e.target))&&!Dk(e.target,'[contenteditable="true"]'))(e)&&e.prevent()})),l=Fc(e,"focusin",(e=>{o.triggerEvent("focusin",e)&&e.kill()})),c=rn(),d=Fc(e,"focusout",(e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout((()=>{o.triggerEvent(mr(),e)}),0))}));return{unbind:()=>{V(s,(e=>{e.unbind()})),i.unbind(),l.unbind(),d.unbind(),a.unbind(),r.on(clearTimeout),c.on(clearTimeout)}}},Rk=(e,t)=>{const o=fe(e,"target").getOr(t);return on(o)},Nk=Is([{stopped:[]},{resume:["element"]},{complete:[]}]),Lk=(e,t,o,n,s,r)=>{const a=e(t,n),i=((e,t)=>{const o=on(!1),n=on(!1);return{stop:()=>{o.set(!0)},cut:()=>{n.set(!0)},isStopped:o.get,isCut:n.get,event:e,setSource:t.set,getSource:t.get}})(o,s);return a.fold((()=>(r.logEventNoHandlers(t,n),Nk.complete())),(e=>{const o=e.descHandler;return Yi(o)(i),i.isStopped()?(r.logEventStopped(t,e.element,o.purpose),Nk.stopped()):i.isCut()?(r.logEventCut(t,e.element,o.purpose),Nk.complete()):rt(e.element).fold((()=>(r.logNoParent(t,e.element,o.purpose),Nk.complete())),(n=>(r.logEventResponse(t,e.element,o.purpose),Nk.resume(n))))}))},zk=(e,t,o,n,s,r)=>Lk(e,t,o,n,s,r).fold(E,(n=>zk(e,t,o,n,s,r)),T),Vk=(e,t,o,n,s)=>{const r=Rk(o,n);return zk(e,t,o,n,r,s)},Hk=()=>{const e=(()=>{const e={};return{registerId:(t,o,n)=>{ie(n,((n,s)=>{const r=void 0!==e[s]?e[s]:{};r[o]=((e,t)=>({cHandler:k.apply(void 0,[e.handler].concat(t)),purpose:e.purpose}))(n,t),e[s]=r}))},unregisterId:t=>{ie(e,((e,o)=>{be(e,t)&&delete e[t]}))},filterByType:t=>fe(e,t).map((e=>ge(e,((e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))))).getOr([]),find:(t,o,n)=>fe(e,o).bind((e=>zs(n,(t=>((e,t)=>zi(t).bind((t=>fe(e,t))).map((e=>((e,t)=>({element:e,descHandler:t}))(t,e))))(e,t)),t)))}})(),t={},o=o=>{zi(o.element).each((o=>{delete t[o],e.unregisterId(o)}))};return{find:(t,o,n)=>e.find(t,o,n),filter:t=>e.filterByType(t),register:n=>{const s=(e=>{const t=e.element;return zi(t).getOrThunk((()=>((e,t)=>{const o=Bi(Ri+"uid-");return Li(t,o),o})(0,e.element)))})(n);ve(t,s)&&((e,n)=>{const s=t[n];if(s!==e)throw new Error('The tagId "'+n+'" is already used by: '+ii(s.element)+"\nCannot use it for: "+ii(e.element)+"\nThe conflicting element is"+(xt(s.element)?" ":" not ")+"already in the DOM");o(e)})(n,s);const r=[n];e.registerId(r,s,n.events),t[s]=n},unregister:o,getById:e=>fe(t,e)}},Pk=Xm({name:"Container",factory:e=>{const{attributes:t,...o}=e.dom;return{uid:e.uid,dom:{tag:"div",attributes:{role:"presentation",...t},...o},components:e.components,behaviours:Xu(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[Cs("components",[]),Yu("containerBehaviours",[]),Cs("events",{}),Cs("domModification",{}),Cs("eventOrder",{})]}),Uk=e=>{const t=t=>rt(e.element).fold(E,(e=>Qe(t,e))),o=Hk(),n=(e,n)=>o.find(t,e,n),s=Fk(e.element,{triggerEvent:(e,t)=>ui(e,t.target,(o=>((e,t,o,n)=>Vk(e,t,o,o.target,n))(n,e,t,o)))}),r={debugInfo:x("real"),triggerEvent:(e,t,o)=>{ui(e,t,(s=>Vk(n,e,o,t,s)))},triggerFocus:(e,t)=>{zi(e).fold((()=>{hc(e)}),(o=>{ui(ur(),e,(o=>(((e,t,o,n,s)=>{const r=Rk(o,n);Lk(e,t,o,n,r,s)})(n,ur(),{originator:t,kill:b,prevent:b,target:e},e,o),!1)))}))},triggerEscape:(e,t)=>{r.triggerEvent("keydown",e.element,t.event)},getByUid:e=>p(e),getByDom:e=>h(e),build:hl,buildOrPatch:pl,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{u(e)},broadcastOn:(e,t)=>{m(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:E},a=e=>{e.connect(r),Ge(e.element)||(o.register(e),V(e.components(),a),r.triggerEvent(wr(),e.element,{target:e.element}))},i=e=>{Ge(e.element)||(V(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{lu(e,t)},c=e=>{uu(e)},d=e=>{const t=o.filter(pr());V(t,(t=>{const o=t.descHandler;Yi(o)(e)}))},u=e=>{d({universal:!0,data:e})},m=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>((e,t,o)=>{const n=(e=>{const t=on(!1);return{stop:()=>{t.set(!0)},cut:b,isStopped:t.get,isCut:T,event:e,setSource:O("Cannot set source of a broadcasted event"),getSource:O("Cannot get source of a broadcasted event")}})(t);return V(e,(e=>{const t=e.descHandler;Yi(t)(n)})),n.isStopped()})(o.filter(e),t),p=e=>o.getById(e).fold((()=>dn.error(new Error('Could not find component with uid: "'+e+'" in system.'))),dn.value),h=e=>{const t=zi(e).getOr("not found");return p(t)};return a(e),{root:e,element:e.element,destroy:()=>{s.unbind(),Uo(e.element)},add:l,remove:c,getByUid:p,getByDom:h,addToWorld:a,removeFromWorld:i,broadcast:u,broadcastOn:m,broadcastEvent:g}},Wk=x([Cs("prefix","form-field"),Yu("fieldBehaviours",[eg,qu])]),jk=x([km({schema:[is("dom")],name:"label"}),km({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[is("text")],name:"aria-descriptor"}),wm({factory:{sketch:e=>{const t=((e,t)=>{const o={};return ie(e,((e,n)=>{F(t,n)||(o[n]=e)})),o})(e,["factory"]);return e.factory.sketch(t)}},schema:[is("factory")],name:"field"})]),$k=Km({name:"FormField",configFields:Wk(),partFields:jk(),factory:(e,t,o,n)=>{const s=Ku(e.fieldBehaviours,[eg.config({find:t=>Rm(t,e,"field")}),qu.config({store:{mode:"manual",getValue:e=>eg.getCurrent(e).bind(qu.getValue),setValue:(e,t)=>{eg.getCurrent(e).each((e=>{qu.setValue(e,t)}))}}})]),r=Wr([ea(((t,o)=>{const n=Lm(t,e,["label","field","aria-descriptor"]);n.field().each((t=>{const o=Bi(e.prefix);n.label().each((e=>{Ct(e.element,"for",o),Ct(t.element,"id",o)})),n["aria-descriptor"]().each((o=>{const n=Bi(e.prefix);Ct(o.element,"id",n),Ct(t.element,"aria-describedby",n)}))}))}))]),a={getField:t=>Rm(t,e,"field"),getLabel:t=>Rm(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:s,events:r,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}});var Gk=tinymce.util.Tools.resolve("tinymce.html.Entities");const qk=(e,t,o,n)=>{const s=Yk(e,t,o,n);return $k.sketch(s)},Yk=(e,t,o,n)=>({dom:Xk(o),components:e.toArray().concat([t]),fieldBehaviours:ma(n)}),Xk=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),Kk=(e,t)=>$k.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[ul(t.translate(e))]}),Jk=Bi("form-component-change"),Zk=Bi("form-close"),Qk=Bi("form-cancel"),eC=Bi("form-action"),tC=Bi("form-submit"),oC=Bi("form-block"),nC=Bi("form-unblock"),sC=Bi("form-tabchange"),rC=Bi("form-resize"),aC=(e,t,o)=>{const n=e.label.map((e=>Kk(e,t))),s=t.icons(),r=e=>(t,o)=>{Tl(o.event.target,"[data-collection-item-value]").each((n=>{e(t,o,n,_t(n,"data-collection-item-value"))}))},a=r(((o,n,s,r)=>{n.stop(),t.isDisabled()||zr(o,eC,{name:e.name,value:r})})),i=[Gr(Js(),r(((e,t,o)=>{hc(o)}))),Gr(sr(),a),Gr(br(),a),Gr(Zs(),r(((e,t,o)=>{_l(e.element,"."+yy).each((e=>{Oa(e,yy)})),ka(o,yy)}))),Gr(Qs(),r((e=>{_l(e.element,"."+yy).each((e=>{Oa(e,yy),fc(e)}))}))),na(r(((t,o,n,s)=>{zr(t,eC,{name:e.name,value:s})})))],l=(e,t)=>z(Td(e.element,".tox-collection__item"),t),c=$k.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:w},behaviours:ma([pg.config({disabled:t.isDisabled,onDisabled:e=>{l(e,(e=>{ka(e,"tox-collection__item--state-disabled"),Ct(e,"aria-disabled",!0)}))},onEnabled:e=>{l(e,(e=>{Oa(e,"tox-collection__item--state-disabled"),At(e,"aria-disabled")}))}}),cw(),Ah.config({}),Qb.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{_l(e.element,"."+yy+"[data-mce-tooltip]").each((o=>{Tt(o,"data-mce-tooltip").each((o=>{Qb.setComponents(e,t.tooltips.getComponents({tooltipText:o}))}))}))}}),mode:"children-keyboard-focus",anchor:e=>({type:"node",node:_l(e.element,"."+yy).orThunk((()=>Ze(".tox-collection__item"))),root:e.element,layouts:{onLtr:x([oc,tc,Jl,Ql,Zl,ec]),onRtl:x([oc,tc,Jl,Ql,Zl,ec])},bubble:Gc(0,-2,{})})}),qu.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(o,n)=>{((o,n)=>{const r=z(n,(o=>{const n=Kv.translate(o.text),r=1===e.columns?`${n}
`:"",a=`${(e=>{var t;return null!==(t=s[e])&&void 0!==t?t:e})(o.icon)}
`,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,(e=>i[e]));return`${a}${r}
`})),a="auto"!==e.columns&&e.columns>1?L(r,e.columns):[r],i=z(a,(e=>`${e.join("")}
`));ri(o.element,i.join(""))})(o,n),"auto"===e.columns&&nw(o,5,"tox-collection__item").each((({numRows:e,numColumns:t})=>{xh.setGridSize(o,e,t)})),Lr(o,rC)}}),Ub.config({}),xh.config((d=e.columns,"normal",1===d?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===d?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:".tox-collection__group",cell:`.${my}`}})),Mh("collection-events",i)]),eventOrder:{[hr()]:["disabling","alloy.base.behaviour","collection-events"],[Zs()]:["collection-events","tooltipping"]}});var d;return qk(n,c,["tox-form__group--collection"],[])},iC=["input","textarea"],lC=e=>{const t=Ue(e);return F(iC,t)},cC=(e,t)=>{const o=t.getRoot(e).getOr(e.element);Oa(o,t.invalidClass),t.notify.each((t=>{lC(e.element)&&Ct(e.element,"aria-invalid",!1),t.getContainer(e).each((e=>{ri(e,t.validHtml)})),t.onValid(e)}))},dC=(e,t,o,n)=>{const s=t.getRoot(e).getOr(e.element);ka(s,t.invalidClass),t.notify.each((t=>{lC(e.element)&&Ct(e.element,"aria-invalid",!0),t.getContainer(e).each((e=>{ri(e,n)})),t.onInvalid(e,n)}))},uC=(e,t,o)=>t.validator.fold((()=>ak(dn.value(!0))),(t=>t.validate(e))),mC=(e,t,o)=>(t.notify.each((t=>{t.onValidate(e)})),uC(e,t).map((o=>e.getSystem().isConnected()?o.fold((o=>(dC(e,t,0,o),dn.error(o))),(o=>(cC(e,t),dn.value(o)))):dn.error("No longer in system"))));var gC=Object.freeze({__proto__:null,markValid:cC,markInvalid:dC,query:uC,run:mC,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return _a(o,t.invalidClass)}}),pC=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map((t=>Wr([Gr(t.onEvent,(t=>{mC(t,e).get(w)}))].concat(t.validateOnLoad?[ea((t=>{mC(t,e).get(b)}))]:[])))).getOr({})}),hC=[is("invalidClass"),Cs("getRoot",A.none),ks("notify",[Cs("aria","alert"),Cs("getContainer",A.none),Cs("validHtml",""),xi("onValid"),xi("onInvalid"),xi("onValidate")]),ks("validator",[is("validate"),Cs("onEvent","input"),Cs("validateOnLoad",!0)])];const fC=pa({fields:hC,name:"invalidating",active:pC,apis:gC,extra:{validation:e=>t=>{const o=qu.getValue(t);return ak(e(o))}}}),bC=pa({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Wr([jr(lr(),E)]),exhibit:()=>aa({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),vC=Bi("color-input-change"),yC=Bi("color-swatch-change"),xC=Bi("color-picker-cancel"),wC=km({schema:[is("dom")],name:"label"}),SC=e=>km({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold((()=>({})),(e=>({events:Wr([qr(Ws(),((t,o,n)=>e(t,n)),[t]),qr(qs(),((t,o,n)=>e(t,n)),[t]),qr(Ys(),((t,o,n)=>{n.mouseIsDown.get()&&e(t,n)}),[t])])})))}),kC=SC("top-left"),CC=SC("top"),OC=SC("top-right"),_C=SC("right"),TC=SC("bottom-right"),EC=SC("bottom"),AC=SC("bottom-left"),MC=SC("left"),DC=wm({name:"thumb",defaults:x({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Wr([Xr(Ws(),e,"spectrum"),Xr(js(),e,"spectrum"),Xr($s(),e,"spectrum"),Xr(qs(),e,"spectrum"),Xr(Ys(),e,"spectrum"),Xr(Ks(),e,"spectrum")])})}),BC=e=>Hg(e.event);var IC=[wC,MC,_C,CC,EC,kC,OC,AC,TC,DC,wm({schema:[rs("mouseIsDown",(()=>on(!1)))],name:"spectrum",overrides:e=>{const t=e.model.manager,o=(o,n)=>t.getValueFromEvent(n).map((n=>t.setValueFrom(o,e,n)));return{behaviours:ma([xh.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,BC(n)),onRight:(o,n)=>t.onRight(o,e,BC(n)),onUp:(o,n)=>t.onUp(o,e,BC(n)),onDown:(o,n)=>t.onDown(o,e,BC(n))}),Ub.config({}),Rh.config({})]),events:Wr([Gr(Ws(),o),Gr(js(),o),Gr(qs(),o),Gr(Ys(),((t,n)=>{e.mouseIsDown.get()&&o(t,n)}))])}}})];const FC=x("slider.change.value"),RC=e=>{const t=e.event.raw;if((e=>-1!==e.type.indexOf("touch"))(t)){const e=t;return void 0!==e.touches&&1===e.touches.length?A.some(e.touches[0]).map((e=>qt(e.clientX,e.clientY))):A.none()}{const e=t;return void 0!==e.clientX?A.some(e).map((e=>qt(e.clientX,e.clientY))):A.none()}},NC=e=>e.model.minX,LC=e=>e.model.minY,zC=e=>e.model.minX-1,VC=e=>e.model.minY-1,HC=e=>e.model.maxX,PC=e=>e.model.maxY,UC=e=>e.model.maxX+1,WC=e=>e.model.maxY+1,jC=(e,t,o)=>t(e)-o(e),$C=e=>jC(e,HC,NC),GC=e=>jC(e,PC,LC),qC=e=>$C(e)/2,YC=e=>GC(e)/2,XC=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,KC=e=>e.snapToGrid,JC=e=>e.snapStart,ZC=e=>e.rounded,QC=(e,t)=>void 0!==e[t+"-edge"],eO=e=>QC(e,"left"),tO=e=>QC(e,"right"),oO=e=>QC(e,"top"),nO=e=>QC(e,"bottom"),sO=e=>e.model.value.get(),rO=(e,t)=>({x:e,y:t}),aO=(e,t)=>{zr(e,FC(),{value:t})},iO=(e,t,o,n)=>eo?o:e===t?t-1:Math.max(t,e-n),lO=(e,t,o,n)=>e>o?e:eMath.max(t,Math.min(o,e)),dO=e=>{const{min:t,max:o,range:n,value:s,step:r,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:u,maxBound:m,screenRange:g}=e,p=c?t-1:t,h=d?o+1:o;if(sm)return h;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(s,u,m),c=cO(e/g*n+t,p,h);return a&&c>=t&&c<=o?((e,t,o,n,s)=>s.fold((()=>{const s=e-t,r=Math.round(s/n)*n;return cO(t+r,t-1,o+1)}),(t=>{const s=(e-t)%n,r=Math.round(s/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+r)*n;return Math.max(t,l)})))(c,t,o,r,i):l?Math.round(c):c}},uO=e=>{const{min:t,max:o,range:n,value:s,hasMinEdge:r,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return so?a?i:d:(s-t)/n*l},mO="top",gO="right",pO="bottom",hO="left",fO=e=>e.element.dom.getBoundingClientRect(),bO=(e,t)=>e[t],vO=e=>{const t=fO(e);return bO(t,hO)},yO=e=>{const t=fO(e);return bO(t,gO)},xO=e=>{const t=fO(e);return bO(t,mO)},wO=e=>{const t=fO(e);return bO(t,pO)},SO=e=>{const t=fO(e);return bO(t,"width")},kO=e=>{const t=fO(e);return bO(t,"height")},CO=(e,t,o)=>(e+t)/2-o,OO=(e,t)=>{const o=fO(e),n=fO(t),s=bO(o,hO),r=bO(o,gO),a=bO(n,hO);return CO(s,r,a)},_O=(e,t)=>{const o=fO(e),n=fO(t),s=bO(o,mO),r=bO(o,pO),a=bO(n,mO);return CO(s,r,a)},TO=(e,t)=>{zr(e,FC(),{value:t})},EO=(e,t,o)=>{const n={min:NC(t),max:HC(t),range:$C(t),value:o,step:XC(t),snap:KC(t),snapStart:JC(t),rounded:ZC(t),hasMinEdge:eO(t),hasMaxEdge:tO(t),minBound:vO(e),maxBound:yO(e),screenRange:SO(e)};return dO(n)},AO=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?lO:iO)(sO(o),NC(o),HC(o),XC(o,n));return TO(t,s),A.some(s)})(e,t,o,n).map(E),MO=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=SO(e),a=n.bind((t=>A.some(OO(t,e)))).getOr(0),i=s.bind((t=>A.some(OO(t,e)))).getOr(r),l={min:NC(t),max:HC(t),range:$C(t),value:o,hasMinEdge:eO(t),hasMaxEdge:tO(t),minBound:vO(e),minOffset:0,maxBound:yO(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return uO(l)})(t,r,o,n,s);return vO(t)-vO(e)+a},DO=AO(-1),BO=AO(1),IO=A.none,FO=A.none,RO={"top-left":A.none(),top:A.none(),"top-right":A.none(),right:A.some(((e,t)=>{aO(e,UC(t))})),"bottom-right":A.none(),bottom:A.none(),"bottom-left":A.none(),left:A.some(((e,t)=>{aO(e,zC(t))}))};var NO=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=EO(e,t,o);return TO(e,n),n},setToMin:(e,t)=>{const o=NC(t);TO(e,o)},setToMax:(e,t)=>{const o=HC(t);TO(e,o)},findValueOfOffset:EO,getValueFromEvent:e=>RC(e).map((e=>e.left)),findPositionOfValue:MO,setPositionFromValue:(e,t,o,n)=>{const s=sO(o),r=MO(e,n.getSpectrum(e),s,n.getLeftEdge(e),n.getRightEdge(e),o),a=Zt(t.element)/2;Bt(t.element,"left",r-a+"px")},onLeft:DO,onRight:BO,onUp:IO,onDown:FO,edgeActions:RO});const LO=(e,t)=>{zr(e,FC(),{value:t})},zO=(e,t,o)=>{const n={min:LC(t),max:PC(t),range:GC(t),value:o,step:XC(t),snap:KC(t),snapStart:JC(t),rounded:ZC(t),hasMinEdge:oO(t),hasMaxEdge:nO(t),minBound:xO(e),maxBound:wO(e),screenRange:kO(e)};return dO(n)},VO=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?lO:iO)(sO(o),LC(o),PC(o),XC(o,n));return LO(t,s),A.some(s)})(e,t,o,n).map(E),HO=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=kO(e),a=n.bind((t=>A.some(_O(t,e)))).getOr(0),i=s.bind((t=>A.some(_O(t,e)))).getOr(r),l={min:LC(t),max:PC(t),range:GC(t),value:o,hasMinEdge:oO(t),hasMaxEdge:nO(t),minBound:xO(e),minOffset:0,maxBound:wO(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return uO(l)})(t,r,o,n,s);return xO(t)-xO(e)+a},PO=A.none,UO=A.none,WO=VO(-1),jO=VO(1),$O={"top-left":A.none(),top:A.some(((e,t)=>{aO(e,VC(t))})),"top-right":A.none(),right:A.none(),"bottom-right":A.none(),bottom:A.some(((e,t)=>{aO(e,WC(t))})),"bottom-left":A.none(),left:A.none()};var GO=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=zO(e,t,o);return LO(e,n),n},setToMin:(e,t)=>{const o=LC(t);LO(e,o)},setToMax:(e,t)=>{const o=PC(t);LO(e,o)},findValueOfOffset:zO,getValueFromEvent:e=>RC(e).map((e=>e.top)),findPositionOfValue:HO,setPositionFromValue:(e,t,o,n)=>{const s=sO(o),r=HO(e,n.getSpectrum(e),s,n.getTopEdge(e),n.getBottomEdge(e),o),a=jt(t.element)/2;Bt(t.element,"top",r-a+"px")},onLeft:PO,onRight:UO,onUp:WO,onDown:jO,edgeActions:$O});const qO=(e,t)=>{zr(e,FC(),{value:t})},YO=(e,t)=>({x:e,y:t}),XO=(e,t)=>(o,n,s)=>((e,t,o,n,s)=>{const r=e>0?lO:iO,a=t?sO(n).x:r(sO(n).x,NC(n),HC(n),XC(n,s)),i=t?r(sO(n).y,LC(n),PC(n),XC(n,s)):sO(n).y;return qO(o,YO(a,i)),A.some(a)})(e,t,o,n,s).map(E),KO=XO(-1,!1),JO=XO(1,!1),ZO=XO(-1,!0),QO=XO(1,!0),e_={"top-left":A.some(((e,t)=>{aO(e,rO(zC(t),VC(t)))})),top:A.some(((e,t)=>{aO(e,rO(qC(t),VC(t)))})),"top-right":A.some(((e,t)=>{aO(e,rO(UC(t),VC(t)))})),right:A.some(((e,t)=>{aO(e,rO(UC(t),YC(t)))})),"bottom-right":A.some(((e,t)=>{aO(e,rO(UC(t),WC(t)))})),bottom:A.some(((e,t)=>{aO(e,rO(qC(t),WC(t)))})),"bottom-left":A.some(((e,t)=>{aO(e,rO(zC(t),WC(t)))})),left:A.some(((e,t)=>{aO(e,rO(zC(t),YC(t)))}))};var t_=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=EO(e,t,o.left),s=zO(e,t,o.top),r=YO(n,s);return qO(e,r),r},setToMin:(e,t)=>{const o=NC(t),n=LC(t);qO(e,YO(o,n))},setToMax:(e,t)=>{const o=HC(t),n=PC(t);qO(e,YO(o,n))},getValueFromEvent:e=>RC(e),setPositionFromValue:(e,t,o,n)=>{const s=sO(o),r=MO(e,n.getSpectrum(e),s.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=HO(e,n.getSpectrum(e),s.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Zt(t.element)/2,l=jt(t.element)/2;Bt(t.element,"left",r-i+"px"),Bt(t.element,"top",a-l+"px")},onLeft:KO,onRight:JO,onUp:ZO,onDown:QO,edgeActions:e_});const o_=Km({name:"Slider",configFields:[Cs("stepSize",1),Cs("speedMultiplier",10),Cs("onChange",b),Cs("onChoose",b),Cs("onInit",b),Cs("onDragStart",b),Cs("onDragEnd",b),Cs("snapToGrid",!1),Cs("rounded",!0),fs("snapStart"),ls("model",os("mode",{x:[Cs("minX",0),Cs("maxX",100),rs("value",(e=>on(e.mode.minX))),is("getInitialValue"),Ci("manager",NO)],y:[Cs("minY",0),Cs("maxY",100),rs("value",(e=>on(e.mode.minY))),is("getInitialValue"),Ci("manager",GO)],xy:[Cs("minX",0),Cs("maxX",100),Cs("minY",0),Cs("maxY",100),rs("value",(e=>on({x:e.mode.minX,y:e.mode.minY}))),is("getInitialValue"),Ci("manager",t_)]})),Yu("sliderBehaviours",[xh,qu]),rs("mouseIsDown",(()=>on(!1)))],partFields:IC,factory:(e,t,o,n)=>{const s=t=>Nm(t,e,"thumb"),r=t=>Nm(t,e,"spectrum"),a=t=>Rm(t,e,"left-edge"),i=t=>Rm(t,e,"right-edge"),l=t=>Rm(t,e,"top-edge"),c=t=>Rm(t,e,"bottom-edge"),d=e.model,u=d.manager,m=(t,o)=>{u.setPositionFromValue(t,o,e,{getLeftEdge:a,getRightEdge:i,getTopEdge:l,getBottomEdge:c,getSpectrum:r})},g=(e,t)=>{d.value.set(t);const o=s(e);m(e,o)},p=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&Rm(t,e,"thumb").each((o=>{const n=d.value.get();e.onChoose(t,o,n)}))},h=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,s(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,s(t)),p(t)},b=t=>{Rm(t,e,"spectrum").map(xh.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.sliderBehaviours,[xh.config({mode:"special",focusIn:b}),qu.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),gc.config({channels:{[Mu()]:{onReceive:p}}})]),events:Wr([Gr(FC(),((t,o)=>{((t,o)=>{g(t,o);const n=s(t);e.onChange(t,n,o),A.some(!0)})(t,o.event.value)})),ea(((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=s(t);m(t,a);const i=r(t);e.onInit(t,a,i,d.value.get())})),Gr(Ws(),h),Gr($s(),f),Gr(qs(),((e,t)=>{b(e),h(e,t)})),Gr(Ks(),f)]),apis:{resetToMin:t=>{u.setToMin(t,e)},resetToMax:t=>{u.setToMax(t,e)},setValue:g,refresh:m},domModification:{styles:{position:"relative"}}}},apis:{setValue:(e,t,o)=>{e.setValue(t,o)},resetToMin:(e,t)=>{e.resetToMin(t)},resetToMax:(e,t)=>{e.resetToMax(t)},refresh:(e,t)=>{e.refresh(t)}}}),n_=Bi("rgb-hex-update"),s_=Bi("slider-update"),r_=Bi("palette-update"),a_="form",i_=[Yu("formBehaviours",[qu])],l_=e=>"",c_=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Ku(e.formBehaviours,[qu.config({store:{mode:"manual",getValue:t=>{const o=zm(t,e);return le(o,((e,t)=>e().bind((e=>{return o=eg.getCurrent(e),n=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+ii(e.element)),o.fold((()=>dn.error(n)),dn.value);var o,n})).map(qu.getValue)))},setValue:(t,o)=>{ie(o,((o,n)=>{Rm(t,e,n).each((e=>{eg.getCurrent(e).each((e=>{qu.setValue(e,o)}))}))}))}}})]),apis:{getField:(t,o)=>Rm(t,e,o).bind(eg.getCurrent)}}),d_={getField:Gi(((e,t,o)=>e.getField(t,o))),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),Mm(a_,l_(t),o)),record:x(e)}})(),o=e(t),n=t.record(),s=z(n,(e=>wm({name:e,pname:l_(e)})));return $m(a_,i_,s,c_,o)}},u_=Bi("valid-input"),m_=Bi("invalid-input"),g_=Bi("validating-input"),p_="colorcustom.rgb.",h_=(e,t,o,n)=>{const s=(o,n)=>fC.config({invalidClass:t("invalid"),notify:{onValidate:e=>{zr(e,g_,{type:o})},onValid:e=>{zr(e,u_,{type:o,value:qu.getValue(e)})},onInvalid:e=>{zr(e,m_,{type:o,value:qu.getValue(e)})}},validator:{validate:t=>{const o=qu.getValue(t),s=n(o)?dn.value(!0):dn.error(e("aria.input.invalid"));return ak(s)},validateOnLoad:!1}}),r=(o,n,r,a,i)=>{const l=e(p_+"range"),c=$k.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[ul(r)]}),d=$k.parts.field({data:i,factory:Iy,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:ma([s(n,o),Ub.config({})]),onSetValue:e=>{fC.isInvalid(e)&&fC.run(e).get(b)}}),u=[c,d],m="hex"!==n?[$k.parts["aria-descriptor"]({text:l})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:u.concat(m)}},a=(e,t)=>{const o=t.red,n=t.green,s=t.blue;qu.setValue(e,{red:o,green:n,blue:s})},i=Vb({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=(e,t)=>{i.getOpt(e).each((e=>{Bt(e.element,"background-color","#"+t.value)}))},c=Xm({factory:()=>{const s={red:on(A.some(255)),green:on(A.some(255)),blue:on(A.some(255)),hex:on(A.some("ffffff"))},c=e=>s[e].get(),d=(e,t)=>{s[e].set(t)},u=e=>{const t=e.red,o=e.green,n=e.blue;d("red",A.some(t)),d("green",A.some(o)),d("blue",A.some(n))},m=(e,t)=>{const o=t.event;"hex"!==o.type?d(o.type,A.none()):n(e)},g=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=Fw(t);d("hex",A.some(n.value));const s=Xw(n);a(e,s),u(s),zr(e,n_,{hex:n}),l(e,n)})(e,n.value):((e,t,o)=>{const n=parseInt(o,10);d(t,A.some(n)),c("red").bind((e=>c("green").bind((t=>c("blue").map((o=>Gw(e,t,o,1))))))).each((t=>{const o=((e,t)=>{const o=Hw(t);return d_.getField(e,"hex").each((t=>{Rh.isFocused(t)||qu.setValue(e,{hex:o.value})})),o})(e,t);zr(e,n_,{hex:o}),l(e,o)}))})(e,n.type,n.value)},p=t=>({label:e(p_+t+".label"),description:e(p_+t+".description")}),h=p("red"),f=p("green"),b=p("blue"),v=p("hex");return wn(d_.sketch((o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",$k.sketch(r(qw,"red",h.label,h.description,255))),o.field("green",$k.sketch(r(qw,"green",f.label,f.description,255))),o.field("blue",$k.sketch(r(qw,"blue",b.label,b.description,255))),o.field("hex",$k.sketch(r(Lw,"hex",v.label,v.description,"ffffff"))),i.asSpec()],formBehaviours:ma([fC.config({invalidClass:t("form-invalid")}),Mh("rgb-form-events",[Gr(u_,g),Gr(m_,m),Gr(g_,m)])])}))),{apis:{updateHex:(e,t)=>{qu.setValue(e,{hex:t.value}),((e,t)=>{const o=Xw(t);a(e,o),u(o)})(e,t),l(e,t)}}})},name:"RgbForm",configFields:[],apis:{updateHex:(e,t,o)=>{e.updateHex(t,o)}},extraApis:{}});return c},f_=(e,t)=>{const o=Xm({name:"ColourPicker",configFields:[is("dom"),Cs("onValidHex",b),Cs("onInvalidHex",b)],factory:o=>{const n=h_(e,t,o.onValidHex,o.onInvalidHex),s=((e,t)=>{const o=o_.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=o_.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:``}}),s=(e,t)=>{const{width:o,height:n}=e,s=e.getContext("2d");if(null===s)return;s.fillStyle=t,s.fillRect(0,0,o,n);const r=s.createLinearGradient(0,0,o,0);r.addColorStop(0,"rgba(255,255,255,1)"),r.addColorStop(1,"rgba(255,255,255,0)"),s.fillStyle=r,s.fillRect(0,0,o,n);const a=s.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),s.fillStyle=a,s.fillRect(0,0,o,n)};return Xm({factory:r=>{const a=x({x:0,y:0}),i=ma([eg.config({find:A.some}),Rh.config({})]);return o_.sketch({dom:{tag:"div",attributes:{role:"slider","aria-valuetext":e(["Saturation {0}%, Brightness {1}%",0,0])},classes:[t("sv-palette")]},model:{mode:"xy",getInitialValue:a},rounded:!1,components:[o,n],onChange:(t,o,n)=>{h(n)||Ct(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),zr(t,r_,{value:n})},onInit:(e,t,o,n)=>{s(o.element.dom,Zw(Qw))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=gS(t,100,100),r=Yw(n);s(o,Zw(r))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=pS(Xw(o));o_.setValue(t,{x:n.saturation,y:100-n.value}),Ct(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}})})(e,t),r={paletteRgba:on(Qw),paletteHue:on(0)},a=Vb(((e,t)=>{const o=o_.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=o_.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return o_.sketch({dom:{tag:"div",classes:[t("hue-slider")],attributes:{role:"slider","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":120}},rounded:!1,model:{mode:"y",getInitialValue:x(0)},components:[o,n],sliderBehaviours:ma([Rh.config({})]),onChange:(e,t,o)=>{Ct(e.element,"aria-valuenow",Math.floor(360-3.6*o)),zr(e,s_,{value:o})}})})(0,t)),i=Vb(s.sketch({})),l=Vb(n.sketch({})),c=(e,t,o)=>{i.getOpt(e).each((e=>{s.setHue(e,o)}))},d=(e,t)=>{l.getOpt(e).each((e=>{n.updateHex(e,t)}))},u=(e,t,o)=>{a.getOpt(e).each((e=>{o_.setValue(e,(e=>100-e/360*100)(o))}))},m=(e,t)=>{i.getOpt(e).each((e=>{s.setThumb(e,t)}))},g=(e,t,o,n)=>{((e,t)=>{const o=Xw(e);r.paletteRgba.set(o),r.paletteHue.set(t)})(t,o),V(n,(n=>{n(e,t,o)}))};return{uid:o.uid,dom:o.dom,components:[i.asSpec(),a.asSpec(),l.asSpec()],behaviours:ma([Mh("colour-picker-events",[Gr(n_,(()=>{const e=[c,u,m];return(t,o)=>{const n=o.event.hex,s=(e=>pS(Xw(e)))(n);g(t,n,s.hue,e)}})()),Gr(r_,(()=>{const e=[d];return(t,o)=>{const n=o.event.value,s=r.paletteHue.get(),a=gS(s,n.x,100-n.y),i=hS(a);g(t,i,s,e)}})()),Gr(s_,(()=>{const e=[c,d];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),s=r.paletteRgba.get(),a=pS(s),i=gS(n,a.saturation,a.value),l=hS(i);g(t,l,n,e)}})())]),eg.config({find:e=>l.getOpt(e)}),xh.config({mode:"acyclic"})])}}});return o},b_=()=>eg.config({find:A.some}),v_=e=>eg.config({find:t=>ct(t.element,e).bind((e=>t.getSystem().getByDom(e).toOptional()))}),y_=Nn([Cs("preprocess",w),Cs("postprocess",w)]),x_=(e,t)=>{const o=es("RepresentingConfigs.memento processors",y_,t);return qu.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),s=qu.getValue(n);return o.postprocess(s)},setValue:(t,n)=>{const s=o.preprocess(n),r=e.get(t);qu.setValue(r,s)}}})},w_=(e,t,o)=>qu.config({store:{mode:"manual",...e.map((e=>({initialValue:e}))).getOr({}),getValue:t,setValue:o}}),S_=(e,t,o)=>w_(e,(e=>t(e.element)),((e,t)=>o(e.element,t))),k_=e=>qu.config({store:{mode:"memory",initialValue:e}}),C_={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"};var O_=tinymce.util.Tools.resolve("tinymce.Resource");const __=e=>be(e,"init");var T_=tinymce.util.Tools.resolve("tinymce.util.Tools");const E_=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...s)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,s)}),t)}}},A_=Bi("alloy-fake-before-tabstop"),M_=Bi("alloy-fake-after-tabstop"),D_=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:ma([Rh.config({ignore:!0}),Ub.config({})])}),B_=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[D_([A_]),t,D_([M_])],behaviours:ma([v_(1)])}),I_=(e,t)=>{zr(e,er(),{raw:{which:9,shiftKey:t}})},F_=(e,t)=>{const o=t.element;_a(o,A_)?I_(e,!0):_a(o,M_)&&I_(e,!1)},R_=e=>Dk(e,["."+A_,"."+M_].join(","),T),N_=Bi("update-dialog"),L_=Bi("update-title"),z_=Bi("update-body"),V_=Bi("update-footer"),H_=Bi("body-send-message"),P_=Bi("dialog-focus-shifted"),U_=Bo().browser,W_=U_.isSafari(),j_=U_.isFirefox(),$_=W_||j_,G_=U_.isChromium(),q_=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,Y_=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),X_=(e,t,o)=>{const n=e.dom;A.from(n.contentDocument).fold(o,(e=>{let o=0;const s=((e,t)=>{const o=e.body;return A.from(!/^1))?o:e.documentElement)})(e,t).map((e=>(o=e.scrollTop,e))).forall(q_),r=()=>{const e=n.contentWindow;g(e)&&(s?Y_(e,"bottom"):!s&&$_&&0!==o&&Y_(e,o))};W_&&n.addEventListener("load",r,{once:!0}),e.open(),e.write(t),e.close(),W_||r()}))},K_=ke($_,W_?500:200).map((e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...s)=>{n=s,c(o)&&(o=setTimeout((()=>{const t=n;o=null,n=null,e.apply(null,t)}),t))}}})(X_,e))),J_=Bi("toolbar.button.execute"),Z_=Bi("common-button-display-events"),Q_={[hr()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[_r()]:["toolbar-button-events",Z_],[Tr()]:["toolbar-button-events","dropdown-events","tooltipping"],[qs()]:["focusing","alloy.base.behaviour",Z_]},eT=e=>Bt(e.element,"width",Rt(e.element,"width")),tT=(e,t,o)=>ry(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),oT=(e,t)=>tT(e,t,[]),nT=(e,t)=>tT(e,t,[Ah.config({})]),sT=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[ul(o.translate(e))],behaviours:ma([Ah.config({})])}),rT=Bi("update-menu-text"),aT=Bi("update-menu-icon"),iT=(e,t,o,n)=>{const s=on(b),r=e.text.map((e=>Vb(sT(e,t,o.providers)))),a=e.icon.map((e=>Vb(nT(e,o.providers.icons)))),i=(e,t)=>{const o=qu.getValue(e);return Rh.focus(o),zr(o,"keydown",{raw:t.event.raw}),xk.close(o),A.some(!0)},l=e.role.fold((()=>({})),(e=>({role:e}))),c=e.ariaLabel.fold((()=>({})),(e=>({"aria-label":o.providers.translate(e)}))),d=ry("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),u=Bi("common-button-display-events"),m="dropdown-events",p=Vb(xk.sketch({...e.uid?{uid:e.uid}:{},...l,dom:{tag:"button",classes:[t,`${t}--select`].concat(z(e.classes,(e=>`${t}--${e}`))),attributes:{...c,...g(n)?{"data-mce-name":n}:{}}},components:vw([a.map((e=>e.asSpec())),r.map((e=>e.asSpec())),A.some(d)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{zy(e).each((e=>Rh.focus(e)))})(n)},dropdownBehaviours:ma([...e.dropdownBehaviours,dw((()=>e.disabled||o.providers.isDisabled())),cw(),bC.config({}),Ah.config({}),...e.tooltip.map((e=>Qb.config(o.providers.tooltips.getConfig({tooltipText:o.providers.translate(e)})))).toArray(),Mh(m,[pw(e,s),hw(e,s)]),Mh(u,[ea(((e,t)=>eT(e)))]),Mh("menubutton-update-display-text",[Gr(rT,((e,t)=>{r.bind((t=>t.getOpt(e))).each((e=>{Ah.set(e,[ul(o.providers.translate(t.event.text))])}))})),Gr(aT,((e,t)=>{a.bind((t=>t.getOpt(e))).each((e=>{Ah.set(e,[nT(t.event.icon,o.providers.icons)])}))}))])]),eventOrder:wn(Q_,{[qs()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[_r()]:["toolbar-button-events",Qb.name(),m,u]}),sandboxBehaviours:ma([xh.config({mode:"special",onLeft:i,onRight:i}),Mh("dropdown-sandbox-events",[Gr(Fy,((e,t)=>{(e=>{const t=qu.getValue(e),o=Ly(e).map(Vy);xk.refetch(t).get((()=>{const e=ek.getCoupled(t,"sandbox");o.each((t=>Ly(e).each((e=>((e,t)=>{qu.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))))}))})(e),t.stop()})),Gr(Ry,((e,t)=>{((e,t)=>{(e=>Tu.getState(e).bind(Cg.getHighlighted).bind(Cg.getHighlighted))(e).each((o=>{((e,t,o,n)=>{const s={...n,target:t};e.getSystem().triggerEvent(o,t,s)})(e,o.element,t.event.eventType,t.event.interactionEvent)}))})(e,t),t.stop()}))])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...Ey(0,e.columns,e.presets),fakeFocus:e.searchable,onHighlightItem:wk,onCollapseMenu:(e,t,o)=>{Cg.getHighlighted(o).each((t=>{wk(e,o,t)}))},onDehighlightItem:Sk}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{Pc()(e,t-10)}}),fetch:t=>rk(k(e.fetch,t))}));return p.asSpec()},lT=e=>"separator"===e.type,cT={type:"separator"},dT=(e,t)=>{const o=((e,t)=>{const o=W(e,((e,o)=>(e=>r(e))(o)?""===o?e:"|"===o?e.length>0&&!lT(e[e.length-1])?e.concat([cT]):e:be(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o])),[]);return o.length>0&&lT(o[o.length-1])&&o.pop(),o})(r(e)?e.split(" "):e,t);return U(o,((e,o)=>{if((e=>be(e,"getSubmenuItems"))(o)){const n=(e=>{const t=fe(e,"value").getOrThunk((()=>Bi("generated-menu-item")));return wn({value:t},e)})(o),s=((e,t)=>{const o=e.getSubmenuItems(),n=dT(o,t);return{item:e,menus:wn(n.menus,{[e.value]:n.items}),expansions:wn(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:wn(e.menus,s.menus),items:[s.item,...e.items],expansions:wn(e.expansions,s.expansions)}}return{...e,items:[o,...e.items]}}),{menus:{},expansions:{},items:[]})},uT=(e,t,o,n)=>{const s=Bi("primary-menu"),r=dT(e,o.shared.providers.menuItems());if(0===r.items.length)return A.none();const a=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-field",placeholder:e.placeholder}))))(n),i=Tk(s,r.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-results"}))))(n),c=le(r.menus,((e,n)=>Tk(n,e,t,o,!1,l))),d=wn(c,Fs(s,i));return A.from(xf.tieredData(s,d,r.expansions))},mT=e=>!be(e,"items"),gT="data-value",pT=(e,t,o,n)=>z(o,(o=>mT(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{qu.setValue(e,o.value),zr(e,Jk,{name:t}),Rh.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>pT(e,t,o.items,n)})),hT=(e,t)=>se(e,(e=>mT(e)?ke(e.value===t,e):hT(e.items,t))),fT=Xm({name:"HtmlSelect",configFields:[is("options"),Yu("selectBehaviours",[Rh,qu]),Cs("selectClasses",[]),Cs("selectAttributes",{}),fs("data")],factory:(e,t)=>{const o=z(e.options,(e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}}))),n=e.data.map((e=>Fs("initialValue",e))).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:Ku(e.selectBehaviours,[Rh.config({}),qu.config({store:{mode:"manual",getValue:e=>ol(e.element),setValue:(t,o)=>{const n=te(e.options);j(e.options,(e=>e.value===o)).isSome()?nl(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each((e=>nl(t.element,e.value)))},...n}})])}}}),bT=x([Cs("field1Name","field1"),Cs("field2Name","field2"),Si("onLockedChange"),vi(["lockClass"]),Cs("locked",!1),Ju("coupledFieldBehaviours",[eg,qu])]),vT=(e,t)=>wm({factory:$k,name:e,overrides:e=>({fieldBehaviours:ma([Mh("coupled-input-behaviour",[Gr(or(),(o=>{((e,t,o)=>Rm(e,t,o).bind(eg.getCurrent))(o,e,t).each((t=>{Rm(o,e,"lock").each((n=>{Wh.isOn(n)&&e.onLockedChange(o,t,n)}))}))}))])])})}),yT=x([vT("field1","field2"),vT("field2","field1"),wm({factory:Lb,schema:[is("dom")],name:"lock",overrides:e=>({buttonBehaviours:ma([Wh.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),xT=Km({name:"FormCoupledInputs",configFields:bT(),partFields:yT(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Zu(e.coupledFieldBehaviours,[eg.config({find:A.some}),qu.config({store:{mode:"manual",getValue:t=>{const o=Hm(t,e,["field1","field2"]);return{[e.field1Name]:qu.getValue(o.field1()),[e.field2Name]:qu.getValue(o.field2())}},setValue:(t,o)=>{const n=Hm(t,e,["field1","field2"]);ve(o,e.field1Name)&&qu.setValue(n.field1(),o[e.field1Name]),ve(o,e.field2Name)&&qu.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>Rm(t,e,"field1"),getField2:t=>Rm(t,e,"field2"),getLock:t=>Rm(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),wT=e=>{const t=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(e);if(null!==t){const e=parseFloat(t[1]),o=t[2];return dn.value({value:e,unit:o})}return dn.error(e)},ST=(e,t)=>{const o={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},n=e=>be(o,e);return e.unit===t?A.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?A.some(e.value):A.some(e.value/o[e.unit]*o[t]):A.none()},kT=e=>A.none(),CT=(e,t)=>{const o=e.label.map((e=>Kk(e,t))),n=[pg.config({disabled:()=>e.disabled||t.isDisabled()}),cw(),xh.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Lr(e,tC),A.some(!0))}),Mh("textfield-change",[Gr(or(),((t,o)=>{zr(t,Jk,{name:e.name})})),Gr(gr(),((t,o)=>{zr(t,Jk,{name:e.name})}))]),Ub.config({})],s=e.validation.map((e=>fC.config({getRoot:e=>at(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=qu.getValue(t),n=e.validator(o);return ak(!0===n?dn.value(o):dn.error(n))},validateOnLoad:e.validateOnLoad}}))).toArray(),r={...e.placeholder.fold(x({}),(e=>({placeholder:t.translate(e)}))),...e.inputMode.fold(x({}),(e=>({inputmode:e})))},a=$k.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map((e=>({data:e}))).getOr({}),inputAttributes:r,inputClasses:[e.classname],inputBehaviours:ma(G([n,s])),selectOnFocus:!1,factory:Iy}),i=e.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[a]}:a,l=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),c=[pg.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{$k.getField(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable)}}),cw()];return qk(o,i,l,c)},OT=(e,t)=>t.getAnimationRoot.fold((()=>e.element),(t=>t(e))),_T=e=>e.dimension.property,TT=(e,t)=>e.dimension.getDimension(t),ET=(e,t)=>{const o=OT(e,t);Ea(o,[t.shrinkingClass,t.growingClass])},AT=(e,t)=>{Oa(e.element,t.openClass),ka(e.element,t.closedClass),Bt(e.element,_T(t),"0px"),Pt(e.element)},MT=(e,t)=>{Oa(e.element,t.closedClass),ka(e.element,t.openClass),Ht(e.element,_T(t))},DT=(e,t,o,n)=>{o.setCollapsed(),Bt(e.element,_T(t),TT(t,e.element)),ET(e,t),AT(e,t),t.onStartShrink(e),t.onShrunk(e)},BT=(e,t,o,n)=>{const s=n.getOrThunk((()=>TT(t,e.element)));o.setCollapsed(),Bt(e.element,_T(t),s),Pt(e.element);const r=OT(e,t);Oa(r,t.growingClass),ka(r,t.shrinkingClass),AT(e,t),t.onStartShrink(e)},IT=(e,t,o)=>{const n=TT(t,e.element);("0px"===n?DT:BT)(e,t,o,A.some(n))},FT=(e,t,o)=>{const n=OT(e,t),s=_a(n,t.shrinkingClass),r=TT(t,e.element);MT(e,t);const a=TT(t,e.element);(s?()=>{Bt(e.element,_T(t),r),Pt(e.element)}:()=>{AT(e,t)})(),Oa(n,t.shrinkingClass),ka(n,t.growingClass),MT(e,t),Bt(e.element,_T(t),a),o.setExpanded(),t.onStartGrow(e)},RT=(e,t,o)=>{const n=OT(e,t);return!0===_a(n,t.growingClass)},NT=(e,t,o)=>{const n=OT(e,t);return!0===_a(n,t.shrinkingClass)};var LT=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){Ht(e.element,_T(t));const o=TT(t,e.element);Bt(e.element,_T(t),o)}},grow:(e,t,o)=>{o.isExpanded()||FT(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&IT(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&DT(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:RT,isShrinking:NT,isTransitioning:(e,t,o)=>RT(e,t)||NT(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?IT:FT)(e,t,o)},disableTransitions:ET,immediateGrow:(e,t,o)=>{o.isExpanded()||(MT(e,t),Bt(e.element,_T(t),TT(t,e.element)),ET(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}}),zT=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return aa(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:Fs(t.dimension.property,"0px")})},events:(e,t)=>Wr([Qr(ar(),((o,n)=>{n.event.raw.propertyName===e.dimension.property&&(ET(o,e),t.isExpanded()&&Ht(o.element,e.dimension.property),(t.isExpanded()?e.onGrown:e.onShrunk)(o))}))])}),VT=[is("closedClass"),is("openClass"),is("shrinkingClass"),is("growingClass"),fs("getAnimationRoot"),xi("onShrunk"),xi("onStartShrink"),xi("onGrown"),xi("onStartGrow"),Cs("expanded",!1),ls("dimension",os("property",{width:[Ci("property","width"),Ci("getDimension",(e=>Zt(e)+"px"))],height:[Ci("property","height"),Ci("getDimension",(e=>jt(e)+"px"))]}))];const HT=pa({fields:VT,name:"sliding",active:zT,apis:LT,state:Object.freeze({__proto__:null,init:e=>{const t=on(e.expanded);return ua({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:k(t.set,!1),setExpanded:k(t.set,!0),readState:()=>"expanded: "+t.get()})}})}),PT=e=>({isEnabled:()=>!pg.isDisabled(e),setEnabled:t=>pg.set(e,!t),setActive:t=>{const o=e.element;t?(ka(o,"tox-tbtn--enabled"),Ct(o,"aria-pressed",!0)):(Oa(o,"tox-tbtn--enabled"),At(o,"aria-pressed"))},isActive:()=>_a(e.element,"tox-tbtn--enabled"),setText:t=>{zr(e,rT,{text:t})},setIcon:t=>zr(e,aT,{icon:t})}),UT=(e,t,o,n,s=!0,r)=>iT({text:e.text,icon:e.icon,tooltip:e.tooltip,ariaLabel:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const s={pattern:e.search.isSome()?kk(t):""};e.fetch((t=>{n(uT(t,dy.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))}),s,PT(t))},onSetup:e.onSetup,getApi:PT,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...s?[Ub.config({})]:[]]},t,o.shared,r),WT=(e,t,o)=>{const n=e=>n=>{const s=!n.isActive();n.setActive(s),e.storage.set(s),o.shared.getSink().each((o=>{t().getOpt(o).each((t=>{hc(t.element),zr(t,eC,{name:e.name,value:e.storage.get()})}))}))},s=e=>t=>{t.setActive(e.storage.get())};return t=>{t(z(e,(e=>{const t=e.text.fold((()=>({})),(e=>({text:e})));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:s(e)}})))}},jT=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":e}},components:[ul(e)]}),$T=Bi("leaf-label-event-id"),GT=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:s,backstage:r})=>{const a=e.menu.map((e=>UT(e,"tox-mbtn",r,A.none(),o))),i=[jT(e.title)];return a.each((e=>i.push(e))),Lb.sketch({dom:{tag:"div",classes:["tox-tree--leaf__label","tox-trbtn"].concat(o?["tox-tree--leaf__label--visible"]:[])},components:i,role:"treeitem",action:o=>{t(e.id),o.getSystem().broadcastOn([`update-active-item-${n}`],{value:e.id})},eventOrder:{[er()]:[$T,"keying"]},buttonBehaviours:ma([...o?[Ub.config({})]:[],Wh.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),gc.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?Wh.on:Wh.off)(t)}}}}),Mh($T,[ea(((t,o)=>{s.each((o=>{(o===e.id?Wh.on:Wh.off)(t)}))})),Gr(er(),((e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(kl(e.element,".tox-tree--directory").each((t=>{e.getSystem().getByDom(t).each((e=>{Ol(t,".tox-tree--directory__label").each((t=>{e.getSystem().getByDom(t).each(Rh.focus)}))}))})),t.stop()):n&&t.stop()}))])])})},qT=Bi("directory-label-event-id"),YT=({directory:e,visible:t,noChildren:o,backstage:n})=>{const s=e.menu.map((e=>UT(e,"tox-mbtn",n,A.none()))),r=[{dom:{tag:"div",classes:["tox-chevron"]},components:[(a="chevron-right",i=n.shared.providers.icons,((e,t,o)=>ry(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:[]},t))(a,i))]},jT(e.title)];var a,i;s.each((e=>{r.push(e)}));const l=t=>{kl(t.element,".tox-tree--directory").each((o=>{t.getSystem().getByDom(o).each((o=>{const n=!Wh.isOn(o);Wh.toggle(o),zr(t,"expand-tree-node",{expanded:n,node:e.id})}))}))};return Lb.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:r,action:l,eventOrder:{[er()]:[qT,"keying"]},buttonBehaviours:ma([...t?[Ub.config({})]:[],Mh(qT,[Gr(er(),((e,t)=>{const n="ArrowRight"===t.event.raw.code,s="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||s)&&kl(e.element,".tox-tree--directory").each((o=>{e.getSystem().getByDom(o).each((o=>{!Wh.isOn(o)&&n||Wh.isOn(o)&&s?(l(e),t.stop()):s&&!Wh.isOn(o)&&(kl(o.element,".tox-tree--directory").each((e=>{Ol(e,".tox-tree--directory__label").each((e=>{o.getSystem().getByDom(e).each(Rh.focus)}))})),t.stop())}))}))}))])])})},XT=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:s,selectedId:r,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map((e=>"leaf"===e.type?GT({leaf:e,selectedId:r,onLeafAction:t,visible:o,treeId:n,backstage:a}):JT({directory:e,expandedIds:s,selectedId:r,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a}))),behaviours:ma([HT.config({dimension:{property:"height"},closedClass:"tox-tree--directory__children--closed",openClass:"tox-tree--directory__children--open",growingClass:"tox-tree--directory__children--growing",shrinkingClass:"tox-tree--directory__children--shrinking",expanded:o}),Ah.config({})])}),KT=Bi("directory-event-id"),JT=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:s,expandedIds:r,selectedId:a})=>{const{children:i}=e,l=on(r),c=r.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[YT({directory:e,visible:o,noChildren:0===e.children.length,backstage:s}),XT({children:i,expandedIds:r,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:s})],behaviours:ma([Mh(KT,[ea(((e,t)=>{Wh.set(e,c)})),Gr("expand-tree-node",((e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter((e=>e!==n)))}))]),Wh.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const r=e.components()[1],c=(d=o,i.map((e=>"leaf"===e.type?GT({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:s}):JT({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:s}))));var d;o?HT.grow(r):HT.shrink(r),Ah.set(r,c)}})])}},ZT=Bi("tree-event-id");var QT=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Wr([Gr(e.event,o),ta((()=>t.cancel()))].concat(e.cancelEvent.map((e=>[Gr(e,(()=>t.cancel()))])).getOr([])))}});const eE=e=>{const t=on(null);return ua({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var tE=Object.freeze({__proto__:null,throttle:eE,init:e=>e.stream.streams.state(e)}),oE=[ls("stream",os("mode",{throttle:[is("delay"),Cs("stopEvent",!0),Ci("streams",{setup:(e,t)=>{const o=e.stream,n=E_(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:eE})]})),Cs("event","input"),fs("cancelEvent"),Si("onStream")];const nE=pa({fields:oE,name:"streaming",active:QT,state:tE}),sE=(e,t,o)=>{const n=qu.getValue(o);qu.setValue(t,n),aE(t)},rE=(e,t)=>{const o=e.element,n=ol(o),s=o.dom;"number"!==_t(o,"type")&&t(s,n)},aE=e=>{rE(e,((e,t)=>e.setSelectionRange(t.length,t.length)))},iE=x("alloy.typeahead.itemexecute"),lE=x([fs("lazySink"),is("fetch"),Cs("minChars",5),Cs("responseTime",1e3),xi("onOpen"),Cs("getHotspot",A.some),Cs("getAnchorOverrides",x({})),Cs("layouts",A.none()),Cs("eventOrder",{}),Bs("model",{},[Cs("getDisplayText",(e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value)),Cs("selectsOver",!0),Cs("populateFromBrowse",!0)]),xi("onSetValue"),wi("onExecute"),xi("onItemExecute"),Cs("inputClasses",[]),Cs("inputAttributes",{}),Cs("inputStyles",{}),Cs("matchWidth",!0),Cs("useMinWidth",!1),Cs("dismissOnBlur",!0),vi(["openClass"]),fs("initialData"),Yu("typeaheadBehaviours",[Rh,qu,nE,xh,Wh,ek]),rs("lazyTypeaheadComp",(()=>on(A.none))),rs("previewing",(()=>on(!0)))].concat(Ay()).concat(bk())),cE=x([Sm({schema:[bi()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each((t=>{((e,t,o)=>{if(e.selectsOver){const n=qu.getValue(t),s=e.getDisplayText(n),r=qu.getValue(o);return 0===e.getDisplayText(r).indexOf(s)?A.some((()=>{sE(0,t,o),((e,t)=>{rE(e,((e,o)=>e.setSelectionRange(t,o.length)))})(t,s.length)})):A.none()}return A.none()})(e.model,t,n).fold((()=>{e.model.selectsOver?(Cg.dehighlight(o,n),e.previewing.set(!0)):e.previewing.set(!1)}),(t=>{t(),e.previewing.set(!1)}))})):e.lazyTypeaheadComp.get().each((t=>{e.model.populateFromBrowse&&sE(e.model,t,n),Tt(n.element,"id").each((e=>Ct(t.element,"aria-activedescendant",e)))}))},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map((e=>(zr(e,iE(),{item:o}),!0))),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each((t=>{e.model.populateFromBrowse&&sE(e.model,t,o)}))}})})]),dE=Km({name:"Typeahead",configFields:lE(),partFields:cE(),factory:(e,t,o,n)=>{const s=(t,o,s)=>{e.previewing.set(!1);const r=ek.getCoupled(t,"sandbox");if(Tu.isOpen(r))eg.getCurrent(r).each((e=>{Cg.getHighlighted(e).fold((()=>{s(e)}),(()=>{Ur(r,e.element,"keydown",o)}))}));else{const o=e=>{eg.getCurrent(e).each(s)};dk(e,a(t),t,r,n,o,vf.HighlightMenuAndItem).get(b)}},r=My(e),a=e=>t=>t.map((t=>{const o=he(t.menus),n=q(o,(e=>P(e.items,(e=>"item"===e.type))));return qu.getState(e).update(z(n,(e=>e.data))),t})),i=e=>eg.getCurrent(e),l="typeaheadevents",c=[Rh.config({}),qu.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>ol(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{nl(t.element,e.model.getDisplayText(o))},...e.initialData.map((e=>Fs("initialValue",e))).getOr({})}}),nE.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const s=ek.getCoupled(t,"sandbox");if(Rh.isFocused(t)&&ol(t.element).length>=e.minChars){const o=i(s).bind((e=>Cg.getHighlighted(e).map(qu.getValue)));e.previewing.set(!0);const r=t=>{i(s).each((t=>{o.fold((()=>{e.model.selectsOver&&Cg.highlightFirst(t)}),(e=>{Cg.highlightBy(t,(t=>qu.getValue(t).value===e.value)),Cg.getHighlighted(t).orThunk((()=>(Cg.highlightFirst(t),A.none())))}))}))};dk(e,a(t),t,s,n,r,vf.HighlightJustMenu).get(b)}},cancelEvent:xr()}),xh.config({mode:"special",onDown:(e,t)=>(s(e,t,Cg.highlightFirst),A.some(!0)),onEscape:e=>{const t=ek.getCoupled(e,"sandbox");return Tu.isOpen(t)?(Tu.close(t),A.some(!0)):A.none()},onUp:(e,t)=>(s(e,t,Cg.highlightLast),A.some(!0)),onEnter:t=>{const o=ek.getCoupled(t,"sandbox"),n=Tu.isOpen(o);if(n&&!e.previewing.get())return i(o).bind((e=>Cg.getHighlighted(e))).map((e=>(zr(t,iE(),{item:e}),!0)));{const s=qu.getValue(t);return Lr(t,xr()),e.onExecute(o,t,s),n&&Tu.close(o),A.some(!0)}}}),Wh.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),ek.config({others:{sandbox:t=>hk(e,t,{onOpen:()=>Wh.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each((e=>At(e.element,"aria-activedescendant"))),Wh.off(t)}})}}),Mh(l,[ea((t=>{e.lazyTypeaheadComp.set(A.some(t))})),ta((t=>{e.lazyTypeaheadComp.set(A.none())})),na((t=>{const o=b;mk(e,a(t),t,n,o,vf.HighlightMenuAndItem).get(b)})),Gr(iE(),((t,o)=>{const n=ek.getCoupled(t,"sandbox");sE(e.model,t,o.event.item),Lr(t,xr()),e.onItemExecute(t,n,o.event.item,qu.getValue(t)),Tu.close(n),aE(t)}))].concat(e.dismissOnBlur?[Gr(mr(),(e=>{const t=ek.getCoupled(e,"sandbox");yc(t.element).isNone()&&Tu.close(t)}))]:[]))],d={[Tr()]:[qu.name(),nE.name(),l],...e.eventOrder};return{uid:e.uid,dom:By(wn(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...r,...Ku(e.typeaheadBehaviours,c)},eventOrder:d}}}),uE=e=>({...e,toCached:()=>uE(e.toCached()),bindFuture:t=>uE(e.bind((e=>e.fold((e=>ak(dn.error(e))),(e=>t(e)))))),bindResult:t=>uE(e.map((e=>e.bind(t)))),mapResult:t=>uE(e.map((e=>e.map(t)))),mapError:t=>uE(e.map((e=>e.mapError(t)))),foldResult:(t,o)=>e.map((e=>e.fold(t,o))),withTimeout:(t,o)=>uE(rk((n=>{let s=!1;const r=setTimeout((()=>{s=!0,n(dn.error(o()))}),t);e.get((e=>{s||(clearTimeout(r),n(e))}))})))}),mE=e=>uE(rk(e)),gE=(e,t,o=[],n,s,r,a)=>{const i=t.fold((()=>({})),(e=>({action:e}))),l={buttonBehaviours:ma([dw((()=>!e.enabled||a.isDisabled())),cw(),Ub.config({}),...r.map((e=>Qb.config(a.tooltips.getConfig({tooltipText:a.translate(e)})))).toArray(),Mh("button press",[$r("click"),$r("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...i},c=wn(l,{dom:n});return wn(c,{components:s})},pE=(e,t,o,n=[],s)=>{const r={tag:"button",classes:["tox-tbtn"],attributes:{...e.tooltip.map((e=>({"aria-label":o.translate(e)}))).getOr({}),"data-mce-name":s}},a=e.icon.map((e=>oT(e,o.icons))),i=vw([a]);return gE(e,t,n,r,i,e.tooltip,o)},hE=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},fE=(e,t,o,n=[],s=[])=>{const r=o.translate(e.text),a=e.icon.map((e=>oT(e,o.icons))),i=[a.getOrThunk((()=>ul(r)))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c={tag:"button",classes:[...hE(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...s],attributes:{"aria-label":r,"data-mce-name":e.text}},d=e.icon.map(x(r));return gE(e,t,n,c,i,d,o)},bE=(e,t,o,n=[],s=[])=>{const r=fE(e,A.some(t),o,n,s);return Lb.sketch(r)},vE=(e,t)=>o=>{"custom"===t?zr(o,eC,{name:e,value:{}}):"submit"===t?Lr(o,tC):"cancel"===t?Lr(o,Qk):console.error("Unknown button type: ",t)},yE=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>r,n=e,s={...e,type:"menubutton",search:A.none(),onSetup:t=>(t.setEnabled(e.enabled),b),fetch:WT(n.items,t,o)},r=Vb(UT(s,"tox-tbtn",o,A.none(),!0,e.text.or(e.tooltip).getOrUndefined()));return r.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=vE(e.name,t),s={...e,borderless:!1};return bE(s,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t,o)=>{var n,s;const r=e.icon.map((e=>nT(e,t.icons))).map(Vb),a=e.buttonType.getOr(e.primary?"primary":"secondary"),i={...e,name:null!==(n=e.name)&&void 0!==n?n:"",primary:"primary"===a,tooltip:e.tooltip,enabled:null!==(s=e.enabled)&&void 0!==s&&s,borderless:!1},l=i.tooltip.or(e.text).map((e=>({"aria-label":t.translate(e)}))).getOr({}),c=hE(null!=a?a:"secondary"),d=e.icon.isSome()&&e.text.isSome(),u={tag:"button",classes:[...c.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...d?["tox-button--icon-and-text"]:[]],attributes:{...l,...g(o)?{"data-mce-name":o}:{}}},m=t.translate(e.text.getOr("")),p=ul(m),h=[...vw([r.map((e=>e.asSpec()))]),...e.text.isSome()?[p]:[]],f=gE(i,A.some((o=>{zr(o,eC,{name:e.name,value:{setIcon:e=>{r.map((n=>n.getOpt(o).each((o=>{Ah.set(o,[nT(e,t.icons)])}))))}}})})),[],u,h,e.tooltip,t);return Lb.sketch(f)})(e,o.shared.providers,e.text.or(e.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},xE={type:"separator"},wE=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:b}),SE=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:b}),kE=(e,t)=>(e=>z(e,wE))(((e,t)=>P(t,(t=>t.type===e)))(e,t)),CE=e=>kE("header",e.targets),OE=e=>kE("anchor",e.targets),_E=e=>A.from(e.anchorTop).map((e=>SE("",e))).toArray(),TE=e=>A.from(e.anchorBottom).map((e=>SE("",e))).toArray(),EE=(e,t)=>{const o=e.toLowerCase();return P(t,(e=>{var t;const n=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,s=null!==(t=e.value)&&void 0!==t?t:"";return _e(n.toLowerCase(),o)||_e(s.toLowerCase(),o)}))},AE=Bi("aria-invalid"),ME=(e,t)=>{e.dom.checked=t},DE=e=>e.dom.checked,BE=e=>(t,o,n,s)=>fe(o,"name").fold((()=>e(o,s,A.none())),(r=>t.field(r,e(o,s,fe(n,r))))),IE={bar:BE(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:z(e.items,t.interpreter)}))(e,t.shared))),collection:BE(((e,t,o)=>aC(e,t.shared.providers,o))),alertbanner:BE(((e,t)=>((e,t)=>{const o=oy(e.icon,t.icons);return Pk.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in",`tox-notification--${e.level}`]},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:e.url?void 0:o},components:e.url?[Lb.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>zr(t,eC,{name:"alert-banner",value:e.url}),buttonBehaviours:ma([ny()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers))),input:BE(((e,t,o)=>((e,t,o)=>CT({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),textarea:BE(((e,t,o)=>((e,t,o)=>CT({name:e.name,multiline:!0,label:e.label,inputMode:A.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),label:BE(((e,t)=>((e,t)=>{const o="tox-label";return{dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"label",classes:[o,..."center"===e.align?[`${o}--center`]:[],..."end"===e.align?[`${o}--end`]:[]]},components:[ul(t.providers.translate(e.label))]},...z(e.items,t.interpreter)],behaviours:ma([b_(),Ah.config({}),(n=A.none(),S_(n,si,ri)),xh.config({mode:"acyclic"})])};var n})(e,t.shared))),iframe:(aM=(e,t,o)=>((e,t,o)=>{const n="tox-dialog__iframe",s=e.transparent?[]:[`${n}--opaque`],r=e.border?["tox-navobj-bordered"]:[],a={...e.label.map((e=>({title:e}))).getOr({}),...o.map((e=>({srcdoc:e}))).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},i=((e,t)=>{const o=on(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,s=()=>Ct(o,"srcdoc",n);t?K_.fold(x(X_),(e=>e.throttle))(o,n,s):s()}o.set(n)}}})(o,e.streamContent),l=e.label.map((e=>Kk(e,t))),c=$k.parts.field({factory:{sketch:e=>B_(A.from(r),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...s]},behaviours:ma([Ub.config({}),Rh.config({}),w_(o,i.getValue,i.setValue),gc.config({channels:{[P_]:{onReceive:(e,t)=>{t.newFocus.each((t=>{at(e.element).each((o=>{(Qe(e.element,t)?ka:Oa)(o,"tox-navobj-bordered-focus")}))}))}}}})])})}});return qk(l,c,["tox-form__group--stretched"],[])})(e,t.shared.providers,o),(e,t,o,n)=>{const s=wn(t,{source:"dynamic"});return BE(aM)(e,s,o,n)}),button:BE(((e,t)=>((e,t)=>{const o=vE(e.name,"custom");return n=A.none(),s=$k.parts.field({factory:Lb,...fE(e,A.some(o),t,[k_(""),b_()])}),qk(n,s,[],[]);var n,s})(e,t.shared.providers))),checkbox:BE(((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),A.some(!0)),s=$k.parts.field({factory:{sketch:w},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:ma([b_(),pg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{at(e.element).each((e=>ka(e,"tox-checkbox--disabled")))},onEnabled:e=>{at(e.element).each((e=>Oa(e,"tox-checkbox--disabled")))}}),Ub.config({}),Rh.config({}),S_(o,DE,ME),xh.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),Mh("checkbox-events",[Gr(nr(),((t,o)=>{zr(t,Jk,{name:e.name})}))])])}),r=$k.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[ul(t.translate(e.label))],behaviours:ma([bC.config({})])}),a=e=>ry("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=Vb({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return $k.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[s,i.asSpec(),r],fieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),cw()])})})(e,t.shared.providers,o))),colorinput:BE(((e,t,o)=>((e,t,o,n)=>{const s=$k.parts.field({factory:Iy,inputClasses:["tox-textfield"],data:n,onSetValue:e=>fC.run(e).get(b),inputBehaviours:ma([pg.config({disabled:t.providers.isDisabled}),cw(),Ub.config({}),fC.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>at(e.element),notify:{onValid:e=>{const t=qu.getValue(e);zr(e,vC,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=qu.getValue(e);if(0===t.length)return ak(dn.value(!0));{const e=Re("span");Bt(e,"background-color",t);const o=Lt(e,"background-color").fold((()=>dn.error("blah")),(e=>dn.value(t)));return ak(o)}}}})]),selectOnFocus:!1}),r=e.label.map((e=>Kk(e,t.providers))),a=(e,t)=>{zr(e,yC,{value:t})},i=Vb(((e,t)=>xk.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:ma([dw(t.providers.isDisabled),cw(),bC.config({}),Ub.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>rk((t=>e.fetch(t))).map((n=>A.from(Ek(wn(PS(Bi("menu-value"),n,(t=>{e.onItemAction(o,t)}),e.columns,e.presets,dy.CLOSE_ON_EXECUTE,T,t.providers),{movement:WS(e.columns,e.presets)}))))),parts:{menu:Ey(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[Zl,Jl,oc],onLtr:()=>[Jl,Zl,oc]},components:[],fetch:IS(o.getColors(e.storageKey),e.storageKey,o.hasCustomColors()),columns:o.getColorCols(e.storageKey),presets:"color",onItemAction:(t,n)=>{i.getOpt(t).each((t=>{"custom"===n?o.colorPicker((o=>{o.fold((()=>Lr(t,xC)),(o=>{a(t,o),mS(e.storageKey,o)}))}),"#ffffff"):a(t,"remove"===n?"":n)}))}},t));return $k.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:r.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[s,i.asSpec()]}]),fieldBehaviours:ma([Mh("form-field-events",[Gr(vC,((t,o)=>{i.getOpt(t).each((e=>{Bt(e.element,"background-color",o.event.color)})),zr(t,Jk,{name:e.name})})),Gr(yC,((e,t)=>{$k.getField(e).each((o=>{qu.setValue(o,t.event.value),eg.getCurrent(e).each(Rh.focus)}))})),Gr(xC,((e,t)=>{$k.getField(e).each((t=>{eg.getCurrent(e).each(Rh.focus)}))}))])])})})(e,t.shared,t.colorinput,o))),colorpicker:BE(((e,t,o)=>((e,t,o)=>{const n=e=>"tox-"+e,s=f_((e=>t=>r(t)?e.translate(C_[t]):e.translate(t))(t),n),a=Vb(s.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{zr(e,eC,{name:"hex-valid",value:!0})},onInvalidHex:e=>{zr(e,eC,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:ma([w_(o,(e=>{const t=a.get(e);return eg.getCurrent(t).bind((e=>qu.getValue(e).hex)).map((e=>"#"+Oe(e,"#"))).getOr("")}),((e,t)=>{const o=A.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind((e=>ee(e,1))),n=a.get(e);eg.getCurrent(n).fold((()=>{console.log("Can not find form")}),(e=>{qu.setValue(e,{hex:o.getOr("")}),d_.getField(e,"hex").each((e=>{Lr(e,or())}))}))})),b_()])}})(0,t.shared.providers,o))),dropzone:BE(((e,t,o)=>((e,t,o)=>{const n=(e,t)=>{t.stop()},s=e=>(t,o)=>{V(e,(e=>{e(t,o)}))},r=(e,t)=>{var o;if(!pg.isDisabled(e)){const n=t.event.raw;i(e,null===(o=n.dataTransfer)||void 0===o?void 0:o.files)}},a=(e,t)=>{const o=t.event.raw.target;i(e,o.files)},i=(o,n)=>{n&&(qu.setValue(o,((e,t)=>{const o=T_.explode(t.getOption("images_file_types"));return P(ne(e),(e=>R(o,(t=>Ee(e.name.toLowerCase(),`.${t.toLowerCase()}`)))))})(n,t)),zr(o,Jk,{name:e.name}))},l=Vb({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:ma([Mh("input-file-events",[Jr(sr()),Jr(br())])])}),c=e.label.map((e=>Kk(e,t))),d=$k.parts.field({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:ma([k_(o.getOr([])),b_(),pg.config({}),Wh.config({toggleClass:"dragenter",toggleOnExecute:!1}),Mh("dropzone-events",[Gr("dragenter",s([n,Wh.toggle])),Gr("dragleave",s([n,Wh.toggle])),Gr("dragover",n),Gr("drop",s([n,r])),Gr(nr(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[ul(t.translate("Drop an image here"))]},Lb.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[ul(t.translate("Browse for an image")),l.asSpec()],action:e=>{l.get(e).element.dom.click()},buttonBehaviours:ma([Ub.config({}),dw(t.isDisabled),cw()])})]}]})}});return qk(c,d,["tox-form__group--stretched"],[])})(e,t.shared.providers,o))),grid:BE(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:z(e.items,t.interpreter)}))(e,t.shared))),listbox:BE(((e,t,o)=>((e,t,o)=>{const n=t.shared.providers,s=o.bind((t=>hT(e.items,t))).orThunk((()=>te(e.items).filter(mT))),r=e.label.map((e=>Kk(e,n))),a=$k.parts.field({dom:{},factory:{sketch:o=>iT({uid:o.uid,text:s.map((e=>e.text)),icon:A.none(),tooltip:A.none(),role:A.none(),ariaLabel:e.label,fetch:(o,n)=>{const s=pT(o,e.name,e.items,qu.getValue(o));n(uT(s,dy.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:A.none()}))},onSetup:x(b),getApi:x({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[Ub.config({}),w_(s.map((e=>e.value)),(e=>_t(e.element,gT)),((t,o)=>{hT(e.items,o).each((e=>{Ct(t.element,gT,e.value),zr(t,rT,{text:e.text})}))}))]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return $k.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:G([r.toArray(),[i]]),fieldBehaviours:ma([pg.config({disabled:x(!e.enabled),onDisabled:e=>{$k.getField(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable)}})])})})(e,t,o))),selectbox:BE(((e,t,o)=>((e,t,o)=>{const n=z(e.items,(e=>({text:t.translate(e.text),value:e.value}))),s=e.label.map((e=>Kk(e,t))),r=$k.parts.field({dom:{},...o.map((e=>({data:e}))).getOr({}),selectAttributes:{size:e.size},options:n,factory:fT,selectBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),Ub.config({}),Mh("selectbox-change",[Gr(nr(),((t,o)=>{zr(t,Jk,{name:e.name})}))])])}),a=e.size>1?A.none():A.some(ry("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:G([[r],a.toArray()])};return $k.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:G([s.toArray(),[i]]),fieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{$k.getField(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable)}}),cw()])})})(e,t.shared.providers,o))),sizeinput:BE(((e,t)=>((e,t)=>{let o=kT;const n=Bi("ratio-event"),s=e=>ry(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),r=e.label.getOr("Constrain proportions"),a=t.translate(r),i=xT.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":a,"data-mce-name":r}},components:[s("lock"),s("unlock")],buttonBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),cw(),Ub.config({}),Qb.config(t.tooltips.getConfig({tooltipText:a}))])}),l=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),c=o=>$k.parts.field({factory:Iy,inputClasses:["tox-textfield"],inputBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled()}),cw(),Ub.config({}),Mh("size-input-events",[Gr(Zs(),((e,t)=>{zr(e,n,{isField1:o})})),Gr(nr(),((t,o)=>{zr(t,Jk,{name:e.name})}))])]),selectOnFocus:!1}),d=e=>({dom:{tag:"label",classes:["tox-label"]},components:[ul(t.translate(e))]}),u=xT.parts.field1(l([$k.parts.label(d("Width")),c(!0)])),m=xT.parts.field2(l([$k.parts.label(d("Height")),c(!1)]));return xT.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[u,m,l([d("\xa0"),i])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{wT(qu.getValue(e)).each((e=>{o(e).each((e=>{qu.setValue(t,(e=>{const t={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,in:4,"%":4};let o=e.value.toFixed((n=e.unit)in t?t[n]:1);var n;return-1!==o.indexOf(".")&&(o=o.replace(/\.?0*$/,"")),o+e.unit})(e))}))}))},coupledFieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{xT.getField1(e).bind($k.getField).each(pg.disable),xT.getField2(e).bind($k.getField).each(pg.disable),xT.getLock(e).each(pg.disable)},onEnabled:e=>{xT.getField1(e).bind($k.getField).each(pg.enable),xT.getField2(e).bind($k.getField).each(pg.enable),xT.getLock(e).each(pg.enable)}}),cw(),Mh("size-input-events2",[Gr(n,((e,t)=>{const n=t.event.isField1,s=n?xT.getField1(e):xT.getField2(e),r=n?xT.getField2(e):xT.getField1(e),a=s.map(qu.getValue).getOr(""),i=r.map(qu.getValue).getOr("");o=((e,t)=>{const o=wT(e).toOptional(),n=wT(t).toOptional();return we(o,n,((e,t)=>ST(e,t.unit).map((e=>t.value/e)).map((e=>{return o=e,n=t.unit,e=>ST(e,n).map((e=>({value:e*o,unit:n})));var o,n})).getOr(kT))).getOr(kT)})(a,i)}))])])})})(e,t.shared.providers))),slider:BE(((e,t,o)=>((e,t,o)=>{const n=o_.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[ul(t.translate(e.label))]}),s=o_.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),r=o_.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return o_.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:x(o.getOrThunk((()=>(Math.abs(e.max)-Math.abs(e.min))/2)))},components:[n,s,r],sliderBehaviours:ma([b_(),Rh.config({})]),onChoose:(t,o,n)=>{zr(t,Jk,{name:e.name,value:n})}})})(e,t.shared.providers,o))),urlinput:BE(((e,t,o)=>((e,t,o,n)=>{const s=t.shared.providers,r=t=>{const n=qu.getValue(t);o.addToHistory(n.value,e.filetype)},a={...n.map((e=>({initialData:e}))).getOr({}),dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":AE,type:"url"},minChars:0,responseTime:0,fetch:n=>{const s=((e,t,o)=>{var n,s;const r=qu.getValue(t),a=null!==(s=null===(n=null==r?void 0:r.meta)||void 0===n?void 0:n.text)&&void 0!==s?s:r.value;return o.getLinkInformation().fold((()=>[]),(t=>{const n=EE(a,(e=>z(e,(e=>SE(e,e))))(o.getHistory(e)));return"file"===e?(s=[n,EE(a,CE(t)),EE(a,G([_E(t),OE(t),TE(t)]))],W(s,((e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(xE,t)),[])):n;var s}))})(e.filetype,n,o),r=uT(s,dy.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:A.none()});return ak(r)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(fC)&&fC.run(e).get(b)},typeaheadBehaviours:ma([...o.getValidationHandler().map((t=>fC.config({getRoot:e=>at(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each((e=>{Ct(e.element,"title",s.translate(t))}))}},validator:{validate:o=>{const n=qu.getValue(o);return mE((o=>{t({type:e.filetype,url:n.value},(e=>{if("invalid"===e.status){const t=dn.error(e.message);o(t)}else{const t=dn.value(e.message);o(t)}}))}))},validateOnLoad:!1}}))).toArray(),pg.config({disabled:()=>!e.enabled||s.isDisabled()}),Ub.config({}),Mh("urlinput-events",[Gr(or(),(t=>{const o=ol(t.element),n=o.trim();n!==o&&nl(t.element,n),"file"===e.filetype&&zr(t,Jk,{name:e.name})})),Gr(nr(),(t=>{zr(t,Jk,{name:e.name}),r(t)})),Gr(gr(),(t=>{zr(t,Jk,{name:e.name}),r(t)}))])]),eventOrder:{[or()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:e=>e.value,selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:t.shared.getSink,parts:{menu:Ey(0,0,"normal")},onExecute:(e,t,o)=>{zr(t,tC,{})},onItemExecute:(t,o,n,s)=>{r(t),zr(t,Jk,{name:e.name})}},i=$k.parts.field({...a,factory:dE}),l=e.label.map((e=>Kk(e,s))),c=Vb(((e,t,o=e,n=e)=>ry(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:s.translate(n),"aria-live":"polite",...t.fold((()=>({})),(e=>({id:e})))}},s.icons))("invalid",A.some(AE),"warning")),d=Vb({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),u=o.getUrlPicker(e.filetype),m=Bi("browser.url.event"),g=Vb({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:ma([pg.config({disabled:()=>!e.enabled||s.isDisabled()})])}),p=Vb(bE({name:e.name,icon:A.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:A.none(),borderless:!0},(e=>Lr(e,m)),s,[],["tox-browse-url"]));return $k.sketch({dom:Xk([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:G([[g.asSpec()],u.map((()=>p.asSpec())).toArray()])}]),fieldBehaviours:ma([pg.config({disabled:()=>!e.enabled||s.isDisabled(),onDisabled:e=>{$k.getField(e).each(pg.disable),p.getOpt(e).each(pg.disable)},onEnabled:e=>{$k.getField(e).each(pg.enable),p.getOpt(e).each(pg.enable)}}),cw(),Mh("url-input-events",[Gr(m,(t=>{eg.getCurrent(t).each((o=>{const n=qu.getValue(o),s={fieldname:e.name,...n};u.each((n=>{n(s).get((n=>{qu.setValue(o,n),zr(t,Jk,{name:e.name})}))}))}))}))])])})})(e,t,t.urlinput,o))),customeditor:BE((e=>{const t=rn(),o=Vb({dom:{tag:e.tag}}),n=rn(),s=!__(e)&&e.onFocus.isSome()?[Rh.config({onFocus:t=>{e.onFocus.each((e=>{e(t.element.dom)}))}}),Ub.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:ma([Mh("custom-editor-events",[ea((s=>{o.getOpt(s).each((o=>{(__(e)?e.init(o.element.dom):O_.load(e.scriptId,e.scriptUrl).then((t=>t(o.element.dom,e.settings)))).then((e=>{n.on((t=>{e.setValue(t)})),n.clear(),t.set(e)}))}))}))]),w_(A.none(),(()=>t.get().fold((()=>n.get().getOr("")),(e=>e.getValue()))),((e,o)=>{t.get().fold((()=>n.set(o)),(e=>e.setValue(o)))})),b_()].concat(s)),components:[o.asSpec()]}})),htmlpanel:BE(((e,t)=>((e,t)=>"presentation"===e.presets?Pk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html},containerBehaviours:ma([Qb.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{_l(e.element,"[data-mce-tooltip]:hover").orThunk((()=>yc(e.element))).each((o=>{Tt(o,"data-mce-tooltip").each((o=>{Qb.setComponents(e,t.tooltips.getComponents({tooltipText:o}))}))}))}}),mode:"children-normal",anchor:e=>({type:"node",node:_l(e.element,"[data-mce-tooltip]:hover").orThunk((()=>yc(e.element).filter((e=>Tt(e,"data-mce-tooltip").isSome())))),root:e.element,layouts:{onLtr:x([oc,tc,Jl,Ql,Zl,ec]),onRtl:x([oc,tc,Jl,Ql,Zl,ec])},bubble:Gc(0,-2,{})})})])}):Pk.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:ma([Ub.config({}),Rh.config({})])}))(e,t.shared.providers))),imagepreview:BE(((e,t,o)=>((e,t)=>{const o=on(t.getOr({url:""})),n=Vb({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map((e=>({src:e.url}))).getOr({})}}),s=Vb({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),r={};e.height.each((e=>r.height=e));const a=t.map((e=>({url:e.url,zoom:A.from(e.zoom),cachedWidth:A.from(e.cachedWidth),cachedHeight:A.from(e.cachedHeight)})));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:r,attributes:{role:"presentation"}},components:[s.asSpec()],behaviours:ma([b_(),w_(a,(()=>o.get()),((e,t)=>{const r={url:t.url};t.zoom.each((e=>r.zoom=e)),t.cachedWidth.each((e=>r.cachedWidth=e)),t.cachedHeight.each((e=>r.cachedHeight=e)),o.set(r);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=r;if(!u(t)&&!u(o)){if(u(n)){const n=((e,t,o)=>{const n=Zt(e),s=jt(e);return Math.min(n/t,s/o,1)})(e.element,t,o);r.zoom=n}const a=((e,t,o,n,s)=>{const r=o*s,a=n*s,i=Math.max(0,e/2-r/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:r.toString()+"px",height:a.toString()+"px"}})(Zt(e.element),jt(e.element),t,o,r.zoom);s.getOpt(e).each((e=>{It(e.element,a)}))}};n.getOpt(e).each((o=>{const n=o.element;var s;t.url!==_t(n,"src")&&(Ct(n,"src",t.url),Oa(e.element,"tox-imagepreview__loaded")),a(),(s=n,new Promise(((e,t)=>{const o=()=>{r(),e(s)},n=[Fc(s,"load",o),Fc(s,"error",(()=>{r(),t("Unable to load data from image: "+s.dom.src)}))],r=()=>V(n,(e=>e.unbind()));s.dom.complete&&o()}))).then((t=>{e.getSystem().isConnected()&&(ka(e.element,"tox-imagepreview__loaded"),r.cachedWidth=t.dom.naturalWidth,r.cachedHeight=t.dom.naturalHeight,a())}))}))}))])}})(e,o))),table:BE(((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"td",innerHtml:t.translate(e)}});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(s=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:z(s,(e=>({dom:{tag:"th",innerHtml:t.translate(e)}})))}]}),(n=e.cells,{dom:{tag:"tbody"},components:z(n,(e=>({dom:{tag:"tr"},components:z(e,o)})))})],behaviours:ma([Ub.config({}),Rh.config({})])};var n,s})(e,t.shared.providers))),tree:BE(((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(b),n=e.onToggleExpand.getOr(b),s=e.defaultExpandedIds,r=on(s),a=on(e.defaultSelectedId),i=Bi("tree-id"),l=(n,s)=>e.items.map((e=>"leaf"===e.type?GT({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):JT({directory:e,selectedId:n,onLeafAction:o,expandedIds:s,labelTabstopping:!0,treeId:i,backstage:t})));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),r.get()),behaviours:ma([xh.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),Mh(ZT,[Gr("expand-tree-node",((e,t)=>{const{expanded:o,node:s}=t.event;r.set(o?[...r.get(),s]:r.get().filter((e=>e!==s))),n(r.get(),{expanded:o,node:s})}))]),gc.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(A.some(t.value)),Ah.set(e,l(A.some(t.value),r.get()))}}}}),Ah.config({})])}})(e,t))),panel:BE(((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:z(e.items,t.shared.interpreter)}))(e,t)))},FE={field:(e,t)=>t,record:x([])},RE=(e,t,o,n)=>{const s=wn(n,{shared:{interpreter:t=>NE(e,t,o,s)}});return NE(e,t,o,s)},NE=(e,t,o,n)=>fe(IE,t.type).fold((()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t)),(s=>s(e,t,o,n))),LE=(e,t,o)=>NE(FE,e,t,o),zE="layout-inset",VE=e=>e.x,HE=(e,t)=>e.x+e.width/2-t.width/2,PE=(e,t)=>e.x+e.width-t.width,UE=e=>e.y,WE=(e,t)=>e.y+e.height-t.height,jE=(e,t)=>e.y+e.height/2-t.height/2,$E=(e,t,o)=>Dl(PE(e,t),WE(e,t),o.insetSouthwest(),Nl(),"southwest",Wl(e,{right:0,bottom:3}),zE),GE=(e,t,o)=>Dl(VE(e),WE(e,t),o.insetSoutheast(),Rl(),"southeast",Wl(e,{left:1,bottom:3}),zE),qE=(e,t,o)=>Dl(PE(e,t),UE(e),o.insetNorthwest(),Fl(),"northwest",Wl(e,{right:0,top:2}),zE),YE=(e,t,o)=>Dl(VE(e),UE(e),o.insetNortheast(),Il(),"northeast",Wl(e,{left:1,top:2}),zE),XE=(e,t,o)=>Dl(HE(e,t),UE(e),o.insetNorth(),Ll(),"north",Wl(e,{top:2}),zE),KE=(e,t,o)=>Dl(HE(e,t),WE(e,t),o.insetSouth(),zl(),"south",Wl(e,{bottom:3}),zE),JE=(e,t,o)=>Dl(PE(e,t),jE(e,t),o.insetEast(),Hl(),"east",Wl(e,{right:0}),zE),ZE=(e,t,o)=>Dl(VE(e),jE(e,t),o.insetWest(),Vl(),"west",Wl(e,{left:1}),zE),QE=e=>{switch(e){case"north":return XE;case"northeast":return YE;case"northwest":return qE;case"south":return KE;case"southeast":return GE;case"southwest":return $E;case"east":return JE;case"west":return ZE}},eA=(e,t,o,n,s)=>Mc(n).map(QE).getOr(XE)(e,t,o,n,s),tA=e=>{switch(e){case"north":return KE;case"northeast":return GE;case"northwest":return $E;case"south":return XE;case"southeast":return YE;case"southwest":return qE;case"east":return ZE;case"west":return JE}},oA=(e,t,o,n,s)=>Mc(n).map(tA).getOr(XE)(e,t,o,n,s),nA={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},sA=(e,t,o)=>{const n={maxHeightFunction:Uc()};return()=>o()?{type:"node",root:bt(ft(e())),node:A.from(e()),bubble:Gc(12,12,nA),layouts:{onRtl:()=>[YE],onLtr:()=>[qE]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:Gc(-12,12,nA),layouts:{onRtl:()=>[Jl,Zl,oc],onLtr:()=>[Zl,Jl,oc]},overrides:n}},rA=(e,t,o,n)=>{const s={maxHeightFunction:Uc()};return()=>n()?{type:"node",root:bt(ft(t())),node:A.from(t()),bubble:Gc(12,12,nA),layouts:{onRtl:()=>[XE],onLtr:()=>[XE]},overrides:s}:e?{type:"node",root:bt(ft(t())),node:A.from(t()),bubble:Gc(0,-$t(t()),nA),layouts:{onRtl:()=>[tc],onLtr:()=>[tc]},overrides:s}:{type:"hotspot",hotspot:o(),bubble:Gc(0,0,nA),layouts:{onRtl:()=>[tc],onLtr:()=>[tc]},overrides:s}},aA=(e,t,o)=>()=>o()?{type:"node",root:bt(ft(e())),node:A.from(e()),layouts:{onRtl:()=>[XE],onLtr:()=>[XE]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[oc],onLtr:()=>[oc]}},iA=(e,t)=>()=>({type:"selection",root:t(),getSelection:()=>{const t=e.selection.getRng(),o=e.model.table.getSelectedCells();if(o.length>1){const e=o[0],t=o[o.length-1],n={firstCell:Le(e),lastCell:Le(t)};return A.some(n)}return A.some(yd.range(Le(t.startContainer),t.startOffset,Le(t.endContainer),t.endOffset))}}),lA=e=>t=>({type:"node",root:e(),node:t}),cA=(e,t,o,n)=>{const s=Ob(e),r=()=>Le(e.getBody()),a=()=>Le(e.getContentAreaContainer()),i=()=>s||!n();return{inlineDialog:sA(a,t,i),inlineBottomDialog:rA(e.inline,a,o,i),banner:aA(a,t,i),cursor:iA(e,r),node:lA(r)}},dA=e=>(t,o)=>{HS(e)(t,o)},uA=e=>()=>_S(e),mA=e=>t=>SS(e,t),gA=e=>t=>OS(e,t),pA=e=>()=>rb(e),hA=e=>ve(e,"items"),fA=e=>ve(e,"format"),bA=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",format:"bold"},{title:"Italic",format:"italic"},{title:"Underline",format:"underline"},{title:"Strikethrough",format:"strikethrough"},{title:"Superscript",format:"superscript"},{title:"Subscript",format:"subscript"},{title:"Code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Align",items:[{title:"Left",format:"alignleft"},{title:"Center",format:"aligncenter"},{title:"Right",format:"alignright"},{title:"Justify",format:"alignjustify"}]}],vA=e=>W(e,((e,t)=>{if(be(t,"items")){const o=vA(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if(be(t,"inline")||(e=>be(e,"block"))(t)||(e=>be(e,"selector"))(t)){const o=`custom-${r(t.name)?t.name:t.title.toLowerCase()}`;return{customFormats:e.customFormats.concat([{name:o,format:t}]),formats:e.formats.concat([{title:t.title,format:o,icon:t.icon}])}}return{...e,formats:e.formats.concat(t)}}),{customFormats:[],formats:[]}),yA=e=>zf(e).map((t=>{const o=((e,t)=>{const o=vA(t),n=t=>{V(t,(t=>{e.formatter.has(t.name)||e.formatter.register(t.name,t.format)}))};return e.formatter?n(o.customFormats):e.on("init",(()=>{n(o.customFormats)})),o.formats})(e,t);return Vf(e)?bA.concat(o):o})).getOr(bA),xA=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),wA=(e,t,o,n)=>{const s=t=>z(t,(t=>hA(t)?(e=>{const t=s(e.items);return{...e,type:"submenu",getStyleItems:x(t)}})(t):fA(t)?(e=>xA(e,o,n))(t):(e=>{const t=re(e);return 1===t.length&&F(t,"title")})(t)?{...t,type:"separator"}:(t=>{const s=r(t.name)?t.name:Bi(t.title),a=`custom-${s}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(s,i),i})(t)));return s(t)},SA=e=>{let t=0;const o=e=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[ul(e.tooltipText)]}];return{getConfig:n=>({delayForShow:()=>t>0?60:300,delayForHide:x(300),exclusive:!0,lazySink:e,tooltipDom:{tag:"div",classes:["tox-tooltip","tox-tooltip--up"]},tooltipComponents:o(n),onShow:(e,o)=>{t++,n.onShow&&n.onShow(e,o)},onHide:()=>{t--}}),getComponents:o}},kA=T_.trim,CA=e=>t=>{if((e=>g(e)&&1===e.nodeType)(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},OA=CA("true"),_A=CA("false"),TA=(e,t,o,n,s)=>({type:e,title:t,url:o,level:n,attach:s}),EA=e=>e.innerText||e.textContent,AA=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&DA(e),MA=e=>e&&/^(H[1-6])$/.test(e.nodeName),DA=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return OA(t)}return!1})(e)&&!_A(e),BA=e=>MA(e)&&DA(e),IA=e=>{var t;const o=(e=>e.id?e.id:Bi("h"))(e);return TA("header",null!==(t=EA(e))&&void 0!==t?t:"","#"+o,(e=>MA(e)?parseInt(e.nodeName.substr(1),10):0)(e),(()=>{e.id=o}))},FA=e=>{const t=e.id||e.name,o=EA(e);return TA("anchor",o||"#"+t,"#"+t,0,b)},RA=e=>kA(e.title).length>0,NA=e=>{const t=(e=>{const t=z(Td(Le(e),"h1,h2,h3,h4,h5,h6,a:not([href])"),(e=>e.dom));return t})(e);return P((e=>z(P(e,BA),IA))(t).concat((e=>z(P(e,AA),FA))(t)),RA)},LA="tinymce-url-history",zA=e=>r(e)&&/^https?/.test(e),VA=e=>a(e)&&pe(e,(e=>{return!(l(t=e)&&t.length<=5&&Y(t,zA));var t})).isNone(),HA=()=>{const e=cS.getItem(LA);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+LA+" was not valid JSON",e),{};throw e}return VA(t)?t:(console.log("Local storage "+LA+" was not valid format",t),{})},PA=e=>{const t=HA();return fe(t,e).getOr([])},UA=(e,t)=>{if(!zA(e))return;const o=HA(),n=fe(o,t).getOr([]),s=P(n,(t=>t!==e));o[t]=[e].concat(s).slice(0,5),(e=>{if(!VA(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));cS.setItem(LA,JSON.stringify(e))})(o)},WA=e=>!!e,jA=e=>le(T_.makeMap(e,/[, ]/),WA),$A=e=>A.from(Zf(e)),GA=e=>A.from(e).filter(r).getOrUndefined(),qA=e=>({getHistory:PA,addToHistory:UA,getLinkInformation:()=>(e=>ob(e)?A.some({targets:NA(e.getBody()),anchorTop:GA(nb(e)),anchorBottom:GA(sb(e))}):A.none())(e),getValidationHandler:()=>(e=>A.from(Qf(e)))(e),getUrlPicker:t=>((e,t)=>((e,t)=>{const o=(e=>{const t=A.from(tb(e)).filter(WA).map(jA);return $A(e).fold(T,(e=>t.fold(E,(e=>re(e).length>0&&e))))})(e);return d(o)?o?$A(e):A.none():o[t]?$A(e):A.none()})(e,t).map((o=>n=>rk((s=>{const i={filetype:t,fieldname:n.fieldname,...A.from(n.meta).getOr({})};o.call(e,((e,t)=>{if(!r(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");s({value:e,meta:t})}),n.value,i)})))))(e,t)}),YA=Wm,XA=_m,KA=x([Cs("shell",!1),is("makeItem"),Cs("setupItem",b),Ju("listBehaviours",[Ah])]),JA=km({name:"items",overrides:()=>({behaviours:ma([Ah.config({})])})}),ZA=x([JA]),QA=Km({name:x("CustomList")(),configFields:KA(),partFields:ZA(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[Ah.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Ku(e.listBehaviours,s.behaviours),apis:{setItems:(t,o)=>{var n;(n=t,e.shell?A.some(n):Rm(n,e,"items")).fold((()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")}),(n=>{const s=Ah.contents(n),r=o.length,a=r-s.length,i=a>0?N(a,(()=>e.makeItem())):[],l=s.slice(r);V(l,(e=>Ah.remove(n,e))),V(i,(e=>Ah.append(n,e)));const c=Ah.contents(n);V(c,((n,s)=>{e.setupItem(t,n,o[s],s)}))}))}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),eM=x([is("dom"),Cs("shell",!0),Yu("toolbarBehaviours",[Ah])]),tM=x([km({name:"groups",overrides:()=>({behaviours:ma([Ah.config({})])})})]),oM=Km({name:"Toolbar",configFields:eM(),partFields:tM(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[Ah.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Ku(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(t,o)=>{var n;(n=t,e.shell?A.some(n):Rm(n,e,"groups")).fold((()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")}),(e=>{Ah.set(e,o)}))},refresh:b},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),nM=b,sM=T,rM=x([]);var aM,iM=Object.freeze({__proto__:null,setup:nM,isDocked:sM,getBehaviours:rM});const lM=x(Bi("toolbar-height-change")),cM={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},dM="tox-tinymce--toolbar-sticky-on",uM="tox-tinymce--toolbar-sticky-off",mM=(e,t)=>F(Ei.getModes(e),t),gM=e=>{const t=e.element;at(t).each((o=>{const n="padding-"+Ei.getModes(e)[0];if(Ei.isDocked(e)){const e=Zt(o);Bt(t,"width",e+"px"),Bt(o,n,(e=>$t(e)+(parseInt(Rt(e,"margin-top"),10)||0)+(parseInt(Rt(e,"margin-bottom"),10)||0))(t)+"px")}else Ht(t,"width"),Ht(o,n)}))},pM=(e,t)=>{t?(Oa(e,cM.fadeOutClass),Ta(e,[cM.transitionClass,cM.fadeInClass])):(Oa(e,cM.fadeInClass),Ta(e,[cM.fadeOutClass,cM.transitionClass]))},hM=(e,t)=>{const o=Le(e.getContainer());t?(ka(o,dM),Oa(o,uM)):(ka(o,uM),Oa(o,dM))},fM=(e,t)=>{const o=rn(),n=t.getSink,s=e=>{n().each((t=>e(t.element)))},r=t=>{e.inline||gM(t),hM(e,Ei.isDocked(t)),t.getSystem().broadcastOn([Au()],{}),n().each((e=>e.getSystem().broadcastOn([Au()],{})))},a=e.inline?[]:[gc.config({channels:{[lM()]:{onReceive:gM}}})];return[Rh.config({}),Ei.config({contextual:{lazyContext:t=>{const o=$t(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return A.from(n).map((n=>{const s=Zo(Le(n));return Rb(e,t.element).fold((()=>{const e=s.height-o,n=s.y+(mM(t,"top")?0:o);return Jo(s.x,n,s.width,e)}),(e=>{const n=en(s,Nb(e)),r=mM(t,"top")?n.y:n.y+o;return Jo(n.x,r,n.width,n.height-o)}))}))},onShow:()=>{s((e=>pM(e,!0)))},onShown:e=>{s((e=>Ea(e,[cM.transitionClass,cM.fadeInClass]))),o.get().each((t=>{((e,t)=>{const o=tt(t);vc(o).filter((e=>!Qe(t,e))).filter((t=>Qe(t,Le(o.dom.body))||et(e,t))).each((()=>hc(t)))})(e.element,t),o.clear()}))},onHide:e=>{((e,t)=>yc(e).orThunk((()=>t().toOptional().bind((e=>yc(e.element))))))(e.element,n).fold(o.clear,o.set),s((e=>pM(e,!1)))},onHidden:()=>{s((e=>Ea(e,[cM.transitionClass])))},...cM},lazyViewport:t=>Rb(e,t.element).fold((()=>{const o=tn(),n=Xf(e),s=o.y+(mM(t,"top")?n:0),r=o.height-(mM(t,"bottom")?n:0);return{bounds:Jo(o.x,s,o.width,r),optScrollEnv:A.none()}}),(e=>({bounds:Nb(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Xt(e.element).top})}))),modes:[t.header.getDockingMode()],onDocked:r,onUndocked:r}),...a]};var bM=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",(()=>{o().each(Ei.reset)})),e.on("ResizeWindow ResizeEditor",(()=>{o().each(gM)})),e.on("SkinLoaded",(()=>{o().each((e=>{Ei.isDocked(e)?Ei.reset(e):Ei.refresh(e)}))})),e.on("FullscreenStateChanged",(()=>{o().each(Ei.reset)}))),e.on("AfterScrollIntoView",(e=>{o().each((t=>{Ei.refresh(t);const o=t.element;gp(o)&&((e,t)=>{const o=tt(t),n=st(t).dom.innerHeight,s=Wo(o),r=Le(e.elm),a=Qo(r),i=jt(r),l=a.y,c=l+i,d=Xt(t),u=jt(t),m=d.top,g=m+u,p=Math.abs(m-s.top)<2,h=Math.abs(g-(s.top+n))<2;if(p&&l