'),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)?F.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,F.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 F.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(F.none()),t=function(){return e.get().each(function(n){return n.destroy()})};return{clear:function(){t(),e.set(F.none())},isSet:function(){return e.get().isSome()},set:function(n){t(),e.set(F.some(n))},run:function(n){return e.get().each(n)}}},im=function(){var e=ko(F.none());return{clear:function(){return e.set(F.none())},set:function(n){return e.set(F.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),F.none()},onEscape:function(){return F.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:E,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'),containerBehaviours:bo([bi.config({toggleClass:Ti("mask-tap-icon-selected"),toggleOnExecute:!1})])})),u=(t=n,r=200,o=null,{cancel:function(){null!==o&&(clearTimeout(o),o=null)},throttle:function(){for(var n=[],e=0;e'),components:[Md.sketch({dom:Af(''),components:[Rf.sketch({dom:Af(''),components:[i.asSpec()],action:function(n){u.throttle()},buttonBehaviours:bo([bi.config({toggleClass:Ti("mask-tap-icon-selected")})])})]})]})},$p=y({unbind:O}),Up=yr([jr("editor",[Br("getFrame"),Nr("getBody"),Nr("getDoc"),Nr("getWin"),Nr("getSelection"),Nr("setSelection"),Nr("clearSelection"),Nr("cursorSaver"),Nr("onKeyup"),Nr("onNodeChanged"),Nr("getCursorBox"),Br("onDomChanged"),Lr("onTouchContent",O),Lr("onTapContent",O),Lr("onTouchToolstrip",O),Lr("onScrollToCursor",$p),Lr("onScrollToElement",$p),Lr("onToEditing",$p),Lr("onToReading",$p),Lr("onToolbarScrollStart",v)]),Br("socket"),Br("toolstrip"),Br("dropup"),Br("toolbar"),Br("container"),Br("alloy"),$r("win",function(n){return Te(n.socket).dom.defaultView}),$r("body",function(n){return de.fromDom(n.socket.dom.ownerDocument.body)}),Lr("translate",v),Lr("setReadOnly",O),Lr("readOnlyOnInit",C)]),Wp=function(n){var e=_r("Getting AndroidWebapp schema",Up,n);Ri(e.toolstrip,"width","100%");var t=Bm(Gp(function(){e.setReadOnly(e.readOnlyOnInit()),f.enter()},e.translate));e.alloy.add(t);var r={show:function(){e.alloy.add(t)},hide:function(){e.alloy.remove(t)}};Fe(e.container,t.element);var o,i,u,c,a,f=(o=e,i=r,u=xp(),c=om(),a=om(),{enter:function(){i.hide(),bt(o.container,Ti("fullscreen-maximized")),bt(o.container,Ti("android-maximized")),u.maximize(),bt(o.body,Ti("android-scroll-reload")),c.set(zp(o.win,bp(o.editor).getOrDie("no"))),yp(o.editor).each(function(n){kp(o.container,n.body),a.set(Ip(n,o.toolstrip,o.alloy))})},exit:function(){u.restore(),i.show(),wt(o.container,Ti("fullscreen-maximized")),wt(o.container,Ti("android-maximized")),Ep(),wt(o.body,Ti("android-scroll-reload")),a.clear(),c.clear()}});return{setReadOnly:e.setReadOnly,refreshStructure:O,enter:f.enter,exit:f.exit,destroy:O}},Xp=y([Br("dom"),Lr("shell",!0),Ea("toolbarBehaviours",[og])]),qp=y([rf({name:"groups",overrides:function(){return{behaviours:bo([og.config({})])}}})]),Yp=Ff({name:"Toolbar",configFields:Xp(),partFields:qp(),factory:function(e,n,t,r){var o=function(n){return e.shell?F.some(n):df(n,e,"groups")},i=e.shell?{behaviours:[og.config({})],components:[]}:{behaviours:[],components:n};return{uid:e.uid,dom:e.dom,components:i.components,behaviours:Ma(e.toolbarBehaviours,i.behaviours),apis:{setGroups:function(n,e){o(n).fold(function(){throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},function(n){og.set(n,e)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(n,e,t){n.setGroups(e,t)}}}),Kp=y([Br("items"),jr("markers",N(["itemSelector"],Br)),Ea("tgroupBehaviours",[ka])]),Jp=y([of({name:"items",unit:"item"})]),Qp=Ff({name:"ToolbarGroup",configFields:Kp(),partFields:Jp(),factory:function(n,e,t,r){return{uid:n.uid,dom:n.dom,components:e,behaviours:Ma(n.tgroupBehaviours,[ka.config({mode:"flow",selector:n.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}}}}),Zp="data-"+Ti("horizontal-scroll"),nh=function(n){return"true"===lt(n,Zp)?0<(t=n).dom.scrollLeft||function(n){n.dom.scrollLeft=1;var e=0!==n.dom.scrollLeft;return n.dom.scrollLeft=0,e}(t):0<(e=n).dom.scrollTop||function(n){n.dom.scrollTop=1;var e=0!==n.dom.scrollTop;return n.dom.scrollTop=0,e}(e);var e,t},eh=function(){var e=function(n){var e=!0===n.scrollable?"${prefix}-toolbar-scrollable-group":"";return{dom:Af(''),tgroupBehaviours:bo([Td("adhoc-scrollable-toolbar",!0===n.scrollable?[co(function(n,e){var t;Ri(n.element,"overflow-x","auto"),t=n.element,ft(t,Zp,"true"),wg(n.element)})]:[])]),components:[Md.sketch({components:[Qp.parts.items({})]})],markers:{itemSelector:"."+Ti("toolbar-group-item")},items:n.items}},t=Bm(Yp.sketch({dom:Af(''),components:[Yp.parts.groups({})],toolbarBehaviours:bo([bi.config({toggleClass:Ti("context-toolbar"),toggleOnExecute:!1,aria:{mode:"none"}}),ka.config({mode:"cyclic"})]),shell:!0})),n=Bm(Md.sketch({dom:{classes:[Ti("toolstrip")]},components:[Am(t)],containerBehaviours:bo([bi.config({toggleClass:Ti("android-selection-context-toolbar"),toggleOnExecute:!1})])})),r=function(){Yp.setGroups(t,o.get()),bi.off(t)},o=ko([]);return{wrapper:n,toolbar:t,createGroups:function(n){return N(n,d(Qp.sketch,e))},setGroups:function(n){o.set(n),r()},setContextToolbar:function(n){bi.on(t),Yp.setGroups(t,n)},restoreToolbar:function(){bi.isOn(t)&&r()},refresh:function(){},focus:function(){ka.focusIn(t)}}},th=function(n){return Bm(Rf.sketch({dom:Af(''),action:function(){n.run(function(n){n.setReadOnly(!1)})}}))},rh=function(){return Bm(Md.sketch({dom:Af(''),components:[],containerBehaviours:bo([og.config({})])}))},oh=function(n,e){og.append(n,Am(e))},ih=function(n,e){og.remove(n,e)},uh=function(n,e,t,r){(!0===t?To.toAlpha:To.toOmega)(r),(t?oh:ih)(n,e)},ch=function(e,n){return n.getAnimationRoot.fold(function(){return e.element},function(n){return n(e)})},ah=function(n){return n.dimension.property},fh=function(n,e){return n.dimension.getDimension(e)},sh=function(n,e){var t=ch(n,e);km(t,[e.shrinkingClass,e.growingClass])},lh=function(n,e){wt(n.element,e.openClass),bt(n.element,e.closedClass),Ri(n.element,ah(e),"0px"),Pi(n.element)},dh=function(n,e){wt(n.element,e.closedClass),bt(n.element,e.openClass),Ni(n.element,ah(e))},mh=function(n,e,t,r){t.setCollapsed(),Ri(n.element,ah(e),fh(e,n.element)),Pi(n.element),sh(n,e),lh(n,e),e.onStartShrink(n),e.onShrunk(n)},gh=function(n,e,t,r){var o=r.getOrThunk(function(){return fh(e,n.element)});t.setCollapsed(),Ri(n.element,ah(e),o),Pi(n.element);var i=ch(n,e);wt(i,e.growingClass),bt(i,e.shrinkingClass),lh(n,e),e.onStartShrink(n)},ph=function(n,e,t){var r=fh(e,n.element);("0px"===r?mh:gh)(n,e,t,F.some(r))},hh=function(n,e,t){var r=ch(n,e),o=St(r,e.shrinkingClass),i=fh(e,n.element);dh(n,e);var u=fh(e,n.element);(o?function(){Ri(n.element,ah(e),i),Pi(n.element)}:function(){lh(n,e)})(),wt(r,e.shrinkingClass),bt(r,e.growingClass),dh(n,e),Ri(n.element,ah(e),u),t.setExpanded(),e.onStartGrow(n)},vh=function(n,e,t){var r=ch(n,e);return!0===St(r,e.growingClass)},yh=function(n,e,t){var r=ch(n,e);return!0===St(r,e.shrinkingClass)},bh=/* */Object.freeze({__proto__:null,refresh:function(n,e,t){var r;t.isExpanded()&&(Ni(n.element,ah(e)),r=fh(e,n.element),Ri(n.element,ah(e),r))},grow:function(n,e,t){t.isExpanded()||hh(n,e,t)},shrink:function(n,e,t){t.isExpanded()&&ph(n,e,t)},immediateShrink:function(n,e,t){t.isExpanded()&&mh(n,e,t,F.none())},hasGrown:function(n,e,t){return t.isExpanded()},hasShrunk:function(n,e,t){return t.isCollapsed()},isGrowing:vh,isShrinking:yh,isTransitioning:function(n,e,t){return vh(n,e)||yh(n,e)},toggleGrow:function(n,e,t){(t.isExpanded()?ph:hh)(n,e,t)},disableTransitions:sh}),xh=/* */Object.freeze({__proto__:null,exhibit:function(n,e,t){var r=e.expanded;return lo(r?{classes:[e.openClass],styles:{}}:{classes:[e.closedClass],styles:or(e.dimension.property,"0px")})},events:function(t,r){return Jr([(n=Ln(),eo(n)(function(n,e){e.event.raw.propertyName===t.dimension.property&&(sh(n,t),r.isExpanded()&&Ni(n.element,t.dimension.property),(r.isExpanded()?t.onGrown:t.onShrunk)(n))}))]);var n}}),wh=[Br("closedClass"),Br("openClass"),Br("shrinkingClass"),Br("growingClass"),Nr("getAnimationRoot"),Zo("onShrunk"),Zo("onStartShrink"),Zo("onGrown"),Zo("onStartGrow"),Lr("expanded",!1),Ar("dimension",Fr("property",{width:[ri("property","width"),ri("getDimension",function(n){return ms(n)+"px"})],height:[ri("property","height"),ri("getDimension",function(n){return Li(n)+"px"})]}))],Sh=wo({fields:wh,name:"sliding",active:xh,apis:bh,state:/* */Object.freeze({__proto__:null,init:function(n){var e=ko(n.expanded);return yo({isExpanded:function(){return!0===e.get()},isCollapsed:function(){return!1===e.get()},setCollapsed:b(e.set,!1),setExpanded:b(e.set,!0),readState:function(){return"expanded: "+e.get()}})}})}),Oh=function(e,t){var r=Bm(Md.sketch({dom:{tag:"div",classes:[Ti("dropup")]},components:[],containerBehaviours:bo([og.config({}),Sh.config({closedClass:Ti("dropup-closed"),openClass:Ti("dropup-open"),shrinkingClass:Ti("dropup-shrinking"),growingClass:Ti("dropup-growing"),dimension:{property:"height"},onShrunk:function(n){e(),t(),og.set(n,[])},onGrown:function(n){e(),t()}}),wi(function(n,e){o(O)})])})),o=function(n){window.requestAnimationFrame(function(){n(),Sh.shrink(r)})};return{appear:function(n,e,t){!0===Sh.hasShrunk(r)&&!1===Sh.isTransitioning(r)&&window.requestAnimationFrame(function(){e(t),og.set(r,[n()]),Sh.grow(r)})},disappear:o,component:r,element:r.element}},Th=function(n){var e,t;return n.raw.which===nu[0]&&!A(["input","textarea"],ye(n.target))&&(e=n.target,!Zi(e,'[contenteditable="true"]',t).isSome())},kh=function(){return Mn().browser.isFirefox()},Eh=vr([Ar("triggerEvent",Vr),Lr("stopBackspace",!0)]),Ch=function(e,n){var t,r,o,i,u=_r("Getting GUI events settings",Eh,n),c=Mp(u),a=N(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),function(n){return Hg(e,n,function(e){c.fireIfReady(e,n).each(function(n){n&&e.kill()}),u.triggerEvent(n,e)&&e.kill()})}),f=ko(F.none()),s=Hg(e,"paste",function(e){c.fireIfReady(e,"paste").each(function(n){n&&e.kill()}),u.triggerEvent("paste",e)&&e.kill(),f.set(F.some(setTimeout(function(){u.triggerEvent(qn(),e)},0)))}),l=Hg(e,"keydown",function(n){u.triggerEvent("keydown",n)?n.kill():!0===u.stopBackspace&&Th(n)&&n.prevent()}),d=(t=e,r=function(n){u.triggerEvent("focusin",n)&&n.kill()},kh()?zg(t,"focus",r):Hg(t,"focusin",r)),m=ko(F.none()),g=(o=e,i=function(n){u.triggerEvent("focusout",n)&&n.kill(),m.set(F.some(setTimeout(function(){u.triggerEvent(Xn(),n)},0)))},kh()?zg(o,"blur",i):Hg(o,"focusout",i));return{unbind:function(){P(a,function(n){n.unbind()}),l.unbind(),d.unbind(),g.unbind(),s.unbind(),f.get().each(clearTimeout),m.get().each(clearTimeout)}}},Mh=function(n,e){var t=it(n,"target").getOr(e);return ko(t)},Dh=Ut([{stopped:[]},{resume:["element"]},{complete:[]}]),_h=function(n,r,e,t,o,i){var u,c,a,f,s=n(r,t),l=(u=e,c=o,a=ko(!1),f=ko(!1),{stop:function(){a.set(!0)},cut:function(){f.set(!0)},isStopped:a.get,isCut:f.get,event:u,setSource:c.set,getSource:c.get});return s.fold(function(){return i.logEventNoHandlers(r,t),Dh.complete()},function(e){var t=e.descHandler;return hm(t)(l),l.isStopped()?(i.logEventStopped(r,e.element,t.purpose),Dh.stopped()):l.isCut()?(i.logEventCut(r,e.element,t.purpose),Dh.complete()):Ee(e.element).fold(function(){return i.logNoParent(r,e.element,t.purpose),Dh.complete()},function(n){return i.logEventResponse(r,e.element,t.purpose),Dh.resume(n)})})},Ih=function(e,t,r,n,o,i){return _h(e,t,r,n,o,i).fold(C,function(n){return Ih(e,t,r,n,o,i)},E)},Fh=function(n,e,t){var r,o,i=(r=e,o=ko(!1),{stop:function(){o.set(!0)},cut:O,isStopped:o.get,isCut:E,event:r,setSource:T("Cannot set source of a broadcasted event"),getSource:T("Cannot get source of a broadcasted event")});return P(n,function(n){var e=n.descHandler;hm(e)(i)}),i.isStopped()},Rh=function(n,e,t,r,o){var i=Mh(t,r);return Ih(n,e,t,r,i,o)},Vh=function(){var c={};return{registerId:function(i,u,n){nt(n,function(n,e){var t,r,o=c[e]!==undefined?c[e]:{};o[u]=(t=n,r=i,{cHandler:b.apply(undefined,[t.handler].concat(r)),purpose:t.purpose}),c[e]=o})},unregisterId:function(t){nt(c,function(n,e){n.hasOwnProperty(t)&&delete n[t]})},filterByType:function(n){return it(c,n).map(function(n){return ot(n,function(n,e){return{id:e,descHandler:n}})}).getOr([])},find:function(n,e,t){var o=it(c,e);return Xr(t,function(n){return t=o,Tf(r=n).fold(function(){return F.none()},function(e){return t.bind(function(n){return it(n,e)}).map(function(n){return{element:r,descHandler:n}})});var t,r},n)}}},Bh=function(){var r=Vh(),o={},i=function(r){var n=r.element;return Tf(n).fold(function(){return n="uid-",e=r.element,t=za(wf+n),Of(e,t),t;var n,e,t},function(n){return n})},u=function(n){Tf(n.element).each(function(n){delete o[n],r.unregisterId(n)})};return{find:function(n,e,t){return r.find(n,e,t)},filter:function(n){return r.filterByType(n)},register:function(n){var e=i(n);ct(o,e)&&function(n,e){var t=o[e];if(t!==n)throw new Error('The tagId "'+e+'" is already used by: '+Ho(t.element)+"\nCannot use it for: "+Ho(n.element)+"\nThe conflicting element is"+(Le(t.element)?" ":" not ")+"already in the DOM");u(n)}(n,e);var t=[n];r.registerId(t,e,n.events),o[e]=n},unregister:u,getById:function(n){return it(o,n)}}},Ah=function(t){var r=function(e){return Ee(t.element).fold(C,function(n){return ve(e,n)})},o=Bh(),f=function(n,e){return o.find(r,n,e)},n=Ch(t.element,{triggerEvent:function(r,o){return Wo(r,o.target,function(n){return t=n,Rh(f,r,e=o,e.target,t);var e,t})}}),i={debugInfo:y("real"),triggerEvent:function(e,t,r){Wo(e,t,function(n){return Rh(f,e,r,t,n)})},triggerFocus:function(c,a){Tf(c).fold(function(){Eo(c)},function(n){Wo(Wn(),c,function(n){var e,t,r,o,i,u;return e=f,t=Wn(),i=n,u=Mh(r={originator:a,kill:O,prevent:O,target:c},o=c),_h(e,t,r,o,u,i),!1})})},triggerEscape:function(n,e){i.triggerEvent("keydown",n.element,e.event)},getByUid:function(n){return g(n)},getByDom:function(n){return p(n)},build:Bm,addToGui:function(n){c(n)},removeFromGui:function(n){a(n)},addToWorld:function(n){e(n)},removeFromWorld:function(n){u(n)},broadcast:function(n){l(n)},broadcastOn:function(n,e){d(n,e)},broadcastEvent:function(n,e){m(n,e)},isConnected:C},e=function(n){n.connect(i),we(n.element)||(o.register(n),P(n.components(),e),i.triggerEvent(ne(),n.element,{target:n.element}))},u=function(n){we(n.element)||(P(n.components(),u),o.unregister(n)),n.disconnect()},c=function(n){Ye(t,n,Fe)},a=function(n){Ke(n)},s=function(t){var n=o.filter(Yn());P(n,function(n){var e=n.descHandler;hm(e)(t)})},l=function(n){s({universal:!0,data:n})},d=function(n,e){s({universal:!1,channels:n,data:e})},m=function(n,e){var t=o.filter(n);return Fh(t,e)},g=function(n){return o.getById(n).fold(function(){return Ct.error(new Error('Could not find component with uid: "'+n+'" in system.'))},Ct.value)},p=function(n){var e=Tf(n).getOr("not found");return g(e)};return e(t),{root:t,element:t.element,destroy:function(){n.unbind(),Be(t.element)},add:c,remove:a,getByUid:g,getByDom:p,addToWorld:e,removeFromWorld:u,broadcast:l,broadcastOn:d,broadcastEvent:m}},jh=Ti("readonly-mode"),Nh=Ti("edit-mode");function Ph(n){var e=Bm(Md.sketch({dom:{classes:[Ti("outer-container")].concat(n.classes)},containerBehaviours:bo([To.config({alpha:jh,omega:Nh})])}));return Ah(e)}var Hh=function(n,e){var t=de.fromTag("input");Vi(t,{opacity:"0",position:"absolute",top:"-1000px",left:"-1000px"}),Fe(n,t),Eo(t),e(t),Be(t)},zh=function(n){var e,t,r=n.getSelection();0o?0:o},cv=function(n,e){var t=Te(n).dom.defaultView;return Li(n)+Li(e)-uv(t)},av=function(n,e,t){var r=cv(e,t),o=Li(e)+Li(t)-r;Ri(n,"padding-bottom",o+"px")},fv=Ut([{fixed:["element","property","offsetY"]},{scroller:["element","offsetY"]}]),sv="data-"+Ti("position-y-fixed"),lv="data-"+Ti("y-property"),dv="data-"+Ti("scrolling"),mv="data-"+Ti("last-window-height"),gv=function(n){return Fp(n,sv)},pv=function(n,e){var t=lt(n,lv);return fv.fixed(n,t,e)},hv=function(n,e){return fv.scroller(n,e)},vv=function(n){var e=gv(n);return("true"===lt(n,dv)?hv:pv)(n,e)},yv=function(n,e,t){var r=Te(n).dom.defaultView.innerHeight;return ft(n,mv,r+"px"),r-e-t},bv=function(r,o,i,u){var e=Te(r).dom.defaultView,n=function(n){var e=lt(n,"style");Vi(n,{position:"absolute",top:"0px"}),ft(n,sv,"0px"),ft(n,lv,"top");return{restore:function(){ft(n,"style",e||""),gt(n,sv),gt(n,lv)}}}(i),t=Li(i),c=Li(u),a=function(n,e,t){var r=lt(t,"style");wg(t),Vi(t,{position:"absolute",height:e+"px",width:"100%",top:n+"px"}),ft(t,sv,n+"px"),ft(t,dv,"true"),ft(t,lv,"top");return{restore:function(){Sg(t),ft(t,"style",r||""),gt(t,sv),gt(t,dv),gt(t,lv)}}}(t,yv(r,t,c),r),f=function(n){var e=lt(n,"style");Vi(n,{position:"absolute",bottom:"0px"}),ft(n,sv,"0px"),ft(n,lv,"bottom");return{restore:function(){ft(n,"style",e||""),gt(n,sv),gt(n,lv)}}}(u),s=!0,l=function(){var n=e.innerHeight;return Fp(r,mv)Math.abs(r-i))&&(Lg.clearInterval(Jh),f(i))})},n)}}),wv="data-"+Ti("last-scroll-top"),Sv=function(n){var e=ji(n,"top").getOr("0");return parseInt(e,10)},Ov=function(n){return parseInt(n.dom.scrollTop,10)},Tv=function(o,i){return rv(function(n){var e=b(Ov,o);ft(o,wv,e());var t=Math.abs(i-e()),r=Math.ceil(t/10);xv.animate(e,i,r,function(n,e){Fp(o,wv)!==o.dom.scrollTop?e(o.dom.scrollTop):(o.dom.scrollTop=n,ft(o,wv,n))},function(){o.dom.scrollTop=i,ft(o,wv,i),n(i)},10)})},kv=function(n,e){var t=e+gv(n)+"px";Ri(n,"top",t)};var Ev=function(u,n){return n(function(r){var o=[],i=0;0===u.length?r([]):P(u,function(n,e){var t;n.get((t=e,function(n){o[t]=n,++i>=u.length&&r(o)}))})})},Cv=function(n,e,t){var r,o,i,u=e+t,c=ji(n,"top").getOr(t),a=u-parseInt(c,10),f=n.dom.scrollTop+a;return r=n,o=f,i=u,rv(function(n){var e=b(Ov,r);xv.animate(e,o,15,function(n){r.dom.scrollTop=n,Ri(r,"top",Sv(r)+15+"px")},function(){r.dom.scrollTop=o,Ri(r,"top",i+"px"),n(o)},10)})},Mv=function(n,o){return n.fold(function(n,e,t){return Ri(n,e,o+(r=t)+"px"),ov(r);var r},function(n,e){return Cv(n,o,e)})},Dv=function(n,e){var t,r=(t=Ui(n,"["+sv+"]"),N(t,vv)),o=N(r,function(n){return Mv(n,e)});return Ev(o,rv)},_v=function(i,u,n,t,e,r){var o,c,a=(o=function(n){return t=u,r=n,o=Te(e=i).dom.defaultView,rv(function(n){kv(e,r),kv(t,r),o.scrollTo(0,r),n(r)});var e,t,r,o},c=ko(nv.pure({})),{start:function(e){var n=nv.nu(function(n){return o(e).get(n)});c.set(n)},idle:function(n){c.get().get(function(){n()})}}),f=Lp(function(){a.idle(function(){Dv(n,t.pageYOffset).get(function(){var n;(n=Bp(r),F.from(n[0]).bind(function(n){var e=n.top-u.dom.scrollTop;return e>t.innerHeight+5||e<-5?F.some({top:e,bottom:e+n.height}):F.none()})).each(function(n){u.dom.scrollTop=u.dom.scrollTop+n.top}),a.start(0),e.refresh()})})},1e3),s=Hg(de.fromDom(t),"scroll",function(){t.pageYOffset<0||f.throttle()});return Dv(n,t.pageYOffset).get(v),{unbind:s.unbind}},Iv=function(n){var a=n.cWin,e=n.ceBody,f=n.socket,t=n.toolstrip,r=n.contentElement,o=n.keyboardType,i=n.outerWindow,s=n.dropup,u=n.outerBody,c=bv(f,e,t,s),l=o(u,a,Ge(),r),d=$g(i,{onChange:O,onReady:c.refresh});d.onAdjustment(function(){c.refresh()});var m=Hg(de.fromDom(i),"resize",function(){c.isExpanding()&&c.refresh()}),g=_v(t,f,u,i,c,a),p=function(t,e){var n=t.document,r=de.fromTag("div");bt(r,Ti("unfocused-selections")),Fe(de.fromDom(n.documentElement),r);var o=Hg(r,"touchstart",function(n){n.prevent(),Lh(t,e),u()}),i=function(n){var e=de.fromTag("span");return Tm(e,[Ti("layer-editor"),Ti("unfocused-selection")]),Vi(e,{left:n.left+"px",top:n.top+"px",width:n.width+"px",height:n.height+"px"}),e},u=function(){Ve(r)};return{update:function(){u();var n=Bp(t),e=N(n,i);Re(r,e)},isActive:function(){return 0