agenda-libre-ruby/public/assets/tinymce/themes/inlite/theme-b229a7d133e9ac600d6bbaba2ed9004366d44ff493691100a9ff91e584e5fa9c.js
2018-02-19 14:21:53 +01:00

2 lines
133 KiB
JavaScript

!function(){"use strict";var t,e,n,i,r,o,s,a=tinymce.util.Tools.resolve("tinymce.ThemeManager"),l=tinymce.util.Tools.resolve("tinymce.Env"),u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.util.Delay"),d=function(t){return t.reduce(function(t,e){return Array.isArray(e)?t.concat(d(e)):t.concat(e)},[])},f={flatten:d},h=function(t,e){for(var n=0;n<e.length;n++){var i=(0,e[n])(t);if(i)return i}return null},m=function(t,e){return{id:t,rect:e}},g=function(t){return{x:t.left,y:t.top,w:t.width,h:t.height}},p=function(t){return{left:t.x,top:t.y,width:t.w,height:t.h,right:t.x+t.w,bottom:t.y+t.h}},v=function(t){var e=u.DOM.getViewPort();return{x:t.x+e.x,y:t.y+e.y,w:t.w,h:t.h}},y=function(t){var e=t.getBoundingClientRect();return v({x:e.left,y:e.top,w:Math.max(t.clientWidth,t.offsetWidth),h:Math.max(t.clientHeight,t.offsetHeight)})},b={getElementRect:function(t,e){return y(e)},getPageAreaRect:function(t){return y(t.getElement().ownerDocument.body)},getContentAreaRect:function(t){return y(t.getContentAreaContainer()||t.getBody())},getSelectionRect:function(t){var e=t.selection.getBoundingClientRect();return e?v(g(e)):null}},x=function(t,e){return function(n){for(var i=0;i<e.length;i++)if(e[i].predicate(t))return m(e[i].id,b.getElementRect(n,t));return null}},w=function(t,e){return function(n){for(var i=0;i<t.length;i++)for(var r=0;r<e.length;r++)if(e[r].predicate(t[i]))return m(e[r].id,b.getElementRect(n,t[i]));return null}},_=tinymce.util.Tools.resolve("tinymce.util.Tools"),R=function(t,e){return{id:t,predicate:e}},k=function(t){return _.map(t,function(t){return R(t.id,t.predicate)})},C=function(t){return function(e){return e.selection.isCollapsed()?null:m(t,b.getSelectionRect(e))}},E=function(t,e){return function(n){var i,r=n.schema.getTextBlockElements();for(i=0;i<t.length;i++)if("TABLE"===t[i].nodeName)return null;for(i=0;i<t.length;i++)if(t[i].nodeName in r)return n.dom.isEmpty(t[i])?m(e,b.getSelectionRect(n)):null;return null}},H={fireSkinLoaded:function(t){t.fire("SkinLoaded")},fireBeforeRenderUI:function(t){return t.fire("BeforeRenderUI")}},S=tinymce.util.Tools.resolve("tinymce.EditorManager"),M=function(t){return function(e){return typeof e===t}},T=function(t){return Array.isArray(t)},P=function(t){return null===t},W={isString:M("string"),isNumber:M("number"),isBoolean:M("boolean"),isFunction:M("function"),isObject:(t=M("object"),function(e){return!P(e)&&!T(e)&&t(e)}),isNull:P,isArray:T},N=function(t,e){if(e(t))return!0;throw new Error("Default value doesn't match requested type.")},D=function(t){return function(e,n,i){var r=e.settings;return N(i,t),n in r&&t(r[n])?r[n]:i}},A={getStringOr:D(W.isString),getBoolOr:D(W.isBoolean),getNumberOr:D(W.isNumber),getHandlerOr:D(W.isFunction),getToolbarItemsOr:(e=W.isArray,function(t,n,i){var r,o,s,a,l=n in t.settings?t.settings[n]:i;return N(i,e),r=l,o=i,W.isArray(r)?r:W.isString(r)?"string"==typeof(s=r)?(a=/[ ,]/,s.split(a).filter(function(t){return t.length>0})):s:W.isBoolean(r)&&!1===r?[]:o})},O=tinymce.util.Tools.resolve("tinymce.geom.Rect"),B=function(t,e){return{rect:t,position:e}},L=function(t,e){return{x:e.x,y:e.y,w:t.w,h:t.h}},I=function(t,e,n,i,r){var o,s,a,l={x:i.x,y:i.y,w:i.w+(i.w<r.w+n.w?r.w:0),h:i.h+(i.h<r.h+n.h?r.h:0)};return o=O.findBestRelativePosition(r,n,l,t),n=O.clamp(n,l),o?(s=O.relativePosition(r,n,o),a=L(r,s),B(a,o)):(n=O.intersect(l,n))?(o=O.findBestRelativePosition(r,n,l,e))?(s=O.relativePosition(r,n,o),a=L(r,s),B(a,o)):(a=L(r,n),B(a,o)):null},z={calcInsert:function(t,e,n){return I(["cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr"],t,e,n)},calc:function(t,e,n){return I(["tc-bc","bc-tc","tl-bl","bl-tl","tr-br","br-tr","cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr","cr-cl"],t,e,n)},userConstrain:function(t,e,n,i){var r;return"function"==typeof t?(r=t({elementRect:p(e),contentAreaRect:p(n),panelRect:p(i)}),g(r)):i},defaultHandler:function(t){return t.panelRect}},F={getTextSelectionToolbarItems:function(t){return A.getToolbarItemsOr(t,"selection_toolbar",["bold","italic","|","quicklink","h2","h3","blockquote"])},getInsertToolbarItems:function(t){return A.getToolbarItemsOr(t,"insert_toolbar",["quickimage","quicktable"])},getPositionHandler:function(t){return A.getHandlerOr(t,"inline_toolbar_position_handler",z.defaultHandler)},getSkinUrl:function(t){var e,n,i,r,o=t.settings;return o.skin_url?(i=t,r=o.skin_url,i.documentBaseURI.toAbsolute(r)):(e=o.skin,n=S.baseURL+"/skins/",e?n+e:n+"lightgray")},isSkinDisabled:function(t){return!1===t.settings.skin}},V=function(t,e){var n=F.getSkinUrl(t),i=function(){var n,i,r;i=e,r=function(){n._skinLoaded=!0,H.fireSkinLoaded(n),i()},(n=t).initialized?r():n.on("init",r)};F.isSkinDisabled(t)?i():(u.DOM.styleSheetLoader.load(n+"/skin.min.css",i),t.contentCSS.push(n+"/content.inline.min.css"))},q=function(t){var e,n,i,r,o=t.contextToolbars;return f.flatten([o||[],(e=t,n="img",i="image",r="alignleft aligncenter alignright",{predicate:function(t){return e.dom.is(t,n)},id:i,items:r})])},U=function(t,e){var n,i,r,o,s;return s=(o=t).selection.getNode(),i=o.dom.getParents(s),r=k(e),(n=h(t,[x(i[0],r),C("text"),E(i,"insert"),w(i,r)]))&&n.rect?n:null},j=function(t,e){return function(){var n,i;t.removed||(n=q(t),(i=U(t,n))?e.show(t,i.id,i.rect,n):e.hide())}},$=function(t,e){var n,i,r,o,s,a=c.throttle(j(t,e),0),d=c.throttle((n=t,i=e,r=j(t,e),function(){n.removed||i.inForm()||r()}),0),f=(o=t,s=e,function(){var t=q(o),e=U(o,t);e&&s.reposition(o,e.id,e.rect)});t.on("blur hide ObjectResizeStart",e.hide),t.on("click",a),t.on("nodeChange mouseup",d),t.on("ResizeEditor keyup",a),t.on("ResizeWindow",f),u.DOM.bind(l.container,"scroll",f),t.on("remove",function(){u.DOM.unbind(l.container,"scroll",f),e.remove()}),t.shortcuts.add("Alt+F10,F10","",e.focus)},Y=function(t,e){return V(t,function(){var n,i;$(t,e),i=e,(n=t).shortcuts.remove("meta+k"),n.shortcuts.add("meta+k","",function(){var t=q(n),e=h(n,[C("quicklink")]);e&&i.show(n,e.id,e.rect,t)})}),{}},X=function(t,e){return t.inline?Y(t,e):function(t){throw new Error(t)}("inlite theme only supports inline mode.")},J=function(t){return function(){return t}},G={noop:function(){},noarg:function(t){return function(){return t()}},compose:function(t,e){return function(){return t(e.apply(null,arguments))}},constant:J,identity:function(t){return t},tripleEquals:function(t,e){return t===e},curry:function(t){for(var e=new Array(arguments.length-1),n=1;n<arguments.length;n++)e[n-1]=arguments[n];return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var r=e.concat(n);return t.apply(null,r)}},not:function(t){return function(){return!t.apply(null,arguments)}},die:function(t){return function(){throw new Error(t)}},apply:function(t){return t()},call:function(t){t()},never:J(!1),always:J(!0)},K=G.never,Q=G.always,Z=function(){return tt},tt=(o={fold:function(t,e){return t()},is:K,isSome:K,isNone:Q,getOr:r=function(t){return t},getOrThunk:i=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},or:r,orThunk:i,map:Z,ap:Z,each:function(){},bind:Z,flatten:Z,exists:K,forall:Q,filter:Z,equals:n=function(t){return t.isNone()},equals_:n,toArray:function(){return[]},toString:G.constant("none()")},Object.freeze&&Object.freeze(o),o),et=function(t){var e=function(){return t},n=function(){return r},i=function(e){return e(t)},r={fold:function(e,n){return n(t)},is:function(e){return t===e},isSome:Q,isNone:K,getOr:e,getOrThunk:e,getOrDie:e,or:n,orThunk:n,map:function(e){return et(e(t))},ap:function(e){return e.fold(Z,function(e){return et(e(t))})},each:function(e){e(t)},bind:i,flatten:e,exists:i,forall:i,filter:function(e){return e(t)?r:tt},equals:function(e){return e.is(t)},equals_:function(e,n){return e.fold(K,function(e){return n(t,e)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return r},nt={some:et,none:Z,from:function(t){return null===t||t===undefined?tt:et(t)}},it=(s=Array.prototype.indexOf)===undefined?function(t,e){return ct(t,e)}:function(t,e){return s.call(t,e)},rt=function(t,e){return it(t,e)>-1},ot=function(t,e){for(var n=t.length,i=new Array(n),r=0;r<n;r++){var o=t[r];i[r]=e(o,r,t)}return i},st=function(t,e){for(var n=0,i=t.length;n<i;n++)e(t[n],n,t)},at=function(t,e){for(var n=t.length-1;n>=0;n--)e(t[n],n,t)},lt=function(t,e){for(var n=[],i=0,r=t.length;i<r;i++){var o=t[i];e(o,i,t)&&n.push(o)}return n},ut=function(t,e){for(var n=0,i=t.length;n<i;n++)if(e(t[n],n,t))return nt.some(n);return nt.none()},ct=function(t,e){for(var n=0,i=t.length;n<i;++n)if(t[n]===e)return n;return-1},dt=Array.prototype.push,ft=function(t){for(var e=[],n=0,i=t.length;n<i;++n){if(!Array.prototype.isPrototypeOf(t[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+t);dt.apply(e,t[n])}return e},ht=function(t,e){for(var n=0,i=t.length;n<i;++n)if(!0!==e(t[n],n,t))return!1;return!0},mt=Array.prototype.slice,gt={map:ot,each:st,eachr:at,partition:function(t,e){for(var n=[],i=[],r=0,o=t.length;r<o;r++){var s=t[r];(e(s,r,t)?n:i).push(s)}return{pass:n,fail:i}},filter:lt,groupBy:function(t,e){if(0===t.length)return[];for(var n=e(t[0]),i=[],r=[],o=0,s=t.length;o<s;o++){var a=t[o],l=e(a);l!==n&&(i.push(r),r=[]),n=l,r.push(a)}return 0!==r.length&&i.push(r),i},indexOf:function(t,e){var n=it(t,e);return-1===n?nt.none():nt.some(n)},foldr:function(t,e,n){return at(t,function(t){n=e(n,t)}),n},foldl:function(t,e,n){return st(t,function(t){n=e(n,t)}),n},find:function(t,e){for(var n=0,i=t.length;n<i;n++){var r=t[n];if(e(r,n,t))return nt.some(r)}return nt.none()},findIndex:ut,flatten:ft,bind:function(t,e){var n=ot(t,e);return ft(n)},forall:ht,exists:function(t,e){return ut(t,e).isSome()},contains:rt,equal:function(t,e){return t.length===e.length&&ht(t,function(t,n){return t===e[n]})},reverse:function(t){var e=mt.call(t,0);return e.reverse(),e},chunk:function(t,e){for(var n=[],i=0;i<t.length;i+=e){var r=t.slice(i,i+e);n.push(r)}return n},difference:function(t,e){return lt(t,function(t){return!rt(e,t)})},mapToObject:function(t,e){for(var n={},i=0,r=t.length;i<r;i++){var o=t[i];n[String(o)]=e(o,i)}return n},pure:function(t){return[t]},sort:function(t,e){var n=mt.call(t,0);return n.sort(e),n},range:function(t,e){for(var n=[],i=0;i<t;i++)n.push(e(i));return n},head:function(t){return 0===t.length?nt.none():nt.some(t[0])},last:function(t){return 0===t.length?nt.none():nt.some(t[t.length-1])}},pt=0,vt={id:function(){return"mceu_"+pt++},create:function(t,e,n){var i=document.createElement(t);return u.DOM.setAttribs(i,e),"string"==typeof n?i.innerHTML=n:_.each(n,function(t){t.nodeType&&i.appendChild(t)}),i},createFragment:function(t){return u.DOM.createFragment(t)},getWindowSize:function(){return u.DOM.getViewPort()},getSize:function(t){var e,n;if(t.getBoundingClientRect){var i=t.getBoundingClientRect();e=Math.max(i.width||i.right-i.left,t.offsetWidth),n=Math.max(i.height||i.bottom-i.bottom,t.offsetHeight)}else e=t.offsetWidth,n=t.offsetHeight;return{width:e,height:n}},getPos:function(t,e){return u.DOM.getPos(t,e||vt.getContainer())},getContainer:function(){return l.container?l.container:document.body},getViewPort:function(t){return u.DOM.getViewPort(t)},get:function(t){return document.getElementById(t)},addClass:function(t,e){return u.DOM.addClass(t,e)},removeClass:function(t,e){return u.DOM.removeClass(t,e)},hasClass:function(t,e){return u.DOM.hasClass(t,e)},toggleClass:function(t,e,n){return u.DOM.toggleClass(t,e,n)},css:function(t,e,n){return u.DOM.setStyle(t,e,n)},getRuntimeStyle:function(t,e){return u.DOM.getStyle(t,e,!0)},on:function(t,e,n,i){return u.DOM.bind(t,e,n,i)},off:function(t,e,n){return u.DOM.unbind(t,e,n)},fire:function(t,e,n){return u.DOM.fire(t,e,n)},innerHtml:function(t,e){u.DOM.setHTML(t,e)}},yt=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),bt=tinymce.util.Tools.resolve("tinymce.util.Class"),xt=tinymce.util.Tools.resolve("tinymce.util.EventDispatcher"),wt=function(t){var e;if(t)return"number"==typeof t?{top:t=t||0,left:t,bottom:t,right:t}:(1===(e=(t=t.split(" ")).length)?t[1]=t[2]=t[3]=t[0]:2===e?(t[2]=t[0],t[3]=t[1]):3===e&&(t[3]=t[1]),{top:parseInt(t[0],10)||0,right:parseInt(t[1],10)||0,bottom:parseInt(t[2],10)||0,left:parseInt(t[3],10)||0})},_t=function(t,e){function n(e){var n=parseFloat(function(e){var n=t.ownerDocument.defaultView;if(n){var i=n.getComputedStyle(t,null);return i?(e=e.replace(/[A-Z]/g,function(t){return"-"+t}),i.getPropertyValue(e)):null}return t.currentStyle[e]}(e));return isNaN(n)?0:n}return{top:n(e+"TopWidth"),right:n(e+"RightWidth"),bottom:n(e+"BottomWidth"),left:n(e+"LeftWidth")}};function Rt(){}function kt(t){this.cls=[],this.cls._map={},this.onchange=t||Rt,this.prefix=""}_.extend(kt.prototype,{add:function(t){return t&&!this.contains(t)&&(this.cls._map[t]=!0,this.cls.push(t),this._change()),this},remove:function(t){if(this.contains(t)){var e=void 0;for(e=0;e<this.cls.length&&this.cls[e]!==t;e++);this.cls.splice(e,1),delete this.cls._map[t],this._change()}return this},toggle:function(t,e){var n=this.contains(t);return n!==e&&(n?this.remove(t):this.add(t),this._change()),this},contains:function(t){return!!this.cls._map[t]},_change:function(){delete this.clsValue,this.onchange.call(this)}}),kt.prototype.toString=function(){var t;if(this.clsValue)return this.clsValue;t="";for(var e=0;e<this.cls.length;e++)e>0&&(t+=" "),t+=this.prefix+this.cls[e];return t};var Ct,Et,Ht,St=/^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,Mt=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,Tt=/^\s*|\s*$/g,Pt=bt.extend({init:function(t){var e=this.match;function n(t,n,r){var o;function s(t){t&&n.push(t)}return s(function(t){if(t)return t=t.toLowerCase(),function(e){return"*"===t||e.type===t}}((o=St.exec(t.replace(Tt,"")))[1])),s(function(t){if(t)return function(e){return e._name===t}}(o[2])),s(function(t){if(t)return t=t.split("."),function(e){for(var n=t.length;n--;)if(!e.classes.contains(t[n]))return!1;return!0}}(o[3])),s(function(t,e,n){if(t)return function(i){var r=i[t]?i[t]():"";return e?"="===e?r===n:"*="===e?r.indexOf(n)>=0:"~="===e?(" "+r+" ").indexOf(" "+n+" ")>=0:"!="===e?r!==n:"^="===e?0===r.indexOf(n):"$="===e&&r.substr(r.length-n.length)===n:!!n}}(o[4],o[5],o[6])),s(function(t){var n;if(t)return(t=/(?:not\((.+)\))|(.+)/i.exec(t))[1]?(n=i(t[1],[]),function(t){return!e(t,n)}):(t=t[2],function(e,n,i){return"first"===t?0===n:"last"===t?n===i-1:"even"===t?n%2==0:"odd"===t?n%2==1:!!e[t]&&e[t]()})}(o[7])),n.pseudo=!!o[7],n.direct=r,n}function i(t,e){var r,o,s,a=[];do{if(Mt.exec(""),(o=Mt.exec(t))&&(t=o[3],a.push(o[1]),o[2])){r=o[3];break}}while(o);for(r&&i(r,e),t=[],s=0;s<a.length;s++)">"!==a[s]&&t.push(n(a[s],[],">"===a[s-1]));return e.push(t),e}this._selectors=i(t,[])},match:function(t,e){var n,i,r,o,s,a,l,u,c,d,f,h,m;for(n=0,i=(e=e||this._selectors).length;n<i;n++){for(m=t,h=0,r=(o=(s=e[n]).length)-1;r>=0;r--)for(u=s[r];m;){if(u.pseudo)for(c=d=(f=m.parent().items()).length;c--&&f[c]!==m;);for(a=0,l=u.length;a<l;a++)if(!u[a](m,c,d)){a=l+1;break}if(a===l){h++;break}if(r===o-1)break;m=m.parent()}if(h===o)return!0}return!1},find:function(t){var e,n,i=[],r=this._selectors;function o(t,e,n){var r,s,a,l,u,c=e[n];for(r=0,s=t.length;r<s;r++){for(u=t[r],a=0,l=c.length;a<l;a++)if(!c[a](u,r,s)){a=l+1;break}if(a===l)n===e.length-1?i.push(u):u.items&&o(u.items(),e,n+1);else if(c.direct)return;u.items&&o(u.items(),e,n)}}if(t.items){for(e=0,n=r.length;e<n;e++)o(t.items(),r[e],0);n>1&&(i=function(t){for(var e,n=[],i=t.length;i--;)(e=t[i]).__checked||(n.push(e),e.__checked=1);for(i=n.length;i--;)delete n[i].__checked;return n}(i))}return Ct||(Ct=Pt.Collection),new Ct(i)}}),Wt=Array.prototype.push,Nt=Array.prototype.slice;Ht={length:0,init:function(t){t&&this.add(t)},add:function(t){return _.isArray(t)?Wt.apply(this,t):t instanceof Et?this.add(t.toArray()):Wt.call(this,t),this},set:function(t){var e,n=this,i=n.length;for(n.length=0,n.add(t),e=n.length;e<i;e++)delete n[e];return n},filter:function(t){var e,n,i,r,o=[];for("string"==typeof t?(t=new Pt(t),r=function(e){return t.match(e)}):r=t,e=0,n=this.length;e<n;e++)r(i=this[e])&&o.push(i);return new Et(o)},slice:function(){return new Et(Nt.apply(this,arguments))},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},each:function(t){return _.each(this,t),this},toArray:function(){return _.toArray(this)},indexOf:function(t){for(var e=this.length;e--&&this[e]!==t;);return e},reverse:function(){return new Et(_.toArray(this).reverse())},hasClass:function(t){return!!this[0]&&this[0].classes.contains(t)},prop:function(t,e){var n;return e!==undefined?(this.each(function(n){n[t]&&n[t](e)}),this):(n=this[0])&&n[t]?n[t]():void 0},exec:function(t){var e=_.toArray(arguments).slice(1);return this.each(function(n){n[t]&&n[t].apply(n,e)}),this},remove:function(){for(var t=this.length;t--;)this[t].remove();return this},addClass:function(t){return this.each(function(e){e.classes.add(t)})},removeClass:function(t){return this.each(function(e){e.classes.remove(t)})}},_.each("fire on off show hide append prepend before after reflow".split(" "),function(t){Ht[t]=function(){var e=_.toArray(arguments);return this.each(function(n){t in n&&n[t].apply(n,e)}),this}}),_.each("text name disabled active selected checked visible parent value data".split(" "),function(t){Ht[t]=function(e){return this.prop(t,e)}}),Et=bt.extend(Ht),Pt.Collection=Et;var Dt=Et,At=function(t){this.create=t.create};At.create=function(t,e){return new At({create:function(n,i){var r,o=function(t){n.set(i,t.value)};return n.on("change:"+i,function(n){t.set(e,n.value)}),t.on("change:"+e,o),(r=n._bindings)||(r=n._bindings=[],n.on("destroy",function(){for(var t=r.length;t--;)r[t]()})),r.push(function(){t.off("change:"+e,o)}),t.get(e)}})};var Ot=tinymce.util.Tools.resolve("tinymce.util.Observable");function Bt(t){return t.nodeType>0}var Lt,It,zt=bt.extend({Mixins:[Ot],init:function(t){var e,n;for(e in t=t||{})(n=t[e])instanceof At&&(t[e]=n.create(this,e));this.data=t},set:function(t,e){var n,i,r=this.data[t];if(e instanceof At&&(e=e.create(this,t)),"object"==typeof t){for(n in t)this.set(n,t[n]);return this}return function o(t,e){var n,i;if(t===e)return!0;if(null===t||null===e)return t===e;if("object"!=typeof t||"object"!=typeof e)return t===e;if(_.isArray(e)){if(t.length!==e.length)return!1;for(n=t.length;n--;)if(!o(t[n],e[n]))return!1}if(Bt(t)||Bt(e))return t===e;for(n in i={},e){if(!o(t[n],e[n]))return!1;i[n]=!0}for(n in t)if(!i[n]&&!o(t[n],e[n]))return!1;return!0}(r,e)||(this.data[t]=e,i={target:this,name:t,value:e,oldValue:r},this.fire("change:"+t,i),this.fire("change",i)),this},get:function(t){return this.data[t]},has:function(t){return t in this.data},bind:function(t){return At.create(this,t)},destroy:function(){this.fire("destroy")}}),Ft={},Vt={add:function(t){var e=t.parent();if(e){if(!e._layout||e._layout.isNative())return;Ft[e._id]||(Ft[e._id]=e),Lt||(Lt=!0,c.requestAnimationFrame(function(){var t,e;for(t in Lt=!1,Ft)(e=Ft[t]).state.get("rendered")&&e.reflow();Ft={}},document.body))}},remove:function(t){Ft[t._id]&&delete Ft[t._id]}},qt="onmousewheel"in document,Ut=!1,jt=0,$t={Statics:{classPrefix:"mce-"},isRtl:function(){return It.rtl},classPrefix:"mce-",init:function(t){var e,n,i=this;function r(t){var e;for(t=t.split(" "),e=0;e<t.length;e++)i.classes.add(t[e])}i.settings=t=_.extend({},i.Defaults,t),i._id=t.id||"mceu_"+jt++,i._aria={role:t.role},i._elmCache={},i.$=yt,i.state=new zt({visible:!0,active:!1,disabled:!1,value:""}),i.data=new zt(t.data),i.classes=new kt(function(){i.state.get("rendered")&&(i.getEl().className=this.toString())}),i.classes.prefix=i.classPrefix,(e=t.classes)&&(i.Defaults&&(n=i.Defaults.classes)&&e!==n&&r(n),r(e)),_.each("title text name visible disabled active value".split(" "),function(e){e in t&&i[e](t[e])}),i.on("click",function(){if(i.disabled())return!1}),i.settings=t,i.borderBox=wt(t.border),i.paddingBox=wt(t.padding),i.marginBox=wt(t.margin),t.hidden&&i.hide()},Properties:"parent,name",getContainerElm:function(){return vt.getContainer()},getParentCtrl:function(t){for(var e,n=this.getRoot().controlIdLookup;t&&n&&!(e=n[t.id]);)t=t.parentNode;return e},initLayoutRect:function(){var t,e,n,i,r,o,s,a,l,u,c=this,d=c.settings,f=c.getEl();t=c.borderBox=c.borderBox||_t(f,"border"),c.paddingBox=c.paddingBox||_t(f,"padding"),c.marginBox=c.marginBox||_t(f,"margin"),u=vt.getSize(f),a=d.minWidth,l=d.minHeight,r=a||u.width,o=l||u.height,n=d.width,i=d.height,s=void 0!==(s=d.autoResize)?s:!n&&!i,n=n||r,i=i||o;var h=t.left+t.right,m=t.top+t.bottom,g=d.maxWidth||65535,p=d.maxHeight||65535;return c._layoutRect=e={x:d.x||0,y:d.y||0,w:n,h:i,deltaW:h,deltaH:m,contentW:n-h,contentH:i-m,innerW:n-h,innerH:i-m,startMinWidth:a||0,startMinHeight:l||0,minW:Math.min(r,g),minH:Math.min(o,p),maxW:g,maxH:p,autoResize:s,scrollW:0},c._lastLayoutRect={},e},layoutRect:function(t){var e,n,i,r,o,s=this,a=s._layoutRect;return a||(a=s.initLayoutRect()),t?(i=a.deltaW,r=a.deltaH,t.x!==undefined&&(a.x=t.x),t.y!==undefined&&(a.y=t.y),t.minW!==undefined&&(a.minW=t.minW),t.minH!==undefined&&(a.minH=t.minH),(n=t.w)!==undefined&&(n=(n=n<a.minW?a.minW:n)>a.maxW?a.maxW:n,a.w=n,a.innerW=n-i),(n=t.h)!==undefined&&(n=(n=n<a.minH?a.minH:n)>a.maxH?a.maxH:n,a.h=n,a.innerH=n-r),(n=t.innerW)!==undefined&&(n=(n=n<a.minW-i?a.minW-i:n)>a.maxW-i?a.maxW-i:n,a.innerW=n,a.w=n+i),(n=t.innerH)!==undefined&&(n=(n=n<a.minH-r?a.minH-r:n)>a.maxH-r?a.maxH-r:n,a.innerH=n,a.h=n+r),t.contentW!==undefined&&(a.contentW=t.contentW),t.contentH!==undefined&&(a.contentH=t.contentH),(e=s._lastLayoutRect).x===a.x&&e.y===a.y&&e.w===a.w&&e.h===a.h||((o=It.repaintControls)&&o.map&&!o.map[s._id]&&(o.push(s),o.map[s._id]=!0),e.x=a.x,e.y=a.y,e.w=a.w,e.h=a.h),s):a},repaint:function(){var t,e,n,i,r,o,s,a,l,u,c=this;l=document.createRange?function(t){return t}:Math.round,t=c.getEl().style,i=c._layoutRect,a=c._lastRepaintRect||{},o=(r=c.borderBox).left+r.right,s=r.top+r.bottom,i.x!==a.x&&(t.left=l(i.x)+"px",a.x=i.x),i.y!==a.y&&(t.top=l(i.y)+"px",a.y=i.y),i.w!==a.w&&(u=l(i.w-o),t.width=(u>=0?u:0)+"px",a.w=i.w),i.h!==a.h&&(u=l(i.h-s),t.height=(u>=0?u:0)+"px",a.h=i.h),c._hasBody&&i.innerW!==a.innerW&&(u=l(i.innerW),(n=c.getEl("body"))&&((e=n.style).width=(u>=0?u:0)+"px"),a.innerW=i.innerW),c._hasBody&&i.innerH!==a.innerH&&(u=l(i.innerH),(n=n||c.getEl("body"))&&((e=e||n.style).height=(u>=0?u:0)+"px"),a.innerH=i.innerH),c._lastRepaintRect=a,c.fire("repaint",{},!1)},updateLayoutRect:function(){var t=this;t.parent()._lastRect=null,vt.css(t.getEl(),{width:"",height:""}),t._layoutRect=t._lastRepaintRect=t._lastLayoutRect=null,t.initLayoutRect()},on:function(t,e){var n,i,r,o=this;return Yt(o).on(t,"string"!=typeof(n=e)?n:function(t){return i||o.parentsAndSelf().each(function(t){var e=t.settings.callbacks;if(e&&(i=e[n]))return r=t,!1}),i?i.call(r,t):(t.action=n,void this.fire("execute",t))}),o},off:function(t,e){return Yt(this).off(t,e),this},fire:function(t,e,n){if((e=e||{}).control||(e.control=this),e=Yt(this).fire(t,e),!1!==n&&this.parent)for(var i=this.parent();i&&!e.isPropagationStopped();)i.fire(t,e,!1),i=i.parent();return e},hasEventListeners:function(t){return Yt(this).has(t)},parents:function(t){var e,n=new Dt;for(e=this.parent();e;e=e.parent())n.add(e);return t&&(n=n.filter(t)),n},parentsAndSelf:function(t){return new Dt(this).add(this.parents(t))},next:function(){var t=this.parent().items();return t[t.indexOf(this)+1]},prev:function(){var t=this.parent().items();return t[t.indexOf(this)-1]},innerHtml:function(t){return this.$el.html(t),this},getEl:function(t){var e=t?this._id+"-"+t:this._id;return this._elmCache[e]||(this._elmCache[e]=yt("#"+e)[0]),this._elmCache[e]},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(t){}return this},blur:function(){return this.getEl().blur(),this},aria:function(t,e){var n=this,i=n.getEl(n.ariaTarget);return void 0===e?n._aria[t]:(n._aria[t]=e,n.state.get("rendered")&&i.setAttribute("role"===t?t:"aria-"+t,e),n)},encode:function(t,e){return!1!==e&&(t=this.translate(t)),(t||"").replace(/[&<>"]/g,function(t){return"&#"+t.charCodeAt(0)+";"})},translate:function(t){return It.translate?It.translate(t):t},before:function(t){var e=this.parent();return e&&e.insert(t,e.items().indexOf(this),!0),this},after:function(t){var e=this.parent();return e&&e.insert(t,e.items().indexOf(this)),this},remove:function(){var t,e,n=this,i=n.getEl(),r=n.parent();if(n.items){var o=n.items().toArray();for(e=o.length;e--;)o[e].remove()}r&&r.items&&(t=[],r.items().each(function(e){e!==n&&t.push(e)}),r.items().set(t),r._lastRect=null),n._eventsRoot&&n._eventsRoot===n&&yt(i).off();var s=n.getRoot().controlIdLookup;return s&&delete s[n._id],i&&i.parentNode&&i.parentNode.removeChild(i),n.state.set("rendered",!1),n.state.destroy(),n.fire("remove"),n},renderBefore:function(t){return yt(t).before(this.renderHtml()),this.postRender(),this},renderTo:function(t){return yt(t||this.getContainerElm()).append(this.renderHtml()),this.postRender(),this},preRender:function(){},render:function(){},renderHtml:function(){return'<div id="'+this._id+'" class="'+this.classes+'"></div>'},postRender:function(){var t,e,n,i,r,o=this,s=o.settings;for(i in o.$el=yt(o.getEl()),o.state.set("rendered",!0),s)0===i.indexOf("on")&&o.on(i.substr(2),s[i]);if(o._eventsRoot){for(n=o.parent();!r&&n;n=n.parent())r=n._eventsRoot;if(r)for(i in r._nativeEvents)o._nativeEvents[i]=!0}Xt(o),s.style&&(t=o.getEl())&&(t.setAttribute("style",s.style),t.style.cssText=s.style),o.settings.border&&(e=o.borderBox,o.$el.css({"border-top-width":e.top,"border-right-width":e.right,"border-bottom-width":e.bottom,"border-left-width":e.left}));var a=o.getRoot();for(var l in a.controlIdLookup||(a.controlIdLookup={}),a.controlIdLookup[o._id]=o,o._aria)o.aria(l,o._aria[l]);!1===o.state.get("visible")&&(o.getEl().style.display="none"),o.bindStates(),o.state.on("change:visible",function(t){var e,n=t.value;o.state.get("rendered")&&(o.getEl().style.display=!1===n?"none":"",o.getEl().getBoundingClientRect()),(e=o.parent())&&(e._lastRect=null),o.fire(n?"show":"hide"),Vt.add(o)}),o.fire("postrender",{},!1)},bindStates:function(){},scrollIntoView:function(t){var e,n,i,r,o,s,a=this.getEl(),l=a.parentNode,u=function(t,e){var n,i,r=t;for(n=i=0;r&&r!==e&&r.nodeType;)n+=r.offsetLeft||0,i+=r.offsetTop||0,r=r.offsetParent;return{x:n,y:i}}(a,l);return e=u.x,n=u.y,i=a.offsetWidth,r=a.offsetHeight,o=l.clientWidth,s=l.clientHeight,"end"===t?(e-=o-i,n-=s-r):"center"===t&&(e-=o/2-i/2,n-=s/2-r/2),l.scrollLeft=e,l.scrollTop=n,this},getRoot:function(){for(var t,e=this,n=[];e;){if(e.rootControl){t=e.rootControl;break}n.push(e),t=e,e=e.parent()}t||(t=this);for(var i=n.length;i--;)n[i].rootControl=t;return t},reflow:function(){Vt.remove(this);var t=this.parent();return t&&t._layout&&!t._layout.isNative()&&t.reflow(),this}};function Yt(t){return t._eventDispatcher||(t._eventDispatcher=new xt({scope:t,toggleEvent:function(e,n){n&&xt.isNative(e)&&(t._nativeEvents||(t._nativeEvents={}),t._nativeEvents[e]=!0,t.state.get("rendered")&&Xt(t))}})),t._eventDispatcher}function Xt(t){var e,n,i,r,o,s;function a(e){var n=t.getParentCtrl(e.target);n&&n.fire(e.type,e)}function l(){var t=r._lastHoverCtrl;t&&(t.fire("mouseleave",{target:t.getEl()}),t.parents().each(function(t){t.fire("mouseleave",{target:t.getEl()})}),r._lastHoverCtrl=null)}function u(e){var n,i,o,s=t.getParentCtrl(e.target),a=r._lastHoverCtrl,l=0;if(s!==a){if(r._lastHoverCtrl=s,(i=s.parents().toArray().reverse()).push(s),a){for((o=a.parents().toArray().reverse()).push(a),l=0;l<o.length&&i[l]===o[l];l++);for(n=o.length-1;n>=l;n--)(a=o[n]).fire("mouseleave",{target:a.getEl()})}for(n=l;n<i.length;n++)(s=i[n]).fire("mouseenter",{target:s.getEl()})}}function c(e){e.preventDefault(),"mousewheel"===e.type?(e.deltaY=-.025*e.wheelDelta,e.wheelDeltaX&&(e.deltaX=-.025*e.wheelDeltaX)):(e.deltaX=0,e.deltaY=e.detail),e=t.fire("wheel",e)}if(o=t._nativeEvents){for((i=t.parents().toArray()).unshift(t),e=0,n=i.length;!r&&e<n;e++)r=i[e]._eventsRoot;for(r||(r=i[i.length-1]||t),t._eventsRoot=r,n=e,e=0;e<n;e++)i[e]._eventsRoot=r;var d=r._delegates;for(s in d||(d=r._delegates={}),o){if(!o)return!1;"wheel"!==s||Ut?("mouseenter"===s||"mouseleave"===s?r._hasMouseEnter||(yt(r.getEl()).on("mouseleave",l).on("mouseover",u),r._hasMouseEnter=1):d[s]||(yt(r.getEl()).on(s,a),d[s]=!0),o[s]=!1):qt?yt(t.getEl()).on("mousewheel",c):yt(t.getEl()).on("DOMMouseScroll",c)}}}_.each("text title visible disabled active value".split(" "),function(t){$t[t]=function(e){return 0===arguments.length?this.state.get(t):(void 0!==e&&this.state.set(t,e),this)}});var Jt=It=bt.extend($t);function Gt(t,e,n){var i,r,o,s,a,l,u,c,d,f;return d=vt.getViewPort(),o=(r=vt.getPos(e)).x,s=r.y,t.state.get("fixed")&&"static"===vt.getRuntimeStyle(document.body,"position")&&(o-=d.x,s-=d.y),i=t.getEl(),a=(f=vt.getSize(i)).width,l=f.height,u=(f=vt.getSize(e)).width,c=f.height,"b"===(n=(n||"").split(""))[0]&&(s+=c),"r"===n[1]&&(o+=u),"c"===n[0]&&(s+=Math.round(c/2)),"c"===n[1]&&(o+=Math.round(u/2)),"b"===n[3]&&(s-=l),"r"===n[4]&&(o-=a),"c"===n[3]&&(s-=Math.round(l/2)),"c"===n[4]&&(o-=Math.round(a/2)),{x:o,y:s,w:a,h:l}}var Kt,Qt={testMoveRel:function(t,e){for(var n=vt.getViewPort(),i=0;i<e.length;i++){var r=Gt(this,t,e[i]);if(this.state.get("fixed")){if(r.x>0&&r.x+r.w<n.w&&r.y>0&&r.y+r.h<n.h)return e[i]}else if(r.x>n.x&&r.x+r.w<n.w+n.x&&r.y>n.y&&r.y+r.h<n.h+n.y)return e[i]}return e[0]},moveRel:function(t,e){"string"!=typeof e&&(e=this.testMoveRel(t,e));var n=Gt(this,t,e);return this.moveTo(n.x,n.y)},moveBy:function(t,e){var n=this.layoutRect();return this.moveTo(n.x+t,n.y+e),this},moveTo:function(t,e){var n=this;function i(t,e,n){return t<0?0:t+n>e&&(t=e-n)<0?0:t}if(n.settings.constrainToViewport){var r=vt.getViewPort(window),o=n.layoutRect();t=i(t,r.w+r.x,o.w),e=i(e,r.h+r.y,o.h)}return n.state.get("rendered")?n.layoutRect({x:t,y:e}).repaint():(n.settings.x=t,n.settings.y=e),n.fire("move",{x:t,y:e}),n}},Zt=Jt.extend({Mixins:[Qt],Defaults:{classes:"widget tooltip tooltip-n"},renderHtml:function(){var t=this,e=t.classPrefix;return'<div id="'+t._id+'" class="'+t.classes+'" role="presentation"><div class="'+e+'tooltip-arrow"></div><div class="'+e+'tooltip-inner">'+t.encode(t.state.get("text"))+"</div></div>"},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl().lastChild.innerHTML=t.encode(e.value)}),t._super()},repaint:function(){var t,e;t=this.getEl().style,e=this._layoutRect,t.left=e.x+"px",t.top=e.y+"px",t.zIndex=131070}}),te=Jt.extend({init:function(t){var e=this;e._super(t),t=e.settings,e.canFocus=!0,t.tooltip&&!1!==te.tooltips&&(e.on("mouseenter",function(n){var i=e.tooltip().moveTo(-65535);if(n.control===e){var r=i.text(t.tooltip).show().testMoveRel(e.getEl(),["bc-tc","bc-tl","bc-tr"]);i.classes.toggle("tooltip-n","bc-tc"===r),i.classes.toggle("tooltip-nw","bc-tl"===r),i.classes.toggle("tooltip-ne","bc-tr"===r),i.moveRel(e.getEl(),r)}else i.hide()}),e.on("mouseleave mousedown click",function(){e.tooltip().hide()})),e.aria("label",t.ariaLabel||t.tooltip)},tooltip:function(){return Kt||(Kt=new Zt({type:"tooltip"})).renderTo(),Kt},postRender:function(){var t=this,e=t.settings;t._super(),t.parent()||!e.width&&!e.height||(t.initLayoutRect(),t.repaint()),e.autofocus&&t.focus()},bindStates:function(){var t=this;function e(e){t.aria("disabled",e),t.classes.toggle("disabled",e)}function n(e){t.aria("pressed",e),t.classes.toggle("active",e)}return t.state.on("change:disabled",function(t){e(t.value)}),t.state.on("change:active",function(t){n(t.value)}),t.state.get("disabled")&&e(!0),t.state.get("active")&&n(!0),t._super()},remove:function(){this._super(),Kt&&(Kt.remove(),Kt=null)}}),ee=te.extend({Defaults:{value:0},init:function(t){this._super(t),this.classes.add("progress"),this.settings.filter||(this.settings.filter=function(t){return Math.round(t)})},renderHtml:function(){var t=this._id,e=this.classPrefix;return'<div id="'+t+'" class="'+this.classes+'"><div class="'+e+'bar-container"><div class="'+e+'bar"></div></div><div class="'+e+'text">0%</div></div>'},postRender:function(){return this._super(),this.value(this.settings.value),this},bindStates:function(){var t=this;function e(e){e=t.settings.filter(e),t.getEl().lastChild.innerHTML=e+"%",t.getEl().firstChild.firstChild.style.width=e+"%"}return t.state.on("change:value",function(t){e(t.value)}),e(t.state.get("value")),t._super()}}),ne=function(t,e){t.getEl().lastChild.textContent=e+(t.progressBar?" "+t.progressBar.value()+"%":"")},ie=Jt.extend({Mixins:[Qt],Defaults:{classes:"widget notification"},init:function(t){var e=this;e._super(t),e.maxWidth=t.maxWidth,t.text&&e.text(t.text),t.icon&&(e.icon=t.icon),t.color&&(e.color=t.color),t.type&&e.classes.add("notification-"+t.type),t.timeout&&(t.timeout<0||t.timeout>0)&&!t.closeButton?e.closeButton=!1:(e.classes.add("has-close"),e.closeButton=!0),t.progressBar&&(e.progressBar=new ee),e.on("click",function(t){-1!==t.target.className.indexOf(e.classPrefix+"close")&&e.close()})},renderHtml:function(){var t,e=this,n=e.classPrefix,i="",r="",o="";return e.icon&&(i='<i class="'+n+"ico "+n+"i-"+e.icon+'"></i>'),t=' style="max-width: '+e.maxWidth+"px;"+(e.color?"background-color: "+e.color+';"':'"'),e.closeButton&&(r='<button type="button" class="'+n+'close" aria-hidden="true">\xd7</button>'),e.progressBar&&(o=e.progressBar.renderHtml()),'<div id="'+e._id+'" class="'+e.classes+'"'+t+' role="presentation">'+i+'<div class="'+n+'notification-inner">'+e.state.get("text")+"</div>"+o+r+'<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;" aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div></div>'},postRender:function(){var t=this;return c.setTimeout(function(){t.$el.addClass(t.classPrefix+"in"),ne(t,t.state.get("text"))},100),t._super()},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl().firstChild.innerHTML=e.value,ne(t,e.value)}),t.progressBar&&(t.progressBar.bindStates(),t.progressBar.state.on("change:value",function(e){ne(t,t.state.get("text"))})),t._super()},close:function(){return this.fire("close").isDefaultPrevented()||this.remove(),this},repaint:function(){var t,e;t=this.getEl().style,e=this._layoutRect,t.left=e.x+"px",t.top=e.y+"px",t.zIndex=65534}});function re(t){var e=function(t){return t.inline?t.getElement():t.getContentAreaContainer()};return{open:function(n,i){var r,o=_.extend(n,{maxWidth:(r=e(t),vt.getSize(r).width)}),s=new ie(o);return s.args=o,o.timeout>0&&(s.timer=setTimeout(function(){s.close(),i()},o.timeout)),s.on("close",function(){i()}),s.renderTo(),s},close:function(t){t.close()},reposition:function(n){var i;i=n,gt.each(i,function(t){t.moveTo(0,0)}),function(n){if(n.length>0){var i=n.slice(0,1)[0],r=e(t);i.moveRel(r,"tc-tc"),gt.each(n,function(t,e){e>0&&t.moveRel(n[e-1].getEl(),"bc-tc")})}}(n)},getArgs:function(t){return t.args}}}function oe(t){var e,n;if(t.changedTouches)for(e="screenX screenY pageX pageY clientX clientY".split(" "),n=0;n<e.length;n++)t[e[n]]=t.changedTouches[0][e[n]]}function se(t,e){var n,i,r,o,s,a,l,u=e.document||document;function c(){return u.getElementById(e.handle||t)}e=e||{},r=function(t){var r,d,f,h,m,g,p,v,y,b,x,w,_=(r=u,b=Math.max,d=r.documentElement,f=r.body,h=b(d.scrollWidth,f.scrollWidth),m=b(d.clientWidth,f.clientWidth),g=b(d.offsetWidth,f.offsetWidth),p=b(d.scrollHeight,f.scrollHeight),v=b(d.clientHeight,f.clientHeight),y=b(d.offsetHeight,f.offsetHeight),{width:h<g?m:h,height:p<y?v:p});oe(t),t.preventDefault(),i=t.button,x=c(),a=t.screenX,l=t.screenY,w=window.getComputedStyle?window.getComputedStyle(x,null).getPropertyValue("cursor"):x.runtimeStyle.cursor,n=yt("<div></div>").css({position:"absolute",top:0,left:0,width:_.width,height:_.height,zIndex:2147483647,opacity:1e-4,cursor:w}).appendTo(u.body),yt(u).on("mousemove touchmove",s).on("mouseup touchend",o),e.start(t)},s=function(t){if(oe(t),t.button!==i)return o(t);t.deltaX=t.screenX-a,t.deltaY=t.screenY-l,t.preventDefault(),e.drag(t)},o=function(t){oe(t),yt(u).off("mousemove touchmove",s).off("mouseup touchend",o),n.remove(),e.stop&&e.stop(t)},this.destroy=function(){yt(c()).off()},yt(c()).on("mousedown touchstart",r)}var ae=tinymce.util.Tools.resolve("tinymce.ui.Factory"),le=function(t){return!!t.getAttribute("data-mce-tabstop")};function ue(t){var e,n,i=t.root;function r(t){return t&&1===t.nodeType}try{e=document.activeElement}catch(b){e=document.body}function o(t){return r(t=t||e)?t.getAttribute("role"):null}function s(t){for(var n,i=t||e;i=i.parentNode;)if(n=o(i))return n}function a(t){var n=e;if(r(n))return n.getAttribute("aria-"+t)}function l(t){var e=t.tagName.toUpperCase();return"INPUT"===e||"TEXTAREA"===e||"SELECT"===e}function u(t){var e=[];return function n(t){if(1===t.nodeType&&"none"!==t.style.display&&!t.disabled){var i;(l(i=t)&&!i.hidden||le(i)||/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(o(i)))&&e.push(t);for(var r=0;r<t.childNodes.length;r++)n(t.childNodes[r])}}(t||i.getEl()),e}function c(t){var e,i;(i=(t=t||n).parents().toArray()).unshift(t);for(var r=0;r<i.length&&!(e=i[r]).settings.ariaRoot;r++);return e}function d(t,e){return t<0?t=e.length-1:t>=e.length&&(t=0),e[t]&&e[t].focus(),t}function f(t,n){var i=-1,r=c();n=n||u(r.getEl());for(var o=0;o<n.length;o++)n[o]===e&&(i=o);i+=t,r.lastAriaIndex=d(i,n)}function h(){"tablist"===s()?f(-1,u(e.parentNode)):n.parent().submenu?v():f(-1)}function m(){var t=o(),n=s();"tablist"===n?f(1,u(e.parentNode)):"menuitem"===t&&"menu"===n&&a("haspopup")?y():f(1)}function g(){f(-1)}function p(){var t=o(),e=s();"menuitem"===t&&"menubar"===e?y():"button"===t&&a("haspopup")?y({key:"down"}):f(1)}function v(){n.fire("cancel")}function y(t){t=t||{},n.fire("click",{target:e,aria:t})}return n=i.getParentCtrl(e),i.on("keydown",function(t){function i(t,n){l(e)||le(e)||"slider"!==o(e)&&!1!==n(t)&&t.preventDefault()}if(!t.isDefaultPrevented())switch(t.keyCode){case 37:i(t,h);break;case 39:i(t,m);break;case 38:i(t,g);break;case 40:i(t,p);break;case 27:v();break;case 14:case 13:case 32:i(t,y);break;case 9:!function(t){if("tablist"===s()){var e=u(n.getEl("body"))[0];e&&e.focus()}else f(t.shiftKey?-1:1)}(t),t.preventDefault()}}),i.on("focusin",function(t){e=t.target,n=t.control}),{focusFirst:function(t){var e=c(t),n=u(e.getEl());e.settings.ariaRemember&&"lastAriaIndex"in e?d(e.lastAriaIndex,n):d(0,n)}}}var ce,de,fe,he,me={},ge=Jt.extend({init:function(t){var e=this;e._super(t),(t=e.settings).fixed&&e.state.set("fixed",!0),e._items=new Dt,e.isRtl()&&e.classes.add("rtl"),e.bodyClasses=new kt(function(){e.state.get("rendered")&&(e.getEl("body").className=this.toString())}),e.bodyClasses.prefix=e.classPrefix,e.classes.add("container"),e.bodyClasses.add("container-body"),t.containerCls&&e.classes.add(t.containerCls),e._layout=ae.create((t.layout||"")+"layout"),e.settings.items?e.add(e.settings.items):e.add(e.render()),e._hasBody=!0},items:function(){return this._items},find:function(t){return(t=me[t]=me[t]||new Pt(t)).find(this)},add:function(t){return this.items().add(this.create(t)).parent(this),this},focus:function(t){var e,n,i,r=this;if(!t||!(n=r.keyboardNav||r.parents().eq(-1)[0].keyboardNav))return i=r.find("*"),r.statusbar&&i.add(r.statusbar.items()),i.each(function(t){if(t.settings.autofocus)return e=null,!1;t.canFocus&&(e=e||t)}),e&&e.focus(),r;n.focusFirst(r)},replace:function(t,e){for(var n,i=this.items(),r=i.length;r--;)if(i[r]===t){i[r]=e;break}r>=0&&((n=e.getEl())&&n.parentNode.removeChild(n),(n=t.getEl())&&n.parentNode.removeChild(n)),e.parent(this)},create:function(t){var e,n=this,i=[];return _.isArray(t)||(t=[t]),_.each(t,function(t){t&&(t instanceof Jt||("string"==typeof t&&(t={type:t}),e=_.extend({},n.settings.defaults,t),t.type=e.type=e.type||t.type||n.settings.defaultType||(e.defaults?e.defaults.type:null),t=ae.create(e)),i.push(t))}),i},renderNew:function(){var t=this;return t.items().each(function(e,n){var i;e.parent(t),e.state.get("rendered")||((i=t.getEl("body")).hasChildNodes()&&n<=i.childNodes.length-1?yt(i.childNodes[n]).before(e.renderHtml()):yt(i).append(e.renderHtml()),e.postRender(),Vt.add(e))}),t._layout.applyClasses(t.items().filter(":visible")),t._lastRect=null,t},append:function(t){return this.add(t).renderNew()},prepend:function(t){return this.items().set(this.create(t).concat(this.items().toArray())),this.renderNew()},insert:function(t,e,n){var i,r,o;return t=this.create(t),i=this.items(),!n&&e<i.length-1&&(e+=1),e>=0&&e<i.length&&(r=i.slice(0,e).toArray(),o=i.slice(e).toArray(),i.set(r.concat(t,o))),this.renderNew()},fromJSON:function(t){for(var e in t)this.find("#"+e).value(t[e]);return this},toJSON:function(){var t={};return this.find("*").each(function(e){var n=e.name(),i=e.value();n&&void 0!==i&&(t[n]=i)}),t},renderHtml:function(){var t=this,e=t._layout,n=this.settings.role;return t.preRender(),e.preRender(t),'<div id="'+t._id+'" class="'+t.classes+'"'+(n?' role="'+this.settings.role+'"':"")+'><div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+(t.settings.html||"")+e.renderHtml(t)+"</div></div>"},postRender:function(){var t,e=this;return e.items().exec("postRender"),e._super(),e._layout.postRender(e),e.state.set("rendered",!0),e.settings.style&&e.$el.css(e.settings.style),e.settings.border&&(t=e.borderBox,e.$el.css({"border-top-width":t.top,"border-right-width":t.right,"border-bottom-width":t.bottom,"border-left-width":t.left})),e.parent()||(e.keyboardNav=ue({root:e})),e},initLayoutRect:function(){var t=this._super();return this._layout.recalc(this),t},recalc:function(){var t=this,e=t._layoutRect,n=t._lastRect;if(!n||n.w!==e.w||n.h!==e.h)return t._layout.recalc(t),e=t.layoutRect(),t._lastRect={x:e.x,y:e.y,w:e.w,h:e.h},!0},reflow:function(){var t;if(Vt.remove(this),this.visible()){for(Jt.repaintControls=[],Jt.repaintControls.map={},this.recalc(),t=Jt.repaintControls.length;t--;)Jt.repaintControls[t].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),Jt.repaintControls=[]}return this}}),pe={init:function(){this.on("repaint",this.renderScroll)},renderScroll:function(){var t=this,e=2;function n(){var n,i,r;function o(r,o,s,a,l,u){var c,d,f,h,m,g,p,v;if(d=t.getEl("scroll"+r)){if(p=o.toLowerCase(),v=s.toLowerCase(),yt(t.getEl("absend")).css(p,t.layoutRect()[a]-1),!l)return void yt(d).css("display","none");yt(d).css("display","block"),c=t.getEl("body"),f=t.getEl("scroll"+r+"t"),h=c["client"+s]-2*e,m=(h-=n&&i?d["client"+u]:0)/c["scroll"+s],(g={})[p]=c["offset"+o]+e,g[v]=h,yt(d).css(g),(g={})[p]=c["scroll"+o]*m,g[v]=h*m,yt(f).css(g)}}r=t.getEl("body"),n=r.scrollWidth>r.clientWidth,i=r.scrollHeight>r.clientHeight,o("h","Left","Width","contentW",n,"Height"),o("v","Top","Height","contentH",i,"Width")}t.settings.autoScroll&&(t._hasScroll||(t._hasScroll=!0,function(){function n(n,i,r,o,s){var a,l=t._id+"-scroll"+n,u=t.classPrefix;yt(t.getEl()).append('<div id="'+l+'" class="'+u+"scrollbar "+u+"scrollbar-"+n+'"><div id="'+l+'t" class="'+u+'scrollbar-thumb"></div></div>'),t.draghelper=new se(l+"t",{start:function(){a=t.getEl("body")["scroll"+i],yt("#"+l).addClass(u+"active")},drag:function(l){var u,c,d,f,h=t.layoutRect();c=h.contentW>h.innerW,d=h.contentH>h.innerH,f=t.getEl("body")["client"+r]-2*e,u=(f-=c&&d?t.getEl("scroll"+n)["client"+s]:0)/t.getEl("body")["scroll"+r],t.getEl("body")["scroll"+i]=a+l["delta"+o]/u},stop:function(){yt("#"+l).removeClass(u+"active")}})}t.classes.add("scroll"),n("v","Top","Height","Y","Width"),n("h","Left","Width","X","Height")}(),t.on("wheel",function(e){var i=t.getEl("body");i.scrollLeft+=10*(e.deltaX||0),i.scrollTop+=10*e.deltaY,n()}),yt(t.getEl("body")).on("scroll",n)),n())}},ve=ge.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[pe],renderHtml:function(){var t=this,e=t._layout,n=t.settings.html;return t.preRender(),e.preRender(t),void 0===n?n='<div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+e.renderHtml(t)+"</div>":("function"==typeof n&&(n=n.call(t)),t._hasBody=!1),'<div id="'+t._id+'" class="'+t.classes+'" hidefocus="1" tabindex="-1" role="group">'+(t._preBodyHtml||"")+n+"</div>"}}),ye={resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo:function(t,e){if(t<=1||e<=1){var n=vt.getWindowSize();t=t<=1?t*n.w:t,e=e<=1?e*n.h:e}return this._layoutRect.autoResize=!1,this.layoutRect({minW:t,minH:e,w:t,h:e}).reflow()},resizeBy:function(t,e){var n=this.layoutRect();return this.resizeTo(n.w+t,n.h+e)}},be=[],xe=[];function we(t,e){for(;t;){if(t===e)return!0;t=t.parent()}}function _e(){ce||(ce=function(t){2!==t.button&&function(t){for(var e=be.length;e--;){var n=be[e],i=n.getParentCtrl(t.target);if(n.settings.autohide){if(i&&(we(i,n)||n.parent()===i))continue;(t=n.fire("autohide",{target:t.target})).isDefaultPrevented()||n.hide()}}}(t)},yt(document).on("click touchstart",ce))}function Re(t){var e=vt.getViewPort().y;function n(e,n){for(var i,r=0;r<be.length;r++)if(be[r]!==t)for(i=be[r].parent();i&&(i=i.parent());)i===t&&be[r].fixed(e).moveBy(0,n).repaint()}t.settings.autofix&&(t.state.get("fixed")?t._autoFixY>e&&(t.fixed(!1).layoutRect({y:t._autoFixY}).repaint(),n(!1,t._autoFixY-e)):(t._autoFixY=t.layoutRect().y,t._autoFixY<e&&(t.fixed(!0).layoutRect({y:0}).repaint(),n(!0,e-t._autoFixY))))}function ke(t,e){var n,i,r=Ce.zIndex||65535;if(t)xe.push(e);else for(n=xe.length;n--;)xe[n]===e&&xe.splice(n,1);if(xe.length)for(n=0;n<xe.length;n++)xe[n].modal&&(r++,i=xe[n]),xe[n].getEl().style.zIndex=r,xe[n].zIndex=r,r++;var o=yt("#"+e.classPrefix+"modal-block",e.getContainerElm())[0];i?yt(o).css("z-index",i.zIndex-1):o&&(o.parentNode.removeChild(o),he=!1),Ce.currentZIndex=r}var Ce=ve.extend({Mixins:[Qt,ye],init:function(t){var e=this;e._super(t),e._eventsRoot=e,e.classes.add("floatpanel"),t.autohide&&(_e(),function(){if(!fe){var t=document.documentElement,e=t.clientWidth,n=t.clientHeight;fe=function(){document.all&&e===t.clientWidth&&n===t.clientHeight||(e=t.clientWidth,n=t.clientHeight,Ce.hideAll())},yt(window).on("resize",fe)}}(),be.push(e)),t.autofix&&(de||(de=function(){var t;for(t=be.length;t--;)Re(be[t])},yt(window).on("scroll",de)),e.on("move",function(){Re(this)})),e.on("postrender show",function(t){if(t.control===e){var n,i=e.classPrefix;e.modal&&!he&&((n=yt("#"+i+"modal-block",e.getContainerElm()))[0]||(n=yt('<div id="'+i+'modal-block" class="'+i+"reset "+i+'fade"></div>').appendTo(e.getContainerElm())),c.setTimeout(function(){n.addClass(i+"in"),yt(e.getEl()).addClass(i+"in")}),he=!0),ke(!0,e)}}),e.on("show",function(){e.parents().each(function(t){if(t.state.get("fixed"))return e.fixed(!0),!1})}),t.popover&&(e._preBodyHtml='<div class="'+e.classPrefix+'arrow"></div>',e.classes.add("popover").add("bottom").add(e.isRtl()?"end":"start")),e.aria("label",t.ariaLabel),e.aria("labelledby",e._id),e.aria("describedby",e.describedBy||e._id+"-none")},fixed:function(t){var e=this;if(e.state.get("fixed")!==t){if(e.state.get("rendered")){var n=vt.getViewPort();t?e.layoutRect().y-=n.y:e.layoutRect().y+=n.y}e.classes.toggle("fixed",t),e.state.set("fixed",t)}return e},show:function(){var t,e=this._super();for(t=be.length;t--&&be[t]!==this;);return-1===t&&be.push(this),e},hide:function(){return Ee(this),ke(!1,this),this._super()},hideAll:function(){Ce.hideAll()},close:function(){return this.fire("close").isDefaultPrevented()||(this.remove(),ke(!1,this)),this},remove:function(){Ee(this),this._super()},postRender:function(){return this.settings.bodyRole&&this.getEl("body").setAttribute("role",this.settings.bodyRole),this._super()}});function Ee(t){var e;for(e=be.length;e--;)be[e]===t&&be.splice(e,1);for(e=xe.length;e--;)xe[e]===t&&xe.splice(e,1)}Ce.hideAll=function(){for(var t=be.length;t--;){var e=be[t];e&&e.settings.autohide&&(e.hide(),be.splice(t,1))}};var He=[],Se="";function Me(t){var e,n=yt("meta[name=viewport]")[0];!1!==l.overrideViewPort&&(n||((n=document.createElement("meta")).setAttribute("name","viewport"),document.getElementsByTagName("head")[0].appendChild(n)),(e=n.getAttribute("content"))&&void 0!==Se&&(Se=e),n.setAttribute("content",t?"width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0":Se))}function Te(t,e){(function(){for(var t=0;t<He.length;t++)if(He[t]._fullscreen)return!0;return!1})()&&!1===e&&yt([document.documentElement,document.body]).removeClass(t+"fullscreen")}var Pe=Ce.extend({modal:!0,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(t){var e=this;e._super(t),e.isRtl()&&e.classes.add("rtl"),e.classes.add("window"),e.bodyClasses.add("window-body"),e.state.set("fixed",!0),t.buttons&&(e.statusbar=new ve({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:e.isRtl()?"start":"end",defaults:{type:"button"},items:t.buttons}),e.statusbar.classes.add("foot"),e.statusbar.parent(e)),e.on("click",function(t){var n=e.classPrefix+"close";(vt.hasClass(t.target,n)||vt.hasClass(t.target.parentNode,n))&&e.close()}),e.on("cancel",function(){e.close()}),e.aria("describedby",e.describedBy||e._id+"-none"),e.aria("label",t.title),e._fullscreen=!1},recalc:function(){var t,e,n,i,r=this,o=r.statusbar;r._fullscreen&&(r.layoutRect(vt.getWindowSize()),r.layoutRect().contentH=r.layoutRect().innerH),r._super(),t=r.layoutRect(),r.settings.title&&!r._fullscreen&&(e=t.headerW)>t.w&&(n=t.x-Math.max(0,e/2),r.layoutRect({w:e,x:n}),i=!0),o&&(o.layoutRect({w:r.layoutRect().innerW}).recalc(),(e=o.layoutRect().minW+t.deltaW)>t.w&&(n=t.x-Math.max(0,e-t.w),r.layoutRect({w:e,x:n}),i=!0)),i&&r.recalc()},initLayoutRect:function(){var t,e=this,n=e._super(),i=0;if(e.settings.title&&!e._fullscreen){t=e.getEl("head");var r=vt.getSize(t);n.headerW=r.width,n.headerH=r.height,i+=n.headerH}e.statusbar&&(i+=e.statusbar.layoutRect().h),n.deltaH+=i,n.minH+=i,n.h+=i;var o=vt.getWindowSize();return n.x=e.settings.x||Math.max(0,o.w/2-n.w/2),n.y=e.settings.y||Math.max(0,o.h/2-n.h/2),n},renderHtml:function(){var t=this,e=t._layout,n=t._id,i=t.classPrefix,r=t.settings,o="",s="",a=r.html;return t.preRender(),e.preRender(t),r.title&&(o='<div id="'+n+'-head" class="'+i+'window-head"><div id="'+n+'-title" class="'+i+'title">'+t.encode(r.title)+'</div><div id="'+n+'-dragh" class="'+i+'dragh"></div><button type="button" class="'+i+'close" aria-hidden="true"><i class="mce-ico mce-i-remove"></i></button></div>'),r.url&&(a='<iframe src="'+r.url+'" tabindex="-1"></iframe>'),void 0===a&&(a=e.renderHtml(t)),t.statusbar&&(s=t.statusbar.renderHtml()),'<div id="'+n+'" class="'+t.classes+'" hidefocus="1"><div class="'+t.classPrefix+'reset" role="application">'+o+'<div id="'+n+'-body" class="'+t.bodyClasses+'">'+a+"</div>"+s+"</div></div>"},fullscreen:function(t){var e,n,i=this,r=document.documentElement,o=i.classPrefix;if(t!==i._fullscreen)if(yt(window).on("resize",function(){var t;if(i._fullscreen)if(e)i._timer||(i._timer=c.setTimeout(function(){var t=vt.getWindowSize();i.moveTo(0,0).resizeTo(t.w,t.h),i._timer=0},50));else{t=(new Date).getTime();var n=vt.getWindowSize();i.moveTo(0,0).resizeTo(n.w,n.h),(new Date).getTime()-t>50&&(e=!0)}}),n=i.layoutRect(),i._fullscreen=t,t){i._initial={x:n.x,y:n.y,w:n.w,h:n.h},i.borderBox=wt("0"),i.getEl("head").style.display="none",n.deltaH-=n.headerH+2,yt([r,document.body]).addClass(o+"fullscreen"),i.classes.add("fullscreen");var s=vt.getWindowSize();i.moveTo(0,0).resizeTo(s.w,s.h)}else i.borderBox=wt(i.settings.border),i.getEl("head").style.display="",n.deltaH+=n.headerH,yt([r,document.body]).removeClass(o+"fullscreen"),i.classes.remove("fullscreen"),i.moveTo(i._initial.x,i._initial.y).resizeTo(i._initial.w,i._initial.h);return i.reflow()},postRender:function(){var t,e=this;setTimeout(function(){e.classes.add("in"),e.fire("open")},0),e._super(),e.statusbar&&e.statusbar.postRender(),e.focus(),this.dragHelper=new se(e._id+"-dragh",{start:function(){t={x:e.layoutRect().x,y:e.layoutRect().y}},drag:function(n){e.moveTo(t.x+n.deltaX,t.y+n.deltaY)}}),e.on("submit",function(t){t.isDefaultPrevented()||e.close()}),He.push(e),Me(!0)},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var t,e=this;for(e.dragHelper.destroy(),e._super(),e.statusbar&&this.statusbar.remove(),Te(e.classPrefix,!1),t=He.length;t--;)He[t]===e&&He.splice(t,1);Me(He.length>0)},getContentWindow:function(){var t=this.getEl().getElementsByTagName("iframe")[0];return t?t.contentWindow:null}});!function(){if(!l.desktop){var t={w:window.innerWidth,h:window.innerHeight};c.setInterval(function(){var e=window.innerWidth,n=window.innerHeight;t.w===e&&t.h===n||(t={w:e,h:n},yt(window).trigger("resize"))},100)}yt(window).on("resize",function(){var t,e,n=vt.getWindowSize();for(t=0;t<He.length;t++)e=He[t].layoutRect(),He[t].moveTo(He[t].settings.x||Math.max(0,n.w/2-e.w/2),He[t].settings.y||Math.max(0,n.h/2-e.h/2))})}();var We=Pe.extend({init:function(t){t={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:!0,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200}},this._super(t)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(t){var e,n=t.callback||function(){};function i(t,e,i){return{type:"button",text:t,subtype:i?"primary":"",onClick:function(t){t.control.parents()[1].close(),n(e)}}}switch(t.buttons){case We.OK_CANCEL:e=[i("Ok",!0,!0),i("Cancel",!1)];break;case We.YES_NO:case We.YES_NO_CANCEL:e=[i("Yes",1,!0),i("No",0)],t.buttons===We.YES_NO_CANCEL&&e.push(i("Cancel",-1));break;default:e=[i("Ok",!0,!0)]}return new Pe({padding:20,x:t.x,y:t.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:e,title:t.title,role:"alertdialog",items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200,text:t.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:t.onClose,onCancel:function(){n(!1)}}).renderTo(document.body).reflow()},alert:function(t,e){return"string"==typeof t&&(t={text:t}),t.callback=e,We.msgBox(t)},confirm:function(t,e){return"string"==typeof t&&(t={text:t}),t.callback=e,t.buttons=We.OK_CANCEL,We.msgBox(t)}}}),Ne=function(t,e){return{renderUI:function(){return X(t,e)},getNotificationManagerImpl:function(){return re(t)},getWindowManagerImpl:function(){return{open:function(t,e,n){var i;return t.title=t.title||" ",t.url=t.url||t.file,t.url&&(t.width=parseInt(t.width||320,10),t.height=parseInt(t.height||240,10)),t.body&&(t.items={defaults:t.defaults,type:t.bodyType||"form",items:t.body,data:t.data,callbacks:t.commands}),t.url||t.buttons||(t.buttons=[{text:"Ok",subtype:"primary",onclick:function(){i.find("form")[0].submit()}},{text:"Cancel",onclick:function(){i.close()}}]),(i=new Pe(t)).on("close",function(){n(i)}),t.data&&i.on("postRender",function(){this.find("*").each(function(e){var n=e.name();n in t.data&&e.value(t.data[n])})}),i.features=t||{},i.params=e||{},i=i.renderTo().reflow()},alert:function(t,e,n){var i;return(i=We.alert(t,function(){e()})).on("close",function(){n(i)}),i},confirm:function(t,e,n){var i;return(i=We.confirm(t,function(t){e(t)})).on("close",function(){n(i)}),i},close:function(t){t.close()},getParams:function(t){return t.params},setParams:function(t,e){t.params=e}}}}},De="undefined"!=typeof window?window:Function("return this;")(),Ae=function(t,e){for(var n=e!==undefined&&null!==e?e:De,i=0;i<t.length&&n!==undefined&&null!==n;++i)n=n[t[i]];return n},Oe=function(t,e){var n=t.split(".");return Ae(n,e)},Be={getOrDie:function(t,e){var n=Oe(t,e);if(n===undefined||null===n)throw t+" not available on this browser";return n}},Le=tinymce.util.Tools.resolve("tinymce.util.Promise"),Ie=function(t){return new Le(function(e){var n=new function(){return new(Be.getOrDie("FileReader"))};n.onloadend=function(){e(n.result.split(",")[1])},n.readAsDataURL(t)})},ze=function(){return new Le(function(t){var e;(e=document.createElement("input")).type="file",e.style.position="fixed",e.style.left=0,e.style.top=0,e.style.opacity=.001,document.body.appendChild(e),e.onchange=function(e){t(Array.prototype.slice.call(e.target.files))},e.click(),e.parentNode.removeChild(e)})},Fe=0,Ve=function(t){return t+Fe+++(e=function(){return Math.round(4294967295*Math.random()).toString(36)},"s"+Date.now().toString(36)+e()+e()+e());var e},qe=function(t,e){var n={};function i(i){var r,o,s;o=e[i?"startContainer":"endContainer"],s=e[i?"startOffset":"endOffset"],1===o.nodeType&&(r=t.create("span",{"data-mce-type":"bookmark"}),o.hasChildNodes()?(s=Math.min(s,o.childNodes.length-1),i?o.insertBefore(r,o.childNodes[s]):t.insertAfter(r,o.childNodes[s])):o.appendChild(r),o=r,s=0),n[i?"startContainer":"endContainer"]=o,n[i?"startOffset":"endOffset"]=s}return i(!0),e.collapsed||i(),n},Ue=function(t,e){function n(n){var i,r,o;i=o=e[n?"startContainer":"endContainer"],r=e[n?"startOffset":"endOffset"],i&&(1===i.nodeType&&(r=function(t){for(var e=t.parentNode.firstChild,n=0;e;){if(e===t)return n;1===e.nodeType&&"bookmark"===e.getAttribute("data-mce-type")||n++,e=e.nextSibling}return-1}(i),i=i.parentNode,t.remove(o)),e[n?"startContainer":"endContainer"]=i,e[n?"startOffset":"endOffset"]=r)}n(!0),n();var i=t.createRng();return i.setStart(e.startContainer,e.startOffset),e.endContainer&&i.setEnd(e.endContainer,e.endOffset),i},je=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),$e=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Ye=function(t){return"A"===t.nodeName&&t.hasAttribute("href")},Xe=function(t){var e,n,i,r,o,s,a,l;return r=t.selection,o=t.dom,s=r.getRng(),a=o,l=$e.getNode(s.startContainer,s.startOffset),e=a.getParent(l,Ye)||l,n=$e.getNode(s.endContainer,s.endOffset),i=t.getBody(),_.grep(function(t,e,n){var i,r,o=[];for(i=new je(e,t),r=e;r&&(1===r.nodeType&&o.push(r),r!==n);r=i.next());return o}(i,e,n),Ye)},Je=function(t){var e,n,i,r,o;e=t,n=Xe(t),r=e.dom,o=e.selection,i=qe(r,o.getRng()),_.each(n,function(t){e.dom.remove(t,!0)}),o.setRng(Ue(r,i))},Ge=function(t){t.selection.collapse(!1)},Ke=function(t){t.focus(),Je(t),Ge(t)},Qe=function(t,e){var n,i,r,o,s,a=t.dom.getParent(t.selection.getStart(),"a[href]");a?(o=a,s=e,(r=t).focus(),r.dom.setAttrib(o,"href",s),Ge(r)):(i=e,(n=t).execCommand("mceInsertLink",!1,{href:i}),Ge(n))},Ze=function(t,e,n){t.undoManager.transact(function(){var i,r;t.insertContent(function(t,e){var n,i,r;for(r='<table data-mce-id="mce" style="width: 100%">',r+="<tbody>",i=0;i<e;i++){for(r+="<tr>",n=0;n<t;n++)r+="<td><br></td>";r+="</tr>"}return r+="</tbody>",r+="</table>"}(e,n)),(i=t.dom.select("*[data-mce-id]")[0]).removeAttribute("data-mce-id"),r=t.dom.select("td,th",i),t.selection.setCursorLocation(r[0],0)})},tn=function(t,e){t.execCommand("FormatBlock",!1,e)},en=function(t,e,n){var i,r;r=(i=t.editorUpload.blobCache).create(Ve("mceu"),n,e),i.add(r),t.insertContent(t.dom.createHTML("img",{src:r.blobUri()}))},nn=function(t,e){0===e.trim().length?Ke(t):Qe(t,e)},rn=Ke,on=function(t,e){t.addButton("quicklink",{icon:"link",tooltip:"Insert/Edit link",stateSelector:"a[href]",onclick:function(){e.showForm(t,"quicklink")}}),t.addButton("quickimage",{icon:"image",tooltip:"Insert image",onclick:function(){ze().then(function(e){var n=e[0];Ie(n).then(function(e){en(t,e,n)})})}}),t.addButton("quicktable",{icon:"table",tooltip:"Insert table",onclick:function(){e.hide(),Ze(t,2,2)}}),function(t){for(var e=function(e){return function(){tn(t,e)}},n=1;n<6;n++){var i="h"+n;t.addButton(i,{text:i.toUpperCase(),tooltip:"Heading "+n,stateSelector:i,onclick:e(i),onPostRender:function(){this.getEl().firstChild.firstChild.style.fontWeight="bold"}})}}(t)},sn={getUiContainerDelta:function(){var t=l.container;if(t&&"static"!==u.DOM.getStyle(t,"position",!0)){var e=u.DOM.getPos(t),n=e.x-t.scrollLeft,i=e.y-t.scrollTop;return nt.some({x:n,y:i})}return nt.none()}},an=function(t){return/^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(t.trim())},ln=function(t){return/^https?:\/\//.test(t.trim())},un=function(t,e){return!ln(e)&&an(e)?(n=t,i=e,new Le(function(t){n.windowManager.confirm("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(e){t(!0===e?"http://"+i:i)})})):Le.resolve(e);var n,i},cn={createQuickLinkForm:function(t,e){var n,i,r,o={};return n="quicklink",i={items:[{type:"button",name:"unlink",icon:"unlink",onclick:function(){t.focus(),rn(t),e()},tooltip:"Remove link"},{type:"filepicker",name:"linkurl",placeholder:"Paste or type a link",filetype:"file",onchange:function(t){var e=t.meta;e&&e.attach&&(o={href:this.value(),attach:e.attach})}},{type:"button",icon:"checkmark",subtype:"primary",tooltip:"Ok",onclick:"submit"}],onshow:function(e){if(e.control===this){var n,i="";(n=t.dom.getParent(t.selection.getStart(),"a[href]"))&&(i=t.dom.getAttrib(n,"href")),this.fromJSON({linkurl:i}),r=this.find("#unlink"),n?r.show():r.hide(),this.find("#linkurl")[0].focus()}var r},onsubmit:function(n){un(t,n.data.linkurl).then(function(n){t.undoManager.transact(function(){n===o.href&&(o.attach(),o={}),nn(t,n)}),e()})}},(r=ae.create(_.extend({type:"form",layout:"flex",direction:"row",padding:5,name:n,spacing:3},i))).on("show",function(){r.find("textbox").eq(0).each(function(t){t.focus()})}),r}},dn={create:function(t,e,n){var i,r,o=[];if(n)return _.each((r=n,W.isArray(r)?r:W.isString(r)?r.split(/[ ,]/):[]),function(e){var n,r,s;"|"===e?i=null:t.buttons[e]&&(i||(i={type:"buttongroup",items:[]},o.push(i)),n=e,"function"==typeof(e=t.buttons[n])&&(e=e()),e.type=e.type||"button",(e=ae.create(e)).on("postRender",(r=t,s=e,function(){var t,e,n=(e=function(t,e){return{selector:t,handler:e}},(t=s).settings.stateSelector?e(t.settings.stateSelector,function(e){t.active(e)}):t.settings.disabledStateSelector?e(t.settings.disabledStateSelector,function(e){t.disabled(e)}):null);null!==n&&r.selection.selectorChanged(n.selector,n.handler)})),i.items.push(e))}),ae.create({type:"toolbar",layout:"flow",name:e,items:o})}};function fn(){var t,e,n=function(t){return t.items().length>0},i=function(t,e){var i,r,o=(i=t,r=e,_.map(r,function(t){return dn.create(i,t.id,t.items)})).concat([dn.create(t,"text",F.getTextSelectionToolbarItems(t)),dn.create(t,"insert",F.getInsertToolbarItems(t)),cn.createQuickLinkForm(t,c)]);return ae.create({type:"floatpanel",role:"dialog",classes:"tinymce tinymce-inline arrow",ariaLabel:"Inline toolbar",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fixed:!0,border:1,items:_.grep(o,n),oncancel:function(){t.focus()}})},r=function(t){t&&t.show()},o=function(t,e){t.moveTo(e.x,e.y)},s=function(t,e){e=e?e.substr(0,2):"",_.each({t:"down",b:"up",c:"center"},function(n,i){t.classes.toggle("arrow-"+n,i===e.substr(0,1))}),"cr"===e?(t.classes.toggle("arrow-left",!0),t.classes.toggle("arrow-right",!1)):"cl"===e?(t.classes.toggle("arrow-left",!0),t.classes.toggle("arrow-right",!0)):_.each({l:"left",r:"right"},function(n,i){t.classes.toggle("arrow-"+n,i===e.substr(1,1))})},a=function(t,e){var n=t.items().filter("#"+e);return n.length>0&&(n[0].show(),t.reflow(),!0)},l=function(t,n,i,r){var a,l,c,d;if(d=F.getPositionHandler(i),a=b.getContentAreaRect(i),l=u.DOM.getRect(t.getEl()),c="insert"===n?z.calcInsert(r,a,l):z.calc(r,a,l)){var f=sn.getUiContainerDelta().getOr({x:0,y:0}),h={x:c.rect.x-f.x,y:c.rect.y-f.y,w:c.rect.w,h:c.rect.h};return e=r,o(t,z.userConstrain(d,r,a,h)),s(t,c.position),!0}return!1},c=function(){t&&t.hide()};return{show:function(e,n,o,s){var u,d,f,h;t||(H.fireBeforeRenderUI(e),(t=i(e,s)).renderTo().reflow().moveTo(o.x,o.y),e.nodeChanged()),d=n,f=e,h=o,r(u=t),u.items().hide(),a(u,d)?!1===l(u,d,f,h)&&c():c()},showForm:function(n,i){if(t){if(t.items().hide(),!a(t,i))return void c();var l,d,f,h=void 0;r(t),t.items().hide(),a(t,i),f=F.getPositionHandler(n),l=b.getContentAreaRect(n),h=u.DOM.getRect(t.getEl()),(d=z.calc(e,l,h))&&(h=d.rect,o(t,z.userConstrain(f,e,l,h)),s(t,d.position))}},reposition:function(e,n,i){t&&l(t,n,e,i)},inForm:function(){return t&&t.visible()&&t.items().filter("form:visible").length>0},hide:c,focus:function(){t&&t.find("toolbar:visible").eq(0).each(function(t){t.focus(!0)})},remove:function(){t&&(t.remove(),t=null)}}}var hn,mn=bt.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(t){this.settings=_.extend({},this.Defaults,t)},preRender:function(t){t.bodyClasses.add(this.settings.containerClass)},applyClasses:function(t){var e,n,i,r,o=this.settings;e=o.firstControlClass,n=o.lastControlClass,t.each(function(t){t.classes.remove(e).remove(n).add(o.controlClass),t.visible()&&(i||(i=t),r=t)}),i&&i.classes.add(e),r&&r.classes.add(n)},renderHtml:function(t){var e="";return this.applyClasses(t.items()),t.items().each(function(t){e+=t.renderHtml()}),e},recalc:function(){},postRender:function(){},isNative:function(){return!1}}),gn=mn.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(t){t.items().filter(":visible").each(function(t){var e=t.settings;t.layoutRect({x:e.x,y:e.y,w:e.w,h:e.h}),t.recalc&&t.recalc()})},renderHtml:function(t){return'<div id="'+t._id+'-absend" class="'+t.classPrefix+'abs-end"></div>'+this._super(t)}}),pn=te.extend({Defaults:{classes:"widget btn",role:"button"},init:function(t){var e,n=this;n._super(t),t=n.settings,e=n.settings.size,n.on("click mousedown",function(t){t.preventDefault()}),n.on("touchstart",function(t){n.fire("click",t),t.preventDefault()}),t.subtype&&n.classes.add(t.subtype),e&&n.classes.add("btn-"+e),t.icon&&n.icon(t.icon)},icon:function(t){return arguments.length?(this.state.set("icon",t),this):this.state.get("icon")},repaint:function(){var t,e=this.getEl().firstChild;e&&((t=e.style).width=t.height="100%"),this._super()},renderHtml:function(){var t,e,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a="",l=n.settings;return(t=l.image)?(o="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",s&&(n.classes.add("btn-has-text"),a='<span class="'+r+'txt">'+n.encode(s)+"</span>"),o=o?r+"ico "+r+"i-"+o:"",e="boolean"==typeof l.active?' aria-pressed="'+l.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" tabindex="-1"'+e+'><button id="'+i+'-button" role="presentation" type="button" tabindex="-1">'+(o?'<i class="'+o+'"'+t+"></i>":"")+a+"</button></div>"},bindStates:function(){var t=this,e=t.$,n=t.classPrefix+"txt";function i(i){var r=e("span."+n,t.getEl());i?(r[0]||(e("button:first",t.getEl()).append('<span class="'+n+'"></span>'),r=e("span."+n,t.getEl())),r.html(t.encode(i))):r.remove(),t.classes.toggle("btn-has-text",!!i)}return t.state.on("change:text",function(t){i(t.value)}),t.state.on("change:icon",function(e){var n=e.value,r=t.classPrefix;t.settings.icon=n,n=n?r+"ico "+r+"i-"+t.settings.icon:"";var o=t.getEl().firstChild,s=o.getElementsByTagName("i")[0];n?(s&&s===o.firstChild||(s=document.createElement("i"),o.insertBefore(s,o.firstChild)),s.className=n):s&&o.removeChild(s),i(t.state.get("text"))}),t._super()}}),vn=pn.extend({init:function(t){t=_.extend({text:"Browse...",multiple:!1,accept:null},t),this._super(t),this.classes.add("browsebutton"),t.multiple&&this.classes.add("multiple")},postRender:function(){var t=this,e=vt.create("input",{type:"file",id:t._id+"-browse",accept:t.settings.accept});t._super(),yt(e).on("change",function(e){var n=e.target.files;t.value=function(){return n.length?t.settings.multiple?n:n[0]:null},e.preventDefault(),n.length&&t.fire("change",e)}),yt(e).on("click",function(t){t.stopPropagation()}),yt(t.getEl("button")).on("click",function(t){t.stopPropagation(),e.click()}),t.getEl().appendChild(e)},remove:function(){yt(this.getEl("button")).off(),yt(this.getEl("input")).off(),this._super()}}),yn=ge.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var t=this,e=t._layout;return t.classes.add("btn-group"),t.preRender(),e.preRender(t),'<div id="'+t._id+'" class="'+t.classes+'"><div id="'+t._id+'-body">'+(t.settings.html||"")+e.renderHtml(t)+"</div></div>"}}),bn=te.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(t){var e=this;e._super(t),e.on("click mousedown",function(t){t.preventDefault()}),e.on("click",function(t){t.preventDefault(),e.disabled()||e.checked(!e.checked())}),e.checked(e.settings.checked)},checked:function(t){return arguments.length?(this.state.set("checked",t),this):this.state.get("checked")},value:function(t){return arguments.length?this.checked(t):this.checked()},renderHtml:function(){var t=this,e=t._id,n=t.classPrefix;return'<div id="'+e+'" class="'+t.classes+'" unselectable="on" aria-labelledby="'+e+'-al" tabindex="-1"><i class="'+n+"ico "+n+'i-checkbox"></i><span id="'+e+'-al" class="'+n+'label">'+t.encode(t.state.get("text"))+"</span></div>"},bindStates:function(){var t=this;function e(e){t.classes.toggle("checked",e),t.aria("checked",e)}return t.state.on("change:text",function(e){t.getEl("al").firstChild.data=t.translate(e.value)}),t.state.on("change:checked change:value",function(n){t.fire("change"),e(n.value)}),t.state.on("change:icon",function(e){var n=e.value,i=t.classPrefix;if(void 0===n)return t.settings.icon;t.settings.icon=n,n=n?i+"ico "+i+"i-"+t.settings.icon:"";var r=t.getEl().firstChild,o=r.getElementsByTagName("i")[0];n?(o&&o===r.firstChild||(o=document.createElement("i"),r.insertBefore(o,r.firstChild)),o.className=n):o&&r.removeChild(o)}),t.state.get("checked")&&e(!0),t._super()}}),xn=tinymce.util.Tools.resolve("tinymce.util.VK"),wn=te.extend({init:function(t){var e=this;e._super(t),t=e.settings,e.classes.add("combobox"),e.subinput=!0,e.ariaTarget="inp",t.menu=t.menu||t.values,t.menu&&(t.icon="caret"),e.on("click",function(n){var i=n.target,r=e.getEl();if(yt.contains(r,i)||i===r)for(;i&&i!==r;)i.id&&-1!==i.id.indexOf("-open")&&(e.fire("action"),t.menu&&(e.showMenu(),n.aria&&e.menu.items()[0].focus())),i=i.parentNode}),e.on("keydown",function(t){var n;13===t.keyCode&&"INPUT"===t.target.nodeName&&(t.preventDefault(),e.parents().reverse().each(function(t){if(t.toJSON)return n=t,!1}),e.fire("submit",{data:n.toJSON()}))}),e.on("keyup",function(t){if("INPUT"===t.target.nodeName){var n=e.state.get("value"),i=t.target.value;i!==n&&(e.state.set("value",i),e.fire("autocomplete",t))}}),e.on("mouseover",function(t){var n=e.tooltip().moveTo(-65535);if(e.statusLevel()&&-1!==t.target.className.indexOf(e.classPrefix+"status")){var i=e.statusMessage()||"Ok",r=n.text(i).show().testMoveRel(t.target,["bc-tc","bc-tl","bc-tr"]);n.classes.toggle("tooltip-n","bc-tc"===r),n.classes.toggle("tooltip-nw","bc-tl"===r),n.classes.toggle("tooltip-ne","bc-tr"===r),n.moveRel(t.target,r)}})},statusLevel:function(t){return arguments.length>0&&this.state.set("statusLevel",t),this.state.get("statusLevel")},statusMessage:function(t){return arguments.length>0&&this.state.set("statusMessage",t),this.state.get("statusMessage")},showMenu:function(){var t,e=this,n=e.settings;e.menu||((t=n.menu||[]).length?t={type:"menu",items:t}:t.type=t.type||"menu",e.menu=ae.create(t).parent(e).renderTo(e.getContainerElm()),e.fire("createmenu"),e.menu.reflow(),e.menu.on("cancel",function(t){t.control===e.menu&&e.focus()}),e.menu.on("show hide",function(t){t.control.items().each(function(t){t.active(t.value()===e.value())})}).fire("show"),e.menu.on("select",function(t){e.value(t.control.value())}),e.on("focusin",function(t){"INPUT"===t.target.tagName.toUpperCase()&&e.menu.hide()}),e.aria("expanded",!0)),e.menu.show(),e.menu.layoutRect({w:e.layoutRect().w}),e.menu.moveRel(e.getEl(),e.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},focus:function(){this.getEl("inp").focus()},repaint:function(){var t,e,n=this,i=n.getEl(),r=n.getEl("open"),o=n.layoutRect(),s=0,a=i.firstChild;n.statusLevel()&&"none"!==n.statusLevel()&&(s=parseInt(vt.getRuntimeStyle(a,"padding-right"),10)-parseInt(vt.getRuntimeStyle(a,"padding-left"),10)),t=r?o.w-vt.getSize(r).width-10:o.w-10;var l=document;return l.all&&(!l.documentMode||l.documentMode<=8)&&(e=n.layoutRect().h-2+"px"),yt(a).css({width:t-s,lineHeight:e}),n._super(),n},postRender:function(){var t=this;return yt(this.getEl("inp")).on("change",function(e){t.state.set("value",e.target.value),t.fire("change",e)}),t._super()},renderHtml:function(){var t,e,n,i=this,r=i._id,o=i.settings,s=i.classPrefix,a=i.state.get("value")||"",l="",u="";return"spellcheck"in o&&(u+=' spellcheck="'+o.spellcheck+'"'),o.maxLength&&(u+=' maxlength="'+o.maxLength+'"'),o.size&&(u+=' size="'+o.size+'"'),o.subtype&&(u+=' type="'+o.subtype+'"'),n='<i id="'+r+'-status" class="mce-status mce-ico" style="display: none"></i>',i.disabled()&&(u+=' disabled="disabled"'),(t=o.icon)&&"caret"!==t&&(t=s+"ico "+s+"i-"+o.icon),e=i.state.get("text"),(t||e)&&(l='<div id="'+r+'-open" class="'+s+"btn "+s+'open" tabIndex="-1" role="button"><button id="'+r+'-action" type="button" hidefocus="1" tabindex="-1">'+("caret"!==t?'<i class="'+t+'"></i>':'<i class="'+s+'caret"></i>')+(e?(t?" ":"")+e:"")+"</button></div>",i.classes.add("has-open")),'<div id="'+r+'" class="'+i.classes+'"><input id="'+r+'-inp" class="'+s+'textbox" value="'+i.encode(a,!1)+'" hidefocus="1"'+u+' placeholder="'+i.encode(o.placeholder)+'" />'+n+l+"</div>"},value:function(t){return arguments.length?(this.state.set("value",t),this):(this.state.get("rendered")&&this.state.set("value",this.getEl("inp").value),this.state.get("value"))},showAutoComplete:function(t,e){var n=this;if(0!==t.length){n.menu?n.menu.items().remove():n.menu=ae.create({type:"menu",classes:"combobox-menu",layout:"flow"}).parent(n).renderTo(),_.each(t,function(t){var i,r;n.menu.add({text:t.title,url:t.previewUrl,match:e,classes:"menu-item-ellipsis",onclick:(i=t.value,r=t.title,function(){n.fire("selectitem",{title:r,value:i})})})}),n.menu.renderNew(),n.hideMenu(),n.menu.on("cancel",function(t){t.control.parent()===n.menu&&(t.stopPropagation(),n.focus(),n.hideMenu())}),n.menu.on("select",function(){n.focus()});var i=n.layoutRect().w;n.menu.layoutRect({w:i,minW:0,maxW:i}),n.menu.repaint(),n.menu.reflow(),n.menu.show(),n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])}else n.hideMenu()},hideMenu:function(){this.menu&&this.menu.hide()},bindStates:function(){var t=this;t.state.on("change:value",function(e){t.getEl("inp").value!==e.value&&(t.getEl("inp").value=e.value)}),t.state.on("change:disabled",function(e){t.getEl("inp").disabled=e.value}),t.state.on("change:statusLevel",function(e){var n=t.getEl("status"),i=t.classPrefix,r=e.value;vt.css(n,"display","none"===r?"none":""),vt.toggleClass(n,i+"i-checkmark","ok"===r),vt.toggleClass(n,i+"i-warning","warn"===r),vt.toggleClass(n,i+"i-error","error"===r),t.classes.toggle("has-status","none"!==r),t.repaint()}),vt.on(t.getEl("status"),"mouseleave",function(){t.tooltip().hide()}),t.on("cancel",function(e){t.menu&&t.menu.visible()&&(e.stopPropagation(),t.hideMenu())});var e=function(t,e){e&&e.items().length>0&&e.items().eq(t)[0].focus()};return t.on("keydown",function(n){var i=n.keyCode;"INPUT"===n.target.nodeName&&(i===xn.DOWN?(n.preventDefault(),t.fire("autocomplete"),e(0,t.menu)):i===xn.UP&&(n.preventDefault(),e(-1,t.menu)))}),t._super()},remove:function(){yt(this.getEl("inp")).off(),this.menu&&this.menu.remove(),this._super()}}),_n=wn.extend({init:function(t){var e=this;t.spellcheck=!1,t.onaction&&(t.icon="none"),e._super(t),e.classes.add("colorbox"),e.on("change keyup postrender",function(){e.repaintColor(e.value())})},repaintColor:function(t){var e=this.getEl("open"),n=e?e.getElementsByTagName("i")[0]:null;if(n)try{n.style.background=t}catch(i){}},bindStates:function(){var t=this;return t.state.on("change:value",function(e){t.state.get("rendered")&&t.repaintColor(e.value)}),t._super()}}),Rn=pn.extend({showPanel:function(){var t=this,e=t.settings;if(t.classes.add("opened"),t.panel)t.panel.show();else{var n=e.panel;n.type&&(n={layout:"grid",items:n}),n.role=n.role||"dialog",n.popover=!0,n.autohide=!0,n.ariaRoot=!0,t.panel=new Ce(n).on("hide",function(){t.classes.remove("opened")}).on("cancel",function(e){e.stopPropagation(),t.focus(),t.hidePanel()}).parent(t).renderTo(t.getContainerElm()),t.panel.fire("show"),t.panel.reflow()}var i=t.panel.testMoveRel(t.getEl(),e.popoverAlign||(t.isRtl()?["bc-tc","bc-tl","bc-tr"]:["bc-tc","bc-tr","bc-tl"]));t.panel.classes.toggle("start","bc-tl"===i),t.panel.classes.toggle("end","bc-tr"===i),t.panel.moveRel(t.getEl(),i)},hidePanel:function(){this.panel&&this.panel.hide()},postRender:function(){var t=this;return t.aria("haspopup",!0),t.on("click",function(e){e.control===t&&(t.panel&&t.panel.visible()?t.hidePanel():(t.showPanel(),t.panel.focus(!!e.aria)))}),t._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}}),kn=u.DOM,Cn=Rn.extend({init:function(t){this._super(t),this.classes.add("splitbtn"),this.classes.add("colorbutton")},color:function(t){return t?(this._color=t,this.getEl("preview").style.backgroundColor=t,this):this._color},resetColor:function(){return this._color=null,this.getEl("preview").style.backgroundColor=null,this},renderHtml:function(){var t=this,e=t._id,n=t.classPrefix,i=t.state.get("text"),r=t.settings.icon?n+"ico "+n+"i-"+t.settings.icon:"",o=t.settings.image?" style=\"background-image: url('"+t.settings.image+"')\"":"",s="";return i&&(t.classes.add("btn-has-text"),s='<span class="'+n+'txt">'+t.encode(i)+"</span>"),'<div id="'+e+'" class="'+t.classes+'" role="button" tabindex="-1" aria-haspopup="true"><button role="presentation" hidefocus="1" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+o+"></i>":"")+'<span id="'+e+'-preview" class="'+n+'preview"></span>'+s+'</button><button type="button" class="'+n+'open" hidefocus="1" tabindex="-1"> <i class="'+n+'caret"></i></button></div>'},postRender:function(){var t=this,e=t.settings.onclick;return t.on("click",function(n){n.aria&&"down"===n.aria.key||n.control!==t||kn.getParent(n.target,"."+t.classPrefix+"open")||(n.stopImmediatePropagation(),e.call(t,n))}),delete t.settings.onclick,t._super()}}),En=tinymce.util.Tools.resolve("tinymce.util.Color"),Hn=te.extend({Defaults:{classes:"widget colorpicker"},init:function(t){this._super(t)},postRender:function(){var t,e,n,i,r,o=this,s=o.color();function a(t,e){var n,i,r=vt.getPos(t);return n=e.pageX-r.x,i=e.pageY-r.y,{x:n=Math.max(0,Math.min(n/t.clientWidth,1)),y:i=Math.max(0,Math.min(i/t.clientHeight,1))}}function l(t,e){var s=(360-t.h)/360;vt.css(n,{top:100*s+"%"}),e||vt.css(r,{left:t.s+"%",top:100-t.v+"%"}),i.style.background=En({s:100,v:100,h:t.h}).toHex(),o.color().parse({s:t.s,v:t.v,h:t.h})}function u(e){var n;n=a(i,e),t.s=100*n.x,t.v=100*(1-n.y),l(t),o.fire("change")}function c(n){var i;i=a(e,n),(t=s.toHsv()).h=360*(1-i.y),l(t,!0),o.fire("change")}e=o.getEl("h"),n=o.getEl("hp"),i=o.getEl("sv"),r=o.getEl("svp"),o._repaint=function(){l(t=s.toHsv())},o._super(),o._svdraghelper=new se(o._id+"-sv",{start:u,drag:u}),o._hdraghelper=new se(o._id+"-h",{start:c,drag:c}),o._repaint()},rgb:function(){return this.color().toRgb()},value:function(t){if(!arguments.length)return this.color().toHex();this.color().parse(t),this._rendered&&this._repaint()},color:function(){return this._color||(this._color=En()),this._color},renderHtml:function(){var t,e=this._id,n=this.classPrefix,i="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000";return t='<div id="'+e+'-h" class="'+n+'colorpicker-h" style="background: -ms-linear-gradient(top,'+i+");background: linear-gradient(to bottom,"+i+');">'+function(){var t,e,r,o,s="";for(r="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",t=0,e=(o=i.split(",")).length-1;t<e;t++)s+='<div class="'+n+'colorpicker-h-chunk" style="height:'+100/e+"%;"+r+o[t]+",endColorstr="+o[t+1]+");-ms-"+r+o[t]+",endColorstr="+o[t+1]+')"></div>';return s}()+'<div id="'+e+'-hp" class="'+n+'colorpicker-h-marker"></div></div>','<div id="'+e+'" class="'+this.classes+'"><div id="'+e+'-sv" class="'+n+'colorpicker-sv"><div class="'+n+'colorpicker-overlay1"><div class="'+n+'colorpicker-overlay2"><div id="'+e+'-svp" class="'+n+'colorpicker-selector1"><div class="'+n+'colorpicker-selector2"></div></div></div></div></div>'+t+"</div>"}}),Sn=te.extend({init:function(t){t=_.extend({height:100,text:"Drop an image here",multiple:!1,accept:null},t),this._super(t),this.classes.add("dropzone"),t.multiple&&this.classes.add("multiple")},renderHtml:function(){var t,e,n=this.settings;return t={id:this._id,hidefocus:"1"},e=vt.create("div",t,"<span>"+this.translate(n.text)+"</span>"),n.height&&vt.css(e,"height",n.height+"px"),n.width&&vt.css(e,"width",n.width+"px"),e.className=this.classes,e.outerHTML},postRender:function(){var t=this,e=function(e){e.preventDefault(),t.classes.toggle("dragenter"),t.getEl().className=t.classes};t._super(),t.$el.on("dragover",function(t){t.preventDefault()}),t.$el.on("dragenter",e),t.$el.on("dragleave",e),t.$el.on("drop",function(e){if(e.preventDefault(),!t.state.get("disabled")){var n=function(e){var n=t.settings.accept;if("string"!=typeof n)return e;var i=new RegExp("("+n.split(/\s*,\s*/).join("|")+")$","i");return _.grep(e,function(t){return i.test(t.name)})}(e.dataTransfer.files);t.value=function(){return n.length?t.settings.multiple?n:n[0]:null},n.length&&t.fire("change",e)}})},remove:function(){this.$el.off(),this._super()}}),Mn=te.extend({init:function(t){var e=this;t.delimiter||(t.delimiter="\xbb"),e._super(t),e.classes.add("path"),e.canFocus=!0,e.on("click",function(t){var n;(n=t.target.getAttribute("data-index"))&&e.fire("select",{value:e.row()[n],index:n})}),e.row(e.settings.row)},focus:function(){return this.getEl().firstChild.focus(),this},row:function(t){return arguments.length?(this.state.set("row",t),this):this.state.get("row")},renderHtml:function(){return'<div id="'+this._id+'" class="'+this.classes+'">'+this._getDataPathHtml(this.state.get("row"))+"</div>"},bindStates:function(){var t=this;return t.state.on("change:row",function(e){t.innerHtml(t._getDataPathHtml(e.value))}),t._super()},_getDataPathHtml:function(t){var e,n,i=t||[],r="",o=this.classPrefix;for(e=0,n=i.length;e<n;e++)r+=(e>0?'<div class="'+o+'divider" aria-hidden="true"> '+this.settings.delimiter+" </div>":"")+'<div role="button" class="'+o+"path-item"+(e===n-1?" "+o+"last":"")+'" data-index="'+e+'" tabindex="-1" id="'+this._id+"-"+e+'" aria-level="'+(e+1)+'">'+i[e].name+"</div>";return r||(r='<div class="'+o+'path-item">\xa0</div>'),r}}),Tn=Mn.extend({postRender:function(){var t=this,e=t.settings.editor;function n(t){if(1===t.nodeType){if("BR"===t.nodeName||t.getAttribute("data-mce-bogus"))return!0;if("bookmark"===t.getAttribute("data-mce-type"))return!0}return!1}return!1!==e.settings.elementpath&&(t.on("select",function(t){e.focus(),e.selection.select(this.row()[t.index].element),e.nodeChanged()}),e.on("nodeChange",function(i){for(var r=[],o=i.parents,s=o.length;s--;)if(1===o[s].nodeType&&!n(o[s])){var a=e.fire("ResolveName",{name:o[s].nodeName.toLowerCase(),target:o[s]});if(a.isDefaultPrevented()||r.push({name:a.name,element:o[s]}),a.isPropagationStopped())break}t.row(r)})),t._super()}}),Pn=ge.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var t=this,e=t._layout,n=t.classPrefix;return t.classes.add("formitem"),e.preRender(t),'<div id="'+t._id+'" class="'+t.classes+'" hidefocus="1" tabindex="-1">'+(t.settings.title?'<div id="'+t._id+'-title" class="'+n+'title">'+t.settings.title+"</div>":"")+'<div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+(t.settings.html||"")+e.renderHtml(t)+"</div></div>"}}),Wn=ge.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:15,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var t=this,e=t.items();t.settings.formItemDefaults||(t.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),e.each(function(e){var n,i=e.settings.label;i&&((n=new Pn(_.extend({items:{type:"label",id:e._id+"-l",text:i,flex:0,forId:e._id,disabled:e.disabled()}},t.settings.formItemDefaults))).type="formitem",e.aria("labelledby",e._id+"-l"),"undefined"==typeof e.settings.flex&&(e.settings.flex=1),t.replace(e,n),n.add(e))})},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){this._super(),this.fromJSON(this.settings.data)},bindStates:function(){var t=this;function e(){var e,n,i=0,r=[];if(!1!==t.settings.labelGapCalc)for(("children"===t.settings.labelGapCalc?t.find("formitem"):t.items()).filter("formitem").each(function(t){var e=t.items()[0],n=e.getEl().clientWidth;i=n>i?n:i,r.push(e)}),n=t.settings.labelGap||0,e=r.length;e--;)r[e].settings.minWidth=i+n}t._super(),t.on("show",e),e()}}),Nn=Wn.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var t=this,e=t._layout,n=t.classPrefix;return t.preRender(),e.preRender(t),'<fieldset id="'+t._id+'" class="'+t.classes+'" hidefocus="1" tabindex="-1">'+(t.settings.title?'<legend id="'+t._id+'-title" class="'+n+'fieldset-title">'+t.settings.title+"</legend>":"")+'<div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+(t.settings.html||"")+e.renderHtml(t)+"</div></fieldset>"}}),Dn=0,An=function(t){var e=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++Dn+String(e)},On=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:G.constant(t)}},Bn={fromHtml:function(t,e){var n=(e||document).createElement("div");if(n.innerHTML=t,!n.hasChildNodes()||n.childNodes.length>1)throw console.error("HTML does not have a single root node",t),"HTML must have a single root node";return On(n.childNodes[0])},fromTag:function(t,e){var n=(e||document).createElement(t);return On(n)},fromText:function(t,e){var n=(e||document).createTextNode(t);return On(n)},fromDom:On,fromPoint:function(t,e,n){return nt.from(t.dom().elementFromPoint(e,n)).map(On)}},Ln=function(t){var e,n=!1;return function(){return n||(n=!0,e=t.apply(null,arguments)),e}},In=8,zn=9,Fn=1,Vn=3,qn=function(t){return t.dom().nodeName.toLowerCase()},Un=function(t){return t.dom().nodeType},jn=function(t){return function(e){return Un(e)===t}},$n=jn(Fn),Yn=jn(Vn),Xn=jn(zn),Jn={name:qn,type:Un,value:function(t){return t.dom().nodeValue},isElement:$n,isText:Yn,isDocument:Xn,isComment:function(t){return Un(t)===In||"#comment"===qn(t)}},Gn=(Ln(function(){return Gn(Bn.fromDom(document))}),function(t){var e=t.dom().body;if(null===e||e===undefined)throw"Body is not available yet";return Bn.fromDom(e)}),Kn=function(t){return function(e){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&Array.prototype.isPrototypeOf(t)?"array":"object"===e&&String.prototype.isPrototypeOf(t)?"string":e}(e)===t}},Qn={isString:Kn("string"),isObject:Kn("object"),isArray:Kn("array"),isNull:Kn("null"),isBoolean:Kn("boolean"),isUndefined:Kn("undefined"),isFunction:Kn("function"),isNumber:Kn("number")},Zn=(hn=Object.keys)===undefined?function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}:hn,ti=function(t,e){for(var n=Zn(t),i=0,r=n.length;i<r;i++){var o=n[i];e(t[o],o,t)}},ei=function(t,e){var n={};return ti(t,function(i,r){var o=e(i,r,t);n[o.k]=o.v}),n},ni=function(t,e){var n=[];return ti(t,function(t,i){n.push(e(t,i))}),n},ii=function(t){return ni(t,function(t){return t})},ri={bifilter:function(t,e){var n={},i={};return ti(t,function(t,r){(e(t,r)?n:i)[r]=t}),{t:n,f:i}},each:ti,map:function(t,e){return ei(t,function(t,n,i){return{k:n,v:e(t,n,i)}})},mapToArray:ni,tupleMap:ei,find:function(t,e){for(var n=Zn(t),i=0,r=n.length;i<r;i++){var o=n[i],s=t[o];if(e(s,o,t))return nt.some(s)}return nt.none()},keys:Zn,values:ii,size:function(t){return ii(t).length}},oi=function(t){return t.slice(0).sort()},si={sort:oi,reqMessage:function(t,e){throw new Error("All required keys ("+oi(t).join(", ")+") were not specified. Specified keys were: "+oi(e).join(", ")+".")},unsuppMessage:function(t){throw new Error("Unsupported keys for object: "+oi(t).join(", "))},validateStrArr:function(t,e){if(!Qn.isArray(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");gt.each(e,function(e){if(!Qn.isString(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},invalidTypeMessage:function(t,e){throw new Error("All values need to be of type: "+e+". Keys ("+oi(t).join(", ")+") were not.")},checkDupes:function(t){var e=oi(t);gt.find(e,function(t,n){return n<e.length-1&&t===e[n+1]}).each(function(t){throw new Error("The field: "+t+" occurs more than once in the combined fields: ["+e.join(", ")+"].")})}},ai={immutable:function(){var t=arguments;return function(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];if(t.length!==e.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+e.length+" arguments");var i={};return gt.each(t,function(t,n){i[t]=G.constant(e[n])}),i}},immutableBag:function(t,e){var n=t.concat(e);if(0===n.length)throw new Error("You must specify at least one required or optional field.");return si.validateStrArr("required",t),si.validateStrArr("optional",e),si.checkDupes(n),function(i){var r=ri.keys(i);gt.forall(t,function(t){return gt.contains(r,t)})||si.reqMessage(t,r);var o=gt.filter(r,function(t){return!gt.contains(n,t)});o.length>0&&si.unsuppMessage(o);var s={};return gt.each(t,function(t){s[t]=G.constant(i[t])}),gt.each(e,function(t){s[t]=G.constant(Object.prototype.hasOwnProperty.call(i,t)?nt.some(i[t]):nt.none())}),s}}},li=function(t,e){var n=function(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(i.test(e))return i}return undefined}(t,e);if(!n)return{major:0,minor:0};var i=function(t){return Number(e.replace(n,"$"+t))};return ci(i(1),i(2))},ui=function(){return ci(0,0)},ci=function(t,e){return{major:t,minor:e}},di={nu:ci,detect:function(t,e){var n=String(e).toLowerCase();return 0===t.length?ui():li(t,n)},unknown:ui},fi="Firefox",hi=function(t,e){return function(){return e===t}},mi=function(t){var e=t.current;return{current:e,version:t.version,isEdge:hi("Edge",e),isChrome:hi("Chrome",e),isIE:hi("IE",e),isOpera:hi("Opera",e),isFirefox:hi(fi,e),isSafari:hi("Safari",e)}},gi={unknown:function(){return mi({current:undefined,version:di.unknown()})},nu:mi,edge:G.constant("Edge"),chrome:G.constant("Chrome"),ie:G.constant("IE"),opera:G.constant("Opera"),firefox:G.constant(fi),safari:G.constant("Safari")},pi="Windows",vi="Android",yi="Solaris",bi="FreeBSD",xi=function(t,e){return function(){return e===t}},wi=function(t){var e=t.current;return{current:e,version:t.version,isWindows:xi(pi,e),isiOS:xi("iOS",e),isAndroid:xi(vi,e),isOSX:xi("OSX",e),isLinux:xi("Linux",e),isSolaris:xi(yi,e),isFreeBSD:xi(bi,e)}},_i={unknown:function(){return wi({current:undefined,version:di.unknown()})},nu:wi,windows:G.constant(pi),ios:G.constant("iOS"),android:G.constant(vi),linux:G.constant("Linux"),osx:G.constant("OSX"),solaris:G.constant(yi),freebsd:G.constant(bi)},Ri=function(t,e){var n=String(e).toLowerCase();return gt.find(t,function(t){return t.search(n)})},ki=function(t,e){return Ri(t,e).map(function(t){var n=di.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Ci=function(t,e){return Ri(t,e).map(function(t){var n=di.detect(t.versionRegexes,e);return{current:t.name,version:n}})},Ei=function(t,e){return-1!==t.indexOf(e)},Hi=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Si=function(t){return function(e){return Ei(e,t)}},Mi=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Ei(t,"edge/")&&Ei(t,"chrome")&&Ei(t,"safari")&&Ei(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Hi],search:function(t){return Ei(t,"chrome")&&!Ei(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Ei(t,"msie")||Ei(t,"trident")}},{name:"Opera",versionRegexes:[Hi,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Si("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Si("firefox")},{name:"Safari",versionRegexes:[Hi,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Ei(t,"safari")||Ei(t,"mobile/"))&&Ei(t,"applewebkit")}}],Ti=[{name:"Windows",search:Si("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(t){return Ei(t,"iphone")||Ei(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Si("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Si("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Si("linux"),versionRegexes:[]},{name:"Solaris",search:Si("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Si("freebsd"),versionRegexes:[]}],Pi={browsers:G.constant(Mi),oses:G.constant(Ti)},Wi=function(t){var e,n,i,r,o,s,a,l,u,c,d,f=Pi.browsers(),h=Pi.oses(),m=ki(f,t).fold(gi.unknown,gi.nu),g=Ci(h,t).fold(_i.unknown,_i.nu);return{browser:m,os:g,deviceType:(n=m,i=t,r=(e=g).isiOS()&&!0===/ipad/i.test(i),o=e.isiOS()&&!r,s=e.isAndroid()&&3===e.version.major,a=e.isAndroid()&&4===e.version.major,l=r||s||a&&!0===/mobile/i.test(i),u=e.isiOS()||e.isAndroid(),c=u&&!l,d=n.isSafari()&&e.isiOS()&&!1===/safari/i.test(i),{isiPad:G.constant(r),isiPhone:G.constant(o),isTablet:G.constant(l),isPhone:G.constant(c),isTouch:G.constant(u),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:G.constant(d)})}},Ni=Fn,Di=zn,Ai=function(t){return t.nodeType!==Ni&&t.nodeType!==Di||0===t.childElementCount},Oi={all:function(t,e){var n=e===undefined?document:e.dom();return Ai(n)?[]:gt.map(n.querySelectorAll(t),Bn.fromDom)},is:function(t,e){var n=t.dom();if(n.nodeType!==Ni)return!1;if(n.matches!==undefined)return n.matches(e);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(e);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(e);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")},one:function(t,e){var n=e===undefined?document:e.dom();return Ai(n)?nt.none():nt.from(n.querySelector(t)).map(Bn.fromDom)}},Bi=(Ln(function(){var t=navigator.userAgent;return Wi(t)})().browser.isIE(),ai.immutable("element","offset"),function(t,e){return Oi.all(e,t)}),Li=_.trim,Ii=function(t){return function(e){if(e&&1===e.nodeType){if(e.contentEditable===t)return!0;if(e.getAttribute("data-mce-contenteditable")===t)return!0}return!1}},zi=Ii("true"),Fi=Ii("false"),Vi=function(t,e,n,i,r){return{type:t,title:e,url:n,level:i,attach:r}},qi=function(t){return t.innerText||t.textContent},Ui=function(t){return(e=t)&&"A"===e.nodeName&&(e.id||e.name)&&$i(t);var e},ji=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},$i=function(t){return function(t){for(;t=t.parentNode;){var e=t.contentEditable;if(e&&"inherit"!==e)return zi(t)}return!1}(t)&&!Fi(t)},Yi=function(t){return ji(t)&&$i(t)},Xi=function(t){var e,n,i=(e=t).id?e.id:An("h");return Vi("header",qi(t),"#"+i,ji(n=t)?parseInt(n.nodeName.substr(1),10):0,function(){t.id=i})},Ji=function(t){var e=t.id||t.name,n=qi(t);return Vi("anchor",n||"#"+e,"#"+e,0,G.noop)},Gi=function(t){var e,n;return e="h1,h2,h3,h4,h5,h6,a:not([href])",n=t,gt.map(Bi(Bn.fromDom(n),e),function(t){return t.dom()})},Ki=function(t){return Li(t.title).length>0},Qi=function(t){var e,n,i=Gi(t);return gt.filter((n=i,gt.map(gt.filter(n,Yi),Xi)).concat((e=i,gt.map(gt.filter(e,Ui),Ji))),Ki)},Zi={},tr=function(t){return{title:t.title,value:{title:{raw:t.title},url:t.url,attach:t.attach}}},er=function(t,e){return{title:t,value:{title:t,url:e,attach:G.noop}}},nr=function(t,e,n){var i=e in t?t[e]:n;return!1===i?null:i},ir=function(t,e,n,i){var r,o,s,a,l={title:"-"},u=function(t){var i=t.hasOwnProperty(n)?t[n]:[],r=gt.filter(i,function(t){return n=t,i=e,!gt.exists(i,function(t){return t.url===n});var n,i});return _.map(r,function(t){return{title:t,value:{title:t,url:t,attach:G.noop}}})},c=function(t){var n,i=gt.filter(e,function(e){return e.type===t});return n=i,_.map(n,tr)};return!1===i.typeahead_urls?[]:"file"===n?(r=[rr(t,u(Zi)),rr(t,c("header")),rr(t,(o=c("anchor"),s=nr(i,"anchor_top","#top"),a=nr(i,"anchor_bottom","#bottom"),null!==s&&o.unshift(er("<top>",s)),null!==a&&o.push(er("<bottom>",a)),o))],gt.foldl(r,function(t,e){return 0===t.length||0===e.length?t.concat(e):t.concat(l,e)},[])):rr(t,u(Zi))},rr=function(t,e){var n=t.toLowerCase(),i=_.grep(e,function(t){return-1!==t.title.toLowerCase().indexOf(n)});return 1===i.length&&i[0].title===t?[]:i},or=function(t,e,n,i){var r=function(r){var o=Qi(n),s=ir(r,o,i,e);t.showAutoComplete(s,r)};t.on("autocomplete",function(){r(t.value())}),t.on("selectitem",function(e){var n=e.value;t.value(n.url);var r,o=(r=n.title).raw?r.raw:r;"image"===i?t.fire("change",{meta:{alt:o,attach:n.attach}}):t.fire("change",{meta:{text:o,attach:n.attach}}),t.focus()}),t.on("click",function(e){0===t.value().length&&"INPUT"===e.target.nodeName&&r("")}),t.on("PostRender",function(){t.getRoot().on("submit",function(e){var n,r,o;e.isDefaultPrevented()||(n=t.value(),o=Zi[r=i],/^https?/.test(n)&&(o?-1===gt.indexOf(o,n)&&(Zi[r]=o.slice(0,5).concat(n)):Zi[r]=[n]))})})},sr=function(t,e,n){var i=e.filepicker_validator_handler;i&&t.state.on("change:value",function(e){var r;0!==(r=e.value).length?i({url:r,type:n},function(e){var n,i,r,o=(i=(n=e).status,r=n.message,"valid"===i?{status:"ok",message:r}:"unknown"===i?{status:"warn",message:r}:"invalid"===i?{status:"warn",message:r}:{status:"none",message:""});t.statusMessage(o.message),t.statusLevel(o.status)}):t.statusLevel("none")})},ar=wn.extend({Statics:{clearHistory:function(){Zi={}}},init:function(t){var e,n,i,r=this,o=window.tinymce?window.tinymce.activeEditor:S.activeEditor,s=o.settings,a=t.filetype;t.spellcheck=!1,(i=s.file_picker_types||s.file_browser_callback_types)&&(i=_.makeMap(i,/[, ]/)),i&&!i[a]||(!(n=s.file_picker_callback)||i&&!i[a]?!(n=s.file_browser_callback)||i&&!i[a]||(e=function(){n(r.getEl("inp").id,r.value(),a,window)}):e=function(){var t=r.fire("beforecall").meta;t=_.extend({filetype:a},t),n.call(o,function(t,e){r.value(t).fire("change",{meta:e})},r.value(),t)}),e&&(t.icon="browse",t.onaction=e),r._super(t),r.classes.add("filepicker"),or(r,s,o.getBody(),a),sr(r,s,a)}}),lr=gn.extend({recalc:function(t){var e=t.layoutRect(),n=t.paddingBox;t.items().filter(":visible").each(function(t){t.layoutRect({x:n.left,y:n.top,w:e.innerW-n.right-n.left,h:e.innerH-n.top-n.bottom}),t.recalc&&t.recalc()})}}),ur=gn.extend({recalc:function(t){var e,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,y,b,x,w,_,R,k,C,E,H,S,M,T,P,W,N,D,A,O,B,L=[],I=Math.max,z=Math.min;for(i=t.items().filter(":visible"),r=t.layoutRect(),o=t.paddingBox,s=t.settings,f=t.isRtl()?s.direction||"row-reversed":s.direction,a=s.align,l=t.isRtl()?s.pack||"end":s.pack,u=s.spacing||0,"row-reversed"!==f&&"column-reverse"!==f||(i=i.set(i.toArray().reverse()),f=f.split("-")[0]),"column"===f?(k="y",_="h",R="minH",C="maxH",H="innerH",E="top",S="deltaH",M="contentH",D="left",W="w",T="x",P="innerW",N="minW",A="right",O="deltaW",B="contentW"):(k="x",_="w",R="minW",C="maxW",H="innerW",E="left",S="deltaW",M="contentW",D="top",W="h",T="y",P="innerH",N="minH",A="bottom",O="deltaH",B="contentH"),d=r[H]-o[E]-o[E],w=c=0,e=0,n=i.length;e<n;e++)m=(h=i[e]).layoutRect(),g=h.settings.flex,d-=e<n-1?u:0,g>0&&(c+=g,m[C]&&L.push(h),m.flex=g),d-=m[R],(p=o[D]+m[N]+o[A])>w&&(w=p);if((b={})[R]=d<0?r[R]-d+r[S]:r[H]-d+r[S],b[N]=w+r[O],b[M]=r[H]-d,b[B]=w,b.minW=z(b.minW,r.maxW),b.minH=z(b.minH,r.maxH),b.minW=I(b.minW,r.startMinWidth),b.minH=I(b.minH,r.startMinHeight),!r.autoResize||b.minW===r.minW&&b.minH===r.minH){for(y=d/c,e=0,n=L.length;e<n;e++)v=(m=(h=L[e]).layoutRect())[C],(p=m[R]+m.flex*y)>v?(d-=m[C]-m[R],c-=m.flex,m.flex=0,m.maxFlexSize=v):m.maxFlexSize=0;for(y=d/c,x=o[E],b={},0===c&&("end"===l?x=d+o[E]:"center"===l?(x=Math.round(r[H]/2-(r[H]-d)/2)+o[E])<0&&(x=o[E]):"justify"===l&&(x=o[E],u=Math.floor(d/(i.length-1)))),b[T]=o[D],e=0,n=i.length;e<n;e++)p=(m=(h=i[e]).layoutRect()).maxFlexSize||m[R],"center"===a?b[T]=Math.round(r[P]/2-m[W]/2):"stretch"===a?(b[W]=I(m[N]||0,r[P]-o[D]-o[A]),b[T]=o[D]):"end"===a&&(b[T]=r[P]-m[W]-o.top),m.flex>0&&(p+=m.flex*y),b[_]=p,b[k]=x,h.layoutRect(b),h.recalc&&h.recalc(),x+=p+u}else if(b.w=b.minW,b.h=b.minH,t.layoutRect(b),this.recalc(t),null===t._lastRect){var F=t.parent();F&&(F._lastRect=null,F.recalc())}}}),cr=mn.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(t){t.items().filter(":visible").each(function(t){t.recalc&&t.recalc()})},isNative:function(){return!0}}),dr=function(t,e){return Oi.one(e,t)},fr=function(t,e){return function(){t.execCommand("mceToggleFormat",!1,e)}},hr=function(t,e){return function(){var n=this;t.formatter?t.formatter.formatChanged(e,function(t){n.active(t)}):t.on("init",function(){t.formatter.formatChanged(e,function(t){n.active(t)})})}},mr=function(t){t.addMenuItem("align",{text:"Align",menu:[{text:"Left",icon:"alignleft",onclick:fr(t,"alignleft")},{text:"Center",icon:"aligncenter",onclick:fr(t,"aligncenter")},{text:"Right",icon:"alignright",onclick:fr(t,"alignright")},{text:"Justify",icon:"alignjustify",onclick:fr(t,"alignjustify")}]}),_.each({alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"],alignnone:["No alignment","JustifyNone"]},function(e,n){t.addButton(n,{active:!1,tooltip:e[0],cmd:e[1],onPostRender:hr(t,n)})})},gr=function(t){return function(e,n){return nt.from(n).map(Bn.fromDom).filter(Jn.isElement).bind(function(n){return function(t,e,n){for(;n!==e;){if(n.style[t]){var i=n.style[t];return""!==i?nt.some(i):nt.none()}n=n.parentNode}return nt.none()}(t,e,n.dom()).or((i=t,r=n.dom(),nt.from(u.DOM.getStyle(r,i,!0))));var i,r}).getOr("")}},pr={getFontSize:gr("fontSize"),getFontFamily:G.compose(function(t){return t.replace(/[\'\"]/g,"").replace(/,\s+/g,",")},gr("fontFamily")),toPt:function(t,e){return/[0-9.]+px$/.test(t)?(n=72*parseInt(t,10)/96,i=e||0,r=Math.pow(10,i),Math.round(n*r)/r+"pt"):t;var n,i,r}},vr=function(t){return t?t.split(",")[0]:""},yr=function(t,e){return function(){var n=this;t.on("init nodeChange",function(i){var r,o,s,a=pr.getFontFamily(t.getBody(),i.element),l=(r=e,o=a,_.each(r,function(t){t.value.toLowerCase()===o.toLowerCase()&&(s=t.value)}),_.each(r,function(t){s||vr(t.value).toLowerCase()!==vr(o).toLowerCase()||(s=t.value)}),s);n.value(l||null),!l&&a&&n.text(vr(a))})}},br=function(t){t.addButton("fontselect",function(){var e,n=(e=function(t){for(var e=(t=t.replace(/;$/,"").split(";")).length;e--;)t[e]=t[e].split("=");return t}(t.settings.font_formats||"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"),_.map(e,function(t){return{text:{raw:t[0]},value:t[1],textStyle:-1===t[1].indexOf("dings")?"font-family:"+t[1]:""}}));return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:n,fixedWidth:!0,onPostRender:yr(t,n),onselect:function(e){e.control.settings.value&&t.execCommand("FontName",!1,e.control.settings.value)}}})},xr=function(t){br(t)},wr=function(t,e,n){var i;return _.each(t,function(t){t.value===n?i=n:t.value===e&&(i=e)}),i},_r=function(t){t.addButton("fontsizeselect",function(){var e,n,i,r=(e=t.settings.fontsize_formats||"8pt 10pt 12pt 14pt 18pt 24pt 36pt",_.map(e.split(" "),function(t){var e=t,n=t,i=t.split("=");return i.length>1&&(e=i[0],n=i[1]),{text:e,value:n}}));return{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:r,fixedWidth:!0,onPostRender:(n=t,i=r,function(){var t=this;n.on("init nodeChange",function(e){var r,o,s,a;if(r=pr.getFontSize(n.getBody(),e.element))for(s=3;!a&&s>=0;s--)o=pr.toPt(r,s),a=wr(i,o,r);t.value(a||null),a||t.text(o)})}),onclick:function(e){e.control.settings.value&&t.execCommand("FontSize",!1,e.control.settings.value)}}})},Rr=function(t){_r(t)},kr=function(t,e){return function(){var n,i,r,o=[];return _.each(e,function(e){o.push({text:e[0],value:e[1],textStyle:function(){return t.formatter.getCssText(e[1])}})}),{type:"listbox",text:e[0][0],values:o,fixedWidth:!0,onselect:function(e){if(e.control){var n=e.control.value();fr(t,n)()}},onPostRender:(n=t,i=o,function(){var t=this;n.on("nodeChange",function(e){var o=n.formatter,s=null;_.each(e.parents,function(t){if(_.each(i,function(e){if(r?o.matchNode(t,r,{value:e.value})&&(s=e.value):o.matchNode(t,e.value)&&(s=e.value),s)return!1}),s)return!1}),t.value(s)})})}}},Cr=function(t){var e,n,i=function(t){for(var e=(t=t.replace(/;$/,"").split(";")).length;e--;)t[e]=t[e].split("=");return t}(t.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");t.addMenuItem("blockformats",{text:"Blocks",menu:(e=t,n=i,_.map(n,function(t){return{text:t[0],onclick:fr(e,t[1]),textStyle:function(){return e.formatter.getCssText(t[1])}}}))}),t.addButton("formatselect",kr(t,i))},Er=function(t,e){var n=e.length;return _.each(e,function(e){e.menu&&(e.hidden=0===Er(t,e.menu));var i=e.format;i&&(e.hidden=!t.formatter.canApply(i)),e.hidden&&n--}),n},Hr=function(t,e){var n=e.items().length;return e.items().each(function(e){e.menu&&e.visible(Hr(t,e.menu)>0),!e.menu&&e.settings.menu&&e.visible(Er(t,e.settings.menu)>0);var i=e.settings.format;i&&e.visible(t.formatter.canApply(i)),e.visible()||n--}),n},Sr=function(t){var e,n,i,r,o,s,a,l,u=(n=0,i=[],r=[{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"}]}],o=function(t){var e=[];if(t)return _.each(t,function(t){var r={text:t.title,icon:t.icon};if(t.items)r.menu=o(t.items);else{var s=t.format||"custom"+n++;t.format||(t.name=s,i.push(t)),r.format=s,r.cmd=t.cmd}e.push(r)}),e},(e=t).on("init",function(){_.each(i,function(t){e.formatter.register(t.name,t)})}),{type:"menu",items:e.settings.style_formats_merge?e.settings.style_formats?o(r.concat(e.settings.style_formats)):o(r):o(e.settings.style_formats||r),onPostRender:function(t){e.fire("renderFormatsMenu",{control:t.control})},itemDefaults:{preview:!0,textStyle:function(){if(this.settings.format)return e.formatter.getCssText(this.settings.format)},onPostRender:function(){var t=this;t.parent().on("show",function(){var n,i;(n=t.settings.format)&&(t.disabled(!e.formatter.canApply(n)),t.active(e.formatter.match(n))),(i=t.settings.cmd)&&t.active(e.queryCommandState(i))})},onclick:function(){this.settings.format&&fr(e,this.settings.format)(),this.settings.cmd&&e.execCommand(this.settings.cmd)}}});s=u,t.addMenuItem("formats",{text:"Formats",menu:s}),l=u,(a=t).addButton("styleselect",{type:"menubutton",text:"Formats",menu:l,onShowMenu:function(){a.settings.style_formats_autohide&&Hr(a,this.menu)}})},Mr=function(t,e){var n,i;if("string"==typeof e)i=e.split(" ");else if(_.isArray(e))return gt.flatten(_.map(e,function(e){return Mr(t,e)}));return n=_.grep(i,function(e){return"|"===e||e in t.menuItems}),_.map(n,function(e){return"|"===e?{text:"-"}:t.menuItems[e]})},Tr=function(t){return t&&"-"===t.text},Pr=function(t){var e=gt.filter(t,function(t,e,n){return!Tr(t)||!Tr(n[e-1])});return gt.filter(e,function(t,e,n){return!Tr(t)||e>0&&e<n.length-1})},Wr=function(t){var e,n,i,r,o=t.settings.insert_button_items;return Pr(o?Mr(t,o):(e=t,n="insert",i=[{text:"-"}],r=_.grep(e.menuItems,function(t){return t.context===n}),_.each(r,function(t){"before"===t.separator&&i.push({text:"|"}),t.prependToContext?i.unshift(t):i.push(t),"after"===t.separator&&i.push({text:"|"})}),i))},Nr=function(t){var e;(e=t).addButton("insert",{type:"menubutton",icon:"insert",menu:[],oncreatemenu:function(){this.menu.add(Wr(e)),this.menu.renderNew()}})},Dr=function(t){var e,n,i;e=t,_.each({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(t,n){e.addButton(n,{active:!1,tooltip:t,onPostRender:hr(e,n),onclick:fr(e,n)})}),n=t,_.each({outdent:["Decrease indent","Outdent"],indent:["Increase indent","Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:["New document","mceNewDocument"],removeformat:["Clear formatting","RemoveFormat"],remove:["Remove","Delete"]},function(t,e){n.addButton(e,{tooltip:t[0],cmd:t[1]})}),i=t,_.each({blockquote:["Blockquote","mceBlockQuote"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"]},function(t,e){i.addButton(e,{active:!1,tooltip:t[0],cmd:t[1],onPostRender:hr(i,e)})})},Ar=function(t){var e;Dr(t),e=t,_.each({bold:["Bold","Bold","Meta+B"],italic:["Italic","Italic","Meta+I"],underline:["Underline","Underline","Meta+U"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"],newdocument:["New document","mceNewDocument"],cut:["Cut","Cut","Meta+X"],copy:["Copy","Copy","Meta+C"],paste:["Paste","Paste","Meta+V"],selectall:["Select all","SelectAll","Meta+A"]},function(t,n){e.addMenuItem(n,{text:t[0],icon:n,shortcut:t[2],cmd:t[1]})}),e.addMenuItem("codeformat",{text:"Code",icon:"code",onclick:fr(e,"code")})},Or=function(t,e){return function(){var n=this,i=function(){var n="redo"===e?"hasRedo":"hasUndo";return!!t.undoManager&&t.undoManager[n]()};n.disabled(!i()),t.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",function(){n.disabled(t.readonly||!i())})}},Br=function(t){var e,n;(e=t).addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:Or(e,"undo"),cmd:"undo"}),e.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:Or(e,"redo"),cmd:"redo"}),(n=t).addButton("undo",{tooltip:"Undo",onPostRender:Or(n,"undo"),cmd:"undo"}),n.addButton("redo",{tooltip:"Redo",onPostRender:Or(n,"redo"),cmd:"redo"})},Lr=function(t){var e,n;(e=t).addMenuItem("visualaid",{text:"Visual aids",selectable:!0,onPostRender:(n=e,function(){var t=this;n.on("VisualAid",function(e){t.active(e.hasVisual)}),t.active(n.hasVisual)}),cmd:"mceToggleVisualAid"})},Ir={setup:function(t){var e;t.rtl&&(Jt.rtl=!0),t.on("mousedown",function(){Ce.hideAll()}),(e=t).settings.ui_container&&(l.container=dr(Bn.fromDom(document.body),e.settings.ui_container).fold(G.constant(null),function(t){return t.dom()})),te.tooltips=!l.iOS,Jt.translate=function(t){return S.translate(t)},Cr(t),mr(t),Ar(t),Br(t),Rr(t),xr(t),Sr(t),Lr(t),Nr(t)}},zr=gn.extend({recalc:function(t){var e,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,y,b,x,w,_,R,k,C,E,H,S,M=[],T=[];e=t.settings,r=t.items().filter(":visible"),o=t.layoutRect(),i=e.columns||Math.ceil(Math.sqrt(r.length)),n=Math.ceil(r.length/i),y=e.spacingH||e.spacing||0,b=e.spacingV||e.spacing||0,x=e.alignH||e.align,w=e.alignV||e.align,p=t.paddingBox,S="reverseRows"in e?e.reverseRows:t.isRtl(),x&&"string"==typeof x&&(x=[x]),w&&"string"==typeof w&&(w=[w]);for(d=0;d<i;d++)M.push(0);for(f=0;f<n;f++)T.push(0);for(f=0;f<n;f++)for(d=0;d<i&&(c=r[f*i+d]);d++)k=(u=c.layoutRect()).minW,C=u.minH,M[d]=k>M[d]?k:M[d],T[f]=C>T[f]?C:T[f];for(E=o.innerW-p.left-p.right,_=0,d=0;d<i;d++)_+=M[d]+(d>0?y:0),E-=(d>0?y:0)+M[d];for(H=o.innerH-p.top-p.bottom,R=0,f=0;f<n;f++)R+=T[f]+(f>0?b:0),H-=(f>0?b:0)+T[f];if(_+=p.left+p.right,R+=p.top+p.bottom,(l={}).minW=_+(o.w-o.innerW),l.minH=R+(o.h-o.innerH),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH,l.minW=Math.min(l.minW,o.maxW),l.minH=Math.min(l.minH,o.maxH),l.minW=Math.max(l.minW,o.startMinWidth),l.minH=Math.max(l.minH,o.startMinHeight),!o.autoResize||l.minW===o.minW&&l.minH===o.minH){var P;o.autoResize&&((l=t.layoutRect(l)).contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH),P="start"===e.packV?0:H>0?Math.floor(H/n):0;var W=0,N=e.flexWidths;if(N)for(d=0;d<N.length;d++)W+=N[d];else W=i;var D=E/W;for(d=0;d<i;d++)M[d]+=N?N[d]*D:D;for(m=p.top,f=0;f<n;f++){for(h=p.left,a=T[f]+P,d=0;d<i&&(c=r[S?f*i+i-1-d:f*i+d]);d++)g=c.settings,u=c.layoutRect(),s=Math.max(M[d],u.startMinWidth),u.x=h,u.y=m,"center"===(v=g.alignH||(x?x[d]||x[0]:null))?u.x=h+s/2-u.w/2:"right"===v?u.x=h+s-u.w:"stretch"===v&&(u.w=s),"center"===(v=g.alignV||(w?w[d]||w[0]:null))?u.y=m+a/2-u.h/2:"bottom"===v?u.y=m+a-u.h:"stretch"===v&&(u.h=a),c.layoutRect(u),h+=s+y,c.recalc&&c.recalc();m+=a+b}}else if(l.w=l.minW,l.h=l.minH,t.layoutRect(l),this.recalc(t),null===t._lastRect){var A=t.parent();A&&(A._lastRect=null,A.recalc())}}}),Fr=te.extend({renderHtml:function(){var t=this;return t.classes.add("iframe"),t.canFocus=!1,'<iframe id="'+t._id+'" class="'+t.classes+'" tabindex="-1" src="'+(t.settings.url||"javascript:''")+'" frameborder="0"></iframe>'},src:function(t){this.getEl().src=t},html:function(t,e){var n=this,i=this.getEl().contentWindow.document.body;return i?(i.innerHTML=t,e&&e()):c.setTimeout(function(){n.html(t)}),this}}),Vr=te.extend({init:function(t){this._super(t),this.classes.add("widget").add("infobox"),this.canFocus=!1},severity:function(t){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(t)},help:function(t){this.state.set("help",t)},renderHtml:function(){var t=this,e=t.classPrefix;return'<div id="'+t._id+'" class="'+t.classes+'"><div id="'+t._id+'-body">'+t.encode(t.state.get("text"))+'<button role="button" tabindex="-1"><i class="'+e+"ico "+e+'i-help"></i></button></div></div>'},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl("body").firstChild.data=t.encode(e.value),t.state.get("rendered")&&t.updateLayoutRect()}),t.state.on("change:help",function(e){t.classes.toggle("has-help",e.value),t.state.get("rendered")&&t.updateLayoutRect()}),t._super()}}),qr=te.extend({init:function(t){var e=this;e._super(t),e.classes.add("widget").add("label"),e.canFocus=!1,t.multiline&&e.classes.add("autoscroll"),t.strong&&e.classes.add("strong")},initLayoutRect:function(){var t=this,e=t._super();return t.settings.multiline&&(vt.getSize(t.getEl()).width>e.maxW&&(e.minW=e.maxW,t.classes.add("multiline")),t.getEl().style.width=e.minW+"px",e.startMinH=e.h=e.minH=Math.min(e.maxH,vt.getSize(t.getEl()).height)),e},repaint:function(){return this.settings.multiline||(this.getEl().style.lineHeight=this.layoutRect().h+"px"),this._super()},severity:function(t){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(t)},renderHtml:function(){var t,e,n=this,i=n.settings.forId,r=n.settings.html?n.settings.html:n.encode(n.state.get("text"));return!i&&(e=n.settings.forName)&&(t=n.getRoot().find("#"+e)[0])&&(i=t._id),i?'<label id="'+n._id+'" class="'+n.classes+'"'+(i?' for="'+i+'"':"")+">"+r+"</label>":'<span id="'+n._id+'" class="'+n.classes+'">'+r+"</span>"},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.innerHtml(t.encode(e.value)),t.state.get("rendered")&&t.updateLayoutRect()}),t._super()}}),Ur=ge.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(t){this._super(t),this.classes.add("toolbar")},postRender:function(){return this.items().each(function(t){t.classes.add("toolbar-item")}),this._super()}}),jr=Ur.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}}),$r=pn.extend({init:function(t){var e=this;e._renderOpen=!0,e._super(t),t=e.settings,e.classes.add("menubtn"),t.fixedWidth&&e.classes.add("fixed-width"),e.aria("haspopup",!0),e.state.set("menu",t.menu||e.render())},showMenu:function(t){var e,n=this;if(n.menu&&n.menu.visible()&&!1!==t)return n.hideMenu();n.menu||(e=n.state.get("menu")||[],n.classes.add("opened"),e.length?e={type:"menu",animate:!0,items:e}:(e.type=e.type||"menu",e.animate=!0),e.renderTo?n.menu=e.parent(n).show().renderTo():n.menu=ae.create(e).parent(n).renderTo(),n.fire("createmenu"),n.menu.reflow(),n.menu.on("cancel",function(t){t.control.parent()===n.menu&&(t.stopPropagation(),n.focus(),n.hideMenu())}),n.menu.on("select",function(){n.focus()}),n.menu.on("show hide",function(t){t.control===n.menu&&(n.activeMenu("show"===t.type),n.classes.toggle("opened","show"===t.type)),n.aria("expanded","show"===t.type)}).fire("show")),n.menu.show(),n.menu.layoutRect({w:n.layoutRect().w}),n.menu.repaint(),n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"]),n.fire("showmenu")},hideMenu:function(){this.menu&&(this.menu.items().each(function(t){t.hideMenu&&t.hideMenu()}),this.menu.hide())},activeMenu:function(t){this.classes.toggle("active",t)},renderHtml:function(){var t,e=this,n=e._id,i=e.classPrefix,r=e.settings.icon,o=e.state.get("text"),s="";return(t=e.settings.image)?(r="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",o&&(e.classes.add("btn-has-text"),s='<span class="'+i+'txt">'+e.encode(o)+"</span>"),r=e.settings.icon?i+"ico "+i+"i-"+r:"",e.aria("role",e.parent()instanceof jr?"menuitem":"button"),'<div id="'+n+'" class="'+e.classes+'" tabindex="-1" aria-labelledby="'+n+'"><button id="'+n+'-open" role="presentation" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+t+"></i>":"")+s+' <i class="'+i+'caret"></i></button></div>'},postRender:function(){var t=this;return t.on("click",function(e){e.control===t&&function(t,e){for(;t;){if(e===t)return!0;t=t.parentNode}return!1}(e.target,t.getEl())&&(t.focus(),t.showMenu(!e.aria),e.aria&&t.menu.items().filter(":visible")[0].focus())}),t.on("mouseenter",function(e){var n,i=e.control,r=t.parent();i&&r&&i instanceof $r&&i.parent()===r&&(r.items().filter("MenuButton").each(function(t){t.hideMenu&&t!==i&&(t.menu&&t.menu.visible()&&(n=!0),t.hideMenu())}),n&&(i.focus(),i.showMenu()))}),t._super()},bindStates:function(){var t=this;return t.state.on("change:menu",function(){t.menu&&t.menu.remove(),t.menu=null}),t._super()},remove:function(){this._super(),this.menu&&this.menu.remove()}});function Yr(t,e){var n,i,r=this,o=Jt.classPrefix;r.show=function(s,a){function l(){n&&(yt(t).append('<div class="'+o+"throbber"+(e?" "+o+"throbber-inline":"")+'"></div>'),a&&a())}return r.hide(),n=!0,s?i=c.setTimeout(l,s):l(),r},r.hide=function(){var e=t.lastChild;return c.clearTimeout(i),e&&-1!==e.className.indexOf("throbber")&&e.parentNode.removeChild(e),n=!1,r}}var Xr=Ce.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(t){if(t.autohide=!0,t.constrainToViewport=!0,"function"==typeof t.items&&(t.itemsFactory=t.items,t.items=[]),t.itemDefaults)for(var e=t.items,n=e.length;n--;)e[n]=_.extend({},t.itemDefaults,e[n]);this._super(t),this.classes.add("menu"),t.animate&&11!==l.ie&&this.classes.add("animate")},repaint:function(){return this.classes.toggle("menu-align",!0),this._super(),this.getEl().style.height="",this.getEl("body").style.height="",this},cancel:function(){this.hideAll(),this.fire("select")},load:function(){var t,e=this;function n(){e.throbber&&(e.throbber.hide(),e.throbber=null)}e.settings.itemsFactory&&(e.throbber||(e.throbber=new Yr(e.getEl("body"),!0),0===e.items().length?(e.throbber.show(),e.fire("loading")):e.throbber.show(100,function(){e.items().remove(),e.fire("loading")}),e.on("hide close",n)),e.requestTime=t=(new Date).getTime(),e.settings.itemsFactory(function(i){0!==i.length?e.requestTime===t&&(e.getEl().style.width="",e.getEl("body").style.width="",n(),e.items().remove(),e.getEl("body").innerHTML="",e.add(i),e.renderNew(),e.fire("loaded")):e.hide()}))},hideAll:function(){return this.find("menuitem").exec("hideMenu"),this._super()},preRender:function(){var t=this;return t.items().each(function(e){var n=e.settings;if(n.icon||n.image||n.selectable)return t._hasIcons=!0,!1}),t.settings.itemsFactory&&t.on("postrender",function(){t.settings.itemsFactory&&t.load()}),t.on("show hide",function(e){e.control===t&&("show"===e.type?c.setTimeout(function(){t.classes.add("in")},0):t.classes.remove("in"))}),t._super()}}),Jr=$r.extend({init:function(t){var e,n,i,r,o=this;o._super(t),t=o.settings,o._values=e=t.values,e&&("undefined"!=typeof t.value&&function s(e){for(var r=0;r<e.length;r++){if(n=e[r].selected||t.value===e[r].value)return i=i||e[r].text,o.state.set("value",e[r].value),!0;if(e[r].menu&&s(e[r].menu))return!0}}(e),!n&&e.length>0&&(i=e[0].text,o.state.set("value",e[0].value)),o.state.set("menu",e)),o.state.set("text",t.text||i),o.classes.add("listbox"),o.on("select",function(e){var n=e.control;r&&(e.lastControl=r),t.multiple?n.active(!n.active()):o.value(e.control.value()),r=n})},bindStates:function(){var t=this;return t.on("show",function(e){var n,i;n=e.control,i=t.value(),n instanceof Xr&&n.items().each(function(t){t.hasMenus()||t.active(t.value()===i)})}),t.state.on("change:value",function(e){var n=function i(t,e){var n;if(t)for(var r=0;r<t.length;r++){if(t[r].value===e)return t[r];if(t[r].menu&&(n=i(t[r].menu,e)))return n}}(t.state.get("menu"),e.value);n?t.text(n.text):t.text(t.settings.text)}),t._super()}}),Gr=te.extend({Defaults:{border:0,role:"menuitem"},init:function(t){var e,n=this;n._super(t),t=n.settings,n.classes.add("menu-item"),t.menu&&n.classes.add("menu-item-expand"),t.preview&&n.classes.add("menu-item-preview"),"-"!==(e=n.state.get("text"))&&"|"!==e||(n.classes.add("menu-item-sep"),n.aria("role","separator"),n.state.set("text","-")),t.selectable&&(n.aria("role","menuitemcheckbox"),n.classes.add("menu-item-checkbox"),t.icon="selected"),t.preview||t.selectable||n.classes.add("menu-item-normal"),n.on("mousedown",function(t){t.preventDefault()}),t.menu&&!t.ariaHideMenu&&n.aria("haspopup",!0)},hasMenus:function(){return!!this.settings.menu},showMenu:function(){var t,e=this,n=e.settings,i=e.parent();if(i.items().each(function(t){t!==e&&t.hideMenu()}),n.menu){(t=e.menu)?t.show():((t=n.menu).length?t={type:"menu",animate:!0,items:t}:(t.type=t.type||"menu",t.animate=!0),i.settings.itemDefaults&&(t.itemDefaults=i.settings.itemDefaults),(t=e.menu=ae.create(t).parent(e).renderTo()).reflow(),t.on("cancel",function(n){n.stopPropagation(),e.focus(),t.hide()}),t.on("show hide",function(t){t.control.items&&t.control.items().each(function(t){t.active(t.settings.selected)})}).fire("show"),t.on("hide",function(n){n.control===t&&e.classes.remove("selected")}),t.submenu=!0),t._parentMenu=i,t.classes.add("menu-sub");var r=t.testMoveRel(e.getEl(),e.isRtl()?["tl-tr","bl-br","tr-tl","br-bl"]:["tr-tl","br-bl","tl-tr","bl-br"]);t.moveRel(e.getEl(),r),t.rel=r,r="menu-sub-"+r,t.classes.remove(t._lastRel).add(r),t._lastRel=r,e.classes.add("selected"),e.aria("expanded",!0)}},hideMenu:function(){var t=this;return t.menu&&(t.menu.items().each(function(t){t.hideMenu&&t.hideMenu()}),t.menu.hide(),t.aria("expanded",!1)),t},renderHtml:function(){var t,e=this,n=e._id,i=e.settings,r=e.classPrefix,o=e.state.get("text"),s=e.settings.icon,a="",u=i.shortcut,c=e.encode(i.url);function d(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(t){var e=i.match||"";return e?t.replace(new RegExp(d(e),"gi"),function(t){return"!mce~match["+t+"]mce~match!"}):t}function h(t){return t.replace(new RegExp(d("!mce~match["),"g"),"<b>").replace(new RegExp(d("]mce~match!"),"g"),"</b>")}return s&&e.parent().classes.add("menu-has-icons"),i.image&&(a=" style=\"background-image: url('"+i.image+"')\""),u&&(u=function(t){var e,n,i={};for(i=l.mac?{alt:"&#x2325;",ctrl:"&#x2318;",shift:"&#x21E7;",meta:"&#x2318;"}:{meta:"Ctrl"},t=t.split("+"),e=0;e<t.length;e++)(n=i[t[e].toLowerCase()])&&(t[e]=n);return t.join("+")}(u)),s=r+"ico "+r+"i-"+(e.settings.icon||"none"),t="-"!==o?'<i class="'+s+'"'+a+"></i>\xa0":"",o=h(e.encode(f(o))),c=h(e.encode(f(c))),'<div id="'+n+'" class="'+e.classes+'" tabindex="-1">'+t+("-"!==o?'<span id="'+n+'-text" class="'+r+'text">'+o+"</span>":"")+(u?'<div id="'+n+'-shortcut" class="'+r+'menu-shortcut">'+u+"</div>":"")+(i.menu?'<div class="'+r+'caret"></div>':"")+(c?'<div class="'+r+'menu-item-link">'+c+"</div>":"")+"</div>"},postRender:function(){var t=this,e=t.settings,n=e.textStyle;if("function"==typeof n&&(n=n.call(this)),n){var i=t.getEl("text");i&&(i.setAttribute("style",n),t._textStyle=n)}return t.on("mouseenter click",function(n){n.control===t&&(e.menu||"click"!==n.type?(t.showMenu(),n.aria&&t.menu.focus(!0)):(t.fire("select"),c.requestAnimationFrame(function(){t.parent().hideAll()})))}),t._super(),t},hover:function(){return this.parent().items().each(function(t){t.classes.remove("selected")}),this.classes.toggle("selected",!0),this},active:function(t){return function(t,e){var n=t._textStyle;if(n){var i=t.getEl("text");i.setAttribute("style",n),e&&(i.style.color="",i.style.backgroundColor="")}}(this,t),void 0!==t&&this.aria("checked",t),this._super(t)},remove:function(){this._super(),this.menu&&this.menu.remove()}}),Kr=bn.extend({Defaults:{classes:"radio",role:"radio"}}),Qr=te.extend({renderHtml:function(){var t=this,e=t.classPrefix;return t.classes.add("resizehandle"),"both"===t.settings.direction&&t.classes.add("resizehandle-both"),t.canFocus=!1,'<div id="'+t._id+'" class="'+t.classes+'"><i class="'+e+"ico "+e+'i-resize"></i></div>'},postRender:function(){var t=this;t._super(),t.resizeDragHelper=new se(this._id,{start:function(){t.fire("ResizeStart")},drag:function(e){"both"!==t.settings.direction&&(e.deltaX=0),t.fire("Resize",e)},stop:function(){t.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}});function Zr(t){var e="";if(t)for(var n=0;n<t.length;n++)e+='<option value="'+t[n]+'">'+t[n]+"</option>";return e}var to=te.extend({Defaults:{classes:"selectbox",role:"selectbox",options:[]},init:function(t){var e=this;e._super(t),e.settings.size&&(e.size=e.settings.size),e.settings.options&&(e._options=e.settings.options),e.on("keydown",function(t){var n;13===t.keyCode&&(t.preventDefault(),e.parents().reverse().each(function(t){if(t.toJSON)return n=t,!1}),e.fire("submit",{data:n.toJSON()}))})},options:function(t){return arguments.length?(this.state.set("options",t),this):this.state.get("options")},renderHtml:function(){var t,e=this,n="";return t=Zr(e._options),e.size&&(n=' size = "'+e.size+'"'),'<select id="'+e._id+'" class="'+e.classes+'"'+n+">"+t+"</select>"},bindStates:function(){var t=this;return t.state.on("change:options",function(e){t.getEl().innerHTML=Zr(e.value)}),t._super()}});function eo(t,e,n){return t<e&&(t=e),t>n&&(t=n),t}function no(t,e,n){t.setAttribute("aria-"+e,n)}function io(t,e){var n,i,r,o,s;"v"===t.settings.orientation?(r="top",i="height",n="h"):(r="left",i="width",n="w"),s=t.getEl("handle"),o=((t.layoutRect()[n]||100)-vt.getSize(s)[i])*((e-t._minValue)/(t._maxValue-t._minValue))+"px",s.style[r]=o,s.style.height=t.layoutRect().h+"px",no(s,"valuenow",e),no(s,"valuetext",""+t.settings.previewFilter(e)),no(s,"valuemin",t._minValue),no(s,"valuemax",t._maxValue)}var ro=te.extend({init:function(t){var e=this;t.previewFilter||(t.previewFilter=function(t){return Math.round(100*t)/100}),e._super(t),e.classes.add("slider"),"v"===t.orientation&&e.classes.add("vertical"),e._minValue=Qn.isNumber(t.minValue)?t.minValue:0,e._maxValue=Qn.isNumber(t.maxValue)?t.maxValue:100,e._initValue=e.state.get("value")},renderHtml:function(){var t=this._id,e=this.classPrefix;return'<div id="'+t+'" class="'+this.classes+'"><div id="'+t+'-handle" class="'+e+'slider-handle" role="slider" tabindex="-1"></div></div>'},reset:function(){this.value(this._initValue).repaint()},postRender:function(){var t,e,n,i,r,o,s,a,l,u,c,d,f,h,m=this;t=m._minValue,e=m._maxValue,"v"===m.settings.orientation?(n="screenY",i="top",r="height",o="h"):(n="screenX",i="left",r="width",o="w"),m._super(),function(t,e){function n(n){var i,r,o;i=eo(i=(((i=m.value())+(o=t))/(e-o)+.05*n)*(e-(r=t))-r,t,e),m.value(i),m.fire("dragstart",{value:i}),m.fire("drag",{value:i}),m.fire("dragend",{value:i})}m.on("keydown",function(t){switch(t.keyCode){case 37:case 38:n(-1);break;case 39:case 40:n(1)}})}(t,e),s=t,a=e,l=m.getEl("handle"),m._dragHelper=new se(m._id,{handle:m._id+"-handle",start:function(t){u=t[n],c=parseInt(m.getEl("handle").style[i],10),d=(m.layoutRect()[o]||100)-vt.getSize(l)[r],m.fire("dragstart",{value:h})},drag:function(t){var e=t[n]-u;f=eo(c+e,0,d),l.style[i]=f+"px",h=s+f/d*(a-s),m.value(h),m.tooltip().text(""+m.settings.previewFilter(h)).show().moveRel(l,"bc tc"),m.fire("drag",{value:h})},stop:function(){m.tooltip().hide(),m.fire("dragend",{value:h})}})},repaint:function(){this._super(),io(this,this.value())},bindStates:function(){var t=this;return t.state.on("change:value",function(e){io(t,e.value)}),t._super()}}),oo=te.extend({renderHtml:function(){return this.classes.add("spacer"),this.canFocus=!1,'<div id="'+this._id+'" class="'+this.classes+'"></div>'}}),so=$r.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var t,e,n=this.getEl(),i=this.layoutRect();return this._super(),t=n.firstChild,e=n.lastChild,yt(t).css({width:i.w-vt.getSize(e).width,height:i.h-2}),yt(e).css({height:i.h-2}),this},activeMenu:function(t){yt(this.getEl().lastChild).toggleClass(this.classPrefix+"active",t)},renderHtml:function(){var t,e,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a=n.settings,l="";return(t=a.image)?(o="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",o=a.icon?r+"ico "+r+"i-"+o:"",s&&(n.classes.add("btn-has-text"),l='<span class="'+r+'txt">'+n.encode(s)+"</span>"),e="boolean"==typeof a.active?' aria-pressed="'+a.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" role="button"'+e+' tabindex="-1"><button type="button" hidefocus="1" tabindex="-1">'+(o?'<i class="'+o+'"'+t+"></i>":"")+l+'</button><button type="button" class="'+r+'open" hidefocus="1" tabindex="-1">'+(n._menuBtnText?(o?"\xa0":"")+n._menuBtnText:"")+' <i class="'+r+'caret"></i></button></div>'},postRender:function(){var t=this.settings.onclick;return this.on("click",function(e){var n=e.target;if(e.control===this)for(;n;){if(e.aria&&"down"!==e.aria.key||"BUTTON"===n.nodeName&&-1===n.className.indexOf("open"))return e.stopImmediatePropagation(),void(t&&t.call(this,e));n=n.parentNode}}),delete this.settings.onclick,this._super()}}),ao=cr.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"},isNative:function(){return!0}}),lo=ve.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(t){var e;this.activeTabId&&(e=this.getEl(this.activeTabId),yt(e).removeClass(this.classPrefix+"active"),e.setAttribute("aria-selected","false")),this.activeTabId="t"+t,(e=this.getEl("t"+t)).setAttribute("aria-selected","true"),yt(e).addClass(this.classPrefix+"active"),this.items()[t].show().fire("showtab"),this.reflow(),this.items().each(function(e,n){t!==n&&e.hide()})},renderHtml:function(){var t=this,e=t._layout,n="",i=t.classPrefix;return t.preRender(),e.preRender(t),t.items().each(function(e,r){var o=t._id+"-t"+r;e.aria("role","tabpanel"),e.aria("labelledby",o),n+='<div id="'+o+'" class="'+i+'tab" unselectable="on" role="tab" aria-controls="'+e._id+'" aria-selected="false" tabIndex="-1">'+t.encode(e.settings.title)+"</div>"}),'<div id="'+t._id+'" class="'+t.classes+'" hidefocus="1" tabindex="-1"><div id="'+t._id+'-head" class="'+i+'tabs" role="tablist">'+n+'</div><div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+e.renderHtml(t)+"</div></div>"},postRender:function(){var t=this;t._super(),t.settings.activeTab=t.settings.activeTab||0,t.activateTab(t.settings.activeTab),this.on("click",function(e){var n=e.target.parentNode;if(n&&n.id===t._id+"-head")for(var i=n.childNodes.length;i--;)n.childNodes[i]===e.target&&t.activateTab(i)})},initLayoutRect:function(){var t,e,n,i=this;e=(e=vt.getSize(i.getEl("head")).width)<0?0:e,n=0,i.items().each(function(t){e=Math.max(e,t.layoutRect().minW),n=Math.max(n,t.layoutRect().minH)}),i.items().each(function(t){t.settings.x=0,t.settings.y=0,t.settings.w=e,t.settings.h=n,t.layoutRect({x:0,y:0,w:e,h:n})});var r=vt.getSize(i.getEl("head")).height;return i.settings.minWidth=e,i.settings.minHeight=n+r,(t=i._super()).deltaH+=r,t.innerH=t.h-t.deltaH,t}}),uo=te.extend({init:function(t){var e=this;e._super(t),e.classes.add("textbox"),t.multiline?e.classes.add("multiline"):(e.on("keydown",function(t){var n;13===t.keyCode&&(t.preventDefault(),e.parents().reverse().each(function(t){if(t.toJSON)return n=t,!1}),e.fire("submit",{data:n.toJSON()}))}),e.on("keyup",function(t){e.state.set("value",t.target.value)}))},repaint:function(){var t,e,n,i,r,o=this,s=0;t=o.getEl().style,e=o._layoutRect,r=o._lastRepaintRect||{};var a=document;return!o.settings.multiline&&a.all&&(!a.documentMode||a.documentMode<=8)&&(t.lineHeight=e.h-s+"px"),i=(n=o.borderBox).left+n.right+8,s=n.top+n.bottom+(o.settings.multiline?8:0),e.x!==r.x&&(t.left=e.x+"px",r.x=e.x),e.y!==r.y&&(t.top=e.y+"px",r.y=e.y),e.w!==r.w&&(t.width=e.w-i+"px",r.w=e.w),e.h!==r.h&&(t.height=e.h-s+"px",r.h=e.h),o._lastRepaintRect=r,o.fire("repaint",{},!1),o},renderHtml:function(){var t,e,n=this,i=n.settings;return t={id:n._id,hidefocus:"1"},_.each(["rows","spellcheck","maxLength","size","readonly","min","max","step","list","pattern","placeholder","required","multiple"],function(e){t[e]=i[e]}),n.disabled()&&(t.disabled="disabled"),i.subtype&&(t.type=i.subtype),(e=vt.create(i.multiline?"textarea":"input",t)).value=n.state.get("value"),e.className=n.classes,e.outerHTML},value:function(t){return arguments.length?(this.state.set("value",t),this):(this.state.get("rendered")&&this.state.set("value",this.getEl().value),this.state.get("value"))},postRender:function(){var t=this;t.getEl().value=t.state.get("value"),t._super(),t.$el.on("change",function(e){t.state.set("value",e.target.value),t.fire("change",e)})},bindStates:function(){var t=this;return t.state.on("change:value",function(e){t.getEl().value!==e.value&&(t.getEl().value=e.value)}),t.state.on("change:disabled",function(e){t.getEl().disabled=e.value}),t._super()},remove:function(){this.$el.off(),this._super()}}),co=function(){return{Selector:Pt,Collection:Dt,ReflowQueue:Vt,Control:Jt,Factory:ae,KeyboardNavigation:ue,Container:ge,DragHelper:se,Scrollable:pe,Panel:ve,Movable:Qt,Resizable:ye,FloatPanel:Ce,Window:Pe,MessageBox:We,Tooltip:Zt,Widget:te,Progress:ee,Notification:ie,Layout:mn,AbsoluteLayout:gn,Button:pn,ButtonGroup:yn,Checkbox:bn,ComboBox:wn,ColorBox:_n,PanelButton:Rn,ColorButton:Cn,ColorPicker:Hn,Path:Mn,ElementPath:Tn,FormItem:Pn,Form:Wn,FieldSet:Nn,FilePicker:ar,FitLayout:lr,FlexLayout:ur,FlowLayout:cr,FormatControls:Ir,GridLayout:zr,Iframe:Fr,InfoBox:Vr,Label:qr,Toolbar:Ur,MenuBar:jr,MenuButton:$r,MenuItem:Gr,Throbber:Yr,Menu:Xr,ListBox:Jr,Radio:Kr,ResizeHandle:Qr,SelectBox:to,Slider:ro,Spacer:oo,SplitButton:so,StackLayout:ao,TabPanel:lo,TextBox:uo,DropZone:Sn,BrowseButton:vn}},fo=function(t){t.ui?_.each(co(),function(e,n){t.ui[n]=e}):t.ui=co()};_.each(co(),function(t,e){ae.add(e,t)}),fo(window.tinymce?window.tinymce:{}),a.add("inlite",function(t){var e=fn();return Ir.setup(t),on(t,e),Ne(t,e)})}();