text: !function(b){"use strict";function h(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)}}function v(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)n.indexOf(o[r])<0&&(e[o[r]]=t[o[r]])}return e}function o(t,n,e,o,r){return t(e,o)?tt.some(e):et(r)&&r(e)?tt.none():n(e,o,r)}function t(o,r){var t=function(t){var n=r(t);if(n<=0||null===n){var e=Ou(t,o);return parseFloat(e)||0}return n},i=function(r,t){return dt(t,function(t,n){var e=Ou(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();xu(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}}}function c(r,i,u){var a=i.backstage;return{open:function(t,n){var e=function(){n(),kg.hide(r)},o=ju(_g.sketch({text:t.text,level:it(["success","error","warning","info"],t.type)?t.type:undefined,progress:!0===t.progressBar,icon:tt.from(t.icon),onAction:e,iconProvider:a.shared.providers.icons,translationProvider:a.shared.providers.translate})),r=ju(kg.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:i.backstage.shared.getSink,fireDismissalEventInstead:{}}));return u.add(r),t.timeout&&Mg.setTimeout(function(){e()},t.timeout),{close:e,moveTo:function(t,n){kg.showAt(r,{anchor:"makeshift",x:t,y:n},Uu(o))},moveRel:function(){kg.showAt(r,i.backstage.shared.anchors.banner(),Uu(o))},text:function(t){_g.updateText(o,t)},settings:t,getEl:function(){},progressBar:{value:function(t){_g.updateProgress(o,t)}}}},close:function(t){t.close()},reposition:function(t){st(t,function(t){t.moveTo(0,0)}),function(e){if(0<e.length){var t=e.slice(0,1)[0],n=(o=r).inline?o.getElement():o.getContentAreaContainer();t.moveRel(n,"tc-tc"),st(e,function(t,n){0<n&&t.moveRel(e[n-1].getEl(),"bc-tc")})}var o}(t)},getArgs:function(t){return t.settings}}}function s(e,o){var r=null;return{cancel:function(){null!==r&&(b.clearTimeout(r),r=null)},schedule:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r=b.setTimeout(function(){e.apply(null,t),r=null},o)}}}function n(){var i={};return{registerId:function(o,r,t){Dt(t,function(t,n){var e=i[n]!==undefined?i[n]:{};e[r]=eu(t,o),i[n]=e})},unregisterId:function(n){Dt(i,function(t){t.hasOwnProperty(n)&&delete t[n]})},filterByType:function(t){return Jt(i,t).map(function(t){return Mt(t,function(t,n){return Kh(n,t)})}).getOr([])},find:function(t,n,e){var r=qt(n)(i);return yi(e,function(t){return e=r,ji(o=t).fold(function(){return tt.none()},function(t){var n=qt(t);return e.bind(n).map(function(t){return qh(o,t)})});var e,o},t)}}}function y(){var o=n(),r={},i=function(o){var t=o.element();return ji(t).fold(function(){return t="uid-",n=o.element(),e=Oo(zi+t),Li(n,e),e;var t,n,e},function(t){return t})},u=function(t){ji(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);tn(r,n)&&function(t,n){var e=r[n];if(e!==t)throw new Error('The tagId "'+n+'" is already used by: '+lo(e.element())+"\nCannot use it for: "+lo(t.element())+"\nThe conflicting element is"+(mi(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 qt(t)(r)}}}function e(t,n){return i(b.document.createElement("canvas"),t,n)}function r(t){return t.getContext("2d")}function i(t,n,e){return t.width=n,t.height=e,t}function u(){return new(Te.getOrDie("FileReader"))}function a(a){return new Jw(function(t,n){function e(){u(),t(i)}function o(){u(),n("Unable to load data of type "+a.type+": "+r)}var r=b.URL.createObjectURL(a),i=new b.Image,u=function(){i.removeEventListener("load",e),i.removeEventListener("error",o)};i.addEventListener("load",e),i.addEventListener("error",o),i.src=r,i.complete&&e()})}function f(o){return new Jw(function(t,e){var n=new b.XMLHttpRequest;n.open("GET",o,!0),n.responseType="blob",n.onload=function(){200==this.status&&t(this.response)},n.onerror=function(){var t,n=this;e(0===this.status?((t=new Error("No access to download image")).code=18,t.name="SecurityError",t):new Error("Error "+n.status+" downloading image"))},n.send()})}function l(t){var n=t.split(","),e=/data:([^;]+)/.exec(n[0]);if(!e)return tt.none();for(var o,r=e[1],i=n[1],u=$w.atob(i),a=u.length,c=Math.ceil(a/1024),s=new Array(c),f=0;f<c;++f){for(var l=1024*f,d=Math.min(l+1024,a),m=new Array(d-l),g=l,p=0;g<d;++p,++g)m[p]=u[g].charCodeAt(0);s[f]=(o=m,new(Te.getOrDie("Uint8Array"))(o))}return tt.some(function h(t,n){return new(Te.getOrDie("Blob"))(t,n)}(s,{type:r}))}function d(e){return new Jw(function(t,n){l(e).fold(function(){n("uri is not base64: "+e)},t)})}function m(e){return new Jw(function(t){var n=u();n.onloadend=function(){t(n.result)},n.readAsDataURL(e)})}function g(t,n,e){function o(n,e){return t.then(function(t){return Qw.canvasToDataURL(t,n,e)})}var r=n.type;return{getType:Z(r),toBlob:function i(){return Jw.resolve(n)},toDataURL:function u(){return e},toBase64:function a(){return e.split(",")[1]},toAdjustedBlob:function c(n,e){return t.then(function(t){return Qw.canvasToBlob(t,n,e)})},toAdjustedDataURL:o,toAdjustedBase64:function s(t,n){return o(t,n).then(function(t){return t.split(",")[1]})},toCanvas:function f(){return t.then(qw.clone)}}}function p(n){return Qw.blobToDataUri(n).then(function(t){return g(Qw.blobToCanvas(n),n,t)})}function x(t,n,e){return e<(t=parseFloat(t))?t=e:t<n&&(t=n),t}function w(t,n){var e,o,r,i,u=[],a=new Array(10);for(e=0;e<5;e++){for(o=0;o<5;o++)u[o]=n[o+5*e];for(o=0;o<5;o++){for(r=i=0;r<5;r++)i+=t[o+5*r]*u[r];a[o+5*e]=i}}return a}function S(t,e){return e=x(e,0,1),t.map(function(t,n){return n%6==0?t=1-(1-t)*e:t*=e,x(t,0,1)})}function C(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o,r=qw.get2dContext(t);return o=function B(t,n){var e,o,r,i,u,a=t.data,c=n[0],s=n[1],f=n[2],l=n[3],d=n[4],m=n[5],g=n[6],p=n[7],h=n[8],v=n[9],b=n[10],y=n[11],x=n[12],w=n[13],S=n[14],C=n[15],k=n[16],O=n[17],E=n[18],T=n[19];for(u=0;u<a.length;u+=4)e=a[u],o=a[u+1],r=a[u+2],i=a[u+3],a[u]=e*c+o*s+r*f+i*l+d,a[u+1]=e*m+o*g+r*p+i*h+v,a[u+2]=e*b+o*y+r*x+i*w+S,a[u+3]=e*C+o*k+r*O+i*E+T;return t}(r.getImageData(0,0,t.width,t.height),e),r.putImageData(o,0,0),Zw.fromCanvas(t,n)}(t,n.getType(),e)})}function k(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o,r=qw.get2dContext(t);return o=function x(t,n,e){function o(t,n,e){return e<t?t=e:t<n&&(t=n),t}var r,i,u,a,c,s,f,l,d,m,g,p,h,v,b,y;for(u=Math.round(Math.sqrt(e.length)),a=Math.floor(u/2),r=t.data,i=n.data,b=t.width,y=t.height,s=0;s<y;s++)for(c=0;c<b;c++){for(f=l=d=0,g=0;g<u;g++)for(m=0;m<u;m++)p=o(c+m-a,0,b-1),h=4*(o(s+g-a,0,y-1)*b+p),v=e[g*u+m],f+=r[h]*v,l+=r[h+1]*v,d+=r[h+2]*v;i[h=4*(s*b+c)]=o(f,0,255),i[h+1]=o(l,0,255),i[h+2]=o(d,0,255)}return n}(r.getImageData(0,0,t.width,t.height),o=r.getImageData(0,0,t.width,t.height),e),r.putImageData(o,0,0),Zw.fromCanvas(t,n)}(t,n.getType(),e)})}function O(c){return function(n,e){return n.toCanvas().then(function(t){return function(t,n,e){var o,r,i=qw.get2dContext(t),u=new Array(256);for(r=0;r<u.length;r++)u[r]=c(r,e);return o=function a(t,n){var e,o=t.data;for(e=0;e<o.length;e+=4)o[e]=n[o[e]],o[e+1]=n[o[e+1]],o[e+2]=n[o[e+2]];return t}(i.getImageData(0,0,t.width,t.height),u),i.putImageData(o,0,0),Zw.fromCanvas(t,n)}(t,n.getType(),e)})}}function E(e){return function(t,n){return C(t,e(eS.identity(),n))}}function T(n){return function(t){return k(t,n)}}function B(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 D(t,r){var i,u,n,a,c,f,l,d=r.document||b.document;r=r||{};var m=d.getElementById(r.handle||t);n=function(t){var n,e,o=function s(t){var n,e,o,r,i,u,a,c=Math.max;return n=t.documentElement,e=t.body,o=c(n.scrollWidth,e.scrollWidth),r=c(n.clientWidth,e.clientWidth),i=c(n.offsetWidth,e.offsetWidth),u=c(n.scrollHeight,e.scrollHeight),a=c(n.clientHeight,e.clientHeight),{width:o<i?r:o,height:u<c(n.offsetHeight,e.offsetHeight)?a:u}}(d);B(t),t.preventDefault(),u=t.button,n=m,f=t.screenX,l=t.screenY,e=b.window.getComputedStyle?b.window.getComputedStyle(n,null).getPropertyValue("cursor"):n.runtimeStyle.cursor,i=jS("<div></div>").css({position:"absolute",top:0,left:0,width:o.width,height:o.height,zIndex:2147483647,opacity:1e-4,cursor:e}).appendTo(d.body),jS(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(B(t),t.button!==u)return a(t);t.deltaX=t.screenX-f,t.deltaY=t.screenY-l,t.preventDefault(),r.drag(t)},a=function(t){B(t),jS(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){jS(m).off()},jS(m).on("mousedown touchstart",n)}var A,_,M,F,I,V,R,Q=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n]},H=function(e,o){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(o.apply(null,t))}},Z=function(t){return function(){return t}},U=function(t){return t},N=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return!e.apply(null,t)}},z=function(t){return function(){throw new Error(t)}},P=Z(!1),L=Z(!0),j=P,W=L,G=function(){return X},X=(F={fold:function(t){return t()},is:j,isSome:j,isNone:W,getOr:M=function(t){return t},getOrThunk:_=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:M,orThunk:_,map:G,ap:G,each:function(){},bind:G,flatten:G,exists:j,forall:W,filter:G,equals:A=function(t){return t.isNone()},equals_:A,toArray:function(){return[]},toString:Z("none()")},Object.freeze&&Object.freeze(F),F),Y=function(e){var t=function(){return e},n=function(){return r},o=function(t){return t(e)},r={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:W,isNone:j,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:n,orThunk:n,map:function(t){return Y(t(e))},ap:function(t){return t.fold(G,function(t){return Y(t(e))})},each:function(t){t(e)},bind:o,flatten:t,exists:o,forall:o,filter:function(t){return t(e)?r:X},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(j,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return r},tt={some:Y,none:G,from:function(t){return null===t||t===undefined?X:Y(t)}},q=function(n){return function(t){return function(t){if(null===t)return"null";var n=typeof t;return"object"===n&&Array.prototype.isPrototypeOf(t)?"array":"object"===n&&String.prototype.isPrototypeOf(t)?"string":n}(t)===n}},K=q("string"),J=q("object"),$=q("array"),nt=q("boolean"),et=q("function"),ot=q("number"),rt=(I=Array.prototype.indexOf)===undefined?function(t,n){return pt(t,n)}:function(t,n){return I.call(t,n)},it=function(t,n){return-1<rt(t,n)},ut=function(t,n){return gt(t,n).isSome()},at=function(t,n){for(var e=[],o=0;o<t.length;o+=n){var r=t.slice(o,o+n);e.push(r)}return e},ct=function(t,n){for(var e=t.length,o=new Array(e),r=0;r<e;r++){var i=t[r];o[r]=n(i,r,t)}return o},st=function(t,n){for(var e=0,o=t.length;e<o;e++)n(t[e],e,t)},ft=function(t,n){for(var e=[],o=0,r=t.length;o<r;o++){var i=t[o];n(i,o,t)&&e.push(i)}return e},lt=function(t,n,e){return function(t,n){for(var e=t.length-1;0<=e;e--)n(t[e],e,t)}(t,function(t){e=n(e,t)}),e},dt=function(t,n,e){return st(t,function(t){e=n(e,t)}),e},mt=function(t,n){for(var e=0,o=t.length;e<o;e++){var r=t[e];if(n(r,e,t))return tt.some(r)}return tt.none()},gt=function(t,n){for(var e=0,o=t.length;e<o;e++)if(n(t[e],e,t))return tt.some(e);return tt.none()},pt=function(t,n){for(var e=0,o=t.length;e<o;++e)if(t[e]===n)return e;return-1},ht=Array.prototype.push,vt=function(t){for(var n=[],e=0,o=t.length;e<o;++e){if(!Array.prototype.isPrototypeOf(t[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+t);ht.apply(n,t[e])}return n},bt=function(t,n){var e=ct(t,n);return vt(e)},yt=function(t,n){for(var e=0,o=t.length;e<o;++e)if(!0!==n(t[e],e,t))return!1;return!0},xt=Array.prototype.slice,wt=function(t){var n=xt.call(t,0);return n.reverse(),n},St=function(t,n){return ft(t,function(t){return!it(n,t)})},Ct=function(t){return[t]},kt=function(t){return 0===t.length?tt.none():tt.some(t[0])},Ot=function(t){return 0===t.length?tt.none():tt.some(t[t.length-1])},Et=et(Array.from)?Array.from:function(t){return xt.call(t)},Tt=Object.keys,Bt=Object.hasOwnProperty,Dt=function(t,n){for(var e=Tt(t),o=0,r=e.length;o<r;o++){var i=e[o];n(t[i],i,t)}},At=function(t,o){return _t(t,function(t,n,e){return{k:n,v:o(t,n,e)}})},_t=function(o,r){var i={};return Dt(o,function(t,n){var e=r(t,n,o);i[e.k]=e.v}),i},Mt=function(t,e){var o=[];return Dt(t,function(t,n){o.push(e(t,n))}),o},Ft=function(t){return Mt(t,function(t){return t})},It=function(t,n){return Vt(t,n)?tt.from(t[n]):tt.none()},Vt=function(t,n){return Bt.call(t,n)},Rt=function(n){return function(t){return Vt(t,n)?tt.from(t[n]):tt.none()}},Ht=function(t,n){return Rt(n)(t)},Nt=function(t,n){var e={};return e[t]=n,e},zt=function(e){return{is:function(t){return e===t},isValue:L,isError:P,getOr:Z(e),getOrThunk:Z(e),getOrDie:Z(e),or:function(){return zt(e)},orThunk:function(){return zt(e)},fold:function(t,n){return n(e)},map:function(t){return zt(t(e))},mapError:function(){return zt(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 tt.some(e)}}},Pt=function(n){return{is:P,isValue:P,isError:L,getOr:U,getOrThunk:function(t){return t()},getOrDie:function(){return z(String(n))()},or:function(t){return t},orThunk:function(t){return t()},fold:function(t){return t(n)},map:function(){return Pt(n)},mapError:function(t){return Pt(t(n))},each:Q,bind:function(){return Pt(n)},exists:P,forall:L,toOption:tt.none}},Lt={value:zt,error:Pt},jt=function(u){if(!$(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 st(u,function(t,o){var n=Tt(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(!$(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=Tt(t);if(a.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+n.join(","));if(!yt(a,function(t){return it(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){b.console.log(t,{constructors:a,constructor:r,params:e})}}}}),e},Ut=(jt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),Object.prototype.hasOwnProperty),Wt=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)Ut.call(r,i)&&(e[i]=u(e[i],r[i]))}return e}},Gt=Wt(function(t,n){return J(t)&&J(n)?Gt(t,n):n}),Xt=Wt(function(t,n){return n}),Yt=function(t,n){return e=n,o={},Dt(t,function(t,n){it(e,n)||(o[n]=t)}),o;var e,o},qt=function(t){return Rt(t)},Kt=function(t,n){return e=t,o=n,function(t){return Vt(t,e)?t[e]:o};var e,o},Jt=function(t,n){return Ht(t,n)},$t=function(t,n){return Nt(t,n)},Qt=function(t){return n={},st(t,function(t){n[t.key]=t.value}),n;var n},Zt=function(t,n){var e,o,r,i,u,a=(e=[],o=[],st(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,H(Lt.error,vt)(u)):(i=n,0===(r=a.values).length?Lt.value(i):Lt.value(Gt(i,Xt.apply(undefined,r))))},tn=function(t,n){return Vt(e=t,o=n)&&e[o]!==undefined&&null!==e[o];var e,o},nn=function(t){var n=t,e=function(){return n};return{get:e,set:function(t){n=t},clone:function(){return nn(e())}}},en=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o<t.length;o++)t[o].each(e);return n},on=function(t,n){for(var e=0;e<t.length;e++){var o=n(t[e],e);if(o.isSome())return o}return tt.none()},rn=Z("touchstart"),un=Z("touchmove"),an=Z("touchend"),cn=Z("mousedown"),sn=Z("mousemove"),fn=Z("mouseout"),ln=Z("mouseup"),dn=Z("mouseover"),mn=Z("focusin"),gn=Z("focusout"),pn=Z("keydown"),hn=Z("keyup"),vn=Z("input"),bn=Z("change"),yn=Z("click"),xn=Z("transitionend"),wn=Z("selectstart"),Sn=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}},Cn=function(t,n){var e=function(t,n){for(var e=0;e<t.length;e++){var o=t[e];if(o.test(n))return o}return undefined}(t,n);if(!e)return{major:0,minor:0};var o=function(t){return Number(n.replace(e,"$"+t))};return On(o(1),o(2))},kn=function(){return On(0,0)},On=function(t,n){return{major:t,minor:n}},En={nu:On,detect:function(t,n){var e=String(n).toLowerCase();return 0===t.length?kn():Cn(t,e)},unknown:kn},Tn="Firefox",Bn=function(t,n){return function(){return n===t}},Dn=function(t){var n=t.current;return{current:n,version:t.version,isEdge:Bn("Edge",n),isChrome:Bn("Chrome",n),isIE:Bn("IE",n),isOpera:Bn("Opera",n),isFirefox:Bn(Tn,n),isSafari:Bn("Safari",n)}},An={unknown:function(){return Dn({current:undefined,version:En.unknown()})},nu:Dn,edge:Z("Edge"),chrome:Z("Chrome"),ie:Z("IE"),opera:Z("Opera"),firefox:Z(Tn),safari:Z("Safari")},_n="Windows",Mn="Android",Fn="Solaris",In="FreeBSD",Vn=function(t,n){return function(){return n===t}},Rn=function(t){var n=t.current;return{current:n,version:t.version,isWindows:Vn(_n,n),isiOS:Vn("iOS",n),isAndroid:Vn(Mn,n),isOSX:Vn("OSX",n),isLinux:Vn("Linux",n),isSolaris:Vn(Fn,n),isFreeBSD:Vn(In,n)}},Hn={unknown:function(){return Rn({current:undefined,version:En.unknown()})},nu:Rn,windows:Z(_n),ios:Z("iOS"),android:Z(Mn),linux:Z("Linux"),osx:Z("OSX"),solaris:Z(Fn),freebsd:Z(In)},Nn=function(t,n){var e=String(n).toLowerCase();return mt(t,function(t){return t.search(e)})},zn=function(t,e){return Nn(t,e).map(function(t){var n=En.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Pn=function(t,e){return Nn(t,e).map(function(t){var n=En.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Ln=function(t,n){return-1!==t.indexOf(n)},jn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Un=function(n){return function(t){return Ln(t,n)}},Wn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Ln(t,"edge/")&&Ln(t,"chrome")&&Ln(t,"safari")&&Ln(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,jn],search:function(t){return Ln(t,"chrome")&&!Ln(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Ln(t,"msie")||Ln(t,"trident")}},{name:"Opera",versionRegexes:[jn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Un("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Un("firefox")},{name:"Safari",versionRegexes:[jn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Ln(t,"safari")||Ln(t,"mobile/"))&&Ln(t,"applewebkit")}}],Gn=[{name:"Windows",search:Un("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return Ln(t,"iphone")||Ln(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Un("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Un("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Un("linux"),versionRegexes:[]},{name:"Solaris",search:Un("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Un("freebsd"),versionRegexes:[]}],Xn={browsers:Z(Wn),oses:Z(Gn)},Yn=function(t){var n,e,o,r,i,u,a,c,s,f,l,d=Xn.browsers(),m=Xn.oses(),g=zn(d,t).fold(An.unknown,An.nu),p=Pn(m,t).fold(Hn.unknown,Hn.nu);return{browser:g,os:p,deviceType:(e=g,o=t,r=(n=p).isiOS()&&!0===/ipad/i.test(o),i=n.isiOS()&&!r,u=n.isAndroid()&&3===n.version.major,a=n.isAndroid()&&4===n.version.major,c=r||u||a&&!0===/mobile/i.test(o),s=n.isiOS()||n.isAndroid(),f=s&&!c,l=e.isSafari()&&n.isiOS()&&!1===/safari/i.test(o),{isiPad:Z(r),isiPhone:Z(i),isTablet:Z(c),isPhone:Z(f),isTouch:Z(s),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:Z(l)})}},qn={detect:Sn(function(){var t=b.navigator.userAgent;return Yn(t)})},Kn={tap:Z("alloy.tap")},Jn=Z("alloy.focus"),$n=Z("alloy.blur.post"),Qn=Z("alloy.paste.post"),Zn=Z("alloy.receive"),te=Z("alloy.execute"),ne=Z("alloy.focus.item"),ee=Kn.tap,oe=qn.detect().deviceType.isTouch()?Kn.tap:yn,re=Z("alloy.longpress"),ie=Z("alloy.sandbox.close"),ue=Z("alloy.typeahead.cancel"),ae=Z("alloy.system.init"),ce=Z("alloy.system.scroll"),se=Z("alloy.system.resize"),fe=Z("alloy.system.attached"),le=Z("alloy.system.detached"),de=Z("alloy.system.dismissRequested"),me=Z("alloy.focusmanager.shifted"),ge=Z("alloy.slotcontainer.visibility"),pe=Z("alloy.change.tab"),he=Z("alloy.dismiss.tab"),ve=Z("alloy.highlight"),be=Z("alloy.dehighlight"),ye=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:Z(t)}},xe={fromHtml:function(t,n){var e=(n||b.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1<e.childNodes.length)throw b.console.error("HTML does not have a single root node",t),new Error("HTML must have a single root node");return ye(e.childNodes[0])},fromTag:function(t,n){var e=(n||b.document).createElement(t);return ye(e)},fromText:function(t,n){var e=(n||b.document).createTextNode(t);return ye(e)},fromDom:ye,fromPoint:function(t,n,e){var o=t.dom();return tt.from(o.elementFromPoint(n,e)).map(ye)}},we=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(n.length!==e.length)throw new Error('Wrong number of arguments to struct. Expected "['+n.length+']", got '+e.length+" arguments");var o={};return st(n,function(t,n){o[t]=Z(e[n])}),o}},Se=function(t){return t.slice(0).sort()},Ce=function(n,t){if(!$(t))throw new Error("The "+n+" fields must be an array. Was: "+t+".");st(t,function(t){if(!K(t))throw new Error("The value "+t+" in the "+n+" fields was not a string.")})},ke=function(r,i){var e,u=r.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return Ce("required",r),Ce("optional",i),e=Se(u),mt(e,function(t,n){return n<e.length-1&&t===e[n+1]}).each(function(t){throw new Error("The field: "+t+" occurs more than once in the combined fields: ["+e.join(", ")+"].")}),function(n){var e=Tt(n);yt(r,function(t){return it(e,t)})||function(t,n){throw new Error("All required keys ("+Se(r).join(", ")+") were not specified. Specified keys were: "+Se(n).join(", ")+".")}(0,e);var t=ft(e,function(t){return!it(u,t)});0<t.length&&function(){throw new Error("Unsupported keys for object: "+Se(t).join(", "))}();var o={};return st(r,function(t){o[t]=Z(n[t])}),st(i,function(t){o[t]=Z(Object.prototype.hasOwnProperty.call(n,t)?tt.some(n[t]):tt.none())}),o}},Oe="undefined"!=typeof b.window?b.window:Function("return this;")(),Ee=function(t,o){return function(t){for(var n=o!==undefined&&null!==o?o:Oe,e=0;e<t.length&&n!==undefined&&null!==n;++e)n=n[t[e]];return n}(t.split("."))},Te={getOrDie:function(t,n){var e=Ee(t,n);if(e===undefined||null===e)throw t+" not available on this browser";return e}},Be=(b.Node.ATTRIBUTE_NODE,b.Node.CDATA_SECTION_NODE,b.Node.COMMENT_NODE,b.Node.DOCUMENT_NODE),De=(b.Node.DOCUMENT_TYPE_NODE,b.Node.DOCUMENT_FRAGMENT_NODE,b.Node.ELEMENT_NODE),Ae=b.Node.TEXT_NODE,_e=(b.Node.PROCESSING_INSTRUCTION_NODE,b.Node.ENTITY_REFERENCE_NODE,b.Node.ENTITY_NODE,b.Node.NOTATION_NODE,De),Me=Be,Fe=function(t,n){var e=t.dom();if(e.nodeType!==_e)return!1;if(e.matches!==undefined)return e.matches(n);if(e.msMatchesSelector!==undefined)return e.msMatchesSelector(n);if(e.webkitMatchesSelector!==undefined)return e.webkitMatchesSelector(n);if(e.mozMatchesSelector!==undefined)return e.mozMatchesSelector(n);throw new Error("Browser lacks native selectors")},Ie=function(t){return t.nodeType!==_e&&t.nodeType!==Me||0===t.childElementCount},Ve=function(t,n){var e=n===undefined?b.document:n.dom();return Ie(e)?[]:ct(e.querySelectorAll(t),xe.fromDom)},Re=function(t,n){return t.dom()===n.dom()},He=(qn.detect().browser.isIE(),function(t){return xe.fromDom(t.dom().ownerDocument)}),Ne=function(t){var n=t.dom().ownerDocument.defaultView;return xe.fromDom(n)},ze=function(t){var n=t.dom();return tt.from(n.parentNode).map(xe.fromDom)},Pe=function(t){var n=t.dom();return tt.from(n.offsetParent).map(xe.fromDom)},Le=function(t){var n=t.dom();return ct(n.childNodes,xe.fromDom)},je=function(t,n){var e=t.dom().childNodes;return tt.from(e[n]).map(xe.fromDom)},Ue=(we("element","offset"),function(n,e){ze(n).each(function(t){t.dom().insertBefore(e.dom(),n.dom())})}),We=function(t,n){var e;(e=t.dom(),tt.from(e.nextSibling).map(xe.fromDom)).fold(function(){ze(t).each(function(t){Xe(t,n)})},function(t){Ue(t,n)})},Ge=function(n,e){je(n,0).fold(function(){Xe(n,e)},function(t){n.dom().insertBefore(e.dom(),t.dom())})},Xe=function(t,n){t.dom().appendChild(n.dom())},Ye=function(n,t){st(t,function(t){Xe(n,t)})},qe=function(t){t.dom().textContent="",st(Le(t),function(t){Ke(t)})},Ke=function(t){var n=t.dom();null!==n.parentNode&&n.parentNode.removeChild(n)},Je=function(t){return t.dom().innerHTML},$e=function(t,n){var e,o,r=He(t).dom(),i=xe.fromDom(r.createDocumentFragment()),u=(e=n,(o=(r||b.document).createElement("div")).innerHTML=e,Le(xe.fromDom(o)));Ye(i,u),qe(t),Xe(t,i)},Qe=function(t){return t.dom().nodeName.toLowerCase()},Ze=function(n){return function(t){return t.dom().nodeType===n}},to=Ze(De),no=Ze(Ae),eo=Ze(Be),oo=function(t,n,e){if(!(K(e)||nt(e)||ot(e)))throw b.console.error("Invalid call to Attr.set. Key ",n,":: Value ",e,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(n,e+"")},ro=function(t,n,e){oo(t.dom(),n,e)},io=function(t,n){var e=t.dom();Dt(n,function(t,n){oo(e,n,t)})},uo=function(t,n){var e=t.dom().getAttribute(n);return null===e?undefined:e},ao=function(t,n){var e=t.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(n)},co=function(t,n){t.dom().removeAttribute(n)},so=function(t){return n=t,e=!1,xe.fromDom(n.dom().cloneNode(e));var n,e},fo=function(t){var n,e,o;return n=so(t),e=xe.fromTag("div"),o=xe.fromDom(n.dom().cloneNode(!0)),Xe(e,o),Je(e)},lo=function(t){return fo(t)},mo="unknown",go="__CHROME_INSPECTOR_CONNECTION_TO_ALLOY__";(R=V||(V={}))[R.STOP=0]="STOP",R[R.NORMAL=1]="NORMAL",R[R.LOGGING=2]="LOGGING";var po,ho,vo=nn({}),bo=function(n,t,e){var o,r,i,u;switch(Jt(vo.get(),n).orThunk(function(){var t=Tt(vo.get());return on(t,function(t){return-1<n.indexOf(t)?tt.some(vo.get()[t]):tt.none()})}).getOr(V.NORMAL)){case V.NORMAL:return e(Co());case V.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();it(["mousemove","mouseover","mouseout",ae()],o)||b.console.log(o,{event:o,time:t-u,target:r.dom(),sequence:ct(i,function(t){return it(["cut","stopped","response"],t.outcome)?"{"+t.purpose+"} "+t.outcome+" at ("+lo(t.target)+")":t.outcome})})}}),c=e(a);return a.write(),c;case V.STOP:return!0}},yo=["alloy/data/Fields","alloy/debugging/Debugging"],xo=function(t,n,e){return bo(t,n,e)},wo=function(){if(b.window[go]!==undefined)return b.window[go];var n=function(t,n){var e=vo.get();e[t]=n,vo.set(e)};return b.window[go]={systems:{},lookup:function(n){var e=b.window[go].systems,t=Tt(e);return on(t,function(t){return e[t].getByUid(n).toOption().map(function(t){return $t(lo(t.element()),(n=function(e){var t=e.spec();return{"(original.spec)":t,"(dom.ref)":e.element().dom(),"(element)":lo(e.element()),"(initComponents)":ct(t.components!==undefined?t.components:[],n),"(components)":ct(e.components(),n),"(bound.events)":Mt(e.events(),function(t,n){return[n]}).join(", "),"(behaviours)":t.behaviours!==undefined?At(t.behaviours,function(t,n){return t===undefined?"--revoked--":{config:t.configAsRaw(),"original-config":t.initialConfig,state:e.readState(n)}}):"none"}})(t));var n})}).orThunk(function(){return tt.some({error:"Systems ("+t.join(", ")+") did not contain uid: "+n})})},events:{setToNormal:function(t){n(t,V.NORMAL)},setToLogging:function(t){n(t,V.LOGGING)},setToStop:function(t){n(t,V.STOP)}}},b.window[go]},So=function(t,n){wo().systems[t]=n},Co=Z({logEventCut:Q,logEventStopped:Q,logNoParent:Q,logEventNoHandlers:Q,logEventResponse:Q,write:Q}),ko=0,Oo=function(t){var n=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++ko+String(n)},Eo=tinymce.util.Tools.resolve("tinymce.ThemeManager"),To=function(){return(To=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)},Bo=jt([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),Do=function(t){return Bo.defaultedThunk(Z(t))},Ao=Bo.strict,_o=Bo.asOption,Mo=Bo.defaultedThunk,Fo=(Bo.asDefaultedOptionThunk,Bo.mergeWithThunk);(ho=po||(po={}))[ho.Error=0]="Error",ho[ho.Value=1]="Value";var Io,Vo,Ro,Ho,No,zo=function(t,n,e){return t.stype===po.Error?n(t.serror):e(t.svalue)},Po=function(t){return{stype:po.Value,svalue:t}},Lo=function(t){return{stype:po.Error,serror:t}},jo=function(t){return t.fold(Lo,Po)},Uo=function(t){return zo(t,Lt.error,Lt.value)},Wo=Po,Go=function(t){var n=[],e=[];return st(t,function(t){zo(t,function(t){return e.push(t)},function(t){return n.push(t)})}),{values:n,errors:e}},Xo=Lo,Yo=function(t,n){return t.stype===po.Value?n(t.svalue):t},qo=function(t,n){return t.stype===po.Error?n(t.serror):t},Ko=function(t,n){return t.stype===po.Value?{stype:po.Value,svalue:n(t.svalue)}:t},Jo=function(t,n){return t.stype===po.Error?{stype:po.Error,serror:n(t.serror)}:t},$o=function(t){return H(Xo,vt)(t)},Qo=function(t,n){var e,o,r=Go(t);return 0<r.errors.length?$o(r.errors):(o=n,0<(e=r.values).length?Wo(Gt(o,Xt.apply(undefined,e))):Wo(o))},Zo=function(t){var n=Go(t);return 0<n.errors.length?$o(n.errors):Wo(n.values)},tr=jt([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),nr=jt([{field:["name","presence","type"]},{state:["name"]}]),er=function(){return Te.getOrDie("JSON")},or=function(t,n,e){return er().stringify(t,n,e)},rr=function(t){return J(t)&&100<Tt(t).length?" removed due to size":or(t,null,2)},ir=function(t,n){return Xo([{path:t,getErrorInfo:n}])},ur=jt([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),ar=function(e,o,r){return Ht(o,r).fold(function(){return t=r,n=o,ir(e,function(){return'Could not find valid *strict* value for "'+t+'" in '+rr(n)});var t,n},Wo)},cr=function(t,n,e){var o=Ht(t,n).fold(function(){return e(t)},U);return Wo(o)},sr=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 Ko(n,function(t){return Nt(e,s(t))})},u=function(t){return t.fold(function(){var t=Nt(e,s(tt.none()));return Wo(t)},function(t){var n=o.extract(a.concat([r]),s,t);return Ko(n,function(t){return Nt(e,s(tt.some(t)))})})};return t.fold(function(){return Yo(ar(a,c,r),i)
  },function(t){return Yo(cr(c,r,t),i)},function(){return Yo(Wo(Ht(c,r)),u)},function(t){return Yo((e=t,o=Ht(n=c,r).map(function(t){return!0===t?e(n):t}),Wo(o)),u);var n,e,o},function(t){var n=t(c),e=Ko(cr(c,r,Z({})),function(t){return Gt(n,t)});return Yo(e,i)})},function(t,n){var e=n(c);return Wo(Nt(t,s(e)))})},fr=function(o){return{extract:function(e,t,n){return qo(o(n,t),function(t){return n=t,ir(e,function(){return n});var n})},toString:function(){return"val"},toDsl:function(){return tr.itemOf(o)}}},lr=function(t){var c=dr(t),s=lt(t,function(n,t){return t.fold(function(t){return Gt(n,$t(t,!0))},Z(n))},{});return{extract:function(t,n,e){var o,r,i,u=nt(e)?[]:(r=Tt(o=e),ft(r,function(t){return tn(o,t)})),a=ft(u,function(t){return!tn(s,t)});return 0===a.length?c.extract(t,n,e):(i=a,ir(t,function(){return"There are unsupported fields: ["+i.join(", ")+"] specified"}))},toString:c.toString,toDsl:c.toDsl}},dr=function(a){return{extract:function(t,n,e){return o=t,r=e,i=n,u=ct(a,function(t){return sr(o,r,t,i)}),Qo(u,{});var o,r,i,u},toString:function(){return"obj{\n"+ct(a,function(t){return t.fold(function(t,n,e,o){return t+" -> "+o.toString()},function(t){return"state("+t+")"})}).join("\n")+"}"},toDsl:function(){return tr.objOf(ct(a,function(t){return t.fold(function(t,n,e,o){return nr.field(t,e,o)},function(t){return nr.state(t)})}))}}},mr=function(r){return{extract:function(e,o,t){var n=ct(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return Zo(n)},toString:function(){return"array("+r.toString()+")"},toDsl:function(){return tr.arrOf(r)}}},gr=function(a,c){return{extract:function(e,o,r){var t,n,i=Tt(r),u=(t=e,n=i,mr(fr(a)).extract(t,U,n));return Yo(u,function(t){var n=ct(t,function(t){return ur.field(t,t,Ao(),c)});return dr(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"},toDsl:function(){return tr.setOf(a,c)}}},pr=Z(fr(Wo)),hr=H(mr,dr),vr=ur.state,br=ur.field,yr=function(e,n,o,r,i){return Jt(r,i).fold(function(){return t=r,n=i,ir(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+rr(t)});var t,n},function(t){return dr(t).extract(e.concat(["branch: "+i]),n,o)})},xr=function(r,i){return{extract:function(n,e,o){return Jt(o,r).fold(function(){return t=r,ir(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return yr(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+Tt(i)},toDsl:function(){return tr.choiceOf(r,i)}}},wr=fr(Wo),Sr=function(n){return fr(function(t){return n(t).fold(Xo,Wo)})},Cr=function(n,t){return gr(function(t){return jo(n(t))},t)},kr=function(t,n,e){return Uo((o=t,r=U,i=e,u=n.extract([o],r,i),Jo(u,function(t){return{input:i,errors:t}})));var o,r,i,u},Or=function(t){return t.fold(function(t){throw new Error(Tr(t))},U)},Er=function(t,n,e){return Or(kr(t,n,e))},Tr=function(t){return"Errors: \n"+(e=10<(n=t.errors).length?n.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):n,ct(e,function(t){return"Failed path: ("+t.path.join(" > ")+")\n"+t.getErrorInfo()}))+"\n\nInput object: "+rr(t.input);var n,e},Br=function(t,n){return xr(t,n)},Dr=Z(wr),Ar=function(e,o){return fr(function(t){var n=typeof t;return e(t)?Wo(t):Xo("Expected type: "+o+" but got: "+n)})},_r=Ar(ot,"number"),Mr=Ar(K,"string"),Fr=Ar(nt,"boolean"),Ir=Ar(et,"function"),Vr=function(n){return Sr(function(t){return it(n,t)?Lt.value(t):Lt.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},Rr=function(t){return br(t,t,Ao(),pr())},Hr=function(t,n){return br(t,t,Ao(),n)},Nr=function(t){return Hr(t,Mr)},zr=function(t,n){return br(t,t,Ao(),Vr(n))},Pr=function(t){return Hr(t,Ir)},Lr=function(t,n){return br(t,t,Ao(),dr(n))},jr=function(t,n){return br(t,t,Ao(),hr(n))},Ur=function(t,n){return br(t,t,Ao(),mr(n))},Wr=function(t){return br(t,t,_o(),pr())},Gr=function(t,n){return br(t,t,_o(),n)},Xr=function(t){return Gr(t,Mr)},Yr=function(t){return Gr(t,Ir)},qr=function(t,n){return br(t,t,_o(),dr(n))},Kr=function(t,n){return br(t,t,Do(n),pr())},Jr=function(t,n,e){return br(t,t,Do(n),e)},$r=function(t,n){return Jr(t,n,_r)},Qr=function(t,n){return Jr(t,n,Mr)},Zr=function(t,n,e){return Jr(t,n,Vr(e))},ti=function(t,n){return Jr(t,n,Fr)},ni=function(t,n){return Jr(t,n,Ir)},ei=function(t,n,e){return br(t,t,Do(n),dr(e))},oi=function(t,n){return vr(t,n)},ri=function(t,n){return Re(t.element(),n.event().target())},ii=function(t){if(!tn(t,"can")&&!tn(t,"abort")&&!tn(t,"run"))throw new Error("EventHandler defined by: "+or(t,null,2)+" does not have can, abort, or run!");return Er("Extracting event.handler",lr([Kr("can",Z(!0)),Kr("abort",Z(!1)),Kr("run",Q)]),t)},ui=function(e){var n,o,r,i,t=(n=e,o=function(t){return t.can},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return dt(n,function(t,n){return t&&o(n).apply(undefined,e)},!0)}),u=(r=e,i=function(t){return t.abort},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return dt(r,function(t,n){return t||i(n).apply(undefined,e)},!1)});return ii({can:t,abort:u,run:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];st(e,function(t){t.run.apply(undefined,n)})}})},ai=function(t,n){li(t,t.element(),n,{})},ci=function(t,n,e){li(t,t.element(),n,e)},si=function(t){ai(t,te())},fi=function(t,n,e){li(t,n,e,{})},li=function(t,n,e,o){var r=To({target:n},o);t.getSystem().triggerEvent(e,n,At(r,Z))},di=function(t,n,e,o){t.getSystem().triggerEvent(e,n,o.event())},mi=function(t){var n=no(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},gi=Sn(function(){return pi(xe.fromDom(b.document))}),pi=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return xe.fromDom(n)},hi=function(t,n,e){for(var o=t.dom(),r=et(e)?e:Z(!1);o.parentNode;){o=o.parentNode;var i=xe.fromDom(o);if(n(i))return tt.some(i);if(r(i))break}return tt.none()},vi=function(t,n,e){return o(function(t){return n(t)},hi,t,n,e)},bi=function(t,o){var r=function(t){for(var n=0;n<t.childNodes.length;n++){if(o(xe.fromDom(t.childNodes[n])))return tt.some(xe.fromDom(t.childNodes[n]));var e=r(t.childNodes[n]);if(e.isSome())return e}return tt.none()};return r(t.dom())},yi=function(t,n,e){return vi(t,function(t){return n(t).isSome()},e).bind(n)},xi=function(t){return Qt(t)},wi=function(t,n){return{key:t,value:ii({abort:n})}},Si=function(t){return{key:t,value:ii({run:function(t,n){n.event().prevent()}})}},Ci=function(t,n){return{key:t,value:ii({run:n})}},ki=function(t,n,e){return{key:t,value:ii({run:function(t){n.apply(undefined,[t].concat(e))}})}},Oi=function(t){return function(e){return{key:t,value:ii({run:function(t,n){ri(t,n)&&e(t,n)}})}}},Ei=function(t,n,e){var o,r,i=n.partUids[e];return r=i,Ci(o=t,function(t,n){t.getSystem().getByUid(r).each(function(t){di(t,t.element(),o,n)})})},Ti=function(t,r){return Ci(t,function(n,t){var e=t.event(),o=n.getSystem().getByDom(e.target()).fold(function(){return yi(e.target(),function(t){return n.getSystem().getByDom(t).toOption()},Z(!1)).getOr(n)},function(t){return t});r(n,o,t)})},Bi=function(t){return Ci(t,function(t,n){n.cut()})},Di=function(t){return Ci(t,function(t,n){n.stop()})},Ai=function(t,n){return Oi(t)(n)},_i=Oi(fe()),Mi=Oi(le()),Fi=Oi(ae()),Ii=(Io=te(),function(t){return Ci(Io,t)}),Vi=xi([(Vo=Jn(),Ro=function(t,n){var e,o,r=n.event().originator(),i=n.event().target();return o=i,!(Re(e=r,t.element())&&!Re(e,o)&&(b.console.warn(Jn()+" did not get interpreted by the desired target. \nOriginator: "+lo(r)+"\nTarget: "+lo(i)+"\nCheck the "+Jn()+" event handlers"),1))},{key:Vo,value:ii({can:Ro})})]),Ri=Object.freeze({events:Vi}),Hi=Z("alloy-id-"),Ni=Z("data-alloy-id"),zi=Hi(),Pi=Ni(),Li=function(t,n){Object.defineProperty(t.dom(),Pi,{value:n,writable:!0})},ji=function(t){var n=to(t)?t.dom()[Pi]:null;return tt.from(n)},Ui=function(t){return Oo(t)},Wi=U,Gi=function(n){var t=function(t){return function(){throw new Error("The component must be in a context to send: "+t+"\n"+lo(n().element())+" is not in context.")}};return{debugInfo:Z("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:Z(!1)}},Xi=Gi(),Yi=function(t){return ct(t,function(t){return o=n="/*",r=(e=t).length-n.length,""!==o&&(e.length<o.length||e.substr(r,r+o.length)!==o)?t:t.substring(0,t.length-"/*".length);var n,e,o,r})},qi=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:Yi(i)}},t},Ki=Oo("alloy-premade"),Ji=function(t){return $t(Ki,t)},$i=function(o){return t=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return o.apply(undefined,[t.getApis()].concat([t].concat(n)))},e=(n=o.toString()).indexOf(")")+1,r=n.indexOf("("),i=n.substring(r+1,e-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:Yi(i.slice(1))}},t;var t,n,e,r,i},Qi={init:function(){return Zi({readState:function(){return"No State required"}})}},Zi=function(t){return t},tu=function(t,r){var i={};return Dt(t,function(t,o){Dt(t,function(t,n){var e=Kt(n,[])(i);i[n]=e.concat([r(o,t)])})}),i},nu=function(t){return{classes:t.classes!==undefined?t.classes:[],attributes:t.attributes!==undefined?t.attributes:{},styles:t.styles!==undefined?t.styles:{}}},eu=function(t,n){return e=h.apply(undefined,[t.handler].concat(n)),o=t.purpose(),{cHandler:e,purpose:Z(o)};var e,o},ou=function(t){return t.cHandler},ru=function(t,n){return{name:Z(t),handler:Z(n)}},iu=function(t,n,e){var o,r,i=To({},e,(o=t,r={},st(n,function(t){r[t.name()]=t.handlers(o)}),r));return tu(i,ru)},uu=function(t){var n,i=et(n=t)?{can:Z(!0),abort:Z(!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)}},au=function(o,t,n){var r,e,i=t[n];return i?function(u,a,t,c){var n=o.slice(0);try{var e=n.sort(function(t,n){var e=t[a](),o=n[a](),r=c.indexOf(e),i=c.indexOf(o);if(-1===r)throw new Error("The ordering for "+u+" does not have an entry for "+e+".\nOrder specified: "+or(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+o+".\nOrder specified: "+or(c,null,2));return r<i?-1:i<r?1:0});return Lt.value(e)}catch(r){return Lt.error([r])}}("Event: "+n,"name",0,i).map(function(t){var n=ct(t,function(t){return t.handler()});return ui(n)}):(r=n,e=o,Lt.error(["The event ("+r+') 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: '+or(ct(e,function(t){return t.name()}),null,2)]))},cu=function(t,i){var n=Mt(t,function(o,r){return(1===o.length?Lt.value(o[0].handler()):au(o,i,r)).map(function(t){var n=uu(t),e=1<o.length?ft(i,function(n){return it(o,function(t){return t.name()===n})}).join(" > "):o[0].name();return $t(r,{handler:n,purpose:Z(e)})})});return Zt(n,{})},su=function(t){return kr("custom.definition",dr([br("dom","dom",Ao(),dr([Rr("tag"),Kr("styles",{}),Kr("classes",[]),Kr("attributes",{}),Wr("value"),Wr("innerHtml")])),Rr("components"),Rr("uid"),Kr("events",{}),Kr("apis",{}),br("eventOrder","eventOrder",(n={"alloy.execute":["disabling","alloy.base.behaviour","toggling","typeaheadevents"],"alloy.focus":["alloy.base.behaviour","focusing","keying"],"alloy.system.init":["alloy.base.behaviour","disabling","toggling","representing"],input:["alloy.base.behaviour","representing","streaming","invalidating"],"alloy.system.detached":["alloy.base.behaviour","representing","item-events","tooltipping"],mousedown:["focusing","alloy.base.behaviour","item-type-events"],mouseover:["item-type-events","tooltipping"]},Bo.mergeWithThunk(Z(n))),Dr()),Wr("domModification")]),t);var n},fu=function(t,n){var e=uo(t,n);return e===undefined||""===e?[]:e.split(" ")},lu=function(t){return t.dom().classList!==undefined},du=function(t,n){return r=n,i=fu(e=t,o="class").concat([r]),ro(e,o,i.join(" ")),!0;var e,o,r,i},mu=function(t,n){return r=n,0<(i=ft(fu(e=t,o="class"),function(t){return t!==r})).length?ro(e,o,i.join(" ")):co(e,o),!1;var e,o,r,i},gu=function(t,n){lu(t)?t.dom().classList.add(n):du(t,n)},pu=function(t){0===(lu(t)?t.dom().classList:fu(t,"class")).length&&co(t,"class")},hu=function(t,n){lu(t)?t.dom().classList.remove(n):mu(t,n),pu(t)},vu=function(t,n){return lu(t)&&t.dom().classList.contains(n)},bu=function(n,t){st(t,function(t){gu(n,t)})},yu=function(n,t){st(t,function(t){hu(n,t)})},xu=function(t){return t.style!==undefined},wu=function(t,n,e){if(!K(e))throw b.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);xu(t)&&t.style.setProperty(n,e)},Su=function(t,n){xu(t)&&t.style.removeProperty(n)},Cu=function(t,n,e){var o=t.dom();wu(o,n,e)},ku=function(t,n){var e=t.dom();Dt(n,function(t,n){wu(e,n,t)})},Ou=function(t,n){var e=t.dom(),o=b.window.getComputedStyle(e).getPropertyValue(n),r=""!==o||mi(t)?o:Eu(e,n);return null===r?undefined:r},Eu=function(t,n){return xu(t)?t.style.getPropertyValue(n):""},Tu=function(t,n){var e=t.dom(),o=Eu(e,n);return tt.from(o).filter(function(t){return 0<t.length})},Bu=function(t,n,e){var o=xe.fromTag(t);return Cu(o,n,e),Tu(o,n).isSome()},Du=function(t,n){var e=t.dom();Su(e,n),ao(t,"style")&&""===uo(t,"style").replace(/^\s+|\s+$/g,"")&&co(t,"style")},Au=function(t){return t.dom().offsetWidth},_u=function(t){return t.dom().value},Mu=function(t,n){if(n===undefined)throw new Error("Value.set was undefined");t.dom().value=n},Fu=function(t,n){return e=t,r=ct(o=n,function(t){return qr(t.name(),[Rr("config"),Kr("state",Qi)])}),i=kr("component.behaviours",dr(r),e.behaviours).fold(function(t){throw new Error(Tr(t)+"\nComplete spec:\n"+or(e,null,2))},function(t){return t}),{list:o,data:At(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},Iu=function(t){var n,e,o,r=(n=t,e=Kt("behaviours",{})(n),o=ft(Tt(e),function(t){return e[t]!==undefined}),ct(o,function(t){return e[t].me}));return Fu(t,r)},Vu=function(t,n,e){var o,r,i,u=To({},(o=t).dom,{uid:o.uid,domChildren:ct(o.components,function(t){return t.element()})}),a=t.domModification.fold(function(){return nu({})},nu),f={"alloy.base.modification":a};return i=0<n.length?function(n,t,e,o){var r=To({},f);st(e,function(t){r[t.name()]=t.exhibit(n,o)});var i=tu(r,function(t,n){return{name:t,modification:n}}),u=function(t){return lt(t,function(t,n){return To({},n.modification,t)},{})},a=lt(i.classes,function(t,n){return n.modification.concat(t)},[]),c=u(i.attributes),s=u(i.styles);return nu({classes:a,attributes:c,styles:s})}(e,0,n,u):a,To({},r=u,{attributes:To({},r.attributes,i.attributes),styles:To({},r.styles,i.styles),classes:r.classes.concat(i.classes)})},Ru=function(t,n,e){var o,r,i,u,a,c,s={"alloy.base.behaviour":(o=t,o.events)};return(r=e,i=t.eventOrder,u=n,a=s,c=iu(r,u,a),cu(c,i)).getOrDie()},Hu=function(e){var t=function(){return f},o=nn(Xi),n=Or(su(e)),r=Iu(e),i=r.list,u=r.data,a=function(t){var n=xe.fromTag(t.tag);io(n,t.attributes),bu(n,t.classes),ku(n,t.styles),t.innerHtml.each(function(t){return $e(n,t)});var e=t.domChildren;return Ye(n,e),t.value.each(function(t){Mu(n,t)}),t.uid,Li(n,t.uid),n}(Vu(n,i,u)),c=Ru(n,i,u),s=nn(n.components),f={getSystem:o.get,config:function(t){var n=u;return(et(n[t.name()])?n[t.name()]:function(){throw new Error("Could not find "+t.name()+" in "+or(e,null,2))})()},hasConfigured:function(t){return et(u[t.name()])},spec:Z(e),readState:function(t){return u[t]().map(function(t){return t.state.readState()}).getOr("not enabled")},getApis:function(){return n.apis},connect:function(t){o.set(t)},disconnect:function(){o.set(Gi(t))},element:Z(a),syncComponents:function(){var t=Le(a),n=bt(t,function(t){return o.get().getByDom(t).fold(function(){return[]},function(t){return[t]})});s.set(n)},components:s.get,events:Z(c)};return f},Nu=function(t){var n,e,o=Wi(t),r=o.events,i=v(o,["events"]),u=(n=i,e=Kt("components",[])(n),ct(e,ju)),a=To({},i,{events:To({},Ri,r),components:u});return Lt.value(Hu(a))},zu=function(t){var n=xe.fromText(t);return Pu({element:n})},Pu=function(t){var n=Er("external.component",lr([Rr("element"),Wr("uid")]),t),e=nn(Gi());n.uid.each(function(t){Li(n.element,t)});var o={getSystem:e.get,config:tt.none,hasConfigured:Z(!1),connect:function(t){e.set(t)},disconnect:function(){e.set(Gi(function(){return o}))},getApis:function(){return{}},element:Z(n.element),spec:Z(t),readState:Z("No state"),syncComponents:Q,components:Z([]),events:Z({})};return Ji(o)},Lu=Ui,ju=function(n){return(t=n,Jt(t,Ki)).fold(function(){var t=n.hasOwnProperty("uid")?n:To({uid:Lu("")},n);return Nu(t).getOrDie()},function(t){return t});var t},Uu=Ji,Wu=function(t,n,e){return hi(t,function(t){return Fe(t,n)},e)},Gu=function(t,n){return e=n,r=(o=t)===undefined?b.document:o.dom(),Ie(r)?tt.none():tt.from(r.querySelector(e)).map(xe.fromDom);var e,o,r},Xu=function(t,n,e){return o(Fe,Wu,t,n,e)},Yu=function(n,t){return(e=t,vi(e,function(t){if(!to(t))return!1;var n=uo(t,"id");return n!==undefined&&-1<n.indexOf("aria-owns")}).bind(function(t){var n=uo(t,"id"),e=He(t);return Gu(e,'[aria-owns="'+n+'"]')})).exists(function(t){return qu(n,t)});var e},qu=function(n,t){return e=t,r=Z(!(o=function(t){return Re(t,n.element())})),vi(e,o,r).isSome()||Yu(n,t);var e,o,r},Ku=Z([Rr("menu"),Rr("selectedMenu")]),Ju=Z([Rr("item"),Rr("selectedItem")]),$u=(Z(dr(Ju().concat(Ku()))),Z(dr(Ju()))),Qu=Lr("initSize",[Rr("numColumns"),Rr("numRows")]),Zu=function(){return Lr("markers",[Rr("backgroundMenu")].concat(Ku()).concat(Ju()))},ta=function(t){return Lr("markers",ct(t,Rr))},na=function(t,n,e){return function(){var t=new Error;if(t.stack!==undefined){var n=t.stack.split("\n");mt(n,function(n){return 0<n.indexOf("alloy")&&!ut(yo,function(t){return-1<n.indexOf(t)})}).getOr(mo)}}(),br(n,n,e,Sr(function(e){return Lt.value(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.apply(undefined,t)})}))},ea=function(t){return na(0,t,Do(Q))},oa=function(t){return na(0,t,Do(tt.none))},ra=function(t){return na(0,t,Ao())},ia=function(t){return na(0,t,Ao())},ua=function(t,n){return oi(t,Z(n))},aa=function(t){return oi(t,U)},ca=Z(Qu),sa=function(n,e,o){return Fi(function(t){o(t,n,e)})},fa=function(t,n,e,o,r,i){var u,a,c=lr(t),s=qr(n,[(u="config",a=t,br(u,u,_o(),lr(a)))]);return ma(c,s,n,e,o,r,i)},la=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:Z(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,o=(e=i.toString()).indexOf(")")+1,a=e.indexOf("("),c=e.substring(a+1,o-1).split(/,\s*/),t.toFunctionAnnotation=function(){return{name:n,parameters:Yi(c.slice(0,1).concat(c.slice(3)))}},t},da=function(t){return{key:t,value:undefined}},ma=function(e,t,o,r,n,i,u){var a=function(t){return tn(t,o)?t[o]():tt.none()},c=At(n,function(t,n){return la(o,t,n)}),s=At(i,function(t,n){return qi(t,n)}),f=To({},s,c,{revoke:h(da,o),config:function(t){var n=Er(o+"-config",e,t);return{key:o,value:{config:n,me:f,configAsRaw:Sn(function(){return Er(o+"-config",e,t)}),initialConfig:t,state:u}}},schema:function(){return t},exhibit:function(t,e){return a(t).bind(function(n){return Jt(r,"exhibit").map(function(t){return t(e,n.config,n.state)})}).getOr(nu({}))},name:function(){return o},handlers:function(t){return a(t).map(function(t){return Kt("events",function(){return{}})(r)(t.config,t.state)}).getOr({})}});return f},ga=function(t){return Qt(t)},pa=lr([Rr("fields"),Rr("name"),Kr("active",{}),Kr("apis",{}),Kr("state",Qi),Kr("extra",{})]),ha=function(t){var n=Er("Creating behaviour: "+t.name,pa,t);return fa(n.fields,n.name,n.active,n.apis,n.extra,n.state)},va=lr([Rr("branchKey"),Rr("branches"),Rr("name"),Kr("active",{}),Kr("apis",{}),Kr("state",Qi),Kr("extra",{})]),ba=function(t){var n,e,o,r,i,u,a,c,s=Er("Creating behaviour: "+t.name,va,t);return n=Br(s.branchKey,s.branches),e=s.name,o=s.active,r=s.apis,i=s.extra,u=s.state,c=qr(e,[Gr("config",a=n)]),ma(a,c,e,o,r,i,u)},ya=Z(undefined),xa=Object.freeze({events:function(o){return xi([Ci(Zn(),function(r,i){var t,n,u=o.channels,e=(t=Tt(u),(n=i).universal()?t:ft(t,function(t){return it(n.channels(),t)}));st(e,function(t){var n=u[t],e=n.schema,o=Er("channel["+t+"] data\nReceiver: "+lo(r.element()),e,i.data());n.onReceive(r,o)})})])}}),wa=[Hr("channels",Cr(Lt.value,lr([ra("onReceive"),Kr("schema",Dr())])))],Sa=ha({fields:wa,name:"receiving",active:xa}),Ca=Object.freeze({exhibit:function(t,n){return nu({classes:[],styles:n.useFixed?{}:{position:"relative"}})}}),ka=function(e,o){return{left:Z(e),top:Z(o),translate:function(t,n){return ka(e+t,o+n)}}},Oa=ka,Ea=function(t,n){return t!==undefined?t:n!==undefined?n:0},Ta=function(t){var n,e,o=t.dom().ownerDocument,r=o.body,i=(e=(n=xe.fromDom(o)).dom())===e.window&&n instanceof b.Window?n:eo(n)?e.defaultView||e.parentWindow:null,u=o.documentElement,a=Ea(i.pageYOffset,u.scrollTop),c=Ea(i.pageXOffset,u.scrollLeft),s=Ea(u.clientTop,r.clientTop),f=Ea(u.clientLeft,r.clientLeft);return Ba(t).translate(c-f,a-s)},Ba=function(t){var n,e,o,r=t.dom(),i=r.ownerDocument,u=i.body,a=xe.fromDom(i.documentElement);return u===r?Oa(u.offsetLeft,u.offsetTop):(n=t,e=a||xe.fromDom(b.document.documentElement),hi(n,h(Re,e)).isSome()?(o=r.getBoundingClientRect(),Oa(o.left,o.top)):Oa(0,0))},Da=(qn.detect().browser.isSafari(),function(t){var n=t!==undefined?t.dom():b.document,e=n.body.scrollLeft||n.documentElement.scrollLeft,o=n.body.scrollTop||n.documentElement.scrollTop;return Oa(e,o)}),Aa=t("width",function(t){return t.dom().offsetWidth}),_a=function(t){return Aa.get(t)},Ma=function(t){return Aa.getOuter(t)},Fa=t("height",function(t){var n=t.dom();return mi(t)?n.getBoundingClientRect().height:n.offsetHeight}),Ia=function(t){return Fa.get(t)},Va=function(t){return Fa.getOuter(t)},Ra=ke(["x","y","width","height","maxHeight","direction","classes","label","candidateYforTest"],[]),Ha=we("position","left","top","right","bottom"),Na=jt([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),za=Na.southeast,Pa=Na.southwest,La=Na.northeast,ja=Na.northwest,Ua=Na.south,Wa=Na.north,Ga=Na.east,Xa=Na.west,Ya=we("point","width","height"),qa=we("x","y","width","height"),Ka=function(t,n,e,o){return{x:Z(t),y:Z(n),width:Z(e),height:Z(o),right:Z(t+e),bottom:Z(n+o)}},Ja=function(t){var n=Ta(t),e=Ma(t),o=Va(t);return Ka(n.left(),n.top(),e,o)},$a=function(o,t){return o.view(t).fold(Z([]),function(t){var n=o.owner(t),e=$a(o,n);return[t].concat(e)})},Qa=Object.freeze({view:function(t){return(t.dom()===b.document?tt.none():tt.from(t.dom().defaultView.frameElement)).map(xe.fromDom)},owner:function(t){return He(t)}}),Za=function(o){var t,n,e,r,i=xe.fromDom(b.document),u=Da(i);return(t=o,e=(n=Qa).owner(t),r=$a(n,e),tt.some(r)).fold(h(Ta,o),function(t){var n=Ba(o),e=lt(t,function(t,n){var e=Ba(n);return{left:t.left+e.left(),top:t.top+e.top()}},{left:0,top:0});return Oa(e.left+n.left()+u.left(),e.top+n.top()+u.top())})},tc=function(){var t=b.window.innerWidth,n=b.window.innerHeight,e=xe.fromDom(b.document),o=Da(e);return Ka(o.left(),o.top(),t,n)},nc=jt([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),ec=function(t,n,e,o,r,i){var u,a,c,s,f,l,d,m,g=n.x()-e,p=n.y()-o,h=r-(g+n.width()),v=i-(p+n.height()),b=tt.some(g),y=tt.some(p),x=tt.some(h),w=tt.some(v),S=tt.none();return u=function(){return Ha(t,b,y,S,S)},a=function(){return Ha(t,S,y,x,S)},c=function(){return Ha(t,b,S,S,w)},s=function(){return Ha(t,S,S,x,w)},f=function(){return Ha(t,b,y,S,S)},l=function(){return Ha(t,b,S,S,w)},d=function(){return Ha(t,b,y,S,S)},m=function(){return Ha(t,S,y,x,S)},n.direction().fold(u,a,c,s,f,l,d,m)},oc=function(t,n){var e=h(Za,n),o=t.fold(e,e,function(){var t=Da();return Za(n).translate(-t.left(),-t.top())}),r=Ma(n),i=Va(n);return Ka(o.left(),o.top(),r,i)},rc=nc.relative,ic=nc.fixed,uc=we("anchorBox","origin"),ac=jt([{fit:["reposition"]},{nofit:["reposition","deltaW","deltaH"]}]),cc=function(t,H,N,z,P){var L=N.width(),j=N.height(),o=function(t,o,r,i){var n,e,u,a,c,s,f,l,d,m,g,p,h,v,b,y,x,w,S,C,k,O,E,T,B,D,A,_,M,F,I,V,R=t(H,N,z);return(e=L,u=j,a=P,d=(n=R).x(),m=n.y(),g=n.bubble().offset().left(),p=n.bubble().offset().top(),h=a.x(),v=a.y(),b=a.width(),y=a.height(),C=v<=(w=m+p),k=(S=h<=(x=d+g))&&C,O=x+e<=h+b&&w+u<=v+y,E=S?Math.min(e,h+b-x):Math.abs(h-(x+e)),T=C?Math.min(u,v+y-w):Math.abs(v-(w+u)),B=a.x()+a.width(),D=Math.max(a.x(),x),A=Math.min(D,B),M=Z((_=C?w:w+(u-T))+T-v),F=Z(v+y-_),c=n.direction(),f=s=F,l=M,I=c.fold(s,s,l,l,s,l,f,f),V=Ra({x:A,y:_,width:E,height:T,maxHeight:I,direction:n.direction(),classes:{on:n.bubble().classesOn(),off:n.bubble().classesOff()},label:n.label(),candidateYforTest:w}),k&&O?ac.fit(V):ac.nofit(V,E,T)).fold(ac.fit,function(t,n,e){return i<e||r<n?ac.nofit(t,n,e):ac.nofit(o,r,i)})};return dt(t,function(t,n){var e=h(o,n);return t.fold(ac.fit,e)},ac.nofit(Ra({x:H.x(),y:H.y(),width:N.width(),height:N.height(),maxHeight:N.height(),direction:za(),classes:[],label:"none",candidateYforTest:H.y()}),-1,-1)).fold(U,U)},sc=function(t,n,e,o){Du(n,"max-height");var r,i={width:Z(Ma(r=n)),height:Z(Va(r))};return cc(o.preference(),t,i,e,o.bounds())},fc=function(t,n,e){var o,r,i,u,a,c=function(t){return t+"px"},s=(o=e.origin(),r=n,o.fold(function(){return Ha("absolute",tt.some(r.x()),tt.some(r.y()),tt.none(),tt.none())},function(t,n,e,o){return ec("absolute",r,t,n,e,o)},function(t,n,e,o){return ec("fixed",r,t,n,e,o)}));i=t,u={position:tt.some(s.position()),left:s.left().map(c),top:s.top().map(c),right:s.right().map(c),bottom:s.bottom().map(c)},a=i.dom(),Dt(u,function(t,n){t.fold(function(){Su(a,n)},function(t){wu(a,n,t)})})},lc=function(t,n){var e,o,r;e=t,o=Math.floor(n),r=Fa.max(e,o,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]),Cu(e,"max-height",r+"px")},dc=Z(function(t,n){lc(t,n),ku(t,{"overflow-x":"hidden","overflow-y":"auto"})}),mc=Z(function(t,n){lc(t,n)}),gc=ke(["bounds","origin","preference","maxHeightFunction"],[]),pc=function(t,n,e,o,r,i){var u,a,c,s,f,l=(u=i,a="maxHeightFunction",c=dc(),u[a]===undefined?c:u[a]),d=t.anchorBox(),m=t.origin(),g=gc({bounds:(s=m,f=r,f.fold(function(){return s.fold(tc,tc,Ka)},function(t){return s.fold(t,t,Ka)})),origin:m,preference:o,maxHeightFunction:l});hc(d,n,e,g)},hc=function(t,n,e,o){var r,i,u,a,c=sc(t,n,e,o);fc(n,c,o),r=n,i=c.classes(),yu(r,i.off),bu(r,i.on),u=n,a=c,o.maxHeightFunction()(u,a.maxHeight())},vc=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right"],bc=function(t,n,e){var r=function(t){return Jt(e,t).getOr([])},o=function(t,n,e){var o=St(vc,e);return{offset:function(){return Oa(t,n)},classesOn:function(){return bt(e,r)},classesOff:function(){return bt(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"])}}},yc=function(){return bc(0,0,{})},xc=we("x","y","bubble","direction","label"),wc=function(t){return t.x()},Sc=function(t,n){return t.x()+t.width()/2-n.width()/2},Cc=function(t,n){return t.x()+t.width()-n.width()},kc=function(t,n){return t.y()-n.height()},Oc=function(t){return t.y()+t.height()},Ec=function(t,n){return t.y()+t.height()/2-n.height()/2},Tc=function(t,n,e){return xc(wc(t),Oc(t),e.southeast(),za(),"layout-se")},Bc=function(t,n,e){return xc(Cc(t,n),Oc(t),e.southwest(),Pa(),"layout-sw")},Dc=function(t,n,e){return xc(wc(t),kc(t,n),e.northeast(),La(),"layout-ne")},Ac=function(t,n,e){return xc(Cc(t,n),kc(t,n),e.northwest(),ja(),"layout-nw")},_c=function(t,n,e){return xc(Sc(t,n),kc(t,n),e.north(),Wa(),"layout-n")},Mc=function(t,n,e){return xc(Sc(t,n),Oc(t),e.south(),Ua(),"layout-s")},Fc=function(t,n,e){return xc((o=t).x()+o.width(),Ec(t,n),e.east(),Ga(),"layout-e");var o},Ic=function(t,n,e){return xc((o=n,t.x()-o.width()),Ec(t,n),e.west(),Xa(),"layout-w");var o},Vc=function(){return[Tc,Bc,Dc,Ac,Mc,_c,Fc,Ic]},Rc=function(){return[Bc,Tc,Ac,Dc,Mc,_c,Fc,Ic]},Hc=function(t){return t},Nc=function(n,e){return function(t){return"rtl"===zc(t)?e:n}},zc=function(t){return"rtl"===Ou(t,"direction")?"rtl":"ltr"},Pc=function(){return qr("layouts",[Rr("onLtr"),Rr("onRtl")])},Lc=function(n,t,e,o){var r=t.layouts.map(function(t){return t.onLtr(n)}).getOr(e),i=t.layouts.map(function(t){return t.onRtl(n)}).getOr(o);return Nc(r,i)(n)},jc=[Rr("hotspot"),Wr("bubble"),Pc(),ua("placement",function(t,n,e){var o=n.hotspot,r=oc(e,o.element()),i=Lc(t.element(),n,Vc(),Rc());return tt.some(Hc({anchorBox:r,bubble:n.bubble.getOr(yc()),overrides:{},layouts:i,placer:tt.none()}))})],Uc=[Rr("x"),Rr("y"),Kr("height",0),Kr("width",0),Kr("bubble",yc()),Pc(),ua("placement",function(t,n){var e=Ka(n.x,n.y,n.width,n.height),o=Lc(t.element(),n,Vc(),Rc());return tt.some(Hc({anchorBox:e,bubble:n.bubble,overrides:{},layouts:o,placer:tt.none()}))})],Wc=(jt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),jt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}])),Gc=we("start","soffset","finish","foffset"),Xc=(Wc.domRange,Wc.relative,Wc.exact),Yc=function(t,n,e,o){var r,i,u,a,c,s=(i=n,u=e,a=o,(c=He(r=t).dom().createRange()).setStart(r.dom(),i),c.setEnd(u.dom(),a),c),f=Re(t,e)&&n===o;return s.collapsed&&!f},qc=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},Kc=function(t,n,e,o,r){var i=t.document.createRange();return i.setStart(n.dom(),e),i.setEnd(o.dom(),r),i},Jc=function(t){return{left:Z(t.left),top:Z(t.top),right:Z(t.right),bottom:Z(t.bottom),width:Z(t.width),height:Z(t.height)}},$c=jt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Qc=function(t,n,e){return n(xe.fromDom(e.startContainer),e.startOffset,xe.fromDom(e.endContainer),e.endOffset)},Zc=function(t,n){var r,e,o,i=(r=t,n.match({domRange:function(t){return{ltr:Z(t),rtl:tt.none}},relative:function(t,n){return{ltr:Sn(function(){return qc(r,t,n)}),rtl:Sn(function(){return tt.some(qc(r,n,t))})}},exact:function(t,n,e,o){return{ltr:Sn(function(){return Kc(r,t,n,e,o)}),rtl:Sn(function(){return tt.some(Kc(r,e,o,t,n))})}}}));return(o=(e=i).ltr()).collapsed?e.rtl().filter(function(t){return!1===t.collapsed}).map(function(t){return $c.rtl(xe.fromDom(t.endContainer),t.endOffset,xe.fromDom(t.startContainer),t.startOffset)}).getOrThunk(function(){return Qc(0,$c.ltr,o)}):Qc(0,$c.ltr,o)},ts=function YD(e,o){var n=function(t){return e(t)?tt.from(t.dom().nodeValue):tt.none()},t=qn.detect().browser,r=t.isIE()&&10===t.version.major?function(t){try{return n(t)}catch(r){return tt.none()}}:n;return{get:function(t){if(!e(t))throw new Error("Can only get "+o+" value of a "+o+" node");return r(t).getOr("")},getOption:r,set:function(t,n){if(!e(t))throw new Error("Can only set raw "+o+" value of a "+o+" node");t.dom().nodeValue=n}}}(no,"text"),ns=function(t){return ts.get(t)},es=(document.caretPositionFromPoint||document.caretRangeFromPoint,function(t,n){return Ve(n,t)}),os=function(t){var n=xe.fromDom(t.anchorNode),e=xe.fromDom(t.focusNode);return Yc(n,t.anchorOffset,e,t.focusOffset)?tt.some(Gc(n,t.anchorOffset,e,t.focusOffset)):function(t){if(0<t.rangeCount){var n=t.getRangeAt(0),e=t.getRangeAt(t.rangeCount-1);return tt.some(Gc(xe.fromDom(n.startContainer),n.startOffset,xe.fromDom(e.endContainer),e.endOffset))}return tt.none()}(t)},rs=function(t,n){var i,e,o,r;return 0<(r=0<(o=(e=Zc(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}})).getClientRects()).length?o[0]:e.getBoundingClientRect()).width||0<r.height?tt.some(r).map(Jc):tt.none()},is=we("element","offset"),us=jt([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),as=function(t){return t.fold(function(t){return t},function(t,n,e){return t.translate(-n,-e)})},cs=function(t){return t.fold(function(t){return t},function(t){return t})},ss=function(t){return dt(t,function(t,n){return t.translate(n.left(),n.top())},Oa(0,0))},fs=function(t){var n=ct(t,cs);return ss(n)},ls=us.screen,ds=us.absolute,ms=function(t,n,e){var o,r,i,u=He(t.element()),a=Da(u),c=(o=t,r=e,i=Ne(r.root).dom(),tt.from(i.frameElement).map(xe.fromDom).filter(function(t){var n=He(t),e=He(o.element());return Re(n,e)}).map(Ta)).getOr(a);return ds(c,a.left(),a.top())},gs=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=ls(Oa(r,i));return tt.some(Ya(c,u,a))},ps=function(t,c,s,f,l){return t.map(function(t){var n,e,o,r=[c,t.point()],i=(n=function(){return fs(r)},e=function(){return fs(r)},o=function(){return t=ct(r,as),ss(t);var t},f.fold(n,e,o)),u=qa(i.left(),i.top(),t.width(),t.height()),a=Lc(l,s,s.showAbove?[Dc,Ac,Tc,Bc,_c,Mc]:[Tc,Bc,Dc,Ac,Mc,Mc],s.showAbove?[Ac,Dc,Bc,Tc,_c,Mc]:[Bc,Tc,Ac,Dc,Mc,_c]);return Hc({anchorBox:u,bubble:s.bubble.getOr(yc()),overrides:s.overrides,layouts:a,placer:tt.none()})})},hs=we("element","offset"),vs=function(t,n){return no(t)?hs(t,n):function(t,n){var e=Le(t);if(0===e.length)return is(t,n);if(n<e.length)return is(e[n],0);var o=e[e.length-1],r=no(o)?ns(o).length:Le(o).length;return is(o,r)}(t,n)},bs=function(n,t){return t.getSelection.getOrThunk(function(){return function(){return t=n,tt.from(t.getSelection()).filter(function(t){return 0<t.rangeCount}).bind(os);var t}})().map(function(t){var n=vs(t.start(),t.soffset()),e=vs(t.finish(),t.foffset());return Gc(n.element(),n.offset(),e.element(),e.offset())})},ys=[Wr("getSelection"),Rr("root"),Wr("bubble"),Pc(),Kr("overrides",{}),Kr("showAbove",!1),ua("placement",function(t,n,e){var o=Ne(n.root).dom(),r=ms(t,0,n),i=bs(o,n).bind(function(t){var n;return rs(o,(n=t,Wc.exact(n.start(),n.soffset(),n.finish(),n.foffset()))).orThunk(function(){var n=xe.fromText("\ufeff");return Ue(t.start(),n),rs(o,Xc(n,0,n,1)).map(function(t){return Ke(n),t})}).bind(function(t){return gs(t.left(),t.top(),t.width(),t.height())})}),u=bs(o,n).bind(function(t){return to(t.start())?tt.some(t.start()):ze(t.start())}).getOr(t.element());return ps(i,r,n,e,u)})],xs=[Rr("node"),Rr("root"),Wr("bubble"),Pc(),Kr("overrides",{}),Kr("showAbove",!1),ua("placement",function(r,i,u){var a=ms(r,0,i);return i.node.bind(function(t){var n=t.dom().getBoundingClientRect(),e=gs(n.left,n.top,n.width,n.height),o=i.node.getOr(r.element());return ps(e,a,i,u,o)})})],ws=function(t){return t.x()+t.width()},Ss=function(t,n){return t.x()-n.width()},Cs=function(t,n){return t.y()-n.height()+t.height()},ks=function(t){return t.y()},Os=function(t,n,e){return xc(ws(t),ks(t),e.southeast(),za(),"link-layout-se")},Es=function(t,n,e){return xc(Ss(t,n),ks(t),e.southwest(),Pa(),"link-layout-sw")},Ts=function(t,n,e){return xc(ws(t),Cs(t,n),e.northeast(),La(),"link-layout-ne")},Bs=function(t,n,e){return xc(Ss(t,n),Cs(t,n),e.northwest(),ja(),"link-layout-nw")},Ds=[Rr("item"),Pc(),ua("placement",function(t,n,e){var o=oc(e,n.item.element()),r=Lc(t.element(),n,[Os,Es,Ts,Bs],[Es,Os,Bs,Ts]);return tt.some(Hc({anchorBox:o,bubble:yc(),overrides:{},layouts:r,placer:tt.none()}))})],As=Br("anchor",{selection:ys,node:xs,hotspot:jc,submenu:Ds,makeshift:Uc}),_s=function(t,n,e,o,r){var i,u=(i=e.anchorBox,uc(i,n));pc(u,r.element(),e.bubble,e.layouts,o,e.overrides)},Ms=function(n,t,e,o,r,i){var u=Er("positioning anchor.info",As,o);Cu(r.element(),"position","fixed");var a=Tu(r.element(),"visibility");Cu(r.element(),"visibility","hidden");var c,s,f,l=t.useFixed?ic(0,0,b.window.innerWidth,b.window.innerHeight):(s=Ta((c=n).element()),f=c.element().dom().getBoundingClientRect(),rc(s.left(),s.top(),f.width,f.height)),d=u.placement,m=i.map(function(t){return function(){return Ja(t)}}).or(t.getBounds);d(n,u,l).each(function(t){t.placer.getOr(_s)(n,l,t,m,r)}),a.fold(function(){Du(r.element(),"visibility")},function(t){Cu(r.element(),"visibility",t)}),Tu(r.element(),"left").isNone()&&Tu(r.element(),"top").isNone()&&Tu(r.element(),"right").isNone()&&Tu(r.element(),"bottom").isNone()&&Tu(r.element(),"position").is("fixed")&&Du(r.element(),"position")},Fs=Object.freeze({position:function(t,n,e,o,r){var i=tt.none();Ms(t,n,e,o,r,i)},positionWithin:Ms,getMode:function(t,n){return n.useFixed?"fixed":"absolute"}}),Is=[Kr("useFixed",!1),Wr("getBounds")],Vs=ha({fields:Is,name:"positioning",active:Ca,apis:Fs}),Rs=function(t){ai(t,le());var n=t.components();st(n,Rs)},Hs=function(t){var n=t.components();st(n,Hs),ai(t,fe())},Ns=function(t,n){zs(t,n,Xe)},zs=function(t,n,e){t.getSystem().addToWorld(n),e(t.element(),n.element()),mi(t.element())&&Hs(n),t.syncComponents()},Ps=function(t){Rs(t),Ke(t.element()),t.getSystem().removeFromWorld(t)},Ls=function(n){var t=ze(n.element()).bind(function(t){return n.getSystem().getByDom(t).fold(tt.none,tt.some)});Ps(n),t.each(function(t){t.syncComponents()})},js=function(t){var n=t.components();st(n,Ps),qe(t.element()),t.syncComponents()},Us=function(t,n){Ws(t,n,Xe)},Ws=function(t,n,e){e(t,n.element());var o=Le(n.element());st(o,function(t){n.getByDom(t).each(Hs)})},Gs=function(n){var t=Le(n.element());st(t,function(t){n.getByDom(t).each(Rs)}),Ke(n.element())},Xs=function(t,n,e,o){var r=function(t,n,e,o){e.get().each(function(){js(t)});var r=n.getAttachPoint(t);Ns(r,t);var i=t.getSystem().build(o);return Ns(t,i),e.set(i),i}(t,n,e,o);return n.onOpen(t,r),r},Ys=function(n,e,o){o.get().each(function(t){js(n),Ls(n),e.onClose(n,t),o.clear()})},qs=function(t,n,e){return e.isOpen()},Ks=function(t,n){var e,o,r,i,u=n.getAttachPoint(t);Cu(t.element(),"position",Vs.getMode(u)),e=t,o="visibility",r=n.cloakVisibilityAttr,i="hidden",Tu(e.element(),o).fold(function(){co(e.element(),r)},function(t){ro(e.element(),r,t)}),Cu(e.element(),o,i)},Js=function(t,n){var e;e=t.element(),ut(["top","left","right","bottom"],function(t){return Tu(e,t).isSome()})||Du(t.element(),"position"),function(t,n,e){if(ao(t.element(),e)){var o=uo(t.element(),e);Cu(t.element(),n,o)}else Du(t.element(),n)}(t,"visibility",n.cloakVisibilityAttr)},$s=Object.freeze({cloak:Ks,decloak:Js,open:Xs,openWhileCloaked:function(t,n,e,o,r){Ks(t,n,e),Xs(t,n,e,o),r(),Js(t,n,e)},close:Ys,isOpen:qs,isPartOf:function(n,e,t,o){return qs(0,0,t)&&t.get().exists(function(t){return e.isPartOf(n,t,o)})},getState:function(t,n,e){return e.get()}}),Qs=Object.freeze({events:function(n,e){return xi([Ci(ie(),function(t){Ys(t,n,e)})])}}),Zs=[ea("onOpen"),ea("onClose"),Rr("isPartOf"),Rr("getAttachPoint"),Kr("cloakVisibilityAttr","data-precloak-visibility")],tf=ha({fields:Zs,name:"sandboxing",active:Qs,apis:$s,state:Object.freeze({init:function(){var n=nn(tt.none()),t=Z("not-implemented");return Zi({readState:t,isOpen:function(){return n.get().isSome()},clear:function(){n.set(tt.none())},set:function(t){n.set(tt.some(t))},get:function(){return n.get()}})}})}),nf=Z("dismiss.popups"),ef=Z("mouse.released"),of=lr([Kr("isExtraPart",Z(!1)),qr("fireEventInstead",[Kr("event",de())])]),rf=function(t){var n=uf(t);return Sa.config(n)},uf=function(t){var e=Er("Dismissal",of,t);return{channels:$t(nf(),{schema:lr([Rr("target")]),onReceive:function(n,t){tf.isOpen(n)&&(tf.isPartOf(n,t.target)||e.isExtraPart(n,t.target)||e.fireEventInstead.fold(function(){return tf.close(n)},function(t){return ai(n,t.event)}))}})}},af=function(o,t){return ei(o,{},ct(t,function(t){return n=t.name(),e="Cannot configure "+t.name()+" for "+o,br(n,n,_o(),fr(function(){return Xo("The field: "+n+" is forbidden. "+e)}));var n,e}).concat([oi("dump",U)]))},cf=function(t){return t.dump},sf=function(t,n){return To({},t.dump,ga(n))},ff=af,lf=sf,df="placeholder",mf=jt([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),gf=function(t,n,e,o){return e.uiType===df?(i=e,u=o,(r=t).exists(function(t){return t!==i.owner})?mf.single(!0,Z(i)):Jt(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+Tt(u)+"]\nNamespace: "+r.getOr("none")+"\nSpec: "+or(i,null,2))},function(t){return t.replace()})):mf.single(!1,Z(e));var r,i,u},pf=function(i,u,a,c){return gf(i,0,a,c).fold(function(t,n){var e=n(u,a.config,a.validated),o=Jt(e,"components").getOr([]),r=bt(o,function(t){return pf(i,u,t,c)});return[To({},e,{components:r})]},function(t,n){var e=n(u,a.config,a.validated);return a.validated.preprocess.getOr(U)(e)})},hf=function(n,e,t,o){var r,i,u,a=At(o,function(t,n){return o=t,r=!1,{name:Z(e=n),required:function(){return o.fold(function(t){return t},function(t){return t})},used:function(){return r},replace:function(){if(!0===r)throw new Error("Trying to use the same placeholder more than once: "+e);return r=!0,o}};var e,o,r}),c=(r=n,i=e,u=a,bt(t,function(t){return pf(r,i,t,u)}));return Dt(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: "+or(e.components,null,2))}),c},vf=mf.single,bf=mf.multiple,yf=Z(df),xf=jt([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),wf=Kr("factory",{sketch:U}),Sf=Kr("schema",[]),Cf=Rr("name"),kf=br("pname","pname",Mo(function(t){return"<alloy."+Oo(t.name)+">"}),Dr()),Of=oi("schema",function(){return[Wr("preprocess")]}),Ef=Kr("defaults",Z({})),Tf=Kr("overrides",Z({})),Bf=dr([wf,Sf,Cf,kf,Ef,Tf]),Df=dr([wf,Sf,Cf,Ef,Tf]),Af=dr([wf,Sf,Cf,kf,Ef,Tf]),_f=dr([wf,Of,Cf,Rr("unit"),kf,Ef,Tf]),Mf=function(t){return t.fold(tt.some,tt.none,tt.some,tt.some)},Ff=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},If=function(e,o){return function(t){var n=Er("Converting part type",o,t);return e(n)}},Vf=If(xf.required,Bf),Rf=If(xf.external,Df),Hf=If(xf.optional,Af),Nf=If(xf.group,_f),zf=Z("entirety"),Pf=Object.freeze({required:Vf,external:Rf,optional:Hf,group:Nf,asNamedPart:Mf,name:Ff,asCommon:function(t){return t.fold(U,U,U,U)},original:zf}),Lf=function(t,n,e,o){return Gt(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},jf=function(r,t){var n={};return st(t,function(t){Mf(t).each(function(e){var o=Uf(r,e.pname);n[e.name]=function(t){var n=Er("Part: "+e.name+" in "+r,dr(e.schema),t);return To({},o,{config:t,validated:n})}})}),n},Uf=function(t,n){return{uiType:yf(),owner:t,name:n}},Wf=function(t,n,e){return{uiType:yf(),owner:t,name:n,config:e,validated:{}}},Gf=function(t){return bt(t,function(t){return t.fold(tt.none,tt.some,tt.none,tt.none).map(function(t){return Lr(t.name,t.schema.concat([aa(zf())]))}).toArray()})},Xf=function(t){return ct(t,Ff)},Yf=function(t,n,e){return o=n,i={},r={},st(e,function(t){t.fold(function(o){i[o.pname]=vf(!0,function(t,n,e){return o.factory.sketch(Lf(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=Z(t.factory.sketch(Lf(o,t,n[zf()]),n))},function(o){i[o.pname]=vf(!1,function(t,n,e){return o.factory.sketch(Lf(t,o,n,e))})},function(r){i[r.pname]=bf(!0,function(n,t,e){var o=n[r.name];return ct(o,function(t){return r.factory.sketch(Gt(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:Z(i),externals:Z(r)};var o,i,r},qf=function(t,n,e){return hf(tt.some(t),n,n.components,e)},Kf=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},Jf=function(t,n,e){return Kf(t,n,e).getOrDie("Could not find part: "+e)},$f=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return st(e,function(t){o[t]=i.getByUid(r[t])}),At(o,Z)},Qf=function(t,n){var e=t.getSystem();return At(n.partUids,function(t){return Z(e.getByUid(t))})},Zf=function(t){return Tt(t.partUids)},tl=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return st(e,function(t){o[t]=i.getByUid(r[t]).getOrDie()}),At(o,Z)},nl=function(n,t){var e=Xf(t);return Qt(ct(e,function(t){return{key:t,value:n+"-"+t}}))},el=function(n){return br("partUids","partUids",Fo(function(t){return nl(t.uid,n)}),Dr())},ol=Object.freeze({generate:jf,generateOne:Wf,schemas:Gf,names:Xf,substitutes:Yf,components:qf,defaultUids:nl,defaultUidsSchema:el,getAllParts:Qf,getAllPartNames:Zf,getPart:Kf,getPartOrDie:Jf,getParts:$f,getPartsOrDie:tl}),rl=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[Lr("parts",i)]:[]).concat([Rr("uid"),Kr("dom",{}),Kr("components",[]),aa("originalSpec"),Kr("debug.sketcher",{})]).concat(u));return Er(t+" [SpecSchema]",lr(a.concat(n)),e)},il=function(t,n,e,o,r){var i=ul(r),u=Gf(e),a=el(e),c=rl(t,n,i,u,[a]),s=Yf(0,c,e);return o(c,qf(t,c,s.internals()),i,s.externals())},ul=function(t){return t.hasOwnProperty("uid")?t:To({},t,{uid:Ui("uid")})},al=lr([Rr("name"),Rr("factory"),Rr("configFields"),Kr("apis",{}),Kr("extraApis",{})]),cl=lr([Rr("name"),Rr("factory"),Rr("configFields"),Rr("partFields"),Kr("apis",{}),Kr("extraApis",{})]),sl=function(t){var i=Er("Sketcher for "+t.name,al,t),n=At(i.apis,$i),e=At(i.extraApis,function(t,n){return qi(t,n)});return To({name:Z(i.name),partFields:Z([]),configFields:Z(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=ul(t),o(rl(n,e,r,[],[]),r);var n,e,o,r}},n,e)},fl=function(t){var n=Er("Sketcher for "+t.name,cl,t),e=jf(n.name,n.partFields),o=At(n.apis,$i),r=At(n.extraApis,function(t,n){return qi(t,n)});return To({name:Z(n.name),partFields:Z(n.partFields),configFields:Z(n.configFields),sketch:function(t){return il(n.name,n.configFields,n.partFields,n.factory,t)},parts:Z(e)},o,r)},ll=function(t){return"input"===Qe(t)&&"radio"!==uo(t,"type")||"textarea"===Qe(t)},dl=Object.freeze({getCurrent:function(t,n){return n.find(t)}}),ml=[Rr("find")],gl=ha({fields:ml,name:"composing",apis:dl}),pl=function(t,n,e,o){var r=t+n;return o<r?e:r<e?o:r},hl=function(t,n,e){return t<=n?n:e<=t?e:t},vl=function(e,o,t,r){var n=es(e.element(),"."+o.highlightClass);st(n,function(n){ut(r,function(t){return t.element()===n})||(hu(n,o.highlightClass),e.getSystem().getByDom(n).each(function(t){o.onDehighlight(e,t),ai(t,be())}))})},bl=function(t,n,e,o){vl(t,n,0,[o]),yl(t,n,e,o)||(gu(o.element(),n.highlightClass),n.onHighlight(t,o),ai(o,ve()))},yl=function(t,n,e,o){return vu(o.element(),n.highlightClass)},xl=function(t,n,e,o){var r=es(t.element(),"."+n.itemClass);return tt.from(r[o]).fold(function(){return Lt.error("No element found with index "+o)},t.getSystem().getByDom)},wl=function(n,t){return Gu(n.element(),"."+t.itemClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},Sl=function(n,t){var e=es(n.element(),"."+t.itemClass);return(0<e.length?tt.some(e[e.length-1]):tt.none()).bind(function(t){return n.getSystem().getByDom(t).toOption()})},Cl=function(e,n,t,o){var r=es(e.element(),"."+n.itemClass);return gt(r,function(t){return vu(t,n.highlightClass)}).bind(function(t){var n=pl(t,o,0,r.length-1);return e.getSystem().getByDom(r[n]).toOption()})},kl=function(n,t){var e=es(n.element(),"."+t.itemClass);return en(ct(e,function(t){return n.getSystem().getByDom(t).toOption()}))},Ol=Object.freeze({dehighlightAll:function(t,n){return vl(t,n,0,[])},dehighlight:function(t,n,e,o){yl(t,n,e,o)&&(hu(o.element(),n.highlightClass),n.onDehighlight(t,o),ai(o,be()))},highlight:bl,highlightFirst:function(n,e,o){wl(n,e,o).each(function(t){bl(n,e,o,t)})},highlightLast:function(n,e,o){Sl(n,e,o).each(function(t){bl(n,e,o,t)})},highlightAt:function(n,e,o,t){xl(n,e,o,t).fold(function(t){throw new Error(t)},function(t){bl(n,e,o,t)})},highlightBy:function(n,e,o,t){var r=kl(n,e,o);mt(r,t).each(function(t){bl(n,e,o,t)})},isHighlighted:yl,getHighlighted:function(n,t){return Gu(n.element(),"."+t.highlightClass).bind(function(t){return n.getSystem().getByDom(t).toOption()})},getFirst:wl,getLast:Sl,getPrevious:function(t,n){return Cl(t,n,0,-1)},getNext:function(t,n){return Cl(t,n,0,1)},getCandidates:kl}),El=[Rr("highlightClass"),Rr("itemClass"),ea("onHighlight"),ea("onDehighlight")],Tl=ha({fields:El,name:"highlighting",apis:Ol}),Bl=function(t,n,e){var o=wt(t.slice(0,n)),r=wt(t.slice(n+1));return mt(o.concat(r),e)},Dl=function(t,n,e){var o=wt(t.slice(0,n));return mt(o,e)},Al=function(t,n,e){var o=t.slice(0,n),r=t.slice(n+1);return mt(r.concat(o),e)},_l=function(t,n,e){var o=t.slice(n+1);return mt(o,e)},Ml=function(e){return function(t){var n=t.raw();return it(e,n.which)}},Fl=function(t){return function(n){return yt(t,function(t){return t(n)})}},Il=function(t){return!0===t.raw().shiftKey},Vl=function(t){return!0===t.raw().ctrlKey},Rl=N(Il),Hl=function(t,n){return{matches:t,classification:n}},Nl=function(t){t.dom().focus()},zl=function(t){var n=t!==undefined?t.dom():b.document;return tt.from(n.activeElement).map(xe.fromDom)},Pl=function(n){return zl(He(n)).filter(function(t){return n.dom().contains(t.dom())})},Ll=function(t,n,e){n.exists(function(n){return e.exists(function(t){return Re(t,n)})})||ci(t,me(),{prevFocus:n,newFocus:e})},jl=function(){var r=function(t){return Pl(t.element())};return{get:r,set:function(t,n){var e=r(t);t.getSystem().triggerFocus(n,t.element());var o=r(t);Ll(t,e,o)}}},Ul=function(){var r=function(t){return Tl.getHighlighted(t).map(function(t){return t.element()})};return{get:r,set:function(n,t){var e=r(n);n.getSystem().getByDom(t).fold(Q,function(t){Tl.highlight(n,t)});var o=r(n);Ll(n,e,o)}}};(No=Ho||(Ho={})).OnFocusMode="onFocus",No.OnEnterOrSpaceMode="onEnterOrSpace",No.OnApiMode="onApi";var Wl,Gl,Xl=function(t,n,e,o,a){var c=function(n,e,t,o,r){var i,u;return(i=t(n,e,o,r),u=e.event(),mt(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([Kr("focusManager",jl()),Jr("focusInside","onFocus",Sr(function(t){return it(["onFocus","onEnterOrSpace","onApi"],t)?Lt.value(t):Lt.error("Invalid value for focusInside")})),ua("handler",r),ua("state",n),ua("sendFocusIn",a)])},processKey:c,toEvents:function(i,u){var t=i.focusInside!==Ho.OnFocusMode?tt.none():a(i).map(function(e){return Ci(Jn(),function(t,n){e(t,i,u),n.stop()})});return xi(t.toArray().concat([Ci(pn(),function(o,r){c(o,r,e,i,u).fold(function(){var n,e,t;n=o,e=r,t=Ml([32].concat([13]))(e.event()),i.focusInside===Ho.OnEnterOrSpaceMode&&t&&ri(n,e)&&a(i).each(function(t){t(n,i,u),e.stop()})},function(){r.stop()})}),Ci(hn(),function(t,n){c(t,n,o,i,u).each(function(){n.stop()})})]))}};return r},Yl=function(t){var n=[Wr("onEscape"),Wr("onEnter"),Kr("selector",'[data-alloy-tabstop="true"]'),Kr("firstTabstop",0),Kr("useTabstopAt",Z(!0)),Wr("visibilitySelector")].concat([t]),u=function(t,n){var e=t.visibilitySelector.bind(function(t){return Xu(n,t)}).getOr(n);return 0<Ia(e)},e=function(n,e){var t,o,r,i;(t=n,o=e,r=es(t.element(),o.selector),i=ft(r,function(t){return u(o,t)}),tt.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?tt.some(!0):tt.none()},function(t){return o.focusManager.set(n,t),tt.some(!0)})},r=function(n,t,e,o){var r,i,u=es(n.element(),e.selector);return(r=n,i=e,i.focusManager.get(r).bind(function(t){return Xu(t,i.selector)})).bind(function(t){return gt(u,h(Re,t)).bind(function(t){return a(n,u,t,e,o)})})},o=Z([Hl(Fl([Il,Ml([9])]),function(t,n,e){var o=e.cyclic?Bl:Dl;return r(t,0,e,o)}),Hl(Ml([9]),function(t,n,e){var o=e.cyclic?Al:_l;return r(t,0,e,o)}),Hl(Ml([27]),function(n,e,t){return t.onEscape.bind(function(t){return t(n,e)})}),Hl(Fl([Rl,Ml([13])]),function(n,e,t){return t.onEnter.bind(function(t){return t(n,e)})})]),i=Z([]);return Xl(n,Qi.init,o,i,function(){return tt.some(e)})},ql=Yl(oi("cyclic",Z(!1))),Kl=Yl(oi("cyclic",Z(!0))),Jl=function(t,n,e){return ll(e)&&Ml([32])(n.event())?tt.none():(fi(t,e,te()),tt.some(!0))},$l=function(){return tt.some(!0)},Ql=[Kr("execute",Jl),Kr("useSpace",!1),Kr("useEnter",!0),Kr("useControlEnter",!1),Kr("useDown",!1)],Zl=function(t,n,e){return e.execute(t,n,t.element())},td=Xl(Ql,Qi.init,function(t,n,e){var o=e.useSpace&&!ll(t.element())?[32]:[],r=e.useEnter?[13]:[],i=e.useDown?[40]:[],u=o.concat(r).concat(i);return[Hl(Ml(u),Zl)].concat(e.useControlEnter?[Hl(Fl([Vl,Ml([13])]),Zl)]:[])},function(t,n,e){return e.useSpace&&!ll(t.element())?[Hl(Ml([32]),$l)]:[]},function(){return tt.none()}),nd=function(){var e=nn(tt.none());return Zi({readState:function(){return e.get().map(function(t){return{numRows:t.numRows(),numColumns:t.numColumns()}}).getOr({numRows:"?",numColumns:"?"})},setGridSize:function(t,n){e.set(tt.some({numRows:Z(t),numColumns:Z(n)}))},getNumRows:function(){return e.get().map(function(t){return t.numRows()})},getNumColumns:function(){return e.get().map(function(t){return t.numColumns()})}})},ed=Object.freeze({flatgrid:nd,init:function(t){return t.state(t)}}),od=function(i){return function(t,n,e,o){var r=i(t.element());return ad(r,t,n,e,o)}},rd=function(t,n){var e=Nc(t,n);return od(e)},id=function(t,n){var e=Nc(n,t);return od(e)},ud=function(r){return function(t,n,e,o){return ad(r,t,n,e,o)}},ad=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})},cd=ud,sd=ud,fd=ud,ld=function(t){var n;return!((n=t.dom()).offsetWidth<=0&&n.offsetHeight<=0)},dd=ke(["index","candidates"],[]),md=function(t,n,e){return gd(t,n,e,ld)},gd=function(t,n,e){var o,r=h(Re,n),i=es(t,e),u=ft(i,ld);return gt(o=u,r).map(function(t){return dd({index:t,candidates:o})})},pd=function(t,n){return gt(t,function(t){return Re(n,t)})},hd=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?tt.some(e[n]):tt.none()})},vd=function(r,t,i,u,a){return hd(r,t,u,function(t,n){var e=t===i-1?r.length-t*u:u,o=pl(n,a,0,e-1);return tt.some({row:Z(t),column:Z(o)})})},bd=function(i,t,u,a,c){return hd(i,t,a,function(t,n){var e=pl(t,c,0,u-1),o=e===u-1?i.length-e*a:a,r=hl(n,0,o-1);return tt.some({row:Z(e),column:Z(r)})})},yd=[Rr("selector"),Kr("execute",Jl),oa("onEscape"),Kr("captureTab",!1),ca()],xd=function(n,e){Gu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},wd=function(r){return function(t,n,e,o){return md(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))})}},Sd=function(t,n,e){return e.captureTab?tt.some(!0):tt.none()},Cd=wd(function(t,n,e,o){return vd(t,n,e,o,-1)}),kd=wd(function(t,n,e,o){return vd(t,n,e,o,1)}),Od=wd(function(t,n,e,o){return bd(t,n,e,o,-1)}),Ed=wd(function(t,n,e,o){return bd(t,n,e,o,1)}),Td=Z([Hl(Ml([37]),rd(Cd,kd)),Hl(Ml([39]),id(Cd,kd)),Hl(Ml([38]),cd(Od)),Hl(Ml([40]),sd(Ed)),Hl(Fl([Il,Ml([9])]),Sd),Hl(Fl([Rl,Ml([9])]),Sd),Hl(Ml([27]),function(t,n,e){return e.onEscape(t,n)}),Hl(Ml([32].concat([13])),function(n,e,o){return(t=n,r=o,r.focusManager.get(t).bind(function(t){return Xu(t,r.selector)})).bind(function(t){return o.execute(n,e,t)});var t,r})]),Bd=Z([Hl(Ml([32]),$l)]),Dd=Xl(yd,nd,Td,Bd,function(){return tt.some(xd)}),Ad=function(t,n,e,i){var u=function(t,n,e){var o,r=pl(n,i,0,e.length-1);return r===t?tt.none():(o=e[r],"button"===Qe(o)&&"disabled"===uo(o,"disabled")?u(t,r,e):tt.from(e[r]))};return md(t,e,n).bind(function(t){var n=t.index(),e=t.candidates();return u(n,n,e)})},_d=[Rr("selector"),Kr("getInitial",tt.none),Kr("execute",Jl),oa("onEscape"),Kr("executeOnMove",!1),Kr("allowVertical",!0)],Md=function(n,e,o){return(t=n,r=o,r.focusManager.get(t).bind(function(t){return Xu(t,r.selector)})).bind(function(t){return o.execute(n,e,t)});var t,r},Fd=function(n,e){e.getInitial(n).orThunk(function(){return Gu(n.element(),e.selector)}).each(function(t){e.focusManager.set(n,t)})},Id=function(t,n,e){return Ad(t,e.selector,n,-1)},Vd=function(t,n,e){return Ad(t,e.selector,n,1)},Rd=function(o){return function(t,n,e){return o(t,n,e).bind(function(){return e.executeOnMove?Md(t,n,e):tt.some(!0)})}},Hd=function(t,n,e){return e.onEscape(t,n)},Nd=Z([Hl(Ml([32]),$l)]),zd=Xl(_d,Qi.init,function(t,n,e){var o=[37].concat(e.allowVertical?[38]:[]),r=[39].concat(e.allowVertical?[40]:[]);return[Hl(Ml(o),Rd(rd(Id,Vd))),Hl(Ml(r),Rd(id(Id,Vd))),Hl(Ml([13]),Md),Hl(Ml([32]),Md),Hl(Ml([27]),Hd)]},Nd,function(){return tt.some(Fd)}),Pd=ke(["rowIndex","columnIndex","cell"],[]),Ld=function(t,n,e){return tt.from(t[n]).bind(function(t){return tt.from(t[e]).map(function(t){return Pd({rowIndex:n,columnIndex:e,cell:t})})})},jd=function(t,n,e,o){var r=t[n].length,i=pl(e,o,0,r-1);return Ld(t,n,i)},Ud=function(t,n,e,o){var r=pl(e,o,0,t.length-1),i=t[r].length,u=hl(n,0,i-1);return Ld(t,r,u)},Wd=function(t,n,e,o){var r=t[n].length,i=hl(e+o,0,r-1);return Ld(t,n,i)},Gd=function(t,n,e,o){var r=hl(e+o,0,t.length-1),i=t[r].length,u=hl(n,0,i-1);return Ld(t,r,u)},Xd=[Lr("selectors",[Rr("row"),Rr("cell")]),Kr("cycles",!0),Kr("previousSelector",tt.none),Kr("execute",Jl)],Yd=function(n,e){e.previousSelector(n).orThunk(function(){var t=e.selectors;return Gu(n.element(),t.cell)}).each(function(t){e.focusManager.set(n,t)})},qd=function(t,n){return function(e,o,i){var u=i.cycles?t:n;return Xu(o,i.selectors.row).bind(function(t){var n=es(t,i.selectors.cell);return pd(n,o).bind(function(o){var r=es(e,i.selectors.row);return pd(r,t).bind(function(t){var n,e=(n=i,ct(r,function(t){return es(t,n.selectors.cell)}));return u(e,t,o).map(function(t){return t.cell()})})})})}},Kd=qd(function(t,n,e){return jd(t,n,e,-1)},function(t,n,e){return Wd(t,n,e,-1)}),Jd=qd(function(t,n,e){return jd(t,n,e,1)},function(t,n,e){return Wd(t,n,e,1)}),$d=qd(function(t,n,e){return Ud(t,e,n,-1)},function(t,n,e){return Gd(t,e,n,-1)}),Qd=qd(function(t,n,e){return Ud(t,e,n,1)},function(t,n,e){return Gd(t,e,n,1)}),Zd=Z([Hl(Ml([37]),rd(Kd,Jd)),Hl(Ml([39]),id(Kd,Jd)),Hl(Ml([38]),cd($d)),Hl(Ml([40]),sd(Qd)),Hl(Ml([32].concat([13])),function(n,e,o){return Pl(n.element()).bind(function(t){return o.execute(n,e,t)})})]),tm=Z([Hl(Ml([32]),$l)]),nm=Xl(Xd,Qi.init,Zd,tm,function(){return tt.some(Yd)}),em=[Rr("selector"),Kr("execute",Jl),Kr("moveOnTab",!1)],om=function(n,e,o){return o.focusManager.get(n).bind(function(t){return o.execute(n,e,t)})},rm=function(n,e){Gu(n.element(),e.selector).each(function(t){e.focusManager.set(n,t)})},im=function(t,n,e){return Ad(t,e.selector,n,-1)},um=function(t,n,e){return Ad(t,e.selector,n,1)},am=Z([Hl(Ml([38]),fd(im)),Hl(Ml([40]),fd(um)),Hl(Fl([Il,Ml([9])]),function(t,n,e){return e.moveOnTab?fd(im)(t,n,e):tt.none()}),Hl(Fl([Rl,Ml([9])]),function(t,n,e){return e.moveOnTab?fd(um)(t,n,e):tt.none()}),Hl(Ml([13]),om),Hl(Ml([32]),om)]),cm=Z([Hl(Ml([32]),$l)]),sm=Xl(em,Qi.init,am,cm,function(){return tt.some(rm)}),fm=[oa("onSpace"),oa("onEnter"),oa("onShiftEnter"),oa("onLeft"),oa("onRight"),oa("onTab"),oa("onShiftTab"),oa("onUp"),oa("onDown"),oa("onEscape"),Kr("stopSpaceKeyup",!1),Wr("focusIn")],lm=Xl(fm,Qi.init,function(t,n,e){return[Hl(Ml([32]),e.onSpace),Hl(Fl([Rl,Ml([13])]),e.onEnter),Hl(Fl([Il,Ml([13])]),e.onShiftEnter),Hl(Fl([Il,Ml([9])]),e.onShiftTab),Hl(Fl([Rl,Ml([9])]),e.onTab),Hl(Ml([38]),e.onUp),Hl(Ml([40]),e.onDown),Hl(Ml([37]),e.onLeft),Hl(Ml([39]),e.onRight),Hl(Ml([32]),e.onSpace),Hl(Ml([27]),e.onEscape)]},function(t,n,e){return e.stopSpaceKeyup?[Hl(Ml([32]),$l)]:[]},function(t){return t.focusIn}),dm=ql.schema(),mm=Kl.schema(),gm=zd.schema(),pm=Dd.schema(),hm=nm.schema(),vm=td.schema(),bm=sm.schema(),ym=lm.schema(),xm=ba({branchKey:"mode",branches:Object.freeze({acyclic:dm,cyclic:mm,flow:gm,flatgrid:pm,matrix:hm,execution:vm,menu:bm,special:ym}),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){tn(e,"setGridSize")?e.setGridSize(o,r):b.console.error("Layout does not support setGridSize")}},state:ed}),wm=function(t,n,e,o){var r=t.getSystem().build(o);zs(t,r,e)},Sm=function(t,n,e,o){var r=Cm(t,n);mt(r,function(t){return Re(o.element(),t.element())}).each(Ls)},Cm=function(t){return t.components()},km=function(n,e,t,r,o){var i=Cm(n,e);return tt.from(i[r]).map(function(t){return Sm(n,e,0,t),o.each(function(t){wm(n,0,function(t,n){var e,o;o=n,je(e=t,r).fold(function(){Xe(e,o)},function(t){Ue(t,o)})},t)}),t})},Om=ha({fields:[],name:"replacing",apis:Object.freeze({append:function(t,n,e,o){wm(t,0,Xe,o)},prepend:function(t,n,e,o){wm(t,0,Ge,o)},remove:Sm,replaceAt:km,replaceBy:function(n,e,t,o,r){var i=Cm(n,e);return gt(i,o).bind(function(t){return km(n,e,0,t,r)})},set:function(n,t,e,o){var r,i,u,a;js(n),r=function(){var t=ct(o,n.getSystem().build);st(t,function(t){Ns(n,t)})},i=n.element(),u=He(i),a=zl(u).bind(function(n){var t=function(t){return Re(n,t)};return t(i)?tt.some(i):bi(i,t)}),r(i),a.each(function(n){zl(u).filter(function(t){return Re(t,n)}).fold(function(){Nl(n)},Q)})},contents:Cm})}),Em=function(t,n,e){n.store.manager.onLoad(t,n,e)},Tm=function(t,n,e){n.store.manager.onUnload(t,n,e)},Bm=Object.freeze({onLoad:Em,onUnload:Tm,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}}),Dm=Object.freeze({events:function(n,e){var t=n.resetOnDom?[_i(function(t){Em(t,n,e)}),Mi(function(t){Tm(t,n,e)})]:[sa(n,e,Em)];return xi(t)}}),Am=function(){var t=nn(null);return Zi({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()}}})},_m=function(){var i=nn({}),u=nn({});return Zi({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(t){return Jt(i.get(),t).orThunk(function(){return Jt(u.get(),t)})},update:function(t){var n=i.get(),e=u.get(),o={},r={};st(t,function(n){o[n.value]=n,Jt(n,"meta").each(function(t){Jt(t,"text").each(function(t){r[t]=n})})}),i.set(To({},n,o)),u.set(To({},e,r))},clear:function(){i.set({}),u.set({})}})},Mm=Object.freeze({memory:Am,dataset:_m,manual:function(){return Zi({readState:function(){}})},init:function(t){return t.store.manager.state(t)}}),Fm=function(t,n,e,o){var r=n.store;e.update([o]),r.setValue(t,o),n.onSetValue(t,o)},Im=[Wr("initialValue"),Rr("getFallbackEntry"),Rr("getDataKey"),Rr("setValue"),ua("manager",{setValue:Fm,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){Fm(n,e,o,t)})},onUnload:function(t,n,e){e.clear()},state:_m})],Vm=[Rr("getValue"),Kr("setValue",Q),Wr("initialValue"),ua("manager",{setValue:function(t,n,e,o){n.store.setValue(t,o),n.onSetValue(t,o)},getValue:function(t,n){return n.store.getValue(t)},onLoad:function(n,e){e.store.initialValue.each(function(t){e.store.setValue(n,t)})},onUnload:Q,state:Qi.init})],Rm=[Wr("initialValue"),ua("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:Am})],Hm=[Jr("store",{mode:"memory"},Br("mode",{memory:Rm,manual:Vm,dataset:Im})),ea("onSetValue"),Kr("resetOnDom",!1)],Nm=ha({fields:Hm,name:"representing",active:Dm,apis:Bm,extra:{setValueFrom:function(t,n){var e=Nm.getValue(n);Nm.setValue(t,e)}},state:Mm}),zm=function(t,n){n.ignore||(Nl(t.element()),n.onFocus(t))},Pm=Object.freeze({focus:zm,blur:function(t,n){n.ignore||t.element().dom().blur()},isFocused:function(t){return n=t.element(),e=He(n).dom(),n.dom()===e.activeElement;var n,e}}),Lm=Object.freeze({exhibit:function(t,n){var e=n.ignore?{}:{attributes:{tabindex:"-1"}};return nu(e)},events:function(e){return xi([Ci(Jn(),function(t,n){zm(t,e),n.stop()})].concat(e.stopMousedown?[Ci(cn(),function(t,n){n.event().prevent()})]:[]))}}),jm=[ea("onFocus"),Kr("stopMousedown",!1),Kr("ignore",!1)],Um=ha({fields:jm,name:"focusing",active:Lm,apis:Pm}),Wm=function(t,n,e){var o=n.aria;o.update(t,o,e.get())},Gm=function(n,t,e){t.toggleClass.each(function(t){e.get()?gu(n.element(),t):hu(n.element(),t)})},Xm=function(t,n,e){Km(t,n,e,!e.get())},Ym=function(t,n,e){e.set(!0),Gm(t,n,e),Wm(t,n,e)},qm=function(t,n,e){e.set(!1),Gm(t,n,e),Wm(t,n,e)},Km=function(t,n,e,o){(o?Ym:qm)(t,n,e)},Jm=function(t,n,e){Km(t,n,e,n.selected)},$m=Object.freeze({onLoad:Jm,toggle:Xm,isOn:function(t,n,e){return e.get()},on:Ym,off:qm,set:Km}),Qm=Object.freeze({exhibit:function(){return nu({})},events:function(t,n){var e,o,r,i=(e=t,o=n,r=Xm,Ii(function(t){r(t,e,o)})),u=sa(t,n,Jm)
  ;return xi(vt([t.toggleOnExecute?[i]:[],[u]]))}}),Zm=Object.freeze({init:function(){var n=nn(!1);return{readState:function(){return n.get()},get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(!1)}}}}),tg=function(t,n,e){ro(t.element(),"aria-expanded",e)},ng=[Kr("selected",!1),Wr("toggleClass"),Kr("toggleOnExecute",!0),Jr("aria",{mode:"none"},Br("mode",{pressed:[Kr("syncWithExpanded",!1),ua("update",function(t,n,e){ro(t.element(),"aria-pressed",e),n.syncWithExpanded&&tg(t,n,e)})],checked:[ua("update",function(t,n,e){ro(t.element(),"aria-checked",e)})],expanded:[ua("update",tg)],selected:[ua("update",function(t,n,e){ro(t.element(),"aria-selected",e)})],none:[ua("update",Q)]}))],eg=ha({fields:ng,name:"toggling",active:Qm,apis:$m,state:Zm}),og="alloy.item-hover",rg="alloy.item-focus",ig=function(t){(Pl(t.element()).isNone()||Um.isFocused(t))&&(Um.isFocused(t)||Um.focus(t),ci(t,og,{item:t}))},ug=function(t){ci(t,rg,{item:t})},ag=Z(og),cg=Z(rg),sg=function(t,n){var e,o;return{key:t,value:{config:{},me:(e=t,o=xi(n),ha({fields:[Rr("enabled")],name:e,active:{events:Z(o)}})),configAsRaw:Z({}),initialConfig:{},state:Qi}}},fg=[Rr("data"),Rr("components"),Rr("dom"),Kr("hasSubmenu",!1),Wr("toggling"),ff("itemBehaviours",[eg,Um,xm,Nm]),Kr("ignoreFocus",!1),Kr("domModification",{}),ua("builder",function(t){return{dom:t.dom,domModification:To({},t.domModification,{attributes:To({role:t.toggling.isSome()?"menuitemcheckbox":"menuitem"},t.domModification.attributes,{"aria-haspopup":t.hasSubmenu},t.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:lf(t.itemBehaviours,[t.toggling.fold(eg.revoke,function(t){return eg.config(To({aria:{mode:"checked"}},t))}),Um.config({ignore:t.ignoreFocus,stopMousedown:t.ignoreFocus,onFocus:function(t){ug(t)}}),xm.config({mode:"execution"}),Nm.config({store:{mode:"memory",initialValue:t.data}}),sg("item-type-events",[Ci(oe(),si),Bi(cn()),Ci(dn(),ig),Ci(ne(),Um.focus)])]),components:t.components,eventOrder:t.eventOrder}}),Kr("eventOrder",{})],lg=[Rr("dom"),Rr("components"),ua("builder",function(t){return{dom:t.dom,components:t.components,events:xi([Di(ne())])}})],dg=Z([Vf({name:"widget",overrides:function(t){return{behaviours:ga([Nm.config({store:{mode:"manual",getValue:function(){return t.data},setValue:function(){}}})])}}})]),mg=[Rr("uid"),Rr("data"),Rr("components"),Rr("dom"),Kr("autofocus",!1),Kr("ignoreFocus",!1),ff("widgetBehaviours",[Nm,Um,xm]),Kr("domModification",{}),el(dg()),ua("builder",function(e){var t=Yf(0,e,dg()),n=qf("item-widget",e,t.internals()),o=function(t){return Kf(t,e,"widget").map(function(t){return xm.focusIn(t),t})},r=function(t,n){return ll(n.event().target())||e.autofocus&&n.setSource(t.element()),tt.none()};return{dom:e.dom,components:n,domModification:e.domModification,events:xi([Ii(function(t,n){o(t).each(function(){n.stop()})}),Ci(dn(),ig),Ci(ne(),function(t){e.autofocus?o(t):Um.focus(t)})]),behaviours:lf(e.widgetBehaviours,[Nm.config({store:{mode:"memory",initialValue:e.data}}),Um.config({ignore:e.ignoreFocus,onFocus:function(t){ug(t)}}),xm.config({mode:"special",focusIn:e.autofocus?function(t){o(t)}:ya(),onLeft:r,onRight:r,onEscape:function(t,n){return Um.isFocused(t)||e.autofocus?(e.autofocus&&n.setSource(t.element()),tt.none()):(Um.focus(t),tt.some(!0))}})])}})],gg=Br("type",{widget:mg,item:fg,separator:lg}),pg=Z([Nf({factory:{sketch:function(t){var n=Er("menu.spec item",gg,t);return n.builder(n)}},name:"items",unit:"item",defaults:function(t,n){return n.hasOwnProperty("uid")?n:To({},n,{uid:Ui("item")})},overrides:function(t,n){return{type:n.type,ignoreFocus:t.fakeFocus,domModification:{classes:[t.markers.item]}}}})]),hg=Z([Rr("value"),Rr("items"),Rr("dom"),Rr("components"),Kr("eventOrder",{}),af("menuBehaviours",[Tl,Nm,gl,xm]),Jr("movement",{mode:"menu",moveOnTab:!0},Br("mode",{grid:[ca(),ua("config",function(t,n){return{mode:"flatgrid",selector:"."+t.markers.item,initSize:{numColumns:n.initSize.numColumns,numRows:n.initSize.numRows},focusManager:t.focusManager}})],matrix:[ua("config",function(t,n){return{mode:"matrix",selectors:{row:n.rowSelector,cell:"."+t.markers.item},focusManager:t.focusManager}}),Rr("rowSelector")],menu:[Kr("moveOnTab",!0),ua("config",function(t,n){return{mode:"menu",selector:"."+t.markers.item,moveOnTab:n.moveOnTab,focusManager:t.focusManager}})]})),Hr("markers",$u()),Kr("fakeFocus",!1),Kr("focusManager",jl()),ea("onHighlight")]),vg=Z("alloy.menu-focus"),bg=fl({name:"Menu",configFields:hg(),partFields:pg(),factory:function(t,n){return{uid:t.uid,dom:t.dom,markers:t.markers,behaviours:sf(t.menuBehaviours,[Tl.config({highlightClass:t.markers.selectedItem,itemClass:t.markers.item,onHighlight:t.onHighlight}),Nm.config({store:{mode:"memory",initialValue:t.value}}),gl.config({find:tt.some}),xm.config(t.movement.config(t,t.movement))]),events:xi([Ci(cg(),function(n,e){var t=e.event();n.getSystem().getByDom(t.target()).each(function(t){Tl.highlight(n,t),e.stop(),ci(n,vg(),{menu:n,item:t})})}),Ci(ag(),function(t,n){var e=n.event().item();Tl.highlight(t,e)})]),components:n,eventOrder:t.eventOrder,domModification:{attributes:{role:"menu"}}}}}),yg=function(e,o,r,t){return Jt(r,t).bind(function(t){return Jt(e,t).bind(function(t){var n=yg(e,o,r,t);return tt.some([t].concat(n))})}).getOr([])},xg=function(t,n){var e={};Dt(t,function(t,n){st(t,function(t){e[t]=n})});var o=n,r=_t(n,function(t,n){return{k:t,v:n}}),i=At(r,function(t,n){return[n].concat(yg(e,o,r,n))});return At(e,function(t){return Jt(i,t).getOr([t])})},wg=function(){var i=nn({}),u=nn({}),a=nn({}),c=nn(tt.none()),s=nn({}),n=function(t){return Jt(u.get(),t)};return{setMenuBuilt:function(t,n){var e;u.set(To({},u.get(),((e={})[t]={type:"prepared",menu:n},e)))},setContents:function(t,n,e,o){c.set(tt.some(t)),i.set(e),u.set(n),s.set(o);var r=xg(o,e);a.set(r)},expand:function(e){return Jt(i.get(),e).map(function(t){var n=Jt(a.get(),e).getOr([]);return[t].concat(n)})},refresh:function(t){return Jt(a.get(),t)},collapse:function(t){return Jt(a.get(),t).bind(function(t){return 1<t.length?tt.some(t.slice(1)):tt.none()})},lookupMenu:n,otherMenus:function(t){var n=s.get();return St(Tt(n),t)},getPrimary:function(){return c.get().bind(function(t){return n(t).bind(function(t){return"prepared"===t.type?tt.some(t.menu):tt.none()})})},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(tt.none())},isClear:function(){return c.get().isNone()}}},Sg=Z("collapse-item"),Cg=sl({name:"TieredMenu",configFields:[ia("onExecute"),ia("onEscape"),ra("onOpenMenu"),ra("onOpenSubmenu"),ea("onCollapseMenu"),Kr("highlightImmediately",!0),Lr("data",[Rr("primary"),Rr("menus"),Rr("expansions")]),Kr("fakeFocus",!1),ea("onHighlight"),ea("onHover"),Zu(),Rr("dom"),Kr("navigateOnHover",!0),Kr("stayInDom",!1),af("tmenuBehaviours",[xm,Tl,gl,Om]),Kr("eventOrder",{})],apis:{collapseMenu:function(t,n){t.collapseMenu(n)},highlightPrimary:function(t,n){t.highlightPrimary(n)}},factory:function(a){var c,t,i=nn(tt.none()),s=wg(),e=function(t){var o,r,n,e=(o=t,r=a.data.primary,n=a.data.menus,At(n,function(t,n){var e=function(){return bg.sketch(To({dom:t.dom},t,{value:n,items:t.items,markers:a.markers,fakeFocus:a.fakeFocus,onHighlight:a.onHighlight,focusManager:a.fakeFocus?Ul():jl()}))};return n===r?{type:"prepared",menu:o.getSystem().build(e())}:{type:"notbuilt",nbMenu:e}})),i=u(t);return s.setContents(a.data.primary,e,a.data.expansions,i),s.getPrimary()},f=function(t){return Nm.getValue(t).value},u=function(){return At(a.data.menus,function(t){return bt(t.items,function(t){return"separator"===t.type?[]:[t.data.value]})})},l=function(n,t){Tl.highlight(n,t),Tl.getHighlighted(t).orThunk(function(){return Tl.getFirst(t)}).each(function(t){fi(n,t.element(),ne())})},d=function(n,t){return en(ct(t,function(t){return n.lookupMenu(t).bind(function(t){return"prepared"===t.type?tt.some(t.menu):tt.none()})}))},m=function(n,t,e){var o=d(t,t.otherMenus(e));st(o,function(t){yu(t.element(),[a.markers.backgroundMenu]),a.stayInDom||Om.remove(n,t)})},g=function(t,o){var r,n=(r=t,i.get().getOrThunk(function(){var e={},t=es(r.element(),"."+a.markers.item),n=ft(t,function(t){return"true"===uo(t,"aria-haspopup")});return st(n,function(t){r.getSystem().getByDom(t).each(function(t){var n=f(t);e[n]=t})}),i.set(tt.some(e)),e}));Dt(n,function(t,n){var e=it(o,n);ro(t.element(),"aria-expanded",e)})},p=function(o,r,i){return tt.from(i[0]).bind(function(t){return r.lookupMenu(t).bind(function(t){if("notbuilt"===t.type)return tt.none();var n=t.menu,e=d(r,i.slice(1));return st(e,function(t){gu(t.element(),a.markers.backgroundMenu)}),mi(n.element())||Om.append(o,Uu(n)),yu(n.element(),[a.markers.backgroundMenu]),l(o,n),m(o,r,i),tt.some(n)})})};(t=c||(c={}))[t.HighlightSubmenu=0]="HighlightSubmenu",t[t.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),tt.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 mi(n.element())||Om.append(r,Uu(n)),a.onOpenSubmenu(r,i,n),u===c.HighlightSubmenu?(Tl.highlightFirst(n),p(r,s,o)):(Tl.dehighlightAll(n),tt.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})})},n=function(e){return function(n,t){return Xu(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})})})}},r=xi([Ci(vg(),function(n,t){var e=t.event().menu();Tl.highlight(n,e);var o=f(t.event().item());s.refresh(o).each(function(t){return m(n,s,t)})}),Ii(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(){})})}),_i(function(n){e(n).each(function(t){Om.append(n,Uu(t)),a.onOpenMenu(n,t),a.highlightImmediately&&l(n,t)})})].concat(a.navigateOnHover?[Ci(ag(),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)})]:[])),v={collapseMenu:function(n){Tl.getHighlighted(n).each(function(t){Tl.getHighlighted(t).each(function(t){o(n,t)})})},highlightPrimary:function(n){s.getPrimary().each(function(t){l(n,t)})}};return{uid:a.uid,dom:a.dom,markers:a.markers,behaviours:sf(a.tmenuBehaviours,[xm.config({mode:"special",onRight:n(function(t,n){return ll(n.element())?tt.none():h(t,n,c.HighlightSubmenu)}),onLeft:n(function(t,n){return ll(n.element())?tt.none():o(t,n)}),onEscape:n(function(t,n){return o(t,n).orThunk(function(){return a.onEscape(t,n).map(function(){return t})})}),focusIn:function(n){s.getPrimary().each(function(t){fi(n,t.element(),ne())})}}),Tl.config({highlightClass:a.markers.selectedMenu,itemClass:a.markers.menu}),gl.config({find:function(t){return Tl.getHighlighted(t)}}),Om.config({})]),eventOrder:a.eventOrder,apis:v,events:r}},extraApis:{tieredData:function(t,n,e){return{primary:t,menus:n,expansions:e}},singleData:function(t,n){return{primary:t,menus:$t(t,n),expansions:{}}},collapseItem:function(t){return{value:Oo(Sg()),meta:{text:t}}}}}),kg=sl({name:"InlineView",configFields:[Rr("lazySink"),ea("onShow"),ea("onHide"),Yr("onEscape"),af("inlineBehaviours",[tf,Sa]),qr("fireDismissalEventInstead",[Kr("event",de())]),Kr("getRelated",tt.none),Kr("eventOrder",tt.none)],factory:function(s){var r=function(t,n,e,o){var r=s.lazySink(t).getOrDie();tf.openWhileCloaked(t,e,function(){return Vs.positionWithin(r,n,t,o)}),s.onShow(t)},t={setContent:function(t,n){tf.open(t,n)},showAt:function(t,n,e){var o=tt.none();r(t,n,e,o)},showWithin:r,showMenuAt:function(t,n,e){var o,r,i,u,a,c=(o=s,r=t,i=n,u=e,a=function(){return o.lazySink(r)},Cg.sketch({dom:{tag:"div"},data:u.data,markers:u.menu.markers,onEscape:function(){return tf.close(r),o.onEscape.map(function(t){return t(r)}),tt.some(!0)},onExecute:function(){return tt.some(!0)},onOpenMenu:function(t,n){Vs.position(a().getOrDie(),i,n)},onOpenSubmenu:function(t,n,e){var o=a().getOrDie();Vs.position(o,{anchor:"submenu",item:n},e)}}));tf.open(t,c),s.onShow(t)},hide:function(t){tf.close(t),s.onHide(t)},getContent:function(t){return tf.getState(t)},isOpen:tf.isOpen};return{uid:s.uid,dom:s.dom,behaviours:sf(s.inlineBehaviours,[tf.config({isPartOf:function(t,n,e){return qu(n,e)||(o=t,r=e,s.getRelated(o).exists(function(t){return qu(t,r)}));var o,r},getAttachPoint:function(t){return s.lazySink(t).getOrDie()}}),rf(To({isExtraPart:Z(!1)},s.fireDismissalEventInstead.map(function(t){return{fireEventInstead:{event:t.event}}}).getOr({})))]),eventOrder:s.eventOrder,apis:t}},apis:{showAt:function(t,n,e,o){t.showAt(n,e,o)},showWithin:function(t,n,e,o,r){t.showWithin(n,e,o,r)},showMenuAt:function(t,n,e,o){t.showMenuAt(n,e,o)},hide:function(t,n){t.hide(n)},isOpen:function(t,n){return t.isOpen(n)},getContent:function(t,n){return t.getContent(n)},setContent:function(t,n,e){t.setContent(n,e)}}}),Og=function(t){var n=function(t,n){n.stop(),si(t)},e=qn.detect().deviceType.isTouch()?[Ci(ee(),n)]:[Ci(yn(),n),Ci(cn(),function(t,n){n.cut()})];return xi(vt([t.map(function(e){return Ci(te(),function(t,n){e(t),n.stop()})}).toArray(),e]))},Eg=sl({name:"Button",factory:function(t){var n=Og(t.action),e=t.dom.tag,o=function(n){return Jt(t.dom,"attributes").bind(function(t){return Jt(t,n)})};return{uid:t.uid,dom:t.dom,components:t.components,events:n,behaviours:lf(t.buttonBehaviours,[Um.config({}),xm.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 To({type:t},n)}()},eventOrder:t.eventOrder}},configFields:[Kr("uid",undefined),Rr("dom"),Kr("components",[]),ff("buttonBehaviours",[Um,xm]),Wr("action"),Wr("role"),Kr("eventOrder",{})]}),Tg=function(t){var n=function M(n){return n.uid!==undefined}(t)&&tn(t,"uid")?t.uid:Ui("memento");return{get:function(t){return t.getSystem().getByUid(n).getOrDie()},getOpt:function(t){return t.getSystem().getByUid(n).fold(tt.none,tt.some)},asSpec:function(){return To({},t,{uid:n})}}},Bg=function(t){return tt.from(t()["temporary-placeholder"]).getOr("!not found!")},Dg=function(t,n){return tt.from(n()[t]).getOrThunk(function(){return Bg(n)})},Ag={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},_g=sl({name:"Notification",factory:function(n){var t,e,o=Tg({dom:{tag:"p",innerHtml:n.translationProvider(n.text)},behaviours:ga([Om.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=Tg({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:ga([Om.config({})])}),a={updateProgress:function(t,n){t.getSystem().isConnected()&&u.getOpt(t).each(function(t){Om.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);Om.set(e,[zu(n)])}}},c=vt([n.icon.toArray(),n.level.toArray(),n.level.bind(function(t){return tt.from(Ag[t])}).toArray()]);return{uid:n.uid,dom:{tag:"div",attributes:{role:"alert"},classes:n.level.map(function(t){return["tox-notification","tox-notification--in","tox-notification--"+t]}).getOr(["tox-notification","tox-notification--in"])},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:(t=c,e=n.iconProvider,on(t,function(t){return tt.from(e()[t])}).getOrThunk(function(){return Bg(e)}))}},{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:ga([Om.config({})])}].concat(n.progress?[u.asSpec()]:[]).concat(Eg.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[{dom:{tag:"div",classes:["tox-icon"],innerHtml:Dg("close",n.iconProvider),attributes:{"aria-label":n.translationProvider("Close")}}}],action:function(t){n.onAction(t)}})),apis:a}},configFields:[Wr("level"),Rr("progress"),Rr("icon"),Rr("onAction"),Rr("text"),Rr("iconProvider"),Rr("translationProvider")],apis:{updateProgress:function(t,n,e){t.updateProgress(n,e)},updateText:function(t,n,e){t.updateText(n,e)}}}),Mg=tinymce.util.Tools.resolve("tinymce.util.Delay"),Fg=function(e,o){var r=null;return{cancel:function(){null!==r&&(b.clearTimeout(r),r=null)},throttle:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];null!==r&&b.clearTimeout(r),r=b.setTimeout(function(){e.apply(null,t),r=null},o)}}},Ig=/[\u00a0 \t\r\n]/,Vg=function(e,t,n,o,r){return void 0===r&&(r=0),(i=e).collapsed&&3===i.startContainer.nodeType?function(t,n,e,o){var r;for(r=n-1;0<=r;r--){if(Ig.test(t.charAt(r)))return tt.none();if(t.charAt(r)===e)break}return-1===r||n-r<o?tt.none():tt.some(t.substring(r+1,n))}(n,o,t,r).map(function(t){var n=e.cloneRange();return n.setStart(e.startContainer,e.startOffset-t.length-1),n.setEnd(e.startContainer,e.startOffset),{text:t,rng:n}}):tt.none();var i},Rg=function(e,t){t.on("keypress",e.onKeypress.throttle),t.on("remove",e.onKeypress.cancel);var o=function(t,n){ci(t,pn(),{raw:n})};t.on("keydown",function(n){var t=function(){return e.getView().bind(Tl.getHighlighted)};8===n.which&&e.onKeypress.throttle(n),e.isActive()&&(27===n.which?e.closeIfNecessary():32===n.which?e.closeIfNecessary():13===n.which?(t().each(si),n.preventDefault()):40===n.which?(t().fold(function(){e.getView().each(Tl.highlightFirst)},function(t){o(t,n)}),n.preventDefault()):37!==n.which&&38!==n.which&&39!==n.which||t().each(function(t){o(t,n),n.preventDefault()}))})},Hg=tinymce.util.Tools.resolve("tinymce.util.Promise"),Ng=function(t,n){return 0===t.startOffset||/\s/.test(n.charAt(t.startOffset-1))},zg=function(t,n){var e,o,r,i=n(),u=t.selection.getRng(),a=u.startContainer.nodeValue;return(e=u,o=a,r=i,on(r.triggerChars,function(n){return Vg(e,n,o,e.startOffset).map(function(t){return{range:t.rng,text:t.text,triggerChar:n}})})).map(function(e){var t=ft(i.lookupByChar(e.triggerChar),function(t){return e.text.length>=t.minChars&&t.matches.getOr(Ng)(e.range,a,e.text)});return{lookupData:Hg.all(ct(t,function(n){return n.fetch(e.text,n.maxResults).then(function(t){return{items:t,columns:n.columns,onAction:n.onAction}})})),triggerChar:e.triggerChar,range:e.range}})},Pg=dr([oi("type",function(){return"autocompleteitem"}),oi("active",function(){return!1}),oi("disabled",function(){return!1}),Kr("meta",{}),Nr("value"),Xr("text"),Xr("icon")]),Lg=dr([Nr("type"),Nr("ch"),$r("minChars",1),Kr("columns",1),$r("maxResults",10),Yr("matches"),Pr("fetch"),Pr("onAction")]),jg=function(t){var n,e,o=t.ui.registry.getAll().popups,r=At(o,function(t){return(n=t,kr("Autocompleter",Lg,n)).fold(function(t){throw new Error(Tr(t))},function(t){return t});var n}),i=(n=Mt(r,function(t){return t.ch}),e={},st(n,function(t){e[t]={}}),Tt(e)),u=Ft(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return ft(u,function(t){return t.ch===n})}}},Ug=[ti("disabled",!1),Xr("text"),Xr("shortcut"),br("value","value",Mo(function(){return Oo("menuitem-value")}),Dr()),Kr("meta",{})],Wg=dr([Nr("type"),ni("onSetup",function(){return Q}),ni("onAction",Q),Xr("icon")].concat(Ug)),Gg=dr([Nr("type"),Pr("getSubmenuItems"),ni("onSetup",function(){return Q}),Xr("icon")].concat(Ug)),Xg=dr([Nr("type"),ti("active",!1),ni("onSetup",function(){return Q}),Pr("onAction")].concat(Ug)),Yg=dr([Nr("type"),ti("active",!1),Xr("icon")].concat(Ug)),qg=dr([Nr("type"),Xr("text")]),Kg=dr([Nr("type"),zr("fancytype",["inserttable"]),ni("onAction",Q)]),Jg=function(t,o,n){var r=es(t.element(),"."+n);if(0<r.length){var e=gt(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 tt.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return tt.none()},$g=function(t,n){return ga([sg(t,n)])},Qg=function(t){return $g(Oo("unnamed-events"),t)},Zg=[Rr("lazySink"),Rr("tooltipDom"),Kr("exclusive",!0),Kr("tooltipComponents",[]),Kr("delay",300),Zr("mode","normal",["normal","follow-highlight"]),Kr("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:Z([Mc,_c,Tc,Dc,Bc,Ac]),onRtl:Z([Mc,_c,Tc,Dc,Bc,Ac])}}}),ea("onHide"),ea("onShow")],tp=Object.freeze({init:function(){var e=nn(tt.none()),n=nn(tt.none()),o=function(){e.get().each(function(t){b.clearTimeout(t)})},t=Z("not-implemented");return Zi({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(tt.some(t))},clearTooltip:function(){n.set(tt.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(tt.some(b.setTimeout(function(){t()},n)))},readState:t})}}),np=Oo("tooltip.exclusive"),ep=Oo("tooltip.show"),op=Oo("tooltip.hide"),rp=function(t){t.getSystem().broadcastOn([np],{})},ip=Object.freeze({hideAllExclusive:rp,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&Om.set(t,o)})}}),up=ha({fields:Zg,name:"tooltipping",active:Object.freeze({events:function(o,r){var e=function(n){r.getTooltip().each(function(t){Ls(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return xi(vt([[Ci(ep,function(t){r.resetTimer(function(){!function(t){if(!r.isShowing()){rp(t);var n=o.lazySink(t).getOrDie(),e=t.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:xi("normal"===o.mode?[Ci(dn(),function(){ai(t,ep)}),Ci(fn(),function(){ai(t,op)})]:[]),behaviours:ga([Om.config({})])});r.setTooltip(e),Ns(n,e),o.onShow(t,e),Vs.position(n,o.anchor(t),e)}}(t)},o.delay)}),Ci(op,function(t){r.resetTimer(function(){e(t)},o.delay)}),Ci(Zn(),function(t,n){it(n.channels(),np)&&e(t)}),Mi(function(t){e(t)})],"normal"===o.mode?[Ci(mn(),function(t){ai(t,ep)}),Ci($n(),function(t){ai(t,op)}),Ci(dn(),function(t){ai(t,ep)}),Ci(fn(),function(t){ai(t,op)})]:[Ci(ve(),function(t){ai(t,ep)}),Ci(be(),function(t){ai(t,op)})]]))}}),state:tp,apis:ip}),ap=function(t){var n,e,o,r=xe.fromHtml(t),i=Le(r),u=(e=(n=r).dom().attributes!==undefined?n.dom().attributes:[],dt(e,function(t,n){var e;return"class"===n.name?t:To({},t,((e={})[n.name]=n.value,e))},{})),a=(o=r,Array.prototype.slice.call(o.dom().classList,0)),c=0===i.length?{}:{innerHtml:Je(r)};return To({tag:Qe(r),classes:a,attributes:u},c)},cp=tinymce.util.Tools.resolve("tinymce.util.I18n"),sp="tox-menu-nav__js",fp="tox-collection__item",lp="tox-swatch",dp={normal:sp,color:lp},mp="tox-collection__item--enabled",gp="tox-collection__item-icon",pp="tox-collection__item-label",hp="tox-collection__item--active",vp=function(t){return Jt(dp,t).getOr(sp)},bp=tinymce.util.Tools.resolve("tinymce.Env"),yp=function(t){var e=bp.mac?{alt:"&#x2325;",ctrl:"&#x2303;",shift:"&#x21E7;",meta:"&#x2318;",access:"&#x2303;&#x2325;"}:{meta:"Ctrl",access:"Shift+Alt"},n=t.split("+"),o=ct(n,function(t){var n=t.toLowerCase().trim();return Vt(e,n)?e[n]:t});return bp.mac?o.join(""):o.join("+")},xp=function(t){return{dom:{tag:"div",classes:[gp],innerHtml:t}}},wp=function(t){return{dom:{tag:"div",classes:[pp]},components:[zu(cp.translate(t))]}},Sp=function(t,n){return{dom:{tag:"div",classes:[pp]},components:[{dom:{tag:t.tag,attributes:{style:t.styleAttr}},components:[zu(cp.translate(n))]}]}},Cp=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:yp(t)}}},kp=function(t){return{dom:{tag:"div",classes:[gp,"tox-collection__item-checkmark"],innerHtml:Dg("checkmark",t)}}},Op=function(t,r,n,i){void 0===i&&(i=tt.none());var e,o,u,a,c,s,f,l,d,m,g=t.iconContent.map(function(t){return n=t,e=r.icons,o=i,tt.from(e()[n]).or(o).getOrThunk(function(){return Bg(e)});var n,e,o}),p=tt.from(t.meta).fold(function(){return wp},function(t){return Vt(t,"style")?h(Sp,t.style):wp});return"color"===t.presets?(s=t.ariaLabel,f=t.value,{dom:(l=lp,d=g.getOr(""),m=s.map(function(t){return' title="'+t+'"'}).getOr(""),ap("custom"===f?'<button class="'+l+' tox-swatches__picker-btn"'+m+">"+d+"</button>":"remove"===f?'<div class="'+l+' tox-swatch--remove"'+m+">"+d+"</div>":'<div class="'+l+'" style="background-color: '+f+'" data-mce-color="'+f+'"'+m+"></div>")),optComponents:[]}):(e=t,o=g,u=p,a=n?e.checkMark.orThunk(function(){return o.or(tt.some("")).map(xp)}):tt.none(),c=e.ariaLabel.map(function(t){return{attributes:{title:cp.translate(t)}}}).getOr({}),{dom:Xt({tag:"div",classes:[sp,fp]},c),optComponents:[a,e.textContent.map(u),e.shortcutContent.map(Cp),e.caret]})},Ep=["input","button","textarea"],Tp=function(t,n,e){n.disabled&&Fp(t,n,e)},Bp=function(t){return it(Ep,Qe(t.element()))},Dp=function(t){ro(t.element(),"disabled","disabled")},Ap=function(t){co(t.element(),"disabled")},_p=function(t){ro(t.element(),"aria-disabled","true")},Mp=function(t){ro(t.element(),"aria-disabled","false")},Fp=function(n,t){t.disableClass.each(function(t){gu(n.element(),t)}),(Bp(n)?Dp:_p)(n)},Ip=function(t){return Bp(t)?ao(t.element(),"disabled"):"true"===uo(t.element(),"aria-disabled")},Vp=Object.freeze({enable:function(n,t){t.disableClass.each(function(t){hu(n.element(),t)}),(Bp(n)?Ap:Mp)(n)},disable:Fp,isDisabled:Ip,onLoad:Tp}),Rp=Object.freeze({exhibit:function(t,n){return nu({classes:n.disabled?n.disableClass.map(Ct).getOr([]):[]})},events:function(t,n){return xi([wi(te(),function(t){return Ip(t)}),sa(t,n,Tp)])}}),Hp=[Kr("disabled",!1),Wr("disableClass")],Np=ha({fields:Hp,name:"disabling",active:Rp,apis:Vp}),zp=function(t){return Np.config({disabled:t,disableClass:"tox-collection__item--state-disabled"})},Pp=function(t){return Np.config({disabled:t})},Lp=function(t){return Np.config({disabled:t,disableClass:"tox-tbtn--disabled"})},jp=function(t,n){var e=t.getApi(n);return function(t){t(e)}},Up=function(e,o){return _i(function(t){jp(e,t)(function(t){var n=e.onSetup(t);null!==n&&n!==undefined&&o.set(n)})})},Wp=function(n,e){return Mi(function(t){return jp(n,t)(e.get())})};(Gl=Wl||(Wl={}))[Gl.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",Gl[Gl.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX";var Gp,Xp,Yp=Wl,qp={"alloy.execute":["disabling","alloy.base.behaviour","toggling","item-events"]},Kp=function(t){return bt(t,function(t){return t.toArray()})},Jp=function(t,n,e){var o,r,i=nn(Q);return{type:"item",dom:n.dom,components:Kp(n.optComponents),data:t.data,eventOrder:qp,hasSubmenu:t.triggersSubmenu,itemBehaviours:ga([sg("item-events",[(o=t,r=e,Ii(function(t,n){jp(o,t)(o.onAction),o.triggersSubmenu||r!==Yp.CLOSE_ON_EXECUTE||(ai(t,ie()),n.stop())})),Up(t,i),Wp(t,i)]),zp(t.disabled),Om.config({})].concat(t.itemBehaviours))}},$p=function(t){return{value:t.value,meta:Xt({text:t.text.getOr("")},t.meta)}},Qp=Z(jf("item-widget",dg())),Zp=Oo("cell-over"),th=Oo("cell-execute"),nh=function(n,e,t){var o,r=function(t){return ci(t,th,{row:n,col:e})};return ju({dom:{tag:"div",attributes:(o={role:"button"},o["aria-labelledby"]=t,o)},behaviours:ga([sg("insert-table-picker-cell",[Ci(dn(),Um.focus),Ci(te(),r),Ci(oe(),r)]),eg.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Um.config({onFocus:function(t){return ci(t,Zp,{row:n,col:e})}})])})},eh={inserttable:function qD(o){var t,n=Oo("size-label"),a=function(t,n,e){for(var o=[],r=0;r<n;r++){for(var i=[],u=0;u<e;u++)i.push(nh(r,u,t));o.push(i)}return o}(n,10,10),c=Tg({dom:{tag:"span",classes:["tox-insert-table-picker__label"],attributes:{id:n}},components:[zu("0x0")],behaviours:ga([Om.config({})])});return{type:"widget",data:{value:Oo("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[Qp().widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:(t=a,bt(t,function(t){return ct(t,Uu)})).concat(c.asSpec()),behaviours:ga([sg("insert-table-picker",[Ti(Zp,function(t,n,e){var o,r,i=e.event().row(),u=e.event().col();!function(t,n,e,o,r){for(var i=0;i<o;i++)for(var u=0;u<r;u++)eg.set(t[i][u],i<=n&&u<=e)}(a,i,u,10,10),Om.set(c.get(t),[(o=i,r=u,zu(r+1+"x"+(o+1)))])}),Ti(th,function(t,n,e){o.onAction({numRows:e.event().row()+1,numColumns:e.event().col()+1}),ai(t,ie())})]),xm.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}}},oh=function(t,n,e,o,r,i,u){var a=Op({presets:e,textContent:n?t.text:tt.none(),ariaLabel:t.text,iconContent:t.icon,shortcutContent:n?t.shortcut:tt.none(),checkMark:n?tt.some(kp(u.icons)):tt.none(),caret:tt.none(),value:t.value},u,!0);return Gt(Jp({data:$p(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){eg.set(n,t)},isActive:function(){return eg.isOn(n)},isDisabled:function(){return Np.isDisabled(n)},setDisabled:function(t){return t?Np.disable(n):Np.enable(n)}}},onAction:function(){return o(t.value)},onSetup:function(t){return t.setActive(r),function(){}},triggersSubmenu:!1,itemBehaviours:[]},a,i),{toggling:{toggleClass:mp,toggleOnExecute:!1,selected:t.active}})},rh=function(t,n,e,o,r,i,u){void 0===u&&(u=!0);var a,c,s=Op({presets:e,textContent:n?t.text:tt.none(),ariaLabel:t.text,iconContent:t.icon,shortcutContent:tt.none(),checkMark:tt.none(),caret:tt.none(),value:t.value},i.providers,u,t.icon);return Jp({data:$p(t),disabled:t.disabled,getApi:function(){return{}},onAction:function(){return o(t.value,t.meta)},onSetup:function(){return function(){}},triggersSubmenu:!1,itemBehaviours:(a=t.meta,c=i,It(a,"tooltipWorker").map(function(t){return[up.config({lazySink:c.getSink,tooltipDom:{tag:"div"},tooltipComponents:[],anchor:function(t){return{anchor:"submenu",item:t}},mode:"follow-highlight",onShow:function(n){t(function(t){up.setComponents(n,[Pu({element:xe.fromDom(t)})])})}})]}).getOr([]))},s,r)},ih=function(t){var n=t.text.fold(function(){return{}},function(t){return{innerHtml:t}});return{type:"separator",dom:To({tag:"div",classes:[fp,"tox-collection__group-heading"]},n),components:[]}},uh=function(t,n,e,o){void 0===o&&(o=!0);var r=Op({presets:"normal",iconContent:t.icon,textContent:t.text,ariaLabel:t.text,caret:tt.none(),checkMark:tt.none(),shortcutContent:t.shortcut},e,o);return Jp({data:$p(t),getApi:function(n){return{isDisabled:function(){return Np.isDisabled(n)},setDisabled:function(t){return t?Np.disable(n):Np.enable(n)}}},disabled:t.disabled,onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,n)},ah=function(t,n,e,o){void 0===o&&(o=!0);var r,i=(r=e.icons,{dom:{tag:"div",classes:["tox-collection__item-caret"],innerHtml:Dg("chevron-right",r)}}),u=Op({presets:"normal",iconContent:t.icon,textContent:t.text,ariaLabel:t.text,caret:tt.some(i),checkMark:tt.none(),shortcutContent:t.shortcut},e,o);return Jp({data:$p(t),getApi:function(n){return{isDisabled:function(){return Np.isDisabled(n)},setDisabled:function(t){return t?Np.disable(n):Np.enable(n)}}},disabled:t.disabled,onAction:Q,onSetup:t.onSetup,triggersSubmenu:!0,itemBehaviours:[]},u,n)},ch=function(t,n,e){var o=Op({iconContent:tt.none(),textContent:t.text,ariaLabel:t.text,checkMark:tt.some(kp(e.icons)),caret:tt.none(),shortcutContent:t.shortcut,presets:"normal",meta:t.meta},e,!0);return Gt(Jp({data:$p(t),disabled:t.disabled,getApi:function(n){return{setActive:function(t){eg.set(n,t)},isActive:function(){return eg.isOn(n)},isDisabled:function(){return Np.isDisabled(n)},setDisabled:function(t){return t?Np.disable(n):Np.enable(n)}}},onAction:t.onAction,onSetup:t.onSetup,triggersSubmenu:!1,itemBehaviours:[]},o,n),{toggling:{toggleClass:mp,toggleOnExecute:!1,selected:t.active}})},sh=function(n){return(t=eh,e=n.fancytype,Object.prototype.hasOwnProperty.call(t,e)?tt.some(t[e]):tt.none()).map(function(t){return t(n)});var t,e},fh=function(t){return{backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:(n=t,"color"===n?"tox-swatches":"tox-menu"),tieredMenu:"tox-tiered-menu"};var n},lh=function(t){var n=fh(t);return{backgroundMenu:n.backgroundMenu,selectedMenu:n.selectedMenu,menu:n.menu,selectedItem:n.selectedItem,item:vp(t)}},dh=[bg.parts().items({})],mh=function(t,n,e){var o=fh(e);return{dom:{tag:"div",classes:vt([[o.tieredMenu]])},markers:lh(e)}},gh=function(t,n){var e=lh(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")}},ph=function(e,o){return function(t){var n=at(t,o);return ct(n,function(t){return{dom:e,components:t}})}},hh=function(n,i,t){return void 0===t&&(t=!0),{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===n?["tox-collection--list"]:[
  "tox-collection--grid"])},components:[bg.parts().items({preprocess:function(t){return"auto"!==n&&1<n?ph({tag:"div",classes:["tox-collection__group"]},n)(t):(e=function(t,n){return"separator"===i[n].type},o=[],r=[],st(t,function(t,n){e(t,n)?(0<r.length&&o.push(r),r=[],Vt(t.dom,"innerHtml")&&r.push(t)):r.push(t)}),0<r.length&&o.push(r),ct(o,function(t){return{dom:{tag:"div",classes:["tox-collection__group"]},components:t}}));var e,o,r}})]}};(Xp=Gp||(Gp={}))[Xp.ContentFocus=0]="ContentFocus",Xp[Xp.UiFocus=1]="UiFocus";var vh,bh,yh=function(t){return b.console.error(Tr(t)),b.console.log(t),tt.none()},xh=function(t){return t.icon!==undefined||"togglemenuitem"===t.type||"choicemenuitem"===t.type},wh=function(t){return ut(t,xh)},Sh=function(t,n,e,o){switch(void 0===o&&(o=!0),t.type){case"menuitem":return(c=t,kr("menuitem",Wg,c)).fold(yh,function(t){return tt.some(uh(t,n,e,o))});case"nestedmenuitem":return(a=t,kr("nestedmenuitem",Gg,a)).fold(yh,function(t){return tt.some(ah(t,n,e,o))});case"togglemenuitem":return(u=t,kr("togglemenuitem",Xg,u)).fold(yh,function(t){return tt.some(ch(t,n,e))});case"separator":return(i=t,kr("separatormenuitem",qg,i)).fold(yh,function(t){return tt.some(ih(t))});case"fancymenuitem":return(r=t,kr("fancymenuitem",Kg,r)).fold(yh,function(t){return sh(t)});default:return b.console.error("Unknown item in general menu",t),tt.none()}var r,i,u,a,c},Ch=function(t,n,e,o,r){var i,u,a,c,s,f,l;return"color"===r?{value:t,dom:(i=o,l={dom:{tag:"div",classes:["tox-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[bg.parts().items({preprocess:"auto"!==i?ph({tag:"div",classes:["tox-swatches__row"]},i):U})]}]}).dom,components:l.components,items:e}:"normal"===r&&"auto"===o?{value:t,dom:(l=hh(o,e)).dom,components:l.components,items:e}:"normal"===r&&1===o?{value:t,dom:(l=hh(1,e)).dom,components:l.components,items:e}:"normal"===r?{value:t,dom:(l=hh(o,e)).dom,components:l.components,items:e}:"listpreview"!==r||"auto"===o?{value:t,dom:(a=n,c=o,s=r,f=fh(s),{tag:"div",classes:vt([[f.menu,"tox-menu-"+c+"-column"],a?[f.hasIcons]:[]])}),components:dh,items:e}:{value:t,dom:(u=o,l={dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[bg.parts().items({preprocess:ph({tag:"div",classes:["tox-collection__group"]},u)})]}).dom,components:l.components,items:e}},kh=function(t,e,o,r,i,u,a){return en(ct(t,function(n){return"choiceitem"===n.type?(t=n,kr("choicemenuitem",Yg,t)).fold(yh,function(t){return tt.some(oh(t,1===o,r,e,u(n.value),i,a))}):tt.none();var t}))},Oh=function(t,e,n,o,r){var i=1===n,u=!i||wh(t);return en(ct(t,function(t){return(n=t,kr("Autocompleter.Item",Pg,n)).fold(yh,function(t){return tt.some(rh(t,i,"normal",e,o,r,u))});var n}))},Eh=function(t,n,e,o,r,i,u,a){var c=wh(n),s=kh(n,e,o,"color"!==r?"normal":"color",i,u,a);return Ch(t,c,s,o,r)},Th=function(t,n,e,o){var r=wh(n),i=en(ct(n,function(t){var n=function(t){return Sh(t,e,o,r)};return"nestedmenuitem"===t.type&&t.getSubmenuItems().length<=0?n(Xt(t,{disabled:!0})):n(t)}));return Ch(t,r,i,1,"normal")},Bh=function(t){return Cg.singleData(t.value,t)},Dh=function(g,p){var h=ju(kg.sketch({dom:{tag:"div",classes:["tox-autocompleter"]},components:[],lazySink:p.getSink})),t=function(){return kg.isOpen(h)},v=function(){t()&&kg.hide(h)},n=Sn(function(){return jg(g)}),e=Fg(function(t){(" "===t.key?tt.none():zg(g,n)).fold(v,function(m){m.lookupData.then(function(t){var e,n,o,r,i,u,a,c,s,f,l=(e=m.triggerChar,o=on(n=t,function(t){return tt.from(t.columns)}).getOr(1),bt(n,function(i){var t=i.items;return Oh(t,function(o,r){var t=g.selection.getRng(),n=t.startContainer;Vg(t,e,n.data,t.startOffset).fold(function(){return b.console.error("Lost context. Cursor probably moved")},function(t){var n=t.rng,e={hide:v};i.onAction(e,n,o,r)})},o,Yp.BUBBLE_TO_SANDBOX,p)}));if(0<l.length){var d=on(t,function(t){return tt.from(t.columns)}).getOr(1);kg.showAt(h,{anchor:"selection",root:xe.fromDom(g.getBody()),getSelection:function(){return tt.some({start:function(){return xe.fromDom(m.range.startContainer)},soffset:function(){return m.range.startOffset},finish:function(){return xe.fromDom(m.range.endContainer)},foffset:function(){return m.range.endOffset}})}},bg.sketch((r=Ch("autocompleter-value",!0,l,d,"normal"),i=d,a="normal",c=(u=Gp.ContentFocus)===Gp.ContentFocus?Ul():jl(),s=gh(i,a),f=lh(a),{dom:r.dom,components:r.components,items:r.items,value:r.value,markers:{selectedItem:f.selectedItem,item:f.item},movement:s,fakeFocus:u===Gp.ContentFocus,focusManager:c,menuBehaviours:Qg("auto"!==i?[]:[_i(function(o){Jg(o,4,f.item).each(function(t){var n=t.numColumns,e=t.numRows;xm.setGridSize(o,e,n)})})])}))),kg.getContent(h).each(Tl.highlightFirst)}else v()})})},50);Rg({onKeypress:e,closeIfNecessary:v,isActive:t,getView:function(){return kg.getContent(h)}},g)},Ah=function(m,g){return function(t){if(m(t)){var n,e,o,r,i,u,a,c=xe.fromDom(t.target),s=function(){t.stopPropagation()},f=function(){t.preventDefault()},l=H(f,s),d=(n=c,e=t.clientX,o=t.clientY,r=s,i=f,u=l,a=t,{target:Z(n),x:Z(e),y:Z(o),stop:r,prevent:i,kill:u,raw:Z(a)});g(d)}}},_h=function(t,n,e,o,r){var i=Ah(e,o);return t.dom().addEventListener(n,i,r),{unbind:h(Mh,t,n,i,r)}},Mh=function(t,n,e,o){t.dom().removeEventListener(n,e,o)},Fh=Z(!0),Ih=function(t,n,e){return _h(t,n,Fh,e,!1)},Vh=function(t,n,e){return _h(t,n,Fh,e,!0)},Rh=function(t,n,e){return Xu(t,n,e).isSome()},Hh=function(t){var n=t.raw();return n.touches===undefined||1!==n.touches.length?tt.none():tt.some(n.touches[0])},Nh=function(e){var u=nn(tt.none()),o=s(function(t){u.set(tt.none()),e.triggerEvent(re(),t)},400),r=Qt([{key:rn(),value:function(e){return Hh(e).each(function(t){o.cancel();var n={x:Z(t.clientX),y:Z(t.clientY),target:e.target};o.schedule(e),u.set(tt.some(n))}),tt.none()}},{key:un(),value:function(t){return o.cancel(),Hh(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(tt.none())})}),tt.none()}},{key:an(),value:function(n){return o.cancel(),u.get().filter(function(t){return Re(t.target(),n.target())}).map(function(){return e.triggerEvent(ee(),n)})}}]);return{fireIfReady:function(n,t){return Jt(r,t).bind(function(t){return t(n)})}}},zh=qn.detect().browser.isFirefox(),Ph=lr([Pr("triggerEvent"),Kr("stopBackspace",!0)]),Lh=function(n,t){var e,o,r,i,u=Er("Getting GUI events settings",Ph,t),a=qn.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],c=Nh(u),s=ct(a.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(t){return Ih(n,t,function(n){c.fireIfReady(n,t).each(function(t){t&&n.kill()}),u.triggerEvent(t,n)&&n.kill()})}),f=nn(tt.none()),l=Ih(n,"paste",function(n){c.fireIfReady(n,"paste").each(function(t){t&&n.kill()}),u.triggerEvent("paste",n)&&n.kill(),f.set(tt.some(b.setTimeout(function(){u.triggerEvent(Qn(),n)},0)))}),d=Ih(n,"keydown",function(t){var n;u.triggerEvent("keydown",t)?t.kill():!0!==u.stopBackspace||8!==(n=t).raw().which||it(["input","textarea"],Qe(n.target()))||Rh(n.target(),'[contenteditable="true"]')||t.prevent()}),m=(e=n,o=function(t){u.triggerEvent("focusin",t)&&t.kill()},zh?Vh(e,"focus",o):Ih(e,"focusin",o)),g=nn(tt.none()),p=(r=n,i=function(t){u.triggerEvent("focusout",t)&&t.kill(),g.set(tt.some(b.setTimeout(function(){u.triggerEvent($n(),t)},0)))},zh?Vh(r,"blur",i):Ih(r,"focusout",i));return{unbind:function(){st(s,function(t){t.unbind()}),d.unbind(),m.unbind(),p.unbind(),l.unbind(),f.get().each(b.clearTimeout),g.get().each(b.clearTimeout)}}},jh=function(t,n){var e=Jt(t,"target").map(function(t){return t()}).getOr(n);return nn(e)},Uh=jt([{stopped:[]},{resume:["element"]},{complete:[]}]),Wh=function(t,o,n,e,r,i){var u,a,c,s,f=t(o,e),l=(u=n,a=r,c=nn(!1),s=nn(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:Z(u),setSource:a.set,getSource:a.get});return f.fold(function(){return i.logEventNoHandlers(o,e),Uh.complete()},function(n){var e=n.descHandler();return ou(e)(l),l.isStopped()?(i.logEventStopped(o,n.element(),e.purpose()),Uh.stopped()):l.isCut()?(i.logEventCut(o,n.element(),e.purpose()),Uh.complete()):ze(n.element()).fold(function(){return i.logNoParent(o,n.element(),e.purpose()),Uh.complete()},function(t){return i.logEventResponse(o,n.element(),e.purpose()),Uh.resume(t)})})},Gh=function(n,e,o,t,r,i){return Wh(n,e,o,t,r,i).fold(function(){return!0},function(t){return Gh(n,e,o,t,r,i)},function(){return!1})},Xh=function(t,n){var e,o,r=(e=n,o=nn(!1),{stop:function(){o.set(!0)},cut:Q,isStopped:o.get,isCut:Z(!1),event:Z(e),setSource:z("Cannot set source of a broadcasted event"),getSource:z("Cannot get source of a broadcasted event")});return st(t,function(t){var n=t.descHandler();ou(n)(r)}),r.isStopped()},Yh=function(t,n,e,o,r){var i=jh(e,o);return Gh(t,n,e,o,i,r)},qh=we("element","descHandler"),Kh=function(t,n){return{id:Z(t),descHandler:Z(n)}},Jh=sl({name:"Container",factory:function(t){var n=t.dom,e=n.attributes,o=v(n,["attributes"]);return{uid:t.uid,dom:To({tag:"div",attributes:To({role:"presentation"},e)},o),components:t.components,behaviours:cf(t.containerBehaviours),events:t.events,domModification:t.domModification,eventOrder:t.eventOrder}},configFields:[Kr("components",[]),af("containerBehaviours",[]),Kr("events",{}),Kr("domModification",{}),Kr("eventOrder",{})]}),$h=function(e){var o=function(n){return ze(e.element()).fold(function(){return!0},function(t){return Re(n,t)})},r=y(),s=function(t,n){return r.find(o,t,n)},t=Lh(e.element(),{triggerEvent:function(u,a){return xo(u,a.target(),function(t){return n=s,e=u,r=t,i=(o=a).target(),Yh(n,e,o,i,r);var n,e,o,r,i})}}),i={debugInfo:Z("real"),triggerEvent:function(n,e,o){xo(n,e,function(t){Yh(s,n,o,e,t)})},triggerFocus:function(a,c){ji(a).fold(function(){Nl(a)},function(){xo(Jn(),a,function(t){var n,e,o,r,i,u;n=s,e=Jn(),o={originator:Z(c),kill:Q,prevent:Q,target:Z(a)},i=t,u=jh(o,r=a),Wh(n,e,o,r,u,i)})})},triggerEscape:function(t,n){i.triggerEvent("keydown",t.element(),n.event())},getByUid:function(t){return g(t)},getByDom:function(t){return p(t)},build:ju,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:Z(!0)},n=function(t){t.connect(i),no(t.element())||(r.register(t),st(t.components(),n),i.triggerEvent(ae(),t.element(),{target:Z(t.element())}))},u=function(t){no(t.element())||(st(t.components(),u),r.unregister(t)),t.disconnect()},a=function(t){Ns(e,t)},c=function(t){Ls(t)},f=function(e){var t=r.filter(Zn());st(t,function(t){var n=t.descHandler();ou(n)(e)})},l=function(t){f({universal:Z(!0),data:Z(t)})},d=function(t,n){f({universal:Z(!1),channels:Z(t),data:Z(n)})},m=function(t,n){var e=r.filter(t);return Xh(e,n)},g=function(t){return r.getById(t).fold(function(){return Lt.error(new Error('Could not find component with uid: "'+t+'" in system.'))},Lt.value)},p=function(t){var n=ji(t).getOr("not found");return g(n)};return n(e),{root:Z(e),element:e.element,destroy:function(){t.unbind(),Ke(e.element())},add:a,remove:c,getByUid:g,getByDom:p,addToWorld:n,removeFromWorld:u,broadcast:l,broadcastOn:d,broadcastEvent:m}},Qh=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Zh=tinymce.util.Tools.resolve("tinymce.EditorManager"),tv=function(t){return tt.from(t.settings.min_width).filter(ot)},nv=function(t){return tt.from(t.settings.min_height).filter(ot)},ev=function(n){var t=Tt(n.settings),e=ft(t,function(t){return/^toolbar([1-9])$/.test(t)}),o=ct(e,function(t){return n.getParam(t,!1,"string")}),r=ft(o,function(t){return"string"==typeof t});return 0<r.length?tt.some(r):tt.none()};(bh=vh||(vh={}))["default"]="",bh.floating="floating",bh.sliding="sliding";var ov,rv,iv=function(t){return t.getParam("toolbar_drawer","","string")},uv=function(t){var n=t.getParam("fixed_toolbar_container","","string"),e=t.getParam("inline",!1,"boolean");return 0<n.length&&e?Gu(gi(),n):tt.none()},av=function(t){return t.getParam("inline",!1,"boolean")&&uv(t).isSome()},cv=Oo("form-component-change"),sv=Oo("form-close"),fv=Oo("form-cancel"),lv=Oo("form-action"),dv=Oo("form-submit"),mv=Oo("form-block"),gv=Oo("form-unblock"),pv=Oo("form-tabchange"),hv=Oo("form-resize"),vv=Z([Kr("prefix","form-field"),af("fieldBehaviours",[gl,Nm])]),bv=Z([Hf({schema:[Rr("dom")],name:"label"}),Hf({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Rr("text")],name:"aria-descriptor"}),Vf({factory:{sketch:function(t){var n=Yt(t,["factory"]);return t.factory.sketch(n)}},schema:[Rr("factory")],name:"field"})]),yv=fl({name:"FormField",configFields:vv(),partFields:bv(),factory:function(r,t){var n=sf(r.fieldBehaviours,[gl.config({find:function(t){return Kf(t,r,"field")}}),Nm.config({store:{mode:"manual",getValue:function(t){return gl.getCurrent(t).bind(Nm.getValue)},setValue:function(t,n){gl.getCurrent(t).each(function(t){Nm.setValue(t,n)})}}})]),e=xi([_i(function(t){var o=$f(t,r,["label","field","aria-descriptor"]);o.field().each(function(e){var n=Oo(r.prefix);o.label().each(function(t){ro(t.element(),"for",n),ro(e.element(),"id",n)}),o["aria-descriptor"]().each(function(t){var n=Oo(r.prefix);ro(t.element(),"id",n),ro(e.element(),"aria-describedby",n)})})})]),o={getField:function(t){return Kf(t,r,"field")},getLabel:function(t){return Kf(t,r,"label")}};return{uid:r.uid,dom:r.dom,components:t,behaviours:n,events:e,apis:o}},apis:{getField:function(t,n){return t.getField(n)},getLabel:function(t,n){return t.getLabel(n)}}}),xv=Object.freeze({getCoupled:function(t,n,e,o){return e.getOrCreate(t,n,o)}}),wv=[Hr("others",Cr(Lt.value,Dr()))],Sv=ha({fields:wv,name:"coupling",apis:xv,state:Object.freeze({init:function(){var i={},t=Z({});return Zi({readState:t,getOrCreate:function(e,o,r){var t=Tt(o.others);if(t)return Jt(i,r).getOrThunk(function(){var t=Jt(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: "+or(t,null,2))}})}})}),Cv=Object.freeze({events:function(t,n){var e=t.stream.streams.setup(t,n);return xi([Ci(t.event,e),Mi(function(){return n.cancel()})].concat(t.cancelEvent.map(function(t){return[Ci(t,function(){return n.cancel()})]}).getOr([])))}}),kv=function(){var n=nn(null);return Zi({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()}})},Ov=Object.freeze({throttle:kv,init:function(t){return t.stream.streams.state(t)}}),Ev=[Hr("stream",Br("mode",{throttle:[Rr("delay"),Kr("stopEvent",!0),ua("streams",{setup:function(t,n){var e=t.stream,o=Fg(t.onStream,e.delay);return n.setTimer(o),function(t,n){o.throttle(t,n),e.stopEvent&&n.stop()}},state:kv})]})),Kr("event","input"),Wr("cancelEvent"),ra("onStream")],Tv=ha({fields:Ev,name:"streaming",active:Cv,state:Ov}),Bv=function(t){var e=tt.none(),n=[],o=function(t){r()?u(t):n.push(t)},r=function(){return e.isSome()},i=function(t){st(t,u)},u=function(n){e.each(function(t){b.setTimeout(function(){n(t)},0)})};return t(function(t){e=tt.some(t),i(n),n=[]}),{get:o,map:function(e){return Bv(function(n){o(function(t){n(e(t))})})},isReady:r}},Dv={nu:Bv,pure:function(n){return Bv(function(t){t(n)})}},Av=function(n){var r=function(t){var o;n((o=t,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=this;b.setTimeout(function(){o.apply(e,t)},0)}))},e=function(){return Dv.nu(r)};return{map:function(o){return Av(function(e){r(function(t){var n=o(t);e(n)})})},bind:function(e){return Av(function(n){r(function(t){e(t).get(n)})})},anonBind:function(n){return Av(function(t){r(function(){n.get(t)})})},toLazy:e,toCached:function(){var n=null;return Av(function(t){null===n&&(n=e()),n.get(t)})},get:r}},_v={nu:Av,pure:function(n){return Av(function(t){t(n)})}},Mv=Z("sink"),Fv=Z(Hf({name:Mv(),overrides:Z({dom:{tag:"div"},behaviours:ga([Vs.config({useFixed:!0})]),events:xi([Bi(pn()),Bi(cn()),Bi(yn())])})}));(rv=ov||(ov={}))[rv.HighlightFirst=0]="HighlightFirst",rv[rv.HighlightNone=1]="HighlightNone";var Iv,Vv,Rv,Hv=function(t,n){var e=t.getHotspot(n).getOr(n);return t.layouts.fold(function(){return{anchor:"hotspot",hotspot:e}},function(t){return{anchor:"hotspot",hotspot:e,layouts:t}})},Nv=function(t,n,e,o,r,i,u){var a,c,s,f,l,d,m,g,p,h,v=Hv(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=jv(s,a),p.map(function(t){return t.bind(function(t){return tt.from(Cg.sketch(To({},l.menu(),{uid:Ui(""),data:t,highlightImmediately:d===ov.HighlightFirst,onOpenMenu:function(t,n){var e=h().getOrDie();Vs.position(e,c,n),tf.decloak(f)},onOpenSubmenu:function(t,n,e){var o=h().getOrDie();Vs.position(o,{anchor:"submenu",item:n},e),tf.decloak(f)},onEscape:function(){return Um.focus(s),tf.close(f),tt.some(!0)}})))})})).map(function(t){return t.fold(function(){tf.isOpen(o)&&tf.close(o)},function(t){tf.cloak(o),tf.open(o,t),i(o)}),o})},zv=function(t,n,e,o){return tf.close(o),_v.pure(o)},Pv=function(t,n,e,o,r,i){var u=Sv.getCoupled(e,"sandbox");return(tf.isOpen(u)?zv:Nv)(t,n,e,u,o,r,i)},Lv=function(t,n,e){var o,r,i=gl.getCurrent(n).getOr(n),u=_a(t.element());e?Cu(i.element(),"min-width",u+"px"):(o=i.element(),r=u,Aa.set(o,r))},jv=function(n,t){return n.getSystem().getByUid(t.uid+"-"+Mv()).map(function(t){return function(){return Lt.value(t)}}).getOrThunk(function(){return t.lazySink.fold(function(){return function(){return Lt.error(new Error("No internal sink is specified, nor could an external sink be found"))}},function(t){return function(){return t(n)}})})},Uv=function(o,r,i){var n,u=(n=Oo("aria-owns"),{id:Z(n),link:function(t){ro(t,"aria-owns",n)},unlink:function(t){co(t,"aria-owns")}}),t=jv(r,o);return{dom:{tag:"div",classes:o.sandboxClasses,attributes:{id:u.id()}},behaviours:lf(o.sandboxBehaviours,[Nm.config({store:{mode:"memory",initialValue:r}}),tf.config({onOpen:function(t,n){var e=Hv(o,r);u.link(r.element()),o.matchWidth&&Lv(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 qu(n,e)||qu(r,e)},getAttachPoint:function(){return t().getOrDie()}}),gl.config({find:function(t){return tf.getState(t).bind(function(t){return gl.getCurrent(t)})}}),rf({isExtraPart:Z(!1)})])}},Wv=function(t,n,e){var o=Nm.getValue(e);Nm.setValue(n,o),Xv(n)},Gv=function(t,n){var e=t.element(),o=_u(e),r=e.dom();"number"!==uo(e,"type")&&n(r,o)},Xv=function(t){Gv(t,function(t,n){return t.setSelectionRange(n.length,n.length)})},Yv=function(t,n,o){if(t.selectsOver){var e=Nm.getValue(n),r=t.getDisplayText(e),i=Nm.getValue(o);return 0===t.getDisplayText(i).indexOf(r)?tt.some(function(){var t,e;Wv(0,n,o),t=n,e=r.length,Gv(t,function(t,n){return t.setSelectionRange(e,n.length)})}):tt.none()}return tt.none()},qv=Z([Wr("data"),Kr("inputAttributes",{}),Kr("inputStyles",{}),Kr("tag","input"),Kr("inputClasses",[]),ea("onSetValue"),Kr("styles",{}),Kr("eventOrder",{}),af("inputBehaviours",[Nm,Um]),Kr("selectOnFocus",!0)]),Kv=function(t){return ga([Um.config({onFocus:!1===t.selectOnFocus?Q:function(t){var n=t.element(),e=_u(n);n.dom().setSelectionRange(0,e.length)}})])},Jv=function(t){return{tag:t.tag,attributes:To({type:"text"},t.inputAttributes),styles:t.inputStyles,classes:t.inputClasses}},$v=Z("alloy.typeahead.itemexecute"),Qv=function(){return[Kr("sandboxClasses",[]),ff("sandboxBehaviours",[gl,Sa,tf,Nm])]},Zv=Z([Wr("lazySink"),Rr("fetch"),Kr("minChars",5),Kr("responseTime",1e3),ea("onOpen"),Kr("getHotspot",tt.some),Kr("layouts",tt.none()),Kr("eventOrder",{}),ei("model",{},[Kr("getDisplayText",function(t){return t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.value}),Kr("selectsOver",!0),Kr("populateFromBrowse",!0)]),ea("onSetValue"),oa("onExecute"),ea("onItemExecute"),Kr("inputClasses",[]),Kr("inputAttributes",{}),Kr("inputStyles",{}),Kr("matchWidth",!0),Kr("useMinWidth",!1),Kr("dismissOnBlur",!0),ta(["openClass"]),Wr("initialData"),af("typeaheadBehaviours",[Um,Nm,Tv,xm,eg,Sv]),oi("previewing",function(){return nn(!0)})].concat(qv()).concat(Qv())),tb=Z([Rf({schema:[Zu()],name:"menu",overrides:function(o){return{fakeFocus:!0,onHighlight:function(n,e){o.previewing.get()?n.getSystem().getByUid(o.uid).each(function(t){Yv(o.model,t,e).fold(function(){return Tl.dehighlight(n,e)},function(t){return t()})}):n.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&Wv(o.model,t,e)}),o.previewing.set(!1)},onExecute:function(t,n){return t.getSystem().getByUid(o.uid).toOption().map(function(t){return ci(t,$v(),{item:n}),!0})},onHover:function(t,n){o.previewing.set(!1),t.getSystem().getByUid(o.uid).each(function(t){o.model.populateFromBrowse&&Wv(o.model,t,n)})}}}})]),nb=fl({name:"Typeahead",configFields:Zv(),partFields:tb(),factory:function(r,t,n,i){var e=function(t,n,e){r.previewing.set(!1);var o=Sv.getCoupled(t,"sandbox");tf.isOpen(o)?gl.getCurrent(o).each(function(t){Tl.getHighlighted(t).fold(function(){e(t)},function(){di(o,t.element(),"keydown",n)})}):Nv(r,u(t),t,o,i,function(t){gl.getCurrent(t).each(e)},ov.HighlightFirst).get(Q)},o=Kv(r),u=function(o){return function(t){return t.map(function(t){var n=Ft(t.menus),e=bt(n,function(t){return ft(t.items,function(t){return"item"===t.type})});return Nm.getState(o).update(ct(e,function(t){return t.data})),t})}},a=[Um.config({}),Nm.config({onSetValue:r.onSetValue,store:To({mode:"dataset",getDataKey:function(t){return _u(t.element())},getFallbackEntry:function(t){return{value:t,meta:{}}},setValue:function(t,n){Mu(t.element(),r.model.getDisplayText(n))}},r.initialData.map(function(t){return $t("initialValue",t)}).getOr({}))}),Tv.config({stream:{mode:"throttle",delay:r.responseTime,stopEvent:!1},onStream:function(t){var n=Sv.getCoupled(t,"sandbox");if(Um.isFocused(t)&&_u(t.element()).length>=r.minChars){var e=gl.getCurrent(n).bind(function(t){return Tl.getHighlighted(t).map(Nm.getValue)});r.previewing.set(!0),Nv(r,u(t),t,n,i,function(){gl.getCurrent(n).each(function(t){e.fold(function(){r.model.selectsOver&&Tl.highlightFirst(t)},function(n){Tl.highlightBy(t,function(t){return Nm.getValue(t).value===n.value}),Tl.getHighlighted(t).orThunk(function(){return Tl.highlightFirst(t),tt.none()})})})},ov.HighlightFirst).get(Q)}},cancelEvent:ue()}),xm.config({mode:"special",onDown:function(t,n){return e(t,n,Tl.highlightFirst),tt.some(!0)},onEscape:function(t){var n=Sv.getCoupled(t,"sandbox");return tf.isOpen(n)?(tf.close(n),tt.some(!0)):tt.none()},onUp:function(t,n){return e(t,n,Tl.highlightLast),tt.some(!0)},onEnter:function(n){var t=Sv.getCoupled(n,"sandbox"),e=tf.isOpen(t);if(e&&!r.previewing.get())return gl.getCurrent(t).bind(function(t){return Tl.getHighlighted(t)}).map(function(t){return ci(n,$v(),{item:t}),!0});var o=Nm.getValue(n);return ai(n,ue()),r.onExecute(t,n,o),e&&tf.close(t),tt.some(!0)}}),eg.config({toggleClass:r.markers.openClass,aria:{mode:"pressed",syncWithExpanded:!0}}),Sv.config({others:{sandbox:function(t){return Uv(r,t,{onOpen:U,onClose:U})}}}),sg("typeaheadevents",[Ii(function(t){var n=Q;Pv(r,u(t),t,i,n,ov.HighlightFirst).get(Q)}),Ci($v(),function(t,n){var e=Sv.getCoupled(t,"sandbox");Wv(r.model,t,n.event().item()),ai(t,ue()),r.onItemExecute(t,e,n.event().item(),Nm.getValue(t)),tf.close(e),Xv(t)})].concat(r.dismissOnBlur?[Ci($n(),function(t){var n=Sv.getCoupled(t,"sandbox");Pl(n.element()).isNone()&&tf.close(n)})]:[]))];return{uid:r.uid,dom:Jv(r),behaviours:To({},o,sf(r.typeaheadBehaviours,a)),eventOrder:r.eventOrder}}}),eb=function(t,n,e){var o=rb(t,n,e);return yv.sketch(o)},ob=function(t,n){return eb(t,n,[])},rb=function(t,n,e){return{dom:ib(e),components:t.toArray().concat([n])}},ib=function(t){return{tag:"div",classes:["tox-form__group"].concat(t)}},ub=function(t,n){return yv.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}})},ab=function(t){return"separator"===t.type},cb={type:"separator"},sb=function(t,e){var n=dt(t,function(t,n){return K(n)?""===n?t:"|"===n?0<t.length&&!ab(t[t.length-1])?t.concat([cb]):t:Vt(e,n.toLowerCase())?t.concat([e[n.toLowerCase()]]):t:t.concat([n])},[]);return 0<n.length&&ab(n[n.length-1])&&n.pop(),n},fb=function(t,n){return Vt(t,"getSubmenuItems")?(o=n,r=(e=t).getSubmenuItems(),i=lb(r,o),{item:e,menus:Gt(i.menus,$t(e.value,i.items)),expansions:Gt(i.expansions,$t(e.value,e.value))}):{item:t,menus:{},expansions:{}};var e,o,r,i},lb=function(t,r){var n=sb(K(t)?t.split(" "):t,r);return lt(n,function(t,n){var e=function(t){if(ab(t))return t;var n=Jt(t,"value").getOrThunk(function(){return Oo("generated-menu-item")});return Gt({value:n},t)}(n),o=fb(e,r);return{menus:Gt(t.menus,o.menus),items:[o.item].concat(t.items),expansions:Gt(t.expansions,o.expansions)}},{menus:{},expansions:{},items:[]})},db=function(t,e,o){var n=Oo("primary-menu"),r=lb(t,o.menuItems());if(0===r.items.length)return tt.none();var i=Th(n,r.items,e,o),u=At(r.menus,function(t,n){return Th(n,t,e,o)}),a=Gt(u,$t(n,i));return tt.from(Cg.tieredData(n,a,r.expansions))},mb=sl({name:"Input",configFields:qv(),factory:function(t){return{uid:t.uid,dom:Jv(t),components:[],behaviours:(n=t,To({},Kv(n),sf(n.inputBehaviours,[Nm.config({store:{mode:"manual",initialValue:n.data.getOr(undefined),getValue:function(t){return _u(t.element())},setValue:function(t,n){_u(t.element())!==n&&Mu(t.element(),n)}},onSetValue:n.onSetValue})]))),eventOrder:t.eventOrder};var n}}),gb=qn.detect().browser.isFirefox(),pb={position:"absolute",left:"-9999px"},hb=function(t,n,e){var o,r,i,u=function(t,n){var e=xe.fromTag("span",t.dom());ro(e,"role","presentation");var o=xe.fromText(n,t.dom());return Xe(e,o),e}(He(n),e);gb&&(o=n,r=u,i=Oo("ephox-alloy-aria-voice"),ro(r,"id",i),ro(o,"aria-describedby",i)),io(u,t(e)),ku(u,pb),Xe(n,u),b.setTimeout(function(){co(u,"aria-live"),Ke(u)},1e3)},vb=function(){return{"aria-live":"assertive","aria-atomic":"true",role:"alert"}},bb=["input","textarea"],yb=function(t){var n=Qe(t);return it(bb,n)},xb=function(t,n){var e=n.getRoot(t).getOr(t.element());hu(e,n.invalidClass),n.notify.each(function(n){yb(t.element())&&co(e,"title"),n.getContainer(t).each(function(t){$e(t,n.validHtml)}),n.onValid(t)})},wb=function(e,t,n,o){var r=t.getRoot(e).getOr(e.element());gu(r,t.invalidClass),t.notify.each(function(t){var n;yb(e.element())&&ro(e.element(),"title",o),n=gi(),hb(vb,n,o),t.getContainer(e).each(function(t){$e(t,o)}),t.onInvalid(e,o)})},Sb=function(n,t){return t.validator.fold(function(){return _v.pure(Lt.value(!0))},function(t){return t.validate(n)})},Cb=function(n,e){return e.notify.each(function(t){t.onValidate(n)}),Sb(n,e).map(function(t){return n.getSystem().isConnected()?t.fold(function(t){return wb(n,e,0,t),Lt.error(t)},function(t){return xb(n,e),Lt.value(t)}):Lt.error("No longer in system")})},kb=Object.freeze({markValid:xb,markInvalid:wb,query:Sb,run:Cb,isInvalid:function(t,n){var e=n.getRoot(t).getOr(t.element());return vu(e,n.invalidClass)}}),Ob=Object.freeze({events:function(n){return n.validator.map(function(t){return xi([Ci(t.onEvent,function(t){Cb(t,n).get(U)})].concat(t.validateOnLoad?[_i(function(t){Cb(t,n).get(Q)})]:[]))}).getOr({})}}),Eb=[Rr("invalidClass"),Kr("getRoot",tt.none),qr("notify",[Kr("aria","alert"),Kr("getContainer",tt.none),Kr("validHtml",""),ea("onValid"),ea("onInvalid"),ea("onValidate")]),qr("validator",[Rr("validate"),Kr("onEvent","input"),Kr("validateOnLoad",!0)])],Tb=ha({fields:Eb,name:"invalidating",active:Ob,apis:kb,extra:{validation:function(e){return function(t){var n=Nm.getValue(t);return _v.pure(e(n))}}}}),Bb=Object.freeze({exhibit:function(t,n){return nu({attributes:Qt([{key:n.tabAttr,value:"true"}])})}}),Db=[Kr("tabAttr","data-alloy-tabstop")],Ab=ha({fields:Db,name:"tabstopping",active:Bb}),_b=function(t){return{value:Z(t)}},Mb=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Fb=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Ib=function(t){return Mb.test(t)||Fb.test(t)},Vb=function(t){var n,e=(n=t.value().replace(Mb,function(t,n,e,o){return n+n+e+e+o+o}),{value:Z(n)});return Fb.exec(e.value())},Rb=function(t){var n=t.toString(16);return 1==n.length?"0"+n:n},Hb=function(t){var n=Rb(t.red())+Rb(t.green())+Rb(t.blue());return _b(n)},Nb=Math.min,zb=Math.max,Pb=Math.round,Lb=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,jb=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,Ub=function(t,n,e,o){return{red:Z(t),green:Z(n),blue:Z(e),alpha:Z(o)}},Wb=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},Gb=function(t){var n,e,o,r,i,u,a,c,s,f;if(i=(t.hue()||0)%360,u=t.saturation()/100,a=t.value()/100,u=zb(0,Nb(u,1)),a=zb(0,Nb(a,1)),0===u)return c=s=f=Pb(255*a),Ub(c,s,f,1);switch(n=i/60,o=(e=a*u)*(1-Math.abs(n%2-1)),r=a-e,Math.floor(n)){case 0:c=e,s=o,f=0;break;case 1:c=o,s=e,f=0;break;case 2:c=0,s=e,f=o;break;case 3:c=0,s=o,f=e;break;case 4:c=o,s=0,f=e;break;case 5:c=e,s=0,f=o;break;default:c=s=f=0}return c=Pb(255*(c+r)),s=Pb(255*(s+r)),f=Pb(255*(f+r)),Ub(c,s,f,1)},Xb=function(t){var n=Vb(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return Ub(e,o,r,1)},Yb=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return Ub(r,i,u,a)},qb=function(t){return"rgba("+t.red()+","+t.green()+","+t.blue()+","+t.alpha()+")"},Kb=Z(Ub(255,0,0,1)),Jb=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),$b="tinymce-custom-colors",Qb="choiceitem",Zb=[{type:Qb,text:"Turquoise",value:"#18BC9B"},{type:Qb,text:"Green",value:"#2FCC71"},{type:Qb,text:"Blue",value:"#3598DB"},{type:Qb,text:"Purple",value:"#9B59B6"},{type:Qb,text:"Navy Blue",value:"#34495E"},{type:Qb,text:"Dark Turquoise",value:"#18A085"},{type:Qb,text:"Dark Green",value:"#27AE60"},{type:Qb,text:"Medium Blue",value:"#2880B9"},{type:Qb,text:"Medium Purple",value:"#8E44AD"},{type:Qb,text:"Midnight Blue",value:"#2B3E50"},{type:Qb,text:"Yellow",value:"#F1C40F"},{type:Qb,text:"Orange",value:"#E67E23"},{type:Qb,text:"Red",value:"#E74C3C"},{type:Qb,text:"Light Gray",value:"#ECF0F1"},{type:Qb,text:"Gray",value:"#95A5A6"},{type:Qb,text:"Dark Yellow",value:"#F29D12"},{type:Qb,text:"Dark Orange",value:"#D35400"},{type:Qb,text:"Dark Red",value:"#E74C3C"},{type:Qb,text:"Medium Gray",value:"#BDC3C7"},{type:Qb,text:"Dark Gray",value:"#7E8C8D"},{type:Qb,text:"Black",value:"#000000"},{type:Qb,text:"White",value:"#ffffff"}],ty=function KD(r){void 0===r&&(r=10);var t,n=Jb.getItem($b),e=K(n)?JSON.parse(n):[],i=r-(t=e).length<0?t.slice(0,r):t,u=function(t){i.splice(t,1)};return{add:function(t){var n,e,o;(n=i,e=t,o=rt(n,e),-1===o?tt.none():tt.some(o)).each(u),i.unshift(t),i.length>r&&i.pop(),Jb.setItem($b,JSON.stringify(i))},state:function(){return i.slice(0)}}}(10),ny=function(t){var n,e=[];for(n=0;n<t.length;n+=2)e.push({text:t[n+1],value:"#"+t[n],type:"choiceitem"});return e},ey=function(t){return t.getParam("color_map")},oy=function(t,n){return t.getParam("color_cols",n,"number")},ry=function(t){return!1!==t.getParam("custom_colors")},iy=function(t){var n=ey(t);return n!==undefined?ny(n):Zb},uy=function(){return ct(ty.state(),function(t){return{type:Qb,text:t,value:t}})},ay=function(t){ty.add(t)},cy=function(t,e){var o;return t.dom.getParents(t.selection.getStart(),function(t){var n;(n=t.style["forecolor"===e?"color":"background-color"])&&(o=o||n)}),o},sy=function(t){return Math.max(5,Math.ceil(Math.sqrt(t)))},fy=function(t){var n=iy(t),e=sy(n.length);return oy(t,e)},ly=function(n,e,t,o){"custom"===t?py(n)(function(t){t.each(function(t){ay(t),n.execCommand("mceApplyTextcolor",e,t),o(t)})},"#000000"):"remove"===t?(o(""),n.execCommand("mceRemoveTextcolor",e)):(o(t),n.execCommand("mceApplyTextcolor",e,t))},dy=function(o,r){return function(t){var n,e;t(o.concat(uy().concat((e={type:n="choiceitem",text:"Remove color",icon:"color-swatch-remove-color",value:"remove"},r?[e,{type:n,text:"Custom color",icon:"color-picker",value:"custom"}]:[e]))))}},my=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)},gy=function(o,e,r,t,i){o.ui.registry.addSplitButton(e,{tooltip:t,presets:"color",icon:"forecolor"===e?"text-color":"highlight-bg-color",select:function(e){return tt.from(cy(o,r)).bind(function(t){return function(t){if("transparent"===t)return tt.some(Ub(0,0,0,0));if(Lb.test(t)){var n=Lb.exec(t);return tt.some(Yb(n[1],n[2],n[3],"1"))}if(jb.test(t)){var e=Lb.exec(t);return tt.some(Yb(e[1],e[2],e[3],e[4]))}return tt.none()}(t).map(
  function(t){var n=Hb(t).value();return Ln(e.toLowerCase(),n)})}).getOr(!1)},columns:fy(o),fetch:dy(iy(o),ry(o)),onAction:function(){null!==i.get()&&ly(o,r,i.get(),function(){})},onItemAction:function(n,t){ly(o,r,t,function(t){i.set(t),my(n,e,t)})},onSetup:function(t){return null!==i.get()&&my(t,e,i.get()),function(){}}})},py=function(i){return function(t,n){var e,o={colorpicker:n},r=(e=t,function(t){var n=t.getData();e(tt.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(tt.none())}})}},hy={register:function(t){var i;(i=t).addCommand("mceApplyTextcolor",function(t,n){var e,o,r;o=t,r=n,(e=i).undoManager.transact(function(){e.focus(),e.formatter.apply(o,{value:r}),e.nodeChanged()})}),i.addCommand("mceRemoveTextcolor",function(t){var n,e;e=t,(n=i).undoManager.transact(function(){n.focus(),n.formatter.remove(e,{value:null},null,!0),n.nodeChanged()})});var n=nn(null),e=nn(null);gy(t,"forecolor","forecolor","Text color",n),gy(t,"backcolor","hilitecolor","Background color",e)},getFetch:dy,colorPickerDialog:py,getCurrentColor:cy,getColorCols:fy,calcCols:sy},vy=Z([Rr("dom"),Rr("fetch"),ea("onOpen"),oa("onExecute"),Kr("getHotspot",tt.some),Kr("layouts",tt.none()),af("dropdownBehaviours",[eg,Sv,xm,Um]),Rr("toggleClass"),Kr("eventOrder",{}),Wr("lazySink"),Kr("matchWidth",!1),Kr("useMinWidth",!1),Wr("role")].concat(Qv())),by=Z([Rf({schema:[Zu()],name:"menu",defaults:function(t){return{onExecute:t.onExecute}}}),Fv()]),yy=fl({name:"Dropdown",configFields:vy(),partFields:by(),factory:function(n,t,e,o){var r,i,u=function(t){tf.getState(t).each(function(t){Cg.highlightPrimary(t)})},a={expand:function(t){eg.isOn(t)||Pv(n,function(t){return t},t,o,Q,ov.HighlightNone).get(Q)},open:function(t){eg.isOn(t)||Pv(n,function(t){return t},t,o,Q,ov.HighlightFirst).get(Q)},isOpen:eg.isOn,close:function(t){eg.isOn(t)&&Pv(n,function(t){return t},t,o,Q,ov.HighlightFirst).get(Q)}},c=function(t){return si(t),tt.some(!0)};return{uid:n.uid,dom:n.dom,components:t,behaviours:sf(n.dropdownBehaviours,[eg.config({toggleClass:n.toggleClass,aria:{mode:"expanded"}}),Sv.config({others:{sandbox:function(t){return Uv(n,t,{onOpen:function(){eg.on(t)},onClose:function(){eg.off(t)}})}}}),xm.config({mode:"special",onSpace:c,onEnter:c,onDown:function(t){if(yy.isOpen(t)){var n=Sv.getCoupled(t,"sandbox");u(n)}else yy.open(t);return tt.some(!0)},onEscape:function(t){return yy.isOpen(t)?(yy.close(t),tt.some(!0)):tt.none()}}),Um.config({})]),events:Og(tt.some(function(t){Pv(n,function(t){return t},t,o,u,ov.HighlightFirst).get(Q)})),eventOrder:To({},n.eventOrder,(r={},r[te()]=["disabling","toggling","alloy.base.behaviour"],r)),apis:a,domModification:{attributes:To({"aria-haspopup":"true"},n.role.fold(function(){return{}},function(t){return{role:t}}),"button"===n.dom.tag?{type:(i="type",Jt(n.dom,"attributes").bind(function(t){return Jt(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)}}}),xy=ha({fields:[],name:"unselecting",active:Object.freeze({events:function(){return xi([wi(wn(),Z(!0))])},exhibit:function(){return nu({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),wy=Oo("color-input-change"),Sy=Oo("color-swatch-change"),Cy=Oo("color-picker-cancel"),ky=function(t,n,o){var e,r,i=yv.parts().field({factory:mb,inputClasses:["tox-textfield"],onSetValue:function(t){return Tb.run(t).get(function(){})},inputBehaviours:ga([Ab.config({}),Tb.config({invalidClass:"tox-textbox-field-invalid",getRoot:function(t){return ze(t.element())},notify:{onValid:function(t){var n=Nm.getValue(t);ci(t,wy,{color:n})}},validator:{validateOnLoad:!1,validate:function(t){var n=Nm.getValue(t);if(0===n.length)return _v.pure(Lt.value(!0));var e=xe.fromTag("span");Cu(e,"background-color",n);var o=Tu(e,"background-color").fold(function(){return Lt.error("blah")},function(){return Lt.value(n)});return _v.pure(o)}}})]),selectOnFocus:!1}),u=t.label.map(function(t){return ub(t,n.providers)}),a=function(t,n){ci(t,Sy,{value:n})},c=Tg((e={dom:{tag:"span",attributes:{"aria-label":n.providers.translate("Color swatch")}},layouts:tt.some({onRtl:function(){return[Tc]},onLtr:function(){return[Bc]}}),components:[],fetch:hy.getFetch(o.getColors(),o.hasCustomColors()),onItemAction:function(e){n.getSink().each(function(t){c.getOpt(t).each(function(n){"custom"===e?o.colorPicker(function(t){t.fold(function(){return ai(n,Cy)},function(t){a(n,t),ay(t)})},"#ffffff"):a(n,"remove"===e?"":e)})})}},r=n,yy.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:ga([xy.config({}),Ab.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:r.getSink,fetch:function(){return _v.nu(function(t){return e.fetch(t)}).map(function(t){return tt.from(Bh(Gt(Eh(Oo("menu-value"),t,function(t){e.onItemAction(t)},5,"color",Yp.CLOSE_ON_EXECUTE,function(){return!1},r.providers),{movement:gh(5,"color")})))})},parts:{menu:mh(0,0,"color")}})));return yv.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:u.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[i,c.asSpec()]}]),fieldBehaviours:ga([sg("form-field-events",[Ci(wy,function(t,n){c.getOpt(t).each(function(t){Cu(t.element(),"background-color",n.event().color())})}),Ci(Sy,function(n,e){yv.getField(n).each(function(t){Nm.setValue(t,e.event().value()),gl.getCurrent(n).each(Um.focus)})}),Ci(Cy,function(t){yv.getField(t).each(function(){gl.getCurrent(t).each(Um.focus)})})])])})},Oy=qn.detect().deviceType.isTouch(),Ey=Hf({schema:[Rr("dom")],name:"label"}),Ty=function(t){return Hf({name:t+"-edge",overrides:function(o){return o.model.manager.edgeActions[t].fold(function(){return{}},function(e){var t=xi([ki(rn(),e,[o])]),n=xi([ki(cn(),e,[o]),ki(sn(),function(t,n){n.mouseIsDown.get()&&e(t,n)},[o])]);return{events:Oy?t:n}})}})},By=Ty("top-left"),Dy=Ty("top"),Ay=Ty("top-right"),_y=Ty("right"),My=Ty("bottom-right"),Fy=Ty("bottom"),Iy=Ty("bottom-left"),Vy=[Ey,Ty("left"),_y,Dy,Fy,By,Ay,Iy,My,Vf({name:"thumb",defaults:Z({dom:{styles:{position:"absolute"}}}),overrides:function(t){return{events:xi([Ei(rn(),t,"spectrum"),Ei(un(),t,"spectrum"),Ei(an(),t,"spectrum"),Ei(cn(),t,"spectrum"),Ei(sn(),t,"spectrum"),Ei(ln(),t,"spectrum")])}}}),Vf({schema:[oi("mouseIsDown",function(){return nn(!1)})],name:"spectrum",overrides:function(e){var o=e.model.manager,r=function(n,t){return o.getValueFromEvent(t).map(function(t){return o.setValueFrom(n,e,t)})},t=xi([Ci(rn(),r),Ci(un(),r)]),n=xi([Ci(cn(),r),Ci(sn(),function(t,n){e.mouseIsDown.get()&&r(t,n)})]);return{behaviours:ga(Oy?[]:[xm.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)}}),Um.config({})]),events:Oy?t:n}}})],Ry=qn.detect().deviceType.isTouch(),Hy=Z("slider.change.value"),Ny=function(t){var n=t.event().raw();if(Ry){var e=n;return e.touches!==undefined&&1===e.touches.length?tt.some(e.touches[0]).map(function(t){return Oa(t.clientX,t.clientY)}):tt.none()}var o=n;return o.clientX!==undefined?tt.some(o).map(function(t){return Oa(t.clientX,t.clientY)}):tt.none()},zy=function(t,n,e,o){return t<n?t:e<t?e:t===n?n-1:Math.max(n,t-o)},Py=function(t,n,e,o){return e<t?t:t<n?n:t===e?e+1:Math.min(e,t+o)},Ly=function(t,n,e){return Math.max(n,Math.min(e,t))},jy=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,C=(x=r,w=l,S=d,Math.min(S,Math.max(x,w))-w),k=Ly(C/m*o+n,g,p);return u&&n<=k&&k<=e?(h=k,v=n,b=e,y=i,a.fold(function(){var t=h-v,n=Math.round(t/y)*y;return Ly(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(k):k},Uy=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},Wy=function(t){return t.model.minX},Gy=function(t){return t.model.minY},Xy=function(t){return t.model.minX-1},Yy=function(t){return t.model.minY-1},qy=function(t){return t.model.maxX},Ky=function(t){return t.model.maxY},Jy=function(t){return t.model.maxX+1},$y=function(t){return t.model.maxY+1},Qy=function(t,n,e){return n(t)-e(t)},Zy=function(t){return Qy(t,qy,Wy)},tx=function(t){return Qy(t,Ky,Gy)},nx=function(t){return Zy(t)/2},ex=function(t){return tx(t)/2},ox=function(t){return t.stepSize},rx=function(t){return t.snapToGrid},ix=function(t){return t.snapStart},ux=function(t){return t.rounded},ax=function(t,n){return t[n+"-edge"]!==undefined},cx=function(t){return ax(t,"left")},sx=function(t){return ax(t,"right")},fx=function(t){return ax(t,"top")},lx=function(t){return ax(t,"bottom")},dx=function(t){return t.model.value.get()},mx=function(t){return{x:Z(t)}},gx=function(t){return{y:Z(t)}},px=function(t,n){return{x:Z(t),y:Z(n)}},hx=function(t,n){ci(t,Hy(),{value:n})},vx="left",bx=function(t){return t.element().dom().getBoundingClientRect()},yx=function(t,n){return t[n]},xx=function(t){var n=bx(t);return yx(n,vx)},wx=function(t){var n=bx(t);return yx(n,"right")},Sx=function(t){var n=bx(t);return yx(n,"top")},Cx=function(t){var n=bx(t);return yx(n,"bottom")},kx=function(t){var n=bx(t);return yx(n,"width")},Ox=function(t){var n=bx(t);return yx(n,"height")},Ex=function(t,n,e){return(t+n)/2-e},Tx=function(t,n){var e=bx(t),o=bx(n),r=yx(e,vx),i=yx(e,"right"),u=yx(o,vx);return Ex(r,i,u)},Bx=function(t,n){var e=bx(t),o=bx(n),r=yx(e,"top"),i=yx(e,"bottom"),u=yx(o,"top");return Ex(r,i,u)},Dx=function(t,n){ci(t,Hy(),{value:n})},Ax=function(t){return{x:Z(t)}},_x=function(t,n,e){var o={min:Wy(n),max:qy(n),range:Zy(n),value:e,step:ox(n),snap:rx(n),snapStart:ix(n),rounded:ux(n),hasMinEdge:cx(n),hasMaxEdge:sx(n),minBound:xx(t),maxBound:wx(t),screenRange:kx(t)};return jy(o)},Mx=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Py:zy)(dx(r).x(),Wy(r),qy(r),ox(r)),Dx(o,Ax(i)),tt.some(i)).map(function(){return!0});var e,o,r,i}},Fx=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=kx(u=n),d=s.bind(function(t){return tt.some(Tx(t,u))}).getOr(0),m=f.bind(function(t){return tt.some(Tx(t,u))}).getOr(l),g={min:Wy(a),max:qy(a),range:Zy(a),value:c,hasMinEdge:cx(a),hasMaxEdge:sx(a),minBound:xx(u),minOffset:0,maxBound:wx(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Uy(g));return xx(n)-xx(t)+p},Ix=Mx(-1),Vx=Mx(1),Rx=tt.none,Hx=tt.none,Nx={"top-left":tt.none(),top:tt.none(),"top-right":tt.none(),right:tt.some(function(t,n){hx(t,mx(Jy(n)))}),"bottom-right":tt.none(),bottom:tt.none(),"bottom-left":tt.none(),left:tt.some(function(t,n){hx(t,mx(Xy(n)))})},zx=Object.freeze({setValueFrom:function(t,n,e){var o=_x(t,n,e),r=Ax(o);return Dx(t,r),o},setToMin:function(t,n){var e=Wy(n);Dx(t,Ax(e))},setToMax:function(t,n){var e=qy(n);Dx(t,Ax(e))},findValueOfOffset:_x,getValueFromEvent:function(t){return Ny(t).map(function(t){return t.left()})},findPositionOfValue:Fx,setPositionFromValue:function(t,n,e,o){var r=dx(e),i=Fx(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=_a(n.element())/2;Cu(n.element(),"left",i-u+"px")},onLeft:Ix,onRight:Vx,onUp:Rx,onDown:Hx,edgeActions:Nx}),Px=function(t,n){ci(t,Hy(),{value:n})},Lx=function(t){return{y:Z(t)}},jx=function(t,n,e){var o={min:Gy(n),max:Ky(n),range:tx(n),value:e,step:ox(n),snap:rx(n),snapStart:ix(n),rounded:ux(n),hasMinEdge:fx(n),hasMaxEdge:lx(n),minBound:Sx(t),maxBound:Cx(t),screenRange:Ox(t)};return jy(o)},Ux=function(u){return function(t,n){return(e=u,o=t,r=n,i=(0<e?Py:zy)(dx(r).y(),Gy(r),Ky(r),ox(r)),Px(o,Lx(i)),tt.some(i)).map(function(){return!0});var e,o,r,i}},Wx=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=Ox(u=n),d=s.bind(function(t){return tt.some(Bx(t,u))}).getOr(0),m=f.bind(function(t){return tt.some(Bx(t,u))}).getOr(l),g={min:Gy(a),max:Ky(a),range:tx(a),value:c,hasMinEdge:fx(a),hasMaxEdge:lx(a),minBound:Sx(u),minOffset:0,maxBound:Cx(u),maxOffset:l,centerMinEdge:d,centerMaxEdge:m},Uy(g));return Sx(n)-Sx(t)+p},Gx=tt.none,Xx=tt.none,Yx=Ux(-1),qx=Ux(1),Kx={"top-left":tt.none(),top:tt.some(function(t,n){hx(t,gx(Yy(n)))}),"top-right":tt.none(),right:tt.none(),"bottom-right":tt.none(),bottom:tt.some(function(t,n){hx(t,gx($y(n)))}),"bottom-left":tt.none(),left:tt.none()},Jx=Object.freeze({setValueFrom:function(t,n,e){var o=jx(t,n,e),r=Lx(o);return Px(t,r),o},setToMin:function(t,n){var e=Gy(n);Px(t,Lx(e))},setToMax:function(t,n){var e=Ky(n);Px(t,Lx(e))},findValueOfOffset:jx,getValueFromEvent:function(t){return Ny(t).map(function(t){return t.top()})},findPositionOfValue:Wx,setPositionFromValue:function(t,n,e,o){var r=dx(e),i=Wx(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),u=Ia(n.element())/2;Cu(n.element(),"top",i-u+"px")},onLeft:Gx,onRight:Xx,onUp:Yx,onDown:qx,edgeActions:Kx}),$x=function(t,n){ci(t,Hy(),{value:n})},Qx=function(t,n){return{x:Z(t),y:Z(n)}},Zx=function(s,f){return function(t,n){return(e=s,o=f,r=t,i=n,u=0<e?Py:zy,a=o?dx(i).x():u(dx(i).x(),Wy(i),qy(i),ox(i)),c=o?u(dx(i).y(),Gy(i),Ky(i),ox(i)):dx(i).y(),$x(r,Qx(a,c)),tt.some(a)).map(function(){return!0});var e,o,r,i,u,a,c}},tw=Zx(-1,!1),nw=Zx(1,!1),ew=Zx(-1,!0),ow=Zx(1,!0),rw={"top-left":tt.some(function(t,n){hx(t,px(Xy(n),Yy(n)))}),top:tt.some(function(t,n){hx(t,px(nx(n),Yy(n)))}),"top-right":tt.some(function(t,n){hx(t,px(Jy(n),Yy(n)))}),right:tt.some(function(t,n){hx(t,px(Jy(n),ex(n)))}),"bottom-right":tt.some(function(t,n){hx(t,px(Jy(n),$y(n)))}),bottom:tt.some(function(t,n){hx(t,px(nx(n),$y(n)))}),"bottom-left":tt.some(function(t,n){hx(t,px(Xy(n),$y(n)))}),left:tt.some(function(t,n){hx(t,px(Xy(n),ex(n)))})},iw=Object.freeze({setValueFrom:function(t,n,e){var o=_x(t,n,e.left()),r=jx(t,n,e.top()),i=Qx(o,r);return $x(t,i),i},setToMin:function(t,n){var e=Wy(n),o=Gy(n);$x(t,Qx(e,o))},setToMax:function(t,n){var e=qy(n),o=Ky(n);$x(t,Qx(e,o))},getValueFromEvent:function(t){return Ny(t)},setPositionFromValue:function(t,n,e,o){var r=dx(e),i=Fx(t,o.getSpectrum(t),r.x(),o.getLeftEdge(t),o.getRightEdge(t),e),u=Wx(t,o.getSpectrum(t),r.y(),o.getTopEdge(t),o.getBottomEdge(t),e),a=_a(n.element())/2,c=Ia(n.element())/2;Cu(n.element(),"left",i-a+"px"),Cu(n.element(),"top",u-c+"px")},onLeft:tw,onRight:nw,onUp:ew,onDown:ow,edgeActions:rw}),uw=qn.detect().deviceType.isTouch(),aw=[Kr("stepSize",1),Kr("onChange",Q),Kr("onChoose",Q),Kr("onInit",Q),Kr("onDragStart",Q),Kr("onDragEnd",Q),Kr("snapToGrid",!1),Kr("rounded",!0),Wr("snapStart"),Hr("model",Br("mode",{x:[Kr("minX",0),Kr("maxX",100),oi("value",function(t){return nn(t.mode.minX)}),Rr("getInitialValue"),ua("manager",zx)],y:[Kr("minY",0),Kr("maxY",100),oi("value",function(t){return nn(t.mode.minY)}),Rr("getInitialValue"),ua("manager",Jx)],xy:[Kr("minX",0),Kr("maxX",100),Kr("minY",0),Kr("maxY",100),oi("value",function(t){return nn({x:Z(t.mode.minX),y:Z(t.mode.minY)})}),Rr("getInitialValue"),ua("manager",iw)]})),af("sliderBehaviours",[xm,Nm])].concat(uw?[]:[oi("mouseIsDown",function(){return nn(!1)})]),cw=qn.detect().deviceType.isTouch(),sw=fl({name:"Slider",configFields:aw,partFields:Vy,factory:function(r,t){var i=function(t){return Jf(t,r,"thumb")},u=function(t){return Jf(t,r,"spectrum")},e=function(t){return Kf(t,r,"left-edge")},o=function(t){return Kf(t,r,"right-edge")},a=function(t){return Kf(t,r,"top-edge")},c=function(t){return Kf(t,r,"bottom-edge")},s=r.model,f=s.manager,l=function(t,n){f.setPositionFromValue(t,n,r,{getLeftEdge:e,getRightEdge:o,getTopEdge:a,getBottomEdge:c,getSpectrum:u})},d=function(t,n){s.value.set(n);var e=i(t);return l(t,e),r.onChange(t,e,n),tt.some(!0)},n=[Ci(rn(),function(t){r.onDragStart(t,i(t))}),Ci(an(),function(t){r.onDragEnd(t,i(t))})],m=[Ci(cn(),function(t,n){n.stop(),r.onDragStart(t,i(t)),r.mouseIsDown.set(!0)}),Ci(ln(),function(t){r.onDragEnd(t,i(t))})],g=cw?n:m;return{uid:r.uid,dom:r.dom,components:t,behaviours:sf(r.sliderBehaviours,vt([cw?[]:[xm.config({mode:"special",focusIn:function(t){return Kf(t,r,"spectrum").map(xm.focusIn).map(Z(!0))}})],[Nm.config({store:{mode:"manual",getValue:function(){return s.value.get()}}}),Sa.config({channels:{"mouse.released":{onReceive:function(e){var t=r.mouseIsDown.get();r.mouseIsDown.set(!1),t&&Kf(e,r,"thumb").each(function(t){var n=s.value.get();r.onChoose(e,t,n)})}}}})]])),events:xi([Ci(Hy(),function(t,n){d(t,n.event().value())}),_i(function(t){var n=s.getInitialValue();s.value.set(n);var e=i(t);l(t,e);var o=u(t);r.onInit(t,e,o,s.value.get())})].concat(g)),apis:{resetToMin:function(t){f.setToMin(t,r)},resetToMax:function(t){f.setToMax(t,r)},changeValue:d,refresh:l},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)}}}),fw=Z(Oo("rgb-hex-update")),lw=Z(Oo("slider-update")),dw=Z(Oo("palette-update")),mw=function(t,e){var o=sw.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[e("sv-palette-spectrum")]}}),r=sw.parts().thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[e("sv-palette-thumb")],innerHtml:"<div class="+e("sv-palette-inner-thumb")+' role="presentation"></div>'}}),i=function(t,n){var e=t.width,o=t.height,r=t.getContext("2d");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 sl({factory:function(){var t=Z({x:Z(0),y:Z(0)}),n=ga([gl.config({find:tt.some}),Um.config({})]);return sw.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[e("sv-palette")]},model:{mode:"xy",getInitialValue:t},rounded:!1,components:[o,r],onChange:function(t,n,e){ci(t,dw(),{value:e})},onInit:function(t,n,e){i(e.element().dom(),qb(Kb()))},sliderBehaviours:n})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),i(r,qb(o))}},extraApis:{}})},gw=function(t,n){var e=sw.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=sw.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}});return sw.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:Z({y:Z(0)})},components:[e,o],sliderBehaviours:ga([Um.config({})]),onChange:function(t,n,e){ci(t,lw(),{value:e})}})},pw=[af("formBehaviours",[Nm])],hw=function(t){return"<alloy.field."+t+">"},vw=function(o,t){return{uid:o.uid,dom:o.dom,components:t,behaviours:sf(o.formBehaviours,[Nm.config({store:{mode:"manual",getValue:function(t){var n=Qf(t,o);return At(n,function(t){return t().bind(function(t){var n,e=gl.getCurrent(t);return n="missing current",e.fold(function(){return Lt.error(n)},Lt.value)}).map(Nm.getValue)})},setValue:function(e,t){Dt(t,function(n,t){Kf(e,o,t).each(function(t){gl.getCurrent(t).each(function(t){Nm.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return Kf(t,o,n).bind(gl.getCurrent)}}}},bw={getField:$i(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),Wf("form",hw(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=ct(r,function(t){return Vf({name:t,pname:hw(t)})});return il("form",pw,i,vw,o)}},yw=Oo("valid-input"),xw=Oo("invalid-input"),ww=Oo("validating-input"),Sw="colorcustom.rgb.",Cw=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(Sw+"range"),c=[yv.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),yv.parts().field({data:r,factory:mb,inputAttributes:To({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:ga([(i=n,u=t,Tb.config({invalidClass:m("invalid"),notify:{onValidate:function(t){ci(t,ww,{type:i})},onValid:function(t){ci(t,yw,{type:i,value:Nm.getValue(t)})},onInvalid:function(t){ci(t,xw,{type:i,value:Nm.getValue(t)})}},validator:{validate:function(t){var n=Nm.getValue(t),e=u(n)?Lt.value(!0):Lt.error(d("aria.input.invalid"));return _v.pure(e)},validateOnLoad:!1}})),Ab.config({})]),onSetValue:function(t){Tb.isInvalid(t)&&Tb.run(t).get(Q)}})],s="hex"!==n?[yv.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();Nm.setValue(t,{red:e,green:o,blue:r})},b=Tg({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){Cu(t.element(),"background-color","#"+n.value())})};return sl({factory:function(){var e={red:Z(nn(tt.some(255))),green:Z(nn(tt.some(255))),blue:Z(nn(tt.some(255))),hex:Z(nn(tt.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",tt.some(n)),i("green",tt.some(e)),i("blue",tt.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),tt.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,tt.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return Ub(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=Hb(t),bw.getField(n,"hex").each(function(t){Um.isFocused(t)||Nm.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=_b(n);i("hex",tt.some(n));var o=Xb(e);v(t,o),r(o),ci(t,fw(),{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(Sw+t+".label"),description:d(Sw+t+".description")}},c=t("red"),s=t("green"),f=t("blue"),l=t("hex");return Gt(bw.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",yv.sketch(h(Wb,"red",c.label,c.description,255))),t.field("green",yv.sketch(h(Wb,"green",s.label,s.description,255))),t.field("blue",yv.sketch(h(Wb,"blue",f.label,f.description,255))),t.field("hex",yv.sketch(h(Ib,"hex",l.label,l.description,"ffffff"))),b.asSpec()],formBehaviours:ga([Tb.config({invalidClass:m("form-invalid")}),sg("rgb-form-events",[Ci(yw,a),Ci(xw,n),Ci(ww,n)])])}}),{apis:{updateHex:function(t,n){var e,o;Nm.setValue(t,{hex:n.value()}),e=t,o=Xb(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},kw=function(t,n,e){return{hue:Z(t),saturation:Z(n),value:Z(e)}},Ow=function(c,s){return sl({name:"ColourPicker",configFields:[Kr("onValidHex",Q),Kr("onInvalidHex",Q),Xr("formChangeEvent")],factory:function(t){var u,h,e=Cw(c,s,t.onValidHex,t.onInvalidHex),o=mw(c,s),v={paletteRgba:Z(nn(Kb()))},n=Tg(o.sketch({})),r=Tg(e.sketch({})),i=function(t,e){n.getOpt(t).each(function(t){var n=Xb(e);v.paletteRgba().set(n),o.setRgba(t,n)})},a=function(t,n){r.getOpt(t).each(function(t){e.updateHex(t,n)})},b=function(n,e,t){st(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[n.asSpec(),gw(c,s),r.asSpec()],behaviours:ga([sg("colour-picker-events",[Ci(dw(),(h=[a],function(t,n){var e,o,r,i,u,a,c,s,f,l=n.event().value(),d=(c=u=0,o=(e=v.paletteRgba().get()).red()/255,r=e.green()/255,i=e.blue()/255,(s=Math.min(o,Math.min(r,i)))===(f=Math.max(o,Math.max(r,i)))?kw(0,0,100*(c=s)):(u=60*((u=o===s?3:i===s?1:5)-(o===s?r-i:i===s?o-r:i-o)/(f-s)),a=(f-s)/f,c=f,kw(Math.round(u),Math.round(100*a),Math.round(100*c)))),m=kw(d.hue(),l.x(),100-l.y()),g=Gb(m),p=Hb(g);b(t,p,h)})),Ci(lw(),(u=[i,a],function(t,n){var e,o,r,i=(e=n.event().value().y(),o=kw(360*(100-e/100),100,100),r=Gb(o),Hb(r));b(t,i,u)}))]),gl.config({find:function(t){return r.getOpt(t)}}),xm.config({mode:"acyclic"})])}}})},Ew=function(){return gl.config({find:tt.some})},Tw=function(t){return gl.config({find:t.getOpt})},Bw=function(t){return gl.config({find:function(n){return je(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},Dw={"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"},Aw=function(t){return Dw[t]},_w=dr([Kr("preprocess",U),Kr("postprocess",U)]),Mw=function(t,n,e){return Nm.config(Gt({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},Fw=function(t,n,e){return Mw(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},Iw=function(r,t){var i=Er("RepresentingConfigs.memento processors",_w,t);return Nm.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=Nm.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);Nm.setValue(o,e)}}})},Vw=Mw,Rw=function(t){return Fw(t,Je,$e)},Hw=function(t){return Nm.config({store:{mode:"memory",initialValue:t}})},Nw=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){st(t,function(t){t(n,e)})}},i=function(t,n){if(!Np.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;Nm.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),ft(Et(e),function(t){return o.test(t.name)}))),ci(t,cv,{name:r.name})},c=Tg({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:ga([sg("input-file-events",[Bi(oe())])])}),t=r.label.map(function(t){return ub(t,n)}),s=yv.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:ga([Hw([]),Ew(),Np.config({}),eg.config({toggleClass:"dragenter",toggleOnExecute:!1}),sg("dropzone-events",[Ci("dragenter",o([e,eg.toggle])),Ci("dragleave",o([e,eg.toggle])),Ci("dragover",e),Ci("drop",o([e,i])),Ci(bn(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},Eg.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:ga([Ab.config({})])})]}]}}}});return eb(t,s,["tox-form__group--stretched"])},zw=Oo("alloy-fake-before-tabstop"),Pw=Oo("alloy-fake-after-tabstop"),Lw=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:ga([Um.config({ignore:!0}),Ab.config({})])}},jw=function(t,n){ci(t,pn(),{raw:{which:9,shiftKey:n}})},Uw=function(t){return Rh(t,["."+zw,"."+Pw].join(","),Z(!1))},Ww=function(t,n){var e=n.element();vu(e,zw)?jw(t,!0):vu(e,Pw)&&jw(t,!1)},Gw=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[Lw([zw]),t,Lw([Pw])],behaviours:ga([Bw(1)])}},Xw=!(qn.detect().browser.isIE()||qn.detect().browser.isEdge()),Yw=function(t,n){var o,r,e=Xw&&t.sandboxed,i=To({},t.label.map(function(t){return{title:t}}).getOr({}),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=nn(""),{getValue:function(){return r.get()},setValue:function(t,n){if(o)ro(t.element(),"src","data:text/html;charset=utf-8,"+encodeURIComponent(n));else{ro(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 ub(t,n)}),c=yv.parts().field({factory:{sketch:function(t){return Gw({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:ga([Ab.config({}),Um.config({}),Vw(tt.none(),u.getValue,u.setValue)])})}}});return eb(a,c,["tox-form__group--stretched"])},qw={create:e,clone:function JD(t){var n;return r(n=e(t.width,t.height)).drawImage(t,0,0),n},resize:i,get2dContext:r,get3dContext:function $D(t){var n=null;try{n=t.getContext("webgl")||t.getContext("experimental-webgl")}catch(M){}return n||(n=null),n}},Kw={getWidth:function QD(t){return t.naturalWidth||t.width},getHeight:function ZD(t){return t.naturalHeight||t.height}},Jw=window.Promise?window.Promise:function(){function c(t,n){return function(){t.apply(n,arguments)}}function i(e){var o=this;null!==this._state?t(function(){var t=o._state?e.onFulfilled:e.onRejected;if(null!==t){var n;try{n=t(o._value)}catch(f){return void e.reject(f)}e.resolve(n)}else(o._state?e.resolve:e.reject)(o._value)}):this._deferreds.push(e)}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void a(c(n,t),c(r,this),c(e,this))}this._state=!0,this._value=t,o.call(this)}catch(f){e.call(this,f)}}function e(t){this._state=!1,this._value=t,o.call(this)}function o(){for(var t=0,n=this._deferreds.length;t<n;t++)i.call(this,this._deferreds[t]);this._deferreds=null}function u(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 a(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)}}var s=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=[],a(t,c(r,this),c(e,this))},t=s.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){b.setTimeout(t,1)},f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};return s.prototype["catch"]=function(t){return this.then(null,t)},s.prototype.then=function(e,o){var r=this;return new s(function(t,n){i.call(r,new u(e,o,t,n))})},s.all=function(t){var a=Array.prototype.slice.call(1===arguments.length&&f(t)?arguments[0]:arguments);return new s(function(o,r){function i(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){i(n,t)},r)}a[n]=t,0==--u&&o(a)}catch(c){r(c)}}if(0===a.length)return o([]);for(var u=a.length,t=0;t<a.length;t++)i(t,a[t])})},s.resolve=function(n){return n&&"object"==typeof n&&n.constructor===s?n:new s(function(t){t(n)})},s.reject=function(e){return new s(function(t,n){n(e)})},s.race=function(r){return new s(function(t,n){for(var e=0,o=r.length;e<o;e++)r[e].then(t,n)})},s}(),$w={atob:function(t){return Te.getOrDie("atob")(t)},requestAnimationFrame:function(t){Te.getOrDie("requestAnimationFrame")(t)}},Qw={blobToImage:a,imageToBlob:function tA(t){var n=t.src;return 0===n.indexOf("data:")?d(n):f(n)},blobToArrayBuffer:function nA(e){return new Jw(function(t){var n=u();n.onloadend=function(){t(n.result)},n.readAsArrayBuffer(e)})},blobToDataUri:m,blobToBase64:function eA(t){return m(t).then(function(t){return t.split(",")[1]})},dataUriToBlobSync:l,canvasToBlob:function oA(t,e,o){return e=e||"image/png",b.HTMLCanvasElement.prototype.toBlob?new Jw(function(n){t.toBlob(function(t){n(t)},e,o)}):d(t.toDataURL(e,o))},canvasToDataURL:function rA(t,n,e){return n=n||"image/png",t.then(function(t){return t.toDataURL(n,e)})},blobToCanvas:function iA(t){return a(t).then(function(t){var n;return function M(n){b.URL.revokeObjectURL(n.src)}(t),n=qw.create(Kw.getWidth(t),Kw.getHeight(t)),qw.get2dContext(n).drawImage(t,0,0),n})},uriToBlob:function uA(t
  ){return 0===t.indexOf("blob:")?f(t):0===t.indexOf("data:")?d(t):null}},Zw={fromBlob:p,fromCanvas:function aA(n,t){return Qw.canvasToBlob(n,t).then(function(t){return g(Jw.resolve(n),t,n.toDataURL())})},fromImage:function cA(t){return Qw.imageToBlob(t).then(function(t){return p(t)})},fromBlobAndUrlSync:function(t,n){return g(Qw.blobToCanvas(t),t,n)}},tS=function(t){return Zw.fromBlob(t)},nS=[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],eS={identity:function sA(){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]},adjust:S,multiply:w,adjustContrast:function fA(t,n){var e;return n=x(n,-1,1),w(t,[(e=(n*=100)<0?127+n/100*127:127*(e=0==(e=n%1)?nS[n]:nS[Math.floor(n)]*(1-e)+nS[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])},adjustBrightness:function lA(t,n){return w(t,[1,0,0,0,n=x(255*n,-255,255),0,1,0,0,n,0,0,1,0,n,0,0,0,1,0,0,0,0,0,1])},adjustSaturation:function dA(t,n){var e;return w(t,[.3086*(1-(e=1+(0<(n=x(n,-1,1))?3*n:n)))+e,.6094*(1-e),.082*(1-e),0,0,.3086*(1-e),.6094*(1-e)+e,.082*(1-e),0,0,.3086*(1-e),.6094*(1-e),.082*(1-e)+e,0,0,0,0,0,1,0,0,0,0,0,1])},adjustHue:function mA(t,n){var e,o;return n=x(n,-180,180)/180*Math.PI,w(t,[.213+.787*(e=Math.cos(n))+-.213*(o=Math.sin(n)),.715+-.715*e+-.715*o,.072+-.072*e+.928*o,0,0,.213+-.213*e+.143*o,.715+e*(1-.715)+.14*o,.072+-.072*e+-.283*o,0,0,.213+-.213*e+-.787*o,.715+-.715*e+.715*o,.072+.928*e+.072*o,0,0,0,0,0,1,0,0,0,0,0,1])},adjustColors:function gA(t,n,e,o){return w(t,[n=x(n,0,2),0,0,0,0,0,e=x(e,0,2),0,0,0,0,0,o=x(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])},adjustSepia:function pA(t,n){return w(t,S([.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0,0,0,0,0,1],n=x(n,0,1)))},adjustGrayscale:function hA(t,n){return w(t,S([.33,.34,.33,0,0,.33,.34,.33,0,0,.33,.34,.33,0,0,0,0,0,1,0,0,0,0,0,1],n=x(n,0,1)))}},oS={invert:function vA(n){return function(t){return C(t,n)}}([-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0]),brightness:E(eS.adjustBrightness),hue:E(eS.adjustHue),saturate:E(eS.adjustSaturation),contrast:E(eS.adjustContrast),grayscale:E(eS.adjustGrayscale),sepia:E(eS.adjustSepia),colorize:function(t,n,e,o){return C(t,eS.adjustColors(eS.identity(),n,e,o))},sharpen:T([0,-1,0,-1,5,-1,0,-1,0]),emboss:T([-2,-1,0,-1,1,1,0,1,2]),gamma:O(function(t,n){return 255*Math.pow(t/255,1-n)}),exposure:O(function(t,n){return 255*(1-Math.exp(-t/255*n))}),colorFilter:C,convoluteFilter:k},rS={scale:function bA(t,n,e){var o=Kw.getWidth(t),r=Kw.getHeight(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 Jw(function(t){var n=Kw.getWidth(u),e=Kw.getHeight(u),o=Math.floor(n*a),r=Math.floor(e*c),i=qw.create(o,r);qw.get2dContext(i).drawImage(u,0,0,n,e,0,0,o,r),t(i)})}(t,i,u);return a?c.then(function(t){return bA(t,n,e)}):c}},iS={rotate:function yA(n,e){return n.toCanvas().then(function(t){return function a(t,n,e){var o=qw.create(t.width,t.height),r=qw.get2dContext(o),i=0,u=0;return 90!=(e=e<0?360+e:e)&&270!=e||qw.resize(o,o.height,o.width),90!=e&&180!=e||(i=o.width),270!=e&&180!=e||(u=o.height),r.translate(i,u),r.rotate(e*Math.PI/180),r.drawImage(t,0,0),Zw.fromCanvas(o,n)}(t,n.getType(),e)})},flip:function xA(n,e){return n.toCanvas().then(function(t){return function i(t,n,e){var o=qw.create(t.width,t.height),r=qw.get2dContext(o);return"v"==e?(r.scale(1,-1),r.drawImage(t,0,-o.height)):(r.scale(-1,1),r.drawImage(t,-o.width,0)),Zw.fromCanvas(o,n)}(t,n.getType(),e)})},crop:function wA(n,e,o,r,i){return n.toCanvas().then(function(t){return function a(t,n,e,o,r,i){var u=qw.create(r,i);return qw.get2dContext(u).drawImage(t,-e,-o),Zw.fromCanvas(u,n)}(t,n.getType(),e,o,r,i)})},resize:function SA(n,e,o){return n.toCanvas().then(function(t){return rS.scale(t,e,o).then(function(t){return Zw.fromCanvas(t,n.getType())})})}},uS=(function(){function t(t){this.littleEndian=!1,this._dv=new DataView(t)}t.prototype.readByteAt=function(t){return this._dv.getUint8(t)},t.prototype.read=function(t,n){if(t+n>this.length())return null;for(var e=this.littleEndian?0:-8*(n-1),o=0,r=0;o<n;o++)r|=this.readByteAt(t+o)<<Math.abs(e+8*o);return r},t.prototype.BYTE=function(t){return this.read(t,1)},t.prototype.SHORT=function(t){return this.read(t,2)},t.prototype.LONG=function(t){return this.read(t,4)},t.prototype.SLONG=function(t){var n=this.read(t,4);return 2147483647<n?n-4294967296:n},t.prototype.CHAR=function(t){return String.fromCharCode(this.read(t,1))},t.prototype.STRING=function(t,n){return this.asArray("CHAR",t,n).join("")},t.prototype.SEGMENT=function(t,n){var e=this._dv.buffer;switch(arguments.length){case 2:return e.slice(t,t+n);case 1:return e.slice(t);default:return e}},t.prototype.asArray=function(t,n,e){for(var o=[],r=0;r<e;r++)o[r]=this[t](n+r);return o},t.prototype.length=function(){return this._dv?this._dv.byteLength:0}}(),function(t,n){return iS.rotate(t,n)}),aS=function(t){return oS.invert(t)},cS=function(t){return oS.sharpen(t)},sS=function(t,n){return oS.brightness(t,n)},fS=function(t,n){return oS.contrast(t,n)},lS=function(t,n,e,o){return oS.colorize(t,n,e,o)},dS=function(t,n){return oS.gamma(t,n)},mS=function(t,n){return iS.flip(t,n)},gS=function(t,n,e,o,r){return iS.crop(t,n,e,o,r)},pS=function(t,n,e){return iS.resize(t,n,e)},hS=uS,vS=function(t,n){return To({dom:{tag:"span",innerHtml:t,classes:["tox-icon","tox-tbtn__icon-wrap"]}},n)},bS=function(t,n){return vS(Dg(t,n),{})},yS=function(t,n){return vS(Dg(t,n),{behaviours:ga([Om.config({})])})},xS=function(t,n,e){return{dom:{tag:"span",innerHtml:e.translate(t),classes:[n+"__select-label"]},behaviours:ga([Om.config({})])}},wS=function(t,n,e,o,r){void 0===e&&(e=[]);var i=n.fold(function(){return{}},function(t){return{action:t}}),u=To({buttonBehaviours:ga([Pp(t.disabled),Ab.config({}),sg("button press",[Si("click"),Si("mousedown")])].concat(e)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]}},i),a=Gt(u,{dom:o});return Gt(a,{components:r})},SS=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 bS(t,e.icons)}),u=Kp([i]);return wS(t,n,o,r,u)},CS=function(t,n,e,o){void 0===o&&(o=[]);var r=SS(t,tt.some(n),e,o);return Eg.sketch(r)},kS=function(t,n,e,o){void 0===o&&(o=[]);var r=e.translate(t.text),i=t.icon?t.icon.map(function(t){return bS(t,e.icons)}):tt.none(),u=i.isSome()?Kp([i]):[],a=i.isSome()?{}:{innerHtml:r},c=(t.primary?["tox-button"]:["tox-button","tox-button--secondary"]).concat(i.isSome()?["tox-button--icon"]:[]);return function(t,n,e,o,r){void 0===e&&(e=[]);var i=wS(t,tt.some(n),e,o,r);return Eg.sketch(i)}(t,n,o,To({tag:"button",classes:c},a,{attributes:{title:r}}),u)},OS=function(n,e){return function(t){"custom"===e?ci(t,lv,{name:n,value:{}}):"submit"===e?ai(t,dv):"cancel"===e?ai(t,fv):b.console.error("Unknown button type: ",e)}},ES=function(t,n,e){var o=OS(t.name,n);return kS(t,o,e,[])},TS=Z([Kr("field1Name","field1"),Kr("field2Name","field2"),ra("onLockedChange"),ta(["lockClass"]),Kr("locked",!1),ff("coupledFieldBehaviours",[gl,Nm])]),BS=function(t,i){return Vf({factory:yv,name:t,overrides:function(r){return{fieldBehaviours:ga([sg("coupled-input-behaviour",[Ci(vn(),function(e){var t,n,o;(t=e,n=r,o=i,Kf(t,n,o).bind(gl.getCurrent)).each(function(n){Kf(e,r,"lock").each(function(t){eg.isOn(t)&&r.onLockedChange(e,n,t)})})})])])}}})},DS=Z([BS("field1","field2"),BS("field2","field1"),Vf({factory:Eg,schema:[Rr("dom")],name:"lock",overrides:function(t){return{buttonBehaviours:ga([eg.config({selected:t.locked,toggleClass:t.markers.lockClass,aria:{mode:"pressed"}})])}}})]),AS=fl({name:"FormCoupledInputs",configFields:TS(),partFields:DS(),factory:function(o,t){return{uid:o.uid,dom:o.dom,components:t,behaviours:lf(o.coupledFieldBehaviours,[gl.config({find:tt.some}),Nm.config({store:{mode:"manual",getValue:function(t){var n,e=tl(t,o,["field1","field2"]);return(n={})[o.field1Name]=Nm.getValue(e.field1()),n[o.field2Name]=Nm.getValue(e.field2()),n},setValue:function(t,n){var e=tl(t,o,["field1","field2"]);tn(n,o.field1Name)&&Nm.setValue(e.field1(),n[o.field1Name]),tn(n,o.field2Name)&&Nm.setValue(e.field2(),n[o.field2Name])}}})]),apis:{getField1:function(t){return Kf(t,o,"field1")},getField2:function(t){return Kf(t,o,"field2")},getLock:function(t){return Kf(t,o,"lock")}}}},apis:{getField1:function(t,n){return t.getField1(n)},getField2:function(t,n){return t.getField2(n)},getLock:function(t,n){return t.getLock(n)}}}),_S=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 Lt.error(t);var e=parseFloat(n[1]),o=n[2];return Lt.value({value:e,unit:o})},MS=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?tt.some(t.value):o(t.unit)&&o(n)?e[t.unit]===e[n]?tt.some(t.value):tt.some(t.value/e[t.unit]*e[n]):tt.none()},FS=function(){return tt.none()},IS=function(t,n){return function(t,n){for(var e=[],o=0;o<t.length;o++){var r=t[o];if(!r.isSome())return tt.none();e.push(r.getOrDie())}return tt.some(n.apply(null,e))}([_S(t).toOption(),_S(n).toOption()],function(t,o){return MS(t,o.unit).map(function(t){return o.value/t}).map(function(t){return n=t,e=o.unit,function(t){return MS(t,e).map(function(t){return{value:t*n,unit:e}})};var n,e}).getOr(FS)}).getOr(FS)},VS=function(e,n){var a=FS,o=Oo("ratio-event"),t=AS.parts().lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{title:n.translate(e.label.getOr("Constrain proportions"))}},components:[{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__lock"],innerHtml:Dg("lock",n.icons)}},{dom:{tag:"span",classes:["tox-icon","tox-lock-icon__unlock"],innerHtml:Dg("unlock",n.icons)}}],buttonBehaviours:ga([Ab.config({})])}),r=function(t){return{dom:{tag:"div",classes:["tox-form__group"]},components:t}},i=function(n){return yv.parts().field({factory:mb,inputClasses:["tox-textfield"],inputBehaviours:ga([Ab.config({}),sg("size-input-events",[Ci(mn(),function(t){ci(t,o,{isField1:n})}),Ci(bn(),function(t){ci(t,cv,{name:e.name})})])]),selectOnFocus:!1})},u=function(t){return{dom:{tag:"label",classes:["tox-label"],innerHtml:n.translate(t)}}},c=AS.parts().field1(r([yv.parts().label(u("Width")),i(!0)])),s=AS.parts().field2(r([yv.parts().label(u("Height")),i(!1)]));return AS.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[c,s,r([u("&nbsp;"),t])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:function(t,i){_S(Nm.getValue(t)).each(function(t){a(t).each(function(t){var n,e,o,r;Nm.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:ga([Np.config({}),sg("size-input-events2",[Ci(o,function(t,n){var e=n.event().isField1(),o=e?AS.getField1(t):AS.getField2(t),r=e?AS.getField2(t):AS.getField1(t),i=o.map(Nm.getValue).getOr(""),u=r.map(Nm.getValue).getOr("");a=IS(i,u)})])])})},RS={undo:Z(Oo("undo")),redo:Z(Oo("redo")),zoom:Z(Oo("zoom")),back:Z(Oo("back")),apply:Z(Oo("apply")),swap:Z(Oo("swap")),transform:Z(Oo("transform")),tempTransform:Z(Oo("temp-transform")),transformApply:Z(Oo("transform-apply"))},HS=Z("save-state"),NS=Z("disable"),zS=Z("enable"),PS={formActionEvent:lv,saveState:HS,disable:NS,enable:zS},LS=function(r,c){var t=function(t,n,e,o){return Tg(kS({name:t,text:t,disabled:e,primary:o},n,c))},n=function(t,n,e,o){return Tg(CS({name:t,icon:tt.some(t),tooltip:tt.some(n),disabled:o},e,c))},u=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Np)&&Np.disable(n)})},a=function(t,e){t.map(function(t){var n=t.get(e);n.hasConfigured(Np)&&Np.enable(n)})},s={tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools-edit-panel"]},e=tt.none(),o=Q,i=function(t,n,e){ci(t,n,e)},f=function(t){return ai(t,PS.disable())},l=function(t){return ai(t,PS.enable())},d=function(t,n){f(t),i(t,RS.transform(),{transform:n}),l(t)},m=function(t){return function(){$.getOpt(t).each(function(t){Om.set(t,[K])})}},g=function(t,n){f(t),i(t,RS.transformApply(),{transform:n,swap:m(t)}),l(t)},p=function(){return t("Back",function(t){return i(t,RS.back(),{swap:m(t)})},!1,!1)},h=function(){return Tg({dom:{tag:"div",classes:["tox-spacer"]},behaviours:ga([Np.config({})])})},v=function(){return t("Apply",function(t){return i(t,RS.apply(),{swap:m(t)})},!0,!0)},b=[p(),h(),t("Apply",function(t){g(t,function(t){var n=r.getRect();return gS(t,n.x,n.y,n.w,n.h)}),r.hideCrop()},!1,!0)],y=Jh.sketch({dom:s,components:b.map(function(t){return t.asSpec()}),containerBehaviours:ga([sg("image-tools-crop-buttons-events",[Ci(PS.disable(),function(t){u(b,t)}),Ci(PS.enable(),function(t){a(b,t)})])])}),x=Tg(VS({name:"size",label:e,type:"sizeinput",constrain:!0},c)),w=[p(),h(),x,h(),t("Apply",function(a){x.getOpt(a).each(function(t){var n,e,o=Nm.getValue(t),r=parseInt(o.width,10),i=parseInt(o.height,10),u=(n=r,e=i,function(t){return pS(t,n,e)});g(a,u)})},!1,!0)],S=Jh.sketch({dom:s,components:w.map(function(t){return t.asSpec()}),containerBehaviours:ga([sg("image-tools-resize-buttons-events",[Ci(PS.disable(),function(t){u(w,t)}),Ci(PS.enable(),function(t){a(w,t)})])])}),C=function(n,e){return function(t){return n(t,e)}},k=C(mS,"h"),O=C(mS,"v"),E=C(hS,-90),T=C(hS,90),B=function(t,n){var e,o;o=n,f(e=t),i(e,RS.tempTransform(),{transform:o}),l(e)},D=[p(),h(),n("flip-horizontally","Flip horizontally",function(t){B(t,k)},!1),n("flip-vertically","Flip vertically",function(t){B(t,O)},!1),n("rotate-left","Rotate counterclockwise",function(t){B(t,E)},!1),n("rotate-right","Rotate clockwise",function(t){B(t,T)},!1),h(),v()],A=Jh.sketch({dom:s,components:D.map(function(t){return t.asSpec()}),containerBehaviours:ga([sg("image-tools-fliprotate-buttons-events",[Ci(PS.disable(),function(t){u(D,t)}),Ci(PS.enable(),function(t){a(D,t)})])])}),_=function(t,n,e,o,r){var i=sw.parts().label({dom:{tag:"label",classes:["tox-label"],innerHtml:c.translate(t)}}),u=sw.parts().spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),a=sw.parts().thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return Tg(sw.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e,maxX:r,getInitialValue:Z({x:Z(o)})},components:[i,u,a],sliderBehaviours:ga([Um.config({})]),onChoose:n}))},M=function(t,n,e,o,r){return[p(),(i=t,u=n,a=e,c=o,s=r,_(i,function(t,n,e){var o=C(u,e.x()/100);d(t,o)},a,c,s)),v()];var i,u,a,c,s},F=function(t,n,e,o,r){var i=M(t,n,e,o,r);return Jh.sketch({dom:s,components:i.map(function(t){return t.asSpec()}),containerBehaviours:ga([sg("image-tools-filter-panel-buttons-events",[Ci(PS.disable(),function(t){u(i,t)}),Ci(PS.enable(),function(t){a(i,t)})])])})},I=[p(),h(),v()],V=Jh.sketch({dom:s,components:I.map(function(t){return t.asSpec()})}),R=F("Brightness",sS,-100,0,100),H=F("Contrast",fS,-100,0,100),N=F("Gamma",dS,-100,0,100),z=function(t){return _(t,function(f){var t=P.getOpt(f),n=j.getOpt(f),e=L.getOpt(f);t.each(function(s){n.each(function(c){e.each(function(t){var n,e,o,r=Nm.getValue(s).x()/100,i=Nm.getValue(t).x()/100,u=Nm.getValue(c).x()/100,a=(n=r,e=i,o=u,function(t){return lS(t,n,e,o)});d(f,a)})})})},0,100,200)},P=z("R"),L=z("G"),j=z("B"),U=[p(),P,L,j,v()],W=Jh.sketch({dom:s,components:U.map(function(t){return t.asSpec()})}),G=function(n,e,o){return function(t){i(t,RS.swap(),{transform:e,swap:function(){$.getOpt(t).each(function(t){Om.set(t,[n]),o(t)})}})}},X=tt.some(cS),Y=tt.some(aS),q=[n("crop","Crop",G(y,e,function(){r.showCrop()}),!1),n("resize","Resize",G(S,e,function(t){x.getOpt(t).each(function(t){var n=r.getMeasurements(),e=n.width,o=n.height;Nm.setValue(t,{width:e,height:o})})}),!1),n("orientation","Orientation",G(A,e,o),!1),n("brightness","Brightness",G(R,e,o),!1),n("sharpen","Sharpen",G(V,X,o),!1),n("contrast","Contrast",G(H,e,o),!1),n("color-levels","Color levels",G(W,e,o),!1),n("gamma","Gamma",G(N,e,o),!1),n("invert","Invert",G(V,Y,o),!1)],K=Jh.sketch({dom:s,components:q.map(function(t){return t.asSpec()})}),J=Jh.sketch({dom:{tag:"div"},components:[K],containerBehaviours:ga([Om.config({})])}),$=Tg(J);return{memContainer:$,getApplyButton:function(t){return $.getOpt(t).map(function(t){var n=t.components()[0];return n.components()[n.components().length-1]})}}},jS=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),US=tinymce.util.Tools.resolve("tinymce.geom.Rect"),WS=tinymce.util.Tools.resolve("tinymce.util.Observable"),GS=tinymce.util.Tools.resolve("tinymce.util.Tools"),XS=tinymce.util.Tools.resolve("tinymce.util.VK"),YS=0,qS=function(n){var f=Tg({dom:{tag:"div",classes:["tox-image-tools__image-bg"],attributes:{role:"presentation"}}}),l=nn(1),d=nn(tt.none()),m=nn({x:0,y:0,w:1,h:1}),c=nn({x:0,y:0,w:1,h:1}),s=function(t,s){g.getOpt(t).each(function(t){var e=l.get(),o=_a(t.element()),r=Ia(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"};ku(s,n),f.getOpt(t).each(function(t){ku(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=xe.fromTag("img");return ro(a,"src",n),(e=a.dom(),new Hg(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=Pu({element:a});Om.replaceAt(t,1,tt.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=US.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=_a(t.element()),e=Ia(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=Jh.sketch({dom:{tag:"div",classes:["tox-image-tools__image"]},components:[f.asSpec(),{dom:{tag:"img",attributes:{src:n}}},{dom:{tag:"div"},behaviours:ga([sg("image-panel-crop-events",[_i(function(t){g.getOpt(t).each(function(t){var n=function S(s,e,f,o,r){function l(t,n){return{x:n.x-t.x,y:n.y-t.y,w:n.w,h:n.h}}function u(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=US.clamp({x:r,y:i,w:u,h:a},f,"move"===t.name),c=l(f,c),m.fire("updateRect",{rect:c}),d(c)}function n(n){function t(t,n){n.h<0&&(n.h=0),n.w<0&&(n.w=0),jS("#"+h+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}GS.each(a,function(t){jS("#"+h+"-"+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 i(t){n(s=t)}function d(t){i(function e(t,n){return{x:n.x+t.x,y:n.y+t.y,w:n.w,h:n.h}}(f,t))}var m,a,c,g,p="tox-",h="tox-crid-"+YS++;return 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"}],g=["top","right","bottom","left"],function v(){jS('<div id="'+h+'" class="'+p+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(o),GS.each(g,function(t){jS("#"+h,o).append('<div id="'+h+"-"+t+'"class="'+p+'croprect-block" style="display: none" data-mce-bogus="all">')}),GS.each(a,function(t){jS("#"+h,o).append('<div id="'+h+"-"+t.name+'" class="'+p+"croprect-handle "+p+"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+'">')}),c=GS.map(a,function t(n){var e;return new D(h,{document:o.ownerDocument,handle:h+"-"+n.name,start:function(){e=s},drag:function(t){u(n,e,t.deltaX,t.deltaY)}})}),n(s),jS(o).on("focusin focusout",function(t){jS(t.target).attr("aria-grabbed","focus"===t.type)}),jS(o).on("keydown",function(n){function t(t,n,e,o,r){t.stopPropagation(),t.preventDefault(),u(i,e,o,r)}var i;switch(GS.each(a,function(t){if(n.target.id===h+"-"+t.name)return i=t,!1}),n.keyCode){case XS.LEFT:t(n,0,s,-10,0);break;case XS.RIGHT:t(n,0,s,10,0);break;case XS.UP:t(n,0,s,0,-10);break;case XS.DOWN:t(n,0,s,0,10);break;case XS.ENTER:case XS.SPACEBAR:n.preventDefault(),r()}})}(),m=GS.extend({toggleVisibility:function b(t){var n;n=GS.map(a,function(t){return"#"+h+"-"+t.name}).concat(GS.map(g,function(t){return"#"+h+"-"+t})).join(","),t?jS(n,o).show():jS(n,o).hide()},setClampRect:function y(t){f=t,n(s)},setRect:i,getInnerRect:function t(){return l(f,s)},setInnerRect:d,setViewPortRect:function x(t){e=t,n(s)},destroy:function w(){GS.each(c,function(t){t.destroy()}),c=[]}},WS)}({x:10,y:10,w:100,h:100},{x:0,y:0,w:200,h:200},{x:0,y:0,w:200,h:200},t.element().dom(),function(){});n.toggleVisibility(!1),n.on("updateRect",function(t){var n=t.rect,e=l.get(),o={x:Math.round(n.x/e),y:Math.round(n.y/e),w:Math.round(n.w/e),h:Math.round(n.h/e)};m.set(o)}),d.set(tt.some(n))})})])])}],containerBehaviours:ga([Om.config({}),sg("image-panel-events",[_i(function(t){e(t,n)})])])}),g=Tg(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}}}},KS=function(t,n,e,o,r){return CS({name:t,icon:tt.some(n),disabled:e,tooltip:tt.some(t)},o,r)},JS=function(t,n){n?Np.enable(t):Np.disable(t)},$S=function(){return Te.getOrDie("URL")},QS=function(t){return $S().createObjectURL(t)},ZS=function(t){$S().revokeObjectURL(t)},tC=function(t){var n=nn(t),e=nn(tt.none()),o=function s(){function t(){return 0<o}function n(){return-1!==o&&o<e.length-1}var e=[],o=-1;return{data:e,add:function r(t){var n;return n=e.splice(++o),e.push(t),{state:t,removed:n}},undo:function i(){if(t())return e[--o]},redo:function u(){if(n())return e[++o]},canUndo:t,canRedo:n}}();o.add(t);var r=function(t){n.set(t)},i=function(t){return{blob:t,url:QS(t)}},u=function(t){ZS(t.url)},a=function(){e.get().each(u),e.set(tt.none())},c=function(t){var n,e=i(t);return r(e),n=o.add(e).removed,GS.each(n,u),e.url};return{getBlobState:function(){return n.get()},setBlobState:r,addBlobState:c,getTempState:function(){return e.get().fold(function(){return n.get()},function(t){return t})},updateTempState:function(t){var n=i(t);return a(),e.set(tt.some(n)),n.url},addTempState:function(t){var n=i(t);return e.set(tt.some(n)),n.url},applyTempState:function(n){return e.get().fold(function(){},function(t){c(t.blob),n()})},destroyTempState:a,undo:function(){var t=o.undo();return r(t),t.url},redo:function(){var t=o.redo();return r(t),t.url},getHistoryStates:function(){return{undoEnabled:o.canUndo(),redoEnabled:o.canRedo()}}}},nC=function(t,n){var e,o,r,u=tC(t.currentState),i=function(t){var n=u.getHistoryStates();p.updateButtonUndoStates(t,n.undoEnabled,n.redoEnabled),ci(t,PS.formActionEvent,{name:PS.saveState(),value:n.undoEnabled})},a=function(t){return t.toBlob()},c=function(t){ci(t,PS.formActionEvent,{name:PS.disable(),value:{}})},s=function(t){h.getApplyButton(t).each(function(t){Np.enable(t)}),ci(t,PS.formActionEvent,{name:PS.enable(),value:{}})},f=function(t,n){return c(t),g.updateSrc(t,n)},l=function(n,t,e,o,r){return c(n),tS(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){b.console.log(t),s(n)})},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=qS(t.currentState.url),p=(o=Tg(KS("Undo","undo",!0,function(t){ci(t,RS.undo(),{direction:1})},e=n)),r=Tg(KS("Redo","redo",!0,function(t){ci(t,RS.redo(),{direction:1})},e)),{container:Jh.sketch({dom:{tag:"div",classes:["tox-image-tools__toolbar","tox-image-tools__sidebar"]},components:[o.asSpec(),r.asSpec(),KS("Zoom in","zoom-in",!1,function(t){ci(t,RS.zoom(),{direction:1})},e),KS("Zoom out","zoom-out",!1,function(t){ci(t,RS.zoom(),{direction:-1})},e)]}),updateButtonUndoStates:function(t,n,e){o.getOpt(t).each(function(t){JS(t,n)}),r.getOpt(t).each(function(t){JS(t,e)})}}),h=LS(g,n);return{dom:{tag:"div",attributes:{role:"presentation"}},components:[h.memContainer.asSpec(),g.memContainer.asSpec(),p.container],behaviours:ga([Nm.config({store:{mode:"manual",getValue:function(){return u.getBlobState()}}}),sg("image-tools-events",[Ci(RS.undo(),function(t){var n=u.undo();f(t,n).then(function(){s(t),i(t)})}),Ci(RS.redo(),function(t){var n=u.redo();f(t,n).then(function(){s(t),i(t)})}),Ci(RS.zoom(),function(t,n){var e=n.event().direction();g.zoom(t,e)}),Ci(RS.back(),function(t,n){var e,o;o=m(e=t),f(e,o).then(function(){s(e)}),n.event().swap()(),g.hideCrop()}),Ci(RS.apply(),function(t,n){u.applyTempState(function(){m(t),n.event().swap()()})}),Ci(RS.transform(),function(t,n){return d(t,n.event().transform(),Q)}),Ci(RS.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)},Q);var e,o,r}),Ci(RS.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}),Ci(RS.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)})})]),Ew()])}},eC=sl({name:"HtmlSelect",configFields:[Rr("options"),af("selectBehaviours",[Um,Nm]),Kr("selectClasses",[]),Kr("selectAttributes",{}),Wr("data")],factory:function(e){var t=ct(e.options,function(t){return{dom:{tag:"option",value:t.value,innerHtml:t.text}}}),n=e.data.map(function(t){return $t("initialValue",t)}).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:t,behaviours:sf(e.selectBehaviours,[Um.config({}),Nm.config({store:To({mode:"manual",getValue:function(t){return _u(t.element())},setValue:function(t,n){mt(e.options,function(t){return t.value===n}).isSome()&&Mu(t.element(),n)}},n)})])}}}),oC=function(n,e){var t=n.label.map(function(t){return ub(t,e)}),o=[xm.config({mode:"execution",useEnter:!0!==n.multiline,useControlEnter:!0===n.multiline,execute:function(t){return ai(t,dv),tt.some(!0)}}),sg("textfield-change",[Ci(vn(),function(t){ci(t,cv,{name:n.name})}),Ci(Qn(),function(t){ci(t,cv,{name:n.name})})]),Ab.config({})],r=n.validation.map(function(o){return Tb.config({getRoot:function(t){return ze(t.element())},invalidClass:"tox-invalid",validator:{validate:function(t){var n=Nm.getValue(t),e=o.validator(n);return _v.pure(!0===e?Lt.value(n):Lt.error(e))},validateOnLoad:o.validateOnLoad}})}).toArray(),i=yv.parts().field({tag:!0===n.multiline?"textarea":"input",inputAttributes:n.placeholder.fold(function(){},function(t){return{placeholder:e.translate(t)}}),inputClasses:[n.classname],inputBehaviours:ga(vt([o,r])),selectOnFocus:!1,factory:mb}),u=n.flex?["tox-form__group--stretched"]:[];return eb(t,i,u)},rC=function(i){return To({},i,{toCached:function(){return rC(i.toCached())},bindFuture:function(n){return rC(i.bind(function(t){return t.fold(function(t){return _v.pure(Lt.error(t))},function(t){return n(t)})}))},bindResult:function(n){return rC(i.map(function(t){return t.bind(n)}))},mapResult:function(n){return rC(i.map(function(t){return t.map(n)}))},mapError:function(n){return rC(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 rC(_v.nu(function(n){var e=!1,o=b.setTimeout(function(){e=!0,n(Lt.error(r()))},t);i.get(function(t){e||(b.clearTimeout(o),n(t))})}))}})},iC=function(t){return rC(_v.nu(t))},uC={type:"separator"},aC=function(t){return{type:"menuitem",value:t.url,text:t.title,meta:{attach:t.attach},onAction:function(){}}},cC=function(t,n){return{type:"menuitem",value:n,text:t,meta:{attach:undefined},onAction:function(){}}},sC=function(t,n){return o=t,e=ft(n,function(t){return t.type===o}),ct(e,aC);var e,o},fC=function(t,n){var e=t.toLowerCase();return ft(n,function(t){var n=t.meta!==undefined&&t.meta.text!==undefined?t.meta.text:t.text;return Ln(n.toLowerCase(),e)||Ln(t.value.toLowerCase(),e)})},lC=function(c,t,s){var n=Nm.getValue(t),f=n.meta.text!==undefined?n.meta.text:n.value;return s.getLinkInformation().fold(function(){return[]},function(t){var n,e,o,r,i,u,a=fC(f,(n=s.getHistory(c),ct(n,function(t){return cC(t,t)})));return"file"===c?(e=[a,fC(f,(u=t,sC("header",u.targets))),fC(f,vt([(i=t,tt.from(i.anchorTop).map(function(t){return cC("<top>",t)}).toArray()),(r=t,sC("anchor",r.targets)),(o=t,tt.from(o.anchorBottom).map(function(t){return cC("<bottom>",t)}).toArray())]))],dt(e,function(t,n){return 0===t.length||0===n.length?t.concat(n):t.concat(uC,n)},[])):a})},dC=function(i,u,o){var t,n=function(t){var n=Nm.getValue(t);o.addToHistory(n.value,i.filetype)},e=yv.parts().field({factory:nb,dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],minChars:0,responseTime:0,fetch:function(t){var n=lC(i.filetype,t,o),e=db(n,Yp.BUBBLE_TO_SANDBOX,u.providers);return _v.pure(e)},getHotspot:function(t){return l.getOpt(t)},onSetValue:function(t){t.hasConfigured(Tb)&&Tb.run(t).get(Q)},typeaheadBehaviours:ga(vt([o.getValidationHandler().map(function(o){return Tb.config({getRoot:function(t){return ze(t.element())},invalidClass:"tox-control-wrap--status-invalid",notify:{},validator:{validate:function(n){var e=Nm.getValue(n);return iC(function(t){o({type:i.filetype,url:e.value},function(e){l.getOpt(n).each(function(t){var n=function(t,n,e){(e?gu:hu)(t.element(),n)};n(t,"tox-control-wrap--status-valid","valid"===e.status),n(t,"tox-control-wrap--status-unknown","unknown"===e.status)}),t(("invalid"===e.status?Lt.error:Lt.value)(e.message))})})},validateOnLoad:!1}})}).toArray(),[Ab.config({}),sg("urlinput-events",vt(["file"===i.filetype?[Ci(vn(),function(t){ci(t,cv,{name:i.name})})]:[],[Ci(bn(),function(t){ci(t,cv,{name:i.name}),n(t)}),Ci(Qn(),function(t){ci(t,cv,{name:i.name}),n(t)})]]))]])),eventOrder:(t={},t[vn()]=["streaming","urlinput-events","invalidating"],t),model:{getDisplayText:function(t){return t.value},selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"dog"},lazySink:u.getSink,parts:{menu:mh(0,0,"normal")},onExecute:function(t,n){ci(n,dv,{})},onItemExecute:function(t){n(t),ci(t,cv,{name:i.name})}}),r=i.label.map(function(t){return ub(t,u.providers)}),a=function(t,n,e){return void 0===n&&(n=t),void 0===e&&(e=t),{dom:{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+t],innerHtml:Dg(n,u.providers.icons),attributes:{title:u.providers.translate(e)}}}},c=Tg({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[a("valid","checkmark","valid"),a("unknown","warning"),a("invalid","warning")]}),s=o.getUrlPicker(i.filetype),f=Oo("browser.url.event"),l=Tg({dom:{tag:"div",classes:["tox-control-wrap"]},components:[e,c.asSpec()]});return yv.sketch({dom:ib([]),components:r.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:vt([[l.asSpec()],s.map(function(){return t=i.label,n=f,e="tox-browse-url",o="browse",r=u.providers,Eg.sketch({dom:{tag:"button",classes:["tox-tbtn",e],innerHtml:Dg(o,r.icons),attributes:{title:r.translate(t.getOr(""))}},buttonBehaviours:ga([Ab.config({})]),action:function(t){ai(t,n)}});var t,
  n,e,o,r}).toArray()])}]),fieldBehaviours:ga([sg("url-input-events",[Ci(f,function(o){gl.getCurrent(o).each(function(n){var e=Nm.getValue(n);s.each(function(t){t(e).get(function(t){Nm.setValue(n,t),ci(o,cv,{name:i.name})})})})})])])})},mC=function(u,n){var t,e,o=u.label.map(function(t){return ub(t,n)}),r=function(e){return function(n,t){Xu(t.event().target(),"[data-collection-item-value]").each(function(t){e(n,t,uo(t,"data-collection-item-value"))})}},i=[Ci(dn(),r(function(t,n){Nl(n)})),Ci(oe(),r(function(t,n,e){ci(t,lv,{name:u.name,value:e})})),Ci(mn(),r(function(t,n){Gu(t.element(),"."+hp).each(function(t){hu(t,hp)}),gu(n,hp)})),Ci(gn(),r(function(t){Gu(t.element(),"."+hp).each(function(t){hu(t,hp)})})),Ii(r(function(t,n,e){ci(t,lv,{name:u.name,value:e})}))],a=yv.parts().field({dom:{tag:"div",classes:["tox-collection"].concat(1!==u.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:U},behaviours:ga([Om.config({}),Nm.config({store:{mode:"memory",initialValue:[]},onSetValue:function(o,t){var n,e,r,i;n=o,e=ct(t,function(t){var n,e=1===u.columns?'<div class="tox-collection__item-label">'+t.text+"</div>":"",o='<div class="tox-collection__item-icon">'+t.icon+"</div>",r={_:" "," - ":" ","-":" "},i=t.text.replace(/\_| \- |\-/g,function(t){return r[t]});return'<div class="tox-collection__item" tabindex="-1" data-collection-item-value="'+('"'===(n=t.value)?"&quot;":n)+'" title="'+i+'" aria-label="'+i+'">'+o+e+"</div>"}),r=1<u.columns&&"auto"!==u.columns?at(e,u.columns):[e],i=ct(r,function(t){return'<div class="tox-collection__group">'+t.join("")+"</div>"}),$e(n.element(),i.join("")),"auto"===u.columns&&Jg(o,5,"tox-collection__item").each(function(t){var n=t.numRows,e=t.numColumns;xm.setGridSize(o,n,e)}),ai(o,hv)}}),Ab.config({}),xm.config((t=u.columns,e="normal",1===t?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===t?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:"color"===e?".tox-swatches__row":".tox-collection__group",cell:"color"===e?"."+lp:"."+fp}})),sg("collection-events",i)])});return eb(o,a,["tox-form__group--collection"])},gC=function(r){return function(n,e,o){return Jt(e,"name").fold(function(){return r(e,o)},function(t){return n.field(t,r(e,o))})}},pC={bar:gC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-bar"]},components:ct(e.items,o.interpreter)};var e,o}),collection:gC(function(t,n){return mC(t,n.shared.providers)}),alloy:gC(U),alertbanner:gC(function(t,n){return e=t,o=n.shared.providers,Jh.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:[Eg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:Dg(e.icon,o.icons),attributes:{title:o.translate(e.actionLabel)}},action:function(t){ci(t,lv,{name:"alert-banner",value:e.url})}})]},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:o.translate(e.text)}}]});var e,o}),input:gC(function(t,n){return e=t,o=n.shared.providers,oC({name:e.name,multiline:!1,label:e.label,placeholder:e.placeholder,flex:!1,classname:"tox-textfield",validation:tt.none()},o);var e,o}),textarea:gC(function(t,n){return e=t,o=n.shared.providers,oC({name:e.name,multiline:!0,label:e.label,placeholder:e.placeholder,flex:!0,classname:"tox-textarea",validation:tt.none()},o);var e,o}),listbox:gC(function(t,n){return e=t,o=n.shared.providers,r=ub(e.label,o),i=yv.parts().field({factory:eC,dom:{classes:["mce-select-field"]},selectBehaviours:ga([Ab.config({})]),options:e.values,data:e.initialValue.getOr(undefined)}),ob(tt.some(r),i);var e,o,r,i}),label:gC(function(t,n){return e=t,r={dom:{tag:"label",innerHtml:(o=n.shared).providers.translate(e.label),classes:["tox-label"]}},i=ct(e.items,o.interpreter),{dom:{tag:"div",classes:["tox-form__group"]},components:[r].concat(i),behaviours:ga([Ew(),Om.config({}),Rw(tt.none()),xm.config({mode:"acyclic"})])};var e,o,r,i}),iframe:(Iv=function(t,n){return Yw(t,n.shared.providers)},function(t,n,e){var o=Gt(n,{source:"dynamic"});return gC(Iv)(t,o,e)}),autocomplete:gC(function(t,n){return r=t,i=n.shared,e=ub(r.label.getOr("?"),i.providers),o=yv.parts().field({factory:nb,dismissOnBlur:!1,inputClasses:["tox-textfield"],minChars:1,fetch:function(t){var n=Nm.getValue(t),e=r.getItems(n),o=db(e,Yp.BUBBLE_TO_SANDBOX,i.providers);return _v.pure(o)},markers:{openClass:"dog"},lazySink:i.getSink,parts:{menu:mh(0,0,"normal")}}),ob(tt.some(e),o);var r,i,e,o}),button:gC(function(t,n){return e=t,o=n.shared.providers,r=OS(e.name,"custom"),kS(e,r,o,[Hw(""),Ew()]);var e,o,r}),checkbox:gC(function(t,n){return e=t,o=n.shared.providers,r=Nm.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(),tt.some(!0)},u=yv.parts().field({factory:{sketch:U},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:ga([Ew(),Ab.config({}),Um.config({}),r,xm.config({mode:"special",onEnter:i,onSpace:i,stopSpaceKeyup:!0}),sg("checkbox-events",[Ci(bn(),function(t){ci(t,cv,{name:e.name})})])])}),a=yv.parts().label({dom:{tag:"span",classes:["tox-checkbox__label"],innerHtml:o.translate(e.label)},behaviours:ga([xy.config({})])}),s=Tg({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[(c=function(t){return{dom:{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+t],innerHtml:Dg("checked"===t?"selected":"unselected",o.icons)}}})("checked"),c("unchecked")]}),yv.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[u,s.asSpec(),a]});var e,o,r,i,u,a,c,s}),colorinput:gC(function(t,n){return ky(t,n.shared,n.colorinput)}),colorpicker:gC(function(){var t=function(t){return"tox-"+t},n=Ow(Aw,t),r=Tg(n.sketch({dom:{tag:"div",classes:[t("color-picker-container")],attributes:{role:"presentation"}},onValidHex:function(t){ci(t,lv,{name:"hex-valid",value:!0})},onInvalidHex:function(t){ci(t,lv,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[r.asSpec()],behaviours:ga([Nm.config({store:{mode:"manual",getValue:function(t){var n=r.get(t);return gl.getCurrent(n).bind(function(t){return Nm.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);gl.getCurrent(o).fold(function(){b.console.log("Can not find form")},function(t){Nm.setValue(t,{hex:tt.from(e[1]).getOr("")}),bw.getField(t,"hex").each(function(t){ai(t,vn())})})}}}),Ew()])}}),dropzone:gC(function(t,n){return Nw(t,n.shared.providers)}),grid:gC(function(t,n){return e=t,o=n.shared,{dom:{tag:"div",classes:["tox-form__grid","tox-form__grid--"+e.columns+"col"]},components:ct(e.items,o.interpreter)};var e,o}),selectbox:gC(function(t,n){return e=t,o=n.shared.providers,r=e.label.map(function(t){return ub(t,o)}),i=yv.parts().field({dom:{},selectAttributes:{size:e.size},options:e.items,factory:eC,selectBehaviours:ga([Ab.config({}),sg("selectbox-change",[Ci(bn(),function(t){ci(t,cv,{name:e.name})})])])}),u=1<e.size?tt.none():tt.some({dom:{tag:"div",classes:["tox-selectfield__icon-js"],innerHtml:Dg("chevron-down",o.icons)}}),a={dom:{tag:"div",classes:["tox-selectfield"]},components:vt([[i],u.toArray()])},yv.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:vt([r.toArray(),[a]])});var e,o,r,i,u,a}),sizeinput:gC(function(t,n){return VS(t,n.shared.providers)}),urlinput:gC(function(t,n){return dC(t,n.shared,n.urlinput)}),customeditor:gC(function(n){var e=nn(tt.none()),o=Tg({dom:{tag:n.tag}}),r=nn(tt.none());return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:ga([sg("editor-foo-events",[_i(function(t){o.getOpt(t).each(function(t){n.init(t.element().dom()).then(function(n){r.get().each(function(t){n.setValue(t)}),r.set(tt.none()),e.set(tt.some(n))})})})]),Nm.config({store:{mode:"manual",getValue:function(){return e.get().fold(function(){return r.get().getOr("")},function(t){return t.getValue()})},setValue:function(t,n){e.get().fold(function(){r.set(tt.some(n))},function(t){return t.setValue(n)})}}}),Ew()]),components:[o.asSpec()]}}),htmlpanel:gC(function(t){return"presentation"===t.presets?Jh.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html}}):Jh.sketch({dom:{tag:"div",classes:["tox-form__group"],innerHtml:t.html,attributes:{role:"document"}},containerBehaviours:ga([Ab.config({}),Um.config({})])})}),imagetools:gC(function(t,n){return nC(t,n.shared.providers)}),table:gC(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:ct(t,a)}},{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(i=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:ct(i,u)}]}),(r=e.cells,{dom:{tag:"tbody"},components:ct(r,c)})],behaviours:ga([Ab.config({}),Um.config({})])};var e,o,r,i,u,a,c})},hC={field:function(t,n){return n}},vC=function(n,t,e){var o=Gt(e,{shared:{interpreter:function(t){return bC(n,t,o)}}});return bC(n,t,o)},bC=function(n,e,o){return Jt(pC,e.type).fold(function(){return b.console.error('Unknown factory type "'+e.type+'", defaulting to container: ',e),e},function(t){return t(n,e,o)})},yC=function(t){return t.y()},xC=function(t,n,e){return xc(t.x(),yC(t),e.northeast(),La(),"layout-ne")},wC=function(t,n,e){return xc((r=n,(o=t).x()+o.width()-r.width()),yC(t),e.northwest(),ja(),"layout-nw");var o,r},SC=function(t,n,e){return xc((r=n,(o=t).x()+o.width()/2-r.width()/2),yC(t),e.north(),Wa(),"layout-n");var o,r},CC={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},kC=function(t,n,e){var o,r,i,u,a,c,s,f,l,d,m=av(t),g=function(){return xe.fromDom(t.getBody())};return{toolbar:(f=g,l=n,d=m,d?function(){return{anchor:"node",root:f(),node:tt.from(f()),bubble:bc(-12,-12,CC),layouts:{onRtl:function(){return[xC]},onLtr:function(){return[wC]}}}}:function(){return{anchor:"hotspot",hotspot:l(),bubble:bc(-12,12,CC),layouts:{onRtl:function(){return[Tc]},onLtr:function(){return[Bc]}}}}),toolbarOverflow:(s=e,function(){return{anchor:"hotspot",hotspot:s(),layouts:{onRtl:function(){return[Tc]},onLtr:function(){return[Bc]}}}}),banner:(u=g,a=n,c=e,c?function(){return{anchor:"node",root:u(),node:tt.from(u()),layouts:{onRtl:function(){return[SC]},onLtr:function(){return[SC]}}}}:function(){return{anchor:"hotspot",hotspot:a(),layouts:{onRtl:function(){return[Mc]},onLtr:function(){return[Mc]}}}}),cursor:(r=t,i=g,function(){return{anchor:"selection",root:i(),getSelection:function(){var t=r.selection.getRng();return tt.some(Gc(xe.fromDom(t.startContainer),t.startOffset,xe.fromDom(t.endContainer),t.endOffset))}}}),node:(o=g,function(t){return{anchor:"node",root:o(),node:t}})}},OC=function(t){return{colorPicker:(o=t,function(t,n){hy.colorPickerDialog(o)(t,n)}),hasCustomColors:(e=t,function(){return ry(e)}),getColors:(n=t,function(){return iy(n)})};var n,e,o},EC=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strike-through",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Align",items:[{title:"Left",icon:"align-left",format:"alignleft"},{title:"Center",icon:"align-center",format:"aligncenter"},{title:"Right",icon:"align-right",format:"alignright"},{title:"Justify",icon:"align-justify",format:"alignjustify"}]}],TC=function(t){return dt(t,function(t,n){if(Vt(n,"items")){var e=TC(n.items);return{customFormats:t.customFormats.concat(e.customFormats),formats:t.formats.concat([{title:n.title,items:e.formats}])}}if(Vt(n,"inline")||Vt(n,"block")||Vt(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 To({},t,{formats:t.formats.concat(n)})},{customFormats:[],formats:[]})},BC=function(i){return(t=i,tt.from(t.getParam("style_formats")).filter($)).map(function(t){var n,e,o,r=(n=i,e=TC(t),o=function(t){st(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")?EC.concat(r):r}).getOr(EC);var t},DC=function(t,n,e){var o={type:"formatter",isSelected:n(t.format),getStylePreview:e(t.format)};return Gt(t,o)},AC=function(s,t,f,l){var d=function(t){return ct(t,function(t){var n,e,o,r,i,u,a=Tt(t);if(tn(t,"items")){var c=d(t.items);return Gt((i=t,u={type:"submenu",isSelected:Z(!1),getStylePreview:function(){return tt.none()}},Gt(i,u)),{getStyleItems:function(){return c}})}return tn(t,"format")?DC(t,f,l):1===a.length&&it(a,"title")?Gt(t,{type:"separator"}):(o={type:"formatter",format:e=Oo((n=t).title),isSelected:f(e),getStylePreview:l(e)},r=Gt(n,o),s.formatter.register(e,r),r)})};return d(t)},_C=GS.trim,MC=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}},FC=MC("true"),IC=MC("false"),VC=function(t,n,e,o,r){return{type:t,title:n,url:e,level:o,attach:r}},RC=function(t){return t.innerText||t.textContent},HC=function(t){return(n=t)&&"A"===n.nodeName&&(n.id||n.name)!==undefined&&zC(t);var n},NC=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},zC=function(t){return function(t){for(;t=t.parentNode;){var n=t.contentEditable;if(n&&"inherit"!==n)return FC(t)}return!1}(t)&&!IC(t)},PC=function(t){return NC(t)&&zC(t)},LC=function(t){var n,e,o=(n=t).id?n.id:Oo("h");return VC("header",RC(t),"#"+o,NC(e=t)?parseInt(e.nodeName.substr(1),10):0,function(){t.id=o})},jC=function(t){var n=t.id||t.name,e=RC(t);return VC("anchor",e||"#"+n,"#"+n,0,Q)},UC=function(t){var n,e;return n="h1,h2,h3,h4,h5,h6,a:not([href])",e=t,ct(es(xe.fromDom(e),n),function(t){return t.dom()})},WC=function(t){return 0<_C(t.title).length},GC=function(t){var n,e=UC(t);return ft((n=e,ct(ft(n,PC),LC)).concat(ct(ft(e,HC),jC)),WC)},XC="tinymce-url-history",YC=function(t){return K(t)&&/^https?/.test(t)},qC=function(t){return J(t)&&function(t,n){for(var e=Tt(t),o=0,r=e.length;o<r;o++){var i=e[o],u=t[i];if(n(u,i,t))return tt.some(u)}return tt.none()}(t,function(t){return!($(n=t)&&n.length<=5&&yt(n,YC));var n}).isNone()},KC=function(){var t,n=b.localStorage.getItem(XC);if(null===n)return{};try{t=JSON.parse(n)}catch(M){if(M instanceof SyntaxError)return b.console.log("Local storage "+XC+" was not valid JSON",M),{};throw M}return qC(t)?t:(b.console.log("Local storage "+XC+" was not valid format",t),{})},JC=function(t){var n=KC();return Object.prototype.hasOwnProperty.call(n,t)?n[t]:[]},$C=function(n,t){if(YC(n)){var e=KC(),o=Object.prototype.hasOwnProperty.call(e,t)?e[t]:[],r=ft(o,function(t){return t!==n});e[t]=[n].concat(r).slice(0,5),function(t){if(!qC(t))throw new Error("Bad format for history:\n"+JSON.stringify(t));b.localStorage.setItem(XC,JSON.stringify(t))}(e)}},QC=Object.prototype.hasOwnProperty,ZC=function(t){return!!t},tk=function(t){return At(GS.makeMap(t,/[, ]/),ZC)},nk=function(t,n,e){var o,r,i=(o=t,r=n,QC.call(o,r)?tt.some(o[r]):tt.none()).getOr(e);return K(i)?tt.some(i):tt.none()},ek=function(t){return tt.some(t.file_picker_callback).filter(et)},ok=function(t,n){var e,o,r,i,u=(e=t,o=tt.some(e.file_picker_types).filter(ZC),r=tt.some(e.file_browser_callback_types).filter(ZC),i=o.or(r).map(tk),ek(e).fold(function(){return!1},function(){return i.fold(function(){return!0},function(t){return 0<Tt(t).length&&t})}));return nt(u)?u?ek(t):tt.none():u[n]?ek(t):tt.none()},rk=function(n){return{getHistory:JC,addToHistory:$C,getLinkInformation:function(){return!1===(t=n).settings.typeahead_urls?tt.none():tt.some({targets:GC(t.getBody()),anchorTop:nk(t.settings,"anchor_top","#top").getOrUndefined(),anchorBottom:nk(t.settings,"anchor_bottom","#bottom").getOrUndefined()});var t},getValidationHandler:function(){return t=n.settings.filepicker_validator_handler,et(t)?tt.some(t):tt.none();var t},getUrlPicker:function(t){return i=t,ok((r=n).settings,i).map(function(o){return function(n){return _v.nu(function(e){var t=GS.extend({filetype:i},tt.from(n.meta).getOr({}));o.call(r,function(t,n){if(!K(t))throw new Error("Expected value to be string");if(n!==undefined&&!J(n))throw new Error("Expected meta to be a object");e({value:t,meta:n})},n.value,t)})}});var r,i}}},ik=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m={shared:{providers:{icons:function(){return n.ui.registry.getAll().icons},menuItems:function(){return n.ui.registry.getAll().menuItems},translate:cp.translate},interpreter:function(t){return bC(hC,t,m)},anchors:kC(n,e,o),getSink:function(){return Lt.value(t)}},urlinput:rk(n),styleselect:(r=n,i=function(t){return function(){return r.formatter.match(t)}},u=function(n){return function(){var t=r.formatter.get(n);return t!==undefined?tt.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:r.formatter.getCssText(n)}):tt.none()}},a=function(t){var n=t.items;return n!==undefined&&0<n.length?bt(n,a):[t.format]},c=nn([]),s=nn([]),f=nn([]),l=nn([]),d=nn(!1),r.on("init",function(){var t=BC(r),n=AC(r,t,i,u);c.set(n),s.set(bt(n,a))}),r.on("addStyleModifications",function(t){var n=AC(r,t.items,i,u);f.set(n),d.set(t.replace),l.set(bt(n,a))}),{getData:function(){var t=d.get()?[]:c.get(),n=f.get();return t.concat(n)},getFlattenedKeys:function(){var t=d.get()?[]:s.get(),n=l.get();return t.concat(n)}}),colorinput:OC(n)};return m},uk=we("within","extra","withinWidth"),ak=function(t,n,o){var e,r=(e=function(t,n){var e=o(t);return tt.some({element:Z(t),start:Z(n),finish:Z(n+e),width:Z(e)})},dt(t,function(n,t){return e(t,n.len).fold(Z(n),function(t){return{len:t.finish(),list:n.list.concat([t])}})},{len:0,list:[]}).list),i=ft(r,function(t){return t.finish()<=n}),u=lt(i,function(t,n){return t+n.width()},0),a=r.slice(i.length);return{within:Z(i),extra:Z(a),withinWidth:Z(u)}},ck=function(t){return ct(t,function(t){return t.element()})},sk=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p,h=(r=t,i=n,u=e,a=ak(i,r,u),0===a.extra().length?tt.some(a):tt.none()).getOrThunk(function(){return ak(n,t-e(o),e)}),v=h.within(),b=h.extra(),y=h.withinWidth();return 1===b.length&&b[0].width()<=e(o)?(m=b,g=y,p=ck(v.concat(m)),uk(p,[],g)):1<=b.length?(s=b,f=o,l=y,d=ck(v).concat([f]),uk(d,ck(s),l)):(c=y,uk(ck(v),[],c))},fk=function(n,t){return t.getAnimationRoot.fold(function(){return n.element()},function(t){return t(n)})},lk=function(t){return t.dimension.property},dk=function(t,n){return t.dimension.getDimension(n)},mk=function(t,n){var e=fk(t,n);yu(e,[n.shrinkingClass,n.growingClass])},gk=function(t,n){hu(t.element(),n.openClass),gu(t.element(),n.closedClass),Cu(t.element(),lk(n),"0px"),Au(t.element())},pk=function(t,n){hu(t.element(),n.closedClass),gu(t.element(),n.openClass),Du(t.element(),lk(n))},hk=function(t,n,e){e.setCollapsed(),Cu(t.element(),lk(n),dk(n,t.element())),Au(t.element()),mk(t,n),gk(t,n),n.onStartShrink(t),n.onShrunk(t)},vk=function(t,n,e,o){var r=o.getOrThunk(function(){return dk(n,t.element())});e.setCollapsed(),Cu(t.element(),lk(n),r),Au(t.element());var i=fk(t,n);hu(i,n.growingClass),gu(i,n.shrinkingClass),gk(t,n),n.onStartShrink(t)},bk=function(t,n,e){var o=dk(n,t.element());("0px"===o?hk:vk)(t,n,e,tt.some(o))},yk=function(t,n,e){var o=fk(t,n),r=vu(o,n.shrinkingClass),i=dk(n,t.element());pk(t,n);var u=dk(n,t.element());(r?function(){Cu(t.element(),lk(n),i),Au(t.element())}:function(){gk(t,n)})(),hu(o,n.shrinkingClass),gu(o,n.growingClass),pk(t,n),Cu(t.element(),lk(n),u),e.setExpanded(),n.onStartGrow(t)},xk=function(t,n){var e=fk(t,n);return!0===vu(e,n.growingClass)},wk=function(t,n){var e=fk(t,n);return!0===vu(e,n.shrinkingClass)},Sk=Object.freeze({refresh:function(t,n,e){if(e.isExpanded()){Du(t.element(),lk(n));var o=dk(n,t.element());Cu(t.element(),lk(n),o)}},grow:function(t,n,e){e.isExpanded()||yk(t,n,e)},shrink:function(t,n,e){e.isExpanded()&&bk(t,n,e)},immediateShrink:function(t,n,e){e.isExpanded()&&hk(t,n,e,tt.none())},hasGrown:function(t,n,e){return e.isExpanded()},hasShrunk:function(t,n,e){return e.isCollapsed()},isGrowing:xk,isShrinking:wk,isTransitioning:function(t,n){return!0===xk(t,n)||!0===wk(t,n)},toggleGrow:function(t,n,e){(e.isExpanded()?bk:yk)(t,n,e)},disableTransitions:mk}),Ck=Object.freeze({exhibit:function(t,n){var e=n.expanded;return nu(e?{classes:[n.openClass],styles:{}}:{classes:[n.closedClass],styles:$t(n.dimension.property,"0px")})},events:function(e,o){return xi([Ai(xn(),function(t,n){n.event().raw().propertyName===e.dimension.property&&(mk(t,e),o.isExpanded()&&Du(t.element(),e.dimension.property),(o.isExpanded()?e.onGrown:e.onShrunk)(t))})])}}),kk=[Rr("closedClass"),Rr("openClass"),Rr("shrinkingClass"),Rr("growingClass"),Wr("getAnimationRoot"),ea("onShrunk"),ea("onStartShrink"),ea("onGrown"),ea("onStartGrow"),Kr("expanded",!1),Hr("dimension",Br("property",{width:[ua("property","width"),ua("getDimension",function(t){return _a(t)+"px"})],height:[ua("property","height"),ua("getDimension",function(t){return Ia(t)+"px"})]}))],Ok=ha({fields:kk,name:"sliding",active:Ck,apis:Sk,state:Object.freeze({init:function(t){var n=nn(t.expanded);return Zi({isExpanded:function(){return!0===n.get()},isCollapsed:function(){return!1===n.get()},setCollapsed:h(n.set,!1),setExpanded:h(n.set,!0),readState:function(){return"expanded: "+n.get()}})}})}),Ek=Z([Kr("shell",!0),af("toolbarBehaviours",[Om])]),Tk=Z([Hf({name:"groups",overrides:function(){return{behaviours:ga([Om.config({})])}}})]),Bk=fl({name:"Toolbar",configFields:Ek(),partFields:Tk(),factory:function(n,t){var e=function(t){return n.shell?tt.some(t):Kf(t,n,"groups")},o=n.shell?{behaviours:[Om.config({})],components:[]}:{behaviours:[],components:t};return{uid:n.uid,dom:n.dom,components:o.components,behaviours:sf(n.toolbarBehaviours,o.behaviours),apis:{setGroups:function(t,n){e(t).fold(function(){throw b.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){Om.set(t,n)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)}}}),Dk=Z([ta(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),af("splitToolbarBehaviours",[]),oi("builtGroups",function(){return nn([])}),Kr("overflow",function(){return tt.none()}),ti("floating",!1)]),Ak=[Rr("dom"),Kr("overflow",function(){return tt.none()}),ti("floating",!1)],_k=Z([Vf({factory:Bk,schema:Ak,name:"primary"}),Hf({factory:Bk,schema:Ak,name:"overflow",overrides:function(n){return{toolbarBehaviours:ga([Ok.config({dimension:{property:"height"},closedClass:n.markers.closedClass,openClass:n.markers.openClass,shrinkingClass:n.markers.shrinkingClass,growingClass:n.markers.growingClass}),xm.config({mode:"acyclic",onEscape:function(t){return Kf(t,n,"overflow-button").each(xm.focusIn),tt.some(!0)}})])}}}),Rf({name:"overflow-button",overrides:function(t){return{buttonBehaviours:ga([eg.config({toggleClass:t.markers.overflowToggledClass,aria:{mode:"pressed"}})])}}}),Rf({name:"overflow-group"})]),Mk=Z([Rr("items"),ta(["itemSelector"]),af("tgroupBehaviours",[xm])]),Fk=Z([Nf({name:"items",unit:"item"})]),Ik=fl({name:"ToolbarGroup",configFields:Mk(),partFields:Fk(),factory:function(t,n){return{uid:t.uid,dom:t.dom,components:n,behaviours:sf(t.tgroupBehaviours,[xm.config({mode:"flow",selector:t.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),Vk=function(t,n){var e=ct(n,function(t){return Uu(t)});Bk.setGroups(t,e)},Rk=function(t,e,n,o){var r=Jf(t,e,"primary"),i=Kf(t,e,"overflow").orThunk(function(){return e.overflow(t)});Cu(r.element(),"visibility","hidden"),i.each(function(t){Bk.setGroups(t,[])});var u=e.builtGroups.get(),a=Ik.sketch(To({},n["overflow-group"](),{items:[Eg.sketch(To({},n["overflow-button"](),{action:function(){!0===e.floating?ai(t,o):i.each(function(t){Ok.toggleGrow(t)})}}))]})),c=t.getSystem().build(a);Vk(r,u.concat([c]));var s=_a(r.element()),f=sk(s,u,function(t){return _a(t.element())},c);0===f.extra().length?(Om.remove(r,c),i.each(function(t){Bk.setGroups(t,[])})):(Vk(r,f.within()),i.each(function(t){Vk(t,f.extra())})),Du(r.element(),"visibility"),Au(r.element()),i.each(function(n){e.floating||Ok.refresh(n),Kf(t,e,"overflow-button").each(function(t){e.floating?eg.set(t,n.getSystem().isConnected()):(eg.set(t,Ok.hasGrown(n)),xm.focusIn(n))})})},Hk=fl({name:"SplitToolbar",configFields:Dk(),partFields:_k(),factory:function(o,t,n,r){var i="alloy.toolbar.toggle";return{uid:o.uid,dom:o.dom,components:t,behaviours:sf(o.splitToolbarBehaviours,[]),apis:{setGroups:function(t,n){var e;e=ct(n,t.getSystem().build),o.builtGroups.set(e),Rk(t,o,r,i)},refresh:function(t){Rk(t,o,r,i)},getMoreButton:function(t){return Kf(t,o,"overflow-button")},getOverflow:function(t){return Kf(n=t,o,"overflow").orThunk(function(){return o.overflow(n)});var n}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(t,n,e){t.setGroups(n,e)},refresh:function(t,n){t.refresh(n)},getMoreButton:function(t,n){return t.getMoreButton(n)},getOverflow:function(t,n){return t.getOverflow(n)}}}),Nk=function(t){var n=t.title.fold(function(){return{}},function(t){return{attributes:{title:t}}});return{dom:To({tag:"div",classes:["tox-toolbar__group"]},n),components:[Ik.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:ga([Ab.config({}),Um.config({})])}},zk=function(t){return Ik.sketch(Nk(t))},Pk=function(r,t,n){var e=_i(function(t){var n=ct(r.initGroups,zk);Bk.setGroups(t,n)}),o=n.fold(function(){return[e]},function(o){return[e,Ci("alloy.toolbar.toggle",function(e){r.getSink().toOption().each(function(n){o.getOpt(n).fold(function(){var t=ju(o.asSpec());Ns(n,t),Vs.position(n,r.backstage.shared.anchors.toolbarOverflow(),t),Hk.refresh(e),Hk.getMoreButton(e).each(Um.focus),xm.focusIn(t)},function(t){Ls(t)})})})]});return ga([xm.config({mode:t,onEscape:r.onEscape,selector:".tox-toolbar__group"}),sg("toolbar-events",o)])},Lk=function(o){var t=o.cyclicKeying?"cyclic":"acyclic",r=Tg(Bk.sketch({dom:{tag:"div",classes:["tox-toolbar__overflow"]},toolbarBehaviours:ga([xm.config({mode:"cyclic",onEscape:function(){return ai(o.moreDrawerData.lazyToolbar(),"alloy.toolbar.toggle"),xm.focusIn(o.moreDrawerData.lazyMoreButton()),tt.some(!0)}})])})),n=Hk.parts().primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),e=o.moreDrawerData.floating?[n]:[n,Hk.parts().overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}})];return Hk.sketch({uid:o.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},floating:o.moreDrawerData.floating,overflow:function(e){return o.getSink().toOption().bind(function(n){return r.getOpt(n).bind(function(t){return Hk.getMoreButton(e).bind(function(){return t.getSystem().isConnected()?(Vs.position(n,o.backstage.shared.anchors.toolbarOverflow(),t),tt.some(t)):tt.none()})})})},parts:{"overflow-group":Nk({title:tt.none(),items:[]}),"overflow-button":SS({name:"more",icon:tt.some("more-drawer"),disabled:!1,tooltip:tt.some("More...")},tt.none(),o.backstage.shared.providers)},components: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"},splitToolbarBehaviours:Pk(o,t,tt.some(r))})},jk=function(t){var n=t.cyclicKeying?"cyclic":"acyclic";return Bk.sketch({uid:t.uid,dom:{tag:"div",classes:["tox-toolbar"]},components:[Bk.parts().groups({})],toolbarBehaviours:Pk(t,n,tt.none())})},Uk=[ti("disabled",!1),Xr("tooltip"),Xr("icon"),Xr("text"),ni("onSetup",function(){return Q})],Wk=dr([Nr("type"),Pr("onAction")].concat(Uk)),Gk=function(t){return kr("toolbarbutton",Wk,t)},Xk=dr([Nr("type"),Xr("tooltip"),Xr("icon"),Xr("text"),Pr("fetch"),ni("onSetup",function(){return Q})]),Yk=dr([Nr("type"),Xr("tooltip"),Xr("icon"),Xr("text"),Yr("select"),Pr("fetch"),ni("onSetup",function(){return Q}),Zr("presets","normal",["normal","color","listpreview"]),Kr("columns",1),Pr("onAction"),Pr("onItemAction")]),qk=[ti("active",!1)].concat(Uk),Kk=dr(qk.concat([Nr("type"),Pr("onAction")])),Jk=function(t){return kr("ToggleButton",Kk,t)},$k=[ni("predicate",function(){return!1}),Zr("scope","node",["node","editor"]),Zr("position","selection",["node","selection","line"])],Qk=Uk.concat([Kr("type","contextformbutton"),Kr("primary",!1),Pr("onAction"),oi("original",U)]),Zk=qk.concat([Kr("type","contextformbutton"),Kr("primary",!1),Pr("onAction"),oi("original",U)]),tO=Uk.concat([Kr("type","contextformbutton")]),nO=qk.concat([Kr("type","contextformtogglebutton")]),eO=Br("type",{contextformbutton:Qk,contextformtogglebutton:Zk}),oO=dr([Kr("type","contextform"),ni("initValue",function(){return""}),Xr("label"),Ur("commands",eO),Gr("launch",Br("type",{contextformbutton:tO,contextformtogglebutton:nO}))].concat($k)),rO=dr([Kr("type","contexttoolbar"),Nr("items")].concat($k)),iO=Oo("toolbar.button.execute"),uO={"alloy.execute":["disabling","alloy.base.behaviour","toggling","toolbar-button-events"]},aO=Object.freeze({getState:function(t,n,e){return e}}),cO=Object.freeze({events:function(r,i){var o=function(e,o){r.updateState.each(function(t){var n=t(e,o);i.set(n)}),r.renderComponents.each(function(t){var n=t(o,i.get());js(e),st(n,function(t){Ns(e,e.getSystem().build(t))})})};return xi([Ci(Zn(),function(t,n){var e=r.channel;it(n.channels(),e)&&o(t,n.data())}),_i(function(n){r.initialData.each(function(t){o(n,t)})})])}}),sO=Object.freeze({init:function(){var n=nn(tt.none());return{readState:function(){return n.get().getOr("none")},get:function(){return n.get()},set:function(t){return n.set(t)},clear:function(){return n.set(tt.none())}}}}),fO=[Rr("channel"),Wr("renderComponents"),Wr("updateState"),Wr("initialData")],lO=ha({fields:fO,name:"reflecting",active:cO,apis:aO,state:sO}),dO=Z([Rr("toggleClass"),Rr("fetch"),ra("onExecute"),Kr("getHotspot",tt.some),Kr("layouts",tt.none()),ra("onItemExecute"),Wr("lazySink"),Rr("dom"),ea("onOpen"),af("splitDropdownBehaviours",[Sv,xm,Um]),Kr("matchWidth",!1),Kr("useMinWidth",!1),Kr("eventOrder",{}),Wr("role")].concat(Qv())),mO=Vf({factory:Eg,schema:[Rr("dom")],name:"arrow",defaults:function(){return{buttonBehaviours:ga([Um.revoke()])}},overrides:function(n){return{dom:{tag:"span",attributes:{role:"presentation"}},action:function(t){t.getSystem().getByUid(n.uid).each(si)},buttonBehaviours:ga([eg.config({toggleOnExecute:!1,toggleClass:n.toggleClass})])}}}),gO=Vf({factory:Eg,schema:[Rr("dom")],name:"button",defaults:function(){return{buttonBehaviours:ga([Um.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)})}}}}),pO=Z([mO,gO,Hf({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:t.text}}}},schema:[Rr("text")],name:"aria-descriptor"}),Rf({schema:[Zu()],name:"menu",defaults:function(o){return{onExecute:function(n,e){n.getSystem().getByUid(o.uid).each(function(t){o.onItemExecute(t,n,e)})}}}}),Fv()]),hO=fl({name:"SplitDropdown",configFields:dO(),partFields:pO(),factory:function(o,t,n,e){var r=function(t){gl.getCurrent(t).each(function(t){Tl.highlightFirst(t),xm.focusIn(t)})},i=function(t){Pv(o,function(t){return t},t,e,r,ov.HighlightFirst).get(Q)},u=function(t){var n=Jf(t,o,"button");return si(n),tt.some(!0)},a=Xt(xi([_i(function(e){Kf(e,o,"aria-descriptor").each(function(t){var n=Oo("aria");ro(t.element(),"id",n),ro(e.element(),"aria-describedby",n)})})]),Og(tt.some(i)));return{uid:o.uid,dom:o.dom,components:t,eventOrder:To({},o.eventOrder,{"alloy.execute":["disabling","toggling","alloy.base.behaviour"]}),events:a,behaviours:sf(o.splitDropdownBehaviours,[Sv.config({
  others:{sandbox:function(t){var n=Jf(t,o,"arrow");return Uv(o,t,{onOpen:function(){eg.on(n),eg.on(t)},onClose:function(){eg.off(n),eg.off(t)}})}}}),xm.config({mode:"special",onSpace:u,onEnter:u,onDown:function(t){return i(t),tt.some(!0)}}),Um.config({}),eg.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:o.role.getOr("button"),"aria-haspopup":!0}}}}}),vO=function(n){return{isDisabled:function(){return Np.isDisabled(n)},setDisabled:function(t){return t?Np.disable(n):Np.enable(n)}}},bO=function(n){return{setActive:function(t){eg.set(n,t)},isActive:function(){return eg.isOn(n)},isDisabled:function(){return Np.isDisabled(n)},setDisabled:function(t){return t?Np.disable(n):Np.enable(n)}}},yO=function(t,n){return t.map(function(t){return{"aria-label":n.translate(t),title:n.translate(t)}}).getOr({})},xO=Oo("focus-button"),wO=function(n,e,t,o,r,i){var u;return{dom:{tag:"button",classes:["tox-tbtn"].concat(e.isSome()?["tox-tbtn--select"]:[]),attributes:yO(t,i)},components:Kp([n.map(function(t){return bS(t,i.icons)}),e.map(function(t){return xS(t,"tox-tbtn",i)})]),eventOrder:(u={},u[cn()]=["focusing","alloy.base.behaviour","common-button-display-events"],u),buttonBehaviours:ga([sg("common-button-display-events",[Ci(cn(),function(t,n){n.event().prevent(),ai(t,xO)})])].concat(o.map(function(t){return lO.config({channel:t,initialData:{icon:n,text:e},renderComponents:function(t){return Kp([t.icon.map(function(t){return bS(t,i.icons)}),t.text.map(function(t){return xS(t,"tox-tbtn",i)})])}})}).toArray()).concat(r.getOr([])))}},SO=function(t,n,e){var o,r=nn(Q),i=wO(t.icon,t.text,t.tooltip,tt.none(),tt.none(),e);return Eg.sketch({dom:i.dom,components:i.components,eventOrder:uO,buttonBehaviours:ga([sg("toolbar-button-events",[(o={onAction:t.onAction,getApi:n.getApi},Ii(function(n){jp(o,n)(function(t){ci(n,iO,{buttonApi:t}),o.onAction(t)})})),Up(n,r),Wp(n,r)]),Pp(t.disabled)].concat(n.toolbarButtonBehaviours))})},CO=function(t,n,e){return SO(t,{toolbarButtonBehaviours:[].concat(0<e.length?[sg("toolbarButtonWith",e)]:[]),getApi:vO,onSetup:t.onSetup},n)},kO=function(t,n,e){return Gt(SO(t,{toolbarButtonBehaviours:[Om.config({}),eg.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(0<e.length?[sg("toolbarToggleButtonWith",e)]:[]),getApi:bO,onSetup:t.onSetup},n))},OO=function(n,t){var e,o,r,i,u=Oo("channel-update-split-dropdown-display"),a=function(e){return{isDisabled:function(){return Np.isDisabled(e)},setDisabled:function(t){return t?Np.disable(e):Np.enable(e)},setIconFill:function(t,n){Gu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){ro(t,"fill",n)})},setIconStroke:function(t,n){Gu(e.element(),'svg path[id="'+t+'"], rect[id="'+t+'"]').each(function(t){ro(t,"stroke",n)})},setActive:function(n){ro(e.element(),"aria-pressed",n),Gu(e.element(),"span").each(function(t){e.getSystem().getByDom(t).each(function(t){return eg.set(t,n)})})},isActive:function(){return Gu(e.element(),"span").exists(function(t){return e.getSystem().getByDom(t).exists(eg.isOn)})}}},c=nn(Q),s={getApi:a,onSetup:n.onSetup};return hO.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:Xt({"aria-pressed":!1},yO(n.tooltip,t.providers))},onExecute:function(t){n.onAction(a(t))},onItemExecute:function(){},splitDropdownBehaviours:ga([Lp(!1),sg("split-dropdown-events",[Ci(xO,Um.focus),Up(s,c),Wp(s,c)])]),eventOrder:(e={},e[fe()]=["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 _v.nu(function(t){return r.fetch(t)}).map(function(t){return tt.from(Bh(Gt(Eh(Oo("menu-value"),t,function(t){r.onItemAction(o(n),t)},r.columns,r.presets,Yp.CLOSE_ON_EXECUTE,r.select.getOr(function(){return!1}),i),{movement:gh(r.columns,r.presets),menuBehaviours:Qg("auto"!==r.columns?[]:[_i(function(o){Jg(o,4,vp(r.presets)).each(function(t){var n=t.numRows,e=t.numColumns;xm.setGridSize(o,n,e)})})])})))})}),parts:{menu:mh(0,n.columns,n.presets)},components:[hO.parts().button(wO(n.icon,n.text,tt.none(),tt.some(u),tt.some([eg.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1})]),t.providers)),hO.parts().arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:Dg("chevron-down",t.providers.icons)}}),hO.parts()["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})},EO=function(i,u){return Ci(iO,function(t,n){var e,o=i.get(t),r=(e=o,{hide:function(){return ai(e,ie())},getValue:function(){return Nm.getValue(e)}});u.onAction(r,n.event().buttonApi())})},TO=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=v(d,["primary"]),g=Or(Jk(To({},m,{type:"togglebutton",onAction:function(){}}))),kO(g,l.backstage.shared.providers,[EO(s,f)])):(o=t,i=p,(u=(r=n).original).primary,a=v(u,["primary"]),c=Or(Gk(To({},a,{type:"button",onAction:function(){}}))),CO(c,i.backstage.shared.providers,[EO(o,r)]))},BO=function(t,n){var e,o,r,i,u=t.label.fold(function(){return{}},function(t){return{"aria-label":t}}),a=Tg(mb.sketch({inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-js"],data:t.initValue(),inputAttributes:u,selectOnFocus:!0,inputBehaviours:ga([xm.config({mode:"special",onEnter:function(t){return c.findPrimary(t).map(function(t){return si(t),!0})},onLeft:function(t,n){return n.cut(),tt.none()},onRight:function(t,n){return n.cut(),tt.none()}})])})),c=(e=a,o=t.commands,r=n.shared.providers,i=ct(o,function(t){return Tg(TO(e,t,r))}),{asSpecs:function(){return ct(i,function(t){return t.asSpec()})},findPrimary:function(e){return on(o,function(t,n){return t.primary?tt.from(i[n]).bind(function(t){return t.getOpt(e)}).filter(N(Np.isDisabled)):tt.none()})}});return jk({uid:Oo("context-toolbar"),initGroups:[{title:tt.none(),items:[a.asSpec()]},{title:tt.none(),items:c.asSpecs()}],onEscape:tt.none,cyclicKeying:!0,backstage:n,getSink:function(){return Lt.error("")}})},DO=Oo("forward-slide"),AO=Oo("backward-slide"),_O=Oo("change-slide-event"),MO="tox-pop--resizing",FO=function(n,t){return on(t,function(t){return t.predicate(n.dom())?tt.some({toolbarApi:t,elem:n}):tt.none()})},IO=function(n,e){var t=function(t){return t.dom()===e.getBody()},a=xe.fromDom(e.selection.getNode());return FO(a,n.inNodeScope).orThunk(function(){return FO(a,n.inEditorScope).orThunk(function(){return function(t,n,e){for(var o=a.dom(),r=et(e)?e:Z(!1);o.parentNode;){o=o.parentNode;var i=xe.fromDom(o),u=n(i);if(u.isSome())return u;if(r(i))break}return tt.none()}(0,function(t){return FO(t,n.inNodeScope)},t)})})},VO=function(e,r){var t={},i=[],u=[],a={},c={},o=function(n,e){var o=Or(kr("ContextForm",oO,e));(t[n]=o).launch.map(function(t){a["form:"+n]=To({},e.launch,{type:"contextformtogglebutton"===t.type?"togglebutton":"button",onAction:function(){r(o)}})}),"editor"===o.scope?u.push(o):i.push(o),c[n]=o},s=function(n,e){var t;(t=e,kr("ContextToolbar",rO,t)).each(function(t){"editor"===e.scope?u.push(t):i.push(t),c[n]=t})},n=Tt(e);return st(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}},RO=Oo("update-menu-text"),HO=Oo("update-menu-icon"),NO=function(t,n,o){var r=t.text.map(function(t){return Tg(xS(t,n,o.providers))}),i=t.icon.map(function(t){return Tg(yS(t,o.providers.icons))}),e=function(t,n){var e=Nm.getValue(t);return Um.focus(e),ci(e,"keydown",{raw:n.event().raw()}),yy.close(e),tt.some(!0)},u=t.role.fold(function(){return{}},function(t){return{role:t}}),a=t.tooltip.fold(function(){return{}},function(t){var n=o.providers.translate(t);return{title:n,"aria-label":n}});return Tg(yy.sketch(To({},u,{dom:{tag:"button",classes:[n,n+"--select"].concat(ct(t.classes,function(t){return n+"--"+t})),attributes:To({},a)},components:Kp([i.map(function(t){return t.asSpec()}),r.map(function(t){return t.asSpec()}),tt.some({dom:{tag:"div",classes:[n+"__select-chevron"],innerHtml:Dg("chevron-down",o.providers.icons)}})]),matchWidth:!0,useMinWidth:!0,dropdownBehaviours:ga([Pp(t.disabled),xy.config({}),Om.config({}),sg("menubutton-update-display-text",[_i(t.onAttach),Mi(t.onDetach),Ci(RO,function(n,e){r.bind(function(t){return t.getOpt(n)}).each(function(t){Om.set(t,[zu(o.providers.translate(e.event().text()))])})}),Ci(HO,function(n,e){i.bind(function(t){return t.getOpt(n)}).each(function(t){Om.set(t,[yS(e.event().icon(),o.providers.icons)])})})])]),eventOrder:Gt(uO,{mousedown:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"]}),sandboxBehaviours:ga([xm.config({mode:"special",onLeft:e,onRight:e})]),lazySink:o.getSink,toggleClass:n+"--active",parts:{menu:mh(0,t.columns,t.presets)},fetch:function(){return _v.nu(t.fetch)}}))).asSpec()},zO=function(o,r){return function(n){var e=nn(tt.none()),t=function(){n.setActive(o.formatter.match(r));var t=o.formatter.formatChanged(r,n.setActive).unbind;e.set(tt.some(t))};return o.initialized?t():o.on("init",t),function(){return e.get().each(function(t){return t()})}}},PO=function(n){return function(t){return function(){n.undoManager.transact(function(){n.focus(),n.execCommand("mceToggleFormat",!1,t.format)})}}},LO=function(t,n,e,o){var i,u,r,a,c,s="basic"===e.type?function(){return ct(e.data,function(t){return DC(t,o.isSelectedFor,o.getPreviewFor)})}:e.getData;return{items:(i=n,u=o,r=function(t,n,e){var o=i.shared.providers.translate(t.title);if("separator"===t.type)return tt.some({type:"separator",text:o});if("submenu"!==t.type)return tt.some(To({type:"togglemenuitem",text:o,active:t.isSelected(),disabled:e,onAction:u.onAction(t)},t.getStylePreview().fold(function(){return{}},function(t){return{meta:{style:t}}})));var r=bt(t.getStyleItems(),function(t){return a(t,n)});return 0===n&&r.length<=0?tt.none():tt.some({type:"nestedmenuitem",text:o,disabled:r.length<=0,getSubmenuItems:function(){return bt(t.getStyleItems(),function(t){return a(t,n)})}})},a=function(t,n){var e="formatter"===t.type&&u.isInvalid(t);return 0===n?e?[]:r(t,n,!1).toArray():r(t,n,e).toArray()},c=function(t){var n=u.shouldHide?0:1;return bt(t,function(t){return a(t,n)})},{validateItems:c,getFetch:function(o,r){return function(t){var n=r(),e=c(n);t(db(e,Yp.CLOSE_ON_EXECUTE,o.shared.providers))}}}),getStyleItems:s}},jO=function(o,t,n,e){var r=LO(0,t,n,e),i=r.items,u=r.getStyleItems,a=nn(undefined),c=e.nodeChangeHandler.map(function(e){return function(t){var n=e(t);a.set(n),o.on("nodeChange",n)}}).getOr(Q),s=e.nodeChangeHandler.map(function(){return function(){var t=a.get();t!==undefined&&o.off("nodeChange",t)}}).getOr(Q);return NO({text:e.icon.isSome()?tt.none():tt.some(""),icon:e.icon,tooltip:tt.from(e.tooltip),role:tt.none(),fetch:i.getFetch(t,u),onAttach:c,onDetach:s,columns:1,presets:"normal",classes:e.icon.isSome()?[]:["bespoke"]},"tox-tbtn",t.shared)};(Rv=Vv||(Vv={}))[Rv.SemiColon=0]="SemiColon",Rv[Rv.Space=1]="Space";var UO,WO,GO=function(t,n,e,o){var r,i;return{type:"basic",data:(i=Jt(t.settings,n).getOr(e),r=o===Vv.SemiColon?i.replace(/;$/,"").split(";"):i.split(" "),ct(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}}))}},XO=[{title:"Left",icon:"align-left",format:"alignleft"},{title:"Center",icon:"align-center",format:"aligncenter"},{title:"Right",icon:"align-right",format:"alignright"},{title:"Justify",icon:"align-justify",format:"alignjustify"}],YO=function(e){var t=tt.some(function(n){return function(){var t=mt(XO,function(t){return e.formatter.match(t.format)}).fold(function(){return"left"},function(t){return t.title.toLowerCase()});ci(n,HO,{icon:"align-"+t})}}),n={type:"basic",data:XO};return{tooltip:"Align",icon:tt.some("align-left"),isSelectedFor:function(t){return function(){return e.formatter.match(t)}},getPreviewFor:function(){return function(){return tt.none()}},onAction:PO(e),nodeChangeHandler:t,dataset:n,shouldHide:!1,isInvalid:function(t){return!e.formatter.canApply(t.format)}}},qO=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],KO=function(r){var o=function(){var e=function(t){return t?t.split(",")[0]:""},t=r.queryCommandValue("FontName"),n=i.data,o=t?t.toLowerCase():"";return mt(n,function(t){var n=t.format;return n.toLowerCase()===o||e(n).toLowerCase()===e(o).toLowerCase()}).orThunk(function(){return 0===(t=o).indexOf("-apple-system")&&(n=t.toLowerCase().split(/['"]?\s*,\s*['"]?/),yt(qO,function(t){return-1<n.indexOf(t.toLowerCase())}))?tt.from({title:"System Font",format:o}):tt.none();var t,n})},t=tt.some(function(e){return function(){var t=r.queryCommandValue("FontName"),n=o().fold(function(){return t},function(t){return t.title});ci(e,RO,{text:n})}}),i=GO(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",Vv.SemiColon);return{tooltip:"Fonts",icon:tt.none(),isSelectedFor:function(n){return function(){return o().exists(function(t){return t.format===n})}},getPreviewFor:function(t){return function(){return tt.some({tag:"div",styleAttr:-1===t.indexOf("dings")?"font-family:"+t:""})}},onAction:function(t){return function(){r.undoManager.transact(function(){r.focus(),r.execCommand("FontName",!1,t.format)})}},nodeChangeHandler:t,dataset:i,shouldHide:!1,isInvalid:function(){return!1}}},JO=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},$O=function(i){var u=function(){var e=tt.none(),o=a.data,r=i.queryCommandValue("FontSize");if(r)for(var t=function(t){var n=JO(r,t);e=mt(o,function(t){return t.format===r||t.format===n})},n=3;e.isNone()&&0<=n;n--)t(n);return{matchOpt:e,px:r}},t=tt.some(function(r){return function(){var t=u(),n=t.matchOpt,e=t.px,o=n.fold(function(){return e},function(t){return t.title});ci(r,RO,{text:o})}}),a=GO(i,"fontsize_formats","8pt 10pt 12pt 14pt 18pt 24pt 36pt",Vv.Space);return{tooltip:"Font sizes",icon:tt.none(),isSelectedFor:function(n){return function(){return u().matchOpt.exists(function(t){return t.format===n})}},getPreviewFor:function(){return function(){return tt.none()}},onAction:function(t){return function(){i.undoManager.transact(function(){i.focus(),i.execCommand("FontSize",!1,t.format)})}},nodeChangeHandler:t,dataset:a,shouldHide:!1,isInvalid:function(){return!1}}},QO=function(e,t,n){var o=n.parents,r=t();return on(o,function(n){return mt(r,function(t){return e.formatter.matchNode(n,t.format)})}).orThunk(function(){return e.formatter.match("p")?tt.some({title:"Paragraph",format:"p"}):tt.none()})},ZO=function(o){var t=tt.some(function(e){return function(t){var n=QO(o,function(){return r.data},t).fold(function(){return"Paragraph"},function(t){return t.title});ci(e,RO,{text:n})}}),r=GO(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",Vv.SemiColon);return{tooltip:"Blocks",icon:tt.none(),isSelectedFor:function(t){return function(){return o.formatter.match(t)}},getPreviewFor:function(n){return function(){var t=o.formatter.get(n);return tt.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:o.formatter.getCssText(n)})}},onAction:PO(o),nodeChangeHandler:t,dataset:r,shouldHide:!1,isInvalid:function(t){return!o.formatter.canApply(t.format)}}},tE=function(i){var t=tt.some(function(e){var o=function(t){var n=t.items;return n!==undefined&&0<n.length?bt(n,o):[{title:t.title,format:t.format}]},r=bt(BC(i),o);return function(t){var n=QO(i,function(){return r},t).fold(function(){return"Paragraph"},function(t){return t.title});ci(e,RO,{text:n})}});return{tooltip:"Formats",icon:tt.none(),isSelectedFor:function(t){return function(){return i.formatter.match(t)}},getPreviewFor:function(n){return function(){var t=i.formatter.get(n);return t!==undefined?tt.some({tag:0<t.length&&(t[0].inline||t[0].block)||"div",styleAttr:i.formatter.getCssText(n)}):tt.none()}},onAction:PO(i),nodeChangeHandler:t,shouldHide:i.getParam("style_formats_autohide",!1,"boolean"),isInvalid:function(t){return!i.formatter.canApply(t.format)}}},nE={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 | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck code wordcount"},table:{title:"Table",items:"inserttable tableprops deletetable row column cell"},help:{title:"Help",items:"help"}},eE=function(t,n,e,o){return NO({text:t.text,icon:t.icon,tooltip:t.tooltip,role:o,fetch:function(n){t.fetch(function(t){n(db(t,Yp.CLOSE_ON_EXECUTE,e.providers))})},onAttach:function(){},onDetach:function(){},columns:1,presets:"normal",classes:[]},n,e)},oE=function(t){return"string"==typeof t?t.split(" "):t},rE=function(u,a){var c=Xt(nE,a.menus),n=0<Tt(a.menus).length,t=a.menubar===undefined||!0===a.menubar?oE("file edit view insert format tools table help"):oE(!1===a.menubar?"":a.menubar),e=ft(t,function(t){return n&&a.menus.hasOwnProperty(t)&&a.menus[t].hasOwnProperty("items")||nE.hasOwnProperty(t)}),o=ct(e,function(t){var n,e,o,r,i=c[t];return n={title:i.title,items:oE(i.items)},e=a,r=(o=u,o.getParam("removed_menuitems","")).split(/[ ,]/),{text:n.title,getItems:function(){return bt(n.items,function(t){var n=t.toLowerCase();return 0===n.trim().length?[]:ut(r,function(t){return t===n})?[]:"separator"===n||"|"===n?[{type:"separator"}]:e.menuItems[n]?[e.menuItems[n]]:[]})}}});return ft(o,function(t){return 0<t.getItems().length&&ut(t.getItems(),function(t){return"separator"!==t.type})})},iE=[{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"]}],uE=function(o,r){return function(t,n){var e=o(t).fold(H(Lt.error,Tr),Lt.value).getOrDie();return r(e,n)}},aE={button:uE(Gk,function(t,n){return e=t,o=n.backstage.shared.providers,CO(e,o,[]);var e,o}),togglebutton:uE(Jk,function(t,n){return e=t,o=n.backstage.shared.providers,kO(e,o,[]);var e,o}),menubutton:uE(function(t){return kr("menubutton",Xk,t)},function(t,n){return eE(t,"tox-tbtn",n.backstage.shared,tt.none())}),splitbutton:uE(function(t){return kr("SplitButton",Yk,t)},function(t,n){return OO(t,n.backstage.shared)}),styleSelectButton:function(t,n){return e=t,r=(o=n.backstage).styleselect,jO(e,o,r,tE(e));var e,o,r},fontsizeSelectButton:function(t,n){return e=t,o=n.backstage,r=$O(e),jO(e,o,r.dataset,r);var e,o,r},fontSelectButton:function(t,n){return e=t,o=n.backstage,r=KO(e),jO(e,o,r.dataset,r);var e,o,r},formatButton:function(t,n){return e=t,o=n.backstage,r=ZO(e),jO(e,o,r.dataset,r);var e,o,r},alignMenuButton:function(t,n){return e=t,o=n.backstage,r=YO(e),jO(e,o,r.dataset,r);var e,o,r}},cE={styleselect:aE.styleSelectButton,fontsizeselect:aE.fontsizeSelectButton,fontselect:aE.fontSelectButton,formatselect:aE.formatButton,align:aE.alignMenuButton},sE=function(t){var n=t.split("|");return ct(n,function(t){return{items:t.trim().split(" ")}})},fE=function(t){return!1===t.toolbar?[]:t.toolbar===undefined||!0===t.toolbar?(e=t.buttons,n=ct(iE,function(t){var n=ft(t.items,function(t){return Vt(e,t)||Vt(cE,t)});return{name:t.name,items:n}}),ft(n,function(t){return 0<t.items.length})):K(t.toolbar)?sE(t.toolbar):$(t.toolbar)&&K(t.toolbar[0])?sE(t.toolbar.join(" | ")):t.toolbar;var e,n},lE=function(n,e,o,r,t){return It(e,o.toLowerCase()).orThunk(function(){return t.bind(function(t){return on(t,function(t){return It(e,t+o.toLowerCase())})})}).fold(function(){return It(cE,o.toLowerCase()).map(function(t){return t(n,r)}).orThunk(function(){return tt.none()})},function(t){return e=r,It(aE,(n=t).type).fold(function(){return b.console.error("skipping button defined by",n),tt.none()},function(t){return tt.some(t(n,e))});var n,e})},dE=function(e,o,r,i){var t=fE(o),n=ct(t,function(t){var n=bt(t.items,function(t){return 0===t.trim().length?[]:lE(e,o.buttons,t,r,i).toArray()});return{title:tt.from(e.translate(t.name)),items:n}});return ft(n,function(t){return 0<t.items.length})},mE=function(i,t,u,a){var n,e,c=ju((n={sink:u,onEscape:function(){return i.focus(),tt.some(!0)}},e=nn([]),kg.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:function(t){e.set([]),kg.getContent(t).each(function(t){Du(t.element(),"visibility")}),hu(t.element(),MO),Du(t.element(),"width")},inlineBehaviours:ga([sg("context-toolbar-events",[Ai(xn(),function(t){kg.getContent(t).each(function(){}),hu(t.element(),MO),Du(t.element(),"width")}),Ci(_O,function(n,e){Du(n.element(),"width");var t=_a(n.element());kg.setContent(n,e.event().contents()),gu(n.element(),MO);var o=_a(n.element());Cu(n.element(),"width",t+"px"),kg.getContent(n).each(function(t){e.event().focus().bind(function(t){return Nl(t),Pl(n.element())}).orThunk(function(){return xm.focusIn(t),zl()})}),Mg.setTimeout(function(){Cu(n.element(),"width",o+"px")},0)}),Ci(DO,function(t,n){kg.getContent(t).each(function(t){e.set(e.get().concat([{bar:t,focus:zl()}]))}),ci(t,_O,{contents:n.event().forwardContents(),focus:tt.none()})}),Ci(AO,function(n){Ot(e.get()).each(function(t){e.set(e.get().slice(0,e.get().length-1)),ci(n,_O,{contents:Uu(t.bar),focus:t.focus})})})]),xm.config({mode:"special",onEscape:function(t){return Ot(e.get()).fold(function(){return n.onEscape()},function(){return ai(t,AO),tt.some(!0)})}})]),lazySink:function(){return Lt.value(n.sink)}}))),s=function(){return tt.some(xe.fromDom(i.contentAreaContainer))};i.on("init",function(){var t=i.getBody().ownerDocument.defaultView,n=Ih(xe.fromDom(t),"scroll",function(){f.get().each(function(t){var n=l.get().getOr(i.selection.getNode()).getBoundingClientRect(),e=i.contentAreaContainer.getBoundingClientRect(),o=n.bottom<0,r=n.top>e.height;o||r?Cu(c.element(),"display","none"):(Du(c.element(),"display"),Vs.positionWithin(u,t,c,s()))})});i.on("remove",function(){n.unbind()})});var f=nn(tt.none()),l=nn(tt.none()),o=nn(null),d=function(t){return{dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:ga([xm.config({mode:"acyclic"}),sg("pop-dialog-wrap-events",[_i(function(t){i.shortcuts.add("ctrl+F9","focus statusbar",function(){return xm.focusIn(t)})}),Mi(function(){i.shortcuts.remove("ctrl+F9")})])])}},m=Sn(function(){return VO(t,function(t){var n=g(t);ci(c,DO,{forwardContents:d(n)})})}),g=function(t){var n,e,o=i.ui.registry.getAll().buttons,r=m();return"contexttoolbar"===t.type?(n=Xt(o,r.formNavigators),e=dE(i,{buttons:n,toolbar:t.items},a,tt.some(["form:"])),jk({uid:Oo("context-toolbar"),initGroups:e,onEscape:tt.none,cyclicKeying:!0,backstage:a.backstage,getSink:function(){return Lt.error("")}})):BO(t,a.backstage)};i.on("contexttoolbar-show",function(n){var t=m();Jt(t.lookupTable,n.toolbarKey).each(function(t){b(t,n.target===i?tt.none():tt.some(n)),kg.getContent(c).each(xm.focusIn)})});var r={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"]},p={maxHeightFunction:mc()},h={bubble:bc(12,0,r),layouts:{onLtr:function(){return[Fc]},onRtl:function(){return[Ic]}},overrides:p},v={bubble:bc(0,12,r),layouts:{onLtr:function(){return[_c,Mc,Dc,Tc,Ac,Bc]},onRtl:function(){return[_c,Mc,Ac,Bc,Dc,Tc]}},overrides:p},b=function(t,n){x();var e,o,r,i=g(t),u=(o=n.map(xe.fromDom),r="node"===(e=t.position)?a.backstage.shared.anchors.node(o):a.backstage.shared.anchors.cursor(),Gt(r,"line"===e?h:v));f.set(tt.some(u)),l.set(n),kg.showWithin(c,u,d(i),s()),Du(c.element(),"display")},y=function(){var t=m();IO(t,i).fold(function(){f.set(tt.none()),kg.hide(c)},function(t){b(t.toolbarApi,tt.some(t.elem.dom()))})},x=function(){var t=o.get();null!==t&&(Mg.clearTimeout(t),o.set(null))},w=function(t){x(),o.set(t)};i.on("init",function(){i.on("click keyup setContent ObjectResized ResizeEditor",function(){w(Mg.setEditorTimeout(i,y,0))}),i.on("focusout",function(){Mg.setEditorTimeout(i,function(){Pl(u.element()).isNone()&&Pl(c.element()).isNone()&&(f.set(tt.none()),kg.hide(c))},0)}),i.on("nodeChange",function(){Pl(c.element()).fold(function(){w(Mg.setEditorTimeout(i,y,0))},function(){})})})},gE=function(t,e,o){var n=Ih(xe.fromDom(b.document),"mousedown",function(n){st([e,o],function(t){t.broadcastOn([nf()],{target:n.target()})})}),r=Ih(xe.fromDom(b.document),"touchstart",function(n){st([e,o],function(t){t.broadcastOn([nf()],{target:n.target()})})}),i=Ih(xe.fromDom(b.document),"mouseup",function(n){0===n.raw().button&&st([e,o],function(t){t.broadcastOn([ef()],{target:n.target()})})}),u=function(n){st([e,o],function(t){t.broadcastOn([nf()],{target:xe.fromDom(n.target)})})};t.on("mousedown",u),t.on("touchstart",u);var a=function(n){0===n.button&&st([e,o],function(t){t.broadcastOn([ef()],{target:xe.fromDom(n.target)})})};t.on("mouseup",a);var c=function(n){st([e,o],function(t){t.broadcastEvent(ce(),n)})};t.on("ScrollWindow",c);var s=function(n){st([e,o],function(t){t.broadcastEvent(se(),n)})};t.on("ResizeWindow",s),t.on("remove",function(){t.off("mousedown",u),t.off("touchstart",u),t.off("mouseup",a),t.off("ResizeWindow",s),t.off("ScrollWindow",c),n.unbind(),r.unbind(),i.unbind()}),t.on("detach",function(){Gs(e),Gs(o),e.destroy(),o.destroy()})},pE=ol,hE=Pf,vE=sl({factory:function(o){var t={focus:xm.focusIn,setMenus:function(t,n){var e=ct(n,function(n){var t={text:tt.some(n.text),icon:tt.none(),tooltip:tt.none(),fetch:function(t){t(n.getItems())}};return eE(t,"tox-mbtn",{getSink:o.getSink,providers:o.providers},tt.some("menuitem"))});Om.set(t,e)}};return{uid:o.uid,dom:o.dom,components:[],behaviours:ga([Om.config({}),sg("menubar-events",[_i(function(t){o.onSetup(t)}),Ci(dn(),function(e,t){Gu(e.element(),".tox-mbtn--active").each(function(n){Xu(t.event().target(),".tox-mbtn").each(function(t){Re(n,t)||e.getSystem().getByDom(n).each(function(n){e.getSystem().getByDom(t).each(function(t){yy.expand(t),yy.close(n),Um.focus(t)})})})})}),Ci(me(),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){yy.isOpen(n)&&(yy.expand(t),yy.close(n))})})})]),xm.config({mode:"flow",selector:".tox-mbtn",onEscape:function(t){return o.onEscape(t),tt.some(!0)}}),Ab.config({})]),apis:t,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[Rr("dom"),Rr("uid"),Rr("onEscape"),Rr("getSink"),Rr("providers"),Kr("onSetup",Q)],apis:{focus:function(t,n){t.focus(n)},setMenus:function(t,n,e){t.setMenus(n,e)}}}),bE="container",yE=[af("slotBehaviours",[])],xE=function(t){return"<alloy.field."+t+">"},wE=function(r,t){var e,n=function(){return Zf(r)},o=function(e,o){return void 0===o&&(o=undefined),function(t,n){return Kf(t,r,n).map(function(t){return e(t,n)}).getOr(o)}},i=function(t){return"true"!==uo(t.element(),"aria-hidden")},u=o(i,!1),a=o(function(t,n){if(i(t)){var e=t.element();Cu(e,"display","none"),ro(e,"aria-hidden","true"),ci(t,ge(),{name:n,visible:!1})}}),c=(e=a,function(n,t){st(t,function(t){return e(n,t)})}),s=o(function(t,n){if(!i(t)){var e=t.element();Du(e,"display"),co(e,"aria-hidden"),ci(t,ge(),{name:n,visible:!0})}}),f={getSlotNames:n,getSlot:function(t,n){return Kf(t,r,n)},isShowing:u,hideSlot:a,hideAllSlots:function(t){return c(t,n())},showSlot:s};return{uid:r.uid,dom:r.dom,components:t,behaviours:cf(r.slotBehaviours),apis:f}},SE=At({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)}},$i),CE=To({},SE,{sketch:function(t){var e,n=(e=[],{slot:function(t,n){return e.push(t),Wf(bE,xE(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=ct(r,function(t){return Vf({name:t,pname:xE(t)})});return il(bE,yE,i,wE,o)}}),kE=dr([Xr("icon"),Xr("tooltip"),ni("onShow",Q),ni("onHide",Q),ni("onSetup",function(){return Q})]),OE=function(t){return{element:function(){return t.element().dom()}}},EE=function(e,o){var r=ct(Tt(o),function(t){var n=o[t],e=Or(kr("sidebar",kE,n));return{name:t,getApi:OE,onSetup:e.onSetup,onShow:e.onShow,onHide:e.onHide}});return ct(r,function(t){var n=nn(Q);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:Qg([Up(t,n),Wp(t,n),Ci(ge(),function(n,t){var e=t.event();mt(r,function(t){return t.name===e.name()}).each(function(t){(e.visible()?t.onShow:t.onHide)(t.getApi(n))})})])})})},TE=function(t,e){gl.getCurrent(t).each(function(t){return Om.set(t,[(n=e,CE.sketch(function(t){return{dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:EE(t,n),slotBehaviours:Qg([_i(function(t){return CE.hideAllSlots(t)})])}}))]);var n})},BE=function(t){return gl.getCurrent(t).bind(function(t){return Ok.isGrowing(t)||Ok.hasGrown(t)?gl.getCurrent(t).bind(function(n){return mt(CE.getSlotNames(n),function(t){return CE.isShowing(n,t)})}):tt.none()})},DE=Oo("FixSizeEvent"),AE=Oo("AutoSizeEvent"),_E=hE.optional({factory:vE,name:"menubar",schema:[Rr("dom"),Rr("getSink")]}),ME=hE.optional({factory:{sketch:function(t){return(t.split===vh.sliding||t.split===vh.floating?Lk:jk)({uid:t.uid,onEscape:function(){return t.onEscape(),tt.some(!0)},cyclicKeying:!1,initGroups:[],getSink:t.getSink,backstage:t.backstage,moreDrawerData:{floating:t.split===vh.floating,lazyToolbar:t.lazyToolbar,lazyMoreButton:t.lazyMoreButton}})}},name:"toolbar",schema:[Rr("dom"),Rr("onEscape"),Rr("getSink")]}),FE=hE.optional({name:"socket",schema:[Rr("dom")]}),IE=hE.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:ga([Ab.config({}),Um.config({}),Ok.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){gl.getCurrent(t).each(CE.hideAllSlots),ai(t,AE)},onGrown:function(t){ai(t,AE)},onStartGrow:function(t){ci(t,DE,{width:Tu(t.element(),"width").getOr("")})},onStartShrink:function(t){ci(t,DE,{width:_a(t.element())+"px"})}}),Om.config({}),gl.config({find:function(t){var n=Om.contents(t);return kt(n)}})])}],behaviours:ga([Bw(0),sg("sidebar-sliding-events",[Ci(DE,function(t,n){Cu(t.element(),"width",n.event().width())}),Ci(AE,function(t){Du(t.element(),"width")})])])}}},name:"sidebar",schema:[Rr("dom")]}),VE=fl({name:"OuterContainer",factory:function(e,t){var n={getSocket:function(t){return pE.getPart(t,e,"socket")},setSidebar:function(t,n){pE.getPart(t,e,"sidebar").each(function(t){return TE(t,n)})},toggleSidebar:function(t,o){pE.getPart(t,e,"sidebar").each(function(t){return n=t,e=o,void gl.getCurrent(n).each(function(n){gl.getCurrent(n).each(function(t){Ok.hasGrown(n)?CE.isShowing(t,e)?Ok.shrink(n):(CE.hideAllSlots(t),CE.showSlot(t,e)):(CE.hideAllSlots(t),CE.showSlot(t,e),Ok.grow(n))})});var n,e})},whichSidebar:function(t){return pE.getPart(t,e,"sidebar").bind(BE).getOrNull()},getToolbar:function(t){return pE.getPart(t,e,"toolbar")},setToolbar:function(t,n){pE.getPart(t,e,"toolbar").each(function(t){Bk.setGroups(t,n)})},getMoreButton:function(t){return pE.getPart(t,e,"toolbar").bind(function(t){return Hk.getMoreButton(t)})},focusToolbar:function(t){pE.getPart(t,e,"toolbar").each(function(t){xm.focusIn(t)})},setMenubar:function(t,n){pE.getPart(t,e,
  "menubar").each(function(t){vE.setMenus(t,n)})},focusMenubar:function(t){pE.getPart(t,e,"menubar").each(function(t){vE.focus(t)})}};return{uid:e.uid,dom:e.dom,components:t,apis:n,behaviours:e.behaviours}},configFields:[Rr("dom"),Rr("behaviours")],partFields:[_E,ME,FE,IE],apis:{getSocket:function(t,n){return t.getSocket(n)},setSidebar:function(t,n,e){t.setSidebar(n,e)},toggleSidebar:function(t,n,e){t.toggleSidebar(n,e)},whichSidebar:function(t,n){return t.whichSidebar(n)},getToolbar:function(t,n){return t.getToolbar(n)},setToolbar:function(t,n,e){var o=ct(e,function(t){return zk(t)});t.setToolbar(n,o)},getMoreButton:function(t,n){return t.getMoreButton(n)},setMenubar:function(t,n,e){t.setMenubar(n,e)},focusMenubar:function(t,n){t.focusMenubar(n)},focusToolbar:function(t,n){t.focusToolbar(n)}}}),RE=function(t){return t.fire("SkinLoaded")},HE=function(t){return t.fire("ResizeEditor")},NE=function(t){return t.fire("ResizeContent")},zE=function(t){var n=function(){t._skinLoaded=!0,RE(t)};return function(){t.initialized?n():t.on("init",n)}},PE=function(t,n){var e,o=function(t){var n=t.settings,e=n.skin,o=n.skin_url;if(!1!==e){var r=e||"oxide";o=o?t.documentBaseURI.toAbsolute(o):Zh.baseURL+"/skins/ui/"+r}return o}(n);o&&(e=o+"/skin.min.css",n.contentCSS.push(o+(t?"/content.inline":"/content")+".min.css")),0==(!1===n.getParam("skin"))&&e?Qh.DOM.styleSheetLoader.load(e,zE(n)):zE(n)()},LE=h(PE,!1),jE=h(PE,!0),UE=Qh.DOM,WE=function(t){return function(n){var e=t.outerContainer;Ve("*",e.element()).forEach(function(t){e.getSystem().getByDom(t).each(function(t){t.hasConfigured(Np)&&("readonly"===n.mode?Np.disable(t):Np.enable(t))})})}},GE={render:function(r,i,n,u,t){var e,o;LE(r),e=xe.fromDom(t.targetNode),o=i.mothership,Ws(e,o,We),Us(gi(),i.uiMothership),r.on("init",function(){VE.setToolbar(i.outerContainer,dE(r,n,{backstage:u},tt.none())),VE.setMenubar(i.outerContainer,rE(r,n)),VE.setSidebar(i.outerContainer,n.sidebar),r.readonly&&WE(i)({mode:"readonly"});var e=nn(Oa(0,0)),o=r.contentWindow,t=function(){var t=e.get();if(t.left()!==o.innerWidth||t.top()!==o.innerHeight){var n=Oa(o.innerWidth,o.innerHeight);e.set(n),NE(r)}};UE.bind(o,"resize",t),r.on("remove",function(){UE.unbind(o,"resize",t)})});var a=VE.getSocket(i.outerContainer).getOrDie("Could not find expected socket element");r.on("SwitchMode",WE(i)),r.getParam("readonly",!1,"boolean")&&r.setMode("readonly"),r.addCommand("ToggleSidebar",function(t,n){VE.toggleSidebar(i.outerContainer,n),r.fire("ToggleSidebar")}),r.addQueryValueHandler("ToggleSidebar",function(){return VE.whichSidebar(i.outerContainer)});var c=iv(r);return c!==vh.sliding&&c!==vh.floating||r.on("ResizeContent",function(){VE.getToolbar(i.outerContainer).each(Hk.refresh)}),{iframeContainer:a.element().dom(),editorContainer:i.outerContainer.element().dom()}},getBehaviours:function(){return[]}},XE=function(e,n){return Pe(e).orThunk(function(){var t=xe.fromTag("span");Ue(e,t);var n=Pe(t);return Ke(t),n}).map(function(t){return Ta(t).translate(-n.left(),-n.top())}).getOrThunk(function(){return Oa(0,0)})},YE=jt([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),qE=function(n){return function(t){return t.translate(-n.left(),-n.top())}},KE=function(n){return function(t){return t.translate(n.left(),n.top())}},JE=function(e){return function(t,n){return dt(e,function(t,n){return n(t)},Oa(t,n))}},$E=function(t,n,e){return t.fold(JE([KE(e),qE(n)]),JE([qE(n)]),JE([]))},QE=function(t,n,e){return t.fold(JE([KE(e)]),JE([]),JE([KE(n)]))},ZE=function(t,n,e){return t.fold(JE([]),JE([qE(e)]),JE([KE(n),qE(e)]))},tT=function(t,n,e){return t.fold(function(t,n){return{position:"absolute",left:t+"px",top:n+"px"}},function(t,n){return{position:"absolute",left:t-e.left()+"px",top:n-e.top()+"px"}},function(t,n){return{position:"fixed",left:t+"px",top:n+"px"}})},nT=YE.offset,eT=YE.absolute,oT=YE.fixed,rT=function(t,n){gu(t.element(),n.transitionClass),hu(t.element(),n.fadeOutClass),gu(t.element(),n.fadeInClass)},iT=function(t,n){gu(t.element(),n.transitionClass),hu(t.element(),n.fadeInClass),gu(t.element(),n.fadeOutClass)},uT=function(t,n){return t.y()>=n.y()&&t.bottom()<=n.bottom()},aT=function(t,n){return ao(t,n)?tt.some(parseInt(uo(t,n),10)):tt.none()},cT=function(o,r,i){return(u=o,t=r,n=u.element(),aT(n,t.leftAttr).bind(function(o){return aT(n,t.topAttr).map(function(t){var n=_a(u.element()),e=Ia(u.element());return Ka(o,t,n,e)})})).bind(function(t){return uT(t,i)?(n=r,e=o.element(),co(e,n.leftAttr),co(e,n.topAttr),tt.some(eT(t.x(),t.y()))):tt.none();var n,e});var u,t,n},sT=function(t,n,e,o,r){var i=Ta(t.element()),u=Ka(i.left(),i.top(),_a(t.element()),Ia(t.element()));if(uT(u,e))return tt.none();a=t,c=n,s=i.left(),f=i.top(),l=a.element(),ro(l,c.leftAttr,s),ro(l,c.topAttr,f);var a,c,s,f,l,d=eT(i.left(),i.top()),m=$E(d,o,r),g=eT(e.x(),e.y()),p=$E(g,o,r),h=u.y()<=e.y()?p.top():p.top()+e.height()-u.height();return tt.some(oT(m.left(),h))},fT=function(i,t){var u=t.lazyViewport(i);t.contextual.each(function(r){r.lazyContext(i).each(function(t){var n,e,o=Ja(t);e=u,((n=o).y()<e.bottom()&&n.bottom()>e.y()?rT:iT)(i,r)})});var n,e,o,r,a,c=He(i.element()),s=Da(c),f=XE(i.element(),s);(n=i,e=t,o=u,r=s,a=f,Tu(n.element(),"position").is("fixed")?cT(n,e,o):sT(n,e,o,r,a)).each(function(t){var n=tT(t,0,f);ku(i.element(),n)})},lT=Object.freeze({refresh:fT}),dT=Object.freeze({events:function(o){return xi([Ci(xn(),function(n,e){o.contextual.each(function(t){Re(n.element(),e.event().target())&&(hu(n.element(),t.transitionClass),e.stop())})}),Ci(ce(),function(t){fT(t,o)})])}}),mT=[qr("contextual",[Rr("fadeInClass"),Rr("fadeOutClass"),Rr("transitionClass"),Rr("lazyContext")]),Kr("lazyViewport",function(){var t=Da();return Ka(t.left(),t.top(),b.window.innerWidth,b.window.innerHeight)}),Rr("leftAttr"),Rr("topAttr")],gT=ha({fields:mT,name:"docking",active:dT,apis:lT}),pT={render:function(e,n,o,r){var i,t=Qh.DOM,u=av(e),a=iv(e),c=a===vh.sliding||a===vh.floating,s=a===vh.floating;jE(e);var f=function(t){var n=c?t.fold(function(){return 0},function(t){return 1<t.components().length?Ia(t.components()[1].element()):0}):0;ku(i.element(),function(t){void 0===t&&(t=0);var n=Ta(xe.fromDom(e.getBody()));return{top:Math.round(n.top()-Ia(i.element()))+t+"px",left:Math.round(n.left())+"px"}}(n)),gT.refresh(i)},l=function(){var t=VE.getToolbar(n.outerContainer);c&&t.each(Hk.refresh),u||f(t)},d=function(){Cu(n.outerContainer.element(),"display","flex"),t.addClass(e.getBody(),"mce-edit-focus"),l(),s&&VE.getToolbar(n.outerContainer).each(function(t){Hk.getOverflow(t).each(function(t){hu(t.element(),"tox-toolbar__overflow--closed")})})},m=function(){n.outerContainer&&(Cu(n.outerContainer.element(),"display","none"),t.removeClass(e.getBody(),"mce-edit-focus"),s&&VE.getToolbar(n.outerContainer).each(function(t){Hk.getOverflow(t).each(function(t){gu(t.element(),"tox-toolbar__overflow--closed")})}))},g=function(){if(i)d();else{i=n.outerContainer;var t=uv(e).getOr(gi());Us(t,n.mothership),Us(t,n.uiMothership),VE.setToolbar(n.outerContainer,dE(e,o,{backstage:r},tt.none())),VE.setMenubar(n.outerContainer,rE(e,o)),u||Cu(i.element(),"position","absolute"),l(),d(),e.on("nodeChange ResizeWindow",l),e.on("activate",d),e.on("deactivate",m),e.nodeChanged()}};return e.on("focus",g),e.on("blur hide",m),e.on("init",function(){e.hasFocus()&&g()}),{editorContainer:n.outerContainer.element().dom()}},getBehaviours:function(t){return av(t)?[]:[gT.config({leftAttr:"data-dock-left",topAttr:"data-dock-top",contextual:{lazyContext:function(){return tt.from(t).map(function(t){return xe.fromDom(t.getBody())})},fadeInClass:"tox-toolbar-dock-fadein",fadeOutClass:"tox-toolbar-dock-fadeout",transitionClass:"tox-toolbar-dock-transition"}}),Um.config({})]}},hT=function(t,n){return{anchor:"makeshift",x:t,y:n}},vT=function(t,n){var e,o,r,i=Qh.DOM.getPos(t);return e=n,o=i.x,r=i.y,hT(e.x+o,e.y+r)},bT=function(t,n){return"contextmenu"===n.type?t.inline?hT((o=n).pageX,o.pageY):vT(t.getContentAreaContainer(),hT((e=n).clientX,e.clientY)):yT(t);var e,o},yT=function(t){return{anchor:"selection",root:xe.fromDom(t.selection.getNode())}},xT=function(t){return"string"==typeof t?t.split(/[ ,]/):t},wT=function(t){return t.settings.contextmenu_never_use_native||!1},ST=function(t){return e="contextmenu",o="link image imagetools table spellchecker configurepermanentpen",r=(n=t).ui.registry.getAll().contextMenus,It(n.settings,e).map(xT).getOrThunk(function(){return ft(xT(o),function(t){return Vt(r,t)})});var n,e,o,r},CT=function(t){return K(t)?"|"===t:"separator"===t.type},kT={type:"separator"},OT=function(n){if(K(n))return n;switch(n.type){case"separator":return kT;case"submenu":return{type:"nestedmenuitem",text:n.text,icon:n.icon,getSubmenuItems:function(){var t=n.getSubmenuItems();return K(t)?t:ct(t,OT)}};default:return{type:"menuitem",text:n.text,icon:n.icon,onAction:(e=n.onAction,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e()})}}var e},ET=function(t,n){if(0===n.length)return t;var e=Ot(t).filter(function(t){return!CT(t)}).fold(function(){return[]},function(){return[kT]});return t.concat(e).concat(n).concat([kT])},TT=function(d,t,m){var g=ju(kg.sketch({dom:{tag:"div"},lazySink:t,onEscape:function(){return d.focus()},fireDismissalEventInstead:{},inlineBehaviours:ga([sg("dismissContextMenu",[Ci(de(),function(t){tf.close(t),d.focus()})])])}));d.on("init",function(){d.on("contextmenu",function(n){if(t=d,!n.ctrlKey||wT(t)){var t,e,r,i,o,u=2!==n.button||n.target===d.getBody(),a=u?(e=d,{anchor:"node",node:tt.some(xe.fromDom(e.selection.getNode())),root:xe.fromDom(e.getBody())}):bT(d,n),c=d.ui.registry.getAll(),s=ST(d),f=u?d.selection.getStart(!0):n.target,l=(r=c.contextMenus,i=f,0<(o=dt(s,function(t,n){if(Vt(r,n)){var e=r[n].update(i);if(K(e))return ET(t,e.split(" "));if(0<e.length){var o=ct(e,OT);return ET(t,o)}return t}return t.concat([n])},[])).length&&CT(o[o.length-1])&&o.pop(),o);db(l,Yp.CLOSE_ON_EXECUTE,m.providers).map(function(t){n.preventDefault(),kg.showMenuAt(g,a,{menu:{markers:lh("normal")},data:t})})}})})},BT=function(t){return/^[0-9\.]+(|px)$/i.test(""+t)?tt.some(parseInt(t,10)):tt.none()},DT=function(t){return ot(t)?t+"px":t},AT="data-initial-z-index",_T=function(t,n){var e;t.getSystem().addToGui(n),ze((e=n).element()).each(function(n){Tu(n,"z-index").each(function(t){ro(n,AT,t)}),Cu(n,"z-index",Ou(e.element(),"z-index"))})},MT=function(t){ze(t.element()).each(function(t){var n=uo(t,AT);ao(t,AT)?Cu(t,"z-index",n):Du(t,"z-index"),co(t,AT)}),t.getSystem().removeFromGui(t)},FT=function(t,n,e,o){return(r=t,i=n,u=r.element(),a=parseInt(uo(u,i.leftAttr),10),c=parseInt(uo(u,i.topAttr),10),isNaN(a)||isNaN(c)?tt.none():tt.some(Oa(a,c))).fold(function(){return e},function(t){return oT(t.left()+o.left(),t.top()+o.top())});var r,i,u,a,c},IT=function(t,n,e,o,r,i){var u,a,c,s=FT(t,n,e,o),f=RT(t,n,s,r,i),l=$E(s,r,i);return u=n,a=l,c=t.element(),ro(c,u.leftAttr,a.left()+"px"),ro(c,u.topAttr,a.top()+"px"),f.fold(function(){return{coord:oT(l.left(),l.top()),extra:tt.none()}},function(t){return{coord:t.output(),extra:t.extra()}})},VT=function(t,n){var e,o;e=n,o=t.element(),co(o,e.leftAttr),co(o,e.topAttr)},RT=function(t,n,p,h,v){var e=n.getSnapPoints(t);return on(e,function(t){var n,e,o,r,i,u,a,c,s,f,l,d,m,g=t.sensor();return n=p,e=g,o=t.range().left(),r=t.range().top(),a=QE(n,i=h,u=v),c=QE(e,i,u),Math.abs(a.left()-c.left())<=o&&Math.abs(a.top()-c.top())<=r?tt.some({output:Z((s=t.output(),f=p,l=h,d=v,m=function(o,r){return function(t,n){var e=o(f,l,d);return r(t.getOr(e.left()),n.getOr(e.top()))}},s.fold(m(ZE,YE.offset),m(QE,YE.absolute),m($E,YE.fixed)))),extra:t.extra}):tt.none()})},HT=function(e,t,i,u,a,c){return t.fold(function(){var t,e,o,n=(t=i,e=c.left(),o=c.top(),t.fold(function(t,n){return YE.offset(t+e,n+o)},function(t,n){return YE.absolute(t+e,n+o)},function(t,n){return YE.fixed(t+e,n+o)})),r=$E(n,u,a);return oT(r.left(),r.top())},function(n){var t=IT(e,n,i,c,u,a);return t.extra.each(function(t){n.onSensor(e,t)}),t.coord})},NT=function(t,n,e){var o,r=n.getTarget(t.element());if(n.repositionTarget){var i=He(t.element()),u=Da(i),a=XE(r,u),c=Tu(o=r,"left").bind(function(e){return Tu(o,"top").bind(function(n){return Tu(o,"position").map(function(t){return("fixed"===t?oT:nT)(parseInt(e,10),parseInt(n,10))})})}).getOrThunk(function(){var t=Ta(o);return eT(t.left(),t.top())}),s=HT(t,n.snaps,c,u,a,e),f=tT(s,0,a);ku(r,f)}n.onDrag(t,r,e)},zT=qr("snaps",[Rr("getSnapPoints"),ea("onSensor"),Rr("leftAttr"),Rr("topAttr"),Kr("lazyViewport",function(){var t=Da();return{x:t.left,y:t.top,width:Z(b.window.innerWidth),height:Z(b.window.innerHeight),bottom:Z(t.top()+b.window.innerHeight),right:Z(t.left()+b.window.innerWidth)}})]),PT=Object.freeze({getData:function(t){return tt.from(Oa(t.x(),t.y()))},getDelta:function(t,n){return Oa(n.left()-t.left(),n.top()-t.top())}}),LT=[Kr("useFixed",!1),Rr("blockerClass"),Kr("getTarget",U),Kr("onDrag",Q),Kr("repositionTarget",!0),ea("onDrop"),zT,ua("dragger",{handlers:function(a,c){return xi([Ci(cn(),function(n,t){if(0===t.event().raw().button){t.stop();var e,o={drop:function(){i()},delayDrop:function(){u.schedule()},forceDrop:function(){i()},move:function(t){u.cancel(),c.update(PT,t).each(function(t){NT(n,a,t)})}},r=n.getSystem().build(Jh.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[a.blockerClass]},events:(e=o,xi([Ci(cn(),e.forceDrop),Ci(ln(),e.drop),Ci(sn(),function(t,n){e.move(n.event())}),Ci(fn(),e.delayDrop)]))})),i=function(){MT(r),a.snaps.each(function(t){VT(n,t)});var t=a.getTarget(n.element());a.onDrop(n,t)},u=s(i,200);c.reset(),_T(n,r)}})])}})],jT=Object.freeze({getData:function(t){var n,e=t.raw().touches;return 1===e.length?(n=e[0],tt.some(Oa(n.clientX,n.clientY))):tt.none()},getDelta:function(t,n){return Oa(n.left()-t.left(),n.top()-t.top())}}),UT=LT,WT=[Kr("useFixed",!1),Kr("getTarget",U),Kr("onDrag",Q),Kr("repositionTarget",!0),Kr("onDrop",Q),zT,ua("dragger",{handlers:function(e,o){return xi([Di(rn()),Ci(un(),function(n,t){t.stop(),o.update(jT,t.event()).each(function(t){NT(n,e,t)})}),Ci(an(),function(n){e.snaps.each(function(t){VT(n,t)});var t=e.getTarget(n.element());o.reset(),e.onDrop(n,t)})])}})],GT=Object.freeze({mouse:UT,touch:WT}),XT=Object.freeze({init:function(){var i=tt.none(),t=Z({});return Zi({readState:t,reset:function(){i=tt.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=tt.some(e),o;var n,e,o})}})}}),YT=ba({branchKey:"mode",branches:GT,name:"dragging",active:{events:function(t,n){return t.dragger.handlers(t,n)}},extra:{snap:ke(["sensor","range","output"],["extra"])},state:XT});(WO=UO||(UO={}))[WO.None=0]="None",WO[WO.Both=1]="Both",WO[WO.Vertical=2]="Vertical";var qT,KT,JT,$T,QT,ZT=function(t,n,e,o){var r=t+n,i=e.filter(function(t){return r<t}),u=o.filter(function(t){return t<r});return i.or(u).getOr(r)},tB=function(t,n,e,o,r){var i,u,a={};return a.height=ZT(o,n.top(),nv(t),(i=t,tt.from(i.getParam("max_height")).filter(ot))),e===UO.Both&&(a.width=ZT(r,n.left(),tv(t),(u=t,tt.from(u.getParam("max_width")).filter(ot)))),a},nB=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},eB=function(i,u){return u.delimiter||(u.delimiter="\xbb"),{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:ga([xm.config({mode:"flow",selector:"div[role=button]"}),Ab.config({}),Om.config({}),sg("elementPathEvents",[_i(function(r){i.shortcuts.add("alt+F11","focus statusbar elementpath",function(){return xm.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&&!nB(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&&Om.set(r,(n=ct(e||[],function(t,n){return Eg.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{role:"button","data-index":n,"tab-index":-1,"aria-level":n+1},innerHtml:t.name},action:function(){i.focus(),i.selection.select(t.element),i.nodeChanged()}})}),o={dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0},innerHtml:" "+u.delimiter+" "}},dt(n.slice(1),function(t,n){var e=t;return e.push(o),e.push(n),e},[n[0]])))})})])]),components:[]}},oB=function(s,t){var n,e,o,r,i,u,a,c,f,l,d,m=function(c){return{dom:{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:t.translate("Resize")},innerHtml:Dg("resize-handle",t.icons)},behaviours:ga([YT.config({mode:"mouse",repositionTarget:!1,onDrag:function(t,n,e){var o,r,i,u,a;o=s,r=e,i=c,u=xe.fromDom(o.getContainer()),a=tB(o,r,i,Ia(u),_a(u)),Dt(a,function(t,n){return Cu(u,n,DT(t))}),HE(o)},blockerClass:"tox-blocker"})])}};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(d=[],s.getParam("elementpath",!0,"boolean")&&d.push(eB(s,{})),Ln(s.settings.plugins,"wordcount")&&d.push((u=s,a=t,f=function(t,n,e){return Om.set(t,[zu(a.translate(["{0} "+e,n[e]]))])},Eg.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:ga([Ab.config({}),Om.config({}),Nm.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),sg("wordcount-events",[Ci(oe(),function(t){var n=Nm.getValue(t),e="words"===n.mode?"characters":"words";Nm.setValue(t,{mode:e,count:n.count}),f(t,n.count,e)}),_i(function(e){u.on("wordCountUpdate",function(t){var n=Nm.getValue(e).mode;Nm.setValue(e,{mode:n,count:t.wordCount}),f(e,t.wordCount,n)})})])]),eventOrder:(c={},c[oe()]=["wordcount-events","alloy.base.behaviour"],c)}))),s.getParam("branding",!0,"boolean")&&d.push({dom:{tag:"span",classes:["tox-statusbar__branding"],innerHtml:'<a href="https://www.tiny.cloud/?utm_campaign=editor_referral&amp;utm_medium=poweredby&amp;utm_source=tinymce&amp;utm_content=v5" rel="noopener" target="_blank" tabindex="-1" aria-label="'+(l=cp.translate(["Powered by {0}","Tiny"]))+'">'+l+"</a>"}}),r=0<d.length?[{dom:{tag:"div",classes:["tox-statusbar__text-container"]},components:d}]:[],e=!Ln((n=s).settings.plugins,"autoresize"),i=!1===(o=n.getParam("resize",e))?UO.None:"both"===o?UO.Both:UO.Vertical,i!==UO.None&&r.push(m(i)),r)}},rB=function(d){var t,n,e=d.getParam("inline",!1,"boolean"),m=e?pT:GE,o=tt.none(),r=cp.isRtl()?{attributes:{dir:"rtl"}}:{},g=ju({dom:To({tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"]},r),behaviours:ga([Vs.config({useFixed:!1})])}),i=Tg({dom:{tag:"div",classes:["tox-anchorbar"]}}),u=function(){return o.bind(function(t){return VE.getMoreButton(t)}).getOrDie("Could not find more button element")},p=ik(g,d,function(){return o.bind(function(t){return i.getOpt(t)}).getOrDie("Could not find a anchor bar element")},u),h=function(){return Lt.value(g)},a=VE.parts().menubar({dom:{tag:"div",classes:["tox-menubar"]},getSink:h,providers:p.shared.providers,onEscape:function(){d.focus()}}),c=VE.parts().toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:h,backstage:p,onEscape:function(){d.focus()},split:iv(d),lazyToolbar:function(){return o.bind(function(t){return VE.getToolbar(t)}).getOrDie("Could not find more toolbar element")},lazyMoreButton:u}),s=VE.parts().socket({dom:{tag:"div",classes:["tox-edit-area"]}}),f=VE.parts().sidebar({dom:{tag:"div",classes:["tox-sidebar"]}}),l=d.getParam("statusbar",!0,"boolean")&&!e?tt.some(oB(d,p.shared.providers)):tt.none(),v={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[s,f]},b=(n=(t=d).getParam("toolbar"),($(n)?0<n.length:!1!==t.getParam("toolbar",!0,"boolean"))||ev(d).isSome()),y=!1!==d.getParam("menubar",!0,"boolean"),x=vt([y?[a]:[],b?[c]:[],av(d)?[]:[i.asSpec()],e?[]:[v]]),w=vt([[{dom:{tag:"div",classes:["tox-editor-container"]},components:x}],e?[]:l.toArray()]),S=To({role:"application"},cp.isRtl()?{dir:"rtl"}:{}),C=ju(VE.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(e?["tox-tinymce-inline"]:[]),styles:{visibility:"hidden"},attributes:S},components:w,behaviours:ga(m.getBehaviours(d).concat([xm.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a"})]))}));o=tt.some(C),d.shortcuts.add("alt+F9","focus menubar",function(){VE.focusMenubar(C)}),d.shortcuts.add("alt+F10","focus toolbar",function(){VE.focusToolbar(C)});var k=$h(C),O=$h(g);gE(d,k,O);var E=function(t){var n,e=Qh.DOM,o=d.getParam("width",e.getStyle(t,"width")),r=(n=d).getParam("height",Math.max(n.getElement().offsetHeight,200)),i=tv(d),u=nv(d),a=BT(o).bind(function(n){return DT(i.map(function(t){return Math.max(n,t)}))}).getOr(DT(o)),c=BT(r).bind(function(n){return u.map(function(t){return Math.max(n,t)})}).getOr(r),s=DT(a);if(Bu("div","width",s)&&Cu(C.element(),"width",s),!d.inline){var f=DT(c);Bu("div","height",f)?Cu(C.element(),"height",f):Cu(C.element(),"height","200px")}return c};return{mothership:k,uiMothership:O,backstage:p,renderUI:function(){var o,r;TT(d,h,p.shared),r=(o=d).ui.registry.getAll().sidebars,st(Tt(r),function(n){var t=r[n],e=function(){return tt.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)}}})});var t=d.ui.registry.getAll(),n=t.buttons,e=t.menuItems,i=t.contextToolbars,u=t.sidebars,a={menuItems:e,buttons:n,menus:d.settings.menu?At(d.settings.menu,function(t){return Xt(t,{items:t.items})}):{},menubar:d.settings.menubar,toolbar:ev(d).getOr(d.getParam("toolbar",!0)),sidebar:u};mE(d,i,g,{backstage:p});var c=d.getElement(),s=E(c),f={mothership:k,uiMothership:O,outerContainer:C},l={targetNode:c,height:s};return m.render(d,f,a,p,l)},getUi:function(){return{channels:{broadcastAll:O.broadcast,broadcastOn:O.broadcastOn,register:function(){}}}}}},iB=function(n){GS.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:zO(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})},uB=function(t,n){return function(){t.execCommand("mceToggleFormat",!1,n)}},aB=function(t){var n,e;!function(n){GS.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.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:zO(n,t.name),onAction:uB(n,t.name)})});for(var t=1;t<=6;t++){var e="h"+t;n.ui.registry.addToggleButton(e,{text:e.toUpperCase(),tooltip:"Heading "+t,onSetup:zO(n,e),onAction:uB(n,e)})}}(t),n=t,GS.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,GS.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:zO(e,t.name)})})},cB=function(t){var n;aB(t),n=t,GS.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:uB(n,"code")})},sB=function(t,n,e){var o=function(){return!!n.undoManager&&n.undoManager[e]()},r=function(){t.setDisabled(n.readonly||!o())};return t.setDisabled(!o()),n.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r),function(){return n.off("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",r)}},fB=function(t){var n,e;(n=t).ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:function(t){return sB(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 sB(t,n,"hasRedo")},onAction:function(){return n.execCommand("redo")}}),(e=t).ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",onSetup:function(t){return sB(t,e,"hasUndo")},onAction:function(){return e.execCommand("undo")}}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",onSetup:function(t){return sB(t,e,"hasRedo")},onAction:function(){return e.execCommand("redo")}})},lB=function(t){var n,e;(n=t).ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:function(){return n.execCommand("mceToggleVisualAid")}}),(e=t).ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:function(t){return function(n,t){n.setActive(t.hasVisual);var e=function(t){n.setActive(t.hasVisual)};return t.on("VisualAid",e),function(){return t.off("VisualAid",e)}}(t,e)},onAction:function(){e.execCommand("mceToggleVisualAid")}})},dB=function(t){var n;(n=t).ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:function(t){return function(t,n){t.setDisabled(!n.queryCommandState("outdent"));var e=function(){t.setDisabled(!n.queryCommandState("outdent"))};return n.on("NodeChange",e),function(){return n.off("NodeChange",e)}}(t,n)},onAction:function(){return n.execCommand("outdent")}}),n.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onAction:function(){return n.execCommand("indent")}})},mB=function(t,n){var e,o,r,i,u,a,c,s,f,l,d,m,g,p,h,v,b,y,x,w;o=n,r=YO(e=t),i=LO(0,o,r.dataset,r),e.ui.registry.addNestedMenuItem("align",{text:o.shared.providers.translate("Align"),getSubmenuItems:function(){return i.items.validateItems(i.getStyleItems())}}),a=n,c=KO(u=t),s=LO(0,a,c.dataset,c),u.ui.registry.addNestedMenuItem("fontformats",{text:a.shared.providers.translate("Fonts"),getSubmenuItems:function(){return s.items.validateItems(s.getStyleItems())}}),f=t,d=(l=n).styleselect,m=LO(0,l,d,tE(f)),f.ui.registry.addNestedMenuItem("formats",{text:"Formats",getSubmenuItems:function(){return m.items.validateItems(m.getStyleItems())}}),p=n,h=ZO(g=t),v=LO(0,p,h.dataset,h),g.ui.registry.addNestedMenuItem("blockformats",{text:"Blocks",getSubmenuItems:function(){return v.items.validateItems(v.getStyleItems())}}),y=n,x=$O(b=t),w=LO(0,y,x.dataset,x),b.ui.registry.addNestedMenuItem("fontsizes",{text:"Font sizes",getSubmenuItems:function(){return w.items.validateItems(w.getStyleItems())}})},gB=function(t,n){iB(t),cB(t),mB(t,n),fB(t),hy.register(t),lB(t),dB(t)},pB=function(t,n){var e=tt.from(uo(t,"id")).fold(function(){var t=Oo("dialog-label");return ro(n,"id",t),t},U);ro(t,"aria-labelledby",e)},hB=Z([Rr("lazySink"),Wr("dragBlockClass"),Kr("useTabstopAt",Z(!0)),Kr("eventOrder",{}),af("modalBehaviours",[xm]),oa("onExecute"),ia("onEscape")]),vB={sketch:U},bB=Z([Hf({name:"draghandle",overrides:function(t,n){return{behaviours:ga([YT.config({mode:"mouse",getTarget:function(t){return Wu(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"+or(n,null,2)).message)})])}}}),Vf({schema:[Rr("dom")],name:"title"}),Vf({factory:vB,schema:[Rr("dom")],name:"close"}),Vf({factory:vB,schema:[Rr("dom")],name:"body"}),Vf({factory:vB,schema:[Rr("dom")],name:"footer"}),Rf({factory:{sketch:function(t,n){return To({},t,{dom:n.dom,components:n.components})}},schema:[Kr("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Kr("components",[])],name:"blocker"})]),yB=fl({name:"ModalDialog",configFields:hB(),partFields:bB(),factory:function(r,t,n,o){var a=Oo("alloy.dialog.busy"),c=Oo("alloy.dialog.idle"),s=ga([xm.config({mode:"special",onTab:function(){return tt.some(!0)},onShiftTab:function(){return tt.some(!0)}}),Um.config({})]),e=Oo("modal-events"),i=To({},r.eventOrder,{"alloy.system.attached":[e].concat(r.eventOrder["alloy.system.attached"]||[])});return{uid:r.uid,dom:r.dom,components:t,apis:{show:function(i){var t=r.lazySink(i).getOrDie(),u=nn(tt.none()),n=o.blocker(),e=t.getSystem().build(To({},n,{components:n.components.concat([Uu(i)]),behaviours:ga([sg("dialog-blocker-events",[Ci(c,function(){ao(i.element(),"aria-busy")&&(co(i.element(),"aria-busy"),u.get().each(function(t){return Om.remove(i,t)}))}),Ci(a,function(t,n){ro(i.element(),"aria-busy","true");var e=n.event().getBusySpec();u.get().each(function(t){Om.remove(i,t)});var o=e(i,s),r=t.getSystem().build(o);u.set(tt.some(r)),Om.append(i,Uu(r)),r.hasConfigured(xm)&&xm.focusIn(r)})])])}));Ns(t,e),xm.focusIn(i)},hide:function(n){ze(n.element()).each(function(t){n.getSystem().getByDom(t).each(function(t){Ls(t)})})},getBody:function(t){return Jf(t,r,"body")},getFooter:function(t){return Jf(t,r,"footer")},setIdle:function(t){ai(t,c)},setBusy:function(t,n){ci(t,a,{getBusySpec:n})}},eventOrder:i,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:sf(r.modalBehaviours,[Om.config({}),xm.config({mode:"cyclic",onEnter:r.onExecute,onEscape:r.onEscape,useTabstopAt:r.useTabstopAt}),sg(e,[_i(function(t){var n,e,o;pB(t.element(),Jf(t,r,"title").element()),n=t.element(),e=Jf(t,r,"body").element(),o=tt.from(uo(n,"id")).fold(function(){var t=Oo("dialog-describe");return ro(e,"id",t),t},U),ro(n,"aria-describedby",o)})])])}},apis:{show:function(t,n){t.show(n)},hide:function(t,n){t.hide(n)},getBody:function(t,n){return t.getBody(n)},getFooter:function(t,n){return t.getFooter(n)},setBusy:function(t,n,e){t.setBusy(n,e)},setIdle:function(t,n){t.setIdle(n)}}}),xB=[Nr("type"),Nr("text"),zr("level",["info","warn","error","success"]),Nr("icon"),Kr("url","")],wB=[Nr("type"),Nr("text"),ti("primary",!1),br("name","name",Mo(function(){return Oo("button-name")}),Mr),Xr("icon")],SB=[Nr("type"),Nr("name"),Nr("label")],CB=Fr,kB=[Nr("type"),Nr("name"),Xr("label")],OB=kB,EB=Mr,TB=kB,BB=Mr,DB=kB,AB=mr(wr),_B=kB.concat([ti("sandboxed",!0)]),MB=Mr,FB=kB.concat([Xr("placeholder")]),IB=Mr,VB=kB.concat([jr("items",[Nr("text"),Nr("value")]),$r("size",1)]),RB=Mr,HB=kB.concat([ti("constrain",!0)]),NB=dr([Nr("width"),Nr("height")]),zB=kB.concat([Xr("placeholder")]),PB=Mr,LB=kB.concat([Zr("filetype","file",["image","media","file"])]),jB=dr([Nr("value"),Kr("meta",{})]),UB=kB.concat([Nr("type"),Qr("tag","textarea"),Pr("init")]),WB=Mr,GB=[Nr("type"),Nr("html"),Zr("presets","presentation",["presentation","document"])],XB=kB.concat([Hr("currentState",dr([Rr("blob"),Nr("url")]))]),YB=kB.concat([Kr("columns","auto")]),qB=(qT=[Nr("value"),Nr("text"),Nr("icon")],hr(qT)),KB=[Nr(
  "type"),Ur("header",Mr),Ur("cells",mr(Mr))],JB=function(n){return br("items","items",Ao(),mr(Sr(function(t){return kr("Checking item of "+n,$B,t).fold(function(t){return Lt.error(Tr(t))},function(t){return Lt.value(t)})})))},$B=Br("type",{alertbanner:xB,bar:(QT=JB("bar"),[Nr("type"),QT]),button:wB,checkbox:SB,colorinput:OB,colorpicker:TB,dropzone:DB,grid:(JT=JB("grid"),[Nr("type"),($T="columns",Hr($T,_r)),JT]),iframe:_B,input:FB,selectbox:VB,sizeinput:HB,textarea:zB,urlinput:LB,customeditor:UB,htmlpanel:GB,imagetools:XB,collection:YB,label:(KT=JB("label"),[Nr("type"),Nr("label"),KT]),table:KB}),QB=[Nr("type"),Ur("items",$B)],ZB=[Nr("title"),Ur("items",$B)],tD=[Nr("type"),jr("tabs",ZB)],nD=dr([zr("type",["submit","cancel","custom"]),br("name","name",Mo(function(){return Oo("button-name")}),Mr),Nr("text"),Xr("icon"),Zr("align","end",["start","end"]),ti("primary",!1),ti("disabled",!1)]),eD=dr([Nr("title"),Hr("body",Br("type",{panel:QB,tabpanel:tD})),Qr("size","normal"),Ur("buttons",nD),Kr("initialData",{}),ni("onAction",Q),ni("onChange",Q),ni("onSubmit",Q),ni("onClose",Q),ni("onCancel",Q),Kr("onTabChange",Q)]),oD=function(t){return J(t)?[t].concat(bt(Ft(t),oD)):$(t)?bt(t,oD):[]},rD=function(t){return K(t.type)&&K(t.name)},iD={checkbox:CB,colorinput:EB,colorpicker:BB,dropzone:AB,input:IB,iframe:MB,sizeinput:NB,selectbox:RB,size:NB,textarea:PB,urlinput:jB,customeditor:WB,collection:qB},uD=function(t){var n=bt(ft(oD(t),rD),function(n){return(t=n,tt.from(iD[t.type])).fold(function(){return[]},function(t){return[Hr(n.name,t)]});var t});return dr(n)},aD=function(t){return{internalDialog:Or(kr("dialog",eD,t)),dataValidator:uD(t),initialData:t.initialData}},cD={open:function(t,n){var e=aD(n);return t(e.internalDialog,e.initialData,e.dataValidator)},redial:function(t){return aD(t)}},sD=Oo("update-dialog"),fD=Oo("update-title"),lD=Oo("update-body"),dD=Oo("update-footer"),mD=function(t){var e=[],o={};return Dt(t,function(t,n){t.fold(function(){e.push(n)},function(t){o[n]=t})}),0<e.length?Lt.error(e):Lt.value(o)},gD=sl({name:"TabButton",configFields:[Kr("uid",undefined),Rr("value"),br("dom","dom",Fo(function(){return{attributes:{role:"tab",id:Oo("aria"),"aria-selected":"false"}}}),Dr()),Wr("action"),Kr("domModification",{}),af("tabButtonBehaviours",[Um,xm,Nm]),Rr("view")],factory:function(t){return{uid:t.uid,dom:t.dom,components:t.components,events:Og(t.action),behaviours:sf(t.tabButtonBehaviours,[Um.config({}),xm.config({mode:"execution",useSpace:!0,useEnter:!0}),Nm.config({store:{mode:"memory",initialValue:t.value}})]),domModification:t.domModification}}}),pD=Z([Rr("tabs"),Rr("dom"),Kr("clickToDismiss",!1),af("tabbarBehaviours",[Tl,xm]),ta(["tabClass","selectedClass"])]),hD=Nf({factory:gD,name:"tabs",unit:"tab",overrides:function(o){var r=function(t,n){Tl.dehighlight(t,n),ci(t,he(),{tabbar:t,button:n})},i=function(t,n){Tl.highlight(t,n),ci(t,pe(),{tabbar:t,button:n})};return{action:function(t){var n=t.getSystem().getByUid(o.uid).getOrDie(),e=Tl.isHighlighted(n,t);(e&&o.clickToDismiss?r:e?Q:i)(n,t)},domModification:{classes:[o.markers.tabClass]}}}}),vD=Z([hD]),bD=fl({name:"Tabbar",configFields:pD(),partFields:vD(),factory:function(t,n){return{uid:t.uid,dom:t.dom,components:n,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:sf(t.tabbarBehaviours,[Tl.config({highlightClass:t.markers.selectedClass,itemClass:t.markers.tabClass,onHighlight:function(t,n){ro(n.element(),"aria-selected","true")},onDehighlight:function(t,n){ro(n.element(),"aria-selected","false")}}),xm.config({mode:"flow",getInitial:function(t){return Tl.getHighlighted(t).map(function(t){return t.element()})},selector:"."+t.markers.tabClass,executeOnMove:!0})])}}}),yD=sl({name:"Tabview",configFields:[af("tabviewBehaviours",[Om])],factory:function(t){return{uid:t.uid,dom:t.dom,behaviours:sf(t.tabviewBehaviours,[Om.config({})]),domModification:{attributes:{role:"tabpanel"}}}}}),xD=Z([Kr("selectFirst",!0),ea("onChangeTab"),ea("onDismissTab"),Kr("tabs",[]),af("tabSectionBehaviours",[])]),wD=Vf({factory:bD,schema:[Rr("dom"),Lr("markers",[Rr("tabClass"),Rr("selectedClass")])],name:"tabbar",defaults:function(t){return{tabs:t.tabs}}}),SD=Vf({factory:yD,name:"tabview"}),CD=Z([wD,SD]),kD=fl({name:"TabSection",configFields:xD(),partFields:CD(),factory:function(i,t){var n=function(t,n){Kf(t,i,"tabbar").each(function(t){n(t).each(si)})};return{uid:i.uid,dom:i.dom,components:t,behaviours:cf(i.tabSectionBehaviours),events:xi(vt([i.selectFirst?[_i(function(t){n(t,Tl.getFirst)})]:[],[Ci(pe(),function(t,n){var o,r,e=n.event().button();o=e,r=Nm.getValue(o),Kf(o,i,"tabview").each(function(e){mt(i.tabs,function(t){return t.value===r}).each(function(t){var n=t.view();ro(e.element(),"aria-labelledby",uo(o.element(),"id")),Om.set(e,n),i.onChangeTab(e,o,n)})})}),Ci(he(),function(t,n){var e=n.event().button();i.onDismissTab(t,e)})]])),apis:{getViewItems:function(t){return Kf(t,i,"tabview").map(function(t){return Om.contents(t)}).getOr([])},showTab:function(t,e){n(t,function(n){var t=Tl.getCandidates(n);return mt(t,function(t){return Nm.getValue(t)===e}).filter(function(t){return!Tl.isHighlighted(n,t)})})}}}},apis:{getViewItems:function(t,n){return t.getViewItems(n)},showTab:function(t,n,e){t.showTab(n,e)}}}),OD=function(t){return kt((n=t,e=function(t,n){return n<t?-1:t<n?1:0},(o=xt.call(n,0)).sort(e),o));var n,e,o},ED=function(i,u,t){Wu(i,'[role="dialog"]').each(function(r){t.get().map(function(t){return Cu(u,"height","0"),Math.min(t,(e=i,o=Wu(n=r,".tox-dialog-wrap").getOr(n),("fixed"===Ou(o,"position")?Math.max(b.document.documentElement.clientHeight,b.window.innerHeight):Math.max(b.document.documentElement.offsetHeight,b.document.documentElement.scrollHeight))-(n.dom().getBoundingClientRect().height-e.dom().getBoundingClientRect().height)));var n,e,o}).each(function(t){Cu(u,"height",t+"px")})})},TD=function(a){var c;return{smartTabHeight:(c=nn(tt.none()),{extraEvents:[_i(function(t){Gu(t.element(),'[role="tabpanel"]').each(function(u){var n;Cu(u,"visibility","hidden"),t.getSystem().getByDom(u).toOption().each(function(t){var o,r,i,n=(r=u,i=t,ct(o=a,function(t,n){Om.set(i,o[n].view());var e=r.dom().getBoundingClientRect();return Om.set(i,[]),e.height})),e=OD(n);c.set(e)}),ED(t.element(),u,c),Du(u,"visibility"),n=t,kt(a).each(function(t){return kD.showTab(n,t.value)}),Mg.requestAnimationFrame(function(){ED(t.element(),u,c)})})}),Ci(se(),function(n){Gu(n.element(),'[role="tabpanel"]').each(function(t){ED(n.element(),t,c)})}),Ci(hv,function(r){Gu(r.element(),'[role="tabpanel"]').each(function(n){var t=zl();Cu(n,"visibility","hidden");var e=Tu(n,"height").map(function(t){return parseInt(t,10)});Du(n,"height");var o=n.dom().getBoundingClientRect().height;e.forall(function(t){return t<o})?(c.set(tt.from(o)),ED(r.element(),n,c)):e.each(function(t){Cu(n,"height",t+"px")}),Du(n,"visibility"),t.each(Nl)})})],selectFirst:!1}),naiveTabHeight:{extraEvents:[],selectFirst:!0}}},BD="send-data-to-section",DD="send-data-to-view",AD=function(t,n,d,e){return{dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:To({},n.map(function(t){return{id:t}}).getOr({}),e?{"aria-live":"polite"}:{})},components:[],behaviours:ga([Bw(0),lO.config({channel:lD,updateState:function(t,n){return tt.some({isTabPanel:function(){return"tabpanel"===n.body.type}})},renderComponents:function(t){switch(t.body.type){case"tabpanel":return[(r={tabs:t.body.tabs},i=d,u=nn({}),a=function(t){var n=Nm.getValue(t),e=mD(n).getOr({}),o=u.get(),r=Gt(o,e);u.set(r)},c=function(t){var n=u.get();Nm.setValue(t,n)},s=nn(null),f=ct(r.tabs,function(t){return{value:t.title,dom:{tag:"div",classes:["tox-dialog__body-nav-item"],innerHtml:i.shared.providers.translate(t.title)},view:function(){return[bw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:ct(t.items,function(t){return vC(n,t,i)}),formBehaviours:ga([xm.config({mode:"acyclic",useTabstopAt:N(Uw)}),sg("TabView.form.events",[_i(c),Mi(a)]),Sa.config({channels:Qt([{key:BD,value:{onReceive:a}},{key:DD,value:{onReceive:c}}])})])}})]}}}),l=TD(f).smartTabHeight,kD.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:function(t,n){var e=Nm.getValue(n);ci(t,pv,{title:e,oldTitle:s.get()}),s.set(e)},tabs:f,components:[kD.parts().tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[bD.parts().tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:ga([Ab.config({})])}),kD.parts().tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:l.selectFirst,tabSectionBehaviours:ga([sg("tabpanel",l.extraEvents),xm.config({mode:"acyclic"}),gl.config({find:function(t){return kt(kD.getViewItems(t))}}),Nm.config({store:{mode:"manual",getValue:function(t){return t.getSystem().broadcastOn([BD],{}),u.get()},setValue:function(t,n){u.set(n),t.getSystem().broadcastOn([DD],{})}}})])}))];default:return[(e={items:t.body.items},o=d,n=Tg(bw.sketch(function(n){return{dom:{tag:"div",classes:["tox-form"]},components:ct(e.items,function(t){return vC(n,t,o)})}})),{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[n.asSpec()]}],behaviours:ga([xm.config({mode:"acyclic",useTabstopAt:N(Uw)}),Tw(n),Iw(n,{postprocess:function(t){return mD(t).fold(function(t){return b.console.error(t),{}},function(t){return t})}})])})]}var e,o,n,r,i,u,a,c,s,f,l},initialData:t})])}},_D=function(o,e){var t=function(t,o){return Ci(t,function(n,e){r(n,function(t){o(t,e.event(),n)})})},r=function(n,e){lO.getState(n).get().each(function(t){e(t.internalDialog,n)})};return[Ti(mn(),Ww),t(dv,function(t){return t.onSubmit(o())}),t(cv,function(t,n){t.onChange(o(),{name:n.name()})}),t(lv,function(t,n){t.onAction(o(),{name:n.name(),value:n.value()})}),t(pv,function(t,n){t.onTabChange(o(),n.title())}),t(sv,function(t){e.onClose(),t.onClose()}),t(fv,function(t,n,e){t.onCancel(o()),ai(e,sv)}),Mi(function(t){var n=o();Nm.setValue(t,n.getData())}),Ci(gv,function(){return e.onUnblock()}),Ci(mv,function(t,n){return e.onBlock(n.event())})]},MD=function(t,n){var e=function(t,n){for(var e=[],o=[],r=0,i=t.length;r<i;r++){var u=t[r];(n(u,r,t)?e:o).push(u)}return{pass:e,fail:o}}(n.map(function(t){return t.footerButtons}).getOr([]),function(t){return"start"===t.align}),o=function(t,n){return Jh.sketch({dom:{tag:"div",classes:["tox-dialog__footer-"+t]},components:ct(n,function(t){return t.memento.asSpec()})})};return[o("start",e.pass),o("end",e.fail)]},FD=function(t,i){return{dom:ap('<div class="tox-dialog__footer"></div>'),components:[],behaviours:ga([lO.config({channel:dD,initialData:t,updateState:function(t,n){var r=ct(n.buttons,function(t){var n,e,o=Tg((e=i,ES(n=t,n.type,e)));return{name:t.name,align:t.align,memento:o}});return tt.some({lookupByName:function(t,n){return e=t,o=n,mt(r,function(t){return t.name===o}).bind(function(t){return t.memento.getOpt(e)});var e,o},footerButtons:r})},renderComponents:MD})])}},ID=function(t){return Eg.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){ai(t,fv)}})},VD=function(t,n,e){var o=function(t){return[zu(e.translate(t.title))]};return{dom:{tag:"div",classes:["tox-dialog__title"],attributes:To({},n.map(function(t){return{id:t}}).getOr({}))},components:o(t),behaviours:ga([lO.config({channel:fD,renderComponents:o})])}},RD=function(n,e){if(n.getRoot().getSystem().isConnected()){var o=gl.getCurrent(n.getFormWrapper()).getOr(n.getFormWrapper());return bw.getField(o,e).fold(function(){var t=n.getFooter();return lO.getState(t).get().bind(function(t){return t.lookupByName(o,e)})},function(t){return tt.some(t)})}return tt.none()},HD=function(a,o){var t=function(t){var n=a.getRoot();n.getSystem().isConnected()&&t(n)},c={getData:function(){var t=a.getRoot(),n=t.getSystem().isConnected()?a.getFormWrapper():t;return Nm.getValue(n)},setData:function(u){t(function(){var n,t,e=c.getData(),o=Xt(e,u),r=(n=o,t=a.getRoot(),lO.getState(t).get().map(function(t){return Or(kr("data",t.dataValidator,n))}).getOr(n)),i=a.getFormWrapper();Nm.setValue(i,r)})},disable:function(t){RD(a,t).each(Np.disable)},enable:function(t){RD(a,t).each(Np.enable)},focus:function(t){RD(a,t).each(Um.focus)},block:function(n){if(!K(n))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(function(t){ci(t,mv,{message:n})})},unblock:function(){t(function(t){ai(t,gv)})},showTab:function(n){t(function(){var t=a.getBody();lO.getState(t).get().exists(function(t){return t.isTabPanel()})&&gl.getCurrent(t).each(function(t){kD.showTab(t,n)})})},redial:function(e){t(function(t){var n=o(e);t.getSystem().broadcastOn([sD],n),t.getSystem().broadcastOn([fD],n.internalDialog),t.getSystem().broadcastOn([lD],n.internalDialog),t.getSystem().broadcastOn([dD],n.internalDialog),c.setData(n.initialData)})},close:function(){t(function(t){ai(t,sv)})}};return c},ND=function(t,n,e){var o,r,i,u,a,c,s,f,l,d,m,g=(r={title:e.shared.providers.translate(t.internalDialog.title),draggable:!0},i=e.shared.providers,u=yB.parts().title(VD(r,tt.none(),i)),a=yB.parts().draghandle({dom:ap('<div class="tox-dialog__draghandle"></div>')}),c=yB.parts().close(ID(i)),s=[u].concat(r.draggable?[a]:[]).concat([c]),Jh.sketch({dom:ap('<div class="tox-dialog__header"></div>'),components:s})),p=(f={body:t.internalDialog.body},l=e,yB.parts().body(AD(f,tt.none(),l,!1))),h=(d={buttons:t.internalDialog.buttons},m=e.shared.providers,yB.parts().footer(FD(d,m))),v=_D(function(){return x},{onClose:function(){return n.closeWindow()},onBlock:function(e){yB.setBusy(y,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:ap('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}})},onUnblock:function(){yB.setIdle(y)}}),b="normal"!==t.internalDialog.size?"large"===t.internalDialog.size?"tox-dialog--width-lg":"tox-dialog--width-md":[],y=ju(yB.sketch({lazySink:e.shared.getSink,onEscape:function(t){return ai(t,fv),tt.some(!0)},useTabstopAt:function(t){return!Uw(t)&&("button"!==Qe(t)||"disabled"!==uo(t,"disabled"))},modalBehaviours:ga([lO.config({channel:sD,updateState:function(t,n){return tt.some(n)},initialData:t}),Um.config({}),sg("execute-on-form",v.concat([Ai(mn(),function(t){xm.focusIn(t)})])),sg("scroll-lock",[_i(function(){gu(gi(),"tox-dialog__disable-scroll")}),Mi(function(){hu(gi(),"tox-dialog__disable-scroll")})]),Hw({})]),eventOrder:(o={},o[te()]=["execute-on-form"],o[fe()]=["scroll-lock","reflecting","execute-on-form","alloy.base.behaviour"],o[le()]=["alloy.base.behaviour","execute-on-form","reflecting","scroll-lock"],o),dom:{tag:"div",classes:["tox-dialog"].concat(b),styles:{position:"relative"}},components:[g,p,h],dragBlockClass:"tox-dialog-wrap",parts:{blocker:{dom:ap('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}}})),x=HD({getRoot:function(){return y},getBody:function(){return yB.getBody(y)},getFooter:function(){return yB.getFooter(y)},getFormWrapper:function(){var t=yB.getBody(y);return gl.getCurrent(t).getOr(t)}},n.redial);return{dialog:y,instanceApi:x}},zD=function(t,n,e,o){var r,i,u,a,c,s,f,l,d,m,g,p=Oo("dialog-label"),h=Oo("dialog-content"),v=Tg((u={title:t.internalDialog.title,draggable:!0},a=p,c=e.shared.providers,Jh.sketch({dom:ap('<div class="tox-dialog__header"></div>'),components:[VD(u,tt.some(a),c),ID(c)],containerBehaviours:ga([YT.config({mode:"mouse",blockerClass:"blocker",getTarget:function(t){return Xu(t,'[role="dialog"]').getOrDie()},snaps:{getSnapPoints:function(){return[]},leftAttr:"data-drag-left",topAttr:"data-drag-top"}})])}))),b=Tg((s={body:t.internalDialog.body},f=h,l=e,d=o,AD(s,tt.some(f),l,d))),y=Tg((m={buttons:t.internalDialog.buttons},g=e.shared.providers,FD(m,g))),x=_D(function(){return S},{onBlock:function(){},onUnblock:function(){},onClose:function(){return n.closeWindow()}}),w=ju({dom:{tag:"div",classes:["tox-dialog"],attributes:(r={role:"dialog"},r["aria-labelledby"]=p,r["aria-describedby"]=""+h,r)},eventOrder:(i={},i[Zn()]=[lO.name(),Sa.name()],i[te()]=["execute-on-form"],i[fe()]=["reflecting","execute-on-form"],i),behaviours:ga([xm.config({mode:"cyclic",onEscape:function(t){return ai(t,sv),tt.some(!0)},useTabstopAt:function(t){return!Uw(t)&&("button"!==Qe(t)||"disabled"!==uo(t,"disabled"))}}),lO.config({channel:sD,updateState:function(t,n){return tt.some(n)},initialData:t}),sg("execute-on-form",x),Hw({})]),components:[v.asSpec(),b.asSpec(),y.asSpec()]}),S=HD({getRoot:function(){return w},getFooter:function(){return y.get(w)},getBody:function(){return b.get(w)},getFormWrapper:function(){var t=b.get(w);return gl.getCurrent(t).getOr(t)}},n.redial);return{dialog:w,instanceApi:S}},PD=function(t,n){return yB.parts().close(Eg.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":n.translate("Close")}},action:t,buttonBehaviours:ga([Ab.config({})])}))},LD=function(){return yB.parts().title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}})},jD=function(t,n){return yB.parts().body({dom:{tag:"div",classes:["tox-dialog__body","todo-tox-fit"]},components:[{dom:ap("<p>"+n.translate(t)+"</p>")}]})},UD=function(t){return yB.parts().footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:t})},WD=function(t,n){return[Jh.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:t}),Jh.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:n})]},GD=function(t){return yB.sketch({lazySink:t.lazySink,onEscape:function(){return t.onCancel(),tt.some(!0)},dom:{tag:"div",classes:["tox-dialog"].concat(t.extraClasses)},components:[{dom:{tag:"div",classes:["tox-dialog__header"]},components:[t.partSpecs.title,t.partSpecs.close]},t.partSpecs.body,t.partSpecs.footer],parts:{blocker:{dom:ap('<div class="tox-dialog-wrap"></div>'),components:[{dom:{tag:"div",classes:["tox-dialog-wrap__backdrop"]}}]}},modalBehaviours:ga([sg("basic-dialog-events",[Ci(fv,function(){t.onCancel()}),Ci(dv,function(){t.onSubmit()})])])})},XD=function(s){var u,a,e=(u=s.backstage.shared,{open:function(t,n){var e=function(){yB.hide(r),n()},o=Tg(ES({name:"close-alert",text:"OK",primary:!0,icon:tt.none()},"cancel",u.providers)),r=ju(GD({lazySink:function(){return u.getSink()},partSpecs:{title:LD(),close:PD(function(){e()},u.providers),body:jD(t,u.providers),footer:UD(WD([],[o.asSpec()]))},onCancel:function(){return e()},onSubmit:Q,extraClasses:["tox-alert-dialog"]}));yB.show(r);var i=o.get(r);Um.focus(i)}}),o=(a=s.backstage.shared,{open:function(t,n){var e=function(t){yB.hide(i),n(t)},o=Tg(ES({name:"yes",text:"Yes",primary:!0,icon:tt.none()},"submit",a.providers)),r=ES({name:"no",text:"No",primary:!0,icon:tt.none()},"cancel",a.providers),i=ju(GD({lazySink:function(){return a.getSink()},partSpecs:{title:LD(),close:PD(function(){e(!1)},a.providers),body:jD(t,a.providers),footer:UD(WD([],[r,o.asSpec()]))},onCancel:function(){return e(!1)},onSubmit:function(){return e(!0)},extraClasses:["tox-confirm-dialog"]}));yB.show(i);var u=o.get(i);Um.focus(u)}}),r=function(t,i){return cD.open(function(t,n,e){var o=n,r=ND({dataValidator:e,initialData:o,internalDialog:t},{redial:cD.redial,closeWindow:function(){yB.hide(r.dialog),i(r.instanceApi)}},s.backstage);return yB.show(r.dialog),r.instanceApi.setData(o),r.instanceApi},t)},i=function(t,u,a,c){return cD.open(function(t,n,e){var o=Or(kr("data",e,n)),r=zD({dataValidator:e,initialData:o,internalDialog:t},{redial:cD.redial,closeWindow:function(){kg.hide(i),a(r.instanceApi)}},s.backstage,c),i=ju(kg.sketch({lazySink:s.backstage.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:{},inlineBehaviours:ga([sg("window-manager-inline-events",[Ci(de(),function(){ai(r.dialog,fv)})])])}));return kg.showAt(i,u,Uu(r.dialog)),r.instanceApi.setData(o),xm.focusIn(r.dialog),r.instanceApi},t)};return{open:function(t,n,e){return n!==undefined&&"toolbar"===n.inline?i(t,s.backstage.shared.anchors.toolbar(),e,n.ariaAttrs):n!==undefined&&"cursor"===n.inline?i(t,s.backstage.shared.anchors.cursor(),e,n.ariaAttrs):r(t,e)},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)})}}};Eo.add("silver",function(t){var n=rB(t),e=n.mothership,o=n.uiMothership,r=n.backstage,i=n.renderUI,u=n.getUi;gB(t,r),So(Oo("silver-demo"),e),So(Oo("silver-ui-demo"),o),Dh(t,r.shared);var a=XD({backstage:r});return{renderUI:i,getWindowManagerImpl:Z(a),getNotificationManagerImpl:function(){return c(t,{backstage:r},o)},ui:u()}}),function CA(){}}(window);