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