/** * 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.0.12 (2019-07-18) */ !function(v){"use strict";var y=function(){return(y=Object.assign||function(n){for(var e,t=1,r=arguments.length;t "+r.toString()},function(n,e){return"state("+n+")"})}).join("\n")+"}"},toDsl:function(){return Qt.objOf(kn(c,function(n){return n.fold(function(n,e,t,r){return Zt.field(n,t,r)},function(n,e){return Zt.state(n)})}))}}},lr=function(t,i){var u=function(n,e){return(o=ar(t),{extract:function(t,r,n){var e=kn(n,function(n,e){return o.extract(t.concat(["["+e+"]"]),r,n)});return Jt(e)},toString:function(){return"array("+o.toString()+")"},toDsl:function(){return Qt.arrOf(o)}}).extract(n,b,e);var o};return{extract:function(t,r,o){var n=E(o),e=u(t,n);return Wt(e,function(n){var e=kn(n,function(n){return or.field(n,n,xt(),i)});return sr(e).extract(t,r,o)})},toString:function(){return"setOf("+i.toString()+")"},toDsl:function(){return Qt.setOf(t,i)}}},dr=h(ar(Gt)),mr=or.state,gr=or.field,pr=function(t,e,r,o,i){return It(o,i).fold(function(){return n=o,e=i,rr(t,function(){return'The chosen schema: "'+e+'" did not exist in branches: '+tr(n)});var n,e},function(n){return sr(n).extract(t.concat(["branch: "+i]),e,r)})},vr=function(o,i){return{extract:function(e,t,r){return It(r,o).fold(function(){return n=o,rr(e,function(){return'Choice schema did not contain choice key: "'+n+'"'});var n},function(n){return pr(e,t,r,i,n)})},toString:function(){return"chooseOn("+o+"). Possible values: "+E(i)},toDsl:function(){return Qt.choiceOf(o,i)}}},hr=ar(Gt),br=function(e){return ar(function(n){return e(n).fold(Ut,Gt)})},yr=function(e,n){return lr(function(n){return Pt(e(n))},n)},xr=function(n,e,t){return Lt((r=n,o=b,i=t,u=e.extract([r],o,i),qt(u,function(n){return{input:i,errors:n}})));var r,o,i,u},wr=function(n){return n.fold(function(n){throw new Error(Or(n))},b)},Sr=function(n,e,t){return wr(xr(n,e,t))},Or=function(n){return"Errors: \n"+(e=n.errors,t=10 ")+")\n"+n.getErrorInfo()}))+"\n\nInput object: "+tr(n.input);var e,t},Tr=function(n,e){return vr(n,e)},kr=h(hr),Er=(Vt=yn,Nt="function",ar(function(n){var e=typeof n;return Vt(n)?Gt(n):Ut("Expected type: "+Nt+" but got: "+e)})),Cr=function(n){return gr(n,n,xt(),dr())},Dr=function(n,e){return gr(n,n,xt(),e)},Mr=function(n,e){return gr(n,n,xt(),sr(e))},Ir=function(n){return gr(n,n,wt(),dr())},Rr=function(n,e){return gr(n,n,wt(),e)},Br=function(n,e){return Rr(n,sr(e))},Ar=function(n,e){return Rr(n,fr(e))},Fr=function(n,e){return gr(n,n,yt(e),dr())},Vr=function(n,e,t){return gr(n,n,yt(e),t)},Nr=function(n,e){return mr(n,e)},jr=function(n,e){return We(n.element(),e.event().target())},Hr=function(n){if(!Ft(n,"can")&&!Ft(n,"abort")&&!Ft(n,"run"))throw new Error("EventHandler defined by: "+er(n,null,2)+" does not have can, abort, or run!");return Sr("Extracting event.handler",fr([Fr("can",h(!0)),Fr("abort",h(!1)),Fr("run",x)]),n)},zr=function(t){var e,r,o,i,n=(e=t,r=function(n){return n.can},function(){for(var t=[],n=0;n"}),kr()),$a=Nr("schema",function(){return[Ir("preprocess")]}),Ua=Fr("defaults",h({})),Wa=Fr("overrides",h({})),_a=sr([za,Pa,La,Ga,Ua,Wa]),Xa=sr([za,Pa,La,Ga,Ua,Wa]),qa=sr([za,$a,La,Cr("unit"),Ga,Ua,Wa]),Ya=function(n){var e=function(n){return n.name};return n.fold(e,e,e,e)},Ka=function(t,r){return function(n){var e=Sr("Converting part type",r,n);return t(e)}},Ja=Ka(Ha.required,_a),Qa=Ka(Ha.optional,Xa),Za=Ka(Ha.group,qa),nf=h("entirety"),ef=function(n,e,t,r){return vt(e.defaults(n,t,r),t,{uid:n.partUids[e.name]},e.overrides(n,t,r))},tf=function(o,n){var i={};return En(n,function(n){var e;(e=n,e.fold(k.some,k.none,k.some,k.some)).each(function(t){var r=rf(o,t.pname);i[t.name]=function(n){var e=Sr("Part: "+t.name+" in "+o,sr(t.schema),n);return y({},r,{config:n,validated:e})}})}),i},rf=function(n,e){return{uiType:Va(),owner:n,name:e}},of=function(n,e,t){return r=e,i={},o={},En(t,function(n){n.fold(function(r){i[r.pname]=Aa(!0,function(n,e,t){return r.factory.sketch(ef(n,r,e,t))})},function(n){var e=r.parts[n.name];o[n.name]=h(n.factory.sketch(ef(r,n,e[nf()]),e))},function(r){i[r.pname]=Aa(!1,function(n,e,t){return r.factory.sketch(ef(n,r,e,t))})},function(o){i[o.pname]=Fa(!0,function(e,n,t){var r=e[o.name];return kn(r,function(n){return o.factory.sketch(vt(o.defaults(e,n,t),n,o.overrides(e,n)))})})})}),{internals:h(i),externals:h(o)};var r,i,o},uf=function(n,e,t){return Ba(k.some(n),e,e.components,t)},cf=function(n,e,t){var r=e.partUids[t];return n.getSystem().getByUid(r).toOption()},af=function(n,e,t){return cf(n,e,t).getOrDie("Could not find part: "+t)},ff=function(e,n){var t=kn(n,Ya);return Bt(kn(t,function(n){return{key:n,value:e+"-"+n}}))},sf=function(e){return gr("partUids","partUids",Ot(function(n){return ff(n.uid,e)}),kr())},lf=ja("alloy-premade"),df=function(n){return Rt(lf,n)},mf=function(r){return n=function(n){for(var e=[],t=1;t')},function(n){return Rf(''+n+"")})},Vf=function(n,e,t,r){return Df.sketch({dom:Ff(n,r),action:e,buttonBehaviours:vt(po([Mf.config({})]),t)})},Nf={forToolbar:Vf,forToolbarCommand:function(n,e){return Vf(e,function(){n.execCommand(e)},{},n)},forToolbarStateAction:function(n,e,t,r){var o=Af(t);return Vf(e,r,o,n)},forToolbarStateCommand:function(n,e){var t=Af(e);return Vf(e,function(){n.execCommand(e)},t,n)},getToolbarIconButton:Ff},jf=Yn.detect().deviceType.isTouch(),Hf=Qa({schema:[Cr("dom")],name:"label"}),zf=function(n){return Qa({name:n+"-edge",overrides:function(r){return r.model.manager.edgeActions[n].fold(function(){return{}},function(t){var n=qr([Jr(A(),t,[r])]),e=qr([Jr(N(),t,[r]),Jr(j(),function(n,e){e.mouseIsDown.get()&&t(n,e)},[r])]);return{events:jf?n:e}})}})},Pf=zf("top-left"),Lf=zf("top"),Gf=zf("top-right"),$f=zf("right"),Uf=zf("bottom-right"),Wf=zf("bottom"),_f=zf("bottom-left"),Xf=[Hf,zf("left"),$f,Lf,Wf,Pf,Gf,_f,Uf,Ja({name:"thumb",defaults:h({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:qr([Zr(A(),n,"spectrum"),Zr(F(),n,"spectrum"),Zr(V(),n,"spectrum"),Zr(N(),n,"spectrum"),Zr(j(),n,"spectrum"),Zr(H(),n,"spectrum")])}}}),Ja({schema:[Nr("mouseIsDown",function(){return Ho(!1)})],name:"spectrum",overrides:function(t){var r=t.model.manager,o=function(e,n){return r.getValueFromEvent(n).map(function(n){return r.setValueFrom(e,t,n)})},n=qr([Kr(A(),o),Kr(F(),o)]),e=qr([Kr(N(),o),Kr(j(),function(n,e){t.mouseIsDown.get()&&o(n,e)})]);return{behaviours:po(jf?[]:[Sa.config({mode:"special",onLeft:function(n){return r.onLeft(n,t)},onRight:function(n){return r.onRight(n,t)},onUp:function(n){return r.onUp(n,t)},onDown:function(n){return r.onDown(n,t)}}),$i.config({})]),events:jf?n:e}}})],qf=function(n,e,t){e.store.manager.onLoad(n,e,t)},Yf=function(n,e,t){e.store.manager.onUnload(n,e,t)},Kf=/* */Object.freeze({onLoad:qf,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}}),Jf=/* */Object.freeze({events:function(t,r){var n=t.resetOnDom?[eo(function(n,e){qf(n,t,r)}),to(function(n,e){Yf(n,t,r)})]:[ao(t,r,qf)];return qr(n)}}),Qf=function(){var n=Ho(null);return go({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()}}})},Zf=function(){var i=Ho({}),u=Ho({});return go({readState:function(){return{mode:"dataset",dataByValue:i.get(),dataByText:u.get()}},lookup:function(n){return It(i.get(),n).orThunk(function(){return It(u.get(),n)})},update:function(n){var e=i.get(),t=u.get(),r={},o={};En(n,function(e){r[e.value]=e,It(e,"meta").each(function(n){It(n,"text").each(function(n){o[n]=e})})}),i.set(y({},e,r)),u.set(y({},t,o))},clear:function(){i.set({}),u.set({})}})},ns=/* */Object.freeze({memory:Qf,dataset:Zf,manual:function(){return go({readState:function(){}})},init:function(n){return n.store.manager.state(n)}}),es=function(n,e,t,r){var o=e.store;t.update([r]),o.setValue(n,r),e.onSetValue(n,r)},ts=[Ir("initialValue"),Cr("getFallbackEntry"),Cr("getDataKey"),Cr("setValue"),hi("manager",{setValue:es,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){es(e,t,r,n)})},onUnload:function(n,e,t){t.clear()},state:Zf})],rs=[Cr("getValue"),Fr("setValue",x),Ir("initialValue"),hi("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:x,state:mo.init})],os=[Ir("initialValue"),hi("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:Qf})],is=[Vr("store",{mode:"memory"},Tr("mode",{memory:os,manual:rs,dataset:ts})),mi("onSetValue"),Fr("resetOnDom",!1)],us=ho({fields:is,name:"representing",active:Jf,apis:Kf,extra:{setValueFrom:function(n,e){var t=us.getValue(e);us.setValue(n,t)}},state:ns}),cs=Zi("width",function(n){return n.dom().offsetWidth}),as=function(n,e){cs.set(n,e)},fs=function(n){return cs.get(n)},ss=function(t,r){return{left:h(t),top:h(r),translate:function(n,e){return ss(t+n,r+e)}}},ls=ss,ds=Yn.detect().deviceType.isTouch(),ms=h("slider.change.value"),gs=function(n){var e=n.event().raw();if(ds){var t=e;return t.touches!==undefined&&1===t.touches.length?k.some(t.touches[0]).map(function(n){return ls(n.clientX,n.clientY)}):k.none()}var r=e;return r.clientX!==undefined?k.some(r).map(function(n){return ls(n.clientX,n.clientY)}):k.none()},ps=function(n){return n.model.minX},vs=function(n){return n.model.minY},hs=function(n){return n.model.minX-1},bs=function(n){return n.model.minY-1},ys=function(n){return n.model.maxX},xs=function(n){return n.model.maxY},ws=function(n){return n.model.maxX+1},Ss=function(n){return n.model.maxY+1},Os=function(n,e,t){return e(n)-t(n)},Ts=function(n){return Os(n,ys,ps)},ks=function(n){return Os(n,xs,vs)},Es=function(n){return Ts(n)/2},Cs=function(n){return ks(n)/2},Ds=function(n){return n.stepSize},Ms=function(n){return n.snapToGrid},Is=function(n){return n.snapStart},Rs=function(n){return n.rounded},Bs=function(n,e){return n[e+"-edge"]!==undefined},As=function(n){return Bs(n,"left")},Fs=function(n){return Bs(n,"right")},Vs=function(n){return Bs(n,"top")},Ns=function(n){return Bs(n,"bottom")},js=function(n){return n.model.value.get()},Hs=function(n){return{x:h(n)}},zs=function(n){return{y:h(n)}},Ps=function(n,e){return{x:h(n),y:h(e)}},Ls=function(n,e){me(n,ms(),{value:e})},Gs=function(n,e,t,r){return n'),components:[zl.parts()["left-edge"](Bf('
')),zl.parts().spectrum({dom:Rf('
'),components:[Bf('
')],behaviours:po([Ai.config({toggleClass:Hi.resolve("thumb-active")})])}),zl.parts()["right-edge"](Bf('
')),zl.parts().thumb({dom:Rf('
'),behaviours:po([Ai.config({toggleClass:Hi.resolve("thumb-active")})])})],onChange:function(n,e,t){var r=i(t.x());_i(e.element(),"background-color",r),o.onChange(n,e,r)},onDragStart:function(n,e){Ai.on(e)},onDragEnd:function(n,e){Ai.off(e)},onInit:function(n,e,t,r){var o=i(r.x());_i(e.element(),"background-color",o)},stepSize:10,model:{mode:"x",minX:0,maxX:360,getInitialValue:function(){return{x:function(){return o.getInitialValue()}}}},sliderBehaviours:po([Vi(zl.refresh)])}))];var o,i},Gl=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 Pl(n,"color-levels",function(){return Ll(e)},r)},$l=fr([Cr("getInitialValue"),Cr("onChange"),Cr("category"),Cr("sizes")]),Ul=function(n){var i=Sr("SizeSlider",$l,n);return zl.sketch({dom:{tag:"div",classes:[Hi.resolve("slider-"+i.category+"-size-container"),Hi.resolve("slider"),Hi.resolve("slider-size-container")]},onChange:function(n,e,t){var r,o=t.x();0<=(r=o)&&r'),components:[Bf('
')]}),zl.parts().thumb({dom:Rf('
'),behaviours:po([Ai.config({toggleClass:Hi.resolve("thumb-active")})])})]})},Wl=["9px","10px","11px","12px","14px","16px","18px","20px","24px","32px","36px"],_l=function(n){var e,t,r=n.selection.getStart(),o=be.fromDom(r),i=be.fromDom(n.getBody()),u=(e=function(n){return We(i,n)},(Te(t=o)?k.some(t):Xe(t)).map(function(n){return Wr(n,function(n){return Ki(n,"font-size").isSome()},e).bind(function(n){return Ki(n,"font-size")}).getOrThunk(function(){return qi(n,"font-size")})}).getOr(""));return In(Wl,function(n){return u===n}).getOr("medium")},Xl={candidates:h(Wl),get:function(n){var e,t=_l(n);return(e=t,Rn(Wl,function(n){return n===e})).getOr(2)},apply:function(r,n){var e;(e=n,k.from(Wl[e])).each(function(n){var e,t;t=n,_l(e=r)!==t&&e.execCommand("fontSize",!1,t)})}},ql=Xl.candidates(),Yl=function(n){return[Bf(''),(e=n,Ul({onChange:e.onChange,sizes:ql,category:"font",getInitialValue:e.getInitialValue})),Bf('')];var e},Kl=function(n){var e=function t(n){return n.uid!==undefined}(n)&&Ft(n,"uid")?n.uid:xf("memento");return{get:function(n){return n.getSystem().getByUid(e).getOrDie()},getOpt:function(n){return n.getSystem().getByUid(e).fold(k.none,k.some)},asSpec:function(){return y({},n,{uid:e})}}};var Jl=window.Promise?window.Promise:function(){var i=function(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],s(n,r(o,this),r(c,this))},n=i.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(n){v.setTimeout(n,1)};function r(n,e){return function(){return n.apply(e,arguments)}}var t=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)};function u(r){var o=this;null!==this._state?n(function(){var n=o._state?r.onFulfilled:r.onRejected;if(null!==n){var e;try{e=n(o._value)}catch(t){return void r.reject(t)}r.resolve(e)}else(o._state?r.resolve:r.reject)(o._value)}):this._deferreds.push(r)}function o(n){try{if(n===this)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if("function"==typeof e)return void s(r(e,n),r(o,this),r(c,this))}this._state=!0,this._value=n,a.call(this)}catch(t){c.call(this,t)}}function c(n){this._state=!1,this._value=n,a.call(this)}function a(){for(var n=0,e=this._deferreds;n'),action:function(n){var e=t.get(n);us.setValue(e,"")}}));return{name:n,spec:vd.sketch({dom:Rf('
'),components:[t.asSpec(),r.asSpec()],containerBehaviours:po([Ai.config({toggleClass:Hi.resolve("input-container-empty")}),pd.config({find:function(n){return k.some(t.get(n))}}),dd("input-clearing",[Kr(G(),function(n){var e=t.get(n);(0"},Ud=function(o,n,e){return{uid:o.uid,dom:o.dom,components:n,behaviours:ka(o.formBehaviours,[us.config({store:{mode:"manual",getValue:function(n){var e,t,r=(e=o,t=n.getSystem(),M(e.partUids,function(n,e){return h(t.getByUid(n))}));return M(r,function(n,e){return n().bind(function(n){var e,t=pd.getCurrent(n);return e="missing current",t.fold(function(){return dt.error(e)},dt.value)}).map(us.getValue)})},setValue:function(t,n){D(n,function(e,n){cf(t,o,n).each(function(n){pd.getCurrent(n).each(function(n){us.setValue(n,e)})})})}}})]),apis:{getField:function(n,e){return cf(n,o,e).bind(pd.getCurrent)}}}},Wd=(mf(function(n,e,t){return n.getField(e,t)}),function(n){var i,e=(i=[],{field:function(n,e){return i.push(n),t="form",r=$d(n),o=e,{uiType:Va(),owner:t,name:r,config:o,validated:{}};var t,r,o},record:function(){return i}}),t=n(e),r=e.record(),o=kn(r,function(n){return Ja({name:n,pname:$d(n)})});return Sf("form",Gd,o,Ud,t)}),_d=function(){var e=Ho(k.none()),t=function(){e.get().each(function(n){n.destroy()})};return{clear:function(){t(),e.set(k.none())},isSet:function(){return e.get().isSome()},set:function(n){t(),e.set(k.some(n))},run:function(n){e.get().each(n)}}},Xd=function(){var e=Ho(k.none());return{clear:function(){e.set(k.none())},set:function(n){e.set(k.some(n))},isSet:function(){return e.get().isSome()},on:function(n){e.get().each(n)}}},qd=function(n){return{xValue:n,points:[]}},Yd=function(n,e){if(e===n.xValue)return n;var t=0'),action:function(n){me(n,r,{direction:e})},buttonBehaviours:po([Ld.config({disableClass:Hi.resolve("toolbar-navigation-disabled"),disabled:!t})])})},i=function(n,o){var i=uu(n.element(),"."+Hi.resolve("serialised-dialog-screen"));fu(n.element(),"."+Hi.resolve("serialised-dialog-chain")).each(function(r){0<=u.state.currentScreen.get()+o&&u.state.currentScreen.get()+o'),components:[vd.sketch({dom:Rf('
'),components:kn(u.fields,function(n,e){return e<=u.maxFieldIndex?vd.sketch({dom:Rf('
'),components:[o(-1,"previous",0'),behaviours:po([Au.config({highlightClass:Hi.resolve("dot-active"),itemClass:Hi.resolve("dot-item")})]),components:Vn(u.fields,function(n,e){return e<=u.maxFieldIndex?[Bf('
')]:[]})});return{dom:Rf('
'),components:[a.asSpec(),f.asSpec()],behaviours:po([Sa.config({mode:"special",focusIn:function(n){var e=a.get(n);Sa.focusIn(e)}}),dd("serializer-wrapper-events",[Kr(A(),function(n,e){var t=e.event();u.state.dialogSwipeState.set(qd(t.raw().touches[0].clientX))}),Kr(F(),function(n,e){var t=e.event();u.state.dialogSwipeState.on(function(n){e.event().prevent(),u.state.dialogSwipeState.set(Yd(n,t.raw().touches[0].clientX))})}),Kr(V(),function(r){u.state.dialogSwipeState.on(function(n){var e=a.get(r),t=-1*Kd(n);i(e,t)})})])])}},Qd=X(function(t,r){return[{label:"the link group",items:[Jd({fields:[Cd("url","Type or paste URL"),Cd("text","Link text"),Cd("title","Link title"),Cd("target","Link target"),(n="link",{name:n,spec:hd.sketch({dom:{tag:"span",styles:{display:"none"}},getInitialValue:function(){return k.none()}})})],maxFieldIndex:["url","text","title","target"].length-1,getInitialValue:function(){return k.some(ad.getInfo(r))},onExecute:function(n){var e=us.getValue(n);ad.applyInfo(r,e),t.restoreToolbar(),r.focus()}})]}];var n}),Zd=[{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:"strikethrough",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:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],nm=qr([(Zl=Jn(),nd=function(n,e){var t,r,o=e.event().originator(),i=e.event().target();return r=i,!(We(t=o,n.element())&&!We(t,r))||(v.console.warn(Jn()+" did not get interpreted by the desired target. \nOriginator: "+Jo(o)+"\nTarget: "+Jo(i)+"\nCheck the "+Jn()+" event handlers"),!1)},{key:Zl,value:Hr({can:nd})})]),em=/* */Object.freeze({events:nm}),tm=b,rm=function(e){var n=function(n){return function(){throw new Error("The component must be in a context to send: "+n+"\n"+Jo(e().element())+" is not in context.")}};return{debugInfo:h("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:h(!1)}},om=rm(),im=function(n,o){var i={};return D(n,function(n,r){D(n,function(n,e){var t=Mt(e,[])(i);i[e]=t.concat([o(r,n)])})}),i},um=function(n,e){return t=l.apply(undefined,[n.handler].concat(e)),r=n.purpose(),{cHandler:t,purpose:h(r)};var t,r},cm=function(n){return n.cHandler},am=function(n,e){return{name:h(n),handler:h(e)}},fm=function(n,e,t){var r,o,i=y({},t,(r=n,o={},En(e,function(n){o[n.name()]=n.handlers(r)}),o));return im(i,am)},sm=function(n){var e,i=yn(e=n)?{can:h(!0),abort:h(!1),run:e}:e;return function(n,e){for(var t=[],r=2;r "):r[0].name();return Rt(o,{handler:e,purpose:h(t)})})});return At(e,{})},mm=function(n){return xr("custom.definition",sr([gr("dom","dom",xt(),sr([Cr("tag"),Fr("styles",{}),Fr("classes",[]),Fr("attributes",{}),Ir("value"),Ir("innerHtml")])),Cr("components"),Cr("uid"),Fr("events",{}),Fr("apis",{}),gr("eventOrder","eventOrder",(e={"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"]},bt.mergeWithThunk(h(e))),kr()),Ir("domModification")]),n);var e},gm=function(e,n){En(n,function(n){Io(e,n)})},pm=function(e,n){En(n,function(n){Bo(e,n)})},vm=function(n,e){return t=n,o=kn(r=e,function(n){return Br(n.name(),[Cr("config"),Fr("state",mo)])}),i=xr("component.behaviours",sr(o),t.behaviours).fold(function(n){throw new Error(Or(n)+"\nComplete spec:\n"+er(t,null,2))},function(n){return n}),{list:r,data:M(i,function(n){var e=n.map(function(n){return{config:n.config,state:n.state.init(n.config)}});return function(){return e}})};var t,r,o,i},hm=function(n){var e,t,r,o=(e=n,t=Mt("behaviours",{})(e),r=Cn(E(t),function(n){return t[n]!==undefined}),kn(r,function(n){return t[n].me}));return vm(n,o)},bm=function(n,e,t){var r,o,i,u=y({},(r=n).dom,{uid:r.uid,domChildren:kn(r.components,function(n){return n.element()})}),c=n.domModification.fold(function(){return co({})},co),a={"alloy.base.modification":c},f=0");r[t[0]]=Rt(t[1],n),r[t[1]]=Rt(t[0],n)}),r},createBistate:function(n,e,t){return Bt([{key:n,value:Rt(e,t)},{key:e,value:Rt(n,t)}])},createTristate:function(n,e,t,r){return Bt([{key:n,value:Bt([{key:e,value:r},{key:t,value:r}])},{key:e,value:Bt([{key:n,value:r},{key:t,value:r}])},{key:t,value:Bt([{key:n,value:r},{key:e,value:r}])}])}}}),cg=Hi.resolve("scrollable"),ag={register:function(n){Io(n,cg)},deregister:function(n){Bo(n,cg)},scrollable:h(cg)},fg=function(n){return It(n,"format").getOr(n.title)},sg=function(n,e,t,r,o){return{data:{value:n,text:e},type:"item",dom:{tag:"div",classes:o?[Hi.resolve("styles-item-is-menu")]:[]},toggling:{toggleOnExecute:!1,toggleClass:Hi.resolve("format-matches"),selected:t},itemBehaviours:po(o?[]:[Fi(n,function(n,e){(e?Ai.on:Ai.off)(n)})]),components:[{dom:{tag:"div",attributes:{style:r},innerHtml:e}}]}},lg=function(n,e,t,r){return{value:n,dom:{tag:"div"},components:[Df.sketch({dom:{tag:"div",classes:[Hi.resolve("styles-collapser")]},components:r?[{dom:{tag:"span",classes:[Hi.resolve("styles-collapse-icon")]}},Sm(n)]:[Sm(n)],action:function(n){if(r){var e=t().get(n);Jm.collapseMenu(e)}}}),{dom:{tag:"div",classes:[Hi.resolve("styles-menu-items-container")]},components:[Lm.parts().items({})],behaviours:po([dd("adhoc-scrollable-menu",[eo(function(n,e){_i(n.element(),"overflow-y","auto"),_i(n.element(),"-webkit-overflow-scrolling","touch"),ag.register(n.element())}),to(function(n){Ji(n.element(),"overflow-y"),Ji(n.element(),"-webkit-overflow-scrolling"),ag.deregister(n.element())})])])}],items:e,menuBehaviours:po([ug.config({initialState:"after",routes:ug.createTristate("before","current","after",{transition:{property:"transform",transitionClass:"transitioning"}})})])}},dg=function(r){var o,i,n,e,t,u=(o=r.formats,i=function(){return c},n=lg("Styles",[].concat(kn(o.items,function(n){return sg(fg(n),n.title,n.isSelected(),n.getPreview(),Ft(o.expansions,fg(n)))})),i,!1),e=M(o.menus,function(n,e){var t=kn(n,function(n){return sg(fg(n),n.title,n.isSelected!==undefined&&n.isSelected(),n.getPreview!==undefined?n.getPreview():"",Ft(o.expansions,fg(n)))});return lg(e,t,i,!0)}),t=vt(e,Rt("styles",n)),{tmenu:Jm.tieredData("styles",t,o.expansions)}),c=Kl(Jm.sketch({dom:{tag:"div",classes:[Hi.resolve("styles-menu")]},components:[],fakeFocus:!0,stayInDom:!0,onExecute:function(n,e){var t=us.getValue(e);return r.handle(e,t.value),k.none()},onEscape:function(){return k.none()},onOpenMenu:function(n,e){var t=fs(n.element());as(e.element(),t),ug.jumpTo(e,"current")},onOpenSubmenu:function(n,e,t){var r=fs(n.element()),o=au(e.element(),'[role="menu"]').getOrDie("hacky"),i=n.getSystem().getByDom(o).getOrDie();as(t.element(),r),ug.progressTo(i,"before"),ug.jumpTo(t,"after"),ug.progressTo(t,"current")},onCollapseMenu:function(n,e,t){var r=au(e.element(),'[role="menu"]').getOrDie("hacky"),o=n.getSystem().getByDom(r).getOrDie();ug.progressTo(o,"after"),ug.progressTo(t,"current")},navigateOnHover:!1,highlightImmediately:!0,data:u.tmenu,markers:{backgroundMenu:Hi.resolve("styles-background-menu"),menu:Hi.resolve("styles-menu"),selectedMenu:Hi.resolve("styles-selected-menu"),item:Hi.resolve("styles-item"),selectedItem:Hi.resolve("styles-selected-item")}}));return c.asSpec()},mg=function(n){return Ft(n,"items")?(t=vt(Ct(e=n,["items"]),{menu:!0}),r=gg(e.items),{item:t,menus:vt(r.menus,Rt(e.title,r.items)),expansions:vt(r.expansions,Rt(e.title,e.title))}):{item:n,menus:{},expansions:{}};var e,t,r},gg=function(n){return Dn(n,function(n,e){var t=mg(e);return{menus:vt(n.menus,t.menus),items:[t.item].concat(n.items),expansions:vt(n.expansions,t.expansions)}},{menus:{},expansions:{},items:[]})},pg={expand:gg},vg=function(u,n){var c=function(n){return function(){return u.formatter.match(n)}},a=function(n){return function(){return u.formatter.getCssText(n)}},e=It(n,"style_formats").getOr(Zd),f=function(n){return kn(n,function(n){if(Ft(n,"items")){var e=f(n.items);return vt(vt(n,{isSelected:h(!1),getPreview:h("")}),{items:e})}return Ft(n,"format")?vt(i=n,{isSelected:c(i.format),getPreview:a(i.format)}):(r=ja((t=n).title),o=vt(t,{format:r,isSelected:c(r),getPreview:a(r)}),u.formatter.register(r,o),o);var t,r,o,i})};return f(e)},hg=function(t,n,r){var e,o,i,u=(e=t,i=(o=function(n){return Vn(n,function(n){return n.items===undefined?!Ft(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===Hg?[]:[Dg(be.fromDom(r.win()),"blur",function(){t.getByDom(e).each(Ai.off)}),Dg(i,"select",n),Dg(r.doc(),"selectionchange",n)]);return{destroy:function(){En(c,function(n){n.unbind()})}}},Pg=function(n,e){var t=parseInt(Oo(n,e),10);return isNaN(t)?0:t};var Lg,Gg=function Jh(t,r){var o=function(n){return t(n)?k.from(n.dom().nodeValue):k.none()},n=Yn.detect().browser,e=n.isIE()&&10===n.version.major?function(n){try{return o(n)}catch(e){return k.none()}}:o;return{get:function(n){if(!t(n))throw new Error("Can only get "+r+" value of a "+r+" node");return e(n).getOr("")},getOption:e,set:function(n,e){if(!t(n))throw new Error("Can only set raw "+r+" value of a "+r+" node");n.dom().nodeValue=e}}}(ke,"text"),$g=function(n){return Gg.getOption(n)},Ug=["img","br"],Wg=function(n){return $g(n).filter(function(n){return 0!==n.trim().length||-1=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom},op=function(t,r,n,e,o){var i,u=function(n){var e=t.dom().createRange();return e.setStart(r.dom(),n),e.collapse(!0),e},c=(i=r,Gg.get(i)).length,a=function(n,e,t,r,o){if(0===o)return 0;if(e===r)return o-1;for(var i=r,u=1;ue.innerHeight||t.bottom()>e.innerHeight?Math.min(r,t.bottom()-e.innerHeight+50):0);0!==o&&u.scrollTo(u.pageXOffset,u.pageYOffset+o)})}),Mp(e,n.innerHeight)});Mp(e,n.innerHeight);return{toEditing:function(){Cp(u)},destroy:function(){t.unbind()}}},Ap=function(n){return k.some(be.fromDom(n.dom().contentWindow.document.body))},Fp=function(n){return k.some(be.fromDom(n.dom().contentWindow.document))},Vp=function(n){return k.from(n.dom().contentWindow)},Np=function(n){return Vp(n).bind(wp)},jp=function(n){return n.getFrame()},Hp=function(n,t){return function(e){return e[n].getOrThunk(function(){var n=jp(e);return function(){return t(n)}})()}},zp=function(n,e,t,r){return n[t].getOrThunk(function(){return function(n){return Dg(e,r,n)}})},Pp=function(n){return{left:h(n.left),top:h(n.top),right:h(n.right),bottom:h(n.bottom),width:h(n.width),height:h(n.height)}},Lp={getBody:Hp("getBody",Ap),getDoc:Hp("getDoc",Fp),getWin:Hp("getWin",Vp),getSelection:Hp("getSelection",Np),getFrame:jp,getActiveApi:function(c){var a=jp(c);return Ap(a).bind(function(u){return Fp(a).bind(function(i){return Vp(a).map(function(o){var n=be.fromDom(i.dom().documentElement),e=c.getCursorBox.getOrThunk(function(){return function(){return(n=o,wp(n).map(function(n){return Kg.exact(n.start(),n.soffset(),n.finish(),n.foffset())})).bind(function(n){return Sp(o,n).orThunk(function(){return wp(o).filter(function(n){return We(n.start(),n.finish())&&n.soffset()===n.foffset()}).bind(function(n){var e=n.start().dom().getBoundingClientRect();return 0