agenda-libre-ruby/public/assets/tinymce/themes/mobile/theme-a98c7795b9f5083893dd5f99696347dbc925fd6311164357294a7461547e66b4.js
2018-07-14 16:21:50 +02:00

2 lines
163 KiB
JavaScript

!function(){"use strict";var n,e,t,r,o,i,u,a,k=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e]},v=function(t,r){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return t(r.apply(null,arguments))}},E=function(n){return function(){return n}},h=function(n){return n},l=function(i){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];for(var u=new Array(arguments.length-1),t=1;t<arguments.length;t++)u[t-1]=arguments[t];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var o=u.concat(t);return i.apply(null,o)}},T=function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return!t.apply(null,arguments)}},c=function(n){return function(){throw new Error(n)}},s=function(n){return n()},f=E(!1),d=E(!0),m=function(e){return function(n){return function(n){if(null===n)return"null";var e=typeof n;return"object"===e&&Array.prototype.isPrototypeOf(n)?"array":"object"===e&&String.prototype.isPrototypeOf(n)?"string":e}(n)===e}},b=m("string"),g=m("object"),p=m("array"),y=m("boolean"),w=m("function"),x=m("number"),S=Object.prototype.hasOwnProperty,O=function(u){return function(){for(var n=new Array(arguments.length),e=0;e<n.length;e++)n[e]=arguments[e];if(0===n.length)throw new Error("Can't merge zero objects");for(var t={},r=0;r<n.length;r++){var o=n[r];for(var i in o)S.call(o,i)&&(t[i]=u(t[i],o[i]))}return t}},C=O(function(n,e){return g(n)&&g(e)?C(n,e):e}),D=O(function(n,e){return e}),A=f,R=d,M=function(){return I},I=(r={fold:function(n,e){return n()},is:A,isSome:A,isNone:R,getOr:t=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:t,orThunk:e,map:M,ap:M,each:function(){},bind:M,flatten:M,exists:A,forall:R,filter:M,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:E("none()")},Object.freeze&&Object.freeze(r),r),N=function(t){var n=function(){return t},e=function(){return o},r=function(n){return n(t)},o={fold:function(n,e){return e(t)},is:function(n){return t===n},isSome:R,isNone:A,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:e,orThunk:e,map:function(n){return N(n(t))},ap:function(n){return n.fold(M,function(n){return N(n(t))})},each:function(n){n(t)},bind:r,flatten:n,exists:r,forall:r,filter:function(n){return n(t)?o:I},equals:function(n){return n.is(t)},equals_:function(n,e){return n.fold(A,function(n){return e(t,n)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return o},B={some:N,none:M,from:function(n){return null===n||n===undefined?I:N(n)}},F=Object.keys,V=function(n,e){for(var t=F(n),r=0,o=t.length;r<o;r++){var i=t[r];e(n[i],i,n)}},H=function(n,r){return z(n,function(n,e,t){return{k:e,v:r(n,e,t)}})},z=function(r,o){var i={};return V(r,function(n,e){var t=o(n,e,r);i[t.k]=t.v}),i},j=function(n,t){var r=[];return V(n,function(n,e){r.push(t(n,e))}),r},L=E("touchstart"),U=E("touchmove"),P=E("touchend"),_=E("mousedown"),W=E("mousemove"),$=E("mouseup"),G=E("mouseover"),q=E("keydown"),Y=E("input"),X=E("change"),K=E("click"),J=E("transitionend"),Q=E("selectstart"),Z=function(t){var r,o=!1;return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return o||(o=!0,r=t.apply(null,n)),r}},nn=function(n,e){var t=function(n,e){for(var t=0;t<n.length;t++){var r=n[t];if(r.test(e))return r}return undefined}(n,e);if(!t)return{major:0,minor:0};var r=function(n){return Number(e.replace(t,"$"+n))};return tn(r(1),r(2))},en=function(){return tn(0,0)},tn=function(n,e){return{major:n,minor:e}},rn={nu:tn,detect:function(n,e){var t=String(e).toLowerCase();return 0===n.length?en():nn(n,t)},unknown:en},on="Firefox",un=function(n,e){return function(){return e===n}},an=function(n){var e=n.current;return{current:e,version:n.version,isEdge:un("Edge",e),isChrome:un("Chrome",e),isIE:un("IE",e),isOpera:un("Opera",e),isFirefox:un(on,e),isSafari:un("Safari",e)}},cn={unknown:function(){return an({current:undefined,version:rn.unknown()})},nu:an,edge:E("Edge"),chrome:E("Chrome"),ie:E("IE"),opera:E("Opera"),firefox:E(on),safari:E("Safari")},sn="Windows",fn="Android",ln="Solaris",dn="FreeBSD",mn=function(n,e){return function(){return e===n}},gn=function(n){var e=n.current;return{current:e,version:n.version,isWindows:mn(sn,e),isiOS:mn("iOS",e),isAndroid:mn(fn,e),isOSX:mn("OSX",e),isLinux:mn("Linux",e),isSolaris:mn(ln,e),isFreeBSD:mn(dn,e)}},vn={unknown:function(){return gn({current:undefined,version:rn.unknown()})},nu:gn,windows:E(sn),ios:E("iOS"),android:E(fn),linux:E("Linux"),osx:E("OSX"),solaris:E(ln),freebsd:E(dn)},pn=(o=Array.prototype.indexOf)===undefined?function(n,e){return kn(n,e)}:function(n,e){return o.call(n,e)},hn=function(n,e){return-1<pn(n,e)},bn=function(n,e){return Cn(n,e).isSome()},yn=function(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var i=n[o];r[o]=e(i,o,n)}return r},wn=function(n,e){for(var t=0,r=n.length;t<r;t++)e(n[t],t,n)},xn=function(n,e){for(var t=[],r=0,o=n.length;r<o;r++){var i=n[r];e(i,r,n)&&t.push(i)}return t},Tn=function(n,e,t){return function(n,e){for(var t=n.length-1;0<=t;t--)e(n[t],t,n)}(n,function(n){t=e(t,n)}),t},Sn=function(n,e,t){return wn(n,function(n){t=e(t,n)}),t},On=function(n,e){for(var t=0,r=n.length;t<r;t++){var o=n[t];if(e(o,t,n))return B.some(o)}return B.none()},Cn=function(n,e){for(var t=0,r=n.length;t<r;t++)if(e(n[t],t,n))return B.some(t);return B.none()},kn=function(n,e){for(var t=0,r=n.length;t<r;++t)if(n[t]===e)return t;return-1},En=Array.prototype.push,Dn=function(n){for(var e=[],t=0,r=n.length;t<r;++t){if(!Array.prototype.isPrototypeOf(n[t]))throw new Error("Arr.flatten item "+t+" was not an array, input: "+n);En.apply(e,n[t])}return e},An=function(n,e){var t=yn(n,e);return Dn(t)},Rn=function(n,e){for(var t=0,r=n.length;t<r;++t)if(!0!==e(n[t],t,n))return!1;return!0},Mn=Array.prototype.slice,In=function(n){var e=Mn.call(n,0);return e.reverse(),e},Nn=function(n){return[n]},Bn=(w(Array.from)&&Array.from,function(n,e){var t=String(e).toLowerCase();return On(n,function(n){return n.search(t)})}),Fn=function(n,t){return Bn(n,t).map(function(n){var e=rn.detect(n.versionRegexes,t);return{current:n.name,version:e}})},Vn=function(n,t){return Bn(n,t).map(function(n){var e=rn.detect(n.versionRegexes,t);return{current:n.name,version:e}})},Hn=function(n,e){return-1!==n.indexOf(e)},zn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,jn=function(e){return function(n){return Hn(n,e)}},Ln=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(n){return Hn(n,"edge/")&&Hn(n,"chrome")&&Hn(n,"safari")&&Hn(n,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,zn],search:function(n){return Hn(n,"chrome")&&!Hn(n,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(n){return Hn(n,"msie")||Hn(n,"trident")}},{name:"Opera",versionRegexes:[zn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:jn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:jn("firefox")},{name:"Safari",versionRegexes:[zn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(n){return(Hn(n,"safari")||Hn(n,"mobile/"))&&Hn(n,"applewebkit")}}],Un=[{name:"Windows",search:jn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(n){return Hn(n,"iphone")||Hn(n,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:jn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:jn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:jn("linux"),versionRegexes:[]},{name:"Solaris",search:jn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:jn("freebsd"),versionRegexes:[]}],Pn={browsers:E(Ln),oses:E(Un)},_n=function(n){var e,t,r,o,i,u,a,c,s,f,l,d=Pn.browsers(),m=Pn.oses(),g=Fn(d,n).fold(cn.unknown,cn.nu),v=Vn(m,n).fold(vn.unknown,vn.nu);return{browser:g,os:v,deviceType:(t=g,r=n,o=(e=v).isiOS()&&!0===/ipad/i.test(r),i=e.isiOS()&&!o,u=e.isAndroid()&&3===e.version.major,a=e.isAndroid()&&4===e.version.major,c=o||u||a&&!0===/mobile/i.test(r),s=e.isiOS()||e.isAndroid(),f=s&&!c,l=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(r),{isiPad:E(o),isiPhone:E(i),isTablet:E(c),isPhone:E(f),isTouch:E(s),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:E(l)})}},Wn={detect:Z(function(){var n=navigator.userAgent;return _n(n)})},$n={tap:E("alloy.tap")},Gn=E("alloy.focus"),qn=E("alloy.blur.post"),Yn=E("alloy.receive"),Xn=E("alloy.execute"),Kn=E("alloy.focus.item"),Jn=$n.tap,Qn=Wn.detect().deviceType.isTouch()?$n.tap:K,Zn=E("alloy.longpress"),ne=E("alloy.system.init"),ee=E("alloy.system.scroll"),te=E("alloy.system.attached"),re=E("alloy.system.detached"),oe=function(n,e){ce(n,n.element(),e,{})},ie=function(n,e,t){ce(n,n.element(),e,t)},ue=function(n){oe(n,Xn())},ae=function(n,e,t){ce(n,e,t,{})},ce=function(n,e,t,r){var o=C({target:e},r);n.getSystem().triggerEvent(t,e,H(o,E))},se=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:E(n)}},fe={fromHtml:function(n,e){var t=(e||document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||1<t.childNodes.length)throw console.error("HTML does not have a single root node",n),"HTML must have a single root node";return se(t.childNodes[0])},fromTag:function(n,e){var t=(e||document).createElement(n);return se(t)},fromText:function(n,e){var t=(e||document).createTextNode(n);return se(t)},fromDom:se,fromPoint:function(n,e,t){var r=n.dom();return B.from(r.elementFromPoint(e,t)).map(se)}},le={ATTRIBUTE:Node.ATTRIBUTE_NODE,CDATA_SECTION:Node.CDATA_SECTION_NODE,COMMENT:Node.COMMENT_NODE,DOCUMENT:Node.DOCUMENT_NODE,DOCUMENT_TYPE:Node.DOCUMENT_TYPE_NODE,DOCUMENT_FRAGMENT:Node.DOCUMENT_FRAGMENT_NODE,ELEMENT:Node.ELEMENT_NODE,TEXT:Node.TEXT_NODE,PROCESSING_INSTRUCTION:Node.PROCESSING_INSTRUCTION_NODE,ENTITY_REFERENCE:Node.ENTITY_REFERENCE_NODE,ENTITY:Node.ENTITY_NODE,NOTATION:Node.NOTATION_NODE},de=function(n){return n.dom().nodeName.toLowerCase()},me=function(n){return n.dom().nodeType},ge=function(e){return function(n){return me(n)===e}},ve=ge(le.ELEMENT),pe=ge(le.TEXT),he=ge(le.DOCUMENT),be={name:de,type:me,value:function(n){return n.dom().nodeValue},isElement:ve,isText:pe,isDocument:he,isComment:function(n){return me(n)===le.COMMENT||"#comment"===de(n)}},ye=Z(function(){return we(fe.fromDom(document))}),we=function(n){var e=n.dom().body;if(null===e||e===undefined)throw"Body is not available yet";return fe.fromDom(e)},xe={body:ye,getBody:we,inBody:function(n){var e=be.isText(n)?n.dom().parentNode:n.dom();return e!==undefined&&null!==e&&e.ownerDocument.body.contains(e)}},Te=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(e.length!==t.length)throw new Error('Wrong number of arguments to struct. Expected "['+e.length+']", got '+t.length+" arguments");var r={};return wn(e,function(n,e){r[n]=E(t[e])}),r}},Se=function(n){return n.slice(0).sort()},Oe=function(n,e){throw new Error("All required keys ("+Se(n).join(", ")+") were not specified. Specified keys were: "+Se(e).join(", ")+".")},Ce=function(n){throw new Error("Unsupported keys for object: "+Se(n).join(", "))},ke=function(e,n){if(!p(n))throw new Error("The "+e+" fields must be an array. Was: "+n+".");wn(n,function(n){if(!b(n))throw new Error("The value "+n+" in the "+e+" fields was not a string.")})},Ee=function(n){var t=Se(n);On(t,function(n,e){return e<t.length-1&&n===t[e+1]}).each(function(n){throw new Error("The field: "+n+" occurs more than once in the combined fields: ["+t.join(", ")+"].")})},De=function(o,i){var u=o.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return ke("required",o),ke("optional",i),Ee(u),function(e){var t=F(e);Rn(o,function(n){return hn(t,n)})||Oe(o,t);var n=xn(t,function(n){return!hn(u,n)});0<n.length&&Ce(n);var r={};return wn(o,function(n){r[n]=E(e[n])}),wn(i,function(n){r[n]=E(Object.prototype.hasOwnProperty.call(e,n)?B.some(e[n]):B.none())}),r}},Ae=function(n,e){for(var t=[],r=function(n){return t.push(n),e(n)},o=e(n);(o=o.bind(r)).isSome(););return t},Re="undefined"!=typeof window?window:Function("return this;")(),Me=function(n,e){return function(n,e){for(var t=e!==undefined&&null!==e?e:Re,r=0;r<n.length&&t!==undefined&&null!==t;++r)t=t[n[r]];return t}(n.split("."),e)},Ie={getOrDie:function(n,e){var t=Me(n,e);if(t===undefined||null===t)throw n+" not available on this browser";return t}},Ne=le.ELEMENT,Be=le.DOCUMENT,Fe=function(n){return n.nodeType!==Ne&&n.nodeType!==Be||0===n.childElementCount},Ve={all:function(n,e){var t=e===undefined?document:e.dom();return Fe(t)?[]:yn(t.querySelectorAll(n),fe.fromDom)},is:function(n,e){var t=n.dom();if(t.nodeType!==Ne)return!1;if(t.matches!==undefined)return t.matches(e);if(t.msMatchesSelector!==undefined)return t.msMatchesSelector(e);if(t.webkitMatchesSelector!==undefined)return t.webkitMatchesSelector(e);if(t.mozMatchesSelector!==undefined)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")},one:function(n,e){var t=e===undefined?document:e.dom();return Fe(t)?B.none():B.from(t.querySelector(n)).map(fe.fromDom)}},He=function(n,e){return n.dom()===e.dom()},ze=(Wn.detect().browser.isIE(),He),je=function(n){var e=n.dom();return B.from(e.parentNode).map(fe.fromDom)},Le=function(n){var e=n.dom();return B.from(e.previousSibling).map(fe.fromDom)},Ue=function(n){var e=n.dom();return B.from(e.nextSibling).map(fe.fromDom)},Pe=function(n){var e=n.dom();return yn(e.childNodes,fe.fromDom)},_e=function(n,e){var t=n.dom().childNodes;return B.from(t[e]).map(fe.fromDom)},We=Te("element","offset"),$e={owner:function(n){return fe.fromDom(n.dom().ownerDocument)},defaultView:function(n){var e=n.dom().ownerDocument.defaultView;return fe.fromDom(e)},documentElement:function(n){return fe.fromDom(n.dom().ownerDocument.documentElement)},parent:je,findIndex:function(t){return je(t).bind(function(n){var e=Pe(n);return Cn(e,function(n){return ze(t,n)})})},parents:function(n,e){for(var t=w(e)?e:E(!1),r=n.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=fe.fromDom(i);if(o.push(u),!0===t(u))break;r=i}return o},siblings:function(e){return je(e).map(Pe).map(function(n){return xn(n,function(n){return!ze(e,n)})}).getOr([])},prevSibling:Le,offsetParent:function(n){var e=n.dom();return B.from(e.offsetParent).map(fe.fromDom)},prevSiblings:function(n){return In(Ae(n,Le))},nextSibling:Ue,nextSiblings:function(n){return Ae(n,Ue)},children:Pe,child:_e,firstChild:function(n){return _e(n,0)},lastChild:function(n){return _e(n,n.dom().childNodes.length-1)},childNodesCount:function(n){return n.dom().childNodes.length},hasChildNodes:function(n){return n.dom().hasChildNodes()},leaf:function(n,e){var t=Pe(n);return 0<t.length&&e<t.length?We(t[e],0):We(n,e)}},Ge=function(e,t){$e.parent(e).each(function(n){n.dom().insertBefore(t.dom(),e.dom())})},qe=function(n,e){n.dom().appendChild(e.dom())},Ye={before:Ge,after:function(n,e){$e.nextSibling(n).fold(function(){$e.parent(n).each(function(n){qe(n,e)})},function(n){Ge(n,e)})},prepend:function(e,t){$e.firstChild(e).fold(function(){qe(e,t)},function(n){e.dom().insertBefore(t.dom(),n.dom())})},append:qe,appendAt:function(n,e,t){$e.child(n,t).fold(function(){qe(n,e)},function(n){Ge(n,e)})},wrap:function(n,e){Ge(n,e),qe(e,n)}},Xe=function(e,n){wn(n,function(n){Ye.before(e,n)})},Ke=function(e,n){wn(n,function(n){Ye.append(e,n)})},Je=function(n){var e=n.dom();null!==e.parentNode&&e.parentNode.removeChild(e)},Qe={empty:function(n){n.dom().textContent="",wn($e.children(n),function(n){Je(n)})},remove:Je,unwrap:function(n){var e=$e.children(n);0<e.length&&Xe(n,e),Je(n)}},Ze=function(n){oe(n,re());var e=n.components();wn(e,Ze)},nt=function(n){var e=n.components();wn(e,nt),oe(n,te())},et=function(n,e){tt(n,e,Ye.append)},tt=function(n,e,t){n.getSystem().addToWorld(e),t(n.element(),e.element()),xe.inBody(n.element())&&nt(e),n.syncComponents()},rt=function(n){Ze(n),Qe.remove(n.element()),n.getSystem().removeFromWorld(n)},ot=function(e){var n=$e.parent(e.element()).bind(function(n){return e.getSystem().getByDom(n).fold(B.none,B.some)});rt(e),n.each(function(n){n.syncComponents()})},it=function(t){return{is:function(n){return t===n},isValue:d,isError:f,getOr:E(t),getOrThunk:E(t),getOrDie:E(t),or:function(n){return it(t)},orThunk:function(n){return it(t)},fold:function(n,e){return e(t)},map:function(n){return it(n(t))},each:function(n){n(t)},bind:function(n){return n(t)},exists:function(n){return n(t)},forall:function(n){return n(t)},toOption:function(){return B.some(t)}}},ut=function(t){return{is:f,isValue:f,isError:d,getOr:h,getOrThunk:function(n){return n()},getOrDie:function(){return c(String(t))()},or:function(n){return n},orThunk:function(n){return n()},fold:function(n,e){return n(t)},map:function(n){return ut(t)},each:k,bind:function(n){return ut(t)},exists:f,forall:d,toOption:B.none}},at={value:it,error:ut},ct=function(u){if(!p(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],t={};return wn(u,function(n,r){var e=F(n);if(1!==e.length)throw new Error("one and only one name per case");var o=e[0],i=n[o];if(t[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!p(i))throw new Error("case arguments must be an array");a.push(o),t[o]=function(){var n=arguments.length;if(n!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+n);for(var t=new Array(n),e=0;e<t.length;e++)t[e]=arguments[e];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[r].apply(null,t)},match:function(n){var e=F(n);if(a.length!==e.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+e.join(","));if(!Rn(a,function(n){return hn(e,n)}))throw new Error("Not all branches were specified when using match. Specified: "+e.join(", ")+"\nRequired: "+a.join(", "));return n[o].apply(null,t)},log:function(n){console.log(n,{constructors:a,constructor:o,params:t})}}}}),t},st=ct([{strict:[]},{defaultedThunk:["fallbackThunk"]},{asOption:[]},{asDefaultedOptionThunk:["fallbackThunk"]},{mergeWithThunk:["baseThunk"]}]),ft=function(n){return st.defaultedThunk(E(n))},lt=st.strict,dt=st.asOption,mt=st.defaultedThunk,gt=(st.asDefaultedOptionThunk,st.mergeWithThunk),vt=(ct([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]),function(n){var e=[],t=[];return wn(n,function(n){n.fold(function(n){e.push(n)},function(n){t.push(n)})}),{errors:e,values:t}}),pt=function(n){return v(at.error,Dn)(n)},ht=function(n,e){var t,r,o=vt(n);return 0<o.errors.length?pt(o.errors):(t=o.values,r=e,at.value(C.apply(undefined,[r].concat(t))))},bt=function(n){var e=vt(n);return 0<e.errors.length?pt(e.errors):at.value(e.values)},yt=function(e){return function(n){return n.hasOwnProperty(e)?B.from(n[e]):B.none()}},wt=function(n,e){return yt(e)(n)},xt=function(n,e){var t={};return t[n]=e,t},Tt=function(n,e){return t=n,r={},wn(e,function(n){t[n]!==undefined&&t.hasOwnProperty(n)&&(r[n]=t[n])}),r;var t,r},St=function(n,e){return t=e,r={},V(n,function(n,e){hn(t,e)||(r[e]=n)}),r;var t,r},Ot=function(n){return yt(n)},Ct=function(n,e){return t=n,r=e,function(n){return yt(t)(n).getOr(r)};var t,r},kt=function(n,e){return wt(n,e)},Et=function(n,e){return xt(n,e)},Dt=function(n){return e={},wn(n,function(n){e[n.key]=n.value}),e;var e},At=function(n,e){return ht(n,e)},Rt=function(n,e){return r=e,(t=n).hasOwnProperty(r)&&t[r]!==undefined&&null!==t[r];var t,r},Mt=ct([{setOf:["validator","valueType"]},{arrOf:["valueType"]},{objOf:["fields"]},{itemOf:["validator"]},{choiceOf:["key","branches"]},{thunk:["description"]},{func:["args","outputSchema"]}]),It=ct([{field:["name","presence","type"]},{state:["name"]}]),Nt=function(){return Ie.getOrDie("JSON")},Bt=function(n,e,t){return Nt().stringify(n,e,t)},Ft=function(n){return g(n)&&100<F(n).length?" removed due to size":Bt(n,null,2)},Vt=function(n,e){return at.error([{path:n,getErrorInfo:e}])},Ht=ct([{field:["key","okey","presence","prop"]},{state:["okey","instantiator"]}]),zt=function(t,r,o){return wt(r,o).fold(function(){return n=o,e=r,Vt(t,function(){return'Could not find valid *strict* value for "'+n+'" in '+Ft(e)});var n,e},at.value)},jt=function(n,e,t){var r=wt(n,e).fold(function(){return t(n)},h);return at.value(r)},Lt=function(o,a,n,c){return n.fold(function(i,e,n,t){var r=function(n){return t.extract(o.concat([i]),c,n).map(function(n){return xt(e,c(n))})},u=function(n){return n.fold(function(){var n=xt(e,c(B.none()));return at.value(n)},function(n){return t.extract(o.concat([i]),c,n).map(function(n){return xt(e,c(B.some(n)))})})};return n.fold(function(){return zt(o,a,i).bind(r)},function(n){return jt(a,i,n).bind(r)},function(){return(n=a,e=i,at.value(wt(n,e))).bind(u);var n,e},function(n){return(e=a,t=i,r=n,o=wt(e,t).map(function(n){return!0===n?r(e):n}),at.value(o)).bind(u);var e,t,r,o},function(n){var e=n(a);return jt(a,i,E({})).map(function(n){return C(e,n)}).bind(r)})},function(n,e){var t=e(a);return at.value(xt(n,c(t)))})},Ut=function(r){return{extract:function(t,n,e){return r(e,n).fold(function(n){return e=n,Vt(t,function(){return e});var e},at.value)},toString:function(){return"val"},toDsl:function(){return Mt.itemOf(r)}}},Pt=function(n){var c=_t(n),s=Tn(n,function(e,n){return n.fold(function(n){return C(e,Et(n,!0))},E(e))},{});return{extract:function(n,e,t){var r,o,i,u=y(t)?[]:(o=F(r=t),xn(o,function(n){return Rt(r,n)})),a=xn(u,function(n){return!Rt(s,n)});return 0===a.length?c.extract(n,e,t):(i=a,Vt(n,function(){return"There are unsupported fields: ["+i.join(", ")+"] specified"}))},toString:c.toString,toDsl:c.toDsl}},_t=function(a){return{extract:function(n,e,t){return r=n,o=t,i=e,u=yn(a,function(n){return Lt(r,o,n,i)}),ht(u,{});var r,o,i,u},toString:function(){return"obj{\n"+yn(a,function(n){return n.fold(function(n,e,t,r){return n+" -> "+r.toString()},function(n,e){return"state("+n+")"})}).join("\n")+"}"},toDsl:function(){return Mt.objOf(yn(a,function(n){return n.fold(function(n,e,t,r){return It.field(n,t,r)},function(n,e){return It.state(n)})}))}}},Wt=function(t,i){var e=function(n,e){return(o=Ut(t),{extract:function(t,r,n){var e=yn(n,function(n,e){return o.extract(t.concat(["["+e+"]"]),r,n)});return bt(e)},toString:function(){return"array("+o.toString()+")"},toDsl:function(){return Mt.arrOf(o)}}).extract(n,h,e);var o};return{extract:function(t,r,o){var n=F(o);return e(t,n).bind(function(n){var e=yn(n,function(n){return Ht.field(n,n,lt(),i)});return _t(e).extract(t,r,o)})},toString:function(){return"setOf("+i.toString()+")"},toDsl:function(){return Mt.setOf(t,i)}}},$t=E(Ut(at.value)),Gt=Ht.state,qt=Ht.field,Yt=function(t,e,r,o,i){return kt(o,i).fold(function(){return n=o,e=i,Vt(t,function(){return'The chosen schema: "'+e+'" did not exist in branches: '+Ft(n)});var n,e},function(n){return _t(n).extract(t.concat(["branch: "+i]),e,r)})},Xt=function(o,i){return{extract:function(e,t,r){return kt(r,o).fold(function(){return n=o,Vt(e,function(){return'Choice schema did not contain choice key: "'+n+'"'});var n},function(n){return Yt(e,t,r,i,n)})},toString:function(){return"chooseOn("+o+"). Possible values: "+F(i)},toDsl:function(){return Mt.choiceOf(o,i)}}},Kt=Ut(at.value),Jt=function(n,e,t,r){return e.extract([n],t,r).fold(function(n){return at.error({input:r,errors:n})},at.value)},Qt=function(n,e,t){return Jt(n,e,E,t)},Zt=function(n){return n.fold(function(n){throw new Error(tr(n))},h)},nr=function(n,e,t){return Zt(Jt(n,e,h,t))},er=function(n,e,t){return Zt(Qt(n,e,t))},tr=function(n){return"Errors: \n"+(e=n.errors,t=10<e.length?e.slice(0,10).concat([{path:[],getErrorInfo:function(){return"... (only showing first ten failures)"}}]):e,yn(t,function(n){return"Failed path: ("+n.path.join(" > ")+")\n"+n.getErrorInfo()}))+"\n\nInput object: "+Ft(n.input);var e,t},rr=function(n,e){return Xt(n,e)},or=E(Kt),ir=(i=w,u="function",Ut(function(n){var e=typeof n;return i(n)?at.value(n):at.error("Expected type: "+u+" but got: "+e)})),ur=function(n){return qt(n,n,lt(),$t())},ar=function(n,e){return qt(n,n,lt(),e)},cr=function(n){return ar(n,ir)},sr=function(n,e){return qt(n,n,lt(),_t(e))},fr=function(n){return qt(n,n,dt(),$t())},lr=function(n,e){return qt(n,n,dt(),_t(e))},dr=function(n,e){return qt(n,n,dt(),Pt(e))},mr=function(n,e){return qt(n,n,ft(e),$t())},gr=function(n,e,t){return qt(n,n,ft(e),t)},vr=function(n,e){return Gt(n,e)},pr=function(n){if(!Rt(n,"can")&&!Rt(n,"abort")&&!Rt(n,"run"))throw new Error("EventHandler defined by: "+Bt(n,null,2)+" does not have can, abort, or run!");return nr("Extracting event.handler",Pt([mr("can",E(!0)),mr("abort",E(!1)),mr("run",k)]),n)},hr=function(t){var e,r,o,i,n=(e=t,r=function(n){return n.can},function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Sn(e,function(n,e){return n&&r(e).apply(undefined,t)},!0)}),u=(o=t,i=function(n){return n.abort},function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Sn(o,function(n,e){return n||i(e).apply(undefined,t)},!1)});return pr({can:n,abort:u,run:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];wn(t,function(n){n.run.apply(undefined,e)})}})},br=function(n){return Dt(n)},yr=function(n,e){return{key:n,value:pr({abort:e})}},wr=function(n,e){return{key:n,value:pr({run:e})}},xr=function(n,e,t){return{key:n,value:pr({run:function(n){e.apply(undefined,[n].concat(t))}})}},Tr=function(n){return function(r){return{key:n,value:pr({run:function(n,e){var t;t=e,ze(n.element(),t.event().target())&&r(n,e)}})}}},Sr=function(n,e,t){var u,r,o=e.partUids()[t];return r=o,wr(u=n,function(n,i){n.getSystem().getByUid(r).each(function(n){var e,t,r,o;t=(e=n).element(),r=u,o=i,e.getSystem().triggerEvent(r,t,o.event())})})},Or=function(n){return wr(n,function(n,e){e.cut()})},Cr=Tr(te()),kr=Tr(re()),Er=Tr(ne()),Dr=(a=Xn(),function(n){return wr(a,n)}),Ar=function(n){return yn(n,function(n){return r=e="/*",o=(t=n).length-e.length,""!==r&&(t.length<r.length||t.substr(o,o+r.length)!==r)?n:n.substring(0,n.length-"/*".length);var e,t,r,o})},Rr=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:Ar(i)}},n},Mr=De(["tag"],["classes","attributes","styles","value","innerHtml","domChildren","defChildren"]),Ir=function(n){return{tag:n.tag(),classes:n.classes().getOr([]),attributes:n.attributes().getOr({}),styles:n.styles().getOr({}),value:n.value().getOr("<none>"),innerHtml:n.innerHtml().getOr("<none>"),defChildren:n.defChildren().fold(function(){return"<none>"},function(n){return Bt(n,null,2)}),domChildren:n.domChildren().fold(function(){return"<none>"},function(n){return 0===n.length?"0 children, but still specified":String(n.length)})}},Nr=De([],["classes","attributes","styles","value","innerHtml","defChildren","domChildren"]),Br=function(e,n,t){return n.fold(function(){return t.fold(function(){return{}},function(n){return Et(e,n)})},function(n){return t.fold(function(){return Et(e,n)},function(n){return Et(e,n)})})},Fr=function(t,r,o){return Er(function(n,e){o(n,t,r)})},Vr=function(n,e,t,r,o,i){var u,a,c=n,s=lr(e,[(u="config",a=n,qt(u,u,dt(),a))]);return jr(c,s,e,t,r,o,i)},Hr=function(o,i,u){var n,e,t,r,a,c;return n=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var r=[t].concat(n);return t.config({name:E(o)}).fold(function(){throw new Error("We could not find any behaviour configuration for: "+o+". Using API: "+u)},function(n){var e=Array.prototype.slice.call(r,1);return i.apply(undefined,[t,n.config,n.state].concat(e))})},e=u,t=i.toString(),r=t.indexOf(")")+1,a=t.indexOf("("),c=t.substring(a+1,r-1).split(/,\s*/),n.toFunctionAnnotation=function(){return{name:e,parameters:Ar(c.slice(0,1).concat(c.slice(3)))}},n},zr=function(n){return{key:n,value:undefined}},jr=function(t,n,r,o,e,i,u){var a=function(n){return Rt(n,r)?n[r]():B.none()},c=H(e,function(n,e){return Hr(r,n,e)}),s=H(i,function(n,e){return Rr(n,e)}),f=C(s,c,{revoke:l(zr,r),config:function(n){var e=er(r+"-config",t,n);return{key:r,value:{config:e,me:f,configAsRaw:Z(function(){return nr(r+"-config",t,n)}),initialConfig:n,state:u}}},schema:function(){return n},exhibit:function(n,t){return a(n).bind(function(e){return kt(o,"exhibit").map(function(n){return n(t,e.config,e.state)})}).getOr(Nr({}))},name:function(){return r},handlers:function(n){return a(n).bind(function(e){return kt(o,"events").map(function(n){return n(e.config,e.state)})}).getOr({})}});return f},Lr=function(n,e){return Ur(n,e,{validate:w,label:"function"})},Ur=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return ke("required",o),Ee(o),function(e){var t=F(e);Rn(o,function(n){return hn(t,n)})||Oe(o,t),r(o,t);var n=xn(o,function(n){return!i.validate(e[n],n)});return 0<n.length&&function(n,e){throw new Error("All values need to be of type: "+e+". Keys ("+Se(n).join(", ")+") were not.")}(n,i.label),e}},Pr=function(e,n){var t=xn(n,function(n){return!hn(e,n)});0<t.length&&Ce(t)},_r=k,Wr=function(n){return Lr(Pr,n)},$r={init:function(){return Gr({readState:function(){return"No State required"}})}},Gr=function(n){return Lr(_r,["readState"])(n),n},qr=function(n){return Dt(n)},Yr=Pt([ur("fields"),ur("name"),mr("active",{}),mr("apis",{}),mr("state",$r),mr("extra",{})]),Xr=function(n){var e,t,r,o,i,u,a,c,s=nr("Creating behaviour: "+n.name,Yr,n);return e=s.fields,t=s.name,r=s.active,o=s.apis,i=s.extra,u=s.state,a=Pt(e),c=lr(t,[dr("config",e)]),jr(a,c,t,r,o,i,u)},Kr=Pt([ur("branchKey"),ur("branches"),ur("name"),mr("active",{}),mr("apis",{}),mr("state",$r),mr("extra",{})]),Jr=E(undefined);function Qr(n,e,t){var r=t||!1,o=function(){e(),r=!0},i=function(){n(),r=!1};return{on:o,off:i,toggle:function(){(r?i:o)()},isOn:function(){return r}}}var Zr=function(n,e,t){if(!(b(t)||y(t)||x(t)))throw console.error("Invalid call to Attr.set. Key ",e,":: Value ",t,":: Element ",n),new Error("Attribute value was not simple");n.setAttribute(e,t+"")},no=function(n,e,t){Zr(n.dom(),e,t)},eo=function(n,e){var t=n.dom().getAttribute(e);return null===t?undefined:t},to=function(n,e){var t=n.dom();return!(!t||!t.hasAttribute)&&t.hasAttribute(e)},ro={clone:function(n){return Sn(n.dom().attributes,function(n,e){return n[e.name]=e.value,n},{})},set:no,setAll:function(n,e){var t=n.dom();V(e,function(n,e){Zr(t,e,n)})},get:eo,has:to,remove:function(n,e){n.dom().removeAttribute(e)},hasNone:function(n){var e=n.dom().attributes;return e===undefined||null===e||0===e.length},transfer:function(o,i,n){be.isElement(o)&&be.isElement(i)&&wn(n,function(n){var e,t,r;t=i,to(e=o,r=n)&&!to(t,r)&&no(t,r,eo(e,r))})}},oo=function(n,e){var t=ro.get(n,e);return t===undefined||""===t?[]:t.split(" ")},io=oo,uo=function(n,e,t){var r=oo(n,e).concat([t]);return ro.set(n,e,r.join(" ")),!0},ao=function(n,e,t){var r=xn(oo(n,e),function(n){return n!==t});return 0<r.length?ro.set(n,e,r.join(" ")):ro.remove(n,e),!1},co=function(n){return io(n,"class")},so=function(n,e){return uo(n,"class",e)},fo=function(n,e){return ao(n,"class",e)},lo=co,mo=so,go=fo,vo=function(n,e){return hn(co(n),e)?fo(n,e):so(n,e)},po=function(n){return n.dom().classList!==undefined},ho=function(n,e){return po(n)&&n.dom().classList.contains(e)},bo={add:function(n,e){po(n)?n.dom().classList.add(e):mo(n,e)},remove:function(n,e){var t;po(n)?n.dom().classList.remove(e):go(n,e),0===(po(t=n)?t.dom().classList:lo(t)).length&&ro.remove(t,"class")},toggle:function(n,e){return po(n)?n.dom().classList.toggle(e):vo(n,e)},toggler:function(n,e){var t=po(n),r=n.dom().classList;return Qr(function(){t?r.remove(e):go(n,e)},function(){t?r.add(e):mo(n,e)},ho(n,e))},has:ho},yo=function(n,e,t){bo.remove(n,t),bo.add(n,e)},wo=Object.freeze({toAlpha:function(n,e,t){yo(n.element(),e.alpha(),e.omega())},toOmega:function(n,e,t){yo(n.element(),e.omega(),e.alpha())},isAlpha:function(n,e,t){return bo.has(n.element(),e.alpha())},isOmega:function(n,e,t){return bo.has(n.element(),e.omega())},clear:function(n,e,t){bo.remove(n.element(),e.alpha()),bo.remove(n.element(),e.omega())}}),xo=[ur("alpha"),ur("omega")],To=Xr({fields:xo,name:"swapping",apis:wo}),So=function(n){var e=n,t=function(){return e};return{get:t,set:function(n){e=n},clone:function(){return So(t())}}};function Oo(n,e,t,r,o){return n(t,r)?B.some(t):w(o)&&o(t)?B.none():e(t,r,o)}var Co=function(n,e,t){for(var r=n.dom(),o=w(t)?t:E(!1);r.parentNode;){r=r.parentNode;var i=fe.fromDom(r);if(e(i))return B.some(i);if(o(i))break}return B.none()},ko=function(n,e){return On(n.dom().childNodes,v(e,fe.fromDom)).map(fe.fromDom)},Eo=function(n,r){var o=function(n){for(var e=0;e<n.childNodes.length;e++){if(r(fe.fromDom(n.childNodes[e])))return B.some(fe.fromDom(n.childNodes[e]));var t=o(n.childNodes[e]);if(t.isSome())return t}return B.none()};return o(n.dom())},Do={first:function(n){return Eo(xe.body(),n)},ancestor:Co,closest:function(n,e,t){return Oo(function(n){return e(n)},Co,n,e,t)},sibling:function(e,t){var n=e.dom();return n.parentNode?ko(fe.fromDom(n.parentNode),function(n){return!ze(e,n)&&t(n)}):B.none()},child:ko,descendant:Eo},Ao=function(n){n.dom().focus()},Ro=function(n){var e=n!==undefined?n.dom():document;return B.from(e.activeElement).map(fe.fromDom)},Mo=function(n){var e=$e.owner(n).dom();return n.dom()===e.activeElement},Io=Ao,No=function(n){n.dom().blur()},Bo=Ro,Fo=function(e){return Ro($e.owner(e)).filter(function(n){return e.dom().contains(n.dom())})},Vo=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Ho=tinymce.util.Tools.resolve("tinymce.ThemeManager"),zo=function(n){var e=document.createElement("a");e.target="_blank",e.href=n.href,e.rel="noreferrer noopener";var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)},jo={formatChanged:E("formatChanged"),orientationChanged:E("orientationChanged"),dropupDismissed:E("dropupDismissed")},Lo=function(n,e){var t=(e||document).createElement("div");return t.innerHTML=n,$e.children(fe.fromDom(t))},Uo=function(n){return n.dom().innerHTML},Po=Uo,_o=function(n,e){var t=$e.owner(n).dom(),r=fe.fromDom(t.createDocumentFragment()),o=Lo(e,t);Ke(r,o),Qe.empty(n),Ye.append(n,r)},Wo=function(n){var e=fe.fromTag("div"),t=fe.fromDom(n.dom().cloneNode(!0));return Ye.append(e,t),Uo(e)},$o=function(n,e){return fe.fromDom(n.dom().cloneNode(e))},Go=function(n){return $o(n,!1)},qo=function(n){return e=Go(n),Wo(e);var e},Yo=Object.freeze({events:function(a){return br([wr(Yn(),function(o,i){var n,e,u=a.channels(),t=F(u),r=(n=t,(e=i).universal()?n:xn(n,function(n){return hn(e.channels(),n)}));wn(r,function(n){var e=u[n](),t=e.schema(),r=er("channel["+n+"] data\nReceiver: "+qo(o.element()),t,i.data());e.onReceive()(o,r)})})])}}),Xo=function(n){for(var e=[],t=function(n){e.push(n)},r=0;r<n.length;r++)n[r].each(t);return e},Ko=function(n,e){for(var t=0;t<n.length;t++){var r=e(n[t],t);if(r.isSome())return r}return B.none()},Jo="unknown",Qo=[],Zo=["alloy/data/Fields","alloy/debugging/Debugging"],ni={logEventCut:k,logEventStopped:k,logNoParent:k,logEventNoHandlers:k,logEventResponse:k,write:k},ei=function(n,e,t){var r,o="*"===Qo||hn(Qo,n)?(r=[],{logEventCut:function(n,e,t){r.push({outcome:"cut",target:e,purpose:t})},logEventStopped:function(n,e,t){r.push({outcome:"stopped",target:e,purpose:t})},logNoParent:function(n,e,t){r.push({outcome:"no-parent",target:e,purpose:t})},logEventNoHandlers:function(n,e){r.push({outcome:"no-handlers-left",target:e})},logEventResponse:function(n,e,t){r.push({outcome:"response",purpose:t,target:e})},write:function(){hn(["mousemove","mouseover","mouseout",ne()],n)||console.log(n,{event:n,target:e.dom(),sequence:yn(r,function(n){return hn(["cut","stopped","response"],n.outcome)?"{"+n.purpose+"} "+n.outcome+" at ("+qo(n.target)+")":n.outcome})})}}):ni,i=t(o);return o.write(),i},ti=E([ur("menu"),ur("selectedMenu")]),ri=E([ur("item"),ur("selectedItem")]),oi=(E(Pt(ri().concat(ti()))),E(Pt(ri()))),ii=sr("initSize",[ur("numColumns"),ur("numRows")]),ui=function(n,e,t){var r;return function(){var n=new Error;if(n.stack!==undefined){var e=n.stack.split("\n");On(e,function(e){return 0<e.indexOf("alloy")&&!bn(Zo,function(n){return-1<e.indexOf(n)})}).getOr(Jo)}}(),qt(e,e,t,(r=function(t){return at.value(function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return t.apply(undefined,n)})},Ut(function(n){return r(n)})))},ai=function(n){return ui(0,n,ft(k))},ci=function(n){return ui(0,n,ft(B.none))},si=function(n){return ui(0,n,lt())},fi=function(n){return ui(0,n,lt())},li=function(n,e){return vr(n,E(e))},di=function(n){return vr(n,h)},mi=E(ii),gi=[ar("channels",Wt(at.value,Pt([si("onReceive"),mr("schema",or())])))],vi=Xr({fields:gi,name:"receiving",active:Yo}),pi=function(n,e){var t=wi(n,e),r=e.aria();r.update()(n,r,t)},hi=function(n,e,t){bo.toggle(n.element(),e.toggleClass()),pi(n,e)},bi=function(n,e,t){bo.add(n.element(),e.toggleClass()),pi(n,e)},yi=function(n,e,t){bo.remove(n.element(),e.toggleClass()),pi(n,e)},wi=function(n,e){return bo.has(n.element(),e.toggleClass())},xi=function(n,e,t){(e.selected()?bi:yi)(n,e,t)},Ti=Object.freeze({onLoad:xi,toggle:hi,isOn:wi,on:bi,off:yi}),Si=Object.freeze({exhibit:function(n,e,t){return Nr({})},events:function(n,e){var t,r,o,i=(t=n,r=e,o=hi,Dr(function(n){o(n,t,r)})),u=Fr(n,e,xi);return br(Dn([n.toggleOnExecute()?[i]:[],[u]]))}}),Oi=function(n,e,t){ro.set(n.element(),"aria-expanded",t)},Ci=[mr("selected",!1),ur("toggleClass"),mr("toggleOnExecute",!0),gr("aria",{mode:"none"},rr("mode",{pressed:[mr("syncWithExpanded",!1),li("update",function(n,e,t){ro.set(n.element(),"aria-pressed",t),e.syncWithExpanded()&&Oi(n,e,t)})],checked:[li("update",function(n,e,t){ro.set(n.element(),"aria-checked",t)})],expanded:[li("update",Oi)],selected:[li("update",function(n,e,t){ro.set(n.element(),"aria-selected",t)})],none:[li("update",k)]}))],ki=Xr({fields:Ci,name:"toggling",active:Si,apis:Ti}),Ei=function(t,r){return vi.config({channels:Et(jo.formatChanged(),{onReceive:function(n,e){e.command===t&&r(n,e.state)}})})},Di=function(n){return vi.config({channels:Et(jo.orientationChanged(),{onReceive:n})})},Ai=function(n,e){return{key:n,value:{onReceive:e}}},Ri="tinymce-mobile",Mi={resolve:function(n){return Ri+"-"+n},prefix:E(Ri)},Ii=function(n,e){e.ignore()||(Io(n.element()),e.onFocus()(n))},Ni=Object.freeze({focus:Ii,blur:function(n,e){e.ignore()||No(n.element())},isFocused:function(n){return Mo(n.element())}}),Bi=Object.freeze({exhibit:function(n,e){return e.ignore()?Nr({}):Nr({attributes:{tabindex:"-1"}})},events:function(t){return br([wr(Gn(),function(n,e){Ii(n,t),e.stop()})])}}),Fi=[ai("onFocus"),mr("ignore",!1)],Vi=Xr({fields:Fi,name:"focusing",active:Bi,apis:Ni}),Hi=function(n){return n.style!==undefined},zi=function(n,e,t){if(!b(t))throw console.error("Invalid call to CSS.set. Property ",e,":: Value ",t,":: Element ",n),new Error("CSS value must be a string: "+t);Hi(n)&&n.style.setProperty(e,t)},ji=function(n,e){Hi(n)&&n.style.removeProperty(e)},Li=function(n,e,t){var r=n.dom();zi(r,e,t)},Ui=function(n,e){return Hi(n)?n.style.getPropertyValue(e):""},Pi=function(n,e){var t=n.dom(),r=Ui(t,e);return B.from(r).filter(function(n){return 0<n.length})},_i={copy:function(n,e){var t=n.dom(),r=e.dom();Hi(t)&&Hi(r)&&(r.style.cssText=t.style.cssText)},set:Li,preserve:function(n,e){var t=ro.get(n,"style"),r=e(n);return(t===undefined?ro.remove:ro.set)(n,"style",t),r},setAll:function(n,e){var t=n.dom();V(e,function(n,e){zi(t,e,n)})},setOptions:function(n,e){var t=n.dom();V(e,function(n,e){n.fold(function(){ji(t,e)},function(n){zi(t,e,n)})})},remove:function(n,e){var t=n.dom();ji(t,e),ro.has(n,"style")&&""===ro.get(n,"style").replace(/^\s+|\s+$/g,"")&&ro.remove(n,"style")},get:function(n,e){var t=n.dom(),r=window.getComputedStyle(t).getPropertyValue(e),o=""!==r||xe.inBody(n)?r:Ui(t,e);return null===o?undefined:o},getRaw:Pi,getAllRaw:function(n){var e={},t=n.dom();if(Hi(t))for(var r=0;r<t.style.length;r++){var o=t.style.item(r);e[o]=t.style[o]}return e},isValidValue:function(n,e,t){var r=fe.fromTag(n);return Li(r,e,t),Pi(r,e).isSome()},reflow:function(n){return n.dom().offsetWidth},transfer:function(r,o,n){be.isElement(r)&&be.isElement(o)&&wn(n,function(n){var e,t;e=o,Pi(r,t=n).each(function(n){Pi(e,t).isNone()&&Li(e,t,n)})})}};function Wi(r,o){var n=function(n){var e=o(n);if(e<=0||null===e){var t=_i.get(n,r);return parseFloat(t)||0}return e},i=function(o,n){return Sn(n,function(n,e){var t=_i.get(o,e),r=t===undefined?0:parseInt(t,10);return isNaN(r)?n:n+r},0)};return{set:function(n,e){if(!x(e)&&!e.match(/^[0-9]+$/))throw r+".set accepts only positive integer values. Value was "+e;var t=n.dom();Hi(t)&&(t.style[r]=e+"px")},get:n,getOuter:n,aggregate:i,max:function(n,e,t){var r=i(n,t);return r<e?e-r:0}}}var $i,Gi,qi=Wi("height",function(n){var e=n.dom();return xe.inBody(n)?e.getBoundingClientRect().height:e.offsetHeight}),Yi=function(n){return qi.get(n)},Xi=function(n,e,t){return xn($e.parents(n,t),e)},Ki=function(n,e){return xn($e.siblings(n),e)},Ji=function(n){return Ve.all(n)},Qi=function(n,e,t){return Xi(n,function(n){return Ve.is(n,e)},t)},Zi=function(n,e){return Ki(n,function(n){return Ve.is(n,e)})},nu=function(n,e){return Ve.all(e,n)},eu=function(n,e,t){return Do.ancestor(n,function(n){return Ve.is(n,e)},t)},tu=function(n){return Ve.one(n)},ru=eu,ou=function(n,e){return Ve.one(e,n)},iu=function(n,e,t){return Oo(Ve.is,eu,n,e,t)},uu=function(n,e,t){var r=In(n.slice(0,e)),o=In(n.slice(e+1));return On(r.concat(o),t)},au=function(n,e,t){var r=In(n.slice(0,e));return On(r,t)},cu=function(n,e,t){var r=n.slice(0,e),o=n.slice(e+1);return On(o.concat(r),t)},su=function(n,e,t){var r=n.slice(e+1);return On(r,t)},fu=function(t){return function(n){var e=n.raw();return hn(t,e.which)}},lu=function(n){return function(e){return Rn(n,function(n){return n(e)})}},du=function(n){return!0===n.raw().shiftKey},mu=function(n){return!0===n.raw().ctrlKey},gu=T(du),vu=function(n,e){return{matches:n,classification:e}},pu=function(n,e,t,r){var o=n+e;return r<o?t:o<t?r:o},hu=function(n,e,t){return n<=e?e:t<=n?t:n},bu=function(e,t,n){var r=nu(e.element(),"."+t.highlightClass());wn(r,function(n){bo.remove(n,t.highlightClass()),e.getSystem().getByDom(n).each(function(n){t.onDehighlight()(e,n)})})},yu=function(n,e,t,r){var o=wu(n,e,t,r);bu(n,e),bo.add(r.element(),e.highlightClass()),o||e.onHighlight()(n,r)},wu=function(n,e,t,r){return bo.has(r.element(),e.highlightClass())},xu=function(n,e,t,r){var o=nu(n.element(),"."+e.itemClass());return B.from(o[r]).fold(function(){return at.error("No element found with index "+r)},n.getSystem().getByDom)},Tu=function(e,n,t){return ou(e.element(),"."+n.itemClass()).bind(function(n){return e.getSystem().getByDom(n).toOption()})},Su=function(e,n,t){var r=nu(e.element(),"."+n.itemClass());return(0<r.length?B.some(r[r.length-1]):B.none()).bind(function(n){return e.getSystem().getByDom(n).toOption()})},Ou=function(t,e,n,r){var o=nu(t.element(),"."+e.itemClass());return Cn(o,function(n){return bo.has(n,e.highlightClass())}).bind(function(n){var e=pu(n,r,0,o.length-1);return t.getSystem().getByDom(o[e]).toOption()})},Cu=Object.freeze({dehighlightAll:bu,dehighlight:function(n,e,t,r){var o=wu(n,e,t,r);bo.remove(r.element(),e.highlightClass()),o&&e.onDehighlight()(n,r)},highlight:yu,highlightFirst:function(e,t,r){Tu(e,t,r).each(function(n){yu(e,t,r,n)})},highlightLast:function(e,t,r){Su(e,t,r).each(function(n){yu(e,t,r,n)})},highlightAt:function(e,t,r,n){xu(e,t,r,n).fold(function(n){throw new Error(n)},function(n){yu(e,t,r,n)})},highlightBy:function(e,t,r,n){var o=nu(e.element(),"."+t.itemClass()),i=Xo(yn(o,function(n){return e.getSystem().getByDom(n).toOption()}));On(i,n).each(function(n){yu(e,t,r,n)})},isHighlighted:wu,getHighlighted:function(e,n,t){return ou(e.element(),"."+n.highlightClass()).bind(function(n){return e.getSystem().getByDom(n).toOption()})},getFirst:Tu,getLast:Su,getPrevious:function(n,e,t){return Ou(n,e,0,-1)},getNext:function(n,e,t){return Ou(n,e,0,1)}}),ku=[ur("highlightClass"),ur("itemClass"),ai("onHighlight"),ai("onDehighlight")],Eu=Xr({fields:ku,name:"highlighting",apis:Cu}),Du=function(){return{get:function(n){return Fo(n.element())},set:function(n,e){n.getSystem().triggerFocus(e,n.element())}}},Au=function(n,e,a,t,r,i){var u=function(e,t,r,o){var n,i,u=a(e,t,r,o);return(n=u,i=t.event(),On(n,function(n){return n.matches(i)}).map(function(n){return n.classification})).bind(function(n){return n(e,t,r,o)})},o={schema:function(){return n.concat([mr("focusManager",Du()),li("handler",o),li("state",e)])},processKey:u,toEvents:function(r,o){var n=t(r,o),e=br(i.map(function(t){return wr(Gn(),function(n,e){t(n,r,o,e),e.stop()})}).toArray().concat([wr(q(),function(n,e){u(n,e,r,o).each(function(n){e.stop()})})]));return C(n,e)},toApis:r};return o},Ru=function(n){var e=[fr("onEscape"),fr("onEnter"),mr("selector",'[data-alloy-tabstop="true"]'),mr("firstTabstop",0),mr("useTabstopAt",E(!0)),fr("visibilitySelector")].concat([n]),u=function(n,e){var t=n.visibilitySelector().bind(function(n){return iu(e,n)}).getOr(e);return 0<Yi(t)},a=function(e,n,t,r,o){return o(n,t,function(n){return u(e=r,t=n)&&e.useTabstopAt()(t);var e,t}).fold(function(){return r.cyclic()?B.some(!0):B.none()},function(n){return r.focusManager().set(e,n),B.some(!0)})},i=function(e,n,t,r){var o,i,u=nu(e.element(),t.selector());return(o=e,i=t,i.focusManager().get(o).bind(function(n){return iu(n,i.selector())})).bind(function(n){return Cn(u,l(ze,n)).bind(function(n){return a(e,u,n,t,r)})})},t=E([vu(lu([du,fu([9])]),function(n,e,t,r){var o=t.cyclic()?uu:au;return i(n,0,t,o)}),vu(fu([9]),function(n,e,t,r){var o=t.cyclic()?cu:su;return i(n,0,t,o)}),vu(fu([27]),function(e,t,n,r){return n.onEscape().bind(function(n){return n(e,t)})}),vu(lu([gu,fu([13])]),function(e,t,n,r){return n.onEnter().bind(function(n){return n(e,t)})})]),r=E({}),o=E({});return Au(e,$r.init,t,r,o,B.some(function(e,t){var n,r,o,i;(n=e,r=t,o=nu(n.element(),r.selector()),i=xn(o,function(n){return u(r,n)}),B.from(i[r.firstTabstop()])).each(function(n){t.focusManager().set(e,n)})}))},Mu=Ru(vr("cyclic",E(!1))),Iu=Ru(vr("cyclic",E(!0))),Nu=function(n){return"input"===be.name(n)&&"radio"!==ro.get(n,"type")||"textarea"===be.name(n)},Bu=function(n,e,t){return Nu(t)&&fu([32])(e.event())?B.none():(ae(n,t,Xn()),B.some(!0))},Fu=[mr("execute",Bu),mr("useSpace",!1),mr("useEnter",!0),mr("useControlEnter",!1),mr("useDown",!1)],Vu=function(n,e,t){return t.execute()(n,e,n.element())},Hu=E({}),zu=E({}),ju=Au(Fu,$r.init,function(n,e,t,r){var o=t.useSpace()&&!Nu(n.element())?[32]:[],i=t.useEnter()?[13]:[],u=t.useDown()?[40]:[],a=o.concat(i).concat(u);return[vu(fu(a),Vu)].concat(t.useControlEnter()?[vu(lu([mu,fu([13])]),Vu)]:[])},Hu,zu,B.none()),Lu=function(n){var t=So(B.none());return Gr({readState:E({}),setGridSize:function(n,e){t.set(B.some({numRows:E(n),numColumns:E(e)}))},getNumRows:function(){return t.get().map(function(n){return n.numRows()})},getNumColumns:function(){return t.get().map(function(n){return n.numColumns()})}})},Uu=Object.freeze({flatgrid:Lu,init:function(n){return n.state()(n)}}),Pu=function(n){return"rtl"===_i.get(n,"direction")?"rtl":"ltr"},_u=function(e,t){return function(n){return"rtl"===Pu(n)?t:e}},Wu=function(i){return function(n,e,t,r){var o=i(n.element());return Yu(o,n,e,t,r)}},$u=function(n,e){var t=_u(n,e);return Wu(t)},Gu=function(n,e){var t=_u(e,n);return Wu(t)},qu=function(o){return function(n,e,t,r){return Yu(o,n,e,t,r)}},Yu=function(e,t,n,r,o){return r.focusManager().get(t).bind(function(n){return e(t.element(),n,r,o)}).map(function(n){return r.focusManager().set(t,n),!0})},Xu=qu,Ku=qu,Ju=qu,Qu=function(n){var e,t=n.dom();return!((e=t).offsetWidth<=0&&e.offsetHeight<=0)},Zu=De(["index","candidates"],[]),na=function(n,e,t){return ea(n,e,t,Qu)},ea=function(n,e,t,r){var o,i=l(ze,e),u=nu(n,t),a=xn(u,Qu);return Cn(o=a,i).map(function(n){return Zu({index:n,candidates:o})})},ta=function(n,e){return Cn(n,function(n){return ze(e,n)})},ra=function(t,n,r,e){return e(Math.floor(n/r),n%r).bind(function(n){var e=n.row()*r+n.column();return 0<=e&&e<t.length?B.some(t[e]):B.none()})},oa=function(o,n,i,u,a){return ra(o,n,u,function(n,e){var t=n===i-1?o.length-n*u:u,r=pu(e,a,0,t-1);return B.some({row:E(n),column:E(r)})})},ia=function(i,n,u,a,c){return ra(i,n,a,function(n,e){var t=pu(n,c,0,u-1),r=t===u-1?i.length-t*a:a,o=hu(e,0,r-1);return B.some({row:E(t),column:E(o)})})},ua=[ur("selector"),mr("execute",Bu),ci("onEscape"),mr("captureTab",!1),mi()],aa=function(o){return function(n,e,t,r){return na(n,e,t.selector()).bind(function(n){return o(n.candidates(),n.index(),r.getNumRows().getOr(t.initSize().numRows()),r.getNumColumns().getOr(t.initSize().numColumns()))})}},ca=function(n,e,t,r){return t.captureTab()?B.some(!0):B.none()},sa=aa(function(n,e,t,r){return oa(n,e,t,r,-1)}),fa=aa(function(n,e,t,r){return oa(n,e,t,r,1)}),la=aa(function(n,e,t,r){return ia(n,e,t,r,-1)}),da=aa(function(n,e,t,r){return ia(n,e,t,r,1)}),ma=E([vu(fu([37]),$u(sa,fa)),vu(fu([39]),Gu(sa,fa)),vu(fu([38]),Xu(la)),vu(fu([40]),Ku(da)),vu(lu([du,fu([9])]),ca),vu(lu([gu,fu([9])]),ca),vu(fu([27]),function(n,e,t,r){return t.onEscape()(n,e)}),vu(fu([32].concat([13])),function(e,t,r,n){return(o=e,i=r,i.focusManager().get(o).bind(function(n){return iu(n,i.selector())})).bind(function(n){return r.execute()(e,t,n)});var o,i})]),ga=E({}),va=Au(ua,Lu,ma,ga,{},B.some(function(e,t,n){ou(e.element(),t.selector()).each(function(n){t.focusManager().set(e,n)})})),pa=function(n,e,t,o){return na(n,t,e).bind(function(n){var e=n.index(),t=n.candidates(),r=pu(e,o,0,t.length-1);return B.from(t[r])})},ha=[ur("selector"),mr("getInitial",B.none),mr("execute",Bu),mr("executeOnMove",!1),mr("allowVertical",!0)],ba=function(e,t,r){return(n=e,o=r,o.focusManager().get(n).bind(function(n){return iu(n,o.selector())})).bind(function(n){return r.execute()(e,t,n)});var n,o},ya=function(n,e,t){return pa(n,t.selector(),e,-1)},wa=function(n,e,t){return pa(n,t.selector(),e,1)},xa=function(r){return function(n,e,t){return r(n,e,t).bind(function(){return t.executeOnMove()?ba(n,e,t):B.some(!0)})}},Ta=E({}),Sa=E({}),Oa=Au(ha,$r.init,function(n,e,t,r){var o=[37].concat(t.allowVertical()?[38]:[]),i=[39].concat(t.allowVertical()?[40]:[]);return[vu(fu(o),xa($u(ya,wa))),vu(fu(i),xa(Gu(ya,wa))),vu(fu([13]),ba),vu(fu([32]),ba)]},Ta,Sa,B.some(function(e,t){t.getInitial()(e).or(ou(e.element(),t.selector())).each(function(n){t.focusManager().set(e,n)})})),Ca=De(["rowIndex","columnIndex","cell"],[]),ka=function(n,e,t){return B.from(n[e]).bind(function(n){return B.from(n[t]).map(function(n){return Ca({rowIndex:e,columnIndex:t,cell:n})})})},Ea=function(n,e,t,r){var o=n[e].length,i=pu(t,r,0,o-1);return ka(n,e,i)},Da=function(n,e,t,r){var o=pu(t,r,0,n.length-1),i=n[o].length,u=hu(e,0,i-1);return ka(n,o,u)},Aa=function(n,e,t,r){var o=n[e].length,i=hu(t+r,0,o-1);return ka(n,e,i)},Ra=function(n,e,t,r){var o=hu(t+r,0,n.length-1),i=n[o].length,u=hu(e,0,i-1);return ka(n,o,u)},Ma=[sr("selectors",[ur("row"),ur("cell")]),mr("cycles",!0),mr("previousSelector",B.none),mr("execute",Bu)],Ia=function(n,e){return function(t,r,i){var u=i.cycles()?n:e;return iu(r,i.selectors().row()).bind(function(n){var e=nu(n,i.selectors().cell());return ta(e,r).bind(function(r){var o=nu(t,i.selectors().row());return ta(o,n).bind(function(n){var e,t=(e=i,yn(o,function(n){return nu(n,e.selectors().cell())}));return u(t,n,r).map(function(n){return n.cell()})})})})}},Na=Ia(function(n,e,t){return Ea(n,e,t,-1)},function(n,e,t){return Aa(n,e,t,-1)}),Ba=Ia(function(n,e,t){return Ea(n,e,t,1)},function(n,e,t){return Aa(n,e,t,1)}),Fa=Ia(function(n,e,t){return Da(n,t,e,-1)},function(n,e,t){return Ra(n,t,e,-1)}),Va=Ia(function(n,e,t){return Da(n,t,e,1)},function(n,e,t){return Ra(n,t,e,1)}),Ha=E([vu(fu([37]),$u(Na,Ba)),vu(fu([39]),Gu(Na,Ba)),vu(fu([38]),Xu(Fa)),vu(fu([40]),Ku(Va)),vu(fu([32].concat([13])),function(e,t,r){return Fo(e.element()).bind(function(n){return r.execute()(e,t,n)})})]),za=E({}),ja=E({}),La=Au(Ma,$r.init,Ha,za,ja,B.some(function(e,t){t.previousSelector()(e).orThunk(function(){var n=t.selectors();return ou(e.element(),n.cell())}).each(function(n){t.focusManager().set(e,n)})})),Ua=[ur("selector"),mr("execute",Bu),mr("moveOnTab",!1)],Pa=function(e,t,r){return r.focusManager().get(e).bind(function(n){return r.execute()(e,t,n)})},_a=function(n,e,t){return pa(n,t.selector(),e,-1)},Wa=function(n,e,t){return pa(n,t.selector(),e,1)},$a=E([vu(fu([38]),Ju(_a)),vu(fu([40]),Ju(Wa)),vu(lu([du,fu([9])]),function(n,e,t){return t.moveOnTab()?Ju(_a)(n,e,t):B.none()}),vu(lu([gu,fu([9])]),function(n,e,t){return t.moveOnTab()?Ju(Wa)(n,e,t):B.none()}),vu(fu([13]),Pa),vu(fu([32]),Pa)]),Ga=E({}),qa=E({}),Ya=Au(Ua,$r.init,$a,Ga,qa,B.some(function(e,t){ou(e.element(),t.selector()).each(function(n){t.focusManager().set(e,n)})})),Xa=[ci("onSpace"),ci("onEnter"),ci("onShiftEnter"),ci("onLeft"),ci("onRight"),ci("onTab"),ci("onShiftTab"),ci("onUp"),ci("onDown"),ci("onEscape"),fr("focusIn")],Ka=Au(Xa,$r.init,function(n,e,t){return[vu(fu([32]),t.onSpace()),vu(lu([gu,fu([13])]),t.onEnter()),vu(lu([du,fu([13])]),t.onShiftEnter()),vu(lu([du,fu([9])]),t.onShiftTab()),vu(lu([gu,fu([9])]),t.onTab()),vu(fu([38]),t.onUp()),vu(fu([40]),t.onDown()),vu(fu([37]),t.onLeft()),vu(fu([39]),t.onRight()),vu(fu([32]),t.onSpace()),vu(fu([27]),t.onEscape())]},function(){return{}},function(){return{}},B.some(function(e,t){return t.focusIn().bind(function(n){return n(e,t)})})),Ja=Mu.schema(),Qa=Iu.schema(),Za=Oa.schema(),nc=va.schema(),ec=La.schema(),tc=ju.schema(),rc=Ya.schema(),oc=Ka.schema(),ic=Object.freeze({acyclic:Ja,cyclic:Qa,flow:Za,flatgrid:nc,matrix:ec,execution:tc,menu:rc,special:oc}),uc=(Gi=nr("Creating behaviour: "+($i={branchKey:"mode",branches:ic,name:"keying",active:{events:function(n,e){return n.handler().toEvents(n,e)}},apis:{focusIn:function(n){n.getSystem().triggerFocus(n.element(),n.element())},setGridSize:function(n,e,t,r,o){Rt(t,"setGridSize")?t.setGridSize(r,o):console.error("Layout does not support setGridSize")}},state:Uu}).name,Kr,$i),Vr(rr(Gi.branchKey,Gi.branches),Gi.name,Gi.active,Gi.apis,Gi.extra,Gi.state)),ac=function(r,n){return e=r,t={},o=yn(n,function(n){return e=n.name(),t="Cannot configure "+n.name()+" for "+r,qt(e,e,dt(),Ut(function(n){return at.error("The field: "+e+" is forbidden. "+t)}));var e,t}).concat([vr("dump",h)]),qt(e,e,ft(t),_t(o));var e,t,o},cc=function(n){return n.dump()},sc="placeholder",fc=ct([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),lc=function(n,e,t,r){return t.uiType===sc?(i=t,u=r,(o=n).exists(function(n){return n!==i.owner})?fc.single(!0,E(i)):kt(u,i.name).fold(function(){throw new Error("Unknown placeholder component: "+i.name+"\nKnown: ["+F(u)+"]\nNamespace: "+o.getOr("none")+"\nSpec: "+Bt(i,null,2))},function(n){return n.replace()})):fc.single(!1,E(t));var o,i,u},dc=function(i,u,a,c){return lc(i,0,a,c).fold(function(n,e){var t=e(u,a.config,a.validated),r=kt(t,"components").getOr([]),o=An(r,function(n){return dc(i,u,n,c)});return[C(t,{components:o})]},function(n,e){return e(u,a.config,a.validated)})},mc=function(e,t,n,r){var o,i,u,a=H(r,function(n,e){return r=n,o=!1,{name:E(t=e),required:function(){return r.fold(function(n,e){return n},function(n,e){return n})},used:function(){return o},replace:function(){if(!0===o)throw new Error("Trying to use the same placeholder more than once: "+t);return o=!0,r}};var t,r,o}),c=(o=e,i=t,u=a,An(n,function(n){return dc(o,i,n,u)}));return V(a,function(n){if(!1===n.used()&&n.required())throw new Error("Placeholder: "+n.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+Bt(t.components(),null,2))}),c},gc=fc.single,vc=fc.multiple,pc=E(sc),hc=0,bc=function(n){var e=(new Date).getTime();return n+"_"+Math.floor(1e9*Math.random())+ ++hc+String(e)},yc=ct([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),wc=mr("factory",{sketch:h}),xc=mr("schema",[]),Tc=ur("name"),Sc=qt("pname","pname",mt(function(n){return"<alloy."+bc(n.name)+">"}),or()),Oc=mr("defaults",E({})),Cc=mr("overrides",E({})),kc=_t([wc,xc,Tc,Sc,Oc,Cc]),Ec=_t([wc,xc,Tc,Oc,Cc]),Dc=_t([wc,xc,Tc,Sc,Oc,Cc]),Ac=_t([wc,xc,Tc,ur("unit"),Sc,Oc,Cc]),Rc=function(n){var e=function(n){return n.name()};return n.fold(e,e,e,e)},Mc=function(t,r){return function(n){var e=er("Converting part type",r,n);return t(e)}},Ic=Mc(yc.required,kc),Nc=(Mc(yc.external,Ec),Mc(yc.optional,Dc)),Bc=Mc(yc.group,Ac),Fc=E("entirety"),Vc=function(n,e,t,r){var o=t;return C(e.defaults()(n,t,r),t,{uid:n.partUids()[e.name()]},e.overrides()(n,t,r),{"debug.sketcher":Et("part-"+e.name(),o)})},Hc=function(o,n){var i={};return wn(n,function(n){var e;(e=n,e.fold(B.some,B.none,B.some,B.some)).each(function(t){var r=zc(o,t.pname());i[t.name()]=function(n){var e=nr("Part: "+t.name()+" in "+o,_t(t.schema()),n);return C(r,{config:n,validated:e})}})}),i},zc=function(n,e){return{uiType:pc(),owner:n,name:e}},jc=function(n,e,t){return r=e,i={},o={},wn(t,function(n){n.fold(function(r){i[r.pname()]=gc(!0,function(n,e,t){return r.factory().sketch(Vc(n,r,e,t))})},function(n){var e=r.parts()[n.name()]();o[n.name()]=E(Vc(r,n,e[Fc()]()))},function(r){i[r.pname()]=gc(!1,function(n,e,t){return r.factory().sketch(Vc(n,r,e,t))})},function(o){i[o.pname()]=vc(!0,function(e,n,t){var r=e[o.name()]();return yn(r,function(n){return o.factory().sketch(C(o.defaults()(e,n),n,o.overrides()(e,n)))})})})}),{internals:E(i),externals:E(o)};var r,i,o},Lc=function(n,e,t){return mc(B.some(n),e,e.components(),t)},Uc=function(n,e,t){var r=e.partUids()[t];return n.getSystem().getByUid(r).toOption()},Pc=function(n,e,t){return Uc(n,e,t).getOrDie("Could not find part: "+t)},_c=function(e,n){var t=yn(n,Rc);return Dt(yn(t,function(n){return{key:n,value:e+"-"+n}}))},Wc=function(e){return qt("partUids","partUids",gt(function(n){return _c(n.uid,e)}),or())},$c=bc("alloy-premade"),Gc=bc("api"),qc=function(n){return Et($c,n)},Yc=function(o){return n=function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];var r=n.config(Gc);return o.apply(undefined,[r].concat([n].concat(e)))},e=o.toString(),t=e.indexOf(")")+1,r=e.indexOf("("),i=e.substring(r+1,t-1).split(/,\s*/),n.toFunctionAnnotation=function(){return{name:"OVERRIDE",parameters:Ar(i.slice(1))}},n;var n,e,t,r,i},Xc=E(Gc),Kc=E("alloy-id-"),Jc=E("data-alloy-id"),Qc=Kc(),Zc=Jc(),ns=function(n){var e=be.isElement(n)?ro.get(n,Zc):null;return B.from(e)},es=function(n){return bc(n)},ts=function(n,e,t,r,o){var i,u,a=(u=o,(0<(i=r).length?[sr("parts",i)]:[]).concat([ur("uid"),mr("dom",{}),mr("components",[]),di("originalSpec"),mr("debug.sketcher",{})]).concat(u));return er(n+" [SpecSchema]",Pt(a.concat(e)),t)},rs=function(n,e,t,r,o){var i=os(o),u=An(t,function(n){return n.fold(B.none,B.some,B.none,B.none).map(function(n){return sr(n.name(),n.schema().concat([di(Fc())]))}).toArray()}),a=Wc(t),c=ts(n,e,i,u,[a]),s=jc(0,c,t),f=Lc(n,c,s.internals());return C(r(c,f,i,s.externals()),{"debug.sketcher":Et(n,o)})},os=function(n){return C({uid:es("uid")},n)},is=Pt([ur("name"),ur("factory"),ur("configFields"),mr("apis",{}),mr("extraApis",{})]),us=Pt([ur("name"),ur("factory"),ur("configFields"),ur("partFields"),mr("apis",{}),mr("extraApis",{})]),as=function(n){var a=nr("Sketcher for "+n.name,is,n),e=H(a.apis,Yc),t=H(a.extraApis,function(n,e){return Rr(n,e)});return C({name:E(a.name),partFields:E([]),configFields:E(a.configFields),sketch:function(n){return e=a.name,t=a.configFields,r=a.factory,i=os(o=n),u=ts(e,t,i,[],[]),C(r(u,i),{"debug.sketcher":Et(e,o)});var e,t,r,o,i,u}},e,t)},cs=function(n){var e=nr("Sketcher for "+n.name,us,n),t=Hc(e.name,e.partFields),r=H(e.apis,Yc),o=H(e.extraApis,function(n,e){return Rr(n,e)});return C({name:E(e.name),partFields:E(e.partFields),configFields:E(e.configFields),sketch:function(n){return rs(e.name,e.configFields,e.partFields,e.factory,n)},parts:E(t)},r,o)},ss=as({name:"Button",factory:function(n){var e,t,r,o=(e=n.action(),t=function(n,e){e.stop(),ue(n)},r=Wn.detect().deviceType.isTouch()?[wr(Jn(),t)]:[wr(K(),t),wr(_(),function(n,e){e.cut()})],br(Dn([e.map(function(t){return wr(Xn(),function(n,e){t(n),e.stop()})}).toArray(),r]))),i=kt(n.dom(),"attributes").bind(Ot("type")),u=kt(n.dom(),"tag");return{uid:n.uid(),dom:n.dom(),components:n.components(),events:o,behaviours:C(qr([Vi.config({}),uc.config({mode:"execution",useSpace:!0,useEnter:!0})]),cc(n.buttonBehaviours())),domModification:{attributes:C(i.fold(function(){return u.is("button")?{type:"button"}:{}},function(n){return{}}),{role:n.role().getOr("button")})},eventOrder:n.eventOrder()}},configFields:[mr("uid",undefined),ur("dom"),mr("components",[]),ac("buttonBehaviours",[Vi,uc]),fr("action"),fr("role"),mr("eventOrder",{})]}),fs=Object.freeze({events:function(n){return br([yr(Q(),E(!0))])},exhibit:function(n,e){return Nr({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})}}),ls=Xr({fields:[],name:"unselecting",active:fs}),ds=function(n){var e,t,r,o=fe.fromHtml(n),i=$e.children(o),u=(t=(e=o).dom().attributes!==undefined?e.dom().attributes:[],Sn(t,function(n,e){return"class"===e.name?n:C(n,Et(e.name,e.value))},{})),a=(r=o,Array.prototype.slice.call(r.dom().classList,0)),c=0===i.length?{}:{innerHtml:Po(o)};return C({tag:be.name(o),classes:a,attributes:u},c)},ms=function(n){var e,o,t=(e=n,o={prefix:Mi.prefix()},e.replace(/\$\{([^{}]*)\}/g,function(n,e){var t,r=o[e];return"string"==(t=typeof r)||"number"===t?r.toString():n}));return ds(t)},gs=function(n){return{dom:ms(n)}},vs=function(n){return qr([ki.config({toggleClass:Mi.resolve("toolbar-button-selected"),toggleOnExecute:!1,aria:{mode:"pressed"}}),Ei(n,function(n,e){(e?ki.on:ki.off)(n)})])},ps=function(n,e,t){return ss.sketch({dom:ms('<span class="${prefix}-toolbar-button ${prefix}-icon-'+n+' ${prefix}-icon"></span>'),action:e,buttonBehaviours:C(qr([ls.config({})]),t)})},hs={forToolbar:ps,forToolbarCommand:function(n,e){return ps(e,function(){n.execCommand(e)},{})},forToolbarStateAction:function(n,e,t,r){var o=vs(t);return ps(e,r,o)},forToolbarStateCommand:function(n,e){var t=vs(e);return ps(e,function(){n.execCommand(e)},t)}},bs=function(t,r){return{left:E(t),top:E(r),translate:function(n,e){return bs(t+n,r+e)}}},ys=bs,ws=function(n,e,t){return Math.max(e,Math.min(t,n))},xs=function(n,e,t,r,o,i,u){var a=t-e;if(r<n.left)return e-1;if(r>n.right)return t+1;var c,s,f,l,d=Math.min(n.right,Math.max(r,n.left))-n.left,m=ws(d/n.width*a+e,e-1,t+1),g=Math.round(m);return i&&e<=m&&m<=t?(c=m,s=e,f=t,l=o,u.fold(function(){var n=c-s,e=Math.round(n/l)*l;return ws(s+e,s-1,f+1)},function(n){var e=(c-n)%l,t=Math.round(e/l),r=Math.floor((c-n)/l),o=Math.floor((f-n)/l),i=n+Math.min(o,r+t)*l;return Math.max(n,i)})):g},Ts="slider.change.value",Ss=Wn.detect().deviceType.isTouch(),Os=function(n){return function(n){var e=n.event().raw();if(Ss){var t=e;return t.touches!==undefined&&1===t.touches.length?B.some(t.touches[0]).map(function(n){return ys(n.clientX,n.clientY)}):B.none()}var r=e;return r.clientX!==undefined?B.some(r).map(function(n){return ys(n.clientX,n.clientY)}):B.none()}(n).map(function(n){return n.left()})},Cs=function(n,e){ie(n,Ts,{value:e})},ks=function(i,u,a,n){return Os(n).map(function(n){var e,t,r,o;return e=i,r=n,o=xs(a,(t=u).min(),t.max(),r,t.stepSize(),t.snapToGrid(),t.snapStart()),Cs(e,o),n})},Es=function(n,e){var t,r,o,i,u=(t=e.value().get(),r=e.min(),o=e.max(),i=e.stepSize(),t<r?t:o<t?o:t===r?r-1:Math.max(r,t-i));Cs(n,u)},Ds=function(n,e){var t,r,o,i,u=(t=e.value().get(),r=e.min(),o=e.max(),i=e.stepSize(),o<t?t:t<r?r:t===o?o+1:Math.min(o,t+i));Cs(n,u)},As=Wn.detect().deviceType.isTouch(),Rs=function(n,r){return Nc({name:n+"-edge",overrides:function(n){var e=br([xr(L(),r,[n])]),t=br([xr(_(),r,[n]),xr(W(),function(n,e){e.mouseIsDown().get()&&r(n,e)},[n])]);return{events:As?e:t}}})},Ms=[Rs("left",function(n,e){Cs(n,e.min()-1)}),Rs("right",function(n,e){Cs(n,e.max()+1)}),Ic({name:"thumb",defaults:E({dom:{styles:{position:"absolute"}}}),overrides:function(n){return{events:br([Sr(L(),n,"spectrum"),Sr(U(),n,"spectrum"),Sr(P(),n,"spectrum")])}}}),Ic({schema:[vr("mouseIsDown",function(){return So(!1)})],name:"spectrum",overrides:function(r){var t=function(n,e){var t=n.element().dom().getBoundingClientRect();ks(n,r,t,e)},n=br([wr(L(),t),wr(U(),t)]),e=br([wr(_(),t),wr(W(),function(n,e){r.mouseIsDown().get()&&t(n,e)})]);return{behaviours:qr(As?[]:[uc.config({mode:"special",onLeft:function(n){return Es(n,r),B.some(!0)},onRight:function(n){return Ds(n,r),B.some(!0)}}),Vi.config({})]),events:As?n:e}}})],Is=function(n,e,t){e.store().manager().onLoad(n,e,t)},Ns=function(n,e,t){e.store().manager().onUnload(n,e,t)},Bs=Object.freeze({onLoad:Is,onUnload:Ns,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)}}),Fs=Object.freeze({events:function(t,r){var n=t.resetOnDom()?[Cr(function(n,e){Is(n,t,r)}),kr(function(n,e){Ns(n,t,r)})]:[Fr(t,r,Is)];return br(n)}}),Vs=function(){var n=So(null);return Gr({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()}}})},Hs=function(){var n=So({});return Gr({readState:function(){return{mode:"dataset",dataset:n.get()}},set:n.set,get:n.get})},zs=Object.freeze({memory:Vs,dataset:Hs,manual:function(){return Gr({readState:function(){}})},init:function(n){return n.store().manager().state(n)}}),js=function(n,e,t,r){e.store().getDataKey(),t.set({}),e.store().setData()(n,r),e.onSetValue()(n,r)},Ls=[fr("initialValue"),ur("getFallbackEntry"),ur("getDataKey"),ur("setData"),li("manager",{setValue:js,getValue:function(n,e,t){var r=e.store().getDataKey()(n),o=t.get();return kt(o,r).fold(function(){return e.store().getFallbackEntry()(r)},function(n){return n})},onLoad:function(e,t,r){t.store().initialValue().each(function(n){js(e,t,r,n)})},onUnload:function(n,e,t){t.set({})},state:Hs})],Us=[ur("getValue"),mr("setValue",k),fr("initialValue"),li("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:k,state:$r.init})],Ps=[fr("initialValue"),li("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:Vs})],_s=[gr("store",{mode:"memory"},rr("mode",{memory:Ps,manual:Us,dataset:Ls})),ai("onSetValue"),mr("resetOnDom",!1)],Ws=Xr({fields:_s,name:"representing",active:Fs,apis:Bs,extra:{setValueFrom:function(n,e){var t=Ws.getValue(e);Ws.setValue(n,t)}},state:zs}),$s=Wn.detect().deviceType.isTouch(),Gs=[ur("min"),ur("max"),mr("stepSize",1),mr("onChange",k),mr("onInit",k),mr("onDragStart",k),mr("onDragEnd",k),mr("snapToGrid",!1),fr("snapStart"),ur("getInitialValue"),ac("sliderBehaviours",[uc,Ws]),vr("value",function(n){return So(n.min)})].concat($s?[]:[vr("mouseIsDown",function(){return So(!1)})]),qs=Wi("width",function(n){return n.dom().offsetWidth}),Ys=function(n,e){qs.set(n,e)},Xs=function(n){return qs.get(n)},Ks=Wn.detect().deviceType.isTouch(),Js=cs({name:"Slider",configFields:Gs,partFields:Ms,factory:function(c,n,e,t){var s=c.max()-c.min(),f=function(n){var e=n.element().dom().getBoundingClientRect();return(e.left+e.right)/2},o=function(n){return Pc(n,c,"thumb")},i=function(n){var e,t,r,o,i=Pc(n,c,"spectrum").element().dom().getBoundingClientRect(),u=n.element().dom().getBoundingClientRect(),a=(e=n,t=i,(o=(r=c).value().get())<r.min()?Uc(e,r,"left-edge").fold(function(){return 0},function(n){return f(n)-t.left}):o>r.max()?Uc(e,r,"right-edge").fold(function(){return t.width},function(n){return f(n)-t.left}):(r.value().get()-r.min())/s*t.width);return i.left-u.left+a},u=function(n){var e=i(n),t=o(n),r=Xs(t.element())/2;_i.set(t.element(),"left",e-r+"px")},r=function(n,e){var t=c.value().get(),r=o(n);return t!==e||_i.getRaw(r.element(),"left").isNone()?(c.value().set(e),u(n),c.onChange()(n,r,e),B.some(!0)):B.none()},a=Ks?[wr(L(),function(n,e){c.onDragStart()(n,o(n))}),wr(P(),function(n,e){c.onDragEnd()(n,o(n))})]:[wr(_(),function(n,e){e.stop(),c.onDragStart()(n,o(n)),c.mouseIsDown().set(!0)}),wr($(),function(n,e){c.onDragEnd()(n,o(n)),c.mouseIsDown().set(!1)})];return{uid:c.uid(),dom:c.dom(),components:n,behaviours:C(qr(Dn([Ks?[]:[uc.config({mode:"special",focusIn:function(n){return Uc(n,c,"spectrum").map(uc.focusIn).map(E(!0))}})],[Ws.config({store:{mode:"manual",getValue:function(n){return c.value().get()}}})]])),cc(c.sliderBehaviours())),events:br([wr(Ts,function(n,e){r(n,e.event().value())}),Cr(function(n,e){c.value().set(c.getInitialValue()());var t=o(n);u(n),c.onInit()(n,t,c.value().get())})].concat(a)),apis:{resetToMin:function(n){r(n,c.min())},resetToMax:function(n){r(n,c.max())},refresh:u},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)}}}),Qs=function(e,t,r){return hs.forToolbar(t,function(){var n=r();e.setContextToolbar([{label:t+" group",items:n}])},{})},Zs=function(n){return[(o=n,i=function(n){return n<0?"black":360<n?"white":"hsl("+n+", 100%, 50%)"},Js.sketch({dom:ms('<div class="${prefix}-slider ${prefix}-hue-slider-container"></div>'),components:[Js.parts()["left-edge"](gs('<div class="${prefix}-hue-slider-black"></div>')),Js.parts().spectrum({dom:ms('<div class="${prefix}-slider-gradient-container"></div>'),components:[gs('<div class="${prefix}-slider-gradient"></div>')],behaviours:qr([ki.config({toggleClass:Mi.resolve("thumb-active")})])}),Js.parts()["right-edge"](gs('<div class="${prefix}-hue-slider-white"></div>')),Js.parts().thumb({dom:ms('<div class="${prefix}-slider-thumb"></div>'),behaviours:qr([ki.config({toggleClass:Mi.resolve("thumb-active")})])})],onChange:function(n,e,t){var r=i(t);_i.set(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){var r=i(t);_i.set(e.element(),"background-color",r)},stepSize:10,min:0,max:360,getInitialValue:o.getInitialValue,sliderBehaviours:qr([Di(Js.refresh)])}))];var o,i},nf=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 Qs(n,"color",function(){return Zs(e)})},ef=Pt([ur("getInitialValue"),ur("onChange"),ur("category"),ur("sizes")]),tf=function(n){var o=nr("SizeSlider",ef,n);return Js.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;0<=(r=t)&&r<o.sizes.length&&o.onChange(t)},onDragStart:function(n,e){ki.on(e)},onDragEnd:function(n,e){ki.off(e)},min:0,max:o.sizes.length-1,stepSize:1,getInitialValue:o.getInitialValue,snapToGrid:!0,sliderBehaviours:qr([Di(Js.refresh)]),components:[Js.parts().spectrum({dom:ms('<div class="${prefix}-slider-size-container"></div>'),components:[gs('<div class="${prefix}-slider-size-line"></div>')]}),Js.parts().thumb({dom:ms('<div class="${prefix}-slider-thumb"></div>'),behaviours:qr([ki.config({toggleClass:Mi.resolve("thumb-active")})])})]})},rf=["9px","10px","11px","12px","14px","16px","18px","20px","24px","32px","36px"],of=function(n){var e,t,r=n.selection.getStart(),o=fe.fromDom(r),i=fe.fromDom(n.getBody()),u=(e=function(n){return ze(i,n)},t=o,(be.isElement(t)?B.some(t):$e.parent(t)).map(function(n){return Do.closest(n,function(n){return _i.getRaw(n,"font-size").isSome()},e).bind(function(n){return _i.getRaw(n,"font-size")}).getOrThunk(function(){return _i.get(n,"font-size")})}).getOr(""));return On(rf,function(n){return u===n}).getOr("medium")},uf={candidates:E(rf),get:function(n){var e,t=of(n);return(e=t,Cn(rf,function(n){return n===e})).getOr(2)},apply:function(r,n){var e;(e=n,B.from(rf[e])).each(function(n){var e,t;t=n,of(e=r)!==t&&e.execCommand("fontSize",!1,t)})}},af=uf.candidates(),cf=function(n){return[gs('<span class="${prefix}-toolbar-button ${prefix}-icon-small-font ${prefix}-icon"></span>'),(e=n,tf({onChange:e.onChange,sizes:af,category:"font",getInitialValue:e.getInitialValue})),gs('<span class="${prefix}-toolbar-button ${prefix}-icon-large-font ${prefix}-icon"></span>')];var e},sf=function(n){var e=n.uid!==undefined&&Rt(n,"uid")?n.uid:es("memento");return{get:function(n){return n.getSystem().getByUid(e).getOrDie()},getOpt:function(n){return n.getSystem().getByUid(e).fold(B.none,B.some)},asSpec:function(){return C(n,{uid:e})}}};function ff(n,e){return df(document.createElement("canvas"),n,e)}function lf(n){return n.getContext("2d")}function df(n,e,t){return n.width=e,n.height=t,n}var mf={create:ff,clone:function(n){var e;return lf(e=ff(n.width,n.height)).drawImage(n,0,0),e},resize:df,get2dContext:lf,get3dContext:function(n){var e=null;try{e=n.getContext("webgl")||n.getContext("experimental-webgl")}catch(t){}return e||(e=null),e}},gf={getWidth:function(n){return n.naturalWidth||n.width},getHeight:function(n){return n.naturalHeight||n.height}},vf=window.Promise?window.Promise:function(){var n=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(u,this))},e=n.immediateFn||"function"==typeof setImmediate&&setImmediate||function(n){setTimeout(n,1)};function r(n,e){return function(){n.apply(e,arguments)}}var t=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)};function i(r){var o=this;null!==this._state?e(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(u,this))}this._state=!0,this._value=n,a.call(this)}catch(t){u.call(this,t)}}function u(n){this._state=!1,this._value=n,a.call(this)}function a(){for(var n=0,e=this._deferreds.length;n<e;n++)i.call(this,this._deferreds[n]);this._deferreds=null}function c(n,e,t,r){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof e?e:null,this.resolve=t,this.reject=r}function s(n,e,t){var r=!1;try{n(function(n){r||(r=!0,e(n))},function(n){r||(r=!0,t(n))})}catch(o){if(r)return;r=!0,t(o)}}return n.prototype["catch"]=function(n){return this.then(null,n)},n.prototype.then=function(t,r){var o=this;return new n(function(n,e){i.call(o,new c(t,r,n,e))})},n.all=function(){var c=Array.prototype.slice.call(1===arguments.length&&t(arguments[0])?arguments[0]:arguments);return new n(function(o,i){if(0===c.length)return o([]);var u=c.length;function a(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if("function"==typeof t)return void t.call(n,function(n){a(e,n)},i)}c[e]=n,0==--u&&o(c)}catch(r){i(r)}}for(var n=0;n<c.length;n++)a(n,c[n])})},n.resolve=function(e){return e&&"object"==typeof e&&e.constructor===n?e:new n(function(n){n(e)})},n.reject=function(t){return new n(function(n,e){e(t)})},n.race=function(o){return new n(function(n,e){for(var t=0,r=o.length;t<r;t++)o[t].then(n,e)})},n}();function pf(){return new(Ie.getOrDie("FileReader"))}var hf={atob:function(n){return Ie.getOrDie("atob")(n)},requestAnimationFrame:function(n){Ie.getOrDie("requestAnimationFrame")(n)}};function bf(a){return new vf(function(n,e){var t=URL.createObjectURL(a),r=new Image,o=function(){r.removeEventListener("load",i),r.removeEventListener("error",u)};function i(){o(),n(r)}function u(){o(),e("Unable to load data of type "+a.type+": "+t)}r.addEventListener("load",i),r.addEventListener("error",u),r.src=t,r.complete&&i()})}function yf(r){return new vf(function(n,t){var e=new XMLHttpRequest;e.open("GET",r,!0),e.responseType="blob",e.onload=function(){200==this.status&&n(this.response)},e.onerror=function(){var n,e=this;t(0===this.status?((n=new Error("No access to download image")).code=18,n.name="SecurityError",n):new Error("Error "+e.status+" downloading image"))},e.send()})}function wf(n){var e=n.split(","),t=/data:([^;]+)/.exec(e[0]);if(!t)return B.none();for(var r,o,i,u=t[1],a=e[1],c=hf.atob(a),s=c.length,f=Math.ceil(s/1024),l=new Array(f),d=0;d<f;++d){for(var m=1024*d,g=Math.min(m+1024,s),v=new Array(g-m),p=m,h=0;p<g;++h,++p)v[h]=c[p].charCodeAt(0);l[d]=(r=v,new(Ie.getOrDie("Uint8Array"))(r))}return B.some((o=l,i={type:u},new(Ie.getOrDie("Blob"))(o,i)))}function xf(t){return new vf(function(n,e){wf(t).fold(function(){e("uri is not base64: "+t)},n)})}function Tf(t){return new vf(function(n){var e=new pf;e.onloadend=function(){n(e.result)},e.readAsDataURL(t)})}var Sf,Of,Cf,kf,Ef,Df,Af,Rf,Mf={blobToImage:bf,imageToBlob:function(n){var e=n.src;return 0===e.indexOf("data:")?xf(e):yf(e)},blobToArrayBuffer:function(t){return new vf(function(n){var e=new pf;e.onloadend=function(){n(e.result)},e.readAsArrayBuffer(t)})},blobToDataUri:Tf,blobToBase64:function(n){return Tf(n).then(function(n){return n.split(",")[1]})},dataUriToBlobSync:wf,canvasToBlob:function(n,t,r){return t=t||"image/png",HTMLCanvasElement.prototype.toBlob?new vf(function(e){n.toBlob(function(n){e(n)},t,r)}):xf(n.toDataURL(t,r))},canvasToDataURL:function(n,e,t){return e=e||"image/png",n.then(function(n){return n.toDataURL(e,t)})},blobToCanvas:function(n){return bf(n).then(function(n){var e,t;return e=n,URL.revokeObjectURL(e.src),t=mf.create(gf.getWidth(n),gf.getHeight(n)),mf.get2dContext(t).drawImage(n,0,0),t})},uriToBlob:function(n){return 0===n.indexOf("blob:")?yf(n):0===n.indexOf("data:")?xf(n):null}},If=function(n){return Mf.blobToBase64(n)},Nf=function(u){var e=sf({dom:{tag:"input",attributes:{accept:"image/*",type:"file",title:""},styles:{visibility:"hidden",position:"absolute"}},events:br([Or(K()),wr(X(),function(n,e){var t,r,o;(t=e,r=t.event(),o=r.raw().target.files||r.raw().dataTransfer.files,B.from(o[0])).each(function(n){var o,i;o=u,If(i=n).then(function(r){o.undoManager.transact(function(){var n=o.editorUpload.blobCache,e=n.create(bc("mceu"),i,r);n.add(e);var t=o.dom.createHTML("img",{src:e.blobUri()});o.insertContent(t)})})})})])});return ss.sketch({dom:ms('<span class="${prefix}-toolbar-button ${prefix}-icon-image ${prefix}-icon"></span>'),components:[e.asSpec()],action:function(n){e.get(n).element().dom().click()}})},Bf=function(n){return n.dom().textContent},Ff=function(n,e){n.dom().textContent=e},Vf=function(n){return 0<n.length},Hf=function(n){return n===undefined||null===n?"":n},zf=function(e,t,n){return n.text.filter(Vf).fold(function(){return ro.get(n=e,"href")===Bf(n)?B.some(t):B.none();var n},B.some)},jf=function(n){var e=fe.fromDom(n.selection.getStart());return iu(e,"a")},Lf={getInfo:function(n){return jf(n).fold(function(){return{url:"",text:n.selection.getContent({format:"text"}),title:"",target:"",link:B.none()}},function(n){return t=Bf(e=n),r=ro.get(e,"href"),o=ro.get(e,"title"),i=ro.get(e,"target"),{url:Hf(r),text:t!==r?Hf(t):"",title:Hf(o),target:Hf(i),link:B.some(e)};var e,t,r,o,i})},applyInfo:function(o,i){i.url.filter(Vf).fold(function(){var e;e=o,i.link.bind(h).each(function(n){e.execCommand("unlink")})},function(t){var n,e,r=(n=i,(e={}).href=t,n.title.filter(Vf).each(function(n){e.title=n}),n.target.filter(Vf).each(function(n){e.target=n}),e);i.link.bind(h).fold(function(){var n=i.text.filter(Vf).getOr(t);o.insertContent(o.dom.createHTML("a",r,o.dom.encode(n)))},function(e){var n=zf(e,t,i);ro.setAll(e,r),n.each(function(n){Ff(e,n)})})})},query:jf},Uf=Wn.detect(),Pf=function(n,e){var t=e.selection.getRng();n(),e.selection.setRng(t)},_f=function(n,e){(Uf.os.isAndroid()?Pf:s)(e,n)},Wf=function(n,e){var t,r;return{key:n,value:{config:{},me:(t=n,r=br(e),Xr({fields:[ur("enabled")],name:t,active:{events:E(r)}})),configAsRaw:E({}),initialConfig:{},state:$r}}},$f=Object.freeze({getCurrent:function(n,e,t){return e.find()(n)}}),Gf=[ur("find")],qf=Xr({fields:Gf,name:"composing",apis:$f}),Yf=as({name:"Container",factory:function(n){return{uid:n.uid(),dom:C({tag:"div",attributes:{role:"presentation"}},n.dom()),components:n.components(),behaviours:cc(n.containerBehaviours()),events:n.events(),domModification:n.domModification(),eventOrder:n.eventOrder()}},configFields:[mr("components",[]),ac("containerBehaviours",[]),mr("events",{}),mr("domModification",{}),mr("eventOrder",{})]}),Xf=as({name:"DataField",factory:function(t){return{uid:t.uid(),dom:t.dom(),behaviours:C(qr([Ws.config({store:{mode:"memory",initialValue:t.getInitialValue()()}}),qf.config({find:B.some})]),cc(t.dataBehaviours())),events:br([Cr(function(n,e){Ws.setValue(n,t.getInitialValue()())})])}},configFields:[ur("uid"),ur("dom"),ur("getInitialValue"),ac("dataBehaviours",[Ws,qf])]}),Kf=function(n,e){if(e===undefined)throw new Error("Value.set was undefined");n.dom().value=e},Jf=function(n){return n.dom().value},Qf=E([fr("data"),mr("inputAttributes",{}),mr("inputStyles",{}),mr("type","input"),mr("tag","input"),mr("inputClasses",[]),ai("onSetValue"),mr("styles",{}),fr("placeholder"),mr("eventOrder",{}),ac("inputBehaviours",[Ws,Vi]),mr("selectOnFocus",!0)]),Zf=function(n){return C(qr([Ws.config({store:{mode:"manual",initialValue:n.data().getOr(undefined),getValue:function(n){return Jf(n.element())},setValue:function(n,e){Jf(n.element())!==e&&Kf(n.element(),e)}},onSetValue:n.onSetValue()})]),(e=n,qr([Vi.config({onFocus:!1===e.selectOnFocus()?k:function(n){var e=n.element(),t=Jf(e);e.dom().setSelectionRange(0,t.length)}})])),cc(n.inputBehaviours()));var e},nl=as({name:"Input",configFields:Qf(),factory:function(n,e){return{uid:n.uid(),dom:(t=n,{tag:t.tag(),attributes:C(Dt([{key:"type",value:t.type()}].concat(t.placeholder().map(function(n){return{key:"placeholder",value:n}}).toArray())),t.inputAttributes()),styles:t.inputStyles(),classes:t.inputClasses()}),components:[],behaviours:Zf(n),eventOrder:n.eventOrder()};var t}}),el=Object.freeze({exhibit:function(n,e){return Nr({attributes:Dt([{key:e.tabAttr(),value:"true"}])})}}),tl=[mr("tabAttr","data-alloy-tabstop")],rl=Xr({fields:tl,name:"tabstopping",active:el}),ol=function(n,e){var t=sf(nl.sketch({placeholder:e,onSetValue:function(n,e){oe(n,Y())},inputBehaviours:qr([qf.config({find:B.some}),rl.config({}),uc.config({mode:"execution"})]),selectOnFocus:!1})),r=sf(ss.sketch({dom:ms('<button class="${prefix}-input-container-x ${prefix}-icon-cancel-circle ${prefix}-icon"></button>'),action:function(n){var e=t.get(n);Ws.setValue(e,"")}}));return{name:n,spec:Yf.sketch({dom:ms('<div class="${prefix}-input-container"></div>'),components:[t.asSpec(),r.asSpec()],containerBehaviours:qr([ki.config({toggleClass:Mi.resolve("input-container-empty")}),qf.config({find:function(n){return B.some(t.get(n))}}),Wf("input-clearing",[wr(Y(),function(n){var e=t.get(n);(0<Ws.getValue(e).length?ki.off:ki.on)(n)})])])})}},il=["input","button","textarea"],ul=function(n,e,t){e.disabled()&&dl(n,e,t)},al=function(n){return hn(il,be.name(n.element()))},cl=function(n){ro.set(n.element(),"disabled","disabled")},sl=function(n){ro.remove(n.element(),"disabled")},fl=function(n){ro.set(n.element(),"aria-disabled","true")},ll=function(n){ro.set(n.element(),"aria-disabled","false")},dl=function(e,n,t){n.disableClass().each(function(n){bo.add(e.element(),n)}),(al(e)?cl:fl)(e)},ml=function(n){return al(n)?ro.has(n.element(),"disabled"):"true"===ro.get(n.element(),"aria-disabled")},gl=Object.freeze({enable:function(e,n,t){n.disableClass().each(function(n){bo.remove(e.element(),n)}),(al(e)?sl:ll)(e)},disable:dl,isDisabled:ml,onLoad:ul}),vl=Object.freeze({exhibit:function(n,e,t){return Nr({classes:e.disabled()?e.disableClass().map(Nn).getOr([]):[]})},events:function(n,e){return br([yr(Xn(),function(n,e){return ml(n)}),Fr(n,e,ul)])}}),pl=[mr("disabled",!1),fr("disableClass")],hl=Xr({fields:pl,name:"disabling",active:vl,apis:gl}),bl=[ac("formBehaviours",[Ws])],yl=function(n){return"<alloy.field."+n+">"},wl=function(o,n,e){return C({"debug.sketcher":{Form:e},uid:o.uid(),dom:o.dom(),components:n,behaviours:C(qr([Ws.config({store:{mode:"manual",getValue:function(n){var e,t,r=(e=o,t=n.getSystem(),H(e.partUids(),function(n,e){return E(t.getByUid(n))}));return H(r,function(n,e){return n().bind(qf.getCurrent).map(Ws.getValue)})},setValue:function(t,n){V(n,function(e,n){Uc(t,o,n).each(function(n){qf.getCurrent(n).each(function(n){Ws.setValue(n,e)})})})}}})]),cc(o.formBehaviours())),apis:{getField:function(n,e){return Uc(n,o,e).bind(qf.getCurrent)}}})},xl=(Yc(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=yl(n),o=e,{uiType:pc(),owner:t,name:r,config:o,validated:{}};var t,r,o},record:function(){return i}}),t=n(e),r=e.record(),o=yn(r,function(n){return Ic({name:n,pname:yl(n)})});return rs("form",bl,o,wl,t)}),Tl=function(){var e=So(B.none()),t=function(){e.get().each(function(n){n.destroy()})};return{clear:function(){t(),e.set(B.none())},isSet:function(){return e.get().isSome()},set:function(n){t(),e.set(B.some(n))},run:function(n){e.get().each(n)}}},Sl=function(){var e=So(B.none());return{clear:function(){e.set(B.none())},set:function(n){e.set(B.some(n))},isSet:function(){return e.get().isSome()},on:function(n){e.get().each(n)}}},Ol=function(n){return{xValue:n,points:[]}},Cl=function(n,e){if(e===n.xValue)return n;var t=0<e-n.xValue?1:-1,r={direction:t,xValue:e};return{xValue:e,points:(0===n.points.length?[]:n.points[n.points.length-1].direction===t?n.points.slice(0,n.points.length-1):n.points).concat([r])}},kl=function(n){if(0===n.points.length)return 0;var e=n.points[0].direction,t=n.points[n.points.length-1].direction;return-1===e&&-1===t?-1:1===e&&1===t?1:0},El=function(n){var r="navigateEvent",e=_t([ur("fields"),mr("maxFieldIndex",n.fields.length-1),ur("onExecute"),ur("getInitialValue"),vr("state",function(){return{dialogSwipeState:Sl(),currentScreen:So(0)}})]),u=nr("SerialisedDialog",e,n),o=function(e,n,t){return ss.sketch({dom:ms('<span class="${prefix}-icon-'+n+' ${prefix}-icon"></span>'),action:function(n){ie(n,r,{direction:e})},buttonBehaviours:qr([hl.config({disableClass:Mi.resolve("toolbar-navigation-disabled"),disabled:!t})])})},i=function(n,o){var i=nu(n.element(),"."+Mi.resolve("serialised-dialog-screen"));ou(n.element(),"."+Mi.resolve("serialised-dialog-chain")).each(function(r){0<=u.state.currentScreen.get()+o&&u.state.currentScreen.get()+o<i.length&&(_i.getRaw(r,"left").each(function(n){var e=parseInt(n,10),t=Xs(i[0]);_i.set(r,"left",e-o*t+"px")}),u.state.currentScreen.set(u.state.currentScreen.get()+o))})},a=function(r){var n=nu(r.element(),"input");B.from(n[u.state.currentScreen.get()]).each(function(n){r.getSystem().getByDom(n).each(function(n){var e,t;e=r,t=n.element(),e.getSystem().triggerFocus(t,e.element())})});var e=s.get(r);Eu.highlightAt(e,u.state.currentScreen.get())},c=sf(xl(function(t){return{dom:ms('<div class="${prefix}-serialised-dialog"></div>'),components:[Yf.sketch({dom:ms('<div class="${prefix}-serialised-dialog-chain" style="left: 0px; position: absolute;"></div>'),components:yn(u.fields,function(n,e){return e<=u.maxFieldIndex?Yf.sketch({dom:ms('<div class="${prefix}-serialised-dialog-screen"></div>'),components:Dn([[o(-1,"previous",0<e)],[t.field(n.name,n.spec)],[o(1,"next",e<u.maxFieldIndex)]])}):t.field(n.name,n.spec)})})],formBehaviours:qr([Di(function(n,e){var t;t=e,ou(n.element(),"."+Mi.resolve("serialised-dialog-chain")).each(function(n){_i.set(n,"left",-u.state.currentScreen.get()*t.width+"px")})}),uc.config({mode:"special",focusIn:function(n){a(n)},onTab:function(n){return i(n,1),B.some(!0)},onShiftTab:function(n){return i(n,-1),B.some(!0)}}),Wf("form-events",[Cr(function(e,n){u.state.currentScreen.set(0),u.state.dialogSwipeState.clear();var t=s.get(e);Eu.highlightFirst(t),u.getInitialValue(e).each(function(n){Ws.setValue(e,n)})}),Dr(u.onExecute),wr(J(),function(n,e){"left"===e.event().raw().propertyName&&a(n)}),wr(r,function(n,e){var t=e.event().direction();i(n,t)})])])}})),s=sf({dom:ms('<div class="${prefix}-dot-container"></div>'),behaviours:qr([Eu.config({highlightClass:Mi.resolve("dot-active"),itemClass:Mi.resolve("dot-item")})]),components:An(u.fields,function(n,e){return e<=u.maxFieldIndex?[gs('<div class="${prefix}-dot-item ${prefix}-icon-full-dot ${prefix}-icon"></div>')]:[]})});return{dom:ms('<div class="${prefix}-serializer-wrapper"></div>'),components:[c.asSpec(),s.asSpec()],behaviours:qr([uc.config({mode:"special",focusIn:function(n){var e=c.get(n);uc.focusIn(e)}}),Wf("serializer-wrapper-events",[wr(L(),function(n,e){var t=e.event();u.state.dialogSwipeState.set(Ol(t.touches[0].clientX))}),wr(U(),function(n,e){var t=e.event();u.state.dialogSwipeState.on(function(n){e.event().prevent(),u.state.dialogSwipeState.set(Cl(n,t.raw().touches[0].clientX))})}),wr(P(),function(r){u.state.dialogSwipeState.on(function(n){var e=c.get(r),t=-1*kl(n);i(e,t)})})])])}},Dl=Z(function(t,r){return[{label:"the link group",items:[El({fields:[ol("url","Type or paste URL"),ol("text","Link text"),ol("title","Link title"),ol("target","Link target"),(n="link",{name:n,spec:Xf.sketch({dom:{tag:"span",styles:{display:"none"}},getInitialValue:function(){return B.none()}})})],maxFieldIndex:["url","text","title","target"].length-1,getInitialValue:function(){return B.some(Lf.getInfo(r))},onExecute:function(n){var e=Ws.getValue(n);Lf.applyInfo(r,e),t.restoreToolbar(),r.focus()}})]}];var n}),Al=[{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"}]}],Rl=br([(Sf=Gn(),Of=function(n,e){var t,r,o=e.event().originator(),i=e.event().target();return r=i,!(ze(t=o,n.element())&&!ze(t,r)&&(console.warn(Gn()+" did not get interpreted by the desired target. \nOriginator: "+qo(o)+"\nTarget: "+qo(i)+"\nCheck the "+Gn()+" event handlers"),1))},{key:Sf,value:pr({can:Of})})]),Ml=Object.freeze({events:Rl}),Il=h,Nl=Wr(["debugInfo","triggerFocus","triggerEvent","triggerEscape","addToWorld","removeFromWorld","addToGui","removeFromGui","build","getByUid","getByDom","broadcast","broadcastOn","isConnected"]),Bl=function(e){var n=function(n){return function(){throw new Error("The component must be in a context to send: "+n+"\n"+qo(e().element())+" is not in context.")}};return Nl({debugInfo:E("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"),isConnected:E(!1)})},Fl=function(n,o){var i={};return V(n,function(n,r){V(n,function(n,e){var t=Ct(e,[])(i);i[e]=t.concat([o(r,n)])})}),i},Vl=function(n,e){return 1<n.length?at.error('Multiple behaviours have tried to change DOM "'+e+'". The guilty behaviours are: '+Bt(yn(n,function(n){return n.name()}))+". At this stage, this is not supported. Future releases might provide strategies for resolving this."):0===n.length?at.value({}):at.value(n[0].modification().fold(function(){return{}},function(n){return Et(e,n)}))},Hl=function(u,a){return Sn(u,function(n,e){var t=e.modification().getOr({});return n.bind(function(i){var n=j(t,function(n,e){return i[e]!==undefined?(t=a,r=e,o=u,at.error("Mulitple behaviours have tried to change the _"+r+'_ "'+t+'". The guilty behaviours are: '+Bt(An(o,function(n){return n.modification().getOr({})[r]!==undefined?[n.name()]:[]}),null,2)+". This is not currently supported.")):at.value(Et(e,n));var t,r,o});return At(n,i)})},at.value({})).map(function(n){return Et(a,n)})},zl={classes:function(n,e){var t=An(n,function(n){return n.modification().getOr([])});return at.value(Et(e,t))},attributes:Hl,styles:Hl,domChildren:Vl,defChildren:Vl,innerHtml:Vl,value:Vl},jl=function(n,e){return t=l.apply(undefined,[n.handler].concat(e)),r=n.purpose(),{cHandler:t,purpose:E(r)};var t,r},Ll=function(n){return n.cHandler},Ul=function(n,e){return{name:E(n),handler:E(e)}},Pl=function(n,e,t){var r,o,i=C(t,(r=n,o={},wn(e,function(n){o[n.name()]=n.handlers(r)}),o));return Fl(i,Ul)},_l=function(n){var e,i=w(e=n)?{can:E(!0),abort:E(!1),run:e}:e;return function(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var o=[n,e].concat(t);i.abort.apply(undefined,o)?e.stop():i.can.apply(undefined,o)&&i.run.apply(undefined,o)}},Wl=function(n,e,t){var r,o,i=e[t];return i?function(u,a,n,c){var e=n.slice(0);try{var t=e.sort(function(n,e){var t=n[a](),r=e[a](),o=c.indexOf(t),i=c.indexOf(r);if(-1===o)throw new Error("The ordering for "+u+" does not have an entry for "+t+".\nOrder specified: "+Bt(c,null,2));if(-1===i)throw new Error("The ordering for "+u+" does not have an entry for "+r+".\nOrder specified: "+Bt(c,null,2));return o<i?-1:i<o?1:0});return at.value(t)}catch(r){return at.error([r])}}("Event: "+t,"name",n,i).map(function(n){var e=yn(n,function(n){return n.handler()});return hr(e)}):(r=t,o=n,at.error(["The event ("+r+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+Bt(yn(o,function(n){return n.name()}),null,2)]))},$l=function(n,i){var e=j(n,function(r,o){return(1===r.length?at.value(r[0].handler()):Wl(r,i,o)).map(function(n){var e=_l(n),t=1<r.length?xn(i,function(e){return hn(r,function(n){return n.name()===e})}).join(" > "):r[0].name();return Et(o,{handler:e,purpose:E(t)})})});return At(e,{})},Gl=function(n){return Qt("custom.definition",Pt([qt("dom","dom",lt(),Pt([ur("tag"),mr("styles",{}),mr("classes",[]),mr("attributes",{}),fr("value"),fr("innerHtml")])),ur("components"),ur("uid"),mr("events",{}),mr("apis",E({})),qt("eventOrder","eventOrder",(e={"alloy.execute":["disabling","alloy.base.behaviour","toggling"],"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"]},st.mergeWithThunk(E(e))),or()),fr("domModification"),di("originalSpec"),mr("debug.sketcher","unknown")]),n);var e},ql=function(n){var e,t={tag:n.dom().tag(),classes:n.dom().classes(),attributes:C((e=n,Et(Jc(),e.uid())),n.dom().attributes()),styles:n.dom().styles(),domChildren:yn(n.components(),function(n){return n.element()})};return Mr(C(t,n.dom().innerHtml().map(function(n){return Et("innerHtml",n)}).getOr({}),n.dom().value().map(function(n){return Et("value",n)}).getOr({})))},Yl=function(e,n){wn(n,function(n){bo.add(e,n)})},Xl=function(e,n){wn(n,function(n){bo.remove(e,n)})},Kl=function(e){if(e.domChildren().isSome()&&e.defChildren().isSome())throw new Error("Cannot specify children and child specs! Must be one or the other.\nDef: "+(n=Ir(e),Bt(n,null,2)));return e.domChildren().fold(function(){var n=e.defChildren().getOr([]);return yn(n,Ql)},function(n){return n});var n},Jl=function(n){var e=fe.fromTag(n.tag());ro.setAll(e,n.attributes().getOr({})),Yl(e,n.classes().getOr([])),_i.setAll(e,n.styles().getOr({})),_o(e,n.innerHtml().getOr(""));var t=Kl(n);return Ke(e,t),n.value().each(function(n){Kf(e,n)}),e},Ql=function(n){var e=Mr(n);return Jl(e)},Zl=function(n,e){return t=n,o=yn(r=e,function(n){return lr(n.name(),[ur("config"),mr("state",$r)])}),i=Qt("component.behaviours",_t(o),t.behaviours).fold(function(n){throw new Error(tr(n)+"\nComplete spec:\n"+Bt(t,null,2))},function(n){return n}),{list:r,data:H(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},nd=function(n){var e,t,r=(e=kt(n,"behaviours").getOr({}),t=xn(F(e),function(n){return e[n]!==undefined}),yn(t,function(n){return e[n].me}));return Zl(n,r)},ed=Wr(["getSystem","config","hasConfigured","spec","connect","disconnect","element","syncComponents","readState","components","events"]),td=function(n,e,t){var r,o,i,u,a=ql(n),c=function(e,n,t,r){var o=C({},n);wn(t,function(n){o[n.name()]=n.exhibit(e,r)});var i=Fl(o,function(n,e){return{name:function(){return n},modification:e}}),u=H(i,function(n,e){return An(n,function(e){return e.modification().fold(function(){return[]},function(n){return[e]})})}),a=j(u,function(e,t){return kt(zl,t).fold(function(){return at.error("Unknown field type: "+t)},function(n){return n(e,t)})});return At(a,{}).map(Nr)}(t,{"alloy.base.modification":(r=n,r.domModification().fold(function(){return Nr({})},Nr))},e,a).getOrDie();return i=c,u=C({tag:(o=a).tag(),classes:i.classes().getOr([]).concat(o.classes().getOr([])),attributes:D(o.attributes().getOr({}),i.attributes().getOr({})),styles:D(o.styles().getOr({}),i.styles().getOr({}))},i.innerHtml().or(o.innerHtml()).map(function(n){return Et("innerHtml",n)}).getOr({}),Br("domChildren",i.domChildren(),o.domChildren()),Br("defChildren",i.defChildren(),o.defChildren()),i.value().or(o.value()).map(function(n){return Et("value",n)}).getOr({})),Mr(u)},rd=function(n,e,t){var r,o,i,u,a,c,s={"alloy.base.behaviour":(r=n,r.events())};return(o=t,i=n.eventOrder(),u=e,a=s,c=Pl(o,u,a),$l(c,i)).getOrDie()},od=function(n){var e,t,r,o,i,u,a,c,s,f,l,d,m,g,v=Il(n),p=(e=v,t=Ct("components",[])(e),yn(t,ad)),h=C(Ml,v,Et("components",p));return at.value((r=h,i=So(Bl(o=function(){return g})),u=Zt(Gl(C(r,{behaviours:undefined}))),a=nd(r),c=a.list,s=a.data,f=td(u,c,s),l=Jl(f),d=rd(u,c,s),m=So(u.components()),g=ed({getSystem:i.get,config:function(n){if(n===Xc())return u.apis();if(b(n))throw new Error("Invalid input: only API constant is allowed");var e=s;return(w(e[n.name()])?e[n.name()]:function(){throw new Error("Could not find "+n.name()+" in "+Bt(r,null,2))})()},hasConfigured:function(n){return w(s[n.name()])},spec:E(r),readState:function(n){return s[n]().map(function(n){return n.state.readState()}).getOr("not enabled")},connect:function(n){i.set(n)},disconnect:function(){i.set(Bl(o))},element:E(l),syncComponents:function(){var n=$e.children(l),e=An(n,function(n){return i.get().getByDom(n).fold(function(){return[]},function(n){return[n]})});m.set(e)},components:m.get,events:E(d)})))},id=function(n){var e=fe.fromText(n);return ud({element:e})},ud=function(n){var t=er("external.component",Pt([ur("element"),fr("uid")]),n),e=So(Bl());t.uid().each(function(n){var e;e=t.element(),ro.set(e,Zc,n)});var r=ed({getSystem:e.get,config:B.none,hasConfigured:E(!1),connect:function(n){e.set(n)},disconnect:function(){e.set(Bl(function(){return r}))},element:E(t.element()),spec:E(n),readState:E("No state"),syncComponents:k,components:E([]),events:E({})});return qc(r)},ad=function(e){return(n=e,kt(n,$c)).fold(function(){var n=C({uid:es("")},e);return od(n).getOrDie()},function(n){return n});var n},cd=qc,sd="alloy.item-hover",fd="alloy.item-focus",ld=function(n){(Fo(n.element()).isNone()||Vi.isFocused(n))&&(Vi.isFocused(n)||Vi.focus(n),ie(n,sd,{item:n}))},dd=function(n){ie(n,fd,{item:n})},md=E(sd),gd=E(fd),vd=[ur("data"),ur("components"),ur("dom"),fr("toggling"),mr("itemBehaviours",{}),mr("ignoreFocus",!1),mr("domModification",{}),li("builder",function(n){return{dom:C(n.dom(),{attributes:{role:n.toggling().isSome()?"menuitemcheckbox":"menuitem"}}),behaviours:C(qr([n.toggling().fold(ki.revoke,function(n){return ki.config(C({aria:{mode:"checked"}},n))}),Vi.config({ignore:n.ignoreFocus(),onFocus:function(n){dd(n)}}),uc.config({mode:"execution"}),Ws.config({store:{mode:"memory",initialValue:n.data()}})]),n.itemBehaviours()),events:br([(e=Qn(),r=ue,wr(e,function(e,t){var n=t.event();e.getSystem().getByDom(n.target()).each(function(n){r(e,n,t)})})),Or(_()),wr(G(),ld),wr(Kn(),Vi.focus)]),components:n.components(),domModification:n.domModification(),eventOrder:n.eventOrder()};var e,r}),mr("eventOrder",{})],pd=[ur("dom"),ur("components"),li("builder",function(n){return{dom:n.dom(),components:n.components(),events:br([(e=Kn(),wr(e,function(n,e){e.stop()}))])};var e})],hd=E([Ic({name:"widget",overrides:function(e){return{behaviours:qr([Ws.config({store:{mode:"manual",getValue:function(n){return e.data()},setValue:function(){}}})])}}})]),bd=[ur("uid"),ur("data"),ur("components"),ur("dom"),mr("autofocus",!1),mr("domModification",{}),Wc(hd()),li("builder",function(t){var n=jc(0,t,hd()),e=Lc("item-widget",t,n.internals()),r=function(n){return Uc(n,t,"widget").map(function(n){return uc.focusIn(n),n})},o=function(n,e){return Nu(e.event().target())||t.autofocus()&&e.setSource(n.element()),B.none()};return C({dom:t.dom(),components:e,domModification:t.domModification(),events:br([Dr(function(n,e){r(n).each(function(n){e.stop()})}),wr(G(),ld),wr(Kn(),function(n,e){t.autofocus()?r(n):Vi.focus(n)})]),behaviours:qr([Ws.config({store:{mode:"memory",initialValue:t.data()}}),Vi.config({onFocus:function(n){dd(n)}}),uc.config({mode:"special",focusIn:t.autofocus()?function(n){r(n)}:Jr(),onLeft:o,onRight:o,onEscape:function(n,e){return Vi.isFocused(n)||t.autofocus()?(t.autofocus()&&e.setSource(n.element()),B.none()):(Vi.focus(n),B.some(!0))}})])})})],yd=rr("type",{widget:bd,item:vd,separator:pd}),wd=E([Bc({factory:{sketch:function(n){var e=er("menu.spec item",yd,n);return e.builder()(e)}},name:"items",unit:"item",defaults:function(n,e){var t=es("");return C({uid:t},e)},overrides:function(n,e){return{type:e.type,ignoreFocus:n.fakeFocus(),domModification:{classes:[n.markers().item()]}}}})]),xd=E([ur("value"),ur("items"),ur("dom"),ur("components"),mr("eventOrder",{}),ac("menuBehaviours",[Eu,Ws,qf,uc]),gr("movement",{mode:"menu",moveOnTab:!0},rr("mode",{grid:[mi(),li("config",function(n,e){return{mode:"flatgrid",selector:"."+n.markers().item(),initSize:{numColumns:e.initSize().numColumns(),numRows:e.initSize().numRows()},focusManager:n.focusManager()}})],menu:[mr("moveOnTab",!0),li("config",function(n,e){return{mode:"menu",selector:"."+n.markers().item(),moveOnTab:e.moveOnTab(),focusManager:n.focusManager()}})]})),ar("markers",oi()),mr("fakeFocus",!1),mr("focusManager",Du()),ai("onHighlight")]),Td=E("alloy.menu-focus"),Sd=cs({name:"Menu",configFields:xd(),partFields:wd(),factory:function(n,e,t,r){return C({dom:C(n.dom(),{attributes:{role:"menu"}}),uid:n.uid(),behaviours:C(qr([Eu.config({highlightClass:n.markers().selectedItem(),itemClass:n.markers().item(),onHighlight:n.onHighlight()}),Ws.config({store:{mode:"memory",initialValue:n.value()}}),qf.config({find:B.some}),uc.config(n.movement().config()(n,n.movement()))]),cc(n.menuBehaviours())),events:br([wr(gd(),function(e,t){var n=t.event();e.getSystem().getByDom(n.target()).each(function(n){Eu.highlight(e,n),t.stop(),ie(e,Td(),{menu:e,item:n})})}),wr(md(),function(n,e){var t=e.event().item();Eu.highlight(n,t)})]),components:e,eventOrder:n.eventOrder()})}}),Od=function(n,e,t,r){var o=n.getSystem().build(r);tt(n,o,t)},Cd=function(n,e){return n.components()},kd=Object.freeze({append:function(n,e,t,r){Od(n,0,Ye.append,r)},prepend:function(n,e,t,r){Od(n,0,Ye.prepend,r)},remove:function(n,e,t,r){var o=Cd(n,e);On(o,function(n){return ze(r.element(),n.element())}).each(ot)},set:function(e,n,t,r){var o,i,u,a,c,s;i=(o=e).components(),wn(i,rt),Qe.empty(o.element()),o.syncComponents(),u=function(){var n=yn(r,e.getSystem().build);wn(n,function(n){et(e,n)})},a=e.element(),c=$e.owner(a),s=Bo(c).bind(function(e){var n=function(n){return ze(e,n)};return n(a)?B.some(a):Do.descendant(a,n)}),u(a),s.each(function(e){Bo(c).filter(function(n){return ze(n,e)}).fold(function(){Io(e)},k)})},contents:Cd}),Ed=Xr({fields:[],name:"replacing",apis:kd}),Dd=function(t,r,o,n){return kt(o,n).bind(function(n){return kt(t,n).bind(function(n){var e=Dd(t,r,o,n);return B.some([n].concat(e))})}).getOr([])},Ad=function(n,e){var t={};V(n,function(n,e){wn(n,function(n){t[n]=e})});var r=e,o=z(e,function(n,e){return{k:n,v:e}}),i=H(o,function(n,e){return[e].concat(Dd(t,r,o,e))});return H(t,function(n){return kt(i,n).getOr([n])})},Rd=function(){var i=So({}),u=So({}),a=So({}),c=So(B.none()),s=So({}),n=function(n){return kt(u.get(),n)};return{setContents:function(n,e,t,r){c.set(B.some(n)),i.set(t),u.set(e),s.set(r);var o=Ad(r,t);a.set(o)},expand:function(t){return kt(i.get(),t).map(function(n){var e=kt(a.get(),t).getOr([]);return[n].concat(e)})},refresh:function(n){return kt(a.get(),n)},collapse:function(n){return kt(a.get(),n).bind(function(n){return 1<n.length?B.some(n.slice(1)):B.none()})},lookupMenu:n,otherMenus:function(n){var e,t,r=s.get();return e=F(r),t=n,xn(e,function(n){return!hn(t,n)})},getPrimary:function(){return c.get().bind(n)},getMenus:function(){return u.get()},clear:function(){i.set({}),u.set({}),a.set({}),c.set(B.none())},isClear:function(){return c.get().isNone()}}},Md=E("collapse-item"),Id=as({name:"TieredMenu",configFields:[fi("onExecute"),fi("onEscape"),si("onOpenMenu"),si("onOpenSubmenu"),ai("onCollapseMenu"),mr("openImmediately",!0),sr("data",[ur("primary"),ur("menus"),ur("expansions")]),mr("fakeFocus",!1),ai("onHighlight"),ai("onHover"),sr("markers",[ur("backgroundMenu")].concat(ti()).concat(ri())),ur("dom"),mr("navigateOnHover",!0),mr("stayInDom",!1),ac("tmenuBehaviours",[uc,Eu,qf,Ed]),mr("eventOrder",{})],apis:{collapseMenu:function(n,e){n.collapseMenu(e)}},factory:function(u,o){var i=function(r,n){return H(n,function(n,e){var t=Sd.sketch(C(n,{value:e,items:n.items,markers:Tt(o.markers,["item","selectedItem"]),fakeFocus:u.fakeFocus(),onHighlight:u.onHighlight(),focusManager:u.fakeFocus()?{get:function(n){return Eu.getHighlighted(n).map(function(n){return n.element()})},set:function(e,n){e.getSystem().getByDom(n).fold(k,function(n){Eu.highlight(e,n)})}}:Du()}));return r.getSystem().build(t)})},a=Rd(),c=function(n){return Ws.getValue(n).value},s=function(n){return H(u.data().menus(),function(n,e){return An(n.items,function(n){return"separator"===n.type?[]:[n.data.value]})})},f=function(e,n){Eu.highlight(e,n),Eu.getHighlighted(n).orThunk(function(){return Eu.getFirst(n)}).each(function(n){ae(e,n.element(),Kn())})},l=function(n,e){return Xo(yn(e,n.lookupMenu))},d=function(r,o,i){return B.from(i[0]).bind(o.lookupMenu).map(function(n){var e=l(o,i.slice(1));wn(e,function(n){bo.add(n.element(),u.markers().backgroundMenu())}),xe.inBody(n.element())||Ed.append(r,cd(n)),Xl(n.element(),[u.markers().backgroundMenu()]),f(r,n);var t=l(o,o.otherMenus(i));return wn(t,function(n){Xl(n.element(),[u.markers().backgroundMenu()]),u.stayInDom()||Ed.remove(r,n)}),n})},m=function(e,t){var n=c(t);return a.expand(n).bind(function(n){return B.from(n[0]).bind(a.lookupMenu).each(function(n){xe.inBody(n.element())||Ed.append(e,cd(n)),u.onOpenSubmenu()(e,t,n),Eu.highlightFirst(n)}),d(e,a,n)})},r=function(e,t){var n=c(t);return a.collapse(n).bind(function(n){return d(e,a,n).map(function(n){return u.onCollapseMenu()(e,t,n),n})})},n=function(t){return function(e,n){return iu(n.getSource(),"."+u.markers().item()).bind(function(n){return e.getSystem().getByDom(n).toOption().bind(function(n){return t(e,n).map(function(){return!0})})})}},e=br([wr(Td(),function(n,e){var t=e.event().menu();Eu.highlight(n,t)}),Dr(function(e,n){var t=n.event().target();e.getSystem().getByDom(t).each(function(n){0===c(n).indexOf("collapse-item")&&r(e,n),m(e,n).fold(function(){u.onExecute()(e,n)},function(){})})}),Cr(function(e,n){var t,r,o;(t=e,r=i(t,u.data().menus()),o=s(t),a.setContents(u.data().primary(),r,u.data().expansions(),o),a.getPrimary()).each(function(n){Ed.append(e,cd(n)),u.openImmediately()&&(f(e,n),u.onOpenMenu()(e,n))})})].concat(u.navigateOnHover()?[wr(md(),function(n,e){var t,r,o=e.event().item();t=n,r=c(o),a.refresh(r).bind(function(n){return d(t,a,n)}),m(n,o),u.onHover()(n,o)})]:[]));return{uid:u.uid(),dom:u.dom(),behaviours:C(qr([uc.config({mode:"special",onRight:n(function(n,e){return Nu(e.element())?B.none():m(n,e)}),onLeft:n(function(n,e){return Nu(e.element())?B.none():r(n,e)}),onEscape:n(function(n,e){return r(n,e).orThunk(function(){return u.onEscape()(n,e).map(function(){return n})})}),focusIn:function(e,n){a.getPrimary().each(function(n){ae(e,n.element(),Kn())})}}),Eu.config({highlightClass:u.markers().selectedMenu(),itemClass:u.markers().menu()}),qf.config({find:function(n){return Eu.getHighlighted(n)}}),Ed.config({})]),cc(u.tmenuBehaviours())),eventOrder:u.eventOrder(),apis:{collapseMenu:function(e){Eu.getHighlighted(e).each(function(n){Eu.getHighlighted(n).each(function(n){r(e,n)})})}},events:e}},extraApis:{tieredData:function(n,e,t){return{primary:n,menus:e,expansions:t}},singleData:function(n,e){return{primary:n,menus:Et(n,e),expansions:{}}},collapseItem:function(n){return{value:bc(Md()),text:n}}}}),Nd=function(n,e,t,r){return kt(e.routes(),r.start()).map(s).bind(function(n){return kt(n,r.destination()).map(s)})},Bd=function(n,e,t,r){return Nd(0,e,0,r).bind(function(e){return e.transition().map(function(n){return{transition:E(n),route:E(e)}})})},Fd=function(t,r,n){var e,o,i;(e=t,o=r,i=n,Vd(e,o,i).bind(function(n){return Bd(e,o,i,n)})).each(function(n){var e=n.transition();bo.remove(t.element(),e.transitionClass()),ro.remove(t.element(),r.destinationAttr())})},Vd=function(n,e,t){var r=n.element();return ro.has(r,e.destinationAttr())?B.some({start:E(ro.get(n.element(),e.stateAttr())),destination:E(ro.get(n.element(),e.destinationAttr()))}):B.none()},Hd=function(n,e,t,r){Fd(n,e,t),ro.has(n.element(),e.stateAttr())&&ro.get(n.element(),e.stateAttr())!==r&&e.onFinish()(n,r),ro.set(n.element(),e.stateAttr(),r)},zd=Object.freeze({findRoute:Nd,disableTransition:Fd,getCurrentRoute:Vd,jumpTo:Hd,progressTo:function(t,r,o,i){var n,e;e=r,ro.has((n=t).element(),e.destinationAttr())&&(ro.set(n.element(),e.stateAttr(),ro.get(n.element(),e.destinationAttr())),ro.remove(n.element(),e.destinationAttr()));var u,a,c=(u=r,a=i,{start:E(ro.get(t.element(),u.stateAttr())),destination:E(a)});Bd(t,r,o,c).fold(function(){Hd(t,r,o,i)},function(n){Fd(t,r,o);var e=n.transition();bo.add(t.element(),e.transitionClass()),ro.set(t.element(),r.destinationAttr(),i)})},getState:function(n,e,t){var r=n.element();return ro.has(r,e.stateAttr())?B.some(ro.get(r,e.stateAttr())):B.none()}}),jd=Object.freeze({events:function(o,i){return br([wr(J(),function(t,n){var r=n.event().raw();Vd(t,o,i).each(function(e){Nd(0,o,0,e).each(function(n){n.transition().each(function(n){r.propertyName===n.property()&&(Hd(t,o,i,e.destination()),o.onTransition()(t,e))})})})}),Cr(function(n,e){Hd(n,o,i,o.initialState())})])}}),Ld=[mr("destinationAttr","data-transitioning-destination"),mr("stateAttr","data-transitioning-state"),ur("initialState"),ai("onTransition"),ai("onFinish"),ar("routes",Wt(at.value,Wt(at.value,Pt([dr("transition",[ur("property"),ur("transitionClass")])]))))],Ud=Xr({fields:Ld,name:"transitioning",active:jd,apis:zd,extra:{createRoutes:function(n){var r={};return V(n,function(n,e){var t=e.split("<->");r[t[0]]=Et(t[1],n),r[t[1]]=Et(t[0],n)}),r},createBistate:function(n,e,t){return Dt([{key:n,value:Et(e,t)},{key:e,value:Et(n,t)}])},createTristate:function(n,e,t,r){return Dt([{key:n,value:Dt([{key:e,value:r},{key:t,value:r}])},{key:e,value:Dt([{key:n,value:r},{key:t,value:r}])},{key:t,value:Dt([{key:n,value:r},{key:e,value:r}])}])}}}),Pd=Mi.resolve("scrollable"),_d={register:function(n){bo.add(n,Pd)},deregister:function(n){bo.remove(n,Pd)},scrollable:E(Pd)},Wd=function(n){return kt(n,"format").getOr(n.title)},$d=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:qr(o?[]:[Ei(n,function(n,e){(e?ki.on:ki.off)(n)})]),components:[{dom:{tag:"div",attributes:{style:r},innerHtml:e}}]}},Gd=function(n,e,t,r){return{value:n,dom:{tag:"div"},components:[ss.sketch({dom:{tag:"div",classes:[Mi.resolve("styles-collapser")]},components:r?[{dom:{tag:"span",classes:[Mi.resolve("styles-collapse-icon")]}},id(n)]:[id(n)],action:function(n){if(r){var e=t().get(n);Id.collapseMenu(e)}}}),{dom:{tag:"div",classes:[Mi.resolve("styles-menu-items-container")]},components:[Sd.parts().items({})],behaviours:qr([Wf("adhoc-scrollable-menu",[Cr(function(n,e){_i.set(n.element(),"overflow-y","auto"),_i.set(n.element(),"-webkit-overflow-scrolling","touch"),_d.register(n.element())}),kr(function(n){_i.remove(n.element(),"overflow-y"),_i.remove(n.element(),"-webkit-overflow-scrolling"),_d.deregister(n.element())})])])}],items:e,menuBehaviours:qr([Ud.config({initialState:"after",routes:Ud.createTristate("before","current","after",{transition:{property:"transform",transitionClass:"transitioning"}})})])}},qd=function(r){var o,i,n,e,t,u=(o=r.formats,i=function(){return a},n=Gd("Styles",[].concat(yn(o.items,function(n){return $d(Wd(n),n.title,n.isSelected(),n.getPreview(),Rt(o.expansions,Wd(n)))})),i,!1),e=H(o.menus,function(n,e){var t=yn(n,function(n){return $d(Wd(n),n.title,n.isSelected!==undefined&&n.isSelected(),n.getPreview!==undefined?n.getPreview():"",Rt(o.expansions,Wd(n)))});return Gd(e,t,i,!0)}),t=C(e,Et("styles",n)),{tmenu:Id.tieredData("styles",t,o.expansions)}),a=sf(Id.sketch({dom:{tag:"div",classes:[Mi.resolve("styles-menu")]},components:[],fakeFocus:!0,stayInDom:!0,onExecute:function(n,e){var t=Ws.getValue(e);return r.handle(e,t.value),B.none()},onEscape:function(){return B.none()},onOpenMenu:function(n,e){var t=Xs(n.element());Ys(e.element(),t),Ud.jumpTo(e,"current")},onOpenSubmenu:function(n,e,t){var r=Xs(n.element()),o=ru(e.element(),'[role="menu"]').getOrDie("hacky"),i=n.getSystem().getByDom(o).getOrDie();Ys(t.element(),r),Ud.progressTo(i,"before"),Ud.jumpTo(t,"after"),Ud.progressTo(t,"current")},onCollapseMenu:function(n,e,t){var r=ru(e.element(),'[role="menu"]').getOrDie("hacky"),o=n.getSystem().getByDom(r).getOrDie();Ud.progressTo(o,"after"),Ud.progressTo(t,"current")},navigateOnHover:!1,openImmediately:!0,data:u.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 a.asSpec()},Yd=function(n){return Rt(n,"items")?(t=C(St(e=n,["items"]),{menu:!0}),r=Xd(e.items),{item:t,menus:C(r.menus,Et(e.title,r.items)),expansions:C(r.expansions,Et(e.title,e.title))}):{item:n,menus:{},expansions:{}};var e,t,r},Xd=function(n){return Tn(n,function(n,e){var t=Yd(e);return{menus:C(n.menus,t.menus),items:[t.item].concat(n.items),expansions:C(n.expansions,t.expansions)}},{menus:{},expansions:{},items:[]})},Kd={expand:Xd},Jd=function(u,n){var a=function(n){return function(){return u.formatter.match(n)}},c=function(n){return function(){return u.formatter.getCssText(n)}},e=kt(n,"style_formats").getOr(Al),s=function(n){return yn(n,function(n){if(Rt(n,"items")){var e=s(n.items);return C(C(n,{isSelected:E(!1),getPreview:E("")}),{items:e})}return Rt(n,"format")?C(i=n,{isSelected:a(i.format),getPreview:c(i.format)}):(r=bc((t=n).title),o=C(t,{format:r,isSelected:a(r),getPreview:c(r)}),u.formatter.register(r,o),o);var t,r,o,i})};return s(e)},Qd=function(t,n,r){var e,o,i,u=(e=t,i=(o=function(n){return An(n,function(n){return n.items!==undefined?0<o(n.items).length?[n]:[]:!Rt(n,"format")||e.formatter.canApply(n.format)?[n]:[]})})(n),Kd.expand(i));return qd({formats:u,handle:function(n,e){t.undoManager.transact(function(){ki.isOn(n)?t.formatter.remove(e):t.formatter.apply(e)}),r()}})},Zd=["undo","bold","italic","link","image","bullist","styleselect"],nm=function(n){var e=n.replace(/\|/g," ").trim();return 0<e.length?e.split(/\s+/):[]},em=function(n){return An(n,function(n){return p(n)?em(n):nm(n)})},tm=function(n){var e=n.toolbar!==undefined?n.toolbar:Zd;return p(e)?em(e):nm(e)},rm=function(r,o){var n=function(n){return function(){return hs.forToolbarCommand(o,n)}},e=function(n){return function(){return hs.forToolbarStateCommand(o,n)}},t=function(n,e,t){return function(){return hs.forToolbarStateAction(o,n,e,t)}},i=n("undo"),u=n("redo"),a=e("bold"),c=e("italic"),s=e("underline"),f=n("removeformat"),l=t("unlink","link",function(){o.execCommand("unlink",null,!1)}),d=t("unordered-list","ul",function(){o.execCommand("InsertUnorderedList",null,!1)}),m=t("ordered-list","ol",function(){o.execCommand("InsertOrderedList",null,!1)}),g=Jd(o,o.settings),v=function(){return Qd(o,g,function(){o.fire("scrollIntoView")})},p=function(n,e){return{isSupported:function(){return n.forall(function(n){return Rt(o.buttons,n)})},sketch:e}};return{undo:p(B.none(),i),redo:p(B.none(),u),bold:p(B.none(),a),italic:p(B.none(),c),underline:p(B.none(),s),removeformat:p(B.none(),f),link:p(B.none(),function(){return e=r,t=o,hs.forToolbarStateAction(t,"link","link",function(){var n=Dl(e,t);e.setContextToolbar(n),_f(t,function(){e.focusToolbar()}),Lf.query(t).each(function(n){t.selection.select(n.dom())})});var e,t}),unlink:p(B.none(),l),image:p(B.none(),function(){return Nf(o)}),bullist:p(B.some("bullist"),d),numlist:p(B.some("numlist"),m),fontsizeselect:p(B.none(),function(){return e=o,n={onChange:function(n){uf.apply(e,n)},getInitialValue:function(){return uf.get(e)}},Qs(r,"font-size",function(){return cf(n)});var e,n}),forecolor:p(B.none(),function(){return nf(r,o)}),styleselect:p(B.none(),function(){return hs.forToolbar("style-formats",function(n){o.fire("toReading"),r.dropup().appear(v,ki.on,n)},qr([ki.config({toggleClass:Mi.resolve("toolbar-button-selected"),toggleOnExecute:!1,aria:{mode:"pressed"}}),vi.config({channels:Dt([Ai(jo.orientationChanged(),ki.off),Ai(jo.dropupDismissed(),ki.off)])})]))})}},om=function(n,t){var e=tm(n),r={};return An(e,function(n){var e=!Rt(r,n)&&Rt(t,n)&&t[n].isSupported()?[t[n].sketch()]:[];return r[n]=!0,e})},im=function(m,g){return function(n){if(m(n)){var e,t,r,o,i,u,a,c=fe.fromDom(n.target),s=function(){n.stopPropagation()},f=function(){n.preventDefault()},l=v(f,s),d=(e=c,t=n.clientX,r=n.clientY,o=s,i=f,u=l,a=n,{target:E(e),x:E(t),y:E(r),stop:o,prevent:i,kill:u,raw:E(a)});g(d)}}},um=function(n,e,t,r,o){var i=im(t,r);return n.dom().addEventListener(e,i,o),{unbind:l(am,n,e,i,o)}},am=function(n,e,t,r){n.dom().removeEventListener(e,t,r)},cm=function(n,e,t,r){return um(n,e,t,r,!1)},sm=function(n,e,t,r){return um(n,e,t,r,!0)},fm=E(!0),lm=function(n,e,t){return cm(n,e,fm,t)},dm=function(n,e,t){return sm(n,e,fm,t)},mm=function(n){var e=n.matchMedia("(orientation: portrait)").matches;return{isPortrait:E(e)}},gm=mm,vm=function(r,e){var n=fe.fromDom(r),o=null,t=lm(n,"orientationchange",function(){clearInterval(o);var n=mm(r);e.onChange(n),i(function(){e.onReady(n)})}),i=function(n){clearInterval(o);var e=r.innerHeight,t=0;o=setInterval(function(){e!==r.innerHeight?(clearInterval(o),n(B.some(r.innerHeight))):20<t&&(clearInterval(o),n(B.none())),t++},50)};return{onAdjustment:i,destroy:function(){t.unbind()}}},pm=function(n){var e=Wn.detect().os.isiOS(),t=mm(n).isPortrait();return e&&!t?n.screen.height:n.screen.width},hm=function(n){var e=n.raw();return e.touches===undefined||1!==e.touches.length?B.none():B.some(e.touches[0])},bm=function(t){var r,o,i,u=So(B.none()),a=(r=function(n){u.set(B.none()),t.triggerEvent(Zn(),n)},o=400,i=null,{cancel:function(){null!==i&&(clearTimeout(i),i=null)},schedule:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];i=setTimeout(function(){r.apply(null,n),i=null},o)}}),c=Dt([{key:L(),value:function(t){return hm(t).each(function(n){a.cancel();var e={x:E(n.clientX),y:E(n.clientY),target:t.target};a.schedule(t),u.set(B.some(e))}),B.none()}},{key:U(),value:function(n){return a.cancel(),hm(n).each(function(i){u.get().each(function(n){var e,t,r,o;e=i,t=n,r=Math.abs(e.clientX-t.x()),o=Math.abs(e.clientY-t.y()),(5<r||5<o)&&u.set(B.none())})}),B.none()}},{key:P(),value:function(e){return a.cancel(),u.get().filter(function(n){return ze(n.target(),e.target())}).map(function(n){return t.triggerEvent(Jn(),e)})}}]);return{fireIfReady:function(e,n){return kt(c,n).bind(function(n){return n(e)})}}},ym=function(t){var e=bm({triggerEvent:function(n,e){t.onTapContent(e)}});return{fireTouchstart:function(n){e.fireIfReady(n,"touchstart")},onTouchend:function(){return lm(t.body(),"touchend",function(n){e.fireIfReady(n,"touchend")})},onTouchmove:function(){return lm(t.body(),"touchmove",function(n){e.fireIfReady(n,"touchmove")})}}},wm=6<=Wn.detect().os.version.major,xm=function(r,e,t){var o=ym(r),i=$e.owner(e),u=function(n){return!ze(n.start(),n.finish())||n.soffset()!==n.foffset()},n=function(){var n=r.doc().dom().hasFocus()&&r.getSelection().exists(u);t.getByDom(e).each(!0===(n||Bo(i).filter(function(n){return"input"===be.name(n)}).exists(function(n){return n.dom().selectionStart!==n.dom().selectionEnd}))?ki.on:ki.off)},a=[lm(r.body(),"touchstart",function(n){r.onTouchContent(),o.fireTouchstart(n)}),o.onTouchmove(),o.onTouchend(),lm(e,"touchstart",function(n){r.onTouchToolstrip()}),r.onToReading(function(){No(r.body())}),r.onToEditing(k),r.onScrollToCursor(function(n){n.preventDefault(),r.getCursorBox().each(function(n){var e=r.win(),t=n.top()>e.innerHeight||n.bottom()>e.innerHeight?n.bottom()-e.innerHeight+50:0;0!==t&&e.scrollTo(e.pageXOffset,e.pageYOffset+t)})})].concat(!0===wm?[]:[lm(fe.fromDom(r.win()),"blur",function(){t.getByDom(e).each(ki.off)}),lm(i,"select",n),lm(r.doc(),"selectionchange",n)]);return{destroy:function(){wn(a,function(n){n.unbind()})}}},Tm=function(n,e){var t=parseInt(ro.get(n,e),10);return isNaN(t)?0:t},Sm=(Cf=be.isText,kf="text",Ef=function(n){return Cf(n)?B.from(n.dom().nodeValue):B.none()},Df=Wn.detect().browser,{get:function(n){if(!Cf(n))throw new Error("Can only get "+kf+" value of a "+kf+" node");return Af(n).getOr("")},getOption:Af=Df.isIE()&&10===Df.version.major?function(n){try{return Ef(n)}catch(e){return B.none()}}:Ef,set:function(n,e){if(!Cf(n))throw new Error("Can only set raw "+kf+" value of a "+kf+" node");n.dom().nodeValue=e}}),Om=function(n){return Sm.getOption(n)},Cm=function(n){return"img"===be.name(n)?1:Om(n).fold(function(){return $e.children(n).length},function(n){return n.length})},km=Cm,Em=ct([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Dm={before:Em.before,on:Em.on,after:Em.after,cata:function(n,e,t,r){return n.fold(e,t,r)},getStart:function(n){return n.fold(h,h,h)}},Am=ct([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Rm=Te("start","soffset","finish","foffset"),Mm={domRange:Am.domRange,relative:Am.relative,exact:Am.exact,exactFromRange:function(n){return Am.exact(n.start(),n.soffset(),n.finish(),n.foffset())},range:Rm,getWin:function(n){var e=n.match({domRange:function(n){return fe.fromDom(n.startContainer)},relative:function(n,e){return Dm.getStart(n)},exact:function(n,e,t,r){return n}});return $e.defaultView(e)}},Im=function(n,e,t,r){var o=$e.owner(n).dom().createRange();return o.setStart(n.dom(),e),o.setEnd(t.dom(),r),o},Nm=function(n,e,t,r){var o=Im(n,e,t,r),i=ze(n,t)&&e===r;return o.collapsed&&!i},Bm=function(n,e){n.selectNodeContents(e.dom())},Fm=function(n){n.deleteContents()},Vm=function(n){return{left:E(n.left),top:E(n.top),right:E(n.right),bottom:E(n.bottom),width:E(n.width),height:E(n.height)}},Hm={create:function(n){return n.document.createRange()},replaceWith:function(n,e){Fm(n),n.insertNode(e.dom())},selectNodeContents:function(n,e){var t=n.document.createRange();return Bm(t,e),t},selectNodeContentsUsing:Bm,relativeToNative:function(n,e,t){var r,o,i=n.document.createRange();return r=i,e.fold(function(n){r.setStartBefore(n.dom())},function(n,e){r.setStart(n.dom(),e)},function(n){r.setStartAfter(n.dom())}),o=i,t.fold(function(n){o.setEndBefore(n.dom())},function(n,e){o.setEnd(n.dom(),e)},function(n){o.setEndAfter(n.dom())}),i},exactToNative:function(n,e,t,r,o){var i=n.document.createRange();return i.setStart(e.dom(),t),i.setEnd(r.dom(),o),i},deleteContents:Fm,cloneFragment:function(n){var e=n.cloneContents();return fe.fromDom(e)},getFirstRect:function(n){var e=n.getClientRects(),t=0<e.length?e[0]:n.getBoundingClientRect();return 0<t.width||0<t.height?B.some(t).map(Vm):B.none()},getBounds:function(n){var e=n.getBoundingClientRect();return 0<e.width||0<e.height?B.some(e).map(Vm):B.none()},isWithin:function(n,e){return e.compareBoundaryPoints(n.END_TO_START,n)<1&&-1<e.compareBoundaryPoints(n.START_TO_END,n)},toString:function(n){return n.toString()}},zm=ct([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),jm=function(n,e,t){return e(fe.fromDom(t.startContainer),t.startOffset,fe.fromDom(t.endContainer),t.endOffset)},Lm=function(n,e){var o,t,r,i=(o=n,e.match({domRange:function(n){return{ltr:E(n),rtl:B.none}},relative:function(n,e){return{ltr:Z(function(){return Hm.relativeToNative(o,n,e)}),rtl:Z(function(){return B.some(Hm.relativeToNative(o,e,n))})}},exact:function(n,e,t,r){return{ltr:Z(function(){return Hm.exactToNative(o,n,e,t,r)}),rtl:Z(function(){return B.some(Hm.exactToNative(o,t,r,n,e))})}}}));return(r=(t=i).ltr()).collapsed?t.rtl().filter(function(n){return!1===n.collapsed}).map(function(n){return zm.rtl(fe.fromDom(n.endContainer),n.endOffset,fe.fromDom(n.startContainer),n.startOffset)}).getOrThunk(function(){return jm(0,zm.ltr,r)}):jm(0,zm.ltr,r)},Um=(zm.ltr,zm.rtl,Lm),Pm=function(i,n){return Lm(i,n).match({ltr:function(n,e,t,r){var o=i.document.createRange();return o.setStart(n.dom(),e),o.setEnd(t.dom(),r),o},rtl:function(n,e,t,r){var o=i.document.createRange();return o.setStart(t.dom(),r),o.setEnd(n.dom(),e),o}})},_m=(document.caretPositionFromPoint||document.caretRangeFromPoint,function(n,e){var t=be.name(n);return"input"===t?Dm.after(n):hn(["br","img"],t)?0===e?Dm.before(n):Dm.after(n):Dm.on(n,e)}),Wm=function(n,e,t,r){var o=_m(n,e),i=_m(t,r);return Mm.relative(o,i)},$m=Wm,Gm=function(n,e){B.from(n.getSelection()).each(function(n){n.removeAllRanges(),n.addRange(e)})},qm=function(n,e,t,r,o){var i=Hm.exactToNative(n,e,t,r,o);Gm(n,i)},Ym=function(l,n){return Um(l,n).match({ltr:function(n,e,t,r){qm(l,n,e,t,r)},rtl:function(n,e,t,r){var o,i,u,a,c,s=l.getSelection();if(s.setBaseAndExtent)s.setBaseAndExtent(n.dom(),e,t.dom(),r);else if(s.extend)try{i=n,u=e,a=t,c=r,(o=s).collapse(i.dom(),u),o.extend(a.dom(),c)}catch(f){qm(l,t,r,n,e)}else qm(l,t,r,n,e)}})},Xm=function(n){var e=fe.fromDom(n.anchorNode),t=fe.fromDom(n.focusNode);return Nm(e,n.anchorOffset,t,n.focusOffset)?B.some(Mm.range(fe.fromDom(n.anchorNode),n.anchorOffset,fe.fromDom(n.focusNode),n.focusOffset)):function(n){if(0<n.rangeCount){var e=n.getRangeAt(0),t=n.getRangeAt(n.rangeCount-1);return B.some(Mm.range(fe.fromDom(e.startContainer),e.startOffset,fe.fromDom(t.endContainer),t.endOffset))}return B.none()}(n)},Km=function(n){return B.from(n.getSelection()).filter(function(n){return 0<n.rangeCount}).bind(Xm)},Jm=function(n,e,t,r,o){var i=$m(e,t,r,o);Ym(n,i)},Qm=Km,Zm=function(n){return Km(n).map(function(n){return Mm.exact(n.start(),n.soffset(),n.finish(),n.foffset())})},ng=function(n){n.getSelection().removeAllRanges()},eg=function(n,e){var t=Pm(n,e);return Hm.getFirstRect(t)},tg=function(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom,width:E(2),height:n.height}},rg=function(n){return{left:E(n.left),top:E(n.top),right:E(n.right),bottom:E(n.bottom),width:E(n.width),height:E(n.height)}},og=function(n){var e=n.getSelection();return e!==undefined&&0<e.rangeCount?function(t){if(t.collapsed){var r=fe.fromDom(t.startContainer);return $e.parent(r).bind(function(n){var e=Mm.exact(r,t.startOffset,n,km(n));return eg(t.startContainer.ownerDocument.defaultView,e).map(tg).map(Nn)}).getOr([])}return yn(t.getClientRects(),rg)}(e.getRangeAt(0)):[]},ig=function(n){n.focus();var e=fe.fromDom(n.document.body);(Bo().exists(function(n){return hn(["input","textarea"],be.name(n))})?function(n){setTimeout(function(){n()},0)}:s)(function(){Bo().each(No),Io(e)})},ug="data-"+Mi.resolve("last-outer-height"),ag=function(n,e){ro.set(n,ug,e)},cg=function(n){return{top:E(n.top()),bottom:E(n.top()+n.height())}},sg=function(n,e){var t=Tm(e,ug),r=n.innerHeight;return r<t?B.some(t-r):B.none()},fg=function(n,u){var e=fe.fromDom(u.document.body),t=lm(fe.fromDom(n),"resize",function(){sg(n,e).each(function(i){var n,e;(n=u,e=og(n),0<e.length?B.some(e[0]).map(cg):B.none()).each(function(n){var e,t,r,o=(e=u,r=i,(t=n).top()>e.innerHeight||t.bottom()>e.innerHeight?Math.min(r,t.bottom()-e.innerHeight+50):0);0!==o&&u.scrollTo(u.pageXOffset,u.pageYOffset+o)})}),ag(e,n.innerHeight)});return ag(e,n.innerHeight),{toEditing:function(){ig(u)},destroy:function(){t.unbind()}}},lg=function(n){return B.some(fe.fromDom(n.dom().contentWindow.document.body))},dg=function(n){return B.some(fe.fromDom(n.dom().contentWindow.document))},mg=function(n){return B.from(n.dom().contentWindow)},gg=function(n){return mg(n).bind(Qm)},vg=function(n){return n.getFrame()},pg=function(n,t){return function(e){return e[n].getOrThunk(function(){var n=vg(e);return function(){return t(n)}})()}},hg=function(n,e,t,r){return n[t].getOrThunk(function(){return function(n){return lm(e,r,n)}})},bg=function(n){return{left:E(n.left),top:E(n.top),right:E(n.right),bottom:E(n.bottom),width:E(n.width),height:E(n.height)}},yg={getBody:pg("getBody",lg),getDoc:pg("getDoc",dg),getWin:pg("getWin",mg),getSelection:pg("getSelection",gg),getFrame:vg,getActiveApi:function(a){var c=vg(a);return lg(c).bind(function(u){return dg(c).bind(function(i){return mg(c).map(function(o){var n=fe.fromDom(i.dom().documentElement),e=a.getCursorBox.getOrThunk(function(){return function(){return Zm(o).bind(function(n){return eg(o,n).orThunk(function(){return Qm(o).filter(function(n){return ze(n.start(),n.finish())&&n.soffset()===n.foffset()}).bind(function(n){var e=n.start().dom().getBoundingClientRect();return 0<e.width||0<e.height?B.some(e).map(bg):B.none()})})})}}),t=a.setSelection.getOrThunk(function(){return function(n,e,t,r){Jm(o,n,e,t,r)}}),r=a.clearSelection.getOrThunk(function(){return function(){ng(o)}});return{body:E(u),doc:E(i),win:E(o),html:E(n),getSelection:l(gg,c),setSelection:t,clearSelection:r,frame:E(c),onKeyup:hg(a,i,"onKeyup","keyup"),onNodeChanged:hg(a,i,"onNodeChanged","selectionchange"),onDomChanged:a.onDomChanged,onScrollToCursor:a.onScrollToCursor,onScrollToElement:a.onScrollToElement,onToReading:a.onToReading,onToEditing:a.onToEditing,onToolbarScrollStart:a.onToolbarScrollStart,onTouchContent:a.onTouchContent,onTapContent:a.onTapContent,onTouchToolstrip:a.onTouchToolstrip,getCursorBox:e}})})})}},wg="data-ephox-mobile-fullscreen-style",xg="position:absolute!important;",Tg="top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;",Sg=Wn.detect().os.isAndroid(),Og=function(n,e){var t,r,o=function(r){return function(n){var e=ro.get(n,"style"),t=e===undefined?"no-styles":e.trim();t!==r&&(ro.set(n,wg,t),ro.set(n,"style",r))}},i=Qi(n,"*"),u=An(i,function(n){return Zi(n,"*")}),a=(t=e,(r=_i.get(t,"background-color"))!==undefined&&""!==r?"background-color:"+r+"!important":"background-color:rgb(255,255,255)!important;");wn(u,o("display:none!important;")),wn(i,o(xg+Tg+a)),o((!0===Sg?"":xg)+Tg+a)(n)},Cg=function(){var n=Ji("["+wg+"]");wn(n,function(n){var e=ro.get(n,wg);"no-styles"!==e?ro.set(n,"style",e):ro.remove(n,"style"),ro.remove(n,wg)})},kg=function(){var e=tu("head").getOrDie(),n=tu('meta[name="viewport"]').getOrThunk(function(){var n=fe.fromTag("meta");return ro.set(n,"name","viewport"),Ye.append(e,n),n}),t=ro.get(n,"content");return{maximize:function(){ro.set(n,"content","width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0")},restore:function(){t!==undefined&&null!==t&&0<t.length?ro.set(n,"content",t):ro.set(n,"content","user-scalable=yes")}}},Eg=function(e,n){var t=kg(),r=Tl(),o=Tl();return{enter:function(){n.hide(),bo.add(e.container,Mi.resolve("fullscreen-maximized")),bo.add(e.container,Mi.resolve("android-maximized")),t.maximize(),bo.add(e.body,Mi.resolve("android-scroll-reload")),r.set(fg(e.win,yg.getWin(e.editor).getOrDie("no"))),yg.getActiveApi(e.editor).each(function(n){Og(e.container,n.body()),o.set(xm(n,e.toolstrip,e.alloy))})},exit:function(){t.restore(),n.show(),bo.remove(e.container,Mi.resolve("fullscreen-maximized")),bo.remove(e.container,Mi.resolve("android-maximized")),Cg(),bo.remove(e.body,Mi.resolve("android-scroll-reload")),o.clear(),r.clear()}}},Dg=function(t,r){var o=null;return{cancel:function(){null!==o&&(clearTimeout(o),o=null)},throttle:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];null!==o&&clearTimeout(o),o=setTimeout(function(){t.apply(null,n),o=null},r)}}},Ag=function(n,e){var t,r,o,i=sf(Yf.sketch({dom:ms('<div aria-hidden="true" class="${prefix}-mask-tap-icon"></div>'),containerBehaviours:qr([ki.config({toggleClass:Mi.resolve("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<arguments.length;e++)n[e]=arguments[e];null===o&&(o=setTimeout(function(){t.apply(null,n),o=null},r))}});return Yf.sketch({dom:ms('<div class="${prefix}-disabled-mask"></div>'),components:[Yf.sketch({dom:ms('<div class="${prefix}-content-container"></div>'),components:[ss.sketch({dom:ms('<div class="${prefix}-content-tap-section"></div>'),components:[i.asSpec()],action:function(n){u.throttle()},buttonBehaviours:qr([ki.config({toggleClass:Mi.resolve("mask-tap-icon-selected")})])})]})]})},Rg=_t([sr("editor",[ur("getFrame"),fr("getBody"),fr("getDoc"),fr("getWin"),fr("getSelection"),fr("setSelection"),fr("clearSelection"),fr("cursorSaver"),fr("onKeyup"),fr("onNodeChanged"),fr("getCursorBox"),ur("onDomChanged"),mr("onTouchContent",k),mr("onTapContent",k),mr("onTouchToolstrip",k),mr("onScrollToCursor",E({unbind:k})),mr("onScrollToElement",E({unbind:k})),mr("onToEditing",E({unbind:k})),mr("onToReading",E({unbind:k})),mr("onToolbarScrollStart",h)]),ur("socket"),ur("toolstrip"),ur("dropup"),ur("toolbar"),ur("container"),ur("alloy"),vr("win",function(n){return $e.owner(n.socket).dom().defaultView}),vr("body",function(n){return fe.fromDom(n.socket.dom().ownerDocument.body)}),mr("translate",h),mr("setReadOnly",k),mr("readOnlyOnInit",E(!0))]),Mg=function(n){var e=nr("Getting AndroidWebapp schema",Rg,n);_i.set(e.toolstrip,"width","100%");var t=ad(Ag(function(){e.setReadOnly(e.readOnlyOnInit()),o.enter()},e.translate));e.alloy.add(t);var r={show:function(){e.alloy.add(t)},hide:function(){e.alloy.remove(t)}};Ye.append(e.container,t.element());var o=Eg(e,r);return{setReadOnly:e.setReadOnly,refreshStructure:k,enter:o.enter,exit:o.exit,destroy:k}},Ig=E([mr("shell",!0),ac("toolbarBehaviours",[Ed])]),Ng=E([Nc({name:"groups",overrides:function(n){return{behaviours:qr([Ed.config({})])}}})]),Bg=cs({name:"Toolbar",configFields:Ig(),partFields:Ng(),factory:function(e,n,t,r){var o=function(n){return e.shell()?B.some(n):Uc(n,e,"groups")},i=e.shell()?{behaviours:[Ed.config({})],components:[]}:{behaviours:[],components:n};return{uid:e.uid(),dom:e.dom(),components:i.components,behaviours:C(qr(i.behaviours),cc(e.toolbarBehaviours())),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){Ed.set(n,e)})}},domModification:{attributes:{role:"group"}}}},apis:{setGroups:function(n,e,t){n.setGroups(e,t)}}}),Fg=E([ur("items"),(Rf=["itemClass"],sr("markers",yn(Rf,ur))),ac("tgroupBehaviours",[uc])]),Vg=E([Bc({name:"items",unit:"item",overrides:function(n){return{domModification:{classes:[n.markers().itemClass()]}}}})]),Hg=cs({name:"ToolbarGroup",configFields:Fg(),partFields:Vg(),factory:function(n,e,t,r){return C({dom:{attributes:{role:"toolbar"}}},{uid:n.uid(),dom:n.dom(),components:e,behaviours:C(qr([uc.config({mode:"flow",selector:"."+n.markers().itemClass()})]),cc(n.tgroupBehaviours())),"debug.sketcher":t["debug.sketcher"]})}}),zg="data-"+Mi.resolve("horizontal-scroll"),jg=function(n){return"true"===ro.get(n,zg)?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},Lg={exclusive:function(n,e){return lm(n,"touchmove",function(n){iu(n.target(),e).filter(jg).fold(function(){n.raw().preventDefault()},k)})},markAsHorizontal:function(n){ro.set(n,zg,"true")}};function Ug(){var e=function(n){var e=!0===n.scrollable?"${prefix}-toolbar-scrollable-group":"";return{dom:ms('<div aria-label="'+n.label+'" class="${prefix}-toolbar-group '+e+'"></div>'),tgroupBehaviours:qr([Wf("adhoc-scrollable-toolbar",!0===n.scrollable?[Er(function(n,e){_i.set(n.element(),"overflow-x","auto"),Lg.markAsHorizontal(n.element()),_d.register(n.element())})]:[])]),components:[Yf.sketch({components:[Hg.parts().items({})]})],markers:{itemClass:Mi.resolve("toolbar-group-item")},items:n.items}},t=ad(Bg.sketch({dom:ms('<div class="${prefix}-toolbar"></div>'),components:[Bg.parts().groups({})],toolbarBehaviours:qr([ki.config({toggleClass:Mi.resolve("context-toolbar"),toggleOnExecute:!1,aria:{mode:"none"}}),uc.config({mode:"cyclic"})]),shell:!0})),n=ad(Yf.sketch({dom:{classes:[Mi.resolve("toolstrip")]},components:[cd(t)],containerBehaviours:qr([ki.config({toggleClass:Mi.resolve("android-selection-context-toolbar"),toggleOnExecute:!1})])})),r=function(){Bg.setGroups(t,o.get()),ki.off(t)},o=So([]);return{wrapper:E(n),toolbar:E(t),createGroups:function(n){return yn(n,v(Hg.sketch,e))},setGroups:function(n){o.set(n),r()},setContextToolbar:function(n){ki.on(t),Bg.setGroups(t,n)},restoreToolbar:function(){ki.isOn(t)&&r()},refresh:function(){},focus:function(){uc.focusIn(t)}}}var Pg=function(n,e){Ed.append(n,cd(e))},_g=function(n,e){Ed.remove(n,e)},Wg=function(n){return ad(ss.sketch({dom:ms('<div class="${prefix}-mask-edit-icon ${prefix}-icon"></div>'),action:function(){n.run(function(n){n.setReadOnly(!1)})}}))},$g=function(){return ad(Yf.sketch({dom:ms('<div class="${prefix}-editor-socket"></div>'),components:[],containerBehaviours:qr([Ed.config({})])}))},Gg=function(n,e,t,r){(!0===t?To.toAlpha:To.toOmega)(r),(t?Pg:_g)(n,e)},qg=function(e,n){return n.getAnimationRoot().fold(function(){return e.element()},function(n){return n(e)})},Yg=function(n){return n.dimension().property()},Xg=function(n,e){return n.dimension().getDimension()(e)},Kg=function(n,e){var t=qg(n,e);Xl(t,[e.shrinkingClass(),e.growingClass()])},Jg=function(n,e){bo.remove(n.element(),e.openClass()),bo.add(n.element(),e.closedClass()),_i.set(n.element(),Yg(e),"0px"),_i.reflow(n.element())},Qg=function(n,e){bo.remove(n.element(),e.closedClass()),bo.add(n.element(),e.openClass()),_i.remove(n.element(),Yg(e))},Zg=function(n,e,t){t.setCollapsed(),_i.set(n.element(),Yg(e),Xg(e,n.element())),_i.reflow(n.element());var r=qg(n,e);bo.add(r,e.shrinkingClass()),Jg(n,e),e.onStartShrink()(n)},nv=function(n,e,t){var r=function(n,e){Qg(n,e);var t=Xg(e,n.element());return Jg(n,e),t}(n,e),o=qg(n,e);bo.add(o,e.growingClass()),Qg(n,e),_i.set(n.element(),Yg(e),r),t.setExpanded(),e.onStartGrow()(n)},ev=function(n,e,t){var r=qg(n,e);return!0===bo.has(r,e.growingClass())},tv=function(n,e,t){var r=qg(n,e);return!0===bo.has(r,e.shrinkingClass())},rv=Object.freeze({grow:function(n,e,t){t.isExpanded()||nv(n,e,t)},shrink:function(n,e,t){t.isExpanded()&&Zg(n,e,t)},immediateShrink:function(n,e,t){var r,o;t.isExpanded()&&(r=n,o=e,t.setCollapsed(),_i.set(r.element(),Yg(o),Xg(o,r.element())),_i.reflow(r.element()),Kg(r,o),Jg(r,o),o.onStartShrink()(r),o.onShrunk()(r))},hasGrown:function(n,e,t){return t.isExpanded()},hasShrunk:function(n,e,t){return t.isCollapsed()},isGrowing:ev,isShrinking:tv,isTransitioning:function(n,e,t){return!0===ev(n,e)||!0===tv(n,e)},toggleGrow:function(n,e,t){(t.isExpanded()?Zg:nv)(n,e,t)},disableTransitions:Kg}),ov=Object.freeze({exhibit:function(n,e){var t=e.expanded();return Nr(t?{classes:[e.openClass()],styles:{}}:{classes:[e.closedClass()],styles:Et(e.dimension().property(),"0px")})},events:function(t,r){return br([wr(J(),function(n,e){e.event().raw().propertyName===t.dimension().property()&&(Kg(n,t),r.isExpanded()&&_i.remove(n.element(),t.dimension().property()),(r.isExpanded()?t.onGrown():t.onShrunk())(n))})])}}),iv=[ur("closedClass"),ur("openClass"),ur("shrinkingClass"),ur("growingClass"),fr("getAnimationRoot"),ai("onShrunk"),ai("onStartShrink"),ai("onGrown"),ai("onStartGrow"),mr("expanded",!1),ar("dimension",rr("property",{width:[li("property","width"),li("getDimension",function(n){return Xs(n)+"px"})],height:[li("property","height"),li("getDimension",function(n){return Yi(n)+"px"})]}))],uv=Object.freeze({init:function(n){var e=So(n.expanded());return Gr({isExpanded:function(){return!0===e.get()},isCollapsed:function(){return!1===e.get()},setCollapsed:l(e.set,!1),setExpanded:l(e.set,!0),readState:function(){return"expanded: "+e.get()}})}}),av=Xr({fields:iv,name:"sliding",active:ov,apis:rv,state:uv}),cv=function(e,t){var r=ad(Yf.sketch({dom:{tag:"div",classes:[Mi.resolve("dropup")]},components:[],containerBehaviours:qr([Ed.config({}),av.config({closedClass:Mi.resolve("dropup-closed"),openClass:Mi.resolve("dropup-open"),shrinkingClass:Mi.resolve("dropup-shrinking"),growingClass:Mi.resolve("dropup-growing"),dimension:{property:"height"},onShrunk:function(n){e(),t(),Ed.set(n,[])},onGrown:function(n){e(),t()}}),Di(function(n,e){o(k)})])})),o=function(n){window.requestAnimationFrame(function(){n(),av.shrink(r)})};return{appear:function(n,e,t){!0===av.hasShrunk(r)&&!1===av.isTransitioning(r)&&window.requestAnimationFrame(function(){e(t),Ed.set(r,[n()]),av.grow(r)})},disappear:o,component:E(r),element:r.element}},sv=Wn.detect().browser.isFirefox(),fv=Pt([cr("triggerEvent"),cr("broadcastEvent"),mr("stopBackspace",!0)]),lv=function(e,n){var t,r,o,i,u=nr("Getting GUI events settings",fv,n),a=Wn.detect().deviceType.isTouch()?["touchstart","touchmove","touchend","gesturestart"]:["mousedown","mouseup","mouseover","mousemove","mouseout","click"],c=bm(u),s=yn(a.concat(["selectstart","input","contextmenu","change","transitionend","drag","dragstart","dragend","dragenter","dragleave","dragover","drop"]),function(n){return lm(e,n,function(e){c.fireIfReady(e,n).each(function(n){n&&e.kill()}),u.triggerEvent(n,e)&&e.kill()})}),f=lm(e,"keydown",function(n){var e;u.triggerEvent("keydown",n)?n.kill():!0!==u.stopBackspace||8!==(e=n).raw().which||hn(["input","textarea"],be.name(e.target()))||n.prevent()}),l=(t=e,r=function(n){u.triggerEvent("focusin",n)&&n.kill()},sv?dm(t,"focus",r):lm(t,"focusin",r)),d=(o=e,i=function(n){u.triggerEvent("focusout",n)&&n.kill(),setTimeout(function(){u.triggerEvent(qn(),n)},0)},sv?dm(o,"blur",i):lm(o,"focusout",i)),m=$e.defaultView(e),g=lm(m,"scroll",function(n){u.broadcastEvent(ee(),n)&&n.kill()});return{unbind:function(){wn(s,function(n){n.unbind()}),f.unbind(),l.unbind(),d.unbind(),g.unbind()}}},dv=function(n,e){var t=kt(n,"target").map(function(n){return n()}).getOr(e);return So(t)},mv=ct([{stopped:[]},{resume:["element"]},{complete:[]}]),gv=function(n,r,e,t,o,i){var u,a,c,s,f=n(r,t),l=(u=e,a=o,c=So(!1),s=So(!1),{stop:function(){c.set(!0)},cut:function(){s.set(!0)},isStopped:c.get,isCut:s.get,event:E(u),setSource:a.set,getSource:a.get});return f.fold(function(){return i.logEventNoHandlers(r,t),mv.complete()},function(e){var t=e.descHandler();return Ll(t)(l),l.isStopped()?(i.logEventStopped(r,e.element(),t.purpose()),mv.stopped()):l.isCut()?(i.logEventCut(r,e.element(),t.purpose()),mv.complete()):$e.parent(e.element()).fold(function(){return i.logNoParent(r,e.element(),t.purpose()),mv.complete()},function(n){return i.logEventResponse(r,e.element(),t.purpose()),mv.resume(n)})})},vv=function(e,t,r,n,o,i){return gv(e,t,r,n,o,i).fold(function(){return!0},function(n){return vv(e,t,r,n,o,i)},function(){return!1})},pv=function(n,e,t){var r,o,i=(r=e,o=So(!1),{stop:function(){o.set(!0)},cut:k,isStopped:o.get,isCut:E(!1),event:E(r),setSource:c("Cannot set source of a broadcasted event"),getSource:c("Cannot get source of a broadcasted event")});return wn(n,function(n){var e=n.descHandler();Ll(e)(i)}),i.isStopped()},hv=function(n,e,t,r,o){var i=dv(t,r);return vv(n,e,t,r,i,o)},bv=function(n,e,t){return Do.closest(n,function(n){return e(n).isSome()},t).bind(e)},yv=Te("element","descHandler"),wv=function(n,e){return{id:E(n),descHandler:E(e)}};function xv(){var i={};return{registerId:function(r,o,n){V(n,function(n,e){var t=i[e]!==undefined?i[e]:{};t[o]=jl(n,r),i[e]=t})},unregisterId:function(t){V(i,function(n,e){n.hasOwnProperty(t)&&delete n[t]})},filterByType:function(n){return kt(i,n).map(function(n){return j(n,function(n,e){return wv(e,n)})}).getOr([])},find:function(n,e,t){var o=Ot(e)(i);return bv(t,function(n){return t=o,ns(r=n).fold(function(){return B.none()},function(n){var e=Ot(n);return t.bind(e).map(function(n){return yv(r,n)})});var t,r},n)}}}function Tv(){var r=xv(),o={},i=function(r){var n=r.element();return ns(n).fold(function(){return n="uid-",e=r.element(),t=bc(Qc+n),ro.set(e,Zc,t),t;var n,e,t},function(n){return n})},u=function(n){ns(n.element()).each(function(n){o[n]=undefined,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);Rt(o,e)&&function(n,e){var t=o[e];if(t!==n)throw new Error('The tagId "'+e+'" is already used by: '+qo(t.element())+"\nCannot use it for: "+qo(n.element())+"\nThe conflicting element is"+(xe.inBody(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 Ot(n)(o)}}}var Sv=function(t){var r=function(e){return $e.parent(t.element()).fold(function(){return!0},function(n){return ze(e,n)})},o=Tv(),s=function(n,e){return o.find(r,n,e)},n=lv(t.element(),{triggerEvent:function(u,a){return ei(u,a.target(),function(n){return e=s,t=u,o=n,i=(r=a).target(),hv(e,t,r,i,o);var e,t,r,o,i})},broadcastEvent:function(n,e){var t=o.filter(n);return pv(t,e)}}),i=Nl({debugInfo:E("real"),triggerEvent:function(e,t,r){ei(e,t,function(n){hv(s,e,r,t,n)})},triggerFocus:function(a,c){ns(a).fold(function(){Io(a)},function(n){ei(Gn(),a,function(n){var e,t,r,o,i,u;e=s,t=Gn(),r={originator:E(c),kill:k,prevent:k,target:E(a)},i=n,u=dv(r,o=a),gv(e,t,r,o,u,i)})})},triggerEscape:function(n,e){i.triggerEvent("keydown",n.element(),e.event())},getByUid:function(n){return m(n)},getByDom:function(n){return g(n)},build:ad,addToGui:function(n){a(n)},removeFromGui:function(n){c(n)},addToWorld:function(n){e(n)},removeFromWorld:function(n){u(n)},broadcast:function(n){l(n)},broadcastOn:function(n,e){d(n,e)},isConnected:E(!0)}),e=function(n){n.connect(i),be.isText(n.element())||(o.register(n),wn(n.components(),e),i.triggerEvent(ne(),n.element(),{target:E(n.element())}))},u=function(n){be.isText(n.element())||(wn(n.components(),u),o.unregister(n)),n.disconnect()},a=function(n){et(t,n)},c=function(n){ot(n)},f=function(t){var n=o.filter(Yn());wn(n,function(n){var e=n.descHandler();Ll(e)(t)})},l=function(n){f({universal:E(!0),data:E(n)})},d=function(n,e){f({universal:E(!1),channels:E(n),data:E(e)})},m=function(n){return o.getById(n).fold(function(){return at.error(new Error('Could not find component with uid: "'+n+'" in system.'))},at.value)},g=function(n){var e=ns(n).getOr("not found");return m(e)};return e(t),{root:E(t),element:t.element,destroy:function(){n.unbind(),Qe.remove(t.element())},add:a,remove:c,getByUid:m,getByDom:g,addToWorld:e,removeFromWorld:u,broadcast:l,broadcastOn:d}},Ov=E(Mi.resolve("readonly-mode")),Cv=E(Mi.resolve("edit-mode"));function kv(n){var e=ad(Yf.sketch({dom:{classes:[Mi.resolve("outer-container")].concat(n.classes)},containerBehaviours:qr([To.config({alpha:Ov(),omega:Cv()})])}));return Sv(e)}var Ev=function(n,e){var t=fe.fromTag("input");_i.setAll(t,{opacity:"0",position:"absolute",top:"-1000px",left:"-1000px"}),Ye.append(n,t),Io(t),e(t),Qe.remove(t)},Dv=function(n){var e=n.getSelection();if(0<e.rangeCount){var t=e.getRangeAt(0),r=n.document.createRange();r.setStart(t.startContainer,t.startOffset),r.setEnd(t.endContainer,t.endOffset),e.removeAllRanges(),e.addRange(r)}},Av=function(n,e){Bo().each(function(n){ze(n,e)||No(n)}),n.focus(),Io(fe.fromDom(n.document.body)),Dv(n)},Rv={stubborn:function(n,e,t,r){var o=function(){Av(e,r)},i=lm(t,"keydown",function(n){hn(["input","textarea"],be.name(n.target()))||o()});return{toReading:function(){Ev(n,No)},toEditing:o,onToolbarTouch:function(){},destroy:function(){i.unbind()}}},timid:function(n,e,t,r){var o=function(){No(r)};return{toReading:function(){o()},toEditing:function(){Av(e,r)},onToolbarTouch:function(){o()},destroy:k}}},Mv=function(t,r,o,i,n){var u=function(){r.run(function(n){n.refreshSelection()})},e=function(n,e){var t=n-i.dom().scrollTop;r.run(function(n){n.scrollIntoView(t,t+e)})},a=function(){r.run(function(n){n.clearSelection()})},c=function(){t.getCursorBox().each(function(n){e(n.top(),n.height())}),r.run(function(n){n.syncHeight()})},s=ym(t),f=Dg(c,300),l=[t.onKeyup(function(){a(),f.throttle()}),t.onNodeChanged(u),t.onDomChanged(f.throttle),t.onDomChanged(u),t.onScrollToCursor(function(n){n.preventDefault(),f.throttle()}),t.onScrollToElement(function(n){n.element(),e(r,i)}),t.onToEditing(function(){r.run(function(n){n.toEditing()})}),t.onToReading(function(){r.run(function(n){n.toReading()})}),lm(t.doc(),"touchend",function(n){ze(t.html(),n.target())||ze(t.body(),n.target())}),lm(o,"transitionend",function(n){var e;"height"===n.raw().propertyName&&(e=Yi(o),r.run(function(n){n.setViewportOffset(e)}),u(),c())}),dm(o,"touchstart",function(n){var e;r.run(function(n){n.highlightSelection()}),e=n,r.run(function(n){n.onToolbarTouch(e)}),t.onTouchToolstrip()}),lm(t.body(),"touchstart",function(n){a(),t.onTouchContent(),s.fireTouchstart(n)}),s.onTouchmove(),s.onTouchend(),lm(t.body(),"click",function(n){n.kill()}),lm(o,"touchmove",function(){t.onToolbarScrollStart()})];return{destroy:function(){wn(l,function(n){n.unbind()})}}},Iv=function(n){var t=B.none(),e=[],r=function(n){o()?u(n):e.push(n)},o=function(){return t.isSome()},i=function(n){wn(n,u)},u=function(e){t.each(function(n){setTimeout(function(){e(n)},0)})};return n(function(n){t=B.some(n),i(e),e=[]}),{get:r,map:function(t){return Iv(function(e){r(function(n){e(t(n))})})},isReady:o}},Nv={nu:Iv,pure:function(e){return Iv(function(n){n(e)})}},Bv=function(e){var n=function(n){var r;e((r=n,function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=this;setTimeout(function(){r.apply(t,n)},0)}))};return{map:function(r){return Bv(function(t){n(function(n){var e=r(n);t(e)})})},bind:function(t){return Bv(function(e){n(function(n){t(n).get(e)})})},anonBind:function(t){return Bv(function(e){n(function(n){t.get(e)})})},toLazy:function(){return Nv.nu(n)},get:n}},Fv={nu:Bv,pure:function(e){return Bv(function(n){n(e)})}},Vv=function(n,e,t){return Math.abs(n-e)<=t?B.none():n<e?B.some(n+t):B.some(n-t)},Hv=function(){var s=null;return{animate:function(r,o,n,i,e,t){var u=!1,a=function(n){u=!0,e(n)};clearInterval(s);var c=function(n){clearInterval(s),a(n)};s=setInterval(function(){var t=r();Vv(t,o,n).fold(function(){clearInterval(s),a(o)},function(n){if(i(n,c),!u){var e=r();(e!==n||Math.abs(e-o)>Math.abs(t-o))&&(clearInterval(s),a(o))}})},t)}}},zv=function(e,t){return Ko([{width:320,height:480,keyboard:{portrait:300,landscape:240}},{width:320,height:568,keyboard:{portrait:300,landscape:240}},{width:375,height:667,keyboard:{portrait:305,landscape:240}},{width:414,height:736,keyboard:{portrait:320,landscape:240}},{width:768,height:1024,keyboard:{portrait:320,landscape:400}},{width:1024,height:1366,keyboard:{portrait:380,landscape:460}}],function(n){return e<=n.width&&t<=n.height?B.some(n.keyboard):B.none()}).getOr({portrait:t/5,landscape:e/4})},jv=function(n){var e,t=gm(n).isPortrait(),r=zv((e=n).screen.width,e.screen.height),o=t?r.portrait:r.landscape;return(t?n.screen.height:n.screen.width)-n.innerHeight>o?0:o},Lv=function(n,e){var t=$e.owner(n).dom().defaultView;return Yi(n)+Yi(e)-jv(t)},Uv=Lv,Pv=function(n,e,t){var r=Lv(e,t),o=Yi(e)+Yi(t)-r;_i.set(n,"padding-bottom",o+"px")},_v=ct([{fixed:["element","property","offsetY"]},{scroller:["element","offsetY"]}]),Wv="data-"+Mi.resolve("position-y-fixed"),$v="data-"+Mi.resolve("y-property"),Gv="data-"+Mi.resolve("scrolling"),qv="data-"+Mi.resolve("last-window-height"),Yv=function(n){return Tm(n,Wv)},Xv=function(n,e){var t=ro.get(n,$v);return _v.fixed(n,t,e)},Kv=function(n,e){return _v.scroller(n,e)},Jv=function(n){var e=Yv(n);return("true"===ro.get(n,Gv)?Kv:Xv)(n,e)},Qv=function(n,e,t){var r=$e.owner(n).dom().defaultView.innerHeight;return ro.set(n,qv,r+"px"),r-e-t},Zv=function(n){var e=nu(n,"["+Wv+"]");return yn(e,Jv)},np=function(r,o,i,u){var n,e,t,a,c,s,f,l,d=$e.owner(r).dom().defaultView,m=(l=ro.get(f=i,"style"),_i.setAll(f,{position:"absolute",top:"0px"}),ro.set(f,Wv,"0px"),ro.set(f,$v,"top"),{restore:function(){ro.set(f,"style",l||""),ro.remove(f,Wv),ro.remove(f,$v)}}),g=Yi(i),v=Yi(u),p=Qv(r,g,v),h=(t=g,a=p,s=ro.get(c=r,"style"),_d.register(c),_i.setAll(c,{position:"absolute",height:a+"px",width:"100%",top:t+"px"}),ro.set(c,Wv,t+"px"),ro.set(c,Gv,"true"),ro.set(c,$v,"top"),{restore:function(){_d.deregister(c),ro.set(c,"style",s||""),ro.remove(c,Wv),ro.remove(c,Gv),ro.remove(c,$v)}}),b=(e=ro.get(n=u,"style"),_i.setAll(n,{position:"absolute",bottom:"0px"}),ro.set(n,Wv,"0px"),ro.set(n,$v,"bottom"),{restore:function(){ro.set(n,"style",e||""),ro.remove(n,Wv),ro.remove(n,$v)}}),y=!0,w=function(){var n=d.innerHeight;return Tm(r,qv)<n},x=function(){if(y){var n=Yi(i),e=Yi(u),t=Qv(r,n,e);ro.set(r,Wv,n+"px"),_i.set(r,"height",t+"px"),_i.set(u,"bottom",-(n+t+e)+"px"),Pv(o,r,u)}};return Pv(o,r,u),{setViewportOffset:function(n){ro.set(r,Wv,n+"px"),x()},isExpanding:w,isShrinking:T(w),refresh:x,restore:function(){y=!1,m.restore(),h.restore(),b.restore()}}},ep=Yv,tp=Hv(),rp="data-"+Mi.resolve("last-scroll-top"),op=function(n){var e=_i.getRaw(n,"top").getOr("0");return parseInt(e,10)},ip=function(n){return parseInt(n.dom().scrollTop,10)},up=function(n,e){var t=e+ep(n)+"px";_i.set(n,"top",t)},ap=function(t,r,o){return Fv.nu(function(n){var e=l(ip,t);tp.animate(e,r,15,function(n){t.dom().scrollTop=n,_i.set(t,"top",op(t)+15+"px")},function(){t.dom().scrollTop=r,_i.set(t,"top",o+"px"),n(r)},10)})},cp=function(o,i){return Fv.nu(function(n){var e=l(ip,o);ro.set(o,rp,e());var t=Math.abs(i-e()),r=Math.ceil(t/10);tp.animate(e,i,r,function(n,e){Tm(o,rp)!==o.dom().scrollTop?e(o.dom().scrollTop):(o.dom().scrollTop=n,ro.set(o,rp,n))},function(){o.dom().scrollTop=i,ro.set(o,rp,i),n(i)},10)})},sp=function(i,u){return Fv.nu(function(n){var e=l(op,i),t=function(n){_i.set(i,"top",n+"px")},r=Math.abs(u-e()),o=Math.ceil(r/10);tp.animate(e,u,o,t,function(){t(u),n(u)},10)})},fp=function(e,t,r){var o=$e.owner(e).dom().defaultView;return Fv.nu(function(n){up(e,r),up(t,r),o.scrollTo(0,r),n(r)})},lp=function(n,e,t,r,o){var i=Uv(e,t),u=l(Dv,n);i<r||i<o?cp(e,e.dom().scrollTop-i+o).get(u):r<0&&cp(e,e.dom().scrollTop+r).get(u)},dp=function(u,n){return n(function(r){var o=[],i=0;0===u.length?r([]):wn(u,function(n,e){var t;n.get((t=e,function(n){o[t]=n,++i>=u.length&&r(o)}))})})},mp=function(n,c){return n.fold(function(n,e,t){return r=n,o=e,u=c+(i=t),_i.set(r,o,u+"px"),Fv.pure(i);var r,o,i,u},function(n,e){return t=n,o=c+(r=e),i=_i.getRaw(t,"top").getOr(r),u=o-parseInt(i,10),a=t.dom().scrollTop+u,ap(t,a,o);var t,r,o,i,u,a})},gp=function(n,e){var t=Zv(n),r=yn(t,function(n){return mp(n,e)});return dp(r,Fv.nu)},vp=function(e,t,n,r,o,i){var u,a,c=(u=function(n){return fp(e,t,n)},a=So(Nv.pure({})),{start:function(e){var n=Nv.nu(function(n){return u(e).get(n)});a.set(n)},idle:function(n){a.get().get(function(){n()})}}),s=Dg(function(){c.idle(function(){gp(n,r.pageYOffset).get(function(){var n;(n=og(i),B.from(n[0]).bind(function(n){var e=n.top()-t.dom().scrollTop;return e>r.innerHeight+5||e<-5?B.some({top:E(e),bottom:E(e+n.height())}):B.none()})).each(function(n){t.dom().scrollTop=t.dom().scrollTop+n.top()}),c.start(0),o.refresh()})})},1e3),f=lm(fe.fromDom(r),"scroll",function(){r.pageYOffset<0||s.throttle()});return gp(n,r.pageYOffset).get(h),{unbind:f.unbind}},pp=function(n){var t=n.cWin(),e=n.ceBody(),r=n.socket(),o=n.toolstrip(),i=n.toolbar(),u=n.contentElement(),a=n.keyboardType(),c=n.outerWindow(),s=n.dropup(),f=np(r,e,o,s),l=a(n.outerBody(),t,xe.body(),u,o,i),d=vm(c,{onChange:k,onReady:f.refresh});d.onAdjustment(function(){f.refresh()});var m=lm(fe.fromDom(c),"resize",function(){f.isExpanding()&&f.refresh()}),g=vp(o,r,n.outerBody(),c,f,t),v=function(t,e){var n=t.document,r=fe.fromTag("div");bo.add(r,Mi.resolve("unfocused-selections")),Ye.append(fe.fromDom(n.documentElement),r);var o=lm(r,"touchstart",function(n){n.prevent(),Av(t,e),u()}),i=function(n){var e=fe.fromTag("span");return Yl(e,[Mi.resolve("layer-editor"),Mi.resolve("unfocused-selection")]),_i.setAll(e,{left:n.left()+"px",top:n.top()+"px",width:n.width()+"px",height:n.height()+"px"}),e},u=function(){Qe.empty(r)};return{update:function(){u();var n=og(t),e=yn(n,i);Ke(r,e)},isActive:function(){return 0<$e.children(r).length},destroy:function(){o.unbind(),Qe.remove(r)},clear:u}}(t,u),p=function(){v.clear()};return{toEditing:function(){l.toEditing(),p()},toReading:function(){l.toReading()},onToolbarTouch:function(n){l.onToolbarTouch(n)},refreshSelection:function(){v.isActive()&&v.update()},clearSelection:p,highlightSelection:function(){v.update()},scrollIntoView:function(n,e){lp(t,r,s,n,e)},updateToolbarPadding:k,setViewportOffset:function(n){f.setViewportOffset(n),sp(r,n).get(h)},syncHeight:function(){_i.set(u,"height",u.dom().contentWindow.document.body.scrollHeight+"px")},refreshStructure:f.refresh,destroy:function(){f.restore(),d.destroy(),g.unbind(),m.unbind(),l.destroy(),v.destroy(),Ev(xe.body(),No)}}},hp=function(r,n){var o=kg(),i=Sl(),u=Sl(),a=Tl(),c=Tl();return{enter:function(){n.hide();var t=fe.fromDom(document);yg.getActiveApi(r.editor).each(function(n){i.set({socketHeight:_i.getRaw(r.socket,"height"),iframeHeight:_i.getRaw(n.frame(),"height"),outerScroll:document.body.scrollTop}),u.set({exclusives:Lg.exclusive(t,"."+_d.scrollable())}),bo.add(r.container,Mi.resolve("fullscreen-maximized")),Og(r.container,n.body()),o.maximize(),_i.set(r.socket,"overflow","scroll"),_i.set(r.socket,"-webkit-overflow-scrolling","touch"),Io(n.body());var e=De(["cWin","ceBody","socket","toolstrip","toolbar","dropup","contentElement","cursor","keyboardType","isScrolling","outerWindow","outerBody"],[]);a.set(pp(e({cWin:n.win(),ceBody:n.body(),socket:r.socket,toolstrip:r.toolstrip,toolbar:r.toolbar,dropup:r.dropup.element(),contentElement:n.frame(),cursor:k,outerBody:r.body,outerWindow:r.win,keyboardType:Rv.stubborn,isScrolling:function(){return u.get().exists(function(n){return n.socket.isScrolling()})}}))),a.run(function(n){n.syncHeight()}),c.set(Mv(n,a,r.toolstrip,r.socket,r.dropup))})},refreshStructure:function(){a.run(function(n){n.refreshStructure()})},exit:function(){o.restore(),c.clear(),a.clear(),n.show(),i.on(function(n){n.socketHeight.each(function(n){_i.set(r.socket,"height",n)}),n.iframeHeight.each(function(n){_i.set(r.editor.getFrame(),"height",n)}),document.body.scrollTop=n.scrollTop}),i.clear(),u.on(function(n){n.exclusives.unbind()}),u.clear(),bo.remove(r.container,Mi.resolve("fullscreen-maximized")),Cg(),_d.deregister(r.toolbar),_i.remove(r.socket,"overflow"),_i.remove(r.socket,"-webkit-overflow-scrolling"),No(r.editor.getFrame()),yg.getActiveApi(r.editor).each(function(n){n.clearSelection()})}}},bp=function(n){var e=nr("Getting IosWebapp schema",Rg,n);_i.set(e.toolstrip,"width","100%"),_i.set(e.container,"position","relative");var t=ad(Ag(function(){e.setReadOnly(e.readOnlyOnInit()),r.enter()},e.translate));e.alloy.add(t);var r=hp(e,{show:function(){e.alloy.add(t)},hide:function(){e.alloy.remove(t)}});return{setReadOnly:e.setReadOnly,refreshStructure:r.refreshStructure,enter:r.enter,exit:r.exit,destroy:k}},yp=tinymce.util.Tools.resolve("tinymce.EditorManager"),wp=function(n){var e=kt(n.settings,"skin_url").fold(function(){return yp.baseURL+"/skins/lightgray"},function(n){return n});return{content:e+"/content.mobile.min.css",ui:e+"/skin.mobile.min.css"}},xp=function(n,e,t){n.system().broadcastOn([jo.formatChanged()],{command:e,state:t})},Tp=function(r,n){var e=F(n.formatter.get());wn(e,function(e){n.formatter.formatChanged(e,function(n){xp(r,e,n)})}),wn(["ul","ol"],function(t){n.selection.selectorChanged(t,function(n,e){xp(r,t,n)})})},Sp=(E(["x-small","small","medium","large","x-large"]),function(n){var e=function(){n._skinLoaded=!0,n.fire("SkinLoaded")};return function(){n.initialized?e():n.on("init",e)}}),Op=E("toReading"),Cp=E("toEditing");Ho.add("mobile",function(C){return{getNotificationManagerImpl:function(){return{open:h,close:k,reposition:k,getArgs:h}},renderUI:function(n){var e=wp(C);0==(!1===C.settings.skin)?(C.contentCSS.push(e.content),Vo.DOM.styleSheetLoader.load(e.ui,Sp(C))):Sp(C)();var t,r,o,i,u,a,c,s,f,l,d,m,g,v,p=function(){C.fire("scrollIntoView")},h=fe.fromTag("div"),b=Wn.detect().os.isAndroid()?(s=p,f=kv({classes:[Mi.resolve("android-container")]}),l=Ug(),d=Tl(),m=Wg(d),g=$g(),v=cv(k,s),f.add(l.wrapper()),f.add(g),f.add(v.component()),{system:E(f),element:f.element,init:function(n){d.set(Mg(n))},exit:function(){d.run(function(n){n.exit(),Ed.remove(g,m)})},setToolbarGroups:function(n){var e=l.createGroups(n);l.setGroups(e)},setContextToolbar:function(n){var e=l.createGroups(n);l.setContextToolbar(e)},focusToolbar:function(){l.focus()},restoreToolbar:function(){l.restoreToolbar()},updateMode:function(n){Gg(g,m,n,f.root())},socket:E(g),dropup:E(v)}):(t=p,r=kv({classes:[Mi.resolve("ios-container")]}),o=Ug(),i=Tl(),u=Wg(i),a=$g(),c=cv(function(){i.run(function(n){n.refreshStructure()})},t),r.add(o.wrapper()),r.add(a),r.add(c.component()),{system:E(r),element:r.element,init:function(n){i.set(bp(n))},exit:function(){i.run(function(n){Ed.remove(a,u),n.exit()})},setToolbarGroups:function(n){var e=o.createGroups(n);o.setGroups(e)},setContextToolbar:function(n){var e=o.createGroups(n);o.setContextToolbar(e)},focusToolbar:function(){o.focus()},restoreToolbar:function(){o.restoreToolbar()},updateMode:function(n){Gg(a,u,n,r.root())},socket:E(a),dropup:E(c)}),y=fe.fromDom(n.targetNode);Ye.after(y,h),function(n,e){Ye.append(n,e.element());var t=$e.children(e.element());wn(t,function(n){e.getByDom(n).each(nt)})}(h,b.system());var w=n.targetNode.ownerDocument.defaultView,x=vm(w,{onChange:function(){b.system().broadcastOn([jo.orientationChanged()],{width:pm(w)})},onReady:k}),T=function(n,e,t,r){!1===r&&C.selection.collapse();var o=S(n,e,t);b.setToolbarGroups(!0===r?o.readOnly:o.main),C.setMode(!0===r?"readonly":"design"),C.fire(!0===r?Op():Cp()),b.updateMode(r)},S=function(n,e,t){var r=n.get(),o={readOnly:r.backToMask.concat(e.get()),main:r.backToMask.concat(t.get())};return o},O=function(n,e){return C.on(n,e),{unbind:function(){C.off(n)}}};return C.on("init",function(){b.init({editor:{getFrame:function(){return fe.fromDom(C.contentAreaContainer.querySelector("iframe"))},onDomChanged:function(){return{unbind:k}},onToReading:function(n){return O(Op(),n)},onToEditing:function(n){return O(Cp(),n)},onScrollToCursor:function(e){return C.on("scrollIntoView",function(n){e(n)}),{unbind:function(){C.off("scrollIntoView"),x.destroy()}}},onTouchToolstrip:function(){t()},onTouchContent:function(){var n,e=fe.fromDom(C.editorContainer.querySelector("."+Mi.resolve("toolbar")));(n=e,Fo(n).bind(function(n){return b.system().getByDom(n).toOption()})).each(ue),b.restoreToolbar(),t()},onTapContent:function(n){var e=n.target();"img"===be.name(e)?(C.selection.select(e.dom()),n.kill()):"a"===be.name(e)&&b.system().getByDom(fe.fromDom(C.editorContainer)).each(function(n){To.isAlpha(n)&&zo(e.dom())})}},container:fe.fromDom(C.editorContainer),socket:fe.fromDom(C.contentAreaContainer),toolstrip:fe.fromDom(C.editorContainer.querySelector("."+Mi.resolve("toolstrip"))),toolbar:fe.fromDom(C.editorContainer.querySelector("."+Mi.resolve("toolbar"))),dropup:b.dropup(),alloy:b.system(),translate:k,setReadOnly:function(n){T(c,a,u,n)},readOnlyOnInit:function(){return!1}});var t=function(){b.dropup().disappear(function(){b.system().broadcastOn([jo.dropupDismissed()],{})})},n={label:"The first group",scrollable:!1,items:[hs.forToolbar("back",function(){C.selection.collapse(),b.exit()},{})]},e={label:"Back to read only",scrollable:!1,items:[hs.forToolbar("readonly-back",function(){T(c,a,u,!0)},{})]},r=rm(b,C),o=om(C.settings,r),i={label:"The extra group",scrollable:!1,items:[]},u=So([{label:"the action group",scrollable:!0,items:o},i]),a=So([{label:"The read only mode group",scrollable:!0,items:[]},i]),c=So({backToMask:[n],backToReadOnly:[e]});Tp(b,C)}),{iframeContainer:b.socket().element().dom(),editorContainer:b.element().dom()}}}})}();