opentiny 6.9.33 → 6.9.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/themes/silver/theme.js +1019 -967
- package/themes/silver/theme.min.js +366 -1
- package/tinymce.js +1019 -967
- package/tinymce.min.js +366 -1
|
@@ -1,4 +1,369 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TinyMCE version 7.0.0 (TBD)
|
|
3
3
|
*/
|
|
4
|
-
!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,(e,t)=>t.isPrototypeOf(e))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,(t,o)=>e(t)===o))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<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 C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=x(!1),E=x(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:A.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return g(e)?A.some(e):A.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,D=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>D.call(e,t),F=(e,t)=>{const o=I(e,t);return-1===o?A.none():A.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},L=(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 s=M.call(e,n,n+t);o.push(s)}return o},V=(e,t)=>{const o=e.length,n=new Array(o);for(let s=0;s<o;s++){const o=e[s];n[s]=t(o,s)}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 s=0,r=e.length;s<r;s++){const r=e[s];(t(r,s)?o:n).push(r)}return{pass:o,fail:n}},U=(e,t)=>{const o=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];t(s,n)&&o.push(s)}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),G=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return A.some(s);if(o(s,n))break}return A.none()})(e,t,T),$=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.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(V(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=M.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,s=e.length;n<s;n++){const s=e[n];o[String(s)]=t(s,n)}return o},Q=e=>[e],ee=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},te=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),oe=e=>te(e,0),ne=e=>te(e,e.length-1),se=p(Array.from)?Array.from:e=>M.call(e),re=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},ae=Object.keys,ie=Object.hasOwnProperty,le=(e,t)=>{const o=ae(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},ce=(e,t)=>de(e,(e,o)=>({k:o,v:t(e,o)})),de=(e,t)=>{const o={};return le(e,(e,n)=>{const s=t(e,n);o[s.k]=s.v}),o},ue=e=>(t,o)=>{e[o]=t},me=(e,t,o,n)=>{le(e,(e,s)=>{(t(e,s)?o:n)(e,s)})},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,s=o.length;n<s;n++){const s=o[n],r=e[s];if(t(r,s,e))return A.some(r)}return A.none()},fe=e=>pe(e,w),be=(e,t)=>ve(e,t)?A.from(e[t]):A.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()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),Ce=(e,t)=>null!=e?A.some(t(e)):A.none(),ke=(e,t)=>e?A.some(t):A.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 s=e.indexOf(t,o);return-1!==s&&(!!u(n)||s+t.length<=n)},Ee=(e,t)=>Oe(e,t,0),Ae=(e,t)=>Oe(e,t,e.length-t.length),Me=(Do=/^\s+|\s+$/g,e=>e.replace(Do,"")),De=e=>e.length>0,Be=e=>!De(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=(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])},Ne=(e,t)=>{const o=(t||document).createElement(e);return Fe(o)},Le=(e,t)=>{const o=(t||document).createTextNode(e);return Fe(o)},ze=Fe,Ve="undefined"!=typeof window?window:Function("return this;")(),He=(e,t)=>((e,t)=>{let o=null!=t?t:Ve;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t),Pe=Object.getPrototypeOf,Ue=e=>{const t=He("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const o=((e,t)=>He(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Pe(e).constructor.name))},We=e=>e.dom.nodeName.toLowerCase(),je=e=>t=>(e=>e.dom.nodeType)(t)===e,Ge=e=>$e(e)&&Ue(e.dom),$e=je(1),qe=je(3),Ye=je(9),Xe=je(11),Ke=e=>t=>$e(t)&&We(t)===e,Je=(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")}},Ze=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Qe=(e,t)=>{const o=void 0===t?document:t.dom;return Ze(o)?A.none():A.from(o.querySelector(e)).map(ze)},et=(e,t)=>e.dom===t.dom,tt=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},ot=e=>ze(e.dom.ownerDocument),nt=e=>Ye(e)?e:ot(e),st=e=>ze(nt(e).dom.documentElement),rt=e=>ze(nt(e).dom.defaultView),at=e=>A.from(e.dom.parentNode).map(ze),it=e=>A.from(e.dom.parentElement).map(ze),lt=e=>A.from(e.dom.offsetParent).map(ze),ct=e=>V(e.dom.childNodes,ze),dt=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(ze)},ut=e=>dt(e,0),mt=(e,t)=>({element:e,offset:t}),gt=(e,t)=>{const o=ct(e);return o.length>0&&t<o.length?mt(o[t],0):mt(e,t)},pt=e=>Xe(e)&&g(e.dom.host),ht=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),ft=x(ht),bt=ht?e=>ze(e.dom.getRootNode()):nt,vt=e=>pt(e)?e:ze(nt(e).dom.body),yt=e=>{const t=bt(e);return pt(t)?A.some(t):A.none()},xt=e=>ze(e.dom.host),wt=e=>{const t=qe(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return yt(ze(t)).fold(()=>o.body.contains(t),(n=wt,s=xt,e=>n(s(e))));var n,s},St=()=>Ct(ze(document)),Ct=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ze(t)},kt=(e,t,o)=>{if(!(r(o)||d(o)||h(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},Ot=(e,t,o)=>{kt(e.dom,t,o)},_t=(e,t)=>{const o=e.dom;le(t,(e,t)=>{kt(o,t,e)})},Tt=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Et=(e,t)=>A.from(Tt(e,t)),At=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Mt=(e,t)=>{e.dom.removeAttribute(t)},Dt=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ie(e)&&e.style.setProperty(t,o)},Bt=(e,t)=>{Ie(e)&&e.style.removeProperty(t)},It=(e,t,o)=>{const n=e.dom;Dt(n,t,o)},Ft=(e,t)=>{const o=e.dom;le(t,(e,t)=>{Dt(o,t,e)})},Rt=(e,t)=>{const o=e.dom;le(t,(e,t)=>{e.fold(()=>{Bt(o,t)},e=>{Dt(o,t,e)})})},Nt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||wt(e)?n:Lt(o,t)},Lt=(e,t)=>Ie(e)?e.style.getPropertyValue(t):"",zt=(e,t)=>{const o=e.dom,n=Lt(o,t);return A.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},Ht=(e,t,o)=>{const n=Ne(e);return It(n,t,o),zt(n,t).isSome()},Pt=(e,t)=>{const o=e.dom;Bt(o,t),xe(Et(e,"style").map(Me),"")&&Mt(e,"style")},Ut=e=>e.dom.offsetWidth,Wt=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Nt(o,e);return parseFloat(t)||0}return n},n=(e,t)=>j(t,(t,o)=>{const n=Nt(e,o),s=void 0===n?0:parseInt(n,10);return isNaN(s)?t:t+s},0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Ie(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const s=n(e,o);return t>s?t-s:0}}},jt=Wt("height",e=>{const t=e.dom;return wt(e)?t.getBoundingClientRect().height:t.offsetHeight}),Gt=e=>jt.get(e),$t=e=>jt.getOuter(e),qt=(e,t)=>({left:e,top:t,translate:(o,n)=>qt(e+o,t+n)}),Yt=qt,Xt=(e,t)=>void 0!==e?e:void 0!==t?t:0,Kt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return Yt(o.offsetLeft,o.offsetTop);const r=Xt(null==n?void 0:n.pageYOffset,s.scrollTop),a=Xt(null==n?void 0:n.pageXOffset,s.scrollLeft),i=Xt(s.clientTop,o.clientTop),l=Xt(s.clientLeft,o.clientLeft);return Jt(e).translate(a-l,r-i)},Jt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Yt(o.offsetLeft,o.offsetTop):wt(e)?(e=>{const t=e.getBoundingClientRect();return Yt(t.left,t.top)})(t):Yt(0,0)},Zt=Wt("width",e=>e.dom.offsetWidth),Qt=e=>Zt.get(e),eo=e=>Zt.getOuter(e),to=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},oo=()=>no(0,0),no=(e,t)=>({major:e,minor:t}),so={nu:no,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?oo():((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 no(n(1),n(2))})(e,o)},unknown:oo},ro=(e,t)=>{const o=String(t).toLowerCase();return G(e,e=>e.search(o))},ao=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,io=e=>t=>Te(t,e),lo=[{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]+).*/,ao],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:[ao,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:io("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:io("firefox")},{name:"Safari",versionRegexes:[ao,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Te(e,"safari")||Te(e,"mobile/"))&&Te(e,"applewebkit")}],co=[{name:"Windows",search:io("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:io("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:io("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:io("linux"),versionRegexes:[]},{name:"Solaris",search:io("sunos"),versionRegexes:[]},{name:"FreeBSD",search:io("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:io("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],uo={browsers:x(lo),oses:x(co)},mo="Edge",go="Chromium",po="Opera",ho="Firefox",fo="Safari",bo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(mo),isChromium:n(go),isIE:n("IE"),isOpera:n(po),isFirefox:n(ho),isSafari:n(fo)}},vo=()=>bo({current:void 0,version:so.unknown()}),yo=bo,xo=(x(mo),x(go),x("IE"),x(po),x(ho),x(fo),"Windows"),wo="Android",So="Linux",Co="macOS",ko="Solaris",Oo="FreeBSD",_o="ChromeOS",To=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(xo),isiOS:n("iOS"),isAndroid:n(wo),isMacOS:n(Co),isLinux:n(So),isSolaris:n(ko),isFreeBSD:n(Oo),isChromeOS:n(_o)}},Eo=()=>To({current:void 0,version:so.unknown()}),Ao=To,Mo=(x(xo),x("iOS"),x(wo),x(So),x(Co),x(ko),x(Oo),x(_o),e=>window.matchMedia(e).matches);var Do;let Bo=to(()=>((e,t,o)=>{const n=uo.browsers(),s=uo.oses(),r=t.bind(e=>((e,t)=>re(t.brands,t=>{const o=t.brand.toLowerCase();return G(e,e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())}).map(e=>({current:e.name,version:so.nu(parseInt(t.version,10),0)}))}))(n,e)).orThunk(()=>((e,t)=>ro(e,t).map(e=>{const o=so.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(n,e)).fold(vo,yo),a=((e,t)=>ro(e,t).map(e=>{const o=so.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(s,e).fold(Eo,Ao),i=((e,t,o,n)=>{const s=e.isiOS()&&!0===/ipad/i.test(o),r=e.isiOS()&&!s,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=s||!r&&a&&n("(min-device-width:768px)"),c=r||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:x(s),isiPhone:x(r),isTablet:x(l),isPhone:x(c),isTouch:x(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:x(d),isDesktop:x(u)}})(a,r,e,o);return{browser:r,os:a,deviceType:i}})(navigator.userAgent,A.from(navigator.userAgentData),Mo));const Io=()=>Bo(),Fo=e=>{const t=ze((e=>{if(ft()&&g(e.target)){const t=ze(e.target);if($e(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return oe(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=y(n,o);return((e,t,o,n,s,r,a)=>({target:e,x:t,y:o,stop:n,prevent:s,kill:r,raw:a}))(t,e.clientX,e.clientY,o,n,s,e)},Ro=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(Fo(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:C(No,e,t,r,s)}},No=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Lo=(e,t)=>{at(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},zo=(e,t)=>{const o=(e=>A.from(e.dom.nextSibling).map(ze))(e);o.fold(()=>{at(e).each(e=>{Ho(e,t)})},e=>{Lo(e,t)})},Vo=(e,t)=>{ut(e).fold(()=>{Ho(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},Ho=(e,t)=>{e.dom.appendChild(t.dom)},Po=(e,t)=>{H(t,t=>{Ho(e,t)})},Uo=e=>{e.dom.textContent="",H(ct(e),e=>{Wo(e)})},Wo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},jo=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Yt(o,n)},Go=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},$o=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),qo=e=>{const t=void 0===e?window:e,o=t.document,n=jo(ze(o));return(e=>{const t=void 0===e?window:e;return Io().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold(()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return $o(n.left,n.top,o,s)},e=>$o(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height))},Yo=()=>ze(document),Xo=(e,t)=>e.view(t).fold(x([]),t=>{const o=e.owner(t),n=Xo(e,o);return[t].concat(n)});var Ko=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?A.none():A.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(ze)},owner:e=>ot(e)});const Jo=e=>{const t=Yo(),o=jo(t),n=((e,t)=>{const o=t.owner(e),n=Xo(t,o);return A.some(n)})(e,Ko);return n.fold(C(Kt,e),t=>{const n=Jt(e),s=W(t,(e,t)=>{const o=Jt(t);return{left:e.left+o.left,top:e.top+o.top}},{left:0,top:0});return Yt(s.left+n.left+o.left,s.top+n.top+o.top)})},Zo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Qo=e=>{const t=Kt(e),o=eo(e),n=$t(e);return Zo(t.left,t.top,o,n)},en=e=>{const t=Jo(e),o=eo(e),n=$t(e);return Zo(t.left,t.top,o,n)},tn=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),s=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return Zo(o,n,s-o,r-n)},on=()=>qo(window);var nn=tinymce.util.Tools.resolve("tinymce.ThemeManager");const sn=e=>{const t=t=>t(e),o=x(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>an.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>A.some(e)};return s},rn=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>an.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:O(String(e)),each:b,toOptional:A.none};return o},an={value:sn,error:rn,fromOption:(e,t)=>e.fold(()=>rn(t),sn)};var ln;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(ln||(ln={}));const cn=(e,t,o)=>e.stype===ln.Error?t(e.serror):o(e.svalue),dn=e=>({stype:ln.Value,svalue:e}),un=e=>({stype:ln.Error,serror:e}),mn=dn,gn=un,pn=cn,hn=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),fn=(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)}},bn=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 s=t[n];for(const t in s)ve(s,t)&&(o[t]=e(o[t],s[t]))}return o},vn=bn((e,t)=>i(e)&&i(t)?vn(e,t):t),yn=bn((e,t)=>t),xn=e=>({tag:"defaultedThunk",process:e}),wn=e=>xn(x(e)),Sn=e=>({tag:"mergeWithThunk",process:e}),Cn=e=>{const t=(e=>{const t=[],o=[];return H(e,e=>{cn(e,e=>o.push(e),e=>t.push(e))}),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,y(gn,q)(o)):mn(t.values);var o},kn=e=>a(e)&&ae(e).length>100?" removed due to size":JSON.stringify(e,null,2),On=(e,t)=>gn([{path:e,getErrorInfo:t}]),_n=e=>({extract:(t,o)=>((e,t)=>e.stype===ln.Error?t(e.serror):e)(e(o),e=>((e,t)=>On(e,x(t)))(t,e)),toString:x("val")}),Tn=_n(mn),En=(e,t,o,n)=>n(be(e,t).getOrThunk(()=>o(e))),An=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold(()=>mn(A.none()),e=>((e,t)=>e.stype===ln.Value?{stype:ln.Value,svalue:t(e.svalue)}:e)(s.extract(t.concat([n]),e),A.some));switch(e.tag){case"required":return((e,t,o,n)=>be(t,o).fold(()=>((e,t,o)=>On(e,()=>'Could not find valid *required* value for "'+t+'" in '+kn(o)))(e,o,t),n))(t,o,n,r);case"defaultedThunk":return En(o,n,e.process,r);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 En(o,n,x({}),t=>{const n=vn(e.process(o),t);return r(n)})}},Mn=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),Dn=e=>ae(ge(e,g)),Bn=e=>{const t=In(e),o=W(e,(e,t)=>fn(t,t=>vn(e,{[t]:!0}),x(e)),{});return{extract:(e,n)=>{const s=d(n)?[]:Dn(n),r=U(s,e=>!ye(o,e));return 0===r.length?t.extract(e,n):((e,t)=>On(e,()=>"There are unsupported fields: ["+t.join(", ")+"] specified"))(e,r)},toString:t.toString}},In=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)fn(r,(o,r,a,i)=>{const l=An(a,e,t,o,i);pn(l,e=>{s.push(...e)},e=>{n[r]=e})},(e,o)=>{n[e]=o(t)});return s.length>0?gn(s):mn(n)})(t,o,e),toString:()=>{const t=V(e,e=>fn(e,(e,t,o,n)=>e+" -> "+n.toString(),(e,t)=>"state("+e+")"));return"obj{\n"+t.join("\n")+"}"}}),Fn=e=>({extract:(t,o)=>{const n=V(o,(o,n)=>e.extract(t.concat(["["+n+"]"]),o));return Cn(n)},toString:()=>"array("+e.toString()+")"}),Rn=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const s=[];for(const r of e){const e=r.extract(t,n);if(e.stype===ln.Value)return{stype:ln.Value,svalue:o(e.svalue)};s.push(e)}return Cn(s)},toString:()=>"oneOf("+V(e,e=>e.toString()).join(", ")+")"}},Nn=(e,t)=>({extract:(o,n)=>{const s=ae(n),r=((t,o)=>Fn(_n(e)).extract(t,o))(o,s);return((e,t)=>e.stype===ln.Value?t(e.svalue):e)(r,e=>{const s=V(e,e=>hn(e,e,{tag:"required",process:{}},t));return In(s).extract(o,n)})},toString:()=>"setOf("+t.toString()+")"}),Ln=y(Fn,In),zn=x(Tn),Vn=(e,t)=>_n(o=>{const n=typeof o;return e(o)?mn(o):gn(`Expected type: ${t} but got: ${n}`)}),Hn=Vn(h,"number"),Pn=Vn(r,"string"),Un=Vn(d,"boolean"),Wn=Vn(p,"function"),jn=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=>jn(e[t]));default:return!1}},Gn=_n(e=>jn(e)?mn(e):gn("Expected value to be acceptable for sending via postMessage")),$n=(e,t)=>({extract:(o,n)=>be(n,e).fold(()=>((e,t)=>On(e,()=>'Choice schema did not contain choice key: "'+t+'"'))(o,e),e=>((e,t,o,n)=>be(o,n).fold(()=>((e,t,o)=>On(e,()=>'The chosen schema: "'+o+'" did not exist in branches: '+kn(t)))(e,o,n),o=>o.extract(e.concat(["branch: "+n]),t)))(o,n,t,e)),toString:()=>"chooseOn("+e+"). Possible values: "+ae(t)}),qn=e=>_n(t=>e(t).fold(gn,mn)),Yn=(e,t)=>Nn(t=>e(t).fold(un,dn),t),Xn=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===ln.Error?{stype:ln.Error,serror:t(e.serror)}:e)(t.extract([e],o),e=>({input:o,errors:e})))(e,t,o),cn(n,an.error,an.value);var n},Kn=e=>e.fold(e=>{throw new Error(Zn(e))},w),Jn=(e,t,o)=>Kn(Xn(e,t,o)),Zn=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:x("... (only showing first ten failures)")}]):e;return V(t,e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo())})(e.errors).join("\n")+"\n\nInput object: "+kn(e.input),Qn=(e,t)=>$n(e,ce(t,In)),es=(e,t)=>((e,t)=>{const o=to(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),ts=hn,os=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),ns=e=>qn(t=>R(e,t)?an.value(t):an.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`)),ss=e=>ts(e,e,{tag:"required",process:{}},zn()),rs=(e,t)=>ts(e,e,{tag:"required",process:{}},t),as=e=>rs(e,Hn),is=e=>rs(e,Pn),ls=(e,t)=>ts(e,e,{tag:"required",process:{}},ns(t)),cs=e=>rs(e,Wn),ds=(e,t)=>ts(e,e,{tag:"required",process:{}},In(t)),us=(e,t)=>ts(e,e,{tag:"required",process:{}},Ln(t)),ms=(e,t)=>ts(e,e,{tag:"required",process:{}},Fn(t)),gs=e=>ts(e,e,{tag:"option",process:{}},zn()),ps=(e,t)=>ts(e,e,{tag:"option",process:{}},t),hs=e=>ps(e,Hn),fs=e=>ps(e,Pn),bs=(e,t)=>ps(e,ns(t)),vs=e=>ps(e,Wn),ys=(e,t)=>ps(e,Fn(t)),xs=(e,t)=>ps(e,In(t)),ws=(e,t)=>ts(e,e,wn(t),zn()),Ss=(e,t,o)=>ts(e,e,wn(t),o),Cs=(e,t)=>Ss(e,t,Hn),ks=(e,t)=>Ss(e,t,Pn),Os=(e,t,o)=>Ss(e,t,ns(o)),_s=(e,t)=>Ss(e,t,Un),Ts=(e,t)=>Ss(e,t,Wn),Es=(e,t,o)=>Ss(e,t,Fn(o)),As=(e,t,o)=>Ss(e,t,In(o)),Ms=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Ds=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,s)=>{const r=ae(n);if(1!==r.length)throw new Error("one and only one name per case");const a=r[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!l(i))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,o)},match:e=>{const n=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};Ds([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Bs=(e,t)=>((e,t)=>({[e]:t}))(e,t),Is=e=>(e=>{const t={};return H(e,e=>{t[e.key]=e.value}),t})(e),Fs=e=>p(e)?e:T,Rs=(e,t,o)=>{let n=e.dom;const s=Fs(o);for(;n.parentNode;){n=n.parentNode;const e=ze(n),o=t(e);if(o.isSome())return o;if(s(e))break}return A.none()},Ns=(e,t,o)=>{const n=t(e),s=Fs(o);return n.orThunk(()=>s(e)?A.none():Rs(e,t,s))},Ls=(e,t)=>et(e.element,t.event.target),zs={can:E,abort:T,run:b},Vs=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{...zs,...e}},Hs=x,Ps=Hs("touchstart"),Us=Hs("touchmove"),Ws=Hs("touchend"),js=Hs("touchcancel"),Gs=Hs("mousedown"),$s=Hs("mousemove"),qs=Hs("mouseout"),Ys=Hs("mouseup"),Xs=Hs("mouseover"),Ks=Hs("focusin"),Js=Hs("focusout"),Zs=Hs("keydown"),Qs=Hs("keyup"),er=Hs("input"),tr=Hs("change"),or=Hs("click"),nr=Hs("transitioncancel"),sr=Hs("transitionend"),rr=Hs("transitionstart"),ar=Hs("selectstart"),ir=e=>x("alloy."+e),lr={tap:ir("tap")},cr=ir("focus"),dr=ir("blur.post"),ur=ir("paste.post"),mr=ir("receive"),gr=ir("execute"),pr=ir("focus.item"),hr=lr.tap,fr=ir("longpress"),br=ir("sandbox.close"),vr=ir("typeahead.cancel"),yr=ir("system.init"),xr=ir("system.touchmove"),wr=ir("system.touchend"),Sr=ir("system.scroll"),Cr=ir("system.resize"),kr=ir("system.attached"),Or=ir("system.detached"),_r=ir("system.dismissRequested"),Tr=ir("system.repositionRequested"),Er=ir("focusmanager.shifted"),Ar=ir("slotcontainer.visibility"),Mr=ir("system.external.element.scroll"),Dr=ir("change.tab"),Br=ir("dismiss.tab"),Ir=ir("highlight"),Fr=ir("dehighlight"),Rr=(e,t)=>{Vr(e,e.element,t,{})},Nr=(e,t,o)=>{Vr(e,e.element,t,o)},Lr=e=>{Rr(e,gr())},zr=(e,t,o)=>{Vr(e,t,o,{})},Vr=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Hr=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Pr=e=>Is(e),Ur=(e,t)=>({key:e,value:Vs({abort:t})}),Wr=e=>({key:e,value:Vs({run:(e,t)=>{t.event.prevent()}})}),jr=(e,t)=>({key:e,value:Vs({run:t})}),Gr=(e,t,o)=>({key:e,value:Vs({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),$r=e=>t=>({key:e,value:Vs({run:(e,o)=>{Ls(e,o)&&t(e,o)}})}),qr=(e,t,o)=>((e,t)=>jr(e,(o,n)=>{o.getSystem().getByUid(t).each(t=>{Hr(t,t.element,e,n)})}))(e,t.partUids[o]),Yr=(e,t)=>jr(e,(e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk(()=>Ns(n.target,t=>e.getSystem().getByDom(t).toOptional(),T).getOr(e));t(e,s,o)}),Xr=e=>jr(e,(e,t)=>{t.cut()}),Kr=e=>jr(e,(e,t)=>{t.stop()}),Jr=(e,t)=>$r(e)(t),Zr=$r(kr()),Qr=$r(Or()),ea=$r(yr()),ta=(ia=gr(),e=>jr(ia,e)),oa=e=>e.dom.innerHTML,na=(e,t)=>{const o=ot(e).dom,n=ze(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,ct(ze(o))})(t,o);Po(n,s),Uo(e),Ho(e,n)},sa=(e,t)=>ze(e.dom.cloneNode(t)),ra=e=>(e=>{if(pt(e))return"#shadow-root";{const t=(e=>sa(e,!1))(e);return(e=>{const t=Ne("div"),o=ze(e.dom.cloneNode(!0));return Ho(t,o),oa(t)})(t)}})(e),aa=Pr([(e=>({key:e,value:Vs({can:(e,t)=>{const o=t.event,n=o.originator,s=o.target;return!((e,t,o)=>et(t,e.element)&&!et(t,o))(e,n,s)||(console.warn(cr()+" did not get interpreted by the desired target. \nOriginator: "+ra(n)+"\nTarget: "+ra(s)+"\nCheck the "+cr()+" event handlers"),!1)}})}))(cr())]);var ia,la=Object.freeze({__proto__:null,events:aa});let ca=0;const da=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return ca++,e+"_"+o+ca+String(t)},ua=x("alloy-id-"),ma=x("data-alloy-id"),ga=ua(),pa=ma(),ha=(e,t)=>{Object.defineProperty(e.dom,pa,{value:t,writable:!0})},fa=e=>{const t=$e(e)?e.dom[pa]:null;return A.from(t)},ba=e=>da(e),va=w,ya=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+ra(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}},xa=ya(),wa=e=>V(e,e=>Ae(e,"/*")?e.substring(0,e.length-2):e),Sa=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:wa(r)}),e},Ca=da("alloy-premade"),ka=e=>(Object.defineProperty(e.element.dom,Ca,{value:e.uid,writable:!0}),Bs(Ca,e)),Oa=e=>be(e,Ca),_a=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:wa(r.slice(1))}),e})((t,...o)=>e(t.getApis(),t,...o),e),Ta={init:()=>Ea({readState:x("No State required")})},Ea=e=>e,Aa=(e,t)=>{const o={};return le(e,(e,n)=>{le(e,(e,s)=>{const r=be(o,s).getOr([]);o[s]=r.concat([t(n,e)])})}),o},Ma=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),Da=e=>e.cHandler,Ba=(e,t)=>({name:e,handler:t}),Ia=(e,t)=>{const o={};return H(e,e=>{o[e.name()]=e.handlers(t)}),o},Fa=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const s=ee(o,(o,s)=>{const r=o[t],a=s[t],i=n.indexOf(r),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+r+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(n,null,2));return i<l?-1:l<i?1:0});return an.value(s)}catch(e){return an.error([e])}})("Event: "+o,"name",e,n).map(e=>(e=>{const t=(e=>(...t)=>j(e,(e,o)=>e&&(e=>e.can)(o).apply(void 0,t),!0))(e),o=(e=>(...t)=>j(e,(e,o)=>e||(e=>e.abort)(o).apply(void 0,t),!1))(e);return{can:t,abort:o,run:(...t)=>{H(e,e=>{e.run.apply(void 0,t)})}}})(V(e,e=>e.handler))):((e,t)=>an.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(V(t,e=>e.name),null,2)]))(o,e)},Ra=(e,t)=>((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,an.error(q(n))):((e,t)=>0===e.length?an.value(t):an.value(vn(t,yn.apply(void 0,e))))(o.values,t);var n})(pe(e,(e,o)=>(1===e.length?an.value(e[0].handler):Fa(e,t,o)).map(n=>{const s=(e=>{const t=(e=>p(e)?{can:E,abort:T,run:e}:e)(e);return(e,o,...n)=>{const s=[e,o].concat(n);t.abort.apply(void 0,s)?o.stop():t.can.apply(void 0,s)&&t.run.apply(void 0,s)}})(n),r=e.length>1?U(t[o],t=>N(e,e=>e.name===t)).join(" > "):e[0].name;return Bs(o,((e,t)=>({handler:e,purpose:t}))(s,r))})),{}),Na="alloy.base.behaviour",La=In([ts("dom","dom",{tag:"required",process:{}},In([ss("tag"),ws("styles",{}),ws("classes",[]),ws("attributes",{}),gs("value"),gs("innerHtml")])),ss("components"),ss("uid"),ws("events",{}),ws("apis",{}),ts("eventOrder","eventOrder",(mi={[gr()]:["disabling",Na,"toggling","typeaheadevents"],[cr()]:[Na,"focusing","keying"],[yr()]:[Na,"disabling","toggling","representing"],[er()]:[Na,"representing","streaming","invalidating"],[Or()]:[Na,"representing","item-events","toolbar-button-events","tooltipping"],[Gs()]:["focusing",Na,"item-type-events"],[Ps()]:["focusing",Na,"item-type-events"],[Xs()]:["item-type-events","tooltipping"],[mr()]:["receiving","reflecting","tooltipping"]},Sn(x(mi))),zn()),gs("domModification")]),za=e=>e.events,Va=(e,t)=>{const o=Tt(e,t);return void 0===o||""===o?[]:o.split(" ")},Ha=e=>void 0!==e.dom.classList,Pa=e=>Va(e,"class"),Ua=(e,t)=>((e,t,o)=>{const n=Va(e,t).concat([o]);return Ot(e,t,n.join(" ")),!0})(e,"class",t),Wa=(e,t)=>((e,t,o)=>{const n=U(Va(e,t),e=>e!==o);return n.length>0?Ot(e,t,n.join(" ")):Mt(e,t),!1})(e,"class",t),ja=(e,t)=>{Ha(e)?e.dom.classList.add(t):Ua(e,t)},Ga=e=>{0===(Ha(e)?e.dom.classList:Pa(e)).length&&Mt(e,"class")},$a=(e,t)=>{Ha(e)?e.dom.classList.remove(t):Wa(e,t),Ga(e)},qa=(e,t)=>Ha(e)&&e.dom.classList.contains(t),Ya=(e,t)=>{H(t,t=>{ja(e,t)})},Xa=(e,t)=>{H(t,t=>{$a(e,t)})},Ka=e=>Ha(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):Pa(e),Ja=e=>e.dom.value,Za=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},Qa=(e,t,o)=>{o.fold(()=>Ho(e,t),e=>{et(e,t)||(Lo(e,t),Wo(e))})},ei=(e,t,o)=>{const n=V(t,o),s=ct(e);return H(s.slice(n.length),Wo),n},ti=(e,t,o,n)=>{const s=dt(e,t),r=n(o,s),a=((e,t,o)=>dt(e,t).map(e=>{if(o.exists(t=>!et(t,e))){const t=o.map(We).getOr("span"),n=Ne(t);return Lo(e,n),n}return e}))(e,t,s);return Qa(e,r.element,a),r},oi=(e,t)=>{const o=ae(e),n=ae(t),s=J(n,o),r=(e=>{const o={},n={};return me(e,(e,o)=>!ve(t,o)||e!==t[o],ue(o),ue(n)),{t:o,f:n}})(e).t;return{toRemove:s,toSet:r}},ni=(e,t)=>{const o=t.filter(t=>We(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>ve(e.dom,Ca))(t)).bind(t=>((e,t)=>{try{const o=((e,t)=>{const{class:o,style:n,...s}=(e=>j(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}))(t),{toSet:r,toRemove:a}=oi(e.attributes,s),i=Vt(t),{toSet:l,toRemove:c}=oi(e.styles,i),d=Ka(t),u=J(d,e.classes),m=J(e.classes,d);return H(a,e=>Mt(t,e)),_t(t,r),Ya(t,m),Xa(t,u),H(c,e=>Pt(t,e)),Ft(t,l),e.innerHtml.fold(()=>{const o=e.domChildren;((e,t)=>{ei(e,t,(t,o)=>{const n=dt(e,o);return Qa(e,t,n),t})})(t,o)},e=>{na(t,e)}),(()=>{const o=t,n=e.value.getOrUndefined();n!==Ja(o)&&Za(o,null!=n?n:"")})(),t})(e,t);return A.some(o)}catch(e){return A.none()}})(e,t)).getOrThunk(()=>(e=>{const t=Ne(e.tag);_t(t,e.attributes),Ya(t,e.classes),Ft(t,e.styles),e.innerHtml.each(e=>na(t,e));const o=e.domChildren;return Po(t,o),e.value.each(e=>{Za(t,e)}),t})(e));return ha(o,e.uid),o},si=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((e,t)=>((e,t)=>{const o=V(t,e=>xs(e.name(),[ss("config"),ws("state",Ta)])),n=Xn("component.behaviours",In(o),e.behaviours).fold(t=>{throw new Error(Zn(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))(e,t)},ri=(e,t)=>{const o=()=>m,n=Ms(xa),s=Kn((e=>Xn("custom.definition",La,e))(e)),r=si(e),a=(e=>e.list)(r),i=(e=>e.data)(r),l=((e,t,o)=>{const n={...(s=e).dom,uid:s.uid,domChildren:V(s.components,e=>e.element)};var s;const r=(e=>e.domModification.fold(()=>Ma({}),Ma))(e),a={"alloy.base.modification":r},i=t.length>0?((e,t,o,n)=>{const s={...t};H(o,t=>{s[t.name()]=t.exhibit(e,n)});const r=Aa(s,(e,t)=>({name:e,modification:t})),a=e=>W(e,(e,t)=>({...t.modification,...e}),{}),i=W(r.classes,(e,t)=>t.modification.concat(e),[]),l=a(r.attributes),c=a(r.styles);return Ma({classes:i,attributes:l,styles:c})})(o,a,t,n):r;return l=n,c=i,{...l,attributes:{...l.attributes,...c.attributes},styles:{...l.styles,...c.styles},classes:l.classes.concat(c.classes)};var l,c})(s,a,i),c=ni(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":za(e)};return((e,t,o,n)=>{const s=((e,t,o)=>{const n={...o,...Ia(t,e)};return Aa(n,Ba)})(e,o,n);return Ra(s,t)})(o,e.eventOrder,t,n).getOrDie()})(s,a,i),u=Ms(s.components),m={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(p(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>p(i[e.name()]),spec:e,readState:e=>i[e]().map(e=>e.state.readState()).getOr("not enabled"),getApis:()=>s.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(ya(o))},element:c,syncComponents:()=>{const e=ct(c),t=Y(e,e=>n.get().getByDom(e).fold(()=>[],Q));u.set(t)},components:u.get,events:d};return m},ai=e=>{const t=Le(e);return ii({element:t})},ii=e=>{const t=Jn("external.component",Bn([ss("element"),gs("uid")]),e),o=Ms(ya()),n=t.uid.getOrThunk(()=>ba("external"));ha(t.element,n);const s={uid:n,getSystem:o.get,config:A.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(ya(()=>s))},getApis:()=>({}),element:t.element,spec:e,readState:x("No state"),syncComponents:b,components:x([]),events:{}};return ka(s)},li=ba,ci=(e,t)=>Oa(e).getOrThunk(()=>((e,t)=>{const{events:o,...n}=va(e),s=((e,t)=>{const o=be(e,"components").getOr([]);return t.fold(()=>V(o,di),e=>V(o,(t,o)=>ci(t,dt(e,o))))})(n,t),r={...n,events:{...la,...o},components:s};return an.value(ri(r,t))})((e=>ve(e,"uid"))(e)?e:{uid:li(""),...e},t).getOrDie()),di=e=>ci(e,A.none()),ui=ka;var mi,gi=(e,t,o,n,s)=>e(o,n)?A.some(o):p(s)&&s(o)?A.none():t(o,n,s);const pi=(e,t,o)=>{let n=e.dom;const s=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=ze(n);if(t(e))return A.some(e);if(s(e))break}return A.none()},hi=(e,t,o)=>gi((e,t)=>t(e),pi,e,t,o),fi=(e,t,o)=>hi(e,t,o).isSome(),bi=(e,t,o)=>pi(e,e=>Je(e,t),o),vi=(e,t)=>(e=>G(e.dom.childNodes,e=>{return o=ze(e),Je(o,t);var o}).map(ze))(e),yi=(e,t)=>Qe(t,e),xi=(e,t,o)=>gi((e,t)=>Je(e,t),bi,e,t,o),wi="aria-controls",Si=()=>{const e=da(wi);return{id:e,link:t=>{Ot(t,wi,e)},unlink:e=>{Mt(e,wi)}}},Ci=(e,t)=>fi(t,t=>et(t,e.element),T)||((e,t)=>(e=>hi(e,e=>{if(!$e(e))return!1;const t=Tt(e,"id");return void 0!==t&&t.indexOf(wi)>-1}).bind(e=>{const t=Tt(e,"id"),o=bt(e);return yi(o,`[${wi}="${t}"]`)}))(t).exists(t=>Ci(e,t)))(e,t);var ki;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(ki||(ki={}));const Oi=Ms({}),_i=["alloy/data/Fields","alloy/debugging/Debugging"],Ti=(e,t,o)=>((e,t,o)=>{switch(be(Oi.get(),e).orThunk(()=>{const t=ae(Oi.get());return re(t,t=>e.indexOf(t)>-1?A.some(Oi.get()[t]):A.none())}).getOr(ki.NORMAL)){case ki.NORMAL:return o(Ei());case ki.LOGGING:{const n=((e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const s=(new Date).getTime();R(["mousemove","mouseover","mouseout",yr()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:V(o,e=>R(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ra(e.target)+")":e.outcome)})}}})(e,t),s=o(n);return n.write(),s}case ki.STOP:return!0}})(e,t,o),Ei=x({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),Ai=x([ss("menu"),ss("selectedMenu")]),Mi=x([ss("item"),ss("selectedItem")]);x(In(Mi().concat(Ai())));const Di=x(In(Mi())),Bi=ds("initSize",[ss("numColumns"),ss("numRows")]),Ii=()=>ds("markers",[ss("backgroundMenu")].concat(Ai()).concat(Mi())),Fi=e=>ds("markers",V(e,ss)),Ri=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");G(t,e=>e.indexOf("alloy")>0&&!N(_i,t=>e.indexOf(t)>-1)).getOr("unknown")}})(),ts(t,t,o,qn(e=>an.value((...t)=>e.apply(void 0,t))))),Ni=e=>Ri(0,e,wn(b)),Li=e=>Ri(0,e,wn(A.none)),zi=e=>Ri(0,e,{tag:"required",process:{}}),Vi=e=>Ri(0,e,{tag:"required",process:{}}),Hi=(e,t)=>os(e,x(t)),Pi=e=>os(e,w),Ui=x(Bi),Wi=(e,t,o,n,s,r,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:s,restriction:r,label:`${a}-${s}`,alwaysFit:i}),ji=Ds([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Gi=ji.southeast,$i=ji.southwest,qi=ji.northeast,Yi=ji.northwest,Xi=ji.south,Ki=ji.north,Ji=ji.east,Zi=ji.west,Qi=(e,t,o,n)=>{const s=e+t;return s>n?o:s<o?n:s},el=(e,t,o)=>Math.min(Math.max(e,t),o),tl=(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))),ol="layout",nl=e=>e.x,sl=(e,t)=>e.x+e.width/2-t.width/2,rl=(e,t)=>e.x+e.width-t.width,al=(e,t)=>e.y-t.height,il=e=>e.y+e.height,ll=(e,t)=>e.y+e.height/2-t.height/2,cl=(e,t,o)=>Wi(nl(e),il(e),o.southeast(),Gi(),"southeast",tl(e,{left:1,top:3}),ol),dl=(e,t,o)=>Wi(rl(e,t),il(e),o.southwest(),$i(),"southwest",tl(e,{right:0,top:3}),ol),ul=(e,t,o)=>Wi(nl(e),al(e,t),o.northeast(),qi(),"northeast",tl(e,{left:1,bottom:2}),ol),ml=(e,t,o)=>Wi(rl(e,t),al(e,t),o.northwest(),Yi(),"northwest",tl(e,{right:0,bottom:2}),ol),gl=(e,t,o)=>Wi(sl(e,t),al(e,t),o.north(),Ki(),"north",tl(e,{bottom:2}),ol),pl=(e,t,o)=>Wi(sl(e,t),il(e),o.south(),Xi(),"south",tl(e,{top:3}),ol),hl=(e,t,o)=>Wi((e=>e.x+e.width)(e),ll(e,t),o.east(),Ji(),"east",tl(e,{left:0}),ol),fl=(e,t,o)=>Wi(((e,t)=>e.x-t.width)(e,t),ll(e,t),o.west(),Zi(),"west",tl(e,{right:1}),ol),bl=()=>[cl,dl,ul,ml,pl,gl,hl,fl],vl=()=>[dl,cl,ml,ul,pl,gl,hl,fl],yl=()=>[ul,ml,cl,dl,gl,pl],xl=()=>[ml,ul,dl,cl,gl,pl],wl=()=>[cl,dl,ul,ml,pl,gl],Sl=()=>[dl,cl,ml,ul,pl,gl];var Cl=Object.freeze({__proto__:null,events:e=>Pr([jr(mr(),(t,o)=>{const n=e.channels,s=ae(n),r=o,a=((e,t)=>t.universal?e:U(e,e=>R(t.channels,e)))(s,r);H(a,e=>{const o=n[e],s=o.schema,a=Jn("channel["+e+"] data\nReceiver: "+ra(t.element),s,r.data);o.onReceive(t,a)})})])}),kl=[rs("channels",Yn(an.value,Bn([zi("onReceive"),ws("schema",zn())])))];const Ol=(e,t,o)=>ea((n,s)=>{o(n,e,t)}),_l=e=>({key:e,value:void 0}),Tl=(e,t,o,n,s,r,a)=>{const i=e=>ye(e,o)?e[o]():A.none(),l=ce(s,(e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),s=n.indexOf(")")+1,r=n.indexOf("("),a=n.substring(r+1,s-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:wa(a.slice(0,1).concat(a.slice(3)))}),e})((n,...s)=>{const r=[n].concat(s);return n.config({name:x(e)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)},e=>{const o=Array.prototype.slice.call(r,1);return t.apply(void 0,[n,e.config,e.state].concat(o))})},o,t))(o,e,t)),c={...ce(r,(e,t)=>Sa(e,t)),...l,revoke:C(_l,o),config:t=>{const n=Jn(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:to(()=>Jn(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(()=>Ma({})),name:x(o),handlers:e=>i(e).map(e=>be(n,"events").getOr(()=>({}))(e.config,e.state)).getOr({})};return c},El=e=>Is(e),Al=Bn([ss("fields"),ss("name"),ws("active",{}),ws("apis",{}),ws("state",Ta),ws("extra",{})]),Ml=e=>{const t=Jn("Creating behaviour: "+e.name,Al,e);return((e,t,o,n,s,r)=>{const a=Bn(e),i=xs(t,[(l=e,ps("config",Bn(l)))]);var l;return Tl(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},Dl=Bn([ss("branchKey"),ss("branches"),ss("name"),ws("active",{}),ws("apis",{}),ws("state",Ta),ws("extra",{})]),Bl=e=>{const t=Jn("Creating behaviour: "+e.name,Dl,e);return((e,t,o,n,s,r)=>{const a=e,i=xs(t,[ps("config",e)]);return Tl(a,i,t,o,n,s,r)})(Qn(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},Il=x(void 0),Fl=Ml({fields:kl,name:"receiving",active:Cl});var Rl=Object.freeze({__proto__:null,exhibit:(e,t)=>Ma({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const Nl=(e,t=!1)=>e.dom.focus({preventScroll:t}),Ll=e=>e.dom.blur(),zl=e=>{const t=bt(e).dom;return e.dom===t.activeElement},Vl=(e=Yo())=>A.from(e.dom.activeElement).map(ze),Hl=e=>Vl(bt(e)).filter(t=>e.dom.contains(t.dom)),Pl=(e,t)=>{const o=bt(t),n=Vl(o).bind(e=>{const o=t=>et(e,t);return o(t)?A.some(t):((e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const s=ze(e.childNodes[n]);if(t(s))return A.some(s);const r=o(e.childNodes[n]);if(r.isSome())return r}return A.none()};return o(e.dom)})(t,o)}),s=e(t);return n.each(e=>{Vl(o).filter(t=>et(t,e)).fold(()=>{Nl(e)},b)}),s},Ul=(e,t,o,n,s)=>{const r=e=>e+"px";return{position:e,left:t.map(r),top:o.map(r),right:n.map(r),bottom:s.map(r)}},Wl=(e,t)=>{Rt(e,(e=>({...e,position:A.some(e.position)}))(t))},jl=Ds([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Gl=(e,t,o,n,s,r)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=s-(i+a.width),d=r-(l+a.height),u=A.some(i),m=A.some(l),g=A.some(c),p=A.some(d),h=A.none();return t.direction.fold(()=>Ul(e,u,m,h,h),()=>Ul(e,h,m,g,h),()=>Ul(e,u,h,h,p),()=>Ul(e,h,h,g,p),()=>Ul(e,u,m,h,h),()=>Ul(e,u,h,h,p),()=>Ul(e,u,m,h,h),()=>Ul(e,h,m,g,h))},$l=(e,t)=>e.fold(()=>{const e=t.rect;return Ul("absolute",A.some(e.x),A.some(e.y),A.none(),A.none())},(e,o,n,s)=>Gl("absolute",t,e,o,n,s),(e,o,n,s)=>Gl("fixed",t,e,o,n,s)),ql=(e,t)=>{const o=C(Jo,t),n=e.fold(o,o,()=>{const e=jo();return Jo(t).translate(-e.left,-e.top)}),s=eo(t),r=$t(t);return Zo(n.left,n.top,s,r)},Yl=(e,t)=>t.fold(()=>e.fold(on,on,Zo),t=>e.fold(x(t),x(t),()=>{const o=Xl(e,t.x,t.y);return Zo(o.left,o.top,t.width,t.height)})),Xl=(e,t,o)=>{const n=Yt(t,o);return e.fold(x(n),x(n),()=>{const e=jo();return n.translate(-e.left,-e.top)})};jl.none;const Kl=jl.relative,Jl=jl.fixed,Zl="data-alloy-placement",Ql=e=>Et(e,Zl),ec=Ds([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),tc=(e,t,o,n)=>{const s=e.bubble,r=s.offset,a=((e,t,o)=>{const n=(n,s)=>t[n].map(t=>{const r="top"===n||"bottom"===n,a=r?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,s)+a;return r?el(i,e.y,e.bottom):el(i,e.x,e.right)}).getOr(s),s=n("left",e.x),r=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Zo(s,r,a-s,i-r)})(n,e.restriction,r),i=e.x+r.left,l=e.y+r.top,c=Zo(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:a>=o&&a<=s&&i>=n&&i<=r,sizeInBounds:l<=s&&l>=o&&c<=r&&c>=n,visibleW:Math.min(d,a>=o?s-a:l-o),visibleH:Math.min(u,i>=n?r-i:c-n)}})(c,a),p=d&&u,h=p?c:((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,s-l),u=Math.max(n,r-c),m=el(a,o,d),g=el(i,n,u),p=Math.min(m+l,s)-m,h=Math.min(g+c,r)-g;return Zo(m,g,p,h)})(c,a),f=h.width>0&&h.height>0,{maxWidth:b,maxHeight:v}=((e,t,o)=>{const n=x(t.bottom-o.y),s=x(o.bottom-t.y),r=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,s,s,n),a=x(t.right-o.x),i=x(o.right-t.x),l=((e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n))(e,i,i,a);return{maxWidth:l,maxHeight:r}})(e.direction,h,n),y={rect:h,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:s.classesOn,off:s.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?ec.fit(y):ec.nofit(y,m,g,f)},oc=e=>{const t=Ms(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},nc=()=>oc(e=>e.unbind()),sc=()=>{const e=oc(b);return{...e,on:t=>e.get().each(t)}},rc=E,ac=(e,t,o)=>((e,t,o,n)=>Ro(e,t,o,n,!1))(e,t,rc,o),ic=(e,t,o)=>((e,t,o,n)=>Ro(e,t,o,n,!0))(e,t,rc,o),lc=Fo,cc=["top","bottom","right","left"],dc="data-alloy-transition-timer",uc=(e,t,o,n,s,a)=>{const i=((e,t,o)=>o.exists(o=>{const n=e.mode;return"all"===n||o[n]!==t[n]}))(n,s,a);if(i||((e,t)=>((e,t)=>X(t,t=>qa(e,t)))(e,t.classes))(e,n)){It(e,"position",o.position);const a=ql(t,e),l=$l(t,{...s,rect:a}),c=Z(cc,e=>l[e]);((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()})(o,c)&&(Rt(e,c),i&&((e,t)=>{Ya(e,t.classes),Et(e,dc).each(t=>{clearTimeout(parseInt(t,10)),Mt(e,dc)}),((e,t)=>{const o=nc(),n=nc();let s;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return et(t.target,e)&&Be(n)&&R(cc,t.raw.propertyName)},i=r=>{if(m(r)||a(r)){o.clear(),n.clear();const a=null==r?void 0:r.raw.type;(m(a)||a===sr())&&(clearTimeout(s),Mt(e,dc),Xa(e,t.classes))}},l=ac(e,rr(),t=>{a(t)&&(l.unbind(),o.set(ac(e,sr(),i)),n.set(ac(e,nr(),i)))}),c=(e=>{const t=t=>{const o=Nt(e,t).split(/\s*,\s*/);return U(o,De)},o=e=>{if(r(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return Ae(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),s=t("transition-duration");return j(s,(e,t,s)=>{const r=o(n[s])+o(t);return Math.max(e,r)},0)})(e);requestAnimationFrame(()=>{s=setTimeout(i,c+17),Ot(e,dc,s)})})(e,t)})(e,n),Ut(e))}else Xa(e,n.classes)},mc=(e,t)=>{((e,t)=>{const o=jt.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);It(e,"max-height",o+"px")})(e,Math.floor(t))},gc=x((e,t)=>{mc(e,t),Ft(e,{"overflow-x":"hidden","overflow-y":"auto"})}),pc=x((e,t)=>{mc(e,t)}),hc=(e,t,o)=>void 0===e[t]?o:e[t],fc=(e,t,o,n)=>{const s=((e,t,o,n)=>{Pt(t,"max-height"),Pt(t,"max-width");const s={width:eo(r=t),height:$t(r)};var r;return((e,t,o,n,s,r)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,s,e,r),g=tc(m,a,i,r);return g.fold(x(g),(e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?g:ec.nofit(l,c,d,u))};return j(t,(e,t)=>{const o=C(l,t);return e.fold(x(e),o)},ec.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:Gi(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1)).fold(w,w)})(t,n.preference,e,s,o,n.bounds)})(e,t,o,n);return((e,t,o)=>{const n=$l(o.origin,t);o.transition.each(s=>{uc(e,o.origin,n,s,t,o.lastPlacement)}),Wl(e,n)})(t,s,n),((e,t)=>{((e,t)=>{Ot(e,Zl,t)})(e,t.placement)})(t,s),((e,t)=>{const o=t.classes;Xa(e,o.off),Ya(e,o.on)})(t,s),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,s,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,s,n),{layout:s.layout,placement:s.placement}},bc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],vc=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>be(o,e).getOr([]),i=(e,t,o)=>{const n=J(bc,o);return{offset:Yt(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(s,r,["top","alignLeft","inset"]),insetNorthwest:()=>i(-s,r,["top","alignRight","inset"]),insetNorth:()=>i(-s/2,r,["top","alignCentre","inset"]),insetSoutheast:()=>i(s,-r,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-s,-r,["bottom","alignRight","inset"]),insetSouth:()=>i(-s/2,-r,["bottom","alignCentre","inset"]),insetEast:()=>i(-s,-r/2,["valignCentre","right","inset"]),insetWest:()=>i(s,-r/2,["valignCentre","left","inset"])}},yc=()=>vc(0,0,{}),xc=w,wc=(e,t)=>o=>"rtl"===Sc(o)?t:e,Sc=e=>"rtl"===Nt(e,"direction")?"rtl":"ltr";var Cc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Cc||(Cc={}));const kc="data-alloy-vertical-dir",Oc=e=>fi(e,e=>$e(e)&&Tt(e,"data-alloy-vertical-dir")===Cc.BottomToTop),_c=()=>xs("layouts",[ss("onLtr"),ss("onRtl"),gs("onBottomLtr"),gs("onBottomRtl")]),Tc=(e,t,o,n,s,r,a)=>{const i=a.map(Oc).getOr(!1),l=t.layouts.map(t=>t.onLtr(e)),c=t.layouts.map(t=>t.onRtl(e)),d=i?t.layouts.bind(t=>t.onBottomLtr.map(t=>t(e))).or(l).getOr(s):l.getOr(o),u=i?t.layouts.bind(t=>t.onBottomRtl.map(t=>t(e))).or(c).getOr(r):c.getOr(n);return wc(d,u)(e)};var Ec=[ss("hotspot"),gs("bubble"),ws("overrides",{}),_c(),Hi("placement",(e,t,o)=>{const n=t.hotspot,s=ql(o,n.element),r=Tc(e.element,t,wl(),Sl(),yl(),xl(),A.some(t.hotspot.element));return A.some(xc({anchorBox:s,bubble:t.bubble.getOr(yc()),overrides:t.overrides,layouts:r}))})],Ac=[ss("x"),ss("y"),ws("height",0),ws("width",0),ws("bubble",yc()),ws("overrides",{}),_c(),Hi("placement",(e,t,o)=>{const n=Xl(o,t.x,t.y),s=Zo(n.left,n.top,t.width,t.height),r=Tc(e.element,t,bl(),vl(),bl(),vl(),A.none());return A.some(xc({anchorBox:s,bubble:t.bubble,overrides:t.overrides,layouts:r}))})];const Mc=Ds([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),Dc=e=>e.fold(w,(e,t,o)=>e.translate(-t,-o)),Bc=e=>e.fold(w,w),Ic=e=>j(e,(e,t)=>e.translate(t.left,t.top),Yt(0,0)),Fc=e=>{const t=V(e,Bc);return Ic(t)},Rc=Mc.screen,Nc=Mc.absolute,Lc=(e,t,o)=>{const n=ot(e.element),s=jo(n),r=((e,t,o)=>{const n=rt(o.root).dom;return A.from(n.frameElement).map(ze).filter(t=>{const o=ot(t),n=ot(e.element);return et(o,n)}).map(Kt)})(e,0,o).getOr(s);return Nc(r,s.left,s.top)},zc=(e,t,o,n)=>{const s=Rc(Yt(e,t));return A.some(((e,t,o)=>({point:e,width:t,height:o}))(s,o,n))},Vc=(e,t,o,n,s)=>e.map(e=>{const r=[t,e.point],a=(i=()=>Fc(r),l=()=>Fc(r),c=()=>(e=>{const t=V(e,Dc);return Ic(t)})(r),n.fold(i,l,c));var i,l,c;const d=(p=a.left,h=a.top,f=e.width,b=e.height,{x:p,y:h,width:f,height:b}),u=o.showAbove?yl():wl(),m=o.showAbove?xl():Sl(),g=Tc(s,o,u,m,u,m,A.none());var p,h,f,b;return xc({anchorBox:d,bubble:o.bubble.getOr(yc()),overrides:o.overrides,layouts:g})});var Hc=[ss("node"),ss("root"),gs("bubble"),_c(),ws("overrides",{}),ws("showAbove",!1),Hi("placement",(e,t,o)=>{const n=Lc(e,0,t);return t.node.filter(wt).bind(s=>{const r=s.dom.getBoundingClientRect(),a=zc(r.left,r.top,r.width,r.height),i=t.node.getOr(e.element);return Vc(a,n,t,o,i)})})];const Pc=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),Uc=Ds([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Wc=(Uc.before,Uc.on,Uc.after,e=>e.fold(w,w,w)),jc=Ds([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Gc={domRange:jc.domRange,relative:jc.relative,exact:jc.exact,exactFromRange:e=>jc.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>ze(e.startContainer),relative:(e,t)=>Wc(e),exact:(e,t,o,n)=>e}))(e);return rt(t)},range:Pc},$c=(e,t,o)=>{const n=e.document.createRange();var s;return s=n,t.fold(e=>{s.setStartBefore(e.dom)},(e,t)=>{s.setStart(e.dom,t)},e=>{s.setStartAfter(e.dom)}),((e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})})(n,o),n},qc=(e,t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},Yc=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),Xc=Ds([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Kc=(e,t,o)=>t(ze(o.startContainer),o.startOffset,ze(o.endContainer),o.endOffset),Jc=(e,t)=>((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:x(e),rtl:A.none}),relative:(t,o)=>({ltr:to(()=>$c(e,t,o)),rtl:to(()=>A.some($c(e,o,t)))}),exact:(t,o,n,s)=>({ltr:to(()=>qc(e,t,o,n,s)),rtl:to(()=>A.some(qc(e,n,s,t,o)))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter(e=>!1===e.collapsed).map(e=>Xc.rtl(ze(e.endContainer),e.endOffset,ze(e.startContainer),e.startOffset)).getOrThunk(()=>Kc(0,Xc.ltr,o)):Kc(0,Xc.ltr,o)})(0,o)})(e,t).match({ltr:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},rtl:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(n.dom,s),r.setEnd(t.dom,o),r}});Xc.ltr,Xc.rtl;const Zc=(e,t,o)=>U(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const s=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=ze(e);if(s.push(t),!0===o(t))break;n=e}return s})(e,o),t),Qc=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ze(o)?[]:V(o.querySelectorAll(e),ze)})(t,e),ed=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(Pc(ze(t.startContainer),t.startOffset,ze(o.endContainer),o.endOffset))}return A.none()},td=e=>{if(null===e.anchorNode||null===e.focusNode)return ed(e);{const t=ze(e.anchorNode),o=ze(e.focusNode);return((e,t,o,n)=>{const s=((e,t,o,n)=>{const s=ot(e).dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s})(e,t,o,n),r=et(e,o)&&t===n;return s.collapsed&&!r})(t,e.anchorOffset,o,e.focusOffset)?A.some(Pc(t,e.anchorOffset,o,e.focusOffset)):ed(e)}},od=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(Yc):A.none()})(Jc(e,t)),nd=(e=>{const t=t=>e(t)?A.from(t.dom.nodeValue):A.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(qe),sd=(e,t)=>({element:e,offset:t}),rd=(e,t)=>qe(e)?sd(e,t):((e,t)=>{const o=ct(e);if(0===o.length)return sd(e,t);if(t<o.length)return sd(o[t],0);{const e=o[o.length-1],t=qe(e)?(e=>nd.get(e))(e).length:ct(e).length;return sd(e,t)}})(e,t),ad=e=>void 0!==e.foffset,id=(e,t)=>t.getSelection.getOrThunk(()=>()=>(e=>(e=>A.from(e.getSelection()))(e).filter(e=>e.rangeCount>0).bind(td))(e))().map(e=>{if(ad(e)){const t=rd(e.start,e.soffset),o=rd(e.finish,e.foffset);return Gc.range(t.element,t.offset,o.element,o.offset)}return e});var ld=[gs("getSelection"),ss("root"),gs("bubble"),_c(),ws("overrides",{}),ws("showAbove",!1),Hi("placement",(e,t,o)=>{const n=rt(t.root).dom,s=Lc(e,0,t),r=id(n,t).bind(e=>{if(ad(e)){const t=((e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?A.some(t).map(Yc):A.none()})(Jc(e,t)))(n,Gc.exactFromRange(e)).orThunk(()=>{const t=Le("\ufeff");Lo(e.start,t);const o=od(n,Gc.exact(t,0,t,1));return Wo(t),o});return t.bind(e=>zc(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 zc(o.left,o.top,o.right-o.left,o.bottom-o.top)}}),a=id(n,t).bind(e=>ad(e)?$e(e.start)?A.some(e.start):it(e.start):A.some(e.firstCell)).getOr(e.element);return Vc(r,s,t,o,a)})];const cd="link-layout",dd=e=>e.x+e.width,ud=(e,t)=>e.x-t.width,md=(e,t)=>e.y-t.height+e.height,gd=e=>e.y,pd=(e,t,o)=>Wi(dd(e),gd(e),o.southeast(),Gi(),"southeast",tl(e,{left:0,top:2}),cd),hd=(e,t,o)=>Wi(ud(e,t),gd(e),o.southwest(),$i(),"southwest",tl(e,{right:1,top:2}),cd),fd=(e,t,o)=>Wi(dd(e),md(e,t),o.northeast(),qi(),"northeast",tl(e,{left:0,bottom:3}),cd),bd=(e,t,o)=>Wi(ud(e,t),md(e,t),o.northwest(),Yi(),"northwest",tl(e,{right:1,bottom:3}),cd),vd=()=>[pd,hd,fd,bd],yd=()=>[hd,pd,bd,fd];var xd=[ss("item"),_c(),ws("overrides",{}),Hi("placement",(e,t,o)=>{const n=ql(o,t.item.element),s=Tc(e.element,t,vd(),yd(),vd(),yd(),A.none());return A.some(xc({anchorBox:n,bubble:yc(),overrides:t.overrides,layouts:s}))})],wd=Qn("type",{selection:ld,node:Hc,hotspot:Ec,submenu:xd,makeshift:Ac});const Sd=[ms("classes",Pn),Os("mode","all",["all","layout","placement"])],Cd=[ws("useFixed",T),gs("getBounds")],kd=[rs("anchor",wd),xs("transition",Sd)],Od=(e,t,o,n,s,r)=>{const a=Jn("placement.info",In(kd),s),i=a.anchor,l=n.element,c=o.get(n.uid);Pl(()=>{It(l,"position","fixed");const s=zt(l,"visibility");It(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return Jl(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Kt(e.element),o=e.element.dom.getBoundingClientRect();return Kl(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each(e=>{const s=r.orThunk(()=>t.getBounds.map(_)),i=((e,t,o,n,s,r)=>((e,t,o,n,s,r,a,i)=>{const l=hc(a,"maxHeightFunction",gc()),c=hc(a,"maxWidthFunction",b),d=e.anchorBox,u=e.origin,m={bounds:Yl(u,r),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:s,transition:i};return fc(d,t,o,m)})(((e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t))(t.anchorBox,e),n.element,t.bubble,t.layouts,s,o,t.overrides,r))(d,e,s,n,c,a.transition);o.set(n.uid,i)}),s.fold(()=>{Pt(l,"visibility")},e=>{It(l,"visibility",e)}),zt(l,"left").isNone()&&zt(l,"top").isNone()&&zt(l,"right").isNone()&&zt(l,"bottom").isNone()&&xe(zt(l,"position"),"fixed")&&Pt(l,"position")},l)};var _d=Object.freeze({__proto__:null,position:(e,t,o,n,s)=>{const r=A.none();Od(e,t,o,n,s,r)},positionWithinBounds:Od,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const s=n.element;H(["position","left","right","top","bottom"],e=>Pt(s,e)),(e=>{Mt(e,Zl)})(s),o.clear(n.uid)}});const Td=Ml({fields:Cd,name:"positioning",active:Rl,apis:_d,state:Object.freeze({__proto__:null,init:()=>{let e={};return Ea({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>be(e,t)})}})}),Ed=e=>e.getSystem().isConnected(),Ad=e=>{Rr(e,Or());const t=e.components();H(t,Ad)},Md=e=>{const t=e.components();H(t,Md),Rr(e,kr())},Dd=(e,t)=>{e.getSystem().addToWorld(t),wt(e.element)&&Md(t)},Bd=e=>{Ad(e),e.getSystem().removeFromWorld(e)},Id=(e,t)=>{Ho(e.element,t.element)},Fd=(e,t)=>{Rd(e,t,Ho)},Rd=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),wt(e.element)&&Md(t),e.syncComponents()},Nd=e=>{Ad(e),Wo(e.element),e.getSystem().removeFromWorld(e)},Ld=e=>{const t=at(e.element).bind(t=>e.getSystem().getByDom(t).toOptional());Nd(e),t.each(e=>{e.syncComponents()})},zd=e=>{const t=e.components();H(t,Nd),Uo(e.element),e.syncComponents()},Vd=(e,t)=>{Pd(e,t,Ho)},Hd=(e,t)=>{Pd(e,t,zo)},Pd=(e,t,o)=>{o(e,t.element);const n=ct(t.element);H(n,e=>{t.getByDom(e).each(Md)})},Ud=e=>{const t=ct(e.element);H(t,t=>{e.getByDom(t).each(Ad)}),Wo(e.element)},Wd=(e,t,o,n)=>{o.get().each(t=>{zd(e)});const s=t.getAttachPoint(e);Fd(s,e);const r=e.getSystem().build(n);return Fd(e,r),o.set(r),r},jd=(e,t,o,n)=>{const s=Wd(e,t,o,n);return t.onOpen(e,s),s},Gd=(e,t,o)=>{o.get().each(n=>{zd(e),Ld(e),t.onClose(e,n),o.clear()})},$d=(e,t,o)=>o.isOpen(),qd=(e,t,o)=>{const n=t.getAttachPoint(e);It(e.element,"position",Td.getMode(n)),((e,t,o)=>{zt(e.element,t).fold(()=>{Mt(e.element,o)},t=>{Ot(e.element,o,t)}),It(e.element,t,"hidden")})(e,"visibility",t.cloakVisibilityAttr)},Yd=(e,t,o)=>{(e=>N(["top","left","right","bottom"],t=>zt(e,t).isSome()))(e.element)||Pt(e.element,"position"),((e,t,o)=>{Et(e.element,o).fold(()=>Pt(e.element,t),o=>It(e.element,t,o))})(e,"visibility",t.cloakVisibilityAttr)};var Xd=Object.freeze({__proto__:null,cloak:qd,decloak:Yd,open:jd,openWhileCloaked:(e,t,o,n,s)=>{qd(e,t),jd(e,t,o,n),s(),Yd(e,t)},close:Gd,isOpen:$d,isPartOf:(e,t,o,n)=>$d(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(()=>Wd(e,t,o,n))}),Kd=Object.freeze({__proto__:null,events:(e,t)=>Pr([jr(br(),(o,n)=>{Gd(o,e,t)})])}),Jd=[Ni("onOpen"),Ni("onClose"),ss("isPartOf"),ss("getAttachPoint"),ws("cloakVisibilityAttr","data-precloak-visibility")],Zd=Object.freeze({__proto__:null,init:()=>{const e=sc(),t=x("not-implemented");return Ea({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Qd=Ml({fields:Jd,name:"sandboxing",active:Kd,apis:Xd,state:Zd}),eu=x("dismiss.popups"),tu=x("reposition.popups"),ou=x("mouse.released"),nu=Bn([ws("isExtraPart",T),xs("fireEventInstead",[ws("event",_r())])]),su=e=>{const t=Jn("Dismissal",nu,e);return{[eu()]:{schema:Bn([ss("target")]),onReceive:(e,o)=>{Qd.isOpen(e)&&(Qd.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold(()=>Qd.close(e),t=>Rr(e,t.event)))}}}},ru=Bn([xs("fireEventInstead",[ws("event",Tr())]),cs("doReposition")]),au=e=>{const t=Jn("Reposition",ru,e);return{[tu()]:{onReceive:e=>{Qd.isOpen(e)&&t.fireEventInstead.fold(()=>t.doReposition(e),t=>Rr(e,t.event))}}}},iu=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},lu=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var cu=Object.freeze({__proto__:null,onLoad:iu,onUnload:lu,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}),du=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[Zr((o,n)=>{iu(o,e,t)}),Qr((o,n)=>{lu(o,e,t)})]:[Ol(e,t,iu)];return Pr(o)}});const uu=()=>{const e=Ms(null);return Ea({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},mu=()=>{const e=Ms({}),t=Ms({});return Ea({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(),s=t.get(),r={},a={};H(o,e=>{r[e.value]=e,be(e,"meta").each(t=>{be(t,"text").each(t=>{a[t]=e})})}),e.set({...n,...r}),t.set({...s,...a})},clear:()=>{e.set({}),t.set({})}})};var gu=Object.freeze({__proto__:null,memory:uu,dataset:mu,manual:()=>Ea({readState:b}),init:e=>e.store.manager.state(e)});const pu=(e,t,o,n)=>{const s=t.store;o.update([n]),s.setValue(e,n),t.onSetValue(e,n)};var hu=[gs("initialValue"),ss("getFallbackEntry"),ss("getDataKey"),ss("setValue"),Hi("manager",{setValue:pu,getValue:(e,t,o)=>{const n=t.store,s=n.getDataKey(e);return o.lookup(s).getOrThunk(()=>n.getFallbackEntry(s))},onLoad:(e,t,o)=>{t.store.initialValue.each(n=>{pu(e,t,o,n)})},onUnload:(e,t,o)=>{o.clear()},state:mu})],fu=[ss("getValue"),ws("setValue",b),gs("initialValue"),Hi("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:Ta.init})],bu=[gs("initialValue"),Hi("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:uu})],vu=[Ss("store",{mode:"memory"},Qn("mode",{memory:bu,manual:fu,dataset:hu})),Ni("onSetValue"),ws("resetOnDom",!1)];const yu=Ml({fields:vu,name:"representing",active:du,apis:cu,extra:{setValueFrom:(e,t)=>{const o=yu.getValue(t);yu.setValue(e,o)}},state:gu}),xu=(e,t)=>As(e,{},V(t,t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,ts(o,o,{tag:"option",process:{}},_n(e=>gn("The field: "+o+" is forbidden. "+n)));var o,n}).concat([os("dump",w)])),wu=e=>e.dump,Su=(e,t)=>({...El(t),...e.dump}),Cu=xu,ku=Su,Ou="placeholder",_u=Ds([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Tu=e=>ve(e,"uiType"),Eu=(e,t,o,n)=>((e,t,o,n)=>Tu(o)&&o.uiType===Ou?((e,t,o,n)=>e.exists(e=>e!==o.owner)?_u.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):_u.single(!1,x(o)))(e,0,o,n).fold((s,r)=>{const a=Tu(o)?r(t,o.config,o.validated):r(t),i=be(a,"components").getOr([]),l=Y(i,o=>Eu(e,t,o,n));return[{...a,components:l}]},(e,n)=>{if(Tu(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)}),Au=_u.single,Mu=_u.multiple,Du=x(Ou),Bu=Ds([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Iu=ws("factory",{sketch:w}),Fu=ws("schema",[]),Ru=ss("name"),Nu=ts("pname","pname",xn(e=>"<alloy."+da(e.name)+">"),zn()),Lu=os("schema",()=>[gs("preprocess")]),zu=ws("defaults",x({})),Vu=ws("overrides",x({})),Hu=In([Iu,Fu,Ru,Nu,zu,Vu]),Pu=In([Iu,Fu,Ru,zu,Vu]),Uu=In([Iu,Fu,Ru,Nu,zu,Vu]),Wu=In([Iu,Lu,Ru,ss("unit"),Nu,zu,Vu]),ju=e=>e.fold(A.some,A.none,A.some,A.some),Gu=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},$u=(e,t)=>o=>{const n=Jn("Converting part type",t,o);return e(n)},qu=$u(Bu.required,Hu),Yu=$u(Bu.external,Pu),Xu=$u(Bu.optional,Uu),Ku=$u(Bu.group,Wu),Ju=x("entirety");var Zu=Object.freeze({__proto__:null,required:qu,external:Yu,optional:Xu,group:Ku,asNamedPart:ju,name:Gu,asCommon:e=>e.fold(w,w,w,w),original:Ju});const Qu=(e,t,o,n)=>vn(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),em=(e,t)=>{const o={};return H(t,t=>{ju(t).each(t=>{const n=tm(e,t.pname);o[t.name]=o=>{const s=Jn("Part: "+t.name+" in "+e,In(t.schema),o);return{...n,config:o,validated:s}}})}),o},tm=(e,t)=>({uiType:Du(),owner:e,name:t}),om=(e,t,o)=>({uiType:Du(),owner:e,name:t,config:o,validated:{}}),nm=e=>Y(e,e=>e.fold(A.none,A.some,A.none,A.none).map(e=>ds(e.name,e.schema.concat([Pi(Ju())]))).toArray()),sm=e=>V(e,Gu),rm=(e,t,o)=>((e,t,o)=>{const n={},s={};return H(o,e=>{e.fold(e=>{n[e.pname]=Au(!0,(t,o,n)=>e.factory.sketch(Qu(t,e,o,n)))},e=>{const o=t.parts[e.name];s[e.name]=x(e.factory.sketch(Qu(t,e,o[Ju()]),o))},e=>{n[e.pname]=Au(!1,(t,o,n)=>e.factory.sketch(Qu(t,e,o,n)))},e=>{n[e.pname]=Mu(!0,(t,o,n)=>{const s=t[e.name];return V(s,o=>e.factory.sketch(vn(e.defaults(t,o,n),o,e.overrides(t,o))))})})}),{internals:x(n),externals:x(s)}})(0,t,o),am=(e,t,o)=>((e,t,o,n)=>{const s=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)),r=((e,t,o,n)=>Y(o,o=>Eu(e,t,o,n)))(e,t,o,s);return le(s,o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))}),r})(A.some(e),t,t.components,o),im=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},lm=(e,t,o)=>im(e,t,o).getOrDie("Could not find part: "+o),cm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return H(o,e=>{n[e]=x(r.getByUid(s[e]))}),n},dm=(e,t)=>{const o=e.getSystem();return ce(t.partUids,(e,t)=>x(o.getByUid(e)))},um=e=>ae(e.partUids),mm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return H(o,e=>{n[e]=x(r.getByUid(s[e]).getOrDie())}),n},gm=(e,t)=>{const o=sm(t);return Is(V(o,t=>({key:t,value:e+"-"+t})))},pm=e=>ts("partUids","partUids",Sn(t=>gm(t.uid,e)),zn());var hm=Object.freeze({__proto__:null,generate:em,generateOne:om,schemas:nm,names:sm,substitutes:rm,components:am,defaultUids:gm,defaultUidsSchema:pm,getAllParts:dm,getAllPartNames:um,getPart:im,getPartOrDie:lm,getParts:cm,getPartsOrDie:mm});const fm=(e,t,o,n,s)=>{const r=((e,t)=>(e.length>0?[ds("parts",e)]:[]).concat([ss("uid"),ws("dom",{}),ws("components",[]),Pi("originalSpec"),ws("debug.sketcher",{})]).concat(t))(n,s);return Jn(e+" [SpecSchema]",Bn(r.concat(t)),o)},bm=(e,t,o,n,s)=>{const r=vm(s),a=nm(o),i=pm(o),l=fm(e,t,r,a,[i]),c=rm(0,l,o);return n(l,am(e,l,c.internals()),r,c.externals())},vm=e=>(e=>ve(e,"uid"))(e)?e:{...e,uid:ba("uid")},ym=Bn([ss("name"),ss("factory"),ss("configFields"),ws("apis",{}),ws("extraApis",{})]),xm=Bn([ss("name"),ss("factory"),ss("configFields"),ss("partFields"),ws("apis",{}),ws("extraApis",{})]),wm=e=>{const t=Jn("Sketcher for "+e.name,ym,e),o=ce(t.apis,_a),n=ce(t.extraApis,(e,t)=>Sa(e,t));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const s=vm(n);return o(fm(e,t,s,[],[]),s)})(t.name,t.configFields,t.factory,e),...o,...n}},Sm=e=>{const t=Jn("Sketcher for "+e.name,xm,e),o=em(t.name,t.partFields),n=ce(t.apis,_a),s=ce(t.extraApis,(e,t)=>Sa(e,t));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>bm(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...s}},Cm=e=>Ke("input")(e)&&"radio"!==Tt(e,"type")||Ke("textarea")(e);var km=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const Om=[ss("find")],_m=Ml({fields:Om,name:"composing",apis:km}),Tm=["input","button","textarea","select"],Em=(e,t,o)=>{(t.disabled()?Fm:Rm)(e,t)},Am=(e,t)=>!0===t.useNative&&R(Tm,We(e.element)),Mm=e=>{Ot(e.element,"disabled","disabled")},Dm=e=>{Mt(e.element,"disabled")},Bm=e=>{Ot(e.element,"aria-disabled","true")},Im=e=>{Ot(e.element,"aria-disabled","false")},Fm=(e,t,o)=>{t.disableClass.each(t=>{ja(e.element,t)}),(Am(e,t)?Mm:Bm)(e),t.onDisabled(e)},Rm=(e,t,o)=>{t.disableClass.each(t=>{$a(e.element,t)}),(Am(e,t)?Dm:Im)(e),t.onEnabled(e)},Nm=(e,t)=>Am(e,t)?(e=>At(e.element,"disabled"))(e):(e=>"true"===Tt(e.element,"aria-disabled"))(e);var Lm=Object.freeze({__proto__:null,enable:Rm,disable:Fm,isDisabled:Nm,onLoad:Em,set:(e,t,o,n)=>{(n?Fm:Rm)(e,t)}}),zm=Object.freeze({__proto__:null,exhibit:(e,t)=>Ma({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>Pr([Ur(gr(),(t,o)=>Nm(t,e)),Ol(e,t,Em)])}),Vm=[Ts("disabled",T),ws("useNative",!0),gs("disableClass"),Ni("onDisabled"),Ni("onEnabled")];const Hm=Ml({fields:Vm,name:"disabling",active:zm,apis:Lm}),Pm=(e,t,o,n)=>{const s=Qc(e.element,"."+t.highlightClass);H(s,o=>{N(n,e=>et(e.element,o))||($a(o,t.highlightClass),e.getSystem().getByDom(o).each(o=>{t.onDehighlight(e,o),Rr(o,Fr())}))})},Um=(e,t,o,n)=>{Pm(e,t,0,[n]),Wm(e,t,o,n)||(ja(n.element,t.highlightClass),t.onHighlight(e,n),Rr(n,Ir()))},Wm=(e,t,o,n)=>qa(n.element,t.highlightClass),jm=(e,t,o)=>yi(e.element,"."+t.itemClass).bind(t=>e.getSystem().getByDom(t).toOptional()),Gm=(e,t,o)=>{const n=Qc(e.element,"."+t.itemClass);return(n.length>0?A.some(n[n.length-1]):A.none()).bind(t=>e.getSystem().getByDom(t).toOptional())},$m=(e,t,o,n)=>{const s=Qc(e.element,"."+t.itemClass);return $(s,e=>qa(e,t.highlightClass)).bind(t=>{const o=Qi(t,n,0,s.length-1);return e.getSystem().getByDom(s[o]).toOptional()})},qm=(e,t,o)=>{const n=Qc(e.element,"."+t.itemClass);return we(V(n,t=>e.getSystem().getByDom(t).toOptional()))};var Ym=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>Pm(e,t,0,[]),dehighlight:(e,t,o,n)=>{Wm(e,t,o,n)&&($a(n.element,t.highlightClass),t.onDehighlight(e,n),Rr(n,Fr()))},highlight:Um,highlightFirst:(e,t,o)=>{jm(e,t).each(n=>{Um(e,t,o,n)})},highlightLast:(e,t,o)=>{Gm(e,t).each(n=>{Um(e,t,o,n)})},highlightAt:(e,t,o,n)=>{((e,t,o,n)=>{const s=Qc(e.element,"."+t.itemClass);return A.from(s[n]).fold(()=>an.error(new Error("No element found with index "+n)),e.getSystem().getByDom)})(e,t,0,n).fold(e=>{throw e},n=>{Um(e,t,o,n)})},highlightBy:(e,t,o,n)=>{const s=qm(e,t);G(s,n).each(n=>{Um(e,t,o,n)})},isHighlighted:Wm,getHighlighted:(e,t,o)=>yi(e.element,"."+t.highlightClass).bind(t=>e.getSystem().getByDom(t).toOptional()),getFirst:jm,getLast:Gm,getPrevious:(e,t,o)=>$m(e,t,0,-1),getNext:(e,t,o)=>$m(e,t,0,1),getCandidates:qm}),Xm=[ss("highlightClass"),ss("itemClass"),Ni("onHighlight"),Ni("onDehighlight")];const Km=Ml({fields:Xm,name:"highlighting",apis:Ym}),Jm=[8],Zm=[9],Qm=[13],eg=[27],tg=[32],og=[37],ng=[38],sg=[39],rg=[40],ag=(e,t,o)=>{const n=K(e.slice(0,t)),s=K(e.slice(t+1));return G(n.concat(s),o)},ig=(e,t,o)=>{const n=K(e.slice(0,t));return G(n,o)},lg=(e,t,o)=>{const n=e.slice(0,t),s=e.slice(t+1);return G(s.concat(n),o)},cg=(e,t,o)=>{const n=e.slice(t+1);return G(n,o)},dg=e=>t=>{const o=t.raw;return R(e,o.which)},ug=e=>t=>X(e,e=>e(t)),mg=e=>!0===e.raw.shiftKey,gg=e=>!0===e.raw.ctrlKey,pg=k(mg),hg=(e,t)=>({matches:e,classification:t}),fg=(e,t,o)=>{t.exists(e=>o.exists(t=>et(t,e)))||Nr(e,Er(),{prevFocus:t,newFocus:o})},bg=()=>{const e=e=>Hl(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const s=e(t);fg(t,n,s)}}},vg=()=>{const e=e=>Km.getHighlighted(e).map(e=>e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(b,e=>{Km.highlight(t,e)});const s=e(t);fg(t,n,s)}}};var yg;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(yg||(yg={}));const xg=(e,t,o,n,s)=>{const r=(e,t,o,n,s)=>{return(r=o(e,t,n,s),a=t.event,G(r,e=>e.matches(a)).map(e=>e.classification)).bind(o=>o(e,t,n,s));var r,a},a={schema:()=>e.concat([ws("focusManager",bg()),Ss("focusInside","onFocus",qn(e=>R(["onFocus","onEnterOrSpace","onApi"],e)?an.value(e):an.error("Invalid value for focusInside"))),Hi("handler",a),Hi("state",t),Hi("sendFocusIn",s)]),processKey:r,toEvents:(e,t)=>{const a=e.focusInside!==yg.OnFocusMode?A.none():s(e).map(o=>jr(cr(),(n,s)=>{o(n,e,t),s.stop()})),i=[jr(Zs(),(n,a)=>{r(n,a,o,e,t).fold(()=>{((o,n)=>{const r=dg(tg.concat(Qm))(n.event);e.focusInside===yg.OnEnterOrSpaceMode&&r&&Ls(o,n)&&s(e).each(s=>{s(o,e,t),n.stop()})})(n,a)},e=>{a.stop()})}),jr(Qs(),(o,s)=>{r(o,s,n,e,t).each(e=>{s.stop()})})];return Pr(a.toArray().concat(i))}};return a},wg=e=>{const t=[gs("onEscape"),gs("onEnter"),ws("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),ws("firstTabstop",0),ws("useTabstopAt",E),gs("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind(e=>xi(t,e)).getOr(t);return Gt(o)>0},n=(e,t)=>t.focusManager.get(e).bind(e=>xi(e,t.selector)),s=(e,t,n)=>{((e,t)=>{const n=Qc(e.element,t.selector),s=U(n,e=>o(t,e));return A.from(s[t.firstTabstop])})(e,t).each(o=>{t.focusManager.set(e,o)})},r=(e,t,s,r)=>{const a=Qc(e.element,s.selector);return n(e,s).bind(t=>$(a,C(et,t)).bind(t=>((e,t,n,s,r)=>r(t,n,e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(s,e)).fold(()=>s.cyclic?A.some(!0):A.none(),t=>(s.focusManager.set(e,t),A.some(!0))))(e,a,t,s,r)))},a=(e,t,o)=>{const n=o.cyclic?ag:ig;return r(e,0,o,n)},i=(e,t,o)=>{const n=o.cyclic?lg:cg;return r(e,0,o,n)},l=x([hg(ug([mg,dg(Zm)]),a),hg(dg(Zm),i),hg(ug([pg,dg(Qm)]),(e,t,o)=>o.onEnter.bind(o=>o(e,t)))]),c=x([hg(dg(eg),(e,t,o)=>o.onEscape.bind(o=>o(e,t))),hg(dg(Zm),(e,t,o)=>n(e,o).filter(e=>!o.useTabstopAt(e)).bind(n=>((e=>(e=>at(e))(e).bind(ut).exists(t=>et(t,e)))(n)?a:i)(e,t,o)))]);return xg(t,Ta.init,l,c,()=>A.some(s))};var Sg=wg(os("cyclic",T)),Cg=wg(os("cyclic",E));const kg=(e,t,o)=>Cm(o)&&dg(tg)(t.event)?A.none():((e,t,o)=>(zr(e,o,gr()),A.some(!0)))(e,0,o),Og=(e,t)=>A.some(!0),_g=[ws("execute",kg),ws("useSpace",!1),ws("useEnter",!0),ws("useControlEnter",!1),ws("useDown",!1)],Tg=(e,t,o)=>o.execute(e,t,e.element);var Eg=xg(_g,Ta.init,(e,t,o,n)=>{const s=o.useSpace&&!Cm(e.element)?tg:[],r=o.useEnter?Qm:[],a=o.useDown?rg:[],i=s.concat(r).concat(a);return[hg(dg(i),Tg)].concat(o.useControlEnter?[hg(ug([gg,dg(Qm)]),Tg)]:[])},(e,t,o,n)=>o.useSpace&&!Cm(e.element)?[hg(dg(tg),Og)]:[],()=>A.none());const Ag=()=>{const e=sc();return Ea({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 Mg=Object.freeze({__proto__:null,flatgrid:Ag,init:e=>e.state(e)});const Dg=e=>(t,o,n,s)=>{const r=e(t.element);return Rg(r,t,o,n,s)},Bg=(e,t)=>{const o=wc(e,t);return Dg(o)},Ig=(e,t)=>{const o=wc(t,e);return Dg(o)},Fg=e=>(t,o,n,s)=>Rg(e,t,o,n,s),Rg=(e,t,o,n,s)=>n.focusManager.get(t).bind(o=>e(t.element,o,n,s)).map(e=>(n.focusManager.set(t,e),!0)),Ng=Fg,Lg=Fg,zg=Fg,Vg=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),Hg=(e,t,o)=>{const n=Qc(e,o);return(e=>$(e,e=>et(e,t)).map(t=>({index:t,candidates:e})))(U(n,Vg))},Pg=(e,t)=>$(e,e=>et(t,e)),Ug=(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?A.some(e[n]):A.none()}),Wg=(e,t,o,n,s)=>Ug(e,t,n,(t,r)=>{const a=t===o-1?e.length-t*n:n,i=Qi(r,s,0,a-1);return A.some({row:t,column:i})}),jg=(e,t,o,n,s)=>Ug(e,t,n,(t,r)=>{const a=Qi(t,s,0,o-1),i=a===o-1?e.length-a*n:n,l=el(r,0,i-1);return A.some({row:a,column:l})}),Gg=[ss("selector"),ws("execute",kg),Li("onEscape"),ws("captureTab",!1),Ui()],$g=(e,t,o)=>{yi(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},qg=e=>(t,o,n,s)=>Hg(t,o,n.selector).bind(t=>e(t.candidates,t.index,s.getNumRows().getOr(n.initSize.numRows),s.getNumColumns().getOr(n.initSize.numColumns))),Yg=(e,t,o)=>o.captureTab?A.some(!0):A.none(),Xg=qg((e,t,o,n)=>Wg(e,t,o,n,-1)),Kg=qg((e,t,o,n)=>Wg(e,t,o,n,1)),Jg=qg((e,t,o,n)=>jg(e,t,o,n,-1)),Zg=qg((e,t,o,n)=>jg(e,t,o,n,1)),Qg=x([hg(dg(og),Bg(Xg,Kg)),hg(dg(sg),Ig(Xg,Kg)),hg(dg(ng),Ng(Jg)),hg(dg(rg),Lg(Zg)),hg(ug([mg,dg(Zm)]),Yg),hg(ug([pg,dg(Zm)]),Yg),hg(dg(tg.concat(Qm)),(e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind(e=>xi(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)))]),ep=x([hg(dg(eg),(e,t,o)=>o.onEscape(e,t)),hg(dg(tg),Og)]);var tp=xg(Gg,Ag,Qg,ep,()=>A.some($g));const op=(e,t,o,n,s)=>{const r=(e,t,o)=>s(e,t,n,0,o.length-1,o[t],t=>{return n=o[t],"button"===We(n)&&"disabled"===Tt(n,"disabled")?r(e,t,o):A.from(o[t]);var n});return Hg(e,o,t).bind(e=>{const t=e.index,o=e.candidates;return r(t,t,o)})},np=(e,t,o,n)=>op(e,t,o,n,(e,t,o,n,s,r,a)=>{const i=el(t+o,n,s);return i===e?A.from(r):a(i)}),sp=(e,t,o,n)=>op(e,t,o,n,(e,t,o,n,s,r,a)=>{const i=Qi(t,o,n,s);return i===e?A.none():a(i)}),rp=[ss("selector"),ws("getInitial",A.none),ws("execute",kg),Li("onEscape"),ws("executeOnMove",!1),ws("allowVertical",!0),ws("allowHorizontal",!0),ws("cycles",!0)],ap=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind(e=>xi(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)),ip=(e,t,o)=>{t.getInitial(e).orThunk(()=>yi(e.element,t.selector)).each(o=>{t.focusManager.set(e,o)})},lp=(e,t,o)=>(o.cycles?sp:np)(e,o.selector,t,-1),cp=(e,t,o)=>(o.cycles?sp:np)(e,o.selector,t,1),dp=e=>(t,o,n,s)=>e(t,o,n,s).bind(()=>n.executeOnMove?ap(t,o,n):A.some(!0)),up=x([hg(dg(tg),Og),hg(dg(eg),(e,t,o)=>o.onEscape(e,t))]);var mp=xg(rp,Ta.init,(e,t,o,n)=>{const s=[...o.allowHorizontal?og:[]].concat(o.allowVertical?ng:[]),r=[...o.allowHorizontal?sg:[]].concat(o.allowVertical?rg:[]);return[hg(dg(s),dp(Bg(lp,cp))),hg(dg(r),dp(Ig(lp,cp))),hg(dg(Qm),ap),hg(dg(tg),ap)]},up,()=>A.some(ip));const gp=(e,t,o)=>A.from(e[t]).bind(e=>A.from(e[o]).map(e=>({rowIndex:t,columnIndex:o,cell:e}))),pp=(e,t,o,n)=>{const s=e[t].length,r=Qi(o,n,0,s-1);return gp(e,t,r)},hp=(e,t,o,n)=>{const s=Qi(o,n,0,e.length-1),r=e[s].length,a=el(t,0,r-1);return gp(e,s,a)},fp=(e,t,o,n)=>{const s=e[t].length,r=el(o+n,0,s-1);return gp(e,t,r)},bp=(e,t,o,n)=>{const s=el(o+n,0,e.length-1),r=e[s].length,a=el(t,0,r-1);return gp(e,s,a)},vp=[ds("selectors",[ss("row"),ss("cell")]),ws("cycles",!0),ws("previousSelector",A.none),ws("execute",kg)],yp=(e,t,o)=>{t.previousSelector(e).orThunk(()=>{const o=t.selectors;return yi(e.element,o.cell)}).each(o=>{t.focusManager.set(e,o)})},xp=(e,t)=>(o,n,s)=>{const r=s.cycles?e:t;return xi(n,s.selectors.row).bind(e=>{const t=Qc(e,s.selectors.cell);return Pg(t,n).bind(t=>{const n=Qc(o,s.selectors.row);return Pg(n,e).bind(e=>{const o=((e,t)=>V(e,e=>Qc(e,t.selectors.cell)))(n,s);return r(o,e,t).map(e=>e.cell)})})})},wp=xp((e,t,o)=>pp(e,t,o,-1),(e,t,o)=>fp(e,t,o,-1)),Sp=xp((e,t,o)=>pp(e,t,o,1),(e,t,o)=>fp(e,t,o,1)),Cp=xp((e,t,o)=>hp(e,o,t,-1),(e,t,o)=>bp(e,o,t,-1)),kp=xp((e,t,o)=>hp(e,o,t,1),(e,t,o)=>bp(e,o,t,1)),Op=x([hg(dg(og),Bg(wp,Sp)),hg(dg(sg),Ig(wp,Sp)),hg(dg(ng),Ng(Cp)),hg(dg(rg),Lg(kp)),hg(dg(tg.concat(Qm)),(e,t,o)=>Hl(e.element).bind(n=>o.execute(e,t,n)))]),_p=x([hg(dg(tg),Og)]);var Tp=xg(vp,Ta.init,Op,_p,()=>A.some(yp));const Ep=[ss("selector"),ws("execute",kg),ws("moveOnTab",!1)],Ap=(e,t,o)=>o.focusManager.get(e).bind(n=>o.execute(e,t,n)),Mp=(e,t,o)=>{yi(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},Dp=(e,t,o)=>sp(e,o.selector,t,-1),Bp=(e,t,o)=>sp(e,o.selector,t,1),Ip=x([hg(dg(ng),zg(Dp)),hg(dg(rg),zg(Bp)),hg(ug([mg,dg(Zm)]),(e,t,o,n)=>o.moveOnTab?zg(Dp)(e,t,o,n):A.none()),hg(ug([pg,dg(Zm)]),(e,t,o,n)=>o.moveOnTab?zg(Bp)(e,t,o,n):A.none()),hg(dg(Qm),Ap),hg(dg(tg),Ap)]),Fp=x([hg(dg(tg),Og)]);var Rp=xg(Ep,Ta.init,Ip,Fp,()=>A.some(Mp));const Np=[Li("onSpace"),Li("onEnter"),Li("onShiftEnter"),Li("onLeft"),Li("onRight"),Li("onTab"),Li("onShiftTab"),Li("onUp"),Li("onDown"),Li("onEscape"),ws("stopSpaceKeyup",!1),gs("focusIn")];var Lp=xg(Np,Ta.init,(e,t,o)=>[hg(dg(tg),o.onSpace),hg(ug([pg,dg(Qm)]),o.onEnter),hg(ug([mg,dg(Qm)]),o.onShiftEnter),hg(ug([mg,dg(Zm)]),o.onShiftTab),hg(ug([pg,dg(Zm)]),o.onTab),hg(dg(ng),o.onUp),hg(dg(rg),o.onDown),hg(dg(og),o.onLeft),hg(dg(sg),o.onRight),hg(dg(tg),o.onSpace)],(e,t,o)=>[...o.stopSpaceKeyup?[hg(dg(tg),Og)]:[],hg(dg(eg),o.onEscape)],e=>e.focusIn);const zp=Sg.schema(),Vp=Cg.schema(),Hp=mp.schema(),Pp=tp.schema(),Up=Tp.schema(),Wp=Eg.schema(),jp=Rp.schema(),Gp=Lp.schema(),$p=Bl({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:zp,cyclic:Vp,flow:Hp,flatgrid:Pp,matrix:Up,execution:Wp,menu:jp,special:Gp}),name:"keying",active:{events:(e,t)=>e.handler.toEvents(e,t)},apis:{focusIn:(e,t,o)=>{t.sendFocusIn(t).fold(()=>{e.getSystem().triggerFocus(e.element,e.element)},n=>{n(e,t,o)})},setGridSize:(e,t,o,n,s)=>{(e=>ye(e,"setGridSize"))(o)?o.setGridSize(n,s):console.error("Layout does not support setGridSize")}},state:Mg}),qp=(e,t)=>{Pl(()=>{((e,t,o)=>{const n=e.components();(e=>{H(e.components(),e=>Wo(e.element)),Uo(e.element),e.syncComponents()})(e);const s=o(t),r=J(n,s);H(r,t=>{Ad(t),e.getSystem().removeFromWorld(t)}),H(s,t=>{Ed(t)?Id(e,t):(e.getSystem().addToWorld(t),Id(e,t),wt(e.element)&&Md(t))}),e.syncComponents()})(e,t,()=>V(t,e.getSystem().build))},e.element)},Yp=(e,t)=>{Pl(()=>{((o,n)=>{const s=o.components(),r=Y(n,e=>Oa(e).toArray());H(s,e=>{R(r,e)||Bd(e)});const a=((e,t,o)=>ei(e,t,(t,n)=>ti(e,n,t,o)))(e.element,t,e.getSystem().buildOrPatch),i=J(s,a);H(i,e=>{Ed(e)&&Bd(e)}),H(a,e=>{Ed(e)||Dd(o,e)}),o.syncComponents()})(e,t)},e.element)},Xp=(e,t,o,n)=>{Bd(t);const s=ti(e.element,o,n,e.getSystem().buildOrPatch);Dd(e,s),e.syncComponents()},Kp=(e,t,o)=>{const n=e.getSystem().build(o);Rd(e,n,t)},Jp=(e,t,o,n)=>{Ld(t),Kp(e,(e,t)=>((e,t,o)=>{dt(e,o).fold(()=>{Ho(e,t)},e=>{Lo(e,t)})})(e,t,o),n)},Zp=(e,t)=>e.components(),Qp=(e,t,o,n,s)=>{const r=Zp(e);return A.from(r[n]).map(o=>(s.fold(()=>Ld(o),s=>{(t.reuseDom?Xp:Jp)(e,o,n,s)}),o))};var eh=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Kp(e,Ho,n)},prepend:(e,t,o,n)=>{Kp(e,Vo,n)},remove:(e,t,o,n)=>{const s=Zp(e),r=G(s,e=>et(n.element,e.element));r.each(Ld)},replaceAt:Qp,replaceBy:(e,t,o,n,s)=>{const r=Zp(e);return $(r,n).bind(o=>Qp(e,t,0,o,s))},set:(e,t,o,n)=>(t.reuseDom?Yp:qp)(e,n),contents:Zp});const th=Ml({fields:[_s("reuseDom",!0)],name:"replacing",apis:eh}),oh=(e,t)=>{const o=((e,t)=>{const o=Pr(t);return Ml({fields:[ss("enabled")],name:e,active:{events:x(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:x({}),initialConfig:{},state:Ta}}},nh=(e,t)=>{t.ignore||(Nl(e.element),t.onFocus(e))};var sh=Object.freeze({__proto__:null,focus:nh,blur:(e,t)=>{t.ignore||Ll(e.element)},isFocused:e=>zl(e.element)}),rh=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return Ma(o)},events:e=>Pr([jr(cr(),(t,o)=>{nh(t,e),o.stop()})].concat(e.stopMousedown?[jr(Gs(),(e,t)=>{t.event.prevent()})]:[]))}),ah=[Ni("onFocus"),ws("stopMousedown",!1),ws("ignore",!1)];const ih=Ml({fields:ah,name:"focusing",active:rh,apis:sh}),lh=(e,t,o,n)=>{const s=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each(t=>{o.get()?ja(e.element,t):$a(e.element,t)})})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),s!==n&&t.onToggled(e,n)},ch=(e,t,o)=>{lh(e,t,o,!o.get())},dh=(e,t,o)=>{lh(e,t,o,t.selected)};var uh=Object.freeze({__proto__:null,onLoad:dh,toggle:ch,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{lh(e,t,o,!0)},off:(e,t,o)=>{lh(e,t,o,!1)},set:lh}),mh=Object.freeze({__proto__:null,exhibit:()=>Ma({}),events:(e,t)=>{const o=(n=e,s=t,r=ch,ta(e=>{r(e,n,s)}));var n,s,r;const a=Ol(e,t,dh);return Pr(q([e.toggleOnExecute?[o]:[],[a]]))}});const gh=(e,t,o)=>{Ot(e.element,"aria-expanded",o)};var ph=[ws("selected",!1),gs("toggleClass"),ws("toggleOnExecute",!0),Ni("onToggled"),Ss("aria",{mode:"none"},Qn("mode",{pressed:[ws("syncWithExpanded",!1),Hi("update",(e,t,o)=>{Ot(e.element,"aria-pressed",o),t.syncWithExpanded&&gh(e,0,o)})],checked:[Hi("update",(e,t,o)=>{Ot(e.element,"aria-checked",o)})],expanded:[Hi("update",gh)],selected:[Hi("update",(e,t,o)=>{Ot(e.element,"aria-selected",o)})],none:[Hi("update",b)]}))];const hh=Ml({fields:ph,name:"toggling",active:mh,apis:uh,state:(fh=!1,{init:()=>{const e=Ms(fh);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(fh),readState:()=>e.get()}}})});var fh;const bh=()=>{const e=(e,t)=>{t.stop(),Lr(e)};return[jr(or(),e),jr(hr(),e),Xr(Ps()),Xr(Gs())]},vh=e=>Pr(q([e.map(e=>ta((t,o)=>{e(t),o.stop()})).toArray(),bh()])),yh="alloy.item-hover",xh="alloy.item-focus",wh="alloy.item-toggled",Sh=e=>{(Hl(e.element).isNone()||ih.isFocused(e))&&(ih.isFocused(e)||ih.focus(e),Nr(e,yh,{item:e}))},Ch=e=>{Nr(e,xh,{item:e})},kh=x(yh),Oh=x(xh),_h=x(wh),Th=e=>e.toggling.map(e=>e.exclusive?"menuitemradio":"menuitemcheckbox").getOr("menuitem"),Eh=[ss("data"),ss("components"),ss("dom"),ws("hasSubmenu",!1),gs("toggling"),Cu("itemBehaviours",[hh,ih,$p,yu]),ws("ignoreFocus",!1),ws("domModification",{}),Hi("builder",e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:Th(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:ku(e.itemBehaviours,[e.toggling.fold(hh.revoke,e=>hh.config((e=>({aria:{mode:"checked"},...ge(e,(e,t)=>"exclusive"!==t),onToggled:(t,o)=>{p(e.onToggled)&&e.onToggled(t,o),((e,t)=>{Nr(e,wh,{item:e,state:t})})(t,o)}}))(e))),ih.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{Ch(e)}}),$p.config({mode:"execution"}),yu.config({store:{mode:"memory",initialValue:e.data}}),oh("item-type-events",[...bh(),jr(Xs(),Sh),jr(pr(),ih.focus)])]),components:e.components,eventOrder:e.eventOrder})),ws("eventOrder",{})],Ah=[ss("dom"),ss("components"),Hi("builder",e=>({dom:e.dom,components:e.components,events:Pr([Kr(pr())])}))],Mh=x("item-widget"),Dh=x([qu({name:"widget",overrides:e=>({behaviours:El([yu.config({store:{mode:"manual",getValue:t=>e.data,setValue:b}})])})})]),Bh=[ss("uid"),ss("data"),ss("components"),ss("dom"),ws("autofocus",!1),ws("ignoreFocus",!1),Cu("widgetBehaviours",[yu,ih,$p]),ws("domModification",{}),pm(Dh()),Hi("builder",e=>{const t=rm(Mh(),e,Dh()),o=am(Mh(),e,t.internals()),n=t=>im(t,e,"widget").map(e=>($p.focusIn(e),e)),s=(t,o)=>Cm(o.event.target)?A.none():e.autofocus?(o.setSource(t.element),A.none()):A.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Pr([ta((e,t)=>{n(e).each(e=>{t.stop()})}),jr(Xs(),Sh),jr(pr(),(t,o)=>{e.autofocus?n(t):ih.focus(t)})]),behaviours:ku(e.widgetBehaviours,[yu.config({store:{mode:"memory",initialValue:e.data}}),ih.config({ignore:e.ignoreFocus,onFocus:e=>{Ch(e)}}),$p.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:Il(),onLeft:s,onRight:s,onEscape:(t,o)=>ih.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),A.none()):A.none():(ih.focus(t),A.some(!0))})])}})],Ih=Qn("type",{widget:Bh,item:Eh,separator:Ah}),Fh=x([Ku({factory:{sketch:e=>{const t=Jn("menu.spec item",Ih,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>ve(t,"uid")?t:{...t,uid:ba("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),Rh=x([ss("value"),ss("items"),ss("dom"),ss("components"),ws("eventOrder",{}),xu("menuBehaviours",[Km,yu,_m,$p]),Ss("movement",{mode:"menu",moveOnTab:!0},Qn("mode",{grid:[Ui(),Hi("config",(e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager}))],matrix:[Hi("config",(e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager})),ss("rowSelector"),ws("previousSelector",A.none)],menu:[ws("moveOnTab",!0),Hi("config",(e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager}))]})),rs("markers",Di()),ws("fakeFocus",!1),ws("focusManager",bg()),Ni("onHighlight"),Ni("onDehighlight")]),Nh=x("alloy.menu-focus"),Lh=Sm({name:"Menu",configFields:Rh(),partFields:Fh(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Su(e.menuBehaviours,[Km.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),yu.config({store:{mode:"memory",initialValue:e.value}}),_m.config({find:A.some}),$p.config(e.movement.config(e,e.movement))]),events:Pr([jr(Oh(),(e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each(o=>{Km.highlight(e,o),t.stop(),Nr(e,Nh(),{menu:e,item:o})})}),jr(kh(),(e,t)=>{const o=t.event.item;Km.highlight(e,o)}),jr(_h(),(e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===Tt(o.element,"role")&&((e,t)=>{const o=Qc(e.element,'[role="menuitemradio"][aria-checked="true"]');H(o,o=>{et(o,t.element)||e.getSystem().getByDom(o).each(e=>{hh.off(e)})})})(e,o)})]),components:t,eventOrder:e.eventOrder,domModification:{attributes:{role:"menu"}}})}),zh=(e,t,o,n)=>be(o,n).bind(n=>be(e,n).bind(n=>{const s=zh(e,t,o,n);return A.some([n].concat(s))})).getOr([]),Vh=e=>"prepared"===e.type?A.some(e.menu):A.none(),Hh=()=>{const e=Ms({}),t=Ms({}),o=Ms({}),n=sc(),s=Ms({}),r=e=>a(e).bind(Vh),a=e=>be(t.get(),e),i=t=>be(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(r,a,i,l)=>{n.set(r),e.set(i),t.set(a),s.set(l);const c=((e,t)=>{const o={};le(e,(e,t)=>{H(e,e=>{o[e]=t})});const n=t,s=de(t,(e,t)=>({k:e,v:t})),r=ce(s,(e,t)=>[t].concat(zh(o,n,s,t)));return ce(o,e=>be(r,e).getOr([e]))})(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?A.some(e.slice(1)):A.none()),lookupMenu:a,lookupItem:i,otherMenus:e=>{const t=s.get();return J(ae(t),e)},getPrimary:()=>n.get().bind(r),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(t,s)=>{const a=U(i(t).toArray(),e=>r(e).isSome());return be(o.get(),t).bind(t=>{const o=K(a.concat(t));return(e=>{const t=[];for(let o=0;o<e.length;o++){const n=e[o];if(!n.isSome())return A.none();t.push(n.getOrDie())}return A.some(t)})(Y(o,(t,a)=>((t,o,n)=>r(t).bind(s=>(t=>he(e.get(),(e,o)=>e===t))(t).bind(e=>o(e).map(e=>({triggeredMenu:s,triggeringItem:e,triggeringPath:n})))))(t,s,o.slice(0,a+1)).fold(()=>xe(n.get(),t)?[]:[A.none()],e=>[A.some(e)])))})}}},Ph=Vh,Uh=da("tiered-menu-item-highlight"),Wh=da("tiered-menu-item-dehighlight");var jh;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(jh||(jh={}));const Gh=x("collapse-item"),$h=wm({name:"TieredMenu",configFields:[Vi("onExecute"),Vi("onEscape"),zi("onOpenMenu"),zi("onOpenSubmenu"),Ni("onRepositionMenu"),Ni("onCollapseMenu"),ws("highlightOnOpen",jh.HighlightMenuAndItem),ds("data",[ss("primary"),ss("menus"),ss("expansions")]),ws("fakeFocus",!1),Ni("onHighlightItem"),Ni("onDehighlightItem"),Ni("onHover"),Ii(),ss("dom"),ws("navigateOnHover",!0),ws("stayInDom",!1),xu("tmenuBehaviours",[$p,Km,_m,th]),ws("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=sc(),n=Hh(),s=e=>yu.getValue(e).value,r=t=>ce(e.data.menus,(e,t)=>Y(e.items,e=>"separator"===e.type?[]:[e.data.value])),a=Km.highlight,i=(t,o)=>{a(t,o),Km.getHighlighted(o).orThunk(()=>Km.getFirst(o)).each(n=>{e.fakeFocus?Km.highlight(o,n):zr(t,n.element,pr())})},l=(e,t)=>we(V(t,t=>e.lookupMenu(t).bind(e=>"prepared"===e.type?A.some(e.menu):A.none()))),c=(t,o,n)=>{const s=l(o,o.otherMenus(n));H(s,o=>{Xa(o.element,[e.markers.backgroundMenu]),e.stayInDom||th.remove(t,o)})},d=(t,n)=>{const r=(t=>o.get().getOrThunk(()=>{const n={},r=Qc(t.element,`.${e.markers.item}`),a=U(r,e=>"true"===Tt(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);Ot(e.element,"aria-expanded",o)})},u=(t,o,n)=>A.from(n[0]).bind(s=>o.lookupMenu(s).bind(s=>{if("notbuilt"===s.type)return A.none();{const r=s.menu,a=l(o,n.slice(1));return H(a,t=>{ja(t.element,e.markers.backgroundMenu)}),wt(r.element)||th.append(t,ui(r)),Xa(r.element,[e.markers.backgroundMenu]),i(t,r),c(t,o,n),A.some(r)}}));let m;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(m||(m={}));const g=(t,o,r=m.HighlightSubmenu)=>{if(o.hasConfigured(Hm)&&Hm.isDisabled(o))return A.some(o);{const a=s(o);return n.expand(a).bind(s=>(d(t,s),A.from(s[0]).bind(a=>n.lookupMenu(a).bind(i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const s=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,s),s}return o.menu})(t,a,i);return wt(l.element)||th.append(t,ui(l)),e.onOpenSubmenu(t,o,l,K(s)),r===m.HighlightSubmenu?(Km.highlightFirst(l),u(t,n,s)):(Km.dehighlightAll(l),A.some(o))}))))}},p=(t,o)=>{const r=s(o);return n.collapse(r).bind(s=>(d(t,s),u(t,n,s).map(n=>(e.onCollapseMenu(t,o,n),n))))},h=t=>(o,n)=>xi(n.getSource(),`.${e.markers.item}`).bind(e=>o.getSystem().getByDom(e).toOptional().bind(e=>t(o,e).map(E))),f=Pr([jr(Nh(),(e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each(()=>{const o=t.event.menu;Km.highlight(e,o);const r=s(t.event.item);n.refresh(r).each(t=>c(e,n,t))})}),ta((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each(o=>{0===s(o).indexOf("collapse-item")&&p(t,o),g(t,o,m.HighlightSubmenu).fold(()=>{e.onExecute(t,o)},b)})}),Zr((t,o)=>{(t=>{const o=((t,o,n)=>ce(n,(n,s)=>{const r=()=>Lh.sketch({...n,value:s,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{Nr(e,Uh,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{Nr(e,Wh,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?vg():bg()});return s===o?{type:"prepared",menu:t.getSystem().build(r())}:{type:"notbuilt",nbMenu:r}}))(t,e.data.primary,e.data.menus),s=r();return n.setContents(e.data.primary,o,e.data.expansions,s),n.getPrimary()})(t).each(o=>{th.append(t,ui(o)),e.onOpenMenu(t,o),e.highlightOnOpen===jh.HighlightMenuAndItem?i(t,o):e.highlightOnOpen===jh.HighlightJustMenu&&a(t,o)})}),jr(Uh,(t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)}),jr(Wh,(t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)}),...e.navigateOnHover?[jr(kh(),(t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind(t=>(d(e,t),u(e,n,t)))})(t,r),g(t,r,m.HighlightParent),e.onHover(t,r)})]:[]]),v=e=>Km.getHighlighted(e).bind(Km.getHighlighted),y={collapseMenu:e=>{v(e).each(t=>{p(e,t)})},highlightPrimary:e=>{n.getPrimary().each(t=>{i(e,t)})},repositionMenus:t=>{const o=n.getPrimary().bind(e=>v(t).bind(e=>{const t=s(e),o=fe(n.getMenus()),r=we(V(o,Ph));return n.getTriggeringPath(t,e=>((e,t,o)=>re(t,e=>{if(!e.getSystem().isConnected())return A.none();const t=Km.getCandidates(e);return G(t,e=>s(e)===o)}))(0,r,e))}).map(t=>({primary:e,triggeringPath:t})));o.fold(()=>{(e=>A.from(e.components()[0]).filter(e=>"menu"===Tt(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:Su(e.tmenuBehaviours,[$p.config({mode:"special",onRight:h((e,t)=>Cm(t.element)?A.none():g(e,t,m.HighlightSubmenu)),onLeft:h((e,t)=>Cm(t.element)?A.none():p(e,t)),onEscape:h((t,o)=>p(t,o).orThunk(()=>e.onEscape(t,o).map(()=>t))),focusIn:(e,t)=>{n.getPrimary().each(t=>{zr(e,t.element,pr())})}}),Km.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),_m.config({find:e=>Km.getHighlighted(e)}),th.config({})]),eventOrder:e.eventOrder,apis:y,events:f}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:Bs(e,t),expansions:{}}),collapseItem:e=>({value:da(Gh()),meta:{text:e}})}}),qh=wm({name:"InlineView",configFields:[ss("lazySink"),Ni("onShow"),Ni("onHide"),vs("onEscape"),xu("inlineBehaviours",[Qd,yu,Fl]),xs("fireDismissalEventInstead",[ws("event",_r())]),xs("fireRepositionEventInstead",[ws("event",Tr())]),ws("getRelated",A.none),ws("isExtraPart",T),ws("eventOrder",A.none)],factory:(e,t)=>{const o=(t,o,n,s)=>{const r=e.lazySink(t).getOrDie();Qd.openWhileCloaked(t,o,()=>Td.positionWithinBounds(r,t,n,s())),yu.setValue(t,A.some({mode:"position",config:n,getBounds:s}))},n=(t,o,n,s)=>{const r=((e,t,o,n,s)=>{const r=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>wl(),onRtl:()=>Sl()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return $h.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(Qd.close(t),e.onEscape.map(e=>e(t)),A.some(!0)),onExecute:()=>A.some(!0),onOpenMenu:(e,t)=>{Td.positionWithinBounds(r().getOrDie(),t,o,s())},onOpenSubmenu:(e,t,o,n)=>{const s=r().getOrDie();Td.position(s,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=r().getOrDie();Td.positionWithinBounds(a,t,o,s()),H(n,e=>{const t=i(e.triggeringPath);Td.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})})}})})(e,t,o,n,s);Qd.open(t,r),yu.setValue(t,A.some({mode:"menu",menu:r}))},s=t=>{Qd.isOpen(t)&&yu.getValue(t).each(o=>{switch(o.mode){case"menu":Qd.getState(t).each($h.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();Td.positionWithinBounds(n,t,o.config,o.getBounds())}})},r={setContent:(e,t)=>{Qd.setContent(e,t)},showAt:(e,t,n)=>{const s=A.none;o(e,t,n,s)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,A.none)},showMenuWithinBounds:n,hide:e=>{Qd.isOpen(e)&&(yu.setValue(e,A.none()),Qd.close(e))},getContent:e=>Qd.getState(e),reposition:s,isOpen:Qd.isOpen};return{uid:e.uid,dom:e.dom,behaviours:Su(e.inlineBehaviours,[Qd.config({isPartOf:(t,o,n)=>Ci(o,n)||((t,o)=>e.getRelated(t).exists(e=>Ci(e,o)))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),yu.config({store:{mode:"memory",initialValue:A.none()}}),Fl.config({channels:{...su({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...au({...e.fireRepositionEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({}),doReposition:s})}})]),eventOrder:e.eventOrder,apis:r}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,s)=>{e.showWithinBounds(t,o,n,s)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,s)=>{e.showMenuWithinBounds(t,o,n,s)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}});var Yh=tinymce.util.Tools.resolve("tinymce.util.Delay");const Xh=wm({name:"Button",factory:e=>{const t=vh(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:ku(e.buttonBehaviours,[ih.config({}),$p.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:"button"===o?{type:n("type").getOr("button"),...n("role").map(e=>({role:e})).getOr({})}:{role:e.role.getOr(n("role").getOr("button"))}},eventOrder:e.eventOrder}},configFields:[ws("uid",void 0),ss("dom"),ws("components",[]),Cu("buttonBehaviours",[ih,$p]),gs("action"),gs("role"),ws("eventOrder",{})]}),Kh=e=>{const t=Re(e),o=ct(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),s=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),r=0===o.length?{}:{innerHtml:oa(t)};return{tag:We(t),classes:s,attributes:n,...r}},Jh=e=>{const t=(e=>void 0!==e.uid)(e)&&ye(e,"uid")?e.uid:ba("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}},{entries:Zh,setPrototypeOf:Qh,isFrozen:ef,getPrototypeOf:tf,getOwnPropertyDescriptor:of}=Object;let{freeze:nf,seal:sf,create:rf}=Object,{apply:af,construct:lf}="undefined"!=typeof Reflect&&Reflect;af||(af=function(e,t,o){return e.apply(t,o)}),nf||(nf=function(e){return e}),sf||(sf=function(e){return e}),lf||(lf=function(e,t){return new e(...t)});const cf=wf(Array.prototype.forEach),df=wf(Array.prototype.pop),uf=wf(Array.prototype.push),mf=wf(String.prototype.toLowerCase),gf=wf(String.prototype.toString),pf=wf(String.prototype.match),hf=wf(String.prototype.replace),ff=wf(String.prototype.indexOf),bf=wf(String.prototype.trim),vf=wf(RegExp.prototype.test),yf=(xf=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return lf(xf,t)});var xf;function wf(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=arguments[s];return af(e,t,n)}}function Sf(e,t,o){var n;o=null!==(n=o)&&void 0!==n?n:mf,Qh&&Qh(e,null);let s=t.length;for(;s--;){let n=t[s];if("string"==typeof n){const e=o(n);e!==n&&(ef(t)||(t[s]=e),n=e)}e[n]=!0}return e}function Cf(e){const t=rf(null);for(const[o,n]of Zh(e))t[o]=n;return t}function kf(e,t){for(;null!==e;){const o=of(e,t);if(o){if(o.get)return wf(o.get);if("function"==typeof o.value)return wf(o.value)}e=tf(e)}return function(e){return console.warn("fallback value for",e),null}}const Of=nf(["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"]),_f=nf(["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"]),Tf=nf(["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"]),Ef=nf(["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"]),Af=nf(["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"]),Mf=nf(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Df=nf(["#text"]),Bf=nf(["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","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","xmlns","slot"]),If=nf(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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"]),Ff=nf(["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"]),Rf=nf(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Nf=sf(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Lf=sf(/<%[\w\W]*|[\w\W]*%>/gm),zf=sf(/\${[\w\W]*}/gm),Vf=sf(/^data-[\-\w.\u00B7-\uFFFF]/),Hf=sf(/^aria-[\-\w]+$/),Pf=sf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Uf=sf(/^(?:\w+script|data):/i),Wf=sf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jf=sf(/^html$/i);var Gf=Object.freeze({__proto__:null,MUSTACHE_EXPR:Nf,ERB_EXPR:Lf,TMPLIT_EXPR:zf,DATA_ATTR:Vf,ARIA_ATTR:Hf,IS_ALLOWED_URI:Pf,IS_SCRIPT_OR_DATA:Uf,ATTR_WHITESPACE:Wf,DOCTYPE_NAME:jf});const $f=()=>"undefined"==typeof window?null:window;var qf=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$f();const o=t=>e(t);if(o.version="3.0.5",o.removed=[],!t||!t.document||9!==t.document.nodeType)return o.isSupported=!1,o;const n=t.document,s=n.currentScript;let{document:r}=t;const{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:p}=t,h=c.prototype,f=kf(h,"cloneNode"),b=kf(h,"nextSibling"),v=kf(h,"childNodes"),y=kf(h,"parentNode");if("function"==typeof i){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let x,w="";const{implementation:S,createNodeIterator:C,createDocumentFragment:k,getElementsByTagName:O}=r,{importNode:_}=n;let T={};o.isSupported="function"==typeof Zh&&"function"==typeof y&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:E,ERB_EXPR:A,TMPLIT_EXPR:M,DATA_ATTR:D,ARIA_ATTR:B,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:F}=Gf;let{IS_ALLOWED_URI:R}=Gf,N=null;const L=Sf({},[...Of,..._f,...Tf,...Af,...Df]);let z=null;const V=Sf({},[...Bf,...If,...Ff,...Rf]);let H=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),P=null,U=null,W=!0,j=!0,G=!1,$=!0,q=!1,Y=!1,X=!1,K=!1,J=!1,Z=!1,Q=!1,ee=!0,te=!1,oe=!0,ne=!1,se={},re=null;const ae=Sf({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ie=null;const le=Sf({},["audio","video","img","source","image","track"]);let ce=null;const de=Sf({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let pe=ge,he=!1,fe=null;const be=Sf({},[ue,me,ge],gf);let ve;const ye=["application/xhtml+xml","text/html"];let xe,we=null;const Se=r.createElement("form"),Ce=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){if(!we||we!==e){if(e&&"object"==typeof e||(e={}),e=Cf(e),ve=ve=-1===ye.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,xe="application/xhtml+xml"===ve?gf:mf,N="ALLOWED_TAGS"in e?Sf({},e.ALLOWED_TAGS,xe):L,z="ALLOWED_ATTR"in e?Sf({},e.ALLOWED_ATTR,xe):V,fe="ALLOWED_NAMESPACES"in e?Sf({},e.ALLOWED_NAMESPACES,gf):be,ce="ADD_URI_SAFE_ATTR"in e?Sf(Cf(de),e.ADD_URI_SAFE_ATTR,xe):de,ie="ADD_DATA_URI_TAGS"in e?Sf(Cf(le),e.ADD_DATA_URI_TAGS,xe):le,re="FORBID_CONTENTS"in e?Sf({},e.FORBID_CONTENTS,xe):ae,P="FORBID_TAGS"in e?Sf({},e.FORBID_TAGS,xe):{},U="FORBID_ATTR"in e?Sf({},e.FORBID_ATTR,xe):{},se="USE_PROFILES"in e&&e.USE_PROFILES,W=!1!==e.ALLOW_ARIA_ATTR,j=!1!==e.ALLOW_DATA_ATTR,G=e.ALLOW_UNKNOWN_PROTOCOLS||!1,$=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,Y=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Z=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ne=e.IN_PLACE||!1,R=e.ALLOWED_URI_REGEXP||Pf,pe=e.NAMESPACE||ge,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(j=!1),Z&&(J=!0),se&&(N=Sf({},[...Df]),z=[],!0===se.html&&(Sf(N,Of),Sf(z,Bf)),!0===se.svg&&(Sf(N,_f),Sf(z,If),Sf(z,Rf)),!0===se.svgFilters&&(Sf(N,Tf),Sf(z,If),Sf(z,Rf)),!0===se.mathMl&&(Sf(N,Af),Sf(z,Ff),Sf(z,Rf))),e.ADD_TAGS&&(N===L&&(N=Cf(N)),Sf(N,e.ADD_TAGS,xe)),e.ADD_ATTR&&(z===V&&(z=Cf(z)),Sf(z,e.ADD_ATTR,xe)),e.ADD_URI_SAFE_ATTR&&Sf(ce,e.ADD_URI_SAFE_ATTR,xe),e.FORBID_CONTENTS&&(re===ae&&(re=Cf(re)),Sf(re,e.FORBID_CONTENTS,xe)),oe&&(N["#text"]=!0),Y&&Sf(N,["html","head","body"]),N.table&&(Sf(N,["tbody"]),delete P.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw yf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw yf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=e.TRUSTED_TYPES_POLICY,w=x.createHTML("")}else void 0===x&&(x=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const s="dompurify"+(o?"#"+o:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(p,s)),null!==x&&"string"==typeof w&&(w=x.createHTML(""));nf&&nf(e),we=e}},Oe=Sf({},["mi","mo","mn","ms","mtext"]),_e=Sf({},["foreignobject","desc","title","annotation-xml"]),Te=Sf({},["title","style","font","a","script"]),Ee=Sf({},_f);Sf(Ee,Tf),Sf(Ee,Ef);const Ae=Sf({},Af);Sf(Ae,Mf);const Me=function(e){uf(o.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},De=function(e,t){try{uf(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){uf(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!z[e])if(J||Z)try{Me(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Be=function(e){let t,o;if(K)e="<remove></remove>"+e;else{const t=pf(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===ve&&pe===ge&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const n=x?x.createHTML(e):e;if(pe===ge)try{t=(new g).parseFromString(n,ve)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(pe,"template",null);try{t.documentElement.innerHTML=he?w:n}catch(e){}}const s=t.body||t.documentElement;return e&&o&&s.insertBefore(r.createTextNode(o),s.childNodes[0]||null),pe===ge?O.call(t,Y?"html":"body")[0]:Y?t.documentElement:s},Ie=function(e){return C.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Fe=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Re=function(e,t,n){T[e]&&cf(T[e],e=>{e.call(o,t,n,we)})},Ne=function(e){let t;if(Re("beforeSanitizeElements",e,null),(n=e)instanceof m&&("string"!=typeof n.nodeName||"string"!=typeof n.textContent||"function"!=typeof n.removeChild||!(n.attributes instanceof u)||"function"!=typeof n.removeAttribute||"function"!=typeof n.setAttribute||"string"!=typeof n.namespaceURI||"function"!=typeof n.insertBefore||"function"!=typeof n.hasChildNodes))return Me(e),!0;var n;const s=xe(e.nodeName);if(Re("uponSanitizeElement",e,{tagName:s,allowedTags:N}),e.hasChildNodes()&&!Fe(e.firstElementChild)&&(!Fe(e.content)||!Fe(e.content.firstElementChild))&&vf(/<[/\w]/g,e.innerHTML)&&vf(/<[/\w]/g,e.textContent))return Me(e),!0;if(!N[s]||P[s]){if(!P[s]&&ze(s)){if(H.tagNameCheck instanceof RegExp&&vf(H.tagNameCheck,s))return!1;if(H.tagNameCheck instanceof Function&&H.tagNameCheck(s))return!1}if(oe&&!re[s]){const t=y(e)||e.parentNode,o=v(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n)t.insertBefore(f(o[n],!0),b(e))}return Me(e),!0}return e instanceof c&&!function(e){let t=y(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});const o=mf(e.tagName),n=mf(t.tagName);return!!fe[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===ge?"svg"===o:t.namespaceURI===ue?"svg"===o&&("annotation-xml"===n||Oe[n]):Boolean(Ee[o]):e.namespaceURI===ue?t.namespaceURI===ge?"math"===o:t.namespaceURI===me?"math"===o&&_e[n]:Boolean(Ae[o]):e.namespaceURI===ge?!(t.namespaceURI===me&&!_e[n])&&!(t.namespaceURI===ue&&!Oe[n])&&!Ae[o]&&(Te[o]||!Ee[o]):!("application/xhtml+xml"!==ve||!fe[e.namespaceURI]))}(e)?(Me(e),!0):"noscript"!==s&&"noembed"!==s&&"noframes"!==s||!vf(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,t=hf(t,E," "),t=hf(t,A," "),t=hf(t,M," "),e.textContent!==t&&(uf(o.removed,{element:e.cloneNode()}),e.textContent=t)),Re("afterSanitizeElements",e,null),!1):(Me(e),!0)},Le=function(e,t,o){if(ee&&("id"===t||"name"===t)&&(o in r||o in Se))return!1;if(j&&!U[t]&&vf(D,t));else if(W&&vf(B,t));else if(!z[t]||U[t]){if(!(ze(e)&&(H.tagNameCheck instanceof RegExp&&vf(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&vf(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&vf(H.tagNameCheck,o)||H.tagNameCheck instanceof Function&&H.tagNameCheck(o))))return!1}else if(ce[t]);else if(vf(R,hf(o,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==ff(o,"data:")||!ie[e])if(G&&!vf(I,hf(o,F,"")));else if(o)return!1;return!0},ze=function(e){return e.indexOf("-")>0},Ve=function(e){let t,o,n,s;Re("beforeSanitizeAttributes",e,null);const{attributes:r}=e;if(!r)return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};for(s=r.length;s--;){t=r[s];const{name:i,namespaceURI:l}=t;o="value"===i?t.value:bf(t.value);const c=o;if(n=xe(i),a.attrName=n,a.attrValue=o,a.keepAttr=!0,a.forceKeepAttr=void 0,Re("uponSanitizeAttribute",e,a),o=a.attrValue,a.forceKeepAttr)continue;if(!a.keepAttr){De(i,e);continue}if(!$&&vf(/\/>/i,o)){De(i,e);continue}q&&(o=hf(o,E," "),o=hf(o,A," "),o=hf(o,M," "));const d=xe(e.nodeName);if(Le(d,n,o)){if(!te||"id"!==n&&"name"!==n||(De(i,e),o="user-content-"+o),x&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(l);else switch(p.getAttributeType(d,n)){case"TrustedHTML":o=x.createHTML(o);break;case"TrustedScriptURL":o=x.createScriptURL(o)}if(o!==c)try{l?e.setAttributeNS(l,i,o):e.setAttribute(i,o)}catch(t){De(i,e)}}else De(i,e)}Re("afterSanitizeAttributes",e,null)},He=function e(t){let o;const n=Ie(t);for(Re("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)Re("uponSanitizeShadowNode",o,null),Ne(o)||(o.content instanceof a&&e(o.content),Ve(o));Re("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t,s,r,i,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(he=!e,he&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw yf("toString is not a function");if("string"!=typeof(e=e.toString()))throw yf("dirty is not a string, aborting")}if(!o.isSupported)return e;if(X||ke(c),o.removed=[],"string"==typeof e&&(ne=!1),ne){if(e.nodeName){const t=xe(e.nodeName);if(!N[t]||P[t])throw yf("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Be("\x3c!----\x3e"),s=t.ownerDocument.importNode(e,!0),1===s.nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?t=s:t.appendChild(s);else{if(!J&&!q&&!Y&&-1===e.indexOf("<"))return x&&Q?x.createHTML(e):e;if(t=Be(e),!t)return J?null:Q?w:""}t&&K&&Me(t.firstChild);const d=Ie(ne?e:t);for(;r=d.nextNode();)Ne(r)||(r.content instanceof a&&He(r.content),Ve(r));if(ne)return e;if(J){if(Z)for(i=k.call(t.ownerDocument);t.firstChild;)i.appendChild(t.firstChild);else i=t;return(z.shadowroot||z.shadowrootmode)&&(i=_.call(n,i,!0)),i}let u=Y?t.outerHTML:t.innerHTML;return Y&&N["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&vf(jf,t.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+t.ownerDocument.doctype.name+">\n"+u),q&&(u=hf(u,E," "),u=hf(u,A," "),u=hf(u,M," ")),x&&Q?x.createHTML(u):u},o.setConfig=function(e){ke(e),X=!0},o.clearConfig=function(){we=null,X=!1},o.isValidAttribute=function(e,t,o){we||ke({});const n=xe(e),s=xe(t);return Le(n,s,o)},o.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],uf(T[e],t))},o.removeHook=function(e){if(T[e])return df(T[e])},o.removeHooks=function(e){T[e]&&(T[e]=[])},o.removeAllHooks=function(){T={}},o}();const Yf=e=>qf().sanitize(e);var Xf=tinymce.util.Tools.resolve("tinymce.util.I18n");const Kf={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},Jf="temporary-placeholder",Zf=e=>()=>be(e,Jf).getOr("!not found!"),Qf=(e,t)=>{const o=e.toLowerCase();if(Xf.isRtl()){const e=((e,t)=>Ae(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return ve(t,e)?e:o}return o},eb=(e,t)=>be(t,Qf(e,t)),tb=(e,t)=>{const o=t();return eb(e,o).getOrThunk(Zf(o))},ob=()=>oh("add-focusable",[Zr(e=>{vi(e.element,"svg").each(e=>Ot(e,"focusable","false"))})]),nb=(e,t,o,n)=>{var s,r;const a=(e=>!!Xf.isRtl()&&ve(Kf,e))(t)?["tox-icon--flip"]:[],i=be(o,Qf(t,o)).or(n).getOrThunk(Zf(o));return{dom:{tag:e.tag,attributes:null!==(s=e.attributes)&&void 0!==s?s:{},classes:e.classes.concat(a),innerHtml:i},behaviours:El([...null!==(r=e.behaviours)&&void 0!==r?r:[],ob()])}},sb=(e,t,o,n=A.none())=>nb(t,e,o(),n),rb={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},ab=wm({name:"Notification",factory:e=>{const t=Jh({dom:Kh(`<p>${Yf(e.translationProvider(e.text))}</p>`),behaviours:El([th.config({})])}),o=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),n=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),s=Jh({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:El([th.config({})])}),r={updateProgress:(e,t)=>{e.getSystem().isConnected()&&s.getOpt(e).each(e=>{th.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);th.set(n,[ai(o)])}}},a=q([e.icon.toArray(),e.level.toArray(),e.level.bind(e=>A.from(rb[e])).toArray()]),i=Jh(Xh.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[sb("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(),s=G(e,e=>ve(n,Qf(e,n)));return nb({tag:"div",classes:["tox-notification__icon"]},s.getOr(Jf),n,A.none())})(a,0,e.iconProvider),c=[l,{dom:{tag:"div",classes:["tox-notification__body"]},components:[t.asSpec()],behaviours:El([th.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:El([ih.config({}),oh("notification-events",[jr(Ks(),e=>{i.getOpt(e).each(ih.focus)})])]),components:c.concat(e.progress?[s.asSpec()]:[]).concat([i.asSpec()]),apis:r}},configFields:[gs("level"),ss("progress"),gs("icon"),ss("onAction"),ss("text"),ss("iconProvider"),ss("translationProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var ib,lb,cb=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),db=tinymce.util.Tools.resolve("tinymce.EditorManager"),ub=tinymce.util.Tools.resolve("tinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(ib||(ib={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(lb||(lb={}));const mb=e=>t=>t.options.get(e),gb=e=>t=>A.from(e(t)),pb=e=>{const t=ub.deviceType.isPhone(),o=ub.deviceType.isTablet()||t,n=e.options.register,s=e=>r(e)||!1===e,a=e=>r(e)||h(e);n("skin",{processor:e=>r(e)||!1===e,default:"oxide"}),n("skin_url",{processor:"string"}),n("height",{processor:a,default:Math.max(e.getElement().offsetHeight,400)}),n("width",{processor:a,default:cb.DOM.getStyle(e.getElement(),"width")}),n("min_height",{processor:"number",default:100}),n("min_width",{processor:"number"}),n("max_height",{processor:"number"}),n("max_width",{processor:"number"}),n("style_formats",{processor:"object[]"}),n("style_formats_merge",{processor:"boolean",default:!1}),n("style_formats_autohide",{processor:"boolean",default:!1}),n("line_height_formats",{processor:"string",default:"1 1.1 1.2 1.3 1.4 1.5 2"}),n("font_family_formats",{processor:"string",default:"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"}),n("font_size_formats",{processor:"string",default:"8pt 10pt 12pt 14pt 18pt 24pt 36pt"}),n("font_size_input_default_unit",{processor:"string",default:"pt"}),n("block_formats",{processor:"string",default:"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"}),n("content_langs",{processor:"object[]"}),n("removed_menuitems",{processor:"string",default:""}),n("menubar",{processor:e=>r(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||r(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),L(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:lb.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:s,default:"#top"}),n("anchor_bottom",{processor:s,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||d(e),default:!ub.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},hb=mb("readonly"),fb=mb("height"),bb=mb("width"),vb=gb(mb("min_width")),yb=gb(mb("min_height")),xb=gb(mb("max_width")),wb=gb(mb("max_height")),Sb=gb(mb("style_formats")),Cb=mb("style_formats_merge"),kb=mb("style_formats_autohide"),Ob=mb("content_langs"),_b=mb("removed_menuitems"),Tb=mb("toolbar_mode"),Eb=mb("toolbar_groups"),Ab=mb("toolbar_location"),Mb=mb("fixed_toolbar_container"),Db=mb("fixed_toolbar_container_target"),Bb=mb("toolbar_persist"),Ib=mb("toolbar_sticky_offset"),Fb=mb("menubar"),Rb=mb("toolbar"),Nb=mb("file_picker_callback"),Lb=mb("file_picker_validator_handler"),zb=mb("font_size_input_default_unit"),Vb=mb("file_picker_types"),Hb=mb("typeahead_urls"),Pb=mb("anchor_top"),Ub=mb("anchor_bottom"),Wb=mb("draggable_modal"),jb=mb("statusbar"),Gb=mb("elementpath"),$b=mb("branding"),qb=mb("resize"),Yb=mb("paste_as_text"),Xb=mb("sidebar_show"),Kb=mb("help_accessibility"),Jb=mb("default_font_stack"),Zb=e=>!1===e.options.get("skin"),Qb=e=>!1!==e.options.get("menubar"),ev=e=>{const t=e.options.get("skin_url");if(Zb(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return db.baseURL+"/skins/ui/"+t}},tv=e=>A.from(e.options.get("skin_url")),ov=e=>e.options.get("line_height_formats").split(" "),nv=e=>{const t=Rb(e),o=r(t),n=l(t)&&t.length>0;return!rv(e)&&(n||o||!0===t)},sv=e=>{const t=L(9,t=>e.options.get("toolbar"+(t+1))),o=U(t,r);return ke(o.length>0,o)},rv=e=>sv(e).fold(()=>{const t=Rb(e);return f(t,r)&&t.length>0},E),av=e=>Ab(e)===lb.bottom,iv=e=>{var t;if(!e.inline)return A.none();const o=null!==(t=Mb(e))&&void 0!==t?t:"";if(o.length>0)return yi(St(),o);const n=Db(e);return g(n)?A.some(ze(n)):A.none()},lv=e=>e.inline&&iv(e).isSome(),cv=e=>iv(e).getOrThunk(()=>vt(bt(ze(e.getElement())))),dv=e=>e.inline&&!Qb(e)&&!nv(e)&&!rv(e),uv=e=>(e.options.get("toolbar_sticky")||e.inline)&&!lv(e)&&!dv(e),mv=e=>!lv(e)&&"split"===e.options.get("ui_mode"),gv=e=>{const t=e.options.get("menu");return ce(t,e=>({...e,items:e.items}))},pv=(e,t)=>{if(0===t.length)return"";const o=new Set(t),n=e.split("|").map(e=>e.trim()).map(e=>0===e.length?[]:e.split(/\s+/).filter(e=>o.has(e))).filter(e=>e.length>0).map(e=>e.join(" "));return n.join(" | ")},hv=(e,t)=>{var o,n,s,r;if(!e.options.isRegistered("table_contextmenu"))return t;const a=e.options.isSet("table_contextmenu"),i=null!==(o=e.options.get("table_contextmenu"))&&void 0!==o?o:[],l=i.length>0?["inserttable",...i]:[],c=a?l.join(" "):t;if(!e.options.get("table_contextmenu_flatten")||0===c.length)return c;const d="tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter",u="tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter",m="tablecellprops tablemergecells tablesplitcells",g=e.options.isSet("table_row_contextmenu")?pv(d,null!==(n=e.options.get("table_row_contextmenu"))&&void 0!==n?n:[]):d,p=e.options.isSet("table_column_contextmenu")?pv(u,null!==(s=e.options.get("table_column_contextmenu"))&&void 0!==s?s:[]):u;return((e,t)=>{const o=e.split("|").map(e=>e.trim()).filter(e=>e.length>0),n=[],s=e=>{e.length>0&&n.push(e.join(" "))};return H(o,e=>{const o=e.split(/\s+/).filter(e=>e.length>0);let n=[];H(o,e=>{const o=t[e];if(void 0===o)n.push(e);else{if(0===o.length)return;{const e=o.split("|").map(e=>e.trim()).filter(e=>e.length>0);1===e.length?n=n.concat(e[0].split(/\s+/).filter(e=>e.length>0)):(s(n),n=[],H(e,e=>{s(e.split(/\s+/).filter(e=>e.length>0))}))}}}),s(n)}),n.join(" | ")})(c,{cell:e.options.isSet("table_cell_contextmenu")?pv(m,null!==(r=e.options.get("table_cell_contextmenu"))&&void 0!==r?r:[]):m,row:g,column:p})};var fv=Object.freeze({__proto__:null,get ToolbarMode(){return ib},get ToolbarLocation(){return lb},register:pb,getSkinUrl:ev,getSkinUrlOption:tv,isReadOnly:hb,isSkinDisabled:Zb,getHeightOption:fb,getWidthOption:bb,getMinWidthOption:vb,getMinHeightOption:yb,getMaxWidthOption:xb,getMaxHeightOption:wb,getUserStyleFormats:Sb,shouldMergeStyleFormats:Cb,shouldAutoHideStyleFormats:kb,getLineHeightFormats:ov,getContentLanguages:Ob,getRemovedMenuItems:_b,isMenubarEnabled:Qb,isMultipleToolbars:rv,isToolbarEnabled:nv,isToolbarPersist:Bb,getMultipleToolbarsOption:sv,getUiContainer:cv,useFixedContainer:lv,isSplitUiMode:mv,getToolbarMode:Tb,isDraggableModal:Wb,isDistractionFree:dv,isStickyToolbar:uv,getStickyToolbarOffset:Ib,getToolbarLocation:Ab,isToolbarLocationBottom:av,getToolbarGroups:Eb,getMenus:gv,getMenubar:Fb,getToolbar:Rb,getFilePickerCallback:Nb,getFilePickerTypes:Vb,useTypeaheadUrls:Hb,getAnchorTop:Pb,getAnchorBottom:Ub,getFilePickerValidatorHandler:Lb,getFontSizeInputDefaultUnit:zb,useStatusBar:jb,useElementPath:Gb,useBranding:$b,getResize:qb,getPasteAsText:Yb,getSidebarShow:Xb,useHelpAccessibility:Kb,getDefaultFontStack:Jb,getFilteredTableMenuItems:hv});var bv;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(bv||(bv={}));var vv=bv;const yv="tox-menu-nav__js",xv="tox-collection__item",wv="tox-swatch",Sv={normal:yv,color:wv},Cv="tox-collection__item--enabled",kv="tox-collection__item-icon",Ov="tox-collection__item-label",_v="tox-collection__item-caret",Tv="tox-collection__item--active",Ev="tox-collection__item-container",Av="tox-collection__item-container--row",Mv=e=>be(Sv,e).getOr(yv),Dv=e=>"color"===e?"tox-swatches":"tox-menu",Bv=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:Dv(e),tieredMenu:"tox-tiered-menu"}),Iv=e=>{const t=Bv(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:Mv(e)}},Fv=(e,t,o)=>{const n=Bv(o);return{tag:"div",classes:q([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},Rv=[Lh.parts.items({})],Nv=(e,t,o)=>{const n=Bv(o);return{dom:{tag:"div",classes:q([[n.tieredMenu]])},markers:Iv(o)}},Lv=x([gs("data"),ws("inputAttributes",{}),ws("inputStyles",{}),ws("tag","input"),ws("inputClasses",[]),Ni("onSetValue"),ws("styles",{}),ws("eventOrder",{}),xu("inputBehaviours",[yu,ih]),ws("selectOnFocus",!0)]),zv=e=>El([ih.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=Ja(t);t.dom.setSelectionRange(0,o.length)}:b})]),Vv=e=>({...zv(e),...Su(e.inputBehaviours,[yu.config({store:{mode:"manual",...e.data.map(e=>({initialValue:e})).getOr({}),getValue:e=>Ja(e.element),setValue:(e,t)=>{Ja(e.element)!==t&&Za(e.element,t)}},onSetValue:e.onSetValue})])}),Hv=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),Pv=wm({name:"Input",configFields:Lv(),factory:(e,t)=>({uid:e.uid,dom:Hv(e),components:[],behaviours:Vv(e),eventOrder:e.eventOrder})}),Uv=da("refetch-trigger-event"),Wv=da("redirect-menu-item-interaction"),jv="tox-menu__searcher",Gv=e=>yi(e.element,`.${jv}`).bind(t=>e.getSystem().getByDom(t).toOptional()),$v=Gv,qv=e=>({fetchPattern:yu.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),Yv=e=>{const t=(e,t)=>(t.cut(),A.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return Nr(e,Wv,o),A.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[xv]},components:[Pv.sketch({inputClasses:[jv,"tox-textfield"],inputAttributes:{...e.placeholder.map(t=>({placeholder:e.i18n(t)})).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:El([oh(n,[jr(er(),e=>{Rr(e,Uv)}),jr(Zs(),(e,t)=>{"Escape"===t.event.raw.key&&t.stop()})]),$p.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,$p.name()]}})]}},Xv="tox-collection--results__js",Kv=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:da("aria-item-search-result-id"),"aria-selected":"false"}}}:e},Jv=(e,t)=>o=>{const n=z(o,t);return V(n,t=>({dom:e,components:t}))},Zv=(e,t)=>{const o=[];let n=[];return H(e,(e,s)=>{t(e,s)?(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),V(o,e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e}))},Qv=(e,t,o)=>Lh.parts.items({preprocess:n=>{const s=V(n,o);return"auto"!==e&&e>1?Jv({tag:"div",classes:["tox-collection__group"]},e)(s):Zv(s,(e,o)=>"separator"===t[o].type)}}),ey=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[Qv(e,t,w)]}),ty=e=>N(e,e=>"icon"in e&&void 0!==e.icon),oy=e=>(console.error(Zn(e)),console.log(e),A.none()),ny=(e,t,o,n,s)=>{const r=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[Lh.parts.items({preprocess:e=>Zv(e,(e,t)=>"separator"===a[t].type)})]});var a;return{value:e,dom:r.dom,components:r.components,items:o}},sy=(e,t,o,n,s)=>{if("color"===s.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[Lh.parts.items({preprocess:"auto"!==e?Jv({tag:"div",classes:["tox-swatches__row"]},e):w})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType&&"auto"===n){const t=ey(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType||"searchable"===s.menuType){const t="searchable"!==s.menuType?ey(n,o):"search-with-field"===s.searchMode.searchMode?((e,t,o)=>{const n=da("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[Yv({i18n:Xf.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],Xv],attributes:{id:n}},components:[Qv(e,t,Kv)]}]}})(n,o,s.searchMode):((e,t)=>{const o=da("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",Xv].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:o}},components:[Qv(e,t,Kv)]}})(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===s.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[Lh.parts.items({preprocess:Jv({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:Fv(t,n,s.menuType),components:Rv,items:o}},ry=is("type"),ay=is("name"),iy=is("label"),ly=is("text"),cy=is("title"),dy=is("icon"),uy=is("value"),my=cs("fetch"),gy=cs("getSubmenuItems"),py=cs("onAction"),hy=cs("onItemAction"),fy=Ts("onSetup",()=>b),by=fs("name"),vy=fs("text"),yy=fs("icon"),xy=fs("tooltip"),wy=fs("label"),Sy=fs("shortcut"),Cy=vs("select"),ky=_s("active",!1),Oy=_s("borderless",!1),_y=_s("enabled",!0),Ty=_s("primary",!1),Ey=e=>ws("columns",e),Ay=ws("meta",{}),My=Ts("onAction",b),Dy=e=>ks("type",e),By=e=>ts("name","name",xn(()=>da(`${e}-name`)),Pn),Iy=In([ry,vy]),Fy=In([Dy("autocompleteitem"),ky,_y,Ay,uy,vy,yy]),Ry=[_y,xy,yy,vy,fy],Ny=In([ry,py,Sy].concat(Ry)),Ly=e=>Xn("toolbarbutton",Ny,e),zy=[ky].concat(Ry),Vy=In(zy.concat([ry,py,Sy])),Hy=e=>Xn("ToggleButton",Vy,e),Py=[Ts("predicate",T),Os("scope","node",["node","editor"]),Os("position","selection",["node","selection","line"])],Uy=Ry.concat([Dy("contextformbutton"),Ty,py,os("original",w)]),Wy=zy.concat([Dy("contextformbutton"),Ty,py,os("original",w)]),jy=Ry.concat([Dy("contextformbutton")]),Gy=zy.concat([Dy("contextformtogglebutton")]),$y=Qn("type",{contextformbutton:Uy,contextformtogglebutton:Wy}),qy=In([Dy("contextform"),Ts("initValue",x("")),wy,ms("commands",$y),ps("launch",Qn("type",{contextformbutton:jy,contextformtogglebutton:Gy}))].concat(Py)),Yy=In([Dy("contexttoolbar"),is("items")].concat(Py)),Xy=[ry,is("src"),fs("alt"),Es("classes",[],Pn)],Ky=In(Xy),Jy=[ry,ly,by,Es("classes",["tox-collection__item-label"],Pn)],Zy=In(Jy),Qy=Mn(()=>$n("type",{cardimage:Ky,cardtext:Zy,cardcontainer:ex})),ex=In([ry,ks("direction","horizontal"),ks("align","left"),ks("valign","middle"),ms("items",Qy)]),tx=[_y,vy,Sy,ts("value","value",xn(()=>da("menuitem-value")),zn()),Ay];const ox=In([ry,wy,ms("items",Qy),fy,My].concat(tx)),nx=In([ry,ky,yy].concat(tx)),sx=[ry,is("fancytype"),My],rx=[ws("initData",{})].concat(sx),ax=[vs("select"),As("initData",{},[_s("allowCustomColors",!0),ks("storageKey","default"),ys("colors",zn())])].concat(sx),ix=Qn("fancytype",{inserttable:rx,colorswatch:ax}),lx=In([ry,fy,My,yy].concat(tx)),cx=In([ry,gy,fy,yy].concat(tx)),dx=In([ry,yy,ky,fy,py].concat(tx)),ux=(e,t,o)=>{const n=Qc(e.element,"."+o);if(n.length>0){const e=$(n,e=>{const o=e.dom.getBoundingClientRect().top,s=n[0].dom.getBoundingClientRect().top;return Math.abs(o-s)>t}).getOr(n.length);return A.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return A.none()},mx=e=>((e,t)=>El([oh(e,t)]))(da("unnamed-events"),e),gx=da("tooltip.exclusive"),px=da("tooltip.show"),hx=da("tooltip.hide"),fx=da("tooltip.immediateHide"),bx=da("tooltip.immediateShow"),vx=(e,t,o)=>{e.getSystem().broadcastOn([gx],{})};var yx=Object.freeze({__proto__:null,hideAllExclusive:vx,setComponents:(e,t,o,n)=>{o.getTooltip().each(e=>{e.getSystem().isConnected()&&th.set(e,n)})}}),xx=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each(n=>{n.getSystem().isConnected()&&(Ld(n),e.onHide(o,n),t.clearTooltip())}),t.clearTimer()},n=o=>{if(!t.isShowing()){vx(o);const n=e.lazySink(o).getOrDie(),s=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Pr("normal"===e.mode?[jr(Xs(),e=>{Rr(o,px)}),jr(qs(),e=>{Rr(o,hx)})]:[]),behaviours:El([th.config({})])});t.setTooltip(s),Fd(n,s),e.onShow(o,s),Td.position(n,s,{anchor:e.anchor(o)})}},s=o=>{t.getTooltip().each(t=>{const n=e.lazySink(o).getOrDie();Td.position(n,t,{anchor:e.anchor(o)})})};return Pr(q([[jr(px,o=>{t.resetTimer(()=>{n(o)},e.delayForShow())}),jr(hx,n=>{t.resetTimer(()=>{o(n)},e.delayForHide())}),jr(bx,e=>{t.resetTimer(()=>{n(e)},0)}),jr(fx,e=>{t.resetTimer(()=>{o(e)},0)}),jr(mr(),(e,t)=>{const n=t;n.universal||R(n.channels,gx)&&o(e)}),Qr(e=>{o(e)})],(()=>{switch(e.mode){case"normal":return[jr(Ks(),e=>{Rr(e,bx)}),jr(dr(),e=>{Rr(e,fx)}),jr(Xs(),e=>{Rr(e,px)}),jr(qs(),e=>{Rr(e,hx)})];case"follow-highlight":return[jr(Ir(),(e,t)=>{Rr(e,px)}),jr(Fr(),e=>{Rr(e,hx)})];case"children-normal":return[jr(Ks(),(o,n)=>{Hl(o.element).each(r=>{Je(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Rr(o,bx)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),jr(dr(),e=>{Hl(e.element).fold(()=>{Rr(e,fx)},b)}),jr(Xs(),o=>{yi(o.element,"[data-mce-tooltip]:hover").each(n=>{t.getTooltip().fold(()=>{Rr(o,px)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),jr(qs(),e=>{yi(e.element,"[data-mce-tooltip]:hover").fold(()=>{Rr(e,hx)},b)})];default:return[jr(Ks(),(o,n)=>{Hl(o.element).each(r=>{Je(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Rr(o,bx)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),jr(dr(),e=>{Hl(e.element).fold(()=>{Rr(e,fx)},b)})]}})()]))}}),wx=[ss("lazySink"),ss("tooltipDom"),ws("exclusive",!0),ws("tooltipComponents",[]),Ts("delayForShow",x(300)),Ts("delayForHide",x(300)),Os("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),ws("anchor",e=>({type:"hotspot",hotspot:e,layouts:{onLtr:x([pl,gl,cl,ul,dl,ml]),onRtl:x([pl,gl,cl,ul,dl,ml])},bubble:vc(0,-2,{})})),Ni("onHide"),Ni("onShow")],Sx=Object.freeze({__proto__:null,init:()=>{const e=sc(),t=sc(),o=()=>{e.on(clearTimeout)},n=x("not-implemented");return Ea({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 Cx=Ml({fields:wx,name:"tooltipping",active:xx,state:Sx,apis:yx}),kx="silver.readonly",Ox=In([rs("readonly",Un)]);const _x=(e,t)=>{const o=e.mainUi.outerContainer.element,n=[e.mainUi.mothership,...e.uiMotherships];t&&H(n,e=>{e.broadcastOn([eu()],{target:o})}),H(n,e=>{e.broadcastOn([kx],{readonly:t})})},Tx=(e,t)=>{e.on("init",()=>{e.mode.isReadOnly()&&_x(t,!0)}),e.on("SwitchMode",()=>_x(t,e.mode.isReadOnly())),hb(e)&&e.mode.set("readonly")},Ex=()=>Fl.config({channels:{[kx]:{schema:Ox,onReceive:(e,t)=>{Hm.set(e,t.readonly)}}}}),Ax=e=>Hm.config({disabled:e}),Mx=e=>Hm.config({disabled:e,disableClass:"tox-tbtn--disabled"}),Dx=e=>Hm.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),Bx=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},Ix=(e,t)=>Zr(o=>{Bx(e,o)(o=>{const n=e.onSetup(o);p(n)&&t.set(n)})}),Fx=(e,t)=>Qr(o=>Bx(e,o)(t.get())),Rx=(e,t)=>ta((o,n)=>{Bx(e,o)(e.onAction),e.triggersSubmenu||t!==vv.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Rr(o,br()),n.stop())}),Nx={[gr()]:["disabling","alloy.base.behaviour","toggling","item-events"]},Lx=we,zx=(e,t,o,n)=>{const s=Ms(b);return{type:"item",dom:t.dom,components:Lx(t.optComponents),data:e.data,eventOrder:Nx,hasSubmenu:e.triggersSubmenu,itemBehaviours:El([oh("item-events",[Rx(e,o),Ix(e,s),Fx(e,s)]),(r=()=>!e.enabled||n.isDisabled(),Hm.config({disabled:r,disableClass:"tox-collection__item--state-disabled"})),Ex(),th.config({})].concat(e.itemBehaviours))};var r},Vx=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),Hx=e=>{const t=ub.os.isMacOS()||ub.os.isiOS(),o=t?{alt:"\u2325",ctrl:"\u2303",shift:"\u21e7",meta:"\u2318",access:"\u2303\u2325"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),s=V(n,e=>{const t=e.toLowerCase().trim();return ve(o,t)?o[t]:e});return t?s.join(""):s.join("+")},Px=(e,t,o=[kv])=>sb(e,{tag:"div",classes:o},t),Ux=e=>({dom:{tag:"div",classes:[Ov]},components:[ai(Xf.translate(e))]}),Wx=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),jx=(e,t)=>({dom:{tag:"div",classes:[Ov]},components:[{dom:{tag:e.tag,styles:e.styles},components:[ai(Xf.translate(t))]}]}),Gx=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[ai(Hx(e))]}),$x=e=>Px("checkmark",e,["tox-collection__item-checkmark"]),qx=e=>{const t=e.map(e=>({attributes:{id:da("menu-item"),"aria-label":Xf.translate(e)}})).getOr({});return{tag:"div",classes:[yv,xv],...t}},Yx=(e,t,o,n=A.none())=>"color"===e.presets?((e,t,o)=>{const n=e.value,s=e.iconContent.map(e=>((e,t,o)=>{const n=t();return eb(e,n).or(o).getOrThunk(Zf(n))})(e,t.icons,o)),r=e.ariaLabel.map(e=>({"aria-label":t.translate(e),"data-mce-name":e})).getOr({});return{dom:(()=>{const e=wv,t=s.getOr(""),o={tag:"div",attributes:r,classes:[e]};return"custom"===n?{...o,tag:"button",classes:[...o.classes,"tox-swatches__picker-btn"],innerHtml:t}:"remove"===n?{...o,classes:[...o.classes,"tox-swatch--remove"],innerHtml:t}:g(n)?{...o,attributes:{...o.attributes,"data-mce-color":n},styles:{"background-color":n},innerHtml:t}:o})(),optComponents:[]}})(e,t,n):((e,t,o,n)=>{const s={tag:"div",classes:[kv]},r=o?e.iconContent.map(e=>sb(e,s,t.icons,n)).orThunk(()=>A.some({dom:s})):A.none(),a=e.checkMark,i=A.from(e.meta).fold(()=>Ux,e=>ve(e,"style")?C(jx,e.style):Ux),l=e.htmlContent.fold(()=>e.textContent.map(i),e=>A.some(Wx(e,[Ov])));return{dom:qx(e.ariaLabel),optComponents:[r,l,e.shortcutContent.map(Gx),a,e.caret]}})(e,t,o,n),Xx=(e,t,o)=>be(e,"tooltipWorker").map(e=>[Cx.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:pc}}),mode:"follow-highlight",onShow:(t,o)=>{e(e=>{Cx.setComponents(t,[ii({element:ze(e)})])})}})]).getOrThunk(()=>o.map(e=>[Cx.config({...t.providers.tooltips.getConfig({tooltipText:e}),mode:"follow-highlight"})]).getOr([])),Kx=(e,t)=>{const o=(e=>cb.DOM.encode(e))(Xf.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},Jx=(e,t)=>V(e,e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":Av,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[Ev,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,Jx(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?A.from(t.cardText.matchText).getOr(""):"";return Wx(Kx(e.text,n),e.classes)}}),Zx=em(Mh(),Dh()),Qx=e=>({value:nw(e)}),ew=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,tw=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,ow=e=>ew.test(e)||tw.test(e),nw=e=>_e(e,"#").toUpperCase(),sw=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},rw=e=>{const t=sw(e.red)+sw(e.green)+sw(e.blue);return Qx(t)},aw=Math.min,iw=Math.max,lw=Math.round,cw=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,dw=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,uw=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),mw=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},gw=e=>{let t,o,n;const s=(e.hue||0)%360;let r=e.saturation/100,a=e.value/100;if(r=iw(0,aw(r,1)),a=iw(0,aw(a,1)),0===r)return t=o=n=lw(255*a),uw(t,o,n,1);const i=s/60,l=a*r,c=l*(1-Math.abs(i%2-1)),d=a-l;switch(Math.floor(i)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=lw(255*(t+d)),o=lw(255*(o+d)),n=lw(255*(n+d)),uw(t,o,n,1)},pw=e=>{const t=(e=>{const t=(e=>{const t=e.value.replace(ew,(e,t,o,n)=>t+t+o+o+n+n);return{value:t}})(e),o=tw.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o})(e),o=parseInt(t[1],16),n=parseInt(t[2],16),s=parseInt(t[3],16);return uw(o,n,s,1)},hw=(e,t,o,n)=>{const s=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return uw(s,r,a,i)},fw=e=>{if("transparent"===e)return A.some(uw(0,0,0,0));const t=cw.exec(e);if(null!==t)return A.some(hw(t[1],t[2],t[3],"1"));const o=dw.exec(e);return null!==o?A.some(hw(o[1],o[2],o[3],o[4])):A.none()},bw=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,vw=uw(255,0,0,1),yw=(e,t)=>{e.dispatch("ResizeContent",t)},xw=(e,t)=>{e.dispatch("TextColorChange",t)},ww=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),Sw=(e,t)=>()=>{e(),t()},Cw=e=>Ow(e,"NodeChange",t=>{t.setEnabled(e.selection.isEditable())}),kw=(e,t)=>o=>{const n=Cw(e)(o),s=((e,t)=>o=>{const n=nc(),s=()=>{o.setActive(e.formatter.match(t));const s=e.formatter.formatChanged(t,o.setActive);n.set(s)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),n.clear()}})(e,t)(o);return()=>{n(),s()}},Ow=(e,t,o)=>n=>{const s=()=>o(n),r=()=>{o(n),e.on(t,s)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),e.off(t,s)}},_w=e=>t=>()=>{e.undoManager.transact(()=>{e.focus(),["p","h1","h2","h3","h4","h5","h6"].includes(t.format)&&e.execCommand("RemoveFormat"),e.execCommand("mceToggleFormat",!1,t.format)})},Tw=(e,t)=>()=>e.execCommand(t);var Ew=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const Aw={},Mw=e=>be(Aw,e).getOrThunk(()=>{const t=`tinymce-custom-colors-${e}`,o=Ew.getItem(t);if(m(o)){const e=Ew.getItem("tinymce-custom-colors");Ew.setItem(t,g(e)?e:"[]")}const n=((e,t=10)=>{const o=Ew.getItem(e),n=r(o)?JSON.parse(o):[],s=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{s.splice(e,1)};return{add:o=>{F(s,o).each(i),s.unshift(o),s.length>t&&s.pop(),Ew.setItem(e,JSON.stringify(s))},state:()=>s.slice(0)}})(t,10);return Aw[e]=n,n}),Dw=(e,t)=>{Mw(e).add(t)},Bw=(e,t,o)=>({hue:e,saturation:t,value:o}),Iw=e=>{let t=0,o=0,n=0;const s=e.red/255,r=e.green/255,a=e.blue/255,i=Math.min(s,Math.min(r,a)),l=Math.max(s,Math.max(r,a));return i===l?(n=i,Bw(0,0,100*n)):(t=s===i?3:a===i?1:5,t=60*(t-(s===i?r-a:a===i?s-r:a-s)/(l-i)),o=(l-i)/l,n=l,Bw(Math.round(t),Math.round(100*o),Math.round(100*n)))},Fw=e=>rw(gw(e)),Rw=e=>{return(t=e,ow(t)?A.some({value:nw(t)}):A.none()).orThunk(()=>fw(e).map(rw)).getOrThunk(()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,s=n[0],r=n[1],a=n[2],i=n[3];return rw(uw(s,r,a,i))});var t},Nw="forecolor",Lw="hilitecolor",zw=e=>{const t=[];for(let o=0;o<e.length;o+=2)t.push({text:e[o+1],value:"#"+Rw(e[o]).value,icon:"checkmark",type:"choiceitem"});return t},Vw=e=>t=>t.options.get(e),Hw="#000000",Pw=(e,t)=>t===Nw&&e.options.isSet("color_map_foreground")?Vw("color_map_foreground")(e):t===Lw&&e.options.isSet("color_map_background")?Vw("color_map_background")(e):Vw("color_map")(e),Uw=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(Pw(e,t).length))),Ww=(e,t)=>{const o=Vw("color_cols")(e),n=Uw(e,t);return o===Uw(e)?n:o},jw=(e,t="default")=>Math.round(t===Nw?Vw("color_cols_foreground")(e):t===Lw?Vw("color_cols_background")(e):Vw("color_cols")(e)),Gw=Vw("custom_colors"),$w=Vw("color_default_foreground"),qw=Vw("color_default_background"),Yw=(e,t)=>{const o=ze(e.selection.getStart()),n="hilitecolor"===t?Ns(o,e=>{if($e(e)){const t=Nt(e,"background-color");return ke(fw(t).exists(e=>0!==e.alpha),t)}return A.none()}).getOr("rgba(0, 0, 0, 0)"):Nt(o,"color");return fw(n).map(e=>"#"+rw(e).value)},Xw=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]},Kw=(e,t,o,n)=>{"custom"===o?rS(e)(o=>{o.each(o=>{Dw(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)})},Yw(e,t).getOr(Hw)):"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},Jw=(e,t,o)=>e.concat((e=>V(Mw(e).state(),e=>({type:"choiceitem",text:e,icon:"checkmark",value:e})))(t).concat(Xw(o))),Zw=(e,t,o)=>n=>{n(Jw(e,t,o))},Qw=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},eS=(e,t)=>{e.setTooltip(t)},tS=(e,t)=>o=>{const n=Yw(e,t);return xe(n,o.toUpperCase())},oS=(e,t,o)=>{if(Be(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",s=Jw(Pw(e,t),t,!1),r=G(s,e=>e.value===o).getOr({text:""}).text;return e.translate([n,e.translate(r)])},nS=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:oS(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:tS(e,o),columns:jw(e,o),fetch:Zw(Pw(e,o),o,Gw(e)),onAction:t=>{Kw(e,o,n.get(),b)},onItemAction:(s,r)=>{Kw(e,o,r,o=>{n.set(o),xw(e,{name:t,color:o})})},onSetup:s=>{Qw(s,t,n.get());const r=n=>{n.name===t&&(Qw(s,n.name,n.color),eS(s,oS(e,o,n.color)))};return e.on("TextColorChange",r),Sw(Cw(e)(s),()=>{e.off("TextColorChange",r)})}})},sS=(e,t,o,n,s)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(eS(n,oS(e,o,s.get())),Qw(n,t,s.get()),Cw(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:tS(e,o),initData:{storageKey:o},onAction:n=>{Kw(e,o,n.value,o=>{s.set(o),xw(e,{name:t,color:o})})}}]})},rS=e=>(t,o)=>{let n=!1;const s={colorpicker:o};e.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:s,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const s=o.getData().colorpicker;n?(t(A.from(s)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",s]))},onClose:b,onCancel:()=>{t(A.none())}})},aS=(e,t,o,n,s,r,a,i)=>{const l=ty(t),c=iS(t,o,n,"color"!==s?"normal":"color",r,a,i);return sy(e,l,c,n,{menuType:s})},iS=(e,t,o,n,s,r,a)=>we(V(e,i=>{return"choiceitem"===i.type?(l=i,Xn("choicemenuitem",nx,l)).fold(oy,i=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=Yx({presets:o,textContent:t?e.text:A.none(),htmlContent:A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:A.none(),checkMark:t?A.some($x(a.icons)):A.none(),caret:A.none(),value:e.value},a,i),c=e.text.filter(x(!t)).map(e=>Cx.config(a.tooltips.getConfig({tooltipText:a.translate(e)})));return vn(zx({data:Vx(e),enabled:e.enabled,getApi:e=>({setActive:t=>{hh.set(e,t)},isActive:()=>hh.isOn(e),isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(s),b),triggersSubmenu:!1,itemBehaviours:[...c.toArray()]},l,r,a),{toggling:{toggleClass:Cv,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(i,1===o,n,t,r(i.value),s,a,ty(e)))):A.none();var l})),lS=(e,t)=>{const o=Iv(t);return 1===e?{mode:"menu",moveOnTab:!0}:"auto"===e?{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group"),previousSelector:e=>"color"===t?yi(e.element,"[aria-checked=true]"):A.none()}},cS=da("cell-over"),dS=da("cell-execute"),uS=(e,t,o)=>{const n=o=>Nr(o,dS,{row:e,col:t}),s=(e,t)=>{t.stop(),n(e)};return di({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:El([oh("insert-table-picker-cell",[jr(Xs(),ih.focus),jr(gr(),n),jr(or(),s),jr(hr(),s)]),hh.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),ih.config({onFocus:o=>Nr(o,cS,{row:e,col:t})})])})},mS=e=>Y(e,e=>V(e,ui)),gS=(e,t)=>ai(`${t}x${e}`),pS={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=(e=>{const t=[];for(let o=0;o<10;o++){const n=[];for(let t=0;t<10;t++){const s=e(o+1,t+1);n.push(uS(o,t,s))}t.push(n)}return t})(o),s=gS(0,0),r=Jh({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[s],behaviours:El([th.config({})])});return{type:"widget",data:{value:da("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Zx.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:mS(n).concat(r.asSpec()),behaviours:El([oh("insert-table-picker",[Zr(e=>{th.set(r.get(e),[s])}),Yr(cS,(e,t,o)=>{const{row:s,col:a}=o.event;((e,t,o)=>{for(let n=0;n<10;n++)for(let s=0;s<10;s++)hh.set(e[n][s],n<=t&&s<=o)})(n,s,a),th.set(r.get(e),[gS(s+1,a+1)])}),Yr(dS,(t,o,n)=>{const{row:s,col:r}=n.event;e.onAction({numRows:s+1,numColumns:r+1}),Rr(t,br())})]),$p.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=((e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold(()=>Jw(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o),e=>e.concat(Xw(o)))})(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),s="color",r={...aS(da("menu-value"),o,t=>{e.onAction({value:t})},n,s,vv.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),markers:Iv(s),movement:lS(n,s)};return{type:"widget",data:{value:da("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Zx.widget(Lh.sketch(r))]}}},hS=e=>({type:"separator",dom:{tag:"div",classes:[xv,"tox-collection__group-heading"]},components:e.text.map(ai).toArray()});var fS=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),bS=[rs("others",Yn(an.value,zn()))],vS=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 Ea({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk(()=>(be(o.others,n).getOrDie("No information found for coupled component: "+n),A.none())),getOrCreate:(o,n,s)=>t(n,s).getOrThunk(()=>{const t=be(n.others,s).getOrDie("No information found for coupled component: "+s)(o),r=o.getSystem().build(t);return e[s]=r,r})})}});const yS=Ml({fields:bS,name:"coupling",apis:fS,state:vS}),xS=e=>{let t=A.none(),o=[];const n=e=>{s()?r(e):o.push(e)},s=()=>t.isSome(),r=e=>{t.each(t=>{setTimeout(()=>{e(t)},0)})};return e(e=>{s()||(t=A.some(e),H(o,r),o=[])}),{get:n,map:e=>xS(t=>{n(o=>{t(e(o))})}),isReady:s}},wS={nu:xS,pure:e=>xS(t=>{t(e)})},SS=e=>{setTimeout(()=>{throw e},0)},CS=e=>{const t=t=>{e().then(t,SS)};return{map:t=>CS(()=>e().then(t)),bind:t=>CS(()=>e().then(e=>t(e).toPromise())),anonBind:t=>CS(()=>e().then(()=>t.toPromise())),toLazy:()=>wS.nu(t),toCached:()=>{let t=null;return CS(()=>(null===t&&(t=e()),t))},toPromise:e,get:t}},kS=e=>CS(()=>new Promise(e)),OS=e=>CS(()=>Promise.resolve(e)),_S=x("sink"),TS=x(Xu({name:_S(),overrides:x({dom:{tag:"div"},behaviours:El([Td.config({useFixed:E})]),events:Pr([Xr(Zs()),Xr(Gs()),Xr(or())])})})),ES=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",s=e.getAnchorOverrides();return e.layouts.fold(()=>({type:n,hotspot:o,overrides:s}),e=>({type:n,hotspot:o,overrides:s,layouts:e}))},AS=(e,t,o,n,s,r,a)=>{const i=((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=BS(n,e);return i.map(e=>e.bind(e=>A.from($h.sketch({...r.menu(),uid:ba(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();Td.position(n,t,{anchor:o}),Qd.decloak(s)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();Td.position(n,o,{anchor:{type:"submenu",item:t}}),Qd.decloak(s)},onRepositionMenu:(e,t,n)=>{const s=l().getOrDie();Td.position(s,t,{anchor:o}),H(n,e=>{Td.position(s,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})})},onEscape:()=>(ih.focus(n),Qd.close(s),A.some(!0))}))))})(e,t,ES(e,o),o,n,s,a);return i.map(e=>(e.fold(()=>{Qd.isOpen(n)&&Qd.close(n)},e=>{Qd.cloak(n),Qd.open(n,e),r(n)}),n))},MS=(e,t,o,n,s,r,a)=>(Qd.close(n),OS(n)),DS=(e,t,o,n,s,r)=>{const a=yS.getCoupled(o,"sandbox");return(Qd.isOpen(a)?MS:AS)(e,t,o,a,n,s,r)},BS=(e,t)=>e.getSystem().getByUid(t.uid+"-"+_S()).map(e=>()=>an.value(e)).getOrThunk(()=>t.lazySink.fold(()=>()=>an.error(new Error("No internal sink is specified, nor could an external sink be found")),t=>()=>t(e))),IS=e=>{Qd.getState(e).each(e=>{$h.repositionMenus(e)})},FS=(e,t,o)=>{const n=Si(),s=BS(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:ku(e.sandboxBehaviours,[yu.config({store:{mode:"memory",initialValue:t}}),Qd.config({onOpen:(s,r)=>{const a=ES(e,t);n.link(t.element),e.matchWidth&&((e,t,o)=>{const n=_m.getCurrent(t).getOr(t),s=Qt(e.element);o?It(n.element,"min-width",s+"px"):((e,t)=>{Zt.set(e,t)})(n.element,s)})(a.hotspot,r,e.useMinWidth),e.onOpen(a,s,r),void 0!==o&&void 0!==o.onOpen&&o.onOpen(s,r)},onClose:(e,r)=>{n.unlink(t.element),s().getOr(r).element.dom.dispatchEvent(new window.FocusEvent("focusout")),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},isPartOf:(e,o,n)=>Ci(o,n)||Ci(t,n),getAttachPoint:()=>s().getOrDie()}),_m.config({find:e=>Qd.getState(e).bind(e=>_m.getCurrent(e))}),Fl.config({channels:{...su({isExtraPart:T}),...au({doReposition:IS})}})])}},RS=e=>{const t=yS.getCoupled(e,"sandbox");IS(t)},NS=()=>[ws("sandboxClasses",[]),Cu("sandboxBehaviours",[_m,Fl,Qd,yu])],LS=x([ss("dom"),ss("fetch"),Ni("onOpen"),Li("onExecute"),ws("getHotspot",A.some),ws("getAnchorOverrides",x({})),_c(),xu("dropdownBehaviours",[hh,yS,$p,ih]),ss("toggleClass"),ws("eventOrder",{}),gs("lazySink"),ws("matchWidth",!1),ws("useMinWidth",!1),gs("role")].concat(NS())),zS=x([Yu({schema:[Ii(),ws("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),TS()]),VS=Sm({name:"Dropdown",configFields:LS(),partFields:zS(),factory:(e,t,o,n)=>{const s=e=>{Qd.getState(e).each(e=>{$h.highlightPrimary(e)})},r=(t,o,s)=>DS(e,w,t,n,o,s),a={expand:e=>{hh.isOn(e)||r(e,b,jh.HighlightNone).get(b)},open:e=>{hh.isOn(e)||r(e,b,jh.HighlightMenuAndItem).get(b)},refetch:t=>yS.getExistingCoupled(t,"sandbox").fold(()=>r(t,b,jh.HighlightMenuAndItem).map(b),o=>AS(e,w,t,o,n,b,jh.HighlightMenuAndItem).map(b)),isOpen:hh.isOn,close:e=>{hh.isOn(e)&&r(e,b,jh.HighlightMenuAndItem).get(b)},repositionMenus:e=>{hh.isOn(e)&&RS(e)}},i=(e,t)=>(Lr(e),A.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.dropdownBehaviours,[hh.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),yS.config({others:{sandbox:t=>FS(e,t,{onOpen:()=>hh.on(t),onClose:()=>hh.off(t)})}}),$p.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(VS.isOpen(e)){const t=yS.getCoupled(e,"sandbox");s(t)}else VS.open(e);return A.some(!0)},onEscape:(e,t)=>VS.isOpen(e)?(VS.close(e),A.some(!0)):A.none()}),ih.config({})]),events:vh(A.some(e=>{r(e,s,jh.HighlightMenuAndItem).get(b)})),eventOrder:{...e.eventOrder,[gr()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold(()=>({}),e=>({role:e})),..."button"===e.dom.tag?{type:be(e.dom,"attributes").bind(e=>be(e,"type")).getOr("button")}:{}}}}},apis:{open:(e,t)=>e.open(t),refetch:(e,t)=>e.refetch(t),expand:(e,t)=>e.expand(t),close:(e,t)=>e.close(t),isOpen:(e,t)=>e.isOpen(t),repositionMenus:(e,t)=>e.repositionMenus(t)}}),HS=(e,t,o)=>{$v(e).each(e=>{var n;((e,t)=>{Et(t.element,"id").each(t=>Ot(e.element,"aria-activedescendant",t))})(e,o),(qa((n=t).element,Xv)?A.some(n.element):yi(n.element,"."+Xv)).each(t=>{Et(t,"id").each(t=>Ot(e.element,"aria-controls",t))})}),Ot(o.element,"aria-selected","true")},PS=(e,t,o)=>{Ot(o.element,"aria-selected","false")},US=e=>yS.getExistingCoupled(e,"sandbox").bind(Gv).map(qv).map(e=>e.fetchPattern).getOr("");var WS;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(WS||(WS={}));const jS=(e,t,o,n,s)=>{const r=o.shared.providers,a=e=>s?{...e,shortcut:A.none(),icon:e.text.isSome()?A.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,Xn("menuitem",lx,i)).fold(oy,e=>A.some(((e,t,o,n=!0)=>{const s=Yx({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.none(),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return zx({data:Vx(e),getApi:e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o)})(a(e),t,r,n)));case"nestedmenuitem":return(e=>Xn("nestedmenuitem",cx,e))(e).fold(oy,e=>A.some(((e,t,o,n=!0,s=!1)=>{const r=s?(a=o.icons,Px("chevron-down",a,[_v])):(e=>Px("chevron-right",e,[_v]))(o.icons);var a;const i=Yx({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.some(r),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return zx({data:Vx(e),getApi:e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setIconFill:(t,o)=>{yi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{Ot(e,"fill",o)})},setTooltip:t=>{const n=o.translate(t);Ot(e.element,"aria-label",n)}}),enabled:e.enabled,onAction:b,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)})(a(e),t,r,n,s)));case"togglemenuitem":return(e=>Xn("togglemenuitem",dx,e))(e).fold(oy,e=>A.some(((e,t,o,n=!0)=>{const s=Yx({iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,checkMark:A.some($x(o.icons)),caret:A.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return vn(zx({data:Vx(e),enabled:e.enabled,getApi:e=>({setActive:t=>{hh.set(e,t)},isActive:()=>hh.isOn(e),isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o),{toggling:{toggleClass:Cv,toggleOnExecute:!1,selected:e.active}})})(a(e),t,r,n)));case"separator":return(e=>Xn("separatormenuitem",Iy,e))(e).fold(oy,e=>A.some(hS(e)));case"fancymenuitem":return(e=>Xn("fancymenuitem",ix,e))(e).fold(oy,e=>((e,t)=>be(pS,e.fancytype).map(o=>o(e,t)))(e,o));default:return console.error("Unknown item in general menu",e),A.none()}var i},GS=(e,t,o,n,s,r,a)=>{const i=1===n,l=!i||ty(e);return we(V(e,e=>{switch(e.type){case"separator":return(n=e,Xn("Autocompleter.Separator",Iy,n)).fold(oy,e=>A.some(hS(e)));case"cardmenuitem":return(e=>Xn("cardmenuitem",ox,e))(e).fold(oy,e=>A.some(((e,t,o,n)=>{const s={dom:qx(e.label),optComponents:[A.some({dom:{tag:"div",classes:[Ev,Av]},components:Jx(e.items,n)})]};return zx({data:Vx({text:A.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>{Hm.set(e,!t),H(Qc(e.element,"*"),o=>{e.getSystem().getByDom(o).each(e=>{e.hasConfigured(Hm)&&Hm.set(e,!t)})})}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:A.from(n.itemBehaviours).getOr([])},s,t,o.providers)})({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},s,r,{itemBehaviours:Xx(e.meta,r,A.none()),cardText:{matchText:t,highlightOn:a}})));default:return(e=>Xn("Autocompleter.Item",Fy,e))(e).fold(oy,e=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=Yx({presets:n,textContent:A.none(),htmlContent:o?e.text.map(e=>Kx(e,t)):A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:A.none(),checkMark:A.none(),caret:A.none(),value:e.value},a.providers,i,e.icon),c=e.text.filter(e=>!o&&""!==e);return zx({data:Vx(e),enabled:e.enabled,getApi:x({}),onAction:t=>s(e.value,e.meta),onSetup:x(b),triggersSubmenu:!1,itemBehaviours:Xx(e,a,c)},l,r,a.providers)})(e,t,i,"normal",o,s,r,l)))}var n}))},$S=(e,t,o,n,s,r)=>{const a=ty(t),i=we(V(t,e=>{const t=e=>jS(e,o,n,(e=>s?!ve(e,"text"):a)(e),s);return"nestedmenuitem"===e.type&&e.getSubmenuItems().length<=0?t({...e,enabled:!1}):t(e)})),l=(e=>"no-search"===e.searchMode?{menuType:"normal"}:{menuType:"searchable",searchMode:e})(r);return(s?ny:sy)(e,a,i,1,l)},qS=e=>$h.singleData(e.value,e),YS=e=>Pc(ze(e.startContainer),e.startOffset,ze(e.endContainer),e.endOffset),XS=(e,t)=>{const o=da("autocompleter"),n=Ms(!1),s=Ms(!1),r=sc(),a=di(qh.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:El([oh("dismissAutocompleter",[jr(_r(),()=>u()),jr(Ir(),(t,o)=>{Et(o.event.target,"id").each(t=>Ot(ze(e.getBody()),"aria-activedescendant",t))})])]),lazySink:t.getSink})),i=()=>qh.isOpen(a),l=s.get,c=()=>{if(i()){qh.hide(a),e.dom.remove(o,!1);const t=ze(e.getBody());Et(t,"aria-owns").filter(e=>e===o).each(()=>{Mt(t,"aria-owns"),Mt(t,"aria-activedescendant")})}},d=()=>qh.getContent(a).bind(e=>te(e.components(),0)),u=()=>e.execCommand("mceAutocompleterClose"),m=s=>{const i=(o=>{const s=re(o,e=>A.from(e.columns)).getOr(1);return Y(o,o=>{const a=o.items;return GS(a,o.matchText,(t,s)=>{const a={hide:()=>u(),reload:t=>{c(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};e.execCommand("mceAutocompleterRefreshActiveRange"),r.get().each(e=>{n.set(!0),o.onAction(a,e,t,s),n.set(!1)})},s,vv.BUBBLE_TO_SANDBOX,t,o.highlightOn)})})(s);i.length>0?(((t,o)=>{const n=re(t,e=>A.from(e.columns)).getOr(1);qh.showMenuAt(a,{anchor:{type:"selection",getSelection:()=>r.get().map(YS),root:ze(e.getBody())}},((e,t,o,n)=>{const s=lS(t,n),r=Iv(n);return{data:qS({...e,movement:s,menuBehaviours:mx("auto"!==t?[]:[Zr((e,t)=>{ux(e,4,r.item).each(({numColumns:t,numRows:o})=>{$p.setGridSize(e,o,t)})})])}),menu:{markers:Iv(n),fakeFocus:o===WS.ContentFocus}}})(sy("autocompleter-value",!0,o,n,{menuType:"normal"}),n,WS.ContentFocus,"normal")),d().each(Km.highlightFirst)})(s,i),Ot(ze(e.getBody()),"aria-owns",o),e.inline||g()):c()},g=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),s=(e=>sa(e,!0))(a.element);Ft(s,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${n.offsetTop}px`,left:`${n.offsetLeft}px`}),e.dom.add(t,s.dom),yi(s,'[role="menu"]').each(e=>{Pt(e,"position"),Pt(e,"max-height")})};e.on("AutocompleterStart",({lookupData:e})=>{s.set(!0),n.set(!1),m(e)}),e.on("AutocompleterUpdate",({lookupData:e})=>m(e)),e.on("AutocompleterUpdateActiveRange",({range:e})=>r.set(e)),e.on("AutocompleterEnd",()=>{c(),s.set(!1),n.set(!1),r.clear()});((e,t)=>{const o=(e,t)=>{Nr(e,Zs(),{raw:t})},n=()=>e.getMenu().bind(Km.getHighlighted);t.on("keydown",t=>{const s=t.which;e.isActive()&&(e.isMenuOpen()?13===s?(n().each(Lr),t.preventDefault()):40===s?(n().fold(()=>{e.getMenu().each(Km.highlightFirst)},e=>{o(e,t)}),t.preventDefault(),t.stopImmediatePropagation()):37!==s&&38!==s&&39!==s||n().each(e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()}):13!==s&&38!==s&&40!==s||e.cancelIfNecessary())}),t.on("NodeChange",()=>{!e.isActive()||e.isProcessingAction()||t.queryCommandState("mceAutoCompleterInRange")||e.cancelIfNecessary()})})({cancelIfNecessary:u,isMenuOpen:i,isActive:l,isProcessingAction:n.get,getMenu:d},e)},KS=["visible","hidden","clip"],JS=e=>Me(e).length>0&&!R(KS,e),ZS=e=>{if(Ge(e)){const t=Nt(e,"overflow-x"),o=Nt(e,"overflow-y");return JS(t)||JS(o)}return!1},QS=(e,t)=>mv(e)?(e=>{const t=Zc(e,ZS),o=0===t.length?yt(e).map(xt).map(e=>Zc(e,ZS)).getOr([]):t;return oe(o).map(e=>({element:e,others:o.slice(1)}))})(t):A.none(),eC=e=>{const t=[...V(e.others,Qo),on()];return((e,t)=>j(t,(e,t)=>tn(e,t),e))(Qo(e.element),t)},tC=(e,t,o)=>xi(e,t,o).isSome(),oC=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout(()=>{e.apply(null,n),o=null},t)}}},nC=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])},sC=(e,t)=>{const o={stopBackspace:!0,...t},n=(e=>{const t=sc(),o=Ms(!1),n=oC(t=>{e.triggerEvent(fr(),t),o.set(!0)},400),s=Is([{key:Ps(),value:e=>(nC(e).each(s=>{n.cancel();const r={x:s.clientX,y:s.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(r)}),A.none())},{key:Us(),value:e=>(n.cancel(),nC(e).each(e=>{t.on(o=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(e,o)&&t.clear()})}),A.none())},{key:Ws(),value:s=>(n.cancel(),t.get().filter(e=>et(e.target,s.target)).map(t=>o.get()?(s.prevent(),!1):e.triggerEvent(hr(),s)))}]);return{fireIfReady:(e,t)=>be(s,t).bind(t=>t(e))}})(o),s=V(["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=>ac(e,t,e=>{n.fireIfReady(e,t).each(t=>{t&&e.kill()}),o.triggerEvent(t,e)&&e.kill()})),r=sc(),a=ac(e,"paste",e=>{n.fireIfReady(e,"paste").each(t=>{t&&e.kill()}),o.triggerEvent("paste",e)&&e.kill(),r.set(setTimeout(()=>{o.triggerEvent(ur(),e)},0))}),i=ac(e,"keydown",e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===Jm[0]&&!R(["input","textarea"],We(e.target))&&!tC(e.target,'[contenteditable="true"]'))(e)&&e.prevent()}),l=ac(e,"focusin",e=>{o.triggerEvent("focusin",e)&&e.kill()}),c=sc(),d=ac(e,"focusout",e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout(()=>{o.triggerEvent(dr(),e)},0))});return{unbind:()=>{H(s,e=>{e.unbind()}),i.unbind(),l.unbind(),d.unbind(),a.unbind(),r.on(clearTimeout),c.on(clearTimeout)}}},rC=(e,t)=>{const o=be(e,"target").getOr(t);return Ms(o)},aC=Ds([{stopped:[]},{resume:["element"]},{complete:[]}]),iC=(e,t,o,n,s,r)=>{const a=e(t,n),i=((e,t)=>{const o=Ms(!1),n=Ms(!1);return{stop:()=>{o.set(!0)},cut:()=>{n.set(!0)},isStopped:o.get,isCut:n.get,event:e,setSource:t.set,getSource:t.get}})(o,s);return a.fold(()=>(r.logEventNoHandlers(t,n),aC.complete()),e=>{const o=e.descHandler;return Da(o)(i),i.isStopped()?(r.logEventStopped(t,e.element,o.purpose),aC.stopped()):i.isCut()?(r.logEventCut(t,e.element,o.purpose),aC.complete()):at(e.element).fold(()=>(r.logNoParent(t,e.element,o.purpose),aC.complete()),n=>(r.logEventResponse(t,e.element,o.purpose),aC.resume(n)))})},lC=(e,t,o,n,s,r)=>iC(e,t,o,n,s,r).fold(E,n=>lC(e,t,o,n,s,r),T),cC=(e,t,o,n,s)=>{const r=rC(o,n);return lC(e,t,o,n,r,s)},dC=()=>{const e=(()=>{const e={};return{registerId:(t,o,n)=>{le(n,(n,s)=>{const r=void 0!==e[s]?e[s]:{};r[o]=((e,t)=>({cHandler:C.apply(void 0,[e.handler].concat(t)),purpose:e.purpose}))(n,t),e[s]=r})},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=>Ns(n,t=>((e,t)=>fa(t).bind(t=>be(e,t)).map(e=>((e,t)=>({element:e,descHandler:t}))(t,e)))(e,t),t))}})(),t={},o=o=>{fa(o.element).each(o=>{delete t[o],e.unregisterId(o)})};return{find:(t,o,n)=>e.find(t,o,n),filter:t=>e.filterByType(t),register:n=>{const s=(e=>{const t=e.element;return fa(t).getOrThunk(()=>((e,t)=>{const o=da(ga+"uid-");return ha(t,o),o})(0,e.element))})(n);ye(t,s)&&((e,n)=>{const s=t[n];if(s!==e)throw new Error('The tagId "'+n+'" is already used by: '+ra(s.element)+"\nCannot use it for: "+ra(e.element)+"\nThe conflicting element is"+(wt(s.element)?" ":" not ")+"already in the DOM");o(e)})(n,s);const r=[n];e.registerId(r,s,n.events),t[s]=n},unregister:o,getById:e=>be(t,e)}},uC=wm({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:wu(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[ws("components",[]),xu("containerBehaviours",[]),ws("events",{}),ws("domModification",{}),ws("eventOrder",{})]}),mC=e=>{const t=t=>at(e.element).fold(E,e=>et(t,e)),o=dC(),n=(e,n)=>o.find(t,e,n),s=sC(e.element,{triggerEvent:(e,t)=>Ti(e,t.target,o=>((e,t,o,n)=>cC(e,t,o,o.target,n))(n,e,t,o))}),r={debugInfo:x("real"),triggerEvent:(e,t,o)=>{Ti(e,t,s=>cC(n,e,o,t,s))},triggerFocus:(e,t)=>{fa(e).fold(()=>{Nl(e)},o=>{Ti(cr(),e,o=>(((e,t,o,n,s)=>{const r=rC(o,n);iC(e,t,o,n,r,s)})(n,cr(),{originator:t,kill:b,prevent:b,target:e},e,o),!1))})},triggerEscape:(e,t)=>{r.triggerEvent("keydown",e.element,t.event)},getByUid:e=>p(e),getByDom:e=>h(e),build:di,buildOrPatch:ci,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{u(e)},broadcastOn:(e,t)=>{m(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:E},a=e=>{e.connect(r),qe(e.element)||(o.register(e),H(e.components(),a),r.triggerEvent(yr(),e.element,{target:e.element}))},i=e=>{qe(e.element)||(H(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{Fd(e,t)},c=e=>{Ld(e)},d=e=>{const t=o.filter(mr());H(t,t=>{const o=t.descHandler;Da(o)(e)})},u=e=>{d({universal:!0,data:e})},m=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>((e,t)=>{const o=(e=>{const t=Ms(!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;Da(t)(o)}),o.isStopped()})(o.filter(e),t),p=e=>o.getById(e).fold(()=>an.error(new Error('Could not find component with uid: "'+e+'" in system.')),an.value),h=e=>{const t=fa(e).getOr("not found");return p(t)};return a(e),{root:e,element:e.element,destroy:()=>{s.unbind(),Wo(e.element)},add:l,remove:c,getByUid:p,getByDom:h,addToWorld:a,removeFromWorld:i,broadcast:u,broadcastOn:m,broadcastEvent:g}},gC=x([ws("prefix","form-field"),xu("fieldBehaviours",[_m,yu])]),pC=x([Xu({schema:[ss("dom")],name:"label"}),Xu({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[ss("text")],name:"aria-descriptor"}),qu({factory:{sketch:e=>{const t=((e,t)=>{const o={};return le(e,(e,n)=>{R(t,n)||(o[n]=e)}),o})(e,["factory"]);return e.factory.sketch(t)}},schema:[ss("factory")],name:"field"})]),hC=Sm({name:"FormField",configFields:gC(),partFields:pC(),factory:(e,t,o,n)=>{const s=Su(e.fieldBehaviours,[_m.config({find:t=>im(t,e,"field")}),yu.config({store:{mode:"manual",getValue:e=>_m.getCurrent(e).bind(yu.getValue),setValue:(e,t)=>{_m.getCurrent(e).each(e=>{yu.setValue(e,t)})}}})]),r=Pr([Zr((t,o)=>{const n=cm(t,e,["label","field","aria-descriptor"]);n.field().each(t=>{const o=da(e.prefix);n.label().each(e=>{Ot(e.element,"for",o),Ot(t.element,"id",o)}),n["aria-descriptor"]().each(o=>{const n=da(e.prefix);Ot(o.element,"id",n),Ot(t.element,"aria-describedby",n)})})})]),a={getField:t=>im(t,e,"field"),getLabel:t=>im(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:s,events:r,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}});var fC=Object.freeze({__proto__:null,exhibit:(e,t)=>Ma({attributes:Is([{key:t.tabAttr,value:"true"}])})}),bC=[ws("tabAttr","data-alloy-tabstop")];const vC=Ml({fields:bC,name:"tabstopping",active:fC});var yC=tinymce.util.Tools.resolve("tinymce.html.Entities");const xC=(e,t,o,n)=>{const s=wC(e,t,o,n);return hC.sketch(s)},wC=(e,t,o,n)=>({dom:SC(o),components:e.toArray().concat([t]),fieldBehaviours:El(n)}),SC=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),CC=(e,t,o)=>{const n={dom:{tag:"label",classes:["tox-label"]},components:[ai(o.translate(e))]};if(""===t.trim())return hC.parts.label(n);const s={dom:{tag:"div",classes:["tox-label-tooltip"]},components:[sb("tooltip",{tag:"span",classes:["tox-icon","tox-label-tooltip-icon"]},o.icons)],behaviours:El([Cx.config(o.tooltips.getConfig({tooltipText:o.translate(t)}))])};return hC.parts.label({dom:{tag:"div",classes:["tox-form__label-container"]},components:[n,s]})},kC=da("form-component-change"),OC=da("form-close"),_C=da("form-cancel"),TC=da("form-action"),EC=da("form-submit"),AC=da("form-block"),MC=da("form-unblock"),DC=da("form-tabchange"),BC=da("form-resize"),IC=(e,t,o)=>{const n=e.label.map(o=>CC(o,e.tooltip.getOr(""),t)),s=t.icons(),r=e=>(t,o)=>{xi(o.event.target,"[data-collection-item-value]").each(n=>{e(t,o,n,Tt(n,"data-collection-item-value"))})},a=r((o,n,s,r)=>{n.stop(),t.isDisabled()||Nr(o,TC,{name:e.name,value:r})}),i=[jr(Xs(),r((e,t,o)=>{Nl(o)})),jr(or(),a),jr(hr(),a),jr(Ks(),r((e,t,o)=>{yi(e.element,"."+Tv).each(e=>{$a(e,Tv)}),ja(o,Tv)})),jr(Js(),r(e=>{yi(e.element,"."+Tv).each(e=>{$a(e,Tv),Ll(e)})})),ta(r((t,o,n,s)=>{Nr(t,TC,{name:e.name,value:s})}))],l=(e,t)=>V(Qc(e.element,".tox-collection__item"),t),c=hC.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:w},behaviours:El([Hm.config({disabled:t.isDisabled,onDisabled:e=>{l(e,e=>{ja(e,"tox-collection__item--state-disabled"),Ot(e,"aria-disabled",!0)})},onEnabled:e=>{l(e,e=>{$a(e,"tox-collection__item--state-disabled"),Mt(e,"aria-disabled")})}}),Ex(),th.config({}),Cx.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{yi(e.element,"."+Tv+"[data-mce-tooltip]").each(o=>{Et(o,"data-mce-tooltip").each(o=>{Cx.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-keyboard-focus",anchor:e=>({type:"node",node:yi(e.element,"."+Tv).orThunk(()=>Qe(".tox-collection__item")),root:e.element,layouts:{onLtr:x([pl,gl,cl,ul,dl,ml]),onRtl:x([pl,gl,cl,ul,dl,ml])},bubble:vc(0,-2,{})})}),yu.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(o,n)=>{((o,n)=>{const r=V(n,o=>{const n=Xf.translate(o.text),r=1===e.columns?`<div class="tox-collection__item-label">${n}</div>`:"",a=`<div class="tox-collection__item-icon">${(e=>{var t;return null!==(t=s[e])&&void 0!==t?t:e})(o.icon)}</div>`,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,e=>i[e]);return`<div data-mce-tooltip="${l}" class="tox-collection__item${t.isDisabled()?" tox-collection__item--state-disabled":""}" tabindex="-1" data-collection-item-value="${yC.encodeAllRaw(o.value)}" aria-label="${l}">${a}${r}</div>`}),a="auto"!==e.columns&&e.columns>1?z(r,e.columns):[r],i=V(a,e=>`<div class="tox-collection__group">${e.join("")}</div>`);na(o.element,i.join(""))})(o,n),"auto"===e.columns&&ux(o,5,"tox-collection__item").each(({numRows:e,numColumns:t})=>{$p.setGridSize(o,e,t)}),Rr(o,BC)}}),vC.config({}),$p.config((d=e.columns,1===d?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===d?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:".tox-collection__group",cell:`.${xv}`}})),oh("collection-events",i)]),eventOrder:{[gr()]:["disabling","alloy.base.behaviour","collection-events"],[Ks()]:["collection-events","tooltipping"]}});var d;return xC(n,c,["tox-form__group--collection"],[])},FC=["input","textarea"],RC=e=>{const t=We(e);return R(FC,t)},NC=(e,t)=>{const o=t.getRoot(e).getOr(e.element);$a(o,t.invalidClass),t.notify.each(t=>{RC(e.element)&&Ot(e.element,"aria-invalid",!1),t.getContainer(e).each(e=>{na(e,t.validHtml)}),t.onValid(e)})},LC=(e,t,o,n)=>{const s=t.getRoot(e).getOr(e.element);ja(s,t.invalidClass),t.notify.each(t=>{RC(e.element)&&Ot(e.element,"aria-invalid",!0),t.getContainer(e).each(e=>{na(e,n)}),t.onInvalid(e,n)})},zC=(e,t,o)=>t.validator.fold(()=>OS(an.value(!0)),t=>t.validate(e)),VC=(e,t,o)=>(t.notify.each(t=>{t.onValidate(e)}),zC(e,t).map(o=>e.getSystem().isConnected()?o.fold(o=>(LC(e,t,0,o),an.error(o)),o=>(NC(e,t),an.value(o))):an.error("No longer in system")));var HC=Object.freeze({__proto__:null,markValid:NC,markInvalid:LC,query:zC,run:VC,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return qa(o,t.invalidClass)}}),PC=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map(t=>Pr([jr(t.onEvent,t=>{VC(t,e).get(w)})].concat(t.validateOnLoad?[Zr(t=>{VC(t,e).get(b)})]:[]))).getOr({})}),UC=[ss("invalidClass"),ws("getRoot",A.none),xs("notify",[ws("aria","alert"),ws("getContainer",A.none),ws("validHtml",""),Ni("onValid"),Ni("onInvalid"),Ni("onValidate")]),xs("validator",[ss("validate"),ws("onEvent","input"),ws("validateOnLoad",!0)])];const WC=Ml({fields:UC,name:"invalidating",active:PC,apis:HC,extra:{validation:e=>t=>{const o=yu.getValue(t);return OS(e(o))}}}),jC=Ml({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Pr([Ur(ar(),E)]),exhibit:()=>Ma({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),GC=da("color-input-change"),$C=da("color-swatch-change"),qC=da("color-picker-cancel"),YC=Xu({schema:[ss("dom")],name:"label"}),XC=e=>Xu({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold(()=>({}),e=>({events:Pr([Gr(Ps(),(t,o,n)=>e(t,n),[t]),Gr(Gs(),(t,o,n)=>e(t,n),[t]),Gr($s(),(t,o,n)=>{n.mouseIsDown.get()&&e(t,n)},[t])])}))}),KC=XC("top-left"),JC=XC("top"),ZC=XC("top-right"),QC=XC("right"),ek=XC("bottom-right"),tk=XC("bottom"),ok=XC("bottom-left"),nk=XC("left"),sk=qu({name:"thumb",defaults:x({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Pr([qr(Ps(),e,"spectrum"),qr(Us(),e,"spectrum"),qr(Ws(),e,"spectrum"),qr(Gs(),e,"spectrum"),qr($s(),e,"spectrum"),qr(Ys(),e,"spectrum")])})}),rk=e=>mg(e.event);var ak=[YC,nk,QC,JC,tk,KC,ZC,ok,ek,sk,qu({schema:[os("mouseIsDown",()=>Ms(!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:El([$p.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,rk(n)),onRight:(o,n)=>t.onRight(o,e,rk(n)),onUp:(o,n)=>t.onUp(o,e,rk(n)),onDown:(o,n)=>t.onDown(o,e,rk(n))}),vC.config({}),ih.config({})]),events:Pr([jr(Ps(),o),jr(Us(),o),jr(Gs(),o),jr($s(),(t,n)=>{e.mouseIsDown.get()&&o(t,n)})])}}})];const ik=x("slider.change.value"),lk=e=>{const t=e.event.raw;if((e=>-1!==e.type.indexOf("touch"))(t)){const e=t;return void 0!==e.touches&&1===e.touches.length?A.some(e.touches[0]).map(e=>Yt(e.clientX,e.clientY)):A.none()}{const e=t;return void 0!==e.clientX?A.some(e).map(e=>Yt(e.clientX,e.clientY)):A.none()}},ck=e=>e.model.minX,dk=e=>e.model.minY,uk=e=>e.model.minX-1,mk=e=>e.model.minY-1,gk=e=>e.model.maxX,pk=e=>e.model.maxY,hk=e=>e.model.maxX+1,fk=e=>e.model.maxY+1,bk=(e,t,o)=>t(e)-o(e),vk=e=>bk(e,gk,ck),yk=e=>bk(e,pk,dk),xk=e=>vk(e)/2,wk=e=>yk(e)/2,Sk=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,Ck=e=>e.snapToGrid,kk=e=>e.snapStart,Ok=e=>e.rounded,_k=(e,t)=>void 0!==e[t+"-edge"],Tk=e=>_k(e,"left"),Ek=e=>_k(e,"right"),Ak=e=>_k(e,"top"),Mk=e=>_k(e,"bottom"),Dk=e=>e.model.value.get(),Bk=(e,t)=>({x:e,y:t}),Ik=(e,t)=>{Nr(e,ik(),{value:t})},Fk=(e,t,o,n)=>e<t?e:e>o?o:e===t?t-1:Math.max(t,e-n),Rk=(e,t,o,n)=>e>o?e:e<t?t:e===o?o+1:Math.min(o,e+n),Nk=(e,t,o)=>Math.max(t,Math.min(o,e)),Lk=e=>{const{min:t,max:o,range:n,value:s,step:r,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:u,maxBound:m,screenRange:g}=e,p=c?t-1:t,h=d?o+1:o;if(s<u)return p;if(s>m)return h;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(s,u,m),c=Nk(e/g*n+t,p,h);return a&&c>=t&&c<=o?((e,t,o,n,s)=>s.fold(()=>{const s=e-t,r=Math.round(s/n)*n;return Nk(t+r,t-1,o+1)},t=>{const s=(e-t)%n,r=Math.round(s/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+r)*n;return Math.max(t,l)}))(c,t,o,r,i):l?Math.round(c):c}},zk=e=>{const{min:t,max:o,range:n,value:s,hasMinEdge:r,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return s<t?r?0:c:s>o?a?i:d:(s-t)/n*l},Vk="top",Hk="right",Pk="bottom",Uk="left",Wk=e=>e.element.dom.getBoundingClientRect(),jk=(e,t)=>e[t],Gk=e=>{const t=Wk(e);return jk(t,Uk)},$k=e=>{const t=Wk(e);return jk(t,Hk)},qk=e=>{const t=Wk(e);return jk(t,Vk)},Yk=e=>{const t=Wk(e);return jk(t,Pk)},Xk=e=>{const t=Wk(e);return jk(t,"width")},Kk=e=>{const t=Wk(e);return jk(t,"height")},Jk=(e,t,o)=>(e+t)/2-o,Zk=(e,t)=>{const o=Wk(e),n=Wk(t),s=jk(o,Uk),r=jk(o,Hk),a=jk(n,Uk);return Jk(s,r,a)},Qk=(e,t)=>{const o=Wk(e),n=Wk(t),s=jk(o,Vk),r=jk(o,Pk),a=jk(n,Vk);return Jk(s,r,a)},eO=(e,t)=>{Nr(e,ik(),{value:t})},tO=(e,t,o)=>{const n={min:ck(t),max:gk(t),range:vk(t),value:o,step:Sk(t),snap:Ck(t),snapStart:kk(t),rounded:Ok(t),hasMinEdge:Tk(t),hasMaxEdge:Ek(t),minBound:Gk(e),maxBound:$k(e),screenRange:Xk(e)};return Lk(n)},oO=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?Rk:Fk)(Dk(o),ck(o),gk(o),Sk(o,n));return eO(t,s),A.some(s)})(e,t,o,n).map(E),nO=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=Xk(e),a=n.bind(t=>A.some(Zk(t,e))).getOr(0),i=s.bind(t=>A.some(Zk(t,e))).getOr(r),l={min:ck(t),max:gk(t),range:vk(t),value:o,hasMinEdge:Tk(t),hasMaxEdge:Ek(t),minBound:Gk(e),minOffset:0,maxBound:$k(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return zk(l)})(t,r,o,n,s);return Gk(t)-Gk(e)+a},sO=oO(-1),rO=oO(1),aO=A.none,iO=A.none,lO={"top-left":A.none(),top:A.none(),"top-right":A.none(),right:A.some((e,t)=>{Ik(e,hk(t))}),"bottom-right":A.none(),bottom:A.none(),"bottom-left":A.none(),left:A.some((e,t)=>{Ik(e,uk(t))})};var cO=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=tO(e,t,o);return eO(e,n),n},setToMin:(e,t)=>{const o=ck(t);eO(e,o)},setToMax:(e,t)=>{const o=gk(t);eO(e,o)},findValueOfOffset:tO,getValueFromEvent:e=>lk(e).map(e=>e.left),findPositionOfValue:nO,setPositionFromValue:(e,t,o,n)=>{const s=Dk(o),r=nO(e,n.getSpectrum(e),s,n.getLeftEdge(e),n.getRightEdge(e),o),a=Qt(t.element)/2;It(t.element,"left",r-a+"px")},onLeft:sO,onRight:rO,onUp:aO,onDown:iO,edgeActions:lO});const dO=(e,t)=>{Nr(e,ik(),{value:t})},uO=(e,t,o)=>{const n={min:dk(t),max:pk(t),range:yk(t),value:o,step:Sk(t),snap:Ck(t),snapStart:kk(t),rounded:Ok(t),hasMinEdge:Ak(t),hasMaxEdge:Mk(t),minBound:qk(e),maxBound:Yk(e),screenRange:Kk(e)};return Lk(n)},mO=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?Rk:Fk)(Dk(o),dk(o),pk(o),Sk(o,n));return dO(t,s),A.some(s)})(e,t,o,n).map(E),gO=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=Kk(e),a=n.bind(t=>A.some(Qk(t,e))).getOr(0),i=s.bind(t=>A.some(Qk(t,e))).getOr(r),l={min:dk(t),max:pk(t),range:yk(t),value:o,hasMinEdge:Ak(t),hasMaxEdge:Mk(t),minBound:qk(e),minOffset:0,maxBound:Yk(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return zk(l)})(t,r,o,n,s);return qk(t)-qk(e)+a},pO=A.none,hO=A.none,fO=mO(-1),bO=mO(1),vO={"top-left":A.none(),top:A.some((e,t)=>{Ik(e,mk(t))}),"top-right":A.none(),right:A.none(),"bottom-right":A.none(),bottom:A.some((e,t)=>{Ik(e,fk(t))}),"bottom-left":A.none(),left:A.none()};var yO=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=uO(e,t,o);return dO(e,n),n},setToMin:(e,t)=>{const o=dk(t);dO(e,o)},setToMax:(e,t)=>{const o=pk(t);dO(e,o)},findValueOfOffset:uO,getValueFromEvent:e=>lk(e).map(e=>e.top),findPositionOfValue:gO,setPositionFromValue:(e,t,o,n)=>{const s=Dk(o),r=gO(e,n.getSpectrum(e),s,n.getTopEdge(e),n.getBottomEdge(e),o),a=Gt(t.element)/2;It(t.element,"top",r-a+"px")},onLeft:pO,onRight:hO,onUp:fO,onDown:bO,edgeActions:vO});const xO=(e,t)=>{Nr(e,ik(),{value:t})},wO=(e,t)=>({x:e,y:t}),SO=(e,t)=>(o,n,s)=>((e,t,o,n,s)=>{const r=e>0?Rk:Fk,a=t?Dk(n).x:r(Dk(n).x,ck(n),gk(n),Sk(n,s)),i=t?r(Dk(n).y,dk(n),pk(n),Sk(n,s)):Dk(n).y;return xO(o,wO(a,i)),A.some(a)})(e,t,o,n,s).map(E),CO=SO(-1,!1),kO=SO(1,!1),OO=SO(-1,!0),_O=SO(1,!0),TO={"top-left":A.some((e,t)=>{Ik(e,Bk(uk(t),mk(t)))}),top:A.some((e,t)=>{Ik(e,Bk(xk(t),mk(t)))}),"top-right":A.some((e,t)=>{Ik(e,Bk(hk(t),mk(t)))}),right:A.some((e,t)=>{Ik(e,Bk(hk(t),wk(t)))}),"bottom-right":A.some((e,t)=>{Ik(e,Bk(hk(t),fk(t)))}),bottom:A.some((e,t)=>{Ik(e,Bk(xk(t),fk(t)))}),"bottom-left":A.some((e,t)=>{Ik(e,Bk(uk(t),fk(t)))}),left:A.some((e,t)=>{Ik(e,Bk(uk(t),wk(t)))})};var EO=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=tO(e,t,o.left),s=uO(e,t,o.top),r=wO(n,s);return xO(e,r),r},setToMin:(e,t)=>{const o=ck(t),n=dk(t);xO(e,wO(o,n))},setToMax:(e,t)=>{const o=gk(t),n=pk(t);xO(e,wO(o,n))},getValueFromEvent:e=>lk(e),setPositionFromValue:(e,t,o,n)=>{const s=Dk(o),r=nO(e,n.getSpectrum(e),s.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=gO(e,n.getSpectrum(e),s.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Qt(t.element)/2,l=Gt(t.element)/2;It(t.element,"left",r-i+"px"),It(t.element,"top",a-l+"px")},onLeft:CO,onRight:kO,onUp:OO,onDown:_O,edgeActions:TO});const AO=Sm({name:"Slider",configFields:[ws("stepSize",1),ws("speedMultiplier",10),ws("onChange",b),ws("onChoose",b),ws("onInit",b),ws("onDragStart",b),ws("onDragEnd",b),ws("snapToGrid",!1),ws("rounded",!0),gs("snapStart"),rs("model",Qn("mode",{x:[ws("minX",0),ws("maxX",100),os("value",e=>Ms(e.mode.minX)),ss("getInitialValue"),Hi("manager",cO)],y:[ws("minY",0),ws("maxY",100),os("value",e=>Ms(e.mode.minY)),ss("getInitialValue"),Hi("manager",yO)],xy:[ws("minX",0),ws("maxX",100),ws("minY",0),ws("maxY",100),os("value",e=>Ms({x:e.mode.minX,y:e.mode.minY})),ss("getInitialValue"),Hi("manager",EO)]})),xu("sliderBehaviours",[$p,yu]),os("mouseIsDown",()=>Ms(!1))],partFields:ak,factory:(e,t,o,n)=>{const s=t=>lm(t,e,"thumb"),r=t=>lm(t,e,"spectrum"),a=t=>im(t,e,"left-edge"),i=t=>im(t,e,"right-edge"),l=t=>im(t,e,"top-edge"),c=t=>im(t,e,"bottom-edge"),d=e.model,u=d.manager,m=(t,o)=>{u.setPositionFromValue(t,o,e,{getLeftEdge:a,getRightEdge:i,getTopEdge:l,getBottomEdge:c,getSpectrum:r})},g=(e,t)=>{d.value.set(t);const o=s(e);m(e,o)},p=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&im(t,e,"thumb").each(o=>{const n=d.value.get();e.onChoose(t,o,n)})},h=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,s(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,s(t)),p(t)},b=t=>{im(t,e,"spectrum").map($p.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.sliderBehaviours,[$p.config({mode:"special",focusIn:b}),yu.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),Fl.config({channels:{[ou()]:{onReceive:p}}})]),events:Pr([jr(ik(),(t,o)=>{((t,o)=>{g(t,o);const n=s(t);e.onChange(t,n,o),A.some(!0)})(t,o.event.value)}),Zr((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=s(t);m(t,a);const i=r(t);e.onInit(t,a,i,d.value.get())}),jr(Ps(),h),jr(Ws(),f),jr(Gs(),(e,t)=>{b(e),h(e,t)}),jr(Ys(),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)}}}),MO=da("rgb-hex-update"),DO=da("slider-update"),BO=da("palette-update"),IO="form",FO=[xu("formBehaviours",[yu])],RO=e=>"<alloy.field."+e+">",NO=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.formBehaviours,[yu.config({store:{mode:"manual",getValue:t=>{const o=dm(t,e);return ce(o,(e,t)=>e().bind(e=>{return o=_m.getCurrent(e),n=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+ra(e.element)),o.fold(()=>an.error(n),an.value);var o,n}).map(yu.getValue))},setValue:(t,o)=>{le(o,(o,n)=>{im(t,e,n).each(e=>{_m.getCurrent(e).each(e=>{yu.setValue(e,o)})})})}}})]),apis:{getField:(t,o)=>im(t,e,o).bind(_m.getCurrent)}}),LO={getField:_a((e,t,o)=>e.getField(t,o)),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),om(IO,RO(t),o)),record:x(e)}})(),o=e(t),n=t.record(),s=V(n,e=>qu({name:e,pname:RO(e)}));return bm(IO,FO,s,NO,o)}},zO=da("valid-input"),VO=da("invalid-input"),HO=da("validating-input"),PO="colorcustom.rgb.",UO=(e,t,o,n)=>{const s=(o,n)=>WC.config({invalidClass:t("invalid"),notify:{onValidate:e=>{Nr(e,HO,{type:o})},onValid:e=>{Nr(e,zO,{type:o,value:yu.getValue(e)})},onInvalid:e=>{Nr(e,VO,{type:o,value:yu.getValue(e)})}},validator:{validate:t=>{const o=yu.getValue(t),s=n(o)?an.value(!0):an.error(e("aria.input.invalid"));return OS(s)},validateOnLoad:!1}}),r=(o,n,r,a,i)=>{const l=e(PO+"range"),c=hC.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[ai(r)]}),d=hC.parts.field({data:i,factory:Pv,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:El([s(n,o),vC.config({})]),onSetValue:e=>{WC.isInvalid(e)&&WC.run(e).get(b)}}),u=[c,d],m="hex"!==n?[hC.parts["aria-descriptor"]({text:l})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:u.concat(m)}},a=(e,t)=>{const o=t.red,n=t.green,s=t.blue;yu.setValue(e,{red:o,green:n,blue:s})},i=Jh({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=(e,t)=>{i.getOpt(e).each(e=>{It(e.element,"background-color","#"+t.value)})},c=wm({factory:()=>{const s={red:Ms(A.some(255)),green:Ms(A.some(255)),blue:Ms(A.some(255)),hex:Ms(A.some("ffffff"))},c=e=>s[e].get(),d=(e,t)=>{s[e].set(t)},u=e=>{const t=e.red,o=e.green,n=e.blue;d("red",A.some(t)),d("green",A.some(o)),d("blue",A.some(n))},m=(e,t)=>{const o=t.event;"hex"!==o.type?d(o.type,A.none()):n(e)},g=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=Qx(t);d("hex",A.some(n.value));const s=pw(n);a(e,s),u(s),Nr(e,MO,{hex:n}),l(e,n)})(e,n.value):((e,t,o)=>{const n=parseInt(o,10);d(t,A.some(n)),c("red").bind(e=>c("green").bind(t=>c("blue").map(o=>uw(e,t,o,1)))).each(t=>{const o=((e,t)=>{const o=rw(t);return LO.getField(e,"hex").each(t=>{ih.isFocused(t)||yu.setValue(e,{hex:o.value})}),o})(e,t);Nr(e,MO,{hex:o}),l(e,o)})})(e,n.type,n.value)},p=t=>({label:e(PO+t+".label"),description:e(PO+t+".description")}),h=p("red"),f=p("green"),b=p("blue"),v=p("hex");return vn(LO.sketch(o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",hC.sketch(r(mw,"red",h.label,h.description,255))),o.field("green",hC.sketch(r(mw,"green",f.label,f.description,255))),o.field("blue",hC.sketch(r(mw,"blue",b.label,b.description,255))),o.field("hex",hC.sketch(r(ow,"hex",v.label,v.description,"ffffff"))),i.asSpec()],formBehaviours:El([WC.config({invalidClass:t("form-invalid")}),oh("rgb-form-events",[jr(zO,g),jr(VO,m),jr(HO,m)])])})),{apis:{updateHex:(e,t)=>{yu.setValue(e,{hex:t.value}),((e,t)=>{const o=pw(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},WO=(e,t)=>{const o=wm({name:"ColourPicker",configFields:[ss("dom"),ws("onValidHex",b),ws("onInvalidHex",b)],factory:o=>{const n=UO(e,t,o.onValidHex,o.onInvalidHex),s=((e,t)=>{const o=AO.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=AO.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:`<div class=${t("sv-palette-inner-thumb")} role="presentation"></div>`}}),s=(e,t)=>{const{width:o,height:n}=e,s=e.getContext("2d");if(null===s)return;s.fillStyle=t,s.fillRect(0,0,o,n);const r=s.createLinearGradient(0,0,o,0);r.addColorStop(0,"rgba(255,255,255,1)"),r.addColorStop(1,"rgba(255,255,255,0)"),s.fillStyle=r,s.fillRect(0,0,o,n);const a=s.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),s.fillStyle=a,s.fillRect(0,0,o,n)};return wm({factory:r=>{const a=x({x:0,y:0}),i=El([_m.config({find:A.some}),ih.config({})]);return AO.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)||Ot(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),Nr(t,BO,{value:n})},onInit:(e,t,o,n)=>{s(o.element.dom,bw(vw))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=Bw(t,100,100),r=gw(n);s(o,bw(r))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=Iw(pw(o));AO.setValue(t,{x:n.saturation,y:100-n.value}),Ot(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}})})(e,t),r={paletteRgba:Ms(vw),paletteHue:Ms(0)},a=Jh(((e,t)=>{const o=AO.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=AO.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return AO.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:El([ih.config({})]),onChange:(e,t,o)=>{Ot(e.element,"aria-valuenow",Math.floor(360-3.6*o)),Nr(e,DO,{value:o})}})})(0,t)),i=Jh(s.sketch({})),l=Jh(n.sketch({})),c=(e,t,o)=>{i.getOpt(e).each(e=>{s.setHue(e,o)})},d=(e,t)=>{l.getOpt(e).each(e=>{n.updateHex(e,t)})},u=(e,t,o)=>{a.getOpt(e).each(e=>{AO.setValue(e,(e=>100-e/360*100)(o))})},m=(e,t)=>{i.getOpt(e).each(e=>{s.setThumb(e,t)})},g=(e,t,o,n)=>{((e,t)=>{const o=pw(e);r.paletteRgba.set(o),r.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:El([oh("colour-picker-events",[jr(MO,(()=>{const e=[c,u,m];return(t,o)=>{const n=o.event.hex,s=(e=>Iw(pw(e)))(n);g(t,n,s.hue,e)}})()),jr(BO,(()=>{const e=[d];return(t,o)=>{const n=o.event.value,s=r.paletteHue.get(),a=Bw(s,n.x,100-n.y),i=Fw(a);g(t,i,s,e)}})()),jr(DO,(()=>{const e=[c,d];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),s=r.paletteRgba.get(),a=Iw(s),i=Bw(n,a.saturation,a.value),l=Fw(i);g(t,l,n,e)}})())]),_m.config({find:e=>l.getOpt(e)}),$p.config({mode:"acyclic"})])}}});return o},jO=()=>_m.config({find:A.some}),GO=e=>_m.config({find:t=>dt(t.element,e).bind(e=>t.getSystem().getByDom(e).toOptional())}),$O=In([ws("preprocess",w),ws("postprocess",w)]),qO=(e,t)=>{const o=Jn("RepresentingConfigs.memento processors",$O,t);return yu.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),s=yu.getValue(n);return o.postprocess(s)},setValue:(t,n)=>{const s=o.preprocess(n),r=e.get(t);yu.setValue(r,s)}}})},YO=(e,t,o)=>yu.config({store:{mode:"manual",...e.map(e=>({initialValue:e})).getOr({}),getValue:t,setValue:o}}),XO=(e,t,o)=>YO(e,e=>t(e.element),(e,t)=>o(e.element,t)),KO=e=>yu.config({store:{mode:"memory",initialValue:e}}),JO={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"};var ZO=tinymce.util.Tools.resolve("tinymce.Resource");const QO=e=>ve(e,"init");var e_=tinymce.util.Tools.resolve("tinymce.util.Tools");const t_=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...s)=>{n(),o=setTimeout(()=>{o=null,e.apply(null,s)},t)}}},o_=da("alloy-fake-before-tabstop"),n_=da("alloy-fake-after-tabstop"),s_=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:El([ih.config({ignore:!0}),vC.config({})])}),r_=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[s_([o_]),t,s_([n_])],behaviours:El([GO(1)])}),a_=(e,t)=>{Nr(e,Zs(),{raw:{which:9,shiftKey:t}})},i_=(e,t)=>{const o=t.element;qa(o,o_)?a_(e,!0):qa(o,n_)&&a_(e,!1)},l_=e=>tC(e,["."+o_,"."+n_].join(","),T),c_=da("update-dialog"),d_=da("update-title"),u_=da("update-body"),m_=da("update-footer"),g_=da("body-send-message"),p_=da("dialog-focus-shifted"),h_=Io().browser,f_=h_.isSafari(),b_=h_.isFirefox(),v_=f_||b_,y_=h_.isChromium(),x_=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,w_=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),S_=(e,t,o)=>{const n=e.dom;A.from(n.contentDocument).fold(o,e=>{let o=0;const s=((e,t)=>{const o=e.body;return A.from(!/^<!DOCTYPE (html|HTML)/.test(t)&&(!y_&&!f_||g(o)&&(0!==o.scrollTop||Math.abs(o.scrollHeight-o.clientHeight)>1))?o:e.documentElement)})(e,t).map(e=>(o=e.scrollTop,e)).forall(x_),r=()=>{const e=n.contentWindow;g(e)&&(s?w_(e,"bottom"):!s&&v_&&0!==o&&w_(e,o))};f_&&n.addEventListener("load",r,{once:!0}),e.open(),e.write(t),e.close(),f_||r()})},C_=ke(v_,f_?500:200).map(e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...s)=>{n=s,c(o)&&(o=setTimeout(()=>{const t=n;o=null,n=null,e.apply(null,t)},t))}}})(S_,e)),k_=da("toolbar.button.execute"),O_=da("common-button-display-events"),__={[gr()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[kr()]:["toolbar-button-events",O_],[Or()]:["toolbar-button-events","dropdown-events","tooltipping"],[Gs()]:["focusing","alloy.base.behaviour",O_]},T_=e=>It(e.element,"width",Nt(e.element,"width")),E_=(e,t,o)=>sb(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),A_=(e,t)=>E_(e,t,[]),M_=(e,t)=>E_(e,t,[th.config({})]),D_=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[ai(o.translate(e))],behaviours:El([th.config({})])}),B_=da("update-menu-text"),I_=da("update-menu-icon"),F_=(e,t,o,n)=>{const s=Ms(b),r=e.text.map(e=>Jh(D_(e,t,o.providers))),a=e.icon.map(e=>Jh(M_(e,o.providers.icons))),i=(e,t)=>{const o=yu.getValue(e);return ih.focus(o),Nr(o,"keydown",{raw:t.event.raw}),VS.close(o),A.some(!0)},l=e.role.fold(()=>({}),e=>({role:e})),c=e.ariaLabel.fold(()=>({}),e=>({"aria-label":o.providers.translate(e)})),d=sb("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),u=da("common-button-display-events"),m="dropdown-events",p=Jh(VS.sketch({...e.uid?{uid:e.uid}:{},...l,dom:{tag:"button",classes:[t,`${t}--select`].concat(V(e.classes,e=>`${t}--${e}`)),attributes:{...c,...g(n)?{"data-mce-name":n}:{}}},components:Lx([a.map(e=>e.asSpec()),r.map(e=>e.asSpec()),A.some(d)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{$v(e).each(e=>ih.focus(e))})(n)},dropdownBehaviours:El([...e.dropdownBehaviours,Ax(()=>e.disabled||o.providers.isDisabled()),Ex(),jC.config({}),th.config({}),...e.tooltip.map(e=>Cx.config(o.providers.tooltips.getConfig({tooltipText:o.providers.translate(e)}))).toArray(),oh(m,[Ix(e,s),Fx(e,s)]),oh(u,[Zr((e,t)=>T_(e))]),oh("menubutton-update-display-text",[jr(B_,(e,t)=>{r.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[ai(o.providers.translate(t.event.text))])})}),jr(I_,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[M_(t.event.icon,o.providers.icons)])})})])]),eventOrder:vn(__,{[Gs()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[kr()]:["toolbar-button-events",Cx.name(),m,u]}),sandboxBehaviours:El([$p.config({mode:"special",onLeft:i,onRight:i}),oh("dropdown-sandbox-events",[jr(Uv,(e,t)=>{(e=>{const t=yu.getValue(e),o=Gv(e).map(qv);VS.refetch(t).get(()=>{const e=yS.getCoupled(t,"sandbox");o.each(t=>Gv(e).each(e=>((e,t)=>{yu.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))})})(e),t.stop()}),jr(Wv,(e,t)=>{((e,t)=>{(e=>Qd.getState(e).bind(Km.getHighlighted).bind(Km.getHighlighted))(e).each(o=>{((e,t,o,n)=>{const s={...n,target:t};e.getSystem().triggerEvent(o,t,s)})(e,o.element,t.event.eventType,t.event.interactionEvent)})})(e,t),t.stop()})])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...Nv(0,e.columns,e.presets),fakeFocus:e.searchable,onHighlightItem:HS,onCollapseMenu:(e,t,o)=>{Km.getHighlighted(o).each(t=>{HS(e,o,t)})},onDehighlightItem:PS}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{gc()(e,t-10)}}),fetch:t=>kS(C(e.fetch,t))}));return p.asSpec()},R_=e=>"separator"===e.type,N_={type:"separator"},L_=(e,t)=>{const o=((e,t)=>{const o=j(e,(e,o)=>(e=>r(e))(o)?""===o?e:"|"===o?e.length>0&&!R_(e[e.length-1])?e.concat([N_]):e:ve(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o]),[]);return o.length>0&&R_(o[o.length-1])&&o.pop(),o})(r(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(()=>da("generated-menu-item"));return vn({value:t},e)})(o),s=((e,t)=>{const o=e.getSubmenuItems(),n=L_(o,t);return{item:e,menus:vn(n.menus,{[e.value]:n.items}),expansions:vn(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:vn(e.menus,s.menus),items:[s.item,...e.items],expansions:vn(e.expansions,s.expansions)}}return{...e,items:[o,...e.items]}},{menus:{},expansions:{},items:[]})},z_=(e,t,o,n)=>{const s=da("primary-menu"),r=L_(e,o.shared.providers.menuItems());if(0===r.items.length)return A.none();const a=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-field",placeholder:e.placeholder})))(n),i=$S(s,r.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-results"})))(n),c=ce(r.menus,(e,n)=>$S(n,e,t,o,!1,l)),d=vn(c,Bs(s,i));return A.from($h.tieredData(s,d,r.expansions))},V_=e=>!ve(e,"items"),H_="data-value",P_=(e,t,o,n)=>V(o,o=>V_(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{yu.setValue(e,o.value),Nr(e,kC,{name:t}),ih.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>P_(e,t,o.items,n)}),U_=(e,t)=>re(e,e=>V_(e)?ke(e.value===t,e):U_(e.items,t)),W_=wm({name:"HtmlSelect",configFields:[ss("options"),xu("selectBehaviours",[ih,yu]),ws("selectClasses",[]),ws("selectAttributes",{}),gs("data")],factory:(e,t)=>{const o=V(e.options,e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}})),n=e.data.map(e=>Bs("initialValue",e)).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:Su(e.selectBehaviours,[ih.config({}),yu.config({store:{mode:"manual",getValue:e=>Ja(e.element),setValue:(t,o)=>{const n=oe(e.options);G(e.options,e=>e.value===o).isSome()?Za(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each(e=>Za(t.element,e.value))},...n}})])}}}),j_=x([ws("field1Name","field1"),ws("field2Name","field2"),zi("onLockedChange"),Fi(["lockClass"]),ws("locked",!1),Cu("coupledFieldBehaviours",[_m,yu])]),G_=(e,t)=>qu({factory:hC,name:e,overrides:e=>({fieldBehaviours:El([oh("coupled-input-behaviour",[jr(er(),o=>{((e,t,o)=>im(e,t,o).bind(_m.getCurrent))(o,e,t).each(t=>{im(o,e,"lock").each(n=>{hh.isOn(n)&&e.onLockedChange(o,t,n)})})})])])})}),$_=x([G_("field1","field2"),G_("field2","field1"),qu({factory:Xh,schema:[ss("dom")],name:"lock",overrides:e=>({buttonBehaviours:El([hh.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),q_=Sm({name:"FormCoupledInputs",configFields:j_(),partFields:$_(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:ku(e.coupledFieldBehaviours,[_m.config({find:A.some}),yu.config({store:{mode:"manual",getValue:t=>{const o=mm(t,e,["field1","field2"]);return{[e.field1Name]:yu.getValue(o.field1()),[e.field2Name]:yu.getValue(o.field2())}},setValue:(t,o)=>{const n=mm(t,e,["field1","field2"]);ye(o,e.field1Name)&&yu.setValue(n.field1(),o[e.field1Name]),ye(o,e.field2Name)&&yu.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>im(t,e,"field1"),getField2:t=>im(t,e,"field2"),getLock:t=>im(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),Y_=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 an.value({value:e,unit:o})}return an.error(e)},X_=(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?A.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?A.some(e.value):A.some(e.value/o[e.unit]*o[t]):A.none()},K_=e=>A.none(),J_=(e,t)=>{const o=e.label.map(o=>CC(o,e.tooltip.getOr(""),t)),n=[Hm.config({disabled:()=>e.disabled||t.isDisabled()}),Ex(),$p.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Rr(e,EC),A.some(!0))}),oh("textfield-change",[jr(er(),(t,o)=>{Nr(t,kC,{name:e.name})}),jr(ur(),(t,o)=>{Nr(t,kC,{name:e.name})})]),vC.config({})],s=e.validation.map(e=>WC.config({getRoot:e=>it(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=yu.getValue(t),n=e.validator(o);return OS(!0===n?an.value(o):an.error(n))},validateOnLoad:e.validateOnLoad}})).toArray(),r={...e.placeholder.fold(x({}),e=>({placeholder:t.translate(e)})),...e.inputMode.fold(x({}),e=>({inputmode:e}))},a=hC.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map(e=>({data:e})).getOr({}),inputAttributes:r,inputClasses:[e.classname],inputBehaviours:El(q([n,s])),selectOnFocus:!1,factory:Pv}),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=[Hm.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{hC.getField(e).each(Hm.disable)},onEnabled:e=>{hC.getField(e).each(Hm.enable)}}),Ex()];return xC(o,i,l,c)},Z_=(e,t)=>t.getAnimationRoot.fold(()=>e.element,t=>t(e)),Q_=e=>e.dimension.property,eT=(e,t)=>e.dimension.getDimension(t),tT=(e,t)=>{const o=Z_(e,t);Xa(o,[t.shrinkingClass,t.growingClass])},oT=(e,t)=>{$a(e.element,t.openClass),ja(e.element,t.closedClass),It(e.element,Q_(t),"0px"),Ut(e.element)},nT=(e,t)=>{$a(e.element,t.closedClass),ja(e.element,t.openClass),Pt(e.element,Q_(t))},sT=(e,t,o,n)=>{o.setCollapsed(),It(e.element,Q_(t),eT(t,e.element)),tT(e,t),oT(e,t),t.onStartShrink(e),t.onShrunk(e)},rT=(e,t,o,n)=>{const s=n.getOrThunk(()=>eT(t,e.element));o.setCollapsed(),It(e.element,Q_(t),s),Ut(e.element);const r=Z_(e,t);$a(r,t.growingClass),ja(r,t.shrinkingClass),oT(e,t),t.onStartShrink(e)},aT=(e,t,o)=>{const n=eT(t,e.element);("0px"===n?sT:rT)(e,t,o,A.some(n))},iT=(e,t,o)=>{const n=Z_(e,t),s=qa(n,t.shrinkingClass),r=eT(t,e.element);nT(e,t);const a=eT(t,e.element);(s?()=>{It(e.element,Q_(t),r),Ut(e.element)}:()=>{oT(e,t)})(),$a(n,t.shrinkingClass),ja(n,t.growingClass),nT(e,t),It(e.element,Q_(t),a),o.setExpanded(),t.onStartGrow(e)},lT=(e,t,o)=>{const n=Z_(e,t);return!0===qa(n,t.growingClass)},cT=(e,t,o)=>{const n=Z_(e,t);return!0===qa(n,t.shrinkingClass)};var dT=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){Pt(e.element,Q_(t));const o=eT(t,e.element);It(e.element,Q_(t),o)}},grow:(e,t,o)=>{o.isExpanded()||iT(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&aT(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&sT(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:lT,isShrinking:cT,isTransitioning:(e,t,o)=>lT(e,t)||cT(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?aT:iT)(e,t,o)},disableTransitions:tT,immediateGrow:(e,t,o)=>{o.isExpanded()||(nT(e,t),It(e.element,Q_(t),eT(t,e.element)),tT(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}}),uT=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return Ma(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:Bs(t.dimension.property,"0px")})},events:(e,t)=>Pr([Jr(sr(),(o,n)=>{n.event.raw.propertyName===e.dimension.property&&(tT(o,e),t.isExpanded()&&Pt(o.element,e.dimension.property),(t.isExpanded()?e.onGrown:e.onShrunk)(o))})])}),mT=[ss("closedClass"),ss("openClass"),ss("shrinkingClass"),ss("growingClass"),gs("getAnimationRoot"),Ni("onShrunk"),Ni("onStartShrink"),Ni("onGrown"),Ni("onStartGrow"),ws("expanded",!1),rs("dimension",Qn("property",{width:[Hi("property","width"),Hi("getDimension",e=>Qt(e)+"px")],height:[Hi("property","height"),Hi("getDimension",e=>Gt(e)+"px")]}))];const gT=Ml({fields:mT,name:"sliding",active:uT,apis:dT,state:Object.freeze({__proto__:null,init:e=>{const t=Ms(e.expanded);return Ea({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:C(t.set,!1),setExpanded:C(t.set,!0),readState:()=>"expanded: "+t.get()})}})}),pT=e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setActive:t=>{const o=e.element;t?(ja(o,"tox-tbtn--enabled"),Ot(o,"aria-pressed",!0)):($a(o,"tox-tbtn--enabled"),Mt(o,"aria-pressed"))},isActive:()=>qa(e.element,"tox-tbtn--enabled"),setText:t=>{Nr(e,B_,{text:t})},setIcon:t=>Nr(e,I_,{icon:t})}),hT=(e,t,o,n,s=!0,r)=>F_({text:e.text,icon:e.icon,tooltip:e.tooltip,ariaLabel:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const s={pattern:e.search.isSome()?US(t):""};e.fetch(t=>{n(z_(t,vv.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))},s,pT(t))},onSetup:e.onSetup,getApi:pT,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...s?[vC.config({})]:[]]},t,o.shared,r),fT=(e,t,o)=>{const n=e=>n=>{const s=!n.isActive();n.setActive(s),e.storage.set(s),o.shared.getSink().each(o=>{t().getOpt(o).each(t=>{Nl(t.element),Nr(t,TC,{name:e.name,value:e.storage.get()})})})},s=e=>t=>{t.setActive(e.storage.get())};return t=>{t(V(e,e=>{const t=e.text.fold(()=>({}),e=>({text:e}));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:s(e)}}))}},bT=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":e}},components:[ai(e)]}),vT=da("leaf-label-event-id"),yT=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:s,backstage:r})=>{const a=e.menu.map(e=>hT(e,"tox-mbtn",r,A.none(),o)),i=[bT(e.title)];return a.each(e=>i.push(e)),Xh.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:{[Zs()]:[vT,"keying"]},buttonBehaviours:El([...o?[vC.config({})]:[],hh.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),Fl.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?hh.on:hh.off)(t)}}}}),oh(vT,[Zr((t,o)=>{s.each(o=>{(o===e.id?hh.on:hh.off)(t)})}),jr(Zs(),(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=>{vi(t,".tox-tree--directory__label").each(t=>{e.getSystem().getByDom(t).each(ih.focus)})})}),t.stop()):n&&t.stop()})])])})},xT=da("directory-label-event-id"),wT=({directory:e,visible:t,noChildren:o,backstage:n})=>{const s=e.menu.map(e=>hT(e,"tox-mbtn",n,A.none())),r=[{dom:{tag:"div",classes:["tox-chevron"]},components:[(a="chevron-right",i=n.shared.providers.icons,((e,t)=>sb(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:[]},t))(a,i))]},bT(e.title)];var a,i;s.each(e=>{r.push(e)});const l=t=>{bi(t.element,".tox-tree--directory").each(o=>{t.getSystem().getByDom(o).each(o=>{const n=!hh.isOn(o);hh.toggle(o),Nr(t,"expand-tree-node",{expanded:n,node:e.id})})})};return Xh.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:r,action:l,eventOrder:{[Zs()]:[xT,"keying"]},buttonBehaviours:El([...t?[vC.config({})]:[],oh(xT,[jr(Zs(),(e,t)=>{const n="ArrowRight"===t.event.raw.code,s="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||s)&&bi(e.element,".tox-tree--directory").each(o=>{e.getSystem().getByDom(o).each(o=>{!hh.isOn(o)&&n||hh.isOn(o)&&s?(l(e),t.stop()):s&&!hh.isOn(o)&&(bi(o.element,".tox-tree--directory").each(e=>{vi(e,".tox-tree--directory__label").each(e=>{o.getSystem().getByDom(e).each(ih.focus)})}),t.stop())})})})])])})},ST=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:s,selectedId:r,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map(e=>"leaf"===e.type?yT({leaf:e,selectedId:r,onLeafAction:t,visible:o,treeId:n,backstage:a}):kT({directory:e,expandedIds:s,selectedId:r,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a})),behaviours:El([gT.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}),th.config({})])}),CT=da("directory-event-id"),kT=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:s,expandedIds:r,selectedId:a})=>{const{children:i}=e,l=Ms(r),c=r.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[wT({directory:e,visible:o,noChildren:0===e.children.length,backstage:s}),ST({children:i,expandedIds:r,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:s})],behaviours:El([oh(CT,[Zr((e,t)=>{hh.set(e,c)}),jr("expand-tree-node",(e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter(e=>e!==n))})]),hh.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const r=e.components()[1],c=(d=o,i.map(e=>"leaf"===e.type?yT({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:s}):kT({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:s})));var d;o?gT.grow(r):gT.shrink(r),th.set(r,c)}})])}},OT=da("tree-event-id");var _T=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Pr([jr(e.event,o),Qr(()=>t.cancel())].concat(e.cancelEvent.map(e=>[jr(e,()=>t.cancel())]).getOr([])))}});const TT=e=>{const t=Ms(null);return Ea({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var ET=Object.freeze({__proto__:null,throttle:TT,init:e=>e.stream.streams.state(e)}),AT=[rs("stream",Qn("mode",{throttle:[ss("delay"),ws("stopEvent",!0),Hi("streams",{setup:(e,t)=>{const o=e.stream,n=t_(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:TT})]})),ws("event","input"),gs("cancelEvent"),zi("onStream")];const MT=Ml({fields:AT,name:"streaming",active:_T,state:ET}),DT=(e,t,o)=>{const n=yu.getValue(o);yu.setValue(t,n),IT(t)},BT=(e,t)=>{const o=e.element,n=Ja(o),s=o.dom;"number"!==Tt(o,"type")&&t(s,n)},IT=e=>{BT(e,(e,t)=>e.setSelectionRange(t.length,t.length))},FT=x("alloy.typeahead.itemexecute"),RT=x([gs("lazySink"),ss("fetch"),ws("minChars",5),ws("responseTime",1e3),Ni("onOpen"),ws("getHotspot",A.some),ws("getAnchorOverrides",x({})),ws("layouts",A.none()),ws("eventOrder",{}),As("model",{},[ws("getDisplayText",e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value),ws("selectsOver",!0),ws("populateFromBrowse",!0)]),Ni("onSetValue"),Li("onExecute"),Ni("onItemExecute"),ws("inputClasses",[]),ws("inputAttributes",{}),ws("inputStyles",{}),ws("matchWidth",!0),ws("useMinWidth",!1),ws("dismissOnBlur",!0),Fi(["openClass"]),gs("initialData"),xu("typeaheadBehaviours",[ih,yu,MT,$p,hh,yS]),os("lazyTypeaheadComp",()=>Ms(A.none)),os("previewing",()=>Ms(!0))].concat(Lv()).concat(NS())),NT=x([Yu({schema:[Ii()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each(t=>{((e,t,o)=>{if(e.selectsOver){const n=yu.getValue(t),s=e.getDisplayText(n),r=yu.getValue(o);return 0===e.getDisplayText(r).indexOf(s)?A.some(()=>{DT(0,t,o),((e,t)=>{BT(e,(e,o)=>e.setSelectionRange(t,o.length))})(t,s.length)}):A.none()}return A.none()})(e.model,t,n).fold(()=>{e.model.selectsOver?(Km.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&&DT(e.model,t,n),Et(n.element,"id").each(e=>Ot(t.element,"aria-activedescendant",e))})},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map(e=>(Nr(e,FT(),{item:o}),!0)),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each(t=>{e.model.populateFromBrowse&&DT(e.model,t,o)})}})})]),LT=Sm({name:"Typeahead",configFields:RT(),partFields:NT(),factory:(e,t,o,n)=>{const s=(t,o,s)=>{e.previewing.set(!1);const r=yS.getCoupled(t,"sandbox");if(Qd.isOpen(r))_m.getCurrent(r).each(e=>{Km.getHighlighted(e).fold(()=>{s(e)},()=>{Hr(r,e.element,"keydown",o)})});else{const o=e=>{_m.getCurrent(e).each(s)};AS(e,a(t),t,r,n,o,jh.HighlightMenuAndItem).get(b)}},r=zv(e),a=e=>t=>t.map(t=>{const o=fe(t.menus),n=Y(o,e=>U(e.items,e=>"item"===e.type));return yu.getState(e).update(V(n,e=>e.data)),t}),i=e=>_m.getCurrent(e),l="typeaheadevents",c=[ih.config({}),yu.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>Ja(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{Za(t.element,e.model.getDisplayText(o))},...e.initialData.map(e=>Bs("initialValue",e)).getOr({})}}),MT.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const s=yS.getCoupled(t,"sandbox");if(ih.isFocused(t)&&Ja(t.element).length>=e.minChars){const o=i(s).bind(e=>Km.getHighlighted(e).map(yu.getValue));e.previewing.set(!0);const r=t=>{i(s).each(t=>{o.fold(()=>{e.model.selectsOver&&Km.highlightFirst(t)},e=>{Km.highlightBy(t,t=>yu.getValue(t).value===e.value),Km.getHighlighted(t).orThunk(()=>(Km.highlightFirst(t),A.none()))})})};AS(e,a(t),t,s,n,r,jh.HighlightJustMenu).get(b)}},cancelEvent:vr()}),$p.config({mode:"special",onDown:(e,t)=>(s(e,t,Km.highlightFirst),A.some(!0)),onEscape:e=>{const t=yS.getCoupled(e,"sandbox");return Qd.isOpen(t)?(Qd.close(t),A.some(!0)):A.none()},onUp:(e,t)=>(s(e,t,Km.highlightLast),A.some(!0)),onEnter:t=>{const o=yS.getCoupled(t,"sandbox"),n=Qd.isOpen(o);if(n&&!e.previewing.get())return i(o).bind(e=>Km.getHighlighted(e)).map(e=>(Nr(t,FT(),{item:e}),!0));{const s=yu.getValue(t);return Rr(t,vr()),e.onExecute(o,t,s),n&&Qd.close(o),A.some(!0)}}}),hh.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),yS.config({others:{sandbox:t=>FS(e,t,{onOpen:()=>hh.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each(e=>Mt(e.element,"aria-activedescendant")),hh.off(t)}})}}),oh(l,[Zr(t=>{e.lazyTypeaheadComp.set(A.some(t))}),Qr(t=>{e.lazyTypeaheadComp.set(A.none())}),ta(t=>{const o=b;DS(e,a(t),t,n,o,jh.HighlightMenuAndItem).get(b)}),jr(FT(),(t,o)=>{const n=yS.getCoupled(t,"sandbox");DT(e.model,t,o.event.item),Rr(t,vr()),e.onItemExecute(t,n,o.event.item,yu.getValue(t)),Qd.close(n),IT(t)})].concat(e.dismissOnBlur?[jr(dr(),e=>{const t=yS.getCoupled(e,"sandbox");Hl(t.element).isNone()&&Qd.close(t)})]:[]))],d={[Or()]:[yu.name(),MT.name(),l],...e.eventOrder};return{uid:e.uid,dom:Hv(vn(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...r,...Su(e.typeaheadBehaviours,c)},eventOrder:d}}}),zT=e=>({...e,toCached:()=>zT(e.toCached()),bindFuture:t=>zT(e.bind(e=>e.fold(e=>OS(an.error(e)),e=>t(e)))),bindResult:t=>zT(e.map(e=>e.bind(t))),mapResult:t=>zT(e.map(e=>e.map(t))),mapError:t=>zT(e.map(e=>e.mapError(t))),foldResult:(t,o)=>e.map(e=>e.fold(t,o)),withTimeout:(t,o)=>zT(kS(n=>{let s=!1;const r=setTimeout(()=>{s=!0,n(an.error(o()))},t);e.get(e=>{s||(clearTimeout(r),n(e))})}))}),VT=e=>zT(kS(e)),HT=(e,t,o=[],n,s,r,a)=>{const i=t.fold(()=>({}),e=>({action:e})),l={buttonBehaviours:El([Ax(()=>!e.enabled||a.isDisabled()),Ex(),vC.config({}),...r.map(e=>Cx.config(a.tooltips.getConfig({tooltipText:a.translate(e)}))).toArray(),oh("button press",[Wr("click"),Wr("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...i},c=vn(l,{dom:n});return vn(c,{components:s})},PT=(e,t,o,n=[],s)=>{const r={tag:"button",classes:["tox-tbtn"],attributes:{...e.tooltip.map(e=>({"aria-label":o.translate(e)})).getOr({}),"data-mce-name":s}},a=e.icon.map(e=>A_(e,o.icons)),i=Lx([a]);return HT(e,t,n,r,i,e.tooltip,o)},UT=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},WT=(e,t,o,n=[],s=[])=>{const r=o.translate(e.text),a=e.icon.map(e=>A_(e,o.icons)),i=[a.getOrThunk(()=>ai(r))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c={tag:"button",classes:[...UT(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...s],attributes:{"aria-label":r,"data-mce-name":e.text}},d=e.icon.map(x(r));return HT(e,t,n,c,i,d,o)},jT=(e,t,o,n=[],s=[])=>{const r=WT(e,A.some(t),o,n,s);return Xh.sketch(r)},GT=(e,t)=>o=>{"custom"===t?Nr(o,TC,{name:e,value:{}}):"submit"===t?Rr(o,EC):"cancel"===t?Rr(o,_C):console.error("Unknown button type: ",t)},$T=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>r,n=e,s={...e,type:"menubutton",search:A.none(),onSetup:t=>(t.setEnabled(e.enabled),b),fetch:fT(n.items,t,o)},r=Jh(hT(s,"tox-tbtn",o,A.none(),!0,e.text.or(e.tooltip).getOrUndefined()));return r.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=GT(e.name,t),s={...e,borderless:!1};return jT(s,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t,o)=>{var n,s;const r=e.icon.map(e=>M_(e,t.icons)).map(Jh),a=e.buttonType.getOr(e.primary?"primary":"secondary"),i={...e,name:null!==(n=e.name)&&void 0!==n?n:"",primary:"primary"===a,tooltip:e.tooltip,enabled:null!==(s=e.enabled)&&void 0!==s&&s,borderless:!1},l=i.tooltip.map(e=>({"aria-label":t.translate(e)})).getOr({}),c=UT(null!=a?a:"secondary"),d=e.icon.isSome()&&e.text.isSome(),u={tag:"button",classes:[...c.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...d?["tox-button--icon-and-text"]:[]],attributes:{...l,...g(o)?{"data-mce-name":o}:{}}},m=t.translate(e.text.getOr("")),p=ai(m),h=[...Lx([r.map(e=>e.asSpec())]),...e.text.isSome()?[p]:[]],f=HT(i,A.some(o=>{Nr(o,TC,{name:e.name,value:{setIcon:e=>{r.map(n=>n.getOpt(o).each(o=>{th.set(o,[M_(e,t.icons)])}))}}})}),[],u,h,e.tooltip,t);return Xh.sketch(f)})(e,o.shared.providers,e.text.or(e.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},qT={type:"separator"},YT=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:b}),XT=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:b}),KT=(e,t)=>(e=>V(e,YT))(((e,t)=>U(t,t=>t.type===e))(e,t)),JT=e=>KT("header",e.targets),ZT=e=>KT("anchor",e.targets),QT=e=>A.from(e.anchorTop).map(e=>XT("<top>",e)).toArray(),eE=e=>A.from(e.anchorBottom).map(e=>XT("<bottom>",e)).toArray(),tE=(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,s=null!==(t=e.value)&&void 0!==t?t:"";return Te(n.toLowerCase(),o)||Te(s.toLowerCase(),o)})},oE=da("aria-invalid"),nE=(e,t)=>{e.dom.checked=t},sE=e=>e.dom.checked,rE=e=>(t,o,n,s)=>be(o,"name").fold(()=>e(o,s,A.none()),r=>t.field(r,e(o,s,be(n,r)))),aE={bar:rE((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:V(e.items,t.interpreter)}))(e,t.shared)),collection:rE((e,t,o)=>IC(e,t.shared.providers,o)),alertbanner:rE((e,t)=>((e,t)=>{const o=tb(e.icon,t.icons);return uC.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?[Xh.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>Nr(t,TC,{name:"alert-banner",value:e.url}),buttonBehaviours:El([ob()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers)),input:rE((e,t,o)=>((e,t,o)=>J_({name:e.name,multiline:!1,label:e.label,tooltip:e.tooltip,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o)),textarea:rE((e,t,o)=>((e,t,o)=>J_({name:e.name,multiline:!0,label:e.label,tooltip:e.tooltip,inputMode:A.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o)),label:rE((e,t)=>((e,t)=>{const o="tox-label",n={dom:{tag:"label",classes:[o,..."center"===e.align?[`${o}--center`]:[],..."end"===e.align?[`${o}--end`]:[]]},components:[ai(t.providers.translate(e.label))]};return e.tooltip&&""!==e.tooltip.getOr("")?{dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__label-container"]},components:[n,{dom:{tag:"div",classes:["tox-label-tooltip"]},components:[sb("tooltip",{tag:"span",classes:["tox-icon","tox-label-tooltip-icon"]},t.providers.icons)],behaviours:El([Cx.config(t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e.tooltip.getOr(""))}))])}]},...V(e.items,t.interpreter)],behaviours:El([jO(),th.config({}),(s=A.none(),XO(s,oa,na)),$p.config({mode:"acyclic"})])}:n;var s})(e,t.shared)),iframe:(IA=(e,t,o)=>((e,t,o)=>{const n="tox-dialog__iframe",s=e.transparent?[]:[`${n}--opaque`],r=e.border?["tox-navobj-bordered"]:[],a={...e.label.map(e=>({title:e})).getOr({}),...o.map(e=>({srcdoc:e})).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},i=((e,t)=>{const o=Ms(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,s=()=>Ot(o,"srcdoc",n);t?C_.fold(x(S_),e=>e.throttle)(o,n,s):s()}o.set(n)}}})(o,e.streamContent),l=e.label.map(o=>CC(o,e.tooltip.getOr(""),t)),c=hC.parts.field({factory:{sketch:e=>r_(A.from(r),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...s]},behaviours:El([vC.config({}),ih.config({}),YO(o,i.getValue,i.setValue),Fl.config({channels:{[p_]:{onReceive:(e,t)=>{t.newFocus.each(t=>{it(e.element).each(o=>{(et(e.element,t)?ja:$a)(o,"tox-navobj-bordered-focus")})})}}}})])})}});return xC(l,c,["tox-form__group--stretched"],[])})(e,t.shared.providers,o),(e,t,o,n)=>{const s=vn(t,{source:"dynamic"});return rE(IA)(e,s,o,n)}),button:rE((e,t)=>((e,t)=>{const o=GT(e.name,"custom");return n=A.none(),s=hC.parts.field({factory:Xh,...WT(e,A.some(o),t,[KO(""),jO()])}),xC(n,s,[],[]);var n,s})(e,t.shared.providers)),checkbox:rE((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),A.some(!0)),s=hC.parts.field({factory:{sketch:w},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:El([jO(),Hm.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{it(e.element).each(e=>ja(e,"tox-checkbox--disabled"))},onEnabled:e=>{it(e.element).each(e=>$a(e,"tox-checkbox--disabled"))}}),vC.config({}),ih.config({}),XO(o,sE,nE),$p.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),oh("checkbox-events",[jr(tr(),(t,o)=>{Nr(t,kC,{name:e.name})})])])}),r=hC.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[ai(t.translate(e.label))],behaviours:El([jC.config({})])}),a=e=>sb("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=Jh({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return hC.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[s,i.asSpec(),r],fieldBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),Ex()])})})(e,t.shared.providers,o)),colorinput:rE((e,t,o)=>((e,t,o,n)=>{const s=hC.parts.field({factory:Pv,inputClasses:["tox-textfield"],data:n,onSetValue:e=>WC.run(e).get(b),inputBehaviours:El([Hm.config({disabled:t.providers.isDisabled}),Ex(),vC.config({}),WC.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>it(e.element),notify:{onValid:e=>{const t=yu.getValue(e);Nr(e,GC,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=yu.getValue(e);if(0===t.length)return OS(an.value(!0));{const e=Ne("span");It(e,"background-color",t);const o=zt(e,"background-color").fold(()=>an.error("blah"),e=>an.value(t));return OS(o)}}}})]),selectOnFocus:!1}),r=e.label.map(o=>CC(o,e.tooltip.getOr(""),t.providers)),a=(e,t)=>{Nr(e,$C,{value:t})},i=Jh(((e,t)=>VS.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:El([Ax(t.providers.isDisabled),Ex(),jC.config({}),vC.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>kS(t=>e.fetch(t)).map(n=>A.from(qS(vn(aS(da("menu-value"),n,t=>{e.onItemAction(o,t)},e.columns,e.presets,vv.CLOSE_ON_EXECUTE,T,t.providers),{movement:lS(e.columns,e.presets)})))),parts:{menu:Nv(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[dl,cl,pl],onLtr:()=>[cl,dl,pl]},components:[],fetch:Zw(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(()=>Rr(t,qC),o=>{a(t,o),Dw(e.storageKey,o)})},"#ffffff"):a(t,"remove"===n?"":n)})}},t));return hC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:r.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[s,i.asSpec()]}]),fieldBehaviours:El([oh("form-field-events",[jr(GC,(t,o)=>{i.getOpt(t).each(e=>{It(e.element,"background-color",o.event.color)}),Nr(t,kC,{name:e.name})}),jr($C,(e,t)=>{hC.getField(e).each(o=>{yu.setValue(o,t.event.value),_m.getCurrent(e).each(ih.focus)})}),jr(qC,(e,t)=>{hC.getField(e).each(t=>{_m.getCurrent(e).each(ih.focus)})})])])})})(e,t.shared,t.colorinput,o)),colorpicker:rE((e,t,o)=>((e,t,o)=>{const n=e=>"tox-"+e,s=WO((e=>t=>r(t)?e.translate(JO[t]):e.translate(t))(t),n),a=Jh(s.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{Nr(e,TC,{name:"hex-valid",value:!0})},onInvalidHex:e=>{Nr(e,TC,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:El([YO(o,e=>{const t=a.get(e);return _m.getCurrent(t).bind(e=>yu.getValue(e).hex).map(e=>"#"+_e(e,"#")).getOr("")},(e,t)=>{const o=A.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind(e=>te(e,1)),n=a.get(e);_m.getCurrent(n).fold(()=>{console.log("Can not find form")},e=>{yu.setValue(e,{hex:o.getOr("")}),LO.getField(e,"hex").each(e=>{Rr(e,er())})})}),jO()])}})(0,t.shared.providers,o)),dropzone:rE((e,t,o)=>((e,t,o)=>{const n=(e,t)=>{t.stop()},s=e=>(t,o)=>{H(e,e=>{e(t,o)})},r=(e,t)=>{var o;if(!Hm.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&&(yu.setValue(o,((e,t)=>{const o=e_.explode(t.getOption("images_file_types"));return U(se(e),e=>N(o,t=>Ae(e.name.toLowerCase(),`.${t.toLowerCase()}`)))})(n,t)),Nr(o,kC,{name:e.name}))},l=Jh({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:El([oh("input-file-events",[Xr(or()),Xr(hr())])])}),c=e.label.map(o=>CC(o,e.tooltip.getOr(""),t)),d=hC.parts.field({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:El([KO(o.getOr([])),jO(),Hm.config({}),hh.config({toggleClass:"dragenter",toggleOnExecute:!1}),oh("dropzone-events",[jr("dragenter",s([n,hh.toggle])),jr("dragleave",s([n,hh.toggle])),jr("dragover",n),jr("drop",s([n,r])),jr(tr(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[ai(t.translate("Drop an image here"))]},Xh.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[ai(t.translate("Browse for an image")),l.asSpec()],action:e=>{l.get(e).element.dom.click()},buttonBehaviours:El([vC.config({}),Ax(t.isDisabled),Ex()])})]}]})}});return xC(c,d,["tox-form__group--stretched"],[])})(e,t.shared.providers,o)),grid:rE((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:V(e.items,t.interpreter)}))(e,t.shared)),listbox:rE((e,t,o)=>((e,t,o)=>{const n=t.shared.providers,s=o.bind(t=>U_(e.items,t)).orThunk(()=>oe(e.items).filter(V_)),r=e.label.map(t=>CC(t,e.tooltip.getOr(""),n)),a=hC.parts.field({dom:{},factory:{sketch:o=>F_({uid:o.uid,text:s.map(e=>e.text),icon:A.none(),tooltip:A.none(),role:A.none(),ariaLabel:e.label,fetch:(o,n)=>{const s=P_(o,e.name,e.items,yu.getValue(o));n(z_(s,vv.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:A.none()}))},onSetup:x(b),getApi:x({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[vC.config({}),YO(s.map(e=>e.value),e=>Tt(e.element,H_),(t,o)=>{U_(e.items,o).each(e=>{Ot(t.element,H_,e.value),Nr(t,B_,{text:e.text})})})]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return hC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([r.toArray(),[i]]),fieldBehaviours:El([Hm.config({disabled:x(!e.enabled),onDisabled:e=>{hC.getField(e).each(Hm.disable)},onEnabled:e=>{hC.getField(e).each(Hm.enable)}})])})})(e,t,o)),selectbox:rE((e,t,o)=>((e,t,o)=>{const n=V(e.items,e=>({text:t.translate(e.text),value:e.value})),s=e.label.map(o=>CC(o,e.tooltip.getOr(""),t)),r=hC.parts.field({dom:{},...o.map(e=>({data:e})).getOr({}),selectAttributes:{size:e.size},options:n,factory:W_,selectBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),vC.config({}),oh("selectbox-change",[jr(tr(),(t,o)=>{Nr(t,kC,{name:e.name})})])])}),a=e.size>1?A.none():A.some(sb("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:q([[r],a.toArray()])};return hC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([s.toArray(),[i]]),fieldBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{hC.getField(e).each(Hm.disable)},onEnabled:e=>{hC.getField(e).each(Hm.enable)}}),Ex()])})})(e,t.shared.providers,o)),sizeinput:rE((e,t)=>((e,t)=>{let o=K_;const n=da("ratio-event"),s=e=>sb(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),r=e.label.getOr("Constrain proportions"),a=t.translate(r),i=q_.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":a,"data-mce-name":r}},components:[s("lock"),s("unlock")],buttonBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),Ex(),vC.config({}),Cx.config(t.tooltips.getConfig({tooltipText:a}))])}),l=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),c=o=>hC.parts.field({factory:Pv,inputClasses:["tox-textfield"],inputBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),Ex(),vC.config({}),oh("size-input-events",[jr(Ks(),(e,t)=>{Nr(e,n,{isField1:o})}),jr(tr(),(t,o)=>{Nr(t,kC,{name:e.name})})])]),selectOnFocus:!1}),d=e=>({dom:{tag:"label",classes:["tox-label"]},components:[ai(t.translate(e))]}),u=q_.parts.field1(l([hC.parts.label(d("Width")),c(!0)])),m=q_.parts.field2(l([hC.parts.label(d("Height")),c(!1)]));return q_.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[u,m,l([d("\xa0"),i])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{Y_(yu.getValue(e)).each(e=>{o(e).each(e=>{yu.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:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{q_.getField1(e).bind(hC.getField).each(Hm.disable),q_.getField2(e).bind(hC.getField).each(Hm.disable),q_.getLock(e).each(Hm.disable)},onEnabled:e=>{q_.getField1(e).bind(hC.getField).each(Hm.enable),q_.getField2(e).bind(hC.getField).each(Hm.enable),q_.getLock(e).each(Hm.enable)}}),Ex(),oh("size-input-events2",[jr(n,(e,t)=>{const n=t.event.isField1,s=n?q_.getField1(e):q_.getField2(e),r=n?q_.getField2(e):q_.getField1(e),a=s.map(yu.getValue).getOr(""),i=r.map(yu.getValue).getOr("");o=((e,t)=>{const o=Y_(e).toOptional(),n=Y_(t).toOptional();return Se(o,n,(e,t)=>X_(e,t.unit).map(e=>t.value/e).map(e=>{return o=e,n=t.unit,e=>X_(e,n).map(e=>({value:e*o,unit:n}));var o,n}).getOr(K_)).getOr(K_)})(a,i)})])])})})(e,t.shared.providers)),slider:rE((e,t,o)=>((e,t,o)=>{const n=AO.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[ai(t.translate(e.label))]}),s=AO.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),r=AO.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return AO.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:x(o.getOrThunk(()=>(Math.abs(e.max)-Math.abs(e.min))/2))},components:[n,s,r],sliderBehaviours:El([jO(),ih.config({})]),onChoose:(t,o,n)=>{Nr(t,kC,{name:e.name,value:n})}})})(e,t.shared.providers,o)),urlinput:rE((e,t,o)=>((e,t,o,n)=>{const s=t.shared.providers,r=t=>{const n=yu.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":oE,type:"url"},minChars:0,responseTime:0,fetch:n=>{const s=((e,t,o)=>{var n,s;const r=yu.getValue(t),a=null!==(s=null===(n=null==r?void 0:r.meta)||void 0===n?void 0:n.text)&&void 0!==s?s:r.value;return o.getLinkInformation().fold(()=>[],t=>{const n=tE(a,(e=>V(e,e=>XT(e,e)))(o.getHistory(e)));return"file"===e?(s=[n,tE(a,JT(t)),tE(a,q([QT(t),ZT(t),eE(t)]))],j(s,(e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(qT,t),[])):n;var s})})(e.filetype,n,o),r=z_(s,vv.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:A.none()});return OS(r)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(WC)&&WC.run(e).get(b)},typeaheadBehaviours:El([...o.getValidationHandler().map(t=>WC.config({getRoot:e=>it(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each(e=>{Ot(e.element,"title",s.translate(t))})}},validator:{validate:o=>{const n=yu.getValue(o);return VT(o=>{t({type:e.filetype,url:n.value},e=>{if("invalid"===e.status){const t=an.error(e.message);o(t)}else{const t=an.value(e.message);o(t)}})})},validateOnLoad:!1}})).toArray(),Hm.config({disabled:()=>!e.enabled||s.isDisabled()}),vC.config({}),oh("urlinput-events",[jr(er(),t=>{const o=Ja(t.element),n=o.trim();n!==o&&Za(t.element,n),"file"===e.filetype&&Nr(t,kC,{name:e.name})}),jr(tr(),t=>{Nr(t,kC,{name:e.name}),r(t)}),jr(ur(),t=>{Nr(t,kC,{name:e.name}),r(t)})])]),eventOrder:{[er()]:["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:Nv(0,0,"normal")},onExecute:(e,t,o)=>{Nr(t,EC,{})},onItemExecute:(t,o,n,s)=>{r(t),Nr(t,kC,{name:e.name})}},i=hC.parts.field({...a,factory:LT}),l=e.label.map(t=>CC(t,e.tooltip.getOr(""),s)),c=Jh(((e,t,o=e,n=e)=>sb(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:s.translate(n),"aria-live":"polite",...t.fold(()=>({}),e=>({id:e}))}},s.icons))("invalid",A.some(oE),"warning")),d=Jh({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),u=o.getUrlPicker(e.filetype),m=da("browser.url.event"),g=Jh({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:El([Hm.config({disabled:()=>!e.enabled||s.isDisabled()})])}),p=Jh(jT({name:e.name,icon:A.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:A.none(),borderless:!0},e=>Rr(e,m),s,[],["tox-browse-url"]));return hC.sketch({dom:SC([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:q([[g.asSpec()],u.map(()=>p.asSpec()).toArray()])}]),fieldBehaviours:El([Hm.config({disabled:()=>!e.enabled||s.isDisabled(),onDisabled:e=>{hC.getField(e).each(Hm.disable),p.getOpt(e).each(Hm.disable)},onEnabled:e=>{hC.getField(e).each(Hm.enable),p.getOpt(e).each(Hm.enable)}}),Ex(),oh("url-input-events",[jr(m,t=>{_m.getCurrent(t).each(o=>{const n=yu.getValue(o),s={fieldname:e.name,...n};u.each(n=>{n(s).get(n=>{yu.setValue(o,n),Nr(t,kC,{name:e.name})})})})})])])})})(e,t,t.urlinput,o)),customeditor:rE(e=>{const t=sc(),o=Jh({dom:{tag:e.tag}}),n=sc(),s=!QO(e)&&e.onFocus.isSome()?[ih.config({onFocus:t=>{e.onFocus.each(e=>{e(t.element.dom)})}}),vC.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:El([oh("custom-editor-events",[Zr(s=>{o.getOpt(s).each(o=>{(QO(e)?e.init(o.element.dom):ZO.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)})})})]),YO(A.none(),()=>t.get().fold(()=>n.get().getOr(""),e=>e.getValue()),(e,o)=>{t.get().fold(()=>n.set(o),e=>e.setValue(o))}),jO()].concat(s)),components:[o.asSpec()]}}),htmlpanel:rE((e,t)=>((e,t)=>"presentation"===e.presets?uC.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html},containerBehaviours:El([Cx.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{yi(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Hl(e.element)).each(o=>{Et(o,"data-mce-tooltip").each(o=>{Cx.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-normal",anchor:e=>({type:"node",node:yi(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Hl(e.element).filter(e=>Et(e,"data-mce-tooltip").isSome())),root:e.element,layouts:{onLtr:x([pl,gl,cl,ul,dl,ml]),onRtl:x([pl,gl,cl,ul,dl,ml])},bubble:vc(0,-2,{})})})])}):uC.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:El([vC.config({}),ih.config({})])}))(e,t.shared.providers)),imagepreview:rE((e,t,o)=>((e,t)=>{const o=Ms(t.getOr({url:""})),n=Jh({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map(e=>({src:e.url})).getOr({})}}),s=Jh({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),r={};e.height.each(e=>r.height=e);const a=t.map(e=>({url:e.url,zoom:A.from(e.zoom),cachedWidth:A.from(e.cachedWidth),cachedHeight:A.from(e.cachedHeight)}));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:r,attributes:{role:"presentation"}},components:[s.asSpec()],behaviours:El([jO(),YO(a,()=>o.get(),(e,t)=>{const r={url:t.url};t.zoom.each(e=>r.zoom=e),t.cachedWidth.each(e=>r.cachedWidth=e),t.cachedHeight.each(e=>r.cachedHeight=e),o.set(r);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=r;if(!u(t)&&!u(o)){if(u(n)){const n=((e,t,o)=>{const n=Qt(e),s=Gt(e);return Math.min(n/t,s/o,1)})(e.element,t,o);r.zoom=n}const a=((e,t,o,n,s)=>{const r=o*s,a=n*s,i=Math.max(0,e/2-r/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:r.toString()+"px",height:a.toString()+"px"}})(Qt(e.element),Gt(e.element),t,o,r.zoom);s.getOpt(e).each(e=>{Ft(e.element,a)})}};n.getOpt(e).each(o=>{const n=o.element;var s;t.url!==Tt(n,"src")&&(Ot(n,"src",t.url),$a(e.element,"tox-imagepreview__loaded")),a(),(s=n,new Promise((e,t)=>{const o=()=>{r(),e(s)},n=[ac(s,"load",o),ac(s,"error",()=>{r(),t("Unable to load data from image: "+s.dom.src)})],r=()=>H(n,e=>e.unbind());s.dom.complete&&o()})).then(t=>{e.getSystem().isConnected()&&(ja(e.element,"tox-imagepreview__loaded"),r.cachedWidth=t.dom.naturalWidth,r.cachedHeight=t.dom.naturalHeight,a())})})})])}})(e,o)),table:rE((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"td",innerHtml:t.translate(e)}});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(s=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:V(s,e=>({dom:{tag:"th",innerHtml:t.translate(e)}}))}]}),(n=e.cells,{dom:{tag:"tbody"},components:V(n,e=>({dom:{tag:"tr"},components:V(e,o)}))})],behaviours:El([vC.config({}),ih.config({})])};var n,s})(e,t.shared.providers)),tree:rE((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(b),n=e.onToggleExpand.getOr(b),s=e.defaultExpandedIds,r=Ms(s),a=Ms(e.defaultSelectedId),i=da("tree-id"),l=(n,s)=>e.items.map(e=>"leaf"===e.type?yT({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):kT({directory:e,selectedId:n,onLeafAction:o,expandedIds:s,labelTabstopping:!0,treeId:i,backstage:t}));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),r.get()),behaviours:El([$p.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),oh(OT,[jr("expand-tree-node",(e,t)=>{const{expanded:o,node:s}=t.event;r.set(o?[...r.get(),s]:r.get().filter(e=>e!==s)),n(r.get(),{expanded:o,node:s})})]),Fl.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(A.some(t.value)),th.set(e,l(A.some(t.value),r.get()))}}}}),th.config({})])}})(e,t)),panel:rE((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:V(e.items,t.shared.interpreter)}))(e,t))},iE={field:(e,t)=>t,record:x([])},lE=(e,t,o,n)=>{const s=vn(n,{shared:{interpreter:t=>cE(e,t,o,s)}});return cE(e,t,o,s)},cE=(e,t,o,n)=>be(aE,t.type).fold(()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t),s=>s(e,t,o,n)),dE=(e,t,o)=>cE(iE,e,t,o),uE="layout-inset",mE=e=>e.x,gE=(e,t)=>e.x+e.width/2-t.width/2,pE=(e,t)=>e.x+e.width-t.width,hE=e=>e.y,fE=(e,t)=>e.y+e.height-t.height,bE=(e,t)=>e.y+e.height/2-t.height/2,vE=(e,t,o)=>Wi(pE(e,t),fE(e,t),o.insetSouthwest(),Yi(),"southwest",tl(e,{right:0,bottom:3}),uE),yE=(e,t,o)=>Wi(mE(e),fE(e,t),o.insetSoutheast(),qi(),"southeast",tl(e,{left:1,bottom:3}),uE),xE=(e,t,o)=>Wi(pE(e,t),hE(e),o.insetNorthwest(),$i(),"northwest",tl(e,{right:0,top:2}),uE),wE=(e,t,o)=>Wi(mE(e),hE(e),o.insetNortheast(),Gi(),"northeast",tl(e,{left:1,top:2}),uE),SE=(e,t,o)=>Wi(gE(e,t),hE(e),o.insetNorth(),Xi(),"north",tl(e,{top:2}),uE),CE=(e,t,o)=>Wi(gE(e,t),fE(e,t),o.insetSouth(),Ki(),"south",tl(e,{bottom:3}),uE),kE=(e,t,o)=>Wi(pE(e,t),bE(e,t),o.insetEast(),Zi(),"east",tl(e,{right:0}),uE),OE=(e,t,o)=>Wi(mE(e),bE(e,t),o.insetWest(),Ji(),"west",tl(e,{left:1}),uE),_E=e=>{switch(e){case"north":return SE;case"northeast":return wE;case"northwest":return xE;case"south":return CE;case"southeast":return yE;case"southwest":return vE;case"east":return kE;case"west":return OE}},TE=(e,t,o,n,s)=>Ql(n).map(_E).getOr(SE)(e,t,o,n,s),EE=e=>{switch(e){case"north":return CE;case"northeast":return yE;case"northwest":return vE;case"south":return SE;case"southeast":return wE;case"southwest":return xE;case"east":return OE;case"west":return kE}},AE=(e,t,o,n,s)=>Ql(n).map(EE).getOr(SE)(e,t,o,n,s),ME={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},DE=(e,t,o)=>{const n={maxHeightFunction:pc()};return()=>o()?{type:"node",root:vt(bt(e())),node:A.from(e()),bubble:vc(12,12,ME),layouts:{onRtl:()=>[wE],onLtr:()=>[xE]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:vc(-12,12,ME),layouts:{onRtl:()=>[cl,dl,pl],onLtr:()=>[dl,cl,pl]},overrides:n}},BE=(e,t,o,n)=>{const s={maxHeightFunction:pc()};return()=>n()?{type:"node",root:vt(bt(t())),node:A.from(t()),bubble:vc(12,12,ME),layouts:{onRtl:()=>[SE],onLtr:()=>[SE]},overrides:s}:e?{type:"node",root:vt(bt(t())),node:A.from(t()),bubble:vc(0,-$t(t()),ME),layouts:{onRtl:()=>[gl],onLtr:()=>[gl]},overrides:s}:{type:"hotspot",hotspot:o(),bubble:vc(0,0,ME),layouts:{onRtl:()=>[gl],onLtr:()=>[gl]},overrides:s}},IE=(e,t,o)=>()=>o()?{type:"node",root:vt(bt(e())),node:A.from(e()),layouts:{onRtl:()=>[SE],onLtr:()=>[SE]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[pl],onLtr:()=>[pl]}},FE=(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:ze(e),lastCell:ze(t)};return A.some(n)}return A.some(Gc.range(ze(t.startContainer),t.startOffset,ze(t.endContainer),t.endOffset))}}),RE=e=>t=>({type:"node",root:e(),node:t}),NE=(e,t,o,n)=>{const s=lv(e),r=()=>ze(e.getBody()),a=()=>ze(e.getContentAreaContainer()),i=()=>s||!n();return{inlineDialog:DE(a,t,i),inlineBottomDialog:BE(e.inline,a,o,i),banner:IE(a,t,i),cursor:FE(e,r),node:RE(r)}},LE=e=>(t,o)=>{rS(e)(t,o)},zE=e=>()=>Gw(e),VE=e=>t=>Pw(e,t),HE=e=>t=>jw(e,t),PE=e=>()=>Wb(e),UE=e=>ye(e,"items"),WE=e=>ye(e,"format"),jE=[{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"}]}],GE=e=>j(e,(e,t)=>{if(ve(t,"items")){const o=GE(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if(ve(t,"inline")||(e=>ve(e,"block"))(t)||(e=>ve(e,"selector"))(t)){const o=`custom-${r(t.name)?t.name:t.title.toLowerCase()}`;return{customFormats:e.customFormats.concat([{name:o,format:t}]),formats:e.formats.concat([{title:t.title,format:o,icon:t.icon}])}}return{...e,formats:e.formats.concat(t)}},{customFormats:[],formats:[]}),$E=e=>Sb(e).map(t=>{const o=((e,t)=>{const o=GE(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 Cb(e)?jE.concat(o):o}).getOr(jE),qE=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),YE=(e,t,o,n)=>{const s=t=>V(t,t=>UE(t)?(e=>{const t=s(e.items);return{...e,type:"submenu",getStyleItems:x(t)}})(t):WE(t)?(e=>qE(e,o,n))(t):(e=>{const t=ae(e);return 1===t.length&&R(t,"title")})(t)?{...t,type:"separator"}:(t=>{const s=r(t.name)?t.name:da(t.title),a=`custom-${s}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(s,i),i})(t));return s(t)},XE=e=>{let t=0;const o=e=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[ai(e.tooltipText)]}];return{getConfig:n=>({delayForShow:()=>t>0?60:300,delayForHide:x(300),exclusive:!0,lazySink:e,tooltipDom:{tag:"div",classes:["tox-tooltip","tox-tooltip--up"]},tooltipComponents:o(n),onShow:(e,o)=>{t++,n.onShow&&n.onShow(e,o)},onHide:()=>{t--}}),getComponents:o}},KE=e_.trim,JE=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},ZE=JE("true"),QE=JE("false"),eA=(e,t,o,n,s)=>({type:e,title:t,url:o,level:n,attach:s}),tA=e=>e.innerText||e.textContent,oA=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&sA(e),nA=e=>e&&/^(H[1-6])$/.test(e.nodeName),sA=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return ZE(t)}return!1})(e)&&!QE(e),rA=e=>nA(e)&&sA(e),aA=e=>{var t;const o=(e=>e.id?e.id:da("h"))(e);return eA("header",null!==(t=tA(e))&&void 0!==t?t:"","#"+o,(e=>nA(e)?parseInt(e.nodeName.substr(1),10):0)(e),()=>{e.id=o})},iA=e=>{const t=e.id||e.name,o=tA(e);return eA("anchor",o||"#"+t,"#"+t,0,b)},lA=e=>KE(e.title).length>0,cA=e=>{const t=(e=>{const t=V(Qc(ze(e),"h1,h2,h3,h4,h5,h6,a:not([href])"),e=>e.dom);return t})(e);return U((e=>V(U(e,rA),aA))(t).concat((e=>V(U(e,oA),iA))(t)),lA)},dA="tinymce-url-history",uA=e=>r(e)&&/^https?/.test(e),mA=e=>a(e)&&he(e,e=>{return!(l(t=e)&&t.length<=5&&X(t,uA));var t}).isNone(),gA=()=>{const e=Ew.getItem(dA);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+dA+" was not valid JSON",e),{};throw e}return mA(t)?t:(console.log("Local storage "+dA+" was not valid format",t),{})},pA=e=>{const t=gA();return be(t,e).getOr([])},hA=(e,t)=>{if(!uA(e))return;const o=gA(),n=be(o,t).getOr([]),s=U(n,t=>t!==e);o[t]=[e].concat(s).slice(0,5),(e=>{if(!mA(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));Ew.setItem(dA,JSON.stringify(e))})(o)},fA=e=>!!e,bA=e=>ce(e_.makeMap(e,/[, ]/),fA),vA=e=>A.from(Nb(e)),yA=e=>A.from(e).filter(r).getOrUndefined(),xA=e=>({getHistory:pA,addToHistory:hA,getLinkInformation:()=>(e=>Hb(e)?A.some({targets:cA(e.getBody()),anchorTop:yA(Pb(e)),anchorBottom:yA(Ub(e))}):A.none())(e),getValidationHandler:()=>(e=>A.from(Lb(e)))(e),getUrlPicker:t=>((e,t)=>((e,t)=>{const o=(e=>{const t=A.from(Vb(e)).filter(fA).map(bA);return vA(e).fold(T,e=>t.fold(E,e=>ae(e).length>0&&e))})(e);return d(o)?o?vA(e):A.none():o[t]?vA(e):A.none()})(e,t).map(o=>n=>kS(s=>{const i={filetype:t,fieldname:n.fieldname,...A.from(n.meta).getOr({})};o.call(e,(e,t)=>{if(!r(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");s({value:e,meta:t})},n.value,i)})))(e,t)}),wA=hm,SA=Zu,CA=x([ws("shell",!1),ss("makeItem"),ws("setupItem",b),Cu("listBehaviours",[th])]),kA=Xu({name:"items",overrides:()=>({behaviours:El([th.config({})])})}),OA=x([kA]),_A=Sm({name:x("CustomList")(),configFields:CA(),partFields:OA(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[th.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Su(e.listBehaviours,s.behaviours),apis:{setItems:(t,o)=>{var n;(n=t,e.shell?A.some(n):im(n,e,"items")).fold(()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},n=>{const s=th.contents(n),r=o.length,a=r-s.length,i=a>0?L(a,()=>e.makeItem()):[],l=s.slice(r);H(l,e=>th.remove(n,e)),H(i,e=>th.append(n,e));const c=th.contents(n);H(c,(n,s)=>{e.setupItem(t,n,o[s],s)})})}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),TA=x([ss("dom"),ws("shell",!0),xu("toolbarBehaviours",[th])]),EA=x([Xu({name:"groups",overrides:()=>({behaviours:El([th.config({})])})})]),AA=Sm({name:"Toolbar",configFields:TA(),partFields:EA(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[th.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Su(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(t,o)=>{var n;(n=t,e.shell?A.some(n):im(n,e,"groups")).fold(()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},e=>{th.set(e,o)})},refresh:b},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),MA=b,DA=T,BA=x([]);var IA,FA=Object.freeze({__proto__:null,setup:MA,isDocked:DA,getBehaviours:BA});const RA=e=>(xe(zt(e,"position"),"fixed")?A.none():lt(e)).orThunk(()=>{const t=Ne("span");return at(e).bind(e=>{Ho(e,t);const o=lt(t);return Wo(t),o})}),NA=e=>RA(e).map(Kt).getOrThunk(()=>Yt(0,0)),LA=(e,t)=>{const o=e.element;ja(o,t.transitionClass),$a(o,t.fadeOutClass),ja(o,t.fadeInClass),t.onShow(e)},zA=(e,t)=>{const o=e.element;ja(o,t.transitionClass),$a(o,t.fadeInClass),ja(o,t.fadeOutClass),t.onHide(e)},VA=(e,t)=>e.y>=t.y,HA=(e,t)=>e.bottom<=t.bottom,PA=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),UA=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),WA=e=>e.box.x-e.win.x,jA=(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 Yt(e.bounds.x,o)})(o,t);return{box:Zo(n.left,n.top,Qt(e),Gt(e)),location:o.location}}),GA=(e,t,o,n,s)=>{const r=((e,t)=>{const o=t.optScrollEnv.fold(x(e.y),t=>e.y+t.currentScrollTop-t.scrollElmTop);return Yt(e.x,o)})(t,o),a=Zo(r.left,r.top,t.width,t.height);n.setInitialPos({style:Vt(e),position:Nt(e,"position")||"static",bounds:a,location:s.location})},$A=(e,t,o)=>o.getInitialPos().bind(n=>{var s;switch(o.clearInitialPos(),n.position){case"static":return A.some({morph:"static"});case"absolute":const o=RA(e).getOr(St()),r=Qo(o),a=null!==(s=o.dom.scrollTop)&&void 0!==s?s:0;return A.some({morph:"absolute",positionCss:Ul("absolute",be(n.style,"left").map(e=>t.x-r.x),be(n.style,"top").map(e=>t.y-r.y+a),be(n.style,"right").map(e=>r.right-t.right),be(n.style,"bottom").map(e=>r.bottom-t.bottom))});default:return A.none()}}),qA=e=>{switch(e.location){case"top":return A.some({morph:"fixed",positionCss:Ul("fixed",A.some(e.leftX),A.some(e.topY),A.none(),A.none())});case"bottom":return A.some({morph:"fixed",positionCss:Ul("fixed",A.some(e.leftX),A.none(),A.none(),A.some(e.bottomY))});default:return A.none()}},YA=(e,t,o)=>{const n=e.element;return xe(zt(n,"position"),"fixed")?((e,t,o)=>((e,t,o)=>jA(e,t,o).filter(({box:e})=>((e,t,o)=>X(e,e=>{switch(e){case"bottom":return HA(t,o.bounds);case"top":return VA(t,o.bounds)}}))(o.getModes(),e,t)).bind(({box:t})=>$A(e,t,o)))(e,t,o).orThunk(()=>t.optScrollEnv.bind(n=>jA(e,t,o)).bind(({box:e,location:o})=>{const n=on(),s=WA({win:n,box:e}),r="top"===o?PA(n,s,t):UA(n,s,t);return qA(r)})))(n,t,o):((e,t,o)=>{const n=Qo(e),s=on(),r=((e,t,o)=>{const n=t.win,s=t.box,r=WA(t);return re(e,e=>{switch(e){case"bottom":return HA(s,o.bounds)?A.none():A.some(UA(n,r,o));case"top":return VA(s,o.bounds)?A.none():A.some(PA(n,r,o));default:return A.none()}}).getOr({location:"no-dock"})})(o.getModes(),{win:s,box:n},t);return"top"===r.location||"bottom"===r.location?(GA(e,n,t,o,r),qA(r)):A.none()})(n,t,o)},XA=(e,t,o)=>{o.setDocked(!1),H(["left","right","top","bottom","position"],t=>Pt(e.element,t)),t.onUndocked(e)},KA=(e,t,o,n)=>{const s="fixed"===n.position;o.setDocked(s),Wl(e.element,n),(s?t.onDocked:t.onUndocked)(e)},JA=(e,t,o,n,s=!1)=>{t.contextual.each(t=>{t.lazyContext(e).each(r=>{const a=((e,t)=>e.y<t.bottom&&e.bottom>t.y)(r,n.bounds);a!==o.isVisible()&&(o.setVisible(a),s&&!a?(Ya(e.element,[t.fadeOutClass]),t.onHide(e)):(a?LA:zA)(e,t))})})},ZA=(e,t,o,n,s)=>{JA(e,t,o,n,!0),KA(e,t,o,s.positionCss)},QA=(e,t,o)=>{e.getSystem().isConnected()&&((e,t,o)=>{const n=t.lazyViewport(e);JA(e,t,o,n),YA(e,n,o).each(s=>{((e,t,o,n,s)=>{switch(s.morph){case"static":return XA(e,t,o);case"absolute":return KA(e,t,o,s.positionCss);case"fixed":ZA(e,t,o,n,s)}})(e,t,o,n,s)})})(e,t,o)},eM=(e,t,o)=>{o.isDocked()&&((e,t,o)=>{const n=e.element;o.setDocked(!1);const s=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return jA(n,t,o).bind(({box:e})=>$A(n,e,o))})(e,s,o).each(n=>{switch(n.morph){case"static":XA(e,t,o);break;case"absolute":KA(e,t,o,n.positionCss)}}),o.setVisible(!0),t.contextual.each(t=>{Xa(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)}),QA(e,t,o)})(e,t,o)},tM=e=>(t,o,n)=>{const s=o.lazyViewport(t);((e,t,o,n)=>{const s=Qo(e),r=on(),a=n(r,WA({win:r,box:s}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,s)=>{n.getInitialPos().fold(()=>GA(e,t,o,n,s),()=>b)})(e,s,t,o,a),qA(a)):A.none()})(t.element,s,n,e).each(e=>{ZA(t,o,n,s,e)})},oM=tM(PA),nM=tM(UA);var sM=Object.freeze({__proto__:null,refresh:QA,reset:eM,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:oM,forceDockToBottom:nM}),rM=Object.freeze({__proto__:null,events:(e,t)=>Pr([Jr(sr(),(o,n)=>{e.contextual.each(e=>{qa(o.element,e.transitionClass)&&(Xa(o.element,[e.transitionClass,e.fadeInClass]),(t.isVisible()?e.onShown:e.onHidden)(o)),n.stop()})}),jr(Sr(),(o,n)=>{QA(o,e,t)}),jr(Mr(),(o,n)=>{QA(o,e,t)}),jr(Cr(),(o,n)=>{eM(o,e,t)})])}),aM=[xs("contextual",[is("fadeInClass"),is("fadeOutClass"),is("transitionClass"),cs("lazyContext"),Ni("onShow"),Ni("onShown"),Ni("onHide"),Ni("onHidden")]),Ts("lazyViewport",()=>({bounds:on(),optScrollEnv:A.none()})),Es("modes",["top","bottom"],Pn),Ni("onDocked"),Ni("onUndocked")];const iM=Ml({fields:aM,name:"docking",active:rM,apis:sM,state:Object.freeze({__proto__:null,init:e=>{const t=Ms(!1),o=Ms(!0),n=sc(),s=Ms(e.modes);return Ea({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:s.get,setModes:s.set,readState:()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${s.get().join(",")}`})}})}),lM=x(da("toolbar-height-change")),cM={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},dM="tox-tinymce--toolbar-sticky-on",uM="tox-tinymce--toolbar-sticky-off",mM=(e,t)=>R(iM.getModes(e),t),gM=e=>{const t=e.element;it(t).each(o=>{const n="padding-"+iM.getModes(e)[0];if(iM.isDocked(e)){const e=Qt(o);It(t,"width",e+"px"),It(o,n,(e=>$t(e)+(parseInt(Nt(e,"margin-top"),10)||0)+(parseInt(Nt(e,"margin-bottom"),10)||0))(t)+"px")}else Pt(t,"width"),Pt(o,n)})},pM=(e,t)=>{t?($a(e,cM.fadeOutClass),Ya(e,[cM.transitionClass,cM.fadeInClass])):($a(e,cM.fadeInClass),Ya(e,[cM.fadeOutClass,cM.transitionClass]))},hM=(e,t)=>{const o=ze(e.getContainer());t?(ja(o,dM),$a(o,uM)):(ja(o,uM),$a(o,dM))},fM=(e,t)=>{const o=sc(),n=t.getSink,s=e=>{n().each(t=>e(t.element))},r=t=>{e.inline||gM(t),hM(e,iM.isDocked(t)),t.getSystem().broadcastOn([tu()],{}),n().each(e=>e.getSystem().broadcastOn([tu()],{}))},a=e.inline?[]:[Fl.config({channels:{[lM()]:{onReceive:gM}}})];return[ih.config({}),iM.config({contextual:{lazyContext:t=>{const o=$t(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return A.from(n).map(n=>{const s=Qo(ze(n));return QS(e,t.element).fold(()=>{const e=s.height-o,n=s.y+(mM(t,"top")?0:o);return Zo(s.x,n,s.width,e)},e=>{const n=tn(s,eC(e)),r=mM(t,"top")?n.y:n.y+o;return Zo(n.x,r,n.width,n.height-o)})})},onShow:()=>{s(e=>pM(e,!0))},onShown:e=>{s(e=>Xa(e,[cM.transitionClass,cM.fadeInClass])),o.get().each(t=>{((e,t)=>{const o=ot(t);Vl(o).filter(e=>!et(t,e)).filter(t=>et(t,ze(o.dom.body))||tt(e,t)).each(()=>Nl(t))})(e.element,t),o.clear()})},onHide:e=>{((e,t)=>Hl(e).orThunk(()=>t().toOptional().bind(e=>Hl(e.element))))(e.element,n).fold(o.clear,o.set),s(e=>pM(e,!1))},onHidden:()=>{s(e=>Xa(e,[cM.transitionClass]))},...cM},lazyViewport:t=>QS(e,t.element).fold(()=>{const o=on(),n=Ib(e),s=o.y+(mM(t,"top")?n:0),r=o.height-(mM(t,"bottom")?n:0);return{bounds:Zo(o.x,s,o.width,r),optScrollEnv:A.none()}},e=>({bounds:eC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})})),modes:[t.header.getDockingMode()],onDocked:r,onUndocked:r}),...a]};var bM=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",()=>{o().each(iM.reset)}),e.on("ResizeWindow ResizeEditor",()=>{o().each(gM)}),e.on("SkinLoaded",()=>{o().each(e=>{iM.isDocked(e)?iM.reset(e):iM.refresh(e)})}),e.on("FullscreenStateChanged",()=>{o().each(iM.reset)})),e.on("AfterScrollIntoView",e=>{o().each(t=>{iM.refresh(t);const o=t.element;Vg(o)&&((e,t)=>{const o=ot(t),n=rt(t).dom.innerHeight,s=jo(o),r=ze(e.elm),a=en(r),i=Gt(r),l=a.y,c=l+i,d=Kt(t),u=Gt(t),m=d.top,g=m+u,p=Math.abs(m-s.top)<2,h=Math.abs(g-(s.top+n))<2;if(p&&l<g)Go(s.left,l-u,o);else if(h&&c>m){const e=l-n+i+u;Go(s.left,e,o)}})(e,o)})}),e.on("PostRender",()=>{hM(e,!1)})},isDocked:e=>e().map(iM.isDocked).getOr(!1),getBehaviours:fM});const vM=In([ry,rs("items",Rn([Ln([ay,ms("items",Pn)]),Pn]))].concat(Ry)),yM=[fs("text"),fs("tooltip"),fs("icon"),Ss("search",!1,Rn([Un,In([fs("placeholder")])],e=>d(e)?e?A.some({placeholder:A.none()}):A.none():A.some(e))),cs("fetch"),Ts("onSetup",()=>b)],xM=In([ry,...yM]),wM=e=>Xn("menubutton",xM,e),SM=In([ry,xy,yy,vy,Cy,my,fy,Os("presets","normal",["normal","color","listpreview"]),Ey(1),py,hy]);var CM=wm({factory:(e,t)=>{const o={focus:$p.focusIn,setMenus:(e,o)=>{const n=V(o,e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())}},n=wM(o).mapError(e=>Zn(e)).getOrDie();return hT(n,"tox-mbtn",t.backstage,A.some("menuitem"))});th.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:El([th.config({}),oh("menubar-events",[Zr(t=>{e.onSetup(t)}),jr(Xs(),(e,t)=>{yi(e.element,".tox-mbtn--active").each(o=>{xi(t.event.target,".tox-mbtn").each(t=>{et(o,t)||e.getSystem().getByDom(o).each(o=>{e.getSystem().getByDom(t).each(e=>{VS.expand(e),VS.close(o),ih.focus(e)})})})})}),jr(Er(),(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=>{VS.isOpen(o)&&(VS.expand(e),VS.close(o))})})})]),$p.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),A.some(!0))}),vC.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[ss("dom"),ss("uid"),ss("onEscape"),ss("backstage"),ws("onSetup",b)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const kM="container",OM=[xu("slotBehaviours",[])],_M=e=>"<alloy.field."+e+">",TM=(e,t)=>{const o=t=>um(e),n=(t,o)=>(n,s)=>im(n,e,s).map(e=>t(e,s)).getOr(o),s=(e,t)=>"true"!==Tt(e.element,"aria-hidden"),r=n(s,!1),a=n((e,t)=>{if(s(e)){const o=e.element;It(o,"display","none"),Ot(o,"aria-hidden","true"),Nr(e,Ar(),{name:t,visible:!1})}}),i=(e=>(t,o)=>{H(o,o=>e(t,o))})(a),l=n((e,t)=>{if(!s(e)){const o=e.element;Pt(o,"display"),Mt(o,"aria-hidden"),Nr(e,Ar(),{name:t,visible:!0})}}),c={getSlotNames:o,getSlot:(t,o)=>im(t,e,o),isShowing:r,hideSlot:a,hideAllSlots:e=>i(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:wu(e.slotBehaviours),apis:c}},EM=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=>_a(e)),AM={...EM,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),om(kM,_M(t),o)),record:x(e)}})(),o=e(t),n=t.record(),s=V(n,e=>qu({name:e,pname:_M(e)}));return bm(kM,OM,s,TM,o)}},MM=In([yy,xy,Ts("onShow",b),Ts("onHide",b),fy]),DM=e=>({element:()=>e.element.dom}),BM=(e,t)=>{const o=V(ae(t),e=>{const o=t[e],n=Kn((e=>Xn("sidebar",MM,e))(o));return{name:e,getApi:DM,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}});return V(o,t=>{const n=Ms(b);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:mx([Ix(t,n),Fx(t,n),jr(Ar(),(e,t)=>{const n=t.event,s=G(o,e=>e.name===n.name);s.each(t=>{(n.visible?t.onShow:t.onHide)(t.getApi(e))})})])})})},IM=e=>AM.sketch(t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:BM(t,e),slotBehaviours:mx([Zr(e=>AM.hideAllSlots(e))])})),FM=(e,t)=>{Ot(e,"role",t)},RM=e=>_m.getCurrent(e).bind(e=>gT.isGrowing(e)||gT.hasGrown(e)?_m.getCurrent(e).bind(e=>G(AM.getSlotNames(e),t=>AM.isShowing(e,t))):A.none()),NM=da("FixSizeEvent"),LM=da("AutoSizeEvent");var zM=Object.freeze({__proto__:null,block:(e,t,o,n)=>{Ot(e.element,"aria-busy",!0);const s=t.getRoot(e).getOr(e),r=El([$p.config({mode:"special",onTab:()=>A.some(!0),onShiftTab:()=>A.some(!0)}),ih.config({})]),a=n(s,r),i=s.getSystem().build(a);th.append(s,ui(i)),i.hasConfigured($p)&&t.focus&&$p.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith(()=>th.remove(s,i))},unblock:(e,t,o)=>{Mt(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},isBlocked:(e,t,o)=>o.isBlocked()}),VM=[Ts("getRoot",A.none),_s("focus",!0),Ni("onBlock"),Ni("onUnblock")];const HM=Ml({fields:VM,name:"blocking",apis:zM,state:Object.freeze({__proto__:null,init:()=>{const e=oc(e=>e.destroy());return Ea({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})}),PM=e=>_m.getCurrent(e).each(e=>Nl(e.element,!0)),UM=(e,t,o)=>{const n=Ms(!1),s=sc(),r=o=>{var s;n.get()&&(!(e=>"focusin"===e.type)(s=o)||!(s.composed?oe(s.composedPath()):A.from(s.target)).map(ze).filter($e).exists(e=>qa(e,"mce-pastebin")))&&(o.preventDefault(),PM(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",()=>{e.dom.bind(e.getWin(),"focusin",r),e.on("BeforeExecCommand",e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&r(e)})});const a=s=>{s!==n.get()&&(n.set(s),((e,t,o,n)=>{const s=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;A.from(e.iframeElement).map(ze).each(e=>{t?(Et(e,o).each(t=>Ot(e,n,t)),Ot(e,o,-1)):(Mt(e,o),Et(e,n).each(t=>{Ot(e,o,t),Mt(e,n)}))})})(e,o),o)HM.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:Kh('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}))(n)),Pt(s,"display"),Mt(s,"aria-hidden"),e.hasFocus()&&PM(t);else{const o=_m.getCurrent(t).exists(e=>zl(e.element));HM.unblock(t),It(s,"display","none"),Ot(s,"aria-hidden","true"),o&&e.focus()}})(e,t(),s,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,s))};e.on("ProgressState",t=>{if(s.on(clearTimeout),h(t.time)){const o=Yh.setEditorTimeout(e,()=>a(t.state),t.time);s.set(o)}else a(t.state),s.clear()})},WM=(e,t,o)=>({within:e,extra:t,withinWidth:o}),jM=(e,t,o)=>{const n=j(e,(e,t)=>((e,t)=>{const n=o(e);return A.some({element:e,start:t,finish:t+n,width:n})})(t,e.len).fold(x(e),t=>({len:t.finish,list:e.list.concat([t])})),{len:0,list:[]}).list,s=U(n,e=>e.finish<=t),r=W(s,(e,t)=>e+t.width,0);return{within:s,extra:n.slice(s.length),withinWidth:r}},GM=e=>V(e,e=>e.element),$M=(e,t)=>{const o=V(t,e=>ui(e));AA.setGroups(e,o)},qM=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const s=lm(e,t,"primary"),r=yS.getCoupled(e,"overflowGroup");It(s.element,"visibility","hidden");const a=n.concat([r]),i=re(a,e=>Hl(e.element).bind(t=>e.getSystem().getByDom(t).toOptional()));o([]),$M(s,a);const l=((e,t,o,n)=>{const s=((e,t,o)=>{const n=jM(t,e,o);return 0===n.extra.length?A.some(n):A.none()})(e,t,o).getOrThunk(()=>jM(t,e-o(n),o)),r=s.within,a=s.extra,i=s.withinWidth;return 1===a.length&&a[0].width<=o(n)?((e,t,o)=>{const n=GM(e.concat(t));return WM(n,[],o)})(r,a,i):a.length>=1?((e,t,o,n)=>{const s=GM(e).concat([o]);return WM(s,GM(t),n)})(r,a,n,i):((e,t,o)=>WM(GM(e),[],o))(r,0,i)})(Qt(s.element),t.builtGroups.get(),e=>Math.ceil(e.element.dom.getBoundingClientRect().width),r);0===l.extra.length?(th.remove(s,r),o([])):($M(s,l.within),o(l.extra)),Pt(s.element,"visibility"),Ut(s.element),i.each(ih.focus)},YM=x([xu("splitToolbarBehaviours",[yS]),os("builtGroups",()=>Ms([]))]),XM=x([Fi(["overflowToggledClass"]),vs("getOverflowBounds"),ss("lazySink"),os("overflowGroups",()=>Ms([])),Ni("onOpened"),Ni("onClosed")].concat(YM())),KM=x([qu({factory:AA,schema:TA(),name:"primary"}),Yu({schema:TA(),name:"overflow"}),Yu({name:"overflow-button"}),Yu({name:"overflow-group"})]),JM=x((e,t)=>{((e,t)=>{const o=Zt.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);It(e,"max-width",o+"px")})(e,Math.floor(t))}),ZM=x([Fi(["toggledClass"]),ss("lazySink"),cs("fetch"),vs("getBounds"),xs("fireDismissalEventInstead",[ws("event",_r())]),_c(),Ni("onToggled")]),QM=x([Yu({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:El([hh.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Yu({factory:AA,schema:TA(),name:"toolbar",overrides:e=>({toolbarBehaviours:El([$p.config({mode:"cyclic",onEscape:t=>(im(t,e,"button").each(ih.focus),A.none())})])})})]),eD=sc(),tD=(e,t)=>{const o=yS.getCoupled(e,"toolbarSandbox");Qd.isOpen(o)?Qd.close(o):Qd.open(o,t.toolbar())},oD=(e,t,o,n)=>{const s=o.getBounds.map(e=>e()),r=o.lazySink(e).getOrDie();Td.positionWithinBounds(r,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:JM()}}},s)},nD=(e,t,o,n,s)=>{AA.setGroups(t,s),oD(e,t,o,n),hh.on(e)},sD=Sm({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Xh.sketch({...n.button(),action:e=>{tD(e,n)},buttonBehaviours:ku({dump:n.button().buttonBehaviours},[yS.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Si();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:El([$p.config({mode:"special",onEscape:e=>(Qd.close(e),A.some(!0))}),Qd.config({onOpen:(s,r)=>{const a=eD.get().getOr(!1);o.fetch().get(s=>{nD(e,r,o,t.layouts,s),n.link(e.element),a||$p.focusIn(r)})},onClose:()=>{hh.off(e),eD.get().getOr(!1)||ih.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>Ci(o,n)||Ci(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),Fl.config({channels:{...su({isExtraPart:T,...o.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...au({doReposition:()=>{Qd.getState(yS.getCoupled(e,"toolbarSandbox")).each(n=>{oD(e,n,o,t.layouts)})}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{Qd.getState(yS.getCoupled(t,"toolbarSandbox")).each(s=>{nD(t,s,e,o.layouts,n)})},reposition:t=>{Qd.getState(yS.getCoupled(t,"toolbarSandbox")).each(n=>{oD(t,n,e,o.layouts)})},toggle:e=>{tD(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{eD.set(!0),tD(e,t),eD.clear()})(e,n)},getToolbar:e=>Qd.getState(yS.getCoupled(e,"toolbarSandbox")),isOpen:e=>Qd.isOpen(yS.getCoupled(e,"toolbarSandbox"))}}),configFields:ZM(),partFields:QM(),apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggleWithoutFocusing(t)},getToolbar:(e,t)=>e.getToolbar(t),isOpen:(e,t)=>e.isOpen(t)}}),rD=x([ss("items"),Fi(["itemSelector"]),xu("tgroupBehaviours",[$p])]),aD=x([Ku({name:"items",unit:"item"})]),iD=Sm({name:"ToolbarGroup",configFields:rD(),partFields:aD(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.tgroupBehaviours,[$p.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),lD=e=>V(e,e=>ui(e)),cD=(e,t,o)=>{qM(e,o,n=>{o.overflowGroups.set(n),t.getOpt(e).each(e=>{sD.setGroups(e,lD(n))})})},dD=Sm({name:"SplitFloatingToolbar",configFields:XM(),partFields:KM(),factory:(e,t,o,n)=>{const s=Jh(sD.sketch({fetch:()=>kS(t=>{t(lD(e.overflowGroups.get()))}),layouts:{onLtr:()=>[dl,cl],onRtl:()=>[cl,dl],onBottomLtr:()=>[ml,ul],onBottomRtl:()=>[ul,ml]},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:Su(e.splitToolbarBehaviours,[yS.config({others:{overflowGroup:()=>iD.sketch({...n["overflow-group"](),items:[s.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(V(o,t.getSystem().build)),cD(t,s,e)},refresh:t=>cD(t,s,e),toggle:e=>{s.getOpt(e).each(e=>{sD.toggle(e)})},toggleWithoutFocusing:e=>{s.getOpt(e).each(sD.toggleWithoutFocusing)},isOpen:e=>s.getOpt(e).map(sD.isOpen).getOr(!1),reposition:e=>{s.getOpt(e).each(e=>{sD.reposition(e)})},getOverflow:e=>s.getOpt(e).bind(sD.getToolbar)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t),getOverflow:(e,t)=>e.getOverflow(t)}}),uD=x([Fi(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),Ni("onOpened"),Ni("onClosed")].concat(YM())),mD=x([qu({factory:AA,schema:TA(),name:"primary"}),qu({factory:AA,schema:TA(),name:"overflow",overrides:e=>({toolbarBehaviours:El([gT.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{im(t,e,"overflow-button").each(e=>{hh.off(e),ih.focus(e)}),e.onClosed(t)},onGrown:t=>{$p.focusIn(t),e.onOpened(t)},onStartGrow:t=>{im(t,e,"overflow-button").each(hh.on)}}),$p.config({mode:"acyclic",onEscape:t=>(im(t,e,"overflow-button").each(ih.focus),A.some(!0))})])})}),Yu({name:"overflow-button",overrides:e=>({buttonBehaviours:El([hh.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])})}),Yu({name:"overflow-group"})]),gD=(e,t)=>{im(e,t,"overflow-button").bind(()=>im(e,t,"overflow")).each(o=>{pD(e,t),gT.toggleGrow(o)})},pD=(e,t)=>{im(e,t,"overflow").each(o=>{qM(e,t,e=>{const t=V(e,e=>ui(e));AA.setGroups(o,t)}),im(e,t,"overflow-button").each(e=>{gT.hasGrown(o)&&hh.on(e)}),gT.refresh(o)})},hD=Sm({name:"SplitSlidingToolbar",configFields:uD(),partFields:mD(),factory:(e,t,o,n)=>{const s="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.splitToolbarBehaviours,[yS.config({others:{overflowGroup:e=>iD.sketch({...n["overflow-group"](),items:[Xh.sketch({...n["overflow-button"](),action:t=>{Rr(e,s)}})]})}}),oh("toolbar-toggle-events",[jr(s,t=>{gD(t,e)})])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=V(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),pD(t,e)},refresh:t=>pD(t,e),toggle:t=>gD(t,e),isOpen:t=>((e,t)=>im(e,t,"overflow").map(gT.hasGrown).getOr(!1))(t,e)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},toggle:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t)}}),fD=e=>{const t=e.title.fold(()=>({}),e=>({attributes:{title:e}}));return{dom:{tag:"div",classes:["tox-toolbar__group"],...t},components:[iD.parts.items({})],items:e.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:El([vC.config({}),ih.config({})])}},bD=e=>iD.sketch(fD(e)),vD=(e,t)=>{const o=Zr(t=>{const o=V(e.initGroups,bD);AA.setGroups(t,o)});return El([Dx(e.providers.isDisabled),Ex(),$p.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),oh("toolbar-events",[o])])},yD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":fD({title:A.none(),items:[]}),"overflow-button":PT({name:"more",icon:A.some("more-drawer"),enabled:!0,tooltip:A.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:A.none(),borderless:!1},A.none(),e.providers,[],"overflow-button")},splitToolbarBehaviours:vD(e,t)}},xD=e=>{const t=yD(e),o=dD.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return dD.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=en(t),n=st(t),s=en(n),r=Math.max(n.dom.scrollHeight,s.height);return Zo(o.x+4,s.y,o.width-8,r)},parts:{...t.parts,overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:e.attributes}}},components:[o],markers:{overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>e.onToggled(t,!0),onClosed:t=>e.onToggled(t,!1)})},wD=e=>{const t=hD.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=hD.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=yD(e);return hD.sketch({...n,components:[t,o],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>{t.getSystem().broadcastOn([lM()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([lM()],{type:"closed"}),e.onToggled(t,!1)}})},SD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return AA.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===ib.scrolling?["tox-toolbar--scrolling"]:[])},components:[AA.parts.groups({})],toolbarBehaviours:vD(e,t)})},CD=[vy,yy,fs("tooltip"),Os("buttonType","secondary",["primary","secondary"]),_s("borderless",!1),cs("onAction")],kD={button:[...CD,ly,ls("type",["button"])],togglebutton:[...CD,_s("active",!1),ls("type",["togglebutton"])]},OD=[ls("type",["group"]),Es("buttons",[],Qn("type",kD))],_D=Qn("type",{...kD,group:OD}),TD=In([Es("buttons",[],_D),cs("onShow"),cs("onHide")]),ED=(e,t)=>((e,t)=>{var o,n;const s="togglebutton"===e.type,r=e.icon.map(e=>M_(e,t.icons)).map(Jh),a={...e,name:s?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:A.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},i=UT(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),l=s?e.text.map(t.translate):A.some(t.translate(e.text)),c=l.map(ai),d=a.tooltip.or(l).map(e=>({"aria-label":t.translate(e)})).getOr({}),u=r.map(e=>e.asSpec()),m=Lx([u,c]),g=e.icon.isSome()&&c.isSome(),p={tag:"button",classes:i.concat(...e.icon.isSome()&&!g?["tox-button--icon"]:[]).concat(...g?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:d},h=HT(a,A.some(o=>{const n=e=>{r.map(n=>n.getOpt(o).each(o=>{th.set(o,[M_(e,t.icons)])}))};return s?e.onAction({setIcon:n,setActive:e=>{const t=o.element;e?(ja(t,"tox-button--enabled"),Ot(t,"aria-pressed",!0)):($a(t,"tox-button--enabled"),Mt(t,"aria-pressed"))},isActive:()=>qa(o.element,"tox-button--enabled")}):"button"===e.type?e.onAction({setIcon:n}):void 0}),[],p,m,e.tooltip,t);return Xh.sketch(h)})(e,t),AD=Io().deviceType,MD=AD.isPhone(),DD=AD.isTablet();var BD=Sm({name:"silver.View",configFields:[ss("viewConfig")],partFields:[Xu({factory:{sketch:e=>{let t=!1;const o=V(e.buttons,o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:V(e.buttons,e=>ED(e,t))}))(o,e.providers)):ED(o,e.providers));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...MD||DD?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:El([ih.config({}),$p.config({mode:"flow",selector:"button, .tox-button",focusInside:yg.OnEnterOrSpaceMode})]),components:t?o:[uC.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),uC.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[ss("buttons"),ss("providers")],name:"header"}),Xu({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const s={getPane:t=>wA.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,apis:s}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const ID=(e,t,o)=>pe(t,(t,n)=>{const s=Kn(Xn("view",TD,t));return e.slot(n,BD.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:s,components:[...s.buttons.length>0?[BD.parts.header({buttons:s.buttons,providers:o})]:[],BD.parts.pane({})]}))}),FD=(e,t)=>AM.sketch(o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:ID(o,e,t),slotBehaviours:mx([Zr(e=>AM.hideAllSlots(e))])})),RD=e=>G(AM.getSlotNames(e),t=>AM.isShowing(e,t)),ND=(e,t,o)=>{AM.getSlot(e,t).each(e=>{BD.getPane(e).each(t=>{var n;o(e)((n=t.element.dom,{getContainer:x(n)}))})})};var LD=wm({factory:(e,t)=>{const o={setViews:(e,o)=>{th.set(e,[FD(o,t.backstage.shared.providers)])},whichView:e=>_m.getCurrent(e).bind(RD),toggleView:(e,t,o,n)=>_m.getCurrent(e).exists(s=>{const r=RD(s),a=r.exists(e=>n===e),i=AM.getSlot(s,n).isSome();return i&&(AM.hideAllSlots(s),a?((e=>{const t=e.element;It(t,"display","none"),Ot(t,"aria-hidden","true")})(e),t()):(o(),(e=>{const t=e.element;Pt(t,"display"),Mt(t,"aria-hidden")})(e),AM.showSlot(s,n),((e,t)=>{ND(e,t,BD.getOnShow)})(s,n)),r.each(e=>((e,t)=>ND(e,t,BD.getOnHide))(s,e))),i})};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:El([th.config({}),_m.config({find:e=>{const t=th.contents(e);return oe(t)}})]),apis:o}},name:"silver.ViewWrapper",configFields:[ss("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,s)=>e.toggleView(t,o,n,s),whichView:(e,t)=>e.whichView(t)}});const zD=SA.optional({factory:CM,name:"menubar",schema:[ss("backstage")]}),VD=SA.optional({factory:{sketch:e=>_A.sketch({uid:e.uid,dom:e.dom,listBehaviours:El([$p.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>SD({type:e.type,uid:da("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),A.some(!0))}),setupItem:(e,t,o,n)=>{AA.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[ss("dom"),ss("onEscape")]}),HD=SA.optional({factory:{sketch:e=>{const t=(e=>e.type===ib.sliding?wD:e.type===ib.floating?xD:SD)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),A.some(!0)),onToggled:(t,o)=>e.onToolbarToggled(o),cyclicKeying:!1,initGroups:[],getSink:e.getSink,providers:e.providers,moreDrawerData:{lazyToolbar:e.lazyToolbar,lazyMoreButton:e.lazyMoreButton,lazyHeader:e.lazyHeader},attributes:e.attributes})}},name:"toolbar",schema:[ss("dom"),ss("onEscape"),ss("getSink")]}),PD=SA.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?fM:BA;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:El(o(t,e.sharedBackstage))}}},name:"header",schema:[ss("dom")]}),UD=SA.optional({name:"socket",schema:[ss("dom")]}),WD=SA.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:El([vC.config({}),ih.config({}),gT.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=>{_m.getCurrent(e).each(AM.hideAllSlots),Rr(e,LM)},onGrown:e=>{Rr(e,LM)},onStartGrow:e=>{Nr(e,NM,{width:zt(e.element,"width").getOr("")})},onStartShrink:e=>{Nr(e,NM,{width:Qt(e.element)+"px"})}}),th.config({}),_m.config({find:e=>{const t=th.contents(e);return oe(t)}})])}],behaviours:El([GO(0),oh("sidebar-sliding-events",[jr(NM,(e,t)=>{It(e.element,"width",t.event.width)}),jr(LM,(e,t)=>{Pt(e.element,"width")})])])})},name:"sidebar",schema:[ss("dom")]}),jD=SA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:El([th.config({}),HM.config({focus:!1}),_m.config({find:e=>oe(e.components())})]),components:[]})},name:"throbber",schema:[ss("dom")]}),GD=SA.optional({factory:LD,name:"viewWrapper",schema:[ss("backstage")]}),$D=SA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var qD=Sm({name:"OuterContainer",factory:(e,t,o)=>{let n=!1;const s={getSocket:t=>wA.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{wA.getPart(t,e,"sidebar").each(e=>((e,t,o)=>{_m.getCurrent(e).each(n=>{th.set(n,[IM(t)]);const s=null==o?void 0:o.toLowerCase();r(s)&&ve(t,s)&&_m.getCurrent(n).each(t=>{AM.showSlot(t,s),gT.immediateGrow(n),Pt(n.element,"width"),FM(e.element,"region")})})})(e,o,n))},toggleSidebar:(t,o)=>{wA.getPart(t,e,"sidebar").each(e=>((e,t)=>{_m.getCurrent(e).each(o=>{_m.getCurrent(o).each(n=>{gT.hasGrown(o)?AM.isShowing(n,t)?(gT.shrink(o),FM(e.element,"presentation")):(AM.hideAllSlots(n),AM.showSlot(n,t),FM(e.element,"region")):(AM.hideAllSlots(n),AM.showSlot(n,t),gT.grow(o),FM(e.element,"region"))})})})(e,o))},whichSidebar:t=>wA.getPart(t,e,"sidebar").bind(RM).getOrNull(),getHeader:t=>wA.getPart(t,e,"header"),getToolbar:t=>wA.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{wA.getPart(t,e,"toolbar").each(e=>{const t=V(o,bD);e.getApis().setGroups(e,t)})},setToolbars:(t,o)=>{wA.getPart(t,e,"multiple-toolbar").each(e=>{const t=V(o,e=>V(e,bD));_A.setItems(e,t)})},refreshToolbar:t=>{wA.getPart(t,e,"toolbar").each(e=>e.getApis().refresh(e))},toggleToolbarDrawer:t=>{wA.getPart(t,e,"toolbar").each(e=>{Ce(e.getApis().toggle,t=>t(e))})},toggleToolbarDrawerWithoutFocusing:t=>{wA.getPart(t,e,"toolbar").each(e=>{Ce(e.getApis().toggleWithoutFocusing,t=>t(e))})},isToolbarDrawerToggled:t=>wA.getPart(t,e,"toolbar").bind(e=>A.from(e.getApis().isOpen).map(t=>t(e))).getOr(!1),getThrobber:t=>wA.getPart(t,e,"throbber"),focusToolbar:t=>{wA.getPart(t,e,"toolbar").orThunk(()=>wA.getPart(t,e,"multiple-toolbar")).each(e=>{$p.focusIn(e)})},setMenubar:(t,o)=>{wA.getPart(t,e,"menubar").each(e=>{CM.setMenus(e,o)})},focusMenubar:t=>{wA.getPart(t,e,"menubar").each(e=>{CM.focus(e)})},setViews:(t,o)=>{wA.getPart(t,e,"viewWrapper").each(e=>{LD.setViews(e,o)})},toggleView:(t,o)=>wA.getPart(t,e,"viewWrapper").exists(e=>LD.toggleView(e,()=>s.showMainView(t),()=>s.hideMainView(t),o)),whichView:t=>wA.getPart(t,e,"viewWrapper").bind(LD.whichView).getOrNull(),hideMainView:t=>{n=s.isToolbarDrawerToggled(t),n&&s.toggleToolbarDrawer(t),wA.getPart(t,e,"editorContainer").each(e=>{const t=e.element;It(t,"display","none"),Ot(t,"aria-hidden","true")})},showMainView:t=>{n&&s.toggleToolbarDrawer(t),wA.getPart(t,e,"editorContainer").each(e=>{const t=e.element;Pt(t,"display"),Mt(t,"aria-hidden")})}};return{uid:e.uid,dom:e.dom,components:t,apis:s,behaviours:e.behaviours}},configFields:[ss("dom"),ss("behaviours")],partFields:[PD,zD,HD,VD,UD,WD,jD,GD,$D],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 YD={file:{title:"File",items:"newdocument restoredraft | preview | importword exportpdf exportword | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed inserttemplate codesample inserttable accordion | 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"}},XD=e=>e.split(" "),KD=(e,t)=>{const o={...YD,...t.menus},n=ae(t.menus).length>0,s=void 0===t.menubar||!0===t.menubar?XD("file edit view insert format tools table help"):XD(!1===t.menubar?"":t.menubar),a=U(s,e=>{const o=ve(YD,e);return n?o||be(t.menus,e).exists(e=>ve(e,"items")):o}),i=V(a,n=>{const s=o[n],r=XD("table"===n?hv(e,s.items):s.items);return((e,t,o)=>{const n=_b(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:s.title,items:r},t,e)});return U(i,e=>e.getItems().length>0&&N(e.getItems(),e=>r(e)||"separator"!==e.type))},JD=(e,t,o)=>(e.on("remove",()=>o.unload(t)),o.load(t)),ZD=(e,t,o,n)=>(e.on("remove",()=>n.unloadRawCss(t)),n.loadRawCss(t,o)),QD=async(e,t)=>{const o="ui/"+tv(e).getOr("default")+"/skin.css",n=tinymce.Resource.get(o);return r(n)?Promise.resolve(ZD(e,o,n,e.ui.styleSheetLoader)):JD(e,t+"/skin.min.css",e.ui.styleSheetLoader)},eB=async(e,t)=>{var o;if(o=ze(e.getElement()),yt(o).isSome()){const o="ui/"+tv(e).getOr("default")+"/skin.shadowdom.css",n=tinymce.Resource.get(o);return r(n)?(ZD(e,o,n,cb.DOM.styleSheetLoader),Promise.resolve()):JD(e,t+"/skin.shadowdom.min.css",cb.DOM.styleSheetLoader)}},tB=(e,t)=>(async(e,t)=>{tv(t).fold(()=>{const o=ev(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")},o=>{const n="ui/"+o+(e?"/content.inline":"/content")+".css",s=tinymce.Resource.get(n);if(r(s))ZD(t,n,s,t.ui.styleSheetLoader);else{const o=ev(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}});const o=ev(t);if(!Zb(t)&&r(o))return Promise.all([QD(t,o),eB(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=>()=>((e,t)=>{e.dispatch("SkinLoadError",t)})(e,{message:"Skin could not be loaded"}))(t)),oB=C(tB,!1),nB=C(tB,!0),sB=(e,t,o)=>e.translate([t,e.translate(o)]),rB=(e,t)=>{const o=(o,s,r,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return A.some({type:"separator",text:i});if("submenu"===o.type){const e=Y(o.getStyleItems(),e=>n(e,s,a));return 0===s&&e.length<=0?A.none():A.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>Y(o.getStyleItems(),e=>n(e,s,a))})}return A.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!r,onAction:t.onAction(o),...o.getStylePreview().fold(()=>({}),e=>({meta:{style:e}}))})},n=(e,n,s)=>{const r="formatter"===e.type&&t.isInvalid(e);return 0===n?r?[]:o(e,n,!1,s).toArray():o(e,n,r,s).toArray()},s=e=>{const o=t.getCurrentValue(),s=t.shouldHide?0:1;return Y(e,e=>n(e,s,o))};return{validateItems:s,getFetch:(e,t)=>(o,n)=>{const r=t(),a=s(r);n(z_(a,vv.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:A.none()}))}}},aB=(e,t)=>{const o=t.dataset,n="basic"===o.type?()=>V(o.data,e=>qE(e,t.isSelectedFor,t.getPreviewFor)):o.getData;return{items:rB(e,t),getStyleItems:n}},iB=(e,t,o,n,s,r)=>{const{items:a,getStyleItems:i}=aB(t,o),l=Ms(o.tooltip);return F_({text:o.icon.isSome()?A.none():o.text,icon:o.icon,ariaLabel:A.some(o.tooltip),tooltip:A.none(),role:A.none(),fetch:a.getFetch(t,i),onSetup:t=>{const r=o=>t.setTooltip(sB(e,n,o.value));return e.on(s,r),Sw(Ow(e,"NodeChange",t=>{const n=t.getComponent();o.updateText(n),Hm.set(t.getComponent(),!e.selection.isEditable())})(t),()=>e.off(s,r))},getApi:e=>({getComponent:x(e),setTooltip:o=>{const n=t.shared.providers.translate(o);Ot(e.element,"aria-label",n),l.set(o)}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[Cx.config({...t.shared.providers.tooltips.getConfig({tooltipText:t.shared.providers.translate(o.tooltip),onShow:e=>{if(o.tooltip!==l.get()){const o=t.shared.providers.translate(l.get());Cx.setComponents(e,t.shared.providers.tooltips.getComponents({tooltipText:o}))}}})})]},"tox-tbtn",t.shared,r)};var lB;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(lB||(lB={}));const cB=(e,t,o)=>{const n=(s=((e,t)=>t===lB.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o),V(s,e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}}));var s;return{type:"basic",data:n}},dB="Alignment {0}",uB="left",mB=[{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"}],gB=e=>{const t={type:"basic",data:mB};return{tooltip:sB(e,dB,uB),text:A.none(),icon:A.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:e=>A.none,onAction:t=>()=>G(mB,e=>e.format===t.format).each(t=>e.execCommand(t.command)),updateText:t=>{const o=G(mB,t=>e.formatter.match(t.format)).fold(x(uB),e=>e.title.toLowerCase());Nr(t,I_,{icon:`align-${o}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:o})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},pB=(e,t)=>{const o=t(),n=V(o,e=>e.format);return A.from(e.formatter.closest(n)).bind(e=>G(o,t=>t.format===e)).orThunk(()=>ke(e.formatter.match("p"),{title:"Paragraph",format:"p"}))},hB="Block {0}",fB="Paragraph",bB=e=>{const t=cB(e,"block_formats",lB.SemiColon);return{tooltip:sB(e,hB,fB),text:A.some(fB),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:_w(e),updateText:o=>{const n=pB(e,()=>t.data).fold(x(fB),e=>e.title);Nr(o,B_,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},vB="Font {0}",yB="System Font",xB=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],wB=e=>{const t=e.split(/\s*,\s*/);return V(t,e=>e.replace(/^['"]+|['"]+$/g,""))},SB=(e,t)=>t.length>0&&X(t,t=>e.indexOf(t.toLowerCase())>-1),CB=e=>{const t=()=>{const t=e=>e?wB(e)[0]:"",n=e.queryCommandValue("FontName"),s=o.data,r=n?n.toLowerCase():"",a=Jb(e),i=G(s,e=>{const o=e.format;return o.toLowerCase()===r||t(o).toLowerCase()===t(r).toLowerCase()}).orThunk(()=>ke(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=wB(e.toLowerCase());return SB(o,xB)||SB(o,t)}return!1})(r,a),{title:yB,format:r}));return{matchOpt:i,font:n}},o=cB(e,"font_family_formats",lB.SemiColon);return{tooltip:sB(e,vB,yB),text:A.some(yB),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>A.some({tag:"div",styles:-1===e.indexOf("dings")?{"font-family":e}:{}}),onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontName",!1,t.format)})},updateText:o=>{const{matchOpt:n,font:s}=t(),r=n.fold(x(s),e=>e.title);Nr(o,B_,{text:r}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:r})},dataset:o,shouldHide:!1,isInvalid:T}},kB={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:[""]},OB=(()=>{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}))(.*)$`)})(),_B=(e,t)=>A.from(OB.exec(e)).bind(e=>{const o=Number(e[1]),n=e[2];return((e,t)=>N(t,t=>N(kB[t],t=>e===t)))(n,t)?A.some({value:o,unit:n}):A.none()}),TB={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)},EB="Font size {0}",AB="12pt",MB={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},DB={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},BB=(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(DB,e).getOr(e),IB=e=>be(MB,e).getOr(""),FB=e=>{const t=()=>{let t=A.none();const o=n.data,s=e.queryCommandValue("FontSize");if(s)for(let e=3;t.isNone()&&e>=0;e--){const n=BB(s,e),r=IB(n);t=G(o,e=>e.format===s||e.format===n||e.format===r)}return{matchOpt:t,size:s}},o=x(A.none),n=cB(e,"font_size_formats",lB.Space);return{tooltip:sB(e,EB,AB),text:A.some(AB),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getPreviewFor:o,getCurrentValue:()=>{const{matchOpt:e}=t();return e},onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontSize",!1,t.format)})},updateText:o=>{const{matchOpt:n,size:s}=t(),r=n.fold(x(s),e=>e.title);Nr(o,B_,{text:r}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:r})},dataset:n,shouldHide:!1,isInvalid:T}},RB="Format {0}",NB=(e,t)=>{const o="Paragraph";return{tooltip:sB(e,RB,o),text:A.some(o),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:_w(e),updateText:t=>{const n=e=>UE(e)?Y(e.items,n):WE(e)?[{title:e.title,format:e.format}]:[],s=Y($E(e),n),r=pB(e,x(s)).fold(x(o),e=>e.title);Nr(t,B_,{text:r}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:r})},shouldHide:kb(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},LB=x([ss("toggleClass"),ss("fetch"),zi("onExecute"),ws("getHotspot",A.some),ws("getAnchorOverrides",x({})),_c(),zi("onItemExecute"),gs("lazySink"),ss("dom"),Ni("onOpen"),xu("splitDropdownBehaviours",[yS,$p,ih]),ws("matchWidth",!1),ws("useMinWidth",!1),ws("eventOrder",{}),gs("role")].concat(NS())),zB=qu({factory:Xh,schema:[ss("dom")],name:"arrow",defaults:()=>({buttonBehaviours:El([ih.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(Lr)},buttonBehaviours:El([hh.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),VB=qu({factory:Xh,schema:[ss("dom")],name:"button",defaults:()=>({buttonBehaviours:El([ih.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(o=>{e.onExecute(o,t)})}})}),HB=x([zB,VB,Xu({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[ss("text")],name:"aria-descriptor"}),Yu({schema:[Ii()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each(n=>{e.onItemExecute(n,t,o)})}})}),TS()]),PB=Sm({name:"SplitDropdown",configFields:LB(),partFields:HB(),factory:(e,t,o,n)=>{const s=e=>{_m.getCurrent(e).each(e=>{Km.highlightFirst(e),$p.focusIn(e)})},r=t=>{DS(e,w,t,n,s,jh.HighlightMenuAndItem).get(b)},a=t=>{const o=lm(t,e,"button");return Lr(o),A.some(!0)},i={...Pr([Zr((t,o)=>{im(t,e,"aria-descriptor").each(e=>{const o=da("aria");Ot(e.element,"id",o),Ot(t.element,"aria-describedby",o)})})]),...vh(A.some(r))},l={repositionMenus:e=>{hh.isOn(e)&&RS(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:l,eventOrder:{...e.eventOrder,[gr()]:["disabling","toggling","alloy.base.behaviour"]},events:i,behaviours:Su(e.splitDropdownBehaviours,[yS.config({others:{sandbox:t=>{const o=lm(t,e,"arrow");return FS(e,t,{onOpen:()=>{hh.on(o),hh.on(t)},onClose:()=>{hh.off(o),hh.off(t)}})}}}),$p.config({mode:"special",onSpace:a,onEnter:a,onDown:e=>(r(e),A.some(!0))}),ih.config({}),hh.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),UB=e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setText:t=>Nr(e,B_,{text:t}),setIcon:t=>Nr(e,I_,{icon:t})}),WB=e=>({setActive:t=>{hh.set(e,t)},isActive:()=>hh.isOn(e),isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setText:t=>Nr(e,B_,{text:t}),setIcon:t=>Nr(e,I_,{icon:t})}),jB=(e,t)=>e.map(e=>({"aria-label":t.translate(e)})).getOr({}),GB=da("focus-button"),$B=(e,t,o,n,s,r)=>{const a=t.map(e=>Jh(D_(e,"tox-tbtn",s))),i=e.map(e=>Jh(M_(e,s.icons)));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:{...jB(o,s),...g(r)?{"data-mce-name":r}:{}}},components:Lx([i.map(e=>e.asSpec()),a.map(e=>e.asSpec())]),eventOrder:{[Gs()]:["focusing","alloy.base.behaviour",O_],[kr()]:[O_,"toolbar-group-button-events"]},buttonBehaviours:El([Dx(s.isDisabled),Ex(),oh(O_,[Zr((e,t)=>T_(e)),jr(B_,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[ai(s.translate(t.event.text))])})}),jr(I_,(e,t)=>{i.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[M_(t.event.icon,s.icons)])})}),jr(Gs(),(e,t)=>{t.event.prevent(),Rr(e,GB)})])].concat(n.getOr([])))}},qB=(e,t,o,n)=>{var s;const r=Ms(b),a=$B(e.icon,e.text,e.tooltip,A.none(),o,n);return Xh.sketch({dom:a.dom,components:a.components,eventOrder:__,buttonBehaviours:{...El([oh("toolbar-button-events",[(i={onAction:e.onAction,getApi:t.getApi},ta((e,t)=>{Bx(i,e)(t=>{Nr(e,k_,{buttonApi:t}),i.onAction(t)})})),Ix(t,r),Fx(t,r)]),...e.tooltip.map(t=>Cx.config(o.tooltips.getConfig({tooltipText:o.translate(t)+e.shortcut.map(e=>` (${Hx(e)})`).getOr("")}))).toArray(),Dx(()=>!e.enabled||o.isDisabled()),Ex()].concat(t.toolbarButtonBehaviours)),[O_]:null===(s=a.buttonBehaviours)||void 0===s?void 0:s[O_]}});var i},YB=(e,t,o,n)=>qB(e,{toolbarButtonBehaviours:o.length>0?[oh("toolbarButtonWith",o)]:[],getApi:UB,onSetup:e.onSetup},t,n),XB=(e,t,o,n)=>qB(e,{toolbarButtonBehaviours:[th.config({}),hh.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[oh("toolbarToggleButtonWith",o)]:[]),getApi:WB,onSetup:e.onSetup},t,n),KB=(e,t,o)=>n=>kS(e=>t.fetch(e)).map(s=>A.from(qS(vn(aS(da("menu-value"),s,o=>{t.onItemAction(e(n),o)},t.columns,t.presets,vv.CLOSE_ON_EXECUTE,t.select.getOr(T),o),{movement:lS(t.columns,t.presets),menuBehaviours:mx("auto"!==t.columns?[]:[Zr((e,o)=>{ux(e,4,Mv(t.presets)).each(({numRows:t,numColumns:o})=>{$p.setGridSize(e,t,o)})})])})))),JB=[{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"]}],ZB=(e,t)=>(o,n,s,r)=>{const a=e(o).mapError(e=>Zn(e)).getOrDie();return t(a,n,s,r)},QB={button:ZB(Ly,(e,t,o,n)=>((e,t,o)=>YB(e,t,[],o))(e,t.shared.providers,n)),togglebutton:ZB(Hy,(e,t,o,n)=>((e,t,o)=>XB(e,t,[],o))(e,t.shared.providers,n)),menubutton:ZB(wM,(e,t,o,n)=>hT(e,"tox-tbtn",t,A.none(),!1,n)),splitbutton:ZB(e=>Xn("SplitButton",SM,e),(e,t,o,n)=>((e,t,o)=>{const n=Ms(e.tooltip.getOr("")),s=e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setIconFill:(t,o)=>{yi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{Ot(e,"fill",o)})},setActive:t=>{Ot(e.element,"aria-pressed",t),yi(e.element,"span").each(o=>{e.getSystem().getByDom(o).each(e=>hh.set(e,t))})},isActive:()=>yi(e.element,"span").exists(t=>e.getSystem().getByDom(t).exists(hh.isOn)),setText:t=>yi(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Nr(e,B_,{text:t}))),setIcon:t=>yi(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Nr(e,I_,{icon:t}))),setTooltip:o=>{const s=t.providers.translate(o);Ot(e.element,"aria-label",s),n.set(o)}}),r=Ms(b),a={getApi:s,onSetup:e.onSetup};return PB.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...jB(e.tooltip,t.providers),...g(o)?{"data-mce-name":o}:{}}},onExecute:t=>{const o=s(t);o.isEnabled()&&e.onAction(o)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:El([Mx(t.providers.isDisabled),Ex(),oh("split-dropdown-events",[Zr((e,t)=>T_(e)),jr(GB,ih.focus),Ix(a,r),Fx(a,r)]),jC.config({}),...e.tooltip.map(e=>Cx.config({...t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e),onShow:o=>{if(n.get()!==e){const e=t.providers.translate(n.get());Cx.setComponents(o,t.providers.tooltips.getComponents({tooltipText:e}))}}})})).toArray()]),eventOrder:{[kr()]:["alloy.base.behaviour","split-dropdown-events","tooltipping"],[Or()]:["split-dropdown-events","tooltipping"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:KB(s,e,t.providers),parts:{menu:Nv(0,e.columns,e.presets)},components:[PB.parts.button($B(e.icon,e.text,A.none(),A.some([hh.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),PB.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:tb("chevron-down",t.providers.icons)},buttonBehaviours:El([Mx(t.providers.isDisabled),Ex(),ob()])}),PB.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})})(e,t.shared,n)),grouptoolbarbutton:ZB(e=>Xn("GroupToolbarButton",vM,e),(e,t,o,n)=>{const s=o.ui.registry.getAll().buttons,r={[kc]:t.shared.header.isPositionedAtTop()?Cc.TopToBottom:Cc.BottomToTop};if(Tb(o)===ib.floating)return((e,t,o,n,s)=>{const r=t.shared,a=Ms(b),i={toolbarButtonBehaviours:[],getApi:UB,onSetup:e.onSetup},l=[oh("toolbar-group-button-events",[Ix(i,a),Fx(i,a)])];return sD.sketch({lazySink:r.getSink,fetch:()=>kS(t=>{t(V(o(e.items),bD))}),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:$B(e.icon,e.text,e.tooltip,A.some(l),r.providers,s),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,e=>tI(o,{buttons:s,toolbar:e,allowToolbarGroups:!1},t,A.none()),r,n);throw new Error("Toolbar groups are only supported when using floating toolbar mode")})},eI={styles:(e,t)=>{const o={type:"advanced",...t.styles};return iB(e,t,NB(e,o),RB,"StylesTextUpdate","styles")},fontsize:(e,t)=>iB(e,t,FB(e),EB,"FontSizeTextUpdate","fontsize"),fontsizeinput:(e,t)=>((e,t,o,n)=>{let s=A.none();const r=Ow(e,"NodeChange SwitchMode",t=>{const n=t.getComponent();s=A.some(n),o.updateInputValue(n),Hm.set(n,!e.selection.isEditable())}),a=e=>({getComponent:x(e)}),i=Ms(b),l=da("custom-number-input-events"),c=(e,t,n)=>{const r=s.map(e=>yu.getValue(e)).getOr(""),a=o.getNewValue(r,e),i=r.length-`${a}`.length,l=s.map(e=>e.element.dom.selectionStart-i),c=s.map(e=>e.element.dom.selectionEnd-i);o.onAction(a,n),s.each(e=>{yu.setValue(e,a),t&&(l.each(t=>e.element.dom.selectionStart=t),c.each(t=>e.element.dom.selectionEnd=t))})},d=(e,t)=>c((e,t)=>e-t,e,t),u=(e,t)=>c((e,t)=>e+t,e,t),m=e=>it(e.element).fold(A.none,e=>(Nl(e),A.some(!0))),p=e=>zl(e.element)?(ut(e.element).each(e=>Nl(e)),A.some(!0)):A.none(),h=(o,n,s,r)=>{const i=Ms(b),l=t.shared.providers.translate(s),c=da("altExecuting"),d=Ow(e,"NodeChange SwitchMode",t=>{Hm.set(t.getComponent(),!e.selection.isEditable())}),u=e=>{Hm.isDisabled(e)||o(!0)};return Xh.sketch({dom:{tag:"button",attributes:{"aria-label":l,"data-mce-name":n},classes:r.concat(n)},components:[A_(n,t.shared.providers.icons)],buttonBehaviours:El([Hm.config({}),Cx.config(t.shared.providers.tooltips.getConfig({tooltipText:l})),oh(c,[Ix({onSetup:d,getApi:a},i),Fx({getApi:a},i),jr(Zs(),(e,t)=>{t.event.raw.keyCode!==TB.space()&&t.event.raw.keyCode!==TB.enter()||Hm.isDisabled(e)||o(!1)}),jr(or(),u),jr(Ws(),u)])]),eventOrder:{[Zs()]:[c,"keying"],[or()]:[c,"alloy.base.behaviour"],[Ws()]:[c,"alloy.base.behaviour"],[kr()]:["alloy.base.behaviour",c,"tooltipping"],[Or()]:[c,"tooltipping"]}})},f=Jh(h(e=>d(!1,e),"minus","Decrease font size",[])),v=Jh(h(e=>u(!1,e),"plus","Increase font size",[])),y=Jh({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[Pv.sketch({inputBehaviours:El([Hm.config({}),oh(l,[Ix({onSetup:r,getApi:a},i),Fx({getApi:a},i)]),oh("input-update-display-text",[jr(B_,(e,t)=>{yu.setValue(e,t.event.text)}),jr(Js(),e=>{o.onAction(yu.getValue(e))}),jr(tr(),e=>{o.onAction(yu.getValue(e))})]),$p.config({mode:"special",onEnter:e=>(c(w,!0,!0),A.some(!0)),onEscape:m,onUp:e=>(u(!0,!1),A.some(!0)),onDown:e=>(d(!0,!1),A.some(!0)),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})],behaviours:El([ih.config({}),$p.config({mode:"special",onEnter:p,onSpace:p,onEscape:m}),oh("input-wrapper-events",[jr(Xs(),e=>{H([f,v],t=>{const o=ze(t.get(e).element.dom);zl(o)&&Ll(o)})})])])});return{dom:{tag:"div",classes:["tox-number-input"],attributes:{...g(n)?{"data-mce-name":n}:{}}},components:[f.asSpec(),y.asSpec(),v.asSpec()],behaviours:El([ih.config({}),$p.config({mode:"flow",focusInside:yg.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>zl(e.element)?A.none():(Nl(e.element),A.some(!0))})])}})(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>Nr(e,B_,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{_B(o,["unsupportedLength","empty"]);const s=t(),r=_B(o,["unsupportedLength","empty"]).or(_B(s,["unsupportedLength","empty"])),a=r.map(e=>e.value).getOr(16),i=zb(e),l=r.map(e=>e.unit).filter(e=>""!==e).getOr(i),c=n(a,(e=>{var t;return null!==(t={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[e])&&void 0!==t?t:{step:1}})(l).step),d=`${(e=>e>=0)(c)?c:a}${l}`;return d!==s&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e),"fontsizeinput"),fontfamily:(e,t)=>iB(e,t,CB(e),vB,"FontFamilyTextUpdate","fontfamily"),blocks:(e,t)=>iB(e,t,bB(e),hB,"BlocksTextUpdate","blocks"),align:(e,t)=>iB(e,t,gB(e),dB,"AlignTextUpdate","align")},tI=(e,t,o,n)=>{const s=(e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=V(JB,t=>{const o=U(t.items,t=>ve(e,t)||ve(eI,t));return{name:t.name,items:o}});return U(t,e=>e.items.length>0)})(o):r(t)?(e=>{const t=e.split("|");return V(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[]"),[])})(t),a=V(s,s=>{const r=Y(s.items,s=>0===s.trim().length?[]:((e,t,o,n,s,r)=>be(t,o.toLowerCase()).orThunk(()=>r.bind(e=>re(e,e=>be(t,e+o.toLowerCase())))).fold(()=>be(eI,o.toLowerCase()).map(t=>t(e,s)),t=>"grouptoolbarbutton"!==t.type||n?((e,t,o,n)=>be(QB,e.type).fold(()=>(console.error("skipping button defined by",e),A.none()),s=>A.some(s(e,t,o,n))))(t,s,e,o.toLowerCase()):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),A.none())))(e,t.buttons,s,t.allowToolbarGroups,o,n).toArray());return{title:A.from(e.translate(s.name)),items:r}});return U(a,e=>e.items.length>0)},oI=(e,t,o,n)=>{const s=t.mainUi.outerContainer,a=o.toolbar,i=o.buttons;if(f(a,r)){const t=a.map(t=>{const s={toolbar:t,buttons:i,allowToolbarGroups:o.allowToolbarGroups};return tI(e,s,n,A.none())});qD.setToolbars(s,t)}else qD.setToolbar(s,tI(e,o,n,A.none()))},nI=Io(),sI=nI.os.isiOS()&&nI.os.version.major<=12;var rI=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=t,i=Ms(0),l=r.outerContainer;oB(e);const d=ze(s.targetNode),u=vt(bt(d));Hd(d,r.mothership),((e,t,o)=>{mv(e)&&Hd(o.mainUi.mothership.element,o.popupUi.mothership),Vd(t,o.dialogUi.mothership)})(e,u,t),e.on("SkinLoaded",()=>{qD.setSidebar(l,o.sidebar,Xb(e)),oI(e,t,o,n),i.set(e.getWin().innerWidth),qD.setMenubar(l,KD(e,o)),qD.setViews(l,o.views),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let s=e.getWin();const r=e.getDoc().documentElement,a=Ms(Yt(s.innerWidth,s.innerHeight)),i=Ms(Yt(r.offsetWidth,r.offsetHeight)),l=()=>{const t=a.get();t.left===s.innerWidth&&t.top===s.innerHeight||(a.set(Yt(s.innerWidth,s.innerHeight)),yw(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set(Yt(t.offsetWidth,t.offsetHeight)),yw(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(s,"resize",l),n.bind(s,"scroll",d);const u=ic(ze(e.getBody()),"load",c);e.on("hide",()=>{H(o,e=>{It(e.element,"display","none")})}),e.on("show",()=>{H(o,e=>{Pt(e.element,"display")})}),e.on("NodeChange",c),e.on("remove",()=>{u.unbind(),n.unbind(s,"resize",l),n.unbind(s,"scroll",d),s=null})})(e,t)});const m=qD.getSocket(l).getOrDie("Could not find expected socket element");if(sI){Ft(m.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=(e=>{let t=null;return{cancel:()=>{c(t)||(clearTimeout(t),t=null)},throttle:(...o)=>{c(t)&&(t=setTimeout(()=>{t=null,e.apply(null,o)},20))}}})(()=>{e.dispatch("ScrollContent")}),o=ac(m.element,"scroll",t.throttle);e.on("remove",o.unbind)}Tx(e,t),e.addCommand("ToggleSidebar",(t,o)=>{qD.toggleSidebar(l,o),e.dispatch("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",()=>{var e;return null!==(e=qD.whichSidebar(l))&&void 0!==e?e:""}),e.addCommand("ToggleView",(t,o)=>{if(qD.toggleView(l,o)){const t=l.element;r.mothership.broadcastOn([eu()],{target:t}),H(a,e=>{e.broadcastOn([eu()],{target:t})}),c(qD.whichView(l))&&(e.focus(),e.nodeChanged(),qD.refreshToolbar(l))}}),e.addQueryValueHandler("ToggleView",()=>{var e;return null!==(e=qD.whichView(l))&&void 0!==e?e:""});const g=Tb(e);g!==ib.sliding&&g!==ib.floating||e.on("ResizeWindow ResizeEditor ResizeContent",()=>{const o=e.getWin().innerWidth;o!==i.get()&&(qD.refreshToolbar(t.mainUi.outerContainer),i.set(o))});const p={setEnabled:e=>{_x(t,!e)},isEnabled:()=>!Hm.isDisabled(l)};return{iframeContainer:m.element.dom,editorContainer:l.element.dom,api:p}}});const aI=e=>/^[0-9\.]+(|px)$/i.test(""+e)?A.some(parseInt(""+e,10)):A.none(),iI=e=>h(e)?e+"px":e,lI=(e,t,o)=>{const n=t.filter(t=>e<t),s=o.filter(t=>e>t);return n.or(s).getOr(e)},cI=e=>{const t=bb(e),o=vb(e),n=xb(e);return aI(t).map(e=>lI(e,o,n))},{ToolbarLocation:dI,ToolbarMode:uI}=fv,mI=(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=o,i=cb.DOM,l=lv(e),c=uv(e),d=xb(e).or(cI(e)),u=n.shared.header,m=u.isPositionedAtTop,g=Tb(e),p=g===uI.sliding||g===uI.floating,h=Ms(!1),f=()=>h.get()&&!e.removed,b=e=>p?e.fold(x(0),e=>e.components().length>1?Gt(e.components()[1].element):0):0,v=()=>{H(a,e=>{e.broadcastOn([tu()],{})})},y=o=>{if(!f())return;l||s.on(e=>{const o=d.getOrThunk(()=>{const e=aI(Nt(St(),"margin-left")).getOr(0);return Qt(St())-Kt(t).left+e});It(e.element,"max-width",o+"px")});const n=!(l||l||!(Kt(r.outerContainer.element).left+eo(r.outerContainer.element)>=window.innerWidth-40||zt(r.outerContainer.element,"width").isSome())||(It(r.outerContainer.element,"position","absolute"),It(r.outerContainer.element,"left","0px"),Pt(r.outerContainer.element,"width"),0));p&&qD.refreshToolbar(r.outerContainer),l||(o=>{s.on(n=>{const s=qD.getToolbar(r.outerContainer),a=b(s),i=Qo(t),l=((e,t)=>mv(e)?RA(t):A.none())(e,r.outerContainer.element),c=l.fold(()=>i.x,e=>{const t=Qo(e);return et(e,St())?i.x:i.x-t.x}),d=ke(o,Math.ceil(r.outerContainer.element.dom.getBoundingClientRect().width)).filter(e=>e>150).map(e=>{const t=jo(),o=window.innerWidth-(c-t.left),n=Math.max(Math.min(e,o),150);return o<e&&It(r.outerContainer.element,"width",n+"px"),{width:n+"px"}}).getOr({}),u={position:"absolute",left:Math.round(c)+"px",top:l.fold(()=>m()?Math.max(i.y-Gt(n.element)+a,0):i.bottom,e=>{var t;const o=Qo(e),s=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,r=et(e,St())?Math.max(i.y-Gt(n.element)+a,0):i.y-o.y+s-Gt(n.element)+a;return m()?r:i.bottom})+"px"};Ft(r.outerContainer.element,{...u,...d})})})(n),c&&s.on(o),v()},w=()=>!(l||!c||!f())&&s.get().exists(o=>{const n=u.getDockingMode(),a=(o=>{switch(Ab(e)){case dI.auto:const e=qD.getToolbar(r.outerContainer),n=b(e),s=Gt(o.element)-n,a=Qo(t);if(a.y>s)return"top";{const e=st(t),o=Math.max(e.dom.scrollHeight,Gt(e));return a.bottom<o-s||on().bottom<a.bottom-s?"bottom":"top"}case dI.bottom:return"bottom";case dI.top:default:return"top"}})(o);return a!==n&&(i=a,s.on(e=>{iM.setModes(e,[i]),u.setDockingMode(i);const t=m()?Cc.TopToBottom:Cc.BottomToTop;Ot(e.element,kc,t)}),!0);var i});return{isVisible:f,isPositionedAtTop:m,show:()=>{h.set(!0),It(r.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),H(a,e=>{Pt(e.element,"display")}),w(),mv(e)?y(e=>iM.isDocked(e)?iM.reset(e):iM.refresh(e)):y(iM.refresh)},hide:()=>{h.set(!1),It(r.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),H(a,e=>{It(e.element,"display","none")})},update:y,updateMode:()=>{w()&&y(iM.reset)},repositionPopups:v}},gI=(e,t)=>{const o=Qo(e);return{pos:t?o.y:o.bottom,bounds:o}};var pI=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r}=t,a=sc(),i=ze(s.targetNode),l=mI(e,i,t,n,a),c=Bb(e);nB(e);const d=()=>{if(a.isSet())return void l.show();a.set(qD.getHeader(r.outerContainer).getOrDie());const s=cv(e);mv(e)?(Hd(i,r.mothership),Hd(i,t.popupUi.mothership)):Vd(s,r.mothership),Vd(s,t.dialogUi.mothership);const d=()=>{oI(e,t,o,n),qD.setMenubar(r.outerContainer,KD(e,o)),l.show(),((e,t,o,n)=>{const s=Ms(gI(t,o.isPositionedAtTop())),r=n=>{const{pos:r,bounds:a}=gI(t,o.isPositionedAtTop()),{pos:i,bounds:l}=s.get(),c=a.height!==l.height||a.width!==l.width;s.set({pos:r,bounds:a}),c&&yw(e,n),o.isVisible()&&(i!==r?o.update(iM.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",()=>o.update(iM.reset)),e.on("NodeChange keydown",e=>{requestAnimationFrame(()=>r(e))});let a=0;const i=t_(()=>o.update(iM.refresh),33);e.on("ScrollWindow",()=>{const e=jo().left;e!==a&&(a=e,i.throttle()),o.updateMode()}),mv(e)&&e.on("ElementScroll",e=>{o.update(iM.refresh)});const l=nc();l.set(ic(ze(e.getBody()),"load",e=>r(e.raw))),e.on("remove",()=>{l.clear()})})(e,i,l,c),e.nodeChanged()};c?e.once("SkinLoaded",d):d()};e.on("show",d),e.on("hide",l.hide),c||(e.on("focus",d),e.on("blur",l.hide)),e.on("init",()=>{(e.hasFocus()||c)&&d()}),Tx(e,t);const u={show:d,hide:l.hide,setEnabled:e=>{_x(t,!e)},isEnabled:()=>!Hm.isDisabled(r.outerContainer)};return{editorContainer:r.outerContainer.element.dom,api:u}}});const hI="contexttoolbar-hide",fI=(e,t)=>jr(k_,(o,n)=>{const s=(e=>({hide:()=>Rr(e,br()),getValue:()=>yu.getValue(e)}))(e.get(o));t.onAction(s,n.event.buttonApi)}),bI=(e,t)=>{const o=e.label.fold(()=>({}),e=>({"aria-label":e})),n=Jh(Pv.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:e.initValue(),inputAttributes:o,selectOnFocus:!0,inputBehaviours:El([$p.config({mode:"special",onEnter:e=>s.findPrimary(e).map(e=>(Lr(e),!0)),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})),s=((e,t,o)=>{const n=V(t,t=>Jh(((e,t,o)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o)=>{const{primary:n,...s}=t.original,r=Kn(Hy({...s,type:"togglebutton",onAction:b}));return XB(r,o,[fI(e,t)])})(e,t,o):((e,t,o)=>{const{primary:n,...s}=t.original,r=Kn(Ly({...s,type:"button",onAction:b}));return YB(r,o,[fI(e,t)])})(e,t,o))(e,t,o)));return{asSpecs:()=>V(n,e=>e.asSpec()),findPrimary:e=>re(t,(t,o)=>t.primary?A.from(n[o]).bind(t=>t.getOpt(e)).filter(k(Hm.isDisabled)):A.none())}})(n,e.commands,t);return[{title:A.none(),items:[n.asSpec()]},{title:A.none(),items:s.asSpecs()}]},vI=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,yI=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=gt(ze(e.startContainer),e.startOffset).element;return(qe(o)?at(o):A.some(o)).filter($e).map(e=>e.dom.getBoundingClientRect()).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=jo();return Zo(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=en(ze(e.getBody()));return Zo(o.x+t.left,o.y+t.top,t.width,t.height)}},xI=(e,t,o,n=0)=>{const s=qo(window),r=Qo(ze(e.getContentAreaContainer())),a=Qb(e)||nv(e)||rv(e),{x:i,width:l}=((e,t,o)=>{const n=Math.max(e.x+o,t.x);return{x:n,width:Math.min(e.right-o,t.right)-n}})(r,s,n);if(e.inline&&!a)return Zo(i,s.y,l,s.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,s,r)=>{const a=ze(e.getContainer()),i=yi(a,".tox-editor-header").getOr(a),l=Qo(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+r,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-r,o.bottom)};const u="line"===s?Qo(a):t;return d?{y:Math.max(l.bottom+r,o.y),bottom:Math.min(u.bottom-r,o.bottom)}:{y:Math.max(u.y+r,o.y),bottom:Math.min(l.y-r,o.bottom)}})(e,r,s,a,o,n);return Zo(i,c,l,d-c)}},wI={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"]},SI={maxHeightFunction:pc(),maxWidthFunction:JM()},CI=e=>"node"===e,kI=(e,t,o,n,s)=>{const r=yI(e),a=n.lastElement().exists(e=>et(o,e));return((e,t)=>{const o=e.selection.getRng(),n=gt(ze(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&et(n.element,t)})(e,o)?a?TE:SE:a?((e,o)=>{const s=zt(e,"position");It(e,"position",o);const a=vI(r,Qo(t),-20)&&!n.isReposition()?AE:TE;return s.each(t=>It(e,"position",t)),a})(t,n.getMode()):("fixed"===n.getMode()?s.y+jo().top:s.y)+(Gt(t)+12)<=r.y?SE:CE},OI=(e,t,o,n)=>{const s=t=>(n,s,r,a,i)=>({...kI(e,a,t,o,i)({...n,y:i.y,height:i.height},s,r,a,i),alwaysFit:!0}),r=e=>CI(n)?[s(e)]:[];return t?{onLtr:e=>[pl,cl,dl,ul,ml,gl].concat(r(e)),onRtl:e=>[pl,dl,cl,ml,ul,gl].concat(r(e))}:{onLtr:e=>[gl,pl,ul,cl,ml,dl].concat(r(e)),onRtl:e=>[gl,pl,ml,dl,ul,cl].concat(r(e))}},_I=(e,t)=>{const o=U(t,t=>t.predicate(e.dom)),{pass:n,fail:s}=P(o,e=>"contexttoolbar"===e.type);return{contextToolbars:n,contextForms:s}},TI=(e,t)=>{const o={},n=[],s=[],r={},a={},i=ae(e);return H(i,i=>{const l=e[i];"contextform"===l.type?((e,i)=>{const l=Kn(Xn("ContextForm",qy,i));o[e]=l,l.launch.map(o=>{r["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}}),"editor"===l.scope?s.push(l):n.push(l),a[e]=l})(i,l):"contexttoolbar"===l.type&&((e,t)=>{var o;(o=t,Xn("ContextToolbar",Yy,o)).each(o=>{"editor"===t.scope?s.push(o):n.push(o),a[e]=o})})(i,l)}),{forms:o,inNodeScope:n,inEditorScope:s,lookupTable:a,formNavigators:r}},EI=da("forward-slide"),AI=da("backward-slide"),MI=da("change-slide-event"),DI="tox-pop--resizing",BI="tox-pop--transition",II=(e,t,o,n)=>{const s=n.backstage,r=s.shared,a=Io().deviceType.isTouch,i=sc(),l=sc(),c=sc(),d=di((e=>{const t=Ms([]);return qh.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),qh.getContent(e).each(e=>{Pt(e.element,"visibility")}),$a(e.element,DI),Pt(e.element,"width")},inlineBehaviours:El([oh("context-toolbar-events",[Jr(sr(),(e,t)=>{"width"===t.event.raw.propertyName&&($a(e.element,DI),Pt(e.element,"width"))}),jr(MI,(e,t)=>{const o=e.element;Pt(o,"width");const n=Qt(o);qh.setContent(e,t.event.contents),ja(o,DI);const s=Qt(o);It(o,"width",n+"px"),qh.getContent(e).each(e=>{t.event.focus.bind(e=>(Nl(e),Hl(o))).orThunk(()=>($p.focusIn(e),Vl(bt(o))))}),setTimeout(()=>{It(e.element,"width",s+"px")},0)}),jr(EI,(e,o)=>{qh.getContent(e).each(o=>{t.set(t.get().concat([{bar:o,focus:Vl(bt(e.element))}]))}),Nr(e,MI,{contents:o.event.forwardContents,focus:A.none()})}),jr(AI,(e,o)=>{ne(t.get()).each(o=>{t.set(t.get().slice(0,t.get().length-1)),Nr(e,MI,{contents:ui(o.bar),focus:o.focus})})})]),$p.config({mode:"special",onEscape:o=>ne(t.get()).fold(()=>e.onEscape(),e=>(Rr(o,AI),A.some(!0)))})]),lazySink:()=>an.value(e.sink)})})({sink:o,onEscape:()=>(e.focus(),A.some(!0))})),u=()=>{const t=c.get().getOr("node"),o=CI(t)?1:0;return xI(e,r,t,o)},m=()=>!(e.removed||a()&&s.isContextMenuOpen()),g=()=>{if(m()){const t=u(),o=xe(c.get(),"node")?((e,t)=>t.filter(e=>wt(e)&&Ge(e)).map(en).getOrThunk(()=>yI(e)))(e,i.get()):yI(e);return t.height<=0||!vI(o,t,.01)}return!0},p=()=>{i.clear(),l.clear(),c.clear(),qh.hide(d)},h=()=>{if(qh.isOpen(d)){const e=d.element;Pt(e,"display"),g()?It(e,"display","none"):(l.set(0),qh.reposition(d))}},f=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:El([$p.config({mode:"acyclic"}),oh("pop-dialog-wrap-events",[Zr(t=>{e.shortcuts.add("ctrl+F9","focus statusbar",()=>$p.focusIn(t))}),Qr(t=>{e.shortcuts.remove("ctrl+F9")})])])}),v=to(()=>TI(t,e=>{const t=y([e]);Nr(d,EI,{forwardContents:f(t)})})),y=t=>{const{buttons:o}=e.ui.registry.getAll(),s={...o,...v().formNavigators},a=Tb(e)===ib.scrolling?ib.scrolling:ib.default,i=q(V(t,t=>"contexttoolbar"===t.type?((t,o)=>tI(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,A.some(["form:"])))(s,t):((e,t)=>bI(e,t))(t,r.providers)));return SD({type:a,uid:da("context-toolbar"),initGroups:i,onEscape:A.none,cyclicKeying:!0,providers:r.providers})},x=(t,n)=>{if(S.cancel(),!m())return;const s=y(t),p=t[0].position,h=((t,n)=>{const s="node"===t?r.anchors.node(n):r.anchors.cursor(),c=((e,t,o,n)=>"line"===t?{bubble:vc(12,0,wI),layouts:{onLtr:()=>[hl],onRtl:()=>[fl]},overrides:SI}:{bubble:vc(0,12,wI,1/12),layouts:OI(e,o,n,t),overrides:SI})(e,t,a(),{lastElement:i.get,isReposition:()=>xe(l.get(),0),getMode:()=>Td.getMode(o)});return vn(s,c)})(p,n);c.set(p),l.set(1);const b=d.element;Pt(b,"display"),(e=>xe(Se(e,i.get(),et),!0))(n)||($a(b,BI),Td.reset(o,d)),qh.showWithinBounds(d,f(s),{anchor:h,transition:{classes:[BI],mode:"placement"}},()=>A.some(u())),n.fold(i.clear,i.set),g()&&It(b,"display","none")};let w=!1;const S=t_(()=>{!e.hasFocus()||e.removed||w||(qa(d.element,BI)?S.throttle():((e,t)=>{const o=ze(t.getBody()),n=e=>et(e,o),s=ze(t.selection.getNode());return(e=>!n(e)&&!tt(o,e))(s)?A.none():((e,t,o)=>{const n=_I(e,t);if(n.contextForms.length>0)return A.some({elem:e,toolbars:[n.contextForms[0]]});{const t=_I(e,o);if(t.contextForms.length>0)return A.some({elem:e,toolbars:[t.contextForms[0]]});if(n.contextToolbars.length>0||t.contextToolbars.length>0){const o=(e=>{if(e.length<=1)return e;{const t=t=>N(e,e=>e.position===t),o=t=>U(e,e=>e.position===t),n=t("selection"),s=t("node");if(n||s){if(s&&n){const e=o("node"),t=V(o("selection"),e=>({...e,position:"node"}));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return A.some({elem:e,toolbars:o})}return A.none()}})(s,e.inNodeScope,e.inEditorScope).orThunk(()=>((e,t,o)=>e(t)?A.none():Rs(t,e=>{if($e(e)){const{contextToolbars:t,contextForms:n}=_I(e,o.inNodeScope),s=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>G(e,e=>e.position===t);return t("selection").orThunk(()=>t("node")).orThunk(()=>t("line")).map(e=>e.position).fold(()=>[],t=>U(e,e=>e.position===t))}})(t);return s.length>0?A.some({elem:e,toolbars:s}):A.none()}return A.none()},e))(n,s,e))})(v(),e).fold(p,e=>{x(e.toolbars,A.some(e.elem))}))},17);e.on("init",()=>{e.on("remove",p),e.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",h),e.on("click keyup focus SetContent",S.throttle),e.on(hI,p),e.on("contexttoolbar-show",t=>{const o=v();be(o.lookupTable,t.toolbarKey).each(o=>{x([o],ke(t.target!==e,t.target)),qh.getContent(d).each($p.focusIn)})}),e.on("focusout",t=>{Yh.setEditorTimeout(e,()=>{Hl(o.element).isNone()&&Hl(d.element).isNone()&&p()},0)}),e.on("SwitchMode",()=>{e.mode.isReadOnly()&&p()}),e.on("ExecCommand",({command:e})=>{"toggleview"===e.toLowerCase()&&p()}),e.on("AfterProgressState",t=>{t.state?p():e.hasFocus()&&S.throttle()}),e.on("dragstart",()=>{w=!0}),e.on("dragend drop",()=>{w=!1}),e.on("NodeChange",e=>{Hl(d.element).fold(S.throttle,b)})})},FI=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),s=sc();return V(o,o=>({type:"togglemenuitem",text:t.display(o),onSetup:r=>{const a=e=>{e&&(s.on(e=>e.setActive(!1)),s.set(r)),r.setActive(e)};a(xe(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{s.clear(),i()}},onAction:()=>t.setCurrent(e,o)}))};e.ui.registry.addMenuButton(t.name,{tooltip:t.text,icon:t.icon,fetch:e=>e(o()),onSetup:t.onToolbarSetup}),e.ui.registry.addNestedMenuItem(t.name,{type:"nestedmenuitem",text:t.text,getSubmenuItems:o,onSetup:t.onMenuSetup})},RI=e=>{FI(e,(e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:ov,hash:e=>(e=>_B(e,["fixed","relative","empty"]).map(({value:e,unit:t})=>e+t))(e).getOr(e),display:w,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>A.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:Cw(e),onMenuSetup:Cw(e)}))(e)),(e=>A.from(Ob(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=ze(e.selection.getNode());return Ns(t,e=>A.some(e).filter($e).bind(e=>Et(e,"lang").map(t=>({code:t,customCode:Et(e,"data-mce-lang").getOrUndefined(),title:""}))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=nc();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),Sw(o.clear,Cw(e)(t))},onMenuSetup:Cw(e)})))(e).each(t=>FI(e,t))},NI=e=>Ow(e,"NodeChange",t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())}),LI=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),Sw(()=>e.off("PastePlainTextToggle",n),Cw(e)(o))},zI=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},VI=e=>{(e=>{(e=>{e_.each([{name:"bold",text:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],(t,o)=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:kw(e,t.name),onAction:zI(e,t.name),shortcut:t.shortcut})});for(let t=1;t<=6;t++){const o="h"+t,n=`Alt+Shift+${t}`;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:kw(e,o),onAction:zI(e,o),shortcut:n})}})(e),(e=>{e_.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"help",text:"Help",action:"mceHelp",icon:"help",shortcut:"Alt+0"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:Tw(e,t.action),shortcut:t.shortcut})}),e_.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:Cw(e),onAction:Tw(e,t.action)})})})(e),(e=>{e_.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:Tw(e,t.action),onSetup:kw(e,t.name)})})})(e)})(e),(e=>{e_.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:Tw(e,t.action)})}),e_.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:Cw(e),onAction:Tw(e,t.action)})}),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:Cw(e),onAction:zI(e,"code")})})(e)},HI=(e,t)=>Ow(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())}),PI=e=>Ow(e,"VisualAid",t=>{t.setActive(e.hasVisual)}),UI=(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:Tw(e,t.cmd),onSetup:kw(e,t.name)})}),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:Cw(e),onAction:Tw(e,"JustifyNone")})})(e),VI(e),((e,t)=>{((e,t)=>{const o=aB(t,gB(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:Cw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=aB(t,CB(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:Cw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=aB(t,NB(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:Cw(e),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=aB(t,bB(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:Cw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=aB(t,FB(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:Cw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)})(e,t),(e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:HI(e,"hasUndo"),onAction:Tw(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:HI(e,"hasRedo"),onAction:Tw(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:HI(e,"hasUndo"),onAction:Tw(e,"undo"),shortcut:"Meta+Z"}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:HI(e,"hasRedo"),onAction:Tw(e,"redo"),shortcut:"Meta+Y"})})(e)})(e),(e=>{(e=>{e.addCommand("mceApplyTextcolor",(t,o)=>{((e,t,o)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.apply(t,{value:o}),e.nodeChanged()})})(e,t,o)}),e.addCommand("mceRemoveTextcolor",t=>{((e,t)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.remove(t,{value:null},void 0,!0),e.nodeChanged()})})(e,t)})})(e);const t=$w(e),o=qw(e),n=Ms(t),s=Ms(o);nS(e,"forecolor","forecolor",n),nS(e,"backcolor","hilitecolor",s),sS(e,"forecolor","forecolor","Text color",n),sS(e,"backcolor","hilitecolor","Background color",s)})(e),(e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:Tw(e,"mceToggleVisualAid")})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:PI(e),onAction:Tw(e,"mceToggleVisualAid")})})(e)})(e),(e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:NI(e),onAction:Tw(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:Cw(e),onAction:Tw(e,"indent")})})(e)})(e),RI(e),(e=>{const t=Ms(Yb(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:LI(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:LI(e,t)})})(e)},WI=e=>r(e)?e.split(/[ ,]/):e,jI=e=>t=>t.options.get(e),GI=jI("contextmenu_never_use_native"),$I=jI("contextmenu_avoid_overlap"),qI=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))},YI=(e,t)=>({type:"makeshift",x:e,y:t}),XI=e=>"longpress"===e.type||0===e.type.indexOf("touch"),KI=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(XI(e)){const t=e.touches[0];return YI(t.pageX,t.pageY)}return YI(e.pageX,e.pageY)})(t):((e,t)=>{const o=cb.DOM.getPos(e);return((e,t,o)=>YI(e.x+t,e.y+o))(t,o.x,o.y)})(e.getContentAreaContainer(),(e=>{if(XI(e)){const t=e.touches[0];return YI(t.clientX,t.clientY)}return YI(e.clientX,e.clientY)})(t)):JI(e),JI=e=>({type:"selection",root:ze(e.selection.getNode())}),ZI=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:A.some(ze(e.selection.getNode())),root:ze(e.getBody())}))(e);case"point":return KI(e,t);case"selection":return JI(e)}},QI=(e,t,o,n,s,r)=>{const a=o(),i=ZI(e,t,r);z_(a,vv.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:A.none()}).map(e=>{t.preventDefault(),qh.showMenuAt(s,{anchor:i},{menu:{markers:Iv("normal")},data:e})})},eF={onLtr:()=>[pl,cl,dl,ul,ml,gl,SE,CE,wE,yE,xE,vE],onRtl:()=>[pl,dl,cl,ml,ul,gl,SE,CE,xE,vE,wE,yE]},tF={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"]},oF=(e,t,o,n,s,r)=>{const a=Io(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),u=()=>{const a=o();((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>{const n=ZI(e,t,o);return{bubble:vc(0,"point"===o?12:0,tF),layouts:eF,overrides:{maxWidthFunction:JM(),maxHeightFunction:pc()},...n}})(e,t,r);z_(o,vv.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:A.none()}).map(o=>{t.preventDefault();const l=a?jh.HighlightMenuAndItem:jh.HighlightNone;qh.showMenuWithinBounds(s,{anchor:i},{menu:{markers:Iv("normal"),highlightOnOpen:l},data:o,type:"horizontal"},()=>A.some(xI(e,n.shared,"node"===r?"node":"selection"))),e.dispatch(hI)})})(e,t,a,n,s,r,!(c||i||l&&d))};if((l||i)&&"node"!==r){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{Yh.setEditorTimeout(e,()=>{e.selection.setRng(t)},10),r()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const s=()=>r();e.once("longpresscancel",s);const r=()=>{e.off("touchend",o),e.off("longpresscancel",s),e.off("mousedown",n)}})(e),u()};((e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],s=o.getRng();return od(e.getWin(),Gc.domRange(s)).exists(e=>e.left<=n.clientX&&e.right>=n.clientX&&e.top<=n.clientY&&e.bottom>=n.clientY)}})(e,t)?o():(e.once("selectionchange",o),e.once("touchend",()=>e.off("selectionchange",o)))}else u()},nF=e=>r(e)?"|"===e:"separator"===e.type,sF={type:"separator"},rF=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(r(e))return e;switch(e.type){case"separator":return sF;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return r(t)?t:V(t,rF)}};default:const o=e;return{type:"menuitem",...t(o),onAction:v(o.onAction)}}},aF=(e,t)=>{if(0===t.length)return e;const o=ne(e).filter(e=>!nF(e)).fold(()=>[],e=>[sF]);return e.concat(o).concat(t).concat([sF])},iF=(e,t)=>!(e=>"longpress"===e.type||ve(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),lF=(e,t)=>iF(e,t)?e.selection.getStart(!0):t.target,cF=(e,t,o)=>{const n=Io().deviceType.isTouch,s=di(qh.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:El([oh("dismissContextMenu",[jr(_r(),(t,o)=>{Qd.close(t),e.focus()})])])})),a=()=>qh.hide(s),i=t=>{if(GI(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!GI(e))(e,t)||(e=>0===qI(e).length)(e))return;const a=((e,t)=>{const o=$I(e),n=iF(e,t)?"selection":"point";if(De(o)){const s=lF(e,t);return tC(ze(s),o)?"node":n}return n})(e,t);(n()?oF:QI)(e,t,()=>{const o=lF(e,t),n=e.ui.registry.getAll(),s=qI(e);return((e,t,o)=>{const n=j(t,(t,n)=>be(e,n.toLowerCase()).map(e=>{const n=e.update(o);if(r(n)&&De(Me(n)))return aF(t,n.split(" "));if(l(n)&&n.length>0){const e=V(n,rF);return aF(t,e)}return t}).getOrThunk(()=>t.concat([n])),[]);return n.length>0&&nF(n[n.length-1])&&n.pop(),n})(n.contextMenus,s,o)},o,s,a)};e.on("init",()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)})},dF=Ds([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),uF=e=>t=>t.translate(-e.left,-e.top),mF=e=>t=>t.translate(e.left,e.top),gF=e=>(t,o)=>j(e,(e,t)=>t(e),Yt(t,o)),pF=(e,t,o)=>e.fold(gF([mF(o),uF(t)]),gF([uF(t)]),gF([])),hF=(e,t,o)=>e.fold(gF([mF(o)]),gF([]),gF([mF(t)])),fF=(e,t,o)=>e.fold(gF([]),gF([uF(o)]),gF([mF(t),uF(o)])),bF=(e,t,o)=>{const n=e.fold((e,t)=>({position:A.some("absolute"),left:A.some(e+"px"),top:A.some(t+"px")}),(e,t)=>({position:A.some("absolute"),left:A.some(e-o.left+"px"),top:A.some(t-o.top+"px")}),(e,t)=>({position:A.some("fixed"),left:A.some(e+"px"),top:A.some(t+"px")}));return{right:A.none(),bottom:A.none(),...n}},vF=(e,t,o,n)=>{const s=(e,s)=>(r,a)=>{const i=e(t,o,n);return s(r.getOr(i.left),a.getOr(i.top))};return e.fold(s(fF,yF),s(hF,xF),s(pF,wF))},yF=dF.offset,xF=dF.absolute,wF=dF.fixed,SF=(e,t)=>{const o=Tt(e,t);return u(o)?NaN:parseInt(o,10)},CF=(e,t,o,n,s,r)=>{const a=((e,t,o,n)=>((e,t)=>{const o=e.element,n=SF(o,t.leftAttr),s=SF(o,t.topAttr);return isNaN(n)||isNaN(s)?A.none():A.some(Yt(n,s))})(e,t).fold(()=>o,e=>wF(e.left+n.left,e.top+n.top)))(e,t,o,n),i=t.mustSnap?OF(e,t,a,s,r):_F(e,t,a,s,r),l=pF(a,s,r);return((e,t,o)=>{const n=e.element;Ot(n,t.leftAttr,o.left+"px"),Ot(n,t.topAttr,o.top+"px")})(e,t,l),i.fold(()=>({coord:wF(l.left,l.top),extra:A.none()}),e=>({coord:e.output,extra:e.extra}))},kF=(e,t,o,n)=>re(e,e=>{const s=e.sensor,r=((e,t,o,n,s,r)=>{const a=hF(e,s,r),i=hF(t,s,r);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n})(t,s,e.range.left,e.range.top,o,n);return r?A.some({output:vF(e.output,t,o,n),extra:e.extra}):A.none()}),OF=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return kF(r,o,n,s).orThunk(()=>{const e=j(r,(e,t)=>{const r=t.sensor,a=((e,t,o,n,s,r)=>{const a=hF(e,s,r),i=hF(t,s,r),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return Yt(l,c)})(o,r,t.range.left,t.range.top,n,s);return e.deltas.fold(()=>({deltas:A.some(a),snap:A.some(t)}),o=>(a.left+a.top)/2<=(o.left+o.top)/2?{deltas:A.some(a),snap:A.some(t)}:e)},{deltas:A.none(),snap:A.none()});return e.snap.map(e=>({output:vF(e.output,o,n,s),extra:e.extra}))})},_F=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return kF(r,o,n,s)};var TF=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const t=ot(e.element),o=jo(t),r=NA(s),a=((e,t,o)=>({coord:vF(e.output,e.output,t,o),extra:e.extra}))(n,o,r),i=bF(a.coord,0,r);Rt(s,i)}}});const EF="data-initial-z-index",AF=(e,t)=>{e.getSystem().addToGui(t),(e=>{at(e.element).filter($e).each(t=>{zt(t,"z-index").each(e=>{Ot(t,EF,e)}),It(t,"z-index",Nt(e.element,"z-index"))})})(t)},MF=e=>{(e=>{at(e.element).filter($e).each(e=>{Et(e,EF).fold(()=>Pt(e,"z-index"),t=>It(e,"z-index",t)),Mt(e,EF)})})(e),e.getSystem().removeFromGui(e)},DF=(e,t,o)=>e.getSystem().build(uC.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var BF=xs("snaps",[ss("getSnapPoints"),Ni("onSensor"),ss("leftAttr"),ss("topAttr"),ws("lazyViewport",on),ws("mustSnap",!1)]);const IF=[ws("useFixed",T),ss("blockerClass"),ws("getTarget",w),ws("onDrag",b),ws("repositionTarget",!0),ws("onDrop",b),Ts("getBounds",on),BF],FF=e=>{return(t=zt(e,"left"),o=zt(e,"top"),n=zt(e,"position"),t.isSome()&&o.isSome()&&n.isSome()?A.some(((e,t,o)=>("fixed"===o?wF:yF)(parseInt(e,10),parseInt(t,10)))(t.getOrDie(),o.getOrDie(),n.getOrDie())):A.none()).getOrThunk(()=>{const t=Kt(e);return xF(t.left,t.top)});var t,o,n},RF=(e,t)=>({bounds:e.getBounds(),height:$t(t.element),width:eo(t.element)}),NF=(e,t,o,n,s)=>{const r=o.update(n,s),a=o.getStartData().getOrThunk(()=>RF(t,e));r.each(o=>{((e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const r=ot(e.element),a=jo(r),i=NA(s),l=FF(s),c=((e,t,o,n,s,r,a)=>((e,t,o,n,s)=>{const r=s.bounds,a=hF(t,o,n),i=el(a.left,r.x,r.x+r.width-s.width),l=el(a.top,r.y,r.y+r.height-s.height),c=xF(i,l);return t.fold(()=>{const e=fF(c,o,n);return yF(e.left,e.top)},x(c),()=>{const e=pF(c,o,n);return wF(e.left,e.top)})})(0,t.fold(()=>{const e=(t=o,a=r.left,i=r.top,t.fold((e,t)=>yF(e+a,t+i),(e,t)=>xF(e+a,t+i),(e,t)=>wF(e+a,t+i)));var t,a,i;const l=pF(e,n,s);return wF(l.left,l.top)},t=>{const a=CF(e,t,o,r,n,s);return a.extra.each(o=>{t.onSensor(e,o)}),a.coord}),n,s,a))(e,t.snaps,l,a,i,n,o),d=bF(c,0,i);Rt(s,d)}t.onDrag(e,s,n)})(e,t,a,o)})},LF=(e,t,o,n)=>{t.each(MF),o.snaps.each(t=>{((e,t)=>{((e,t)=>{const o=e.element;Mt(o,t.leftAttr),Mt(o,t.topAttr)})(e,t)})(e,t)});const s=o.getTarget(e.element);n.reset(),o.onDrop(e,s)},zF=e=>(t,o)=>{const n=e=>{o.setStartData(RF(t,e))};return Pr([jr(Sr(),e=>{o.getStartData().each(()=>n(e))}),...e(t,o,n)])};var VF=Object.freeze({__proto__:null,getData:e=>A.from(Yt(e.x,e.y)),getDelta:(e,t)=>Yt(t.left-e.left,t.top-e.top)});const HF=(e,t,o)=>[jr(Gs(),(n,s)=>{if(0!==s.event.raw.button)return;s.stop();const r=()=>LF(n,A.some(l),e,t),a=oC(r,200),i={drop:r,delayDrop:a.schedule,forceDrop:r,move:o=>{a.cancel(),NF(n,e,t,VF,o)}},l=DF(n,e.blockerClass,(e=>Pr([jr(Gs(),e.forceDrop),jr(Ys(),e.drop),jr($s(),(t,o)=>{e.move(o.event)}),jr(qs(),e.delayDrop)]))(i));o(n),AF(n,l)})],PF=[...IF,Hi("dragger",{handlers:zF(HF)})];var UF=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return A.some(Yt(t.clientX,t.clientY))})(t):A.none()},getDelta:(e,t)=>Yt(t.left-e.left,t.top-e.top)});const WF=(e,t,o)=>{const n=sc(),s=o=>{LF(o,n.get(),e,t),n.clear()};return[jr(Ps(),(r,a)=>{a.stop();const i=()=>s(r),l={drop:i,delayDrop:b,forceDrop:i,move:o=>{NF(r,e,t,UF,o)}},c=DF(r,e.blockerClass,(e=>Pr([jr(Ps(),e.forceDrop),jr(Ws(),e.drop),jr(js(),e.drop),jr(Us(),(t,o)=>{e.move(o.event)})]))(l));n.set(c),o(r),AF(r,c)}),jr(Us(),(o,n)=>{n.stop(),NF(o,e,t,UF,n.event)}),jr(Ws(),(e,t)=>{t.stop(),s(e)}),jr(js(),s)]},jF=PF,GF=[...IF,Hi("dragger",{handlers:zF(WF)})],$F=[...IF,Hi("dragger",{handlers:zF((e,t,o)=>[...HF(e,t,o),...WF(e,t,o)])})];var qF=Object.freeze({__proto__:null,mouse:jF,touch:GF,mouseOrTouch:$F}),YF=Object.freeze({__proto__:null,init:()=>{let e=A.none(),t=A.none();const o=x({});return Ea({readState:o,reset:()=>{e=A.none(),t=A.none()},update:(t,o)=>t.getData(o).bind(o=>((t,o)=>{const n=e.map(e=>t.getDelta(e,o));return e=A.some(o),n})(t,o)),getStartData:()=>t,setStartData:e=>{t=A.some(e)}})}});const XF=Bl({branchKey:"mode",branches:qF,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:A.from(e.extra)})},state:YF,apis:TF}),KF=(e,t,o,n,s,r)=>e.fold(()=>XF.snap({sensor:xF(o-20,n-20),range:Yt(s,r),output:xF(A.some(o),A.some(n)),extra:{td:t}}),e=>{const s=o-20,r=n-20,a=e.element.dom.getBoundingClientRect();return XF.snap({sensor:xF(s,r),range:Yt(40,40),output:xF(A.some(o-a.width/2),A.some(n-a.height/2)),extra:{td:t}})}),JF=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const s=n.td;((e,t)=>e.exists(e=>et(e,t)))(t.get(),s)||(t.set(s),o(s))},mustSnap:!0}),ZF=e=>Jh(Xh.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:El([XF.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),jC.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),QF=(e,t)=>{const o=Ms([]),n=Ms([]),s=Ms(!1),r=sc(),a=sc(),i=e=>{const o=en(e);return KF(u.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=en(e);return KF(m.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=JF(()=>V(o.get(),e=>i(e)),r,t=>{a.get().each(o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})})}),d=JF(()=>V(n.get(),e=>l(e)),a,t=>{r.get().each(o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})})}),u=ZF(c),m=ZF(d),g=di(u.asSpec()),p=di(m.asSpec()),h=(t,o,n,s)=>{const r=n(o);XF.snapTo(t,r),((t,o)=>{const n=o.dom.getBoundingClientRect();Pt(t.element,"display");const r=rt(ze(e.getBody())).dom.innerHeight,a=n[s]<0,i=((e,t)=>e[s]>t)(n,r);(a||i)&&It(t.element,"display","none")})(t,o)},f=e=>h(g,e,i,"top"),b=e=>h(p,e,l,"bottom");if(Io().deviceType.isTouch()){const i=e=>V(e,ze);e.on("TableSelectionChange",e=>{s.get()||(Fd(t,g),Fd(t,p),s.set(!0));const l=ze(e.start),c=ze(e.finish);r.set(l),a.set(c),A.from(e.otherCells).each(e=>{o.set(i(e.upOrLeftCells)),n.set(i(e.downOrRightCells)),f(l),b(c)})}),e.on("ResizeEditor ResizeWindow ScrollContent",()=>{r.get().each(f),a.get().each(b)}),e.on("TableSelectionClear",()=>{s.get()&&(Ld(g),Ld(p),s.set(!1)),r.clear(),a.clear()})}},eR=e=>"BR"===e.nodeName||!!e.getAttribute("data-mce-bogus")||"bookmark"===e.getAttribute("data-mce-type"),tR=(e,t,o)=>{var n;const s=null!==(n=t.delimiter)&&void 0!==n?n:"\u203a";return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:El([$p.config({mode:"flow",selector:"div[role=button]"}),Hm.config({disabled:o.isDisabled}),Ex(),vC.config({}),th.config({}),oh("elementPathEvents",[Zr((t,n)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",()=>$p.focusIn(t)),e.on("NodeChange",n=>{const r=(t=>{const o=[];let n=t.length;for(;n-- >0;){const s=t[n];if(1===s.nodeType&&!eR(s)){const t=ww(e,s);if(t.isDefaultPrevented()||o.push({name:t.name,element:s}),t.isPropagationStopped())break}}return o})(n.parents),a=r.length>0?j(r,(t,n,r)=>{const a=((t,n,s)=>Xh.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":s,"aria-level":s+1}},components:[ai(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:El([Ax(o.isDisabled),Ex()])}))(n.name,n.element,r);return 0===r?t.concat([a]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[ai(` ${s} `)]},a])},[]):[];th.set(t,a)})})])]),components:[]}};var oR;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(oR||(oR={}));const nR=(e,t,o)=>{const n=ze(e.getContainer()),s=((e,t,o,n,s)=>{const r={height:lI(n+t.top,yb(e),wb(e))};return o===oR.Both&&(r.width=lI(s+t.left,vb(e),xb(e))),r})(e,t,o,Gt(n),Qt(n));le(s,(e,t)=>{h(e)&&It(n,t,iI(e))}),(e=>{e.dispatch("ResizeEditor")})(e)},sR=(e,t,o,n)=>{const s=Yt(20*o,20*n);return nR(e,s,t),A.some(!0)},rR=(e,t)=>{const o=()=>{const o=[],n=Kb(e),s=Gb(e),r=$b(e)||e.hasPlugin("wordcount");return s&&o.push(tR(e,{},t)),n&&o.push((()=>{const e=Hx("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[ai(Xf.translate(["Press {0} for help",e]))]}})()),r&&o.push((()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>th.set(e,[ai(t.translate(["{0} "+n,o[n]]))]);return Xh.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:El([Ax(t.isDisabled),Ex(),vC.config({}),th.config({}),yu.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),oh("wordcount-events",[ta(e=>{const t=yu.getValue(e),n="words"===t.mode?"characters":"words";yu.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)}),Zr(t=>{e.on("wordCountUpdate",e=>{const{mode:n}=yu.getValue(t);yu.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)})})])]),eventOrder:{[gr()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),$b(e)&&o.push({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v7",rel:"noopener",target:"_blank","aria-label":Xf.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:El([ih.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}})()),o.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...(()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(n){const o="tox-statusbar__text-container-3-cols";return r||s?r&&!s?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[r&&!s?t:e]})()]},components:o}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const n=o(),s=((e,t)=>{const o=(e=>{const t=qb(e);return!1===t?oR.None:"both"===t?oR.Both:oR.Vertical})(e);if(o===oR.None)return A.none();const n=o===oR.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return A.some(sb("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{"aria-label":t.translate(n),"data-mce-name":"resize-handle"},behaviours:[XF.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,s)=>nR(e,s,o),blockerClass:"tox-blocker"}),$p.config({mode:"special",onLeft:()=>sR(e,o,-1,0),onRight:()=>sR(e,o,1,0),onUp:()=>sR(e,o,0,-1),onDown:()=>sR(e,o,0,1)}),vC.config({}),ih.config({}),Cx.config(t.tooltips.getConfig({tooltipText:t.translate("Resize")}))]},t.icons))})(e,t);return n.concat(s.toArray())})()}},aR=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),iR=(e,t)=>{const o=e.inline,n=o?pI:rI,s=uv(e)?bM:FA,r=(()=>{const e=sc(),t=sc(),o=sc();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=>et(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=sc(),i=sc(),l=sc(),c=Io().deviceType.isTouch()?["tox-platform-touch"]:[],d=av(e),u=Tb(e),m=Jh({dom:{tag:"div",classes:["tox-anchorbar"]}}),g=Jh({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),p=()=>r.mainUi.get().map(e=>e.outerContainer).bind(qD.getHeader),h=r.lazyGetInOuterOrDie("anchor bar",m.getOpt),f=r.lazyGetInOuterOrDie("bottom anchor bar",g.getOpt),b=r.lazyGetInOuterOrDie("toolbar",qD.getToolbar),v=r.lazyGetInOuterOrDie("throbber",qD.getThrobber),y=((e,t,o,n)=>{const s=Ms(!1),r=(e=>{const t=Ms(av(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:Xf.translate,isDisabled:()=>t.mode.isReadOnly()||!t.ui.isEnabled(),getOption:t.options.get,tooltips:XE(e.popup)},i=xA(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},n=Ms([]),s=Ms([]),r=Ms(!1);return e.on("PreInit",s=>{const r=$E(e),a=YE(e,r,t,o);n.set(a)}),e.on("addStyleModifications",n=>{const a=YE(e,n.items,t,o);s.set(a),r.set(n.replace)}),{getData:()=>{const e=r.get()?[]:n.get(),t=s.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:LE(e),hasCustomColors:zE(e),getColors:VE(e),getColorCols:HE(e)}))(t),d=(e=>({isDraggableModal:PE(e)}))(t),u={shared:{providers:a,anchors:NE(t,o,n,r.isPositionedAtTop),header:r},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>s.get(),setContextMenuState:e=>s.set(e)},m={...u,shared:{...u.shared,interpreter:e=>dE(e,{},m),getSink:e.popup}},g={...u,shared:{...u.shared,interpreter:e=>dE(e,{},g),getSink:e.dialog}};return{popup:m,dialog:g}})({popup:()=>an.fromOption(r.popupUi.get().map(e=>e.sink),"(popup) UI has not been rendered"),dialog:()=>an.fromOption(r.dialogUi.get().map(e=>e.sink),"UI has not been rendered")},e,h,f),x=t=>{const o=iI((e=>{const t=(e=>{const t=fb(e),o=yb(e),n=wb(e);return aI(t).map(e=>lI(e,o,n))})(e);return t.getOr(fb(e))})(e)),n=iI((e=>cI(e).getOr(bb(e)))(e));return e.inline||(Ht("div","width",n)&&It(t.element,"width",n),Ht("div","height",o)?It(t.element,"height",o):It(t.element,"height","400px")),o};return{popups:{backstage:y.popup,getMothership:()=>aR("popups",l)},dialogs:{backstage:y.dialog,getMothership:()=>aR("dialogs",i)},renderUI:()=>{const h=(()=>{const t=(()=>{const t={attributes:{[kc]:d?Cc.BottomToTop:Cc.TopToBottom}},o=qD.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:y.popup,onEscape:()=>{e.focus()}}),n=qD.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:y.popup.shared.getSink,providers:y.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{((e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})})(e,t)},type:u,lazyToolbar:b,lazyHeader:()=>p().getOrDie("Could not find header element"),...t}),s=qD.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:y.popup.shared.providers,onEscape:()=>{e.focus()},type:u}),r=rv(e),a=nv(e),i=Qb(e),l=r||a||i;return qD.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(l?[]:["tox-editor-header--empty"]),...t},components:q([i?[o]:[],r?[s]:a?[n]:[],lv(e)?[]:[m.asSpec()]]),sticky:uv(e),editor:e,sharedBackstage:y.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[qD.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),qD.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},s=qD.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:y.popup}),r=qD.parts.viewWrapper({backstage:y.popup}),i=jb(e)&&!o?A.some(rR(e,y.popup.shared.providers)):A.none(),l=q([d?[]:[t],o?[]:[n],d?[t]:[]]),h=qD.parts.editorContainer({components:q([l,o?[]:[g.asSpec(),...i.toArray()]])}),f=dv(e),v={role:"application",...Xf.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},x=di(qD.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(o?["tox-tinymce-inline"]:[]).concat(d?["tox-tinymce--toolbar-bottom"]:[]).concat(c),styles:{visibility:"hidden",...f?{opacity:"0",border:"0"}:{}},attributes:v},components:[h,...o?[]:[r],s],behaviours:El([Ex(),Hm.config({disableClass:"tox-tinymce--disabled"}),$p.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle"})])})),w=mC(x);return a.set(w),{mothership:w,outerContainer:x}})(),f=(()=>{const t=cv(e),o=et(St(),t)&&"grid"===Nt(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...Xf.isRtl()?{dir:"rtl"}:{}}},behaviours:El([Td.config({useFixed:()=>s.isDocked(p)})])},r={dom:{styles:{width:document.body.clientWidth+"px"}},events:Pr([jr(Cr(),e=>{It(e.element,"width",document.body.clientWidth+"px")})])},a=di(vn(n,o?r:{})),l=mC(a);return i.set(l),{sink:a,mothership:l}})(),w=mv(e)?(()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(c),attributes:{...Xf.isRtl()?{dir:"rtl"}:{}}},behaviours:El([Td.config({useFixed:()=>s.isDocked(p),getBounds:()=>t.getPopupSinkBounds()})])},o=di(e),n=mC(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(f);r.dialogUi.set(f),r.popupUi.set(w),r.mainUi.set(h);return(t=>{const{mainUi:o,popupUi:r,uiMotherships:a}=t;ce(Eb(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=sv(e),h={menuItems:l,menus:gv(e),menubar:Fb(e),toolbar:g.getOrThunk(()=>Rb(e)),allowToolbarGroups:u===ib.floating,buttons:i,sidebar:d,views:m};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",()=>{qD.focusMenubar(f)}),e.addShortcut("alt+F10","focus toolbar",()=>{qD.focusToolbar(f)}),e.addCommand("ToggleToolbarDrawer",(e,t)=>{(null==t?void 0:t.skipFocus)?qD.toggleToolbarDrawerWithoutFocusing(f):qD.toggleToolbarDrawer(f)}),e.addQueryStateHandler("ToggleToolbarDrawer",()=>qD.isToolbarDrawerToggled(f)),((e,t,o)=>{const n=(e,n)=>{H([t,...o],t=>{t.broadcastEvent(e,n)})},s=(e,n)=>{H([t,...o],t=>{t.broadcastOn([e],n)})},r=e=>s(eu(),{target:e.target}),a=Yo(),i=ac(a,"touchstart",r),l=ac(a,"touchmove",e=>n(xr(),e)),c=ac(a,"touchend",e=>n(wr(),e)),d=ac(a,"mousedown",r),u=ac(a,"mouseup",e=>{0===e.raw.button&&s(ou(),{target:e.target})}),m=e=>s(eu(),{target:ze(e.target)}),g=e=>{0===e.button&&s(ou(),{target:ze(e.target)})},p=()=>{H(e.editorManager.get(),t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})})},h=e=>n(Sr(),lc(e)),f=e=>{s(tu(),{}),n(Cr(),lc(e))},b=bt(ze(e.getElement())),v=ic(b,"scroll",o=>{requestAnimationFrame(()=>{if(null!=e.getContainer()){const s=QS(e,t.element).map(e=>[e.element,...e.others]).getOr([]);N(s,e=>et(e,o.target))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Mr(),o))}})}),y=()=>s(tu(),{}),x=t=>{t.state&&s(eu(),{target:ze(e.getContainer())})},w=e=>{s(eu(),{target:ze(e.relatedTarget.getContainer())})},S=t=>e.dispatch("focusin",t),C=t=>e.dispatch("focusout",t);e.on("PostRender",()=>{e.on("click",m),e.on("tap",m),e.on("mouseup",g),e.on("mousedown",p),e.on("ScrollWindow",h),e.on("ResizeWindow",f),e.on("ResizeEditor",y),e.on("AfterProgressState",x),e.on("DismissPopups",w),H([t,...o],e=>{e.element.dom.addEventListener("focusin",S),e.element.dom.addEventListener("focusout",C)})}),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),H([t,...o],e=>{e.element.dom.removeEventListener("focusin",S),e.element.dom.removeEventListener("focusout",C)}),d.unbind(),i.unbind(),l.unbind(),c.unbind(),u.unbind(),v.unbind()}),e.on("detach",()=>{H([t,...o],Ud),H([t,...o],e=>e.destroy())})})(e,o.mothership,a),s.setup(e,y.popup.shared,p),UI(e,y.popup),cF(e,y.popup.shared.getSink,y.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();H(ae(t),o=>{const n=t[o],s=()=>xe(A.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o),t.setActive(s())},onSetup:t=>{t.setActive(s());const o=()=>t.setActive(s());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}}})})})(e),UM(e,v,y.popup.shared),II(e,c,r.sink,{backstage:y.popup}),QF(e,r.sink);const b={targetNode:e.getElement(),height:x(o.outerContainer)};return n.render(e,t,h,y.popup,b)})({popupUi:w,dialogUi:f,mainUi:h,uiMotherships:r.getUiMotherships()})}}},lR=x([ss("lazySink"),gs("dragBlockClass"),Ts("getBounds",on),ws("useTabstopAt",E),ws("firstTabstop",0),ws("eventOrder",{}),xu("modalBehaviours",[$p]),Li("onExecute"),Vi("onEscape")]),cR={sketch:w},dR=x([Xu({name:"draghandle",overrides:(e,t)=>({behaviours:El([XF.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})])})}),qu({schema:[ss("dom")],name:"title"}),qu({factory:cR,schema:[ss("dom")],name:"close"}),qu({factory:cR,schema:[ss("dom")],name:"body"}),Xu({factory:cR,schema:[ss("dom")],name:"footer"}),Yu({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[ws("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),ws("components",[])],name:"blocker"})]),uR=Sm({name:"ModalDialog",configFields:lR(),partFields:dR(),factory:(e,t,o,n)=>{const s=sc(),r=da("modal-events"),a={...e.eventOrder,[kr()]:[r].concat(e.eventOrder["alloy.system.attached"]||[])};return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{s.set(t);const o=e.lazySink(t).getOrDie(),r=n.blocker(),a=o.getSystem().build({...r,components:r.components.concat([ui(t)]),behaviours:El([ih.config({}),oh("dialog-blocker-events",[Jr(Ks(),()=>{HM.isBlocked(t)||$p.focusIn(t)})])])});Fd(o,a),$p.focusIn(t)},hide:e=>{s.clear(),at(e.element).each(t=>{e.getSystem().getByDom(t).each(e=>{Ld(e)})})},getBody:t=>lm(t,e,"body"),getFooter:t=>im(t,e,"footer"),setIdle:e=>{HM.unblock(e)},setBusy:(e,t)=>{HM.block(e,t)}},eventOrder:a,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Su(e.modalBehaviours,[th.config({}),$p.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),HM.config({getRoot:s.get}),oh(r,[Zr(t=>{((e,t)=>{const o=Et(e,"id").fold(()=>{const e=da("dialog-label");return Ot(t,"id",e),e},w);Ot(e,"aria-labelledby",o)})(t.element,lm(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)}}}),mR=In([ry,ay].concat(tx)),gR=Un,pR=[By("button"),yy,Os("align","end",["start","end"]),Ty,_y,bs("buttonType",["primary","secondary"])],hR=[...pR,ly],fR=[ls("type",["submit","cancel","custom"]),...hR],bR=[ls("type",["menu"]),vy,xy,yy,ms("items",mR),...pR],vR=[...pR,ls("type",["togglebutton"]),xy,yy,vy,_s("active",!1)],yR=Qn("type",{submit:fR,cancel:fR,custom:fR,menu:bR,togglebutton:vR}),xR=[ry,ly,ls("level",["info","warn","error","success"]),dy,ws("url","")],wR=In(xR),SR=[ry,ly,_y,By("button"),yy,Oy,bs("buttonType",["primary","secondary","toolbar"]),Ty],CR=In(SR),kR=[ry,ay],OR=kR.concat([wy,xy]),_R=kR.concat([iy,_y]),TR=In(_R),ER=Un,AR=OR.concat([Ey("auto")]),MR=In(AR),DR=Ln([uy,ly,dy]),BR=OR.concat([ks("storageKey","default")]),IR=In(BR),FR=Pn,RR=In(OR),NR=Pn,LR=kR.concat([ks("tag","textarea"),is("scriptId"),is("scriptUrl"),vs("onFocus"),Ss("settings",void 0,Gn)]),zR=kR.concat([ks("tag","textarea"),cs("init")]),VR=qn(e=>Xn("customeditor.old",Bn(zR),e).orThunk(()=>Xn("customeditor.new",Bn(LR),e))),HR=Pn,PR=In(OR),UR=Fn(Tn),WR=e=>[ry,as("columns"),e],jR=[ry,is("html"),Os("presets","presentation",["presentation","document"])],GR=In(jR),$R=OR.concat([_s("border",!1),_s("sandboxed",!0),_s("streamContent",!1),_s("transparent",!0)]),qR=In($R),YR=Pn,XR=In(kR.concat([fs("height")])),KR=In([is("url"),hs("zoom"),hs("cachedWidth"),hs("cachedHeight")]),JR=OR.concat([fs("inputMode"),fs("placeholder"),_s("maximized",!1),_y]),ZR=In(JR),QR=Pn,eN=e=>[ry,iy,e,Os("align","start",["start","center","end"]),xy],tN=[ly,uy],oN=[ly,ms("items",es(0,()=>nN))],nN=Rn([In(tN),In(oN)]),sN=OR.concat([ms("items",nN),_y]),rN=In(sN),aN=Pn,iN=OR.concat([us("items",[ly,uy]),Cs("size",1),_y]),lN=In(iN),cN=Pn,dN=OR.concat([_s("constrain",!0),_y]),uN=In(dN),mN=In([is("width"),is("height")]),gN=kR.concat([iy,Cs("min",0),Cs("max",0)]),pN=In(gN),hN=Hn,fN=[ry,ms("header",Pn),ms("cells",Fn(Pn))],bN=In(fN),vN=OR.concat([fs("placeholder"),_s("maximized",!1),_y]),yN=In(vN),xN=Pn,wN=[ls("type",["directory","leaf"]),cy,is("id"),ps("menu",xM)],SN=In(wN),CN=wN.concat([ms("children",es(0,()=>$n("type",{directory:kN,leaf:SN})))]),kN=In(CN),ON=$n("type",{directory:kN,leaf:SN}),_N=[ry,ms("items",ON),vs("onLeafAction"),vs("onToggleExpand"),Es("defaultExpandedIds",[],Pn),fs("defaultSelectedId")],TN=In(_N),EN=OR.concat([Os("filetype","file",["image","media","file"]),_y,fs("picker_text")]),AN=In(EN),MN=In([uy,Ay]),DN=e=>ts("items","items",{tag:"required",process:{}},Fn(qn(t=>Xn(`Checking item of ${e}`,BN,t).fold(e=>an.error(Zn(e)),e=>an.value(e))))),BN=Mn(()=>{return $n("type",{alertbanner:wR,bar:In((e=DN("bar"),[ry,e])),button:CR,checkbox:TR,colorinput:IR,colorpicker:RR,dropzone:PR,grid:In(WR(DN("grid"))),iframe:qR,input:ZR,listbox:rN,selectbox:lN,sizeinput:uN,slider:pN,textarea:yN,urlinput:AN,customeditor:VR,htmlpanel:GR,imagepreview:XR,collection:MR,label:In(eN(DN("label"))),table:bN,tree:TN,panel:FN});var e}),IN=[ry,ws("classes",[]),ms("items",BN)],FN=In(IN),RN=[By("tab"),cy,ms("items",BN)],NN=[ry,us("tabs",RN)],LN=In(NN),zN=hR,VN=yR,HN=In([is("title"),rs("body",$n("type",{panel:FN,tabpanel:LN})),ks("size","normal"),Es("buttons",[],VN),ws("initialData",{}),Ts("onAction",b),Ts("onChange",b),Ts("onSubmit",b),Ts("onClose",b),Ts("onCancel",b),Ts("onTabChange",b)]),PN=In([ls("type",["cancel","custom"]),...zN]),UN=In([is("title"),is("url"),hs("height"),hs("width"),ys("buttons",PN),Ts("onAction",b),Ts("onCancel",b),Ts("onClose",b),Ts("onMessage",b)]),WN=e=>a(e)?[e].concat(Y(fe(e),WN)):l(e)?Y(e,WN):[],jN=e=>r(e.type)&&r(e.name),GN={checkbox:ER,colorinput:FR,colorpicker:NR,dropzone:UR,input:QR,iframe:YR,imagepreview:KR,selectbox:cN,sizeinput:mN,slider:hN,listbox:aN,size:mN,textarea:xN,urlinput:MN,customeditor:HR,collection:DR,togglemenuitem:gR},$N=e=>{const t=(e=>U(WN(e),jN))(e),o=Y(t,e=>(e=>A.from(GN[e.type]))(e).fold(()=>[],t=>[rs(e.name,t)]));return In(o)},qN=e=>{var t;return{internalDialog:Kn(Xn("dialog",HN,e)),dataValidator:$N(e),initialData:null!==(t=e.initialData)&&void 0!==t?t:{}}},YN={open:(e,t)=>{const o=qN(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(Kn(Xn("dialog",UN,t))),redial:e=>qN(e)};var XN=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each(e=>{const s=e(o,n);t.set(s)}),e.renderComponents.each(s=>{const r=s(n,t.get());(e.reuseDom?Yp:qp)(o,r)})};return Pr([jr(mr(),(t,n)=>{const s=n;if(!s.universal){const n=e.channel;R(s.channels,n)&&o(t,s.data)}}),Zr((t,n)=>{e.initialData.each(e=>{o(t,e)})})])}}),KN=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),JN=[ss("channel"),gs("renderComponents"),gs("updateState"),gs("initialData"),_s("reuseDom",!0)];const ZN=Ml({fields:JN,name:"reflecting",active:XN,apis:KN,state:Object.freeze({__proto__:null,init:()=>{const e=Ms(A.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(A.none())}}})}),QN=e=>{const t=[],o={};return le(e,(e,n)=>{e.fold(()=>{t.push(n)},e=>{o[n]=e})}),t.length>0?an.error(t):an.value(o)},eL=(e,t,o)=>{const n=Jh(LO.sketch(n=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:V(e.items,e=>lE(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:El([$p.config({mode:"acyclic",useTabstopAt:k(l_)}),(s=n,_m.config({find:s.getOpt})),qO(n,{postprocess:e=>QN(e).fold(e=>(console.error(e),{}),w)}),oh("dialog-body-panel",[jr(Ks(),(e,t)=>{e.getSystem().broadcastOn([p_],{newFocus:A.some(t.event.target)})})])])};var s},tL=wm({name:"TabButton",configFields:[ws("uid",void 0),ss("value"),ts("dom","dom",Sn(()=>({attributes:{role:"tab",id:da("aria"),"aria-selected":"false"}})),zn()),gs("action"),ws("domModification",{}),xu("tabButtonBehaviours",[ih,$p,yu]),ss("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:vh(e.action),behaviours:Su(e.tabButtonBehaviours,[ih.config({}),$p.config({mode:"execution",useSpace:!0,useEnter:!0}),yu.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),oL=x([ss("tabs"),ss("dom"),ws("clickToDismiss",!1),xu("tabbarBehaviours",[Km,$p]),Fi(["tabClass","selectedClass"])]),nL=Ku({factory:tL,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Km.dehighlight(e,t),Nr(e,Br(),{tabbar:e,button:t})},o=(e,t)=>{Km.highlight(e,t),Nr(e,Dr(),{tabbar:e,button:t})};return{action:n=>{const s=n.getSystem().getByUid(e.uid).getOrDie(),r=Km.isHighlighted(s,n);(r&&e.clickToDismiss?t:r?b:o)(s,n)},domModification:{classes:[e.markers.tabClass]}}}}),sL=x([nL]),rL=Sm({name:"Tabbar",configFields:oL(),partFields:sL(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Su(e.tabbarBehaviours,[Km.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{Ot(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{Ot(t.element,"aria-selected","false")}}),$p.config({mode:"flow",getInitial:e=>Km.getHighlighted(e).map(e=>e.element),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),aL=wm({name:"Tabview",configFields:[xu("tabviewBehaviours",[th])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:Su(e.tabviewBehaviours,[th.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),iL=x([ws("selectFirst",!0),Ni("onChangeTab"),Ni("onDismissTab"),ws("tabs",[]),xu("tabSectionBehaviours",[])]),lL=qu({factory:rL,schema:[ss("dom"),ds("markers",[ss("tabClass"),ss("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),cL=qu({factory:aL,name:"tabview"}),dL=x([lL,cL]),uL=Sm({name:"TabSection",configFields:iL(),partFields:dL(),factory:(e,t,o,n)=>{const s=(t,o)=>{im(t,e,"tabbar").each(e=>{o(e).each(Lr)})};return{uid:e.uid,dom:e.dom,components:t,behaviours:wu(e.tabSectionBehaviours),events:Pr(q([e.selectFirst?[Zr((e,t)=>{s(e,Km.getFirst)})]:[],[jr(Dr(),(t,o)=>{(t=>{const o=yu.getValue(t);im(t,e,"tabview").each(n=>{G(e.tabs,e=>e.value===o).each(o=>{const s=o.view();Et(t.element,"id").each(e=>{Ot(n.element,"aria-labelledby",e)}),th.set(n,s),e.onChangeTab(n,t,s)})})})(o.event.button)}),jr(Br(),(t,o)=>{const n=o.event.button;e.onDismissTab(t,n)})]])),apis:{getViewItems:t=>im(t,e,"tabview").map(e=>th.contents(e)).getOr([]),showTab:(e,t)=>{s(e,e=>{const o=Km.getCandidates(e);return G(o,e=>yu.getValue(e)===t).filter(t=>!Km.isHighlighted(e,t))})}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),mL=(e,t)=>{It(e,"height",t+"px"),It(e,"flex-basis",t+"px")},gL=(e,t,o)=>{bi(e,'[role="dialog"]').each(e=>{yi(e,'[role="tablist"]').each(n=>{o.get().map(o=>(It(t,"height","0"),It(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=st(e).dom,s=bi(e,".tox-dialog-wrap").getOr(e);let r;r="fixed"===Nt(s,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const a=Gt(t),i=t.dom.offsetLeft>=o.dom.offsetLeft+Qt(o)?Math.max(Gt(o),a):a,l=parseInt(Nt(e,"margin-top"),10)||0,c=parseInt(Nt(e,"margin-bottom"),10)||0;return r-(Gt(e)+l+c-i)})(e,t,n)))).each(e=>{mL(t,e)})})})},pL=e=>yi(e,'[role="tabpanel"]'),hL="send-data-to-section",fL="send-data-to-view",bL=(e,t,o)=>{const n=Ms({}),s=e=>{const t=yu.getValue(e),o=QN(t).getOr({}),s=n.get(),r=vn(s,o);n.set(r)},r=e=>{const t=n.get();yu.setValue(e,t)},a=Ms(null),i=V(e.tabs,e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[ai(o.shared.providers.translate(e.title))],view:()=>[LO.sketch(n=>({dom:{tag:"div",classes:["tox-form"]},components:V(e.items,e=>lE(n,e,t,o)),formBehaviours:El([$p.config({mode:"acyclic",useTabstopAt:k(l_)}),oh("TabView.form.events",[Zr(r),Qr(s)]),Fl.config({channels:Is([{key:hL,value:{onReceive:s}},{key:fL,value:{onReceive:r}}])})])}))]})),l=(e=>{const t=sc(),o=[Zr(o=>{const n=o.element;pL(n).each(s=>{It(s,"visibility","hidden"),o.getSystem().getByDom(s).toOptional().each(o=>{const n=((e,t,o)=>V(e,(n,s)=>{th.set(o,e[s].view());const r=t.dom.getBoundingClientRect();return th.set(o,[]),r.height}))(e,s,o),r=(e=>oe(ee(e,(e,t)=>e>t?-1:e<t?1:0)))(n);r.fold(t.clear,t.set)}),gL(n,s,t),Pt(s,"visibility"),((e,t)=>{oe(e).each(e=>uL.showTab(t,e.value))})(e,o),requestAnimationFrame(()=>{gL(n,s,t)})})}),jr(Cr(),e=>{const o=e.element;pL(o).each(e=>{gL(o,e,t)})}),jr(BC,(e,o)=>{const n=e.element;pL(n).each(e=>{const o=Vl(bt(e));It(e,"visibility","hidden");const s=zt(e,"height").map(e=>parseInt(e,10));Pt(e,"height"),Pt(e,"flex-basis");const r=e.dom.getBoundingClientRect().height;s.forall(e=>r>e)?(t.set(r),gL(n,e,t)):s.each(t=>{mL(e,t)}),Pt(e,"visibility"),o.each(Nl)})})];return{extraEvents:o,selectFirst:!1}})(i);return uL.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=yu.getValue(t);Nr(e,DC,{name:n,oldName:a.get()}),a.set(n)},tabs:i,components:[uL.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[rL.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:El([vC.config({})])}),uL.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:El([oh("tabpanel",l.extraEvents),$p.config({mode:"acyclic"}),_m.config({find:e=>oe(uL.getViewItems(e))}),YO(A.none(),e=>(e.getSystem().broadcastOn([hL],{}),n.get()),(e,t)=>{n.set(t),e.getSystem().broadcastOn([fL],{})})])})},vL=(e,t,o,n,s)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map(e=>({id:e})).getOr({}),...s?{"aria-live":"polite"}:{}}},components:[],behaviours:El([GO(0),ZN.config({channel:`${u_}-${t}`,updateState:(e,t)=>A.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[bL(t,e.initialData,n)]:[eL(t,e.initialData,n)]},initialData:e})])}),yL=ub.deviceType.isTouch(),xL=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),wL=(e,t)=>uR.parts.close(Xh.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:El([vC.config({})])})),SL=()=>uR.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),CL=(e,t)=>uR.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:Kh(`<p>${Yf(t.translate(e))}</p>`)}]}]}),kL=e=>uR.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),OL=(e,t)=>[uC.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),uC.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],_L=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",s=t+"__disable-scroll";return uR.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),A.some(!0)),useTabstopAt:e=>!l_(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:Kh(`<div class="${o}"></div>`),components:[{dom:{tag:"div",classes:yL?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:El([ih.config({}),oh("dialog-events",e.dialogEvents.concat([Jr(Ks(),(e,t)=>{HM.isBlocked(e)||$p.focusIn(e)}),jr(Er(),(e,t)=>{e.getSystem().broadcastOn([p_],{newFocus:t.event.newFocus})})])),oh("scroll-lock",[Zr(()=>{ja(St(),s)}),Qr(()=>{$a(St(),s)})]),...e.extraBehaviours]),eventOrder:{[gr()]:["dialog-events"],[kr()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[Or()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},TL=e=>Xh.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),"data-mce-name":"close"}},buttonBehaviours:El([vC.config({}),Cx.config(e.tooltips.getConfig({tooltipText:e.translate("Close")}))]),components:[sb("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{Rr(e,_C)}}),EL=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__title"],attributes:{...o.map(e=>({id:e})).getOr({})}},components:[],behaviours:El([ZN.config({channel:`${d_}-${t}`,initialData:e,renderComponents:e=>[ai(n.translate(e.title))]})])}),AL=()=>({dom:Kh('<div class="tox-dialog__draghandle"></div>')}),ML=(e,t,o)=>((e,t,o)=>{const n=uR.parts.title(EL(e,t,A.none(),o)),s=uR.parts.draghandle(AL()),r=uR.parts.close(TL(o)),a=[n].concat(e.draggable?[s]:[]).concat([r]);return uC.sketch({dom:Kh('<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:Kh('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}),BL=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=yi(e().element,".tox-dialog__header").map(e=>Gt(e));uR.setBusy(e(),(e,s)=>DL(o.message,s,t,n))},onUnblock:()=>{uR.setIdle(e())}}),IL="tox-dialog--fullscreen",FL="tox-dialog--width-lg",RL="tox-dialog--width-md",NL=e=>{switch(e){case"large":return A.some(FL);case"medium":return A.some(RL);default:return A.none()}},LL=(e,t)=>{const o=ze(t.element.dom);qa(o,IL)||(Xa(o,[FL,RL]),NL(e).each(e=>ja(o,e)))},zL=(e,t)=>{const o=ze(e.element.dom),n=Ka(o),s=G(n,e=>e===FL||e===RL).or(NL(t));((e,t)=>{H(t,t=>{((e,t)=>{const o=Ha(e)?e.dom.classList.toggle(t):((e,t)=>R(Pa(e),t)?Wa(e,t):Ua(e,t))(e,t);Ga(e)})(e,t)})})(o,[IL,...s.toArray()])},VL=(e,t,o)=>di(_L({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[KO({}),...e.extraBehaviours],onEscape:e=>{Rr(e,_C)},dialogEvents:t,eventOrder:{[mr()]:[ZN.name(),Fl.name()],[kr()]:["scroll-lock",ZN.name(),"messages","dialog-events","alloy.base.behaviour"],[Or()]:["alloy.base.behaviour","dialog-events","messages",ZN.name(),"scroll-lock"]}})),HL=(e,t={})=>V(e,e=>"menu"===e.type?(e=>{const o=V(e.items,e=>{const o=be(t,e.name).getOr(Ms(!1));return{...e,storage:o}});return{...e,items:o}})(e):e),PL=e=>j(e,(e,t)=>"menu"===t.type?j(t.items,(e,t)=>(e[t.name]=t.storage,e),e):e,{}),UL=(e,t)=>[Yr(Ks(),i_),e(OC,(e,o,n,s)=>{Vl(bt(s.element)).fold(b,Ll),t.onClose(),o.onClose()}),e(_C,(e,t,o,n)=>{t.onCancel(e),Rr(n,OC)}),jr(MC,(e,o)=>t.onUnblock()),jr(AC,(e,o)=>t.onBlock(o.event))],WL=(e,t,o)=>{const n=(t,o)=>jr(t,(t,n)=>{s(t,(s,r)=>{o(e(),s,n.event,t)})}),s=(e,t)=>{ZN.getState(e).get().each(o=>{t(o.internalDialog,e)})};return[...UL(n,t),n(EC,(e,t)=>t.onSubmit(e)),n(kC,(e,t,o)=>{t.onChange(e,{name:o.name})}),n(TC,(e,t,n,s)=>{const r=()=>s.getSystem().isConnected()?$p.focusIn(s):void 0,a=e=>At(e,"disabled")||Et(e,"aria-disabled").exists(e=>"true"===e),i=bt(s.element),l=Vl(i);t.onAction(e,{name:n.name,value:n.value}),Vl(i).fold(r,e=>{a(e)||l.exists(t=>tt(e,t)&&a(t))?r():o().toOptional().filter(t=>!tt(t.element,e)).each(r)})}),n(DC,(e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})}),Qr(t=>{const o=e();yu.setValue(t,o.getData())})]},jL=(e,t)=>{const o=t.map(e=>e.footerButtons).getOr([]),n=P(o,e=>"start"===e.align),s=(e,t)=>uC.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:V(t,e=>e.memento.asSpec())});return[s("start",n.pass),s("end",n.fail)]},GL=(e,t,o)=>({dom:Kh('<div class="tox-dialog__footer"></div>'),components:[],behaviours:El([ZN.config({channel:`${m_}-${t}`,initialData:e,updateState:(e,t)=>{const n=V(t.buttons,e=>{const t=Jh(((e,t)=>$T(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}});return A.some({lookupByName:t=>((e,t,o)=>G(t,e=>e.name===o).bind(t=>t.memento.getOpt(e)))(e,n,t),footerButtons:n})},renderComponents:jL})])}),$L=(e,t,o)=>uR.parts.footer(GL(e,t,o)),qL=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=_m.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return LO.getField(o,t).orThunk(()=>{const o=e.getFooter().bind(e=>ZN.getState(e).get());return o.bind(e=>e.lookupByName(t))})}return A.none()},YL=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},s={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...yu.getValue(n),...ce(o,e=>e.get())}},setData:t=>{n(n=>{const r=s.getData(),a=vn(r,t),i=((e,t)=>{const o=e.getRoot();return ZN.getState(o).get().map(e=>Kn(Xn("data",e.dataValidator,t))).getOr(t)})(e,a),l=e.getFormWrapper();yu.setValue(l,i),le(o,(e,t)=>{ve(a,t)&&e.set(a[t])})})},setEnabled:(t,o)=>{qL(e,t).each(o?Hm.enable:Hm.disable)},focus:t=>{qL(e,t).each(ih.focus)},block:e=>{if(!r(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n(t=>{Nr(t,AC,{message:e})})},unblock:()=>{n(e=>{Rr(e,MC)})},showTab:t=>{n(o=>{const n=e.getBody();ZN.getState(n).get().exists(e=>e.isTabPanel())&&_m.getCurrent(n).each(e=>{uL.showTab(e,t)})})},redial:r=>{n(n=>{const a=e.getId(),i=t(r),l=HL(i.internalDialog.buttons,o);n.getSystem().broadcastOn([`${c_}-${a}`],i),n.getSystem().broadcastOn([`${d_}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${u_}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${m_}-${a}`],{...i.internalDialog,buttons:l}),s.setData(i.initialData)})},close:()=>{n(e=>{Rr(e,OC)})},toggleFullscreen:e.toggleFullscreen};return s},XL=(e,t,o,n=!1,s)=>{const r=da("dialog"),a=da("dialog-label"),i=da("dialog-content"),l=e.internalDialog,c=Ms(l.size),d=NL(c.get()).toArray(),u=Jh(((e,t,o,n)=>uC.sketch({dom:Kh('<div class="tox-dialog__header"></div>'),components:[EL(e,t,A.some(o),n),AL(),TL(n)],containerBehaviours:El([XF.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>xi(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))({title:l.title,draggable:!0},r,a,o.shared.providers)),m=Jh(((e,t,o,n,s)=>vL(e,t,A.some(o),n,s))({body:l.body,initialData:l.initialData},r,i,o,n)),g=HL(l.buttons),p=PL(g),h=ke(0!==g.length,Jh(((e,t,o)=>GL(e,t,o))({buttons:g},r,o))),f=WL(()=>v,{onBlock:e=>{HM.block(b,(t,n)=>{const s=u.getOpt(b).map(e=>Gt(e.element));return DL(e.message,n,o.shared.providers,s)})},onUnblock:()=>{HM.unblock(b)},onClose:()=>t.closeWindow()},o.shared.getSink),b=di({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog","aria-labelledby":a}},eventOrder:{[mr()]:[ZN.name(),Fl.name()],[gr()]:["execute-on-form"],[kr()]:["reflecting","execute-on-form"]},behaviours:El([$p.config({mode:"cyclic",onEscape:e=>(Rr(e,OC),A.some(!0)),useTabstopAt:e=>!l_(e)&&("button"!==We(e)||"disabled"!==Tt(e,"disabled")),firstTabstop:1}),ZN.config({channel:`${c_}-${r}`,updateState:(e,t)=>(c.set(t.internalDialog.size),LL(t.internalDialog.size,e),s(),A.some(t)),initialData:e}),ih.config({}),oh("execute-on-form",f.concat([Jr(Ks(),(e,t)=>{$p.focusIn(e)}),jr(Er(),(e,t)=>{e.getSystem().broadcastOn([p_],{newFocus:t.event.newFocus})})])),HM.config({getRoot:()=>A.some(b)}),th.config({}),KO({})]),components:[u.asSpec(),m.asSpec(),...h.map(e=>e.asSpec()).toArray()]}),v=YL({getId:x(r),getRoot:x(b),getFooter:()=>h.map(e=>e.get(b)),getBody:()=>m.get(b),getFormWrapper:()=>{const e=m.get(b);return _m.getCurrent(e).getOr(e)},toggleFullscreen:()=>{zL(b,c.get())}},t.redial,p);return{dialog:b,instanceApi:v}};var KL=tinymce.util.Tools.resolve("tinymce.util.URI");const JL=["insertContent","setContent","execCommand","close","block","unblock"],ZL=e=>a(e)&&-1!==JL.indexOf(e.mceAction),QL=(e,t,o,n)=>{const s=da("dialog"),i=ML(e.title,s,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[r_(A.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:El([vC.config({}),ih.config({})])})]}],behaviours:El([$p.config({mode:"acyclic",useTabstopAt:k(l_)})])};return uR.parts.body(t)})(e),c=e.buttons.bind(e=>0===e.length?A.none():A.some($L({buttons:e},s,n))),u=((e,t)=>{const o=(e,t)=>jr(e,(e,o)=>{n(e,(n,s)=>{t(x,n,o.event,e)})}),n=(e,t)=>{ZN.getState(e).get().each(o=>{t(o,e)})};return[...UL(o,t),o(TC,(e,t,o)=>{t.onAction(e,{name:o.name})})]})(0,BL(()=>y,n.shared.providers,t)),m={...e.height.fold(()=>({}),e=>({height:e+"px","max-height":e+"px"})),...e.width.fold(()=>({}),e=>({width:e+"px","max-width":e+"px"}))},p=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],h=new KL(e.url,{base_uri:new KL(window.location.href)}),f=`${h.protocol}://${h.host}${h.port?":"+h.port:""}`,b=nc(),v=[ZN.config({channel:`${c_}-${s}`,updateState:(e,t)=>A.some(t),initialData:e}),oh("messages",[Zr(()=>{const t=ac(ze(window),"message",t=>{if(h.isSameOrigin(new KL(t.raw.origin))){const n=t.raw.data;ZL(n)?((e,t,o)=>{switch(o.mceAction){case"insertContent":e.insertContent(o.content);break;case"setContent":e.setContent(o.content);break;case"execCommand":const n=!!d(o.ui)&&o.ui;e.execCommand(o.cmd,n,o.value);break;case"close":t.close();break;case"block":t.block(o.message);break;case"unblock":t.unblock()}})(o,x,n):(e=>!ZL(e)&&a(e)&&ve(e,"mceAction"))(n)&&e.onMessage(x,n)}});b.set(t)}),Qr(b.clear)]),Fl.config({channels:{[g_]:{onReceive:(e,t)=>{yi(e.element,"iframe").each(e=>{const o=e.dom.contentWindow;g(o)&&o.postMessage(t,f)})}}}})],y=VL({id:s,header:i,body:l,footer:c,extraClasses:p,extraBehaviours:v,extraStyles:m},u,n),x=(e=>{const t=t=>{e.getSystem().isConnected()&&t(e)};return{block:e=>{if(!r(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(t=>{Nr(t,AC,{message:e})})},unblock:()=>{t(e=>{Rr(e,MC)})},close:()=>{t(e=>{Rr(e,OC)})},sendMessage:e=>{t(t=>{t.getSystem().broadcastOn([g_],e)})}}})(y);return{dialog:y,instanceApi:x}},ez=(e,t)=>Kn(Xn("data",t,e)),tz=e=>tC(e,".tox-alert-dialog")||tC(e,".tox-confirm-dialog"),oz=(e,t,o)=>t&&o?[]:[iM.config({contextual:{lazyContext:()=>A.some(Qo(ze(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:t=>QS(e,t.element).map(e=>({bounds:eC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})})).getOrThunk(()=>({bounds:on(),optScrollEnv:A.none()}))})],nz=e=>{const t=e.editor,o=uv(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const s=()=>{uR.hide(l),n()},r=Jh($T({name:"close-alert",text:"OK",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"cancel",e)),a=SL(),i=wL(s,t.providers),l=di(_L({lazySink:()=>t.getSink(),header:xL(a,i),body:CL(o,t.providers),footer:A.some(kL(OL([],[r.asSpec()]))),onEscape:s,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[jr(_C,s)],eventOrder:{}}));uR.show(l);const c=r.get(l);ih.focus(c)}}})(e.backstages.dialog),s=(e=>{const t=e.shared;return{open:(o,n)=>{const s=e=>{uR.hide(c),n(e)},r=Jh($T({name:"yes",text:"Yes",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"submit",e)),a=$T({name:"no",text:"No",primary:!1,buttonType:A.some("secondary"),align:"end",enabled:!0,icon:A.none()},"cancel",e),i=SL(),l=wL(()=>s(!1),t.providers),c=di(_L({lazySink:()=>t.getSink(),header:xL(i,l),body:CL(o,t.providers),footer:A.some(kL(OL([],[a,r.asSpec()]))),onEscape:()=>s(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[jr(_C,()=>s(!1)),jr(EC,()=>s(!0))],eventOrder:{}}));uR.show(c);const d=r.get(c);ih.focus(d)}}})(e.backstages.dialog),r=(t,o)=>YN.open((t,n,s)=>{const r=n,a=((e,t,o)=>{const n=da("dialog"),s=e.internalDialog,r=ML(s.title,n,o),a=Ms(s.size),i=NL(a.get()).toArray(),l=((e,t,o)=>{const n=vL(e,t,A.none(),o,!1);return uR.parts.body(n)})({body:s.body,initialData:s.initialData},n,o),c=HL(s.buttons),d=PL(c),u=ke(0!==c.length,$L({buttons:c},n,o)),m=WL(()=>f,BL(()=>p,o.shared.providers,t),o.shared.getSink),g={id:n,header:r,body:l,footer:u,extraClasses:i,extraBehaviours:[ZN.config({channel:`${c_}-${n}`,updateState:(e,t)=>(a.set(t.internalDialog.size),LL(t.internalDialog.size,e),A.some(t)),initialData:e})],extraStyles:{}},p=VL(g,m,o),h={getId:x(n),getRoot:x(p),getBody:()=>uR.getBody(p),getFooter:()=>uR.getFooter(p),getFormWrapper:()=>{const e=uR.getBody(p);return _m.getCurrent(e).getOr(e)},toggleFullscreen:()=>{zL(p,a.get())}},f=YL(h,t.redial,d);return{dialog:p,instanceApi:f}})({dataValidator:s,initialData:r,internalDialog:t},{redial:YN.redial,closeWindow:()=>{uR.hide(a.dialog),o(a.instanceApi)}},e.backstages.dialog);return uR.show(a.dialog),a.instanceApi.setData(r),a.instanceApi},t),a=(n,s,r,a)=>YN.open((n,i,l)=>{const c=ez(i,l),d=sc(),u=e.backstages.popup.shared.header.isPositionedAtTop(),m=()=>d.on(e=>{qh.reposition(e),o&&u||iM.refresh(e)}),g=XL({dataValidator:l,initialData:c,internalDialog:n},{redial:YN.redial,closeWindow:()=>{d.on(qh.hide),t.off("ResizeEditor",m),d.clear(),r(g.instanceApi)}},e.backstages.popup,a.ariaAttrs,m),p=di(qh.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},...u?{}:{fireRepositionEventInstead:{}},inlineBehaviours:El([oh("window-manager-inline-events",[jr(_r(),(e,t)=>{Rr(g.dialog,_C)})]),...oz(t,o,u)]),isExtraPart:(e,t)=>tz(t)}));return d.set(p),qh.showWithinBounds(p,ui(g.dialog),{anchor:s},()=>{const e=t.inline?St():ze(t.getContainer()),o=Qo(e);return A.some(o)}),o&&u||(iM.refresh(p),t.on("ResizeEditor",m)),g.instanceApi.setData(c),$p.focusIn(g.dialog),g.instanceApi},n),i=(o,n,s,r)=>YN.open((o,a,i)=>{const l=ez(a,i),c=sc(),d=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>c.on(e=>{qh.reposition(e),iM.refresh(e)}),m=XL({dataValidator:i,initialData:l,internalDialog:o},{redial:YN.redial,closeWindow:()=>{c.on(qh.hide),t.off("ResizeEditor ScrollWindow ElementScroll",u),c.clear(),s(m.instanceApi)}},e.backstages.popup,r.ariaAttrs,u),g=di(qh.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:r.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:El([oh("window-manager-inline-events",[jr(_r(),(e,t)=>{Rr(m.dialog,_C)})]),iM.config({contextual:{lazyContext:()=>A.some(Qo(ze(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>QS(t,e.element).map(e=>({bounds:eC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})})).getOrThunk(()=>({bounds:on(),optScrollEnv:A.none()}))})]),isExtraPart:(e,t)=>tz(t)}));return c.set(g),qh.showWithinBounds(g,ui(m.dialog),{anchor:n},()=>e.backstages.popup.shared.getSink().toOptional().bind(e=>{const o=QS(t,e.element).map(e=>eC(e)).getOr(on()),n=Qo(ze(t.getContentAreaContainer())),s=tn(n,o);return A.some(Zo(s.x,s.y,s.width,s.height-15))})),iM.refresh(g),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",u),m.instanceApi.setData(l),$p.focusIn(m.dialog),m.instanceApi},o);return{open:(t,o,n)=>{if(!u(o)){if("toolbar"===o.inline)return a(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return i(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return a(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return r(t,n)},openUrl:(o,n)=>((o,n)=>YN.openUrl(o=>{const s=QL(o,{closeWindow:()=>{uR.hide(s.dialog),n(s.instanceApi)}},t,e.backstages.dialog);return uR.show(s.dialog),s.instanceApi},o))(o,n),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{s.open(e,t)}}};nn.add("silver",e=>{(e=>{pb(e),(e=>{const t=e.options.register,o=e=>f(e,r)?{value:zw(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:Uw(e)}),t("color_cols_foreground",{processor:n,default:Ww(e,Nw)}),t("color_cols_background",{processor:n,default:Ww(e,Lw)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:Hw}),t("color_default_background",{processor:"string",default:Hw})})(e),(e=>{const t=e.options.register;t("contextmenu_avoid_overlap",{processor:"string",default:""}),t("contextmenu_never_use_native",{processor:"boolean",default:!1}),t("contextmenu",{processor:e=>!1===e?{value:[],valid:!0}:r(e)||f(e,r)?{value:WI(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)})(e);let t=()=>on();const{dialogs:o,popups:n,renderUI:s}=iR(e,{getPopupSinkBounds:()=>t()});XS(e,n.backstage.shared);const a=nz({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}});return{renderUI:()=>{const o=s();return QS(e,n.getMothership().element).each(e=>{t=()=>eC(e)}),o},getWindowManagerImpl:x(a),getNotificationManagerImpl:()=>((e,t,o)=>{const n=t.backstage.shared,s=()=>{const t=Qo(ze(e.getContentAreaContainer())),o=on(),n=el(o.x,t.x,t.right),s=el(o.y,t.y,t.bottom),r=Math.max(t.right,o.right),a=Math.max(t.bottom,o.bottom);return A.some(Zo(n,s,r-n,a-s))};return{open:(t,r)=>{const a=()=>{r(),qh.hide(l)},i=di(ab.sketch({text:t.text,level:R(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:a,iconProvider:n.providers.icons,translationProvider:n.providers.translate})),l=di(qh.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&&Yh.setEditorTimeout(e,()=>{a()},t.timeout);const c={close:a,reposition:()=>{const t=ui(i),o={maxHeightFunction:pc()},r=e.notificationManager.getNotifications();if(r[0]===c){const e={...n.anchors.banner(),overrides:o};qh.showWithinBounds(l,t,{anchor:e},s)}else F(r,c).each(e=>{const n=r[e-1].getEl(),a={type:"node",root:St(),node:A.some(ze(n)),overrides:o,layouts:{onRtl:()=>[pl],onLtr:()=>[pl]}};qh.showWithinBounds(l,t,{anchor:a},s)})},text:e=>{ab.updateText(i,e)},settings:t,getEl:()=>i.element.dom,progressBar:{value:e=>{ab.updateProgress(i,e)}}};return c},close:e=>{e.close()},getArgs:e=>e.settings}})(e,{backstage:n.backstage},n.getMothership())}})}();
|
|
4
|
+
!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,(e,t)=>t.isPrototypeOf(e))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,(t,o)=>e(t)===o))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<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 C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const O=e=>t=>!e(t),k=e=>()=>{throw new Error(e)},_=e=>e(),T=x(!1),E=x(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:A.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return g(e)?A.some(e):A.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,D=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>D.call(e,t),F=(e,t)=>{const o=I(e,t);return-1===o?A.none():A.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},z=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},L=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const s=M.call(e,n,n+t);o.push(s)}return o},V=(e,t)=>{const o=e.length,n=new Array(o);for(let s=0;s<o;s++){const o=e[s];n[s]=t(o,s)}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 s=0,r=e.length;s<r;s++){const r=e[s];(t(r,s)?o:n).push(r)}return{pass:o,fail:n}},U=(e,t)=>{const o=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];t(s,n)&&o.push(s)}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),G=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return A.some(s);if(o(s,n))break}return A.none()})(e,t,T),$=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.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(V(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=M.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,s=e.length;n<s;n++){const s=e[n];o[String(s)]=t(s,n)}return o},Q=e=>[e],ee=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},te=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),oe=e=>te(e,0),ne=e=>te(e,e.length-1),se=p(Array.from)?Array.from:e=>M.call(e),re=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},ae=Object.keys,ie=Object.hasOwnProperty,le=(e,t)=>{const o=ae(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},ce=(e,t)=>de(e,(e,o)=>({k:o,v:t(e,o)})),de=(e,t)=>{const o={};return le(e,(e,n)=>{const s=t(e,n);o[s.k]=s.v}),o},ue=e=>(t,o)=>{e[o]=t},me=(e,t,o,n)=>{le(e,(e,s)=>{(t(e,s)?o:n)(e,s)})},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,s=o.length;n<s;n++){const s=o[n],r=e[s];if(t(r,s,e))return A.some(r)}return A.none()},fe=e=>pe(e,w),be=(e,t)=>ve(e,t)?A.from(e[t]):A.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()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),Ce=(e,t)=>null!=e?A.some(t(e)):A.none(),Oe=(e,t)=>e?A.some(t):A.none(),ke=(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 s=e.indexOf(t,o);return-1!==s&&(!!u(n)||s+t.length<=n)},Ee=(e,t)=>ke(e,t,0),Ae=(e,t)=>ke(e,t,e.length-t.length),Me=(Do=/^\s+|\s+$/g,e=>e.replace(Do,"")),De=e=>e.length>0,Be=e=>!De(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=(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])},Ne=(e,t)=>{const o=(t||document).createElement(e);return Fe(o)},ze=(e,t)=>{const o=(t||document).createTextNode(e);return Fe(o)},Le=Fe,Ve="undefined"!=typeof window?window:Function("return this;")(),He=(e,t)=>((e,t)=>{let o=null!=t?t:Ve;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t),Pe=Object.getPrototypeOf,Ue=e=>{const t=He("ownerDocument.defaultView",e);return a(e)&&((e=>((e,t)=>{const o=((e,t)=>He(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Pe(e).constructor.name))},We=e=>e.dom.nodeName.toLowerCase(),je=e=>t=>(e=>e.dom.nodeType)(t)===e,Ge=e=>$e(e)&&Ue(e.dom),$e=je(1),qe=je(3),Ye=je(9),Xe=je(11),Ke=e=>t=>$e(t)&&We(t)===e,Je=(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")}},Ze=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Qe=(e,t)=>{const o=void 0===t?document:t.dom;return Ze(o)?A.none():A.from(o.querySelector(e)).map(Le)},et=(e,t)=>e.dom===t.dom,tt=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},ot=e=>Le(e.dom.ownerDocument),nt=e=>Ye(e)?e:ot(e),st=e=>Le(nt(e).dom.documentElement),rt=e=>Le(nt(e).dom.defaultView),at=e=>A.from(e.dom.parentNode).map(Le),it=e=>A.from(e.dom.parentElement).map(Le),lt=e=>A.from(e.dom.offsetParent).map(Le),ct=e=>V(e.dom.childNodes,Le),dt=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(Le)},ut=e=>dt(e,0),mt=(e,t)=>({element:e,offset:t}),gt=(e,t)=>{const o=ct(e);return o.length>0&&t<o.length?mt(o[t],0):mt(e,t)},pt=e=>Xe(e)&&g(e.dom.host),ht=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),ft=x(ht),bt=ht?e=>Le(e.dom.getRootNode()):nt,vt=e=>pt(e)?e:Le(nt(e).dom.body),yt=e=>{const t=bt(e);return pt(t)?A.some(t):A.none()},xt=e=>Le(e.dom.host),wt=e=>{const t=qe(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return yt(Le(t)).fold(()=>o.body.contains(t),(n=wt,s=xt,e=>n(s(e))));var n,s},St=()=>Ct(Le(document)),Ct=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Le(t)},Ot=(e,t,o)=>{if(!(r(o)||d(o)||h(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},kt=(e,t,o)=>{Ot(e.dom,t,o)},_t=(e,t)=>{const o=e.dom;le(t,(e,t)=>{Ot(o,t,e)})},Tt=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Et=(e,t)=>A.from(Tt(e,t)),At=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Mt=(e,t)=>{e.dom.removeAttribute(t)},Dt=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Ie(e)&&e.style.setProperty(t,o)},Bt=(e,t)=>{Ie(e)&&e.style.removeProperty(t)},It=(e,t,o)=>{const n=e.dom;Dt(n,t,o)},Ft=(e,t)=>{const o=e.dom;le(t,(e,t)=>{Dt(o,t,e)})},Rt=(e,t)=>{const o=e.dom;le(t,(e,t)=>{e.fold(()=>{Bt(o,t)},e=>{Dt(o,t,e)})})},Nt=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||wt(e)?n:zt(o,t)},zt=(e,t)=>Ie(e)?e.style.getPropertyValue(t):"",Lt=(e,t)=>{const o=e.dom,n=zt(o,t);return A.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},Ht=(e,t,o)=>{const n=Ne(e);return It(n,t,o),Lt(n,t).isSome()},Pt=(e,t)=>{const o=e.dom;Bt(o,t),xe(Et(e,"style").map(Me),"")&&Mt(e,"style")},Ut=e=>e.dom.offsetWidth,Wt=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Nt(o,e);return parseFloat(t)||0}return n},n=(e,t)=>j(t,(t,o)=>{const n=Nt(e,o),s=void 0===n?0:parseInt(n,10);return isNaN(s)?t:t+s},0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Ie(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const s=n(e,o);return t>s?t-s:0}}},jt=Wt("height",e=>{const t=e.dom;return wt(e)?t.getBoundingClientRect().height:t.offsetHeight}),Gt=e=>jt.get(e),$t=e=>jt.getOuter(e),qt=(e,t)=>({left:e,top:t,translate:(o,n)=>qt(e+o,t+n)}),Yt=qt,Xt=(e,t)=>void 0!==e?e:void 0!==t?t:0,Kt=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,s=t.documentElement;if(o===e.dom)return Yt(o.offsetLeft,o.offsetTop);const r=Xt(null==n?void 0:n.pageYOffset,s.scrollTop),a=Xt(null==n?void 0:n.pageXOffset,s.scrollLeft),i=Xt(s.clientTop,o.clientTop),l=Xt(s.clientLeft,o.clientLeft);return Jt(e).translate(a-l,r-i)},Jt=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Yt(o.offsetLeft,o.offsetTop):wt(e)?(e=>{const t=e.getBoundingClientRect();return Yt(t.left,t.top)})(t):Yt(0,0)},Zt=Wt("width",e=>e.dom.offsetWidth),Qt=e=>Zt.get(e),eo=e=>Zt.getOuter(e),to=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},oo=()=>no(0,0),no=(e,t)=>({major:e,minor:t}),so={nu:no,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?oo():((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 no(n(1),n(2))})(e,o)},unknown:oo},ro=(e,t)=>{const o=String(t).toLowerCase();return G(e,e=>e.search(o))},ao=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,io=e=>t=>Te(t,e),lo=[{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]+).*/,ao],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:[ao,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:io("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:io("firefox")},{name:"Safari",versionRegexes:[ao,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Te(e,"safari")||Te(e,"mobile/"))&&Te(e,"applewebkit")}],co=[{name:"Windows",search:io("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:io("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:io("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:io("linux"),versionRegexes:[]},{name:"Solaris",search:io("sunos"),versionRegexes:[]},{name:"FreeBSD",search:io("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:io("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],uo={browsers:x(lo),oses:x(co)},mo="Edge",go="Chromium",po="Opera",ho="Firefox",fo="Safari",bo=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(mo),isChromium:n(go),isIE:n("IE"),isOpera:n(po),isFirefox:n(ho),isSafari:n(fo)}},vo=()=>bo({current:void 0,version:so.unknown()}),yo=bo,xo=(x(mo),x(go),x("IE"),x(po),x(ho),x(fo),"Windows"),wo="Android",So="Linux",Co="macOS",Oo="Solaris",ko="FreeBSD",_o="ChromeOS",To=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(xo),isiOS:n("iOS"),isAndroid:n(wo),isMacOS:n(Co),isLinux:n(So),isSolaris:n(Oo),isFreeBSD:n(ko),isChromeOS:n(_o)}},Eo=()=>To({current:void 0,version:so.unknown()}),Ao=To,Mo=(x(xo),x("iOS"),x(wo),x(So),x(Co),x(Oo),x(ko),x(_o),e=>window.matchMedia(e).matches);var Do;let Bo=to(()=>((e,t,o)=>{const n=uo.browsers(),s=uo.oses(),r=t.bind(e=>((e,t)=>re(t.brands,t=>{const o=t.brand.toLowerCase();return G(e,e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())}).map(e=>({current:e.name,version:so.nu(parseInt(t.version,10),0)}))}))(n,e)).orThunk(()=>((e,t)=>ro(e,t).map(e=>{const o=so.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(n,e)).fold(vo,yo),a=((e,t)=>ro(e,t).map(e=>{const o=so.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(s,e).fold(Eo,Ao),i=((e,t,o,n)=>{const s=e.isiOS()&&!0===/ipad/i.test(o),r=e.isiOS()&&!s,a=e.isiOS()||e.isAndroid(),i=a||n("(pointer:coarse)"),l=s||!r&&a&&n("(min-device-width:768px)"),c=r||a&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:x(s),isiPhone:x(r),isTablet:x(l),isPhone:x(c),isTouch:x(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:x(d),isDesktop:x(u)}})(a,r,e,o);return{browser:r,os:a,deviceType:i}})(navigator.userAgent,A.from(navigator.userAgentData),Mo));const Io=()=>Bo(),Fo=e=>{const t=Le((e=>{if(ft()&&g(e.target)){const t=Le(e.target);if($e(t)&&(e=>g(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return oe(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),s=y(n,o);return((e,t,o,n,s,r,a)=>({target:e,x:t,y:o,stop:n,prevent:s,kill:r,raw:a}))(t,e.clientX,e.clientY,o,n,s,e)},Ro=(e,t,o,n,s)=>{const r=((e,t)=>o=>{e(o)&&t(Fo(o))})(o,n);return e.dom.addEventListener(t,r,s),{unbind:C(No,e,t,r,s)}},No=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},zo=(e,t)=>{at(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},Lo=(e,t)=>{const o=(e=>A.from(e.dom.nextSibling).map(Le))(e);o.fold(()=>{at(e).each(e=>{Ho(e,t)})},e=>{zo(e,t)})},Vo=(e,t)=>{ut(e).fold(()=>{Ho(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},Ho=(e,t)=>{e.dom.appendChild(t.dom)},Po=(e,t)=>{H(t,t=>{Ho(e,t)})},Uo=e=>{e.dom.textContent="",H(ct(e),e=>{Wo(e)})},Wo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},jo=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Yt(o,n)},Go=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},$o=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),qo=e=>{const t=void 0===e?window:e,o=t.document,n=jo(Le(o));return(e=>{const t=void 0===e?window:e;return Io().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold(()=>{const e=t.document.documentElement,o=e.clientWidth,s=e.clientHeight;return $o(n.left,n.top,o,s)},e=>$o(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height))},Yo=()=>Le(document),Xo=(e,t)=>e.view(t).fold(x([]),t=>{const o=e.owner(t),n=Xo(e,o);return[t].concat(n)});var Ko=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?A.none():A.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(Le)},owner:e=>ot(e)});const Jo=e=>{const t=Yo(),o=jo(t),n=((e,t)=>{const o=t.owner(e),n=Xo(t,o);return A.some(n)})(e,Ko);return n.fold(C(Kt,e),t=>{const n=Jt(e),s=W(t,(e,t)=>{const o=Jt(t);return{left:e.left+o.left,top:e.top+o.top}},{left:0,top:0});return Yt(s.left+n.left+o.left,s.top+n.top+o.top)})},Zo=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Qo=e=>{const t=Kt(e),o=eo(e),n=$t(e);return Zo(t.left,t.top,o,n)},en=e=>{const t=Jo(e),o=eo(e),n=$t(e);return Zo(t.left,t.top,o,n)},tn=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),s=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return Zo(o,n,s-o,r-n)},on=()=>qo(window);var nn=tinymce.util.Tools.resolve("tinymce.ThemeManager");const sn=e=>{const t=t=>t(e),o=x(e),n=()=>s,s={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:E,isError:T,map:t=>an.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>A.some(e)};return s},rn=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:T,isError:E,map:t,mapError:t=>an.error(t(e)),bind:t,exists:T,forall:E,getOr:w,or:w,getOrThunk:_,orThunk:_,getOrDie:k(String(e)),each:b,toOptional:A.none};return o},an={value:sn,error:rn,fromOption:(e,t)=>e.fold(()=>rn(t),sn)};var ln;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(ln||(ln={}));const cn=(e,t,o)=>e.stype===ln.Error?t(e.serror):o(e.svalue),dn=e=>({stype:ln.Value,svalue:e}),un=e=>({stype:ln.Error,serror:e}),mn=dn,gn=un,pn=cn,hn=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),fn=(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)}},bn=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 s=t[n];for(const t in s)ve(s,t)&&(o[t]=e(o[t],s[t]))}return o},vn=bn((e,t)=>i(e)&&i(t)?vn(e,t):t),yn=bn((e,t)=>t),xn=e=>({tag:"defaultedThunk",process:e}),wn=e=>xn(x(e)),Sn=e=>({tag:"mergeWithThunk",process:e}),Cn=e=>{const t=(e=>{const t=[],o=[];return H(e,e=>{cn(e,e=>o.push(e),e=>t.push(e))}),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,y(gn,q)(o)):mn(t.values);var o},On=e=>a(e)&&ae(e).length>100?" removed due to size":JSON.stringify(e,null,2),kn=(e,t)=>gn([{path:e,getErrorInfo:t}]),_n=e=>({extract:(t,o)=>((e,t)=>e.stype===ln.Error?t(e.serror):e)(e(o),e=>((e,t)=>kn(e,x(t)))(t,e)),toString:x("val")}),Tn=_n(mn),En=(e,t,o,n)=>n(be(e,t).getOrThunk(()=>o(e))),An=(e,t,o,n,s)=>{const r=e=>s.extract(t.concat([n]),e),a=e=>e.fold(()=>mn(A.none()),e=>((e,t)=>e.stype===ln.Value?{stype:ln.Value,svalue:t(e.svalue)}:e)(s.extract(t.concat([n]),e),A.some));switch(e.tag){case"required":return((e,t,o,n)=>be(t,o).fold(()=>((e,t,o)=>kn(e,()=>'Could not find valid *required* value for "'+t+'" in '+On(o)))(e,o,t),n))(t,o,n,r);case"defaultedThunk":return En(o,n,e.process,r);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 En(o,n,x({}),t=>{const n=vn(e.process(o),t);return r(n)})}},Mn=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),Dn=e=>ae(ge(e,g)),Bn=e=>{const t=In(e),o=W(e,(e,t)=>fn(t,t=>vn(e,{[t]:!0}),x(e)),{});return{extract:(e,n)=>{const s=d(n)?[]:Dn(n),r=U(s,e=>!ye(o,e));return 0===r.length?t.extract(e,n):((e,t)=>kn(e,()=>"There are unsupported fields: ["+t.join(", ")+"] specified"))(e,r)},toString:t.toString}},In=e=>({extract:(t,o)=>((e,t,o)=>{const n={},s=[];for(const r of o)fn(r,(o,r,a,i)=>{const l=An(a,e,t,o,i);pn(l,e=>{s.push(...e)},e=>{n[r]=e})},(e,o)=>{n[e]=o(t)});return s.length>0?gn(s):mn(n)})(t,o,e),toString:()=>{const t=V(e,e=>fn(e,(e,t,o,n)=>e+" -> "+n.toString(),(e,t)=>"state("+e+")"));return"obj{\n"+t.join("\n")+"}"}}),Fn=e=>({extract:(t,o)=>{const n=V(o,(o,n)=>e.extract(t.concat(["["+n+"]"]),o));return Cn(n)},toString:()=>"array("+e.toString()+")"}),Rn=(e,t)=>{const o=void 0!==t?t:w;return{extract:(t,n)=>{const s=[];for(const r of e){const e=r.extract(t,n);if(e.stype===ln.Value)return{stype:ln.Value,svalue:o(e.svalue)};s.push(e)}return Cn(s)},toString:()=>"oneOf("+V(e,e=>e.toString()).join(", ")+")"}},Nn=(e,t)=>({extract:(o,n)=>{const s=ae(n),r=((t,o)=>Fn(_n(e)).extract(t,o))(o,s);return((e,t)=>e.stype===ln.Value?t(e.svalue):e)(r,e=>{const s=V(e,e=>hn(e,e,{tag:"required",process:{}},t));return In(s).extract(o,n)})},toString:()=>"setOf("+t.toString()+")"}),zn=y(Fn,In),Ln=x(Tn),Vn=(e,t)=>_n(o=>{const n=typeof o;return e(o)?mn(o):gn(`Expected type: ${t} but got: ${n}`)}),Hn=Vn(h,"number"),Pn=Vn(r,"string"),Un=Vn(d,"boolean"),Wn=Vn(p,"function"),jn=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=>jn(e[t]));default:return!1}},Gn=_n(e=>jn(e)?mn(e):gn("Expected value to be acceptable for sending via postMessage")),$n=(e,t)=>({extract:(o,n)=>be(n,e).fold(()=>((e,t)=>kn(e,()=>'Choice schema did not contain choice key: "'+t+'"'))(o,e),e=>((e,t,o,n)=>be(o,n).fold(()=>((e,t,o)=>kn(e,()=>'The chosen schema: "'+o+'" did not exist in branches: '+On(t)))(e,o,n),o=>o.extract(e.concat(["branch: "+n]),t)))(o,n,t,e)),toString:()=>"chooseOn("+e+"). Possible values: "+ae(t)}),qn=e=>_n(t=>e(t).fold(gn,mn)),Yn=(e,t)=>Nn(t=>e(t).fold(un,dn),t),Xn=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===ln.Error?{stype:ln.Error,serror:t(e.serror)}:e)(t.extract([e],o),e=>({input:o,errors:e})))(e,t,o),cn(n,an.error,an.value);var n},Kn=e=>e.fold(e=>{throw new Error(Zn(e))},w),Jn=(e,t,o)=>Kn(Xn(e,t,o)),Zn=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:x("... (only showing first ten failures)")}]):e;return V(t,e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo())})(e.errors).join("\n")+"\n\nInput object: "+On(e.input),Qn=(e,t)=>$n(e,ce(t,In)),es=(e,t)=>((e,t)=>{const o=to(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),ts=hn,os=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),ns=e=>qn(t=>R(e,t)?an.value(t):an.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`)),ss=e=>ts(e,e,{tag:"required",process:{}},Ln()),rs=(e,t)=>ts(e,e,{tag:"required",process:{}},t),as=e=>rs(e,Hn),is=e=>rs(e,Pn),ls=(e,t)=>ts(e,e,{tag:"required",process:{}},ns(t)),cs=e=>rs(e,Wn),ds=(e,t)=>ts(e,e,{tag:"required",process:{}},In(t)),us=(e,t)=>ts(e,e,{tag:"required",process:{}},zn(t)),ms=(e,t)=>ts(e,e,{tag:"required",process:{}},Fn(t)),gs=e=>ts(e,e,{tag:"option",process:{}},Ln()),ps=(e,t)=>ts(e,e,{tag:"option",process:{}},t),hs=e=>ps(e,Hn),fs=e=>ps(e,Pn),bs=(e,t)=>ps(e,ns(t)),vs=e=>ps(e,Wn),ys=(e,t)=>ps(e,Fn(t)),xs=(e,t)=>ps(e,In(t)),ws=(e,t)=>ts(e,e,wn(t),Ln()),Ss=(e,t,o)=>ts(e,e,wn(t),o),Cs=(e,t)=>Ss(e,t,Hn),Os=(e,t)=>Ss(e,t,Pn),ks=(e,t,o)=>Ss(e,t,ns(o)),_s=(e,t)=>Ss(e,t,Un),Ts=(e,t)=>Ss(e,t,Wn),Es=(e,t,o)=>Ss(e,t,Fn(o)),As=(e,t,o)=>Ss(e,t,In(o)),Ms=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Ds=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,s)=>{const r=ae(n);if(1!==r.length)throw new Error("one and only one name per case");const a=r[0],i=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!l(i))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+i.length+" ("+i+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,o)},match:e=>{const n=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};Ds([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Bs=(e,t)=>((e,t)=>({[e]:t}))(e,t),Is=e=>(e=>{const t={};return H(e,e=>{t[e.key]=e.value}),t})(e),Fs=e=>p(e)?e:T,Rs=(e,t,o)=>{let n=e.dom;const s=Fs(o);for(;n.parentNode;){n=n.parentNode;const e=Le(n),o=t(e);if(o.isSome())return o;if(s(e))break}return A.none()},Ns=(e,t,o)=>{const n=t(e),s=Fs(o);return n.orThunk(()=>s(e)?A.none():Rs(e,t,s))},zs=(e,t)=>et(e.element,t.event.target),Ls={can:E,abort:T,run:b},Vs=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{...Ls,...e}},Hs=x,Ps=Hs("touchstart"),Us=Hs("touchmove"),Ws=Hs("touchend"),js=Hs("touchcancel"),Gs=Hs("mousedown"),$s=Hs("mousemove"),qs=Hs("mouseout"),Ys=Hs("mouseup"),Xs=Hs("mouseover"),Ks=Hs("focusin"),Js=Hs("focusout"),Zs=Hs("keydown"),Qs=Hs("keyup"),er=Hs("input"),tr=Hs("change"),or=Hs("click"),nr=Hs("transitioncancel"),sr=Hs("transitionend"),rr=Hs("transitionstart"),ar=Hs("selectstart"),ir=e=>x("alloy."+e),lr={tap:ir("tap")},cr=ir("focus"),dr=ir("blur.post"),ur=ir("paste.post"),mr=ir("receive"),gr=ir("execute"),pr=ir("focus.item"),hr=lr.tap,fr=ir("longpress"),br=ir("sandbox.close"),vr=ir("typeahead.cancel"),yr=ir("system.init"),xr=ir("system.touchmove"),wr=ir("system.touchend"),Sr=ir("system.scroll"),Cr=ir("system.resize"),Or=ir("system.attached"),kr=ir("system.detached"),_r=ir("system.dismissRequested"),Tr=ir("system.repositionRequested"),Er=ir("focusmanager.shifted"),Ar=ir("slotcontainer.visibility"),Mr=ir("system.external.element.scroll"),Dr=ir("change.tab"),Br=ir("dismiss.tab"),Ir=ir("highlight"),Fr=ir("dehighlight"),Rr=(e,t)=>{Vr(e,e.element,t,{})},Nr=(e,t,o)=>{Vr(e,e.element,t,o)},zr=e=>{Rr(e,gr())},Lr=(e,t,o)=>{Vr(e,t,o,{})},Vr=(e,t,o,n)=>{const s={target:t,...n};e.getSystem().triggerEvent(o,t,s)},Hr=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},Pr=e=>Is(e),Ur=(e,t)=>({key:e,value:Vs({abort:t})}),Wr=e=>({key:e,value:Vs({run:(e,t)=>{t.event.prevent()}})}),jr=(e,t)=>({key:e,value:Vs({run:t})}),Gr=(e,t,o)=>({key:e,value:Vs({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),$r=e=>t=>({key:e,value:Vs({run:(e,o)=>{zs(e,o)&&t(e,o)}})}),qr=(e,t,o)=>((e,t)=>jr(e,(o,n)=>{o.getSystem().getByUid(t).each(t=>{Hr(t,t.element,e,n)})}))(e,t.partUids[o]),Yr=(e,t)=>jr(e,(e,o)=>{const n=o.event,s=e.getSystem().getByDom(n.target).getOrThunk(()=>Ns(n.target,t=>e.getSystem().getByDom(t).toOptional(),T).getOr(e));t(e,s,o)}),Xr=e=>jr(e,(e,t)=>{t.cut()}),Kr=e=>jr(e,(e,t)=>{t.stop()}),Jr=(e,t)=>$r(e)(t),Zr=$r(Or()),Qr=$r(kr()),ea=$r(yr()),ta=(ia=gr(),e=>jr(ia,e)),oa=e=>e.dom.innerHTML,na=(e,t)=>{const o=ot(e).dom,n=Le(o.createDocumentFragment()),s=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,ct(Le(o))})(t,o);Po(n,s),Uo(e),Ho(e,n)},sa=(e,t)=>Le(e.dom.cloneNode(t)),ra=e=>(e=>{if(pt(e))return"#shadow-root";{const t=(e=>sa(e,!1))(e);return(e=>{const t=Ne("div"),o=Le(e.dom.cloneNode(!0));return Ho(t,o),oa(t)})(t)}})(e),aa=Pr([(e=>({key:e,value:Vs({can:(e,t)=>{const o=t.event,n=o.originator,s=o.target;return!((e,t,o)=>et(t,e.element)&&!et(t,o))(e,n,s)||(console.warn(cr()+" did not get interpreted by the desired target. \nOriginator: "+ra(n)+"\nTarget: "+ra(s)+"\nCheck the "+cr()+" event handlers"),!1)}})}))(cr())]);var ia,la=Object.freeze({__proto__:null,events:aa});let ca=0;const da=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Math.random());return ca++,e+"_"+o+ca+String(t)},ua=x("alloy-id-"),ma=x("data-alloy-id"),ga=ua(),pa=ma(),ha=(e,t)=>{Object.defineProperty(e.dom,pa,{value:t,writable:!0})},fa=e=>{const t=$e(e)?e.dom[pa]:null;return A.from(t)},ba=e=>da(e),va=w,ya=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+ra(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}},xa=ya(),wa=e=>V(e,e=>Ae(e,"/*")?e.substring(0,e.length-2):e),Sa=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:wa(r)}),e},Ca=da("alloy-premade"),Oa=e=>(Object.defineProperty(e.element.dom,Ca,{value:e.uid,writable:!0}),Bs(Ca,e)),ka=e=>be(e,Ca),_a=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,s=o.indexOf("("),r=o.substring(s+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:wa(r.slice(1))}),e})((t,...o)=>e(t.getApis(),t,...o),e),Ta={init:()=>Ea({readState:x("No State required")})},Ea=e=>e,Aa=(e,t)=>{const o={};return le(e,(e,n)=>{le(e,(e,s)=>{const r=be(o,s).getOr([]);o[s]=r.concat([t(n,e)])})}),o},Ma=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),Da=e=>e.cHandler,Ba=(e,t)=>({name:e,handler:t}),Ia=(e,t)=>{const o={};return H(e,e=>{o[e.name()]=e.handlers(t)}),o},Fa=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const s=ee(o,(o,s)=>{const r=o[t],a=s[t],i=n.indexOf(r),l=n.indexOf(a);if(-1===i)throw new Error("The ordering for "+e+" does not have an entry for "+r+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+a+".\nOrder specified: "+JSON.stringify(n,null,2));return i<l?-1:l<i?1:0});return an.value(s)}catch(e){return an.error([e])}})("Event: "+o,"name",e,n).map(e=>(e=>{const t=(e=>(...t)=>j(e,(e,o)=>e&&(e=>e.can)(o).apply(void 0,t),!0))(e),o=(e=>(...t)=>j(e,(e,o)=>e||(e=>e.abort)(o).apply(void 0,t),!1))(e);return{can:t,abort:o,run:(...t)=>{H(e,e=>{e.run.apply(void 0,t)})}}})(V(e,e=>e.handler))):((e,t)=>an.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(V(t,e=>e.name),null,2)]))(o,e)},Ra=(e,t)=>((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,an.error(q(n))):((e,t)=>0===e.length?an.value(t):an.value(vn(t,yn.apply(void 0,e))))(o.values,t);var n})(pe(e,(e,o)=>(1===e.length?an.value(e[0].handler):Fa(e,t,o)).map(n=>{const s=(e=>{const t=(e=>p(e)?{can:E,abort:T,run:e}:e)(e);return(e,o,...n)=>{const s=[e,o].concat(n);t.abort.apply(void 0,s)?o.stop():t.can.apply(void 0,s)&&t.run.apply(void 0,s)}})(n),r=e.length>1?U(t[o],t=>N(e,e=>e.name===t)).join(" > "):e[0].name;return Bs(o,((e,t)=>({handler:e,purpose:t}))(s,r))})),{}),Na="alloy.base.behaviour",za=In([ts("dom","dom",{tag:"required",process:{}},In([ss("tag"),ws("styles",{}),ws("classes",[]),ws("attributes",{}),gs("value"),gs("innerHtml")])),ss("components"),ss("uid"),ws("events",{}),ws("apis",{}),ts("eventOrder","eventOrder",(mi={[gr()]:["disabling",Na,"toggling","typeaheadevents"],[cr()]:[Na,"focusing","keying"],[yr()]:[Na,"disabling","toggling","representing"],[er()]:[Na,"representing","streaming","invalidating"],[kr()]:[Na,"representing","item-events","toolbar-button-events","tooltipping"],[Gs()]:["focusing",Na,"item-type-events"],[Ps()]:["focusing",Na,"item-type-events"],[Xs()]:["item-type-events","tooltipping"],[mr()]:["receiving","reflecting","tooltipping"]},Sn(x(mi))),Ln()),gs("domModification")]),La=e=>e.events,Va=(e,t)=>{const o=Tt(e,t);return void 0===o||""===o?[]:o.split(" ")},Ha=e=>void 0!==e.dom.classList,Pa=e=>Va(e,"class"),Ua=(e,t)=>((e,t,o)=>{const n=Va(e,t).concat([o]);return kt(e,t,n.join(" ")),!0})(e,"class",t),Wa=(e,t)=>((e,t,o)=>{const n=U(Va(e,t),e=>e!==o);return n.length>0?kt(e,t,n.join(" ")):Mt(e,t),!1})(e,"class",t),ja=(e,t)=>{Ha(e)?e.dom.classList.add(t):Ua(e,t)},Ga=e=>{0===(Ha(e)?e.dom.classList:Pa(e)).length&&Mt(e,"class")},$a=(e,t)=>{Ha(e)?e.dom.classList.remove(t):Wa(e,t),Ga(e)},qa=(e,t)=>Ha(e)&&e.dom.classList.contains(t),Ya=(e,t)=>{H(t,t=>{ja(e,t)})},Xa=(e,t)=>{H(t,t=>{$a(e,t)})},Ka=e=>Ha(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):Pa(e),Ja=e=>e.dom.value,Za=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},Qa=(e,t,o)=>{o.fold(()=>Ho(e,t),e=>{et(e,t)||(zo(e,t),Wo(e))})},ei=(e,t,o)=>{const n=V(t,o),s=ct(e);return H(s.slice(n.length),Wo),n},ti=(e,t,o,n)=>{const s=dt(e,t),r=n(o,s),a=((e,t,o)=>dt(e,t).map(e=>{if(o.exists(t=>!et(t,e))){const t=o.map(We).getOr("span"),n=Ne(t);return zo(e,n),n}return e}))(e,t,s);return Qa(e,r.element,a),r},oi=(e,t)=>{const o=ae(e),n=ae(t),s=J(n,o),r=(e=>{const o={},n={};return me(e,(e,o)=>!ve(t,o)||e!==t[o],ue(o),ue(n)),{t:o,f:n}})(e).t;return{toRemove:s,toSet:r}},ni=(e,t)=>{const o=t.filter(t=>We(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>ve(e.dom,Ca))(t)).bind(t=>((e,t)=>{try{const o=((e,t)=>{const{class:o,style:n,...s}=(e=>j(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}))(t),{toSet:r,toRemove:a}=oi(e.attributes,s),i=Vt(t),{toSet:l,toRemove:c}=oi(e.styles,i),d=Ka(t),u=J(d,e.classes),m=J(e.classes,d);return H(a,e=>Mt(t,e)),_t(t,r),Ya(t,m),Xa(t,u),H(c,e=>Pt(t,e)),Ft(t,l),e.innerHtml.fold(()=>{const o=e.domChildren;((e,t)=>{ei(e,t,(t,o)=>{const n=dt(e,o);return Qa(e,t,n),t})})(t,o)},e=>{na(t,e)}),(()=>{const o=t,n=e.value.getOrUndefined();n!==Ja(o)&&Za(o,null!=n?n:"")})(),t})(e,t);return A.some(o)}catch(e){return A.none()}})(e,t)).getOrThunk(()=>(e=>{const t=Ne(e.tag);_t(t,e.attributes),Ya(t,e.classes),Ft(t,e.styles),e.innerHtml.each(e=>na(t,e));const o=e.domChildren;return Po(t,o),e.value.each(e=>{Za(t,e)}),t})(e));return ha(o,e.uid),o},si=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((e,t)=>((e,t)=>{const o=V(t,e=>xs(e.name(),[ss("config"),ws("state",Ta)])),n=Xn("component.behaviours",In(o),e.behaviours).fold(t=>{throw new Error(Zn(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))(e,t)},ri=(e,t)=>{const o=()=>m,n=Ms(xa),s=Kn((e=>Xn("custom.definition",za,e))(e)),r=si(e),a=(e=>e.list)(r),i=(e=>e.data)(r),l=((e,t,o)=>{const n={...(s=e).dom,uid:s.uid,domChildren:V(s.components,e=>e.element)};var s;const r=(e=>e.domModification.fold(()=>Ma({}),Ma))(e),a={"alloy.base.modification":r},i=t.length>0?((e,t,o,n)=>{const s={...t};H(o,t=>{s[t.name()]=t.exhibit(e,n)});const r=Aa(s,(e,t)=>({name:e,modification:t})),a=e=>W(e,(e,t)=>({...t.modification,...e}),{}),i=W(r.classes,(e,t)=>t.modification.concat(e),[]),l=a(r.attributes),c=a(r.styles);return Ma({classes:i,attributes:l,styles:c})})(o,a,t,n):r;return l=n,c=i,{...l,attributes:{...l.attributes,...c.attributes},styles:{...l.styles,...c.styles},classes:l.classes.concat(c.classes)};var l,c})(s,a,i),c=ni(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":La(e)};return((e,t,o,n)=>{const s=((e,t,o)=>{const n={...o,...Ia(t,e)};return Aa(n,Ba)})(e,o,n);return Ra(s,t)})(o,e.eventOrder,t,n).getOrDie()})(s,a,i),u=Ms(s.components),m={uid:e.uid,getSystem:n.get,config:t=>{const o=i;return(p(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>p(i[e.name()]),spec:e,readState:e=>i[e]().map(e=>e.state.readState()).getOr("not enabled"),getApis:()=>s.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(ya(o))},element:c,syncComponents:()=>{const e=ct(c),t=Y(e,e=>n.get().getByDom(e).fold(()=>[],Q));u.set(t)},components:u.get,events:d};return m},ai=e=>{const t=ze(e);return ii({element:t})},ii=e=>{const t=Jn("external.component",Bn([ss("element"),gs("uid")]),e),o=Ms(ya()),n=t.uid.getOrThunk(()=>ba("external"));ha(t.element,n);const s={uid:n,getSystem:o.get,config:A.none,hasConfigured:T,connect:e=>{o.set(e)},disconnect:()=>{o.set(ya(()=>s))},getApis:()=>({}),element:t.element,spec:e,readState:x("No state"),syncComponents:b,components:x([]),events:{}};return Oa(s)},li=ba,ci=(e,t)=>ka(e).getOrThunk(()=>((e,t)=>{const{events:o,...n}=va(e),s=((e,t)=>{const o=be(e,"components").getOr([]);return t.fold(()=>V(o,di),e=>V(o,(t,o)=>ci(t,dt(e,o))))})(n,t),r={...n,events:{...la,...o},components:s};return an.value(ri(r,t))})((e=>ve(e,"uid"))(e)?e:{uid:li(""),...e},t).getOrDie()),di=e=>ci(e,A.none()),ui=Oa;var mi,gi=(e,t,o,n,s)=>e(o,n)?A.some(o):p(s)&&s(o)?A.none():t(o,n,s);const pi=(e,t,o)=>{let n=e.dom;const s=p(o)?o:T;for(;n.parentNode;){n=n.parentNode;const e=Le(n);if(t(e))return A.some(e);if(s(e))break}return A.none()},hi=(e,t,o)=>gi((e,t)=>t(e),pi,e,t,o),fi=(e,t,o)=>hi(e,t,o).isSome(),bi=(e,t,o)=>pi(e,e=>Je(e,t),o),vi=(e,t)=>(e=>G(e.dom.childNodes,e=>{return o=Le(e),Je(o,t);var o}).map(Le))(e),yi=(e,t)=>Qe(t,e),xi=(e,t,o)=>gi((e,t)=>Je(e,t),bi,e,t,o),wi="aria-controls",Si=()=>{const e=da(wi);return{id:e,link:t=>{kt(t,wi,e)},unlink:e=>{Mt(e,wi)}}},Ci=(e,t)=>fi(t,t=>et(t,e.element),T)||((e,t)=>(e=>hi(e,e=>{if(!$e(e))return!1;const t=Tt(e,"id");return void 0!==t&&t.indexOf(wi)>-1}).bind(e=>{const t=Tt(e,"id"),o=bt(e);return yi(o,`[${wi}="${t}"]`)}))(t).exists(t=>Ci(e,t)))(e,t);var Oi;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(Oi||(Oi={}));const ki=Ms({}),_i=["alloy/data/Fields","alloy/debugging/Debugging"],Ti=(e,t,o)=>((e,t,o)=>{switch(be(ki.get(),e).orThunk(()=>{const t=ae(ki.get());return re(t,t=>e.indexOf(t)>-1?A.some(ki.get()[t]):A.none())}).getOr(Oi.NORMAL)){case Oi.NORMAL:return o(Ei());case Oi.LOGGING:{const n=((e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const s=(new Date).getTime();R(["mousemove","mouseover","mouseout",yr()],e)||console.log(e,{event:e,time:s-n,target:t.dom,sequence:V(o,e=>R(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ra(e.target)+")":e.outcome)})}}})(e,t),s=o(n);return n.write(),s}case Oi.STOP:return!0}})(e,t,o),Ei=x({logEventCut:b,logEventStopped:b,logNoParent:b,logEventNoHandlers:b,logEventResponse:b,write:b}),Ai=x([ss("menu"),ss("selectedMenu")]),Mi=x([ss("item"),ss("selectedItem")]);x(In(Mi().concat(Ai())));const Di=x(In(Mi())),Bi=ds("initSize",[ss("numColumns"),ss("numRows")]),Ii=()=>ds("markers",[ss("backgroundMenu")].concat(Ai()).concat(Mi())),Fi=e=>ds("markers",V(e,ss)),Ri=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");G(t,e=>e.indexOf("alloy")>0&&!N(_i,t=>e.indexOf(t)>-1)).getOr("unknown")}})(),ts(t,t,o,qn(e=>an.value((...t)=>e.apply(void 0,t))))),Ni=e=>Ri(0,e,wn(b)),zi=e=>Ri(0,e,wn(A.none)),Li=e=>Ri(0,e,{tag:"required",process:{}}),Vi=e=>Ri(0,e,{tag:"required",process:{}}),Hi=(e,t)=>os(e,x(t)),Pi=e=>os(e,w),Ui=x(Bi),Wi=(e,t,o,n,s,r,a,i=!1)=>({x:e,y:t,bubble:o,direction:n,placement:s,restriction:r,label:`${a}-${s}`,alwaysFit:i}),ji=Ds([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Gi=ji.southeast,$i=ji.southwest,qi=ji.northeast,Yi=ji.northwest,Xi=ji.south,Ki=ji.north,Ji=ji.east,Zi=ji.west,Qi=(e,t,o,n)=>{const s=e+t;return s>n?o:s<o?n:s},el=(e,t,o)=>Math.min(Math.max(e,t),o),tl=(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))),ol="layout",nl=e=>e.x,sl=(e,t)=>e.x+e.width/2-t.width/2,rl=(e,t)=>e.x+e.width-t.width,al=(e,t)=>e.y-t.height,il=e=>e.y+e.height,ll=(e,t)=>e.y+e.height/2-t.height/2,cl=(e,t,o)=>Wi(nl(e),il(e),o.southeast(),Gi(),"southeast",tl(e,{left:1,top:3}),ol),dl=(e,t,o)=>Wi(rl(e,t),il(e),o.southwest(),$i(),"southwest",tl(e,{right:0,top:3}),ol),ul=(e,t,o)=>Wi(nl(e),al(e,t),o.northeast(),qi(),"northeast",tl(e,{left:1,bottom:2}),ol),ml=(e,t,o)=>Wi(rl(e,t),al(e,t),o.northwest(),Yi(),"northwest",tl(e,{right:0,bottom:2}),ol),gl=(e,t,o)=>Wi(sl(e,t),al(e,t),o.north(),Ki(),"north",tl(e,{bottom:2}),ol),pl=(e,t,o)=>Wi(sl(e,t),il(e),o.south(),Xi(),"south",tl(e,{top:3}),ol),hl=(e,t,o)=>Wi((e=>e.x+e.width)(e),ll(e,t),o.east(),Ji(),"east",tl(e,{left:0}),ol),fl=(e,t,o)=>Wi(((e,t)=>e.x-t.width)(e,t),ll(e,t),o.west(),Zi(),"west",tl(e,{right:1}),ol),bl=()=>[cl,dl,ul,ml,pl,gl,hl,fl],vl=()=>[dl,cl,ml,ul,pl,gl,hl,fl],yl=()=>[ul,ml,cl,dl,gl,pl],xl=()=>[ml,ul,dl,cl,gl,pl],wl=()=>[cl,dl,ul,ml,pl,gl],Sl=()=>[dl,cl,ml,ul,pl,gl];var Cl=Object.freeze({__proto__:null,events:e=>Pr([jr(mr(),(t,o)=>{const n=e.channels,s=ae(n),r=o,a=((e,t)=>t.universal?e:U(e,e=>R(t.channels,e)))(s,r);H(a,e=>{const o=n[e],s=o.schema,a=Jn("channel["+e+"] data\nReceiver: "+ra(t.element),s,r.data);o.onReceive(t,a)})})])}),Ol=[rs("channels",Yn(an.value,Bn([Li("onReceive"),ws("schema",Ln())])))];const kl=(e,t,o)=>ea((n,s)=>{o(n,e,t)}),_l=e=>({key:e,value:void 0}),Tl=(e,t,o,n,s,r,a)=>{const i=e=>ye(e,o)?e[o]():A.none(),l=ce(s,(e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),s=n.indexOf(")")+1,r=n.indexOf("("),a=n.substring(r+1,s-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:wa(a.slice(0,1).concat(a.slice(3)))}),e})((n,...s)=>{const r=[n].concat(s);return n.config({name:x(e)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)},e=>{const o=Array.prototype.slice.call(r,1);return t.apply(void 0,[n,e.config,e.state].concat(o))})},o,t))(o,e,t)),c={...ce(r,(e,t)=>Sa(e,t)),...l,revoke:C(_l,o),config:t=>{const n=Jn(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:to(()=>Jn(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(()=>Ma({})),name:x(o),handlers:e=>i(e).map(e=>be(n,"events").getOr(()=>({}))(e.config,e.state)).getOr({})};return c},El=e=>Is(e),Al=Bn([ss("fields"),ss("name"),ws("active",{}),ws("apis",{}),ws("state",Ta),ws("extra",{})]),Ml=e=>{const t=Jn("Creating behaviour: "+e.name,Al,e);return((e,t,o,n,s,r)=>{const a=Bn(e),i=xs(t,[(l=e,ps("config",Bn(l)))]);var l;return Tl(a,i,t,o,n,s,r)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},Dl=Bn([ss("branchKey"),ss("branches"),ss("name"),ws("active",{}),ws("apis",{}),ws("state",Ta),ws("extra",{})]),Bl=e=>{const t=Jn("Creating behaviour: "+e.name,Dl,e);return((e,t,o,n,s,r)=>{const a=e,i=xs(t,[ps("config",e)]);return Tl(a,i,t,o,n,s,r)})(Qn(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},Il=x(void 0),Fl=Ml({fields:Ol,name:"receiving",active:Cl});var Rl=Object.freeze({__proto__:null,exhibit:(e,t)=>Ma({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const Nl=(e,t=!1)=>e.dom.focus({preventScroll:t}),zl=e=>e.dom.blur(),Ll=e=>{const t=bt(e).dom;return e.dom===t.activeElement},Vl=(e=Yo())=>A.from(e.dom.activeElement).map(Le),Hl=e=>Vl(bt(e)).filter(t=>e.dom.contains(t.dom)),Pl=(e,t)=>{const o=bt(t),n=Vl(o).bind(e=>{const o=t=>et(e,t);return o(t)?A.some(t):((e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const s=Le(e.childNodes[n]);if(t(s))return A.some(s);const r=o(e.childNodes[n]);if(r.isSome())return r}return A.none()};return o(e.dom)})(t,o)}),s=e(t);return n.each(e=>{Vl(o).filter(t=>et(t,e)).fold(()=>{Nl(e)},b)}),s},Ul=(e,t,o,n,s)=>{const r=e=>e+"px";return{position:e,left:t.map(r),top:o.map(r),right:n.map(r),bottom:s.map(r)}},Wl=(e,t)=>{Rt(e,(e=>({...e,position:A.some(e.position)}))(t))},jl=Ds([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Gl=(e,t,o,n,s,r)=>{const a=t.rect,i=a.x-o,l=a.y-n,c=s-(i+a.width),d=r-(l+a.height),u=A.some(i),m=A.some(l),g=A.some(c),p=A.some(d),h=A.none();return t.direction.fold(()=>Ul(e,u,m,h,h),()=>Ul(e,h,m,g,h),()=>Ul(e,u,h,h,p),()=>Ul(e,h,h,g,p),()=>Ul(e,u,m,h,h),()=>Ul(e,u,h,h,p),()=>Ul(e,u,m,h,h),()=>Ul(e,h,m,g,h))},$l=(e,t)=>e.fold(()=>{const e=t.rect;return Ul("absolute",A.some(e.x),A.some(e.y),A.none(),A.none())},(e,o,n,s)=>Gl("absolute",t,e,o,n,s),(e,o,n,s)=>Gl("fixed",t,e,o,n,s)),ql=(e,t)=>{const o=C(Jo,t),n=e.fold(o,o,()=>{const e=jo();return Jo(t).translate(-e.left,-e.top)}),s=eo(t),r=$t(t);return Zo(n.left,n.top,s,r)},Yl=(e,t)=>t.fold(()=>e.fold(on,on,Zo),t=>e.fold(x(t),x(t),()=>{const o=Xl(e,t.x,t.y);return Zo(o.left,o.top,t.width,t.height)})),Xl=(e,t,o)=>{const n=Yt(t,o);return e.fold(x(n),x(n),()=>{const e=jo();return n.translate(-e.left,-e.top)})};jl.none;const Kl=jl.relative,Jl=jl.fixed,Zl="data-alloy-placement",Ql=e=>Et(e,Zl),ec=Ds([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),tc=(e,t,o,n)=>{const s=e.bubble,r=s.offset,a=((e,t,o)=>{const n=(n,s)=>t[n].map(t=>{const r="top"===n||"bottom"===n,a=r?o.top:o.left,i=("left"===n||"top"===n?Math.max:Math.min)(t,s)+a;return r?el(i,e.y,e.bottom):el(i,e.x,e.right)}).getOr(s),s=n("left",e.x),r=n("top",e.y),a=n("right",e.right),i=n("bottom",e.bottom);return Zo(s,r,a-s,i-r)})(n,e.restriction,r),i=e.x+r.left,l=e.y+r.top,c=Zo(i,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:m,visibleH:g}=((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:a>=o&&a<=s&&i>=n&&i<=r,sizeInBounds:l<=s&&l>=o&&c<=r&&c>=n,visibleW:Math.min(d,a>=o?s-a:l-o),visibleH:Math.min(u,i>=n?r-i:c-n)}})(c,a),p=d&&u,h=p?c:((e,t)=>{const{x:o,y:n,right:s,bottom:r}=t,{x:a,y:i,width:l,height:c}=e,d=Math.max(o,s-l),u=Math.max(n,r-c),m=el(a,o,d),g=el(i,n,u),p=Math.min(m+l,s)-m,h=Math.min(g+c,r)-g;return Zo(m,g,p,h)})(c,a),f=h.width>0&&h.height>0,{maxWidth:b,maxHeight:v}=((e,t,o)=>{const n=x(t.bottom-o.y),s=x(o.bottom-t.y),r=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,s,s,n),a=x(t.right-o.x),i=x(o.right-t.x),l=((e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n))(e,i,i,a);return{maxWidth:l,maxHeight:r}})(e.direction,h,n),y={rect:h,maxHeight:v,maxWidth:b,direction:e.direction,placement:e.placement,classes:{on:s.classesOn,off:s.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?ec.fit(y):ec.nofit(y,m,g,f)},oc=e=>{const t=Ms(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},nc=()=>oc(e=>e.unbind()),sc=()=>{const e=oc(b);return{...e,on:t=>e.get().each(t)}},rc=E,ac=(e,t,o)=>((e,t,o,n)=>Ro(e,t,o,n,!1))(e,t,rc,o),ic=(e,t,o)=>((e,t,o,n)=>Ro(e,t,o,n,!0))(e,t,rc,o),lc=Fo,cc=["top","bottom","right","left"],dc="data-alloy-transition-timer",uc=(e,t,o,n,s,a)=>{const i=((e,t,o)=>o.exists(o=>{const n=e.mode;return"all"===n||o[n]!==t[n]}))(n,s,a);if(i||((e,t)=>((e,t)=>X(t,t=>qa(e,t)))(e,t.classes))(e,n)){It(e,"position",o.position);const a=ql(t,e),l=$l(t,{...s,rect:a}),c=Z(cc,e=>l[e]);((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()})(o,c)&&(Rt(e,c),i&&((e,t)=>{Ya(e,t.classes),Et(e,dc).each(t=>{clearTimeout(parseInt(t,10)),Mt(e,dc)}),((e,t)=>{const o=nc(),n=nc();let s;const a=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return et(t.target,e)&&Be(n)&&R(cc,t.raw.propertyName)},i=r=>{if(m(r)||a(r)){o.clear(),n.clear();const a=null==r?void 0:r.raw.type;(m(a)||a===sr())&&(clearTimeout(s),Mt(e,dc),Xa(e,t.classes))}},l=ac(e,rr(),t=>{a(t)&&(l.unbind(),o.set(ac(e,sr(),i)),n.set(ac(e,nr(),i)))}),c=(e=>{const t=t=>{const o=Nt(e,t).split(/\s*,\s*/);return U(o,De)},o=e=>{if(r(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return Ae(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),s=t("transition-duration");return j(s,(e,t,s)=>{const r=o(n[s])+o(t);return Math.max(e,r)},0)})(e);requestAnimationFrame(()=>{s=setTimeout(i,c+17),kt(e,dc,s)})})(e,t)})(e,n),Ut(e))}else Xa(e,n.classes)},mc=(e,t)=>{((e,t)=>{const o=jt.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);It(e,"max-height",o+"px")})(e,Math.floor(t))},gc=x((e,t)=>{mc(e,t),Ft(e,{"overflow-x":"hidden","overflow-y":"auto"})}),pc=x((e,t)=>{mc(e,t)}),hc=(e,t,o)=>void 0===e[t]?o:e[t],fc=(e,t,o,n)=>{const s=((e,t,o,n)=>{Pt(t,"max-height"),Pt(t,"max-width");const s={width:eo(r=t),height:$t(r)};var r;return((e,t,o,n,s,r)=>{const a=n.width,i=n.height,l=(t,l,c,d,u)=>{const m=t(o,n,s,e,r),g=tc(m,a,i,r);return g.fold(x(g),(e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?g:ec.nofit(l,c,d,u))};return j(t,(e,t)=>{const o=C(l,t);return e.fold(x(e),o)},ec.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:Gi(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1)).fold(w,w)})(t,n.preference,e,s,o,n.bounds)})(e,t,o,n);return((e,t,o)=>{const n=$l(o.origin,t);o.transition.each(s=>{uc(e,o.origin,n,s,t,o.lastPlacement)}),Wl(e,n)})(t,s,n),((e,t)=>{((e,t)=>{kt(e,Zl,t)})(e,t.placement)})(t,s),((e,t)=>{const o=t.classes;Xa(e,o.off),Ya(e,o.on)})(t,s),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,s,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,s,n),{layout:s.layout,placement:s.placement}},bc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],vc=(e,t,o,n=1)=>{const s=e*n,r=t*n,a=e=>be(o,e).getOr([]),i=(e,t,o)=>{const n=J(bc,o);return{offset:Yt(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(s,r,["top","alignLeft","inset"]),insetNorthwest:()=>i(-s,r,["top","alignRight","inset"]),insetNorth:()=>i(-s/2,r,["top","alignCentre","inset"]),insetSoutheast:()=>i(s,-r,["bottom","alignLeft","inset"]),insetSouthwest:()=>i(-s,-r,["bottom","alignRight","inset"]),insetSouth:()=>i(-s/2,-r,["bottom","alignCentre","inset"]),insetEast:()=>i(-s,-r/2,["valignCentre","right","inset"]),insetWest:()=>i(s,-r/2,["valignCentre","left","inset"])}},yc=()=>vc(0,0,{}),xc=w,wc=(e,t)=>o=>"rtl"===Sc(o)?t:e,Sc=e=>"rtl"===Nt(e,"direction")?"rtl":"ltr";var Cc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Cc||(Cc={}));const Oc="data-alloy-vertical-dir",kc=e=>fi(e,e=>$e(e)&&Tt(e,"data-alloy-vertical-dir")===Cc.BottomToTop),_c=()=>xs("layouts",[ss("onLtr"),ss("onRtl"),gs("onBottomLtr"),gs("onBottomRtl")]),Tc=(e,t,o,n,s,r,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(s):l.getOr(o),u=i?t.layouts.bind(t=>t.onBottomRtl.map(t=>t(e))).or(c).getOr(r):c.getOr(n);return wc(d,u)(e)};var Ec=[ss("hotspot"),gs("bubble"),ws("overrides",{}),_c(),Hi("placement",(e,t,o)=>{const n=t.hotspot,s=ql(o,n.element),r=Tc(e.element,t,wl(),Sl(),yl(),xl(),A.some(t.hotspot.element));return A.some(xc({anchorBox:s,bubble:t.bubble.getOr(yc()),overrides:t.overrides,layouts:r}))})],Ac=[ss("x"),ss("y"),ws("height",0),ws("width",0),ws("bubble",yc()),ws("overrides",{}),_c(),Hi("placement",(e,t,o)=>{const n=Xl(o,t.x,t.y),s=Zo(n.left,n.top,t.width,t.height),r=Tc(e.element,t,bl(),vl(),bl(),vl(),A.none());return A.some(xc({anchorBox:s,bubble:t.bubble,overrides:t.overrides,layouts:r}))})];const Mc=Ds([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),Dc=e=>e.fold(w,(e,t,o)=>e.translate(-t,-o)),Bc=e=>e.fold(w,w),Ic=e=>j(e,(e,t)=>e.translate(t.left,t.top),Yt(0,0)),Fc=e=>{const t=V(e,Bc);return Ic(t)},Rc=Mc.screen,Nc=Mc.absolute,zc=(e,t,o)=>{const n=ot(e.element),s=jo(n),r=((e,t,o)=>{const n=rt(o.root).dom;return A.from(n.frameElement).map(Le).filter(t=>{const o=ot(t),n=ot(e.element);return et(o,n)}).map(Kt)})(e,0,o).getOr(s);return Nc(r,s.left,s.top)},Lc=(e,t,o,n)=>{const s=Rc(Yt(e,t));return A.some(((e,t,o)=>({point:e,width:t,height:o}))(s,o,n))},Vc=(e,t,o,n,s)=>e.map(e=>{const r=[t,e.point],a=(i=()=>Fc(r),l=()=>Fc(r),c=()=>(e=>{const t=V(e,Dc);return Ic(t)})(r),n.fold(i,l,c));var i,l,c;const d=(p=a.left,h=a.top,f=e.width,b=e.height,{x:p,y:h,width:f,height:b}),u=o.showAbove?yl():wl(),m=o.showAbove?xl():Sl(),g=Tc(s,o,u,m,u,m,A.none());var p,h,f,b;return xc({anchorBox:d,bubble:o.bubble.getOr(yc()),overrides:o.overrides,layouts:g})});var Hc=[ss("node"),ss("root"),gs("bubble"),_c(),ws("overrides",{}),ws("showAbove",!1),Hi("placement",(e,t,o)=>{const n=zc(e,0,t);return t.node.filter(wt).bind(s=>{const r=s.dom.getBoundingClientRect(),a=Lc(r.left,r.top,r.width,r.height),i=t.node.getOr(e.element);return Vc(a,n,t,o,i)})})];const Pc=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),Uc=Ds([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Wc=(Uc.before,Uc.on,Uc.after,e=>e.fold(w,w,w)),jc=Ds([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Gc={domRange:jc.domRange,relative:jc.relative,exact:jc.exact,exactFromRange:e=>jc.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Le(e.startContainer),relative:(e,t)=>Wc(e),exact:(e,t,o,n)=>e}))(e);return rt(t)},range:Pc},$c=(e,t,o)=>{const n=e.document.createRange();var s;return s=n,t.fold(e=>{s.setStartBefore(e.dom)},(e,t)=>{s.setStart(e.dom,t)},e=>{s.setStartAfter(e.dom)}),((e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})})(n,o),n},qc=(e,t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},Yc=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),Xc=Ds([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Kc=(e,t,o)=>t(Le(o.startContainer),o.startOffset,Le(o.endContainer),o.endOffset),Jc=(e,t)=>((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:x(e),rtl:A.none}),relative:(t,o)=>({ltr:to(()=>$c(e,t,o)),rtl:to(()=>A.some($c(e,o,t)))}),exact:(t,o,n,s)=>({ltr:to(()=>qc(e,t,o,n,s)),rtl:to(()=>A.some(qc(e,n,s,t,o)))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter(e=>!1===e.collapsed).map(e=>Xc.rtl(Le(e.endContainer),e.endOffset,Le(e.startContainer),e.startOffset)).getOrThunk(()=>Kc(0,Xc.ltr,o)):Kc(0,Xc.ltr,o)})(0,o)})(e,t).match({ltr:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(t.dom,o),r.setEnd(n.dom,s),r},rtl:(t,o,n,s)=>{const r=e.document.createRange();return r.setStart(n.dom,s),r.setEnd(t.dom,o),r}});Xc.ltr,Xc.rtl;const Zc=(e,t,o)=>U(((e,t)=>{const o=p(t)?t:T;let n=e.dom;const s=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Le(e);if(s.push(t),!0===o(t))break;n=e}return s})(e,o),t),Qc=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ze(o)?[]:V(o.querySelectorAll(e),Le)})(t,e),ed=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(Pc(Le(t.startContainer),t.startOffset,Le(o.endContainer),o.endOffset))}return A.none()},td=e=>{if(null===e.anchorNode||null===e.focusNode)return ed(e);{const t=Le(e.anchorNode),o=Le(e.focusNode);return((e,t,o,n)=>{const s=((e,t,o,n)=>{const s=ot(e).dom.createRange();return s.setStart(e.dom,t),s.setEnd(o.dom,n),s})(e,t,o,n),r=et(e,o)&&t===n;return s.collapsed&&!r})(t,e.anchorOffset,o,e.focusOffset)?A.some(Pc(t,e.anchorOffset,o,e.focusOffset)):ed(e)}},od=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(Yc):A.none()})(Jc(e,t)),nd=(e=>{const t=t=>e(t)?A.from(t.dom.nodeValue):A.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(qe),sd=(e,t)=>({element:e,offset:t}),rd=(e,t)=>qe(e)?sd(e,t):((e,t)=>{const o=ct(e);if(0===o.length)return sd(e,t);if(t<o.length)return sd(o[t],0);{const e=o[o.length-1],t=qe(e)?(e=>nd.get(e))(e).length:ct(e).length;return sd(e,t)}})(e,t),ad=e=>void 0!==e.foffset,id=(e,t)=>t.getSelection.getOrThunk(()=>()=>(e=>(e=>A.from(e.getSelection()))(e).filter(e=>e.rangeCount>0).bind(td))(e))().map(e=>{if(ad(e)){const t=rd(e.start,e.soffset),o=rd(e.finish,e.foffset);return Gc.range(t.element,t.offset,o.element,o.offset)}return e});var ld=[gs("getSelection"),ss("root"),gs("bubble"),_c(),ws("overrides",{}),ws("showAbove",!1),Hi("placement",(e,t,o)=>{const n=rt(t.root).dom,s=zc(e,0,t),r=id(n,t).bind(e=>{if(ad(e)){const t=((e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?A.some(t).map(Yc):A.none()})(Jc(e,t)))(n,Gc.exactFromRange(e)).orThunk(()=>{const t=ze("\ufeff");zo(e.start,t);const o=od(n,Gc.exact(t,0,t,1));return Wo(t),o});return t.bind(e=>Lc(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 Lc(o.left,o.top,o.right-o.left,o.bottom-o.top)}}),a=id(n,t).bind(e=>ad(e)?$e(e.start)?A.some(e.start):it(e.start):A.some(e.firstCell)).getOr(e.element);return Vc(r,s,t,o,a)})];const cd="link-layout",dd=e=>e.x+e.width,ud=(e,t)=>e.x-t.width,md=(e,t)=>e.y-t.height+e.height,gd=e=>e.y,pd=(e,t,o)=>Wi(dd(e),gd(e),o.southeast(),Gi(),"southeast",tl(e,{left:0,top:2}),cd),hd=(e,t,o)=>Wi(ud(e,t),gd(e),o.southwest(),$i(),"southwest",tl(e,{right:1,top:2}),cd),fd=(e,t,o)=>Wi(dd(e),md(e,t),o.northeast(),qi(),"northeast",tl(e,{left:0,bottom:3}),cd),bd=(e,t,o)=>Wi(ud(e,t),md(e,t),o.northwest(),Yi(),"northwest",tl(e,{right:1,bottom:3}),cd),vd=()=>[pd,hd,fd,bd],yd=()=>[hd,pd,bd,fd];var xd=[ss("item"),_c(),ws("overrides",{}),Hi("placement",(e,t,o)=>{const n=ql(o,t.item.element),s=Tc(e.element,t,vd(),yd(),vd(),yd(),A.none());return A.some(xc({anchorBox:n,bubble:yc(),overrides:t.overrides,layouts:s}))})],wd=Qn("type",{selection:ld,node:Hc,hotspot:Ec,submenu:xd,makeshift:Ac});const Sd=[ms("classes",Pn),ks("mode","all",["all","layout","placement"])],Cd=[ws("useFixed",T),gs("getBounds")],Od=[rs("anchor",wd),xs("transition",Sd)],kd=(e,t,o,n,s,r)=>{const a=Jn("placement.info",In(Od),s),i=a.anchor,l=n.element,c=o.get(n.uid);Pl(()=>{It(l,"position","fixed");const s=Lt(l,"visibility");It(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return Jl(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Kt(e.element),o=e.element.dom.getBoundingClientRect();return Kl(t.left,t.top,o.width,o.height)})(e);i.placement(e,i,d).each(e=>{const s=r.orThunk(()=>t.getBounds.map(_)),i=((e,t,o,n,s,r)=>((e,t,o,n,s,r,a,i)=>{const l=hc(a,"maxHeightFunction",gc()),c=hc(a,"maxWidthFunction",b),d=e.anchorBox,u=e.origin,m={bounds:Yl(u,r),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:s,transition:i};return fc(d,t,o,m)})(((e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t))(t.anchorBox,e),n.element,t.bubble,t.layouts,s,o,t.overrides,r))(d,e,s,n,c,a.transition);o.set(n.uid,i)}),s.fold(()=>{Pt(l,"visibility")},e=>{It(l,"visibility",e)}),Lt(l,"left").isNone()&&Lt(l,"top").isNone()&&Lt(l,"right").isNone()&&Lt(l,"bottom").isNone()&&xe(Lt(l,"position"),"fixed")&&Pt(l,"position")},l)};var _d=Object.freeze({__proto__:null,position:(e,t,o,n,s)=>{const r=A.none();kd(e,t,o,n,s,r)},positionWithinBounds:kd,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const s=n.element;H(["position","left","right","top","bottom"],e=>Pt(s,e)),(e=>{Mt(e,Zl)})(s),o.clear(n.uid)}});const Td=Ml({fields:Cd,name:"positioning",active:Rl,apis:_d,state:Object.freeze({__proto__:null,init:()=>{let e={};return Ea({readState:()=>e,clear:t=>{g(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>be(e,t)})}})}),Ed=e=>e.getSystem().isConnected(),Ad=e=>{Rr(e,kr());const t=e.components();H(t,Ad)},Md=e=>{const t=e.components();H(t,Md),Rr(e,Or())},Dd=(e,t)=>{e.getSystem().addToWorld(t),wt(e.element)&&Md(t)},Bd=e=>{Ad(e),e.getSystem().removeFromWorld(e)},Id=(e,t)=>{Ho(e.element,t.element)},Fd=(e,t)=>{Rd(e,t,Ho)},Rd=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),wt(e.element)&&Md(t),e.syncComponents()},Nd=e=>{Ad(e),Wo(e.element),e.getSystem().removeFromWorld(e)},zd=e=>{const t=at(e.element).bind(t=>e.getSystem().getByDom(t).toOptional());Nd(e),t.each(e=>{e.syncComponents()})},Ld=e=>{const t=e.components();H(t,Nd),Uo(e.element),e.syncComponents()},Vd=(e,t)=>{Pd(e,t,Ho)},Hd=(e,t)=>{Pd(e,t,Lo)},Pd=(e,t,o)=>{o(e,t.element);const n=ct(t.element);H(n,e=>{t.getByDom(e).each(Md)})},Ud=e=>{const t=ct(e.element);H(t,t=>{e.getByDom(t).each(Ad)}),Wo(e.element)},Wd=(e,t,o,n)=>{o.get().each(t=>{Ld(e)});const s=t.getAttachPoint(e);Fd(s,e);const r=e.getSystem().build(n);return Fd(e,r),o.set(r),r},jd=(e,t,o,n)=>{const s=Wd(e,t,o,n);return t.onOpen(e,s),s},Gd=(e,t,o)=>{o.get().each(n=>{Ld(e),zd(e),t.onClose(e,n),o.clear()})},$d=(e,t,o)=>o.isOpen(),qd=(e,t,o)=>{const n=t.getAttachPoint(e);It(e.element,"position",Td.getMode(n)),((e,t,o)=>{Lt(e.element,t).fold(()=>{Mt(e.element,o)},t=>{kt(e.element,o,t)}),It(e.element,t,"hidden")})(e,"visibility",t.cloakVisibilityAttr)},Yd=(e,t,o)=>{(e=>N(["top","left","right","bottom"],t=>Lt(e,t).isSome()))(e.element)||Pt(e.element,"position"),((e,t,o)=>{Et(e.element,o).fold(()=>Pt(e.element,t),o=>It(e.element,t,o))})(e,"visibility",t.cloakVisibilityAttr)};var Xd=Object.freeze({__proto__:null,cloak:qd,decloak:Yd,open:jd,openWhileCloaked:(e,t,o,n,s)=>{qd(e,t),jd(e,t,o,n),s(),Yd(e,t)},close:Gd,isOpen:$d,isPartOf:(e,t,o,n)=>$d(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(()=>Wd(e,t,o,n))}),Kd=Object.freeze({__proto__:null,events:(e,t)=>Pr([jr(br(),(o,n)=>{Gd(o,e,t)})])}),Jd=[Ni("onOpen"),Ni("onClose"),ss("isPartOf"),ss("getAttachPoint"),ws("cloakVisibilityAttr","data-precloak-visibility")],Zd=Object.freeze({__proto__:null,init:()=>{const e=sc(),t=x("not-implemented");return Ea({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const Qd=Ml({fields:Jd,name:"sandboxing",active:Kd,apis:Xd,state:Zd}),eu=x("dismiss.popups"),tu=x("reposition.popups"),ou=x("mouse.released"),nu=Bn([ws("isExtraPart",T),xs("fireEventInstead",[ws("event",_r())])]),su=e=>{const t=Jn("Dismissal",nu,e);return{[eu()]:{schema:Bn([ss("target")]),onReceive:(e,o)=>{Qd.isOpen(e)&&(Qd.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold(()=>Qd.close(e),t=>Rr(e,t.event)))}}}},ru=Bn([xs("fireEventInstead",[ws("event",Tr())]),cs("doReposition")]),au=e=>{const t=Jn("Reposition",ru,e);return{[tu()]:{onReceive:e=>{Qd.isOpen(e)&&t.fireEventInstead.fold(()=>t.doReposition(e),t=>Rr(e,t.event))}}}},iu=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},lu=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var cu=Object.freeze({__proto__:null,onLoad:iu,onUnload:lu,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}),du=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[Zr((o,n)=>{iu(o,e,t)}),Qr((o,n)=>{lu(o,e,t)})]:[kl(e,t,iu)];return Pr(o)}});const uu=()=>{const e=Ms(null);return Ea({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},mu=()=>{const e=Ms({}),t=Ms({});return Ea({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(),s=t.get(),r={},a={};H(o,e=>{r[e.value]=e,be(e,"meta").each(t=>{be(t,"text").each(t=>{a[t]=e})})}),e.set({...n,...r}),t.set({...s,...a})},clear:()=>{e.set({}),t.set({})}})};var gu=Object.freeze({__proto__:null,memory:uu,dataset:mu,manual:()=>Ea({readState:b}),init:e=>e.store.manager.state(e)});const pu=(e,t,o,n)=>{const s=t.store;o.update([n]),s.setValue(e,n),t.onSetValue(e,n)};var hu=[gs("initialValue"),ss("getFallbackEntry"),ss("getDataKey"),ss("setValue"),Hi("manager",{setValue:pu,getValue:(e,t,o)=>{const n=t.store,s=n.getDataKey(e);return o.lookup(s).getOrThunk(()=>n.getFallbackEntry(s))},onLoad:(e,t,o)=>{t.store.initialValue.each(n=>{pu(e,t,o,n)})},onUnload:(e,t,o)=>{o.clear()},state:mu})],fu=[ss("getValue"),ws("setValue",b),gs("initialValue"),Hi("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:Ta.init})],bu=[gs("initialValue"),Hi("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:uu})],vu=[Ss("store",{mode:"memory"},Qn("mode",{memory:bu,manual:fu,dataset:hu})),Ni("onSetValue"),ws("resetOnDom",!1)];const yu=Ml({fields:vu,name:"representing",active:du,apis:cu,extra:{setValueFrom:(e,t)=>{const o=yu.getValue(t);yu.setValue(e,o)}},state:gu}),xu=(e,t)=>As(e,{},V(t,t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,ts(o,o,{tag:"option",process:{}},_n(e=>gn("The field: "+o+" is forbidden. "+n)));var o,n}).concat([os("dump",w)])),wu=e=>e.dump,Su=(e,t)=>({...El(t),...e.dump}),Cu=xu,Ou=Su,ku="placeholder",_u=Ds([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Tu=e=>ve(e,"uiType"),Eu=(e,t,o,n)=>((e,t,o,n)=>Tu(o)&&o.uiType===ku?((e,t,o,n)=>e.exists(e=>e!==o.owner)?_u.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):_u.single(!1,x(o)))(e,0,o,n).fold((s,r)=>{const a=Tu(o)?r(t,o.config,o.validated):r(t),i=be(a,"components").getOr([]),l=Y(i,o=>Eu(e,t,o,n));return[{...a,components:l}]},(e,n)=>{if(Tu(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(w)(e)}return n(t)}),Au=_u.single,Mu=_u.multiple,Du=x(ku),Bu=Ds([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Iu=ws("factory",{sketch:w}),Fu=ws("schema",[]),Ru=ss("name"),Nu=ts("pname","pname",xn(e=>"<alloy."+da(e.name)+">"),Ln()),zu=os("schema",()=>[gs("preprocess")]),Lu=ws("defaults",x({})),Vu=ws("overrides",x({})),Hu=In([Iu,Fu,Ru,Nu,Lu,Vu]),Pu=In([Iu,Fu,Ru,Lu,Vu]),Uu=In([Iu,Fu,Ru,Nu,Lu,Vu]),Wu=In([Iu,zu,Ru,ss("unit"),Nu,Lu,Vu]),ju=e=>e.fold(A.some,A.none,A.some,A.some),Gu=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},$u=(e,t)=>o=>{const n=Jn("Converting part type",t,o);return e(n)},qu=$u(Bu.required,Hu),Yu=$u(Bu.external,Pu),Xu=$u(Bu.optional,Uu),Ku=$u(Bu.group,Wu),Ju=x("entirety");var Zu=Object.freeze({__proto__:null,required:qu,external:Yu,optional:Xu,group:Ku,asNamedPart:ju,name:Gu,asCommon:e=>e.fold(w,w,w,w),original:Ju});const Qu=(e,t,o,n)=>vn(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),em=(e,t)=>{const o={};return H(t,t=>{ju(t).each(t=>{const n=tm(e,t.pname);o[t.name]=o=>{const s=Jn("Part: "+t.name+" in "+e,In(t.schema),o);return{...n,config:o,validated:s}}})}),o},tm=(e,t)=>({uiType:Du(),owner:e,name:t}),om=(e,t,o)=>({uiType:Du(),owner:e,name:t,config:o,validated:{}}),nm=e=>Y(e,e=>e.fold(A.none,A.some,A.none,A.none).map(e=>ds(e.name,e.schema.concat([Pi(Ju())]))).toArray()),sm=e=>V(e,Gu),rm=(e,t,o)=>((e,t,o)=>{const n={},s={};return H(o,e=>{e.fold(e=>{n[e.pname]=Au(!0,(t,o,n)=>e.factory.sketch(Qu(t,e,o,n)))},e=>{const o=t.parts[e.name];s[e.name]=x(e.factory.sketch(Qu(t,e,o[Ju()]),o))},e=>{n[e.pname]=Au(!1,(t,o,n)=>e.factory.sketch(Qu(t,e,o,n)))},e=>{n[e.pname]=Mu(!0,(t,o,n)=>{const s=t[e.name];return V(s,o=>e.factory.sketch(vn(e.defaults(t,o,n),o,e.overrides(t,o))))})})}),{internals:x(n),externals:x(s)}})(0,t,o),am=(e,t,o)=>((e,t,o,n)=>{const s=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)),r=((e,t,o,n)=>Y(o,o=>Eu(e,t,o,n)))(e,t,o,s);return le(s,o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))}),r})(A.some(e),t,t.components,o),im=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},lm=(e,t,o)=>im(e,t,o).getOrDie("Could not find part: "+o),cm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return H(o,e=>{n[e]=x(r.getByUid(s[e]))}),n},dm=(e,t)=>{const o=e.getSystem();return ce(t.partUids,(e,t)=>x(o.getByUid(e)))},um=e=>ae(e.partUids),mm=(e,t,o)=>{const n={},s=t.partUids,r=e.getSystem();return H(o,e=>{n[e]=x(r.getByUid(s[e]).getOrDie())}),n},gm=(e,t)=>{const o=sm(t);return Is(V(o,t=>({key:t,value:e+"-"+t})))},pm=e=>ts("partUids","partUids",Sn(t=>gm(t.uid,e)),Ln());var hm=Object.freeze({__proto__:null,generate:em,generateOne:om,schemas:nm,names:sm,substitutes:rm,components:am,defaultUids:gm,defaultUidsSchema:pm,getAllParts:dm,getAllPartNames:um,getPart:im,getPartOrDie:lm,getParts:cm,getPartsOrDie:mm});const fm=(e,t,o,n,s)=>{const r=((e,t)=>(e.length>0?[ds("parts",e)]:[]).concat([ss("uid"),ws("dom",{}),ws("components",[]),Pi("originalSpec"),ws("debug.sketcher",{})]).concat(t))(n,s);return Jn(e+" [SpecSchema]",Bn(r.concat(t)),o)},bm=(e,t,o,n,s)=>{const r=vm(s),a=nm(o),i=pm(o),l=fm(e,t,r,a,[i]),c=rm(0,l,o);return n(l,am(e,l,c.internals()),r,c.externals())},vm=e=>(e=>ve(e,"uid"))(e)?e:{...e,uid:ba("uid")},ym=Bn([ss("name"),ss("factory"),ss("configFields"),ws("apis",{}),ws("extraApis",{})]),xm=Bn([ss("name"),ss("factory"),ss("configFields"),ss("partFields"),ws("apis",{}),ws("extraApis",{})]),wm=e=>{const t=Jn("Sketcher for "+e.name,ym,e),o=ce(t.apis,_a),n=ce(t.extraApis,(e,t)=>Sa(e,t));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const s=vm(n);return o(fm(e,t,s,[],[]),s)})(t.name,t.configFields,t.factory,e),...o,...n}},Sm=e=>{const t=Jn("Sketcher for "+e.name,xm,e),o=em(t.name,t.partFields),n=ce(t.apis,_a),s=ce(t.extraApis,(e,t)=>Sa(e,t));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>bm(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...s}},Cm=e=>Ke("input")(e)&&"radio"!==Tt(e,"type")||Ke("textarea")(e);var Om=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const km=[ss("find")],_m=Ml({fields:km,name:"composing",apis:Om}),Tm=["input","button","textarea","select"],Em=(e,t,o)=>{(t.disabled()?Fm:Rm)(e,t)},Am=(e,t)=>!0===t.useNative&&R(Tm,We(e.element)),Mm=e=>{kt(e.element,"disabled","disabled")},Dm=e=>{Mt(e.element,"disabled")},Bm=e=>{kt(e.element,"aria-disabled","true")},Im=e=>{kt(e.element,"aria-disabled","false")},Fm=(e,t,o)=>{t.disableClass.each(t=>{ja(e.element,t)}),(Am(e,t)?Mm:Bm)(e),t.onDisabled(e)},Rm=(e,t,o)=>{t.disableClass.each(t=>{$a(e.element,t)}),(Am(e,t)?Dm:Im)(e),t.onEnabled(e)},Nm=(e,t)=>Am(e,t)?(e=>At(e.element,"disabled"))(e):(e=>"true"===Tt(e.element,"aria-disabled"))(e);var zm=Object.freeze({__proto__:null,enable:Rm,disable:Fm,isDisabled:Nm,onLoad:Em,set:(e,t,o,n)=>{(n?Fm:Rm)(e,t)}}),Lm=Object.freeze({__proto__:null,exhibit:(e,t)=>Ma({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>Pr([Ur(gr(),(t,o)=>Nm(t,e)),kl(e,t,Em)])}),Vm=[Ts("disabled",T),ws("useNative",!0),gs("disableClass"),Ni("onDisabled"),Ni("onEnabled")];const Hm=Ml({fields:Vm,name:"disabling",active:Lm,apis:zm}),Pm=(e,t,o,n)=>{const s=Qc(e.element,"."+t.highlightClass);H(s,o=>{N(n,e=>et(e.element,o))||($a(o,t.highlightClass),e.getSystem().getByDom(o).each(o=>{t.onDehighlight(e,o),Rr(o,Fr())}))})},Um=(e,t,o,n)=>{Pm(e,t,0,[n]),Wm(e,t,o,n)||(ja(n.element,t.highlightClass),t.onHighlight(e,n),Rr(n,Ir()))},Wm=(e,t,o,n)=>qa(n.element,t.highlightClass),jm=(e,t,o)=>yi(e.element,"."+t.itemClass).bind(t=>e.getSystem().getByDom(t).toOptional()),Gm=(e,t,o)=>{const n=Qc(e.element,"."+t.itemClass);return(n.length>0?A.some(n[n.length-1]):A.none()).bind(t=>e.getSystem().getByDom(t).toOptional())},$m=(e,t,o,n)=>{const s=Qc(e.element,"."+t.itemClass);return $(s,e=>qa(e,t.highlightClass)).bind(t=>{const o=Qi(t,n,0,s.length-1);return e.getSystem().getByDom(s[o]).toOptional()})},qm=(e,t,o)=>{const n=Qc(e.element,"."+t.itemClass);return we(V(n,t=>e.getSystem().getByDom(t).toOptional()))};var Ym=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>Pm(e,t,0,[]),dehighlight:(e,t,o,n)=>{Wm(e,t,o,n)&&($a(n.element,t.highlightClass),t.onDehighlight(e,n),Rr(n,Fr()))},highlight:Um,highlightFirst:(e,t,o)=>{jm(e,t).each(n=>{Um(e,t,o,n)})},highlightLast:(e,t,o)=>{Gm(e,t).each(n=>{Um(e,t,o,n)})},highlightAt:(e,t,o,n)=>{((e,t,o,n)=>{const s=Qc(e.element,"."+t.itemClass);return A.from(s[n]).fold(()=>an.error(new Error("No element found with index "+n)),e.getSystem().getByDom)})(e,t,0,n).fold(e=>{throw e},n=>{Um(e,t,o,n)})},highlightBy:(e,t,o,n)=>{const s=qm(e,t);G(s,n).each(n=>{Um(e,t,o,n)})},isHighlighted:Wm,getHighlighted:(e,t,o)=>yi(e.element,"."+t.highlightClass).bind(t=>e.getSystem().getByDom(t).toOptional()),getFirst:jm,getLast:Gm,getPrevious:(e,t,o)=>$m(e,t,0,-1),getNext:(e,t,o)=>$m(e,t,0,1),getCandidates:qm}),Xm=[ss("highlightClass"),ss("itemClass"),Ni("onHighlight"),Ni("onDehighlight")];const Km=Ml({fields:Xm,name:"highlighting",apis:Ym}),Jm=[8],Zm=[9],Qm=[13],eg=[27],tg=[32],og=[37],ng=[38],sg=[39],rg=[40],ag=(e,t,o)=>{const n=K(e.slice(0,t)),s=K(e.slice(t+1));return G(n.concat(s),o)},ig=(e,t,o)=>{const n=K(e.slice(0,t));return G(n,o)},lg=(e,t,o)=>{const n=e.slice(0,t),s=e.slice(t+1);return G(s.concat(n),o)},cg=(e,t,o)=>{const n=e.slice(t+1);return G(n,o)},dg=e=>t=>{const o=t.raw;return R(e,o.which)},ug=e=>t=>X(e,e=>e(t)),mg=e=>!0===e.raw.shiftKey,gg=e=>!0===e.raw.ctrlKey,pg=O(mg),hg=(e,t)=>({matches:e,classification:t}),fg=(e,t,o)=>{t.exists(e=>o.exists(t=>et(t,e)))||Nr(e,Er(),{prevFocus:t,newFocus:o})},bg=()=>{const e=e=>Hl(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const s=e(t);fg(t,n,s)}}},vg=()=>{const e=e=>Km.getHighlighted(e).map(e=>e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(b,e=>{Km.highlight(t,e)});const s=e(t);fg(t,n,s)}}};var yg;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(yg||(yg={}));const xg=(e,t,o,n,s)=>{const r=(e,t,o,n,s)=>{return(r=o(e,t,n,s),a=t.event,G(r,e=>e.matches(a)).map(e=>e.classification)).bind(o=>o(e,t,n,s));var r,a},a={schema:()=>e.concat([ws("focusManager",bg()),Ss("focusInside","onFocus",qn(e=>R(["onFocus","onEnterOrSpace","onApi"],e)?an.value(e):an.error("Invalid value for focusInside"))),Hi("handler",a),Hi("state",t),Hi("sendFocusIn",s)]),processKey:r,toEvents:(e,t)=>{const a=e.focusInside!==yg.OnFocusMode?A.none():s(e).map(o=>jr(cr(),(n,s)=>{o(n,e,t),s.stop()})),i=[jr(Zs(),(n,a)=>{r(n,a,o,e,t).fold(()=>{((o,n)=>{const r=dg(tg.concat(Qm))(n.event);e.focusInside===yg.OnEnterOrSpaceMode&&r&&zs(o,n)&&s(e).each(s=>{s(o,e,t),n.stop()})})(n,a)},e=>{a.stop()})}),jr(Qs(),(o,s)=>{r(o,s,n,e,t).each(e=>{s.stop()})})];return Pr(a.toArray().concat(i))}};return a},wg=e=>{const t=[gs("onEscape"),gs("onEnter"),ws("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),ws("firstTabstop",0),ws("useTabstopAt",E),gs("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind(e=>xi(t,e)).getOr(t);return Gt(o)>0},n=(e,t)=>t.focusManager.get(e).bind(e=>xi(e,t.selector)),s=(e,t,n)=>{((e,t)=>{const n=Qc(e.element,t.selector),s=U(n,e=>o(t,e));return A.from(s[t.firstTabstop])})(e,t).each(o=>{t.focusManager.set(e,o)})},r=(e,t,s,r)=>{const a=Qc(e.element,s.selector);return n(e,s).bind(t=>$(a,C(et,t)).bind(t=>((e,t,n,s,r)=>r(t,n,e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(s,e)).fold(()=>s.cyclic?A.some(!0):A.none(),t=>(s.focusManager.set(e,t),A.some(!0))))(e,a,t,s,r)))},a=(e,t,o)=>{const n=o.cyclic?ag:ig;return r(e,0,o,n)},i=(e,t,o)=>{const n=o.cyclic?lg:cg;return r(e,0,o,n)},l=x([hg(ug([mg,dg(Zm)]),a),hg(dg(Zm),i),hg(ug([pg,dg(Qm)]),(e,t,o)=>o.onEnter.bind(o=>o(e,t)))]),c=x([hg(dg(eg),(e,t,o)=>o.onEscape.bind(o=>o(e,t))),hg(dg(Zm),(e,t,o)=>n(e,o).filter(e=>!o.useTabstopAt(e)).bind(n=>((e=>(e=>at(e))(e).bind(ut).exists(t=>et(t,e)))(n)?a:i)(e,t,o)))]);return xg(t,Ta.init,l,c,()=>A.some(s))};var Sg=wg(os("cyclic",T)),Cg=wg(os("cyclic",E));const Og=(e,t,o)=>Cm(o)&&dg(tg)(t.event)?A.none():((e,t,o)=>(Lr(e,o,gr()),A.some(!0)))(e,0,o),kg=(e,t)=>A.some(!0),_g=[ws("execute",Og),ws("useSpace",!1),ws("useEnter",!0),ws("useControlEnter",!1),ws("useDown",!1)],Tg=(e,t,o)=>o.execute(e,t,e.element);var Eg=xg(_g,Ta.init,(e,t,o,n)=>{const s=o.useSpace&&!Cm(e.element)?tg:[],r=o.useEnter?Qm:[],a=o.useDown?rg:[],i=s.concat(r).concat(a);return[hg(dg(i),Tg)].concat(o.useControlEnter?[hg(ug([gg,dg(Qm)]),Tg)]:[])},(e,t,o,n)=>o.useSpace&&!Cm(e.element)?[hg(dg(tg),kg)]:[],()=>A.none());const Ag=()=>{const e=sc();return Ea({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 Mg=Object.freeze({__proto__:null,flatgrid:Ag,init:e=>e.state(e)});const Dg=e=>(t,o,n,s)=>{const r=e(t.element);return Rg(r,t,o,n,s)},Bg=(e,t)=>{const o=wc(e,t);return Dg(o)},Ig=(e,t)=>{const o=wc(t,e);return Dg(o)},Fg=e=>(t,o,n,s)=>Rg(e,t,o,n,s),Rg=(e,t,o,n,s)=>n.focusManager.get(t).bind(o=>e(t.element,o,n,s)).map(e=>(n.focusManager.set(t,e),!0)),Ng=Fg,zg=Fg,Lg=Fg,Vg=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),Hg=(e,t,o)=>{const n=Qc(e,o);return(e=>$(e,e=>et(e,t)).map(t=>({index:t,candidates:e})))(U(n,Vg))},Pg=(e,t)=>$(e,e=>et(t,e)),Ug=(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?A.some(e[n]):A.none()}),Wg=(e,t,o,n,s)=>Ug(e,t,n,(t,r)=>{const a=t===o-1?e.length-t*n:n,i=Qi(r,s,0,a-1);return A.some({row:t,column:i})}),jg=(e,t,o,n,s)=>Ug(e,t,n,(t,r)=>{const a=Qi(t,s,0,o-1),i=a===o-1?e.length-a*n:n,l=el(r,0,i-1);return A.some({row:a,column:l})}),Gg=[ss("selector"),ws("execute",Og),zi("onEscape"),ws("captureTab",!1),Ui()],$g=(e,t,o)=>{yi(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},qg=e=>(t,o,n,s)=>Hg(t,o,n.selector).bind(t=>e(t.candidates,t.index,s.getNumRows().getOr(n.initSize.numRows),s.getNumColumns().getOr(n.initSize.numColumns))),Yg=(e,t,o)=>o.captureTab?A.some(!0):A.none(),Xg=qg((e,t,o,n)=>Wg(e,t,o,n,-1)),Kg=qg((e,t,o,n)=>Wg(e,t,o,n,1)),Jg=qg((e,t,o,n)=>jg(e,t,o,n,-1)),Zg=qg((e,t,o,n)=>jg(e,t,o,n,1)),Qg=x([hg(dg(og),Bg(Xg,Kg)),hg(dg(sg),Ig(Xg,Kg)),hg(dg(ng),Ng(Jg)),hg(dg(rg),zg(Zg)),hg(ug([mg,dg(Zm)]),Yg),hg(ug([pg,dg(Zm)]),Yg),hg(dg(tg.concat(Qm)),(e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind(e=>xi(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)))]),ep=x([hg(dg(eg),(e,t,o)=>o.onEscape(e,t)),hg(dg(tg),kg)]);var tp=xg(Gg,Ag,Qg,ep,()=>A.some($g));const op=(e,t,o,n,s)=>{const r=(e,t,o)=>s(e,t,n,0,o.length-1,o[t],t=>{return n=o[t],"button"===We(n)&&"disabled"===Tt(n,"disabled")?r(e,t,o):A.from(o[t]);var n});return Hg(e,o,t).bind(e=>{const t=e.index,o=e.candidates;return r(t,t,o)})},np=(e,t,o,n)=>op(e,t,o,n,(e,t,o,n,s,r,a)=>{const i=el(t+o,n,s);return i===e?A.from(r):a(i)}),sp=(e,t,o,n)=>op(e,t,o,n,(e,t,o,n,s,r,a)=>{const i=Qi(t,o,n,s);return i===e?A.none():a(i)}),rp=[ss("selector"),ws("getInitial",A.none),ws("execute",Og),zi("onEscape"),ws("executeOnMove",!1),ws("allowVertical",!0),ws("allowHorizontal",!0),ws("cycles",!0)],ap=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind(e=>xi(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)),ip=(e,t,o)=>{t.getInitial(e).orThunk(()=>yi(e.element,t.selector)).each(o=>{t.focusManager.set(e,o)})},lp=(e,t,o)=>(o.cycles?sp:np)(e,o.selector,t,-1),cp=(e,t,o)=>(o.cycles?sp:np)(e,o.selector,t,1),dp=e=>(t,o,n,s)=>e(t,o,n,s).bind(()=>n.executeOnMove?ap(t,o,n):A.some(!0)),up=x([hg(dg(tg),kg),hg(dg(eg),(e,t,o)=>o.onEscape(e,t))]);var mp=xg(rp,Ta.init,(e,t,o,n)=>{const s=[...o.allowHorizontal?og:[]].concat(o.allowVertical?ng:[]),r=[...o.allowHorizontal?sg:[]].concat(o.allowVertical?rg:[]);return[hg(dg(s),dp(Bg(lp,cp))),hg(dg(r),dp(Ig(lp,cp))),hg(dg(Qm),ap),hg(dg(tg),ap)]},up,()=>A.some(ip));const gp=(e,t,o)=>A.from(e[t]).bind(e=>A.from(e[o]).map(e=>({rowIndex:t,columnIndex:o,cell:e}))),pp=(e,t,o,n)=>{const s=e[t].length,r=Qi(o,n,0,s-1);return gp(e,t,r)},hp=(e,t,o,n)=>{const s=Qi(o,n,0,e.length-1),r=e[s].length,a=el(t,0,r-1);return gp(e,s,a)},fp=(e,t,o,n)=>{const s=e[t].length,r=el(o+n,0,s-1);return gp(e,t,r)},bp=(e,t,o,n)=>{const s=el(o+n,0,e.length-1),r=e[s].length,a=el(t,0,r-1);return gp(e,s,a)},vp=[ds("selectors",[ss("row"),ss("cell")]),ws("cycles",!0),ws("previousSelector",A.none),ws("execute",Og)],yp=(e,t,o)=>{t.previousSelector(e).orThunk(()=>{const o=t.selectors;return yi(e.element,o.cell)}).each(o=>{t.focusManager.set(e,o)})},xp=(e,t)=>(o,n,s)=>{const r=s.cycles?e:t;return xi(n,s.selectors.row).bind(e=>{const t=Qc(e,s.selectors.cell);return Pg(t,n).bind(t=>{const n=Qc(o,s.selectors.row);return Pg(n,e).bind(e=>{const o=((e,t)=>V(e,e=>Qc(e,t.selectors.cell)))(n,s);return r(o,e,t).map(e=>e.cell)})})})},wp=xp((e,t,o)=>pp(e,t,o,-1),(e,t,o)=>fp(e,t,o,-1)),Sp=xp((e,t,o)=>pp(e,t,o,1),(e,t,o)=>fp(e,t,o,1)),Cp=xp((e,t,o)=>hp(e,o,t,-1),(e,t,o)=>bp(e,o,t,-1)),Op=xp((e,t,o)=>hp(e,o,t,1),(e,t,o)=>bp(e,o,t,1)),kp=x([hg(dg(og),Bg(wp,Sp)),hg(dg(sg),Ig(wp,Sp)),hg(dg(ng),Ng(Cp)),hg(dg(rg),zg(Op)),hg(dg(tg.concat(Qm)),(e,t,o)=>Hl(e.element).bind(n=>o.execute(e,t,n)))]),_p=x([hg(dg(tg),kg)]);var Tp=xg(vp,Ta.init,kp,_p,()=>A.some(yp));const Ep=[ss("selector"),ws("execute",Og),ws("moveOnTab",!1)],Ap=(e,t,o)=>o.focusManager.get(e).bind(n=>o.execute(e,t,n)),Mp=(e,t,o)=>{yi(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},Dp=(e,t,o)=>sp(e,o.selector,t,-1),Bp=(e,t,o)=>sp(e,o.selector,t,1),Ip=x([hg(dg(ng),Lg(Dp)),hg(dg(rg),Lg(Bp)),hg(ug([mg,dg(Zm)]),(e,t,o,n)=>o.moveOnTab?Lg(Dp)(e,t,o,n):A.none()),hg(ug([pg,dg(Zm)]),(e,t,o,n)=>o.moveOnTab?Lg(Bp)(e,t,o,n):A.none()),hg(dg(Qm),Ap),hg(dg(tg),Ap)]),Fp=x([hg(dg(tg),kg)]);var Rp=xg(Ep,Ta.init,Ip,Fp,()=>A.some(Mp));const Np=[zi("onSpace"),zi("onEnter"),zi("onShiftEnter"),zi("onLeft"),zi("onRight"),zi("onTab"),zi("onShiftTab"),zi("onUp"),zi("onDown"),zi("onEscape"),ws("stopSpaceKeyup",!1),gs("focusIn")];var zp=xg(Np,Ta.init,(e,t,o)=>[hg(dg(tg),o.onSpace),hg(ug([pg,dg(Qm)]),o.onEnter),hg(ug([mg,dg(Qm)]),o.onShiftEnter),hg(ug([mg,dg(Zm)]),o.onShiftTab),hg(ug([pg,dg(Zm)]),o.onTab),hg(dg(ng),o.onUp),hg(dg(rg),o.onDown),hg(dg(og),o.onLeft),hg(dg(sg),o.onRight),hg(dg(tg),o.onSpace)],(e,t,o)=>[...o.stopSpaceKeyup?[hg(dg(tg),kg)]:[],hg(dg(eg),o.onEscape)],e=>e.focusIn);const Lp=Sg.schema(),Vp=Cg.schema(),Hp=mp.schema(),Pp=tp.schema(),Up=Tp.schema(),Wp=Eg.schema(),jp=Rp.schema(),Gp=zp.schema(),$p=Bl({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:Lp,cyclic:Vp,flow:Hp,flatgrid:Pp,matrix:Up,execution:Wp,menu:jp,special:Gp}),name:"keying",active:{events:(e,t)=>e.handler.toEvents(e,t)},apis:{focusIn:(e,t,o)=>{t.sendFocusIn(t).fold(()=>{e.getSystem().triggerFocus(e.element,e.element)},n=>{n(e,t,o)})},setGridSize:(e,t,o,n,s)=>{(e=>ye(e,"setGridSize"))(o)?o.setGridSize(n,s):console.error("Layout does not support setGridSize")}},state:Mg}),qp=(e,t)=>{Pl(()=>{((e,t,o)=>{const n=e.components();(e=>{H(e.components(),e=>Wo(e.element)),Uo(e.element),e.syncComponents()})(e);const s=o(t),r=J(n,s);H(r,t=>{Ad(t),e.getSystem().removeFromWorld(t)}),H(s,t=>{Ed(t)?Id(e,t):(e.getSystem().addToWorld(t),Id(e,t),wt(e.element)&&Md(t))}),e.syncComponents()})(e,t,()=>V(t,e.getSystem().build))},e.element)},Yp=(e,t)=>{Pl(()=>{((o,n)=>{const s=o.components(),r=Y(n,e=>ka(e).toArray());H(s,e=>{R(r,e)||Bd(e)});const a=((e,t,o)=>ei(e,t,(t,n)=>ti(e,n,t,o)))(e.element,t,e.getSystem().buildOrPatch),i=J(s,a);H(i,e=>{Ed(e)&&Bd(e)}),H(a,e=>{Ed(e)||Dd(o,e)}),o.syncComponents()})(e,t)},e.element)},Xp=(e,t,o,n)=>{Bd(t);const s=ti(e.element,o,n,e.getSystem().buildOrPatch);Dd(e,s),e.syncComponents()},Kp=(e,t,o)=>{const n=e.getSystem().build(o);Rd(e,n,t)},Jp=(e,t,o,n)=>{zd(t),Kp(e,(e,t)=>((e,t,o)=>{dt(e,o).fold(()=>{Ho(e,t)},e=>{zo(e,t)})})(e,t,o),n)},Zp=(e,t)=>e.components(),Qp=(e,t,o,n,s)=>{const r=Zp(e);return A.from(r[n]).map(o=>(s.fold(()=>zd(o),s=>{(t.reuseDom?Xp:Jp)(e,o,n,s)}),o))};var eh=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Kp(e,Ho,n)},prepend:(e,t,o,n)=>{Kp(e,Vo,n)},remove:(e,t,o,n)=>{const s=Zp(e),r=G(s,e=>et(n.element,e.element));r.each(zd)},replaceAt:Qp,replaceBy:(e,t,o,n,s)=>{const r=Zp(e);return $(r,n).bind(o=>Qp(e,t,0,o,s))},set:(e,t,o,n)=>(t.reuseDom?Yp:qp)(e,n),contents:Zp});const th=Ml({fields:[_s("reuseDom",!0)],name:"replacing",apis:eh}),oh=(e,t)=>{const o=((e,t)=>{const o=Pr(t);return Ml({fields:[ss("enabled")],name:e,active:{events:x(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:x({}),initialConfig:{},state:Ta}}},nh=(e,t)=>{t.ignore||(Nl(e.element),t.onFocus(e))};var sh=Object.freeze({__proto__:null,focus:nh,blur:(e,t)=>{t.ignore||zl(e.element)},isFocused:e=>Ll(e.element)}),rh=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return Ma(o)},events:e=>Pr([jr(cr(),(t,o)=>{nh(t,e),o.stop()})].concat(e.stopMousedown?[jr(Gs(),(e,t)=>{t.event.prevent()})]:[]))}),ah=[Ni("onFocus"),ws("stopMousedown",!1),ws("ignore",!1)];const ih=Ml({fields:ah,name:"focusing",active:rh,apis:sh}),lh=(e,t,o,n)=>{const s=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each(t=>{o.get()?ja(e.element,t):$a(e.element,t)})})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),s!==n&&t.onToggled(e,n)},ch=(e,t,o)=>{lh(e,t,o,!o.get())},dh=(e,t,o)=>{lh(e,t,o,t.selected)};var uh=Object.freeze({__proto__:null,onLoad:dh,toggle:ch,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{lh(e,t,o,!0)},off:(e,t,o)=>{lh(e,t,o,!1)},set:lh}),mh=Object.freeze({__proto__:null,exhibit:()=>Ma({}),events:(e,t)=>{const o=(n=e,s=t,r=ch,ta(e=>{r(e,n,s)}));var n,s,r;const a=kl(e,t,dh);return Pr(q([e.toggleOnExecute?[o]:[],[a]]))}});const gh=(e,t,o)=>{kt(e.element,"aria-expanded",o)};var ph=[ws("selected",!1),gs("toggleClass"),ws("toggleOnExecute",!0),Ni("onToggled"),Ss("aria",{mode:"none"},Qn("mode",{pressed:[ws("syncWithExpanded",!1),Hi("update",(e,t,o)=>{kt(e.element,"aria-pressed",o),t.syncWithExpanded&&gh(e,0,o)})],checked:[Hi("update",(e,t,o)=>{kt(e.element,"aria-checked",o)})],expanded:[Hi("update",gh)],selected:[Hi("update",(e,t,o)=>{kt(e.element,"aria-selected",o)})],none:[Hi("update",b)]}))];const hh=Ml({fields:ph,name:"toggling",active:mh,apis:uh,state:(fh=!1,{init:()=>{const e=Ms(fh);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(fh),readState:()=>e.get()}}})});var fh;const bh=()=>{const e=(e,t)=>{t.stop(),zr(e)};return[jr(or(),e),jr(hr(),e),Xr(Ps()),Xr(Gs())]},vh=e=>Pr(q([e.map(e=>ta((t,o)=>{e(t),o.stop()})).toArray(),bh()])),yh="alloy.item-hover",xh="alloy.item-focus",wh="alloy.item-toggled",Sh=e=>{(Hl(e.element).isNone()||ih.isFocused(e))&&(ih.isFocused(e)||ih.focus(e),Nr(e,yh,{item:e}))},Ch=e=>{Nr(e,xh,{item:e})},Oh=x(yh),kh=x(xh),_h=x(wh),Th=e=>e.toggling.map(e=>e.exclusive?"menuitemradio":"menuitemcheckbox").getOr("menuitem"),Eh=[ss("data"),ss("components"),ss("dom"),ws("hasSubmenu",!1),gs("toggling"),Cu("itemBehaviours",[hh,ih,$p,yu]),ws("ignoreFocus",!1),ws("domModification",{}),Hi("builder",e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:Th(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:Ou(e.itemBehaviours,[e.toggling.fold(hh.revoke,e=>hh.config((e=>({aria:{mode:"checked"},...ge(e,(e,t)=>"exclusive"!==t),onToggled:(t,o)=>{p(e.onToggled)&&e.onToggled(t,o),((e,t)=>{Nr(e,wh,{item:e,state:t})})(t,o)}}))(e))),ih.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{Ch(e)}}),$p.config({mode:"execution"}),yu.config({store:{mode:"memory",initialValue:e.data}}),oh("item-type-events",[...bh(),jr(Xs(),Sh),jr(pr(),ih.focus)])]),components:e.components,eventOrder:e.eventOrder})),ws("eventOrder",{})],Ah=[ss("dom"),ss("components"),Hi("builder",e=>({dom:e.dom,components:e.components,events:Pr([Kr(pr())])}))],Mh=x("item-widget"),Dh=x([qu({name:"widget",overrides:e=>({behaviours:El([yu.config({store:{mode:"manual",getValue:t=>e.data,setValue:b}})])})})]),Bh=[ss("uid"),ss("data"),ss("components"),ss("dom"),ws("autofocus",!1),ws("ignoreFocus",!1),Cu("widgetBehaviours",[yu,ih,$p]),ws("domModification",{}),pm(Dh()),Hi("builder",e=>{const t=rm(Mh(),e,Dh()),o=am(Mh(),e,t.internals()),n=t=>im(t,e,"widget").map(e=>($p.focusIn(e),e)),s=(t,o)=>Cm(o.event.target)?A.none():e.autofocus?(o.setSource(t.element),A.none()):A.none();return{dom:e.dom,components:o,domModification:e.domModification,events:Pr([ta((e,t)=>{n(e).each(e=>{t.stop()})}),jr(Xs(),Sh),jr(pr(),(t,o)=>{e.autofocus?n(t):ih.focus(t)})]),behaviours:Ou(e.widgetBehaviours,[yu.config({store:{mode:"memory",initialValue:e.data}}),ih.config({ignore:e.ignoreFocus,onFocus:e=>{Ch(e)}}),$p.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:Il(),onLeft:s,onRight:s,onEscape:(t,o)=>ih.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),A.none()):A.none():(ih.focus(t),A.some(!0))})])}})],Ih=Qn("type",{widget:Bh,item:Eh,separator:Ah}),Fh=x([Ku({factory:{sketch:e=>{const t=Jn("menu.spec item",Ih,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>ve(t,"uid")?t:{...t,uid:ba("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),Rh=x([ss("value"),ss("items"),ss("dom"),ss("components"),ws("eventOrder",{}),xu("menuBehaviours",[Km,yu,_m,$p]),Ss("movement",{mode:"menu",moveOnTab:!0},Qn("mode",{grid:[Ui(),Hi("config",(e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager}))],matrix:[Hi("config",(e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager})),ss("rowSelector"),ws("previousSelector",A.none)],menu:[ws("moveOnTab",!0),Hi("config",(e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager}))]})),rs("markers",Di()),ws("fakeFocus",!1),ws("focusManager",bg()),Ni("onHighlight"),Ni("onDehighlight")]),Nh=x("alloy.menu-focus"),zh=Sm({name:"Menu",configFields:Rh(),partFields:Fh(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Su(e.menuBehaviours,[Km.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),yu.config({store:{mode:"memory",initialValue:e.value}}),_m.config({find:A.some}),$p.config(e.movement.config(e,e.movement))]),events:Pr([jr(kh(),(e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each(o=>{Km.highlight(e,o),t.stop(),Nr(e,Nh(),{menu:e,item:o})})}),jr(Oh(),(e,t)=>{const o=t.event.item;Km.highlight(e,o)}),jr(_h(),(e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===Tt(o.element,"role")&&((e,t)=>{const o=Qc(e.element,'[role="menuitemradio"][aria-checked="true"]');H(o,o=>{et(o,t.element)||e.getSystem().getByDom(o).each(e=>{hh.off(e)})})})(e,o)})]),components:t,eventOrder:e.eventOrder,domModification:{attributes:{role:"menu"}}})}),Lh=(e,t,o,n)=>be(o,n).bind(n=>be(e,n).bind(n=>{const s=Lh(e,t,o,n);return A.some([n].concat(s))})).getOr([]),Vh=e=>"prepared"===e.type?A.some(e.menu):A.none(),Hh=()=>{const e=Ms({}),t=Ms({}),o=Ms({}),n=sc(),s=Ms({}),r=e=>a(e).bind(Vh),a=e=>be(t.get(),e),i=t=>be(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(r,a,i,l)=>{n.set(r),e.set(i),t.set(a),s.set(l);const c=((e,t)=>{const o={};le(e,(e,t)=>{H(e,e=>{o[e]=t})});const n=t,s=de(t,(e,t)=>({k:e,v:t})),r=ce(s,(e,t)=>[t].concat(Lh(o,n,s,t)));return ce(o,e=>be(r,e).getOr([e]))})(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?A.some(e.slice(1)):A.none()),lookupMenu:a,lookupItem:i,otherMenus:e=>{const t=s.get();return J(ae(t),e)},getPrimary:()=>n.get().bind(r),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(t,s)=>{const a=U(i(t).toArray(),e=>r(e).isSome());return be(o.get(),t).bind(t=>{const o=K(a.concat(t));return(e=>{const t=[];for(let o=0;o<e.length;o++){const n=e[o];if(!n.isSome())return A.none();t.push(n.getOrDie())}return A.some(t)})(Y(o,(t,a)=>((t,o,n)=>r(t).bind(s=>(t=>he(e.get(),(e,o)=>e===t))(t).bind(e=>o(e).map(e=>({triggeredMenu:s,triggeringItem:e,triggeringPath:n})))))(t,s,o.slice(0,a+1)).fold(()=>xe(n.get(),t)?[]:[A.none()],e=>[A.some(e)])))})}}},Ph=Vh,Uh=da("tiered-menu-item-highlight"),Wh=da("tiered-menu-item-dehighlight");var jh;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(jh||(jh={}));const Gh=x("collapse-item"),$h=wm({name:"TieredMenu",configFields:[Vi("onExecute"),Vi("onEscape"),Li("onOpenMenu"),Li("onOpenSubmenu"),Ni("onRepositionMenu"),Ni("onCollapseMenu"),ws("highlightOnOpen",jh.HighlightMenuAndItem),ds("data",[ss("primary"),ss("menus"),ss("expansions")]),ws("fakeFocus",!1),Ni("onHighlightItem"),Ni("onDehighlightItem"),Ni("onHover"),Ii(),ss("dom"),ws("navigateOnHover",!0),ws("stayInDom",!1),xu("tmenuBehaviours",[$p,Km,_m,th]),ws("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=sc(),n=Hh(),s=e=>yu.getValue(e).value,r=t=>ce(e.data.menus,(e,t)=>Y(e.items,e=>"separator"===e.type?[]:[e.data.value])),a=Km.highlight,i=(t,o)=>{a(t,o),Km.getHighlighted(o).orThunk(()=>Km.getFirst(o)).each(n=>{e.fakeFocus?Km.highlight(o,n):Lr(t,n.element,pr())})},l=(e,t)=>we(V(t,t=>e.lookupMenu(t).bind(e=>"prepared"===e.type?A.some(e.menu):A.none()))),c=(t,o,n)=>{const s=l(o,o.otherMenus(n));H(s,o=>{Xa(o.element,[e.markers.backgroundMenu]),e.stayInDom||th.remove(t,o)})},d=(t,n)=>{const r=(t=>o.get().getOrThunk(()=>{const n={},r=Qc(t.element,`.${e.markers.item}`),a=U(r,e=>"true"===Tt(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)})},u=(t,o,n)=>A.from(n[0]).bind(s=>o.lookupMenu(s).bind(s=>{if("notbuilt"===s.type)return A.none();{const r=s.menu,a=l(o,n.slice(1));return H(a,t=>{ja(t.element,e.markers.backgroundMenu)}),wt(r.element)||th.append(t,ui(r)),Xa(r.element,[e.markers.backgroundMenu]),i(t,r),c(t,o,n),A.some(r)}}));let m;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(m||(m={}));const g=(t,o,r=m.HighlightSubmenu)=>{if(o.hasConfigured(Hm)&&Hm.isDisabled(o))return A.some(o);{const a=s(o);return n.expand(a).bind(s=>(d(t,s),A.from(s[0]).bind(a=>n.lookupMenu(a).bind(i=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const s=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,s),s}return o.menu})(t,a,i);return wt(l.element)||th.append(t,ui(l)),e.onOpenSubmenu(t,o,l,K(s)),r===m.HighlightSubmenu?(Km.highlightFirst(l),u(t,n,s)):(Km.dehighlightAll(l),A.some(o))}))))}},p=(t,o)=>{const r=s(o);return n.collapse(r).bind(s=>(d(t,s),u(t,n,s).map(n=>(e.onCollapseMenu(t,o,n),n))))},h=t=>(o,n)=>xi(n.getSource(),`.${e.markers.item}`).bind(e=>o.getSystem().getByDom(e).toOptional().bind(e=>t(o,e).map(E))),f=Pr([jr(Nh(),(e,t)=>{const o=t.event.item;n.lookupItem(s(o)).each(()=>{const o=t.event.menu;Km.highlight(e,o);const r=s(t.event.item);n.refresh(r).each(t=>c(e,n,t))})}),ta((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each(o=>{0===s(o).indexOf("collapse-item")&&p(t,o),g(t,o,m.HighlightSubmenu).fold(()=>{e.onExecute(t,o)},b)})}),Zr((t,o)=>{(t=>{const o=((t,o,n)=>ce(n,(n,s)=>{const r=()=>zh.sketch({...n,value:s,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{Nr(e,Uh,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{Nr(e,Wh,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?vg():bg()});return s===o?{type:"prepared",menu:t.getSystem().build(r())}:{type:"notbuilt",nbMenu:r}}))(t,e.data.primary,e.data.menus),s=r();return n.setContents(e.data.primary,o,e.data.expansions,s),n.getPrimary()})(t).each(o=>{th.append(t,ui(o)),e.onOpenMenu(t,o),e.highlightOnOpen===jh.HighlightMenuAndItem?i(t,o):e.highlightOnOpen===jh.HighlightJustMenu&&a(t,o)})}),jr(Uh,(t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)}),jr(Wh,(t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)}),...e.navigateOnHover?[jr(Oh(),(t,o)=>{const r=o.event.item;((e,t)=>{const o=s(t);n.refresh(o).bind(t=>(d(e,t),u(e,n,t)))})(t,r),g(t,r,m.HighlightParent),e.onHover(t,r)})]:[]]),v=e=>Km.getHighlighted(e).bind(Km.getHighlighted),y={collapseMenu:e=>{v(e).each(t=>{p(e,t)})},highlightPrimary:e=>{n.getPrimary().each(t=>{i(e,t)})},repositionMenus:t=>{const o=n.getPrimary().bind(e=>v(t).bind(e=>{const t=s(e),o=fe(n.getMenus()),r=we(V(o,Ph));return n.getTriggeringPath(t,e=>((e,t,o)=>re(t,e=>{if(!e.getSystem().isConnected())return A.none();const t=Km.getCandidates(e);return G(t,e=>s(e)===o)}))(0,r,e))}).map(t=>({primary:e,triggeringPath:t})));o.fold(()=>{(e=>A.from(e.components()[0]).filter(e=>"menu"===Tt(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:Su(e.tmenuBehaviours,[$p.config({mode:"special",onRight:h((e,t)=>Cm(t.element)?A.none():g(e,t,m.HighlightSubmenu)),onLeft:h((e,t)=>Cm(t.element)?A.none():p(e,t)),onEscape:h((t,o)=>p(t,o).orThunk(()=>e.onEscape(t,o).map(()=>t))),focusIn:(e,t)=>{n.getPrimary().each(t=>{Lr(e,t.element,pr())})}}),Km.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),_m.config({find:e=>Km.getHighlighted(e)}),th.config({})]),eventOrder:e.eventOrder,apis:y,events:f}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:Bs(e,t),expansions:{}}),collapseItem:e=>({value:da(Gh()),meta:{text:e}})}}),qh=wm({name:"InlineView",configFields:[ss("lazySink"),Ni("onShow"),Ni("onHide"),vs("onEscape"),xu("inlineBehaviours",[Qd,yu,Fl]),xs("fireDismissalEventInstead",[ws("event",_r())]),xs("fireRepositionEventInstead",[ws("event",Tr())]),ws("getRelated",A.none),ws("isExtraPart",T),ws("eventOrder",A.none)],factory:(e,t)=>{const o=(t,o,n,s)=>{const r=e.lazySink(t).getOrDie();Qd.openWhileCloaked(t,o,()=>Td.positionWithinBounds(r,t,n,s())),yu.setValue(t,A.some({mode:"position",config:n,getBounds:s}))},n=(t,o,n,s)=>{const r=((e,t,o,n,s)=>{const r=()=>e.lazySink(t),a="horizontal"===n.type?{layouts:{onLtr:()=>wl(),onRtl:()=>Sl()}}:{},i=e=>(e=>2===e.length)(e)?a:{};return $h.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(Qd.close(t),e.onEscape.map(e=>e(t)),A.some(!0)),onExecute:()=>A.some(!0),onOpenMenu:(e,t)=>{Td.positionWithinBounds(r().getOrDie(),t,o,s())},onOpenSubmenu:(e,t,o,n)=>{const s=r().getOrDie();Td.position(s,o,{anchor:{type:"submenu",item:t,...i(n)}})},onRepositionMenu:(e,t,n)=>{const a=r().getOrDie();Td.positionWithinBounds(a,t,o,s()),H(n,e=>{const t=i(e.triggeringPath);Td.position(a,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})})}})})(e,t,o,n,s);Qd.open(t,r),yu.setValue(t,A.some({mode:"menu",menu:r}))},s=t=>{Qd.isOpen(t)&&yu.getValue(t).each(o=>{switch(o.mode){case"menu":Qd.getState(t).each($h.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();Td.positionWithinBounds(n,t,o.config,o.getBounds())}})},r={setContent:(e,t)=>{Qd.setContent(e,t)},showAt:(e,t,n)=>{const s=A.none;o(e,t,n,s)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,A.none)},showMenuWithinBounds:n,hide:e=>{Qd.isOpen(e)&&(yu.setValue(e,A.none()),Qd.close(e))},getContent:e=>Qd.getState(e),reposition:s,isOpen:Qd.isOpen};return{uid:e.uid,dom:e.dom,behaviours:Su(e.inlineBehaviours,[Qd.config({isPartOf:(t,o,n)=>Ci(o,n)||((t,o)=>e.getRelated(t).exists(e=>Ci(e,o)))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),yu.config({store:{mode:"memory",initialValue:A.none()}}),Fl.config({channels:{...su({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...au({...e.fireRepositionEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({}),doReposition:s})}})]),eventOrder:e.eventOrder,apis:r}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,s)=>{e.showWithinBounds(t,o,n,s)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,s)=>{e.showMenuWithinBounds(t,o,n,s)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}});var Yh=tinymce.util.Tools.resolve("tinymce.util.Delay");const Xh=wm({name:"Button",factory:e=>{const t=vh(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:Ou(e.buttonBehaviours,[ih.config({}),$p.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:"button"===o?{type:n("type").getOr("button"),...n("role").map(e=>({role:e})).getOr({})}:{role:e.role.getOr(n("role").getOr("button"))}},eventOrder:e.eventOrder}},configFields:[ws("uid",void 0),ss("dom"),ws("components",[]),Cu("buttonBehaviours",[ih,$p]),gs("action"),gs("role"),ws("eventOrder",{})]}),Kh=e=>{const t=Re(e),o=ct(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),s=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),r=0===o.length?{}:{innerHtml:oa(t)};return{tag:We(t),classes:s,attributes:n,...r}},Jh=e=>{const t=(e=>void 0!==e.uid)(e)&&ye(e,"uid")?e.uid:ba("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}};
|
|
5
|
+
/*! @license DOMPurify 3.4.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.5/LICENSE */
|
|
6
|
+
function Zh(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n}function Qh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,s,r,a,i=[],l=!0,c=!1;try{if(r=(o=o.call(e)).next,0===t);else for(;!(l=(n=r.call(o)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=o.return&&(a=o.return(),Object(a)!==a))return}finally{if(c)throw s}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Zh(e,t);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Zh(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const ef=Object.entries,tf=Object.setPrototypeOf,of=Object.isFrozen,nf=Object.getPrototypeOf,sf=Object.getOwnPropertyDescriptor;let rf=Object.freeze,af=Object.seal,lf=Object.create,cf="undefined"!=typeof Reflect&&Reflect,df=cf.apply,uf=cf.construct;// eslint-disable-line import/no-mutable-exports
|
|
7
|
+
rf||(rf=function(e){return e}),af||(af=function(e){return e}),df||(df=function(e,t){for(var o=arguments.length,n=new Array(o>2?o-2:0),s=2;s<o;s++)n[s-2]=arguments[s];return e.apply(t,n)}),uf||(uf=function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];return new e(...o)});const mf=If(Array.prototype.forEach),gf=If(Array.prototype.lastIndexOf),pf=If(Array.prototype.pop),hf=If(Array.prototype.push),ff=If(Array.prototype.splice),bf=Array.isArray,vf=If(String.prototype.toLowerCase),yf=If(String.prototype.toString),xf=If(String.prototype.match),wf=If(String.prototype.replace),Sf=If(String.prototype.indexOf),Cf=If(String.prototype.trim),Of=If(Number.prototype.toString),kf=If(Boolean.prototype.toString),_f="undefined"==typeof BigInt?null:If(BigInt.prototype.toString),Tf="undefined"==typeof Symbol?null:If(Symbol.prototype.toString),Ef=If(Object.prototype.hasOwnProperty),Af=If(Object.prototype.toString),Mf=If(RegExp.prototype.test),Df=(Bf=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return uf(Bf,t)});
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
10
|
+
*
|
|
11
|
+
* @param func - The constructor function to be wrapped and called.
|
|
12
|
+
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
13
|
+
*/
|
|
14
|
+
var Bf;
|
|
15
|
+
/**
|
|
16
|
+
* Add properties to a lookup table
|
|
17
|
+
*
|
|
18
|
+
* @param set - The set to which elements will be added.
|
|
19
|
+
* @param array - The array containing elements to be added to the set.
|
|
20
|
+
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
21
|
+
* @returns The modified set with added elements.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
25
|
+
*
|
|
26
|
+
* @param func - The function to be wrapped and called.
|
|
27
|
+
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
|
28
|
+
*/
|
|
29
|
+
function If(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,n=new Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=arguments[s];return df(e,t,n)}}function Ff(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:vf;if(tf&&
|
|
30
|
+
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
31
|
+
// independent of any properties defined on Object.prototype.
|
|
32
|
+
// Prevent prototype setters from intercepting set as a this value.
|
|
33
|
+
tf(e,null),!bf(t))return e;let n=t.length;for(;n--;){let s=t[n];if("string"==typeof s){const e=o(s);e!==s&&(
|
|
34
|
+
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
35
|
+
of(t)||(t[n]=e),s=e)}e[s]=!0}return e}
|
|
36
|
+
/**
|
|
37
|
+
* Clean up an array to harden against CSPP
|
|
38
|
+
*
|
|
39
|
+
* @param array - The array to be cleaned.
|
|
40
|
+
* @returns The cleaned version of the array
|
|
41
|
+
*/function Rf(e){for(let t=0;t<e.length;t++)Ef(e,t)||(e[t]=null);return e}
|
|
42
|
+
/**
|
|
43
|
+
* Shallow clone an object
|
|
44
|
+
*
|
|
45
|
+
* @param object - The object to be cloned.
|
|
46
|
+
* @returns A new object that copies the original.
|
|
47
|
+
*/function Nf(e){const t=lf(null);for(const n of ef(e)){var o=Qh(n,2);const s=o[0],r=o[1];Ef(e,s)&&(bf(r)?t[s]=Rf(r):r&&"object"==typeof r&&r.constructor===Object?t[s]=Nf(r):t[s]=r)}return t}
|
|
48
|
+
/**
|
|
49
|
+
* Convert non-node values into strings without depending on direct property access.
|
|
50
|
+
*
|
|
51
|
+
* @param value - The value to stringify.
|
|
52
|
+
* @returns A string representation of the provided value.
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
56
|
+
*
|
|
57
|
+
* @param object - The object to look up the getter function in its prototype chain.
|
|
58
|
+
* @param prop - The property name for which to find the getter function.
|
|
59
|
+
* @returns The getter function found in the prototype chain or a fallback function.
|
|
60
|
+
*/
|
|
61
|
+
function zf(e,t){for(;null!==e;){const o=sf(e,t);if(o){if(o.get)return If(o.get);if("function"==typeof o.value)return If(o.value)}e=nf(e)}return function(){return null}}const Lf=rf(["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","search","section","select","shadow","slot","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"]),Vf=rf(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hf=rf(["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"]),Pf=rf(["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"]),Uf=rf(["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"]),Wf=rf(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),jf=rf(["#text"]),Gf=rf(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),$f=rf(["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","mask-type","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"]),qf=rf(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Yf=rf(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Xf=af(/{{[\w\W]*|^[\w\W]*}}/g),Kf=af(/<%[\w\W]*|^[\w\W]*%>/g),Jf=af(/\${[\w\W]*/g),Zf=af(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qf=af(/^aria-[\-\w]+$/),eb=af(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tb=af(/^(?:\w+script|data):/i),ob=af(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nb=af(/^html$/i),sb=af(/^[a-z][.\w]*(-[.\w]+)+$/i),rb=function(){return"undefined"==typeof window?null:window};var ab=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rb();const o=t=>e(t);if(o.version="3.4.5",o.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)
|
|
62
|
+
// Not running in a browser, provide a factory function
|
|
63
|
+
// so that you can pass your own Window
|
|
64
|
+
return o.isSupported=!1,o;let n=t.document;const s=n,r=s.currentScript,a=t.DocumentFragment,i=t.HTMLTemplateElement,l=t.Node,c=t.Element,d=t.NodeFilter,u=t.NamedNodeMap,m=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,g=t.HTMLFormElement,p=t.DOMParser,h=t.trustedTypes,f=c.prototype,b=zf(f,"cloneNode"),v=zf(f,"remove"),y=zf(f,"nextSibling"),x=zf(f,"childNodes"),w=zf(f,"parentNode"),S=l&&l.prototype?zf(l.prototype,"nodeType"):null;
|
|
65
|
+
// As per issue #47, the web-components registry is inherited by a
|
|
66
|
+
// new document created via createHTMLDocument. As per the spec
|
|
67
|
+
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
68
|
+
// a new empty registry is used when creating a template contents owner
|
|
69
|
+
// document, so we use that as our parent document to ensure nothing
|
|
70
|
+
// is inherited.
|
|
71
|
+
if("function"==typeof i){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let C,O="";const k=n,_=k.implementation,T=k.createNodeIterator,E=k.createDocumentFragment,A=k.getElementsByTagName,M=s.importNode;let D={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};
|
|
72
|
+
/**
|
|
73
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
74
|
+
*/o.isSupported="function"==typeof ef&&"function"==typeof w&&_&&void 0!==_.createHTMLDocument;const B=Xf,I=Kf,F=Jf,R=Zf,N=Qf,z=tb,L=ob,V=sb;let H=eb,P=null;
|
|
75
|
+
/**
|
|
76
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
77
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
78
|
+
*/
|
|
79
|
+
/* allowed element names */const U=Ff({},[...Lf,...Vf,...Hf,...Uf,...jf]);
|
|
80
|
+
/* Allowed attribute names */let W=null;const j=Ff({},[...Gf,...$f,...qf,...Yf]);
|
|
81
|
+
/*
|
|
82
|
+
* Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
|
|
83
|
+
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
84
|
+
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
85
|
+
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
86
|
+
*/let G=Object.seal(lf(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}})),$=null,q=null;
|
|
87
|
+
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
88
|
+
/* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
|
|
89
|
+
const Y=Object.seal(lf(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));
|
|
90
|
+
/* Decide if ARIA attributes are okay */let X=!0,K=!0,J=!1,Z=!0,Q=!1,ee=!0,te=!1,oe=!1,ne=!1,se=!1,re=!1,ae=!1,ie=!0,le=!1;
|
|
91
|
+
/* Decide if custom data attributes are okay */const ce="user-content-";
|
|
92
|
+
/* Keep element content when removing element? */let de=!0,ue=!1,me={},ge=null;
|
|
93
|
+
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
94
|
+
* of importing it into a new Document and returning a sanitized copy */const pe=Ff({},["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"]);
|
|
95
|
+
/* Tags that are safe for data: URIs */let he=null;const fe=Ff({},["audio","video","img","source","image","track"]);
|
|
96
|
+
/* Attributes safe for values like "javascript:" */let be=null;const ve=Ff({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ye="http://www.w3.org/1998/Math/MathML",xe="http://www.w3.org/2000/svg",we="http://www.w3.org/1999/xhtml";
|
|
97
|
+
/* Document namespace */
|
|
98
|
+
let Se=we,Ce=!1,Oe=null;const ke=Ff({},[ye,xe,we],yf);let _e=Ff({},["mi","mo","mn","ms","mtext"]),Te=Ff({},["annotation-xml"]);
|
|
99
|
+
// Certain elements are allowed in both SVG and HTML
|
|
100
|
+
// namespace. We need to specify them explicitly
|
|
101
|
+
// so that they don't get erroneously deleted from
|
|
102
|
+
// HTML namespace.
|
|
103
|
+
const Ee=Ff({},["title","style","font","a","script"]);
|
|
104
|
+
/* Parsing of strict XHTML documents */let Ae=null;const Me=["application/xhtml+xml","text/html"];let De=null,Be=null;
|
|
105
|
+
/* Keep a reference to config to pass to hooks */
|
|
106
|
+
/* Ideally, do not touch anything below this line */
|
|
107
|
+
/* ______________________________________________ */
|
|
108
|
+
const Ie=n.createElement("form"),Fe=function(e){return e instanceof RegExp||e instanceof Function},Re=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Be&&Be===e)return;
|
|
109
|
+
/* Shield configuration object from tampering */e&&"object"==typeof e||(e={})
|
|
110
|
+
/* Shield configuration object from prototype pollution */,e=Nf(e),Ae=
|
|
111
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
112
|
+
-1===Me.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,
|
|
113
|
+
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
114
|
+
De="application/xhtml+xml"===Ae?yf:vf,
|
|
115
|
+
/* Set configuration parameters */
|
|
116
|
+
P=Ef(e,"ALLOWED_TAGS")&&bf(e.ALLOWED_TAGS)?Ff({},e.ALLOWED_TAGS,De):U,W=Ef(e,"ALLOWED_ATTR")&&bf(e.ALLOWED_ATTR)?Ff({},e.ALLOWED_ATTR,De):j,Oe=Ef(e,"ALLOWED_NAMESPACES")&&bf(e.ALLOWED_NAMESPACES)?Ff({},e.ALLOWED_NAMESPACES,yf):ke,be=Ef(e,"ADD_URI_SAFE_ATTR")&&bf(e.ADD_URI_SAFE_ATTR)?Ff(Nf(ve),e.ADD_URI_SAFE_ATTR,De):ve,he=Ef(e,"ADD_DATA_URI_TAGS")&&bf(e.ADD_DATA_URI_TAGS)?Ff(Nf(fe),e.ADD_DATA_URI_TAGS,De):fe,ge=Ef(e,"FORBID_CONTENTS")&&bf(e.FORBID_CONTENTS)?Ff({},e.FORBID_CONTENTS,De):pe,$=Ef(e,"FORBID_TAGS")&&bf(e.FORBID_TAGS)?Ff({},e.FORBID_TAGS,De):Nf({}),q=Ef(e,"FORBID_ATTR")&&bf(e.FORBID_ATTR)?Ff({},e.FORBID_ATTR,De):Nf({}),me=!!Ef(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?Nf(e.USE_PROFILES):e.USE_PROFILES),X=!1!==e.ALLOW_ARIA_ATTR,// Default true
|
|
117
|
+
K=!1!==e.ALLOW_DATA_ATTR,// Default true
|
|
118
|
+
J=e.ALLOW_UNKNOWN_PROTOCOLS||!1,// Default false
|
|
119
|
+
Z=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,// Default true
|
|
120
|
+
Q=e.SAFE_FOR_TEMPLATES||!1,// Default false
|
|
121
|
+
ee=!1!==e.SAFE_FOR_XML,// Default true
|
|
122
|
+
te=e.WHOLE_DOCUMENT||!1,// Default false
|
|
123
|
+
se=e.RETURN_DOM||!1,// Default false
|
|
124
|
+
re=e.RETURN_DOM_FRAGMENT||!1,// Default false
|
|
125
|
+
ae=e.RETURN_TRUSTED_TYPE||!1,// Default false
|
|
126
|
+
ne=e.FORCE_BODY||!1,// Default false
|
|
127
|
+
ie=!1!==e.SANITIZE_DOM,// Default true
|
|
128
|
+
le=e.SANITIZE_NAMED_PROPS||!1,// Default false
|
|
129
|
+
de=!1!==e.KEEP_CONTENT,// Default true
|
|
130
|
+
ue=e.IN_PLACE||!1,// Default false
|
|
131
|
+
H=function(e){try{return Mf(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:eb,// Default regexp
|
|
132
|
+
Se="string"==typeof e.NAMESPACE?e.NAMESPACE:we,// Default HTML namespace
|
|
133
|
+
_e=Ef(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?Nf(e.MATHML_TEXT_INTEGRATION_POINTS):Ff({},["mi","mo","mn","ms","mtext"]),// Default built-in map
|
|
134
|
+
Te=Ef(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?Nf(e.HTML_INTEGRATION_POINTS):Ff({},["annotation-xml"]);// Default built-in map
|
|
135
|
+
const t=Ef(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?Nf(e.CUSTOM_ELEMENT_HANDLING):lf(null);if(G=lf(null),Ef(t,"tagNameCheck")&&Fe(t.tagNameCheck)&&(G.tagNameCheck=t.tagNameCheck),Ef(t,"attributeNameCheck")&&Fe(t.attributeNameCheck)&&(G.attributeNameCheck=t.attributeNameCheck),Ef(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(G.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Q&&(K=!1),re&&(se=!0)
|
|
136
|
+
/* Parse profile info */,me&&(P=Ff({},jf),W=lf(null),!0===me.html&&(Ff(P,Lf),Ff(W,Gf)),!0===me.svg&&(Ff(P,Vf),Ff(W,$f),Ff(W,Yf)),!0===me.svgFilters&&(Ff(P,Hf),Ff(W,$f),Ff(W,Yf)),!0===me.mathMl&&(Ff(P,Uf),Ff(W,qf),Ff(W,Yf)))
|
|
137
|
+
/* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
|
|
138
|
+
* leaking across calls when switching from function to array config */,Y.tagCheck=null,Y.attributeCheck=null,
|
|
139
|
+
/* Merge configuration parameters */
|
|
140
|
+
Ef(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Y.tagCheck=e.ADD_TAGS:bf(e.ADD_TAGS)&&(P===U&&(P=Nf(P)),Ff(P,e.ADD_TAGS,De))),Ef(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Y.attributeCheck=e.ADD_ATTR:bf(e.ADD_ATTR)&&(W===j&&(W=Nf(W)),Ff(W,e.ADD_ATTR,De))),Ef(e,"ADD_URI_SAFE_ATTR")&&bf(e.ADD_URI_SAFE_ATTR)&&Ff(be,e.ADD_URI_SAFE_ATTR,De),Ef(e,"FORBID_CONTENTS")&&bf(e.FORBID_CONTENTS)&&(ge===pe&&(ge=Nf(ge)),Ff(ge,e.FORBID_CONTENTS,De)),Ef(e,"ADD_FORBID_CONTENTS")&&bf(e.ADD_FORBID_CONTENTS)&&(ge===pe&&(ge=Nf(ge)),Ff(ge,e.ADD_FORBID_CONTENTS,De))
|
|
141
|
+
/* Add #text in case KEEP_CONTENT is set to true */,de&&(P["#text"]=!0)
|
|
142
|
+
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */,te&&Ff(P,["html","head","body"])
|
|
143
|
+
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */,P.table&&(Ff(P,["tbody"]),delete $.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Df('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Df('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
144
|
+
// Overwrite existing TrustedTypes policy.
|
|
145
|
+
C=e.TRUSTED_TYPES_POLICY,
|
|
146
|
+
// Sign local variables required by `sanitize`.
|
|
147
|
+
O=C.createHTML("")}else
|
|
148
|
+
// Uninitialized policy, attempt to initialize the internal dompurify policy.
|
|
149
|
+
void 0===C&&(C=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;
|
|
150
|
+
// Allow the callers to control the unique policy name
|
|
151
|
+
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
152
|
+
// Policy creation with duplicate names throws in Trusted Types.
|
|
153
|
+
let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const s="dompurify"+(o?"#"+o:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){
|
|
154
|
+
// Policy creation failed (most likely another DOMPurify script has
|
|
155
|
+
// already run). Skip creating the policy, as this will only cause errors
|
|
156
|
+
// if TT are enforced.
|
|
157
|
+
return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(h,r)),
|
|
158
|
+
// If creating the internal policy succeeded sign internal variables.
|
|
159
|
+
null!==C&&"string"==typeof O&&(O=C.createHTML(""));
|
|
160
|
+
// Prevent further manipulation of configuration.
|
|
161
|
+
// Not available in IE8, Safari 5, etc.
|
|
162
|
+
rf&&rf(e),Be=e},Ne=Ff({},[...Vf,...Hf,...Pf]),ze=Ff({},[...Uf,...Wf]),Le=function(e){hf(o.removed,{element:e});try{
|
|
163
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
164
|
+
w(e).removeChild(e)}catch(t){v(e)}},Ve=function(e,t){try{hf(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){hf(o.removed,{attribute:null,from:t})}
|
|
165
|
+
// We void attribute values for unremovable "is" attributes
|
|
166
|
+
if(t.removeAttribute(e),"is"===e)if(se||re)try{Le(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},He=function(e){
|
|
167
|
+
/* Create a HTML document */
|
|
168
|
+
let t=null,o=null;if(ne)e="<remove></remove>"+e;else{
|
|
169
|
+
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
|
170
|
+
const t=xf(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===Ae&&Se===we&&(
|
|
171
|
+
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
172
|
+
e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const s=C?C.createHTML(e):e;
|
|
173
|
+
/*
|
|
174
|
+
* Use the DOMParser API by default, fallback later if needs be
|
|
175
|
+
* DOMParser not work for svg when has multiple root element.
|
|
176
|
+
*/if(Se===we)try{t=(new p).parseFromString(s,Ae)}catch(e){}
|
|
177
|
+
/* Use createHTMLDocument in case DOMParser is not available */if(!t||!t.documentElement){t=_.createDocument(Se,"template",null);try{t.documentElement.innerHTML=Ce?O:s}catch(e){
|
|
178
|
+
// Syntax error if dirtyPayload is invalid xml
|
|
179
|
+
}}const r=t.body||t.documentElement;
|
|
180
|
+
/* Work on whole document or just its body */
|
|
181
|
+
return e&&o&&r.insertBefore(n.createTextNode(o),r.childNodes[0]||null),Se===we?A.call(t,te?"html":"body")[0]:te?t.documentElement:r},Pe=function(e){return T.call(e.ownerDocument||e,e,
|
|
182
|
+
// eslint-disable-next-line no-bitwise
|
|
183
|
+
d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ue=function(e){e.normalize();const t=T.call(e.ownerDocument||e,e,
|
|
184
|
+
// eslint-disable-next-line no-bitwise
|
|
185
|
+
d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let o=t.nextNode();for(;o;){let e=o.data;mf([B,I,F],t=>{e=wf(e,t," ")}),o.data=e,o=t.nextNode()}},We=function(e){return e instanceof g&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof m)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},je=function(e){if(!S||"object"!=typeof e||null===e)return!1;try{return"number"==typeof S(e)}catch(e){return!1}};function Ge(e,t,n){mf(e,e=>{e.call(o,t,n,Be)})}
|
|
186
|
+
/**
|
|
187
|
+
* _sanitizeElements
|
|
188
|
+
*
|
|
189
|
+
* @protect nodeName
|
|
190
|
+
* @protect textContent
|
|
191
|
+
* @protect removeChild
|
|
192
|
+
* @param currentNode to check for permission to exist
|
|
193
|
+
* @return true if node was killed, false if left alive
|
|
194
|
+
*/const $e=function(e){let t=null;
|
|
195
|
+
/* Execute a hook if present */
|
|
196
|
+
/* Check if element is clobbered or can clobber */
|
|
197
|
+
if(Ge(D.beforeSanitizeElements,e,null),We(e))return Le(e),!0;
|
|
198
|
+
/* Now let's check the element's type and name */const n=De(e.nodeName);
|
|
199
|
+
/* Execute a hook if present */
|
|
200
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
201
|
+
if(Ge(D.uponSanitizeElement,e,{tagName:n,allowedTags:P}),ee&&e.hasChildNodes()&&!je(e.firstElementChild)&&Mf(/<[/\w!]/g,e.innerHTML)&&Mf(/<[/\w!]/g,e.textContent))return Le(e),!0;
|
|
202
|
+
/* Remove risky CSS construction leading to mXSS */if(ee&&e.namespaceURI===we&&"style"===n&&je(e.firstElementChild))return Le(e),!0;
|
|
203
|
+
/* Remove any occurrence of processing instructions */if(7===e.nodeType)return Le(e),!0;
|
|
204
|
+
/* Remove any kind of possibly harmful comments */if(ee&&8===e.nodeType&&Mf(/<[/\w]/g,e.data))return Le(e),!0;
|
|
205
|
+
/* Remove element if anything forbids its presence */if($[n]||!(Y.tagCheck instanceof Function&&Y.tagCheck(n))&&!P[n]){
|
|
206
|
+
/* Check if we have a custom element to handle */
|
|
207
|
+
if(!$[n]&&Xe(n)){if(G.tagNameCheck instanceof RegExp&&Mf(G.tagNameCheck,n))return!1;if(G.tagNameCheck instanceof Function&&G.tagNameCheck(n))return!1}
|
|
208
|
+
/* Keep content except for bad-listed elements */if(de&&!ge[n]){const t=w(e)||e.parentNode,o=x(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n){const s=b(o[n],!0);t.insertBefore(s,y(e))}}return Le(e),!0}
|
|
209
|
+
/* Check whether element has a valid namespace */return e instanceof c&&!function(e){let t=w(e);
|
|
210
|
+
// In JSDOM, if we're inside shadow DOM, then parentNode
|
|
211
|
+
// can be null. We just simulate parent in this case.
|
|
212
|
+
t&&t.tagName||(t={namespaceURI:Se,tagName:"template"});const o=vf(e.tagName),n=vf(t.tagName);return!!Oe[e.namespaceURI]&&(e.namespaceURI===xe?
|
|
213
|
+
// The only way to switch from HTML namespace to SVG
|
|
214
|
+
// is via <svg>. If it happens via any other tag, then
|
|
215
|
+
// it should be killed.
|
|
216
|
+
t.namespaceURI===we?"svg"===o:
|
|
217
|
+
// The only way to switch from MathML to SVG is via`
|
|
218
|
+
// svg if parent is either <annotation-xml> or MathML
|
|
219
|
+
// text integration points.
|
|
220
|
+
t.namespaceURI===ye?"svg"===o&&("annotation-xml"===n||_e[n]):Boolean(Ne[o]):e.namespaceURI===ye?
|
|
221
|
+
// The only way to switch from HTML namespace to MathML
|
|
222
|
+
// is via <math>. If it happens via any other tag, then
|
|
223
|
+
// it should be killed.
|
|
224
|
+
t.namespaceURI===we?"math"===o:
|
|
225
|
+
// The only way to switch from SVG to MathML is via
|
|
226
|
+
// <math> and HTML integration points
|
|
227
|
+
t.namespaceURI===xe?"math"===o&&Te[n]:Boolean(ze[o]):e.namespaceURI===we?
|
|
228
|
+
// The only way to switch from SVG to HTML is via
|
|
229
|
+
// HTML integration points, and from MathML to HTML
|
|
230
|
+
// is via MathML text integration points
|
|
231
|
+
!(t.namespaceURI===xe&&!Te[n])&&!(t.namespaceURI===ye&&!_e[n])&&!ze[o]&&(Ee[o]||!Ne[o]):!("application/xhtml+xml"!==Ae||!Oe[e.namespaceURI]))}(e)?(Le(e),!0):
|
|
232
|
+
/* Make sure that older browsers don't get fallback-tag mXSS */
|
|
233
|
+
"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!Mf(/<\/no(script|embed|frames)/i,e.innerHTML)?(
|
|
234
|
+
/* Sanitize element content to be template-safe */
|
|
235
|
+
Q&&3===e.nodeType&&(
|
|
236
|
+
/* Get the element's text content */
|
|
237
|
+
t=e.textContent,mf([B,I,F],e=>{t=wf(t,e," ")}),e.textContent!==t&&(hf(o.removed,{element:e.cloneNode()}),e.textContent=t))
|
|
238
|
+
/* Execute a hook if present */,Ge(D.afterSanitizeElements,e,null),!1):(Le(e),!0)},qe=function(e,t,o){
|
|
239
|
+
/* FORBID_ATTR must always win, even if ADD_ATTR predicate would allow it */
|
|
240
|
+
if(q[t])return!1;
|
|
241
|
+
/* Make sure attribute cannot clobber */if(ie&&("id"===t||"name"===t)&&(o in n||o in Ie))return!1;const s=W[t]||Y.attributeCheck instanceof Function&&Y.attributeCheck(t,e);
|
|
242
|
+
/* Allow valid data-* attributes: At least one character after "-"
|
|
243
|
+
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
244
|
+
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
245
|
+
We don't need to check the value; it's always URI safe. */if(K&&!q[t]&&Mf(R,t));else if(X&&Mf(N,t));else if(!s||q[t]){if(
|
|
246
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
247
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
248
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
249
|
+
!(Xe(e)&&(G.tagNameCheck instanceof RegExp&&Mf(G.tagNameCheck,e)||G.tagNameCheck instanceof Function&&G.tagNameCheck(e))&&(G.attributeNameCheck instanceof RegExp&&Mf(G.attributeNameCheck,t)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(t,e))||
|
|
250
|
+
// Alternative, second condition checks if it's an `is`-attribute, AND
|
|
251
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
252
|
+
"is"===t&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&Mf(G.tagNameCheck,o)||G.tagNameCheck instanceof Function&&G.tagNameCheck(o))))return!1;
|
|
253
|
+
/* Check value is safe. First, is attr inert? If so, is safe */}else if(be[t]);else if(Mf(H,wf(o,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Sf(o,"data:")||!he[e])if(J&&!Mf(z,wf(o,L,"")));else if(o)return!1;return!0},Ye=Ff({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Xe=function(e){return!Ye[vf(e)]&&Mf(V,e)},Ke=function(e){
|
|
254
|
+
/* Execute a hook if present */
|
|
255
|
+
Ge(D.beforeSanitizeAttributes,e,null);const t=e.attributes;
|
|
256
|
+
/* Check if we have attributes; if not we might have a text node */if(!t||We(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let s=t.length;
|
|
257
|
+
/* Go backwards over all attributes; safely remove bad ones */for(;s--;){const r=t[s],a=r.name,i=r.namespaceURI,l=r.value,c=De(a),d=l;let u="value"===a?d:Cf(d);
|
|
258
|
+
/* Execute a hook if present */
|
|
259
|
+
// Else: already prefixed, leave the attribute alone — the prefix is
|
|
260
|
+
// itself the clobbering protection, and re-applying it is incorrect.
|
|
261
|
+
/* Work around a security issue with comments inside attributes */
|
|
262
|
+
if(n.attrName=c,n.attrValue=u,n.keepAttr=!0,n.forceKeepAttr=void 0,// Allows developers to see this is a property they can set
|
|
263
|
+
Ge(D.uponSanitizeAttribute,e,n),u=n.attrValue,
|
|
264
|
+
/* Full DOM Clobbering protection via namespace isolation,
|
|
265
|
+
* Prefix id and name attributes with `user-content-`
|
|
266
|
+
*/
|
|
267
|
+
!le||"id"!==c&&"name"!==c||0===Sf(u,ce)||(
|
|
268
|
+
// Remove the attribute with this value
|
|
269
|
+
Ve(a,e),
|
|
270
|
+
// Prefix the value and later re-create the attribute with the sanitized value
|
|
271
|
+
u=ce+u),ee&&Mf(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){Ve(a,e);continue}
|
|
272
|
+
/* Make sure we cannot easily use animated hrefs, even if animations are allowed */if("attributename"===c&&xf(u,"href")){Ve(a,e);continue}
|
|
273
|
+
/* Did the hooks approve of the attribute? */if(n.forceKeepAttr)continue;
|
|
274
|
+
/* Did the hooks approve of the attribute? */if(!n.keepAttr){Ve(a,e);continue}
|
|
275
|
+
/* Work around a security issue in jQuery 3.0 */if(!Z&&Mf(/\/>/i,u)){Ve(a,e);continue}
|
|
276
|
+
/* Sanitize attribute content to be template-safe */Q&&mf([B,I,F],e=>{u=wf(u,e," ")})
|
|
277
|
+
/* Is `value` valid for this attribute? */;const m=De(e.nodeName);if(qe(m,c,u)){
|
|
278
|
+
/* Handle attributes that require Trusted Types */
|
|
279
|
+
if(C&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(i);else switch(h.getAttributeType(m,c)){case"TrustedHTML":u=C.createHTML(u);break;case"TrustedScriptURL":u=C.createScriptURL(u)}
|
|
280
|
+
/* Handle invalid data-* attribute set by try-catching it */if(u!==d)try{i?e.setAttributeNS(i,a,u):
|
|
281
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
282
|
+
e.setAttribute(a,u),We(e)?Le(e):pf(o.removed)}catch(t){Ve(a,e)}}else Ve(a,e)}
|
|
283
|
+
/* Execute a hook if present */Ge(D.afterSanitizeAttributes,e,null)},Je=function(e){let t=null;const o=Pe(e);
|
|
284
|
+
/* Execute a hook if present */for(Ge(D.beforeSanitizeShadowDOM,e,null);t=o.nextNode();)
|
|
285
|
+
/* Execute a hook if present */
|
|
286
|
+
Ge(D.uponSanitizeShadowNode,t,null),
|
|
287
|
+
/* Sanitize tags and elements */
|
|
288
|
+
$e(t),
|
|
289
|
+
/* Check attributes next */
|
|
290
|
+
Ke(t),
|
|
291
|
+
/* Deep shadow DOM detected */
|
|
292
|
+
t.content instanceof a&&Je(t.content);
|
|
293
|
+
/* Execute a hook if present */Ge(D.afterSanitizeShadowDOM,e,null)},Ze=function(e){if(1===e.nodeType&&e.shadowRoot instanceof a){const t=e.shadowRoot;
|
|
294
|
+
// Recurse first so that nested shadow roots are reached even if
|
|
295
|
+
// _sanitizeShadowDOM removes hosts at this level.
|
|
296
|
+
Ze(t),Je(t)}
|
|
297
|
+
// Snapshot children before recursing. Sanitization of one subtree
|
|
298
|
+
// (e.g. via an uponSanitizeShadowNode hook) may detach siblings,
|
|
299
|
+
// and naive nextSibling traversal would silently skip the rest of
|
|
300
|
+
// the list once a node is detached.
|
|
301
|
+
const t=e.childNodes;if(!t)return;const o=[];mf(t,e=>{hf(o,e)});for(const e of o)Ze(e)};
|
|
302
|
+
/**
|
|
303
|
+
* _isValidAttribute
|
|
304
|
+
*
|
|
305
|
+
* @param lcTag Lowercase tag name of containing element.
|
|
306
|
+
* @param lcName Lowercase attribute name.
|
|
307
|
+
* @param value Attribute value.
|
|
308
|
+
* @return Returns true if `value` is valid, otherwise false.
|
|
309
|
+
*/
|
|
310
|
+
// eslint-disable-next-line complexity
|
|
311
|
+
// eslint-disable-next-line complexity
|
|
312
|
+
return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,i=null,l=null;
|
|
313
|
+
/* Stringify, in case dirty is an object */
|
|
314
|
+
if(
|
|
315
|
+
/* Make sure we have a string to sanitize.
|
|
316
|
+
DO NOT return early, as this will return the wrong type if
|
|
317
|
+
the user has requested a DOM object rather than a string */
|
|
318
|
+
Ce=!e,Ce&&(e="\x3c!--\x3e"),"string"!=typeof e&&!je(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return Of(e);case"boolean":return kf(e);case"bigint":return _f?_f(e):"0";case"symbol":return Tf?Tf(e):"Symbol()";case"undefined":default:return Af(e);case"function":case"object":{if(null===e)return Af(e);const t=e,o=zf(t,"toString");if("function"==typeof o){const e=o(t);return"string"==typeof e?e:Af(e)}return Af(e)}}}(e)))throw Df("dirty is not a string, aborting");
|
|
319
|
+
/* Return dirty HTML if DOMPurify cannot run */if(!o.isSupported)return e;
|
|
320
|
+
/* Assign config vars */if(oe||Re(t)
|
|
321
|
+
/* Clean up removed elements */,o.removed=[],
|
|
322
|
+
/* Check if dirty is correctly typed for IN_PLACE */
|
|
323
|
+
"string"==typeof e&&(ue=!1),ue){
|
|
324
|
+
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
325
|
+
const t=e.nodeName;if("string"==typeof t){const e=De(t);if(!P[e]||$[e])throw Df("root node is forbidden and cannot be sanitized in-place")}
|
|
326
|
+
/* Sanitize attached shadow roots before the main iterator runs.
|
|
327
|
+
The iterator does not descend into shadow trees. */Ze(e)}else if(je(e))
|
|
328
|
+
/* If dirty is a DOM element, append to an empty document to avoid
|
|
329
|
+
elements being stripped by the parser */
|
|
330
|
+
n=He("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName
|
|
331
|
+
/* Clonable shadow roots are deep-cloned by importNode(); sanitize
|
|
332
|
+
them before the main iterator runs, since the iterator does not
|
|
333
|
+
descend into shadow trees. */?
|
|
334
|
+
/* Node is already a body, use as is */
|
|
335
|
+
n=r:
|
|
336
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
337
|
+
n.appendChild(r),Ze(r);else{
|
|
338
|
+
/* Exit directly if we have nothing to do */
|
|
339
|
+
if(!se&&!Q&&!te&&
|
|
340
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
341
|
+
-1===e.indexOf("<"))return C&&ae?C.createHTML(e):e;
|
|
342
|
+
/* Initialize the document to work on */
|
|
343
|
+
/* Check we have a DOM node from the data */
|
|
344
|
+
if(n=He(e),!n)return se?null:ae?O:""}
|
|
345
|
+
/* Remove first element node (ours) if FORCE_BODY is set */n&&ne&&Le(n.firstChild)
|
|
346
|
+
/* Get node iterator */;const c=Pe(ue?e:n);
|
|
347
|
+
/* Now start iterating over the created document */for(;i=c.nextNode();)
|
|
348
|
+
/* Sanitize tags and elements */
|
|
349
|
+
$e(i),
|
|
350
|
+
/* Check attributes next */
|
|
351
|
+
Ke(i),
|
|
352
|
+
/* Shadow DOM detected, sanitize it */
|
|
353
|
+
i.content instanceof a&&Je(i.content);
|
|
354
|
+
/* If we sanitized `dirty` in-place, return it. */if(ue)return Q&&Ue(e),e;
|
|
355
|
+
/* Return sanitized string or DOM */if(se){if(Q&&Ue(n),re)for(l=E.call(n.ownerDocument);n.firstChild;)
|
|
356
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
357
|
+
l.appendChild(n.firstChild);else l=n;return(W.shadowroot||W.shadowrootmode)&&(
|
|
358
|
+
/*
|
|
359
|
+
AdoptNode() is not used because internal state is not reset
|
|
360
|
+
(e.g. the past names map of a HTMLFormElement), this is safe
|
|
361
|
+
in theory but we would rather not risk another attack vector.
|
|
362
|
+
The state that is cloned by importNode() is explicitly defined
|
|
363
|
+
by the specs.
|
|
364
|
+
*/
|
|
365
|
+
l=M.call(s,l,!0)),l}let d=te?n.outerHTML:n.innerHTML;
|
|
366
|
+
/* Serialize doctype if allowed */return te&&P["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&Mf(nb,n.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+d)
|
|
367
|
+
/* Sanitize final string template-safe */,Q&&mf([B,I,F],e=>{d=wf(d,e," ")}),C&&ae?C.createHTML(d):d},o.setConfig=function(){Re(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),oe=!0},o.clearConfig=function(){Be=null,oe=!1},o.isValidAttribute=function(e,t,o){
|
|
368
|
+
/* Initialize shared config vars if necessary. */
|
|
369
|
+
Be||Re({});const n=De(e),s=De(t);return qe(n,s,o)},o.addHook=function(e,t){"function"==typeof t&&hf(D[e],t)},o.removeHook=function(e,t){if(void 0!==t){const o=gf(D[e],t);return-1===o?void 0:ff(D[e],o,1)[0]}return pf(D[e])},o.removeHooks=function(e){D[e]=[]},o.removeAllHooks=function(){D={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();const ib=e=>ab().sanitize(e);var lb=tinymce.util.Tools.resolve("tinymce.util.I18n");const cb={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},db="temporary-placeholder",ub=e=>()=>be(e,db).getOr("!not found!"),mb=(e,t)=>{const o=e.toLowerCase();if(lb.isRtl()){const e=((e,t)=>Ae(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return ve(t,e)?e:o}return o},gb=(e,t)=>be(t,mb(e,t)),pb=(e,t)=>{const o=t();return gb(e,o).getOrThunk(ub(o))},hb=()=>oh("add-focusable",[Zr(e=>{vi(e.element,"svg").each(e=>kt(e,"focusable","false"))})]),fb=(e,t,o,n)=>{var s,r;const a=(e=>!!lb.isRtl()&&ve(cb,e))(t)?["tox-icon--flip"]:[],i=be(o,mb(t,o)).or(n).getOrThunk(ub(o));return{dom:{tag:e.tag,attributes:null!==(s=e.attributes)&&void 0!==s?s:{},classes:e.classes.concat(a),innerHtml:i},behaviours:El([...null!==(r=e.behaviours)&&void 0!==r?r:[],hb()])}},bb=(e,t,o,n=A.none())=>fb(t,e,o(),n),vb={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},yb=wm({name:"Notification",factory:e=>{const t=Jh({dom:Kh(`<p>${ib(e.translationProvider(e.text))}</p>`),behaviours:El([th.config({})])}),o=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),n=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),s=Jh({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:El([th.config({})])}),r={updateProgress:(e,t)=>{e.getSystem().isConnected()&&s.getOpt(e).each(e=>{th.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);th.set(n,[ai(o)])}}},a=q([e.icon.toArray(),e.level.toArray(),e.level.bind(e=>A.from(vb[e])).toArray()]),i=Jh(Xh.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[bb("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(),s=G(e,e=>ve(n,mb(e,n)));return fb({tag:"div",classes:["tox-notification__icon"]},s.getOr(db),n,A.none())})(a,0,e.iconProvider),c=[l,{dom:{tag:"div",classes:["tox-notification__body"]},components:[t.asSpec()],behaviours:El([th.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:El([ih.config({}),oh("notification-events",[jr(Ks(),e=>{i.getOpt(e).each(ih.focus)})])]),components:c.concat(e.progress?[s.asSpec()]:[]).concat([i.asSpec()]),apis:r}},configFields:[gs("level"),ss("progress"),gs("icon"),ss("onAction"),ss("text"),ss("iconProvider"),ss("translationProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var xb,wb,Sb=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Cb=tinymce.util.Tools.resolve("tinymce.EditorManager"),Ob=tinymce.util.Tools.resolve("tinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(xb||(xb={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(wb||(wb={}));const kb=e=>t=>t.options.get(e),_b=e=>t=>A.from(e(t)),Tb=e=>{const t=Ob.deviceType.isPhone(),o=Ob.deviceType.isTablet()||t,n=e.options.register,s=e=>r(e)||!1===e,a=e=>r(e)||h(e);n("skin",{processor:e=>r(e)||!1===e,default:"oxide"}),n("skin_url",{processor:"string"}),n("height",{processor:a,default:Math.max(e.getElement().offsetHeight,400)}),n("width",{processor:a,default:Sb.DOM.getStyle(e.getElement(),"width")}),n("min_height",{processor:"number",default:100}),n("min_width",{processor:"number"}),n("max_height",{processor:"number"}),n("max_width",{processor:"number"}),n("style_formats",{processor:"object[]"}),n("style_formats_merge",{processor:"boolean",default:!1}),n("style_formats_autohide",{processor:"boolean",default:!1}),n("line_height_formats",{processor:"string",default:"1 1.1 1.2 1.3 1.4 1.5 2"}),n("font_family_formats",{processor:"string",default:"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"}),n("font_size_formats",{processor:"string",default:"8pt 10pt 12pt 14pt 18pt 24pt 36pt"}),n("font_size_input_default_unit",{processor:"string",default:"pt"}),n("block_formats",{processor:"string",default:"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"}),n("content_langs",{processor:"object[]"}),n("removed_menuitems",{processor:"string",default:""}),n("menubar",{processor:e=>r(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||r(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),z(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:wb.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:s,default:"#top"}),n("anchor_bottom",{processor:s,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||d(e),default:!Ob.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},Eb=kb("readonly"),Ab=kb("height"),Mb=kb("width"),Db=_b(kb("min_width")),Bb=_b(kb("min_height")),Ib=_b(kb("max_width")),Fb=_b(kb("max_height")),Rb=_b(kb("style_formats")),Nb=kb("style_formats_merge"),zb=kb("style_formats_autohide"),Lb=kb("content_langs"),Vb=kb("removed_menuitems"),Hb=kb("toolbar_mode"),Pb=kb("toolbar_groups"),Ub=kb("toolbar_location"),Wb=kb("fixed_toolbar_container"),jb=kb("fixed_toolbar_container_target"),Gb=kb("toolbar_persist"),$b=kb("toolbar_sticky_offset"),qb=kb("menubar"),Yb=kb("toolbar"),Xb=kb("file_picker_callback"),Kb=kb("file_picker_validator_handler"),Jb=kb("font_size_input_default_unit"),Zb=kb("file_picker_types"),Qb=kb("typeahead_urls"),ev=kb("anchor_top"),tv=kb("anchor_bottom"),ov=kb("draggable_modal"),nv=kb("statusbar"),sv=kb("elementpath"),rv=kb("branding"),av=kb("resize"),iv=kb("paste_as_text"),lv=kb("sidebar_show"),cv=kb("help_accessibility"),dv=kb("default_font_stack"),uv=e=>!1===e.options.get("skin"),mv=e=>!1!==e.options.get("menubar"),gv=e=>{const t=e.options.get("skin_url");if(uv(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return Cb.baseURL+"/skins/ui/"+t}},pv=e=>A.from(e.options.get("skin_url")),hv=e=>e.options.get("line_height_formats").split(" "),fv=e=>{const t=Yb(e),o=r(t),n=l(t)&&t.length>0;return!vv(e)&&(n||o||!0===t)},bv=e=>{const t=z(9,t=>e.options.get("toolbar"+(t+1))),o=U(t,r);return Oe(o.length>0,o)},vv=e=>bv(e).fold(()=>{const t=Yb(e);return f(t,r)&&t.length>0},E),yv=e=>Ub(e)===wb.bottom,xv=e=>{var t;if(!e.inline)return A.none();const o=null!==(t=Wb(e))&&void 0!==t?t:"";if(o.length>0)return yi(St(),o);const n=jb(e);return g(n)?A.some(Le(n)):A.none()},wv=e=>e.inline&&xv(e).isSome(),Sv=e=>xv(e).getOrThunk(()=>vt(bt(Le(e.getElement())))),Cv=e=>e.inline&&!mv(e)&&!fv(e)&&!vv(e),Ov=e=>(e.options.get("toolbar_sticky")||e.inline)&&!wv(e)&&!Cv(e),kv=e=>!wv(e)&&"split"===e.options.get("ui_mode"),_v=e=>{const t=e.options.get("menu");return ce(t,e=>({...e,items:e.items}))},Tv=(e,t)=>{if(0===t.length)return"";const o=new Set(t),n=e.split("|").map(e=>e.trim()).map(e=>0===e.length?[]:e.split(/\s+/).filter(e=>o.has(e))).filter(e=>e.length>0).map(e=>e.join(" "));return n.join(" | ")},Ev=(e,t)=>{var o,n,s,r;if(!e.options.isRegistered("table_contextmenu"))return t;const a=e.options.isSet("table_contextmenu"),i=null!==(o=e.options.get("table_contextmenu"))&&void 0!==o?o:[],l=i.length>0?["inserttable",...i]:[],c=a?l.join(" "):t;if(!e.options.get("table_contextmenu_flatten")||0===c.length)return c;const d="tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter",u="tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter",m="tablecellprops tablemergecells tablesplitcells",g=e.options.isSet("table_row_contextmenu")?Tv(d,null!==(n=e.options.get("table_row_contextmenu"))&&void 0!==n?n:[]):d,p=e.options.isSet("table_column_contextmenu")?Tv(u,null!==(s=e.options.get("table_column_contextmenu"))&&void 0!==s?s:[]):u;return((e,t)=>{const o=e.split("|").map(e=>e.trim()).filter(e=>e.length>0),n=[],s=e=>{e.length>0&&n.push(e.join(" "))};return H(o,e=>{const o=e.split(/\s+/).filter(e=>e.length>0);let n=[];H(o,e=>{const o=t[e];if(void 0===o)n.push(e);else{if(0===o.length)return;{const e=o.split("|").map(e=>e.trim()).filter(e=>e.length>0);1===e.length?n=n.concat(e[0].split(/\s+/).filter(e=>e.length>0)):(s(n),n=[],H(e,e=>{s(e.split(/\s+/).filter(e=>e.length>0))}))}}}),s(n)}),n.join(" | ")})(c,{cell:e.options.isSet("table_cell_contextmenu")?Tv(m,null!==(r=e.options.get("table_cell_contextmenu"))&&void 0!==r?r:[]):m,row:g,column:p})};var Av=Object.freeze({__proto__:null,get ToolbarMode(){return xb},get ToolbarLocation(){return wb},register:Tb,getSkinUrl:gv,getSkinUrlOption:pv,isReadOnly:Eb,isSkinDisabled:uv,getHeightOption:Ab,getWidthOption:Mb,getMinWidthOption:Db,getMinHeightOption:Bb,getMaxWidthOption:Ib,getMaxHeightOption:Fb,getUserStyleFormats:Rb,shouldMergeStyleFormats:Nb,shouldAutoHideStyleFormats:zb,getLineHeightFormats:hv,getContentLanguages:Lb,getRemovedMenuItems:Vb,isMenubarEnabled:mv,isMultipleToolbars:vv,isToolbarEnabled:fv,isToolbarPersist:Gb,getMultipleToolbarsOption:bv,getUiContainer:Sv,useFixedContainer:wv,isSplitUiMode:kv,getToolbarMode:Hb,isDraggableModal:ov,isDistractionFree:Cv,isStickyToolbar:Ov,getStickyToolbarOffset:$b,getToolbarLocation:Ub,isToolbarLocationBottom:yv,getToolbarGroups:Pb,getMenus:_v,getMenubar:qb,getToolbar:Yb,getFilePickerCallback:Xb,getFilePickerTypes:Zb,useTypeaheadUrls:Qb,getAnchorTop:ev,getAnchorBottom:tv,getFilePickerValidatorHandler:Kb,getFontSizeInputDefaultUnit:Jb,useStatusBar:nv,useElementPath:sv,useBranding:rv,getResize:av,getPasteAsText:iv,getSidebarShow:lv,useHelpAccessibility:cv,getDefaultFontStack:dv,getFilteredTableMenuItems:Ev});var Mv;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(Mv||(Mv={}));var Dv=Mv;const Bv="tox-menu-nav__js",Iv="tox-collection__item",Fv="tox-swatch",Rv={normal:Bv,color:Fv},Nv="tox-collection__item--enabled",zv="tox-collection__item-icon",Lv="tox-collection__item-label",Vv="tox-collection__item-caret",Hv="tox-collection__item--active",Pv="tox-collection__item-container",Uv="tox-collection__item-container--row",Wv=e=>be(Rv,e).getOr(Bv),jv=e=>"color"===e?"tox-swatches":"tox-menu",Gv=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:jv(e),tieredMenu:"tox-tiered-menu"}),$v=e=>{const t=Gv(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:Wv(e)}},qv=(e,t,o)=>{const n=Gv(o);return{tag:"div",classes:q([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},Yv=[zh.parts.items({})],Xv=(e,t,o)=>{const n=Gv(o);return{dom:{tag:"div",classes:q([[n.tieredMenu]])},markers:$v(o)}},Kv=x([gs("data"),ws("inputAttributes",{}),ws("inputStyles",{}),ws("tag","input"),ws("inputClasses",[]),Ni("onSetValue"),ws("styles",{}),ws("eventOrder",{}),xu("inputBehaviours",[yu,ih]),ws("selectOnFocus",!0)]),Jv=e=>El([ih.config({onFocus:e.selectOnFocus?e=>{const t=e.element,o=Ja(t);t.dom.setSelectionRange(0,o.length)}:b})]),Zv=e=>({...Jv(e),...Su(e.inputBehaviours,[yu.config({store:{mode:"manual",...e.data.map(e=>({initialValue:e})).getOr({}),getValue:e=>Ja(e.element),setValue:(e,t)=>{Ja(e.element)!==t&&Za(e.element,t)}},onSetValue:e.onSetValue})])}),Qv=e=>({tag:e.tag,attributes:{type:"text",...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),ey=wm({name:"Input",configFields:Kv(),factory:(e,t)=>({uid:e.uid,dom:Qv(e),components:[],behaviours:Zv(e),eventOrder:e.eventOrder})}),ty=da("refetch-trigger-event"),oy=da("redirect-menu-item-interaction"),ny="tox-menu__searcher",sy=e=>yi(e.element,`.${ny}`).bind(t=>e.getSystem().getByDom(t).toOptional()),ry=sy,ay=e=>({fetchPattern:yu.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),iy=e=>{const t=(e,t)=>(t.cut(),A.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return Nr(e,oy,o),A.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[Iv]},components:[ey.sketch({inputClasses:[ny,"tox-textfield"],inputAttributes:{...e.placeholder.map(t=>({placeholder:e.i18n(t)})).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:El([oh(n,[jr(er(),e=>{Rr(e,ty)}),jr(Zs(),(e,t)=>{"Escape"===t.event.raw.key&&t.stop()})]),$p.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,$p.name()]}})]}},ly="tox-collection--results__js",cy=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:da("aria-item-search-result-id"),"aria-selected":"false"}}}:e},dy=(e,t)=>o=>{const n=L(o,t);return V(n,t=>({dom:e,components:t}))},uy=(e,t)=>{const o=[];let n=[];return H(e,(e,s)=>{t(e,s)?(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),V(o,e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e}))},my=(e,t,o)=>zh.parts.items({preprocess:n=>{const s=V(n,o);return"auto"!==e&&e>1?dy({tag:"div",classes:["tox-collection__group"]},e)(s):uy(s,(e,o)=>"separator"===t[o].type)}}),gy=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[my(e,t,w)]}),py=e=>N(e,e=>"icon"in e&&void 0!==e.icon),hy=e=>(console.error(Zn(e)),console.log(e),A.none()),fy=(e,t,o,n,s)=>{const r=(a=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[zh.parts.items({preprocess:e=>uy(e,(e,t)=>"separator"===a[t].type)})]});var a;return{value:e,dom:r.dom,components:r.components,items:o}},by=(e,t,o,n,s)=>{if("color"===s.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[zh.parts.items({preprocess:"auto"!==e?dy({tag:"div",classes:["tox-swatches__row"]},e):w})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType&&"auto"===n){const t=gy(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===s.menuType||"searchable"===s.menuType){const t="searchable"!==s.menuType?gy(n,o):"search-with-field"===s.searchMode.searchMode?((e,t,o)=>{const n=da("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[iy({i18n:lb.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],ly],attributes:{id:n}},components:[my(e,t,cy)]}]}})(n,o,s.searchMode):((e,t)=>{const o=da("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",ly].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:o}},components:[my(e,t,cy)]}})(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===s.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[zh.parts.items({preprocess:dy({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:qv(t,n,s.menuType),components:Yv,items:o}},vy=is("type"),yy=is("name"),xy=is("label"),wy=is("text"),Sy=is("title"),Cy=is("icon"),Oy=is("value"),ky=cs("fetch"),_y=cs("getSubmenuItems"),Ty=cs("onAction"),Ey=cs("onItemAction"),Ay=Ts("onSetup",()=>b),My=fs("name"),Dy=fs("text"),By=fs("icon"),Iy=fs("tooltip"),Fy=fs("label"),Ry=fs("shortcut"),Ny=vs("select"),zy=_s("active",!1),Ly=_s("borderless",!1),Vy=_s("enabled",!0),Hy=_s("primary",!1),Py=e=>ws("columns",e),Uy=ws("meta",{}),Wy=Ts("onAction",b),jy=e=>Os("type",e),Gy=e=>ts("name","name",xn(()=>da(`${e}-name`)),Pn),$y=In([vy,Dy]),qy=In([jy("autocompleteitem"),zy,Vy,Uy,Oy,Dy,By]),Yy=[Vy,Iy,By,Dy,Ay],Xy=In([vy,Ty,Ry].concat(Yy)),Ky=e=>Xn("toolbarbutton",Xy,e),Jy=[zy].concat(Yy),Zy=In(Jy.concat([vy,Ty,Ry])),Qy=e=>Xn("ToggleButton",Zy,e),ex=[Ts("predicate",T),ks("scope","node",["node","editor"]),ks("position","selection",["node","selection","line"])],tx=Yy.concat([jy("contextformbutton"),Hy,Ty,os("original",w)]),ox=Jy.concat([jy("contextformbutton"),Hy,Ty,os("original",w)]),nx=Yy.concat([jy("contextformbutton")]),sx=Jy.concat([jy("contextformtogglebutton")]),rx=Qn("type",{contextformbutton:tx,contextformtogglebutton:ox}),ax=In([jy("contextform"),Ts("initValue",x("")),Fy,ms("commands",rx),ps("launch",Qn("type",{contextformbutton:nx,contextformtogglebutton:sx}))].concat(ex)),ix=In([jy("contexttoolbar"),is("items")].concat(ex)),lx=[vy,is("src"),fs("alt"),Es("classes",[],Pn)],cx=In(lx),dx=[vy,wy,My,Es("classes",["tox-collection__item-label"],Pn)],ux=In(dx),mx=Mn(()=>$n("type",{cardimage:cx,cardtext:ux,cardcontainer:gx})),gx=In([vy,Os("direction","horizontal"),Os("align","left"),Os("valign","middle"),ms("items",mx)]),px=[Vy,Dy,Ry,ts("value","value",xn(()=>da("menuitem-value")),Ln()),Uy];const hx=In([vy,Fy,ms("items",mx),Ay,Wy].concat(px)),fx=In([vy,zy,By].concat(px)),bx=[vy,is("fancytype"),Wy],vx=[ws("initData",{})].concat(bx),yx=[vs("select"),As("initData",{},[_s("allowCustomColors",!0),Os("storageKey","default"),ys("colors",Ln())])].concat(bx),xx=Qn("fancytype",{inserttable:vx,colorswatch:yx}),wx=In([vy,Ay,Wy,By].concat(px)),Sx=In([vy,_y,Ay,By].concat(px)),Cx=In([vy,By,zy,Ay,Ty].concat(px)),Ox=(e,t,o)=>{const n=Qc(e.element,"."+o);if(n.length>0){const e=$(n,e=>{const o=e.dom.getBoundingClientRect().top,s=n[0].dom.getBoundingClientRect().top;return Math.abs(o-s)>t}).getOr(n.length);return A.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return A.none()},kx=e=>((e,t)=>El([oh(e,t)]))(da("unnamed-events"),e),_x=da("tooltip.exclusive"),Tx=da("tooltip.show"),Ex=da("tooltip.hide"),Ax=da("tooltip.immediateHide"),Mx=da("tooltip.immediateShow"),Dx=(e,t,o)=>{e.getSystem().broadcastOn([_x],{})};var Bx=Object.freeze({__proto__:null,hideAllExclusive:Dx,setComponents:(e,t,o,n)=>{o.getTooltip().each(e=>{e.getSystem().isConnected()&&th.set(e,n)})}}),Ix=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each(n=>{n.getSystem().isConnected()&&(zd(n),e.onHide(o,n),t.clearTooltip())}),t.clearTimer()},n=o=>{if(!t.isShowing()){Dx(o);const n=e.lazySink(o).getOrDie(),s=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:Pr("normal"===e.mode?[jr(Xs(),e=>{Rr(o,Tx)}),jr(qs(),e=>{Rr(o,Ex)})]:[]),behaviours:El([th.config({})])});t.setTooltip(s),Fd(n,s),e.onShow(o,s),Td.position(n,s,{anchor:e.anchor(o)})}},s=o=>{t.getTooltip().each(t=>{const n=e.lazySink(o).getOrDie();Td.position(n,t,{anchor:e.anchor(o)})})};return Pr(q([[jr(Tx,o=>{t.resetTimer(()=>{n(o)},e.delayForShow())}),jr(Ex,n=>{t.resetTimer(()=>{o(n)},e.delayForHide())}),jr(Mx,e=>{t.resetTimer(()=>{n(e)},0)}),jr(Ax,e=>{t.resetTimer(()=>{o(e)},0)}),jr(mr(),(e,t)=>{const n=t;n.universal||R(n.channels,_x)&&o(e)}),Qr(e=>{o(e)})],(()=>{switch(e.mode){case"normal":return[jr(Ks(),e=>{Rr(e,Mx)}),jr(dr(),e=>{Rr(e,Ax)}),jr(Xs(),e=>{Rr(e,Tx)}),jr(qs(),e=>{Rr(e,Ex)})];case"follow-highlight":return[jr(Ir(),(e,t)=>{Rr(e,Tx)}),jr(Fr(),e=>{Rr(e,Ex)})];case"children-normal":return[jr(Ks(),(o,n)=>{Hl(o.element).each(r=>{Je(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Rr(o,Mx)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),jr(dr(),e=>{Hl(e.element).fold(()=>{Rr(e,Ax)},b)}),jr(Xs(),o=>{yi(o.element,"[data-mce-tooltip]:hover").each(n=>{t.getTooltip().fold(()=>{Rr(o,Tx)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),jr(qs(),e=>{yi(e.element,"[data-mce-tooltip]:hover").fold(()=>{Rr(e,Ex)},b)})];default:return[jr(Ks(),(o,n)=>{Hl(o.element).each(r=>{Je(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Rr(o,Mx)},n=>{t.isShowing()&&(e.onShow(o,n),s(o))})})}),jr(dr(),e=>{Hl(e.element).fold(()=>{Rr(e,Ax)},b)})]}})()]))}}),Fx=[ss("lazySink"),ss("tooltipDom"),ws("exclusive",!0),ws("tooltipComponents",[]),Ts("delayForShow",x(300)),Ts("delayForHide",x(300)),ks("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),ws("anchor",e=>({type:"hotspot",hotspot:e,layouts:{onLtr:x([pl,gl,cl,ul,dl,ml]),onRtl:x([pl,gl,cl,ul,dl,ml])},bubble:vc(0,-2,{})})),Ni("onHide"),Ni("onShow")],Rx=Object.freeze({__proto__:null,init:()=>{const e=sc(),t=sc(),o=()=>{e.on(clearTimeout)},n=x("not-implemented");return Ea({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 Nx=Ml({fields:Fx,name:"tooltipping",active:Ix,state:Rx,apis:Bx}),zx="silver.readonly",Lx=In([rs("readonly",Un)]);const Vx=(e,t)=>{const o=e.mainUi.outerContainer.element,n=[e.mainUi.mothership,...e.uiMotherships];t&&H(n,e=>{e.broadcastOn([eu()],{target:o})}),H(n,e=>{e.broadcastOn([zx],{readonly:t})})},Hx=(e,t)=>{e.on("init",()=>{e.mode.isReadOnly()&&Vx(t,!0)}),e.on("SwitchMode",()=>Vx(t,e.mode.isReadOnly())),Eb(e)&&e.mode.set("readonly")},Px=()=>Fl.config({channels:{[zx]:{schema:Lx,onReceive:(e,t)=>{Hm.set(e,t.readonly)}}}}),Ux=e=>Hm.config({disabled:e}),Wx=e=>Hm.config({disabled:e,disableClass:"tox-tbtn--disabled"}),jx=e=>Hm.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),Gx=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},$x=(e,t)=>Zr(o=>{Gx(e,o)(o=>{const n=e.onSetup(o);p(n)&&t.set(n)})}),qx=(e,t)=>Qr(o=>Gx(e,o)(t.get())),Yx=(e,t)=>ta((o,n)=>{Gx(e,o)(e.onAction),e.triggersSubmenu||t!==Dv.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Rr(o,br()),n.stop())}),Xx={[gr()]:["disabling","alloy.base.behaviour","toggling","item-events"]},Kx=we,Jx=(e,t,o,n)=>{const s=Ms(b);return{type:"item",dom:t.dom,components:Kx(t.optComponents),data:e.data,eventOrder:Xx,hasSubmenu:e.triggersSubmenu,itemBehaviours:El([oh("item-events",[Yx(e,o),$x(e,s),qx(e,s)]),(r=()=>!e.enabled||n.isDisabled(),Hm.config({disabled:r,disableClass:"tox-collection__item--state-disabled"})),Px(),th.config({})].concat(e.itemBehaviours))};var r},Zx=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),Qx=e=>{const t=Ob.os.isMacOS()||Ob.os.isiOS(),o=t?{alt:"\u2325",ctrl:"\u2303",shift:"\u21e7",meta:"\u2318",access:"\u2303\u2325"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),s=V(n,e=>{const t=e.toLowerCase().trim();return ve(o,t)?o[t]:e});return t?s.join(""):s.join("+")},ew=(e,t,o=[zv])=>bb(e,{tag:"div",classes:o},t),tw=e=>({dom:{tag:"div",classes:[Lv]},components:[ai(lb.translate(e))]}),ow=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),nw=(e,t)=>({dom:{tag:"div",classes:[Lv]},components:[{dom:{tag:e.tag,styles:e.styles},components:[ai(lb.translate(t))]}]}),sw=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[ai(Qx(e))]}),rw=e=>ew("checkmark",e,["tox-collection__item-checkmark"]),aw=e=>{const t=e.map(e=>({attributes:{id:da("menu-item"),"aria-label":lb.translate(e)}})).getOr({});return{tag:"div",classes:[Bv,Iv],...t}},iw=(e,t,o,n=A.none())=>"color"===e.presets?((e,t,o)=>{const n=e.value,s=e.iconContent.map(e=>((e,t,o)=>{const n=t();return gb(e,n).or(o).getOrThunk(ub(n))})(e,t.icons,o)),r=e.ariaLabel.map(e=>({"aria-label":t.translate(e),"data-mce-name":e})).getOr({});return{dom:(()=>{const e=Fv,t=s.getOr(""),o={tag:"div",attributes:r,classes:[e]};return"custom"===n?{...o,tag:"button",classes:[...o.classes,"tox-swatches__picker-btn"],innerHtml:t}:"remove"===n?{...o,classes:[...o.classes,"tox-swatch--remove"],innerHtml:t}:g(n)?{...o,attributes:{...o.attributes,"data-mce-color":n},styles:{"background-color":n},innerHtml:t}:o})(),optComponents:[]}})(e,t,n):((e,t,o,n)=>{const s={tag:"div",classes:[zv]},r=o?e.iconContent.map(e=>bb(e,s,t.icons,n)).orThunk(()=>A.some({dom:s})):A.none(),a=e.checkMark,i=A.from(e.meta).fold(()=>tw,e=>ve(e,"style")?C(nw,e.style):tw),l=e.htmlContent.fold(()=>e.textContent.map(i),e=>A.some(ow(e,[Lv])));return{dom:aw(e.ariaLabel),optComponents:[r,l,e.shortcutContent.map(sw),a,e.caret]}})(e,t,o,n),lw=(e,t,o)=>be(e,"tooltipWorker").map(e=>[Nx.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:pc}}),mode:"follow-highlight",onShow:(t,o)=>{e(e=>{Nx.setComponents(t,[ii({element:Le(e)})])})}})]).getOrThunk(()=>o.map(e=>[Nx.config({...t.providers.tooltips.getConfig({tooltipText:e}),mode:"follow-highlight"})]).getOr([])),cw=(e,t)=>{const o=(e=>Sb.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},dw=(e,t)=>V(e,e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":Uv,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[Pv,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,dw(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?A.from(t.cardText.matchText).getOr(""):"";return ow(cw(e.text,n),e.classes)}}),uw=em(Mh(),Dh()),mw=e=>({value:fw(e)}),gw=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,pw=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,hw=e=>gw.test(e)||pw.test(e),fw=e=>_e(e,"#").toUpperCase(),bw=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},vw=e=>{const t=bw(e.red)+bw(e.green)+bw(e.blue);return mw(t)},yw=Math.min,xw=Math.max,ww=Math.round,Sw=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,Cw=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Ow=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),kw=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},_w=e=>{let t,o,n;const s=(e.hue||0)%360;let r=e.saturation/100,a=e.value/100;if(r=xw(0,yw(r,1)),a=xw(0,yw(a,1)),0===r)return t=o=n=ww(255*a),Ow(t,o,n,1);const i=s/60,l=a*r,c=l*(1-Math.abs(i%2-1)),d=a-l;switch(Math.floor(i)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=ww(255*(t+d)),o=ww(255*(o+d)),n=ww(255*(n+d)),Ow(t,o,n,1)},Tw=e=>{const t=(e=>{const t=(e=>{const t=e.value.replace(gw,(e,t,o,n)=>t+t+o+o+n+n);return{value:t}})(e),o=pw.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o})(e),o=parseInt(t[1],16),n=parseInt(t[2],16),s=parseInt(t[3],16);return Ow(o,n,s,1)},Ew=(e,t,o,n)=>{const s=parseInt(e,10),r=parseInt(t,10),a=parseInt(o,10),i=parseFloat(n);return Ow(s,r,a,i)},Aw=e=>{if("transparent"===e)return A.some(Ow(0,0,0,0));const t=Sw.exec(e);if(null!==t)return A.some(Ew(t[1],t[2],t[3],"1"));const o=Cw.exec(e);return null!==o?A.some(Ew(o[1],o[2],o[3],o[4])):A.none()},Mw=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Dw=Ow(255,0,0,1),Bw=(e,t)=>{e.dispatch("ResizeContent",t)},Iw=(e,t)=>{e.dispatch("TextColorChange",t)},Fw=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),Rw=(e,t)=>()=>{e(),t()},Nw=e=>Lw(e,"NodeChange",t=>{t.setEnabled(e.selection.isEditable())}),zw=(e,t)=>o=>{const n=Nw(e)(o),s=((e,t)=>o=>{const n=nc(),s=()=>{o.setActive(e.formatter.match(t));const s=e.formatter.formatChanged(t,o.setActive);n.set(s)};return e.initialized?s():e.once("init",s),()=>{e.off("init",s),n.clear()}})(e,t)(o);return()=>{n(),s()}},Lw=(e,t,o)=>n=>{const s=()=>o(n),r=()=>{o(n),e.on(t,s)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),e.off(t,s)}},Vw=e=>t=>()=>{e.undoManager.transact(()=>{e.focus(),["p","h1","h2","h3","h4","h5","h6"].includes(t.format)&&e.execCommand("RemoveFormat"),e.execCommand("mceToggleFormat",!1,t.format)})},Hw=(e,t)=>()=>e.execCommand(t);var Pw=tinymce.util.Tools.resolve("tinymce.util.LocalStorage");const Uw={},Ww=e=>be(Uw,e).getOrThunk(()=>{const t=`tinymce-custom-colors-${e}`,o=Pw.getItem(t);if(m(o)){const e=Pw.getItem("tinymce-custom-colors");Pw.setItem(t,g(e)?e:"[]")}const n=((e,t=10)=>{const o=Pw.getItem(e),n=r(o)?JSON.parse(o):[],s=t-(a=n).length<0?a.slice(0,t):a;var a;const i=e=>{s.splice(e,1)};return{add:o=>{F(s,o).each(i),s.unshift(o),s.length>t&&s.pop(),Pw.setItem(e,JSON.stringify(s))},state:()=>s.slice(0)}})(t,10);return Uw[e]=n,n}),jw=(e,t)=>{Ww(e).add(t)},Gw=(e,t,o)=>({hue:e,saturation:t,value:o}),$w=e=>{let t=0,o=0,n=0;const s=e.red/255,r=e.green/255,a=e.blue/255,i=Math.min(s,Math.min(r,a)),l=Math.max(s,Math.max(r,a));return i===l?(n=i,Gw(0,0,100*n)):(t=s===i?3:a===i?1:5,t=60*(t-(s===i?r-a:a===i?s-r:a-s)/(l-i)),o=(l-i)/l,n=l,Gw(Math.round(t),Math.round(100*o),Math.round(100*n)))},qw=e=>vw(_w(e)),Yw=e=>{return(t=e,hw(t)?A.some({value:fw(t)}):A.none()).orThunk(()=>Aw(e).map(vw)).getOrThunk(()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,s=n[0],r=n[1],a=n[2],i=n[3];return vw(Ow(s,r,a,i))});var t},Xw="forecolor",Kw="hilitecolor",Jw=e=>{const t=[];for(let o=0;o<e.length;o+=2)t.push({text:e[o+1],value:"#"+Yw(e[o]).value,icon:"checkmark",type:"choiceitem"});return t},Zw=e=>t=>t.options.get(e),Qw="#000000",eS=(e,t)=>t===Xw&&e.options.isSet("color_map_foreground")?Zw("color_map_foreground")(e):t===Kw&&e.options.isSet("color_map_background")?Zw("color_map_background")(e):Zw("color_map")(e),tS=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(eS(e,t).length))),oS=(e,t)=>{const o=Zw("color_cols")(e),n=tS(e,t);return o===tS(e)?n:o},nS=(e,t="default")=>Math.round(t===Xw?Zw("color_cols_foreground")(e):t===Kw?Zw("color_cols_background")(e):Zw("color_cols")(e)),sS=Zw("custom_colors"),rS=Zw("color_default_foreground"),aS=Zw("color_default_background"),iS=(e,t)=>{const o=Le(e.selection.getStart()),n="hilitecolor"===t?Ns(o,e=>{if($e(e)){const t=Nt(e,"background-color");return Oe(Aw(t).exists(e=>0!==e.alpha),t)}return A.none()}).getOr("rgba(0, 0, 0, 0)"):Nt(o,"color");return Aw(n).map(e=>"#"+vw(e).value)},lS=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]},cS=(e,t,o,n)=>{"custom"===o?vS(e)(o=>{o.each(o=>{jw(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)})},iS(e,t).getOr(Qw)):"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},dS=(e,t,o)=>e.concat((e=>V(Ww(e).state(),e=>({type:"choiceitem",text:e,icon:"checkmark",value:e})))(t).concat(lS(o))),uS=(e,t,o)=>n=>{n(dS(e,t,o))},mS=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},gS=(e,t)=>{e.setTooltip(t)},pS=(e,t)=>o=>{const n=iS(e,t);return xe(n,o.toUpperCase())},hS=(e,t,o)=>{if(Be(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",s=dS(eS(e,t),t,!1),r=G(s,e=>e.value===o).getOr({text:""}).text;return e.translate([n,e.translate(r)])},fS=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:hS(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:pS(e,o),columns:nS(e,o),fetch:uS(eS(e,o),o,sS(e)),onAction:t=>{cS(e,o,n.get(),b)},onItemAction:(s,r)=>{cS(e,o,r,o=>{n.set(o),Iw(e,{name:t,color:o})})},onSetup:s=>{mS(s,t,n.get());const r=n=>{n.name===t&&(mS(s,n.name,n.color),gS(s,hS(e,o,n.color)))};return e.on("TextColorChange",r),Rw(Nw(e)(s),()=>{e.off("TextColorChange",r)})}})},bS=(e,t,o,n,s)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(gS(n,hS(e,o,s.get())),mS(n,t,s.get()),Nw(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:pS(e,o),initData:{storageKey:o},onAction:n=>{cS(e,o,n.value,o=>{s.set(o),Iw(e,{name:t,color:o})})}}]})},vS=e=>(t,o)=>{let n=!1;const s={colorpicker:o};e.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:s,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const s=o.getData().colorpicker;n?(t(A.from(s)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",s]))},onClose:b,onCancel:()=>{t(A.none())}})},yS=(e,t,o,n,s,r,a,i)=>{const l=py(t),c=xS(t,o,n,"color"!==s?"normal":"color",r,a,i);return by(e,l,c,n,{menuType:s})},xS=(e,t,o,n,s,r,a)=>we(V(e,i=>{return"choiceitem"===i.type?(l=i,Xn("choicemenuitem",fx,l)).fold(hy,i=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=iw({presets:o,textContent:t?e.text:A.none(),htmlContent:A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:A.none(),checkMark:t?A.some(rw(a.icons)):A.none(),caret:A.none(),value:e.value},a,i),c=e.text.filter(x(!t)).map(e=>Nx.config(a.tooltips.getConfig({tooltipText:a.translate(e)})));return vn(Jx({data:Zx(e),enabled:e.enabled,getApi:e=>({setActive:t=>{hh.set(e,t)},isActive:()=>hh.isOn(e),isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(s),b),triggersSubmenu:!1,itemBehaviours:[...c.toArray()]},l,r,a),{toggling:{toggleClass:Nv,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(i,1===o,n,t,r(i.value),s,a,py(e)))):A.none();var l})),wS=(e,t)=>{const o=$v(t);return 1===e?{mode:"menu",moveOnTab:!0}:"auto"===e?{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===t?"tox-swatches__row":"tox-collection__group"),previousSelector:e=>"color"===t?yi(e.element,"[aria-checked=true]"):A.none()}},SS=da("cell-over"),CS=da("cell-execute"),OS=(e,t,o)=>{const n=o=>Nr(o,CS,{row:e,col:t}),s=(e,t)=>{t.stop(),n(e)};return di({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:El([oh("insert-table-picker-cell",[jr(Xs(),ih.focus),jr(gr(),n),jr(or(),s),jr(hr(),s)]),hh.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),ih.config({onFocus:o=>Nr(o,SS,{row:e,col:t})})])})},kS=e=>Y(e,e=>V(e,ui)),_S=(e,t)=>ai(`${t}x${e}`),TS={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=(e=>{const t=[];for(let o=0;o<10;o++){const n=[];for(let t=0;t<10;t++){const s=e(o+1,t+1);n.push(OS(o,t,s))}t.push(n)}return t})(o),s=_S(0,0),r=Jh({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[s],behaviours:El([th.config({})])});return{type:"widget",data:{value:da("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[uw.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:kS(n).concat(r.asSpec()),behaviours:El([oh("insert-table-picker",[Zr(e=>{th.set(r.get(e),[s])}),Yr(SS,(e,t,o)=>{const{row:s,col:a}=o.event;((e,t,o)=>{for(let n=0;n<10;n++)for(let s=0;s<10;s++)hh.set(e[n][s],n<=t&&s<=o)})(n,s,a),th.set(r.get(e),[_S(s+1,a+1)])}),Yr(CS,(t,o,n)=>{const{row:s,col:r}=n.event;e.onAction({numRows:s+1,numColumns:r+1}),Rr(t,br())})]),$p.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=((e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold(()=>dS(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o),e=>e.concat(lS(o)))})(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),s="color",r={...yS(da("menu-value"),o,t=>{e.onAction({value:t})},n,s,Dv.CLOSE_ON_EXECUTE,e.select.getOr(T),t.shared.providers),markers:$v(s),movement:wS(n,s)};return{type:"widget",data:{value:da("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[uw.widget(zh.sketch(r))]}}},ES=e=>({type:"separator",dom:{tag:"div",classes:[Iv,"tox-collection__group-heading"]},components:e.text.map(ai).toArray()});var AS=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),MS=[rs("others",Yn(an.value,Ln()))],DS=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 Ea({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk(()=>(be(o.others,n).getOrDie("No information found for coupled component: "+n),A.none())),getOrCreate:(o,n,s)=>t(n,s).getOrThunk(()=>{const t=be(n.others,s).getOrDie("No information found for coupled component: "+s)(o),r=o.getSystem().build(t);return e[s]=r,r})})}});const BS=Ml({fields:MS,name:"coupling",apis:AS,state:DS}),IS=e=>{let t=A.none(),o=[];const n=e=>{s()?r(e):o.push(e)},s=()=>t.isSome(),r=e=>{t.each(t=>{setTimeout(()=>{e(t)},0)})};return e(e=>{s()||(t=A.some(e),H(o,r),o=[])}),{get:n,map:e=>IS(t=>{n(o=>{t(e(o))})}),isReady:s}},FS={nu:IS,pure:e=>IS(t=>{t(e)})},RS=e=>{setTimeout(()=>{throw e},0)},NS=e=>{const t=t=>{e().then(t,RS)};return{map:t=>NS(()=>e().then(t)),bind:t=>NS(()=>e().then(e=>t(e).toPromise())),anonBind:t=>NS(()=>e().then(()=>t.toPromise())),toLazy:()=>FS.nu(t),toCached:()=>{let t=null;return NS(()=>(null===t&&(t=e()),t))},toPromise:e,get:t}},zS=e=>NS(()=>new Promise(e)),LS=e=>NS(()=>Promise.resolve(e)),VS=x("sink"),HS=x(Xu({name:VS(),overrides:x({dom:{tag:"div"},behaviours:El([Td.config({useFixed:E})]),events:Pr([Xr(Zs()),Xr(Gs()),Xr(or())])})})),PS=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",s=e.getAnchorOverrides();return e.layouts.fold(()=>({type:n,hotspot:o,overrides:s}),e=>({type:n,hotspot:o,overrides:s,layouts:e}))},US=(e,t,o,n,s,r,a)=>{const i=((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=GS(n,e);return i.map(e=>e.bind(e=>A.from($h.sketch({...r.menu(),uid:ba(""),data:e,highlightOnOpen:a,onOpenMenu:(e,t)=>{const n=l().getOrDie();Td.position(n,t,{anchor:o}),Qd.decloak(s)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();Td.position(n,o,{anchor:{type:"submenu",item:t}}),Qd.decloak(s)},onRepositionMenu:(e,t,n)=>{const s=l().getOrDie();Td.position(s,t,{anchor:o}),H(n,e=>{Td.position(s,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})})},onEscape:()=>(ih.focus(n),Qd.close(s),A.some(!0))}))))})(e,t,PS(e,o),o,n,s,a);return i.map(e=>(e.fold(()=>{Qd.isOpen(n)&&Qd.close(n)},e=>{Qd.cloak(n),Qd.open(n,e),r(n)}),n))},WS=(e,t,o,n,s,r,a)=>(Qd.close(n),LS(n)),jS=(e,t,o,n,s,r)=>{const a=BS.getCoupled(o,"sandbox");return(Qd.isOpen(a)?WS:US)(e,t,o,a,n,s,r)},GS=(e,t)=>e.getSystem().getByUid(t.uid+"-"+VS()).map(e=>()=>an.value(e)).getOrThunk(()=>t.lazySink.fold(()=>()=>an.error(new Error("No internal sink is specified, nor could an external sink be found")),t=>()=>t(e))),$S=e=>{Qd.getState(e).each(e=>{$h.repositionMenus(e)})},qS=(e,t,o)=>{const n=Si(),s=GS(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id,role:"listbox"}},behaviours:Ou(e.sandboxBehaviours,[yu.config({store:{mode:"memory",initialValue:t}}),Qd.config({onOpen:(s,r)=>{const a=PS(e,t);n.link(t.element),e.matchWidth&&((e,t,o)=>{const n=_m.getCurrent(t).getOr(t),s=Qt(e.element);o?It(n.element,"min-width",s+"px"):((e,t)=>{Zt.set(e,t)})(n.element,s)})(a.hotspot,r,e.useMinWidth),e.onOpen(a,s,r),void 0!==o&&void 0!==o.onOpen&&o.onOpen(s,r)},onClose:(e,r)=>{n.unlink(t.element),s().getOr(r).element.dom.dispatchEvent(new window.FocusEvent("focusout")),void 0!==o&&void 0!==o.onClose&&o.onClose(e,r)},isPartOf:(e,o,n)=>Ci(o,n)||Ci(t,n),getAttachPoint:()=>s().getOrDie()}),_m.config({find:e=>Qd.getState(e).bind(e=>_m.getCurrent(e))}),Fl.config({channels:{...su({isExtraPart:T}),...au({doReposition:$S})}})])}},YS=e=>{const t=BS.getCoupled(e,"sandbox");$S(t)},XS=()=>[ws("sandboxClasses",[]),Cu("sandboxBehaviours",[_m,Fl,Qd,yu])],KS=x([ss("dom"),ss("fetch"),Ni("onOpen"),zi("onExecute"),ws("getHotspot",A.some),ws("getAnchorOverrides",x({})),_c(),xu("dropdownBehaviours",[hh,BS,$p,ih]),ss("toggleClass"),ws("eventOrder",{}),gs("lazySink"),ws("matchWidth",!1),ws("useMinWidth",!1),gs("role")].concat(XS())),JS=x([Yu({schema:[Ii(),ws("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),HS()]),ZS=Sm({name:"Dropdown",configFields:KS(),partFields:JS(),factory:(e,t,o,n)=>{const s=e=>{Qd.getState(e).each(e=>{$h.highlightPrimary(e)})},r=(t,o,s)=>jS(e,w,t,n,o,s),a={expand:e=>{hh.isOn(e)||r(e,b,jh.HighlightNone).get(b)},open:e=>{hh.isOn(e)||r(e,b,jh.HighlightMenuAndItem).get(b)},refetch:t=>BS.getExistingCoupled(t,"sandbox").fold(()=>r(t,b,jh.HighlightMenuAndItem).map(b),o=>US(e,w,t,o,n,b,jh.HighlightMenuAndItem).map(b)),isOpen:hh.isOn,close:e=>{hh.isOn(e)&&r(e,b,jh.HighlightMenuAndItem).get(b)},repositionMenus:e=>{hh.isOn(e)&&YS(e)}},i=(e,t)=>(zr(e),A.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.dropdownBehaviours,[hh.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),BS.config({others:{sandbox:t=>qS(e,t,{onOpen:()=>hh.on(t),onClose:()=>hh.off(t)})}}),$p.config({mode:"special",onSpace:i,onEnter:i,onDown:(e,t)=>{if(ZS.isOpen(e)){const t=BS.getCoupled(e,"sandbox");s(t)}else ZS.open(e);return A.some(!0)},onEscape:(e,t)=>ZS.isOpen(e)?(ZS.close(e),A.some(!0)):A.none()}),ih.config({})]),events:vh(A.some(e=>{r(e,s,jh.HighlightMenuAndItem).get(b)})),eventOrder:{...e.eventOrder,[gr()]:["disabling","toggling","alloy.base.behaviour"]},apis:a,domModification:{attributes:{"aria-haspopup":"true",...e.role.fold(()=>({}),e=>({role:e})),..."button"===e.dom.tag?{type:be(e.dom,"attributes").bind(e=>be(e,"type")).getOr("button")}:{}}}}},apis:{open:(e,t)=>e.open(t),refetch:(e,t)=>e.refetch(t),expand:(e,t)=>e.expand(t),close:(e,t)=>e.close(t),isOpen:(e,t)=>e.isOpen(t),repositionMenus:(e,t)=>e.repositionMenus(t)}}),QS=(e,t,o)=>{ry(e).each(e=>{var n;((e,t)=>{Et(t.element,"id").each(t=>kt(e.element,"aria-activedescendant",t))})(e,o),(qa((n=t).element,ly)?A.some(n.element):yi(n.element,"."+ly)).each(t=>{Et(t,"id").each(t=>kt(e.element,"aria-controls",t))})}),kt(o.element,"aria-selected","true")},eC=(e,t,o)=>{kt(o.element,"aria-selected","false")},tC=e=>BS.getExistingCoupled(e,"sandbox").bind(sy).map(ay).map(e=>e.fetchPattern).getOr("");var oC;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(oC||(oC={}));const nC=(e,t,o,n,s)=>{const r=o.shared.providers,a=e=>s?{...e,shortcut:A.none(),icon:e.text.isSome()?A.none():e.icon}:e;switch(e.type){case"menuitem":return(i=e,Xn("menuitem",wx,i)).fold(hy,e=>A.some(((e,t,o,n=!0)=>{const s=iw({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.none(),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return Jx({data:Zx(e),getApi:e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o)})(a(e),t,r,n)));case"nestedmenuitem":return(e=>Xn("nestedmenuitem",Sx,e))(e).fold(hy,e=>A.some(((e,t,o,n=!0,s=!1)=>{const r=s?(a=o.icons,ew("chevron-down",a,[Vv])):(e=>ew("chevron-right",e,[Vv]))(o.icons);var a;const i=iw({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,caret:A.some(r),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return Jx({data:Zx(e),getApi:e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setIconFill:(t,o)=>{yi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{kt(e,"fill",o)})},setTooltip:t=>{const n=o.translate(t);kt(e.element,"aria-label",n)}}),enabled:e.enabled,onAction:b,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},i,t,o)})(a(e),t,r,n,s)));case"togglemenuitem":return(e=>Xn("togglemenuitem",Cx,e))(e).fold(hy,e=>A.some(((e,t,o,n=!0)=>{const s=iw({iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,checkMark:A.some(rw(o.icons)),caret:A.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return vn(Jx({data:Zx(e),enabled:e.enabled,getApi:e=>({setActive:t=>{hh.set(e,t)},isActive:()=>hh.isOn(e),isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},s,t,o),{toggling:{toggleClass:Nv,toggleOnExecute:!1,selected:e.active}})})(a(e),t,r,n)));case"separator":return(e=>Xn("separatormenuitem",$y,e))(e).fold(hy,e=>A.some(ES(e)));case"fancymenuitem":return(e=>Xn("fancymenuitem",xx,e))(e).fold(hy,e=>((e,t)=>be(TS,e.fancytype).map(o=>o(e,t)))(e,o));default:return console.error("Unknown item in general menu",e),A.none()}var i},sC=(e,t,o,n,s,r,a)=>{const i=1===n,l=!i||py(e);return we(V(e,e=>{switch(e.type){case"separator":return(n=e,Xn("Autocompleter.Separator",$y,n)).fold(hy,e=>A.some(ES(e)));case"cardmenuitem":return(e=>Xn("cardmenuitem",hx,e))(e).fold(hy,e=>A.some(((e,t,o,n)=>{const s={dom:aw(e.label),optComponents:[A.some({dom:{tag:"div",classes:[Pv,Uv]},components:dw(e.items,n)})]};return Jx({data:Zx({text:A.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>{Hm.set(e,!t),H(Qc(e.element,"*"),o=>{e.getSystem().getByDom(o).each(e=>{e.hasConfigured(Hm)&&Hm.set(e,!t)})})}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:A.from(n.itemBehaviours).getOr([])},s,t,o.providers)})({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},s,r,{itemBehaviours:lw(e.meta,r,A.none()),cardText:{matchText:t,highlightOn:a}})));default:return(e=>Xn("Autocompleter.Item",qy,e))(e).fold(hy,e=>A.some(((e,t,o,n,s,r,a,i=!0)=>{const l=iw({presets:n,textContent:A.none(),htmlContent:o?e.text.map(e=>cw(e,t)):A.none(),ariaLabel:e.text,iconContent:e.icon,shortcutContent:A.none(),checkMark:A.none(),caret:A.none(),value:e.value},a.providers,i,e.icon),c=e.text.filter(e=>!o&&""!==e);return Jx({data:Zx(e),enabled:e.enabled,getApi:x({}),onAction:t=>s(e.value,e.meta),onSetup:x(b),triggersSubmenu:!1,itemBehaviours:lw(e,a,c)},l,r,a.providers)})(e,t,i,"normal",o,s,r,l)))}var n}))},rC=(e,t,o,n,s,r)=>{const a=py(t),i=we(V(t,e=>{const t=e=>nC(e,o,n,(e=>s?!ve(e,"text"):a)(e),s);return"nestedmenuitem"===e.type&&e.getSubmenuItems().length<=0?t({...e,enabled:!1}):t(e)})),l=(e=>"no-search"===e.searchMode?{menuType:"normal"}:{menuType:"searchable",searchMode:e})(r);return(s?fy:by)(e,a,i,1,l)},aC=e=>$h.singleData(e.value,e),iC=e=>Pc(Le(e.startContainer),e.startOffset,Le(e.endContainer),e.endOffset),lC=(e,t)=>{const o=da("autocompleter"),n=Ms(!1),s=Ms(!1),r=sc(),a=di(qh.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:El([oh("dismissAutocompleter",[jr(_r(),()=>u()),jr(Ir(),(t,o)=>{Et(o.event.target,"id").each(t=>kt(Le(e.getBody()),"aria-activedescendant",t))})])]),lazySink:t.getSink})),i=()=>qh.isOpen(a),l=s.get,c=()=>{if(i()){qh.hide(a),e.dom.remove(o,!1);const t=Le(e.getBody());Et(t,"aria-owns").filter(e=>e===o).each(()=>{Mt(t,"aria-owns"),Mt(t,"aria-activedescendant")})}},d=()=>qh.getContent(a).bind(e=>te(e.components(),0)),u=()=>e.execCommand("mceAutocompleterClose"),m=s=>{const i=(o=>{const s=re(o,e=>A.from(e.columns)).getOr(1);return Y(o,o=>{const a=o.items;return sC(a,o.matchText,(t,s)=>{const a={hide:()=>u(),reload:t=>{c(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};e.execCommand("mceAutocompleterRefreshActiveRange"),r.get().each(e=>{n.set(!0),o.onAction(a,e,t,s),n.set(!1)})},s,Dv.BUBBLE_TO_SANDBOX,t,o.highlightOn)})})(s);i.length>0?(((t,o)=>{const n=re(t,e=>A.from(e.columns)).getOr(1);qh.showMenuAt(a,{anchor:{type:"selection",getSelection:()=>r.get().map(iC),root:Le(e.getBody())}},((e,t,o,n)=>{const s=wS(t,n),r=$v(n);return{data:aC({...e,movement:s,menuBehaviours:kx("auto"!==t?[]:[Zr((e,t)=>{Ox(e,4,r.item).each(({numColumns:t,numRows:o})=>{$p.setGridSize(e,o,t)})})])}),menu:{markers:$v(n),fakeFocus:o===oC.ContentFocus}}})(by("autocompleter-value",!0,o,n,{menuType:"normal"}),n,oC.ContentFocus,"normal")),d().each(Km.highlightFirst)})(s,i),kt(Le(e.getBody()),"aria-owns",o),e.inline||g()):c()},g=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),s=(e=>sa(e,!0))(a.element);Ft(s,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${n.offsetTop}px`,left:`${n.offsetLeft}px`}),e.dom.add(t,s.dom),yi(s,'[role="menu"]').each(e=>{Pt(e,"position"),Pt(e,"max-height")})};e.on("AutocompleterStart",({lookupData:e})=>{s.set(!0),n.set(!1),m(e)}),e.on("AutocompleterUpdate",({lookupData:e})=>m(e)),e.on("AutocompleterUpdateActiveRange",({range:e})=>r.set(e)),e.on("AutocompleterEnd",()=>{c(),s.set(!1),n.set(!1),r.clear()});((e,t)=>{const o=(e,t)=>{Nr(e,Zs(),{raw:t})},n=()=>e.getMenu().bind(Km.getHighlighted);t.on("keydown",t=>{const s=t.which;e.isActive()&&(e.isMenuOpen()?13===s?(n().each(zr),t.preventDefault()):40===s?(n().fold(()=>{e.getMenu().each(Km.highlightFirst)},e=>{o(e,t)}),t.preventDefault(),t.stopImmediatePropagation()):37!==s&&38!==s&&39!==s||n().each(e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()}):13!==s&&38!==s&&40!==s||e.cancelIfNecessary())}),t.on("NodeChange",()=>{!e.isActive()||e.isProcessingAction()||t.queryCommandState("mceAutoCompleterInRange")||e.cancelIfNecessary()})})({cancelIfNecessary:u,isMenuOpen:i,isActive:l,isProcessingAction:n.get,getMenu:d},e)},cC=["visible","hidden","clip"],dC=e=>Me(e).length>0&&!R(cC,e),uC=e=>{if(Ge(e)){const t=Nt(e,"overflow-x"),o=Nt(e,"overflow-y");return dC(t)||dC(o)}return!1},mC=(e,t)=>kv(e)?(e=>{const t=Zc(e,uC),o=0===t.length?yt(e).map(xt).map(e=>Zc(e,uC)).getOr([]):t;return oe(o).map(e=>({element:e,others:o.slice(1)}))})(t):A.none(),gC=e=>{const t=[...V(e.others,Qo),on()];return((e,t)=>j(t,(e,t)=>tn(e,t),e))(Qo(e.element),t)},pC=(e,t,o)=>xi(e,t,o).isSome(),hC=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout(()=>{e.apply(null,n),o=null},t)}}},fC=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])},bC=(e,t)=>{const o={stopBackspace:!0,...t},n=(e=>{const t=sc(),o=Ms(!1),n=hC(t=>{e.triggerEvent(fr(),t),o.set(!0)},400),s=Is([{key:Ps(),value:e=>(fC(e).each(s=>{n.cancel();const r={x:s.clientX,y:s.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(r)}),A.none())},{key:Us(),value:e=>(n.cancel(),fC(e).each(e=>{t.on(o=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(e,o)&&t.clear()})}),A.none())},{key:Ws(),value:s=>(n.cancel(),t.get().filter(e=>et(e.target,s.target)).map(t=>o.get()?(s.prevent(),!1):e.triggerEvent(hr(),s)))}]);return{fireIfReady:(e,t)=>be(s,t).bind(t=>t(e))}})(o),s=V(["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=>ac(e,t,e=>{n.fireIfReady(e,t).each(t=>{t&&e.kill()}),o.triggerEvent(t,e)&&e.kill()})),r=sc(),a=ac(e,"paste",e=>{n.fireIfReady(e,"paste").each(t=>{t&&e.kill()}),o.triggerEvent("paste",e)&&e.kill(),r.set(setTimeout(()=>{o.triggerEvent(ur(),e)},0))}),i=ac(e,"keydown",e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===Jm[0]&&!R(["input","textarea"],We(e.target))&&!pC(e.target,'[contenteditable="true"]'))(e)&&e.prevent()}),l=ac(e,"focusin",e=>{o.triggerEvent("focusin",e)&&e.kill()}),c=sc(),d=ac(e,"focusout",e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout(()=>{o.triggerEvent(dr(),e)},0))});return{unbind:()=>{H(s,e=>{e.unbind()}),i.unbind(),l.unbind(),d.unbind(),a.unbind(),r.on(clearTimeout),c.on(clearTimeout)}}},vC=(e,t)=>{const o=be(e,"target").getOr(t);return Ms(o)},yC=Ds([{stopped:[]},{resume:["element"]},{complete:[]}]),xC=(e,t,o,n,s,r)=>{const a=e(t,n),i=((e,t)=>{const o=Ms(!1),n=Ms(!1);return{stop:()=>{o.set(!0)},cut:()=>{n.set(!0)},isStopped:o.get,isCut:n.get,event:e,setSource:t.set,getSource:t.get}})(o,s);return a.fold(()=>(r.logEventNoHandlers(t,n),yC.complete()),e=>{const o=e.descHandler;return Da(o)(i),i.isStopped()?(r.logEventStopped(t,e.element,o.purpose),yC.stopped()):i.isCut()?(r.logEventCut(t,e.element,o.purpose),yC.complete()):at(e.element).fold(()=>(r.logNoParent(t,e.element,o.purpose),yC.complete()),n=>(r.logEventResponse(t,e.element,o.purpose),yC.resume(n)))})},wC=(e,t,o,n,s,r)=>xC(e,t,o,n,s,r).fold(E,n=>wC(e,t,o,n,s,r),T),SC=(e,t,o,n,s)=>{const r=vC(o,n);return wC(e,t,o,n,r,s)},CC=()=>{const e=(()=>{const e={};return{registerId:(t,o,n)=>{le(n,(n,s)=>{const r=void 0!==e[s]?e[s]:{};r[o]=((e,t)=>({cHandler:C.apply(void 0,[e.handler].concat(t)),purpose:e.purpose}))(n,t),e[s]=r})},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=>Ns(n,t=>((e,t)=>fa(t).bind(t=>be(e,t)).map(e=>((e,t)=>({element:e,descHandler:t}))(t,e)))(e,t),t))}})(),t={},o=o=>{fa(o.element).each(o=>{delete t[o],e.unregisterId(o)})};return{find:(t,o,n)=>e.find(t,o,n),filter:t=>e.filterByType(t),register:n=>{const s=(e=>{const t=e.element;return fa(t).getOrThunk(()=>((e,t)=>{const o=da(ga+"uid-");return ha(t,o),o})(0,e.element))})(n);ye(t,s)&&((e,n)=>{const s=t[n];if(s!==e)throw new Error('The tagId "'+n+'" is already used by: '+ra(s.element)+"\nCannot use it for: "+ra(e.element)+"\nThe conflicting element is"+(wt(s.element)?" ":" not ")+"already in the DOM");o(e)})(n,s);const r=[n];e.registerId(r,s,n.events),t[s]=n},unregister:o,getById:e=>be(t,e)}},OC=wm({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:wu(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[ws("components",[]),xu("containerBehaviours",[]),ws("events",{}),ws("domModification",{}),ws("eventOrder",{})]}),kC=e=>{const t=t=>at(e.element).fold(E,e=>et(t,e)),o=CC(),n=(e,n)=>o.find(t,e,n),s=bC(e.element,{triggerEvent:(e,t)=>Ti(e,t.target,o=>((e,t,o,n)=>SC(e,t,o,o.target,n))(n,e,t,o))}),r={debugInfo:x("real"),triggerEvent:(e,t,o)=>{Ti(e,t,s=>SC(n,e,o,t,s))},triggerFocus:(e,t)=>{fa(e).fold(()=>{Nl(e)},o=>{Ti(cr(),e,o=>(((e,t,o,n,s)=>{const r=vC(o,n);xC(e,t,o,n,r,s)})(n,cr(),{originator:t,kill:b,prevent:b,target:e},e,o),!1))})},triggerEscape:(e,t)=>{r.triggerEvent("keydown",e.element,t.event)},getByUid:e=>p(e),getByDom:e=>h(e),build:di,buildOrPatch:ci,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{a(e)},removeFromWorld:e=>{i(e)},broadcast:e=>{u(e)},broadcastOn:(e,t)=>{m(e,t)},broadcastEvent:(e,t)=>{g(e,t)},isConnected:E},a=e=>{e.connect(r),qe(e.element)||(o.register(e),H(e.components(),a),r.triggerEvent(yr(),e.element,{target:e.element}))},i=e=>{qe(e.element)||(H(e.components(),i),o.unregister(e)),e.disconnect()},l=t=>{Fd(e,t)},c=e=>{zd(e)},d=e=>{const t=o.filter(mr());H(t,t=>{const o=t.descHandler;Da(o)(e)})},u=e=>{d({universal:!0,data:e})},m=(e,t)=>{d({universal:!1,channels:e,data:t})},g=(e,t)=>((e,t)=>{const o=(e=>{const t=Ms(!1);return{stop:()=>{t.set(!0)},cut:b,isStopped:t.get,isCut:T,event:e,setSource:k("Cannot set source of a broadcasted event"),getSource:k("Cannot get source of a broadcasted event")}})(t);return H(e,e=>{const t=e.descHandler;Da(t)(o)}),o.isStopped()})(o.filter(e),t),p=e=>o.getById(e).fold(()=>an.error(new Error('Could not find component with uid: "'+e+'" in system.')),an.value),h=e=>{const t=fa(e).getOr("not found");return p(t)};return a(e),{root:e,element:e.element,destroy:()=>{s.unbind(),Wo(e.element)},add:l,remove:c,getByUid:p,getByDom:h,addToWorld:a,removeFromWorld:i,broadcast:u,broadcastOn:m,broadcastEvent:g}},_C=x([ws("prefix","form-field"),xu("fieldBehaviours",[_m,yu])]),TC=x([Xu({schema:[ss("dom")],name:"label"}),Xu({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[ss("text")],name:"aria-descriptor"}),qu({factory:{sketch:e=>{const t=((e,t)=>{const o={};return le(e,(e,n)=>{R(t,n)||(o[n]=e)}),o})(e,["factory"]);return e.factory.sketch(t)}},schema:[ss("factory")],name:"field"})]),EC=Sm({name:"FormField",configFields:_C(),partFields:TC(),factory:(e,t,o,n)=>{const s=Su(e.fieldBehaviours,[_m.config({find:t=>im(t,e,"field")}),yu.config({store:{mode:"manual",getValue:e=>_m.getCurrent(e).bind(yu.getValue),setValue:(e,t)=>{_m.getCurrent(e).each(e=>{yu.setValue(e,t)})}}})]),r=Pr([Zr((t,o)=>{const n=cm(t,e,["label","field","aria-descriptor"]);n.field().each(t=>{const o=da(e.prefix);n.label().each(e=>{kt(e.element,"for",o),kt(t.element,"id",o)}),n["aria-descriptor"]().each(o=>{const n=da(e.prefix);kt(o.element,"id",n),kt(t.element,"aria-describedby",n)})})})]),a={getField:t=>im(t,e,"field"),getLabel:t=>im(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:s,events:r,apis:a}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}});var AC=Object.freeze({__proto__:null,exhibit:(e,t)=>Ma({attributes:Is([{key:t.tabAttr,value:"true"}])})}),MC=[ws("tabAttr","data-alloy-tabstop")];const DC=Ml({fields:MC,name:"tabstopping",active:AC});var BC=tinymce.util.Tools.resolve("tinymce.html.Entities");const IC=(e,t,o,n)=>{const s=FC(e,t,o,n);return EC.sketch(s)},FC=(e,t,o,n)=>({dom:RC(o),components:e.toArray().concat([t]),fieldBehaviours:El(n)}),RC=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),NC=(e,t,o)=>{const n={dom:{tag:"label",classes:["tox-label"]},components:[ai(o.translate(e))]};if(""===t.trim())return EC.parts.label(n);const s={dom:{tag:"div",classes:["tox-label-tooltip"]},components:[bb("tooltip",{tag:"span",classes:["tox-icon","tox-label-tooltip-icon"]},o.icons)],behaviours:El([Nx.config(o.tooltips.getConfig({tooltipText:o.translate(t)}))])};return EC.parts.label({dom:{tag:"div",classes:["tox-form__label-container"]},components:[n,s]})},zC=da("form-component-change"),LC=da("form-close"),VC=da("form-cancel"),HC=da("form-action"),PC=da("form-submit"),UC=da("form-block"),WC=da("form-unblock"),jC=da("form-tabchange"),GC=da("form-resize"),$C=(e,t,o)=>{const n=e.label.map(o=>NC(o,e.tooltip.getOr(""),t)),s=t.icons(),r=e=>(t,o)=>{xi(o.event.target,"[data-collection-item-value]").each(n=>{e(t,o,n,Tt(n,"data-collection-item-value"))})},a=r((o,n,s,r)=>{n.stop(),t.isDisabled()||Nr(o,HC,{name:e.name,value:r})}),i=[jr(Xs(),r((e,t,o)=>{Nl(o)})),jr(or(),a),jr(hr(),a),jr(Ks(),r((e,t,o)=>{yi(e.element,"."+Hv).each(e=>{$a(e,Hv)}),ja(o,Hv)})),jr(Js(),r(e=>{yi(e.element,"."+Hv).each(e=>{$a(e,Hv),zl(e)})})),ta(r((t,o,n,s)=>{Nr(t,HC,{name:e.name,value:s})}))],l=(e,t)=>V(Qc(e.element,".tox-collection__item"),t),c=EC.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:w},behaviours:El([Hm.config({disabled:t.isDisabled,onDisabled:e=>{l(e,e=>{ja(e,"tox-collection__item--state-disabled"),kt(e,"aria-disabled",!0)})},onEnabled:e=>{l(e,e=>{$a(e,"tox-collection__item--state-disabled"),Mt(e,"aria-disabled")})}}),Px(),th.config({}),Nx.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{yi(e.element,"."+Hv+"[data-mce-tooltip]").each(o=>{Et(o,"data-mce-tooltip").each(o=>{Nx.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-keyboard-focus",anchor:e=>({type:"node",node:yi(e.element,"."+Hv).orThunk(()=>Qe(".tox-collection__item")),root:e.element,layouts:{onLtr:x([pl,gl,cl,ul,dl,ml]),onRtl:x([pl,gl,cl,ul,dl,ml])},bubble:vc(0,-2,{})})}),yu.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(o,n)=>{((o,n)=>{const r=V(n,o=>{const n=lb.translate(o.text),r=1===e.columns?`<div class="tox-collection__item-label">${n}</div>`:"",a=`<div class="tox-collection__item-icon">${(e=>{var t;return null!==(t=s[e])&&void 0!==t?t:e})(o.icon)}</div>`,i={_:" "," - ":" ","-":" "},l=n.replace(/\_| \- |\-/g,e=>i[e]);return`<div data-mce-tooltip="${l}" class="tox-collection__item${t.isDisabled()?" tox-collection__item--state-disabled":""}" tabindex="-1" data-collection-item-value="${BC.encodeAllRaw(o.value)}" aria-label="${l}">${a}${r}</div>`}),a="auto"!==e.columns&&e.columns>1?L(r,e.columns):[r],i=V(a,e=>`<div class="tox-collection__group">${e.join("")}</div>`);na(o.element,i.join(""))})(o,n),"auto"===e.columns&&Ox(o,5,"tox-collection__item").each(({numRows:e,numColumns:t})=>{$p.setGridSize(o,e,t)}),Rr(o,GC)}}),DC.config({}),$p.config((d=e.columns,1===d?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===d?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:".tox-collection__group",cell:`.${Iv}`}})),oh("collection-events",i)]),eventOrder:{[gr()]:["disabling","alloy.base.behaviour","collection-events"],[Ks()]:["collection-events","tooltipping"]}});var d;return IC(n,c,["tox-form__group--collection"],[])},qC=["input","textarea"],YC=e=>{const t=We(e);return R(qC,t)},XC=(e,t)=>{const o=t.getRoot(e).getOr(e.element);$a(o,t.invalidClass),t.notify.each(t=>{YC(e.element)&&kt(e.element,"aria-invalid",!1),t.getContainer(e).each(e=>{na(e,t.validHtml)}),t.onValid(e)})},KC=(e,t,o,n)=>{const s=t.getRoot(e).getOr(e.element);ja(s,t.invalidClass),t.notify.each(t=>{YC(e.element)&&kt(e.element,"aria-invalid",!0),t.getContainer(e).each(e=>{na(e,n)}),t.onInvalid(e,n)})},JC=(e,t,o)=>t.validator.fold(()=>LS(an.value(!0)),t=>t.validate(e)),ZC=(e,t,o)=>(t.notify.each(t=>{t.onValidate(e)}),JC(e,t).map(o=>e.getSystem().isConnected()?o.fold(o=>(KC(e,t,0,o),an.error(o)),o=>(XC(e,t),an.value(o))):an.error("No longer in system")));var QC=Object.freeze({__proto__:null,markValid:XC,markInvalid:KC,query:JC,run:ZC,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return qa(o,t.invalidClass)}}),eO=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map(t=>Pr([jr(t.onEvent,t=>{ZC(t,e).get(w)})].concat(t.validateOnLoad?[Zr(t=>{ZC(t,e).get(b)})]:[]))).getOr({})}),tO=[ss("invalidClass"),ws("getRoot",A.none),xs("notify",[ws("aria","alert"),ws("getContainer",A.none),ws("validHtml",""),Ni("onValid"),Ni("onInvalid"),Ni("onValidate")]),xs("validator",[ss("validate"),ws("onEvent","input"),ws("validateOnLoad",!0)])];const oO=Ml({fields:tO,name:"invalidating",active:eO,apis:QC,extra:{validation:e=>t=>{const o=yu.getValue(t);return LS(e(o))}}}),nO=Ml({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>Pr([Ur(ar(),E)]),exhibit:()=>Ma({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),sO=da("color-input-change"),rO=da("color-swatch-change"),aO=da("color-picker-cancel"),iO=Xu({schema:[ss("dom")],name:"label"}),lO=e=>Xu({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold(()=>({}),e=>({events:Pr([Gr(Ps(),(t,o,n)=>e(t,n),[t]),Gr(Gs(),(t,o,n)=>e(t,n),[t]),Gr($s(),(t,o,n)=>{n.mouseIsDown.get()&&e(t,n)},[t])])}))}),cO=lO("top-left"),dO=lO("top"),uO=lO("top-right"),mO=lO("right"),gO=lO("bottom-right"),pO=lO("bottom"),hO=lO("bottom-left"),fO=lO("left"),bO=qu({name:"thumb",defaults:x({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:Pr([qr(Ps(),e,"spectrum"),qr(Us(),e,"spectrum"),qr(Ws(),e,"spectrum"),qr(Gs(),e,"spectrum"),qr($s(),e,"spectrum"),qr(Ys(),e,"spectrum")])})}),vO=e=>mg(e.event);var yO=[iO,fO,mO,dO,pO,cO,uO,hO,gO,bO,qu({schema:[os("mouseIsDown",()=>Ms(!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:El([$p.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,vO(n)),onRight:(o,n)=>t.onRight(o,e,vO(n)),onUp:(o,n)=>t.onUp(o,e,vO(n)),onDown:(o,n)=>t.onDown(o,e,vO(n))}),DC.config({}),ih.config({})]),events:Pr([jr(Ps(),o),jr(Us(),o),jr(Gs(),o),jr($s(),(t,n)=>{e.mouseIsDown.get()&&o(t,n)})])}}})];const xO=x("slider.change.value"),wO=e=>{const t=e.event.raw;if((e=>-1!==e.type.indexOf("touch"))(t)){const e=t;return void 0!==e.touches&&1===e.touches.length?A.some(e.touches[0]).map(e=>Yt(e.clientX,e.clientY)):A.none()}{const e=t;return void 0!==e.clientX?A.some(e).map(e=>Yt(e.clientX,e.clientY)):A.none()}},SO=e=>e.model.minX,CO=e=>e.model.minY,OO=e=>e.model.minX-1,kO=e=>e.model.minY-1,_O=e=>e.model.maxX,TO=e=>e.model.maxY,EO=e=>e.model.maxX+1,AO=e=>e.model.maxY+1,MO=(e,t,o)=>t(e)-o(e),DO=e=>MO(e,_O,SO),BO=e=>MO(e,TO,CO),IO=e=>DO(e)/2,FO=e=>BO(e)/2,RO=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,NO=e=>e.snapToGrid,zO=e=>e.snapStart,LO=e=>e.rounded,VO=(e,t)=>void 0!==e[t+"-edge"],HO=e=>VO(e,"left"),PO=e=>VO(e,"right"),UO=e=>VO(e,"top"),WO=e=>VO(e,"bottom"),jO=e=>e.model.value.get(),GO=(e,t)=>({x:e,y:t}),$O=(e,t)=>{Nr(e,xO(),{value:t})},qO=(e,t,o,n)=>e<t?e:e>o?o:e===t?t-1:Math.max(t,e-n),YO=(e,t,o,n)=>e>o?e:e<t?t:e===o?o+1:Math.min(o,e+n),XO=(e,t,o)=>Math.max(t,Math.min(o,e)),KO=e=>{const{min:t,max:o,range:n,value:s,step:r,snap:a,snapStart:i,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:u,maxBound:m,screenRange:g}=e,p=c?t-1:t,h=d?o+1:o;if(s<u)return p;if(s>m)return h;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(s,u,m),c=XO(e/g*n+t,p,h);return a&&c>=t&&c<=o?((e,t,o,n,s)=>s.fold(()=>{const s=e-t,r=Math.round(s/n)*n;return XO(t+r,t-1,o+1)},t=>{const s=(e-t)%n,r=Math.round(s/n),a=Math.floor((e-t)/n),i=Math.floor((o-t)/n),l=t+Math.min(i,a+r)*n;return Math.max(t,l)}))(c,t,o,r,i):l?Math.round(c):c}},JO=e=>{const{min:t,max:o,range:n,value:s,hasMinEdge:r,hasMaxEdge:a,maxBound:i,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return s<t?r?0:c:s>o?a?i:d:(s-t)/n*l},ZO="top",QO="right",ek="bottom",tk="left",ok=e=>e.element.dom.getBoundingClientRect(),nk=(e,t)=>e[t],sk=e=>{const t=ok(e);return nk(t,tk)},rk=e=>{const t=ok(e);return nk(t,QO)},ak=e=>{const t=ok(e);return nk(t,ZO)},ik=e=>{const t=ok(e);return nk(t,ek)},lk=e=>{const t=ok(e);return nk(t,"width")},ck=e=>{const t=ok(e);return nk(t,"height")},dk=(e,t,o)=>(e+t)/2-o,uk=(e,t)=>{const o=ok(e),n=ok(t),s=nk(o,tk),r=nk(o,QO),a=nk(n,tk);return dk(s,r,a)},mk=(e,t)=>{const o=ok(e),n=ok(t),s=nk(o,ZO),r=nk(o,ek),a=nk(n,ZO);return dk(s,r,a)},gk=(e,t)=>{Nr(e,xO(),{value:t})},pk=(e,t,o)=>{const n={min:SO(t),max:_O(t),range:DO(t),value:o,step:RO(t),snap:NO(t),snapStart:zO(t),rounded:LO(t),hasMinEdge:HO(t),hasMaxEdge:PO(t),minBound:sk(e),maxBound:rk(e),screenRange:lk(e)};return KO(n)},hk=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?YO:qO)(jO(o),SO(o),_O(o),RO(o,n));return gk(t,s),A.some(s)})(e,t,o,n).map(E),fk=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=lk(e),a=n.bind(t=>A.some(uk(t,e))).getOr(0),i=s.bind(t=>A.some(uk(t,e))).getOr(r),l={min:SO(t),max:_O(t),range:DO(t),value:o,hasMinEdge:HO(t),hasMaxEdge:PO(t),minBound:sk(e),minOffset:0,maxBound:rk(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return JO(l)})(t,r,o,n,s);return sk(t)-sk(e)+a},bk=hk(-1),vk=hk(1),yk=A.none,xk=A.none,wk={"top-left":A.none(),top:A.none(),"top-right":A.none(),right:A.some((e,t)=>{$O(e,EO(t))}),"bottom-right":A.none(),bottom:A.none(),"bottom-left":A.none(),left:A.some((e,t)=>{$O(e,OO(t))})};var Sk=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=pk(e,t,o);return gk(e,n),n},setToMin:(e,t)=>{const o=SO(t);gk(e,o)},setToMax:(e,t)=>{const o=_O(t);gk(e,o)},findValueOfOffset:pk,getValueFromEvent:e=>wO(e).map(e=>e.left),findPositionOfValue:fk,setPositionFromValue:(e,t,o,n)=>{const s=jO(o),r=fk(e,n.getSpectrum(e),s,n.getLeftEdge(e),n.getRightEdge(e),o),a=Qt(t.element)/2;It(t.element,"left",r-a+"px")},onLeft:bk,onRight:vk,onUp:yk,onDown:xk,edgeActions:wk});const Ck=(e,t)=>{Nr(e,xO(),{value:t})},Ok=(e,t,o)=>{const n={min:CO(t),max:TO(t),range:BO(t),value:o,step:RO(t),snap:NO(t),snapStart:zO(t),rounded:LO(t),hasMinEdge:UO(t),hasMaxEdge:WO(t),minBound:ak(e),maxBound:ik(e),screenRange:ck(e)};return KO(n)},kk=e=>(t,o,n)=>((e,t,o,n)=>{const s=(e>0?YO:qO)(jO(o),CO(o),TO(o),RO(o,n));return Ck(t,s),A.some(s)})(e,t,o,n).map(E),_k=(e,t,o,n,s,r)=>{const a=((e,t,o,n,s)=>{const r=ck(e),a=n.bind(t=>A.some(mk(t,e))).getOr(0),i=s.bind(t=>A.some(mk(t,e))).getOr(r),l={min:CO(t),max:TO(t),range:BO(t),value:o,hasMinEdge:UO(t),hasMaxEdge:WO(t),minBound:ak(e),minOffset:0,maxBound:ik(e),maxOffset:r,centerMinEdge:a,centerMaxEdge:i};return JO(l)})(t,r,o,n,s);return ak(t)-ak(e)+a},Tk=A.none,Ek=A.none,Ak=kk(-1),Mk=kk(1),Dk={"top-left":A.none(),top:A.some((e,t)=>{$O(e,kO(t))}),"top-right":A.none(),right:A.none(),"bottom-right":A.none(),bottom:A.some((e,t)=>{$O(e,AO(t))}),"bottom-left":A.none(),left:A.none()};var Bk=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=Ok(e,t,o);return Ck(e,n),n},setToMin:(e,t)=>{const o=CO(t);Ck(e,o)},setToMax:(e,t)=>{const o=TO(t);Ck(e,o)},findValueOfOffset:Ok,getValueFromEvent:e=>wO(e).map(e=>e.top),findPositionOfValue:_k,setPositionFromValue:(e,t,o,n)=>{const s=jO(o),r=_k(e,n.getSpectrum(e),s,n.getTopEdge(e),n.getBottomEdge(e),o),a=Gt(t.element)/2;It(t.element,"top",r-a+"px")},onLeft:Tk,onRight:Ek,onUp:Ak,onDown:Mk,edgeActions:Dk});const Ik=(e,t)=>{Nr(e,xO(),{value:t})},Fk=(e,t)=>({x:e,y:t}),Rk=(e,t)=>(o,n,s)=>((e,t,o,n,s)=>{const r=e>0?YO:qO,a=t?jO(n).x:r(jO(n).x,SO(n),_O(n),RO(n,s)),i=t?r(jO(n).y,CO(n),TO(n),RO(n,s)):jO(n).y;return Ik(o,Fk(a,i)),A.some(a)})(e,t,o,n,s).map(E),Nk=Rk(-1,!1),zk=Rk(1,!1),Lk=Rk(-1,!0),Vk=Rk(1,!0),Hk={"top-left":A.some((e,t)=>{$O(e,GO(OO(t),kO(t)))}),top:A.some((e,t)=>{$O(e,GO(IO(t),kO(t)))}),"top-right":A.some((e,t)=>{$O(e,GO(EO(t),kO(t)))}),right:A.some((e,t)=>{$O(e,GO(EO(t),FO(t)))}),"bottom-right":A.some((e,t)=>{$O(e,GO(EO(t),AO(t)))}),bottom:A.some((e,t)=>{$O(e,GO(IO(t),AO(t)))}),"bottom-left":A.some((e,t)=>{$O(e,GO(OO(t),AO(t)))}),left:A.some((e,t)=>{$O(e,GO(OO(t),FO(t)))})};var Pk=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=pk(e,t,o.left),s=Ok(e,t,o.top),r=Fk(n,s);return Ik(e,r),r},setToMin:(e,t)=>{const o=SO(t),n=CO(t);Ik(e,Fk(o,n))},setToMax:(e,t)=>{const o=_O(t),n=TO(t);Ik(e,Fk(o,n))},getValueFromEvent:e=>wO(e),setPositionFromValue:(e,t,o,n)=>{const s=jO(o),r=fk(e,n.getSpectrum(e),s.x,n.getLeftEdge(e),n.getRightEdge(e),o),a=_k(e,n.getSpectrum(e),s.y,n.getTopEdge(e),n.getBottomEdge(e),o),i=Qt(t.element)/2,l=Gt(t.element)/2;It(t.element,"left",r-i+"px"),It(t.element,"top",a-l+"px")},onLeft:Nk,onRight:zk,onUp:Lk,onDown:Vk,edgeActions:Hk});const Uk=Sm({name:"Slider",configFields:[ws("stepSize",1),ws("speedMultiplier",10),ws("onChange",b),ws("onChoose",b),ws("onInit",b),ws("onDragStart",b),ws("onDragEnd",b),ws("snapToGrid",!1),ws("rounded",!0),gs("snapStart"),rs("model",Qn("mode",{x:[ws("minX",0),ws("maxX",100),os("value",e=>Ms(e.mode.minX)),ss("getInitialValue"),Hi("manager",Sk)],y:[ws("minY",0),ws("maxY",100),os("value",e=>Ms(e.mode.minY)),ss("getInitialValue"),Hi("manager",Bk)],xy:[ws("minX",0),ws("maxX",100),ws("minY",0),ws("maxY",100),os("value",e=>Ms({x:e.mode.minX,y:e.mode.minY})),ss("getInitialValue"),Hi("manager",Pk)]})),xu("sliderBehaviours",[$p,yu]),os("mouseIsDown",()=>Ms(!1))],partFields:yO,factory:(e,t,o,n)=>{const s=t=>lm(t,e,"thumb"),r=t=>lm(t,e,"spectrum"),a=t=>im(t,e,"left-edge"),i=t=>im(t,e,"right-edge"),l=t=>im(t,e,"top-edge"),c=t=>im(t,e,"bottom-edge"),d=e.model,u=d.manager,m=(t,o)=>{u.setPositionFromValue(t,o,e,{getLeftEdge:a,getRightEdge:i,getTopEdge:l,getBottomEdge:c,getSpectrum:r})},g=(e,t)=>{d.value.set(t);const o=s(e);m(e,o)},p=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&im(t,e,"thumb").each(o=>{const n=d.value.get();e.onChoose(t,o,n)})},h=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,s(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,s(t)),p(t)},b=t=>{im(t,e,"spectrum").map($p.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.sliderBehaviours,[$p.config({mode:"special",focusIn:b}),yu.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:g}}),Fl.config({channels:{[ou()]:{onReceive:p}}})]),events:Pr([jr(xO(),(t,o)=>{((t,o)=>{g(t,o);const n=s(t);e.onChange(t,n,o),A.some(!0)})(t,o.event.value)}),Zr((t,o)=>{const n=d.getInitialValue();d.value.set(n);const a=s(t);m(t,a);const i=r(t);e.onInit(t,a,i,d.value.get())}),jr(Ps(),h),jr(Ws(),f),jr(Gs(),(e,t)=>{b(e),h(e,t)}),jr(Ys(),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)}}}),Wk=da("rgb-hex-update"),jk=da("slider-update"),Gk=da("palette-update"),$k="form",qk=[xu("formBehaviours",[yu])],Yk=e=>"<alloy.field."+e+">",Xk=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.formBehaviours,[yu.config({store:{mode:"manual",getValue:t=>{const o=dm(t,e);return ce(o,(e,t)=>e().bind(e=>{return o=_m.getCurrent(e),n=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+ra(e.element)),o.fold(()=>an.error(n),an.value);var o,n}).map(yu.getValue))},setValue:(t,o)=>{le(o,(o,n)=>{im(t,e,n).each(e=>{_m.getCurrent(e).each(e=>{yu.setValue(e,o)})})})}}})]),apis:{getField:(t,o)=>im(t,e,o).bind(_m.getCurrent)}}),Kk={getField:_a((e,t,o)=>e.getField(t,o)),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),om($k,Yk(t),o)),record:x(e)}})(),o=e(t),n=t.record(),s=V(n,e=>qu({name:e,pname:Yk(e)}));return bm($k,qk,s,Xk,o)}},Jk=da("valid-input"),Zk=da("invalid-input"),Qk=da("validating-input"),e_="colorcustom.rgb.",t_=(e,t,o,n)=>{const s=(o,n)=>oO.config({invalidClass:t("invalid"),notify:{onValidate:e=>{Nr(e,Qk,{type:o})},onValid:e=>{Nr(e,Jk,{type:o,value:yu.getValue(e)})},onInvalid:e=>{Nr(e,Zk,{type:o,value:yu.getValue(e)})}},validator:{validate:t=>{const o=yu.getValue(t),s=n(o)?an.value(!0):an.error(e("aria.input.invalid"));return LS(s)},validateOnLoad:!1}}),r=(o,n,r,a,i)=>{const l=e(e_+"range"),c=EC.parts.label({dom:{tag:"label",attributes:{"aria-label":a}},components:[ai(r)]}),d=EC.parts.field({data:i,factory:ey,inputAttributes:{type:"text",..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:El([s(n,o),DC.config({})]),onSetValue:e=>{oO.isInvalid(e)&&oO.run(e).get(b)}}),u=[c,d],m="hex"!==n?[EC.parts["aria-descriptor"]({text:l})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:u.concat(m)}},a=(e,t)=>{const o=t.red,n=t.green,s=t.blue;yu.setValue(e,{red:o,green:n,blue:s})},i=Jh({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),l=(e,t)=>{i.getOpt(e).each(e=>{It(e.element,"background-color","#"+t.value)})},c=wm({factory:()=>{const s={red:Ms(A.some(255)),green:Ms(A.some(255)),blue:Ms(A.some(255)),hex:Ms(A.some("ffffff"))},c=e=>s[e].get(),d=(e,t)=>{s[e].set(t)},u=e=>{const t=e.red,o=e.green,n=e.blue;d("red",A.some(t)),d("green",A.some(o)),d("blue",A.some(n))},m=(e,t)=>{const o=t.event;"hex"!==o.type?d(o.type,A.none()):n(e)},g=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=mw(t);d("hex",A.some(n.value));const s=Tw(n);a(e,s),u(s),Nr(e,Wk,{hex:n}),l(e,n)})(e,n.value):((e,t,o)=>{const n=parseInt(o,10);d(t,A.some(n)),c("red").bind(e=>c("green").bind(t=>c("blue").map(o=>Ow(e,t,o,1)))).each(t=>{const o=((e,t)=>{const o=vw(t);return Kk.getField(e,"hex").each(t=>{ih.isFocused(t)||yu.setValue(e,{hex:o.value})}),o})(e,t);Nr(e,Wk,{hex:o}),l(e,o)})})(e,n.type,n.value)},p=t=>({label:e(e_+t+".label"),description:e(e_+t+".description")}),h=p("red"),f=p("green"),b=p("blue"),v=p("hex");return vn(Kk.sketch(o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",EC.sketch(r(kw,"red",h.label,h.description,255))),o.field("green",EC.sketch(r(kw,"green",f.label,f.description,255))),o.field("blue",EC.sketch(r(kw,"blue",b.label,b.description,255))),o.field("hex",EC.sketch(r(hw,"hex",v.label,v.description,"ffffff"))),i.asSpec()],formBehaviours:El([oO.config({invalidClass:t("form-invalid")}),oh("rgb-form-events",[jr(Jk,g),jr(Zk,m),jr(Qk,m)])])})),{apis:{updateHex:(e,t)=>{yu.setValue(e,{hex:t.value}),((e,t)=>{const o=Tw(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},o_=(e,t)=>{const o=wm({name:"ColourPicker",configFields:[ss("dom"),ws("onValidHex",b),ws("onInvalidHex",b)],factory:o=>{const n=t_(e,t,o.onValidHex,o.onInvalidHex),s=((e,t)=>{const o=Uk.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=Uk.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:`<div class=${t("sv-palette-inner-thumb")} role="presentation"></div>`}}),s=(e,t)=>{const{width:o,height:n}=e,s=e.getContext("2d");if(null===s)return;s.fillStyle=t,s.fillRect(0,0,o,n);const r=s.createLinearGradient(0,0,o,0);r.addColorStop(0,"rgba(255,255,255,1)"),r.addColorStop(1,"rgba(255,255,255,0)"),s.fillStyle=r,s.fillRect(0,0,o,n);const a=s.createLinearGradient(0,0,0,n);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),s.fillStyle=a,s.fillRect(0,0,o,n)};return wm({factory:r=>{const a=x({x:0,y:0}),i=El([_m.config({find:A.some}),ih.config({})]);return Uk.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)])),Nr(t,Gk,{value:n})},onInit:(e,t,o,n)=>{s(o.element.dom,Mw(Dw))},sliderBehaviours:i})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=Gw(t,100,100),r=_w(n);s(o,Mw(r))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=$w(Tw(o));Uk.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:{}})})(e,t),r={paletteRgba:Ms(Dw),paletteHue:Ms(0)},a=Jh(((e,t)=>{const o=Uk.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=Uk.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return Uk.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:El([ih.config({})]),onChange:(e,t,o)=>{kt(e.element,"aria-valuenow",Math.floor(360-3.6*o)),Nr(e,jk,{value:o})}})})(0,t)),i=Jh(s.sketch({})),l=Jh(n.sketch({})),c=(e,t,o)=>{i.getOpt(e).each(e=>{s.setHue(e,o)})},d=(e,t)=>{l.getOpt(e).each(e=>{n.updateHex(e,t)})},u=(e,t,o)=>{a.getOpt(e).each(e=>{Uk.setValue(e,(e=>100-e/360*100)(o))})},m=(e,t)=>{i.getOpt(e).each(e=>{s.setThumb(e,t)})},g=(e,t,o,n)=>{((e,t)=>{const o=Tw(e);r.paletteRgba.set(o),r.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:El([oh("colour-picker-events",[jr(Wk,(()=>{const e=[c,u,m];return(t,o)=>{const n=o.event.hex,s=(e=>$w(Tw(e)))(n);g(t,n,s.hue,e)}})()),jr(Gk,(()=>{const e=[d];return(t,o)=>{const n=o.event.value,s=r.paletteHue.get(),a=Gw(s,n.x,100-n.y),i=qw(a);g(t,i,s,e)}})()),jr(jk,(()=>{const e=[c,d];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),s=r.paletteRgba.get(),a=$w(s),i=Gw(n,a.saturation,a.value),l=qw(i);g(t,l,n,e)}})())]),_m.config({find:e=>l.getOpt(e)}),$p.config({mode:"acyclic"})])}}});return o},n_=()=>_m.config({find:A.some}),s_=e=>_m.config({find:t=>dt(t.element,e).bind(e=>t.getSystem().getByDom(e).toOptional())}),r_=In([ws("preprocess",w),ws("postprocess",w)]),a_=(e,t)=>{const o=Jn("RepresentingConfigs.memento processors",r_,t);return yu.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),s=yu.getValue(n);return o.postprocess(s)},setValue:(t,n)=>{const s=o.preprocess(n),r=e.get(t);yu.setValue(r,s)}}})},i_=(e,t,o)=>yu.config({store:{mode:"manual",...e.map(e=>({initialValue:e})).getOr({}),getValue:t,setValue:o}}),l_=(e,t,o)=>i_(e,e=>t(e.element),(e,t)=>o(e.element,t)),c_=e=>yu.config({store:{mode:"memory",initialValue:e}}),d_={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red component","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green component","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue component","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"};var u_=tinymce.util.Tools.resolve("tinymce.Resource");const m_=e=>ve(e,"init");var g_=tinymce.util.Tools.resolve("tinymce.util.Tools");const p_=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...s)=>{n(),o=setTimeout(()=>{o=null,e.apply(null,s)},t)}}},h_=da("alloy-fake-before-tabstop"),f_=da("alloy-fake-after-tabstop"),b_=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:El([ih.config({ignore:!0}),DC.config({})])}),v_=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[b_([h_]),t,b_([f_])],behaviours:El([s_(1)])}),y_=(e,t)=>{Nr(e,Zs(),{raw:{which:9,shiftKey:t}})},x_=(e,t)=>{const o=t.element;qa(o,h_)?y_(e,!0):qa(o,f_)&&y_(e,!1)},w_=e=>pC(e,["."+h_,"."+f_].join(","),T),S_=da("update-dialog"),C_=da("update-title"),O_=da("update-body"),k_=da("update-footer"),__=da("body-send-message"),T_=da("dialog-focus-shifted"),E_=Io().browser,A_=E_.isSafari(),M_=E_.isFirefox(),D_=A_||M_,B_=E_.isChromium(),I_=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,F_=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),R_=(e,t,o)=>{const n=e.dom;A.from(n.contentDocument).fold(o,e=>{let o=0;const s=((e,t)=>{const o=e.body;return A.from(!/^<!DOCTYPE (html|HTML)/.test(t)&&(!B_&&!A_||g(o)&&(0!==o.scrollTop||Math.abs(o.scrollHeight-o.clientHeight)>1))?o:e.documentElement)})(e,t).map(e=>(o=e.scrollTop,e)).forall(I_),r=()=>{const e=n.contentWindow;g(e)&&(s?F_(e,"bottom"):!s&&D_&&0!==o&&F_(e,o))};A_&&n.addEventListener("load",r,{once:!0}),e.open(),e.write(t),e.close(),A_||r()})},N_=Oe(D_,A_?500:200).map(e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...s)=>{n=s,c(o)&&(o=setTimeout(()=>{const t=n;o=null,n=null,e.apply(null,t)},t))}}})(R_,e)),z_=da("toolbar.button.execute"),L_=da("common-button-display-events"),V_={[gr()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[Or()]:["toolbar-button-events",L_],[kr()]:["toolbar-button-events","dropdown-events","tooltipping"],[Gs()]:["focusing","alloy.base.behaviour",L_]},H_=e=>It(e.element,"width",Nt(e.element,"width")),P_=(e,t,o)=>bb(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),U_=(e,t)=>P_(e,t,[]),W_=(e,t)=>P_(e,t,[th.config({})]),j_=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[ai(o.translate(e))],behaviours:El([th.config({})])}),G_=da("update-menu-text"),$_=da("update-menu-icon"),q_=(e,t,o,n)=>{const s=Ms(b),r=e.text.map(e=>Jh(j_(e,t,o.providers))),a=e.icon.map(e=>Jh(W_(e,o.providers.icons))),i=(e,t)=>{const o=yu.getValue(e);return ih.focus(o),Nr(o,"keydown",{raw:t.event.raw}),ZS.close(o),A.some(!0)},l=e.role.fold(()=>({}),e=>({role:e})),c=e.ariaLabel.fold(()=>({}),e=>({"aria-label":o.providers.translate(e)})),d=bb("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),u=da("common-button-display-events"),m="dropdown-events",p=Jh(ZS.sketch({...e.uid?{uid:e.uid}:{},...l,dom:{tag:"button",classes:[t,`${t}--select`].concat(V(e.classes,e=>`${t}--${e}`)),attributes:{...c,...g(n)?{"data-mce-name":n}:{}}},components:Kx([a.map(e=>e.asSpec()),r.map(e=>e.asSpec()),A.some(d)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{ry(e).each(e=>ih.focus(e))})(n)},dropdownBehaviours:El([...e.dropdownBehaviours,Ux(()=>e.disabled||o.providers.isDisabled()),Px(),nO.config({}),th.config({}),...e.tooltip.map(e=>Nx.config(o.providers.tooltips.getConfig({tooltipText:o.providers.translate(e)}))).toArray(),oh(m,[$x(e,s),qx(e,s)]),oh(u,[Zr((e,t)=>H_(e))]),oh("menubutton-update-display-text",[jr(G_,(e,t)=>{r.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[ai(o.providers.translate(t.event.text))])})}),jr($_,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[W_(t.event.icon,o.providers.icons)])})})])]),eventOrder:vn(V_,{[Gs()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[Or()]:["toolbar-button-events",Nx.name(),m,u]}),sandboxBehaviours:El([$p.config({mode:"special",onLeft:i,onRight:i}),oh("dropdown-sandbox-events",[jr(ty,(e,t)=>{(e=>{const t=yu.getValue(e),o=sy(e).map(ay);ZS.refetch(t).get(()=>{const e=BS.getCoupled(t,"sandbox");o.each(t=>sy(e).each(e=>((e,t)=>{yu.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))})})(e),t.stop()}),jr(oy,(e,t)=>{((e,t)=>{(e=>Qd.getState(e).bind(Km.getHighlighted).bind(Km.getHighlighted))(e).each(o=>{((e,t,o,n)=>{const s={...n,target:t};e.getSystem().triggerEvent(o,t,s)})(e,o.element,t.event.eventType,t.event.interactionEvent)})})(e,t),t.stop()})])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...Xv(0,e.columns,e.presets),fakeFocus:e.searchable,onHighlightItem:QS,onCollapseMenu:(e,t,o)=>{Km.getHighlighted(o).each(t=>{QS(e,o,t)})},onDehighlightItem:eC}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{gc()(e,t-10)}}),fetch:t=>zS(C(e.fetch,t))}));return p.asSpec()},Y_=e=>"separator"===e.type,X_={type:"separator"},K_=(e,t)=>{const o=((e,t)=>{const o=j(e,(e,o)=>(e=>r(e))(o)?""===o?e:"|"===o?e.length>0&&!Y_(e[e.length-1])?e.concat([X_]):e:ve(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o]),[]);return o.length>0&&Y_(o[o.length-1])&&o.pop(),o})(r(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(()=>da("generated-menu-item"));return vn({value:t},e)})(o),s=((e,t)=>{const o=e.getSubmenuItems(),n=K_(o,t);return{item:e,menus:vn(n.menus,{[e.value]:n.items}),expansions:vn(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:vn(e.menus,s.menus),items:[s.item,...e.items],expansions:vn(e.expansions,s.expansions)}}return{...e,items:[o,...e.items]}},{menus:{},expansions:{},items:[]})},J_=(e,t,o,n)=>{const s=da("primary-menu"),r=K_(e,o.shared.providers.menuItems());if(0===r.items.length)return A.none();const a=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-field",placeholder:e.placeholder})))(n),i=rC(s,r.items,t,o,n.isHorizontalMenu,a),l=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-results"})))(n),c=ce(r.menus,(e,n)=>rC(n,e,t,o,!1,l)),d=vn(c,Bs(s,i));return A.from($h.tieredData(s,d,r.expansions))},Z_=e=>!ve(e,"items"),Q_="data-value",eT=(e,t,o,n)=>V(o,o=>Z_(o)?{type:"togglemenuitem",text:o.text,value:o.value,active:o.value===n,onAction:()=>{yu.setValue(e,o.value),Nr(e,zC,{name:t}),ih.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>eT(e,t,o.items,n)}),tT=(e,t)=>re(e,e=>Z_(e)?Oe(e.value===t,e):tT(e.items,t)),oT=wm({name:"HtmlSelect",configFields:[ss("options"),xu("selectBehaviours",[ih,yu]),ws("selectClasses",[]),ws("selectAttributes",{}),gs("data")],factory:(e,t)=>{const o=V(e.options,e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}})),n=e.data.map(e=>Bs("initialValue",e)).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:Su(e.selectBehaviours,[ih.config({}),yu.config({store:{mode:"manual",getValue:e=>Ja(e.element),setValue:(t,o)=>{const n=oe(e.options);G(e.options,e=>e.value===o).isSome()?Za(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each(e=>Za(t.element,e.value))},...n}})])}}}),nT=x([ws("field1Name","field1"),ws("field2Name","field2"),Li("onLockedChange"),Fi(["lockClass"]),ws("locked",!1),Cu("coupledFieldBehaviours",[_m,yu])]),sT=(e,t)=>qu({factory:EC,name:e,overrides:e=>({fieldBehaviours:El([oh("coupled-input-behaviour",[jr(er(),o=>{((e,t,o)=>im(e,t,o).bind(_m.getCurrent))(o,e,t).each(t=>{im(o,e,"lock").each(n=>{hh.isOn(n)&&e.onLockedChange(o,t,n)})})})])])})}),rT=x([sT("field1","field2"),sT("field2","field1"),qu({factory:Xh,schema:[ss("dom")],name:"lock",overrides:e=>({buttonBehaviours:El([hh.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),aT=Sm({name:"FormCoupledInputs",configFields:nT(),partFields:rT(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Ou(e.coupledFieldBehaviours,[_m.config({find:A.some}),yu.config({store:{mode:"manual",getValue:t=>{const o=mm(t,e,["field1","field2"]);return{[e.field1Name]:yu.getValue(o.field1()),[e.field2Name]:yu.getValue(o.field2())}},setValue:(t,o)=>{const n=mm(t,e,["field1","field2"]);ye(o,e.field1Name)&&yu.setValue(n.field1(),o[e.field1Name]),ye(o,e.field2Name)&&yu.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>im(t,e,"field1"),getField2:t=>im(t,e,"field2"),getLock:t=>im(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),iT=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 an.value({value:e,unit:o})}return an.error(e)},lT=(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?A.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?A.some(e.value):A.some(e.value/o[e.unit]*o[t]):A.none()},cT=e=>A.none(),dT=(e,t)=>{const o=e.label.map(o=>NC(o,e.tooltip.getOr(""),t)),n=[Hm.config({disabled:()=>e.disabled||t.isDisabled()}),Px(),$p.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Rr(e,PC),A.some(!0))}),oh("textfield-change",[jr(er(),(t,o)=>{Nr(t,zC,{name:e.name})}),jr(ur(),(t,o)=>{Nr(t,zC,{name:e.name})})]),DC.config({})],s=e.validation.map(e=>oO.config({getRoot:e=>it(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=yu.getValue(t),n=e.validator(o);return LS(!0===n?an.value(o):an.error(n))},validateOnLoad:e.validateOnLoad}})).toArray(),r={...e.placeholder.fold(x({}),e=>({placeholder:t.translate(e)})),...e.inputMode.fold(x({}),e=>({inputmode:e}))},a=EC.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map(e=>({data:e})).getOr({}),inputAttributes:r,inputClasses:[e.classname],inputBehaviours:El(q([n,s])),selectOnFocus:!1,factory:ey}),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=[Hm.config({disabled:()=>e.disabled||t.isDisabled(),onDisabled:e=>{EC.getField(e).each(Hm.disable)},onEnabled:e=>{EC.getField(e).each(Hm.enable)}}),Px()];return IC(o,i,l,c)},uT=(e,t)=>t.getAnimationRoot.fold(()=>e.element,t=>t(e)),mT=e=>e.dimension.property,gT=(e,t)=>e.dimension.getDimension(t),pT=(e,t)=>{const o=uT(e,t);Xa(o,[t.shrinkingClass,t.growingClass])},hT=(e,t)=>{$a(e.element,t.openClass),ja(e.element,t.closedClass),It(e.element,mT(t),"0px"),Ut(e.element)},fT=(e,t)=>{$a(e.element,t.closedClass),ja(e.element,t.openClass),Pt(e.element,mT(t))},bT=(e,t,o,n)=>{o.setCollapsed(),It(e.element,mT(t),gT(t,e.element)),pT(e,t),hT(e,t),t.onStartShrink(e),t.onShrunk(e)},vT=(e,t,o,n)=>{const s=n.getOrThunk(()=>gT(t,e.element));o.setCollapsed(),It(e.element,mT(t),s),Ut(e.element);const r=uT(e,t);$a(r,t.growingClass),ja(r,t.shrinkingClass),hT(e,t),t.onStartShrink(e)},yT=(e,t,o)=>{const n=gT(t,e.element);("0px"===n?bT:vT)(e,t,o,A.some(n))},xT=(e,t,o)=>{const n=uT(e,t),s=qa(n,t.shrinkingClass),r=gT(t,e.element);fT(e,t);const a=gT(t,e.element);(s?()=>{It(e.element,mT(t),r),Ut(e.element)}:()=>{hT(e,t)})(),$a(n,t.shrinkingClass),ja(n,t.growingClass),fT(e,t),It(e.element,mT(t),a),o.setExpanded(),t.onStartGrow(e)},wT=(e,t,o)=>{const n=uT(e,t);return!0===qa(n,t.growingClass)},ST=(e,t,o)=>{const n=uT(e,t);return!0===qa(n,t.shrinkingClass)};var CT=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){Pt(e.element,mT(t));const o=gT(t,e.element);It(e.element,mT(t),o)}},grow:(e,t,o)=>{o.isExpanded()||xT(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&yT(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&bT(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:wT,isShrinking:ST,isTransitioning:(e,t,o)=>wT(e,t)||ST(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?yT:xT)(e,t,o)},disableTransitions:pT,immediateGrow:(e,t,o)=>{o.isExpanded()||(fT(e,t),It(e.element,mT(t),gT(t,e.element)),pT(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}}),OT=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return Ma(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:Bs(t.dimension.property,"0px")})},events:(e,t)=>Pr([Jr(sr(),(o,n)=>{n.event.raw.propertyName===e.dimension.property&&(pT(o,e),t.isExpanded()&&Pt(o.element,e.dimension.property),(t.isExpanded()?e.onGrown:e.onShrunk)(o))})])}),kT=[ss("closedClass"),ss("openClass"),ss("shrinkingClass"),ss("growingClass"),gs("getAnimationRoot"),Ni("onShrunk"),Ni("onStartShrink"),Ni("onGrown"),Ni("onStartGrow"),ws("expanded",!1),rs("dimension",Qn("property",{width:[Hi("property","width"),Hi("getDimension",e=>Qt(e)+"px")],height:[Hi("property","height"),Hi("getDimension",e=>Gt(e)+"px")]}))];const _T=Ml({fields:kT,name:"sliding",active:OT,apis:CT,state:Object.freeze({__proto__:null,init:e=>{const t=Ms(e.expanded);return Ea({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:C(t.set,!1),setExpanded:C(t.set,!0),readState:()=>"expanded: "+t.get()})}})}),TT=e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setActive:t=>{const o=e.element;t?(ja(o,"tox-tbtn--enabled"),kt(o,"aria-pressed",!0)):($a(o,"tox-tbtn--enabled"),Mt(o,"aria-pressed"))},isActive:()=>qa(e.element,"tox-tbtn--enabled"),setText:t=>{Nr(e,G_,{text:t})},setIcon:t=>Nr(e,$_,{icon:t})}),ET=(e,t,o,n,s=!0,r)=>q_({text:e.text,icon:e.icon,tooltip:e.tooltip,ariaLabel:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const s={pattern:e.search.isSome()?tC(t):""};e.fetch(t=>{n(J_(t,Dv.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))},s,TT(t))},onSetup:e.onSetup,getApi:TT,columns:1,presets:"normal",classes:[],dropdownBehaviours:[...s?[DC.config({})]:[]]},t,o.shared,r),AT=(e,t,o)=>{const n=e=>n=>{const s=!n.isActive();n.setActive(s),e.storage.set(s),o.shared.getSink().each(o=>{t().getOpt(o).each(t=>{Nl(t.element),Nr(t,HC,{name:e.name,value:e.storage.get()})})})},s=e=>t=>{t.setActive(e.storage.get())};return t=>{t(V(e,e=>{const t=e.text.fold(()=>({}),e=>({text:e}));return{type:e.type,active:!1,...t,onAction:n(e),onSetup:s(e)}}))}},MT=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":e}},components:[ai(e)]}),DT=da("leaf-label-event-id"),BT=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:s,backstage:r})=>{const a=e.menu.map(e=>ET(e,"tox-mbtn",r,A.none(),o)),i=[MT(e.title)];return a.each(e=>i.push(e)),Xh.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:{[Zs()]:[DT,"keying"]},buttonBehaviours:El([...o?[DC.config({})]:[],hh.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),Fl.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?hh.on:hh.off)(t)}}}}),oh(DT,[Zr((t,o)=>{s.each(o=>{(o===e.id?hh.on:hh.off)(t)})}),jr(Zs(),(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=>{vi(t,".tox-tree--directory__label").each(t=>{e.getSystem().getByDom(t).each(ih.focus)})})}),t.stop()):n&&t.stop()})])])})},IT=da("directory-label-event-id"),FT=({directory:e,visible:t,noChildren:o,backstage:n})=>{const s=e.menu.map(e=>ET(e,"tox-mbtn",n,A.none())),r=[{dom:{tag:"div",classes:["tox-chevron"]},components:[(a="chevron-right",i=n.shared.providers.icons,((e,t)=>bb(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"],behaviours:[]},t))(a,i))]},MT(e.title)];var a,i;s.each(e=>{r.push(e)});const l=t=>{bi(t.element,".tox-tree--directory").each(o=>{t.getSystem().getByDom(o).each(o=>{const n=!hh.isOn(o);hh.toggle(o),Nr(t,"expand-tree-node",{expanded:n,node:e.id})})})};return Xh.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:r,action:l,eventOrder:{[Zs()]:[IT,"keying"]},buttonBehaviours:El([...t?[DC.config({})]:[],oh(IT,[jr(Zs(),(e,t)=>{const n="ArrowRight"===t.event.raw.code,s="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||s)&&bi(e.element,".tox-tree--directory").each(o=>{e.getSystem().getByDom(o).each(o=>{!hh.isOn(o)&&n||hh.isOn(o)&&s?(l(e),t.stop()):s&&!hh.isOn(o)&&(bi(o.element,".tox-tree--directory").each(e=>{vi(e,".tox-tree--directory__label").each(e=>{o.getSystem().getByDom(e).each(ih.focus)})}),t.stop())})})})])])})},RT=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:s,selectedId:r,backstage:a})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map(e=>"leaf"===e.type?BT({leaf:e,selectedId:r,onLeafAction:t,visible:o,treeId:n,backstage:a}):zT({directory:e,expandedIds:s,selectedId:r,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:a})),behaviours:El([_T.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}),th.config({})])}),NT=da("directory-event-id"),zT=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:s,expandedIds:r,selectedId:a})=>{const{children:i}=e,l=Ms(r),c=r.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[FT({directory:e,visible:o,noChildren:0===e.children.length,backstage:s}),RT({children:i,expandedIds:r,selectedId:a,onLeafAction:t,visible:c,treeId:n,backstage:s})],behaviours:El([oh(NT,[Zr((e,t)=>{hh.set(e,c)}),jr("expand-tree-node",(e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter(e=>e!==n))})]),hh.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const r=e.components()[1],c=(d=o,i.map(e=>"leaf"===e.type?BT({leaf:e,selectedId:a,onLeafAction:t,visible:d,treeId:n,backstage:s}):zT({directory:e,expandedIds:l.get(),selectedId:a,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:s})));var d;o?_T.grow(r):_T.shrink(r),th.set(r,c)}})])}},LT=da("tree-event-id");var VT=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return Pr([jr(e.event,o),Qr(()=>t.cancel())].concat(e.cancelEvent.map(e=>[jr(e,()=>t.cancel())]).getOr([])))}});const HT=e=>{const t=Ms(null);return Ea({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var PT=Object.freeze({__proto__:null,throttle:HT,init:e=>e.stream.streams.state(e)}),UT=[rs("stream",Qn("mode",{throttle:[ss("delay"),ws("stopEvent",!0),Hi("streams",{setup:(e,t)=>{const o=e.stream,n=p_(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:HT})]})),ws("event","input"),gs("cancelEvent"),Li("onStream")];const WT=Ml({fields:UT,name:"streaming",active:VT,state:PT}),jT=(e,t,o)=>{const n=yu.getValue(o);yu.setValue(t,n),$T(t)},GT=(e,t)=>{const o=e.element,n=Ja(o),s=o.dom;"number"!==Tt(o,"type")&&t(s,n)},$T=e=>{GT(e,(e,t)=>e.setSelectionRange(t.length,t.length))},qT=x("alloy.typeahead.itemexecute"),YT=x([gs("lazySink"),ss("fetch"),ws("minChars",5),ws("responseTime",1e3),Ni("onOpen"),ws("getHotspot",A.some),ws("getAnchorOverrides",x({})),ws("layouts",A.none()),ws("eventOrder",{}),As("model",{},[ws("getDisplayText",e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value),ws("selectsOver",!0),ws("populateFromBrowse",!0)]),Ni("onSetValue"),zi("onExecute"),Ni("onItemExecute"),ws("inputClasses",[]),ws("inputAttributes",{}),ws("inputStyles",{}),ws("matchWidth",!0),ws("useMinWidth",!1),ws("dismissOnBlur",!0),Fi(["openClass"]),gs("initialData"),xu("typeaheadBehaviours",[ih,yu,WT,$p,hh,BS]),os("lazyTypeaheadComp",()=>Ms(A.none)),os("previewing",()=>Ms(!0))].concat(Kv()).concat(XS())),XT=x([Yu({schema:[Ii()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each(t=>{((e,t,o)=>{if(e.selectsOver){const n=yu.getValue(t),s=e.getDisplayText(n),r=yu.getValue(o);return 0===e.getDisplayText(r).indexOf(s)?A.some(()=>{jT(0,t,o),((e,t)=>{GT(e,(e,o)=>e.setSelectionRange(t,o.length))})(t,s.length)}):A.none()}return A.none()})(e.model,t,n).fold(()=>{e.model.selectsOver?(Km.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&&jT(e.model,t,n),Et(n.element,"id").each(e=>kt(t.element,"aria-activedescendant",e))})},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map(e=>(Nr(e,qT(),{item:o}),!0)),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each(t=>{e.model.populateFromBrowse&&jT(e.model,t,o)})}})})]),KT=Sm({name:"Typeahead",configFields:YT(),partFields:XT(),factory:(e,t,o,n)=>{const s=(t,o,s)=>{e.previewing.set(!1);const r=BS.getCoupled(t,"sandbox");if(Qd.isOpen(r))_m.getCurrent(r).each(e=>{Km.getHighlighted(e).fold(()=>{s(e)},()=>{Hr(r,e.element,"keydown",o)})});else{const o=e=>{_m.getCurrent(e).each(s)};US(e,a(t),t,r,n,o,jh.HighlightMenuAndItem).get(b)}},r=Jv(e),a=e=>t=>t.map(t=>{const o=fe(t.menus),n=Y(o,e=>U(e.items,e=>"item"===e.type));return yu.getState(e).update(V(n,e=>e.data)),t}),i=e=>_m.getCurrent(e),l="typeaheadevents",c=[ih.config({}),yu.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>Ja(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{Za(t.element,e.model.getDisplayText(o))},...e.initialData.map(e=>Bs("initialValue",e)).getOr({})}}),WT.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const s=BS.getCoupled(t,"sandbox");if(ih.isFocused(t)&&Ja(t.element).length>=e.minChars){const o=i(s).bind(e=>Km.getHighlighted(e).map(yu.getValue));e.previewing.set(!0);const r=t=>{i(s).each(t=>{o.fold(()=>{e.model.selectsOver&&Km.highlightFirst(t)},e=>{Km.highlightBy(t,t=>yu.getValue(t).value===e.value),Km.getHighlighted(t).orThunk(()=>(Km.highlightFirst(t),A.none()))})})};US(e,a(t),t,s,n,r,jh.HighlightJustMenu).get(b)}},cancelEvent:vr()}),$p.config({mode:"special",onDown:(e,t)=>(s(e,t,Km.highlightFirst),A.some(!0)),onEscape:e=>{const t=BS.getCoupled(e,"sandbox");return Qd.isOpen(t)?(Qd.close(t),A.some(!0)):A.none()},onUp:(e,t)=>(s(e,t,Km.highlightLast),A.some(!0)),onEnter:t=>{const o=BS.getCoupled(t,"sandbox"),n=Qd.isOpen(o);if(n&&!e.previewing.get())return i(o).bind(e=>Km.getHighlighted(e)).map(e=>(Nr(t,qT(),{item:e}),!0));{const s=yu.getValue(t);return Rr(t,vr()),e.onExecute(o,t,s),n&&Qd.close(o),A.some(!0)}}}),hh.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),BS.config({others:{sandbox:t=>qS(e,t,{onOpen:()=>hh.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each(e=>Mt(e.element,"aria-activedescendant")),hh.off(t)}})}}),oh(l,[Zr(t=>{e.lazyTypeaheadComp.set(A.some(t))}),Qr(t=>{e.lazyTypeaheadComp.set(A.none())}),ta(t=>{const o=b;jS(e,a(t),t,n,o,jh.HighlightMenuAndItem).get(b)}),jr(qT(),(t,o)=>{const n=BS.getCoupled(t,"sandbox");jT(e.model,t,o.event.item),Rr(t,vr()),e.onItemExecute(t,n,o.event.item,yu.getValue(t)),Qd.close(n),$T(t)})].concat(e.dismissOnBlur?[jr(dr(),e=>{const t=BS.getCoupled(e,"sandbox");Hl(t.element).isNone()&&Qd.close(t)})]:[]))],d={[kr()]:[yu.name(),WT.name(),l],...e.eventOrder};return{uid:e.uid,dom:Qv(vn(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...r,...Su(e.typeaheadBehaviours,c)},eventOrder:d}}}),JT=e=>({...e,toCached:()=>JT(e.toCached()),bindFuture:t=>JT(e.bind(e=>e.fold(e=>LS(an.error(e)),e=>t(e)))),bindResult:t=>JT(e.map(e=>e.bind(t))),mapResult:t=>JT(e.map(e=>e.map(t))),mapError:t=>JT(e.map(e=>e.mapError(t))),foldResult:(t,o)=>e.map(e=>e.fold(t,o)),withTimeout:(t,o)=>JT(zS(n=>{let s=!1;const r=setTimeout(()=>{s=!0,n(an.error(o()))},t);e.get(e=>{s||(clearTimeout(r),n(e))})}))}),ZT=e=>JT(zS(e)),QT=(e,t,o=[],n,s,r,a)=>{const i=t.fold(()=>({}),e=>({action:e})),l={buttonBehaviours:El([Ux(()=>!e.enabled||a.isDisabled()),Px(),DC.config({}),...r.map(e=>Nx.config(a.tooltips.getConfig({tooltipText:a.translate(e)}))).toArray(),oh("button press",[Wr("click"),Wr("mousedown")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...i},c=vn(l,{dom:n});return vn(c,{components:s})},eE=(e,t,o,n=[],s)=>{const r={tag:"button",classes:["tox-tbtn"],attributes:{...e.tooltip.map(e=>({"aria-label":o.translate(e)})).getOr({}),"data-mce-name":s}},a=e.icon.map(e=>U_(e,o.icons)),i=Kx([a]);return QT(e,t,n,r,i,e.tooltip,o)},tE=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},oE=(e,t,o,n=[],s=[])=>{const r=o.translate(e.text),a=e.icon.map(e=>U_(e,o.icons)),i=[a.getOrThunk(()=>ai(r))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c={tag:"button",classes:[...tE(l),...a.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...s],attributes:{"aria-label":r,"data-mce-name":e.text}},d=e.icon.map(x(r));return QT(e,t,n,c,i,d,o)},nE=(e,t,o,n=[],s=[])=>{const r=oE(e,A.some(t),o,n,s);return Xh.sketch(r)},sE=(e,t)=>o=>{"custom"===t?Nr(o,HC,{name:e,value:{}}):"submit"===t?Rr(o,PC):"cancel"===t?Rr(o,VC):console.error("Unknown button type: ",t)},rE=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>r,n=e,s={...e,type:"menubutton",search:A.none(),onSetup:t=>(t.setEnabled(e.enabled),b),fetch:AT(n.items,t,o)},r=Jh(ET(s,"tox-tbtn",o,A.none(),!0,e.text.or(e.tooltip).getOrUndefined()));return r.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=sE(e.name,t),s={...e,borderless:!1};return nE(s,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t,o)=>{var n,s;const r=e.icon.map(e=>W_(e,t.icons)).map(Jh),a=e.buttonType.getOr(e.primary?"primary":"secondary"),i={...e,name:null!==(n=e.name)&&void 0!==n?n:"",primary:"primary"===a,tooltip:e.tooltip,enabled:null!==(s=e.enabled)&&void 0!==s&&s,borderless:!1},l=i.tooltip.map(e=>({"aria-label":t.translate(e)})).getOr({}),c=tE(null!=a?a:"secondary"),d=e.icon.isSome()&&e.text.isSome(),u={tag:"button",classes:[...c.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...d?["tox-button--icon-and-text"]:[]],attributes:{...l,...g(o)?{"data-mce-name":o}:{}}},m=t.translate(e.text.getOr("")),p=ai(m),h=[...Kx([r.map(e=>e.asSpec())]),...e.text.isSome()?[p]:[]],f=QT(i,A.some(o=>{Nr(o,HC,{name:e.name,value:{setIcon:e=>{r.map(n=>n.getOpt(o).each(o=>{th.set(o,[W_(e,t.icons)])}))}}})}),[],u,h,e.tooltip,t);return Xh.sketch(f)})(e,o.shared.providers,e.text.or(e.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},aE={type:"separator"},iE=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:b}),lE=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:b}),cE=(e,t)=>(e=>V(e,iE))(((e,t)=>U(t,t=>t.type===e))(e,t)),dE=e=>cE("header",e.targets),uE=e=>cE("anchor",e.targets),mE=e=>A.from(e.anchorTop).map(e=>lE("<top>",e)).toArray(),gE=e=>A.from(e.anchorBottom).map(e=>lE("<bottom>",e)).toArray(),pE=(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,s=null!==(t=e.value)&&void 0!==t?t:"";return Te(n.toLowerCase(),o)||Te(s.toLowerCase(),o)})},hE=da("aria-invalid"),fE=(e,t)=>{e.dom.checked=t},bE=e=>e.dom.checked,vE=e=>(t,o,n,s)=>be(o,"name").fold(()=>e(o,s,A.none()),r=>t.field(r,e(o,s,be(n,r)))),yE={bar:vE((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:V(e.items,t.interpreter)}))(e,t.shared)),collection:vE((e,t,o)=>$C(e,t.shared.providers,o)),alertbanner:vE((e,t)=>((e,t)=>{const o=pb(e.icon,t.icons);return OC.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?[Xh.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>Nr(t,HC,{name:"alert-banner",value:e.url}),buttonBehaviours:El([hb()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers)),input:vE((e,t,o)=>((e,t,o)=>dT({name:e.name,multiline:!1,label:e.label,tooltip:e.tooltip,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o)),textarea:vE((e,t,o)=>((e,t,o)=>dT({name:e.name,multiline:!0,label:e.label,tooltip:e.tooltip,inputMode:A.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:A.none(),maximized:e.maximized,data:o},t))(e,t.shared.providers,o)),label:vE((e,t)=>((e,t)=>{const o="tox-label",n={dom:{tag:"label",classes:[o,..."center"===e.align?[`${o}--center`]:[],..."end"===e.align?[`${o}--end`]:[]]},components:[ai(t.providers.translate(e.label))]};return e.tooltip&&""!==e.tooltip.getOr("")?{dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__label-container"]},components:[n,{dom:{tag:"div",classes:["tox-label-tooltip"]},components:[bb("tooltip",{tag:"span",classes:["tox-icon","tox-label-tooltip-icon"]},t.providers.icons)],behaviours:El([Nx.config(t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e.tooltip.getOr(""))}))])}]},...V(e.items,t.interpreter)],behaviours:El([n_(),th.config({}),(s=A.none(),l_(s,oa,na)),$p.config({mode:"acyclic"})])}:n;var s})(e,t.shared)),iframe:($A=(e,t,o)=>((e,t,o)=>{const n="tox-dialog__iframe",s=e.transparent?[]:[`${n}--opaque`],r=e.border?["tox-navobj-bordered"]:[],a={...e.label.map(e=>({title:e})).getOr({}),...o.map(e=>({srcdoc:e})).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},i=((e,t)=>{const o=Ms(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,s=()=>kt(o,"srcdoc",n);t?N_.fold(x(R_),e=>e.throttle)(o,n,s):s()}o.set(n)}}})(o,e.streamContent),l=e.label.map(o=>NC(o,e.tooltip.getOr(""),t)),c=EC.parts.field({factory:{sketch:e=>v_(A.from(r),{uid:e.uid,dom:{tag:"iframe",attributes:a,classes:[n,...s]},behaviours:El([DC.config({}),ih.config({}),i_(o,i.getValue,i.setValue),Fl.config({channels:{[T_]:{onReceive:(e,t)=>{t.newFocus.each(t=>{it(e.element).each(o=>{(et(e.element,t)?ja:$a)(o,"tox-navobj-bordered-focus")})})}}}})])})}});return IC(l,c,["tox-form__group--stretched"],[])})(e,t.shared.providers,o),(e,t,o,n)=>{const s=vn(t,{source:"dynamic"});return vE($A)(e,s,o,n)}),button:vE((e,t)=>((e,t)=>{const o=sE(e.name,"custom");return n=A.none(),s=EC.parts.field({factory:Xh,...oE(e,A.some(o),t,[c_(""),n_()])}),IC(n,s,[],[]);var n,s})(e,t.shared.providers)),checkbox:vE((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),A.some(!0)),s=EC.parts.field({factory:{sketch:w},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:El([n_(),Hm.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{it(e.element).each(e=>ja(e,"tox-checkbox--disabled"))},onEnabled:e=>{it(e.element).each(e=>$a(e,"tox-checkbox--disabled"))}}),DC.config({}),ih.config({}),l_(o,bE,fE),$p.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),oh("checkbox-events",[jr(tr(),(t,o)=>{Nr(t,zC,{name:e.name})})])])}),r=EC.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[ai(t.translate(e.label))],behaviours:El([nO.config({})])}),a=e=>bb("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),i=Jh({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[a("checked"),a("unchecked")]});return EC.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[s,i.asSpec(),r],fieldBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),Px()])})})(e,t.shared.providers,o)),colorinput:vE((e,t,o)=>((e,t,o,n)=>{const s=EC.parts.field({factory:ey,inputClasses:["tox-textfield"],data:n,onSetValue:e=>oO.run(e).get(b),inputBehaviours:El([Hm.config({disabled:t.providers.isDisabled}),Px(),DC.config({}),oO.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>it(e.element),notify:{onValid:e=>{const t=yu.getValue(e);Nr(e,sO,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=yu.getValue(e);if(0===t.length)return LS(an.value(!0));{const e=Ne("span");It(e,"background-color",t);const o=Lt(e,"background-color").fold(()=>an.error("blah"),e=>an.value(t));return LS(o)}}}})]),selectOnFocus:!1}),r=e.label.map(o=>NC(o,e.tooltip.getOr(""),t.providers)),a=(e,t)=>{Nr(e,rO,{value:t})},i=Jh(((e,t)=>ZS.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:El([Ux(t.providers.isDisabled),Px(),nO.config({}),DC.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>zS(t=>e.fetch(t)).map(n=>A.from(aC(vn(yS(da("menu-value"),n,t=>{e.onItemAction(o,t)},e.columns,e.presets,Dv.CLOSE_ON_EXECUTE,T,t.providers),{movement:wS(e.columns,e.presets)})))),parts:{menu:Xv(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[dl,cl,pl],onLtr:()=>[cl,dl,pl]},components:[],fetch:uS(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(()=>Rr(t,aO),o=>{a(t,o),jw(e.storageKey,o)})},"#ffffff"):a(t,"remove"===n?"":n)})}},t));return EC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:r.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[s,i.asSpec()]}]),fieldBehaviours:El([oh("form-field-events",[jr(sO,(t,o)=>{i.getOpt(t).each(e=>{It(e.element,"background-color",o.event.color)}),Nr(t,zC,{name:e.name})}),jr(rO,(e,t)=>{EC.getField(e).each(o=>{yu.setValue(o,t.event.value),_m.getCurrent(e).each(ih.focus)})}),jr(aO,(e,t)=>{EC.getField(e).each(t=>{_m.getCurrent(e).each(ih.focus)})})])])})})(e,t.shared,t.colorinput,o)),colorpicker:vE((e,t,o)=>((e,t,o)=>{const n=e=>"tox-"+e,s=o_((e=>t=>r(t)?e.translate(d_[t]):e.translate(t))(t),n),a=Jh(s.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{Nr(e,HC,{name:"hex-valid",value:!0})},onInvalidHex:e=>{Nr(e,HC,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[a.asSpec()],behaviours:El([i_(o,e=>{const t=a.get(e);return _m.getCurrent(t).bind(e=>yu.getValue(e).hex).map(e=>"#"+_e(e,"#")).getOr("")},(e,t)=>{const o=A.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind(e=>te(e,1)),n=a.get(e);_m.getCurrent(n).fold(()=>{console.log("Can not find form")},e=>{yu.setValue(e,{hex:o.getOr("")}),Kk.getField(e,"hex").each(e=>{Rr(e,er())})})}),n_()])}})(0,t.shared.providers,o)),dropzone:vE((e,t,o)=>((e,t,o)=>{const n=(e,t)=>{t.stop()},s=e=>(t,o)=>{H(e,e=>{e(t,o)})},r=(e,t)=>{var o;if(!Hm.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&&(yu.setValue(o,((e,t)=>{const o=g_.explode(t.getOption("images_file_types"));return U(se(e),e=>N(o,t=>Ae(e.name.toLowerCase(),`.${t.toLowerCase()}`)))})(n,t)),Nr(o,zC,{name:e.name}))},l=Jh({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:El([oh("input-file-events",[Xr(or()),Xr(hr())])])}),c=e.label.map(o=>NC(o,e.tooltip.getOr(""),t)),d=EC.parts.field({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:El([c_(o.getOr([])),n_(),Hm.config({}),hh.config({toggleClass:"dragenter",toggleOnExecute:!1}),oh("dropzone-events",[jr("dragenter",s([n,hh.toggle])),jr("dragleave",s([n,hh.toggle])),jr("dragover",n),jr("drop",s([n,r])),jr(tr(),a)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[ai(t.translate("Drop an image here"))]},Xh.sketch({dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[ai(t.translate("Browse for an image")),l.asSpec()],action:e=>{l.get(e).element.dom.click()},buttonBehaviours:El([DC.config({}),Ux(t.isDisabled),Px()])})]}]})}});return IC(c,d,["tox-form__group--stretched"],[])})(e,t.shared.providers,o)),grid:vE((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:V(e.items,t.interpreter)}))(e,t.shared)),listbox:vE((e,t,o)=>((e,t,o)=>{const n=t.shared.providers,s=o.bind(t=>tT(e.items,t)).orThunk(()=>oe(e.items).filter(Z_)),r=e.label.map(t=>NC(t,e.tooltip.getOr(""),n)),a=EC.parts.field({dom:{},factory:{sketch:o=>q_({uid:o.uid,text:s.map(e=>e.text),icon:A.none(),tooltip:A.none(),role:A.none(),ariaLabel:e.label,fetch:(o,n)=>{const s=eT(o,e.name,e.items,yu.getValue(o));n(J_(s,Dv.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:A.none()}))},onSetup:x(b),getApi:x({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[DC.config({}),i_(s.map(e=>e.value),e=>Tt(e.element,Q_),(t,o)=>{tT(e.items,o).each(e=>{kt(t.element,Q_,e.value),Nr(t,G_,{text:e.text})})})]},"tox-listbox",t.shared)}}),i={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return EC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([r.toArray(),[i]]),fieldBehaviours:El([Hm.config({disabled:x(!e.enabled),onDisabled:e=>{EC.getField(e).each(Hm.disable)},onEnabled:e=>{EC.getField(e).each(Hm.enable)}})])})})(e,t,o)),selectbox:vE((e,t,o)=>((e,t,o)=>{const n=V(e.items,e=>({text:t.translate(e.text),value:e.value})),s=e.label.map(o=>NC(o,e.tooltip.getOr(""),t)),r=EC.parts.field({dom:{},...o.map(e=>({data:e})).getOr({}),selectAttributes:{size:e.size},options:n,factory:oT,selectBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),DC.config({}),oh("selectbox-change",[jr(tr(),(t,o)=>{Nr(t,zC,{name:e.name})})])])}),a=e.size>1?A.none():A.some(bb("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),i={dom:{tag:"div",classes:["tox-selectfield"]},components:q([[r],a.toArray()])};return EC.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:q([s.toArray(),[i]]),fieldBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{EC.getField(e).each(Hm.disable)},onEnabled:e=>{EC.getField(e).each(Hm.enable)}}),Px()])})})(e,t.shared.providers,o)),sizeinput:vE((e,t)=>((e,t)=>{let o=cT;const n=da("ratio-event"),s=e=>bb(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),r=e.label.getOr("Constrain proportions"),a=t.translate(r),i=aT.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":a,"data-mce-name":r}},components:[s("lock"),s("unlock")],buttonBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),Px(),DC.config({}),Nx.config(t.tooltips.getConfig({tooltipText:a}))])}),l=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),c=o=>EC.parts.field({factory:ey,inputClasses:["tox-textfield"],inputBehaviours:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled()}),Px(),DC.config({}),oh("size-input-events",[jr(Ks(),(e,t)=>{Nr(e,n,{isField1:o})}),jr(tr(),(t,o)=>{Nr(t,zC,{name:e.name})})])]),selectOnFocus:!1}),d=e=>({dom:{tag:"label",classes:["tox-label"]},components:[ai(t.translate(e))]}),u=aT.parts.field1(l([EC.parts.label(d("Width")),c(!0)])),m=aT.parts.field2(l([EC.parts.label(d("Height")),c(!1)]));return aT.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[u,m,l([d("\xa0"),i])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{iT(yu.getValue(e)).each(e=>{o(e).each(e=>{yu.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:El([Hm.config({disabled:()=>!e.enabled||t.isDisabled(),onDisabled:e=>{aT.getField1(e).bind(EC.getField).each(Hm.disable),aT.getField2(e).bind(EC.getField).each(Hm.disable),aT.getLock(e).each(Hm.disable)},onEnabled:e=>{aT.getField1(e).bind(EC.getField).each(Hm.enable),aT.getField2(e).bind(EC.getField).each(Hm.enable),aT.getLock(e).each(Hm.enable)}}),Px(),oh("size-input-events2",[jr(n,(e,t)=>{const n=t.event.isField1,s=n?aT.getField1(e):aT.getField2(e),r=n?aT.getField2(e):aT.getField1(e),a=s.map(yu.getValue).getOr(""),i=r.map(yu.getValue).getOr("");o=((e,t)=>{const o=iT(e).toOptional(),n=iT(t).toOptional();return Se(o,n,(e,t)=>lT(e,t.unit).map(e=>t.value/e).map(e=>{return o=e,n=t.unit,e=>lT(e,n).map(e=>({value:e*o,unit:n}));var o,n}).getOr(cT)).getOr(cT)})(a,i)})])])})})(e,t.shared.providers)),slider:vE((e,t,o)=>((e,t,o)=>{const n=Uk.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[ai(t.translate(e.label))]}),s=Uk.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),r=Uk.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Uk.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:x(o.getOrThunk(()=>(Math.abs(e.max)-Math.abs(e.min))/2))},components:[n,s,r],sliderBehaviours:El([n_(),ih.config({})]),onChoose:(t,o,n)=>{Nr(t,zC,{name:e.name,value:n})}})})(e,t.shared.providers,o)),urlinput:vE((e,t,o)=>((e,t,o,n)=>{const s=t.shared.providers,r=t=>{const n=yu.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":hE,type:"url"},minChars:0,responseTime:0,fetch:n=>{const s=((e,t,o)=>{var n,s;const r=yu.getValue(t),a=null!==(s=null===(n=null==r?void 0:r.meta)||void 0===n?void 0:n.text)&&void 0!==s?s:r.value;return o.getLinkInformation().fold(()=>[],t=>{const n=pE(a,(e=>V(e,e=>lE(e,e)))(o.getHistory(e)));return"file"===e?(s=[n,pE(a,dE(t)),pE(a,q([mE(t),uE(t),gE(t)]))],j(s,(e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(aE,t),[])):n;var s})})(e.filetype,n,o),r=J_(s,Dv.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:A.none()});return LS(r)},getHotspot:e=>g.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(oO)&&oO.run(e).get(b)},typeaheadBehaviours:El([...o.getValidationHandler().map(t=>oO.config({getRoot:e=>it(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each(e=>{kt(e.element,"title",s.translate(t))})}},validator:{validate:o=>{const n=yu.getValue(o);return ZT(o=>{t({type:e.filetype,url:n.value},e=>{if("invalid"===e.status){const t=an.error(e.message);o(t)}else{const t=an.value(e.message);o(t)}})})},validateOnLoad:!1}})).toArray(),Hm.config({disabled:()=>!e.enabled||s.isDisabled()}),DC.config({}),oh("urlinput-events",[jr(er(),t=>{const o=Ja(t.element),n=o.trim();n!==o&&Za(t.element,n),"file"===e.filetype&&Nr(t,zC,{name:e.name})}),jr(tr(),t=>{Nr(t,zC,{name:e.name}),r(t)}),jr(ur(),t=>{Nr(t,zC,{name:e.name}),r(t)})])]),eventOrder:{[er()]:["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:Xv(0,0,"normal")},onExecute:(e,t,o)=>{Nr(t,PC,{})},onItemExecute:(t,o,n,s)=>{r(t),Nr(t,zC,{name:e.name})}},i=EC.parts.field({...a,factory:KT}),l=e.label.map(t=>NC(t,e.tooltip.getOr(""),s)),c=Jh(((e,t,o=e,n=e)=>bb(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:s.translate(n),"aria-live":"polite",...t.fold(()=>({}),e=>({id:e}))}},s.icons))("invalid",A.some(hE),"warning")),d=Jh({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),u=o.getUrlPicker(e.filetype),m=da("browser.url.event"),g=Jh({dom:{tag:"div",classes:["tox-control-wrap"]},components:[i,d.asSpec()],behaviours:El([Hm.config({disabled:()=>!e.enabled||s.isDisabled()})])}),p=Jh(nE({name:e.name,icon:A.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:A.none(),borderless:!0},e=>Rr(e,m),s,[],["tox-browse-url"]));return EC.sketch({dom:RC([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:q([[g.asSpec()],u.map(()=>p.asSpec()).toArray()])}]),fieldBehaviours:El([Hm.config({disabled:()=>!e.enabled||s.isDisabled(),onDisabled:e=>{EC.getField(e).each(Hm.disable),p.getOpt(e).each(Hm.disable)},onEnabled:e=>{EC.getField(e).each(Hm.enable),p.getOpt(e).each(Hm.enable)}}),Px(),oh("url-input-events",[jr(m,t=>{_m.getCurrent(t).each(o=>{const n=yu.getValue(o),s={fieldname:e.name,...n};u.each(n=>{n(s).get(n=>{yu.setValue(o,n),Nr(t,zC,{name:e.name})})})})})])])})})(e,t,t.urlinput,o)),customeditor:vE(e=>{const t=sc(),o=Jh({dom:{tag:e.tag}}),n=sc(),s=!m_(e)&&e.onFocus.isSome()?[ih.config({onFocus:t=>{e.onFocus.each(e=>{e(t.element.dom)})}}),DC.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:El([oh("custom-editor-events",[Zr(s=>{o.getOpt(s).each(o=>{(m_(e)?e.init(o.element.dom):u_.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)})})})]),i_(A.none(),()=>t.get().fold(()=>n.get().getOr(""),e=>e.getValue()),(e,o)=>{t.get().fold(()=>n.set(o),e=>e.setValue(o))}),n_()].concat(s)),components:[o.asSpec()]}}),htmlpanel:vE((e,t)=>((e,t)=>"presentation"===e.presets?OC.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html},containerBehaviours:El([Nx.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{yi(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Hl(e.element)).each(o=>{Et(o,"data-mce-tooltip").each(o=>{Nx.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-normal",anchor:e=>({type:"node",node:yi(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Hl(e.element).filter(e=>Et(e,"data-mce-tooltip").isSome())),root:e.element,layouts:{onLtr:x([pl,gl,cl,ul,dl,ml]),onRtl:x([pl,gl,cl,ul,dl,ml])},bubble:vc(0,-2,{})})})])}):OC.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:El([DC.config({}),ih.config({})])}))(e,t.shared.providers)),imagepreview:vE((e,t,o)=>((e,t)=>{const o=Ms(t.getOr({url:""})),n=Jh({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map(e=>({src:e.url})).getOr({})}}),s=Jh({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),r={};e.height.each(e=>r.height=e);const a=t.map(e=>({url:e.url,zoom:A.from(e.zoom),cachedWidth:A.from(e.cachedWidth),cachedHeight:A.from(e.cachedHeight)}));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:r,attributes:{role:"presentation"}},components:[s.asSpec()],behaviours:El([n_(),i_(a,()=>o.get(),(e,t)=>{const r={url:t.url};t.zoom.each(e=>r.zoom=e),t.cachedWidth.each(e=>r.cachedWidth=e),t.cachedHeight.each(e=>r.cachedHeight=e),o.set(r);const a=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=r;if(!u(t)&&!u(o)){if(u(n)){const n=((e,t,o)=>{const n=Qt(e),s=Gt(e);return Math.min(n/t,s/o,1)})(e.element,t,o);r.zoom=n}const a=((e,t,o,n,s)=>{const r=o*s,a=n*s,i=Math.max(0,e/2-r/2),l=Math.max(0,t/2-a/2);return{left:i.toString()+"px",top:l.toString()+"px",width:r.toString()+"px",height:a.toString()+"px"}})(Qt(e.element),Gt(e.element),t,o,r.zoom);s.getOpt(e).each(e=>{Ft(e.element,a)})}};n.getOpt(e).each(o=>{const n=o.element;var s;t.url!==Tt(n,"src")&&(kt(n,"src",t.url),$a(e.element,"tox-imagepreview__loaded")),a(),(s=n,new Promise((e,t)=>{const o=()=>{r(),e(s)},n=[ac(s,"load",o),ac(s,"error",()=>{r(),t("Unable to load data from image: "+s.dom.src)})],r=()=>H(n,e=>e.unbind());s.dom.complete&&o()})).then(t=>{e.getSystem().isConnected()&&(ja(e.element,"tox-imagepreview__loaded"),r.cachedWidth=t.dom.naturalWidth,r.cachedHeight=t.dom.naturalHeight,a())})})})])}})(e,o)),table:vE((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"td",innerHtml:t.translate(e)}});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(s=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:V(s,e=>({dom:{tag:"th",innerHtml:t.translate(e)}}))}]}),(n=e.cells,{dom:{tag:"tbody"},components:V(n,e=>({dom:{tag:"tr"},components:V(e,o)}))})],behaviours:El([DC.config({}),ih.config({})])};var n,s})(e,t.shared.providers)),tree:vE((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(b),n=e.onToggleExpand.getOr(b),s=e.defaultExpandedIds,r=Ms(s),a=Ms(e.defaultSelectedId),i=da("tree-id"),l=(n,s)=>e.items.map(e=>"leaf"===e.type?BT({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:i,backstage:t}):zT({directory:e,selectedId:n,onLeafAction:o,expandedIds:s,labelTabstopping:!0,treeId:i,backstage:t}));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(a.get(),r.get()),behaviours:El([$p.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),oh(LT,[jr("expand-tree-node",(e,t)=>{const{expanded:o,node:s}=t.event;r.set(o?[...r.get(),s]:r.get().filter(e=>e!==s)),n(r.get(),{expanded:o,node:s})})]),Fl.config({channels:{[`update-active-item-${i}`]:{onReceive:(e,t)=>{a.set(A.some(t.value)),th.set(e,l(A.some(t.value),r.get()))}}}}),th.config({})])}})(e,t)),panel:vE((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:V(e.items,t.shared.interpreter)}))(e,t))},xE={field:(e,t)=>t,record:x([])},wE=(e,t,o,n)=>{const s=vn(n,{shared:{interpreter:t=>SE(e,t,o,s)}});return SE(e,t,o,s)},SE=(e,t,o,n)=>be(yE,t.type).fold(()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t),s=>s(e,t,o,n)),CE=(e,t,o)=>SE(xE,e,t,o),OE="layout-inset",kE=e=>e.x,_E=(e,t)=>e.x+e.width/2-t.width/2,TE=(e,t)=>e.x+e.width-t.width,EE=e=>e.y,AE=(e,t)=>e.y+e.height-t.height,ME=(e,t)=>e.y+e.height/2-t.height/2,DE=(e,t,o)=>Wi(TE(e,t),AE(e,t),o.insetSouthwest(),Yi(),"southwest",tl(e,{right:0,bottom:3}),OE),BE=(e,t,o)=>Wi(kE(e),AE(e,t),o.insetSoutheast(),qi(),"southeast",tl(e,{left:1,bottom:3}),OE),IE=(e,t,o)=>Wi(TE(e,t),EE(e),o.insetNorthwest(),$i(),"northwest",tl(e,{right:0,top:2}),OE),FE=(e,t,o)=>Wi(kE(e),EE(e),o.insetNortheast(),Gi(),"northeast",tl(e,{left:1,top:2}),OE),RE=(e,t,o)=>Wi(_E(e,t),EE(e),o.insetNorth(),Xi(),"north",tl(e,{top:2}),OE),NE=(e,t,o)=>Wi(_E(e,t),AE(e,t),o.insetSouth(),Ki(),"south",tl(e,{bottom:3}),OE),zE=(e,t,o)=>Wi(TE(e,t),ME(e,t),o.insetEast(),Zi(),"east",tl(e,{right:0}),OE),LE=(e,t,o)=>Wi(kE(e),ME(e,t),o.insetWest(),Ji(),"west",tl(e,{left:1}),OE),VE=e=>{switch(e){case"north":return RE;case"northeast":return FE;case"northwest":return IE;case"south":return NE;case"southeast":return BE;case"southwest":return DE;case"east":return zE;case"west":return LE}},HE=(e,t,o,n,s)=>Ql(n).map(VE).getOr(RE)(e,t,o,n,s),PE=e=>{switch(e){case"north":return NE;case"northeast":return BE;case"northwest":return DE;case"south":return RE;case"southeast":return FE;case"southwest":return IE;case"east":return LE;case"west":return zE}},UE=(e,t,o,n,s)=>Ql(n).map(PE).getOr(RE)(e,t,o,n,s),WE={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},jE=(e,t,o)=>{const n={maxHeightFunction:pc()};return()=>o()?{type:"node",root:vt(bt(e())),node:A.from(e()),bubble:vc(12,12,WE),layouts:{onRtl:()=>[FE],onLtr:()=>[IE]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:vc(-12,12,WE),layouts:{onRtl:()=>[cl,dl,pl],onLtr:()=>[dl,cl,pl]},overrides:n}},GE=(e,t,o,n)=>{const s={maxHeightFunction:pc()};return()=>n()?{type:"node",root:vt(bt(t())),node:A.from(t()),bubble:vc(12,12,WE),layouts:{onRtl:()=>[RE],onLtr:()=>[RE]},overrides:s}:e?{type:"node",root:vt(bt(t())),node:A.from(t()),bubble:vc(0,-$t(t()),WE),layouts:{onRtl:()=>[gl],onLtr:()=>[gl]},overrides:s}:{type:"hotspot",hotspot:o(),bubble:vc(0,0,WE),layouts:{onRtl:()=>[gl],onLtr:()=>[gl]},overrides:s}},$E=(e,t,o)=>()=>o()?{type:"node",root:vt(bt(e())),node:A.from(e()),layouts:{onRtl:()=>[RE],onLtr:()=>[RE]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[pl],onLtr:()=>[pl]}},qE=(e,t)=>()=>({type:"selection",root:t(),getSelection:()=>{const t=e.selection.getRng(),o=e.model.table.getSelectedCells();if(o.length>1){const e=o[0],t=o[o.length-1],n={firstCell:Le(e),lastCell:Le(t)};return A.some(n)}return A.some(Gc.range(Le(t.startContainer),t.startOffset,Le(t.endContainer),t.endOffset))}}),YE=e=>t=>({type:"node",root:e(),node:t}),XE=(e,t,o,n)=>{const s=wv(e),r=()=>Le(e.getBody()),a=()=>Le(e.getContentAreaContainer()),i=()=>s||!n();return{inlineDialog:jE(a,t,i),inlineBottomDialog:GE(e.inline,a,o,i),banner:$E(a,t,i),cursor:qE(e,r),node:YE(r)}},KE=e=>(t,o)=>{vS(e)(t,o)},JE=e=>()=>sS(e),ZE=e=>t=>eS(e,t),QE=e=>t=>nS(e,t),eA=e=>()=>ov(e),tA=e=>ye(e,"items"),oA=e=>ye(e,"format"),nA=[{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"}]}],sA=e=>j(e,(e,t)=>{if(ve(t,"items")){const o=sA(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if(ve(t,"inline")||(e=>ve(e,"block"))(t)||(e=>ve(e,"selector"))(t)){const o=`custom-${r(t.name)?t.name:t.title.toLowerCase()}`;return{customFormats:e.customFormats.concat([{name:o,format:t}]),formats:e.formats.concat([{title:t.title,format:o,icon:t.icon}])}}return{...e,formats:e.formats.concat(t)}},{customFormats:[],formats:[]}),rA=e=>Rb(e).map(t=>{const o=((e,t)=>{const o=sA(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 Nb(e)?nA.concat(o):o}).getOr(nA),aA=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),iA=(e,t,o,n)=>{const s=t=>V(t,t=>tA(t)?(e=>{const t=s(e.items);return{...e,type:"submenu",getStyleItems:x(t)}})(t):oA(t)?(e=>aA(e,o,n))(t):(e=>{const t=ae(e);return 1===t.length&&R(t,"title")})(t)?{...t,type:"separator"}:(t=>{const s=r(t.name)?t.name:da(t.title),a=`custom-${s}`,i={...t,type:"formatter",format:a,isSelected:o(a),getStylePreview:n(a)};return e.formatter.register(s,i),i})(t));return s(t)},lA=e=>{let t=0;const o=e=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[ai(e.tooltipText)]}];return{getConfig:n=>({delayForShow:()=>t>0?60:300,delayForHide:x(300),exclusive:!0,lazySink:e,tooltipDom:{tag:"div",classes:["tox-tooltip","tox-tooltip--up"]},tooltipComponents:o(n),onShow:(e,o)=>{t++,n.onShow&&n.onShow(e,o)},onHide:()=>{t--}}),getComponents:o}},cA=g_.trim,dA=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},uA=dA("true"),mA=dA("false"),gA=(e,t,o,n,s)=>({type:e,title:t,url:o,level:n,attach:s}),pA=e=>e.innerText||e.textContent,hA=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&bA(e),fA=e=>e&&/^(H[1-6])$/.test(e.nodeName),bA=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return uA(t)}return!1})(e)&&!mA(e),vA=e=>fA(e)&&bA(e),yA=e=>{var t;const o=(e=>e.id?e.id:da("h"))(e);return gA("header",null!==(t=pA(e))&&void 0!==t?t:"","#"+o,(e=>fA(e)?parseInt(e.nodeName.substr(1),10):0)(e),()=>{e.id=o})},xA=e=>{const t=e.id||e.name,o=pA(e);return gA("anchor",o||"#"+t,"#"+t,0,b)},wA=e=>cA(e.title).length>0,SA=e=>{const t=(e=>{const t=V(Qc(Le(e),"h1,h2,h3,h4,h5,h6,a:not([href])"),e=>e.dom);return t})(e);return U((e=>V(U(e,vA),yA))(t).concat((e=>V(U(e,hA),xA))(t)),wA)},CA="tinymce-url-history",OA=e=>r(e)&&/^https?/.test(e),kA=e=>a(e)&&he(e,e=>{return!(l(t=e)&&t.length<=5&&X(t,OA));var t}).isNone(),_A=()=>{const e=Pw.getItem(CA);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+CA+" was not valid JSON",e),{};throw e}return kA(t)?t:(console.log("Local storage "+CA+" was not valid format",t),{})},TA=e=>{const t=_A();return be(t,e).getOr([])},EA=(e,t)=>{if(!OA(e))return;const o=_A(),n=be(o,t).getOr([]),s=U(n,t=>t!==e);o[t]=[e].concat(s).slice(0,5),(e=>{if(!kA(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));Pw.setItem(CA,JSON.stringify(e))})(o)},AA=e=>!!e,MA=e=>ce(g_.makeMap(e,/[, ]/),AA),DA=e=>A.from(Xb(e)),BA=e=>A.from(e).filter(r).getOrUndefined(),IA=e=>({getHistory:TA,addToHistory:EA,getLinkInformation:()=>(e=>Qb(e)?A.some({targets:SA(e.getBody()),anchorTop:BA(ev(e)),anchorBottom:BA(tv(e))}):A.none())(e),getValidationHandler:()=>(e=>A.from(Kb(e)))(e),getUrlPicker:t=>((e,t)=>((e,t)=>{const o=(e=>{const t=A.from(Zb(e)).filter(AA).map(MA);return DA(e).fold(T,e=>t.fold(E,e=>ae(e).length>0&&e))})(e);return d(o)?o?DA(e):A.none():o[t]?DA(e):A.none()})(e,t).map(o=>n=>zS(s=>{const i={filetype:t,fieldname:n.fieldname,...A.from(n.meta).getOr({})};o.call(e,(e,t)=>{if(!r(e))throw new Error("Expected value to be string");if(void 0!==t&&!a(t))throw new Error("Expected meta to be a object");s({value:e,meta:t})},n.value,i)})))(e,t)}),FA=hm,RA=Zu,NA=x([ws("shell",!1),ss("makeItem"),ws("setupItem",b),Cu("listBehaviours",[th])]),zA=Xu({name:"items",overrides:()=>({behaviours:El([th.config({})])})}),LA=x([zA]),VA=Sm({name:x("CustomList")(),configFields:NA(),partFields:LA(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[th.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Su(e.listBehaviours,s.behaviours),apis:{setItems:(t,o)=>{var n;(n=t,e.shell?A.some(n):im(n,e,"items")).fold(()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},n=>{const s=th.contents(n),r=o.length,a=r-s.length,i=a>0?z(a,()=>e.makeItem()):[],l=s.slice(r);H(l,e=>th.remove(n,e)),H(i,e=>th.append(n,e));const c=th.contents(n);H(c,(n,s)=>{e.setupItem(t,n,o[s],s)})})}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),HA=x([ss("dom"),ws("shell",!0),xu("toolbarBehaviours",[th])]),PA=x([Xu({name:"groups",overrides:()=>({behaviours:El([th.config({})])})})]),UA=Sm({name:"Toolbar",configFields:HA(),partFields:PA(),factory:(e,t,o,n)=>{const s=e.shell?{behaviours:[th.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:s.components,behaviours:Su(e.toolbarBehaviours,s.behaviours),apis:{setGroups:(t,o)=>{var n;(n=t,e.shell?A.some(n):im(n,e,"groups")).fold(()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},e=>{th.set(e,o)})},refresh:b},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),WA=b,jA=T,GA=x([]);var $A,qA=Object.freeze({__proto__:null,setup:WA,isDocked:jA,getBehaviours:GA});const YA=e=>(xe(Lt(e,"position"),"fixed")?A.none():lt(e)).orThunk(()=>{const t=Ne("span");return at(e).bind(e=>{Ho(e,t);const o=lt(t);return Wo(t),o})}),XA=e=>YA(e).map(Kt).getOrThunk(()=>Yt(0,0)),KA=(e,t)=>{const o=e.element;ja(o,t.transitionClass),$a(o,t.fadeOutClass),ja(o,t.fadeInClass),t.onShow(e)},JA=(e,t)=>{const o=e.element;ja(o,t.transitionClass),$a(o,t.fadeInClass),ja(o,t.fadeOutClass),t.onHide(e)},ZA=(e,t)=>e.y>=t.y,QA=(e,t)=>e.bottom<=t.bottom,eM=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),tM=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),oM=e=>e.box.x-e.win.x,nM=(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 Yt(e.bounds.x,o)})(o,t);return{box:Zo(n.left,n.top,Qt(e),Gt(e)),location:o.location}}),sM=(e,t,o,n,s)=>{const r=((e,t)=>{const o=t.optScrollEnv.fold(x(e.y),t=>e.y+t.currentScrollTop-t.scrollElmTop);return Yt(e.x,o)})(t,o),a=Zo(r.left,r.top,t.width,t.height);n.setInitialPos({style:Vt(e),position:Nt(e,"position")||"static",bounds:a,location:s.location})},rM=(e,t,o)=>o.getInitialPos().bind(n=>{var s;switch(o.clearInitialPos(),n.position){case"static":return A.some({morph:"static"});case"absolute":const o=YA(e).getOr(St()),r=Qo(o),a=null!==(s=o.dom.scrollTop)&&void 0!==s?s:0;return A.some({morph:"absolute",positionCss:Ul("absolute",be(n.style,"left").map(e=>t.x-r.x),be(n.style,"top").map(e=>t.y-r.y+a),be(n.style,"right").map(e=>r.right-t.right),be(n.style,"bottom").map(e=>r.bottom-t.bottom))});default:return A.none()}}),aM=e=>{switch(e.location){case"top":return A.some({morph:"fixed",positionCss:Ul("fixed",A.some(e.leftX),A.some(e.topY),A.none(),A.none())});case"bottom":return A.some({morph:"fixed",positionCss:Ul("fixed",A.some(e.leftX),A.none(),A.none(),A.some(e.bottomY))});default:return A.none()}},iM=(e,t,o)=>{const n=e.element;return xe(Lt(n,"position"),"fixed")?((e,t,o)=>((e,t,o)=>nM(e,t,o).filter(({box:e})=>((e,t,o)=>X(e,e=>{switch(e){case"bottom":return QA(t,o.bounds);case"top":return ZA(t,o.bounds)}}))(o.getModes(),e,t)).bind(({box:t})=>rM(e,t,o)))(e,t,o).orThunk(()=>t.optScrollEnv.bind(n=>nM(e,t,o)).bind(({box:e,location:o})=>{const n=on(),s=oM({win:n,box:e}),r="top"===o?eM(n,s,t):tM(n,s,t);return aM(r)})))(n,t,o):((e,t,o)=>{const n=Qo(e),s=on(),r=((e,t,o)=>{const n=t.win,s=t.box,r=oM(t);return re(e,e=>{switch(e){case"bottom":return QA(s,o.bounds)?A.none():A.some(tM(n,r,o));case"top":return ZA(s,o.bounds)?A.none():A.some(eM(n,r,o));default:return A.none()}}).getOr({location:"no-dock"})})(o.getModes(),{win:s,box:n},t);return"top"===r.location||"bottom"===r.location?(sM(e,n,t,o,r),aM(r)):A.none()})(n,t,o)},lM=(e,t,o)=>{o.setDocked(!1),H(["left","right","top","bottom","position"],t=>Pt(e.element,t)),t.onUndocked(e)},cM=(e,t,o,n)=>{const s="fixed"===n.position;o.setDocked(s),Wl(e.element,n),(s?t.onDocked:t.onUndocked)(e)},dM=(e,t,o,n,s=!1)=>{t.contextual.each(t=>{t.lazyContext(e).each(r=>{const a=((e,t)=>e.y<t.bottom&&e.bottom>t.y)(r,n.bounds);a!==o.isVisible()&&(o.setVisible(a),s&&!a?(Ya(e.element,[t.fadeOutClass]),t.onHide(e)):(a?KA:JA)(e,t))})})},uM=(e,t,o,n,s)=>{dM(e,t,o,n,!0),cM(e,t,o,s.positionCss)},mM=(e,t,o)=>{e.getSystem().isConnected()&&((e,t,o)=>{const n=t.lazyViewport(e);dM(e,t,o,n),iM(e,n,o).each(s=>{((e,t,o,n,s)=>{switch(s.morph){case"static":return lM(e,t,o);case"absolute":return cM(e,t,o,s.positionCss);case"fixed":uM(e,t,o,n,s)}})(e,t,o,n,s)})})(e,t,o)},gM=(e,t,o)=>{o.isDocked()&&((e,t,o)=>{const n=e.element;o.setDocked(!1);const s=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return nM(n,t,o).bind(({box:e})=>rM(n,e,o))})(e,s,o).each(n=>{switch(n.morph){case"static":lM(e,t,o);break;case"absolute":cM(e,t,o,n.positionCss)}}),o.setVisible(!0),t.contextual.each(t=>{Xa(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)}),mM(e,t,o)})(e,t,o)},pM=e=>(t,o,n)=>{const s=o.lazyViewport(t);((e,t,o,n)=>{const s=Qo(e),r=on(),a=n(r,oM({win:r,box:s}),t);return"bottom"===a.location||"top"===a.location?(((e,t,o,n,s)=>{n.getInitialPos().fold(()=>sM(e,t,o,n,s),()=>b)})(e,s,t,o,a),aM(a)):A.none()})(t.element,s,n,e).each(e=>{uM(t,o,n,s,e)})},hM=pM(eM),fM=pM(tM);var bM=Object.freeze({__proto__:null,refresh:mM,reset:gM,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:hM,forceDockToBottom:fM}),vM=Object.freeze({__proto__:null,events:(e,t)=>Pr([Jr(sr(),(o,n)=>{e.contextual.each(e=>{qa(o.element,e.transitionClass)&&(Xa(o.element,[e.transitionClass,e.fadeInClass]),(t.isVisible()?e.onShown:e.onHidden)(o)),n.stop()})}),jr(Sr(),(o,n)=>{mM(o,e,t)}),jr(Mr(),(o,n)=>{mM(o,e,t)}),jr(Cr(),(o,n)=>{gM(o,e,t)})])}),yM=[xs("contextual",[is("fadeInClass"),is("fadeOutClass"),is("transitionClass"),cs("lazyContext"),Ni("onShow"),Ni("onShown"),Ni("onHide"),Ni("onHidden")]),Ts("lazyViewport",()=>({bounds:on(),optScrollEnv:A.none()})),Es("modes",["top","bottom"],Pn),Ni("onDocked"),Ni("onUndocked")];const xM=Ml({fields:yM,name:"docking",active:vM,apis:bM,state:Object.freeze({__proto__:null,init:e=>{const t=Ms(!1),o=Ms(!0),n=sc(),s=Ms(e.modes);return Ea({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:s.get,setModes:s.set,readState:()=>`docked: ${t.get()}, visible: ${o.get()}, modes: ${s.get().join(",")}`})}})}),wM=x(da("toolbar-height-change")),SM={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},CM="tox-tinymce--toolbar-sticky-on",OM="tox-tinymce--toolbar-sticky-off",kM=(e,t)=>R(xM.getModes(e),t),_M=e=>{const t=e.element;it(t).each(o=>{const n="padding-"+xM.getModes(e)[0];if(xM.isDocked(e)){const e=Qt(o);It(t,"width",e+"px"),It(o,n,(e=>$t(e)+(parseInt(Nt(e,"margin-top"),10)||0)+(parseInt(Nt(e,"margin-bottom"),10)||0))(t)+"px")}else Pt(t,"width"),Pt(o,n)})},TM=(e,t)=>{t?($a(e,SM.fadeOutClass),Ya(e,[SM.transitionClass,SM.fadeInClass])):($a(e,SM.fadeInClass),Ya(e,[SM.fadeOutClass,SM.transitionClass]))},EM=(e,t)=>{const o=Le(e.getContainer());t?(ja(o,CM),$a(o,OM)):(ja(o,OM),$a(o,CM))},AM=(e,t)=>{const o=sc(),n=t.getSink,s=e=>{n().each(t=>e(t.element))},r=t=>{e.inline||_M(t),EM(e,xM.isDocked(t)),t.getSystem().broadcastOn([tu()],{}),n().each(e=>e.getSystem().broadcastOn([tu()],{}))},a=e.inline?[]:[Fl.config({channels:{[wM()]:{onReceive:_M}}})];return[ih.config({}),xM.config({contextual:{lazyContext:t=>{const o=$t(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return A.from(n).map(n=>{const s=Qo(Le(n));return mC(e,t.element).fold(()=>{const e=s.height-o,n=s.y+(kM(t,"top")?0:o);return Zo(s.x,n,s.width,e)},e=>{const n=tn(s,gC(e)),r=kM(t,"top")?n.y:n.y+o;return Zo(n.x,r,n.width,n.height-o)})})},onShow:()=>{s(e=>TM(e,!0))},onShown:e=>{s(e=>Xa(e,[SM.transitionClass,SM.fadeInClass])),o.get().each(t=>{((e,t)=>{const o=ot(t);Vl(o).filter(e=>!et(t,e)).filter(t=>et(t,Le(o.dom.body))||tt(e,t)).each(()=>Nl(t))})(e.element,t),o.clear()})},onHide:e=>{((e,t)=>Hl(e).orThunk(()=>t().toOptional().bind(e=>Hl(e.element))))(e.element,n).fold(o.clear,o.set),s(e=>TM(e,!1))},onHidden:()=>{s(e=>Xa(e,[SM.transitionClass]))},...SM},lazyViewport:t=>mC(e,t.element).fold(()=>{const o=on(),n=$b(e),s=o.y+(kM(t,"top")?n:0),r=o.height-(kM(t,"bottom")?n:0);return{bounds:Zo(o.x,s,o.width,r),optScrollEnv:A.none()}},e=>({bounds:gC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})})),modes:[t.header.getDockingMode()],onDocked:r,onUndocked:r}),...a]};var MM=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",()=>{o().each(xM.reset)}),e.on("ResizeWindow ResizeEditor",()=>{o().each(_M)}),e.on("SkinLoaded",()=>{o().each(e=>{xM.isDocked(e)?xM.reset(e):xM.refresh(e)})}),e.on("FullscreenStateChanged",()=>{o().each(xM.reset)})),e.on("AfterScrollIntoView",e=>{o().each(t=>{xM.refresh(t);const o=t.element;Vg(o)&&((e,t)=>{const o=ot(t),n=rt(t).dom.innerHeight,s=jo(o),r=Le(e.elm),a=en(r),i=Gt(r),l=a.y,c=l+i,d=Kt(t),u=Gt(t),m=d.top,g=m+u,p=Math.abs(m-s.top)<2,h=Math.abs(g-(s.top+n))<2;if(p&&l<g)Go(s.left,l-u,o);else if(h&&c>m){const e=l-n+i+u;Go(s.left,e,o)}})(e,o)})}),e.on("PostRender",()=>{EM(e,!1)})},isDocked:e=>e().map(xM.isDocked).getOr(!1),getBehaviours:AM});const DM=In([vy,rs("items",Rn([zn([yy,ms("items",Pn)]),Pn]))].concat(Yy)),BM=[fs("text"),fs("tooltip"),fs("icon"),Ss("search",!1,Rn([Un,In([fs("placeholder")])],e=>d(e)?e?A.some({placeholder:A.none()}):A.none():A.some(e))),cs("fetch"),Ts("onSetup",()=>b)],IM=In([vy,...BM]),FM=e=>Xn("menubutton",IM,e),RM=In([vy,Iy,By,Dy,Ny,ky,Ay,ks("presets","normal",["normal","color","listpreview"]),Py(1),Ty,Ey]);var NM=wm({factory:(e,t)=>{const o={focus:$p.focusIn,setMenus:(e,o)=>{const n=V(o,e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())}},n=FM(o).mapError(e=>Zn(e)).getOrDie();return ET(n,"tox-mbtn",t.backstage,A.some("menuitem"))});th.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:El([th.config({}),oh("menubar-events",[Zr(t=>{e.onSetup(t)}),jr(Xs(),(e,t)=>{yi(e.element,".tox-mbtn--active").each(o=>{xi(t.event.target,".tox-mbtn").each(t=>{et(o,t)||e.getSystem().getByDom(o).each(o=>{e.getSystem().getByDom(t).each(e=>{ZS.expand(e),ZS.close(o),ih.focus(e)})})})})}),jr(Er(),(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=>{ZS.isOpen(o)&&(ZS.expand(e),ZS.close(o))})})})]),$p.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),A.some(!0))}),DC.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[ss("dom"),ss("uid"),ss("onEscape"),ss("backstage"),ws("onSetup",b)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const zM="container",LM=[xu("slotBehaviours",[])],VM=e=>"<alloy.field."+e+">",HM=(e,t)=>{const o=t=>um(e),n=(t,o)=>(n,s)=>im(n,e,s).map(e=>t(e,s)).getOr(o),s=(e,t)=>"true"!==Tt(e.element,"aria-hidden"),r=n(s,!1),a=n((e,t)=>{if(s(e)){const o=e.element;It(o,"display","none"),kt(o,"aria-hidden","true"),Nr(e,Ar(),{name:t,visible:!1})}}),i=(e=>(t,o)=>{H(o,o=>e(t,o))})(a),l=n((e,t)=>{if(!s(e)){const o=e.element;Pt(o,"display"),Mt(o,"aria-hidden"),Nr(e,Ar(),{name:t,visible:!0})}}),c={getSlotNames:o,getSlot:(t,o)=>im(t,e,o),isShowing:r,hideSlot:a,hideAllSlots:e=>i(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:wu(e.slotBehaviours),apis:c}},PM=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=>_a(e)),UM={...PM,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),om(zM,VM(t),o)),record:x(e)}})(),o=e(t),n=t.record(),s=V(n,e=>qu({name:e,pname:VM(e)}));return bm(zM,LM,s,HM,o)}},WM=In([By,Iy,Ts("onShow",b),Ts("onHide",b),Ay]),jM=e=>({element:()=>e.element.dom}),GM=(e,t)=>{const o=V(ae(t),e=>{const o=t[e],n=Kn((e=>Xn("sidebar",WM,e))(o));return{name:e,getApi:jM,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}});return V(o,t=>{const n=Ms(b);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:kx([$x(t,n),qx(t,n),jr(Ar(),(e,t)=>{const n=t.event,s=G(o,e=>e.name===n.name);s.each(t=>{(n.visible?t.onShow:t.onHide)(t.getApi(e))})})])})})},$M=e=>UM.sketch(t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:GM(t,e),slotBehaviours:kx([Zr(e=>UM.hideAllSlots(e))])})),qM=(e,t)=>{kt(e,"role",t)},YM=e=>_m.getCurrent(e).bind(e=>_T.isGrowing(e)||_T.hasGrown(e)?_m.getCurrent(e).bind(e=>G(UM.getSlotNames(e),t=>UM.isShowing(e,t))):A.none()),XM=da("FixSizeEvent"),KM=da("AutoSizeEvent");var JM=Object.freeze({__proto__:null,block:(e,t,o,n)=>{kt(e.element,"aria-busy",!0);const s=t.getRoot(e).getOr(e),r=El([$p.config({mode:"special",onTab:()=>A.some(!0),onShiftTab:()=>A.some(!0)}),ih.config({})]),a=n(s,r),i=s.getSystem().build(a);th.append(s,ui(i)),i.hasConfigured($p)&&t.focus&&$p.focusIn(i),o.isBlocked()||t.onBlock(e),o.blockWith(()=>th.remove(s,i))},unblock:(e,t,o)=>{Mt(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},isBlocked:(e,t,o)=>o.isBlocked()}),ZM=[Ts("getRoot",A.none),_s("focus",!0),Ni("onBlock"),Ni("onUnblock")];const QM=Ml({fields:ZM,name:"blocking",apis:JM,state:Object.freeze({__proto__:null,init:()=>{const e=oc(e=>e.destroy());return Ea({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})}),eD=e=>_m.getCurrent(e).each(e=>Nl(e.element,!0)),tD=(e,t,o)=>{const n=Ms(!1),s=sc(),r=o=>{var s;n.get()&&(!(e=>"focusin"===e.type)(s=o)||!(s.composed?oe(s.composedPath()):A.from(s.target)).map(Le).filter($e).exists(e=>qa(e,"mce-pastebin")))&&(o.preventDefault(),eD(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",()=>{e.dom.bind(e.getWin(),"focusin",r),e.on("BeforeExecCommand",e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&r(e)})});const a=s=>{s!==n.get()&&(n.set(s),((e,t,o,n)=>{const s=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;A.from(e.iframeElement).map(Le).each(e=>{t?(Et(e,o).each(t=>kt(e,n,t)),kt(e,o,-1)):(Mt(e,o),Et(e,n).each(t=>{kt(e,o,t),Mt(e,n)}))})})(e,o),o)QM.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:Kh('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}))(n)),Pt(s,"display"),Mt(s,"aria-hidden"),e.hasFocus()&&eD(t);else{const o=_m.getCurrent(t).exists(e=>Ll(e.element));QM.unblock(t),It(s,"display","none"),kt(s,"aria-hidden","true"),o&&e.focus()}})(e,t(),s,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,s))};e.on("ProgressState",t=>{if(s.on(clearTimeout),h(t.time)){const o=Yh.setEditorTimeout(e,()=>a(t.state),t.time);s.set(o)}else a(t.state),s.clear()})},oD=(e,t,o)=>({within:e,extra:t,withinWidth:o}),nD=(e,t,o)=>{const n=j(e,(e,t)=>((e,t)=>{const n=o(e);return A.some({element:e,start:t,finish:t+n,width:n})})(t,e.len).fold(x(e),t=>({len:t.finish,list:e.list.concat([t])})),{len:0,list:[]}).list,s=U(n,e=>e.finish<=t),r=W(s,(e,t)=>e+t.width,0);return{within:s,extra:n.slice(s.length),withinWidth:r}},sD=e=>V(e,e=>e.element),rD=(e,t)=>{const o=V(t,e=>ui(e));UA.setGroups(e,o)},aD=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const s=lm(e,t,"primary"),r=BS.getCoupled(e,"overflowGroup");It(s.element,"visibility","hidden");const a=n.concat([r]),i=re(a,e=>Hl(e.element).bind(t=>e.getSystem().getByDom(t).toOptional()));o([]),rD(s,a);const l=((e,t,o,n)=>{const s=((e,t,o)=>{const n=nD(t,e,o);return 0===n.extra.length?A.some(n):A.none()})(e,t,o).getOrThunk(()=>nD(t,e-o(n),o)),r=s.within,a=s.extra,i=s.withinWidth;return 1===a.length&&a[0].width<=o(n)?((e,t,o)=>{const n=sD(e.concat(t));return oD(n,[],o)})(r,a,i):a.length>=1?((e,t,o,n)=>{const s=sD(e).concat([o]);return oD(s,sD(t),n)})(r,a,n,i):((e,t,o)=>oD(sD(e),[],o))(r,0,i)})(Qt(s.element),t.builtGroups.get(),e=>Math.ceil(e.element.dom.getBoundingClientRect().width),r);0===l.extra.length?(th.remove(s,r),o([])):(rD(s,l.within),o(l.extra)),Pt(s.element,"visibility"),Ut(s.element),i.each(ih.focus)},iD=x([xu("splitToolbarBehaviours",[BS]),os("builtGroups",()=>Ms([]))]),lD=x([Fi(["overflowToggledClass"]),vs("getOverflowBounds"),ss("lazySink"),os("overflowGroups",()=>Ms([])),Ni("onOpened"),Ni("onClosed")].concat(iD())),cD=x([qu({factory:UA,schema:HA(),name:"primary"}),Yu({schema:HA(),name:"overflow"}),Yu({name:"overflow-button"}),Yu({name:"overflow-group"})]),dD=x((e,t)=>{((e,t)=>{const o=Zt.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);It(e,"max-width",o+"px")})(e,Math.floor(t))}),uD=x([Fi(["toggledClass"]),ss("lazySink"),cs("fetch"),vs("getBounds"),xs("fireDismissalEventInstead",[ws("event",_r())]),_c(),Ni("onToggled")]),mD=x([Yu({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:El([hh.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Yu({factory:UA,schema:HA(),name:"toolbar",overrides:e=>({toolbarBehaviours:El([$p.config({mode:"cyclic",onEscape:t=>(im(t,e,"button").each(ih.focus),A.none())})])})})]),gD=sc(),pD=(e,t)=>{const o=BS.getCoupled(e,"toolbarSandbox");Qd.isOpen(o)?Qd.close(o):Qd.open(o,t.toolbar())},hD=(e,t,o,n)=>{const s=o.getBounds.map(e=>e()),r=o.lazySink(e).getOrDie();Td.positionWithinBounds(r,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:dD()}}},s)},fD=(e,t,o,n,s)=>{UA.setGroups(t,s),hD(e,t,o,n),hh.on(e)},bD=Sm({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Xh.sketch({...n.button(),action:e=>{pD(e,n)},buttonBehaviours:Ou({dump:n.button().buttonBehaviours},[BS.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Si();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:El([$p.config({mode:"special",onEscape:e=>(Qd.close(e),A.some(!0))}),Qd.config({onOpen:(s,r)=>{const a=gD.get().getOr(!1);o.fetch().get(s=>{fD(e,r,o,t.layouts,s),n.link(e.element),a||$p.focusIn(r)})},onClose:()=>{hh.off(e),gD.get().getOr(!1)||ih.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>Ci(o,n)||Ci(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),Fl.config({channels:{...su({isExtraPart:T,...o.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...au({doReposition:()=>{Qd.getState(BS.getCoupled(e,"toolbarSandbox")).each(n=>{hD(e,n,o,t.layouts)})}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{Qd.getState(BS.getCoupled(t,"toolbarSandbox")).each(s=>{fD(t,s,e,o.layouts,n)})},reposition:t=>{Qd.getState(BS.getCoupled(t,"toolbarSandbox")).each(n=>{hD(t,n,e,o.layouts)})},toggle:e=>{pD(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{gD.set(!0),pD(e,t),gD.clear()})(e,n)},getToolbar:e=>Qd.getState(BS.getCoupled(e,"toolbarSandbox")),isOpen:e=>Qd.isOpen(BS.getCoupled(e,"toolbarSandbox"))}}),configFields:uD(),partFields:mD(),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)}}),vD=x([ss("items"),Fi(["itemSelector"]),xu("tgroupBehaviours",[$p])]),yD=x([Ku({name:"items",unit:"item"})]),xD=Sm({name:"ToolbarGroup",configFields:vD(),partFields:yD(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.tgroupBehaviours,[$p.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),wD=e=>V(e,e=>ui(e)),SD=(e,t,o)=>{aD(e,o,n=>{o.overflowGroups.set(n),t.getOpt(e).each(e=>{bD.setGroups(e,wD(n))})})},CD=Sm({name:"SplitFloatingToolbar",configFields:lD(),partFields:cD(),factory:(e,t,o,n)=>{const s=Jh(bD.sketch({fetch:()=>zS(t=>{t(wD(e.overflowGroups.get()))}),layouts:{onLtr:()=>[dl,cl],onRtl:()=>[cl,dl],onBottomLtr:()=>[ml,ul],onBottomRtl:()=>[ul,ml]},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:Su(e.splitToolbarBehaviours,[BS.config({others:{overflowGroup:()=>xD.sketch({...n["overflow-group"](),items:[s.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(V(o,t.getSystem().build)),SD(t,s,e)},refresh:t=>SD(t,s,e),toggle:e=>{s.getOpt(e).each(e=>{bD.toggle(e)})},toggleWithoutFocusing:e=>{s.getOpt(e).each(bD.toggleWithoutFocusing)},isOpen:e=>s.getOpt(e).map(bD.isOpen).getOr(!1),reposition:e=>{s.getOpt(e).each(e=>{bD.reposition(e)})},getOverflow:e=>s.getOpt(e).bind(bD.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)}}),OD=x([Fi(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),Ni("onOpened"),Ni("onClosed")].concat(iD())),kD=x([qu({factory:UA,schema:HA(),name:"primary"}),qu({factory:UA,schema:HA(),name:"overflow",overrides:e=>({toolbarBehaviours:El([_T.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{im(t,e,"overflow-button").each(e=>{hh.off(e),ih.focus(e)}),e.onClosed(t)},onGrown:t=>{$p.focusIn(t),e.onOpened(t)},onStartGrow:t=>{im(t,e,"overflow-button").each(hh.on)}}),$p.config({mode:"acyclic",onEscape:t=>(im(t,e,"overflow-button").each(ih.focus),A.some(!0))})])})}),Yu({name:"overflow-button",overrides:e=>({buttonBehaviours:El([hh.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])})}),Yu({name:"overflow-group"})]),_D=(e,t)=>{im(e,t,"overflow-button").bind(()=>im(e,t,"overflow")).each(o=>{TD(e,t),_T.toggleGrow(o)})},TD=(e,t)=>{im(e,t,"overflow").each(o=>{aD(e,t,e=>{const t=V(e,e=>ui(e));UA.setGroups(o,t)}),im(e,t,"overflow-button").each(e=>{_T.hasGrown(o)&&hh.on(e)}),_T.refresh(o)})},ED=Sm({name:"SplitSlidingToolbar",configFields:OD(),partFields:kD(),factory:(e,t,o,n)=>{const s="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:Su(e.splitToolbarBehaviours,[BS.config({others:{overflowGroup:e=>xD.sketch({...n["overflow-group"](),items:[Xh.sketch({...n["overflow-button"](),action:t=>{Rr(e,s)}})]})}}),oh("toolbar-toggle-events",[jr(s,t=>{_D(t,e)})])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=V(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),TD(t,e)},refresh:t=>TD(t,e),toggle:t=>_D(t,e),isOpen:t=>((e,t)=>im(e,t,"overflow").map(_T.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)}}),AD=e=>{const t=e.title.fold(()=>({}),e=>({attributes:{title:e}}));return{dom:{tag:"div",classes:["tox-toolbar__group"],...t},components:[xD.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:El([DC.config({}),ih.config({})])}},MD=e=>xD.sketch(AD(e)),DD=(e,t)=>{const o=Zr(t=>{const o=V(e.initGroups,MD);UA.setGroups(t,o)});return El([jx(e.providers.isDisabled),Px(),$p.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),oh("toolbar-events",[o])])},BD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":AD({title:A.none(),items:[]}),"overflow-button":eE({name:"more",icon:A.some("more-drawer"),enabled:!0,tooltip:A.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:A.none(),borderless:!1},A.none(),e.providers,[],"overflow-button")},splitToolbarBehaviours:DD(e,t)}},ID=e=>{const t=BD(e),o=CD.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return CD.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=en(t),n=st(t),s=en(n),r=Math.max(n.dom.scrollHeight,s.height);return Zo(o.x+4,s.y,o.width-8,r)},parts:{...t.parts,overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:e.attributes}}},components:[o],markers:{overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>e.onToggled(t,!0),onClosed:t=>e.onToggled(t,!1)})},FD=e=>{const t=ED.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=ED.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=BD(e);return ED.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([wM()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([wM()],{type:"closed"}),e.onToggled(t,!1)}})},RD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return UA.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===xb.scrolling?["tox-toolbar--scrolling"]:[])},components:[UA.parts.groups({})],toolbarBehaviours:DD(e,t)})},ND=[Dy,By,fs("tooltip"),ks("buttonType","secondary",["primary","secondary"]),_s("borderless",!1),cs("onAction")],zD={button:[...ND,wy,ls("type",["button"])],togglebutton:[...ND,_s("active",!1),ls("type",["togglebutton"])]},LD=[ls("type",["group"]),Es("buttons",[],Qn("type",zD))],VD=Qn("type",{...zD,group:LD}),HD=In([Es("buttons",[],VD),cs("onShow"),cs("onHide")]),PD=(e,t)=>((e,t)=>{var o,n;const s="togglebutton"===e.type,r=e.icon.map(e=>W_(e,t.icons)).map(Jh),a={...e,name:s?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:A.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},i=tE(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),l=s?e.text.map(t.translate):A.some(t.translate(e.text)),c=l.map(ai),d=a.tooltip.or(l).map(e=>({"aria-label":t.translate(e)})).getOr({}),u=r.map(e=>e.asSpec()),m=Kx([u,c]),g=e.icon.isSome()&&c.isSome(),p={tag:"button",classes:i.concat(...e.icon.isSome()&&!g?["tox-button--icon"]:[]).concat(...g?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:d},h=QT(a,A.some(o=>{const n=e=>{r.map(n=>n.getOpt(o).each(o=>{th.set(o,[W_(e,t.icons)])}))};return s?e.onAction({setIcon:n,setActive:e=>{const t=o.element;e?(ja(t,"tox-button--enabled"),kt(t,"aria-pressed",!0)):($a(t,"tox-button--enabled"),Mt(t,"aria-pressed"))},isActive:()=>qa(o.element,"tox-button--enabled")}):"button"===e.type?e.onAction({setIcon:n}):void 0}),[],p,m,e.tooltip,t);return Xh.sketch(h)})(e,t),UD=Io().deviceType,WD=UD.isPhone(),jD=UD.isTablet();var GD=Sm({name:"silver.View",configFields:[ss("viewConfig")],partFields:[Xu({factory:{sketch:e=>{let t=!1;const o=V(e.buttons,o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:V(e.buttons,e=>PD(e,t))}))(o,e.providers)):PD(o,e.providers));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...WD||jD?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:El([ih.config({}),$p.config({mode:"flow",selector:"button, .tox-button",focusInside:yg.OnEnterOrSpaceMode})]),components:t?o:[OC.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),OC.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[ss("buttons"),ss("providers")],name:"header"}),Xu({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const s={getPane:t=>FA.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,apis:s}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const $D=(e,t,o)=>pe(t,(t,n)=>{const s=Kn(Xn("view",HD,t));return e.slot(n,GD.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:s,components:[...s.buttons.length>0?[GD.parts.header({buttons:s.buttons,providers:o})]:[],GD.parts.pane({})]}))}),qD=(e,t)=>UM.sketch(o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:$D(o,e,t),slotBehaviours:kx([Zr(e=>UM.hideAllSlots(e))])})),YD=e=>G(UM.getSlotNames(e),t=>UM.isShowing(e,t)),XD=(e,t,o)=>{UM.getSlot(e,t).each(e=>{GD.getPane(e).each(t=>{var n;o(e)((n=t.element.dom,{getContainer:x(n)}))})})};var KD=wm({factory:(e,t)=>{const o={setViews:(e,o)=>{th.set(e,[qD(o,t.backstage.shared.providers)])},whichView:e=>_m.getCurrent(e).bind(YD),toggleView:(e,t,o,n)=>_m.getCurrent(e).exists(s=>{const r=YD(s),a=r.exists(e=>n===e),i=UM.getSlot(s,n).isSome();return i&&(UM.hideAllSlots(s),a?((e=>{const t=e.element;It(t,"display","none"),kt(t,"aria-hidden","true")})(e),t()):(o(),(e=>{const t=e.element;Pt(t,"display"),Mt(t,"aria-hidden")})(e),UM.showSlot(s,n),((e,t)=>{XD(e,t,GD.getOnShow)})(s,n)),r.each(e=>((e,t)=>XD(e,t,GD.getOnHide))(s,e))),i})};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:El([th.config({}),_m.config({find:e=>{const t=th.contents(e);return oe(t)}})]),apis:o}},name:"silver.ViewWrapper",configFields:[ss("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,s)=>e.toggleView(t,o,n,s),whichView:(e,t)=>e.whichView(t)}});const JD=RA.optional({factory:NM,name:"menubar",schema:[ss("backstage")]}),ZD=RA.optional({factory:{sketch:e=>VA.sketch({uid:e.uid,dom:e.dom,listBehaviours:El([$p.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>RD({type:e.type,uid:da("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),A.some(!0))}),setupItem:(e,t,o,n)=>{UA.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[ss("dom"),ss("onEscape")]}),QD=RA.optional({factory:{sketch:e=>{const t=(e=>e.type===xb.sliding?FD:e.type===xb.floating?ID:RD)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),A.some(!0)),onToggled:(t,o)=>e.onToolbarToggled(o),cyclicKeying:!1,initGroups:[],getSink:e.getSink,providers:e.providers,moreDrawerData:{lazyToolbar:e.lazyToolbar,lazyMoreButton:e.lazyMoreButton,lazyHeader:e.lazyHeader},attributes:e.attributes})}},name:"toolbar",schema:[ss("dom"),ss("onEscape"),ss("getSink")]}),eB=RA.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?AM:GA;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:El(o(t,e.sharedBackstage))}}},name:"header",schema:[ss("dom")]}),tB=RA.optional({name:"socket",schema:[ss("dom")]}),oB=RA.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:El([DC.config({}),ih.config({}),_T.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=>{_m.getCurrent(e).each(UM.hideAllSlots),Rr(e,KM)},onGrown:e=>{Rr(e,KM)},onStartGrow:e=>{Nr(e,XM,{width:Lt(e.element,"width").getOr("")})},onStartShrink:e=>{Nr(e,XM,{width:Qt(e.element)+"px"})}}),th.config({}),_m.config({find:e=>{const t=th.contents(e);return oe(t)}})])}],behaviours:El([s_(0),oh("sidebar-sliding-events",[jr(XM,(e,t)=>{It(e.element,"width",t.event.width)}),jr(KM,(e,t)=>{Pt(e.element,"width")})])])})},name:"sidebar",schema:[ss("dom")]}),nB=RA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:El([th.config({}),QM.config({focus:!1}),_m.config({find:e=>oe(e.components())})]),components:[]})},name:"throbber",schema:[ss("dom")]}),sB=RA.optional({factory:KD,name:"viewWrapper",schema:[ss("backstage")]}),rB=RA.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var aB=Sm({name:"OuterContainer",factory:(e,t,o)=>{let n=!1;const s={getSocket:t=>FA.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{FA.getPart(t,e,"sidebar").each(e=>((e,t,o)=>{_m.getCurrent(e).each(n=>{th.set(n,[$M(t)]);const s=null==o?void 0:o.toLowerCase();r(s)&&ve(t,s)&&_m.getCurrent(n).each(t=>{UM.showSlot(t,s),_T.immediateGrow(n),Pt(n.element,"width"),qM(e.element,"region")})})})(e,o,n))},toggleSidebar:(t,o)=>{FA.getPart(t,e,"sidebar").each(e=>((e,t)=>{_m.getCurrent(e).each(o=>{_m.getCurrent(o).each(n=>{_T.hasGrown(o)?UM.isShowing(n,t)?(_T.shrink(o),qM(e.element,"presentation")):(UM.hideAllSlots(n),UM.showSlot(n,t),qM(e.element,"region")):(UM.hideAllSlots(n),UM.showSlot(n,t),_T.grow(o),qM(e.element,"region"))})})})(e,o))},whichSidebar:t=>FA.getPart(t,e,"sidebar").bind(YM).getOrNull(),getHeader:t=>FA.getPart(t,e,"header"),getToolbar:t=>FA.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{FA.getPart(t,e,"toolbar").each(e=>{const t=V(o,MD);e.getApis().setGroups(e,t)})},setToolbars:(t,o)=>{FA.getPart(t,e,"multiple-toolbar").each(e=>{const t=V(o,e=>V(e,MD));VA.setItems(e,t)})},refreshToolbar:t=>{FA.getPart(t,e,"toolbar").each(e=>e.getApis().refresh(e))},toggleToolbarDrawer:t=>{FA.getPart(t,e,"toolbar").each(e=>{Ce(e.getApis().toggle,t=>t(e))})},toggleToolbarDrawerWithoutFocusing:t=>{FA.getPart(t,e,"toolbar").each(e=>{Ce(e.getApis().toggleWithoutFocusing,t=>t(e))})},isToolbarDrawerToggled:t=>FA.getPart(t,e,"toolbar").bind(e=>A.from(e.getApis().isOpen).map(t=>t(e))).getOr(!1),getThrobber:t=>FA.getPart(t,e,"throbber"),focusToolbar:t=>{FA.getPart(t,e,"toolbar").orThunk(()=>FA.getPart(t,e,"multiple-toolbar")).each(e=>{$p.focusIn(e)})},setMenubar:(t,o)=>{FA.getPart(t,e,"menubar").each(e=>{NM.setMenus(e,o)})},focusMenubar:t=>{FA.getPart(t,e,"menubar").each(e=>{NM.focus(e)})},setViews:(t,o)=>{FA.getPart(t,e,"viewWrapper").each(e=>{KD.setViews(e,o)})},toggleView:(t,o)=>FA.getPart(t,e,"viewWrapper").exists(e=>KD.toggleView(e,()=>s.showMainView(t),()=>s.hideMainView(t),o)),whichView:t=>FA.getPart(t,e,"viewWrapper").bind(KD.whichView).getOrNull(),hideMainView:t=>{n=s.isToolbarDrawerToggled(t),n&&s.toggleToolbarDrawer(t),FA.getPart(t,e,"editorContainer").each(e=>{const t=e.element;It(t,"display","none"),kt(t,"aria-hidden","true")})},showMainView:t=>{n&&s.toggleToolbarDrawer(t),FA.getPart(t,e,"editorContainer").each(e=>{const t=e.element;Pt(t,"display"),Mt(t,"aria-hidden")})}};return{uid:e.uid,dom:e.dom,components:t,apis:s,behaviours:e.behaviours}},configFields:[ss("dom"),ss("behaviours")],partFields:[eB,JD,QD,ZD,tB,oB,nB,sB,rB],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 iB={file:{title:"File",items:"newdocument restoredraft | preview | importword exportpdf exportword | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed inserttemplate codesample inserttable accordion | 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"}},lB=e=>e.split(" "),cB=(e,t)=>{const o={...iB,...t.menus},n=ae(t.menus).length>0,s=void 0===t.menubar||!0===t.menubar?lB("file edit view insert format tools table help"):lB(!1===t.menubar?"":t.menubar),a=U(s,e=>{const o=ve(iB,e);return n?o||be(t.menus,e).exists(e=>ve(e,"items")):o}),i=V(a,n=>{const s=o[n],r=lB("table"===n?Ev(e,s.items):s.items);return((e,t,o)=>{const n=Vb(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:s.title,items:r},t,e)});return U(i,e=>e.getItems().length>0&&N(e.getItems(),e=>r(e)||"separator"!==e.type))},dB=(e,t,o)=>(e.on("remove",()=>o.unload(t)),o.load(t)),uB=(e,t,o,n)=>(e.on("remove",()=>n.unloadRawCss(t)),n.loadRawCss(t,o)),mB=async(e,t)=>{const o="ui/"+pv(e).getOr("default")+"/skin.css",n=tinymce.Resource.get(o);return r(n)?Promise.resolve(uB(e,o,n,e.ui.styleSheetLoader)):dB(e,t+"/skin.min.css",e.ui.styleSheetLoader)},gB=async(e,t)=>{var o;if(o=Le(e.getElement()),yt(o).isSome()){const o="ui/"+pv(e).getOr("default")+"/skin.shadowdom.css",n=tinymce.Resource.get(o);return r(n)?(uB(e,o,n,Sb.DOM.styleSheetLoader),Promise.resolve()):dB(e,t+"/skin.shadowdom.min.css",Sb.DOM.styleSheetLoader)}},pB=(e,t)=>(async(e,t)=>{pv(t).fold(()=>{const o=gv(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")},o=>{const n="ui/"+o+(e?"/content.inline":"/content")+".css",s=tinymce.Resource.get(n);if(r(s))uB(t,n,s,t.ui.styleSheetLoader);else{const o=gv(t);o&&t.contentCSS.push(o+(e?"/content.inline":"/content")+".min.css")}});const o=gv(t);if(!uv(t)&&r(o))return Promise.all([mB(t,o),gB(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=>()=>((e,t)=>{e.dispatch("SkinLoadError",t)})(e,{message:"Skin could not be loaded"}))(t)),hB=C(pB,!1),fB=C(pB,!0),bB=(e,t,o)=>e.translate([t,e.translate(o)]),vB=(e,t)=>{const o=(o,s,r,a)=>{const i=e.shared.providers.translate(o.title);if("separator"===o.type)return A.some({type:"separator",text:i});if("submenu"===o.type){const e=Y(o.getStyleItems(),e=>n(e,s,a));return 0===s&&e.length<=0?A.none():A.some({type:"nestedmenuitem",text:i,enabled:e.length>0,getSubmenuItems:()=>Y(o.getStyleItems(),e=>n(e,s,a))})}return A.some({type:"togglemenuitem",text:i,icon:o.icon,active:o.isSelected(a),enabled:!r,onAction:t.onAction(o),...o.getStylePreview().fold(()=>({}),e=>({meta:{style:e}}))})},n=(e,n,s)=>{const r="formatter"===e.type&&t.isInvalid(e);return 0===n?r?[]:o(e,n,!1,s).toArray():o(e,n,r,s).toArray()},s=e=>{const o=t.getCurrentValue(),s=t.shouldHide?0:1;return Y(e,e=>n(e,s,o))};return{validateItems:s,getFetch:(e,t)=>(o,n)=>{const r=t(),a=s(r);n(J_(a,Dv.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:A.none()}))}}},yB=(e,t)=>{const o=t.dataset,n="basic"===o.type?()=>V(o.data,e=>aA(e,t.isSelectedFor,t.getPreviewFor)):o.getData;return{items:vB(e,t),getStyleItems:n}},xB=(e,t,o,n,s,r)=>{const{items:a,getStyleItems:i}=yB(t,o),l=Ms(o.tooltip);return q_({text:o.icon.isSome()?A.none():o.text,icon:o.icon,ariaLabel:A.some(o.tooltip),tooltip:A.none(),role:A.none(),fetch:a.getFetch(t,i),onSetup:t=>{const r=o=>t.setTooltip(bB(e,n,o.value));return e.on(s,r),Rw(Lw(e,"NodeChange",t=>{const n=t.getComponent();o.updateText(n),Hm.set(t.getComponent(),!e.selection.isEditable())})(t),()=>e.off(s,r))},getApi:e=>({getComponent:x(e),setTooltip:o=>{const n=t.shared.providers.translate(o);kt(e.element,"aria-label",n),l.set(o)}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[Nx.config({...t.shared.providers.tooltips.getConfig({tooltipText:t.shared.providers.translate(o.tooltip),onShow:e=>{if(o.tooltip!==l.get()){const o=t.shared.providers.translate(l.get());Nx.setComponents(e,t.shared.providers.tooltips.getComponents({tooltipText:o}))}}})})]},"tox-tbtn",t.shared,r)};var wB;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(wB||(wB={}));const SB=(e,t,o)=>{const n=(s=((e,t)=>t===wB.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o),V(s,e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}}));var s;return{type:"basic",data:n}},CB="Alignment {0}",OB="left",kB=[{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"}],_B=e=>{const t={type:"basic",data:kB};return{tooltip:bB(e,CB,OB),text:A.none(),icon:A.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:e=>A.none,onAction:t=>()=>G(kB,e=>e.format===t.format).each(t=>e.execCommand(t.command)),updateText:t=>{const o=G(kB,t=>e.formatter.match(t.format)).fold(x(OB),e=>e.title.toLowerCase());Nr(t,$_,{icon:`align-${o}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:o})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},TB=(e,t)=>{const o=t(),n=V(o,e=>e.format);return A.from(e.formatter.closest(n)).bind(e=>G(o,t=>t.format===e)).orThunk(()=>Oe(e.formatter.match("p"),{title:"Paragraph",format:"p"}))},EB="Block {0}",AB="Paragraph",MB=e=>{const t=SB(e,"block_formats",wB.SemiColon);return{tooltip:bB(e,EB,AB),text:A.some(AB),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:Vw(e),updateText:o=>{const n=TB(e,()=>t.data).fold(x(AB),e=>e.title);Nr(o,G_,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},DB="Font {0}",BB="System Font",IB=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],FB=e=>{const t=e.split(/\s*,\s*/);return V(t,e=>e.replace(/^['"]+|['"]+$/g,""))},RB=(e,t)=>t.length>0&&X(t,t=>e.indexOf(t.toLowerCase())>-1),NB=e=>{const t=()=>{const t=e=>e?FB(e)[0]:"",n=e.queryCommandValue("FontName"),s=o.data,r=n?n.toLowerCase():"",a=dv(e),i=G(s,e=>{const o=e.format;return o.toLowerCase()===r||t(o).toLowerCase()===t(r).toLowerCase()}).orThunk(()=>Oe(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=FB(e.toLowerCase());return RB(o,IB)||RB(o,t)}return!1})(r,a),{title:BB,format:r}));return{matchOpt:i,font:n}},o=SB(e,"font_family_formats",wB.SemiColon);return{tooltip:bB(e,DB,BB),text:A.some(BB),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>A.some({tag:"div",styles:-1===e.indexOf("dings")?{"font-family":e}:{}}),onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontName",!1,t.format)})},updateText:o=>{const{matchOpt:n,font:s}=t(),r=n.fold(x(s),e=>e.title);Nr(o,G_,{text:r}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:r})},dataset:o,shouldHide:!1,isInvalid:T}},zB={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:[""]},LB=(()=>{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}))(.*)$`)})(),VB=(e,t)=>A.from(LB.exec(e)).bind(e=>{const o=Number(e[1]),n=e[2];return((e,t)=>N(t,t=>N(zB[t],t=>e===t)))(n,t)?A.some({value:o,unit:n}):A.none()}),HB={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)},PB="Font size {0}",UB="12pt",WB={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},jB={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},GB=(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(jB,e).getOr(e),$B=e=>be(WB,e).getOr(""),qB=e=>{const t=()=>{let t=A.none();const o=n.data,s=e.queryCommandValue("FontSize");if(s)for(let e=3;t.isNone()&&e>=0;e--){const n=GB(s,e),r=$B(n);t=G(o,e=>e.format===s||e.format===n||e.format===r)}return{matchOpt:t,size:s}},o=x(A.none),n=SB(e,"font_size_formats",wB.Space);return{tooltip:bB(e,PB,UB),text:A.some(UB),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getPreviewFor:o,getCurrentValue:()=>{const{matchOpt:e}=t();return e},onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontSize",!1,t.format)})},updateText:o=>{const{matchOpt:n,size:s}=t(),r=n.fold(x(s),e=>e.title);Nr(o,G_,{text:r}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:r})},dataset:n,shouldHide:!1,isInvalid:T}},YB="Format {0}",XB=(e,t)=>{const o="Paragraph";return{tooltip:bB(e,YB,o),text:A.some(o),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:Vw(e),updateText:t=>{const n=e=>tA(e)?Y(e.items,n):oA(e)?[{title:e.title,format:e.format}]:[],s=Y(rA(e),n),r=TB(e,x(s)).fold(x(o),e=>e.title);Nr(t,G_,{text:r}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:r})},shouldHide:zb(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},KB=x([ss("toggleClass"),ss("fetch"),Li("onExecute"),ws("getHotspot",A.some),ws("getAnchorOverrides",x({})),_c(),Li("onItemExecute"),gs("lazySink"),ss("dom"),Ni("onOpen"),xu("splitDropdownBehaviours",[BS,$p,ih]),ws("matchWidth",!1),ws("useMinWidth",!1),ws("eventOrder",{}),gs("role")].concat(XS())),JB=qu({factory:Xh,schema:[ss("dom")],name:"arrow",defaults:()=>({buttonBehaviours:El([ih.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(zr)},buttonBehaviours:El([hh.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),ZB=qu({factory:Xh,schema:[ss("dom")],name:"button",defaults:()=>({buttonBehaviours:El([ih.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(o=>{e.onExecute(o,t)})}})}),QB=x([JB,ZB,Xu({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[ss("text")],name:"aria-descriptor"}),Yu({schema:[Ii()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each(n=>{e.onItemExecute(n,t,o)})}})}),HS()]),eI=Sm({name:"SplitDropdown",configFields:KB(),partFields:QB(),factory:(e,t,o,n)=>{const s=e=>{_m.getCurrent(e).each(e=>{Km.highlightFirst(e),$p.focusIn(e)})},r=t=>{jS(e,w,t,n,s,jh.HighlightMenuAndItem).get(b)},a=t=>{const o=lm(t,e,"button");return zr(o),A.some(!0)},i={...Pr([Zr((t,o)=>{im(t,e,"aria-descriptor").each(e=>{const o=da("aria");kt(e.element,"id",o),kt(t.element,"aria-describedby",o)})})]),...vh(A.some(r))},l={repositionMenus:e=>{hh.isOn(e)&&YS(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:l,eventOrder:{...e.eventOrder,[gr()]:["disabling","toggling","alloy.base.behaviour"]},events:i,behaviours:Su(e.splitDropdownBehaviours,[BS.config({others:{sandbox:t=>{const o=lm(t,e,"arrow");return qS(e,t,{onOpen:()=>{hh.on(o),hh.on(t)},onClose:()=>{hh.off(o),hh.off(t)}})}}}),$p.config({mode:"special",onSpace:a,onEnter:a,onDown:e=>(r(e),A.some(!0))}),ih.config({}),hh.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),tI=e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setText:t=>Nr(e,G_,{text:t}),setIcon:t=>Nr(e,$_,{icon:t})}),oI=e=>({setActive:t=>{hh.set(e,t)},isActive:()=>hh.isOn(e),isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setText:t=>Nr(e,G_,{text:t}),setIcon:t=>Nr(e,$_,{icon:t})}),nI=(e,t)=>e.map(e=>({"aria-label":t.translate(e)})).getOr({}),sI=da("focus-button"),rI=(e,t,o,n,s,r)=>{const a=t.map(e=>Jh(j_(e,"tox-tbtn",s))),i=e.map(e=>Jh(W_(e,s.icons)));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:{...nI(o,s),...g(r)?{"data-mce-name":r}:{}}},components:Kx([i.map(e=>e.asSpec()),a.map(e=>e.asSpec())]),eventOrder:{[Gs()]:["focusing","alloy.base.behaviour",L_],[Or()]:[L_,"toolbar-group-button-events"]},buttonBehaviours:El([jx(s.isDisabled),Px(),oh(L_,[Zr((e,t)=>H_(e)),jr(G_,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[ai(s.translate(t.event.text))])})}),jr($_,(e,t)=>{i.bind(t=>t.getOpt(e)).each(e=>{th.set(e,[W_(t.event.icon,s.icons)])})}),jr(Gs(),(e,t)=>{t.event.prevent(),Rr(e,sI)})])].concat(n.getOr([])))}},aI=(e,t,o,n)=>{var s;const r=Ms(b),a=rI(e.icon,e.text,e.tooltip,A.none(),o,n);return Xh.sketch({dom:a.dom,components:a.components,eventOrder:V_,buttonBehaviours:{...El([oh("toolbar-button-events",[(i={onAction:e.onAction,getApi:t.getApi},ta((e,t)=>{Gx(i,e)(t=>{Nr(e,z_,{buttonApi:t}),i.onAction(t)})})),$x(t,r),qx(t,r)]),...e.tooltip.map(t=>Nx.config(o.tooltips.getConfig({tooltipText:o.translate(t)+e.shortcut.map(e=>` (${Qx(e)})`).getOr("")}))).toArray(),jx(()=>!e.enabled||o.isDisabled()),Px()].concat(t.toolbarButtonBehaviours)),[L_]:null===(s=a.buttonBehaviours)||void 0===s?void 0:s[L_]}});var i},iI=(e,t,o,n)=>aI(e,{toolbarButtonBehaviours:o.length>0?[oh("toolbarButtonWith",o)]:[],getApi:tI,onSetup:e.onSetup},t,n),lI=(e,t,o,n)=>aI(e,{toolbarButtonBehaviours:[th.config({}),hh.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[oh("toolbarToggleButtonWith",o)]:[]),getApi:oI,onSetup:e.onSetup},t,n),cI=(e,t,o)=>n=>zS(e=>t.fetch(e)).map(s=>A.from(aC(vn(yS(da("menu-value"),s,o=>{t.onItemAction(e(n),o)},t.columns,t.presets,Dv.CLOSE_ON_EXECUTE,t.select.getOr(T),o),{movement:wS(t.columns,t.presets),menuBehaviours:kx("auto"!==t.columns?[]:[Zr((e,o)=>{Ox(e,4,Wv(t.presets)).each(({numRows:t,numColumns:o})=>{$p.setGridSize(e,t,o)})})])})))),dI=[{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"]}],uI=(e,t)=>(o,n,s,r)=>{const a=e(o).mapError(e=>Zn(e)).getOrDie();return t(a,n,s,r)},mI={button:uI(Ky,(e,t,o,n)=>((e,t,o)=>iI(e,t,[],o))(e,t.shared.providers,n)),togglebutton:uI(Qy,(e,t,o,n)=>((e,t,o)=>lI(e,t,[],o))(e,t.shared.providers,n)),menubutton:uI(FM,(e,t,o,n)=>ET(e,"tox-tbtn",t,A.none(),!1,n)),splitbutton:uI(e=>Xn("SplitButton",RM,e),(e,t,o,n)=>((e,t,o)=>{const n=Ms(e.tooltip.getOr("")),s=e=>({isEnabled:()=>!Hm.isDisabled(e),setEnabled:t=>Hm.set(e,!t),setIconFill:(t,o)=>{yi(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{kt(e,"fill",o)})},setActive:t=>{kt(e.element,"aria-pressed",t),yi(e.element,"span").each(o=>{e.getSystem().getByDom(o).each(e=>hh.set(e,t))})},isActive:()=>yi(e.element,"span").exists(t=>e.getSystem().getByDom(t).exists(hh.isOn)),setText:t=>yi(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Nr(e,G_,{text:t}))),setIcon:t=>yi(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Nr(e,$_,{icon:t}))),setTooltip:o=>{const s=t.providers.translate(o);kt(e.element,"aria-label",s),n.set(o)}}),r=Ms(b),a={getApi:s,onSetup:e.onSetup};return eI.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...nI(e.tooltip,t.providers),...g(o)?{"data-mce-name":o}:{}}},onExecute:t=>{const o=s(t);o.isEnabled()&&e.onAction(o)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:El([Wx(t.providers.isDisabled),Px(),oh("split-dropdown-events",[Zr((e,t)=>H_(e)),jr(sI,ih.focus),$x(a,r),qx(a,r)]),nO.config({}),...e.tooltip.map(e=>Nx.config({...t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e),onShow:o=>{if(n.get()!==e){const e=t.providers.translate(n.get());Nx.setComponents(o,t.providers.tooltips.getComponents({tooltipText:e}))}}})})).toArray()]),eventOrder:{[Or()]:["alloy.base.behaviour","split-dropdown-events","tooltipping"],[kr()]:["split-dropdown-events","tooltipping"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:cI(s,e,t.providers),parts:{menu:Xv(0,e.columns,e.presets)},components:[eI.parts.button(rI(e.icon,e.text,A.none(),A.some([hh.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),eI.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:pb("chevron-down",t.providers.icons)},buttonBehaviours:El([Wx(t.providers.isDisabled),Px(),hb()])}),eI.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})})(e,t.shared,n)),grouptoolbarbutton:uI(e=>Xn("GroupToolbarButton",DM,e),(e,t,o,n)=>{const s=o.ui.registry.getAll().buttons,r={[Oc]:t.shared.header.isPositionedAtTop()?Cc.TopToBottom:Cc.BottomToTop};if(Hb(o)===xb.floating)return((e,t,o,n,s)=>{const r=t.shared,a=Ms(b),i={toolbarButtonBehaviours:[],getApi:tI,onSetup:e.onSetup},l=[oh("toolbar-group-button-events",[$x(i,a),qx(i,a)])];return bD.sketch({lazySink:r.getSink,fetch:()=>zS(t=>{t(V(o(e.items),MD))}),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:rI(e.icon,e.text,e.tooltip,A.some(l),r.providers,s),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,e=>pI(o,{buttons:s,toolbar:e,allowToolbarGroups:!1},t,A.none()),r,n);throw new Error("Toolbar groups are only supported when using floating toolbar mode")})},gI={styles:(e,t)=>{const o={type:"advanced",...t.styles};return xB(e,t,XB(e,o),YB,"StylesTextUpdate","styles")},fontsize:(e,t)=>xB(e,t,qB(e),PB,"FontSizeTextUpdate","fontsize"),fontsizeinput:(e,t)=>((e,t,o,n)=>{let s=A.none();const r=Lw(e,"NodeChange SwitchMode",t=>{const n=t.getComponent();s=A.some(n),o.updateInputValue(n),Hm.set(n,!e.selection.isEditable())}),a=e=>({getComponent:x(e)}),i=Ms(b),l=da("custom-number-input-events"),c=(e,t,n)=>{const r=s.map(e=>yu.getValue(e)).getOr(""),a=o.getNewValue(r,e),i=r.length-`${a}`.length,l=s.map(e=>e.element.dom.selectionStart-i),c=s.map(e=>e.element.dom.selectionEnd-i);o.onAction(a,n),s.each(e=>{yu.setValue(e,a),t&&(l.each(t=>e.element.dom.selectionStart=t),c.each(t=>e.element.dom.selectionEnd=t))})},d=(e,t)=>c((e,t)=>e-t,e,t),u=(e,t)=>c((e,t)=>e+t,e,t),m=e=>it(e.element).fold(A.none,e=>(Nl(e),A.some(!0))),p=e=>Ll(e.element)?(ut(e.element).each(e=>Nl(e)),A.some(!0)):A.none(),h=(o,n,s,r)=>{const i=Ms(b),l=t.shared.providers.translate(s),c=da("altExecuting"),d=Lw(e,"NodeChange SwitchMode",t=>{Hm.set(t.getComponent(),!e.selection.isEditable())}),u=e=>{Hm.isDisabled(e)||o(!0)};return Xh.sketch({dom:{tag:"button",attributes:{"aria-label":l,"data-mce-name":n},classes:r.concat(n)},components:[U_(n,t.shared.providers.icons)],buttonBehaviours:El([Hm.config({}),Nx.config(t.shared.providers.tooltips.getConfig({tooltipText:l})),oh(c,[$x({onSetup:d,getApi:a},i),qx({getApi:a},i),jr(Zs(),(e,t)=>{t.event.raw.keyCode!==HB.space()&&t.event.raw.keyCode!==HB.enter()||Hm.isDisabled(e)||o(!1)}),jr(or(),u),jr(Ws(),u)])]),eventOrder:{[Zs()]:[c,"keying"],[or()]:[c,"alloy.base.behaviour"],[Ws()]:[c,"alloy.base.behaviour"],[Or()]:["alloy.base.behaviour",c,"tooltipping"],[kr()]:[c,"tooltipping"]}})},f=Jh(h(e=>d(!1,e),"minus","Decrease font size",[])),v=Jh(h(e=>u(!1,e),"plus","Increase font size",[])),y=Jh({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[ey.sketch({inputBehaviours:El([Hm.config({}),oh(l,[$x({onSetup:r,getApi:a},i),qx({getApi:a},i)]),oh("input-update-display-text",[jr(G_,(e,t)=>{yu.setValue(e,t.event.text)}),jr(Js(),e=>{o.onAction(yu.getValue(e))}),jr(tr(),e=>{o.onAction(yu.getValue(e))})]),$p.config({mode:"special",onEnter:e=>(c(w,!0,!0),A.some(!0)),onEscape:m,onUp:e=>(u(!0,!1),A.some(!0)),onDown:e=>(d(!0,!1),A.some(!0)),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})],behaviours:El([ih.config({}),$p.config({mode:"special",onEnter:p,onSpace:p,onEscape:m}),oh("input-wrapper-events",[jr(Xs(),e=>{H([f,v],t=>{const o=Le(t.get(e).element.dom);Ll(o)&&zl(o)})})])])});return{dom:{tag:"div",classes:["tox-number-input"],attributes:{...g(n)?{"data-mce-name":n}:{}}},components:[f.asSpec(),y.asSpec(),v.asSpec()],behaviours:El([ih.config({}),$p.config({mode:"flow",focusInside:yg.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>Ll(e.element)?A.none():(Nl(e.element),A.some(!0))})])}})(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>Nr(e,G_,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{VB(o,["unsupportedLength","empty"]);const s=t(),r=VB(o,["unsupportedLength","empty"]).or(VB(s,["unsupportedLength","empty"])),a=r.map(e=>e.value).getOr(16),i=Jb(e),l=r.map(e=>e.unit).filter(e=>""!==e).getOr(i),c=n(a,(e=>{var t;return null!==(t={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[e])&&void 0!==t?t:{step:1}})(l).step),d=`${(e=>e>=0)(c)?c:a}${l}`;return d!==s&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e),"fontsizeinput"),fontfamily:(e,t)=>xB(e,t,NB(e),DB,"FontFamilyTextUpdate","fontfamily"),blocks:(e,t)=>xB(e,t,MB(e),EB,"BlocksTextUpdate","blocks"),align:(e,t)=>xB(e,t,_B(e),CB,"AlignTextUpdate","align")},pI=(e,t,o,n)=>{const s=(e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=V(dI,t=>{const o=U(t.items,t=>ve(e,t)||ve(gI,t));return{name:t.name,items:o}});return U(t,e=>e.items.length>0)})(o):r(t)?(e=>{const t=e.split("|");return V(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[]"),[])})(t),a=V(s,s=>{const r=Y(s.items,s=>0===s.trim().length?[]:((e,t,o,n,s,r)=>be(t,o.toLowerCase()).orThunk(()=>r.bind(e=>re(e,e=>be(t,e+o.toLowerCase())))).fold(()=>be(gI,o.toLowerCase()).map(t=>t(e,s)),t=>"grouptoolbarbutton"!==t.type||n?((e,t,o,n)=>be(mI,e.type).fold(()=>(console.error("skipping button defined by",e),A.none()),s=>A.some(s(e,t,o,n))))(t,s,e,o.toLowerCase()):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),A.none())))(e,t.buttons,s,t.allowToolbarGroups,o,n).toArray());return{title:A.from(e.translate(s.name)),items:r}});return U(a,e=>e.items.length>0)},hI=(e,t,o,n)=>{const s=t.mainUi.outerContainer,a=o.toolbar,i=o.buttons;if(f(a,r)){const t=a.map(t=>{const s={toolbar:t,buttons:i,allowToolbarGroups:o.allowToolbarGroups};return pI(e,s,n,A.none())});aB.setToolbars(s,t)}else aB.setToolbar(s,pI(e,o,n,A.none()))},fI=Io(),bI=fI.os.isiOS()&&fI.os.version.major<=12;var vI=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=t,i=Ms(0),l=r.outerContainer;hB(e);const d=Le(s.targetNode),u=vt(bt(d));Hd(d,r.mothership),((e,t,o)=>{kv(e)&&Hd(o.mainUi.mothership.element,o.popupUi.mothership),Vd(t,o.dialogUi.mothership)})(e,u,t),e.on("SkinLoaded",()=>{aB.setSidebar(l,o.sidebar,lv(e)),hI(e,t,o,n),i.set(e.getWin().innerWidth),aB.setMenubar(l,cB(e,o)),aB.setViews(l,o.views),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let s=e.getWin();const r=e.getDoc().documentElement,a=Ms(Yt(s.innerWidth,s.innerHeight)),i=Ms(Yt(r.offsetWidth,r.offsetHeight)),l=()=>{const t=a.get();t.left===s.innerWidth&&t.top===s.innerHeight||(a.set(Yt(s.innerWidth,s.innerHeight)),Bw(e))},c=()=>{const t=e.getDoc().documentElement,o=i.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(i.set(Yt(t.offsetWidth,t.offsetHeight)),Bw(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(s,"resize",l),n.bind(s,"scroll",d);const u=ic(Le(e.getBody()),"load",c);e.on("hide",()=>{H(o,e=>{It(e.element,"display","none")})}),e.on("show",()=>{H(o,e=>{Pt(e.element,"display")})}),e.on("NodeChange",c),e.on("remove",()=>{u.unbind(),n.unbind(s,"resize",l),n.unbind(s,"scroll",d),s=null})})(e,t)});const m=aB.getSocket(l).getOrDie("Could not find expected socket element");if(bI){Ft(m.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=(e=>{let t=null;return{cancel:()=>{c(t)||(clearTimeout(t),t=null)},throttle:(...o)=>{c(t)&&(t=setTimeout(()=>{t=null,e.apply(null,o)},20))}}})(()=>{e.dispatch("ScrollContent")}),o=ac(m.element,"scroll",t.throttle);e.on("remove",o.unbind)}Hx(e,t),e.addCommand("ToggleSidebar",(t,o)=>{aB.toggleSidebar(l,o),e.dispatch("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",()=>{var e;return null!==(e=aB.whichSidebar(l))&&void 0!==e?e:""}),e.addCommand("ToggleView",(t,o)=>{if(aB.toggleView(l,o)){const t=l.element;r.mothership.broadcastOn([eu()],{target:t}),H(a,e=>{e.broadcastOn([eu()],{target:t})}),c(aB.whichView(l))&&(e.focus(),e.nodeChanged(),aB.refreshToolbar(l))}}),e.addQueryValueHandler("ToggleView",()=>{var e;return null!==(e=aB.whichView(l))&&void 0!==e?e:""});const g=Hb(e);g!==xb.sliding&&g!==xb.floating||e.on("ResizeWindow ResizeEditor ResizeContent",()=>{const o=e.getWin().innerWidth;o!==i.get()&&(aB.refreshToolbar(t.mainUi.outerContainer),i.set(o))});const p={setEnabled:e=>{Vx(t,!e)},isEnabled:()=>!Hm.isDisabled(l)};return{iframeContainer:m.element.dom,editorContainer:l.element.dom,api:p}}});const yI=e=>/^[0-9\.]+(|px)$/i.test(""+e)?A.some(parseInt(""+e,10)):A.none(),xI=e=>h(e)?e+"px":e,wI=(e,t,o)=>{const n=t.filter(t=>e<t),s=o.filter(t=>e>t);return n.or(s).getOr(e)},SI=e=>{const t=Mb(e),o=Db(e),n=Ib(e);return yI(t).map(e=>wI(e,o,n))},{ToolbarLocation:CI,ToolbarMode:OI}=Av,kI=(e,t,o,n,s)=>{const{mainUi:r,uiMotherships:a}=o,i=Sb.DOM,l=wv(e),c=Ov(e),d=Ib(e).or(SI(e)),u=n.shared.header,m=u.isPositionedAtTop,g=Hb(e),p=g===OI.sliding||g===OI.floating,h=Ms(!1),f=()=>h.get()&&!e.removed,b=e=>p?e.fold(x(0),e=>e.components().length>1?Gt(e.components()[1].element):0):0,v=()=>{H(a,e=>{e.broadcastOn([tu()],{})})},y=o=>{if(!f())return;l||s.on(e=>{const o=d.getOrThunk(()=>{const e=yI(Nt(St(),"margin-left")).getOr(0);return Qt(St())-Kt(t).left+e});It(e.element,"max-width",o+"px")});const n=!(l||l||!(Kt(r.outerContainer.element).left+eo(r.outerContainer.element)>=window.innerWidth-40||Lt(r.outerContainer.element,"width").isSome())||(It(r.outerContainer.element,"position","absolute"),It(r.outerContainer.element,"left","0px"),Pt(r.outerContainer.element,"width"),0));p&&aB.refreshToolbar(r.outerContainer),l||(o=>{s.on(n=>{const s=aB.getToolbar(r.outerContainer),a=b(s),i=Qo(t),l=((e,t)=>kv(e)?YA(t):A.none())(e,r.outerContainer.element),c=l.fold(()=>i.x,e=>{const t=Qo(e);return et(e,St())?i.x:i.x-t.x}),d=Oe(o,Math.ceil(r.outerContainer.element.dom.getBoundingClientRect().width)).filter(e=>e>150).map(e=>{const t=jo(),o=window.innerWidth-(c-t.left),n=Math.max(Math.min(e,o),150);return o<e&&It(r.outerContainer.element,"width",n+"px"),{width:n+"px"}}).getOr({}),u={position:"absolute",left:Math.round(c)+"px",top:l.fold(()=>m()?Math.max(i.y-Gt(n.element)+a,0):i.bottom,e=>{var t;const o=Qo(e),s=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,r=et(e,St())?Math.max(i.y-Gt(n.element)+a,0):i.y-o.y+s-Gt(n.element)+a;return m()?r:i.bottom})+"px"};Ft(r.outerContainer.element,{...u,...d})})})(n),c&&s.on(o),v()},w=()=>!(l||!c||!f())&&s.get().exists(o=>{const n=u.getDockingMode(),a=(o=>{switch(Ub(e)){case CI.auto:const e=aB.getToolbar(r.outerContainer),n=b(e),s=Gt(o.element)-n,a=Qo(t);if(a.y>s)return"top";{const e=st(t),o=Math.max(e.dom.scrollHeight,Gt(e));return a.bottom<o-s||on().bottom<a.bottom-s?"bottom":"top"}case CI.bottom:return"bottom";case CI.top:default:return"top"}})(o);return a!==n&&(i=a,s.on(e=>{xM.setModes(e,[i]),u.setDockingMode(i);const t=m()?Cc.TopToBottom:Cc.BottomToTop;kt(e.element,Oc,t)}),!0);var i});return{isVisible:f,isPositionedAtTop:m,show:()=>{h.set(!0),It(r.outerContainer.element,"display","flex"),i.addClass(e.getBody(),"mce-edit-focus"),H(a,e=>{Pt(e.element,"display")}),w(),kv(e)?y(e=>xM.isDocked(e)?xM.reset(e):xM.refresh(e)):y(xM.refresh)},hide:()=>{h.set(!1),It(r.outerContainer.element,"display","none"),i.removeClass(e.getBody(),"mce-edit-focus"),H(a,e=>{It(e.element,"display","none")})},update:y,updateMode:()=>{w()&&y(xM.reset)},repositionPopups:v}},_I=(e,t)=>{const o=Qo(e);return{pos:t?o.y:o.bottom,bounds:o}};var TI=Object.freeze({__proto__:null,render:(e,t,o,n,s)=>{const{mainUi:r}=t,a=sc(),i=Le(s.targetNode),l=kI(e,i,t,n,a),c=Gb(e);fB(e);const d=()=>{if(a.isSet())return void l.show();a.set(aB.getHeader(r.outerContainer).getOrDie());const s=Sv(e);kv(e)?(Hd(i,r.mothership),Hd(i,t.popupUi.mothership)):Vd(s,r.mothership),Vd(s,t.dialogUi.mothership);const d=()=>{hI(e,t,o,n),aB.setMenubar(r.outerContainer,cB(e,o)),l.show(),((e,t,o,n)=>{const s=Ms(_I(t,o.isPositionedAtTop())),r=n=>{const{pos:r,bounds:a}=_I(t,o.isPositionedAtTop()),{pos:i,bounds:l}=s.get(),c=a.height!==l.height||a.width!==l.width;s.set({pos:r,bounds:a}),c&&Bw(e,n),o.isVisible()&&(i!==r?o.update(xM.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",()=>o.update(xM.reset)),e.on("NodeChange keydown",e=>{requestAnimationFrame(()=>r(e))});let a=0;const i=p_(()=>o.update(xM.refresh),33);e.on("ScrollWindow",()=>{const e=jo().left;e!==a&&(a=e,i.throttle()),o.updateMode()}),kv(e)&&e.on("ElementScroll",e=>{o.update(xM.refresh)});const l=nc();l.set(ic(Le(e.getBody()),"load",e=>r(e.raw))),e.on("remove",()=>{l.clear()})})(e,i,l,c),e.nodeChanged()};c?e.once("SkinLoaded",d):d()};e.on("show",d),e.on("hide",l.hide),c||(e.on("focus",d),e.on("blur",l.hide)),e.on("init",()=>{(e.hasFocus()||c)&&d()}),Hx(e,t);const u={show:d,hide:l.hide,setEnabled:e=>{Vx(t,!e)},isEnabled:()=>!Hm.isDisabled(r.outerContainer)};return{editorContainer:r.outerContainer.element.dom,api:u}}});const EI="contexttoolbar-hide",AI=(e,t)=>jr(z_,(o,n)=>{const s=(e=>({hide:()=>Rr(e,br()),getValue:()=>yu.getValue(e)}))(e.get(o));t.onAction(s,n.event.buttonApi)}),MI=(e,t)=>{const o=e.label.fold(()=>({}),e=>({"aria-label":e})),n=Jh(ey.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:e.initValue(),inputAttributes:o,selectOnFocus:!0,inputBehaviours:El([$p.config({mode:"special",onEnter:e=>s.findPrimary(e).map(e=>(zr(e),!0)),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})),s=((e,t,o)=>{const n=V(t,t=>Jh(((e,t,o)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o)=>{const{primary:n,...s}=t.original,r=Kn(Qy({...s,type:"togglebutton",onAction:b}));return lI(r,o,[AI(e,t)])})(e,t,o):((e,t,o)=>{const{primary:n,...s}=t.original,r=Kn(Ky({...s,type:"button",onAction:b}));return iI(r,o,[AI(e,t)])})(e,t,o))(e,t,o)));return{asSpecs:()=>V(n,e=>e.asSpec()),findPrimary:e=>re(t,(t,o)=>t.primary?A.from(n[o]).bind(t=>t.getOpt(e)).filter(O(Hm.isDisabled)):A.none())}})(n,e.commands,t);return[{title:A.none(),items:[n.asSpec()]},{title:A.none(),items:s.asSpecs()}]},DI=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,BI=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=gt(Le(e.startContainer),e.startOffset).element;return(qe(o)?at(o):A.some(o)).filter($e).map(e=>e.dom.getBoundingClientRect()).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=jo();return Zo(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=en(Le(e.getBody()));return Zo(o.x+t.left,o.y+t.top,t.width,t.height)}},II=(e,t,o,n=0)=>{const s=qo(window),r=Qo(Le(e.getContentAreaContainer())),a=mv(e)||fv(e)||vv(e),{x:i,width:l}=((e,t,o)=>{const n=Math.max(e.x+o,t.x);return{x:n,width:Math.min(e.right-o,t.right)-n}})(r,s,n);if(e.inline&&!a)return Zo(i,s.y,l,s.height);{const a=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,s,r)=>{const a=Le(e.getContainer()),i=yi(a,".tox-editor-header").getOr(a),l=Qo(i),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+r,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-r,o.bottom)};const u="line"===s?Qo(a):t;return d?{y:Math.max(l.bottom+r,o.y),bottom:Math.min(u.bottom-r,o.bottom)}:{y:Math.max(u.y+r,o.y),bottom:Math.min(l.y-r,o.bottom)}})(e,r,s,a,o,n);return Zo(i,c,l,d-c)}},FI={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"]},RI={maxHeightFunction:pc(),maxWidthFunction:dD()},NI=e=>"node"===e,zI=(e,t,o,n,s)=>{const r=BI(e),a=n.lastElement().exists(e=>et(o,e));return((e,t)=>{const o=e.selection.getRng(),n=gt(Le(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&et(n.element,t)})(e,o)?a?HE:RE:a?((e,o)=>{const s=Lt(e,"position");It(e,"position",o);const a=DI(r,Qo(t),-20)&&!n.isReposition()?UE:HE;return s.each(t=>It(e,"position",t)),a})(t,n.getMode()):("fixed"===n.getMode()?s.y+jo().top:s.y)+(Gt(t)+12)<=r.y?RE:NE},LI=(e,t,o,n)=>{const s=t=>(n,s,r,a,i)=>({...zI(e,a,t,o,i)({...n,y:i.y,height:i.height},s,r,a,i),alwaysFit:!0}),r=e=>NI(n)?[s(e)]:[];return t?{onLtr:e=>[pl,cl,dl,ul,ml,gl].concat(r(e)),onRtl:e=>[pl,dl,cl,ml,ul,gl].concat(r(e))}:{onLtr:e=>[gl,pl,ul,cl,ml,dl].concat(r(e)),onRtl:e=>[gl,pl,ml,dl,ul,cl].concat(r(e))}},VI=(e,t)=>{const o=U(t,t=>t.predicate(e.dom)),{pass:n,fail:s}=P(o,e=>"contexttoolbar"===e.type);return{contextToolbars:n,contextForms:s}},HI=(e,t)=>{const o={},n=[],s=[],r={},a={},i=ae(e);return H(i,i=>{const l=e[i];"contextform"===l.type?((e,i)=>{const l=Kn(Xn("ContextForm",ax,i));o[e]=l,l.launch.map(o=>{r["form:"+e]={...i.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}}),"editor"===l.scope?s.push(l):n.push(l),a[e]=l})(i,l):"contexttoolbar"===l.type&&((e,t)=>{var o;(o=t,Xn("ContextToolbar",ix,o)).each(o=>{"editor"===t.scope?s.push(o):n.push(o),a[e]=o})})(i,l)}),{forms:o,inNodeScope:n,inEditorScope:s,lookupTable:a,formNavigators:r}},PI=da("forward-slide"),UI=da("backward-slide"),WI=da("change-slide-event"),jI="tox-pop--resizing",GI="tox-pop--transition",$I=(e,t,o,n)=>{const s=n.backstage,r=s.shared,a=Io().deviceType.isTouch,i=sc(),l=sc(),c=sc(),d=di((e=>{const t=Ms([]);return qh.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),qh.getContent(e).each(e=>{Pt(e.element,"visibility")}),$a(e.element,jI),Pt(e.element,"width")},inlineBehaviours:El([oh("context-toolbar-events",[Jr(sr(),(e,t)=>{"width"===t.event.raw.propertyName&&($a(e.element,jI),Pt(e.element,"width"))}),jr(WI,(e,t)=>{const o=e.element;Pt(o,"width");const n=Qt(o);qh.setContent(e,t.event.contents),ja(o,jI);const s=Qt(o);It(o,"width",n+"px"),qh.getContent(e).each(e=>{t.event.focus.bind(e=>(Nl(e),Hl(o))).orThunk(()=>($p.focusIn(e),Vl(bt(o))))}),setTimeout(()=>{It(e.element,"width",s+"px")},0)}),jr(PI,(e,o)=>{qh.getContent(e).each(o=>{t.set(t.get().concat([{bar:o,focus:Vl(bt(e.element))}]))}),Nr(e,WI,{contents:o.event.forwardContents,focus:A.none()})}),jr(UI,(e,o)=>{ne(t.get()).each(o=>{t.set(t.get().slice(0,t.get().length-1)),Nr(e,WI,{contents:ui(o.bar),focus:o.focus})})})]),$p.config({mode:"special",onEscape:o=>ne(t.get()).fold(()=>e.onEscape(),e=>(Rr(o,UI),A.some(!0)))})]),lazySink:()=>an.value(e.sink)})})({sink:o,onEscape:()=>(e.focus(),A.some(!0))})),u=()=>{const t=c.get().getOr("node"),o=NI(t)?1:0;return II(e,r,t,o)},m=()=>!(e.removed||a()&&s.isContextMenuOpen()),g=()=>{if(m()){const t=u(),o=xe(c.get(),"node")?((e,t)=>t.filter(e=>wt(e)&&Ge(e)).map(en).getOrThunk(()=>BI(e)))(e,i.get()):BI(e);return t.height<=0||!DI(o,t,.01)}return!0},p=()=>{i.clear(),l.clear(),c.clear(),qh.hide(d)},h=()=>{if(qh.isOpen(d)){const e=d.element;Pt(e,"display"),g()?It(e,"display","none"):(l.set(0),qh.reposition(d))}},f=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:El([$p.config({mode:"acyclic"}),oh("pop-dialog-wrap-events",[Zr(t=>{e.shortcuts.add("ctrl+F9","focus statusbar",()=>$p.focusIn(t))}),Qr(t=>{e.shortcuts.remove("ctrl+F9")})])])}),v=to(()=>HI(t,e=>{const t=y([e]);Nr(d,PI,{forwardContents:f(t)})})),y=t=>{const{buttons:o}=e.ui.registry.getAll(),s={...o,...v().formNavigators},a=Hb(e)===xb.scrolling?xb.scrolling:xb.default,i=q(V(t,t=>"contexttoolbar"===t.type?((t,o)=>pI(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,A.some(["form:"])))(s,t):((e,t)=>MI(e,t))(t,r.providers)));return RD({type:a,uid:da("context-toolbar"),initGroups:i,onEscape:A.none,cyclicKeying:!0,providers:r.providers})},x=(t,n)=>{if(S.cancel(),!m())return;const s=y(t),p=t[0].position,h=((t,n)=>{const s="node"===t?r.anchors.node(n):r.anchors.cursor(),c=((e,t,o,n)=>"line"===t?{bubble:vc(12,0,FI),layouts:{onLtr:()=>[hl],onRtl:()=>[fl]},overrides:RI}:{bubble:vc(0,12,FI,1/12),layouts:LI(e,o,n,t),overrides:RI})(e,t,a(),{lastElement:i.get,isReposition:()=>xe(l.get(),0),getMode:()=>Td.getMode(o)});return vn(s,c)})(p,n);c.set(p),l.set(1);const b=d.element;Pt(b,"display"),(e=>xe(Se(e,i.get(),et),!0))(n)||($a(b,GI),Td.reset(o,d)),qh.showWithinBounds(d,f(s),{anchor:h,transition:{classes:[GI],mode:"placement"}},()=>A.some(u())),n.fold(i.clear,i.set),g()&&It(b,"display","none")};let w=!1;const S=p_(()=>{!e.hasFocus()||e.removed||w||(qa(d.element,GI)?S.throttle():((e,t)=>{const o=Le(t.getBody()),n=e=>et(e,o),s=Le(t.selection.getNode());return(e=>!n(e)&&!tt(o,e))(s)?A.none():((e,t,o)=>{const n=VI(e,t);if(n.contextForms.length>0)return A.some({elem:e,toolbars:[n.contextForms[0]]});{const t=VI(e,o);if(t.contextForms.length>0)return A.some({elem:e,toolbars:[t.contextForms[0]]});if(n.contextToolbars.length>0||t.contextToolbars.length>0){const o=(e=>{if(e.length<=1)return e;{const t=t=>N(e,e=>e.position===t),o=t=>U(e,e=>e.position===t),n=t("selection"),s=t("node");if(n||s){if(s&&n){const e=o("node"),t=V(o("selection"),e=>({...e,position:"node"}));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return A.some({elem:e,toolbars:o})}return A.none()}})(s,e.inNodeScope,e.inEditorScope).orThunk(()=>((e,t,o)=>e(t)?A.none():Rs(t,e=>{if($e(e)){const{contextToolbars:t,contextForms:n}=VI(e,o.inNodeScope),s=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>G(e,e=>e.position===t);return t("selection").orThunk(()=>t("node")).orThunk(()=>t("line")).map(e=>e.position).fold(()=>[],t=>U(e,e=>e.position===t))}})(t);return s.length>0?A.some({elem:e,toolbars:s}):A.none()}return A.none()},e))(n,s,e))})(v(),e).fold(p,e=>{x(e.toolbars,A.some(e.elem))}))},17);e.on("init",()=>{e.on("remove",p),e.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",h),e.on("click keyup focus SetContent",S.throttle),e.on(EI,p),e.on("contexttoolbar-show",t=>{const o=v();be(o.lookupTable,t.toolbarKey).each(o=>{x([o],Oe(t.target!==e,t.target)),qh.getContent(d).each($p.focusIn)})}),e.on("focusout",t=>{Yh.setEditorTimeout(e,()=>{Hl(o.element).isNone()&&Hl(d.element).isNone()&&p()},0)}),e.on("SwitchMode",()=>{e.mode.isReadOnly()&&p()}),e.on("ExecCommand",({command:e})=>{"toggleview"===e.toLowerCase()&&p()}),e.on("AfterProgressState",t=>{t.state?p():e.hasFocus()&&S.throttle()}),e.on("dragstart",()=>{w=!0}),e.on("dragend drop",()=>{w=!1}),e.on("NodeChange",e=>{Hl(d.element).fold(S.throttle,b)})})},qI=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),s=sc();return V(o,o=>({type:"togglemenuitem",text:t.display(o),onSetup:r=>{const a=e=>{e&&(s.on(e=>e.setActive(!1)),s.set(r)),r.setActive(e)};a(xe(n,t.hash(o)));const i=t.watcher(e,o,a);return()=>{s.clear(),i()}},onAction:()=>t.setCurrent(e,o)}))};e.ui.registry.addMenuButton(t.name,{tooltip:t.text,icon:t.icon,fetch:e=>e(o()),onSetup:t.onToolbarSetup}),e.ui.registry.addNestedMenuItem(t.name,{type:"nestedmenuitem",text:t.text,getSubmenuItems:o,onSetup:t.onMenuSetup})},YI=e=>{qI(e,(e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:hv,hash:e=>(e=>VB(e,["fixed","relative","empty"]).map(({value:e,unit:t})=>e+t))(e).getOr(e),display:w,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>A.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:Nw(e),onMenuSetup:Nw(e)}))(e)),(e=>A.from(Lb(e)).map(t=>({name:"language",text:"Language",icon:"language",getOptions:x(t),hash:e=>u(e.customCode)?e.code:`${e.code}/${e.customCode}`,display:e=>e.title,watcher:(e,t,o)=>{var n;return e.formatter.formatChanged("lang",o,!1,{value:t.code,customValue:null!==(n=t.customCode)&&void 0!==n?n:null}).unbind},getCurrent:e=>{const t=Le(e.selection.getNode());return Ns(t,e=>A.some(e).filter($e).bind(e=>Et(e,"lang").map(t=>({code:t,customCode:Et(e,"data-mce-lang").getOrUndefined(),title:""}))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=nc();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),Rw(o.clear,Nw(e)(t))},onMenuSetup:Nw(e)})))(e).each(t=>qI(e,t))},XI=e=>Lw(e,"NodeChange",t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())}),KI=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),Rw(()=>e.off("PastePlainTextToggle",n),Nw(e)(o))},JI=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},ZI=e=>{(e=>{(e=>{g_.each([{name:"bold",text:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],(t,o)=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:zw(e,t.name),onAction:JI(e,t.name),shortcut:t.shortcut})});for(let t=1;t<=6;t++){const o="h"+t,n=`Alt+Shift+${t}`;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:zw(e,o),onAction:JI(e,o),shortcut:n})}})(e),(e=>{g_.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"help",text:"Help",action:"mceHelp",icon:"help",shortcut:"Alt+0"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print",shortcut:"Meta+P"}],t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:Hw(e,t.action),shortcut:t.shortcut})}),g_.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:Nw(e),onAction:Hw(e,t.action)})})})(e),(e=>{g_.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:Hw(e,t.action),onSetup:zw(e,t.name)})})})(e)})(e),(e=>{g_.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:Hw(e,t.action)})}),g_.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:Nw(e),onAction:Hw(e,t.action)})}),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:Nw(e),onAction:JI(e,"code")})})(e)},QI=(e,t)=>Lw(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())}),eF=e=>Lw(e,"VisualAid",t=>{t.setActive(e.hasVisual)}),tF=(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:Hw(e,t.cmd),onSetup:zw(e,t.name)})}),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:Nw(e),onAction:Hw(e,"JustifyNone")})})(e),ZI(e),((e,t)=>{((e,t)=>{const o=yB(t,_B(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:Nw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=yB(t,NB(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:Nw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=yB(t,XB(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:Nw(e),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=yB(t,MB(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:Nw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=yB(t,qB(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:Nw(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)})(e,t),(e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:QI(e,"hasUndo"),onAction:Hw(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:QI(e,"hasRedo"),onAction:Hw(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:QI(e,"hasUndo"),onAction:Hw(e,"undo"),shortcut:"Meta+Z"}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:QI(e,"hasRedo"),onAction:Hw(e,"redo"),shortcut:"Meta+Y"})})(e)})(e),(e=>{(e=>{e.addCommand("mceApplyTextcolor",(t,o)=>{((e,t,o)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.apply(t,{value:o}),e.nodeChanged()})})(e,t,o)}),e.addCommand("mceRemoveTextcolor",t=>{((e,t)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.remove(t,{value:null},void 0,!0),e.nodeChanged()})})(e,t)})})(e);const t=rS(e),o=aS(e),n=Ms(t),s=Ms(o);fS(e,"forecolor","forecolor",n),fS(e,"backcolor","hilitecolor",s),bS(e,"forecolor","forecolor","Text color",n),bS(e,"backcolor","hilitecolor","Background color",s)})(e),(e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:Hw(e,"mceToggleVisualAid")})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:eF(e),onAction:Hw(e,"mceToggleVisualAid")})})(e)})(e),(e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:XI(e),onAction:Hw(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:Nw(e),onAction:Hw(e,"indent")})})(e)})(e),YI(e),(e=>{const t=Ms(iv(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:KI(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:KI(e,t)})})(e)},oF=e=>r(e)?e.split(/[ ,]/):e,nF=e=>t=>t.options.get(e),sF=nF("contextmenu_never_use_native"),rF=nF("contextmenu_avoid_overlap"),aF=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))},iF=(e,t)=>({type:"makeshift",x:e,y:t}),lF=e=>"longpress"===e.type||0===e.type.indexOf("touch"),cF=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(lF(e)){const t=e.touches[0];return iF(t.pageX,t.pageY)}return iF(e.pageX,e.pageY)})(t):((e,t)=>{const o=Sb.DOM.getPos(e);return((e,t,o)=>iF(e.x+t,e.y+o))(t,o.x,o.y)})(e.getContentAreaContainer(),(e=>{if(lF(e)){const t=e.touches[0];return iF(t.clientX,t.clientY)}return iF(e.clientX,e.clientY)})(t)):dF(e),dF=e=>({type:"selection",root:Le(e.selection.getNode())}),uF=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:A.some(Le(e.selection.getNode())),root:Le(e.getBody())}))(e);case"point":return cF(e,t);case"selection":return dF(e)}},mF=(e,t,o,n,s,r)=>{const a=o(),i=uF(e,t,r);J_(a,Dv.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:A.none()}).map(e=>{t.preventDefault(),qh.showMenuAt(s,{anchor:i},{menu:{markers:$v("normal")},data:e})})},gF={onLtr:()=>[pl,cl,dl,ul,ml,gl,RE,NE,FE,BE,IE,DE],onRtl:()=>[pl,dl,cl,ml,ul,gl,RE,NE,IE,DE,FE,BE]},pF={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"]},hF=(e,t,o,n,s,r)=>{const a=Io(),i=a.os.isiOS(),l=a.os.isMacOS(),c=a.os.isAndroid(),d=a.deviceType.isTouch(),u=()=>{const a=o();((e,t,o,n,s,r,a)=>{const i=((e,t,o)=>{const n=uF(e,t,o);return{bubble:vc(0,"point"===o?12:0,pF),layouts:gF,overrides:{maxWidthFunction:dD(),maxHeightFunction:pc()},...n}})(e,t,r);J_(o,Dv.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:A.none()}).map(o=>{t.preventDefault();const l=a?jh.HighlightMenuAndItem:jh.HighlightNone;qh.showMenuWithinBounds(s,{anchor:i},{menu:{markers:$v("normal"),highlightOnOpen:l},data:o,type:"horizontal"},()=>A.some(II(e,n.shared,"node"===r?"node":"selection"))),e.dispatch(EI)})})(e,t,a,n,s,r,!(c||i||l&&d))};if((l||i)&&"node"!==r){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{Yh.setEditorTimeout(e,()=>{e.selection.setRng(t)},10),r()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const s=()=>r();e.once("longpresscancel",s);const r=()=>{e.off("touchend",o),e.off("longpresscancel",s),e.off("mousedown",n)}})(e),u()};((e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],s=o.getRng();return od(e.getWin(),Gc.domRange(s)).exists(e=>e.left<=n.clientX&&e.right>=n.clientX&&e.top<=n.clientY&&e.bottom>=n.clientY)}})(e,t)?o():(e.once("selectionchange",o),e.once("touchend",()=>e.off("selectionchange",o)))}else u()},fF=e=>r(e)?"|"===e:"separator"===e.type,bF={type:"separator"},vF=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(r(e))return e;switch(e.type){case"separator":return bF;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return r(t)?t:V(t,vF)}};default:const o=e;return{type:"menuitem",...t(o),onAction:v(o.onAction)}}},yF=(e,t)=>{if(0===t.length)return e;const o=ne(e).filter(e=>!fF(e)).fold(()=>[],e=>[bF]);return e.concat(o).concat(t).concat([bF])},xF=(e,t)=>!(e=>"longpress"===e.type||ve(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),wF=(e,t)=>xF(e,t)?e.selection.getStart(!0):t.target,SF=(e,t,o)=>{const n=Io().deviceType.isTouch,s=di(qh.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:El([oh("dismissContextMenu",[jr(_r(),(t,o)=>{Qd.close(t),e.focus()})])])})),a=()=>qh.hide(s),i=t=>{if(sF(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!sF(e))(e,t)||(e=>0===aF(e).length)(e))return;const a=((e,t)=>{const o=rF(e),n=xF(e,t)?"selection":"point";if(De(o)){const s=wF(e,t);return pC(Le(s),o)?"node":n}return n})(e,t);(n()?hF:mF)(e,t,()=>{const o=wF(e,t),n=e.ui.registry.getAll(),s=aF(e);return((e,t,o)=>{const n=j(t,(t,n)=>be(e,n.toLowerCase()).map(e=>{const n=e.update(o);if(r(n)&&De(Me(n)))return yF(t,n.split(" "));if(l(n)&&n.length>0){const e=V(n,vF);return yF(t,e)}return t}).getOrThunk(()=>t.concat([n])),[]);return n.length>0&&fF(n[n.length-1])&&n.pop(),n})(n.contextMenus,s,o)},o,s,a)};e.on("init",()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,a),e.on("longpress contextmenu",i)})},CF=Ds([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),OF=e=>t=>t.translate(-e.left,-e.top),kF=e=>t=>t.translate(e.left,e.top),_F=e=>(t,o)=>j(e,(e,t)=>t(e),Yt(t,o)),TF=(e,t,o)=>e.fold(_F([kF(o),OF(t)]),_F([OF(t)]),_F([])),EF=(e,t,o)=>e.fold(_F([kF(o)]),_F([]),_F([kF(t)])),AF=(e,t,o)=>e.fold(_F([]),_F([OF(o)]),_F([kF(t),OF(o)])),MF=(e,t,o)=>{const n=e.fold((e,t)=>({position:A.some("absolute"),left:A.some(e+"px"),top:A.some(t+"px")}),(e,t)=>({position:A.some("absolute"),left:A.some(e-o.left+"px"),top:A.some(t-o.top+"px")}),(e,t)=>({position:A.some("fixed"),left:A.some(e+"px"),top:A.some(t+"px")}));return{right:A.none(),bottom:A.none(),...n}},DF=(e,t,o,n)=>{const s=(e,s)=>(r,a)=>{const i=e(t,o,n);return s(r.getOr(i.left),a.getOr(i.top))};return e.fold(s(AF,BF),s(EF,IF),s(TF,FF))},BF=CF.offset,IF=CF.absolute,FF=CF.fixed,RF=(e,t)=>{const o=Tt(e,t);return u(o)?NaN:parseInt(o,10)},NF=(e,t,o,n,s,r)=>{const a=((e,t,o,n)=>((e,t)=>{const o=e.element,n=RF(o,t.leftAttr),s=RF(o,t.topAttr);return isNaN(n)||isNaN(s)?A.none():A.some(Yt(n,s))})(e,t).fold(()=>o,e=>FF(e.left+n.left,e.top+n.top)))(e,t,o,n),i=t.mustSnap?LF(e,t,a,s,r):VF(e,t,a,s,r),l=TF(a,s,r);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:FF(l.left,l.top),extra:A.none()}),e=>({coord:e.output,extra:e.extra}))},zF=(e,t,o,n)=>re(e,e=>{const s=e.sensor,r=((e,t,o,n,s,r)=>{const a=EF(e,s,r),i=EF(t,s,r);return Math.abs(a.left-i.left)<=o&&Math.abs(a.top-i.top)<=n})(t,s,e.range.left,e.range.top,o,n);return r?A.some({output:DF(e.output,t,o,n),extra:e.extra}):A.none()}),LF=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return zF(r,o,n,s).orThunk(()=>{const e=j(r,(e,t)=>{const r=t.sensor,a=((e,t,o,n,s,r)=>{const a=EF(e,s,r),i=EF(t,s,r),l=Math.abs(a.left-i.left),c=Math.abs(a.top-i.top);return Yt(l,c)})(o,r,t.range.left,t.range.top,n,s);return e.deltas.fold(()=>({deltas:A.some(a),snap:A.some(t)}),o=>(a.left+a.top)/2<=(o.left+o.top)/2?{deltas:A.some(a),snap:A.some(t)}:e)},{deltas:A.none(),snap:A.none()});return e.snap.map(e=>({output:DF(e.output,o,n,s),extra:e.extra}))})},VF=(e,t,o,n,s)=>{const r=t.getSnapPoints(e);return zF(r,o,n,s)};var HF=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const t=ot(e.element),o=jo(t),r=XA(s),a=((e,t,o)=>({coord:DF(e.output,e.output,t,o),extra:e.extra}))(n,o,r),i=MF(a.coord,0,r);Rt(s,i)}}});const PF="data-initial-z-index",UF=(e,t)=>{e.getSystem().addToGui(t),(e=>{at(e.element).filter($e).each(t=>{Lt(t,"z-index").each(e=>{kt(t,PF,e)}),It(t,"z-index",Nt(e.element,"z-index"))})})(t)},WF=e=>{(e=>{at(e.element).filter($e).each(e=>{Et(e,PF).fold(()=>Pt(e,"z-index"),t=>It(e,"z-index",t)),Mt(e,PF)})})(e),e.getSystem().removeFromGui(e)},jF=(e,t,o)=>e.getSystem().build(OC.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var GF=xs("snaps",[ss("getSnapPoints"),Ni("onSensor"),ss("leftAttr"),ss("topAttr"),ws("lazyViewport",on),ws("mustSnap",!1)]);const $F=[ws("useFixed",T),ss("blockerClass"),ws("getTarget",w),ws("onDrag",b),ws("repositionTarget",!0),ws("onDrop",b),Ts("getBounds",on),GF],qF=e=>{return(t=Lt(e,"left"),o=Lt(e,"top"),n=Lt(e,"position"),t.isSome()&&o.isSome()&&n.isSome()?A.some(((e,t,o)=>("fixed"===o?FF:BF)(parseInt(e,10),parseInt(t,10)))(t.getOrDie(),o.getOrDie(),n.getOrDie())):A.none()).getOrThunk(()=>{const t=Kt(e);return IF(t.left,t.top)});var t,o,n},YF=(e,t)=>({bounds:e.getBounds(),height:$t(t.element),width:eo(t.element)}),XF=(e,t,o,n,s)=>{const r=o.update(n,s),a=o.getStartData().getOrThunk(()=>YF(t,e));r.each(o=>{((e,t,o,n)=>{const s=t.getTarget(e.element);if(t.repositionTarget){const r=ot(e.element),a=jo(r),i=XA(s),l=qF(s),c=((e,t,o,n,s,r,a)=>((e,t,o,n,s)=>{const r=s.bounds,a=EF(t,o,n),i=el(a.left,r.x,r.x+r.width-s.width),l=el(a.top,r.y,r.y+r.height-s.height),c=IF(i,l);return t.fold(()=>{const e=AF(c,o,n);return BF(e.left,e.top)},x(c),()=>{const e=TF(c,o,n);return FF(e.left,e.top)})})(0,t.fold(()=>{const e=(t=o,a=r.left,i=r.top,t.fold((e,t)=>BF(e+a,t+i),(e,t)=>IF(e+a,t+i),(e,t)=>FF(e+a,t+i)));var t,a,i;const l=TF(e,n,s);return FF(l.left,l.top)},t=>{const a=NF(e,t,o,r,n,s);return a.extra.each(o=>{t.onSensor(e,o)}),a.coord}),n,s,a))(e,t.snaps,l,a,i,n,o),d=MF(c,0,i);Rt(s,d)}t.onDrag(e,s,n)})(e,t,a,o)})},KF=(e,t,o,n)=>{t.each(WF),o.snaps.each(t=>{((e,t)=>{((e,t)=>{const o=e.element;Mt(o,t.leftAttr),Mt(o,t.topAttr)})(e,t)})(e,t)});const s=o.getTarget(e.element);n.reset(),o.onDrop(e,s)},JF=e=>(t,o)=>{const n=e=>{o.setStartData(YF(t,e))};return Pr([jr(Sr(),e=>{o.getStartData().each(()=>n(e))}),...e(t,o,n)])};var ZF=Object.freeze({__proto__:null,getData:e=>A.from(Yt(e.x,e.y)),getDelta:(e,t)=>Yt(t.left-e.left,t.top-e.top)});const QF=(e,t,o)=>[jr(Gs(),(n,s)=>{if(0!==s.event.raw.button)return;s.stop();const r=()=>KF(n,A.some(l),e,t),a=hC(r,200),i={drop:r,delayDrop:a.schedule,forceDrop:r,move:o=>{a.cancel(),XF(n,e,t,ZF,o)}},l=jF(n,e.blockerClass,(e=>Pr([jr(Gs(),e.forceDrop),jr(Ys(),e.drop),jr($s(),(t,o)=>{e.move(o.event)}),jr(qs(),e.delayDrop)]))(i));o(n),UF(n,l)})],eR=[...$F,Hi("dragger",{handlers:JF(QF)})];var tR=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return A.some(Yt(t.clientX,t.clientY))})(t):A.none()},getDelta:(e,t)=>Yt(t.left-e.left,t.top-e.top)});const oR=(e,t,o)=>{const n=sc(),s=o=>{KF(o,n.get(),e,t),n.clear()};return[jr(Ps(),(r,a)=>{a.stop();const i=()=>s(r),l={drop:i,delayDrop:b,forceDrop:i,move:o=>{XF(r,e,t,tR,o)}},c=jF(r,e.blockerClass,(e=>Pr([jr(Ps(),e.forceDrop),jr(Ws(),e.drop),jr(js(),e.drop),jr(Us(),(t,o)=>{e.move(o.event)})]))(l));n.set(c),o(r),UF(r,c)}),jr(Us(),(o,n)=>{n.stop(),XF(o,e,t,tR,n.event)}),jr(Ws(),(e,t)=>{t.stop(),s(e)}),jr(js(),s)]},nR=eR,sR=[...$F,Hi("dragger",{handlers:JF(oR)})],rR=[...$F,Hi("dragger",{handlers:JF((e,t,o)=>[...QF(e,t,o),...oR(e,t,o)])})];var aR=Object.freeze({__proto__:null,mouse:nR,touch:sR,mouseOrTouch:rR}),iR=Object.freeze({__proto__:null,init:()=>{let e=A.none(),t=A.none();const o=x({});return Ea({readState:o,reset:()=>{e=A.none(),t=A.none()},update:(t,o)=>t.getData(o).bind(o=>((t,o)=>{const n=e.map(e=>t.getDelta(e,o));return e=A.some(o),n})(t,o)),getStartData:()=>t,setStartData:e=>{t=A.some(e)}})}});const lR=Bl({branchKey:"mode",branches:aR,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:A.from(e.extra)})},state:iR,apis:HF}),cR=(e,t,o,n,s,r)=>e.fold(()=>lR.snap({sensor:IF(o-20,n-20),range:Yt(s,r),output:IF(A.some(o),A.some(n)),extra:{td:t}}),e=>{const s=o-20,r=n-20,a=e.element.dom.getBoundingClientRect();return lR.snap({sensor:IF(s,r),range:Yt(40,40),output:IF(A.some(o-a.width/2),A.some(n-a.height/2)),extra:{td:t}})}),dR=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const s=n.td;((e,t)=>e.exists(e=>et(e,t)))(t.get(),s)||(t.set(s),o(s))},mustSnap:!0}),uR=e=>Jh(Xh.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:El([lR.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),nO.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),mR=(e,t)=>{const o=Ms([]),n=Ms([]),s=Ms(!1),r=sc(),a=sc(),i=e=>{const o=en(e);return cR(u.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=en(e);return cR(m.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=dR(()=>V(o.get(),e=>i(e)),r,t=>{a.get().each(o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})})}),d=dR(()=>V(n.get(),e=>l(e)),a,t=>{r.get().each(o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})})}),u=uR(c),m=uR(d),g=di(u.asSpec()),p=di(m.asSpec()),h=(t,o,n,s)=>{const r=n(o);lR.snapTo(t,r),((t,o)=>{const n=o.dom.getBoundingClientRect();Pt(t.element,"display");const r=rt(Le(e.getBody())).dom.innerHeight,a=n[s]<0,i=((e,t)=>e[s]>t)(n,r);(a||i)&&It(t.element,"display","none")})(t,o)},f=e=>h(g,e,i,"top"),b=e=>h(p,e,l,"bottom");if(Io().deviceType.isTouch()){const i=e=>V(e,Le);e.on("TableSelectionChange",e=>{s.get()||(Fd(t,g),Fd(t,p),s.set(!0));const l=Le(e.start),c=Le(e.finish);r.set(l),a.set(c),A.from(e.otherCells).each(e=>{o.set(i(e.upOrLeftCells)),n.set(i(e.downOrRightCells)),f(l),b(c)})}),e.on("ResizeEditor ResizeWindow ScrollContent",()=>{r.get().each(f),a.get().each(b)}),e.on("TableSelectionClear",()=>{s.get()&&(zd(g),zd(p),s.set(!1)),r.clear(),a.clear()})}},gR=e=>"BR"===e.nodeName||!!e.getAttribute("data-mce-bogus")||"bookmark"===e.getAttribute("data-mce-type"),pR=(e,t,o)=>{var n;const s=null!==(n=t.delimiter)&&void 0!==n?n:"\u203a";return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:El([$p.config({mode:"flow",selector:"div[role=button]"}),Hm.config({disabled:o.isDisabled}),Px(),DC.config({}),th.config({}),oh("elementPathEvents",[Zr((t,n)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",()=>$p.focusIn(t)),e.on("NodeChange",n=>{const r=(t=>{const o=[];let n=t.length;for(;n-- >0;){const s=t[n];if(1===s.nodeType&&!gR(s)){const t=Fw(e,s);if(t.isDefaultPrevented()||o.push({name:t.name,element:s}),t.isPropagationStopped())break}}return o})(n.parents),a=r.length>0?j(r,(t,n,r)=>{const a=((t,n,s)=>Xh.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":s,"aria-level":s+1}},components:[ai(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:El([Ux(o.isDisabled),Px()])}))(n.name,n.element,r);return 0===r?t.concat([a]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[ai(` ${s} `)]},a])},[]):[];th.set(t,a)})})])]),components:[]}};var hR;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(hR||(hR={}));const fR=(e,t,o)=>{const n=Le(e.getContainer()),s=((e,t,o,n,s)=>{const r={height:wI(n+t.top,Bb(e),Fb(e))};return o===hR.Both&&(r.width=wI(s+t.left,Db(e),Ib(e))),r})(e,t,o,Gt(n),Qt(n));le(s,(e,t)=>{h(e)&&It(n,t,xI(e))}),(e=>{e.dispatch("ResizeEditor")})(e)},bR=(e,t,o,n)=>{const s=Yt(20*o,20*n);return fR(e,s,t),A.some(!0)},vR=(e,t)=>{const o=()=>{const o=[],n=cv(e),s=sv(e),r=rv(e)||e.hasPlugin("wordcount");return s&&o.push(pR(e,{},t)),n&&o.push((()=>{const e=Qx("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[ai(lb.translate(["Press {0} for help",e]))]}})()),r&&o.push((()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>th.set(e,[ai(t.translate(["{0} "+n,o[n]]))]);return Xh.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:El([Ux(t.isDisabled),Px(),DC.config({}),th.config({}),yu.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),oh("wordcount-events",[ta(e=>{const t=yu.getValue(e),n="words"===t.mode?"characters":"words";yu.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)}),Zr(t=>{e.on("wordCountUpdate",e=>{const{mode:n}=yu.getValue(t);yu.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)})})])]),eventOrder:{[gr()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),rv(e)&&o.push({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v7",rel:"noopener",target:"_blank","aria-label":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:El([ih.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}})()),o.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...(()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(n){const o="tox-statusbar__text-container-3-cols";return r||s?r&&!s?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[r&&!s?t:e]})()]},components:o}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const n=o(),s=((e,t)=>{const o=(e=>{const t=av(e);return!1===t?hR.None:"both"===t?hR.Both:hR.Vertical})(e);if(o===hR.None)return A.none();const n=o===hR.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return A.some(bb("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{"aria-label":t.translate(n),"data-mce-name":"resize-handle"},behaviours:[lR.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,s)=>fR(e,s,o),blockerClass:"tox-blocker"}),$p.config({mode:"special",onLeft:()=>bR(e,o,-1,0),onRight:()=>bR(e,o,1,0),onUp:()=>bR(e,o,0,-1),onDown:()=>bR(e,o,0,1)}),DC.config({}),ih.config({}),Nx.config(t.tooltips.getConfig({tooltipText:t.translate("Resize")}))]},t.icons))})(e,t);return n.concat(s.toArray())})()}},yR=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),xR=(e,t)=>{const o=e.inline,n=o?TI:vI,s=Ov(e)?MM:qA,r=(()=>{const e=sc(),t=sc(),o=sc();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=>et(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=sc(),i=sc(),l=sc(),c=Io().deviceType.isTouch()?["tox-platform-touch"]:[],d=yv(e),u=Hb(e),m=Jh({dom:{tag:"div",classes:["tox-anchorbar"]}}),g=Jh({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),p=()=>r.mainUi.get().map(e=>e.outerContainer).bind(aB.getHeader),h=r.lazyGetInOuterOrDie("anchor bar",m.getOpt),f=r.lazyGetInOuterOrDie("bottom anchor bar",g.getOpt),b=r.lazyGetInOuterOrDie("toolbar",aB.getToolbar),v=r.lazyGetInOuterOrDie("throbber",aB.getThrobber),y=((e,t,o,n)=>{const s=Ms(!1),r=(e=>{const t=Ms(yv(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,tooltips:lA(e.popup)},i=IA(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},n=Ms([]),s=Ms([]),r=Ms(!1);return e.on("PreInit",s=>{const r=rA(e),a=iA(e,r,t,o);n.set(a)}),e.on("addStyleModifications",n=>{const a=iA(e,n.items,t,o);s.set(a),r.set(n.replace)}),{getData:()=>{const e=r.get()?[]:n.get(),t=s.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:KE(e),hasCustomColors:JE(e),getColors:ZE(e),getColorCols:QE(e)}))(t),d=(e=>({isDraggableModal:eA(e)}))(t),u={shared:{providers:a,anchors:XE(t,o,n,r.isPositionedAtTop),header:r},urlinput:i,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>s.get(),setContextMenuState:e=>s.set(e)},m={...u,shared:{...u.shared,interpreter:e=>CE(e,{},m),getSink:e.popup}},g={...u,shared:{...u.shared,interpreter:e=>CE(e,{},g),getSink:e.dialog}};return{popup:m,dialog:g}})({popup:()=>an.fromOption(r.popupUi.get().map(e=>e.sink),"(popup) UI has not been rendered"),dialog:()=>an.fromOption(r.dialogUi.get().map(e=>e.sink),"UI has not been rendered")},e,h,f),x=t=>{const o=xI((e=>{const t=(e=>{const t=Ab(e),o=Bb(e),n=Fb(e);return yI(t).map(e=>wI(e,o,n))})(e);return t.getOr(Ab(e))})(e)),n=xI((e=>SI(e).getOr(Mb(e)))(e));return e.inline||(Ht("div","width",n)&&It(t.element,"width",n),Ht("div","height",o)?It(t.element,"height",o):It(t.element,"height","400px")),o};return{popups:{backstage:y.popup,getMothership:()=>yR("popups",l)},dialogs:{backstage:y.dialog,getMothership:()=>yR("dialogs",i)},renderUI:()=>{const h=(()=>{const t=(()=>{const t={attributes:{[Oc]:d?Cc.BottomToTop:Cc.TopToBottom}},o=aB.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:y.popup,onEscape:()=>{e.focus()}}),n=aB.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:y.popup.shared.getSink,providers:y.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{((e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})})(e,t)},type:u,lazyToolbar:b,lazyHeader:()=>p().getOrDie("Could not find header element"),...t}),s=aB.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:y.popup.shared.providers,onEscape:()=>{e.focus()},type:u}),r=vv(e),a=fv(e),i=mv(e),l=r||a||i;return aB.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(l?[]:["tox-editor-header--empty"]),...t},components:q([i?[o]:[],r?[s]:a?[n]:[],wv(e)?[]:[m.asSpec()]]),sticky:Ov(e),editor:e,sharedBackstage:y.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[aB.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),aB.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},s=aB.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:y.popup}),r=aB.parts.viewWrapper({backstage:y.popup}),i=nv(e)&&!o?A.some(vR(e,y.popup.shared.providers)):A.none(),l=q([d?[]:[t],o?[]:[n],d?[t]:[]]),h=aB.parts.editorContainer({components:q([l,o?[]:[g.asSpec(),...i.toArray()]])}),f=Cv(e),v={role:"application",...lb.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},x=di(aB.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(o?["tox-tinymce-inline"]:[]).concat(d?["tox-tinymce--toolbar-bottom"]:[]).concat(c),styles:{visibility:"hidden",...f?{opacity:"0",border:"0"}:{}},attributes:v},components:[h,...o?[]:[r],s],behaviours:El([Px(),Hm.config({disableClass:"tox-tinymce--disabled"}),$p.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle"})])})),w=kC(x);return a.set(w),{mothership:w,outerContainer:x}})(),f=(()=>{const t=Sv(e),o=et(St(),t)&&"grid"===Nt(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...lb.isRtl()?{dir:"rtl"}:{}}},behaviours:El([Td.config({useFixed:()=>s.isDocked(p)})])},r={dom:{styles:{width:document.body.clientWidth+"px"}},events:Pr([jr(Cr(),e=>{It(e.element,"width",document.body.clientWidth+"px")})])},a=di(vn(n,o?r:{})),l=kC(a);return i.set(l),{sink:a,mothership:l}})(),w=kv(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:El([Td.config({useFixed:()=>s.isDocked(p),getBounds:()=>t.getPopupSinkBounds()})])},o=di(e),n=kC(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(f);r.dialogUi.set(f),r.popupUi.set(w),r.mainUi.set(h);return(t=>{const{mainUi:o,popupUi:r,uiMotherships:a}=t;ce(Pb(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=bv(e),h={menuItems:l,menus:_v(e),menubar:qb(e),toolbar:g.getOrThunk(()=>Yb(e)),allowToolbarGroups:u===xb.floating,buttons:i,sidebar:d,views:m};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",()=>{aB.focusMenubar(f)}),e.addShortcut("alt+F10","focus toolbar",()=>{aB.focusToolbar(f)}),e.addCommand("ToggleToolbarDrawer",(e,t)=>{(null==t?void 0:t.skipFocus)?aB.toggleToolbarDrawerWithoutFocusing(f):aB.toggleToolbarDrawer(f)}),e.addQueryStateHandler("ToggleToolbarDrawer",()=>aB.isToolbarDrawerToggled(f)),((e,t,o)=>{const n=(e,n)=>{H([t,...o],t=>{t.broadcastEvent(e,n)})},s=(e,n)=>{H([t,...o],t=>{t.broadcastOn([e],n)})},r=e=>s(eu(),{target:e.target}),a=Yo(),i=ac(a,"touchstart",r),l=ac(a,"touchmove",e=>n(xr(),e)),c=ac(a,"touchend",e=>n(wr(),e)),d=ac(a,"mousedown",r),u=ac(a,"mouseup",e=>{0===e.raw.button&&s(ou(),{target:e.target})}),m=e=>s(eu(),{target:Le(e.target)}),g=e=>{0===e.button&&s(ou(),{target:Le(e.target)})},p=()=>{H(e.editorManager.get(),t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})})},h=e=>n(Sr(),lc(e)),f=e=>{s(tu(),{}),n(Cr(),lc(e))},b=bt(Le(e.getElement())),v=ic(b,"scroll",o=>{requestAnimationFrame(()=>{if(null!=e.getContainer()){const s=mC(e,t.element).map(e=>[e.element,...e.others]).getOr([]);N(s,e=>et(e,o.target))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Mr(),o))}})}),y=()=>s(tu(),{}),x=t=>{t.state&&s(eu(),{target:Le(e.getContainer())})},w=e=>{s(eu(),{target:Le(e.relatedTarget.getContainer())})},S=t=>e.dispatch("focusin",t),C=t=>e.dispatch("focusout",t);e.on("PostRender",()=>{e.on("click",m),e.on("tap",m),e.on("mouseup",g),e.on("mousedown",p),e.on("ScrollWindow",h),e.on("ResizeWindow",f),e.on("ResizeEditor",y),e.on("AfterProgressState",x),e.on("DismissPopups",w),H([t,...o],e=>{e.element.dom.addEventListener("focusin",S),e.element.dom.addEventListener("focusout",C)})}),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),H([t,...o],e=>{e.element.dom.removeEventListener("focusin",S),e.element.dom.removeEventListener("focusout",C)}),d.unbind(),i.unbind(),l.unbind(),c.unbind(),u.unbind(),v.unbind()}),e.on("detach",()=>{H([t,...o],Ud),H([t,...o],e=>e.destroy())})})(e,o.mothership,a),s.setup(e,y.popup.shared,p),tF(e,y.popup),SF(e,y.popup.shared.getSink,y.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();H(ae(t),o=>{const n=t[o],s=()=>xe(A.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o),t.setActive(s())},onSetup:t=>{t.setActive(s());const o=()=>t.setActive(s());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}}})})})(e),tD(e,v,y.popup.shared),$I(e,c,r.sink,{backstage:y.popup}),mR(e,r.sink);const b={targetNode:e.getElement(),height:x(o.outerContainer)};return n.render(e,t,h,y.popup,b)})({popupUi:w,dialogUi:f,mainUi:h,uiMotherships:r.getUiMotherships()})}}},wR=x([ss("lazySink"),gs("dragBlockClass"),Ts("getBounds",on),ws("useTabstopAt",E),ws("firstTabstop",0),ws("eventOrder",{}),xu("modalBehaviours",[$p]),zi("onExecute"),Vi("onEscape")]),SR={sketch:w},CR=x([Xu({name:"draghandle",overrides:(e,t)=>({behaviours:El([lR.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})])})}),qu({schema:[ss("dom")],name:"title"}),qu({factory:SR,schema:[ss("dom")],name:"close"}),qu({factory:SR,schema:[ss("dom")],name:"body"}),Xu({factory:SR,schema:[ss("dom")],name:"footer"}),Yu({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[ws("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),ws("components",[])],name:"blocker"})]),OR=Sm({name:"ModalDialog",configFields:wR(),partFields:CR(),factory:(e,t,o,n)=>{const s=sc(),r=da("modal-events"),a={...e.eventOrder,[Or()]:[r].concat(e.eventOrder["alloy.system.attached"]||[])};return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{s.set(t);const o=e.lazySink(t).getOrDie(),r=n.blocker(),a=o.getSystem().build({...r,components:r.components.concat([ui(t)]),behaviours:El([ih.config({}),oh("dialog-blocker-events",[Jr(Ks(),()=>{QM.isBlocked(t)||$p.focusIn(t)})])])});Fd(o,a),$p.focusIn(t)},hide:e=>{s.clear(),at(e.element).each(t=>{e.getSystem().getByDom(t).each(e=>{zd(e)})})},getBody:t=>lm(t,e,"body"),getFooter:t=>im(t,e,"footer"),setIdle:e=>{QM.unblock(e)},setBusy:(e,t)=>{QM.block(e,t)}},eventOrder:a,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Su(e.modalBehaviours,[th.config({}),$p.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),QM.config({getRoot:s.get}),oh(r,[Zr(t=>{((e,t)=>{const o=Et(e,"id").fold(()=>{const e=da("dialog-label");return kt(t,"id",e),e},w);kt(e,"aria-labelledby",o)})(t.element,lm(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)}}}),kR=In([vy,yy].concat(px)),_R=Un,TR=[Gy("button"),By,ks("align","end",["start","end"]),Hy,Vy,bs("buttonType",["primary","secondary"])],ER=[...TR,wy],AR=[ls("type",["submit","cancel","custom"]),...ER],MR=[ls("type",["menu"]),Dy,Iy,By,ms("items",kR),...TR],DR=[...TR,ls("type",["togglebutton"]),Iy,By,Dy,_s("active",!1)],BR=Qn("type",{submit:AR,cancel:AR,custom:AR,menu:MR,togglebutton:DR}),IR=[vy,wy,ls("level",["info","warn","error","success"]),Cy,ws("url","")],FR=In(IR),RR=[vy,wy,Vy,Gy("button"),By,Ly,bs("buttonType",["primary","secondary","toolbar"]),Hy],NR=In(RR),zR=[vy,yy],LR=zR.concat([Fy,Iy]),VR=zR.concat([xy,Vy]),HR=In(VR),PR=Un,UR=LR.concat([Py("auto")]),WR=In(UR),jR=zn([Oy,wy,Cy]),GR=LR.concat([Os("storageKey","default")]),$R=In(GR),qR=Pn,YR=In(LR),XR=Pn,KR=zR.concat([Os("tag","textarea"),is("scriptId"),is("scriptUrl"),vs("onFocus"),Ss("settings",void 0,Gn)]),JR=zR.concat([Os("tag","textarea"),cs("init")]),ZR=qn(e=>Xn("customeditor.old",Bn(JR),e).orThunk(()=>Xn("customeditor.new",Bn(KR),e))),QR=Pn,eN=In(LR),tN=Fn(Tn),oN=e=>[vy,as("columns"),e],nN=[vy,is("html"),ks("presets","presentation",["presentation","document"])],sN=In(nN),rN=LR.concat([_s("border",!1),_s("sandboxed",!0),_s("streamContent",!1),_s("transparent",!0)]),aN=In(rN),iN=Pn,lN=In(zR.concat([fs("height")])),cN=In([is("url"),hs("zoom"),hs("cachedWidth"),hs("cachedHeight")]),dN=LR.concat([fs("inputMode"),fs("placeholder"),_s("maximized",!1),Vy]),uN=In(dN),mN=Pn,gN=e=>[vy,xy,e,ks("align","start",["start","center","end"]),Iy],pN=[wy,Oy],hN=[wy,ms("items",es(0,()=>fN))],fN=Rn([In(pN),In(hN)]),bN=LR.concat([ms("items",fN),Vy]),vN=In(bN),yN=Pn,xN=LR.concat([us("items",[wy,Oy]),Cs("size",1),Vy]),wN=In(xN),SN=Pn,CN=LR.concat([_s("constrain",!0),Vy]),ON=In(CN),kN=In([is("width"),is("height")]),_N=zR.concat([xy,Cs("min",0),Cs("max",0)]),TN=In(_N),EN=Hn,AN=[vy,ms("header",Pn),ms("cells",Fn(Pn))],MN=In(AN),DN=LR.concat([fs("placeholder"),_s("maximized",!1),Vy]),BN=In(DN),IN=Pn,FN=[ls("type",["directory","leaf"]),Sy,is("id"),ps("menu",IM)],RN=In(FN),NN=FN.concat([ms("children",es(0,()=>$n("type",{directory:zN,leaf:RN})))]),zN=In(NN),LN=$n("type",{directory:zN,leaf:RN}),VN=[vy,ms("items",LN),vs("onLeafAction"),vs("onToggleExpand"),Es("defaultExpandedIds",[],Pn),fs("defaultSelectedId")],HN=In(VN),PN=LR.concat([ks("filetype","file",["image","media","file"]),Vy,fs("picker_text")]),UN=In(PN),WN=In([Oy,Uy]),jN=e=>ts("items","items",{tag:"required",process:{}},Fn(qn(t=>Xn(`Checking item of ${e}`,GN,t).fold(e=>an.error(Zn(e)),e=>an.value(e))))),GN=Mn(()=>{return $n("type",{alertbanner:FR,bar:In((e=jN("bar"),[vy,e])),button:NR,checkbox:HR,colorinput:$R,colorpicker:YR,dropzone:eN,grid:In(oN(jN("grid"))),iframe:aN,input:uN,listbox:vN,selectbox:wN,sizeinput:ON,slider:TN,textarea:BN,urlinput:UN,customeditor:ZR,htmlpanel:sN,imagepreview:lN,collection:WR,label:In(gN(jN("label"))),table:MN,tree:HN,panel:qN});var e}),$N=[vy,ws("classes",[]),ms("items",GN)],qN=In($N),YN=[Gy("tab"),Sy,ms("items",GN)],XN=[vy,us("tabs",YN)],KN=In(XN),JN=ER,ZN=BR,QN=In([is("title"),rs("body",$n("type",{panel:qN,tabpanel:KN})),Os("size","normal"),Es("buttons",[],ZN),ws("initialData",{}),Ts("onAction",b),Ts("onChange",b),Ts("onSubmit",b),Ts("onClose",b),Ts("onCancel",b),Ts("onTabChange",b)]),ez=In([ls("type",["cancel","custom"]),...JN]),tz=In([is("title"),is("url"),hs("height"),hs("width"),ys("buttons",ez),Ts("onAction",b),Ts("onCancel",b),Ts("onClose",b),Ts("onMessage",b)]),oz=e=>a(e)?[e].concat(Y(fe(e),oz)):l(e)?Y(e,oz):[],nz=e=>r(e.type)&&r(e.name),sz={checkbox:PR,colorinput:qR,colorpicker:XR,dropzone:tN,input:mN,iframe:iN,imagepreview:cN,selectbox:SN,sizeinput:kN,slider:EN,listbox:yN,size:kN,textarea:IN,urlinput:WN,customeditor:QR,collection:jR,togglemenuitem:_R},rz=e=>{const t=(e=>U(oz(e),nz))(e),o=Y(t,e=>(e=>A.from(sz[e.type]))(e).fold(()=>[],t=>[rs(e.name,t)]));return In(o)},az=e=>{var t;return{internalDialog:Kn(Xn("dialog",QN,e)),dataValidator:rz(e),initialData:null!==(t=e.initialData)&&void 0!==t?t:{}}},iz={open:(e,t)=>{const o=az(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(Kn(Xn("dialog",tz,t))),redial:e=>az(e)};var lz=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each(e=>{const s=e(o,n);t.set(s)}),e.renderComponents.each(s=>{const r=s(n,t.get());(e.reuseDom?Yp:qp)(o,r)})};return Pr([jr(mr(),(t,n)=>{const s=n;if(!s.universal){const n=e.channel;R(s.channels,n)&&o(t,s.data)}}),Zr((t,n)=>{e.initialData.each(e=>{o(t,e)})})])}}),cz=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),dz=[ss("channel"),gs("renderComponents"),gs("updateState"),gs("initialData"),_s("reuseDom",!0)];const uz=Ml({fields:dz,name:"reflecting",active:lz,apis:cz,state:Object.freeze({__proto__:null,init:()=>{const e=Ms(A.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(A.none())}}})}),mz=e=>{const t=[],o={};return le(e,(e,n)=>{e.fold(()=>{t.push(n)},e=>{o[n]=e})}),t.length>0?an.error(t):an.value(o)},gz=(e,t,o)=>{const n=Jh(Kk.sketch(n=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:V(e.items,e=>wE(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:El([$p.config({mode:"acyclic",useTabstopAt:O(w_)}),(s=n,_m.config({find:s.getOpt})),a_(n,{postprocess:e=>mz(e).fold(e=>(console.error(e),{}),w)}),oh("dialog-body-panel",[jr(Ks(),(e,t)=>{e.getSystem().broadcastOn([T_],{newFocus:A.some(t.event.target)})})])])};var s},pz=wm({name:"TabButton",configFields:[ws("uid",void 0),ss("value"),ts("dom","dom",Sn(()=>({attributes:{role:"tab",id:da("aria"),"aria-selected":"false"}})),Ln()),gs("action"),ws("domModification",{}),xu("tabButtonBehaviours",[ih,$p,yu]),ss("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:vh(e.action),behaviours:Su(e.tabButtonBehaviours,[ih.config({}),$p.config({mode:"execution",useSpace:!0,useEnter:!0}),yu.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),hz=x([ss("tabs"),ss("dom"),ws("clickToDismiss",!1),xu("tabbarBehaviours",[Km,$p]),Fi(["tabClass","selectedClass"])]),fz=Ku({factory:pz,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{Km.dehighlight(e,t),Nr(e,Br(),{tabbar:e,button:t})},o=(e,t)=>{Km.highlight(e,t),Nr(e,Dr(),{tabbar:e,button:t})};return{action:n=>{const s=n.getSystem().getByUid(e.uid).getOrDie(),r=Km.isHighlighted(s,n);(r&&e.clickToDismiss?t:r?b:o)(s,n)},domModification:{classes:[e.markers.tabClass]}}}}),bz=x([fz]),vz=Sm({name:"Tabbar",configFields:hz(),partFields:bz(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Su(e.tabbarBehaviours,[Km.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")}}),$p.config({mode:"flow",getInitial:e=>Km.getHighlighted(e).map(e=>e.element),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),yz=wm({name:"Tabview",configFields:[xu("tabviewBehaviours",[th])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:Su(e.tabviewBehaviours,[th.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),xz=x([ws("selectFirst",!0),Ni("onChangeTab"),Ni("onDismissTab"),ws("tabs",[]),xu("tabSectionBehaviours",[])]),wz=qu({factory:vz,schema:[ss("dom"),ds("markers",[ss("tabClass"),ss("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),Sz=qu({factory:yz,name:"tabview"}),Cz=x([wz,Sz]),Oz=Sm({name:"TabSection",configFields:xz(),partFields:Cz(),factory:(e,t,o,n)=>{const s=(t,o)=>{im(t,e,"tabbar").each(e=>{o(e).each(zr)})};return{uid:e.uid,dom:e.dom,components:t,behaviours:wu(e.tabSectionBehaviours),events:Pr(q([e.selectFirst?[Zr((e,t)=>{s(e,Km.getFirst)})]:[],[jr(Dr(),(t,o)=>{(t=>{const o=yu.getValue(t);im(t,e,"tabview").each(n=>{G(e.tabs,e=>e.value===o).each(o=>{const s=o.view();Et(t.element,"id").each(e=>{kt(n.element,"aria-labelledby",e)}),th.set(n,s),e.onChangeTab(n,t,s)})})})(o.event.button)}),jr(Br(),(t,o)=>{const n=o.event.button;e.onDismissTab(t,n)})]])),apis:{getViewItems:t=>im(t,e,"tabview").map(e=>th.contents(e)).getOr([]),showTab:(e,t)=>{s(e,e=>{const o=Km.getCandidates(e);return G(o,e=>yu.getValue(e)===t).filter(t=>!Km.isHighlighted(e,t))})}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),kz=(e,t)=>{It(e,"height",t+"px"),It(e,"flex-basis",t+"px")},_z=(e,t,o)=>{bi(e,'[role="dialog"]').each(e=>{yi(e,'[role="tablist"]').each(n=>{o.get().map(o=>(It(t,"height","0"),It(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=st(e).dom,s=bi(e,".tox-dialog-wrap").getOr(e);let r;r="fixed"===Nt(s,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const a=Gt(t),i=t.dom.offsetLeft>=o.dom.offsetLeft+Qt(o)?Math.max(Gt(o),a):a,l=parseInt(Nt(e,"margin-top"),10)||0,c=parseInt(Nt(e,"margin-bottom"),10)||0;return r-(Gt(e)+l+c-i)})(e,t,n)))).each(e=>{kz(t,e)})})})},Tz=e=>yi(e,'[role="tabpanel"]'),Ez="send-data-to-section",Az="send-data-to-view",Mz=(e,t,o)=>{const n=Ms({}),s=e=>{const t=yu.getValue(e),o=mz(t).getOr({}),s=n.get(),r=vn(s,o);n.set(r)},r=e=>{const t=n.get();yu.setValue(e,t)},a=Ms(null),i=V(e.tabs,e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[ai(o.shared.providers.translate(e.title))],view:()=>[Kk.sketch(n=>({dom:{tag:"div",classes:["tox-form"]},components:V(e.items,e=>wE(n,e,t,o)),formBehaviours:El([$p.config({mode:"acyclic",useTabstopAt:O(w_)}),oh("TabView.form.events",[Zr(r),Qr(s)]),Fl.config({channels:Is([{key:Ez,value:{onReceive:s}},{key:Az,value:{onReceive:r}}])})])}))]})),l=(e=>{const t=sc(),o=[Zr(o=>{const n=o.element;Tz(n).each(s=>{It(s,"visibility","hidden"),o.getSystem().getByDom(s).toOptional().each(o=>{const n=((e,t,o)=>V(e,(n,s)=>{th.set(o,e[s].view());const r=t.dom.getBoundingClientRect();return th.set(o,[]),r.height}))(e,s,o),r=(e=>oe(ee(e,(e,t)=>e>t?-1:e<t?1:0)))(n);r.fold(t.clear,t.set)}),_z(n,s,t),Pt(s,"visibility"),((e,t)=>{oe(e).each(e=>Oz.showTab(t,e.value))})(e,o),requestAnimationFrame(()=>{_z(n,s,t)})})}),jr(Cr(),e=>{const o=e.element;Tz(o).each(e=>{_z(o,e,t)})}),jr(GC,(e,o)=>{const n=e.element;Tz(n).each(e=>{const o=Vl(bt(e));It(e,"visibility","hidden");const s=Lt(e,"height").map(e=>parseInt(e,10));Pt(e,"height"),Pt(e,"flex-basis");const r=e.dom.getBoundingClientRect().height;s.forall(e=>r>e)?(t.set(r),_z(n,e,t)):s.each(t=>{kz(e,t)}),Pt(e,"visibility"),o.each(Nl)})})];return{extraEvents:o,selectFirst:!1}})(i);return Oz.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=yu.getValue(t);Nr(e,jC,{name:n,oldName:a.get()}),a.set(n)},tabs:i,components:[Oz.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[vz.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:El([DC.config({})])}),Oz.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:El([oh("tabpanel",l.extraEvents),$p.config({mode:"acyclic"}),_m.config({find:e=>oe(Oz.getViewItems(e))}),i_(A.none(),e=>(e.getSystem().broadcastOn([Ez],{}),n.get()),(e,t)=>{n.set(t),e.getSystem().broadcastOn([Az],{})})])})},Dz=(e,t,o,n,s)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map(e=>({id:e})).getOr({}),...s?{"aria-live":"polite"}:{}}},components:[],behaviours:El([s_(0),uz.config({channel:`${O_}-${t}`,updateState:(e,t)=>A.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[Mz(t,e.initialData,n)]:[gz(t,e.initialData,n)]},initialData:e})])}),Bz=Ob.deviceType.isTouch(),Iz=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),Fz=(e,t)=>OR.parts.close(Xh.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:El([DC.config({})])})),Rz=()=>OR.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),Nz=(e,t)=>OR.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:Kh(`<p>${ib(t.translate(e))}</p>`)}]}]}),zz=e=>OR.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),Lz=(e,t)=>[OC.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),OC.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],Vz=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",s=t+"__disable-scroll";return OR.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),A.some(!0)),useTabstopAt:e=>!w_(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:Kh(`<div class="${o}"></div>`),components:[{dom:{tag:"div",classes:Bz?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:El([ih.config({}),oh("dialog-events",e.dialogEvents.concat([Jr(Ks(),(e,t)=>{QM.isBlocked(e)||$p.focusIn(e)}),jr(Er(),(e,t)=>{e.getSystem().broadcastOn([T_],{newFocus:t.event.newFocus})})])),oh("scroll-lock",[Zr(()=>{ja(St(),s)}),Qr(()=>{$a(St(),s)})]),...e.extraBehaviours]),eventOrder:{[gr()]:["dialog-events"],[Or()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[kr()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},Hz=e=>Xh.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),"data-mce-name":"close"}},buttonBehaviours:El([DC.config({}),Nx.config(e.tooltips.getConfig({tooltipText:e.translate("Close")}))]),components:[bb("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{Rr(e,VC)}}),Pz=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__title"],attributes:{...o.map(e=>({id:e})).getOr({})}},components:[],behaviours:El([uz.config({channel:`${C_}-${t}`,initialData:e,renderComponents:e=>[ai(n.translate(e.title))]})])}),Uz=()=>({dom:Kh('<div class="tox-dialog__draghandle"></div>')}),Wz=(e,t,o)=>((e,t,o)=>{const n=OR.parts.title(Pz(e,t,A.none(),o)),s=OR.parts.draghandle(Uz()),r=OR.parts.close(Hz(o)),a=[n].concat(e.draggable?[s]:[]).concat([r]);return OC.sketch({dom:Kh('<div class="tox-dialog__header"></div>'),components:a})})({title:o.shared.providers.translate(e),draggable:o.dialog.isDraggableModal()},t,o.shared.providers),jz=(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:Kh('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}),Gz=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=yi(e().element,".tox-dialog__header").map(e=>Gt(e));OR.setBusy(e(),(e,s)=>jz(o.message,s,t,n))},onUnblock:()=>{OR.setIdle(e())}}),$z="tox-dialog--fullscreen",qz="tox-dialog--width-lg",Yz="tox-dialog--width-md",Xz=e=>{switch(e){case"large":return A.some(qz);case"medium":return A.some(Yz);default:return A.none()}},Kz=(e,t)=>{const o=Le(t.element.dom);qa(o,$z)||(Xa(o,[qz,Yz]),Xz(e).each(e=>ja(o,e)))},Jz=(e,t)=>{const o=Le(e.element.dom),n=Ka(o),s=G(n,e=>e===qz||e===Yz).or(Xz(t));((e,t)=>{H(t,t=>{((e,t)=>{const o=Ha(e)?e.dom.classList.toggle(t):((e,t)=>R(Pa(e),t)?Wa(e,t):Ua(e,t))(e,t);Ga(e)})(e,t)})})(o,[$z,...s.toArray()])},Zz=(e,t,o)=>di(Vz({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[c_({}),...e.extraBehaviours],onEscape:e=>{Rr(e,VC)},dialogEvents:t,eventOrder:{[mr()]:[uz.name(),Fl.name()],[Or()]:["scroll-lock",uz.name(),"messages","dialog-events","alloy.base.behaviour"],[kr()]:["alloy.base.behaviour","dialog-events","messages",uz.name(),"scroll-lock"]}})),Qz=(e,t={})=>V(e,e=>"menu"===e.type?(e=>{const o=V(e.items,e=>{const o=be(t,e.name).getOr(Ms(!1));return{...e,storage:o}});return{...e,items:o}})(e):e),eL=e=>j(e,(e,t)=>"menu"===t.type?j(t.items,(e,t)=>(e[t.name]=t.storage,e),e):e,{}),tL=(e,t)=>[Yr(Ks(),x_),e(LC,(e,o,n,s)=>{Vl(bt(s.element)).fold(b,zl),t.onClose(),o.onClose()}),e(VC,(e,t,o,n)=>{t.onCancel(e),Rr(n,LC)}),jr(WC,(e,o)=>t.onUnblock()),jr(UC,(e,o)=>t.onBlock(o.event))],oL=(e,t,o)=>{const n=(t,o)=>jr(t,(t,n)=>{s(t,(s,r)=>{o(e(),s,n.event,t)})}),s=(e,t)=>{uz.getState(e).get().each(o=>{t(o.internalDialog,e)})};return[...tL(n,t),n(PC,(e,t)=>t.onSubmit(e)),n(zC,(e,t,o)=>{t.onChange(e,{name:o.name})}),n(HC,(e,t,n,s)=>{const r=()=>s.getSystem().isConnected()?$p.focusIn(s):void 0,a=e=>At(e,"disabled")||Et(e,"aria-disabled").exists(e=>"true"===e),i=bt(s.element),l=Vl(i);t.onAction(e,{name:n.name,value:n.value}),Vl(i).fold(r,e=>{a(e)||l.exists(t=>tt(e,t)&&a(t))?r():o().toOptional().filter(t=>!tt(t.element,e)).each(r)})}),n(jC,(e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})}),Qr(t=>{const o=e();yu.setValue(t,o.getData())})]},nL=(e,t)=>{const o=t.map(e=>e.footerButtons).getOr([]),n=P(o,e=>"start"===e.align),s=(e,t)=>OC.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:V(t,e=>e.memento.asSpec())});return[s("start",n.pass),s("end",n.fail)]},sL=(e,t,o)=>({dom:Kh('<div class="tox-dialog__footer"></div>'),components:[],behaviours:El([uz.config({channel:`${k_}-${t}`,initialData:e,updateState:(e,t)=>{const n=V(t.buttons,e=>{const t=Jh(((e,t)=>rE(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}});return A.some({lookupByName:t=>((e,t,o)=>G(t,e=>e.name===o).bind(t=>t.memento.getOpt(e)))(e,n,t),footerButtons:n})},renderComponents:nL})])}),rL=(e,t,o)=>OR.parts.footer(sL(e,t,o)),aL=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=_m.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return Kk.getField(o,t).orThunk(()=>{const o=e.getFooter().bind(e=>uz.getState(e).get());return o.bind(e=>e.lookupByName(t))})}return A.none()},iL=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},s={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...yu.getValue(n),...ce(o,e=>e.get())}},setData:t=>{n(n=>{const r=s.getData(),a=vn(r,t),i=((e,t)=>{const o=e.getRoot();return uz.getState(o).get().map(e=>Kn(Xn("data",e.dataValidator,t))).getOr(t)})(e,a),l=e.getFormWrapper();yu.setValue(l,i),le(o,(e,t)=>{ve(a,t)&&e.set(a[t])})})},setEnabled:(t,o)=>{aL(e,t).each(o?Hm.enable:Hm.disable)},focus:t=>{aL(e,t).each(ih.focus)},block:e=>{if(!r(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n(t=>{Nr(t,UC,{message:e})})},unblock:()=>{n(e=>{Rr(e,WC)})},showTab:t=>{n(o=>{const n=e.getBody();uz.getState(n).get().exists(e=>e.isTabPanel())&&_m.getCurrent(n).each(e=>{Oz.showTab(e,t)})})},redial:r=>{n(n=>{const a=e.getId(),i=t(r),l=Qz(i.internalDialog.buttons,o);n.getSystem().broadcastOn([`${S_}-${a}`],i),n.getSystem().broadcastOn([`${C_}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${O_}-${a}`],i.internalDialog),n.getSystem().broadcastOn([`${k_}-${a}`],{...i.internalDialog,buttons:l}),s.setData(i.initialData)})},close:()=>{n(e=>{Rr(e,LC)})},toggleFullscreen:e.toggleFullscreen};return s},lL=(e,t,o,n=!1,s)=>{const r=da("dialog"),a=da("dialog-label"),i=da("dialog-content"),l=e.internalDialog,c=Ms(l.size),d=Xz(c.get()).toArray(),u=Jh(((e,t,o,n)=>OC.sketch({dom:Kh('<div class="tox-dialog__header"></div>'),components:[Pz(e,t,A.some(o),n),Uz(),Hz(n)],containerBehaviours:El([lR.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>xi(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))({title:l.title,draggable:!0},r,a,o.shared.providers)),m=Jh(((e,t,o,n,s)=>Dz(e,t,A.some(o),n,s))({body:l.body,initialData:l.initialData},r,i,o,n)),g=Qz(l.buttons),p=eL(g),h=Oe(0!==g.length,Jh(((e,t,o)=>sL(e,t,o))({buttons:g},r,o))),f=oL(()=>v,{onBlock:e=>{QM.block(b,(t,n)=>{const s=u.getOpt(b).map(e=>Gt(e.element));return jz(e.message,n,o.shared.providers,s)})},onUnblock:()=>{QM.unblock(b)},onClose:()=>t.closeWindow()},o.shared.getSink),b=di({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog","aria-labelledby":a}},eventOrder:{[mr()]:[uz.name(),Fl.name()],[gr()]:["execute-on-form"],[Or()]:["reflecting","execute-on-form"]},behaviours:El([$p.config({mode:"cyclic",onEscape:e=>(Rr(e,LC),A.some(!0)),useTabstopAt:e=>!w_(e)&&("button"!==We(e)||"disabled"!==Tt(e,"disabled")),firstTabstop:1}),uz.config({channel:`${S_}-${r}`,updateState:(e,t)=>(c.set(t.internalDialog.size),Kz(t.internalDialog.size,e),s(),A.some(t)),initialData:e}),ih.config({}),oh("execute-on-form",f.concat([Jr(Ks(),(e,t)=>{$p.focusIn(e)}),jr(Er(),(e,t)=>{e.getSystem().broadcastOn([T_],{newFocus:t.event.newFocus})})])),QM.config({getRoot:()=>A.some(b)}),th.config({}),c_({})]),components:[u.asSpec(),m.asSpec(),...h.map(e=>e.asSpec()).toArray()]}),v=iL({getId:x(r),getRoot:x(b),getFooter:()=>h.map(e=>e.get(b)),getBody:()=>m.get(b),getFormWrapper:()=>{const e=m.get(b);return _m.getCurrent(e).getOr(e)},toggleFullscreen:()=>{Jz(b,c.get())}},t.redial,p);return{dialog:b,instanceApi:v}};var cL=tinymce.util.Tools.resolve("tinymce.util.URI");const dL=["insertContent","setContent","execCommand","close","block","unblock"],uL=e=>a(e)&&-1!==dL.indexOf(e.mceAction),mL=(e,t,o,n)=>{const s=da("dialog"),i=Wz(e.title,s,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[v_(A.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:El([DC.config({}),ih.config({})])})]}],behaviours:El([$p.config({mode:"acyclic",useTabstopAt:O(w_)})])};return OR.parts.body(t)})(e),c=e.buttons.bind(e=>0===e.length?A.none():A.some(rL({buttons:e},s,n))),u=((e,t)=>{const o=(e,t)=>jr(e,(e,o)=>{n(e,(n,s)=>{t(x,n,o.event,e)})}),n=(e,t)=>{uz.getState(e).get().each(o=>{t(o,e)})};return[...tL(o,t),o(HC,(e,t,o)=>{t.onAction(e,{name:o.name})})]})(0,Gz(()=>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 cL(e.url,{base_uri:new cL(window.location.href)}),f=`${h.protocol}://${h.host}${h.port?":"+h.port:""}`,b=nc(),v=[uz.config({channel:`${S_}-${s}`,updateState:(e,t)=>A.some(t),initialData:e}),oh("messages",[Zr(()=>{const t=ac(Le(window),"message",t=>{if(h.isSameOrigin(new cL(t.raw.origin))){const n=t.raw.data;uL(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=>!uL(e)&&a(e)&&ve(e,"mceAction"))(n)&&e.onMessage(x,n)}});b.set(t)}),Qr(b.clear)]),Fl.config({channels:{[__]:{onReceive:(e,t)=>{yi(e.element,"iframe").each(e=>{const o=e.dom.contentWindow;g(o)&&o.postMessage(t,f)})}}}})],y=Zz({id:s,header:i,body:l,footer:c,extraClasses:p,extraBehaviours:v,extraStyles:m},u,n),x=(e=>{const t=t=>{e.getSystem().isConnected()&&t(e)};return{block:e=>{if(!r(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(t=>{Nr(t,UC,{message:e})})},unblock:()=>{t(e=>{Rr(e,WC)})},close:()=>{t(e=>{Rr(e,LC)})},sendMessage:e=>{t(t=>{t.getSystem().broadcastOn([__],e)})}}})(y);return{dialog:y,instanceApi:x}},gL=(e,t)=>Kn(Xn("data",t,e)),pL=e=>pC(e,".tox-alert-dialog")||pC(e,".tox-confirm-dialog"),hL=(e,t,o)=>t&&o?[]:[xM.config({contextual:{lazyContext:()=>A.some(Qo(Le(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"],lazyViewport:t=>mC(e,t.element).map(e=>({bounds:gC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})})).getOrThunk(()=>({bounds:on(),optScrollEnv:A.none()}))})],fL=e=>{const t=e.editor,o=Ov(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const s=()=>{OR.hide(l),n()},r=Jh(rE({name:"close-alert",text:"OK",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"cancel",e)),a=Rz(),i=Fz(s,t.providers),l=di(Vz({lazySink:()=>t.getSink(),header:Iz(a,i),body:Nz(o,t.providers),footer:A.some(zz(Lz([],[r.asSpec()]))),onEscape:s,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[jr(VC,s)],eventOrder:{}}));OR.show(l);const c=r.get(l);ih.focus(c)}}})(e.backstages.dialog),s=(e=>{const t=e.shared;return{open:(o,n)=>{const s=e=>{OR.hide(c),n(e)},r=Jh(rE({name:"yes",text:"Yes",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"submit",e)),a=rE({name:"no",text:"No",primary:!1,buttonType:A.some("secondary"),align:"end",enabled:!0,icon:A.none()},"cancel",e),i=Rz(),l=Fz(()=>s(!1),t.providers),c=di(Vz({lazySink:()=>t.getSink(),header:Iz(i,l),body:Nz(o,t.providers),footer:A.some(zz(Lz([],[a,r.asSpec()]))),onEscape:()=>s(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[jr(VC,()=>s(!1)),jr(PC,()=>s(!0))],eventOrder:{}}));OR.show(c);const d=r.get(c);ih.focus(d)}}})(e.backstages.dialog),r=(t,o)=>iz.open((t,n,s)=>{const r=n,a=((e,t,o)=>{const n=da("dialog"),s=e.internalDialog,r=Wz(s.title,n,o),a=Ms(s.size),i=Xz(a.get()).toArray(),l=((e,t,o)=>{const n=Dz(e,t,A.none(),o,!1);return OR.parts.body(n)})({body:s.body,initialData:s.initialData},n,o),c=Qz(s.buttons),d=eL(c),u=Oe(0!==c.length,rL({buttons:c},n,o)),m=oL(()=>f,Gz(()=>p,o.shared.providers,t),o.shared.getSink),g={id:n,header:r,body:l,footer:u,extraClasses:i,extraBehaviours:[uz.config({channel:`${S_}-${n}`,updateState:(e,t)=>(a.set(t.internalDialog.size),Kz(t.internalDialog.size,e),A.some(t)),initialData:e})],extraStyles:{}},p=Zz(g,m,o),h={getId:x(n),getRoot:x(p),getBody:()=>OR.getBody(p),getFooter:()=>OR.getFooter(p),getFormWrapper:()=>{const e=OR.getBody(p);return _m.getCurrent(e).getOr(e)},toggleFullscreen:()=>{Jz(p,a.get())}},f=iL(h,t.redial,d);return{dialog:p,instanceApi:f}})({dataValidator:s,initialData:r,internalDialog:t},{redial:iz.redial,closeWindow:()=>{OR.hide(a.dialog),o(a.instanceApi)}},e.backstages.dialog);return OR.show(a.dialog),a.instanceApi.setData(r),a.instanceApi},t),a=(n,s,r,a)=>iz.open((n,i,l)=>{const c=gL(i,l),d=sc(),u=e.backstages.popup.shared.header.isPositionedAtTop(),m=()=>d.on(e=>{qh.reposition(e),o&&u||xM.refresh(e)}),g=lL({dataValidator:l,initialData:c,internalDialog:n},{redial:iz.redial,closeWindow:()=>{d.on(qh.hide),t.off("ResizeEditor",m),d.clear(),r(g.instanceApi)}},e.backstages.popup,a.ariaAttrs,m),p=di(qh.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:a.persistent?{event:"doNotDismissYet"}:{},...u?{}:{fireRepositionEventInstead:{}},inlineBehaviours:El([oh("window-manager-inline-events",[jr(_r(),(e,t)=>{Rr(g.dialog,VC)})]),...hL(t,o,u)]),isExtraPart:(e,t)=>pL(t)}));return d.set(p),qh.showWithinBounds(p,ui(g.dialog),{anchor:s},()=>{const e=t.inline?St():Le(t.getContainer()),o=Qo(e);return A.some(o)}),o&&u||(xM.refresh(p),t.on("ResizeEditor",m)),g.instanceApi.setData(c),$p.focusIn(g.dialog),g.instanceApi},n),i=(o,n,s,r)=>iz.open((o,a,i)=>{const l=gL(a,i),c=sc(),d=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>c.on(e=>{qh.reposition(e),xM.refresh(e)}),m=lL({dataValidator:i,initialData:l,internalDialog:o},{redial:iz.redial,closeWindow:()=>{c.on(qh.hide),t.off("ResizeEditor ScrollWindow ElementScroll",u),c.clear(),s(m.instanceApi)}},e.backstages.popup,r.ariaAttrs,u),g=di(qh.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:r.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:El([oh("window-manager-inline-events",[jr(_r(),(e,t)=>{Rr(m.dialog,VC)})]),xM.config({contextual:{lazyContext:()=>A.some(Qo(Le(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>mC(t,e.element).map(e=>({bounds:gC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Kt(e.element).top})})).getOrThunk(()=>({bounds:on(),optScrollEnv:A.none()}))})]),isExtraPart:(e,t)=>pL(t)}));return c.set(g),qh.showWithinBounds(g,ui(m.dialog),{anchor:n},()=>e.backstages.popup.shared.getSink().toOptional().bind(e=>{const o=mC(t,e.element).map(e=>gC(e)).getOr(on()),n=Qo(Le(t.getContentAreaContainer())),s=tn(n,o);return A.some(Zo(s.x,s.y,s.width,s.height-15))})),xM.refresh(g),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",u),m.instanceApi.setData(l),$p.focusIn(m.dialog),m.instanceApi},o);return{open:(t,o,n)=>{if(!u(o)){if("toolbar"===o.inline)return a(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return i(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return a(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return r(t,n)},openUrl:(o,n)=>((o,n)=>iz.openUrl(o=>{const s=mL(o,{closeWindow:()=>{OR.hide(s.dialog),n(s.instanceApi)}},t,e.backstages.dialog);return OR.show(s.dialog),s.instanceApi},o))(o,n),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{s.open(e,t)}}};nn.add("silver",e=>{(e=>{Tb(e),(e=>{const t=e.options.register,o=e=>f(e,r)?{value:Jw(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:tS(e)}),t("color_cols_foreground",{processor:n,default:oS(e,Xw)}),t("color_cols_background",{processor:n,default:oS(e,Kw)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:Qw}),t("color_default_background",{processor:"string",default:Qw})})(e),(e=>{const t=e.options.register;t("contextmenu_avoid_overlap",{processor:"string",default:""}),t("contextmenu_never_use_native",{processor:"boolean",default:!1}),t("contextmenu",{processor:e=>!1===e?{value:[],valid:!0}:r(e)||f(e,r)?{value:oF(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)})(e);let t=()=>on();const{dialogs:o,popups:n,renderUI:s}=xR(e,{getPopupSinkBounds:()=>t()});lC(e,n.backstage.shared);const a=fL({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}});return{renderUI:()=>{const o=s();return mC(e,n.getMothership().element).each(e=>{t=()=>gC(e)}),o},getWindowManagerImpl:x(a),getNotificationManagerImpl:()=>((e,t,o)=>{const n=t.backstage.shared,s=()=>{const t=Qo(Le(e.getContentAreaContainer())),o=on(),n=el(o.x,t.x,t.right),s=el(o.y,t.y,t.bottom),r=Math.max(t.right,o.right),a=Math.max(t.bottom,o.bottom);return A.some(Zo(n,s,r-n,a-s))};return{open:(t,r)=>{const a=()=>{r(),qh.hide(l)},i=di(yb.sketch({text:t.text,level:R(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:a,iconProvider:n.providers.icons,translationProvider:n.providers.translate})),l=di(qh.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&&Yh.setEditorTimeout(e,()=>{a()},t.timeout);const c={close:a,reposition:()=>{const t=ui(i),o={maxHeightFunction:pc()},r=e.notificationManager.getNotifications();if(r[0]===c){const e={...n.anchors.banner(),overrides:o};qh.showWithinBounds(l,t,{anchor:e},s)}else F(r,c).each(e=>{const n=r[e-1].getEl(),a={type:"node",root:St(),node:A.some(Le(n)),overrides:o,layouts:{onRtl:()=>[pl],onLtr:()=>[pl]}};qh.showWithinBounds(l,t,{anchor:a},s)})},text:e=>{yb.updateText(i,e)},settings:t,getEl:()=>i.element.dom,progressBar:{value:e=>{yb.updateProgress(i,e)}}};return c},close:e=>{e.close()},getArgs:e=>e.settings}})(e,{backstage:n.backstage},n.getMothership())}})}();
|