/** * 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.7.1 (2021-03-17) */ !function(){"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")+"}"}}},br=function(t,i){var u=function(n,e){return o=hr(t),function(t,r,n){var e=N(n,function(n,e){return o.extract(t.concat(["["+e+"]"]),r,n)});return fr(e)}(n,v,e);var o};return{extract:function(t,r,o){var n=Qe(o),e=u(t,n);return zt(e,function(n){var e=N(n,function(n){return dr.field(n,n,Qt(),i)});return yr(e).extract(t,r,o)})},toString:function(){return"setOf("+i.toString()+")"}}},xr=y(hr(Nt)),wr=dr.state,Sr=dr.field,Or=function(t,e,r,o,i){return it(o,i).fold(function(){return n=o,e=i,lr(t,function(){return'The chosen schema: "'+e+'" did not exist in branches: '+sr(n)});var n,e},function(n){return n.extract(t.concat(["branch: "+i]),e,r)})},Tr=function(o,i){return{extract:function(e,t,r){return it(r,o).fold(function(){return n=o,lr(e,function(){return'Choice schema did not contain choice key: "'+n+'"'});var n},function(n){return Or(e,t,r,i,n)})},toString:function(){return"chooseOn("+o+"). Possible values: "+Qe(i)}}},kr=hr(Nt),Er=function(e){return hr(function(n){return e(n).fold(Ht,Nt)})},Cr=function(e,n){return br(function(n){return At(e(n))},n)},Mr=function(n,e,t){return jt((r=n,o=v,i=t,u=e.extract([r],o,i),$t(u,function(n){return{input:i,errors:n}})));var r,o,i,u},Dr=function(n){return n.fold(function(n){throw new Error(Ir(n))},v)},_r=function(n,e,t){return Dr(Mr(n,e,t))},Ir=function(n){return"Errors: \n"+(e=n.errors,t=10 ")+")\n"+n.getErrorInfo()}).join("\n"))+"\n\nInput object: "+sr(n.input);var e,t},Fr=function(n,e){return Tr(n,et(e,yr))},Rr=y(kr),Vr=(Mt=I,Dt="function",hr(function(n){var e=typeof n;return Mt(n)?Nt(n):Ht("Expected type: "+Dt+" but got: "+e)})),Br=function(n){return Sr(n,n,Qt(),xr())},Ar=function(n,e){return Sr(n,n,Qt(),e)},jr=function(n,e){return Sr(n,n,Qt(),yr(e))},Nr=function(n){return Sr(n,n,Zt(),xr())},Pr=function(n,e){return Sr(n,n,Zt(),e)},Hr=function(n,e){return Pr(n,yr(e))},zr=function(n,e){return Pr(n,vr(e))},Lr=function(n,e){return Sr(n,n,Jt(e),xr())},Gr=function(n,e,t){return Sr(n,n,Jt(e),t)},$r=function(n,e){return wr(n,e)},Ur=[Br("alpha"),Br("omega")],Wr=function(n){return I(n)?n:l},Xr=function(n,e,t){var r=e(n),o=Wr(t);return r.orThunk(function(){return o(n)?T.none():function(n,e,t){for(var r=n.dom,o=Wr(t);r.parentNode;){r=r.parentNode;var i=de.fromDom(r),u=e(i);if(u.isSome())return u;if(o(i))break}return T.none()}(n,e,o)})},qr=function(n,e){return ve(n.element,e.event.target)},Yr=function(n){if(!ct(n,"can")&&!ct(n,"abort")&&!ct(n,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(n,null,2)+" does not have can, abort, or run!");return _r("Extracting event.handler",vr([Lr("can",w),Lr("abort",l),Lr("run",O)]),n)},Kr=function(t){var e,r,o,i,n=(r=function(n){return n.can},function(){for(var t=[],n=0;n=r.length&&t.substr(o,o+r.length)===r?n.substring(0,n.length-"/*".length):n;var e,t,r,o})},so=function(n,e){var t=n.toString(),r=t.indexOf(")")+1,o=t.indexOf("("),i=t.substring(o+1,r-1).split(/,\s*/);return n.toFunctionAnnotation=function(){return{name:e,parameters:fo(i)}},n},lo=function(n){return{classes:n.classes!==undefined?n.classes:[],attributes:n.attributes!==undefined?n.attributes:{},styles:n.styles!==undefined?n.styles:{}}},mo=function(t,r,o){return co(function(n,e){o(n,t,r)})},go=function(o,i,u){var n,e,t,r,c,a;return n=function(t){for(var n=[],e=1;e"}),Rr()),Xa=$r("schema",function(){return[Nr("preprocess")]}),qa=Lr("defaults",y({})),Ya=Lr("overrides",y({})),Ka=yr([Ga,$a,Ua,Wa,qa,Ya]),Ja=yr([Ga,$a,Ua,qa,Ya]),Qa=yr([Ga,$a,Ua,Wa,qa,Ya]),Za=yr([Ga,Xa,Ua,Br("unit"),Wa,qa,Ya]),nf=function(n){var e=function(n){return n.name};return n.fold(e,e,e,e)},ef=function(t,r){return function(n){var e=_r("Converting part type",r,n);return t(e)}},tf=ef(La.required,Ka),rf=(ef(La.external,Ja),ef(La.optional,Qa)),of=ef(La.group,Za),uf=y("entirety"),cf=function(n,e,t,r){return qt(e.defaults(n,t,r),t,{uid:n.partUids[e.name]},e.overrides(n,t,r))},af=function(o,n){var e={};return P(n,function(n){n.fold(T.some,T.none,T.some,T.some).each(function(t){var r=ff(o,t.pname);e[t.name]=function(n){var e=_r("Part: "+t.name+" in "+o,yr(t.schema),n);return x(x({},r),{config:n,validated:e})}})}),e},ff=function(n,e){return{uiType:Pa(),owner:n,name:e}},sf=function(n,e,t){return r=e,i={},o={},P(t,function(n){n.fold(function(r){i[r.pname]=ja(!0,function(n,e,t){return r.factory.sketch(cf(n,r,e,t))})},function(n){var e=r.parts[n.name];o[n.name]=y(n.factory.sketch(cf(r,n,e[uf()]),e))},function(r){i[r.pname]=ja(!1,function(n,e,t){return r.factory.sketch(cf(n,r,e,t))})},function(o){i[o.pname]=Na(!0,function(e,n,t){var r=e[o.name];return N(r,function(n){return o.factory.sketch(qt(o.defaults(e,n,t),n,o.overrides(e,n)))})})})}),{internals:y(i),externals:y(o)};var r,i,o},lf=function(n,e,t){return Aa(T.some(n),e,e.components,t)},df=function(n,e,t){var r=e.partUids[t];return n.getSystem().getByUid(r).toOptional()},mf=function(n,e,t){return df(n,e,t).getOrDie("Could not find part: "+t)},gf=function(e,n){var t=N(n,nf);return ir(N(t,function(n){return{key:n,value:e+"-"+n}}))},pf=function(e){return Sr("partUids","partUids",er(function(n){return gf(n.uid,e)}),Rr())},hf=za("alloy-premade"),vf=function(n){return or(hf,n)},yf=function(r){return n=function(n){for(var e=[],t=1;t')},function(n){return Af(''+n+"")})},zf=function(n,e,t,r){return Rf.sketch({dom:Hf(n,r),action:e,buttonBehaviours:qt(bo([Vf.config({})]),t)})},Lf=rf({schema:[Br("dom")],name:"label"}),Gf=function(e){return rf({name:e+"-edge",overrides:function(n){return n.model.manager.edgeActions[e].fold(function(){return{}},function(r){return{events:Jr([no(_n(),function(n,e,t){return r(n,t)},[n]),no(Rn(),function(n,e,t){return r(n,t)},[n]),no(Vn(),function(n,e,t){t.mouseIsDown.get()&&r(n,t)},[n])])}})}})},$f=Gf("top-left"),Uf=Gf("top"),Wf=Gf("top-right"),Xf=Gf("right"),qf=Gf("bottom-right"),Yf=Gf("bottom"),Kf=Gf("bottom-left"),Jf=[Lf,Gf("left"),Xf,Uf,Yf,$f,Wf,Kf,qf,tf({name:"thumb",defaults:y({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:Jr([ro(_n(),n,"spectrum"),ro(In(),n,"spectrum"),ro(Fn(),n,"spectrum"),ro(Rn(),n,"spectrum"),ro(Vn(),n,"spectrum"),ro(Bn(),n,"spectrum")])}}}),tf({schema:[$r("mouseIsDown",function(){return ko(!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)})};return{behaviours:bo([ka.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:Jr([Zr(_n(),o),Zr(In(),o),Zr(Rn(),o),Zr(Vn(),function(n,e){t.mouseIsDown.get()&&o(n,e)})])}}})],Qf=function(n,e,t){e.store.manager.onLoad(n,e,t)},Zf=function(n,e,t){e.store.manager.onUnload(n,e,t)},ns=/* */Object.freeze({__proto__:null,onLoad:Qf,onUnload:Zf,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}}),es=/* */Object.freeze({__proto__:null,events:function(t,r){var n=t.resetOnDom?[io(function(n,e){Qf(n,t,r)}),uo(function(n,e){Zf(n,t,r)})]:[mo(t,r,Qf)];return Jr(n)}}),ts=function(){var n=ko(null);return yo({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()}}})},rs=function(){var i=ko({}),u=ko({});return yo({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={};P(n,function(e){r[e.value]=e,it(e,"meta").each(function(n){it(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({})}})},os=/* */Object.freeze({__proto__:null,memory:ts,dataset:rs,manual:function(){return yo({readState:O})},init:function(n){return n.store.manager.state(n)}}),is=function(n,e,t,r){var o=e.store;t.update([r]),o.setValue(n,r),e.onSetValue(n,r)},us=[Nr("initialValue"),Br("getFallbackEntry"),Br("getDataKey"),Br("setValue"),ri("manager",{setValue:is,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){is(e,t,r,n)})},onUnload:function(n,e,t){t.clear()},state:rs})],cs=[Br("getValue"),Lr("setValue",O),Nr("initialValue"),ri("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:O,state:vo.init})],as=[Nr("initialValue"),ri("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:ts})],fs=[Gr("store",{mode:"memory"},Fr("mode",{memory:as,manual:cs,dataset:us})),Zo("onSetValue"),Lr("resetOnDom",!1)],ss=wo({fields:fs,name:"representing",active:es,apis:ns,extra:{setValueFrom:function(n,e){var t=ss.getValue(e);ss.setValue(n,t)}},state:os}),ls=Hi("width",function(n){return n.dom.offsetWidth}),ds=function(n,e){return ls.set(n,e)},ms=function(n){return ls.get(n)},gs=function(t,r){return{left:t,top:r,translate:function(n,e){return gs(t+n,r+e)}}},ps=gs,hs=y("slider.change.value"),vs=function(n){var e=n.event.raw;return-1===e.type.indexOf("touch")?e.clientX!==undefined?T.some(e).map(function(n){return ps(n.clientX,n.clientY)}):T.none():e.touches!==undefined&&1===e.touches.length?T.some(e.touches[0]).map(function(n){return ps(n.clientX,n.clientY)}):T.none()},ys=function(n){return n.model.minX},bs=function(n){return n.model.minY},xs=function(n){return n.model.minX-1},ws=function(n){return n.model.minY-1},Ss=function(n){return n.model.maxX},Os=function(n){return n.model.maxY},Ts=function(n){return n.model.maxX+1},ks=function(n){return n.model.maxY+1},Es=function(n,e,t){return e(n)-t(n)},Cs=function(n){return Es(n,Ss,ys)},Ms=function(n){return Es(n,Os,bs)},Ds=function(n){return Cs(n)/2},_s=function(n){return Ms(n)/2},Is=function(n){return n.stepSize},Fs=function(n){return n.snapToGrid},Rs=function(n){return n.snapStart},Vs=function(n){return n.rounded},Bs=function(n,e){return n[e+"-edge"]!==undefined},As=function(n){return Bs(n,"left")},js=function(n){return Bs(n,"right")},Ns=function(n){return Bs(n,"top")},Ps=function(n){return Bs(n,"bottom")},Hs=function(n){return n.model.value.get()},zs=function(n){return{x:n}},Ls=function(n){return{y:n}},Gs=function(n,e){return{x:n,y:e}},$s=function(n,e){ce(n,hs(),{value:e})},Us=function(n,e,t,r){return n'),components:[Ll.parts["left-edge"](jf('
')),Ll.parts.spectrum({dom:Af('
'),components:[jf('
')],behaviours:bo([bi.config({toggleClass:Ti("thumb-active")})])}),Ll.parts["right-edge"](jf('
')),Ll.parts.thumb({dom:Af('
'),behaviours:bo([bi.config({toggleClass:Ti("thumb-active")})])})],onChange:function(n,e,t){var r=i(t.x());Ri(e.element,"background-color",r),o.onChange(n,e,r)},onDragStart:function(n,e){bi.on(e)},onDragEnd:function(n,e){bi.off(e)},onInit:function(n,e,t,r){var o=i(r.x());Ri(e.element,"background-color",o)},stepSize:10,model:{mode:"x",minX:0,maxX:360,getInitialValue:function(){return{x:o.getInitialValue()}}},sliderBehaviours:bo([wi(Ll.refresh)])}))];var o,i},Ul=["9px","10px","11px","12px","14px","16px","18px","20px","24px","32px","36px"],Wl=function(e,n){return(xe(n)?T.some(n):Ee(n).filter(xe)).map(function(n){return Wi(function(n,e){return e(n)},Yi,n,function(n){return ji(n,"font-size").isSome()},e).bind(function(n){return ji(n,"font-size")}).getOrThunk(function(){return Bi(n,"font-size")})}).getOr("")},Xl=function(n){var e=n.selection.getStart(),t=de.fromDom(e),r=de.fromDom(n.getBody()),o=Wl(function(n){return ve(r,n)},t);return G(Ul,function(n){return o===n}).getOr("medium")},ql=function(n){var e,t=Xl(n);return e=t,$(Ul,function(n){return n===e}).getOr(2)},Yl=function(r,n){var e;e=n,T.from(Ul[e]).each(function(n){var e,t;t=n,Xl(e=r)!==t&&e.execCommand("fontSize",!1,t)})},Kl=y(Ul),Jl=vr([Br("getInitialValue"),Br("onChange"),Br("category"),Br("sizes")]),Ql=function(n){var i=_r("SizeSlider",Jl,n);return Ll.sketch({dom:{tag:"div",classes:[Ti("slider-"+i.category+"-size-container"),Ti("slider"),Ti("slider-size-container")]},onChange:function(n,e,t){var r,o=t.x();0<=(r=o)&&r'),components:[jf('
')]}),Ll.parts.thumb({dom:Af('
'),behaviours:bo([bi.config({toggleClass:Ti("thumb-active")})])})]})},Zl=Kl(),nd=function(n){return[jf(''),Ql({onChange:(e=n).onChange,sizes:Zl,category:"font",getInitialValue:e.getInitialValue}),jf('')];var e},ed=function(n){var e=n.uid!==undefined&&ct(n,"uid")?n.uid:kf("memento");return{get:function(n){return n.getSystem().getByUid(e).getOrDie()},getOpt:function(n){return n.getSystem().getByUid(e).toOptional()},asSpec:function(){return x(x({},n),{uid:e})}}},td=window.Promise?window.Promise:(Uu=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=[],Ku(n,qu(od,this),qu(id,this))},Wu=window,Xu=Uu.immediateFn||"function"==typeof Wu.setImmediate&&Wu.setImmediate||function(n){return setTimeout(n,1)},qu=function(t,r){return function(){for(var n=[],e=0;e'),action:function(n){var e=t.get(n);ss.setValue(e,"")}}));return{name:n,spec:Md.sketch({dom:Af('
'),components:[t.asSpec(),r.asSpec()],containerBehaviours:bo([bi.config({toggleClass:Ti("input-container-empty")}),Cd.config({find:function(n){return T.some(t.get(n))}}),Td("input-clearing",[Zr(Pn(),function(n){var e=t.get(n);(0"},tm=function(o,n){return{uid:o.uid,dom:o.dom,components:n,behaviours:Ma(o.formBehaviours,[ss.config({store:{mode:"manual",getValue:function(n){var e,t,r=(e=o,t=n.getSystem(),et(e.partUids,function(n,e){return y(t.getByUid(n))}));return et(r,function(n,o){return n().bind(function(n){var e,t,r=Cd.getCurrent(n);return e=r,t=new Error("Cannot find a current component to extract the value from for form part '"+o+"': "+Ho(n.element)),e.fold(function(){return Ct.error(t)},Ct.value)}).map(ss.getValue)})},setValue:function(t,n){nt(n,function(e,n){df(t,o,n).each(function(n){Cd.getCurrent(n).each(function(n){ss.setValue(n,e)})})})}}})]),apis:{getField:function(n,e){return df(n,o,e).bind(Cd.getCurrent)}}}},rm=(yf(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=em(n),o=e,{uiType:Pa(),owner:t,name:r,config:o,validated:{}};var t,r,o},record:function(){return i}}),t=n(e),r=e.record(),o=N(r,function(n){return tf({name:n,pname:em(n)})});return Cf("form",nm,o,tm,t)}),om=function(){var e=ko(T.none()),t=function(){return e.get().each(function(n){return n.destroy()})};return{clear:function(){t(),e.set(T.none())},isSet:function(){return e.get().isSome()},set:function(n){t(),e.set(T.some(n))},run:function(n){return e.get().each(n)}}},im=function(){var e=ko(T.none());return{clear:function(){return e.set(T.none())},set:function(n){return e.set(T.some(n))},isSet:function(){return e.get().isSome()},on:function(n){return e.get().each(n)}}},um=function(n){var r="navigateEvent",e=yr([Br("fields"),Lr("maxFieldIndex",n.fields.length-1),Br("onExecute"),Br("getInitialValue"),$r("state",function(){return{dialogSwipeState:im(),currentScreen:ko(0)}})]),u=_r("SerialisedDialog",e,n),o=function(e,n,t){return Rf.sketch({dom:Af(''),action:function(n){ce(n,r,{direction:e})},buttonBehaviours:bo([Zd.config({disableClass:Ti("toolbar-navigation-disabled"),disabled:function(){return!t}})])})},i=function(n,o){var i=Ui(n.element,"."+Ti("serialised-dialog-screen"));Qi(n.element,"."+Ti("serialised-dialog-chain")).each(function(r){0<=u.state.currentScreen.get()+o&&u.state.currentScreen.get()+o'),components:[Md.sketch({dom:Af('
'),components:N(u.fields,function(n,e){return e<=u.maxFieldIndex?Md.sketch({dom:Af('
'),components:[o(-1,"previous",0'),behaviours:bo([Fu.config({highlightClass:Ti("dot-active"),itemClass:Ti("dot-item")})]),components:W(u.fields,function(n,e){return e<=u.maxFieldIndex?[jf('
')]:[]})});return{dom:Af('
'),components:[a.asSpec(),f.asSpec()],behaviours:bo([ka.config({mode:"special",focusIn:function(n){var e=a.get(n);ka.focusIn(e)}}),Td("serializer-wrapper-events",[Zr(_n(),function(n,e){var t=e.event;u.state.dialogSwipeState.set({xValue:t.raw.touches[0].clientX,points:[]})}),Zr(In(),function(n,e){var t=e.event;u.state.dialogSwipeState.on(function(n){e.event.prevent(),u.state.dialogSwipeState.set(function(n,e){if(e===n.xValue)return n;var t=0 "):r[0].name;return or(o,{handler:e,purpose:t})})});return ur(e,{})},Sm="alloy.base.behaviour",Om=function(n){var e,t;return Mr("custom.definition",yr([Sr("dom","dom",Qt(),yr([Br("tag"),Lr("styles",{}),Lr("classes",[]),Lr("attributes",{}),Nr("value"),Nr("innerHtml")])),Br("components"),Br("uid"),Lr("events",{}),Lr("apis",{}),Sr("eventOrder","eventOrder",((e={})[Kn()]=["disabling",Sm,"toggling","typeaheadevents"],e[Wn()]=[Sm,"focusing","keying"],e[ne()]=[Sm,"disabling","toggling","representing"],e[Pn()]=[Sm,"representing","streaming","invalidating"],e[te()]=[Sm,"representing","item-events","tooltipping"],e[Rn()]=["focusing",Sm,"item-type-events"],e[_n()]=["focusing",Sm,"item-type-events"],e[An()]=["item-type-events","tooltipping"],e[Yn()]=["receiving","reflecting","tooltipping"],t=e,Kt.mergeWithThunk(y(t))),Rr()),Nr("domModification")]),n)},Tm=function(e,n){P(n,function(n){bt(e,n)})},km=function(e,n){P(n,function(n){wt(e,n)})},Em=function(n,e){return t=n,o=N(r=e,function(n){return Hr(n.name(),[Br("config"),Lr("state",vo)])}),i=Mr("component.behaviours",yr(o),t.behaviours).fold(function(n){throw new Error(Ir(n)+"\nComplete spec:\n"+JSON.stringify(t,null,2))},function(n){return n}),{list:r,data:et(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},Cm=function(n){var e,t,r=(e=it(n,"behaviours").getOr({}),t=H(Qe(e),function(n){return e[n]!==undefined}),N(t,function(n){return e[n].me}));return Em(n,r)},Mm=function(n,e,t){var r,o,i,u=x(x({},(r=n).dom),{uid:r.uid,domChildren:N(r.components,function(n){return n.element})}),c=n.domModification.fold(function(){return lo({})},lo),a={"alloy.base.modification":c},f=0");r[t[0]]=or(t[1],n),r[t[1]]=or(t[0],n)}),r},createBistate:function(n,e,t){return ir([{key:n,value:or(e,t)},{key:e,value:or(n,t)}])},createTristate:function(n,e,t,r){return ir([{key:n,value:ir([{key:e,value:r},{key:t,value:r}])},{key:e,value:ir([{key:n,value:r},{key:t,value:r}])},{key:t,value:ir([{key:n,value:r},{key:e,value:r}])}])}}}),xg=Ti("scrollable"),wg=function(n){bt(n,xg)},Sg=function(n){wt(n,xg)},Og=xg,Tg=function(n){return it(n,"format").getOr(n.title)},kg=function(n,e,t,r,o){return{data:{value:n,text:e},type:"item",dom:{tag:"div",classes:o?[Ti("styles-item-is-menu")]:[]},toggling:{toggleOnExecute:!1,toggleClass:Ti("format-matches"),selected:t},itemBehaviours:bo(o?[]:[xi(n,function(n,e){(e?bi.on:bi.off)(n)})]),components:[{dom:{tag:"div",attributes:{style:r},innerHtml:e}}]}},Eg=function(n,e,t,r){return{value:n,dom:{tag:"div"},components:[Rf.sketch({dom:{tag:"div",classes:[Ti("styles-collapser")]},components:r?[{dom:{tag:"span",classes:[Ti("styles-collapse-icon")]}},Fm(n)]:[Fm(n)],action:function(n){var e;r&&(e=t().get(n),sg.collapseMenu(e))}}),{dom:{tag:"div",classes:[Ti("styles-menu-items-container")]},components:[Qm.parts.items({})],behaviours:bo([Td("adhoc-scrollable-menu",[io(function(n,e){Ri(n.element,"overflow-y","auto"),Ri(n.element,"-webkit-overflow-scrolling","touch"),wg(n.element)}),uo(function(n){Ni(n.element,"overflow-y"),Ni(n.element,"-webkit-overflow-scrolling"),Sg(n.element)})])])}],items:e,menuBehaviours:bo([bg.config({initialState:"after",routes:bg.createTristate("before","current","after",{transition:{property:"transform",transitionClass:"transitioning"}})})])}},Cg=function(r){var o,i,n,e,t,u=(o=r.formats,i=function(){return c},n=Eg("Styles",[].concat(N(o.items,function(n){return kg(Tg(n),n.title,n.isSelected(),n.getPreview(),ct(o.expansions,Tg(n)))})),i,!1),e=et(o.menus,function(n,e){var t=N(n,function(n){return kg(Tg(n),n.title,n.isSelected!==undefined&&n.isSelected(),n.getPreview!==undefined?n.getPreview():"",ct(o.expansions,Tg(n)))});return Eg(e,t,i,!0)}),t=qt(e,or("styles",n)),{tmenu:sg.tieredData("styles",t,o.expansions)}),c=ed(sg.sketch({dom:{tag:"div",classes:[Ti("styles-menu")]},components:[],fakeFocus:!0,stayInDom:!0,onExecute:function(n,e){var t=ss.getValue(e);return r.handle(e,t.value),T.none()},onEscape:function(){return T.none()},onOpenMenu:function(n,e){var t=ms(n.element);ds(e.element,t),bg.jumpTo(e,"current")},onOpenSubmenu:function(n,e,t){var r=ms(n.element),o=Ji(e.element,'[role="menu"]').getOrDie("hacky"),i=n.getSystem().getByDom(o).getOrDie();ds(t.element,r),bg.progressTo(i,"before"),bg.jumpTo(t,"after"),bg.progressTo(t,"current")},onCollapseMenu:function(n,e,t){var r=Ji(e.element,'[role="menu"]').getOrDie("hacky"),o=n.getSystem().getByDom(r).getOrDie();bg.progressTo(o,"after"),bg.progressTo(t,"current")},navigateOnHover:!1,highlightImmediately:!0,data:u.tmenu,markers:{backgroundMenu:Ti("styles-background-menu"),menu:Ti("styles-menu"),selectedMenu:Ti("styles-selected-menu"),item:Ti("styles-item"),selectedItem:Ti("styles-selected-item")}}));return c.asSpec()},Mg=function(n){return ct(n,"items")?(t=qt(rr(e=n,["items"]),{menu:!0}),r=Dg(e.items),{item:t,menus:qt(r.menus,or(e.title,r.items)),expansions:qt(r.expansions,or(e.title,e.title))}):{item:n,menus:{},expansions:{}};var e,t,r},Dg=function(n){return z(n,function(n,e){var t=Mg(e);return{menus:qt(n.menus,t.menus),items:[t.item].concat(n.items),expansions:qt(n.expansions,t.expansions)}},{menus:{},expansions:{},items:[]})},_g=function(u){var c=function(n){return function(){return u.formatter.match(n)}},a=function(n){return function(){return u.formatter.getCssText(n)}},f=function(n){return N(n,function(n){if(ct(n,"items")){var e=f(n.items);return qt(qt(n,{isSelected:l,getPreview:y("")}),{items:e})}return ct(n,"format")?qt(i=n,{isSelected:c(i.format),getPreview:a(i.format)}):(r=za((t=n).title),o=qt(t,{format:r,isSelected:c(r),getPreview:a(r)}),u.formatter.register(r,o),o);var t,r,o,i})};return f(u.getParam("style_formats",Fo,"array"))},Ig=function(t,n,r){var e,o,i,u=(e=t,i=(o=function(n){return W(n,function(n){return n.items===undefined?!ct(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==_p?[]:[Hg(de.fromDom(r.win),"blur",function(){t.getByDom(e).each(bi.off)}),Hg(i,"select",n),Hg(r.doc,"selectionchange",n)]);return{destroy:function(){P(c,function(n){n.unbind()})}}},Fp=function(n,e){var t=parseInt(lt(n,e),10);return isNaN(t)?0:t},Rp=function(n){return x(x({},n),{width:2})},Vp=function(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom,width:n.width,height:n.height}},Bp=function(n){var e=n.getSelection();return e!==undefined&&0e.innerHeight||t.bottom>e.innerHeight?Math.min(r,t.bottom-e.innerHeight+50):0);0!==o&&u.scrollTo(u.pageXOffset,u.pageYOffset+o)})}),Np(e,n.innerHeight)});Np(e,n.innerHeight);return{toEditing:function(){Ap(u)},destroy:function(){t.unbind()}}},Lp=function(t,r){var o=null;return{cancel:function(){null!==o&&(clearTimeout(o),o=null)},throttle:function(){for(var n=[],e=0;e