@lotte-innovate/ui-component-test 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/package.json +2 -1
  2. package/post-tinymce.js +3 -2
  3. package/public/tinymce/CHANGELOG.md +3453 -0
  4. package/public/tinymce/README.md +73 -0
  5. package/public/tinymce/bower.json +27 -0
  6. package/public/tinymce/composer.json +52 -0
  7. package/public/tinymce/icons/default/icons.js +194 -0
  8. package/public/tinymce/icons/default/icons.min.js +1 -0
  9. package/public/tinymce/icons/default/icons.mjs +2 -0
  10. package/public/tinymce/icons/default/icons.mjs.map +1 -0
  11. package/public/tinymce/icons/default/index.d.ts +1 -0
  12. package/public/tinymce/icons/default/index.js +7 -0
  13. package/public/tinymce/icons/default/index.mjs +2 -0
  14. package/public/tinymce/icons/default/index.mjs.map +1 -0
  15. package/public/tinymce/license.txt +21 -0
  16. package/public/tinymce/models/dom/index.d.ts +1 -0
  17. package/public/tinymce/models/dom/index.js +7 -0
  18. package/public/tinymce/models/dom/index.mjs +2 -0
  19. package/public/tinymce/models/dom/index.mjs.map +1 -0
  20. package/public/tinymce/models/dom/model.js +8040 -0
  21. package/public/tinymce/models/dom/model.min.js +4 -0
  22. package/public/tinymce/models/dom/model.mjs +2 -0
  23. package/public/tinymce/models/dom/model.mjs.map +1 -0
  24. package/public/tinymce/package.json +32 -0
  25. package/public/tinymce/plugins/advlist/index.d.ts +1 -0
  26. package/public/tinymce/plugins/advlist/index.js +7 -0
  27. package/public/tinymce/plugins/advlist/index.mjs +2 -0
  28. package/public/tinymce/plugins/advlist/index.mjs.map +1 -0
  29. package/public/tinymce/plugins/advlist/plugin.js +259 -0
  30. package/public/tinymce/plugins/advlist/plugin.min.js +4 -0
  31. package/public/tinymce/plugins/advlist/plugin.mjs +2 -0
  32. package/public/tinymce/plugins/advlist/plugin.mjs.map +1 -0
  33. package/public/tinymce/plugins/autolink/index.js +7 -0
  34. package/public/tinymce/plugins/autolink/plugin.js +228 -0
  35. package/public/tinymce/plugins/autolink/plugin.min.js +4 -0
  36. package/public/tinymce/plugins/code/index.d.ts +1 -0
  37. package/public/tinymce/plugins/code/index.js +7 -0
  38. package/public/tinymce/plugins/code/index.mjs +2 -0
  39. package/public/tinymce/plugins/code/index.mjs.map +1 -0
  40. package/public/tinymce/plugins/code/plugin.js +85 -0
  41. package/public/tinymce/plugins/code/plugin.min.js +4 -0
  42. package/public/tinymce/plugins/code/plugin.mjs +2 -0
  43. package/public/tinymce/plugins/code/plugin.mjs.map +1 -0
  44. package/public/tinymce/plugins/codesample/index.d.ts +1 -0
  45. package/public/tinymce/plugins/codesample/index.js +7 -0
  46. package/public/tinymce/plugins/codesample/index.mjs +2 -0
  47. package/public/tinymce/plugins/codesample/index.mjs.map +1 -0
  48. package/public/tinymce/plugins/codesample/plugin.d.ts +45 -0
  49. package/public/tinymce/plugins/codesample/plugin.js +2463 -0
  50. package/public/tinymce/plugins/codesample/plugin.min.js +4 -0
  51. package/public/tinymce/plugins/codesample/plugin.mjs +2 -0
  52. package/public/tinymce/plugins/codesample/plugin.mjs.map +1 -0
  53. package/public/tinymce/plugins/image/index.d.ts +1 -0
  54. package/public/tinymce/plugins/image/index.js +7 -0
  55. package/public/tinymce/plugins/image/index.mjs +2 -0
  56. package/public/tinymce/plugins/image/index.mjs.map +1 -0
  57. package/public/tinymce/plugins/image/plugin.js +1505 -0
  58. package/public/tinymce/plugins/image/plugin.min.js +4 -0
  59. package/public/tinymce/plugins/image/plugin.mjs +2 -0
  60. package/public/tinymce/plugins/image/plugin.mjs.map +1 -0
  61. package/public/tinymce/plugins/link/index.d.ts +1 -0
  62. package/public/tinymce/plugins/link/index.js +7 -0
  63. package/public/tinymce/plugins/link/index.mjs +2 -0
  64. package/public/tinymce/plugins/link/index.mjs.map +1 -0
  65. package/public/tinymce/plugins/link/plugin.js +1242 -0
  66. package/public/tinymce/plugins/link/plugin.min.js +4 -0
  67. package/public/tinymce/plugins/link/plugin.mjs +2 -0
  68. package/public/tinymce/plugins/link/plugin.mjs.map +1 -0
  69. package/public/tinymce/plugins/lists/index.d.ts +1 -0
  70. package/public/tinymce/plugins/lists/index.js +7 -0
  71. package/public/tinymce/plugins/lists/index.mjs +2 -0
  72. package/public/tinymce/plugins/lists/index.mjs.map +1 -0
  73. package/public/tinymce/plugins/lists/plugin.js +2172 -0
  74. package/public/tinymce/plugins/lists/plugin.min.js +4 -0
  75. package/public/tinymce/plugins/lists/plugin.mjs +2 -0
  76. package/public/tinymce/plugins/lists/plugin.mjs.map +1 -0
  77. package/public/tinymce/plugins/table/index.d.ts +1 -0
  78. package/public/tinymce/plugins/table/index.js +7 -0
  79. package/public/tinymce/plugins/table/index.mjs +2 -0
  80. package/public/tinymce/plugins/table/index.mjs.map +1 -0
  81. package/public/tinymce/plugins/table/plugin.js +3462 -0
  82. package/public/tinymce/plugins/table/plugin.min.js +4 -0
  83. package/public/tinymce/plugins/table/plugin.mjs +2 -0
  84. package/public/tinymce/plugins/table/plugin.mjs.map +1 -0
  85. package/public/tinymce/skins/content/default/content.css +61 -0
  86. package/public/tinymce/skins/content/default/content.js +2 -0
  87. package/public/tinymce/skins/content/default/content.min.css +1 -0
  88. package/public/tinymce/skins/content/default/content.mjs +2 -0
  89. package/public/tinymce/skins/content/default/content.mjs.map +1 -0
  90. package/public/tinymce/skins/ui/oxide/content.css +785 -0
  91. package/public/tinymce/skins/ui/oxide/content.inline.css +779 -0
  92. package/public/tinymce/skins/ui/oxide/content.inline.js +2 -0
  93. package/public/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
  94. package/public/tinymce/skins/ui/oxide/content.js +2 -0
  95. package/public/tinymce/skins/ui/oxide/content.min.css +1 -0
  96. package/public/tinymce/skins/ui/oxide/content.mjs +2 -0
  97. package/public/tinymce/skins/ui/oxide/content.mjs.map +1 -0
  98. package/public/tinymce/skins/ui/oxide/skin.css +3763 -0
  99. package/public/tinymce/skins/ui/oxide/skin.js +2 -0
  100. package/public/tinymce/skins/ui/oxide/skin.min.css +1 -0
  101. package/public/tinymce/skins/ui/oxide/skin.mjs +2 -0
  102. package/public/tinymce/skins/ui/oxide/skin.mjs.map +1 -0
  103. package/public/tinymce/skins/ui/oxide/skin.shadowdom.css +30 -0
  104. package/public/tinymce/skins/ui/oxide/skin.shadowdom.js +2 -0
  105. package/public/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  106. package/public/tinymce/skins/ui/oxide-dark/content.css +766 -0
  107. package/public/tinymce/skins/ui/oxide-dark/content.inline.css +779 -0
  108. package/public/tinymce/skins/ui/oxide-dark/content.inline.js +2 -0
  109. package/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
  110. package/public/tinymce/skins/ui/oxide-dark/content.js +2 -0
  111. package/public/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
  112. package/public/tinymce/skins/ui/oxide-dark/skin.css +3766 -0
  113. package/public/tinymce/skins/ui/oxide-dark/skin.js +2 -0
  114. package/public/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
  115. package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +30 -0
  116. package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
  117. package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  118. package/public/tinymce/themes/silver/index.d.ts +1 -0
  119. package/public/tinymce/themes/silver/index.js +7 -0
  120. package/public/tinymce/themes/silver/index.mjs +2 -0
  121. package/public/tinymce/themes/silver/index.mjs.map +1 -0
  122. package/public/tinymce/themes/silver/theme.js +30775 -0
  123. package/public/tinymce/themes/silver/theme.min.js +384 -0
  124. package/public/tinymce/themes/silver/theme.mjs +2 -0
  125. package/public/tinymce/themes/silver/theme.mjs.map +1 -0
  126. package/public/tinymce/tinymce.d.ts +3238 -0
  127. package/public/tinymce/tinymce.js +31779 -0
  128. package/public/tinymce/tinymce.min.js +384 -0
  129. package/public/tinymce/tinymce.mjs +2 -0
  130. package/public/tinymce/tinymce.mjs.map +1 -0
@@ -0,0 +1,2 @@
1
+ import{__exports as e}from"../../../../_virtual/theme.mjs";var t;function o(){return t||(t=1,function(){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,r=e=>t=>e===t,s=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=r(null),d=n("boolean"),u=r(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<n;++o)if(!t(e[o]))return!1;return!0}return!1},b=()=>{},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 D{constructor(e,t){this.tag=e,this.value=t}static some(e){return new D(!0,e)}static none(){return D.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?D.some(e(this.value)):D.none()}bind(e){return this.tag?e(this.value):D.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:D.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return g(e)?D.some(e):D.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()"}}D.singletonNone=new D(!1);const A=Array.prototype.slice,M=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>M.call(e,t),F=(e,t)=>{const o=I(e,t);return-1===o?D.none():D.some(o)},R=(e,t)=>I(e,t)>-1,N=(e,t)=>{for(let o=0,n=e.length;o<n;o++){if(t(e[o],o))return!0}return!1},V=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},z=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const r=A.call(e,n,n+t);o.push(r)}return o},L=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n},H=(e,t)=>{for(let o=0,n=e.length;o<n;o++){t(e[o],o)}},P=(e,t)=>{const o=[],n=[];for(let r=0,s=e.length;r<s;r++){const s=e[r];(t(s,r)?o:n).push(s)}return{pass:o,fail:n}},U=(e,t)=>{const o=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t(r,n)&&o.push(r)}return o},W=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),j=(e,t,o)=>(H(e,((e,n)=>{o=t(o,e,n)})),o),$=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n<r;n++){const r=e[n];if(t(r,n))return D.some(r);if(o(r,n))break}return D.none()})(e,t,T),G=(e,t)=>{for(let o=0,n=e.length;o<n;o++){if(t(e[o],o))return D.some(o)}return D.none()},q=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!l(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);B.apply(t,e[o])}return t},Y=(e,t)=>q(L(e,t)),X=(e,t)=>{for(let o=0,n=e.length;o<n;++o){if(!0!==t(e[o],o))return!1}return!0},K=e=>{const t=A.call(e,0);return t.reverse(),t},J=(e,t)=>U(e,(e=>!R(t,e))),Z=(e,t)=>{const o={};for(let n=0,r=e.length;n<r;n++){const r=e[n];o[String(r)]=t(r,n)}return o},Q=e=>[e],ee=(e,t)=>{const o=A.call(e,0);return o.sort(t),o},te=(e,t)=>t>=0&&t<e.length?D.some(e[t]):D.none(),oe=e=>te(e,0),ne=e=>te(e,e.length-1),re=p(Array.from)?Array.from:e=>A.call(e),se=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return D.none()},ae=Object.keys,ie=Object.hasOwnProperty,le=(e,t)=>{const o=ae(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}},ce=(e,t)=>de(e,((e,o)=>({k:o,v:t(e,o)}))),de=(e,t)=>{const o={};return le(e,((e,n)=>{const r=t(e,n);o[r.k]=r.v})),o},ue=e=>(t,o)=>{e[o]=t},me=(e,t,o,n)=>{le(e,((e,r)=>{(t(e,r)?o:n)(e,r)}))},ge=(e,t)=>{const o={};return me(e,t,ue(o),b),o},pe=(e,t)=>{const o=[];return le(e,((e,n)=>{o.push(t(e,n))})),o},he=(e,t)=>{const o=ae(e);for(let n=0,r=o.length;n<r;n++){const r=o[n],s=e[r];if(t(s,r,e))return D.some(s)}return D.none()},fe=e=>pe(e,w),be=(e,t)=>ve(e,t)?D.from(e[t]):D.none(),ve=(e,t)=>ie.call(e,t),ye=(e,t)=>ve(e,t)&&void 0!==e[t]&&null!==e[t],xe=(e,t,o=S)=>e.exists((e=>o(e,t))),we=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},Se=(e,t,o)=>e.isSome()&&t.isSome()?D.some(o(e.getOrDie(),t.getOrDie())):D.none(),ke=(e,t)=>null!=e?D.some(t(e)):D.none(),Ce=(e,t)=>e?D.some(t):D.none(),Oe=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,_e=(e,t)=>Ee(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Te=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!u(n)||r+t.length<=n)},Ee=(e,t)=>Oe(e,t,0),De=(e,t)=>Oe(e,t,e.length-t.length),Ae=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),Me=e=>e.length>0,Be=e=>!Me(e),Ie=e=>void 0!==e.style&&p(e.style.getPropertyValue),Fe=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Re={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 Fe(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return Fe(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return Fe(o)},fromDom:Fe,fromPoint:(e,t,o)=>D.from(e.dom.elementFromPoint(t,o)).map(Fe)},Ne="undefined"!=typeof window?window:Function("return this;")(),Ve=(e,t)=>((e,t)=>{let o=null!=t?t:Ne;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t),ze=(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},Le=Object.getPrototypeOf,He=e=>{const t=Ve("ownerDocument.defaultView",e);return a(e)&&((e=>ze("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Le(e).constructor.name))},Pe=e=>e.dom.nodeName.toLowerCase(),Ue=e=>t=>(e=>e.dom.nodeType)(t)===e,We=e=>je(e)&&He(e.dom),je=Ue(1),$e=Ue(3),Ge=Ue(9),qe=Ue(11),Ye=e=>t=>je(t)&&Pe(t)===e,Xe=(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")}},Ke=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Je=(e,t)=>e.dom===t.dom,Ze=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Qe=e=>Re.fromDom(e.dom.ownerDocument),et=e=>Ge(e)?e:Qe(e),tt=e=>Re.fromDom(et(e).dom.documentElement),ot=e=>Re.fromDom(et(e).dom.defaultView),nt=e=>D.from(e.dom.parentNode).map(Re.fromDom),rt=e=>D.from(e.dom.parentElement).map(Re.fromDom),st=e=>D.from(e.dom.offsetParent).map(Re.fromDom),at=e=>L(e.dom.childNodes,Re.fromDom),it=(e,t)=>{const o=e.dom.childNodes;return D.from(o[t]).map(Re.fromDom)},lt=e=>it(e,0),ct=(e,t)=>({element:e,offset:t}),dt=(e,t)=>{const o=at(e);return o.length>0&&t<o.length?ct(o[t],0):ct(e,t)},ut=e=>qe(e)&&g(e.dom.host),mt=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),gt=x(mt),pt=mt?e=>Re.fromDom(e.dom.getRootNode()):et,ht=e=>ut(e)?e:Re.fromDom(et(e).dom.body),ft=e=>{const t=pt(e);return ut(t)?D.some(t):D.none()},bt=e=>Re.fromDom(e.dom.host),vt=e=>g(e.dom.shadowRoot),yt=e=>{const t=$e(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ft(Re.fromDom(t)).fold((()=>o.body.contains(t)),(n=yt,r=bt,e=>n(r(e))));var n,r},xt=()=>wt(Re.fromDom(document)),wt=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Re.fromDom(t)},St=(e,t,o)=>{if(!(s(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+"")},kt=(e,t,o)=>{St(e.dom,t,o)},Ct=(e,t)=>{const o=e.dom;le(t,((e,t)=>{St(o,t,e)}))},Ot=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},_t=(e,t)=>D.from(Ot(e,t)),Tt=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Et=(e,t)=>{e.dom.removeAttribute(t)},Dt=(e,t,o)=>{if(!s(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ie(e)&&e.style.setProperty(t,o)},At=(e,t)=>{Ie(e)&&e.style.removeProperty(t)},Mt=(e,t,o)=>{const n=e.dom;Dt(n,t,o)},Bt=(e,t)=>{const o=e.dom;le(t,((e,t)=>{Dt(o,t,e)}))},It=(e,t)=>{const o=e.dom;le(t,((e,t)=>{e.fold((()=>{At(o,t)}),(e=>{Dt(o,t,e)}))}))},Ft=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||yt(e)?n:Rt(o,t)},Rt=(e,t)=>Ie(e)?e.style.getPropertyValue(t):"",Nt=(e,t)=>{const o=e.dom,n=Rt(o,t);return D.from(n).filter((e=>e.length>0))},Vt=e=>{const t={},o=e.dom;if(Ie(o))for(let e=0;e<o.style.length;e++){const n=o.style.item(e);t[n]=o.style[n]}return t},zt=(e,t,o)=>{const n=Re.fromTag(e);Mt(n,t,o);return Nt(n,t).isSome()},Lt=(e,t)=>{const o=e.dom;At(o,t),xe(_t(e,"style").map(Ae),"")&&Et(e,"style")},Ht=e=>e.dom.offsetWidth,Pt=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Ft(o,e);return parseFloat(t)||0}return n},n=(e,t)=>j(t,((t,o)=>{const n=Ft(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r}),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;Ie(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}}},Ut=Pt("height",(e=>{const t=e.dom;return yt(e)?t.getBoundingClientRect().height:t.offsetHeight})),Wt=e=>Ut.get(e),jt=e=>Ut.getOuter(e),$t=(e,t)=>({left:e,top:t,translate:(o,n)=>$t(e+o,t+n)}),Gt=$t,qt=(e,t)=>void 0!==e?e:void 0!==t?t:0,Yt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Gt(o.offsetLeft,o.offsetTop);const s=qt(null==n?void 0:n.pageYOffset,r.scrollTop),a=qt(null==n?void 0:n.pageXOffset,r.scrollLeft),i=qt(r.clientTop,o.clientTop),l=qt(r.clientLeft,o.clientLeft);return Xt(e).translate(a-l,s-i)},Xt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Gt(o.offsetLeft,o.offsetTop):yt(e)?(e=>{const t=e.getBoundingClientRect();return Gt(t.left,t.top)})(t):Gt(0,0)},Kt=Pt("width",(e=>e.dom.offsetWidth)),Jt=e=>Kt.get(e),Zt=e=>Kt.getOuter(e),Qt=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;o<e.length;o++){const n=e[o];if(n.test(t))return n}})(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return to(n(1),n(2))})(e,o)},unknown:eo},no=(e,t)=>{const o=String(t).toLowerCase();return $(e,(e=>e.search(o)))},ro=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,so=e=>t=>Te(t,e),ao=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Te(e,"edge/")&&Te(e,"chrome")&&Te(e,"safari")&&Te(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ro],search:e=>Te(e,"chrome")&&!Te(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Te(e,"msie")||Te(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=>(Te(e,"safari")||Te(e,"mobile/"))&&Te(e,"applewebkit")}],io=[{name:"Windows",search:so("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Te(e,"iphone")||Te(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]+).*/]}],lo={browsers:x(ao),oses:x(io)},co="Edge",uo="Chromium",mo="Opera",go="Firefox",po="Safari",ho=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(co),isChromium:n(uo),isIE:n("IE"),isOpera:n(mo),isFirefox:n(go),isSafari:n(po)}},fo={unknown:()=>ho({current:void 0,version:oo.unknown()}),nu:ho,edge:x(co),chromium:x(uo),ie:x("IE"),opera:x(mo),firefox:x(go),safari:x(po)},bo="Windows",vo="Android",yo="Linux",xo="macOS",wo="Solaris",So="FreeBSD",ko="ChromeOS",Co=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(bo),isiOS:n("iOS"),isAndroid:n(vo),isMacOS:n(xo),isLinux:n(yo),isSolaris:n(wo),isFreeBSD:n(So),isChromeOS:n(ko)}},Oo={unknown:()=>Co({current:void 0,version:oo.unknown()}),nu:Co,windows:x(bo),ios:x("iOS"),android:x(vo),linux:x(yo),macos:x(xo),solaris:x(wo),freebsd:x(So),chromeos:x(ko)},_o=(e,t,o)=>{const n=lo.browsers(),r=lo.oses(),s=t.bind((e=>((e,t)=>se(t.brands,(t=>{const o=t.brand.toLowerCase();return $(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(fo.unknown,fo.nu),a=((e,t)=>no(e,t).map((e=>{const o=oo.detect(e.versionRegexes,t);return{current:e.name,version:o}})))(r,e).fold(Oo.unknown,Oo.nu),i=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),s=e.isiOS()&&!r,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=r||!s&&a&&n("(min-device-width:768px)"),c=s||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:x(r),isiPhone:x(s),isTablet:x(l),isPhone:x(c),isTouch:x(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:x(d),isDesktop:x(u)}})(a,s,e,o);return{browser:s,os:a,deviceType:i}},To=e=>window.matchMedia(e).matches;let Eo=Qt((()=>_o(navigator.userAgent,D.from(navigator.userAgentData),To)));const Do=()=>Eo(),Ao=e=>{const t=Re.fromDom((e=>{if(gt()&&g(e.target)){const t=Re.fromDom(e.target);if(je(t)&&vt(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return oe(t)}}return D.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=y(n,o);return((e,t,o,n,r,s,a)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:s,raw:a}))(t,e.clientX,e.clientY,o,n,r,e)},Mo=(e,t,o,n,r)=>{const s=((e,t)=>o=>{e(o)&&t(Ao(o))})(o,n);return e.dom.addEventListener(t,s,r),{unbind:k(Bo,e,t,s,r)}},Bo=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Io=(e,t)=>{nt(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},Fo=(e,t)=>{const o=(e=>D.from(e.dom.nextSibling).map(Re.fromDom))(e);o.fold((()=>{nt(e).each((e=>{No(e,t)}))}),(e=>{Io(e,t)}))},Ro=(e,t)=>{lt(e).fold((()=>{No(e,t)}),(o=>{e.dom.insertBefore(t.dom,o.dom)}))},No=(e,t)=>{e.dom.appendChild(t.dom)},Vo=(e,t)=>{H(t,(t=>{No(e,t)}))},zo=e=>{e.dom.textContent="",H(at(e),(e=>{Lo(e)}))},Lo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Ho=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Gt(o,n)},Po=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},Uo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Wo=e=>{const t=void 0===e?window:e,o=t.document,n=Ho(Re.fromDom(o));return(e=>{const t=void 0===e?window:e;return Do().browser.isFirefox()?D.none():D.from(t.visualViewport)})(t).fold((()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return Uo(n.left,n.top,o,r)}),(e=>Uo(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height)))},jo=()=>Re.fromDom(document),$o=(e,t)=>e.view(t).fold(x([]),(t=>{const o=e.owner(t),n=$o(e,o);return[t].concat(n)}));var Go=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?D.none():D.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Re.fromDom)},owner:e=>Qe(e)});const qo=e=>{const t=jo(),o=Ho(t),n=((e,t)=>{const o=t.owner(e),n=$o(t,o);return D.some(n)})(e,Go);return n.fold(k(Yt,e),(t=>{const n=Xt(e),r=W(t,((e,t)=>{const o=Xt(t);return{left:e.left+o.left,top:e.top+o.top}}),{left:0,top:0});return Gt(r.left+n.left+o.left,r.top+n.top+o.top)}))},Yo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Xo=e=>{const t=Yt(e),o=Zt(e),n=jt(e);return Yo(t.left,t.top,o,n)},Ko=e=>{const t=qo(e),o=Zt(e),n=jt(e);return Yo(t.left,t.top,o,n)},Jo=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),r=Math.min(e.right,t.right),s=Math.min(e.bottom,t.bottom);return Yo(o,n,r-o,s-n)},Zo=()=>Wo(window);var Qo=tinymce.util.Tools.resolve("tinymce.ThemeManager");const en=e=>{const t=t=>t(e),o=x(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>on.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:()=>D.some(e)};return r},tn=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>on.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:O(String(e)),each:b,toOptional:D.none};return o},on={value:en,error:tn,fromOption:(e,t)=>e.fold((()=>tn(t)),en)};var nn;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(nn||(nn={}));const rn=(e,t,o)=>e.stype===nn.Error?t(e.serror):o(e.svalue),sn=e=>({stype:nn.Value,svalue:e}),an=e=>({stype:nn.Error,serror:e}),ln=e=>e.fold(an,sn),cn=e=>rn(e,on.error,on.value),dn=sn,un=e=>{const t=[],o=[];return H(e,(e=>{rn(e,(e=>o.push(e)),(e=>t.push(e)))})),{values:t,errors:o}},mn=an,gn=(e,t)=>e.stype===nn.Value?t(e.svalue):e,pn=(e,t)=>e.stype===nn.Error?t(e.serror):e,hn=(e,t)=>e.stype===nn.Value?{stype:nn.Value,svalue:t(e.svalue)}:e,fn=(e,t)=>e.stype===nn.Error?{stype:nn.Error,serror:t(e.serror)}:e,bn=rn,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;n<t.length;n++){const r=t[n];for(const t in r)ve(r,t)&&(o[t]=e(o[t],r[t]))}return o},wn=xn(((e,t)=>i(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=>y(mn,q)(e),Tn=e=>{const t=un(e);return t.errors.length>0?_n(t.errors):dn(t.values)},En=e=>a(e)&&ae(e).length>100?" removed due to size":JSON.stringify(e,null,2),Dn=(e,t)=>mn([{path:e,getErrorInfo:t}]),An=e=>({extract:(t,o)=>pn(e(o),(e=>((e,t)=>Dn(e,x(t)))(t,e))),toString:x("val")}),Mn=An(dn),Bn=(e,t,o,n)=>be(t,o).fold((()=>((e,t,o)=>Dn(e,(()=>'Could not find valid *required* value for "'+t+'" in '+En(o))))(e,o,t)),n),In=(e,t,o,n)=>n(be(e,t).getOrThunk((()=>o(e)))),Fn=(e,t,o,n,r)=>{const s=e=>r.extract(t.concat([n]),e),a=e=>e.fold((()=>dn(D.none())),(e=>{const o=r.extract(t.concat([n]),e);return hn(o,D.some)}));switch(e.tag){case"required":return Bn(t,o,n,s);case"defaultedThunk":return In(o,n,e.process,s);case"option":return((e,t,o)=>o(be(e,t)))(o,n,a);case"defaultedOptionThunk":return((e,t,o,n)=>n(be(e,t).map((t=>!0===t?o(e):t))))(o,n,e.process,a);case"mergeWithThunk":return In(o,n,x({}),(t=>{const n=wn(e.process(o),t);return s(n)}))}},Rn=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),Nn=e=>ae(ge(e,g)),Vn=e=>{const t=zn(e),o=W(e,((e,t)=>yn(t,(t=>wn(e,{[t]:!0})),x(e))),{});return{extract:(e,n)=>{const r=d(n)?[]:Nn(n),s=U(r,(e=>!ye(o,e)));return 0===s.length?t.extract(e,n):((e,t)=>Dn(e,(()=>"There are unsupported fields: ["+t.join(", ")+"] specified")))(e,s)},toString:t.toString}},zn=e=>({extract:(t,o)=>((e,t,o)=>{const n={},r=[];for(const s of o)yn(s,((o,s,a,i)=>{const l=Fn(a,e,t,o,i);bn(l,(e=>{r.push(...e)}),(e=>{n[s]=e}))}),((e,o)=>{n[e]=o(t)}));return r.length>0?mn(r):dn(n)})(t,o,e),toString:()=>{const t=L(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=L(o,((o,n)=>e.extract(t.concat(["["+n+"]"]),o)));return Tn(n)},toString:()=>"array("+e.toString()+")"}),Hn=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const r=[];for(const s of e){const e=s.extract(t,n);if(e.stype===nn.Value)return{stype:nn.Value,svalue:o(e.svalue)};r.push(e)}return Tn(r)},toString:()=>"oneOf("+L(e,(e=>e.toString())).join(", ")+")"}},Pn=(e,t)=>({extract:(o,n)=>{const r=ae(n),s=((t,o)=>Ln(An(e)).extract(t,o))(o,r);return gn(s,(e=>{const r=L(e,(e=>vn(e,e,{tag:"required",process:{}},t)));return zn(r).extract(o,n)}))},toString:()=>"setOf("+t.toString()+")"}),Un=y(Ln,zn),Wn=x(Mn),jn=(e,t)=>An((o=>{const n=typeof o;return e(o)?dn(o):mn(`Expected type: ${t} but got: ${n}`)})),$n=jn(h,"number"),Gn=jn(s,"string"),qn=jn(d,"boolean"),Yn=jn(p,"function"),Xn=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=>Xn(e[t])));default:return!1}},Kn=An((e=>Xn(e)?dn(e):mn("Expected value to be acceptable for sending via postMessage"))),Jn=(e,t,o,n)=>be(o,n).fold((()=>((e,t,o)=>Dn(e,(()=>'The chosen schema: "'+o+'" did not exist in branches: '+En(t))))(e,o,n)),(o=>o.extract(e.concat(["branch: "+n]),t))),Zn=(e,t)=>({extract:(o,n)=>be(n,e).fold((()=>((e,t)=>Dn(e,(()=>'Choice schema did not contain choice key: "'+t+'"')))(o,e)),(e=>Jn(o,n,t,e))),toString:()=>"chooseOn("+e+"). Possible values: "+ae(t)}),Qn=e=>An((t=>e(t).fold(mn,dn))),er=(e,t)=>Pn((t=>ln(e(t))),t),tr=(e,t,o)=>cn(((e,t,o)=>{const n=t.extract([e],o);return fn(n,(e=>({input:o,errors:e})))})(e,t,o)),or=e=>e.fold((e=>{throw new Error(rr(e))}),w),nr=(e,t,o)=>or(tr(e,t,o)),rr=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:x("... (only showing first ten failures)")}]):e;return L(t,(e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo()))})(e.errors).join("\n")+"\n\nInput object: "+En(e.input),sr=(e,t)=>Zn(e,ce(t,zn)),ar=(e,t)=>((e,t)=>{const o=Qt(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),ir=vn,lr=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),cr=e=>Qn((t=>R(e,t)?on.value(t):on.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`))),dr=e=>ir(e,e,{tag:"required",process:{}},Wn()),ur=(e,t)=>ir(e,e,{tag:"required",process:{}},t),mr=e=>ur(e,$n),gr=e=>ur(e,Gn),pr=(e,t)=>ir(e,e,{tag:"required",process:{}},cr(t)),hr=e=>ur(e,Yn),fr=(e,t)=>ir(e,e,{tag:"required",process:{}},zn(t)),br=(e,t)=>ir(e,e,{tag:"required",process:{}},Un(t)),vr=(e,t)=>ir(e,e,{tag:"required",process:{}},Ln(t)),yr=e=>ir(e,e,{tag:"option",process:{}},Wn()),xr=(e,t)=>ir(e,e,{tag:"option",process:{}},t),wr=e=>xr(e,$n),Sr=e=>xr(e,Gn),kr=(e,t)=>xr(e,cr(t)),Cr=e=>xr(e,Yn),Or=(e,t)=>xr(e,Ln(t)),_r=(e,t)=>xr(e,zn(t)),Tr=(e,t)=>ir(e,e,Cn(t),Wn()),Er=(e,t,o)=>ir(e,e,Cn(t),o),Dr=(e,t)=>Er(e,t,$n),Ar=(e,t)=>Er(e,t,Gn),Mr=(e,t,o)=>Er(e,t,cr(o)),Br=(e,t)=>Er(e,t,qn),Ir=(e,t)=>Er(e,t,Yn),Fr=(e,t,o)=>Er(e,t,Ln(o)),Rr=(e,t,o)=>Er(e,t,zn(o)),Nr=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Vr=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 H(e,((n,r)=>{const s=ae(n);if(1!==s.length)throw new Error("one and only one name per case");const a=s[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[r].apply(null,o)},match:e=>{const n=ae(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!X(t,(e=>R(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};Vr([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const zr=(e,t)=>((e,t)=>{const o={};return le(e,((e,n)=>{R(t,n)||(o[n]=e)})),o})(e,t),Lr=(e,t)=>((e,t)=>({[e]:t}))(e,t),Hr=e=>(e=>{const t={};return H(e,(e=>{t[e.key]=e.value})),t})(e),Pr=(e,t)=>{const o=(e=>{const t=[],o=[];return H(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,on.error(q(n))):((e,t)=>0===e.length?on.value(t):on.value(wn(t,Sn.apply(void 0,e))))(o.values,t);var n},Ur=e=>p(e)?e:T,Wr=(e,t,o)=>{let n=e.dom;const r=Ur(o);for(;n.parentNode;){n=n.parentNode;const e=Re.fromDom(n),o=t(e);if(o.isSome())return o;if(r(e))break}return D.none()},jr=(e,t,o)=>{const n=t(e),r=Ur(o);return n.orThunk((()=>r(e)?D.none():Wr(e,t,r)))},$r=(e,t)=>Je(e.element,t.event.target),Gr={can:E,abort:T,run:b},qr=e=>{if(!ye(e,"can")&&!ye(e,"abort")&&!ye(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...Gr,...e}},Yr=e=>{const t=((e,t)=>(...o)=>j(e,((e,n)=>e&&t(n).apply(void 0,o)),!0))(e,(e=>e.can)),o=((e,t)=>(...o)=>j(e,((e,n)=>e||t(n).apply(void 0,o)),!1))(e,(e=>e.abort));return{can:t,abort:o,run:(...t)=>{H(e,(e=>{e.run.apply(void 0,t)}))}}},Xr=x,Kr=Xr("touchstart"),Jr=Xr("touchmove"),Zr=Xr("touchend"),Qr=Xr("touchcancel"),es=Xr("mousedown"),ts=Xr("mousemove"),os=Xr("mouseout"),ns=Xr("mouseup"),rs=Xr("mouseover"),ss=Xr("focusin"),as=Xr("focusout"),is=Xr("keydown"),ls=Xr("keyup"),cs=Xr("input"),ds=Xr("change"),us=Xr("click"),ms=Xr("transitioncancel"),gs=Xr("transitionend"),ps=Xr("transitionstart"),hs=Xr("selectstart"),fs=e=>x("alloy."+e),bs={tap:fs("tap")},vs=fs("focus"),ys=fs("blur.post"),xs=fs("paste.post"),ws=fs("receive"),Ss=fs("execute"),ks=fs("focus.item"),Cs=bs.tap,Os=fs("longpress"),_s=fs("sandbox.close"),Ts=fs("typeahead.cancel"),Es=fs("system.init"),Ds=fs("system.touchmove"),As=fs("system.touchend"),Ms=fs("system.scroll"),Bs=fs("system.resize"),Is=fs("system.attached"),Fs=fs("system.detached"),Rs=fs("system.dismissRequested"),Ns=fs("system.repositionRequested"),Vs=fs("focusmanager.shifted"),zs=fs("slotcontainer.visibility"),Ls=fs("system.external.element.scroll"),Hs=fs("change.tab"),Ps=fs("dismiss.tab"),Us=fs("highlight"),Ws=fs("dehighlight"),js=(e,t)=>{Ys(e,e.element,t,{})},$s=(e,t,o)=>{Ys(e,e.element,t,o)},Gs=e=>{js(e,Ss())},qs=(e,t,o)=>{Ys(e,t,o,{})},Ys=(e,t,o,n)=>{const r={target:t,...n};e.getSystem().triggerEvent(o,t,r)},Xs=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Ks=e=>Hr(e),Js=(e,t)=>({key:e,value:qr({abort:t})}),Zs=e=>({key:e,value:qr({run:(e,t)=>{t.event.prevent()}})}),Qs=(e,t)=>({key:e,value:qr({run:t})}),ea=(e,t,o)=>({key:e,value:qr({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),ta=e=>t=>({key:e,value:qr({run:(e,o)=>{$r(e,o)&&t(e,o)}})}),oa=(e,t,o)=>((e,t)=>Qs(e,((o,n)=>{o.getSystem().getByUid(t).each((t=>{Xs(t,t.element,e,n)}))})))(e,t.partUids[o]),na=(e,t)=>Qs(e,((e,o)=>{const n=o.event,r=e.getSystem().getByDom(n.target).getOrThunk((()=>jr(n.target,(t=>e.getSystem().getByDom(t).toOptional()),T).getOr(e)));t(e,r,o)})),ra=e=>Qs(e,((e,t)=>{t.cut()})),sa=e=>Qs(e,((e,t)=>{t.stop()})),aa=(e,t)=>ta(e)(t),ia=ta(Is()),la=ta(Fs()),ca=ta(Es()),da=(e=>t=>Qs(e,t))(Ss()),ua=e=>e.dom.innerHTML,ma=(e,t)=>{const o=Qe(e).dom,n=Re.fromDom(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,at(Re.fromDom(o))})(t,o);Vo(n,r),zo(e),No(e,n)},ga=(e,t)=>Re.fromDom(e.dom.cloneNode(t)),pa=e=>{if(ut(e))return"#shadow-root";{const t=(e=>ga(e,!1))(e);return(e=>{const t=Re.fromTag("div"),o=Re.fromDom(e.dom.cloneNode(!0));return No(t,o),ua(t)})(t)}},ha=e=>pa(e),fa=Ks([((e,t)=>({key:e,value:qr({can:t})}))(vs(),((e,t)=>{const o=t.event,n=o.originator,r=o.target;return!((e,t,o)=>Je(t,e.element)&&!Je(t,o))(e,n,r)||(console.warn(vs()+" did not get interpreted by the desired target. \nOriginator: "+ha(n)+"\nTarget: "+ha(r)+"\nCheck the "+vs()+" event handlers"),!1)}))]);var ba=Object.freeze({__proto__:null,events:fa});let va=0;const ya=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return va++,e+"_"+o+va+String(t)},xa=x("alloy-id-"),wa=x("data-alloy-id"),Sa=xa(),ka=wa(),Ca=(e,t)=>{Object.defineProperty(e.dom,ka,{value:t,writable:!0})},Oa=e=>{const t=je(e)?e.dom[ka]:null;return D.from(t)},_a=e=>ya(e),Ta=w,Ea=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+ha(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}},Da=Ea(),Aa=e=>L(e,(e=>De(e,"/*")?e.substring(0,e.length-2):e)),Ma=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Aa(s)}),e},Ba=ya("alloy-premade"),Ia=e=>(Object.defineProperty(e.element.dom,Ba,{value:e.uid,writable:!0}),Lr(Ba,e)),Fa=e=>be(e,Ba),Ra=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),s=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Aa(s.slice(1))}),e})(((t,...o)=>e(t.getApis(),t,...o)),e),Na={init:()=>Va({readState:x("No State required")})},Va=e=>e,za=(e,t)=>{const o={};return le(e,((e,n)=>{le(e,((e,r)=>{const s=be(o,r).getOr([]);o[r]=s.concat([t(n,e)])}))})),o},La=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),Ha=e=>e.cHandler,Pa=(e,t)=>({name:e,handler:t}),Ua=(e,t)=>{const o={};return H(e,(e=>{o[e.name()]=e.handlers(t)})),o},Wa=(e,t,o,n)=>{const r=((e,t,o)=>{const n={...o,...Ua(t,e)};return za(n,Pa)})(e,o,n);return Ga(r,t)},ja=e=>{const t=(e=>p(e)?{can:E,abort:T,run:e}:e)(e);return(e,o,...n)=>{const r=[e,o].concat(n);t.abort.apply(void 0,r)?o.stop():t.can.apply(void 0,r)&&t.run.apply(void 0,r)}},$a=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const r=ee(o,((o,r)=>{const s=o[t],a=r[t],i=n.indexOf(s),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+s+".\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<l?-1:l<i?1:0}));return on.value(r)}catch(e){return on.error([e])}})("Event: "+o,"name",e,n).map((e=>{const t=L(e,(e=>e.handler));return Yr(t)})):((e,t)=>on.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(L(t,(e=>e.name)),null,2)]))(o,e)},Ga=(e,t)=>{const o=pe(e,((e,o)=>(1===e.length?on.value(e[0].handler):$a(e,t,o)).map((n=>{const r=ja(n),s=e.length>1?U(t[o],(t=>N(e,(e=>e.name===t)))).join(" > "):e[0].name;return Lr(o,((e,t)=>({handler:e,purpose:t}))(r,s))}))));return Pr(o,{})},qa="alloy.base.behaviour",Ya=zn([ir("dom","dom",{tag:"required",process:{}},zn([dr("tag"),Tr("styles",{}),Tr("classes",[]),Tr("attributes",{}),yr("value"),yr("innerHtml")])),dr("components"),dr("uid"),Tr("events",{}),Tr("apis",{}),ir("eventOrder","eventOrder",(e=>On(x(e)))({[Ss()]:["disabling",qa,"toggling","typeaheadevents"],[vs()]:[qa,"focusing","keying"],[Es()]:[qa,"disabling","toggling","representing"],[cs()]:[qa,"representing","streaming","invalidating"],[Fs()]:[qa,"representing","item-events","tooltipping"],[es()]:["focusing",qa,"item-type-events"],[Kr()]:["focusing",qa,"item-type-events"],[rs()]:["item-type-events","tooltipping"],[ws()]:["receiving","reflecting","tooltipping"]}),Wn()),yr("domModification")]),Xa=e=>e.events,Ka=(e,t)=>{const o=Ot(e,t);return void 0===o||""===o?[]:o.split(" ")},Ja=e=>void 0!==e.dom.classList,Za=e=>Ka(e,"class"),Qa=(e,t)=>((e,t,o)=>{const n=Ka(e,t).concat([o]);return kt(e,t,n.join(" ")),!0})(e,"class",t),ei=(e,t)=>((e,t,o)=>{const n=U(Ka(e,t),(e=>e!==o));return n.length>0?kt(e,t,n.join(" ")):Et(e,t),!1})(e,"class",t),ti=(e,t)=>{Ja(e)?e.dom.classList.add(t):Qa(e,t)},oi=e=>{0===(Ja(e)?e.dom.classList:Za(e)).length&&Et(e,"class")},ni=(e,t)=>{if(Ja(e)){e.dom.classList.remove(t)}else ei(e,t);oi(e)},ri=(e,t)=>{const o=Ja(e)?e.dom.classList.toggle(t):((e,t)=>R(Za(e),t)?ei(e,t):Qa(e,t))(e,t);return oi(e),o},si=(e,t)=>Ja(e)&&e.dom.classList.contains(t),ai=(e,t)=>{H(t,(t=>{ti(e,t)}))},ii=(e,t)=>{H(t,(t=>{ni(e,t)}))},li=e=>Ja(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;e<t.length;e++){const n=t.item(e);null!==n&&(o[e]=n)}return o})(e):Za(e),ci=e=>e.dom.value,di=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},ui=(e,t,o)=>{o.fold((()=>No(e,t)),(e=>{Je(e,t)||(Io(e,t),Lo(e))}))},mi=(e,t,o)=>{const n=L(t,o),r=at(e);return H(r.slice(n.length),Lo),n},gi=(e,t,o,n)=>{const r=it(e,t),s=n(o,r),a=((e,t,o)=>it(e,t).map((e=>{if(o.exists((t=>!Je(t,e)))){const t=o.map(Pe).getOr("span"),n=Re.fromTag(t);return Io(e,n),n}return e})))(e,t,r);return ui(e,s.element,a),s},pi=(e,t)=>{const o=ae(e),n=ae(t),r=J(n,o),s=((e,t)=>{const o={},n={};return me(e,t,ue(o),ue(n)),{t:o,f:n}})(e,((e,o)=>!ve(t,o)||e!==t[o])).t;return{toRemove:r,toSet:s}},hi=(e,t)=>{const{class:o,style:n,...r}=(e=>j(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{}))(t),{toSet:s,toRemove:a}=pi(e.attributes,r),i=Vt(t),{toSet:l,toRemove:c}=pi(e.styles,i),d=li(t),u=J(d,e.classes),m=J(e.classes,d);return H(a,(e=>Et(t,e))),Ct(t,s),ai(t,m),ii(t,u),H(c,(e=>Lt(t,e))),Bt(t,l),e.innerHtml.fold((()=>{const o=e.domChildren;((e,t)=>{mi(e,t,((t,o)=>{const n=it(e,o);return ui(e,t,n),t}))})(t,o)}),(e=>{ma(t,e)})),(()=>{const o=t,n=e.value.getOrUndefined();n!==ci(o)&&di(o,null!=n?n:"")})(),t},fi=(e,t)=>{const o=t.filter((t=>Pe(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>ve(e.dom,Ba))(t))).bind((t=>((e,t)=>{try{const o=hi(e,t);return D.some(o)}catch(e){return D.none()}})(e,t))).getOrThunk((()=>(e=>{const t=Re.fromTag(e.tag);Ct(t,e.attributes),ai(t,e.classes),Bt(t,e.styles),e.innerHtml.each((e=>ma(t,e)));const o=e.domChildren;return Vo(t,o),e.value.each((e=>{di(t,e)})),t})(e)));return Ca(o,e.uid),o},bi=(e,t)=>((e,t)=>{const o=L(t,(e=>_r(e.name(),[dr("config"),Tr("state",Na)]))),n=tr("component.behaviours",zn(o),e.behaviours).fold((t=>{throw new Error(rr(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))}),w);return{list:t,data:ce(n,(e=>{const t=e.map((e=>({config:e.config,state:e.state.init(e.config)})));return x(t)}))}})(e,t),vi=e=>{const t=(e=>{const t=be(e,"behaviours").getOr({});return Y(ae(t),(e=>{const o=t[e];return g(o)?[o.me]:[]}))})(e);return bi(e,t)},yi=(e,t,o)=>{const n={...(r=e).dom,uid:r.uid,domChildren:L(r.components,(e=>e.element))};var r;const s=(e=>e.domModification.fold((()=>La({})),La))(e),a={"alloy.base.modification":s},i=t.length>0?((e,t,o,n)=>{const r={...t};H(o,(t=>{r[t.name()]=t.exhibit(e,n)}));const s=za(r,((e,t)=>({name:e,modification:t}))),a=e=>W(e,((e,t)=>({...t.modification,...e})),{}),i=W(s.classes,((e,t)=>t.modification.concat(e)),[]),l=a(s.attributes),c=a(s.styles);return La({classes:i,attributes:l,styles:c})})(o,a,t,n):s;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},xi=(e,t)=>{const o=()=>m,n=Nr(Da),r=or((e=>tr("custom.definition",Ya,e))(e)),s=vi(e),a=(e=>e.list)(s),i=(e=>e.data)(s),l=yi(r,a,i),c=fi(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":Xa(e)};return Wa(o,e.eventOrder,t,n).getOrDie()})(r,a,i),u=Nr(r.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:()=>r.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(Ea(o))},element:c,syncComponents:()=>{const e=at(c),t=Y(e,(e=>n.get().getByDom(e).fold((()=>[]),Q)));u.set(t)},components:u.get,events:d};return m},wi=(e,t)=>{const{events:o,...n}=Ta(e),r=((e,t)=>{const o=be(e,"components").getOr([]);return t.fold((()=>L(o,_i)),(e=>L(o,((t,o)=>Oi(t,it(e,o))))))})(n,t),s={...n,events:{...ba,...o},components:r};return on.value(xi(s,t))},Si=e=>{const t=Re.fromText(e);return ki({element:t})},ki=e=>{const t=nr("external.component",Vn([dr("element"),yr("uid")]),e),o=Nr(Ea()),n=t.uid.getOrThunk((()=>_a("external")));Ca(t.element,n);const r={uid:n,getSystem:o.get,config:D.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(Ea((()=>r)))},getApis:()=>({}),element:t.element,spec:e,readState:x("No state"),syncComponents:b,components:x([]),events:{}};return Ia(r)},Ci=_a,Oi=(e,t)=>Fa(e).getOrThunk((()=>{const o=(e=>ve(e,"uid"))(e)?e:{uid:Ci(""),...e};return wi(o,t).getOrDie()})),_i=e=>Oi(e,D.none()),Ti=Ia;var Ei=(e,t,o,n,r)=>e(o,n)?D.some(o):p(r)&&r(o)?D.none():t(o,n,r);const Di=(e,t,o)=>{let n=e.dom;const r=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=Re.fromDom(n);if(t(e))return D.some(e);if(r(e))break}return D.none()},Ai=(e,t,o)=>Ei(((e,t)=>t(e)),Di,e,t,o),Mi=(e,t,o)=>Ai(e,t,o).isSome(),Bi=(e,t,o)=>Di(e,(e=>Xe(e,t)),o),Ii=(e,t)=>((e,t)=>$(e.dom.childNodes,(e=>t(Re.fromDom(e)))).map(Re.fromDom))(e,(e=>Xe(e,t))),Fi=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ke(o)?D.none():D.from(o.querySelector(e)).map(Re.fromDom)})(t,e),Ri=(e,t,o)=>Ei(((e,t)=>Xe(e,t)),Bi,e,t,o),Ni="aria-controls",Vi=()=>{const e=ya(Ni);return{id:e,link:t=>{kt(t,Ni,e)},unlink:e=>{Et(e,Ni)}}},zi=(e,t)=>(e=>Ai(e,(e=>{if(!je(e))return!1;const t=Ot(e,"id");return void 0!==t&&t.indexOf(Ni)>-1})).bind((e=>{const t=Ot(e,"id"),o=pt(e);return Fi(o,`[${Ni}="${t}"]`)})))(t).exists((t=>Li(e,t))),Li=(e,t)=>Mi(t,(t=>Je(t,e.element)),T)||zi(e,t),Hi="unknown";var Pi;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(Pi||(Pi={}));const Ui=Nr({}),Wi=(e,t,o)=>{switch(be(Ui.get(),e).orThunk((()=>{const t=ae(Ui.get());return se(t,(t=>e.indexOf(t)>-1?D.some(Ui.get()[t]):D.none()))})).getOr(Pi.NORMAL)){case Pi.NORMAL:return o(Gi());case Pi.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 r=(new Date).getTime();R(["mousemove","mouseover","mouseout",Es()],e)||console.log(e,{event:e,time:r-n,target:t.dom,sequence:L(o,(e=>R(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ha(e.target)+")":e.outcome))})}}})(e,t),r=o(n);return n.write(),r}case Pi.STOP:return!0}},ji=["alloy/data/Fields","alloy/debugging/Debugging"],$i=(e,t,o)=>Wi(e,t,o),Gi=x({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),qi=x([dr("menu"),dr("selectedMenu")]),Yi=x([dr("item"),dr("selectedItem")]);x(zn(Yi().concat(qi())));const Xi=x(zn(Yi())),Ki=fr("initSize",[dr("numColumns"),dr("numRows")]),Ji=()=>fr("markers",[dr("backgroundMenu")].concat(qi()).concat(Yi())),Zi=e=>fr("markers",L(e,dr)),Qi=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");return $(t,(e=>e.indexOf("alloy")>0&&!N(ji,(t=>e.indexOf(t)>-1)))).getOr(Hi)}})(),ir(t,t,o,Qn((e=>on.value(((...t)=>e.apply(void 0,t))))))),el=e=>Qi(0,e,Cn(b)),tl=e=>Qi(0,e,Cn(D.none)),ol=e=>Qi(0,e,{tag:"required",process:{}}),nl=e=>Qi(0,e,{tag:"required",process:{}}),rl=(e,t)=>lr(e,x(t)),sl=e=>lr(e,w),al=x(Ki),il=(e,t,o,n,r,s,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:r,restriction:s,label:`${a}-${r}`,alwaysFit:i}),ll=Vr([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),cl=ll.southeast,dl=ll.southwest,ul=ll.northeast,ml=ll.northwest,gl=ll.south,pl=ll.north,hl=ll.east,fl=ll.west,bl=(e,t,o,n)=>{const r=e+t;return r>n?o:r<o?n:r},vl=(e,t,o)=>Math.min(Math.max(e,t),o),yl=(e,t)=>Z(["left","right","top","bottom"],(o=>be(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))))),xl="layout",wl=e=>e.x,Sl=(e,t)=>e.x+e.width/2-t.width/2,kl=(e,t)=>e.x+e.width-t.width,Cl=(e,t)=>e.y-t.height,Ol=e=>e.y+e.height,_l=(e,t)=>e.y+e.height/2-t.height/2,Tl=(e,t,o)=>il(wl(e),Ol(e),o.southeast(),cl(),"southeast",yl(e,{left:1,top:3}),xl),El=(e,t,o)=>il(kl(e,t),Ol(e),o.southwest(),dl(),"southwest",yl(e,{right:0,top:3}),xl),Dl=(e,t,o)=>il(wl(e),Cl(e,t),o.northeast(),ul(),"northeast",yl(e,{left:1,bottom:2}),xl),Al=(e,t,o)=>il(kl(e,t),Cl(e,t),o.northwest(),ml(),"northwest",yl(e,{right:0,bottom:2}),xl),Ml=(e,t,o)=>il(Sl(e,t),Cl(e,t),o.north(),pl(),"north",yl(e,{bottom:2}),xl),Bl=(e,t,o)=>il(Sl(e,t),Ol(e),o.south(),gl(),"south",yl(e,{top:3}),xl),Il=(e,t,o)=>il((e=>e.x+e.width)(e),_l(e,t),o.east(),hl(),"east",yl(e,{left:0}),xl),Fl=(e,t,o)=>il(((e,t)=>e.x-t.width)(e,t),_l(e,t),o.west(),fl(),"west",yl(e,{right:1}),xl),Rl=()=>[Tl,El,Dl,Al,Bl,Ml,Il,Fl],Nl=()=>[El,Tl,Al,Dl,Bl,Ml,Il,Fl],Vl=()=>[Dl,Al,Tl,El,Ml,Bl],zl=()=>[Al,Dl,El,Tl,Ml,Bl],Ll=()=>[Tl,El,Dl,Al,Bl,Ml],Hl=()=>[El,Tl,Al,Dl,Bl,Ml];var Pl=Object.freeze({__proto__:null,events:e=>Ks([Qs(ws(),((t,o)=>{const n=e.channels,r=ae(n),s=o,a=((e,t)=>t.universal?e:U(e,(e=>R(t.channels,e))))(r,s);H(a,(e=>{const o=n[e],r=o.schema,a=nr("channel["+e+"] data\nReceiver: "+ha(t.element),r,s.data);o.onReceive(t,a)}))}))])}),Ul=[ur("channels",er(on.value,Vn([ol("onReceive"),Tr("schema",Wn())])))];const Wl=(e,t,o)=>ca(((n,r)=>{o(n,e,t)})),jl=(e,t,o)=>((e,t,o)=>{const n=o.toString(),r=n.indexOf(")")+1,s=n.indexOf("("),a=n.substring(s+1,r-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:Aa(a.slice(0,1).concat(a.slice(3)))}),e})(((n,...r)=>{const s=[n].concat(r);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(s,1);return t.apply(void 0,[n,e.config,e.state].concat(o))}))}),o,t),$l=e=>({key:e,value:void 0}),Gl=(e,t,o,n,r,s,a)=>{const i=e=>ye(e,o)?e[o]():D.none(),l=ce(r,((e,t)=>jl(o,e,t))),c={...ce(s,((e,t)=>Ma(e,t))),...l,revoke:k($l,o),config:t=>{const n=nr(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:Qt((()=>nr(o+"-config",e,t))),initialConfig:t,state:a}}},schema:x(t),exhibit:(e,t)=>Se(i(e),be(n,"exhibit"),((e,o)=>o(t,e.config,e.state))).getOrThunk((()=>La({}))),name:x(o),handlers:e=>i(e).map((e=>be(n,"events").getOr((()=>({})))(e.config,e.state))).getOr({})};return c},ql=e=>Hr(e),Yl=Vn([dr("fields"),dr("name"),Tr("active",{}),Tr("apis",{}),Tr("state",Na),Tr("extra",{})]),Xl=e=>{const t=nr("Creating behaviour: "+e.name,Yl,e);return((e,t,o,n,r,s)=>{const a=Vn(e),i=_r(t,[(l="config",c=e,xr(l,Vn(c)))]);var l,c;return Gl(a,i,t,o,n,r,s)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},Kl=Vn([dr("branchKey"),dr("branches"),dr("name"),Tr("active",{}),Tr("apis",{}),Tr("state",Na),Tr("extra",{})]),Jl=e=>{const t=nr("Creating behaviour: "+e.name,Kl,e);return((e,t,o,n,r,s)=>{const a=e,i=_r(t,[xr("config",e)]);return Gl(a,i,t,o,n,r,s)})(sr(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},Zl=x(void 0),Ql=Xl({fields:Ul,name:"receiving",active:Pl});var ec=Object.freeze({__proto__:null,exhibit:(e,t)=>La({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const tc=(e,t=!1)=>e.dom.focus({preventScroll:t}),oc=e=>e.dom.blur(),nc=e=>{const t=pt(e).dom;return e.dom===t.activeElement},rc=(e=jo())=>D.from(e.dom.activeElement).map(Re.fromDom),sc=e=>rc(pt(e)).filter((t=>e.dom.contains(t.dom))),ac=(e,t)=>{const o=pt(t),n=rc(o).bind((e=>{const o=t=>Je(e,t);return o(t)?D.some(t):((e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const r=Re.fromDom(e.childNodes[n]);if(t(r))return D.some(r);const s=o(e.childNodes[n]);if(s.isSome())return s}return D.none()};return o(e.dom)})(t,o)})),r=e(t);return n.each((e=>{rc(o).filter((t=>Je(t,e))).fold((()=>{tc(e)}),b)})),r},ic=(e,t,o,n,r)=>{const s=e=>e+"px";return{position:e,left:t.map(s),top:o.map(s),right:n.map(s),bottom:r.map(s)}},lc=(e,t)=>{It(e,(e=>({...e,position:D.some(e.position)}))(t))},cc=Vr([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),dc=(e,t,o,n,r,s)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=r-(i+a.width),d=s-(l+a.height),u=D.some(i),m=D.some(l),g=D.some(c),p=D.some(d),h=D.none();return((e,t,o,n,r,s,a,i,l)=>e.fold(t,o,n,r,s,a,i,l))(t.direction,(()=>ic(e,u,m,h,h)),(()=>ic(e,h,m,g,h)),(()=>ic(e,u,h,h,p)),(()=>ic(e,h,h,g,p)),(()=>ic(e,u,m,h,h)),(()=>ic(e,u,h,h,p)),(()=>ic(e,u,m,h,h)),(()=>ic(e,h,m,g,h)))},uc=(e,t)=>e.fold((()=>{const e=t.rect;return ic("absolute",D.some(e.x),D.some(e.y),D.none(),D.none())}),((e,o,n,r)=>dc("absolute",t,e,o,n,r)),((e,o,n,r)=>dc("fixed",t,e,o,n,r))),mc=(e,t)=>{const o=k(qo,t),n=e.fold(o,o,(()=>{const e=Ho();return qo(t).translate(-e.left,-e.top)})),r=Zt(t),s=jt(t);return Yo(n.left,n.top,r,s)},gc=(e,t)=>t.fold((()=>e.fold(Zo,Zo,Yo)),(t=>e.fold(x(t),x(t),(()=>{const o=pc(e,t.x,t.y);return Yo(o.left,o.top,t.width,t.height)})))),pc=(e,t,o)=>{const n=Gt(t,o);return e.fold(x(n),x(n),(()=>{const e=Ho();return n.translate(-e.left,-e.top)}))};cc.none;const hc=cc.relative,fc=cc.fixed,bc=(e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t),vc="data-alloy-placement",yc=e=>_t(e,vc),xc=Vr([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),wc=(e,t,o,n)=>{const r=e.bubble,s=r.offset,a=((e,t,o)=>{const n=(n,r)=>t[n].map((t=>{const s="top"===n||"bottom"===n,a=s?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,r)+a;return s?vl(i,e.y,e.bottom):vl(i,e.x,e.right)})).getOr(r),r=n("left",e.x),s=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Yo(r,s,a-r,i-s)})(n,e.restriction,s),i=e.x+s.left,l=e.y+s.top,c=Yo(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=((e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:a>=o&&a<=r&&i>=n&&i<=s,sizeInBounds:l<=r&&l>=o&&c<=s&&c>=n,visibleW:Math.min(d,a>=o?r-a:l-o),visibleH:Math.min(u,i>=n?s-i:c-n)}})(c,a),p=d&&u,h=p?c:((e,t)=>{const{x:o,y:n,right:r,bottom:s}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,r-l),u=Math.max(n,s-c),m=vl(a,o,d),g=vl(i,n,u),p=Math.min(m+l,r)-m,h=Math.min(g+c,s)-g;return Yo(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),r=x(o.bottom-t.y),s=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,r,r,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:s}})(e.direction,h,n),y={rect:h,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:r.classesOn,off:r.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?xc.fit(y):xc.nofit(y,m,g,f)},Sc=e=>{const t=Nr(D.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(D.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(D.some(e))}}},kc=()=>Sc((e=>e.unbind())),Cc=()=>{const e=Sc(b);return{...e,on:t=>e.get().each(t)}},Oc=E,_c=(e,t,o)=>((e,t,o,n)=>Mo(e,t,o,n,!1))(e,t,Oc,o),Tc=(e,t,o)=>((e,t,o,n)=>Mo(e,t,o,n,!0))(e,t,Oc,o),Ec=Ao,Dc=["top","bottom","right","left"],Ac="data-alloy-transition-timer",Mc=(e,t)=>((e,t)=>X(t,(t=>si(e,t))))(e,t.classes),Bc=(e,t)=>{const o=e=>parseFloat(e).toFixed(3);return he(t,((t,n)=>!((e,t,o=S)=>Se(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o)))).isSome()},Ic=(e,t)=>{const o=kc(),n=kc();let r;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return Je(t.target,e)&&Be(n)&&R(Dc,t.raw.propertyName)},i=s=>{if(m(s)||a(s)){o.clear(),n.clear();const a=null==s?void 0:s.raw.type;(m(a)||a===gs())&&(clearTimeout(r),Et(e,Ac),ii(e,t.classes))}},l=_c(e,ps(),(t=>{a(t)&&(l.unbind(),o.set(_c(e,gs(),i)),n.set(_c(e,ms(),i)))})),c=(e=>{const t=t=>{const o=Ft(e,t).split(/\s*,\s*/);return U(o,Me)},o=e=>{if(s(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return De(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),r=t("transition-duration");return j(r,((e,t,r)=>{const s=o(n[r])+o(t);return Math.max(e,s)}),0)})(e);requestAnimationFrame((()=>{r=setTimeout(i,c+17),kt(e,Ac,r)}))},Fc=(e,t,o,n,r,s)=>{const a=((e,t,o)=>o.exists((o=>{const n=e.mode;return"all"===n||o[n]!==t[n]})))(n,r,s);if(a||Mc(e,n)){Mt(e,"position",o.position);const s=mc(t,e),i=uc(t,{...r,rect:s}),l=Z(Dc,(e=>i[e]));Bc(o,l)&&(It(e,l),a&&((e,t)=>{ai(e,t.classes),_t(e,Ac).each((t=>{clearTimeout(parseInt(t,10)),Et(e,Ac)})),Ic(e,t)})(e,n),Ht(e))}else ii(e,n.classes)},Rc=(e,t,o,n)=>{Lt(t,"max-height"),Lt(t,"max-width");const r={width:Zt(s=t),height:jt(s)};var s;return((e,t,o,n,r,s)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,r,e,s),g=wc(m,a,i,s);return g.fold(x(g),((e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?g:xc.nofit(l,c,d,u)))},c=j(t,((e,t)=>{const o=k(l,t);return e.fold(x(e),o)}),xc.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:cl(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1));return c.fold(w,w)})(t,n.preference,e,r,o,n.bounds)},Nc=(e,t)=>{((e,t)=>{kt(e,vc,t)})(e,t.placement)},Vc=(e,t)=>{((e,t)=>{const o=Ut.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);Mt(e,"max-height",o+"px")})(e,Math.floor(t))},zc=x(((e,t)=>{Vc(e,t),Bt(e,{"overflow-x":"hidden","overflow-y":"auto"})})),Lc=x(((e,t)=>{Vc(e,t)})),Hc=(e,t,o)=>void 0===e[t]?o:e[t],Pc=(e,t,o,n)=>{const r=Rc(e,t,o,n);return((e,t,o)=>{const n=uc(o.origin,t);o.transition.each((r=>{Fc(e,o.origin,n,r,t,o.lastPlacement)})),lc(e,n)})(t,r,n),Nc(t,r),((e,t)=>{const o=t.classes;ii(e,o.off),ai(e,o.on)})(t,r),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,r,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,r,n),{layout:r.layout,placement:r.placement}},Uc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],Wc=(e,t,o,n=1)=>{const r=e*n,s=t*n,a=e=>be(o,e).getOr([]),i=(e,t,o)=>{const n=J(Uc,o);return{offset:Gt(e,t),classesOn:Y(o,a),classesOff:Y(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(r,s,["top","alignLeft","inset"]),insetNorthwest:()=>i(-r,s,["top","alignRight","inset"]),insetNorth:()=>i(-r/2,s,["top","alignCentre","inset"]),insetSoutheast:()=>i(r,-s,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-r,-s,["bottom","alignRight","inset"]),insetSouth:()=>i(-r/2,-s,["bottom","alignCentre","inset"]),insetEast:()=>i(-r,-s/2,["valignCentre","right","inset"]),insetWest:()=>i(r,-s/2,["valignCentre","left","inset"])}},jc=()=>Wc(0,0,{}),$c=w,Gc=(e,t)=>o=>"rtl"===qc(o)?t:e,qc=e=>"rtl"===Ft(e,"direction")?"rtl":"ltr";var Yc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Yc||(Yc={}));const Xc="data-alloy-vertical-dir",Kc=e=>Mi(e,(e=>je(e)&&Ot(e,"data-alloy-vertical-dir")===Yc.BottomToTop)),Jc=()=>_r("layouts",[dr("onLtr"),dr("onRtl"),yr("onBottomLtr"),yr("onBottomRtl")]),Zc=(e,t,o,n,r,s,a)=>{const i=a.map(Kc).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(r):l.getOr(o),u=i?t.layouts.bind((t=>t.onBottomRtl.map((t=>t(e))))).or(c).getOr(s):c.getOr(n);return Gc(d,u)(e)};var Qc=[dr("hotspot"),yr("bubble"),Tr("overrides",{}),Jc(),rl("placement",((e,t,o)=>{const n=t.hotspot,r=mc(o,n.element),s=Zc(e.element,t,Ll(),Hl(),Vl(),zl(),D.some(t.hotspot.element));return D.some($c({anchorBox:r,bubble:t.bubble.getOr(jc()),overrides:t.overrides,layouts:s}))}))];var ed=[dr("x"),dr("y"),Tr("height",0),Tr("width",0),Tr("bubble",jc()),Tr("overrides",{}),Jc(),rl("placement",((e,t,o)=>{const n=pc(o,t.x,t.y),r=Yo(n.left,n.top,t.width,t.height),s=Zc(e.element,t,Rl(),Nl(),Rl(),Nl(),D.none());return D.some($c({anchorBox:r,bubble:t.bubble,overrides:t.overrides,layouts:s}))}))];const td=Vr([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),od=e=>e.fold(w,((e,t,o)=>e.translate(-t,-o))),nd=e=>e.fold(w,w),rd=e=>j(e,((e,t)=>e.translate(t.left,t.top)),Gt(0,0)),sd=e=>{const t=L(e,nd);return rd(t)},ad=td.screen,id=td.absolute,ld=(e,t,o)=>{const n=Qe(e.element),r=Ho(n),s=((e,t,o)=>{const n=ot(o.root).dom;return D.from(n.frameElement).map(Re.fromDom).filter((t=>{const o=Qe(t),n=Qe(e.element);return Je(o,n)})).map(Yt)})(e,0,o).getOr(r);return id(s,r.left,r.top)},cd=(e,t,o,n)=>{const r=ad(Gt(e,t));return D.some(((e,t,o)=>({point:e,width:t,height:o}))(r,o,n))},dd=(e,t,o,n,r)=>e.map((e=>{const s=[t,e.point],a=(i=()=>sd(s),l=()=>sd(s),c=()=>(e=>{const t=L(e,od);return rd(t)})(s),n.fold(i,l,c));var i,l,c;const d=((e,t,o,n)=>({x:e,y:t,width:o,height:n}))(a.left,a.top,e.width,e.height),u=o.showAbove?Vl():Ll(),m=o.showAbove?zl():Hl(),g=Zc(r,o,u,m,u,m,D.none());return $c({anchorBox:d,bubble:o.bubble.getOr(jc()),overrides:o.overrides,layouts:g})}));var ud=[dr("node"),dr("root"),yr("bubble"),Jc(),Tr("overrides",{}),Tr("showAbove",!1),rl("placement",((e,t,o)=>{const n=ld(e,0,t);return t.node.filter(yt).bind((r=>{const s=r.dom.getBoundingClientRect(),a=cd(s.left,s.top,s.width,s.height),i=t.node.getOr(e.element);return dd(a,n,t,o,i)}))}))];const md=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),gd=Vr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),pd=(gd.before,gd.on,gd.after,e=>e.fold(w,w,w)),hd=Vr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),fd={domRange:hd.domRange,relative:hd.relative,exact:hd.exact,exactFromRange:e=>hd.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Re.fromDom(e.startContainer),relative:(e,t)=>pd(e),exact:(e,t,o,n)=>e}))(e);return ot(t)},range:md},bd=(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},vd=(e,t,o,n,r)=>{const s=e.document.createRange();return s.setStart(t.dom,o),s.setEnd(n.dom,r),s},yd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),xd=Vr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),wd=(e,t,o)=>t(Re.fromDom(o.startContainer),o.startOffset,Re.fromDom(o.endContainer),o.endOffset),Sd=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:x(e),rtl:D.none}),relative:(t,o)=>({ltr:Qt((()=>bd(e,t,o))),rtl:Qt((()=>D.some(bd(e,o,t))))}),exact:(t,o,n,r)=>({ltr:Qt((()=>vd(e,t,o,n,r))),rtl:Qt((()=>D.some(vd(e,n,r,t,o))))})}))(e,t);return((e,t)=>{const o=t.ltr();if(o.collapsed)return t.rtl().filter((e=>!1===e.collapsed)).map((e=>xd.rtl(Re.fromDom(e.endContainer),e.endOffset,Re.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>wd(0,xd.ltr,o)));return wd(0,xd.ltr,o)})(0,o)},kd=(e,t)=>Sd(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}});xd.ltr,xd.rtl;const Cd=(e,t,o)=>U(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Re.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r})(e,o),t),Od=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ke(o)?[]:L(o.querySelectorAll(e),Re.fromDom)})(t,e),_d=(e,t,o,n)=>{const r=((e,t,o,n)=>{const r=Qe(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),s=Je(e,o)&&t===n;return r.collapsed&&!s},Td=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return D.some(md(Re.fromDom(t.startContainer),t.startOffset,Re.fromDom(o.endContainer),o.endOffset))}return D.none()},Ed=e=>{if(null===e.anchorNode||null===e.focusNode)return Td(e);{const t=Re.fromDom(e.anchorNode),o=Re.fromDom(e.focusNode);return _d(t,e.anchorOffset,o,e.focusOffset)?D.some(md(t,e.anchorOffset,o,e.focusOffset)):Td(e)}},Dd=e=>(e=>D.from(e.getSelection()))(e).filter((e=>e.rangeCount>0)).bind(Ed),Ad=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?D.some(o).map(yd):D.none()})(kd(e,t)),Md=(e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?D.some(t).map(yd):D.none()})(kd(e,t)),Bd=((e,t)=>{const o=t=>e(t)?D.from(t.dom.nodeValue):D.none();return{get:n=>{if(!e(n))throw new Error("Can only get "+t+" value of a "+t+" node");return o(n).getOr("")},getOption:o,set:(o,n)=>{if(!e(o))throw new Error("Can only set raw "+t+" value of a "+t+" node");o.dom.nodeValue=n}}})($e,"text"),Id=(e,t)=>({element:e,offset:t}),Fd=(e,t)=>{const o=at(e);if(0===o.length)return Id(e,t);if(t<o.length)return Id(o[t],0);{const e=o[o.length-1],t=$e(e)?(e=>Bd.get(e))(e).length:at(e).length;return Id(e,t)}},Rd=(e,t)=>$e(e)?Id(e,t):Fd(e,t),Nd=e=>void 0!==e.foffset,Vd=(e,t)=>t.getSelection.getOrThunk((()=>()=>Dd(e)))().map((e=>{if(Nd(e)){const t=Rd(e.start,e.soffset),o=Rd(e.finish,e.foffset);return fd.range(t.element,t.offset,o.element,o.offset)}return e}));var zd=[yr("getSelection"),dr("root"),yr("bubble"),Jc(),Tr("overrides",{}),Tr("showAbove",!1),rl("placement",((e,t,o)=>{const n=ot(t.root).dom,r=ld(e,0,t),s=Vd(n,t).bind((e=>{if(Nd(e)){const t=Md(n,fd.exactFromRange(e)).orThunk((()=>{const t=Re.fromText("\ufeff");Io(e.start,t);const o=Ad(n,fd.exact(t,0,t,1));return Lo(t),o}));return t.bind((e=>cd(e.left,e.top,e.width,e.height)))}{const t=ce(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 cd(o.left,o.top,o.right-o.left,o.bottom-o.top)}})),a=Vd(n,t).bind((e=>Nd(e)?je(e.start)?D.some(e.start):rt(e.start):D.some(e.firstCell))).getOr(e.element);return dd(s,r,t,o,a)}))];const Ld="link-layout",Hd=e=>e.x+e.width,Pd=(e,t)=>e.x-t.width,Ud=(e,t)=>e.y-t.height+e.height,Wd=e=>e.y,jd=(e,t,o)=>il(Hd(e),Wd(e),o.southeast(),cl(),"southeast",yl(e,{left:0,top:2}),Ld),$d=(e,t,o)=>il(Pd(e,t),Wd(e),o.southwest(),dl(),"southwest",yl(e,{right:1,top:2}),Ld),Gd=(e,t,o)=>il(Hd(e),Ud(e,t),o.northeast(),ul(),"northeast",yl(e,{left:0,bottom:3}),Ld),qd=(e,t,o)=>il(Pd(e,t),Ud(e,t),o.northwest(),ml(),"northwest",yl(e,{right:1,bottom:3}),Ld),Yd=()=>[jd,$d,Gd,qd],Xd=()=>[$d,jd,qd,Gd];var Kd=[dr("item"),Jc(),Tr("overrides",{}),rl("placement",((e,t,o)=>{const n=mc(o,t.item.element),r=Zc(e.element,t,Yd(),Xd(),Yd(),Xd(),D.none());return D.some($c({anchorBox:n,bubble:jc(),overrides:t.overrides,layouts:r}))}))],Jd=sr("type",{selection:zd,node:ud,hotspot:Qc,submenu:Kd,makeshift:ed});const Zd=[vr("classes",Gn),Mr("mode","all",["all","layout","placement"])],Qd=[Tr("useFixed",T),yr("getBounds")],eu=[ur("anchor",Jd),_r("transition",Zd)],tu=(e,t,o,n,r,s)=>((e,t,o,n,r,s,a,i)=>{const l=Hc(a,"maxHeightFunction",zc()),c=Hc(a,"maxWidthFunction",b),d=e.anchorBox,u=e.origin,m={bounds:gc(u,s),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:r,transition:i};return Pc(d,t,o,m)})(bc(t.anchorBox,e),n.element,t.bubble,t.layouts,r,o,t.overrides,s),ou=(e,t,o,n,r,s)=>{const a=nr("placement.info",zn(eu),r),i=a.anchor,l=n.element,c=o.get(n.uid);ac((()=>{Mt(l,"position","fixed");const r=Nt(l,"visibility");Mt(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return fc(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Yt(e.element),o=e.element.dom.getBoundingClientRect();return hc(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each((e=>{const r=s.orThunk((()=>t.getBounds.map(_))),i=tu(d,e,r,n,c,a.transition);o.set(n.uid,i)})),r.fold((()=>{Lt(l,"visibility")}),(e=>{Mt(l,"visibility",e)})),Nt(l,"left").isNone()&&Nt(l,"top").isNone()&&Nt(l,"right").isNone()&&Nt(l,"bottom").isNone()&&xe(Nt(l,"position"),"fixed")&&Lt(l,"position")}),l)};var nu=Object.freeze({__proto__:null,position:(e,t,o,n,r)=>{const s=D.none();ou(e,t,o,n,r,s)},positionWithinBounds:ou,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const r=n.element;H(["position","left","right","top","bottom"],(e=>Lt(r,e))),(e=>{Et(e,vc)})(r),o.clear(n.uid)}});const ru=Xl({fields:Qd,name:"positioning",active:ec,apis:nu,state:Object.freeze({__proto__:null,init:()=>{let e={};return Va({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>be(e,t)})}})}),su=e=>e.getSystem().isConnected(),au=e=>{js(e,Fs());const t=e.components();H(t,au)},iu=e=>{const t=e.components();H(t,iu),js(e,Is())},lu=(e,t)=>{e.getSystem().addToWorld(t),yt(e.element)&&iu(t)},cu=e=>{au(e),e.getSystem().removeFromWorld(e)},du=(e,t)=>{No(e.element,t.element)},uu=(e,t,o)=>{const n=e.components();(e=>{H(e.components(),(e=>Lo(e.element))),zo(e.element),e.syncComponents()})(e);const r=o(t),s=J(n,r);H(s,(t=>{au(t),e.getSystem().removeFromWorld(t)})),H(r,(t=>{su(t)?du(e,t):(e.getSystem().addToWorld(t),du(e,t),yt(e.element)&&iu(t))})),e.syncComponents()},mu=(e,t)=>{gu(e,t,No)},gu=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),yt(e.element)&&iu(t),e.syncComponents()},pu=e=>{au(e),Lo(e.element),e.getSystem().removeFromWorld(e)},hu=e=>{const t=nt(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()));pu(e),t.each((e=>{e.syncComponents()}))},fu=e=>{const t=e.components();H(t,pu),zo(e.element),e.syncComponents()},bu=(e,t)=>{yu(e,t,No)},vu=(e,t)=>{yu(e,t,Fo)},yu=(e,t,o)=>{o(e,t.element);const n=at(t.element);H(n,(e=>{t.getByDom(e).each(iu)}))},xu=e=>{const t=at(e.element);H(t,(t=>{e.getByDom(t).each(au)})),Lo(e.element)},wu=(e,t,o,n)=>{o.get().each((t=>{fu(e)}));const r=t.getAttachPoint(e);mu(r,e);const s=e.getSystem().build(n);return mu(e,s),o.set(s),s},Su=(e,t,o,n)=>{const r=wu(e,t,o,n);return t.onOpen(e,r),r},ku=(e,t,o)=>{o.get().each((n=>{fu(e),hu(e),t.onClose(e,n),o.clear()}))},Cu=(e,t,o)=>o.isOpen(),Ou=(e,t,o)=>{const n=t.getAttachPoint(e);Mt(e.element,"position",ru.getMode(n)),((e,t,o,n)=>{Nt(e.element,t).fold((()=>{Et(e.element,o)}),(t=>{kt(e.element,o,t)})),Mt(e.element,t,n)})(e,"visibility",t.cloakVisibilityAttr,"hidden")},_u=(e,t,o)=>{(e=>N(["top","left","right","bottom"],(t=>Nt(e,t).isSome())))(e.element)||Lt(e.element,"position"),((e,t,o)=>{_t(e.element,o).fold((()=>Lt(e.element,t)),(o=>Mt(e.element,t,o)))})(e,"visibility",t.cloakVisibilityAttr)};var Tu=Object.freeze({__proto__:null,cloak:Ou,decloak:_u,open:Su,openWhileCloaked:(e,t,o,n,r)=>{Ou(e,t),Su(e,t,o,n),r(),_u(e,t)},close:ku,isOpen:Cu,isPartOf:(e,t,o,n)=>Cu(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((()=>wu(e,t,o,n)))});var Eu=Object.freeze({__proto__:null,events:(e,t)=>Ks([Qs(_s(),((o,n)=>{ku(o,e,t)}))])}),Du=[el("onOpen"),el("onClose"),dr("isPartOf"),dr("getAttachPoint"),Tr("cloakVisibilityAttr","data-precloak-visibility")];var Au=Object.freeze({__proto__:null,init:()=>{const e=Cc(),t=x("not-implemented");return Va({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Mu=Xl({fields:Du,name:"sandboxing",active:Eu,apis:Tu,state:Au}),Bu=x("dismiss.popups"),Iu=x("reposition.popups"),Fu=x("mouse.released"),Ru=Vn([Tr("isExtraPart",T),_r("fireEventInstead",[Tr("event",Rs())])]),Nu=e=>{const t=nr("Dismissal",Ru,e);return{[Bu()]:{schema:Vn([dr("target")]),onReceive:(e,o)=>{if(Mu.isOpen(e)){Mu.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold((()=>Mu.close(e)),(t=>js(e,t.event)))}}}}},Vu=Vn([_r("fireEventInstead",[Tr("event",Ns())]),hr("doReposition")]),zu=e=>{const t=nr("Reposition",Vu,e);return{[Iu()]:{onReceive:e=>{Mu.isOpen(e)&&t.fireEventInstead.fold((()=>t.doReposition(e)),(t=>js(e,t.event)))}}}},Lu=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},Hu=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var Pu=Object.freeze({__proto__:null,onLoad:Lu,onUnload:Hu,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});var Uu=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[ia(((o,n)=>{Lu(o,e,t)})),la(((o,n)=>{Hu(o,e,t)}))]:[Wl(e,t,Lu)];return Ks(o)}});const Wu=()=>{const e=Nr(null);return Va({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},ju=()=>{const e=Nr({}),t=Nr({});return Va({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:o=>be(e.get(),o).orThunk((()=>be(t.get(),o))),update:o=>{const n=e.get(),r=t.get(),s={},a={};H(o,(e=>{s[e.value]=e,be(e,"meta").each((t=>{be(t,"text").each((t=>{a[t]=e}))}))})),e.set({...n,...s}),t.set({...r,...a})},clear:()=>{e.set({}),t.set({})}})};var $u=Object.freeze({__proto__:null,memory:Wu,dataset:ju,manual:()=>Va({readState:b}),init:e=>e.store.manager.state(e)});const Gu=(e,t,o,n)=>{const r=t.store;o.update([n]),r.setValue(e,n),t.onSetValue(e,n)};var qu=[yr("initialValue"),dr("getFallbackEntry"),dr("getDataKey"),dr("setValue"),rl("manager",{setValue:Gu,getValue:(e,t,o)=>{const n=t.store,r=n.getDataKey(e);return o.lookup(r).getOrThunk((()=>n.getFallbackEntry(r)))},onLoad:(e,t,o)=>{t.store.initialValue.each((n=>{Gu(e,t,o,n)}))},onUnload:(e,t,o)=>{o.clear()},state:ju})];var Yu=[dr("getValue"),Tr("setValue",b),yr("initialValue"),rl("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:Na.init})];var Xu=[yr("initialValue"),rl("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:Wu})],Ku=[Er("store",{mode:"memory"},sr("mode",{memory:Xu,manual:Yu,dataset:qu})),el("onSetValue"),Tr("resetOnDom",!1)];const Ju=Xl({fields:Ku,name:"representing",active:Uu,apis:Pu,extra:{setValueFrom:(e,t)=>{const o=Ju.getValue(t);Ju.setValue(e,o)}},state:$u}),Zu=(e,t)=>Rr(e,{},L(t,(t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,ir(o,o,{tag:"option",process:{}},An((e=>mn("The field: "+o+" is forbidden. "+n))));var o,n})).concat([lr("dump",w)])),Qu=e=>e.dump,em=(e,t)=>({...ql(t),...e.dump}),tm=Zu,om=em,nm="placeholder",rm=Vr([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),sm=e=>ve(e,"uiType"),am=(e,t,o,n)=>sm(o)&&o.uiType===nm?((e,t,o,n)=>e.exists((e=>e!==o.owner))?rm.single(!0,x(o)):be(n,o.name).fold((()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+ae(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))}),(e=>e.replace())))(e,0,o,n):rm.single(!1,x(o)),im=(e,t,o,n)=>am(e,0,o,n).fold(((r,s)=>{const a=sm(o)?s(t,o.config,o.validated):s(t),i=be(a,"components").getOr([]),l=Y(i,(o=>im(e,t,o,n)));return[{...a,components:l}]}),((e,n)=>{if(sm(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)})),lm=(e,t,o,n)=>{const r=ce(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))),s=((e,t,o,n)=>Y(o,(o=>im(e,t,o,n))))(e,t,o,r);return le(r,(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))})),s},cm=rm.single,dm=rm.multiple,um=x(nm),mm=Vr([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),gm=Tr("factory",{sketch:w}),pm=Tr("schema",[]),hm=dr("name"),fm=ir("pname","pname",kn((e=>"<alloy."+ya(e.name)+">")),Wn()),bm=lr("schema",(()=>[yr("preprocess")])),vm=Tr("defaults",x({})),ym=Tr("overrides",x({})),xm=zn([gm,pm,hm,fm,vm,ym]),wm=zn([gm,pm,hm,vm,ym]),Sm=zn([gm,pm,hm,fm,vm,ym]),km=zn([gm,bm,hm,dr("unit"),fm,vm,ym]),Cm=e=>e.fold(D.some,D.none,D.some,D.some),Om=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},_m=(e,t)=>o=>{const n=nr("Converting part type",t,o);return e(n)},Tm=_m(mm.required,xm),Em=_m(mm.external,wm),Dm=_m(mm.optional,Sm),Am=_m(mm.group,km),Mm=x("entirety");var Bm=Object.freeze({__proto__:null,required:Tm,external:Em,optional:Dm,group:Am,asNamedPart:Cm,name:Om,asCommon:e=>e.fold(w,w,w,w),original:Mm});const Im=(e,t,o,n)=>wn(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),Fm=(e,t)=>{const o={};return H(t,(t=>{Cm(t).each((t=>{const n=Rm(e,t.pname);o[t.name]=o=>{const r=nr("Part: "+t.name+" in "+e,zn(t.schema),o);return{...n,config:o,validated:r}}}))})),o},Rm=(e,t)=>({uiType:um(),owner:e,name:t}),Nm=(e,t,o)=>({uiType:um(),owner:e,name:t,config:o,validated:{}}),Vm=e=>Y(e,(e=>e.fold(D.none,D.some,D.none,D.none).map((e=>fr(e.name,e.schema.concat([sl(Mm())])))).toArray())),zm=e=>L(e,Om),Lm=(e,t,o)=>((e,t,o)=>{const n={},r={};return H(o,(e=>{e.fold((e=>{n[e.pname]=cm(!0,((t,o,n)=>e.factory.sketch(Im(t,e,o,n))))}),(e=>{const o=t.parts[e.name];r[e.name]=x(e.factory.sketch(Im(t,e,o[Mm()]),o))}),(e=>{n[e.pname]=cm(!1,((t,o,n)=>e.factory.sketch(Im(t,e,o,n))))}),(e=>{n[e.pname]=dm(!0,((t,o,n)=>{const r=t[e.name];return L(r,(o=>e.factory.sketch(wn(e.defaults(t,o,n),o,e.overrides(t,o)))))}))}))})),{internals:x(n),externals:x(r)}})(0,t,o),Hm=(e,t,o)=>lm(D.some(e),t,t.components,o),Pm=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},Um=(e,t,o)=>Pm(e,t,o).getOrDie("Could not find part: "+o),Wm=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return H(o,(e=>{n[e]=x(s.getByUid(r[e]))})),n},jm=(e,t)=>{const o=e.getSystem();return ce(t.partUids,((e,t)=>x(o.getByUid(e))))},$m=e=>ae(e.partUids),Gm=(e,t,o)=>{const n={},r=t.partUids,s=e.getSystem();return H(o,(e=>{n[e]=x(s.getByUid(r[e]).getOrDie())})),n},qm=(e,t)=>{const o=zm(t);return Hr(L(o,(t=>({key:t,value:e+"-"+t}))))},Ym=e=>ir("partUids","partUids",On((t=>qm(t.uid,e))),Wn());var Xm=Object.freeze({__proto__:null,generate:Fm,generateOne:Nm,schemas:Vm,names:zm,substitutes:Lm,components:Hm,defaultUids:qm,defaultUidsSchema:Ym,getAllParts:jm,getAllPartNames:$m,getPart:Pm,getPartOrDie:Um,getParts:Wm,getPartsOrDie:Gm});const Km=(e,t,o,n,r)=>{const s=((e,t)=>(e.length>0?[fr("parts",e)]:[]).concat([dr("uid"),Tr("dom",{}),Tr("components",[]),sl("originalSpec"),Tr("debug.sketcher",{})]).concat(t))(n,r);return nr(e+" [SpecSchema]",Vn(s.concat(t)),o)},Jm=(e,t,o,n,r)=>{const s=Zm(r),a=Vm(o),i=Ym(o),l=Km(e,t,s,a,[i]),c=Lm(0,l,o);return n(l,Hm(e,l,c.internals()),s,c.externals())},Zm=e=>(e=>ve(e,"uid"))(e)?e:{...e,uid:_a("uid")},Qm=Vn([dr("name"),dr("factory"),dr("configFields"),Tr("apis",{}),Tr("extraApis",{})]),eg=Vn([dr("name"),dr("factory"),dr("configFields"),dr("partFields"),Tr("apis",{}),Tr("extraApis",{})]),tg=e=>{const t=nr("Sketcher for "+e.name,Qm,e),o=ce(t.apis,Ra),n=ce(t.extraApis,((e,t)=>Ma(e,t)));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const r=Zm(n);return o(Km(e,t,r,[],[]),r)})(t.name,t.configFields,t.factory,e),...o,...n}},og=e=>{const t=nr("Sketcher for "+e.name,eg,e),o=Fm(t.name,t.partFields),n=ce(t.apis,Ra),r=ce(t.extraApis,((e,t)=>Ma(e,t)));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>Jm(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...r}},ng=e=>Ye("input")(e)&&"radio"!==Ot(e,"type")||Ye("textarea")(e);var rg=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const sg=[dr("find")],ag=Xl({fields:sg,name:"composing",apis:rg}),ig=["input","button","textarea","select"],lg=(e,t,o)=>{(t.disabled()?pg:hg)(e,t)},cg=(e,t)=>!0===t.useNative&&R(ig,Pe(e.element)),dg=e=>{kt(e.element,"disabled","disabled")},ug=e=>{Et(e.element,"disabled")},mg=e=>{kt(e.element,"aria-disabled","true")},gg=e=>{kt(e.element,"aria-disabled","false")},pg=(e,t,o)=>{t.disableClass.each((t=>{ti(e.element,t)}));(cg(e,t)?dg:mg)(e),t.onDisabled(e)},hg=(e,t,o)=>{t.disableClass.each((t=>{ni(e.element,t)}));(cg(e,t)?ug:gg)(e),t.onEnabled(e)},fg=(e,t)=>cg(e,t)?(e=>Tt(e.element,"disabled"))(e):(e=>"true"===Ot(e.element,"aria-disabled"))(e);var bg=Object.freeze({__proto__:null,enable:hg,disable:pg,isDisabled:fg,onLoad:lg,set:(e,t,o,n)=>{(n?pg:hg)(e,t)}});var vg=Object.freeze({__proto__:null,exhibit:(e,t)=>La({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>Ks([Js(Ss(),((t,o)=>fg(t,e))),Wl(e,t,lg)])}),yg=[Ir("disabled",T),Tr("useNative",!0),yr("disableClass"),el("onDisabled"),el("onEnabled")];const xg=Xl({fields:yg,name:"disabling",active:vg,apis:bg}),wg=(e,t,o,n)=>{const r=Od(e.element,"."+t.highlightClass);H(r,(o=>{N(n,(e=>Je(e.element,o)))||(ni(o,t.highlightClass),e.getSystem().getByDom(o).each((o=>{t.onDehighlight(e,o),js(o,Ws())})))}))},Sg=(e,t,o,n)=>{wg(e,t,0,[n]),kg(e,t,o,n)||(ti(n.element,t.highlightClass),t.onHighlight(e,n),js(n,Us()))},kg=(e,t,o,n)=>si(n.element,t.highlightClass),Cg=(e,t,o,n)=>{const r=Od(e.element,"."+t.itemClass);return D.from(r[n]).fold((()=>on.error(new Error("No element found with index "+n))),e.getSystem().getByDom)},Og=(e,t,o)=>Fi(e.element,"."+t.itemClass).bind((t=>e.getSystem().getByDom(t).toOptional())),_g=(e,t,o)=>{const n=Od(e.element,"."+t.itemClass);return(n.length>0?D.some(n[n.length-1]):D.none()).bind((t=>e.getSystem().getByDom(t).toOptional()))},Tg=(e,t,o,n)=>{const r=Od(e.element,"."+t.itemClass),s=G(r,(e=>si(e,t.highlightClass)));return s.bind((t=>{const o=bl(t,n,0,r.length-1);return e.getSystem().getByDom(r[o]).toOptional()}))},Eg=(e,t,o)=>{const n=Od(e.element,"."+t.itemClass);return we(L(n,(t=>e.getSystem().getByDom(t).toOptional())))};var Dg=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>wg(e,t,0,[]),dehighlight:(e,t,o,n)=>{kg(e,t,o,n)&&(ni(n.element,t.highlightClass),t.onDehighlight(e,n),js(n,Ws()))},highlight:Sg,highlightFirst:(e,t,o)=>{Og(e,t).each((n=>{Sg(e,t,o,n)}))},highlightLast:(e,t,o)=>{_g(e,t).each((n=>{Sg(e,t,o,n)}))},highlightAt:(e,t,o,n)=>{Cg(e,t,o,n).fold((e=>{throw e}),(n=>{Sg(e,t,o,n)}))},highlightBy:(e,t,o,n)=>{const r=Eg(e,t);$(r,n).each((n=>{Sg(e,t,o,n)}))},isHighlighted:kg,getHighlighted:(e,t,o)=>Fi(e.element,"."+t.highlightClass).bind((t=>e.getSystem().getByDom(t).toOptional())),getFirst:Og,getLast:_g,getPrevious:(e,t,o)=>Tg(e,t,0,-1),getNext:(e,t,o)=>Tg(e,t,0,1),getCandidates:Eg}),Ag=[dr("highlightClass"),dr("itemClass"),el("onHighlight"),el("onDehighlight")];const Mg=Xl({fields:Ag,name:"highlighting",apis:Dg}),Bg=[8],Ig=[9],Fg=[13],Rg=[27],Ng=[32],Vg=[37],zg=[38],Lg=[39],Hg=[40],Pg=(e,t,o)=>{const n=K(e.slice(0,t)),r=K(e.slice(t+1));return $(n.concat(r),o)},Ug=(e,t,o)=>{const n=K(e.slice(0,t));return $(n,o)},Wg=(e,t,o)=>{const n=e.slice(0,t),r=e.slice(t+1);return $(r.concat(n),o)},jg=(e,t,o)=>{const n=e.slice(t+1);return $(n,o)},$g=e=>t=>{const o=t.raw;return R(e,o.which)},Gg=e=>t=>X(e,(e=>e(t))),qg=e=>!0===e.raw.shiftKey,Yg=e=>!0===e.raw.ctrlKey,Xg=C(qg),Kg=(e,t)=>({matches:e,classification:t}),Jg=(e,t,o)=>{t.exists((e=>o.exists((t=>Je(t,e)))))||$s(e,Vs(),{prevFocus:t,newFocus:o})},Zg=()=>{const e=e=>sc(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const r=e(t);Jg(t,n,r)}}},Qg=()=>{const e=e=>Mg.getHighlighted(e).map((e=>e.element));return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(b,(e=>{Mg.highlight(t,e)}));const r=e(t);Jg(t,n,r)}}};var ep;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(ep||(ep={}));const tp=(e,t,o,n,r)=>{const s=(e,t,o,n,r)=>((e,t)=>{const o=$(e,(e=>e.matches(t)));return o.map((e=>e.classification))})(o(e,t,n,r),t.event).bind((o=>o(e,t,n,r))),a={schema:()=>e.concat([Tr("focusManager",Zg()),Er("focusInside","onFocus",Qn((e=>R(["onFocus","onEnterOrSpace","onApi"],e)?on.value(e):on.error("Invalid value for focusInside")))),rl("handler",a),rl("state",t),rl("sendFocusIn",r)]),processKey:s,toEvents:(e,t)=>{const a=e.focusInside!==ep.OnFocusMode?D.none():r(e).map((o=>Qs(vs(),((n,r)=>{o(n,e,t),r.stop()})))),i=[Qs(is(),((n,a)=>{s(n,a,o,e,t).fold((()=>{((o,n)=>{const s=$g(Ng.concat(Fg))(n.event);e.focusInside===ep.OnEnterOrSpaceMode&&s&&$r(o,n)&&r(e).each((r=>{r(o,e,t),n.stop()}))})(n,a)}),(e=>{a.stop()}))})),Qs(ls(),((o,r)=>{s(o,r,n,e,t).each((e=>{r.stop()}))}))];return Ks(a.toArray().concat(i))}};return a},op=e=>{const t=[yr("onEscape"),yr("onEnter"),Tr("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Tr("firstTabstop",0),Tr("useTabstopAt",E),yr("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind((e=>Ri(t,e))).getOr(t);return Wt(o)>0},n=(e,t)=>t.focusManager.get(e).bind((e=>Ri(e,t.selector))),r=(e,t,n)=>{((e,t)=>{const n=Od(e.element,t.selector),r=U(n,(e=>o(t,e)));return D.from(r[t.firstTabstop])})(e,t).each((o=>{t.focusManager.set(e,o)}))},s=(e,t,n,r,s)=>s(t,n,(e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(r,e))).fold((()=>r.cyclic?D.some(!0):D.none()),(t=>(r.focusManager.set(e,t),D.some(!0)))),a=(e,t,o,r)=>{const a=Od(e.element,o.selector);return n(e,o).bind((t=>G(a,k(Je,t)).bind((t=>s(e,a,t,o,r)))))},i=(e,t,o)=>{const n=o.cyclic?Pg:Ug;return a(e,0,o,n)},l=(e,t,o)=>{const n=o.cyclic?Wg:jg;return a(e,0,o,n)},c=e=>(e=>nt(e))(e).bind(lt).exists((t=>Je(t,e))),d=x([Kg(Gg([qg,$g(Ig)]),i),Kg($g(Ig),l),Kg(Gg([Xg,$g(Fg)]),((e,t,o)=>o.onEnter.bind((o=>o(e,t)))))]),u=x([Kg($g(Rg),((e,t,o)=>o.onEscape.bind((o=>o(e,t))))),Kg($g(Ig),((e,t,o)=>n(e,o).filter((e=>!o.useTabstopAt(e))).bind((n=>(c(n)?i:l)(e,t,o)))))]);return tp(t,Na.init,d,u,(()=>D.some(r)))};var np=op(lr("cyclic",T)),rp=op(lr("cyclic",E));const sp=(e,t,o)=>ng(o)&&$g(Ng)(t.event)?D.none():((e,t,o)=>(qs(e,o,Ss()),D.some(!0)))(e,0,o),ap=(e,t)=>D.some(!0),ip=[Tr("execute",sp),Tr("useSpace",!1),Tr("useEnter",!0),Tr("useControlEnter",!1),Tr("useDown",!1)],lp=(e,t,o)=>o.execute(e,t,e.element);var cp=tp(ip,Na.init,((e,t,o,n)=>{const r=o.useSpace&&!ng(e.element)?Ng:[],s=o.useEnter?Fg:[],a=o.useDown?Hg:[],i=r.concat(s).concat(a);return[Kg($g(i),lp)].concat(o.useControlEnter?[Kg(Gg([Yg,$g(Fg)]),lp)]:[])}),((e,t,o,n)=>o.useSpace&&!ng(e.element)?[Kg($g(Ng),ap)]:[]),(()=>D.none()));const dp=()=>{const e=Cc();return Va({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 up=Object.freeze({__proto__:null,flatgrid:dp,init:e=>e.state(e)});const mp=e=>(t,o,n,r)=>{const s=e(t.element);return fp(s,t,o,n,r)},gp=(e,t)=>{const o=Gc(e,t);return mp(o)},pp=(e,t)=>{const o=Gc(t,e);return mp(o)},hp=e=>(t,o,n,r)=>fp(e,t,o,n,r),fp=(e,t,o,n,r)=>n.focusManager.get(t).bind((o=>e(t.element,o,n,r))).map((e=>(n.focusManager.set(t,e),!0))),bp=hp,vp=hp,yp=hp,xp=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),wp=(e,t,o)=>{const n=Od(e,o);return((e,t)=>G(e,t).map((t=>({index:t,candidates:e}))))(U(n,xp),(e=>Je(e,t)))},Sp=(e,t)=>G(e,(e=>Je(t,e))),kp=(e,t,o,n)=>n(Math.floor(t/o),t%o).bind((t=>{const n=t.row*o+t.column;return n>=0&&n<e.length?D.some(e[n]):D.none()})),Cp=(e,t,o,n,r)=>kp(e,t,n,((t,s)=>{const a=t===o-1?e.length-t*n:n,i=bl(s,r,0,a-1);return D.some({row:t,column:i})})),Op=(e,t,o,n,r)=>kp(e,t,n,((t,s)=>{const a=bl(t,r,0,o-1),i=a===o-1?e.length-a*n:n,l=vl(s,0,i-1);return D.some({row:a,column:l})})),_p=[dr("selector"),Tr("execute",sp),tl("onEscape"),Tr("captureTab",!1),al()],Tp=(e,t,o)=>{Fi(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},Ep=e=>(t,o,n,r)=>wp(t,o,n.selector).bind((t=>e(t.candidates,t.index,r.getNumRows().getOr(n.initSize.numRows),r.getNumColumns().getOr(n.initSize.numColumns)))),Dp=(e,t,o)=>o.captureTab?D.some(!0):D.none(),Ap=Ep(((e,t,o,n)=>Cp(e,t,o,n,-1))),Mp=Ep(((e,t,o,n)=>Cp(e,t,o,n,1))),Bp=Ep(((e,t,o,n)=>Op(e,t,o,n,-1))),Ip=Ep(((e,t,o,n)=>Op(e,t,o,n,1))),Fp=x([Kg($g(Vg),gp(Ap,Mp)),Kg($g(Lg),pp(Ap,Mp)),Kg($g(zg),bp(Bp)),Kg($g(Hg),vp(Ip)),Kg(Gg([qg,$g(Ig)]),Dp),Kg(Gg([Xg,$g(Ig)]),Dp),Kg($g(Ng.concat(Fg)),((e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind((e=>Ri(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n)))))]),Rp=x([Kg($g(Rg),((e,t,o)=>o.onEscape(e,t))),Kg($g(Ng),ap)]);var Np=tp(_p,dp,Fp,Rp,(()=>D.some(Tp)));const Vp=(e,t,o,n,r)=>{const s=(e,t,o)=>r(e,t,n,0,o.length-1,o[t],(t=>{return n=o[t],"button"===Pe(n)&&"disabled"===Ot(n,"disabled")?s(e,t,o):D.from(o[t]);var n}));return wp(e,o,t).bind((e=>{const t=e.index,o=e.candidates;return s(t,t,o)}))},zp=(e,t,o,n)=>Vp(e,t,o,n,((e,t,o,n,r,s,a)=>{const i=vl(t+o,n,r);return i===e?D.from(s):a(i)})),Lp=(e,t,o,n)=>Vp(e,t,o,n,((e,t,o,n,r,s,a)=>{const i=bl(t,o,n,r);return i===e?D.none():a(i)})),Hp=[dr("selector"),Tr("getInitial",D.none),Tr("execute",sp),tl("onEscape"),Tr("executeOnMove",!1),Tr("allowVertical",!0),Tr("allowHorizontal",!0),Tr("cycles",!0)],Pp=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind((e=>Ri(e,t.selector))))(e,o).bind((n=>o.execute(e,t,n))),Up=(e,t,o)=>{t.getInitial(e).orThunk((()=>Fi(e.element,t.selector))).each((o=>{t.focusManager.set(e,o)}))},Wp=(e,t,o)=>(o.cycles?Lp:zp)(e,o.selector,t,-1),jp=(e,t,o)=>(o.cycles?Lp:zp)(e,o.selector,t,1),$p=e=>(t,o,n,r)=>e(t,o,n,r).bind((()=>n.executeOnMove?Pp(t,o,n):D.some(!0))),Gp=x([Kg($g(Ng),ap),Kg($g(Rg),((e,t,o)=>o.onEscape(e,t)))]);var qp=tp(Hp,Na.init,((e,t,o,n)=>{const r=[...o.allowHorizontal?Vg:[]].concat(o.allowVertical?zg:[]),s=[...o.allowHorizontal?Lg:[]].concat(o.allowVertical?Hg:[]);return[Kg($g(r),$p(gp(Wp,jp))),Kg($g(s),$p(pp(Wp,jp))),Kg($g(Fg),Pp),Kg($g(Ng),Pp)]}),Gp,(()=>D.some(Up)));const Yp=(e,t,o)=>D.from(e[t]).bind((e=>D.from(e[o]).map((e=>({rowIndex:t,columnIndex:o,cell:e}))))),Xp=(e,t,o,n)=>{const r=e[t].length,s=bl(o,n,0,r-1);return Yp(e,t,s)},Kp=(e,t,o,n)=>{const r=bl(o,n,0,e.length-1),s=e[r].length,a=vl(t,0,s-1);return Yp(e,r,a)},Jp=(e,t,o,n)=>{const r=e[t].length,s=vl(o+n,0,r-1);return Yp(e,t,s)},Zp=(e,t,o,n)=>{const r=vl(o+n,0,e.length-1),s=e[r].length,a=vl(t,0,s-1);return Yp(e,r,a)},Qp=[fr("selectors",[dr("row"),dr("cell")]),Tr("cycles",!0),Tr("previousSelector",D.none),Tr("execute",sp)],eh=(e,t,o)=>{t.previousSelector(e).orThunk((()=>{const o=t.selectors;return Fi(e.element,o.cell)})).each((o=>{t.focusManager.set(e,o)}))},th=(e,t)=>(o,n,r)=>{const s=r.cycles?e:t;return Ri(n,r.selectors.row).bind((e=>{const t=Od(e,r.selectors.cell);return Sp(t,n).bind((t=>{const n=Od(o,r.selectors.row);return Sp(n,e).bind((e=>{const o=((e,t)=>L(e,(e=>Od(e,t.selectors.cell))))(n,r);return s(o,e,t).map((e=>e.cell))}))}))}))},oh=th(((e,t,o)=>Xp(e,t,o,-1)),((e,t,o)=>Jp(e,t,o,-1))),nh=th(((e,t,o)=>Xp(e,t,o,1)),((e,t,o)=>Jp(e,t,o,1))),rh=th(((e,t,o)=>Kp(e,o,t,-1)),((e,t,o)=>Zp(e,o,t,-1))),sh=th(((e,t,o)=>Kp(e,o,t,1)),((e,t,o)=>Zp(e,o,t,1))),ah=x([Kg($g(Vg),gp(oh,nh)),Kg($g(Lg),pp(oh,nh)),Kg($g(zg),bp(rh)),Kg($g(Hg),vp(sh)),Kg($g(Ng.concat(Fg)),((e,t,o)=>sc(e.element).bind((n=>o.execute(e,t,n)))))]),ih=x([Kg($g(Ng),ap)]);var lh=tp(Qp,Na.init,ah,ih,(()=>D.some(eh)));const ch=[dr("selector"),Tr("execute",sp),Tr("moveOnTab",!1)],dh=(e,t,o)=>o.focusManager.get(e).bind((n=>o.execute(e,t,n))),uh=(e,t,o)=>{Fi(e.element,t.selector).each((o=>{t.focusManager.set(e,o)}))},mh=(e,t,o)=>Lp(e,o.selector,t,-1),gh=(e,t,o)=>Lp(e,o.selector,t,1),ph=x([Kg($g(zg),yp(mh)),Kg($g(Hg),yp(gh)),Kg(Gg([qg,$g(Ig)]),((e,t,o,n)=>o.moveOnTab?yp(mh)(e,t,o,n):D.none())),Kg(Gg([Xg,$g(Ig)]),((e,t,o,n)=>o.moveOnTab?yp(gh)(e,t,o,n):D.none())),Kg($g(Fg),dh),Kg($g(Ng),dh)]),hh=x([Kg($g(Ng),ap)]);var fh=tp(ch,Na.init,ph,hh,(()=>D.some(uh)));const bh=[tl("onSpace"),tl("onEnter"),tl("onShiftEnter"),tl("onLeft"),tl("onRight"),tl("onTab"),tl("onShiftTab"),tl("onUp"),tl("onDown"),tl("onEscape"),Tr("stopSpaceKeyup",!1),yr("focusIn")];var vh=tp(bh,Na.init,((e,t,o)=>[Kg($g(Ng),o.onSpace),Kg(Gg([Xg,$g(Fg)]),o.onEnter),Kg(Gg([qg,$g(Fg)]),o.onShiftEnter),Kg(Gg([qg,$g(Ig)]),o.onShiftTab),Kg(Gg([Xg,$g(Ig)]),o.onTab),Kg($g(zg),o.onUp),Kg($g(Hg),o.onDown),Kg($g(Vg),o.onLeft),Kg($g(Lg),o.onRight),Kg($g(Ng),o.onSpace)]),((e,t,o)=>[...o.stopSpaceKeyup?[Kg($g(Ng),ap)]:[],Kg($g(Rg),o.onEscape)]),(e=>e.focusIn));const yh=np.schema(),xh=rp.schema(),wh=qp.schema(),Sh=Np.schema(),kh=lh.schema(),Ch=cp.schema(),Oh=fh.schema(),_h=vh.schema();const Th=Jl({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:yh,cyclic:xh,flow:wh,flatgrid:Sh,matrix:kh,execution:Ch,menu:Oh,special:_h}),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,r)=>{(e=>ye(e,"setGridSize"))(o)?o.setGridSize(n,r):console.error("Layout does not support setGridSize")}},state:up}),Eh=(e,t)=>{ac((()=>{uu(e,t,(()=>L(t,e.getSystem().build)))}),e.element)},Dh=(e,t)=>{ac((()=>{((e,t,o)=>{const n=e.components(),r=Y(t,(e=>Fa(e).toArray()));H(n,(e=>{R(r,e)||cu(e)}));const s=o(t),a=J(n,s);H(a,(e=>{su(e)&&cu(e)})),H(s,(t=>{su(t)||lu(e,t)})),e.syncComponents()})(e,t,(()=>((e,t,o)=>mi(e,t,((t,n)=>gi(e,n,t,o))))(e.element,t,e.getSystem().buildOrPatch)))}),e.element)},Ah=(e,t,o,n)=>{cu(t);const r=gi(e.element,o,n,e.getSystem().buildOrPatch);lu(e,r),e.syncComponents()},Mh=(e,t,o)=>{const n=e.getSystem().build(o);gu(e,n,t)},Bh=(e,t,o,n)=>{hu(t),Mh(e,((e,t)=>((e,t,o)=>{it(e,o).fold((()=>{No(e,t)}),(e=>{Io(e,t)}))})(e,t,o)),n)},Ih=(e,t)=>e.components(),Fh=(e,t,o,n,r)=>{const s=Ih(e);return D.from(s[n]).map((o=>(r.fold((()=>hu(o)),(r=>{(t.reuseDom?Ah:Bh)(e,o,n,r)})),o)))};var Rh=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Mh(e,No,n)},prepend:(e,t,o,n)=>{Mh(e,Ro,n)},remove:(e,t,o,n)=>{const r=Ih(e),s=$(r,(e=>Je(n.element,e.element)));s.each(hu)},replaceAt:Fh,replaceBy:(e,t,o,n,r)=>{const s=Ih(e);return G(s,n).bind((o=>Fh(e,t,0,o,r)))},set:(e,t,o,n)=>(t.reuseDom?Dh:Eh)(e,n),contents:Ih});const Nh=Xl({fields:[Br("reuseDom",!0)],name:"replacing",apis:Rh}),Vh=(e,t)=>{const o=((e,t)=>{const o=Ks(t);return Xl({fields:[dr("enabled")],name:e,active:{events:x(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:x({}),initialConfig:{},state:Na}}},zh=(e,t)=>{t.ignore||(tc(e.element),t.onFocus(e))};var Lh=Object.freeze({__proto__:null,focus:zh,blur:(e,t)=>{t.ignore||oc(e.element)},isFocused:e=>nc(e.element)});var Hh=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return La(o)},events:e=>Ks([Qs(vs(),((t,o)=>{zh(t,e),o.stop()}))].concat(e.stopMousedown?[Qs(es(),((e,t)=>{t.event.prevent()}))]:[]))}),Ph=[el("onFocus"),Tr("stopMousedown",!1),Tr("ignore",!1)];const Uh=Xl({fields:Ph,name:"focusing",active:Hh,apis:Lh}),Wh=(e,t,o,n)=>{const r=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each((t=>{o.get()?ti(e.element,t):ni(e.element,t)}))})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),r!==n&&t.onToggled(e,n)},jh=(e,t,o)=>{Wh(e,t,o,!o.get())},$h=(e,t,o)=>{Wh(e,t,o,t.selected)};var Gh=Object.freeze({__proto__:null,onLoad:$h,toggle:jh,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{Wh(e,t,o,!0)},off:(e,t,o)=>{Wh(e,t,o,!1)},set:Wh});var qh=Object.freeze({__proto__:null,exhibit:()=>La({}),events:(e,t)=>{const o=(n=e,r=t,s=jh,da((e=>{s(e,n,r)})));var n,r,s;const a=Wl(e,t,$h);return Ks(q([e.toggleOnExecute?[o]:[],[a]]))}});const Yh=(e,t,o)=>{kt(e.element,"aria-expanded",o)};var Xh=[Tr("selected",!1),yr("toggleClass"),Tr("toggleOnExecute",!0),el("onToggled"),Er("aria",{mode:"none"},sr("mode",{pressed:[Tr("syncWithExpanded",!1),rl("update",((e,t,o)=>{kt(e.element,"aria-pressed",o),t.syncWithExpanded&&Yh(e,t,o)}))],checked:[rl("update",((e,t,o)=>{kt(e.element,"aria-checked",o)}))],expanded:[rl("update",Yh)],selected:[rl("update",((e,t,o)=>{kt(e.element,"aria-selected",o)}))],none:[rl("update",b)]}))];const Kh=Xl({fields:Xh,name:"toggling",active:qh,apis:Gh,state:(Jh=!1,{init:()=>{const e=Nr(Jh);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(Jh),readState:()=>e.get()}}})});var Jh;const Zh=()=>{const e=(e,t)=>{t.stop(),Gs(e)};return[Qs(us(),e),Qs(Cs(),e),ra(Kr()),ra(es())]},Qh=e=>Ks(q([e.map((e=>da(((t,o)=>{e(t),o.stop()})))).toArray(),Zh()])),ef="alloy.item-hover",tf="alloy.item-focus",of="alloy.item-toggled",nf=e=>{(sc(e.element).isNone()||Uh.isFocused(e))&&(Uh.isFocused(e)||Uh.focus(e),$s(e,ef,{item:e}))},rf=e=>{$s(e,tf,{item:e})},sf=x(ef),af=x(tf),lf=x(of),cf=e=>e.toggling.map((e=>e.exclusive?"menuitemradio":"menuitemcheckbox")).getOr("menuitem"),df=e=>({aria:{mode:"checked"},...ge(e,((e,t)=>"exclusive"!==t)),onToggled:(t,o)=>{p(e.onToggled)&&e.onToggled(t,o),((e,t)=>{$s(e,of,{item:e,state:t})})(t,o)}}),uf=[dr("data"),dr("components"),dr("dom"),Tr("hasSubmenu",!1),yr("toggling"),tm("itemBehaviours",[Kh,Uh,Th,Ju]),Tr("ignoreFocus",!1),Tr("domModification",{}),rl("builder",(e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:cf(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:om(e.itemBehaviours,[e.toggling.fold(Kh.revoke,(e=>Kh.config(df(e)))),Uh.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{rf(e)}}),Th.config({mode:"execution"}),Ju.config({store:{mode:"memory",initialValue:e.data}}),Vh("item-type-events",[...Zh(),Qs(rs(),nf),Qs(ks(),Uh.focus)])]),components:e.components,eventOrder:e.eventOrder}))),Tr("eventOrder",{})],mf=[dr("dom"),dr("components"),rl("builder",(e=>({dom:e.dom,components:e.components,events:Ks([sa(ks())])})))],gf=x("item-widget"),pf=x([Tm({name:"widget",overrides:e=>({behaviours:ql([Ju.config({store:{mode:"manual",getValue:t=>e.data,setValue:b}})])})})]),hf=[dr("uid"),dr("data"),dr("components"),dr("dom"),Tr("autofocus",!1),Tr("ignoreFocus",!1),tm("widgetBehaviours",[Ju,Uh,Th]),Tr("domModification",{}),Ym(pf()),rl("builder",(e=>{const t=Lm(gf(),e,pf()),o=Hm(gf(),e,t.internals()),n=t=>Pm(t,e,"widget").map((e=>(Th.focusIn(e),e))),r=(t,o)=>ng(o.event.target)?D.none():e.autofocus?(o.setSource(t.element),D.none()):D.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Ks([da(((e,t)=>{n(e).each((e=>{t.stop()}))})),Qs(rs(),nf),Qs(ks(),((t,o)=>{e.autofocus?n(t):Uh.focus(t)}))]),behaviours:om(e.widgetBehaviours,[Ju.config({store:{mode:"memory",initialValue:e.data}}),Uh.config({ignore:e.ignoreFocus,onFocus:e=>{rf(e)}}),Th.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:Zl(),onLeft:r,onRight:r,onEscape:(t,o)=>Uh.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),D.none()):D.none():(Uh.focus(t),D.some(!0))})])}}))],ff=sr("type",{widget:hf,item:uf,separator:mf}),bf=x([Am({factory:{sketch:e=>{const t=nr("menu.spec item",ff,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>ve(t,"uid")?t:{...t,uid:_a("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),vf=x([dr("value"),dr("items"),dr("dom"),dr("components"),Tr("eventOrder",{}),Zu("menuBehaviours",[Mg,Ju,ag,Th]),Er("movement",{mode:"menu",moveOnTab:!0},sr("mode",{grid:[al(),rl("config",((e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager})))],matrix:[rl("config",((e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager}))),dr("rowSelector"),Tr("previousSelector",D.none)],menu:[Tr("moveOnTab",!0),rl("config",((e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager})))]})),ur("markers",Xi()),Tr("fakeFocus",!1),Tr("focusManager",Zg()),el("onHighlight"),el("onDehighlight")]),yf=x("alloy.menu-focus"),xf=og({name:"Menu",configFields:vf(),partFields:bf(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:em(e.menuBehaviours,[Mg.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),Ju.config({store:{mode:"memory",initialValue:e.value}}),ag.config({find:D.some}),Th.config(e.movement.config(e,e.movement))]),events:Ks([Qs(af(),((e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each((o=>{Mg.highlight(e,o),t.stop(),$s(e,yf(),{menu:e,item:o})}))})),Qs(sf(),((e,t)=>{const o=t.event.item;Mg.highlight(e,o)})),Qs(lf(),((e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===Ot(o.element,"role")&&((e,t)=>{const o=Od(e.element,'[role="menuitemradio"][aria-checked="true"]');H(o,(o=>{Je(o,t.element)||e.getSystem().getByDom(o).each((e=>{Kh.off(e)}))}))})(e,o)}))]),components:t,eventOrder:e.eventOrder,domModification:{attributes:{role:"menu"}}})}),wf=(e,t,o,n)=>be(o,n).bind((n=>be(e,n).bind((n=>{const r=wf(e,t,o,n);return D.some([n].concat(r))})))).getOr([]),Sf=(e,t)=>{const o={};le(e,((e,t)=>{H(e,(e=>{o[e]=t}))}));const n=t,r=de(t,((e,t)=>({k:e,v:t})));const s=ce(r,((e,t)=>[t].concat(wf(o,n,r,t))));return ce(o,(e=>be(s,e).getOr([e])))},kf=e=>"prepared"===e.type?D.some(e.menu):D.none(),Cf={init:()=>{const e=Nr({}),t=Nr({}),o=Nr({}),n=Cc(),r=Nr({}),s=(t,o,n)=>a(t).bind((r=>(t=>he(e.get(),((e,o)=>e===t)))(t).bind((e=>o(e).map((e=>({triggeredMenu:r,triggeringItem:e,triggeringPath:n}))))))),a=e=>i(e).bind(kf),i=e=>be(t.get(),e),l=t=>be(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(s,a,i,l)=>{n.set(s),e.set(i),t.set(a),r.set(l);const c=Sf(l,i);o.set(c)},expand:t=>be(e.get(),t).map((e=>{const n=be(o.get(),t).getOr([]);return[e].concat(n)})),refresh:e=>be(o.get(),e),collapse:e=>be(o.get(),e).bind((e=>e.length>1?D.some(e.slice(1)):D.none())),lookupMenu:i,lookupItem:l,otherMenus:e=>{const t=r.get();return J(ae(t),e)},getPrimary:()=>n.get().bind(a),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(e,t)=>{const r=U(l(e).toArray(),(e=>a(e).isSome()));return be(o.get(),e).bind((e=>{const o=K(r.concat(e));return(e=>{const t=[];for(let o=0;o<e.length;o++){const n=e[o];if(!n.isSome())return D.none();t.push(n.getOrDie())}return D.some(t)})(Y(o,((e,r)=>s(e,t,o.slice(0,r+1)).fold((()=>xe(n.get(),e)?[]:[D.none()]),(e=>[D.some(e)])))))}))}}},extractPreparedMenu:kf},Of=ya("tiered-menu-item-highlight"),_f=ya("tiered-menu-item-dehighlight");var Tf;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(Tf||(Tf={}));const Ef=x("collapse-item"),Df=tg({name:"TieredMenu",configFields:[nl("onExecute"),nl("onEscape"),ol("onOpenMenu"),ol("onOpenSubmenu"),el("onRepositionMenu"),el("onCollapseMenu"),Tr("highlightOnOpen",Tf.HighlightMenuAndItem),fr("data",[dr("primary"),dr("menus"),dr("expansions")]),Tr("fakeFocus",!1),el("onHighlightItem"),el("onDehighlightItem"),el("onHover"),Ji(),dr("dom"),Tr("navigateOnHover",!0),Tr("stayInDom",!1),Zu("tmenuBehaviours",[Th,Mg,ag,Nh]),Tr("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=Cc(),n=Cf.init(),r=t=>{const o=((t,o,n)=>ce(n,((n,r)=>{const s=()=>xf.sketch({...n,value:r,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{$s(e,Of,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{$s(e,_f,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?Qg():Zg()});return r===o?{type:"prepared",menu:t.getSystem().build(s())}:{type:"notbuilt",nbMenu:s}})))(t,e.data.primary,e.data.menus),r=a();return n.setContents(e.data.primary,o,e.data.expansions,r),n.getPrimary()},s=e=>Ju.getValue(e).value,a=t=>ce(e.data.menus,((e,t)=>Y(e.items,(e=>"separator"===e.type?[]:[e.data.value])))),i=Mg.highlight,l=(t,o)=>{i(t,o),Mg.getHighlighted(o).orThunk((()=>Mg.getFirst(o))).each((n=>{e.fakeFocus?Mg.highlight(o,n):qs(t,n.element,ks())}))},c=(e,t)=>we(L(t,(t=>e.lookupMenu(t).bind((e=>"prepared"===e.type?D.some(e.menu):D.none()))))),d=(t,o,n)=>{const r=c(o,o.otherMenus(n));H(r,(o=>{ii(o.element,[e.markers.backgroundMenu]),e.stayInDom||Nh.remove(t,o)}))},u=(t,n)=>{const r=(t=>o.get().getOrThunk((()=>{const n={},r=Od(t.element,`.${e.markers.item}`),a=U(r,(e=>"true"===Ot(e,"aria-haspopup")));return H(a,(e=>{t.getSystem().getByDom(e).each((e=>{const t=s(e);n[t]=e}))})),o.set(n),n})))(t);le(r,((e,t)=>{const o=R(n,t);kt(e.element,"aria-expanded",o)}))},m=(t,o,n)=>D.from(n[0]).bind((r=>o.lookupMenu(r).bind((r=>{if("notbuilt"===r.type)return D.none();{const s=r.menu,a=c(o,n.slice(1));return H(a,(t=>{ti(t.element,e.markers.backgroundMenu)})),yt(s.element)||Nh.append(t,Ti(s)),ii(s.element,[e.markers.backgroundMenu]),l(t,s),d(t,o,n),D.some(s)}}))));let g;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(g||(g={}));const p=(t,o,r=g.HighlightSubmenu)=>{if(o.hasConfigured(xg)&&xg.isDisabled(o))return D.some(o);{const a=s(o);return n.expand(a).bind((s=>(u(t,s),D.from(s[0]).bind((a=>n.lookupMenu(a).bind((i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const r=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,r),r}return o.menu})(t,a,i);return yt(l.element)||Nh.append(t,Ti(l)),e.onOpenSubmenu(t,o,l,K(s)),r===g.HighlightSubmenu?(Mg.highlightFirst(l),m(t,n,s)):(Mg.dehighlightAll(l),D.some(o))})))))))}},h=(t,o)=>{const r=s(o);return n.collapse(r).bind((r=>(u(t,r),m(t,n,r).map((n=>(e.onCollapseMenu(t,o,n),n))))))},f=t=>(o,n)=>Ri(n.getSource(),`.${e.markers.item}`).bind((e=>o.getSystem().getByDom(e).toOptional().bind((e=>t(o,e).map(E))))),v=Ks([Qs(yf(),((e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each((()=>{const o=t.event.menu;Mg.highlight(e,o);const r=s(t.event.item);n.refresh(r).each((t=>d(e,n,t)))}))})),da(((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each((o=>{0===s(o).indexOf("collapse-item")&&h(t,o),p(t,o,g.HighlightSubmenu).fold((()=>{e.onExecute(t,o)}),b)}))})),ia(((t,o)=>{r(t).each((o=>{Nh.append(t,Ti(o)),e.onOpenMenu(t,o),e.highlightOnOpen===Tf.HighlightMenuAndItem?l(t,o):e.highlightOnOpen===Tf.HighlightJustMenu&&i(t,o)}))})),Qs(Of,((t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)})),Qs(_f,((t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)})),...e.navigateOnHover?[Qs(sf(),((t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind((t=>(u(e,t),m(e,n,t))))})(t,r),p(t,r,g.HighlightParent),e.onHover(t,r)}))]:[]]),y=e=>Mg.getHighlighted(e).bind(Mg.getHighlighted),x={collapseMenu:e=>{y(e).each((t=>{h(e,t)}))},highlightPrimary:e=>{n.getPrimary().each((t=>{l(e,t)}))},repositionMenus:t=>{const o=n.getPrimary().bind((e=>y(t).bind((e=>{const t=s(e),o=fe(n.getMenus()),r=we(L(o,Cf.extractPreparedMenu));return n.getTriggeringPath(t,(e=>((e,t,o)=>se(t,(e=>{if(!e.getSystem().isConnected())return D.none();const t=Mg.getCandidates(e);return $(t,(e=>s(e)===o))})))(0,r,e)))})).map((t=>({primary:e,triggeringPath:t})))));o.fold((()=>{(e=>D.from(e.components()[0]).filter((e=>"menu"===Ot(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:em(e.tmenuBehaviours,[Th.config({mode:"special",onRight:f(((e,t)=>ng(t.element)?D.none():p(e,t,g.HighlightSubmenu))),onLeft:f(((e,t)=>ng(t.element)?D.none():h(e,t))),onEscape:f(((t,o)=>h(t,o).orThunk((()=>e.onEscape(t,o).map((()=>t)))))),focusIn:(e,t)=>{n.getPrimary().each((t=>{qs(e,t.element,ks())}))}}),Mg.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),ag.config({find:e=>Mg.getHighlighted(e)}),Nh.config({})]),eventOrder:e.eventOrder,apis:x,events:v}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:Lr(e,t),expansions:{}}),collapseItem:e=>({value:ya(Ef()),meta:{text:e}})}}),Af=tg({name:"InlineView",configFields:[dr("lazySink"),el("onShow"),el("onHide"),Cr("onEscape"),Zu("inlineBehaviours",[Mu,Ju,Ql]),_r("fireDismissalEventInstead",[Tr("event",Rs())]),_r("fireRepositionEventInstead",[Tr("event",Ns())]),Tr("getRelated",D.none),Tr("isExtraPart",T),Tr("eventOrder",D.none)],factory:(e,t)=>{const o=(t,o,n,r)=>{const s=e.lazySink(t).getOrDie();Mu.openWhileCloaked(t,o,(()=>ru.positionWithinBounds(s,t,n,r()))),Ju.setValue(t,D.some({mode:"position",config:n,getBounds:r}))},n=(t,o,n,r)=>{const s=((e,t,o,n,r)=>{const s=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>Ll(),onRtl:()=>Hl()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return Df.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(Mu.close(t),e.onEscape.map((e=>e(t))),D.some(!0)),onExecute:()=>D.some(!0),onOpenMenu:(e,t)=>{ru.positionWithinBounds(s().getOrDie(),t,o,r())},onOpenSubmenu:(e,t,o,n)=>{const r=s().getOrDie();ru.position(r,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=s().getOrDie();ru.positionWithinBounds(a,t,o,r()),H(n,(e=>{const t=i(e.triggeringPath);ru.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})}))}})})(e,t,o,n,r);Mu.open(t,s),Ju.setValue(t,D.some({mode:"menu",menu:s}))},r=t=>{Mu.isOpen(t)&&Ju.getValue(t).each((o=>{switch(o.mode){case"menu":Mu.getState(t).each(Df.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();ru.positionWithinBounds(n,t,o.config,o.getBounds())}}))},s={setContent:(e,t)=>{Mu.setContent(e,t)},showAt:(e,t,n)=>{const r=D.none;o(e,t,n,r)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,D.none)},showMenuWithinBounds:n,hide:e=>{Mu.isOpen(e)&&(Ju.setValue(e,D.none()),Mu.close(e))},getContent:e=>Mu.getState(e),reposition:r,isOpen:Mu.isOpen};return{uid:e.uid,dom:e.dom,behaviours:em(e.inlineBehaviours,[Mu.config({isPartOf:(t,o,n)=>Li(o,n)||((t,o)=>e.getRelated(t).exists((e=>Li(e,o))))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),Ju.config({store:{mode:"memory",initialValue:D.none()}}),Ql.config({channels:{...Nu({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...zu({...e.fireRepositionEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({}),doReposition:r})}})]),eventOrder:e.eventOrder,apis:s}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,r)=>{e.showWithinBounds(t,o,n,r)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,r)=>{e.showMenuWithinBounds(t,o,n,r)},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 Mf=tinymce.util.Tools.resolve("tinymce.util.Delay");const Bf=tg({name:"Button",factory:e=>{const t=Qh(e.action),o=e.dom.tag,n=t=>be(e.dom,"attributes").bind((e=>be(e,t)));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:om(e.buttonBehaviours,[Uh.config({}),Th.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:(()=>{if("button"===o){return{type:n("type").getOr("button"),...n("role").map((e=>({role:e}))).getOr({})}}return{role:e.role.getOr(n("role").getOr("button"))}})()},eventOrder:e.eventOrder}},configFields:[Tr("uid",void 0),dr("dom"),Tr("components",[]),tm("buttonBehaviours",[Uh,Th]),yr("action"),yr("role"),Tr("eventOrder",{})]}),If=e=>{const t=Re.fromHtml(e),o=at(t),n=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return j(t,((e,t)=>"class"===t.name?e:{...e,[t.name]:t.value}),{})})(t),r=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),s=0===o.length?{}:{innerHtml:ua(t)};return{tag:Pe(t),classes:r,attributes:n,...s}},Ff=e=>{const t=(e=>void 0!==e.uid)(e)&&ye(e,"uid")?e.uid:_a("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}},{entries:Rf,setPrototypeOf:Nf,isFrozen:Vf,getPrototypeOf:zf,getOwnPropertyDescriptor:Lf}=Object;let{freeze:Hf,seal:Pf,create:Uf}=Object,{apply:Wf,construct:jf}="undefined"!=typeof Reflect&&Reflect;Hf||(Hf=function(e){return e}),Pf||(Pf=function(e){return e}),Wf||(Wf=function(e,t,o){return e.apply(t,o)}),jf||(jf=function(e,t){return new e(...t)});const $f=rb(Array.prototype.forEach),Gf=rb(Array.prototype.pop),qf=rb(Array.prototype.push),Yf=rb(String.prototype.toLowerCase),Xf=rb(String.prototype.toString),Kf=rb(String.prototype.match),Jf=rb(String.prototype.replace),Zf=rb(String.prototype.indexOf),Qf=rb(String.prototype.trim),eb=rb(Object.prototype.hasOwnProperty),tb=rb(RegExp.prototype.test),ob=(nb=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return jf(nb,t)});var nb;function rb(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return Wf(e,t,n)}}function sb(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Yf;Nf&&Nf(e,null);let n=t.length;for(;n--;){let r=t[n];if("string"==typeof r){const e=o(r);e!==r&&(Vf(t)||(t[n]=e),r=e)}e[r]=!0}return e}function ab(e){for(let t=0;t<e.length;t++){eb(e,t)||(e[t]=null)}return e}function ib(e){const t=Uf(null);for(const[o,n]of Rf(e)){eb(e,o)&&(Array.isArray(n)?t[o]=ab(n):n&&"object"==typeof n&&n.constructor===Object?t[o]=ib(n):t[o]=n)}return t}function lb(e,t){for(;null!==e;){const o=Lf(e,t);if(o){if(o.get)return rb(o.get);if("function"==typeof o.value)return rb(o.value)}e=zf(e)}return function(){return null}}const cb=Hf(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),db=Hf(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ub=Hf(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),mb=Hf(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),gb=Hf(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),pb=Hf(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),hb=Hf(["#text"]),fb=Hf(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),bb=Hf(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),vb=Hf(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),yb=Hf(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xb=Pf(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wb=Pf(/<%[\w\W]*|[\w\W]*%>/gm),Sb=Pf(/\${[\w\W]*}/gm),kb=Pf(/^data-[\-\w.\u00B7-\uFFFF]/),Cb=Pf(/^aria-[\-\w]+$/),Ob=Pf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_b=Pf(/^(?:\w+script|data):/i),Tb=Pf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Eb=Pf(/^html$/i),Db=Pf(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ab=Object.freeze({__proto__:null,MUSTACHE_EXPR:xb,ERB_EXPR:wb,TMPLIT_EXPR:Sb,DATA_ATTR:kb,ARIA_ATTR:Cb,IS_ALLOWED_URI:Ob,IS_SCRIPT_OR_DATA:_b,ATTR_WHITESPACE:Tb,DOCTYPE_NAME:Eb,CUSTOM_ELEMENT:Db});const Mb=1,Bb=3,Ib=7,Fb=8,Rb=9,Nb=function(){return"undefined"==typeof window?null:window};var Vb=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nb();const o=t=>e(t);if(o.version="3.1.7",o.removed=[],!t||!t.document||t.document.nodeType!==Rb)return o.isSupported=!1,o;let{document:n}=t;const r=n,s=r.currentScript,{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=lb(h,"cloneNode"),b=lb(h,"remove"),v=lb(h,"nextSibling"),y=lb(h,"childNodes"),x=lb(h,"parentNode");if("function"==typeof i){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,S="";const{implementation:k,createNodeIterator:C,createDocumentFragment:O,getElementsByTagName:_}=n,{importNode:T}=r;let E={};o.isSupported="function"==typeof Rf&&"function"==typeof x&&k&&void 0!==k.createHTMLDocument;const{MUSTACHE_EXPR:D,ERB_EXPR:A,TMPLIT_EXPR:M,DATA_ATTR:B,ARIA_ATTR:I,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:N}=Ab;let{IS_ALLOWED_URI:V}=Ab,z=null;const L=sb({},[...cb,...db,...ub,...gb,...hb]);let H=null;const P=sb({},[...fb,...bb,...vb,...yb]);let U=Object.seal(Uf(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}})),W=null,j=null,$=!0,G=!0,q=!1,Y=!0,X=!1,K=!0,J=!1,Z=!1,Q=!1,ee=!1,te=!1,oe=!1,ne=!0,re=!1,se=!0,ae=!1,ie={},le=null;const ce=sb({},["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 de=null;const ue=sb({},["audio","video","img","source","image","track"]);let me=null;const ge=sb({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",he="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let be=fe,ve=!1,ye=null;const xe=sb({},[pe,he,fe],Xf);let we=null;const Se=["application/xhtml+xml","text/html"];let ke=null,Ce=null;const Oe=n.createElement("form"),_e=function(e){return e instanceof RegExp||e instanceof Function},Te=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ce||Ce!==e){if(e&&"object"==typeof e||(e={}),e=ib(e),we=-1===Se.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ke="application/xhtml+xml"===we?Xf:Yf,z=eb(e,"ALLOWED_TAGS")?sb({},e.ALLOWED_TAGS,ke):L,H=eb(e,"ALLOWED_ATTR")?sb({},e.ALLOWED_ATTR,ke):P,ye=eb(e,"ALLOWED_NAMESPACES")?sb({},e.ALLOWED_NAMESPACES,Xf):xe,me=eb(e,"ADD_URI_SAFE_ATTR")?sb(ib(ge),e.ADD_URI_SAFE_ATTR,ke):ge,de=eb(e,"ADD_DATA_URI_TAGS")?sb(ib(ue),e.ADD_DATA_URI_TAGS,ke):ue,le=eb(e,"FORBID_CONTENTS")?sb({},e.FORBID_CONTENTS,ke):ce,W=eb(e,"FORBID_TAGS")?sb({},e.FORBID_TAGS,ke):{},j=eb(e,"FORBID_ATTR")?sb({},e.FORBID_ATTR,ke):{},ie=!!eb(e,"USE_PROFILES")&&e.USE_PROFILES,$=!1!==e.ALLOW_ARIA_ATTR,G=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,X=e.SAFE_FOR_TEMPLATES||!1,K=!1!==e.SAFE_FOR_XML,J=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,ne=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,se=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,V=e.ALLOWED_URI_REGEXP||Ob,be=e.NAMESPACE||fe,U=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(U.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(G=!1),te&&(ee=!0),ie&&(z=sb({},hb),H=[],!0===ie.html&&(sb(z,cb),sb(H,fb)),!0===ie.svg&&(sb(z,db),sb(H,bb),sb(H,yb)),!0===ie.svgFilters&&(sb(z,ub),sb(H,bb),sb(H,yb)),!0===ie.mathMl&&(sb(z,gb),sb(H,vb),sb(H,yb))),e.ADD_TAGS&&(z===L&&(z=ib(z)),sb(z,e.ADD_TAGS,ke)),e.ADD_ATTR&&(H===P&&(H=ib(H)),sb(H,e.ADD_ATTR,ke)),e.ADD_URI_SAFE_ATTR&&sb(me,e.ADD_URI_SAFE_ATTR,ke),e.FORBID_CONTENTS&&(le===ce&&(le=ib(le)),sb(le,e.FORBID_CONTENTS,ke)),se&&(z["#text"]=!0),J&&sb(z,["html","head","body"]),z.table&&(sb(z,["tbody"]),delete W.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ob('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ob('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,S=w.createHTML("")}else void 0===w&&(w=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 r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(p,s)),null!==w&&"string"==typeof S&&(S=w.createHTML(""));Hf&&Hf(e),Ce=e}},Ee=sb({},["mi","mo","mn","ms","mtext"]),De=sb({},["annotation-xml"]),Ae=sb({},["title","style","font","a","script"]),Me=sb({},[...db,...ub,...mb]),Be=sb({},[...gb,...pb]),Ie=function(e){qf(o.removed,{element:e});try{x(e).removeChild(e)}catch(t){b(e)}},Fe=function(e,t){try{qf(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){qf(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!H[e])if(ee||te)try{Ie(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){let t=null,o=null;if(Q)e="<remove></remove>"+e;else{const t=Kf(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===we&&be===fe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=w?w.createHTML(e):e;if(be===fe)try{t=(new g).parseFromString(r,we)}catch(e){}if(!t||!t.documentElement){t=k.createDocument(be,"template",null);try{t.documentElement.innerHTML=ve?S:r}catch(e){}}const s=t.body||t.documentElement;return e&&o&&s.insertBefore(n.createTextNode(o),s.childNodes[0]||null),be===fe?_.call(t,J?"html":"body")[0]:J?t.documentElement:s},Ne=function(e){return C.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ve=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},ze=function(e){return"function"==typeof l&&e instanceof l},Le=function(e,t,n){E[e]&&$f(E[e],(e=>{e.call(o,t,n,Ce)}))},He=function(e){let t=null;if(Le("beforeSanitizeElements",e,null),Ve(e))return Ie(e),!0;const n=ke(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:n,allowedTags:z}),e.hasChildNodes()&&!ze(e.firstElementChild)&&tb(/<[/\w]/g,e.innerHTML)&&tb(/<[/\w]/g,e.textContent))return Ie(e),!0;if(e.nodeType===Ib)return Ie(e),!0;if(K&&e.nodeType===Fb&&tb(/<[/\w]/g,e.data))return Ie(e),!0;if(!z[n]||W[n]){if(!W[n]&&Ue(n)){if(U.tagNameCheck instanceof RegExp&&tb(U.tagNameCheck,n))return!1;if(U.tagNameCheck instanceof Function&&U.tagNameCheck(n))return!1}if(se&&!le[n]){const t=x(e)||e.parentNode,o=y(e)||e.childNodes;if(o&&t){for(let n=o.length-1;n>=0;--n){const r=f(o[n],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,v(e))}}}return Ie(e),!0}return e instanceof c&&!function(e){let t=x(e);t&&t.tagName||(t={namespaceURI:be,tagName:"template"});const o=Yf(e.tagName),n=Yf(t.tagName);return!!ye[e.namespaceURI]&&(e.namespaceURI===he?t.namespaceURI===fe?"svg"===o:t.namespaceURI===pe?"svg"===o&&("annotation-xml"===n||Ee[n]):Boolean(Me[o]):e.namespaceURI===pe?t.namespaceURI===fe?"math"===o:t.namespaceURI===he?"math"===o&&De[n]:Boolean(Be[o]):e.namespaceURI===fe?!(t.namespaceURI===he&&!De[n])&&!(t.namespaceURI===pe&&!Ee[n])&&!Be[o]&&(Ae[o]||!Me[o]):!("application/xhtml+xml"!==we||!ye[e.namespaceURI]))}(e)?(Ie(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!tb(/<\/no(script|embed|frames)/i,e.innerHTML)?(X&&e.nodeType===Bb&&(t=e.textContent,$f([D,A,M],(e=>{t=Jf(t,e," ")})),e.textContent!==t&&(qf(o.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Ie(e),!0)},Pe=function(e,t,o){if(ne&&("id"===t||"name"===t)&&(o in n||o in Oe))return!1;if(G&&!j[t]&&tb(B,t));else if($&&tb(I,t));else if(!H[t]||j[t]){if(!(Ue(e)&&(U.tagNameCheck instanceof RegExp&&tb(U.tagNameCheck,e)||U.tagNameCheck instanceof Function&&U.tagNameCheck(e))&&(U.attributeNameCheck instanceof RegExp&&tb(U.attributeNameCheck,t)||U.attributeNameCheck instanceof Function&&U.attributeNameCheck(t))||"is"===t&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&tb(U.tagNameCheck,o)||U.tagNameCheck instanceof Function&&U.tagNameCheck(o))))return!1}else if(me[t]);else if(tb(V,Jf(o,R,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Zf(o,"data:")||!de[e]){if(q&&!tb(F,Jf(o,R,"")));else if(o)return!1}else;return!0},Ue=function(e){return"annotation-xml"!==e&&Kf(e,N)},We=function(e){Le("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H};let r=t.length;for(;r--;){const s=t[r],{name:a,namespaceURI:i,value:l}=s,c=ke(a);let d="value"===a?l:Qf(l);const u=d;if(n.attrName=c,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,n),d=n.attrValue,n.forceKeepAttr)continue;if(!n.keepAttr){Fe(a,e);continue}if(!Y&&tb(/\/>/i,d)){Fe(a,e);continue}X&&$f([D,A,M],(e=>{d=Jf(d,e," ")}));const m=ke(e.nodeName);if(Pe(m,c,d))if(!re||"id"!==c&&"name"!==c||(Fe(a,e),d="user-content-"+d),K&&tb(/((--!?|])>)|<\/(style|title)/i,d))Fe(a,e);else{if(w&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(i);else switch(p.getAttributeType(m,c)){case"TrustedHTML":d=w.createHTML(d);break;case"TrustedScriptURL":d=w.createScriptURL(d)}if(d!==u)try{i?e.setAttributeNS(i,a,d):e.setAttribute(a,d),Ve(e)?Ie(e):Gf(o.removed)}catch(e){}}else Fe(a,e)}Le("afterSanitizeAttributes",e,null)},je=function e(t){let o=null;const n=Ne(t);for(Le("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Le("uponSanitizeShadowNode",o,null),He(o)||(o.content instanceof a&&e(o.content),We(o));Le("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,s=null,i=null,c=null;if(ve=!e,ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ze(e)){if("function"!=typeof e.toString)throw ob("toString is not a function");if("string"!=typeof(e=e.toString()))throw ob("dirty is not a string, aborting")}if(!o.isSupported)return e;if(Z||Te(t),o.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=ke(e.nodeName);if(!z[t]||W[t])throw ob("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)n=Re("\x3c!----\x3e"),s=n.ownerDocument.importNode(e,!0),s.nodeType===Mb&&"BODY"===s.nodeName||"HTML"===s.nodeName?n=s:n.appendChild(s);else{if(!ee&&!X&&!J&&-1===e.indexOf("<"))return w&&oe?w.createHTML(e):e;if(n=Re(e),!n)return ee?null:oe?S:""}n&&Q&&Ie(n.firstChild);const d=Ne(ae?e:n);for(;i=d.nextNode();)He(i)||(i.content instanceof a&&je(i.content),We(i));if(ae)return e;if(ee){if(te)for(c=O.call(n.ownerDocument);n.firstChild;)c.appendChild(n.firstChild);else c=n;return(H.shadowroot||H.shadowrootmode)&&(c=T.call(r,c,!0)),c}let u=J?n.outerHTML:n.innerHTML;return J&&z["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&tb(Eb,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),X&&$f([D,A,M],(e=>{u=Jf(u,e," ")})),w&&oe?w.createHTML(u):u},o.setConfig=function(){Te(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},o.clearConfig=function(){Ce=null,Z=!1},o.isValidAttribute=function(e,t,o){Ce||Te({});const n=ke(e),r=ke(t);return Pe(n,r,o)},o.addHook=function(e,t){"function"==typeof t&&(E[e]=E[e]||[],qf(E[e],t))},o.removeHook=function(e){if(E[e])return Gf(E[e])},o.removeHooks=function(e){E[e]&&(E[e]=[])},o.removeAllHooks=function(){E={}},o}();const zb=e=>Vb().sanitize(e);var Lb=tinymce.util.Tools.resolve("tinymce.util.I18n");const Hb={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},Pb="temporary-placeholder",Ub=e=>()=>be(e,Pb).getOr("!not found!"),Wb=(e,t)=>{const o=e.toLowerCase();if(Lb.isRtl()){const e=((e,t)=>De(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return ve(t,e)?e:o}return o},jb=(e,t)=>be(t,Wb(e,t)),$b=(e,t)=>{const o=t();return jb(e,o).getOrThunk(Ub(o))},Gb=()=>Vh("add-focusable",[ia((e=>{Ii(e.element,"svg").each((e=>kt(e,"focusable","false")))}))]),qb=(e,t,o,n)=>{var r,s;const a=(e=>!!Lb.isRtl()&&ve(Hb,e))(t)?["tox-icon--flip"]:[],i=be(o,Wb(t,o)).or(n).getOrThunk(Ub(o));return{dom:{tag:e.tag,attributes:null!==(r=e.attributes)&&void 0!==r?r:{},classes:e.classes.concat(a),innerHtml:i},behaviours:ql([...null!==(s=e.behaviours)&&void 0!==s?s:[],Gb()])}},Yb=(e,t,o,n=D.none())=>qb(t,e,o(),n),Xb={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Kb=tg({name:"Notification",factory:e=>{const t=Ff({dom:If(`<p>${zb(e.translationProvider(e.text))}</p>`),behaviours:ql([Nh.config({})])}),o=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),n=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=Ff({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(0)]},n(0)],behaviours:ql([Nh.config({})])}),s={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each((e=>{Nh.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[o(t)]},n(t)])}))},updateText:(e,o)=>{if(e.getSystem().isConnected()){const n=t.get(e);Nh.set(n,[Si(o)])}}},a=q([e.icon.toArray(),e.level.toArray(),e.level.bind((e=>D.from(Xb[e]))).toArray()]),i=Ff(Bf.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[Yb("close",{tag:"span",classes:["tox-icon"],attributes:{"aria-label":e.translationProvider("Close")}},e.iconProvider)],action:t=>{e.onAction(t)}})),l=((e,t,o)=>{const n=o(),r=$(e,(e=>ve(n,Wb(e,n))));return qb(t,r.getOr(Pb),n,D.none())})(a,{tag:"div",classes:["tox-notification__icon"]},e.iconProvider),c=[l,{dom:{tag:"div",classes:["tox-notification__body"]},components:[t.asSpec()],behaviours:ql([Nh.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert"},classes:e.level.map((e=>["tox-notification","tox-notification--in",`tox-notification--${e}`])).getOr(["tox-notification","tox-notification--in"])},behaviours:ql([Uh.config({}),Vh("notification-events",[Qs(ss(),(e=>{i.getOpt(e).each(Uh.focus)}))])]),components:c.concat(e.progress?[r.asSpec()]:[]).concat(e.closeButton?[i.asSpec()]:[]),apis:s}},configFields:[yr("level"),dr("progress"),yr("icon"),dr("onAction"),dr("text"),dr("iconProvider"),dr("translationProvider"),Br("closeButton",!0)],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var Jb,Zb,Qb=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),ev=tinymce.util.Tools.resolve("tinymce.EditorManager"),tv=tinymce.util.Tools.resolve("tinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(Jb||(Jb={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(Zb||(Zb={}));const ov=e=>t=>t.options.get(e),nv=e=>t=>D.from(e(t)),rv=e=>{const t=tv.deviceType.isPhone(),o=tv.deviceType.isTablet()||t,n=e.options.register,r=e=>s(e)||!1===e,a=e=>s(e)||h(e);n("skin",{processor:e=>s(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:Qb.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=>s(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||s(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),V(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:Zb.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:r,default:"#top"}),n("anchor_bottom",{processor:r,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:!tv.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},sv=ov("readonly"),av=ov("height"),iv=ov("width"),lv=nv(ov("min_width")),cv=nv(ov("min_height")),dv=nv(ov("max_width")),uv=nv(ov("max_height")),mv=nv(ov("style_formats")),gv=ov("style_formats_merge"),pv=ov("style_formats_autohide"),hv=ov("content_langs"),fv=ov("removed_menuitems"),bv=ov("toolbar_mode"),vv=ov("toolbar_groups"),yv=ov("toolbar_location"),xv=ov("fixed_toolbar_container"),wv=ov("fixed_toolbar_container_target"),Sv=ov("toolbar_persist"),kv=ov("toolbar_sticky_offset"),Cv=ov("menubar"),Ov=ov("toolbar"),_v=ov("file_picker_callback"),Tv=ov("file_picker_validator_handler"),Ev=ov("font_size_input_default_unit"),Dv=ov("file_picker_types"),Av=ov("typeahead_urls"),Mv=ov("anchor_top"),Bv=ov("anchor_bottom"),Iv=ov("draggable_modal"),Fv=ov("statusbar"),Rv=ov("elementpath"),Nv=ov("branding"),Vv=ov("resize"),zv=ov("paste_as_text"),Lv=ov("sidebar_show"),Hv=ov("promotion"),Pv=ov("help_accessibility"),Uv=ov("default_font_stack"),Wv=e=>!1===e.options.get("skin"),jv=e=>!1!==e.options.get("menubar"),$v=e=>{const t=e.options.get("skin_url");if(Wv(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return ev.baseURL+"/skins/ui/"+t}},Gv=e=>D.from(e.options.get("skin_url")),qv=e=>e.options.get("line_height_formats").split(" "),Yv=e=>{const t=Ov(e),o=s(t),n=l(t)&&t.length>0;return!Kv(e)&&(n||o||!0===t)},Xv=e=>{const t=V(9,(t=>e.options.get("toolbar"+(t+1)))),o=U(t,s);return Ce(o.length>0,o)},Kv=e=>Xv(e).fold((()=>{const t=Ov(e);return f(t,s)&&t.length>0}),E),Jv=e=>yv(e)===Zb.bottom,Zv=e=>{var t;if(!e.inline)return D.none();const o=null!==(t=xv(e))&&void 0!==t?t:"";if(o.length>0)return Fi(xt(),o);const n=wv(e);return g(n)?D.some(Re.fromDom(n)):D.none()},Qv=e=>e.inline&&Zv(e).isSome(),ey=e=>Zv(e).getOrThunk((()=>ht(pt(Re.fromDom(e.getElement()))))),ty=e=>e.inline&&!jv(e)&&!Yv(e)&&!Kv(e),oy=e=>(e.options.get("toolbar_sticky")||e.inline)&&!Qv(e)&&!ty(e),ny=e=>!Qv(e)&&"split"===e.options.get("ui_mode"),ry=e=>{const t=e.options.get("menu");return ce(t,(e=>({...e,items:e.items})))};var sy=Object.freeze({__proto__:null,get ToolbarMode(){return Jb},get ToolbarLocation(){return Zb},register:rv,getSkinUrl:$v,getSkinUrlOption:Gv,isReadOnly:sv,isSkinDisabled:Wv,getHeightOption:av,getWidthOption:iv,getMinWidthOption:lv,getMinHeightOption:cv,getMaxWidthOption:dv,getMaxHeightOption:uv,getUserStyleFormats:mv,shouldMergeStyleFormats:gv,shouldAutoHideStyleFormats:pv,getLineHeightFormats:qv,getContentLanguages:hv,getRemovedMenuItems:fv,isMenubarEnabled:jv,isMultipleToolbars:Kv,isToolbarEnabled:Yv,isToolbarPersist:Sv,getMultipleToolbarsOption:Xv,getUiContainer:ey,useFixedContainer:Qv,isSplitUiMode:ny,getToolbarMode:bv,isDraggableModal:Iv,isDistractionFree:ty,isStickyToolbar:oy,getStickyToolbarOffset:kv,getToolbarLocation:yv,isToolbarLocationBottom:Jv,getToolbarGroups:vv,getMenus:ry,getMenubar:Cv,getToolbar:Ov,getFilePickerCallback:_v,getFilePickerTypes:Dv,useTypeaheadUrls:Av,getAnchorTop:Mv,getAnchorBottom:Bv,getFilePickerValidatorHandler:Tv,getFontSizeInputDefaultUnit:Ev,useStatusBar:Fv,useElementPath:Rv,promotionEnabled:Hv,useBranding:Nv,getResize:Vv,getPasteAsText:zv,getSidebarShow:Lv,useHelpAccessibility:Pv,getDefaultFontStack:Uv});const ay="[data-mce-autocompleter]",iy=e=>Ri(e,ay),ly=(e,t)=>{const o=(e,t)=>{$s(e,is(),{raw:t})},n=()=>e.getMenu().bind(Mg.getHighlighted);t.on("keydown",(t=>{const r=t.which;e.isActive()&&(e.isMenuOpen()?13===r?(n().each(Gs),t.preventDefault()):40===r?(n().fold((()=>{e.getMenu().each(Mg.highlightFirst)}),(e=>{o(e,t)})),t.preventDefault(),t.stopImmediatePropagation()):37!==r&&38!==r&&39!==r||n().each((e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()})):13!==r&&38!==r&&40!==r||e.cancelIfNecessary())})),t.on("NodeChange",(t=>{e.isActive()&&!e.isProcessingAction()&&iy(Re.fromDom(t.element)).isNone()&&e.cancelIfNecessary()}))};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=>be(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:q([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},Ty=[xf.parts.items({})],Ey=(e,t,o)=>{const n=Cy(o);return{dom:{tag:"div",classes:q([[n.tieredMenu]])},markers:Oy(o)}},Dy=x([yr("data"),Tr("inputAttributes",{}),Tr("inputStyles",{}),Tr("tag","input"),Tr("inputClasses",[]),el("onSetValue"),Tr("styles",{}),Tr("eventOrder",{}),Zu("inputBehaviours",[Ju,Uh]),Tr("selectOnFocus",!0)]),Ay=e=>ql([Uh.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=ci(t);t.dom.setSelectionRange(0,o.length)}:b})]),My=e=>({...Ay(e),...em(e.inputBehaviours,[Ju.config({store:{mode:"manual",...e.data.map((e=>({initialValue:e}))).getOr({}),getValue:e=>ci(e.element),setValue:(e,t)=>{ci(e.element)!==t&&di(e.element,t)}},onSetValue:e.onSetValue})])}),By=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),Iy=tg({name:"Input",configFields:Dy(),factory:(e,t)=>({uid:e.uid,dom:By(e),components:[],behaviours:My(e),eventOrder:e.eventOrder})}),Fy=ya("refetch-trigger-event"),Ry=ya("redirect-menu-item-interaction"),Ny="tox-menu__searcher",Vy=e=>Fi(e.element,`.${Ny}`).bind((t=>e.getSystem().getByDom(t).toOptional())),zy=Vy,Ly=e=>({fetchPattern:Ju.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),Hy=e=>{const t=(e,t)=>(t.cut(),D.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return $s(e,Ry,o),D.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:ql([Vh(n,[Qs(cs(),(e=>{js(e,Fy)})),Qs(is(),((e,t)=>{"Escape"===t.event.raw.key&&t.stop()}))]),Th.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,Th.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:ya("aria-item-search-result-id"),"aria-selected":"false"}}}:e},Wy=(e,t)=>o=>{const n=z(o,t);return L(n,(t=>({dom:e,components:t})))},jy=(e,t)=>{const o=[];let n=[];return H(e,((e,r)=>{t(e,r)?(n.length>0&&o.push(n),n=[],(ve(e.dom,"innerHtml")||e.components&&e.components.length>0)&&n.push(e)):n.push(e)})),n.length>0&&o.push(n),L(o,(e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e})))},$y=(e,t,o)=>xf.parts.items({preprocess:n=>{const r=L(n,o);return"auto"!==e&&e>1?Wy({tag:"div",classes:["tox-collection__group"]},e)(r):jy(r,((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=>N(e,(e=>"icon"in e&&void 0!==e.icon)),Yy=e=>(console.error(rr(e)),console.log(e),D.none()),Xy=(e,t,o,n,r)=>{const s=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[xf.parts.items({preprocess:e=>jy(e,((e,t)=>"separator"===a[t].type))})]});var a;return{value:e,dom:s.dom,components:s.components,items:o}},Ky=(e,t,o,n,r)=>{const s=()=>"searchable"!==r.menuType?Gy(n,o):"search-with-field"===r.searchMode.searchMode?((e,t,o)=>{const n=ya("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:Lb.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,r.searchMode):((e,t)=>{const o=ya("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:o}},components:[$y(e,t,Uy)]}})(n,o);if("color"===r.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[xf.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"===r.menuType&&"auto"===n){const t=Gy(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType||"searchable"===r.menuType){const t=s();return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===r.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[xf.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,r.menuType),components:Ty,items:o}},Jy=gr("type"),Zy=gr("name"),Qy=gr("label"),ex=gr("text"),tx=gr("title"),ox=gr("icon"),nx=gr("value"),rx=hr("fetch"),sx=hr("getSubmenuItems"),ax=hr("onAction"),ix=hr("onItemAction"),lx=Ir("onSetup",(()=>b)),cx=Sr("name"),dx=Sr("text"),ux=Sr("icon"),mx=Sr("tooltip"),gx=Sr("label"),px=Sr("shortcut"),hx=Cr("select"),fx=Br("active",!1),bx=Br("borderless",!1),vx=Br("enabled",!0),yx=Br("primary",!1),xx=e=>Tr("columns",e),wx=Tr("meta",{}),Sx=Ir("onAction",b),kx=e=>Ar("type",e),Cx=e=>ir("name","name",kn((()=>ya(`${e}-name`))),Gn),Ox=zn([Jy,dx]),_x=zn([kx("autocompleteitem"),fx,vx,wx,nx,dx,ux]),Tx=[vx,mx,ux,dx,lx],Ex=zn([Jy,ax].concat(Tx)),Dx=e=>tr("toolbarbutton",Ex,e),Ax=[fx].concat(Tx),Mx=zn(Ax.concat([Jy,ax])),Bx=e=>tr("ToggleButton",Mx,e),Ix=[Ir("predicate",T),Mr("scope","node",["node","editor"]),Mr("position","selection",["node","selection","line"])],Fx=Tx.concat([kx("contextformbutton"),yx,ax,lr("original",w)]),Rx=Ax.concat([kx("contextformbutton"),yx,ax,lr("original",w)]),Nx=Tx.concat([kx("contextformbutton")]),Vx=Ax.concat([kx("contextformtogglebutton")]),zx=sr("type",{contextformbutton:Fx,contextformtogglebutton:Rx}),Lx=zn([kx("contextform"),Ir("initValue",x("")),gx,vr("commands",zx),xr("launch",sr("type",{contextformbutton:Nx,contextformtogglebutton:Vx}))].concat(Ix)),Hx=zn([kx("contexttoolbar"),gr("items")].concat(Ix)),Px=[Jy,gr("src"),Sr("alt"),Fr("classes",[],Gn)],Ux=zn(Px),Wx=[Jy,ex,cx,Fr("classes",["tox-collection__item-label"],Gn)],jx=zn(Wx),$x=Rn((()=>Zn("type",{cardimage:Ux,cardtext:jx,cardcontainer:Gx}))),Gx=zn([Jy,Ar("direction","horizontal"),Ar("align","left"),Ar("valign","middle"),vr("items",$x)]),qx=[vx,dx,px,(Yx="menuitem",ir("value","value",kn((()=>ya(`${Yx}-value`))),Wn())),wx];var Yx;const Xx=zn([Jy,gx,vr("items",$x),lx,Sx].concat(qx)),Kx=zn([Jy,fx,ux].concat(qx)),Jx=[Jy,gr("fancytype"),Sx],Zx=[Tr("initData",{})].concat(Jx),Qx=[Cr("select"),Rr("initData",{},[Br("allowCustomColors",!0),Ar("storageKey","default"),Or("colors",Wn())])].concat(Jx),ew=sr("fancytype",{inserttable:Zx,colorswatch:Qx}),tw=zn([Jy,lx,Sx,ux].concat(qx)),ow=zn([Jy,sx,lx,ux].concat(qx)),nw=zn([Jy,ux,fx,lx,ax].concat(qx)),rw=(e,t,o)=>{const n=Od(e.element,"."+o);if(n.length>0){const e=G(n,(e=>{const o=e.dom.getBoundingClientRect().top,r=n[0].dom.getBoundingClientRect().top;return Math.abs(o-r)>t})).getOr(n.length);return D.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return D.none()},sw=(e,t)=>ql([Vh(e,t)]),aw=e=>sw(ya("unnamed-events"),e),iw=ya("tooltip.exclusive"),lw=ya("tooltip.show"),cw=ya("tooltip.hide"),dw=(e,t,o)=>{e.getSystem().broadcastOn([iw],{})};var uw=Object.freeze({__proto__:null,hideAllExclusive:dw,setComponents:(e,t,o,n)=>{o.getTooltip().each((e=>{e.getSystem().isConnected()&&Nh.set(e,n)}))}});var mw=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each((n=>{hu(n),e.onHide(o,n),t.clearTooltip()})),t.clearTimer()};return Ks(q([[Qs(lw,(o=>{t.resetTimer((()=>{(o=>{if(!t.isShowing()){dw(o);const n=e.lazySink(o).getOrDie(),r=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Ks("normal"===e.mode?[Qs(rs(),(e=>{js(o,lw)})),Qs(os(),(e=>{js(o,cw)}))]:[]),behaviours:ql([Nh.config({})])});t.setTooltip(r),mu(n,r),e.onShow(o,r),ru.position(n,r,{anchor:e.anchor(o)})}})(o)}),e.delay)})),Qs(cw,(n=>{t.resetTimer((()=>{o(n)}),e.delay)})),Qs(ws(),((e,t)=>{const n=t;n.universal||R(n.channels,iw)&&o(e)})),la((e=>{o(e)}))],"normal"===e.mode?[Qs(ss(),(e=>{js(e,lw)})),Qs(ys(),(e=>{js(e,cw)})),Qs(rs(),(e=>{js(e,lw)})),Qs(os(),(e=>{js(e,cw)}))]:[Qs(Us(),((e,t)=>{js(e,lw)})),Qs(Ws(),(e=>{js(e,cw)}))]]))}}),gw=[dr("lazySink"),dr("tooltipDom"),Tr("exclusive",!0),Tr("tooltipComponents",[]),Tr("delay",300),Mr("mode","normal",["normal","follow-highlight"]),Tr("anchor",(e=>({type:"hotspot",hotspot:e,layouts:{onLtr:x([Bl,Ml,Tl,Dl,El,Al]),onRtl:x([Bl,Ml,Tl,Dl,El,Al])}}))),el("onHide"),el("onShow")];var pw=Object.freeze({__proto__:null,init:()=>{const e=Cc(),t=Cc(),o=()=>{e.on(clearTimeout)},n=x("not-implemented");return Va({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 hw=Xl({fields:gw,name:"tooltipping",active:mw,state:pw,apis:uw}),fw="silver.readonly",bw=zn([(vw="readonly",ur(vw,qn))]);var vw;const yw=(e,t)=>{const o=e.mainUi.outerContainer.element,n=[e.mainUi.mothership,...e.uiMotherships];t&&H(n,(e=>{e.broadcastOn([Bu()],{target:o})})),H(n,(e=>{e.broadcastOn([fw],{readonly:t})}))},xw=(e,t)=>{e.on("init",(()=>{e.mode.isReadOnly()&&yw(t,!0)})),e.on("SwitchMode",(()=>yw(t,e.mode.isReadOnly()))),sv(e)&&e.mode.set("readonly")},ww=()=>Ql.config({channels:{[fw]:{schema:bw,onReceive:(e,t)=>{xg.set(e,t.readonly)}}}}),Sw=e=>xg.config({disabled:e,disableClass:"tox-collection__item--state-disabled"}),kw=e=>xg.config({disabled:e}),Cw=e=>xg.config({disabled:e,disableClass:"tox-tbtn--disabled"}),Ow=e=>xg.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),_w=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},Tw=(e,t)=>ia((o=>{_w(e,o)((o=>{const n=e.onSetup(o);p(n)&&t.set(n)}))})),Ew=(e,t)=>la((o=>_w(e,o)(t.get()))),Dw=(e,t)=>da(((o,n)=>{_w(e,o)(e.onAction),e.triggersSubmenu||t!==dy.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&js(o,_s()),n.stop())})),Aw={[Ss()]:["disabling","alloy.base.behaviour","toggling","item-events"]},Mw=we,Bw=(e,t,o,n)=>{const r=Nr(b);return{type:"item",dom:t.dom,components:Mw(t.optComponents),data:e.data,eventOrder:Aw,hasSubmenu:e.triggersSubmenu,itemBehaviours:ql([Vh("item-events",[Dw(e,o),Tw(e,r),Ew(e,r)]),Sw((()=>!e.enabled||n.isDisabled())),ww(),Nh.config({})].concat(e.itemBehaviours))}},Iw=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),Fw=e=>{const t=tv.os.isMacOS()||tv.os.isiOS(),o=t?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),r=L(n,(e=>{const t=e.toLowerCase().trim();return ve(o,t)?o[t]:e}));return t?r.join(""):r.join("+")},Rw=(e,t,o=[fy])=>Yb(e,{tag:"div",classes:o},t),Nw=e=>({dom:{tag:"div",classes:[by]},components:[Si(Lb.translate(e))]}),Vw=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),zw=(e,t)=>({dom:{tag:"div",classes:[by]},components:[{dom:{tag:e.tag,styles:e.styles},components:[Si(Lb.translate(t))]}]}),Lw=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[Si(Fw(e))]}),Hw=e=>Rw("checkmark",e,["tox-collection__item-checkmark"]),Pw=(e,t,o)=>{const n=e.ariaLabel,r=e.value,s=e.iconContent.map((e=>((e,t,o)=>{const n=t();return jb(e,n).or(o).getOrThunk(Ub(n))})(e,t.icons,o)));return{dom:(()=>{const e=gy,o=s.getOr(""),a=n.map((e=>({title:t.translate(e)}))).getOr({}),i={tag:"div",attributes:a,classes:[e]};return"custom"===r?{...i,tag:"button",classes:[...i.classes,"tox-swatches__picker-btn"],innerHtml:o}:"remove"===r?{...i,classes:[...i.classes,"tox-swatch--remove"],innerHtml:o}:g(r)?{...i,attributes:{...i.attributes,"data-mce-color":r},styles:{"background-color":r},innerHtml:o}:i})(),optComponents:[]}},Uw=e=>{const t=e.map((e=>({attributes:{title:Lb.translate(e),id:ya("menu-item")}}))).getOr({});return{tag:"div",classes:[uy,my],...t}},Ww=(e,t,o,n=D.none())=>"color"===e.presets?Pw(e,t,n):((e,t,o,n)=>{const r={tag:"div",classes:[fy]},s=o?e.iconContent.map((e=>Yb(e,r,t.icons,n))).orThunk((()=>D.some({dom:r}))):D.none(),a=e.checkMark,i=D.from(e.meta).fold((()=>Nw),(e=>ve(e,"style")?k(zw,e.style):Nw)),l=e.htmlContent.fold((()=>e.textContent.map(i)),(e=>D.some(Vw(e,[by]))));return{dom:Uw(e.ariaLabel),optComponents:[s,l,e.shortcutContent.map(Lw),a,e.caret]}})(e,t,o,n),jw=(e,t)=>be(e,"tooltipWorker").map((e=>[hw.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:Lc}}),mode:"follow-highlight",onShow:(t,o)=>{e((e=>{hw.setComponents(t,[ki({element:Re.fromDom(e)})])}))}})])).getOr([]),$w=(e,t)=>{const o=(e=>Qb.DOM.encode(e))(Lb.translate(e));if(t.length>0){const e=new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t),"gi");return o.replace(e,(e=>`<span class="tox-autocompleter-highlight">${e}</span>`))}return o},Gw=(e,t)=>L(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,Gw(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=>R(t.cardText.highlightOn,e))),n=o?D.from(t.cardText.matchText).getOr(""):"";return Vw($w(e.text,n),e.classes)}})),qw=Fm(gf(),pf()),Yw=e=>({value:Zw(e)}),Xw=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Kw=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Jw=e=>Xw.test(e)||Kw.test(e),Zw=e=>_e(e,"#").toUpperCase(),Qw=e=>{const t=(e=>{const t=e.value.replace(Xw,((e,t,o,n)=>t+t+o+o+n+n));return{value:t}})(e),o=Kw.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o},eS=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},tS=e=>{const t=eS(e.red)+eS(e.green)+eS(e.blue);return Yw(t)},oS=Math.min,nS=Math.max,rS=Math.round,sS=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,aS=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,iS=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),lS=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},cS=e=>{let t,o,n;const r=(e.hue||0)%360;let s=e.saturation/100,a=e.value/100;if(s=nS(0,oS(s,1)),a=nS(0,oS(a,1)),0===s)return t=o=n=rS(255*a),iS(t,o,n,1);const i=r/60,l=a*s,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=rS(255*(t+d)),o=rS(255*(o+d)),n=rS(255*(n+d)),iS(t,o,n,1)},dS=e=>{const t=Qw(e),o=parseInt(t[1],16),n=parseInt(t[2],16),r=parseInt(t[3],16);return iS(o,n,r,1)},uS=(e,t,o,n)=>{const r=parseInt(e,10),s=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return iS(r,s,a,i)},mS=e=>{if("transparent"===e)return D.some(iS(0,0,0,0));const t=sS.exec(e);if(null!==t)return D.some(uS(t[1],t[2],t[3],"1"));const o=aS.exec(e);return null!==o?D.some(uS(o[1],o[2],o[3],o[4])):D.none()},gS=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,pS=iS(255,0,0,1),hS=(e,t)=>{e.dispatch("ResizeContent",t)},fS=(e,t)=>{e.dispatch("TextColorChange",t)},bS=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),vS=(e,t)=>()=>{e(),t()},yS=e=>wS(e,"NodeChange",(t=>{t.setEnabled(e.selection.isEditable())})),xS=(e,t)=>o=>{const n=yS(e)(o),r=((e,t)=>o=>{const n=kc(),r=()=>{o.setActive(e.formatter.match(t));const r=e.formatter.formatChanged(t,o.setActive);n.set(r)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),n.clear()}})(e,t)(o);return()=>{n(),r()}},wS=(e,t,o)=>n=>{const r=()=>o(n),s=()=>{o(n),e.on(t,r)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),e.off(t,r)}},SS=e=>t=>()=>{e.undoManager.transact((()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)}))},kS=(e,t)=>()=>e.execCommand(t);var CS=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const OS={},_S=e=>be(OS,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=s(o)?JSON.parse(o):[],r=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{r.splice(e,1)};return{add:o=>{F(r,o).each(i),r.unshift(o),r.length>t&&r.pop(),CS.setItem(e,JSON.stringify(r))},state:()=>r.slice(0)}})(t,10);return OS[e]=n,n})),TS=(e,t)=>{_S(e).add(t)},ES=(e,t,o)=>({hue:e,saturation:t,value:o}),DS=e=>{let t=0,o=0,n=0;const r=e.red/255,s=e.green/255,a=e.blue/255,i=Math.min(r,Math.min(s,a)),l=Math.max(r,Math.max(s,a));if(i===l)return n=i,ES(0,0,100*n);return t=r===i?3:a===i?1:5,t=60*(t-(r===i?s-a:a===i?r-s:a-r)/(l-i)),o=(l-i)/l,n=l,ES(Math.round(t),Math.round(100*o),Math.round(100*n))},AS=e=>tS(cS(e)),MS=e=>{return(t=e,Jw(t)?D.some({value:Zw(t)}):D.none()).orThunk((()=>mS(e).map(tS))).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,r=n[0],s=n[1],a=n[2],i=n[3];return tS(iS(r,s,a,i))}));var t},BS="forecolor",IS="hilitecolor",FS=e=>{const t=[];for(let o=0;o<e.length;o+=2)t.push({text:e[o+1],value:"#"+MS(e[o]).value,icon:"checkmark",type:"choiceitem"});return t},RS=e=>t=>t.options.get(e),NS="#000000",VS=(e,t)=>t===BS&&e.options.isSet("color_map_foreground")?RS("color_map_foreground")(e):t===IS&&e.options.isSet("color_map_background")?RS("color_map_background")(e):RS("color_map")(e),zS=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(VS(e,t).length))),LS=(e,t)=>{const o=RS("color_cols")(e),n=zS(e,t);return o===zS(e)?n:o},HS=(e,t="default")=>Math.round(t===BS?RS("color_cols_foreground")(e):t===IS?RS("color_cols_background")(e):RS("color_cols")(e)),PS=RS("custom_colors"),US=RS("color_default_foreground"),WS=RS("color_default_background"),jS=e=>jr(e,(e=>{if(je(e)){const t=Ft(e,"background-color");return Ce((e=>mS(e).exists((e=>0!==e.alpha)))(t),t)}return D.none()})).getOr("rgba(0, 0, 0, 0)"),$S=(e,t)=>{const o=Re.fromDom(e.selection.getStart()),n="hilitecolor"===t?jS(o):Ft(o,"color");return mS(n).map((e=>"#"+tS(e).value))},GS=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]},qS=(e,t,o,n)=>{if("custom"===o){ok(e)((o=>{o.each((o=>{TS(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)}))}),$S(e,t).getOr(NS))}else"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},YS=(e,t,o)=>e.concat((e=>L(_S(e).state(),(e=>({type:"choiceitem",text:e,icon:"checkmark",value:e}))))(t).concat(GS(o))),XS=(e,t,o)=>n=>{n(YS(e,t,o))},KS=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},JS=(e,t)=>{e.setTooltip(t)},ZS=(e,t)=>o=>{const n=$S(e,t);return xe(n,o.toUpperCase())},QS=(e,t,o)=>{if(Be(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",r=YS(VS(e,t),t,!1),s=$(r,(e=>e.value===o)).getOr({text:""}).text;return e.translate([n,e.translate(s)])},ek=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:QS(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:ZS(e,o),columns:HS(e,o),fetch:XS(VS(e,o),o,PS(e)),onAction:t=>{qS(e,o,n.get(),b)},onItemAction:(r,s)=>{qS(e,o,s,(o=>{n.set(o),fS(e,{name:t,color:o})}))},onSetup:r=>{KS(r,t,n.get());const s=n=>{n.name===t&&(KS(r,n.name,n.color),JS(r,QS(e,o,n.color)))};return e.on("TextColorChange",s),vS(yS(e)(r),(()=>{e.off("TextColorChange",s)}))}})},tk=(e,t,o,n,r)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(JS(n,QS(e,o,r.get())),KS(n,t,r.get()),yS(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:ZS(e,o),initData:{storageKey:o},onAction:n=>{qS(e,o,n.value,(o=>{r.set(o),fS(e,{name:t,color:o})}))}}]})},ok=e=>(t,o)=>{let n=!1;const r={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:r,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const r=o.getData().colorpicker;n?(t(D.from(r)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",r]))},onClose:b,onCancel:()=>{t(D.none())}})},nk=(e,t,o,n,r,s,a,i)=>{const l=qy(t),c=rk(t,o,n,"color"!==r?"normal":"color",s,a,i);return Ky(e,l,c,n,{menuType:r})},rk=(e,t,o,n,r,s,a)=>we(L(e,(i=>{return"choiceitem"===i.type?(l=i,tr("choicemenuitem",Kx,l)).fold(Yy,(i=>D.some(((e,t,o,n,r,s,a,i=!0)=>{const l=Ww({presets:o,textContent:t?e.text:D.none(),htmlContent:D.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:D.none(),checkMark:t?D.some(Hw(a.icons)):D.none(),caret:D.none(),value:e.value},a,i);return wn(Bw({data:Iw(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Kh.set(e,t)},isActive:()=>Kh.isOn(e),isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(r),b),triggersSubmenu:!1,itemBehaviours:[]},l,s,a),{toggling:{toggleClass:hy,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(i,1===o,n,t,s(i.value),r,a,qy(e))))):D.none();var l}))),sk=(e,t)=>{const o=Oy(t);if(1===e)return{mode:"menu",moveOnTab:!0};if("auto"===e)return{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}};return{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group"),previousSelector:e=>"color"===t?Fi(e.element,"[aria-checked=true]"):D.none()}},ak=(e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold((()=>YS(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o)),(e=>e.concat(GS(o))))},ik=ya("cell-over"),lk=ya("cell-execute"),ck=(e,t,o)=>{const n=o=>$s(o,lk,{row:e,col:t}),r=(e,t)=>{t.stop(),n(e)};return _i({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:ql([Vh("insert-table-picker-cell",[Qs(rs(),Uh.focus),Qs(Ss(),n),Qs(us(),r),Qs(Cs(),r)]),Kh.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Uh.config({onFocus:o=>$s(o,ik,{row:e,col:t})})])})},dk=e=>Y(e,(e=>L(e,Ti))),uk=(e,t)=>Si(`${t}x${e}`),mk={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 r=0;r<t;r++){const t=[];for(let n=0;n<o;n++){const o=e(r+1,n+1);t.push(ck(r,n,o))}n.push(t)}return n})(o,10,10),r=uk(0,0),s=Ff({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[r],behaviours:ql([Nh.config({})])});return{type:"widget",data:{value:ya("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[qw.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:dk(n).concat(s.asSpec()),behaviours:ql([Vh("insert-table-picker",[ia((e=>{Nh.set(s.get(e),[r])})),na(ik,((e,t,o)=>{const{row:r,col:a}=o.event;((e,t,o,n,r)=>{for(let s=0;s<n;s++)for(let n=0;n<r;n++)Kh.set(e[s][n],s<=t&&n<=o)})(n,r,a,10,10),Nh.set(s.get(e),[uk(r+1,a+1)])})),na(lk,((t,o,n)=>{const{row:r,col:s}=n.event;e.onAction({numRows:r+1,numColumns:s+1}),js(t,_s())}))]),Th.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=ak(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),r="color",s=nk(ya("menu-value"),o,(t=>{e.onAction({value:t})}),n,r,dy.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),a={...s,markers:Oy(r),movement:sk(n,r)};return{type:"widget",data:{value:ya("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[qw.widget(xf.sketch(a))]}}},gk=(e,t,o,n,r,s,a,i=!0)=>{const l=Ww({presets:n,textContent:D.none(),htmlContent:o?e.text.map((e=>$w(e,t))):D.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:D.none(),checkMark:D.none(),caret:D.none(),value:e.value},a.providers,i,e.icon);return Bw({data:Iw(e),enabled:e.enabled,getApi:x({}),onAction:t=>r(e.value,e.meta),onSetup:x(b),triggersSubmenu:!1,itemBehaviours:jw(e.meta,a)},l,s,a.providers)},pk=e=>({type:"separator",dom:{tag:"div",classes:[my,"tox-collection__group-heading"]},components:e.text.map(Si).toArray()}),hk=(e,t,o,n=!0)=>{const r=Ww({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,caret:D.none(),checkMark:D.none(),shortcutContent:e.shortcut},o,n);return Bw({data:Iw(e),getApi:e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o)},fk=(e,t,o,n=!0,r=!1)=>{const s=r?(a=o.icons,Rw("chevron-down",a,[vy])):(e=>Rw("chevron-right",e,[vy]))(o.icons);var a;const i=Ww({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,caret:D.some(s),checkMark:D.none(),shortcutContent:e.shortcut},o,n);return Bw({data:Iw(e),getApi:e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setIconFill:(t,o)=>{Fi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{kt(e,"fill",o)}))},setTooltip:t=>{const n=o.translate(t);Ct(e.element,{"aria-label":n,title:n})}}),enabled:e.enabled,onAction:b,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)},bk=(e,t,o,n=!0)=>{const r=Ww({iconContent:e.icon,textContent:e.text,htmlContent:D.none(),ariaLabel:e.text,checkMark:D.some(Hw(o.icons)),caret:D.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return wn(Bw({data:Iw(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Kh.set(e,t)},isActive:()=>Kh.isOn(e),isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o),{toggling:{toggleClass:hy,toggleOnExecute:!1,selected:e.active}})},vk=(e,t)=>be(mk,e.fancytype).map((o=>o(e,t))),yk=(e,t,o,n)=>{const r={dom:Uw(e.label),optComponents:[D.some({dom:{tag:"div",classes:[xy,wy]},components:Gw(e.items,n)})]};return Bw({data:Iw({text:D.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>{xg.set(e,!t),H(Od(e.element,"*"),(o=>{e.getSystem().getByDom(o).each((e=>{e.hasConfigured(xg)&&xg.set(e,!t)}))}))}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:D.from(n.itemBehaviours).getOr([])},r,t,o.providers)};var xk=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),wk=[ur("others",er(on.value,Wn()))];var Sk=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,o)=>{if(0===ae(t.others).length)throw new Error("Cannot find any known coupled components");return be(e,o)},o=x({});return Va({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk((()=>(be(o.others,n).getOrDie("No information found for coupled component: "+n),D.none()))),getOrCreate:(o,n,r)=>t(n,r).getOrThunk((()=>{const t=be(n.others,r).getOrDie("No information found for coupled component: "+r)(o),s=o.getSystem().build(t);return e[r]=s,s}))})}});const kk=Xl({fields:wk,name:"coupling",apis:xk,state:Sk}),Ck=e=>{let t=D.none(),o=[];const n=e=>{r()?a(e):o.push(e)},r=()=>t.isSome(),s=e=>{H(e,a)},a=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{r()||(t=D.some(e),s(o),o=[])})),{get:n,map:e=>Ck((t=>{n((o=>{t(e(o))}))})),isReady:r}},Ok={nu:Ck,pure:e=>Ck((t=>{t(e)}))},_k=e=>{setTimeout((()=>{throw e}),0)},Tk=e=>{const t=t=>{e().then(t,_k)};return{map:t=>Tk((()=>e().then(t))),bind:t=>Tk((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>Tk((()=>e().then((()=>t.toPromise())))),toLazy:()=>Ok.nu(t),toCached:()=>{let t=null;return Tk((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},Ek=e=>Tk((()=>new Promise(e))),Dk=e=>Tk((()=>Promise.resolve(e))),Ak=x("sink"),Mk=x(Dm({name:Ak(),overrides:x({dom:{tag:"div"},behaviours:ql([ru.config({useFixed:E})]),events:Ks([ra(is()),ra(es()),ra(us())])})})),Bk=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",r=e.getAnchorOverrides();return e.layouts.fold((()=>({type:n,hotspot:o,overrides:r})),(e=>({type:n,hotspot:o,overrides:r,layouts:e})))},Ik=(e,t,o,n,r,s,a)=>{const i=((e,t,o,n,r,s,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=Vk(n,e);return i.map((e=>e.bind((e=>D.from(Df.sketch({...s.menu(),uid:_a(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();ru.position(n,t,{anchor:o}),Mu.decloak(r)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();ru.position(n,o,{anchor:{type:"submenu",item:t}}),Mu.decloak(r)},onRepositionMenu:(e,t,n)=>{const r=l().getOrDie();ru.position(r,t,{anchor:o}),H(n,(e=>{ru.position(r,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})}))},onEscape:()=>(Uh.focus(n),Mu.close(r),D.some(!0))}))))))})(e,t,Bk(e,o),o,n,r,a);return i.map((e=>(e.fold((()=>{Mu.isOpen(n)&&Mu.close(n)}),(e=>{Mu.cloak(n),Mu.open(n,e),s(n)})),n)))},Fk=(e,t,o,n,r,s,a)=>(Mu.close(n),Dk(n)),Rk=(e,t,o,n,r,s)=>{const a=kk.getCoupled(o,"sandbox");return(Mu.isOpen(a)?Fk:Ik)(e,t,o,a,n,r,s)},Nk=(e,t,o)=>{const n=ag.getCurrent(t).getOr(t),r=Jt(e.element);o?Mt(n.element,"min-width",r+"px"):((e,t)=>{Kt.set(e,t)})(n.element,r)},Vk=(e,t)=>e.getSystem().getByUid(t.uid+"-"+Ak()).map((e=>()=>on.value(e))).getOrThunk((()=>t.lazySink.fold((()=>()=>on.error(new Error("No internal sink is specified, nor could an external sink be found"))),(t=>()=>t(e))))),zk=e=>{Mu.getState(e).each((e=>{Df.repositionMenus(e)}))},Lk=(e,t,o)=>{const n=Vi(),r=Vk(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:om(e.sandboxBehaviours,[Ju.config({store:{mode:"memory",initialValue:t}}),Mu.config({onOpen:(r,s)=>{const a=Bk(e,t);n.link(t.element),e.matchWidth&&Nk(a.hotspot,s,e.useMinWidth),e.onOpen(a,r,s),void 0!==o&&void 0!==o.onOpen&&o.onOpen(r,s)},onClose:(e,r)=>{n.unlink(t.element),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},isPartOf:(e,o,n)=>Li(o,n)||Li(t,n),getAttachPoint:()=>r().getOrDie()}),ag.config({find:e=>Mu.getState(e).bind((e=>ag.getCurrent(e)))}),Ql.config({channels:{...Nu({isExtraPart:T}),...zu({doReposition:zk})}})])}},Hk=e=>{const t=kk.getCoupled(e,"sandbox");zk(t)},Pk=()=>[Tr("sandboxClasses",[]),tm("sandboxBehaviours",[ag,Ql,Mu,Ju])],Uk=x([dr("dom"),dr("fetch"),el("onOpen"),tl("onExecute"),Tr("getHotspot",D.some),Tr("getAnchorOverrides",x({})),Jc(),Zu("dropdownBehaviours",[Kh,kk,Th,Uh]),dr("toggleClass"),Tr("eventOrder",{}),yr("lazySink"),Tr("matchWidth",!1),Tr("useMinWidth",!1),yr("role")].concat(Pk())),Wk=x([Em({schema:[Ji(),Tr("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),Mk()]),jk=og({name:"Dropdown",configFields:Uk(),partFields:Wk(),factory:(e,t,o,n)=>{const r=e=>{Mu.getState(e).each((e=>{Df.highlightPrimary(e)}))},s=(t,o,r)=>Rk(e,w,t,n,o,r),a={expand:e=>{Kh.isOn(e)||s(e,b,Tf.HighlightNone).get(b)},open:e=>{Kh.isOn(e)||s(e,b,Tf.HighlightMenuAndItem).get(b)},refetch:t=>kk.getExistingCoupled(t,"sandbox").fold((()=>s(t,b,Tf.HighlightMenuAndItem).map(b)),(o=>Ik(e,w,t,o,n,b,Tf.HighlightMenuAndItem).map(b))),isOpen:Kh.isOn,close:e=>{Kh.isOn(e)&&s(e,b,Tf.HighlightMenuAndItem).get(b)},repositionMenus:e=>{Kh.isOn(e)&&Hk(e)}},i=(e,t)=>(Gs(e),D.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:em(e.dropdownBehaviours,[Kh.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),kk.config({others:{sandbox:t=>Lk(e,t,{onOpen:()=>Kh.on(t),onClose:()=>Kh.off(t)})}}),Th.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(jk.isOpen(e)){const t=kk.getCoupled(e,"sandbox");r(t)}else jk.open(e);return D.some(!0)},onEscape:(e,t)=>jk.isOpen(e)?(jk.close(e),D.some(!0)):D.none()}),Uh.config({})]),events:Qh(D.some((e=>{s(e,r,Tf.HighlightMenuAndItem).get(b)}))),eventOrder:{...e.eventOrder,[Ss()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold((()=>({})),(e=>({role:e}))),..."button"===e.dom.tag?{type:(l="type",be(e.dom,"attributes").bind((e=>be(e,l)))).getOr("button")}:{}}}};var l},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)}}),$k=e=>{const t=Ju.getValue(e),o=Vy(e).map(Ly);jk.refetch(t).get((()=>{const e=kk.getCoupled(t,"sandbox");o.each((t=>Vy(e).each((e=>((e,t)=>{Ju.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))))}))},Gk=e=>Mu.getState(e).bind(Mg.getHighlighted).bind(Mg.getHighlighted),qk=(e,t,o)=>{zy(e).each((e=>{((e,t)=>{_t(t.element,"id").each((t=>kt(e.element,"aria-activedescendant",t)))})(e,o);var n;(si((n=t).element,Py)?D.some(n.element):Fi(n.element,"."+Py)).each((t=>{_t(t,"id").each((t=>kt(e.element,"aria-controls",t)))}))})),kt(o.element,"aria-selected","true")},Yk=(e,t,o)=>{kt(o.element,"aria-selected","false")},Xk=e=>kk.getExistingCoupled(e,"sandbox").bind(Vy).map(Ly).map((e=>e.fetchPattern)).getOr("");var Kk;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(Kk||(Kk={}));const Jk=(e,t,o,n,r)=>{const s=o.shared.providers,a=e=>r?{...e,shortcut:D.none(),icon:e.text.isSome()?D.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,tr("menuitem",tw,i)).fold(Yy,(e=>D.some(hk(a(e),t,s,n))));case"nestedmenuitem":return(e=>tr("nestedmenuitem",ow,e))(e).fold(Yy,(e=>D.some(fk(a(e),t,s,n,r))));case"togglemenuitem":return(e=>tr("togglemenuitem",nw,e))(e).fold(Yy,(e=>D.some(bk(a(e),t,s,n))));case"separator":return(e=>tr("separatormenuitem",Ox,e))(e).fold(Yy,(e=>D.some(pk(e))));case"fancymenuitem":return(e=>tr("fancymenuitem",ew,e))(e).fold(Yy,(e=>vk(e,o)));default:return console.error("Unknown item in general menu",e),D.none()}var i},Zk=(e,t,o,n,r,s,a)=>{const i=1===n,l=!i||qy(e);return we(L(e,(e=>{switch(e.type){case"separator":return(n=e,tr("Autocompleter.Separator",Ox,n)).fold(Yy,(e=>D.some(pk(e))));case"cardmenuitem":return(e=>tr("cardmenuitem",Xx,e))(e).fold(Yy,(e=>D.some(yk({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},r,s,{itemBehaviours:jw(e.meta,s),cardText:{matchText:t,highlightOn:a}}))));default:return(e=>tr("Autocompleter.Item",_x,e))(e).fold(Yy,(e=>D.some(gk(e,t,i,"normal",o,r,s,l))))}var n})))},Qk=(e,t,o,n,r,s)=>{const a=qy(t),i=we(L(t,(e=>{const t=e=>Jk(e,o,n,(e=>r?!ve(e,"text"):a)(e),r);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})(s);return(r?Xy:Ky)(e,a,i,1,l)},eC=e=>Df.singleData(e.value,e),tC=(e,t)=>{const o=ya("autocompleter"),n=Nr(!1),r=Nr(!1),s=_i(Af.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:ql([Vh("dismissAutocompleter",[Qs(Rs(),(()=>d())),Qs(Us(),((t,o)=>{_t(o.event.target,"id").each((t=>kt(Re.fromDom(e.getBody()),"aria-activedescendant",t)))}))])]),lazySink:t.getSink})),a=()=>Af.isOpen(s),i=r.get,l=()=>{if(a()){Af.hide(s),e.dom.remove(o,!1);const t=Re.fromDom(e.getBody());_t(t,"aria-owns").filter((e=>e===o)).each((()=>{Et(t,"aria-owns"),Et(t,"aria-activedescendant")}))}},c=()=>Af.getContent(s).bind((e=>te(e.components(),0))),d=()=>e.execCommand("mceAutocompleterClose"),u=o=>{const r=se(o,(e=>D.from(e.columns))).getOr(1);return Y(o,(o=>{const s=o.items;return Zk(s,o.matchText,((t,r)=>{const s=e.selection.getRng();((e,t)=>iy(Re.fromDom(t.startContainer)).map((t=>{const o=e.createRng();return o.selectNode(t.dom),o})))(e.dom,s).each((s=>{const a={hide:()=>d(),reload:t=>{l(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};n.set(!0),o.onAction(a,s,t,r),n.set(!1)}))}),r,dy.BUBBLE_TO_SANDBOX,t,o.highlightOn)}))},m=(t,o)=>{var n;(n=Re.fromDom(e.getBody()),Fi(n,ay)).each((n=>{const r=se(t,(e=>D.from(e.columns))).getOr(1);Af.showMenuAt(s,{anchor:{type:"node",root:Re.fromDom(e.getBody()),node:D.from(n)}},((e,t,o,n)=>{const r=sk(t,n),s=Oy(n);return{data:eC({...e,movement:r,menuBehaviours:aw("auto"!==t?[]:[ia(((e,t)=>{rw(e,4,s.item).each((({numColumns:t,numRows:o})=>{Th.setGridSize(e,o,t)}))}))])}),menu:{markers:Oy(n),fakeFocus:o===Kk.ContentFocus}}})(Ky("autocompleter-value",!0,o,r,{menuType:"normal"}),r,Kk.ContentFocus,"normal"))})),c().each(Mg.highlightFirst)},g=t=>{const n=u(t);n.length>0?(m(t,n),kt(Re.fromDom(e.getBody()),"aria-owns",o),e.inline||p()):l()},p=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),r=(e=>ga(e,!0))(s.element);Bt(r,{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,r.dom),Fi(r,'[role="menu"]').each((e=>{Lt(e,"position"),Lt(e,"max-height")}))};e.on("AutocompleterStart",(({lookupData:e})=>{r.set(!0),n.set(!1),g(e)})),e.on("AutocompleterUpdate",(({lookupData:e})=>g(e))),e.on("AutocompleterEnd",(()=>{l(),r.set(!1),n.set(!1)}));const h={cancelIfNecessary:d,isMenuOpen:a,isActive:i,isProcessingAction:n.get,getMenu:c};ly(h,e)},oC=["visible","hidden","clip"],nC=e=>Ae(e).length>0&&!R(oC,e),rC=e=>{if(We(e)){const t=Ft(e,"overflow-x"),o=Ft(e,"overflow-y");return nC(t)||nC(o)}return!1},sC=(e,t)=>ny(e)?(e=>{const t=Cd(e,rC),o=0===t.length?ft(e).map(bt).map((e=>Cd(e,rC))).getOr([]):t;return oe(o).map((e=>({element:e,others:o.slice(1)})))})(t):D.none(),aC=e=>{const t=[...L(e.others,Xo),Zo()];return((e,t)=>j(t,((e,t)=>Jo(e,t)),e))(Xo(e.element),t)},iC=(e,t,o)=>Ri(e,t,o).isSome(),lC=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout((()=>{e.apply(null,n),o=null}),t)}}},cC=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?D.none():D.some(t.touches[0])},dC=e=>{const t=Cc(),o=Nr(!1),n=lC((t=>{e.triggerEvent(Os(),t),o.set(!0)}),400),r=Hr([{key:Kr(),value:e=>(cC(e).each((r=>{n.cancel();const s={x:r.clientX,y:r.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(s)})),D.none())},{key:Jr(),value:e=>(n.cancel(),cC(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()}))})),D.none())},{key:Zr(),value:r=>{n.cancel();return t.get().filter((e=>Je(e.target,r.target))).map((t=>o.get()?(r.prevent(),!1):e.triggerEvent(Cs(),r)))}}]);return{fireIfReady:(e,t)=>be(r,t).bind((t=>t(e)))}},uC=(e,t)=>{const o={stopBackspace:!0,...t},n=dC(o),r=L(["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=>_c(e,t,(e=>{n.fireIfReady(e,t).each((t=>{t&&e.kill()}));o.triggerEvent(t,e)&&e.kill()})))),s=Cc(),a=_c(e,"paste",(e=>{n.fireIfReady(e,"paste").each((t=>{t&&e.kill()}));o.triggerEvent("paste",e)&&e.kill(),s.set(setTimeout((()=>{o.triggerEvent(xs(),e)}),0))})),i=_c(e,"keydown",(e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===Bg[0]&&!R(["input","textarea"],Pe(e.target))&&!iC(e.target,'[contenteditable="true"]'))(e)&&e.prevent()})),l=_c(e,"focusin",(e=>{o.triggerEvent("focusin",e)&&e.kill()})),c=Cc(),d=_c(e,"focusout",(e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout((()=>{o.triggerEvent(ys(),e)}),0))}));return{unbind:()=>{H(r,(e=>{e.unbind()})),i.unbind(),l.unbind(),d.unbind(),a.unbind(),s.on(clearTimeout),c.on(clearTimeout)}}},mC=(e,t)=>{const o=be(e,"target").getOr(t);return Nr(o)},gC=Vr([{stopped:[]},{resume:["element"]},{complete:[]}]),pC=(e,t,o,n,r,s)=>{const a=e(t,n),i=((e,t)=>{const o=Nr(!1),n=Nr(!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,r);return a.fold((()=>(s.logEventNoHandlers(t,n),gC.complete())),(e=>{const o=e.descHandler;return Ha(o)(i),i.isStopped()?(s.logEventStopped(t,e.element,o.purpose),gC.stopped()):i.isCut()?(s.logEventCut(t,e.element,o.purpose),gC.complete()):nt(e.element).fold((()=>(s.logNoParent(t,e.element,o.purpose),gC.complete())),(n=>(s.logEventResponse(t,e.element,o.purpose),gC.resume(n))))}))},hC=(e,t,o,n,r,s)=>pC(e,t,o,n,r,s).fold(E,(n=>hC(e,t,o,n,r,s)),T),fC=(e,t,o)=>{const n=(e=>{const t=Nr(!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 H(e,(e=>{const t=e.descHandler;Ha(t)(n)})),n.isStopped()},bC=(e,t,o,n,r)=>{const s=mC(o,n);return hC(e,t,o,n,s,r)},vC=()=>{const e={};return{registerId:(t,o,n)=>{le(n,((n,r)=>{const s=void 0!==e[r]?e[r]:{};s[o]=((e,t)=>{return o=k.apply(void 0,[e.handler].concat(t)),n=e.purpose,{cHandler:o,purpose:n};var o,n})(n,t),e[r]=s}))},unregisterId:t=>{le(e,((e,o)=>{ve(e,t)&&delete e[t]}))},filterByType:t=>be(e,t).map((e=>pe(e,((e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))))).getOr([]),find:(t,o,n)=>be(e,o).bind((e=>jr(n,(t=>((e,t)=>Oa(t).bind((t=>be(e,t))).map((e=>((e,t)=>({element:e,descHandler:t}))(t,e))))(e,t)),t)))}},yC=()=>{const e=vC(),t={},o=e=>{const t=e.element;return Oa(t).getOrThunk((()=>((e,t)=>{const o=ya(Sa+e);return Ca(t,o),o})("uid-",e.element)))},n=o=>{Oa(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:r=>{const s=o(r);ye(t,s)&&((e,o)=>{const r=t[o];if(r!==e)throw new Error('The tagId "'+o+'" is already used by: '+ha(r.element)+"\nCannot use it for: "+ha(e.element)+"\nThe conflicting element is"+(yt(r.element)?" ":" not ")+"already in the DOM");n(e)})(r,s);const a=[r];e.registerId(a,s,r.events),t[s]=r},unregister:n,getById:e=>be(t,e)}},xC=tg({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:Qu(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[Tr("components",[]),Zu("containerBehaviours",[]),Tr("events",{}),Tr("domModification",{}),Tr("eventOrder",{})]}),wC=e=>{const t=t=>nt(e.element).fold(E,(e=>Je(t,e))),o=yC(),n=(e,n)=>o.find(t,e,n),r=uC(e.element,{triggerEvent:(e,t)=>$i(e,t.target,(o=>((e,t,o,n)=>bC(e,t,o,o.target,n))(n,e,t,o)))}),s={debugInfo:x("real"),triggerEvent:(e,t,o)=>{$i(e,t,(r=>bC(n,e,o,t,r)))},triggerFocus:(e,t)=>{Oa(e).fold((()=>{tc(e)}),(o=>{$i(vs(),e,(o=>(((e,t,o,n,r)=>{const s=mC(o,n);pC(e,t,o,n,s,r)})(n,vs(),{originator:t,kill:b,prevent:b,target:e},e,o),!1)))}))},triggerEscape:(e,t)=>{s.triggerEvent("keydown",e.element,t.event)},getByUid:e=>p(e),getByDom:e=>h(e),build:_i,buildOrPatch:Oi,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(s),$e(e.element)||(o.register(e),H(e.components(),a),s.triggerEvent(Es(),e.element,{target:e.element}))},i=e=>{$e(e.element)||(H(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{mu(e,t)},c=e=>{hu(e)},d=e=>{const t=o.filter(ws());H(t,(t=>{const o=t.descHandler;Ha(o)(e)}))},u=e=>{d({universal:!0,data:e})},m=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>{const n=o.filter(e);return fC(n,t)},p=e=>o.getById(e).fold((()=>on.error(new Error('Could not find component with uid: "'+e+'" in system.'))),on.value),h=e=>{const t=Oa(e).getOr("not found");return p(t)};return a(e),{root:e,element:e.element,destroy:()=>{r.unbind(),Lo(e.element)},add:l,remove:c,getByUid:p,getByDom:h,addToWorld:a,removeFromWorld:i,broadcast:u,broadcastOn:m,broadcastEvent:g}},SC=x([Tr("prefix","form-field"),Zu("fieldBehaviours",[ag,Ju])]),kC=x([Dm({schema:[dr("dom")],name:"label"}),Dm({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[dr("text")],name:"aria-descriptor"}),Tm({factory:{sketch:e=>{const t=zr(e,["factory"]);return e.factory.sketch(t)}},schema:[dr("factory")],name:"field"})]),CC=og({name:"FormField",configFields:SC(),partFields:kC(),factory:(e,t,o,n)=>{const r=em(e.fieldBehaviours,[ag.config({find:t=>Pm(t,e,"field")}),Ju.config({store:{mode:"manual",getValue:e=>ag.getCurrent(e).bind(Ju.getValue),setValue:(e,t)=>{ag.getCurrent(e).each((e=>{Ju.setValue(e,t)}))}}})]),s=Ks([ia(((t,o)=>{const n=Wm(t,e,["label","field","aria-descriptor"]);n.field().each((t=>{const o=ya(e.prefix);n.label().each((e=>{kt(e.element,"for",o),kt(t.element,"id",o)})),n["aria-descriptor"]().each((o=>{const n=ya(e.prefix);kt(o.element,"id",n),kt(t.element,"aria-describedby",n)}))}))}))]),a={getField:t=>Pm(t,e,"field"),getLabel:t=>Pm(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:r,events:s,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}});var OC=Object.freeze({__proto__:null,exhibit:(e,t)=>La({attributes:Hr([{key:t.tabAttr,value:"true"}])})}),_C=[Tr("tabAttr","data-alloy-tabstop")];const TC=Xl({fields:_C,name:"tabstopping",active:OC});var EC=tinymce.util.Tools.resolve("tinymce.html.Entities");const DC=(e,t,o,n)=>{const r=AC(e,t,o,n);return CC.sketch(r)},AC=(e,t,o,n)=>({dom:MC(o),components:e.toArray().concat([t]),fieldBehaviours:ql(n)}),MC=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),BC=(e,t)=>CC.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Si(t.translate(e))]}),IC=ya("form-component-change"),FC=ya("form-close"),RC=ya("form-cancel"),NC=ya("form-action"),VC=ya("form-submit"),zC=ya("form-block"),LC=ya("form-unblock"),HC=ya("form-tabchange"),PC=ya("form-resize"),UC=(e,t,o)=>{const n=e.label.map((e=>BC(e,t))),r=t.icons(),s=e=>(t,o)=>{Ri(o.event.target,"[data-collection-item-value]").each((n=>{e(t,o,n,Ot(n,"data-collection-item-value"))}))},a=(o,n)=>{const s=L(n,(o=>{const n=Lb.translate(o.text),s=1===e.columns?`<div class="tox-collection__item-label">${n}</div>`:"",a=`<div class="tox-collection__item-icon">${(e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e})(o.icon)}</div>`,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,(e=>i[e]));return`<div class="tox-collection__item${t.isDisabled()?" tox-collection__item--state-disabled":""}" tabindex="-1" data-collection-item-value="${EC.encodeAllRaw(o.value)}" title="${l}" aria-label="${l}">${a}${s}</div>`})),a="auto"!==e.columns&&e.columns>1?z(s,e.columns):[s],i=L(a,(e=>`<div class="tox-collection__group">${e.join("")}</div>`));ma(o.element,i.join(""))},i=s(((o,n,r,s)=>{n.stop(),t.isDisabled()||$s(o,NC,{name:e.name,value:s})})),l=[Qs(rs(),s(((e,t,o)=>{tc(o)}))),Qs(us(),i),Qs(Cs(),i),Qs(ss(),s(((e,t,o)=>{Fi(e.element,"."+yy).each((e=>{ni(e,yy)})),ti(o,yy)}))),Qs(as(),s((e=>{Fi(e.element,"."+yy).each((e=>{ni(e,yy)}))}))),da(s(((t,o,n,r)=>{$s(t,NC,{name:e.name,value:r})})))],c=(e,t)=>L(Od(e.element,".tox-collection__item"),t),d=CC.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:w},behaviours:ql([xg.config({disabled:t.isDisabled,onDisabled:e=>{c(e,(e=>{ti(e,"tox-collection__item--state-disabled"),kt(e,"aria-disabled",!0)}))},onEnabled:e=>{c(e,(e=>{ni(e,"tox-collection__item--state-disabled"),Et(e,"aria-disabled")}))}}),ww(),Nh.config({}),Ju.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(t,o)=>{a(t,o),"auto"===e.columns&&rw(t,5,"tox-collection__item").each((({numRows:e,numColumns:o})=>{Th.setGridSize(t,e,o)})),js(t,PC)}}),TC.config({}),Th.config((u=e.columns,m="normal",1===u?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===u?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===m?".tox-swatches__row":".tox-collection__group",cell:"color"===m?`.${gy}`:`.${my}`}})),Vh("collection-events",l)]),eventOrder:{[Ss()]:["disabling","alloy.base.behaviour","collection-events"]}});var u,m;return DC(n,d,["tox-form__group--collection"],[])},WC=["input","textarea"],jC=e=>{const t=Pe(e);return R(WC,t)},$C=(e,t)=>{const o=t.getRoot(e).getOr(e.element);ni(o,t.invalidClass),t.notify.each((t=>{jC(e.element)&&kt(e.element,"aria-invalid",!1),t.getContainer(e).each((e=>{ma(e,t.validHtml)})),t.onValid(e)}))},GC=(e,t,o,n)=>{const r=t.getRoot(e).getOr(e.element);ti(r,t.invalidClass),t.notify.each((t=>{jC(e.element)&&kt(e.element,"aria-invalid",!0),t.getContainer(e).each((e=>{ma(e,n)})),t.onInvalid(e,n)}))},qC=(e,t,o)=>t.validator.fold((()=>Dk(on.value(!0))),(t=>t.validate(e))),YC=(e,t,o)=>(t.notify.each((t=>{t.onValidate(e)})),qC(e,t).map((o=>e.getSystem().isConnected()?o.fold((o=>(GC(e,t,0,o),on.error(o))),(o=>($C(e,t),on.value(o)))):on.error("No longer in system"))));var XC=Object.freeze({__proto__:null,markValid:$C,markInvalid:GC,query:qC,run:YC,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return si(o,t.invalidClass)}});var KC=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map((t=>Ks([Qs(t.onEvent,(t=>{YC(t,e).get(w)}))].concat(t.validateOnLoad?[ia((t=>{YC(t,e).get(b)}))]:[])))).getOr({})}),JC=[dr("invalidClass"),Tr("getRoot",D.none),_r("notify",[Tr("aria","alert"),Tr("getContainer",D.none),Tr("validHtml",""),el("onValid"),el("onInvalid"),el("onValidate")]),_r("validator",[dr("validate"),Tr("onEvent","input"),Tr("validateOnLoad",!0)])];const ZC=Xl({fields:JC,name:"invalidating",active:KC,apis:XC,extra:{validation:e=>t=>{const o=Ju.getValue(t);return Dk(e(o))}}});const QC=Xl({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Ks([Js(hs(),E)]),exhibit:()=>La({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),eO=ya("color-input-change"),tO=ya("color-swatch-change"),oO=ya("color-picker-cancel"),nO=(e,t,o,n)=>{const r=CC.parts.field({factory:Iy,inputClasses:["tox-textfield"],data:n,onSetValue:e=>ZC.run(e).get(b),inputBehaviours:ql([xg.config({disabled:t.providers.isDisabled}),ww(),TC.config({}),ZC.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>rt(e.element),notify:{onValid:e=>{const t=Ju.getValue(e);$s(e,eO,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=Ju.getValue(e);if(0===t.length)return Dk(on.value(!0));{const e=Re.fromTag("span");Mt(e,"background-color",t);const o=Nt(e,"background-color").fold((()=>on.error("blah")),(e=>on.value(t)));return Dk(o)}}}})]),selectOnFocus:!1}),s=e.label.map((e=>BC(e,t.providers))),a=(e,t)=>{$s(e,tO,{value:t})},i=Ff(((e,t)=>jk.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:ql([kw(t.providers.isDisabled),ww(),QC.config({}),TC.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>Ek((t=>e.fetch(t))).map((n=>D.from(eC(wn(nk(ya("menu-value"),n,(t=>{e.onItemAction(o,t)}),e.columns,e.presets,dy.CLOSE_ON_EXECUTE,T,t.providers),{movement:sk(e.columns,e.presets)}))))),parts:{menu:Ey(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[El,Tl,Bl],onLtr:()=>[Tl,El,Bl]},components:[],fetch:XS(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((()=>js(t,oO)),(o=>{a(t,o),TS(e.storageKey,o)}))}),"#ffffff"):a(t,"remove"===n?"":n)}))}},t));return CC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:s.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[r,i.asSpec()]}]),fieldBehaviours:ql([Vh("form-field-events",[Qs(eO,((t,o)=>{i.getOpt(t).each((e=>{Mt(e.element,"background-color",o.event.color)})),$s(t,IC,{name:e.name})})),Qs(tO,((e,t)=>{CC.getField(e).each((o=>{Ju.setValue(o,t.event.value),ag.getCurrent(e).each(Uh.focus)}))})),Qs(oO,((e,t)=>{CC.getField(e).each((t=>{ag.getCurrent(e).each(Uh.focus)}))}))])])})},rO=Dm({schema:[dr("dom")],name:"label"}),sO=e=>Dm({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold((()=>({})),(e=>({events:Ks([ea(Kr(),((t,o,n)=>e(t,n)),[t]),ea(es(),((t,o,n)=>e(t,n)),[t]),ea(ts(),((t,o,n)=>{n.mouseIsDown.get()&&e(t,n)}),[t])])})))}),aO=sO("top-left"),iO=sO("top"),lO=sO("top-right"),cO=sO("right"),dO=sO("bottom-right"),uO=sO("bottom"),mO=sO("bottom-left"),gO=sO("left"),pO=Tm({name:"thumb",defaults:x({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Ks([oa(Kr(),e,"spectrum"),oa(Jr(),e,"spectrum"),oa(Zr(),e,"spectrum"),oa(es(),e,"spectrum"),oa(ts(),e,"spectrum"),oa(ns(),e,"spectrum")])})}),hO=e=>qg(e.event),fO=Tm({schema:[lr("mouseIsDown",(()=>Nr(!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:ql([Th.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,hO(n)),onRight:(o,n)=>t.onRight(o,e,hO(n)),onUp:(o,n)=>t.onUp(o,e,hO(n)),onDown:(o,n)=>t.onDown(o,e,hO(n))}),TC.config({}),Uh.config({})]),events:Ks([Qs(Kr(),o),Qs(Jr(),o),Qs(es(),o),Qs(ts(),((t,n)=>{e.mouseIsDown.get()&&o(t,n)}))])}}});var bO=[rO,gO,cO,iO,uO,aO,lO,mO,dO,pO,fO];const vO=x("slider.change.value"),yO=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?D.some(e.touches[0]).map((e=>Gt(e.clientX,e.clientY))):D.none()}{const e=t;return void 0!==e.clientX?D.some(e).map((e=>Gt(e.clientX,e.clientY))):D.none()}},xO=e=>e.model.minX,wO=e=>e.model.minY,SO=e=>e.model.minX-1,kO=e=>e.model.minY-1,CO=e=>e.model.maxX,OO=e=>e.model.maxY,_O=e=>e.model.maxX+1,TO=e=>e.model.maxY+1,EO=(e,t,o)=>t(e)-o(e),DO=e=>EO(e,CO,xO),AO=e=>EO(e,OO,wO),MO=e=>DO(e)/2,BO=e=>AO(e)/2,IO=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,FO=e=>e.snapToGrid,RO=e=>e.snapStart,NO=e=>e.rounded,VO=(e,t)=>void 0!==e[t+"-edge"],zO=e=>VO(e,"left"),LO=e=>VO(e,"right"),HO=e=>VO(e,"top"),PO=e=>VO(e,"bottom"),UO=e=>e.model.value.get(),WO=(e,t)=>({x:e,y:t}),jO=(e,t)=>{$s(e,vO(),{value:t})},$O=(e,t,o,n)=>e<t?e:e>o?o:e===t?t-1:Math.max(t,e-n),GO=(e,t,o,n)=>e>o?e:e<t?t:e===o?o+1:Math.min(o,e+n),qO=(e,t,o)=>Math.max(t,Math.min(o,e)),YO=e=>{const{min:t,max:o,range:n,value:r,step:s,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(r<u)return p;if(r>m)return h;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(r,u,m),c=qO(e/g*n+t,p,h);return a&&c>=t&&c<=o?((e,t,o,n,r)=>r.fold((()=>{const r=e-t,s=Math.round(r/n)*n;return qO(t+s,t-1,o+1)}),(t=>{const r=(e-t)%n,s=Math.round(r/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+s)*n;return Math.max(t,l)})))(c,t,o,s,i):l?Math.round(c):c}},XO=e=>{const{min:t,max:o,range:n,value:r,hasMinEdge:s,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return r<t?s?0:c:r>o?a?i:d:(r-t)/n*l},KO="top",JO="right",ZO="bottom",QO="left",e_=e=>e.element.dom.getBoundingClientRect(),t_=(e,t)=>e[t],o_=e=>{const t=e_(e);return t_(t,QO)},n_=e=>{const t=e_(e);return t_(t,JO)},r_=e=>{const t=e_(e);return t_(t,KO)},s_=e=>{const t=e_(e);return t_(t,ZO)},a_=e=>{const t=e_(e);return t_(t,"width")},i_=e=>{const t=e_(e);return t_(t,"height")},l_=(e,t,o)=>(e+t)/2-o,c_=(e,t)=>{const o=e_(e),n=e_(t),r=t_(o,QO),s=t_(o,JO),a=t_(n,QO);return l_(r,s,a)},d_=(e,t)=>{const o=e_(e),n=e_(t),r=t_(o,KO),s=t_(o,ZO),a=t_(n,KO);return l_(r,s,a)},u_=(e,t)=>{$s(e,vO(),{value:t})},m_=(e,t,o)=>{const n={min:xO(t),max:CO(t),range:DO(t),value:o,step:IO(t),snap:FO(t),snapStart:RO(t),rounded:NO(t),hasMinEdge:zO(t),hasMaxEdge:LO(t),minBound:o_(e),maxBound:n_(e),screenRange:a_(e)};return YO(n)},g_=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?GO:$O)(UO(o),xO(o),CO(o),IO(o,n));return u_(t,r),D.some(r)})(e,t,o,n).map(E),p_=(e,t,o,n,r,s)=>{const a=((e,t,o,n,r)=>{const s=a_(e),a=n.bind((t=>D.some(c_(t,e)))).getOr(0),i=r.bind((t=>D.some(c_(t,e)))).getOr(s),l={min:xO(t),max:CO(t),range:DO(t),value:o,hasMinEdge:zO(t),hasMaxEdge:LO(t),minBound:o_(e),minOffset:0,maxBound:n_(e),maxOffset:s,centerMinEdge:a,centerMaxEdge:i};return XO(l)})(t,s,o,n,r);return o_(t)-o_(e)+a},h_=g_(-1),f_=g_(1),b_=D.none,v_=D.none,y_={"top-left":D.none(),top:D.none(),"top-right":D.none(),right:D.some(((e,t)=>{jO(e,_O(t))})),"bottom-right":D.none(),bottom:D.none(),"bottom-left":D.none(),left:D.some(((e,t)=>{jO(e,SO(t))}))};var x_=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=m_(e,t,o);return u_(e,n),n},setToMin:(e,t)=>{const o=xO(t);u_(e,o)},setToMax:(e,t)=>{const o=CO(t);u_(e,o)},findValueOfOffset:m_,getValueFromEvent:e=>yO(e).map((e=>e.left)),findPositionOfValue:p_,setPositionFromValue:(e,t,o,n)=>{const r=UO(o),s=p_(e,n.getSpectrum(e),r,n.getLeftEdge(e),n.getRightEdge(e),o),a=Jt(t.element)/2;Mt(t.element,"left",s-a+"px")},onLeft:h_,onRight:f_,onUp:b_,onDown:v_,edgeActions:y_});const w_=(e,t)=>{$s(e,vO(),{value:t})},S_=(e,t,o)=>{const n={min:wO(t),max:OO(t),range:AO(t),value:o,step:IO(t),snap:FO(t),snapStart:RO(t),rounded:NO(t),hasMinEdge:HO(t),hasMaxEdge:PO(t),minBound:r_(e),maxBound:s_(e),screenRange:i_(e)};return YO(n)},k_=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?GO:$O)(UO(o),wO(o),OO(o),IO(o,n));return w_(t,r),D.some(r)})(e,t,o,n).map(E),C_=(e,t,o,n,r,s)=>{const a=((e,t,o,n,r)=>{const s=i_(e),a=n.bind((t=>D.some(d_(t,e)))).getOr(0),i=r.bind((t=>D.some(d_(t,e)))).getOr(s),l={min:wO(t),max:OO(t),range:AO(t),value:o,hasMinEdge:HO(t),hasMaxEdge:PO(t),minBound:r_(e),minOffset:0,maxBound:s_(e),maxOffset:s,centerMinEdge:a,centerMaxEdge:i};return XO(l)})(t,s,o,n,r);return r_(t)-r_(e)+a},O_=D.none,__=D.none,T_=k_(-1),E_=k_(1),D_={"top-left":D.none(),top:D.some(((e,t)=>{jO(e,kO(t))})),"top-right":D.none(),right:D.none(),"bottom-right":D.none(),bottom:D.some(((e,t)=>{jO(e,TO(t))})),"bottom-left":D.none(),left:D.none()};var A_=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=S_(e,t,o);return w_(e,n),n},setToMin:(e,t)=>{const o=wO(t);w_(e,o)},setToMax:(e,t)=>{const o=OO(t);w_(e,o)},findValueOfOffset:S_,getValueFromEvent:e=>yO(e).map((e=>e.top)),findPositionOfValue:C_,setPositionFromValue:(e,t,o,n)=>{const r=UO(o),s=C_(e,n.getSpectrum(e),r,n.getTopEdge(e),n.getBottomEdge(e),o),a=Wt(t.element)/2;Mt(t.element,"top",s-a+"px")},onLeft:O_,onRight:__,onUp:T_,onDown:E_,edgeActions:D_});const M_=(e,t)=>{$s(e,vO(),{value:t})},B_=(e,t)=>({x:e,y:t}),I_=(e,t)=>(o,n,r)=>((e,t,o,n,r)=>{const s=e>0?GO:$O,a=t?UO(n).x:s(UO(n).x,xO(n),CO(n),IO(n,r)),i=t?s(UO(n).y,wO(n),OO(n),IO(n,r)):UO(n).y;return M_(o,B_(a,i)),D.some(a)})(e,t,o,n,r).map(E),F_=I_(-1,!1),R_=I_(1,!1),N_=I_(-1,!0),V_=I_(1,!0),z_={"top-left":D.some(((e,t)=>{jO(e,WO(SO(t),kO(t)))})),top:D.some(((e,t)=>{jO(e,WO(MO(t),kO(t)))})),"top-right":D.some(((e,t)=>{jO(e,WO(_O(t),kO(t)))})),right:D.some(((e,t)=>{jO(e,WO(_O(t),BO(t)))})),"bottom-right":D.some(((e,t)=>{jO(e,WO(_O(t),TO(t)))})),bottom:D.some(((e,t)=>{jO(e,WO(MO(t),TO(t)))})),"bottom-left":D.some(((e,t)=>{jO(e,WO(SO(t),TO(t)))})),left:D.some(((e,t)=>{jO(e,WO(SO(t),BO(t)))}))};var L_=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=m_(e,t,o.left),r=S_(e,t,o.top),s=B_(n,r);return M_(e,s),s},setToMin:(e,t)=>{const o=xO(t),n=wO(t);M_(e,B_(o,n))},setToMax:(e,t)=>{const o=CO(t),n=OO(t);M_(e,B_(o,n))},getValueFromEvent:e=>yO(e),setPositionFromValue:(e,t,o,n)=>{const r=UO(o),s=p_(e,n.getSpectrum(e),r.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=C_(e,n.getSpectrum(e),r.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Jt(t.element)/2,l=Wt(t.element)/2;Mt(t.element,"left",s-i+"px"),Mt(t.element,"top",a-l+"px")},onLeft:F_,onRight:R_,onUp:N_,onDown:V_,edgeActions:z_});const H_=og({name:"Slider",configFields:[Tr("stepSize",1),Tr("speedMultiplier",10),Tr("onChange",b),Tr("onChoose",b),Tr("onInit",b),Tr("onDragStart",b),Tr("onDragEnd",b),Tr("snapToGrid",!1),Tr("rounded",!0),yr("snapStart"),ur("model",sr("mode",{x:[Tr("minX",0),Tr("maxX",100),lr("value",(e=>Nr(e.mode.minX))),dr("getInitialValue"),rl("manager",x_)],y:[Tr("minY",0),Tr("maxY",100),lr("value",(e=>Nr(e.mode.minY))),dr("getInitialValue"),rl("manager",A_)],xy:[Tr("minX",0),Tr("maxX",100),Tr("minY",0),Tr("maxY",100),lr("value",(e=>Nr({x:e.mode.minX,y:e.mode.minY}))),dr("getInitialValue"),rl("manager",L_)]})),Zu("sliderBehaviours",[Th,Ju]),lr("mouseIsDown",(()=>Nr(!1)))],partFields:bO,factory:(e,t,o,n)=>{const r=t=>Um(t,e,"thumb"),s=t=>Um(t,e,"spectrum"),a=t=>Pm(t,e,"left-edge"),i=t=>Pm(t,e,"right-edge"),l=t=>Pm(t,e,"top-edge"),c=t=>Pm(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:s})},g=(e,t)=>{d.value.set(t);const o=r(e);m(e,o)},p=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&Pm(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,r(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,r(t)),p(t)},b=t=>{Pm(t,e,"spectrum").map(Th.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:em(e.sliderBehaviours,[Th.config({mode:"special",focusIn:b}),Ju.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),Ql.config({channels:{[Fu()]:{onReceive:p}}})]),events:Ks([Qs(vO(),((t,o)=>{((t,o)=>{g(t,o);const n=r(t);e.onChange(t,n,o),D.some(!0)})(t,o.event.value)})),ia(((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=r(t);m(t,a);const i=s(t);e.onInit(t,a,i,d.value.get())})),Qs(Kr(),h),Qs(Zr(),f),Qs(es(),((e,t)=>{b(e),h(e,t)})),Qs(ns(),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)}}}),P_=ya("rgb-hex-update"),U_=ya("slider-update"),W_=ya("palette-update"),j_="form",$_=[Zu("formBehaviours",[Ju])],G_=e=>"<alloy.field."+e+">",q_=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:em(e.formBehaviours,[Ju.config({store:{mode:"manual",getValue:t=>{const o=jm(t,e);return ce(o,((e,t)=>e().bind((e=>{const o=ag.getCurrent(e);return n=o,r=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+ha(e.element)),n.fold((()=>on.error(r)),on.value);var n,r})).map(Ju.getValue)))},setValue:(t,o)=>{le(o,((o,n)=>{Pm(t,e,n).each((e=>{ag.getCurrent(e).each((e=>{Ju.setValue(e,o)}))}))}))}}})]),apis:{getField:(t,o)=>Pm(t,e,o).bind(ag.getCurrent)}}),Y_={getField:Ra(((e,t,o)=>e.getField(t,o))),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),Nm(j_,G_(t),o)),record:x(e)}})(),o=e(t),n=t.record(),r=L(n,(e=>Tm({name:e,pname:G_(e)})));return Jm(j_,$_,r,q_,o)}},X_=ya("valid-input"),K_=ya("invalid-input"),J_=ya("validating-input"),Z_="colorcustom.rgb.",Q_=(e,t,o,n)=>{const r=(o,n)=>ZC.config({invalidClass:t("invalid"),notify:{onValidate:e=>{$s(e,J_,{type:o})},onValid:e=>{$s(e,X_,{type:o,value:Ju.getValue(e)})},onInvalid:e=>{$s(e,K_,{type:o,value:Ju.getValue(e)})}},validator:{validate:t=>{const o=Ju.getValue(t),r=n(o)?on.value(!0):on.error(e("aria.input.invalid"));return Dk(r)},validateOnLoad:!1}}),s=(o,n,s,a,i)=>{const l=e(Z_+"range"),c=CC.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[Si(s)]}),d=CC.parts.field({data:i,factory:Iy,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:ql([r(n,o),TC.config({})]),onSetValue:e=>{if(ZC.isInvalid(e)){ZC.run(e).get(b)}}}),u=[c,d],m="hex"!==n?[CC.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,r=t.blue;Ju.setValue(e,{red:o,green:n,blue:r})},i=Ff({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=(e,t)=>{i.getOpt(e).each((e=>{Mt(e.element,"background-color","#"+t.value)}))},c=tg({factory:()=>{const r={red:Nr(D.some(255)),green:Nr(D.some(255)),blue:Nr(D.some(255)),hex:Nr(D.some("ffffff"))},c=e=>r[e].get(),d=(e,t)=>{r[e].set(t)},u=e=>{const t=e.red,o=e.green,n=e.blue;d("red",D.some(t)),d("green",D.some(o)),d("blue",D.some(n))},m=(e,t)=>{const o=t.event;"hex"!==o.type?d(o.type,D.none()):n(e)},g=(e,t,o)=>{const n=parseInt(o,10);d(t,D.some(n)),c("red").bind((e=>c("green").bind((t=>c("blue").map((o=>iS(e,t,o,1))))))).each((t=>{const o=((e,t)=>{const o=tS(t);return Y_.getField(e,"hex").each((t=>{Uh.isFocused(t)||Ju.setValue(e,{hex:o.value})})),o})(e,t);$s(e,P_,{hex:o}),l(e,o)}))},p=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=Yw(t);d("hex",D.some(n.value));const r=dS(n);a(e,r),u(r),$s(e,P_,{hex:n}),l(e,n)})(e,n.value):g(e,n.type,n.value)},h=t=>({label:e(Z_+t+".label"),description:e(Z_+t+".description")}),f=h("red"),b=h("green"),v=h("blue"),y=h("hex");return wn(Y_.sketch((o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",CC.sketch(s(lS,"red",f.label,f.description,255))),o.field("green",CC.sketch(s(lS,"green",b.label,b.description,255))),o.field("blue",CC.sketch(s(lS,"blue",v.label,v.description,255))),o.field("hex",CC.sketch(s(Jw,"hex",y.label,y.description,"ffffff"))),i.asSpec()],formBehaviours:ql([ZC.config({invalidClass:t("form-invalid")}),Vh("rgb-form-events",[Qs(X_,p),Qs(K_,m),Qs(J_,m)])])}))),{apis:{updateHex:(e,t)=>{Ju.setValue(e,{hex:t.value}),((e,t)=>{const o=dS(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},eT=(e,t)=>{const o=H_.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=H_.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:`<div class=${t("sv-palette-inner-thumb")} role="presentation"></div>`}}),r=(e,t)=>{const{width:o,height:n}=e,r=e.getContext("2d");if(null===r)return;r.fillStyle=t,r.fillRect(0,0,o,n);const s=r.createLinearGradient(0,0,o,0);s.addColorStop(0,"rgba(255,255,255,1)"),s.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=s,r.fillRect(0,0,o,n);const a=r.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=a,r.fillRect(0,0,o,n)},s=tg({factory:s=>{const a=x({x:0,y:0}),i=ql([ag.config({find:D.some}),Uh.config({})]);return H_.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)||kt(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),$s(t,W_,{value:n})},onInit:(e,t,o,n)=>{r(o.element.dom,gS(pS))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=ES(t,100,100),s=cS(n);r(o,gS(s))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=DS(dS(o));H_.setValue(t,{x:n.saturation,y:100-n.value}),kt(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}});return s},tT=(e,t)=>{const o=tg({name:"ColourPicker",configFields:[dr("dom"),Tr("onValidHex",b),Tr("onInvalidHex",b)],factory:o=>{const n=Q_(e,t,o.onValidHex,o.onInvalidHex),r=eT(e,t),s={paletteRgba:Nr(pS),paletteHue:Nr(0)},a=Ff(((e,t)=>{const o=H_.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=H_.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return H_.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:ql([Uh.config({})]),onChange:(e,t,o)=>{kt(e.element,"aria-valuenow",Math.floor(360-3.6*o)),$s(e,U_,{value:o})}})})(0,t)),i=Ff(r.sketch({})),l=Ff(n.sketch({})),c=(e,t,o)=>{i.getOpt(e).each((e=>{r.setHue(e,o)}))},d=(e,t)=>{l.getOpt(e).each((e=>{n.updateHex(e,t)}))},u=(e,t,o)=>{a.getOpt(e).each((e=>{H_.setValue(e,(e=>100-e/360*100)(o))}))},m=(e,t)=>{i.getOpt(e).each((e=>{r.setThumb(e,t)}))},g=(e,t,o,n)=>{((e,t)=>{const o=dS(e);s.paletteRgba.set(o),s.paletteHue.set(t)})(t,o),H(n,(n=>{n(e,t,o)}))};return{uid:o.uid,dom:o.dom,components:[i.asSpec(),a.asSpec(),l.asSpec()],behaviours:ql([Vh("colour-picker-events",[Qs(P_,(()=>{const e=[c,u,m];return(t,o)=>{const n=o.event.hex,r=(e=>DS(dS(e)))(n);g(t,n,r.hue,e)}})()),Qs(W_,(()=>{const e=[d];return(t,o)=>{const n=o.event.value,r=s.paletteHue.get(),a=ES(r,n.x,100-n.y),i=AS(a);g(t,i,r,e)}})()),Qs(U_,(()=>{const e=[c,d];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),r=s.paletteRgba.get(),a=DS(r),i=ES(n,a.saturation,a.value),l=AS(i);g(t,l,n,e)}})())]),ag.config({find:e=>l.getOpt(e)}),Th.config({mode:"acyclic"})])}}});return o},oT=()=>ag.config({find:D.some}),nT=e=>ag.config({find:e.getOpt}),rT=e=>ag.config({find:t=>it(t.element,e).bind((e=>t.getSystem().getByDom(e).toOptional()))}),sT=zn([Tr("preprocess",w),Tr("postprocess",w)]),aT=(e,t)=>{const o=nr("RepresentingConfigs.memento processors",sT,t);return Ju.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),r=Ju.getValue(n);return o.postprocess(r)},setValue:(t,n)=>{const r=o.preprocess(n),s=e.get(t);Ju.setValue(s,r)}}})},iT=(e,t,o)=>Ju.config({store:{mode:"manual",...e.map((e=>({initialValue:e}))).getOr({}),getValue:t,setValue:o}}),lT=(e,t,o)=>iT(e,(e=>t(e.element)),((e,t)=>o(e.element,t))),cT=e=>Ju.config({store:{mode:"memory",initialValue:e}}),dT={"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"},uT=(e,t,o)=>{const n=e=>"tox-"+e,r=tT((e=>t=>s(t)?e.translate(dT[t]):e.translate(t))(t),n),a=Ff(r.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{$s(e,NC,{name:"hex-valid",value:!0})},onInvalidHex:e=>{$s(e,NC,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:ql([iT(o,(e=>{const t=a.get(e);return ag.getCurrent(t).bind((e=>Ju.getValue(e).hex)).map((e=>"#"+_e(e,"#"))).getOr("")}),((e,t)=>{const o=D.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind((e=>te(e,1))),n=a.get(e);ag.getCurrent(n).fold((()=>{console.log("Can not find form")}),(e=>{Ju.setValue(e,{hex:o.getOr("")}),Y_.getField(e,"hex").each((e=>{js(e,cs())}))}))})),oT()])}};var mT=tinymce.util.Tools.resolve("tinymce.Resource");var gT=tinymce.util.Tools.resolve("tinymce.util.Tools");const pT=(e,t,o)=>{const n=(e,t)=>{t.stop()},r=e=>(t,o)=>{H(e,(e=>{e(t,o)}))},s=(e,t)=>{var o;if(!xg.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&&(Ju.setValue(o,((e,t)=>{const o=gT.explode(t.getOption("images_file_types"));return U(re(e),(e=>N(o,(t=>De(e.name.toLowerCase(),`.${t.toLowerCase()}`)))))})(n,t)),$s(o,IC,{name:e.name}))},l=Ff({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:ql([Vh("input-file-events",[ra(us()),ra(Cs())])])}),c=e.label.map((e=>BC(e,t))),d=CC.parts.field({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:ql([cT(o.getOr([])),oT(),xg.config({}),Kh.config({toggleClass:"dragenter",toggleOnExecute:!1}),Vh("dropzone-events",[Qs("dragenter",r([n,Kh.toggle])),Qs("dragleave",r([n,Kh.toggle])),Qs("dragover",n),Qs("drop",r([n,s])),Qs(ds(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[Si(t.translate("Drop an image here"))]},Bf.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[Si(t.translate("Browse for an image")),l.asSpec()],action:e=>{l.get(e).element.dom.click()},buttonBehaviours:ql([TC.config({}),kw(t.isDisabled),ww()])})]}]})}});return DC(c,d,["tox-form__group--stretched"],[])},hT=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout((()=>{o=null,e.apply(null,r)}),t)}}},fT=ya("alloy-fake-before-tabstop"),bT=ya("alloy-fake-after-tabstop"),vT=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:ql([Uh.config({ignore:!0}),TC.config({})])}),yT=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[vT([fT]),t,vT([bT])],behaviours:ql([rT(1)])}),xT=(e,t)=>{$s(e,is(),{raw:{which:9,shiftKey:t}})},wT=(e,t)=>{const o=t.element;si(o,fT)?xT(e,!0):si(o,bT)&&xT(e,!1)},ST=e=>iC(e,["."+fT,"."+bT].join(","),T),kT=ya("update-dialog"),CT=ya("update-title"),OT=ya("update-body"),_T=ya("update-footer"),TT=ya("body-send-message"),ET=ya("dialog-focus-shifted"),DT=Do().browser,AT=DT.isSafari(),MT=DT.isFirefox(),BT=AT||MT,IT=DT.isChromium(),FT=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,RT=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),NT=(e,t,o)=>{const n=e.dom;D.from(n.contentDocument).fold(o,(e=>{let o=0;const r=((e,t)=>{const o=e.body;return D.from(!/^<!DOCTYPE (html|HTML)/.test(t)&&(!IT&&!AT||g(o)&&(0!==o.scrollTop||Math.abs(o.scrollHeight-o.clientHeight)>1))?o:e.documentElement)})(e,t).map((e=>(o=e.scrollTop,e))).forall(FT),s=()=>{const e=n.contentWindow;g(e)&&(r?RT(e,"bottom"):!r&&BT&&0!==o&&RT(e,o))};AT&&n.addEventListener("load",s,{once:!0}),e.open(),e.write(t),e.close(),AT||s()}))},VT=Ce(BT,AT?500:200).map((e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...r)=>{n=r,c(o)&&(o=setTimeout((()=>{const t=n;o=null,n=null,e.apply(null,t)}),t))}}})(NT,e))),zT=(e,t,o)=>{const n="tox-dialog__iframe",r=e.transparent?[]:[`${n}--opaque`],s=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=Nr(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,r=()=>kt(o,"srcdoc",n);t?VT.fold(x(NT),(e=>e.throttle))(o,n,r):r()}o.set(n)}}})(o,e.streamContent),l=e.label.map((e=>BC(e,t))),c=CC.parts.field({factory:{sketch:e=>yT(D.from(s),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...r]},behaviours:ql([TC.config({}),Uh.config({}),iT(o,i.getValue,i.setValue),Ql.config({channels:{[ET]:{onReceive:(e,t)=>{t.newFocus.each((t=>{rt(e.element).each((o=>{(Je(e.element,t)?ti:ni)(o,"tox-navobj-bordered-focus")}))}))}}}})])})}});return DC(l,c,["tox-form__group--stretched"],[])},LT=(e,t)=>{const o=Nr(t.getOr({url:""})),n=Ff({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map((e=>({src:e.url}))).getOr({})}}),r=Ff({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),s={};e.height.each((e=>s.height=e));const a=t.map((e=>({url:e.url,zoom:D.from(e.zoom),cachedWidth:D.from(e.cachedWidth),cachedHeight:D.from(e.cachedHeight)})));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:s,attributes:{role:"presentation"}},components:[r.asSpec()],behaviours:ql([oT(),iT(a,(()=>o.get()),((e,t)=>{const s={url:t.url};t.zoom.each((e=>s.zoom=e)),t.cachedWidth.each((e=>s.cachedWidth=e)),t.cachedHeight.each((e=>s.cachedHeight=e)),o.set(s);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=s;if(!u(t)&&!u(o)){if(u(n)){const n=((e,t,o)=>{const n=Jt(e),r=Wt(e);return Math.min(n/t,r/o,1)})(e.element,t,o);s.zoom=n}const a=((e,t,o,n,r)=>{const s=o*r,a=n*r,i=Math.max(0,e/2-s/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:s.toString()+"px",height:a.toString()+"px"}})(Jt(e.element),Wt(e.element),t,o,s.zoom);r.getOpt(e).each((e=>{Bt(e.element,a)}))}};n.getOpt(e).each((o=>{const n=o.element;t.url!==Ot(n,"src")&&(kt(n,"src",t.url),ni(e.element,"tox-imagepreview__loaded")),a(),(e=>new Promise(((t,o)=>{const n=()=>{s(),t(e)},r=[_c(e,"load",n),_c(e,"error",(()=>{s(),o("Unable to load data from image: "+e.dom.src)}))],s=()=>H(r,(e=>e.unbind()));e.dom.complete&&n()})))(n).then((t=>{e.getSystem().isConnected()&&(ti(e.element,"tox-imagepreview__loaded"),s.cachedWidth=t.dom.naturalWidth,s.cachedHeight=t.dom.naturalHeight,a())}))}))}))])}},HT=ya("toolbar.button.execute"),PT=ya("common-button-display-events"),UT={[Ss()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events"],[Is()]:["toolbar-button-events",PT],[es()]:["focusing","alloy.base.behaviour",PT]},WT=e=>Mt(e.element,"width",Ft(e.element,"width")),jT=(e,t,o)=>Yb(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),$T=(e,t)=>jT(e,t,[]),GT=(e,t)=>jT(e,t,[Nh.config({})]),qT=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[Si(o.translate(e))],behaviours:ql([Nh.config({})])}),YT=ya("update-menu-text"),XT=ya("update-menu-icon"),KT=(e,t,o)=>{const n=Nr(b),r=e.text.map((e=>Ff(qT(e,t,o.providers)))),s=e.icon.map((e=>Ff(GT(e,o.providers.icons)))),a=(e,t)=>{const o=Ju.getValue(e);return Uh.focus(o),$s(o,"keydown",{raw:t.event.raw}),jk.close(o),D.some(!0)},i=e.role.fold((()=>({})),(e=>({role:e}))),l=e.tooltip.fold((()=>({})),(e=>{const t=o.providers.translate(e);return{title:t,"aria-label":t}})),c=Yb("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),d=ya("common-button-display-events"),u=Ff(jk.sketch({...e.uid?{uid:e.uid}:{},...i,dom:{tag:"button",classes:[t,`${t}--select`].concat(L(e.classes,(e=>`${t}--${e}`))),attributes:{...l}},components:Mw([s.map((e=>e.asSpec())),r.map((e=>e.asSpec())),D.some(c)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{zy(e).each((e=>Uh.focus(e)))})(n)},dropdownBehaviours:ql([...e.dropdownBehaviours,kw((()=>e.disabled||o.providers.isDisabled())),ww(),QC.config({}),Nh.config({}),Vh("dropdown-events",[Tw(e,n),Ew(e,n)]),Vh(d,[ia(((e,t)=>WT(e)))]),Vh("menubutton-update-display-text",[Qs(YT,((e,t)=>{r.bind((t=>t.getOpt(e))).each((e=>{Nh.set(e,[Si(o.providers.translate(t.event.text))])}))})),Qs(XT,((e,t)=>{s.bind((t=>t.getOpt(e))).each((e=>{Nh.set(e,[GT(t.event.icon,o.providers.icons)])}))}))])]),eventOrder:wn(UT,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[Is()]:["toolbar-button-events","dropdown-events",d]}),sandboxBehaviours:ql([Th.config({mode:"special",onLeft:a,onRight:a}),Vh("dropdown-sandbox-events",[Qs(Fy,((e,t)=>{$k(e),t.stop()})),Qs(Ry,((e,t)=>{((e,t)=>{Gk(e).each((o=>{((e,t,o,n)=>{const r={...n,target:t};e.getSystem().triggerEvent(o,t,r)})(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:qk,onCollapseMenu:(e,t,o)=>{Mg.getHighlighted(o).each((t=>{qk(e,o,t)}))},onDehighlightItem:Yk}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{zc()(e,t-10)}}),fetch:t=>Ek(k(e.fetch,t))}));return u.asSpec()},JT=e=>"separator"===e.type,ZT={type:"separator"},QT=(e,t)=>{const o=j(e,((e,o)=>(e=>s(e))(o)?""===o?e:"|"===o?e.length>0&&!JT(e[e.length-1])?e.concat([ZT]):e:ve(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o])),[]);return o.length>0&&JT(o[o.length-1])&&o.pop(),o},eE=(e,t)=>{const o=QT(s(e)?e.split(" "):e,t);return W(o,((e,o)=>{if((e=>ve(e,"getSubmenuItems"))(o)){const n=(e=>{const t=be(e,"value").getOrThunk((()=>ya("generated-menu-item")));return wn({value:t},e)})(o),r=((e,t)=>{const o=e.getSubmenuItems(),n=eE(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,r.menus),items:[r.item,...e.items],expansions:wn(e.expansions,r.expansions)}}return{...e,items:[o,...e.items]}}),{menus:{},expansions:{},items:[]})},tE=(e,t,o,n)=>{const r=ya("primary-menu"),s=eE(e,o.shared.providers.menuItems());if(0===s.items.length)return D.none();const a=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-field",placeholder:e.placeholder}))))(n),i=Qk(r,s.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold((()=>({searchMode:"no-search"})),(e=>({searchMode:"search-with-results"}))))(n),c=ce(s.menus,((e,n)=>Qk(n,e,t,o,!1,l))),d=wn(c,Lr(r,i));return D.from(Df.tieredData(r,d,s.expansions))},oE=e=>!ve(e,"items"),nE="data-value",rE=(e,t,o,n)=>L(o,(o=>oE(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{Ju.setValue(e,o.value),$s(e,IC,{name:t}),Uh.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>rE(e,t,o.items,n)})),sE=(e,t)=>se(e,(e=>oE(e)?Ce(e.value===t,e):sE(e.items,t))),aE=tg({name:"HtmlSelect",configFields:[dr("options"),Zu("selectBehaviours",[Uh,Ju]),Tr("selectClasses",[]),Tr("selectAttributes",{}),yr("data")],factory:(e,t)=>{const o=L(e.options,(e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}}))),n=e.data.map((e=>Lr("initialValue",e))).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:em(e.selectBehaviours,[Uh.config({}),Ju.config({store:{mode:"manual",getValue:e=>ci(e.element),setValue:(t,o)=>{const n=oe(e.options);$(e.options,(e=>e.value===o)).isSome()?di(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each((e=>di(t.element,e.value)))},...n}})])}}}),iE=x([Tr("field1Name","field1"),Tr("field2Name","field2"),ol("onLockedChange"),Zi(["lockClass"]),Tr("locked",!1),tm("coupledFieldBehaviours",[ag,Ju])]),lE=(e,t)=>Tm({factory:CC,name:e,overrides:e=>({fieldBehaviours:ql([Vh("coupled-input-behaviour",[Qs(cs(),(o=>{((e,t,o)=>Pm(e,t,o).bind(ag.getCurrent))(o,e,t).each((t=>{Pm(o,e,"lock").each((n=>{Kh.isOn(n)&&e.onLockedChange(o,t,n)}))}))}))])])})}),cE=x([lE("field1","field2"),lE("field2","field1"),Tm({factory:Bf,schema:[dr("dom")],name:"lock",overrides:e=>({buttonBehaviours:ql([Kh.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),dE=og({name:"FormCoupledInputs",configFields:iE(),partFields:cE(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:om(e.coupledFieldBehaviours,[ag.config({find:D.some}),Ju.config({store:{mode:"manual",getValue:t=>{const o=Gm(t,e,["field1","field2"]);return{[e.field1Name]:Ju.getValue(o.field1()),[e.field2Name]:Ju.getValue(o.field2())}},setValue:(t,o)=>{const n=Gm(t,e,["field1","field2"]);ye(o,e.field1Name)&&Ju.setValue(n.field1(),o[e.field1Name]),ye(o,e.field2Name)&&Ju.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>Pm(t,e,"field1"),getField2:t=>Pm(t,e,"field2"),getLock:t=>Pm(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),uE=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 on.value({value:e,unit:o})}return on.error(e)},mE=(e,t)=>{const o={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},n=e=>ve(o,e);return e.unit===t?D.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?D.some(e.value):D.some(e.value/o[e.unit]*o[t]):D.none()},gE=e=>D.none(),pE=(e,t)=>{const o=uE(e).toOptional(),n=uE(t).toOptional();return Se(o,n,((e,t)=>mE(e,t.unit).map((e=>t.value/e)).map((e=>{return o=e,n=t.unit,e=>mE(e,n).map((e=>({value:e*o,unit:n})));var o,n})).getOr(gE))).getOr(gE)},hE=(e,t)=>{const o=e.label.map((e=>BC(e,t))),n=[xg.config({disabled:()=>e.disabled||t.isDisabled()}),ww(),Th.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(js(e,VC),D.some(!0))}),Vh("textfield-change",[Qs(cs(),((t,o)=>{$s(t,IC,{name:e.name})})),Qs(xs(),((t,o)=>{$s(t,IC,{name:e.name})}))]),TC.config({})],r=e.validation.map((e=>ZC.config({getRoot:e=>rt(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=Ju.getValue(t),n=e.validator(o);return Dk(!0===n?on.value(o):on.error(n))},validateOnLoad:e.validateOnLoad}}))).toArray(),s={...e.placeholder.fold(x({}),(e=>({placeholder:t.translate(e)}))),...e.inputMode.fold(x({}),(e=>({inputmode:e})))},a=CC.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map((e=>({data:e}))).getOr({}),inputAttributes:s,inputClasses:[e.classname],inputBehaviours:ql(q([n,r])),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=[xg.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{CC.getField(e).each(xg.disable)},onEnabled:e=>{CC.getField(e).each(xg.enable)}}),ww()];return DC(o,i,l,c)},fE=(e,t)=>t.getAnimationRoot.fold((()=>e.element),(t=>t(e))),bE=e=>e.dimension.property,vE=(e,t)=>e.dimension.getDimension(t),yE=(e,t)=>{const o=fE(e,t);ii(o,[t.shrinkingClass,t.growingClass])},xE=(e,t)=>{ni(e.element,t.openClass),ti(e.element,t.closedClass),Mt(e.element,bE(t),"0px"),Ht(e.element)},wE=(e,t)=>{ni(e.element,t.closedClass),ti(e.element,t.openClass),Lt(e.element,bE(t))},SE=(e,t,o,n)=>{o.setCollapsed(),Mt(e.element,bE(t),vE(t,e.element)),yE(e,t),xE(e,t),t.onStartShrink(e),t.onShrunk(e)},kE=(e,t,o,n)=>{const r=n.getOrThunk((()=>vE(t,e.element)));o.setCollapsed(),Mt(e.element,bE(t),r),Ht(e.element);const s=fE(e,t);ni(s,t.growingClass),ti(s,t.shrinkingClass),xE(e,t),t.onStartShrink(e)},CE=(e,t,o)=>{const n=vE(t,e.element);("0px"===n?SE:kE)(e,t,o,D.some(n))},OE=(e,t,o)=>{const n=fE(e,t),r=si(n,t.shrinkingClass),s=vE(t,e.element);wE(e,t);const a=vE(t,e.element);(r?()=>{Mt(e.element,bE(t),s),Ht(e.element)}:()=>{xE(e,t)})(),ni(n,t.shrinkingClass),ti(n,t.growingClass),wE(e,t),Mt(e.element,bE(t),a),o.setExpanded(),t.onStartGrow(e)},_E=(e,t,o)=>{const n=fE(e,t);return!0===si(n,t.growingClass)},TE=(e,t,o)=>{const n=fE(e,t);return!0===si(n,t.shrinkingClass)};var EE=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){Lt(e.element,bE(t));const o=vE(t,e.element);Mt(e.element,bE(t),o)}},grow:(e,t,o)=>{o.isExpanded()||OE(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&CE(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&SE(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:_E,isShrinking:TE,isTransitioning:(e,t,o)=>_E(e,t)||TE(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?CE:OE)(e,t,o)},disableTransitions:yE,immediateGrow:(e,t,o)=>{o.isExpanded()||(wE(e,t),Mt(e.element,bE(t),vE(t,e.element)),yE(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}});var DE=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return La(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:Lr(t.dimension.property,"0px")})},events:(e,t)=>Ks([aa(gs(),((o,n)=>{if(n.event.raw.propertyName===e.dimension.property){yE(o,e),t.isExpanded()&&Lt(o.element,e.dimension.property);(t.isExpanded()?e.onGrown:e.onShrunk)(o)}}))])}),AE=[dr("closedClass"),dr("openClass"),dr("shrinkingClass"),dr("growingClass"),yr("getAnimationRoot"),el("onShrunk"),el("onStartShrink"),el("onGrown"),el("onStartGrow"),Tr("expanded",!1),ur("dimension",sr("property",{width:[rl("property","width"),rl("getDimension",(e=>Jt(e)+"px"))],height:[rl("property","height"),rl("getDimension",(e=>Wt(e)+"px"))]}))];const ME=Xl({fields:AE,name:"sliding",active:DE,apis:EE,state:Object.freeze({__proto__:null,init:e=>{const t=Nr(e.expanded);return Va({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:k(t.set,!1),setExpanded:k(t.set,!0),readState:()=>"expanded: "+t.get()})}})}),BE=e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setActive:t=>{const o=e.element;t?(ti(o,"tox-tbtn--enabled"),kt(o,"aria-pressed",!0)):(ni(o,"tox-tbtn--enabled"),Et(o,"aria-pressed"))},isActive:()=>si(e.element,"tox-tbtn--enabled"),setText:t=>{$s(e,YT,{text:t})},setIcon:t=>$s(e,XT,{icon:t})}),IE=(e,t,o,n,r=!0)=>KT({text:e.text,icon:e.icon,tooltip:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const r={pattern:e.search.isSome()?Xk(t):""};e.fetch((t=>{n(tE(t,dy.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))}),r,BE(t))},onSetup:e.onSetup,getApi:BE,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...r?[TC.config({})]:[]]},t,o.shared),FE=(e,t,o)=>{const n=e=>n=>{const r=!n.isActive();n.setActive(r),e.storage.set(r),o.shared.getSink().each((o=>{t().getOpt(o).each((t=>{tc(t.element),$s(t,NC,{name:e.name,value:e.storage.get()})}))}))},r=e=>t=>{t.setActive(e.storage.get())};return t=>{t(L(e,(e=>{const t=e.text.fold((()=>({})),(e=>({text:e})));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:r(e)}})))}},RE=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{title:e,"aria-label":e}},components:[Si(e)]}),NE=ya("leaf-label-event-id"),VE=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:r,backstage:s})=>{const a=e.menu.map((e=>IE(e,"tox-mbtn",s,D.none(),o))),i=[RE(e.title)];return a.each((e=>i.push(e))),Bf.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:{[is()]:[NE,"keying"]},buttonBehaviours:ql([...o?[TC.config({})]:[],Kh.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),Ql.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?Kh.on:Kh.off)(t)}}}}),Vh(NE,[ia(((t,o)=>{r.each((o=>{(o===e.id?Kh.on:Kh.off)(t)}))})),Qs(is(),((e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(Bi(e.element,".tox-tree--directory").each((t=>{e.getSystem().getByDom(t).each((e=>{Ii(t,".tox-tree--directory__label").each((t=>{e.getSystem().getByDom(t).each(Uh.focus)}))}))})),t.stop()):n&&t.stop()}))])])})},zE=(e,t)=>((e,t,o)=>Yb(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:o},t))(e,t,[]),LE=ya("directory-label-event-id"),HE=({directory:e,visible:t,noChildren:o,backstage:n})=>{const r=e.menu.map((e=>IE(e,"tox-mbtn",n,D.none()))),s=[{dom:{tag:"div",classes:["tox-chevron"]},components:[zE("chevron-right",n.shared.providers.icons)]},RE(e.title)];r.each((e=>{s.push(e)}));const a=t=>{Bi(t.element,".tox-tree--directory").each((o=>{t.getSystem().getByDom(o).each((o=>{const n=!Kh.isOn(o);Kh.toggle(o),$s(t,"expand-tree-node",{expanded:n,node:e.id})}))}))};return Bf.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:s,action:a,eventOrder:{[is()]:[LE,"keying"]},buttonBehaviours:ql([...t?[TC.config({})]:[],Vh(LE,[Qs(is(),((e,t)=>{const n="ArrowRight"===t.event.raw.code,r="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||r)&&Bi(e.element,".tox-tree--directory").each((o=>{e.getSystem().getByDom(o).each((o=>{!Kh.isOn(o)&&n||Kh.isOn(o)&&r?(a(e),t.stop()):r&&!Kh.isOn(o)&&(Bi(o.element,".tox-tree--directory").each((e=>{Ii(e,".tox-tree--directory__label").each((e=>{o.getSystem().getByDom(e).each(Uh.focus)}))})),t.stop())}))}))}))])])})},PE=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:r,selectedId:s,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map((e=>"leaf"===e.type?VE({leaf:e,selectedId:s,onLeafAction:t,visible:o,treeId:n,backstage:a}):WE({directory:e,expandedIds:r,selectedId:s,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a}))),behaviours:ql([ME.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}),Nh.config({})])}),UE=ya("directory-event-id"),WE=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:r,expandedIds:s,selectedId:a})=>{const{children:i}=e,l=Nr(s),c=s.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[HE({directory:e,visible:o,noChildren:0===e.children.length,backstage:r}),PE({children:i,expandedIds:s,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:r})],behaviours:ql([Vh(UE,[ia(((e,t)=>{Kh.set(e,c)})),Qs("expand-tree-node",((e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter((e=>e!==n)))}))]),Kh.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const s=e.components()[1],c=(d=o,i.map((e=>"leaf"===e.type?VE({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:r}):WE({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:r}))));var d;o?ME.grow(s):ME.shrink(s),Nh.set(s,c)}})])}},jE=ya("tree-event-id");var $E=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Ks([Qs(e.event,o),la((()=>t.cancel()))].concat(e.cancelEvent.map((e=>[Qs(e,(()=>t.cancel()))])).getOr([])))}});const GE=e=>{const t=Nr(null);return Va({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var qE=Object.freeze({__proto__:null,throttle:GE,init:e=>e.stream.streams.state(e)});var YE=[ur("stream",sr("mode",{throttle:[dr("delay"),Tr("stopEvent",!0),rl("streams",{setup:(e,t)=>{const o=e.stream,n=hT(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:GE})]})),Tr("event","input"),yr("cancelEvent"),ol("onStream")];const XE=Xl({fields:YE,name:"streaming",active:$E,state:qE}),KE=(e,t,o)=>{const n=Ju.getValue(o);Ju.setValue(t,n),ZE(t)},JE=(e,t)=>{const o=e.element,n=ci(o),r=o.dom;"number"!==Ot(o,"type")&&t(r,n)},ZE=e=>{JE(e,((e,t)=>e.setSelectionRange(t.length,t.length)))},QE=(e,t,o)=>{if(e.selectsOver){const n=Ju.getValue(t),r=e.getDisplayText(n),s=Ju.getValue(o);return 0===e.getDisplayText(s).indexOf(r)?D.some((()=>{KE(0,t,o),((e,t)=>{JE(e,((e,o)=>e.setSelectionRange(t,o.length)))})(t,r.length)})):D.none()}return D.none()},eD=x("alloy.typeahead.itemexecute"),tD=x([yr("lazySink"),dr("fetch"),Tr("minChars",5),Tr("responseTime",1e3),el("onOpen"),Tr("getHotspot",D.some),Tr("getAnchorOverrides",x({})),Tr("layouts",D.none()),Tr("eventOrder",{}),Rr("model",{},[Tr("getDisplayText",(e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value)),Tr("selectsOver",!0),Tr("populateFromBrowse",!0)]),el("onSetValue"),tl("onExecute"),el("onItemExecute"),Tr("inputClasses",[]),Tr("inputAttributes",{}),Tr("inputStyles",{}),Tr("matchWidth",!0),Tr("useMinWidth",!1),Tr("dismissOnBlur",!0),Zi(["openClass"]),yr("initialData"),Zu("typeaheadBehaviours",[Uh,Ju,XE,Th,Kh,kk]),lr("lazyTypeaheadComp",(()=>Nr(D.none))),lr("previewing",(()=>Nr(!0)))].concat(Dy()).concat(Pk())),oD=x([Em({schema:[Ji()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each((t=>{QE(e.model,t,n).fold((()=>{e.model.selectsOver?(Mg.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&&KE(e.model,t,n),_t(n.element,"id").each((e=>kt(t.element,"aria-activedescendant",e)))}))},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map((e=>($s(e,eD(),{item:o}),!0))),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each((t=>{e.model.populateFromBrowse&&KE(e.model,t,o)}))}})})]),nD=og({name:"Typeahead",configFields:tD(),partFields:oD(),factory:(e,t,o,n)=>{const r=(t,o,r)=>{e.previewing.set(!1);const s=kk.getCoupled(t,"sandbox");if(Mu.isOpen(s))ag.getCurrent(s).each((e=>{Mg.getHighlighted(e).fold((()=>{r(e)}),(()=>{Xs(s,e.element,"keydown",o)}))}));else{const o=e=>{ag.getCurrent(e).each(r)};Ik(e,a(t),t,s,n,o,Tf.HighlightMenuAndItem).get(b)}},s=Ay(e),a=e=>t=>t.map((t=>{const o=fe(t.menus),n=Y(o,(e=>U(e.items,(e=>"item"===e.type))));return Ju.getState(e).update(L(n,(e=>e.data))),t})),i=e=>ag.getCurrent(e),l="typeaheadevents",c=[Uh.config({}),Ju.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>ci(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{di(t.element,e.model.getDisplayText(o))},...e.initialData.map((e=>Lr("initialValue",e))).getOr({})}}),XE.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const r=kk.getCoupled(t,"sandbox");if(Uh.isFocused(t)&&ci(t.element).length>=e.minChars){const o=i(r).bind((e=>Mg.getHighlighted(e).map(Ju.getValue)));e.previewing.set(!0);const s=t=>{i(r).each((t=>{o.fold((()=>{e.model.selectsOver&&Mg.highlightFirst(t)}),(e=>{Mg.highlightBy(t,(t=>Ju.getValue(t).value===e.value)),Mg.getHighlighted(t).orThunk((()=>(Mg.highlightFirst(t),D.none())))}))}))};Ik(e,a(t),t,r,n,s,Tf.HighlightJustMenu).get(b)}},cancelEvent:Ts()}),Th.config({mode:"special",onDown:(e,t)=>(r(e,t,Mg.highlightFirst),D.some(!0)),onEscape:e=>{const t=kk.getCoupled(e,"sandbox");return Mu.isOpen(t)?(Mu.close(t),D.some(!0)):D.none()},onUp:(e,t)=>(r(e,t,Mg.highlightLast),D.some(!0)),onEnter:t=>{const o=kk.getCoupled(t,"sandbox"),n=Mu.isOpen(o);if(n&&!e.previewing.get())return i(o).bind((e=>Mg.getHighlighted(e))).map((e=>($s(t,eD(),{item:e}),!0)));{const r=Ju.getValue(t);return js(t,Ts()),e.onExecute(o,t,r),n&&Mu.close(o),D.some(!0)}}}),Kh.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),kk.config({others:{sandbox:t=>Lk(e,t,{onOpen:()=>Kh.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each((e=>Et(e.element,"aria-activedescendant"))),Kh.off(t)}})}}),Vh(l,[ia((t=>{e.lazyTypeaheadComp.set(D.some(t))})),la((t=>{e.lazyTypeaheadComp.set(D.none())})),da((t=>{const o=b;Rk(e,a(t),t,n,o,Tf.HighlightMenuAndItem).get(b)})),Qs(eD(),((t,o)=>{const n=kk.getCoupled(t,"sandbox");KE(e.model,t,o.event.item),js(t,Ts()),e.onItemExecute(t,n,o.event.item,Ju.getValue(t)),Mu.close(n),ZE(t)}))].concat(e.dismissOnBlur?[Qs(ys(),(e=>{const t=kk.getCoupled(e,"sandbox");sc(t.element).isNone()&&Mu.close(t)}))]:[]))],d={[Fs()]:[Ju.name(),XE.name(),l],...e.eventOrder};return{uid:e.uid,dom:By(wn(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...s,...em(e.typeaheadBehaviours,c)},eventOrder:d}}}),rD=e=>({...e,toCached:()=>rD(e.toCached()),bindFuture:t=>rD(e.bind((e=>e.fold((e=>Dk(on.error(e))),(e=>t(e)))))),bindResult:t=>rD(e.map((e=>e.bind(t)))),mapResult:t=>rD(e.map((e=>e.map(t)))),mapError:t=>rD(e.map((e=>e.mapError(t)))),foldResult:(t,o)=>e.map((e=>e.fold(t,o))),withTimeout:(t,o)=>rD(Ek((n=>{let r=!1;const s=setTimeout((()=>{r=!0,n(on.error(o()))}),t);e.get((e=>{r||(clearTimeout(s),n(e))}))})))}),sD=e=>rD(Ek(e)),aD=sD,iD=(e,t,o=[],n,r,s)=>{const a=t.fold((()=>({})),(e=>({action:e}))),i={buttonBehaviours:ql([kw((()=>!e.enabled||s.isDisabled())),ww(),TC.config({}),Vh("button press",[Zs("click"),Zs("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...a},l=wn(i,{dom:n});return wn(l,{components:r})},lD=(e,t,o,n=[])=>{const r={tag:"button",classes:["tox-tbtn"],attributes:e.tooltip.map((e=>({"aria-label":o.translate(e),title:o.translate(e)}))).getOr({})},s=e.icon.map((e=>$T(e,o.icons))),a=Mw([s]);return iD(e,t,n,r,a,o)},cD=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},dD=(e,t,o,n=[],r=[])=>{const s=o.translate(e.text),a=e.icon.map((e=>$T(e,o.icons))),i=[a.getOrThunk((()=>Si(s)))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c=[...cD(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...r];return iD(e,t,n,{tag:"button",classes:c,attributes:{title:s}},i,o)},uD=(e,t,o,n=[],r=[])=>{const s=dD(e,D.some(t),o,n,r);return Bf.sketch(s)},mD=(e,t)=>o=>{"custom"===t?$s(o,NC,{name:e,value:{}}):"submit"===t?js(o,VC):"cancel"===t?js(o,RC):console.error("Unknown button type: ",t)},gD=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>s,n=e,r={...e,type:"menubutton",search:D.none(),onSetup:t=>(t.setEnabled(e.enabled),b),fetch:FE(n.items,t,o)},s=Ff(IE(r,"tox-tbtn",o,D.none()));return s.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=mD(e.name,t),r={...e,borderless:!1};return uD(r,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t)=>{var o,n;const r=e.icon.map((e=>GT(e,t.icons))).map(Ff),s=e.buttonType.getOr(e.primary?"primary":"secondary"),a={...e,name:null!==(o=e.name)&&void 0!==o?o:"",primary:"primary"===s,tooltip:D.from(e.tooltip),enabled:null!==(n=e.enabled)&&void 0!==n&&n,borderless:!1},i=a.tooltip.map((e=>({"aria-label":t.translate(e),title:t.translate(e)}))).getOr({}),l=cD(null!=s?s:"secondary"),c=e.icon.isSome()&&e.text.isSome(),d={tag:"button",classes:[...l.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...c?["tox-button--icon-and-text"]:[]],attributes:i},u=t.translate(e.text.getOr("")),m=Si(u),g=[...Mw([r.map((e=>e.asSpec()))]),...e.text.isSome()?[m]:[]],p=iD(a,D.some((o=>{$s(o,NC,{name:e.name,value:{setIcon:e=>{r.map((n=>n.getOpt(o).each((o=>{Nh.set(o,[GT(e,t.icons)])}))))}}})})),[],d,g,t);return Bf.sketch(p)})(e,o.shared.providers);throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},pD=(e,t)=>{const o=mD(e.name,"custom");return n=D.none(),r=CC.parts.field({factory:Bf,...dD(e,D.some(o),t,[cT(""),oT()])}),DC(n,r,[],[]);var n,r},hD={type:"separator"},fD=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:b}),bD=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:b}),vD=(e,t)=>(e=>L(e,fD))(((e,t)=>U(t,(t=>t.type===e)))(e,t)),yD=e=>vD("header",e.targets),xD=e=>vD("anchor",e.targets),wD=e=>D.from(e.anchorTop).map((e=>bD("<top>",e))).toArray(),SD=e=>D.from(e.anchorBottom).map((e=>bD("<bottom>",e))).toArray(),kD=(e,t)=>{const o=e.toLowerCase();return U(t,(e=>{var t;const n=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,r=null!==(t=e.value)&&void 0!==t?t:"";return Te(n.toLowerCase(),o)||Te(r.toLowerCase(),o)}))},CD=(e,t,o)=>{var n,r;const s=Ju.getValue(t),a=null!==(r=null===(n=null==s?void 0:s.meta)||void 0===n?void 0:n.text)&&void 0!==r?r:s.value;return o.getLinkInformation().fold((()=>[]),(t=>{const n=kD(a,(e=>L(e,(e=>bD(e,e))))(o.getHistory(e)));return"file"===e?(r=[n,kD(a,yD(t)),kD(a,q([wD(t),xD(t),SD(t)]))],j(r,((e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(hD,t)),[])):n;var r}))},OD=ya("aria-invalid"),_D=(e,t)=>{e.dom.checked=t},TD=e=>e.dom.checked,ED=e=>(t,o,n,r)=>be(o,"name").fold((()=>e(o,r,D.none())),(s=>t.field(s,e(o,r,be(n,s))))),DD={bar:ED(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:L(e.items,t.interpreter)}))(e,t.shared))),collection:ED(((e,t,o)=>UC(e,t.shared.providers,o))),alertbanner:ED(((e,t)=>((e,t)=>{const o=$b(e.icon,t.icons);return xC.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?[Bf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>$s(t,NC,{name:"alert-banner",value:e.url}),buttonBehaviours:ql([Gb()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers))),input:ED(((e,t,o)=>((e,t,o)=>hE({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:D.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),textarea:ED(((e,t,o)=>((e,t,o)=>hE({name:e.name,multiline:!0,label:e.label,inputMode:D.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:D.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o))),label:ED(((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:[Si(t.providers.translate(e.label))]},...L(e.items,t.interpreter)],behaviours:ql([oT(),Nh.config({}),(n=D.none(),lT(n,ua,ma)),Th.config({mode:"acyclic"})])};var n})(e,t.shared))),iframe:(e=>(t,o,n,r)=>{const s=wn(o,{source:"dynamic"});return ED(e)(t,s,n,r)})(((e,t,o)=>zT(e,t.shared.providers,o))),button:ED(((e,t)=>pD(e,t.shared.providers))),checkbox:ED(((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),D.some(!0)),r=CC.parts.field({factory:{sketch:w},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:ql([oT(),xg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{rt(e.element).each((e=>ti(e,"tox-checkbox--disabled")))},onEnabled:e=>{rt(e.element).each((e=>ni(e,"tox-checkbox--disabled")))}}),TC.config({}),Uh.config({}),lT(o,TD,_D),Th.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),Vh("checkbox-events",[Qs(ds(),((t,o)=>{$s(t,IC,{name:e.name})}))])])}),s=CC.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[Si(t.translate(e.label))],behaviours:ql([QC.config({})])}),a=e=>Yb("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=Ff({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return CC.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[r,i.asSpec(),s],fieldBehaviours:ql([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),ww()])})})(e,t.shared.providers,o))),colorinput:ED(((e,t,o)=>nO(e,t.shared,t.colorinput,o))),colorpicker:ED(((e,t,o)=>uT(0,t.shared.providers,o))),dropzone:ED(((e,t,o)=>pT(e,t.shared.providers,o))),grid:ED(((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:L(e.items,t.interpreter)}))(e,t.shared))),listbox:ED(((e,t,o)=>((e,t,o)=>{const n=t.shared.providers,r=o.bind((t=>sE(e.items,t))).orThunk((()=>oe(e.items).filter(oE))),s=e.label.map((e=>BC(e,n))),a=CC.parts.field({dom:{},factory:{sketch:o=>KT({uid:o.uid,text:r.map((e=>e.text)),icon:D.none(),tooltip:e.label,role:D.none(),fetch:(o,n)=>{const r=rE(o,e.name,e.items,Ju.getValue(o));n(tE(r,dy.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:D.none()}))},onSetup:x(b),getApi:x({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[TC.config({}),iT(r.map((e=>e.value)),(e=>Ot(e.element,nE)),((t,o)=>{sE(e.items,o).each((e=>{kt(t.element,nE,e.value),$s(t,YT,{text:e.text})}))}))]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return CC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([s.toArray(),[i]]),fieldBehaviours:ql([xg.config({disabled:x(!e.enabled),onDisabled:e=>{CC.getField(e).each(xg.disable)},onEnabled:e=>{CC.getField(e).each(xg.enable)}})])})})(e,t,o))),selectbox:ED(((e,t,o)=>((e,t,o)=>{const n=L(e.items,(e=>({text:t.translate(e.text),value:e.value}))),r=e.label.map((e=>BC(e,t))),s=CC.parts.field({dom:{},...o.map((e=>({data:e}))).getOr({}),selectAttributes:{size:e.size},options:n,factory:aE,selectBehaviours:ql([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),TC.config({}),Vh("selectbox-change",[Qs(ds(),((t,o)=>{$s(t,IC,{name:e.name})}))])])}),a=e.size>1?D.none():D.some(Yb("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:q([[s],a.toArray()])};return CC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([r.toArray(),[i]]),fieldBehaviours:ql([xg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{CC.getField(e).each(xg.disable)},onEnabled:e=>{CC.getField(e).each(xg.enable)}}),ww()])})})(e,t.shared.providers,o))),sizeinput:ED(((e,t)=>((e,t)=>{let o=gE;const n=ya("ratio-event"),r=e=>Yb(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),s=dE.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:t.translate(e.label.getOr("Constrain proportions"))}},components:[r("lock"),r("unlock")],buttonBehaviours:ql([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),ww(),TC.config({})])}),a=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),i=o=>CC.parts.field({factory:Iy,inputClasses:["tox-textfield"],inputBehaviours:ql([xg.config({disabled:()=>!e.enabled||t.isDisabled()}),ww(),TC.config({}),Vh("size-input-events",[Qs(ss(),((e,t)=>{$s(e,n,{isField1:o})})),Qs(ds(),((t,o)=>{$s(t,IC,{name:e.name})}))])]),selectOnFocus:!1}),l=e=>({dom:{tag:"label",classes:["tox-label"]},components:[Si(t.translate(e))]}),c=dE.parts.field1(a([CC.parts.label(l("Width")),i(!0)])),d=dE.parts.field2(a([CC.parts.label(l("Height")),i(!1)]));return dE.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,d,a([l(" "),s])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{uE(Ju.getValue(e)).each((e=>{o(e).each((e=>{Ju.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:ql([xg.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{dE.getField1(e).bind(CC.getField).each(xg.disable),dE.getField2(e).bind(CC.getField).each(xg.disable),dE.getLock(e).each(xg.disable)},onEnabled:e=>{dE.getField1(e).bind(CC.getField).each(xg.enable),dE.getField2(e).bind(CC.getField).each(xg.enable),dE.getLock(e).each(xg.enable)}}),ww(),Vh("size-input-events2",[Qs(n,((e,t)=>{const n=t.event.isField1,r=n?dE.getField1(e):dE.getField2(e),s=n?dE.getField2(e):dE.getField1(e),a=r.map(Ju.getValue).getOr(""),i=s.map(Ju.getValue).getOr("");o=pE(a,i)}))])])})})(e,t.shared.providers))),slider:ED(((e,t,o)=>((e,t,o)=>{const n=H_.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Si(t.translate(e.label))]}),r=H_.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),s=H_.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return H_.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,r,s],sliderBehaviours:ql([oT(),Uh.config({})]),onChoose:(t,o,n)=>{$s(t,IC,{name:e.name,value:n})}})})(e,t.shared.providers,o))),urlinput:ED(((e,t,o)=>((e,t,o,n)=>{const r=t.shared.providers,s=t=>{const n=Ju.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":OD,type:"url"},minChars:0,responseTime:0,fetch:n=>{const r=CD(e.filetype,n,o),s=tE(r,dy.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:D.none()});return Dk(s)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(ZC)&&ZC.run(e).get(b)},typeaheadBehaviours:ql([...o.getValidationHandler().map((t=>ZC.config({getRoot:e=>rt(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each((e=>{kt(e.element,"title",r.translate(t))}))}},validator:{validate:o=>{const n=Ju.getValue(o);return aD((o=>{t({type:e.filetype,url:n.value},(e=>{if("invalid"===e.status){const t=on.error(e.message);o(t)}else{const t=on.value(e.message);o(t)}}))}))},validateOnLoad:!1}}))).toArray(),xg.config({disabled:()=>!e.enabled||r.isDisabled()}),TC.config({}),Vh("urlinput-events",[Qs(cs(),(t=>{const o=ci(t.element),n=o.trim();n!==o&&di(t.element,n),"file"===e.filetype&&$s(t,IC,{name:e.name})})),Qs(ds(),(t=>{$s(t,IC,{name:e.name}),s(t)})),Qs(xs(),(t=>{$s(t,IC,{name:e.name}),s(t)}))])]),eventOrder:{[cs()]:["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)=>{$s(t,VC,{})},onItemExecute:(t,o,n,r)=>{s(t),$s(t,IC,{name:e.name})}},i=CC.parts.field({...a,factory:nD}),l=e.label.map((e=>BC(e,r))),c=Ff(((e,t,o=e,n=e)=>Yb(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:r.translate(n),"aria-live":"polite",...t.fold((()=>({})),(e=>({id:e})))}},r.icons))("invalid",D.some(OD),"warning")),d=Ff({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),u=o.getUrlPicker(e.filetype),m=ya("browser.url.event"),g=Ff({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:ql([xg.config({disabled:()=>!e.enabled||r.isDisabled()})])}),p=Ff(uD({name:e.name,icon:D.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:D.none(),borderless:!0},(e=>js(e,m)),r,[],["tox-browse-url"]));return CC.sketch({dom:MC([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:q([[g.asSpec()],u.map((()=>p.asSpec())).toArray()])}]),fieldBehaviours:ql([xg.config({disabled:()=>!e.enabled||r.isDisabled(),onDisabled:e=>{CC.getField(e).each(xg.disable),p.getOpt(e).each(xg.disable)},onEnabled:e=>{CC.getField(e).each(xg.enable),p.getOpt(e).each(xg.enable)}}),ww(),Vh("url-input-events",[Qs(m,(t=>{ag.getCurrent(t).each((o=>{const n=Ju.getValue(o),r={fieldname:e.name,...n};u.each((n=>{n(r).get((n=>{Ju.setValue(o,n),$s(t,IC,{name:e.name})}))}))}))}))])])})})(e,t,t.urlinput,o))),customeditor:ED((e=>{const t=Cc(),o=Ff({dom:{tag:e.tag}}),n=Cc();return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:ql([Vh("custom-editor-events",[ia((r=>{o.getOpt(r).each((o=>{((e=>ve(e,"init"))(e)?e.init(o.element.dom):mT.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)}))}))}))]),iT(D.none(),(()=>t.get().fold((()=>n.get().getOr("")),(e=>e.getValue()))),((e,o)=>{t.get().fold((()=>n.set(o)),(e=>e.setValue(o)))})),oT()]),components:[o.asSpec()]}})),htmlpanel:ED((e=>"presentation"===e.presets?xC.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html}}):xC.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:ql([TC.config({}),Uh.config({})])}))),imagepreview:ED(((e,t,o)=>LT(e,o))),table:ED(((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"th",innerHtml:t.translate(e)}}),n=e=>({dom:{tag:"td",innerHtml:t.translate(e)}}),r=e=>({dom:{tag:"tr"},components:L(e,n)});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(a=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:L(a,o)}]}),(s=e.cells,{dom:{tag:"tbody"},components:L(s,r)})],behaviours:ql([TC.config({}),Uh.config({})])};var s,a})(e,t.shared.providers))),tree:ED(((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(b),n=e.onToggleExpand.getOr(b),r=e.defaultExpandedIds,s=Nr(r),a=Nr(e.defaultSelectedId),i=ya("tree-id"),l=(n,r)=>e.items.map((e=>"leaf"===e.type?VE({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):WE({directory:e,selectedId:n,onLeafAction:o,expandedIds:r,labelTabstopping:!0,treeId:i,backstage:t})));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),s.get()),behaviours:ql([Th.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),Vh(jE,[Qs("expand-tree-node",((e,t)=>{const{expanded:o,node:r}=t.event;s.set(o?[...s.get(),r]:s.get().filter((e=>e!==r))),n(s.get(),{expanded:o,node:r})}))]),Ql.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(D.some(t.value)),Nh.set(e,l(D.some(t.value),s.get()))}}}}),Nh.config({})])}})(e,t))),panel:ED(((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:L(e.items,t.shared.interpreter)}))(e,t)))},AD={field:(e,t)=>t,record:x([])},MD=(e,t,o,n)=>{const r=wn(n,{shared:{interpreter:t=>BD(e,t,o,r)}});return BD(e,t,o,r)},BD=(e,t,o,n)=>be(DD,t.type).fold((()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t)),(r=>r(e,t,o,n))),ID=(e,t,o)=>BD(AD,e,t,o),FD="layout-inset",RD=e=>e.x,ND=(e,t)=>e.x+e.width/2-t.width/2,VD=(e,t)=>e.x+e.width-t.width,zD=e=>e.y,LD=(e,t)=>e.y+e.height-t.height,HD=(e,t)=>e.y+e.height/2-t.height/2,PD=(e,t,o)=>il(VD(e,t),LD(e,t),o.insetSouthwest(),ml(),"southwest",yl(e,{right:0,bottom:3}),FD),UD=(e,t,o)=>il(RD(e),LD(e,t),o.insetSoutheast(),ul(),"southeast",yl(e,{left:1,bottom:3}),FD),WD=(e,t,o)=>il(VD(e,t),zD(e),o.insetNorthwest(),dl(),"northwest",yl(e,{right:0,top:2}),FD),jD=(e,t,o)=>il(RD(e),zD(e),o.insetNortheast(),cl(),"northeast",yl(e,{left:1,top:2}),FD),$D=(e,t,o)=>il(ND(e,t),zD(e),o.insetNorth(),gl(),"north",yl(e,{top:2}),FD),GD=(e,t,o)=>il(ND(e,t),LD(e,t),o.insetSouth(),pl(),"south",yl(e,{bottom:3}),FD),qD=(e,t,o)=>il(VD(e,t),HD(e,t),o.insetEast(),fl(),"east",yl(e,{right:0}),FD),YD=(e,t,o)=>il(RD(e),HD(e,t),o.insetWest(),hl(),"west",yl(e,{left:1}),FD),XD=e=>{switch(e){case"north":return $D;case"northeast":return jD;case"northwest":return WD;case"south":return GD;case"southeast":return UD;case"southwest":return PD;case"east":return qD;case"west":return YD}},KD=(e,t,o,n,r)=>yc(n).map(XD).getOr($D)(e,t,o,n,r),JD=e=>{switch(e){case"north":return GD;case"northeast":return UD;case"northwest":return PD;case"south":return $D;case"southeast":return jD;case"southwest":return WD;case"east":return YD;case"west":return qD}},ZD=(e,t,o,n,r)=>yc(n).map(JD).getOr($D)(e,t,o,n,r),QD={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},eA=(e,t,o)=>{const n={maxHeightFunction:Lc()};return()=>o()?{type:"node",root:ht(pt(e())),node:D.from(e()),bubble:Wc(12,12,QD),layouts:{onRtl:()=>[jD],onLtr:()=>[WD]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:Wc(-12,12,QD),layouts:{onRtl:()=>[Tl,El,Bl],onLtr:()=>[El,Tl,Bl]},overrides:n}},tA=(e,t,o,n)=>{const r={maxHeightFunction:Lc()};return()=>n()?{type:"node",root:ht(pt(t())),node:D.from(t()),bubble:Wc(12,12,QD),layouts:{onRtl:()=>[$D],onLtr:()=>[$D]},overrides:r}:e?{type:"node",root:ht(pt(t())),node:D.from(t()),bubble:Wc(0,-jt(t()),QD),layouts:{onRtl:()=>[Ml],onLtr:()=>[Ml]},overrides:r}:{type:"hotspot",hotspot:o(),bubble:Wc(0,0,QD),layouts:{onRtl:()=>[Ml],onLtr:()=>[Ml]},overrides:r}},oA=(e,t,o)=>()=>o()?{type:"node",root:ht(pt(e())),node:D.from(e()),layouts:{onRtl:()=>[$D],onLtr:()=>[$D]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[Bl],onLtr:()=>[Bl]}},nA=(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:Re.fromDom(e),lastCell:Re.fromDom(t)};return D.some(n)}return D.some(fd.range(Re.fromDom(t.startContainer),t.startOffset,Re.fromDom(t.endContainer),t.endOffset))}}),rA=e=>t=>({type:"node",root:e(),node:t}),sA=(e,t,o,n)=>{const r=Qv(e),s=()=>Re.fromDom(e.getBody()),a=()=>Re.fromDom(e.getContentAreaContainer()),i=()=>r||!n();return{inlineDialog:eA(a,t,i),inlineBottomDialog:tA(e.inline,a,o,i),banner:oA(a,t,i),cursor:nA(e,s),node:rA(s)}},aA=e=>(t,o)=>{ok(e)(t,o)},iA=e=>()=>PS(e),lA=e=>t=>VS(e,t),cA=e=>t=>HS(e,t),dA=e=>()=>Iv(e),uA=e=>ye(e,"items"),mA=e=>ye(e,"format"),gA=[{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"}]}],pA=e=>j(e,((e,t)=>{if(ve(t,"items")){const o=pA(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if((e=>ve(e,"inline"))(t)||(e=>ve(e,"block"))(t)||(e=>ve(e,"selector"))(t)){const o=`custom-${s(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:[]}),hA=e=>mv(e).map((t=>{const o=((e,t)=>{const o=pA(t),n=t=>{H(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 gv(e)?gA.concat(o):o})).getOr(gA),fA=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),bA=(e,t,o,n)=>{const r=t=>L(t,(t=>uA(t)?(e=>{const t=r(e.items);return{...e,type:"submenu",getStyleItems:x(t)}})(t):mA(t)?(e=>fA(e,o,n))(t):(e=>{const t=ae(e);return 1===t.length&&R(t,"title")})(t)?{...t,type:"separator"}:(t=>{const r=s(t.name)?t.name:ya(t.title),a=`custom-${r}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(r,i),i})(t)));return r(t)},vA=gT.trim,yA=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},xA=yA("true"),wA=yA("false"),SA=(e,t,o,n,r)=>({type:e,title:t,url:o,level:n,attach:r}),kA=e=>e.innerText||e.textContent,CA=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&_A(e),OA=e=>e&&/^(H[1-6])$/.test(e.nodeName),_A=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return xA(t)}return!1})(e)&&!wA(e),TA=e=>OA(e)&&_A(e),EA=e=>{var t;const o=(e=>e.id?e.id:ya("h"))(e);return SA("header",null!==(t=kA(e))&&void 0!==t?t:"","#"+o,(e=>OA(e)?parseInt(e.nodeName.substr(1),10):0)(e),(()=>{e.id=o}))},DA=e=>{const t=e.id||e.name,o=kA(e);return SA("anchor",o||"#"+t,"#"+t,0,b)},AA=e=>{const t=(o="h1,h2,h3,h4,h5,h6,a:not([href])",n=e,L(Od(Re.fromDom(n),o),(e=>e.dom)));var o,n;return t},MA=e=>vA(e.title).length>0,BA=e=>{const t=AA(e);return U((e=>L(U(e,TA),EA))(t).concat((e=>L(U(e,CA),DA))(t)),MA)},IA="tinymce-url-history",FA=e=>s(e)&&/^https?/.test(e),RA=e=>a(e)&&he(e,(e=>{return!(l(t=e)&&t.length<=5&&X(t,FA));var t})).isNone(),NA=()=>{const e=CS.getItem(IA);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+IA+" was not valid JSON",e),{};throw e}return RA(t)?t:(console.log("Local storage "+IA+" was not valid format",t),{})},VA=e=>{const t=NA();return be(t,e).getOr([])},zA=(e,t)=>{if(!FA(e))return;const o=NA(),n=be(o,t).getOr([]),r=U(n,(t=>t!==e));o[t]=[e].concat(r).slice(0,5),(e=>{if(!RA(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));CS.setItem(IA,JSON.stringify(e))})(o)},LA=e=>!!e,HA=e=>ce(gT.makeMap(e,/[, ]/),LA),PA=e=>D.from(_v(e)),UA=(e,t)=>{const o=(e=>{const t=D.from(Dv(e)).filter(LA).map(HA);return PA(e).fold(T,(e=>t.fold(E,(e=>ae(e).length>0&&e))))})(e);return d(o)?o?PA(e):D.none():o[t]?PA(e):D.none()},WA=e=>D.from(e).filter(s).getOrUndefined(),jA=e=>({getHistory:VA,addToHistory:zA,getLinkInformation:()=>(e=>Av(e)?D.some({targets:BA(e.getBody()),anchorTop:WA(Mv(e)),anchorBottom:WA(Bv(e))}):D.none())(e),getValidationHandler:()=>(e=>D.from(Tv(e)))(e),getUrlPicker:t=>((e,t)=>UA(e,t).map((o=>n=>Ek((r=>{const i={filetype:t,fieldname:n.fieldname,...D.from(n.meta).getOr({})};o.call(e,((e,t)=>{if(!s(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");r({value:e,meta:t})}),n.value,i)})))))(e,t)}),$A=(e,t,o,n)=>{const r=Nr(!1),s=(e=>{const t=Nr(Jv(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:Lb.translate,isDisabled:()=>t.mode.isReadOnly()||!t.ui.isEnabled(),getOption:t.options.get},i=jA(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},n=Nr([]),r=Nr([]),s=Nr(!1);return e.on("PreInit",(r=>{const s=hA(e),a=bA(e,s,t,o);n.set(a)})),e.on("addStyleModifications",(n=>{const a=bA(e,n.items,t,o);r.set(a),s.set(n.replace)})),{getData:()=>{const e=s.get()?[]:n.get(),t=r.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:aA(e),hasCustomColors:iA(e),getColors:lA(e),getColorCols:cA(e)}))(t),d=(e=>({isDraggableModal:dA(e)}))(t),u={shared:{providers:a,anchors:sA(t,o,n,s.isPositionedAtTop),header:s},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>r.get(),setContextMenuState:e=>r.set(e)},m={...u,shared:{...u.shared,interpreter:e=>ID(e,{},m),getSink:e.popup}},g={...u,shared:{...u.shared,interpreter:e=>ID(e,{},g),getSink:e.dialog}};return{popup:m,dialog:g}},GA=Xm,qA=Bm,YA=x([Tr("shell",!1),dr("makeItem"),Tr("setupItem",b),tm("listBehaviours",[Nh])]),XA=Dm({name:"items",overrides:()=>({behaviours:ql([Nh.config({})])})}),KA=x([XA]),JA=og({name:x("CustomList")(),configFields:YA(),partFields:KA(),factory:(e,t,o,n)=>{const r=e.shell?{behaviours:[Nh.config({})],components:[]}:{behaviours:[],components:t},s=t=>e.shell?D.some(t):Pm(t,e,"items");return{uid:e.uid,dom:e.dom,components:r.components,behaviours:em(e.listBehaviours,r.behaviours),apis:{setItems:(t,o)=>{s(t).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 r=Nh.contents(n),s=o.length,a=s-r.length,i=a>0?V(a,(()=>e.makeItem())):[],l=r.slice(s);H(l,(e=>Nh.remove(n,e))),H(i,(e=>Nh.append(n,e)));const c=Nh.contents(n);H(c,((n,r)=>{e.setupItem(t,n,o[r],r)}))}))}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),ZA=x([dr("dom"),Tr("shell",!0),Zu("toolbarBehaviours",[Nh])]),QA=x([Dm({name:"groups",overrides:()=>({behaviours:ql([Nh.config({})])})})]),eM=og({name:"Toolbar",configFields:ZA(),partFields:QA(),factory:(e,t,o,n)=>{const r=t=>e.shell?D.some(t):Pm(t,e,"groups"),s=e.shell?{behaviours:[Nh.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:em(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(e,t)=>{r(e).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=>{Nh.set(e,t)}))},refresh:b},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),tM=b,oM=T,nM=x([]);var rM=Object.freeze({__proto__:null,setup:tM,isDocked:oM,getBehaviours:nM});const sM=e=>(xe(Nt(e,"position"),"fixed")?D.none():st(e)).orThunk((()=>{const t=Re.fromTag("span");return nt(e).bind((e=>{No(e,t);const o=st(t);return Lo(t),o}))})),aM=e=>sM(e).map(Yt).getOrThunk((()=>Gt(0,0))),iM=(e,t)=>{const o=e.element;ti(o,t.transitionClass),ni(o,t.fadeOutClass),ti(o,t.fadeInClass),t.onShow(e)},lM=(e,t)=>{const o=e.element;ti(o,t.transitionClass),ni(o,t.fadeInClass),ti(o,t.fadeOutClass),t.onHide(e)},cM=(e,t)=>e.y>=t.y,dM=(e,t)=>e.bottom<=t.bottom,uM=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),mM=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),gM=e=>e.box.x-e.win.x,pM=(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 Gt(e.bounds.x,o)})(o,t);return{box:Yo(n.left,n.top,Jt(e),Wt(e)),location:o.location}})),hM=(e,t,o,n,r)=>{const s=((e,t)=>{const o=t.optScrollEnv.fold(x(e.y),(t=>e.y+t.currentScrollTop-t.scrollElmTop));return Gt(e.x,o)})(t,o),a=Yo(s.left,s.top,t.width,t.height);n.setInitialPos({style:Vt(e),position:Ft(e,"position")||"static",bounds:a,location:r.location})},fM=(e,t,o)=>o.getInitialPos().bind((n=>{var r;switch(o.clearInitialPos(),n.position){case"static":return D.some({morph:"static"});case"absolute":const o=sM(e).getOr(xt()),s=Xo(o),a=null!==(r=o.dom.scrollTop)&&void 0!==r?r:0;return D.some({morph:"absolute",positionCss:ic("absolute",be(n.style,"left").map((e=>t.x-s.x)),be(n.style,"top").map((e=>t.y-s.y+a)),be(n.style,"right").map((e=>s.right-t.right)),be(n.style,"bottom").map((e=>s.bottom-t.bottom)))});default:return D.none()}})),bM=(e,t,o)=>pM(e,t,o).filter((({box:e})=>((e,t,o)=>X(e,(e=>{switch(e){case"bottom":return dM(t,o.bounds);case"top":return cM(t,o.bounds)}})))(o.getModes(),e,t))).bind((({box:t})=>fM(e,t,o))),vM=e=>{switch(e.location){case"top":return D.some({morph:"fixed",positionCss:ic("fixed",D.some(e.leftX),D.some(e.topY),D.none(),D.none())});case"bottom":return D.some({morph:"fixed",positionCss:ic("fixed",D.some(e.leftX),D.none(),D.none(),D.some(e.bottomY))});default:return D.none()}},yM=(e,t,o)=>{const n=Xo(e),r=Zo(),s=((e,t,o)=>{const n=t.win,r=t.box,s=gM(t);return se(e,(e=>{switch(e){case"bottom":return dM(r,o.bounds)?D.none():D.some(mM(n,s,o));case"top":return cM(r,o.bounds)?D.none():D.some(uM(n,s,o));default:return D.none()}})).getOr({location:"no-dock"})})(o.getModes(),{win:r,box:n},t);return"top"===s.location||"bottom"===s.location?(hM(e,n,t,o,s),vM(s)):D.none()},xM=(e,t,o)=>{const n=e.element;return xe(Nt(n,"position"),"fixed")?((e,t,o)=>bM(e,t,o).orThunk((()=>t.optScrollEnv.bind((n=>pM(e,t,o))).bind((({box:e,location:o})=>{const n=Zo(),r=gM({win:n,box:e}),s="top"===o?uM(n,r,t):mM(n,r,t);return vM(s)})))))(n,t,o):yM(n,t,o)},wM=(e,t,o,n)=>{const r=Xo(e),s=Zo(),a=n(s,gM({win:s,box:r}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,r)=>{n.getInitialPos().fold((()=>hM(e,t,o,n,r)),(()=>b))})(e,r,t,o,a),vM(a)):D.none()},SM=(e,t,o)=>{o.setDocked(!1),H(["left","right","top","bottom","position"],(t=>Lt(e.element,t))),t.onUndocked(e)},kM=(e,t,o,n)=>{const r="fixed"===n.position;o.setDocked(r),lc(e.element,n);(r?t.onDocked:t.onUndocked)(e)},CM=(e,t,o,n,r=!1)=>{t.contextual.each((t=>{t.lazyContext(e).each((s=>{const a=((e,t)=>e.y<t.bottom&&e.bottom>t.y)(s,n.bounds);if(a!==o.isVisible())if(o.setVisible(a),r&&!a)ai(e.element,[t.fadeOutClass]),t.onHide(e);else{(a?iM:lM)(e,t)}}))}))},OM=(e,t,o,n,r)=>{CM(e,t,o,n,!0),kM(e,t,o,r.positionCss)},_M=(e,t,o)=>{const n=t.lazyViewport(e);CM(e,t,o,n),xM(e,n,o).each((r=>{((e,t,o,n,r)=>{switch(r.morph){case"static":return SM(e,t,o);case"absolute":return kM(e,t,o,r.positionCss);case"fixed":OM(e,t,o,n,r)}})(e,t,o,n,r)}))},TM=(e,t,o)=>{const n=e.element;o.setDocked(!1);const r=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return pM(n,t,o).bind((({box:e})=>fM(n,e,o)))})(e,r,o).each((n=>{switch(n.morph){case"static":SM(e,t,o);break;case"absolute":kM(e,t,o,n.positionCss)}})),o.setVisible(!0),t.contextual.each((t=>{ii(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)})),EM(e,t,o)},EM=(e,t,o)=>{e.getSystem().isConnected()&&_M(e,t,o)},DM=(e,t,o)=>{o.isDocked()&&TM(e,t,o)},AM=e=>(t,o,n)=>{const r=o.lazyViewport(t);wM(t.element,r,n,e).each((e=>{OM(t,o,n,r,e)}))},MM=AM(uM),BM=AM(mM);var IM=Object.freeze({__proto__:null,refresh:EM,reset:DM,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:MM,forceDockToBottom:BM});var FM=Object.freeze({__proto__:null,events:(e,t)=>Ks([aa(gs(),((o,n)=>{e.contextual.each((e=>{if(si(o.element,e.transitionClass)){ii(o.element,[e.transitionClass,e.fadeInClass]);(t.isVisible()?e.onShown:e.onHidden)(o)}n.stop()}))})),Qs(Ms(),((o,n)=>{EM(o,e,t)})),Qs(Ls(),((o,n)=>{EM(o,e,t)})),Qs(Bs(),((o,n)=>{DM(o,e,t)}))])}),RM=[_r("contextual",[gr("fadeInClass"),gr("fadeOutClass"),gr("transitionClass"),hr("lazyContext"),el("onShow"),el("onShown"),el("onHide"),el("onHidden")]),Ir("lazyViewport",(()=>({bounds:Zo(),optScrollEnv:D.none()}))),Fr("modes",["top","bottom"],Gn),el("onDocked"),el("onUndocked")];const NM=Xl({fields:RM,name:"docking",active:FM,apis:IM,state:Object.freeze({__proto__:null,init:e=>{const t=Nr(!1),o=Nr(!0),n=Cc(),r=Nr(e.modes);return Va({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:r.get,setModes:r.set,readState:()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${r.get().join(",")}`})}})}),VM=x(ya("toolbar-height-change")),zM={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},LM="tox-tinymce--toolbar-sticky-on",HM="tox-tinymce--toolbar-sticky-off",PM=(e,t)=>R(NM.getModes(e),t),UM=e=>{const t=e.element;rt(t).each((o=>{const n="padding-"+NM.getModes(e)[0];if(NM.isDocked(e)){const e=Jt(o);Mt(t,"width",e+"px"),Mt(o,n,(e=>jt(e)+(parseInt(Ft(e,"margin-top"),10)||0)+(parseInt(Ft(e,"margin-bottom"),10)||0))(t)+"px")}else Lt(t,"width"),Lt(o,n)}))},WM=(e,t)=>{t?(ni(e,zM.fadeOutClass),ai(e,[zM.transitionClass,zM.fadeInClass])):(ni(e,zM.fadeInClass),ai(e,[zM.fadeOutClass,zM.transitionClass]))},jM=(e,t)=>{const o=Re.fromDom(e.getContainer());t?(ti(o,LM),ni(o,HM)):(ti(o,HM),ni(o,LM))},$M=(e,t)=>{const o=Cc(),n=t.getSink,r=e=>{n().each((t=>e(t.element)))},s=t=>{e.inline||UM(t),jM(e,NM.isDocked(t)),t.getSystem().broadcastOn([Iu()],{}),n().each((e=>e.getSystem().broadcastOn([Iu()],{})))},a=e.inline?[]:[Ql.config({channels:{[VM()]:{onReceive:UM}}})];return[Uh.config({}),NM.config({contextual:{lazyContext:t=>{const o=jt(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return D.from(n).map((n=>{const r=Xo(Re.fromDom(n));return sC(e,t.element).fold((()=>{const e=r.height-o,n=r.y+(PM(t,"top")?0:o);return Yo(r.x,n,r.width,e)}),(e=>{const n=Jo(r,aC(e)),s=PM(t,"top")?n.y:n.y+o;return Yo(n.x,s,n.width,n.height-o)}))}))},onShow:()=>{r((e=>WM(e,!0)))},onShown:e=>{r((e=>ii(e,[zM.transitionClass,zM.fadeInClass]))),o.get().each((t=>{((e,t)=>{const o=Qe(t);rc(o).filter((e=>!Je(t,e))).filter((t=>Je(t,Re.fromDom(o.dom.body))||Ze(e,t))).each((()=>tc(t)))})(e.element,t),o.clear()}))},onHide:e=>{((e,t)=>sc(e).orThunk((()=>t().toOptional().bind((e=>sc(e.element))))))(e.element,n).fold(o.clear,o.set),r((e=>WM(e,!1)))},onHidden:()=>{r((e=>ii(e,[zM.transitionClass])))},...zM},lazyViewport:t=>sC(e,t.element).fold((()=>{const o=Zo(),n=kv(e),r=o.y+(PM(t,"top")?n:0),s=o.height-(PM(t,"bottom")?n:0);return{bounds:Yo(o.x,r,o.width,s),optScrollEnv:D.none()}}),(e=>({bounds:aC(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Yt(e.element).top})}))),modes:[t.header.getDockingMode()],onDocked:s,onUndocked:s}),...a]};var GM=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",(()=>{o().each(NM.reset)})),e.on("ResizeWindow ResizeEditor",(()=>{o().each(UM)})),e.on("SkinLoaded",(()=>{o().each((e=>{NM.isDocked(e)?NM.reset(e):NM.refresh(e)}))})),e.on("FullscreenStateChanged",(()=>{o().each(NM.reset)}))),e.on("AfterScrollIntoView",(e=>{o().each((t=>{NM.refresh(t);const o=t.element;xp(o)&&((e,t)=>{const o=Qe(t),n=ot(t).dom.innerHeight,r=Ho(o),s=Re.fromDom(e.elm),a=Ko(s),i=Wt(s),l=a.y,c=l+i,d=Yt(t),u=Wt(t),m=d.top,g=m+u,p=Math.abs(m-r.top)<2,h=Math.abs(g-(r.top+n))<2;if(p&&l<g)Po(r.left,l-u,o);else if(h&&c>m){const e=l-n+i+u;Po(r.left,e,o)}})(e,o)}))})),e.on("PostRender",(()=>{jM(e,!1)}))},isDocked:e=>e().map(NM.isDocked).getOr(!1),getBehaviours:$M});const qM=zn([Jy,ur("items",Hn([Un([Zy,vr("items",Gn)]),Gn]))].concat(Tx)),YM=[Sr("text"),Sr("tooltip"),Sr("icon"),Er("search",!1,Hn([qn,zn([Sr("placeholder")])],(e=>d(e)?e?D.some({placeholder:D.none()}):D.none():D.some(e)))),hr("fetch"),Ir("onSetup",(()=>b))],XM=zn([Jy,...YM]),KM=e=>tr("menubutton",XM,e),JM=zn([Jy,mx,ux,dx,hx,rx,lx,Mr("presets","normal",["normal","color","listpreview"]),xx(1),ax,ix]);var ZM=tg({factory:(e,t)=>{const o={focus:Th.focusIn,setMenus:(e,o)=>{const n=L(o,(e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())}},n=KM(o).mapError((e=>rr(e))).getOrDie();return IE(n,"tox-mbtn",t.backstage,D.some("menuitem"))}));Nh.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:ql([Nh.config({}),Vh("menubar-events",[ia((t=>{e.onSetup(t)})),Qs(rs(),((e,t)=>{Fi(e.element,".tox-mbtn--active").each((o=>{Ri(t.event.target,".tox-mbtn").each((t=>{Je(o,t)||e.getSystem().getByDom(o).each((o=>{e.getSystem().getByDom(t).each((e=>{jk.expand(e),jk.close(o),Uh.focus(e)}))}))}))}))})),Qs(Vs(),((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=>{jk.isOpen(o)&&(jk.expand(e),jk.close(o))}))}))}))]),Th.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),D.some(!0))}),TC.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[dr("dom"),dr("uid"),dr("onEscape"),dr("backstage"),Tr("onSetup",b)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const QM="container",eB=[Zu("slotBehaviours",[])],tB=e=>"<alloy.field."+e+">",oB=(e,t)=>{const o=t=>$m(e),n=(t,o)=>(n,r)=>Pm(n,e,r).map((e=>t(e,r))).getOr(o),r=(e,t)=>"true"!==Ot(e.element,"aria-hidden"),s=n(r,!1),a=n(((e,t)=>{if(r(e)){const o=e.element;Mt(o,"display","none"),kt(o,"aria-hidden","true"),$s(e,zs(),{name:t,visible:!1})}})),i=(e=>(t,o)=>{H(o,(o=>e(t,o)))})(a),l=n(((e,t)=>{if(!r(e)){const o=e.element;Lt(o,"display"),Et(o,"aria-hidden"),$s(e,zs(),{name:t,visible:!0})}})),c={getSlotNames:o,getSlot:(t,o)=>Pm(t,e,o),isShowing:s,hideSlot:a,hideAllSlots:e=>i(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:Qu(e.slotBehaviours),apis:c}},nB=ce({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=>Ra(e))),rB={...nB,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),Nm(QM,tB(t),o)),record:x(e)}})(),o=e(t),n=t.record(),r=L(n,(e=>Tm({name:e,pname:tB(e)})));return Jm(QM,eB,r,oB,o)}},sB=zn([ux,mx,Ir("onShow",b),Ir("onHide",b),lx]),aB=e=>({element:()=>e.element.dom}),iB=(e,t)=>{const o=L(ae(t),(e=>{const o=t[e],n=or((e=>tr("sidebar",sB,e))(o));return{name:e,getApi:aB,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}}));return L(o,(t=>{const n=Nr(b);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:aw([Tw(t,n),Ew(t,n),Qs(zs(),((e,t)=>{const n=t.event,r=$(o,(e=>e.name===n.name));r.each((t=>{(n.visible?t.onShow:t.onHide)(t.getApi(e))}))}))])})}))},lB=e=>rB.sketch((t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:iB(t,e),slotBehaviours:aw([ia((e=>rB.hideAllSlots(e)))])}))),cB=(e,t)=>{kt(e,"role",t)},dB=e=>ag.getCurrent(e).bind((e=>{if(ME.isGrowing(e)||ME.hasGrown(e)){return ag.getCurrent(e).bind((e=>$(rB.getSlotNames(e),(t=>rB.isShowing(e,t)))))}return D.none()})),uB=ya("FixSizeEvent"),mB=ya("AutoSizeEvent");var gB=Object.freeze({__proto__:null,block:(e,t,o,n)=>{kt(e.element,"aria-busy",!0);const r=t.getRoot(e).getOr(e),s=ql([Th.config({mode:"special",onTab:()=>D.some(!0),onShiftTab:()=>D.some(!0)}),Uh.config({})]),a=n(r,s),i=r.getSystem().build(a);Nh.append(r,Ti(i)),i.hasConfigured(Th)&&t.focus&&Th.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith((()=>Nh.remove(r,i)))},unblock:(e,t,o)=>{Et(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},isBlocked:(e,t,o)=>o.isBlocked()}),pB=[Ir("getRoot",D.none),Br("focus",!0),el("onBlock"),el("onUnblock")];const hB=Xl({fields:pB,name:"blocking",apis:gB,state:Object.freeze({__proto__:null,init:()=>{const e=Sc((e=>e.destroy()));return Va({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})}),fB=e=>ag.getCurrent(e).each((e=>tc(e.element,!0))),bB=(e,t,o,n)=>{const r=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;D.from(e.iframeElement).map(Re.fromDom).each((e=>{t?(_t(e,o).each((t=>kt(e,n,t))),kt(e,o,-1)):(Et(e,o),_t(e,n).each((t=>{kt(e,o,t),Et(e,n)})))}))})(e,o),o)hB.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:If('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}))(n)),Lt(r,"display"),Et(r,"aria-hidden"),e.hasFocus()&&fB(t);else{const o=ag.getCurrent(t).exists((e=>nc(e.element)));hB.unblock(t),Mt(r,"display","none"),kt(r,"aria-hidden","true"),o&&e.focus()}},vB=(e,t,o)=>{const n=Nr(!1),r=Cc(),s=o=>{n.get()&&!(e=>{if((e=>"focusin"===e.type)(e))return(e.composed?oe(e.composedPath()):D.from(e.target)).map(Re.fromDom).filter(je).exists((e=>si(e,"mce-pastebin")));return!1})(o)&&(o.preventDefault(),fB(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",(()=>{e.dom.bind(e.getWin(),"focusin",s),e.on("BeforeExecCommand",(e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&s(e)}))}));const a=r=>{r!==n.get()&&(n.set(r),bB(e,t(),r,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,r))};e.on("ProgressState",(t=>{if(r.on(clearTimeout),h(t.time)){const o=Mf.setEditorTimeout(e,(()=>a(t.state)),t.time);r.set(o)}else a(t.state),r.clear()}))},yB=(e,t,o)=>({within:e,extra:t,withinWidth:o}),xB=(e,t,o)=>{const n=((e,t)=>{const o=j(e,((e,o)=>t(o,e.len).fold(x(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:0,list:[]});return o.list})(e,((e,t)=>{const n=o(e);return D.some({element:e,start:t,finish:t+n,width:n})})),r=U(n,(e=>e.finish<=t)),s=W(r,((e,t)=>e+t.width),0);return{within:r,extra:n.slice(r.length),withinWidth:s}},wB=e=>L(e,(e=>e.element)),SB=(e,t,o,n)=>{const r=((e,t,o)=>{const n=xB(t,e,o);return 0===n.extra.length?D.some(n):D.none()})(e,t,o).getOrThunk((()=>xB(t,e-o(n),o))),s=r.within,a=r.extra,i=r.withinWidth;return 1===a.length&&a[0].width<=o(n)?((e,t,o)=>{const n=wB(e.concat(t));return yB(n,[],o)})(s,a,i):a.length>=1?((e,t,o,n)=>{const r=wB(e).concat([o]);return yB(r,wB(t),n)})(s,a,n,i):((e,t,o)=>yB(wB(e),[],o))(s,0,i)},kB=(e,t)=>{const o=L(t,(e=>Ti(e)));eM.setGroups(e,o)},CB=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const r=Um(e,t,"primary"),s=kk.getCoupled(e,"overflowGroup");Mt(r.element,"visibility","hidden");const a=n.concat([s]),i=se(a,(e=>sc(e.element).bind((t=>e.getSystem().getByDom(t).toOptional()))));o([]),kB(r,a);const l=Jt(r.element),c=SB(l,t.builtGroups.get(),(e=>Jt(e.element)),s);0===c.extra.length?(Nh.remove(r,s),o([])):(kB(r,c.within),o(c.extra)),Lt(r.element,"visibility"),Ht(r.element),i.each(Uh.focus)},OB=x([Zu("splitToolbarBehaviours",[kk]),lr("builtGroups",(()=>Nr([])))]),_B=x([Zi(["overflowToggledClass"]),Cr("getOverflowBounds"),dr("lazySink"),lr("overflowGroups",(()=>Nr([]))),el("onOpened"),el("onClosed")].concat(OB())),TB=x([Tm({factory:eM,schema:ZA(),name:"primary"}),Em({schema:ZA(),name:"overflow"}),Em({name:"overflow-button"}),Em({name:"overflow-group"})]),EB=x(((e,t)=>{((e,t)=>{const o=Kt.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);Mt(e,"max-width",o+"px")})(e,Math.floor(t))})),DB=x([Zi(["toggledClass"]),dr("lazySink"),hr("fetch"),Cr("getBounds"),_r("fireDismissalEventInstead",[Tr("event",Rs())]),Jc(),el("onToggled")]),AB=x([Em({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:ql([Kh.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Em({factory:eM,schema:ZA(),name:"toolbar",overrides:e=>({toolbarBehaviours:ql([Th.config({mode:"cyclic",onEscape:t=>(Pm(t,e,"button").each(Uh.focus),D.none())})])})})]),MB=Cc(),BB=(e,t)=>{const o=kk.getCoupled(e,"toolbarSandbox");Mu.isOpen(o)?Mu.close(o):Mu.open(o,t.toolbar())},IB=(e,t,o,n)=>{const r=o.getBounds.map((e=>e())),s=o.lazySink(e).getOrDie();ru.positionWithinBounds(s,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:EB()}}},r)},FB=(e,t,o,n,r)=>{eM.setGroups(t,r),IB(e,t,o,n),Kh.on(e)},RB=og({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Bf.sketch({...n.button(),action:e=>{BB(e,n)},buttonBehaviours:om({dump:n.button().buttonBehaviours},[kk.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Vi();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:ql([Th.config({mode:"special",onEscape:e=>(Mu.close(e),D.some(!0))}),Mu.config({onOpen:(r,s)=>{const a=MB.get().getOr(!1);o.fetch().get((r=>{FB(e,s,o,t.layouts,r),n.link(e.element),a||Th.focusIn(s)}))},onClose:()=>{Kh.off(e),MB.get().getOr(!1)||Uh.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>Li(o,n)||Li(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),Ql.config({channels:{...Nu({isExtraPart:T,...o.fireDismissalEventInstead.map((e=>({fireEventInstead:{event:e.event}}))).getOr({})}),...zu({doReposition:()=>{Mu.getState(kk.getCoupled(e,"toolbarSandbox")).each((n=>{IB(e,n,o,t.layouts)}))}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{Mu.getState(kk.getCoupled(t,"toolbarSandbox")).each((r=>{FB(t,r,e,o.layouts,n)}))},reposition:t=>{Mu.getState(kk.getCoupled(t,"toolbarSandbox")).each((n=>{IB(t,n,e,o.layouts)}))},toggle:e=>{BB(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{MB.set(!0),BB(e,t),MB.clear()})(e,n)},getToolbar:e=>Mu.getState(kk.getCoupled(e,"toolbarSandbox")),isOpen:e=>Mu.isOpen(kk.getCoupled(e,"toolbarSandbox"))}}),configFields:DB(),partFields:AB(),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)}}),NB=x([dr("items"),Zi(["itemSelector"]),Zu("tgroupBehaviours",[Th])]),VB=x([Am({name:"items",unit:"item"})]),zB=og({name:"ToolbarGroup",configFields:NB(),partFields:VB(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:em(e.tgroupBehaviours,[Th.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),LB=e=>L(e,(e=>Ti(e))),HB=(e,t,o)=>{CB(e,o,(n=>{o.overflowGroups.set(n),t.getOpt(e).each((e=>{RB.setGroups(e,LB(n))}))}))},PB=og({name:"SplitFloatingToolbar",configFields:_B(),partFields:TB(),factory:(e,t,o,n)=>{const r=Ff(RB.sketch({fetch:()=>Ek((t=>{t(LB(e.overflowGroups.get()))})),layouts:{onLtr:()=>[El,Tl],onRtl:()=>[Tl,El],onBottomLtr:()=>[Al,Dl],onBottomRtl:()=>[Dl,Al]},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:em(e.splitToolbarBehaviours,[kk.config({others:{overflowGroup:()=>zB.sketch({...n["overflow-group"](),items:[r.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(L(o,t.getSystem().build)),HB(t,r,e)},refresh:t=>HB(t,r,e),toggle:e=>{r.getOpt(e).each((e=>{RB.toggle(e)}))},toggleWithoutFocusing:e=>{r.getOpt(e).each(RB.toggleWithoutFocusing)},isOpen:e=>r.getOpt(e).map(RB.isOpen).getOr(!1),reposition:e=>{r.getOpt(e).each((e=>{RB.reposition(e)}))},getOverflow:e=>r.getOpt(e).bind(RB.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)}}),UB=x([Zi(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),el("onOpened"),el("onClosed")].concat(OB())),WB=x([Tm({factory:eM,schema:ZA(),name:"primary"}),Tm({factory:eM,schema:ZA(),name:"overflow",overrides:e=>({toolbarBehaviours:ql([ME.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{Pm(t,e,"overflow-button").each((e=>{Kh.off(e),Uh.focus(e)})),e.onClosed(t)},onGrown:t=>{Th.focusIn(t),e.onOpened(t)},onStartGrow:t=>{Pm(t,e,"overflow-button").each(Kh.on)}}),Th.config({mode:"acyclic",onEscape:t=>(Pm(t,e,"overflow-button").each(Uh.focus),D.some(!0))})])})}),Em({name:"overflow-button",overrides:e=>({buttonBehaviours:ql([Kh.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])})}),Em({name:"overflow-group"})]),jB=(e,t)=>{Pm(e,t,"overflow-button").bind((()=>Pm(e,t,"overflow"))).each((o=>{$B(e,t),ME.toggleGrow(o)}))},$B=(e,t)=>{Pm(e,t,"overflow").each((o=>{CB(e,t,(e=>{const t=L(e,(e=>Ti(e)));eM.setGroups(o,t)})),Pm(e,t,"overflow-button").each((e=>{ME.hasGrown(o)&&Kh.on(e)})),ME.refresh(o)}))},GB=og({name:"SplitSlidingToolbar",configFields:UB(),partFields:WB(),factory:(e,t,o,n)=>{const r="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:em(e.splitToolbarBehaviours,[kk.config({others:{overflowGroup:e=>zB.sketch({...n["overflow-group"](),items:[Bf.sketch({...n["overflow-button"](),action:t=>{js(e,r)}})]})}}),Vh("toolbar-toggle-events",[Qs(r,(t=>{jB(t,e)}))])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=L(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),$B(t,e)},refresh:t=>$B(t,e),toggle:t=>jB(t,e),isOpen:t=>((e,t)=>Pm(e,t,"overflow").map(ME.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)}}),qB=e=>{const t=e.title.fold((()=>({})),(e=>({attributes:{title:e}})));return{dom:{tag:"div",classes:["tox-toolbar__group"],...t},components:[zB.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:ql([TC.config({}),Uh.config({})])}},YB=e=>zB.sketch(qB(e)),XB=(e,t)=>{const o=ia((t=>{const o=L(e.initGroups,YB);eM.setGroups(t,o)}));return ql([Ow(e.providers.isDisabled),ww(),Th.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),Vh("toolbar-events",[o])])},KB=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":qB({title:D.none(),items:[]}),"overflow-button":lD({name:"more",icon:D.some("more-drawer"),enabled:!0,tooltip:D.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:D.none(),borderless:!1},D.none(),e.providers)},splitToolbarBehaviours:XB(e,t)}},JB=e=>{const t=KB(e),o=PB.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return PB.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=Ko(t),n=tt(t),r=Ko(n),s=Math.max(n.dom.scrollHeight,r.height);return Yo(o.x+4,r.y,o.width-8,s)},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)})},ZB=e=>{const t=GB.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=GB.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=KB(e);return GB.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([VM()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([VM()],{type:"closed"}),e.onToggled(t,!1)}})},QB=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return eM.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===Jb.scrolling?["tox-toolbar--scrolling"]:[])},components:[eM.parts.groups({})],toolbarBehaviours:XB(e,t)})},eI=[dx,ux,Sr("tooltip"),Mr("buttonType","secondary",["primary","secondary"]),Br("borderless",!1),hr("onAction")],tI={button:[...eI,ex,pr("type",["button"])],togglebutton:[...eI,Br("active",!1),pr("type",["togglebutton"])]},oI=[pr("type",["group"]),Fr("buttons",[],sr("type",tI))],nI=sr("type",{...tI,group:oI}),rI=zn([Fr("buttons",[],nI),hr("onShow"),hr("onHide")]),sI=(e,t)=>((e,t)=>{var o,n;const r="togglebutton"===e.type,s=e.icon.map((e=>GT(e,t.icons))).map(Ff),a=o=>{const n=e=>{s.map((n=>n.getOpt(o).each((o=>{Nh.set(o,[GT(e,t.icons)])}))))},a=e=>{const t=o.element;e?(ti(t,"tox-button--enabled"),kt(t,"aria-pressed",!0)):(ni(t,"tox-button--enabled"),Et(t,"aria-pressed"))},i=()=>si(o.element,"tox-button--enabled");return r?e.onAction({setIcon:n,setActive:a,isActive:i}):"button"===e.type?e.onAction({setIcon:n}):void 0},i={...e,name:r?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:D.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},l=cD(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),c=r?e.text.map(t.translate):D.some(t.translate(e.text)),d=c.map(Si),u=i.tooltip.or(c).map((e=>({"aria-label":t.translate(e),title:t.translate(e)}))).getOr({}),m=s.map((e=>e.asSpec())),g=Mw([m,d]),p=e.icon.isSome()&&d.isSome(),h={tag:"button",classes:l.concat(...e.icon.isSome()&&!p?["tox-button--icon"]:[]).concat(...p?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:u},f=iD(i,D.some(a),[],h,g,t);return Bf.sketch(f)})(e,t),aI=Do().deviceType,iI=aI.isPhone(),lI=aI.isTablet();var cI=og({name:"silver.View",configFields:[dr("viewConfig")],partFields:[Dm({factory:{sketch:e=>{let t=!1;const o=L(e.buttons,(o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:L(e.buttons,(e=>sI(e,t)))}))(o,e.providers)):sI(o,e.providers)));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...iI||lI?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:ql([Uh.config({}),Th.config({mode:"flow",selector:"button, .tox-button",focusInside:ep.OnEnterOrSpaceMode})]),components:t?o:[xC.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),xC.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[dr("buttons"),dr("providers")],name:"header"}),Dm({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const r={getPane:t=>GA.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,apis:r}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const dI=(e,t,o)=>pe(t,((t,n)=>{const r=or(tr("view",rI,t));return e.slot(n,cI.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:r,components:[...r.buttons.length>0?[cI.parts.header({buttons:r.buttons,providers:o})]:[],cI.parts.pane({})]}))})),uI=(e,t)=>rB.sketch((o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:dI(o,e,t),slotBehaviours:aw([ia((e=>rB.hideAllSlots(e)))])}))),mI=e=>$(rB.getSlotNames(e),(t=>rB.isShowing(e,t))),gI=(e,t,o)=>{rB.getSlot(e,t).each((e=>{cI.getPane(e).each((t=>{var n;o(e)((n=t.element.dom,{getContainer:x(n)}))}))}))};var pI=tg({factory:(e,t)=>{const o={setViews:(e,o)=>{Nh.set(e,[uI(o,t.backstage.shared.providers)])},whichView:e=>ag.getCurrent(e).bind(mI),toggleView:(e,t,o,n)=>ag.getCurrent(e).exists((r=>{const s=mI(r),a=s.exists((e=>n===e)),i=rB.getSlot(r,n).isSome();return i&&(rB.hideAllSlots(r),a?((e=>{const t=e.element;Mt(t,"display","none"),kt(t,"aria-hidden","true")})(e),t()):(o(),(e=>{const t=e.element;Lt(t,"display"),Et(t,"aria-hidden")})(e),rB.showSlot(r,n),((e,t)=>{gI(e,t,cI.getOnShow)})(r,n)),s.each((e=>((e,t)=>gI(e,t,cI.getOnHide))(r,e)))),i}))};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:ql([Nh.config({}),ag.config({find:e=>{const t=Nh.contents(e);return oe(t)}})]),apis:o}},name:"silver.ViewWrapper",configFields:[dr("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,r)=>e.toggleView(t,o,n,r),whichView:(e,t)=>e.whichView(t)}});const hI=qA.optional({factory:ZM,name:"menubar",schema:[dr("backstage")]}),fI=qA.optional({factory:{sketch:e=>JA.sketch({uid:e.uid,dom:e.dom,listBehaviours:ql([Th.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>QB({type:e.type,uid:ya("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),D.some(!0))}),setupItem:(e,t,o,n)=>{eM.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[dr("dom"),dr("onEscape")]}),bI=qA.optional({factory:{sketch:e=>{const t=(e=>e.type===Jb.sliding?ZB:e.type===Jb.floating?JB:QB)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),D.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:[dr("dom"),dr("onEscape"),dr("getSink")]}),vI=qA.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?$M:nM;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:ql(o(t,e.sharedBackstage))}}},name:"header",schema:[dr("dom")]}),yI=qA.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:"⚡️Upgrade"}}]})},name:"promotion",schema:[dr("dom")]}),xI=qA.optional({name:"socket",schema:[dr("dom")]}),wI=qA.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:ql([TC.config({}),Uh.config({}),ME.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=>{ag.getCurrent(e).each(rB.hideAllSlots),js(e,mB)},onGrown:e=>{js(e,mB)},onStartGrow:e=>{$s(e,uB,{width:Nt(e.element,"width").getOr("")})},onStartShrink:e=>{$s(e,uB,{width:Jt(e.element)+"px"})}}),Nh.config({}),ag.config({find:e=>{const t=Nh.contents(e);return oe(t)}})])}],behaviours:ql([rT(0),Vh("sidebar-sliding-events",[Qs(uB,((e,t)=>{Mt(e.element,"width",t.event.width)})),Qs(mB,((e,t)=>{Lt(e.element,"width")}))])])})},name:"sidebar",schema:[dr("dom")]}),SI=qA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:ql([Nh.config({}),hB.config({focus:!1}),ag.config({find:e=>oe(e.components())})]),components:[]})},name:"throbber",schema:[dr("dom")]}),kI=qA.optional({factory:pI,name:"viewWrapper",schema:[dr("backstage")]}),CI=qA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var OI=og({name:"OuterContainer",factory:(e,t,o)=>{let n=!1;const r={getSocket:t=>GA.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{GA.getPart(t,e,"sidebar").each((e=>((e,t,o)=>{ag.getCurrent(e).each((n=>{Nh.set(n,[lB(t)]);const r=null==o?void 0:o.toLowerCase();s(r)&&ve(t,r)&&ag.getCurrent(n).each((t=>{rB.showSlot(t,r),ME.immediateGrow(n),Lt(n.element,"width"),cB(e.element,"region")}))}))})(e,o,n)))},toggleSidebar:(t,o)=>{GA.getPart(t,e,"sidebar").each((e=>((e,t)=>{ag.getCurrent(e).each((o=>{ag.getCurrent(o).each((n=>{ME.hasGrown(o)?rB.isShowing(n,t)?(ME.shrink(o),cB(e.element,"presentation")):(rB.hideAllSlots(n),rB.showSlot(n,t),cB(e.element,"region")):(rB.hideAllSlots(n),rB.showSlot(n,t),ME.grow(o),cB(e.element,"region"))}))}))})(e,o)))},whichSidebar:t=>GA.getPart(t,e,"sidebar").bind(dB).getOrNull(),getHeader:t=>GA.getPart(t,e,"header"),getToolbar:t=>GA.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{GA.getPart(t,e,"toolbar").each((e=>{const t=L(o,YB);e.getApis().setGroups(e,t)}))},setToolbars:(t,o)=>{GA.getPart(t,e,"multiple-toolbar").each((e=>{const t=L(o,(e=>L(e,YB)));JA.setItems(e,t)}))},refreshToolbar:t=>{GA.getPart(t,e,"toolbar").each((e=>e.getApis().refresh(e)))},toggleToolbarDrawer:t=>{GA.getPart(t,e,"toolbar").each((e=>{ke(e.getApis().toggle,(t=>t(e)))}))},toggleToolbarDrawerWithoutFocusing:t=>{GA.getPart(t,e,"toolbar").each((e=>{ke(e.getApis().toggleWithoutFocusing,(t=>t(e)))}))},isToolbarDrawerToggled:t=>GA.getPart(t,e,"toolbar").bind((e=>D.from(e.getApis().isOpen).map((t=>t(e))))).getOr(!1),getThrobber:t=>GA.getPart(t,e,"throbber"),focusToolbar:t=>{GA.getPart(t,e,"toolbar").orThunk((()=>GA.getPart(t,e,"multiple-toolbar"))).each((e=>{Th.focusIn(e)}))},setMenubar:(t,o)=>{GA.getPart(t,e,"menubar").each((e=>{ZM.setMenus(e,o)}))},focusMenubar:t=>{GA.getPart(t,e,"menubar").each((e=>{ZM.focus(e)}))},setViews:(t,o)=>{GA.getPart(t,e,"viewWrapper").each((e=>{pI.setViews(e,o)}))},toggleView:(t,o)=>GA.getPart(t,e,"viewWrapper").exists((e=>pI.toggleView(e,(()=>r.showMainView(t)),(()=>r.hideMainView(t)),o))),whichView:t=>GA.getPart(t,e,"viewWrapper").bind(pI.whichView).getOrNull(),hideMainView:t=>{n=r.isToolbarDrawerToggled(t),n&&r.toggleToolbarDrawer(t),GA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;Mt(t,"display","none"),kt(t,"aria-hidden","true")}))},showMainView:t=>{n&&r.toggleToolbarDrawer(t),GA.getPart(t,e,"editorContainer").each((e=>{const t=e.element;Lt(t,"display"),Et(t,"aria-hidden")}))}};return{uid:e.uid,dom:e.dom,components:t,apis:r,behaviours:e.behaviours}},configFields:[dr("dom"),dr("behaviours")],partFields:[vI,hI,bI,fI,xI,wI,yI,SI,kI,CI],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 _I={file:{title:"File",items:"newdocument restoredraft | preview | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template inserttemplate codesample inserttable accordion | 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"}},TI=e=>e.split(" "),EI=(e,t)=>{const o={..._I,...t.menus},n=ae(t.menus).length>0,r=void 0===t.menubar||!0===t.menubar?TI("file edit view insert format tools table help"):TI(!1===t.menubar?"":t.menubar),a=U(r,(e=>{const o=ve(_I,e);return n?o||be(t.menus,e).exists((e=>ve(e,"items"))):o})),i=L(a,(n=>{const r=o[n];return((e,t,o)=>{const n=fv(o).split(/[ ,]/);return{text:e.title,getItems:()=>Y(e.items,(e=>{const o=e.toLowerCase();return 0===o.trim().length||N(n,(e=>e===o))?[]:"separator"===o||"|"===o?[{type:"separator"}]:t.menuItems[o]?[t.menuItems[o]]:[]}))}})({title:r.title,items:TI(r.items)},t,e)}));return U(i,(e=>e.getItems().length>0&&N(e.getItems(),(e=>s(e)||"separator"!==e.type))))},DI=(e,t,o)=>(e.on("remove",(()=>o.unload(t))),o.load(t)),AI=(e,t,o,n)=>(e.on("remove",(()=>n.unloadRawCss(t))),n.loadRawCss(t,o)),MI=async(e,t)=>{const o="ui/"+Gv(e).getOr("default")+"/skin.css",n=tinymce.Resource.get(o);if(s(n))return Promise.resolve(AI(e,o,n,e.ui.styleSheetLoader));return DI(e,t+"/skin.min.css",e.ui.styleSheetLoader)},BI=async(e,t)=>{var o;if(o=Re.fromDom(e.getElement()),ft(o).isSome()){const o="ui/"+Gv(e).getOr("default")+"/skin.shadowdom.css",n=tinymce.Resource.get(o);if(s(n))return AI(e,o,n,Qb.DOM.styleSheetLoader),Promise.resolve();return DI(e,t+"/skin.shadowdom.min.css",Qb.DOM.styleSheetLoader)}},II=(e,t)=>(async(e,t)=>{Gv(t).fold((()=>{const o=$v(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}),(o=>{const n="ui/"+o+(e?"/content.inline":"/content")+".css",r=tinymce.Resource.get(n);if(s(r))AI(t,n,r,t.ui.styleSheetLoader);else{const o=$v(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}}));const o=$v(t);if(!Wv(t)&&s(o))return Promise.all([MI(t,o),BI(t,o)]).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:t}))(t,"Skin could not be loaded")),FI=k(II,!1),RI=k(II,!0),NI=(e,t,o)=>e.translate([t,e.translate(o)]),VI=(e,t)=>{const o=(o,r,s,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return D.some({type:"separator",text:i});if("submenu"===o.type){const e=Y(o.getStyleItems(),(e=>n(e,r,a)));return 0===r&&e.length<=0?D.none():D.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>Y(o.getStyleItems(),(e=>n(e,r,a)))})}return D.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!s,onAction:t.onAction(o),...o.getStylePreview().fold((()=>({})),(e=>({meta:{style:e}})))})},n=(e,n,r)=>{const s="formatter"===e.type&&t.isInvalid(e);return 0===n?s?[]:o(e,n,!1,r).toArray():o(e,n,s,r).toArray()},r=e=>{const o=t.getCurrentValue(),r=t.shouldHide?0:1;return Y(e,(e=>n(e,r,o)))};return{validateItems:r,getFetch:(e,t)=>(o,n)=>{const s=t(),a=r(s);n(tE(a,dy.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:D.none()}))}}},zI=(e,t,o)=>{const n=o.dataset,r="basic"===n.type?()=>L(n.data,(e=>fA(e,o.isSelectedFor,o.getPreviewFor))):n.getData;return{items:VI(t,o),getStyleItems:r}},LI=(e,t,o,n,r)=>{const{items:s,getStyleItems:a}=zI(0,t,o);return KT({text:o.icon.isSome()?D.none():o.text,icon:o.icon,tooltip:D.from(o.tooltip),role:D.none(),fetch:s.getFetch(t,a),onSetup:t=>{const s=o=>t.setTooltip(NI(e,n,o.value));return e.on(r,s),vS(wS(e,"NodeChange",(t=>{const n=t.getComponent();o.updateText(n),xg.set(t.getComponent(),!e.selection.isEditable())}))(t),(()=>e.off(r,s)))},getApi:e=>({getComponent:x(e),setTooltip:o=>{const n=t.shared.providers.translate(o);Ct(e.element,{"aria-label":n,title:n})}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};var HI;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(HI||(HI={}));const PI=(e,t,o)=>{const n=(e=>L(e,(e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}})))(((e,t)=>t===HI.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o));return{type:"basic",data:n}},UI="Alignment {0}",WI="left",jI=[{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"}],$I=e=>{const t={type:"basic",data:jI};return{tooltip:NI(e,UI,WI),text:D.none(),icon:D.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:e=>D.none,onAction:t=>()=>$(jI,(e=>e.format===t.format)).each((t=>e.execCommand(t.command))),updateText:t=>{const o=$(jI,(t=>e.formatter.match(t.format))),n=o.fold(x(WI),(e=>e.title.toLowerCase()));$s(t,XT,{icon:`align-${n}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},GI=(e,t)=>{const o=t(),n=L(o,(e=>e.format));return D.from(e.formatter.closest(n)).bind((e=>$(o,(t=>t.format===e)))).orThunk((()=>Ce(e.formatter.match("p"),{title:"Paragraph",format:"p"})))},qI="Block {0}",YI="Paragraph",XI=e=>{const t=PI(e,"block_formats",HI.SemiColon);return{tooltip:NI(e,qI,YI),text:D.some(YI),icon:D.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},onAction:SS(e),updateText:o=>{const n=GI(e,(()=>t.data)).fold(x(YI),(e=>e.title));$s(o,YT,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},KI="Font {0}",JI="System Font",ZI=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],QI=e=>{const t=e.split(/\s*,\s*/);return L(t,(e=>e.replace(/^['"]+|['"]+$/g,"")))},eF=(e,t)=>t.length>0&&X(t,(t=>e.indexOf(t.toLowerCase())>-1)),tF=e=>{const t=()=>{const t=e=>e?QI(e)[0]:"",n=e.queryCommandValue("FontName"),r=o.data,s=n?n.toLowerCase():"",a=Uv(e),i=$(r,(e=>{const o=e.format;return o.toLowerCase()===s||t(o).toLowerCase()===t(s).toLowerCase()})).orThunk((()=>Ce(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=QI(e.toLowerCase());return eF(o,ZI)||eF(o,t)}return!1})(s,a),{title:JI,format:s})));return{matchOpt:i,font:n}},o=PI(e,"font_family_formats",HI.SemiColon);return{tooltip:NI(e,KI,JI),text:D.some(JI),icon:D.none(),isSelectedFor:e=>t=>t.exists((t=>t.format===e)),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>D.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:r}=t(),s=n.fold(x(r),(e=>e.title));$s(o,YT,{text:s}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:s})},dataset:o,shouldHide:!1,isInvalid:T}},oF={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:[""]},nF=(()=>{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})`})(.*)$`)})(),rF=(e,t)=>D.from(nF.exec(e)).bind((e=>{const o=Number(e[1]),n=e[2];return((e,t)=>N(t,(t=>N(oF[t],(t=>e===t)))))(n,t)?D.some({value:o,unit:n}):D.none()})),sF={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)},aF=(e,t,o)=>{let n=D.none();const r=wS(e,"NodeChange SwitchMode",(t=>{const r=t.getComponent();n=D.some(r),o.updateInputValue(r),xg.set(r,!e.selection.isEditable())})),s=e=>({getComponent:x(e)}),a=Nr(b),i=ya("custom-number-input-events"),l=(e,t,r)=>{const s=n.map((e=>Ju.getValue(e))).getOr("");const a=o.getNewValue(s,e),i=s.length-`${a}`.length,l=n.map((e=>e.element.dom.selectionStart-i)),c=n.map((e=>e.element.dom.selectionEnd-i));o.onAction(a,r),n.each((e=>{Ju.setValue(e,a),t&&(l.each((t=>e.element.dom.selectionStart=t)),c.each((t=>e.element.dom.selectionEnd=t)))}))},c=(e,t)=>l(((e,t)=>e-t),e,t),d=(e,t)=>l(((e,t)=>e+t),e,t),u=e=>rt(e.element).fold(D.none,(e=>(tc(e),D.some(!0)))),m=e=>nc(e.element)?(lt(e.element).each((e=>tc(e))),D.some(!0)):D.none(),g=(o,n,r,a)=>{const i=Nr(b),l=t.shared.providers.translate(r),c=ya("altExecuting"),d=wS(e,"NodeChange SwitchMode",(t=>{xg.set(t.getComponent(),!e.selection.isEditable())})),u=e=>{xg.isDisabled(e)||o(!0)};return Bf.sketch({dom:{tag:"button",attributes:{title:l,"aria-label":l},classes:a.concat(n)},components:[$T(n,t.shared.providers.icons)],buttonBehaviours:ql([xg.config({}),Vh(c,[Tw({onSetup:d,getApi:s},i),Ew({getApi:s},i),Qs(is(),((e,t)=>{t.event.raw.keyCode!==sF.space()&&t.event.raw.keyCode!==sF.enter()||xg.isDisabled(e)||o(!1)})),Qs(us(),u),Qs(Zr(),u)])]),eventOrder:{[is()]:[c,"keying"],[us()]:[c,"alloy.base.behaviour"],[Zr()]:[c,"alloy.base.behaviour"]}})},p=Ff(g((e=>c(!1,e)),"minus","Decrease font size",[])),h=Ff(g((e=>d(!1,e)),"plus","Increase font size",[])),f=Ff({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[Iy.sketch({inputBehaviours:ql([xg.config({}),Vh(i,[Tw({onSetup:r,getApi:s},a),Ew({getApi:s},a)]),Vh("input-update-display-text",[Qs(YT,((e,t)=>{Ju.setValue(e,t.event.text)})),Qs(as(),(e=>{o.onAction(Ju.getValue(e))})),Qs(ds(),(e=>{o.onAction(Ju.getValue(e))}))]),Th.config({mode:"special",onEnter:e=>(l(w,!0,!0),D.some(!0)),onEscape:u,onUp:e=>(d(!0,!1),D.some(!0)),onDown:e=>(c(!0,!1),D.some(!0)),onLeft:(e,t)=>(t.cut(),D.none()),onRight:(e,t)=>(t.cut(),D.none())})])})],behaviours:ql([Uh.config({}),Th.config({mode:"special",onEnter:m,onSpace:m,onEscape:u}),Vh("input-wrapper-events",[Qs(rs(),(e=>{H([p,h],(t=>{const o=Re.fromDom(t.get(e).element.dom);nc(o)&&oc(o)}))}))])])});return{dom:{tag:"div",classes:["tox-number-input"]},components:[p.asSpec(),f.asSpec(),h.asSpec()],behaviours:ql([Uh.config({}),Th.config({mode:"flow",focusInside:ep.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>nc(e.element)?D.none():(tc(e.element),D.some(!0))})])}},iF="Font size {0}",lF="12pt",cF={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},dF={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},uF=(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":be(dF,e).getOr(e),mF=e=>be(cF,e).getOr(""),gF=e=>{const t=()=>{let t=D.none();const o=n.data,r=e.queryCommandValue("FontSize");if(r)for(let e=3;t.isNone()&&e>=0;e--){const n=uF(r,e),s=mF(n);t=$(o,(e=>e.format===r||e.format===n||e.format===s))}return{matchOpt:t,size:r}},o=x(D.none),n=PI(e,"font_size_formats",HI.Space);return{tooltip:NI(e,iF,lF),text:D.some(lF),icon:D.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:r}=t(),s=n.fold(x(r),(e=>e.title));$s(o,YT,{text:s}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:s})},dataset:n,shouldHide:!1,isInvalid:T}},pF="Format {0}",hF=(e,t)=>{const o="Paragraph";return{tooltip:NI(e,pF,o),text:D.some(o),icon:D.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:D.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?D.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):D.none()},onAction:SS(e),updateText:t=>{const n=e=>uA(e)?Y(e.items,n):mA(e)?[{title:e.title,format:e.format}]:[],r=Y(hA(e),n),s=GI(e,x(r)).fold(x(o),(e=>e.title));$s(t,YT,{text:s}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:s})},shouldHide:pv(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},fF=x([dr("toggleClass"),dr("fetch"),ol("onExecute"),Tr("getHotspot",D.some),Tr("getAnchorOverrides",x({})),Jc(),ol("onItemExecute"),yr("lazySink"),dr("dom"),el("onOpen"),Zu("splitDropdownBehaviours",[kk,Th,Uh]),Tr("matchWidth",!1),Tr("useMinWidth",!1),Tr("eventOrder",{}),yr("role")].concat(Pk())),bF=Tm({factory:Bf,schema:[dr("dom")],name:"arrow",defaults:()=>({buttonBehaviours:ql([Uh.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(Gs)},buttonBehaviours:ql([Kh.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),vF=Tm({factory:Bf,schema:[dr("dom")],name:"button",defaults:()=>({buttonBehaviours:ql([Uh.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each((o=>{e.onExecute(o,t)}))}})}),yF=x([bF,vF,Dm({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[dr("text")],name:"aria-descriptor"}),Em({schema:[Ji()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each((n=>{e.onItemExecute(n,t,o)}))}})}),Mk()]),xF=og({name:"SplitDropdown",configFields:fF(),partFields:yF(),factory:(e,t,o,n)=>{const r=e=>{ag.getCurrent(e).each((e=>{Mg.highlightFirst(e),Th.focusIn(e)}))},s=t=>{Rk(e,w,t,n,r,Tf.HighlightMenuAndItem).get(b)},a=t=>{const o=Um(t,e,"button");return Gs(o),D.some(!0)},i={...Ks([ia(((t,o)=>{Pm(t,e,"aria-descriptor").each((e=>{const o=ya("aria");kt(e.element,"id",o),kt(t.element,"aria-describedby",o)}))}))]),...Qh(D.some(s))},l={repositionMenus:e=>{Kh.isOn(e)&&Hk(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:l,eventOrder:{...e.eventOrder,[Ss()]:["disabling","toggling","alloy.base.behaviour"]},events:i,behaviours:em(e.splitDropdownBehaviours,[kk.config({others:{sandbox:t=>{const o=Um(t,e,"arrow");return Lk(e,t,{onOpen:()=>{Kh.on(o),Kh.on(t)},onClose:()=>{Kh.off(o),Kh.off(t)}})}}}),Th.config({mode:"special",onSpace:a,onEnter:a,onDown:e=>(s(e),D.some(!0))}),Uh.config({}),Kh.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),wF=e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setText:t=>$s(e,YT,{text:t}),setIcon:t=>$s(e,XT,{icon:t})}),SF=e=>({setActive:t=>{Kh.set(e,t)},isActive:()=>Kh.isOn(e),isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setText:t=>$s(e,YT,{text:t}),setIcon:t=>$s(e,XT,{icon:t})}),kF=(e,t)=>e.map((e=>({"aria-label":t.translate(e),title:t.translate(e)}))).getOr({}),CF=ya("focus-button"),OF=(e,t,o,n,r)=>{const s=t.map((e=>Ff(qT(e,"tox-tbtn",r)))),a=e.map((e=>Ff(GT(e,r.icons))));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:kF(o,r)},components:Mw([a.map((e=>e.asSpec())),s.map((e=>e.asSpec()))]),eventOrder:{[es()]:["focusing","alloy.base.behaviour",PT],[Is()]:[PT,"toolbar-group-button-events"]},buttonBehaviours:ql([Ow(r.isDisabled),ww(),Vh(PT,[ia(((e,t)=>WT(e))),Qs(YT,((e,t)=>{s.bind((t=>t.getOpt(e))).each((e=>{Nh.set(e,[Si(r.translate(t.event.text))])}))})),Qs(XT,((e,t)=>{a.bind((t=>t.getOpt(e))).each((e=>{Nh.set(e,[GT(t.event.icon,r.icons)])}))})),Qs(es(),((e,t)=>{t.event.prevent(),js(e,CF)}))])].concat(n.getOr([])))}},_F=(e,t,o)=>{var n;const r=Nr(b),s=OF(e.icon,e.text,e.tooltip,D.none(),o);return Bf.sketch({dom:s.dom,components:s.components,eventOrder:UT,buttonBehaviours:{...ql([Vh("toolbar-button-events",[(a={onAction:e.onAction,getApi:t.getApi},da(((e,t)=>{_w(a,e)((t=>{$s(e,HT,{buttonApi:t}),a.onAction(t)}))}))),Tw(t,r),Ew(t,r)]),Ow((()=>!e.enabled||o.isDisabled())),ww()].concat(t.toolbarButtonBehaviours)),[PT]:null===(n=s.buttonBehaviours)||void 0===n?void 0:n[PT]}});var a},TF=(e,t,o)=>_F(e,{toolbarButtonBehaviours:o.length>0?[Vh("toolbarButtonWith",o)]:[],getApi:wF,onSetup:e.onSetup},t),EF=(e,t,o)=>_F(e,{toolbarButtonBehaviours:[Nh.config({}),Kh.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[Vh("toolbarToggleButtonWith",o)]:[]),getApi:SF,onSetup:e.onSetup},t),DF=(e,t,o)=>n=>Ek((e=>t.fetch(e))).map((r=>D.from(eC(wn(nk(ya("menu-value"),r,(o=>{t.onItemAction(e(n),o)}),t.columns,t.presets,dy.CLOSE_ON_EXECUTE,t.select.getOr(T),o),{movement:sk(t.columns,t.presets),menuBehaviours:aw("auto"!==t.columns?[]:[ia(((e,o)=>{rw(e,4,Sy(t.presets)).each((({numRows:t,numColumns:o})=>{Th.setGridSize(e,t,o)}))}))])}))))),AF=[{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"]}],MF=(e,t)=>(o,n,r)=>{const s=e(o).mapError((e=>rr(e))).getOrDie();return t(s,n,r)},BF={button:MF(Dx,((e,t)=>{return o=e,n=t.shared.providers,TF(o,n,[]);var o,n})),togglebutton:MF(Bx,((e,t)=>{return o=e,n=t.shared.providers,EF(o,n,[]);var o,n})),menubutton:MF(KM,((e,t)=>IE(e,"tox-tbtn",t,D.none(),!1))),splitbutton:MF((e=>tr("SplitButton",JM,e)),((e,t)=>((e,t)=>{const o=e=>({isEnabled:()=>!xg.isDisabled(e),setEnabled:t=>xg.set(e,!t),setIconFill:(t,o)=>{Fi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each((e=>{kt(e,"fill",o)}))},setActive:t=>{kt(e.element,"aria-pressed",t),Fi(e.element,"span").each((o=>{e.getSystem().getByDom(o).each((e=>Kh.set(e,t)))}))},isActive:()=>Fi(e.element,"span").exists((t=>e.getSystem().getByDom(t).exists(Kh.isOn))),setText:t=>Fi(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>$s(e,YT,{text:t}))))),setIcon:t=>Fi(e.element,"span").each((o=>e.getSystem().getByDom(o).each((e=>$s(e,XT,{icon:t}))))),setTooltip:o=>{const n=t.providers.translate(o);Ct(e.element,{"aria-label":n,title:n})}}),n=Nr(b),r={getApi:o,onSetup:e.onSetup};return xF.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...kF(e.tooltip,t.providers)}},onExecute:t=>{const n=o(t);n.isEnabled()&&e.onAction(n)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:ql([Cw(t.providers.isDisabled),ww(),Vh("split-dropdown-events",[ia(((e,t)=>WT(e))),Qs(CF,Uh.focus),Tw(r,n),Ew(r,n)]),QC.config({})]),eventOrder:{[Is()]:["alloy.base.behaviour","split-dropdown-events"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:DF(o,e,t.providers),parts:{menu:Ey(0,e.columns,e.presets)},components:[xF.parts.button(OF(e.icon,e.text,D.none(),D.some([Kh.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),xF.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:$b("chevron-down",t.providers.icons)},buttonBehaviours:ql([Cw(t.providers.isDisabled),ww(),Gb()])}),xF.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})})(e,t.shared))),grouptoolbarbutton:MF((e=>tr("GroupToolbarButton",qM,e)),((e,t,o)=>{const n=o.ui.registry.getAll().buttons,r=e=>NF(o,{buttons:n,toolbar:e,allowToolbarGroups:!1},t,D.none()),s={[Xc]:t.shared.header.isPositionedAtTop()?Yc.TopToBottom:Yc.BottomToTop};if(bv(o)===Jb.floating)return((e,t,o,n)=>{const r=t.shared,s=Nr(b),a={toolbarButtonBehaviours:[],getApi:wF,onSetup:e.onSetup},i=[Vh("toolbar-group-button-events",[Tw(a,s),Ew(a,s)])];return RB.sketch({lazySink:r.getSink,fetch:()=>Ek((t=>{t(L(o(e.items),YB))})),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:OF(e.icon,e.text,e.tooltip,D.some(i),r.providers),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,r,s);throw new Error("Toolbar groups are only supported when using floating toolbar mode")}))},IF={styles:(e,t)=>{const o={type:"advanced",...t.styles};return LI(e,t,hF(e,o),pF,"StylesTextUpdate")},fontsize:(e,t)=>LI(e,t,gF(e),iF,"FontSizeTextUpdate"),fontsizeinput:(e,t)=>aF(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>$s(e,YT,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{rF(o,["unsupportedLength","empty"]);const r=t(),s=rF(o,["unsupportedLength","empty"]).or(rF(r,["unsupportedLength","empty"])),a=s.map((e=>e.value)).getOr(16),i=Ev(e),l=s.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!==r&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e)),fontfamily:(e,t)=>LI(e,t,tF(e),KI,"FontFamilyTextUpdate"),blocks:(e,t)=>LI(e,t,XI(e),qI,"BlocksTextUpdate"),align:(e,t)=>LI(e,t,$I(e),UI,"AlignTextUpdate")},FF=e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=L(AF,(t=>{const o=U(t.items,(t=>ve(e,t)||ve(IF,t)));return{name:t.name,items:o}}));return U(t,(e=>e.items.length>0))})(o):s(t)?(e=>{const t=e.split("|");return L(t,(e=>({items:e.trim().split(" ")})))})(t):(e=>f(e,(e=>ve(e,"name")&&ve(e,"items"))))(t)?t:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},RF=(e,t,o,n,r,s)=>be(t,o.toLowerCase()).orThunk((()=>s.bind((e=>se(e,(e=>be(t,e+o.toLowerCase()))))))).fold((()=>be(IF,o.toLowerCase()).map((t=>t(e,r)))),(t=>"grouptoolbarbutton"!==t.type||n?((e,t,o)=>be(BF,e.type).fold((()=>(console.error("skipping button defined by",e),D.none())),(n=>D.some(n(e,t,o)))))(t,r,e):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),D.none()))),NF=(e,t,o,n)=>{const r=FF(t),s=L(r,(r=>{const s=Y(r.items,(r=>0===r.trim().length?[]:RF(e,t.buttons,r,t.allowToolbarGroups,o,n).toArray()));return{title:D.from(e.translate(r.name)),items:s}}));return U(s,(e=>e.items.length>0))},VF=(e,t,o,n)=>{const r=t.mainUi.outerContainer,a=o.toolbar,i=o.buttons;if(f(a,s)){const t=a.map((t=>{const r={toolbar:t,buttons:i,allowToolbarGroups:o.allowToolbarGroups};return NF(e,r,n,D.none())}));OI.setToolbars(r,t)}else OI.setToolbar(r,NF(e,o,n,D.none()))},zF=Do(),LF=zF.os.isiOS()&&zF.os.version.major<=12;var HF=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=t,i=Nr(0),l=s.outerContainer;FI(e);const d=Re.fromDom(r.targetNode),u=ht(pt(d));vu(d,s.mothership),((e,t,o)=>{ny(e)&&vu(o.mainUi.mothership.element,o.popupUi.mothership),bu(t,o.dialogUi.mothership)})(e,u,t),e.on("SkinLoaded",(()=>{OI.setSidebar(l,o.sidebar,Lv(e)),VF(e,t,o,n),i.set(e.getWin().innerWidth),OI.setMenubar(l,EI(e,o)),OI.setViews(l,o.views),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let r=e.getWin();const s=e.getDoc().documentElement,a=Nr(Gt(r.innerWidth,r.innerHeight)),i=Nr(Gt(s.offsetWidth,s.offsetHeight)),l=()=>{const t=a.get();t.left===r.innerWidth&&t.top===r.innerHeight||(a.set(Gt(r.innerWidth,r.innerHeight)),hS(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set(Gt(t.offsetWidth,t.offsetHeight)),hS(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(r,"resize",l),n.bind(r,"scroll",d);const u=Tc(Re.fromDom(e.getBody()),"load",c);e.on("hide",(()=>{H(o,(e=>{Mt(e.element,"display","none")}))})),e.on("show",(()=>{H(o,(e=>{Lt(e.element,"display")}))})),e.on("NodeChange",c),e.on("remove",(()=>{u.unbind(),n.unbind(r,"resize",l),n.unbind(r,"scroll",d),r=null}))})(e,t)}));const m=OI.getSocket(l).getOrDie("Could not find expected socket element");if(LF){Bt(m.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=((e,t)=>{let o=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{c(o)&&(o=setTimeout((()=>{o=null,e.apply(null,n)}),t))}}})((()=>{e.dispatch("ScrollContent")}),20),o=_c(m.element,"scroll",t.throttle);e.on("remove",o.unbind)}xw(e,t),e.addCommand("ToggleSidebar",((t,o)=>{OI.toggleSidebar(l,o),e.dispatch("ToggleSidebar")})),e.addQueryValueHandler("ToggleSidebar",(()=>{var e;return null!==(e=OI.whichSidebar(l))&&void 0!==e?e:""})),e.addCommand("ToggleView",((t,o)=>{if(OI.toggleView(l,o)){const t=l.element;s.mothership.broadcastOn([Bu()],{target:t}),H(a,(e=>{e.broadcastOn([Bu()],{target:t})})),c(OI.whichView(l))&&(e.focus(),e.nodeChanged(),OI.refreshToolbar(l))}})),e.addQueryValueHandler("ToggleView",(()=>{var e;return null!==(e=OI.whichView(l))&&void 0!==e?e:""}));const g=bv(e);g!==Jb.sliding&&g!==Jb.floating||e.on("ResizeWindow ResizeEditor ResizeContent",(()=>{const o=e.getWin().innerWidth;o!==i.get()&&(OI.refreshToolbar(t.mainUi.outerContainer),i.set(o))}));const p={setEnabled:e=>{yw(t,!e)},isEnabled:()=>!xg.isDisabled(l)};return{iframeContainer:m.element.dom,editorContainer:l.element.dom,api:p}}});const PF=e=>/^[0-9\.]+(|px)$/i.test(""+e)?D.some(parseInt(""+e,10)):D.none(),UF=e=>h(e)?e+"px":e,WF=(e,t,o)=>{const n=t.filter((t=>e<t)),r=o.filter((t=>e>t));return n.or(r).getOr(e)},jF=e=>{const t=(e=>{const t=av(e),o=cv(e),n=uv(e);return PF(t).map((e=>WF(e,o,n)))})(e);return t.getOr(av(e))},$F=e=>{const t=iv(e),o=lv(e),n=dv(e);return PF(t).map((e=>WF(e,o,n)))},{ToolbarLocation:GF,ToolbarMode:qF}=sy,YF=(e,t,o,n,r)=>{const{mainUi:s,uiMotherships:a}=o,i=Qb.DOM,l=Qv(e),c=oy(e),d=dv(e).or($F(e)),u=n.shared.header,m=u.isPositionedAtTop,g=bv(e),p=g===qF.sliding||g===qF.floating,h=Nr(!1),f=()=>h.get()&&!e.removed,b=e=>p?e.fold(x(0),(e=>e.components().length>1?Wt(e.components()[1].element):0)):0,v=(e,t)=>ny(e)?sM(t):D.none(),y=()=>{H(a,(e=>{e.broadcastOn([Iu()],{})}))},w=o=>{if(!f())return;l||r.on((e=>{const o=d.getOrThunk((()=>{const e=PF(Ft(xt(),"margin-left")).getOr(0);return Jt(xt())-Yt(t).left+e}));Mt(e.element,"max-width",o+"px")}));const n=l?D.none():(()=>{if(l)return D.none();if(Yt(s.outerContainer.element).left+Zt(s.outerContainer.element)>=window.innerWidth-40||Nt(s.outerContainer.element,"width").isSome()){Mt(s.outerContainer.element,"position","absolute"),Mt(s.outerContainer.element,"left","0px"),Lt(s.outerContainer.element,"width");const e=Zt(s.outerContainer.element);return D.some(e)}return D.none()})();p&&OI.refreshToolbar(s.outerContainer),l||(o=>{r.on((n=>{const r=OI.getToolbar(s.outerContainer),a=b(r),i=Xo(t),{top:l,left:c}=v(e,s.outerContainer.element).fold((()=>({top:m()?Math.max(i.y-Wt(n.element)+a,0):i.bottom,left:i.x})),(e=>{var t;const o=Xo(e),r=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,s=Je(e,xt()),l=s?Math.max(i.y-Wt(n.element)+a,0):i.y-o.y+r-Wt(n.element)+a;return{top:m()?l:i.bottom,left:s?i.x:i.x-o.x}})),d={position:"absolute",left:Math.round(c)+"px",top:Math.round(l)+"px"},u=o.map((e=>{const t=Ho(),o=window.innerWidth-(c-t.left);return{width:Math.max(Math.min(e,o),150)+"px"}})).getOr({});Bt(s.outerContainer.element,{...d,...u})}))})(n),c&&r.on(o),y()},S=()=>!(l||!c||!f())&&r.get().exists((o=>{const n=u.getDockingMode(),a=(o=>{switch(yv(e)){case GF.auto:const e=OI.getToolbar(s.outerContainer),n=b(e),r=Wt(o.element)-n,a=Xo(t);if(a.y>r)return"top";{const e=tt(t),o=Math.max(e.dom.scrollHeight,Wt(e));return a.bottom<o-r||Zo().bottom<a.bottom-r?"bottom":"top"}case GF.bottom:return"bottom";case GF.top:default:return"top"}})(o);return a!==n&&(i=a,r.on((e=>{NM.setModes(e,[i]),u.setDockingMode(i);const t=m()?Yc.TopToBottom:Yc.BottomToTop;kt(e.element,Xc,t)})),!0);var i}));return{isVisible:f,isPositionedAtTop:m,show:()=>{h.set(!0),Mt(s.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),H(a,(e=>{Lt(e.element,"display")})),S(),ny(e)?w((e=>NM.isDocked(e)?NM.reset(e):NM.refresh(e))):w(NM.refresh)},hide:()=>{h.set(!1),Mt(s.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),H(a,(e=>{Mt(e.element,"display","none")}))},update:w,updateMode:()=>{S()&&w(NM.reset)},repositionPopups:y}},XF=(e,t)=>{const o=Xo(e);return{pos:t?o.y:o.bottom,bounds:o}};var KF=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:s}=t,a=Cc(),i=Re.fromDom(r.targetNode),l=YF(e,i,t,n,a),c=Sv(e);RI(e);const d=()=>{if(a.isSet())return void l.show();a.set(OI.getHeader(s.outerContainer).getOrDie());const r=ey(e);ny(e)?(vu(i,s.mothership),vu(i,t.popupUi.mothership)):bu(r,s.mothership),bu(r,t.dialogUi.mothership),VF(e,t,o,n),OI.setMenubar(s.outerContainer,EI(e,o)),l.show(),((e,t,o,n)=>{const r=Nr(XF(t,o.isPositionedAtTop())),s=n=>{const{pos:s,bounds:a}=XF(t,o.isPositionedAtTop()),{pos:i,bounds:l}=r.get(),c=a.height!==l.height||a.width!==l.width;r.set({pos:s,bounds:a}),c&&hS(e,n),o.isVisible()&&(i!==s?o.update(NM.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",(()=>o.update(NM.reset))),e.on("NodeChange keydown",(e=>{requestAnimationFrame((()=>s(e)))}));let a=0;const i=hT((()=>o.update(NM.refresh)),33);e.on("ScrollWindow",(()=>{const e=Ho().left;e!==a&&(a=e,i.throttle()),o.updateMode()})),ny(e)&&e.on("ElementScroll",(e=>{o.update(NM.refresh)}));const l=kc();l.set(Tc(Re.fromDom(e.getBody()),"load",(e=>s(e.raw)))),e.on("remove",(()=>{l.clear()}))})(e,i,l,c),e.nodeChanged()};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()})),xw(e,t);const u={show:d,hide:l.hide,setEnabled:e=>{yw(t,!e)},isEnabled:()=>!xg.isDisabled(s.outerContainer)};return{editorContainer:s.outerContainer.element.dom,api:u}}});const JF="contexttoolbar-hide",ZF=(e,t)=>Qs(HT,((o,n)=>{const r=(e=>({hide:()=>js(e,_s()),getValue:()=>Ju.getValue(e)}))(e.get(o));t.onAction(r,n.event.buttonApi)})),QF=(e,t,o)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o)=>{const{primary:n,...r}=t.original,s=or(Bx({...r,type:"togglebutton",onAction:b}));return EF(s,o,[ZF(e,t)])})(e,t,o):((e,t,o)=>{const{primary:n,...r}=t.original,s=or(Dx({...r,type:"button",onAction:b}));return TF(s,o,[ZF(e,t)])})(e,t,o),eR=(e,t)=>{const o=e.label.fold((()=>({})),(e=>({"aria-label":e}))),n=Ff(Iy.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:e.initValue(),inputAttributes:o,selectOnFocus:!0,inputBehaviours:ql([Th.config({mode:"special",onEnter:e=>r.findPrimary(e).map((e=>(Gs(e),!0))),onLeft:(e,t)=>(t.cut(),D.none()),onRight:(e,t)=>(t.cut(),D.none())})])})),r=((e,t,o)=>{const n=L(t,(t=>Ff(QF(e,t,o))));return{asSpecs:()=>L(n,(e=>e.asSpec())),findPrimary:e=>se(t,((t,o)=>t.primary?D.from(n[o]).bind((t=>t.getOpt(e))).filter(C(xg.isDisabled)):D.none()))}})(n,e.commands,t);return[{title:D.none(),items:[n.asSpec()]},{title:D.none(),items:r.asSpecs()}]},tR=eR,oR=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,nR=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=dt(Re.fromDom(e.startContainer),e.startOffset).element;return($e(o)?nt(o):D.some(o)).filter(je).map((e=>e.dom.getBoundingClientRect())).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=Ho();return Yo(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=Ko(Re.fromDom(e.getBody()));return Yo(o.x+t.left,o.y+t.top,t.width,t.height)}},rR=(e,t,o,n=0)=>{const r=Wo(window),s=Xo(Re.fromDom(e.getContentAreaContainer())),a=jv(e)||Yv(e)||Kv(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}})(s,r,n);if(e.inline&&!a)return Yo(i,r.y,l,r.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,r,s)=>{const a=Re.fromDom(e.getContainer()),i=Fi(a,".tox-editor-header").getOr(a),l=Xo(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+s,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-s,o.bottom)};const u="line"===r?Xo(a):t;return d?{y:Math.max(l.bottom+s,o.y),bottom:Math.min(u.bottom-s,o.bottom)}:{y:Math.max(u.y+s,o.y),bottom:Math.min(l.y-s,o.bottom)}})(e,s,r,a,o,n);return Yo(i,c,l,d-c)}},sR={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"]},aR={maxHeightFunction:Lc(),maxWidthFunction:EB()},iR=e=>"node"===e,lR=(e,t,o,n,r)=>{const s=nR(e),a=n.lastElement().exists((e=>Je(o,e)));if(((e,t)=>{const o=e.selection.getRng(),n=dt(Re.fromDom(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&Je(n.element,t)})(e,o))return a?KD:$D;if(a)return((e,t,o)=>{const n=Nt(e,"position");Mt(e,"position",t);const r=o(e);return n.each((t=>Mt(e,"position",t))),r})(t,n.getMode(),(()=>oR(s,Xo(t),-20)&&!n.isReposition()?ZD:KD));return("fixed"===n.getMode()?r.y+Ho().top:r.y)+(Wt(t)+12)<=s.y?$D:GD},cR=(e,t,o,n)=>{const r=t=>(n,r,s,a,i)=>({...lR(e,a,t,o,i)({...n,y:i.y,height:i.height},r,s,a,i),alwaysFit:!0}),s=e=>iR(n)?[r(e)]:[];return t?{onLtr:e=>[Bl,Tl,El,Dl,Al,Ml].concat(s(e)),onRtl:e=>[Bl,El,Tl,Al,Dl,Ml].concat(s(e))}:{onLtr:e=>[Ml,Bl,Dl,Tl,Al,El].concat(s(e)),onRtl:e=>[Ml,Bl,Al,El,Dl,Tl].concat(s(e))}},dR=(e,t)=>{const o=U(t,(t=>t.predicate(e.dom))),{pass:n,fail:r}=P(o,(e=>"contexttoolbar"===e.type));return{contextToolbars:n,contextForms:r}},uR=(e,t,o)=>{const n=dR(e,t);if(n.contextForms.length>0)return D.some({elem:e,toolbars:[n.contextForms[0]]});{const t=dR(e,o);if(t.contextForms.length>0)return D.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=>N(e,(e=>e.position===t)),o=t=>U(e,(e=>e.position===t)),n=t("selection"),r=t("node");if(n||r){if(r&&n){const e=o("node"),t=L(o("selection"),(e=>({...e,position:"node"})));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return D.some({elem:e,toolbars:o})}return D.none()}},mR=(e,t,o)=>e(t)?D.none():Wr(t,(e=>{if(je(e)){const{contextToolbars:t,contextForms:n}=dR(e,o.inNodeScope),r=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>$(e,(e=>e.position===t)),o=t("selection").orThunk((()=>t("node"))).orThunk((()=>t("line"))).map((e=>e.position));return o.fold((()=>[]),(t=>U(e,(e=>e.position===t))))}})(t);return r.length>0?D.some({elem:e,toolbars:r}):D.none()}return D.none()}),e),gR=(e,t)=>{const o={},n=[],r=[],s={},a={},i=(e,i)=>{const l=or(tr("ContextForm",Lx,i));o[e]=l,l.launch.map((o=>{s["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}})),"editor"===l.scope?r.push(l):n.push(l),a[e]=l},l=(e,t)=>{var o;(o=t,tr("ContextToolbar",Hx,o)).each((o=>{"editor"===t.scope?r.push(o):n.push(o),a[e]=o}))},c=ae(e);return H(c,(t=>{const o=e[t];"contextform"===o.type?i(t,o):"contexttoolbar"===o.type&&l(t,o)})),{forms:o,inNodeScope:n,inEditorScope:r,lookupTable:a,formNavigators:s}},pR=ya("forward-slide"),hR=ya("backward-slide"),fR=ya("change-slide-event"),bR="tox-pop--resizing",vR="tox-pop--transition",yR=(e,t,o,n)=>{const r=n.backstage,s=r.shared,a=Do().deviceType.isTouch,i=Cc(),l=Cc(),c=Cc(),d=_i((e=>{const t=Nr([]);return Af.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),Af.getContent(e).each((e=>{Lt(e.element,"visibility")})),ni(e.element,bR),Lt(e.element,"width")},inlineBehaviours:ql([Vh("context-toolbar-events",[aa(gs(),((e,t)=>{"width"===t.event.raw.propertyName&&(ni(e.element,bR),Lt(e.element,"width"))})),Qs(fR,((e,t)=>{const o=e.element;Lt(o,"width");const n=Jt(o);Af.setContent(e,t.event.contents),ti(o,bR);const r=Jt(o);Mt(o,"width",n+"px"),Af.getContent(e).each((e=>{t.event.focus.bind((e=>(tc(e),sc(o)))).orThunk((()=>(Th.focusIn(e),rc(pt(o)))))})),setTimeout((()=>{Mt(e.element,"width",r+"px")}),0)})),Qs(pR,((e,o)=>{Af.getContent(e).each((o=>{t.set(t.get().concat([{bar:o,focus:rc(pt(e.element))}]))})),$s(e,fR,{contents:o.event.forwardContents,focus:D.none()})})),Qs(hR,((e,o)=>{ne(t.get()).each((o=>{t.set(t.get().slice(0,t.get().length-1)),$s(e,fR,{contents:Ti(o.bar),focus:o.focus})}))}))]),Th.config({mode:"special",onEscape:o=>ne(t.get()).fold((()=>e.onEscape()),(e=>(js(o,hR),D.some(!0))))})]),lazySink:()=>on.value(e.sink)})})({sink:o,onEscape:()=>(e.focus(),D.some(!0))})),u=()=>{const t=c.get().getOr("node"),o=iR(t)?1:0;return rR(e,s,t,o)},m=()=>!(e.removed||a()&&r.isContextMenuOpen()),g=()=>{if(m()){const t=u(),o=xe(c.get(),"node")?((e,t)=>t.filter((e=>yt(e)&&We(e))).map(Ko).getOrThunk((()=>nR(e))))(e,i.get()):nR(e);return t.height<=0||!oR(o,t,.01)}return!0},p=()=>{i.clear(),l.clear(),c.clear(),Af.hide(d)},h=()=>{if(Af.isOpen(d)){const e=d.element;Lt(e,"display"),g()?Mt(e,"display","none"):(l.set(0),Af.reposition(d))}},f=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:ql([Th.config({mode:"acyclic"}),Vh("pop-dialog-wrap-events",[ia((t=>{e.shortcuts.add("ctrl+F9","focus statusbar",(()=>Th.focusIn(t)))})),la((t=>{e.shortcuts.remove("ctrl+F9")}))])])}),v=Qt((()=>gR(t,(e=>{const t=y([e]);$s(d,pR,{forwardContents:f(t)})})))),y=t=>{const{buttons:o}=e.ui.registry.getAll(),r={...o,...v().formNavigators},a=bv(e)===Jb.scrolling?Jb.scrolling:Jb.default,i=q(L(t,(t=>"contexttoolbar"===t.type?((t,o)=>NF(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,D.some(["form:"])))(r,t):((e,t)=>tR(e,t))(t,s.providers))));return QB({type:a,uid:ya("context-toolbar"),initGroups:i,onEscape:D.none,cyclicKeying:!0,providers:s.providers})},x=(t,n)=>{const r="node"===t?s.anchors.node(n):s.anchors.cursor(),c=((e,t,o,n)=>"line"===t?{bubble:Wc(12,0,sR),layouts:{onLtr:()=>[Il],onRtl:()=>[Fl]},overrides:aR}:{bubble:Wc(0,12,sR,1/12),layouts:cR(e,o,n,t),overrides:aR})(e,t,a(),{lastElement:i.get,isReposition:()=>xe(l.get(),0),getMode:()=>ru.getMode(o)});return wn(r,c)},w=(e,t)=>{if(k.cancel(),!m())return;const n=y(e),r=e[0].position,s=x(r,t);c.set(r),l.set(1);const a=d.element;Lt(a,"display"),(e=>xe(Se(e,i.get(),Je),!0))(t)||(ni(a,vR),ru.reset(o,d)),Af.showWithinBounds(d,f(n),{anchor:s,transition:{classes:[vR],mode:"placement"}},(()=>D.some(u()))),t.fold(i.clear,i.set),g()&&Mt(a,"display","none")};let S=!1;const k=hT((()=>{if(e.hasFocus()&&!e.removed&&!S)if(si(d.element,vR))k.throttle();else{((e,t)=>{const o=Re.fromDom(t.getBody()),n=e=>Je(e,o),r=Re.fromDom(t.selection.getNode());return(e=>!n(e)&&!Ze(o,e))(r)?D.none():uR(r,e.inNodeScope,e.inEditorScope).orThunk((()=>mR(n,r,e)))})(v(),e).fold(p,(e=>{w(e.toolbars,D.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",k.throttle),e.on(JF,p),e.on("contexttoolbar-show",(t=>{const o=v();be(o.lookupTable,t.toolbarKey).each((o=>{w([o],Ce(t.target!==e,t.target)),Af.getContent(d).each(Th.focusIn)}))})),e.on("focusout",(t=>{Mf.setEditorTimeout(e,(()=>{sc(o.element).isNone()&&sc(d.element).isNone()&&p()}),0)})),e.on("SwitchMode",(()=>{e.mode.isReadOnly()&&p()})),e.on("AfterProgressState",(t=>{t.state?p():e.hasFocus()&&k.throttle()})),e.on("dragstart",(()=>{S=!0})),e.on("dragend drop",(()=>{S=!1})),e.on("NodeChange",(e=>{sc(d.element).fold(k.throttle,b)}))}))},xR=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),r=Cc();return L(o,(o=>({type:"togglemenuitem",text:t.display(o),onSetup:s=>{const a=e=>{e&&(r.on((e=>e.setActive(!1))),r.set(s)),s.setActive(e)};a(xe(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{r.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})},wR=e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:qv,hash:e=>((e,t)=>rF(e,t).map((({value:e,unit:t})=>e+t)))(e,["fixed","relative","empty"]).getOr(e),display:w,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>D.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:yS(e),onMenuSetup:yS(e)}),SR=e=>{xR(e,wR(e)),(e=>D.from(hv(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=Re.fromDom(e.selection.getNode());return jr(t,(e=>D.some(e).filter(je).bind((e=>_t(e,"lang").map((t=>({code:t,customCode:_t(e,"data-mce-lang").getOrUndefined(),title:""})))))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=kc();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),vS(o.clear,yS(e)(t))},onMenuSetup:yS(e)}))))(e).each((t=>xR(e,t)))},kR=(e,t)=>{((e,t)=>{const o=zI(0,t,$I(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:yS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=zI(0,t,tF(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:yS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=zI(0,t,hF(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:yS(e),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=zI(0,t,XI(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:yS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=zI(0,t,gF(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:yS(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)},CR=e=>wS(e,"NodeChange",(t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())})),OR=e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:CR(e),onAction:kS(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:yS(e),onAction:kS(e,"indent")})})(e)},_R=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),vS((()=>e.off("PastePlainTextToggle",n)),yS(e)(o))},TR=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},ER=e=>{(e=>{gT.each([{name:"bold",text:"Bold",icon:"bold"},{name:"italic",text:"Italic",icon:"italic"},{name:"underline",text:"Underline",icon:"underline"},{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:xS(e,t.name),onAction:TR(e,t.name)})}));for(let t=1;t<=6;t++){const o="h"+t;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:xS(e,o),onAction:TR(e,o)})}})(e),(e=>{gT.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"help",text:"Help",action:"mceHelp",icon:"help"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print"}],(t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:kS(e,t.action)})})),gT.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:yS(e),onAction:kS(e,t.action)})}))})(e),(e=>{gT.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],(t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:kS(e,t.action),onSetup:xS(e,t.name)})}))})(e)},DR=e=>{ER(e),(e=>{gT.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:kS(e,t.action)})})),gT.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:yS(e),onAction:kS(e,t.action)})})),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:yS(e),onAction:TR(e,"code")})})(e)},AR=(e,t)=>wS(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",(o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())})),MR=e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:AR(e,"hasUndo"),onAction:kS(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:AR(e,"hasRedo"),onAction:kS(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:AR(e,"hasUndo"),onAction:kS(e,"undo")}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:AR(e,"hasRedo"),onAction:kS(e,"redo")})})(e)},BR=e=>wS(e,"VisualAid",(t=>{t.setActive(e.hasVisual)})),IR=e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:kS(e,"mceToggleVisualAid")})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:BR(e),onAction:kS(e,"mceToggleVisualAid")})})(e)},FR=(e,t)=>{(e=>{H([{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:kS(e,t.cmd),onSetup:xS(e,t.name)})})),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:yS(e),onAction:kS(e,"JustifyNone")})})(e),DR(e),kR(e,t),MR(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=US(e),o=WS(e),n=Nr(t),r=Nr(o);ek(e,"forecolor","forecolor",n),ek(e,"backcolor","hilitecolor",r),tk(e,"forecolor","forecolor","Text color",n),tk(e,"backcolor","hilitecolor","Background color",r)})(e),IR(e),OR(e),SR(e),(e=>{const t=Nr(zv(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:_R(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:_R(e,t)})})(e)},RR=e=>s(e)?e.split(/[ ,]/):e,NR=e=>t=>t.options.get(e),VR=NR("contextmenu_never_use_native"),zR=NR("contextmenu_avoid_overlap"),LR=e=>{const t=e.ui.registry.getAll().contextMenus,o=e.options.get("contextmenu");return e.options.isSet("contextmenu")?o:U(o,(e=>ve(t,e)))},HR=(e,t)=>({type:"makeshift",x:e,y:t}),PR=e=>"longpress"===e.type||0===e.type.indexOf("touch"),UR=(e,t)=>{const o=Qb.DOM.getPos(e);return((e,t,o)=>HR(e.x+t,e.y+o))(t,o.x,o.y)},WR=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(PR(e)){const t=e.touches[0];return HR(t.pageX,t.pageY)}return HR(e.pageX,e.pageY)})(t):UR(e.getContentAreaContainer(),(e=>{if(PR(e)){const t=e.touches[0];return HR(t.clientX,t.clientY)}return HR(e.clientX,e.clientY)})(t)):jR(e),jR=e=>({type:"selection",root:Re.fromDom(e.selection.getNode())}),$R=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:D.some(Re.fromDom(e.selection.getNode())),root:Re.fromDom(e.getBody())}))(e);case"point":return WR(e,t);case"selection":return jR(e)}},GR=(e,t,o,n,r,s)=>{const a=o(),i=$R(e,t,s);tE(a,dy.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:D.none()}).map((e=>{t.preventDefault(),Af.showMenuAt(r,{anchor:i},{menu:{markers:Oy("normal")},data:e})}))},qR={onLtr:()=>[Bl,Tl,El,Dl,Al,Ml,$D,GD,jD,UD,WD,PD],onRtl:()=>[Bl,El,Tl,Al,Dl,Ml,$D,GD,WD,PD,jD,UD]},YR={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"]},XR=(e,t,o,n,r,s,a)=>{const i=((e,t,o)=>{const n=$R(e,t,o);return{bubble:Wc(0,"point"===o?12:0,YR),layouts:qR,overrides:{maxWidthFunction:EB(),maxHeightFunction:Lc()},...n}})(e,t,s);tE(o,dy.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:D.none()}).map((o=>{t.preventDefault();const l=a?Tf.HighlightMenuAndItem:Tf.HighlightNone;Af.showMenuWithinBounds(r,{anchor:i},{menu:{markers:Oy("normal"),highlightOnOpen:l},data:o,type:"horizontal"},(()=>D.some(rR(e,n.shared,"node"===s?"node":"selection")))),e.dispatch(JF)}))},KR=(e,t,o,n,r,s)=>{const a=Do(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),u=()=>{const a=o();XR(e,t,a,n,r,s,!(c||i||l&&d))};if((l||i)&&"node"!==s){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{Mf.setEditorTimeout(e,(()=>{e.selection.setRng(t)}),10),s()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const r=()=>s();e.once("longpresscancel",r);const s=()=>{e.off("touchend",o),e.off("longpresscancel",r),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],r=o.getRng();return Ad(e.getWin(),fd.domRange(r)).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()},JR=e=>s(e)?"|"===e:"separator"===e.type,ZR={type:"separator"},QR=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(s(e))return e;switch(e.type){case"separator":return ZR;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return s(t)?t:L(t,QR)}};default:const o=e;return{type:"menuitem",...t(o),onAction:v(o.onAction)}}},eN=(e,t)=>{if(0===t.length)return e;const o=ne(e).filter((e=>!JR(e))),n=o.fold((()=>[]),(e=>[ZR]));return e.concat(n).concat(t).concat([ZR])},tN=(e,t)=>!(e=>"longpress"===e.type||ve(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),oN=(e,t)=>tN(e,t)?e.selection.getStart(!0):t.target,nN=(e,t,o)=>{const n=Do().deviceType.isTouch,r=_i(Af.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:ql([Vh("dismissContextMenu",[Qs(Rs(),((t,o)=>{Mu.close(t),e.focus()}))])])})),a=()=>Af.hide(r),i=t=>{if(VR(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!VR(e))(e,t)||(e=>0===LR(e).length)(e))return;const a=((e,t)=>{const o=zR(e),n=tN(e,t)?"selection":"point";if(Me(o)){const r=oN(e,t);return iC(Re.fromDom(r),o)?"node":n}return n})(e,t);(n()?KR:GR)(e,t,(()=>{const o=oN(e,t),n=e.ui.registry.getAll(),r=LR(e);return((e,t,o)=>{const n=j(t,((t,n)=>be(e,n.toLowerCase()).map((e=>{const n=e.update(o);if(s(n)&&Me(Ae(n)))return eN(t,n.split(" "));if(l(n)&&n.length>0){const e=L(n,QR);return eN(t,e)}return t})).getOrThunk((()=>t.concat([n])))),[]);return n.length>0&&JR(n[n.length-1])&&n.pop(),n})(n.contextMenus,r,o)}),o,r,a)};e.on("init",(()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)}))},rN=Vr([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),sN=e=>t=>t.translate(-e.left,-e.top),aN=e=>t=>t.translate(e.left,e.top),iN=e=>(t,o)=>j(e,((e,t)=>t(e)),Gt(t,o)),lN=(e,t,o)=>e.fold(iN([aN(o),sN(t)]),iN([sN(t)]),iN([])),cN=(e,t,o)=>e.fold(iN([aN(o)]),iN([]),iN([aN(t)])),dN=(e,t,o)=>e.fold(iN([]),iN([sN(o)]),iN([aN(t),sN(o)])),uN=(e,t,o)=>{const n=e.fold(((e,t)=>({position:D.some("absolute"),left:D.some(e+"px"),top:D.some(t+"px")})),((e,t)=>({position:D.some("absolute"),left:D.some(e-o.left+"px"),top:D.some(t-o.top+"px")})),((e,t)=>({position:D.some("fixed"),left:D.some(e+"px"),top:D.some(t+"px")})));return{right:D.none(),bottom:D.none(),...n}},mN=(e,t,o,n)=>{const r=(e,r)=>(s,a)=>{const i=e(t,o,n);return r(s.getOr(i.left),a.getOr(i.top))};return e.fold(r(dN,gN),r(cN,pN),r(lN,hN))},gN=rN.offset,pN=rN.absolute,hN=rN.fixed,fN=(e,t)=>{const o=Ot(e,t);return u(o)?NaN:parseInt(o,10)},bN=(e,t,o,n)=>((e,t)=>{const o=e.element,n=fN(o,t.leftAttr),r=fN(o,t.topAttr);return isNaN(n)||isNaN(r)?D.none():D.some(Gt(n,r))})(e,t).fold((()=>o),(e=>hN(e.left+n.left,e.top+n.top))),vN=(e,t,o,n,r,s)=>{const a=bN(e,t,o,n),i=t.mustSnap?wN(e,t,a,r,s):SN(e,t,a,r,s),l=lN(a,r,s);return((e,t,o)=>{const n=e.element;kt(n,t.leftAttr,o.left+"px"),kt(n,t.topAttr,o.top+"px")})(e,t,l),i.fold((()=>({coord:hN(l.left,l.top),extra:D.none()})),(e=>({coord:e.output,extra:e.extra})))},yN=(e,t)=>{((e,t)=>{const o=e.element;Et(o,t.leftAttr),Et(o,t.topAttr)})(e,t)},xN=(e,t,o,n)=>se(e,(e=>{const r=e.sensor,s=((e,t,o,n,r,s)=>{const a=cN(e,r,s),i=cN(t,r,s);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n})(t,r,e.range.left,e.range.top,o,n);return s?D.some({output:mN(e.output,t,o,n),extra:e.extra}):D.none()})),wN=(e,t,o,n,r)=>{const s=t.getSnapPoints(e);return xN(s,o,n,r).orThunk((()=>{const e=j(s,((e,t)=>{const s=t.sensor,a=((e,t,o,n,r,s)=>{const a=cN(e,r,s),i=cN(t,r,s),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return Gt(l,c)})(o,s,t.range.left,t.range.top,n,r);return e.deltas.fold((()=>({deltas:D.some(a),snap:D.some(t)})),(o=>(a.left+a.top)/2<=(o.left+o.top)/2?{deltas:D.some(a),snap:D.some(t)}:e))}),{deltas:D.none(),snap:D.none()});return e.snap.map((e=>({output:mN(e.output,o,n,r),extra:e.extra})))}))},SN=(e,t,o,n,r)=>{const s=t.getSnapPoints(e);return xN(s,o,n,r)};var kN=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const t=Qe(e.element),o=Ho(t),s=aM(r),a=((e,t,o)=>({coord:mN(e.output,e.output,t,o),extra:e.extra}))(n,o,s),i=uN(a.coord,0,s);It(r,i)}}});const CN="data-initial-z-index",ON=(e,t)=>{e.getSystem().addToGui(t),(e=>{nt(e.element).filter(je).each((t=>{Nt(t,"z-index").each((e=>{kt(t,CN,e)})),Mt(t,"z-index",Ft(e.element,"z-index"))}))})(t)},_N=e=>{(e=>{nt(e.element).filter(je).each((e=>{_t(e,CN).fold((()=>Lt(e,"z-index")),(t=>Mt(e,"z-index",t))),Et(e,CN)}))})(e),e.getSystem().removeFromGui(e)},TN=(e,t,o)=>e.getSystem().build(xC.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var EN=_r("snaps",[dr("getSnapPoints"),el("onSensor"),dr("leftAttr"),dr("topAttr"),Tr("lazyViewport",Zo),Tr("mustSnap",!1)]);const DN=[Tr("useFixed",T),dr("blockerClass"),Tr("getTarget",w),Tr("onDrag",b),Tr("repositionTarget",!0),Tr("onDrop",b),Ir("getBounds",Zo),EN],AN=e=>((e,t,o,n)=>e.isSome()&&t.isSome()&&o.isSome()?D.some(n(e.getOrDie(),t.getOrDie(),o.getOrDie())):D.none())(Nt(e,"left"),Nt(e,"top"),Nt(e,"position"),((e,t,o)=>("fixed"===o?hN:gN)(parseInt(e,10),parseInt(t,10)))).getOrThunk((()=>{const t=Yt(e);return pN(t.left,t.top)})),MN=(e,t,o,n,r,s,a)=>((e,t,o,n,r)=>{const s=r.bounds,a=cN(t,o,n),i=vl(a.left,s.x,s.x+s.width-r.width),l=vl(a.top,s.y,s.y+s.height-r.height),c=pN(i,l);return t.fold((()=>{const e=dN(c,o,n);return gN(e.left,e.top)}),x(c),(()=>{const e=lN(c,o,n);return hN(e.left,e.top)}))})(0,t.fold((()=>{const e=(t=o,a=s.left,i=s.top,t.fold(((e,t)=>gN(e+a,t+i)),((e,t)=>pN(e+a,t+i)),((e,t)=>hN(e+a,t+i))));var t,a,i;const l=lN(e,n,r);return hN(l.left,l.top)}),(t=>{const a=vN(e,t,o,s,n,r);return a.extra.each((o=>{t.onSensor(e,o)})),a.coord})),n,r,a),BN=(e,t)=>({bounds:e.getBounds(),height:jt(t.element),width:Zt(t.element)}),IN=(e,t,o,n,r)=>{const s=o.update(n,r),a=o.getStartData().getOrThunk((()=>BN(t,e)));s.each((o=>{((e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const s=Qe(e.element),a=Ho(s),i=aM(r),l=AN(r),c=MN(e,t.snaps,l,a,i,n,o),d=uN(c,0,i);It(r,d)}t.onDrag(e,r,n)})(e,t,a,o)}))},FN=(e,t,o,n)=>{t.each(_N),o.snaps.each((t=>{yN(e,t)}));const r=o.getTarget(e.element);n.reset(),o.onDrop(e,r)},RN=e=>(t,o)=>{const n=e=>{o.setStartData(BN(t,e))};return Ks([Qs(Ms(),(e=>{o.getStartData().each((()=>n(e)))})),...e(t,o,n)])};var NN=Object.freeze({__proto__:null,getData:e=>D.from(Gt(e.x,e.y)),getDelta:(e,t)=>Gt(t.left-e.left,t.top-e.top)});const VN=(e,t,o)=>[Qs(es(),((n,r)=>{if(0!==r.event.raw.button)return;r.stop();const s=()=>FN(n,D.some(l),e,t),a=lC(s,200),i={drop:s,delayDrop:a.schedule,forceDrop:s,move:o=>{a.cancel(),IN(n,e,t,NN,o)}},l=TN(n,e.blockerClass,(e=>Ks([Qs(es(),e.forceDrop),Qs(ns(),e.drop),Qs(ts(),((t,o)=>{e.move(o.event)})),Qs(os(),e.delayDrop)]))(i));o(n),ON(n,l)}))],zN=[...DN,rl("dragger",{handlers:RN(VN)})];var LN=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return D.some(Gt(t.clientX,t.clientY))})(t):D.none()},getDelta:(e,t)=>Gt(t.left-e.left,t.top-e.top)});const HN=(e,t,o)=>{const n=Cc(),r=o=>{FN(o,n.get(),e,t),n.clear()};return[Qs(Kr(),((s,a)=>{a.stop();const i=()=>r(s),l={drop:i,delayDrop:b,forceDrop:i,move:o=>{IN(s,e,t,LN,o)}},c=TN(s,e.blockerClass,(e=>Ks([Qs(Kr(),e.forceDrop),Qs(Zr(),e.drop),Qs(Qr(),e.drop),Qs(Jr(),((t,o)=>{e.move(o.event)}))]))(l));n.set(c);o(s),ON(s,c)})),Qs(Jr(),((o,n)=>{n.stop(),IN(o,e,t,LN,n.event)})),Qs(Zr(),((e,t)=>{t.stop(),r(e)})),Qs(Qr(),r)]},PN=zN,UN=[...DN,rl("dragger",{handlers:RN(HN)})],WN=[...DN,rl("dragger",{handlers:RN(((e,t,o)=>[...VN(e,t,o),...HN(e,t,o)]))})];var jN=Object.freeze({__proto__:null,mouse:PN,touch:UN,mouseOrTouch:WN});var $N=Object.freeze({__proto__:null,init:()=>{let e=D.none(),t=D.none();const o=x({});return Va({readState:o,reset:()=>{e=D.none(),t=D.none()},update:(t,o)=>t.getData(o).bind((o=>((t,o)=>{const n=e.map((e=>t.getDelta(e,o)));return e=D.some(o),n})(t,o))),getStartData:()=>t,setStartData:e=>{t=D.some(e)}})}});const GN=Jl({branchKey:"mode",branches:jN,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:D.from(e.extra)})},state:$N,apis:kN}),qN=(e,t,o,n,r,s)=>e.fold((()=>GN.snap({sensor:pN(o-20,n-20),range:Gt(r,s),output:pN(D.some(o),D.some(n)),extra:{td:t}})),(e=>{const r=o-20,s=n-20,a=e.element.dom.getBoundingClientRect();return GN.snap({sensor:pN(r,s),range:Gt(40,40),output:pN(D.some(o-a.width/2),D.some(n-a.height/2)),extra:{td:t}})})),YN=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const r=n.td;((e,t)=>e.exists((e=>Je(e,t))))(t.get(),r)||(t.set(r),o(r))},mustSnap:!0}),XN=e=>Ff(Bf.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:ql([GN.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),QC.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),KN=(e,t)=>{const o=Nr([]),n=Nr([]),r=Nr(!1),s=Cc(),a=Cc(),i=e=>{const o=Ko(e);return qN(u.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=Ko(e);return qN(m.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=YN((()=>L(o.get(),(e=>i(e)))),s,(t=>{a.get().each((o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})}))})),d=YN((()=>L(n.get(),(e=>l(e)))),a,(t=>{s.get().each((o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})}))})),u=XN(c),m=XN(d),g=_i(u.asSpec()),p=_i(m.asSpec()),h=(t,o,n,r)=>{const s=n(o);GN.snapTo(t,s);((t,o,n,r)=>{const s=o.dom.getBoundingClientRect();Lt(t.element,"display");const a=ot(Re.fromDom(e.getBody())).dom.innerHeight,i=n(s),l=r(s,a);(i||l)&&Mt(t.element,"display","none")})(t,o,(e=>e[r]<0),((e,t)=>e[r]>t))},f=e=>h(g,e,i,"top"),b=e=>h(p,e,l,"bottom");Do().deviceType.isTouch()&&(e.on("TableSelectionChange",(e=>{r.get()||(mu(t,g),mu(t,p),r.set(!0)),s.set(e.start),a.set(e.finish),e.otherCells.each((t=>{o.set(t.upOrLeftCells),n.set(t.downOrRightCells),f(e.start),b(e.finish)}))})),e.on("ResizeEditor ResizeWindow ScrollContent",(()=>{s.get().each(f),a.get().each(b)})),e.on("TableSelectionClear",(()=>{r.get()&&(hu(g),hu(p),r.set(!1)),s.clear(),a.clear()})))};const JN=(e,t,o)=>{var n;const r=null!==(n=t.delimiter)&&void 0!==n?n:"›",s=t=>j(t,((t,n,s)=>{const a=((t,n,r)=>Bf.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":r,"aria-level":r+1}},components:[Si(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:ql([kw(o.isDisabled),ww()])}))(n.name,n.element,s);return 0===s?t.concat([a]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[Si(` ${r} `)]},a])}),[]);return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:ql([Th.config({mode:"flow",selector:"div[role=button]"}),xg.config({disabled:o.isDisabled}),ww(),TC.config({}),Nh.config({}),Vh("elementPathEvents",[ia(((t,o)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",(()=>Th.focusIn(t))),e.on("NodeChange",(o=>{const n=(t=>{const o=[];let n=t.length;for(;n-- >0;){const s=t[n];if(1===s.nodeType&&"BR"!==(r=s).nodeName&&!r.getAttribute("data-mce-bogus")&&"bookmark"!==r.getAttribute("data-mce-type")){const t=bS(e,s);if(t.isDefaultPrevented()||o.push({name:t.name,element:s}),t.isPropagationStopped())break}}var r;return o})(o.parents),r=n.length>0?s(n):[];Nh.set(t,r)}))}))])]),components:[]}};var ZN;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(ZN||(ZN={}));const QN=(e,t,o)=>{const n=Re.fromDom(e.getContainer()),r=((e,t,o,n,r)=>{const s={height:WF(n+t.top,cv(e),uv(e))};return o===ZN.Both&&(s.width=WF(r+t.left,lv(e),dv(e))),s})(e,t,o,Wt(n),Jt(n));le(r,((e,t)=>{h(e)&&Mt(n,t,UF(e))})),(e=>{e.dispatch("ResizeEditor")})(e)},eV=(e,t,o,n)=>{const r=Gt(20*o,20*n);return QN(e,r,t),D.some(!0)},tV=(e,t)=>{const o=(e=>{const t=Vv(e);return!1===t?ZN.None:"both"===t?ZN.Both:ZN.Vertical})(e);if(o===ZN.None)return D.none();const n=o===ZN.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return D.some(Yb("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:t.translate("Resize"),"aria-label":t.translate(n)},behaviours:[GN.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,r)=>QN(e,r,o),blockerClass:"tox-blocker"}),Th.config({mode:"special",onLeft:()=>eV(e,o,-1,0),onRight:()=>eV(e,o,1,0),onUp:()=>eV(e,o,0,-1),onDown:()=>eV(e,o,0,1)}),TC.config({}),Uh.config({})]},t.icons))},oV=(e,t)=>{const o=()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>Nh.set(e,[Si(t.translate(["{0} "+n,o[n]]))]);return Bf.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:ql([kw(t.isDisabled),ww(),TC.config({}),Nh.config({}),Ju.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Vh("wordcount-events",[da((e=>{const t=Ju.getValue(e),n="words"===t.mode?"characters":"words";Ju.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)})),ia((t=>{e.on("wordCountUpdate",(e=>{const{mode:n}=Ju.getValue(t);Ju.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)}))}))])]),eventOrder:{[Ss()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),Nv(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=v6",rel:"noopener",target:"_blank","aria-label":Lb.translate(["Powered by {0}","Tiny"])},innerHtml:'<svg width="50px" height="16px" viewBox="0 0 50 16" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.143 0c2.608.015 5.186 2.178 5.186 5.331 0 0 .077 3.812-.084 4.87-.361 2.41-2.164 4.074-4.65 4.496-1.453.284-2.523.49-3.212.623-.373.071-.634.122-.785.152-.184.038-.997.145-1.35.145-2.732 0-5.21-2.04-5.248-5.33 0 0 0-3.514.03-4.442.093-2.4 1.758-4.342 4.926-4.963 0 0 3.875-.752 4.036-.782.368-.07.775-.1 1.15-.1Zm1.826 2.8L5.83 3.989v2.393l-2.455.475v5.968l6.137-1.189V9.243l2.456-.476V2.8ZM5.83 6.382l3.682-.713v3.574l-3.682.713V6.382Zm27.173-1.64-.084-1.066h-2.226v9.132h2.456V7.743c-.008-1.151.998-2.064 2.149-2.072 1.15-.008 1.987.92 1.995 2.072v5.065h2.455V7.359c-.015-2.18-1.657-3.929-3.837-3.913a3.993 3.993 0 0 0-2.908 1.296Zm-6.3-4.266L29.16 0v2.387l-2.456.475V.476Zm0 3.2v9.132h2.456V3.676h-2.456Zm18.179 11.787L49.11 3.676H46.58l-1.612 4.527-.46 1.382-.384-1.382-1.611-4.527H39.98l3.3 9.132L42.15 16l2.732-.537ZM22.867 9.738c0 .752.568 1.075.921 1.075.353 0 .668-.047.998-.154l.537 1.765c-.23.154-.92.537-2.225.537-1.305 0-2.655-.997-2.686-2.686a136.877 136.877 0 0 1 0-4.374H18.8V3.676h1.612v-1.98l2.455-.476v2.456h2.302V5.9h-2.302v3.837Z"/>\n</svg>\n'.trim()},behaviours:ql([Uh.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}},n=()=>{const n=[],r=Pv(e),s=Rv(e),a=Nv(e)||e.hasPlugin("wordcount"),i=()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(r){const o="tox-statusbar__text-container-3-cols";return a||s?a&&!s?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[a&&!s?t:e]};return s&&n.push(JN(e,{},t)),r&&n.push((()=>{const e=Fw("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[Si(Lb.translate(["Press {0} for help",e]))]}})()),a&&n.push(o()),n.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...i()]},components:n}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const o=n(),r=tV(e,t);return o.concat(r.toArray())})()}},nV=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),rV=(e,t)=>{const o=e.inline,n=o?KF:HF,r=oy(e)?GM:rM,s=(()=>{const e=Cc(),t=Cc(),o=Cc();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=>Je(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=Cc(),i=Cc(),l=Cc(),c=Do().deviceType.isTouch()?["tox-platform-touch"]:[],d=Jv(e),u=bv(e),m=Ff({dom:{tag:"div",classes:["tox-anchorbar"]}}),g=Ff({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),p=()=>s.mainUi.get().map((e=>e.outerContainer)).bind(OI.getHeader),h=s.lazyGetInOuterOrDie("anchor bar",m.getOpt),f=s.lazyGetInOuterOrDie("bottom anchor bar",g.getOpt),b=s.lazyGetInOuterOrDie("toolbar",OI.getToolbar),v=s.lazyGetInOuterOrDie("throbber",OI.getThrobber),y=$A({popup:()=>on.fromOption(s.popupUi.get().map((e=>e.sink)),"(popup) UI has not been rendered"),dialog:()=>on.fromOption(s.dialogUi.get().map((e=>e.sink)),"UI has not been rendered")},e,h,f),x=()=>OI.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]}}),w=()=>{const t=(()=>{const t={attributes:{[Xc]:d?Yc.BottomToTop:Yc.TopToBottom}},o=OI.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:y.popup,onEscape:()=>{e.focus()}}),n=OI.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}),r=OI.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:y.popup.shared.providers,onEscape:()=>{e.focus()},type:u}),s=Kv(e),a=Yv(e),i=jv(e),l=Hv(e),c=x(),g=s||a||i,h=l?[c,o]:[o];return OI.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(g?[]:["tox-editor-header--empty"]),...t},components:q([i?h:[],s?[r]:a?[n]:[],Qv(e)?[]:[m.asSpec()]]),sticky:oy(e),editor:e,sharedBackstage:y.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[OI.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),OI.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},r=OI.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:y.popup}),s=OI.parts.viewWrapper({backstage:y.popup}),i=Fv(e)&&!o?D.some(oV(e,y.popup.shared.providers)):D.none(),l=q([d?[]:[t],o?[]:[n],d?[t]:[]]),h=OI.parts.editorContainer({components:q([l,o?[]:[g.asSpec(),...i.toArray()]])}),f=ty(e),v={role:"application",...Lb.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},w=_i(OI.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?[]:[s],r],behaviours:ql([ww(),xg.config({disableClass:"tox-tinymce--disabled"}),Th.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"})])})),S=wC(w);return a.set(S),{mothership:S,outerContainer:w}},S=t=>{const o=UF(jF(e)),n=UF((e=>$F(e).getOr(iv(e)))(e));return e.inline||(zt("div","width",n)&&Mt(t.element,"width",n),zt("div","height",o)?Mt(t.element,"height",o):Mt(t.element,"height","400px")),o},k=t=>{const{mainUi:o,popupUi:s,uiMotherships:a}=t;ce(vv(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=Xv(e),h={menuItems:l,menus:ry(e),menubar:Cv(e),toolbar:g.getOrThunk((()=>Ov(e))),allowToolbarGroups:u===Jb.floating,buttons:i,sidebar:d,views:m};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",(()=>{OI.focusMenubar(f)})),e.addShortcut("alt+F10","focus toolbar",(()=>{OI.focusToolbar(f)})),e.addCommand("ToggleToolbarDrawer",((e,t)=>{(null==t?void 0:t.skipFocus)?OI.toggleToolbarDrawerWithoutFocusing(f):OI.toggleToolbarDrawer(f)})),e.addQueryStateHandler("ToggleToolbarDrawer",(()=>OI.isToolbarDrawerToggled(f))),((e,t,o)=>{const n=(e,n)=>{H([t,...o],(t=>{t.broadcastEvent(e,n)}))},r=(e,n)=>{H([t,...o],(t=>{t.broadcastOn([e],n)}))},s=e=>r(Bu(),{target:e.target}),a=jo(),i=_c(a,"touchstart",s),l=_c(a,"touchmove",(e=>n(Ds(),e))),c=_c(a,"touchend",(e=>n(As(),e))),d=_c(a,"mousedown",s),u=_c(a,"mouseup",(e=>{0===e.raw.button&&r(Fu(),{target:e.target})})),m=e=>r(Bu(),{target:Re.fromDom(e.target)}),g=e=>{0===e.button&&r(Fu(),{target:Re.fromDom(e.target)})},p=()=>{H(e.editorManager.get(),(t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})}))},h=e=>n(Ms(),Ec(e)),f=e=>{r(Iu(),{}),n(Bs(),Ec(e))},b=pt(Re.fromDom(e.getElement())),v=Tc(b,"scroll",(o=>{requestAnimationFrame((()=>{if(null!=e.getContainer()){const r=sC(e,t.element).map((e=>[e.element,...e.others])).getOr([]);N(r,(e=>Je(e,o.target)))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Ls(),o))}}))})),y=()=>r(Iu(),{}),x=t=>{t.state&&r(Bu(),{target:Re.fromDom(e.getContainer())})},w=e=>{r(Bu(),{target:Re.fromDom(e.relatedTarget.getContainer())})};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)})),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),d.unbind(),i.unbind(),l.unbind(),c.unbind(),u.unbind(),v.unbind()})),e.on("detach",(()=>{H([t,...o],xu),H([t,...o],(e=>e.destroy()))}))})(e,o.mothership,a),r.setup(e,y.popup.shared,p),FR(e,y.popup),nN(e,y.popup.shared.getSink,y.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();H(ae(t),(o=>{const n=t[o],r=()=>xe(D.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(r())},onSetup:t=>{t.setActive(r());const o=()=>t.setActive(r());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}}})}))})(e),vB(e,v,y.popup.shared),yR(e,c,s.sink,{backstage:y.popup}),KN(e,s.sink);const b={targetNode:e.getElement(),height:S(o.outerContainer)};return n.render(e,t,h,y.popup,b)};return{popups:{backstage:y.popup,getMothership:()=>nV("popups",l)},dialogs:{backstage:y.dialog,getMothership:()=>nV("dialogs",i)},renderUI:()=>{const o=w(),n=(()=>{const t=ey(e),o=Je(xt(),t)&&"grid"===Ft(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...Lb.isRtl()?{dir:"rtl"}:{}}},behaviours:ql([ru.config({useFixed:()=>r.isDocked(p)})])},s={dom:{styles:{width:document.body.clientWidth+"px"}},events:Ks([Qs(Bs(),(e=>{Mt(e.element,"width",document.body.clientWidth+"px")}))])},a=_i(wn(n,o?s:{})),l=wC(a);return i.set(l),{sink:a,mothership:l}})(),a=ny(e)?(()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(c),attributes:{...Lb.isRtl()?{dir:"rtl"}:{}}},behaviours:ql([ru.config({useFixed:()=>r.isDocked(p),getBounds:()=>t.getPopupSinkBounds()})])},o=_i(e),n=wC(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(n);s.dialogUi.set(n),s.popupUi.set(a),s.mainUi.set(o);const d={popupUi:a,dialogUi:n,mainUi:o,uiMotherships:s.getUiMotherships()};return k(d)}}},sV=x([dr("lazySink"),yr("dragBlockClass"),Ir("getBounds",Zo),Tr("useTabstopAt",E),Tr("firstTabstop",0),Tr("eventOrder",{}),Zu("modalBehaviours",[Th]),tl("onExecute"),nl("onEscape")]),aV={sketch:w},iV=x([Dm({name:"draghandle",overrides:(e,t)=>({behaviours:ql([GN.config({mode:"mouse",getTarget:e=>Bi(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})])})}),Tm({schema:[dr("dom")],name:"title"}),Tm({factory:aV,schema:[dr("dom")],name:"close"}),Tm({factory:aV,schema:[dr("dom")],name:"body"}),Dm({factory:aV,schema:[dr("dom")],name:"footer"}),Em({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[Tr("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Tr("components",[])],name:"blocker"})]),lV=og({name:"ModalDialog",configFields:sV(),partFields:iV(),factory:(e,t,o,n)=>{const r=Cc(),s=ya("modal-events"),a={...e.eventOrder,[Is()]:[s].concat(e.eventOrder["alloy.system.attached"]||[])};return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{r.set(t);const o=e.lazySink(t).getOrDie(),s=n.blocker(),a=o.getSystem().build({...s,components:s.components.concat([Ti(t)]),behaviours:ql([Uh.config({}),Vh("dialog-blocker-events",[aa(ss(),(()=>{hB.isBlocked(t)||Th.focusIn(t)}))])])});mu(o,a),Th.focusIn(t)},hide:e=>{r.clear(),nt(e.element).each((t=>{e.getSystem().getByDom(t).each((e=>{hu(e)}))}))},getBody:t=>Um(t,e,"body"),getFooter:t=>Pm(t,e,"footer"),setIdle:e=>{hB.unblock(e)},setBusy:(e,t)=>{hB.block(e,t)}},eventOrder:a,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:em(e.modalBehaviours,[Nh.config({}),Th.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),hB.config({getRoot:r.get}),Vh(s,[ia((t=>{((e,t)=>{const o=_t(e,"id").fold((()=>{const e=ya("dialog-label");return kt(t,"id",e),e}),w);kt(e,"aria-labelledby",o)})(t.element,Um(t,e,"title").element)}))])])}},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)}}}),cV=zn([Jy,Zy].concat(qx)),dV=qn,uV=[Cx("button"),ux,Mr("align","end",["start","end"]),yx,vx,kr("buttonType",["primary","secondary"])],mV=[...uV,ex],gV=[pr("type",["submit","cancel","custom"]),...mV],pV=[pr("type",["menu"]),dx,mx,ux,vr("items",cV),...uV],hV=[...uV,pr("type",["togglebutton"]),gr("tooltip"),ux,dx,Br("active",!1)],fV=sr("type",{submit:gV,cancel:gV,custom:gV,menu:pV,togglebutton:hV}),bV=[Jy,ex,pr("level",["info","warn","error","success"]),ox,Tr("url","")],vV=zn(bV),yV=[Jy,ex,vx,Cx("button"),ux,bx,kr("buttonType",["primary","secondary","toolbar"]),yx],xV=zn(yV),wV=[Jy,Zy],SV=wV.concat([gx]),kV=wV.concat([Qy,vx]),CV=zn(kV),OV=qn,_V=SV.concat([xx("auto")]),TV=zn(_V),EV=Un([nx,ex,ox]),DV=SV.concat([Ar("storageKey","default")]),AV=zn(DV),MV=Gn,BV=zn(SV),IV=Gn,FV=wV.concat([Ar("tag","textarea"),gr("scriptId"),gr("scriptUrl"),((e,t)=>Er(e,t,Kn))("settings",void 0)]),RV=wV.concat([Ar("tag","textarea"),hr("init")]),NV=Qn((e=>tr("customeditor.old",Vn(RV),e).orThunk((()=>tr("customeditor.new",Vn(FV),e))))),VV=Gn,zV=zn(SV),LV=Ln(Mn),HV=e=>[Jy,mr("columns"),e],PV=[Jy,gr("html"),Mr("presets","presentation",["presentation","document"])],UV=zn(PV),WV=SV.concat([Br("border",!1),Br("sandboxed",!0),Br("streamContent",!1),Br("transparent",!0)]),jV=zn(WV),$V=Gn,GV=zn(wV.concat([Sr("height")])),qV=zn([gr("url"),wr("zoom"),wr("cachedWidth"),wr("cachedHeight")]),YV=SV.concat([Sr("inputMode"),Sr("placeholder"),Br("maximized",!1),vx]),XV=zn(YV),KV=Gn,JV=e=>[Jy,Qy,e,Mr("align","start",["start","center","end"])],ZV=[ex,nx],QV=[ex,vr("items",ar(0,(()=>ez)))],ez=Hn([zn(ZV),zn(QV)]),tz=SV.concat([vr("items",ez),vx]),oz=zn(tz),nz=Gn,rz=SV.concat([br("items",[ex,nx]),Dr("size",1),vx]),sz=zn(rz),az=Gn,iz=SV.concat([Br("constrain",!0),vx]),lz=zn(iz),cz=zn([gr("width"),gr("height")]),dz=wV.concat([Qy,Dr("min",0),Dr("max",0)]),uz=zn(dz),mz=$n,gz=[Jy,vr("header",Gn),vr("cells",Ln(Gn))],pz=zn(gz),hz=SV.concat([Sr("placeholder"),Br("maximized",!1),vx]),fz=zn(hz),bz=Gn,vz=[pr("type",["directory","leaf"]),tx,gr("id"),xr("menu",XM)],yz=zn(vz),xz=vz.concat([vr("children",ar(0,(()=>Zn("type",{directory:wz,leaf:yz}))))]),wz=zn(xz),Sz=Zn("type",{directory:wz,leaf:yz}),kz=[Jy,vr("items",Sz),Cr("onLeafAction"),Cr("onToggleExpand"),Fr("defaultExpandedIds",[],Gn),Sr("defaultSelectedId")],Cz=zn(kz),Oz=SV.concat([Mr("filetype","file",["image","media","file"]),vx,Sr("picker_text")]),_z=zn(Oz),Tz=zn([nx,wx]),Ez=e=>ir("items","items",{tag:"required",process:{}},Ln(Qn((t=>tr(`Checking item of ${e}`,Dz,t).fold((e=>on.error(rr(e))),(e=>on.value(e))))))),Dz=Rn((()=>{return Zn("type",{alertbanner:vV,bar:zn((e=Ez("bar"),[Jy,e])),button:xV,checkbox:CV,colorinput:AV,colorpicker:BV,dropzone:zV,grid:zn(HV(Ez("grid"))),iframe:jV,input:XV,listbox:oz,selectbox:sz,sizeinput:lz,slider:uz,textarea:fz,urlinput:_z,customeditor:NV,htmlpanel:UV,imagepreview:GV,collection:TV,label:zn(JV(Ez("label"))),table:pz,tree:Cz,panel:Mz});var e})),Az=[Jy,Tr("classes",[]),vr("items",Dz)],Mz=zn(Az),Bz=[Cx("tab"),tx,vr("items",Dz)],Iz=[Jy,br("tabs",Bz)],Fz=zn(Iz),Rz=mV,Nz=fV,Vz=zn([gr("title"),ur("body",Zn("type",{panel:Mz,tabpanel:Fz})),Ar("size","normal"),Fr("buttons",[],Nz),Tr("initialData",{}),Ir("onAction",b),Ir("onChange",b),Ir("onSubmit",b),Ir("onClose",b),Ir("onCancel",b),Ir("onTabChange",b)]),zz=zn([pr("type",["cancel","custom"]),...Rz]),Lz=zn([gr("title"),gr("url"),wr("height"),wr("width"),Or("buttons",zz),Ir("onAction",b),Ir("onCancel",b),Ir("onClose",b),Ir("onMessage",b)]),Hz=e=>a(e)?[e].concat(Y(fe(e),Hz)):l(e)?Y(e,Hz):[],Pz=e=>s(e.type)&&s(e.name),Uz={checkbox:OV,colorinput:MV,colorpicker:IV,dropzone:LV,input:KV,iframe:$V,imagepreview:qV,selectbox:az,sizeinput:cz,slider:mz,listbox:nz,size:cz,textarea:bz,urlinput:Tz,customeditor:VV,collection:EV,togglemenuitem:dV},Wz=e=>{const t=(e=>U(Hz(e),Pz))(e),o=Y(t,(e=>(e=>D.from(Uz[e.type]))(e).fold((()=>[]),(t=>[ur(e.name,t)]))));return zn(o)},jz=e=>{var t;return{internalDialog:or(tr("dialog",Vz,e)),dataValidator:Wz(e),initialData:null!==(t=e.initialData)&&void 0!==t?t:{}}},$z={open:(e,t)=>{const o=jz(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(or(tr("dialog",Lz,t))),redial:e=>jz(e)};var Gz=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each((e=>{const r=e(o,n);t.set(r)})),e.renderComponents.each((r=>{const s=r(n,t.get());(e.reuseDom?Dh:Eh)(o,s)}))};return Ks([Qs(ws(),((t,n)=>{const r=n;if(!r.universal){const n=e.channel;R(r.channels,n)&&o(t,r.data)}})),ia(((t,n)=>{e.initialData.each((e=>{o(t,e)}))}))])}});var qz=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),Yz=[dr("channel"),yr("renderComponents"),yr("updateState"),yr("initialData"),Br("reuseDom",!0)];const Xz=Xl({fields:Yz,name:"reflecting",active:Gz,apis:qz,state:Object.freeze({__proto__:null,init:()=>{const e=Nr(D.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(D.none())}}})}),Kz=e=>{const t=[],o={};return le(e,((e,n)=>{e.fold((()=>{t.push(n)}),(e=>{o[n]=e}))})),t.length>0?on.error(t):on.value(o)},Jz=(e,t,o)=>{const n=Ff(Y_.sketch((n=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:L(e.items,(e=>MD(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:ql([Th.config({mode:"acyclic",useTabstopAt:C(ST)}),nT(n),aT(n,{postprocess:e=>Kz(e).fold((e=>(console.error(e),{})),w)}),Vh("dialog-body-panel",[Qs(ss(),((e,t)=>{e.getSystem().broadcastOn([ET],{newFocus:D.some(t.event.target)})}))])])}},Zz=tg({name:"TabButton",configFields:[Tr("uid",void 0),dr("value"),ir("dom","dom",On((()=>({attributes:{role:"tab",id:ya("aria"),"aria-selected":"false"}}))),Wn()),yr("action"),Tr("domModification",{}),Zu("tabButtonBehaviours",[Uh,Th,Ju]),dr("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:Qh(e.action),behaviours:em(e.tabButtonBehaviours,[Uh.config({}),Th.config({mode:"execution",useSpace:!0,useEnter:!0}),Ju.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),Qz=x([dr("tabs"),dr("dom"),Tr("clickToDismiss",!1),Zu("tabbarBehaviours",[Mg,Th]),Zi(["tabClass","selectedClass"])]),eL=Am({factory:Zz,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Mg.dehighlight(e,t),$s(e,Ps(),{tabbar:e,button:t})},o=(e,t)=>{Mg.highlight(e,t),$s(e,Hs(),{tabbar:e,button:t})};return{action:n=>{const r=n.getSystem().getByUid(e.uid).getOrDie(),s=Mg.isHighlighted(r,n);(s&&e.clickToDismiss?t:s?b:o)(r,n)},domModification:{classes:[e.markers.tabClass]}}}}),tL=x([eL]),oL=og({name:"Tabbar",configFields:Qz(),partFields:tL(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:em(e.tabbarBehaviours,[Mg.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{kt(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{kt(t.element,"aria-selected","false")}}),Th.config({mode:"flow",getInitial:e=>Mg.getHighlighted(e).map((e=>e.element)),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),nL=tg({name:"Tabview",configFields:[Zu("tabviewBehaviours",[Nh])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:em(e.tabviewBehaviours,[Nh.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),rL=x([Tr("selectFirst",!0),el("onChangeTab"),el("onDismissTab"),Tr("tabs",[]),Zu("tabSectionBehaviours",[])]),sL=Tm({factory:oL,schema:[dr("dom"),fr("markers",[dr("tabClass"),dr("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),aL=Tm({factory:nL,name:"tabview"}),iL=x([sL,aL]),lL=og({name:"TabSection",configFields:rL(),partFields:iL(),factory:(e,t,o,n)=>{const r=(t,o)=>{Pm(t,e,"tabbar").each((e=>{o(e).each(Gs)}))};return{uid:e.uid,dom:e.dom,components:t,behaviours:Qu(e.tabSectionBehaviours),events:Ks(q([e.selectFirst?[ia(((e,t)=>{r(e,Mg.getFirst)}))]:[],[Qs(Hs(),((t,o)=>{(t=>{const o=Ju.getValue(t);Pm(t,e,"tabview").each((n=>{const r=$(e.tabs,(e=>e.value===o));r.each((o=>{const r=o.view();_t(t.element,"id").each((e=>{kt(n.element,"aria-labelledby",e)})),Nh.set(n,r),e.onChangeTab(n,t,r)}))}))})(o.event.button)})),Qs(Ps(),((t,o)=>{const n=o.event.button;e.onDismissTab(t,n)}))]])),apis:{getViewItems:t=>Pm(t,e,"tabview").map((e=>Nh.contents(e))).getOr([]),showTab:(e,t)=>{r(e,(e=>{const o=Mg.getCandidates(e);return $(o,(e=>Ju.getValue(e)===t)).filter((t=>!Mg.isHighlighted(e,t)))}))}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),cL=(e,t)=>{Mt(e,"height",t+"px"),Mt(e,"flex-basis",t+"px")},dL=(e,t,o)=>{Bi(e,'[role="dialog"]').each((e=>{Fi(e,'[role="tablist"]').each((n=>{o.get().map((o=>(Mt(t,"height","0"),Mt(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=tt(e).dom,r=Bi(e,".tox-dialog-wrap").getOr(e);let s;s="fixed"===Ft(r,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const a=Wt(t),i=t.dom.offsetLeft>=o.dom.offsetLeft+Jt(o)?Math.max(Wt(o),a):a,l=parseInt(Ft(e,"margin-top"),10)||0,c=parseInt(Ft(e,"margin-bottom"),10)||0;return s-(Wt(e)+l+c-i)})(e,t,n))))).each((e=>{cL(t,e)}))}))}))},uL=e=>Fi(e,'[role="tabpanel"]'),mL=e=>{const t=Cc(),o=[ia((o=>{const n=o.element;uL(n).each((r=>{Mt(r,"visibility","hidden"),o.getSystem().getByDom(r).toOptional().each((o=>{const n=((e,t,o)=>L(e,((n,r)=>{Nh.set(o,e[r].view());const s=t.dom.getBoundingClientRect();return Nh.set(o,[]),s.height})))(e,r,o),s=(e=>oe(ee(e,((e,t)=>e>t?-1:e<t?1:0))))(n);s.fold(t.clear,t.set)})),dL(n,r,t),Lt(r,"visibility"),((e,t)=>{oe(e).each((e=>lL.showTab(t,e.value)))})(e,o),requestAnimationFrame((()=>{dL(n,r,t)}))}))})),Qs(Bs(),(e=>{const o=e.element;uL(o).each((e=>{dL(o,e,t)}))})),Qs(PC,((e,o)=>{const n=e.element;uL(n).each((e=>{const o=rc(pt(e));Mt(e,"visibility","hidden");const r=Nt(e,"height").map((e=>parseInt(e,10)));Lt(e,"height"),Lt(e,"flex-basis");const s=e.dom.getBoundingClientRect().height;r.forall((e=>s>e))?(t.set(s),dL(n,e,t)):r.each((t=>{cL(e,t)})),Lt(e,"visibility"),o.each(tc)}))}))];return{extraEvents:o,selectFirst:!1}},gL="send-data-to-section",pL="send-data-to-view",hL=(e,t,o)=>{const n=Nr({}),r=e=>{const t=Ju.getValue(e),o=Kz(t).getOr({}),r=n.get(),s=wn(r,o);n.set(s)},s=e=>{const t=n.get();Ju.setValue(e,t)},a=Nr(null),i=L(e.tabs,(e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[Si(o.shared.providers.translate(e.title))],view:()=>[Y_.sketch((n=>({dom:{tag:"div",classes:["tox-form"]},components:L(e.items,(e=>MD(n,e,t,o))),formBehaviours:ql([Th.config({mode:"acyclic",useTabstopAt:C(ST)}),Vh("TabView.form.events",[ia(s),la(r)]),Ql.config({channels:Hr([{key:gL,value:{onReceive:r}},{key:pL,value:{onReceive:s}}])})])})))]}))),l=mL(i);return lL.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=Ju.getValue(t);$s(e,HC,{name:n,oldName:a.get()}),a.set(n)},tabs:i,components:[lL.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[oL.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:ql([TC.config({})])}),lL.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:ql([Vh("tabpanel",l.extraEvents),Th.config({mode:"acyclic"}),ag.config({find:e=>oe(lL.getViewItems(e))}),iT(D.none(),(e=>(e.getSystem().broadcastOn([gL],{}),n.get())),((e,t)=>{n.set(t),e.getSystem().broadcastOn([pL],{})}))])})},fL=(e,t,o,n,r)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map((e=>({id:e}))).getOr({}),...r?{"aria-live":"polite"}:{}}},components:[],behaviours:ql([rT(0),Xz.config({channel:`${OT}-${t}`,updateState:(e,t)=>D.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[hL(t,e.initialData,n)]:[Jz(t,e.initialData,n)]},initialData:e})])}),bL=tv.deviceType.isTouch(),vL=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),yL=(e,t)=>lV.parts.close(Bf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:ql([TC.config({})])})),xL=()=>lV.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),wL=(e,t)=>lV.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:If(`<p>${zb(t.translate(e))}</p>`)}]}]}),SL=e=>lV.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),kL=(e,t)=>[xC.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),xC.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],CL=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",r=t+"__disable-scroll";return lV.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),D.some(!0)),useTabstopAt:e=>!ST(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:If(`<div class="${o}"></div>`),components:[{dom:{tag:"div",classes:bL?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:ql([Uh.config({}),Vh("dialog-events",e.dialogEvents.concat([aa(ss(),((e,t)=>{hB.isBlocked(e)||Th.focusIn(e)})),Qs(Vs(),((e,t)=>{e.getSystem().broadcastOn([ET],{newFocus:t.event.newFocus})}))])),Vh("scroll-lock",[ia((()=>{ti(xt(),r)})),la((()=>{ni(xt(),r)}))]),...e.extraBehaviours]),eventOrder:{[Ss()]:["dialog-events"],[Is()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[Fs()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},OL=e=>Bf.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),title:e.translate("Close")}},buttonBehaviours:ql([TC.config({})]),components:[Yb("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{js(e,RC)}}),_L=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__title"],attributes:{...o.map((e=>({id:e}))).getOr({})}},components:[],behaviours:ql([Xz.config({channel:`${CT}-${t}`,initialData:e,renderComponents:e=>[Si(n.translate(e.title))]})])}),TL=()=>({dom:If('<div class="tox-dialog__draghandle"></div>')}),EL=(e,t,o)=>((e,t,o)=>{const n=lV.parts.title(_L(e,t,D.none(),o)),r=lV.parts.draghandle(TL()),s=lV.parts.close(OL(o)),a=[n].concat(e.draggable?[r]:[]).concat([s]);return xC.sketch({dom:If('<div class="tox-dialog__header"></div>'),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:If('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}),AL=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=Fi(e().element,".tox-dialog__header").map((e=>Wt(e)));lV.setBusy(e(),((e,r)=>DL(o.message,r,t,n)))},onUnblock:()=>{lV.setIdle(e())}}),ML="tox-dialog--fullscreen",BL="tox-dialog--width-lg",IL="tox-dialog--width-md",FL=e=>{switch(e){case"large":return D.some(BL);case"medium":return D.some(IL);default:return D.none()}},RL=(e,t)=>{const o=Re.fromDom(t.element.dom);si(o,ML)||(ii(o,[BL,IL]),FL(e).each((e=>ti(o,e))))},NL=(e,t)=>{const o=Re.fromDom(e.element.dom),n=li(o),r=$(n,(e=>e===BL||e===IL)).or(FL(t));((e,t)=>{H(t,(t=>{ri(e,t)}))})(o,[ML,...r.toArray()])},VL=(e,t,o)=>_i(CL({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[cT({}),...e.extraBehaviours],onEscape:e=>{js(e,RC)},dialogEvents:t,eventOrder:{[ws()]:[Xz.name(),Ql.name()],[Is()]:["scroll-lock",Xz.name(),"messages","dialog-events","alloy.base.behaviour"],[Fs()]:["alloy.base.behaviour","dialog-events","messages",Xz.name(),"scroll-lock"]}})),zL=(e,t={})=>L(e,(e=>"menu"===e.type?(e=>{const o=L(e.items,(e=>{const o=be(t,e.name).getOr(Nr(!1));return{...e,storage:o}}));return{...e,items:o}})(e):e)),LL=e=>j(e,((e,t)=>{if("menu"===t.type){return j(t.items,((e,t)=>(e[t.name]=t.storage,e)),e)}return e}),{}),HL=(e,t)=>[na(ss(),wT),e(FC,((e,o,n,r)=>{rc(pt(r.element)).fold(b,oc),t.onClose(),o.onClose()})),e(RC,((e,t,o,n)=>{t.onCancel(e),js(n,FC)})),Qs(LC,((e,o)=>t.onUnblock())),Qs(zC,((e,o)=>t.onBlock(o.event)))],PL=(e,t,o)=>{const n=(t,o)=>Qs(t,((t,n)=>{r(t,((r,s)=>{o(e(),r,n.event,t)}))})),r=(e,t)=>{Xz.getState(e).get().each((o=>{t(o.internalDialog,e)}))};return[...HL(n,t),n(VC,((e,t)=>t.onSubmit(e))),n(IC,((e,t,o)=>{t.onChange(e,{name:o.name})})),n(NC,((e,t,n,r)=>{const s=()=>r.getSystem().isConnected()?Th.focusIn(r):void 0,a=e=>Tt(e,"disabled")||_t(e,"aria-disabled").exists((e=>"true"===e)),i=pt(r.element),l=rc(i);t.onAction(e,{name:n.name,value:n.value}),rc(i).fold(s,(e=>{a(e)||l.exists((t=>Ze(e,t)&&a(t)))?s():o().toOptional().filter((t=>!Ze(t.element,e))).each(s)}))})),n(HC,((e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})})),la((t=>{const o=e();Ju.setValue(t,o.getData())}))]},UL=(e,t)=>{const o=t.map((e=>e.footerButtons)).getOr([]),n=P(o,(e=>"start"===e.align)),r=(e,t)=>xC.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:L(t,(e=>e.memento.asSpec()))});return[r("start",n.pass),r("end",n.fail)]},WL=(e,t,o)=>({dom:If('<div class="tox-dialog__footer"></div>'),components:[],behaviours:ql([Xz.config({channel:`${_T}-${t}`,initialData:e,updateState:(e,t)=>{const n=L(t.buttons,(e=>{const t=Ff(((e,t)=>gD(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}}));return D.some({lookupByName:t=>((e,t,o)=>$(t,(e=>e.name===o)).bind((t=>t.memento.getOpt(e))))(e,n,t),footerButtons:n})},renderComponents:UL})])}),jL=(e,t,o)=>lV.parts.footer(WL(e,t,o)),$L=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=ag.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return Y_.getField(o,t).orThunk((()=>{const o=e.getFooter().bind((e=>Xz.getState(e).get()));return o.bind((e=>e.lookupByName(t)))}))}return D.none()},GL=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},r={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...Ju.getValue(n),...ce(o,(e=>e.get()))}},setData:t=>{n((n=>{const s=r.getData(),a=wn(s,t),i=((e,t)=>{const o=e.getRoot();return Xz.getState(o).get().map((e=>or(tr("data",e.dataValidator,t)))).getOr(t)})(e,a),l=e.getFormWrapper();Ju.setValue(l,i),le(o,((e,t)=>{ve(a,t)&&e.set(a[t])}))}))},setEnabled:(t,o)=>{$L(e,t).each(o?xg.enable:xg.disable)},focus:t=>{$L(e,t).each(Uh.focus)},block:e=>{if(!s(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n((t=>{$s(t,zC,{message:e})}))},unblock:()=>{n((e=>{js(e,LC)}))},showTab:t=>{n((o=>{const n=e.getBody();Xz.getState(n).get().exists((e=>e.isTabPanel()))&&ag.getCurrent(n).each((e=>{lL.showTab(e,t)}))}))},redial:s=>{n((n=>{const a=e.getId(),i=t(s),l=zL(i.internalDialog.buttons,o);n.getSystem().broadcastOn([`${kT}-${a}`],i),n.getSystem().broadcastOn([`${CT}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${OT}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${_T}-${a}`],{...i.internalDialog,buttons:l}),r.setData(i.initialData)}))},close:()=>{n((e=>{js(e,FC)}))},toggleFullscreen:e.toggleFullscreen};return r},qL=(e,t,o)=>{const n=ya("dialog"),r=e.internalDialog,s=EL(r.title,n,o),a=Nr(r.size),i=FL(a.get()).toArray(),l=((e,t,o)=>{const n=fL(e,t,D.none(),o,!1);return lV.parts.body(n)})({body:r.body,initialData:r.initialData},n,o),c=zL(r.buttons),d=LL(c),u=Ce(0!==c.length,jL({buttons:c},n,o)),m=PL((()=>f),AL((()=>p),o.shared.providers,t),o.shared.getSink),g={id:n,header:s,body:l,footer:u,extraClasses:i,extraBehaviours:[Xz.config({channel:`${kT}-${n}`,updateState:(e,t)=>(a.set(t.internalDialog.size),RL(t.internalDialog.size,e),D.some(t)),initialData:e})],extraStyles:{}},p=VL(g,m,o),h={getId:x(n),getRoot:x(p),getBody:()=>lV.getBody(p),getFooter:()=>lV.getFooter(p),getFormWrapper:()=>{const e=lV.getBody(p);return ag.getCurrent(e).getOr(e)},toggleFullscreen:()=>{NL(p,a.get())}},f=GL(h,t.redial,d);return{dialog:p,instanceApi:f}},YL=(e,t,o,n=!1,r)=>{const s=ya("dialog"),a=ya("dialog-label"),i=ya("dialog-content"),l=e.internalDialog,c=Nr(l.size),d=FL(c.get()).toArray(),u=Ff(((e,t,o,n)=>xC.sketch({dom:If('<div class="tox-dialog__header"></div>'),components:[_L(e,t,D.some(o),n),TL(),OL(n)],containerBehaviours:ql([GN.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>Ri(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))({title:l.title,draggable:!0},s,a,o.shared.providers)),m=Ff(((e,t,o,n,r)=>fL(e,t,D.some(o),n,r))({body:l.body,initialData:l.initialData},s,i,o,n)),g=zL(l.buttons),p=LL(g),h=Ce(0!==g.length,Ff(((e,t,o)=>WL(e,t,o))({buttons:g},s,o))),f=PL((()=>v),{onBlock:e=>{hB.block(b,((t,n)=>{const r=u.getOpt(b).map((e=>Wt(e.element)));return DL(e.message,n,o.shared.providers,r)}))},onUnblock:()=>{hB.unblock(b)},onClose:()=>t.closeWindow()},o.shared.getSink),b=_i({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog","aria-labelledby":a}},eventOrder:{[ws()]:[Xz.name(),Ql.name()],[Ss()]:["execute-on-form"],[Is()]:["reflecting","execute-on-form"]},behaviours:ql([Th.config({mode:"cyclic",onEscape:e=>(js(e,FC),D.some(!0)),useTabstopAt:e=>!ST(e)&&("button"!==Pe(e)||"disabled"!==Ot(e,"disabled")),firstTabstop:1}),Xz.config({channel:`${kT}-${s}`,updateState:(e,t)=>(c.set(t.internalDialog.size),RL(t.internalDialog.size,e),r(),D.some(t)),initialData:e}),Uh.config({}),Vh("execute-on-form",f.concat([aa(ss(),((e,t)=>{Th.focusIn(e)})),Qs(Vs(),((e,t)=>{e.getSystem().broadcastOn([ET],{newFocus:t.event.newFocus})}))])),hB.config({getRoot:()=>D.some(b)}),Nh.config({}),cT({})]),components:[u.asSpec(),m.asSpec(),...h.map((e=>e.asSpec())).toArray()]}),v=GL({getId:x(s),getRoot:x(b),getFooter:()=>h.map((e=>e.get(b))),getBody:()=>m.get(b),getFormWrapper:()=>{const e=m.get(b);return ag.getCurrent(e).getOr(e)},toggleFullscreen:()=>{NL(b,c.get())}},t.redial,p);return{dialog:b,instanceApi:v}};var XL=tinymce.util.Tools.resolve("tinymce.util.URI");const KL=["insertContent","setContent","execCommand","close","block","unblock"],JL=e=>a(e)&&-1!==KL.indexOf(e.mceAction),ZL=(e,t,o,n)=>{const r=ya("dialog"),i=EL(e.title,r,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[yT(D.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:ql([TC.config({}),Uh.config({})])})]}],behaviours:ql([Th.config({mode:"acyclic",useTabstopAt:C(ST)})])};return lV.parts.body(t)})(e),c=e.buttons.bind((e=>0===e.length?D.none():D.some(jL({buttons:e},r,n)))),u=((e,t)=>{const o=(t,o)=>Qs(t,((t,r)=>{n(t,((n,s)=>{o(e(),n,r.event,t)}))})),n=(e,t)=>{Xz.getState(e).get().each((o=>{t(o,e)}))};return[...HL(o,t),o(NC,((e,t,o)=>{t.onAction(e,{name:o.name})}))]})((()=>x),AL((()=>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 XL(e.url,{base_uri:new XL(window.location.href)}),f=`${h.protocol}://${h.host}${h.port?":"+h.port:""}`,b=kc(),v=[Xz.config({channel:`${kT}-${r}`,updateState:(e,t)=>D.some(t),initialData:e}),Vh("messages",[ia((()=>{const t=_c(Re.fromDom(window),"message",(t=>{if(h.isSameOrigin(new XL(t.raw.origin))){const n=t.raw.data;JL(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=>!JL(e)&&a(e)&&ve(e,"mceAction"))(n)&&e.onMessage(x,n)}}));b.set(t)})),la(b.clear)]),Ql.config({channels:{[TT]:{onReceive:(e,t)=>{Fi(e.element,"iframe").each((e=>{const o=e.dom.contentWindow;g(o)&&o.postMessage(t,f)}))}}}})],y=VL({id:r,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(!s(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t((t=>{$s(t,zC,{message:e})}))},unblock:()=>{t((e=>{js(e,LC)}))},close:()=>{t((e=>{js(e,FC)}))},sendMessage:e=>{t((t=>{t.getSystem().broadcastOn([TT],e)}))}}})(y);return{dialog:y,instanceApi:x}},QL=(e,t)=>or(tr("data",t,e)),eH=e=>iC(e,".tox-alert-dialog")||iC(e,".tox-confirm-dialog"),tH=(e,t,o)=>t&&o?[]:[NM.config({contextual:{lazyContext:()=>D.some(Xo(Re.fromDom(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:t=>sC(e,t.element).map((e=>({bounds:aC(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Yt(e.element).top})}))).getOrThunk((()=>({bounds:Zo(),optScrollEnv:D.none()})))})],oH=e=>{const t=e.editor,o=oy(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const r=()=>{lV.hide(l),n()},s=Ff(gD({name:"close-alert",text:"OK",primary:!0,buttonType:D.some("primary"),align:"end",enabled:!0,icon:D.none()},"cancel",e)),a=xL(),i=yL(r,t.providers),l=_i(CL({lazySink:()=>t.getSink(),header:vL(a,i),body:wL(o,t.providers),footer:D.some(SL(kL([],[s.asSpec()]))),onEscape:r,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Qs(RC,r)],eventOrder:{}}));lV.show(l);const c=s.get(l);Uh.focus(c)}}})(e.backstages.dialog),r=(e=>{const t=e.shared;return{open:(o,n)=>{const r=e=>{lV.hide(c),n(e)},s=Ff(gD({name:"yes",text:"Yes",primary:!0,buttonType:D.some("primary"),align:"end",enabled:!0,icon:D.none()},"submit",e)),a=gD({name:"no",text:"No",primary:!1,buttonType:D.some("secondary"),align:"end",enabled:!0,icon:D.none()},"cancel",e),i=xL(),l=yL((()=>r(!1)),t.providers),c=_i(CL({lazySink:()=>t.getSink(),header:vL(i,l),body:wL(o,t.providers),footer:D.some(SL(kL([],[a,s.asSpec()]))),onEscape:()=>r(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Qs(RC,(()=>r(!1))),Qs(VC,(()=>r(!0)))],eventOrder:{}}));lV.show(c);const d=s.get(c);Uh.focus(d)}}})(e.backstages.dialog),s=(o,n)=>$z.openUrl((o=>{const r=ZL(o,{closeWindow:()=>{lV.hide(r.dialog),n(r.instanceApi)}},t,e.backstages.dialog);return lV.show(r.dialog),r.instanceApi}),o),a=(t,o)=>$z.open(((t,n,r)=>{const s=n,a=qL({dataValidator:r,initialData:s,internalDialog:t},{redial:$z.redial,closeWindow:()=>{lV.hide(a.dialog),o(a.instanceApi)}},e.backstages.dialog);return lV.show(a.dialog),a.instanceApi.setData(s),a.instanceApi}),t),i=(n,r,s,a)=>$z.open(((n,i,l)=>{const c=QL(i,l),d=Cc(),u=e.backstages.popup.shared.header.isPositionedAtTop(),m=()=>d.on((e=>{Af.reposition(e),o&&u||NM.refresh(e)})),g=YL({dataValidator:l,initialData:c,internalDialog:n},{redial:$z.redial,closeWindow:()=>{d.on(Af.hide),t.off("ResizeEditor",m),d.clear(),s(g.instanceApi)}},e.backstages.popup,a.ariaAttrs,m),p=_i(Af.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},...u?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ql([Vh("window-manager-inline-events",[Qs(Rs(),((e,t)=>{js(g.dialog,RC)}))]),...tH(t,o,u)]),isExtraPart:(e,t)=>eH(t)}));d.set(p);return Af.showWithinBounds(p,Ti(g.dialog),{anchor:r},(()=>{const e=t.inline?xt():Re.fromDom(t.getContainer()),o=Xo(e);return D.some(o)})),o&&u||(NM.refresh(p),t.on("ResizeEditor",m)),g.instanceApi.setData(c),Th.focusIn(g.dialog),g.instanceApi}),n),l=(o,n,r,s)=>$z.open(((o,a,i)=>{const l=QL(a,i),c=Cc(),d=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>c.on((e=>{Af.reposition(e),NM.refresh(e)})),m=YL({dataValidator:i,initialData:l,internalDialog:o},{redial:$z.redial,closeWindow:()=>{c.on(Af.hide),t.off("ResizeEditor ScrollWindow ElementScroll",u),c.clear(),r(m.instanceApi)}},e.backstages.popup,s.ariaAttrs,u),g=_i(Af.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:s.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:ql([Vh("window-manager-inline-events",[Qs(Rs(),((e,t)=>{js(m.dialog,RC)}))]),NM.config({contextual:{lazyContext:()=>D.some(Xo(Re.fromDom(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>sC(t,e.element).map((e=>({bounds:aC(e),optScrollEnv:D.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Yt(e.element).top})}))).getOrThunk((()=>({bounds:Zo(),optScrollEnv:D.none()})))})]),isExtraPart:(e,t)=>eH(t)}));c.set(g);return Af.showWithinBounds(g,Ti(m.dialog),{anchor:n},(()=>e.backstages.popup.shared.getSink().toOptional().bind((e=>{const o=sC(t,e.element).map((e=>aC(e))).getOr(Zo()),n=Xo(Re.fromDom(t.getContentAreaContainer())),r=Jo(n,o);return D.some(Yo(r.x,r.y,r.width,r.height-15))})))),NM.refresh(g),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",u),m.instanceApi.setData(l),Th.focusIn(m.dialog),m.instanceApi}),o);return{open:(t,o,n)=>{if(!u(o)){if("toolbar"===o.inline)return i(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return l(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return i(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return a(t,n)},openUrl:(e,t)=>s(e,t),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{r.open(e,t)}}},nH=e=>{rv(e),(e=>{const t=e.options.register,o=e=>f(e,s)?{value:FS(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:zS(e)}),t("color_cols_foreground",{processor:n,default:LS(e,BS)}),t("color_cols_background",{processor:n,default:LS(e,IS)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:NS}),t("color_default_background",{processor:"string",default:NS})})(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}:s(e)||f(e,s)?{value:RR(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)};Qo.add("silver",(e=>{nH(e);let t=()=>Zo();const{dialogs:o,popups:n,renderUI:r}=rV(e,{getPopupSinkBounds:()=>t()});tC(e,n.backstage.shared);const s=oH({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}});return{renderUI:()=>{const o=r();return sC(e,n.getMothership().element).each((e=>{t=()=>aC(e)})),o},getWindowManagerImpl:x(s),getNotificationManagerImpl:()=>((e,t,o)=>{const n=t.backstage.shared,r=()=>{const t=Xo(Re.fromDom(e.getContentAreaContainer())),o=Zo(),n=vl(o.x,t.x,t.right),r=vl(o.y,t.y,t.bottom),s=Math.max(t.right,o.right),a=Math.max(t.bottom,o.bottom);return D.some(Yo(n,r,s-n,a-r))};return{open:(t,s)=>{const a=()=>{s(),Af.hide(l)},i=_i(Kb.sketch({text:t.text,level:R(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,closeButton:t.closeButton,onAction:a,iconProvider:n.providers.icons,translationProvider:n.providers.translate})),l=_i(Af.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:n.getSink,fireDismissalEventInstead:{},...n.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}}}));o.add(l),h(t.timeout)&&t.timeout>0&&Mf.setEditorTimeout(e,(()=>{a()}),t.timeout);const c={close:a,reposition:()=>{const t=Ti(i),o={maxHeightFunction:Lc()},s=e.notificationManager.getNotifications();if(s[0]===c){const e={...n.anchors.banner(),overrides:o};Af.showWithinBounds(l,t,{anchor:e},r)}else F(s,c).each((e=>{const n=s[e-1].getEl(),a={type:"node",root:xt(),node:D.some(Re.fromDom(n)),overrides:o,layouts:{onRtl:()=>[Bl],onLtr:()=>[Bl]}};Af.showWithinBounds(l,t,{anchor:a},r)}))},text:e=>{Kb.updateText(i,e)},settings:t,getEl:()=>i.element.dom,progressBar:{value:e=>{Kb.updateProgress(i,e)}}};return c},close:e=>{e.close()},getArgs:e=>e.settings}})(e,{backstage:n.backstage},n.getMothership())}}))}()),e}export{o as __require};
2
+ //# sourceMappingURL=theme.mjs.map