theme.min.js 398 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.4.2 (2020-08-17)
  8. */
  9. !function(nt){"use strict";var Z=function(){},d=function(e,o){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(o.apply(null,t))}},at=function(t){return function(){return t}},ct=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 x=function(n){return function(t){return!n(t)}},u=function(t){return function(){throw new Error(t)}},c=at(!1),i=at(!0),t=tinymce.util.Tools.resolve("tinymce.ThemeManager"),et=function(){return(et=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 y(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&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(e[o[r]]=t[o[r]])}return e}function b(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var o=Array(t),r=0;for(n=0;n<e;n++)for(var i=arguments[n],u=0,a=i.length;u<a;u++,r++)o[r]=i[u];return o}var n,e,o,r,a,s,f=function(){return l},l=(n=function(t){return t.isNone()},{fold:function(t,n){return t()},is:c,isSome:c,isNone:i,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:at(null),getOrUndefined:at(undefined),or:o,orThunk:e,map:f,each:Z,bind:f,exists:c,forall:i,filter:f,equals:n,equals_:n,toArray:function(){return[]},toString:at("none()")}),m=function(e){var t=at(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:i,isNone:c,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){return m(t(e))},each:function(t){t(e)},bind:o,exists:o,forall:o,filter:function(t){return t(e)?r:l},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(c,function(t){return n(e,t)})}};return r},st={some:m,none:f,from:function(t){return null===t||t===undefined?l:m(t)}},p=function(o){return function(t){return e=typeof(n=t),(null===n?"null":"object"==e&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==e&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":e)===o;var n,e}},h=function(n){return function(t){return typeof t===n}},w=p("string"),S=p("object"),v=p("array"),k=h("boolean"),C=(r=undefined,function(t){return r===t}),O=function(t){return!(null===(n=t)||n===undefined);var n},_=h("function"),ot=h("number"),T=function(t,n){if(v(t)){for(var e=0,o=t.length;e<o;++e)if(!n(t[e]))return!1;return!0}return!1},E=Array.prototype.slice,B=Array.prototype.indexOf,D=Array.prototype.push,M=function(t,n){return B.call(t,n)},A=function(t,n){return-1<M(t,n)},F=function(t,n){for(var e=0,o=t.length;e<o;e++){if(n(t[e],e))return!0}return!1},I=function(t,n){for(var e=[],o=0;o<t;o++)e.push(n(o));return e},R=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=E.call(t,o,o+n);e.push(r)}return e},V=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)}return o},rt=function(t,n){for(var e=0,o=t.length;e<o;e++){n(t[e],e)}},P=function(t,n){for(var e=[],o=[],r=0,i=t.length;r<i;r++){var u=t[r];(n(u,r)?e:o).push(u)}return{pass:e,fail:o}},H=function(t,n){for(var e=[],o=0,r=t.length;o<r;o++){var i=t[o];n(i,o)&&e.push(i)}return e},z=function(t,n,e){return function(t,n){for(var e=t.length-1;0<=e;e--){n(t[e],e)}}(t,function(t){e=n(e,t)}),e},N=function(t,n,e){return rt(t,function(t){e=n(e,t)}),e},L=function(t,n){return function(t,n,e){for(var o=0,r=t.length;o<r;o++){var i=t[o];if(n(i,o))return st.some(i);if(e(i,o))break}return st.none()}(t,n,c)},j=function(t,n){for(var e=0,o=t.length;e<o;e++){if(n(t[e],e))return st.some(e)}return st.none()},it=function(t){for(var n=[],e=0,o=t.length;e<o;++e){if(!v(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);D.apply(n,t[e])}return n},U=function(t,n){return it(V(t,n))},W=function(t,n){for(var e=0,o=t.length;e<o;++e){if(!0!==n(t[e],e))return!1}return!0},G=function(t){var n=E.call(t,0);return n.reverse(),n},X=function(t,n){return H(t,function(t){return!A(n,t)})},Y=function(t,n){var e=E.call(t,0);return e.sort(n),e},q=function(t){return 0===t.length?st.none():st.some(t[0])},K=function(t){return 0===t.length?st.none():st.some(t[t.length-1])},J=_(Array.from)?Array.from:function(t){return E.call(t)},$=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return st.none()},Q=function(e){return{is:function(t){return e===t},isValue:i,isError:c,getOr:at(e),getOrThunk:at(e),getOrDie:at(e),or:function(t){return Q(e)},orThunk:function(t){return Q(e)},fold:function(t,n){return n(e)},map:function(t){return Q(t(e))},mapError:function(t){return Q(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 st.some(e)}}},tt=function(e){return{is:c,isValue:c,isError:i,getOr:ct,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 tt(e)},mapError:function(t){return tt(t(e))},each:Z,bind:function(t){return tt(e)},exists:c,forall:i,toOption:st.none}},ut={value:Q,error:tt,fromOption:function(t,n){return t.fold(function(){return tt(n)},Q)}};(s=a=a||{})[s.Error=0]="Error",s[s.Value=1]="Value";var ft,lt,dt=function(t,n,e){return t.stype===a.Error?n(t.serror):e(t.svalue)},mt=function(t){return{stype:a.Value,svalue:t}},gt=function(t){return{stype:a.Error,serror:t}},pt=function(t){return t.fold(gt,mt)},ht=function(t){return dt(t,ut.error,ut.value)},vt=mt,bt=function(t){var n=[],e=[];return rt(t,function(t){dt(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},yt=gt,xt=function(t,n){return t.stype===a.Value?n(t.svalue):t},wt=function(t,n){return t.stype===a.Error?n(t.serror):t},St=function(t,n){return t.stype===a.Value?{stype:a.Value,svalue:n(t.svalue)}:t},kt=function(t,n){return t.stype===a.Error?{stype:a.Error,serror:n(t.serror)}:t},Ct=Object.keys,Ot=Object.hasOwnProperty,_t=function(t,n){for(var e=Ct(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i)}},Tt=function(t,e){return Et(t,function(t,n){return{k:n,v:e(t,n)}})},Et=function(t,o){var r={};return _t(t,function(t,n){var e=o(t,n);r[e.k]=e.v}),r},Bt=function(t,n){var e,o,r,i,u={};return e=n,i=u,o=function(t,n){i[n]=t},r=Z,_t(t,function(t,n){(e(t,n)?o:r)(t,n)}),u},Dt=function(t,e){var o=[];return _t(t,function(t,n){o.push(e(t,n))}),o},Mt=function(t,n){for(var e=Ct(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return st.some(u)}return st.none()},At=function(t){return Dt(t,function(t){return t})},Ft=function(t,n){return It(t,n)?st.from(t[n]):st.none()},It=function(t,n){return Ot.call(t,n)},Rt=function(t,n){return It(t,n)&&t[n]!==undefined&&null!==t[n]},Vt=function(u){if(!v(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 rt(u,function(t,o){var n=Ct(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(!v(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=Ct(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!W(a,function(t){return A(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){nt.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},Pt=Object.prototype.hasOwnProperty,Ht=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)Pt.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},zt=Ht(function(t,n){return S(t)&&S(n)?zt(t,n):n}),Nt=Ht(function(t,n){return n}),Lt=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}},jt=Vt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),Ut=function(t){return jt.defaultedThunk(at(t))},Wt=jt.strict,Gt=jt.asOption,Xt=jt.defaultedThunk,Yt=(jt.asDefaultedOptionThunk,jt.mergeWithThunk),qt=function(t,n){var e;return(e={})[t]=n,e},Kt=(Vt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(t,n){return e=n,o={},_t(t,function(t,n){A(e,n)||(o[n]=t)}),o;var e,o}),Jt=function(t,n){return qt(t,n)},$t=function(t){return n={},rt(t,function(t){n[t.key]=t.value}),n;var n},Qt=function(t,n){var e,o,r,i,u,a=(e=[],o=[],rt(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,ut.error(it(u))):(i=n,0===(r=a.values).length?ut.value(i):ut.value(zt(i,Nt.apply(undefined,r))))},Zt=function(t){return d(yt,it)(t)},tn=function(t,n){var e,o,r=bt(t);return 0<r.errors.length?Zt(r.errors):(e=r.values,o=n,0<e.length?vt(zt(o,Nt.apply(undefined,e))):vt(o))},nn=function(t){var n=bt(t);return 0<n.errors.length?Zt(n.errors):vt(n.values)},en=function(t){return S(t)&&100<Ct(t).length?" removed due to size":JSON.stringify(t,null,2)},on=function(t,n){return yt([{path:t,getErrorInfo:n}])},rn=Vt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),un=function(e,o,r){return Ft(o,r).fold(function(){return t=r,n=o,on(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+en(n)});var t,n},vt)},an=function(t,n,e){var o=Ft(t,n).fold(function(){return e(t)},ct);return vt(o)},cn=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 St(n,function(t){return qt(e,s(t))})},u=function(t){return t.fold(function(){var t=qt(e,s(st.none()));return vt(t)},function(t){var n=o.extract(a.concat([r]),s,t);return St(n,function(t){return qt(e,s(st.some(t)))})})};return t.fold(function(){return xt(un(a,c,r),i)},function(t){return xt(an(c,r,t),i)},function(){return xt(vt(Ft(c,r)),u)},function(t){return xt((e=t,o=Ft(n=c,r).map(function(t){return!0===t?e(n):t}),vt(o)),u);var n,e,o},function(t){var n=t(c),e=St(an(c,r,at({})),function(t){return zt(n,t)});return xt(e,i)})},function(t,n){var e=n(c);return vt(qt(t,s(e)))})},sn=function(o){return{extract:function(e,t,n){return wt(o(n,t),function(t){return n=t,on(e,function(){return n});var n})},toString:function(){return"val"}}},fn=function(t){var u=ln(t),a=z(t,function(n,t){return t.fold(function(t){return zt(n,Jt(t,!0))},at(n))},{});return{extract:function(t,n,e){var o,r=k(e)?[]:Ct(Bt(e,function(t){return t!==undefined&&null!==t})),i=H(r,function(t){return!Rt(a,t)});return 0===i.length?u.extract(t,n,e):(o=i,on(t,function(){return"There are unsupported fields: ["+o.join(", ")+"] specified"}))},toString:u.toString}},ln=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=V(a,function(t){return cn(o,r,t,i)}),tn(u,{});var o,r,i,u},toString:function(){return"obj{\n"+V(a,function(t){return t.fold(function(t,n,e,o){return t+" -> "+o.toString()},function(t,n){return"state("+t+")"})}).join("\n")+"}"}}},dn=function(r){return{extract:function(e,o,t){var n=V(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return nn(n)},toString:function(){return"array("+r.toString()+")"}}},mn=function(a,c){return{extract:function(e,o,r){var t,n,i=Ct(r),u=(t=e,n=i,dn(sn(a)).extract(t,ct,n));return xt(u,function(t){var n=V(t,function(t){return rn.field(t,t,Wt(),c)});return ln(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"}}},gn=at(sn(vt)),pn=d(dn,ln),hn=rn.state,vn=rn.field,bn=function(e,n,o,r,i){return Ft(r,i).fold(function(){return t=r,n=i,on(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+en(t)});var t,n},function(t){return t.extract(e.concat(["branch: "+i]),n,o)})},yn=function(r,i){return{extract:function(n,e,o){return Ft(o,r).fold(function(){return t=r,on(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return bn(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+Ct(i)}}},xn=sn(vt),wn=function(t){return pn(t)},Sn=function(o){return{extract:function(t,n,e){return o().extract(t,n,e)},toString:function(){return o().toString()}}},kn=function(n){return sn(function(t){return n(t).fold(yt,vt)})},Cn=function(n,t){return mn(function(t){return pt(n(t))},t)},On=function(t,n,e){return ht((o=t,r=ct,i=e,u=n.extract([o],r,i),kt(u,function(t){return{input:i,errors:t}})));var o,r,i,u},_n=function(t){return t.fold(function(t){throw new Error(En(t))},ct)},Tn=function(t,n,e){return _n(On(t,n,e))},En=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,V(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}).join("\n"))+"\n\nInput object: "+en(t.input);var n,e},Bn=function(t,n){return yn(t,n)},Dn=function(t,n){return yn(t,Tt(n,ln))},Mn=at(xn),An=function(e,o){return sn(function(t){var n=typeof t;return e(t)?vt(t):yt("Expected type: "+o+" but got: "+n)})},Fn=An(ot,"number"),In=An(w,"string"),Rn=An(k,"boolean"),Vn=An(_,"function"),Pn=function(n){var t=function(t,n){for(var e=t.next();!e.done;){if(!n(e.value))return!1;e=t.next()}return!0};if(Object(n)!==n)return!0;switch({}.toString.call(n).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(n).every(function(t){return Pn(n[t])});case"Map":return t(n.keys(),Pn)&&t(n.values(),Pn);case"Set":return t(n.keys(),Pn);default:return!1}},Hn=sn(function(t){return Pn(t)?vt(t):yt("Expected value to be acceptable for sending via postMessage")}),zn=function(n){return kn(function(t){return A(n,t)?ut.value(t):ut.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},Nn=function(t){return vn(t,t,Wt(),gn())},Ln=function(t,n){return vn(t,t,Wt(),n)},jn=function(t){return Ln(t,In)},Un=function(t,n){return vn(t,t,Wt(),zn(n))},Wn=function(t){return Ln(t,Vn)},Gn=function(t,n){return vn(t,t,Wt(),ln(n))},Xn=function(t,n){return vn(t,t,Wt(),pn(n))},Yn=function(t,n){return vn(t,t,Wt(),dn(n))},qn=function(t){return vn(t,t,Gt(),gn())},Kn=function(t,n){return vn(t,t,Gt(),n)},Jn=function(t){return Kn(t,Fn)},$n=function(t){return Kn(t,In)},Qn=function(t){return Kn(t,Vn)},Zn=function(t,n){return Kn(t,ln(n))},te=function(t,n){return vn(t,t,Ut(n),gn())},ne=function(t,n,e){return vn(t,t,Ut(n),e)},ee=function(t,n){return ne(t,n,Fn)},oe=function(t,n){return ne(t,n,In)},re=function(t,n,e){return ne(t,n,zn(e))},ie=function(t,n){return ne(t,n,Rn)},ue=function(t,n){return ne(t,n,Vn)},ae=function(t,n,e){return ne(t,n,ln(e))},ce=function(t,n){return hn(t,n)},se=function(t){var n=t;return{get:function(){return n},set:function(t){n=t}}},fe=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:at(t)}},le={fromHtml:function(t,n){var e=(n||nt.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw nt.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return fe(e.childNodes[0])},fromTag:function(t,n){var e=(n||nt.document).createElement(t);return fe(e)},fromText:function(t,n){var e=(n||nt.document).createTextNode(t);return fe(e)},fromDom:fe,fromPoint:function(t,n,e){var o=t.dom();return st.from(o.elementFromPoint(n,e)).map(fe)}},de=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 ge(o(1),o(2))},me=function(){return ge(0,0)},ge=function(t,n){return{major:t,minor:n}},pe={nu:ge,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?me():de(t,e)},unknown:me},he="Firefox",ve=function(t){var n=t.current,e=t.version,o=function(t){return function(){return n===t}};return{current:n,version:e,isEdge:o("Edge"),isChrome:o("Chrome"),isIE:o("IE"),isOpera:o("Opera"),isFirefox:o(he),isSafari:o("Safari")}},be={unknown:function(){return ve({current:undefined,version:pe.unknown()})},nu:ve,edge:at("Edge"),chrome:at("Chrome"),ie:at("IE"),opera:at("Opera"),firefox:at(he),safari:at("Safari")},ye="Windows",xe="Android",we="Solaris",Se="FreeBSD",ke="ChromeOS",Ce=function(t){var n=t.current,e=t.version,o=function(t){return function(){return n===t}};return{current:n,version:e,isWindows:o(ye),isiOS:o("iOS"),isAndroid:o(xe),isOSX:o("OSX"),isLinux:o("Linux"),isSolaris:o(we),isFreeBSD:o(Se),isChromeOS:o(ke)}},Oe={unknown:function(){return Ce({current:undefined,version:pe.unknown()})},nu:Ce,windows:at(ye),ios:at("iOS"),android:at(xe),linux:at("Linux"),osx:at("OSX"),solaris:at(we),freebsd:at(Se),chromeos:at(ke)},_e=function(t,n){var e=String(n).toLowerCase();return L(t,function(t){return t.search(e)})},Te=function(t,e){return _e(t,e).map(function(t){var n=pe.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Ee=function(t,e){return _e(t,e).map(function(t){var n=pe.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Be=function(t,n){return-1!==t.indexOf(n)},De=(ft=/^\s+|\s+$/g,function(t){return t.replace(ft,"")}),Me=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Ae=function(n){return function(t){return Be(t,n)}},Fe=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Be(t,"edge/")&&Be(t,"chrome")&&Be(t,"safari")&&Be(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Me],search:function(t){return Be(t,"chrome")&&!Be(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Be(t,"msie")||Be(t,"trident")}},{name:"Opera",versionRegexes:[Me,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Ae("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Ae("firefox")},{name:"Safari",versionRegexes:[Me,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Be(t,"safari")||Be(t,"mobile/"))&&Be(t,"applewebkit")}}],Ie=[{name:"Windows",search:Ae("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return Be(t,"iphone")||Be(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Ae("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Ae("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Ae("linux"),versionRegexes:[]},{name:"Solaris",search:Ae("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Ae("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Ae("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Re={browsers:at(Fe),oses:at(Ie)},Ve=function(t,n){var e,o,r,i,u,a,c,s,f,l,d,m,g=Re.browsers(),p=Re.oses(),h=Te(g,t).fold(be.unknown,be.nu),v=Ee(p,t).fold(Oe.unknown,Oe.nu);return{browser:h,os:v,deviceType:(o=h,r=t,i=n,u=(e=v).isiOS()&&!0===/ipad/i.test(r),a=e.isiOS()&&!u,c=e.isiOS()||e.isAndroid(),s=c||i("(pointer:coarse)"),f=u||!a&&c&&i("(min-device-width:768px)"),l=a||c&&!f,d=o.isSafari()&&e.isiOS()&&!1===/safari/i.test(r),m=!l&&!f&&!d,{isiPad:at(u),isiPhone:at(a),isTablet:at(f),isPhone:at(l),isTouch:at(s),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:at(d),isDesktop:at(m)})}},Pe=function(t){return nt.window.matchMedia(t).matches},He=Lt(function(){return Ve(nt.navigator.userAgent,Pe)}),ze=function(){return He()},Ne=function(t,n){var e=t.dom();if(1!==e.nodeType)return!1;var o=e;if(o.matches!==undefined)return o.matches(n);if(o.msMatchesSelector!==undefined)return o.msMatchesSelector(n);if(o.webkitMatchesSelector!==undefined)return o.webkitMatchesSelector(n);if(o.mozMatchesSelector!==undefined)return o.mozMatchesSelector(n);throw new Error("Browser lacks native selectors")},Le=function(t){return 1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType||0===t.childElementCount},je=function(t,n){return t.dom()===n.dom()},Ue=function(t,n){return e=t.dom(),o=n.dom(),r=e,i=o,u=nt.Node.DOCUMENT_POSITION_CONTAINED_BY,0!=(r.compareDocumentPosition(i)&u);var e,o,r,i,u},We=function(t,n){return ze().browser.isIE()?Ue(t,n):(e=n,o=t.dom(),r=e.dom(),o!==r&&o.contains(r));var e,o,r},Ge=function(t){return _(t)?t:at(!1)},Xe=function(t,n,e){for(var o=t.dom(),r=Ge(e);o.parentNode;){o=o.parentNode;var i=le.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return st.none()},Ye=function(t,n,e){var o=n(t),r=Ge(e);return o.orThunk(function(){return r(t)?st.none():Xe(t,n,r)})},qe=function(t,n){return je(t.element(),n.event().target())},Ke=function(t){if(!Rt(t,"can")&&!Rt(t,"abort")&&!Rt(t,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(t,null,2)+" does not have can, abort, or run!");return Tn("Extracting event.handler",fn([te("can",at(!0)),te("abort",at(!1)),te("run",Z)]),t)},Je=function(e){var n,o,r,i,t=(o=function(t){return t.can},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N(n,function(t,n){return t&&o(n).apply(undefined,e)},!0)}),u=(r=n=e,i=function(t){return t.abort},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return N(r,function(t,n){return t||i(n).apply(undefined,e)},!1)});return Ke({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];rt(e,function(t){t.run.apply(undefined,n)})}})},$e=at("touchstart"),Qe=at("touchmove"),Ze=at("touchend"),to=at("touchcancel"),no=at("mousedown"),eo=at("mousemove"),oo=at("mouseout"),ro=at("mouseup"),io=at("mouseover"),uo=at("focusin"),ao=at("focusout"),co=at("keydown"),so=at("keyup"),fo=at("input"),lo=at("change"),mo=at("click"),go=at("transitionend"),po=at("selectstart"),ho={tap:at("alloy.tap")},vo=at("alloy.focus"),bo=at("alloy.blur.post"),yo=at("alloy.paste.post"),xo=at("alloy.receive"),wo=at("alloy.execute"),So=at("alloy.focus.item"),ko=ho.tap,Co=at("alloy.longpress"),Oo=at("alloy.sandbox.close"),_o=at("alloy.typeahead.cancel"),To=at("alloy.system.init"),Eo=at("alloy.system.touchmove"),Bo=at("alloy.system.touchend"),Do=at("alloy.system.scroll"),Mo=at("alloy.system.resize"),Ao=at("alloy.system.attached"),Fo=at("alloy.system.detached"),Io=at("alloy.system.dismissRequested"),Ro=at("alloy.system.repositionRequested"),Vo=at("alloy.focusmanager.shifted"),Po=at("alloy.slotcontainer.visibility"),Ho=at("alloy.change.tab"),zo=at("alloy.dismiss.tab"),No=at("alloy.highlight"),Lo=at("alloy.dehighlight"),jo=function(t,n){Xo(t,t.element(),n,{})},Uo=function(t,n,e){Xo(t,t.element(),n,e)},Wo=function(t){jo(t,wo())},Go=function(t,n,e){Xo(t,n,e,{})},Xo=function(t,n,e,o){var r=et({target:n},o);t.getSystem().triggerEvent(e,n,Tt(r,at))},Yo=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())},qo=function(t){return $t(t)},Ko=function(t,n){return{key:t,value:Ke({abort:n})}},Jo=function(t){return{key:t,value:Ke({run:function(t,n){n.event().prevent()}})}},$o=function(t,n){return{key:t,value:Ke({run:n})}},Qo=function(t,e,o){return{key:t,value:Ke({run:function(t,n){e.apply(undefined,[t,n].concat(o))}})}},Zo=function(t){return function(e){return{key:t,value:Ke({run:function(t,n){qe(t,n)&&e(t,n)}})}}},tr=function(t,n,e){var o,r,i=n.partUids[e];return r=i,$o(o=t,function(t,n){t.getSystem().getByUid(r).each(function(t){Yo(t,t.element(),o,n)})})},nr=function(t,r){return $o(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return Ye(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},at(!1)).getOr(n)},function(t){return t});r(n,o,t)})},er=function(t){return $o(t,function(t,n){n.cut()})},or=function(t,n){return Zo(t)(n)},rr=Zo(Ao()),ir=Zo(Fo()),ur=Zo(To()),ar=(lt=wo(),function(t){return $o(lt,t)}),cr=("undefined"!=typeof nt.window?nt.window:Function("return this;")(),function(t){return t.dom().nodeName.toLowerCase()}),sr=function(n){return function(t){return t.dom().nodeType===n}},fr=sr(1),lr=sr(3),dr=sr(9),mr=sr(11),gr=function(t){return le.fromDom(t.dom().ownerDocument)},pr=function(t){return dr(t)?t:gr(t)},hr=function(t){return le.fromDom(t.dom().ownerDocument.documentElement)},vr=function(t){return le.fromDom(t.dom().ownerDocument.defaultView)},br=function(t){return st.from(t.dom().parentNode).map(le.fromDom)},yr=function(t){return st.from(t.dom().offsetParent).map(le.fromDom)},xr=function(t){return V(t.dom().childNodes,le.fromDom)},wr=function(t,n){var e=t.dom().childNodes;return st.from(e[n]).map(le.fromDom)},Sr=function(n,e){br(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})},kr=function(t,n){var e;(e=t,st.from(e.dom().nextSibling).map(le.fromDom)).fold(function(){br(t).each(function(t){Or(t,n)})},function(t){Sr(t,n)})},Cr=function(n,e){wr(n,0).fold(function(){Or(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},Or=function(t,n){t.dom().appendChild(n.dom())},_r=function(n,t){rt(t,function(t){Or(n,t)})},Tr=function(t){t.dom().textContent="",rt(xr(t),function(t){Er(t)})},Er=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},Br=function(t){var n,e=xr(t);0<e.length&&(n=t,rt(e,function(t){Sr(n,t)})),Er(t)},Dr=function(t){return t.dom().innerHTML},Mr=function(t,n){var e,o,r=gr(t).dom(),i=le.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||nt.document).createElement("div")).innerHTML=e,xr(le.fromDom(o)));_r(i,u),Tr(t),Or(t,i)},Ar=function(t,n,e){if(!(w(e)||k(e)||ot(e)))throw nt.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},Fr=function(t,n,e){Ar(t.dom(),n,e)},Ir=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},Rr=function(t,n){return st.from(Ir(t,n))},Vr=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},Pr=function(t,n){t.dom().removeAttribute(n)},Hr=function(t){return n=t,e=!1,le.fromDom(n.dom().cloneNode(e));var n,e},zr=function(t){var n,e,o,r=Hr(t);return n=r,e=le.fromTag("div"),o=le.fromDom(n.dom().cloneNode(!0)),Or(e,o),Dr(e)},Nr=function(t){return zr(t)},Lr=qo([{key:vo(),value:Ke({can:function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(je(e=r,t.element())&&!je(e,o))||(nt.console.warn(vo()+" did not get interpreted by the desired target. \nOriginator: "+Nr(r)+"\nTarget: "+Nr(i)+"\nCheck the "+vo()+" event handlers"),!1)}})}]),jr=/* */Object.freeze({__proto__:null,events:Lr}),Ur=0,Wr=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++Ur+String(n)},Gr=at("alloy-id-"),Xr=at("data-alloy-id"),Yr=Gr(),qr=Xr(),Kr=function(t,n){Object.defineProperty(t.dom(),qr,{value:n,writable:!0})},Jr=function(t){var n=fr(t)?t.dom()[qr]:null;return st.from(n)},$r=function(t){return Wr(t)},Qr=ct,Zr=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+(n?"\n"+Nr(n().element())+" is not in context.":""))}};return{debugInfo:at("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:at(!1)}},ti=Zr(),ni=function(t){return V(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.substring(0,t.length-"/*".length):t;var n,e,o,r})},ei=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:ni(i)}},t},oi=Wr("alloy-premade"),ri=function(t){return Jt(oi,t)},ii=function(o){return t=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o.apply(void 0,b([t.getApis(),t],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:ni(i.slice(1))}},t;var t,n,e,r,i},ui={init:function(){return ai({readState:function(){return"No State required"}})}},ai=function(t){return t},ci=function(t,r){var i={};return _t(t,function(t,o){_t(t,function(t,n){var e=Ft(i,n).getOr([]);i[n]=e.concat([r(o,t)])})}),i},si=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},fi=function(t,n){return e=g.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:at(o)};var e,o},li=function(t){return t.cHandler},di=function(t,n){return{name:at(t),handler:at(n)}},mi=function(t,n,e){var o,r,i=et(et({},e),(o=t,r={},rt(n,function(t){r[t.name()]=t.handlers(o)}),r));return ci(i,di)},gi=function(t){var n,i=_(n=t)?{can:at(!0),abort:at(!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)}},pi=function(t,n,e){var o,r,i=n[e];return i?function(u,a,t,c){try{var n=Y(t,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: "+JSON.stringify(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+JSON.stringify(c,null,2));return r<i?-1:i<r?1:0});return ut.value(n)}catch(e){return ut.error([e])}}("Event: "+e,"name",t,i).map(function(t){var n=V(t,function(t){return t.handler()});return Je(n)}):(o=e,r=t,ut.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: '+JSON.stringify(V(r,function(t){return t.name()}),null,2)]))},hi=function(t,i){var n=Dt(t,function(o,r){return(1===o.length?ut.value(o[0].handler()):pi(o,i,r)).map(function(t){var n=gi(t),e=1<o.length?H(i[r],function(n){return F(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return Jt(r,{handler:n,purpose:at(e)})})});return Qt(n,{})},vi=function(t){return On("custom.definition",ln([vn("dom","dom",Wt(),ln([Nn("tag"),te("styles",{}),te("classes",[]),te("attributes",{}),qn("value"),qn("innerHtml")])),Nn("components"),Nn("uid"),te("events",{}),te("apis",{}),vn("eventOrder","eventOrder",jt.mergeWithThunk(at({"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"],touchstart:["focusing","alloy.base.behaviour","item-type-events"],mouseover:["item-type-events","tooltipping"],"alloy.receive":["receiving","reflecting","tooltipping"]})),Mn()),qn("domModification")]),t)},bi=function(t,n){var e=Ir(t,n);return e===undefined||""===e?[]:e.split(" ")},yi=function(t){return t.dom().classList!==undefined},xi=function(t,n){return r=n,i=bi(e=t,o="class").concat([r]),Fr(e,o,i.join(" ")),!0;var e,o,r,i},wi=function(t,n){return r=n,0<(i=H(bi(e=t,o="class"),function(t){return t!==r})).length?Fr(e,o,i.join(" ")):Pr(e,o),!1;var e,o,r,i},Si=function(t,n){yi(t)?t.dom().classList.add(n):xi(t,n)},ki=function(t){0===(yi(t)?t.dom().classList:bi(t,"class")).length&&Pr(t,"class")},Ci=function(t,n){yi(t)?t.dom().classList.remove(n):wi(t,n);ki(t)},Oi=function(t,n){return yi(t)&&t.dom().classList.contains(n)},_i=function(n,t){rt(t,function(t){Si(n,t)})},Ti=function(n,t){rt(t,function(t){Ci(n,t)})},Ei=function(t){return t.style!==undefined&&_(t.style.getPropertyValue)},Bi=function(t){return mr(t)},Di=_(nt.Element.prototype.attachShadow)&&_(nt.Node.prototype.getRootNode),Mi=at(Di),Ai=Di?function(t){return le.fromDom(t.dom().getRootNode())}:pr,Fi=function(t){return le.fromDom(t.dom().host)},Ii=function(t){return O(t.dom().shadowRoot)},Ri=function(t){var n,e,o,r,i=lr(t)?t.dom().parentNode:t.dom();return i!==undefined&&null!==i&&null!==i.ownerDocument&&(o=le.fromDom(i),r=Ai(o),(Bi(r)?st.some(r):st.none()).fold(function(){return i.ownerDocument.body.contains(i)},(n=Ri,e=Fi,function(t){return n(e(t))})))},Vi=function(){return Pi(le.fromDom(nt.document))},Pi=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return le.fromDom(n)},Hi=function(t,n,e){if(!w(e))throw nt.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);Ei(t)&&t.style.setProperty(n,e)},zi=function(t,n){Ei(t)&&t.style.removeProperty(n)},Ni=function(t,n,e){var o=t.dom();Hi(o,n,e)},Li=function(t,n){var e=t.dom();_t(n,function(t,n){Hi(e,n,t)})},ji=function(t,n){var e=t.dom();_t(n,function(t,n){t.fold(function(){zi(e,n)},function(t){Hi(e,n,t)})})},Ui=function(t,n){var e=t.dom(),o=nt.window.getComputedStyle(e).getPropertyValue(n);return""!==o||Ri(t)?o:Wi(e,n)},Wi=function(t,n){return Ei(t)?t.style.getPropertyValue(n):""},Gi=function(t,n){var e=t.dom(),o=Wi(e,n);return st.from(o).filter(function(t){return 0<t.length})},Xi=function(t,n,e){var o=le.fromTag(t);return Ni(o,n,e),Gi(o,n).isSome()},Yi=function(t,n){var e=t.dom();zi(e,n),Rr(t,"style").map(De).is("")&&Pr(t,"style")},qi=function(t){return t.dom().offsetWidth},Ki=function(t){return t.dom().value},Ji=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},$i=function(t){var n,e,o,r=le.fromTag(t.tag);n=r,e=t.attributes,o=n.dom(),_t(e,function(t,n){Ar(o,n,t)}),_i(r,t.classes),Li(r,t.styles),t.innerHtml.each(function(t){return Mr(r,t)});var i=t.domChildren;return _r(r,i),t.value.each(function(t){Ji(r,t)}),t.uid,Kr(r,t.uid),r},Qi=function(t,n){return e=t,r=V(o=n,function(t){return Zn(t.name(),[Nn("config"),te("state",ui)])}),i=On("component.behaviours",ln(r),e.behaviours).fold(function(t){throw new Error(En(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))},function(t){return t}),{list:o,data:Tt(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},Zi=function(t){var n,e,o=(n=Ft(t,"behaviours").getOr({}),e=H(Ct(n),function(t){return n[t]!==undefined}),V(e,function(t){return n[t].me}));return Qi(t,o)},tu=function(t,n,e){var o,r,i,u=et(et({},(o=t).dom),{uid:o.uid,domChildren:V(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return si({})},si),c={"alloy.base.modification":a},s=0<n.length?function(n,t,e,o){var r=et({},t);rt(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=ci(r,function(t,n){return{name:t,modification:n}}),u=function(t){return z(t,function(t,n){return et(et({},n.modification),t)},{})},a=z(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return si({classes:a,attributes:c,styles:s})}(e,c,n,u):a;return i=s,et(et({},r=u),{attributes:et(et({},r.attributes),i.attributes),styles:et(et({},r.styles),i.styles),classes:r.classes.concat(i.classes)})},nu=function(t,n,e){var o,r,i,u={"alloy.base.behaviour":t.events};return o=e,r=t.eventOrder,i=mi(o,n,u),hi(i,r).getOrDie()},eu=function(t){var n,e,o,r,i,u,a,c,s,f,l,d,m,g=Qr(t),p=g.events,h=y(g,["events"]),v=(n=Ft(h,"components").getOr([]),V(n,uu)),b=et(et({},h),{events:et(et({},jr),p),components:v});return ut.value((o=function(){return m},r=se(ti),i=_n(vi(e=b)),u=Zi(e),a=u.list,c=u.data,s=tu(i,a,c),f=$i(s),l=nu(i,a,c),d=se(i.components),m={getSystem:r.get,config:function(t){var n=c;return(_(n[t.name()])?n[t.name()]:function(){throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:function(t){return _(c[t.name()])},spec:at(e),readState:function(t){return c[t]().map(function(t){return t.state.readState()}).getOr("not enabled")},getApis:function(){return i.apis},connect:function(t){r.set(t)},disconnect:function(){r.set(Zr(o))},element:at(f),syncComponents:function(){var t=xr(f),n=U(t,function(t){return r.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});d.set(n)},components:d.get,events:at(l)}))},ou=function(t){var n=le.fromText(t);return ru({element:n})},ru=function(t){var n=Tn("external.component",fn([Nn("element"),qn("uid")]),t),e=se(Zr());n.uid.each(function(t){Kr(n.element,t)});var o={getSystem:e.get,config:st.none,hasConfigured:at(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(Zr(function(){return o}))},getApis:function(){return{}},element:at(n.element),spec:at(t),readState:at("No state"),syncComponents:Z,components:at([]),events:at({})};return ri(o)},iu=$r,uu=function(n){return Ft(n,oi).fold(function(){var t=n.hasOwnProperty("uid")?n:et({uid:iu("")},n);return eu(t).getOrDie()},function(t){return t})},au=ri;function cu(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=Ui(t,o);return parseFloat(e)||0}return n},i=function(r,t){return N(t,function(t,n){var e=Ui(r,n),o=e===undefined?0:parseInt(e,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!ot(n)&&!n.match(/^[0-9]+$/))throw new Error(o+".set accepts only positive integer values. Value was "+n);var e=t.dom();Ei(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 su=cu("height",function(t){var n=t.dom();return Ri(t)?n.getBoundingClientRect().height:n.offsetHeight}),fu=function(t){return su.get(t)},lu=function(t){return su.getOuter(t)},du=function(e,o){return{left:at(e),top:at(o),translate:function(t,n){return du(e+t,o+n)}}},mu=du,gu=function(t,n){return t!==undefined?t:n!==undefined?n:0},pu=function(t){var n=t.dom().ownerDocument,e=n.body,o=n.defaultView,r=n.documentElement;if(e===t.dom())return mu(e.offsetLeft,e.offsetTop);var i=gu(o.pageYOffset,r.scrollTop),u=gu(o.pageXOffset,r.scrollLeft),a=gu(r.clientTop,e.clientTop),c=gu(r.clientLeft,e.clientLeft);return hu(t).translate(u-c,i-a)},hu=function(t){var n,e=t.dom(),o=e.ownerDocument.body;return o===e?mu(o.offsetLeft,o.offsetTop):Ri(t)?(n=e.getBoundingClientRect(),mu(n.left,n.top)):mu(0,0)},vu=cu("width",function(t){return t.dom().offsetWidth}),bu=function(t){return vu.get(t)},yu=function(t){return vu.getOuter(t)},xu=function(t){var n,e,o,r,i,u,a,c=le.fromDom(function(t){if(Mi()&&O(t.target)){var n=le.fromDom(t.target);if(fr(n)&&Ii(le.fromDom(t.target))){if(t.composed&&t.composedPath){var e=t.composedPath();if(e)return q(e)}}}return st.from(t.target)}(t).getOr(t.target)),s=function(){return t.stopPropagation()},f=function(){return t.preventDefault()},l=d(f,s);return n=c,e=t.clientX,o=t.clientY,r=s,i=f,u=l,a=t,{target:at(n),x:at(e),y:at(o),stop:r,prevent:i,kill:u,raw:at(a)}},wu=function(t,n,e,o,r){var i,u,a=(i=e,u=o,function(t){i(t)&&u(xu(t))});return t.dom().addEventListener(n,a,r),{unbind:g(Su,t,n,a,r)}},Su=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},ku=function(t){var n=t!==undefined?t.dom():nt.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return mu(e,o)},Cu=function(t,n,e){(e!==undefined?e.dom():nt.document).defaultView.scrollTo(t,n)},Ou=function(t,n,e,o){return{x:t,y:n,width:e,height:o,right:t+e,bottom:n+o}},_u=function(t){var n,e,o=t===undefined?nt.window:t,r=o.document,i=ku(le.fromDom(r));return e=(n=o)===undefined?nt.window:n,st.from(e.visualViewport).fold(function(){var t=o.document.documentElement,n=t.clientWidth,e=t.clientHeight;return Ou(i.left(),i.top(),n,e)},function(t){return Ou(Math.max(t.pageLeft,i.left()),Math.max(t.pageTop,i.top()),t.width,t.height)})},Tu=function(o,t){return o.view(t).fold(at([]),function(t){var n=o.owner(t),e=Tu(o,n);return[t].concat(e)})},Eu=/* */Object.freeze({__proto__:null,view:function(t){return(t.dom()===nt.document?st.none():st.from(t.dom().defaultView.frameElement)).map(le.fromDom)},owner:function(t){return gr(t)}}),Bu=function(o){var t,n,e,r,i=le.fromDom(nt.document),u=ku(i);return(t=o,e=(n=Eu).owner(t),r=Tu(n,e),st.some(r)).fold(g(pu,o),function(t){var n=hu(o),e=z(t,function(t,n){var e=hu(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return mu(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},Du=function(t,n,e,o){return{x:t,y:n,width:e,height:o,right:t+e,bottom:n+o}},Mu=function(t){var n=pu(t),e=yu(t),o=lu(t);return Du(n.left(),n.top(),e,o)},Au=function(t){var n=Bu(t),e=yu(t),o=lu(t);return Du(n.left(),n.top(),e,o)},Fu=function(){return _u(nt.window)};function Iu(t,n,e,o,r){return t(e,o)?st.some(e):_(r)&&r(e)?st.none():n(e,o,r)}var Ru,Vu,Pu=function(t,n,e){for(var o=t.dom(),r=_(e)?e:at(!1);o.parentNode;){o=o.parentNode;var i=le.fromDom(o);if(n(i))return st.some(i);if(r(i))break}return st.none()},Hu=function(t,n,e){return Iu(function(t,n){return n(t)},Pu,t,n,e)},zu=function(t,n,e){return Hu(t,n,e).isSome()},Nu=function(t,n,e){return Pu(t,function(t){return Ne(t,n)},e)},Lu=function(t,n){return e=n,r=(o=t)===undefined?nt.document:o.dom(),Le(r)?st.none():st.from(r.querySelector(e)).map(le.fromDom);var e,o,r},ju=function(t,n,e){return Iu(function(t,n){return Ne(t,n)},Nu,t,n,e)},Uu=function(){var n=Wr("aria-owns");return{id:n,link:function(t){Fr(t,"aria-owns",n)},unlink:function(t){Pr(t,"aria-owns")}}},Wu=function(n,t){return Hu(t,function(t){if(!fr(t))return!1;var n=Ir(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=Ir(t,"id"),e=gr(t);return Lu(e,'[aria-owns="'+n+'"]')}).exists(function(t){return Gu(n,t)})},Gu=function(n,t){return zu(t,function(t){return je(t,n.element())},at(!1))||Wu(n,t)},Xu="unknown";(Vu=Ru=Ru||{})[Vu.STOP=0]="STOP",Vu[Vu.NORMAL=1]="NORMAL",Vu[Vu.LOGGING=2]="LOGGING";var Yu,qu,Ku=se({}),Ju=function(n,t,e){var o,r,i,u;switch(Ft(Ku.get(),n).orThunk(function(){var t=Ct(Ku.get());return $(t,function(t){return-1<n.indexOf(t)?st.some(Ku.get()[t]):st.none()})}).getOr(Ru.NORMAL)){case Ru.NORMAL:return e(Zu());case Ru.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();A(["mousemove","mouseover","mouseout",To()],o)||nt.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:V(i,function(t){return A(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+Nr(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case Ru.STOP:return!0}},$u=["alloy/data/Fields","alloy/debugging/Debugging"],Qu=function(t,n,e){return Ju(t,n,e)},Zu=at({logEventCut:Z,logEventStopped:Z,logNoParent:Z,logEventNoHandlers:Z,logEventResponse:Z,write:Z}),ta=at([Nn("menu"),Nn("selectedMenu")]),na=at([Nn("item"),Nn("selectedItem")]),ea=(at(ln(na().concat(ta()))),at(ln(na()))),oa=Gn("initSize",[Nn("numColumns"),Nn("numRows")]),ra=function(){return Gn("markers",[Nn("backgroundMenu")].concat(ta()).concat(na()))},ia=function(t){return Gn("markers",V(t,Nn))},ua=function(t,n,e){!function(){var t=new Error;if(t.stack===undefined)return;var n=t.stack.split("\n");L(n,function(n){return 0<n.indexOf("alloy")&&!F($u,function(t){return-1<n.indexOf(t)})}).getOr(Xu)}();return vn(n,n,e,kn(function(e){return ut.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},aa=function(t){return ua(0,t,Ut(Z))},ca=function(t){return ua(0,t,Ut(st.none))},sa=function(t){return ua(0,t,Wt())},fa=function(t){return ua(0,t,Wt())},la=function(t,n){return ce(t,at(n))},da=function(t){return ce(t,ct)},ma=at(oa),ga=function(t,n,e,o,r,i){return{x:at(t),y:at(n),bubble:at(e),direction:at(o),boundsRestriction:at(r),label:at(i)}},pa=Vt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),ha=pa.southeast,va=pa.southwest,ba=pa.northeast,ya=pa.northwest,xa=pa.south,wa=pa.north,Sa=pa.east,ka=pa.west,Ca=function(n,e){return function(t,n){for(var e={},o=0,r=t.length;o<r;o++){var i=t[o];e[String(i)]=n(i,o)}return e}(["left","right","top","bottom"],function(t){return Ft(e,t).map(function(t){return function(t,n){switch(n){case 1:return t.x;case 0:return t.x+t.width;case 2:return t.y;case 3:return t.y+t.height}}(n,t)})})},Oa=function(t){return t.x},_a=function(t,n){return t.x+t.width/2-n.width/2},Ta=function(t,n){return t.x+t.width-n.width},Ea=function(t,n){return t.y-n.height},Ba=function(t){return t.y+t.height},Da=function(t,n){return t.y+t.height/2-n.height/2},Ma=function(t,n,e){return ga(Oa(t),Ba(t),e.southeast(),ha(),Ca(t,{left:1,top:3}),"layout-se")},Aa=function(t,n,e){return ga(Ta(t,n),Ba(t),e.southwest(),va(),Ca(t,{right:0,top:3}),"layout-sw")},Fa=function(t,n,e){return ga(Oa(t),Ea(t,n),e.northeast(),ba(),Ca(t,{left:1,bottom:2}),"layout-ne")},Ia=function(t,n,e){return ga(Ta(t,n),Ea(t,n),e.northwest(),ya(),Ca(t,{right:0,bottom:2}),"layout-nw")},Ra=function(t,n,e){return ga(_a(t,n),Ea(t,n),e.north(),wa(),Ca(t,{bottom:2}),"layout-n")},Va=function(t,n,e){return ga(_a(t,n),Ba(t),e.south(),xa(),Ca(t,{top:3}),"layout-s")},Pa=function(t,n,e){return ga((o=t).x+o.width,Da(t,n),e.east(),Sa(),Ca(t,{left:0}),"layout-e");var o},Ha=function(t,n,e){return ga((o=n,t.x-o.width),Da(t,n),e.west(),ka(),Ca(t,{right:1}),"layout-w");var o},za=function(){return[Ma,Aa,Fa,Ia,Va,Ra,Pa,Ha]},Na=function(){return[Aa,Ma,Ia,Fa,Va,Ra,Pa,Ha]},La=function(){return[Fa,Ia,Ma,Aa,Ra,Va]},ja=function(){return[Ma,Aa,Fa,Ia,Va,Ra]},Ua=function(){return[Aa,Ma,Ia,Fa,Va,Ra]},Wa=function(e,o,r){return ur(function(t,n){r(t,e,o)})},Ga=function(t,n,e,o,r,i){var u=fn(t),a=Zn(n,[Kn("config",fn(t))]);return qa(u,a,n,e,o,r,i)},Xa=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:at(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:ni(c.slice(0,1).concat(c.slice(3)))}},t},Ya=function(t){return{key:t,value:undefined}},qa=function(e,t,o,r,n,i,u){var a=function(t){return Rt(t,o)?t[o]():st.none()},c=Tt(n,function(t,n){return Xa(o,t,n)}),s=Tt(i,function(t,n){return ei(t,n)}),f=et(et(et({},s),c),{revoke:g(Ya,o),config:function(t){var n=Tn(o+"-config",e,t);return{key:o,value:{config:n,me:f,configAsRaw:Lt(function(){return Tn(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return Ft(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(si({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return Ft(r,"events").getOr(function(){return{}})(t.config,t.state)}).getOr({})}});return f},Ka=function(t){return $t(t)},Ja=fn([Nn("fields"),Nn("name"),te("active",{}),te("apis",{}),te("state",ui),te("extra",{})]),$a=function(t){var n=Tn("Creating behaviour: "+t.name,Ja,t);return Ga(n.fields,n.name,n.active,n.apis,n.extra,n.state)},Qa=fn([Nn("branchKey"),Nn("branches"),Nn("name"),te("active",{}),te("apis",{}),te("state",ui),te("extra",{})]),Za=function(t){var n,e,o,r,i,u,a,c,s=Tn("Creating behaviour: "+t.name,Qa,t);return n=Dn(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=Zn(e,[Kn("config",a=n)]),qa(a,c,e,o,r,i,u)},tc=at(undefined),nc=/* */Object.freeze({__proto__:null,events:function(c){return qo([$o(xo(),function(r,t){var n,e,i=c.channels,o=Ct(i),u=t,a=(n=o,(e=u).universal()?n:H(n,function(t){return A(e.channels(),t)}));rt(a,function(t){var n=i[t],e=n.schema,o=Tn("channel["+t+"] data\nReceiver: "+Nr(r.element()),e,u.data());n.onReceive(r,o)})})])}}),ec=[Ln("channels",Cn(ut.value,fn([sa("onReceive"),te("schema",Mn())])))],oc=$a({fields:ec,name:"receiving",active:nc}),rc=/* */Object.freeze({__proto__:null,exhibit:function(t,n){return si({classes:[],styles:n.useFixed()?{}:{position:"relative"}})}}),ic=function(t){return t.dom().focus()},uc=function(t){return void 0===t&&(t=le.fromDom(nt.document)),st.from(t.dom().activeElement).map(le.fromDom)},ac=function(n){return uc(Ai(n)).filter(function(t){return n.dom().contains(t.dom())})},cc=function(t,e){var o=gr(e),n=uc(o).bind(function(n){var r,i,t=function(t){return je(n,t)};return t(e)?st.some(e):(r=t,(i=function(t){for(var n=0;n<t.childNodes.length;n++){var e=le.fromDom(t.childNodes[n]);if(r(e))return st.some(e);var o=i(t.childNodes[n]);if(o.isSome())return o}return st.none()})(e.dom()))}),r=t(e);return n.each(function(n){uc(o).filter(function(t){return je(t,n)}).fold(function(){ic(n)},Z)}),r},sc=function(t,n,e,o,r){return{position:at(t),left:at(n),top:at(e),right:at(o),bottom:at(r)}},fc=function(t,n){var e=function(t){return t+"px"};ji(t,{position:st.some(n.position()),left:n.left().map(e),top:n.top().map(e),right:n.right().map(e),bottom:n.bottom().map(e)})},lc=Vt([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),dc=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=st.some(p),x=st.some(h),w=st.some(v),S=st.some(b),k=st.none();return u=n.direction,a=function(){return sc(t,y,x,k,k)},c=function(){return sc(t,k,x,w,k)},s=function(){return sc(t,y,k,k,S)},f=function(){return sc(t,k,k,w,S)},l=function(){return sc(t,y,x,k,k)},d=function(){return sc(t,y,k,k,S)},m=function(){return sc(t,y,x,k,k)},g=function(){return sc(t,k,x,w,k)},u.fold(a,c,s,f,l,d,m,g)},mc=function(t,n){var e=g(Bu,n),o=t.fold(e,e,function(){var t=ku();return Bu(n).translate(-t.left(),-t.top())}),r=yu(n),i=lu(n);return Du(o.left(),o.top(),r,i)},gc=function(t,n,e){var o=mu(n,e);return t.fold(at(o),at(o),function(){var t=ku();return o.translate(-t.left(),-t.top())})},pc=(lc.none,lc.relative),hc=lc.fixed,vc=function(t,n){return e=n,{anchorBox:at(t),origin:at(e)};var e},bc=function(t,n,e,o){var r=t+n;return o<r?e:r<e?o:r},yc=function(t,n,e){return Math.min(Math.max(t,n),e)},xc=Vt([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),wc=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p,h,v,b,y,x,w,S,k,C,O,_,T,E,B,D,M,A,F,I,R,V,P=t.x(),H=t.y(),z=t.bubble().offset(),N=z.left(),L=z.top(),j=(r=o,i=t.boundsRestriction(),u=z,c=(a=function(n,e){var o="top"===n||"bottom"===n?u.top():u.left();return Ft(i,n).bind(ct).bind(function(t){return"left"===n||"top"===n?e<=t?st.some(t):st.none():t<=e?st.some(t):st.none()}).map(function(t){return t+o}).getOr(e)})("left",r.x),s=a("top",r.y),f=a("right",r.right),l=a("bottom",r.bottom),Du(c,s,f-c,l-s)),U=j.y,W=j.bottom,G=j.x,X=j.right,Y=H+L,q=(d=P+N,m=Y,g=n,p=e,v=(h=j).x,b=h.y,y=h.width,x=h.height,S=b<=m,k=(w=v<=d)&&S,C=d+g<=v+y&&m+p<=b+x,O=Math.abs(Math.min(g,w?v+y-d:v-(d+g))),_=Math.abs(Math.min(p,S?b+x-m:b-(m+p))),T=Math.max(h.x,h.right-g),E=Math.max(h.y,h.bottom-p),{originInBounds:k,sizeInBounds:C,limitX:yc(d,h.x,T),limitY:yc(m,h.y,E),deltaW:O,deltaH:_}),K=q.originInBounds,J=q.sizeInBounds,$=q.limitX,Q=q.limitY,Z=q.deltaW,tt=q.deltaH,nt=at(Q+tt-U),et=at(W-Q),ot=(B=t.direction(),M=D=et,A=nt,B.fold(D,D,A,A,D,A,M,M)),rt=at($+Z-G),it=at(X-$),ut={x:$,y:Q,width:Z,height:tt,maxHeight:ot,maxWidth:(F=t.direction(),R=I=it,V=rt,F.fold(I,V,I,V,R,R,I,V)),direction:t.direction(),classes:{on:t.bubble().classesOn(),off:t.bubble().classesOff()},label:t.label(),candidateYforTest:Y};return K&&J?xc.fit(ut):xc.nofit(ut,Z,tt)},Sc=function(t,n,e,o){Yi(n,"max-height"),Yi(n,"max-width");var r,i,u,a,c,s,f,l,d,m={width:yu(r=n),height:lu(r)};return i=o.preference,u=t,a=m,c=e,s=o.bounds,f=a.width,l=a.height,d=function(t,o,r,i){var n=t(u,a,c);return wc(n,f,l,s).fold(xc.fit,function(t,n,e){return i<e||r<n?xc.nofit(t,n,e):xc.nofit(o,r,i)})},N(i,function(t,n){var e=g(d,n);return t.fold(xc.fit,e)},xc.nofit({x:u.x,y:u.y,width:a.width,height:a.height,maxHeight:a.height,maxWidth:a.width,direction:ha(),classes:{on:[],off:[]},label:"none",candidateYforTest:u.y},-1,-1)).fold(ct,ct)},kc=function(t,n,e){var o,r;fc(t,(o=e.origin,r=n,o.fold(function(){return sc("absolute",st.some(r.x),st.some(r.y),st.none(),st.none())},function(t,n,e,o){return dc("absolute",r,t,n,e,o)},function(t,n,e,o){return dc("fixed",r,t,n,e,o)})))},Cc=function(t,n){var e,o,r;e=t,o=Math.floor(n),r=su.max(e,o,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]),Ni(e,"max-height",r+"px")},Oc=at(function(t,n){Cc(t,n),Li(t,{"overflow-x":"hidden","overflow-y":"auto"})}),_c=at(function(t,n){Cc(t,n)}),Tc=function(t,n,e){return t[n]===undefined?e:t[n]},Ec=function(t,n,e,o,r,i){var u,a=Tc(i,"maxHeightFunction",Oc()),c=Tc(i,"maxWidthFunction",Z),s=t.anchorBox(),f=t.origin(),l={bounds:(u=f,r.fold(function(){return u.fold(Fu,Fu,Du)},function(e){return u.fold(e,e,function(){var t=e(),n=gc(u,t.x,t.y);return Du(n.left(),n.top(),t.width,t.height)})})),origin:f,preference:o,maxHeightFunction:a,maxWidthFunction:c};Bc(s,n,e,l)},Bc=function(t,n,e,o){var r,i,u,a,c,s,f=Sc(t,n,e,o);kc(n,f,o),r=n,i=f.classes,Ti(r,i.off),_i(r,i.on),u=n,a=f,(0,o.maxHeightFunction)(u,a.maxHeight),c=n,s=f,(0,o.maxWidthFunction)(c,s.maxWidth)},Dc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],Mc=function(t,n,e){var r=function(t){return Ft(e,t).getOr([])},o=function(t,n,e){var o=X(Dc,e);return{offset:function(){return mu(t,n)},classesOn:function(){return U(e,r)},classesOff:function(){return U(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"])},innerNorthwest:function(){return o(-t,n,["top","alignRight"])},innerNortheast:function(){return o(t,n,["top","alignLeft"])},innerNorth:function(){return o(-t/2,n,["top","alignCentre"])},innerSouthwest:function(){return o(-t,-n,["bottom","alignRight"])},innerSoutheast:function(){return o(t,-n,["bottom","alignLeft"])},innerSouth:function(){return o(-t/2,-n,["bottom","alignCentre"])},innerWest:function(){return o(t,-n/2,["valignCentre","right"])},innerEast:function(){return o(-t,-n/2,["valignCentre","left"])}}},Ac=function(){return Mc(0,0,{})},Fc=function(n,e){return function(t){return"rtl"===Ic(t)?e:n}},Ic=function(t){return"rtl"===Ui(t,"direction")?"rtl":"ltr"};(qu=Yu=Yu||{}).TopToBottom="toptobottom",qu.BottomToTop="bottomtotop";var Rc="data-alloy-vertical-dir",Vc=function(t){return zu(t,function(t){return fr(t)&&Ir(t,Rc)===Yu.BottomToTop})},Pc=function(){return Zn("layouts",[Nn("onLtr"),Nn("onRtl"),qn("onBottomLtr"),qn("onBottomRtl")])},Hc=function(n,t,e,o,r,i,u){var a=u.map(Vc).getOr(!1),c=t.layouts.map(function(t){return t.onLtr(n)}),s=t.layouts.map(function(t){return t.onRtl(n)}),f=a?t.layouts.bind(function(t){return t.onBottomLtr.map(function(t){return t(n)})}).or(c).getOr(r):c.getOr(e),l=a?t.layouts.bind(function(t){return t.onBottomRtl.map(function(t){return t(n)})}).or(s).getOr(i):s.getOr(o);return Fc(f,l)(n)},zc=[Nn("hotspot"),qn("bubble"),te("overrides",{}),Pc(),la("placement",function(t,n,e){var o=n.hotspot,r=mc(e,o.element()),i=Hc(t.element(),n,ja(),Ua(),La(),[Ia,Fa,Aa,Ma,Ra,Va],st.some(n.hotspot.element()));return st.some({anchorBox:r,bubble:n.bubble.getOr(Ac()),overrides:n.overrides,layouts:i,placer:st.none()})})],Nc=[Nn("x"),Nn("y"),te("height",0),te("width",0),te("bubble",Ac()),te("overrides",{}),Pc(),la("placement",function(t,n,e){var o=gc(e,n.x,n.y),r=Du(o.left(),o.top(),n.width,n.height),i=Hc(t.element(),n,za(),Na(),za(),Na(),st.none());return st.some({anchorBox:r,bubble:n.bubble,overrides:n.overrides,layouts:i,placer:st.none()})})],Lc=function(t,n,e,o){return{start:at(t),soffset:at(n),finish:at(e),foffset:at(o)}},jc=Vt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Uc=(jc.before,jc.on,jc.after,function(t){return t.fold(ct,ct,ct)}),Wc=Vt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Gc={domRange:Wc.domRange,relative:Wc.relative,exact:Wc.exact,exactFromRange:function(t){return Wc.exact(t.start(),t.soffset(),t.finish(),t.foffset())},getWin:function(t){var n=t.match({domRange:function(t){return le.fromDom(t.startContainer)},relative:function(t,n){return Uc(t)},exact:function(t,n,e,o){return t}});return vr(n)},range:Lc},Xc=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},Yc=function(t,n,e,o,r){var i=t.document.createRange();return i.setStart(n.dom(),e),i.setEnd(o.dom(),r),i},qc=function(t){return{left:at(t.left),top:at(t.top),right:at(t.right),bottom:at(t.bottom),width:at(t.width),height:at(t.height)}},Kc=Vt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Jc=function(t,n,e){return n(le.fromDom(e.startContainer),e.startOffset,le.fromDom(e.endContainer),e.endOffset)},$c=function(t,n){var r,e,o,i=(r=t,n.match({domRange:function(t){return{ltr:at(t),rtl:st.none}},relative:function(t,n){return{ltr:Lt(function(){return Xc(r,t,n)}),rtl:Lt(function(){return st.some(Xc(r,n,t))})}},exact:function(t,n,e,o){return{ltr:Lt(function(){return Yc(r,t,n,e,o)}),rtl:Lt(function(){return st.some(Yc(r,e,o,t,n))})}}}));return(o=(e=i).ltr()).collapsed?e.rtl().filter(function(t){return!1===t.collapsed}).map(function(t){return Kc.rtl(le.fromDom(t.endContainer),t.endOffset,le.fromDom(t.startContainer),t.startOffset)}).getOrThunk(function(){return Jc(0,Kc.ltr,o)}):Jc(0,Kc.ltr,o)};Kc.ltr,Kc.rtl;var Qc=function KF(e,o){var n=function(t){return e(t)?st.from(t.dom().nodeValue):st.none()};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}}}(lr,"text"),Zc=function(t){return Qc.getOption(t)},ts=["img","br"],ns=function(t){return Zc(t).filter(function(t){return 0!==t.trim().length||-1<t.indexOf("\xa0")}).isSome()||A(ts,cr(t))},es=function(t,i){var u=function(t){for(var n=xr(t),e=n.length-1;0<=e;e--){var o=n[e];if(i(o))return st.some(o);var r=u(o);if(r.isSome())return r}return st.none()};return u(t)},os=function(t,n){return e=n,r=(o=t)===undefined?nt.document:o.dom(),Le(r)?[]:V(r.querySelectorAll(e),le.fromDom);var e,o,r},rs=function(t,n,e,o){var r,i,u,a,c,s=(i=n,u=e,a=o,(c=gr(r=t).dom().createRange()).setStart(r.dom(),i),c.setEnd(u.dom(),a),c),f=je(t,e)&&n===o;return s.collapsed&&!f},is=function(t){var n=le.fromDom(t.anchorNode),e=le.fromDom(t.focusNode);return rs(n,t.anchorOffset,e,t.focusOffset)?st.some(Lc(n,t.anchorOffset,e,t.focusOffset)):function(t){if(0<t.rangeCount){var n=t.getRangeAt(0),e=t.getRangeAt(t.rangeCount-1);return st.some(Lc(le.fromDom(n.startContainer),n.startOffset,le.fromDom(e.endContainer),e.endOffset))}return st.none()}(t)},us=function(t,n){var i,e,o,r,u=$c(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?st.some(r).map(qc):st.none()},as=function(t,n){return{element:t,offset:n}},cs=function(t,n){var e=xr(t);if(0===e.length)return as(t,n);if(n<e.length)return as(e[n],0);var o,r=e[e.length-1],i=lr(r)?(o=r,Qc.get(o).length):xr(r).length;return as(r,i)},ss=Vt([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),fs=function(t){return t.fold(ct,function(t,n,e){return t.translate(-n,-e)})},ls=function(t){return t.fold(ct,ct)},ds=function(t){return N(t,function(t,n){return t.translate(n.left(),n.top())},mu(0,0))},ms=function(t){var n=V(t,ls);return ds(n)},gs=ss.screen,ps=ss.absolute,hs=function(t,n,e){var o,r,i=gr(t.element()),u=ku(i),a=(o=t,r=vr(e.root).dom(),st.from(r.frameElement).map(le.fromDom).filter(function(t){var n=gr(t),e=gr(o.element());return je(n,e)}).map(pu).getOr(u));return ps(a,u.left(),u.top())},vs=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=gs(mu(r,i));return st.some({point:c,width:u,height:a})},bs=function(t,f,l,d,m){return t.map(function(t){var n,e,o,r=[f,t.point],i=(n=function(){return ms(r)},e=function(){return ms(r)},o=function(){return t=V(r,fs),ds(t);var t},d.fold(n,e,o)),u={x:i.left(),y:i.top(),width:t.width,height:t.height},a=(l.showAbove?La:ja)(),c=(l.showAbove,Ua()),s=Hc(m,l,a,c,a,c,st.none());return{anchorBox:u,bubble:l.bubble.getOr(Ac()),overrides:l.overrides,layouts:s,placer:st.none()}})},ys=function(t,n){return lr(t)?{element:t,offset:n}:cs(t,n)},xs=function(n,t){return t.getSelection.getOrThunk(function(){return function(){return t=n,st.from(t.getSelection()).filter(function(t){return 0<t.rangeCount}).bind(is);var t}})().map(function(t){var n=ys(t.start(),t.soffset()),e=ys(t.finish(),t.foffset());return Gc.range(n.element,n.offset,e.element,e.offset)})},ws=[qn("getSelection"),Nn("root"),qn("bubble"),Pc(),te("overrides",{}),te("showAbove",!1),la("placement",function(t,n,e){var o=vr(n.root).dom(),r=hs(t,0,n),i=xs(o,n).bind(function(t){return us(o,Gc.exactFromRange(t)).orThunk(function(){var n=le.fromText("\ufeff");return Sr(t.start(),n),us(o,Gc.exact(n,0,n,1)).map(function(t){return Er(n),t})}).bind(function(t){return vs(t.left(),t.top(),t.width(),t.height())})}),u=xs(o,n).bind(function(t){return fr(t.start())?st.some(t.start()):br(t.start())}).getOr(t.element());return bs(i,r,n,e,u)})],Ss=[Nn("node"),Nn("root"),qn("bubble"),Pc(),te("overrides",{}),te("showAbove",!1),la("placement",function(r,i,u){var a=hs(r,0,i);return i.node.bind(function(t){var n=t.dom().getBoundingClientRect(),e=vs(n.left,n.top,n.width,n.height),o=i.node.getOr(r.element());return bs(e,a,i,u,o)})})],ks=function(t){return t.x+t.width},Cs=function(t,n){return t.x-n.width},Os=function(t,n){return t.y-n.height+t.height},_s=function(t){return t.y},Ts=function(t,n,e){return ga(ks(t),_s(t),e.southeast(),ha(),Ca(t,{left:0,top:2}),"link-layout-se")},Es=function(t,n,e){return ga(Cs(t,n),_s(t),e.southwest(),va(),Ca(t,{right:1,top:2}),"link-layout-sw")},Bs=function(t,n,e){return ga(ks(t),Os(t,n),e.northeast(),ba(),Ca(t,{left:0,bottom:3}),"link-layout-ne")},Ds=function(t,n,e){return ga(Cs(t,n),Os(t,n),e.northwest(),ya(),Ca(t,{right:1,bottom:3}),"link-layout-nw")},Ms=function(){return[Ts,Es,Bs,Ds]},As=function(){return[Es,Ts,Ds,Bs]},Fs=[Nn("item"),Pc(),te("overrides",{}),la("placement",function(t,n,e){var o=mc(e,n.item.element()),r=Hc(t.element(),n,Ms(),As(),Ms(),As(),st.none());return st.some({anchorBox:o,bubble:Ac(),overrides:n.overrides,layouts:r,placer:st.none()})})],Is=Dn("anchor",{selection:ws,node:Ss,hotspot:zc,submenu:Fs,makeshift:Nc}),Rs=function(t,n,e,o,r){var i=vc(e.anchorBox,n);Ec(i,r.element(),e.bubble,e.layouts,o,e.overrides)},Vs=function(t,n,e,o,r,i){var u=i.map(Mu);return Ps(t,n,e,o,r,u)},Ps=function(c,s,t,n,f,l){var d=Tn("positioning anchor.info",Is,n);cc(function(){Ni(f.element(),"position","fixed");var t=Gi(f.element(),"visibility");Ni(f.element(),"visibility","hidden");var n,e,o,r,i=s.useFixed()?(r=nt.document.documentElement,hc(0,0,r.clientWidth,r.clientHeight)):(e=pu((n=c).element()),o=n.element().dom().getBoundingClientRect(),pc(e.left(),e.top(),o.width,o.height)),u=d.placement,a=l.map(at).or(s.getBounds);u(c,d,i).each(function(t){t.placer.getOr(Rs)(c,i,t,a,f)}),t.fold(function(){Yi(f.element(),"visibility")},function(t){Ni(f.element(),"visibility",t)}),Gi(f.element(),"left").isNone()&&Gi(f.element(),"top").isNone()&&Gi(f.element(),"right").isNone()&&Gi(f.element(),"bottom").isNone()&&Gi(f.element(),"position").is("fixed")&&Yi(f.element(),"position")},f.element())},Hs=/* */Object.freeze({__proto__:null,position:function(t,n,e,o,r){Vs(t,n,e,o,r,st.none())},positionWithin:Vs,positionWithinBounds:Ps,getMode:function(t,n,e){return n.useFixed()?"fixed":"absolute"}}),zs=[te("useFixed",c),qn("getBounds")],Ns=$a({fields:zs,name:"positioning",active:rc,apis:Hs}),Ls=function(t){jo(t,Fo());var n=t.components();rt(n,Ls)},js=function(t){var n=t.components();rt(n,js),jo(t,Ao())},Us=function(t,n){Or(t.element(),n.element())},Ws=function(n,t){var e,o=n.components();rt((e=n).components(),function(t){return Er(t.element())}),Tr(e.element()),e.syncComponents();var r=X(o,t);rt(r,function(t){Ls(t),n.getSystem().removeFromWorld(t)}),rt(t,function(t){t.getSystem().isConnected()?Us(n,t):(n.getSystem().addToWorld(t),Us(n,t),Ri(n.element())&&js(t)),n.syncComponents()})},Gs=function(t,n){Xs(t,n,Or)},Xs=function(t,n,e){t.getSystem().addToWorld(n),e(t.element(),n.element()),Ri(t.element())&&js(n),t.syncComponents()},Ys=function(t){Ls(t),Er(t.element()),t.getSystem().removeFromWorld(t)},qs=function(n){var t=br(n.element()).bind(function(t){return n.getSystem().getByDom(t).toOption()});Ys(n),t.each(function(t){t.syncComponents()})},Ks=function(t){var n=t.components();rt(n,Ys),Tr(t.element()),t.syncComponents()},Js=function(t,n){$s(t,n,Or)},$s=function(t,n,e){e(t,n.element());var o=xr(n.element());rt(o,function(t){n.getByDom(t).each(js)})},Qs=function(n){var t=xr(n.element());rt(t,function(t){n.getByDom(t).each(Ls)}),Er(n.element())},Zs=function(n,t,e,o){e.get().each(function(t){Ks(n)});var r=t.getAttachPoint(n);Gs(r,n);var i=n.getSystem().build(o);return Gs(n,i),e.set(i),i},tf=function(t,n,e,o){var r=Zs(t,n,e,o);return n.onOpen(t,r),r},nf=function(n,e,o){o.get().each(function(t){Ks(n),qs(n),e.onClose(n,t),o.clear()})},ef=function(t,n,e){return e.isOpen()},of=function(t,n,e){var o,r,i,u,a=n.getAttachPoint(t);Ni(t.element(),"position",Ns.getMode(a)),o=t,r="visibility",i=n.cloakVisibilityAttr,u="hidden",Gi(o.element(),r).fold(function(){Pr(o.element(),i)},function(t){Fr(o.element(),i,t)}),Ni(o.element(),r,u)},rf=function(t,n,e){var o,r,i,u;o=t.element(),F(["top","left","right","bottom"],function(t){return Gi(o,t).isSome()})||Yi(t.element(),"position"),r=t,i="visibility",u=n.cloakVisibilityAttr,Rr(r.element(),u).fold(function(){return Yi(r.element(),i)},function(t){return Ni(r.element(),i,t)})},uf=/* */Object.freeze({__proto__:null,cloak:of,decloak:rf,open:tf,openWhileCloaked:function(t,n,e,o,r){of(t,n),tf(t,n,e,o),r(),rf(t,n)},close:nf,isOpen:ef,isPartOf:function(n,e,t,o){return ef(0,0,t)&&t.get().exists(function(t){return e.isPartOf(n,t,o)})},getState:function(t,n,e){return e.get()},setContent:function(t,n,e,o){return e.get().map(function(){return Zs(t,n,e,o)})}}),af=/* */Object.freeze({__proto__:null,events:function(e,o){return qo([$o(Oo(),function(t,n){nf(t,e,o)})])}}),cf=[aa("onOpen"),aa("onClose"),Nn("isPartOf"),Nn("getAttachPoint"),te("cloakVisibilityAttr","data-precloak-visibility")],sf=$a({fields:cf,name:"sandboxing",active:af,apis:uf,state:/* */Object.freeze({__proto__:null,init:function(){var n=se(st.none()),t=at("not-implemented");return ai({readState:t,isOpen:function(){return n.get().isSome()},clear:function(){n.set(st.none())},set:function(t){n.set(st.some(t))},get:function(){return n.get()}})}})}),ff=at("dismiss.popups"),lf=at("reposition.popups"),df=at("mouse.released"),mf=fn([te("isExtraPart",at(!1)),Zn("fireEventInstead",[te("event",Io())])]),gf=function(t){var n,e=Tn("Dismissal",mf,t);return(n={})[ff()]={schema:fn([Nn("target")]),onReceive:function(n,t){sf.isOpen(n)&&(sf.isPartOf(n,t.target)||e.isExtraPart(n,t.target)||e.fireEventInstead.fold(function(){return sf.close(n)},function(t){return jo(n,t.event)}))}},n},pf=fn([Zn("fireEventInstead",[te("event",Ro())]),Wn("doReposition")]),hf=function(t){var n,e=Tn("Reposition",pf,t);return(n={})[lf()]={onReceive:function(n){sf.isOpen(n)&&e.fireEventInstead.fold(function(){return e.doReposition(n)},function(t){return jo(n,t.event)})}},n},vf=function(t,n,e){n.store.manager.onLoad(t,n,e)},bf=function(t,n,e){n.store.manager.onUnload(t,n,e)},yf=/* */Object.freeze({__proto__:null,onLoad:vf,onUnload:bf,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}}),xf=/* */Object.freeze({__proto__:null,events:function(e,o){var t=e.resetOnDom?[rr(function(t,n){vf(t,e,o)}),ir(function(t,n){bf(t,e,o)})]:[Wa(e,o,vf)];return qo(t)}}),wf=function(){var t=se(null);return ai({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()}}})},Sf=function(){var i=se({}),u=se({});return ai({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(t){return Ft(i.get(),t).orThunk(function(){return Ft(u.get(),t)})},update:function(t){var n=i.get(),e=u.get(),o={},r={};rt(t,function(n){o[n.value]=n,Ft(n,"meta").each(function(t){Ft(t,"text").each(function(t){r[t]=n})})}),i.set(et(et({},n),o)),u.set(et(et({},e),r))},clear:function(){i.set({}),u.set({})}})},kf=/* */Object.freeze({__proto__:null,memory:wf,dataset:Sf,manual:function(){return ai({readState:function(){}})},init:function(t){return t.store.manager.state(t)}}),Cf=function(t,n,e,o){var r=n.store;e.update([o]),r.setValue(t,o),n.onSetValue(t,o)},Of=[qn("initialValue"),Nn("getFallbackEntry"),Nn("getDataKey"),Nn("setValue"),la("manager",{setValue:Cf,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){Cf(n,e,o,t)})},onUnload:function(t,n,e){e.clear()},state:Sf})],_f=[Nn("getValue"),te("setValue",Z),qn("initialValue"),la("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:Z,state:ui.init})],Tf=[qn("initialValue"),la("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:wf})],Ef=[ne("store",{mode:"memory"},Dn("mode",{memory:Tf,manual:_f,dataset:Of})),aa("onSetValue"),te("resetOnDom",!1)],Bf=$a({fields:Ef,name:"representing",active:xf,apis:yf,extra:{setValueFrom:function(t,n){var e=Bf.getValue(n);Bf.setValue(t,e)}},state:kf}),Df=function(o,t){return ae(o,{},V(t,function(t){return n=t.name(),e="Cannot configure "+t.name()+" for "+o,vn(n,n,Gt(),sn(function(t){return yt("The field: "+n+" is forbidden. "+e)}));var n,e}).concat([ce("dump",ct)]))},Mf=function(t){return t.dump},Af=function(t,n){return et(et({},t.dump),Ka(n))},Ff=Df,If=Af,Rf="placeholder",Vf=Vt([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Pf=function(t){return It(t,"uiType")},Hf=function(t,n,e,o){return Pf(e)&&e.uiType===Rf?(i=e,u=o,(r=t).exists(function(t){return t!==i.owner})?Vf.single(!0,at(i)):Ft(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+Ct(u)+"]\nNamespace: "+r.getOr("none")+"\nSpec: "+JSON.stringify(i,null,2))},function(t){return t.replace()})):Vf.single(!1,at(e));var r,i,u},zf=function(i,u,a,c){return Hf(i,0,a,c).fold(function(t,n){var e=Pf(a)?n(u,a.config,a.validated):n(u),o=Ft(e,"components").getOr([]),r=U(o,function(t){return zf(i,u,t,c)});return[et(et({},e),{components:r})]},function(t,n){if(Pf(a)){var e=n(u,a.config,a.validated);return a.validated.preprocess.getOr(ct)(e)}return n(u)})},Nf=function(n,e,t,o){var r,i,u,a=Tt(o,function(t,n){return o=t,r=!1,{name:at(e=n),required:function(){return o.fold(function(t,n){return t},function(t,n){return t})},used:function(){return r},replace:function(){if(r)throw new Error("Trying to use the same placeholder more than once: "+e);return r=!0,o}};var e,o,r}),c=(r=n,i=e,u=a,U(t,function(t){return zf(r,i,t,u)}));return _t(a,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: "+JSON.stringify(e.components,null,2))}),c},Lf=Vf.single,jf=Vf.multiple,Uf=at(Rf),Wf=Vt([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Gf=te("factory",{sketch:ct}),Xf=te("schema",[]),Yf=Nn("name"),qf=vn("pname","pname",Xt(function(t){return"<alloy."+Wr(t.name)+">"}),Mn()),Kf=ce("schema",function(){return[qn("preprocess")]}),Jf=te("defaults",at({})),$f=te("overrides",at({})),Qf=ln([Gf,Xf,Yf,qf,Jf,$f]),Zf=ln([Gf,Xf,Yf,Jf,$f]),tl=ln([Gf,Xf,Yf,qf,Jf,$f]),nl=ln([Gf,Kf,Yf,Nn("unit"),qf,Jf,$f]),el=function(t){return t.fold(st.some,st.none,st.some,st.some)},ol=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},rl=function(e,o){return function(t){var n=Tn("Converting part type",o,t);return e(n)}},il=rl(Wf.required,Qf),ul=rl(Wf.external,Zf),al=rl(Wf.optional,tl),cl=rl(Wf.group,nl),sl=at("entirety"),fl=/* */Object.freeze({__proto__:null,required:il,external:ul,optional:al,group:cl,asNamedPart:el,name:ol,asCommon:function(t){return t.fold(ct,ct,ct,ct)},original:sl}),ll=function(t,n,e,o){return zt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},dl=function(r,t){var n={};return rt(t,function(t){el(t).each(function(e){var o=ml(r,e.pname);n[e.name]=function(t){var n=Tn("Part: "+e.name+" in "+r,ln(e.schema),t);return et(et({},o),{config:t,validated:n})}})}),n},ml=function(t,n){return{uiType:Uf(),owner:t,name:n}},gl=function(t,n,e){return{uiType:Uf(),owner:t,name:n,config:e,validated:{}}},pl=function(t){return U(t,function(t){return t.fold(st.none,st.some,st.none,st.none).map(function(t){return Gn(t.name,t.schema.concat([da(sl())]))}).toArray()})},hl=function(t){return V(t,ol)},vl=function(t,n,e){return o=n,i={},r={},rt(e,function(t){t.fold(function(o){i[o.pname]=Lf(!0,function(t,n,e){return o.factory.sketch(ll(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=at(t.factory.sketch(ll(o,t,n[sl()]),n))},function(o){i[o.pname]=Lf(!1,function(t,n,e){return o.factory.sketch(ll(t,o,n,e))})},function(r){i[r.pname]=jf(!0,function(n,t,e){var o=n[r.name];return V(o,function(t){return r.factory.sketch(zt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:at(i),externals:at(r)};var o,i,r},bl=function(t,n,e){return Nf(st.some(t),n,n.components,e)},yl=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},xl=function(t,n,e){return yl(t,n,e).getOrDie("Could not find part: "+e)},wl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return rt(e,function(t){o[t]=at(i.getByUid(r[t]))}),o},Sl=function(t,n){var e=t.getSystem();return Tt(n.partUids,function(t,n){return at(e.getByUid(t))})},kl=function(t){return Ct(t.partUids)},Cl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return rt(e,function(t){o[t]=at(i.getByUid(r[t]).getOrDie())}),o},Ol=function(n,t){var e=hl(t);return $t(V(e,function(t){return{key:t,value:n+"-"+t}}))},_l=function(n){return vn("partUids","partUids",Yt(function(t){return Ol(t.uid,n)}),Mn())},Tl=/* */Object.freeze({__proto__:null,generate:dl,generateOne:gl,schemas:pl,names:hl,substitutes:vl,components:bl,defaultUids:Ol,defaultUidsSchema:_l,getAllParts:Sl,getAllPartNames:kl,getPart:yl,getPartOrDie:xl,getParts:wl,getPartsOrDie:Cl}),El=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[Gn("parts",i)]:[]).concat([Nn("uid"),te("dom",{}),te("components",[]),da("originalSpec"),te("debug.sketcher",{})]).concat(u));return Tn(t+" [SpecSchema]",fn(a.concat(n)),e)},Bl=function(t,n,e,o,r){var i=Dl(r),u=pl(e),a=_l(e),c=El(t,n,i,u,[a]),s=vl(0,c,e);return o(c,bl(t,c,s.internals()),i,s.externals())},Dl=function(t){return It(t,"uid")?t:et(et({},t),{uid:$r("uid")})};var Ml,Al,Fl=fn([Nn("name"),Nn("factory"),Nn("configFields"),te("apis",{}),te("extraApis",{})]),Il=fn([Nn("name"),Nn("factory"),Nn("configFields"),Nn("partFields"),te("apis",{}),te("extraApis",{})]),Rl=function(t){var i=Tn("Sketcher for "+t.name,Fl,t),n=Tt(i.apis,ii),e=Tt(i.extraApis,function(t,n){return ei(t,n)});return et(et({name:at(i.name),configFields:at(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=Dl(t),o(El(n,e,r,[],[]),r);var n,e,o,r}},n),e)},Vl=function(t){var n=Tn("Sketcher for "+t.name,Il,t),e=dl(n.name,n.partFields),o=Tt(n.apis,ii),r=Tt(n.extraApis,function(t,n){return ei(t,n)});return et(et({name:at(n.name),partFields:at(n.partFields),configFields:at(n.configFields),sketch:function(t){return Bl(n.name,n.configFields,n.partFields,n.factory,t)},parts:at(e)},o),r)},Pl=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o<t.length;o++)t[o].each(e);return n},Hl=function(t){return"input"===cr(t)&&"radio"!==Ir(t,"type")||"textarea"===cr(t)},zl=/* */Object.freeze({__proto__:null,getCurrent:function(t,n,e){return n.find(t)}}),Nl=[Nn("find")],Ll=$a({fields:Nl,name:"composing",apis:zl}),jl=function(e,o,t,r){var n=os(e.element(),"."+o.highlightClass);rt(n,function(n){F(r,function(t){return t.element()===n})||(Ci(n,o.highlightClass),e.getSystem().getByDom(n).each(function(t){o.onDehighlight(e,t),jo(t,Lo())}))})},Ul=function(t,n,e,o){jl(t,n,0,[o]),Wl(t,n,e,o)||(Si(o.element(),n.highlightClass),n.onHighlight(t,o),jo(o,No()))},Wl=function(t,n,e,o){return Oi(o.element(),n.highlightClass)},Gl=function(t,n,e,o){var r=os(t.element(),"."+n.itemClass);return st.from(r[o]).fold(function(){return ut.error("No element found with index "+o)},t.getSystem().getByDom)},Xl=function(n,t,e){return Lu(n.element(),"."+t.itemClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},Yl=function(n,t,e){var o=os(n.element(),"."+t.itemClass);return(0<o.length?st.some(o[o.length-1]):st.none()).bind(function(t){return n.getSystem().getByDom(t).toOption()})},ql=function(e,n,t,o){var r=os(e.element(),"."+n.itemClass);return j(r,function(t){return Oi(t,n.highlightClass)}).bind(function(t){var n=bc(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOption()})},Kl=function(n,t,e){var o=os(n.element(),"."+t.itemClass);return Pl(V(o,function(t){return n.getSystem().getByDom(t).toOption()}))},Jl=/* */Object.freeze({__proto__:null,dehighlightAll:function(t,n,e){return jl(t,n,0,[])},dehighlight:function(t,n,e,o){Wl(t,n,e,o)&&(Ci(o.element(),n.highlightClass),n.onDehighlight(t,o),jo(o,Lo()))},highlight:Ul,highlightFirst:function(n,e,o){Xl(n,e).each(function(t){Ul(n,e,o,t)})},highlightLast:function(n,e,o){Yl(n,e).each(function(t){Ul(n,e,o,t)})},highlightAt:function(n,e,o,t){Gl(n,e,o,t).fold(function(t){throw new Error(t)},function(t){Ul(n,e,o,t)})},highlightBy:function(n,e,o,t){var r=Kl(n,e);L(r,t).each(function(t){Ul(n,e,o,t)})},isHighlighted:Wl,getHighlighted:function(n,t,e){return Lu(n.element(),"."+t.highlightClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},getFirst:Xl,getLast:Yl,getPrevious:function(t,n,e){return ql(t,n,0,-1)},getNext:function(t,n,e){return ql(t,n,0,1)},getCandidates:Kl}),$l=[Nn("highlightClass"),Nn("itemClass"),aa("onHighlight"),aa("onDehighlight")],Ql=$a({fields:$l,name:"highlighting",apis:Jl}),Zl=function(){return[13]},td=function(){return[27]},nd=function(){return[32]},ed=function(){return[37]},od=function(){return[38]},rd=function(){return[39]},id=function(){return[40]},ud=function(t,n,e){var o=G(t.slice(0,n)),r=G(t.slice(n+1));return L(o.concat(r),e)},ad=function(t,n,e){var o=G(t.slice(0,n));return L(o,e)},cd=function(t,n,e){var o=t.slice(0,n),r=t.slice(n+1);return L(r.concat(o),e)},sd=function(t,n,e){var o=t.slice(n+1);return L(o,e)},fd=function(e){return function(t){var n=t.raw();return A(e,n.which)}},ld=function(t){return function(n){return W(t,function(t){return t(n)})}},dd=function(t){return!0===t.raw().shiftKey},md=function(t){return!0===t.raw().ctrlKey},gd=x(dd),pd=function(t,n){return{matches:t,classification:n}},hd=function(t,n,e){n.exists(function(n){return e.exists(function(t){return je(t,n)})})||Uo(t,Vo(),{prevFocus:n,newFocus:e})},vd=function(){var r=function(t){return ac(t.element())};return{get:r,set:function(t,n){var e=r(t);t.getSystem().triggerFocus(n,t.element());var o=r(t);hd(t,e,o)}}},bd=function(){var r=function(t){return Ql.getHighlighted(t).map(function(t){return t.element()})};return{get:r,set:function(n,t){var e=r(n);n.getSystem().getByDom(t).fold(Z,function(t){Ql.highlight(n,t)});var o=r(n);hd(n,e,o)}}};(Al=Ml=Ml||{}).OnFocusMode="onFocus",Al.OnEnterOrSpaceMode="onEnterOrSpace",Al.OnApiMode="onApi";var yd,xd=function(t,n,e,o,a){var c=function(n,e,t,o,r){var i,u,a=t(n,e,o,r);return i=a,u=e.event(),L(i,function(t){return t.matches(u)}).map(function(t){return t.classification}).bind(function(t){return t(n,e,o,r)})},r={schema:function(){return t.concat([te("focusManager",vd()),ne("focusInside","onFocus",kn(function(t){return A(["onFocus","onEnterOrSpace","onApi"],t)?ut.value(t):ut.error("Invalid value for focusInside")})),la("handler",r),la("state",n),la("sendFocusIn",a)])},processKey:c,toEvents:function(i,u){var t=i.focusInside!==Ml.OnFocusMode?st.none():a(i).map(function(e){return $o(vo(),function(t,n){e(t,i,u),n.stop()})}),n=[$o(co(),function(o,r){c(o,r,e,i,u).fold(function(){var n,e,t;n=o,e=r,t=fd(nd().concat(Zl()))(e.event()),i.focusInside===Ml.OnEnterOrSpaceMode&&t&&qe(n,e)&&a(i).each(function(t){t(n,i,u),e.stop()})},function(t){r.stop()})}),$o(so(),function(t,n){c(t,n,o,i,u).each(function(t){n.stop()})})];return qo(t.toArray().concat(n))}};return r},wd=function(t){var n=[qn("onEscape"),qn("onEnter"),te("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),te("firstTabstop",0),te("useTabstopAt",at(!0)),qn("visibilitySelector")].concat([t]),u=function(t,n){var e=t.visibilitySelector.bind(function(t){return ju(n,t)}).getOr(n);return 0<fu(e)},e=function(n,e,t){var o,r,i;o=e,r=os(n.element(),o.selector),i=H(r,function(t){return u(o,t)}),st.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?st.some(!0):st.none()},function(t){return o.focusManager.set(n,t),st.some(!0)})},r=function(n,t,e,o){var r,i,u=os(n.element(),e.selector);return r=n,(i=e).focusManager.get(r).bind(function(t){return ju(t,i.selector)}).bind(function(t){return j(u,g(je,t)).bind(function(t){return a(n,u,t,e,o)})})},o=at([pd(ld([dd,fd([9])]),function(t,n,e){var o=e.cyclic?ud:ad;return r(t,0,e,o)}),pd(fd([9]),function(t,n,e){var o=e.cyclic?cd:sd;return r(t,0,e,o)}),pd(fd(td()),function(n,e,t){return t.onEscape.bind(function(t){return t(n,e)})}),pd(ld([gd,fd(Zl())]),function(n,e,t){return t.onEnter.bind(function(t){return t(n,e)})})]),i=at([]);return xd(n,ui.init,o,i,function(){return st.some(e)})},Sd=wd(ce("cyclic",at(!1))),kd=wd(ce("cyclic",at(!0))),Cd=function(t,n,e){return Hl(e)&&fd(nd())(n.event())?st.none():(Go(t,e,wo()),st.some(!0))},Od=function(t,n){return st.some(!0)},_d=[te("execute",Cd),te("useSpace",!1),te("useEnter",!0),te("useControlEnter",!1),te("useDown",!1)],Td=function(t,n,e){return e.execute(t,n,t.element())},Ed=xd(_d,ui.init,function(t,n,e,o){var r=e.useSpace&&!Hl(t.element())?nd():[],i=e.useEnter?Zl():[],u=e.useDown?id():[],a=r.concat(i).concat(u);return[pd(fd(a),Td)].concat(e.useControlEnter?[pd(ld([md,fd(Zl())]),Td)]:[])},function(t,n,e,o){return e.useSpace&&!Hl(t.element())?[pd(fd(nd()),Od)]:[]},function(){return st.none()}),Bd=function(){var e=se(st.none());return ai({readState:function(){return e.get().map(function(t){return{numRows:String(t.numRows),numColumns:String(t.numColumns)}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(t,n){e.set(st.some({numRows:t,numColumns:n}))},getNumRows:function(){return e.get().map(function(t){return t.numRows})},getNumColumns:function(){return e.get().map(function(t){return t.numColumns})}})},Dd=/* */Object.freeze({__proto__:null,flatgrid:Bd,init:function(t){return t.state(t)}}),Md=function(i){return function(t,n,e,o){var r=i(t.element());return Rd(r,t,n,e,o)}},Ad=function(t,n){var e=Fc(t,n);return Md(e)},Fd=function(t,n){var e=Fc(n,t);return Md(e)},Id=function(r){return function(t,n,e,o){return Rd(r,t,n,e,o)}},Rd=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})},Vd=Id,Pd=Id,Hd=Id,zd=function(t){return!((n=t.dom()).offsetWidth<=0&&n.offsetHeight<=0);var n},Nd=function(t,n,e){var o,r=os(t,e),i=H(r,zd);return j(o=i,function(t){return je(t,n)}).map(function(t){return{index:at(t),candidates:at(o)}})},Ld=function(t,n){return j(t,function(t){return je(n,t)})},jd=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?st.some(e[n]):st.none()})},Ud=function(r,t,i,u,a){return jd(r,t,u,function(t,n){var e=t===i-1?r.length-t*u:u,o=bc(n,a,0,e-1);return st.some({row:at(t),column:at(o)})})},Wd=function(i,t,u,a,c){return jd(i,t,a,function(t,n){var e=bc(t,c,0,u-1),o=e===u-1?i.length-e*a:a,r=yc(n,0,o-1);return st.some({row:at(e),column:at(r)})})},Gd=[Nn("selector"),te("execute",Cd),ca("onEscape"),te("captureTab",!1),ma()],Xd=function(n,e,t){Lu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},Yd=function(r){return function(t,n,e,o){return Nd(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))})}},qd=function(t,n,e){return e.captureTab?st.some(!0):st.none()},Kd=Yd(function(t,n,e,o){return Ud(t,n,e,o,-1)}),Jd=Yd(function(t,n,e,o){return Ud(t,n,e,o,1)}),$d=Yd(function(t,n,e,o){return Wd(t,n,e,o,-1)}),Qd=Yd(function(t,n,e,o){return Wd(t,n,e,o,1)}),Zd=at([pd(fd(ed()),Ad(Kd,Jd)),pd(fd(rd()),Fd(Kd,Jd)),pd(fd(od()),Vd($d)),pd(fd(id()),Pd(Qd)),pd(ld([dd,fd([9])]),qd),pd(ld([gd,fd([9])]),qd),pd(fd(td()),function(t,n,e){return e.onEscape(t,n)}),pd(fd(nd().concat(Zl())),function(n,e,o,t){return r=n,(i=o).focusManager.get(r).bind(function(t){return ju(t,i.selector)}).bind(function(t){return o.execute(n,e,t)});var r,i})]),tm=at([pd(fd(nd()),Od)]),nm=xd(Gd,Bd,Zd,tm,function(){return st.some(Xd)}),em=function(t,n,e,i){var u=function(t,n,e){var o,r=bc(n,i,0,e.length-1);return r===t?st.none():(o=e[r],"button"===cr(o)&&"disabled"===Ir(o,"disabled")?u(t,r,e):st.from(e[r]))};return Nd(t,e,n).bind(function(t){var n=t.index(),e=t.candidates();return u(n,n,e)})},om=[Nn("selector"),te("getInitial",st.none),te("execute",Cd),ca("onEscape"),te("executeOnMove",!1),te("allowVertical",!0)],rm=function(n,e,o){return t=n,(r=o).focusManager.get(t).bind(function(t){return ju(t,r.selector)}).bind(function(t){return o.execute(n,e,t)});var t,r},im=function(n,e,t){e.getInitial(n).orThunk(function(){return Lu(n.element(),e.selector)}).each(function(t){e.focusManager.set(n,t)})},um=function(t,n,e){return em(t,e.selector,n,-1)},am=function(t,n,e){return em(t,e.selector,n,1)},cm=function(r){return function(t,n,e,o){return r(t,n,e,o).bind(function(){return e.executeOnMove?rm(t,n,e):st.some(!0)})}},sm=function(t,n,e){return e.onEscape(t,n)},fm=at([pd(fd(nd()),Od)]),lm=xd(om,ui.init,function(t,n,e,o){var r=ed().concat(e.allowVertical?od():[]),i=rd().concat(e.allowVertical?id():[]);return[pd(fd(r),cm(Ad(um,am))),pd(fd(i),cm(Fd(um,am))),pd(fd(Zl()),rm),pd(fd(nd()),rm),pd(fd(td()),sm)]},fm,function(){return st.some(im)}),dm=function(t,n,e){return st.from(t[n]).bind(function(t){return st.from(t[e]).map(function(t){return{rowIndex:n,columnIndex:e,cell:t}})})},mm=function(t,n,e,o){var r=t[n].length,i=bc(e,o,0,r-1);return dm(t,n,i)},gm=function(t,n,e,o){var r=bc(e,o,0,t.length-1),i=t[r].length,u=yc(n,0,i-1);return dm(t,r,u)},pm=function(t,n,e,o){var r=t[n].length,i=yc(e+o,0,r-1);return dm(t,n,i)},hm=function(t,n,e,o){var r=yc(e+o,0,t.length-1),i=t[r].length,u=yc(n,0,i-1);return dm(t,r,u)},vm=[Gn("selectors",[Nn("row"),Nn("cell")]),te("cycles",!0),te("previousSelector",st.none),te("execute",Cd)],bm=function(n,e,t){e.previousSelector(n).orThunk(function(){var t=e.selectors;return Lu(n.element(),t.cell)}).each(function(t){e.focusManager.set(n,t)})},ym=function(t,n){return function(e,o,i){var u=i.cycles?t:n;return ju(o,i.selectors.row).bind(function(t){var n=os(t,i.selectors.cell);return Ld(n,o).bind(function(o){var r=os(e,i.selectors.row);return Ld(r,t).bind(function(t){var n,e=(n=i,V(r,function(t){return os(t,n.selectors.cell)}));return u(e,t,o).map(function(t){return t.cell})})})})}},xm=ym(function(t,n,e){return mm(t,n,e,-1)},function(t,n,e){return pm(t,n,e,-1)}),wm=ym(function(t,n,e){return mm(t,n,e,1)},function(t,n,e){return pm(t,n,e,1)}),Sm=ym(function(t,n,e){return gm(t,e,n,-1)},function(t,n,e){return hm(t,e,n,-1)}),km=ym(function(t,n,e){return gm(t,e,n,1)},function(t,n,e){return hm(t,e,n,1)}),Cm=at([pd(fd(ed()),Ad(xm,wm)),pd(fd(rd()),Fd(xm,wm)),pd(fd(od()),Vd(Sm)),pd(fd(id()),Pd(km)),pd(fd(nd().concat(Zl())),function(n,e,o){return ac(n.element()).bind(function(t){return o.execute(n,e,t)})})]),Om=at([pd(fd(nd()),Od)]),_m=xd(vm,ui.init,Cm,Om,function(){return st.some(bm)}),Tm=[Nn("selector"),te("execute",Cd),te("moveOnTab",!1)],Em=function(n,e,o){return o.focusManager.get(n).bind(function(t){return o.execute(n,e,t)})},Bm=function(n,e,t){Lu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},Dm=function(t,n,e){return em(t,e.selector,n,-1)},Mm=function(t,n,e){return em(t,e.selector,n,1)},Am=at([pd(fd(od()),Hd(Dm)),pd(fd(id()),Hd(Mm)),pd(ld([dd,fd([9])]),function(t,n,e,o){return e.moveOnTab?Hd(Dm)(t,n,e,o):st.none()}),pd(ld([gd,fd([9])]),function(t,n,e,o){return e.moveOnTab?Hd(Mm)(t,n,e,o):st.none()}),pd(fd(Zl()),Em),pd(fd(nd()),Em)]),Fm=at([pd(fd(nd()),Od)]),Im=xd(Tm,ui.init,Am,Fm,function(){return st.some(Bm)}),Rm=[ca("onSpace"),ca("onEnter"),ca("onShiftEnter"),ca("onLeft"),ca("onRight"),ca("onTab"),ca("onShiftTab"),ca("onUp"),ca("onDown"),ca("onEscape"),te("stopSpaceKeyup",!1),qn("focusIn")],Vm=xd(Rm,ui.init,function(t,n,e){return[pd(fd(nd()),e.onSpace),pd(ld([gd,fd(Zl())]),e.onEnter),pd(ld([dd,fd(Zl())]),e.onShiftEnter),pd(ld([dd,fd([9])]),e.onShiftTab),pd(ld([gd,fd([9])]),e.onTab),pd(fd(od()),e.onUp),pd(fd(id()),e.onDown),pd(fd(ed()),e.onLeft),pd(fd(rd()),e.onRight),pd(fd(nd()),e.onSpace),pd(fd(td()),e.onEscape)]},function(t,n,e){return e.stopSpaceKeyup?[pd(fd(nd()),Od)]:[]},function(t){return t.focusIn}),Pm=Sd.schema(),Hm=kd.schema(),zm=lm.schema(),Nm=nm.schema(),Lm=_m.schema(),jm=Ed.schema(),Um=Im.schema(),Wm=Vm.schema(),Gm=Za({branchKey:"mode",branches:/* */Object.freeze({__proto__:null,acyclic:Pm,cyclic:Hm,flow:zm,flatgrid:Nm,matrix:Lm,execution:jm,menu:Um,special:Wm}),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){Rt(e,"setGridSize")?e.setGridSize(o,r):nt.console.error("Layout does not support setGridSize")}},state:Dd}),Xm=function(t,n,e,o){var r=t.getSystem().build(o);Xs(t,r,e)},Ym=function(t,n,e,o){var r=qm(t);L(r,function(t){return je(o.element(),t.element())}).each(qs)},qm=function(t,n){return t.components()},Km=function(n,t,e,r,o){var i=qm(n);return st.from(i[r]).map(function(t){return Ym(n,0,0,t),o.each(function(t){Xm(n,0,function(t,n){var e,o;o=n,wr(e=t,r).fold(function(){Or(e,o)},function(t){Sr(t,o)})},t)}),t})},Jm=$a({fields:[],name:"replacing",apis:/* */Object.freeze({__proto__:null,append:function(t,n,e,o){Xm(t,0,Or,o)},prepend:function(t,n,e,o){Xm(t,0,Cr,o)},remove:Ym,replaceAt:Km,replaceBy:function(n,t,e,o,r){var i=qm(n);return j(i,o).bind(function(t){return Km(n,0,0,t,r)})},set:function(n,t,e,o){cc(function(){var t=V(o,n.getSystem().build);Ws(n,t)},n.element())},contents:qm})}),$m=function(t,n){var e,o;return{key:t,value:{config:{},me:(e=t,o=qo(n),$a({fields:[Nn("enabled")],name:e,active:{events:at(o)}})),configAsRaw:at({}),initialConfig:{},state:ui}}},Qm=function(t,n){n.ignore||(ic(t.element()),n.onFocus(t))},Zm=/* */Object.freeze({__proto__:null,focus:Qm,blur:function(t,n){n.ignore||t.element().dom().blur()},isFocused:function(t){return n=t.element(),e=Ai(n).dom(),n.dom()===e.activeElement;var n,e}}),tg=/* */Object.freeze({__proto__:null,exhibit:function(t,n){var e=n.ignore?{}:{attributes:{tabindex:"-1"}};return si(e)},events:function(e){return qo([$o(vo(),function(t,n){Qm(t,e),n.stop()})].concat(e.stopMousedown?[$o(no(),function(t,n){n.event().prevent()})]:[]))}}),ng=[aa("onFocus"),te("stopMousedown",!1),te("ignore",!1)],eg=$a({fields:ng,name:"focusing",active:tg,apis:Zm}),og=function(t,n,e){var o=n.aria;o.update(t,o,e.get())},rg=function(n,t,e){t.toggleClass.each(function(t){(e.get()?Si:Ci)(n.element(),t)})},ig=function(t,n,e){cg(t,n,e,!e.get())},ug=function(t,n,e){e.set(!0),rg(t,n,e),og(t,n,e)},ag=function(t,n,e){e.set(!1),rg(t,n,e),og(t,n,e)},cg=function(t,n,e,o){(o?ug:ag)(t,n,e)},sg=function(t,n,e){cg(t,n,e,n.selected)},fg=/* */Object.freeze({__proto__:null,onLoad:sg,toggle:ig,isOn:function(t,n,e){return e.get()},on:ug,off:ag,set:cg}),lg=/* */Object.freeze({__proto__:null,exhibit:function(){return si({})},events:function(t,n){var e,o,r,i=(e=t,o=n,r=ig,ar(function(t){r(t,e,o)})),u=Wa(t,n,sg);return qo(it([t.toggleOnExecute?[i]:[],[u]]))}}),dg=function(t,n,e){Fr(t.element(),"aria-expanded",e)},mg=[te("selected",!1),qn("toggleClass"),te("toggleOnExecute",!0),ne("aria",{mode:"none"},Dn("mode",{pressed:[te("syncWithExpanded",!1),la("update",function(t,n,e){Fr(t.element(),"aria-pressed",e),n.syncWithExpanded&&dg(t,n,e)})],checked:[la("update",function(t,n,e){Fr(t.element(),"aria-checked",e)})],expanded:[la("update",dg)],selected:[la("update",function(t,n,e){Fr(t.element(),"aria-selected",e)})],none:[la("update",Z)]}))],gg=$a({fields:mg,name:"toggling",active:lg,apis:fg,state:(yd=!1,{init:function(){var n=se(yd);return{get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(yd)},readState:function(){return n.get()}}}})}),pg=function(){var t=function(t,n){n.stop(),Wo(t)};return[$o(mo(),t),$o(ko(),t),er($e()),er(no())]},hg=function(t){return qo(it([t.map(function(e){return ar(function(t,n){e(t),n.stop()})}).toArray(),pg()]))},vg="alloy.item-hover",bg="alloy.item-focus",yg=function(t){(ac(t.element()).isNone()||eg.isFocused(t))&&(eg.isFocused(t)||eg.focus(t),Uo(t,vg,{item:t}))},xg=function(t){Uo(t,bg,{item:t})},wg=at(vg),Sg=at(bg),kg=[Nn("data"),Nn("components"),Nn("dom"),te("hasSubmenu",!1),qn("toggling"),Ff("itemBehaviours",[gg,eg,Gm,Bf]),te("ignoreFocus",!1),te("domModification",{}),la("builder",function(t){return{dom:t.dom,domModification:et(et({},t.domModification),{attributes:et(et(et({role:t.toggling.isSome()?"menuitemcheckbox":"menuitem"},t.domModification.attributes),{"aria-haspopup":t.hasSubmenu}),t.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:If(t.itemBehaviours,[t.toggling.fold(gg.revoke,function(t){return gg.config(et({aria:{mode:"checked"}},t))}),eg.config({ignore:t.ignoreFocus,stopMousedown:t.ignoreFocus,onFocus:function(t){xg(t)}}),Gm.config({mode:"execution"}),Bf.config({store:{mode:"memory",initialValue:t.data}}),$m("item-type-events",b(pg(),[$o(io(),yg),$o(So(),eg.focus)]))]),components:t.components,eventOrder:t.eventOrder}}),te("eventOrder",{})],Cg=[Nn("dom"),Nn("components"),la("builder",function(t){return{dom:t.dom,components:t.components,events:qo([(n=So(),$o(n,function(t,n){n.stop()}))])};var n})],Og=function(){return"item-widget"},_g=at([il({name:"widget",overrides:function(n){return{behaviours:Ka([Bf.config({store:{mode:"manual",getValue:function(t){return n.data},setValue:function(){}}})])}}})]),Tg=[Nn("uid"),Nn("data"),Nn("components"),Nn("dom"),te("autofocus",!1),te("ignoreFocus",!1),Ff("widgetBehaviours",[Bf,eg,Gm]),te("domModification",{}),_l(_g()),la("builder",function(e){var t=vl(Og(),e,_g()),n=bl(Og(),e,t.internals()),o=function(t){return yl(t,e,"widget").map(function(t){return Gm.focusIn(t),t})},r=function(t,n){return Hl(n.event().target())||e.autofocus&&n.setSource(t.element()),st.none()};return{dom:e.dom,components:n,domModification:e.domModification,events:qo([ar(function(t,n){o(t).each(function(t){n.stop()})}),$o(io(),yg),$o(So(),function(t,n){e.autofocus?o(t):eg.focus(t)})]),behaviours:If(e.widgetBehaviours,[Bf.config({store:{mode:"memory",initialValue:e.data}}),eg.config({ignore:e.ignoreFocus,onFocus:function(t){xg(t)}}),Gm.config({mode:"special",focusIn:e.autofocus?function(t){o(t)}:tc(),onLeft:r,onRight:r,onEscape:function(t,n){return eg.isFocused(t)||e.autofocus?(e.autofocus&&n.setSource(t.element()),st.none()):(eg.focus(t),st.some(!0))}})])}})],Eg=Dn("type",{widget:Tg,item:kg,separator:Cg}),Bg=at([cl({factory:{sketch:function(t){var n=Tn("menu.spec item",Eg,t);return n.builder(n)}},name:"items",unit:"item",defaults:function(t,n){return n.hasOwnProperty("uid")?n:et(et({},n),{uid:$r("item")})},overrides:function(t,n){return{type:n.type,ignoreFocus:t.fakeFocus,domModification:{classes:[t.markers.item]}}}})]),Dg=at([Nn("value"),Nn("items"),Nn("dom"),Nn("components"),te("eventOrder",{}),Df("menuBehaviours",[Ql,Bf,Ll,Gm]),ne("movement",{mode:"menu",moveOnTab:!0},Dn("mode",{grid:[ma(),la("config",function(t,n){return{mode:"flatgrid",selector:"."+t.markers.item,initSize:{numColumns:n.initSize.numColumns,numRows:n.initSize.numRows},focusManager:t.focusManager}})],matrix:[la("config",function(t,n){return{mode:"matrix",selectors:{row:n.rowSelector,cell:"."+t.markers.item},focusManager:t.focusManager}}),Nn("rowSelector")],menu:[te("moveOnTab",!0),la("config",function(t,n){return{mode:"menu",selector:"."+t.markers.item,moveOnTab:n.moveOnTab,focusManager:t.focusManager}})]})),Ln("markers",ea()),te("fakeFocus",!1),te("focusManager",vd()),aa("onHighlight")]),Mg=at("alloy.menu-focus"),Ag=Vl({name:"Menu",configFields:Dg(),partFields:Bg(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:Af(t.menuBehaviours,[Ql.config({highlightClass:t.markers.selectedItem,itemClass:t.markers.item,onHighlight:t.onHighlight}),Bf.config({store:{mode:"memory",initialValue:t.value}}),Ll.config({find:st.some}),Gm.config(t.movement.config(t,t.movement))]),events:qo([$o(Sg(),function(n,e){var t=e.event();n.getSystem().getByDom(t.target()).each(function(t){Ql.highlight(n,t),e.stop(),Uo(n,Mg(),{menu:n,item:t})})}),$o(wg(),function(t,n){var e=n.event().item();Ql.highlight(t,e)})]),components:n,eventOrder:t.eventOrder,domModification:{attributes:{role:"menu"}}}}}),Fg=function(e,o,r,t){return Ft(r,t).bind(function(t){return Ft(e,t).bind(function(t){var n=Fg(e,o,r,t);return st.some([t].concat(n))})}).getOr([])},Ig=function(t,n){var e={};_t(t,function(t,n){rt(t,function(t){e[t]=n})});var o=n,r=Et(n,function(t,n){return{k:t,v:n}}),i=Tt(r,function(t,n){return[n].concat(Fg(e,o,r,n))});return Tt(e,function(t){return Ft(i,t).getOr([t])})},Rg=function(t){return"prepared"===t.type?st.some(t.menu):st.none()},Vg={init:function(){var i=se({}),u=se({}),a=se({}),c=se(st.none()),s=se({}),r=function(t,o,r){return e(t).bind(function(n){return e=t,Mt(i.get(),function(t,n){return t===e}).bind(function(t){return o(t).map(function(t){return{triggeredMenu:n,triggeringItem:t,triggeringPath:r}})});var e})},e=function(t){return n(t).bind(Rg)},n=function(t){return Ft(u.get(),t)},f=function(t){return Ft(i.get(),t)};return{setMenuBuilt:function(t,n){var e;u.set(et(et({},u.get()),((e={})[t]={type:"prepared",menu:n},e)))},setContents:function(t,n,e,o){c.set(st.some(t)),i.set(e),u.set(n),s.set(o);var r=Ig(o,e);a.set(r)},expand:function(e){return Ft(i.get(),e).map(function(t){var n=Ft(a.get(),e).getOr([]);return[t].concat(n)})},refresh:function(t){return Ft(a.get(),t)},collapse:function(t){return Ft(a.get(),t).bind(function(t){return 1<t.length?st.some(t.slice(1)):st.none()})},lookupMenu:n,lookupItem:f,otherMenus:function(t){var n=s.get();return X(Ct(n),t)},getPrimary:function(){return c.get().bind(e)},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(st.none())},isClear:function(){return c.get().isNone()},getTriggeringPath:function(t,o){var n=H(f(t).toArray(),function(t){return e(t).isSome()});return Ft(a.get(),t).bind(function(t){var e=G(n.concat(t));return function(t){for(var n=[],e=0;e<t.length;e++){var o=t[e];if(!o.isSome())return st.none();n.push(o.getOrDie())}return st.some(n)}(U(e,function(t,n){return r(t,o,e.slice(0,n+1)).fold(function(){return c.get().is(t)?[]:[st.none()]},function(t){return[st.some(t)]})}))})}}},extractPreparedMenu:Rg},Pg=at("collapse-item"),Hg=Rl({name:"TieredMenu",configFields:[fa("onExecute"),fa("onEscape"),sa("onOpenMenu"),sa("onOpenSubmenu"),aa("onRepositionMenu"),aa("onCollapseMenu"),te("highlightImmediately",!0),Gn("data",[Nn("primary"),Nn("menus"),Nn("expansions")]),te("fakeFocus",!1),aa("onHighlight"),aa("onHover"),ra(),Nn("dom"),te("navigateOnHover",!0),te("stayInDom",!1),Df("tmenuBehaviours",[Gm,Ql,Ll,Jm]),te("eventOrder",{})],apis:{collapseMenu:function(t,n){t.collapseMenu(n)},highlightPrimary:function(t,n){t.highlightPrimary(n)},repositionMenus:function(t,n){t.repositionMenus(n)}},factory:function(a,t){var c,n,i=se(st.none()),s=Vg.init(),e=function(t){var o,r,n,e=(o=t,r=a.data.primary,n=a.data.menus,Tt(n,function(t,n){var e=function(){return Ag.sketch(et(et({},t),{value:n,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:(a.fakeFocus?bd:vd)()}))};return n===r?{type:"prepared",menu:o.getSystem().build(e())}:{type:"notbuilt",nbMenu:e}})),i=u();return s.setContents(a.data.primary,e,a.data.expansions,i),s.getPrimary()},f=function(t){return Bf.getValue(t).value},u=function(t){return Tt(a.data.menus,function(t,n){return U(t.items,function(t){return"separator"===t.type?[]:[t.data.value]})})},l=function(n,t){Ql.highlight(n,t),Ql.getHighlighted(t).orThunk(function(){return Ql.getFirst(t)}).each(function(t){Go(n,t.element(),So())})},d=function(n,t){return Pl(V(t,function(t){return n.lookupMenu(t).bind(function(t){return"prepared"===t.type?st.some(t.menu):st.none()})}))},m=function(n,t,e){var o=d(t,t.otherMenus(e));rt(o,function(t){Ti(t.element(),[a.markers.backgroundMenu]),a.stayInDom||Jm.remove(n,t)})},g=function(t,o){var r,n=(r=t,i.get().getOrThunk(function(){var e={},t=os(r.element(),"."+a.markers.item),n=H(t,function(t){return"true"===Ir(t,"aria-haspopup")});return rt(n,function(t){r.getSystem().getByDom(t).each(function(t){var n=f(t);e[n]=t})}),i.set(st.some(e)),e}));_t(n,function(t,n){var e=A(o,n);Fr(t.element(),"aria-expanded",e)})},p=function(o,r,i){return st.from(i[0]).bind(function(t){return r.lookupMenu(t).bind(function(t){if("notbuilt"===t.type)return st.none();var n=t.menu,e=d(r,i.slice(1));return rt(e,function(t){Si(t.element(),a.markers.backgroundMenu)}),Ri(n.element())||Jm.append(o,au(n)),Ti(n.element(),[a.markers.backgroundMenu]),l(o,n),m(o,r,i),st.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),st.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 Ri(n.element())||Jm.append(r,au(n)),a.onOpenSubmenu(r,i,n,G(o)),u===c.HighlightSubmenu?(Ql.highlightFirst(n),p(r,s,o)):(Ql.dehighlightAll(n),st.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 ju(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=qo([$o(Mg(),function(e,o){var t=o.event().item();s.lookupItem(f(t)).each(function(){var t=o.event().menu();Ql.highlight(e,t);var n=f(o.event().item());s.refresh(n).each(function(t){return m(e,s,t)})})}),ar(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(){})})}),rr(function(n,t){e(n).each(function(t){Jm.append(n,au(t)),a.onOpenMenu(n,t),a.highlightImmediately&&l(n,t)})})].concat(a.navigateOnHover?[$o(wg(),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=function(t){return Ql.getHighlighted(t).bind(Ql.getHighlighted)},y={collapseMenu:function(n){b(n).each(function(t){o(n,t)})},highlightPrimary:function(n){s.getPrimary().each(function(t){l(n,t)})},repositionMenus:function(o){s.getPrimary().bind(function(n){return b(o).bind(function(t){var n=f(t),e=At(s.getMenus()),o=Pl(V(e,Vg.extractPreparedMenu));return s.getTriggeringPath(n,function(t){return e=t,$(o,function(t){if(!t.getSystem().isConnected())return st.none();var n=Ql.getCandidates(t);return L(n,function(t){return f(t)===e})});var e})}).map(function(t){return{primary:n,triggeringPath:t}})}).fold(function(){var t;t=o,st.from(t.components()[0]).filter(function(t){return"menu"===Ir(t.element(),"role")}).each(function(t){a.onRepositionMenu(o,t,[])})},function(t){var n=t.primary,e=t.triggeringPath;a.onRepositionMenu(o,n,e)})}};return{uid:a.uid,dom:a.dom,markers:a.markers,behaviours:Af(a.tmenuBehaviours,[Gm.config({mode:"special",onRight:r(function(t,n){return Hl(n.element())?st.none():h(t,n,c.HighlightSubmenu)}),onLeft:r(function(t,n){return Hl(n.element())?st.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){Go(n,t.element(),So())})}}),Ql.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),Ll.config({find:function(t){return Ql.getHighlighted(t)}}),Jm.config({})]),eventOrder:a.eventOrder,apis:y,events:v}},extraApis:{tieredData:function(t,n,e){return{primary:t,menus:n,expansions:e}},singleData:function(t,n){return{primary:t,menus:Jt(t,n),expansions:{}}},collapseItem:function(t){return{value:Wr(Pg()),meta:{text:t}}}}}),zg=Rl({name:"InlineView",configFields:[Nn("lazySink"),aa("onShow"),aa("onHide"),Qn("onEscape"),Df("inlineBehaviours",[sf,Bf,oc]),Zn("fireDismissalEventInstead",[te("event",Io())]),Zn("fireRepositionEventInstead",[te("event",Ro())]),te("getRelated",st.none),te("isExtraPart",c),te("eventOrder",st.none)],factory:function(m,t){var o=function(t,n,e,o){r(t,n,e,function(){return o.map(function(t){return Mu(t)})})},r=function(t,n,e,o){var r=m.lazySink(t).getOrDie();sf.openWhileCloaked(t,e,function(){return Ns.positionWithinBounds(r,n,t,o())}),Bf.setValue(t,st.some({mode:"position",anchor:n,getBounds:o}))},i=function(t,n,e,o){var r,i,u,a,c,s,f,l,d=(r=m,i=t,u=n,c=o,s=function(){return r.lazySink(i)},f="horizontal"===(a=e).type?{layouts:{onLtr:function(){return ja()},onRtl:function(){return Ua()}}}:{},l=function(t){return 2===t.length?f:{}},Hg.sketch({dom:{tag:"div"},data:a.data,markers:a.menu.markers,highlightImmediately:a.menu.highlightImmediately,onEscape:function(){return sf.close(i),r.onEscape.map(function(t){return t(i)}),st.some(!0)},onExecute:function(){return st.some(!0)},onOpenMenu:function(t,n){Ns.positionWithinBounds(s().getOrDie(),u,n,c())},onOpenSubmenu:function(t,n,e,o){var r=s().getOrDie();Ns.position(r,et({anchor:"submenu",item:n},l(o)),e)},onRepositionMenu:function(t,n,e){var o=s().getOrDie();Ns.positionWithinBounds(o,u,n,c()),rt(e,function(t){var n=l(t.triggeringPath);Ns.position(o,et({anchor:"submenu",item:t.triggeringItem},n),t.triggeredMenu)})}}));sf.open(t,d),Bf.setValue(t,st.some({mode:"menu",menu:d}))},n=function(e){sf.isOpen(e)&&Bf.getValue(e).each(function(t){switch(t.mode){case"menu":sf.getState(e).each(function(t){Hg.repositionMenus(t)});break;case"position":var n=m.lazySink(e).getOrDie();Ns.positionWithinBounds(n,t.anchor,e,t.getBounds())}})},e={setContent:function(t,n){sf.setContent(t,n)},showAt:function(t,n,e){o(t,n,e,st.none())},showWithin:o,showWithinBounds:r,showMenuAt:function(t,n,e){i(t,n,e,function(){return st.none()})},showMenuWithinBounds:i,hide:function(t){sf.isOpen(t)&&(Bf.setValue(t,st.none()),sf.close(t))},getContent:function(t){return sf.getState(t)},reposition:n,isOpen:sf.isOpen};return{uid:m.uid,dom:m.dom,behaviours:Af(m.inlineBehaviours,[sf.config({isPartOf:function(t,n,e){return Gu(n,e)||(o=t,r=e,m.getRelated(o).exists(function(t){return Gu(t,r)}));var o,r},getAttachPoint:function(t){return m.lazySink(t).getOrDie()},onOpen:function(t){m.onShow(t)},onClose:function(t){m.onHide(t)}}),Bf.config({store:{mode:"memory",initialValue:st.none()}}),oc.config({channels:et(et({},gf(et({isExtraPart:t.isExtraPart},m.fireDismissalEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})))),hf(et(et({},m.fireRepositionEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})),{doReposition:n})))})]),eventOrder:m.eventOrder,apis:e}},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)},showWithinBounds:function(t,n,e,o,r){t.showWithinBounds(n,e,o,r)},showMenuAt:function(t,n,e,o){t.showMenuAt(n,e,o)},showMenuWithinBounds:function(t,n,e,o,r){t.showMenuWithinBounds(n,e,o,r)},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)},reposition:function(t,n){t.reposition(n)}}}),Ng=function(t){return t.x},Lg=function(t,n){return t.x+t.width/2-n.width/2},jg=function(t,n){return t.x+t.width-n.width},Ug=function(t){return t.y},Wg=function(t,n){return t.y+t.height-n.height},Gg=function(t,n,e){return ga(jg(t,n),Wg(t,n),e.innerSoutheast(),ya(),Ca(t,{right:0,bottom:3}),"layout-inner-se")},Xg=function(t,n,e){return ga(Ng(t),Wg(t,n),e.innerSouthwest(),ba(),Ca(t,{left:1,bottom:3}),"layout-inner-sw")},Yg=function(t,n,e){return ga(jg(t,n),Ug(t),e.innerNortheast(),va(),Ca(t,{right:0,top:2}),"layout-inner-ne")},qg=function(t,n,e){return ga(Ng(t),Ug(t),e.innerNorthwest(),ha(),Ca(t,{left:1,top:2}),"layout-inner-nw")},Kg=function(t,n,e){return ga(Lg(t,n),Ug(t),e.innerNorth(),xa(),Ca(t,{top:2}),"layout-inner-n")},Jg=function(t,n,e){return ga(Lg(t,n),Wg(t,n),e.innerSouth(),wa(),Ca(t,{bottom:3}),"layout-inner-s")},$g=tinymce.util.Tools.resolve("tinymce.util.Delay"),Qg=Rl({name:"Button",factory:function(t){var n=hg(t.action),e=t.dom.tag,o=function(n){return Ft(t.dom,"attributes").bind(function(t){return Ft(t,n)})};return{uid:t.uid,dom:t.dom,components:t.components,events:n,behaviours:If(t.buttonBehaviours,[eg.config({}),Gm.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 et({type:t},n)}()},eventOrder:t.eventOrder}},configFields:[te("uid",undefined),Nn("dom"),te("components",[]),Ff("buttonBehaviours",[eg,Gm]),qn("action"),qn("role"),te("eventOrder",{})]}),Zg=function(t){var n=function e(t){return t.uid!==undefined}(t)&&Rt(t,"uid")?t.uid:$r("memento");return{get:function(t){return t.getSystem().getByUid(n).getOrDie()},getOpt:function(t){return t.getSystem().getByUid(n).toOption()},asSpec:function(){return et(et({},t),{uid:n})}}},tp=function(t){return st.from(t()["temporary-placeholder"]).getOr("!not found!")},np=function(t,n){return st.from(n()[t.toLowerCase()]).getOrThunk(function(){return tp(n)})},ep={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},op=Rl({name:"Notification",factory:function(n){var t,e,o=Zg({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:Ka([Jm.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=Zg({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:Ka([Jm.config({})])}),a={updateProgress:function(t,n){t.getSystem().isConnected()&&u.getOpt(t).each(function(t){Jm.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);Jm.set(e,[ou(n)])}}},c=it([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return st.from(ep[t])}).toArray()]),s=Zg(Qg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:np("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),f=[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:(t=c,e=n.iconProvider,$(t,function(t){return st.from(e()[t.toLowerCase()])}).getOrThunk(function(){return tp(e)}))}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:Ka([Jm.config({})])}];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"])},behaviours:Ka([eg.config({}),$m("notification-events",[$o(uo(),function(t){s.getOpt(t).each(eg.focus)})])]),components:f.concat(n.progress?[u.asSpec()]:[]).concat(n.closeButton?[s.asSpec()]:[]),apis:a}},configFields:[qn("level"),Nn("progress"),Nn("icon"),Nn("onAction"),Nn("text"),Nn("iconProvider"),Nn("translationProvider"),ie("closeButton",!0)],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}});function rp(t,u,a){var c=u.backstage;return{open:function(t,n){var e=!t.closeButton&&t.timeout&&(0<t.timeout||t.timeout<0),o=function(){n(),zg.hide(i)},r=uu(op.sketch({text:t.text,level:A(["success","error","warning","warn","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:st.from(t.icon),closeButton:!e,onAction:o,iconProvider:c.shared.providers.icons,translationProvider:c.shared.providers.translate})),i=uu(zg.sketch(et({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:u.backstage.shared.getSink,fireDismissalEventInstead:{}},c.shared.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}})));return a.add(i),0<t.timeout&&$g.setTimeout(function(){o()},t.timeout),{close:o,moveTo:function(t,n){zg.showAt(i,{anchor:"makeshift",x:t,y:n},au(r))},moveRel:function(t,n){if("banner"!==n){var e=function(t){switch(t){case"bc-bc":return Jg;case"tc-tc":return Kg;case"tc-bc":return Ra;case"bc-tc":default:return Va}}(n),o={anchor:"node",root:Vi(),node:st.some(le.fromDom(t)),layouts:{onRtl:function(){return[e]},onLtr:function(){return[e]}}};zg.showAt(i,o,au(r))}else zg.showAt(i,u.backstage.shared.anchors.banner(),au(r))},text:function(t){op.updateText(r,t)},settings:t,getEl:function(){return r.element().dom()},progressBar:{value:function(t){op.updateProgress(r,t)}}}},close:function(t){t.close()},reposition:function(t){var e;rt(t,function(t){return t.moveTo(0,0)}),0<(e=t).length&&(q(e).each(function(t){return t.moveRel(null,"banner")}),rt(e,function(t,n){0<n&&t.moveRel(e[n-1].getEl(),"bc-tc")}))},getArgs:function(t){return t.settings}}}var ip,up,ap=function(e,o){var r=null;return{cancel:function(){null!==r&&(nt.clearTimeout(r),r=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null!==r&&nt.clearTimeout(r),r=nt.setTimeout(function(){e.apply(null,t),r=null},o)}}},cp=tinymce.util.Tools.resolve("tinymce.dom.TextSeeker"),sp=function(o,t,n,e,r){var i=cp(o,function(t){return e=t,(n=o).isBlock(e)||A(["BR","IMG","HR","INPUT"],e.nodeName)||"false"===n.getContentEditable(e);var n,e});return st.from(i.backwards(t,n,e,r))},fp=function(e,n){return lp(le.fromDom(e.selection.getNode())).getOrThunk(function(){var t=le.fromHtml('<span data-mce-autocompleter="1" data-mce-bogus="1"></span>',e.getDoc());return Or(t,le.fromDom(n.extractContents())),n.insertNode(t.dom()),br(t).each(function(t){return t.dom().normalize()}),es(t,ns).map(function(t){var n;e.selection.setCursorLocation(t.dom(),"img"===cr(n=t)?1:Zc(n).fold(function(){return xr(n).length},function(t){return t.length}))}),t})},lp=function(t){return ju(t,"[data-mce-autocompleter]")},dp=function(t){return t.toString().replace(/\u00A0/g," ").replace(/\uFEFF/g,"")},mp=function(t){return""!==t&&-1!==" \xa0\f\n\r\t\x0B".indexOf(t)},gp=function(t,n){return t.substring(n.length)},pp=function(t,o,r,i){if(void 0===i&&(i=0),!(n=o).collapsed||3!==n.startContainer.nodeType)return st.none();var n,e=t.getParent(o.startContainer,t.isBlock)||t.getRoot();return sp(t,o.startContainer,o.startOffset,function(t,n,e){return function(t,n,e){var o;for(o=n-1;0<=o;o--){var r=t.charAt(o);if(mp(r))return st.none();if(r===e)break}return st.some(o)}(e,n,r).getOr(n)},e).bind(function(t){var n=o.cloneRange();if(n.setStart(t.container,t.offset),n.setEnd(o.endContainer,o.endOffset),n.collapsed)return st.none();var e=dp(n);return 0!==e.lastIndexOf(r)||gp(e,r).length<i?st.none():st.some({text:gp(e,r),range:n,triggerChar:r})})},hp=function(o,t,r,n){return void 0===n&&(n=0),lp(le.fromDom(t.startContainer)).fold(function(){return pp(o,t,r,n)},function(t){var n=o.createRng();n.selectNode(t.dom());var e=dp(n);return st.some({range:n,text:gp(e,r),triggerChar:r})})},vp=function(e,t){t.on("keypress compositionend",e.onKeypress.throttle),t.on("remove",e.onKeypress.cancel);var o=function(t,n){Uo(t,co(),{raw:n})};t.on("keydown",function(n){var t=function(){return e.getView().bind(Ql.getHighlighted)};8===n.which&&e.onKeypress.throttle(n),e.isActive()&&(27===n.which&&e.cancelIfNecessary(),e.isMenuOpen()?13===n.which?(t().each(Wo),n.preventDefault()):40===n.which?(t().fold(function(){e.getView().each(Ql.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()&&!e.isProcessingAction()&&lp(le.fromDom(t.element)).isNone()&&e.cancelIfNecessary()})},bp=tinymce.util.Tools.resolve("tinymce.util.Promise"),yp=function(t,n){return{container:t,offset:n}},xp=function(t){if(t.nodeType===nt.Node.TEXT_NODE)return yp(t,t.data.length);var n=t.childNodes;return 0<n.length?xp(n[n.length-1]):yp(t,n.length)},wp=function(t,n){var e=t.childNodes;return 0<e.length&&n<e.length?wp(e[n],0):0<e.length&&t.nodeType===nt.Node.ELEMENT_NODE&&e.length===n?xp(e[e.length-1]):yp(t,n)},Sp=function(r){return function(t){var n,e,o=wp(t.startContainer,t.startOffset);return!sp(n=r,(e=o).container,e.offset,function(t,n){return 0===n?-1:n},n.getRoot()).filter(function(t){var n=t.container.data.charAt(t.offset-1);return!mp(n)}).isSome()}},kp=function(n,e){var o,r,t=e(),i=n.selection.getRng();return o=n.dom,r=i,$(t.triggerChars,function(t){return hp(o,r,t)}).bind(function(t){return Cp(n,e,t)})},Cp=function(n,t,e,o){void 0===o&&(o={});var r=t(),i=n.selection.getRng().startContainer.nodeValue,u=H(r.lookupByChar(e.triggerChar),function(t){return e.text.length>=t.minChars&&t.matches.getOrThunk(function(){return Sp(n.dom)})(e.range,i,e.text)});if(0===u.length)return st.none();var a=bp.all(V(u,function(n){return n.fetch(e.text,n.maxResults,o).then(function(t){return{matchText:e.text,items:t,columns:n.columns,onAction:n.onAction}})}));return st.some({lookupData:a,context:e})},Op=ln([jn("type"),$n("text")]),_p=ln([ce("type",function(){return"autocompleteitem"}),ce("active",function(){return!1}),ce("disabled",function(){return!1}),te("meta",{}),jn("value"),$n("text"),$n("icon")]),Tp=ln([jn("type"),jn("ch"),ee("minChars",1),te("columns",1),ee("maxResults",10),Qn("matches"),Wn("fetch"),Wn("onAction")]),Ep=function(t){var n,e,o=t.ui.registry.getAll().popups,r=Tt(o,function(t){return On("Autocompleter",Tp,t).fold(function(t){throw new Error(En(t))},function(t){return t})}),i=(n=Dt(r,function(t){return t.ch}),e={},rt(n,function(t){e[t]={}}),Ct(e)),u=At(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return H(u,function(t){return t.ch===n})}}};(up=ip=ip||{})[up.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",up[up.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var Bp,Dp,Mp=ip,Ap="tox-menu-nav__js",Fp="tox-collection__item",Ip="tox-swatch",Rp={normal:Ap,color:Ip},Vp="tox-collection__item--enabled",Pp="tox-collection__item-label",Hp="tox-collection__item-caret",zp="tox-collection__item--active",Np=function(t){return Ft(Rp,t).getOr(Ap)},Lp=function(t){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:"color"===t?"tox-swatches":"tox-menu",tieredMenu:"tox-tiered-menu"}},jp=function(t){var n=Lp(t);return{backgroundMenu:n.backgroundMenu,selectedMenu:n.selectedMenu,menu:n.menu,selectedItem:n.selectedItem,item:Np(t)}},Up=[Ag.parts().items({})],Wp=function(t,n,e){var o=Lp(e);return{dom:{tag:"div",classes:it([[o.tieredMenu]])},markers:jp(e)}},Gp=function(e,o){return function(t){var n=R(t,o);return V(n,function(t){return{dom:e,components:t}})}},Xp=function(t,e){var o=[],r=[];return rt(t,function(t,n){e(t,n)?(0<r.length&&o.push(r),r=[],It(t.dom,"innerHtml")&&r.push(t)):r.push(t)}),0<r.length&&o.push(r),V(o,function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}})},Yp=function(n,e,t){return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===n?["tox-collection--list"]:["tox-collection--grid"])},components:[Ag.parts().items({preprocess:function(t){return"auto"!==n&&1<n?Gp({tag:"div",classes:["tox-collection__group"]},n)(t):Xp(t,function(t,n){return"separator"===e[n].type})}})]}},qp=function(t){return F(t,function(t){return"icon"in t&&t.icon!==undefined})},Kp=function(t){return nt.console.error(En(t)),nt.console.log(t),st.none()},Jp=function(t,n,e,o,r){var i,u=(i=e,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[Ag.parts().items({preprocess:function(t){return Xp(t,function(t,n){return"separator"===i[n].type})}})]});return{value:t,dom:u.dom,components:u.components,items:e}},$p=function(t,n,e,o,r){var i,u,a,c,s,f;return"color"===r?{value:t,dom:(f=(i=o,{dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[Ag.parts().items({preprocess:"auto"!==i?Gp({tag:"div",classes:["tox-swatches__row"]},i):ct})]}]})).dom,components:f.components,items:e}:"normal"===r&&"auto"===o?{value:t,dom:(f=Yp(o,e)).dom,components:f.components,items:e}:"normal"===r&&1===o?{value:t,dom:(f=Yp(1,e)).dom,components:f.components,items:e}:"normal"===r?{value:t,dom:(f=Yp(o,e)).dom,components:f.components,items:e}:"listpreview"!==r||"auto"===o?{value:t,dom:(a=n,c=o,s=Lp(r),{tag:"div",classes:it([[s.menu,"tox-menu-"+c+"-column"],a?[s.hasIcons]:[]])}),components:Up,items:e}:{value:t,dom:(f=(u=o,{dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[Ag.parts().items({preprocess:Gp({tag:"div",classes:["tox-collection__group"]},u)})]})).dom,components:f.components,items:e}},Qp=[ie("disabled",!1),$n("text"),$n("shortcut"),vn("value","value",Xt(function(){return Wr("menuitem-value")}),Mn()),te("meta",{})],Zp=ln([jn("type"),ie("active",!1),$n("icon")].concat(Qp)),th=ln([jn("type"),Un("fancytype",["inserttable","colorswatch"]),ue("onAction",Z)]),nh=ln([jn("type"),ue("onSetup",function(){return Z}),ue("onAction",Z),$n("icon")].concat(Qp)),eh=ln([jn("type"),Wn("getSubmenuItems"),ue("onSetup",function(){return Z}),$n("icon")].concat(Qp)),oh=ln([jn("type"),$n("icon"),ie("active",!1),ue("onSetup",function(){return Z}),Wn("onAction")].concat(Qp)),rh=function(t,o,n){var r=os(t.element(),"."+n);if(0<r.length){var e=j(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 st.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return st.none()},ih=function(t,n){return Ka([$m(t,n)])},uh=function(t){return ih(Wr("unnamed-events"),t)},ah=[Nn("lazySink"),Nn("tooltipDom"),te("exclusive",!0),te("tooltipComponents",[]),te("delay",300),re("mode","normal",["normal","follow-highlight"]),te("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:at([Va,Ra,Ma,Fa,Aa,Ia]),onRtl:at([Va,Ra,Ma,Fa,Aa,Ia])}}}),aa("onHide"),aa("onShow")],ch=/* */Object.freeze({__proto__:null,init:function(){var e=se(st.none()),n=se(st.none()),o=function(){e.get().each(function(t){nt.clearTimeout(t)})},t=at("not-implemented");return ai({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(st.some(t))},clearTooltip:function(){n.set(st.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(st.some(nt.setTimeout(function(){t()},n)))},readState:t})}}),sh=Wr("tooltip.exclusive"),fh=Wr("tooltip.show"),lh=Wr("tooltip.hide"),dh=function(t,n,e){t.getSystem().broadcastOn([sh],{})},mh=/* */Object.freeze({__proto__:null,hideAllExclusive:dh,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&Jm.set(t,o)})}}),gh=$a({fields:ah,name:"tooltipping",active:/* */Object.freeze({__proto__:null,events:function(o,r){var e=function(n){r.getTooltip().each(function(t){qs(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return qo(it([[$o(fh,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){dh(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:qo("normal"===o.mode?[$o(io(),function(t){jo(n,fh)}),$o(oo(),function(t){jo(n,lh)})]:[]),behaviours:Ka([Jm.config({})])});r.setTooltip(e),Gs(t,e),o.onShow(n,e),Ns.position(t,o.anchor(n),e)}}(t)},o.delay)}),$o(lh,function(t){r.resetTimer(function(){e(t)},o.delay)}),$o(xo(),function(t,n){A(n.channels(),sh)&&e(t)}),ir(function(t){e(t)})],"normal"===o.mode?[$o(uo(),function(t){jo(t,fh)}),$o(bo(),function(t){jo(t,lh)}),$o(io(),function(t){jo(t,fh)}),$o(oo(),function(t){jo(t,lh)})]:[$o(No(),function(t,n){jo(t,fh)}),$o(Lo(),function(t){jo(t,lh)})]]))}}),state:ch,apis:mh}),ph=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),hh=tinymce.util.Tools.resolve("tinymce.util.I18n"),vh=["input","button","textarea","select"],bh=function(t,n,e){(n.disabled()?Ch:Oh)(t,n,e)},yh=function(t,n){return!0===n.useNative&&A(vh,cr(t.element()))},xh=function(t){Fr(t.element(),"disabled","disabled")},wh=function(t){Pr(t.element(),"disabled")},Sh=function(t){Fr(t.element(),"aria-disabled","true")},kh=function(t){Fr(t.element(),"aria-disabled","false")},Ch=function(n,t,e){t.disableClass.each(function(t){Si(n.element(),t)}),(yh(n,t)?xh:Sh)(n),t.onDisabled(n)},Oh=function(n,t,e){t.disableClass.each(function(t){Ci(n.element(),t)}),(yh(n,t)?wh:kh)(n),t.onEnabled(n)},_h=function(t,n){return yh(t,n)?Vr(t.element(),"disabled"):"true"===Ir(t.element(),"aria-disabled")},Th=/* */Object.freeze({__proto__:null,enable:Oh,disable:Ch,isDisabled:_h,onLoad:bh,set:function(t,n,e,o){(o?Ch:Oh)(t,n,e)}}),Eh=/* */Object.freeze({__proto__:null,exhibit:function(t,n){return si({classes:n.disabled()?n.disableClass.toArray():[]})},events:function(e,t){return qo([Ko(wo(),function(t,n){return _h(t,e)}),Wa(e,t,bh)])}}),Bh=[ue("disabled",c),te("useNative",!0),qn("disableClass"),aa("onDisabled"),aa("onEnabled")],Dh=$a({fields:Bh,name:"disabling",active:Eh,apis:Th}),Mh=tinymce.util.Tools.resolve("tinymce.EditorManager"),Ah=function(t){return t.getParam("height",Math.max(t.getElement().offsetHeight,200))},Fh=function(t){return t.getParam("width",ph.DOM.getStyle(t.getElement(),"width"))},Ih=function(t){return st.from(t.getParam("min_width")).filter(ot)},Rh=function(t){return st.from(t.getParam("min_height")).filter(ot)},Vh=function(t){return st.from(t.getParam("max_width")).filter(ot)},Ph=function(t){return st.from(t.getParam("max_height")).filter(ot)},Hh=function(t){return!1!==t.getParam("menubar",!0,"boolean")},zh=function(t){var n=t.getParam("toolbar",!0),e=!0===n,o=w(n),r=v(n)&&0<n.length;return!Lh(t)&&(r||o||e)},Nh=function(n){var t=I(9,function(t){return n.getParam("toolbar"+(t+1),!1,"string")}),e=H(t,function(t){return"string"==typeof t});return 0<e.length?st.some(e):st.none()},Lh=function(t){return Nh(t).fold(function(){return 0<t.getParam("toolbar",[],"string[]").length},function(){return!0})};(Dp=Bp=Bp||{})["default"]="wrap",Dp.floating="floating",Dp.sliding="sliding",Dp.scrolling="scrolling";var jh,Uh,Wh=function(t){return t.getParam("toolbar_mode","","string")};(Uh=jh=jh||{}).auto="auto",Uh.top="top",Uh.bottom="bottom";var Gh=function(t){return t.getParam("toolbar_location",jh.auto,"string")},Xh=function(t){return Gh(t)===jh.bottom},Yh=function(t){var n=t.getParam("fixed_toolbar_container","","string");return 0<n.length&&t.inline?Lu(Vi(),n):st.none()},qh=function(t){return t.inline&&Yh(t).isSome()},Kh=function(t){return t.inline&&!Hh(t)&&!zh(t)&&!Lh(t)},Jh=function(t){return(t.getParam("toolbar_sticky",!1,"boolean")||t.inline)&&!qh(t)&&!Kh(t)},$h="silver.readonly",Qh=ln([Ln("readonly",Rn)]),Zh=function(t,n){var e=t.outerContainer.element();n&&(t.mothership.broadcastOn([ff()],{target:e}),t.uiMothership.broadcastOn([ff()],{target:e})),t.mothership.broadcastOn([$h],{readonly:n}),t.uiMothership.broadcastOn([$h],{readonly:n})},tv=function(t,n){t.on("init",function(){t.mode.isReadOnly()&&Zh(n,!0)}),t.on("SwitchMode",function(){return Zh(n,t.mode.isReadOnly())}),t.getParam("readonly",!1,"boolean")&&t.setMode("readonly")},nv=function(){var t;return oc.config({channels:((t={})[$h]={schema:Qh,onReceive:function(t,n){Dh.set(t,n.readonly)}},t)})},ev=function(t){return Dh.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},ov=function(t){return Dh.config({disabled:t})},rv=function(t){return Dh.config({disabled:t,disableClass:"tox-tbtn--disabled"})},iv=function(t){return Dh.config({disabled:t,disableClass:"tox-tbtn--disabled",useNative:!1})},uv=function(t,n){var e=t.getApi(n);return function(t){t(e)}},av=function(e,o){return rr(function(t){uv(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},cv=function(n,e){return ir(function(t){return uv(n,t)(e.get())})},sv={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},fv=function(t){return U(t,function(t){return t.toArray()})},lv=function(t,n,e,o){var r,i,u=se(Z);return{type:"item",dom:n.dom,components:fv(n.optComponents),data:t.data,eventOrder:sv,hasSubmenu:t.triggersSubmenu,itemBehaviours:Ka([$m("item-events",[(r=t,i=e,ar(function(t,n){uv(r,t)(r.onAction),r.triggersSubmenu||i!==Mp.CLOSE_ON_EXECUTE||(jo(t,Oo()),n.stop())})),av(t,u),cv(t,u)]),ev(function(){return t.disabled||o.isReadOnly()}),nv(),Jm.config({})].concat(t.itemBehaviours))}},dv=function(t){return{value:t.value,meta:et({text:t.text.getOr("")},t.meta)}},mv=tinymce.util.Tools.resolve("tinymce.Env"),gv=function(t){return{dom:{tag:"div",classes:["tox-collection__item-icon"],innerHtml:t}}},pv=function(t){return{dom:{tag:"div",classes:[Pp]},components:[ou(hh.translate(t))]}},hv=function(t,n){return{dom:{tag:"div",classes:[Pp]},components:[{dom:{tag:t.tag,styles:t.styles},components:[ou(hh.translate(n))]}]}},vv=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:(n=t,e=mv.mac?{alt:"&#x2325;",ctrl:"&#x2303;",shift:"&#x21E7;",meta:"&#x2318;",access:"&#x2303;&#x2325;"}:{meta:"Ctrl",access:"Shift+Alt"},o=n.split("+"),r=V(o,function(t){var n=t.toLowerCase().trim();return It(e,n)?e[n]:t}),mv.mac?r.join(""):r.join("+"))}};var n,e,o,r},bv=function(t){return{dom:{tag:"div",classes:["tox-collection__item-checkmark"],innerHtml:np("checkmark",t)}}},yv=function(t,n,e,o,r){var i=e?n.or(st.some("")).map(gv):st.none(),u=t.checkMark,a=t.ariaLabel.map(function(t){return{attributes:{title:hh.translate(t)}}}).getOr({});return{dom:et({tag:"div",classes:[Ap,Fp].concat(r?["tox-collection__item-icon-rtl"]:[])},a),optComponents:[i,t.htmlContent.fold(function(){return t.textContent.map(o)},function(t){return st.some({dom:{tag:"div",classes:[Pp],innerHtml:t}})}),t.shortcutContent.map(vv),u,t.caret]}},xv=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],wv=["list-bull-circle","list-bull-default","list-bull-square"],Sv=function(t,r,n,i){void 0===i&&(i=st.none());var e,o,u,a,c,s=hh.isRtl()&&t.iconContent.exists(function(t){return A(wv,t)}),f=t.iconContent.map(function(t){return hh.isRtl()&&A(xv,t)?t+"-rtl":t}).map(function(t){return n=t,e=r.icons,o=i,st.from(e()[n.toLowerCase()]).or(o).getOrThunk(function(){return tp(e)});var n,e,o}),l=st.from(t.meta).fold(function(){return pv},function(t){return It(t,"style")?g(hv,t.style):pv});return"color"===t.presets?(e=t.ariaLabel,o=t.value,u=r,{dom:(a=f.getOr(""),c={tag:"div",attributes:e.map(function(t){return{title:u.translate(t)}}).getOr({}),classes:["tox-swatch"]},et(et({},c),"custom"===o?{tag:"button",classes:b(c.classes,["tox-swatches__picker-btn"]),innerHtml:a}:"remove"===o?{classes:b(c.classes,["tox-swatch--remove"]),innerHtml:a}:{attributes:et(et({},c.attributes),{"data-mce-color":o}),styles:{"background-color":o}})),optComponents:[]}):yv(t,f,n,l,s)},kv=function(t,n){var e,o=hh.translate(t),r=(e=o,ph.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},Cv=at(dl(Og(),_g())),Ov=Wr("cell-over"),_v=Wr("cell-execute"),Tv=function(n,e,t){var o,r=function(t){return Uo(t,_v,{row:n,col:e})},i=function(t,n){n.stop(),r(t)};return uu({dom:{tag:"div",attributes:((o={role:"button"})["aria-labelledby"]=t,o)},behaviours:Ka([$m("insert-table-picker-cell",[$o(io(),eg.focus),$o(wo(),r),$o(mo(),i),$o(ko(),i)]),gg.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),eg.config({onFocus:function(t){return Uo(t,Ov,{row:n,col:e})}})])})},Ev=function(t){return{value:t}},Bv=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Dv=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Mv=function(t){return Bv.test(t)||Dv.test(t)},Av=function(t){var n={value:t.value.replace(Bv,function(t,n,e,o){return n+n+e+e+o+o})},e=Dv.exec(n.value);return null===e?["FFFFFF","FF","FF","FF"]:e},Fv=function(t){var n=t.toString(16);return 1===n.length?"0"+n:n},Iv=function(t){var n=Fv(t.red)+Fv(t.green)+Fv(t.blue);return Ev(n)},Rv=Math.min,Vv=Math.max,Pv=Math.round,Hv=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,zv=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,Nv=function(t,n,e,o){return{red:t,green:n,blue:e,alpha:o}},Lv=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},jv=function(t){var n,e,o,r=(t.hue||0)%360,i=t.saturation/100,u=t.value/100;if(i=Vv(0,Rv(i,1)),u=Vv(0,Rv(u,1)),0===i)return n=e=o=Pv(255*u),Nv(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=Pv(255*(n+f)),e=Pv(255*(e+f)),o=Pv(255*(o+f)),Nv(n,e,o,1)},Uv=function(t){var n=Av(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return Nv(e,o,r,1)},Wv=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return Nv(r,i,u,a)},Gv=function(t){return"rgba("+t.red+","+t.green+","+t.blue+","+t.alpha+")"},Xv=Nv(255,0,0,1),Yv=function(t,n){return t.fire("ResizeContent",n)},qv=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),Kv="tinymce-custom-colors";var Jv="choiceitem",$v=[{type:Jv,text:"Light Green",value:"#BFEDD2"},{type:Jv,text:"Light Yellow",value:"#FBEEB8"},{type:Jv,text:"Light Red",value:"#F8CAC6"},{type:Jv,text:"Light Purple",value:"#ECCAFA"},{type:Jv,text:"Light Blue",value:"#C2E0F4"},{type:Jv,text:"Green",value:"#2DC26B"},{type:Jv,text:"Yellow",value:"#F1C40F"},{type:Jv,text:"Red",value:"#E03E2D"},{type:Jv,text:"Purple",value:"#B96AD9"},{type:Jv,text:"Blue",value:"#3598DB"},{type:Jv,text:"Dark Turquoise",value:"#169179"},{type:Jv,text:"Orange",value:"#E67E23"},{type:Jv,text:"Dark Red",value:"#BA372A"},{type:Jv,text:"Dark Purple",value:"#843FA1"},{type:Jv,text:"Dark Blue",value:"#236FA1"},{type:Jv,text:"Light Gray",value:"#ECF0F1"},{type:Jv,text:"Medium Gray",value:"#CED4D9"},{type:Jv,text:"Gray",value:"#95A5A6"},{type:Jv,text:"Dark Gray",value:"#7E8C8D"},{type:Jv,text:"Navy Blue",value:"#34495E"},{type:Jv,text:"Black",value:"#000000"},{type:Jv,text:"White",value:"#ffffff"}],Qv=function JF(e){void 0===e&&(e=10);var t,n=qv.getItem(Kv),o=w(n)?JSON.parse(n):[],r=e-(t=o).length<0?t.slice(0,e):t,i=function(t){r.splice(t,1)};return{add:function(t){var n;(-1===(n=M(r,t))?st.none():st.some(n)).each(i),r.unshift(t),r.length>e&&r.pop(),qv.setItem(Kv,JSON.stringify(r))},state:function(){return r.slice(0)}}}(10),Zv=function(t){return!1!==t.getParam("custom_colors")},tb=function(t){var n=t.getParam("color_map");return n!==undefined?function(t){var n=[],u=nt.document.createElement("canvas");u.height=1,u.width=1;for(var a=u.getContext("2d"),c=function(t,n){var e=n/255;return("0"+Math.round(t*e+255*(1-e)).toString(16)).slice(-2).toUpperCase()},e=function(t){if(/^[0-9A-Fa-f]{6}$/.test(t))return"#"+t.toUpperCase();a.clearRect(0,0,u.width,u.height),a.fillStyle="#FFFFFF",a.fillStyle=t,a.fillRect(0,0,1,1);var n=a.getImageData(0,0,1,1).data,e=n[0],o=n[1],r=n[2],i=n[3];return"#"+c(e,i)+c(o,i)+c(r,i)},o=0;o<t.length;o+=2)n.push({text:t[o+1],value:e(t[o]),type:"choiceitem"});return n}(n):$v},nb=function(t){Qv.add(t)},eb=function(i){i.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()})})},ob=function(t){var n,e,o=tb(t),r=(n=o.length,Math.max(5,Math.ceil(Math.sqrt(n))));return e=r,t.getParam("color_cols",e,"number")},rb=function(n,e,t,o){"custom"===t?fb(n)(function(t){t.each(function(t){nb(t),n.execCommand("mceApplyTextcolor",e,t),o(t)})},"#000000"):"remove"===t?(o(""),n.execCommand("mceRemoveTextcolor",e)):(o(t),n.execCommand("mceApplyTextcolor",e,t))},ib=function(t,n){return t.concat(V(Qv.state(),function(t){return{type:Jv,text:t,value:t}}).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},ub=function(n,e){return function(t){t(ib(n,e))}},ab=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)},cb=function(i,e,u,t,o){i.ui.registry.addSplitButton(e,{tooltip:t,presets:"color",icon:"forecolor"===e?"text-color":"highlight-bg-color",select:function(e){var t,o,r;return st.from((o=u,(t=i).dom.getParents(t.selection.getStart(),function(t){var n;(n=t.style["forecolor"===o?"color":"background-color"])&&(r=r||n)}),r)).bind(function(t){return function(t){if("transparent"===t)return st.some(Nv(0,0,0,0));var n=Hv.exec(t);if(null!==n)return st.some(Wv(n[1],n[2],n[3],"1"));var e=zv.exec(t);return null!==e?st.some(Wv(e[1],e[2],e[3],e[4])):st.none()}(t).map(function(t){var n=Iv(t).value;return Be(e.toLowerCase(),n)})}).getOr(!1)},columns:ob(i),fetch:ub(tb(i),Zv(i)),onAction:function(t){null!==o.get()&&rb(i,u,o.get(),function(){})},onItemAction:function(t,n){rb(i,u,n,function(t){var n;o.set(t),n={name:e,color:t},i.fire("TextColorChange",n)})},onSetup:function(n){null!==o.get()&&ab(n,e,o.get());var t=function(t){t.name===e&&ab(n,t.name,t.color)};return i.on("TextColorChange",t),function(){i.off("TextColorChange",t)}}})},sb=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){rb(n,e,t.value,Z)}}]}})},fb=function(i){return function(t,n){var e,o={colorpicker:n},r=(e=t,function(t){var n=t.getData();e(st.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(st.none())}})}},lb=function(t,n,e,o,r,i,u,a){var c=qp(n),s=db(n,e,o,"color"!==r?"normal":"color",i,u,a);return $p(t,c,s,o,r)},db=function(e,o,r,i,u,a,c){return Pl(V(e,function(n){return"choiceitem"===n.type?On("choicemenuitem",Zp,n).fold(Kp,function(t){return st.some(function(n,t,e,o,r,i,u,a){void 0===a&&(a=!0);var c=Sv({presets:e,textContent:t?n.text:st.none(),htmlContent:st.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:t?n.shortcut:st.none(),checkMark:t?st.some(bv(u.icons)):st.none(),caret:st.none(),value:n.value},u,a);return zt(lv({data:dv(n),disabled:n.disabled,getApi:function(n){return{setActive:function(t){gg.set(n,t)},isActive:function(){return gg.isOn(n)},isDisabled:function(){return Dh.isDisabled(n)},setDisabled:function(t){return Dh.set(n,t)}}},onAction:function(t){return o(n.value)},onSetup:function(t){return t.setActive(r),function(){}},triggersSubmenu:!1,itemBehaviours:[]},c,i,u),{toggling:{toggleClass:Vp,toggleOnExecute:!1,selected:n.active}})}(t,1===r,i,o,a(n.value),u,c,qp(e)))}):st.none()}))},mb=function(t,n){var e=jp(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")}};var gb,pb,hb={inserttable:function(o){var t=Wr("size-label"),i=function(t,n,e){for(var o=[],r=0;r<n;r++){for(var i=[],u=0;u<e;u++)i.push(Tv(r,u,t));o.push(i)}return o}(t,10,10),u=Zg({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:t}},components:[ou("0x0")],behaviours:Ka([Jm.config({})])});return{type:"widget",data:{value:Wr("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Cv().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:U(i,function(t){return V(t,au)}).concat(u.asSpec()),behaviours:Ka([$m("insert-table-picker",[nr(Ov,function(t,n,e){var o=e.event().row(),r=e.event().col();!function(t,n,e,o,r){for(var i=0;i<o;i++)for(var u=0;u<r;u++)gg.set(t[i][u],i<=n&&u<=e)}(i,o,r,10,10),Jm.set(u.get(t),[ou(r+1+"x"+(o+1))])}),nr(_v,function(t,n,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),jo(t,Oo())})]),Gm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:function $F(n,t){var e=ib(t.colorinput.getColors(),t.colorinput.hasCustomColors()),o=t.colorinput.getColorCols(),r=lb(Wr("menu-value"),e,function(t){n.onAction({value:t})},o,"color",Mp.CLOSE_ON_EXECUTE,function(){return!1},t.shared.providers),i=et(et({},r),{markers:jp("color"),movement:mb(o,"color")});return{type:"widget",data:{value:Wr("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Cv().widget(Ag.sketch(i))]}}},vb=function(n,e,t,o,r,i,u,a){void 0===a&&(a=!0);var c,s,f=Sv({presets:o,textContent:st.none(),htmlContent:t?n.text.map(function(t){return kv(t,e)}):st.none(),ariaLabel:n.text,iconContent:n.icon,shortcutContent:st.none(),checkMark:st.none(),caret:st.none(),value:n.value},u.providers,a,n.icon);return lv({data:dv(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[gh.config({lazySink:s.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:function(t){return{anchor:"submenu",item:t,overrides:{maxHeightFunction:_c}}},mode:"follow-highlight",onShow:function(n,t){e(function(t){gh.setComponents(n,[ru({element:le.fromDom(t)})])})}})]}).getOr([]))},f,i,u.providers)},bb=function(t){var n=t.text.fold(function(){return{}},function(t){return{innerHtml:t}});return{type:"separator",dom:et({tag:"div",classes:[Fp,"tox-collection__group-heading"]},n),components:[]}},yb=function(t,n,e,o){void 0===o&&(o=!0);var r=Sv({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:st.none(),ariaLabel:t.text,caret:st.none(),checkMark:st.none(),shortcutContent:t.shortcut},e,o);return lv({data:dv(t),getApi:function(n){return{isDisabled:function(){return Dh.isDisabled(n)},setDisabled:function(t){return Dh.set(n,t)}}},disabled:t.disabled,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n,e)},xb=function(t,n,e,o,r){void 0===o&&(o=!0),void 0===r&&(r=!1);var i,u,a=r?(u=e.icons,{dom:{tag:"div",classes:[Hp],innerHtml:np("chevron-down",u)}}):(i=e.icons,{dom:{tag:"div",classes:[Hp],innerHtml:np("chevron-right",i)}}),c=Sv({presets:"normal",iconContent:t.icon,textContent:t.text,htmlContent:st.none(),ariaLabel:t.text,caret:st.some(a),checkMark:st.none(),shortcutContent:t.shortcut},e,o);return lv({data:dv(t),getApi:function(n){return{isDisabled:function(){return Dh.isDisabled(n)},setDisabled:function(t){return Dh.set(n,t)}}},disabled:t.disabled,onAction:Z,onSetup:t.onSetup,triggersSubmenu:!0,itemBehaviours:[]},c,n,e)},wb=function(t,n,e,o){void 0===o&&(o=!0);var r=Sv({iconContent:t.icon,textContent:t.text,htmlContent:st.none(),ariaLabel:t.text,checkMark:st.some(bv(e.icons)),caret:st.none(),shortcutContent:t.shortcut,presets:"normal",meta:t.meta},e,o);return zt(lv({data:dv(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){gg.set(n,t)},isActive:function(){return gg.isOn(n)},isDisabled:function(){return Dh.isDisabled(n)},setDisabled:function(t){return Dh.set(n,t)}}},onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n,e),{toggling:{toggleClass:Vp,toggleOnExecute:!1,selected:t.active}})},Sb=function(n,e){return t=hb,o=n.fancytype,(Object.prototype.hasOwnProperty.call(t,o)?st.some(t[o]):st.none()).map(function(t){return t(n,e)});var t,o};(pb=gb=gb||{})[pb.ContentFocus=0]="ContentFocus",pb[pb.UiFocus=1]="UiFocus";var kb=function(t,n,e,o,r){var i=e.shared.providers,u=function(t){return r?et(et({},t),{shortcut:st.none(),icon:t.text.isSome()?st.none():t.icon}):t};switch(t.type){case"menuitem":return On("menuitem",nh,t).fold(Kp,function(t){return st.some(yb(u(t),n,i,o))});case"nestedmenuitem":return On("nestedmenuitem",eh,t).fold(Kp,function(t){return st.some(xb(u(t),n,i,o,r))});case"togglemenuitem":return On("togglemenuitem",oh,t).fold(Kp,function(t){return st.some(wb(u(t),n,i,o))});case"separator":return On("separatormenuitem",Op,t).fold(Kp,function(t){return st.some(bb(t))});case"fancymenuitem":return On("fancymenuitem",th,t).fold(Kp,function(t){return Sb(u(t),e)});default:return nt.console.error("Unknown item in general menu",t),st.none()}},Cb=function(t,n,e,o,r,i){var u=1===o,a=!u||qp(t);return Pl(V(t,function(t){return"separator"===t.type?On("Autocompleter.Separator",Op,t).fold(Kp,function(t){return st.some(bb(t))}):On("Autocompleter.Item",_p,t).fold(Kp,function(t){return st.some(vb(t,n,u,"normal",e,r,i,a))})}))},Ob=function(t,n,e,o,r){var i=qp(n),u=Pl(V(n,function(t){var n=function(t){return kb(t,e,o,(n=t,r?!n.hasOwnProperty("text"):i),r);var n};return"nestedmenuitem"===t.type&&t.getSubmenuItems().length<=0?n(et(et({},t),{disabled:!0})):n(t)}));return(r?Jp:$p)(t,i,u,1,"normal")},_b=function(t){return Hg.singleData(t.value,t)},Tb=function(d,c){var e=se(st.none()),s=se(!1),m=uu(zg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],fireDismissalEventInstead:{},inlineBehaviours:Ka([$m("dismissAutocompleter",[$o(Io(),function(){return l()})])]),lazySink:c.getSink})),o=function(){return e.get().isSome()},f=function(){o()&&zg.hide(m)},l=function(){if(o()){var t=e.get().map(function(t){return t.element});lp(t.getOr(le.fromDom(d.selection.getNode()))).each(Br),f(),e.set(st.none()),s.set(!1)}},r=Lt(function(){return Ep(d)}),g=function(t,n,e,o){t.matchLength=n.text.length;var r,i,u,a,c,s,f,l=$(e,function(t){return st.from(t.columns)}).getOr(1);zg.showAt(m,{anchor:"node",root:le.fromDom(d.getBody()),node:st.from(t.element)},Ag.sketch((r=$p("autocompleter-value",!0,o,l,"normal"),i=l,u=gb.ContentFocus,a="normal",c=(u===gb.ContentFocus?bd:vd)(),s=mb(i,a),f=jp(a),{dom:r.dom,components:r.components,items:r.items,value:r.value,markers:{selectedItem:f.selectedItem,item:f.item},movement:s,fakeFocus:u===gb.ContentFocus,focusManager:c,menuBehaviours:uh("auto"!==i?[]:[rr(function(o,t){rh(o,4,f.item).each(function(t){var n=t.numColumns,e=t.numRows;Gm.setGridSize(o,e,n)})})])}))),zg.getContent(m).each(Ql.highlightFirst)},p=function(t){var n;n=t,e.get().map(function(t){return hp(d.dom,d.selection.getRng(),t.triggerChar).bind(function(t){return Cp(d,r,t,n)})}).getOrThunk(function(){return kp(d,r)}).fold(l,function(a){!function(t){if(!o()){var n=fp(d,t.range);e.set(st.some({triggerChar:t.triggerChar,element:n,matchLength:t.text.length})),s.set(!1)}}(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=$(e=u,function(t){return st.from(t.columns)}).getOr(1),U(e,function(i){var t=i.items;return Cb(t,i.matchText,function(o,r){var t=d.selection.getRng();hp(d.dom,t,n).fold(function(){return nt.console.error("Lost context. Cursor probably moved")},function(t){var n=t.range,e={hide:function(){l()},reload:function(t){f(),p(t)}};s.set(!0),i.onAction(e,n,o,r),s.set(!1)})},o,Mp.BUBBLE_TO_SANDBOX,c)}));0<i.length?g(t,r,u,i):(10<=r.text.length-t.matchLength?l:f)()}})})})},t={onKeypress:ap(function(t){27!==t.which&&p()},50),cancelIfNecessary:l,isMenuOpen:function(){return zg.isOpen(m)},isActive:o,isProcessingAction:s.get,getView:function(){return zg.getContent(m)}};vp(t,d)},Eb=at(!0),Bb=function(t,n,e){return wu(t,n,Eb,e,!1)},Db=function(t,n,e){return wu(t,n,Eb,e,!0)},Mb=xu,Ab=function(t,n,e){return ju(t,n,e).isSome()};function Fb(e,o){var r=null;return{cancel:function(){null!==r&&(nt.clearTimeout(r),r=null)},schedule:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r=nt.setTimeout(function(){e.apply(null,t),r=null},o)}}}var Ib=function(t){var n=t.raw();return n.touches===undefined||1!==n.touches.length?st.none():st.some(n.touches[0])},Rb=function(e){var u=se(st.none()),o=se(!1),r=Fb(function(t){e.triggerEvent(Co(),t),o.set(!0)},400),i=$t([{key:$e(),value:function(e){return Ib(e).each(function(t){r.cancel();var n={x:t.clientX,y:t.clientY,target:e.target()};r.schedule(e),o.set(!1),u.set(st.some(n))}),st.none()}},{key:Qe(),value:function(t){return r.cancel(),Ib(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(st.none())})}),st.none()}},{key:Ze(),value:function(n){r.cancel();return u.get().filter(function(t){return je(t.target,n.target())}).map(function(t){return o.get()?(n.prevent(),!1):e.triggerEvent(ko(),n)})}}]);return{fireIfReady:function(n,t){return Ft(i,t).bind(function(t){return t(n)})}}},Vb=function(){return ze().browser.isFirefox()},Pb=fn([Wn("triggerEvent"),te("stopBackspace",!0)]),Hb=function(n,t){var e,o,r,i,u=Tn("Getting GUI events settings",Pb,t),a=Rb(u),c=V(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(t){return Bb(n,t,function(n){a.fireIfReady(n,t).each(function(t){t&&n.kill()}),u.triggerEvent(t,n)&&n.kill()})}),s=se(st.none()),f=Bb(n,"paste",function(n){a.fireIfReady(n,"paste").each(function(t){t&&n.kill()}),u.triggerEvent("paste",n)&&n.kill(),s.set(st.some(nt.setTimeout(function(){u.triggerEvent(yo(),n)},0)))}),l=Bb(n,"keydown",function(t){var n;u.triggerEvent("keydown",t)?t.kill():!0!==u.stopBackspace||(8!==(n=t).raw().which||A(["input","textarea"],cr(n.target()))||Ab(n.target(),'[contenteditable="true"]'))||t.prevent()}),d=(e=n,o=function(t){u.triggerEvent("focusin",t)&&t.kill()},Vb()?Db(e,"focus",o):Bb(e,"focusin",o)),m=se(st.none()),g=(r=n,i=function(t){u.triggerEvent("focusout",t)&&t.kill(),m.set(st.some(nt.setTimeout(function(){u.triggerEvent(bo(),t)},0)))},Vb()?Db(r,"blur",i):Bb(r,"focusout",i));return{unbind:function(){rt(c,function(t){t.unbind()}),l.unbind(),d.unbind(),g.unbind(),f.unbind(),s.get().each(nt.clearTimeout),m.get().each(nt.clearTimeout)}}},zb=function(t,n){var e=Ft(t,"target").map(function(t){return t()}).getOr(n);return se(e)},Nb=Vt([{stopped:[]},{resume:["element"]},{complete:[]}]),Lb=function(t,o,n,e,r,i){var u,a,c,s,f=t(o,e),l=(u=n,a=r,c=se(!1),s=se(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:at(u),setSource:a.set,getSource:a.get});return f.fold(function(){return i.logEventNoHandlers(o,e),Nb.complete()},function(n){var e=n.descHandler;return li(e)(l),l.isStopped()?(i.logEventStopped(o,n.element,e.purpose()),Nb.stopped()):l.isCut()?(i.logEventCut(o,n.element,e.purpose()),Nb.complete()):br(n.element).fold(function(){return i.logNoParent(o,n.element,e.purpose()),Nb.complete()},function(t){return i.logEventResponse(o,n.element,e.purpose()),Nb.resume(t)})})},jb=function(n,e,o,t,r,i){return Lb(n,e,o,t,r,i).fold(function(){return!0},function(t){return jb(n,e,o,t,r,i)},function(){return!1})},Ub=function(t,n,e){var o,r,i=(o=n,r=se(!1),{stop:function(){r.set(!0)},cut:Z,isStopped:r.get,isCut:at(!1),event:at(o),setSource:u("Cannot set source of a broadcasted event"),getSource:u("Cannot get source of a broadcasted event")});return rt(t,function(t){var n=t.descHandler();li(n)(i)}),i.isStopped()},Wb=function(t,n,e,o,r){var i=zb(e,o);return jb(t,n,e,o,i,r)},Gb=function(t,n){return{element:t,descHandler:n}},Xb=function(t,n){return{id:at(t),descHandler:at(n)}};function Yb(){var i={};return{registerId:function(o,r,t){_t(t,function(t,n){var e=i[n]!==undefined?i[n]:{};e[r]=fi(t,o),i[n]=e})},unregisterId:function(e){_t(i,function(t,n){t.hasOwnProperty(e)&&delete t[e]})},filterByType:function(t){return Ft(i,t).map(function(t){return Dt(t,function(t,n){return Xb(n,t)})}).getOr([])},find:function(t,n,e){var r=Ft(i,n);return Ye(e,function(t){return e=r,Jr(o=t).fold(function(){return st.none()},function(n){return e.bind(function(t){return Ft(t,n)}).map(function(t){return Gb(o,t)})});var e,o},t)}}}function qb(){var o=Yb(),r={},i=function(o){var t=o.element();return Jr(t).fold(function(){return t="uid-",n=o.element(),e=Wr(Yr+t),Kr(n,e),e;var t,n,e},function(t){return t})},u=function(t){Jr(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);Rt(r,n)&&function(t,n){var e=r[n];if(e!==t)throw new Error('The tagId "'+n+'" is already used by: '+Nr(e.element())+"\nCannot use it for: "+Nr(t.element())+"\nThe conflicting element is"+(Ri(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 Ft(r,t)}}}var Kb,Jb,$b,Qb,Zb=Rl({name:"Container",factory:function(t){var n=t.dom,e=n.attributes,o=y(n,["attributes"]);return{uid:t.uid,dom:et({tag:"div",attributes:et({role:"presentation"},e)},o),components:t.components,behaviours:Mf(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},configFields:[te("components",[]),Df("containerBehaviours",[]),te("events",{}),te("domModification",{}),te("eventOrder",{})]}),ty=function(e){var o=function(n){return br(e.element()).fold(function(){return!0},function(t){return je(n,t)})},r=qb(),s=function(t,n){return r.find(o,t,n)},t=Hb(e.element(),{triggerEvent:function(u,a){return Qu(u,a.target(),function(t){return n=s,e=u,r=t,i=(o=a).target(),Wb(n,e,o,i,r);var n,e,o,r,i})}}),i={debugInfo:at("real"),triggerEvent:function(n,e,o){Qu(n,e,function(t){return Wb(s,n,o,e,t)})},triggerFocus:function(a,c){Jr(a).fold(function(){ic(a)},function(t){Qu(vo(),a,function(t){var n,e,o,r,i,u;return n=s,e=vo(),o={originator:at(c),kill:Z,prevent:Z,target:at(a)},i=t,u=zb(o,r=a),Lb(n,e,o,r,u,i),!1})})},triggerEscape:function(t,n){i.triggerEvent("keydown",t.element(),n.event())},getByUid:function(t){return g(t)},getByDom:function(t){return p(t)},build:uu,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:at(!0)},n=function(t){t.connect(i),lr(t.element())||(r.register(t),rt(t.components(),n),i.triggerEvent(To(),t.element(),{target:at(t.element())}))},u=function(t){lr(t.element())||(rt(t.components(),u),r.unregister(t)),t.disconnect()},a=function(t){Gs(e,t)},c=function(t){qs(t)},f=function(e){var t=r.filter(xo());rt(t,function(t){var n=t.descHandler();li(n)(e)})},l=function(t){f({universal:at(!0),data:at(t)})},d=function(t,n){f({universal:at(!1),channels:at(t),data:at(n)})},m=function(t,n){var e=r.filter(t);return Ub(e,n)},g=function(t){return r.getById(t).fold(function(){return ut.error(new Error('Could not find component with uid: "'+t+'" in system.'))},ut.value)},p=function(t){var n=Jr(t).getOr("not found");return g(n)};return n(e),{root:at(e),element:e.element,destroy:function(){t.unbind(),Er(e.element())},add:a,remove:c,getByUid:g,getByDom:p,addToWorld:n,removeFromWorld:u,broadcast:l,broadcastOn:d,broadcastEvent:m}},ny=at([te("prefix","form-field"),Df("fieldBehaviours",[Ll,Bf])]),ey=at([al({schema:[Nn("dom")],name:"label"}),al({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Nn("text")],name:"aria-descriptor"}),il({factory:{sketch:function(t){var n=Kt(t,["factory"]);return t.factory.sketch(n)}},schema:[Nn("factory")],name:"field"})]),oy=Vl({name:"FormField",configFields:ny(),partFields:ey(),factory:function(r,t,n,e){var o=Af(r.fieldBehaviours,[Ll.config({find:function(t){return yl(t,r,"field")}}),Bf.config({store:{mode:"manual",getValue:function(t){return Ll.getCurrent(t).bind(Bf.getValue)},setValue:function(t,n){Ll.getCurrent(t).each(function(t){Bf.setValue(t,n)})}}})]),i=qo([rr(function(t,n){var o=wl(t,r,["label","field","aria-descriptor"]);o.field().each(function(e){var n=Wr(r.prefix);o.label().each(function(t){Fr(t.element(),"for",n),Fr(e.element(),"id",n)}),o["aria-descriptor"]().each(function(t){var n=Wr(r.prefix);Fr(t.element(),"id",n),Fr(e.element(),"aria-describedby",n)})})})]),u={getField:function(t){return yl(t,r,"field")},getLabel:function(t){return yl(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)}}}),ry=/* */Object.freeze({__proto__:null,exhibit:function(t,n){return si({attributes:$t([{key:n.tabAttr,value:"true"}])})}}),iy=[te("tabAttr","data-alloy-tabstop")],uy=$a({fields:iy,name:"tabstopping",active:ry}),ay=function(t,n,e,o){var r=cy(t,n,e,o);return oy.sketch(r)},cy=function(t,n,e,o){return{dom:sy(e),components:t.toArray().concat([n]),fieldBehaviours:Ka(o)}},sy=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},fy=function(t,n){return oy.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},ly=Wr("form-component-change"),dy=Wr("form-close"),my=Wr("form-cancel"),gy=Wr("form-action"),py=Wr("form-submit"),hy=Wr("form-block"),vy=Wr("form-unblock"),by=Wr("form-tabchange"),yy=Wr("form-resize"),xy=function(a,c){var t,n,e=a.label.map(function(t){return fy(t,c)}),o=function(o){return function(n,e){ju(e.event().target(),"[data-collection-item-value]").each(function(t){o(n,e,t,Ir(t,"data-collection-item-value"))})}},r=function(t,n){var e=V(n,function(t){var n,e=hh.translate(t.text),o=1===a.columns?'<div class="tox-collection__item-label">'+e+"</div>":"",r='<div class="tox-collection__item-icon">'+t.icon+"</div>",i={_:" "," - ":" ","-":" "},u=e.replace(/\_| \- |\-/g,function(t){return i[t]});return'<div class="tox-collection__item'+(c.isReadOnly()?" tox-collection__item--state-disabled":"")+'" tabindex="-1" data-collection-item-value="'+('"'===(n=t.value)?"&quot;":n)+'" title="'+u+'" aria-label="'+u+'">'+r+o+"</div>"}),o=1<a.columns&&"auto"!==a.columns?R(e,a.columns):[e],r=V(o,function(t){return'<div class="tox-collection__group">'+t.join("")+"</div>"});Mr(t.element(),r.join(""))},i=o(function(t,n,e,o){n.stop(),c.isReadOnly()||Uo(t,gy,{name:a.name,value:o})}),u=[$o(io(),o(function(t,n,e){ic(e)})),$o(mo(),i),$o(ko(),i),$o(uo(),o(function(t,n,e){Lu(t.element(),"."+zp).each(function(t){Ci(t,zp)}),Si(e,zp)})),$o(ao(),o(function(t){Lu(t.element(),"."+zp).each(function(t){Ci(t,zp)})})),ar(o(function(t,n,e,o){Uo(t,gy,{name:a.name,value:o})}))],s=function(t,n){return V(os(t.element(),".tox-collection__item"),n)},f=oy.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==a.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:ct},behaviours:Ka([Dh.config({disabled:c.isReadOnly,onDisabled:function(t){s(t,function(t){Si(t,"tox-collection__item--state-disabled"),Fr(t,"aria-disabled",!0)})},onEnabled:function(t){s(t,function(t){Ci(t,"tox-collection__item--state-disabled"),Pr(t,"aria-disabled")})}}),nv(),Jm.config({}),Bf.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,t){r(o,t),"auto"===a.columns&&rh(o,5,"tox-collection__item").each(function(t){var n=t.numRows,e=t.numColumns;Gm.setGridSize(o,n,e)}),jo(o,yy)}}),uy.config({}),Gm.config((t=a.columns,n="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"===n?".tox-swatches__row":".tox-collection__group",cell:"color"===n?"."+Ip:"."+Fp}})),$m("collection-events",u)]),eventOrder:{"alloy.execute":["disabling","alloy.base.behaviour","collection-events"]}});return ay(e,f,["tox-form__group--collection"],[])},wy=at([qn("data"),te("inputAttributes",{}),te("inputStyles",{}),te("tag","input"),te("inputClasses",[]),aa("onSetValue"),te("styles",{}),te("eventOrder",{}),Df("inputBehaviours",[Bf,eg]),te("selectOnFocus",!0)]),Sy=function(t){return Ka([eg.config({onFocus:t.selectOnFocus?function(t){var n=t.element(),e=Ki(n);n.dom().setSelectionRange(0,e.length)}:Z})])},ky=function(t){return{tag:t.tag,attributes:et({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},Cy=Rl({name:"Input",configFields:wy(),factory:function(t,n){return{uid:t.uid,dom:ky(t),components:[],behaviours:et(et({},Sy(e=t)),Af(e.inputBehaviours,[Bf.config({store:et(et({mode:"manual"},e.data.map(function(t){return{initialValue:t}}).getOr({})),{getValue:function(t){return Ki(t.element())},setValue:function(t,n){Ki(t.element())!==n&&Ji(t.element(),n)}}),onSetValue:e.onSetValue})])),eventOrder:t.eventOrder};var e}}),Oy={},_y={exports:Oy};Kb=undefined,Jb=Oy,$b=_y,Qb=undefined,function(t){if("object"==typeof Jb&&void 0!==$b)$b.exports=t();else if("function"==typeof Kb&&Kb.amd)Kb([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EphoxContactWrapper=t()}}(function(){return function f(i,u,a){function c(n,t){if(!u[n]){if(!i[n]){var e="function"==typeof Qb&&Qb;if(!t&&e)return e(n,!0);if(s)return s(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var r=u[n]={exports:{}};i[n][0].call(r.exports,function(t){return c(i[n][1][t]||t)},r,r.exports,f,i,u,a)}return u[n].exports}for(var s="function"==typeof Qb&&Qb,t=0;t<a.length;t++)c(a[t]);return c}({1:[function(t,n,e){var o,r,i=n.exports={};function u(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(o===setTimeout)return setTimeout(t,0);if((o===u||!o)&&setTimeout)return o=setTimeout,setTimeout(t,0);try{return o(t,0)}catch(n){try{return o.call(null,t,0)}catch(n){return o.call(this,t,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:u}catch(t){o=u}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var s,f=[],l=!1,d=-1;function m(){l&&s&&(l=!1,s.length?f=s.concat(f):d=-1,f.length&&g())}function g(){if(!l){var t=c(m);l=!0;for(var n=f.length;n;){for(s=f,f=[];++d<n;)s&&s[d].run();d=-1,n=f.length}s=null,l=!1,function e(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(n){try{return r.call(null,t)}catch(n){return r.call(this,t)}}}(t)}}function p(t,n){this.fun=t,this.array=n}function h(){}i.nextTick=function(t){var n=new Array(arguments.length-1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)n[e-1]=arguments[e];f.push(new p(t,n)),1!==f.length||l||c(g)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(t,l,n){(function(n){function o(){}function i(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=0,this._handled=!1,this._value=undefined,this._deferreds=[],f(t,this)}function r(o,r){for(;3===o._state;)o=o._value;0!==o._state?(o._handled=!0,i._immediateFn(function(){var t=1===o._state?r.onFulfilled:r.onRejected;if(null!==t){var n;try{n=t(o._value)}catch(e){return void a(r.promise,e)}u(r.promise,n)}else(1===o._state?u:a)(r.promise,o._value)})):o._deferreds.push(r)}function u(t,n){try{if(n===t)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if(n instanceof i)return t._state=3,t._value=n,void c(t);if("function"==typeof e)return void f(function o(t,n){return function(){t.apply(n,arguments)}}(e,n),t)}t._state=1,t._value=n,c(t)}catch(r){a(t,r)}}function a(t,n){t._state=2,t._value=n,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var n=0,e=t._deferreds.length;n<e;n++)r(t,t._deferreds[n]);t._deferreds=null}function s(t,n,e){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=e}function f(t,n){var e=!1;try{t(function(t){e||(e=!0,u(n,t))},function(t){e||(e=!0,a(n,t))})}catch(o){if(e)return;e=!0,a(n,o)}}var t,e;t=this,e=setTimeout,i.prototype["catch"]=function(t){return this.then(null,t)},i.prototype.then=function(t,n){var e=new this.constructor(o);return r(this,new s(t,n,e)),e},i.all=function(t){var c=Array.prototype.slice.call(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.length;e<o;e++)r[e].then(t,n)})},i._immediateFn="function"==typeof n?function(t){n(t)}:function(t){e(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},i._setImmediateFn=function(t){i._immediateFn=t},i._setUnhandledRejectionFn=function(t){i._unhandledRejectionFn=t},void 0!==l&&l.exports?l.exports=i:t.Promise||(t.Promise=i)}).call(this,t("timers").setImmediate)},{timers:3}],3:[function(c,t,s){(function(t,n){var o=c("process/browser.js").nextTick,e=Function.prototype.apply,r=Array.prototype.slice,i={},u=0;function a(t,n){this._id=t,this._clearFn=n}s.setTimeout=function(){return new a(e.call(setTimeout,window,arguments),clearTimeout)},s.setInterval=function(){return new a(e.call(setInterval,window,arguments),clearInterval)},s.clearTimeout=s.clearInterval=function(t){t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},s.enroll=function(t,n){clearTimeout(t._idleTimeoutId),t._idleTimeout=n},s.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},s._unrefActive=s.active=function(t){clearTimeout(t._idleTimeoutId);var n=t._idleTimeout;0<=n&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},n))},s.setImmediate="function"==typeof t?t:function(t){var n=u++,e=!(arguments.length<2)&&r.call(arguments,1);return i[n]=!0,o(function(){i[n]&&(e?t.apply(null,e):t.call(null),s.clearImmediate(n))}),n},s.clearImmediate="function"==typeof n?n:function(t){delete i[t]}}).call(this,c("timers").setImmediate,c("timers").clearImmediate)},{"process/browser.js":1,timers:3}],4:[function(t,n,e){var o=t("promise-polyfill"),r="undefined"!=typeof window?window:Function("return this;")();n.exports={boltExport:r.Promise||o}},{"promise-polyfill":2}]},{},[4])(4)});var Ty,Ey,By=_y.exports.boltExport,Dy=function(t){var e=st.none(),n=[],o=function(t){r()?u(t):n.push(t)},r=function(){return e.isSome()},i=function(t){rt(t,u)},u=function(n){e.each(function(t){nt.setTimeout(function(){n(t)},0)})};return t(function(t){r()||(e=st.some(t),i(n),n=[])}),{get:o,map:function(e){return Dy(function(n){o(function(t){n(e(t))})})},isReady:r}},My={nu:Dy,pure:function(n){return Dy(function(t){t(n)})}},Ay=function(t){nt.setTimeout(function(){throw t},0)},Fy=function(e){var t=function(t){e().then(t,Ay)};return{map:function(t){return Fy(function(){return e().then(t)})},bind:function(n){return Fy(function(){return e().then(function(t){return n(t).toPromise()})})},anonBind:function(t){return Fy(function(){return e().then(function(){return t.toPromise()})})},toLazy:function(){return My.nu(t)},toCached:function(){var t=null;return Fy(function(){return null===t&&(t=e()),t})},toPromise:e,get:t}},Iy=function(t){return Fy(function(){return new By(t)})},Ry=function(t){return Fy(function(){return By.resolve(t)})},Vy=["input","textarea"],Py=function(t){var n=cr(t);return A(Vy,n)},Hy=function(t,n){var e=n.getRoot(t).getOr(t.element());Ci(e,n.invalidClass),n.notify.each(function(n){Py(t.element())&&Fr(t.element(),"aria-invalid",!1),n.getContainer(t).each(function(t){Mr(t,n.validHtml)}),n.onValid(t)})},zy=function(n,t,e,o){var r=t.getRoot(n).getOr(n.element());Si(r,t.invalidClass),t.notify.each(function(t){Py(n.element())&&Fr(n.element(),"aria-invalid",!0),t.getContainer(n).each(function(t){Mr(t,o)}),t.onInvalid(n,o)})},Ny=function(n,t,e){return t.validator.fold(function(){return Ry(ut.value(!0))},function(t){return t.validate(n)})},Ly=function(n,e,t){return e.notify.each(function(t){t.onValidate(n)}),Ny(n,e).map(function(t){return n.getSystem().isConnected()?t.fold(function(t){return zy(n,e,0,t),ut.error(t)},function(t){return Hy(n,e),ut.value(t)}):ut.error("No longer in system")})},jy=/* */Object.freeze({__proto__:null,markValid:Hy,markInvalid:zy,query:Ny,run:Ly,isInvalid:function(t,n){var e=n.getRoot(t).getOr(t.element());return Oi(e,n.invalidClass)}}),Uy=/* */Object.freeze({__proto__:null,events:function(n,t){return n.validator.map(function(t){return qo([$o(t.onEvent,function(t){Ly(t,n).get(ct)})].concat(t.validateOnLoad?[rr(function(t){Ly(t,n).get(Z)})]:[]))}).getOr({})}}),Wy=[Nn("invalidClass"),te("getRoot",st.none),Zn("notify",[te("aria","alert"),te("getContainer",st.none),te("validHtml",""),aa("onValid"),aa("onInvalid"),aa("onValidate")]),Zn("validator",[Nn("validate"),te("onEvent","input"),te("validateOnLoad",!0)])],Gy=$a({fields:Wy,name:"invalidating",active:Uy,apis:jy,extra:{validation:function(e){return function(t){var n=Bf.getValue(t);return Ry(e(n))}}}}),Xy=/* */Object.freeze({__proto__:null,getCoupled:function(t,n,e,o){return e.getOrCreate(t,n,o)}}),Yy=[Ln("others",Cn(ut.value,Mn()))],qy=$a({fields:Yy,name:"coupling",apis:Xy,state:/* */Object.freeze({__proto__:null,init:function(){var i={},t=at({});return ai({readState:t,getOrCreate:function(e,o,r){var t=Ct(o.others);if(t)return Ft(i,r).getOrThunk(function(){var t=Ft(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: "+JSON.stringify(t,null,2))}})}})}),Ky=at("sink"),Jy=at(al({name:Ky(),overrides:at({dom:{tag:"div"},behaviours:Ka([Ns.config({useFixed:i})]),events:qo([er(co()),er(no()),er(mo())])})}));(Ey=Ty=Ty||{})[Ey.HighlightFirst=0]="HighlightFirst",Ey[Ey.HighlightNone=1]="HighlightNone";var $y=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}})},Qy=function(t,n,e,o,r,i,u){var a,c,s,f,l,d,m,g,p,h,v=$y(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=ex(s,a),p.map(function(t){return t.bind(function(t){return st.from(Hg.sketch(et(et({},l.menu()),{uid:$r(""),data:t,highlightImmediately:d===Ty.HighlightFirst,onOpenMenu:function(t,n){var e=h().getOrDie();Ns.position(e,c,n),sf.decloak(f)},onOpenSubmenu:function(t,n,e){var o=h().getOrDie();Ns.position(o,{anchor:"submenu",item:n},e),sf.decloak(f)},onRepositionMenu:function(t,n,e){var o=h().getOrDie();Ns.position(o,c,n),rt(e,function(t){Ns.position(o,{anchor:"submenu",item:t.triggeringItem},t.triggeredMenu)})},onEscape:function(){return eg.focus(s),sf.close(f),st.some(!0)}})))})})).map(function(t){return t.fold(function(){sf.isOpen(o)&&sf.close(o)},function(t){sf.cloak(o),sf.open(o,t),i(o)}),o})},Zy=function(t,n,e,o,r,i,u){return sf.close(o),Ry(o)},tx=function(t,n,e,o,r,i){var u=qy.getCoupled(e,"sandbox");return(sf.isOpen(u)?Zy:Qy)(t,n,e,u,o,r,i)},nx=function(t,n,e){var o,r,i=Ll.getCurrent(n).getOr(n),u=bu(t.element());e?Ni(i.element(),"min-width",u+"px"):(o=i.element(),r=u,vu.set(o,r))},ex=function(n,t){return n.getSystem().getByUid(t.uid+"-"+Ky()).map(function(t){return function(){return ut.value(t)}}).getOrThunk(function(){return t.lazySink.fold(function(){return function(){return ut.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(t){return function(){return t(n)}})})},ox=function(t){sf.getState(t).each(function(t){Hg.repositionMenus(t)})},rx=function(o,r,i){var u=Uu(),t=ex(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id,role:"listbox"}},behaviours:If(o.sandboxBehaviours,[Bf.config({store:{mode:"memory",initialValue:r}}),sf.config({onOpen:function(t,n){var e=$y(o,r);u.link(r.element()),o.matchWidth&&nx(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 Gu(n,e)||Gu(r,e)},getAttachPoint:function(){return t().getOrDie()}}),Ll.config({find:function(t){return sf.getState(t).bind(function(t){return Ll.getCurrent(t)})}}),oc.config({channels:et(et({},gf({isExtraPart:c})),hf({doReposition:ox}))})])}},ix=function(t){var n=qy.getCoupled(t,"sandbox");ox(n)},ux=function(){return[te("sandboxClasses",[]),Ff("sandboxBehaviours",[Ll,oc,sf,Bf])]},ax=at([Nn("dom"),Nn("fetch"),aa("onOpen"),ca("onExecute"),te("getHotspot",st.some),te("getAnchorOverrides",at({})),Pc(),Df("dropdownBehaviours",[gg,qy,Gm,eg]),Nn("toggleClass"),te("eventOrder",{}),qn("lazySink"),te("matchWidth",!1),te("useMinWidth",!1),qn("role")].concat(ux())),cx=at([ul({schema:[ra()],name:"menu",defaults:function(t){return{onExecute:t.onExecute}}}),Jy()]),sx=Vl({name:"Dropdown",configFields:ax(),partFields:cx(),factory:function(n,t,e,o){var r,i,u=function(t){sf.getState(t).each(function(t){Hg.highlightPrimary(t)})},a={expand:function(t){gg.isOn(t)||tx(n,function(t){return t},t,o,Z,Ty.HighlightNone).get(Z)},open:function(t){gg.isOn(t)||tx(n,function(t){return t},t,o,Z,Ty.HighlightFirst).get(Z)},isOpen:gg.isOn,close:function(t){gg.isOn(t)&&tx(n,function(t){return t},t,o,Z,Ty.HighlightFirst).get(Z)},repositionMenus:function(t){gg.isOn(t)&&ix(t)}},c=function(t,n){return Wo(t),st.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:Af(n.dropdownBehaviours,[gg.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),qy.config({others:{sandbox:function(t){return rx(n,t,{onOpen:function(){gg.on(t)},onClose:function(){gg.off(t)}})}}}),Gm.config({mode:"special",onSpace:c,onEnter:c,onDown:function(t,n){if(sx.isOpen(t)){var e=qy.getCoupled(t,"sandbox");u(e)}else sx.open(t);return st.some(!0)},onEscape:function(t,n){return sx.isOpen(t)?(sx.close(t),st.some(!0)):st.none()}}),eg.config({})]),events:hg(st.some(function(t){tx(n,function(t){return t},t,o,u,Ty.HighlightFirst).get(Z)})),eventOrder:et(et({},n.eventOrder),((r={})[wo()]=["disabling","toggling","alloy.base.behaviour"],r)),apis:a,domModification:{attributes:et(et({"aria-haspopup":"true"},n.role.fold(function(){return{}},function(t){return{role:t}})),"button"===n.dom.tag?{type:(i="type",Ft(n.dom,"attributes").bind(function(t){return Ft(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)},repositionMenus:function(t,n){return t.repositionMenus(n)}}}),fx=$a({fields:[],name:"unselecting",active:/* */Object.freeze({__proto__:null,events:function(){return qo([Ko(po(),at(!0))])},exhibit:function(){return si({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),lx=Wr("color-input-change"),dx=Wr("color-swatch-change"),mx=Wr("color-picker-cancel"),gx=function(e,n,o){var r,i,t=oy.parts().field({factory:Cy,inputClasses:["tox-textfield"],onSetValue:function(t){return Gy.run(t).get(function(){})},inputBehaviours:Ka([Dh.config({disabled:n.providers.isReadOnly}),nv(),uy.config({}),Gy.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(t){return br(t.element())},notify:{onValid:function(t){var n=Bf.getValue(t);Uo(t,lx,{color:n})}},validator:{validateOnLoad:!1,validate:function(t){var n=Bf.getValue(t);if(0===n.length)return Ry(ut.value(!0));var e=le.fromTag("span");Ni(e,"background-color",n);var o=Gi(e,"background-color").fold(function(){return ut.error("blah")},function(t){return ut.value(n)});return Ry(o)}}})]),selectOnFocus:!1}),u=e.label.map(function(t){return fy(t,n.providers)}),a=function(t,n){Uo(t,dx,{value:n})},c=Zg((r={dom:{tag:"span",attributes:{"aria-label":n.providers.translate("Color swatch")}},layouts:{onRtl:function(){return[Aa,Ma,Va]},onLtr:function(){return[Ma,Aa,Va]}},components:[],fetch:ub(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 jo(n,mx)},function(t){a(n,t),nb(t)})},"#ffffff"):a(n,"remove"===e?"":e)})}},i=n,sx.sketch({dom:r.dom,components:r.components,toggleClass:"mce-active",dropdownBehaviours:Ka([ov(i.providers.isReadOnly),nv(),fx.config({}),uy.config({})]),layouts:r.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:i.getSink,fetch:function(n){return Iy(function(t){return r.fetch(t)}).map(function(t){return st.from(_b(zt(lb(Wr("menu-value"),t,function(t){r.onItemAction(n,t)},r.columns,r.presets,Mp.CLOSE_ON_EXECUTE,function(){return!1},i.providers),{movement:mb(r.columns,r.presets)})))})},parts:{menu:Wp(0,0,r.presets)}})));return oy.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:u.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[t,c.asSpec()]}]),fieldBehaviours:Ka([$m("form-field-events",[$o(lx,function(t,n){c.getOpt(t).each(function(t){Ni(t.element(),"background-color",n.event().color())}),Uo(t,ly,{name:e.name})}),$o(dx,function(n,e){oy.getField(n).each(function(t){Bf.setValue(t,e.event().value()),Ll.getCurrent(n).each(eg.focus)})}),$o(mx,function(n,t){oy.getField(n).each(function(t){Ll.getCurrent(n).each(eg.focus)})})])])})},px=function(t,n,e){return{hue:t,saturation:n,value:e}},hx=Wr("rgb-hex-update"),vx=Wr("slider-update"),bx=Wr("palette-update"),yx=al({schema:[Nn("dom")],name:"label"}),xx=function(n){return al({name:n+"-edge",overrides:function(t){return t.model.manager.edgeActions[n].fold(function(){return{}},function(o){return{events:qo([Qo($e(),function(t,n,e){return o(t,e)},[t]),Qo(no(),function(t,n,e){return o(t,e)},[t]),Qo(eo(),function(t,n,e){e.mouseIsDown.get()&&o(t,e)},[t])])}})}})},wx=xx("top-left"),Sx=xx("top"),kx=xx("top-right"),Cx=xx("right"),Ox=xx("bottom-right"),_x=xx("bottom"),Tx=xx("bottom-left"),Ex=[yx,xx("left"),Cx,Sx,_x,wx,kx,Tx,Ox,il({name:"thumb",defaults:at({dom:{styles:{position:"absolute"}}}),overrides:function(t){return{events:qo([tr($e(),t,"spectrum"),tr(Qe(),t,"spectrum"),tr(Ze(),t,"spectrum"),tr(no(),t,"spectrum"),tr(eo(),t,"spectrum"),tr(ro(),t,"spectrum")])}}}),il({schema:[ce("mouseIsDown",function(){return se(!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)})};return{behaviours:Ka([Gm.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)}}),eg.config({})]),events:qo([$o($e(),r),$o(Qe(),r),$o(no(),r),$o(eo(),function(t,n){e.mouseIsDown.get()&&r(t,n)})])}}})],Bx=at("slider.change.value"),Dx=function(t){var n=t.event().raw();if(-1!==n.type.indexOf("touch")){return n.touches!==undefined&&1===n.touches.length?st.some(n.touches[0]).map(function(t){return mu(t.clientX,t.clientY)}):st.none()}return n.clientX!==undefined?st.some(n).map(function(t){return mu(t.clientX,t.clientY)}):st.none()},Mx=function(t){return t.model.minX},Ax=function(t){return t.model.minY},Fx=function(t){return t.model.minX-1},Ix=function(t){return t.model.minY-1},Rx=function(t){return t.model.maxX},Vx=function(t){return t.model.maxY},Px=function(t){return t.model.maxX+1},Hx=function(t){return t.model.maxY+1},zx=function(t,n,e){return n(t)-e(t)},Nx=function(t){return zx(t,Rx,Mx)},Lx=function(t){return zx(t,Vx,Ax)},jx=function(t){return Nx(t)/2},Ux=function(t){return Lx(t)/2},Wx=function(t){return t.stepSize},Gx=function(t){return t.snapToGrid},Xx=function(t){return t.snapStart},Yx=function(t){return t.rounded},qx=function(t,n){return t[n+"-edge"]!==undefined},Kx=function(t){return qx(t,"left")},Jx=function(t){return qx(t,"right")},$x=function(t){return qx(t,"top")},Qx=function(t){return qx(t,"bottom")},Zx=function(t){return t.model.value.get()},tw=function(t){return{x:at(t)}},nw=function(t){return{y:at(t)}},ew=function(t,n){return{x:at(t),y:at(n)}},ow=function(t,n){Uo(t,Bx(),{value:n})},rw=function(t,n,e,o){return t<n?t:e<t?e:t===n?n-1:Math.max(n,t-o)},iw=function(t,n,e,o){return e<t?t:t<n?n:t===e?e+1:Math.min(e,t+o)},uw=function(t,n,e){return Math.max(n,Math.min(e,t))},aw=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=uw(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 uw(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},cw=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},sw="left",fw=function(t){return t.element().dom().getBoundingClientRect()},lw=function(t,n){return t[n]},dw=function(t){var n=fw(t);return lw(n,sw)},mw=function(t){var n=fw(t);return lw(n,"right")},gw=function(t){var n=fw(t);return lw(n,"top")},pw=function(t){var n=fw(t);return lw(n,"bottom")},hw=function(t){var n=fw(t);return lw(n,"width")},vw=function(t){var n=fw(t);return lw(n,"height")},bw=function(t,n,e){return(t+n)/2-e},yw=function(t,n){var e=fw(t),o=fw(n),r=lw(e,sw),i=lw(e,"right"),u=lw(o,sw);return bw(r,i,u)},xw=function(t,n){var e=fw(t),o=fw(n),r=lw(e,"top"),i=lw(e,"bottom"),u=lw(o,"top");return bw(r,i,u)},ww=function(t,n){Uo(t,Bx(),{value:n})},Sw=function(t){return{x:at(t)}},kw=function(t,n,e){var o={min:Mx(n),max:Rx(n),range:Nx(n),value:e,step:Wx(n),snap:Gx(n),snapStart:Xx(n),rounded:Yx(n),hasMinEdge:Kx(n),hasMaxEdge:Jx(n),minBound:dw(t),maxBound:mw(t),screenRange:hw(t)};return aw(o)},Cw=function(i){return function(t,n){return e=t,r=(0<i?iw:rw)(Zx(o=n).x(),Mx(o),Rx(o),Wx(o)),ww(e,Sw(r)),st.some(r).map(function(){return!0});var e,o,r}},Ow=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=hw(u=n),d=s.bind(function(t){return st.some(yw(t,u))}).getOr(0),m=f.bind(function(t){return st.some(yw(t,u))}).getOr(l),g={min:Mx(a),max:Rx(a),range:Nx(a),value:c,hasMinEdge:Kx(a),hasMaxEdge:Jx(a),minBound:dw(u),minOffset:0,maxBound:mw(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},cw(g));return dw(n)-dw(t)+p},_w=Cw(-1),Tw=Cw(1),Ew=st.none,Bw=st.none,Dw={"top-left":st.none(),top:st.none(),"top-right":st.none(),right:st.some(function(t,n){ow(t,tw(Px(n)))}),"bottom-right":st.none(),bottom:st.none(),"bottom-left":st.none(),left:st.some(function(t,n){ow(t,tw(Fx(n)))})},Mw=/* */Object.freeze({__proto__:null,setValueFrom:function(t,n,e){var o=kw(t,n,e),r=Sw(o);return ww(t,r),o},setToMin:function(t,n){var e=Mx(n);ww(t,Sw(e))},setToMax:function(t,n){var e=Rx(n);ww(t,Sw(e))},findValueOfOffset:kw,getValueFromEvent:function(t){return Dx(t).map(function(t){return t.left()})},findPositionOfValue:Ow,setPositionFromValue:function(t,n,e,o){var r=Zx(e),i=Ow(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=bu(n.element())/2;Ni(n.element(),"left",i-u+"px")},onLeft:_w,onRight:Tw,onUp:Ew,onDown:Bw,edgeActions:Dw}),Aw=function(t,n){Uo(t,Bx(),{value:n})},Fw=function(t){return{y:at(t)}},Iw=function(t,n,e){var o={min:Ax(n),max:Vx(n),range:Lx(n),value:e,step:Wx(n),snap:Gx(n),snapStart:Xx(n),rounded:Yx(n),hasMinEdge:$x(n),hasMaxEdge:Qx(n),minBound:gw(t),maxBound:pw(t),screenRange:vw(t)};return aw(o)},Rw=function(i){return function(t,n){return e=t,r=(0<i?iw:rw)(Zx(o=n).y(),Ax(o),Vx(o),Wx(o)),Aw(e,Fw(r)),st.some(r).map(function(){return!0});var e,o,r}},Vw=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=vw(u=n),d=s.bind(function(t){return st.some(xw(t,u))}).getOr(0),m=f.bind(function(t){return st.some(xw(t,u))}).getOr(l),g={min:Ax(a),max:Vx(a),range:Lx(a),value:c,hasMinEdge:$x(a),hasMaxEdge:Qx(a),minBound:gw(u),minOffset:0,maxBound:pw(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},cw(g));return gw(n)-gw(t)+p},Pw=st.none,Hw=st.none,zw=Rw(-1),Nw=Rw(1),Lw={"top-left":st.none(),top:st.some(function(t,n){ow(t,nw(Ix(n)))}),"top-right":st.none(),right:st.none(),"bottom-right":st.none(),bottom:st.some(function(t,n){ow(t,nw(Hx(n)))}),"bottom-left":st.none(),left:st.none()},jw=/* */Object.freeze({__proto__:null,setValueFrom:function(t,n,e){var o=Iw(t,n,e),r=Fw(o);return Aw(t,r),o},setToMin:function(t,n){var e=Ax(n);Aw(t,Fw(e))},setToMax:function(t,n){var e=Vx(n);Aw(t,Fw(e))},findValueOfOffset:Iw,getValueFromEvent:function(t){return Dx(t).map(function(t){return t.top()})},findPositionOfValue:Vw,setPositionFromValue:function(t,n,e,o){var r=Zx(e),i=Vw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),u=fu(n.element())/2;Ni(n.element(),"top",i-u+"px")},onLeft:Pw,onRight:Hw,onUp:zw,onDown:Nw,edgeActions:Lw}),Uw=function(t,n){Uo(t,Bx(),{value:n})},Ww=function(t,n){return{x:at(t),y:at(n)}},Gw=function(c,s){return function(t,n){return o=t,r=n,i=0<c?iw:rw,u=(e=s)?Zx(r).x():i(Zx(r).x(),Mx(r),Rx(r),Wx(r)),a=e?i(Zx(r).y(),Ax(r),Vx(r),Wx(r)):Zx(r).y(),Uw(o,Ww(u,a)),st.some(u).map(function(){return!0});var e,o,r,i,u,a}},Xw=Gw(-1,!1),Yw=Gw(1,!1),qw=Gw(-1,!0),Kw=Gw(1,!0),Jw={"top-left":st.some(function(t,n){ow(t,ew(Fx(n),Ix(n)))}),top:st.some(function(t,n){ow(t,ew(jx(n),Ix(n)))}),"top-right":st.some(function(t,n){ow(t,ew(Px(n),Ix(n)))}),right:st.some(function(t,n){ow(t,ew(Px(n),Ux(n)))}),"bottom-right":st.some(function(t,n){ow(t,ew(Px(n),Hx(n)))}),bottom:st.some(function(t,n){ow(t,ew(jx(n),Hx(n)))}),"bottom-left":st.some(function(t,n){ow(t,ew(Fx(n),Hx(n)))}),left:st.some(function(t,n){ow(t,ew(Fx(n),Ux(n)))})},$w=/* */Object.freeze({__proto__:null,setValueFrom:function(t,n,e){var o=kw(t,n,e.left()),r=Iw(t,n,e.top()),i=Ww(o,r);return Uw(t,i),i},setToMin:function(t,n){var e=Mx(n),o=Ax(n);Uw(t,Ww(e,o))},setToMax:function(t,n){var e=Rx(n),o=Vx(n);Uw(t,Ww(e,o))},getValueFromEvent:function(t){return Dx(t)},setPositionFromValue:function(t,n,e,o){var r=Zx(e),i=Ow(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=Vw(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),a=bu(n.element())/2,c=fu(n.element())/2;Ni(n.element(),"left",i-a+"px"),Ni(n.element(),"top",u-c+"px")},onLeft:Xw,onRight:Yw,onUp:qw,onDown:Kw,edgeActions:Jw}),Qw=Vl({name:"Slider",configFields:[te("stepSize",1),te("onChange",Z),te("onChoose",Z),te("onInit",Z),te("onDragStart",Z),te("onDragEnd",Z),te("snapToGrid",!1),te("rounded",!0),qn("snapStart"),Ln("model",Dn("mode",{x:[te("minX",0),te("maxX",100),ce("value",function(t){return se(t.mode.minX)}),Nn("getInitialValue"),la("manager",Mw)],y:[te("minY",0),te("maxY",100),ce("value",function(t){return se(t.mode.minY)}),Nn("getInitialValue"),la("manager",jw)],xy:[te("minX",0),te("maxX",100),te("minY",0),te("maxY",100),ce("value",function(t){return se({x:at(t.mode.minX),y:at(t.mode.minY)})}),Nn("getInitialValue"),la("manager",$w)]})),Df("sliderBehaviours",[Gm,Bf]),ce("mouseIsDown",function(){return se(!1)})],partFields:Ex,factory:function(i,t,n,e){var o,u=function(t){return xl(t,i,"thumb")},a=function(t){return xl(t,i,"spectrum")},r=function(t){return yl(t,i,"left-edge")},c=function(t){return yl(t,i,"right-edge")},s=function(t){return yl(t,i,"top-edge")},f=function(t){return yl(t,i,"bottom-edge")},l=i.model,d=l.manager,m=function(t,n){d.setPositionFromValue(t,n,i,{getLeftEdge:r,getRightEdge:c,getTopEdge:s,getBottomEdge:f,getSpectrum:a})},g=function(t,n){l.value.set(n);var e=u(t);return m(t,e),i.onChange(t,e,n),st.some(!0)},p=function(e){var t=i.mouseIsDown.get();i.mouseIsDown.set(!1),t&&yl(e,i,"thumb").each(function(t){var n=l.value.get();i.onChoose(e,t,n)})},h=function(t,n){n.stop(),i.mouseIsDown.set(!0),i.onDragStart(t,u(t))},v=function(t,n){n.stop(),i.onDragEnd(t,u(t)),p(t)};return{uid:i.uid,dom:i.dom,components:t,behaviours:Af(i.sliderBehaviours,[Gm.config({mode:"special",focusIn:function(t){return yl(t,i,"spectrum").map(Gm.focusIn).map(at(!0))}}),Bf.config({store:{mode:"manual",getValue:function(t){return l.value.get()}}}),oc.config({channels:((o={})[df()]={onReceive:p},o)})]),events:qo([$o(Bx(),function(t,n){g(t,n.event().value())}),rr(function(t,n){var e=l.getInitialValue();l.value.set(e);var o=u(t);m(t,o);var r=a(t);i.onInit(t,o,r,l.value.get())}),$o($e(),h),$o(Ze(),v),$o(no(),h),$o(ro(),v)]),apis:{resetToMin:function(t){d.setToMin(t,i)},resetToMax:function(t){d.setToMax(t,i)},changeValue:g,refresh:m},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)}}}),Zw=[Df("formBehaviours",[Bf])],tS=function(t){return"<alloy.field."+t+">"},nS=function(o,t){return{uid:o.uid,dom:o.dom,components:t,behaviours:Af(o.formBehaviours,[Bf.config({store:{mode:"manual",getValue:function(t){var n=Sl(t,o);return Tt(n,function(t,r){return t().bind(function(t){var n,e,o=Ll.getCurrent(t);return n=o,e=new Error("Cannot find a current component to extract the value from for form part '"+r+"': "+Nr(t.element())),n.fold(function(){return ut.error(e)},ut.value)}).map(Bf.getValue)})},setValue:function(e,t){_t(t,function(n,t){yl(e,o,t).each(function(t){Ll.getCurrent(t).each(function(t){Bf.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return yl(t,o,n).bind(Ll.getCurrent)}}}},eS={getField:ii(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),gl("form",tS(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=V(r,function(t){return il({name:t,pname:tS(t)})});return Bl("form",Zw,i,nS,o)}},oS=Wr("valid-input"),rS=Wr("invalid-input"),iS=Wr("validating-input"),uS="colorcustom.rgb.",aS=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(uS+"range"),c=[oy.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),oy.parts().field({data:r,factory:Cy,inputAttributes:et({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:Ka([(i=n,u=t,Gy.config({invalidClass:m("invalid"),notify:{onValidate:function(t){Uo(t,iS,{type:i})},onValid:function(t){Uo(t,oS,{type:i,value:Bf.getValue(t)})},onInvalid:function(t){Uo(t,rS,{type:i,value:Bf.getValue(t)})}},validator:{validate:function(t){var n=Bf.getValue(t),e=u(n)?ut.value(!0):ut.error(d("aria.input.invalid"));return Ry(e)},validateOnLoad:!1}})),uy.config({})]),onSetValue:function(t){Gy.isInvalid(t)&&Gy.run(t).get(Z)}})],s="hex"!==n?[oy.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;Bf.setValue(t,{red:e,green:o,blue:r})},b=Zg({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){Ni(t.element(),"background-color","#"+n.value)})};return Rl({factory:function(){var e={red:se(st.some(255)),green:se(st.some(255)),blue:se(st.some(255)),hex:se(st.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",st.some(n)),i("green",st.some(e)),i("blue",st.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),st.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,st.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return Nv(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=Iv(t),eS.getField(n,"hex").each(function(t){eg.isFocused(t)||Bf.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=Ev(n);i("hex",st.some(n));var o=Uv(e);v(t,o),r(o),Uo(t,hx,{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(uS+t+".label"),description:d(uS+t+".description")}},c=t("red"),s=t("green"),f=t("blue"),l=t("hex");return zt(eS.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",oy.sketch(h(Lv,"red",c.label,c.description,255))),t.field("green",oy.sketch(h(Lv,"green",s.label,s.description,255))),t.field("blue",oy.sketch(h(Lv,"blue",f.label,f.description,255))),t.field("hex",oy.sketch(h(Mv,"hex",l.label,l.description,"ffffff"))),b.asSpec()],formBehaviours:Ka([Gy.config({invalidClass:m("form-invalid")}),$m("rgb-form-events",[$o(oS,a),$o(rS,n),$o(iS,n)])])}}),{apis:{updateHex:function(t,n){var e,o;Bf.setValue(t,{hex:n.value}),e=t,o=Uv(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},cS=function(t,o){var r=Qw.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),i=Qw.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 Rl({factory:function(t){var n=at({x:at(0),y:at(0)}),e=Ka([Ll.config({find:st.some}),eg.config({})]);return Qw.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){Uo(t,bx,{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),Gv(Xv))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,Gv(o))}},extraApis:{}})},sS=function(l,d){return Rl({name:"ColourPicker",configFields:[Nn("dom"),te("onValidHex",Z),te("onInvalidHex",Z)],factory:function(t){var a,v,n,e,o,r=aS(l,d,t.onValidHex,t.onInvalidHex),i=cS(0,d),b={paletteRgba:se(Xv)},u=Zg(i.sketch({})),c=Zg(r.sketch({})),s=function(t,e){u.getOpt(t).each(function(t){var n=Uv(e);b.paletteRgba.set(n),i.setRgba(t,n)})},f=function(t,n){c.getOpt(t).each(function(t){r.updateHex(t,n)})},y=function(n,e,t){rt(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[u.asSpec(),(n=d,e=Qw.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=Qw.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}}),Qw.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:at({y:at(0)})},components:[e,o],sliderBehaviours:Ka([eg.config({})]),onChange:function(t,n,e){Uo(t,vx,{value:e})}})),c.asSpec()],behaviours:Ka([$m("colour-picker-events",[$o(bx,(v=[f],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?px(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,px(Math.round(r),Math.round(100*o),Math.round(100*i)))),g=px(m.hue,l.x(),100-l.y()),p=jv(g),h=Iv(p);y(t,h,v)})),$o(vx,(a=[s,f],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=px((100-e)/100*360,100,100),r=jv(o),Iv(r));y(t,u,a)}))]),Ll.config({find:function(t){return c.getOpt(t)}}),Gm.config({mode:"acyclic"})])}}})},fS=function(){return Ll.config({find:st.some})},lS=function(t){return Ll.config({find:t.getOpt})},dS=function(t){return Ll.config({find:function(n){return wr(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},mS={"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"},gS=function(t){return mS[t]},pS=tinymce.util.Tools.resolve("tinymce.Resource"),hS=ln([te("preprocess",ct),te("postprocess",ct)]),vS=function(t,n,e){return Bf.config(zt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},bS=function(t,n,e){return vS(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},yS=function(r,t){var i=Tn("RepresentingConfigs.memento processors",hS,t);return Bf.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=Bf.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);Bf.setValue(o,e)}}})},xS=vS,wS=function(t){return bS(t,Dr,Mr)},SS=function(t){return Bf.config({store:{mode:"memory",initialValue:t}})},kS=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){rt(t,function(t){t(n,e)})}},i=function(t,n){if(!Dh.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;Bf.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),H(J(e),function(t){return o.test(t.name)}))),Uo(t,ly,{name:r.name})},c=Zg({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:Ka([$m("input-file-events",[er(mo()),er(ko())])])}),t=r.label.map(function(t){return fy(t,n)}),s=oy.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:Ka([SS([]),fS(),Dh.config({}),gg.config({toggleClass:"dragenter",toggleOnExecute:!1}),$m("dropzone-events",[$o("dragenter",o([e,gg.toggle])),$o("dragleave",o([e,gg.toggle])),$o("dragover",e),$o("drop",o([e,i])),$o(lo(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},Qg.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:Ka([uy.config({}),ov(n.isReadOnly),nv()])})]}]}}}});return ay(t,s,["tox-form__group--stretched"],[])},CS=Wr("alloy-fake-before-tabstop"),OS=Wr("alloy-fake-after-tabstop"),_S=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:Ka([eg.config({ignore:!0}),uy.config({})])}},TS=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[_S([CS]),t,_S([OS])],behaviours:Ka([dS(1)])}},ES=function(t,n){Uo(t,co(),{raw:{which:9,shiftKey:n}})},BS=function(t,n){var e=n.element();Oi(e,CS)?ES(t,!0):Oi(e,OS)&&ES(t,!1)},DS=function(t){return Ab(t,["."+CS,"."+OS].join(","),at(!1))},MS=!(ze().browser.isIE()||ze().browser.isEdge()),AS=function(t,n){var o,r,e=MS&&t.sandboxed,i=et(et({},t.label.map(function(t){return{title:t}}).getOr({})),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=se(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)Fr(t.element(),"srcdoc",n);else{Fr(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 fy(t,n)}),c=oy.parts().field({factory:{sketch:function(t){return TS({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:Ka([uy.config({}),eg.config({}),xS(st.none(),u.getValue,u.setValue)])})}}});return ay(a,c,["tox-form__group--stretched"],[])};function FS(t,n){return VS(nt.document.createElement("canvas"),t,n)}function IS(t){var n=FS(t.width,t.height);return RS(n).drawImage(t,0,0),n}function RS(t){return t.getContext("2d")}function VS(t,n,e){return t.width=n,t.height=e,t}function PS(t){return t.naturalWidth||t.width}function HS(t){return t.naturalHeight||t.height}var zS,NS,LS,jS=window.Promise?window.Promise:(NS=(zS=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=[],KS(t,US(GS,this),US(XS,this))}).immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){nt.setTimeout(t,1)},LS=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},zS.prototype["catch"]=function(t){return this.then(null,t)},zS.prototype.then=function(e,o){var r=this;return new zS(function(t,n){WS.call(r,new qS(e,o,t,n))})},zS.all=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var c=Array.prototype.slice.call(1===t.length&&LS(t[0])?t[0]:t);return new zS(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])})},zS.resolve=function(n){return n&&"object"==typeof n&&n.constructor===zS?n:new zS(function(t){t(n)})},zS.reject=function(e){return new zS(function(t,n){n(e)})},zS.race=function(r){return new zS(function(t,n){for(var e=0,o=r;e<o.length;e++)o[e].then(t,n)})},zS);function US(t,n){return function(){return t.apply(n,arguments)}}function WS(o){var r=this;null!==this._state?NS(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 GS(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 KS(US(n,t),US(GS,this),US(XS,this))}this._state=!0,this._value=t,YS.call(this)}catch(e){XS.call(this,e)}}function XS(t){this._state=!1,this._value=t,YS.call(this)}function YS(){for(var t=0,n=this._deferreds;t<n.length;t++){var e=n[t];WS.call(this,e)}this._deferreds=[]}function qS(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 KS(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)}}function JS(e){return new jS(function(t,n){(function p(t){var n=t.split(","),e=/data:([^;]+)/.exec(n[0]);if(!e)return st.none();for(var o=e[1],r=n[1],i=nt.atob(r),u=i.length,a=Math.ceil(u/1024),c=new Array(a),s=0;s<a;++s){for(var f=1024*s,l=Math.min(1024+f,u),d=new Array(l-f),m=f,g=0;m<l;++g,++m)d[g]=i[m].charCodeAt(0);c[s]=new Uint8Array(d)}return st.some(new nt.Blob(c,{type:o}))})(e).fold(function(){n("uri is not base64: "+e)},t)})}function $S(t,o,r){return o=o||"image/png",nt.HTMLCanvasElement.prototype.toBlob?new jS(function(n,e){t.toBlob(function(t){t?n(t):e()},o,r)}):JS(t.toDataURL(o,r))}function QS(t){return function n(a){return new jS(function(t,n){var e=nt.URL.createObjectURL(a),o=new nt.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){nt.URL.revokeObjectURL(t.src)}(t);var n=FS(PS(t),HS(t));return RS(n).drawImage(t,0,0),n})}function ZS(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:at(o),toBlob:function i(){return jS.resolve(n)},toDataURL:at(e),toBase64:function u(){return e.split(",")[1]},toAdjustedBlob:function a(n,e){return t.then(function(t){return $S(t,n,e)})},toAdjustedDataURL:r,toAdjustedBase64:function c(t,n){return r(t,n).then(function(t){return t.split(",")[1]})},toCanvas:function s(){return t.then(IS)}}}function tk(n){return function t(e){return new jS(function(t){var n=new nt.FileReader;n.onloadend=function(){t(n.result)},n.readAsDataURL(e)})}(n).then(function(t){return ZS(QS(n),n,t)})}function nk(n,t){return $S(n,t).then(function(t){return ZS(jS.resolve(n),t,n.toDataURL())})}function ek(t,n,e){var o="string"==typeof t?parseFloat(t):t;return e<o?o=e:o<n&&(o=n),o}function ok(){return[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]}var rk=[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 ik(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 uk(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=RS(t);var r=function E(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],_=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+_;return t}(o.getImageData(0,0,t.width,t.height),e);return o.putImageData(r,0,0),nk(t,n)}(t,n.getType(),e)})}function ak(n,e){return n.toCanvas().then(function(t){return function u(t,n,e){var o=RS(t);var r=o.getImageData(0,0,t.width,t.height),i=o.getImageData(0,0,t.width,t.height);return i=function w(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=4*(o(f+p-i,0,s-1)*c+v),y=e[p*r+h];d+=u[b]*y,m+=u[1+b]*y,g+=u[2+b]*y}var x=4*(f*c+l);a[x]=o(d,0,255),a[1+x]=o(m,0,255),a[2+x]=o(g,0,255)}return n}(r,i,e),o.putImageData(i,0,0),nk(t,n)}(t,n.getType(),e)})}function ck(e){return function(t,n){return uk(t,e(ok(),n))}}var sk=function QF(n){return function(t){return uk(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]),fk=ck(function ZF(t,n){return ik(t,[1,0,0,0,n=ek(255*n,-255,255),0,1,0,0,n,0,0,1,0,n,0,0,0,1,0,0,0,0,0,1])}),lk=ck(function tI(t,n){var e;return n=ek(n,-1,1),ik(t,[(e=(n*=100)<0?127+n/100*127:127*(e=0===(e=n%1)?rk[n]:rk[Math.floor(n)]*(1-e)+rk[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])}),dk=function(t,n,e,o){return uk(t,function r(t,n,e,o){return ik(t,[n=ek(n,0,2),0,0,0,0,0,e=ek(e,0,2),0,0,0,0,0,o=ek(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])}(ok(),n,e,o))},mk=function nI(n){return function(t){return ak(t,n)}}([0,-1,0,-1,5,-1,0,-1,0]),gk=function eI(c){var o=function(t,n,e){var o=RS(t),r=new Array(256);for(var 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),nk(t,n)};return function(n,e){return n.toCanvas().then(function(t){return o(t,n.getType(),e)})}}(function(t,n){return 255*Math.pow(t/255,1-n)});function pk(t,n,e){var o=PS(t),r=HS(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 s(u,a,c){return new jS(function(t){var n=PS(u),e=HS(u),o=Math.floor(n*a),r=Math.floor(e*c),i=FS(o,r);RS(i).drawImage(u,0,0,n,e,0,0,o,r),t(i)})}(t,i,u);return a?c.then(function(t){return pk(t,n,e)}):c}function hk(n,e){return n.toCanvas().then(function(t){return function a(t,n,e){var o=FS(t.width,t.height),r=RS(o),i=0,u=0;90!==(e=e<0?360+e:e)&&270!==e||VS(o,o.height,o.width);90!==e&&180!==e||(i=o.width);270!==e&&180!==e||(u=o.height);return r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(t,0,0),nk(o,n)}(t,n.getType(),e)})}function vk(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=FS(t.width,t.height),r=RS(o);"v"===e?(r.scale(1,-1),r.drawImage(t,0,-o.height)):(r.scale(-1,1),r.drawImage(t,-o.width,0));return nk(o,n)}(t,n.getType(),e)})}function bk(n,e,o,r,i){return n.toCanvas().then(function(t){return function a(t,n,e,o,r,i){var u=FS(r,i);return RS(u).drawImage(t,-e,-o),nk(u,n)}(t,n.getType(),e,o,r,i)})}var yk=function(t){return sk(t)},xk=function(t){return mk(t)},wk=function(t,n){return gk(t,n)},Sk=function(t,n){return fk(t,n)},kk=function(t,n){return lk(t,n)},Ck=function(t,n){return vk(t,n)},Ok=function(t,n,e){return function r(n,e,o){return n.toCanvas().then(function(t){return pk(t,e,o).then(function(t){return nk(t,n.getType())})})}(t,n,e)},_k=function(t,n){return hk(t,n)},Tk=function(t,n){return et({dom:{tag:"span",innerHtml:t,classes:["tox-icon","tox-tbtn__icon-wrap"]}},n)},Ek=function(t,n){return Tk(np(t,n),{})},Bk=function(t,n){return Tk(np(t,n),{behaviours:Ka([Jm.config({})])})},Dk=function(t,n,e){return{dom:{tag:"span",innerHtml:e.translate(t),classes:[n+"__select-label"]},behaviours:Ka([Jm.config({})])}},Mk=Wr("toolbar.button.execute"),Ak={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},Fk=Wr("update-menu-text"),Ik=Wr("update-menu-icon"),Rk=function(t,n,o){var e=se(Z),r=t.text.map(function(t){return Zg(Dk(t,n,o.providers))}),i=t.icon.map(function(t){return Zg(Bk(t,o.providers.icons))}),u=function(t,n){var e=Bf.getValue(t);return eg.focus(e),Uo(e,"keydown",{raw:n.event().raw()}),sx.close(e),st.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 Zg(sx.sketch(et(et({},a),{dom:{tag:"button",classes:[n,n+"--select"].concat(V(t.classes,function(t){return n+"--"+t})),attributes:et({},c)},components:fv([i.map(function(t){return t.asSpec()}),r.map(function(t){return t.asSpec()}),st.some({dom:{tag:"div",classes:[n+"__select-chevron"],innerHtml:np("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:Ka(b(t.dropdownBehaviours,[ov(function(){return t.disabled||o.providers.isReadOnly()}),nv(),fx.config({}),Jm.config({}),$m("dropdown-events",[av(t,e),cv(t,e)]),$m("menubutton-update-display-text",[$o(Fk,function(n,e){r.bind(function(t){return t.getOpt(n)}).each(function(t){Jm.set(t,[ou(o.providers.translate(e.event().text()))])})}),$o(Ik,function(n,e){i.bind(function(t){return t.getOpt(n)}).each(function(t){Jm.set(t,[Bk(e.event().icon(),o.providers.icons)])})})])])),eventOrder:zt(Ak,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:Ka([Gm.config({mode:"special",onLeft:u,onRight:u})]),lazySink:o.getSink,toggleClass:n+"--active",parts:{menu:Wp(0,t.columns,t.presets)},fetch:function(){return Iy(t.fetch)}}))).asSpec()},Vk=function(t){return"separator"===t.type},Pk={type:"separator"},Hk=function(t,e){var n=N(t,function(t,n){return w(n)?""===n?t:"|"===n?0<t.length&&!Vk(t[t.length-1])?t.concat([Pk]):t:It(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])},[]);return 0<n.length&&Vk(n[n.length-1])&&n.pop(),n},zk=function(t,n){return It(t,"getSubmenuItems")?(o=n,r=(e=t).getSubmenuItems(),i=Nk(r,o),{item:e,menus:zt(i.menus,Jt(e.value,i.items)),expansions:zt(i.expansions,Jt(e.value,e.value))}):{item:t,menus:{},expansions:{}};var e,o,r,i},Nk=function(t,r){var n=Hk(w(t)?t.split(" "):t,r);return z(n,function(t,n){var e=function(t){if(Vk(t))return t;var n=Ft(t,"value").getOrThunk(function(){return Wr("generated-menu-item")});return zt({value:n},t)}(n),o=zk(e,r);return{menus:zt(t.menus,o.menus),items:[o.item].concat(t.items),expansions:zt(t.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},Lk=function(t,e,o,n){var r=Wr("primary-menu"),i=Nk(t,o.shared.providers.menuItems());if(0===i.items.length)return st.none();var u=Ob(r,i.items,e,o,n),a=Tt(i.menus,function(t,n){return Ob(n,t,e,o,!1)}),c=zt(a,Jt(r,u));return st.from(Hg.tieredData(r,c,i.expansions))},jk=function(e){return{isDisabled:function(){return Dh.isDisabled(e)},setDisabled:function(t){return Dh.set(e,t)},setActive:function(t){var n=e.element();t?(Si(n,"tox-tbtn--enabled"),Fr(n,"aria-pressed",!0)):(Ci(n,"tox-tbtn--enabled"),Pr(n,"aria-pressed"))},isActive:function(){return Oi(e.element(),"tox-tbtn--enabled")}}},Uk=function(t,n,e,o){return Rk({text:t.text,icon:t.icon,tooltip:t.tooltip,role:o,fetch:function(n){t.fetch(function(t){n(Lk(t,Mp.CLOSE_ON_EXECUTE,e,!1))})},onSetup:t.onSetup,getApi:jk,columns:1,presets:"normal",classes:[],dropdownBehaviours:[uy.config({})]},n,e.shared)},Wk=function(n,r,i){return function(t){t(V(n,function(t){var n,e,o=t.text.fold(function(){return{}},function(t){return{text:t}});return et(et({type:t.type,active:!1},o),{onAction:function(t){var n=!t.isActive();t.setActive(n),e.storage.set(n),i.shared.getSink().each(function(t){r().getOpt(t).each(function(t){ic(t.element()),Uo(t,gy,{name:e.name,value:e.storage.get()})})})},onSetup:(n=e=t,function(t){t.setActive(n.storage.get())})})}))}},Gk=function(t,n,e,o,r,i){void 0===e&&(e=[]);var u=n.fold(function(){return{}},function(t){return{action:t}}),a=et({buttonBehaviours:Ka([ov(function(){return t.disabled||i.isReadOnly()}),nv(),uy.config({}),$m("button press",[Jo("click"),Jo("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},u),c=zt(a,{dom:o});return zt(c,{components:r})},Xk=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 Ek(t,e.icons)}),u=fv([i]);return Gk(t,n,o,r,u,e)},Yk=function(t,n,e,o){void 0===o&&(o=[]);var r=Xk(t,st.some(n),e,o);return Qg.sketch(r)},qk=function(t,n,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=e.translate(t.text),u=t.icon?t.icon.map(function(t){return Ek(t,e.icons)}):st.none(),a=u.isSome()?fv([u]):[],c=u.isSome()?{}:{innerHtml:i},s=b(t.primary||t.borderless?["tox-button"]:["tox-button","tox-button--secondary"],u.isSome()?["tox-button--icon"]:[],t.borderless?["tox-button--naked"]:[],r),f=et(et({tag:"button",classes:s},c),{attributes:{title:i}});return Gk(t,n,o,f,a,e)},Kk=function(t,n,e,o,r){void 0===o&&(o=[]),void 0===r&&(r=[]);var i=qk(t,st.some(n),e,o,r);return Qg.sketch(i)},Jk=function(n,e){return function(t){"custom"===e?Uo(t,gy,{name:n,value:{}}):"submit"===e?jo(t,py):"cancel"===e?jo(t,my):nt.console.error("Unknown button type: ",e)}},$k=function(n,t,e){if("menu"===t){var o=n,r=et(et({},n),{onSetup:function(t){return t.setDisabled(n.disabled),Z},fetch:Wk(o.items,function(){return i},e)}),i=Zg(Uk(r,"tox-tbtn",e,st.none()));return i.asSpec()}if("custom"===(c=t)||"cancel"===c||"submit"===c){var u=Jk(n.name,t),a=et(et({},n),{borderless:!1});return Kk(a,u,e.shared.providers,[])}var c;nt.console.error("Unknown footer button type: ",t)},Qk=function(t,n){var e,o,r=Jk(t.name,"custom");return e=st.none(),o=oy.parts().field(et({factory:Qg},qk(t,st.some(r),n,[SS(""),fS()]))),ay(e,o,[],[])},Zk=at([te("field1Name","field1"),te("field2Name","field2"),sa("onLockedChange"),ia(["lockClass"]),te("locked",!1),Ff("coupledFieldBehaviours",[Ll,Bf])]),tC=function(t,n){return il({factory:oy,name:t,overrides:function(o){return{fieldBehaviours:Ka([$m("coupled-input-behaviour",[$o(fo(),function(e){yl(e,o,n).bind(Ll.getCurrent).each(function(n){yl(e,o,"lock").each(function(t){gg.isOn(t)&&o.onLockedChange(e,n,t)})})})])])}}})},nC=at([tC("field1","field2"),tC("field2","field1"),il({factory:Qg,schema:[Nn("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:Ka([gg.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),eC=Vl({name:"FormCoupledInputs",configFields:Zk(),partFields:nC(),factory:function(o,t,n,e){return{uid:o.uid,dom:o.dom,components:t,behaviours:If(o.coupledFieldBehaviours,[Ll.config({find:st.some}),Bf.config({store:{mode:"manual",getValue:function(t){var n,e=Cl(t,o,["field1","field2"]);return(n={})[o.field1Name]=Bf.getValue(e.field1()),n[o.field2Name]=Bf.getValue(e.field2()),n},setValue:function(t,n){var e=Cl(t,o,["field1","field2"]);Rt(n,o.field1Name)&&Bf.setValue(e.field1(),n[o.field1Name]),Rt(n,o.field2Name)&&Bf.setValue(e.field2(),n[o.field2Name])}}})]),apis:{getField1:function(t){return yl(t,o,"field1")},getField2:function(t){return yl(t,o,"field2")},getLock:function(t){return yl(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)}}}),oC=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 ut.error(t);var e=parseFloat(n[1]),o=n[2];return ut.value({value:e,unit:o})},rC=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?st.some(t.value):o(t.unit)&&o(n)?e[t.unit]===e[n]?st.some(t.value):st.some(t.value/e[t.unit]*e[n]):st.none()},iC=function(t){return st.none()},uC=function(t,n){var e,o,r,i=oC(t).toOption(),u=oC(n).toOption();return o=u,r=function(t,o){return rC(t,o.unit).map(function(t){return o.value/t}).map(function(t){return n=t,e=o.unit,function(t){return rC(t,e).map(function(t){return{value:t*n,unit:e}})};var n,e}).getOr(iC)},((e=i).isSome()&&o.isSome()?st.some(r(e.getOrDie(),o.getOrDie())):st.none()).getOr(iC)},aC=function(o,n){var a=iC,r=Wr("ratio-event"),t=eC.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:np("lock",n.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:np("unlock",n.icons)}}],buttonBehaviours:Ka([Dh.config({disabled:function(){return o.disabled||n.isReadOnly()}}),nv(),uy.config({})])}),e=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},i=function(e){return oy.parts().field({factory:Cy,inputClasses:["tox-textfield"],inputBehaviours:Ka([Dh.config({disabled:function(){return o.disabled||n.isReadOnly()}}),nv(),uy.config({}),$m("size-input-events",[$o(uo(),function(t,n){Uo(t,r,{isField1:e})}),$o(lo(),function(t,n){Uo(t,ly,{name:o.name})})])]),selectOnFocus:!1})},u=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}}},c=eC.parts().field1(e([oy.parts().label(u("Width")),i(!0)])),s=eC.parts().field2(e([oy.parts().label(u("Height")),i(!1)]));return eC.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){oC(Bf.getValue(t)).each(function(t){a(t).each(function(t){var n,e,o,r;Bf.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:Ka([Dh.config({disabled:function(){return o.disabled||n.isReadOnly()},onDisabled:function(t){eC.getField1(t).bind(oy.getField).each(Dh.disable),eC.getField2(t).bind(oy.getField).each(Dh.disable),eC.getLock(t).each(Dh.disable)},onEnabled:function(t){eC.getField1(t).bind(oy.getField).each(Dh.enable),eC.getField2(t).bind(oy.getField).each(Dh.enable),eC.getLock(t).each(Dh.enable)}}),nv(),$m("size-input-events2",[$o(r,function(t,n){var e=n.event().isField1(),o=e?eC.getField1(t):eC.getField2(t),r=e?eC.getField2(t):eC.getField1(t),i=o.map(Bf.getValue).getOr(""),u=r.map(Bf.getValue).getOr("");a=uC(i,u)})])])})},cC={undo:at(Wr("undo")),redo:at(Wr("redo")),zoom:at(Wr("zoom")),back:at(Wr("back")),apply:at(Wr("apply")),swap:at(Wr("swap")),transform:at(Wr("transform")),tempTransform:at(Wr("temp-transform")),transformApply:at(Wr("transform-apply"))},sC=at("save-state"),fC=at("disable"),lC=at("enable"),dC={formActionEvent:gy,saveState:sC,disable:fC,enable:lC},mC=function(a,c){var t=function(t,n,e,o){return Zg(Kk({name:t,text:t,disabled:e,primary:o,icon:st.none(),borderless:!1},n,c))},n=function(t,n,e,o){return Zg(Yk({name:t,icon:st.some(t),tooltip:st.some(n),disabled:o,primary:!1,borderless:!1},e,c))},u=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Dh)&&Dh.disable(n)})},s=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Dh)&&Dh.enable(n)})},f={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},e=Z,r=function(t,n,e){Uo(t,n,e)},i=function(t){return jo(t,dC.disable())},l=function(t){return jo(t,dC.enable())},d=function(t,n){i(t),r(t,cC.transform(),{transform:n}),l(t)},o=function(t){return function(){Q.getOpt(t).each(function(t){Jm.set(t,[J])})}},m=function(t,n){i(t),r(t,cC.transformApply(),{transform:n,swap:o(t)}),l(t)},g=function(){return t("Back",function(t){return r(t,cC.back(),{swap:o(t)})},!1,!1)},p=function(){return Zg({dom:{tag:"div",classes:["tox-spacer"]},behaviours:Ka([Dh.config({})])})},h=function(){return t("Apply",function(t){return r(t,cC.apply(),{swap:o(t)})},!0,!0)},v=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,bk(n,e,o,r,i)}},b=[g(),p(),t("Apply",function(t){var n=v();m(t,n),a.hideCrop()},!1,!0)],y=Zb.sketch({dom:f,components:b.map(function(t){return t.asSpec()}),containerBehaviours:Ka([$m("image-tools-crop-buttons-events",[$o(dC.disable(),function(t,n){u(b,t)}),$o(dC.enable(),function(t,n){s(b,t)})])])}),x=Zg(aC({name:"size",label:st.none(),constrain:!0,disabled:!1},c)),w=[g(),p(),x,p(),t("Apply",function(a){x.getOpt(a).each(function(t){var n,e,o=Bf.getValue(t),r=parseInt(o.width,10),i=parseInt(o.height,10),u=(n=r,e=i,function(t){return Ok(t,n,e)});m(a,u)})},!1,!0)],S=Zb.sketch({dom:f,components:w.map(function(t){return t.asSpec()}),containerBehaviours:Ka([$m("image-tools-resize-buttons-events",[$o(dC.disable(),function(t,n){u(w,t)}),$o(dC.enable(),function(t,n){s(w,t)})])])}),k=function(n,e){return function(t){return n(t,e)}},C=k(Ck,"h"),O=k(Ck,"v"),_=k(_k,-90),T=k(_k,90),E=function(t,n){var e,o;o=n,i(e=t),r(e,cC.tempTransform(),{transform:o}),l(e)},B=[g(),p(),n("flip-horizontally","Flip horizontally",function(t){E(t,C)},!1),n("flip-vertically","Flip vertically",function(t){E(t,O)},!1),n("rotate-left","Rotate counterclockwise",function(t){E(t,_)},!1),n("rotate-right","Rotate clockwise",function(t){E(t,T)},!1),p(),h()],D=Zb.sketch({dom:f,components:B.map(function(t){return t.asSpec()}),containerBehaviours:Ka([$m("image-tools-fliprotate-buttons-events",[$o(dC.disable(),function(t,n){u(B,t)}),$o(dC.enable(),function(t,n){s(B,t)})])])}),M=function(t,n,e,o,r){var i=Qw.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(t)}}),u=Qw.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=Qw.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Zg(Qw.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:at({x:at(o)})},components:[i,u,a],sliderBehaviours:Ka([eg.config({})]),onChoose:n}))},A=function(t,n,e,o,r){return[g(),(i=n,M(t,function(t,n,e){var o=k(i,e.x()/100);d(t,o)},e,o,r)),h()];var i},F=function(t,n,e,o,r){var i=A(t,n,e,o,r);return Zb.sketch({dom:f,components:i.map(function(t){return t.asSpec()}),containerBehaviours:Ka([$m("image-tools-filter-panel-buttons-events",[$o(dC.disable(),function(t,n){u(i,t)}),$o(dC.enable(),function(t,n){s(i,t)})])])})},I=[g(),p(),h()],R=Zb.sketch({dom:f,components:I.map(function(t){return t.asSpec()})}),V=F("Brightness",Sk,-100,0,100),P=F("Contrast",kk,-100,0,100),H=F("Gamma",wk,-100,0,100),z=function(n,e,o){return function(t){return dk(t,n,e,o)}},N=function(t){return M(t,function(a,t,n){var e=L.getOpt(a),o=U.getOpt(a),r=j.getOpt(a);e.each(function(u){o.each(function(i){r.each(function(t){var n=Bf.getValue(u).x()/100,e=Bf.getValue(t).x()/100,o=Bf.getValue(i).x()/100,r=z(n,e,o);d(a,r)})})})},0,100,200)},L=N("R"),j=N("G"),U=N("B"),W=[g(),L,j,U,h()],G=Zb.sketch({dom:f,components:W.map(function(t){return t.asSpec()})}),X=function(n,e,o){return function(t){r(t,cC.swap(),{transform:e,swap:function(){Q.getOpt(t).each(function(t){Jm.set(t,[n]),o(t)})}})}},Y=st.some(xk),q=st.some(yk),K=[n("crop","Crop",X(y,st.none(),function(t){a.showCrop()}),!1),n("resize","Resize",X(S,st.none(),function(t){x.getOpt(t).each(function(t){var n=a.getMeasurements(),e=n.width,o=n.height;Bf.setValue(t,{width:e,height:o})})}),!1),n("orientation","Orientation",X(D,st.none(),e),!1),n("brightness","Brightness",X(V,st.none(),e),!1),n("sharpen","Sharpen",X(R,Y,e),!1),n("contrast","Contrast",X(P,st.none(),e),!1),n("color-levels","Color levels",X(G,st.none(),e),!1),n("gamma","Gamma",X(H,st.none(),e),!1),n("invert","Invert",X(R,q,e),!1)],J=Zb.sketch({dom:f,components:K.map(function(t){return t.asSpec()})}),$=Zb.sketch({dom:{tag:"div"},components:[J],containerBehaviours:Ka([Jm.config({})])}),Q=Zg($);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]})}}},gC=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),pC=tinymce.util.Tools.resolve("tinymce.geom.Rect"),hC=tinymce.util.Tools.resolve("tinymce.util.Observable"),vC=tinymce.util.Tools.resolve("tinymce.util.Tools"),bC=tinymce.util.Tools.resolve("tinymce.util.VK");function yC(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 xC(t,r){var i,u,a,c,f=r.document||nt.document;r=r||{};var l=f.getElementById(r.handle||t),d=function(t){if(yC(t),t.button!==u)return m(t);t.deltaX=t.screenX-a,t.deltaY=t.screenY-c,t.preventDefault(),r.drag(t)},m=function(t){yC(t),gC(f).off("mousemove touchmove",d).off("mouseup touchend",m),i.remove(),r.stop&&r.stop(t)};this.destroy=function(){gC(l).off()},gC(l).on("mousedown touchstart",function(t){var n,e=function s(t){var n=Math.max,e=t.documentElement,o=t.body,r=n(e.scrollWidth,o.scrollWidth),i=n(e.clientWidth,o.clientWidth),u=n(e.offsetWidth,o.offsetWidth),a=n(e.scrollHeight,o.scrollHeight),c=n(e.clientHeight,o.clientHeight);return{width:r<u?i:r,height:a<n(e.offsetHeight,o.offsetHeight)?c:a}}(f);yC(t),t.preventDefault(),u=t.button;var o=l;a=t.screenX,c=t.screenY,n=nt.window.getComputedStyle?nt.window.getComputedStyle(o,null).getPropertyValue("cursor"):o.runtimeStyle.cursor,i=gC("<div></div>").css({position:"absolute",top:0,left:0,width:e.width,height:e.height,zIndex:2147483647,opacity:1e-4,cursor:n}).appendTo(f.body),gC(f).on("mousemove touchmove",d).on("mouseup touchend",m),r.start(t)})}var wC=0,SC=function(s,e,f,o,r){var n,i="tox-",u="tox-crid-"+wC++,a=[{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"}],c=["top","right","bottom","left"],l=function(t,n){return{x:n.x+t.x,y:n.y+t.y,w:n.w,h:n.h}},d=function(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=pC.clamp({x:r,y:i,w:u,h:a},f,"move"===t.name),c=d(f,c),v.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),gC("#"+u+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}vC.each(a,function(t){gC("#"+u+"-"+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(l(f,t))}!function b(){gC('<div id="'+u+'" class="'+i+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),vC.each(c,function(t){gC("#"+u,o).append('<div id="'+u+"-"+t+'"class="'+i+'croprect-block" style="display: none" data-mce-bogus="all">')}),vC.each(a,function(t){gC("#"+u,o).append('<div id="'+u+"-"+t.name+'" class="'+i+"croprect-handle "+i+"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=vC.map(a,function t(n){var e;return new xC(u,{document:o.ownerDocument,handle:u+"-"+n.name,start:function(){e=s},drag:function(t){m(n,e,t.deltaX,t.deltaY)}})}),g(s),gC(o).on("focusin focusout",function(t){gC(t.target).attr("aria-grabbed","focus"===t.type?"true":"false")}),gC(o).on("keydown",function(n){var i;function t(t,n,e,o,r){t.stopPropagation(),t.preventDefault(),m(i,e,o,r)}switch(vC.each(a,function(t){if(n.target.id===u+"-"+t.name)return i=t,!1}),n.keyCode){case bC.LEFT:t(n,0,s,-10,0);break;case bC.RIGHT:t(n,0,s,10,0);break;case bC.UP:t(n,0,s,0,-10);break;case bC.DOWN:t(n,0,s,0,10);break;case bC.ENTER:case bC.SPACEBAR:n.preventDefault(),r()}})}();var v=vC.extend({toggleVisibility:function y(t){var n=vC.map(a,function(t){return"#"+u+"-"+t.name}).concat(vC.map(c,function(t){return"#"+u+"-"+t})).join(",");t?gC(n,o).show():gC(n,o).hide()},setClampRect:function x(t){f=t,g(s)},setRect:p,getInnerRect:function(){return d(f,s)},setInnerRect:h,setViewPortRect:function w(t){e=t,g(s)},destroy:function t(){vC.each(n,function(t){t.destroy()}),n=[]}},hC);return v},kC=function(n){var f=Zg({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),l=se(1),d=se(st.none()),m=se({x:0,y:0,w:1,h:1}),c=se({x:0,y:0,w:1,h:1}),s=function(t,s){g.getOpt(t).each(function(t){var e=l.get(),o=bu(t.element()),r=fu(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"};Li(s,n),f.getOpt(t).each(function(t){Li(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=le.fromTag("img");return Fr(a,"src",n),e=a.dom(),new bp(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=ru({element:a});Jm.replaceAt(t,1,st.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=pC.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=bu(t.element()),e=fu(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=Zb.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[f.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:Ka([$m("image-panel-crop-events",[rr(function(t){g.getOpt(t).each(function(t){var n=t.element().dom(),e=SC({x:10,y:10,w:100,h:100},{x:0,y:0,w:200,h:200},{x:0,y:0,w:200,h:200},n,function(){});e.toggleVisibility(!1),e.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(st.some(e))})})])])}],containerBehaviours:Ka([Jm.config({}),$m("image-panel-events",[rr(function(t){e(t,n)})])])}),g=Zg(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}}}},CC=function(t,n,e,o,r){return Yk({name:t,icon:st.some(n),disabled:e,tooltip:st.some(t),primary:!1,borderless:!1},o,r)},OC=function(t,n){n?Dh.enable(t):Dh.disable(t)};function _C(){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=e.splice(++o);return 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}}var TC,EC,BC,DC,MC=function(t){var n=se(t),e=se(st.none()),r=_C();r.add(t);var i=function(t){n.set(t)},u=function(t){return{blob:t,url:nt.URL.createObjectURL(t)}},a=function(t){nt.URL.revokeObjectURL(t.url)},o=function(){e.get().each(a),e.set(st.none())},c=function(t){var n=u(t);i(n);var e,o=r.add(n).removed;return e=o,vC.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(st.some(n)),n.url},addTempState:function(t){var n=u(t);return e.set(st.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()}}}},AC=function(t,n){var e,o,r,u=MC(t.currentState),i=function(t){var n=u.getHistoryStates();p.updateButtonUndoStates(t,n.undoEnabled,n.redoEnabled),Uo(t,dC.formActionEvent,{name:dC.saveState(),value:n.undoEnabled})},a=function(t){return t.toBlob()},c=function(t){Uo(t,dC.formActionEvent,{name:dC.disable(),value:{}})},s=function(t){h.getApplyButton(t).each(function(t){Dh.enable(t)}),Uo(t,dC.formActionEvent,{name:dC.enable(),value:{}})},f=function(t,n){return c(t),g.updateSrc(t,n)},l=function(n,t,e,o,r){return c(n),tk(t).then(e).then(a).then(o).then(function(t){return f(n,t).then(function(t){return i(n),r(),s(n),t})})["catch"](function(t){return nt.console.log(t),s(n),t})},d=function(t,n,e){var o=u.getBlobState().blob;l(t,o,n,function(t){return u.updateTempState(t)},e)},m=function(t){var n=u.getBlobState().url;return u.destroyTempState(),i(t),n},g=kC(t.currentState.url),p=(o=Zg(CC("Undo","undo",!0,function(t){Uo(t,cC.undo(),{direction:1})},e=n)),r=Zg(CC("Redo","redo",!0,function(t){Uo(t,cC.redo(),{direction:1})},e)),{container:Zb.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),CC("Zoom in","zoom-in",!1,function(t){Uo(t,cC.zoom(),{direction:1})},e),CC("Zoom out","zoom-out",!1,function(t){Uo(t,cC.zoom(),{direction:-1})},e)]}),updateButtonUndoStates:function(t,n,e){o.getOpt(t).each(function(t){OC(t,n)}),r.getOpt(t).each(function(t){OC(t,e)})}}),h=mC(g,n);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[h.memContainer.asSpec(),g.memContainer.asSpec(),p.container],behaviours:Ka([Bf.config({store:{mode:"manual",getValue:function(){return u.getBlobState()}}}),$m("image-tools-events",[$o(cC.undo(),function(n,t){var e=u.undo();f(n,e).then(function(t){s(n),i(n)})}),$o(cC.redo(),function(n,t){var e=u.redo();f(n,e).then(function(t){s(n),i(n)})}),$o(cC.zoom(),function(t,n){var e=n.event().direction();g.zoom(t,e)}),$o(cC.back(),function(t,n){var e,o;o=m(e=t),f(e,o).then(function(t){s(e)}),n.event().swap()(),g.hideCrop()}),$o(cC.apply(),function(t,n){u.applyTempState(function(){m(t),n.event().swap()()})}),$o(cC.transform(),function(t,n){return d(t,n.event().transform(),Z)}),$o(cC.tempTransform(),function(t,n){return e=t,o=n.event().transform(),r=u.getTempState().blob,void l(e,r,o,function(t){return u.addTempState(t)},Z);var e,o,r}),$o(cC.transformApply(),function(t,n){return e=t,o=n.event().transform(),r=n.event().swap(),i=u.getBlobState().blob,void l(e,i,o,function(t){var n=u.addBlobState(t);return m(e),n},r);var e,o,r,i}),$o(cC.swap(),function(n,t){var e;e=n,p.updateButtonUndoStates(e,!1,!1);var o=t.event().transform(),r=t.event().swap();o.fold(function(){r()},function(t){d(n,t,r)})})]),fS()])}},FC=Rl({name:"HtmlSelect",configFields:[Nn("options"),Df("selectBehaviours",[eg,Bf]),te("selectClasses",[]),te("selectAttributes",{}),qn("data")],factory:function(e,t){var n=V(e.options,function(t){return{dom:{tag:"option",value:t.value,innerHtml:t.text}}}),o=e.data.map(function(t){return Jt("initialValue",t)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:n,behaviours:Af(e.selectBehaviours,[eg.config({}),Bf.config({store:et({mode:"manual",getValue:function(t){return Ki(t.element())},setValue:function(t,n){L(e.options,function(t){return t.value===n}).isSome()&&Ji(t.element(),n)}},o)})])}}}),IC=function(e,n){var t=e.label.map(function(t){return fy(t,n)}),o=[Dh.config({disabled:function(){return e.disabled||n.isReadOnly()}}),nv(),Gm.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:function(t){return jo(t,py),st.some(!0)}}),$m("textfield-change",[$o(fo(),function(t,n){Uo(t,ly,{name:e.name})}),$o(yo(),function(t,n){Uo(t,ly,{name:e.name})})]),uy.config({})],r=e.validation.map(function(o){return Gy.config({getRoot:function(t){return br(t.element())},invalidClass:"tox-invalid",validator:{validate:function(t){var n=Bf.getValue(t),e=o.validator(n);return Ry(!0===e?ut.value(n):ut.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=e.placeholder.fold(at({}),function(t){return{placeholder:n.translate(t)}}),u=e.inputMode.fold(at({}),function(t){return{inputmode:t}}),a=et(et({},i),u),c=oy.parts().field({tag:!0===e.multiline?"textarea":"input",inputAttributes:a,inputClasses:[e.classname],inputBehaviours:Ka(it([o,r])),selectOnFocus:!1,factory:Cy}),s=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),f=[Dh.config({disabled:function(){return e.disabled||n.isReadOnly()},onDisabled:function(t){oy.getField(t).each(Dh.disable)},onEnabled:function(t){oy.getField(t).each(Dh.enable)}}),nv()];return ay(t,c,s,f)},RC=/* */Object.freeze({__proto__:null,events:function(t,n){var e=t.stream.streams.setup(t,n);return qo([$o(t.event,e),ir(function(){return n.cancel()})].concat(t.cancelEvent.map(function(t){return[$o(t,function(){return n.cancel()})]}).getOr([])))}}),VC=function(t){var n=se(null);return ai({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()}})},PC=/* */Object.freeze({__proto__:null,throttle:VC,init:function(t){return t.stream.streams.state(t)}}),HC=[Ln("stream",Dn("mode",{throttle:[Nn("delay"),te("stopEvent",!0),la("streams",{setup:function(t,n){var e=t.stream,o=ap(t.onStream,e.delay);return n.setTimer(o),function(t,n){o.throttle(t,n),e.stopEvent&&n.stop()}},state:VC})]})),te("event","input"),qn("cancelEvent"),sa("onStream")],zC=$a({fields:HC,name:"streaming",active:RC,state:PC}),NC=function(t,n,e){var o=Bf.getValue(e);Bf.setValue(n,o),jC(n)},LC=function(t,n){var e=t.element(),o=Ki(e),r=e.dom();"number"!==Ir(e,"type")&&n(r,o)},jC=function(t){LC(t,function(t,n){return t.setSelectionRange(n.length,n.length)})},UC=function(t,n,o){if(t.selectsOver){var e=Bf.getValue(n),r=t.getDisplayText(e),i=Bf.getValue(o);return 0===t.getDisplayText(i).indexOf(r)?st.some(function(){var t,e;NC(0,n,o),t=n,e=r.length,LC(t,function(t,n){return t.setSelectionRange(e,n.length)})}):st.none()}return st.none()},WC=at("alloy.typeahead.itemexecute"),GC=at([qn("lazySink"),Nn("fetch"),te("minChars",5),te("responseTime",1e3),aa("onOpen"),te("getHotspot",st.some),te("getAnchorOverrides",at({})),te("layouts",st.none()),te("eventOrder",{}),ae("model",{},[te("getDisplayText",function(t){return t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.value}),te("selectsOver",!0),te("populateFromBrowse",!0)]),aa("onSetValue"),ca("onExecute"),aa("onItemExecute"),te("inputClasses",[]),te("inputAttributes",{}),te("inputStyles",{}),te("matchWidth",!0),te("useMinWidth",!1),te("dismissOnBlur",!0),ia(["openClass"]),qn("initialData"),Df("typeaheadBehaviours",[eg,Bf,zC,Gm,gg,qy]),ce("previewing",function(){return se(!0)})].concat(wy()).concat(ux())),XC=at([ul({schema:[ra()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(n,e){o.previewing.get()?n.getSystem().getByUid(o.uid).each(function(t){UC(o.model,t,e).fold(function(){return Ql.dehighlight(n,e)},function(t){return t()})}):n.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&NC(o.model,t,e)}),o.previewing.set(!1)},onExecute:function(t,n){return t.getSystem().getByUid(o.uid).toOption().map(function(t){return Uo(t,WC(),{item:n}),!0})},onHover:function(t,n){o.previewing.set(!1),t.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&NC(o.model,t,n)})}}}})]),YC=Vl({name:"Typeahead",configFields:GC(),partFields:XC(),factory:function(r,t,n,i){var e=function(t,n,e){r.previewing.set(!1);var o=qy.getCoupled(t,"sandbox");if(sf.isOpen(o))Ll.getCurrent(o).each(function(t){Ql.getHighlighted(t).fold(function(){e(t)},function(){Yo(o,t.element(),"keydown",n)})});else{Qy(r,u(t),t,o,i,function(t){Ll.getCurrent(t).each(e)},Ty.HighlightFirst).get(Z)}},o=Sy(r),u=function(o){return function(t){return t.map(function(t){var n=At(t.menus),e=U(n,function(t){return H(t.items,function(t){return"item"===t.type})});return Bf.getState(o).update(V(e,function(t){return t.data})),t})}},a=[eg.config({}),Bf.config({onSetValue:r.onSetValue,store:et({mode:"dataset",getDataKey:function(t){return Ki(t.element())},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(t,n){Ji(t.element(),r.model.getDisplayText(n))}},r.initialData.map(function(t){return Jt("initialValue",t)}).getOr({}))}),zC.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(t,n){var e=qy.getCoupled(t,"sandbox");if(eg.isFocused(t)&&Ki(t.element()).length>=r.minChars){var o=Ll.getCurrent(e).bind(function(t){return Ql.getHighlighted(t).map(Bf.getValue)});r.previewing.set(!0);Qy(r,u(t),t,e,i,function(t){Ll.getCurrent(e).each(function(t){o.fold(function(){r.model.selectsOver&&Ql.highlightFirst(t)},function(n){Ql.highlightBy(t,function(t){return Bf.getValue(t).value===n.value}),Ql.getHighlighted(t).orThunk(function(){return Ql.highlightFirst(t),st.none()})})})},Ty.HighlightFirst).get(Z)}},cancelEvent:_o()}),Gm.config({mode:"special",onDown:function(t,n){return e(t,n,Ql.highlightFirst),st.some(!0)},onEscape:function(t){var n=qy.getCoupled(t,"sandbox");return sf.isOpen(n)?(sf.close(n),st.some(!0)):st.none()},onUp:function(t,n){return e(t,n,Ql.highlightLast),st.some(!0)},onEnter:function(n){var t=qy.getCoupled(n,"sandbox"),e=sf.isOpen(t);if(e&&!r.previewing.get())return Ll.getCurrent(t).bind(function(t){return Ql.getHighlighted(t)}).map(function(t){return Uo(n,WC(),{item:t}),!0});var o=Bf.getValue(n);return jo(n,_o()),r.onExecute(t,n,o),e&&sf.close(t),st.some(!0)}}),gg.config({toggleClass:r.markers.openClass,aria:{mode:"expanded"}}),qy.config({others:{sandbox:function(t){return rx(r,t,{onOpen:function(){return gg.on(t)},onClose:function(){return gg.off(t)}})}}}),$m("typeaheadevents",[ar(function(t){var n=Z;tx(r,u(t),t,i,n,Ty.HighlightFirst).get(Z)}),$o(WC(),function(t,n){var e=qy.getCoupled(t,"sandbox");NC(r.model,t,n.event().item()),jo(t,_o()),r.onItemExecute(t,e,n.event().item(),Bf.getValue(t)),sf.close(e),jC(t)})].concat(r.dismissOnBlur?[$o(bo(),function(t){var n=qy.getCoupled(t,"sandbox");ac(n.element()).isNone()&&sf.close(n)})]:[]))];return{uid:r.uid,dom:ky(zt(r,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:et(et({},o),Af(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),qC=function(i){return et(et({},i),{toCached:function(){return qC(i.toCached())},bindFuture:function(n){return qC(i.bind(function(t){return t.fold(function(t){return Ry(ut.error(t))},function(t){return n(t)})}))},bindResult:function(n){return qC(i.map(function(t){return t.bind(n)}))},mapResult:function(n){return qC(i.map(function(t){return t.map(n)}))},mapError:function(n){return qC(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 qC(Iy(function(n){var e=!1,o=nt.setTimeout(function(){e=!0,n(ut.error(r()))},t);i.get(function(t){e||(nt.clearTimeout(o),n(t))})}))}})},KC=function(t){return qC(Iy(t))},JC=KC,$C={type:"separator"},QC=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:function(){}}},ZC=function(t,n){return{type:"menuitem",value:n,text:t,meta:{attach:undefined},onAction:function(){}}},tO=function(t,n){return o=t,e=H(n,function(t){return t.type===o}),V(e,QC);var e,o},nO=function(t,n){var e=t.toLowerCase();return H(n,function(t){var n=t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.text;return Be(n.toLowerCase(),e)||Be(t.value.toLowerCase(),e)})},eO=function(u,t,a){var n=Bf.getValue(t),c=n.meta.text!==undefined?n.meta.text:n.value;return a.getLinkInformation().fold(function(){return[]},function(t){var n,e,o,r,i=nO(c,(n=a.getHistory(u),V(n,function(t){return ZC(t,t)})));return"file"===u?(e=[i,nO(c,tO("header",t.targets)),nO(c,it([(r=t,st.from(r.anchorTop).map(function(t){return ZC("<top>",t)}).toArray()),tO("anchor",t.targets),(o=t,st.from(o.anchorBottom).map(function(t){return ZC("<bottom>",t)}).toArray())]))],N(e,function(t,n){return 0===t.length||0===n.length?t.concat(n):t.concat($C,n)},[])):i})},oO=Wr("aria-invalid"),rO=function(r,o,i){var t,n,e,u,a,c=o.shared.providers,s=function(t){var n=Bf.getValue(t);i.addToHistory(n.value,r.filetype)},f=oy.parts().field({factory:YC,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":oO,type:"url"},minChars:0,responseTime:0,fetch:function(t){var n=eO(r.filetype,t,i),e=Lk(n,Mp.BUBBLE_TO_SANDBOX,o,!1);return Ry(e)},getHotspot:function(t){return h.getOpt(t)},onSetValue:function(t,n){t.hasConfigured(Gy)&&Gy.run(t).get(Z)},typeaheadBehaviours:Ka(it([i.getValidationHandler().map(function(e){return Gy.config({getRoot:function(t){return br(t.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:function(t,n){d.getOpt(t).each(function(t){Fr(t.element(),"title",c.translate(n))})}},validator:{validate:function(t){var n=Bf.getValue(t);return JC(function(o){e({type:r.filetype,url:n.value},function(t){if("invalid"===t.status){var n=ut.error(t.message);o(n)}else{var e=ut.value(t.message);o(e)}})})},validateOnLoad:!1}})}).toArray(),[Dh.config({disabled:function(){return r.disabled||c.isReadOnly()}}),uy.config({}),$m("urlinput-events",it(["file"===r.filetype?[$o(fo(),function(t){Uo(t,ly,{name:r.name})})]:[],[$o(lo(),function(t){Uo(t,ly,{name:r.name}),s(t)}),$o(yo(),function(t){Uo(t,ly,{name:r.name}),s(t)})]]))]])),eventOrder:((t={})[fo()]=["streaming","urlinput-events","invalidating"],t),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:o.shared.getSink,parts:{menu:Wp(0,0,"normal")},onExecute:function(t,n,e){Uo(n,py,{})},onItemExecute:function(t,n,e,o){s(t),Uo(t,ly,{name:r.name})}}),l=r.label.map(function(t){return fy(t,c)}),d=Zg((n="invalid",e=st.some(oO),void 0===(u="warning")&&(u=n),void 0===a&&(a=n),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+n],innerHtml:np(u,c.icons),attributes:et({title:c.translate(a),"aria-live":"polite"},e.fold(function(){return{}},function(t){return{id:t}}))}})),m=Zg({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[d.asSpec()]}),g=i.getUrlPicker(r.filetype),p=Wr("browser.url.event"),h=Zg({dom:{tag:"div",classes:["tox-control-wrap"]},components:[f,m.asSpec()],behaviours:Ka([Dh.config({disabled:function(){return r.disabled||c.isReadOnly()}})])}),v=Zg(Kk({name:r.name,icon:st.some("browse"),text:r.label.getOr(""),disabled:r.disabled,primary:!1,borderless:!0},function(t){return jo(t,p)},c,[],["tox-browse-url"]));return oy.sketch({dom:sy([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:it([[h.asSpec()],g.map(function(){return v.asSpec()}).toArray()])}]),fieldBehaviours:Ka([Dh.config({disabled:function(){return r.disabled||c.isReadOnly()},onDisabled:function(t){oy.getField(t).each(Dh.disable),v.getOpt(t).each(Dh.disable)},onEnabled:function(t){oy.getField(t).each(Dh.enable),v.getOpt(t).each(Dh.enable)}}),nv(),$m("url-input-events",[$o(p,function(o){Ll.getCurrent(o).each(function(n){var t=Bf.getValue(n),e=et({fieldname:r.name},t);g.each(function(t){t(e).get(function(t){Bf.setValue(n,t),Uo(o,ly,{name:r.name})})})})})])])})},iO=function(r){return function(n,e,o){return Ft(e,"name").fold(function(){return r(e,o)},function(t){return n.field(t,r(e,o))})}},uO={bar:iO(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:V(e.items,o.interpreter)};var e,o}),collection:iO(function(t,n){return xy(t,n.shared.providers)}),alertbanner:iO(function(t,n){return e=t,o=n.shared.providers,Zb.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:[Qg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:np(e.icon,o.icons),attributes:{title:o.translate(e.iconTooltip)}},action:function(t){Uo(t,gy,{name:"alert-banner",value:e.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:o.translate(e.text)}}]});var e,o}),input:iO(function(t,n){return e=t,o=n.shared.providers,IC({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:e.disabled,classname:"tox-textfield",validation:st.none(),maximized:e.maximized},o);var e,o}),textarea:iO(function(t,n){return e=t,o=n.shared.providers,IC({name:e.name,multiline:!0,label:e.label,inputMode:st.none(),placeholder:e.placeholder,flex:!0,disabled:e.disabled,classname:"tox-textarea",validation:st.none(),maximized:e.maximized},o);var e,o}),label:iO(function(t,n){return e=t,o=n.shared,r={dom:{tag:"label",innerHtml:o.providers.translate(e.label),classes:["tox-label"]}},i=V(e.items,o.interpreter),{dom:{tag:"div",classes:["tox-form__group"]},components:[r].concat(i),behaviours:Ka([fS(),Jm.config({}),wS(st.none()),Gm.config({mode:"acyclic"})])};var e,o,r,i}),iframe:(TC=function(t,n){return AS(t,n.shared.providers)},function(t,n,e){var o=zt(n,{source:"dynamic"});return iO(TC)(t,o,e)}),button:iO(function(t,n){return Qk(t,n.shared.providers)}),checkbox:iO(function(t,n){return e=t,o=n.shared.providers,r=Bf.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(),st.some(!0)},u=oy.parts().field({factory:{sketch:ct},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:Ka([fS(),Dh.config({disabled:function(){return e.disabled||o.isReadOnly()}}),uy.config({}),eg.config({}),r,Gm.config({mode:"special",onEnter:i,onSpace:i,stopSpaceKeyup:!0}),$m("checkbox-events",[$o(lo(),function(t,n){Uo(t,ly,{name:e.name})})])])}),a=oy.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:o.translate(e.label)},behaviours:Ka([fx.config({})])}),s=Zg({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[(c=function(t){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t],innerHtml:np("checked"===t?"selected":"unselected",o.icons)}}})("checked"),c("unchecked")]}),oy.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[u,s.asSpec(),a],fieldBehaviours:Ka([Dh.config({disabled:function(){return e.disabled||o.isReadOnly()},disableClass:"tox-checkbox--disabled",onDisabled:function(t){oy.getField(t).each(Dh.disable)},onEnabled:function(t){oy.getField(t).each(Dh.enable)}}),nv()])});var e,o,r,i,u,a,c,s}),colorinput:iO(function(t,n){return gx(t,n.shared,n.colorinput)}),colorpicker:iO(function(t){var n=function(t){return"tox-"+t},e=sS(gS,n),r=Zg(e.sketch({dom:{tag:"div",classes:["tox-color-picker-container"],attributes:{role:"presentation"}},onValidHex:function(t){Uo(t,gy,{name:"hex-valid",value:!0})},onInvalidHex:function(t){Uo(t,gy,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:Ka([Bf.config({store:{mode:"manual",getValue:function(t){var n=r.get(t);return Ll.getCurrent(n).bind(function(t){return Bf.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);Ll.getCurrent(o).fold(function(){nt.console.log("Can not find form")},function(t){Bf.setValue(t,{hex:st.from(e[1]).getOr("")}),eS.getField(t,"hex").each(function(t){jo(t,fo())})})}}}),fS()])}}),dropzone:iO(function(t,n){return kS(t,n.shared.providers)}),grid:iO(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+e.columns+"col"]},components:V(e.items,o.interpreter)};var e,o}),selectbox:iO(function(t,n){return e=t,o=n.shared.providers,r=V(e.items,function(t){return{text:o.translate(t.text),value:t.value}}),i=e.label.map(function(t){return fy(t,o)}),u=oy.parts().field({dom:{},selectAttributes:{size:e.size},options:r,factory:FC,selectBehaviours:Ka([Dh.config({disabled:function(){return e.disabled||o.isReadOnly()}}),uy.config({}),$m("selectbox-change",[$o(lo(),function(t,n){Uo(t,ly,{name:e.name})})])])}),a=1<e.size?st.none():st.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:np("chevron-down",o.icons)}}),c={dom:{tag:"div",classes:["tox-selectfield"]},components:it([[u],a.toArray()])},oy.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:it([i.toArray(),[c]]),fieldBehaviours:Ka([Dh.config({disabled:function(){return e.disabled||o.isReadOnly()},onDisabled:function(t){oy.getField(t).each(Dh.disable)},onEnabled:function(t){oy.getField(t).each(Dh.enable)}}),nv()])});var e,o,r,i,u,a,c}),sizeinput:iO(function(t,n){return aC(t,n.shared.providers)}),urlinput:iO(function(t,n){return rO(t,n,n.urlinput)}),customeditor:iO(function(e){var o=se(st.none()),n=Zg({dom:{tag:e.tag}}),r=se(st.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:Ka([$m("editor-foo-events",[rr(function(t){n.getOpt(t).each(function(n){var t;t=e,(Object.prototype.hasOwnProperty.call(t,"init")?e.init(n.element().dom()):pS.load(e.scriptId,e.scriptUrl).then(function(t){return t(n.element().dom(),e.settings)})).then(function(n){r.get().each(function(t){n.setValue(t)}),r.set(st.none()),o.set(st.some(n))})})})]),Bf.config({store:{mode:"manual",getValue:function(){return o.get().fold(function(){return r.get().getOr("")},function(t){return t.getValue()})},setValue:function(t,n){o.get().fold(function(){r.set(st.some(n))},function(t){return t.setValue(n)})}}}),fS()]),components:[n.asSpec()]}}),htmlpanel:iO(function(t){return"presentation"===t.presets?Zb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):Zb.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:Ka([uy.config({}),eg.config({})])})}),imagetools:iO(function(t,n){return AC(t,n.shared.providers)}),table:iO(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:V(t,a)}},{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(i=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:V(i,u)}]}),(r=e.cells,{dom:{tag:"tbody"},components:V(r,c)})],behaviours:Ka([uy.config({}),eg.config({})])};var e,o,r,i,u,a,c}),panel:iO(function(t,n){return o=n,{dom:{tag:"div",classes:(e=t).classes},components:V(e.items,o.shared.interpreter)};var e,o})},aO={field:function(t,n){return n}},cO=function(n,t,e){var o=zt(e,{shared:{interpreter:function(t){return sO(n,t,o)}}});return sO(n,t,o)},sO=function(n,e,o){return Ft(uO,e.type).fold(function(){return nt.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(t){return t(n,e,o)})},fO={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},lO=function(t,n,e){var o=Mc(-12,12,fO),r={maxHeightFunction:_c()};return function(){return e()?{anchor:"node",root:Pi(gr(t())),node:st.from(t()),bubble:o,layouts:{onRtl:function(){return[qg]},onLtr:function(){return[Yg]}},overrides:r}:{anchor:"hotspot",hotspot:n(),bubble:o,layouts:{onRtl:function(){return[Ma]},onLtr:function(){return[Aa]}},overrides:r}}},dO=function(t,n,e){return function(){return e()?{anchor:"node",root:Pi(gr(t())),node:st.from(t()),layouts:{onRtl:function(){return[Kg]},onLtr:function(){return[Kg]}}}:{anchor:"hotspot",hotspot:n(),layouts:{onRtl:function(){return[Va]},onLtr:function(){return[Va]}}}}},mO=function(t,n,e){var o,r,i,u=qh(t),a=function(){return le.fromDom(t.getBody())},c=function(){return le.fromDom(t.getContentAreaContainer())},s=function(){return u||!e()};return{inlineDialog:lO(c,n,s),banner:dO(c,n,s),cursor:(r=t,function(){return{anchor:"selection",root:i(),getSelection:function(){var t=r.selection.getRng();return st.some(Gc.range(le.fromDom(t.startContainer),t.startOffset,le.fromDom(t.endContainer),t.endOffset))}}}),node:(o=i=a,function(t){return{anchor:"node",root:o(),node:t}})}},gO=function(t){return{colorPicker:function(t,n){fb(r)(t,n)},hasCustomColors:function(){return Zv(o)},getColors:function(){return tb(e)},getColorCols:(n=e=o=r=t,function(){return ob(n)})};var n,e,o,r},pO=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",format:"bold"},{title:"Italic",format:"italic"},{title:"Underline",format:"underline"},{title:"Strikethrough",format:"strikethrough"},{title:"Superscript",format:"superscript"},{title:"Subscript",format:"subscript"},{title:"Code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Align",items:[{title:"Left",format:"alignleft"},{title:"Center",format:"aligncenter"},{title:"Right",format:"alignright"},{title:"Justify",format:"alignjustify"}]}],hO=function(t){return N(t,function(t,n){if(It(n,"items")){var e=hO(n.items);return{customFormats:t.customFormats.concat(e.customFormats),formats:t.formats.concat([{title:n.title,items:e.formats}])}}if(It(n,"inline")||It(n,"block")||It(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 et(et({},t),{formats:t.formats.concat(n)})},{customFormats:[],formats:[]})},vO=function(i){return t=i,st.from(t.getParam("style_formats")).filter(v).map(function(t){var n,e,o,r=(n=i,e=hO(t),o=function(t){rt(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")?pO.concat(r):r}).getOr(pO);var t},bO=function(t,n,e){var o={type:"formatter",isSelected:n(t.format),getStylePreview:e(t.format)};return zt(t,o)},yO=function(a,t,c,s){var f=function(t){return V(t,function(t){var n,e,o,r,i=Ct(t);if(Rt(t,"items")){var u=f(t.items);return zt(zt(t,{type:"submenu"}),{getStyleItems:function(){return u}})}return Rt(t,"format")?bO(t,c,s):1===i.length&&A(i,"title")?zt(t,{type:"separator"}):(e=Wr((n=t).title),o={type:"formatter",format:e,isSelected:c(e),getStylePreview:s(e)},r=zt(n,o),a.formatter.register(e,r),r)})};return f(t)},xO=vC.trim,wO=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}},SO=wO("true"),kO=wO("false"),CO=function(t,n,e,o,r){return{type:t,title:n,url:e,level:o,attach:r}},OO=function(t){return t.innerText||t.textContent},_O=function(t){return(n=t)&&"A"===n.nodeName&&(n.id||n.name)!==undefined&&EO(t);var n},TO=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},EO=function(t){return function(t){for(;t=t.parentNode;){var n=t.contentEditable;if(n&&"inherit"!==n)return SO(t)}return!1}(t)&&!kO(t)},BO=function(t){return TO(t)&&EO(t)},DO=function(t){var n,e,o=(n=t).id?n.id:Wr("h");return CO("header",OO(t),"#"+o,TO(e=t)?parseInt(e.nodeName.substr(1),10):0,function(){t.id=o})},MO=function(t){var n=t.id||t.name,e=OO(t);return CO("anchor",e||"#"+n,"#"+n,0,Z)},AO=function(t){var n,e;return n="h1,h2,h3,h4,h5,h6,a:not([href])",e=t,V(os(le.fromDom(e),n),function(t){return t.dom()})},FO=function(t){return 0<xO(t.title).length},IO=function(t){var n=AO(t);return H(V(H(n,BO),DO).concat(V(H(n,_O),MO)),FO)},RO="tinymce-url-history",VO=function(t){return w(t)&&/^https?/.test(t)},PO=function(t){return S(t)&&Mt(t,function(t){return!(v(n=t)&&n.length<=5&&W(n,VO));var n}).isNone()},HO=function(){var t,n=qv.getItem(RO);if(null===n)return{};try{t=JSON.parse(n)}catch(e){if(e instanceof SyntaxError)return nt.console.log("Local storage "+RO+" was not valid JSON",e),{};throw e}return PO(t)?t:(nt.console.log("Local storage "+RO+" was not valid format",t),{})},zO=function(t){var n=HO();return Object.prototype.hasOwnProperty.call(n,t)?n[t]:[]},NO=function(n,t){if(VO(n)){var e=HO(),o=Object.prototype.hasOwnProperty.call(e,t)?e[t]:[],r=H(o,function(t){return t!==n});e[t]=[n].concat(r).slice(0,5),function(t){if(!PO(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));qv.setItem(RO,JSON.stringify(t))}(e)}},LO=function(t){return!!t},jO=function(t){return Tt(vC.makeMap(t,/[, ]/),LO)},UO=function(t){return st.from(t.getParam("file_picker_callback")).filter(_)},WO=function(t,n){var e,o,r,i,u=(e=t,o=st.some(e.getParam("file_picker_types")).filter(LO),r=st.some(e.getParam("file_browser_callback_types")).filter(LO),i=o.or(r).map(jO),UO(e).fold(function(){return!1},function(t){return i.fold(function(){return!0},function(t){return 0<Ct(t).length&&t})}));return k(u)?u?UO(t):st.none():u[n]?UO(t):st.none()},GO=function(t){return st.from(t).filter(w).getOrUndefined()},XO=function(t){return st.from((e=(n=t).getParam("file_picker_validator_handler",undefined,"function"))===undefined?n.getParam("filepicker_validator_handler",undefined,"function"):e);var n,e},YO=function(n){return{getHistory:zO,addToHistory:NO,getLinkInformation:function(){return!1===(t=n).getParam("typeahead_urls")?st.none():st.some({targets:IO(t.getBody()),anchorTop:GO(t.getParam("anchor_top","#top")),anchorBottom:GO(t.getParam("anchor_bottom","#bottom"))});var t},getValidationHandler:function(){return XO(n)},getUrlPicker:function(t){return WO(r=n,i=t).map(function(o){return function(n){return Iy(function(e){var t=et({filetype:i,fieldname:n.fieldname},st.from(n.meta).getOr({}));o.call(r,function(t,n){if(!w(t))throw new Error("Expected value to be string");if(n!==undefined&&!S(n))throw new Error("Expected meta to be a object");e({value:t,meta:n})},n.value,t)})}});var r,i}}},qO=function(t,n,e){var o,r,i=se(!1),u={isPositionedAtTop:function(){return"top"===o.get()},getDockingMode:(o=se(Xh(n)?"bottom":"top")).get,setDockingMode:o.set},a={shared:{providers:{icons:function(){return n.ui.registry.getAll().icons},menuItems:function(){return n.ui.registry.getAll().menuItems},translate:hh.translate,isReadOnly:function(){return n.mode.isReadOnly()}},interpreter:function(t){return sO(aO,t,a)},anchors:mO(n,e,u.isPositionedAtTop),header:u,getSink:function(){return ut.value(t)}},urlinput:YO(n),styleselect:function(o){var r=function(t){return function(){return o.formatter.match(t)}},i=function(n){return function(){var t=o.formatter.get(n);return t!==undefined?st.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styles:o.dom.parseStyle(o.formatter.getCssText(n))}):st.none()}},u=function(t){var n=t.items;return n!==undefined&&0<n.length?U(n,u):[t.format]},a=se([]),c=se([]),e=se([]),s=se([]),f=se(!1);o.on("PreInit",function(t){var n=vO(o),e=yO(o,n,r,i);a.set(e),c.set(U(e,u))}),o.on("addStyleModifications",function(t){var n=yO(o,t.items,r,i);e.set(n),f.set(t.replace),s.set(U(n,u))});return{getData:function(){var t=f.get()?[]:a.get(),n=e.get();return t.concat(n)},getFlattenedKeys:function(){var t=f.get()?[]:c.get(),n=s.get();return t.concat(n)}}}(n),colorinput:gO(n),dialog:{isDraggableModal:(r=n,function(){return r.getParam("draggable_modal",!1,"boolean")})},isContextMenuOpen:function(){return i.get()},setContextMenuState:function(t){return i.set(t)}};return a},KO=at(function(t,n){var e,o,r;e=t,o=Math.floor(n),r=vu.max(e,o,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]),Ni(e,"max-width",r+"px")}),JO="contexttoolbar-hide",$O=at([Nn("items"),ia(["itemSelector"]),Df("tgroupBehaviours",[Gm])]),QO=at([cl({name:"items",unit:"item"})]),ZO=Vl({name:"ToolbarGroup",configFields:$O(),partFields:QO(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,behaviours:Af(t.tgroupBehaviours,[Gm.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),t_=at([Nn("dom"),te("shell",!0),Df("toolbarBehaviours",[Jm])]),n_=at([al({name:"groups",overrides:function(){return{behaviours:Ka([Jm.config({})])}}})]),e_=Vl({name:"Toolbar",configFields:t_(),partFields:n_(),factory:function(n,t,e,o){var r=function(t){return n.shell?st.some(t):yl(t,n,"groups")},i=n.shell?{behaviours:[Jm.config({})],components:[]}:{behaviours:[],components:t};return{uid:n.uid,dom:n.dom,components:i.components,behaviours:Af(n.toolbarBehaviours,i.behaviours),apis:{setGroups:function(t,n){r(t).fold(function(){throw nt.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){Jm.set(t,n)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)}}}),o_=function(t,n,e){return{within:at(t),extra:at(n),withinWidth:at(e)}},r_=function(t,n,o){var e,r=(e=function(t,n){var e=o(t);return st.some({element:at(t),start:at(n),finish:at(n+e),width:at(e)})},N(t,function(n,t){return e(t,n.len).fold(at(n),function(t){return{len:t.finish(),list:n.list.concat([t])}})},{len:0,list:[]}).list),i=H(r,function(t){return t.finish()<=n}),u=z(i,function(t,n){return t+n.width()},0),a=r.slice(i.length);return{within:at(i),extra:at(a),withinWidth:at(u)}},i_=function(t){return V(t,function(t){return t.element()})},u_=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m=(0===(r=r_(n,t,e)).extra().length?st.some(r):st.none()).getOrThunk(function(){return r_(n,t-e(o),e)}),g=m.within(),p=m.extra(),h=m.withinWidth();return 1===p.length&&p[0].width()<=e(o)?(f=p,l=h,d=i_(g.concat(f)),o_(d,[],l)):1<=p.length?(u=p,a=o,c=h,s=i_(g).concat([a]),o_(s,i_(u),c)):(i=h,o_(i_(g),[],i))},a_=function(t,n){var e=V(n,function(t){return au(t)});e_.setGroups(t,e)},c_=function(t,n,e){var o=xl(t,n,"primary"),r=qy.getCoupled(t,"overflowGroup");Ni(o.element(),"visibility","hidden");var i=n.builtGroups.get().concat([r]),u=$(i,function(n){return ac(n.element()).bind(function(t){return n.getSystem().getByDom(t).toOption()})});e([]),a_(o,i);var a=bu(o.element()),c=u_(a,n.builtGroups.get(),function(t){return bu(t.element())},r);0===c.extra().length?(Jm.remove(o,r),e([])):(a_(o,c.within()),e(c.extra())),Yi(o.element(),"visibility"),qi(o.element()),u.each(eg.focus)},s_=at([Df("splitToolbarBehaviours",[qy]),ce("builtGroups",function(){return se([])})]),f_=at([ia(["overflowToggledClass"]),Qn("getOverflowBounds"),Nn("lazySink"),ce("overflowGroups",function(){return se([])})].concat(s_())),l_=at([il({factory:e_,schema:t_(),name:"primary"}),ul({schema:t_(),name:"overflow"}),ul({name:"overflow-button"}),ul({name:"overflow-group"})]),d_=at([ia(["toggledClass"]),Nn("lazySink"),Wn("fetch"),Qn("getBounds"),Zn("fireDismissalEventInstead",[te("event",Io())]),Pc()]),m_=at([ul({name:"button",overrides:function(t){return{dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:Ka([gg.config({toggleClass:t.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])}}}),ul({factory:e_,schema:t_(),name:"toolbar",overrides:function(n){return{toolbarBehaviours:Ka([Gm.config({mode:"cyclic",onEscape:function(t){return yl(t,n,"button").each(eg.focus),st.none()}})])}}})]),g_=function(t,n){var e=qy.getCoupled(t,"toolbarSandbox");sf.isOpen(e)?sf.close(e):sf.open(e,n.toolbar())},p_=function(t,n,e,o){var r=e.getBounds.map(function(t){return t()}),i=e.lazySink(t).getOrDie();Ns.positionWithinBounds(i,{anchor:"hotspot",hotspot:t,layouts:o,overrides:{maxWidthFunction:KO()}},n,r)},h_=function(t,n,e,o,r){e_.setGroups(n,r),p_(t,n,e,o),gg.on(t)},v_=Vl({name:"FloatingToolbarButton",factory:function(u,t,a,n){return et(et({},Qg.sketch(et(et({},n.button()),{action:function(t){g_(t,n)},buttonBehaviours:If({dump:n.button().buttonBehaviours},[qy.config({others:{toolbarSandbox:function(t){return o=t,e=a,r=u,{dom:{tag:"div",attributes:{id:(i=Uu()).id}},behaviours:Ka([Gm.config({mode:"special",onEscape:function(t){return sf.close(t),st.some(!0)}}),sf.config({onOpen:function(t,n){r.fetch().get(function(t){h_(o,n,r,e.layouts,t),i.link(o.element()),Gm.focusIn(n)})},onClose:function(){gg.off(o),eg.focus(o),i.unlink(o.element())},isPartOf:function(t,n,e){return Gu(n,e)||Gu(o,e)},getAttachPoint:function(){return r.lazySink(o).getOrDie()}}),oc.config({channels:et(et({},gf(et({isExtraPart:c},r.fireDismissalEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})))),hf({doReposition:function(){sf.getState(qy.getCoupled(o,"toolbarSandbox")).each(function(t){p_(o,t,r,e.layouts)})}}))})])};var o,e,r,i}}})])}))),{apis:{setGroups:function(n,e){sf.getState(qy.getCoupled(n,"toolbarSandbox")).each(function(t){h_(n,t,u,a.layouts,e)})},reposition:function(n){sf.getState(qy.getCoupled(n,"toolbarSandbox")).each(function(t){p_(n,t,u,a.layouts)})},toggle:function(t){g_(t,n)},getToolbar:function(t){return sf.getState(qy.getCoupled(t,"toolbarSandbox"))}}})},configFields:d_(),partFields:m_(),apis:{setGroups:function(t,n,e){t.setGroups(n,e)},reposition:function(t,n){t.reposition(n)},toggle:function(t,n){t.toggle(n)},getToolbar:function(t,n){return t.getToolbar(n)}}}),b_=function(t){return V(t,function(t){return au(t)})},y_=function(t,e,o){c_(t,o,function(n){o.overflowGroups.set(n),e.getOpt(t).each(function(t){v_.setGroups(t,b_(n))})})},x_=Vl({name:"SplitFloatingToolbar",configFields:f_(),partFields:l_(),factory:function(e,t,n,o){var r=Zg(v_.sketch({fetch:function(){return Iy(function(t){t(b_(e.overflowGroups.get()))})},layouts:{onLtr:function(){return[Aa,Ma]},onRtl:function(){return[Ma,Aa]},onBottomLtr:function(){return[Ia,Fa]},onBottomRtl:function(){return[Fa,Ia]}},getBounds:n.getOverflowBounds,lazySink:e.lazySink,fireDismissalEventInstead:{},markers:{toggledClass:e.markers.overflowToggledClass},parts:{button:o["overflow-button"](),toolbar:o.overflow()}}));return{uid:e.uid,dom:e.dom,components:t,behaviours:Af(e.splitToolbarBehaviours,[qy.config({others:{overflowGroup:function(){return ZO.sketch(et(et({},o["overflow-group"]()),{items:[r.asSpec()]}))}}})]),apis:{setGroups:function(t,n){e.builtGroups.set(V(n,t.getSystem().build)),y_(t,r,e)},refresh:function(t){return y_(t,r,e)},toggle:function(t){r.getOpt(t).each(function(t){v_.toggle(t)})},reposition:function(t){r.getOpt(t).each(function(t){v_.reposition(t)})},getOverflow:function(t){return r.getOpt(t).bind(function(t){return v_.getToolbar(t)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},reposition:function(t,n){t.reposition(n)},toggle:function(t,n){t.toggle(n)},getOverflow:function(t,n){return t.getOverflow(n)}}}),w_=function(n,t){return t.getAnimationRoot.fold(function(){return n.element()},function(t){return t(n)})},S_=function(t){return t.dimension.property},k_=function(t,n){return t.dimension.getDimension(n)},C_=function(t,n){var e=w_(t,n);Ti(e,[n.shrinkingClass,n.growingClass])},O_=function(t,n){Ci(t.element(),n.openClass),Si(t.element(),n.closedClass),Ni(t.element(),S_(n),"0px"),qi(t.element())},__=function(t,n){Ci(t.element(),n.closedClass),Si(t.element(),n.openClass),Yi(t.element(),S_(n))},T_=function(t,n,e,o){e.setCollapsed(),Ni(t.element(),S_(n),k_(n,t.element())),qi(t.element()),C_(t,n),O_(t,n),n.onStartShrink(t),n.onShrunk(t)},E_=function(t,n,e,o){var r=o.getOrThunk(function(){return k_(n,t.element())});e.setCollapsed(),Ni(t.element(),S_(n),r),qi(t.element());var i=w_(t,n);Ci(i,n.growingClass),Si(i,n.shrinkingClass),O_(t,n),n.onStartShrink(t)},B_=function(t,n,e){var o=k_(n,t.element());("0px"===o?T_:E_)(t,n,e,st.some(o))},D_=function(t,n,e){var o=w_(t,n),r=Oi(o,n.shrinkingClass),i=k_(n,t.element());__(t,n);var u=k_(n,t.element());(r?function(){Ni(t.element(),S_(n),i),qi(t.element())}:function(){O_(t,n)})(),Ci(o,n.shrinkingClass),Si(o,n.growingClass),__(t,n),Ni(t.element(),S_(n),u),e.setExpanded(),n.onStartGrow(t)},M_=function(t,n,e){var o=w_(t,n);return!0===Oi(o,n.growingClass)},A_=function(t,n,e){var o=w_(t,n);return!0===Oi(o,n.shrinkingClass)},F_=/* */Object.freeze({__proto__:null,refresh:function(t,n,e){if(e.isExpanded()){Yi(t.element(),S_(n));var o=k_(n,t.element());Ni(t.element(),S_(n),o)}},grow:function(t,n,e){e.isExpanded()||D_(t,n,e)},shrink:function(t,n,e){e.isExpanded()&&B_(t,n,e)},immediateShrink:function(t,n,e){e.isExpanded()&&T_(t,n,e,st.none())},hasGrown:function(t,n,e){return e.isExpanded()},hasShrunk:function(t,n,e){return e.isCollapsed()},isGrowing:M_,isShrinking:A_,isTransitioning:function(t,n,e){return!0===M_(t,n)||!0===A_(t,n)},toggleGrow:function(t,n,e){(e.isExpanded()?B_:D_)(t,n,e)},disableTransitions:C_}),I_=/* */Object.freeze({__proto__:null,exhibit:function(t,n,e){var o=n.expanded;return si(o?{classes:[n.openClass],styles:{}}:{classes:[n.closedClass],styles:Jt(n.dimension.property,"0px")})},events:function(e,o){return qo([or(go(),function(t,n){n.event().raw().propertyName===e.dimension.property&&(C_(t,e),o.isExpanded()&&Yi(t.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(t))})])}}),R_=[Nn("closedClass"),Nn("openClass"),Nn("shrinkingClass"),Nn("growingClass"),qn("getAnimationRoot"),aa("onShrunk"),aa("onStartShrink"),aa("onGrown"),aa("onStartGrow"),te("expanded",!1),Ln("dimension",Dn("property",{width:[la("property","width"),la("getDimension",function(t){return bu(t)+"px"})],height:[la("property","height"),la("getDimension",function(t){return fu(t)+"px"})]}))],V_=$a({fields:R_,name:"sliding",active:I_,apis:F_,state:/* */Object.freeze({__proto__:null,init:function(t){var n=se(t.expanded);return ai({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()}})}})}),P_=at([ia(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),aa("onOpened"),aa("onClosed")].concat(s_())),H_=at([il({factory:e_,schema:t_(),name:"primary"}),il({factory:e_,schema:t_(),name:"overflow",overrides:function(n){return{toolbarBehaviours:Ka([V_.config({dimension:{property:"height"},closedClass:n.markers.closedClass,openClass:n.markers.openClass,shrinkingClass:n.markers.shrinkingClass,growingClass:n.markers.growingClass,onShrunk:function(t){yl(t,n,"overflow-button").each(function(t){gg.off(t),eg.focus(t)}),n.onClosed(t)},onGrown:function(t){Gm.focusIn(t),n.onOpened(t)},onStartGrow:function(t){yl(t,n,"overflow-button").each(gg.on)}}),Gm.config({mode:"acyclic",onEscape:function(t){return yl(t,n,"overflow-button").each(eg.focus),st.some(!0)}})])}}}),ul({name:"overflow-button",overrides:function(t){return{buttonBehaviours:Ka([gg.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"},toggleOnExecute:!1})])}}}),ul({name:"overflow-group"})]),z_=function(t,n){yl(t,n,"overflow").each(function(e){c_(t,n,function(t){var n=V(t,function(t){return au(t)});e_.setGroups(e,n)}),yl(t,n,"overflow-button").each(function(t){V_.hasGrown(e)&&gg.on(t)}),V_.refresh(e)})},N_=Vl({name:"SplitSlidingToolbar",configFields:P_(),partFields:H_(),factory:function(o,t,n,e){var r="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:t,behaviours:Af(o.splitToolbarBehaviours,[qy.config({others:{overflowGroup:function(n){return ZO.sketch(et(et({},e["overflow-group"]()),{items:[Qg.sketch(et(et({},e["overflow-button"]()),{action:function(t){jo(n,r)}}))]}))}}}),$m("toolbar-toggle-events",[$o(r,function(n){yl(n,o,"overflow").each(function(t){z_(n,o),V_.toggleGrow(t)})})])]),apis:{setGroups:function(t,n){var e;e=V(n,t.getSystem().build),o.builtGroups.set(e),z_(t,o)},refresh:function(t){return z_(t,o)},toggle:function(t){var n,e;yl(n=t,e=o,"overflow").each(function(t){z_(n,e),V_.toggleGrow(t)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},toggle:function(t,n){t.toggle(n)}}}),L_=at(Wr("toolbar-height-change")),j_=function(t){var n=t.title.fold(function(){return{}},function(t){return{attributes:{title:t}}});return{dom:et({tag:"div",classes:["tox-toolbar__group"]},n),components:[ZO.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:Ka([uy.config({}),eg.config({})])}},U_=function(t){return ZO.sketch(j_(t))},W_=function(e,t){var n=rr(function(t){var n=V(e.initGroups,U_);e_.setGroups(t,n)});return Ka([iv(e.providers.isReadOnly),nv(),Gm.config({mode:t,onEscape:e.onEscape,selector:".tox-toolbar__group"}),$m("toolbar-events",[n])])},G_=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return{uid:t.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":j_({title:st.none(),items:[]}),"overflow-button":Xk({name:"more",icon:st.some("more-drawer"),disabled:!1,tooltip:st.some("More..."),primary:!1,borderless:!1},st.none(),t.providers)},splitToolbarBehaviours:W_(t,n)}},X_=function(i){var t=G_(i),n=x_.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return x_.sketch(et(et({},t),{lazySink:i.getSink,getOverflowBounds:function(){var t=i.moreDrawerData.lazyHeader().element(),n=Au(t),e=hr(t),o=Au(e),r=Math.max(e.dom().scrollHeight,o.height);return Du(n.x+4,o.y,n.width-8,r)},parts:et(et({},t.parts),{overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:i.attributes}}}),components:[n],markers:{overflowToggledClass:"tox-tbtn--enabled"}}))},Y_=function(t){var n=N_.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),e=N_.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),o=G_(t);return N_.sketch(et(et({},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"},onOpened:function(t){t.getSystem().broadcastOn([L_()],{type:"opened"})},onClosed:function(t){t.getSystem().broadcastOn([L_()],{type:"closed"})}}))},q_=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return e_.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(t.type===Bp.scrolling?["tox-toolbar--scrolling"]:[])},components:[e_.parts().groups({})],toolbarBehaviours:W_(t,n)})},K_=[ie("disabled",!1),$n("tooltip"),$n("icon"),$n("text"),ue("onSetup",function(){return Z})],J_=ln([jn("type"),Wn("onAction")].concat(K_)),$_=function(t){return On("toolbarbutton",J_,t)},Q_=[$n("text"),$n("tooltip"),$n("icon"),Wn("fetch"),ue("onSetup",function(){return Z})],Z_=ln(b([jn("type")],Q_)),tT=function(t){return On("menubutton",Z_,t)},nT=ln([jn("type"),$n("tooltip"),$n("icon"),$n("text"),Qn("select"),Wn("fetch"),ue("onSetup",function(){return Z}),re("presets","normal",["normal","color","listpreview"]),te("columns",1),Wn("onAction"),Wn("onItemAction")]),eT=[ie("active",!1)].concat(K_),oT=ln(eT.concat([jn("type"),Wn("onAction")])),rT=function(t){return On("ToggleButton",oT,t)},iT=ln([jn("type"),Ln("items",(EC=[wn([jn("name"),Yn("items",In)]),In],{extract:function(t,n,e){for(var o=[],r=0,i=EC;r<i.length;r++){var u=i[r].extract(t,n,e);if(u.stype===a.Value)return u;o.push(u)}return nn(o)},toString:function(){return"oneOf("+V(EC,function(t){return t.toString()}).join(", ")+")"}}))].concat(K_)),uT=[ue("predicate",function(){return!1}),re("scope","node",["node","editor"]),re("position","selection",["node","selection","line"])],aT=K_.concat([te("type","contextformbutton"),te("primary",!1),Wn("onAction"),ce("original",ct)]),cT=eT.concat([te("type","contextformbutton"),te("primary",!1),Wn("onAction"),ce("original",ct)]),sT=K_.concat([te("type","contextformbutton")]),fT=eT.concat([te("type","contextformtogglebutton")]),lT=Dn("type",{contextformbutton:aT,contextformtogglebutton:cT}),dT=ln([te("type","contextform"),ue("initValue",function(){return""}),$n("label"),Yn("commands",lT),Kn("launch",Dn("type",{contextformbutton:sT,contextformtogglebutton:fT}))].concat(uT)),mT=ln([te("type","contexttoolbar"),jn("items")].concat(uT)),gT=/* */Object.freeze({__proto__:null,getState:function(t,n,e){return e}}),pT=/* */Object.freeze({__proto__:null,events:function(i,u){var r=function(o,r){i.updateState.each(function(t){var n=t(o,r);u.set(n)}),i.renderComponents.each(function(t){var n=t(r,u.get()),e=V(n,o.getSystem().build);Ws(o,e)})};return qo([$o(xo(),function(t,n){var e=n,o=i.channel;A(e.channels(),o)&&r(t,e.data())}),rr(function(n,t){i.initialData.each(function(t){r(n,t)})})])}}),hT=/* */Object.freeze({__proto__:null,init:function(){var n=se(st.none());return{readState:function(){return n.get().fold(function(){return"none"},function(t){return t})},get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(st.none())}}}}),vT=[Nn("channel"),qn("renderComponents"),qn("updateState"),qn("initialData")],bT=$a({fields:vT,name:"reflecting",active:pT,apis:gT,state:hT}),yT=at([Nn("toggleClass"),Nn("fetch"),sa("onExecute"),te("getHotspot",st.some),te("getAnchorOverrides",at({})),Pc(),sa("onItemExecute"),qn("lazySink"),Nn("dom"),aa("onOpen"),Df("splitDropdownBehaviours",[qy,Gm,eg]),te("matchWidth",!1),te("useMinWidth",!1),te("eventOrder",{}),qn("role")].concat(ux())),xT=il({factory:Qg,schema:[Nn("dom")],name:"arrow",defaults:function(){return{buttonBehaviours:Ka([eg.revoke()])}},overrides:function(n){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(n.uid).each(Wo)},buttonBehaviours:Ka([gg.config({toggleOnExecute:!1,toggleClass:n.toggleClass})])}}}),wT=il({factory:Qg,schema:[Nn("dom")],name:"button",defaults:function(){return{buttonBehaviours:Ka([eg.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)})}}}}),ST=at([xT,wT,al({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Nn("text")],name:"aria-descriptor"}),ul({schema:[ra()],name:"menu",defaults:function(o){return{onExecute:function(n,e){n.getSystem().getByUid(o.uid).each(function(t){o.onItemExecute(t,n,e)})}}}}),Jy()]),kT=Vl({name:"SplitDropdown",configFields:yT(),partFields:ST(),factory:function(o,t,n,e){var r=function(t){Ll.getCurrent(t).each(function(t){Ql.highlightFirst(t),Gm.focusIn(t)})},i=function(t){tx(o,function(t){return t},t,e,r,Ty.HighlightFirst).get(Z)},u=function(t){var n=xl(t,o,"button");return Wo(n),st.some(!0)},a=et(et({},qo([rr(function(e,t){yl(e,o,"aria-descriptor").each(function(t){var n=Wr("aria");Fr(t.element(),"id",n),Fr(e.element(),"aria-describedby",n)})})])),hg(st.some(i))),c={repositionMenus:function(t){gg.isOn(t)&&ix(t)}};return{uid:o.uid,dom:o.dom,components:t,apis:c,eventOrder:et(et({},o.eventOrder),{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:Af(o.splitDropdownBehaviours,[qy.config({others:{sandbox:function(t){var n=xl(t,o,"arrow");return rx(o,t,{onOpen:function(){gg.on(n),gg.on(t)},onClose:function(){gg.off(n),gg.off(t)}})}}}),Gm.config({mode:"special",onSpace:u,onEnter:u,onDown:function(t){return i(t),st.some(!0)}}),eg.config({}),gg.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:function(t,n){return t.repositionMenus(n)}}}),CT=function(n){return{isDisabled:function(){return Dh.isDisabled(n)},setDisabled:function(t){return Dh.set(n,t)}}},OT=function(n){return{setActive:function(t){gg.set(n,t)},isActive:function(){return gg.isOn(n)},isDisabled:function(){return Dh.isDisabled(n)},setDisabled:function(t){return Dh.set(n,t)}}},_T=function(t,n){return t.map(function(t){return{"aria-label":n.translate(t),title:n.translate(t)}}).getOr({})},TT=Wr("focus-button"),ET=["checklist","ordered-list"],BT=["indent","outdent","table-insert-column-after","table-insert-column-before","unordered-list"],DT=function(n,e,t,o,r,i){var u,a=function(t){return hh.isRtl()&&A(ET,t)?t+"-rtl":t},c=hh.isRtl()&&n.exists(function(t){return A(BT,t)});return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]).concat(c?["tox-tbtn__icon-rtl"]:[]),attributes:_T(t,i)},components:fv([n.map(function(t){return Ek(a(t),i.icons)}),e.map(function(t){return Dk(t,"tox-tbtn",i)})]),eventOrder:((u={})[no()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:Ka([iv(i.isReadOnly),nv(),$m("common-button-display-events",[$o(no(),function(t,n){n.event().prevent(),jo(t,TT)})])].concat(o.map(function(t){return bT.config({channel:t,initialData:{icon:n,text:e},renderComponents:function(t,n){return fv([t.icon.map(function(t){return Ek(a(t),i.icons)}),t.text.map(function(t){return Dk(t,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}},MT=function(t,n,e){var o,r=se(Z),i=DT(t.icon,t.text,t.tooltip,st.none(),st.none(),e);return Qg.sketch({dom:i.dom,components:i.components,eventOrder:Ak,buttonBehaviours:Ka([$m("toolbar-button-events",[(o={onAction:t.onAction,getApi:n.getApi},ar(function(n,t){uv(o,n)(function(t){Uo(n,Mk,{buttonApi:t}),o.onAction(t)})})),av(n,r),cv(n,r)]),iv(function(){return t.disabled||e.isReadOnly()}),nv()].concat(n.toolbarButtonBehaviours))})},AT=function(t,n,e){return MT(t,{toolbarButtonBehaviours:[].concat(0<e.length?[$m("toolbarButtonWith",e)]:[]),getApi:CT,onSetup:t.onSetup},n)},FT=function(t,n,e){return zt(MT(t,{toolbarButtonBehaviours:[Jm.config({}),gg.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[$m("toolbarToggleButtonWith",e)]:[]),getApi:OT,onSetup:t.onSetup},n))},IT=function(n,t){var e,o,r,i,u=Wr("channel-update-split-dropdown-display"),a=function(e){return{isDisabled:function(){return Dh.isDisabled(e)},setDisabled:function(t){return Dh.set(e,t)},setIconFill:function(t,n){Lu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Fr(t,"fill",n)})},setIconStroke:function(t,n){Lu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){Fr(t,"stroke",n)})},setActive:function(n){Fr(e.element(),"aria-pressed",n),Lu(e.element(),"span").each(function(t){e.getSystem().getByDom(t).each(function(t){return gg.set(t,n)})})},isActive:function(){return Lu(e.element(),"span").exists(function(t){return e.getSystem().getByDom(t).exists(gg.isOn)})}}},c=se(Z),s={getApi:a,onSetup:n.onSetup};return kT.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:et({"aria-pressed":!1},_T(n.tooltip,t.providers))},onExecute:function(t){n.onAction(a(t))},onItemExecute:function(t,n,e){},splitDropdownBehaviours:Ka([rv(t.providers.isReadOnly),nv(),$m("split-dropdown-events",[$o(TT,eg.focus),av(s,c),cv(s,c)]),fx.config({})]),eventOrder:((e={})[Ao()]=["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 Iy(function(t){return r.fetch(t)}).map(function(t){return st.from(_b(zt(lb(Wr("menu-value"),t,function(t){r.onItemAction(o(n),t)},r.columns,r.presets,Mp.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),i),{movement:mb(r.columns,r.presets),menuBehaviours:uh("auto"!==r.columns?[]:[rr(function(o,t){rh(o,4,Np(r.presets)).each(function(t){var n=t.numRows,e=t.numColumns;Gm.setGridSize(o,n,e)})})])})))})}),parts:{menu:Wp(0,n.columns,n.presets)},components:[kT.parts().button(DT(n.icon,n.text,st.none(),st.some(u),st.some([gg.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),kT.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:np("chevron-down",t.providers.icons)},buttonBehaviours:Ka([rv(t.providers.isReadOnly),nv()])}),kT.parts()["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},RT=function(i,u){return $o(Mk,function(t,n){var e,o=i.get(t),r=(e=o,{hide:function(){return jo(e,Oo())},getValue:function(){return Bf.getValue(e)}});u.onAction(r,n.event().buttonApi())})},VT=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=y(d,["primary"]),g=_n(rT(et(et({},m),{type:"togglebutton",onAction:function(){}}))),FT(g,l.backstage.shared.providers,[RT(s,f)])):(o=t,i=p,(u=(r=n).original).primary,a=y(u,["primary"]),c=_n($_(et(et({},a),{type:"button",onAction:function(){}}))),AT(c,i.backstage.shared.providers,[RT(o,r)]))},PT=function(t,n){var e,o,r,i,u=t.label.fold(function(){return{}},function(t){return{"aria-label":t}}),a=Zg(Cy.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:t.initValue(),inputAttributes:u,selectOnFocus:!0,inputBehaviours:Ka([Gm.config({mode:"special",onEnter:function(t){return c.findPrimary(t).map(function(t){return Wo(t),!0})},onLeft:function(t,n){return n.cut(),st.none()},onRight:function(t,n){return n.cut(),st.none()}})])})),c=(e=a,o=t.commands,r=n,i=V(o,function(t){return Zg(VT(e,t,r))}),{asSpecs:function(){return V(i,function(t){return t.asSpec()})},findPrimary:function(e){return $(o,function(t,n){return t.primary?st.from(i[n]).bind(function(t){return t.getOpt(e)}).filter(x(Dh.isDisabled)):st.none()})}});return[{title:st.none(),items:[a.asSpec()]},{title:st.none(),items:c.asSpecs()}]},HT=PT,zT=function(t,n){var e,o,r,i,u,a=_u(nt.window),c=Mu(le.fromDom(t.getContentAreaContainer())),s=Hh(t)||zh(t)||Lh(t),f=(e=c,o=a,r=Math.max(o.x,e.x),i=e.right-r,u=o.width-(r-o.x),{x:r,width:Math.min(i,u)}),l=f.x,d=f.width;if(t.inline&&!s)return Du(l,a.y,d,a.height);var m=function(t,n,e,o){var r=le.fromDom(t.getContainer()),i=Lu(r,".tox-editor-header").getOr(r),u=Mu(i),a=u.y>=n.bottom,c=o&&!a;if(t.inline&&c)return{y:Math.max(u.bottom,e.y),bottom:e.bottom};if(t.inline&&!c)return{y:e.y,bottom:Math.min(u.y,e.bottom)};var s=Mu(r);return c?{y:Math.max(u.bottom,e.y),bottom:Math.min(s.bottom,e.bottom)}:{y:Math.max(s.y,e.y),bottom:Math.min(u.y,e.bottom)}}(t,c,a,n.header.isPositionedAtTop()),g=m.y,p=m.bottom;return Du(l,g,d,p-g)},NT=function(n,t){var e=H(t,function(t){return t.predicate(n.dom())}),o=P(e,function(t){return"contexttoolbar"===t.type});return{contextToolbars:o.pass,contextForms:o.fail}},LT=function(t,n,e){var o=NT(t,n);if(0<o.contextForms.length)return st.some({elem:t,toolbars:[o.contextForms[0]]});var r=NT(t,e);if(0<r.contextForms.length)return st.some({elem:t,toolbars:[r.contextForms[0]]});if(0<o.contextToolbars.length||0<r.contextToolbars.length){var i=function(t){if(t.length<=1)return t;var n=function(n){return F(t,function(t){return t.position===n})},e=function(n){return H(t,function(t){return t.position===n})},o=n("selection"),r=n("node");if(o||r){if(r&&o){var i=e("node"),u=V(e("selection"),function(t){return et(et({},t),{position:"node"})});return i.concat(u)}return e(o?"selection":"node")}return e("line")}(o.contextToolbars.concat(r.contextToolbars));return st.some({elem:t,toolbars:i})}return st.none()},jT=function(t,n,i){return t(n)?st.none():Xe(n,function(t){var n=NT(t,i.inNodeScope),e=n.contextToolbars,o=n.contextForms,r=0<o.length?o:function(t){if(t.length<=1)return t;var n=function(n){return L(t,function(t){return t.position===n})};return n("selection").orThunk(function(){return n("node")}).orThunk(function(){return n("line")}).map(function(t){return t.position}).fold(function(){return[]},function(n){return H(t,function(t){return t.position===n})})}(e);return 0<r.length?st.some({elem:t,toolbars:r}):st.none()},t)},UT=function(e,r){var t={},i=[],u=[],a={},c={},o=function(n,e){var o=_n(On("ContextForm",dT,e));(t[n]=o).launch.map(function(t){a["form:"+n]=et(et({},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){On("ContextToolbar",mT,e).each(function(t){"editor"===e.scope?u.push(t):i.push(t),c[n]=t})},n=Ct(e);return rt(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}},WT=Wr("forward-slide"),GT=Wr("backward-slide"),XT=Wr("change-slide-event"),YT="tox-pop--resizing",qT=function(t,n,e){var u,a,r,c,i,o=e.dataset,s="basic"===o.type?function(){return V(o.data,function(t){return bO(t,e.isSelectedFor,e.getPreviewFor)})}:o.getData;return{items:(u=n,a=e,r=function(t,n,e,o){var r=u.shared.providers.translate(t.title);if("separator"===t.type)return st.some({type:"separator",text:r});if("submenu"!==t.type)return st.some(et({type:"togglemenuitem",text:r,icon:t.icon,active:t.isSelected(o),disabled:e,onAction:a.onAction(t)},t.getStylePreview().fold(function(){return{}},function(t){return{meta:{style:t}}})));var i=U(t.getStyleItems(),function(t){return c(t,n,o)});return 0===n&&i.length<=0?st.none():st.some({type:"nestedmenuitem",text:r,disabled:i.length<=0,getSubmenuItems:function(){return U(t.getStyleItems(),function(t){return c(t,n,o)})}})},c=function(t,n,e){var o="formatter"===t.type&&a.isInvalid(t);return 0===n?o?[]:r(t,n,!1,e).toArray():r(t,n,o,e).toArray()},{validateItems:i=function(t){var n=a.getCurrentValue(),e=a.shouldHide?0:1;return U(t,function(t){return c(t,e,n)})},getFetch:function(o,r){return function(t){var n=r(),e=i(n);t(Lk(e,Mp.CLOSE_ON_EXECUTE,o,!1))}}}),getStyleItems:s}},KT=function(o,t,n){var e=qT(0,t,n),r=e.items,i=e.getStyleItems;return Rk({text:n.icon.isSome()?st.none():st.some(""),icon:n.icon,tooltip:st.from(n.tooltip),role:st.none(),fetch:r.getFetch(t,i),onSetup:function(e){return n.setInitialValue.each(function(t){return t(e.getComponent())}),n.nodeChangeHandler.map(function(t){var n=t(e.getComponent());return o.on("NodeChange",n),function(){o.off("NodeChange",n)}}).getOr(Z)},getApi:function(t){return{getComponent:function(){return t}}},columns:1,presets:"normal",classes:n.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[]},"tox-tbtn",t.shared)};(DC=BC=BC||{})[DC.SemiColon=0]="SemiColon",DC[DC.Space=1]="Space";var JT,$T,QT=function(t,n,e,o){var r,i,u=t.getParam(n,e,"string");return{type:"basic",data:(i=u,r=o===BC.SemiColon?i.replace(/;$/,"").split(";"):i.split(" "),V(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}}))}},ZT=[{title:"Left",icon:"align-left",format:"alignleft",command:"JustifyLeft"},{title:"Center",icon:"align-center",format:"aligncenter",command:"JustifyCenter"},{title:"Right",icon:"align-right",format:"alignright",command:"JustifyRight"},{title:"Justify",icon:"align-justify",format:"alignjustify",command:"JustifyFull"}],tE=function(e){var n=function(t){var n=L(ZT,function(t){return e.formatter.match(t.format)}).fold(function(){return"left"},function(t){return t.title.toLowerCase()});Uo(t,Ik,{icon:"align-"+n})},t=st.some(function(t){return function(){return n(t)}}),o=st.some(function(t){return n(t)}),r={type:"basic",data:ZT};return{tooltip:"Align",icon:st.some("align-left"),isSelectedFor:function(t){return function(){return e.formatter.match(t)}},getCurrentValue:at(st.none()),getPreviewFor:function(t){return function(){return st.none()}},onAction:function(n){return function(){return L(ZT,function(t){return t.format===n.format}).each(function(t){return e.execCommand(t.command)})}},setInitialValue:o,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!e.formatter.canApply(t.format)}}},nE=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],eE=function(t){var n=t.split(/\s*,\s*/);return V(n,function(t){return t.replace(/^['"]+|['"]+$/g,"")})},oE=function(t){var n;return 0===t.indexOf("-apple-system")&&(n=eE(t.toLowerCase()),W(nE,function(t){return-1<n.indexOf(t.toLowerCase())}))},rE=function(r){var i=function(){var e=function(t){return t?eE(t)[0]:""},t=r.queryCommandValue("FontName"),n=u.data,o=t?t.toLowerCase():"";return{matchOpt:L(n,function(t){var n=t.format;return n.toLowerCase()===o||e(n).toLowerCase()===e(o).toLowerCase()}).orThunk(function(){return oE(o)?st.from({title:"System Font",format:o}):st.none()}),font:t}},n=function(t){var n=i(),e=n.matchOpt,o=n.font,r=e.fold(function(){return o},function(t){return t.title});Uo(t,Fk,{text:r})},t=st.some(function(t){return function(){return n(t)}}),e=st.some(function(t){return n(t)}),u=QT(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",BC.SemiColon);return{tooltip:"Fonts",icon:st.none(),isSelectedFor:function(n){return function(t){return t.exists(function(t){return t.format===n})}},getCurrentValue:function(){return i().matchOpt},getPreviewFor:function(t){return function(){return st.some({tag:"div",styles:-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:u,shouldHide:!1,isInvalid:function(){return!1}}},iE={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},uE=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},aE=function(e){var i=function(){var o=st.none(),r=u.data,i=e.queryCommandValue("FontSize");if(i)for(var t=function(t){var n=uE(i,t),e=Ft(iE,n).getOr("");o=L(r,function(t){return t.format===i||t.format===n||t.format===e})},n=3;o.isNone()&&0<=n;n--)t(n);return{matchOpt:o,size:i}},t=at(at(st.none())),n=function(t){var n=i(),e=n.matchOpt,o=n.size,r=e.fold(function(){return o},function(t){return t.title});Uo(t,Fk,{text:r})},o=st.some(function(t){return function(){return n(t)}}),r=st.some(function(t){return n(t)}),u=QT(e,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",BC.Space);return{tooltip:"Font sizes",icon:st.none(),isSelectedFor:function(n){return function(t){return t.exists(function(t){return t.format===n})}},getPreviewFor:t,getCurrentValue:function(){return i().matchOpt},onAction:function(t){return function(){e.undoManager.transact(function(){e.focus(),e.execCommand("FontSize",!1,t.format)})}},setInitialValue:r,nodeChangeHandler:o,dataset:u,shouldHide:!1,isInvalid:function(){return!1}}},cE=function(e,t,n){var o=t();return $(n,function(n){return L(o,function(t){return e.formatter.matchNode(n,t.format)})}).orThunk(function(){return e.formatter.match("p")?st.some({title:"Paragraph",format:"p"}):st.none()})},sE=function(t){var n=t.selection.getStart(!0)||t.getBody();return t.dom.getParents(n,function(){return!0},t.getBody())},fE=function(o,r){return function(n){var e=se(st.none()),t=function(){n.setActive(o.formatter.match(r));var t=o.formatter.formatChanged(r,n.setActive).unbind;e.set(st.some(t))};return o.initialized?t():o.on("init",t),function(){return e.get().each(function(t){return t()})}}},lE=function(n){return function(t){return function(){n.undoManager.transact(function(){n.focus(),n.execCommand("mceToggleFormat",!1,t.format)})}}},dE=function(o){var e=function(t,n){var e=cE(o,function(){return r.data},t).fold(function(){return"Paragraph"},function(t){return t.title});Uo(n,Fk,{text:e})},t=st.some(function(n){return function(t){return e(t.parents,n)}}),n=st.some(function(t){var n=sE(o);e(n,t)}),r=QT(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",BC.SemiColon);return{tooltip:"Blocks",icon:st.none(),isSelectedFor:function(t){return function(){return o.formatter.match(t)}},getCurrentValue:at(st.none()),getPreviewFor:function(n){return function(){var t=o.formatter.get(n);return st.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styles:o.dom.parseStyle(o.formatter.getCssText(n))})}},onAction:lE(o),setInitialValue:n,nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!o.formatter.canApply(t.format)}}},mE=function(i,t){var e=function(t,n){var e=function(t){var n=t.items;return n!==undefined&&0<n.length?U(n,e):[{title:t.title,format:t.format}]},o=U(vO(i),e),r=cE(i,function(){return o},t).fold(function(){return"Paragraph"},function(t){return t.title});Uo(n,Fk,{text:r})},n=st.some(function(n){return function(t){return e(t.parents,n)}}),o=st.some(function(t){var n=sE(i);e(n,t)});return{tooltip:"Formats",icon:st.none(),isSelectedFor:function(t){return function(){return i.formatter.match(t)}},getCurrentValue:at(st.none()),getPreviewFor:function(n){return function(){var t=i.formatter.get(n);return t!==undefined?st.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styles:i.dom.parseStyle(i.formatter.getCssText(n))}):st.none()}},onAction:lE(i),setInitialValue:o,nodeChangeHandler:n,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(t){return!i.formatter.canApply(t.format)},dataset:t}},gE=[{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"]}],pE=function(r,i){return function(t,n,e){var o=r(t).mapError(function(t){return En(t)}).getOrDie();return i(o,n,e)}},hE={button:pE($_,function(t,n){return e=t,o=n.backstage.shared.providers,AT(e,o,[]);var e,o}),togglebutton:pE(rT,function(t,n){return e=t,o=n.backstage.shared.providers,FT(e,o,[]);var e,o}),menubutton:pE(tT,function(t,n){return Uk(t,"tox-tbtn",n.backstage,st.none())}),splitbutton:pE(function(t){return On("SplitButton",nT,t)},function(t,n){return IT(t,n.backstage.shared)}),grouptoolbarbutton:pE(function(t){return On("GroupToolbarButton",iT,t)},function(t,n,e){var o,r,i,u,a,c,s=e.ui.registry.getAll().buttons,f=((o={})[Rc]=n.backstage.shared.header.isPositionedAtTop()?Yu.TopToBottom:Yu.BottomToTop,o);switch(Wh(e)){case Bp.floating:return r=t,i=n.backstage,u=function(t){return xE(e,{buttons:s,toolbar:t,allowToolbarGroups:!1},n,st.none())},a=f,c=i.shared,v_.sketch({lazySink:c.getSink,fetch:function(){return Iy(function(t){t(V(u(r.items),U_))})},markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:DT(r.icon,r.text,r.tooltip,st.none(),st.none(),c.providers),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:a}}}});default:throw new Error("Toolbar groups are only supported when using floating toolbar mode")}}),styleSelectButton:function(t,n){return e=t,o=n.backstage,r=et({type:"advanced"},o.styleselect),KT(e,o,mE(e,r));var e,o,r},fontsizeSelectButton:function(t,n){return e=t,o=n.backstage,KT(e,o,aE(e));var e,o},fontSelectButton:function(t,n){return e=t,o=n.backstage,KT(e,o,rE(e));var e,o},formatButton:function(t,n){return e=t,o=n.backstage,KT(e,o,dE(e));var e,o},alignMenuButton:function(t,n){return e=t,o=n.backstage,KT(e,o,tE(e));var e,o}},vE={styleselect:hE.styleSelectButton,fontsizeselect:hE.fontsizeSelectButton,fontselect:hE.fontSelectButton,formatselect:hE.formatButton,align:hE.alignMenuButton},bE=function(t){var n,e,o,r=t.toolbar,i=t.buttons;return!1===r?[]:r===undefined||!0===r?(e=i,o=V(gE,function(t){var n=H(t.items,function(t){return It(e,t)||It(vE,t)});return{name:t.name,items:n}}),H(o,function(t){return 0<t.items.length})):w(r)?(n=r.split("|"),V(n,function(t){return{items:t.trim().split(" ")}})):T(r,function(t){return It(t,"name")&&It(t,"items")})?r:(nt.console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])},yE=function(r,n,i,u,a,t){return Ft(n,i.toLowerCase()).orThunk(function(){return t.bind(function(t){return $(t,function(t){return Ft(n,t+i.toLowerCase())})})}).fold(function(){return Ft(vE,i.toLowerCase()).map(function(t){return t(r,a)}).orThunk(function(){return st.none()})},function(t){return"grouptoolbarbutton"!==t.type||u?(e=a,o=r,Ft(hE,(n=t).type).fold(function(){return nt.console.error("skipping button defined by",n),st.none()},function(t){return st.some(t(n,e,o))})):(nt.console.warn("Ignoring the '"+i+"' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested."),st.none());var n,e,o})},xE=function(e,o,r,i){var t=bE(o),n=V(t,function(t){var n=U(t.items,function(t){return 0===t.trim().length?[]:yE(e,o.buttons,t,o.allowToolbarGroups,r,i).toArray()});return{title:st.from(e.translate(t.name)),items:n}});return H(n,function(t){return 0<t.items.length})},wE={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"]},SE={maxHeightFunction:_c(),maxWidthFunction:KO()},kE={onLtr:function(){return[Ra,Va,Fa,Ma,Ia,Aa,Kg,Jg,Yg,Gg,qg,Xg]},onRtl:function(){return[Ra,Va,Ia,Aa,Fa,Ma,Kg,Jg,qg,Xg,Yg,Gg]}},CE={onLtr:function(){return[Va,Ma,Aa,Fa,Ia,Ra,Kg,Jg,Yg,Gg,qg,Xg]},onRtl:function(){return[Va,Aa,Ma,Ia,Fa,Ra,Kg,Jg,qg,Xg,Yg,Gg]}},OE=function(c,t,e,s){var o,r,f=ze().deviceType.isTouch,a=uu((o={sink:e,onEscape:function(){return c.focus(),st.some(!0)}},r=se([]),zg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){r.set([]),zg.getContent(t).each(function(t){Yi(t.element(),"visibility")}),Ci(t.element(),YT),Yi(t.element(),"width")},inlineBehaviours:Ka([$m("context-toolbar-events",[or(go(),function(t,n){Ci(t.element(),YT),Yi(t.element(),"width")}),$o(XT,function(n,e){Yi(n.element(),"width");var t=bu(n.element());zg.setContent(n,e.event().contents()),Si(n.element(),YT);var o=bu(n.element());Ni(n.element(),"width",t+"px"),zg.getContent(n).each(function(t){e.event().focus().bind(function(t){return ic(t),ac(n.element())}).orThunk(function(){return Gm.focusIn(t),uc()})}),$g.setTimeout(function(){Ni(n.element(),"width",o+"px")},0)}),$o(WT,function(t,n){zg.getContent(t).each(function(t){r.set(r.get().concat([{bar:t,focus:uc()}]))}),Uo(t,XT,{contents:n.event().forwardContents(),focus:st.none()})}),$o(GT,function(n,t){K(r.get()).each(function(t){r.set(r.get().slice(0,r.get().length-1)),Uo(n,XT,{contents:au(t.bar),focus:t.focus})})})]),Gm.config({mode:"special",onEscape:function(n){return K(r.get()).fold(function(){return o.onEscape()},function(t){return jo(n,GT),st.some(!0)})}})]),lazySink:function(){return ut.value(o.sink)}}))),l=function(){return zT(c,s.backstage.shared)},u=function(){if(f()&&s.backstage.isContextMenuOpen())return!0;var t,n,e,o,r,i,u=(t=m.get().filter(function(t){return Ri(le.fromDom(t))}).map(function(t){return t.getBoundingClientRect()}).getOrThunk(function(){return c.selection.getRng().getBoundingClientRect()}),n=c.inline?ku().top():Au(le.fromDom(c.getBody())).y,{y:t.top+n,bottom:t.bottom+n}),a=l();return e=u.y,o=u.bottom,r=a.y,i=a.bottom,!(Math.max(e,r)<=Math.min(o,i))},n=function(){zg.hide(a)},i=function(){d.get().each(function(t){var n=a.element();Yi(n,"display"),u()?Ni(n,"display","none"):Ns.positionWithinBounds(e,t,a,st.some(l()))})},d=se(st.none()),m=se(st.none()),g=se(null),p=function(t){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:Ka([Gm.config({mode:"acyclic"}),$m("pop-dialog-wrap-events",[rr(function(t){c.shortcuts.add("ctrl+F9","focus statusbar",function(){return Gm.focusIn(t)})}),ir(function(t){c.shortcuts.remove("ctrl+F9")})])])}},h=Lt(function(){return UT(t,function(t){var n=v([t]);Uo(a,WT,{forwardContents:p(n)})})}),v=function(t){var n=c.ui.registry.getAll().buttons,e=h(),o=et(et({},n),e.formNavigators),r=Wh(c)===Bp.scrolling?Bp.scrolling:Bp["default"],i=it(V(t,function(t){return"contexttoolbar"===t.type?xE(c,{buttons:o,toolbar:t.items,allowToolbarGroups:!1},s,st.some(["form:"])):(n=t,e=s.backstage.shared.providers,HT(n,e));var n,e}));return q_({type:r,uid:Wr("context-toolbar"),initGroups:i,onEscape:st.none,cyclicKeying:!0,providers:s.backstage.shared.providers})};c.on("contexttoolbar-show",function(n){var t=h();Ft(t.lookupTable,n.toolbarKey).each(function(t){y([t],n.target===c?st.none():st.some(n)),zg.getContent(a).each(Gm.focusIn)})});var b=function(t,n){var e,o,r="node"===t?s.backstage.shared.anchors.node(n):s.backstage.shared.anchors.cursor();return zt(r,(e=t,o=f(),"line"===e?{bubble:Mc(12,0,wE),layouts:{onLtr:function(){return[Pa]},onRtl:function(){return[Ha]}},overrides:SE}:{bubble:Mc(0,12,wE),layouts:o?CE:kE,overrides:SE}))},y=function(t,n){if(w(),!f()||!s.backstage.isContextMenuOpen()){var e=v(t),o=n.map(le.fromDom),r=b(t[0].position,o);d.set(st.some(r)),m.set(n);var i=a.element();Yi(i,"display"),zg.showWithinBounds(a,r,p(e),function(){return st.some(l())}),u()&&Ni(i,"display","none")}},x=function(){if(c.hasFocus()){var t,n,e,o,r,i,u=h();t=u,n=c,o=le.fromDom(n.getBody()),r=function(t){return je(t,o)},i=le.fromDom(n.selection.getNode()),(r(e=i)||We(o,e)?LT(i,t.inNodeScope,t.inEditorScope).orThunk(function(){return jT(r,i,t)}):st.none()).fold(function(){d.set(st.none()),zg.hide(a)},function(t){y(t.toolbars,st.some(t.elem.dom()))})}},w=function(){var t=g.get();null!==t&&($g.clearTimeout(t),g.set(null))},S=function(t){w(),g.set(t)};c.on("init",function(){c.on(JO,n),c.on("ScrollContent ScrollWindow longpress",i),c.on("click keyup focus SetContent ObjectResized ResizeEditor",function(){S($g.setEditorTimeout(c,x,0))}),c.on("focusout",function(t){$g.setEditorTimeout(c,function(){ac(e.element()).isNone()&&ac(a.element()).isNone()&&(d.set(st.none()),zg.hide(a))},0)}),c.on("SwitchMode",function(){c.mode.isReadOnly()&&(d.set(st.none()),zg.hide(a))}),c.on("NodeChange",function(t){ac(a.element()).fold(function(){S($g.setEditorTimeout(c,x,0))},function(t){})})})},_E=Tl,TE=fl,EE=at([te("shell",!1),Nn("makeItem"),te("setupItem",Z),Ff("listBehaviours",[Jm])]),BE=al({name:"items",overrides:function(){return{behaviours:Ka([Jm.config({})])}}}),DE=at([BE]),ME=Vl({name:at("CustomList")(),configFields:EE(),partFields:DE(),factory:function(s,t,n,e){var o=s.shell?{behaviours:[Jm.config({})],components:[]}:{behaviours:[],components:t},r=function(t){return s.shell?st.some(t):yl(t,s,"items")};return{uid:s.uid,dom:s.dom,components:o.components,behaviours:Af(s.listBehaviours,o.behaviours),apis:{setItems:function(a,c){r(a).fold(function(){throw nt.console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},function(n){var t=Jm.contents(n),e=c.length,o=e-t.length,r=0<o?I(o,function(){return s.makeItem()}):[],i=t.slice(e);rt(i,function(t){return Jm.remove(n,t)}),rt(r,function(t){return Jm.append(n,t)});var u=Jm.contents(n);rt(u,function(t,n){s.setupItem(a,t,c[n],n)})})}}}},apis:{setItems:function(t,n,e){t.setItems(n,e)}}}),AE=function(t){return(Gi(t,"position").is("fixed")?st.none():yr(t)).orThunk(function(){var e=le.fromTag("span");return br(t).bind(function(t){Or(t,e);var n=yr(e);return Er(e),n})})},FE=function(t){return AE(t).map(pu).getOrThunk(function(){return mu(0,0)})},IE=Vt([{"static":[]},{absolute:["positionCss"]},{fixed:["positionCss"]}]),RE=function(t,n){var e=t.element();Si(e,n.transitionClass),Ci(e,n.fadeOutClass),Si(e,n.fadeInClass),n.onShow(t)},VE=function(t,n){var e=t.element();Si(e,n.transitionClass),Ci(e,n.fadeInClass),Si(e,n.fadeOutClass),n.onHide(t)},PE=function(t,o,r){return W(t,function(t){switch(t){case"bottom":return e=r,o.bottom<=e.bottom;case"top":return n=r,o.y>=n.y}var n,e})},HE=function(n,t){return t.getInitialPosition().map(function(t){return Du(t.bounds.x,t.bounds.y,bu(n),fu(n))})},zE=function(t,n,e){e.setInitialPosition(st.some({style:function(t){var n={},e=t.dom();if(Ei(e))for(var o=0;o<e.style.length;o++){var r=e.style.item(o);n[r]=e.style[r]}return n}(t),position:Ui(t,"position")||"static",bounds:n}))},NE=function(e,o,r){return r.getInitialPosition().bind(function(t){switch(r.setInitialPosition(st.none()),t.position){case"static":return st.some(IE["static"]());case"absolute":var n=AE(e).map(Mu).getOrThunk(function(){return Mu(Vi())});return st.some(IE.absolute(sc("absolute",Ft(t.style,"left").map(function(t){return o.x-n.x}),Ft(t.style,"top").map(function(t){return o.y-n.y}),Ft(t.style,"right").map(function(t){return n.right-o.right}),Ft(t.style,"bottom").map(function(t){return n.bottom-o.bottom}))));default:return st.none()}})},LE=function(t,n,e){var o,r,i,u=t.element();return Gi(u,"position").is("fixed")?(r=n,HE(o=u,i=e).filter(function(t){return PE(i.getModes(),t,r)}).bind(function(t){return NE(o,t,i)})):function(t,n,e){var o=Mu(t);if(PE(e.getModes(),o,n))return st.none();zE(t,o,e);var r=Fu(),i=o.x-r.x,u=n.y-r.y,a=r.bottom-n.bottom,c=o.y<=n.y;return st.some(IE.fixed(sc("fixed",st.some(i),c?st.some(u):st.none(),st.none(),c?st.none():st.some(a))))}(u,n,e)},jE=function(n,t){rt(["left","right","top","bottom","position"],function(t){return Yi(n.element(),t)}),t.onUndocked(n)},UE=function(t,n,e){fc(t.element(),e),("fixed"===e.position()?n.onDocked:n.onUndocked)(t)},WE=function(i,t,u,a,c){void 0===c&&(c=!1),t.contextual.each(function(r){r.lazyContext(i).each(function(t){var n,e,o=(e=a,(n=t).y<e.bottom&&n.bottom>e.y);o!==u.isVisible()&&(u.setVisible(o),c&&!o?(_i(i.element(),[r.fadeOutClass]),r.onHide(i)):(o?RE:VE)(i,r))})})},GE=function(n,e,t){var o,r,i=n.element();t.setDocked(!1),o=t,r=n.element(),HE(r,o).bind(function(t){return NE(r,t,o)}).each(function(t){t.fold(function(){return jE(n,e)},function(t){return UE(n,e,t)},Z)}),t.setVisible(!0),e.contextual.each(function(t){Ti(i,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(n)}),XE(n,e,t)},XE=function(t,n,e){var o,r,i,u,a;t.getSystem().isConnected()&&(o=t,i=e,u=(r=n).lazyViewport(o),(a=i.isDocked())&&WE(o,r,i,u),LE(o,u,i).each(function(t){i.setDocked(!a),t.fold(function(){return jE(o,r)},function(t){return UE(o,r,t)},function(t){WE(o,r,i,u,!0),UE(o,r,t)})}))},YE=function(t,n,e){e.isDocked()&&GE(t,n,e)},qE=/* */Object.freeze({__proto__:null,refresh:XE,reset:YE,isDocked:function(t,n,e){return e.isDocked()},getModes:function(t,n,e){return e.getModes()},setModes:function(t,n,e,o){return e.setModes(o)}}),KE=/* */Object.freeze({__proto__:null,events:function(o,r){return qo([or(go(),function(n,e){o.contextual.each(function(t){Oi(n.element(),t.transitionClass)&&(Ti(n.element(),[t.transitionClass,t.fadeInClass]),(r.isVisible()?t.onShown:t.onHidden)(n));e.stop()})}),$o(Do(),function(t,n){XE(t,o,r)}),$o(Mo(),function(t,n){YE(t,o,r)})])}}),JE=[Zn("contextual",[jn("fadeInClass"),jn("fadeOutClass"),jn("transitionClass"),Wn("lazyContext"),aa("onShow"),aa("onShown"),aa("onHide"),aa("onHidden")]),ue("lazyViewport",Fu),ne("modes",["top","bottom"],dn(In)),aa("onDocked"),aa("onUndocked")],$E=$a({fields:JE,name:"docking",active:KE,apis:qE,state:/* */Object.freeze({__proto__:null,init:function(t){var n=se(!1),e=se(!0),o=se(st.none()),r=se(t.modes);return ai({isDocked:n.get,setDocked:n.set,getInitialPosition:o.get,setInitialPosition:o.set,isVisible:e.get,setVisible:e.set,getModes:r.get,setModes:r.set,readState:function(){return"docked: "+n.get()+", visible: "+e.get()+", modes: "+r.get().join(",")}})}})}),QE={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},ZE="tox-tinymce--toolbar-sticky-on",tB="tox-tinymce--toolbar-sticky-off",nB=function(r){var i=r.element();br(i).each(function(t){var n,e="padding-"+$E.getModes(r)[0];if($E.isDocked(r)){var o=bu(t);Ni(i,"width",o+"px"),Ni(t,e,lu(n=i)+(parseInt(Ui(n,"margin-top"),10)||0)+(parseInt(Ui(n,"margin-bottom"),10)||0)+"px")}else Yi(i,"width"),Yi(t,e)})},eB=function(t,n){n?(Ci(t,QE.fadeOutClass),_i(t,[QE.transitionClass,QE.fadeInClass])):(Ci(t,QE.fadeInClass),_i(t,[QE.fadeOutClass,QE.transitionClass]))},oB=function(t,n){var e=le.fromDom(t.getContainer());n?(Si(e,ZE),Ci(e,tB)):(Si(e,tB),Ci(e,ZE))},rB=function(c,t){var n,i=se(st.none()),o=t.getSink,u=function(n){o().each(function(t){return n(t.element())})},e=function(t){c.inline||nB(t),oB(c,$E.isDocked(t)),t.getSystem().broadcastOn([lf()],{}),o().each(function(t){return t.getSystem().broadcastOn([lf()],{})})},r=c.inline?[]:[oc.config({channels:((n={})[L_()]={onReceive:nB},n)})];return b([eg.config({}),$E.config({contextual:et({lazyContext:function(t){var n,e,o=lu(t.element()),r=c.inline?c.getContentAreaContainer():c.getContainer(),i=Mu(le.fromDom(r)),u=i.height-o,a=i.y+(n=t,e="top",A($E.getModes(n),e)?0:o);return st.some(Du(i.x,a,i.width,u))},onShow:function(){u(function(t){return eB(t,!0)})},onShown:function(r){u(function(t){return Ti(t,[QE.transitionClass,QE.fadeInClass])}),i.get().each(function(t){var n,e,o;n=r.element(),o=gr(e=t),uc(o).filter(function(t){return!je(e,t)}).filter(function(t){return je(t,le.fromDom(o.dom().body))||We(n,t)}).each(function(){return ic(e)}),i.set(st.none())})},onHide:function(t){var n,e;i.set((n=t.element(),e=o,ac(n).orThunk(function(){return e().toOption().bind(function(t){return ac(t.element())})}))),u(function(t){return eB(t,!1)})},onHidden:function(){u(function(t){return Ti(t,[QE.transitionClass])})}},QE),modes:[t.header.getDockingMode()],onDocked:e,onUndocked:e})],r)},iB=/* */Object.freeze({__proto__:null,setup:function(t,n,o){t.inline||(n.header.isPositionedAtTop()||t.on("ResizeEditor",function(){o().each($E.reset)}),t.on("ResizeWindow ResizeEditor",function(){o().each(nB)}),t.on("SkinLoaded",function(){o().each(function(t){$E.isDocked(t)?$E.reset(t):$E.refresh(t)})}),t.on("FullscreenStateChanged",function(){o().each($E.reset)})),t.on("AfterScrollIntoView",function(e){o().each(function(t){$E.refresh(t);var n=t.element();zd(n)&&function(t,n){var e=gr(n),o=e.dom().defaultView.innerHeight,r=ku(e),i=le.fromDom(t.elm),u=Au(i),a=fu(i),c=u.y,s=c+a,f=pu(n),l=fu(n),d=f.top(),m=d+l,g=Math.abs(d-r.top())<2,p=Math.abs(m-(r.top()+o))<2;if(g&&c<m)Cu(r.left(),c-l,e);else if(p&&d<s){var h=c-o+a+l;Cu(r.left(),h,e)}}(e,n)})}),t.on("PostRender",function(){oB(t,!1)})},isDocked:function(t){return t().map($E.isDocked).getOr(!1)},getBehaviours:rB}),uB=Z,aB=c,cB=at([]),sB=/* */Object.freeze({__proto__:null,setup:uB,isDocked:aB,getBehaviours:cB}),fB=Rl({factory:function(n,o){var t={focus:Gm.focusIn,setMenus:function(t,n){var e=V(n,function(n){var t={type:"menubutton",text:n.text,fetch:function(t){t(n.getItems())}},e=tT(t).mapError(function(t){return En(t)}).getOrDie();return Uk(e,"tox-mbtn",o.backstage,st.some("menuitem"))});Jm.set(t,e)}};return{uid:n.uid,dom:n.dom,components:[],behaviours:Ka([Jm.config({}),$m("menubar-events",[rr(function(t){n.onSetup(t)}),$o(io(),function(e,t){Lu(e.element(),".tox-mbtn--active").each(function(n){ju(t.event().target(),".tox-mbtn").each(function(t){je(n,t)||e.getSystem().getByDom(n).each(function(n){e.getSystem().getByDom(t).each(function(t){sx.expand(t),sx.close(n),eg.focus(t)})})})})}),$o(Vo(),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){sx.isOpen(n)&&(sx.expand(t),sx.close(n))})})})]),Gm.config({mode:"flow",selector:".tox-mbtn",onEscape:function(t){return n.onEscape(t),st.some(!0)}}),uy.config({})]),apis:t,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[Nn("dom"),Nn("uid"),Nn("onEscape"),Nn("backstage"),te("onSetup",Z)],apis:{focus:function(t,n){t.focus(n)},setMenus:function(t,n,e){t.setMenus(n,e)}}}),lB="container",dB=[Df("slotBehaviours",[])],mB=function(t){return"<alloy.field."+t+">"},gB=function(r,t){var e,n=function(t){return kl(r)},o=function(e,o){return function(t,n){return yl(t,r,n).map(function(t){return e(t,n)}).getOr(o)}},i=function(t,n){return"true"!==Ir(t.element(),"aria-hidden")},u=o(i,!1),a=o(function(t,n){if(i(t)){var e=t.element();Ni(e,"display","none"),Fr(e,"aria-hidden","true"),Uo(t,Po(),{name:n,visible:!1})}}),c=function(n,t){rt(t,function(t){return e(n,t)})},s=o(function(t,n){if(!i(t)){var e=t.element();Yi(e,"display"),Pr(e,"aria-hidden"),Uo(t,Po(),{name:n,visible:!0})}}),f={getSlotNames:n,getSlot:function(t,n){return yl(t,r,n)},isShowing:u,hideSlot:e=a,hideAllSlots:function(t){return c(t,n())},showSlot:s};return{uid:r.uid,dom:r.dom,components:t,behaviours:Mf(r.slotBehaviours),apis:f}},pB=Tt({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)}},function(t){return ii(t)}),hB=et(et({},pB),{sketch:function(t){var e,n=(e=[],{slot:function(t,n){return e.push(t),gl(lB,mB(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=V(r,function(t){return il({name:t,pname:mB(t)})});return Bl(lB,dB,i,gB,o)}}),vB=ln([$n("icon"),$n("tooltip"),ue("onShow",Z),ue("onHide",Z),ue("onSetup",function(){return Z})]),bB=function(t){return{element:function(){return t.element().dom()}}},yB=function(e,o){var r=V(Ct(o),function(t){var n=o[t],e=_n(On("sidebar",vB,n));return{name:t,getApi:bB,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return V(r,function(t){var n=se(Z);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:uh([av(t,n),cv(t,n),$o(Po(),function(n,t){var e=t.event();L(r,function(t){return t.name===e.name()}).each(function(t){(e.visible()?t.onShow:t.onHide)(t.getApi(n))})})])})})},xB=function(t,e){Ll.getCurrent(t).each(function(t){return Jm.set(t,[(n=e,hB.sketch(function(t){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:yB(t,n),slotBehaviours:uh([rr(function(t){return hB.hideAllSlots(t)})])}}))]);var n})},wB=function(t){return Ll.getCurrent(t).bind(function(t){return V_.isGrowing(t)||V_.hasGrown(t)?Ll.getCurrent(t).bind(function(n){return L(hB.getSlotNames(n),function(t){return hB.isShowing(n,t)})}):st.none()})},SB=Wr("FixSizeEvent"),kB=Wr("AutoSizeEvent"),CB=function(t){var n,e,o,r=le.fromHtml(t),i=xr(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],N(e,function(t,n){var e;return"class"===n.name?t:et(et({},t),((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:Dr(r)};return et({tag:cr(r),classes:a,attributes:u},c)},OB=function(t,n,e){var o=t.element();!0===n?(Jm.set(t,[{dom:{tag:"div",attributes:{"aria-label":e.translate("Loading...")},classes:["tox-throbber__busy-spinner"]},components:[{dom:CB('<div class="tox-spinner"><div></div><div></div><div></div></div>')}],behaviours:Ka([Gm.config({mode:"special",onTab:function(){return st.some(!0)},onShiftTab:function(){return st.some(!0)}}),eg.config({})])}]),Yi(o,"display"),Pr(o,"aria-hidden")):(Jm.set(t,[]),Ni(o,"display","none"),Fr(o,"aria-hidden","true"))},_B=TE.optional({factory:fB,name:"menubar",schema:[Nn("backstage")]}),TB=TE.optional({factory:{sketch:function(t){return ME.sketch({uid:t.uid,dom:t.dom,listBehaviours:Ka([Gm.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:function(){return q_({type:t.type,uid:Wr("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:t.providers,onEscape:function(){return st.none()}})},setupItem:function(t,n,e,o){e_.setGroups(n,e)},shell:!0})}},name:"multiple-toolbar",schema:[Nn("dom"),Nn("onEscape")]}),EB=TE.optional({factory:{sketch:function(t){var n;return((n=t).type===Bp.sliding?Y_:n.type===Bp.floating?X_:q_)({type:t.type,uid:t.uid,onEscape:function(){return t.onEscape(),st.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,providers:t.providers,moreDrawerData:{lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton,lazyHeader:t.lazyHeader},attributes:t.attributes})}},name:"toolbar",schema:[Nn("dom"),Nn("onEscape"),Nn("getSink")]}),BB=TE.optional({factory:{sketch:function(t){var n=t.editor,e=t.sticky?rB:cB;return{uid:t.uid,dom:t.dom,components:t.components,behaviours:Ka(e(n,t.sharedBackstage))}}},name:"header",schema:[Nn("dom")]}),DB=TE.optional({name:"socket",schema:[Nn("dom")]}),MB=TE.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:Ka([uy.config({}),eg.config({}),V_.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){Ll.getCurrent(t).each(hB.hideAllSlots),jo(t,kB)},onGrown:function(t){jo(t,kB)},onStartGrow:function(t){Uo(t,SB,{width:Gi(t.element(),"width").getOr("")})},onStartShrink:function(t){Uo(t,SB,{width:bu(t.element())+"px"})}}),Jm.config({}),Ll.config({find:function(t){var n=Jm.contents(t);return q(n)}})])}],behaviours:Ka([dS(0),$m("sidebar-sliding-events",[$o(SB,function(t,n){Ni(t.element(),"width",n.event().width())}),$o(kB,function(t,n){Yi(t.element(),"width")})])])}}},name:"sidebar",schema:[Nn("dom")]}),AB=TE.optional({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:Ka([Jm.config({})]),components:[]}}},name:"throbber",schema:[Nn("dom")]}),FB=Vl({name:"OuterContainer",factory:function(e,t,n){var o={getSocket:function(t){return _E.getPart(t,e,"socket")},setSidebar:function(t,n){_E.getPart(t,e,"sidebar").each(function(t){return xB(t,n)})},toggleSidebar:function(t,o){_E.getPart(t,e,"sidebar").each(function(t){return n=t,e=o,void Ll.getCurrent(n).each(function(n){Ll.getCurrent(n).each(function(t){V_.hasGrown(n)?hB.isShowing(t,e)?V_.shrink(n):(hB.hideAllSlots(t),hB.showSlot(t,e)):(hB.hideAllSlots(t),hB.showSlot(t,e),V_.grow(n))})});var n,e})},whichSidebar:function(t){return _E.getPart(t,e,"sidebar").bind(wB).getOrNull()},getHeader:function(t){return _E.getPart(t,e,"header")},getToolbar:function(t){return _E.getPart(t,e,"toolbar")},setToolbar:function(t,n){_E.getPart(t,e,"toolbar").each(function(t){t.getApis().setGroups(t,n)})},setToolbars:function(t,n){_E.getPart(t,e,"multiple-toolbar").each(function(t){ME.setItems(t,n)})},refreshToolbar:function(t){_E.getPart(t,e,"toolbar").each(function(t){return t.getApis().refresh(t)})},getThrobber:function(t){return _E.getPart(t,e,"throbber")},focusToolbar:function(t){_E.getPart(t,e,"toolbar").orThunk(function(){return _E.getPart(t,e,"multiple-toolbar")}).each(function(t){Gm.focusIn(t)})},setMenubar:function(t,n){_E.getPart(t,e,"menubar").each(function(t){fB.setMenus(t,n)})},focusMenubar:function(t){_E.getPart(t,e,"menubar").each(function(t){fB.focus(t)})}};return{uid:e.uid,dom:e.dom,components:t,apis:o,behaviours:e.behaviours}},configFields:[Nn("dom"),Nn("behaviours")],partFields:[BB,_B,EB,TB,DB,MB,AB],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)},getHeader:function(t,n){return t.getHeader(n)},getToolbar:function(t,n){return t.getToolbar(n)},setToolbar:function(t,n,e){var o=V(e,function(t){return U_(t)});t.setToolbar(n,o)},setToolbars:function(t,n,e){var o=V(e,function(t){return V(t,U_)});t.setToolbars(n,o)},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)}}}),IB={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 | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},RB=function(t){return"string"==typeof t?t.split(" "):t},VB=function(i,u){var a=et(et({},IB),u.menus),n=0<Ct(u.menus).length,t=u.menubar===undefined||!0===u.menubar?RB("file edit view insert format tools table help"):RB(!1===u.menubar?"":u.menubar),e=H(t,function(t){return n&&u.menus.hasOwnProperty(t)&&u.menus[t].hasOwnProperty("items")||IB.hasOwnProperty(t)}),o=V(e,function(t){var n,e,o,r=a[t];return n={title:r.title,items:RB(r.items)},e=u,o=i.getParam("removed_menuitems","").split(/[ ,]/),{text:n.title,getItems:function(){return U(n.items,function(t){var n=t.toLowerCase();return 0===n.trim().length||F(o,function(t){return t===n})?[]:"separator"===n||"|"===n?[{type:"separator"}]:e.menuItems[n]?[e.menuItems[n]]:[]})}}});return H(o,function(t){return 0<t.getItems().length&&F(t.getItems(),function(t){return"separator"!==t.type})})},PB=function(t){var n=function(){t._skinLoaded=!0,t.fire("SkinLoaded")};return function(){t.initialized?n():t.on("init",n)}},HB=function(n,e){return function(){return t={message:e},n.fire("SkinLoadError",t);var t}},zB=function(t,n){var e,o=function(t){var n=t.getParam("skin"),e=t.getParam("skin_url");if(!1!==n){var o=n||"oxide";e=e?t.documentBaseURI.toAbsolute(e):Mh.baseURL+"/skins/ui/"+o}return e}(n);o&&(e=o+"/skin.min.css",n.contentCSS.push(o+(t?"/content.inline":"/content")+".min.css")),!1==(!1===n.getParam("skin"))&&e?n.ui.styleSheetLoader.load(e,PB(n),HB(n,"Skin could not be loaded")):PB(n)()},NB=g(zB,!1),LB=g(zB,!0),jB=function(e,t,o,r){var n=t.outerContainer,i=o.toolbar,u=o.buttons;if(T(i,w)){var a=i.map(function(t){var n={toolbar:t,buttons:u,allowToolbarGroups:o.allowToolbarGroups};return xE(e,n,{backstage:r},st.none())});FB.setToolbars(n,a)}else FB.setToolbar(n,xE(e,o,{backstage:r},st.none()))},UB=ph.DOM,WB=ze(),GB=WB.os.isiOS()&&WB.os.version.major<=12,XB=function(e,t){var n=e.getWin(),o=e.getDoc().documentElement,r=se(mu(n.innerWidth,n.innerHeight)),i=se(mu(o.offsetWidth,o.offsetHeight)),u=function(){var t=r.get();t.left()===n.innerWidth&&t.top()===n.innerHeight||(r.set(mu(n.innerWidth,n.innerHeight)),Yv(e))},a=function(){var t=e.getDoc().documentElement,n=i.get();n.left()===t.offsetWidth&&n.top()===t.offsetHeight||(i.set(mu(t.offsetWidth,t.offsetHeight)),Yv(e))},c=function(t){return n=t,e.fire("ScrollContent",n);var n};UB.bind(n,"resize",u),UB.bind(n,"scroll",c);var s=Db(le.fromDom(e.getBody()),"load",a),f=t.uiMothership.element();e.on("hide",function(){Ni(f,"display","none")}),e.on("show",function(){Yi(f,"display")}),e.on("NodeChange",a),e.on("remove",function(){s.unbind(),UB.unbind(n,"resize",u),UB.unbind(n,"scroll",c)})},YB=/* */Object.freeze({__proto__:null,render:function(e,o,t,n,r){var i=se(0);NB(e);var u,a,c,s=le.fromDom(r.targetNode),f=(u=Ai(s),Bi(u)?u:le.fromDom(pr(u).dom().body));a=s,c=o.mothership,$s(a,c,kr),Js(f,o.uiMothership),e.on("PostRender",function(){jB(e,o,t,n),i.set(e.getWin().innerWidth),FB.setMenubar(o.outerContainer,VB(e,t)),FB.setSidebar(o.outerContainer,t.sidebar),XB(e,o)});var l,d,m,g=FB.getSocket(o.outerContainer).getOrDie("Could not find expected socket element");if(GB){Li(g.element(),{overflow:"scroll","-webkit-overflow-scrolling":"touch"});var p=(l=function(){e.fire("ScrollContent")},d=20,m=null,{cancel:function(){null!==m&&(nt.clearTimeout(m),m=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null===m&&(m=nt.setTimeout(function(){l.apply(null,t),m=null},d))}});Bb(g.element(),"scroll",p.throttle)}tv(e,o),e.addCommand("ToggleSidebar",function(t,n){FB.toggleSidebar(o.outerContainer,n),e.fire("ToggleSidebar")}),e.addQueryValueHandler("ToggleSidebar",function(){return FB.whichSidebar(o.outerContainer)});var h=Wh(e);return h!==Bp.sliding&&h!==Bp.floating||e.on("ResizeWindow ResizeEditor ResizeContent",function(){var t=e.getWin().innerWidth;t!==i.get()&&(FB.refreshToolbar(o.outerContainer),i.set(t))}),{iframeContainer:g.element().dom(),editorContainer:o.outerContainer.element().dom()}}}),qB=function(){return t=function(t){t.unbind()},n=se(st.none()),e=function(){n.get().each(t)},{clear:function(){e(),n.set(st.none())},isSet:function(){return n.get().isSome()},set:function(t){e(),n.set(st.some(t))}};var t,n,e},KB=function(t){return/^[0-9\.]+(|px)$/i.test(""+t)?st.some(parseInt(""+t,10)):st.none()},JB=function(t){return ot(t)?t+"px":t},$B=function(n,t,e){var o=t.filter(function(t){return n<t}),r=e.filter(function(t){return t<n});return o.or(r).getOr(n)},QB=function(t){var n,e,o,r;return(e=Ah(n=t),o=Rh(n),r=Ph(n),KB(e).map(function(t){return $B(t,o,r)})).getOr(Ah(t))},ZB=function(t){var n=Fh(t),e=Ih(t),o=Vh(t);return KB(n).map(function(t){return $B(t,e,o)})},tD=function(a,c,t,n,s){var e=t.uiMothership,f=t.outerContainer,o=ph.DOM,l=qh(a),d=Jh(a),m=Vh(a).or(ZB(a)),r=n.shared.header,g=r.isPositionedAtTop,i=Wh(a),p=i===Bp.sliding||i===Bp.floating,u=se(!1),h=function(){return u.get()&&!a.removed},v=function(t){return p?t.fold(function(){return 0},function(t){return 1<t.components().length?fu(t.components()[1].element()):0}):0},b=function(){e.broadcastOn([lf()],{})},y=function(t){if(void 0===t&&(t=!1),h()){var n,e,o,r,i;if(l||(n=m.getOrThunk(function(){var t=KB(Ui(Vi(),"margin-left")).getOr(0);return bu(Vi())-pu(c).left()+t}),Ni(s.get().element(),"max-width",n+"px")),p&&FB.refreshToolbar(f),l||(e=FB.getToolbar(f),o=v(e),r=Mu(c),i=g()?Math.max(r.y-fu(s.get().element())+o,0):r.bottom,Li(f.element(),{position:"absolute",top:Math.round(i)+"px",left:Math.round(r.x)+"px"})),d){var u=s.get();t?$E.reset(u):$E.refresh(u)}b()}},x=function(t){if(void 0===t&&(t=!0),!l&&d&&h()){var n=r.getDockingMode(),e=function(t){switch(Gh(a)){case jh.auto:var n=FB.getToolbar(f),e=v(n),o=fu(t.element())-e,r=Mu(c);if(r.y>o)return"top";var i=hr(c),u=Math.max(i.dom().scrollHeight,fu(i));return r.bottom<u-o||Fu().bottom<r.bottom-o?"bottom":"top";case jh.bottom:return"bottom";case jh.top:default:return"top"}}(s.get());e!==n&&(function(t){var n=s.get();$E.setModes(n,[t]),r.setDockingMode(t);var e=g()?Yu.TopToBottom:Yu.BottomToTop;Fr(n.element(),Rc,e)}(e),t&&y(!0))}};return{isVisible:h,isPositionedAtTop:g,show:function(){u.set(!0),Ni(f.element(),"display","flex"),o.addClass(a.getBody(),"mce-edit-focus"),Yi(e.element(),"display"),x(!1),y()},hide:function(){u.set(!1),t.outerContainer&&(Ni(f.element(),"display","none"),o.removeClass(a.getBody(),"mce-edit-focus")),Ni(e.element(),"display","none")},update:y,updateMode:x,repositionPopups:b}},nD=function(t,n){var e=Mu(t);return{pos:n?e.y:e.bottom,bounds:e}},eD=/* */Object.freeze({__proto__:null,render:function(n,e,o,r,t){var i=e.mothership,u=e.uiMothership,a=e.outerContainer,c=se(null),s=le.fromDom(t.targetNode),f=tD(n,s,e,r,c);LB(n);var l=function(){if(c.get())f.show();else{c.set(FB.getHeader(a).getOrDie());var t=Yh(n).getOr(Vi());Js(t,i),Js(t,u),jB(n,e,o,r),FB.setMenubar(a,VB(n,o)),f.show(),function(c,s,f){var l=se(nD(s,f.isPositionedAtTop())),n=function(t){var n=nD(s,f.isPositionedAtTop()),e=n.pos,o=n.bounds,r=l.get(),i=r.pos,u=r.bounds,a=o.height!==u.height||o.width!==u.width;l.set({pos:e,bounds:o}),a&&Yv(c,t),f.isVisible()&&(i!==e?f.update(!0):a&&(f.updateMode(),f.repositionPopups()))};c.on("activate",f.show),c.on("deactivate",f.hide),c.on("SkinLoaded ResizeWindow",function(){return f.update(!0)}),c.on("NodeChange keydown",function(t){$g.requestAnimationFrame(function(){return n(t)})}),c.on("ScrollWindow",function(){return f.updateMode()});var t=qB();t.set(Db(le.fromDom(c.getBody()),"load",n)),c.on("remove",function(){t.clear()})}(n,s,f),n.nodeChanged()}};return n.on("focus show",l),n.on("blur hide",f.hide),n.on("init",function(){n.hasFocus()&&l()}),tv(n,e),{editorContainer:a.element().dom()}}}),oD=function(t,n){return function(){t.execCommand("mceToggleFormat",!1,n)}},rD=function(t){var n,e;!function(e){vC.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:fE(e,t.name),onAction:oD(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:fE(e,n),onAction:oD(e,n)})}}(t),n=t,vC.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,vC.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:fE(e,t.name)})})},iD=function(t){var n;rD(t),n=t,vC.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:oD(n,"code")})},uD=function(t,n,e){var o=function(){return!!n.undoManager&&n.undoManager[e]()},r=function(){t.setDisabled(n.mode.isReadOnly()||!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)}},aD=function(t){var n,e;(n=t).ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(t){return uD(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 uD(t,n,"hasRedo")},onAction:function(){return n.execCommand("redo")}}),(e=t).ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(t){return uD(t,e,"hasUndo")},onAction:function(){return e.execCommand("undo")}}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(t){return uD(t,e,"hasRedo")},onAction:function(){return e.execCommand("redo")}})},cD=function(t,n){var e,o,r,i,u,a,c,s,f,l,d,m,g,p;r=qT(0,o=n,tE(e=t)),e.ui.registry.addNestedMenuItem("align",{text:o.shared.providers.translate("Align"),getSubmenuItems:function(){return r.items.validateItems(r.getStyleItems())}}),a=qT(0,u=n,rE(i=t)),i.ui.registry.addNestedMenuItem("fontformats",{text:u.shared.providers.translate("Fonts"),getSubmenuItems:function(){return a.items.validateItems(a.getStyleItems())}}),c=t,f=et({type:"advanced"},(s=n).styleselect),l=qT(0,s,mE(c,f)),c.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return l.items.validateItems(l.getStyleItems())}}),m=qT(0,n,dE(d=t)),d.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return m.items.validateItems(m.getStyleItems())}}),p=qT(0,n,aE(g=t)),g.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return p.items.validateItems(p.getStyleItems())}})},sD=function(t,n){var e,o,r,i;!function(n){vC.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:fE(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})}(t),iD(t),cD(t,n),aD(t),function(t){eb(t);var n=se(null),e=se(null);cb(t,"forecolor","forecolor","Text color",n),cb(t,"backcolor","hilitecolor","Background color",e),sb(t,"forecolor","forecolor","Text color"),sb(t,"backcolor","hilitecolor","Background color")}(t),(o=e=t).ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:function(){return o.execCommand("mceToggleVisualAid")}}),(r=e).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,r)},onAction:function(){r.execCommand("mceToggleVisualAid")}}),(i=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,i)},onAction:function(){return i.execCommand("outdent")}}),i.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onAction:function(){return i.execCommand("indent")}})},fD=function(t,n){return{anchor:"makeshift",x:t,y:n}},lD=function(t){return"longpress"===t.type||0===t.type.indexOf("touch")},dD=function(t,n){var e,o,r,i=ph.DOM.getPos(t);return e=n,o=i.x,r=i.y,fD(e.x+o,e.y+r)},mD=function(t,n){return"contextmenu"===n.type||"longpress"===n.type?t.inline?function(t){if(lD(t)){var n=t.touches[0];return fD(n.pageX,n.pageY)}return fD(t.pageX,t.pageY)}(n):dD(t.getContentAreaContainer(),function(t){if(lD(t)){var n=t.touches[0];return fD(n.clientX,n.clientY)}return fD(t.clientX,t.clientY)}(n)):gD(t)},gD=function(t){return{anchor:"selection",root:le.fromDom(t.selection.getNode())}},pD=function(t){return{anchor:"node",node:st.some(le.fromDom(t.selection.getNode())),root:le.fromDom(t.getBody())}},hD=function(t,n,e,o,r,i){var u,a,c=e(),s=(u=t,a=n,i?pD(u):mD(u,a));Lk(c,Mp.CLOSE_ON_EXECUTE,o,!1).map(function(t){n.preventDefault(),zg.showMenuAt(r,s,{menu:{markers:jp("normal")},data:t})})},vD={onLtr:function(){return[Va,Ma,Aa,Fa,Ia,Ra,Kg,Jg,Yg,Gg,qg,Xg]},onRtl:function(){return[Va,Aa,Ma,Ia,Fa,Ra,Kg,Jg,qg,Xg,Yg,Gg]}},bD={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"]},yD=function(n,e,t,o,r,i,u){var a,c,s,f=(a=n,c=e,s=i?pD(a):mD(a,c),et({bubble:Mc(0,12,bD),layouts:vD,overrides:{maxWidthFunction:KO(),maxHeightFunction:_c()}},s));Lk(t,Mp.CLOSE_ON_EXECUTE,o,!0).map(function(t){e.preventDefault(),zg.showMenuWithinBounds(r,f,{menu:{markers:jp("normal"),highlightImmediately:u},data:t,type:"horizontal"},function(){return st.some(zT(n,o.shared))}),n.fire(JO)})},xD=function(n,e,o,r,i,u){var t=ze(),a=t.os.isiOS(),c=t.os.isOSX(),s=t.os.isAndroid(),f=t.deviceType.isTouch(),l=function(){var t=o();yD(n,e,t,r,i,u,!(s||a||c&&f))};if(!c&&!a||u)s&&!u&&n.selection.setCursorLocation(e.target,0),l();else{var d=function(){!function(t){var n=t.selection.getRng(),e=function(){$g.setEditorTimeout(t,function(){t.selection.setRng(n)},10),i()};t.once("touchend",e);var o=function(t){t.preventDefault(),t.stopImmediatePropagation()};t.on("mousedown",o,!0);var r=function(){return i()};t.once("longpresscancel",r);var i=function(){t.off("touchend",e),t.off("longpresscancel",r),t.off("mousedown",o)}}(n),l()};!function(t,n){var e=t.selection;if(e.isCollapsed()||n.touches.length<1)return!1;var o=n.touches[0],r=e.getRng();return us(t.getWin(),Gc.domRange(r)).exists(function(t){return t.left()<=o.clientX&&t.right()>=o.clientX&&t.top()<=o.clientY&&t.bottom()>=o.clientY})}(n,e)?(n.once("selectionchange",d),n.once("touchend",function(){return n.off("selectionchange",d)})):d()}},wD=function(t){return"string"==typeof t?t.split(/[ ,]/):t},SD=function(t){return t.getParam("contextmenu_never_use_native",!1,"boolean")},kD=function(t){return e="contextmenu",o="link linkchecker image imagetools table spellchecker configurepermanentpen",r=(n=t).ui.registry.getAll().contextMenus,st.from(n.getParam(e)).map(wD).getOrThunk(function(){return H(wD(o),function(t){return It(r,t)})});var n,e,o,r},CD=function(t){return w(t)?"|"===t:"separator"===t.type},OD={type:"separator"},_D=function(n){if(w(n))return n;switch(n.type){case"separator":return OD;case"submenu":return{type:"nestedmenuitem",text:n.text,icon:n.icon,getSubmenuItems:function(){var t=n.getSubmenuItems();return w(t)?t:V(t,_D)}};default:return{type:"menuitem",text:n.text,icon:n.icon,onAction:(t=n.onAction,function(){return t()})}}var t},TD=function(t,n){if(0===n.length)return t;var e=K(t).filter(function(t){return!CD(t)}).fold(function(){return[]},function(t){return[OD]});return t.concat(e).concat(n).concat([OD])},ED=function(c,t,o){var r=ze().deviceType.isTouch,i=uu(zg.sketch({dom:{tag:"div"},lazySink:t,onEscape:function(){return c.focus()},onShow:function(){return o.setContextMenuState(!0)},onHide:function(){return o.setContextMenuState(!1)},fireDismissalEventInstead:{},inlineBehaviours:Ka([$m("dismissContextMenu",[$o(Io(),function(t,n){sf.close(t),c.focus()})])])})),n=function(t){return zg.hide(i)},e=function(u){if(SD(c)&&u.preventDefault(),t=c,(!u.ctrlKey||SD(t))&&!1!==c.getParam("contextmenu")){var t,n,e,a=(n=c,"longpress"!==(e=u).type&&(2!==e.button||e.target===n.getBody()&&""===e.pointerType));(r()?xD:hD)(c,u,function(){var r,i,t,n=a?c.selection.getStart(!0):u.target,e=c.ui.registry.getAll(),o=kD(c);return r=e.contextMenus,i=n,0<(t=N(o,function(t,n){if(It(r,n)){var e=r[n].update(i);if(w(e))return TD(t,e.split(" "));if(0<e.length){var o=V(e,_D);return TD(t,o)}return t}return t.concat([n])},[])).length&&CD(t[t.length-1])&&t.pop(),t},o,i,a)}};c.on("init",function(){var t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(r()?"":" ResizeWindow");c.on(t,n),c.on("longpress contextmenu",e)})},BD=Vt([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),DD=function(n){return function(t){return t.translate(-n.left(),-n.top())}},MD=function(n){return function(t){return t.translate(n.left(),n.top())}},AD=function(e){return function(t,n){return N(e,function(t,n){return n(t)},mu(t,n))}},FD=function(t,n,e){return t.fold(AD([MD(e),DD(n)]),AD([DD(n)]),AD([]))},ID=function(t,n,e){return t.fold(AD([MD(e)]),AD([]),AD([MD(n)]))},RD=function(t,n,e){return t.fold(AD([]),AD([DD(e)]),AD([MD(n),DD(e)]))},VD=function(t,n,e){var o=t.fold(function(t,n){return{position:st.some("absolute"),left:st.some(t+"px"),top:st.some(n+"px")}},function(t,n){return{position:st.some("absolute"),left:st.some(t-e.left()+"px"),top:st.some(n-e.top()+"px")}},function(t,n){return{position:st.some("fixed"),left:st.some(t+"px"),top:st.some(n+"px")}});return et({right:st.none(),bottom:st.none()},o)},PD=function(t,i,u,a){var n=function(o,r){return function(t,n){var e=o(i,u,a);return r(t.getOr(e.left()),n.getOr(e.top()))}};return t.fold(n(RD,HD),n(ID,zD),n(FD,ND))},HD=BD.offset,zD=BD.absolute,ND=BD.fixed,LD=function(t,n){var e=Ir(t,n);return C(e)?NaN:parseInt(e,10)},jD=function(t,n,e,o){return r=n,i=t.element(),u=LD(i,r.leftAttr),a=LD(i,r.topAttr),(isNaN(u)||isNaN(a)?st.none():st.some(mu(u,a))).fold(function(){return e},function(t){return ND(t.left()+o.left(),t.top()+o.top())});var r,i,u,a},UD=function(t,n,e,o,r,i){var u,a,c,s=jD(t,n,e,o),f=(n.mustSnap?XD:YD)(t,n,s,r,i),l=FD(s,r,i);return u=n,a=l,c=t.element(),Fr(c,u.leftAttr,a.left()+"px"),Fr(c,u.topAttr,a.top()+"px"),f.fold(function(){return{coord:ND(l.left(),l.top()),extra:st.none()}},function(t){return{coord:t.output,extra:t.extra}})},WD=function(t,n){var e,o;e=n,o=t.element(),Pr(o,e.leftAttr),Pr(o,e.topAttr)},GD=function(t,f,l,d){return $(t,function(t){var n,e,o,r,i,u,a,c,s=t.sensor;return(n=f,e=s,o=t.range.left(),r=t.range.top(),a=ID(n,i=l,u=d),c=ID(e,i,u),Math.abs(a.left()-c.left())<=o&&Math.abs(a.top()-c.top())<=r)?st.some({output:PD(t.output,f,l,d),extra:t.extra}):st.none()})},XD=function(t,n,d,m,g){var e=n.getSnapPoints(t);return GD(e,d,m,g).orThunk(function(){return N(e,function(n,e){var t,o,r,i,u,a,c,s,f=e.sensor,l=(t=d,o=f,e.range.left(),e.range.top(),u=ID(t,r=m,i=g),a=ID(o,r,i),c=Math.abs(u.left()-a.left()),s=Math.abs(u.top()-a.top()),mu(c,s));return n.deltas.fold(function(){return{deltas:st.some(l),snap:st.some(e)}},function(t){return(l.left()+l.top())/2<=(t.left()+t.top())/2?{deltas:st.some(l),snap:st.some(e)}:n})},{deltas:st.none(),snap:st.none()}).snap.map(function(t){return{output:PD(t.output,d,m,g),extra:t.extra}})})},YD=function(t,n,e,o,r){var i=n.getSnapPoints(t);return GD(i,e,o,r)},qD=/* */Object.freeze({__proto__:null,snapTo:function(t,n,e,o){var r,i,u,a=n.getTarget(t.element());if(n.repositionTarget){var c=gr(t.element()),s=ku(c),f=FE(a),l=(i=s,u=f,{coord:PD((r=o).output,r.output,i,u),extra:r.extra}),d=VD(l.coord,0,f);ji(a,d)}}}),KD="data-initial-z-index",JD=function(t,n){var e;t.getSystem().addToGui(n),br((e=n).element()).filter(fr).each(function(n){Gi(n,"z-index").each(function(t){Fr(n,KD,t)}),Ni(n,"z-index",Ui(e.element(),"z-index"))})},$D=function(t){br(t.element()).filter(fr).each(function(n){Rr(n,KD).fold(function(){return Yi(n,"z-index")},function(t){return Ni(n,"z-index",t)}),Pr(n,KD)}),t.getSystem().removeFromGui(t)},QD=function(t,n,e){return t.getSystem().build(Zb.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[n]},events:e}))},ZD=Zn("snaps",[Nn("getSnapPoints"),aa("onSensor"),Nn("leftAttr"),Nn("topAttr"),te("lazyViewport",Fu),te("mustSnap",!1)]),tM=[te("useFixed",c),Nn("blockerClass"),te("getTarget",ct),te("onDrag",Z),te("repositionTarget",!0),te("onDrop",Z),ue("getBounds",Fu),ZD],nM=function(n){return t=Gi(n,"left"),e=Gi(n,"top"),o=Gi(n,"position"),r=function(t,n,e){return("fixed"===e?ND:HD)(parseInt(t,10),parseInt(n,10))},(t.isSome()&&e.isSome()&&o.isSome()?st.some(r(t.getOrDie(),e.getOrDie(),o.getOrDie())):st.none()).getOrThunk(function(){var t=pu(n);return zD(t.left(),t.top())});var t,e,o,r},eM=function(e,t,i,u,a,c,n){var o,r,s,f,l,d,m,g,p,h=t.fold(function(){var t,e,o,n=(t=i,e=c.left(),o=c.top(),t.fold(function(t,n){return HD(t+e,n+o)},function(t,n){return zD(t+e,n+o)},function(t,n){return ND(t+e,n+o)})),r=FD(n,u,a);return ND(r.left(),r.top())},function(n){var t=UD(e,n,i,c,u,a);return t.extra.each(function(t){n.onSensor(e,t)}),t.coord});return o=h,r=u,s=a,l=(f=n).bounds,d=ID(o,r,s),m=yc(d.left(),l.x,l.x+l.width-f.width),g=yc(d.top(),l.y,l.y+l.height-f.height),p=zD(m,g),o.fold(function(){var t=RD(p,r,s);return HD(t.left(),t.top())},function(){return p},function(){var t=FD(p,r,s);return ND(t.left(),t.top())})},oM=function(t,n){return{bounds:t.getBounds(),height:lu(n.element()),width:yu(n.element())}},rM=function(n,e,t,o,r){var i=t.update(o,r),u=t.getStartData().getOrThunk(function(){return oM(e,n)});i.each(function(t){!function(t,n,e,o){var r=n.getTarget(t.element());if(n.repositionTarget){var i=gr(t.element()),u=ku(i),a=FE(r),c=nM(r),s=eM(t,n.snaps,c,u,a,o,e),f=VD(s,0,a);ji(r,f)}n.onDrag(t,r,o)}(n,e,u,t)})},iM=function(n,t,e,o){t.each($D),e.snaps.each(function(t){WD(n,t)});var r=e.getTarget(n.element());o.reset(),e.onDrop(n,r)},uM=function(t){return function(n,e){var o=function(t){e.setStartData(oM(n,t))};return qo(b([$o(Do(),function(t){e.getStartData().each(function(){return o(t)})})],t(n,e,o)))}},aM=/* */Object.freeze({__proto__:null,getData:function(t){return st.from(mu(t.x(),t.y()))},getDelta:function(t,n){return mu(n.left()-t.left(),n.top()-t.top())}}),cM=function(a,c,s){return[$o(no(),function(n,t){if(0===t.event().raw().button){t.stop();var e,o=function(){return iM(n,st.some(u),a,c)},r=Fb(o,200),i={drop:o,delayDrop:r.schedule,forceDrop:o,move:function(t){r.cancel(),rM(n,a,c,aM,t)}},u=QD(n,a.blockerClass,(e=i,qo([$o(no(),e.forceDrop),$o(ro(),e.drop),$o(eo(),function(t,n){e.move(n.event())}),$o(oo(),e.delayDrop)])));s(n),JD(n,u)}})]},sM=b(tM,[la("dragger",{handlers:uM(cM)})]),fM=/* */Object.freeze({__proto__:null,getData:function(t){var n,e=t.raw().touches;return 1===e.length?(n=e[0],st.some(mu(n.clientX,n.clientY))):st.none()},getDelta:function(t,n){return mu(n.left()-t.left(),n.top()-t.top())}}),lM=function(u,a,c){var s=se(st.none());return[$o($e(),function(n,t){t.stop();var e,o=function(){iM(n,s.get(),u,a),s.set(st.none())},r={drop:o,delayDrop:function(){},forceDrop:o,move:function(t){rM(n,u,a,fM,t)}},i=QD(n,u.blockerClass,(e=r,qo([$o($e(),e.forceDrop),$o(Ze(),e.drop),$o(to(),e.drop),$o(Qe(),function(t,n){e.move(n.event())})])));s.set(st.some(i));c(n),JD(n,i)}),$o(Qe(),function(t,n){n.stop(),rM(t,u,a,fM,n.event())}),$o(Ze(),function(t,n){n.stop(),iM(t,s.get(),u,a),s.set(st.none())}),$o(to(),function(t){iM(t,s.get(),u,a),s.set(st.none())})]},dM=sM,mM=b(tM,[la("dragger",{handlers:uM(lM)})]),gM=b(tM,[la("dragger",{handlers:uM(function(t,n,e){return b(cM(t,n,e),lM(t,n,e))})})]),pM=Za({branchKey:"mode",branches:/* */Object.freeze({__proto__:null,mouse:dM,touch:mM,mouseOrTouch:gM}),name:"dragging",active:{events:function(t,n){return t.dragger.handlers(t,n)}},extra:{snap:function(t){return{sensor:t.sensor,range:t.range,output:t.output,extra:st.from(t.extra)}}},state:/* */Object.freeze({__proto__:null,init:function(){var i=st.none(),n=st.none(),t=at({});return ai({readState:t,reset:function(){i=st.none(),n=st.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=st.some(e),o;var n,e,o})},getStartData:function(){return n},setStartData:function(t){n=st.some(t)}})}}),apis:qD}),hM=function(t,r,i,u,n,e){return t.fold(function(){return pM.snap({sensor:zD(i-20,u-20),range:mu(n,e),output:zD(st.some(i),st.some(u)),extra:{td:r}})},function(t){var n=i-20,e=u-20,o=t.element().dom().getBoundingClientRect();return pM.snap({sensor:zD(n,e),range:mu(40,40),output:zD(st.some(i-o.width/2),st.some(u-o.height/2)),extra:{td:r}})})},vM=function(t,i,u){return{getSnapPoints:t,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:function(t,n){var e,o,r=n.td;e=i.get(),o=r,e.exists(function(t){return je(t,o)})||(i.set(st.some(r)),u(r))},mustSnap:!0}},bM=function(t){return Zg(Qg.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:Ka([pM.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:t}),fx.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}}))},yM=function(c,e){var o=se([]),r=se([]),t=se(!1),i=se(st.none()),u=se(st.none()),n=function(t){var n=Au(t);return hM(l.getOpt(e),t,n.x,n.y,n.width,n.height)},a=function(t){var n=Au(t);return hM(d.getOpt(e),t,n.right,n.bottom,n.width,n.height)},s=vM(function(){return V(o.get(),function(t){return n(t)})},i,function(n){u.get().each(function(t){c.fire("TableSelectorChange",{start:n,finish:t})})}),f=vM(function(){return V(r.get(),function(t){return a(t)})},u,function(n){i.get().each(function(t){c.fire("TableSelectorChange",{start:t,finish:n})})}),l=bM(s),d=bM(f),m=uu(l.asSpec()),g=uu(d.asSpec()),p=function(t,n,e,o){var r=e(n);pM.snapTo(t,r);!function(t,n,e,o){var r=n.dom().getBoundingClientRect();Yi(t.element(),"display");var i=vr(le.fromDom(c.getBody())).dom().innerHeight,u=e(r),a=o(r,i);(u||a)&&Ni(t.element(),"display","none")}(t,n,function(t){return t[o]<0},function(t,n){return t[o]>n})},h=function(t){return p(m,t,n,"top")},v=function(t){return p(g,t,a,"bottom")};ze().deviceType.isTouch()&&(c.on("TableSelectionChange",function(n){t.get()||(Gs(e,m),Gs(e,g),t.set(!0)),i.set(st.some(n.start)),u.set(st.some(n.finish)),n.otherCells.each(function(t){o.set(t.upOrLeftCells),r.set(t.downOrRightCells),h(n.start),v(n.finish)})}),c.on("ResizeEditor ResizeWindow ScrollContent",function(){i.get().each(h),u.get().each(v)}),c.on("TableSelectionClear",function(){t.get()&&(qs(m),qs(g),t.set(!1)),i.set(st.none()),u.set(st.none())}))};($T=JT=JT||{})[$T.None=0]="None",$T[$T.Both=1]="Both",$T[$T.Vertical=2]="Vertical";var xM,wM=function(t,n,e){var o,r,i,u,a,c,s=le.fromDom(t.getContainer()),f=(o=t,r=n,i=e,u=fu(s),a=bu(s),(c={}).height=$B(u+r.top(),Rh(o),Ph(o)),i===JT.Both&&(c.width=$B(a+r.left(),Ih(o),Vh(o))),c);_t(f,function(t,n){return Ni(s,n,JB(t))}),t.fire("ResizeEditor")},SM=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},kM=function(i,u,a){u.delimiter||(u.delimiter="\xbb");return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Ka([Gm.config({mode:"flow",selector:"div[role=button]"}),Dh.config({disabled:a.isReadOnly}),nv(),uy.config({}),Jm.config({}),$m("elementPathEvents",[rr(function(r,t){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return Gm.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&&!SM(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?Jm.set(r,(n=V(e||[],function(n,t){return Qg.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()},buttonBehaviours:Ka([ov(a.isReadOnly),nv()])})}),o={dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0},innerHtml:" "+u.delimiter+" "}},N(n.slice(1),function(t,n){var e=t;return e.push(o),e.push(n),e},[n[0]]))):Jm.set(r,[])})})])]),components:[]}},CM=function(i,u){var t,n,e,o,r,a;return{dom:{tag:"div",classes:["tox-statusbar"]},components:(r=function(){var t,o,r,n,e=[];return i.getParam("elementpath",!0,"boolean")&&e.push(kM(i,{},u)),Be(i.getParam("plugins","","string"),"wordcount")&&e.push((t=i,o=u,r=function(t,n,e){return Jm.set(t,[ou(o.translate(["{0} "+e,n[e]]))])},Qg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Ka([ov(o.isReadOnly),nv(),uy.config({}),Jm.config({}),Bf.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),$m("wordcount-events",[ar(function(t){var n=Bf.getValue(t),e="words"===n.mode?"characters":"words";Bf.setValue(t,{mode:e,count:n.count}),r(t,n.count,e)}),rr(function(e){t.on("wordCountUpdate",function(t){var n=Bf.getValue(e).mode;Bf.setValue(e,{mode:n,count:t.wordCount}),r(e,t.wordCount,n)})})])]),eventOrder:{"alloy.execute":["disabling","alloy.base.behaviour","wordcount-events"]}}))),i.getParam("branding",!0,"boolean")&&e.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="'+(n=hh.translate(["Powered by {0}","Tiny"]))+'">'+n+"</a>"}}),0<e.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:e}]:[]}(),n=!Be((t=i).getParam("plugins","","string"),"autoresize"),(a=!1===(e=t.getParam("resize",n))?JT.None:"both"===e?JT.Both:JT.Vertical)!==JT.None&&r.push((o=a,{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:u.translate("Resize"),"aria-hidden":"true"},innerHtml:np("resize-handle",u.icons)},behaviours:Ka([pM.config({mode:"mouse",repositionTarget:!1,onDrag:function(t,n,e){wM(i,e,o)},blockerClass:"tox-blocker"})])})),r)}},OM=function(x){var t,n=x.inline,w=n?eD:YB,S=Jh(x)?iB:sB,e=st.none(),o=ze(),r=o.browser.isIE()?["tox-platform-ie"]:[],i=o.deviceType.isTouch()?["tox-platform-touch"]:[],u=Xh(x),a=hh.isRtl()?{attributes:{dir:"rtl"}}:{},c={attributes:((t={})[Rc]=u?Yu.BottomToTop:Yu.TopToBottom,t)},k=function(){return e.bind(FB.getHeader)},C=uu({dom:et({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(r).concat(i)},a),behaviours:Ka([Ns.config({useFixed:function(){return S.isDocked(k)}})])}),O=function(){return ut.value(C)},s=Zg({dom:{tag:"div",classes:["tox-anchorbar"]}}),_=function(){return e.bind(function(t){return FB.getThrobber(t)}).getOrDie("Could not find throbber element")},T=qO(C,x,function(){return e.bind(function(t){return s.getOpt(t)}).getOrDie("Could not find a anchor bar element")}),f=FB.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:T,onEscape:function(){x.focus()}}),E=Wh(x),l=FB.parts().toolbar(et({dom:{tag:"div",classes:["tox-toolbar"]},getSink:O,providers:T.shared.providers,onEscape:function(){x.focus()},type:E,lazyToolbar:function(){return e.bind(function(t){return FB.getToolbar(t)}).getOrDie("Could not find more toolbar element")},lazyHeader:function(){return k().getOrDie("Could not find header element")}},c)),d=FB.parts()["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:T.shared.providers,onEscape:function(){},type:E}),m=FB.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),g=FB.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),p=FB.parts().throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:T}),h=x.getParam("statusbar",!0,"boolean")&&!n?st.some(CM(x,T.shared.providers)):st.none(),v={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[m,g]},b=Lh(x),y=zh(x),B=Hh(x),D=FB.parts().header({dom:et({tag:"div",classes:["tox-editor-header"]},c),components:it([B?[f]:[],b?[d]:y?[l]:[],qh(x)?[]:[s.asSpec()]]),sticky:Jh(x),editor:x,sharedBackstage:T.shared}),M=it([u?[]:[D],n?[]:[v],u?[D]:[]]),A=it([[{dom:{tag:"div",classes:["tox-editor-container"]},components:M}],n?[]:h.toArray(),[p]]),F=Kh(x),I=et(et({role:"application"},hh.isRtl()?{dir:"rtl"}:{}),F?{"aria-hidden":"true"}:{}),R=uu(FB.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(n?["tox-tinymce-inline"]:[]).concat(u?["tox-tinymce--toolbar-bottom"]:[]).concat(i).concat(r),styles:et({visibility:"hidden"},F?{opacity:"0",border:"0"}:{}),attributes:I},components:A,behaviours:Ka([Gm.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"})])}));e=st.some(R),x.shortcuts.add("alt+F9","focus menubar",function(){FB.focusMenubar(R)}),x.shortcuts.add("alt+F10","focus toolbar",function(){FB.focusToolbar(R)});var V,P,H,z,N,L,j,U,W,G,X,Y,q,K,J,$,Q=ty(R),Z=ty(C);V=x,P=Q,H=Z,z=function(n,e){rt([P,H],function(t){t.broadcastEvent(n,e)})},N=function(n,e){rt([P,H],function(t){t.broadcastOn([n],e)})},L=function(t){return N(ff(),{target:t.target()})},j=Bb(le.fromDom(nt.document),"touchstart",L),U=Bb(le.fromDom(nt.document),"touchmove",function(t){return z(Eo(),t)}),W=Bb(le.fromDom(nt.document),"touchend",function(t){return z(Bo(),t)}),G=Bb(le.fromDom(nt.document),"mousedown",L),X=Bb(le.fromDom(nt.document),"mouseup",function(t){0===t.raw().button&&N(df(),{target:t.target()})}),Y=function(t){return N(ff(),{target:le.fromDom(t.target)})},q=function(t){0===t.button&&N(df(),{target:le.fromDom(t.target)})},K=function(t){return z(Do(),Mb(t))},J=function(t){N(lf(),{}),z(Mo(),Mb(t))},$=function(){return N(lf(),{})},V.on("PostRender",function(){V.on("click",Y),V.on("tap",Y),V.on("mouseup",q),V.on("ScrollWindow",K),V.on("ResizeWindow",J),V.on("ResizeEditor",$)}),V.on("remove",function(){V.off("click",Y),V.off("tap",Y),V.off("mouseup",q),V.off("ScrollWindow",K),V.off("ResizeWindow",J),V.off("ResizeEditor",$),G.unbind(),j.unbind(),U.unbind(),W.unbind(),X.unbind()}),V.on("detach",function(){Qs(P),Qs(H),P.destroy(),H.destroy()});var tt=function(){var t,n=JB(QB(x)),e=JB(ZB(t=x).getOr(Fh(t)));return x.inline||(Xi("div","width",e)&&Ni(R.element(),"width",e),Xi("div","height",n)?Ni(R.element(),"height",n):Ni(R.element(),"height","200px")),n};return{mothership:Q,uiMothership:Z,backstage:T,renderUI:function(){var o,r,e,n,i,u,a,c;S.setup(x,T.shared,k),sD(x,T),ED(x,O,T),r=(o=x).ui.registry.getAll().sidebars,rt(Ct(r),function(n){var t=r[n],e=function(){return st.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=x,n=_,i=T.shared,u=se(!1),a=se(st.none()),c=function(t){t!==u.get()&&(OB(n(),t,i.providers),u.set(t))},e.on("ProgressState",function(t){if(a.get().each($g.clearTimeout),ot(t.time)){var n=$g.setEditorTimeout(e,function(){return c(t.state)},t.time);a.set(st.some(n))}else c(t.state),a.set(st.none())}),Tt(x.getParam("toolbar_groups",{},"object"),function(t,n){x.ui.registry.addGroupToolbarButton(n,t)});var t,s=x.ui.registry.getAll(),f=s.buttons,l=s.menuItems,d=s.contextToolbars,m=s.sidebars,g=Nh(x),p={menuItems:l,menus:(t=x.getParam("menu"))?Tt(t,function(t){return et(et({},t),{items:t.items})}):{},menubar:x.getParam("menubar"),toolbar:g.getOrThunk(function(){return x.getParam("toolbar",!0)}),allowToolbarGroups:E===Bp.floating,buttons:f,sidebar:m};OE(x,d,C,{backstage:T}),yM(x,C);var h=x.getElement(),v=tt(),b={mothership:Q,uiMothership:Z,outerContainer:R},y={targetNode:h,height:v};return w.render(x,b,p,T,y)},getUi:function(){return{channels:{broadcastAll:Z.broadcast,broadcastOn:Z.broadcastOn,register:function(){}}}}}},_M=at([Nn("lazySink"),qn("dragBlockClass"),ue("getBounds",Fu),te("useTabstopAt",at(!0)),te("eventOrder",{}),Df("modalBehaviours",[Gm]),ca("onExecute"),fa("onEscape")]),TM={sketch:ct},EM=at([al({name:"draghandle",overrides:function(t,n){return{behaviours:Ka([pM.config({mode:"mouse",getTarget:function(t){return Nu(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"+JSON.stringify(n,null,2)).message),getBounds:t.getDragBounds})])}}}),il({schema:[Nn("dom")],name:"title"}),il({factory:TM,schema:[Nn("dom")],name:"close"}),il({factory:TM,schema:[Nn("dom")],name:"body"}),al({factory:TM,schema:[Nn("dom")],name:"footer"}),ul({factory:{sketch:function(t,n){return et(et({},t),{dom:n.dom,components:n.components})}},schema:[te("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),te("components",[])],name:"blocker"})]),BM=Vl({name:"ModalDialog",configFields:_M(),partFields:EM(),factory:function(a,t,n,o){var r=Wr("alloy.dialog.busy"),c=Wr("alloy.dialog.idle"),s=Ka([Gm.config({mode:"special",onTab:function(){return st.some(!0)},onShiftTab:function(){return st.some(!0)}}),eg.config({})]),e=Wr("modal-events"),i=et(et({},a.eventOrder),{"alloy.system.attached":[e].concat(a.eventOrder["alloy.system.attached"]||[])});return{uid:a.uid,dom:a.dom,components:t,apis:{show:function(i){var t=a.lazySink(i).getOrDie(),u=se(st.none()),n=o.blocker(),e=t.getSystem().build(et(et({},n),{components:n.components.concat([au(i)]),behaviours:Ka([eg.config({}),$m("dialog-blocker-events",[or(uo(),function(){Gm.focusIn(i)}),$o(c,function(t,n){Vr(i.element(),"aria-busy")&&(Pr(i.element(),"aria-busy"),u.get().each(function(t){return Jm.remove(i,t)}))}),$o(r,function(t,n){Fr(i.element(),"aria-busy","true");var e=n.event().getBusySpec();u.get().each(function(t){Jm.remove(i,t)});var o=e(i,s),r=t.getSystem().build(o);u.set(st.some(r)),Jm.append(i,au(r)),r.hasConfigured(Gm)&&Gm.focusIn(r)})])])}));Gs(t,e),Gm.focusIn(i)},hide:function(n){br(n.element()).each(function(t){n.getSystem().getByDom(t).each(function(t){qs(t)})})},getBody:function(t){return xl(t,a,"body")},getFooter:function(t){return xl(t,a,"footer")},setIdle:function(t){jo(t,c)},setBusy:function(t,n){Uo(t,r,{getBusySpec:n})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Af(a.modalBehaviours,[Jm.config({}),Gm.config({mode:"cyclic",onEnter:a.onExecute,onEscape:a.onEscape,useTabstopAt:a.useTabstopAt}),$m(e,[rr(function(t){var n,e,o,r,i,u;n=t.element(),e=xl(t,a,"title").element(),o=st.from(Ir(n,"id")).fold(function(){var t=Wr("dialog-label");return Fr(e,"id",t),t},ct),Fr(n,"aria-labelledby",o),r=t.element(),i=xl(t,a,"body").element(),u=st.from(Ir(r,"id")).fold(function(){var t=Wr("dialog-describe");return Fr(i,"id",t),t},ct),Fr(r,"aria-describedby",u)})])])}},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)}}}),DM=ln([jn("type"),jn("name")].concat(Qp)),MM=Rn,AM=[vn("name","name",Xt(function(){return Wr("button-name")}),In),$n("icon"),re("align","end",["start","end"]),ie("primary",!1),ie("disabled",!1)],FM=b(AM,[jn("text")]),IM=b([Un("type",["submit","cancel","custom"])],FM),RM=b([Un("type",["menu"]),$n("text"),$n("tooltip"),$n("icon"),Yn("items",DM)],AM),VM=Dn("type",{submit:IM,cancel:IM,custom:IM,menu:RM}),PM=[jn("type"),jn("text"),Un("level",["info","warn","error","success"]),jn("icon"),te("url","")],HM=ln(PM),zM=[jn("type"),jn("text"),ie("disabled",!1),ie("primary",!1),vn("name","name",Xt(function(){return Wr("button-name")}),In),$n("icon"),ie("borderless",!1)],NM=ln(zM),LM=[jn("type"),jn("name"),jn("label"),ie("disabled",!1)],jM=ln(LM),UM=Rn,WM=[jn("type"),jn("name")],GM=WM.concat([$n("label")]),XM=ln(GM),YM=In,qM=ln(GM),KM=In,JM=ln(GM),$M=dn(xn),QM=function(t){return[jn("type"),Ln("columns",Fn),t]},ZM=GM.concat([ie("sandboxed",!0)]),tA=ln(ZM),nA=In,eA=GM.concat([$n("inputMode"),$n("placeholder"),ie("maximized",!1),ie("disabled",!1)]),oA=ln(eA),rA=In,iA=GM.concat([Xn("items",[jn("text"),jn("value")]),ee("size",1),ie("disabled",!1)]),uA=ln(iA),aA=In,cA=GM.concat([ie("constrain",!0),ie("disabled",!1)]),sA=ln(cA),fA=ln([jn("width"),jn("height")]),lA=GM.concat([$n("placeholder"),ie("maximized",!1),ie("disabled",!1)]),dA=ln(lA),mA=In,gA=GM.concat([re("filetype","file",["image","media","file"]),te("disabled",!1)]),pA=ln(gA),hA=ln([jn("value"),te("meta",{})]),vA=WM.concat([oe("tag","textarea"),jn("scriptId"),jn("scriptUrl"),(xM=undefined,ne("settings",xM,Hn))]),bA=WM.concat([oe("tag","textarea"),Wn("init")]),yA=kn(function(t){return On("customeditor.old",fn(bA),t).orThunk(function(){return On("customeditor.new",fn(vA),t)})}),xA=In,wA=[jn("type"),jn("html"),re("presets","presentation",["presentation","document"])],SA=ln(wA),kA=GM.concat([Ln("currentState",ln([Nn("blob"),jn("url")]))]),CA=ln(kA),OA=GM.concat([te("columns","auto")]),_A=ln(OA),TA=wn([jn("value"),jn("text"),jn("icon")]),EA=[jn("type"),Yn("header",In),Yn("cells",dn(In))],BA=ln(EA),DA=function(n){return vn("items","items",Wt(),dn(kn(function(t){return On("Checking item of "+n,MA,t).fold(function(t){return ut.error(En(t))},function(t){return ut.value(t)})})))},MA=Sn(function(){return Bn("type",{alertbanner:HM,bar:ln((n=DA("bar"),[jn("type"),n])),button:NM,checkbox:jM,colorinput:XM,colorpicker:qM,dropzone:JM,grid:ln(QM(DA("grid"))),iframe:tA,input:oA,selectbox:uA,sizeinput:sA,textarea:dA,urlinput:pA,customeditor:yA,htmlpanel:SA,imagetools:CA,collection:_A,label:ln((t=DA("label"),[jn("type"),jn("label"),t])),table:BA,panel:FA});var t,n}),AA=[jn("type"),te("classes",[]),Yn("items",MA)],FA=ln(AA),IA=[vn("name","name",Xt(function(){return Wr("tab-name")}),In),jn("title"),Yn("items",MA)],RA=[jn("type"),Xn("tabs",IA)],VA=ln(RA),PA=FM,HA=VM,zA=ln([jn("title"),Ln("body",Bn("type",{panel:FA,tabpanel:VA})),oe("size","normal"),Yn("buttons",HA),te("initialData",{}),ue("onAction",Z),ue("onChange",Z),ue("onSubmit",Z),ue("onClose",Z),ue("onCancel",Z),te("onTabChange",Z)]),NA=function(t){return S(t)?[t].concat(U(At(t),NA)):v(t)?U(t,NA):[]},LA=function(t){return w(t.type)&&w(t.name)},jA={checkbox:UM,colorinput:YM,colorpicker:KM,dropzone:$M,input:rA,iframe:nA,sizeinput:fA,selectbox:aA,size:fA,textarea:mA,urlinput:hA,customeditor:xA,collection:TA,togglemenuitem:MM},UA=function(t){var n=H(NA(t),LA),e=U(n,function(n){return t=n,st.from(jA[t.type]).fold(function(){return[]},function(t){return[Ln(n.name,t)]});var t});return ln(e)},WA=ln(b([Un("type",["cancel","custom"])],PA)),GA=ln([jn("title"),jn("url"),Jn("height"),Jn("width"),Kn("buttons",dn(WA)),ue("onAction",Z),ue("onCancel",Z),ue("onClose",Z),ue("onMessage",Z)]),XA=function(t){return{internalDialog:_n(On("dialog",zA,t)),dataValidator:UA(t),initialData:t.initialData}},YA={open:function(t,n){var e=XA(n);return t(e.internalDialog,e.initialData,e.dataValidator)},openUrl:function(t,n){return t(_n(On("dialog",GA,n)))},redial:function(t){return XA(t)}},qA=function(t){var e=[],o={};return _t(t,function(t,n){t.fold(function(){e.push(n)},function(t){o[n]=t})}),0<e.length?ut.error(e):ut.value(o)},KA=Rl({name:"TabButton",configFields:[te("uid",undefined),Nn("value"),vn("dom","dom",Yt(function(){return{attributes:{role:"tab",id:Wr("aria"),"aria-selected":"false"}}}),Mn()),qn("action"),te("domModification",{}),Df("tabButtonBehaviours",[eg,Gm,Bf]),Nn("view")],factory:function(t,n){return{uid:t.uid,dom:t.dom,components:t.components,events:hg(t.action),behaviours:Af(t.tabButtonBehaviours,[eg.config({}),Gm.config({mode:"execution",useSpace:!0,useEnter:!0}),Bf.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}}}),JA=at([Nn("tabs"),Nn("dom"),te("clickToDismiss",!1),Df("tabbarBehaviours",[Ql,Gm]),ia(["tabClass","selectedClass"])]),$A=cl({factory:KA,name:"tabs",unit:"tab",overrides:function(o){var r=function(t,n){Ql.dehighlight(t,n),Uo(t,zo(),{tabbar:t,button:n})},i=function(t,n){Ql.highlight(t,n),Uo(t,Ho(),{tabbar:t,button:n})};return{action:function(t){var n=t.getSystem().getByUid(o.uid).getOrDie(),e=Ql.isHighlighted(n,t);(e&&o.clickToDismiss?r:e?Z:i)(n,t)},domModification:{classes:[o.markers.tabClass]}}}}),QA=at([$A]),ZA=Vl({name:"Tabbar",configFields:JA(),partFields:QA(),factory:function(t,n,e,o){return{uid:t.uid,dom:t.dom,components:n,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Af(t.tabbarBehaviours,[Ql.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,n){Fr(n.element(),"aria-selected","true")},onDehighlight:function(t,n){Fr(n.element(),"aria-selected","false")}}),Gm.config({mode:"flow",getInitial:function(t){return Ql.getHighlighted(t).map(function(t){return t.element()})},selector:"."+t.markers.tabClass,executeOnMove:!0})])}}}),tF=Rl({name:"Tabview",configFields:[Df("tabviewBehaviours",[Jm])],factory:function(t,n){return{uid:t.uid,dom:t.dom,behaviours:Af(t.tabviewBehaviours,[Jm.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),nF=at([te("selectFirst",!0),aa("onChangeTab"),aa("onDismissTab"),te("tabs",[]),Df("tabSectionBehaviours",[])]),eF=il({factory:ZA,schema:[Nn("dom"),Gn("markers",[Nn("tabClass"),Nn("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),oF=il({factory:tF,name:"tabview"}),rF=at([eF,oF]),iF=Vl({name:"TabSection",configFields:nF(),partFields:rF(),factory:function(i,t,n,e){var o=function(t,n){yl(t,i,"tabbar").each(function(t){n(t).each(Wo)})};return{uid:i.uid,dom:i.dom,components:t,behaviours:Mf(i.tabSectionBehaviours),events:qo(it([i.selectFirst?[rr(function(t,n){o(t,Ql.getFirst)})]:[],[$o(Ho(),function(t,n){var o,r,e=n.event().button();o=e,r=Bf.getValue(o),yl(o,i,"tabview").each(function(e){L(i.tabs,function(t){return t.value===r}).each(function(t){var n=t.view();Rr(o.element(),"id").each(function(t){Fr(e.element(),"aria-labelledby",t)}),Jm.set(e,n),i.onChangeTab(e,o,n)})})}),$o(zo(),function(t,n){var e=n.event().button();i.onDismissTab(t,e)})]])),apis:{getViewItems:function(t){return yl(t,i,"tabview").map(function(t){return Jm.contents(t)}).getOr([])},showTab:function(t,e){o(t,function(n){var t=Ql.getCandidates(n);return L(t,function(t){return Bf.getValue(t)===e}).filter(function(t){return!Ql.isHighlighted(n,t)})})}}}},apis:{getViewItems:function(t,n){return t.getViewItems(n)},showTab:function(t,n,e){t.showTab(n,e)}}}),uF=function(t,n){Ni(t,"height",n+"px"),ze().browser.isIE()?Yi(t,"flex-basis"):Ni(t,"flex-basis",n+"px")},aF=function(t,o,r){Nu(t,'[role="dialog"]').each(function(e){Lu(e,'[role="tablist"]').each(function(n){r.get().map(function(t){return Ni(o,"height","0"),Ni(o,"flex-basis","0"),Math.min(t,function(t,n,e){var o,r=hr(t).dom(),i=Nu(t,".tox-dialog-wrap").getOr(t);o="fixed"===Ui(i,"position")?Math.max(r.clientHeight,nt.window.innerHeight):Math.max(r.offsetHeight,r.scrollHeight);var u=fu(n),a=n.dom().offsetLeft>=e.dom().offsetLeft+bu(e)?Math.max(fu(e),u):u,c=parseInt(Ui(t,"margin-top"),10)||0,s=parseInt(Ui(t,"margin-bottom"),10)||0;return o-(fu(t)+c+s-a)}(e,o,n))}).each(function(t){uF(o,t)})})})},cF=function(t){return Lu(t,'[role="tabpanel"]')},sF=function(a){var c;return{smartTabHeight:(c=se(st.none()),{extraEvents:[rr(function(t){var e=t.element();cF(e).each(function(u){var n;Ni(u,"visibility","hidden"),t.getSystem().getByDom(u).toOption().each(function(t){var o,r,i,n=(r=u,i=t,V(o=a,function(t,n){Jm.set(i,o[n].view());var e=r.dom().getBoundingClientRect();return Jm.set(i,[]),e.height})),e=q(Y(n,function(t,n){return n<t?-1:t<n?1:0}));c.set(e)}),aF(e,u,c),Yi(u,"visibility"),n=t,q(a).each(function(t){return iF.showTab(n,t.value)}),$g.requestAnimationFrame(function(){aF(e,u,c)})})}),$o(Mo(),function(t){var n=t.element();cF(n).each(function(t){aF(n,t,c)})}),$o(yy,function(t,n){var r=t.element();cF(r).each(function(n){var t=uc();Ni(n,"visibility","hidden");var e=Gi(n,"height").map(function(t){return parseInt(t,10)});Yi(n,"height"),Yi(n,"flex-basis");var o=n.dom().getBoundingClientRect().height;e.forall(function(t){return t<o})?(c.set(st.from(o)),aF(r,n,c)):e.each(function(t){uF(n,t)}),Yi(n,"visibility"),t.each(ic)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}},fF="send-data-to-section",lF="send-data-to-view",dF=Wr("update-dialog"),mF=Wr("update-title"),gF=Wr("update-body"),pF=Wr("update-footer"),hF=Wr("body-send-message"),vF=function(t,n,d,e){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:et(et({},n.map(function(t){return{id:t}}).getOr({})),e?{"aria-live":"polite"}:{})},components:[],behaviours:Ka([dS(0),bT.config({channel:gF,updateState:function(t,n){return st.some({isTabPanel:function(){return"tabpanel"===n.body.type}})},renderComponents:function(t){switch(t.body.type){case"tabpanel":return[(r=t.body,i=d,u=se({}),a=function(t){var n=Bf.getValue(t),e=qA(n).getOr({}),o=u.get(),r=zt(o,e);u.set(r)},c=function(t){var n=u.get();Bf.setValue(t,n)},s=se(null),f=V(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[eS.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:V(t.items,function(t){return cO(n,t,i)}),formBehaviours:Ka([Gm.config({mode:"acyclic",useTabstopAt:x(DS)}),$m("TabView.form.events",[rr(c),ir(a)]),oc.config({channels:$t([{key:fF,value:{onReceive:a}},{key:lF,value:{onReceive:c}}])})])}})]}}}),l=sF(f).smartTabHeight,iF.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,n,e){var o=Bf.getValue(n);Uo(t,by,{name:o,oldName:s.get()}),s.set(o)},tabs:f,components:[iF.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[ZA.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:Ka([uy.config({})])}),iF.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:Ka([$m("tabpanel",l.extraEvents),Gm.config({mode:"acyclic"}),Ll.config({find:function(t){return q(iF.getViewItems(t))}}),Bf.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([fF],{}),u.get()},setValue:function(t,n){u.set(n),t.getSystem().broadcastOn([lF],{})}}})])}))];default:return[(e=t.body,o=d,{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[(n=Zg(eS.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:V(e.items,function(t){return cO(n,t,o)})}}))).asSpec()]}],behaviours:Ka([Gm.config({mode:"acyclic",useTabstopAt:x(DS)}),lS(n),yS(n,{postprocess:function(t){return qA(t).fold(function(t){return nt.console.error(t),{}},function(t){return t})}})])})]}var e,o,n,r,i,u,a,c,s,f,l},initialData:t})])}},bF=mv.deviceType.isTouch(),yF=function(t,n){return{dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[t,n]}},xF=function(t,n){return BM.parts().close(Qg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:Ka([uy.config({})])}))},wF=function(){return BM.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},SF=function(t,n){return BM.parts().body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:CB("<p>"+n.translate(t)+"</p>")}]}]})},kF=function(t){return BM.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},CF=function(t,n){return[Zb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),Zb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},OF=function(n){var t,e="tox-dialog",o=e+"-wrap",r=o+"__backdrop",i=e+"__disable-scroll";return BM.sketch({lazySink:n.lazySink,onEscape:function(t){return n.onEscape(t),st.some(!0)},useTabstopAt:function(t){return!DS(t)},dom:{tag:"div",classes:[e].concat(n.extraClasses),styles:et({position:"relative"},n.extraStyles)},components:b([n.header,n.body],n.footer.toArray()),parts:{blocker:{dom:CB('<div class="'+o+'"></div>'),components:[{dom:{tag:"div",classes:bF?[r,r+"--opaque"]:[r]}}]}},dragBlockClass:o,modalBehaviours:Ka(b([eg.config({}),$m("dialog-events",n.dialogEvents.concat([or(uo(),function(t,n){Gm.focusIn(t)})])),$m("scroll-lock",[rr(function(){Si(Vi(),i)}),ir(function(){Ci(Vi(),i)})])],n.extraBehaviours)),eventOrder:et(((t={})[wo()]=["dialog-events"],t[Ao()]=["scroll-lock","dialog-events","alloy.base.behaviour"],t[Fo()]=["alloy.base.behaviour","dialog-events","scroll-lock"],t),n.eventOrder)})},_F=function(t){return Qg.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){jo(t,my)}})},TF=function(t,n,e){var o=function(t){return[ou(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:et({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:Ka([bT.config({channel:mF,renderComponents:o})])}},EF=function(){return{dom:CB('<div class="tox-dialog__draghandle"></div>')}},BF=function(t,n){return e={title:n.shared.providers.translate(t),draggable:n.dialog.isDraggableModal()},o=n.shared.providers,r=BM.parts().title(TF(e,st.none(),o)),i=BM.parts().draghandle(EF()),u=BM.parts().close(_F(o)),a=[r].concat(e.draggable?[i]:[]).concat([u]),Zb.sketch({dom:CB('<div class="tox-dialog__header"></div>'),components:a});var e,o,r,i,u,a},DF=function(t,n){return{onClose:function(){return n.closeWindow()},onBlock:function(e){BM.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:CB('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){BM.setIdle(t())}}},MF=function(t,n,e,o){var r;return uu(OF(et(et({},t),{lazySink:o.shared.getSink,extraBehaviours:b([bT.config({channel:dF,updateState:function(t,n){return st.some(n)},initialData:n}),SS({})],t.extraBehaviours),onEscape:function(t){jo(t,my)},dialogEvents:e,eventOrder:((r={})[xo()]=["reflecting","receiving"],r[Ao()]=["scroll-lock","reflecting","messages","dialog-events","alloy.base.behaviour"],r[Fo()]=["alloy.base.behaviour","dialog-events","messages","reflecting","scroll-lock"],r)})))},AF=function(t){return V(t,function(t){return"menu"===t.type?(e=V((n=t).items,function(t){var n=se(!1);return et(et({},t),{storage:n})}),et(et({},n),{items:e})):t;var n,e})},FF=function(t){return N(t,function(t,n){return"menu"!==n.type?t:N(n.items,function(t,n){return t[n.name]=n.storage,t},t)},{})},IF=function(t,e){return[nr(uo(),BS),t(dy,function(t,n){e.onClose(),n.onClose()}),t(my,function(t,n,e,o){n.onCancel(t),jo(o,dy)}),$o(vy,function(t,n){return e.onUnblock()}),$o(hy,function(t,n){return e.onBlock(n.event())})]},RF=function(i,t){var n=function(t,r){return $o(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){bT.getState(n).get().each(function(t){e(t,n)})};return b(IF(n,t),[n(gy,function(t,n,e){n.onAction(t,{name:e.name()})})])},VF=function(i,t,a){var n=function(t,r){return $o(t,function(e,o){u(e,function(t,n){r(i(),t,o.event(),e)})})},u=function(n,e){bT.getState(n).get().each(function(t){e(t.internalDialog,n)})};return b(IF(n,t),[n(py,function(t,n){return n.onSubmit(t)}),n(ly,function(t,n,e){n.onChange(t,{name:e.name()})}),n(gy,function(t,n,e,o){var r=function(){return Gm.focusIn(o)},i=function(t){return Vr(t,"disabled")||Rr(t,"aria-disabled").exists(function(t){return"true"===t})},u=uc();n.onAction(t,{name:e.name(),value:e.value()}),uc().fold(r,function(n){i(n)||u.exists(function(t){return We(n,t)&&i(t)})?r():a().toOption().filter(function(t){return!We(t.element(),n)}).each(r)})}),n(by,function(t,n,e){n.onTabChange(t,{newTabName:e.name(),oldTabName:e.oldName()})}),ir(function(t){var n=i();Bf.setValue(t,n.getData())})])},PF=function(t,n){var e=n.map(function(t){return t.footerButtons}).getOr([]),o=P(e,function(t){return"start"===t.align}),r=function(t,n){return Zb.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:V(n,function(t){return t.memento.asSpec()})})};return[r("start",o.pass),r("end",o.fail)]},HF=function(t,i){return{dom:CB('<div class="tox-dialog__footer"></div>'),components:[],behaviours:Ka([bT.config({channel:pF,initialData:t,updateState:function(t,n){var r=V(n.buttons,function(t){var n,e,o=Zg((e=i,$k(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return st.some({lookupByName:function(t,n){return e=t,o=n,L(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:PF})])}},zF=function(t,n){return BM.parts().footer(HF(t,n))},NF=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=Ll.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return eS.getField(o,e).fold(function(){var t=n.getFooter();return bT.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return st.some(t)})}return st.none()},LF=function(c,o,s){var t=function(t){var n=c.getRoot();n.getSystem().isConnected()&&t(n)},f={getData:function(){var t=c.getRoot(),n=t.getSystem().isConnected()?c.getFormWrapper():t,e=Bf.getValue(n),o=Tt(s,function(t){return t.get()});return et(et({},e),o)},setData:function(a){t(function(t){var n,e,o=f.getData(),r=et(et({},o),a),i=(n=r,e=c.getRoot(),bT.getState(e).get().map(function(t){return _n(On("data",t.dataValidator,n))}).getOr(n)),u=c.getFormWrapper();Bf.setValue(u,i),_t(s,function(t,n){It(r,n)&&t.set(r[n])})})},disable:function(t){NF(c,t).each(Dh.disable)},enable:function(t){NF(c,t).each(Dh.enable)},focus:function(t){NF(c,t).each(eg.focus)},block:function(n){if(!w(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){Uo(t,hy,{message:n})})},unblock:function(){t(function(t){jo(t,vy)})},showTab:function(e){t(function(t){var n=c.getBody();bT.getState(n).get().exists(function(t){return t.isTabPanel()})&&Ll.getCurrent(n).each(function(t){iF.showTab(t,e)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([dF],n),t.getSystem().broadcastOn([mF],n.internalDialog),t.getSystem().broadcastOn([gF],n.internalDialog),t.getSystem().broadcastOn([pF],n.internalDialog),f.setData(n.initialData)})},close:function(){t(function(t){jo(t,dy)})}};return f},jF=function(t,n,e){var o,r,i,u=BF(t.internalDialog.title,e),a=(o={body:t.internalDialog.body},r=e,i=vF(o,st.none(),r,!1),BM.parts().body(i)),c=AF(t.internalDialog.buttons),s=FF(c),f=zF({buttons:c},e),l=VF(function(){return p},DF(function(){return g},n),e.shared.getSink),d="normal"!==t.internalDialog.size?"large"===t.internalDialog.size?["tox-dialog--width-lg"]:["tox-dialog--width-md"]:[],m={header:u,body:a,footer:st.some(f),extraClasses:d,extraBehaviours:[],extraStyles:{}},g=MF(m,t,l,e),p=LF({getRoot:function(){return g},getBody:function(){return BM.getBody(g)},getFooter:function(){return BM.getFooter(g)},getFormWrapper:function(){var t=BM.getBody(g);return Ll.getCurrent(t).getOr(t)}},n.redial,s);return{dialog:g,instanceApi:p}},UF=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m=Wr("dialog-label"),g=Wr("dialog-content"),p=Zg((u={title:t.internalDialog.title,draggable:!0},a=m,c=e.shared.providers,Zb.sketch({dom:CB('<div class="tox-dialog__header"></div>'),components:[TF(u,st.some(a),c),EF(),_F(c)],containerBehaviours:Ka([pM.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return ju(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),h=Zg((s={body:t.internalDialog.body},f=g,l=e,d=o,vF(s,st.some(f),l,d))),v=AF(t.internalDialog.buttons),b=FF(v),y=Zg(HF({buttons:v},e)),x=VF(function(){return S},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}},e.shared.getSink),w=uu({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline"],attributes:((r={role:"dialog"})["aria-labelledby"]=m,r["aria-describedby"]=""+g,r)},eventOrder:((i={})[xo()]=[bT.name(),oc.name()],i[wo()]=["execute-on-form"],i[Ao()]=["reflecting","execute-on-form"],i),behaviours:Ka([Gm.config({mode:"cyclic",onEscape:function(t){return jo(t,dy),st.some(!0)},useTabstopAt:function(t){return!DS(t)&&("button"!==cr(t)||"disabled"!==Ir(t,"disabled"))}}),bT.config({channel:dF,updateState:function(t,n){return st.some(n)},initialData:t}),eg.config({}),$m("execute-on-form",x.concat([or(uo(),function(t,n){Gm.focusIn(t)})])),SS({})]),components:[p.asSpec(),h.asSpec(),y.asSpec()]}),S=LF({getRoot:function(){return w},getFooter:function(){return y.get(w)},getBody:function(){return h.get(w)},getFormWrapper:function(){var t=h.get(w);return Ll.getCurrent(t).getOr(t)}},n.redial,b);return{dialog:w,instanceApi:S}},WF=tinymce.util.Tools.resolve("tinymce.util.URI"),GF=["insertContent","setContent","execCommand","close","block","unblock"],XF=function(t){return S(t)&&-1!==GF.indexOf(t.mceAction)},YF=function(o,t,r,n){var e,i,u,a,c=BF(o.title,n),s=(i={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[TS({dom:{tag:"iframe",attributes:{src:o.url}},behaviours:Ka([uy.config({}),eg.config({})])})]}],behaviours:Ka([Gm.config({mode:"acyclic",useTabstopAt:x(DS)})])},BM.parts().body(i)),f=o.buttons.bind(function(t){return 0===t.length?st.none():st.some(zF({buttons:t},n))}),l=RF(function(){return y},DF(function(){return b},t)),d=et(et({},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 WF(o.url,{base_uri:new WF(nt.window.location.href)}),p=g.protocol+"://"+g.host+(g.port?":"+g.port:""),h=se(st.none()),v=[$m("messages",[rr(function(){var t=Bb(le.fromDom(nt.window),"message",function(t){if(g.isSameOrigin(new WF(t.raw().origin))){var n=t.raw().data;XF(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=!!k(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):!XF(e=n)&&S(e)&&It(e,"mceAction")&&o.onMessage(y,n)}var e});h.set(st.some(t))}),ir(function(){h.get().each(function(t){return t.unbind()})})]),oc.config({channels:((e={})[hF]={onReceive:function(t,n){Lu(t.element(),"iframe").each(function(t){t.dom().contentWindow.postMessage(n,p)})}},e)})],b=MF({header:c,body:s,footer:f,extraClasses:m,extraBehaviours:v,extraStyles:d},o,l,n),y=(a=function(t){u.getSystem().isConnected()&&t(u)},{block:function(n){if(!w(n))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");a(function(t){Uo(t,hy,{message:n})})},unblock:function(){a(function(t){jo(t,vy)})},close:function(){a(function(t){jo(t,dy)})},sendMessage:function(n){a(function(t){t.getSystem().broadcastOn([hF],n)})}});return{dialog:u=b,instanceApi:y}},qF=function(t){var c,s,f,l,p=t.backstage,h=t.editor,v=Jh(h),e=(s=(c=t).backstage.shared,{open:function(t,n){var e=function(){BM.hide(u),n()},o=Zg($k({name:"close-alert",text:"OK",primary:!0,align:"end",disabled:!1,icon:st.none()},"cancel",c.backstage)),r=wF(),i=xF(e,s.providers),u=uu(OF({lazySink:function(){return s.getSink()},header:yF(r,i),body:SF(t,s.providers),footer:st.some(kF(CF([],[o.asSpec()]))),onEscape:e,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[$o(my,e)],eventOrder:{}}));BM.show(u);var a=o.get(u);eg.focus(a)}}),o=(l=(f=t).backstage.shared,{open:function(t,n){var e=function(t){BM.hide(a),n(t)},o=Zg($k({name:"yes",text:"Yes",primary:!0,align:"end",disabled:!1,icon:st.none()},"submit",f.backstage)),r=$k({name:"no",text:"No",primary:!1,align:"end",disabled:!1,icon:st.none()},"cancel",f.backstage),i=wF(),u=xF(function(){return e(!1)},l.providers),a=uu(OF({lazySink:function(){return l.getSink()},header:yF(i,u),body:SF(t,l.providers),footer:st.some(kF(CF([],[r,o.asSpec()]))),onEscape:function(){return e(!1)},extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[$o(my,function(){return e(!1)}),$o(py,function(){return e(!0)})],eventOrder:{}}));BM.show(a);var c=o.get(a);eg.focus(c)}}),r=function(t,e){return YA.openUrl(function(t){var n=YF(t,{closeWindow:function(){BM.hide(n.dialog),e(n.instanceApi)}},h,p);return BM.show(n.dialog),n.instanceApi},t)},i=function(t,i){return YA.open(function(t,n,e){var o=n,r=jF({dataValidator:e,initialData:o,internalDialog:t},{redial:YA.redial,closeWindow:function(){BM.hide(r.dialog),i(r.instanceApi)}},p);return BM.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},u=function(t,d,m,g){return YA.open(function(t,n,e){var o,r,i,u=_n(On("data",e,n)),a=(o=se(st.none()),{clear:function(){o.set(st.none())},set:function(t){o.set(st.some(t))},isSet:function(){return o.get().isSome()},on:function(t){o.get().each(t)}}),c=p.shared.header.isPositionedAtTop(),s=function(){return a.on(function(t){zg.reposition(t),$E.refresh(t)})},f=UF({dataValidator:e,initialData:u,internalDialog:t},{redial:YA.redial,closeWindow:function(){a.on(zg.hide),h.off("ResizeEditor",s),a.clear(),m(f.instanceApi)}},p,g),l=uu(zg.sketch(et(et({lazySink:p.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{}},c?{}:{fireRepositionEventInstead:{}}),{inlineBehaviours:Ka(b([$m("window-manager-inline-events",[$o(Io(),function(t,n){jo(f.dialog,my)})])],(r=h,i=c,v&&i?[]:[$E.config({contextual:{lazyContext:function(){return st.some(Mu(le.fromDom(r.getContentAreaContainer())))},fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top"]})]))),isExtraPart:function(t,n){return Ab(e=n,".tox-alert-dialog")||Ab(e,".tox-confirm-dialog");var e}})));return a.set(l),zg.showWithin(l,d,au(f.dialog),st.some(Vi())),v&&c||($E.refresh(l),h.on("ResizeEditor",s)),f.instanceApi.setData(u),Gm.focusIn(f.dialog),f.instanceApi},t)};return{open:function(t,n,e){return n!==undefined&&"toolbar"===n.inline?u(t,p.shared.anchors.inlineDialog(),e,n.ariaAttrs):n!==undefined&&"cursor"===n.inline?u(t,p.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)})}}};!function oI(){t.add("silver",function(t){var n=OM(t),e=n.uiMothership,o=n.backstage,r=n.renderUI,i=n.getUi;Tb(t,o.shared);var u=qF({editor:t,backstage:o});return{renderUI:r,getWindowManagerImpl:at(u),getNotificationManagerImpl:function(){return rp(0,{backstage:o},e)},ui:i()}})}()}(window);