theme.min.js 357 KB

123456789
  1. /**
  2. * Copyright (c) Tiny Technologies, Inc. All rights reserved.
  3. * Licensed under the LGPL or a commercial license.
  4. * For LGPL see License.txt in the project root for license information.
  5. * For commercial licenses see https://www.tiny.cloud/
  6. *
  7. * Version: 5.0.7 (2019-06-05)
  8. */
  9. !function(x){"use strict";var tt=function(){},t=function(t){return function(){return t()}},p=function(e,o){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(o.apply(null,t))}},nt=function(t){return function(){return t}},d=function(t){return t};function g(o){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=r.concat(t);return o.apply(null,e)}}var n,e,o,r,i,w=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return!e.apply(null,t)}},u=function(t){return function(){throw new Error(t)}},a=nt(!1),c=nt(!0),s=a,f=c,l=function(){return m},m=(r={fold:function(t,n){return t()},is:s,isSome:s,isNone:f,getOr:o=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:o,orThunk:e,map:l,ap:l,each:function(){},bind:l,flatten:l,exists:s,forall:f,filter:l,equals:n=function(t){return t.isNone()},equals_:n,toArray:function(){return[]},toString:nt("none()")},Object.freeze&&Object.freeze(r),r),h=function(e){var t=function(){return e},n=function(){return r},o=function(t){return t(e)},r={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:f,isNone:s,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){return h(t(e))},ap:function(t){return t.fold(l,function(t){return h(t(e))})},each:function(t){t(e)},bind:o,flatten:t,exists:o,forall:o,filter:function(t){return t(e)?r:m},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(s,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return r},et={some:h,none:l,from:function(t){return null===t||t===undefined?m:h(t)}},v=function(n){return function(t){return function(t){if(null===t)return"null";var n=typeof t;return"object"===n&&Array.prototype.isPrototypeOf(t)?"array":"object"===n&&String.prototype.isPrototypeOf(t)?"string":n}(t)===n}},S=v("string"),k=v("object"),D=v("array"),C=(v("null"),v("boolean")),b=(v("undefined"),v("function")),_=v("number"),y=Array.prototype.slice,O=(i=Array.prototype.indexOf)===undefined?function(t,n){return z(t,n)}:function(t,n){return i.call(t,n)},E=function(t,n){var e=O(t,n);return-1===e?et.none():et.some(e)},T=function(t,n){return-1<O(t,n)},B=function(t,n){return P(t,n).isSome()},A=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=y.call(t,o,o+n);e.push(r)}return e},M=function(t,n){for(var e=t.length,o=new Array(e),r=0;r<e;r++){var i=t[r];o[r]=n(i,r,t)}return o},F=function(t,n){for(var e=0,o=t.length;e<o;e++)n(t[e],e,t)},I=function(t,n){for(var e=t.length-1;0<=e;e--)n(t[e],e,t)},V=function(t,n){for(var e=[],o=[],r=0,i=t.length;r<i;r++){var u=t[r];(n(u,r,t)?e:o).push(u)}return{pass:e,fail:o}},R=function(t,n){for(var e=[],o=0,r=t.length;o<r;o++){var i=t[o];n(i,o,t)&&e.push(i)}return e},H=function(t,n,e){return I(t,function(t){e=n(e,t)}),e},U=function(t,n,e){return F(t,function(t){e=n(e,t)}),e},N=function(t,n){for(var e=0,o=t.length;e<o;e++){var r=t[e];if(n(r,e,t))return et.some(r)}return et.none()},P=function(t,n){for(var e=0,o=t.length;e<o;e++)if(n(t[e],e,t))return et.some(e);return et.none()},z=function(t,n){for(var e=0,o=t.length;e<o;++e)if(t[e]===n)return e;return-1},L=Array.prototype.push,j=function(t){for(var n=[],e=0,o=t.length;e<o;++e){if(!Array.prototype.isPrototypeOf(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);L.apply(n,t[e])}return n},W=function(t,n){var e=M(t,n);return j(e)},G=function(t,n){for(var e=0,o=t.length;e<o;++e)if(!0!==n(t[e],e,t))return!1;return!0},X=function(t){var n=y.call(t,0);return n.reverse(),n},Y=function(t,n){return R(t,function(t){return!T(n,t)})},q=function(t){return[t]},K=function(t,n){var e=y.call(t,0);return e.sort(n),e},$=function(t){return 0===t.length?et.none():et.some(t[0])},J=function(t){return 0===t.length?et.none():et.some(t[t.length-1])},Z=b(Array.from)?Array.from:function(t){return y.call(t)},Q=Object.keys,ot=Object.hasOwnProperty,rt=function(t,n){for(var e=Q(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i,t)}},it=function(t,o){return ut(t,function(t,n,e){return{k:n,v:o(t,n,e)}})},ut=function(o,r){var i={};return rt(o,function(t,n){var e=r(t,n,o);i[e.k]=e.v}),i},at=function(t,e){var o=[];return rt(t,function(t,n){o.push(e(t,n))}),o},ct=function(t,n){for(var e=Q(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return et.some(u)}return et.none()},st=function(t){return at(t,function(t){return t})},ft=function(t,n){return lt(t,n)?et.from(t[n]):et.none()},lt=function(t,n){return ot.call(t,n)},dt=function(n){return function(t){return lt(t,n)?et.from(t[n]):et.none()}},mt=function(t,n){return dt(n)(t)},gt=function(t,n){var e={};return e[t]=n,e},pt=function(e){return{is:function(t){return e===t},isValue:c,isError:a,getOr:nt(e),getOrThunk:nt(e),getOrDie:nt(e),or:function(t){return pt(e)},orThunk:function(t){return pt(e)},fold:function(t,n){return n(e)},map:function(t){return pt(t(e))},mapError:function(t){return pt(e)},each:function(t){t(e)},bind:function(t){return t(e)},exists:function(t){return t(e)},forall:function(t){return t(e)},toOption:function(){return et.some(e)}}},ht=function(e){return{is:a,isValue:a,isError:c,getOr:d,getOrThunk:function(t){return t()},getOrDie:function(){return u(String(e))()},or:function(t){return t},orThunk:function(t){return t()},fold:function(t,n){return t(e)},map:function(t){return ht(e)},mapError:function(t){return ht(t(e))},each:tt,bind:function(t){return ht(e)},exists:a,forall:c,toOption:et.none}},vt={value:pt,error:ht,fromOption:function(t,n){return t.fold(function(){return ht(n)},pt)}},bt=function(u){if(!D(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],e={};return F(u,function(t,o){var n=Q(t);if(1!==n.length)throw new Error("one and only one name per case");var r=n[0],i=t[r];if(e[r]!==undefined)throw new Error("duplicate key detected:"+r);if("cata"===r)throw new Error("cannot have a case named cata (sorry)");if(!D(i))throw new Error("case arguments must be an array");a.push(r),e[r]=function(){var t=arguments.length;if(t!==i.length)throw new Error("Wrong number of arguments to case "+r+". Expected "+i.length+" ("+i+"), got "+t);for(var e=new Array(t),n=0;n<e.length;n++)e[n]=arguments[n];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[o].apply(null,e)},match:function(t){var n=Q(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!G(a,function(t){return T(n,t)}))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+a.join(", "));return t[r].apply(null,e)},log:function(t){x.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},yt=(bt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),Object.prototype.hasOwnProperty),xt=function(u){return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(0===t.length)throw new Error("Can't merge zero objects");for(var e={},o=0;o<t.length;o++){var r=t[o];for(var i in r)yt.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},wt=xt(function(t,n){return k(t)&&k(n)?wt(t,n):n}),St=xt(function(t,n){return n}),kt=function(t,n){return e=n,o={},rt(t,function(t,n){T(e,n)||(o[n]=t)}),o;var e,o},Ct=function(t){return dt(t)},Ot=function(t,n){return e=t,o=n,function(t){return lt(t,e)?t[e]:o};var e,o},Et=function(t,n){return mt(t,n)},Tt=function(t,n){return gt(t,n)},Bt=function(t){return n={},F(t,function(t){n[t.key]=t.value}),n;var n},At=function(t,n){var e,o,r,i,u,a=(e=[],o=[],F(t,function(t){t.fold(function(t){e.push(t)},function(t){o.push(t)})}),{errors:e,values:o});return 0<a.errors.length?(u=a.errors,p(vt.error,j)(u)):(i=n,0===(r=a.values).length?vt.value(i):vt.value(wt(i,St.apply(undefined,r))))},Dt=function(t,n){return lt(e=t,o=n)&&e[o]!==undefined&&null!==e[o];var e,o},_t=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return _t(e())}}},Mt=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o<t.length;o++)t[o].each(e);return n},Ft=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return et.none()},It=function(t,n){for(var e=[],o=0;o<t.length;o++){var r=t[o];if(!r.isSome())return et.none();e.push(r.getOrDie())}return et.some(n.apply(null,e))};(function k_(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=t.pop();return It(t,e)});var Vt,Rt,Ht=nt("touchstart"),Nt=nt("touchmove"),Pt=nt("touchend"),zt=nt("mousedown"),Lt=nt("mousemove"),jt=nt("mouseout"),Ut=nt("mouseup"),Wt=nt("mouseover"),Gt=nt("focusin"),Xt=nt("focusout"),Yt=nt("keydown"),qt=nt("keyup"),Kt=nt("input"),$t=nt("change"),Jt=nt("click"),Zt=nt("transitionend"),Qt=nt("selectstart"),tn=function(e){var o,r=!1;return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r||(r=!0,o=e.apply(null,t)),o}},nn=function(t,n){var e=function(t,n){for(var e=0;e<t.length;e++){var o=t[e];if(o.test(n))return o}return undefined}(t,n);if(!e)return{major:0,minor:0};var o=function(t){return Number(n.replace(e,"$"+t))};return on(o(1),o(2))},en=function(){return on(0,0)},on=function(t,n){return{major:t,minor:n}},rn={nu:on,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?en():nn(t,e)},unknown:en},un="Firefox",an=function(t,n){return function(){return n===t}},cn=function(t){var n=t.current;return{current:n,version:t.version,isEdge:an("Edge",n),isChrome:an("Chrome",n),isIE:an("IE",n),isOpera:an("Opera",n),isFirefox:an(un,n),isSafari:an("Safari",n)}},sn={unknown:function(){return cn({current:undefined,version:rn.unknown()})},nu:cn,edge:nt("Edge"),chrome:nt("Chrome"),ie:nt("IE"),opera:nt("Opera"),firefox:nt(un),safari:nt("Safari")},fn="Windows",ln="Android",dn="Solaris",mn="FreeBSD",gn=function(t,n){return function(){return n===t}},pn=function(t){var n=t.current;return{current:n,version:t.version,isWindows:gn(fn,n),isiOS:gn("iOS",n),isAndroid:gn(ln,n),isOSX:gn("OSX",n),isLinux:gn("Linux",n),isSolaris:gn(dn,n),isFreeBSD:gn(mn,n)}},hn={unknown:function(){return pn({current:undefined,version:rn.unknown()})},nu:pn,windows:nt(fn),ios:nt("iOS"),android:nt(ln),linux:nt("Linux"),osx:nt("OSX"),solaris:nt(dn),freebsd:nt(mn)},vn=function(t,n){var e=String(n).toLowerCase();return N(t,function(t){return t.search(e)})},bn=function(t,e){return vn(t,e).map(function(t){var n=rn.detect(t.versionRegexes,e);return{current:t.name,version:n}})},yn=function(t,e){return vn(t,e).map(function(t){var n=rn.detect(t.versionRegexes,e);return{current:t.name,version:n}})},xn=function(t,n){return-1!==t.indexOf(n)},wn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Sn=function(n){return function(t){return xn(t,n)}},kn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return xn(t,"edge/")&&xn(t,"chrome")&&xn(t,"safari")&&xn(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,wn],search:function(t){return xn(t,"chrome")&&!xn(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return xn(t,"msie")||xn(t,"trident")}},{name:"Opera",versionRegexes:[wn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Sn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Sn("firefox")},{name:"Safari",versionRegexes:[wn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(xn(t,"safari")||xn(t,"mobile/"))&&xn(t,"applewebkit")}}],Cn=[{name:"Windows",search:Sn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return xn(t,"iphone")||xn(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Sn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Sn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Sn("linux"),versionRegexes:[]},{name:"Solaris",search:Sn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Sn("freebsd"),versionRegexes:[]}],On={browsers:nt(kn),oses:nt(Cn)},En=function(t){var n,e,o,r,i,u,a,c,s,f,l,d=On.browsers(),m=On.oses(),g=bn(d,t).fold(sn.unknown,sn.nu),p=yn(m,t).fold(hn.unknown,hn.nu);return{browser:g,os:p,deviceType:(e=g,o=t,r=(n=p).isiOS()&&!0===/ipad/i.test(o),i=n.isiOS()&&!r,u=n.isAndroid()&&3===n.version.major,a=n.isAndroid()&&4===n.version.major,c=r||u||a&&!0===/mobile/i.test(o),s=n.isiOS()||n.isAndroid(),f=s&&!c,l=e.isSafari()&&n.isiOS()&&!1===/safari/i.test(o),{isiPad:nt(r),isiPhone:nt(i),isTablet:nt(c),isPhone:nt(f),isTouch:nt(s),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:nt(l)})}},Tn={detect:tn(function(){var t=x.navigator.userAgent;return En(t)})},Bn={tap:nt("alloy.tap")},An=nt("alloy.focus"),Dn=nt("alloy.blur.post"),_n=nt("alloy.paste.post"),Mn=nt("alloy.receive"),Fn=nt("alloy.execute"),In=nt("alloy.focus.item"),Vn=Bn.tap,Rn=Tn.detect().deviceType.isTouch()?Bn.tap:Jt,Hn=nt("alloy.longpress"),Nn=nt("alloy.sandbox.close"),Pn=nt("alloy.typeahead.cancel"),zn=nt("alloy.system.init"),Ln=nt("alloy.system.scroll"),jn=nt("alloy.system.resize"),Un=nt("alloy.system.attached"),Wn=nt("alloy.system.detached"),Gn=nt("alloy.system.dismissRequested"),Xn=nt("alloy.focusmanager.shifted"),Yn=nt("alloy.slotcontainer.visibility"),qn=nt("alloy.change.tab"),Kn=nt("alloy.dismiss.tab"),$n=nt("alloy.highlight"),Jn=nt("alloy.dehighlight"),Zn=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:nt(t)}},Qn={fromHtml:function(t,n){var e=(n||x.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw x.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return Zn(e.childNodes[0])},fromTag:function(t,n){var e=(n||x.document).createElement(t);return Zn(e)},fromText:function(t,n){var e=(n||x.document).createTextNode(t);return Zn(e)},fromDom:Zn,fromPoint:function(t,n,e){var o=t.dom();return et.from(o.elementFromPoint(n,e)).map(Zn)}},te=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(n.length!==e.length)throw new Error('Wrong number of arguments to struct. Expected "['+n.length+']", got '+e.length+" arguments");var o={};return F(n,function(t,n){o[t]=nt(e[n])}),o}},ne=function(t){return t.slice(0).sort()},ee=function(n,t){if(!D(t))throw new Error("The "+n+" fields must be an array. Was: "+t+".");F(t,function(t){if(!S(t))throw new Error("The value "+t+" in the "+n+" fields was not a string.")})},oe=function(r,i){var e,u=r.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return ee("required",r),ee("optional",i),e=ne(u),N(e,function(t,n){return n<e.length-1&&t===e[n+1]}).each(function(t){throw new Error("The field: "+t+" occurs more than once in the combined fields: ["+e.join(", ")+"].")}),function(n){var e=Q(n);G(r,function(t){return T(e,t)})||function(t,n){throw new Error("All required keys ("+ne(t).join(", ")+") were not specified. Specified keys were: "+ne(n).join(", ")+".")}(r,e);var t=R(e,function(t){return!T(u,t)});0<t.length&&function(t){throw new Error("Unsupported keys for object: "+ne(t).join(", "))}(t);var o={};return F(r,function(t){o[t]=nt(n[t])}),F(i,function(t){o[t]=nt(Object.prototype.hasOwnProperty.call(n,t)?et.some(n[t]):et.none())}),o}},re="undefined"!=typeof x.window?x.window:Function("return this;")(),ie=function(t,n){return function(t,n){for(var e=n!==undefined&&null!==n?n:re,o=0;o<t.length&&e!==undefined&&null!==e;++o)e=e[t[o]];return e}(t.split("."),n)},ue={getOrDie:function(t,n){var e=ie(t,n);if(e===undefined||null===e)throw t+" not available on this browser";return e}},ae=(x.Node.ATTRIBUTE_NODE,x.Node.CDATA_SECTION_NODE,x.Node.COMMENT_NODE,x.Node.DOCUMENT_NODE),ce=(x.Node.DOCUMENT_TYPE_NODE,x.Node.DOCUMENT_FRAGMENT_NODE,x.Node.ELEMENT_NODE),se=x.Node.TEXT_NODE,fe=(x.Node.PROCESSING_INSTRUCTION_NODE,x.Node.ENTITY_REFERENCE_NODE,x.Node.ENTITY_NODE,x.Node.NOTATION_NODE,ce),le=ae,de=function(t,n){var e=t.dom();if(e.nodeType!==fe)return!1;if(e.matches!==undefined)return e.matches(n);if(e.msMatchesSelector!==undefined)return e.msMatchesSelector(n);if(e.webkitMatchesSelector!==undefined)return e.webkitMatchesSelector(n);if(e.mozMatchesSelector!==undefined)return e.mozMatchesSelector(n);throw new Error("Browser lacks native selectors")},me=function(t){return t.nodeType!==fe&&t.nodeType!==le||0===t.childElementCount},ge=function(t,n){var e=n===undefined?x.document:n.dom();return me(e)?[]:M(e.querySelectorAll(t),Qn.fromDom)},pe=function(t,n){var e=n===undefined?x.document:n.dom();return me(e)?et.none():et.from(e.querySelector(t)).map(Qn.fromDom)},he=function(t,n){return t.dom()===n.dom()},ve=(Tn.detect().browser.isIE(),function(t){return Qn.fromDom(t.dom().ownerDocument)}),be=function(t){var n=t.dom().ownerDocument.defaultView;return Qn.fromDom(n)},ye=function(t){var n=t.dom();return et.from(n.parentNode).map(Qn.fromDom)},xe=function(t){var n=t.dom();return et.from(n.offsetParent).map(Qn.fromDom)},we=function(t){var n=t.dom();return M(n.childNodes,Qn.fromDom)},Se=function(t,n){var e=t.dom().childNodes;return et.from(e[n]).map(Qn.fromDom)},ke=(te("element","offset"),function(n,e){ye(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})}),Ce=function(t,n){var e;(e=t.dom(),et.from(e.nextSibling).map(Qn.fromDom)).fold(function(){ye(t).each(function(t){Ee(t,n)})},function(t){ke(t,n)})},Oe=function(n,e){Se(n,0).fold(function(){Ee(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},Ee=function(t,n){t.dom().appendChild(n.dom())},Te=function(n,t){F(t,function(t){Ee(n,t)})},Be=function(t){t.dom().textContent="",F(we(t),function(t){Ae(t)})},Ae=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},De=function(t){var n,e=we(t);0<e.length&&(n=t,F(e,function(t){ke(n,t)})),Ae(t)},_e=function(t){return t.dom().innerHTML},Me=function(t,n){var e,o,r=ve(t).dom(),i=Qn.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||x.document).createElement("div")).innerHTML=e,we(Qn.fromDom(o)));Te(i,u),Be(t),Ee(t,i)},Fe=function(t){return t.dom().nodeName.toLowerCase()},Ie=function(t){return t.dom().nodeType},Ve=function(n){return function(t){return Ie(t)===n}},Re=Ve(ce),He=Ve(se),Ne=Ve(ae),Pe=function(t,n,e){if(!(S(e)||C(e)||_(e)))throw x.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},ze=function(t,n,e){Pe(t.dom(),n,e)},Le=function(t,n){var e=t.dom();rt(n,function(t,n){Pe(e,n,t)})},je=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},We=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},Ge=function(t,n){t.dom().removeAttribute(n)},Xe=function(t){return n=t,e=!1,Qn.fromDom(n.dom().cloneNode(e));var n,e},Ye=function(t){var n,e,o,r=Xe(t);return n=r,e=Qn.fromTag("div"),o=Qn.fromDom(n.dom().cloneNode(!0)),Ee(e,o),_e(e)},qe=function(t){return Ye(t)},Ke="unknown",$e="__CHROME_INSPECTOR_CONNECTION_TO_ALLOY__";(Rt=Vt||(Vt={}))[Rt.STOP=0]="STOP",Rt[Rt.NORMAL=1]="NORMAL",Rt[Rt.LOGGING=2]="LOGGING";var Je=_t({}),Ze=function(n,t,e){var o,r,i,u;switch(Et(Je.get(),n).orThunk(function(){var t=Q(Je.get());return Ft(t,function(t){return-1<n.indexOf(t)?et.some(Je.get()[t]):et.none()})}).getOr(Vt.NORMAL)){case Vt.NORMAL:return e(oo());case Vt.LOGGING:var a=(o=n,r=t,i=[],u=(new Date).getTime(),{logEventCut:function(t,n,e){i.push({outcome:"cut",target:n,purpose:e})},logEventStopped:function(t,n,e){i.push({outcome:"stopped",target:n,purpose:e})},logNoParent:function(t,n,e){i.push({outcome:"no-parent",target:n,purpose:e})},logEventNoHandlers:function(t,n){i.push({outcome:"no-handlers-left",target:n})},logEventResponse:function(t,n,e){i.push({outcome:"response",purpose:e,target:n})},write:function(){var t=(new Date).getTime();T(["mousemove","mouseover","mouseout",zn()],o)||x.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:M(i,function(t){return T(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+qe(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case Vt.STOP:return!0}},Qe=["alloy/data/Fields","alloy/debugging/Debugging"],to=function(t,n,e){return Ze(t,n,e)},no=function(){if(x.window[$e]!==undefined)return x.window[$e];var n=function(t,n){var e=Je.get();e[t]=n,Je.set(e)};return x.window[$e]={systems:{},lookup:function(n){var e=x.window[$e].systems,t=Q(e);return Ft(t,function(t){return e[t].getByUid(n).toOption().map(function(t){return Tt(qe(t.element()),(n=function(e){var t=e.spec();return{"(original.spec)":t,"(dom.ref)":e.element().dom(),"(element)":qe(e.element()),"(initComponents)":M(t.components!==undefined?t.components:[],n),"(components)":M(e.components(),n),"(bound.events)":at(e.events(),function(t,n){return[n]}).join(", "),"(behaviours)":t.behaviours!==undefined?it(t.behaviours,function(t,n){return t===undefined?"--revoked--":{config:t.configAsRaw(),"original-config":t.initialConfig,state:e.readState(n)}}):"none"}})(t));var n})}).orThunk(function(){return et.some({error:"Systems ("+t.join(", ")+") did not contain uid: "+n})})},events:{setToNormal:function(t){n(t,Vt.NORMAL)},setToLogging:function(t){n(t,Vt.LOGGING)},setToStop:function(t){n(t,Vt.STOP)}}},x.window[$e]},eo=function(t,n){no().systems[t]=n},oo=nt({logEventCut:tt,logEventStopped:tt,logNoParent:tt,logEventNoHandlers:tt,logEventResponse:tt,write:tt}),ro=0,io=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++ro+String(n)},uo=tinymce.util.Tools.resolve("tinymce.ThemeManager"),ao=function(){return(ao=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function co(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)n.indexOf(o[r])<0&&(e[o[r]]=t[o[r]])}return e}(function C_(t,n){function e(){this.constructor=t}Ue(t,n),t.prototype=null===n?Object.create(n):(n.prototype,new e)}),function O_(t,n,e,o){var r,i=arguments.length,u=i<3?n:null===o?Object.getOwnPropertyDescriptor(n,e):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)Reflect.decorate(t,n,e,o);else for(var a=t.length-1;0<=a;a--)t[a]&&(i<3?r(u):3<i?r(n,e,u):r(n,e));return 3<i&&u&&Object.defineProperty(n,e,u),u},function E_(e,o){return function(t,n){o(t,n,e)}},function T_(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)},function B_(n,u,a,c){return new(a||Promise)(function(t,e){function o(t){try{i(c.next(t))}catch(n){e(n)}}function r(t){try{i(c["throw"](t))}catch(n){e(n)}}function i(n){n.done?t(n.value):new a(function(t){t(n.value)}).then(o,r)}i(c.apply(n,u||[]).next())})},function A_(o,r){var i,u,a,t,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return n(0),n(1),n(2),"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function n(n){return function(t){return function e(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(u&&(2&t[0]?u["return"]:t[0]?u["throw"]||(u["return"]&&a.call(u),0):u.next)&&!a.call(u,t[1]).done)return a;switch(a&&(t[0],a.value),t[0]){case 0:case 1:break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,t[1];continue;case 7:c.ops.pop(),c.trys.pop();continue;default:if(!(0<c.trys.length&&a[a.length-1]||6!==t[0]&&2!==t[0]))continue;if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){c.label=t[1];break}if(6===t[0]&&c.label<a[1]){c.label=a[1];break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(t);break}a[2]&&c.ops.pop(),c.trys.pop();continue}r.call(o,c)}catch(n){}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([n,t])}}},function D_(t,n){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])},function __(){for(var t=[],n=0;n<arguments.length;n++)t.concat(df(arguments[n]));return t},function M_(t,n,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=e.apply(t,n||[]),u=[];return o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(o){i[o]&&(r[o]=function(e){return new Promise(function(t,n){1<u.push([o,e,t,n])||a(o,e)})})}function a(t,n){try{!function e(t){t.value instanceof ff?Promise.resolve(t.value.v).then(c,s):f(u[0][2],t)}(i[t](n))}catch(o){f(u[0][3],o)}}function c(t){a("next",t)}function s(t){a("throw",t)}function f(t,n){t(n),u.shift(),u.length&&a(u[0][0],u[0][1])}},function F_(o){var t,r;return n("next"),n("throw",function(t){throw t}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,e){t[n]=o[n]?function(t){return r?e?e(t):t:{value:ff(o[n](t)),done:"return"===n}}:e}},function I_(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=i[Symbol.asyncIterator];return n?n.call(i):(cf(),e("next"),e("throw"),e("return"),t[Symbol.asyncIterator]=function(){return this},t);function e(o){t[o]=i[o]&&function(e){return new Promise(function(t,n){!function r(n,t,e,o){Promise.resolve(o).then(function(t){n({value:t,done:e})},t)}(t,n,i[o](e).done,e.value)})}}},function V_(t,n){return Object.defineProperty?Object.defineProperty(t,"raw",{value:n}):t.raw=n,t},function R_(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n["default"]=t,n},function H_(t){return t&&t.__esModule?t:{"default":t}};var so,fo,lo=bt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),mo=function(t){return lo.defaultedThunk(nt(t))},go=lo.strict,po=lo.asOption,ho=lo.defaultedThunk,vo=lo.mergeWithThunk;(fo=so||(so={}))[fo.Error=0]="Error",fo[fo.Value=1]="Value";var bo=function(t,n,e){return t.stype===so.Error?n(t.serror):e(t.svalue)},yo=function(t){return{stype:so.Value,svalue:t}},xo=function(t){return{stype:so.Error,serror:t}},wo=function(t){return t.fold(xo,yo)},So=function(t){return bo(t,vt.error,vt.value)},ko=yo,Co=function(t){var n=[],e=[];return F(t,function(t){bo(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},Oo=xo,Eo=function(t,n){return t.stype===so.Value?n(t.svalue):t},To=function(t,n){return t.stype===so.Error?n(t.serror):t},Bo=function(t,n){return t.stype===so.Value?{stype:so.Value,svalue:n(t.svalue)}:t},Ao=function(t,n){return t.stype===so.Error?{stype:so.Error,serror:n(t.serror)}:t},Do=function(t){return p(Oo,j)(t)},_o=function(t,n){var e,o,r=Co(t);return 0<r.errors.length?Do(r.errors):(e=r.values,o=n,0<e.length?ko(wt(o,St.apply(undefined,e))):ko(o))},Mo=function(t){var n=Co(t);return 0<n.errors.length?Do(n.errors):ko(n.values)},Fo=bt([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),Io=bt([{field:["name","presence","type"]},{state:["name"]}]),Vo=function(){return ue.getOrDie("JSON")},Ro=function(t,n,e){return Vo().stringify(t,n,e)},Ho=function(t){return k(t)&&100<Q(t).length?" removed due to size":Ro(t,null,2)},No=function(t,n){return Oo([{path:t,getErrorInfo:n}])},Po=bt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),zo=function(e,o,r){return mt(o,r).fold(function(){return t=r,n=o,No(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+Ho(n)});var t,n},ko)},Lo=function(t,n,e){var o=mt(t,n).fold(function(){return e(t)},d);return ko(o)},jo=function(a,c,t,s){return t.fold(function(r,e,t,o){var i=function(t){var n=o.extract(a.concat([r]),s,t);return Bo(n,function(t){return gt(e,s(t))})},u=function(t){return t.fold(function(){var t=gt(e,s(et.none()));return ko(t)},function(t){var n=o.extract(a.concat([r]),s,t);return Bo(n,function(t){return gt(e,s(et.some(t)))})})};return t.fold(function(){return Eo(zo(a,c,r),i)},function(t){return Eo(Lo(c,r,t),i)},function(){return Eo(ko(mt(c,r)),u)},function(t){return Eo((e=t,o=mt(n=c,r).map(function(t){return!0===t?e(n):t}),ko(o)),u);var n,e,o},function(t){var n=t(c),e=Bo(Lo(c,r,nt({})),function(t){return wt(n,t)});return Eo(e,i)})},function(t,n){var e=n(c);return ko(gt(t,s(e)))})},Uo=function(o){return{extract:function(e,t,n){return To(o(n,t),function(t){return n=t,No(e,function(){return n});var n})},toString:function(){return"val"},toDsl:function(){return Fo.itemOf(o)}}},Wo=function(t){var c=Go(t),s=H(t,function(n,t){return t.fold(function(t){return wt(n,Tt(t,!0))},nt(n))},{});return{extract:function(t,n,e){var o,r,i,u=C(e)?[]:(r=Q(o=e),R(r,function(t){return Dt(o,t)})),a=R(u,function(t){return!Dt(s,t)});return 0===a.length?c.extract(t,n,e):(i=a,No(t,function(){return"There are unsupported fields: ["+i.join(", ")+"] specified"}))},toString:c.toString,toDsl:c.toDsl}},Go=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=M(a,function(t){return jo(o,r,t,i)}),_o(u,{});var o,r,i,u},toString:function(){return"obj{\n"+M(a,function(t){return t.fold(function(t,n,e,o){return t+" -> "+o.toString()},function(t,n){return"state("+t+")"})}).join("\n")+"}"},toDsl:function(){return Fo.objOf(M(a,function(t){return t.fold(function(t,n,e,o){return Io.field(t,e,o)},function(t,n){return Io.state(t)})}))}}},Xo=function(r){return{extract:function(e,o,t){var n=M(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return Mo(n)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return Fo.arrOf(r)}}},Yo=function(a,c){return{extract:function(e,o,r){var t,n,i=Q(r),u=(t=e,n=i,Xo(Uo(a)).extract(t,d,n));return Eo(u,function(t){var n=M(t,function(t){return Po.field(t,t,go(),c)});return Go(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"},toDsl:function(){return Fo.setOf(a,c)}}},qo=nt(Uo(ko)),Ko=p(Xo,Go),$o=Po.state,Jo=Po.field,Zo=function(e,n,o,r,i){return Et(r,i).fold(function(){return t=r,n=i,No(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+Ho(t)});var t,n},function(t){return Go(t).extract(e.concat(["branch: "+i]),n,o)})},Qo=function(r,i){return{extract:function(n,e,o){return Et(o,r).fold(function(){return t=r,No(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return Zo(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+Q(i)},toDsl:function(){return Fo.choiceOf(r,i)}}},tr=Uo(ko),nr=function(t){return Ko(t)},er=function(){return Xo(tr)},or=function(n){return Uo(function(t){return n(t).fold(Oo,ko)})},rr=function(n,t){return Yo(function(t){return wo(n(t))},t)},ir=function(t,n,e,o){var r=n.extract([t],e,o);return Ao(r,function(t){return{input:o,errors:t}})},ur=function(t,n,e){return So(ir(t,n,d,e))},ar=function(t){return t.fold(function(t){throw new Error(sr(t))},d)},cr=function(t,n,e){return ar(ur(t,n,e))},sr=function(t){return"Errors: \n"+(n=t.errors,e=10<n.length?n.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):n,M(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}))+"\n\nInput object: "+Ho(t.input);var n,e},fr=function(t,n){return Qo(t,n)},lr=nt(tr),dr=function(e,o){return Uo(function(t){var n=typeof t;return e(t)?ko(t):Oo("Expected type: "+o+" but got: "+n)})},mr=dr(_,"number"),gr=dr(S,"string"),pr=dr(C,"boolean"),hr=dr(b,"function"),vr=function(n){return or(function(t){return T(n,t)?vt.value(t):vt.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},br=function(t){return Jo(t,t,go(),qo())},yr=function(t,n){return Jo(t,t,go(),n)},xr=function(t){return yr(t,gr)},wr=function(t,n){return Jo(t,t,go(),vr(n))},Sr=function(t){return yr(t,hr)},kr=function(t,n){return Jo(t,t,go(),Go(n))},Cr=function(t,n){return Jo(t,t,go(),Ko(n))},Or=function(t,n){return Jo(t,t,go(),Xo(n))},Er=function(t){return Jo(t,t,po(),qo())},Tr=function(t,n){return Jo(t,t,po(),n)},Br=function(t){return Tr(t,mr)},Ar=function(t){return Tr(t,gr)},Dr=function(t){return Tr(t,hr)},_r=function(t,n){return Tr(t,Go(n))},Mr=function(t,n){return Jo(t,t,mo(n),qo())},Fr=function(t,n,e){return Jo(t,t,mo(n),e)},Ir=function(t,n){return Fr(t,n,mr)},Vr=function(t,n){return Fr(t,n,gr)},Rr=function(t,n,e){return Fr(t,n,vr(e))},Hr=function(t,n){return Fr(t,n,pr)},Nr=function(t,n){return Fr(t,n,hr)},Pr=function(t,n,e){return Fr(t,n,Go(e))},zr=function(t,n){return $o(t,n)},Lr=function(t,n){return he(t.element(),n.event().target())},jr=function(t){if(!Dt(t,"can")&&!Dt(t,"abort")&&!Dt(t,"run"))throw new Error("EventHandler defined by: "+Ro(t,null,2)+" does not have can, abort, or run!");return cr("Extracting event.handler",Wo([Mr("can",nt(!0)),Mr("abort",nt(!1)),Mr("run",tt)]),t)},Ur=function(e){var n,o,r,i,t=(n=e,o=function(t){return t.can},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return U(n,function(t,n){return t&&o(n).apply(undefined,e)},!0)}),u=(r=e,i=function(t){return t.abort},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return U(r,function(t,n){return t||i(n).apply(undefined,e)},!1)});return jr({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];F(e,function(t){t.run.apply(undefined,n)})}})},Wr=function(t,n){qr(t,t.element(),n,{})},Gr=function(t,n,e){qr(t,t.element(),n,e)},Xr=function(t){Wr(t,Fn())},Yr=function(t,n,e){qr(t,n,e,{})},qr=function(t,n,e,o){var r=ao({target:n},o);t.getSystem().triggerEvent(e,n,it(r,nt))},Kr=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())};function $r(t,n,e,o,r){return t(e,o)?et.some(e):b(r)&&r(e)?et.none():n(e,o,r)}var Jr,Zr=function(t){var n=He(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},Qr=tn(function(){return ti(Qn.fromDom(x.document))}),ti=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return Qn.fromDom(n)},ni=function(t,n,e){for(var o=t.dom(),r=b(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=Qn.fromDom(o);if(n(i))return et.some(i);if(r(i))break}return et.none()},ei=function(t,n,e){return $r(function(t){return n(t)},ni,t,n,e)},oi=function(t,o){var r=function(t){for(var n=0;n<t.childNodes.length;n++){if(o(Qn.fromDom(t.childNodes[n])))return et.some(Qn.fromDom(t.childNodes[n]));var e=r(t.childNodes[n]);if(e.isSome())return e}return et.none()};return r(t.dom())},ri=function(t,n,e){return ei(t,function(t){return n(t).isSome()},e).bind(n)},ii=function(t){return Bt(t)},ui=function(t,n){return{key:t,value:jr({abort:n})}},ai=function(t,n){return{key:t,value:jr({can:n})}},ci=function(t){return{key:t,value:jr({run:function(t,n){n.event().prevent()}})}},si=function(t,n){return{key:t,value:jr({run:n})}},fi=function(t,n,e){return{key:t,value:jr({run:function(t){n.apply(undefined,[t].concat(e))}})}},li=function(t){return function(e){return{key:t,value:jr({run:function(t,n){Lr(t,n)&&e(t,n)}})}}},di=function(e,o){return si(e,function(t,n){t.getSystem().getByUid(o).each(function(t){Kr(t,t.element(),e,n)})})},mi=function(t,n,e){var o=n.partUids[e];return di(t,o)},gi=function(t,r){return si(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return ri(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},nt(!1)).getOr(n)},function(t){return t});r(n,o,t)})},pi=function(t){return si(t,function(t,n){n.cut()})},hi=function(t){return si(t,function(t,n){n.stop()})},vi=function(t,n){return li(t)(n)},bi=li(Un()),yi=li(Wn()),xi=li(zn()),wi=(Jr=Fn(),function(t){return si(Jr,t)}),Si=ii([ai(An(),function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(he(e=r,t.element())&&!he(e,o)&&(x.console.warn(An()+" did not get interpreted by the desired target. \nOriginator: "+qe(r)+"\nTarget: "+qe(i)+"\nCheck the "+An()+" event handlers"),1))})]),ki=/* */Object.freeze({events:Si}),Ci=nt("alloy-id-"),Oi=nt("data-alloy-id"),Ei=Ci(),Ti=Oi(),Bi=function(t,n){Object.defineProperty(t.dom(),Ti,{value:n,writable:!0})},Ai=function(t){var n=Re(t)?t.dom()[Ti]:null;return et.from(n)},Di=function(t){return io(t)},_i=d,Mi=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+"\n"+qe(n().element())+" is not in context.")}};return{debugInfo:nt("fake"),triggerEvent:t("triggerEvent"),triggerFocus:t("triggerFocus"),triggerEscape:t("triggerEscape"),build:t("build"),addToWorld:t("addToWorld"),removeFromWorld:t("removeFromWorld"),addToGui:t("addToGui"),removeFromGui:t("removeFromGui"),getByUid:t("getByUid"),getByDom:t("getByDom"),broadcast:t("broadcast"),broadcastOn:t("broadcastOn"),broadcastEvent:t("broadcastEvent"),isConnected:nt(!1)}},Fi=Mi(),Ii=function(t){return M(t,function(t){return o=n="/*",r=(e=t).length-n.length,""!==o&&(e.length<o.length||e.substr(r,r+o.length)!==o)?t:t.substring(0,t.length-"/*".length);var n,e,o,r})},Vi=function(t,n){var e=t.toString(),o=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,o-1).split(/,\s*/);return t.toFunctionAnnotation=function(){return{name:n,parameters:Ii(i)}},t},Ri=io("alloy-premade"),Hi=function(t){return Tt(Ri,t)},Ni=function(t){return Et(t,Ri)},Pi=function(o){return t=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o.apply(undefined,[t.getApis()].concat([t].concat(n)))},n=o.toString(),e=n.indexOf(")")+1,r=n.indexOf("("),i=n.substring(r+1,e-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:Ii(i.slice(1))}},t;var t,n,e,r,i},zi={init:function(){return Li({readState:function(){return"No State required"}})}},Li=function(t){return t},ji=function(t,r){var i={};return rt(t,function(t,o){rt(t,function(t,n){var e=Ot(n,[])(i);i[n]=e.concat([r(o,t)])})}),i},Ui=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},Wi=function(t,n){return e=g.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:nt(o)};var e,o},Gi=function(t){return t.cHandler},Xi=function(t,n){return{name:nt(t),handler:nt(n)}},Yi=function(t,n,e){var o,r,i=ao({},e,(o=t,r={},F(n,function(t){r[t.name()]=t.handlers(o)}),r));return ji(i,Xi)},qi=function(t){var n,i=b(n=t)?{can:nt(!0),abort:nt(!1),run:n}:n;return function(t,n){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var r=[t,n].concat(e);i.abort.apply(undefined,r)?n.stop():i.can.apply(undefined,r)&&i.run.apply(undefined,r)}},Ki=function(t,n,e){var o,r,i=n[e];return i?function(u,a,t,c){var n=t.slice(0);try{var e=n.sort(function(t,n){var e=t[a](),o=n[a](),r=c.indexOf(e),i=c.indexOf(o);if(-1===r)throw new Error("The ordering for "+u+" does not have an entry for "+e+".\nOrder specified: "+Ro(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+Ro(c,null,2));return r<i?-1:i<r?1:0});return vt.value(e)}catch(o){return vt.error([o])}}("Event: "+e,"name",t,i).map(function(t){var n=M(t,function(t){return t.handler()});return Ur(n)}):(o=e,r=t,vt.error(["The event ("+o+') 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: '+Ro(M(r,function(t){return t.name()}),null,2)]))},$i=function(t,i){var n=at(t,function(o,r){return(1===o.length?vt.value(o[0].handler()):Ki(o,i,r)).map(function(t){var n=qi(t),e=1<o.length?R(i,function(n){return T(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return Tt(r,{handler:n,purpose:nt(e)})})});return At(n,{})},Ji=function(t){return ur("custom.definition",Go([Jo("dom","dom",go(),Go([br("tag"),Mr("styles",{}),Mr("classes",[]),Mr("attributes",{}),Er("value"),Er("innerHtml")])),br("components"),br("uid"),Mr("events",{}),Mr("apis",{}),Jo("eventOrder","eventOrder",(n={"alloy.execute":["disabling","alloy.base.behaviour","toggling","typeaheadevents"],"alloy.focus":["alloy.base.behaviour","focusing","keying"],"alloy.system.init":["alloy.base.behaviour","disabling","toggling","representing"],input:["alloy.base.behaviour","representing","streaming","invalidating"],"alloy.system.detached":["alloy.base.behaviour","representing","item-events","tooltipping"],mousedown:["focusing","alloy.base.behaviour","item-type-events"],mouseover:["item-type-events","tooltipping"]},lo.mergeWithThunk(nt(n))),lr()),Er("domModification")]),t);var n},Zi=function(t,n){var e=je(t,n);return e===undefined||""===e?[]:e.split(" ")},Qi=function(t){return t.dom().classList!==undefined},tu=function(t){return Zi(t,"class")},nu=function(t,n){return r=n,i=Zi(e=t,o="class").concat([r]),ze(e,o,i.join(" ")),!0;var e,o,r,i},eu=function(t,n){return r=n,0<(i=R(Zi(e=t,o="class"),function(t){return t!==r})).length?ze(e,o,i.join(" ")):Ge(e,o),!1;var e,o,r,i},ou=function(t,n){Qi(t)?t.dom().classList.add(n):nu(t,n)},ru=function(t,n){var e;Qi(t)?t.dom().classList.remove(n):eu(t,n),0===(Qi(e=t)?e.dom().classList:tu(e)).length&&Ge(e,"class")},iu=function(t,n){return Qi(t)&&t.dom().classList.contains(n)},uu=function(n,t){F(t,function(t){ou(n,t)})},au=function(n,t){F(t,function(t){ru(n,t)})},cu=function(t){return t.style!==undefined},su=function(t,n,e){if(!S(e))throw x.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);cu(t)&&t.style.setProperty(n,e)},fu=function(t,n){cu(t)&&t.style.removeProperty(n)},lu=function(t,n,e){var o=t.dom();su(o,n,e)},du=function(t,n){var e=t.dom();rt(n,function(t,n){su(e,n,t)})},mu=function(t,n){var e=t.dom();rt(n,function(t,n){t.fold(function(){fu(e,n)},function(t){su(e,n,t)})})},gu=function(t,n){var e=t.dom(),o=x.window.getComputedStyle(e).getPropertyValue(n),r=""!==o||Zr(t)?o:pu(e,n);return null===r?undefined:r},pu=function(t,n){return cu(t)?t.style.getPropertyValue(n):""},hu=function(t,n){var e=t.dom(),o=pu(e,n);return et.from(o).filter(function(t){return 0<t.length})},vu=function(t,n,e){var o=Qn.fromTag(t);return lu(o,n,e),hu(o,n).isSome()},bu=function(t,n){var e=t.dom();fu(e,n),We(t,"style")&&""===je(t,"style").replace(/^\s+|\s+$/g,"")&&Ge(t,"style")},yu=function(t){return t.dom().offsetWidth},xu=function(t){return t.dom().value},wu=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},Su=function(t,n){return e=t,r=M(o=n,function(t){return _r(t.name(),[br("config"),Mr("state",zi)])}),i=ur("component.behaviours",Go(r),e.behaviours).fold(function(t){throw new Error(sr(t)+"\nComplete spec:\n"+Ro(e,null,2))},function(t){return t}),{list:o,data:it(i,function(t){var n=t.map(function(t){return{config:t.config,state:t.state.init(t.config)}});return function(){return n}})};var e,o,r,i},ku=function(t){var n,e,o,r=(n=t,e=Ot("behaviours",{})(n),o=R(Q(e),function(t){return e[t]!==undefined}),M(o,function(t){return e[t].me}));return Su(t,r)},Cu=function(t,n,e){var o,r,i,u=ao({},(o=t).dom,{uid:o.uid,domChildren:M(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return Ui({})},Ui),c={"alloy.base.modification":a},s=0<n.length?function(n,t,e,o){var r=ao({},t);F(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=ji(r,function(t,n){return{name:t,modification:n}}),u=function(t){return H(t,function(t,n){return ao({},n.modification,t)},{})},a=H(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return Ui({classes:a,attributes:c,styles:s})}(e,c,n,u):a;return i=s,ao({},r=u,{attributes:ao({},r.attributes,i.attributes),styles:ao({},r.styles,i.styles),classes:r.classes.concat(i.classes)})},Ou=function(t,n,e){var o,r,i,u,a,c,s={"alloy.base.behaviour":(o=t,o.events)};return(r=e,i=t.eventOrder,u=n,a=s,c=Yi(r,u,a),$i(c,i)).getOrDie()},Eu=function(e){var t=function(){return f},o=_t(Fi),n=ar(Ji(e)),r=ku(e),i=r.list,u=r.data,a=function(t){var n=Qn.fromTag(t.tag);Le(n,t.attributes),uu(n,t.classes),du(n,t.styles),t.innerHtml.each(function(t){return Me(n,t)});var e=t.domChildren;return Te(n,e),t.value.each(function(t){wu(n,t)}),t.uid,Bi(n,t.uid),n}(Cu(n,i,u)),c=Ou(n,i,u),s=_t(n.components),f={getSystem:o.get,config:function(t){var n=u;return(b(n[t.name()])?n[t.name()]:function(){throw new Error("Could not find "+t.name()+" in "+Ro(e,null,2))})()},hasConfigured:function(t){return b(u[t.name()])},spec:nt(e),readState:function(t){return u[t]().map(function(t){return t.state.readState()}).getOr("not enabled")},getApis:function(){return n.apis},connect:function(t){o.set(t)},disconnect:function(){o.set(Mi(t))},element:nt(a),syncComponents:function(){var t=we(a),n=W(t,function(t){return o.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});s.set(n)},components:s.get,events:nt(c)};return f},Tu=function(t){var n,e,o=_i(t),r=o.events,i=co(o,["events"]),u=(n=i,e=Ot("components",[])(n),M(e,_u)),a=ao({},i,{events:ao({},ki,r),components:u});return vt.value(Eu(a))},Bu=function(t){var n=Qn.fromText(t);return Au({element:n})},Au=function(t){var n=cr("external.component",Wo([br("element"),Er("uid")]),t),e=_t(Mi());n.uid.each(function(t){Bi(n.element,t)});var o={getSystem:e.get,config:et.none,hasConfigured:nt(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(Mi(function(){return o}))},getApis:function(){return{}},element:nt(n.element),spec:nt(t),readState:nt("No state"),syncComponents:tt,components:nt([]),events:nt({})};return Hi(o)},Du=Di,_u=function(n){return Ni(n).fold(function(){var t=n.hasOwnProperty("uid")?n:ao({uid:Du("")},n);return Tu(t).getOrDie()},function(t){return t})},Mu=Hi,Fu=function(t,n,e){return ei(t,n,e).isSome()},Iu=function(t,n,e){return ni(t,function(t){return de(t,n)},e)},Vu=function(t,n){return pe(n,t)},Ru=function(t,n,e){return $r(de,Iu,t,n,e)},Hu=function(){var n=io("aria-owns");return{id:nt(n),link:function(t){ze(t,"aria-owns",n)},unlink:function(t){Ge(t,"aria-owns")}}},Nu=function(n,t){return(e=t,ei(e,function(t){if(!Re(t))return!1;var n=je(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=je(t,"id"),e=ve(t);return Vu(e,'[aria-owns="'+n+'"]')})).exists(function(t){return Pu(n,t)});var e},Pu=function(n,t){return Fu(t,function(t){return he(t,n.element())},nt(!1))||Nu(n,t)},zu=nt([br("menu"),br("selectedMenu")]),Lu=nt([br("item"),br("selectedItem")]),ju=(nt(Go(Lu().concat(zu()))),nt(Go(Lu()))),Uu=kr("initSize",[br("numColumns"),br("numRows")]),Wu=function(){return kr("markers",[br("backgroundMenu")].concat(zu()).concat(Lu()))},Gu=function(t){return kr("markers",M(t,br))},Xu=function(t,n,e){return function(){var t=new Error;if(t.stack!==undefined){var n=t.stack.split("\n");N(n,function(n){return 0<n.indexOf("alloy")&&!B(Qe,function(t){return-1<n.indexOf(t)})}).getOr(Ke)}}(),Jo(n,n,e,or(function(e){return vt.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},Yu=function(t){return Xu(0,t,mo(tt))},qu=function(t){return Xu(0,t,mo(et.none))},Ku=function(t){return Xu(0,t,go())},$u=function(t){return Xu(0,t,go())},Ju=function(t,n){return zr(t,nt(n))},Zu=function(t){return zr(t,d)},Qu=nt(Uu),ta=function(e,o,r){return xi(function(t,n){r(t,e,o)})},na=function(t,n,e,o,r,i){var u,a,c=Wo(t),s=_r(n,[(u="config",a=t,Tr(u,Wo(a)))]);return ra(c,s,n,e,o,r,i)},ea=function(r,i,u){var t,n,e,o,a,c;return t=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=[e].concat(t);return e.config({name:nt(r)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+r+". Using API: "+u)},function(t){var n=Array.prototype.slice.call(o,1);return i.apply(undefined,[e,t.config,t.state].concat(n))})},n=u,e=i.toString(),o=e.indexOf(")")+1,a=e.indexOf("("),c=e.substring(a+1,o-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:n,parameters:Ii(c.slice(0,1).concat(c.slice(3)))}},t},oa=function(t){return{key:t,value:undefined}},ra=function(e,t,o,r,n,i,u){var a=function(t){return Dt(t,o)?t[o]():et.none()},c=it(n,function(t,n){return ea(o,t,n)}),s=it(i,function(t,n){return Vi(t,n)}),f=ao({},s,c,{revoke:g(oa,o),config:function(t){var n=cr(o+"-config",e,t);return{key:o,value:{config:n,me:f,configAsRaw:tn(function(){return cr(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return Et(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(Ui({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return Ot("events",function(t,n){return{}})(r)(t.config,t.state)}).getOr({})}});return f},ia=function(t){return Bt(t)},ua=Wo([br("fields"),br("name"),Mr("active",{}),Mr("apis",{}),Mr("state",zi),Mr("extra",{})]),aa=function(t){var n=cr("Creating behaviour: "+t.name,ua,t);return na(n.fields,n.name,n.active,n.apis,n.extra,n.state)},ca=Wo([br("branchKey"),br("branches"),br("name"),Mr("active",{}),Mr("apis",{}),Mr("state",zi),Mr("extra",{})]),sa=function(t){var n,e,o,r,i,u,a,c,s=cr("Creating behaviour: "+t.name,ca,t);return n=fr(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=_r(e,[Tr("config",a=n)]),ra(a,c,e,o,r,i,u)},fa=nt(undefined),la=/* */Object.freeze({events:function(a){return ii([si(Mn(),function(r,i){var t,n,u=a.channels,e=Q(u),o=(t=e,(n=i).universal()?t:R(t,function(t){return T(n.channels(),t)}));F(o,function(t){var n=u[t],e=n.schema,o=cr("channel["+t+"] data\nReceiver: "+qe(r.element()),e,i.data());n.onReceive(r,o)})})])}}),da=[yr("channels",rr(vt.value,Wo([Ku("onReceive"),Mr("schema",lr())])))],ma=aa({fields:da,name:"receiving",active:la}),ga=/* */Object.freeze({exhibit:function(t,n){return Ui({classes:[],styles:n.useFixed?{}:{position:"relative"}})}}),pa=function(e,o){return{left:nt(e),top:nt(o),translate:function(t,n){return pa(e+t,o+n)}}},ha=pa,va=function(t,n){return t!==undefined?t:n!==undefined?n:0},ba=function(t){var n,e,o=t.dom().ownerDocument,r=o.body,i=(n=Qn.fromDom(o),(e=n.dom())===e.window&&n instanceof x.Window?n:Ne(n)?e.defaultView||e.parentWindow:null),u=o.documentElement,a=va(i.pageYOffset,u.scrollTop),c=va(i.pageXOffset,u.scrollLeft),s=va(u.clientTop,r.clientTop),f=va(u.clientLeft,r.clientLeft);return ya(t).translate(c-f,a-s)},ya=function(t){var n,e,o,r=t.dom(),i=r.ownerDocument,u=i.body,a=Qn.fromDom(i.documentElement);return u===r?ha(u.offsetLeft,u.offsetTop):(n=t,e=a||Qn.fromDom(x.document.documentElement),ni(n,g(he,e)).isSome()?(o=r.getBoundingClientRect(),ha(o.left,o.top)):ha(0,0))},xa=(Tn.detect().browser.isSafari(),function(t){var n=t!==undefined?t.dom():x.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return ha(e,o)});function wa(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=gu(t,o);return parseFloat(e)||0}return n},i=function(r,t){return U(t,function(t,n){var e=gu(r,n),o=e===undefined?0:parseInt(e,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!_(n)&&!n.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+n);var e=t.dom();cu(e)&&(e.style[o]=n+"px")},get:t,getOuter:t,aggregate:i,max:function(t,n,e){var o=i(t,e);return o<n?n-o:0}}}var Sa=wa("width",function(t){return t.dom().offsetWidth}),ka=function(t){return Sa.get(t)},Ca=function(t){return Sa.getOuter(t)},Oa=wa("height",function(t){var n=t.dom();return Zr(t)?n.getBoundingClientRect().height:n.offsetHeight}),Ea=function(t){return Oa.get(t)},Ta=function(t){return Oa.getOuter(t)},Ba=oe(["x","y","width","height","maxHeight","direction","classes","label","candidateYforTest"],[]),Aa=te("position","left","top","right","bottom"),Da=bt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),_a=Da.southeast,Ma=Da.southwest,Fa=Da.northeast,Ia=Da.northwest,Va=Da.south,Ra=Da.north,Ha=Da.east,Na=Da.west,Pa=te("point","width","height"),za=te("x","y","width","height"),La=function(t,n,e,o){return{x:nt(t),y:nt(n),width:nt(e),height:nt(o),right:nt(t+e),bottom:nt(n+o)}},ja=function(t){var n=ba(t),e=Ca(t),o=Ta(t);return La(n.left(),n.top(),e,o)},Ua=function(o,t){return o.view(t).fold(nt([]),function(t){var n=o.owner(t),e=Ua(o,n);return[t].concat(e)})},Wa=/* */Object.freeze({view:function(t){return(t.dom()===x.document?et.none():et.from(t.dom().defaultView.frameElement)).map(Qn.fromDom)},owner:function(t){return ve(t)}}),Ga=function(o){var t,n,e,r,i=Qn.fromDom(x.document),u=xa(i);return(t=o,e=(n=Wa).owner(t),r=Ua(n,e),et.some(r)).fold(g(ba,o),function(t){var n=ya(o),e=H(t,function(t,n){var e=ya(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return ha(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},Xa=function(){var t=x.window.innerWidth,n=x.window.innerHeight,e=Qn.fromDom(x.document),o=xa(e);return La(o.left(),o.top(),t,n)},Ya=bt([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),qa=function(t,n,e,o,r,i){var u,a,c,s,f,l,d,m,g,p=n.x()-e,h=n.y()-o,v=r-(p+n.width()),b=i-(h+n.height()),y=et.some(p),x=et.some(h),w=et.some(v),S=et.some(b),k=et.none();return u=n.direction(),a=function(){return Aa(t,y,x,k,k)},c=function(){return Aa(t,k,x,w,k)},s=function(){return Aa(t,y,k,k,S)},f=function(){return Aa(t,k,k,w,S)},l=function(){return Aa(t,y,x,k,k)},d=function(){return Aa(t,y,k,k,S)},m=function(){return Aa(t,y,x,k,k)},g=function(){return Aa(t,k,x,w,k)},u.fold(a,c,s,f,l,d,m,g)},Ka=function(t,n){var e=g(Ga,n),o=t.fold(e,e,function(){var t=xa();return Ga(n).translate(-t.left(),-t.top())}),r=Ca(n),i=Ta(n);return La(o.left(),o.top(),r,i)},$a=Ya.relative,Ja=Ya.fixed,Za=te("anchorBox","origin"),Qa=bt([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),tc=function(t,H,N,P,z){var L=N.width(),j=N.height(),o=function(t,o,r,i){var n,e,u,a,c,s,f,l,d,m,g,p,h,v,b,y,x,w,S,k,C,O,E,T,B,A,D,_,M,F,I,V,R=t(H,N,P);return(e=L,u=j,a=z,d=(n=R).x(),m=n.y(),g=n.bubble().offset().left(),p=n.bubble().offset().top(),h=a.x(),v=a.y(),b=a.width(),y=a.height(),k=v<=(w=m+p),C=(S=h<=(x=d+g))&&k,O=x+e<=h+b&&w+u<=v+y,E=S?Math.min(e,h+b-x):Math.abs(h-(x+e)),T=k?Math.min(u,v+y-w):Math.abs(v-(w+u)),B=a.x()+a.width(),A=Math.max(a.x(),x),D=Math.min(A,B),M=nt((_=k?w:w+(u-T))+T-v),F=nt(v+y-_),c=n.direction(),f=s=F,l=M,I=c.fold(s,s,l,l,s,l,f,f),V=Ba({x:D,y:_,width:E,height:T,maxHeight:I,direction:n.direction(),classes:{on:n.bubble().classesOn(),off:n.bubble().classesOff()},label:n.label(),candidateYforTest:w}),C&&O?Qa.fit(V):Qa.nofit(V,E,T)).fold(Qa.fit,function(t,n,e){return i<e||r<n?Qa.nofit(t,n,e):Qa.nofit(o,r,i)})};return U(t,function(t,n){var e=g(o,n);return t.fold(Qa.fit,e)},Qa.nofit(Ba({x:H.x(),y:H.y(),width:N.width(),height:N.height(),maxHeight:N.height(),direction:_a(),classes:[],label:"none",candidateYforTest:H.y()}),-1,-1)).fold(d,d)},nc=function(t,n,e,o){bu(n,"max-height");var r,i={width:nt(Ca(r=n)),height:nt(Ta(r))};return tc(o.preference(),t,i,e,o.bounds())},ec=function(t,n,e){var o,r,i=function(t){return t+"px"},u=(o=e.origin(),r=n,o.fold(function(){return Aa("absolute",et.some(r.x()),et.some(r.y()),et.none(),et.none())},function(t,n,e,o){return qa("absolute",r,t,n,e,o)},function(t,n,e,o){return qa("fixed",r,t,n,e,o)}));mu(t,{position:et.some(u.position()),left:u.left().map(i),top:u.top().map(i),right:u.right().map(i),bottom:u.bottom().map(i)})},oc=function(t,n){var e,o,r;e=t,o=Math.floor(n),r=Oa.max(e,o,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]),lu(e,"max-height",r+"px")},rc=nt(function(t,n){oc(t,n),du(t,{"overflow-x":"hidden","overflow-y":"auto"})}),ic=nt(function(t,n){oc(t,n)}),uc=oe(["bounds","origin","preference","maxHeightFunction"],[]),ac=function(t,n,e,o,r,i){var u,a,c,s,f,l=(u=i,a="maxHeightFunction",c=rc(),u[a]===undefined?c:u[a]),d=t.anchorBox(),m=t.origin(),g=uc({bounds:(s=m,f=r,f.fold(function(){return s.fold(Xa,Xa,La)},function(t){return s.fold(t,t,La)})),origin:m,preference:o,maxHeightFunction:l});cc(d,n,e,g)},cc=function(t,n,e,o){var r,i,u,a,c=nc(t,n,e,o);ec(n,c,o),r=n,i=c.classes(),au(r,i.off),uu(r,i.on),u=n,a=c,o.maxHeightFunction()(u,a.maxHeight())},sc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],fc=function(t,n,e){var r=function(t){return Et(e,t).getOr([])},o=function(t,n,e){var o=Y(sc,e);return{offset:function(){return ha(t,n)},classesOn:function(){return W(e,r)},classesOff:function(){return W(o,r)}}};return{southeast:function(){return o(-t,n,["top","alignLeft"])},southwest:function(){return o(t,n,["top","alignRight"])},south:function(){return o(-t/2,n,["top","alignCentre"])},northeast:function(){return o(-t,-n,["bottom","alignLeft"])},northwest:function(){return o(t,-n,["bottom","alignRight"])},north:function(){return o(-t/2,-n,["bottom","alignCentre"])},east:function(){return o(t,-n/2,["valignCentre","left"])},west:function(){return o(-t,-n/2,["valignCentre","right"])}}},lc=function(){return fc(0,0,{})},dc=te("x","y","bubble","direction","label"),mc=function(t){return t.x()},gc=function(t,n){return t.x()+t.width()/2-n.width()/2},pc=function(t,n){return t.x()+t.width()-n.width()},hc=function(t,n){return t.y()-n.height()},vc=function(t){return t.y()+t.height()},bc=function(t,n){return t.y()+t.height()/2-n.height()/2},yc=function(t,n,e){return dc(mc(t),vc(t),e.southeast(),_a(),"layout-se")},xc=function(t,n,e){return dc(pc(t,n),vc(t),e.southwest(),Ma(),"layout-sw")},wc=function(t,n,e){return dc(mc(t),hc(t,n),e.northeast(),Fa(),"layout-ne")},Sc=function(t,n,e){return dc(pc(t,n),hc(t,n),e.northwest(),Ia(),"layout-nw")},kc=function(t,n,e){return dc(gc(t,n),hc(t,n),e.north(),Ra(),"layout-n")},Cc=function(t,n,e){return dc(gc(t,n),vc(t),e.south(),Va(),"layout-s")},Oc=function(t,n,e){return dc((o=t).x()+o.width(),bc(t,n),e.east(),Ha(),"layout-e");var o},Ec=function(t,n,e){return dc((o=n,t.x()-o.width()),bc(t,n),e.west(),Na(),"layout-w");var o},Tc=function(){return[yc,xc,wc,Sc,Cc,kc,Oc,Ec]},Bc=function(){return[xc,yc,Sc,wc,Cc,kc,Oc,Ec]},Ac=function(t){return t},Dc=function(n,e){return function(t){return"rtl"===_c(t)?e:n}},_c=function(t){return"rtl"===gu(t,"direction")?"rtl":"ltr"},Mc=function(){return _r("layouts",[br("onLtr"),br("onRtl")])},Fc=function(n,t,e,o){var r=t.layouts.map(function(t){return t.onLtr(n)}).getOr(e),i=t.layouts.map(function(t){return t.onRtl(n)}).getOr(o);return Dc(r,i)(n)},Ic=[br("hotspot"),Er("bubble"),Mr("overrides",{}),Mc(),Ju("placement",function(t,n,e){var o=n.hotspot,r=Ka(e,o.element()),i=Fc(t.element(),n,Tc(),Bc());return et.some(Ac({anchorBox:r,bubble:n.bubble.getOr(lc()),overrides:n.overrides,layouts:i,placer:et.none()}))})],Vc=[br("x"),br("y"),Mr("height",0),Mr("width",0),Mr("bubble",lc()),Mr("overrides",{}),Mc(),Ju("placement",function(t,n,e){var o=La(n.x,n.y,n.width,n.height),r=Fc(t.element(),n,Tc(),Bc());return et.some(Ac({anchorBox:o,bubble:n.bubble,overrides:n.overrides,layouts:r,placer:et.none()}))})],Rc=(bt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),bt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}])),Hc=te("start","soffset","finish","foffset"),Nc=Rc.exact,Pc=function(t,n,e,o){var r,i,u,a,c,s=(i=n,u=e,a=o,(c=ve(r=t).dom().createRange()).setStart(r.dom(),i),c.setEnd(u.dom(),a),c),f=he(t,e)&&n===o;return s.collapsed&&!f},zc=function(t,n,e){var o,r,i=t.document.createRange();return o=i,n.fold(function(t){o.setStartBefore(t.dom())},function(t,n){o.setStart(t.dom(),n)},function(t){o.setStartAfter(t.dom())}),r=i,e.fold(function(t){r.setEndBefore(t.dom())},function(t,n){r.setEnd(t.dom(),n)},function(t){r.setEndAfter(t.dom())}),i},Lc=function(t,n,e,o,r){var i=t.document.createRange();return i.setStart(n.dom(),e),i.setEnd(o.dom(),r),i},jc=function(t){return{left:nt(t.left),top:nt(t.top),right:nt(t.right),bottom:nt(t.bottom),width:nt(t.width),height:nt(t.height)}},Uc=bt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Wc=function(t,n,e){return n(Qn.fromDom(e.startContainer),e.startOffset,Qn.fromDom(e.endContainer),e.endOffset)},Gc=function(t,n){var r,e,o,i=(r=t,n.match({domRange:function(t){return{ltr:nt(t),rtl:et.none}},relative:function(t,n){return{ltr:tn(function(){return zc(r,t,n)}),rtl:tn(function(){return et.some(zc(r,n,t))})}},exact:function(t,n,e,o){return{ltr:tn(function(){return Lc(r,t,n,e,o)}),rtl:tn(function(){return et.some(Lc(r,e,o,t,n))})}}}));return(o=(e=i).ltr()).collapsed?e.rtl().filter(function(t){return!1===t.collapsed}).map(function(t){return Uc.rtl(Qn.fromDom(t.endContainer),t.endOffset,Qn.fromDom(t.startContainer),t.startOffset)}).getOrThunk(function(){return Wc(0,Uc.ltr,o)}):Wc(0,Uc.ltr,o)},Xc=function N_(e,o){var r=function(t){return e(t)?et.from(t.dom().nodeValue):et.none()},t=Tn.detect().browser,n=t.isIE()&&10===t.version.major?function(t){try{return r(t)}catch(n){return et.none()}}:r;return{get:function(t){if(!e(t))throw new Error("Can only get "+o+" value of a "+o+" node");return n(t).getOr("")},getOption:n,set:function(t,n){if(!e(t))throw new Error("Can only set raw "+o+" value of a "+o+" node");t.dom().nodeValue=n}}}(He,"text"),Yc=function(t){return Xc.get(t)},qc=function(t){return Xc.getOption(t)},Kc=["img","br"],$c=function(t){return qc(t).filter(function(t){return 0!==t.trim().length||-1<t.indexOf("\xa0")}).isSome()||T(Kc,Fe(t))},Jc=function(t){return Zc(t,$c)},Zc=function(t,i){var u=function(t){for(var n=we(t),e=n.length-1;0<=e;e--){var o=n[e];if(i(o))return et.some(o);var r=u(o);if(r.isSome())return r}return et.none()};return u(t)},Qc=(document.caretPositionFromPoint||document.caretRangeFromPoint,function(t,n){return ge(n,t)}),ts=function(t){var n=Qn.fromDom(t.anchorNode),e=Qn.fromDom(t.focusNode);return Pc(n,t.anchorOffset,e,t.focusOffset)?et.some(Hc(n,t.anchorOffset,e,t.focusOffset)):function(t){if(0<t.rangeCount){var n=t.getRangeAt(0),e=t.getRangeAt(t.rangeCount-1);return et.some(Hc(Qn.fromDom(n.startContainer),n.startOffset,Qn.fromDom(e.endContainer),e.endOffset))}return et.none()}(t)},ns=function(t,n){var i,e,o,r,u=Gc(i=t,n).match({ltr:function(t,n,e,o){var r=i.document.createRange();return r.setStart(t.dom(),n),r.setEnd(e.dom(),o),r},rtl:function(t,n,e,o){var r=i.document.createRange();return r.setStart(e.dom(),o),r.setEnd(t.dom(),n),r}});return o=(e=u).getClientRects(),0<(r=0<o.length?o[0]:e.getBoundingClientRect()).width||0<r.height?et.some(r).map(jc):et.none()},es=te("element","offset"),os=bt([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),rs=function(t){return t.fold(function(t){return t},function(t,n,e){return t.translate(-n,-e)})},is=function(t){return t.fold(function(t){return t},function(t,n,e){return t})},us=function(t){return U(t,function(t,n){return t.translate(n.left(),n.top())},ha(0,0))},as=function(t){var n=M(t,is);return us(n)},cs=os.screen,ss=os.absolute,fs=function(t,n,e){var o,r,i,u=ve(t.element()),a=xa(u),c=(o=t,r=e,i=be(r.root).dom(),et.from(i.frameElement).map(Qn.fromDom).filter(function(t){var n=ve(t),e=ve(o.element());return he(n,e)}).map(ba)).getOr(a);return ss(c,a.left(),a.top())},ls=function(t,n,e,o){var r=t,i=n,u=e,a=o;t<0&&(r=0,u=e+t),n<0&&(i=0,a=o+n);var c=cs(ha(r,i));return et.some(Pa(c,u,a))},ds=function(t,c,s,f,l){return t.map(function(t){var n,e,o,r=[c,t.point()],i=(n=function(){return as(r)},e=function(){return as(r)},o=function(){return t=M(r,rs),us(t);var t},f.fold(n,e,o)),u=za(i.left(),i.top(),t.width(),t.height()),a=Fc(l,s,s.showAbove?[wc,Sc,yc,xc,kc,Cc]:[yc,xc,wc,Sc,Cc,Cc],s.showAbove?[Sc,wc,xc,yc,kc,Cc]:[xc,yc,Sc,wc,Cc,kc]);return Ac({anchorBox:u,bubble:s.bubble.getOr(lc()),overrides:s.overrides,layouts:a,placer:et.none()})})},ms=te("element","offset"),gs=function(t,n){return He(t)?ms(t,n):function(t,n){var e=we(t);if(0===e.length)return es(t,n);if(n<e.length)return es(e[n],0);var o=e[e.length-1],r=He(o)?Yc(o).length:we(o).length;return es(o,r)}(t,n)},ps=function(n,t){return t.getSelection.getOrThunk(function(){return function(){return t=n,et.from(t.getSelection()).filter(function(t){return 0<t.rangeCount}).bind(ts);var t}})().map(function(t){var n=gs(t.start(),t.soffset()),e=gs(t.finish(),t.foffset());return Hc(n.element(),n.offset(),e.element(),e.offset())})},hs=[Er("getSelection"),br("root"),Er("bubble"),Mc(),Mr("overrides",{}),Mr("showAbove",!1),Ju("placement",function(t,n,e){var o=be(n.root).dom(),r=fs(t,0,n),i=ps(o,n).bind(function(t){var n;return ns(o,(n=t,Rc.exact(n.start(),n.soffset(),n.finish(),n.foffset()))).orThunk(function(){var n=Qn.fromText("\ufeff");return ke(t.start(),n),ns(o,Nc(n,0,n,1)).map(function(t){return Ae(n),t})}).bind(function(t){return ls(t.left(),t.top(),t.width(),t.height())})}),u=ps(o,n).bind(function(t){return Re(t.start())?et.some(t.start()):ye(t.start())}).getOr(t.element());return ds(i,r,n,e,u)})],vs=[br("node"),br("root"),Er("bubble"),Mc(),Mr("overrides",{}),Mr("showAbove",!1),Ju("placement",function(r,i,u){var a=fs(r,0,i);return i.node.bind(function(t){var n=t.dom().getBoundingClientRect(),e=ls(n.left,n.top,n.width,n.height),o=i.node.getOr(r.element());return ds(e,a,i,u,o)})})],bs=function(t){return t.x()+t.width()},ys=function(t,n){return t.x()-n.width()},xs=function(t,n){return t.y()-n.height()+t.height()},ws=function(t){return t.y()},Ss=function(t,n,e){return dc(bs(t),ws(t),e.southeast(),_a(),"link-layout-se")},ks=function(t,n,e){return dc(ys(t,n),ws(t),e.southwest(),Ma(),"link-layout-sw")},Cs=function(t,n,e){return dc(bs(t),xs(t,n),e.northeast(),Fa(),"link-layout-ne")},Os=function(t,n,e){return dc(ys(t,n),xs(t,n),e.northwest(),Ia(),"link-layout-nw")},Es=[br("item"),Mc(),Mr("overrides",{}),Ju("placement",function(t,n,e){var o=Ka(e,n.item.element()),r=Fc(t.element(),n,[Ss,ks,Cs,Os],[ks,Ss,Os,Cs]);return et.some(Ac({anchorBox:o,bubble:lc(),overrides:n.overrides,layouts:r,placer:et.none()}))})],Ts=fr("anchor",{selection:hs,node:vs,hotspot:Ic,submenu:Es,makeshift:Vc}),Bs=function(t,n,e,o,r){var i,u=(i=e.anchorBox,Za(i,n));ac(u,r.element(),e.bubble,e.layouts,o,e.overrides)},As=function(n,t,e,o,r,i){var u=cr("positioning anchor.info",Ts,o);lu(r.element(),"position","fixed");var a=hu(r.element(),"visibility");lu(r.element(),"visibility","hidden");var c,s,f,l=t.useFixed?Ja(0,0,x.window.innerWidth,x.window.innerHeight):(s=ba((c=n).element()),f=c.element().dom().getBoundingClientRect(),$a(s.left(),s.top(),f.width,f.height)),d=u.placement,m=i.map(function(t){return function(){return ja(t)}}).or(t.getBounds);d(n,u,l).each(function(t){t.placer.getOr(Bs)(n,l,t,m,r)}),a.fold(function(){bu(r.element(),"visibility")},function(t){lu(r.element(),"visibility",t)}),hu(r.element(),"left").isNone()&&hu(r.element(),"top").isNone()&&hu(r.element(),"right").isNone()&&hu(r.element(),"bottom").isNone()&&hu(r.element(),"position").is("fixed")&&bu(r.element(),"position")},Ds=/* */Object.freeze({position:function(t,n,e,o,r){var i=et.none();As(t,n,e,o,r,i)},positionWithin:As,getMode:function(t,n,e){return n.useFixed?"fixed":"absolute"}}),_s=[Mr("useFixed",!1),Er("getBounds")],Ms=aa({fields:_s,name:"positioning",active:ga,apis:Ds}),Fs=function(t){Wr(t,Wn());var n=t.components();F(n,Fs)},Is=function(t){var n=t.components();F(n,Is),Wr(t,Un())},Vs=function(t,n){Rs(t,n,Ee)},Rs=function(t,n,e){t.getSystem().addToWorld(n),e(t.element(),n.element()),Zr(t.element())&&Is(n),t.syncComponents()},Hs=function(t){Fs(t),Ae(t.element()),t.getSystem().removeFromWorld(t)},Ns=function(n){var t=ye(n.element()).bind(function(t){return n.getSystem().getByDom(t).fold(et.none,et.some)});Hs(n),t.each(function(t){t.syncComponents()})},Ps=function(t){var n=t.components();F(n,Hs),Be(t.element()),t.syncComponents()},zs=function(t,n){Ls(t,n,Ee)},Ls=function(t,n,e){e(t,n.element());var o=we(n.element());F(o,function(t){n.getByDom(t).each(Is)})},js=function(n){var t=we(n.element());F(t,function(t){n.getByDom(t).each(Fs)}),Ae(n.element())},Us=function(t,n,e,o){var r=function(n,t,e,o){e.get().each(function(t){Ps(n)});var r=t.getAttachPoint(n);Vs(r,n);var i=n.getSystem().build(o);return Vs(n,i),e.set(i),i}(t,n,e,o);return n.onOpen(t,r),r},Ws=function(n,e,o){o.get().each(function(t){Ps(n),Ns(n),e.onClose(n,t),o.clear()})},Gs=function(t,n,e){return e.isOpen()},Xs=function(t,n,e){var o,r,i,u,a=n.getAttachPoint(t);lu(t.element(),"position",Ms.getMode(a)),o=t,r="visibility",i=n.cloakVisibilityAttr,u="hidden",hu(o.element(),r).fold(function(){Ge(o.element(),i)},function(t){ze(o.element(),i,t)}),lu(o.element(),r,u)},Ys=function(t,n,e){var o;o=t.element(),B(["top","left","right","bottom"],function(t){return hu(o,t).isSome()})||bu(t.element(),"position"),function(t,n,e){if(We(t.element(),e)){var o=je(t.element(),e);lu(t.element(),n,o)}else bu(t.element(),n)}(t,"visibility",n.cloakVisibilityAttr)},qs=/* */Object.freeze({cloak:Xs,decloak:Ys,open:Us,openWhileCloaked:function(t,n,e,o,r){Xs(t,n,e),Us(t,n,e,o),r(),Ys(t,n,e)},close:Ws,isOpen:Gs,isPartOf:function(n,e,t,o){return Gs(0,0,t)&&t.get().exists(function(t){return e.isPartOf(n,t,o)})},getState:function(t,n,e){return e.get()}}),Ks=/* */Object.freeze({events:function(e,o){return ii([si(Nn(),function(t,n){Ws(t,e,o)})])}}),$s=[Yu("onOpen"),Yu("onClose"),br("isPartOf"),br("getAttachPoint"),Mr("cloakVisibilityAttr","data-precloak-visibility")],Js=aa({fields:$s,name:"sandboxing",active:Ks,apis:qs,state:/* */Object.freeze({init:function(){var n=_t(et.none()),t=nt("not-implemented");return Li({readState:t,isOpen:function(){return n.get().isSome()},clear:function(){n.set(et.none())},set:function(t){n.set(et.some(t))},get:function(t){return n.get()}})}})}),Zs=nt("dismiss.popups"),Qs=nt("mouse.released"),tf=Wo([Mr("isExtraPart",nt(!1)),_r("fireEventInstead",[Mr("event",Gn())])]),nf=function(t){var n=ef(t);return ma.config(n)},ef=function(t){var e=cr("Dismissal",tf,t);return{channels:Tt(Zs(),{schema:Wo([br("target")]),onReceive:function(n,t){Js.isOpen(n)&&(Js.isPartOf(n,t.target)||e.isExtraPart(n,t.target)||e.fireEventInstead.fold(function(){return Js.close(n)},function(t){return Wr(n,t.event)}))}})}},of=function(o,t){return Pr(o,{},M(t,function(t){return n=t.name(),e="Cannot configure "+t.name()+" for "+o,Jo(n,n,po(),Uo(function(t){return Oo("The field: "+n+" is forbidden. "+e)}));var n,e}).concat([zr("dump",d)]))},rf=function(t){return t.dump},uf=function(t,n){return ao({},t.dump,ia(n))},af={field:of,augment:uf,get:rf},sf="placeholder",lf=bt([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),mf=function(t,n,e,o){return e.uiType===sf?(i=e,u=o,(r=t).exists(function(t){return t!==i.owner})?lf.single(!0,nt(i)):Et(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+Q(u)+"]\nNamespace: "+r.getOr("none")+"\nSpec: "+Ro(i,null,2))},function(t){return t.replace()})):lf.single(!1,nt(e));var r,i,u},gf=function(i,u,a,c){return mf(i,0,a,c).fold(function(t,n){var e=n(u,a.config,a.validated),o=Et(e,"components").getOr([]),r=W(o,function(t){return gf(i,u,t,c)});return[ao({},e,{components:r})]},function(t,n){var e=n(u,a.config,a.validated);return a.validated.preprocess.getOr(d)(e)})},pf=function(n,e,t,o){return W(t,function(t){return gf(n,e,t,o)})},hf=function(n,e,t,o){var r=it(o,function(t,n){return o=t,r=!1,{name:nt(e=n),required:function(){return o.fold(function(t,n){return t},function(t,n){return t})},used:function(){return r},replace:function(){if(!0===r)throw new Error("Trying to use the same placeholder more than once: "+e);return r=!0,o}};var e,o,r}),i=pf(n,e,t,r);return rt(r,function(t){if(!1===t.used()&&t.required())throw new Error("Placeholder: "+t.name()+" was not found in components list\nNamespace: "+n.getOr("none")+"\nComponents: "+Ro(e.components,null,2))}),i},vf=lf.single,bf=lf.multiple,yf=nt(sf),xf=bt([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),wf=Mr("factory",{sketch:d}),Sf=Mr("schema",[]),kf=br("name"),Cf=Jo("pname","pname",ho(function(t){return"<alloy."+io(t.name)+">"}),lr()),Of=zr("schema",function(){return[Er("preprocess")]}),Ef=Mr("defaults",nt({})),Tf=Mr("overrides",nt({})),Bf=Go([wf,Sf,kf,Cf,Ef,Tf]),Af=Go([wf,Sf,kf,Ef,Tf]),Df=Go([wf,Sf,kf,Cf,Ef,Tf]),_f=Go([wf,Of,kf,br("unit"),Cf,Ef,Tf]),Mf=function(t){return t.fold(et.some,et.none,et.some,et.some)},Ff=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},If=function(e,o){return function(t){var n=cr("Converting part type",o,t);return e(n)}},Vf=If(xf.required,Bf),Rf=If(xf.external,Af),Hf=If(xf.optional,Df),Nf=If(xf.group,_f),Pf=nt("entirety"),zf=/* */Object.freeze({required:Vf,external:Rf,optional:Hf,group:Nf,asNamedPart:Mf,name:Ff,asCommon:function(t){return t.fold(d,d,d,d)},original:Pf}),Lf=function(t,n,e,o){return wt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},jf=function(r,t){var n={};return F(t,function(t){Mf(t).each(function(e){var o=Uf(r,e.pname);n[e.name]=function(t){var n=cr("Part: "+e.name+" in "+r,Go(e.schema),t);return ao({},o,{config:t,validated:n})}})}),n},Uf=function(t,n){return{uiType:yf(),owner:t,name:n}},Wf=function(t,n,e){return{uiType:yf(),owner:t,name:n,config:e,validated:{}}},Gf=function(t){return W(t,function(t){return t.fold(et.none,et.some,et.none,et.none).map(function(t){return kr(t.name,t.schema.concat([Zu(Pf())]))}).toArray()})},Xf=function(t){return M(t,Ff)},Yf=function(t,n,e){return o=n,i={},r={},F(e,function(t){t.fold(function(o){i[o.pname]=vf(!0,function(t,n,e){return o.factory.sketch(Lf(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=nt(t.factory.sketch(Lf(o,t,n[Pf()]),n))},function(o){i[o.pname]=vf(!1,function(t,n,e){return o.factory.sketch(Lf(t,o,n,e))})},function(r){i[r.pname]=bf(!0,function(n,t,e){var o=n[r.name];return M(o,function(t){return r.factory.sketch(wt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:nt(i),externals:nt(r)};var o,i,r},qf=function(t,n,e){return hf(et.some(t),n,n.components,e)},Kf=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},$f=function(t,n,e){return Kf(t,n,e).getOrDie("Could not find part: "+e)},Jf=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return F(e,function(t){o[t]=i.getByUid(r[t])}),it(o,nt)},Zf=function(t,n){var e=t.getSystem();return it(n.partUids,function(t,n){return nt(e.getByUid(t))})},Qf=function(t){return Q(t.partUids)},tl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return F(e,function(t){o[t]=i.getByUid(r[t]).getOrDie()}),it(o,nt)},nl=function(n,t){var e=Xf(t);return Bt(M(e,function(t){return{key:t,value:n+"-"+t}}))},el=function(n){return Jo("partUids","partUids",vo(function(t){return nl(t.uid,n)}),lr())},ol=/* */Object.freeze({generate:jf,generateOne:Wf,schemas:Gf,names:Xf,substitutes:Yf,components:qf,defaultUids:nl,defaultUidsSchema:el,getAllParts:Zf,getAllPartNames:Qf,getPart:Kf,getPartOrDie:$f,getParts:Jf,getPartsOrDie:tl}),rl=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[kr("parts",i)]:[]).concat([br("uid"),Mr("dom",{}),Mr("components",[]),Zu("originalSpec"),Mr("debug.sketcher",{})]).concat(u));return cr(t+" [SpecSchema]",Wo(a.concat(n)),e)},il=function(t,n,e,o,r){var i=ul(r),u=Gf(e),a=el(e),c=rl(t,n,i,u,[a]),s=Yf(0,c,e);return o(c,qf(t,c,s.internals()),i,s.externals())},ul=function(t){return t.hasOwnProperty("uid")?t:ao({},t,{uid:Di("uid")})};function al(t){return t.uid!==undefined}var cl,sl,fl=Wo([br("name"),br("factory"),br("configFields"),Mr("apis",{}),Mr("extraApis",{})]),ll=Wo([br("name"),br("factory"),br("configFields"),br("partFields"),Mr("apis",{}),Mr("extraApis",{})]),dl=function(t){var i=cr("Sketcher for "+t.name,fl,t),n=it(i.apis,Pi),e=it(i.extraApis,function(t,n){return Vi(t,n)});return ao({name:nt(i.name),partFields:nt([]),configFields:nt(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=ul(t),o(rl(n,e,r,[],[]),r);var n,e,o,r}},n,e)},ml=function(t){var n=cr("Sketcher for "+t.name,ll,t),e=jf(n.name,n.partFields),o=it(n.apis,Pi),r=it(n.extraApis,function(t,n){return Vi(t,n)});return ao({name:nt(n.name),partFields:nt(n.partFields),configFields:nt(n.configFields),sketch:function(t){return il(n.name,n.configFields,n.partFields,n.factory,t)},parts:nt(e)},o,r)},gl=function(t){return"input"===Fe(t)&&"radio"!==je(t,"type")||"textarea"===Fe(t)},pl=/* */Object.freeze({getCurrent:function(t,n,e){return n.find(t)}}),hl=[br("find")],vl=aa({fields:hl,name:"composing",apis:pl}),bl=function(t,n,e,o){var r=t+n;return o<r?e:r<e?o:r},yl=function(t,n,e){return t<=n?n:e<=t?e:t},xl=function(e,o,t,r){var n=Qc(e.element(),"."+o.highlightClass);F(n,function(n){B(r,function(t){return t.element()===n})||(ru(n,o.highlightClass),e.getSystem().getByDom(n).each(function(t){o.onDehighlight(e,t),Wr(t,Jn())}))})},wl=function(t,n,e,o){xl(t,n,0,[o]),Sl(t,n,e,o)||(ou(o.element(),n.highlightClass),n.onHighlight(t,o),Wr(o,$n()))},Sl=function(t,n,e,o){return iu(o.element(),n.highlightClass)},kl=function(t,n,e,o){var r=Qc(t.element(),"."+n.itemClass);return et.from(r[o]).fold(function(){return vt.error("No element found with index "+o)},t.getSystem().getByDom)},Cl=function(n,t,e){return Vu(n.element(),"."+t.itemClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},Ol=function(n,t,e){var o=Qc(n.element(),"."+t.itemClass);return(0<o.length?et.some(o[o.length-1]):et.none()).bind(function(t){return n.getSystem().getByDom(t).toOption()})},El=function(e,n,t,o){var r=Qc(e.element(),"."+n.itemClass);return P(r,function(t){return iu(t,n.highlightClass)}).bind(function(t){var n=bl(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOption()})},Tl=function(n,t,e){var o=Qc(n.element(),"."+t.itemClass);return Mt(M(o,function(t){return n.getSystem().getByDom(t).toOption()}))},Bl=/* */Object.freeze({dehighlightAll:function(t,n,e){return xl(t,n,0,[])},dehighlight:function(t,n,e,o){Sl(t,n,e,o)&&(ru(o.element(),n.highlightClass),n.onDehighlight(t,o),Wr(o,Jn()))},highlight:wl,highlightFirst:function(n,e,o){Cl(n,e,o).each(function(t){wl(n,e,o,t)})},highlightLast:function(n,e,o){Ol(n,e,o).each(function(t){wl(n,e,o,t)})},highlightAt:function(n,e,o,t){kl(n,e,o,t).fold(function(t){throw new Error(t)},function(t){wl(n,e,o,t)})},highlightBy:function(n,e,o,t){var r=Tl(n,e,o);N(r,t).each(function(t){wl(n,e,o,t)})},isHighlighted:Sl,getHighlighted:function(n,t,e){return Vu(n.element(),"."+t.highlightClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},getFirst:Cl,getLast:Ol,getPrevious:function(t,n,e){return El(t,n,0,-1)},getNext:function(t,n,e){return El(t,n,0,1)},getCandidates:Tl}),Al=[br("highlightClass"),br("itemClass"),Yu("onHighlight"),Yu("onDehighlight")],Dl=aa({fields:Al,name:"highlighting",apis:Bl}),_l=function(t,n,e){var o=X(t.slice(0,n)),r=X(t.slice(n+1));return N(o.concat(r),e)},Ml=function(t,n,e){var o=X(t.slice(0,n));return N(o,e)},Fl=function(t,n,e){var o=t.slice(0,n),r=t.slice(n+1);return N(r.concat(o),e)},Il=function(t,n,e){var o=t.slice(n+1);return N(o,e)},Vl=function(e){return function(t){var n=t.raw();return T(e,n.which)}},Rl=function(t){return function(n){return G(t,function(t){return t(n)})}},Hl=function(t){return!0===t.raw().shiftKey},Nl=function(t){return!0===t.raw().ctrlKey},Pl=w(Hl),zl=function(t,n){return{matches:t,classification:n}},Ll=function(t,n){return N(t,function(t){return t.matches(n)}).map(function(t){return t.classification})},jl=function(t){t.dom().focus()},Ul=function(t){var n=t!==undefined?t.dom():x.document;return et.from(n.activeElement).map(Qn.fromDom)},Wl=function(n){return Ul(ve(n)).filter(function(t){return n.dom().contains(t.dom())})},Gl=function(t,n,e){n.exists(function(n){return e.exists(function(t){return he(t,n)})})||Gr(t,Xn(),{prevFocus:n,newFocus:e})},Xl=function(){var r=function(t){return Wl(t.element())};return{get:r,set:function(t,n){var e=r(t);t.getSystem().triggerFocus(n,t.element());var o=r(t);Gl(t,e,o)}}},Yl=function(){var r=function(t){return Dl.getHighlighted(t).map(function(t){return t.element()})};return{get:r,set:function(n,t){var e=r(n);n.getSystem().getByDom(t).fold(tt,function(t){Dl.highlight(n,t)});var o=r(n);Gl(n,e,o)}}};(sl=cl||(cl={})).OnFocusMode="onFocus",sl.OnEnterOrSpaceMode="onEnterOrSpace",sl.OnApiMode="onApi";var ql,Kl=function(t,n,e,o,a){var c=function(n,e,t,o,r){var i=t(n,e,o,r);return Ll(i,e.event()).bind(function(t){return t(n,e,o,r)})},r={schema:function(){return t.concat([Mr("focusManager",Xl()),Fr("focusInside","onFocus",or(function(t){return T(["onFocus","onEnterOrSpace","onApi"],t)?vt.value(t):vt.error("Invalid value for focusInside")})),Ju("handler",r),Ju("state",n),Ju("sendFocusIn",a)])},processKey:c,toEvents:function(i,u){var t=i.focusInside!==cl.OnFocusMode?et.none():a(i).map(function(e){return si(An(),function(t,n){e(t,i,u),n.stop()})});return ii(t.toArray().concat([si(Yt(),function(o,r){c(o,r,e,i,u).fold(function(){var n,e,t;n=o,e=r,t=Vl([32].concat([13]))(e.event()),i.focusInside===cl.OnEnterOrSpaceMode&&t&&Lr(n,e)&&a(i).each(function(t){t(n,i,u),e.stop()})},function(t){r.stop()})}),si(qt(),function(t,n){c(t,n,o,i,u).each(function(t){n.stop()})})]))}};return r},$l=function(t){var n=[Er("onEscape"),Er("onEnter"),Mr("selector",'[data-alloy-tabstop="true"]'),Mr("firstTabstop",0),Mr("useTabstopAt",nt(!0)),Er("visibilitySelector")].concat([t]),u=function(t,n){var e=t.visibilitySelector.bind(function(t){return Ru(n,t)}).getOr(n);return 0<Ea(e)},e=function(n,e){var t,o,r,i;(t=n,o=e,r=Qc(t.element(),o.selector),i=R(r,function(t){return u(o,t)}),et.from(i[o.firstTabstop])).each(function(t){e.focusManager.set(n,t)})},a=function(n,t,e,o,r){return r(t,e,function(t){return u(n=o,e=t)&&n.useTabstopAt(e);var n,e}).fold(function(){return o.cyclic?et.some(!0):et.none()},function(t){return o.focusManager.set(n,t),et.some(!0)})},i=function(n,t,e,o){var r,i,u=Qc(n.element(),e.selector);return(r=n,i=e,i.focusManager.get(r).bind(function(t){return Ru(t,i.selector)})).bind(function(t){return P(u,g(he,t)).bind(function(t){return a(n,u,t,e,o)})})},o=nt([zl(Rl([Hl,Vl([9])]),function(t,n,e,o){var r=e.cyclic?_l:Ml;return i(t,0,e,r)}),zl(Vl([9]),function(t,n,e,o){var r=e.cyclic?Fl:Il;return i(t,0,e,r)}),zl(Vl([27]),function(n,e,t,o){return t.onEscape.bind(function(t){return t(n,e)})}),zl(Rl([Pl,Vl([13])]),function(n,e,t,o){return t.onEnter.bind(function(t){return t(n,e)})})]),r=nt([]);return Kl(n,zi.init,o,r,function(){return et.some(e)})},Jl=$l(zr("cyclic",nt(!1))),Zl=$l(zr("cyclic",nt(!0))),Ql=function(t,n,e){return gl(e)&&Vl([32])(n.event())?et.none():(Yr(t,e,Fn()),et.some(!0))},td=function(t,n){return et.some(!0)},nd=[Mr("execute",Ql),Mr("useSpace",!1),Mr("useEnter",!0),Mr("useControlEnter",!1),Mr("useDown",!1)],ed=function(t,n,e){return e.execute(t,n,t.element())},od=Kl(nd,zi.init,function(t,n,e,o){var r=e.useSpace&&!gl(t.element())?[32]:[],i=e.useEnter?[13]:[],u=e.useDown?[40]:[],a=r.concat(i).concat(u);return[zl(Vl(a),ed)].concat(e.useControlEnter?[zl(Rl([Nl,Vl([13])]),ed)]:[])},function(t,n,e,o){return e.useSpace&&!gl(t.element())?[zl(Vl([32]),td)]:[]},function(){return et.none()}),rd=function(t){var e=_t(et.none());return Li({readState:function(){return e.get().map(function(t){return{numRows:t.numRows(),numColumns:t.numColumns()}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(t,n){e.set(et.some({numRows:nt(t),numColumns:nt(n)}))},getNumRows:function(){return e.get().map(function(t){return t.numRows()})},getNumColumns:function(){return e.get().map(function(t){return t.numColumns()})}})},id=/* */Object.freeze({flatgrid:rd,init:function(t){return t.state(t)}}),ud=function(i){return function(t,n,e,o){var r=i(t.element());return fd(r,t,n,e,o)}},ad=function(t,n){var e=Dc(t,n);return ud(e)},cd=function(t,n){var e=Dc(n,t);return ud(e)},sd=function(r){return function(t,n,e,o){return fd(r,t,n,e,o)}},fd=function(n,e,t,o,r){return o.focusManager.get(e).bind(function(t){return n(e.element(),t,o,r)}).map(function(t){return o.focusManager.set(e,t),!0})},ld=sd,dd=sd,md=sd,gd=function(t){var n,e=t.dom();return!((n=e).offsetWidth<=0&&n.offsetHeight<=0)},pd=oe(["index","candidates"],[]),hd=function(t,n,e){return vd(t,n,e,gd)},vd=function(t,n,e,o){var r,i=g(he,n),u=Qc(t,e),a=R(u,gd);return P(r=a,i).map(function(t){return pd({index:t,candidates:r})})},bd=function(t,n){return P(t,function(t){return he(n,t)})},yd=function(e,t,o,n){return n(Math.floor(t/o),t%o).bind(function(t){var n=t.row()*o+t.column();return 0<=n&&n<e.length?et.some(e[n]):et.none()})},xd=function(r,t,i,u,a){return yd(r,t,u,function(t,n){var e=t===i-1?r.length-t*u:u,o=bl(n,a,0,e-1);return et.some({row:nt(t),column:nt(o)})})},wd=function(i,t,u,a,c){return yd(i,t,a,function(t,n){var e=bl(t,c,0,u-1),o=e===u-1?i.length-e*a:a,r=yl(n,0,o-1);return et.some({row:nt(e),column:nt(r)})})},Sd=[br("selector"),Mr("execute",Ql),qu("onEscape"),Mr("captureTab",!1),Qu()],kd=function(n,e,t){Vu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},Cd=function(r){return function(t,n,e,o){return hd(t,n,e.selector).bind(function(t){return r(t.candidates(),t.index(),o.getNumRows().getOr(e.initSize.numRows),o.getNumColumns().getOr(e.initSize.numColumns))})}},Od=function(t,n,e,o){return e.captureTab?et.some(!0):et.none()},Ed=Cd(function(t,n,e,o){return xd(t,n,e,o,-1)}),Td=Cd(function(t,n,e,o){return xd(t,n,e,o,1)}),Bd=Cd(function(t,n,e,o){return wd(t,n,e,o,-1)}),Ad=Cd(function(t,n,e,o){return wd(t,n,e,o,1)}),Dd=nt([zl(Vl([37]),ad(Ed,Td)),zl(Vl([39]),cd(Ed,Td)),zl(Vl([38]),ld(Bd)),zl(Vl([40]),dd(Ad)),zl(Rl([Hl,Vl([9])]),Od),zl(Rl([Pl,Vl([9])]),Od),zl(Vl([27]),function(t,n,e,o){return e.onEscape(t,n)}),zl(Vl([32].concat([13])),function(n,e,o,t){return(r=n,i=o,i.focusManager.get(r).bind(function(t){return Ru(t,i.selector)})).bind(function(t){return o.execute(n,e,t)});var r,i})]),_d=nt([zl(Vl([32]),td)]),Md=Kl(Sd,rd,Dd,_d,function(){return et.some(kd)}),Fd=function(t,n,e,i){var u=function(t,n,e){var o,r=bl(n,i,0,e.length-1);return r===t?et.none():(o=e[r],"button"===Fe(o)&&"disabled"===je(o,"disabled")?u(t,r,e):et.from(e[r]))};return hd(t,e,n).bind(function(t){var n=t.index(),e=t.candidates();return u(n,n,e)})},Id=[br("selector"),Mr("getInitial",et.none),Mr("execute",Ql),qu("onEscape"),Mr("executeOnMove",!1),Mr("allowVertical",!0)],Vd=function(n,e,o){return(t=n,r=o,r.focusManager.get(t).bind(function(t){return Ru(t,r.selector)})).bind(function(t){return o.execute(n,e,t)});var t,r},Rd=function(n,e){e.getInitial(n).orThunk(function(){return Vu(n.element(),e.selector)}).each(function(t){e.focusManager.set(n,t)})},Hd=function(t,n,e){return Fd(t,e.selector,n,-1)},Nd=function(t,n,e){return Fd(t,e.selector,n,1)},Pd=function(o){return function(t,n,e){return o(t,n,e).bind(function(){return e.executeOnMove?Vd(t,n,e):et.some(!0)})}},zd=function(t,n,e,o){return e.onEscape(t,n)},Ld=nt([zl(Vl([32]),td)]),jd=Kl(Id,zi.init,function(t,n,e,o){var r=[37].concat(e.allowVertical?[38]:[]),i=[39].concat(e.allowVertical?[40]:[]);return[zl(Vl(r),Pd(ad(Hd,Nd))),zl(Vl(i),Pd(cd(Hd,Nd))),zl(Vl([13]),Vd),zl(Vl([32]),Vd),zl(Vl([27]),zd)]},Ld,function(){return et.some(Rd)}),Ud=oe(["rowIndex","columnIndex","cell"],[]),Wd=function(t,n,e){return et.from(t[n]).bind(function(t){return et.from(t[e]).map(function(t){return Ud({rowIndex:n,columnIndex:e,cell:t})})})},Gd=function(t,n,e,o){var r=t[n].length,i=bl(e,o,0,r-1);return Wd(t,n,i)},Xd=function(t,n,e,o){var r=bl(e,o,0,t.length-1),i=t[r].length,u=yl(n,0,i-1);return Wd(t,r,u)},Yd=function(t,n,e,o){var r=t[n].length,i=yl(e+o,0,r-1);return Wd(t,n,i)},qd=function(t,n,e,o){var r=yl(e+o,0,t.length-1),i=t[r].length,u=yl(n,0,i-1);return Wd(t,r,u)},Kd=[kr("selectors",[br("row"),br("cell")]),Mr("cycles",!0),Mr("previousSelector",et.none),Mr("execute",Ql)],$d=function(n,e){e.previousSelector(n).orThunk(function(){var t=e.selectors;return Vu(n.element(),t.cell)}).each(function(t){e.focusManager.set(n,t)})},Jd=function(t,n){return function(e,o,i){var u=i.cycles?t:n;return Ru(o,i.selectors.row).bind(function(t){var n=Qc(t,i.selectors.cell);return bd(n,o).bind(function(o){var r=Qc(e,i.selectors.row);return bd(r,t).bind(function(t){var n,e=(n=i,M(r,function(t){return Qc(t,n.selectors.cell)}));return u(e,t,o).map(function(t){return t.cell()})})})})}},Zd=Jd(function(t,n,e){return Gd(t,n,e,-1)},function(t,n,e){return Yd(t,n,e,-1)}),Qd=Jd(function(t,n,e){return Gd(t,n,e,1)},function(t,n,e){return Yd(t,n,e,1)}),tm=Jd(function(t,n,e){return Xd(t,e,n,-1)},function(t,n,e){return qd(t,e,n,-1)}),nm=Jd(function(t,n,e){return Xd(t,e,n,1)},function(t,n,e){return qd(t,e,n,1)}),em=nt([zl(Vl([37]),ad(Zd,Qd)),zl(Vl([39]),cd(Zd,Qd)),zl(Vl([38]),ld(tm)),zl(Vl([40]),dd(nm)),zl(Vl([32].concat([13])),function(n,e,o){return Wl(n.element()).bind(function(t){return o.execute(n,e,t)})})]),om=nt([zl(Vl([32]),td)]),rm=Kl(Kd,zi.init,em,om,function(){return et.some($d)}),im=[br("selector"),Mr("execute",Ql),Mr("moveOnTab",!1)],um=function(n,e,o){return o.focusManager.get(n).bind(function(t){return o.execute(n,e,t)})},am=function(n,e){Vu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},cm=function(t,n,e){return Fd(t,e.selector,n,-1)},sm=function(t,n,e){return Fd(t,e.selector,n,1)},fm=nt([zl(Vl([38]),md(cm)),zl(Vl([40]),md(sm)),zl(Rl([Hl,Vl([9])]),function(t,n,e){return e.moveOnTab?md(cm)(t,n,e):et.none()}),zl(Rl([Pl,Vl([9])]),function(t,n,e){return e.moveOnTab?md(sm)(t,n,e):et.none()}),zl(Vl([13]),um),zl(Vl([32]),um)]),lm=nt([zl(Vl([32]),td)]),dm=Kl(im,zi.init,fm,lm,function(){return et.some(am)}),mm=[qu("onSpace"),qu("onEnter"),qu("onShiftEnter"),qu("onLeft"),qu("onRight"),qu("onTab"),qu("onShiftTab"),qu("onUp"),qu("onDown"),qu("onEscape"),Mr("stopSpaceKeyup",!1),Er("focusIn")],gm=Kl(mm,zi.init,function(t,n,e){return[zl(Vl([32]),e.onSpace),zl(Rl([Pl,Vl([13])]),e.onEnter),zl(Rl([Hl,Vl([13])]),e.onShiftEnter),zl(Rl([Hl,Vl([9])]),e.onShiftTab),zl(Rl([Pl,Vl([9])]),e.onTab),zl(Vl([38]),e.onUp),zl(Vl([40]),e.onDown),zl(Vl([37]),e.onLeft),zl(Vl([39]),e.onRight),zl(Vl([32]),e.onSpace),zl(Vl([27]),e.onEscape)]},function(t,n,e){return e.stopSpaceKeyup?[zl(Vl([32]),td)]:[]},function(t){return t.focusIn}),pm=Jl.schema(),hm=Zl.schema(),vm=jd.schema(),bm=Md.schema(),ym=rm.schema(),xm=od.schema(),wm=dm.schema(),Sm=gm.schema(),km=sa({branchKey:"mode",branches:/* */Object.freeze({acyclic:pm,cyclic:hm,flow:vm,flatgrid:bm,matrix:ym,execution:xm,menu:wm,special:Sm}),name:"keying",active:{events:function(t,n){return t.handler.toEvents(t,n)}},apis:{focusIn:function(n,e,o){e.sendFocusIn(e).fold(function(){n.getSystem().triggerFocus(n.element(),n.element())},function(t){t(n,e,o)})},setGridSize:function(t,n,e,o,r){Dt(e,"setGridSize")?e.setGridSize(o,r):x.console.error("Layout does not support setGridSize")}},state:id}),Cm=function(t,n,e,o){var r=t.getSystem().build(o);Rs(t,r,e)},Om=function(t,n,e,o){var r=Em(t,n);N(r,function(t){return he(o.element(),t.element())}).each(Ns)},Em=function(t,n){return t.components()},Tm=function(n,e,t,r,o){var i=Em(n,e);return et.from(i[r]).map(function(t){return Om(n,e,0,t),o.each(function(t){Cm(n,0,function(t,n){var e,o;o=n,Se(e=t,r).fold(function(){Ee(e,o)},function(t){ke(t,o)})},t)}),t})},Bm=aa({fields:[],name:"replacing",apis:/* */Object.freeze({append:function(t,n,e,o){Cm(t,0,Ee,o)},prepend:function(t,n,e,o){Cm(t,0,Oe,o)},remove:Om,replaceAt:Tm,replaceBy:function(n,e,t,o,r){var i=Em(n,e);return P(i,o).bind(function(t){return Tm(n,e,0,t,r)})},set:function(n,t,e,o){var r,i,u,a;Ps(n),r=function(){var t=M(o,n.getSystem().build);F(t,function(t){Vs(n,t)})},i=n.element(),u=ve(i),a=Ul(u).bind(function(n){var t=function(t){return he(n,t)};return t(i)?et.some(i):oi(i,t)}),r(i),a.each(function(n){Ul(u).filter(function(t){return he(t,n)}).fold(function(){jl(n)},tt)})},contents:Em})}),Am=function(t,n,e){n.store.manager.onLoad(t,n,e)},Dm=function(t,n,e){n.store.manager.onUnload(t,n,e)},_m=/* */Object.freeze({onLoad:Am,onUnload:Dm,setValue:function(t,n,e,o){n.store.manager.setValue(t,n,e,o)},getValue:function(t,n,e){return n.store.manager.getValue(t,n,e)},getState:function(t,n,e){return e}}),Mm=/* */Object.freeze({events:function(e,o){var t=e.resetOnDom?[bi(function(t,n){Am(t,e,o)}),yi(function(t,n){Dm(t,e,o)})]:[ta(e,o,Am)];return ii(t)}}),Fm=function(){var t=_t(null);return Li({set:t.set,get:t.get,isNotSet:function(){return null===t.get()},clear:function(){t.set(null)},readState:function(){return{mode:"memory",value:t.get()}}})},Im=function(){var i=_t({}),u=_t({});return Li({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(t){return Et(i.get(),t).orThunk(function(){return Et(u.get(),t)})},update:function(t){var n=i.get(),e=u.get(),o={},r={};F(t,function(n){o[n.value]=n,Et(n,"meta").each(function(t){Et(t,"text").each(function(t){r[t]=n})})}),i.set(ao({},n,o)),u.set(ao({},e,r))},clear:function(){i.set({}),u.set({})}})},Vm=/* */Object.freeze({memory:Fm,dataset:Im,manual:function(){return Li({readState:function(){}})},init:function(t){return t.store.manager.state(t)}}),Rm=function(t,n,e,o){var r=n.store;e.update([o]),r.setValue(t,o),n.onSetValue(t,o)},Hm=[Er("initialValue"),br("getFallbackEntry"),br("getDataKey"),br("setValue"),Ju("manager",{setValue:Rm,getValue:function(t,n,e){var o=n.store,r=o.getDataKey(t);return e.lookup(r).fold(function(){return o.getFallbackEntry(r)},function(t){return t})},onLoad:function(n,e,o){e.store.initialValue.each(function(t){Rm(n,e,o,t)})},onUnload:function(t,n,e){e.clear()},state:Im})],Nm=[br("getValue"),Mr("setValue",tt),Er("initialValue"),Ju("manager",{setValue:function(t,n,e,o){n.store.setValue(t,o),n.onSetValue(t,o)},getValue:function(t,n,e){return n.store.getValue(t)},onLoad:function(n,e,t){e.store.initialValue.each(function(t){e.store.setValue(n,t)})},onUnload:tt,state:zi.init})],Pm=[Er("initialValue"),Ju("manager",{setValue:function(t,n,e,o){e.set(o),n.onSetValue(t,o)},getValue:function(t,n,e){return e.get()},onLoad:function(t,n,e){n.store.initialValue.each(function(t){e.isNotSet()&&e.set(t)})},onUnload:function(t,n,e){e.clear()},state:Fm})],zm=[Fr("store",{mode:"memory"},fr("mode",{memory:Pm,manual:Nm,dataset:Hm})),Yu("onSetValue"),Mr("resetOnDom",!1)],Lm=aa({fields:zm,name:"representing",active:Mm,apis:_m,extra:{setValueFrom:function(t,n){var e=Lm.getValue(n);Lm.setValue(t,e)}},state:Vm}),jm=function(t,n){n.ignore||(jl(t.element()),n.onFocus(t))},Um=/* */Object.freeze({focus:jm,blur:function(t,n){n.ignore||t.element().dom().blur()},isFocused:function(t){return n=t.element(),e=ve(n).dom(),n.dom()===e.activeElement;var n,e}}),Wm=/* */Object.freeze({exhibit:function(t,n){var e=n.ignore?{}:{attributes:{tabindex:"-1"}};return Ui(e)},events:function(e){return ii([si(An(),function(t,n){jm(t,e),n.stop()})].concat(e.stopMousedown?[si(zt(),function(t,n){n.event().prevent()})]:[]))}}),Gm=[Yu("onFocus"),Mr("stopMousedown",!1),Mr("ignore",!1)],Xm=aa({fields:Gm,name:"focusing",active:Wm,apis:Um}),Ym=function(t,n,e){var o=n.aria;o.update(t,o,e.get())},qm=function(n,t,e){t.toggleClass.each(function(t){e.get()?ou(n.element(),t):ru(n.element(),t)})},Km=function(t,n,e){Zm(t,n,e,!e.get())},$m=function(t,n,e){e.set(!0),qm(t,n,e),Ym(t,n,e)},Jm=function(t,n,e){e.set(!1),qm(t,n,e),Ym(t,n,e)},Zm=function(t,n,e,o){(o?$m:Jm)(t,n,e)},Qm=function(t,n,e){Zm(t,n,e,n.selected)},tg=/* */Object.freeze({onLoad:Qm,toggle:Km,isOn:function(t,n,e){return e.get()},on:$m,off:Jm,set:Zm}),ng=/* */Object.freeze({exhibit:function(t,n,e){return Ui({})},events:function(t,n){var e,o,r,i=(e=t,o=n,r=Km,wi(function(t){r(t,e,o)})),u=ta(t,n,Qm);return ii(j([t.toggleOnExecute?[i]:[],[u]]))}}),eg=function(t,n,e){ze(t.element(),"aria-expanded",e)},og=[Mr("selected",!1),Er("toggleClass"),Mr("toggleOnExecute",!0),Fr("aria",{mode:"none"},fr("mode",{pressed:[Mr("syncWithExpanded",!1),Ju("update",function(t,n,e){ze(t.element(),"aria-pressed",e),n.syncWithExpanded&&eg(t,n,e)})],checked:[Ju("update",function(t,n,e){ze(t.element(),"aria-checked",e)})],expanded:[Ju("update",eg)],selected:[Ju("update",function(t,n,e){ze(t.element(),"aria-selected",e)})],none:[Ju("update",tt)]}))],rg=aa({fields:og,name:"toggling",active:ng,apis:tg,state:(ql=!1,{init:function(){var n=_t(ql);return{get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(ql)},readState:function(){return n.get()}}}})}),ig="alloy.item-hover",ug="alloy.item-focus",ag=function(t){(Wl(t.element()).isNone()||Xm.isFocused(t))&&(Xm.isFocused(t)||Xm.focus(t),Gr(t,ig,{item:t}))},cg=function(t){Gr(t,ug,{item:t})},sg=nt(ig),fg=nt(ug),lg=function(t,n){var e,o;return{key:t,value:{config:{},me:(e=t,o=ii(n),aa({fields:[br("enabled")],name:e,active:{events:nt(o)}})),configAsRaw:nt({}),initialConfig:{},state:zi}}},dg=[br("data"),br("components"),br("dom"),Mr("hasSubmenu",!1),Er("toggling"),af.field("itemBehaviours",[rg,Xm,km,Lm]),Mr("ignoreFocus",!1),Mr("domModification",{}),Ju("builder",function(t){return{dom:t.dom,domModification:ao({},t.domModification,{attributes:ao({role:t.toggling.isSome()?"menuitemcheckbox":"menuitem"},t.domModification.attributes,{"aria-haspopup":t.hasSubmenu},t.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:af.augment(t.itemBehaviours,[t.toggling.fold(rg.revoke,function(t){return rg.config(ao({aria:{mode:"checked"}},t))}),Xm.config({ignore:t.ignoreFocus,stopMousedown:t.ignoreFocus,onFocus:function(t){cg(t)}}),km.config({mode:"execution"}),Lm.config({store:{mode:"memory",initialValue:t.data}}),lg("item-type-events",[si(Rn(),Xr),pi(zt()),si(Wt(),ag),si(In(),Xm.focus)])]),components:t.components,eventOrder:t.eventOrder}}),Mr("eventOrder",{})],mg=[br("dom"),br("components"),Ju("builder",function(t){return{dom:t.dom,components:t.components,events:ii([hi(In())])}})],gg=nt([Vf({name:"widget",overrides:function(n){return{behaviours:ia([Lm.config({store:{mode:"manual",getValue:function(t){return n.data},setValue:function(){}}})])}}})]),pg=[br("uid"),br("data"),br("components"),br("dom"),Mr("autofocus",!1),Mr("ignoreFocus",!1),af.field("widgetBehaviours",[Lm,Xm,km]),Mr("domModification",{}),el(gg()),Ju("builder",function(e){var t=Yf(0,e,gg()),n=qf("item-widget",e,t.internals()),o=function(t){return Kf(t,e,"widget").map(function(t){return km.focusIn(t),t})},r=function(t,n){return gl(n.event().target())||e.autofocus&&n.setSource(t.element()),et.none()};return{dom:e.dom,components:n,domModification:e.domModification,events:ii([wi(function(t,n){o(t).each(function(t){n.stop()})}),si(Wt(),ag),si(In(),function(t,n){e.autofocus?o(t):Xm.focus(t)})]),behaviours:af.augment(e.widgetBehaviours,[Lm.config({store:{mode:"memory",initialValue:e.data}}),Xm.config({ignore:e.ignoreFocus,onFocus:function(t){cg(t)}}),km.config({mode:"special",focusIn:e.autofocus?function(t){o(t)}:fa(),onLeft:r,onRight:r,onEscape:function(t,n){return Xm.isFocused(t)||e.autofocus?(e.autofocus&&n.setSource(t.element()),et.none()):(Xm.focus(t),et.some(!0))}})])}})],hg=fr("type",{widget:pg,item:dg,separator:mg}),vg=nt([Nf({factory:{sketch:function(t){var n=cr("menu.spec item",hg,t);return n.builder(n)}},name:"items",unit:"item",defaults:function(t,n){return n.hasOwnProperty("uid")?n:ao({},n,{uid:Di("item")})},overrides:function(t,n){return{type:n.type,ignoreFocus:t.fakeFocus,domModification:{classes:[t.markers.item]}}}})]),bg=nt([br("value"),br("items"),br("dom"),br("components"),Mr("eventOrder",{}),of("menuBehaviours",[Dl,Lm,vl,km]),Fr("movement",{mode:"menu",moveOnTab:!0},fr("mode",{grid:[Qu(),Ju("config",function(t,n){return{mode:"flatgrid",selector:"."+t.markers.item,initSize:{numColumns:n.initSize.numColumns,numRows:n.initSize.numRows},focusManager:t.focusManager}})],matrix:[Ju("config",function(t,n){return{mode:"matrix",selectors:{row:n.rowSelector,cell:"."+t.markers.item},focusManager:t.focusManager}}),br("rowSelector")],menu:[Mr("moveOnTab",!0),Ju("config",function(t,n){return{mode:"menu",selector:"."+t.markers.item,moveOnTab:n.moveOnTab,focusManager:t.focusManager}})]})),yr("markers",ju()),Mr("fakeFocus",!1),Mr("focusManager",Xl()),Yu("onHighlight")]),yg=nt("alloy.menu-focus"),xg=ml({name:"Menu",configFields:bg(),partFields:vg(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:uf(t.menuBehaviours,[Dl.config({highlightClass:t.markers.selectedItem,itemClass:t.markers.item,onHighlight:t.onHighlight}),Lm.config({store:{mode:"memory",initialValue:t.value}}),vl.config({find:et.some}),km.config(t.movement.config(t,t.movement))]),events:ii([si(fg(),function(n,e){var t=e.event();n.getSystem().getByDom(t.target()).each(function(t){Dl.highlight(n,t),e.stop(),Gr(n,yg(),{menu:n,item:t})})}),si(sg(),function(t,n){var e=n.event().item();Dl.highlight(t,e)})]),components:n,eventOrder:t.eventOrder,domModification:{attributes:{role:"menu"}}}}}),wg=function(e,o,r,t){return Et(r,t).bind(function(t){return Et(e,t).bind(function(t){var n=wg(e,o,r,t);return et.some([t].concat(n))})}).getOr([])},Sg=function(t,n){var e={};rt(t,function(t,n){F(t,function(t){e[t]=n})});var o=n,r=ut(n,function(t,n){return{k:t,v:n}}),i=it(r,function(t,n){return[n].concat(wg(e,o,r,n))});return it(e,function(t){return Et(i,t).getOr([t])})},kg=function(){var i=_t({}),u=_t({}),a=_t({}),c=_t(et.none()),s=_t({}),n=function(t){return Et(u.get(),t)};return{setMenuBuilt:function(t,n){var e;u.set(ao({},u.get(),((e={})[t]={type:"prepared",menu:n},e)))},setContents:function(t,n,e,o){c.set(et.some(t)),i.set(e),u.set(n),s.set(o);var r=Sg(o,e);a.set(r)},expand:function(e){return Et(i.get(),e).map(function(t){var n=Et(a.get(),e).getOr([]);return[t].concat(n)})},refresh:function(t){return Et(a.get(),t)},collapse:function(t){return Et(a.get(),t).bind(function(t){return 1<t.length?et.some(t.slice(1)):et.none()})},lookupMenu:n,otherMenus:function(t){var n=s.get();return Y(Q(n),t)},getPrimary:function(){return c.get().bind(function(t){return n(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})})},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(et.none())},isClear:function(){return c.get().isNone()}}},Cg=nt("collapse-item"),Og=dl({name:"TieredMenu",configFields:[$u("onExecute"),$u("onEscape"),Ku("onOpenMenu"),Ku("onOpenSubmenu"),Yu("onCollapseMenu"),Mr("highlightImmediately",!0),kr("data",[br("primary"),br("menus"),br("expansions")]),Mr("fakeFocus",!1),Yu("onHighlight"),Yu("onHover"),Wu(),br("dom"),Mr("navigateOnHover",!0),Mr("stayInDom",!1),of("tmenuBehaviours",[km,Dl,vl,Bm]),Mr("eventOrder",{})],apis:{collapseMenu:function(t,n){t.collapseMenu(n)},highlightPrimary:function(t,n){t.highlightPrimary(n)}},factory:function(a,t){var c,n,i=_t(et.none()),s=kg(),e=function(t){var o,r,n,e=(o=t,r=a.data.primary,n=a.data.menus,it(n,function(t,n){var e=function(){return xg.sketch(ao({dom:t.dom},t,{value:n,items:t.items,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:a.fakeFocus?Yl():Xl()}))};return n===r?{type:"prepared",menu:o.getSystem().build(e())}:{type:"notbuilt",nbMenu:e}})),i=u(t);return s.setContents(a.data.primary,e,a.data.expansions,i),s.getPrimary()},f=function(t){return Lm.getValue(t).value},u=function(t){return it(a.data.menus,function(t,n){return W(t.items,function(t){return"separator"===t.type?[]:[t.data.value]})})},l=function(n,t){Dl.highlight(n,t),Dl.getHighlighted(t).orThunk(function(){return Dl.getFirst(t)}).each(function(t){Yr(n,t.element(),In())})},d=function(n,t){return Mt(M(t,function(t){return n.lookupMenu(t).bind(function(t){return"prepared"===t.type?et.some(t.menu):et.none()})}))},m=function(n,t,e){var o=d(t,t.otherMenus(e));F(o,function(t){au(t.element(),[a.markers.backgroundMenu]),a.stayInDom||Bm.remove(n,t)})},g=function(t,o){var r,n=(r=t,i.get().getOrThunk(function(){var e={},t=Qc(r.element(),"."+a.markers.item),n=R(t,function(t){return"true"===je(t,"aria-haspopup")});return F(n,function(t){r.getSystem().getByDom(t).each(function(t){var n=f(t);e[n]=t})}),i.set(et.some(e)),e}));rt(n,function(t,n){var e=T(o,n);ze(t.element(),"aria-expanded",e)})},p=function(o,r,i){return et.from(i[0]).bind(function(t){return r.lookupMenu(t).bind(function(t){if("notbuilt"===t.type)return et.none();var n=t.menu,e=d(r,i.slice(1));return F(e,function(t){ou(t.element(),a.markers.backgroundMenu)}),Zr(n.element())||Bm.append(o,Mu(n)),au(n.element(),[a.markers.backgroundMenu]),l(o,n),m(o,r,i),et.some(n)})})};(n=c||(c={}))[n.HighlightSubmenu=0]="HighlightSubmenu",n[n.HighlightParent=1]="HighlightParent";var h=function(r,i,u){void 0===u&&(u=c.HighlightSubmenu);var t=f(i);return s.expand(t).bind(function(o){return g(r,o),et.from(o[0]).bind(function(e){return s.lookupMenu(e).bind(function(t){var n=function(t,n,e){if("notbuilt"!==e.type)return e.menu;var o=t.getSystem().build(e.nbMenu());return s.setMenuBuilt(n,o),o}(r,e,t);return Zr(n.element())||Bm.append(r,Mu(n)),a.onOpenSubmenu(r,i,n),u===c.HighlightSubmenu?(Dl.highlightFirst(n),p(r,s,o)):(Dl.dehighlightAll(n),et.some(i))})})})},o=function(n,e){var t=f(e);return s.collapse(t).bind(function(t){return g(n,t),p(n,s,t).map(function(t){return a.onCollapseMenu(n,e,t),t})})},r=function(e){return function(n,t){return Ru(t.getSource(),"."+a.markers.item).bind(function(t){return n.getSystem().getByDom(t).toOption().bind(function(t){return e(n,t).map(function(){return!0})})})}},v=ii([si(yg(),function(n,t){var e=t.event().menu();Dl.highlight(n,e);var o=f(t.event().item());s.refresh(o).each(function(t){return m(n,s,t)})}),wi(function(n,t){var e=t.event().target();n.getSystem().getByDom(e).each(function(t){0===f(t).indexOf("collapse-item")&&o(n,t),h(n,t,c.HighlightSubmenu).fold(function(){a.onExecute(n,t)},function(){})})}),bi(function(n,t){e(n).each(function(t){Bm.append(n,Mu(t)),a.onOpenMenu(n,t),a.highlightImmediately&&l(n,t)})})].concat(a.navigateOnHover?[si(sg(),function(t,n){var e,o,r=n.event().item();e=t,o=f(r),s.refresh(o).bind(function(t){return g(e,t),p(e,s,t)}),h(t,r,c.HighlightParent),a.onHover(t,r)})]:[])),b={collapseMenu:function(n){Dl.getHighlighted(n).each(function(t){Dl.getHighlighted(t).each(function(t){o(n,t)})})},highlightPrimary:function(n){s.getPrimary().each(function(t){l(n,t)})}};return{uid:a.uid,dom:a.dom,markers:a.markers,behaviours:uf(a.tmenuBehaviours,[km.config({mode:"special",onRight:r(function(t,n){return gl(n.element())?et.none():h(t,n,c.HighlightSubmenu)}),onLeft:r(function(t,n){return gl(n.element())?et.none():o(t,n)}),onEscape:r(function(t,n){return o(t,n).orThunk(function(){return a.onEscape(t,n).map(function(){return t})})}),focusIn:function(n,t){s.getPrimary().each(function(t){Yr(n,t.element(),In())})}}),Dl.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),vl.config({find:function(t){return Dl.getHighlighted(t)}}),Bm.config({})]),eventOrder:a.eventOrder,apis:b,events:v}},extraApis:{tieredData:function(t,n,e){return{primary:t,menus:n,expansions:e}},singleData:function(t,n){return{primary:t,menus:Tt(t,n),expansions:{}}},collapseItem:function(t){return{value:io(Cg()),meta:{text:t}}}}}),Eg=dl({name:"InlineView",configFields:[br("lazySink"),Yu("onShow"),Yu("onHide"),Dr("onEscape"),of("inlineBehaviours",[Js,ma]),_r("fireDismissalEventInstead",[Mr("event",Gn())]),Mr("getRelated",et.none),Mr("eventOrder",et.none)],factory:function(s,t){var r=function(t,n,e,o){var r=s.lazySink(t).getOrDie();Js.openWhileCloaked(t,e,function(){return Ms.positionWithin(r,n,t,o)}),s.onShow(t)},n={setContent:function(t,n){Js.open(t,n)},showAt:function(t,n,e){var o=et.none();r(t,n,e,o)},showWithin:r,showMenuAt:function(t,n,e){var o,r,i,u,a,c=(o=s,r=t,i=n,u=e,a=function(){return o.lazySink(r)},Og.sketch({dom:{tag:"div"},data:u.data,markers:u.menu.markers,onEscape:function(){return Js.close(r),o.onEscape.map(function(t){return t(r)}),et.some(!0)},onExecute:function(){return et.some(!0)},onOpenMenu:function(t,n){Ms.position(a().getOrDie(),i,n)},onOpenSubmenu:function(t,n,e){var o=a().getOrDie();Ms.position(o,{anchor:"submenu",item:n},e)}}));Js.open(t,c),s.onShow(t)},hide:function(t){Js.close(t),s.onHide(t)},getContent:function(t){return Js.getState(t)},isOpen:Js.isOpen};return{uid:s.uid,dom:s.dom,behaviours:uf(s.inlineBehaviours,[Js.config({isPartOf:function(t,n,e){return Pu(n,e)||(o=t,r=e,s.getRelated(o).exists(function(t){return Pu(t,r)}));var o,r},getAttachPoint:function(t){return s.lazySink(t).getOrDie()}}),nf(ao({isExtraPart:nt(!1)},s.fireDismissalEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})))]),eventOrder:s.eventOrder,apis:n}},apis:{showAt:function(t,n,e,o){t.showAt(n,e,o)},showWithin:function(t,n,e,o,r){t.showWithin(n,e,o,r)},showMenuAt:function(t,n,e,o){t.showMenuAt(n,e,o)},hide:function(t,n){t.hide(n)},isOpen:function(t,n){return t.isOpen(n)},getContent:function(t,n){return t.getContent(n)},setContent:function(t,n,e){t.setContent(n,e)}}}),Tg=function(t){var n=function(t,n){n.stop(),Xr(t)},e=Tn.detect().deviceType.isTouch()?[si(Vn(),n)]:[si(Jt(),n),si(zt(),function(t,n){n.cut()})];return ii(j([t.map(function(e){return si(Fn(),function(t,n){e(t),n.stop()})}).toArray(),e]))},Bg=dl({name:"Button",factory:function(t){var n=Tg(t.action),e=t.dom.tag,o=function(n){return Et(t.dom,"attributes").bind(function(t){return Et(t,n)})};return{uid:t.uid,dom:t.dom,components:t.components,events:n,behaviours:af.augment(t.buttonBehaviours,[Xm.config({}),km.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:function(){if("button"!==e)return{role:o("role").getOr("button")};var t=o("type").getOr("button"),n=o("role").map(function(t){return{role:t}}).getOr({});return ao({type:t},n)}()},eventOrder:t.eventOrder}},configFields:[Mr("uid",undefined),br("dom"),Mr("components",[]),af.field("buttonBehaviours",[Xm,km]),Er("action"),Er("role"),Mr("eventOrder",{})]}),Ag=function(t){var n=al(t)&&Dt(t,"uid")?t.uid:Di("memento");return{get:function(t){return t.getSystem().getByUid(n).getOrDie()},getOpt:function(t){return t.getSystem().getByUid(n).fold(et.none,et.some)},asSpec:function(){return ao({},t,{uid:n})}}},Dg=function(t){return et.from(t()["temporary-placeholder"]).getOr("!not found!")},_g=function(t,n){return et.from(n()[t]).getOrThunk(function(){return Dg(n)})},Mg={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},Fg=dl({name:"Notification",factory:function(n){var t,e,o=Ag({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:ia([Bm.config({})])}),r=function(t){return{dom:{tag:"div",classes:["tox-bar"],attributes:{style:"width: "+t+"%"}}}},i=function(t){return{dom:{tag:"div",classes:["tox-text"],innerHtml:t+"%"}}},u=Ag({dom:{tag:"div",classes:n.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[r(0)]},i(0)],behaviours:ia([Bm.config({})])}),a={updateProgress:function(t,n){t.getSystem().isConnected()&&u.getOpt(t).each(function(t){Bm.set(t,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[r(n)]},i(n)])})},updateText:function(t,n){if(t.getSystem().isConnected()){var e=o.get(t);Bm.set(e,[Bu(n)])}}},c=j([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return et.from(Mg[t])}).toArray()]);return{uid:n.uid,dom:{tag:"div",attributes:{role:"alert"},classes:n.level.map(function(t){return["tox-notification","tox-notification--in","tox-notification--"+t]}).getOr(["tox-notification","tox-notification--in"])},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:(t=c,e=n.iconProvider,Ft(t,function(t){return et.from(e()[t])}).getOrThunk(function(){return Dg(e)}))}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:ia([Bm.config({})])}].concat(n.progress?[u.asSpec()]:[]).concat(Bg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:_g("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:a}},configFields:[Er("level"),br("progress"),br("icon"),br("onAction"),br("text"),br("iconProvider"),br("translationProvider")],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}}),Ig=tinymce.util.Tools.resolve("tinymce.util.Delay");function Vg(r,i,u){var a=i.backstage;return{open:function(t,n){var e=function(){n(),Eg.hide(r)},o=_u(Fg.sketch({text:t.text,level:T(["success","error","warning","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:et.from(t.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=_u(Eg.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),t.timeout&&Ig.setTimeout(function(){e()},t.timeout),{close:e,moveTo:function(t,n){Eg.showAt(r,{anchor:"makeshift",x:t,y:n},Mu(o))},moveRel:function(t,n){Eg.showAt(r,i.backstage.shared.anchors.banner(),Mu(o))},text:function(t){Fg.updateText(o,t)},settings:t,getEl:function(){},progressBar:{value:function(t){Fg.updateProgress(o,t)}}}},close:function(t){t.close()},reposition:function(t){F(t,function(t){t.moveTo(0,0)}),function(e){if(0<e.length){var t=e.slice(0,1)[0],n=(o=r).inline?o.getElement():o.getContentAreaContainer();t.moveRel(n,"tc-tc"),F(e,function(t,n){0<n&&t.moveRel(e[n-1].getEl(),"bc-tc")})}var o}(t)},getArgs:function(t){return t.settings}}}var Rg,Hg,Ng=function(e,o){var r=null;return{cancel:function(){null!==r&&(x.clearTimeout(r),r=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null!==r&&x.clearTimeout(r),r=x.setTimeout(function(){e.apply(null,t),r=null},o)}}},Pg=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),zg=bt([{aborted:[]},{edge:["element"]},{success:["info"]}]),Lg=bt([{abort:[]},{kontinue:[]},{finish:["info"]}]),jg=function(n,e,t,o,r,i){var u=function(){return i.fold(zg.aborted,zg.edge)},a=function(){var t=r();return t?jg(n,t,et.none(),o,r,et.some(e)):u()};if(n.isBlock(e))return u();if(e.nodeType!==x.Node.TEXT_NODE)return a();var c=e.textContent;return o(Lg,e,c,t).fold(zg.aborted,function(){return a()},zg.success)},Ug=function(t,n,e,o,r){var i=new Pg(n,r||t.getRoot());return jg(t,n,et.some(e),o,i.prev,et.none())},Wg=function(e,n){return Gg(Qn.fromDom(e.selection.getNode())).getOrThunk(function(){var t=Qn.fromHtml('<span data-mce-type="autocompleter" data-mce-bogus="1"></span>',e.getDoc());return Ee(t,Qn.fromDom(n.extractContents())),n.insertNode(t.dom()),ye(t).each(function(t){return t.dom().normalize()}),Jc(t).map(function(t){var n;e.selection.setCursorLocation(t.dom(),"img"===Fe(n=t)?1:qc(n).fold(function(){return we(n).length},function(t){return t.length}))}),t})},Gg=function(t){return Ru(t,'[data-mce-type="autocompleter"]')},Xg=/[\u00a0 \t\r\n]/,Yg=function(t,n){return t.toString().substring(n.length).replace(/\u00A0/g," ").replace(/\uFEFF/g,"")},qg=function(t,u,a,c){return void 0===c&&(c=0),(n=u).collapsed&&3===n.startContainer.nodeType?Ug(t,u.startContainer,u.startOffset,function(e,o,r,t){var i=t.getOr(r.length);return function(t,n,e,o){var r;for(r=n-1;0<=r;r--){var i=t.charAt(r);if(Xg.test(i))return et.none();if(i===e)break}return-1===r||n-r<o?et.none():et.some(t.substring(r+1,n))}(r,i,a,1).fold(function(){return r.match(Xg)?e.abort():e.kontinue()},function(t){var n=u.cloneRange();return n.setStart(o,i-t.length-1),n.setEnd(u.endContainer,u.endOffset),r.length<c?e.abort():e.finish({text:Yg(n,a),range:n,triggerChar:a})})}).fold(et.none,et.none,et.some):et.none();var n},Kg=function(e,t,o,n){return void 0===n&&(n=0),Gg(Qn.fromDom(t.startContainer)).fold(function(){return qg(e,t,o,n)},function(t){var n=e.createRng();return n.selectNode(t.dom()),et.some({range:n,text:Yg(n,o),triggerChar:o})})},$g=function(e,t){t.on("keypress compositionend",e.onKeypress.throttle),t.on("remove",e.onKeypress.cancel);var o=function(t,n){Gr(t,Yt(),{raw:n})};t.on("keydown",function(n){var t=function(){return e.getView().bind(Dl.getHighlighted)};8===n.which&&e.onKeypress.throttle(n),e.isActive()&&(27===n.which&&e.cancelIfNecessary(),e.isMenuOpen()?13===n.which?(t().each(Xr),n.preventDefault()):40===n.which?(t().fold(function(){e.getView().each(Dl.highlightFirst)},function(t){o(t,n)}),n.preventDefault(),n.stopImmediatePropagation()):37!==n.which&&38!==n.which&&39!==n.which||t().each(function(t){o(t,n),n.preventDefault(),n.stopImmediatePropagation()}):13!==n.which&&38!==n.which&&40!==n.which||e.cancelIfNecessary())}),t.on("NodeChange",function(t){e.isActive()&&Gg(Qn.fromDom(t.element)).isNone()&&e.cancelIfNecessary()})},Jg=tinymce.util.Tools.resolve("tinymce.util.Promise"),Zg=function(t,n){return{element:t,offset:n}},Qg=function(t){if(t.nodeType===x.Node.TEXT_NODE)return Zg(t,t.data.length);var n=t.childNodes;return 0<n.length?Qg(n[n.length-1]):Zg(t,n.length)},tp=function(t,n){var e=t.childNodes;return 0<e.length&&n<e.length?tp(e[n],0):0<e.length&&t.nodeType===x.Node.ELEMENT_NODE&&e.length===n?Qg(e[e.length-1]):Zg(t,n)},np=function(n,e){var o,r,t,i=e(),u=n.selection.getRng();return(o=n.dom,r=u,t=i,Ft(t.triggerChars,function(t){return Kg(o,r,t)})).bind(function(t){return ep(n,e,t)})},ep=function(n,t,e){var o=t(),r=n.selection.getRng().startContainer.nodeValue,i=R(o.lookupByChar(e.triggerChar),function(t){return e.text.length>=t.minChars&&t.matches.getOrThunk(function(){return e=n.dom,o=function(t,n,e,o){var r=o.getOr(e.length);return 0===r?t.kontinue():t.finish(/\s/.test(e.charAt(r-1)))},function(t){var n=tp(t.startContainer,t.startOffset);return Ug(e,n.element,n.offset,o).fold(nt(!0),nt(!0),d)};var e,o})(e.range,r,e.text)});if(0===i.length)return et.none();var u=Jg.all(M(i,function(n){return n.fetch(e.text,n.maxResults).then(function(t){return{matchText:e.text,items:t,columns:n.columns,onAction:n.onAction}})}));return et.some({lookupData:u,context:e})},op=Go([zr("type",function(){return"autocompleteitem"}),zr("active",function(){return!1}),zr("disabled",function(){return!1}),Mr("meta",{}),xr("value"),Ar("text"),Ar("icon")]),rp=Go([xr("type"),xr("ch"),Ir("minChars",1),Mr("columns",1),Ir("maxResults",10),Dr("matches"),Sr("fetch"),Sr("onAction")]),ip=function(t){var n,e,o=t.ui.registry.getAll().popups,r=it(o,function(t){return(n=t,ur("Autocompleter",rp,n)).fold(function(t){throw new Error(sr(t))},function(t){return t});var n}),i=(n=at(r,function(t){return t.ch}),e={},F(n,function(t){e[t]={}}),Q(e)),u=st(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return R(u,function(t){return t.ch===n})}}},up=[Hr("disabled",!1),Ar("text"),Ar("shortcut"),Jo("value","value",ho(function(){return io("menuitem-value")}),lr()),Mr("meta",{})],ap=Go([xr("type"),Nr("onSetup",function(){return tt}),Nr("onAction",tt),Ar("icon")].concat(up)),cp=Go([xr("type"),Sr("getSubmenuItems"),Nr("onSetup",function(){return tt}),Ar("icon")].concat(up)),sp=Go([xr("type"),Hr("active",!1),Nr("onSetup",function(){return tt}),Sr("onAction")].concat(up)),fp=Go([xr("type"),Hr("active",!1),Ar("icon")].concat(up)),lp=Go([xr("type"),Ar("text")]),dp=Go([xr("type"),wr("fancytype",["inserttable","colorswatch"]),Nr("onAction",tt)]),mp=function(t,o,n){var r=Qc(t.element(),"."+n);if(0<r.length){var e=P(r,function(t){var n=t.dom().getBoundingClientRect().top,e=r[0].dom().getBoundingClientRect().top;return Math.abs(n-e)>o}).getOr(r.length);return et.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return et.none()},gp=function(t,n){return ia([lg(t,n)])},pp=function(t){return gp(io("unnamed-events"),t)},hp=[br("lazySink"),br("tooltipDom"),Mr("exclusive",!0),Mr("tooltipComponents",[]),Mr("delay",300),Rr("mode","normal",["normal","follow-highlight"]),Mr("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:nt([Cc,kc,yc,wc,xc,Sc]),onRtl:nt([Cc,kc,yc,wc,xc,Sc])}}}),Yu("onHide"),Yu("onShow")],vp=/* */Object.freeze({init:function(){var e=_t(et.none()),n=_t(et.none()),o=function(){e.get().each(function(t){x.clearTimeout(t)})},t=nt("not-implemented");return Li({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(et.some(t))},clearTooltip:function(){n.set(et.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(et.some(x.setTimeout(function(){t()},n)))},readState:t})}}),bp=io("tooltip.exclusive"),yp=io("tooltip.show"),xp=io("tooltip.hide"),wp=function(t,n,e){t.getSystem().broadcastOn([bp],{})},Sp=/* */Object.freeze({hideAllExclusive:wp,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&Bm.set(t,o)})}}),kp=aa({fields:hp,name:"tooltipping",active:/* */Object.freeze({events:function(o,r){var e=function(n){r.getTooltip().each(function(t){Ns(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return ii(j([[si(yp,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){wp(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:ii("normal"===o.mode?[si(Wt(),function(t){Wr(n,yp)}),si(jt(),function(t){Wr(n,xp)})]:[]),behaviours:ia([Bm.config({})])});r.setTooltip(e),Vs(t,e),o.onShow(n,e),Ms.position(t,o.anchor(n),e)}}(t)},o.delay)}),si(xp,function(t){r.resetTimer(function(){e(t)},o.delay)}),si(Mn(),function(t,n){T(n.channels(),bp)&&e(t)}),yi(function(t){e(t)})],"normal"===o.mode?[si(Gt(),function(t){Wr(t,yp)}),si(Dn(),function(t){Wr(t,xp)}),si(Wt(),function(t){Wr(t,yp)}),si(jt(),function(t){Wr(t,xp)})]:[si($n(),function(t,n){Wr(t,yp)}),si(Jn(),function(t){Wr(t,xp)})]]))}}),state:vp,apis:Sp}),Cp=function(t){var n,e,o,r=Qn.fromHtml(t),i=we(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],U(e,function(t,n){var e;return"class"===n.name?t:ao({},t,((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:_e(r)};return ao({tag:Fe(r),classes:a,attributes:u},c)},Op=tinymce.util.Tools.resolve("tinymce.util.I18n"),Ep="tox-menu-nav__js",Tp="tox-collection__item",Bp="tox-swatch",Ap={normal:Ep,color:Bp},Dp="tox-collection__item--enabled",_p="tox-collection__item-icon",Mp="tox-collection__item-label",Fp="tox-collection__item--active",Ip=function(t){return Et(Ap,t).getOr(Ep)},Vp=tinymce.util.Tools.resolve("tinymce.Env"),Rp=function(t){var e=Vp.mac?{alt:"&#x2325;",ctrl:"&#x2303;",shift:"&#x21E7;",meta:"&#x2318;",access:"&#x2303;&#x2325;"}:{meta:"Ctrl",access:"Shift+Alt"},n=t.split("+"),o=M(n,function(t){var n=t.toLowerCase().trim();return lt(e,n)?e[n]:t});return Vp.mac?o.join(""):o.join("+")},Hp=function(t){return{dom:{tag:"div",classes:[_p],innerHtml:t}}},Np=function(t){return{dom:{tag:"div",classes:[Mp]},components:[Bu(Op.translate(t))]}},Pp=function(t,n){return{dom:{tag:"div",classes:[Mp]},components:[{dom:{tag:t.tag,attributes:{style:t.styleAttr}},components:[Bu(Op.translate(n))]}]}},zp=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:Rp(t)}}},Lp=function(t){return{dom:{tag:"div",classes:[_p,"tox-collection__item-checkmark"],innerHtml:_g("checkmark",t)}}},jp=function(t,n,e,o,r){var i=e?t.checkMark.orThunk(function(){return n.or(et.some("")).map(Hp)}):et.none(),u=t.ariaLabel.map(function(t){return{attributes:{title:Op.translate(t)}}}).getOr({});return{dom:St({tag:"div",classes:[Ep,Tp].concat(r?["tox-collection__item-icon-rtl"]:[])},u),optComponents:[i,t.htmlContent.fold(function(){return t.textContent.map(o)},function(t){return et.some({dom:{tag:"div",classes:[Mp],innerHtml:t}})}),t.shortcutContent.map(zp),t.caret]}},Up=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],Wp=["list-bull-circle","list-bull-default","list-bull-square"],Gp=function(t,r,n,i){void 0===i&&(i=et.none());var e,o,u,a,c,s,f,l=Op.isRtl()&&t.iconContent.exists(function(t){return T(Wp,t)}),d=(e=t.iconContent,e.map(function(t){return Op.isRtl()&&T(Up,t)?t+"-rtl":t})).map(function(t){return n=t,e=r.icons,o=i,et.from(e()[n]).or(o).getOrThunk(function(){return Dg(e)});var n,e,o}),m=et.from(t.meta).fold(function(){return Np},function(t){return lt(t,"style")?g(Pp,t.style):Np});return"color"===t.presets?(o=t.ariaLabel,u=t.value,a=r,{dom:(c=Bp,s=d.getOr(""),f=o.map(function(t){return' title="'+a.translate(t)+'"'}).getOr(""),Cp("custom"===u?'<button class="'+c+' tox-swatches__picker-btn"'+f+">"+s+"</button>":"remove"===u?'<div class="'+c+' tox-swatch--remove"'+f+">"+s+"</div>":'<div class="'+c+'" style="background-color: '+u+'" data-mce-color="'+u+'"'+f+"></div>")),optComponents:[]}):jp(t,d,n,m,l)},Xp=["input","button","textarea"],Yp=function(t,n,e){n.disabled&&Qp(t,n,e)},qp=function(t){return T(Xp,Fe(t.element()))},Kp=function(t){ze(t.element(),"disabled","disabled")},$p=function(t){Ge(t.element(),"disabled")},Jp=function(t){ze(t.element(),"aria-disabled","true")},Zp=function(t){ze(t.element(),"aria-disabled","false")},Qp=function(n,t,e){t.disableClass.each(function(t){ou(n.element(),t)}),(qp(n)?Kp:Jp)(n)},th=function(n,t,e){t.disableClass.each(function(t){ru(n.element(),t)}),(qp(n)?$p:Zp)(n)},nh=function(t){return qp(t)?We(t.element(),"disabled"):"true"===je(t.element(),"aria-disabled")},eh=/* */Object.freeze({enable:th,disable:Qp,isDisabled:nh,onLoad:Yp,set:function(t,n,e,o){(o?Qp:th)(t,n,e)}}),oh=/* */Object.freeze({exhibit:function(t,n,e){return Ui({classes:n.disabled?n.disableClass.map(q).getOr([]):[]})},events:function(t,n){return ii([ui(Fn(),function(t,n){return nh(t)}),ta(t,n,Yp)])}}),rh=[Mr("disabled",!1),Er("disableClass")],ih=aa({fields:rh,name:"disabling",active:oh,apis:eh}),uh=function(t){return ih.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},ah=function(t){return ih.config({disabled:t})},ch=function(t){return ih.config({disabled:t,disableClass:"tox-tbtn--disabled"})},sh=function(t,n){var e=t.getApi(n);return function(t){t(e)}},fh=function(e,o){return bi(function(t){sh(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},lh=function(n,e){return yi(function(t){return sh(n,t)(e.get())})};(Hg=Rg||(Rg={}))[Hg.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",Hg[Hg.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var dh,mh,gh=Rg,ph={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},hh=function(t){return W(t,function(t){return t.toArray()})},vh=function(t,n,e){var o,r,i=_t(tt);return{type:"item",dom:n.dom,components:hh(n.optComponents),data:t.data,eventOrder:ph,hasSubmenu:t.triggersSubmenu,itemBehaviours:ia([lg("item-events",[(o=t,r=e,wi(function(t,n){sh(o,t)(o.onAction),o.triggersSubmenu||r!==gh.CLOSE_ON_EXECUTE||(Wr(t,Nn()),n.stop())})),fh(t,i),lh(t,i)]),uh(t.disabled),Bm.config({})].concat(t.itemBehaviours))}},bh=function(t){return{value:t.value,meta:St({text:t.text.getOr("")},t.meta)}},yh=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),xh=function(t,n){var e,o=Op.translate(t),r=(e=o,yh.DOM.encode(e));if(0<n.length){var i=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");return r.replace(i,function(t){return'<span class="tox-autocompleter-highlight">'+t+"</span>"})}return r},wh=nt(jf("item-widget",gg())),Sh=io("cell-over"),kh=io("cell-execute"),Ch=function(n,e,t){var o,r=function(t){return Gr(t,kh,{row:n,col:e})};return _u({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=t,o)},behaviours:ia([lg("insert-table-picker-cell",[si(Wt(),Xm.focus),si(Fn(),r),si(Rn(),r)]),rg.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Xm.config({onFocus:function(t){return Gr(t,Sh,{row:n,col:e})}})])})},Oh=function(t){return{value:nt(t)}},Eh=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Th=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Bh=function(t){return Eh.test(t)||Th.test(t)},Ah=function(t){var n,e=(n=t.value().replace(Eh,function(t,n,e,o){return n+n+e+e+o+o}),{value:nt(n)}),o=Th.exec(e.value());return null===o?["FFFFFF","FF","FF","FF"]:o},Dh=function(t){var n=t.toString(16);return 1===n.length?"0"+n:n},_h=function(t){var n=Dh(t.red())+Dh(t.green())+Dh(t.blue());return Oh(n)},Mh=Math.min,Fh=Math.max,Ih=Math.round,Vh=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,Rh=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,Hh=function(t,n,e,o){return{red:nt(t),green:nt(n),blue:nt(e),alpha:nt(o)}},Nh=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},Ph=function(t){var n,e,o,r=(t.hue()||0)%360,i=t.saturation()/100,u=t.value()/100;if(i=Fh(0,Mh(i,1)),u=Fh(0,Mh(u,1)),0===i)return n=e=o=Ih(255*u),Hh(n,e,o,1);var a=r/60,c=u*i,s=c*(1-Math.abs(a%2-1)),f=u-c;switch(Math.floor(a)){case 0:n=c,e=s,o=0;break;case 1:n=s,e=c,o=0;break;case 2:n=0,e=c,o=s;break;case 3:n=0,e=s,o=c;break;case 4:n=s,e=0,o=c;break;case 5:n=c,e=0,o=s;break;default:n=e=o=0}return n=Ih(255*(n+f)),e=Ih(255*(e+f)),o=Ih(255*(o+f)),Hh(n,e,o,1)},zh=function(t){var n=Ah(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return Hh(e,o,r,1)},Lh=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return Hh(r,i,u,a)},jh=function(t){return"rgba("+t.red()+","+t.green()+","+t.blue()+","+t.alpha()+")"},Uh=nt(Hh(255,0,0,1)),Wh=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),Gh="tinymce-custom-colors",Xh="choiceitem",Yh=[{type:Xh,text:"Turquoise",value:"#18BC9B"},{type:Xh,text:"Green",value:"#2FCC71"},{type:Xh,text:"Blue",value:"#3598DB"},{type:Xh,text:"Purple",value:"#9B59B6"},{type:Xh,text:"Navy Blue",value:"#34495E"},{type:Xh,text:"Dark Turquoise",value:"#18A085"},{type:Xh,text:"Dark Green",value:"#27AE60"},{type:Xh,text:"Medium Blue",value:"#2880B9"},{type:Xh,text:"Medium Purple",value:"#8E44AD"},{type:Xh,text:"Midnight Blue",value:"#2B3E50"},{type:Xh,text:"Yellow",value:"#F1C40F"},{type:Xh,text:"Orange",value:"#E67E23"},{type:Xh,text:"Red",value:"#E74C3C"},{type:Xh,text:"Light Gray",value:"#ECF0F1"},{type:Xh,text:"Gray",value:"#95A5A6"},{type:Xh,text:"Dark Yellow",value:"#F29D12"},{type:Xh,text:"Dark Orange",value:"#D35400"},{type:Xh,text:"Dark Red",value:"#C0392B"},{type:Xh,text:"Medium Gray",value:"#BDC3C7"},{type:Xh,text:"Dark Gray",value:"#7E8C8D"},{type:Xh,text:"Black",value:"#000000"},{type:Xh,text:"White",value:"#ffffff"}],qh=function P_(n){void 0===n&&(n=10);var t,e=Wh.getItem(Gh),o=S(e)?JSON.parse(e):[],r=n-(t=o).length<0?t.slice(0,n):t,i=function(t){r.splice(t,1)};return{add:function(t){E(r,t).each(i),r.unshift(t),r.length>n&&r.pop(),Wh.setItem(Gh,JSON.stringify(r))},state:function(){return r.slice(0)}}}(10),Kh=function(t){var n,e=[];for(n=0;n<t.length;n+=2)e.push({text:t[n+1],value:"#"+t[n],type:"choiceitem"});return e},$h=function(t){return t.getParam("color_map")},Jh=function(t,n){return t.getParam("color_cols",n,"number")},Zh=function(t){return!1!==t.getParam("custom_colors")},Qh=function(t){var n=$h(t);return n!==undefined?Kh(n):Yh},tv=function(){return M(qh.state(),function(t){return{type:Xh,text:t,value:t}})},nv=function(t){qh.add(t)},ev=function(t){return t.fire("SkinLoaded")},ov=function(t){return t.fire("ResizeEditor")},rv=function(t){return t.fire("ResizeContent")},iv=function(t,n){t.fire("TextColorChange",n)},uv=function(t,e){var o;return t.dom.getParents(t.selection.getStart(),function(t){var n;(n=t.style["forecolor"===e?"color":"background-color"])&&(o=o||n)}),o},av=function(t){return Math.max(5,Math.ceil(Math.sqrt(t)))},cv=function(t){var n=Qh(t),e=av(n.length);return Jh(t,e)},sv=function(n,e,t,o){"custom"===t?pv(n)(function(t){t.each(function(t){nv(t),n.execCommand("mceApplyTextcolor",e,t),o(t)})},"#000000"):"remove"===t?(o(""),n.execCommand("mceRemoveTextcolor",e)):(o(t),n.execCommand("mceApplyTextcolor",e,t))},fv=function(t,n){return t.concat(tv().concat((o={type:e="choiceitem",text:"Remove color",icon:"color-swatch-remove-color",value:"remove"},n?[o,{type:e,text:"Custom color",icon:"color-picker",value:"custom"}]:[o])));var e,o},lv=function(n,e){return function(t){t(fv(n,e))}},dv=function(t,n,e){var o,r;o="forecolor"===n?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color",r=e,t.setIconFill(o,r),t.setIconStroke(o,r)},mv=function(o,e,r,t,i){o.ui.registry.addSplitButton(e,{tooltip:t,presets:"color",icon:"forecolor"===e?"text-color":"highlight-bg-color",select:function(e){return et.from(uv(o,r)).bind(function(t){return function(t){if("transparent"===t)return et.some(Hh(0,0,0,0));var n=Vh.exec(t);if(null!==n)return et.some(Lh(n[1],n[2],n[3],"1"));var e=Rh.exec(t);return null!==e?et.some(Lh(e[1],e[2],e[3],e[4])):et.none()}(t).map(function(t){var n=_h(t).value();return xn(e.toLowerCase(),n)})}).getOr(!1)},columns:cv(o),fetch:lv(Qh(o),Zh(o)),onAction:function(t){null!==i.get()&&sv(o,r,i.get(),function(){})},onItemAction:function(t,n){sv(o,r,n,function(t){i.set(t),iv(o,{name:e,color:t})})},onSetup:function(n){null!==i.get()&&dv(n,e,i.get());var t=function(t){t.name===e&&dv(n,t.name,t.color)};return o.on("TextColorChange",t),function(){o.off("TextColorChange",t)}}})},gv=function(n,t,e,o){n.ui.registry.addNestedMenuItem(t,{text:o,icon:"forecolor"===t?"text-color":"highlight-bg-color",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"colorswatch",onAction:function(t){sv(n,e,t.value,tt)}}]}})},pv=function(i){return function(t,n){var e,o={colorpicker:n},r=(e=t,function(t){var n=t.getData();e(et.from(n.colorpicker)),t.close()});i.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:o,onAction:function(t,n){"hex-valid"===n.name&&(n.value?t.enable("ok"):t.disable("ok"))},onSubmit:r,onClose:function(){},onCancel:function(){t(et.none())}})}},hv={register:function(t){var i;(i=t).addCommand("mceApplyTextcolor",function(t,n){var e,o,r;o=t,r=n,(e=i).undoManager.transact(function(){e.focus(),e.formatter.apply(o,{value:r}),e.nodeChanged()})}),i.addCommand("mceRemoveTextcolor",function(t){var n,e;e=t,(n=i).undoManager.transact(function(){n.focus(),n.formatter.remove(e,{value:null},null,!0),n.nodeChanged()})});var n=_t(null),e=_t(null);mv(t,"forecolor","forecolor","Text color",n),mv(t,"backcolor","hilitecolor","Background color",e),gv(t,"forecolor","forecolor","Text color"),gv(t,"backcolor","hilitecolor","Background color")},getColors:fv,getFetch:lv,colorPickerDialog:pv,getCurrentColor:uv,getColorCols:cv,calcCols:av},vv=function(e,o){return function(t){var n=A(t,o);return M(n,function(t){return{dom:e,components:t}})}},bv=function(n,i,t){return void 0===t&&(t=!0),{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===n?["tox-collection--list"]:["tox-collection--grid"])},components:[xg.parts().items({preprocess:function(t){return"auto"!==n&&1<n?vv({tag:"div",classes:["tox-collection__group"]},n)(t):(e=function(t,n){return"separator"===i[n].type},o=[],r=[],F(t,function(t,n){e(t,n)?(0<r.length&&o.push(r),r=[],lt(t.dom,"innerHtml")&&r.push(t)):r.push(t)}),0<r.length&&o.push(r),M(o,function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}}));var e,o,r}})]}},yv=function(t){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:(n=t,"color"===n?"tox-swatches":"tox-menu"),tieredMenu:"tox-tiered-menu"};var n},xv=function(t){var n=yv(t);return{backgroundMenu:n.backgroundMenu,selectedMenu:n.selectedMenu,menu:n.menu,selectedItem:n.selectedItem,item:Ip(t)}},wv=[xg.parts().items({})],Sv=function(t,n,e){var o=yv(e);return{dom:{tag:"div",classes:j([[o.tieredMenu]])},markers:xv(e)}},kv=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},Cv=function(t){return x.console.error(sr(t)),x.console.log(t),et.none()},Ov=function(t,n,e,o,r){var i,u,a,c,s,f,l;return"color"===r?{value:t,dom:(i=o,l={dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[xg.parts().items({preprocess:"auto"!==i?vv({tag:"div",classes:["tox-swatches__row"]},i):d})]}]}).dom,components:l.components,items:e}:"normal"===r&&"auto"===o?{value:t,dom:(l=bv(o,e)).dom,components:l.components,items:e}:"normal"===r&&1===o?{value:t,dom:(l=bv(1,e)).dom,components:l.components,items:e}:"normal"===r?{value:t,dom:(l=bv(o,e)).dom,components:l.components,items:e}:"listpreview"!==r||"auto"===o?{value:t,dom:(a=n,c=o,s=r,f=yv(s),{tag:"div",classes:j([[f.menu,"tox-menu-"+c+"-column"],a?[f.hasIcons]:[]])}),components:wv,items:e}:{value:t,dom:(u=o,l={dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[xg.parts().items({preprocess:vv({tag:"div",classes:["tox-collection__group"]},u)})]}).dom,components:l.components,items:e}},Ev=function(t,n,e,o,r,i,u,a){var c=B(n,kv),s=Tv(n,e,o,"color"!==r?"normal":"color",i,u,a);return Ov(t,c,s,o,r)},Tv=function(t,f,l,d,m,g,p){return Mt(M(t,function(s){return"choiceitem"===s.type?(t=s,ur("choicemenuitem",fp,t)).fold(Cv,function(t){return et.some((n=t,e=1===l,o=d,r=f,i=g(s.value),u=m,a=p,c=Gp({presets:o,textContent:e?n.text:et.none(),htmlContent:et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:e?n.shortcut:et.none(),checkMark:e?et.some(Lp(a.icons)):et.none(),caret:et.none(),value:n.value},a,!0),wt(vh({data:bh(n),disabled:n.disabled,getApi:function(n){return{setActive:function(t){rg.set(n,t)},isActive:function(){return rg.isOn(n)},isDisabled:function(){return ih.isDisabled(n)},setDisabled:function(t){return ih.set(n,t)}}},onAction:function(t){return r(n.value)},onSetup:function(t){return t.setActive(i),function(){}},triggersSubmenu:!1,itemBehaviours:[]},c,u),{toggling:{toggleClass:Dp,toggleOnExecute:!1,selected:n.active}})));var n,e,o,r,i,u,a,c}):et.none();var t}))},Bv=function(t,n){var e=xv(n);return 1===t?{mode:"menu",moveOnTab:!0}:"auto"===t?{mode:"grid",selector:"."+e.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+("color"===n?"tox-swatches__row":"tox-collection__group")}},Av={inserttable:function z_(o){var t,n=io("size-label"),a=function(t,n,e){for(var o=[],r=0;r<n;r++){for(var i=[],u=0;u<e;u++)i.push(Ch(r,u,t));o.push(i)}return o}(n,10,10),c=Ag({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:n}},components:[Bu("0x0")],behaviours:ia([Bm.config({})])});return{type:"widget",data:{value:io("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[wh().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:(t=a,W(t,function(t){return M(t,Mu)})).concat(c.asSpec()),behaviours:ia([lg("insert-table-picker",[gi(Sh,function(t,n,e){var o,r,i=e.event().row(),u=e.event().col();!function(t,n,e,o,r){for(var i=0;i<o;i++)for(var u=0;u<r;u++)rg.set(t[i][u],i<=n&&u<=e)}(a,i,u,10,10),Bm.set(c.get(t),[(o=i,r=u,Bu(r+1+"x"+(o+1)))])}),gi(kh,function(t,n,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),Wr(t,Nn())})]),km.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:function L_(n,t){var e=hv.getColors(t.colorinput.getColors(),t.colorinput.hasCustomColors()),o=t.colorinput.getColorCols(),r=Ev(io("menu-value"),e,function(t){n.onAction({value:t})},o,"color",gh.CLOSE_ON_EXECUTE,function(){return!1},t.shared.providers),i=wt(ao({},r,{markers:xv("color"),movement:Bv(o,"color")}));return{type:"widget",data:{value:io("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[wh().widget(xg.sketch(i))]}}},Dv=function(n,e,t,o,r,i,u,a){void 0===a&&(a=!0);var c,s,f=Gp({presets:o,textContent:et.none(),htmlContent:t?n.text.map(function(t){return xh(t,e)}):et.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:et.none(),checkMark:et.none(),caret:et.none(),value:n.value},u.providers,a,n.icon);return vh({data:bh(n),disabled:n.disabled,getApi:function(){return{}},onAction:function(t){return r(n.value,n.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:(c=n.meta,s=u,ft(c,"tooltipWorker").map(function(e){return[kp.config({lazySink:s.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(t){return{anchor:"submenu",item:t,overrides:{maxHeightFunction:ic}}},mode:"follow-highlight",onShow:function(n,t){e(function(t){kp.setComponents(n,[Au({element:Qn.fromDom(t)})])})}})]}).getOr([]))},f,i)},_v=function(t){var n=t.text.fold(function(){return{}},function(t){return{innerHtml:t}});return{type:"separator",dom:ao({tag:"div",classes:[Tp,"tox-collection__group-heading"]},n),components:[]}},Mv=function(t,n,e,o){void 0===o&&(o=!0);var r=Gp({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.none(),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return vh({data:bh(t),getApi:function(n){return{isDisabled:function(){return ih.isDisabled(n)},setDisabled:function(t){return ih.set(n,t)}}},disabled:t.disabled,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n)},Fv=function(t,n,e,o){void 0===o&&(o=!0);var r,i=(r=e.icons,{dom:{tag:"div",classes:["tox-collection__item-caret"],innerHtml:_g("chevron-right",r)}}),u=Gp({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,caret:et.some(i),checkMark:et.none(),shortcutContent:t.shortcut},e,o);return vh({data:bh(t),getApi:function(n){return{isDisabled:function(){return ih.isDisabled(n)},setDisabled:function(t){return ih.set(n,t)}}},disabled:t.disabled,onAction:tt,onSetup:t.onSetup,triggersSubmenu:!0,itemBehaviours:[]},u,n)},Iv=function(t,n,e){var o=Gp({iconContent:et.none(),textContent:t.text,htmlContent:et.none(),ariaLabel:t.text,checkMark:et.some(Lp(e.icons)),caret:et.none(),shortcutContent:t.shortcut,presets:"normal",meta:t.meta},e,!0);return wt(vh({data:bh(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){rg.set(n,t)},isActive:function(){return rg.isOn(n)},isDisabled:function(){return ih.isDisabled(n)},setDisabled:function(t){return ih.set(n,t)}}},onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},o,n),{toggling:{toggleClass:Dp,toggleOnExecute:!1,selected:t.active}})},Vv=function(n,e){return(t=Av,o=n.fancytype,Object.prototype.hasOwnProperty.call(t,o)?et.some(t[o]):et.none()).map(function(t){return t(n,e)});var t,o};(mh=dh||(dh={}))[mh.ContentFocus=0]="ContentFocus",mh[mh.UiFocus=1]="UiFocus";var Rv=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},Hv=function(t){return B(t,Rv)},Nv=function(t,n,e,o){void 0===o&&(o=!0);var r,i,u,a,c,s=e.shared.providers;switch(t.type){case"menuitem":return(c=t,ur("menuitem",ap,c)).fold(Cv,function(t){return et.some(Mv(t,n,s,o))});case"nestedmenuitem":return(a=t,ur("nestedmenuitem",cp,a)).fold(Cv,function(t){return et.some(Fv(t,n,s,o))});case"togglemenuitem":return(u=t,ur("togglemenuitem",sp,u)).fold(Cv,function(t){return et.some(Iv(t,n,s))});case"separator":return(i=t,ur("separatormenuitem",lp,i)).fold(Cv,function(t){return et.some(_v(t))});case"fancymenuitem":return(r=t,ur("fancymenuitem",dp,r)).fold(Cv,function(t){return Vv(t,e)});default:return x.console.error("Unknown item in general menu",t),et.none()}},Pv=function(t,e,o,n,r,i){var u=1===n,a=!u||Hv(t);return Mt(M(t,function(t){return(n=t,ur("Autocompleter.Item",op,n)).fold(Cv,function(t){return et.some(Dv(t,e,u,"normal",o,r,i,a))});var n}))},zv=function(t,n,e,o){var r=Hv(n),i=Mt(M(n,function(t){var n=function(t){return Nv(t,e,o,r)};return"nestedmenuitem"===t.type&&t.getSubmenuItems().length<=0?n(St(t,{disabled:!0})):n(t)}));return Ov(t,r,i,1,"normal")},Lv=function(t){return Og.singleData(t.value,t)},jv=function(d,c){var e=_t(et.none()),m=_u(Eg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],fireDismissalEventInstead:{},inlineBehaviours:ia([lg("dismissAutocompleter",[si(Gn(),function(){return f()})])]),lazySink:c.getSink})),o=function(){return e.get().isSome()},s=function(){o()&&Eg.hide(m)},f=function(){if(o()){var t=e.get().map(function(t){return t.element});Gg(t.getOr(Qn.fromDom(d.selection.getNode()))).each(De),s(),e.set(et.none())}},n=tn(function(){return ip(d)}),l=function(t,n,e,o){t.matchLength=n.text.length;var r,i,u,a,c,s,f,l=Ft(e,function(t){return et.from(t.columns)}).getOr(1);Eg.showAt(m,{anchor:"node",root:Qn.fromDom(d.getBody()),node:et.from(t.element)},xg.sketch((r=Ov("autocompleter-value",!0,o,l,"normal"),i=l,u=dh.ContentFocus,a="normal",c=u===dh.ContentFocus?Yl():Xl(),s=Bv(i,a),f=xv(a),{dom:r.dom,components:r.components,items:r.items,value:r.value,markers:{selectedItem:f.selectedItem,item:f.item},movement:s,fakeFocus:u===dh.ContentFocus,focusManager:c,menuBehaviours:pp("auto"!==i?[]:[bi(function(o,t){mp(o,4,f.item).each(function(t){var n=t.numColumns,e=t.numRows;km.setGridSize(o,e,n)})})])}))),Eg.getContent(m).each(Dl.highlightFirst)},t=Ng(function(t){27!==t.which&&e.get().map(function(t){return Kg(d.dom,d.selection.getRng(),t.triggerChar).bind(function(t){return ep(d,n,t)})}).getOrThunk(function(){return np(d,n)}).fold(f,function(a){!function(t){if(!o()){var n=Wg(d,t.range);e.set(et.some({triggerChar:t.triggerChar,element:n,matchLength:t.text.length}))}}(a.context),a.lookupData.then(function(u){e.get().map(function(t){var n,e,o,r=a.context;if(t.triggerChar===r.triggerChar){var i=(n=r.triggerChar,o=Ft(e=u,function(t){return et.from(t.columns)}).getOr(1),W(e,function(i){var t=i.items;return Pv(t,i.matchText,function(o,r){var t=d.selection.getRng();Kg(d.dom,t,n).fold(function(){return x.console.error("Lost context. Cursor probably moved")},function(t){var n=t.range,e={hide:f};i.onAction(e,n,o,r)})},o,gh.BUBBLE_TO_SANDBOX,c)}));0<i.length?l(t,r,u,i):10<=r.text.length-t.matchLength?f():s()}})})})},50);$g({onKeypress:t,cancelIfNecessary:f,isMenuOpen:function(){return Eg.isOpen(m)},isActive:o,getView:function(){return Eg.getContent(m)}},d)},Uv=function(m,g){return function(t){if(m(t)){var n,e,o,r,i,u,a,c=Qn.fromDom(t.target),s=function(){t.stopPropagation()},f=function(){t.preventDefault()},l=p(f,s),d=(n=c,e=t.clientX,o=t.clientY,r=s,i=f,u=l,a=t,{target:nt(n),x:nt(e),y:nt(o),stop:r,prevent:i,kill:u,raw:nt(a)});g(d)}}},Wv=function(t,n,e,o,r){var i=Uv(e,o);return t.dom().addEventListener(n,i,r),{unbind:g(Gv,t,n,i,r)}},Gv=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},Xv=nt(!0),Yv=function(t,n,e){return Wv(t,n,Xv,e,!1)},qv=function(t,n,e){return Wv(t,n,Xv,e,!0)},Kv=function(t,n,e){return Ru(t,n,e).isSome()};function $v(e,o){var r=null;return{cancel:function(){null!==r&&(x.clearTimeout(r),r=null)},schedule:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r=x.setTimeout(function(){e.apply(null,t),r=null},o)}}}var Jv=function(t){var n=t.raw();return n.touches===undefined||1!==n.touches.length?et.none():et.some(n.touches[0])},Zv=function(e){var u=_t(et.none()),o=$v(function(t){u.set(et.none()),e.triggerEvent(Hn(),t)},400),r=Bt([{key:Ht(),value:function(e){return Jv(e).each(function(t){o.cancel();var n={x:nt(t.clientX),y:nt(t.clientY),target:e.target};o.schedule(e),u.set(et.some(n))}),et.none()}},{key:Nt(),value:function(t){return o.cancel(),Jv(t).each(function(i){u.get().each(function(t){var n,e,o,r;n=i,e=t,o=Math.abs(n.clientX-e.x()),r=Math.abs(n.clientY-e.y()),(5<o||5<r)&&u.set(et.none())})}),et.none()}},{key:Pt(),value:function(n){return o.cancel(),u.get().filter(function(t){return he(t.target(),n.target())}).map(function(t){return e.triggerEvent(Vn(),n)})}}]);return{fireIfReady:function(n,t){return Et(r,t).bind(function(t){return t(n)})}}},Qv=Tn.detect().browser.isFirefox(),tb=Wo([Sr("triggerEvent"),Mr("stopBackspace",!0)]),nb=function(n,t){var e,o,r,i,u=cr("Getting GUI events settings",tb,t),a=Tn.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],c=Zv(u),s=M(a.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(t){return Yv(n,t,function(n){c.fireIfReady(n,t).each(function(t){t&&n.kill()}),u.triggerEvent(t,n)&&n.kill()})}),f=_t(et.none()),l=Yv(n,"paste",function(n){c.fireIfReady(n,"paste").each(function(t){t&&n.kill()}),u.triggerEvent("paste",n)&&n.kill(),f.set(et.some(x.setTimeout(function(){u.triggerEvent(_n(),n)},0)))}),d=Yv(n,"keydown",function(t){var n;u.triggerEvent("keydown",t)?t.kill():!0!==u.stopBackspace||8!==(n=t).raw().which||T(["input","textarea"],Fe(n.target()))||Kv(n.target(),'[contenteditable="true"]')||t.prevent()}),m=(e=n,o=function(t){u.triggerEvent("focusin",t)&&t.kill()},Qv?qv(e,"focus",o):Yv(e,"focusin",o)),g=_t(et.none()),p=(r=n,i=function(t){u.triggerEvent("focusout",t)&&t.kill(),g.set(et.some(x.setTimeout(function(){u.triggerEvent(Dn(),t)},0)))},Qv?qv(r,"blur",i):Yv(r,"focusout",i));return{unbind:function(){F(s,function(t){t.unbind()}),d.unbind(),m.unbind(),p.unbind(),l.unbind(),f.get().each(x.clearTimeout),g.get().each(x.clearTimeout)}}},eb=function(t,n){var e=Et(t,"target").map(function(t){return t()}).getOr(n);return _t(e)},ob=bt([{stopped:[]},{resume:["element"]},{complete:[]}]),rb=function(t,o,n,e,r,i){var u,a,c,s,f=t(o,e),l=(u=n,a=r,c=_t(!1),s=_t(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:nt(u),setSource:a.set,getSource:a.get});return f.fold(function(){return i.logEventNoHandlers(o,e),ob.complete()},function(n){var e=n.descHandler();return Gi(e)(l),l.isStopped()?(i.logEventStopped(o,n.element(),e.purpose()),ob.stopped()):l.isCut()?(i.logEventCut(o,n.element(),e.purpose()),ob.complete()):ye(n.element()).fold(function(){return i.logNoParent(o,n.element(),e.purpose()),ob.complete()},function(t){return i.logEventResponse(o,n.element(),e.purpose()),ob.resume(t)})})},ib=function(n,e,o,t,r,i){return rb(n,e,o,t,r,i).fold(function(){return!0},function(t){return ib(n,e,o,t,r,i)},function(){return!1})},ub=function(t,n,e){var o,r,i=(o=n,r=_t(!1),{stop:function(){r.set(!0)},cut:tt,isStopped:r.get,isCut:nt(!1),event:nt(o),setSource:u("Cannot set source of a broadcasted event"),getSource:u("Cannot get source of a broadcasted event")});return F(t,function(t){var n=t.descHandler();Gi(n)(i)}),i.isStopped()},ab=function(t,n,e,o,r){var i=eb(e,o);return ib(t,n,e,o,i,r)},cb=te("element","descHandler"),sb=function(t,n){return{id:nt(t),descHandler:nt(n)}};function fb(){var i={};return{registerId:function(o,r,t){rt(t,function(t,n){var e=i[n]!==undefined?i[n]:{};e[r]=Wi(t,o),i[n]=e})},unregisterId:function(e){rt(i,function(t,n){t.hasOwnProperty(e)&&delete t[e]})},filterByType:function(t){return Et(i,t).map(function(t){return at(t,function(t,n){return sb(n,t)})}).getOr([])},find:function(t,n,e){var r=Ct(n)(i);return ri(e,function(t){return e=r,Ai(o=t).fold(function(){return et.none()},function(t){var n=Ct(t);return e.bind(n).map(function(t){return cb(o,t)})});var e,o},t)}}}function lb(){var o=fb(),r={},i=function(o){var t=o.element();return Ai(t).fold(function(){return t="uid-",n=o.element(),e=io(Ei+t),Bi(n,e),e;var t,n,e},function(t){return t})},u=function(t){Ai(t.element()).each(function(t){delete r[t],o.unregisterId(t)})};return{find:function(t,n,e){return o.find(t,n,e)},filter:function(t){return o.filterByType(t)},register:function(t){var n=i(t);Dt(r,n)&&function(t,n){var e=r[n];if(e!==t)throw new Error('The tagId "'+n+'" is already used by: '+qe(e.element())+"\nCannot use it for: "+qe(t.element())+"\nThe conflicting element is"+(Zr(e.element())?" ":" not ")+"already in the DOM");u(t)}(t,n);var e=[t];o.registerId(e,n,t.events()),r[n]=t},unregister:u,getById:function(t){return Ct(t)(r)}}}var db,mb,gb=dl({name:"Container",factory:function(t){var n=t.dom,e=n.attributes,o=co(n,["attributes"]);return{uid:t.uid,dom:ao({tag:"div",attributes:ao({role:"presentation"},e)},o),components:t.components,behaviours:rf(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},configFields:[Mr("components",[]),of("containerBehaviours",[]),Mr("events",{}),Mr("domModification",{}),Mr("eventOrder",{})]}),pb=function(e){var o=function(n){return ye(e.element()).fold(function(){return!0},function(t){return he(n,t)})},r=lb(),s=function(t,n){return r.find(o,t,n)},t=nb(e.element(),{triggerEvent:function(u,a){return to(u,a.target(),function(t){return n=s,e=u,r=t,i=(o=a).target(),ab(n,e,o,i,r);var n,e,o,r,i})}}),i={debugInfo:nt("real"),triggerEvent:function(n,e,o){to(n,e,function(t){ab(s,n,o,e,t)})},triggerFocus:function(a,c){Ai(a).fold(function(){jl(a)},function(t){to(An(),a,function(t){var n,e,o,r,i,u;n=s,e=An(),o={originator:nt(c),kill:tt,prevent:tt,target:nt(a)},i=t,u=eb(o,r=a),rb(n,e,o,r,u,i)})})},triggerEscape:function(t,n){i.triggerEvent("keydown",t.element(),n.event())},getByUid:function(t){return g(t)},getByDom:function(t){return p(t)},build:_u,addToGui:function(t){a(t)},removeFromGui:function(t){c(t)},addToWorld:function(t){n(t)},removeFromWorld:function(t){u(t)},broadcast:function(t){l(t)},broadcastOn:function(t,n){d(t,n)},broadcastEvent:function(t,n){m(t,n)},isConnected:nt(!0)},n=function(t){t.connect(i),He(t.element())||(r.register(t),F(t.components(),n),i.triggerEvent(zn(),t.element(),{target:nt(t.element())}))},u=function(t){He(t.element())||(F(t.components(),u),r.unregister(t)),t.disconnect()},a=function(t){Vs(e,t)},c=function(t){Ns(t)},f=function(e){var t=r.filter(Mn());F(t,function(t){var n=t.descHandler();Gi(n)(e)})},l=function(t){f({universal:nt(!0),data:nt(t)})},d=function(t,n){f({universal:nt(!1),channels:nt(t),data:nt(n)})},m=function(t,n){var e=r.filter(t);return ub(e,n)},g=function(t){return r.getById(t).fold(function(){return vt.error(new Error('Could not find component with uid: "'+t+'" in system.'))},vt.value)},p=function(t){var n=Ai(t).getOr("not found");return g(n)};return n(e),{root:nt(e),element:e.element,destroy:function(){t.unbind(),Ae(e.element())},add:a,remove:c,getByUid:g,getByDom:p,addToWorld:n,removeFromWorld:u,broadcast:l,broadcastOn:d,broadcastEvent:m}},hb=tinymce.util.Tools.resolve("tinymce.EditorManager"),vb=function(t){return et.from(t.settings.min_width).filter(_)},bb=function(t){return et.from(t.settings.min_height).filter(_)},yb=function(n){var t=Q(n.settings),e=R(t,function(t){return/^toolbar([1-9])$/.test(t)}),o=M(e,function(t){return n.getParam(t,!1,"string")}),r=R(o,function(t){return"string"==typeof t});return 0<r.length?et.some(r):et.none()};(mb=db||(db={}))["default"]="",mb.floating="floating",mb.sliding="sliding";var xb,wb,Sb=function(t){return t.getParam("toolbar_drawer","","string")},kb=function(t){var n=t.getParam("fixed_toolbar_container","","string"),e=t.getParam("inline",!1,"boolean");return 0<n.length&&e?Vu(Qr(),n):et.none()},Cb=function(t){return t.getParam("inline",!1,"boolean")&&kb(t).isSome()},Ob=io("form-component-change"),Eb=io("form-close"),Tb=io("form-cancel"),Bb=io("form-action"),Ab=io("form-submit"),Db=io("form-block"),_b=io("form-unblock"),Mb=io("form-tabchange"),Fb=io("form-resize"),Ib=nt([Mr("prefix","form-field"),of("fieldBehaviours",[vl,Lm])]),Vb=nt([Hf({schema:[br("dom")],name:"label"}),Hf({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[br("text")],name:"aria-descriptor"}),Vf({factory:{sketch:function(t){var n=kt(t,["factory"]);return t.factory.sketch(n)}},schema:[br("factory")],name:"field"})]),Rb=ml({name:"FormField",configFields:Ib(),partFields:Vb(),factory:function(r,t,n,e){var o=uf(r.fieldBehaviours,[vl.config({find:function(t){return Kf(t,r,"field")}}),Lm.config({store:{mode:"manual",getValue:function(t){return vl.getCurrent(t).bind(Lm.getValue)},setValue:function(t,n){vl.getCurrent(t).each(function(t){Lm.setValue(t,n)})}}})]),i=ii([bi(function(t,n){var o=Jf(t,r,["label","field","aria-descriptor"]);o.field().each(function(e){var n=io(r.prefix);o.label().each(function(t){ze(t.element(),"for",n),ze(e.element(),"id",n)}),o["aria-descriptor"]().each(function(t){var n=io(r.prefix);ze(t.element(),"id",n),ze(e.element(),"aria-describedby",n)})})})]),u={getField:function(t){return Kf(t,r,"field")},getLabel:function(t){return Kf(t,r,"label")}};return{uid:r.uid,dom:r.dom,components:t,behaviours:o,events:i,apis:u}},apis:{getField:function(t,n){return t.getField(n)},getLabel:function(t,n){return t.getLabel(n)}}}),Hb=/* */Object.freeze({getCoupled:function(t,n,e,o){return e.getOrCreate(t,n,o)}}),Nb=[yr("others",rr(vt.value,lr()))],Pb=aa({fields:Nb,name:"coupling",apis:Hb,state:/* */Object.freeze({init:function(t){var i={},n=nt({});return Li({readState:n,getOrCreate:function(e,o,r){var t=Q(o.others);if(t)return Et(i,r).getOrThunk(function(){var t=Et(o.others,r).getOrDie("No information found for coupled component: "+r)(e),n=e.getSystem().build(t);return i[r]=n});throw new Error("Cannot find coupled component: "+r+". Known coupled components: "+Ro(t,null,2))}})}})}),zb=/* */Object.freeze({events:function(t,n){var e=t.stream.streams.setup(t,n);return ii([si(t.event,e),yi(function(){return n.cancel()})].concat(t.cancelEvent.map(function(t){return[si(t,function(){return n.cancel()})]}).getOr([])))}}),Lb=function(t){var n=_t(null);return Li({readState:function(){return{timer:null!==n.get()?"set":"unset"}},setTimer:function(t){n.set(t)},cancel:function(){var t=n.get();null!==t&&t.cancel()}})},jb=/* */Object.freeze({throttle:Lb,init:function(t){return t.stream.streams.state(t)}}),Ub=[yr("stream",fr("mode",{throttle:[br("delay"),Mr("stopEvent",!0),Ju("streams",{setup:function(t,n){var e=t.stream,o=Ng(t.onStream,e.delay);return n.setTimer(o),function(t,n){o.throttle(t,n),e.stopEvent&&n.stop()}},state:Lb})]})),Mr("event","input"),Er("cancelEvent"),Ku("onStream")],Wb=aa({fields:Ub,name:"streaming",active:zb,state:jb}),Gb=function(t){var e=et.none(),n=[],o=function(t){r()?u(t):n.push(t)},r=function(){return e.isSome()},i=function(t){F(t,u)},u=function(n){e.each(function(t){x.setTimeout(function(){n(t)},0)})};return t(function(t){e=et.some(t),i(n),n=[]}),{get:o,map:function(e){return Gb(function(n){o(function(t){n(e(t))})})},isReady:r}},Xb={nu:Gb,pure:function(n){return Gb(function(t){t(n)})}},Yb=function(n){var t=function(t){var o;n((o=t,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=this;x.setTimeout(function(){o.apply(e,t)},0)}))},e=function(){return Xb.nu(t)};return{map:function(o){return Yb(function(e){t(function(t){var n=o(t);e(n)})})},bind:function(e){return Yb(function(n){t(function(t){e(t).get(n)})})},anonBind:function(e){return Yb(function(n){t(function(t){e.get(n)})})},toLazy:e,toCached:function(){var n=null;return Yb(function(t){null===n&&(n=e()),n.get(t)})},get:t}},qb={nu:Yb,pure:function(n){return Yb(function(t){t(n)})}},Kb=nt("sink"),$b=nt(Hf({name:Kb(),overrides:nt({dom:{tag:"div"},behaviours:ia([Ms.config({useFixed:!0})]),events:ii([pi(Yt()),pi(zt()),pi(Jt())])})}));(wb=xb||(xb={}))[wb.HighlightFirst=0]="HighlightFirst",wb[wb.HighlightNone=1]="HighlightNone";var Jb=function(t,n){var e=t.getHotspot(n).getOr(n),o=t.getAnchorOverrides();return t.layouts.fold(function(){return{anchor:"hotspot",hotspot:e,overrides:o}},function(t){return{anchor:"hotspot",hotspot:e,overrides:o,layouts:t}})},Zb=function(t,n,e,o,r,i,u){var a,c,s,f,l,d,m,g,p,h,v=Jb(t,e);return(c=v,f=o,l=r,d=u,m=n,g=s=e,p=(0,(a=t).fetch)(g).map(m),h=ey(s,a),p.map(function(t){return t.bind(function(t){return et.from(Og.sketch(ao({},l.menu(),{uid:Di(""),data:t,highlightImmediately:d===xb.HighlightFirst,onOpenMenu:function(t,n){var e=h().getOrDie();Ms.position(e,c,n),Js.decloak(f)},onOpenSubmenu:function(t,n,e){var o=h().getOrDie();Ms.position(o,{anchor:"submenu",item:n},e),Js.decloak(f)},onEscape:function(){return Xm.focus(s),Js.close(f),et.some(!0)}})))})})).map(function(t){return t.fold(function(){Js.isOpen(o)&&Js.close(o)},function(t){Js.cloak(o),Js.open(o,t),i(o)}),o})},Qb=function(t,n,e,o,r,i,u){return Js.close(o),qb.pure(o)},ty=function(t,n,e,o,r,i){var u=Pb.getCoupled(e,"sandbox");return(Js.isOpen(u)?Qb:Zb)(t,n,e,u,o,r,i)},ny=function(t,n,e){var o,r,i=vl.getCurrent(n).getOr(n),u=ka(t.element());e?lu(i.element(),"min-width",u+"px"):(o=i.element(),r=u,Sa.set(o,r))},ey=function(n,t){return n.getSystem().getByUid(t.uid+"-"+Kb()).map(function(t){return function(){return vt.value(t)}}).getOrThunk(function(){return t.lazySink.fold(function(){return function(){return vt.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(t){return function(){return t(n)}})})},oy=function(o,r,i){var u=Hu(),t=ey(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id(),role:"listbox"}},behaviours:af.augment(o.sandboxBehaviours,[Lm.config({store:{mode:"memory",initialValue:r}}),Js.config({onOpen:function(t,n){var e=Jb(o,r);u.link(r.element()),o.matchWidth&&ny(e.hotspot,n,o.useMinWidth),o.onOpen(e,t,n),i!==undefined&&i.onOpen!==undefined&&i.onOpen(t,n)},onClose:function(t,n){u.unlink(r.element()),i!==undefined&&i.onClose!==undefined&&i.onClose(t,n)},isPartOf:function(t,n,e){return Pu(n,e)||Pu(r,e)},getAttachPoint:function(){return t().getOrDie()}}),vl.config({find:function(t){return Js.getState(t).bind(function(t){return vl.getCurrent(t)})}}),nf({isExtraPart:nt(!1)})])}},ry=function(t,n,e){var o=Lm.getValue(e);Lm.setValue(n,o),uy(n)},iy=function(t,n){var e=t.element(),o=xu(e),r=e.dom();"number"!==je(e,"type")&&n(r,o)},uy=function(t){iy(t,function(t,n){return t.setSelectionRange(n.length,n.length)})},ay=function(t,n,o){if(t.selectsOver){var e=Lm.getValue(n),r=t.getDisplayText(e),i=Lm.getValue(o);return 0===t.getDisplayText(i).indexOf(r)?et.some(function(){var t,e;ry(0,n,o),t=n,e=r.length,iy(t,function(t,n){return t.setSelectionRange(e,n.length)})}):et.none()}return et.none()},cy=nt([Er("data"),Mr("inputAttributes",{}),Mr("inputStyles",{}),Mr("tag","input"),Mr("inputClasses",[]),Yu("onSetValue"),Mr("styles",{}),Mr("eventOrder",{}),of("inputBehaviours",[Lm,Xm]),Mr("selectOnFocus",!0)]),sy=function(t){return ia([Xm.config({onFocus:!1===t.selectOnFocus?tt:function(t){var n=t.element(),e=xu(n);n.dom().setSelectionRange(0,e.length)}})])},fy=function(t){return{tag:t.tag,attributes:ao({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},ly=nt("alloy.typeahead.itemexecute"),dy=function(){return[Mr("sandboxClasses",[]),af.field("sandboxBehaviours",[vl,ma,Js,Lm])]},my=nt([Er("lazySink"),br("fetch"),Mr("minChars",5),Mr("responseTime",1e3),Yu("onOpen"),Mr("getHotspot",et.some),Mr("getAnchorOverrides",nt({})),Mr("layouts",et.none()),Mr("eventOrder",{}),Pr("model",{},[Mr("getDisplayText",function(t){return t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.value}),Mr("selectsOver",!0),Mr("populateFromBrowse",!0)]),Yu("onSetValue"),qu("onExecute"),Yu("onItemExecute"),Mr("inputClasses",[]),Mr("inputAttributes",{}),Mr("inputStyles",{}),Mr("matchWidth",!0),Mr("useMinWidth",!1),Mr("dismissOnBlur",!0),Gu(["openClass"]),Er("initialData"),of("typeaheadBehaviours",[Xm,Lm,Wb,km,rg,Pb]),zr("previewing",function(){return _t(!0)})].concat(cy()).concat(dy())),gy=nt([Rf({schema:[Wu()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(n,e){o.previewing.get()?n.getSystem().getByUid(o.uid).each(function(t){ay(o.model,t,e).fold(function(){return Dl.dehighlight(n,e)},function(t){return t()})}):n.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&ry(o.model,t,e)}),o.previewing.set(!1)},onExecute:function(t,n){return t.getSystem().getByUid(o.uid).toOption().map(function(t){return Gr(t,ly(),{item:n}),!0})},onHover:function(t,n){o.previewing.set(!1),t.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&ry(o.model,t,n)})}}}})]),py=ml({name:"Typeahead",configFields:my(),partFields:gy(),factory:function(r,t,n,i){var e=function(t,n,e){r.previewing.set(!1);var o=Pb.getCoupled(t,"sandbox");Js.isOpen(o)?vl.getCurrent(o).each(function(t){Dl.getHighlighted(t).fold(function(){e(t)},function(){Kr(o,t.element(),"keydown",n)})}):Zb(r,u(t),t,o,i,function(t){vl.getCurrent(t).each(e)},xb.HighlightFirst).get(tt)},o=sy(r),u=function(o){return function(t){return t.map(function(t){var n=st(t.menus),e=W(n,function(t){return R(t.items,function(t){return"item"===t.type})});return Lm.getState(o).update(M(e,function(t){return t.data})),t})}},a=[Xm.config({}),Lm.config({onSetValue:r.onSetValue,store:ao({mode:"dataset",getDataKey:function(t){return xu(t.element())},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(t,n){wu(t.element(),r.model.getDisplayText(n))}},r.initialData.map(function(t){return Tt("initialValue",t)}).getOr({}))}),Wb.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(t,n){var e=Pb.getCoupled(t,"sandbox");if(Xm.isFocused(t)&&xu(t.element()).length>=r.minChars){var o=vl.getCurrent(e).bind(function(t){return Dl.getHighlighted(t).map(Lm.getValue)});r.previewing.set(!0),Zb(r,u(t),t,e,i,function(t){vl.getCurrent(e).each(function(t){o.fold(function(){r.model.selectsOver&&Dl.highlightFirst(t)},function(n){Dl.highlightBy(t,function(t){return Lm.getValue(t).value===n.value}),Dl.getHighlighted(t).orThunk(function(){return Dl.highlightFirst(t),et.none()})})})},xb.HighlightFirst).get(tt)}},cancelEvent:Pn()}),km.config({mode:"special",onDown:function(t,n){return e(t,n,Dl.highlightFirst),et.some(!0)},onEscape:function(t){var n=Pb.getCoupled(t,"sandbox");return Js.isOpen(n)?(Js.close(n),et.some(!0)):et.none()},onUp:function(t,n){return e(t,n,Dl.highlightLast),et.some(!0)},onEnter:function(n){var t=Pb.getCoupled(n,"sandbox"),e=Js.isOpen(t);if(e&&!r.previewing.get())return vl.getCurrent(t).bind(function(t){return Dl.getHighlighted(t)}).map(function(t){return Gr(n,ly(),{item:t}),!0});var o=Lm.getValue(n);return Wr(n,Pn()),r.onExecute(t,n,o),e&&Js.close(t),et.some(!0)}}),rg.config({toggleClass:r.markers.openClass,aria:{mode:"expanded"}}),Pb.config({others:{sandbox:function(t){return oy(r,t,{onOpen:function(){return rg.on(t)},onClose:function(){return rg.off(t)}})}}}),lg("typeaheadevents",[wi(function(t){var n=tt;ty(r,u(t),t,i,n,xb.HighlightFirst).get(tt)}),si(ly(),function(t,n){var e=Pb.getCoupled(t,"sandbox");ry(r.model,t,n.event().item()),Wr(t,Pn()),r.onItemExecute(t,e,n.event().item(),Lm.getValue(t)),Js.close(e),uy(t)})].concat(r.dismissOnBlur?[si(Dn(),function(t){var n=Pb.getCoupled(t,"sandbox");Wl(n.element()).isNone()&&Js.close(n)})]:[]))];return{uid:r.uid,dom:fy(wt(r,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:ao({},o,uf(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),hy=function(t,n,e){var o=by(t,n,e);return Rb.sketch(o)},vy=function(t,n){return hy(t,n,[])},by=function(t,n,e){return{dom:yy(e),components:t.toArray().concat([n])}},yy=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},xy=function(t,n){return Rb.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},wy=function(t){return"separator"===t.type},Sy={type:"separator"},ky=function(t,e){var n=U(t,function(t,n){return S(n)?""===n?t:"|"===n?0<t.length&&!wy(t[t.length-1])?t.concat([Sy]):t:lt(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])},[]);return 0<n.length&&wy(n[n.length-1])&&n.pop(),n},Cy=function(t,n){return lt(t,"getSubmenuItems")?(o=n,r=(e=t).getSubmenuItems(),i=Oy(r,o),{item:e,menus:wt(i.menus,Tt(e.value,i.items)),expansions:wt(i.expansions,Tt(e.value,e.value))}):{item:t,menus:{},expansions:{}};var e,o,r,i},Oy=function(t,r){var n=ky(S(t)?t.split(" "):t,r);return H(n,function(t,n){var e=function(t){if(wy(t))return t;var n=Et(t,"value").getOrThunk(function(){return io("generated-menu-item")});return wt({value:n},t)}(n),o=Cy(e,r);return{menus:wt(t.menus,o.menus),items:[o.item].concat(t.items),expansions:wt(t.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},Ey=function(t,e,o){var n=io("primary-menu"),r=Oy(t,o.shared.providers.menuItems());if(0===r.items.length)return et.none();var i=zv(n,r.items,e,o),u=it(r.menus,function(t,n){return zv(n,t,e,o)}),a=wt(u,Tt(n,i));return et.from(Og.tieredData(n,a,r.expansions))},Ty=dl({name:"Input",configFields:cy(),factory:function(t,n){return{uid:t.uid,dom:fy(t),components:[],behaviours:(e=t,ao({},sy(e),uf(e.inputBehaviours,[Lm.config({store:{mode:"manual",initialValue:e.data.getOr(undefined),getValue:function(t){return xu(t.element())},setValue:function(t,n){xu(t.element())!==n&&wu(t.element(),n)}},onSetValue:e.onSetValue})]))),eventOrder:t.eventOrder};var e}}),By=["input","textarea"],Ay=function(t){var n=Fe(t);return T(By,n)},Dy=function(t,n){var e=n.getRoot(t).getOr(t.element());ru(e,n.invalidClass),n.notify.each(function(n){Ay(t.element())&&ze(t.element(),"aria-invalid",!1),n.getContainer(t).each(function(t){Me(t,n.validHtml)}),n.onValid(t)})},_y=function(n,t,e,o){var r=t.getRoot(n).getOr(n.element());ou(r,t.invalidClass),t.notify.each(function(t){Ay(n.element())&&ze(n.element(),"aria-invalid",!0),t.getContainer(n).each(function(t){Me(t,o)}),t.onInvalid(n,o)})},My=function(n,t,e){return t.validator.fold(function(){return qb.pure(vt.value(!0))},function(t){return t.validate(n)})},Fy=function(n,e,t){return e.notify.each(function(t){t.onValidate(n)}),My(n,e).map(function(t){return n.getSystem().isConnected()?t.fold(function(t){return _y(n,e,0,t),vt.error(t)},function(t){return Dy(n,e),vt.value(t)}):vt.error("No longer in system")})},Iy=/* */Object.freeze({markValid:Dy,markInvalid:_y,query:My,run:Fy,isInvalid:function(t,n){var e=n.getRoot(t).getOr(t.element());return iu(e,n.invalidClass)}}),Vy=/* */Object.freeze({events:function(n,t){return n.validator.map(function(t){return ii([si(t.onEvent,function(t){Fy(t,n).get(d)})].concat(t.validateOnLoad?[bi(function(t){Fy(t,n).get(tt)})]:[]))}).getOr({})}}),Ry=[br("invalidClass"),Mr("getRoot",et.none),_r("notify",[Mr("aria","alert"),Mr("getContainer",et.none),Mr("validHtml",""),Yu("onValid"),Yu("onInvalid"),Yu("onValidate")]),_r("validator",[br("validate"),Mr("onEvent","input"),Mr("validateOnLoad",!0)])],Hy=aa({fields:Ry,name:"invalidating",active:Vy,apis:Iy,extra:{validation:function(e){return function(t){var n=Lm.getValue(t);return qb.pure(e(n))}}}}),Ny=/* */Object.freeze({exhibit:function(t,n){return Ui({attributes:Bt([{key:n.tabAttr,value:"true"}])})}}),Py=[Mr("tabAttr","data-alloy-tabstop")],zy=aa({fields:Py,name:"tabstopping",active:Ny}),Ly=nt([br("dom"),br("fetch"),Yu("onOpen"),qu("onExecute"),Mr("getHotspot",et.some),Mr("getAnchorOverrides",nt({})),Mr("layouts",et.none()),of("dropdownBehaviours",[rg,Pb,km,Xm]),br("toggleClass"),Mr("eventOrder",{}),Er("lazySink"),Mr("matchWidth",!1),Mr("useMinWidth",!1),Er("role")].concat(dy())),jy=nt([Rf({schema:[Wu()],name:"menu",defaults:function(t){return{onExecute:t.onExecute}}}),$b()]),Uy=ml({name:"Dropdown",configFields:Ly(),partFields:jy(),factory:function(n,t,e,o){var r,i,u=function(t){Js.getState(t).each(function(t){Og.highlightPrimary(t)})},a={expand:function(t){rg.isOn(t)||ty(n,function(t){return t},t,o,tt,xb.HighlightNone).get(tt)},open:function(t){rg.isOn(t)||ty(n,function(t){return t},t,o,tt,xb.HighlightFirst).get(tt)},isOpen:rg.isOn,close:function(t){rg.isOn(t)&&ty(n,function(t){return t},t,o,tt,xb.HighlightFirst).get(tt)}},c=function(t,n){return Xr(t),et.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:uf(n.dropdownBehaviours,[rg.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),Pb.config({others:{sandbox:function(t){return oy(n,t,{onOpen:function(){rg.on(t)},onClose:function(){rg.off(t)}})}}}),km.config({mode:"special",onSpace:c,onEnter:c,onDown:function(t,n){if(Uy.isOpen(t)){var e=Pb.getCoupled(t,"sandbox");u(e)}else Uy.open(t);return et.some(!0)},onEscape:function(t,n){return Uy.isOpen(t)?(Uy.close(t),et.some(!0)):et.none()}}),Xm.config({})]),events:Tg(et.some(function(t){ty(n,function(t){return t},t,o,u,xb.HighlightFirst).get(tt)})),eventOrder:ao({},n.eventOrder,(r={},r[Fn()]=["disabling","toggling","alloy.base.behaviour"],r)),apis:a,domModification:{attributes:ao({"aria-haspopup":"true"},n.role.fold(function(){return{}},function(t){return{role:t}}),"button"===n.dom.tag?{type:(i="type",Et(n.dom,"attributes").bind(function(t){return Et(t,i)})).getOr("button")}:{})}}},apis:{open:function(t,n){return t.open(n)},expand:function(t,n){return t.expand(n)},close:function(t,n){return t.close(n)},isOpen:function(t,n){return t.isOpen(n)}}}),Wy=aa({fields:[],name:"unselecting",active:/* */Object.freeze({events:function(t){return ii([ui(Qt(),nt(!0))])},exhibit:function(t,n){return Ui({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),Gy=io("color-input-change"),Xy=io("color-swatch-change"),Yy=io("color-picker-cancel"),qy=function(t,n,o){var e,r,i=Rb.parts().field({factory:Ty,inputClasses:["tox-textfield"],onSetValue:function(t){return Hy.run(t).get(function(){})},inputBehaviours:ia([zy.config({}),Hy.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(t){return ye(t.element())},notify:{onValid:function(t){var n=Lm.getValue(t);Gr(t,Gy,{color:n})}},validator:{validateOnLoad:!1,validate:function(t){var n=Lm.getValue(t);if(0===n.length)return qb.pure(vt.value(!0));var e=Qn.fromTag("span");lu(e,"background-color",n);var o=hu(e,"background-color").fold(function(){return vt.error("blah")},function(t){return vt.value(n)});return qb.pure(o)}}})]),selectOnFocus:!1}),u=t.label.map(function(t){return xy(t,n.providers)}),a=function(t,n){Gr(t,Xy,{value:n})},c=Ag((e={dom:{tag:"span",attributes:{"aria-label":n.providers.translate("Color swatch")}},layouts:et.some({onRtl:function(){return[yc]},onLtr:function(){return[xc]}}),components:[],fetch:hv.getFetch(o.getColors(),o.hasCustomColors()),columns:o.getColorCols(),presets:"color",onItemAction:function(t,e){c.getOpt(t).each(function(n){"custom"===e?o.colorPicker(function(t){t.fold(function(){return Wr(n,Yy)},function(t){a(n,t),nv(t)})},"#ffffff"):a(n,"remove"===e?"":e)})}},r=n,Uy.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:ia([Wy.config({}),zy.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:r.getSink,fetch:function(n){return qb.nu(function(t){return e.fetch(t)}).map(function(t){return et.from(Lv(wt(Ev(io("menu-value"),t,function(t){e.onItemAction(n,t)},e.columns,e.presets,gh.CLOSE_ON_EXECUTE,function(){return!1},r.providers),{movement:Bv(e.columns,e.presets)})))})},parts:{menu:Sv(0,0,e.presets)}})));return Rb.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:u.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[i,c.asSpec()]}]),fieldBehaviours:ia([lg("form-field-events",[si(Gy,function(t,n){c.getOpt(t).each(function(t){lu(t.element(),"background-color",n.event().color())})}),si(Xy,function(n,e){Rb.getField(n).each(function(t){Lm.setValue(t,e.event().value()),vl.getCurrent(n).each(Xm.focus)})}),si(Yy,function(n,t){Rb.getField(n).each(function(t){vl.getCurrent(n).each(Xm.focus)})})])])})},Ky=function(t,n,e){return{hue:nt(t),saturation:nt(n),value:nt(e)}},$y=nt(io("rgb-hex-update")),Jy=nt(io("slider-update")),Zy=nt(io("palette-update")),Qy=Tn.detect().deviceType.isTouch(),tx=Hf({schema:[br("dom")],name:"label"}),nx=function(t){return Hf({name:t+"-edge",overrides:function(o){return o.model.manager.edgeActions[t].fold(function(){return{}},function(e){var t=ii([fi(Ht(),e,[o])]),n=ii([fi(zt(),e,[o]),fi(Lt(),function(t,n){n.mouseIsDown.get()&&e(t,n)},[o])]);return{events:Qy?t:n}})}})},ex=nx("top-left"),ox=nx("top"),rx=nx("top-right"),ix=nx("right"),ux=nx("bottom-right"),ax=nx("bottom"),cx=nx("bottom-left"),sx=[tx,nx("left"),ix,ox,ax,ex,rx,cx,ux,Vf({name:"thumb",defaults:nt({dom:{styles:{position:"absolute"}}}),overrides:function(t){return{events:ii([mi(Ht(),t,"spectrum"),mi(Nt(),t,"spectrum"),mi(Pt(),t,"spectrum"),mi(zt(),t,"spectrum"),mi(Lt(),t,"spectrum"),mi(Ut(),t,"spectrum")])}}}),Vf({schema:[zr("mouseIsDown",function(){return _t(!1)})],name:"spectrum",overrides:function(e){var o=e.model.manager,r=function(n,t){return o.getValueFromEvent(t).map(function(t){return o.setValueFrom(n,e,t)})},t=ii([si(Ht(),r),si(Nt(),r)]),n=ii([si(zt(),r),si(Lt(),function(t,n){e.mouseIsDown.get()&&r(t,n)})]);return{behaviours:ia(Qy?[]:[km.config({mode:"special",onLeft:function(t){return o.onLeft(t,e)},onRight:function(t){return o.onRight(t,e)},onUp:function(t){return o.onUp(t,e)},onDown:function(t){return o.onDown(t,e)}}),Xm.config({})]),events:Qy?t:n}}})],fx=Tn.detect().deviceType.isTouch(),lx=nt("slider.change.value"),dx=function(t){var n=t.event().raw();if(fx){var e=n;return e.touches!==undefined&&1===e.touches.length?et.some(e.touches[0]).map(function(t){return ha(t.clientX,t.clientY)}):et.none()}var o=n;return o.clientX!==undefined?et.some(o).map(function(t){return ha(t.clientX,t.clientY)}):et.none()},mx=function(t,n,e,o){return t<n?t:e<t?e:t===n?n-1:Math.max(n,t-o)},gx=function(t,n,e,o){return e<t?t:t<n?n:t===e?e+1:Math.min(e,t+o)},px=function(t,n,e){return Math.max(n,Math.min(e,t))},hx=function(t){var n=t.min,e=t.max,o=t.range,r=t.value,i=t.step,u=t.snap,a=t.snapStart,c=t.rounded,s=t.hasMinEdge,f=t.hasMaxEdge,l=t.minBound,d=t.maxBound,m=t.screenRange,g=s?n-1:n,p=f?e+1:e;if(r<l)return g;if(d<r)return p;var h,v,b,y,x,w,S,k=(x=r,w=l,S=d,Math.min(S,Math.max(x,w))-w),C=px(k/m*o+n,g,p);return u&&n<=C&&C<=e?(h=C,v=n,b=e,y=i,a.fold(function(){var t=h-v,n=Math.round(t/y)*y;return px(v+n,v-1,b+1)},function(t){var n=(h-t)%y,e=Math.round(n/y),o=Math.floor((h-t)/y),r=Math.floor((b-t)/y),i=t+Math.min(r,o+e)*y;return Math.max(t,i)})):c?Math.round(C):C},vx=function(t){var n=t.min,e=t.max,o=t.range,r=t.value,i=t.hasMinEdge,u=t.hasMaxEdge,a=t.maxBound,c=t.maxOffset,s=t.centerMinEdge,f=t.centerMaxEdge;return r<n?i?0:s:e<r?u?a:f:(r-n)/o*c},bx=function(t){return t.model.minX},yx=function(t){return t.model.minY},xx=function(t){return t.model.minX-1},wx=function(t){return t.model.minY-1},Sx=function(t){return t.model.maxX},kx=function(t){return t.model.maxY},Cx=function(t){return t.model.maxX+1},Ox=function(t){return t.model.maxY+1},Ex=function(t,n,e){return n(t)-e(t)},Tx=function(t){return Ex(t,Sx,bx)},Bx=function(t){return Ex(t,kx,yx)},Ax=function(t){return Tx(t)/2},Dx=function(t){return Bx(t)/2},_x=function(t){return t.stepSize},Mx=function(t){return t.snapToGrid},Fx=function(t){return t.snapStart},Ix=function(t){return t.rounded},Vx=function(t,n){return t[n+"-edge"]!==undefined},Rx=function(t){return Vx(t,"left")},Hx=function(t){return Vx(t,"right")},Nx=function(t){return Vx(t,"top")},Px=function(t){return Vx(t,"bottom")},zx=function(t){return t.model.value.get()},Lx=function(t){return{x:nt(t)}},jx=function(t){return{y:nt(t)}},Ux=function(t,n){return{x:nt(t),y:nt(n)}},Wx=function(t,n){Gr(t,lx(),{value:n})},Gx="left",Xx=function(t){return t.element().dom().getBoundingClientRect()},Yx=function(t,n){return t[n]},qx=function(t){var n=Xx(t);return Yx(n,Gx)},Kx=function(t){var n=Xx(t);return Yx(n,"right")},$x=function(t){var n=Xx(t);return Yx(n,"top")},Jx=function(t){var n=Xx(t);return Yx(n,"bottom")},Zx=function(t){var n=Xx(t);return Yx(n,"width")},Qx=function(t){var n=Xx(t);return Yx(n,"height")},tw=function(t,n,e){return(t+n)/2-e},nw=function(t,n){var e=Xx(t),o=Xx(n),r=Yx(e,Gx),i=Yx(e,"right"),u=Yx(o,Gx);return tw(r,i,u)},ew=function(t,n){var e=Xx(t),o=Xx(n),r=Yx(e,"top"),i=Yx(e,"bottom"),u=Yx(o,"top");return tw(r,i,u)},ow=function(t,n){Gr(t,lx(),{value:n})},rw=function(t){return{x:nt(t)}},iw=function(t,n,e){var o={min:bx(n),max:Sx(n),range:Tx(n),value:e,step:_x(n),snap:Mx(n),snapStart:Fx(n),rounded:Ix(n),hasMinEdge:Rx(n),hasMaxEdge:Hx(n),minBound:qx(t),maxBound:Kx(t),screenRange:Zx(t)};return hx(o)},uw=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?gx:mx)(zx(r).x(),bx(r),Sx(r),_x(r)),ow(o,rw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},aw=function(t,n,e,o,r,i){var u,a,c,s,f,l,d,m,g,p=(a=i,c=e,s=o,f=r,l=Zx(u=n),d=s.bind(function(t){return et.some(nw(t,u))}).getOr(0),m=f.bind(function(t){return et.some(nw(t,u))}).getOr(l),g={min:bx(a),max:Sx(a),range:Tx(a),value:c,hasMinEdge:Rx(a),hasMaxEdge:Hx(a),minBound:qx(u),minOffset:0,maxBound:Kx(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},vx(g));return qx(n)-qx(t)+p},cw=uw(-1),sw=uw(1),fw=et.none,lw=et.none,dw={"top-left":et.none(),top:et.none(),"top-right":et.none(),right:et.some(function(t,n){Wx(t,Lx(Cx(n)))}),"bottom-right":et.none(),bottom:et.none(),"bottom-left":et.none(),left:et.some(function(t,n){Wx(t,Lx(xx(n)))})},mw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=iw(t,n,e),r=rw(o);return ow(t,r),o},setToMin:function(t,n){var e=bx(n);ow(t,rw(e))},setToMax:function(t,n){var e=Sx(n);ow(t,rw(e))},findValueOfOffset:iw,getValueFromEvent:function(t){return dx(t).map(function(t){return t.left()})},findPositionOfValue:aw,setPositionFromValue:function(t,n,e,o){var r=zx(e),i=aw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=ka(n.element())/2;lu(n.element(),"left",i-u+"px")},onLeft:cw,onRight:sw,onUp:fw,onDown:lw,edgeActions:dw}),gw=function(t,n){Gr(t,lx(),{value:n})},pw=function(t){return{y:nt(t)}},hw=function(t,n,e){var o={min:yx(n),max:kx(n),range:Bx(n),value:e,step:_x(n),snap:Mx(n),snapStart:Fx(n),rounded:Ix(n),hasMinEdge:Nx(n),hasMaxEdge:Px(n),minBound:$x(t),maxBound:Jx(t),screenRange:Qx(t)};return hx(o)},vw=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?gx:mx)(zx(r).y(),yx(r),kx(r),_x(r)),gw(o,pw(i)),et.some(i)).map(function(){return!0});var e,o,r,i}},bw=function(t,n,e,o,r,i){var u,a,c,s,f,l,d,m,g,p=(a=i,c=e,s=o,f=r,l=Qx(u=n),d=s.bind(function(t){return et.some(ew(t,u))}).getOr(0),m=f.bind(function(t){return et.some(ew(t,u))}).getOr(l),g={min:yx(a),max:kx(a),range:Bx(a),value:c,hasMinEdge:Nx(a),hasMaxEdge:Px(a),minBound:$x(u),minOffset:0,maxBound:Jx(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},vx(g));return $x(n)-$x(t)+p},yw=et.none,xw=et.none,ww=vw(-1),Sw=vw(1),kw={"top-left":et.none(),top:et.some(function(t,n){Wx(t,jx(wx(n)))}),"top-right":et.none(),right:et.none(),"bottom-right":et.none(),bottom:et.some(function(t,n){Wx(t,jx(Ox(n)))}),"bottom-left":et.none(),left:et.none()},Cw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=hw(t,n,e),r=pw(o);return gw(t,r),o},setToMin:function(t,n){var e=yx(n);gw(t,pw(e))},setToMax:function(t,n){var e=kx(n);gw(t,pw(e))},findValueOfOffset:hw,getValueFromEvent:function(t){return dx(t).map(function(t){return t.top()})},findPositionOfValue:bw,setPositionFromValue:function(t,n,e,o){var r=zx(e),i=bw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),u=Ea(n.element())/2;lu(n.element(),"top",i-u+"px")},onLeft:yw,onRight:xw,onUp:ww,onDown:Sw,edgeActions:kw}),Ow=function(t,n){Gr(t,lx(),{value:n})},Ew=function(t,n){return{x:nt(t),y:nt(n)}},Tw=function(s,f){return function(t,n){return(e=s,o=f,r=t,i=n,u=0<e?gx:mx,a=o?zx(i).x():u(zx(i).x(),bx(i),Sx(i),_x(i)),c=o?u(zx(i).y(),yx(i),kx(i),_x(i)):zx(i).y(),Ow(r,Ew(a,c)),et.some(a)).map(function(){return!0});var e,o,r,i,u,a,c}},Bw=Tw(-1,!1),Aw=Tw(1,!1),Dw=Tw(-1,!0),_w=Tw(1,!0),Mw={"top-left":et.some(function(t,n){Wx(t,Ux(xx(n),wx(n)))}),top:et.some(function(t,n){Wx(t,Ux(Ax(n),wx(n)))}),"top-right":et.some(function(t,n){Wx(t,Ux(Cx(n),wx(n)))}),right:et.some(function(t,n){Wx(t,Ux(Cx(n),Dx(n)))}),"bottom-right":et.some(function(t,n){Wx(t,Ux(Cx(n),Ox(n)))}),bottom:et.some(function(t,n){Wx(t,Ux(Ax(n),Ox(n)))}),"bottom-left":et.some(function(t,n){Wx(t,Ux(xx(n),Ox(n)))}),left:et.some(function(t,n){Wx(t,Ux(xx(n),Dx(n)))})},Fw=/* */Object.freeze({setValueFrom:function(t,n,e){var o=iw(t,n,e.left()),r=hw(t,n,e.top()),i=Ew(o,r);return Ow(t,i),i},setToMin:function(t,n){var e=bx(n),o=yx(n);Ow(t,Ew(e,o))},setToMax:function(t,n){var e=Sx(n),o=kx(n);Ow(t,Ew(e,o))},getValueFromEvent:function(t){return dx(t)},setPositionFromValue:function(t,n,e,o){var r=zx(e),i=aw(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=bw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),a=ka(n.element())/2,c=Ea(n.element())/2;lu(n.element(),"left",i-a+"px"),lu(n.element(),"top",u-c+"px")},onLeft:Bw,onRight:Aw,onUp:Dw,onDown:_w,edgeActions:Mw}),Iw=Tn.detect().deviceType.isTouch(),Vw=[Mr("stepSize",1),Mr("onChange",tt),Mr("onChoose",tt),Mr("onInit",tt),Mr("onDragStart",tt),Mr("onDragEnd",tt),Mr("snapToGrid",!1),Mr("rounded",!0),Er("snapStart"),yr("model",fr("mode",{x:[Mr("minX",0),Mr("maxX",100),zr("value",function(t){return _t(t.mode.minX)}),br("getInitialValue"),Ju("manager",mw)],y:[Mr("minY",0),Mr("maxY",100),zr("value",function(t){return _t(t.mode.minY)}),br("getInitialValue"),Ju("manager",Cw)],xy:[Mr("minX",0),Mr("maxX",100),Mr("minY",0),Mr("maxY",100),zr("value",function(t){return _t({x:nt(t.mode.minX),y:nt(t.mode.minY)})}),br("getInitialValue"),Ju("manager",Fw)]})),of("sliderBehaviours",[km,Lm])].concat(Iw?[]:[zr("mouseIsDown",function(){return _t(!1)})]),Rw=Tn.detect().deviceType.isTouch(),Hw=ml({name:"Slider",configFields:Vw,partFields:sx,factory:function(i,t,n,e){var u=function(t){return $f(t,i,"thumb")},a=function(t){return $f(t,i,"spectrum")},o=function(t){return Kf(t,i,"left-edge")},r=function(t){return Kf(t,i,"right-edge")},c=function(t){return Kf(t,i,"top-edge")},s=function(t){return Kf(t,i,"bottom-edge")},f=i.model,l=f.manager,d=function(t,n){l.setPositionFromValue(t,n,i,{getLeftEdge:o,getRightEdge:r,getTopEdge:c,getBottomEdge:s,getSpectrum:a})},m=function(t,n){f.value.set(n);var e=u(t);return d(t,e),i.onChange(t,e,n),et.some(!0)},g=[si(Ht(),function(t,n){i.onDragStart(t,u(t))}),si(Pt(),function(t,n){i.onDragEnd(t,u(t))})],p=[si(zt(),function(t,n){n.stop(),i.onDragStart(t,u(t)),i.mouseIsDown.set(!0)}),si(Ut(),function(t,n){i.onDragEnd(t,u(t))})],h=Rw?g:p;return{uid:i.uid,dom:i.dom,components:t,behaviours:uf(i.sliderBehaviours,j([Rw?[]:[km.config({mode:"special",focusIn:function(t){return Kf(t,i,"spectrum").map(km.focusIn).map(nt(!0))}})],[Lm.config({store:{mode:"manual",getValue:function(t){return f.value.get()}}}),ma.config({channels:{"mouse.released":{onReceive:function(e,t){var n=i.mouseIsDown.get();i.mouseIsDown.set(!1),n&&Kf(e,i,"thumb").each(function(t){var n=f.value.get();i.onChoose(e,t,n)})}}}})]])),events:ii([si(lx(),function(t,n){m(t,n.event().value())}),bi(function(t,n){var e=f.getInitialValue();f.value.set(e);var o=u(t);d(t,o);var r=a(t);i.onInit(t,o,r,f.value.get())})].concat(h)),apis:{resetToMin:function(t){l.setToMin(t,i)},resetToMax:function(t){l.setToMax(t,i)},changeValue:m,refresh:d},domModification:{styles:{position:"relative"}}}},apis:{resetToMin:function(t,n){t.resetToMin(n)},resetToMax:function(t,n){t.resetToMax(n)},refresh:function(t,n){t.refresh(n)}}}),Nw=function(t,n){var e=Hw.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=Hw.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}});return Hw.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:nt({y:nt(0)})},components:[e,o],sliderBehaviours:ia([Xm.config({})]),onChange:function(t,n,e){Gr(t,Jy(),{value:e})}})},Pw=[of("formBehaviours",[Lm])],zw=function(t){return"<alloy.field."+t+">"},Lw=function(o,t,n){return{uid:o.uid,dom:o.dom,components:t,behaviours:uf(o.formBehaviours,[Lm.config({store:{mode:"manual",getValue:function(t){var n=Zf(t,o);return it(n,function(t,n){return t().bind(function(t){var n,e=vl.getCurrent(t);return n="missing current",e.fold(function(){return vt.error(n)},vt.value)}).map(Lm.getValue)})},setValue:function(e,t){rt(t,function(n,t){Kf(e,o,t).each(function(t){vl.getCurrent(t).each(function(t){Lm.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return Kf(t,o,n).bind(vl.getCurrent)}}}},jw={getField:Pi(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),Wf("form",zw(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=M(r,function(t){return Vf({name:t,pname:zw(t)})});return il("form",Pw,i,Lw,o)}},Uw=io("valid-input"),Ww=io("invalid-input"),Gw=io("validating-input"),Xw="colorcustom.rgb.",Yw=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(Xw+"range"),c=[Rb.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),Rb.parts().field({data:r,factory:Ty,inputAttributes:ao({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:ia([(i=n,u=t,Hy.config({invalidClass:m("invalid"),notify:{onValidate:function(t){Gr(t,Gw,{type:i})},onValid:function(t){Gr(t,Uw,{type:i,value:Lm.getValue(t)})},onInvalid:function(t){Gr(t,Ww,{type:i,value:Lm.getValue(t)})}},validator:{validate:function(t){var n=Lm.getValue(t),e=u(n)?vt.value(!0):vt.error(d("aria.input.invalid"));return qb.pure(e)},validateOnLoad:!1}})),zy.config({})]),onSetValue:function(t){Hy.isInvalid(t)&&Hy.run(t).get(tt)}})],s="hex"!==n?[Rb.parts()["aria-descriptor"]({text:a})]:[];return{dom:{tag:"div",attributes:{role:"presentation"}},components:c.concat(s)}},v=function(t,n){var e=n.red(),o=n.green(),r=n.blue();Lm.setValue(t,{red:e,green:o,blue:r})},b=Ag({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){lu(t.element(),"background-color","#"+n.value())})};return dl({factory:function(){var e={red:nt(_t(et.some(255))),green:nt(_t(et.some(255))),blue:nt(_t(et.some(255))),hex:nt(_t(et.some("ffffff")))},o=function(t){return e[t]().get()},i=function(t,n){e[t]().set(n)},r=function(t){var n=t.red(),e=t.green(),o=t.blue();i("red",et.some(n)),i("green",et.some(e)),i("blue",et.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),et.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,et.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return Hh(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=_h(t),jw.getField(n,"hex").each(function(t){Xm.isFocused(t)||Lm.setValue(n,{hex:e.value()})}),e);y(r,o)})},a=function(t,n){var e=n.event();"hex"===e.type()?function(t,n){g(t);var e=Oh(n);i("hex",et.some(n));var o=zh(e);v(t,o),r(o),Gr(t,$y(),{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(Xw+t+".label"),description:d(Xw+t+".description")}},c=t("red"),s=t("green"),f=t("blue"),l=t("hex");return wt(jw.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",Rb.sketch(h(Nh,"red",c.label,c.description,255))),t.field("green",Rb.sketch(h(Nh,"green",s.label,s.description,255))),t.field("blue",Rb.sketch(h(Nh,"blue",f.label,f.description,255))),t.field("hex",Rb.sketch(h(Bh,"hex",l.label,l.description,"ffffff"))),b.asSpec()],formBehaviours:ia([Hy.config({invalidClass:m("form-invalid")}),lg("rgb-form-events",[si(Uw,a),si(Ww,n),si(Gw,n)])])}}),{apis:{updateHex:function(t,n){var e,o;Lm.setValue(t,{hex:n.value()}),e=t,o=zh(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},qw=function(t,o){var r=Hw.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),i=Hw.parts().thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette-thumb")],innerHtml:"<div class="+o("sv-palette-inner-thumb")+' role="presentation"></div>'}}),u=function(t,n){var e=t.width,o=t.height,r=t.getContext("2d");if(null!==r){r.fillStyle=n,r.fillRect(0,0,e,o);var i=r.createLinearGradient(0,0,e,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=i,r.fillRect(0,0,e,o);var u=r.createLinearGradient(0,0,0,o);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=u,r.fillRect(0,0,e,o)}};return dl({factory:function(t){var n=nt({x:nt(0),y:nt(0)}),e=ia([vl.config({find:et.some}),Xm.config({})]);return Hw.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette")]},model:{mode:"xy",getInitialValue:n},rounded:!1,components:[r,i],onChange:function(t,n,e){Gr(t,Zy(),{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),jh(Uh()))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,jh(o))}},extraApis:{}})},Kw=function(c,s){return dl({name:"ColourPicker",configFields:[br("dom"),Mr("onValidHex",tt),Mr("onInvalidHex",tt)],factory:function(t){var a,v,e=Yw(c,s,t.onValidHex,t.onInvalidHex),o=qw(c,s),b={paletteRgba:nt(_t(Uh()))},n=Ag(o.sketch({})),r=Ag(e.sketch({})),i=function(t,e){n.getOpt(t).each(function(t){var n=zh(e);b.paletteRgba().set(n),o.setRgba(t,n)})},u=function(t,n){r.getOpt(t).each(function(t){e.updateHex(t,n)})},y=function(n,e,t){F(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[n.asSpec(),Nw(c,s),r.asSpec()],behaviours:ia([lg("colour-picker-events",[si(Zy(),(v=[u],function(t,n){var e,o,r,i,u,a,c,s,f,l=n.event().value(),d=b.paletteRgba().get(),m=(i=r=0,u=(e=d).red()/255,a=e.green()/255,c=e.blue()/255,s=Math.min(u,Math.min(a,c)),f=Math.max(u,Math.max(a,c)),s===f?Ky(0,0,100*(i=s)):(r=60*((r=u===s?3:c===s?1:5)-(u===s?a-c:c===s?u-a:c-u)/(f-s)),o=(f-s)/f,i=f,Ky(Math.round(r),Math.round(100*o),Math.round(100*i)))),g=Ky(m.hue(),l.x(),100-l.y()),p=Ph(g),h=_h(p);y(t,h,v)})),si(Jy(),(a=[i,u],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=Ky((100-e)/100*360,100,100),r=Ph(o),_h(r));y(t,u,a)}))]),vl.config({find:function(t){return r.getOpt(t)}}),km.config({mode:"acyclic"})])}}})},$w=function(){return vl.config({find:et.some})},Jw=function(t){return vl.config({find:t.getOpt})},Zw=function(t){return vl.config({find:function(n){return Se(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},Qw={"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","colorcustom.sb.saturation":"Saturation","colorcustom.sb.brightness":"Brightness","colorcustom.sb.picker":"Saturation and Brightness Picker","colorcustom.sb.palette":"Saturation and Brightness Palette","colorcustom.sb.instructions":"Use arrow keys to select saturation and brightness, on x and y axes","colorcustom.hue.hue":"Hue","colorcustom.hue.slider":"Hue Slider","colorcustom.hue.palette":"Hue Palette","colorcustom.hue.instructions":"Use arrow keys to select a hue","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"},tS=function(t){return Qw[t]},nS=Go([Mr("preprocess",d),Mr("postprocess",d)]),eS=function(t,n,e){return Lm.config(wt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},oS=function(t,n,e){return eS(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},rS=function(r,t){var i=cr("RepresentingConfigs.memento processors",nS,t);return Lm.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=Lm.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);Lm.setValue(o,e)}}})},iS=eS,uS=function(t){return oS(t,_e,Me)},aS=function(t){return Lm.config({store:{mode:"memory",initialValue:t}})},cS=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){F(t,function(t){t(n,e)})}},i=function(t,n){if(!ih.isDisabled(t)){var e=n.event().raw();a(t,e.dataTransfer.files)}},u=function(t,n){var e=n.event().raw().target.files;a(t,e)},a=function(t,n){var e,o;Lm.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),R(Z(e),function(t){return o.test(t.name)}))),Gr(t,Ob,{name:r.name})},c=Ag({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:ia([lg("input-file-events",[pi(Rn())])])}),t=r.label.map(function(t){return xy(t,n)}),s=Rb.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:ia([aS([]),$w(),ih.config({}),rg.config({toggleClass:"dragenter",toggleOnExecute:!1}),lg("dropzone-events",[si("dragenter",o([e,rg.toggle])),si("dragleave",o([e,rg.toggle])),si("dragover",e),si("drop",o([e,i])),si($t(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},Bg.sketch({dom:{tag:"button",innerHtml:n.translate("Browse for an image"),styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[c.asSpec()],action:function(t){c.get(t).element().dom().click()},buttonBehaviours:ia([zy.config({})])})]}]}}}});return hy(t,s,["tox-form__group--stretched"])},sS=io("alloy-fake-before-tabstop"),fS=io("alloy-fake-after-tabstop"),lS=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:ia([Xm.config({ignore:!0}),zy.config({})])}},dS=function(t,n){Gr(t,Yt(),{raw:{which:9,shiftKey:n}})},mS=function(t){return Kv(t,["."+sS,"."+fS].join(","),nt(!1))},gS=function(t,n){var e=n.element();iu(e,sS)?dS(t,!0):iu(e,fS)&&dS(t,!1)},pS=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[lS([sS]),t,lS([fS])],behaviours:ia([Zw(1)])}},hS=!(Tn.detect().browser.isIE()||Tn.detect().browser.isEdge()),vS=function(t,n){var o,r,e=hS&&t.sandboxed,i=ao({},t.label.map(function(t){return{title:t}}).getOr({}),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=_t(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)ze(t.element(),"src","data:text/html;charset=utf-8,"+encodeURIComponent(n));else{ze(t.element(),"src","javascript:''");var e=t.element().dom().contentWindow.document;e.open(),e.write(n),e.close()}r.set(n)}}),a=t.label.map(function(t){return xy(t,n)}),c=Rb.parts().field({factory:{sketch:function(t){return pS({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:ia([zy.config({}),Xm.config({}),iS(et.none(),u.getValue,u.setValue)])})}}});return hy(a,c,["tox-form__group--stretched"])};function bS(t,n){return wS(x.document.createElement("canvas"),t,n)}function yS(t){var n=bS(t.width,t.height);return xS(n).drawImage(t,0,0),n}function xS(t){return t.getContext("2d")}function wS(t,n,e){return t.width=n,t.height=e,t}var SS={atob:function(t){return ue.getOrDie("atob")(t)},requestAnimationFrame:function(t){ue.getOrDie("requestAnimationFrame")(t)}};function kS(t){return t.naturalWidth||t.width}function CS(t){return t.naturalHeight||t.height}var OS=window.Promise?window.Promise:function(){var i=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],f(t,o(r,this),o(a,this))},t=i.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){x.setTimeout(t,1)};function o(t,n){return function(){return t.apply(n,arguments)}}var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function u(o){var r=this;null!==this._state?t(function(){var t=r._state?o.onFulfilled:o.onRejected;if(null!==t){var n;try{n=t(r._value)}catch(e){return void o.reject(e)}o.resolve(n)}else(r._state?o.resolve:o.reject)(r._value)}):this._deferreds.push(o)}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void f(o(n,t),o(r,this),o(a,this))}this._state=!0,this._value=t,c.call(this)}catch(e){a.call(this,e)}}function a(t){this._state=!1,this._value=t,c.call(this)}function c(){for(var t=0,n=this._deferreds;t<n.length;t++){var e=n[t];u.call(this,e)}this._deferreds=[]}function s(t,n,e,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.resolve=e,this.reject=o}function f(t,n,e){var o=!1;try{t(function(t){o||(o=!0,n(t))},function(t){o||(o=!0,e(t))})}catch(r){if(o)return;o=!0,e(r)}}return i.prototype["catch"]=function(t){return this.then(null,t)},i.prototype.then=function(e,o){var r=this;return new i(function(t,n){u.call(r,new s(e,o,t,n))})},i.all=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var c=Array.prototype.slice.call(1===t.length&&e(t[0])?t[0]:t);return new i(function(r,i){if(0===c.length)return r([]);var u=c.length;function a(n,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void e.call(t,function(t){a(n,t)},i)}c[n]=t,0==--u&&r(c)}catch(o){i(o)}}for(var t=0;t<c.length;t++)a(t,c[t])})},i.resolve=function(n){return n&&"object"==typeof n&&n.constructor===i?n:new i(function(t){t(n)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(r){return new i(function(t,n){for(var e=0,o=r;e<o.length;e++)o[e].then(t,n)})},i}();function ES(t){var n=t.split(","),e=/data:([^;]+)/.exec(n[0]);if(!e)return et.none();for(var o,r=e[1],i=n[1],u=SS.atob(i),a=u.length,c=Math.ceil(a/1024),s=new Array(c),f=0;f<c;++f){for(var l=1024*f,d=Math.min(l+1024,a),m=new Array(d-l),g=l,p=0;g<d;++p,++g)m[p]=u[g].charCodeAt(0);s[f]=(o=m,new(ue.getOrDie("Uint8Array"))(o))}return et.some(function h(t,n){return new(ue.getOrDie("Blob"))(t,n)}(s,{type:r}))}function TS(e){return new OS(function(t,n){ES(e).fold(function(){n("uri is not base64: "+e)},t)})}function BS(t,o,r){return o=o||"image/png",x.HTMLCanvasElement.prototype.toBlob?new OS(function(n,e){t.toBlob(function(t){t?n(t):e()},o,r)}):TS(t.toDataURL(o,r))}function AS(t){return function n(a){return new OS(function(t,n){var e=x.URL.createObjectURL(a),o=new x.Image,r=function(){o.removeEventListener("load",i),o.removeEventListener("error",u)};function i(){r(),t(o)}function u(){r(),n("Unable to load data of type "+a.type+": "+e)}o.addEventListener("load",i),o.addEventListener("error",u),o.src=e,o.complete&&i()})}(t).then(function(t){!function e(t){x.URL.revokeObjectURL(t.src)}(t);var n=bS(kS(t),CS(t));return xS(n).drawImage(t,0,0),n})}function DS(o){return new OS(function(t){var n=function e(){return new(ue.getOrDie("FileReader"))}();n.onloadend=function(){t(n.result)},n.readAsDataURL(o)})}function _S(t,n,e){var o=n.type;function r(n,e){return t.then(function(t){return function o(t,n,e){return n=n||"image/png",t.toDataURL(n,e)}(t,n,e)})}return{getType:nt(o),toBlob:function i(){return OS.resolve(n)},toDataURL:function u(){return e},toBase64:function a(){return e.split(",")[1]},toAdjustedBlob:function c(n,e){return t.then(function(t){return BS(t,n,e)})},toAdjustedDataURL:r,toAdjustedBase64:function s(t,n){return r(t,n).then(function(t){return t.split(",")[1]})},toCanvas:function f(){return t.then(yS)}}}function MS(n){return DS(n).then(function(t){return _S(AS(n),n,t)})}function FS(n,t){return BS(n,t).then(function(t){return _S(OS.resolve(n),t,n.toDataURL())})}function IS(t,n,e){var o="string"==typeof t?parseFloat(t):t;return e<o?o=e:o<n&&(o=n),o}(function j_(t){return ZH().then(function(t){return MS(t)})});var VS=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10];function RS(t,n){for(var e,o=[],r=new Array(25),i=0;i<5;i++){for(var u=0;u<5;u++)o[u]=n[u+5*i];for(u=0;u<5;u++){for(var a=e=0;a<5;a++)e+=t[u+5*a]*o[a];r[u+5*i]=e}}return r}function HS(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=xS(t),r=function B(t,n){for(var e,o,r,i,u=t.data,a=n[0],c=n[1],s=n[2],f=n[3],l=n[4],d=n[5],m=n[6],g=n[7],p=n[8],h=n[9],v=n[10],b=n[11],y=n[12],x=n[13],w=n[14],S=n[15],k=n[16],C=n[17],O=n[18],E=n[19],T=0;T<u.length;T+=4)e=u[T],o=u[T+1],r=u[T+2],i=u[T+3],u[T]=e*a+o*c+r*s+i*f+l,u[T+1]=e*d+o*m+r*g+i*p+h,u[T+2]=e*v+o*b+r*y+i*x+w,u[T+3]=e*S+o*k+r*C+i*O+E;return t}(o.getImageData(0,0,t.width,t.height),e);return o.putImageData(r,0,0),FS(t,n)}(t,n.getType(),e)})}function NS(n,e){return n.toCanvas().then(function(t){return function u(t,n,e){var o=xS(t),r=o.getImageData(0,0,t.width,t.height),i=o.getImageData(0,0,t.width,t.height);return i=function S(t,n,e){function o(t,n,e){return e<t?t=e:t<n&&(t=n),t}for(var r=Math.round(Math.sqrt(e.length)),i=Math.floor(r/2),u=t.data,a=n.data,c=t.width,s=t.height,f=0;f<s;f++)for(var l=0;l<c;l++){for(var d=0,m=0,g=0,p=0;p<r;p++)for(var h=0;h<r;h++){var v=o(l+h-i,0,c-1),b=o(f+p-i,0,s-1),y=4*(b*c+v),x=e[p*r+h];d+=u[y]*x,m+=u[y+1]*x,g+=u[y+2]*x}var w=4*(f*c+l);a[w]=o(d,0,255),a[w+1]=o(m,0,255),a[w+2]=o(g,0,255)}return n}(r,i,e),o.putImageData(i,0,0),FS(t,n)}(t,n.getType(),e)})}function PS(e){return function(t,n){return HS(t,e([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n))}}var zS=function U_(n){return function(t){return HS(t,n)}}([-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0,0,0,0,0,1]),LS=PS(function W_(t,n){return RS(t,[1,0,0,0,n=IS(255*n,-255,255),0,1,0,0,n,0,0,1,0,n,0,0,0,1,0,0,0,0,0,1])}),jS=PS(function G_(t,n){var e;return n=IS(n,-1,1),RS(t,[(e=(n*=100)<0?127+n/100*127:127*(e=0==(e=n%1)?VS[n]:VS[Math.floor(n)]*(1-e)+VS[Math.floor(n)+1]*e)+127)/127,0,0,0,.5*(127-e),0,e/127,0,0,.5*(127-e),0,0,e/127,0,.5*(127-e),0,0,0,1,0,0,0,0,0,1])}),US=function(t,n,e,o){return HS(t,function r(t,n,e,o){return RS(t,[n=IS(n,0,2),0,0,0,0,0,e=IS(e,0,2),0,0,0,0,0,o=IS(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])}([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1],n,e,o))},WS=function X_(n){return function(t){return NS(t,n)}}([0,-1,0,-1,5,-1,0,-1,0]),GS=function Y_(c){return function(n,e){return n.toCanvas().then(function(t){return function(t,n,e){for(var o=xS(t),r=new Array(256),i=0;i<r.length;i++)r[i]=c(i,e);var u=function a(t,n){for(var e=t.data,o=0;o<e.length;o+=4)e[o]=n[e[o]],e[o+1]=n[e[o+1]],e[o+2]=n[e[o+2]];return t}(o.getImageData(0,0,t.width,t.height),r);return o.putImageData(u,0,0),FS(t,n)}(t,n.getType(),e)})}}(function(t,n){return 255*Math.pow(t/255,1-n)});function XS(t,n,e){var o=kS(t),r=CS(t),i=n/o,u=e/r,a=!1;(i<.5||2<i)&&(i=i<.5?.5:2,a=!0),(u<.5||2<u)&&(u=u<.5?.5:2,a=!0);var c=function f(a,c,s){return new OS(function(t){var n=kS(a),e=CS(a),o=Math.floor(n*c),r=Math.floor(e*s),i=bS(o,r),u=xS(i);u.drawImage(a,0,0,n,e,0,0,o,r),t(i)})}(t,i,u);return a?c.then(function(t){return XS(t,n,e)}):c}function YS(n,e){return n.toCanvas().then(function(t){return function a(t,n,e){var o=bS(t.width,t.height),r=xS(o),i=0,u=0;return 90!==(e=e<0?360+e:e)&&270!==e||wS(o,o.height,o.width),90!==e&&180!==e||(i=o.width),270!==e&&180!==e||(u=o.height),r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(t,0,0),FS(o,n)}(t,n.getType(),e)})}function qS(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=bS(t.width,t.height),r=xS(o);return"v"===e?(r.scale(1,-1),r.drawImage(t,0,-o.height)):(r.scale(-1,1),r.drawImage(t,-o.width,0)),FS(o,n)}(t,n.getType(),e)})}function KS(n,e,o,r,i){return n.toCanvas().then(function(t){return function a(t,n,e,o,r,i){var u=bS(r,i);return xS(u).drawImage(t,-e,-o),FS(u,n)}(t,n.getType(),e,o,r,i)})}var $S=function(t){return zS(t)},JS=function(t){return WS(t)},ZS=function(t,n){return GS(t,n)},QS=function(t,n){return LS(t,n)},tk=function(t,n){return jS(t,n)},nk=function(t,n){return qS(t,n)},ek=function(t,n,e){return function r(n,e,o){return n.toCanvas().then(function(t){return XS(t,e,o).then(function(t){return FS(t,n.getType())})})}(t,n,e)},ok=function(t,n){return YS(t,n)},rk=function(t,n){return ao({dom:{tag:"span",innerHtml:t,classes:["tox-icon","tox-tbtn__icon-wrap"]}},n)},ik=function(t,n){return rk(_g(t,n),{})},uk=function(t,n){return rk(_g(t,n),{behaviours:ia([Bm.config({})])})},ak=function(t,n,e){return{dom:{tag:"span",innerHtml:e.translate(t),classes:[n+"__select-label"]},behaviours:ia([Bm.config({})])}},ck=function(t,n,e,o,r){void 0===e&&(e=[]);var i=n.fold(function(){return{}},function(t){return{action:t}}),u=ao({buttonBehaviours:ia([ah(t.disabled),zy.config({}),lg("button press",[ci("click"),ci("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=wt(u,{dom:o});return wt(a,{components:r})},sk=function(t,n,e,o){void 0===o&&(o=[]);var r={tag:"button",classes:["tox-tbtn"],attributes:t.tooltip.map(function(t){return{"aria-label":e.translate(t),title:e.translate(t)}}).getOr({})},i=t.icon.map(function(t){return ik(t,e.icons)}),u=hh([i]);return ck(t,n,o,r,u)},fk=function(t,n,e,o){void 0===o&&(o=[]);var r=sk(t,et.some(n),e,o);return Bg.sketch(r)},lk=function(t,n,e,o){void 0===o&&(o=[]);var r=e.translate(t.text),i=t.icon?t.icon.map(function(t){return ik(t,e.icons)}):et.none(),u=i.isSome()?hh([i]):[],a=i.isSome()?{}:{innerHtml:r},c=(t.primary?["tox-button"]:["tox-button","tox-button--secondary"]).concat(i.isSome()?["tox-button--icon"]:[]);return function(t,n,e,o,r){void 0===e&&(e=[]);var i=ck(t,et.some(n),e,o,r);return Bg.sketch(i)}(t,n,o,ao({tag:"button",classes:c},a,{attributes:{title:r}}),u)},dk=function(n,e){return function(t){"custom"===e?Gr(t,Bb,{name:n,value:{}}):"submit"===e?Wr(t,Ab):"cancel"===e?Wr(t,Tb):x.console.error("Unknown button type: ",e)}},mk=function(t,n,e){var o=dk(t.name,n);return lk(t,o,e,[])},gk=nt([Mr("field1Name","field1"),Mr("field2Name","field2"),Ku("onLockedChange"),Gu(["lockClass"]),Mr("locked",!1),af.field("coupledFieldBehaviours",[vl,Lm])]),pk=function(t,i){return Vf({factory:Rb,name:t,overrides:function(r){return{fieldBehaviours:ia([lg("coupled-input-behaviour",[si(Kt(),function(e){var t,n,o;(t=e,n=r,o=i,Kf(t,n,o).bind(vl.getCurrent)).each(function(n){Kf(e,r,"lock").each(function(t){rg.isOn(t)&&r.onLockedChange(e,n,t)})})})])])}}})},hk=nt([pk("field1","field2"),pk("field2","field1"),Vf({factory:Bg,schema:[br("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:ia([rg.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),vk=ml({name:"FormCoupledInputs",configFields:gk(),partFields:hk(),factory:function(o,t,n,e){return{uid:o.uid,dom:o.dom,components:t,behaviours:af.augment(o.coupledFieldBehaviours,[vl.config({find:et.some}),Lm.config({store:{mode:"manual",getValue:function(t){var n,e=tl(t,o,["field1","field2"]);return(n={})[o.field1Name]=Lm.getValue(e.field1()),n[o.field2Name]=Lm.getValue(e.field2()),n},setValue:function(t,n){var e=tl(t,o,["field1","field2"]);Dt(n,o.field1Name)&&Lm.setValue(e.field1(),n[o.field1Name]),Dt(n,o.field2Name)&&Lm.setValue(e.field2(),n[o.field2Name])}}})]),apis:{getField1:function(t){return Kf(t,o,"field1")},getField2:function(t){return Kf(t,o,"field2")},getLock:function(t){return Kf(t,o,"lock")}}}},apis:{getField1:function(t,n){return t.getField1(n)},getField2:function(t,n){return t.getField2(n)},getLock:function(t,n){return t.getLock(n)}}}),bk=function(t){var n=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(t);if(null===n)return vt.error(t);var e=parseFloat(n[1]),o=n[2];return vt.value({value:e,unit:o})},yk=function(t,n){var e={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,"in":1},o=function(t){return Object.prototype.hasOwnProperty.call(e,t)};return t.unit===n?et.some(t.value):o(t.unit)&&o(n)?e[t.unit]===e[n]?et.some(t.value):et.some(t.value/e[t.unit]*e[n]):et.none()},xk=function(t){return et.none()},wk=function(t,n){var e=bk(t).toOption(),o=bk(n).toOption();return It([e,o],function(t,o){return yk(t,o.unit).map(function(t){return o.value/t}).map(function(t){return n=t,e=o.unit,function(t){return yk(t,e).map(function(t){return{value:t*n,unit:e}})};var n,e}).getOr(xk)}).getOr(xk)},Sk=function(o,n){var a=xk,r=io("ratio-event"),t=vk.parts().lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:n.translate(o.label.getOr("Constrain proportions"))}},components:[{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__lock"],innerHtml:_g("lock",n.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:_g("unlock",n.icons)}}],buttonBehaviours:ia([zy.config({})])}),e=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},i=function(e){return Rb.parts().field({factory:Ty,inputClasses:["tox-textfield"],inputBehaviours:ia([zy.config({}),lg("size-input-events",[si(Gt(),function(t,n){Gr(t,r,{isField1:e})}),si($t(),function(t,n){Gr(t,Ob,{name:o.name})})])]),selectOnFocus:!1})},u=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}}},c=vk.parts().field1(e([Rb.parts().label(u("Width")),i(!0)])),s=vk.parts().field2(e([Rb.parts().label(u("Height")),i(!1)]));return vk.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,s,e([u("&nbsp;"),t])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(t,i,n){bk(Lm.getValue(t)).each(function(t){a(t).each(function(t){var n,e,o,r;Lm.setValue(i,(o={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,"in":4,"%":4},-1!==(r=(n=t).value.toFixed((e=n.unit)in o?o[e]:1)).indexOf(".")&&(r=r.replace(/\.?0*$/,"")),r+n.unit))})})},coupledFieldBehaviours:ia([ih.config({}),lg("size-input-events2",[si(r,function(t,n){var e=n.event().isField1(),o=e?vk.getField1(t):vk.getField2(t),r=e?vk.getField2(t):vk.getField1(t),i=o.map(Lm.getValue).getOr(""),u=r.map(Lm.getValue).getOr("");a=wk(i,u)})])])})},kk={undo:nt(io("undo")),redo:nt(io("redo")),zoom:nt(io("zoom")),back:nt(io("back")),apply:nt(io("apply")),swap:nt(io("swap")),transform:nt(io("transform")),tempTransform:nt(io("temp-transform")),transformApply:nt(io("transform-apply"))},Ck=nt("save-state"),Ok=nt("disable"),Ek=nt("enable"),Tk={formActionEvent:Bb,saveState:Ck,disable:Ok,enable:Ek},Bk=function(a,c){var t=function(t,n,e,o){return Ag(lk({name:t,text:t,disabled:e,primary:o},n,c))},n=function(t,n,e,o){return Ag(fk({name:t,icon:et.some(t),tooltip:et.some(n),disabled:o},e,c))},u=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(ih)&&ih.disable(n)})},s=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(ih)&&ih.enable(n)})},f={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},e=et.none(),o=tt,r=function(t,n,e){Gr(t,n,e)},i=function(t){return Wr(t,Tk.disable())},l=function(t){return Wr(t,Tk.enable())},d=function(t,n){i(t),r(t,kk.transform(),{transform:n}),l(t)},m=function(t){return function(){Q.getOpt(t).each(function(t){Bm.set(t,[J])})}},g=function(t,n){i(t),r(t,kk.transformApply(),{transform:n,swap:m(t)}),l(t)},p=function(){return t("Back",function(t){return r(t,kk.back(),{swap:m(t)})},!1,!1)},h=function(){return Ag({dom:{tag:"div",classes:["tox-spacer"]},behaviours:ia([ih.config({})])})},v=function(){return t("Apply",function(t){return r(t,kk.apply(),{swap:m(t)})},!0,!0)},b=function(){return function(t){var n,e,o,r,i,u=a.getRect();return n=t,e=u.x,o=u.y,r=u.w,i=u.h,KS(n,e,o,r,i)}},y=[p(),h(),t("Apply",function(t){var n=b();g(t,n),a.hideCrop()},!1,!0)],x=gb.sketch({dom:f,components:y.map(function(t){return t.asSpec()}),containerBehaviours:ia([lg("image-tools-crop-buttons-events",[si(Tk.disable(),function(t,n){u(y,t)}),si(Tk.enable(),function(t,n){s(y,t)})])])}),w=Ag(Sk({name:"size",label:e,type:"sizeinput",constrain:!0},c)),S=[p(),h(),w,h(),t("Apply",function(a){w.getOpt(a).each(function(t){var n,e,o=Lm.getValue(t),r=parseInt(o.width,10),i=parseInt(o.height,10),u=(n=r,e=i,function(t){return ek(t,n,e)});g(a,u)})},!1,!0)],k=gb.sketch({dom:f,components:S.map(function(t){return t.asSpec()}),containerBehaviours:ia([lg("image-tools-resize-buttons-events",[si(Tk.disable(),function(t,n){u(S,t)}),si(Tk.enable(),function(t,n){s(S,t)})])])}),C=function(n,e){return function(t){return n(t,e)}},O=C(nk,"h"),E=C(nk,"v"),T=C(ok,-90),B=C(ok,90),A=function(t,n){var e,o;o=n,i(e=t),r(e,kk.tempTransform(),{transform:o}),l(e)},D=[p(),h(),n("flip-horizontally","Flip horizontally",function(t){A(t,O)},!1),n("flip-vertically","Flip vertically",function(t){A(t,E)},!1),n("rotate-left","Rotate counterclockwise",function(t){A(t,T)},!1),n("rotate-right","Rotate clockwise",function(t){A(t,B)},!1),h(),v()],_=gb.sketch({dom:f,components:D.map(function(t){return t.asSpec()}),containerBehaviours:ia([lg("image-tools-fliprotate-buttons-events",[si(Tk.disable(),function(t,n){u(D,t)}),si(Tk.enable(),function(t,n){s(D,t)})])])}),M=function(t,n,e,o,r){var i=Hw.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(t)}}),u=Hw.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=Hw.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Ag(Hw.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:nt({x:nt(o)})},components:[i,u,a],sliderBehaviours:ia([Xm.config({})]),onChoose:n}))},F=function(t,n,e,o,r){return[p(),(i=t,u=n,a=e,c=o,s=r,M(i,function(t,n,e){var o=C(u,e.x()/100);d(t,o)},a,c,s)),v()];var i,u,a,c,s},I=function(t,n,e,o,r){var i=F(t,n,e,o,r);return gb.sketch({dom:f,components:i.map(function(t){return t.asSpec()}),containerBehaviours:ia([lg("image-tools-filter-panel-buttons-events",[si(Tk.disable(),function(t,n){u(i,t)}),si(Tk.enable(),function(t,n){s(i,t)})])])})},V=[p(),h(),v()],R=gb.sketch({dom:f,components:V.map(function(t){return t.asSpec()})}),H=I("Brightness",QS,-100,0,100),N=I("Contrast",tk,-100,0,100),P=I("Gamma",ZS,-100,0,100),z=function(n,e,o){return function(t){return US(t,n,e,o)}},L=function(t){return M(t,function(a,t,n){var e=j.getOpt(a),o=W.getOpt(a),r=U.getOpt(a);e.each(function(u){o.each(function(i){r.each(function(t){var n=Lm.getValue(u).x()/100,e=Lm.getValue(t).x()/100,o=Lm.getValue(i).x()/100,r=z(n,e,o);d(a,r)})})})},0,100,200)},j=L("R"),U=L("G"),W=L("B"),G=[p(),j,U,W,v()],X=gb.sketch({dom:f,components:G.map(function(t){return t.asSpec()})}),Y=function(n,e,o){return function(t){r(t,kk.swap(),{transform:e,swap:function(){Q.getOpt(t).each(function(t){Bm.set(t,[n]),o(t)})}})}},q=et.some(JS),K=et.some($S),$=[n("crop","Crop",Y(x,e,function(t){a.showCrop()}),!1),n("resize","Resize",Y(k,e,function(t){w.getOpt(t).each(function(t){var n=a.getMeasurements(),e=n.width,o=n.height;Lm.setValue(t,{width:e,height:o})})}),!1),n("orientation","Orientation",Y(_,e,o),!1),n("brightness","Brightness",Y(H,e,o),!1),n("sharpen","Sharpen",Y(R,q,o),!1),n("contrast","Contrast",Y(N,e,o),!1),n("color-levels","Color levels",Y(X,e,o),!1),n("gamma","Gamma",Y(P,e,o),!1),n("invert","Invert",Y(R,K,o),!1)],J=gb.sketch({dom:f,components:$.map(function(t){return t.asSpec()})}),Z=gb.sketch({dom:{tag:"div"},components:[J],containerBehaviours:ia([Bm.config({})])}),Q=Ag(Z);return{memContainer:Q,getApplyButton:function(t){return Q.getOpt(t).map(function(t){var n=t.components()[0];return n.components()[n.components().length-1]})}}},Ak=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Dk=tinymce.util.Tools.resolve("tinymce.geom.Rect"),_k=tinymce.util.Tools.resolve("tinymce.util.Observable"),Mk=tinymce.util.Tools.resolve("tinymce.util.Tools"),Fk=tinymce.util.Tools.resolve("tinymce.util.VK");function Ik(t){var n,e;if(t.changedTouches)for(n="screenX screenY pageX pageY clientX clientY".split(" "),e=0;e<n.length;e++)t[n[e]]=t.changedTouches[0][n[e]]}function Vk(t,r){var i,u,n,a,c,f,l,d=r.document||x.document;r=r||{};var m=d.getElementById(r.handle||t);n=function(t){var n,e,o=function s(t){var n,e,o,r,i,u,a,c=Math.max;return n=t.documentElement,e=t.body,o=c(n.scrollWidth,e.scrollWidth),r=c(n.clientWidth,e.clientWidth),i=c(n.offsetWidth,e.offsetWidth),u=c(n.scrollHeight,e.scrollHeight),a=c(n.clientHeight,e.clientHeight),{width:o<i?r:o,height:u<c(n.offsetHeight,e.offsetHeight)?a:u}}(d);Ik(t),t.preventDefault(),u=t.button,n=m,f=t.screenX,l=t.screenY,e=x.window.getComputedStyle?x.window.getComputedStyle(n,null).getPropertyValue("cursor"):n.runtimeStyle.cursor,i=Ak("<div></div>").css({position:"absolute",top:0,left:0,width:o.width,height:o.height,zIndex:2147483647,opacity:1e-4,cursor:e}).appendTo(d.body),Ak(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(Ik(t),t.button!==u)return a(t);t.deltaX=t.screenX-f,t.deltaY=t.screenY-l,t.preventDefault(),r.drag(t)},a=function(t){Ik(t),Ak(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){Ak(m).off()},Ak(m).on("mousedown touchstart",n)}var Rk,Hk,Nk,Pk,zk=0,Lk=function(n){var f=Ag({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),l=_t(1),d=_t(et.none()),m=_t({x:0,y:0,w:1,h:1}),c=_t({x:0,y:0,w:1,h:1}),s=function(t,s){g.getOpt(t).each(function(t){var e=l.get(),o=ka(t.element()),r=Ea(t.element()),i=s.dom().naturalWidth*e,u=s.dom().naturalHeight*e,a=Math.max(0,o/2-i/2),c=Math.max(0,r/2-u/2),n={left:a.toString()+"px",top:c.toString()+"px",width:i.toString()+"px",height:u.toString()+"px",position:"absolute"};du(s,n),f.getOpt(t).each(function(t){du(t.element(),n)}),d.get().each(function(t){var n=m.get();t.setRect({x:n.x*e+a,y:n.y*e+c,w:n.w*e,h:n.h*e}),t.setClampRect({x:a,y:c,w:i,h:u}),t.setViewPortRect({x:0,y:0,w:o,h:r})})})},e=function(t,n){var e,a=Qn.fromTag("img");return ze(a,"src",n),(e=a.dom(),new Jg(function(t){var n=function(){e.removeEventListener("load",n),t(e)};e.complete?t(e):e.addEventListener("load",n)})).then(function(){return g.getOpt(t).map(function(t){var n=Au({element:a});Bm.replaceAt(t,1,et.some(n));var e=c.get(),o={x:0,y:0,w:a.dom().naturalWidth,h:a.dom().naturalHeight};c.set(o);var r,u,i=Dk.inflate(o,-20,-20);return m.set(i),e.w===o.w&&e.h===o.h||(r=t,u=a,g.getOpt(r).each(function(t){var n=ka(t.element()),e=Ea(t.element()),o=u.dom().naturalWidth,r=u.dom().naturalHeight,i=Math.min(n/o,e/r);1<=i?l.set(1):l.set(i)})),s(t,a),a})})},t=gb.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[f.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:ia([lg("image-panel-crop-events",[bi(function(t){g.getOpt(t).each(function(t){var n=function S(s,e,f,o,r){var l,u,n,i,a="tox-",c="tox-crid-"+zk++;function d(t,n){return{x:n.x-t.x,y:n.y-t.y,w:n.w,h:n.h}}function m(t,n,e,o){var r,i,u,a,c;r=n.x,i=n.y,u=n.w,a=n.h,r+=e*t.deltaX,i+=o*t.deltaY,(u+=e*t.deltaW)<20&&(u=20),(a+=o*t.deltaH)<20&&(a=20),c=s=Dk.clamp({x:r,y:i,w:u,h:a},f,"move"===t.name),c=d(f,c),l.fire("updateRect",{rect:c}),h(c)}function g(n){function t(t,n){n.h<0&&(n.h=0),n.w<0&&(n.w=0),Ak("#"+c+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}Mk.each(u,function(t){Ak("#"+c+"-"+t.name,o).css({left:n.w*t.xMul+n.x,top:n.h*t.yMul+n.y})}),t("top",{x:e.x,y:e.y,w:e.w,h:n.y-e.y}),t("right",{x:n.x+n.w,y:n.y,w:e.w-n.x-n.w+e.x,h:n.h}),t("bottom",{x:e.x,y:n.y+n.h,w:e.w,h:e.h-n.y-n.h+e.y}),t("left",{x:e.x,y:n.y,w:n.x-e.x,h:n.h}),t("move",n)}function p(t){g(s=t)}function h(t){p(function e(t,n){return{x:n.x+t.x,y:n.y+t.y,w:n.w,h:n.h}}(f,t))}return u=[{name:"move",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:0,deltaH:0,label:"Crop Mask"},{name:"nw",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:-1,deltaH:-1,label:"Top Left Crop Handle"},{name:"ne",xMul:1,yMul:0,deltaX:0,deltaY:1,deltaW:1,deltaH:-1,label:"Top Right Crop Handle"},{name:"sw",xMul:0,yMul:1,deltaX:1,deltaY:0,deltaW:-1,deltaH:1,label:"Bottom Left Crop Handle"},{name:"se",xMul:1,yMul:1,deltaX:0,deltaY:0,deltaW:1,deltaH:1,label:"Bottom Right Crop Handle"}],i=["top","right","bottom","left"],function v(){Ak('<div id="'+c+'" class="'+a+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),Mk.each(i,function(t){Ak("#"+c,o).append('<div id="'+c+"-"+t+'"class="'+a+'croprect-block" style="display: none" data-mce-bogus="all">')}),Mk.each(u,function(t){Ak("#"+c,o).append('<div id="'+c+"-"+t.name+'" class="'+a+"croprect-handle "+a+"croprect-handle-"+t.name+'"style="display: none" data-mce-bogus="all" role="gridcell" tabindex="-1" aria-label="'+t.label+'" aria-grabbed="false" title="'+t.label+'">')}),n=Mk.map(u,function t(n){var e;return new Vk(c,{document:o.ownerDocument,handle:c+"-"+n.name,start:function(){e=s},drag:function(t){m(n,e,t.deltaX,t.deltaY)}})}),g(s),Ak(o).on("focusin focusout",function(t){Ak(t.target).attr("aria-grabbed","focus"===t.type?"true":"false")}),Ak(o).on("keydown",function(n){var i;function t(t,n,e,o,r){t.stopPropagation(),t.preventDefault(),m(i,e,o,r)}switch(Mk.each(u,function(t){if(n.target.id===c+"-"+t.name)return i=t,!1}),n.keyCode){case Fk.LEFT:t(n,0,s,-10,0);break;case Fk.RIGHT:t(n,0,s,10,0);break;case Fk.UP:t(n,0,s,0,-10);break;case Fk.DOWN:t(n,0,s,0,10);break;case Fk.ENTER:case Fk.SPACEBAR:n.preventDefault(),r()}})}(),l=Mk.extend({toggleVisibility:function b(t){var n;n=Mk.map(u,function(t){return"#"+c+"-"+t.name}).concat(Mk.map(i,function(t){return"#"+c+"-"+t})).join(","),t?Ak(n,o).show():Ak(n,o).hide()},setClampRect:function y(t){f=t,g(s)},setRect:p,getInnerRect:function t(){return d(f,s)},setInnerRect:h,setViewPortRect:function x(t){e=t,g(s)},destroy:function w(){Mk.each(n,function(t){t.destroy()}),n=[]}},_k)}({x:10,y:10,w:100,h:100},{x:0,y:0,w:200,h:200},{x:0,y:0,w:200,h:200},t.element().dom(),function(){});n.toggleVisibility(!1),n.on("updateRect",function(t){var n=t.rect,e=l.get(),o={x:Math.round(n.x/e),y:Math.round(n.y/e),w:Math.round(n.w/e),h:Math.round(n.h/e)};m.set(o)}),d.set(et.some(n))})})])])}],containerBehaviours:ia([Bm.config({}),lg("image-panel-events",[bi(function(t){e(t,n)})])])}),g=Ag(t);return{memContainer:g,updateSrc:e,zoom:function(t,n){var e=l.get(),o=0<n?Math.min(2,e+.1):Math.max(.1,e-.1);l.set(o),g.getOpt(t).each(function(t){var n=t.components()[1].element();s(t,n)})},showCrop:function(){d.get().each(function(t){t.toggleVisibility(!0)})},hideCrop:function(){d.get().each(function(t){t.toggleVisibility(!1)})},getRect:function(){return m.get()},getMeasurements:function(){var t=c.get();return{width:t.w,height:t.h}}}},jk=function(t,n,e,o,r){return fk({name:t,icon:et.some(n),disabled:e,tooltip:et.some(t)},o,r)},Uk=function(t,n){n?ih.enable(t):ih.disable(t)},Wk=function(t){var o=Ag(jk("Undo","undo",!0,function(t){Gr(t,kk.undo(),{direction:1})},t)),r=Ag(jk("Redo","redo",!0,function(t){Gr(t,kk.redo(),{direction:1})},t));return{container:gb.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),jk("Zoom in","zoom-in",!1,function(t){Gr(t,kk.zoom(),{direction:1})},t),jk("Zoom out","zoom-out",!1,function(t){Gr(t,kk.zoom(),{direction:-1})},t)]}),updateButtonUndoStates:function(t,n,e){o.getOpt(t).each(function(t){Uk(t,n)}),r.getOpt(t).each(function(t){Uk(t,e)})}}},Gk=function(){return ue.getOrDie("URL")},Xk=function(t){return Gk().createObjectURL(t)},Yk=function(t){Gk().revokeObjectURL(t)},qk=function(t){var n=_t(t),e=_t(et.none()),r=function s(){var e=[],o=-1;function t(){return 0<o}function n(){return-1!==o&&o<e.length-1}return{data:e,add:function r(t){var n;return n=e.splice(++o),e.push(t),{state:t,removed:n}},undo:function i(){if(t())return e[--o]},redo:function u(){if(n())return e[++o]},canUndo:t,canRedo:n}}();r.add(t);var i=function(t){n.set(t)},u=function(t){return{blob:t,url:Xk(t)}},a=function(t){Yk(t.url)},o=function(){e.get().each(a),e.set(et.none())},c=function(t){var n=u(t);i(n);var e,o=r.add(n).removed;return e=o,Mk.each(e,a),n.url};return{getBlobState:function(){return n.get()},setBlobState:i,addBlobState:c,getTempState:function(){return e.get().fold(function(){return n.get()},function(t){return t})},updateTempState:function(t){var n=u(t);return o(),e.set(et.some(n)),n.url},addTempState:function(t){var n=u(t);return e.set(et.some(n)),n.url},applyTempState:function(n){return e.get().fold(function(){},function(t){c(t.blob),n()})},destroyTempState:o,undo:function(){var t=r.undo();return i(t),t.url},redo:function(){var t=r.redo();return i(t),t.url},getHistoryStates:function(){return{undoEnabled:r.canUndo(),redoEnabled:r.canRedo()}}}},Kk=function(t,n){var u=qk(t.currentState),a=function(t){var n=u.getHistoryStates();g.updateButtonUndoStates(t,n.undoEnabled,n.redoEnabled),Gr(t,Tk.formActionEvent,{name:Tk.saveState(),value:n.undoEnabled})},c=function(t){return t.toBlob()},s=function(t){Gr(t,Tk.formActionEvent,{name:Tk.disable(),value:{}})},f=function(t){e.getApplyButton(t).each(function(t){ih.enable(t)}),Gr(t,Tk.formActionEvent,{name:Tk.enable(),value:{}})},l=function(t,n){return s(t),r.updateSrc(t,n)},d=function(n,t,e,o,r){return s(n),(i=t,MS(i)).then(e).then(c).then(o).then(function(t){return l(n,t).then(function(t){return a(n),r(),f(n),t})})["catch"](function(t){return x.console.log(t),f(n),t});var i},i=function(t,n,e){var o=u.getBlobState().blob;d(t,o,n,function(t){return u.updateTempState(t)},e)},m=function(t){var n=u.getBlobState().url;return u.destroyTempState(),a(t),n},r=Lk(t.currentState.url),g=Wk(n),e=Bk(r,n);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[e.memContainer.asSpec(),r.memContainer.asSpec(),g.container],behaviours:ia([Lm.config({store:{mode:"manual",getValue:function(){return u.getBlobState()}}}),lg("image-tools-events",[si(kk.undo(),function(n,t){var e=u.undo();l(n,e).then(function(t){f(n),a(n)})}),si(kk.redo(),function(n,t){var e=u.redo();l(n,e).then(function(t){f(n),a(n)})}),si(kk.zoom(),function(t,n){var e=n.event().direction();r.zoom(t,e)}),si(kk.back(),function(t,n){var e,o;o=m(e=t),l(e,o).then(function(t){f(e)}),n.event().swap()(),r.hideCrop()}),si(kk.apply(),function(t,n){u.applyTempState(function(){m(t),n.event().swap()()})}),si(kk.transform(),function(t,n){return i(t,n.event().transform(),tt)}),si(kk.tempTransform(),function(t,n){return e=t,o=n.event().transform(),r=u.getTempState().blob,void d(e,r,o,function(t){return u.addTempState(t)},tt);var e,o,r}),si(kk.transformApply(),function(t,n){return e=t,o=n.event().transform(),r=n.event().swap(),i=u.getBlobState().blob,void d(e,i,o,function(t){var n=u.addBlobState(t);return m(e),n},r);var e,o,r,i}),si(kk.swap(),function(n,t){var e;e=n,g.updateButtonUndoStates(e,!1,!1);var o=t.event().transform(),r=t.event().swap();o.fold(function(){r()},function(t){i(n,t,r)})})]),$w()])}},$k=dl({name:"HtmlSelect",configFields:[br("options"),of("selectBehaviours",[Xm,Lm]),Mr("selectClasses",[]),Mr("selectAttributes",{}),Er("data")],factory:function(e,t){var n=M(e.options,function(t){return{dom:{tag:"option",value:t.value,innerHtml:t.text}}}),o=e.data.map(function(t){return Tt("initialValue",t)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:n,behaviours:uf(e.selectBehaviours,[Xm.config({}),Lm.config({store:ao({mode:"manual",getValue:function(t){return xu(t.element())},setValue:function(t,n){N(e.options,function(t){return t.value===n}).isSome()&&wu(t.element(),n)}},o)})])}}}),Jk=function(e,n){var t=e.label.map(function(t){return xy(t,n)}),o=[km.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:function(t){return Wr(t,Ab),et.some(!0)}}),lg("textfield-change",[si(Kt(),function(t,n){Gr(t,Ob,{name:e.name})}),si(_n(),function(t,n){Gr(t,Ob,{name:e.name})})]),zy.config({})],r=e.validation.map(function(o){return Hy.config({getRoot:function(t){return ye(t.element())},invalidClass:"tox-invalid",validator:{validate:function(t){var n=Lm.getValue(t),e=o.validator(n);return qb.pure(!0===e?vt.value(n):vt.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=Rb.parts().field({tag:!0===e.multiline?"textarea":"input",inputAttributes:e.placeholder.fold(function(){},function(t){return{placeholder:n.translate(t)}}),inputClasses:[e.classname],inputBehaviours:ia(j([o,r])),selectOnFocus:!1,factory:Ty}),u=e.flex?["tox-form__group--stretched"]:[];return hy(t,i,u)},Zk=function(i){return ao({},i,{toCached:function(){return Zk(i.toCached())},bindFuture:function(n){return Zk(i.bind(function(t){return t.fold(function(t){return qb.pure(vt.error(t))},function(t){return n(t)})}))},bindResult:function(n){return Zk(i.map(function(t){return t.bind(n)}))},mapResult:function(n){return Zk(i.map(function(t){return t.map(n)}))},mapError:function(n){return Zk(i.map(function(t){return t.mapError(n)}))},foldResult:function(n,e){return i.map(function(t){return t.fold(n,e)})},withTimeout:function(t,r){return Zk(qb.nu(function(n){var e=!1,o=x.setTimeout(function(){e=!0,n(vt.error(r()))},t);i.get(function(t){e||(x.clearTimeout(o),n(t))})}))}})},Qk=function(t){return Zk(qb.nu(t))},tC=Qk,nC={type:"separator"},eC=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:function(){}}},oC=function(t,n){return{type:"menuitem",value:n,text:t,meta:{attach:undefined},onAction:function(){}}},rC=function(t,n){return o=t,e=R(n,function(t){return t.type===o}),M(e,eC);var e,o},iC=function(t,n){var e=t.toLowerCase();return R(n,function(t){var n=t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.text;return xn(n.toLowerCase(),e)||xn(t.value.toLowerCase(),e)})},uC=function(c,t,s){var n=Lm.getValue(t),f=n.meta.text!==undefined?n.meta.text:n.value;return s.getLinkInformation().fold(function(){return[]},function(t){var n,e,o,r,i,u,a=iC(f,(n=s.getHistory(c),M(n,function(t){return oC(t,t)})));return"file"===c?(e=[a,iC(f,(u=t,rC("header",u.targets))),iC(f,j([(i=t,et.from(i.anchorTop).map(function(t){return oC("<top>",t)}).toArray()),(r=t,rC("anchor",r.targets)),(o=t,et.from(o.anchorBottom).map(function(t){return oC("<bottom>",t)}).toArray())]))],U(e,function(t,n){return 0===t.length||0===n.length?t.concat(n):t.concat(nC,n)},[])):a})},aC=io("aria-invalid"),cC=function(i,o,r){var t,n,e,u,a,c=o.shared.providers,s=function(t){var n=Lm.getValue(t);r.addToHistory(n.value,i.filetype)},f=Rb.parts().field({factory:py,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":aC},minChars:0,responseTime:0,fetch:function(t){var n=uC(i.filetype,t,r),e=Ey(n,gh.BUBBLE_TO_SANDBOX,o);return qb.pure(e)},getHotspot:function(t){return h.getOpt(t)},onSetValue:function(t,n){t.hasConfigured(Hy)&&Hy.run(t).get(tt)},typeaheadBehaviours:ia(j([r.getValidationHandler().map(function(o){return Hy.config({getRoot:function(t){return ye(t.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:function(t,n){d.getOpt(t).each(function(t){ze(t.element(),"title",c.translate(n))})}},validator:{validate:function(t){var e=Lm.getValue(t);return tC(function(n){o({type:i.filetype,url:e.value},function(t){n(("invalid"===t.status?vt.error:vt.value)(t.message))})})},validateOnLoad:!1}})}).toArray(),[zy.config({}),lg("urlinput-events",j(["file"===i.filetype?[si(Kt(),function(t){Gr(t,Ob,{name:i.name})})]:[],[si($t(),function(t){Gr(t,Ob,{name:i.name}),s(t)}),si(_n(),function(t){Gr(t,Ob,{name:i.name}),s(t)})]]))]])),eventOrder:(t={},t[Kt()]=["streaming","urlinput-events","invalidating"],t),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"dog"},lazySink:o.shared.getSink,parts:{menu:Sv(0,0,"normal")},onExecute:function(t,n,e){Gr(n,Ab,{})},onItemExecute:function(t,n,e,o){s(t),Gr(t,Ob,{name:i.name})}}),l=i.label.map(function(t){return xy(t,c)}),d=Ag((n="invalid",e=et.some(aC),void 0===(u="warning")&&(u=n),void 0===a&&(a=n),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+n],innerHtml:_g(u,c.icons),attributes:ao({title:c.translate(a),"aria-live":"polite"},e.fold(function(){return{}},function(t){return{id:t}}))}})),m=Ag({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[d.asSpec()]}),g=r.getUrlPicker(i.filetype),p=io("browser.url.event"),h=Ag({dom:{tag:"div",classes:["tox-control-wrap"]},components:[f,m.asSpec()]});return Rb.sketch({dom:yy([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:j([[h.asSpec()],g.map(function(){return t=i.label,n=p,e="tox-browse-url",o="browse",r=c,Bg.sketch({dom:{tag:"button",classes:["tox-tbtn",e],innerHtml:_g(o,r.icons),attributes:{title:r.translate(t.getOr(""))}},buttonBehaviours:ia([zy.config({})]),action:function(t){Wr(t,n)}});var t,n,e,o,r}).toArray()])}]),fieldBehaviours:ia([lg("url-input-events",[si(p,function(o){vl.getCurrent(o).each(function(n){var e=Lm.getValue(n);g.each(function(t){t(e).get(function(t){Lm.setValue(n,t),Gr(o,Ob,{name:i.name})})})})})])])})},sC=function(u,n){var t,e,o=u.label.map(function(t){return xy(t,n)}),r=function(e){return function(n,t){Ru(t.event().target(),"[data-collection-item-value]").each(function(t){e(n,t,je(t,"data-collection-item-value"))})}},i=[si(Wt(),r(function(t,n){jl(n)})),si(Rn(),r(function(t,n,e){Gr(t,Bb,{name:u.name,value:e})})),si(Gt(),r(function(t,n,e){Vu(t.element(),"."+Fp).each(function(t){ru(t,Fp)}),ou(n,Fp)})),si(Xt(),r(function(t,n,e){Vu(t.element(),"."+Fp).each(function(t){ru(t,Fp)})})),wi(r(function(t,n,e){Gr(t,Bb,{name:u.name,value:e})}))],a=Rb.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==u.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:d},behaviours:ia([Bm.config({}),Lm.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,t){var n,e,r,i;n=o,e=M(t,function(t){var n,e=1===u.columns?'<div class="tox-collection__item-label">'+t.text+"</div>":"",o='<div class="tox-collection__item-icon">'+t.icon+"</div>",r={_:" "," - ":" ","-":" "},i=t.text.replace(/\_| \- |\-/g,function(t){return r[t]});return'<div class="tox-collection__item" tabindex="-1" data-collection-item-value="'+('"'===(n=t.value)?"&quot;":n)+'" title="'+i+'" aria-label="'+i+'">'+o+e+"</div>"}),r=1<u.columns&&"auto"!==u.columns?A(e,u.columns):[e],i=M(r,function(t){return'<div class="tox-collection__group">'+t.join("")+"</div>"}),Me(n.element(),i.join("")),"auto"===u.columns&&mp(o,5,"tox-collection__item").each(function(t){var n=t.numRows,e=t.numColumns;km.setGridSize(o,n,e)}),Wr(o,Fb)}}),zy.config({}),km.config((t=u.columns,e="normal",1===t?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===t?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===e?".tox-swatches__row":".tox-collection__group",cell:"color"===e?"."+Bp:"."+Tp}})),lg("collection-events",i)])});return hy(o,a,["tox-form__group--collection"])},fC=function(r){return function(n,e,o){return Et(e,"name").fold(function(){return r(e,o)},function(t){return n.field(t,r(e,o))})}},lC={bar:fC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-bar"]},components:M(e.items,o.interpreter)};var e,o}),collection:fC(function(t,n){return sC(t,n.shared.providers)}),alloy:fC(d),alertbanner:fC(function(t,n){return e=t,o=n.shared.providers,gb.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"]},components:[Bg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:_g(e.icon,o.icons),attributes:{title:o.translate(e.actionLabel)}},action:function(t){Gr(t,Bb,{name:"alert-banner",value:e.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:o.translate(e.text)}}]});var e,o}),input:fC(function(t,n){return e=t,o=n.shared.providers,Jk({name:e.name,multiline:!1,label:e.label,placeholder:e.placeholder,flex:!1,classname:"tox-textfield",validation:et.none()},o);var e,o}),textarea:fC(function(t,n){return e=t,o=n.shared.providers,Jk({name:e.name,multiline:!0,label:e.label,placeholder:e.placeholder,flex:!0,classname:"tox-textarea",validation:et.none()},o);var e,o}),listbox:fC(function(t,n){return e=t,o=n.shared.providers,r=xy(e.label,o),i=Rb.parts().field({factory:$k,dom:{classes:["mce-select-field"]},selectBehaviours:ia([zy.config({})]),options:e.values,data:e.initialValue.getOr(undefined)}),vy(et.some(r),i);var e,o,r,i}),label:fC(function(t,n){return e=t,o=n.shared,r={dom:{tag:"label",innerHtml:o.providers.translate(e.label),classes:["tox-label"]}},i=M(e.items,o.interpreter),{dom:{tag:"div",classes:["tox-form__group"]},components:[r].concat(i),behaviours:ia([$w(),Bm.config({}),uS(et.none()),km.config({mode:"acyclic"})])};var e,o,r,i}),iframe:(Rk=function(t,n){return vS(t,n.shared.providers)},function(t,n,e){var o=wt(n,{source:"dynamic"});return fC(Rk)(t,o,e)}),autocomplete:fC(function(t,n){return i=n,e=xy((r=t).label.getOr("?"),i.shared.providers),o=Rb.parts().field({factory:py,dismissOnBlur:!1,inputClasses:["tox-textfield"],minChars:1,fetch:function(t){var n=Lm.getValue(t),e=r.getItems(n),o=Ey(e,gh.BUBBLE_TO_SANDBOX,i);return qb.pure(o)},markers:{openClass:"dog"},lazySink:i.shared.getSink,parts:{menu:Sv(0,0,"normal")}}),vy(et.some(e),o);var r,i,e,o}),button:fC(function(t,n){return e=t,o=n.shared.providers,r=dk(e.name,"custom"),lk(e,r,o,[aS(""),$w()]);var e,o,r}),checkbox:fC(function(t,n){return e=t,o=n.shared.providers,r=Lm.config({store:{mode:"manual",getValue:function(t){return t.element().dom().checked},setValue:function(t,n){t.element().dom().checked=n}}}),i=function(t){return t.element().dom().click(),et.some(!0)},u=Rb.parts().field({factory:{sketch:d},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:ia([$w(),zy.config({}),Xm.config({}),r,km.config({mode:"special",onEnter:i,onSpace:i,stopSpaceKeyup:!0}),lg("checkbox-events",[si($t(),function(t,n){Gr(t,Ob,{name:e.name})})])])}),a=Rb.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:o.translate(e.label)},behaviours:ia([Wy.config({})])}),s=Ag({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[(c=function(t){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t],innerHtml:_g("checked"===t?"selected":"unselected",o.icons)}}})("checked"),c("unchecked")]}),Rb.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[u,s.asSpec(),a]});var e,o,r,i,u,a,c,s}),colorinput:fC(function(t,n){return qy(t,n.shared,n.colorinput)}),colorpicker:fC(function(t){var n=function(t){return"tox-"+t},e=Kw(tS,n),r=Ag(e.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:function(t){Gr(t,Bb,{name:"hex-valid",value:!0})},onInvalidHex:function(t){Gr(t,Bb,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:ia([Lm.config({store:{mode:"manual",getValue:function(t){var n=r.get(t);return vl.getCurrent(n).bind(function(t){return Lm.getValue(t).hex}).map(function(t){return"#"+t}).getOr("")},setValue:function(t,n){var e=/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(n),o=r.get(t);vl.getCurrent(o).fold(function(){x.console.log("Can not find form")},function(t){Lm.setValue(t,{hex:et.from(e[1]).getOr("")}),jw.getField(t,"hex").each(function(t){Wr(t,Kt())})})}}}),$w()])}}),dropzone:fC(function(t,n){return cS(t,n.shared.providers)}),grid:fC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+e.columns+"col"]},components:M(e.items,o.interpreter)};var e,o}),selectbox:fC(function(t,n){return e=t,o=n.shared.providers,r=M(e.items,function(t){return{text:o.translate(t.text),value:t.value}}),i=e.label.map(function(t){return xy(t,o)}),u=Rb.parts().field({dom:{},selectAttributes:{size:e.size},options:r,factory:$k,selectBehaviours:ia([zy.config({}),lg("selectbox-change",[si($t(),function(t,n){Gr(t,Ob,{name:e.name})})])])}),a=1<e.size?et.none():et.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:_g("chevron-down",o.icons)}}),c={dom:{tag:"div",classes:["tox-selectfield"]},components:j([[u],a.toArray()])},Rb.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:j([i.toArray(),[c]])});var e,o,r,i,u,a,c}),sizeinput:fC(function(t,n){return Sk(t,n.shared.providers)}),urlinput:fC(function(t,n){return cC(t,n,n.urlinput)}),customeditor:fC(function(n){var e=_t(et.none()),o=Ag({dom:{tag:n.tag}}),r=_t(et.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:ia([lg("editor-foo-events",[bi(function(t){o.getOpt(t).each(function(t){n.init(t.element().dom()).then(function(n){r.get().each(function(t){n.setValue(t)}),r.set(et.none()),e.set(et.some(n))})})})]),Lm.config({store:{mode:"manual",getValue:function(){return e.get().fold(function(){return r.get().getOr("")},function(t){return t.getValue()})},setValue:function(t,n){e.get().fold(function(){r.set(et.some(n))},function(t){return t.setValue(n)})}}}),$w()]),components:[o.asSpec()]}}),htmlpanel:fC(function(t){return"presentation"===t.presets?gb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):gb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:ia([zy.config({}),Xm.config({})])})}),imagetools:fC(function(t,n){return Kk(t,n.shared.providers)}),table:fC(function(t,n){return e=t,o=n.shared.providers,u=function(t){return{dom:{tag:"th",innerHtml:o.translate(t)}}},a=function(t){return{dom:{tag:"td",innerHtml:o.translate(t)}}},c=function(t){return{dom:{tag:"tr"},components:M(t,a)}},{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(i=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:M(i,u)}]}),(r=e.cells,{dom:{tag:"tbody"},components:M(r,c)})],behaviours:ia([zy.config({}),Xm.config({})])};var e,o,r,i,u,a,c})},dC={field:function(t,n){return n}},mC=function(n,t,e){var o=wt(e,{shared:{interpreter:function(t){return gC(n,t,o)}}});return gC(n,t,o)},gC=function(n,e,o){return Et(lC,e.type).fold(function(){return x.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(t){return t(n,e,o)})},pC=function(t){return t.y()},hC=function(t,n,e){return dc(t.x(),pC(t),e.northeast(),Fa(),"layout-ne")},vC=function(t,n,e){return dc((r=n,(o=t).x()+o.width()-r.width()),pC(t),e.northwest(),Ia(),"layout-nw");var o,r},bC=function(t,n,e){return dc((r=n,(o=t).x()+o.width()/2-r.width()/2),pC(t),e.north(),Ra(),"layout-n");var o,r},yC={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},xC=function(t,n,e){var o,r,i,u,a,c,s,f,l,d,m=Cb(t),g=function(){return Qn.fromDom(t.getBody())};return{toolbar:(f=g,l=n,d=m,d?function(){return{anchor:"node",root:f(),node:et.from(f()),bubble:fc(-12,-12,yC),layouts:{onRtl:function(){return[hC]},onLtr:function(){return[vC]}}}}:function(){return{anchor:"hotspot",hotspot:l(),bubble:fc(-12,12,yC),layouts:{onRtl:function(){return[yc]},onLtr:function(){return[xc]}}}}),toolbarOverflow:(s=e,function(){return{anchor:"hotspot",hotspot:s(),layouts:{onRtl:function(){return[yc]},onLtr:function(){return[xc]}}}}),banner:(u=g,a=n,c=e,c?function(){return{anchor:"node",root:u(),node:et.from(u()),layouts:{onRtl:function(){return[bC]},onLtr:function(){return[bC]}}}}:function(){return{anchor:"hotspot",hotspot:a(),layouts:{onRtl:function(){return[Cc]},onLtr:function(){return[Cc]}}}}),cursor:(r=t,i=g,function(){return{anchor:"selection",root:i(),getSelection:function(){var t=r.selection.getRng();return et.some(Hc(Qn.fromDom(t.startContainer),t.startOffset,Qn.fromDom(t.endContainer),t.endOffset))}}}),node:(o=g,function(t){return{anchor:"node",root:o(),node:t}})}},wC=function(t){return{colorPicker:(r=t,function(t,n){hv.colorPickerDialog(r)(t,n)}),hasCustomColors:(o=t,function(){return Zh(o)}),getColors:(e=t,function(){return Qh(e)}),getColorCols:(n=t,function(){return hv.getColorCols(n)})};var n,e,o,r},SC=[{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",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strike-through",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"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",icon:"align-left",format:"alignleft"},{title:"Center",icon:"align-center",format:"aligncenter"},{title:"Right",icon:"align-right",format:"alignright"},{title:"Justify",icon:"align-justify",format:"alignjustify"}]}],kC=function(t){return U(t,function(t,n){if(lt(n,"items")){var e=kC(n.items);return{customFormats:t.customFormats.concat(e.customFormats),formats:t.formats.concat([{title:n.title,items:e.formats}])}}if(lt(n,"inline")||lt(n,"block")||lt(n,"selector")){var o="custom-"+n.title.toLowerCase();return{customFormats:t.customFormats.concat([{name:o,format:n}]),formats:t.formats.concat([{title:n.title,format:o,icon:n.icon}])}}return ao({},t,{formats:t.formats.concat(n)})},{customFormats:[],formats:[]})},CC=function(i){return(t=i,et.from(t.getParam("style_formats")).filter(D)).map(function(t){var n,e,o,r=(n=i,e=kC(t),o=function(t){F(t,function(t){n.formatter.has(t.name)||n.formatter.register(t.name,t.format)})},n.formatter?o(e.customFormats):n.on("init",function(){o(e.customFormats)}),e.formats);return i.getParam("style_formats_merge",!1,"boolean")?SC.concat(r):r}).getOr(SC);var t},OC=function(t,n,e){var o={type:"formatter",isSelected:n(t.format),getStylePreview:e(t.format)};return wt(t,o)},EC=function(s,t,f,l){var d=function(t){return M(t,function(t){var n,e,o,r,i,u,a=Q(t);if(Dt(t,"items")){var c=d(t.items);return wt((i=t,u={type:"submenu",isSelected:nt(!1),getStylePreview:function(){return et.none()}},wt(i,u)),{getStyleItems:function(){return c}})}return Dt(t,"format")?OC(t,f,l):1===a.length&&T(a,"title")?wt(t,{type:"separator"}):(e=io((n=t).title),o={type:"formatter",format:e,isSelected:f(e),getStylePreview:l(e)},r=wt(n,o),s.formatter.register(e,r),r)})};return d(t)},TC=Mk.trim,BC=function(n){return function(t){if(t&&1===t.nodeType){if(t.contentEditable===n)return!0;if(t.getAttribute("data-mce-contenteditable")===n)return!0}return!1}},AC=BC("true"),DC=BC("false"),_C=function(t,n,e,o,r){return{type:t,title:n,url:e,level:o,attach:r}},MC=function(t){return t.innerText||t.textContent},FC=function(t){return(n=t)&&"A"===n.nodeName&&(n.id||n.name)!==undefined&&VC(t);var n},IC=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},VC=function(t){return function(t){for(;t=t.parentNode;){var n=t.contentEditable;if(n&&"inherit"!==n)return AC(t)}return!1}(t)&&!DC(t)},RC=function(t){return IC(t)&&VC(t)},HC=function(t){var n,e,o=(n=t).id?n.id:io("h");return _C("header",MC(t),"#"+o,IC(e=t)?parseInt(e.nodeName.substr(1),10):0,function(){t.id=o})},NC=function(t){var n=t.id||t.name,e=MC(t);return _C("anchor",e||"#"+n,"#"+n,0,tt)},PC=function(t){var n,e;return n="h1,h2,h3,h4,h5,h6,a:not([href])",e=t,M(Qc(Qn.fromDom(e),n),function(t){return t.dom()})},zC=function(t){return 0<TC(t.title).length},LC=function(t){var n,e=PC(t);return R((n=e,M(R(n,RC),HC)).concat(M(R(e,FC),NC)),zC)},jC="tinymce-url-history",UC=function(t){return S(t)&&/^https?/.test(t)},WC=function(t){return k(t)&&ct(t,function(t){return!(D(n=t)&&n.length<=5&&G(n,UC));var n}).isNone()},GC=function(){var t,n=x.localStorage.getItem(jC);if(null===n)return{};try{t=JSON.parse(n)}catch(e){if(e instanceof SyntaxError)return x.console.log("Local storage "+jC+" was not valid JSON",e),{};throw e}return WC(t)?t:(x.console.log("Local storage "+jC+" was not valid format",t),{})},XC=function(t){var n=GC();return Object.prototype.hasOwnProperty.call(n,t)?n[t]:[]},YC=function(n,t){if(UC(n)){var e=GC(),o=Object.prototype.hasOwnProperty.call(e,t)?e[t]:[],r=R(o,function(t){return t!==n});e[t]=[n].concat(r).slice(0,5),function(t){if(!WC(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));x.localStorage.setItem(jC,JSON.stringify(t))}(e)}},qC=Object.prototype.hasOwnProperty,KC=function(t){return!!t},$C=function(t){return it(Mk.makeMap(t,/[, ]/),KC)},JC=function(t,n,e){var o,r,i=(o=t,r=n,qC.call(o,r)?et.some(o[r]):et.none()).getOr(e);return S(i)?et.some(i):et.none()},ZC=function(t){return et.some(t.file_picker_callback).filter(b)},QC=function(t,n){var e,o,r,i,u=(e=t,o=et.some(e.file_picker_types).filter(KC),r=et.some(e.file_browser_callback_types).filter(KC),i=o.or(r).map($C),ZC(e).fold(function(){return!1},function(t){return i.fold(function(){return!0},function(t){return 0<Q(t).length&&t})}));return C(u)?u?ZC(t):et.none():u[n]?ZC(t):et.none()},tO=function(n){return{getHistory:XC,addToHistory:YC,getLinkInformation:function(){return!1===(t=n).settings.typeahead_urls?et.none():et.some({targets:LC(t.getBody()),anchorTop:JC(t.settings,"anchor_top","#top").getOrUndefined(),anchorBottom:JC(t.settings,"anchor_bottom","#bottom").getOrUndefined()});var t},getValidationHandler:function(){return t=n.settings.filepicker_validator_handler,b(t)?et.some(t):et.none();var t},getUrlPicker:function(t){return i=t,QC((r=n).settings,i).map(function(o){return function(n){return qb.nu(function(e){var t=Mk.extend({filetype:i},et.from(n.meta).getOr({}));o.call(r,function(t,n){if(!S(t))throw new Error("Expected value to be string");if(n!==undefined&&!k(n))throw new Error("Expected meta to be a object");e({value:t,meta:n})},n.value,t)})}});var r,i}}},nO=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m={shared:{providers:{icons:function(){return n.ui.registry.getAll().icons},menuItems:function(){return n.ui.registry.getAll().menuItems},translate:Op.translate},interpreter:function(t){return gC(dC,t,m)},anchors:xC(n,e,o),getSink:function(){return vt.value(t)}},urlinput:tO(n),styleselect:(r=n,i=function(t){return function(){return r.formatter.match(t)}},u=function(n){return function(){var t=r.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:r.formatter.getCssText(n)}):et.none()}},a=function(t){var n=t.items;return n!==undefined&&0<n.length?W(n,a):[t.format]},c=_t([]),s=_t([]),f=_t([]),l=_t([]),d=_t(!1),r.on("init",function(){var t=CC(r),n=EC(r,t,i,u);c.set(n),s.set(W(n,a))}),r.on("addStyleModifications",function(t){var n=EC(r,t.items,i,u);f.set(n),d.set(t.replace),l.set(W(n,a))}),{getData:function(){var t=d.get()?[]:c.get(),n=f.get();return t.concat(n)},getFlattenedKeys:function(){var t=d.get()?[]:s.get(),n=l.get();return t.concat(n)}}),colorinput:wC(n)};return m},eO=nt([br("dom"),Mr("shell",!0),of("toolbarBehaviours",[Bm])]),oO=nt([Hf({name:"groups",overrides:function(t){return{behaviours:ia([Bm.config({})])}}})]),rO=ml({name:"Toolbar",configFields:eO(),partFields:oO(),factory:function(n,t,e,o){var r=function(t){return n.shell?et.some(t):Kf(t,n,"groups")},i=n.shell?{behaviours:[Bm.config({})],components:[]}:{behaviours:[],components:t};return{uid:n.uid,dom:n.dom,components:i.components,behaviours:uf(n.toolbarBehaviours,i.behaviours),apis:{setGroups:function(t,n){r(t).fold(function(){throw x.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")},function(t){Bm.set(t,n)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)}}}),iO=te("within","extra","withinWidth"),uO=function(t,n,o){var e,r=(e=function(t,n){var e=o(t);return et.some({element:nt(t),start:nt(n),finish:nt(n+e),width:nt(e)})},U(t,function(n,t){return e(t,n.len).fold(nt(n),function(t){return{len:t.finish(),list:n.list.concat([t])}})},{len:0,list:[]}).list),i=R(r,function(t){return t.finish()<=n}),u=H(i,function(t,n){return t+n.width()},0),a=r.slice(i.length);return{within:nt(i),extra:nt(a),withinWidth:nt(u)}},aO=function(t){return M(t,function(t){return t.element()})},cO=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p,h=(r=t,i=n,u=e,a=uO(i,r,u),0===a.extra().length?et.some(a):et.none()).getOrThunk(function(){return uO(n,t-e(o),e)}),v=h.within(),b=h.extra(),y=h.withinWidth();return 1===b.length&&b[0].width()<=e(o)?(m=b,g=y,p=aO(v.concat(m)),iO(p,[],g)):1<=b.length?(s=b,f=o,l=y,d=aO(v).concat([f]),iO(d,aO(s),l)):(c=y,iO(aO(v),[],c))},sO=function(t,n){var e=M(n,function(t){return Mu(t)});rO.setGroups(t,e)},fO=function(t,n,e,o){var r=$f(t,n,"primary"),i=Kf(t,n,"overflow-button"),u=Pb.getCoupled(t,"overflowGroup");lu(r.element(),"visibility","hidden");var a,c=(a=i,e.bind(function(n){return Wl(n.element()).bind(function(t){return n.getSystem().getByDom(t).toOption()})}).orThunk(function(){return a.filter(Xm.isFocused)}));e.each(function(t){rO.setGroups(t,[])});var s=n.builtGroups.get();sO(r,s.concat([u]));var f=ka(r.element()),l=cO(f,s,function(t){return ka(t.element())},u);0===l.extra().length?(Bm.remove(r,u),e.each(function(t){rO.setGroups(t,[])})):(sO(r,l.within()),e.each(function(t){sO(t,l.extra())})),bu(r.element(),"visibility"),yu(r.element()),e.each(function(n){i.each(function(t){return rg.set(t,o(n))}),c.each(Xm.focus)})},lO=nt([br("items"),Gu(["itemSelector"]),of("tgroupBehaviours",[km])]),dO=nt([Nf({name:"items",unit:"item"})]),mO=ml({name:"ToolbarGroup",configFields:lO(),partFields:dO(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,behaviours:uf(t.tgroupBehaviours,[km.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),gO=nt([of("splitToolbarBehaviours",[]),zr("builtGroups",function(){return _t([])})]),pO=function(o,t,n,e,r){var i="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:t,behaviours:uf(o.splitToolbarBehaviours,[Pb.config({others:ao({},r.coupling,{overflowGroup:function(n){return mO.sketch(ao({},e["overflow-group"](),{items:[Bg.sketch(ao({},e["overflow-button"](),{action:function(t){Wr(n,i)}}))]}))}})}),lg("toolbar-toggle-events",[si(i,function(t){r.toggleToolbar(t,o,e)})])]),apis:{setGroups:function(t,n){var e;e=M(n,t.getSystem().build),o.builtGroups.set(e),r.refresh(t,o)},refresh:function(t){r.refresh(t,o)},getMoreButton:function(t){return Kf(t,o,"overflow-button")},getOverflow:function(t){return n=t,r.getOverflow(n);var n},toggle:function(t){r.toggleToolbar(t,o,e)}},domModification:{attributes:{role:"group"}}}},hO=nt([Gu(["overflowToggledClass"]),br("getAnchor"),br("lazySink")].concat(gO())),vO=nt([Vf({factory:rO,schema:eO(),name:"primary"}),Rf({factory:rO,schema:eO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:ia([km.config({mode:"cyclic",onEscape:function(t){return Kf(t,n,"overflow-button").each(Xm.focus),et.none()}})])}}}),Rf({name:"overflow-button",overrides:function(t){return{dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:ia([rg.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])}}}),Rf({name:"overflow-group"})]),bO=function(t,n,e){var o=Pb.getCoupled(t,"sandbox");Js.isOpen(o)?Js.close(o):Js.open(o,e.overflow())},yO=function(t){return t.getSystem().isConnected()},xO=function(o,r){var t=Js.getState(Pb.getCoupled(o,"sandbox"));fO(o,r,t,yO),t.each(function(t){var n=r.lazySink(o).getOrDie(),e=r.getAnchor(o);Ms.position(n,e,t)})},wO=ml({name:"SplitFloatingToolbar",configFields:hO(),partFields:vO(),factory:function(n,t,e,o){return pO(n,t,0,o,{refresh:xO,toggleToolbar:bO,getOverflow:function(t){return Js.getState(Pb.getCoupled(t,"sandbox"))},coupling:{sandbox:function(t){return o=t,e=n,{dom:{tag:"div",attributes:{id:(r=Hu()).id()}},behaviours:ia([km.config({mode:"special",onEscape:function(t){return Js.close(t),et.some(!0)}}),Js.config({onOpen:function(t,n){xO(o,e),Kf(o,e,"overflow-button").each(function(t){rg.on(t),r.link(t.element())}),km.focusIn(n)},onClose:function(){Kf(o,e,"overflow-button").each(function(t){rg.off(t),Xm.focus(t),r.unlink(t.element())})},isPartOf:function(t,n,e){return Pu(n,e)||Pu(o,e)},getAttachPoint:function(){return e.lazySink(o).getOrDie()}})])};var o,e,r}}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),SO=function(n,t){return t.getAnimationRoot.fold(function(){return n.element()},function(t){return t(n)})},kO=function(t){return t.dimension.property},CO=function(t,n){return t.dimension.getDimension(n)},OO=function(t,n){var e=SO(t,n);au(e,[n.shrinkingClass,n.growingClass])},EO=function(t,n){ru(t.element(),n.openClass),ou(t.element(),n.closedClass),lu(t.element(),kO(n),"0px"),yu(t.element())},TO=function(t,n){ru(t.element(),n.closedClass),ou(t.element(),n.openClass),bu(t.element(),kO(n))},BO=function(t,n,e,o){e.setCollapsed(),lu(t.element(),kO(n),CO(n,t.element())),yu(t.element()),OO(t,n),EO(t,n),n.onStartShrink(t),n.onShrunk(t)},AO=function(t,n,e,o){var r=o.getOrThunk(function(){return CO(n,t.element())});e.setCollapsed(),lu(t.element(),kO(n),r),yu(t.element());var i=SO(t,n);ru(i,n.growingClass),ou(i,n.shrinkingClass),EO(t,n),n.onStartShrink(t)},DO=function(t,n,e){var o=CO(n,t.element());("0px"===o?BO:AO)(t,n,e,et.some(o))},_O=function(t,n,e){var o=SO(t,n),r=iu(o,n.shrinkingClass),i=CO(n,t.element());TO(t,n);var u=CO(n,t.element());(r?function(){lu(t.element(),kO(n),i),yu(t.element())}:function(){EO(t,n)})(),ru(o,n.shrinkingClass),ou(o,n.growingClass),TO(t,n),lu(t.element(),kO(n),u),e.setExpanded(),n.onStartGrow(t)},MO=function(t,n,e){var o=SO(t,n);return!0===iu(o,n.growingClass)},FO=function(t,n,e){var o=SO(t,n);return!0===iu(o,n.shrinkingClass)},IO=/* */Object.freeze({refresh:function(t,n,e){if(e.isExpanded()){bu(t.element(),kO(n));var o=CO(n,t.element());lu(t.element(),kO(n),o)}},grow:function(t,n,e){e.isExpanded()||_O(t,n,e)},shrink:function(t,n,e){e.isExpanded()&&DO(t,n,e)},immediateShrink:function(t,n,e){e.isExpanded()&&BO(t,n,e,et.none())},hasGrown:function(t,n,e){return e.isExpanded()},hasShrunk:function(t,n,e){return e.isCollapsed()},isGrowing:MO,isShrinking:FO,isTransitioning:function(t,n,e){return!0===MO(t,n)||!0===FO(t,n)},toggleGrow:function(t,n,e){(e.isExpanded()?DO:_O)(t,n,e)},disableTransitions:OO}),VO=/* */Object.freeze({exhibit:function(t,n){var e=n.expanded;return Ui(e?{classes:[n.openClass],styles:{}}:{classes:[n.closedClass],styles:Tt(n.dimension.property,"0px")})},events:function(e,o){return ii([vi(Zt(),function(t,n){n.event().raw().propertyName===e.dimension.property&&(OO(t,e),o.isExpanded()&&bu(t.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(t))})])}}),RO=[br("closedClass"),br("openClass"),br("shrinkingClass"),br("growingClass"),Er("getAnimationRoot"),Yu("onShrunk"),Yu("onStartShrink"),Yu("onGrown"),Yu("onStartGrow"),Mr("expanded",!1),yr("dimension",fr("property",{width:[Ju("property","width"),Ju("getDimension",function(t){return ka(t)+"px"})],height:[Ju("property","height"),Ju("getDimension",function(t){return Ea(t)+"px"})]}))],HO=aa({fields:RO,name:"sliding",active:VO,apis:IO,state:/* */Object.freeze({init:function(t){var n=_t(t.expanded);return Li({isExpanded:function(){return!0===n.get()},isCollapsed:function(){return!1===n.get()},setCollapsed:g(n.set,!1),setExpanded:g(n.set,!0),readState:function(){return"expanded: "+n.get()}})}})}),NO=nt([Gu(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"])].concat(gO())),PO=nt([Vf({factory:rO,schema:eO(),name:"primary"}),Vf({factory:rO,schema:eO(),name:"overflow",overrides:function(n){return{toolbarBehaviours:ia([HO.config({dimension:{property:"height"},closedClass:n.markers.closedClass,openClass:n.markers.openClass,shrinkingClass:n.markers.shrinkingClass,growingClass:n.markers.growingClass,onShrunk:function(t){Kf(t,n,"overflow-button").each(function(t){rg.off(t),Xm.focus(t)})},onGrown:function(t){km.focusIn(t)},onStartGrow:function(t){Kf(t,n,"overflow-button").each(rg.on)}}),km.config({mode:"acyclic",onEscape:function(t){return Kf(t,n,"overflow-button").each(Xm.focus),et.some(!0)}})])}}}),Rf({name:"overflow-button",overrides:function(t){return{buttonBehaviours:ia([rg.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])}}}),Rf({name:"overflow-group"})]),zO=function(n,e){Kf(n,e,"overflow").each(function(t){jO(n,e),HO.toggleGrow(t)})},LO=function(t){return HO.hasGrown(t)},jO=function(t,n){var e=Kf(t,n,"overflow");fO(t,n,e,LO),e.each(HO.refresh)},UO=ml({name:"SplitSlidingToolbar",configFields:NO(),partFields:PO(),factory:function(n,t,e,o){return pO(n,t,0,o,{refresh:jO,toggleToolbar:zO,getOverflow:function(t){return Kf(t,n,"overflow")},coupling:{}})},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)},toggle:function(t,n){t.toggle(n)}}}),WO="silver.readonly",GO=Go([(Hk="readonly",yr(Hk,pr))]),XO=function(t,n){var e,o,r,i=t.outerContainer;o=n,r=(e=t).outerContainer.element(),o&&(e.mothership.broadcastOn([Zs()],{target:r}),e.uiMothership.broadcastOn([Zs()],{target:r})),e.mothership.broadcastOn([WO],{readonly:o}),e.uiMothership.broadcastOn([WO],{readonly:o}),ge("*",i.element()).forEach(function(t){i.getSystem().getByDom(t).each(function(t){t.hasConfigured(ih)&&ih.set(t,n)})})},YO=function(t,n){t.on("init",function(){t.readonly&&XO(n,!0)}),t.on("SwitchMode",function(){return XO(n,t.readonly)}),t.getParam("readonly",!1,"boolean")&&t.setMode("readonly")},qO=function(n){var t;return ma.config({channels:(t={},t[WO]={schema:GO,onReceive:function(t,o){n(t).each(function(t){var n,e;n=t,e=o.readonly,ge("*",n.element()).forEach(function(t){n.getSystem().getByDom(t).each(function(t){t.hasConfigured(ih)&&ih.set(t,e)})})})}},t)})},KO=function(t){var n=t.title.fold(function(){return{}},function(t){return{attributes:{title:t}}});return{dom:ao({tag:"div",classes:["tox-toolbar__group"]},n),components:[mO.parts().items({})],items:t.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled])"},tgroupBehaviours:ia([zy.config({}),Xm.config({})])}},$O=function(t){return mO.sketch(KO(t))},JO=function(e,t,n){var o=bi(function(t){var n=M(e.initGroups,$O);rO.setGroups(t,n)});return ia([km.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),lg("toolbar-events",[o]),qO(n)])},ZO=function(t,n){var e=t.cyclicKeying?"cyclic":"acyclic";return{uid:t.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":KO({title:et.none(),items:[]}),"overflow-button":sk({name:"more",icon:et.some("more-drawer"),disabled:!1,tooltip:et.some("More...")},et.none(),t.backstage.shared.providers)},splitToolbarBehaviours:JO(t,e,n)}},QO=function(t){var n=ZO(t,wO.getOverflow),e=wO.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return wO.sketch(ao({},n,{lazySink:t.getSink,getAnchor:function(){return t.backstage.shared.anchors.toolbarOverflow()},parts:ao({},n.parts,{overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"]}}}),components:[e],markers:{overflowToggledClass:"tox-tbtn--enabled"}}))},tE=function(t){var n=UO.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),e=UO.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),o=ZO(t,UO.getOverflow);return UO.sketch(ao({},o,{components:[n,e],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"}}))},nE=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return rO.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"]},components:[rO.parts().groups({})],toolbarBehaviours:JO(t,n,nt(et.none()))})},eE=[Hr("disabled",!1),Ar("tooltip"),Ar("icon"),Ar("text"),Nr("onSetup",function(){return tt})],oE=Go([xr("type"),Sr("onAction")].concat(eE)),rE=function(t){return ur("toolbarbutton",oE,t)},iE=Go([xr("type"),Ar("tooltip"),Ar("icon"),Ar("text"),Sr("fetch"),Nr("onSetup",function(){return tt})]),uE=function(t){return ur("menubutton",iE,t)},aE=Go([xr("type"),Ar("tooltip"),Ar("icon"),Ar("text"),Dr("select"),Sr("fetch"),Nr("onSetup",function(){return tt}),Rr("presets","normal",["normal","color","listpreview"]),Mr("columns",1),Sr("onAction"),Sr("onItemAction")]),cE=[Hr("active",!1)].concat(eE),sE=Go(cE.concat([xr("type"),Sr("onAction")])),fE=function(t){return ur("ToggleButton",sE,t)},lE=[Nr("predicate",function(){return!1}),Rr("scope","node",["node","editor"]),Rr("position","selection",["node","selection","line"])],dE=eE.concat([Mr("type","contextformbutton"),Mr("primary",!1),Sr("onAction"),zr("original",d)]),mE=cE.concat([Mr("type","contextformbutton"),Mr("primary",!1),Sr("onAction"),zr("original",d)]),gE=eE.concat([Mr("type","contextformbutton")]),pE=cE.concat([Mr("type","contextformtogglebutton")]),hE=fr("type",{contextformbutton:dE,contextformtogglebutton:mE}),vE=Go([Mr("type","contextform"),Nr("initValue",function(){return""}),Ar("label"),Or("commands",hE),Tr("launch",fr("type",{contextformbutton:gE,contextformtogglebutton:pE}))].concat(lE)),bE=Go([Mr("type","contexttoolbar"),xr("items")].concat(lE)),yE=io("toolbar.button.execute"),xE={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},wE=/* */Object.freeze({getState:function(t,n,e){return e}}),SE=/* */Object.freeze({events:function(r,i){var o=function(e,o){r.updateState.each(function(t){var n=t(e,o);i.set(n)}),r.renderComponents.each(function(t){var n=t(o,i.get());Ps(e),F(n,function(t){Vs(e,e.getSystem().build(t))})})};return ii([si(Mn(),function(t,n){var e=r.channel;T(n.channels(),e)&&o(t,n.data())}),bi(function(n,t){r.initialData.each(function(t){o(n,t)})})])}}),kE=/* */Object.freeze({init:function(t){var n=_t(et.none());return{readState:function(){return n.get().getOr("none")},get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(et.none())}}}}),CE=[br("channel"),Er("renderComponents"),Er("updateState"),Er("initialData")],OE=aa({fields:CE,name:"reflecting",active:SE,apis:wE,state:kE}),EE=nt([br("toggleClass"),br("fetch"),Ku("onExecute"),Mr("getHotspot",et.some),Mr("getAnchorOverrides",nt({})),Mr("layouts",et.none()),Ku("onItemExecute"),Er("lazySink"),br("dom"),Yu("onOpen"),of("splitDropdownBehaviours",[Pb,km,Xm]),Mr("matchWidth",!1),Mr("useMinWidth",!1),Mr("eventOrder",{}),Er("role")].concat(dy())),TE=Vf({factory:Bg,schema:[br("dom")],name:"arrow",defaults:function(t){return{buttonBehaviours:ia([Xm.revoke()])}},overrides:function(n){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(n.uid).each(Xr)},buttonBehaviours:ia([rg.config({toggleOnExecute:!1,toggleClass:n.toggleClass})])}}}),BE=Vf({factory:Bg,schema:[br("dom")],name:"button",defaults:function(t){return{buttonBehaviours:ia([Xm.revoke()])}},overrides:function(e){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(n){n.getSystem().getByUid(e.uid).each(function(t){e.onExecute(t,n)})}}}}),AE=nt([TE,BE,Hf({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[br("text")],name:"aria-descriptor"}),Rf({schema:[Wu()],name:"menu",defaults:function(o){return{onExecute:function(n,e){n.getSystem().getByUid(o.uid).each(function(t){o.onItemExecute(t,n,e)})}}}}),$b()]),DE=ml({name:"SplitDropdown",configFields:EE(),partFields:AE(),factory:function(o,t,n,e){var r=function(t){vl.getCurrent(t).each(function(t){Dl.highlightFirst(t),km.focusIn(t)})},i=function(t){ty(o,function(t){return t},t,e,r,xb.HighlightFirst).get(tt)},u=function(t){var n=$f(t,o,"button");return Xr(n),et.some(!0)},a=St(ii([bi(function(e,t){Kf(e,o,"aria-descriptor").each(function(t){var n=io("aria");ze(t.element(),"id",n),ze(e.element(),"aria-describedby",n)})})]),Tg(et.some(i)));return{uid:o.uid,dom:o.dom,components:t,eventOrder:ao({},o.eventOrder,{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:uf(o.splitDropdownBehaviours,[Pb.config({others:{sandbox:function(t){var n=$f(t,o,"arrow");return oy(o,t,{onOpen:function(){rg.on(n),rg.on(t)},onClose:function(){rg.off(n),rg.off(t)}})}}}),km.config({mode:"special",onSpace:u,onEnter:u,onDown:function(t){return i(t),et.some(!0)}}),Xm.config({}),rg.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}}}),_E=io("update-menu-text"),ME=io("update-menu-icon"),FE=function(t,n,o){var e=_t(tt),r=t.text.map(function(t){return Ag(ak(t,n,o.providers))}),i=t.icon.map(function(t){return Ag(uk(t,o.providers.icons))}),u=function(t,n){var e=Lm.getValue(t);return Xm.focus(e),Gr(e,"keydown",{raw:n.event().raw()}),Uy.close(e),et.some(!0)},a=t.role.fold(function(){return{}},function(t){return{role:t}}),c=t.tooltip.fold(function(){return{}},function(t){var n=o.providers.translate(t);return{title:n,"aria-label":n}});return Ag(Uy.sketch(ao({},a,{dom:{tag:"button",classes:[n,n+"--select"].concat(M(t.classes,function(t){return n+"--"+t})),attributes:ao({},c)},components:hh([i.map(function(t){return t.asSpec()}),r.map(function(t){return t.asSpec()}),et.some({dom:{tag:"div",classes:[n+"__select-chevron"],innerHtml:_g("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:ia(t.dropdownBehaviours.concat([ah(t.disabled),Wy.config({}),Bm.config({}),lg("dropdown-events",[fh(t,e),lh(t,e)]),lg("menubutton-update-display-text",[si(_E,function(n,e){r.bind(function(t){return t.getOpt(n)}).each(function(t){Bm.set(t,[Bu(o.providers.translate(e.event().text()))])})}),si(ME,function(n,e){i.bind(function(t){return t.getOpt(n)}).each(function(t){Bm.set(t,[uk(e.event().icon(),o.providers.icons)])})})])])),eventOrder:wt(xE,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:ia([km.config({mode:"special",onLeft:u,onRight:u})]),lazySink:o.getSink,toggleClass:n+"--active",parts:{menu:Sv(0,t.columns,t.presets)},fetch:function(){return qb.nu(t.fetch)}}))).asSpec()},IE=function(n){return{isDisabled:function(){return ih.isDisabled(n)},setDisabled:function(t){return ih.set(n,t)}}},VE=function(n){return{setActive:function(t){rg.set(n,t)},isActive:function(){return rg.isOn(n)},isDisabled:function(){return ih.isDisabled(n)},setDisabled:function(t){return ih.set(n,t)}}},RE=function(e){return{isDisabled:function(){return ih.isDisabled(e)},setDisabled:function(t){return ih.set(e,t)},setActive:function(t){var n=e.element();t?(ou(n,"tox-tbtn--enabled"),ze(n,"aria-pressed",!0)):(ru(n,"tox-tbtn--enabled"),Ge(n,"aria-pressed"))},isActive:function(){return iu(e.element(),"tox-tbtn--enabled")}}},HE=function(t,n){return t.map(function(t){return{"aria-label":n.translate(t),title:n.translate(t)}}).getOr({})},NE=io("focus-button"),PE=["checklist","ordered-list"],zE=["indent","outdent","table-insert-column-after","table-insert-column-before","unordered-list"],LE=function(n,e,t,o,r,i){var u,a=function(t){return Op.isRtl()&&T(PE,t)?t+"-rtl":t},c=Op.isRtl()&&n.exists(function(t){return T(zE,t)});return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]).concat(c?["tox-tbtn__icon-rtl"]:[]),attributes:HE(t,i)},components:hh([n.map(function(t){return ik(a(t),i.icons)}),e.map(function(t){return ak(t,"tox-tbtn",i)})]),eventOrder:(u={},u[zt()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:ia([lg("common-button-display-events",[si(zt(),function(t,n){n.event().prevent(),Wr(t,NE)})])].concat(o.map(function(t){return OE.config({channel:t,initialData:{icon:n,text:e},renderComponents:function(t,n){return hh([t.icon.map(function(t){return ik(a(t),i.icons)}),t.text.map(function(t){return ak(t,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}},jE=function(t,n,e){var o,r=_t(tt),i=LE(t.icon,t.text,t.tooltip,et.none(),et.none(),e);return Bg.sketch({dom:i.dom,components:i.components,eventOrder:xE,buttonBehaviours:ia([lg("toolbar-button-events",[(o={onAction:t.onAction,getApi:n.getApi},wi(function(n,t){sh(o,n)(function(t){Gr(n,yE,{buttonApi:t}),o.onAction(t)})})),fh(n,r),lh(n,r)]),ah(t.disabled)].concat(n.toolbarButtonBehaviours))})},UE=function(t,n,e){return jE(t,{toolbarButtonBehaviours:[].concat(0<e.length?[lg("toolbarButtonWith",e)]:[]),getApi:IE,onSetup:t.onSetup},n)},WE=function(t,n,e){return wt(jE(t,{toolbarButtonBehaviours:[Bm.config({}),rg.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[lg("toolbarToggleButtonWith",e)]:[]),getApi:VE,onSetup:t.onSetup},n))},GE=function(n,t){var e,o,r,i,u=io("channel-update-split-dropdown-display"),a=function(e){return{isDisabled:function(){return ih.isDisabled(e)},setDisabled:function(t){return ih.set(e,t)},setIconFill:function(t,n){Vu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){ze(t,"fill",n)})},setIconStroke:function(t,n){Vu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){ze(t,"stroke",n)})},setActive:function(n){ze(e.element(),"aria-pressed",n),Vu(e.element(),"span").each(function(t){e.getSystem().getByDom(t).each(function(t){return rg.set(t,n)})})},isActive:function(){return Vu(e.element(),"span").exists(function(t){return e.getSystem().getByDom(t).exists(rg.isOn)})}}},c=_t(tt),s={getApi:a,onSetup:n.onSetup};return DE.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:St({"aria-pressed":!1},HE(n.tooltip,t.providers))},onExecute:function(t){n.onAction(a(t))},onItemExecute:function(t,n,e){},splitDropdownBehaviours:ia([ch(!1),lg("split-dropdown-events",[si(NE,Xm.focus),fh(s,c),lh(s,c)])]),eventOrder:(e={},e[Un()]=["alloy.base.behaviour","split-dropdown-events"],e),toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:(o=a,r=n,i=t.providers,function(n){return qb.nu(function(t){return r.fetch(t)}).map(function(t){return et.from(Lv(wt(Ev(io("menu-value"),t,function(t){r.onItemAction(o(n),t)},r.columns,r.presets,gh.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),i),{movement:Bv(r.columns,r.presets),menuBehaviours:pp("auto"!==r.columns?[]:[bi(function(o,t){mp(o,4,Ip(r.presets)).each(function(t){var n=t.numRows,e=t.numColumns;km.setGridSize(o,n,e)})})])})))})}),parts:{menu:Sv(0,n.columns,n.presets)},components:[DE.parts().button(LE(n.icon,n.text,et.none(),et.some(u),et.some([rg.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),DE.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:_g("chevron-down",t.providers.icons)}}),DE.parts()["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},XE=function(t,n,e,o){return FE({text:t.text,icon:t.icon,tooltip:t.tooltip,role:o,fetch:function(n){t.fetch(function(t){n(Ey(t,gh.CLOSE_ON_EXECUTE,e))})},onSetup:t.onSetup,getApi:RE,columns:1,presets:"normal",classes:[],dropdownBehaviours:[]},n,e.shared)},YE=function(i,u){return si(yE,function(t,n){var e,o=i.get(t),r=(e=o,{hide:function(){return Wr(e,Nn())},getValue:function(){return Lm.getValue(e)}});u.onAction(r,n.event().buttonApi())})},qE=function(t,n,e){var o,r,i,u,a,c,s,f,l,d,m,g,p={backstage:{shared:{providers:e}}};return"contextformtogglebutton"===n.type?(s=t,l=p,(d=(f=n).original).primary,m=co(d,["primary"]),g=ar(fE(ao({},m,{type:"togglebutton",onAction:function(){}}))),WE(g,l.backstage.shared.providers,[YE(s,f)])):(o=t,i=p,(u=(r=n).original).primary,a=co(u,["primary"]),c=ar(rE(ao({},a,{type:"button",onAction:function(){}}))),UE(c,i.backstage.shared.providers,[YE(o,r)]))},KE=function(t,n){var e,o,r,i,u=t.label.fold(function(){return{}},function(t){return{"aria-label":t}}),a=Ag(Ty.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:t.initValue(),inputAttributes:u,selectOnFocus:!0,inputBehaviours:ia([km.config({mode:"special",onEnter:function(t){return c.findPrimary(t).map(function(t){return Xr(t),!0})},onLeft:function(t,n){return n.cut(),et.none()},onRight:function(t,n){return n.cut(),et.none()}})])})),c=(e=a,o=t.commands,r=n.shared.providers,i=M(o,function(t){return Ag(qE(e,t,r))}),{asSpecs:function(){return M(i,function(t){return t.asSpec()})},findPrimary:function(e){return Ft(o,function(t,n){return t.primary?et.from(i[n]).bind(function(t){return t.getOpt(e)}).filter(w(ih.isDisabled)):et.none()})}});return nE({uid:io("context-toolbar"),initGroups:[{title:et.none(),items:[a.asSpec()]},{title:et.none(),items:c.asSpecs()}],onEscape:et.none,cyclicKeying:!0,backstage:n,getSink:function(){return vt.error("")}})},$E=io("forward-slide"),JE=io("backward-slide"),ZE=io("change-slide-event"),QE="tox-pop--resizing",tT=function(n,t){return Ft(t,function(t){return t.predicate(n.dom())?et.some({toolbarApi:t,elem:n}):et.none()})},nT=function(n,e){var t=function(t){return t.dom()===e.getBody()},o=Qn.fromDom(e.selection.getNode());return tT(o,n.inNodeScope).orThunk(function(){return tT(o,n.inEditorScope).orThunk(function(){return function(t,n,e){for(var o=t.dom(),r=b(e)?e:nt(!1);o.parentNode;){o=o.parentNode;var i=Qn.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return et.none()}(o,function(t){return tT(t,n.inNodeScope)},t)})})},eT=function(e,r){var t={},i=[],u=[],a={},c={},o=function(n,e){var o=ar(ur("ContextForm",vE,e));(t[n]=o).launch.map(function(t){a["form:"+n]=ao({},e.launch,{type:"contextformtogglebutton"===t.type?"togglebutton":"button",onAction:function(){r(o)}})}),"editor"===o.scope?u.push(o):i.push(o),c[n]=o},s=function(n,e){var t;(t=e,ur("ContextToolbar",bE,t)).each(function(t){"editor"===e.scope?u.push(t):i.push(t),c[n]=t})},n=Q(e);return F(n,function(t){var n=e[t];"contextform"===n.type?o(t,n):"contexttoolbar"===n.type&&s(t,n)}),{forms:t,inNodeScope:i,inEditorScope:u,lookupTable:c,formNavigators:a}},oT=function(o,r){return function(n){var e=_t(et.none()),t=function(){n.setActive(o.formatter.match(r));var t=o.formatter.formatChanged(r,n.setActive).unbind;e.set(et.some(t))};return o.initialized?t():o.on("init",t),function(){return e.get().each(function(t){return t()})}}},rT=function(n){return function(t){return function(){n.undoManager.transact(function(){n.focus(),n.execCommand("mceToggleFormat",!1,t.format)})}}},iT=function(t,n,e,o){var i,u,r,a,c,s="basic"===e.type?function(){return M(e.data,function(t){return OC(t,o.isSelectedFor,o.getPreviewFor)})}:e.getData;return{items:(i=n,u=o,r=function(t,n,e){var o=i.shared.providers.translate(t.title);if("separator"===t.type)return et.some({type:"separator",text:o});if("submenu"!==t.type)return et.some(ao({type:"togglemenuitem",text:o,active:t.isSelected(),disabled:e,onAction:u.onAction(t)},t.getStylePreview().fold(function(){return{}},function(t){return{meta:{style:t}}})));var r=W(t.getStyleItems(),function(t){return a(t,n)});return 0===n&&r.length<=0?et.none():et.some({type:"nestedmenuitem",text:o,disabled:r.length<=0,getSubmenuItems:function(){return W(t.getStyleItems(),function(t){return a(t,n)})}})},a=function(t,n){var e="formatter"===t.type&&u.isInvalid(t);return 0===n?e?[]:r(t,n,!1).toArray():r(t,n,e).toArray()},c=function(t){var n=u.shouldHide?0:1;return W(t,function(t){return a(t,n)})},{validateItems:c,getFetch:function(o,r){return function(t){var n=r(),e=c(n);t(Ey(e,gh.CLOSE_ON_EXECUTE,o))}}}),getStyleItems:s}},uT=function(o,t,n,r){var e=iT(0,t,n,r),i=e.items,u=e.getStyleItems;return FE({text:r.icon.isSome()?et.none():et.some(""),icon:r.icon,tooltip:et.from(r.tooltip),role:et.none(),fetch:i.getFetch(t,u),onSetup:function(e){return r.setInitialValue.each(function(t){return t(e.getComponent())}),r.nodeChangeHandler.map(function(t){var n=t(e.getComponent());return o.on("NodeChange",n),function(){o.off("NodeChange",n)}}).getOr(tt)},getApi:function(t){return{getComponent:function(){return t}}},columns:1,presets:"normal",classes:r.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};(Pk=Nk||(Nk={}))[Pk.SemiColon=0]="SemiColon",Pk[Pk.Space=1]="Space";var aT,cT,sT=function(t,n,e,o){var r,i,u=Et(t.settings,n).getOr(e);return{type:"basic",data:(i=u,r=o===Nk.SemiColon?i.replace(/;$/,"").split(";"):i.split(" "),M(r,function(t){var n=t,e=t,o=t.split("=");return 1<o.length&&(n=o[0],e=o[1]),{title:n,format:e}}))}},fT=[{title:"Left",icon:"align-left",format:"alignleft"},{title:"Center",icon:"align-center",format:"aligncenter"},{title:"Right",icon:"align-right",format:"alignright"},{title:"Justify",icon:"align-justify",format:"alignjustify"}],lT=function(e){var n=function(t){var n=N(fT,function(t){return e.formatter.match(t.format)}).fold(function(){return"left"},function(t){return t.title.toLowerCase()});Gr(t,ME,{icon:"align-"+n})},t=et.some(function(t){return function(){return n(t)}}),o=et.some(function(t){return n(t)}),r={type:"basic",data:fT};return{tooltip:"Align",icon:et.some("align-left"),isSelectedFor:function(t){return function(){return e.formatter.match(t)}},getPreviewFor:function(t){return function(){return et.none()}},onAction:rT(e),setInitialValue:o,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!e.formatter.canApply(t.format)}}},dT=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],mT=function(r){var o=function(){var e=function(t){return t?t.split(",")[0]:""},t=r.queryCommandValue("FontName"),n=i.data,o=t?t.toLowerCase():"";return N(n,function(t){var n=t.format;return n.toLowerCase()===o||e(n).toLowerCase()===e(o).toLowerCase()}).orThunk(function(){return 0===(t=o).indexOf("-apple-system")&&(n=t.toLowerCase().split(/['"]?\s*,\s*['"]?/),G(dT,function(t){return-1<n.indexOf(t.toLowerCase())}))?et.from({title:"System Font",format:o}):et.none();var t,n})},n=function(t){var n=r.queryCommandValue("FontName"),e=o().fold(function(){return n},function(t){return t.title});Gr(t,_E,{text:e})},t=et.some(function(t){return function(){return n(t)}}),e=et.some(function(t){return n(t)}),i=sT(r,"font_formats","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",Nk.SemiColon);return{tooltip:"Fonts",icon:et.none(),isSelectedFor:function(n){return function(){return o().exists(function(t){return t.format===n})}},getPreviewFor:function(t){return function(){return et.some({tag:"div",styleAttr:-1===t.indexOf("dings")?"font-family:"+t:""})}},onAction:function(t){return function(){r.undoManager.transact(function(){r.focus(),r.execCommand("FontName",!1,t.format)})}},setInitialValue:e,nodeChangeHandler:t,dataset:i,shouldHide:!1,isInvalid:function(){return!1}}},gT=function(t,n){return/[0-9.]+px$/.test(t)?(e=72*parseInt(t,10)/96,o=n||0,r=Math.pow(10,o),Math.round(e*r)/r+"pt"):t;var e,o,r},pT=function(i){var u=function(){var e=et.none(),o=a.data,r=i.queryCommandValue("FontSize");if(r)for(var t=function(t){var n=gT(r,t);e=N(o,function(t){return t.format===r||t.format===n})},n=3;e.isNone()&&0<=n;n--)t(n);return{matchOpt:e,px:r}},n=function(t){var n=u(),e=n.matchOpt,o=n.px,r=e.fold(function(){return o},function(t){return t.title});Gr(t,_E,{text:r})},t=et.some(function(t){return function(){return n(t)}}),e=et.some(function(t){return n(t)}),a=sT(i,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",Nk.Space);return{tooltip:"Font sizes",icon:et.none(),isSelectedFor:function(n){return function(){return u().matchOpt.exists(function(t){return t.format===n})}},getPreviewFor:function(){return function(){return et.none()}},onAction:function(t){return function(){i.undoManager.transact(function(){i.focus(),i.execCommand("FontSize",!1,t.format)})}},setInitialValue:e,nodeChangeHandler:t,dataset:a,shouldHide:!1,isInvalid:function(){return!1}}},hT=function(e,t,n){var o=t();return Ft(n,function(n){return N(o,function(t){return e.formatter.matchNode(n,t.format)})}).orThunk(function(){return e.formatter.match("p")?et.some({title:"Paragraph",format:"p"}):et.none()})},vT=function(t){var n=t.selection.getStart(!0)||t.getBody();return t.dom.getParents(n,function(){return!0},t.getBody())},bT=function(o){var e=function(t,n){var e=hT(o,function(){return r.data},t).fold(function(){return"Paragraph"},function(t){return t.title});Gr(n,_E,{text:e})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=vT(o);e(n,t)}),r=sT(o,"block_formats","Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre",Nk.SemiColon);return{tooltip:"Blocks",icon:et.none(),isSelectedFor:function(t){return function(){return o.formatter.match(t)}},getPreviewFor:function(n){return function(){var t=o.formatter.get(n);return et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:o.formatter.getCssText(n)})}},onAction:rT(o),setInitialValue:n,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!o.formatter.canApply(t.format)}}},yT=function(i){var e=function(t,n){var e=function(t){var n=t.items;return n!==undefined&&0<n.length?W(n,e):[{title:t.title,format:t.format}]},o=W(CC(i),e),r=hT(i,function(){return o},t).fold(function(){return"Paragraph"},function(t){return t.title});Gr(n,_E,{text:r})},t=et.some(function(n){return function(t){return e(t.parents,n)}}),n=et.some(function(t){var n=vT(i);e(n,t)});return{tooltip:"Formats",icon:et.none(),isSelectedFor:function(t){return function(){return i.formatter.match(t)}},getPreviewFor:function(n){return function(){var t=i.formatter.get(n);return t!==undefined?et.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:i.formatter.getCssText(n)}):et.none()}},onAction:rT(i),setInitialValue:n,nodeChangeHandler:t,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(t){return!i.formatter.canApply(t.format)}}},xT=[{name:"history",items:["undo","redo"]},{name:"styles",items:["styleselect"]},{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"]}],wT=function(o,r){return function(t,n){var e=o(t).mapError(function(t){return sr(t)}).getOrDie();return r(e,n)}},ST={button:wT(rE,function(t,n){return e=t,o=n.backstage.shared.providers,UE(e,o,[]);var e,o}),togglebutton:wT(fE,function(t,n){return e=t,o=n.backstage.shared.providers,WE(e,o,[]);var e,o}),menubutton:wT(uE,function(t,n){return XE(t,"tox-tbtn",n.backstage,et.none())}),splitbutton:wT(function(t){return ur("SplitButton",aE,t)},function(t,n){return GE(t,n.backstage.shared)}),styleSelectButton:function(t,n){return e=t,o=n.backstage,r=o.styleselect,uT(e,o,r,yT(e));var e,o,r},fontsizeSelectButton:function(t,n){return e=t,o=n.backstage,r=pT(e),uT(e,o,r.dataset,r);var e,o,r},fontSelectButton:function(t,n){return e=t,o=n.backstage,r=mT(e),uT(e,o,r.dataset,r);var e,o,r},formatButton:function(t,n){return e=t,o=n.backstage,r=bT(e),uT(e,o,r.dataset,r);var e,o,r},alignMenuButton:function(t,n){return e=t,o=n.backstage,r=lT(e),uT(e,o,r.dataset,r);var e,o,r}},kT={styleselect:ST.styleSelectButton,fontsizeselect:ST.fontsizeSelectButton,fontselect:ST.fontSelectButton,formatselect:ST.formatButton,align:ST.alignMenuButton},CT=function(t){var n=t.split("|");return M(n,function(t){return{items:t.trim().split(" ")}})},OT=function(t){return!1===t.toolbar?[]:t.toolbar===undefined||!0===t.toolbar?(e=t.buttons,n=M(xT,function(t){var n=R(t.items,function(t){return lt(e,t)||lt(kT,t)});return{name:t.name,items:n}}),R(n,function(t){return 0<t.items.length})):S(t.toolbar)?CT(t.toolbar):D(t.toolbar)&&S(t.toolbar[0])?CT(t.toolbar.join(" | ")):t.toolbar;var e,n},ET=function(n,e,o,r,t){return ft(e,o.toLowerCase()).orThunk(function(){return t.bind(function(t){return Ft(t,function(t){return ft(e,t+o.toLowerCase())})})}).fold(function(){return ft(kT,o.toLowerCase()).map(function(t){return t(n,r)}).orThunk(function(){return et.none()})},function(t){return e=r,ft(ST,(n=t).type).fold(function(){return x.console.error("skipping button defined by",n),et.none()},function(t){return et.some(t(n,e))});var n,e})},TT=function(e,o,r,i){var t=OT(o),n=M(t,function(t){var n=W(t.items,function(t){return 0===t.trim().length?[]:ET(e,o.buttons,t,r,i).toArray()});return{title:et.from(e.translate(t.name)),items:n}});return R(n,function(t){return 0<t.items.length})},BT=function(i,t,u,c){var e,o,s=_u((e={sink:u,onEscape:function(){return i.focus(),et.some(!0)}},o=_t([]),Eg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){o.set([]),Eg.getContent(t).each(function(t){bu(t.element(),"visibility")}),ru(t.element(),QE),bu(t.element(),"width")},inlineBehaviours:ia([lg("context-toolbar-events",[vi(Zt(),function(t,n){Eg.getContent(t).each(function(t){}),ru(t.element(),QE),bu(t.element(),"width")}),si(ZE,function(n,e){bu(n.element(),"width");var t=ka(n.element());Eg.setContent(n,e.event().contents()),ou(n.element(),QE);var o=ka(n.element());lu(n.element(),"width",t+"px"),Eg.getContent(n).each(function(t){e.event().focus().bind(function(t){return jl(t),Wl(n.element())}).orThunk(function(){return km.focusIn(t),Ul()})}),Ig.setTimeout(function(){lu(n.element(),"width",o+"px")},0)}),si($E,function(t,n){Eg.getContent(t).each(function(t){o.set(o.get().concat([{bar:t,focus:Ul()}]))}),Gr(t,ZE,{contents:n.event().forwardContents(),focus:et.none()})}),si(JE,function(n,t){J(o.get()).each(function(t){o.set(o.get().slice(0,o.get().length-1)),Gr(n,ZE,{contents:Mu(t.bar),focus:t.focus})})})]),km.config({mode:"special",onEscape:function(n){return J(o.get()).fold(function(){return e.onEscape()},function(t){return Wr(n,JE),et.some(!0)})}})]),lazySink:function(){return vt.value(e.sink)}}))),f=function(){return et.some(Qn.fromDom(i.contentAreaContainer))};i.on("init",function(){var t=i.getBody().ownerDocument.defaultView,n=Yv(Qn.fromDom(t),"scroll",function(){l.get().each(function(t){var n=d.get().getOr(i.selection.getNode()).getBoundingClientRect(),e=i.contentAreaContainer.getBoundingClientRect(),o=n.bottom<0,r=n.top>e.height;o||r?lu(s.element(),"display","none"):(bu(s.element(),"display"),Ms.positionWithin(u,t,s,f()))})});i.on("remove",function(){n.unbind()})});var l=_t(et.none()),d=_t(et.none()),n=_t(null),m=function(t){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:ia([km.config({mode:"acyclic"}),lg("pop-dialog-wrap-events",[bi(function(t){i.shortcuts.add("ctrl+F9","focus statusbar",function(){return km.focusIn(t)})}),yi(function(t){i.shortcuts.remove("ctrl+F9")})])])}},a=tn(function(){return eT(t,function(t){var n=g(t);Gr(s,$E,{forwardContents:m(n)})})}),g=function(t){var n,e,o=i.ui.registry.getAll().buttons,r=a();return"contexttoolbar"===t.type?(n=St(o,r.formNavigators),e=TT(i,{buttons:n,toolbar:t.items},c,et.some(["form:"])),nE({uid:io("context-toolbar"),initGroups:e,onEscape:et.none,cyclicKeying:!0,backstage:c.backstage,getSink:function(){return vt.error("")}})):KE(t,c.backstage)};i.on("contexttoolbar-show",function(n){var t=a();Et(t.lookupTable,n.toolbarKey).each(function(t){b(t,n.target===i?et.none():et.some(n)),Eg.getContent(s).each(km.focusIn)})});var r={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"]},p={maxHeightFunction:ic()},h={bubble:fc(12,0,r),layouts:{onLtr:function(){return[Oc]},onRtl:function(){return[Ec]}},overrides:p},v={bubble:fc(0,12,r),layouts:{onLtr:function(){return[kc,Cc,wc,yc,Sc,xc]},onRtl:function(){return[kc,Cc,Sc,xc,wc,yc]}},overrides:p},b=function(t,n){x();var e,o,r,i=g(t),u=n.map(Qn.fromDom),a=(e=t.position,o=u,r="node"===e?c.backstage.shared.anchors.node(o):c.backstage.shared.anchors.cursor(),wt(r,"line"===e?h:v));l.set(et.some(a)),d.set(n),Eg.showWithin(s,a,m(i),f()),bu(s.element(),"display")},y=function(){var t=a();nT(t,i).fold(function(){l.set(et.none()),Eg.hide(s)},function(t){b(t.toolbarApi,et.some(t.elem.dom()))})},x=function(){var t=n.get();null!==t&&(Ig.clearTimeout(t),n.set(null))},w=function(t){x(),n.set(t)};i.on("init",function(){i.on("click keyup SetContent ObjectResized ResizeEditor",function(t){w(Ig.setEditorTimeout(i,y,0))}),i.on("focusout",function(t){Ig.setEditorTimeout(i,function(){Wl(u.element()).isNone()&&Wl(s.element()).isNone()&&(l.set(et.none()),Eg.hide(s))},0)}),i.on("SwitchMode",function(){i.readonly&&(l.set(et.none()),Eg.hide(s))}),i.on("NodeChange",function(t){Wl(s.element()).fold(function(){w(Ig.setEditorTimeout(i,y,0))},function(t){})})})},AT=function(t,e,o){var n=Yv(Qn.fromDom(x.document),"mousedown",function(n){F([e,o],function(t){t.broadcastOn([Zs()],{target:n.target()})})}),r=Yv(Qn.fromDom(x.document),"touchstart",function(n){F([e,o],function(t){t.broadcastOn([Zs()],{target:n.target()})})}),i=Yv(Qn.fromDom(x.document),"mouseup",function(n){0===n.raw().button&&F([e,o],function(t){t.broadcastOn([Qs()],{target:n.target()})})}),u=function(n){F([e,o],function(t){t.broadcastOn([Zs()],{target:Qn.fromDom(n.target)})})};t.on("mousedown",u),t.on("touchstart",u);var a=function(n){0===n.button&&F([e,o],function(t){t.broadcastOn([Qs()],{target:Qn.fromDom(n.target)})})};t.on("mouseup",a);var c=function(n){F([e,o],function(t){t.broadcastEvent(Ln(),n)})};t.on("ScrollWindow",c);var s=function(n){F([e,o],function(t){t.broadcastEvent(jn(),n)})};t.on("ResizeWindow",s),t.on("remove",function(){t.off("mousedown",u),t.off("touchstart",u),t.off("mouseup",a),t.off("ResizeWindow",s),t.off("ScrollWindow",c),n.unbind(),r.unbind(),i.unbind()}),t.on("detach",function(){js(e),js(o),e.destroy(),o.destroy()})},DT=ol,_T=zf,MT=dl({factory:function(n,o){var t={focus:km.focusIn,setMenus:function(t,n){var e=M(n,function(n){var t={type:"menubutton",text:n.text,fetch:function(t){t(n.getItems())}},e=uE(t).mapError(function(t){return sr(t)}).getOrDie();return XE(e,"tox-mbtn",o.backstage,et.some("menuitem"))});Bm.set(t,e)}};return{uid:n.uid,dom:n.dom,components:[],behaviours:ia([Bm.config({}),lg("menubar-events",[bi(function(t){n.onSetup(t)}),si(Wt(),function(e,t){Vu(e.element(),".tox-mbtn--active").each(function(n){Ru(t.event().target(),".tox-mbtn").each(function(t){he(n,t)||e.getSystem().getByDom(n).each(function(n){e.getSystem().getByDom(t).each(function(t){Uy.expand(t),Uy.close(n),Xm.focus(t)})})})})}),si(Xn(),function(e,t){t.event().prevFocus().bind(function(t){return e.getSystem().getByDom(t).toOption()}).each(function(n){t.event().newFocus().bind(function(t){return e.getSystem().getByDom(t).toOption()}).each(function(t){Uy.isOpen(n)&&(Uy.expand(t),Uy.close(n))})})})]),km.config({mode:"flow",selector:".tox-mbtn",onEscape:function(t){return n.onEscape(t),et.some(!0)}}),zy.config({})]),apis:t,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[br("dom"),br("uid"),br("onEscape"),br("backstage"),Mr("onSetup",tt)],apis:{focus:function(t,n){t.focus(n)},setMenus:function(t,n,e){t.setMenus(n,e)}}}),FT="container",IT=[of("slotBehaviours",[])],VT=function(t){return"<alloy.field."+t+">"},RT=function(r,t,n){var e,o=function(t){return Qf(r)},i=function(e,o){return void 0===o&&(o=undefined),function(t,n){return Kf(t,r,n).map(function(t){return e(t,n)}).getOr(o)}},u=function(t,n){return"true"!==je(t.element(),"aria-hidden")},a=i(u,!1),c=i(function(t,n){if(u(t)){var e=t.element();lu(e,"display","none"),ze(e,"aria-hidden","true"),Gr(t,Yn(),{name:n,visible:!1})}}),s=(e=c,function(n,t){F(t,function(t){return e(n,t)})}),f=i(function(t,n){if(!u(t)){var e=t.element();bu(e,"display"),Ge(e,"aria-hidden"),Gr(t,Yn(),{name:n,visible:!0})}}),l={getSlotNames:o,getSlot:function(t,n){return Kf(t,r,n)},isShowing:a,hideSlot:c,hideAllSlots:function(t){return s(t,o())},showSlot:f};return{uid:r.uid,dom:r.dom,components:t,behaviours:rf(r.slotBehaviours),apis:l}},HT=it({getSlotNames:function(t,n){return t.getSlotNames(n)},getSlot:function(t,n,e){return t.getSlot(n,e)},isShowing:function(t,n,e){return t.isShowing(n,e)},hideSlot:function(t,n,e){return t.hideSlot(n,e)},hideAllSlots:function(t,n){return t.hideAllSlots(n)},showSlot:function(t,n,e){return t.showSlot(n,e)}},Pi),NT=ao({},HT,{sketch:function(t){var e,n=(e=[],{slot:function(t,n){return e.push(t),Wf(FT,VT(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=M(r,function(t){return Vf({name:t,pname:VT(t)})});return il(FT,IT,i,RT,o)}}),PT=Go([Ar("icon"),Ar("tooltip"),Nr("onShow",tt),Nr("onHide",tt),Nr("onSetup",function(){return tt})]),zT=function(t){return{element:function(){return t.element().dom()}}},LT=function(e,o){var r=M(Q(o),function(t){var n=o[t],e=ar(ur("sidebar",PT,n));return{name:t,getApi:zT,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return M(r,function(t){var n=_t(tt);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:pp([fh(t,n),lh(t,n),si(Yn(),function(n,t){var e=t.event();N(r,function(t){return t.name===e.name()}).each(function(t){(e.visible()?t.onShow:t.onHide)(t.getApi(n))})})])})})},jT=function(t,e){vl.getCurrent(t).each(function(t){return Bm.set(t,[(n=e,NT.sketch(function(t){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:LT(t,n),slotBehaviours:pp([bi(function(t){return NT.hideAllSlots(t)})])}}))]);var n})},UT=function(t){return vl.getCurrent(t).bind(function(t){return HO.isGrowing(t)||HO.hasGrown(t)?vl.getCurrent(t).bind(function(n){return N(NT.getSlotNames(n),function(t){return NT.isShowing(n,t)})}):et.none()})},WT=io("FixSizeEvent"),GT=io("AutoSizeEvent"),XT=function(t,n,e){var o,r=t.element();!0===n?(Bm.set(t,[(o=e,{dom:{tag:"div",attributes:{"aria-label":o.translate("Loading...")},classes:["tox-throbber__busy-spinner"]},components:[{dom:Cp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}],behaviours:ia([km.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),Xm.config({})])})]),bu(r,"display"),Ge(r,"aria-hidden")):(Bm.set(t,[]),lu(r,"display","none"),ze(r,"aria-hidden","true"))},YT=_T.optional({factory:MT,name:"menubar",schema:[br("backstage")]}),qT=_T.optional({factory:{sketch:function(t){var n;return((n=t).split===db.sliding?tE:n.split===db.floating?QO:nE)({uid:t.uid,onEscape:function(){return t.onEscape(),et.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,backstage:t.backstage,moreDrawerData:{lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton}})}},name:"toolbar",schema:[br("dom"),br("onEscape"),br("getSink")]}),KT=_T.optional({name:"socket",schema:[br("dom")]}),$T=_T.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"complementary"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:ia([zy.config({}),Xm.config({}),HO.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:function(t){vl.getCurrent(t).each(NT.hideAllSlots),Wr(t,GT)},onGrown:function(t){Wr(t,GT)},onStartGrow:function(t){Gr(t,WT,{width:hu(t.element(),"width").getOr("")})},onStartShrink:function(t){Gr(t,WT,{width:ka(t.element())+"px"})}}),Bm.config({}),vl.config({find:function(t){var n=Bm.contents(t);return $(n)}})])}],behaviours:ia([Zw(0),lg("sidebar-sliding-events",[si(WT,function(t,n){lu(t.element(),"width",n.event().width())}),si(GT,function(t,n){bu(t.element(),"width")})])])}}},name:"sidebar",schema:[br("dom")]}),JT=_T.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:ia([Bm.config({})]),components:[]}}},name:"throbber",schema:[br("dom")]}),ZT=ml({name:"OuterContainer",factory:function(e,t,n){var o={getSocket:function(t){return DT.getPart(t,e,"socket")},setSidebar:function(t,n){DT.getPart(t,e,"sidebar").each(function(t){return jT(t,n)})},toggleSidebar:function(t,o){DT.getPart(t,e,"sidebar").each(function(t){return n=t,e=o,void vl.getCurrent(n).each(function(n){vl.getCurrent(n).each(function(t){HO.hasGrown(n)?NT.isShowing(t,e)?HO.shrink(n):(NT.hideAllSlots(t),NT.showSlot(t,e)):(NT.hideAllSlots(t),NT.showSlot(t,e),HO.grow(n))})});var n,e})},whichSidebar:function(t){return DT.getPart(t,e,"sidebar").bind(UT).getOrNull()},getToolbar:function(t){return DT.getPart(t,e,"toolbar")},setToolbar:function(t,n){DT.getPart(t,e,"toolbar").each(function(t){t.getApis().setGroups(t,n)})},refreshToolbar:function(t){DT.getPart(t,e,"toolbar").each(function(t){return t.getApis().refresh(t)})},getMoreButton:function(t){return DT.getPart(t,e,"toolbar").bind(function(t){return t.getApis().getMoreButton(t)})},getThrobber:function(t){return DT.getPart(t,e,"throbber")},focusToolbar:function(t){DT.getPart(t,e,"toolbar").each(function(t){km.focusIn(t)})},setMenubar:function(t,n){DT.getPart(t,e,"menubar").each(function(t){MT.setMenus(t,n)})},focusMenubar:function(t){DT.getPart(t,e,"menubar").each(function(t){MT.focus(t)})}};return{uid:e.uid,dom:e.dom,components:t,apis:o,behaviours:e.behaviours}},configFields:[br("dom"),br("behaviours")],partFields:[YT,qT,KT,$T,JT],apis:{getSocket:function(t,n){return t.getSocket(n)},setSidebar:function(t,n,e){t.setSidebar(n,e)},toggleSidebar:function(t,n,e){t.toggleSidebar(n,e)},whichSidebar:function(t,n){return t.whichSidebar(n)},getToolbar:function(t,n){return t.getToolbar(n)},setToolbar:function(t,n,e){var o=M(e,function(t){return $O(t)});t.setToolbar(n,o)},getMoreButton:function(t,n){return t.getMoreButton(n)},refreshToolbar:function(t,n){return t.refreshToolbar(n)},getThrobber:function(t,n){return t.getThrobber(n)},setMenubar:function(t,n,e){t.setMenubar(n,e)},focusMenubar:function(t,n){t.focusMenubar(n)},focusToolbar:function(t,n){t.focusToolbar(n)}}}),QT={file:{title:"File",items:"newdocument restoredraft | preview | print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align | forecolor backcolor | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck code wordcount"},table:{title:"Table",items:"inserttable tableprops deletetable row column cell"},help:{title:"Help",items:"help"}},tB=function(t){return"string"==typeof t?t.split(" "):t},nB=function(u,a){var c=St(QT,a.menus),n=0<Q(a.menus).length,t=a.menubar===undefined||!0===a.menubar?tB("file edit view insert format tools table help"):tB(!1===a.menubar?"":a.menubar),e=R(t,function(t){return n&&a.menus.hasOwnProperty(t)&&a.menus[t].hasOwnProperty("items")||QT.hasOwnProperty(t)}),o=M(e,function(t){var n,e,o,r,i=c[t];return n={title:i.title,items:tB(i.items)},e=a,r=(o=u,o.getParam("removed_menuitems","")).split(/[ ,]/),{text:n.title,getItems:function(){return W(n.items,function(t){var n=t.toLowerCase();return 0===n.trim().length?[]:B(r,function(t){return t===n})?[]:"separator"===n||"|"===n?[{type:"separator"}]:e.menuItems[n]?[e.menuItems[n]]:[]})}}});return R(o,function(t){return 0<t.getItems().length&&B(t.getItems(),function(t){return"separator"!==t.type})})},eB=function(t){var n=function(){t._skinLoaded=!0,ev(t)};return function(){t.initialized?n():t.on("init",n)}},oB=function(t,n){var e,o=function(t){var n=t.settings,e=n.skin,o=n.skin_url;if(!1!==e){var r=e||"oxide";o=o?t.documentBaseURI.toAbsolute(o):hb.baseURL+"/skins/ui/"+r}return o}(n);o&&(e=o+"/skin.min.css",n.contentCSS.push(o+(t?"/content.inline":"/content")+".min.css")),0==(!1===n.getParam("skin"))&&e?yh.DOM.styleSheetLoader.load(e,eB(n)):eB(n)()},rB=g(oB,!1),iB=g(oB,!0),uB=yh.DOM,aB={render:function(e,o,t,n,r){var i,u,a=_t(0);rB(e),i=Qn.fromDom(r.targetNode),u=o.mothership,Ls(i,u,Ce),zs(Qr(),o.uiMothership),e.on("init",function(){ZT.setToolbar(o.outerContainer,TT(e,t,{backstage:n},et.none())),a.set(e.getWin().innerWidth),ZT.setMenubar(o.outerContainer,nB(e,t)),ZT.setSidebar(o.outerContainer,t.sidebar),function(o){var r=o.getWin(),t=o.getDoc().documentElement,i=_t(ha(r.innerWidth,r.innerHeight)),u=_t(ha(t.offsetWidth,t.offsetHeight)),n=function(){var t=o.getDoc().documentElement,n=i.get(),e=u.get();n.left()!==r.innerWidth||n.top()!==r.innerHeight?(i.set(ha(r.innerWidth,r.innerHeight)),rv(o)):e.left()===t.offsetWidth&&e.top()===t.offsetHeight||(u.set(ha(t.offsetWidth,t.offsetHeight)),rv(o))};uB.bind(r,"resize",n);var e=qv(Qn.fromDom(o.getBody()),"load",n);o.on("remove",function(){e.unbind(),uB.unbind(r,"resize",n)})}(e)});var c=ZT.getSocket(o.outerContainer).getOrDie("Could not find expected socket element");YO(e,o),e.addCommand("ToggleSidebar",function(t,n){ZT.toggleSidebar(o.outerContainer,n),e.fire("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",function(){return ZT.whichSidebar(o.outerContainer)});var s=Sb(e);return s!==db.sliding&&s!==db.floating||e.on("ResizeContent",function(){var t=e.getWin().innerWidth;t!==a.get()&&ZT.refreshToolbar(o.outerContainer),a.set(t)}),{iframeContainer:c.element().dom(),editorContainer:o.outerContainer.element().dom()}},getBehaviours:function(t){return[]}},cB=function(e,n){return xe(e).orThunk(function(){var t=Qn.fromTag("span");ke(e,t);var n=xe(t);return Ae(t),n}).map(function(t){return ba(t).translate(-n.left(),-n.top())}).getOrThunk(function(){return ha(0,0)})},sB=bt([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),fB=function(n){return function(t){return t.translate(-n.left(),-n.top())}},lB=function(n){return function(t){return t.translate(n.left(),n.top())}},dB=function(e){return function(t,n){return U(e,function(t,n){return n(t)},ha(t,n))}},mB=function(t,n,e){return t.fold(dB([lB(e),fB(n)]),dB([fB(n)]),dB([]))},gB=function(t,n,e){return t.fold(dB([lB(e)]),dB([]),dB([lB(n)]))},pB=function(t,n,e){return t.fold(dB([]),dB([fB(e)]),dB([lB(n),fB(e)]))},hB=function(t,n,e){return t.fold(function(t,n){return{position:"absolute",left:t+"px",top:n+"px"}},function(t,n){return{position:"absolute",left:t-e.left()+"px",top:n-e.top()+"px"}},function(t,n){return{position:"fixed",left:t+"px",top:n+"px"}})},vB=sB.offset,bB=sB.absolute,yB=sB.fixed,xB=function(t,n){ou(t.element(),n.transitionClass),ru(t.element(),n.fadeOutClass),ou(t.element(),n.fadeInClass)},wB=function(t,n){ou(t.element(),n.transitionClass),ru(t.element(),n.fadeInClass),ou(t.element(),n.fadeOutClass)},SB=function(t,n){return t.y()>=n.y()&&t.bottom()<=n.bottom()},kB=function(t,n){return We(t,n)?et.some(parseInt(je(t,n),10)):et.none()},CB=function(o,r,i){return(u=o,t=r,n=u.element(),kB(n,t.leftAttr).bind(function(o){return kB(n,t.topAttr).map(function(t){var n=ka(u.element()),e=Ea(u.element());return La(o,t,n,e)})})).bind(function(t){return SB(t,i)?(n=r,e=o.element(),Ge(e,n.leftAttr),Ge(e,n.topAttr),et.some(bB(t.x(),t.y()))):et.none();var n,e});var u,t,n},OB=function(t,n,e,o,r){var i=ba(t.element()),u=La(i.left(),i.top(),ka(t.element()),Ea(t.element()));if(SB(u,e))return et.none();a=t,c=n,s=i.left(),f=i.top(),l=a.element(),ze(l,c.leftAttr,s),ze(l,c.topAttr,f);var a,c,s,f,l,d=bB(i.left(),i.top()),m=mB(d,o,r),g=bB(e.x(),e.y()),p=mB(g,o,r),h=u.y()<=e.y()?p.top():p.top()+e.height()-u.height();return et.some(yB(m.left(),h))},EB=function(i,t,n){var u=t.lazyViewport(i);t.contextual.each(function(r){r.lazyContext(i).each(function(t){var n,e,o=ja(t);e=u,((n=o).y()<e.bottom()&&n.bottom()>e.y()?xB:wB)(i,r)})});var e,o,r,a,c,s=ve(i.element()),f=xa(s),l=cB(i.element(),f);(e=i,o=t,r=u,a=f,c=l,hu(e.element(),"position").is("fixed")?CB(e,o,r):OB(e,o,r,a,c)).each(function(t){var n=hB(t,0,l);du(i.element(),n)})},TB=/* */Object.freeze({refresh:EB}),BB=/* */Object.freeze({events:function(o,t){return ii([si(Zt(),function(n,e){o.contextual.each(function(t){he(n.element(),e.event().target())&&(ru(n.element(),t.transitionClass),e.stop())})}),si(Ln(),function(t,n){EB(t,o)})])}}),AB=[_r("contextual",[br("fadeInClass"),br("fadeOutClass"),br("transitionClass"),br("lazyContext")]),Mr("lazyViewport",function(t){var n=xa();return La(n.left(),n.top(),x.window.innerWidth,x.window.innerHeight)}),br("leftAttr"),br("topAttr")],DB=aa({fields:AB,name:"docking",active:BB,apis:TB}),_B={render:function(o,n,e,r,t){var i,u=yh.DOM,a=Cb(o),c=Sb(o),s=c===db.sliding||c===db.floating;iB(o);var f=function(t){var n=hu(i.element(),"position").is("fixed"),e=function(t){void 0===t&&(t=0);var n=ba(Qn.fromDom(o.getBody()));return{top:Math.round(n.top()-Ea(i.element()))+t,left:Math.round(n.left())}}(s?t.fold(function(){return 0},function(t){return 1<t.components().length?Ea(t.components()[1].element()):0}):0);n?Le(i.element(),ut(e,function(t,n){return{k:"data-dock-"+n,v:t}})):du(i.element(),it(e,function(t){return t+"px"})),DB.refresh(i)},l=function(){var t=ZT.getToolbar(n.outerContainer);s&&ZT.refreshToolbar(n.outerContainer),a||f(t)},d=function(){lu(n.outerContainer.element(),"display","flex"),u.addClass(o.getBody(),"mce-edit-focus"),bu(n.uiMothership.element(),"display"),l()},m=function(){n.outerContainer&&(lu(n.outerContainer.element(),"display","none"),u.removeClass(o.getBody(),"mce-edit-focus")),lu(n.uiMothership.element(),"display","none")},g=function(){if(i)d();else{i=n.outerContainer;var t=kb(o).getOr(Qr());zs(t,n.mothership),zs(t,n.uiMothership),ZT.setToolbar(n.outerContainer,TT(o,e,{backstage:r},et.none())),ZT.setMenubar(n.outerContainer,nB(o,e)),a||lu(i.element(),"position","absolute"),l(),d(),o.on("NodeChange ResizeWindow",l),o.on("activate",d),o.on("deactivate",m),o.nodeChanged()}};return o.on("focus",g),o.on("blur hide",m),o.on("init",function(){o.hasFocus()&&g()}),YO(o,n),{editorContainer:n.outerContainer.element().dom()}},getBehaviours:function(n){return Cb(n)?[]:[DB.config({leftAttr:"data-dock-left",topAttr:"data-dock-top",contextual:{lazyContext:function(t){return et.from(n).map(function(t){return Qn.fromDom(t.getBody())})},fadeInClass:"tox-toolbar-dock-fadein",fadeOutClass:"tox-toolbar-dock-fadeout",transitionClass:"tox-toolbar-dock-transition"}}),Xm.config({})]}},MB=function(t,n){return{anchor:"makeshift",x:t,y:n}},FB=function(t,n){var e,o,r,i=yh.DOM.getPos(t);return e=n,o=i.x,r=i.y,MB(e.x+o,e.y+r)},IB=function(t,n){return"contextmenu"===n.type?t.inline?MB((o=n).pageX,o.pageY):FB(t.getContentAreaContainer(),MB((e=n).clientX,e.clientY)):VB(t);var e,o},VB=function(t){return{anchor:"selection",root:Qn.fromDom(t.selection.getNode())}},RB=function(t){return"string"==typeof t?t.split(/[ ,]/):t},HB=function(t){return t.settings.contextmenu_never_use_native||!1},NB=function(t){return e="contextmenu",o="link linkchecker image imagetools table spellchecker configurepermanentpen",r=(n=t).ui.registry.getAll().contextMenus,ft(n.settings,e).map(RB).getOrThunk(function(){return R(RB(o),function(t){return lt(r,t)})});var n,e,o,r},PB=function(t){return S(t)?"|"===t:"separator"===t.type},zB={type:"separator"},LB=function(n){if(S(n))return n;switch(n.type){case"separator":return zB;case"submenu":return{type:"nestedmenuitem",text:n.text,icon:n.icon,getSubmenuItems:function(){var t=n.getSubmenuItems();return S(t)?t:M(t,LB)}};default:return{type:"menuitem",text:n.text,icon:n.icon,onAction:t(n.onAction)}}},jB=function(t,n){if(0===n.length)return t;var e=J(t).filter(function(t){return!PB(t)}).fold(function(){return[]},function(t){return[zB]});return t.concat(e).concat(n).concat([zB])},UB=function(d,t,m){var g=_u(Eg.sketch({dom:{tag:"div"},lazySink:t,onEscape:function(){return d.focus()},fireDismissalEventInstead:{},inlineBehaviours:ia([lg("dismissContextMenu",[si(Gn(),function(t,n){Js.close(t),d.focus()})])])}));d.on("init",function(){d.on("contextmenu",function(n){if(t=d,!n.ctrlKey||HB(t)){var t,e,r,i,o,u=2!==n.button||n.target===d.getBody(),a=u?(e=d,{anchor:"node",node:et.some(Qn.fromDom(e.selection.getNode())),root:Qn.fromDom(e.getBody())}):IB(d,n),c=d.ui.registry.getAll(),s=NB(d),f=u?d.selection.getStart(!0):n.target,l=(r=c.contextMenus,i=f,0<(o=U(s,function(t,n){if(lt(r,n)){var e=r[n].update(i);if(S(e))return jB(t,e.split(" "));if(0<e.length){var o=M(e,LB);return jB(t,o)}return t}return t.concat([n])},[])).length&&PB(o[o.length-1])&&o.pop(),o);Ey(l,gh.CLOSE_ON_EXECUTE,m).map(function(t){n.preventDefault(),Eg.showMenuAt(g,a,{menu:{markers:xv("normal")},data:t})})}})})},WB=function(t){return/^[0-9\.]+(|px)$/i.test(""+t)?et.some(parseInt(t,10)):et.none()},GB=function(t){return _(t)?t+"px":t},XB="data-initial-z-index",YB=function(t,n){var e;t.getSystem().addToGui(n),ye((e=n).element()).each(function(n){hu(n,"z-index").each(function(t){ze(n,XB,t)}),lu(n,"z-index",gu(e.element(),"z-index"))})},qB=function(t){ye(t.element()).each(function(t){var n=je(t,XB);We(t,XB)?lu(t,"z-index",n):bu(t,"z-index"),Ge(t,XB)}),t.getSystem().removeFromGui(t)},KB=function(t,n,e,o){return(r=t,i=n,u=r.element(),a=parseInt(je(u,i.leftAttr),10),c=parseInt(je(u,i.topAttr),10),isNaN(a)||isNaN(c)?et.none():et.some(ha(a,c))).fold(function(){return e},function(t){return yB(t.left()+o.left(),t.top()+o.top())});var r,i,u,a,c},$B=function(t,n,e,o,r,i){var u,a,c,s=KB(t,n,e,o),f=ZB(t,n,s,r,i),l=mB(s,r,i);return u=n,a=l,c=t.element(),ze(c,u.leftAttr,a.left()+"px"),ze(c,u.topAttr,a.top()+"px"),f.fold(function(){return{coord:yB(l.left(),l.top()),extra:et.none()}},function(t){return{coord:t.output(),extra:t.extra()}})},JB=function(t,n){var e,o;e=n,o=t.element(),Ge(o,e.leftAttr),Ge(o,e.topAttr)},ZB=function(t,n,p,h,v){var e=n.getSnapPoints(t);return Ft(e,function(t){var n,e,o,r,i,u,a,c,s,f,l,d,m,g=t.sensor();return n=p,e=g,o=t.range().left(),r=t.range().top(),a=gB(n,i=h,u=v),c=gB(e,i,u),Math.abs(a.left()-c.left())<=o&&Math.abs(a.top()-c.top())<=r?et.some({output:nt((s=t.output(),f=p,l=h,d=v,m=function(o,r){return function(t,n){var e=o(f,l,d);return r(t.getOr(e.left()),n.getOr(e.top()))}},s.fold(m(pB,sB.offset),m(gB,sB.absolute),m(mB,sB.fixed)))),extra:t.extra}):et.none()})},QB=function(e,t,i,u,a,c){return t.fold(function(){var t,e,o,n=(t=i,e=c.left(),o=c.top(),t.fold(function(t,n){return sB.offset(t+e,n+o)},function(t,n){return sB.absolute(t+e,n+o)},function(t,n){return sB.fixed(t+e,n+o)})),r=mB(n,u,a);return yB(r.left(),r.top())},function(n){var t=$B(e,n,i,c,u,a);return t.extra.each(function(t){n.onSensor(e,t)}),t.coord})},tA=function(t,n,e){var o,r=n.getTarget(t.element());if(n.repositionTarget){var i=ve(t.element()),u=xa(i),a=cB(r,u),c=hu(o=r,"left").bind(function(e){return hu(o,"top").bind(function(n){return hu(o,"position").map(function(t){return("fixed"===t?yB:vB)(parseInt(e,10),parseInt(n,10))})})}).getOrThunk(function(){var t=ba(o);return bB(t.left(),t.top())}),s=QB(t,n.snaps,c,u,a,e),f=hB(s,0,a);du(r,f)}n.onDrag(t,r,e)},nA=_r("snaps",[br("getSnapPoints"),Yu("onSensor"),br("leftAttr"),br("topAttr"),Mr("lazyViewport",function(){var t=xa();return{x:t.left,y:t.top,width:nt(x.window.innerWidth),height:nt(x.window.innerHeight),bottom:nt(t.top()+x.window.innerHeight),right:nt(t.left()+x.window.innerWidth)}})]),eA=/* */Object.freeze({getData:function(t){return et.from(ha(t.x(),t.y()))},getDelta:function(t,n){return ha(n.left()-t.left(),n.top()-t.top())}}),oA=[Mr("useFixed",!1),br("blockerClass"),Mr("getTarget",d),Mr("onDrag",tt),Mr("repositionTarget",!0),Yu("onDrop"),nA,Ju("dragger",{handlers:function(a,c){return ii([si(zt(),function(n,t){if(0===t.event().raw().button){t.stop();var e,o={drop:function(){i()},delayDrop:function(){u.schedule()},forceDrop:function(){i()},move:function(t){u.cancel(),c.update(eA,t).each(function(t){tA(n,a,t)})}},r=n.getSystem().build(gb.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[a.blockerClass]},events:(e=o,ii([si(zt(),e.forceDrop),si(Ut(),e.drop),si(Lt(),function(t,n){e.move(n.event())}),si(jt(),e.delayDrop)]))})),i=function(){qB(r),a.snaps.each(function(t){JB(n,t)});var t=a.getTarget(n.element());a.onDrop(n,t)},u=$v(i,200);c.reset(),YB(n,r)}})])}})],rA=/* */Object.freeze({getData:function(t){var n,e=t.raw().touches;return 1===e.length?(n=e[0],et.some(ha(n.clientX,n.clientY))):et.none()},getDelta:function(t,n){return ha(n.left()-t.left(),n.top()-t.top())}}),iA=oA,uA=[Mr("useFixed",!1),Mr("getTarget",d),Mr("onDrag",tt),Mr("repositionTarget",!0),Mr("onDrop",tt),nA,Ju("dragger",{handlers:function(o,r){return ii([hi(Ht()),si(Nt(),function(n,t){t.stop(),r.update(rA,t.event()).each(function(t){tA(n,o,t)})}),si(Pt(),function(n,t){o.snaps.each(function(t){JB(n,t)});var e=o.getTarget(n.element());r.reset(),o.onDrop(n,e)})])}})],aA=/* */Object.freeze({mouse:iA,touch:uA}),cA=/* */Object.freeze({init:function(){var i=et.none(),t=nt({});return Li({readState:t,reset:function(){i=et.none()},update:function(r,t){return r.getData(t).bind(function(t){return n=r,e=t,o=i.map(function(t){return n.getDelta(t,e)}),i=et.some(e),o;var n,e,o})}})}}),sA=sa({branchKey:"mode",branches:aA,name:"dragging",active:{events:function(t,n){return t.dragger.handlers(t,n)}},extra:{snap:oe(["sensor","range","output"],["extra"])},state:cA});(cT=aT||(aT={}))[cT.None=0]="None",cT[cT.Both=1]="Both",cT[cT.Vertical=2]="Vertical";var fA,lA,dA,mA,gA,pA,hA=function(t,n,e,o){var r=t+n,i=e.filter(function(t){return r<t}),u=o.filter(function(t){return t<r});return i.or(u).getOr(r)},vA=function(t,n,e,o,r){var i,u,a={};return a.height=hA(o,n.top(),bb(t),(i=t,et.from(i.getParam("max_height")).filter(_))),e===aT.Both&&(a.width=hA(r,n.left(),vb(t),(u=t,et.from(u.getParam("max_width")).filter(_)))),a},bA=function(t){if(1===t.nodeType){if("BR"===t.nodeName||t.getAttribute("data-mce-bogus"))return!0;if("bookmark"===t.getAttribute("data-mce-type"))return!0}return!1},yA=function(i,u){return u.delimiter||(u.delimiter="\xbb"),{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:ia([km.config({mode:"flow",selector:"div[role=button]"}),zy.config({}),Bm.config({}),lg("elementPathEvents",[bi(function(r,t){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return km.focusIn(r)}),i.on("NodeChange",function(t){var n,o,e=function(t){for(var n=[],e=t.length;0<e--;){var o=t[e];if(1===o.nodeType&&!bA(o)){var r=i.fire("ResolveName",{name:o.nodeName.toLowerCase(),target:o});if(r.isDefaultPrevented()||n.push({name:r.name,element:o}),r.isPropagationStopped())break}}return n}(t.parents);0<e.length&&Bm.set(r,(n=M(e||[],function(n,t){return Bg.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{role:"button","data-index":t,"tab-index":-1,"aria-level":t+1},innerHtml:n.name},action:function(t){i.focus(),i.selection.select(n.element),i.nodeChanged()}})}),o={dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0},innerHtml:" "+u.delimiter+" "}},U(n.slice(1),function(t,n){var e=t;return e.push(o),e.push(n),e},[n[0]])))})})])]),components:[]}},xA=function(s,t){var n,e,o,r,i,u,a,c,f,l,d,m=function(c){return{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:t.translate("Resize")},innerHtml:_g("resize-handle",t.icons)},behaviours:ia([sA.config({mode:"mouse",repositionTarget:!1,onDrag:function(t,n,e){var o,r,i,u,a;o=s,r=e,i=c,u=Qn.fromDom(o.getContainer()),a=vA(o,r,i,Ea(u),ka(u)),rt(a,function(t,n){return lu(u,n,GB(t))}),ov(o)},blockerClass:"tox-blocker"})])}};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(d=[],s.getParam("elementpath",!0,"boolean")&&d.push(yA(s,{})),xn(s.settings.plugins,"wordcount")&&d.push((u=s,a=t,f=function(t,n,e){return Bm.set(t,[Bu(a.translate(["{0} "+e,n[e]]))])},Bg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:ia([zy.config({}),Bm.config({}),Lm.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),lg("wordcount-events",[si(Rn(),function(t){var n=Lm.getValue(t),e="words"===n.mode?"characters":"words";Lm.setValue(t,{mode:e,count:n.count}),f(t,n.count,e)}),bi(function(e){u.on("wordCountUpdate",function(t){var n=Lm.getValue(e).mode;Lm.setValue(e,{mode:n,count:t.wordCount}),f(e,t.wordCount,n)})})])]),eventOrder:(c={},c[Rn()]=["wordcount-events","alloy.base.behaviour"],c)}))),s.getParam("branding",!0,"boolean")&&d.push({dom:{tag:"span",classes:["tox-statusbar__branding"],innerHtml:'<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&amp;utm_medium=poweredby&amp;utm_source=tinymce&amp;utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="'+(l=Op.translate(["Powered by {0}","Tiny"]))+'">'+l+"</a>"}}),r=0<d.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:d}]:[],e=!xn((n=s).settings.plugins,"autoresize"),i=!1===(o=n.getParam("resize",e))?aT.None:"both"===o?aT.Both:aT.Vertical,i!==aT.None&&r.push(m(i)),r)}},wA=function(b){var t,n,e=b.getParam("inline",!1,"boolean"),y=e?_B:aB,o=et.none(),r=Tn.detect().browser.isIE()?["tox-platform-ie"]:[],i=Op.isRtl()?{attributes:{dir:"rtl"}}:{},x=_u({dom:ao({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(r)},i),behaviours:ia([Ms.config({useFixed:!1})])}),u=Ag({dom:{tag:"div",classes:["tox-anchorbar"]}}),a=function(){return o.bind(function(t){return ZT.getMoreButton(t)}).getOrDie("Could not find more button element")},w=function(){return o.bind(function(t){return ZT.getThrobber(t)}).getOrDie("Could not find throbber element")},S=nO(x,b,function(){return o.bind(function(t){return u.getOpt(t)}).getOrDie("Could not find a anchor bar element")},a),k=function(){return vt.value(x)},c=ZT.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:S,onEscape:function(){b.focus()}}),s=ZT.parts().toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:k,backstage:S,onEscape:function(){b.focus()},split:Sb(b),lazyToolbar:function(){return o.bind(function(t){return ZT.getToolbar(t)}).getOrDie("Could not find more toolbar element")},lazyMoreButton:a}),f=ZT.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),l=ZT.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),d=ZT.parts().throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:S}),m=b.getParam("statusbar",!0,"boolean")&&!e?et.some(xA(b,S.shared.providers)):et.none(),g={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[f,l]},p=(n=(t=b).getParam("toolbar"),(D(n)?0<n.length:!1!==t.getParam("toolbar",!0,"boolean"))||yb(b).isSome()),h=!1!==b.getParam("menubar",!0,"boolean"),v=j([h?[c]:[],p?[s]:[],Cb(b)?[]:[u.asSpec()],e?[]:[g]]),C=j([[{dom:{tag:"div",classes:["tox-editor-container"]},components:v}],e?[]:m.toArray(),[d]]),O=ao({role:"application"},Op.isRtl()?{dir:"rtl"}:{}),E=_u(ZT.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(e?["tox-tinymce-inline"]:[]).concat(r),styles:{visibility:"hidden"},attributes:O},components:C,behaviours:ia(y.getBehaviours(b).concat([km.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"})]))}));o=et.some(E),b.shortcuts.add("alt+F9","focus menubar",function(){ZT.focusMenubar(E)}),b.shortcuts.add("alt+F10","focus toolbar",function(){ZT.focusToolbar(E)});var T=pb(E),B=pb(x);AT(b,T,B);var A=function(t){var n,e=yh.DOM,o=b.getParam("width",e.getStyle(t,"width")),r=(n=b).getParam("height",Math.max(n.getElement().offsetHeight,200)),i=vb(b),u=bb(b),a=WB(o).bind(function(n){return GB(i.map(function(t){return Math.max(n,t)}))}).getOr(GB(o)),c=WB(r).bind(function(n){return u.map(function(t){return Math.max(n,t)})}).getOr(r),s=GB(a);if(vu("div","width",s)&&lu(E.element(),"width",s),!b.inline){var f=GB(c);vu("div","height",f)?lu(E.element(),"height",f):lu(E.element(),"height","200px")}return c};return{mothership:T,uiMothership:B,backstage:S,renderUI:function(){var o,r,e,n,i,u,a,c;UB(b,k,S),r=(o=b).ui.registry.getAll().sidebars,F(Q(r),function(n){var t=r[n],e=function(){return et.from(o.queryCommandValue("ToggleSidebar")).is(n)};o.ui.registry.addToggleButton(n,{icon:t.icon,tooltip:t.tooltip,onAction:function(t){o.execCommand("ToggleSidebar",!1,n),t.setActive(e())},onSetup:function(t){var n=function(){return t.setActive(e())};return o.on("ToggleSidebar",n),function(){o.off("ToggleSidebar",n)}}})}),e=b,n=w,i=S.shared,u=_t(!1),a=_t(et.none()),c=function(t){t!==u.get()&&(XT(n(),t,i.providers),u.set(t))},e.on("ProgressState",function(t){if(a.get().each(Ig.clearTimeout),_(t.time)){var n=Ig.setEditorTimeout(e,function(){return c(t.state)},t.time);a.set(et.some(n))}else c(t.state),a.set(et.none())});var t=b.ui.registry.getAll(),s=t.buttons,f=t.menuItems,l=t.contextToolbars,d=t.sidebars,m={menuItems:f,buttons:s,menus:b.settings.menu?it(b.settings.menu,function(t){return St(t,{items:t.items})}):{},menubar:b.settings.menubar,toolbar:yb(b).getOr(b.getParam("toolbar",!0)),sidebar:d};BT(b,l,x,{backstage:S});var g=b.getElement(),p=A(g),h={mothership:T,uiMothership:B,outerContainer:E},v={targetNode:g,height:p};return y.render(b,h,m,S,v)},getUi:function(){return{channels:{broadcastAll:B.broadcast,broadcastOn:B.broadcastOn,register:function(){}}}}}},SA=function(n){Mk.each([{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"}],function(t){n.ui.registry.addToggleButton(t.name,{tooltip:t.text,onAction:function(){return n.execCommand(t.cmd)},icon:t.icon,onSetup:oT(n,t.name)})});var t="alignnone",e="No alignment",o="JustifyNone",r="align-none";n.ui.registry.addButton(t,{tooltip:e,onAction:function(){return n.execCommand(o)},icon:r})},kA=function(t,n){return function(){t.execCommand("mceToggleFormat",!1,n)}},CA=function(t){var n,e;!function(e){Mk.each([{name:"bold",text:"Bold",icon:"bold"},{name:"italic",text:"Italic",icon:"italic"},{name:"underline",text:"Underline",icon:"underline"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],function(t,n){e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:oT(e,t.name),onAction:kA(e,t.name)})});for(var t=1;t<=6;t++){var n="h"+t;e.ui.registry.addToggleButton(n,{text:n.toUpperCase(),tooltip:"Heading "+t,onSetup:oT(e,n),onAction:kA(e,n)})}}(t),n=t,Mk.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"copy",text:"Copy",action:"Copy",icon:"copy"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"help",text:"Help",action:"mceHelp",icon:"help"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"}],function(t){n.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:function(){return n.execCommand(t.action)}})}),e=t,Mk.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],function(t){e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:function(){return e.execCommand(t.action)},onSetup:oT(e,t.name)})})},OA=function(t){var n;CA(t),n=t,Mk.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",shortcut:""},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript",shortcut:""},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript",shortcut:""},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting",shortcut:""},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document",shortcut:""},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A"}],function(t){n.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:function(){return n.execCommand(t.action)}})}),n.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onAction:kA(n,"code")})},EA=function(t,n,e){var o=function(){return!!n.undoManager&&n.undoManager[e]()},r=function(){t.setDisabled(n.readonly||!o())};return t.setDisabled(!o()),n.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r),function(){return n.off("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r)}},TA=function(t){var n,e;(n=t).ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(t){return EA(t,n,"hasUndo")},onAction:function(){return n.execCommand("undo")}}),n.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:function(t){return EA(t,n,"hasRedo")},onAction:function(){return n.execCommand("redo")}}),(e=t).ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(t){return EA(t,e,"hasUndo")},onAction:function(){return e.execCommand("undo")}}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(t){return EA(t,e,"hasRedo")},onAction:function(){return e.execCommand("redo")}})},BA=function(t){var n,e;(n=t).ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:function(){return n.execCommand("mceToggleVisualAid")}}),(e=t).ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:function(t){return function(n,t){n.setActive(t.hasVisual);var e=function(t){n.setActive(t.hasVisual)};return t.on("VisualAid",e),function(){return t.off("VisualAid",e)}}(t,e)},onAction:function(){e.execCommand("mceToggleVisualAid")}})},AA=function(t){var n;(n=t).ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:function(t){return function(t,n){t.setDisabled(!n.queryCommandState("outdent"));var e=function(){t.setDisabled(!n.queryCommandState("outdent"))};return n.on("NodeChange",e),function(){return n.off("NodeChange",e)}}(t,n)},onAction:function(){return n.execCommand("outdent")}}),n.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onAction:function(){return n.execCommand("indent")}})},DA=function(t,n){var e,o,r,i,u,a,c,s,f,l,d,m,g,p,h,v,b,y,x,w;o=n,r=lT(e=t),i=iT(0,o,r.dataset,r),e.ui.registry.addNestedMenuItem("align",{text:o.shared.providers.translate("Align"),getSubmenuItems:function(){return i.items.validateItems(i.getStyleItems())}}),a=n,c=mT(u=t),s=iT(0,a,c.dataset,c),u.ui.registry.addNestedMenuItem("fontformats",{text:a.shared.providers.translate("Fonts"),getSubmenuItems:function(){return s.items.validateItems(s.getStyleItems())}}),f=t,d=(l=n).styleselect,m=iT(0,l,d,yT(f)),f.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return m.items.validateItems(m.getStyleItems())}}),p=n,h=bT(g=t),v=iT(0,p,h.dataset,h),g.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return v.items.validateItems(v.getStyleItems())}}),y=n,x=pT(b=t),w=iT(0,y,x.dataset,x),b.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return w.items.validateItems(w.getStyleItems())}})},_A=function(t,n){SA(t),OA(t),DA(t,n),TA(t),hv.register(t),BA(t),AA(t)},MA=function(t,n){var e=et.from(je(t,"id")).fold(function(){var t=io("dialog-label");return ze(n,"id",t),t},d);ze(t,"aria-labelledby",e)},FA=nt([br("lazySink"),Er("dragBlockClass"),Mr("useTabstopAt",nt(!0)),Mr("eventOrder",{}),of("modalBehaviours",[km]),qu("onExecute"),$u("onEscape")]),IA={sketch:d},VA=nt([Hf({name:"draghandle",overrides:function(t,n){return{behaviours:ia([sA.config({mode:"mouse",getTarget:function(t){return Iu(t,'[role="dialog"]').getOr(t)},blockerClass:t.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+Ro(n,null,2)).message)})])}}}),Vf({schema:[br("dom")],name:"title"}),Vf({factory:IA,schema:[br("dom")],name:"close"}),Vf({factory:IA,schema:[br("dom")],name:"body"}),Hf({factory:IA,schema:[br("dom")],name:"footer"}),Rf({factory:{sketch:function(t,n){return ao({},t,{dom:n.dom,components:n.components})}},schema:[Mr("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Mr("components",[])],name:"blocker"})]),RA=ml({name:"ModalDialog",configFields:FA(),partFields:VA(),factory:function(r,t,n,o){var a=io("alloy.dialog.busy"),c=io("alloy.dialog.idle"),s=ia([km.config({mode:"special",onTab:function(){return et.some(!0)},onShiftTab:function(){return et.some(!0)}}),Xm.config({})]),e=io("modal-events"),i=ao({},r.eventOrder,{"alloy.system.attached":[e].concat(r.eventOrder["alloy.system.attached"]||[])});return{uid:r.uid,dom:r.dom,components:t,apis:{show:function(i){var t=r.lazySink(i).getOrDie(),u=_t(et.none()),n=o.blocker(),e=t.getSystem().build(ao({},n,{components:n.components.concat([Mu(i)]),behaviours:ia([lg("dialog-blocker-events",[si(c,function(t,n){We(i.element(),"aria-busy")&&(Ge(i.element(),"aria-busy"),u.get().each(function(t){return Bm.remove(i,t)}))}),si(a,function(t,n){ze(i.element(),"aria-busy","true");var e=n.event().getBusySpec();u.get().each(function(t){Bm.remove(i,t)});var o=e(i,s),r=t.getSystem().build(o);u.set(et.some(r)),Bm.append(i,Mu(r)),r.hasConfigured(km)&&km.focusIn(r)})])])}));Vs(t,e),km.focusIn(i)},hide:function(n){ye(n.element()).each(function(t){n.getSystem().getByDom(t).each(function(t){Ns(t)})})},getBody:function(t){return $f(t,r,"body")},getFooter:function(t){return $f(t,r,"footer")},setIdle:function(t){Wr(t,c)},setBusy:function(t,n){Gr(t,a,{getBusySpec:n})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:uf(r.modalBehaviours,[Bm.config({}),km.config({mode:"cyclic",onEnter:r.onExecute,onEscape:r.onEscape,useTabstopAt:r.useTabstopAt}),lg(e,[bi(function(t){var n,e,o;MA(t.element(),$f(t,r,"title").element()),n=t.element(),e=$f(t,r,"body").element(),o=et.from(je(n,"id")).fold(function(){var t=io("dialog-describe");return ze(e,"id",t),t},d),ze(n,"aria-describedby",o)})])])}},apis:{show:function(t,n){t.show(n)},hide:function(t,n){t.hide(n)},getBody:function(t,n){return t.getBody(n)},getFooter:function(t,n){return t.getFooter(n)},setBusy:function(t,n,e){t.setBusy(n,e)},setIdle:function(t,n){t.setIdle(n)}}}),HA=[xr("type"),xr("text"),wr("level",["info","warn","error","success"]),xr("icon"),Mr("url","")],NA=[xr("type"),xr("text"),Hr("primary",!1),Jo("name","name",ho(function(){return io("button-name")}),gr),Ar("icon")],PA=[xr("type"),xr("name"),xr("label")],zA=pr,LA=[xr("type"),xr("name"),Ar("label")],jA=LA,UA=gr,WA=LA,GA=gr,XA=LA,YA=er(),qA=LA.concat([Hr("sandboxed",!0)]),KA=gr,$A=LA.concat([Ar("placeholder")]),JA=gr,ZA=LA.concat([Cr("items",[xr("text"),xr("value")]),Ir("size",1)]),QA=gr,tD=LA.concat([Hr("constrain",!0)]),nD=Go([xr("width"),xr("height")]),eD=LA.concat([Ar("placeholder")]),oD=gr,rD=LA.concat([Rr("filetype","file",["image","media","file"])]),iD=Go([xr("value"),Mr("meta",{})]),uD=LA.concat([xr("type"),Vr("tag","textarea"),Sr("init")]),aD=gr,cD=[xr("type"),xr("html"),Rr("presets","presentation",["presentation","document"])],sD=LA.concat([yr("currentState",Go([br("blob"),xr("url")]))]),fD=LA.concat([Mr("columns","auto")]),lD=nr([xr("value"),xr("text"),xr("icon")]),dD=[xr("type"),Or("header",gr),Or("cells",Xo(gr))],mD=function(n){return Jo("items","items",go(),Xo(or(function(t){return ur("Checking item of "+n,gD,t).fold(function(t){return vt.error(sr(t))},function(t){return vt.value(t)})})))},gD=fr("type",{alertbanner:HA,bar:(mA=mD("bar"),[xr("type"),mA]),button:NA,checkbox:PA,colorinput:jA,colorpicker:WA,dropzone:XA,grid:(lA=mD("grid"),[xr("type"),(dA="columns",yr(dA,mr)),lA]),iframe:qA,input:$A,selectbox:ZA,sizeinput:tD,textarea:eD,urlinput:rD,customeditor:uD,htmlpanel:cD,imagetools:sD,collection:fD,label:(fA=mD("label"),[xr("type"),xr("label"),fA]),table:dD}),pD=[xr("type"),Or("items",gD)],hD=[Jo("name","name",ho(function(){return io("tab-name")}),gr),xr("title"),Or("items",gD)],vD=[xr("type"),Cr("tabs",hD)],bD=[Jo("name","name",ho(function(){return io("button-name")}),gr),xr("text"),Ar("icon"),Rr("align","end",["start","end"]),Hr("primary",!1),Hr("disabled",!1)],yD=Go([wr("type",["submit","cancel","custom"])].concat(bD)),xD=Go([xr("title"),yr("body",fr("type",{panel:pD,tabpanel:vD})),Vr("size","normal"),Or("buttons",yD),Mr("initialData",{}),Nr("onAction",tt),Nr("onChange",tt),Nr("onSubmit",tt),Nr("onClose",tt),Nr("onCancel",tt),Mr("onTabChange",tt)]),wD=function(t){return k(t)?[t].concat(W(st(t),wD)):D(t)?W(t,wD):[]},SD=function(t){return S(t.type)&&S(t.name)},kD={checkbox:zA,colorinput:UA,colorpicker:GA,dropzone:YA,input:JA,iframe:KA,sizeinput:nD,selectbox:QA,size:nD,textarea:oD,urlinput:iD,customeditor:aD,collection:lD},CD=function(t){var n=W(R(wD(t),SD),function(n){return(t=n,et.from(kD[t.type])).fold(function(){return[]},function(t){return[yr(n.name,t)]});var t});return Go(n)},OD=Go([wr("type",["cancel","custom"])].concat(bD)),ED=Go([xr("title"),xr("url"),Br("height"),Br("width"),(gA="buttons",pA=OD,Tr(gA,Xo(pA))),Nr("onAction",tt),Nr("onCancel",tt),Nr("onClose",tt),Nr("onMessage",tt)]),TD=function(t){return{internalDialog:ar(ur("dialog",xD,t)),dataValidator:CD(t),initialData:t.initialData}},BD={open:function(t,n){var e=TD(n);return t(e.internalDialog,e.initialData,e.dataValidator)},openUrl:function(t,n){return t(ar(ur("dialog",ED,n)))},redial:function(t){return TD(t)}},AD=function(t){var e=[],o={};return rt(t,function(t,n){t.fold(function(){e.push(n)},function(t){o[n]=t})}),0<e.length?vt.error(e):vt.value(o)},DD=dl({name:"TabButton",configFields:[Mr("uid",undefined),br("value"),Jo("dom","dom",vo(function(t){return{attributes:{role:"tab",id:io("aria"),"aria-selected":"false"}}}),lr()),Er("action"),Mr("domModification",{}),of("tabButtonBehaviours",[Xm,km,Lm]),br("view")],factory:function(t,n){return{uid:t.uid,dom:t.dom,components:t.components,events:Tg(t.action),behaviours:uf(t.tabButtonBehaviours,[Xm.config({}),km.config({mode:"execution",useSpace:!0,useEnter:!0}),Lm.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}}}),_D=nt([br("tabs"),br("dom"),Mr("clickToDismiss",!1),of("tabbarBehaviours",[Dl,km]),Gu(["tabClass","selectedClass"])]),MD=Nf({factory:DD,name:"tabs",unit:"tab",overrides:function(o,t){var r=function(t,n){Dl.dehighlight(t,n),Gr(t,Kn(),{tabbar:t,button:n})},i=function(t,n){Dl.highlight(t,n),Gr(t,qn(),{tabbar:t,button:n})};return{action:function(t){var n=t.getSystem().getByUid(o.uid).getOrDie(),e=Dl.isHighlighted(n,t);(e&&o.clickToDismiss?r:e?tt:i)(n,t)},domModification:{classes:[o.markers.tabClass]}}}}),FD=nt([MD]),ID=ml({name:"Tabbar",configFields:_D(),partFields:FD(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:uf(t.tabbarBehaviours,[Dl.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,n){ze(n.element(),"aria-selected","true")},onDehighlight:function(t,n){ze(n.element(),"aria-selected","false")}}),km.config({mode:"flow",getInitial:function(t){return Dl.getHighlighted(t).map(function(t){return t.element()})},selector:"."+t.markers.tabClass,executeOnMove:!0})])}}}),VD=dl({name:"Tabview",configFields:[of("tabviewBehaviours",[Bm])],factory:function(t,n){return{uid:t.uid,dom:t.dom,behaviours:uf(t.tabviewBehaviours,[Bm.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),RD=nt([Mr("selectFirst",!0),Yu("onChangeTab"),Yu("onDismissTab"),Mr("tabs",[]),of("tabSectionBehaviours",[])]),HD=Vf({factory:ID,schema:[br("dom"),kr("markers",[br("tabClass"),br("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),ND=Vf({factory:VD,name:"tabview"}),PD=nt([HD,ND]),zD=ml({name:"TabSection",configFields:RD(),partFields:PD(),factory:function(i,t,n,e){var o=function(t,n){Kf(t,i,"tabbar").each(function(t){n(t).each(Xr)})};return{uid:i.uid,dom:i.dom,components:t,behaviours:rf(i.tabSectionBehaviours),events:ii(j([i.selectFirst?[bi(function(t,n){o(t,Dl.getFirst)})]:[],[si(qn(),function(t,n){var o,r,e=n.event().button();o=e,r=Lm.getValue(o),Kf(o,i,"tabview").each(function(e){N(i.tabs,function(t){return t.value===r}).each(function(t){var n=t.view();ze(e.element(),"aria-labelledby",je(o.element(),"id")),Bm.set(e,n),i.onChangeTab(e,o,n)})})}),si(Kn(),function(t,n){var e=n.event().button();i.onDismissTab(t,e)})]])),apis:{getViewItems:function(t){return Kf(t,i,"tabview").map(function(t){return Bm.contents(t)}).getOr([])},showTab:function(t,e){o(t,function(n){var t=Dl.getCandidates(n);return N(t,function(t){return Lm.getValue(t)===e}).filter(function(t){return!Dl.isHighlighted(n,t)})})}}}},apis:{getViewItems:function(t,n){return t.getViewItems(n)},showTab:function(t,n,e){t.showTab(n,e)}}}),LD=function(i,u,t){Iu(i,'[role="dialog"]').each(function(r){t.get().map(function(t){return lu(u,"height","0"),Math.min(t,(e=i,o=Iu(n=r,".tox-dialog-wrap").getOr(n),("fixed"===gu(o,"position")?Math.max(x.document.documentElement.clientHeight,x.window.innerHeight):Math.max(x.document.documentElement.offsetHeight,x.document.documentElement.scrollHeight))-(n.dom().getBoundingClientRect().height-e.dom().getBoundingClientRect().height)));var n,e,o}).each(function(t){lu(u,"height",t+"px")})})},jD=function(a){var c;return{smartTabHeight:(c=_t(et.none()),{extraEvents:[bi(function(t){Vu(t.element(),'[role="tabpanel"]').each(function(u){var n;lu(u,"visibility","hidden"),t.getSystem().getByDom(u).toOption().each(function(t){var o,r,i,n=(r=u,i=t,M(o=a,function(t,n){Bm.set(i,o[n].view());var e=r.dom().getBoundingClientRect();return Bm.set(i,[]),e.height})),e=$(K(n,function(t,n){return n<t?-1:t<n?1:0}));c.set(e)}),LD(t.element(),u,c),bu(u,"visibility"),n=t,$(a).each(function(t){return zD.showTab(n,t.value)}),Ig.requestAnimationFrame(function(){LD(t.element(),u,c)})})}),si(jn(),function(n){Vu(n.element(),'[role="tabpanel"]').each(function(t){LD(n.element(),t,c)})}),si(Fb,function(r,t){Vu(r.element(),'[role="tabpanel"]').each(function(n){var t=Ul();lu(n,"visibility","hidden");var e=hu(n,"height").map(function(t){return parseInt(t,10)});bu(n,"height");var o=n.dom().getBoundingClientRect().height;e.forall(function(t){return t<o})?(c.set(et.from(o)),LD(r.element(),n,c)):e.each(function(t){lu(n,"height",t+"px")}),bu(n,"visibility"),t.each(jl)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}},UD="send-data-to-section",WD="send-data-to-view",GD=io("update-dialog"),XD=io("update-title"),YD=io("update-body"),qD=io("update-footer"),KD=io("body-send-message"),$D=function(t,n,d,e){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:ao({},n.map(function(t){return{id:t}}).getOr({}),e?{"aria-live":"polite"}:{})},components:[],behaviours:ia([Zw(0),OE.config({channel:YD,updateState:function(t,n){return et.some({isTabPanel:function(){return"tabpanel"===n.body.type}})},renderComponents:function(t){switch(t.body.type){case"tabpanel":return[(r={tabs:t.body.tabs},i=d,u=_t({}),a=function(t){var n=Lm.getValue(t),e=AD(n).getOr({}),o=u.get(),r=wt(o,e);u.set(r)},c=function(t){var n=u.get();Lm.setValue(t,n)},s=_t(null),f=M(r.tabs,function(t){return{value:t.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:i.shared.providers.translate(t.title)},view:function(){return[jw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:M(t.items,function(t){return mC(n,t,i)}),formBehaviours:ia([km.config({mode:"acyclic",useTabstopAt:w(mS)}),lg("TabView.form.events",[bi(c),yi(a)]),ma.config({channels:Bt([{key:UD,value:{onReceive:a}},{key:WD,value:{onReceive:c}}])})])}})]}}}),l=jD(f).smartTabHeight,zD.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,n,e){var o=Lm.getValue(n);Gr(t,Mb,{name:o,oldName:s.get()}),s.set(o)},tabs:f,components:[zD.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[ID.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:ia([zy.config({})])}),zD.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:ia([lg("tabpanel",l.extraEvents),km.config({mode:"acyclic"}),vl.config({find:function(t){return $(zD.getViewItems(t))}}),Lm.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([UD],{}),u.get()},setValue:function(t,n){u.set(n),t.getSystem().broadcastOn([WD],{})}}})])}))];default:return[(e={items:t.body.items},o=d,n=Ag(jw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:M(e.items,function(t){return mC(n,t,o)})}})),{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:ia([km.config({mode:"acyclic",useTabstopAt:w(mS)}),Jw(n),rS(n,{postprocess:function(t){return AD(t).fold(function(t){return x.console.error(t),{}},function(t){return t})}})])})]}var e,o,n,r,i,u,a,c,s,f,l},initialData:t})])}},JD=function(t,e){return[gi(Gt(),gS),t(Eb,function(t,n){e.onClose(),n.onClose()}),t(Tb,function(t,n,e,o){n.onCancel(t),Wr(o,Eb)}),si(_b,function(t,n){return e.onUnblock()}),si(Db,function(t,n){return e.onBlock(n.event())})]},ZD=function(i,t){var n=function(t,r){return si(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){OE.getState(n).get().each(function(t){e(t,n)})};return JD(n,t).concat([n(Bb,function(t,n,e){n.onAction(t,{name:e.name()})})])},QD=function(i,t){var n=function(t,r){return si(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){OE.getState(n).get().each(function(t){e(t.internalDialog,n)})};return JD(n,t).concat([n(Ab,function(t,n){return n.onSubmit(t)}),n(Ob,function(t,n,e){n.onChange(t,{name:e.name()})}),n(Bb,function(t,n,e){n.onAction(t,{name:e.name(),value:e.value()})}),n(Mb,function(t,n,e){n.onTabChange(t,{newTabName:e.name(),oldTabName:e.oldName()})}),yi(function(t){var n=i();Lm.setValue(t,n.getData())})])},t_=function(t,n){var e=n.map(function(t){return t.footerButtons}).getOr([]),o=V(e,function(t){return"start"===t.align}),r=function(t,n){return gb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:M(n,function(t){return t.memento.asSpec()})})};return[r("start",o.pass),r("end",o.fail)]},n_=function(t,i){return{dom:Cp('<div class="tox-dialog__footer"></div>'),components:[],behaviours:ia([OE.config({channel:qD,initialData:t,updateState:function(t,n){var r=M(n.buttons,function(t){var n,e,o=Ag((e=i,mk(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return et.some({lookupByName:function(t,n){return e=t,o=n,N(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:t_})])}},e_=function(t,n){return RA.parts().footer(n_(t,n))},o_=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=vl.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return jw.getField(o,e).fold(function(){var t=n.getFooter();return OE.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return et.some(t)})}return et.none()},r_=function(c,o){var t=function(t){var n=c.getRoot();n.getSystem().isConnected()&&t(n)},s={getData:function(){var t=c.getRoot(),n=t.getSystem().isConnected()?c.getFormWrapper():t;return Lm.getValue(n)},setData:function(a){t(function(t){var n,e,o=s.getData(),r=St(o,a),i=(n=r,e=c.getRoot(),OE.getState(e).get().map(function(t){return ar(ur("data",t.dataValidator,n))}).getOr(n)),u=c.getFormWrapper();Lm.setValue(u,i)})},disable:function(t){o_(c,t).each(ih.disable)},enable:function(t){o_(c,t).each(ih.enable)},focus:function(t){o_(c,t).each(Xm.focus)},block:function(n){if(!S(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){Gr(t,Db,{message:n})})},unblock:function(){t(function(t){Wr(t,_b)})},showTab:function(e){t(function(t){var n=c.getBody();OE.getState(n).get().exists(function(t){return t.isTabPanel()})&&vl.getCurrent(n).each(function(t){zD.showTab(t,e)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([GD],n),t.getSystem().broadcastOn([XD],n.internalDialog),t.getSystem().broadcastOn([YD],n.internalDialog),t.getSystem().broadcastOn([qD],n.internalDialog),s.setData(n.initialData)})},close:function(){t(function(t){Wr(t,Eb)})}};return s},i_=function(t){return Bg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close"),title:t.translate("Close")}},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:'<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M17.953 7.453L13.422 12l4.531 4.547-1.406 1.406L12 13.422l-4.547 4.531-1.406-1.406L10.578 12 6.047 7.453l1.406-1.406L12 10.578l4.547-4.531z" fill-rule="evenodd"></path></svg>'}}],action:function(t){Wr(t,Tb)}})},u_=function(t,n,e){var o=function(t){return[Bu(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:ao({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:ia([OE.config({channel:XD,renderComponents:o})])}},a_=function(t,n){return e={title:n.shared.providers.translate(t),draggable:!0},o=n.shared.providers,r=RA.parts().title(u_(e,et.none(),o)),i=RA.parts().draghandle({dom:Cp('<div class="tox-dialog__draghandle"></div>')}),u=RA.parts().close(i_(o)),a=[r].concat(e.draggable?[i]:[]).concat([u]),gb.sketch({dom:Cp('<div class="tox-dialog__header"></div>'),components:a});var e,o,r,i,u,a},c_=function(t,n){return{onClose:function(){return n.closeWindow()},onBlock:function(e){RA.setBusy(t(),function(t,n){return{dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":e.message()},styles:{left:"0px",right:"0px",bottom:"0px",top:"0px",position:"absolute"}},behaviours:n,components:[{dom:Cp('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){RA.setIdle(t())}}},s_=function(t,n,e,o){var r;return _u(RA.sketch({lazySink:o.shared.getSink,onEscape:function(t){return Wr(t,Tb),et.some(!0)},useTabstopAt:function(t){return!mS(t)&&("button"!==Fe(t)||"disabled"!==je(t,"disabled"))},modalBehaviours:ia([OE.config({channel:GD,updateState:function(t,n){return et.some(n)},initialData:n}),aS({}),Xm.config({}),lg("execute-on-form",e.concat([vi(Gt(),function(t,n){km.focusIn(t)})])),lg("scroll-lock",[bi(function(){ou(Qr(),"tox-dialog__disable-scroll")}),yi(function(){ru(Qr(),"tox-dialog__disable-scroll")})])].concat(t.extraBehaviours)),eventOrder:(r={},r[Fn()]=["execute-on-form"],r[Mn()]=["reflecting","receiving"],r[Un()]=["scroll-lock","reflecting","messages","execute-on-form","alloy.base.behaviour"],r[Wn()]=["alloy.base.behaviour","execute-on-form","messages","reflecting","scroll-lock"],r),dom:{tag:"div",classes:["tox-dialog"].concat(t.extraClasses),styles:ao({position:"relative"},t.extraStyles)},components:[t.header,t.body].concat(t.footer.toArray()),dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:Cp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}}))},f_=function(t,n,e){var o,r,i,u=a_(t.internalDialog.title,e),a=(o={body:t.internalDialog.body},r=e,i=$D(o,et.none(),r,!1),RA.parts().body(i)),c=e_({buttons:t.internalDialog.buttons},e.shared.providers),s=QD(function(){return m},c_(function(){return d},n)),f="normal"!==t.internalDialog.size?"large"===t.internalDialog.size?["tox-dialog--width-lg"]:["tox-dialog--width-md"]:[],l={header:u,body:a,footer:et.some(c),extraClasses:f,extraBehaviours:[],extraStyles:{}},d=s_(l,t,s,e),m=r_({getRoot:function(){return d},getBody:function(){return RA.getBody(d)},getFooter:function(){return RA.getFooter(d)},getFormWrapper:function(){var t=RA.getBody(d);return vl.getCurrent(t).getOr(t)}},n.redial);return{dialog:d,instanceApi:m}},l_=tinymce.util.Tools.resolve("tinymce.util.URI"),d_=["insertContent","setContent","execCommand","close","block","unblock"],m_=function(t){return k(t)&&-1!==d_.indexOf(t.mceAction)},g_=function(o,t,r,n){var e,i,u,a,c=a_(o.title,n),s=(i={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[pS({dom:{tag:"iframe",attributes:{src:o.url}},behaviours:ia([zy.config({}),Xm.config({})])})]}],behaviours:ia([km.config({mode:"acyclic",useTabstopAt:w(mS)})])},RA.parts().body(i)),f=o.buttons.bind(function(t){return 0===t.length?et.none():et.some(e_({buttons:t},n.shared.providers))}),l=ZD(function(){return y},c_(function(){return b},t)),d=ao({},o.height.fold(function(){return{}},function(t){return{height:t+"px","max-height":t+"px"}}),o.width.fold(function(){return{}},function(t){return{width:t+"px","max-width":t+"px"}})),m=o.width.isNone()&&o.height.isNone()?["tox-dialog--width-lg"]:[],g=new l_(o.url,{base_uri:new l_(x.window.location.href)}),p=g.protocol+"://"+g.host+(g.port?":"+g.port:""),h=_t(et.none()),v=[lg("messages",[bi(function(){var t=Yv(Qn.fromDom(x.window),"message",function(t){if(g.isSameOrigin(new l_(t.raw().origin))){var n=t.raw().data;m_(n)?function(t,n,e){switch(e.mceAction){case"insertContent":t.insertContent(e.content);break;case"setContent":t.setContent(e.content);break;case"execCommand":var o=!!C(e.ui)&&e.ui;t.execCommand(e.cmd,o,e.value);break;case"close":n.close();break;case"block":n.block(e.message);break;case"unblock":n.unblock()}}(r,y,n):!m_(e=n)&&k(e)&&lt(e,"mceAction")&&o.onMessage(y,n)}var e});h.set(et.some(t))}),yi(function(){h.get().each(function(t){return t.unbind()})})]),ma.config({channels:(e={},e[KD]={onReceive:function(t,n){Vu(t.element(),"iframe").each(function(t){t.dom().contentWindow.postMessage(n,p)})}},e)})],b=s_({header:c,body:s,footer:f,extraClasses:m,extraBehaviours:v,extraStyles:d},o,l,n),y=(u=b,a=function(t){u.getSystem().isConnected()&&t(u)},{block:function(n){if(!S(n))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");a(function(t){Gr(t,Db,{message:n})})},unblock:function(){a(function(t){Wr(t,_b)})},close:function(){a(function(t){Wr(t,Eb)})},sendMessage:function(n){a(function(t){t.getSystem().broadcastOn([KD],n)})}});return{dialog:b,instanceApi:y}},p_=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p=io("dialog-label"),h=io("dialog-content"),v=Ag((u={title:t.internalDialog.title,draggable:!0},a=p,c=e.shared.providers,gb.sketch({dom:Cp('<div class="tox-dialog__header"></div>'),components:[u_(u,et.some(a),c),i_(c)],containerBehaviours:ia([sA.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return Ru(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),b=Ag((s={body:t.internalDialog.body},f=h,l=e,d=o,$D(s,et.some(f),l,d))),y=Ag((m={buttons:t.internalDialog.buttons},g=e.shared.providers,n_(m,g))),x=QD(function(){return S},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}}),w=_u({dom:{tag:"div",classes:["tox-dialog"],attributes:(r={role:"dialog"},r["aria-labelledby"]=p,r["aria-describedby"]=""+h,r)},eventOrder:(i={},i[Mn()]=[OE.name(),ma.name()],i[Fn()]=["execute-on-form"],i[Un()]=["reflecting","execute-on-form"],i),behaviours:ia([km.config({mode:"cyclic",onEscape:function(t){return Wr(t,Eb),et.some(!0)},useTabstopAt:function(t){return!mS(t)&&("button"!==Fe(t)||"disabled"!==je(t,"disabled"))}}),OE.config({channel:GD,updateState:function(t,n){return et.some(n)},initialData:t}),lg("execute-on-form",x),aS({})]),components:[v.asSpec(),b.asSpec(),y.asSpec()]}),S=r_({getRoot:function(){return w},getFooter:function(){return y.get(w)},getBody:function(){return b.get(w)},getFormWrapper:function(){var t=b.get(w);return vl.getCurrent(t).getOr(t)}},n.redial);return{dialog:w,instanceApi:S}},h_=function(t,n){return RA.parts().close(Bg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:ia([zy.config({})])}))},v_=function(){return RA.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},b_=function(t,n){return RA.parts().body({dom:{tag:"div",classes:["tox-dialog__body","todo-tox-fit"]},components:[{dom:Cp("<p>"+n.translate(t)+"</p>")}]})},y_=function(t){return RA.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},x_=function(t,n){return[gb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),gb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},w_=function(e){return RA.sketch({lazySink:e.lazySink,onEscape:function(){return e.onCancel(),et.some(!0)},dom:{tag:"div",classes:["tox-dialog"].concat(e.extraClasses)},components:[{dom:{tag:"div",classes:["tox-dialog__header"]},components:[e.partSpecs.title,e.partSpecs.close]},e.partSpecs.body,e.partSpecs.footer],parts:{blocker:{dom:Cp('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:ia([lg("basic-dialog-events",[si(Tb,function(t,n){e.onCancel()}),si(Ab,function(t,n){e.onSubmit()})])])})},S_=function(s){var u,a,e=(u=s.backstage.shared,{open:function(t,n){var e=function(){RA.hide(r),n()},o=Ag(mk({name:"close-alert",text:"OK",primary:!0,icon:et.none()},"cancel",u.providers)),r=_u(w_({lazySink:function(){return u.getSink()},partSpecs:{title:v_(),close:h_(function(){e()},u.providers),body:b_(t,u.providers),footer:y_(x_([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:tt,extraClasses:["tox-alert-dialog"]}));RA.show(r);var i=o.get(r);Xm.focus(i)}}),o=(a=s.backstage.shared,{open:function(t,n){var e=function(t){RA.hide(i),n(t)},o=Ag(mk({name:"yes",text:"Yes",primary:!0,icon:et.none()},"submit",a.providers)),r=mk({name:"no",text:"No",primary:!0,icon:et.none()},"cancel",a.providers),i=_u(w_({lazySink:function(){return a.getSink()},partSpecs:{title:v_(),close:h_(function(){e(!1)},a.providers),body:b_(t,a.providers),footer:y_(x_([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));RA.show(i);var u=o.get(i);Xm.focus(u)}}),r=function(t,e){return BD.openUrl(function(t){var n=g_(t,{closeWindow:function(){RA.hide(n.dialog),e(n.instanceApi)}},s.editor,s.backstage);return RA.show(n.dialog),n.instanceApi},t)},i=function(t,i){return BD.open(function(t,n,e){var o=n,r=f_({dataValidator:e,initialData:o,internalDialog:t},{redial:BD.redial,closeWindow:function(){RA.hide(r.dialog),i(r.instanceApi)}},s.backstage);return RA.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},c=function(t,u,a,c){return BD.open(function(t,n,e){var o=ar(ur("data",e,n)),r=p_({dataValidator:e,initialData:o,internalDialog:t},{redial:BD.redial,closeWindow:function(){Eg.hide(i),a(r.instanceApi)}},s.backstage,c),i=_u(Eg.sketch({lazySink:s.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:ia([lg("window-manager-inline-events",[si(Gn(),function(t,n){Wr(r.dialog,Tb)})])])}));return Eg.showAt(i,u,Mu(r.dialog)),r.instanceApi.setData(o),km.focusIn(r.dialog),r.instanceApi},t)};return{open:function(t,n,e){return n!==undefined&&"toolbar"===n.inline?c(t,s.backstage.shared.anchors.toolbar(),e,n.ariaAttrs):n!==undefined&&"cursor"===n.inline?c(t,s.backstage.shared.anchors.cursor(),e,n.ariaAttrs):i(t,e)},openUrl:function(t,n){return r(t,n)},alert:function(t,n){e.open(t,function(){n()})},close:function(t){t.close()},confirm:function(t,n){o.open(t,function(t){n(t)})}}};uo.add("silver",function(t){var n=wA(t),e=n.mothership,o=n.uiMothership,r=n.backstage,i=n.renderUI,u=n.getUi;_A(t,r),eo(io("silver-demo"),e),eo(io("silver-ui-demo"),o),jv(t,r.shared);var a=S_({editor:t,backstage:r});return{renderUI:i,getWindowManagerImpl:nt(a),getNotificationManagerImpl:function(){return Vg(t,{backstage:r},o)},ui:u()}}),function q_(){}}(window);