/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.3.1 (2020-05-27) */ !function(nt){"use strict";var Z=function(){},d=function(e,o){return function(){for(var t=[],n=0;n "+o.toString()},function(t,n){return"state("+t+")"})}).join("\n")+"}"}}},fn=function(r){return{extract:function(e,o,t){var n=V(t,function(t,n){return r.extract(e.concat(["["+n+"]"]),o,t)});return tn(n)},toString:function(){return"array("+r.toString()+")"}}},dn=function(a,c){return{extract:function(e,o,r){var t,n,i=lt(r),u=(t=e,n=i,fn(cn(a)).extract(t,ct,n));return Ht(u,function(t){var n=V(t,function(t){return on.field(t,t,Ut(),c)});return ln(n).extract(e,o,r)})},toString:function(){return"setOf("+c.toString()+")"}}},mn=at(cn(It)),gn=d(fn,ln),pn=on.state,hn=on.field,vn=function(e,n,o,r,i){return bt(r,i).fold(function(){return t=r,n=i,en(e,function(){return'The chosen schema: "'+n+'" did not exist in branches: '+nn(t)});var t,n},function(t){return t.extract(e.concat(["branch: "+i]),n,o)})},bn=function(r,i){return{extract:function(n,e,o){return bt(o,r).fold(function(){return t=r,en(n,function(){return'Choice schema did not contain choice key: "'+t+'"'});var t},function(t){return vn(n,e,o,i,t)})},toString:function(){return"chooseOn("+r+"). Possible values: "+lt(i)}}},yn=cn(It),xn=function(t){return gn(t)},wn=function(o){return{extract:function(t,n,e){return o().extract(t,n,e)},toString:function(){return o().toString()}}},Sn=function(n){return cn(function(t){return n(t).fold(Vt,It)})},kn=function(n,t){return dn(function(t){return At(n(t))},t)},Cn=function(t,n,e){return Ft((o=t,r=ct,i=e,u=n.extract([o],r,i),Nt(u,function(t){return{input:i,errors:t}})));var o,r,i,u},On=function(t){return t.fold(function(t){throw new Error(Tn(t))},ct)},_n=function(t,n,e){return On(Cn(t,n,e))},Tn=function(t){return"Errors: \n"+(n=t.errors,e=10 ")+")\n"+t.getErrorInfo()}).join("\n"))+"\n\nInput object: "+nn(t.input);var n,e},En=function(t,n){return bn(t,n)},Bn=function(t,n){return bn(t,dt(n,ln))},Dn=at(yn),Mn=function(e,o){return cn(function(t){var n=typeof t;return e(t)?It(t):Vt("Expected type: "+o+" but got: "+n)})},An=Mn(rt,"number"),Fn=Mn(S,"string"),In=Mn(O,"boolean"),Rn=Mn(T,"function"),Vn=function(n){var t=function(t,n){for(var e=t.next();!e.done;){if(!n(e.value))return!1;e=t.next()}return!0};if(Object(n)!==n)return!0;switch({}.toString.call(n).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(n).every(function(t){return Vn(n[t])});case"Map":return t(n.keys(),Vn)&&t(n.values(),Vn);case"Set":return t(n.keys(),Vn);default:return!1}},Hn=cn(function(t){return Vn(t)?It(t):Vt("Expected value to be acceptable for sending via postMessage")}),Pn=function(n){return Sn(function(t){return F(n,t)?ot.value(t):ot.error('Unsupported value: "'+t+'", choose one of "'+n.join(", ")+'".')})},zn=function(t){return hn(t,t,Ut(),mn())},Nn=function(t,n){return hn(t,t,Ut(),n)},Ln=function(t){return Nn(t,Fn)},jn=function(t,n){return hn(t,t,Ut(),Pn(n))},Un=function(t){return Nn(t,Rn)},Wn=function(t,n){return hn(t,t,Ut(),ln(n))},Gn=function(t,n){return hn(t,t,Ut(),gn(n))},Xn=function(t,n){return hn(t,t,Ut(),fn(n))},Yn=function(t){return hn(t,t,Wt(),mn())},qn=function(t,n){return hn(t,t,Wt(),n)},Kn=function(t){return qn(t,An)},Jn=function(t){return qn(t,Fn)},$n=function(t){return qn(t,Rn)},Qn=function(t,n){return qn(t,ln(n))},Zn=function(t,n){return hn(t,t,jt(n),mn())},te=function(t,n,e){return hn(t,t,jt(n),e)},ne=function(t,n){return te(t,n,An)},ee=function(t,n){return te(t,n,Fn)},oe=function(t,n,e){return te(t,n,Pn(e))},re=function(t,n){return te(t,n,In)},ie=function(t,n){return te(t,n,Rn)},ue=function(t,n,e){return te(t,n,ln(e))},ae=function(t,n){return pn(t,n)},ce=function(t){var n=t;return{get:function(){return n},set:function(t){n=t}}},se=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:at(t)}},le={fromHtml:function(t,n){var e=(n||nt.document).createElement("div");if(e.innerHTML=t,!e.hasChildNodes()||1=o.length&&e.substr(r,r+o.length)===o?t.substring(0,t.length-"/*".length):t;var n,e,o,r})},Qr=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:$r(i)}},t},Zr=Nr("alloy-premade"),ti=function(t){return Kt(Zr,t)},ni=function(o){return t=function(t){for(var n=[],e=1;e "):o[0].name();return Kt(r,{handler:n,purpose:at(e)})})});return $t(n,{})},mi=function(t){return Cn("custom.definition",ln([hn("dom","dom",Ut(),ln([zn("tag"),Zn("styles",{}),Zn("classes",[]),Zn("attributes",{}),Yn("value"),Yn("innerHtml")])),zn("components"),zn("uid"),Zn("events",{}),Zn("apis",{}),hn("eventOrder","eventOrder",Lt.mergeWithThunk(at({"alloy.execute":["disabling","alloy.base.behaviour","toggling","typeaheadevents"],"alloy.focus":["alloy.base.behaviour","focusing","keying"],"alloy.system.init":["alloy.base.behaviour","disabling","toggling","representing"],input:["alloy.base.behaviour","representing","streaming","invalidating"],"alloy.system.detached":["alloy.base.behaviour","representing","item-events","tooltipping"],mousedown:["focusing","alloy.base.behaviour","item-type-events"],touchstart:["focusing","alloy.base.behaviour","item-type-events"],mouseover:["item-type-events","tooltipping"],"alloy.receive":["receiving","reflecting","tooltipping"]})),Dn()),Yn("domModification")]),t)},gi=function(t,n){var e=Dr(t,n);return e===undefined||""===e?[]:e.split(" ")},pi=function(t){return t.dom().classList!==undefined},hi=function(t,n){return r=n,i=gi(e=t,o="class").concat([r]),Br(e,o,i.join(" ")),!0;var e,o,r,i},vi=function(t,n){return r=n,0<(i=P(gi(e=t,o="class"),function(t){return t!==r})).length?Br(e,o,i.join(" ")):Fr(e,o),!1;var e,o,r,i},bi=function(t,n){pi(t)?t.dom().classList.add(n):hi(t,n)},yi=function(t){0===(pi(t)?t.dom().classList:gi(t,"class")).length&&Fr(t,"class")},xi=function(t,n){pi(t)?t.dom().classList.remove(n):vi(t,n);yi(t)},wi=function(t,n){return pi(t)&&t.dom().classList.contains(n)},Si=function(n,t){it(t,function(t){bi(n,t)})},ki=function(n,t){it(t,function(t){xi(n,t)})},Ci=function(t){return t.style!==undefined&&T(t.style.getPropertyValue)},Oi=function(t){var n=Tr(t)?t.dom().parentNode:t.dom();return n!==undefined&&null!==n&&n.ownerDocument.body.contains(n)},_i=function(){return Ti(le.fromDom(nt.document))},Ti=function(t){var n=t.dom().body;if(null===n||n===undefined)throw new Error("Body is not available yet");return le.fromDom(n)},Ei=function(t,n,e){if(!S(e))throw nt.console.error("Invalid call to CSS.set. Property ",n,":: Value ",e,":: Element ",t),new Error("CSS value must be a string: "+e);Ci(t)&&t.style.setProperty(n,e)},Bi=function(t,n){Ci(t)&&t.style.removeProperty(n)},Di=function(t,n,e){var o=t.dom();Ei(o,n,e)},Mi=function(t,n){var e=t.dom();ft(n,function(t,n){Ei(e,n,t)})},Ai=function(t,n){var e=t.dom();ft(n,function(t,n){t.fold(function(){Bi(e,n)},function(t){Ei(e,n,t)})})},Fi=function(t,n){var e=t.dom(),o=nt.window.getComputedStyle(e).getPropertyValue(n);return""!==o||Oi(t)?o:Ii(e,n)},Ii=function(t,n){return Ci(t)?t.style.getPropertyValue(n):""},Ri=function(t,n){var e=t.dom(),o=Ii(e,n);return st.from(o).filter(function(t){return 0"}),Dn()),Pl=ae("schema",function(){return[Yn("preprocess")]}),zl=Zn("defaults",at({})),Nl=Zn("overrides",at({})),Ll=ln([Il,Rl,Vl,Hl,zl,Nl]),jl=ln([Il,Rl,Vl,zl,Nl]),Ul=ln([Il,Rl,Vl,Hl,zl,Nl]),Wl=ln([Il,Pl,Vl,zn("unit"),Hl,zl,Nl]),Gl=function(t){return t.fold(st.some,st.none,st.some,st.some)},Xl=function(t){var n=function(t){return t.name};return t.fold(n,n,n,n)},Yl=function(e,o){return function(t){var n=_n("Converting part type",o,t);return e(n)}},ql=Yl(Fl.required,Ll),Kl=Yl(Fl.external,jl),Jl=Yl(Fl.optional,Ul),$l=Yl(Fl.group,Wl),Ql=at("entirety"),Zl=/* */Object.freeze({__proto__:null,required:ql,external:Kl,optional:Jl,group:$l,asNamedPart:Gl,name:Xl,asCommon:function(t){return t.fold(ct,ct,ct,ct)},original:Ql}),tf=function(t,n,e,o){return Ct(n.defaults(t,e,o),e,{uid:t.partUids[n.name]},n.overrides(t,e,o))},nf=function(r,t){var n={};return it(t,function(t){Gl(t).each(function(e){var o=ef(r,e.pname);n[e.name]=function(t){var n=_n("Part: "+e.name+" in "+r,ln(e.schema),t);return et(et({},o),{config:t,validated:n})}})}),n},ef=function(t,n){return{uiType:Al(),owner:t,name:n}},of=function(t,n,e){return{uiType:Al(),owner:t,name:n,config:e,validated:{}}},rf=function(t){return U(t,function(t){return t.fold(st.none,st.some,st.none,st.none).map(function(t){return Wn(t.name,t.schema.concat([ea(Ql())]))}).toArray()})},uf=function(t){return V(t,Xl)},af=function(t,n,e){return o=n,i={},r={},it(e,function(t){t.fold(function(o){i[o.pname]=Dl(!0,function(t,n,e){return o.factory.sketch(tf(t,o,n,e))})},function(t){var n=o.parts[t.name];r[t.name]=at(t.factory.sketch(tf(o,t,n[Ql()]),n))},function(o){i[o.pname]=Dl(!1,function(t,n,e){return o.factory.sketch(tf(t,o,n,e))})},function(r){i[r.pname]=Ml(!0,function(n,t,e){var o=n[r.name];return V(o,function(t){return r.factory.sketch(Ct(r.defaults(n,t,e),t,r.overrides(n,t)))})})})}),{internals:at(i),externals:at(r)};var o,i,r},cf=function(t,n,e){return Bl(st.some(t),n,n.components,e)},sf=function(t,n,e){var o=n.partUids[e];return t.getSystem().getByUid(o).toOption()},lf=function(t,n,e){return sf(t,n,e).getOrDie("Could not find part: "+e)},ff=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return it(e,function(t){o[t]=at(i.getByUid(r[t]))}),o},df=function(t,n){var e=t.getSystem();return dt(n.partUids,function(t,n){return at(e.getByUid(t))})},mf=function(t){return lt(t.partUids)},gf=function(t,n,e){var o={},r=n.partUids,i=t.getSystem();return it(e,function(t){o[t]=at(i.getByUid(r[t]).getOrDie())}),o},pf=function(n,t){var e=uf(t);return Jt(V(e,function(t){return{key:t,value:n+"-"+t}}))},hf=function(n){return hn("partUids","partUids",Xt(function(t){return pf(t.uid,n)}),Dn())},vf=/* */Object.freeze({__proto__:null,generate:nf,generateOne:of,schemas:rf,names:uf,substitutes:af,components:cf,defaultUids:pf,defaultUidsSchema:hf,getAllParts:df,getAllPartNames:mf,getPart:sf,getPartOrDie:lf,getParts:ff,getPartsOrDie:gf}),bf=function(t,n,e,o,r){var i,u,a=(u=r,(0<(i=o).length?[Wn("parts",i)]:[]).concat([zn("uid"),Zn("dom",{}),Zn("components",[]),ea("originalSpec"),Zn("debug.sketcher",{})]).concat(u));return _n(t+" [SpecSchema]",sn(a.concat(n)),e)},yf=function(t,n,e,o,r){var i=xf(r),u=rf(e),a=hf(e),c=bf(t,n,i,u,[a]),s=af(0,c,e);return o(c,cf(t,c,s.internals()),i,s.externals())},xf=function(t){return yt(t,"uid")?t:et(et({},t),{uid:Yr("uid")})};var wf,Sf,kf=sn([zn("name"),zn("factory"),zn("configFields"),Zn("apis",{}),Zn("extraApis",{})]),Cf=sn([zn("name"),zn("factory"),zn("configFields"),zn("partFields"),Zn("apis",{}),Zn("extraApis",{})]),Of=function(t){var i=_n("Sketcher for "+t.name,kf,t),n=dt(i.apis,ni),e=dt(i.extraApis,function(t,n){return Qr(t,n)});return et(et({name:at(i.name),configFields:at(i.configFields),sketch:function(t){return n=i.name,e=i.configFields,o=i.factory,r=xf(t),o(bf(n,e,r,[],[]),r);var n,e,o,r}},n),e)},_f=function(t){var n=_n("Sketcher for "+t.name,Cf,t),e=nf(n.name,n.partFields),o=dt(n.apis,ni),r=dt(n.extraApis,function(t,n){return Qr(t,n)});return et(et({name:at(n.name),partFields:at(n.partFields),configFields:at(n.configFields),sketch:function(t){return yf(n.name,n.configFields,n.partFields,n.factory,t)},parts:at(e)},o),r)},Tf=function(t){for(var n=[],e=function(t){n.push(t)},o=0;o',e.getDoc());return vr(t,le.fromDom(n.extractContents())),n.insertNode(t.dom()),lr(t).each(function(t){return t.dom().normalize()}),Xc(t,Gc).map(function(t){var n;e.selection.setCursorLocation(t.dom(),"img"===Cr(n=t)?1:Uc(n).fold(function(){return dr(n).length},function(t){return t.length}))}),t})},np=function(t){return Au(t,"[data-mce-autocompleter]")},ep=function(t){return t.toString().replace(/\u00A0/g," ").replace(/\uFEFF/g,"")},op=function(t){return""!==t&&-1!==" \xa0\f\n\r\t\x0B".indexOf(t)},rp=function(t,n){return t.substring(n.length)},ip=function(t,o,r,i){if(void 0===i&&(i=0),!(n=o).collapsed||3!==n.startContainer.nodeType)return st.none();var n,e=t.getParent(o.startContainer,t.isBlock)||t.getRoot();return Zg(t,o.startContainer,o.startOffset,function(t,n,e){return function(t,n,e){var o;for(o=n-1;0<=o;o--){var r=t.charAt(o);if(op(r))return st.none();if(r===e)break}return st.some(o)}(e,n,r).getOr(n)},e).bind(function(t){var n=o.cloneRange();if(n.setStart(t.container,t.offset),n.setEnd(o.endContainer,o.endOffset),n.collapsed)return st.none();var e=ep(n);return 0!==e.lastIndexOf(r)||rp(e,r).length=t.minChars&&t.matches.getOrThunk(function(){return dp(n.dom)})(e.range,i,e.text)});if(0===u.length)return st.none();var a=cp.all(V(u,function(n){return n.fetch(e.text,n.maxResults,o).then(function(t){return{matchText:e.text,items:t,columns:n.columns,onAction:n.onAction}})}));return st.some({lookupData:a,context:e})},pp=ln([Ln("type"),Jn("text")]),hp=ln([ae("type",function(){return"autocompleteitem"}),ae("active",function(){return!1}),ae("disabled",function(){return!1}),Zn("meta",{}),Ln("value"),Jn("text"),Jn("icon")]),vp=ln([Ln("type"),Ln("ch"),ne("minChars",1),Zn("columns",1),ne("maxResults",10),$n("matches"),Un("fetch"),Un("onAction")]),bp=function(t){var n,e,o=t.ui.registry.getAll().popups,r=dt(o,function(t){return Cn("Autocompleter",vp,t).fold(function(t){throw new Error(Tn(t))},function(t){return t})}),i=(n=pt(r,function(t){return t.ch}),e={},it(n,function(t){e[t]={}}),lt(e)),u=vt(r);return{dataset:r,triggerChars:i,lookupByChar:function(n){return P(u,function(t){return t.ch===n})}}},yp=[re("disabled",!1),Jn("text"),Jn("shortcut"),hn("value","value",Gt(function(){return Nr("menuitem-value")}),Dn()),Zn("meta",{})],xp=ln([Ln("type"),ie("onSetup",function(){return Z}),ie("onAction",Z),Jn("icon")].concat(yp)),wp=ln([Ln("type"),Un("getSubmenuItems"),ie("onSetup",function(){return Z}),Jn("icon")].concat(yp)),Sp=ln([Ln("type"),Jn("icon"),re("active",!1),ie("onSetup",function(){return Z}),Un("onAction")].concat(yp)),kp=ln([Ln("type"),re("active",!1),Jn("icon")].concat(yp)),Cp=ln([Ln("type"),jn("fancytype",["inserttable","colorswatch"]),ie("onAction",Z)]),Op=function(t,o,n){var r=Yc(t.element(),"."+n);if(0o}).getOr(r.length);return st.some({numColumns:e,numRows:Math.ceil(r.length/e)})}return st.none()},_p=function(t,n){return za([Lm(t,n)])},Tp=function(t){return _p(Nr("unnamed-events"),t)},Ep=[zn("lazySink"),zn("tooltipDom"),Zn("exclusive",!0),Zn("tooltipComponents",[]),Zn("delay",300),oe("mode","normal",["normal","follow-highlight"]),Zn("anchor",function(t){return{anchor:"hotspot",hotspot:t,layouts:{onLtr:at([_a,Oa,wa,ka,Sa,Ca]),onRtl:at([_a,Oa,wa,ka,Sa,Ca])}}}),$u("onHide"),$u("onShow")],Bp=/* */Object.freeze({__proto__:null,init:function(){var e=ce(st.none()),n=ce(st.none()),o=function(){e.get().each(function(t){nt.clearTimeout(t)})},t=at("not-implemented");return oi({getTooltip:function(){return n.get()},isShowing:function(){return n.get().isSome()},setTooltip:function(t){n.set(st.some(t))},clearTooltip:function(){n.set(st.none())},clearTimer:o,resetTimer:function(t,n){o(),e.set(st.some(nt.setTimeout(function(){t()},n)))},readState:t})}}),Dp=Nr("tooltip.exclusive"),Mp=Nr("tooltip.show"),Ap=Nr("tooltip.hide"),Fp=function(t,n,e){t.getSystem().broadcastOn([Dp],{})},Ip=/* */Object.freeze({__proto__:null,hideAllExclusive:Fp,setComponents:function(t,n,e,o){e.getTooltip().each(function(t){t.getSystem().isConnected()&&Nm.set(t,o)})}}),Rp=La({fields:Ep,name:"tooltipping",active:/* */Object.freeze({__proto__:null,events:function(o,r){var e=function(n){r.getTooltip().each(function(t){Ps(t),o.onHide(n,t),r.clearTooltip()}),r.clearTimer()};return Yo(ut([[Jo(Mp,function(t){r.resetTimer(function(){!function(n){if(!r.isShowing()){Fp(n);var t=o.lazySink(n).getOrDie(),e=n.getSystem().build({dom:o.tooltipDom,components:o.tooltipComponents,events:Yo("normal"===o.mode?[Jo(ro(),function(t){Lo(n,Mp)}),Jo(eo(),function(t){Lo(n,Ap)})]:[]),behaviours:za([Nm.config({})])});r.setTooltip(e),Rs(t,e),o.onShow(n,e),Ds.position(t,o.anchor(n),e)}}(t)},o.delay)}),Jo(Ap,function(t){r.resetTimer(function(){e(t)},o.delay)}),Jo(yo(),function(t,n){F(n.channels(),Dp)&&e(t)}),rr(function(t){e(t)})],"normal"===o.mode?[Jo(io(),function(t){Lo(t,Mp)}),Jo(vo(),function(t){Lo(t,Ap)}),Jo(ro(),function(t){Lo(t,Mp)}),Jo(eo(),function(t){Lo(t,Ap)})]:[Jo(zo(),function(t,n){Lo(t,Mp)}),Jo(No(),function(t){Lo(t,Ap)})]]))}}),state:Bp,apis:Ip}),Vp=tinymce.util.Tools.resolve("tinymce.util.I18n"),Hp="tox-menu-nav__js",Pp="tox-collection__item",zp="tox-swatch",Np={normal:Hp,color:zp},Lp="tox-collection__item--enabled",jp="tox-collection__item-label",Up="tox-collection__item-caret",Wp="tox-collection__item--active",Gp=function(t){return bt(Np,t).getOr(Hp)},Xp=tinymce.util.Tools.resolve("tinymce.Env"),Yp=function(t){return{dom:{tag:"div",classes:["tox-collection__item-icon"],innerHtml:t}}},qp=function(t){return{dom:{tag:"div",classes:[jp]},components:[Yi(Vp.translate(t))]}},Kp=function(t,n){return{dom:{tag:"div",classes:[jp]},components:[{dom:{tag:t.tag,styles:t.styles},components:[Yi(Vp.translate(n))]}]}},Jp=function(t){return{dom:{tag:"div",classes:["tox-collection__item-accessory"],innerHtml:(n=t,e=Xp.mac?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},o=n.split("+"),r=V(o,function(t){var n=t.toLowerCase().trim();return yt(e,n)?e[n]:t}),Xp.mac?r.join(""):r.join("+"))}};var n,e,o,r},$p=function(t){return{dom:{tag:"div",classes:["tox-collection__item-checkmark"],innerHtml:Gg("checkmark",t)}}},Qp=function(t,n,e,o,r){var i=e?n.or(st.some("")).map(Yp):st.none(),u=t.checkMark,a=t.ariaLabel.map(function(t){return{attributes:{title:Vp.translate(t)}}}).getOr({});return{dom:et({tag:"div",classes:[Hp,Pp].concat(r?["tox-collection__item-icon-rtl"]:[])},a),optComponents:[i,t.htmlContent.fold(function(){return t.textContent.map(o)},function(t){return st.some({dom:{tag:"div",classes:[jp],innerHtml:t}})}),t.shortcutContent.map(Jp),u,t.caret]}},Zp=["list-num-default","list-num-lower-alpha","list-num-lower-greek","list-num-lower-roman","list-num-upper-alpha","list-num-upper-roman"],th=["list-bull-circle","list-bull-default","list-bull-square"],nh=function(t,r,n,i){void 0===i&&(i=st.none());var e,o,u,a,c,s=Vp.isRtl()&&t.iconContent.exists(function(t){return F(th,t)}),l=t.iconContent.map(function(t){return Vp.isRtl()&&F(Zp,t)?t+"-rtl":t}).map(function(t){return n=t,e=r.icons,o=i,st.from(e()[n]).or(o).getOrThunk(function(){return Wg(e)});var n,e,o}),f=st.from(t.meta).fold(function(){return qp},function(t){return yt(t,"style")?g(Kp,t.style):qp});return"color"===t.presets?(e=t.ariaLabel,o=t.value,u=r,{dom:(a=l.getOr(""),c={tag:"div",attributes:e.map(function(t){return{title:u.translate(t)}}).getOr({}),classes:["tox-swatch"]},et(et({},c),"custom"===o?{tag:"button",classes:b(c.classes,["tox-swatches__picker-btn"]),innerHtml:a}:"remove"===o?{classes:b(c.classes,["tox-swatch--remove"]),innerHtml:a}:{attributes:et(et({},c.attributes),{"data-mce-color":o}),styles:{"background-color":o}})),optComponents:[]}):Qp(t,l,n,f,s)},eh=["input","button","textarea","select"],oh=function(t,n,e){(n.disabled()?sh:lh)(t,n,e)},rh=function(t,n){return!0===n.useNative&&F(eh,Cr(t.element()))},ih=function(t){Br(t.element(),"disabled","disabled")},uh=function(t){Fr(t.element(),"disabled")},ah=function(t){Br(t.element(),"aria-disabled","true")},ch=function(t){Br(t.element(),"aria-disabled","false")},sh=function(n,t,e){t.disableClass.each(function(t){bi(n.element(),t)}),(rh(n,t)?ih:ah)(n),t.onDisabled(n)},lh=function(n,t,e){t.disableClass.each(function(t){xi(n.element(),t)}),(rh(n,t)?uh:ch)(n),t.onEnabled(n)},fh=function(t,n){return rh(t,n)?Ar(t.element(),"disabled"):"true"===Dr(t.element(),"aria-disabled")},dh=/* */Object.freeze({__proto__:null,enable:lh,disable:sh,isDisabled:fh,onLoad:oh,set:function(t,n,e,o){(o?sh:lh)(t,n,e)}}),mh=/* */Object.freeze({__proto__:null,exhibit:function(t,n){return ii({classes:n.disabled?n.disableClass.map(Y).getOr([]):[]})},events:function(e,t){return Yo([qo(xo(),function(t,n){return fh(t,e)}),Ia(e,t,oh)])}}),gh=[ie("disabled",c),Zn("useNative",!0),Yn("disableClass"),$u("onDisabled"),$u("onEnabled")],ph=La({fields:gh,name:"disabling",active:mh,apis:dh}),hh=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),vh=tinymce.util.Tools.resolve("tinymce.EditorManager"),bh=function(t){return t.getParam("height",Math.max(t.getElement().offsetHeight,200))},yh=function(t){return t.getParam("width",hh.DOM.getStyle(t.getElement(),"width"))},xh=function(t){return st.from(t.settings.min_width).filter(rt)},wh=function(t){return st.from(t.settings.min_height).filter(rt)},Sh=function(t){return st.from(t.getParam("max_width")).filter(rt)},kh=function(t){return st.from(t.getParam("max_height")).filter(rt)},Ch=function(t){return!1!==t.getParam("menubar",!0,"boolean")},Oh=function(t){var n=t.getParam("toolbar",!0),e=!0===n,o=S(n),r=C(n)&&0'+t+""})}return r},ov=at(nf(pg(),hg())),rv=Nr("cell-over"),iv=Nr("cell-execute"),uv=function(n,e,t){var o,r=function(t){return jo(t,iv,{row:n,col:e})},i=function(t,n){n.stop(),r(t)};return Ji({dom:{tag:"div",attributes:((o={role:"button"})["aria-labelledby"]=t,o)},behaviours:za([Lm("insert-table-picker-cell",[Jo(ro(),Xm.focus),Jo(xo(),r),Jo(fo(),i),Jo(So(),i)]),rg.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),Xm.config({onFocus:function(t){return jo(t,rv,{row:n,col:e})}})])})},av=function(t){return{value:t}},cv=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,sv=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,lv=function(t){return cv.test(t)||sv.test(t)},fv=function(t){var n={value:t.value.replace(cv,function(t,n,e,o){return n+n+e+e+o+o})},e=sv.exec(n.value);return null===e?["FFFFFF","FF","FF","FF"]:e},dv=function(t){var n=t.toString(16);return 1===n.length?"0"+n:n},mv=function(t){var n=dv(t.red)+dv(t.green)+dv(t.blue);return av(n)},gv=Math.min,pv=Math.max,hv=Math.round,vv=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)/,bv=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/,yv=function(t,n,e,o){return{red:t,green:n,blue:e,alpha:o}},xv=function(t){var n=parseInt(t,10);return n.toString()===t&&0<=n&&n<=255},wv=function(t){var n,e,o,r=(t.hue||0)%360,i=t.saturation/100,u=t.value/100;if(i=pv(0,gv(i,1)),u=pv(0,gv(u,1)),0===i)return n=e=o=hv(255*u),yv(n,e,o,1);var a=r/60,c=u*i,s=c*(1-Math.abs(a%2-1)),l=u-c;switch(Math.floor(a)){case 0:n=c,e=s,o=0;break;case 1:n=s,e=c,o=0;break;case 2:n=0,e=c,o=s;break;case 3:n=0,e=s,o=c;break;case 4:n=s,e=0,o=c;break;case 5:n=c,e=0,o=s;break;default:n=e=o=0}return n=hv(255*(n+l)),e=hv(255*(e+l)),o=hv(255*(o+l)),yv(n,e,o,1)},Sv=function(t){var n=fv(t),e=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16);return yv(e,o,r,1)},kv=function(t,n,e,o){var r=parseInt(t,10),i=parseInt(n,10),u=parseInt(e,10),a=parseFloat(o);return yv(r,i,u,a)},Cv=function(t){return"rgba("+t.red+","+t.green+","+t.blue+","+t.alpha+")"},Ov=yv(255,0,0,1),_v=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),Tv="tinymce-custom-colors";var Ev="choiceitem",Bv=[{type:Ev,text:"Light Green",value:"#BFEDD2"},{type:Ev,text:"Light Yellow",value:"#FBEEB8"},{type:Ev,text:"Light Red",value:"#F8CAC6"},{type:Ev,text:"Light Purple",value:"#ECCAFA"},{type:Ev,text:"Light Blue",value:"#C2E0F4"},{type:Ev,text:"Green",value:"#2DC26B"},{type:Ev,text:"Yellow",value:"#F1C40F"},{type:Ev,text:"Red",value:"#E03E2D"},{type:Ev,text:"Purple",value:"#B96AD9"},{type:Ev,text:"Blue",value:"#3598DB"},{type:Ev,text:"Dark Turquoise",value:"#169179"},{type:Ev,text:"Orange",value:"#E67E23"},{type:Ev,text:"Dark Red",value:"#BA372A"},{type:Ev,text:"Dark Purple",value:"#843FA1"},{type:Ev,text:"Dark Blue",value:"#236FA1"},{type:Ev,text:"Light Gray",value:"#ECF0F1"},{type:Ev,text:"Medium Gray",value:"#CED4D9"},{type:Ev,text:"Gray",value:"#95A5A6"},{type:Ev,text:"Dark Gray",value:"#7E8C8D"},{type:Ev,text:"Navy Blue",value:"#34495E"},{type:Ev,text:"Black",value:"#000000"},{type:Ev,text:"White",value:"#ffffff"}],Dv=function zF(e){void 0===e&&(e=10);var t,n=_v.getItem(Tv),o=S(n)?JSON.parse(n):[],r=e-(t=o).length<0?t.slice(0,e):t,i=function(t){r.splice(t,1)};return{add:function(t){var n;(-1===(n=A(r,t))?st.none():st.some(n)).each(i),r.unshift(t),r.length>e&&r.pop(),_v.setItem(Tv,JSON.stringify(r))},state:function(){return r.slice(0)}}}(10),Mv=function(t){return!1!==t.getParam("custom_colors")},Av=function(t){var n=t.getParam("color_map");return n!==undefined?function(t){var n=[],u=nt.document.createElement("canvas");u.height=1,u.width=1;for(var a=u.getContext("2d"),c=function(t,n){var e=n/255;return("0"+Math.round(t*e+255*(1-e)).toString(16)).slice(-2).toUpperCase()},e=function(t){if(/^[0-9A-Fa-f]{6}$/.test(t))return"#"+t.toUpperCase();a.clearRect(0,0,u.width,u.height),a.fillStyle="#FFFFFF",a.fillStyle=t,a.fillRect(0,0,1,1);var n=a.getImageData(0,0,1,1).data,e=n[0],o=n[1],r=n[2],i=n[3];return"#"+c(e,i)+c(o,i)+c(r,i)},o=0;o"},Ww=function(o,t){return{uid:o.uid,dom:o.dom,components:t,behaviours:wl(o.formBehaviours,[bl.config({store:{mode:"manual",getValue:function(t){var n=df(t,o);return dt(n,function(t,r){return t().bind(function(t){var n,e,o=Mf.getCurrent(t);return n=o,e=new Error("Cannot find a current component to extract the value from for form part '"+r+"': "+Vr(t.element())),n.fold(function(){return ot.error(e)},ot.value)}).map(bl.getValue)})},setValue:function(e,t){ft(t,function(n,t){sf(e,o,t).each(function(t){Mf.getCurrent(t).each(function(t){bl.setValue(t,n)})})})}}})]),apis:{getField:function(t,n){return sf(t,o,n).bind(Mf.getCurrent)}}}},Gw={getField:ni(function(t,n,e){return t.getField(n,e)}),sketch:function(t){var e,n=(e=[],{field:function(t,n){return e.push(t),of("form",Uw(t),n)},record:function(){return e}}),o=t(n),r=n.record(),i=V(r,function(t){return ql({name:t,pname:Uw(t)})});return yf("form",jw,i,Ww,o)}},Xw=Nr("valid-input"),Yw=Nr("invalid-input"),qw=Nr("validating-input"),Kw="colorcustom.rgb.",Jw=function(d,m,g,p){var h=function(t,n,e,o,r){var i,u,a=d(Kw+"range"),c=[ey.parts().label({dom:{tag:"label",innerHtml:e,attributes:{"aria-label":o}}}),ey.parts().field({data:r,factory:uy,inputAttributes:et({type:"text"},"hex"===n?{"aria-live":"polite"}:{}),inputClasses:[m("textfield")],inputBehaviours:za([(i=n,u=t,Ty.config({invalidClass:m("invalid"),notify:{onValidate:function(t){jo(t,qw,{type:i})},onValid:function(t){jo(t,Xw,{type:i,value:bl.getValue(t)})},onInvalid:function(t){jo(t,Yw,{type:i,value:bl.getValue(t)})}},validator:{validate:function(t){var n=bl.getValue(t),e=u(n)?ot.value(!0):ot.error(d("aria.input.invalid"));return vy(e)},validateOnLoad:!1}})),Dy.config({})]),onSetValue:function(t){Ty.isInvalid(t)&&Ty.run(t).get(Z)}})],s="hex"!==n?[ey.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;bl.setValue(t,{red:e,green:o,blue:r})},b=Ug({dom:{tag:"div",classes:[m("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),y=function(t,n){b.getOpt(t).each(function(t){Di(t.element(),"background-color","#"+n.value)})};return Of({factory:function(){var e={red:ce(st.some(255)),green:ce(st.some(255)),blue:ce(st.some(255)),hex:ce(st.some("ffffff"))},o=function(t){return e[t].get()},i=function(t,n){e[t].set(n)},r=function(t){var n=t.red,e=t.green,o=t.blue;i("red",st.some(n)),i("green",st.some(e)),i("blue",st.some(o))},n=function(t,n){var e=n.event();"hex"!==e.type()?i(e.type(),st.none()):p(t)},u=function(r,t,n){var e=parseInt(n,10);i(t,st.some(e)),o("red").bind(function(e){return o("green").bind(function(n){return o("blue").map(function(t){return yv(e,n,t,1)})})}).each(function(t){var n,e,o=(n=r,e=mv(t),Gw.getField(n,"hex").each(function(t){Xm.isFocused(t)||bl.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=av(n);i("hex",st.some(n));var o=Sv(e);v(t,o),r(o),jo(t,ix,{hex:e}),y(t,e)}(t,e.value()):u(t,e.type(),e.value())},t=function(t){return{label:d(Kw+t+".label"),description:d(Kw+t+".description")}},c=t("red"),s=t("green"),l=t("blue"),f=t("hex");return Ct(Gw.sketch(function(t){return{dom:{tag:"form",classes:[m("rgb-form")],attributes:{"aria-label":d("aria.color.picker")}},components:[t.field("red",ey.sketch(h(xv,"red",c.label,c.description,255))),t.field("green",ey.sketch(h(xv,"green",s.label,s.description,255))),t.field("blue",ey.sketch(h(xv,"blue",l.label,l.description,255))),t.field("hex",ey.sketch(h(lv,"hex",f.label,f.description,"ffffff"))),b.asSpec()],formBehaviours:za([Ty.config({invalidClass:m("form-invalid")}),Lm("rgb-form-events",[Jo(Xw,a),Jo(Yw,n),Jo(qw,n)])])}}),{apis:{updateHex:function(t,n){var e,o;bl.setValue(t,{hex:n.value}),e=t,o=Sv(n),v(e,o),r(o),y(t,n)}}})},name:"RgbForm",configFields:[],apis:{updateHex:function(t,n,e){t.updateHex(n,e)}},extraApis:{}})},$w=function(t,o){var r=Lw.parts().spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[o("sv-palette-spectrum")]}}),i=Lw.parts().thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette-thumb")],innerHtml:"'}}),u=function(t,n){var e=t.width,o=t.height,r=t.getContext("2d");if(null!==r){r.fillStyle=n,r.fillRect(0,0,e,o);var i=r.createLinearGradient(0,0,e,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=i,r.fillRect(0,0,e,o);var u=r.createLinearGradient(0,0,0,o);u.addColorStop(0,"rgba(0,0,0,0)"),u.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=u,r.fillRect(0,0,e,o)}};return Of({factory:function(t){var n=at({x:at(0),y:at(0)}),e=za([Mf.config({find:st.some}),Xm.config({})]);return Lw.sketch({dom:{tag:"div",attributes:{role:"presentation"},classes:[o("sv-palette")]},model:{mode:"xy",getInitialValue:n},rounded:!1,components:[r,i],onChange:function(t,n,e){jo(t,ax,{value:e})},onInit:function(t,n,e,o){u(e.element().dom(),Cv(Ov))},sliderBehaviours:e})},name:"SaturationBrightnessPalette",configFields:[],apis:{setRgba:function(t,n,e){var o,r;o=e,r=n.components()[0].element().dom(),u(r,Cv(o))}},extraApis:{}})},Qw=function(f,d){return Of({name:"ColourPicker",configFields:[zn("dom"),Zn("onValidHex",Z),Zn("onInvalidHex",Z)],factory:function(t){var a,v,n,e,o,r=Jw(f,d,t.onValidHex,t.onInvalidHex),i=$w(0,d),b={paletteRgba:ce(Ov)},u=Ug(i.sketch({})),c=Ug(r.sketch({})),s=function(t,e){u.getOpt(t).each(function(t){var n=Sv(e);b.paletteRgba.set(n),i.setRgba(t,n)})},l=function(t,n){c.getOpt(t).each(function(t){r.updateHex(t,n)})},y=function(n,e,t){it(t,function(t){t(n,e)})};return{uid:t.uid,dom:t.dom,components:[u.asSpec(),(n=d,e=Lw.parts().spectrum({dom:{tag:"div",classes:[n("hue-slider-spectrum")],attributes:{role:"presentation"}}}),o=Lw.parts().thumb({dom:{tag:"div",classes:[n("hue-slider-thumb")],attributes:{role:"presentation"}}}),Lw.sketch({dom:{tag:"div",classes:[n("hue-slider")],attributes:{role:"presentation"}},rounded:!1,model:{mode:"y",getInitialValue:at({y:at(0)})},components:[e,o],sliderBehaviours:za([Xm.config({})]),onChange:function(t,n,e){jo(t,ux,{value:e})}})),c.asSpec()],behaviours:za([Lm("colour-picker-events",[Jo(ax,(v=[l],function(t,n){var e,o,r,i,u,a,c,s,l,f=n.event().value(),d=b.paletteRgba.get(),m=(i=r=0,u=(e=d).red/255,a=e.green/255,c=e.blue/255,s=Math.min(u,Math.min(a,c)),l=Math.max(u,Math.max(a,c)),s===l?rx(0,0,100*(i=s)):(r=60*((r=u===s?3:c===s?1:5)-(u===s?a-c:c===s?u-a:c-u)/(l-s)),o=(l-s)/l,i=l,rx(Math.round(r),Math.round(100*o),Math.round(100*i)))),g=rx(m.hue,f.x(),100-f.y()),p=wv(g),h=mv(p);y(t,h,v)})),Jo(ux,(a=[s,l],function(t,n){var e,o,r,i=n.event().value(),u=(e=i.y(),o=rx((100-e)/100*360,100,100),r=wv(o),mv(r));y(t,u,a)}))]),Mf.config({find:function(t){return c.getOpt(t)}}),Rm.config({mode:"acyclic"})])}}})},Zw=function(){return Mf.config({find:st.some})},tS=function(t){return Mf.config({find:t.getOpt})},nS=function(t){return Mf.config({find:function(n){return mr(n.element(),t).bind(function(t){return n.getSystem().getByDom(t).toOption()})}})},eS={"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"},oS=function(t){return eS[t]},rS=tinymce.util.Tools.resolve("tinymce.Resource"),iS=ln([Zn("preprocess",ct),Zn("postprocess",ct)]),uS=function(t,n,e){return bl.config(Ct({store:{mode:"manual",getValue:n,setValue:e}},t.map(function(t){return{store:{initialValue:t}}}).getOr({})))},aS=function(t,n,e){return uS(t,function(t){return n(t.element())},function(t,n){return e(t.element(),n)})},cS=function(r,t){var i=_n("RepresentingConfigs.memento processors",iS,t);return bl.config({store:{mode:"manual",getValue:function(t){var n=r.get(t),e=bl.getValue(n);return i.postprocess(e)},setValue:function(t,n){var e=i.preprocess(n),o=r.get(t);bl.setValue(o,e)}}})},sS=uS,lS=function(t){return aS(t,Sr,kr)},fS=function(t){return bl.config({store:{mode:"memory",initialValue:t}})},dS=function(r,n){var e=function(t,n){n.stop()},o=function(t){return function(n,e){it(t,function(t){t(n,e)})}},i=function(t,n){if(!ph.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;bl.setValue(t,(e=n,o=new RegExp("("+".jpg,.jpeg,.png,.gif".split(/\s*,\s*/).join("|")+")$","i"),P($(e),function(t){return o.test(t.name)}))),jo(t,Gb,{name:r.name})},c=Ug({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:za([Lm("input-file-events",[nr(fo()),nr(So())])])}),t=r.label.map(function(t){return Iy(t,n)}),s=ey.parts().field({factory:{sketch:function(t){return{uid:t.uid,dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:za([fS([]),Zw(),ph.config({}),rg.config({toggleClass:"dragenter",toggleOnExecute:!1}),Lm("dropzone-events",[Jo("dragenter",o([e,rg.toggle])),Jo("dragleave",o([e,rg.toggle])),Jo("dragover",e),Jo("drop",o([e,i])),Jo(lo(),u)])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p",innerHtml:n.translate("Drop an image here")}},jg.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:za([Dy.config({}),Gh(n.isReadOnly),Uh()])})]}]}}}});return My(t,s,["tox-form__group--stretched"],[])},mS=Nr("alloy-fake-before-tabstop"),gS=Nr("alloy-fake-after-tabstop"),pS=function(t){return{dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:t},behaviours:za([Xm.config({ignore:!0}),Dy.config({})])}},hS=function(t){return{dom:{tag:"div",classes:["tox-navobj"]},components:[pS([mS]),t,pS([gS])],behaviours:za([nS(1)])}},vS=function(t,n){jo(t,ao(),{raw:{which:9,shiftKey:n}})},bS=function(t,n){var e=n.element();wi(e,mS)?vS(t,!0):wi(e,gS)&&vS(t,!1)},yS=function(t){return Sb(t,["."+mS,"."+gS].join(","),at(!1))},xS=!(Pe().browser.isIE()||Pe().browser.isEdge()),wS=function(t,n){var o,r,e=xS&&t.sandboxed,i=et(et({},t.label.map(function(t){return{title:t}}).getOr({})),e?{sandbox:"allow-scripts allow-same-origin"}:{}),u=(o=e,r=ce(""),{getValue:function(t){return r.get()},setValue:function(t,n){if(o)Br(t.element(),"srcdoc",n);else{Br(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 Iy(t,n)}),c=ey.parts().field({factory:{sketch:function(t){return hS({uid:t.uid,dom:{tag:"iframe",attributes:i},behaviours:za([Dy.config({}),Xm.config({}),sS(st.none(),u.getValue,u.setValue)])})}}});return My(a,c,["tox-form__group--stretched"],[])};function SS(t,n){return OS(nt.document.createElement("canvas"),t,n)}function kS(t){var n=SS(t.width,t.height);return CS(n).drawImage(t,0,0),n}function CS(t){return t.getContext("2d")}function OS(t,n,e){return t.width=n,t.height=e,t}function _S(t){return t.naturalWidth||t.width}function TS(t){return t.naturalHeight||t.height}var ES,BS,DS,MS=window.Promise?window.Promise:(BS=(ES=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=[],PS(t,AS(IS,this),AS(RS,this))}).immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(t){nt.setTimeout(t,1)},DS=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},ES.prototype["catch"]=function(t){return this.then(null,t)},ES.prototype.then=function(e,o){var r=this;return new ES(function(t,n){FS.call(r,new HS(e,o,t,n))})},ES.all=function(){for(var t=[],n=0;n").css({position:"absolute",top:0,left:0,width:o.width,height:o.height,zIndex:2147483647,opacity:1e-4,cursor:e}).appendTo(d.body),oC(d).on("mousemove touchmove",c).on("mouseup touchend",a),r.start(t)},c=function(t){if(cC(t),t.button!==u)return a(t);t.deltaX=t.screenX-l,t.deltaY=t.screenY-f,t.preventDefault(),r.drag(t)},a=function(t){cC(t),oC(d).off("mousemove touchmove",c).off("mouseup touchend",a),i.remove(),r.stop&&r.stop(t)},this.destroy=function(){oC(m).off()},oC(m).on("mousedown touchstart",n)}var lC=0,fC=function(s,e,l,o,r){var f,n,i,u="tox-",a="tox-crid-"+lC++,c=[{name:"move",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:0,deltaH:0,label:"Crop Mask"},{name:"nw",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:-1,deltaH:-1,label:"Top Left Crop Handle"},{name:"ne",xMul:1,yMul:0,deltaX:0,deltaY:1,deltaW:1,deltaH:-1,label:"Top Right Crop Handle"},{name:"sw",xMul:0,yMul:1,deltaX:1,deltaY:0,deltaW:-1,deltaH:1,label:"Bottom Left Crop Handle"},{name:"se",xMul:1,yMul:1,deltaX:0,deltaY:0,deltaW:1,deltaH:1,label:"Bottom Right Crop Handle"}];i=["top","right","bottom","left"];var d=function(t,n){return{x:n.x+t.x,y:n.y+t.y,w:n.w,h:n.h}},m=function(t,n){return{x:n.x-t.x,y:n.y-t.y,w:n.w,h:n.h}};function g(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=rC.clamp({x:r,y:i,w:u,h:a},l,"move"===t.name),c=m(l,c),f.fire("updateRect",{rect:c}),v(c)}function p(n){function t(t,n){n.h<0&&(n.h=0),n.w<0&&(n.w=0),oC("#"+a+"-"+t,o).css({left:n.x,top:n.y,width:n.w,height:n.h})}uC.each(c,function(t){oC("#"+a+"-"+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 h(t){p(s=t)}function v(t){h(d(l,t))}return function b(){oC('
').appendTo(o),uC.each(i,function(t){oC("#"+a,o).append('