/** * 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.2.1 (2020-03-25) */ !function(l){"use strict";var x=function(){return(x=Object.assign||function(n){for(var e,t=1,r=arguments.length;t "+r.toString()},function(n,e){return"state("+n+")"})}).join("\n")+"}"}}},Kr=b(It(Rr)),Jr=qr.state,Qr=qr.field,Zr=It(Rr),no=function(n){return"Errors: \n"+function(n){var e=10 ")+")\n"+n.getErrorInfo()})}(n.errors).join("\n")+"\n\nInput object: "+Et(n.input)},eo=b(Zr),to=(_r=ee,Mr="function",It(function(n){var e=typeof n;return _r(n)?Rr(n):Vr("Expected type: "+Mr+" but got: "+e)})),ro=function(n,e,t){return e(n).orThunk(function(){return t(n)?On.none():function(n,e,t){for(var r=n.dom(),o=ee(t)?t:b(!1);r.parentNode;){r=r.parentNode;var i=$e.fromDom(r),u=e(i);if(u.isSome())return u;if(o(i))break}return On.none()}(n,e,t)})},oo=ir(je()),io=ir(He()),uo=ir(Ne()),co=(Ir=Fe(),function(n){return rr(Ir,n)}),ao=function(n){return ue(n,function(n){return function(n,e){return function(n,e,t){return""===e||!(n.length"}),eo()),Ga=Jt("schema",function(){return[$t("preprocess")]}),Ua=Yt("defaults",b({})),$a=Yt("overrides",b({})),Wa=Yr([Ha,Pa,za,La,Ua,$a]),Xa=Yr([Ha,Pa,za,Ua,$a]),qa=Yr([Ha,Pa,za,La,Ua,$a]),Ya=Yr([Ha,Ga,za,Lt("unit"),La,Ua,$a]),Ka=gc(ja.required,Wa),Ja=(gc(ja.external,Xa),gc(ja.optional,qa)),Qa=gc(ja.group,Ya),Za=b("entirety"),nf=function(n,e){return{uiType:Va(),owner:n,name:e}},ef=dc("alloy-premade"),tf=b("alloy-id-"),rf=b("data-alloy-id"),of=tf(),uf=rf(),cf=function(n,e){Object.defineProperty(n.dom(),uf,{value:e,writable:!0})},af=function(n){var e=Ye(n)?n.dom()[uf]:null;return On.from(e)},ff=function(n){return function(n){return In(n,"uid")}(n)?n:x(x({},n),{uid:kc("uid")})};function sf(n){var e=Pt("Sketcher for "+n.name,Bs,n),t=S(e.apis,Oc),r=S(e.extraApis,function(n,e){return ar(n,e)});return x(x({name:b(e.name),configFields:b(e.configFields),sketch:function(n){return function(n,e,t,r){var o=ff(r);return t(Ec(n,e,o,[],[]),o)}(e.name,e.configFields,e.factory,n)}},t),r)}function lf(n){var e=Pt("Sketcher for "+n.name,Vs,n),t=hc(e.name,e.partFields),r=S(e.apis,Oc),o=S(e.extraApis,function(n,e){return ar(n,e)});return x(x({name:b(e.name),partFields:b(e.partFields),configFields:b(e.configFields),sketch:function(n){return Cc(e.name,e.configFields,e.partFields,e.factory,n)},parts:b(t)},r),o)}function df(n){var e=$e.fromHtml(n),t=tt(e),r=function(n){var e=n.dom().attributes!==undefined?n.dom().attributes:[];return M(e,function(n,e){var t;return"class"===e.name?n:x(x({},n),((t={})[e.name]=e.value,t))},{})}(e),o=function(n){return Array.prototype.slice.call(n.dom().classList,0)}(e),i=0===t.length?{}:{innerHtml:Eo(e)};return x({tag:Y(e),classes:o,attributes:r},i)}function mf(n){return{dom:Hs(n)}}function gf(n){return mo([ki.config({toggleClass:Mi.resolve("toolbar-button-selected"),toggleOnExecute:!1,aria:{mode:"pressed"}}),Ei(n,function(n,e){(e?ki.on:ki.off)(n)})])}function pf(n,e){var t=e.ui.registry.getAll().icons;return On.from(t[n]).fold(function(){return Hs('')},function(n){return Hs(''+n+"")})}function hf(e){return Ja({name:e+"-edge",overrides:function(n){return n.model.manager.edgeActions[e].fold(function(){return{}},function(r){return{events:er([or(ge(),function(n,e,t){return r(n,t)},[n]),or(ve(),function(n,e,t){return r(n,t)},[n]),or(ye(),function(n,e,t){t.mouseIsDown.get()&&r(n,t)},[n])])}})}})}function vf(n,e,t){e.store.manager.onLoad(n,e,t)}function yf(n,e,t){e.store.manager.onUnload(n,e,t)}function bf(){var n=An(null);return lo({set:n.set,get:n.get,isNotSet:function(){return null===n.get()},clear:function(){n.set(null)},readState:function(){return{mode:"memory",value:n.get()}}})}function xf(){var i=An({}),u=An({});return lo({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(n){return Mn(i.get(),n).orThunk(function(){return Mn(u.get(),n)})},update:function(n){var e=i.get(),t=u.get(),r={},o={};C(n,function(e){r[e.value]=e,Mn(e,"meta").each(function(n){Mn(n,"text").each(function(n){o[n]=e})})}),i.set(x(x({},e),r)),u.set(x(x({},t),o))},clear:function(){i.set({}),u.set({})}})}function wf(n,e,t,r){var o=e.store;t.update([r]),o.setValue(n,r),e.onSetValue(n,r)}function Sf(n,e){il.set(n,e)}function Tf(n){return il.get(n)}function Of(n){var e=n.event().raw();if(function(n){return-1!==n.type.indexOf("touch")}(e)){var t=e;return t.touches!==undefined&&1===t.touches.length?On.some(t.touches[0]).map(function(n){return cl(n.clientX,n.clientY)}):On.none()}var r=e;return r.clientX!==undefined?On.some(r).map(function(n){return cl(n.clientX,n.clientY)}):On.none()}function kf(n){return n.model.minX}function Ef(n){return n.model.minY}function Cf(n){return n.model.minX-1}function Df(n){return n.model.minY-1}function _f(n){return n.model.maxX}function Mf(n){return n.model.maxY}function If(n){return n.model.maxX+1}function Af(n){return n.model.maxY+1}function Ff(n,e,t){return e(n)-t(n)}function Rf(n){return Ff(n,_f,kf)}function Bf(n){return Ff(n,Mf,Ef)}function Vf(n){return Rf(n)/2}function Nf(n){return Bf(n)/2}function jf(n){return n.stepSize}function Hf(n){return n.snapToGrid}function Pf(n){return n.snapStart}function zf(n){return n.rounded}function Lf(n,e){return n[e+"-edge"]!==undefined}function Gf(n){return Lf(n,"left")}function Uf(n){return Lf(n,"right")}function $f(n){return Lf(n,"top")}function Wf(n){return Lf(n,"bottom")}function Xf(n){return n.model.value.get()}function qf(n){return{x:b(n)}}function Yf(n){return{y:b(n)}}function Kf(n,e){return{x:b(n),y:b(e)}}function Jf(n,e){$(n,al(),{value:e})}function Qf(n,e,t,r){return n'),components:[Ml.parts()["left-edge"](mf('
')),Ml.parts().spectrum({dom:Hs('
'),components:[mf('
')],behaviours:mo([ki.config({toggleClass:Mi.resolve("thumb-active")})])}),Ml.parts()["right-edge"](mf('
')),Ml.parts().thumb({dom:Hs('
'),behaviours:mo([ki.config({toggleClass:Mi.resolve("thumb-active")})])})],onChange:function(n,e,t){var r=i(t.x());Bi(e.element(),"background-color",r),o.onChange(n,e,r)},onDragStart:function(n,e){ki.on(e)},onDragEnd:function(n,e){ki.off(e)},onInit:function(n,e,t,r){var o=i(r.x());Bi(e.element(),"background-color",o)},stepSize:10,model:{mode:"x",minX:0,maxX:360,getInitialValue:function(){return{x:function(){return o.getInitialValue()}}}},sliderBehaviours:mo([Ci(Ml.refresh)])})}(n)]}function _s(e,n){return(Ye(n)?On.some(n):sn(n).filter(Ye)).map(function(n){return function(n,e,t){return xo(function(n,e){return e(n)},wo,n,e,t)}(n,function(n){return ui(n,"font-size").isSome()},e).bind(function(n){return ui(n,"font-size")}).getOrThunk(function(){return ii(n,"font-size")})}).getOr("")}function Ms(n){var e=n.selection.getStart(),t=$e.fromDom(e),r=$e.fromDom(n.getBody()),o=_s(function(n){return an(r,n)},t);return I(Rl,function(n){return o===n}).getOr("medium")}function Is(n){return[mf(''),function(n){return Fl({onChange:n.onChange,sizes:Vl,category:"font",getInitialValue:n.getInitialValue})}(n),mf('')]}function As(n){var e=function t(n){return n.uid!==undefined}(n)&&v(n,"uid")?n.uid:kc("memento");return{get:function(n){return n.getSystem().getByUid(e).getOrDie()},getOpt:function(n){return n.getSystem().getByUid(e).toOption()},asSpec:function(){return x(x({},n),{uid:e})}}}var Fs,Rs,Bs=At([Lt("name"),Lt("factory"),Lt("configFields"),Yt("apis",{}),Yt("extraApis",{})]),Vs=At([Lt("name"),Lt("factory"),Lt("configFields"),Lt("partFields"),Yt("apis",{}),Yt("extraApis",{})]),Ns=sf({name:"Button",factory:function(n){function t(e){return Mn(n.dom,"attributes").bind(function(n){return Mn(n,e)})}var e=function(n){return er(F([n.map(function(t){return co(function(n,e){t(n),e.stop()})}).toArray(),ni()]))}(n.action),r=n.dom.tag;return{uid:n.uid,dom:n.dom,components:n.components,events:e,behaviours:Ma(n.buttonBehaviours,[Ri.config({}),Da.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:function(){if("button"!==r)return{role:t("role").getOr("button")};var n=t("type").getOr("button"),e=t("role").map(function(n){return{role:n}}).getOr({});return x({type:n},e)}()},eventOrder:n.eventOrder}},configFields:[Yt("uid",undefined),Lt("dom"),Yt("components",[]),_a("buttonBehaviours",[Ri,Da]),$t("action"),$t("role"),Yt("eventOrder",{})]}),js=mr({fields:[],name:"unselecting",active:/* */Object.freeze({__proto__:null,events:function(){return er([tr(Ce(),b(!0))])},exhibit:function(){return fr({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}})}),Hs=function(n){var e=function(n,r){return n.replace(/\$\{([^{}]*)\}/g,function(n,e){var t=r[e];return function(n){var e=typeof n;return"string"==e||"number"==e}(t)?t.toString():n})}(n,{prefix:Mi.prefix()});return df(e)},Ps=function(n,e,t,r){return Ns.sketch({dom:pf(n,r),action:e,buttonBehaviours:gt(mo([js.config({})]),t)})},zs={forToolbar:Ps,forToolbarCommand:function(n,e){return Ps(e,function(){n.execCommand(e)},{},n)},forToolbarStateAction:function(n,e,t,r){var o=gf(t);return Ps(e,r,o,n)},forToolbarStateCommand:function(n,e){var t=gf(e);return Ps(e,function(){n.execCommand(e)},t,n)},getToolbarIconButton:pf},Ls=Ja({schema:[Lt("dom")],name:"label"}),Gs=hf("top-left"),Us=hf("top"),$s=hf("top-right"),Ws=hf("right"),Xs=hf("bottom-right"),qs=hf("bottom"),Ys=hf("bottom-left"),Ks=[Ls,hf("left"),Ws,Us,qs,Gs,$s,Ys,Xs,Ka({name:"thumb",defaults:b({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:er([ur(ge(),n,"spectrum"),ur(pe(),n,"spectrum"),ur(he(),n,"spectrum"),ur(ve(),n,"spectrum"),ur(ye(),n,"spectrum"),ur(be(),n,"spectrum")])}}}),Ka({schema:[Jt("mouseIsDown",function(){return An(!1)})],name:"spectrum",overrides:function(t){function r(e,n){return o.getValueFromEvent(n).map(function(n){return o.setValueFrom(e,t,n)})}var o=t.model.manager;return{behaviours:mo([Da.config({mode:"special",onLeft:function(n){return o.onLeft(n,t)},onRight:function(n){return o.onRight(n,t)},onUp:function(n){return o.onUp(n,t)},onDown:function(n){return o.onDown(n,t)}}),Ri.config({})]),events:er([rr(ge(),r),rr(pe(),r),rr(ve(),r),rr(ye(),function(n,e){t.mouseIsDown.get()&&r(n,e)})])}}})],Js=/* */Object.freeze({__proto__:null,onLoad:vf,onUnload:yf,setValue:function(n,e,t,r){e.store.manager.setValue(n,e,t,r)},getValue:function(n,e,t){return e.store.manager.getValue(n,e,t)},getState:function(n,e,t){return t}}),Qs=/* */Object.freeze({__proto__:null,events:function(t,r){var n=t.resetOnDom?[oo(function(n,e){vf(n,t,r)}),io(function(n,e){yf(n,t,r)})]:[sr(t,r,vf)];return er(n)}}),Zs=/* */Object.freeze({__proto__:null,memory:bf,dataset:xf,manual:function(){return lo({readState:function(){}})},init:function(n){return n.store.manager.state(n)}}),nl=[$t("initialValue"),Lt("getFallbackEntry"),Lt("getDataKey"),Lt("setValue"),Wo("manager",{setValue:wf,getValue:function(n,e,t){var r=e.store,o=r.getDataKey(n);return t.lookup(o).fold(function(){return r.getFallbackEntry(o)},function(n){return n})},onLoad:function(e,t,r){t.store.initialValue.each(function(n){wf(e,t,r,n)})},onUnload:function(n,e,t){t.clear()},state:xf})],el=[Lt("getValue"),Yt("setValue",w),$t("initialValue"),Wo("manager",{setValue:function(n,e,t,r){e.store.setValue(n,r),e.onSetValue(n,r)},getValue:function(n,e,t){return e.store.getValue(n)},onLoad:function(e,t,n){t.store.initialValue.each(function(n){t.store.setValue(e,n)})},onUnload:w,state:so.init})],tl=[$t("initialValue"),Wo("manager",{setValue:function(n,e,t,r){t.set(r),e.onSetValue(n,r)},getValue:function(n,e,t){return t.get()},onLoad:function(n,e,t){e.store.initialValue.each(function(n){t.isNotSet()&&t.set(n)})},onUnload:function(n,e,t){t.clear()},state:bf})],rl=[Kt("store",{mode:"memory"},zt("mode",{memory:tl,manual:el,dataset:nl})),Lo("onSetValue"),Yt("resetOnDom",!1)],ol=mr({fields:rl,name:"representing",active:Qs,apis:Js,extra:{setValueFrom:function(n,e){var t=ol.getValue(e);ol.setValue(n,t)}},state:Zs}),il=Ni("width",function(n){return n.dom().offsetWidth}),ul=function(t,r){return{left:b(t),top:b(r),translate:function(n,e){return ul(t+n,r+e)}}},cl=ul,al=b("slider.change.value"),fl="left",sl=vs(-1),ll=vs(1),dl=On.none,ml=On.none,gl={"top-left":On.none(),top:On.none(),"top-right":On.none(),right:On.some(function(n,e){Jf(n,qf(If(e)))}),"bottom-right":On.none(),bottom:On.none(),"bottom-left":On.none(),left:On.some(function(n,e){Jf(n,qf(Cf(e)))})},pl=/* */Object.freeze({__proto__:null,setValueFrom:function(n,e,t){var r=hs(n,e,t),o=ps(r);return gs(n,o),r},setToMin:function(n,e){var t=kf(e);gs(n,ps(t))},setToMax:function(n,e){var t=_f(e);gs(n,ps(t))},findValueOfOffset:hs,getValueFromEvent:function(n){return Of(n).map(function(n){return n.left()})},findPositionOfValue:ys,setPositionFromValue:function(n,e,t,r){var o=Xf(t),i=ys(n,r.getSpectrum(n),o.x(),r.getLeftEdge(n),r.getRightEdge(n),t),u=Tf(e.element())/2;Bi(e.element(),"left",i-u+"px")},onLeft:sl,onRight:ll,onUp:dl,onDown:ml,edgeActions:gl}),hl=On.none,vl=On.none,yl=Ss(-1),bl=Ss(1),xl={"top-left":On.none(),top:On.some(function(n,e){Jf(n,Yf(Df(e)))}),"top-right":On.none(),right:On.none(),"bottom-right":On.none(),bottom:On.some(function(n,e){Jf(n,Yf(Af(e)))}),"bottom-left":On.none(),left:On.none()},wl=/* */Object.freeze({__proto__:null,setValueFrom:function(n,e,t){var r=ws(n,e,t),o=xs(r);return bs(n,o),r},setToMin:function(n,e){var t=Ef(e);bs(n,xs(t))},setToMax:function(n,e){var t=Mf(e);bs(n,xs(t))},findValueOfOffset:ws,getValueFromEvent:function(n){return Of(n).map(function(n){return n.top()})},findPositionOfValue:Ts,setPositionFromValue:function(n,e,t,r){var o=Xf(t),i=Ts(n,r.getSpectrum(n),o.y(),r.getTopEdge(n),r.getBottomEdge(n),t),u=ji(e.element())/2;Bi(e.element(),"top",i-u+"px")},onLeft:hl,onRight:vl,onUp:yl,onDown:bl,edgeActions:xl}),Sl=Es(-1,!1),Tl=Es(1,!1),Ol=Es(-1,!0),kl=Es(1,!0),El={"top-left":On.some(function(n,e){Jf(n,Kf(Cf(e),Df(e)))}),top:On.some(function(n,e){Jf(n,Kf(Vf(e),Df(e)))}),"top-right":On.some(function(n,e){Jf(n,Kf(If(e),Df(e)))}),right:On.some(function(n,e){Jf(n,Kf(If(e),Nf(e)))}),"bottom-right":On.some(function(n,e){Jf(n,Kf(If(e),Af(e)))}),bottom:On.some(function(n,e){Jf(n,Kf(Vf(e),Af(e)))}),"bottom-left":On.some(function(n,e){Jf(n,Kf(Cf(e),Af(e)))}),left:On.some(function(n,e){Jf(n,Kf(Cf(e),Nf(e)))})},Cl=/* */Object.freeze({__proto__:null,setValueFrom:function(n,e,t){var r=hs(n,e,t.left()),o=ws(n,e,t.top()),i=ks(r,o);return Os(n,i),i},setToMin:function(n,e){var t=kf(e),r=Ef(e);Os(n,ks(t,r))},setToMax:function(n,e){var t=_f(e),r=Mf(e);Os(n,ks(t,r))},getValueFromEvent:function(n){return Of(n)},setPositionFromValue:function(n,e,t,r){var o=Xf(t),i=ys(n,r.getSpectrum(n),o.x(),r.getLeftEdge(n),r.getRightEdge(n),t),u=Ts(n,r.getSpectrum(n),o.y(),r.getTopEdge(n),r.getBottomEdge(n),t),c=Tf(e.element())/2,a=ji(e.element())/2;Bi(e.element(),"left",i-c+"px"),Bi(e.element(),"top",u-a+"px")},onLeft:Sl,onRight:Tl,onUp:Ol,onDown:kl,edgeActions:El}),Dl=[Yt("stepSize",1),Yt("onChange",w),Yt("onChoose",w),Yt("onInit",w),Yt("onDragStart",w),Yt("onDragEnd",w),Yt("snapToGrid",!1),Yt("rounded",!0),$t("snapStart"),Gt("model",zt("mode",{x:[Yt("minX",0),Yt("maxX",100),Jt("value",function(n){return An(n.mode.minX)}),Lt("getInitialValue"),Wo("manager",pl)],y:[Yt("minY",0),Yt("maxY",100),Jt("value",function(n){return An(n.mode.minY)}),Lt("getInitialValue"),Wo("manager",wl)],xy:[Yt("minX",0),Yt("maxX",100),Yt("minY",0),Yt("maxY",100),Jt("value",function(n){return An({x:b(n.mode.minX),y:b(n.mode.minY)})}),Lt("getInitialValue"),Wo("manager",Cl)]})),uc("sliderBehaviours",[Da,ol]),Jt("mouseIsDown",function(){return An(!1)})],_l=b("mouse.released"),Ml=lf({name:"Slider",configFields:Dl,partFields:Ks,factory:function(i,n,e,t){function u(n){return xc(n,i,"thumb")}function c(n){return xc(n,i,"spectrum")}function r(n){return bc(n,i,"left-edge")}function o(n){return bc(n,i,"right-edge")}function a(n){return bc(n,i,"top-edge")}function f(n){return bc(n,i,"bottom-edge")}function s(n,e){v.setPositionFromValue(n,e,i,{getLeftEdge:r,getRightEdge:o,getTopEdge:a,getBottomEdge:f,getSpectrum:c})}function l(n,e){h.value.set(e);var t=u(n);return s(n,t),i.onChange(n,t,e),On.some(!0)}function d(t){var n=i.mouseIsDown.get();i.mouseIsDown.set(!1),n&&bc(t,i,"thumb").each(function(n){var e=h.value.get();i.onChoose(t,n,e)})}function m(n,e){e.stop(),i.mouseIsDown.set(!0),i.onDragStart(n,u(n))}function g(n,e){e.stop(),i.onDragEnd(n,u(n)),d(n)}var p,h=i.model,v=h.manager;return{uid:i.uid,dom:i.dom,components:n,behaviours:ac(i.sliderBehaviours,[Da.config({mode:"special",focusIn:function(n){return bc(n,i,"spectrum").map(Da.focusIn).map(b(!0))}}),ol.config({store:{mode:"manual",getValue:function(n){return h.value.get()}}}),bi.config({channels:(p={},p[_l()]={onReceive:d},p)})]),events:er([rr(al(),function(n,e){l(n,e.event().value())}),oo(function(n,e){var t=h.getInitialValue();h.value.set(t);var r=u(n);s(n,r);var o=c(n);i.onInit(n,r,o,h.value.get())}),rr(ge(),m),rr(he(),g),rr(ve(),m),rr(be(),g)]),apis:{resetToMin:function(n){v.setToMin(n,i)},resetToMax:function(n){v.setToMax(n,i)},changeValue:l,refresh:s},domModification:{styles:{position:"relative"}}}},apis:{resetToMin:function(n,e){n.resetToMin(e)},resetToMax:function(n,e){n.resetToMax(e)},refresh:function(n,e){n.refresh(e)}}}),Il=function(n,r){var e={onChange:function(n,e,t){r.undoManager.transact(function(){r.formatter.apply("forecolor",{value:t}),r.nodeChanged()})},getInitialValue:function(){return-1}};return Cs(n,"color-levels",function(){return Ds(e)},r)},Al=At([Lt("getInitialValue"),Lt("onChange"),Lt("category"),Lt("sizes")]),Fl=function(n){var o=Pt("SizeSlider",Al,n);return Ml.sketch({dom:{tag:"div",classes:[Mi.resolve("slider-"+o.category+"-size-container"),Mi.resolve("slider"),Mi.resolve("slider-size-container")]},onChange:function(n,e,t){var r=t.x();!function(n){return 0<=n&&n'),components:[mf('
')]}),Ml.parts().thumb({dom:Hs('
'),behaviours:mo([ki.config({toggleClass:Mi.resolve("thumb-active")})])})]})},Rl=["9px","10px","11px","12px","14px","16px","18px","20px","24px","32px","36px"],Bl={candidates:b(Rl),get:function(n){return function(e){return A(Rl,function(n){return n===e})}(Ms(n)).getOr(2)},apply:function(e,n){(function(n){return On.from(Rl[n])})(n).each(function(n){!function(n,e){Ms(n)!==e&&n.execCommand("fontSize",!1,e)}(e,n)})}},Vl=Bl.candidates(),Nl=window.Promise?window.Promise:(Fs=jl.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(n){l.setTimeout(n,1)},Rs=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)},jl.prototype["catch"]=function(n){return this.then(null,n)},jl.prototype.then=function(t,r){var o=this;return new jl(function(n,e){Pl.call(o,new Ul(t,r,n,e))})},jl.all=function(){for(var n=[],e=0;e'),action:function(n){var e=t.get(n);ol.setValue(e,"")}}));return{name:n,spec:fm.sketch({dom:Hs('
'),components:[t.asSpec(),r.asSpec()],containerBehaviours:mo([ki.config({toggleClass:Mi.resolve("input-container-empty")}),am.config({find:function(n){return On.some(t.get(n))}}),im("input-clearing",[rr(Te(),function(n){var e=t.get(n);(0"}function md(){function e(){t.get().each(function(n){n.destroy()})}var t=An(On.none());return{clear:function(){e(),t.set(On.none())},isSet:function(){return t.get().isSome()},set:function(n){e(),t.set(On.some(n))},run:function(n){t.get().each(n)}}}function gd(){var e=An(On.none());return{clear:function(){e.set(On.none())},set:function(n){e.set(On.some(n))},isSet:function(){return e.get().isSome()},on:function(n){e.get().each(n)}}}function pd(n){function r(e,n,t){return Ns.sketch({dom:Hs(''),action:function(n){$(n,u,{direction:e})},buttonBehaviours:mo([Sm.config({disableClass:Mi.resolve("toolbar-navigation-disabled"),disabled:!t})])})}function o(n,o){var i=zi(n.element(),"."+Mi.resolve("serialised-dialog-screen"));Ui(n.element(),"."+Mi.resolve("serialised-dialog-chain")).each(function(r){0<=c.state.currentScreen.get()+o&&c.state.currentScreen.get()+o'),components:[fm.sketch({dom:Hs('
'),components:ue(c.fields,function(n,e){return e<=c.maxFieldIndex?fm.sketch({dom:Hs('
'),components:[r(-1,"previous",0'),behaviours:mo([xu.config({highlightClass:Mi.resolve("dot-active"),itemClass:Mi.resolve("dot-item")})]),components:R(c.fields,function(n,e){return e<=c.maxFieldIndex?[mf('
')]:[]})});return{dom:Hs('
'),components:[a.asSpec(),f.asSpec()],behaviours:mo([Da.config({mode:"special",focusIn:function(n){var e=a.get(n);Da.focusIn(e)}}),im("serializer-wrapper-events",[rr(ge(),function(n,e){var t=e.event();c.state.dialogSwipeState.set(Em(t.raw().touches[0].clientX))}),rr(pe(),function(n,e){var t=e.event();c.state.dialogSwipeState.on(function(n){e.event().prevent(),c.state.dialogSwipeState.set(Cm(n,t.raw().touches[0].clientX))})}),rr(he(),function(r){c.state.dialogSwipeState.on(function(n){var e=a.get(r),t=-1*Dm(n);o(e,t)})})])])}}function hd(e){function n(n){return function(){throw new Error("The component must be in a context to send: "+n+(e?"\n"+Mo(e().element())+" is not in context.":""))}}return{debugInfo:b("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),build:n("build"),addToWorld:n("addToWorld"),removeFromWorld:n("removeFromWorld"),addToGui:n("addToGui"),removeFromGui:n("removeFromGui"),getByUid:n("getByUid"),getByDom:n("getByDom"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),isConnected:b(!1)}}function vd(n,o){var i={};return Cn(n,function(n,r){Cn(n,function(n,e){var t=Mn(i,e).getOr([]);i[e]=t.concat([o(r,n)])})}),i}function yd(u,c,n,a){try{var e=function(n,e){var t=re.call(n,0);return t.sort(e),t}(n,function(n,e){var t=n[c](),r=e[c](),o=a.indexOf(t),i=a.indexOf(r);if(-1===o)throw new Error("The ordering for "+u+" does not have an entry for "+t+".\nOrder specified: "+JSON.stringify(a,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+r+".\nOrder specified: "+JSON.stringify(a,null,2));return o "):r[0].name();return St(o,function(n,e){return{handler:n,purpose:b(e)}}(e,t))})});return Ot(e,{})},Nm=function(n){var e=Pt("external.component",At([Lt("element"),$t("uid")]),n),t=An(hd());e.uid.each(function(n){cf(e.element,n)});var r={getSystem:t.get,config:On.none,hasConfigured:b(!1),connect:function(n){t.set(n)},disconnect:function(){t.set(hd(function(){return r}))},getApis:function(){return{}},element:b(e.element),spec:b(n),readState:b("No state"),syncComponents:w,components:b([]),events:b({})};return Tc(r)},jm=kc,Hm=function(e){return function(n){return Mn(n,ef)}(e).fold(function(){var n=e.hasOwnProperty("uid")?e:x({uid:jm("")},e);return Ad(n).getOrDie()},function(n){return n})},Pm=Tc,zm="alloy.item-hover",Lm="alloy.item-focus",Gm=b(zm),Um=b(Lm),$m=[Lt("data"),Lt("components"),Lt("dom"),Yt("hasSubmenu",!1),$t("toggling"),_a("itemBehaviours",[ki,Ri,Da,ol]),Yt("ignoreFocus",!1),Yt("domModification",{}),Wo("builder",function(n){return{dom:n.dom,domModification:x(x({},n.domModification),{attributes:x(x(x({role:n.toggling.isSome()?"menuitemcheckbox":"menuitem"},n.domModification.attributes),{"aria-haspopup":n.hasSubmenu}),n.hasSubmenu?{"aria-expanded":!1}:{})}),behaviours:Ma(n.itemBehaviours,[n.toggling.fold(ki.revoke,function(n){return ki.config(x({aria:{mode:"checked"}},n))}),Ri.config({ignore:n.ignoreFocus,stopMousedown:n.ignoreFocus,onFocus:function(n){Bd(n)}}),Da.config({mode:"execution"}),ol.config({store:{mode:"memory",initialValue:n.data}}),im("item-type-events",function a(){for(var n=0,e=0,t=arguments.length;e");r[t[0]]=St(t[1],n),r[t[1]]=St(t[0],n)}),r},createBistate:function(n,e,t){return Tt([{key:n,value:St(e,t)},{key:e,value:St(n,t)}])},createTristate:function(n,e,t,r){return Tt([{key:n,value:Tt([{key:e,value:r},{key:t,value:r}])},{key:e,value:Tt([{key:n,value:r},{key:t,value:r}])},{key:t,value:Tt([{key:n,value:r},{key:e,value:r}])}])}}}),mg=Mi.resolve("scrollable"),gg={register:function(n){Or(n,mg)},deregister:function(n){Er(n,mg)},scrollable:b(mg)},pg=function(n,e,t,r,o){return{data:{value:n,text:e},type:"item",dom:{tag:"div",classes:o?[Mi.resolve("styles-item-is-menu")]:[]},toggling:{toggleOnExecute:!1,toggleClass:Mi.resolve("format-matches"),selected:t},itemBehaviours:mo(o?[]:[Ei(n,function(n,e){(e?ki.on:ki.off)(n)})]),components:[{dom:{tag:"div",attributes:{style:r},innerHtml:e}}]}},hg=function(n,e,t,r){return{value:n,dom:{tag:"div"},components:[Ns.sketch({dom:{tag:"div",classes:[Mi.resolve("styles-collapser")]},components:r?[{dom:{tag:"span",classes:[Mi.resolve("styles-collapse-icon")]}},Fd(n)]:[Fd(n)],action:function(n){if(r){var e=t().get(n);ug.collapseMenu(e)}}}),{dom:{tag:"div",classes:[Mi.resolve("styles-menu-items-container")]},components:[Zm.parts().items({})],behaviours:mo([im("adhoc-scrollable-menu",[oo(function(n,e){Bi(n.element(),"overflow-y","auto"),Bi(n.element(),"-webkit-overflow-scrolling","touch"),gg.register(n.element())}),io(function(n){ci(n.element(),"overflow-y"),ci(n.element(),"-webkit-overflow-scrolling"),gg.deregister(n.element())})])])}],items:e,menuBehaviours:mo([dg.config({initialState:"after",routes:dg.createTristate("before","current","after",{transition:{property:"transform",transitionClass:"transitioning"}})})])}},vg=function(r){var n=function(r,o){var n=hg("Styles",[].concat(ue(r.items,function(n){return pg(Ud(n),n.title,n.isSelected(),n.getPreview(),v(r.expansions,Ud(n)))})),o,!1),e=S(r.menus,function(n,e){var t=ue(n,function(n){return pg(Ud(n),n.title,n.isSelected!==undefined&&n.isSelected(),n.getPreview!==undefined?n.getPreview():"",v(r.expansions,Ud(n)))});return hg(e,t,o,!0)}),t=gt(e,St("styles",n));return{tmenu:ug.tieredData("styles",t,r.expansions)}}(r.formats,function(){return e}),e=As(ug.sketch({dom:{tag:"div",classes:[Mi.resolve("styles-menu")]},components:[],fakeFocus:!0,stayInDom:!0,onExecute:function(n,e){var t=ol.getValue(e);return r.handle(e,t.value),On.none()},onEscape:function(){return On.none()},onOpenMenu:function(n,e){var t=Tf(n.element());Sf(e.element(),t),dg.jumpTo(e,"current")},onOpenSubmenu:function(n,e,t){var r=Tf(n.element()),o=Gi(e.element(),'[role="menu"]').getOrDie("hacky"),i=n.getSystem().getByDom(o).getOrDie();Sf(t.element(),r),dg.progressTo(i,"before"),dg.jumpTo(t,"after"),dg.progressTo(t,"current")},onCollapseMenu:function(n,e,t){var r=Gi(e.element(),'[role="menu"]').getOrDie("hacky"),o=n.getSystem().getByDom(r).getOrDie();dg.progressTo(o,"after"),dg.progressTo(t,"current")},navigateOnHover:!1,highlightImmediately:!0,data:n.tmenu,markers:{backgroundMenu:Mi.resolve("styles-background-menu"),menu:Mi.resolve("styles-menu"),selectedMenu:Mi.resolve("styles-selected-menu"),item:Mi.resolve("styles-item"),selectedItem:Mi.resolve("styles-selected-item")}}));return e.asSpec()},yg=function(n){return _(n,function(n,e){var t=$d(e);return{menus:gt(n.menus,t.menus),items:[t.item].concat(n.items),expansions:gt(n.expansions,t.expansions)}},{menus:{},expansions:{},items:[]})},bg={expand:yg},xg=function(r,n){function o(n){return function(){return r.formatter.match(n)}}function i(n){return function(){return r.formatter.getCssText(n)}}var e=Mn(n,"style_formats").getOr(Mm),t=function(n){return ue(n,function(n){if(v(n,"items")){var e=t(n.items);return gt(function(n){return gt(n,{isSelected:b(!1),getPreview:b("")})}(n),{items:e})}return v(n,"format")?function(n){return gt(n,{isSelected:o(n.format),getPreview:i(n.format)})}(n):function(n){var e=dc(n.title),t=gt(n,{format:e,isSelected:o(e),getPreview:i(e)});return r.formatter.register(e,t),t}(n)})};return t(e)},wg=function(t,n,r){var e=function(e,n){var t=function(n){return R(n,function(n){return n.items===undefined?!v(n,"format")||e.formatter.canApply(n.format)?[n]:[]:0e.innerHeight||n.bottom()>e.innerHeight?n.bottom()-e.innerHeight+50:0;0!=t&&e.scrollTo(e.pageXOffset,e.pageYOffset+t)})})].concat(!0==Bg?[]:[Kd($e.fromDom(r.win()),"blur",function(){t.getByDom(e).each(ki.off)}),Kd(u,"select",n),Kd(r.doc(),"selectionchange",n)]);return{destroy:function(){C(c,function(n){n.unbind()})}}},Ng=function(n,e){var t=parseInt(vr(n,e),10);return isNaN(t)?0:t};function jg(n){return"img"===Y(n)?1:function(n){return mp.getOption(n)}(n).fold(function(){return tt(n).length},function(n){return n.length})}function Hg(n,e,t){var r=n.document.createRange();return function(t,n){n.fold(function(n){t.setStartBefore(n.dom())},function(n,e){t.setStart(n.dom(),e)},function(n){t.setStartAfter(n.dom())})}(r,e),function(t,n){n.fold(function(n){t.setEndBefore(n.dom())},function(n,e){t.setEnd(n.dom(),e)},function(n){t.setEndAfter(n.dom())})}(r,t),r}function Pg(n,e,t,r,o){var i=n.document.createRange();return i.setStart(e.dom(),t),i.setEnd(r.dom(),o),i}function zg(n){return{left:b(n.left),top:b(n.top),right:b(n.right),bottom:b(n.bottom),width:b(n.width),height:b(n.height)}}function Lg(n,e,t){return e($e.fromDom(t.startContainer),t.startOffset,$e.fromDom(t.endContainer),t.endOffset)}function Gg(n,e){return function(n,e){var t=e.ltr();return t.collapsed?e.rtl().filter(function(n){return!1===n.collapsed}).map(function(n){return bp.rtl($e.fromDom(n.endContainer),n.endOffset,$e.fromDom(n.startContainer),n.startOffset)}).getOrThunk(function(){return Lg(0,bp.ltr,t)}):Lg(0,bp.ltr,t)}(0,function(o,n){return n.match({domRange:function(n){return{ltr:b(n),rtl:On.none}},relative:function(n,e){return{ltr:q(function(){return Hg(o,n,e)}),rtl:q(function(){return On.some(Hg(o,e,n))})}},exact:function(n,e,t,r){return{ltr:q(function(){return Pg(o,n,e,t,r)}),rtl:q(function(){return On.some(Pg(o,t,r,n,e))})}}})}(n,e))}function Ug(n,e){var t=Y(n);return"input"===t?hp.after(n):k(["br","img"],t)?0===e?hp.before(n):hp.after(n):hp.on(n,e)}function $g(n,e,t,r){var o=function(n,e,t,r){var o=fn(n).dom().createRange();return o.setStart(n.dom(),e),o.setEnd(t.dom(),r),o}(n,e,t,r),i=an(n,t)&&e===r;return o.collapsed&&!i}function Wg(n,e,t,r,o){!function(n,e){On.from(n.getSelection()).each(function(n){n.removeAllRanges(),n.addRange(e)})}(n,Pg(n,e,t,r,o))}function Xg(n,e,t,r,o){!function(u,n){Gg(u,n).match({ltr:function(n,e,t,r){Wg(u,n,e,t,r)},rtl:function(n,e,t,r){var o=u.getSelection();if(o.setBaseAndExtent)o.setBaseAndExtent(n.dom(),e,t.dom(),r);else if(o.extend)try{!function(n,e,t,r,o,i){e.collapse(t.dom(),r),e.extend(o.dom(),i)}(0,o,n,e,t,r)}catch(i){Wg(u,t,r,n,e)}else Wg(u,t,r,n,e)}})}(n,function(n,e,t,r){var o=Ug(n,e),i=Ug(t,r);return yp.relative(o,i)}(e,t,r,o))}function qg(n){var e=$e.fromDom(n.anchorNode),t=$e.fromDom(n.focusNode);return $g(e,n.anchorOffset,t,n.focusOffset)?On.some(gp.create(e,n.anchorOffset,t,n.focusOffset)):function(n){if(0n.innerHeight||e.bottom()>n.innerHeight?Math.min(t,e.bottom()-n.innerHeight+50):0}(r,n,t);0!==e&&r.scrollTo(r.pageXOffset,r.pageYOffset+e)})}),Zg(e,n.innerHeight)});Zg(e,n.innerHeight);return{toEditing:function(){wp(r)},destroy:function(){t.unbind()}}},Op={getBody:cp("getBody",tp),getDoc:cp("getDoc",rp),getWin:cp("getWin",op),getSelection:cp("getSelection",ip),getFrame:up,getActiveApi:function(c){var a=up(c);return tp(a).bind(function(u){return rp(a).bind(function(i){return op(a).map(function(o){var n=$e.fromDom(i.dom().documentElement),e=c.getCursorBox.getOrThunk(function(){return function(){return function(n){return Yg(n).map(function(n){return yp.exact(n.start(),n.soffset(),n.finish(),n.foffset())})}(o).bind(function(n){return Kg(o,n).orThunk(function(){return function(n){return Yg(n).filter(function(n){return an(n.start(),n.finish())&&n.soffset()===n.foffset()}).bind(function(n){var e=n.start().dom().getBoundingClientRect();return 0