血透系统PC前端

tinymce.min.js 815KB

12
  1. // 4.7.5 (2018-01-22)
  2. !function(){"use strict";var e,t,n,r,o,i,a,s,u,c,l,f,d,m,p,g,h,v=function(e){return function(){return e}},y={noop:function(){},noarg:function(e){return function(){return e()}},compose:function(e,t){return function(){return e(t.apply(null,arguments))}},constant:v,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(e){for(var t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[n-1]=arguments[n];return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var o=t.concat(n);return e.apply(null,o)}},not:function(e){return function(){return!e.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:v(!1),always:v(!0)},b=y.never,C=y.always,x=function(){return w},w=(r={fold:function(e,t){return e()},is:b,isSome:b,isNone:C,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:x,ap:x,each:function(){},bind:x,flatten:x,exists:b,forall:C,filter:x,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:y.constant("none()")},Object.freeze&&Object.freeze(r),r),N=function(e){var t=function(){return e},n=function(){return o},r=function(t){return t(e)},o={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:C,isNone:b,getOr:t,getOrThunk:t,getOrDie:t,or:n,orThunk:n,map:function(t){return N(t(e))},ap:function(t){return t.fold(x,function(t){return N(t(e))})},each:function(t){t(e)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(e)?o:w},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(b,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},E={some:N,none:x,from:function(e){return null===e||e===undefined?w:N(e)}},S=(o=Array.prototype.indexOf)===undefined?function(e,t){return D(e,t)}:function(e,t){return o.call(e,t)},k=function(e,t){return S(e,t)>-1},T=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o,e)}return r},A=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},_=function(e,t){for(var n=e.length-1;n>=0;n--)t(e[n],n,e)},B=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r,e)&&n.push(i)}return n},R=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return E.some(n);return E.none()},D=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},O=Array.prototype.push,P=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!Array.prototype.isPrototypeOf(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);O.apply(t,e[n])}return t},I=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},L=Array.prototype.slice,M={map:T,each:A,eachr:_,partition:function(e,t){for(var n=[],r=[],o=0,i=e.length;o<i;o++){var a=e[o];(t(a,o,e)?n:r).push(a)}return{pass:n,fail:r}},filter:B,groupBy:function(e,t){if(0===e.length)return[];for(var n=t(e[0]),r=[],o=[],i=0,a=e.length;i<a;i++){var s=e[i],u=t(s);u!==n&&(r.push(o),o=[]),n=u,o.push(s)}return 0!==o.length&&r.push(o),r},indexOf:function(e,t){var n=S(e,t);return-1===n?E.none():E.some(n)},foldr:function(e,t,n){return _(e,function(e){n=t(n,e)}),n},foldl:function(e,t,n){return A(e,function(e){n=t(n,e)}),n},find:function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return E.some(o)}return E.none()},findIndex:R,flatten:P,bind:function(e,t){var n=T(e,t);return P(n)},forall:I,exists:function(e,t){return R(e,t).isSome()},contains:k,equal:function(e,t){return e.length===t.length&&I(e,function(e,n){return e===t[n]})},reverse:function(e){var t=L.call(e,0);return t.reverse(),t},chunk:function(e,t){for(var n=[],r=0;r<e.length;r+=t){var o=e.slice(r,r+t);n.push(o)}return n},difference:function(e,t){return B(e,function(e){return!k(t,e)})},mapToObject:function(e,t){for(var n={},r=0,o=e.length;r<o;r++){var i=e[r];n[String(i)]=t(i,r)}return n},pure:function(e){return[e]},sort:function(e,t){var n=L.call(e,0);return n.sort(t),n},range:function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},head:function(e){return 0===e.length?E.none():E.some(e[0])},last:function(e){return 0===e.length?E.none():E.some(e[e.length-1])}},F="undefined"!=typeof window?window:Function("return this;")(),z=function(e,t){for(var n=t!==undefined&&null!==t?t:F,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n},U=function(e,t){var n=e.split(".");return z(n,t)},V=function(e,t){var n=U(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n},H=function(){return V("URL")},q=function(e){return H().createObjectURL(e)},j=function(e){H().revokeObjectURL(e)},$=navigator,W=$.userAgent,K=function(e){return"matchMedia"in window&&matchMedia(e).matches};d=/Android/.test(W),a=(a=!(i=/WebKit/.test(W))&&/MSIE/gi.test(W)&&/Explorer/gi.test($.appName))&&/MSIE (\w+)\./.exec(W)[1],s=-1!==W.indexOf("Trident/")&&(-1!==W.indexOf("rv:")||-1!==$.appName.indexOf("Netscape"))&&11,u=-1!==W.indexOf("Edge/")&&!a&&!s&&12,a=a||s||u,c=!i&&!s&&/Gecko/.test(W),l=-1!==W.indexOf("Mac"),f=/(iPad|iPhone)/.test(W),m="FormData"in window&&"FileReader"in window&&"URL"in window&&!!q,p=K("only screen and (max-device-width: 480px)")&&(d||f),g=K("only screen and (min-width: 800px)")&&(d||f),h=-1!==W.indexOf("Windows Phone"),u&&(i=!1);var X,Y,G,J,Q,Z,ee,te,ne,re,oe,ie,ae,se,ue,ce,le,fe,de,me={opera:!1,webkit:i,ie:a,gecko:c,mac:l,iOS:f,android:d,contentEditable:!f||m||parseInt(W.match(/AppleWebKit\/(\d*)/)[1],10)>=534,transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:8!==a,range:window.getSelection&&"Range"in window,documentMode:a&&!u?document.documentMode||7:10,fileApi:m,ceFalse:!1===a||a>8,cacheSuffix:"",container:null,overrideViewPort:null,experimentalShadowDom:!1,canHaveCSP:!1===a||a>11,desktop:!p&&!g,windowsPhone:h},pe=window.Promise?window.Promise:function(){function e(e,t){return function(){e.apply(t,arguments)}}var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],u(t,e(i,this),e(a,this))},r=n.immediateFn||"function"==typeof setImmediate&&setImmediate||function(e){setTimeout(e,1)};function o(e){var t=this;null!==this._state?r(function(){var n=t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(o){return void e.reject(o)}e.resolve(r)}else(t._state?e.resolve:e.reject)(t._value)}):this._deferreds.push(e)}function i(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void u(e(n,t),e(i,this),e(a,this))}this._state=!0,this._value=t,s.call(this)}catch(r){a.call(this,r)}}function a(e){this._state=!1,this._value=e,s.call(this)}function s(){for(var e=0,t=this._deferreds.length;e<t;e++)o.call(this,this._deferreds[e]);this._deferreds=null}function u(e,t,n){var r=!1;try{e(function(e){r||(r=!0,t(e))},function(e){r||(r=!0,n(e))})}catch(o){if(r)return;r=!0,n(o)}}return n.prototype["catch"]=function(e){return this.then(null,e)},n.prototype.then=function(e,t){var r=this;return new n(function(n,i){o.call(r,new function(e,t,n,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r}(e,t,n,i))})},n.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&t(arguments[0])?arguments[0]:arguments);return new n(function(t,n){if(0===e.length)return t([]);var r=e.length;function o(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(e){o(i,e)},n)}e[i]=a,0==--r&&t(e)}catch(u){n(u)}}for(var i=0;i<e.length;i++)o(i,e[i])})},n.resolve=function(e){return e&&"object"==typeof e&&e.constructor===n?e:new n(function(t){t(e)})},n.reject=function(e){return new n(function(t,n){n(e)})},n.race=function(e){return new n(function(t,n){for(var r=0,o=e.length;r<o;r++)e[r].then(t,n)})},n}(),ge=function(e,t){return"number"!=typeof t&&(t=0),setTimeout(e,t)},he=function(e,t){return"number"!=typeof t&&(t=1),setInterval(e,t)},ve=function(e,t){var n,r;return(r=function(){var r=arguments;clearTimeout(n),n=ge(function(){e.apply(this,r)},t)}).stop=function(){clearTimeout(n)},r},ye={requestAnimationFrame:function(e,t){X?X.then(e):X=new pe(function(e){t||(t=document.body),function(e,t){var n,r=window.requestAnimationFrame,o=["ms","moz","webkit"];for(n=0;n<o.length&&!r;n++)r=window[o[n]+"RequestAnimationFrame"];r||(r=function(e){window.setTimeout(e,0)}),r(e,t)}(e,t)}).then(e)},setTimeout:ge,setInterval:he,setEditorTimeout:function(e,t,n){return ge(function(){e.removed||t()},n)},setEditorInterval:function(e,t,n){var r;return r=he(function(){e.removed?clearInterval(r):t()},n)},debounce:ve,throttle:ve,clearInterval:function(e){return clearInterval(e)},clearTimeout:function(e){return clearTimeout(e)}},be=/^(?:mouse|contextmenu)|click/,Ce={keyLocation:1,layerX:1,layerY:1,returnValue:1,webkitMovementX:1,webkitMovementY:1,keyIdentifier:1},xe=function(){return!1},we=function(){return!0},Ne=function(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r||!1):e.attachEvent&&e.attachEvent("on"+t,n)},Ee=function(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r||!1):e.detachEvent&&e.detachEvent("on"+t,n)},Se=function(e,t){var n,r,o,i,a,s,u=t||{};for(n in e)Ce[n]||(u[n]=e[n]);if(u.target||(u.target=u.srcElement||document),me.experimentalShadowDom&&(u.target=(r=e,o=u.target,a=o,(i=r.path)&&i.length>0&&(a=i[0]),r.deepPath&&(i=r.deepPath())&&i.length>0&&(a=i[0]),a)),e&&be.test(e.type)&&e.pageX===undefined&&e.clientX!==undefined){var c=u.target.ownerDocument||document,l=c.documentElement,f=c.body;u.pageX=e.clientX+(l&&l.scrollLeft||f&&f.scrollLeft||0)-(l&&l.clientLeft||f&&f.clientLeft||0),u.pageY=e.clientY+(l&&l.scrollTop||f&&f.scrollTop||0)-(l&&l.clientTop||f&&f.clientTop||0)}return u.preventDefault=function(){u.isDefaultPrevented=we,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},u.stopPropagation=function(){u.isPropagationStopped=we,e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0)},u.stopImmediatePropagation=function(){u.isImmediatePropagationStopped=we,u.stopPropagation()},0==((s=u).isDefaultPrevented===we||s.isDefaultPrevented===xe)&&(u.isDefaultPrevented=xe,u.isPropagationStopped=xe,u.isImmediatePropagationStopped=xe),"undefined"==typeof u.metaKey&&(u.metaKey=!1),u},ke=function(e,t,n){var r=e.document,o={type:"ready"};if(n.domLoaded)t(o);else{var i=function(){return"complete"===r.readyState||"interactive"===r.readyState&&r.body},a=function(){n.domLoaded||(n.domLoaded=!0,t(o))},s=function(){i()&&(Ee(r,"readystatechange",s),a())},u=function(){try{r.documentElement.doScroll("left")}catch(e){return void ye.setTimeout(u)}a()};!r.addEventListener||me.ie&&me.ie<11?(Ne(r,"readystatechange",s),r.documentElement.doScroll&&e.self===e.top&&u()):i()?a():Ne(e,"DOMContentLoaded",a),Ne(e,"load",a)}},Te=function(){var e,t,n,r,o,i=this,a={};t="mce-data-"+(+new Date).toString(32),r="onmouseenter"in document.documentElement,n="onfocusin"in document.documentElement,o={mouseenter:"mouseover",mouseleave:"mouseout"},e=1,i.domLoaded=!1,i.events=a;var s=function(e,t){var n,r,o,i,s=a[t];if(n=s&&s[e.type])for(r=0,o=n.length;r<o;r++)if((i=n[r])&&!1===i.func.call(i.scope,e)&&e.preventDefault(),e.isImmediatePropagationStopped())return};i.bind=function(u,c,l,f){var d,m,p,g,h,v,y,b=window,C=function(e){s(Se(e||b.event),d)};if(u&&3!==u.nodeType&&8!==u.nodeType){for(u[t]?d=u[t]:(d=e++,u[t]=d,a[d]={}),f=f||u,p=(c=c.split(" ")).length;p--;)v=C,h=y=!1,"DOMContentLoaded"===(g=c[p])&&(g="ready"),i.domLoaded&&"ready"===g&&"complete"===u.readyState?l.call(f,Se({type:g})):(r||(h=o[g])&&(v=function(e){var t,n;if(t=e.currentTarget,(n=e.relatedTarget)&&t.contains)n=t.contains(n);else for(;n&&n!==t;)n=n.parentNode;n||((e=Se(e||b.event)).type="mouseout"===e.type?"mouseleave":"mouseenter",e.target=t,s(e,d))}),n||"focusin"!==g&&"focusout"!==g||(y=!0,h="focusin"===g?"focus":"blur",v=function(e){(e=Se(e||b.event)).type="focus"===e.type?"focusin":"focusout",s(e,d)}),(m=a[d][g])?"ready"===g&&i.domLoaded?l({type:g}):m.push({func:l,scope:f}):(a[d][g]=m=[{func:l,scope:f}],m.fakeName=h,m.capture=y,m.nativeHandler=v,"ready"===g?ke(u,v,i):Ne(u,h||g,v,y)));return u=m=0,l}},i.unbind=function(e,n,r){var o,s,u,c,l,f;if(!e||3===e.nodeType||8===e.nodeType)return i;if(o=e[t]){if(f=a[o],n){for(u=(n=n.split(" ")).length;u--;)if(s=f[l=n[u]]){if(r)for(c=s.length;c--;)if(s[c].func===r){var d=s.nativeHandler,m=s.fakeName,p=s.capture;(s=s.slice(0,c).concat(s.slice(c+1))).nativeHandler=d,s.fakeName=m,s.capture=p,f[l]=s}r&&0!==s.length||(delete f[l],Ee(e,s.fakeName||l,s.nativeHandler,s.capture))}}else{for(l in f)s=f[l],Ee(e,s.fakeName||l,s.nativeHandler,s.capture);f={}}for(l in f)return i;delete a[o];try{delete e[t]}catch(g){e[t]=null}}return i},i.fire=function(e,n,r){var o;if(!e||3===e.nodeType||8===e.nodeType)return i;(r=Se(null,r)).type=n,r.target=e;do{(o=e[t])&&s(r,o),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!r.isPropagationStopped());return i},i.clean=function(e){var n,r,o=i.unbind;if(!e||3===e.nodeType||8===e.nodeType)return i;if(e[t]&&o(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName)for(o(e),n=(r=e.getElementsByTagName("*")).length;n--;)(e=r[n])[t]&&o(e);return i},i.destroy=function(){a={}},i.cancel=function(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}};(Te.Event=new Te).bind(window,"ready",function(){});var Ae="sizzle"+-new Date,_e=window.document,Be=0,Re=0,De=ft(),Oe=ft(),Pe=ft(),Ie=function(e,t){return e===t&&(ie=!0),0},Le=typeof undefined,Me=1<<31,Fe={}.hasOwnProperty,ze=[],Ue=ze.pop,Ve=ze.push,He=ze.push,qe=ze.slice,je=ze.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]===e)return t;return-1},$e="[\\x20\\t\\r\\n\\f]",We="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",Ke="\\["+$e+"*("+We+")(?:"+$e+"*([*^$|!~]?=)"+$e+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+We+"))|)"+$e+"*\\]",Xe=":("+We+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+Ke+")*)|.*)\\)|)",Ye=new RegExp("^"+$e+"+|((?:^|[^\\\\])(?:\\\\.)*)"+$e+"+$","g"),Ge=new RegExp("^"+$e+"*,"+$e+"*"),Je=new RegExp("^"+$e+"*([>+~]|"+$e+")"+$e+"*"),Qe=new RegExp("="+$e+"*([^\\]'\"]*?)"+$e+"*\\]","g"),Ze=new RegExp(Xe),et=new RegExp("^"+We+"$"),tt={ID:new RegExp("^#("+We+")"),CLASS:new RegExp("^\\.("+We+")"),TAG:new RegExp("^("+We+"|[*])"),ATTR:new RegExp("^"+Ke),PSEUDO:new RegExp("^"+Xe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+$e+"*(even|odd|(([+-]|)(\\d*)n|)"+$e+"*(?:([+-]|)"+$e+"*(\\d+)|))"+$e+"*\\)|)","i"),bool:new RegExp("^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$","i"),needsContext:new RegExp("^"+$e+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+$e+"*((?:-\\d)?\\d*)"+$e+"*\\)|)(?=[^-]|$)","i")},nt=/^(?:input|select|textarea|button)$/i,rt=/^h\d$/i,ot=/^[^{]+\{\s*\[native \w/,it=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,at=/[+~]/,st=/'|\\/g,ut=new RegExp("\\\\([\\da-f]{1,6}"+$e+"?|("+$e+")|.)","ig"),ct=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{He.apply(ze=qe.call(_e.childNodes),_e.childNodes),ze[_e.childNodes.length].nodeType}catch(yC){He={apply:ze.length?function(e,t){Ve.apply(e,qe.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}var lt=function(e,t,n,r){var o,i,a,s,u,c,l,f,d,m;if((t?t.ownerDocument||t:_e)!==se&&ae(t),t=t||se,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(ce&&!r){if(o=it.exec(e))if(a=o[1]){if(9===s){if(!(i=t.getElementById(a))||!i.parentNode)return n;if(i.id===a)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(a))&&de(t,i)&&i.id===a)return n.push(i),n}else{if(o[2])return He.apply(n,t.getElementsByTagName(e)),n;if((a=o[3])&&G.getElementsByClassName)return He.apply(n,t.getElementsByClassName(a)),n}if(G.qsa&&(!le||!le.test(e))){if(f=l=Ae,d=t,m=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){for(c=ee(e),(l=t.getAttribute("id"))?f=l.replace(st,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",u=c.length;u--;)c[u]=f+bt(c[u]);d=at.test(e)&&vt(t.parentNode)||t,m=c.join(",")}if(m)try{return He.apply(n,d.querySelectorAll(m)),n}catch(p){}finally{l||t.removeAttribute("id")}}}return ne(e.replace(Ye,"$1"),t,n,r)};function ft(){var e=[];return function t(n,r){return e.push(n+" ")>J.cacheLength&&delete t[e.shift()],t[n+" "]=r}}function dt(e){return e[Ae]=!0,e}function mt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||Me)-(~e.sourceIndex||Me);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function pt(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function gt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return dt(function(t){return t=+t,dt(function(n,r){for(var o,i=e([],n.length,t),a=i.length;a--;)n[o=i[a]]&&(n[o]=!(r[o]=n[o]))})})}function vt(e){return e&&typeof e.getElementsByTagName!==Le&&e}for(Y in G=lt.support={},Z=lt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},ae=lt.setDocument=function(e){var t,n=e?e.ownerDocument||e:_e,r=n.defaultView;return n!==se&&9===n.nodeType&&n.documentElement?(se=n,ue=n.documentElement,ce=!Z(n),r&&r!==function(e){try{return e.top}catch(t){}return null}(r)&&(r.addEventListener?r.addEventListener("unload",function(){ae()},!1):r.attachEvent&&r.attachEvent("onunload",function(){ae()})),G.attributes=!0,G.getElementsByTagName=!0,G.getElementsByClassName=ot.test(n.getElementsByClassName),G.getById=!0,J.find.ID=function(e,t){if(typeof t.getElementById!==Le&&ce){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},J.filter.ID=function(e){var t=e.replace(ut,ct);return function(e){return e.getAttribute("id")===t}},J.find.TAG=G.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==Le)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],o=0,i=t.getElementsByTagName(e);if("*"===e){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},J.find.CLASS=G.getElementsByClassName&&function(e,t){if(ce)return t.getElementsByClassName(e)},fe=[],le=[],G.disconnectedMatch=!0,le=le.length&&new RegExp(le.join("|")),fe=fe.length&&new RegExp(fe.join("|")),t=ot.test(ue.compareDocumentPosition),de=t||ot.test(ue.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Ie=t?function(e,t){if(e===t)return ie=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!G.sortDetached&&t.compareDocumentPosition(e)===r?e===n||e.ownerDocument===_e&&de(_e,e)?-1:t===n||t.ownerDocument===_e&&de(_e,t)?1:oe?je.call(oe,e)-je.call(oe,t):0:4&r?-1:1)}:function(e,t){if(e===t)return ie=!0,0;var r,o=0,i=e.parentNode,a=t.parentNode,s=[e],u=[t];if(!i||!a)return e===n?-1:t===n?1:i?-1:a?1:oe?je.call(oe,e)-je.call(oe,t):0;if(i===a)return mt(e,t);for(r=e;r=r.parentNode;)s.unshift(r);for(r=t;r=r.parentNode;)u.unshift(r);for(;s[o]===u[o];)o++;return o?mt(s[o],u[o]):s[o]===_e?-1:u[o]===_e?1:0},n):se},lt.matches=function(e,t){return lt(e,null,null,t)},lt.matchesSelector=function(e,t){if((e.ownerDocument||e)!==se&&ae(e),t=t.replace(Qe,"='$1']"),G.matchesSelector&&ce&&(!fe||!fe.test(t))&&(!le||!le.test(t)))try{var n=(void 0).call(e,t);if(n||G.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(yC){}return lt(t,se,null,[e]).length>0},lt.contains=function(e,t){return(e.ownerDocument||e)!==se&&ae(e),de(e,t)},lt.attr=function(e,t){(e.ownerDocument||e)!==se&&ae(e);var n=J.attrHandle[t.toLowerCase()],r=n&&Fe.call(J.attrHandle,t.toLowerCase())?n(e,t,!ce):undefined;return r!==undefined?r:G.attributes||!ce?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},lt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},lt.uniqueSort=function(e){var t,n=[],r=0,o=0;if(ie=!G.detectDuplicates,oe=!G.sortStable&&e.slice(0),e.sort(Ie),ie){for(;t=e[o++];)t===e[o]&&(r=n.push(o));for(;r--;)e.splice(n[r],1)}return oe=null,e},Q=lt.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=Q(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=Q(t);return n},(J=lt.selectors={cacheLength:50,createPseudo:dt,match:tt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ut,ct),e[3]=(e[3]||e[4]||e[5]||"").replace(ut,ct),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||lt.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&lt.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return tt.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Ze.test(n)&&(t=ee(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ut,ct).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=De[e+" "];return t||(t=new RegExp("(^|"+$e+")"+e+"("+$e+"|$)"))&&De(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==Le&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var o=lt.attr(r,e);return null==o?"!="===t:!t||(o+="","="===t?o===n:"!="===t?o!==n:"^="===t?n&&0===o.indexOf(n):"*="===t?n&&o.indexOf(n)>-1:"$="===t?n&&o.slice(-n.length)===n:"~="===t?(" "+o+" ").indexOf(n)>-1:"|="===t&&(o===n||o.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,o){var i="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===o?function(e){return!!e.parentNode}:function(t,n,u){var c,l,f,d,m,p,g=i!==a?"nextSibling":"previousSibling",h=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!u&&!s;if(h){if(i){for(;g;){for(f=t;f=f[g];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;p=g="only"===e&&!p&&"nextSibling"}return!0}if(p=[a?h.firstChild:h.lastChild],a&&y){for(m=(c=(l=h[Ae]||(h[Ae]={}))[e]||[])[0]===Be&&c[1],d=c[0]===Be&&c[2],f=m&&h.childNodes[m];f=++m&&f&&f[g]||(d=m=0)||p.pop();)if(1===f.nodeType&&++d&&f===t){l[e]=[Be,m,d];break}}else if(y&&(c=(t[Ae]||(t[Ae]={}))[e])&&c[0]===Be)d=c[1];else for(;(f=++m&&f&&f[g]||(d=m=0)||p.pop())&&((s?f.nodeName.toLowerCase()!==v:1!==f.nodeType)||!++d||(y&&((f[Ae]||(f[Ae]={}))[e]=[Be,d]),f!==t)););return(d-=o)===r||d%r==0&&d/r>=0}}},PSEUDO:function(e,t){var n,r=J.pseudos[e]||J.setFilters[e.toLowerCase()]||lt.error("unsupported pseudo: "+e);return r[Ae]?r(t):r.length>1?(n=[e,e,"",t],J.setFilters.hasOwnProperty(e.toLowerCase())?dt(function(e,n){for(var o,i=r(e,t),a=i.length;a--;)e[o=je.call(e,i[a])]=!(n[o]=i[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:dt(function(e){var t=[],n=[],r=te(e.replace(Ye,"$1"));return r[Ae]?dt(function(e,t,n,o){for(var i,a=r(e,null,o,[]),s=e.length;s--;)(i=a[s])&&(e[s]=!(t[s]=i))}):function(e,o,i){return t[0]=e,r(t,null,i,n),!n.pop()}}),has:dt(function(e){return function(t){return lt(e,t).length>0}}),contains:dt(function(e){return e=e.replace(ut,ct),function(t){return(t.textContent||t.innerText||Q(t)).indexOf(e)>-1}}),lang:dt(function(e){return et.test(e||"")||lt.error("unsupported lang: "+e),e=e.replace(ut,ct).toLowerCase(),function(t){var n;do{if(n=ce?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(e){var t=window.location&&window.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===ue},focus:function(e){return e===se.activeElement&&(!se.hasFocus||se.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!J.pseudos.empty(e)},header:function(e){return rt.test(e.nodeName)},input:function(e){return nt.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[n<0?n+t:n]}),even:ht(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ht(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=J.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})J.pseudos[Y]=pt(Y);for(Y in{submit:!0,reset:!0})J.pseudos[Y]=gt(Y);function yt(){}function bt(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function Ct(e,t,n){var r=t.dir,o=n&&"parentNode"===r,i=Re++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,a){var s,u,c=[Be,i];if(a){for(;t=t[r];)if((1===t.nodeType||o)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||o){if((s=(u=t[Ae]||(t[Ae]={}))[r])&&s[0]===Be&&s[1]===i)return c[2]=s[2];if(u[r]=c,c[2]=e(t,n,a))return!0}}}function xt(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function wt(e,t,n,r,o){for(var i,a=[],s=0,u=e.length,c=null!=t;s<u;s++)(i=e[s])&&(n&&!n(i,r,o)||(a.push(i),c&&t.push(s)));return a}function Nt(e,t,n,r,o,i){return r&&!r[Ae]&&(r=Nt(r)),o&&!o[Ae]&&(o=Nt(o,i)),dt(function(i,a,s,u){var c,l,f,d=[],m=[],p=a.length,g=i||function(e,t,n){for(var r=0,o=t.length;r<o;r++)lt(e,t[r],n);return n}(t||"*",s.nodeType?[s]:s,[]),h=!e||!i&&t?g:wt(g,d,e,s,u),v=n?o||(i?e:p||r)?[]:a:h;if(n&&n(h,v,s,u),r)for(c=wt(v,m),r(c,[],s,u),l=c.length;l--;)(f=c[l])&&(v[m[l]]=!(h[m[l]]=f));if(i){if(o||e){if(o){for(c=[],l=v.length;l--;)(f=v[l])&&c.push(h[l]=f);o(null,v=[],c,u)}for(l=v.length;l--;)(f=v[l])&&(c=o?je.call(i,f):d[l])>-1&&(i[c]=!(a[c]=f))}}else v=wt(v===a?v.splice(p,v.length):v),o?o(null,a,v,u):He.apply(a,v)})}function Et(e){for(var t,n,r,o=e.length,i=J.relative[e[0].type],a=i||J.relative[" "],s=i?1:0,u=Ct(function(e){return e===t},a,!0),c=Ct(function(e){return je.call(t,e)>-1},a,!0),l=[function(e,n,r){return!i&&(r||n!==re)||((t=n).nodeType?u(e,n,r):c(e,n,r))}];s<o;s++)if(n=J.relative[e[s].type])l=[Ct(xt(l),n)];else{if((n=J.filter[e[s].type].apply(null,e[s].matches))[Ae]){for(r=++s;r<o&&!J.relative[e[r].type];r++);return Nt(s>1&&xt(l),s>1&&bt(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(Ye,"$1"),n,s<r&&Et(e.slice(s,r)),r<o&&Et(e=e.slice(r)),r<o&&bt(e))}l.push(n)}return xt(l)}yt.prototype=J.filters=J.pseudos,J.setFilters=new yt,ee=lt.tokenize=function(e,t){var n,r,o,i,a,s,u,c=Oe[e+" "];if(c)return t?0:c.slice(0);for(a=e,s=[],u=J.preFilter;a;){for(i in n&&!(r=Ge.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(o=[])),n=!1,(r=Je.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(Ye," ")}),a=a.slice(n.length)),J.filter)!(r=tt[i].exec(a))||u[i]&&!(r=u[i](r))||(n=r.shift(),o.push({value:n,type:i,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?lt.error(e):Oe(e,s).slice(0)},te=lt.compile=function(e,t){var n,r,o,i,a,s,u=[],c=[],l=Pe[e+" "];if(!l){for(t||(t=ee(e)),n=t.length;n--;)(l=Et(t[n]))[Ae]?u.push(l):c.push(l);(l=Pe(e,(r=c,i=(o=u).length>0,a=r.length>0,s=function(e,t,n,s,u){var c,l,f,d=0,m="0",p=e&&[],g=[],h=re,v=e||a&&J.find.TAG("*",u),y=Be+=null==h?1:Math.random()||.1,b=v.length;for(u&&(re=t!==se&&t);m!==b&&null!=(c=v[m]);m++){if(a&&c){for(l=0;f=r[l++];)if(f(c,t,n)){s.push(c);break}u&&(Be=y)}i&&((c=!f&&c)&&d--,e&&p.push(c))}if(d+=m,i&&m!==d){for(l=0;f=o[l++];)f(p,g,t,n);if(e){if(d>0)for(;m--;)p[m]||g[m]||(g[m]=Ue.call(s));g=wt(g)}He.apply(s,g),u&&!e&&g.length>0&&d+o.length>1&&lt.uniqueSort(s)}return u&&(Be=y,re=h),p},i?dt(s):s))).selector=e}return l},ne=lt.select=function(e,t,n,r){var o,i,a,s,u,c="function"==typeof e&&e,l=!r&&ee(e=c.selector||e);if(n=n||[],1===l.length){if((i=l[0]=l[0].slice(0)).length>2&&"ID"===(a=i[0]).type&&G.getById&&9===t.nodeType&&ce&&J.relative[i[1].type]){if(!(t=(J.find.ID(a.matches[0].replace(ut,ct),t)||[])[0]))return n;c&&(t=t.parentNode),e=e.slice(i.shift().value.length)}for(o=tt.needsContext.test(e)?0:i.length;o--&&(a=i[o],!J.relative[s=a.type]);)if((u=J.find[s])&&(r=u(a.matches[0].replace(ut,ct),at.test(i[0].type)&&vt(t.parentNode)||t))){if(i.splice(o,1),!(e=r.length&&bt(i)))return He.apply(n,r),n;break}}return(c||te(e,l))(r,t,!ce,n,at.test(e)&&vt(t.parentNode)||t),n},G.sortStable=Ae.split("").sort(Ie).join("")===Ae,G.detectDuplicates=!!ie,ae(),G.sortDetached=!0;var St=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},kt=function(e,t,n){var r,o;if(!e)return 0;if(n=n||e,e.length!==undefined){for(r=0,o=e.length;r<o;r++)if(!1===t.call(n,e[r],r,e))return 0}else for(r in e)if(e.hasOwnProperty(r)&&!1===t.call(n,e[r],r,e))return 0;return 1},Tt=function(e,t,n){var r,o;for(r=0,o=e.length;r<o;r++)if(t.call(n,e[r],r,e))return r;return-1},At={isArray:St,toArray:function(e){var t,n,r=e;if(!St(e))for(r=[],t=0,n=e.length;t<n;t++)r[t]=e[t];return r},each:kt,map:function(e,t){var n=[];return kt(e,function(r,o){n.push(t(r,o,e))}),n},filter:function(e,t){var n=[];return kt(e,function(r,o){t&&!t(r,o,e)||n.push(r)}),n},indexOf:function(e,t){var n,r;if(e)for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},reduce:function(e,t,n,r){var o=0;for(arguments.length<3&&(n=e[0]);o<e.length;o++)n=t.call(r,n,e[o],o);return n},findIndex:Tt,find:function(e,t,n){var r=Tt(e,t,n);return-1!==r?e[r]:undefined},last:function(e){return e[e.length-1]}},_t=/^\s*|\s*$/g,Bt=function(e){return null===e||e===undefined?"":(""+e).replace(_t,"")},Rt=function(e,t){return t?!("array"!==t||!At.isArray(e))||typeof e===t:e!==undefined},Dt=function(e,t,n,r){r=r||this,e&&(n&&(e=e[n]),At.each(e,function(e,o){if(!1===t.call(r,e,o,n))return!1;Dt(e,t,n,r)}))},Ot={trim:Bt,isArray:At.isArray,is:Rt,toArray:At.toArray,makeMap:function(e,t,n){var r;for(e=e||[],t=t||",","string"==typeof e&&(e=e.split(t)),n=n||{},r=e.length;r--;)n[e[r]]={};return n},each:At.each,map:At.map,grep:At.filter,inArray:At.indexOf,hasOwn:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},extend:function(e,t){for(var n,r,o,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];var s,u=arguments;for(n=1,r=u.length;n<r;n++)for(o in t=u[n])t.hasOwnProperty(o)&&(s=t[o])!==undefined&&(e[o]=s);return e},create:function(e,t,n){var r,o,i,a,s,u=this,c=0;if(e=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(e),i=e[3].match(/(^|\.)(\w+)$/i)[2],!(o=u.createNS(e[3].replace(/\.\w+$/,""),n))[i]){if("static"===e[2])return o[i]=t,void(this.onCreate&&this.onCreate(e[2],e[3],o[i]));t[i]||(t[i]=function(){},c=1),o[i]=t[i],u.extend(o[i].prototype,t),e[5]&&(r=u.resolve(e[5]).prototype,a=e[5].match(/\.(\w+)$/i)[1],s=o[i],o[i]=c?function(){return r[a].apply(this,arguments)}:function(){return this.parent=r[a],s.apply(this,arguments)},o[i].prototype[i]=o[i],u.each(r,function(e,t){o[i].prototype[t]=r[t]}),u.each(t,function(e,t){r[t]?o[i].prototype[t]=function(){return this.parent=r[t],e.apply(this,arguments)}:t!==i&&(o[i].prototype[t]=e)})),u.each(t["static"],function(e,t){o[i][t]=e})}},walk:Dt,createNS:function(e,t){var n,r;for(t=t||window,e=e.split("."),n=0;n<e.length;n++)t[r=e[n]]||(t[r]={}),t=t[r];return t},resolve:function(e,t){var n,r;for(t=t||window,n=0,r=(e=e.split(".")).length;n<r&&(t=t[e[n]]);n++);return t},explode:function(e,t){return!e||Rt(e,"array")?e:At.map(e.split(t||","),Bt)},_addCacheSuffix:function(e){var t=me.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},Pt=document,It=Array.prototype.push,Lt=Array.prototype.slice,Mt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,Ft=Te.Event,zt=Ot.makeMap("children,contents,next,prev"),Ut=function(e){return void 0!==e},Vt=function(e){return"string"==typeof e},Ht=function(e,t){var n,r,o;for(o=(t=t||Pt).createElement("div"),n=t.createDocumentFragment(),o.innerHTML=e;r=o.firstChild;)n.appendChild(r);return n},qt=function(e,t,n,r){var o;if(Vt(t))t=Ht(t,rn(e[0]));else if(t.length&&!t.nodeType){if(t=Qt.makeArray(t),r)for(o=t.length-1;o>=0;o--)qt(e,t[o],n,r);else for(o=0;o<t.length;o++)qt(e,t[o],n,r);return e}if(t.nodeType)for(o=e.length;o--;)n.call(e[o],t);return e},jt=function(e,t){return e&&t&&-1!==(" "+e.className+" ").indexOf(" "+t+" ")},$t=function(e,t,n){var r,o;return t=Qt(t)[0],e.each(function(){var e=this;n&&r===e.parentNode?o.appendChild(e):(r=e.parentNode,o=t.cloneNode(!1),e.parentNode.insertBefore(o,e),o.appendChild(e))}),e},Wt=Ot.makeMap("fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom"," "),Kt=Ot.makeMap("checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected"," "),Xt={"for":"htmlFor","class":"className",readonly:"readOnly"},Yt={"float":"cssFloat"},Gt={},Jt={},Qt=function(e,t){return new Qt.fn.init(e,t)},Zt=/^\s*|\s*$/g,en=function(e){return null===e||e===undefined?"":(""+e).replace(Zt,"")},tn=function(e,t){var n,r,o,i;if(e)if((n=e.length)===undefined){for(r in e)if(e.hasOwnProperty(r)&&(i=e[r],!1===t.call(i,r,i)))break}else for(o=0;o<n&&(i=e[o],!1!==t.call(i,o,i));o++);return e},nn=function(e,t){var n=[];return tn(e,function(e,r){t(r,e)&&n.push(r)}),n},rn=function(e){return e?9===e.nodeType?e:e.ownerDocument:Pt};Qt.fn=Qt.prototype={constructor:Qt,selector:"",context:null,length:0,init:function(e,t){var n,r,o=this;if(!e)return o;if(e.nodeType)return o.context=o[0]=e,o.length=1,o;if(t&&t.nodeType)o.context=t;else{if(t)return Qt(e).attr(t);o.context=t=document}if(Vt(e)){if(o.selector=e,!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Mt.exec(e)))return Qt(t).find(e);if(n[1])for(r=Ht(e,rn(t)).firstChild;r;)It.call(o,r),r=r.nextSibling;else{if(!(r=rn(t).getElementById(n[2])))return o;if(r.id!==n[2])return o.find(e);o.length=1,o[0]=r}}else this.add(e,!1);return o},toArray:function(){return Ot.toArray(this)},add:function(e,t){var n,r,o=this;if(Vt(e))return o.add(Qt(e));if(!1!==t)for(n=Qt.unique(o.toArray().concat(Qt.makeArray(e))),o.length=n.length,r=0;r<n.length;r++)o[r]=n[r];else It.apply(o,Qt.makeArray(e));return o},attr:function(e,t){var n,r=this;if("object"==typeof e)tn(e,function(e,t){r.attr(e,t)});else{if(!Ut(t)){if(r[0]&&1===r[0].nodeType){if((n=Gt[e])&&n.get)return n.get(r[0],e);if(Kt[e])return r.prop(e)?e:undefined;null===(t=r[0].getAttribute(e,2))&&(t=undefined)}return t}this.each(function(){var n;if(1===this.nodeType){if((n=Gt[e])&&n.set)return void n.set(this,t);null===t?this.removeAttribute(e,2):this.setAttribute(e,t,2)}})}return r},removeAttr:function(e){return this.attr(e,null)},prop:function(e,t){var n=this;if("object"==typeof(e=Xt[e]||e))tn(e,function(e,t){n.prop(e,t)});else{if(!Ut(t))return n[0]&&n[0].nodeType&&e in n[0]?n[0][e]:t;this.each(function(){1===this.nodeType&&(this[e]=t)})}return n},css:function(e,t){var n,r,o=this,i=function(e){return e.replace(/-(\D)/g,function(e,t){return t.toUpperCase()})},a=function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e})};if("object"==typeof e)tn(e,function(e,t){o.css(e,t)});else if(Ut(t))e=i(e),"number"!=typeof t||Wt[e]||(t=t.toString()+"px"),o.each(function(){var n=this.style;if((r=Jt[e])&&r.set)r.set(this,t);else{try{this.style[Yt[e]||e]=t}catch(o){}null!==t&&""!==t||(n.removeProperty?n.removeProperty(a(e)):n.removeAttribute(e))}});else{if(n=o[0],(r=Jt[e])&&r.get)return r.get(n);if(n.ownerDocument.defaultView)try{return n.ownerDocument.defaultView.getComputedStyle(n,null).getPropertyValue(a(e))}catch(s){return undefined}else if(n.currentStyle)return n.currentStyle[i(e)]}return o},remove:function(){for(var e,t=this.length;t--;)e=this[t],Ft.clean(e),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var e,t=this.length;t--;)for(e=this[t];e.firstChild;)e.removeChild(e.firstChild);return this},html:function(e){var t,n=this;if(Ut(e)){t=n.length;try{for(;t--;)n[t].innerHTML=e}catch(r){Qt(n[t]).empty().append(e)}return n}return n[0]?n[0].innerHTML:""},text:function(e){var t,n=this;if(Ut(e)){for(t=n.length;t--;)"innerText"in n[t]?n[t].innerText=e:n[0].textContent=e;return n}return n[0]?n[0].innerText||n[0].textContent:""},append:function(){return qt(this,arguments,function(e){(1===this.nodeType||this.host&&1===this.host.nodeType)&&this.appendChild(e)})},prepend:function(){return qt(this,arguments,function(e){(1===this.nodeType||this.host&&1===this.host.nodeType)&&this.insertBefore(e,this.firstChild)},!0)},before:function(){return this[0]&&this[0].parentNode?qt(this,arguments,function(e){this.parentNode.insertBefore(e,this)}):this},after:function(){return this[0]&&this[0].parentNode?qt(this,arguments,function(e){this.parentNode.insertBefore(e,this.nextSibling)},!0):this},appendTo:function(e){return Qt(e).append(this),this},prependTo:function(e){return Qt(e).prepend(this),this},replaceWith:function(e){return this.before(e).remove()},wrap:function(e){return $t(this,e)},wrapAll:function(e){return $t(this,e,!0)},wrapInner:function(e){return this.each(function(){Qt(this).contents().wrapAll(e)}),this},unwrap:function(){return this.parent().each(function(){Qt(this).replaceWith(this.childNodes)})},clone:function(){var e=[];return this.each(function(){e.push(this.cloneNode(!0))}),Qt(e)},addClass:function(e){return this.toggleClass(e,!0)},removeClass:function(e){return this.toggleClass(e,!1)},toggleClass:function(e,t){var n=this;return"string"!=typeof e?n:(-1!==e.indexOf(" ")?tn(e.split(" "),function(){n.toggleClass(this,t)}):n.each(function(n,r){var o,i;(i=jt(r,e))!==t&&(o=r.className,i?r.className=en((" "+o+" ").replace(" "+e+" "," ")):r.className+=o?" "+e:e)}),n)},hasClass:function(e){return jt(this[0],e)},each:function(e){return tn(this,e)},on:function(e,t){return this.each(function(){Ft.bind(this,e,t)})},off:function(e,t){return this.each(function(){Ft.unbind(this,e,t)})},trigger:function(e){return this.each(function(){"object"==typeof e?Ft.fire(this,e.type,e):Ft.fire(this,e)})},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},slice:function(){return new Qt(Lt.apply(this,arguments))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},find:function(e){var t,n,r=[];for(t=0,n=this.length;t<n;t++)Qt.find(e,this[t],r);return Qt(r)},filter:function(e){return Qt("function"==typeof e?nn(this.toArray(),function(t,n){return e(n,t)}):Qt.filter(e,this.toArray()))},closest:function(e){var t=[];return e instanceof Qt&&(e=e[0]),this.each(function(n,r){for(;r;){if("string"==typeof e&&Qt(r).is(e)){t.push(r);break}if(r===e){t.push(r);break}r=r.parentNode}}),Qt(t)},offset:function(e){var t,n,r,o,i=0,a=0;return e?this.css(e):((t=this[0])&&(r=(n=t.ownerDocument).documentElement,t.getBoundingClientRect&&(i=(o=t.getBoundingClientRect()).left+(r.scrollLeft||n.body.scrollLeft)-r.clientLeft,a=o.top+(r.scrollTop||n.body.scrollTop)-r.clientTop)),{left:i,top:a})},push:It,sort:[].sort,splice:[].splice},Ot.extend(Qt,{extend:Ot.extend,makeArray:function(e){return(t=e)&&t===t.window||e.nodeType?[e]:Ot.toArray(e);var t},inArray:function(e,t){var n;if(t.indexOf)return t.indexOf(e);for(n=t.length;n--;)if(t[n]===e)return n;return-1},isArray:Ot.isArray,each:tn,trim:en,grep:nn,find:lt,expr:lt.selectors,unique:lt.uniqueSort,text:lt.getText,contains:lt.contains,filter:function(e,t,n){var r=t.length;for(n&&(e=":not("+e+")");r--;)1!==t[r].nodeType&&t.splice(r,1);return t=1===t.length?Qt.find.matchesSelector(t[0],e)?[t[0]]:[]:Qt.find.matches(e,t)}});var on=function(e,t,n){var r=[],o=e[t];for("string"!=typeof n&&n instanceof Qt&&(n=n[0]);o&&9!==o.nodeType;){if(n!==undefined){if(o===n)break;if("string"==typeof n&&Qt(o).is(n))break}1===o.nodeType&&r.push(o),o=o[t]}return r},an=function(e,t,n,r){var o=[];for(r instanceof Qt&&(r=r[0]);e;e=e[t])if(!n||e.nodeType===n){if(r!==undefined){if(e===r)break;if("string"==typeof r&&Qt(e).is(r))break}o.push(e)}return o},sn=function(e,t,n){for(e=e[t];e;e=e[t])if(e.nodeType===n)return e;return null};tn({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return on(e,"parentNode")},next:function(e){return sn(e,"nextSibling",1)},prev:function(e){return sn(e,"previousSibling",1)},children:function(e){return an(e.firstChild,"nextSibling",1)},contents:function(e){return Ot.toArray(("iframe"===e.nodeName?e.contentDocument||e.contentWindow.document:e).childNodes)}},function(e,t){Qt.fn[e]=function(n){var r=[];return this.each(function(){var e=t.call(r,this,n,r);e&&(Qt.isArray(e)?r.push.apply(r,e):r.push(e))}),this.length>1&&(zt[e]||(r=Qt.unique(r)),0===e.indexOf("parents")&&(r=r.reverse())),r=Qt(r),n?r.filter(n):r}}),tn({parentsUntil:function(e,t){return on(e,"parentNode",t)},nextUntil:function(e,t){return an(e,"nextSibling",1,t).slice(1)},prevUntil:function(e,t){return an(e,"previousSibling",1,t).slice(1)}},function(e,t){Qt.fn[e]=function(n,r){var o=[];return this.each(function(){var e=t.call(o,this,n,o);e&&(Qt.isArray(e)?o.push.apply(o,e):o.push(e))}),this.length>1&&(o=Qt.unique(o),0!==e.indexOf("parents")&&"prevUntil"!==e||(o=o.reverse())),o=Qt(o),r?o.filter(r):o}}),Qt.fn.is=function(e){return!!e&&this.filter(e).length>0},Qt.fn.init.prototype=Qt.fn,Qt.overrideDefaults=function(e){var t,n=function(r,o){return t=t||e(),0===arguments.length&&(r=t.element),o||(o=t.context),new n.fn.init(r,o)};return Qt.extend(n,this),n};var un=function(e,t,n){tn(n,function(n,r){e[n]=e[n]||{},e[n][t]=r})};me.ie&&me.ie<8&&(un(Gt,"get",{maxlength:function(e){var t=e.maxLength;return 2147483647===t?undefined:t},size:function(e){var t=e.size;return 20===t?undefined:t},"class":function(e){return e.className},style:function(e){var t=e.style.cssText;return 0===t.length?undefined:t}}),un(Gt,"set",{"class":function(e,t){e.className=t},style:function(e,t){e.style.cssText=t}})),me.ie&&me.ie<9&&(Yt["float"]="styleFloat",un(Jt,"set",{opacity:function(e,t){var n=e.style;null===t||""===t?n.removeAttribute("filter"):(n.zoom=1,n.filter="alpha(opacity="+100*t+")")}})),Qt.attrHooks=Gt,Qt.cssHooks=Jt;var cn,ln,fn,dn,mn=function(e){var t,n=!1;return function(){return n||(n=!0,t=e.apply(null,arguments)),t}},pn=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.test(t))return r}return undefined}(e,t);if(!n)return{major:0,minor:0};var r=function(e){return Number(t.replace(n,"$"+e))};return hn(r(1),r(2))},gn=function(){return hn(0,0)},hn=function(e,t){return{major:e,minor:t}},vn={nu:hn,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?gn():pn(e,n)},unknown:gn},yn="Firefox",bn=function(e,t){return function(){return t===e}},Cn=function(e){var t=e.current;return{current:t,version:e.version,isEdge:bn("Edge",t),isChrome:bn("Chrome",t),isIE:bn("IE",t),isOpera:bn("Opera",t),isFirefox:bn(yn,t),isSafari:bn("Safari",t)}},xn={unknown:function(){return Cn({current:undefined,version:vn.unknown()})},nu:Cn,edge:y.constant("Edge"),chrome:y.constant("Chrome"),ie:y.constant("IE"),opera:y.constant("Opera"),firefox:y.constant(yn),safari:y.constant("Safari")},wn="Windows",Nn="Android",En="Solaris",Sn="FreeBSD",kn=function(e,t){return function(){return t===e}},Tn=function(e){var t=e.current;return{current:t,version:e.version,isWindows:kn(wn,t),isiOS:kn("iOS",t),isAndroid:kn(Nn,t),isOSX:kn("OSX",t),isLinux:kn("Linux",t),isSolaris:kn(En,t),isFreeBSD:kn(Sn,t)}},An={unknown:function(){return Tn({current:undefined,version:vn.unknown()})},nu:Tn,windows:y.constant(wn),ios:y.constant("iOS"),android:y.constant(Nn),linux:y.constant("Linux"),osx:y.constant("OSX"),solaris:y.constant(En),freebsd:y.constant(Sn)},_n=function(e,t){var n=String(t).toLowerCase();return M.find(e,function(e){return e.search(n)})},Bn=function(e,t){return _n(e,t).map(function(e){var n=vn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Rn=function(e,t){return _n(e,t).map(function(e){var n=vn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Dn=function(e,t){return-1!==e.indexOf(t)},On=function(e){return e.replace(/^\s+|\s+$/g,"")},Pn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,In=function(e){return function(t){return Dn(t,e)}},Ln=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Dn(e,"edge/")&&Dn(e,"chrome")&&Dn(e,"safari")&&Dn(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Pn],search:function(e){return Dn(e,"chrome")&&!Dn(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Dn(e,"msie")||Dn(e,"trident")}},{name:"Opera",versionRegexes:[Pn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:In("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:In("firefox")},{name:"Safari",versionRegexes:[Pn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Dn(e,"safari")||Dn(e,"mobile/"))&&Dn(e,"applewebkit")}}],Mn=[{name:"Windows",search:In("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Dn(e,"iphone")||Dn(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:In("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:In("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:In("linux"),versionRegexes:[]},{name:"Solaris",search:In("sunos"),versionRegexes:[]},{name:"FreeBSD",search:In("freebsd"),versionRegexes:[]}],Fn={browsers:y.constant(Ln),oses:y.constant(Mn)},zn=function(e){var t,n,r,o,i,a,s,u,c,l,f,d=Fn.browsers(),m=Fn.oses(),p=Bn(d,e).fold(xn.unknown,xn.nu),g=Rn(m,e).fold(An.unknown,An.nu);return{browser:p,os:g,deviceType:(n=p,r=e,o=(t=g).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,a=t.isAndroid()&&3===t.version.major,s=t.isAndroid()&&4===t.version.major,u=o||a||s&&!0===/mobile/i.test(r),c=t.isiOS()||t.isAndroid(),l=c&&!u,f=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:y.constant(o),isiPhone:y.constant(i),isTablet:y.constant(u),isPhone:y.constant(l),isTouch:y.constant(c),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:y.constant(f)})}},Un={detect:mn(function(){var e=navigator.userAgent;return zn(e)})},Vn=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:y.constant(e)}},Hn={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1)throw console.error("HTML does not have a single root node",e),"HTML must have a single root node";return Vn(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return Vn(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return Vn(n)},fromDom:Vn,fromPoint:function(e,t,n){return E.from(e.dom().elementFromPoint(t,n)).map(Vn)}},qn=8,jn=9,$n=1,Wn=3,Kn=function(e){return e.dom().nodeName.toLowerCase()},Xn=function(e){return e.dom().nodeType},Yn=function(e){return function(t){return Xn(t)===e}},Gn=Yn($n),Jn=Yn(Wn),Qn=Yn(jn),Zn={name:Kn,type:Xn,value:function(e){return e.dom().nodeValue},isElement:Gn,isText:Jn,isDocument:Qn,isComment:function(e){return Xn(e)===qn||"#comment"===Kn(e)}},er=function(e){return function(t){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(t)===e}},tr={isString:er("string"),isObject:er("object"),isArray:er("array"),isNull:er("null"),isBoolean:er("boolean"),isUndefined:er("undefined"),isFunction:er("function"),isNumber:er("number")},nr=(cn=Object.keys)===undefined?function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}:cn,rr=function(e,t){for(var n=nr(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},or=function(e,t){var n={};return rr(e,function(r,o){var i=t(r,o,e);n[i.k]=i.v}),n},ir=function(e,t){var n=[];return rr(e,function(e,r){n.push(t(e,r))}),n},ar=function(e){return ir(e,function(e){return e})},sr={bifilter:function(e,t){var n={},r={};return rr(e,function(e,o){(t(e,o)?n:r)[o]=e}),{t:n,f:r}},each:rr,map:function(e,t){return or(e,function(e,n,r){return{k:n,v:t(e,n,r)}})},mapToArray:ir,tupleMap:or,find:function(e,t){for(var n=nr(e),r=0,o=n.length;r<o;r++){var i=n[r],a=e[i];if(t(a,i,e))return E.some(a)}return E.none()},keys:nr,values:ar,size:function(e){return ar(e).length}},ur=function(e,t,n){if(!(tr.isString(n)||tr.isBoolean(n)||tr.isNumber(n)))throw console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},cr=function(e,t,n){ur(e.dom(),t,n)},lr=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},fr=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},dr={clone:function(e){return M.foldl(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},set:cr,setAll:function(e,t){var n=e.dom();sr.each(t,function(e,t){ur(n,t,e)})},get:lr,has:fr,remove:function(e,t){e.dom().removeAttribute(t)},hasNone:function(e){var t=e.dom().attributes;return t===undefined||null===t||0===t.length},transfer:function(e,t,n){Zn.isElement(e)&&Zn.isElement(t)&&M.each(n,function(n){var r,o,i;o=t,fr(r=e,i=n)&&!fr(o,i)&&cr(o,i,lr(r,i))})}},mr=mn(function(){return pr(Hn.fromDom(document))}),pr=function(e){var t=e.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return Hn.fromDom(t)},gr={body:mr,getBody:pr,inBody:function(e){var t=Zn.isText(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}},hr=function(e){return e.style!==undefined},vr=function(e,t,n){if(!tr.isString(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);hr(e)&&e.style.setProperty(t,n)},yr=function(e,t){return hr(e)?e.style.getPropertyValue(t):""},br=function(e,t){var n=e.dom();sr.each(t,function(e,t){vr(n,t,e)})},Cr=function(e,t){var n=e.dom(),r=window.getComputedStyle(n).getPropertyValue(t),o=""!==r||gr.inBody(e)?r:yr(n,t);return null===o?undefined:o},xr=function(){var e=arguments;return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(e.length!==t.length)throw new Error('Wrong number of arguments to struct. Expected "['+e.length+']", got '+t.length+" arguments");var r={};return M.each(e,function(e,n){r[e]=y.constant(t[n])}),r}},wr=function(e,t){var n=[],r=function(e){return n.push(e),t(e)},o=t(e);do{o=o.bind(r)}while(o.isSome());return n},Nr=function(){return V("Node")},Er=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},Sr=function(e,t){return Er(e,t,Nr().DOCUMENT_POSITION_CONTAINED_BY)},kr=$n,Tr=jn,Ar=function(e){return e.nodeType!==kr&&e.nodeType!==Tr||0===e.childElementCount},_r={all:function(e,t){var n=t===undefined?document:t.dom();return Ar(n)?[]:M.map(n.querySelectorAll(e),Hn.fromDom)},is:function(e,t){var n=e.dom();if(n.nodeType!==kr)return!1;if(n.matches!==undefined)return n.matches(t);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(t);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(t);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},one:function(e,t){var n=t===undefined?document:t.dom();return Ar(n)?E.none():E.from(n.querySelector(e)).map(Hn.fromDom)}},Br=function(e,t){return e.dom()===t.dom()},Rr=Un.detect().browser.isIE()?function(e,t){return Sr(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},Dr={eq:Br,isEqualNode:function(e,t){return e.dom().isEqualNode(t.dom())},member:function(e,t){return M.exists(t,y.curry(Br,e))},contains:Rr,is:_r.is},Or=function(e){return Hn.fromDom(e.dom().ownerDocument)},Pr=function(e){var t=e.dom();return E.from(t.parentNode).map(Hn.fromDom)},Ir=function(e){var t=e.dom();return E.from(t.previousSibling).map(Hn.fromDom)},Lr=function(e){var t=e.dom();return E.from(t.nextSibling).map(Hn.fromDom)},Mr=function(e){var t=e.dom();return M.map(t.childNodes,Hn.fromDom)},Fr=function(e,t){var n=e.dom().childNodes;return E.from(n[t]).map(Hn.fromDom)},zr=xr("element","offset"),Ur={owner:Or,defaultView:function(e){var t=e.dom().ownerDocument.defaultView;return Hn.fromDom(t)},documentElement:function(e){var t=Or(e);return Hn.fromDom(t.dom().documentElement)},parent:Pr,findIndex:function(e){return Pr(e).bind(function(t){var n=Mr(t);return M.findIndex(n,function(t){return Dr.eq(e,t)})})},parents:function(e,t){for(var n=tr.isFunction(t)?t:y.constant(!1),r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,a=Hn.fromDom(i);if(o.push(a),!0===n(a))break;r=i}return o},siblings:function(e){return Pr(e).map(Mr).map(function(t){return M.filter(t,function(t){return!Dr.eq(e,t)})}).getOr([])},prevSibling:Ir,offsetParent:function(e){var t=e.dom();return E.from(t.offsetParent).map(Hn.fromDom)},prevSiblings:function(e){return M.reverse(wr(e,Ir))},nextSibling:Lr,nextSiblings:function(e){return wr(e,Lr)},children:Mr,child:Fr,firstChild:function(e){return Fr(e,0)},lastChild:function(e){return Fr(e,e.dom().childNodes.length-1)},childNodesCount:function(e){return e.dom().childNodes.length},hasChildNodes:function(e){return e.dom().hasChildNodes()},leaf:function(e,t){var n=Mr(e);return n.length>0&&t<n.length?zr(n[t],0):zr(e,t)}},Vr=Un.detect().browser,Hr=function(e){return M.find(e,Zn.isElement)},qr=function(e,t,n){var r,o,i,a=0,s=0,u=e.ownerDocument;if(n=n||e,t){if(n===e&&t.getBoundingClientRect&&"static"===Cr(Hn.fromDom(e),"position"))return{x:a=(o=t.getBoundingClientRect()).left+(u.documentElement.scrollLeft||e.scrollLeft)-u.documentElement.clientLeft,y:s=o.top+(u.documentElement.scrollTop||e.scrollTop)-u.documentElement.clientTop};for(r=t;r&&r!==n&&r.nodeType;)a+=r.offsetLeft||0,s+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!==n&&r.nodeType;)a-=r.scrollLeft||0,s-=r.scrollTop||0,r=r.parentNode;s+=(i=Hn.fromDom(t),Vr.isFirefox()&&"table"===Zn.name(i)?Hr(Ur.children(i)).filter(function(e){return"caption"===Zn.name(e)}).bind(function(e){return Hr(Ur.nextSiblings(e)).map(function(t){var n=t.dom().offsetTop,r=e.dom().offsetTop,o=e.dom().offsetHeight;return n<=r?-o:0})}).getOr(0):0)}return{x:a,y:s}},jr=function(e){var t=E.none(),n=[],r=function(e){o()?a(e):n.push(e)},o=function(){return t.isSome()},i=function(e){M.each(e,a)},a=function(e){t.each(function(t){setTimeout(function(){e(t)},0)})};return e(function(e){t=E.some(e),i(n),n=[]}),{get:r,map:function(e){return jr(function(t){r(function(n){t(e(n))})})},isReady:o}},$r={nu:jr,pure:function(e){return jr(function(t){t(e)})}},Wr=function(e){return function(){var t=Array.prototype.slice.call(arguments),n=this;setTimeout(function(){e.apply(n,t)},0)}},Kr=function(e){var t=function(t){e(Wr(t))};return{map:function(e){return Kr(function(n){t(function(t){var r=e(t);n(r)})})},bind:function(e){return Kr(function(n){t(function(t){e(t).get(n)})})},anonBind:function(e){return Kr(function(n){t(function(t){e.get(n)})})},toLazy:function(){return $r.nu(t)},get:t}},Xr={nu:Kr,pure:function(e){return Kr(function(t){t(e)})}},Yr=function(e,t){return t(function(t){var n=[],r=0;0===e.length?t([]):M.each(e,function(o,i){var a;o.get((a=i,function(o){n[a]=o,++r>=e.length&&t(n)}))})})},Gr=function(e){return Yr(e,Xr.nu)},Jr=Gr,Qr=function(e){return{is:function(t){return e===t},isValue:y.constant(!0),isError:y.constant(!1),getOr:y.constant(e),getOrThunk:y.constant(e),getOrDie:y.constant(e),or:function(t){return Qr(e)},orThunk:function(t){return Qr(e)},fold:function(t,n){return n(e)},map:function(t){return Qr(t(e))},each:function(t){t(e)},bind:function(t){return t(e)},exists:function(t){return t(e)},forall:function(t){return t(e)},toOption:function(){return E.some(e)}}},Zr=function(e){return{is:y.constant(!1),isValue:y.constant(!1),isError:y.constant(!0),getOr:y.identity,getOrThunk:function(e){return e()},getOrDie:function(){return y.die(e)()},or:function(e){return e},orThunk:function(e){return e()},fold:function(t,n){return t(e)},map:function(t){return Zr(e)},each:y.noop,bind:function(t){return Zr(e)},exists:y.constant(!1),forall:y.constant(!0),toOption:E.none}},eo={value:Qr,error:Zr},to=function(e,t){var n=e,r=function(e,n,r,o){var i,a;if(e){if(!o&&e[n])return e[n];if(e!==t){if(i=e[r])return i;for(a=e.parentNode;a&&a!==t;a=a.parentNode)if(i=a[r])return i}}};this.current=function(){return n},this.next=function(e){return n=r(n,"firstChild","nextSibling",e)},this.prev=function(e){return n=r(n,"lastChild","previousSibling",e)},this.prev2=function(e){return n=function(e,n,r,o){var i,a,s;if(e){if(i=e[r],t&&i===t)return;if(i){if(!o)for(s=i[n];s;s=s[n])if(!s[n])return s;return i}if((a=e.parentNode)&&a!==t)return a}}(n,"lastChild","previousSibling",e)}},no=function(e){var t;return function(n){return(t=t||M.mapToObject(e,y.constant(!0))).hasOwnProperty(Zn.name(n))}},ro=no(["h1","h2","h3","h4","h5","h6"]),oo=no(["article","aside","details","div","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","p","dl","multicol","dd","figure","address","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"]),io={isBlock:oo,isInline:function(e){return Zn.isElement(e)&&!oo(e)},isHeading:ro,isTextBlock:no(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),isList:no(["ul","ol","dl"]),isListItem:no(["li","dd","dt"]),isVoid:no(["area","base","basefont","br","col","frame","hr","img","input","isindex","link","meta","param","embed","source","wbr","track"]),isTableSection:no(["thead","tbody","tfoot"]),isTableCell:no(["td","th"]),isBr:function(e){return Zn.isElement(e)&&"br"===Zn.name(e)}},ao=function(e){return function(t){return!!t&&t.nodeType===e}},so=ao(1),uo=function(e){var t=e.toLowerCase().split(" ");return function(e){var n,r;if(e&&e.nodeType)for(r=e.nodeName.toLowerCase(),n=0;n<t.length;n++)if(r===t[n])return!0;return!1}},co=function(e){return function(t){if(so(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1}},lo=ao(3),fo=ao(8),mo=ao(9),po=uo("br"),go=co("true"),ho=co("false"),vo={isText:lo,isElement:so,isComment:fo,isDocument:mo,isBr:po,isContentEditableTrue:go,isContentEditableFalse:ho,matchNodeNames:uo,hasPropValue:function(e,t){return function(n){return so(n)&&n[e]===t}},hasAttribute:function(e,t){return function(t){return so(t)&&t.hasAttribute(e)}},hasAttributeValue:function(e,t){return function(n){return so(n)&&n.getAttribute(e)===t}},matchStyleValues:function(e,t){var n=t.toLowerCase().split(" ");return function(t){var r;if(so(t))for(r=0;r<n.length;r++)if(t.ownerDocument.defaultView.getComputedStyle(t,null).getPropertyValue(e)===n[r])return!0;return!1}},isBogus:function(e){return so(e)&&e.hasAttribute("data-mce-bogus")}},yo=function(e){return e&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type")},bo=function(e,t){var n,r=t.childNodes;if(!vo.isElement(t)||!yo(t)){for(n=r.length-1;n>=0;n--)bo(e,r[n]);if(!1===vo.isDocument(t)){if(vo.isText(t)&&t.nodeValue.length>0){var o=Ot.trim(t.nodeValue).length;if(e.isBlock(t.parentNode)||o>0)return;if(0===o&&(a=(i=t).previousSibling&&"SPAN"===i.previousSibling.nodeName,s=i.nextSibling&&"SPAN"===i.nextSibling.nodeName,a&&s))return}else if(vo.isElement(t)&&(1===(r=t.childNodes).length&&yo(r[0])&&t.parentNode.insertBefore(r[0],t),r.length||io.isVoid(Hn.fromDom(t))))return;e.remove(t)}var i,a,s;return t}},Co={trimNode:bo},xo=Ot.makeMap,wo=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,No=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Eo=/[<>&\"\']/g,So=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,ko={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"};fn={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;","`":"&#96;"},dn={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"};var To=function(e,t){var n,r,o,i={};if(e){for(e=e.split(","),t=t||10,n=0;n<e.length;n+=2)r=String.fromCharCode(parseInt(e[n],t)),fn[r]||(o="&"+e[n+1]+";",i[r]=o,i[o]=r);return i}};ln=To("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);var Ao={encodeRaw:function(e,t){return e.replace(t?wo:No,function(e){return fn[e]||e})},encodeAllRaw:function(e){return(""+e).replace(Eo,function(e){return fn[e]||e})},encodeNumeric:function(e,t){return e.replace(t?wo:No,function(e){return e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":fn[e]||"&#"+e.charCodeAt(0)+";"})},encodeNamed:function(e,t,n){return n=n||ln,e.replace(t?wo:No,function(e){return fn[e]||n[e]||e})},getEncodeFunc:function(e,t){return t=To(t)||ln,(e=xo(e.replace(/\+/g,","))).named&&e.numeric?function(e,n){return e.replace(n?wo:No,function(e){return fn[e]!==undefined?fn[e]:t[e]!==undefined?t[e]:e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";"})}:e.named?t?function(e,n){return Ao.encodeNamed(e,n,t)}:Ao.encodeNamed:e.numeric?Ao.encodeNumeric:Ao.encodeRaw},decode:function(e){return e.replace(So,function(e,t){return t?(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):ko[t]||String.fromCharCode(t):dn[e]||ln[e]||(n=e,(r=Hn.fromTag("div").dom()).innerHTML=n,r.textContent||r.innerText||n);var n,r})}},_o={},Bo={},Ro=Ot.makeMap,Do=Ot.each,Oo=Ot.extend,Po=Ot.explode,Io=Ot.inArray,Lo=function(e,t){return(e=Ot.trim(e))?e.split(t||" "):[]},Mo=function(e,t){var n;return e&&(n={},"string"==typeof e&&(e={"*":e}),Do(e,function(e,r){n[r]=n[r.toUpperCase()]="map"===t?Ro(e,/[, ]/):Po(e,/[, ]/)})),n},Fo=function(e){var t,n,r,o,i,a,s,u,c,l,f,d,m,p,g,h,v,y,b,C,x,w,N,E={},S={},k={},T=[],A={},_={},B=function(t,n,r){var o=e[t];return o?o=Ro(o,/[, ]/,Ro(o.toUpperCase(),/[, ]/)):(o=_o[t])||(o=Ro(n," ",Ro(n.toUpperCase()," ")),o=Oo(o,r),_o[t]=o),o};p=(e=e||{}).schema,x={},w=function(e,t,n){var r,o,i,a=function(e,t){var n,r,o={};for(n=0,r=e.length;n<r;n++)o[e[n]]=t||{};return o};for(n=n||[],t=t||"","string"==typeof n&&(n=Lo(n)),r=(e=Lo(e)).length;r--;)i={attributes:a(o=Lo([g,t].join(" "))),attributesOrder:o,children:a(n,Bo)},x[e[r]]=i},N=function(e,t){var n,r,o,i;for(n=(e=Lo(e)).length,t=Lo(t);n--;)for(r=x[e[n]],o=0,i=t.length;o<i;o++)r.attributes[t[o]]={},r.attributesOrder.push(t[o])},r=_o[p]?_o[p]:(g="id accesskey class dir lang style tabindex title role",h="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",v="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==p&&(g+=" contenteditable contextmenu draggable dropzone hidden spellcheck translate",h+=" article aside details dialog figure header footer hgroup section nav",v+=" audio canvas command datalist mark meter output picture progress time wbr video ruby bdi keygen"),"html5-strict"!==p&&(g+=" xml:lang",v=[v,C="acronym applet basefont big font strike tt"].join(" "),Do(Lo(C),function(e){w(e,"",v)}),h=[h,b="center dir isindex noframes"].join(" "),y=[h,v].join(" "),Do(Lo(b),function(e){w(e,"",y)})),y=y||[h,v].join(" "),w("html","manifest","head body"),w("head","","base command link meta noscript script style title"),w("title hr noscript br"),w("base","href target"),w("link","href rel media hreflang type sizes hreflang"),w("meta","name http-equiv content charset"),w("style","media type scoped"),w("script","src async defer type charset"),w("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",y),w("address dt dd div caption","",y),w("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",v),w("blockquote","cite",y),w("ol","reversed start type","li"),w("ul","","li"),w("li","value",y),w("dl","","dt dd"),w("a","href target rel media hreflang type",v),w("q","cite",v),w("ins del","cite datetime",y),w("img","src sizes srcset alt usemap ismap width height"),w("iframe","src name width height",y),w("embed","src type width height"),w("object","data type typemustmatch name usemap form width height",[y,"param"].join(" ")),w("param","name value"),w("map","name",[y,"area"].join(" ")),w("area","alt coords shape href target rel media hreflang type"),w("table","border","caption colgroup thead tfoot tbody tr"+("html4"===p?" col":"")),w("colgroup","span","col"),w("col","span"),w("tbody thead tfoot","","tr"),w("tr","","td th"),w("td","colspan rowspan headers",y),w("th","colspan rowspan headers scope abbr",y),w("form","accept-charset action autocomplete enctype method name novalidate target",y),w("fieldset","disabled form name",[y,"legend"].join(" ")),w("label","form for",v),w("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),w("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===p?y:v),w("select","disabled form multiple name required size","option optgroup"),w("optgroup","disabled label","option"),w("option","disabled label selected value"),w("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),w("menu","type label",[y,"li"].join(" ")),w("noscript","",y),"html4"!==p&&(w("wbr"),w("ruby","",[v,"rt rp"].join(" ")),w("figcaption","",y),w("mark rt rp summary bdi","",v),w("canvas","width height",y),w("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[y,"track source"].join(" ")),w("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[y,"track source"].join(" ")),w("picture","","img source"),w("source","src srcset type media sizes"),w("track","kind src srclang label default"),w("datalist","",[v,"option"].join(" ")),w("article section nav aside header footer","",y),w("hgroup","","h1 h2 h3 h4 h5 h6"),w("figure","",[y,"figcaption"].join(" ")),w("time","datetime",v),w("dialog","open",y),w("command","type label icon disabled checked radiogroup command"),w("output","for form name",v),w("progress","value max",v),w("meter","value min max low high optimum",v),w("details","open",[y,"summary"].join(" ")),w("keygen","autofocus challenge disabled form keytype name")),"html5-strict"!==p&&(N("script","language xml:space"),N("style","xml:space"),N("object","declare classid code codebase codetype archive standby align border hspace vspace"),N("embed","align name hspace vspace"),N("param","valuetype type"),N("a","charset name rev shape coords"),N("br","clear"),N("applet","codebase archive code object alt name width height align hspace vspace"),N("img","name longdesc align border hspace vspace"),N("iframe","longdesc frameborder marginwidth marginheight scrolling align"),N("font basefont","size color face"),N("input","usemap align"),N("select","onchange"),N("textarea"),N("h1 h2 h3 h4 h5 h6 div p legend caption","align"),N("ul","type compact"),N("li","type"),N("ol dl menu dir","compact"),N("pre","width xml:space"),N("hr","align noshade size width"),N("isindex","prompt"),N("table","summary width frame rules cellspacing cellpadding align bgcolor"),N("col","width align char charoff valign"),N("colgroup","width align char charoff valign"),N("thead","align char charoff valign"),N("tr","align char charoff valign bgcolor"),N("th","axis align char charoff valign nowrap bgcolor width height"),N("form","accept"),N("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),N("tfoot","align char charoff valign"),N("tbody","align char charoff valign"),N("area","nohref"),N("body","background bgcolor text link vlink alink")),"html4"!==p&&(N("input button select textarea","autofocus"),N("input textarea","placeholder"),N("a","download"),N("link script img","crossorigin"),N("iframe","sandbox seamless allowfullscreen")),Do(Lo("a form meter progress dfn"),function(e){x[e]&&delete x[e].children[e]}),delete x.caption.children.table,delete x.script,_o[p]=x,x),!1===e.verify_html&&(e.valid_elements="*[*]"),t=Mo(e.valid_styles),n=Mo(e.invalid_styles,"map"),u=Mo(e.valid_classes,"map"),o=B("whitespace_elements","pre script noscript style textarea video audio iframe object code"),i=B("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),a=B("short_ended_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),s=B("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls"),l=B("non_empty_elements","td th iframe video audio object script pre code",a),f=B("move_caret_before_on_enter_elements","table",l),d=B("text_block_elements","h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside nav figure"),c=B("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption",d),m=B("text_inline_elements","span strong b em i font strike u var cite dfn code mark q sup sub samp"),Do((e.special||"script noscript noframes noembed title style textarea xmp").split(" "),function(e){_[e]=new RegExp("</"+e+"[^>]*>","gi")});var R=function(e){return new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$")},D=function(e){var t,n,r,o,i,a,s,u,c,l,f,d,m,p,g,h,v,y,b,C=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/,x=/^([!\-])?(\w+[\\:]:\w+|[^=:<]+)?(?:([=:<])(.*))?$/,w=/[*?+]/;if(e)for(e=Lo(e,","),S["@"]&&(h=S["@"].attributes,v=S["@"].attributesOrder),t=0,n=e.length;t<n;t++)if(i=C.exec(e[t])){if(p=i[1],c=i[2],g=i[3],u=i[5],a={attributes:d={},attributesOrder:m=[]},"#"===p&&(a.paddEmpty=!0),"-"===p&&(a.removeEmpty=!0),"!"===i[4]&&(a.removeEmptyAttrs=!0),h){for(y in h)d[y]=h[y];m.push.apply(m,v)}if(u)for(r=0,o=(u=Lo(u,"|")).length;r<o;r++)if(i=x.exec(u[r])){if(s={},f=i[1],l=i[2].replace(/[\\:]:/g,":"),p=i[3],b=i[4],"!"===f&&(a.attributesRequired=a.attributesRequired||[],a.attributesRequired.push(l),s.required=!0),"-"===f){delete d[l],m.splice(Io(m,l),1);continue}p&&("="===p&&(a.attributesDefault=a.attributesDefault||[],a.attributesDefault.push({name:l,value:b}),s.defaultValue=b),":"===p&&(a.attributesForced=a.attributesForced||[],a.attributesForced.push({name:l,value:b}),s.forcedValue=b),"<"===p&&(s.validValues=Ro(b,"?"))),w.test(l)?(a.attributePatterns=a.attributePatterns||[],s.pattern=R(l),a.attributePatterns.push(s)):(d[l]||m.push(l),d[l]=s)}h||"@"!==c||(h=d,v=m),g&&(a.outputName=c,S[g]=a),w.test(c)?(a.pattern=R(c),T.push(a)):S[c]=a}},O=function(e){S={},T=[],D(e),Do(r,function(e,t){k[t]=e.children})},P=function(e){var t=/^(~)?(.+)$/;e&&(_o.text_block_elements=_o.block_elements=null,Do(Lo(e,","),function(e){var n=t.exec(e),r="~"===n[1],o=r?"span":"div",i=n[2];if(k[i]=k[o],A[i]=o,r||(c[i.toUpperCase()]={},c[i]={}),!S[i]){var a=S[o];delete(a=Oo({},a)).removeEmptyAttrs,delete a.removeEmpty,S[i]=a}Do(k,function(e,t){e[o]&&(k[t]=e=Oo({},k[t]),e[i]=e[o])})}))},I=function(t){var n=/^([+\-]?)(\w+)\[([^\]]+)\]$/;_o[e.schema]=null,t&&Do(Lo(t,","),function(e){var t,r,o=n.exec(e);o&&(r=o[1],t=r?k[o[2]]:k[o[2]]={"#comment":{}},t=k[o[2]],Do(Lo(o[3],"|"),function(e){"-"===r?delete t[e]:t[e]={}}))})},L=function(e){var t,n=S[e];if(n)return n;for(t=T.length;t--;)if((n=T[t]).pattern.test(e))return n};return e.valid_elements?O(e.valid_elements):(Do(r,function(e,t){S[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},k[t]=e.children}),"html5"!==e.schema&&Do(Lo("strong/b em/i"),function(e){e=Lo(e,"/"),S[e[1]].outputName=e[0]}),Do(Lo("ol ul sub sup blockquote span font a table tbody tr strong em b i"),function(e){S[e]&&(S[e].removeEmpty=!0)}),Do(Lo("p h1 h2 h3 h4 h5 h6 th td pre div address caption li"),function(e){S[e].paddEmpty=!0}),Do(Lo("span"),function(e){S[e].removeEmptyAttrs=!0})),P(e.custom_elements),I(e.valid_children),D(e.extended_valid_elements),I("+ol[ul|ol],+ul[ul|ol]"),Do({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},function(e,t){S[t]&&(S[t].parentsRequired=Lo(e))}),e.invalid_elements&&Do(Po(e.invalid_elements),function(e){S[e]&&delete S[e]}),L("span")||D("span[!data-mce-type|*]"),E.children=k,E.getValidStyles=function(){return t},E.getInvalidStyles=function(){return n},E.getValidClasses=function(){return u},E.getBoolAttrs=function(){return s},E.getBlockElements=function(){return c},E.getTextBlockElements=function(){return d},E.getTextInlineElements=function(){return m},E.getShortEndedElements=function(){return a},E.getSelfClosingElements=function(){return i},E.getNonEmptyElements=function(){return l},E.getMoveCaretBeforeOnEnterElements=function(){return f},E.getWhiteSpaceElements=function(){return o},E.getSpecialElements=function(){return _},E.isValidChild=function(e,t){var n=k[e.toLowerCase()];return!(!n||!n[t.toLowerCase()])},E.isValid=function(e,t){var n,r,o=L(e);if(o){if(!t)return!0;if(o.attributes[t])return!0;if(n=o.attributePatterns)for(r=n.length;r--;)if(n[r].pattern.test(e))return!0}return!1},E.getElementRule=L,E.getCustomElements=function(){return A},E.addValidElements=D,E.setValidElements=O,E.addCustomElements=P,E.addValidChildren=I,E.elements=S,E},zo=function(e,t){var n,r,o,i,a=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,s=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,u=/\s*([^:]+):\s*([^;]+);?/g,c=/\s+$/,l={},f="\ufeff";for(e=e||{},t&&(o=t.getValidStyles(),i=t.getInvalidStyles()),r=("\\\" \\' \\; \\: ; : "+f).split(" "),n=0;n<r.length;n++)l[r[n]]=f+n,l[f+n]=r[n];var d=function(e,t,n,r){var o=function(e){return(e=parseInt(e,10).toString(16)).length>1?e:"0"+e};return"#"+o(t)+o(n)+o(r)};return{toHex:function(e){return e.replace(a,d)},parse:function(t){var r,o,i,m,p,g,h,v,y={},b=e.url_converter,C=e.url_converter_scope||this,x=function(e,t,r){var o,i,a,s;if((o=y[e+"-top"+t])&&(i=y[e+"-right"+t])&&(a=y[e+"-bottom"+t])&&(s=y[e+"-left"+t])){var u=[o,i,a,s];for(n=u.length-1;n--&&u[n]===u[n+1];);n>-1&&r||(y[e+t]=-1===n?u[0]:u.join(" "),delete y[e+"-top"+t],delete y[e+"-right"+t],delete y[e+"-bottom"+t],delete y[e+"-left"+t])}},w=function(e){var t,n=y[e];if(n){for(t=(n=n.split(" ")).length;t--;)if(n[t]!==n[0])return!1;return y[e]=n[0],!0}},N=function(e){return m=!0,l[e]},E=function(e,t){return m&&(e=e.replace(/\uFEFF[0-9]/g,function(e){return l[e]})),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e},S=function(e){return String.fromCharCode(parseInt(e.slice(1),16))},k=function(e){return e.replace(/\\[0-9a-f]+/gi,S)},T=function(t,n,r,o,i,a){if(i=i||a)return"'"+(i=E(i)).replace(/\'/g,"\\'")+"'";if(n=E(n||r||o),!e.allow_script_urls){var s=n.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(s))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(s))return""}return b&&(n=b.call(C,n,"style")),"url('"+n.replace(/\'/g,"\\'")+"')"};if(t){for(t=(t=t.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,N).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(e){return e.replace(/[;:]/g,N)});r=u.exec(t);)if(u.lastIndex=r.index+r[0].length,o=r[1].replace(c,"").toLowerCase(),i=r[2].replace(c,""),o&&i){if(o=k(o),i=k(i),-1!==o.indexOf(f)||-1!==o.indexOf('"'))continue;if(!e.allow_script_urls&&("behavior"===o||/expression\s*\(|\/\*|\*\//.test(i)))continue;"font-weight"===o&&"700"===i?i="bold":"color"!==o&&"background-color"!==o||(i=i.toLowerCase()),i=(i=i.replace(a,d)).replace(s,T),y[o]=m?E(i,!0):i}x("border","",!0),x("border","-width"),x("border","-color"),x("border","-style"),x("padding",""),x("margin",""),p="border",h="border-style",v="border-color",w(g="border-width")&&w(h)&&w(v)&&(y[p]=y[g]+" "+y[h]+" "+y[v],delete y[g],delete y[h],delete y[v]),"medium none"===y.border&&delete y.border,"none"===y["border-image"]&&delete y["border-image"]}return y},serialize:function(e,t){var n,r,a,s,u,c="",l=function(t){var n,r,i,a;if(n=o[t])for(r=0,i=n.length;r<i;r++)t=n[r],(a=e[t])&&(c+=(c.length>0?" ":"")+t+": "+a+";")};if(t&&o)l("*"),l(t);else for(n in e)!(r=e[n])||i&&(a=n,s=t,u=void 0,(u=i["*"])&&u[a]||(u=i[s])&&u[a])||(c+=(c.length>0?" ":"")+n+": "+r+";");return c}}},Uo=Ot.each,Vo=Ot.is,Ho=Ot.grep,qo=me.ie,jo=/^([a-z0-9],?)+$/i,$o=/^[ \t\r\n]*$/,Wo=function(e,t){var n=t.attr("style");(n=e.serializeStyle(e.parseStyle(n),t[0].nodeName))||(n=null),t.attr("data-mce-style",n)},Ko=function(e,t){var n,r,o=0;if(e)for(n=e.nodeType,e=e.previousSibling;e;e=e.previousSibling)r=e.nodeType,(!t||3!==r||r!==n&&e.nodeValue.length)&&(o++,n=r);return o},Xo=function(e,t){var n,r,o,i,a,s,u=this;u.doc=e,u.win=window,u.files={},u.counter=0,u.stdMode=!qo||e.documentMode>=8,u.boxModel=!qo||"CSS1Compat"===e.compatMode||u.stdMode,u.styleSheetLoader=function(e,t){var n,r=0,o={};n=(t=t||{}).maxLoadTime||5e3;var i=function(t){e.getElementsByTagName("head")[0].appendChild(t)},a=function(t,a,s){var u,c,l,f,d=function(){for(var e=f.passed,t=e.length;t--;)e[t]();f.status=2,f.passed=[],f.failed=[]},m=function(){for(var e=f.failed,t=e.length;t--;)e[t]();f.status=3,f.passed=[],f.failed=[]},p=function(e,t){e()||((new Date).getTime()-l<n?ye.setTimeout(t):m())},g=function(){p(function(){for(var t,n,r=e.styleSheets,o=r.length;o--;)if((n=(t=r[o]).ownerNode?t.ownerNode:t.owningElement)&&n.id===u.id)return d(),!0},g)},h=function(){p(function(){try{var e=c.sheet.cssRules;return d(),!!e}catch(t){}},h)};if(t=Ot._addCacheSuffix(t),o[t]?f=o[t]:(f={passed:[],failed:[]},o[t]=f),a&&f.passed.push(a),s&&f.failed.push(s),1!==f.status)if(2!==f.status)if(3!==f.status){if(f.status=1,(u=e.createElement("link")).rel="stylesheet",u.type="text/css",u.id="u"+r++,u.async=!1,u.defer=!1,l=(new Date).getTime(),"onload"in u&&!((v=navigator.userAgent.match(/WebKit\/(\d*)/))&&parseInt(v[1],10)<536))u.onload=g,u.onerror=m;else{if(navigator.userAgent.indexOf("Firefox")>0)return(c=e.createElement("style")).textContent='@import "'+t+'"',h(),void i(c);g()}var v;i(u),u.href=t}else m();else d()},s=function(e){return Xr.nu(function(t){a(e,y.compose(t,y.constant(eo.value(e))),y.compose(t,y.constant(eo.error(e))))})},u=function(e){return e.fold(y.identity,y.identity)};return{load:a,loadAll:function(e,t,n){Jr(M.map(e,s)).get(function(e){var r=M.partition(e,function(e){return e.isValue()});r.fail.length>0?n(r.fail.map(u)):t(r.pass.map(u))})}}}(e),u.boundEvents=[],u.settings=t=t||{},u.schema=t.schema?t.schema:Fo({}),u.styles=zo({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),u.fixDoc(e),u.events=t.ownEvents?new Te(t.proxy):Te.Event,u.attrHooks=(r=u,a={},s=(o=t).keep_values,i={set:function(e,t,n){o.url_converter&&(t=o.url_converter.call(o.url_converter_scope||r,t,n,e[0])),e.attr("data-mce-"+n,t).attr(n,t)},get:function(e,t){return e.attr("data-mce-"+t)||e.attr(t)}},a={style:{set:function(e,t){null===t||"object"!=typeof t?(s&&e.attr("data-mce-style",t),e.attr("style",t)):e.css(t)},get:function(e){var t=e.attr("data-mce-style")||e.attr("style");return t=r.serializeStyle(r.parseStyle(t),e[0].nodeName)}}},s&&(a.href=a.src=i),a),n=u.schema.getBlockElements(),u.$=Qt.overrideDefaults(function(){return{context:e,element:u.getRoot()}}),u.isBlock=function(e){if(!e)return!1;var t=e.nodeType;return t?!(1!==t||!n[e.nodeName]):!!n[e]}};Xo.prototype={$$:function(e){return"string"==typeof e&&(e=this.get(e)),this.$(e)},root:null,fixDoc:function(e){},clone:function(e,t){var n,r,o=this;return!qo||1!==e.nodeType||t?e.cloneNode(t):(r=o.doc,t?n.firstChild:(n=r.createElement(e.nodeName),Uo(o.getAttribs(e),function(t){o.setAttrib(n,t.nodeName,o.getAttrib(e,t.nodeName))}),n))},getRoot:function(){return this.settings.root_element||this.doc.body},getViewPort:function(e){var t,n;return t=(e=e||this.win).document,n=this.boxModel?t.documentElement:t.body,{x:e.pageXOffset||n.scrollLeft,y:e.pageYOffset||n.scrollTop,w:e.innerWidth||n.clientWidth,h:e.innerHeight||n.clientHeight}},getRect:function(e){var t,n;return e=this.get(e),t=this.getPos(e),n=this.getSize(e),{x:t.x,y:t.y,w:n.w,h:n.h}},getSize:function(e){var t,n;return e=this.get(e),t=this.getStyle(e,"width"),n=this.getStyle(e,"height"),-1===t.indexOf("px")&&(t=0),-1===n.indexOf("px")&&(n=0),{w:parseInt(t,10)||e.offsetWidth||e.clientWidth,h:parseInt(n,10)||e.offsetHeight||e.clientHeight}},getParent:function(e,t,n){return this.getParents(e,t,n,!1)},getParents:function(e,t,n,r){var o,i=this,a=[];for(e=i.get(e),r=r===undefined,n=n||("BODY"!==i.getRoot().nodeName?i.getRoot().parentNode:null),Vo(t,"string")&&(o=t,t="*"===t?function(e){return 1===e.nodeType}:function(e){return i.is(e,o)});e&&e!==n&&e.nodeType&&9!==e.nodeType;){if(!t||t(e)){if(!r)return e;a.push(e)}e=e.parentNode}return r?a:null},get:function(e){var t;return e&&this.doc&&"string"==typeof e&&(t=e,(e=this.doc.getElementById(e))&&e.id!==t)?this.doc.getElementsByName(t)[1]:e},getNext:function(e,t){return this._findSib(e,t,"nextSibling")},getPrev:function(e,t){return this._findSib(e,t,"previousSibling")},select:function(e,t){return lt(e,this.get(t)||this.settings.root_element||this.doc,[])},is:function(e,t){var n;if(!e)return!1;if(e.length===undefined){if("*"===t)return 1===e.nodeType;if(jo.test(t)){for(t=t.toLowerCase().split(/,/),e=e.nodeName.toLowerCase(),n=t.length-1;n>=0;n--)if(t[n]===e)return!0;return!1}}if(e.nodeType&&1!==e.nodeType)return!1;var r=e.nodeType?[e]:e;return lt(t,r[0].ownerDocument||r[0],null,r).length>0},add:function(e,t,n,r,o){var i=this;return this.run(e,function(e){var a;return a=Vo(t,"string")?i.doc.createElement(t):t,i.setAttribs(a,n),r&&(r.nodeType?a.appendChild(r):i.setHTML(a,r)),o?a:e.appendChild(a)})},create:function(e,t,n){return this.add(this.doc.createElement(e),e,t,n,1)},createHTML:function(e,t,n){var r,o="";for(r in o+="<"+e,t)t.hasOwnProperty(r)&&null!==t[r]&&"undefined"!=typeof t[r]&&(o+=" "+r+'="'+this.encode(t[r])+'"');return void 0!==n?o+">"+n+"</"+e+">":o+" />"},createFragment:function(e){var t,n,r,o=this.doc;for(r=o.createElement("div"),t=o.createDocumentFragment(),e&&(r.innerHTML=e);n=r.firstChild;)t.appendChild(n);return t},remove:function(e,t){return e=this.$$(e),t?e.each(function(){for(var e;e=this.firstChild;)3===e.nodeType&&0===e.data.length?this.removeChild(e):this.parentNode.insertBefore(e,this)}).remove():e.remove(),e.length>1?e.toArray():e[0]},setStyle:function(e,t,n){e=this.$$(e).css(t,n),this.settings.update_styles&&Wo(this,e)},getStyle:function(e,t,n){return e=this.$$(e),n?e.css(t):("float"===(t=t.replace(/-(\D)/g,function(e,t){return t.toUpperCase()}))&&(t=me.ie&&me.ie<12?"styleFloat":"cssFloat"),e[0]&&e[0].style?e[0].style[t]:undefined)},setStyles:function(e,t){e=this.$$(e).css(t),this.settings.update_styles&&Wo(this,e)},removeAllAttribs:function(e){return this.run(e,function(e){var t,n=e.attributes;for(t=n.length-1;t>=0;t--)e.removeAttributeNode(n.item(t))})},setAttrib:function(e,t,n){var r,o,i=this.settings;""===n&&(n=null),r=(e=this.$$(e)).attr(t),e.length&&((o=this.attrHooks[t])&&o.set?o.set(e,n,t):e.attr(t,n),r!==n&&i.onSetAttrib&&i.onSetAttrib({attrElm:e,attrName:t,attrValue:n}))},setAttribs:function(e,t){var n=this;n.$$(e).each(function(e,r){Uo(t,function(e,t){n.setAttrib(r,t,e)})})},getAttrib:function(e,t,n){var r,o;return(e=this.$$(e)).length&&(o=(r=this.attrHooks[t])&&r.get?r.get(e,t):e.attr(t)),void 0===o&&(o=n||""),o},getPos:function(e,t){return qr(this.doc.body,this.get(e),t)},parseStyle:function(e){return this.styles.parse(e)},serializeStyle:function(e,t){return this.styles.serialize(e,t)},addStyle:function(e){var t,n,r=this.doc;if(this!==Xo.DOM&&r===document){var o=Xo.DOM.addedStyles;if((o=o||[])[e])return;o[e]=!0,Xo.DOM.addedStyles=o}(n=r.getElementById("mceDefaultStyles"))||((n=r.createElement("style")).id="mceDefaultStyles",n.type="text/css",(t=r.getElementsByTagName("head")[0]).firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(r.createTextNode(e))},loadCSS:function(e){var t,n=this,r=n.doc;n===Xo.DOM||r!==document?(e||(e=""),t=r.getElementsByTagName("head")[0],Uo(e.split(","),function(e){var o;e=Ot._addCacheSuffix(e),n.files[e]||(n.files[e]=!0,o=n.create("link",{rel:"stylesheet",href:e}),qo&&r.documentMode&&r.recalc&&(o.onload=function(){r.recalc&&r.recalc(),o.onload=null}),t.appendChild(o))})):Xo.DOM.loadCSS(e)},addClass:function(e,t){this.$$(e).addClass(t)},removeClass:function(e,t){this.toggleClass(e,t,!1)},hasClass:function(e,t){return this.$$(e).hasClass(t)},toggleClass:function(e,t,n){this.$$(e).toggleClass(t,n).each(function(){""===this.className&&Qt(this).attr("class",null)})},show:function(e){this.$$(e).show()},hide:function(e){this.$$(e).hide()},isHidden:function(e){return"none"===this.$$(e).css("display")},uniqueId:function(e){return(e||"mce_")+this.counter++},setHTML:function(e,t){e=this.$$(e),qo?e.each(function(e,n){if(!1!==n.canHaveHTML){for(;n.firstChild;)n.removeChild(n.firstChild);try{n.innerHTML="<br>"+t,n.removeChild(n.firstChild)}catch(r){Qt("<div></div>").html("<br>"+t).contents().slice(1).appendTo(n)}return t}}):e.html(t)},getOuterHTML:function(e){return 1===(e=this.get(e)).nodeType&&"outerHTML"in e?e.outerHTML:Qt("<div></div>").append(Qt(e).clone()).html()},setOuterHTML:function(e,t){var n=this;n.$$(e).each(function(){try{if("outerHTML"in this)return void(this.outerHTML=t)}catch(e){}n.remove(Qt(this).html(t),!0)})},decode:Ao.decode,encode:Ao.encodeAllRaw,insertAfter:function(e,t){return t=this.get(t),this.run(e,function(e){var n,r;return n=t.parentNode,(r=t.nextSibling)?n.insertBefore(e,r):n.appendChild(e),e})},replace:function(e,t,n){return this.run(t,function(t){return Vo(t,"array")&&(e=e.cloneNode(!0)),n&&Uo(Ho(t.childNodes),function(t){e.appendChild(t)}),t.parentNode.replaceChild(e,t)})},rename:function(e,t){var n,r=this;return e.nodeName!==t.toUpperCase()&&(n=r.create(t),Uo(r.getAttribs(e),function(t){r.setAttrib(n,t.nodeName,r.getAttrib(e,t.nodeName))}),r.replace(n,e,1)),n||e},findCommonAncestor:function(e,t){for(var n,r=e;r;){for(n=t;n&&r!==n;)n=n.parentNode;if(r===n)break;r=r.parentNode}return!r&&e.ownerDocument?e.ownerDocument.documentElement:r},toHex:function(e){return this.styles.toHex(Ot.trim(e))},run:function(e,t,n){var r,o=this;return"string"==typeof e&&(e=o.get(e)),!!e&&(n=n||this,e.nodeType||!e.length&&0!==e.length?t.call(n,e):(r=[],Uo(e,function(e,i){e&&("string"==typeof e&&(e=o.get(e)),r.push(t.call(n,e,i)))}),r))},getAttribs:function(e){var t;return(e=this.get(e))?qo?(t=[],"OBJECT"===e.nodeName?e.attributes:("OPTION"===e.nodeName&&this.getAttrib(e,"selected")&&t.push({specified:1,nodeName:"selected"}),e.cloneNode(!1).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(e){t.push({specified:1,nodeName:e})}),t)):e.attributes:[]},isEmpty:function(e,t){var n,r,o,i,a,s,u=0;if(e=e.firstChild){a=new to(e,e.parentNode),t=t||(this.schema?this.schema.getNonEmptyElements():null),i=this.schema?this.schema.getWhiteSpaceElements():{};do{if(1===(o=e.nodeType)){var c=e.getAttribute("data-mce-bogus");if(c){e=a.next("all"===c);continue}if(s=e.nodeName.toLowerCase(),t&&t[s]){if("br"===s){u++,e=a.next();continue}return!1}for(n=(r=this.getAttribs(e)).length;n--;)if("name"===(s=r[n].nodeName)||"data-mce-bookmark"===s)return!1}if(8===o)return!1;if(3===o&&!$o.test(e.nodeValue))return!1;if(3===o&&e.parentNode&&i[e.parentNode.nodeName]&&$o.test(e.nodeValue))return!1;e=a.next()}while(e)}return u<=1},createRng:function(){return this.doc.createRange()},nodeIndex:Ko,split:function(e,t,n){var r,o,i,a=this.createRng();if(e&&t)return a.setStart(e.parentNode,this.nodeIndex(e)),a.setEnd(t.parentNode,this.nodeIndex(t)),r=a.extractContents(),(a=this.createRng()).setStart(t.parentNode,this.nodeIndex(t)+1),a.setEnd(e.parentNode,this.nodeIndex(e)+1),o=a.extractContents(),(i=e.parentNode).insertBefore(Co.trimNode(this,r),e),n?i.insertBefore(n,e):i.insertBefore(t,e),i.insertBefore(Co.trimNode(this,o),e),this.remove(e),n||t},bind:function(e,t,n,r){if(Ot.isArray(e)){for(var o=e.length;o--;)e[o]=this.bind(e[o],t,n,r);return e}return!this.settings.collect||e!==this.doc&&e!==this.win||this.boundEvents.push([e,t,n,r]),this.events.bind(e,t,n,r||this)},unbind:function(e,t,n){var r;if(Ot.isArray(e)){for(r=e.length;r--;)e[r]=this.unbind(e[r],t,n);return e}if(this.boundEvents&&(e===this.doc||e===this.win))for(r=this.boundEvents.length;r--;){var o=this.boundEvents[r];e!==o[0]||t&&t!==o[1]||n&&n!==o[2]||this.events.unbind(o[0],o[1],o[2])}return this.events.unbind(e,t,n)},fire:function(e,t,n){return this.events.fire(e,t,n)},getContentEditable:function(e){var t;return e&&1===e.nodeType?(t=e.getAttribute("data-mce-contenteditable"))&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null:null},getContentEditableParent:function(e){for(var t=this.getRoot(),n=null;e&&e!==t&&null===(n=this.getContentEditable(e));e=e.parentNode);return n},destroy:function(){if(this.boundEvents){for(var e=this.boundEvents.length;e--;){var t=this.boundEvents[e];this.events.unbind(t[0],t[1],t[2])}this.boundEvents=null}lt.setDocument&&lt.setDocument(),this.win=this.doc=this.root=this.events=this.frag=null},isChildOf:function(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1},dumpRng:function(e){return"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},_findSib:function(e,t,n){var r=this,o=t;if(e)for("string"==typeof o&&(o=function(e){return r.is(e,t)}),e=e[n];e;e=e[n])if(o(e))return e;return null}},Xo.DOM=new Xo(document),Xo.nodeIndex=Ko;var Yo=Xo.DOM,Go=Ot.each,Jo=Ot.grep,Qo=function(e){return"function"==typeof e},Zo=function(){var e={},t=[],n={},r=[],o=0;this.isDone=function(t){return 2===e[t]},this.markDone=function(t){e[t]=2},this.add=this.load=function(r,o,i,a){e[r]===undefined&&(t.push(r),e[r]=0),o&&(n[r]||(n[r]=[]),n[r].push({success:o,failure:a,scope:i||this}))},this.remove=function(t){delete e[t],delete n[t]},this.loadQueue=function(e,n,r){this.loadScripts(t,e,n,r)},this.loadScripts=function(t,i,a,s){var u,c=[],l=function(e,t){Go(n[t],function(t){Qo(t[e])&&t[e].call(t.scope)}),n[t]=undefined};r.push({success:i,failure:s,scope:a||this}),(u=function(){var n=Jo(t);if(t.length=0,Go(n,function(t){var n,r,i,a,s,f,d;2!==e[t]?3!==e[t]?1!==e[t]&&(e[t]=1,o++,n=t,r=function(){e[t]=2,o--,l("success",t),u()},i=function(){e[t]=3,o--,c.push(t),l("failure",t),u()},d=function(){f.remove(s),a&&(a.onreadystatechange=a.onload=a=null),r()},s=(f=Yo).uniqueId(),(a=document.createElement("script")).id=s,a.type="text/javascript",a.src=Ot._addCacheSuffix(n),"onreadystatechange"in a?a.onreadystatechange=function(){/loaded|complete/.test(a.readyState)&&d()}:a.onload=d,a.onerror=function(){Qo(i)?i():"undefined"!=typeof console&&console.log&&console.log("Failed to load script: "+n)},(document.getElementsByTagName("head")[0]||document.body).appendChild(a)):l("failure",t):l("success",t)}),!o){var i=r.slice(0);r.length=0,Go(i,function(e){0===c.length?Qo(e.success)&&e.success.call(e.scope):Qo(e.failure)&&e.failure.call(e.scope,c)})}})()}};Zo.ScriptLoader=new Zo;var ei=Ot.each,ti=function(){this.items=[],this.urls={},this.lookup={},this._listeners=[]};ti.prototype={get:function(e){return this.lookup[e]?this.lookup[e].instance:undefined},dependencies:function(e){var t;return this.lookup[e]&&(t=this.lookup[e].dependencies),t||[]},requireLangPack:function(e,t){var n=ti.language;if(n&&!1!==ti.languageLoad){if(t)if(-1!==(t=","+t+",").indexOf(","+n.substr(0,2)+","))n=n.substr(0,2);else if(-1===t.indexOf(","+n+","))return;Zo.ScriptLoader.add(this.urls[e]+"/langs/"+n+".js")}},add:function(e,t,n){this.items.push(t),this.lookup[e]={instance:t,dependencies:n};var r=M.partition(this._listeners,function(t){return t.name===e});return this._listeners=r.fail,ei(r.pass,function(e){e.callback()}),t},remove:function(e){delete this.urls[e],delete this.lookup[e]},createUrl:function(e,t){return"object"==typeof t?t:{prefix:e.prefix,resource:t,suffix:e.suffix}},addComponents:function(e,t){var n=this.urls[e];ei(t,function(e){Zo.ScriptLoader.add(n+"/"+e)})},load:function(e,t,n,r,o){var i=this,a=t,s=function(){var o=i.dependencies(e);ei(o,function(e){var n=i.createUrl(t,e);i.load(n.resource,n,undefined,undefined)}),n&&(r?n.call(r):n.call(Zo))};i.urls[e]||("object"==typeof t&&(a=t.prefix+t.resource+t.suffix),0!==a.indexOf("/")&&-1===a.indexOf("://")&&(a=ti.baseURL+"/"+a),i.urls[e]=a.substring(0,a.lastIndexOf("/")),i.lookup[e]?s():Zo.ScriptLoader.add(a,s,r,o))},waitFor:function(e,t){this.lookup.hasOwnProperty(e)?t():this._listeners.push({name:e,callback:t})}},ti.PluginManager=new ti,ti.ThemeManager=new ti;var ni="\ufeff",ri=function(e){return e===ni},oi=ni,ii=function(e){return e.replace(new RegExp(ni,"g"),"")},ai=vo.isElement,si=vo.isText,ui=function(e){return si(e)&&(e=e.parentNode),ai(e)&&e.hasAttribute("data-mce-caret")},ci=function(e){return si(e)&&ri(e.data)},li=function(e){return ui(e)||ci(e)},fi=function(e){return si(e)&&e.data[0]===oi},di=function(e){return si(e)&&e.data[e.data.length-1]===oi},mi={isCaretContainer:li,isCaretContainerBlock:ui,isCaretContainerInline:ci,showCaretContainerBlock:function(e){return e&&e.hasAttribute("data-mce-caret")?(t=e.getElementsByTagName("br"),n=t[t.length-1],vo.isBogus(n)&&n.parentNode.removeChild(n),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("_moz_abspos"),e):null;var t,n},insertInline:function(e,t){var n,r,o;if(r=e.ownerDocument.createTextNode(oi),o=e.parentNode,t){if(n=e.previousSibling,si(n)){if(li(n))return n;if(di(n))return n.splitText(n.data.length-1)}o.insertBefore(r,e)}else{if(n=e.nextSibling,si(n)){if(li(n))return n;if(fi(n))return n.splitText(1),n}e.nextSibling?o.insertBefore(r,e.nextSibling):o.appendChild(r)}return r},prependInline:function(e){if(vo.isText(e)){var t=e.data;return t.length>0&&t.charAt(0)!==oi&&e.insertData(0,oi),e}return null},appendInline:function(e){if(vo.isText(e)){var t=e.data;return t.length>0&&t.charAt(t.length-1)!==oi&&e.insertData(t.length,oi),e}return null},isBeforeInline:function(e){return e&&vo.isText(e.container())&&e.container().data.charAt(e.offset())===oi},isAfterInline:function(e){return e&&vo.isText(e.container())&&e.container().data.charAt(e.offset()-1)===oi},insertBlock:function(e,t,n){var r,o,i;return(r=t.ownerDocument.createElement(e)).setAttribute("data-mce-caret",n?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(((i=document.createElement("br")).setAttribute("data-mce-bogus","1"),i)),o=t.parentNode,n?o.insertBefore(r,t):t.nextSibling?o.insertBefore(r,t.nextSibling):o.appendChild(r),r},hasContent:function(e){return e.firstChild!==e.lastChild||!vo.isBr(e.firstChild)},startsWithCaretContainer:fi,endsWithCaretContainer:di},pi=vo.isContentEditableTrue,gi=vo.isContentEditableFalse,hi=vo.isBr,vi=vo.isText,yi=vo.matchNodeNames("script style textarea"),bi=vo.matchNodeNames("img input textarea hr iframe video audio object"),Ci=vo.matchNodeNames("table"),xi=mi.isCaretContainer,wi=function(e){return!xi(e)&&(vi(e)?!yi(e.parentNode):bi(e)||hi(e)||Ci(e)||gi(e))},Ni=function(e,t){for(e=e.parentNode;e&&e!==t;e=e.parentNode){if(gi(e))return!1;if(pi(e))return!0}return!0},Ei=wi,Si=function(e){return bi(e)||!!gi(t=e)&&!0!==At.reduce(t.getElementsByTagName("*"),function(e,t){return e||pi(t)},!1);var t},ki=function(e,t){return wi(e)&&Ni(e,t)},Ti=Math.round,Ai=function(e){return e?{left:Ti(e.left),top:Ti(e.top),bottom:Ti(e.bottom),right:Ti(e.right),width:Ti(e.width),height:Ti(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0}},_i=function(e,t,n){return e>=0&&e<=Math.min(t.height,n.height)/2},Bi=function(e,t){return e.bottom-e.height/2<t.top||!(e.top>t.bottom)&&_i(t.top-e.bottom,e,t)},Ri=function(e,t){return e.top>t.bottom||!(e.bottom<t.top)&&_i(t.bottom-e.top,e,t)},Di=Ai,Oi=function(e,t){return e=Ai(e),t?e.right=e.left:(e.left=e.left+e.width,e.right=e.left),e.width=0,e},Pi=function(e,t){return e.left===t.left&&e.top===t.top&&e.bottom===t.bottom&&e.right===t.right},Ii=Bi,Li=Ri,Mi=function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom},Fi=function(e){var t=e.startContainer,n=e.startOffset;return t.hasChildNodes()&&e.endOffset===n+1?t.childNodes[n]:null},zi=function(e,t){return 1===e.nodeType&&e.hasChildNodes()&&(t>=e.childNodes.length&&(t=e.childNodes.length-1),e=e.childNodes[t]),e},Ui=new RegExp("[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1abe\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20dd-\u20e0\u20e1\u20e2-\u20e4\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\ua670-\ua672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]"),Vi=function(e){return"string"==typeof e&&e.charCodeAt(0)>=768&&Ui.test(e)},Hi=[].slice,qi=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Hi.call(arguments);return r.length-1>=e.length?e.apply(this,r.slice(1)):function(){var e=r.concat([].slice.call(arguments));return qi.apply(this,e)}},ji={constant:function(e){return function(){return e}},negate:function(e){return function(t){return!e(t)}},and:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Hi.call(arguments);return function(e){for(var t=0;t<n.length;t++)if(!n[t](e))return!1;return!0}},or:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Hi.call(arguments);return function(e){for(var t=0;t<n.length;t++)if(n[t](e))return!0;return!1}},curry:qi,compose:function(e,t){return function(n){return e(t(n))}},noop:function(){}},$i=vo.isElement,Wi=Ei,Ki=vo.matchStyleValues("display","block table"),Xi=vo.matchStyleValues("float","left right"),Yi=ji.and($i,Wi,ji.negate(Xi)),Gi=ji.negate(vo.matchStyleValues("white-space","pre pre-line pre-wrap")),Ji=vo.isText,Qi=vo.isBr,Zi=Xo.nodeIndex,ea=zi,ta=function(e){return"createRange"in e?e.createRange():Xo.DOM.createRng()},na=function(e){return e&&/[\r\n\t ]/.test(e)},ra=function(e){var t,n=e.startContainer,r=e.startOffset;return!!(na(e.toString())&&Gi(n.parentNode)&&(t=n.data,na(t[r-1])||na(t[r+1])))},oa=function(e){var t,n,r=[],o=function(e){var t,n,r,o,i,a,s,u;return t=(n=e.getClientRects()).length>0?Di(n[0]):Di(e.getBoundingClientRect()),Qi(e)&&0===t.left?(i=(r=e).ownerDocument,a=ta(i),s=i.createTextNode("\xa0"),(u=r.parentNode).insertBefore(s,r),a.setStart(s,0),a.setEnd(s,1),o=Di(a.getBoundingClientRect()),u.removeChild(s),o):t},i=function(e,t){return(e=Oi(e,t)).width=1,e.right=e.left+1,e},a=function(e){0!==e.height&&(r.length>0&&Pi(e,r[r.length-1])||r.push(e))},s=function(e,t){var n=ta(e.ownerDocument);if(t<e.data.length){if(Vi(e.data[t]))return r;if(Vi(e.data[t-1])&&(n.setStart(e,t),n.setEnd(e,t+1),!ra(n)))return a(i(o(n),!1)),r}t>0&&(n.setStart(e,t-1),n.setEnd(e,t),ra(n)||a(i(o(n),!1))),t<e.data.length&&(n.setStart(e,t),n.setEnd(e,t+1),ra(n)||a(i(o(n),!0)))};if(Ji(e.container()))return s(e.container(),e.offset()),r;if($i(e.container()))if(e.isAtEnd())n=ea(e.container(),e.offset()),Ji(n)&&s(n,n.data.length),Yi(n)&&!Qi(n)&&a(i(o(n),!1));else{if(n=ea(e.container(),e.offset()),Ji(n)&&s(n,0),Yi(n)&&e.isAtEnd())return a(i(o(n),!1)),r;t=ea(e.container(),e.offset()-1),Yi(t)&&!Qi(t)&&(Ki(t)||Ki(n)||!Yi(n))&&a(i(o(t),!1)),Yi(n)&&a(i(o(n),!0))}return r},ia=function(e,t,n){var r=function(){return n||(n=oa(new ia(e,t))),n};return{container:ji.constant(e),offset:ji.constant(t),toRange:function(){var n;return(n=ta(e.ownerDocument)).setStart(e,t),n.setEnd(e,t),n},getClientRects:r,isVisible:function(){return r().length>0},isAtStart:function(){return Ji(e),0===t},isAtEnd:function(){return Ji(e)?t>=e.data.length:t>=e.childNodes.length},isEqual:function(n){return n&&e===n.container()&&t===n.offset()},getNode:function(n){return ea(e,n?t-1:t)}}};ia.fromRangeStart=function(e){return new ia(e.startContainer,e.startOffset)},ia.fromRangeEnd=function(e){return new ia(e.endContainer,e.endOffset)},ia.after=function(e){return new ia(e.parentNode,Zi(e)+1)},ia.before=function(e){return new ia(e.parentNode,Zi(e))},ia.isAtStart=function(e){return!!e&&e.isAtStart()},ia.isAtEnd=function(e){return!!e&&e.isAtEnd()},ia.isTextPosition=function(e){return!!e&&vo.isText(e.container())};var aa,sa,ua,ca,la,fa=vo.isContentEditableTrue,da=vo.isContentEditableFalse,ma=vo.matchStyleValues("display","block table table-cell table-caption list-item"),pa=mi.isCaretContainer,ga=mi.isCaretContainerBlock,ha=ji.curry,va=vo.isElement,ya=Ei,ba=function(e){return e>0},Ca=function(e){return e<0},xa=function(e,t){for(var n;n=e(t);)if(!ga(n))return n;return null},wa=function(e,t){for(e=e.parentNode;e&&e!==t;e=e.parentNode)if(fa(e))return e;return t},Na=function(e,t){for(;e&&e!==t;){if(ma(e))return e;e=e.parentNode}return null},Ea=function(e,t){var n=t.ownerDocument.createRange();return e?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),n},Sa=function(e,t,n){var r,o,i,a;for(o=e?"previousSibling":"nextSibling";n&&n!==t;){if(r=n[o],pa(r)&&(r=r[o]),da(r)){if(a=n,Na(r,i=t)===Na(a,i))return r;break}if(ya(r))break;n=n.parentNode}return null},ka=ha(Ea,!0),Ta=ha(Ea,!1),Aa=function(e,t){return da((n=e,(r=t)?(o=r.container(),i=r.offset(),va(o)?o.childNodes[i+n]:null):null));var n,r,o,i},_a={isForwards:ba,isBackwards:Ca,findNode:function(e,t,n,r,o){var i=new to(e,r);if(Ca(t)){if((da(e)||ga(e))&&n(e=xa(i.prev,!0)))return e;for(;e=xa(i.prev,o);)if(n(e))return e}if(ba(t)){if((da(e)||ga(e))&&n(e=xa(i.next,!0)))return e;for(;e=xa(i.next,o);)if(n(e))return e}return null},getEditingHost:wa,getParentBlock:Na,isInSameBlock:function(e,t,n){return Na(e.container(),n)===Na(t.container(),n)},isInSameEditingHost:function(e,t,n){return wa(e.container(),n)===wa(t.container(),n)},isBeforeContentEditableFalse:ha(Aa,0),isAfterContentEditableFalse:ha(Aa,-1),normalizeRange:function(e,t,n){var r,o,i,a,s=ha(Sa,!0,t),u=ha(Sa,!1,t);if(o=n.startContainer,i=n.startOffset,mi.isCaretContainerBlock(o)){if(va(o)||(o=o.parentNode),"before"===(a=o.getAttribute("data-mce-caret"))&&(r=o.nextSibling,da(r)))return ka(r);if("after"===a&&(r=o.previousSibling,da(r)))return Ta(r)}if(!n.collapsed)return n;if(vo.isText(o)){if(pa(o)){if(1===e){if(r=u(o))return ka(r);if(r=s(o))return Ta(r)}if(-1===e){if(r=s(o))return Ta(r);if(r=u(o))return ka(r)}return n}if(mi.endsWithCaretContainer(o)&&i>=o.data.length-1)return 1===e&&(r=u(o))?ka(r):n;if(mi.startsWithCaretContainer(o)&&i<=1)return-1===e&&(r=s(o))?Ta(r):n;if(i===o.data.length)return(r=u(o))?ka(r):n;if(0===i)return(r=s(o))?Ta(r):n}return n}},Ba=vo.isContentEditableFalse,Ra=vo.isText,Da=vo.isElement,Oa=vo.isBr,Pa=_a.isForwards,Ia=_a.isBackwards,La=Ei,Ma=Si,Fa=ki,za=function(e,t){return e.hasChildNodes()&&t<e.childNodes.length?e.childNodes[t]:null},Ua=function(e,t){if(Pa(e)){if(La(t.previousSibling)&&!Ra(t.previousSibling))return ia.before(t);if(Ra(t))return ia(t,0)}if(Ia(e)){if(La(t.nextSibling)&&!Ra(t.nextSibling))return ia.after(t);if(Ra(t))return ia(t,t.data.length)}return Ia(e)?Oa(t)?ia.before(t):ia.after(t):ia.before(t)},Va=function(e,t,n){var r,o,i,a,s,u,c,l,f,d;if(!Da(n)||!t)return null;if(t.isEqual(ia.after(n))&&n.lastChild){if(c=ia.after(n.lastChild),Ia(e)&&La(n.lastChild)&&Da(n.lastChild))return Oa(n.lastChild)?ia.before(n.lastChild):c}else c=t;if(r=c.container(),o=c.offset(),Ra(r)){if(Ia(e)&&o>0)return ia(r,--o);if(Pa(e)&&o<r.length)return ia(r,++o);i=r}else{if(Ia(e)&&o>0&&(a=za(r,o-1),La(a)))return!Ma(a)&&(s=_a.findNode(a,e,Fa,a))?Ra(s)?ia(s,s.data.length):ia.after(s):Ra(a)?ia(a,a.data.length):ia.before(a);if(Pa(e)&&o<r.childNodes.length&&(a=za(r,o),La(a)))return l=a,f=n,vo.isBr(l)&&(d=Va(1,ia.after(l),f))&&!_a.isInSameBlock(ia.before(l),ia.before(d),f)?Va(e,ia.after(a),n):!Ma(a)&&(s=_a.findNode(a,e,Fa,a))?Ra(s)?ia(s,0):ia.before(s):Ra(a)?ia(a,0):ia.after(a);i=c.getNode()}return(Pa(e)&&c.isAtEnd()||Ia(e)&&c.isAtStart())&&(i=_a.findNode(i,e,ji.constant(!0),n,!0),Fa(i,n))?Ua(e,i):(a=_a.findNode(i,e,Fa,n),!(u=At.last(At.filter(function(e,t){for(var n=[];e&&e!==t;)n.push(e),e=e.parentNode;return n}(r,n),Ba)))||a&&u.contains(a)?a?Ua(e,a):null:c=Pa(e)?ia.after(u):ia.before(u))},Ha=function(e){return{next:function(t){return Va(1,t,e)},prev:function(t){return Va(-1,t,e)}}},qa=function(e){return Ot.grep(e.childNodes,function(e){return"LI"===e.nodeName})},ja=function(e){return e&&e.firstChild&&e.firstChild===e.lastChild&&("\xa0"===(t=e.firstChild).data||vo.isBr(t));var t},$a=function(e){return e.length>0&&(!(t=e[e.length-1]).firstChild||ja(t))?e.slice(0,-1):e;var t},Wa=function(e,t){var n=e.getParent(t,e.isBlock);return n&&"LI"===n.nodeName?n:null},Ka=function(e,t){var n=ia.after(e),r=Ha(t).prev(n);return r?r.toRange():null},Xa=function(e,t,n){var r,o,i,a,s=e.parentNode;return Ot.each(t,function(t){s.insertBefore(t,e)}),r=e,o=n,i=ia.before(r),(a=Ha(o).next(i))?a.toRange():null},Ya=function(e,t){var n,r,o,i,a,s,u=t.firstChild,c=t.lastChild;return u&&"meta"===u.name&&(u=u.next),c&&"mce_marker"===c.attr("id")&&(c=c.prev),r=c,s=(n=e).getNonEmptyElements(),r&&(r.isEmpty(s)||(o=r,n.getBlockElements()[o.name]&&(a=o).firstChild&&a.firstChild===a.lastChild&&("br"===(i=o.firstChild).name||"\xa0"===i.value)))&&(c=c.prev),!(!u||u!==c||"ul"!==u.name&&"ol"!==u.name)},Ga=function(e,t,n,r){var o,i,a,s,u,c,l,f,d,m,p,g,h,v,y,b,C,x,w,N=(o=t,i=r,c=e.serialize(i),l=o.createFragment(c),s=(a=l).firstChild,u=a.lastChild,s&&"META"===s.nodeName&&s.parentNode.removeChild(s),u&&"mce_marker"===u.id&&u.parentNode.removeChild(u),a),E=Wa(t,n.startContainer),S=$a(qa(N.firstChild)),k=t.getRoot(),T=function(e){var r=ia.fromRangeStart(n),o=Ha(t.getRoot()),i=1===e?o.prev(r):o.next(r);return!i||Wa(t,i.getNode())!==E};return T(1)?Xa(E,S,k):T(2)?(f=E,d=S,m=k,t.insertAfter(d.reverse(),f),Ka(d[0],m)):(g=S,h=k,v=p=E,b=(y=n).cloneRange(),C=y.cloneRange(),b.setStartBefore(v),C.setEndAfter(v),x=[b.cloneContents(),C.cloneContents()],(w=p.parentNode).insertBefore(x[0],p),Ot.each(g,function(e){w.insertBefore(e,p)}),w.insertBefore(x[1],p),w.removeChild(p),Ka(g[g.length-1],h))},Ja=function(e,t){return!!Wa(e,t)},Qa=vo.isText,Za=vo.isBogus,es=Xo.nodeIndex,ts=function(e){var t=e.parentNode;return Za(t)?ts(t):t},ns=function(e){return e?At.reduce(e.childNodes,function(e,t){return Za(t)&&"BR"!==t.nodeName?e=e.concat(ns(t)):e.push(t),e},[]):[]},rs=function(e){return function(t){return e===t}},os=function(e){var t,n,r,o;return(Qa(e)?"text()":e.nodeName.toLowerCase())+"["+(n=ns(ts(t=e)),r=At.findIndex(n,rs(t),t),n=n.slice(0,r+1),o=At.reduce(n,function(e,t,r){return Qa(t)&&Qa(n[r-1])&&e++,e},0),n=At.filter(n,vo.matchNodeNames(t.nodeName)),(r=At.findIndex(n,rs(t),t))-o)+"]"},is=function(e,t){var n,r,o,i,a,s=[];return n=t.container(),r=t.offset(),Qa(n)?o=function(e,t){for(;(e=e.previousSibling)&&Qa(e);)t+=e.data.length;return t}(n,r):(r>=(i=n.childNodes).length?(o="after",r=i.length-1):o="before",n=i[r]),s.push(os(n)),a=function(e,t,n){var r=[];for(t=t.parentNode;!(t===e||n&&n(t));t=t.parentNode)r.push(t);return r}(e,n),a=At.filter(a,ji.negate(vo.isBogus)),(s=s.concat(At.map(a,function(e){return os(e)}))).reverse().join("/")+","+o},as=function(e,t){var n,r,o;return t?(t=(n=t.split(","))[0].split("/"),o=n.length>1?n[1]:"before",(r=At.reduce(t,function(e,t){return(t=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t))?("text()"===t[1]&&(t[1]="#text"),n=e,r=t[1],o=parseInt(t[2],10),i=ns(n),i=At.filter(i,function(e,t){return!Qa(e)||!Qa(i[t-1])}),(i=At.filter(i,vo.matchNodeNames(r)))[o]):null;var n,r,o,i},e))?Qa(r)?function(e,t){for(var n,r=e,o=0;Qa(r);){if(n=r.data.length,t>=o&&t<=o+n){e=r,t-=o;break}if(!Qa(r.nextSibling)){e=r,t=n;break}o+=n,r=r.nextSibling}return t>e.data.length&&(t=e.data.length),new ia(e,t)}(r,parseInt(o,10)):(o="after"===o?es(r)+1:es(r),new ia(r.parentNode,o)):null):null},ss=vo.isContentEditableFalse,us=function(e,t,n,r,o){var i,a=r[o?"startContainer":"endContainer"],s=r[o?"startOffset":"endOffset"],u=[],c=0,l=e.getRoot();for(vo.isText(a)?u.push(n?function(e,t,n){var r,o;for(o=e(t.data.slice(0,n)).length,r=t.previousSibling;r&&vo.isText(r);r=r.previousSibling)o+=e(r.data).length;return o}(t,a,s):s):(s>=(i=a.childNodes).length&&i.length&&(c=1,s=Math.max(0,i.length-1)),u.push(e.nodeIndex(i[s],n)+c));a&&a!==l;a=a.parentNode)u.push(e.nodeIndex(a,n));return u},cs=function(e){vo.isText(e)&&0===e.data.length&&e.parentNode.removeChild(e)},ls=function(e,t,n){var r=0;return Ot.each(e.select(t),function(e){if("all"!==e.getAttribute("data-mce-bogus"))return e!==n&&void r++}),r},fs=function(e,t){var n,r,o,i=t?"start":"end";n=e[i+"Container"],r=e[i+"Offset"],vo.isElement(n)&&"TR"===n.nodeName&&(n=(o=n.childNodes)[Math.min(t?r:r-1,o.length-1)])&&(r=t?0:n.childNodes.length,e["set"+(t?"Start":"End")](n,r))},ds=function(e){return fs(e,!0),fs(e,!1),e},ms=function(e,t){var n;if(vo.isElement(e)&&(e=zi(e,t),ss(e)))return e;if(mi.isCaretContainer(e)){if(vo.isText(e)&&mi.isCaretContainerBlock(e)&&(e=e.parentNode),n=e.previousSibling,ss(n))return n;if(n=e.nextSibling,ss(n))return n}},ps=function(e,t,n){var r,o,i,a,s,u,c,l=n.getNode(),f=l?l.nodeName:null,d=n.getRng();return ss(l)||"IMG"===f?{name:f,index:ls(n.dom,f,l)}:(l=ms((r=d).startContainer,r.startOffset)||ms(r.endContainer,r.endOffset))?{name:f=l.tagName,index:ls(n.dom,f,l)}:(o=e,a=t,s=d,u=(i=n).dom,(c={}).start=us(u,o,a,s,!0),i.isCollapsed()||(c.end=us(u,o,a,s,!1)),c)},gs={getBookmark:function(e,t,n){return 2===t?ps(ii,n,e):3===t?(o=(r=e).getRng(),{start:is(r.dom.getRoot(),ia.fromRangeStart(o)),end:is(r.dom.getRoot(),ia.fromRangeEnd(o))}):t?{rng:e.getRng()}:function(e){var t=e.dom,n=e.getRng(),r=t.uniqueId(),o=e.isCollapsed(),i="overflow:hidden;line-height:0px",a=e.getNode(),s=a.nodeName;if("IMG"===s)return{name:s,index:ls(t,s,a)};var u=ds(n.cloneRange());if(!o){u.collapse(!1);var c=t.create("span",{"data-mce-type":"bookmark",id:r+"_end",style:i},"&#xFEFF;");u.insertNode(c),cs(c.nextSibling)}(n=ds(n)).collapse(!0);var l=t.create("span",{"data-mce-type":"bookmark",id:r+"_start",style:i},"&#xFEFF;");return n.insertNode(l),cs(l.previousSibling),e.moveToBookmark({id:r,keep:1}),{id:r}}(e);var r,o},getUndoBookmark:y.curry(ps,y.identity,!0)},hs=function(e,t){for(var n=[],r=0;r<e.length;r++){var o=e[r];if(!o.isSome())return E.none();n.push(o.getOrDie())}return E.some(t.apply(null,n))},vs=function(e,t){return!e.isBlock(t)||t.innerHTML||me.ie||(t.innerHTML='<br data-mce-bogus="1" />'),t},ys=function(e,t,n,r){var o,i,a,s,u=n[t?"start":"end"],c=e.getRoot();if(u){for(a=u[0],i=c,o=u.length-1;o>=1;o--){if(s=i.childNodes,u[o]>s.length-1)return;i=s[u[o]]}3===i.nodeType&&(a=Math.min(u[0],i.nodeValue.length)),1===i.nodeType&&(a=Math.min(u[0],i.childNodes.length)),t?r.setStart(i,a):r.setEnd(i,a)}return!0},bs=function(e,t,n){var r,o,i,a,s,u,c=e.get(n.id+"_"+t),l=n.keep;if(c){if(r=c.parentNode,l?(r=c.firstChild,o=1):o=e.nodeIndex(c),s=r,u=o,!l){for(a=c.previousSibling,i=c.nextSibling,Ot.each(Ot.grep(c.childNodes),function(e){vo.isText(e)&&(e.nodeValue=e.nodeValue.replace(/\uFEFF/g,""))});c=e.get(n.id+"_"+t);)e.remove(c,1);a&&i&&a.nodeType===i.nodeType&&vo.isText(a)&&!me.opera&&(o=a.nodeValue.length,a.appendData(i.nodeValue),e.remove(i),s=a,u=o)}return E.some(ia(s,u))}return E.none()},Cs=function(e,t){var n,r,o,i,a,s,u,c,l,f,d,m,p,g,h,v=e.dom;if(t){if(Ot.isArray(t.start))return g=t,h=(p=v).createRng(),ys(p,!0,g,h)&&ys(p,!1,g,h)?E.some(h):E.none();if("string"==typeof t.start)return E.some((f=t,d=(l=v).createRng(),m=as(l.getRoot(),f.start),d.setStart(m.container(),m.offset()),m=as(l.getRoot(),f.end),d.setEnd(m.container(),m.offset()),d));if(t.id)return u=bs(o=v,"start",i=t),c=bs(o,"end",i),hs([u,(a=c,s=u,a.isSome()?a:s)],function(e,t){var n=o.createRng();return n.setStart(vs(o,e.container()),e.offset()),n.setEnd(vs(o,t.container()),t.offset()),n});if(t.name)return n=v,r=t,E.from(n.select(r.name)[r.index]).map(function(e){var t=n.createRng();return t.selectNode(e),t});if(t.rng)return E.some(t.rng)}return E.none()},xs={getBookmark:function(e,t,n){return gs.getBookmark(e,t,n)},moveToBookmark:function(e,t){Cs(e,t).each(function(t){e.setRng(t)})},isBookmarkNode:function(e){return vo.isElement(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type")}},ws=Ot.each,Ns=function(e){this.compare=function(t,n){if(t.nodeName!==n.nodeName)return!1;var r=function(t){var n={};return ws(e.getAttribs(t),function(r){var o=r.nodeName.toLowerCase();0!==o.indexOf("_")&&"style"!==o&&0!==o.indexOf("data-")&&(n[o]=e.getAttrib(t,o))}),n},o=function(e,t){var n,r;for(r in e)if(e.hasOwnProperty(r)){if(void 0===(n=t[r]))return!1;if(e[r]!==n)return!1;delete t[r]}for(r in t)if(t.hasOwnProperty(r))return!1;return!0};return!(!o(r(t),r(n))||!o(e.parseStyle(e.getAttrib(t,"style")),e.parseStyle(e.getAttrib(n,"style")))||xs.isBookmarkNode(t)||xs.isBookmarkNode(n))}},Es=function(e,t){Ur.parent(e).each(function(n){n.dom().insertBefore(t.dom(),e.dom())})},Ss=function(e,t){e.dom().appendChild(t.dom())},ks={before:Es,after:function(e,t){Ur.nextSibling(e).fold(function(){Ur.parent(e).each(function(e){Ss(e,t)})},function(e){Es(e,t)})},prepend:function(e,t){Ur.firstChild(e).fold(function(){Ss(e,t)},function(n){e.dom().insertBefore(t.dom(),n.dom())})},append:Ss,appendAt:function(e,t,n){Ur.child(e,n).fold(function(){Ss(e,t)},function(e){Es(e,t)})},wrap:function(e,t){Es(e,t),Ss(t,e)}},Ts=function(e,t){M.each(t,function(t){ks.before(e,t)})},As=function(e,t){M.each(t,function(t){ks.append(e,t)})},_s=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},Bs={empty:function(e){e.dom().textContent="",M.each(Ur.children(e),function(e){_s(e)})},remove:_s,unwrap:function(e){var t=Ur.children(e);t.length>0&&Ts(e,t),_s(e)}},Rs=(aa=Zn.isText,sa="text",ua=function(e){return aa(e)?E.from(e.dom().nodeValue):E.none()},ca=Un.detect().browser,{get:function(e){if(!aa(e))throw new Error("Can only get "+sa+" value of a "+sa+" node");return la(e).getOr("")},getOption:la=ca.isIE()&&10===ca.version.major?function(e){try{return ua(e)}catch(yC){return E.none()}}:ua,set:function(e,t){if(!aa(e))throw new Error("Can only set raw "+sa+" value of a "+sa+" node");e.dom().nodeValue=t}}),Ds=function(e){return Rs.get(e)},Os=function(e,t){return _r.all(t,e)},Ps=function(e){var t=Os(e,"br"),n=M.filter(function(e){for(var t=[],n=e.dom();n;)t.push(Hn.fromDom(n)),n=n.lastChild;return t}(e).slice(-1),io.isBr);t.length===n.length&&M.each(n,Bs.remove)},Is=function(e){Bs.empty(e),ks.append(e,Hn.fromHtml('<br data-mce-bogus="1">'))},Ls=function(e){Ur.lastChild(e).each(function(t){Ur.prevSibling(t).each(function(n){io.isBlock(e)&&io.isBr(t)&&io.isBlock(n)&&Bs.remove(t)})})},Ms=Ot.makeMap,Fs=function(e){var t,n,r,o,i,a=[];return t=(e=e||{}).indent,n=Ms(e.indent_before||""),r=Ms(e.indent_after||""),o=Ao.getEncodeFunc(e.entity_encoding||"raw",e.entities),i="html"===e.element_format,{start:function(e,s,u){var c,l,f,d;if(t&&n[e]&&a.length>0&&(d=a[a.length-1]).length>0&&"\n"!==d&&a.push("\n"),a.push("<",e),s)for(c=0,l=s.length;c<l;c++)f=s[c],a.push(" ",f.name,'="',o(f.value,!0),'"');a[a.length]=!u||i?">":" />",u&&t&&r[e]&&a.length>0&&(d=a[a.length-1]).length>0&&"\n"!==d&&a.push("\n")},end:function(e){var n;a.push("</",e,">"),t&&r[e]&&a.length>0&&(n=a[a.length-1]).length>0&&"\n"!==n&&a.push("\n")},text:function(e,t){e.length>0&&(a[a.length]=t?e:o(e))},cdata:function(e){a.push("<![CDATA[",e,"]]>")},comment:function(e){a.push("\x3c!--",e,"--\x3e")},pi:function(e,n){n?a.push("<?",e," ",o(n),"?>"):a.push("<?",e,"?>"),t&&a.push("\n")},doctype:function(e){a.push("<!DOCTYPE",e,">",t?"\n":"")},reset:function(){a.length=0},getContent:function(){return a.join("").replace(/\n$/,"")}}},zs=function(e,t){var n={},r=Fs(e);return(e=e||{}).validate=!("validate"in e)||e.validate,n.schema=t=t||Fo(),n.writer=r,n.serialize=function(n){var o,i;i=e.validate,o={3:function(e){r.text(e.value,e.raw)},8:function(e){r.comment(e.value)},7:function(e){r.pi(e.name,e.value)},10:function(e){r.doctype(e.value)},4:function(e){r.cdata(e.value)},11:function(e){if(e=e.firstChild)do{a(e)}while(e=e.next)}},r.reset();var a=function(e){var n,s,u,c,l,f,d,m,p,g=o[e.type];if(g)g(e);else{if(n=e.name,s=e.shortEnded,u=e.attributes,i&&u&&u.length>1&&((f=[]).map={},p=t.getElementRule(e.name))){for(d=0,m=p.attributesOrder.length;d<m;d++)(c=p.attributesOrder[d])in u.map&&(l=u.map[c],f.map[c]=l,f.push({name:c,value:l}));for(d=0,m=u.length;d<m;d++)(c=u[d].name)in f.map||(l=u.map[c],f.map[c]=l,f.push({name:c,value:l}));u=f}if(r.start(e.name,u,s),!s){if(e=e.firstChild)do{a(e)}while(e=e.next);r.end(n)}}};return 1!==n.type||e.inner?o[11](n):a(n),r.getContent()},n},Us=function(e){return ia.isTextPosition(e)?0===e.offset():Ei(e.getNode())},Vs=function(e){return ia.isTextPosition(e)?e.offset()===e.container().data.length:Ei(e.getNode(!0))},Hs=function(e,t){return!ia.isTextPosition(e)&&!ia.isTextPosition(t)&&e.getNode()===t.getNode(!0)},qs=function(e,t,n){return e?!Hs(t,n)&&(r=t,!(!ia.isTextPosition(r)&&vo.isBr(r.getNode())))&&Vs(t)&&Us(n):!Hs(n,t)&&Us(t)&&Vs(n);var r},js=function(e,t,n){var r=Ha(t);return E.from(e?r.next(n):r.prev(n))},$s=function(e,t){var n,r,o,i,a,s=e?t.firstChild:t.lastChild;return vo.isText(s)?E.some(new ia(s,e?0:s.data.length)):s?Ei(s)?E.some(e?ia.before(s):(a=s,vo.isBr(a)?ia.before(a):ia.after(a))):(r=t,o=s,i=(n=e)?ia.before(o):ia.after(o),js(n,r,i)):E.none()},Ws={fromPosition:js,nextPosition:y.curry(js,!0),prevPosition:y.curry(js,!1),navigate:function(e,t,n){return js(e,t,n).bind(function(r){return _a.isInSameBlock(n,r,t)&&qs(e,n,r)?js(e,t,r):E.some(r)})},positionIn:$s,firstPositionIn:y.curry($s,!0),lastPositionIn:y.curry($s,!1)},Ks=function(e){var t=ia.fromRangeStart(e),n=ia.fromRangeEnd(e),r=e.commonAncestorContainer;return Ws.fromPosition(!1,r,n).map(function(o){return!_a.isInSameBlock(t,n,r)&&_a.isInSameBlock(t,o,r)?(i=t.container(),a=t.offset(),s=o.container(),u=o.offset(),(c=document.createRange()).setStart(i,a),c.setEnd(s,u),c):e;var i,a,s,u,c}).getOr(e)},Xs=function(e){return(t=e).collapsed?t:Ks(t);var t},Ys=vo.matchNodeNames("td th"),Gs=function(e,t,n){var r,o,i,a,s,u,c,l,f,d,m,p,g=e.schema.getTextInlineElements(),h=e.selection,v=e.dom;if(/^ | $/.test(t)&&(t=function(e){var t,n,r;t=h.getRng(),n=t.startContainer,r=t.startOffset;var o=function(e){return n[e]&&3===n[e].nodeType};return 3===n.nodeType&&(r>0?e=e.replace(/^&nbsp;/," "):o("previousSibling")||(e=e.replace(/^ /,"&nbsp;")),r<n.length?e=e.replace(/&nbsp;(<br>|)$/," "):o("nextSibling")||(e=e.replace(/(&nbsp;| )(<br>|)$/,"&nbsp;"))),e}(t)),r=e.parser,p=n.merge,o=zs({validate:e.settings.validate},e.schema),m='<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;&#x200B;</span>',u={content:t,format:"html",selection:!0,paste:n.paste},(u=e.fire("BeforeSetContent",u)).isDefaultPrevented())e.fire("SetContent",{content:u.content,format:"html",selection:!0,paste:n.paste});else{-1===(t=u.content).indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,m);var y,b,C,x,w=(l=h.getRng()).startContainer||(l.parentElement?l.parentElement():null),N=e.getBody();w===N&&h.isCollapsed()&&v.isBlock(N.firstChild)&&(y=N.firstChild)&&!e.schema.getShortEndedElements()[y.nodeName]&&v.isEmpty(N.firstChild)&&((l=v.createRng()).setStart(N.firstChild,0),l.setEnd(N.firstChild,0),h.setRng(l)),h.isCollapsed()||(e.selection.setRng(Xs(e.selection.getRng())),e.getDoc().execCommand("Delete",!1,null),C=(b=h.getRng()).startContainer,x=b.startOffset,3===C.nodeType&&b.collapsed&&("\xa0"===C.data[x]?(C.deleteData(x,1),/[\u00a0| ]$/.test(t)||(t+=" ")):"\xa0"===C.data[x-1]&&(C.deleteData(x-1,1),/[\u00a0| ]$/.test(t)||(t=" "+t))));var S,k,T,A={context:(i=h.getNode()).nodeName.toLowerCase(),data:n.data,insert:!0};if(s=r.parse(t,A),!0===n.paste&&Ya(e.schema,s)&&Ja(v,i))return l=Ga(o,v,e.selection.getRng(!0),s),e.selection.setRng(l),void e.fire("SetContent",u);if(function(e){for(var t=e;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")}(s),"mce_marker"===(f=s.lastChild).attr("id"))for(c=f,f=f.prev;f;f=f.walk(!0))if(3===f.type||!v.isBlock(f.name)){e.schema.isValidChild(f.parent.name,"span")&&f.parent.insert(c,f,"br"===f.name);break}if(e._selectionOverrides.showBlockCaretContainer(i),A.invalid){for(h.setContent(m),i=h.getNode(),a=e.getBody(),9===i.nodeType?i=f=a:f=i;f!==a;)i=f,f=f.parentNode;t=i===a?a.innerHTML:v.getOuterHTML(i),t=o.serialize(r.parse(t.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return o.serialize(s)}))),i===a?v.setHTML(a,t):v.setOuterHTML(i,t)}else t=o.serialize(s),function(e,t,n){if("all"===n.getAttribute("data-mce-bogus"))n.parentNode.insertBefore(e.dom.createFragment(t),n);else{var r=n.firstChild,o=n.lastChild;!r||r===o&&"BR"===r.nodeName?e.dom.setHTML(n,t):e.selection.setContent(t)}}(e,t,i);!function(){if(p){var t=e.getBody(),n=new Ns(v);Ot.each(v.select("*[data-mce-fragment]"),function(e){for(var r=e.parentNode;r&&r!==t;r=r.parentNode)g[e.nodeName.toLowerCase()]&&n.compare(r,e)&&v.remove(e,!0)})}}(),function(t){var n,r,o;if(t){if(h.scrollIntoView(t),n=function(t){for(var n=e.getBody();t&&t!==n;t=t.parentNode)if("false"===e.dom.getContentEditable(t))return t;return null}(t))return v.remove(t),void h.select(n);l=v.createRng(),(f=t.previousSibling)&&3===f.nodeType?(l.setStart(f,f.nodeValue.length),me.ie||(d=t.nextSibling)&&3===d.nodeType&&(f.appendData(d.data),d.parentNode.removeChild(d))):(l.setStartBefore(t),l.setEndBefore(t)),r=v.getParent(t,v.isBlock),v.remove(t),r&&v.isEmpty(r)&&(e.$(r).empty(),l.setStart(r,0),l.setEnd(r,0),Ys(r)||r.getAttribute("data-mce-fragment")||!(o=function(t){var n=ia.fromRangeStart(t);if(n=Ha(e.getBody()).next(n))return n.toRange()}(l))?v.add(r,v.create("br",{"data-mce-bogus":"1"})):(l=o,v.remove(r))),h.setRng(l)}}(v.get("mce_marker")),S=e.getBody(),Ot.each(S.getElementsByTagName("*"),function(e){e.removeAttribute("data-mce-fragment")}),k=e.dom,T=e.selection.getStart(),E.from(k.getParent(T,"td,th")).map(Hn.fromDom).each(Ls),e.fire("SetContent",u),e.addVisual()}},Js=function(e,t){var n,r,o="string"!=typeof(n=t)?(r=Ot.extend({paste:n.paste,data:{paste:n.paste}},n),{content:n.content,details:r}):{content:n,details:{}};Gs(e,o.content,o.details)},Qs=function(e,t,n,r,o){return e(n,r)?E.some(n):tr.isFunction(o)&&o(n)?E.none():t(n,r,o)},Zs=function(e,t,n){for(var r=e.dom(),o=tr.isFunction(n)?n:y.constant(!1);r.parentNode;){r=r.parentNode;var i=Hn.fromDom(r);if(t(i))return E.some(i);if(o(i))break}return E.none()},eu=function(e,t){return M.find(e.dom().childNodes,y.compose(t,Hn.fromDom)).map(Hn.fromDom)},tu=function(e,t){var n=function(e){for(var r=0;r<e.childNodes.length;r++){if(t(Hn.fromDom(e.childNodes[r])))return E.some(Hn.fromDom(e.childNodes[r]));var o=n(e.childNodes[r]);if(o.isSome())return o}return E.none()};return n(e.dom())},nu={first:function(e){return tu(gr.body(),e)},ancestor:Zs,closest:function(e,t,n){return Qs(function(e){return t(e)},Zs,e,t,n)},sibling:function(e,t){var n=e.dom();return n.parentNode?eu(Hn.fromDom(n.parentNode),function(n){return!Dr.eq(e,n)&&t(n)}):E.none()},child:eu,descendant:tu},ru=xr("sections","settings"),ou=Un.detect().deviceType.isTouch(),iu=["lists","autolink","autosave"],au={theme:"mobile"},su=function(e){var t=tr.isArray(e)?e.join(" "):e,n=M.map(tr.isString(t)?t.split(" "):[],On);return M.filter(n,function(e){return e.length>0})},uu=function(e,t){return e.sections().hasOwnProperty(t)},cu=function(e,t,n,r){var o,i,a=su(n.forced_plugins),s=su(r.plugins),u=e&&uu(t,"mobile")?(o=s,M.filter(o,y.curry(M.contains,iu))):s,c=(i=u,[].concat(su(a)).concat(su(i)));return Ot.extend(r,{plugins:c.join(" ")})},lu=function(e,t,n,r){var o,i,a,s,u,c,l,f,d,m,p,g,h,v=(o=["mobile"],i=r,a=sr.bifilter(i,function(e,t){return M.contains(o,t)}),ru(a.t,a.f)),y=Ot.extend(t,n,v.settings(),(p=e,h=(g=v).settings().inline,p&&uu(g,"mobile")&&!h?(l="mobile",f=au,d=v.sections(),m=d.hasOwnProperty(l)?d[l]:{},Ot.extend({},f,m)):{}),{validate:!0,content_editable:v.settings().inline,external_plugins:(s=n,u=v.settings(),c=u.external_plugins?u.external_plugins:{},s&&s.external_plugins?Ot.extend({},s.external_plugins,c):c)});return cu(e,v,n,y)},fu=function(e,t,n){return E.from(t.settings[n]).filter(e)},du=y.curry(fu,tr.isString),mu=function(e,t,n,r){var o,i,a=t in e.settings?e.settings[t]:n;return"hash"===r?(i={},"string"==typeof(o=a)?M.each(o.indexOf("=")>0?o.split(/[;,](?![^=;,]*(?:[;,]|$))/):o.split(","),function(e){(e=e.split("=")).length>1?i[Ot.trim(e[0])]=Ot.trim(e[1]):i[Ot.trim(e[0])]=Ot.trim(e)}):i=o,i):"string"===r?fu(tr.isString,e,t).getOr(n):"number"===r?fu(tr.isNumber,e,t).getOr(n):"boolean"===r?fu(tr.isBoolean,e,t).getOr(n):"object"===r?fu(tr.isObject,e,t).getOr(n):"array"===r?fu(tr.isArray,e,t).getOr(n):"function"===r?fu(tr.isFunction,e,t).getOr(n):a},pu=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,gu=function(e){return pu.test(e)},hu=function(e,t){var n=t.container(),r=t.offset();return e?mi.isCaretContainerInline(n)?vo.isText(n.nextSibling)?new ia(n.nextSibling,0):ia.after(n):mi.isBeforeInline(t)?new ia(n,r+1):t:mi.isCaretContainerInline(n)?vo.isText(n.previousSibling)?new ia(n.previousSibling,n.previousSibling.data.length):ia.before(n):mi.isAfterInline(t)?new ia(n,r-1):t},vu={isInlineTarget:function(e,t){var n=du(e,"inline_boundaries_selector").getOr("a[href],code");return _r.is(Hn.fromDom(t),n)},findRootInline:function(e,t,n){var r,o,i,a=(r=e,o=t,i=n,M.filter(Xo.DOM.getParents(i.container(),"*",o),r));return E.from(a[a.length-1])},isRtl:function(e){return"rtl"===Xo.DOM.getStyle(e,"direction",!0)||gu(e.textContent)},isAtZwsp:function(e){return mi.isBeforeInline(e)||mi.isAfterInline(e)},normalizePosition:hu,normalizeForwards:y.curry(hu,!0),normalizeBackwards:y.curry(hu,!1),hasSameParentBlock:function(e,t,n){var r=_a.getParentBlock(t,e),o=_a.getParentBlock(n,e);return r&&r===o}},yu=function(e,t){return Dr.contains(e,t)?nu.closest(t,function(e){return io.isTextBlock(e)||io.isListItem(e)},(n=e,function(e){return Dr.eq(n,Hn.fromDom(e.dom().parentNode))})):E.none();var n},bu=function(e){var t,n,r;e.dom.isEmpty(e.getBody())&&(e.setContent(""),n=(t=e).getBody(),r=n.firstChild&&t.dom.isBlock(n.firstChild)?n.firstChild:n,t.selection.setCursorLocation(r,0))},Cu=function(e,t,n){return hs([Ws.firstPositionIn(n),Ws.lastPositionIn(n)],function(r,o){var i=vu.normalizePosition(!0,r),a=vu.normalizePosition(!1,o),s=vu.normalizePosition(!1,t);return e?Ws.nextPosition(n,s).map(function(e){return e.isEqual(a)&&t.isEqual(i)}).getOr(!1):Ws.prevPosition(n,s).map(function(e){return e.isEqual(i)&&t.isEqual(a)}).getOr(!1)}).getOr(!0)},xu=function(e,t,n){return nu.ancestor(e,function(e){return _r.is(e,t)},n)},wu=xu,Nu=function(e,t){return _r.one(t,e)},Eu=function(e,t,n){return Qs(_r.is,xu,e,t,n)},Su=function(e,t,n){return wu(e,t,n).isSome()},ku=function(e,t){return vo.isText(t)&&/^[ \t\r\n]*$/.test(t.data)&&!1===(n=e,r=t,o=Hn.fromDom(n),i=Hn.fromDom(r),Su(i,"pre,code",y.curry(Dr.eq,o)));var n,r,o,i},Tu=function(e,t){return Ei(t)&&!1===ku(e,t)||(n=t,vo.isElement(n)&&"A"===n.nodeName&&n.hasAttribute("name"))||Au(t);var n},Au=vo.hasAttribute("data-mce-bookmark"),_u=vo.hasAttribute("data-mce-bogus"),Bu=vo.hasAttributeValue("data-mce-bogus","all"),Ru=function(e){return function(e){var t,n,r=0;if(Tu(e,e))return!1;if(!(n=e.firstChild))return!0;t=new to(n,e);do{if(Bu(n))n=t.next(!0);else if(_u(n))n=t.next();else if(vo.isBr(n))r++,n=t.next();else{if(Tu(e,n))return!1;n=t.next()}}while(n);return r<=1}(e.dom())},Du=xr("block","position"),Ou=xr("from","to"),Pu=function(e,t){var n=Hn.fromDom(e),r=Hn.fromDom(t.container());return yu(n,r).map(function(e){return Du(e,t)})},Iu=function(e,t,n){var r=Pu(e,ia.fromRangeStart(n)),o=r.bind(function(n){return Ws.fromPosition(t,e,n.position()).bind(function(n){return Pu(e,n).map(function(n){return r=e,o=t,i=n,vo.isBr(i.position().getNode())&&!1===Ru(i.block())?Ws.positionIn(!1,i.block().dom()).bind(function(e){return e.isEqual(i.position())?Ws.fromPosition(o,r,e).bind(function(e){return Pu(r,e)}):E.some(i)}).getOr(i):i;var r,o,i})})});return hs([r,o],Ou).filter(function(e){return r=e,!1===Dr.eq(r.from().block(),r.to().block())&&(n=e,Ur.parent(n.from().block()).bind(function(e){return Ur.parent(n.to().block()).filter(function(t){return Dr.eq(e,t)})}).isSome())&&(t=e,!1===vo.isContentEditableFalse(t.from().block())&&!1===vo.isContentEditableFalse(t.to().block()));var t,n,r})},Lu=function(e,t,n){return n.collapsed?Iu(e,t,n):E.none()},Mu=function(e,t,n){return Dr.contains(t,e)?Ur.parents(e,function(e){return n(e)||Dr.eq(e,t)}).slice(0,-1):[]},Fu=function(e,t){return Mu(e,t,y.constant(!1))},zu=Fu,Uu=function(e,t){return[e].concat(Fu(e,t))},Vu=function(e){var t,n,r=(t=e,n=Ur.children(t),M.findIndex(n,io.isBlock).fold(function(){return n},function(e){return n.slice(0,e)}));return M.each(r,function(e){Bs.remove(e)}),r},Hu=function(e,t){Ws.positionIn(e,t.dom()).each(function(e){var t=e.getNode();vo.isBr(t)&&Bs.remove(Hn.fromDom(t))})},qu=function(e,t){var n=Uu(t,e);return M.find(n.reverse(),Ru).each(Bs.remove)},ju=function(e,t){return Dr.contains(t,e)?Ur.parent(e).bind(function(n){return Dr.eq(n,t)?E.some(e):(r=t,o=e,i=Ur.parents(o,function(e){return Dr.eq(e,r)}),E.from(i[i.length-2]));var r,o,i}):E.none()},$u=function(e,t,n){if(Ru(n))return Bs.remove(n),Ru(t)&&Is(t),Ws.firstPositionIn(t.dom());Hu(!0,t),Hu(!1,n);var r=Vu(t);return ju(t,n).fold(function(){qu(e,t);var o=Ws.lastPositionIn(n.dom());return M.each(r,function(e){ks.append(n,e)}),o},function(o){var i=Ws.prevPosition(n.dom(),ia.before(o.dom()));return M.each(r,function(e){ks.before(o,e)}),qu(e,t),i})},Wu=function(e,t,n,r){return t?$u(e,r,n):$u(e,n,r)},Ku=function(e,t){var n,r=Hn.fromDom(e.getBody());return(n=Lu(r.dom(),t,e.selection.getRng()).bind(function(e){return Wu(r,t,e.from().block(),e.to().block())})).each(function(t){e.selection.setRng(t.toRange())}),n.isSome()},Xu=function(e,t){var n=Hn.fromDom(t),r=y.curry(Dr.eq,e);return nu.ancestor(n,io.isTableCell,r).isSome()},Yu=function(e,t){var n,r,o=Ws.prevPosition(e.dom(),ia.fromRangeStart(t)).isNone(),i=Ws.nextPosition(e.dom(),ia.fromRangeEnd(t)).isNone();return!(Xu(n=e,(r=t).startContainer)||Xu(n,r.endContainer))&&o&&i},Gu=function(e){var t,n,r,o,i=Hn.fromDom(e.getBody()),a=e.selection.getRng();return Yu(i,a)?((o=e).setContent(""),o.selection.setCursorLocation(),!0):(t=i,n=e.selection,r=n.getRng(),hs([yu(t,Hn.fromDom(r.startContainer)),yu(t,Hn.fromDom(r.endContainer))],function(e,o){return!1===Dr.eq(e,o)&&(r.deleteContents(),Wu(t,!0,e,o).each(function(e){n.setRng(e.toRange())}),!0)}).getOr(!1))},Ju=function(e,t){return!e.selection.isCollapsed()&&Gu(e)},Qu=function(e){if(!tr.isArray(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");var t=[],n={};return M.each(e,function(r,o){var i=sr.keys(r);if(1!==i.length)throw new Error("one and only one name per case");var a=i[0],s=r[a];if(n[a]!==undefined)throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!tr.isArray(s))throw new Error("case arguments must be an array");t.push(a),n[a]=function(){var n=arguments.length;if(n!==s.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+s.length+" ("+s+"), got "+n);for(var r=new Array(n),i=0;i<r.length;i++)r[i]=arguments[i];return{fold:function(){if(arguments.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+arguments.length);return arguments[o].apply(null,r)},match:function(e){var n=sr.keys(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!M.forall(t,function(e){return M.contains(n,e)}))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,r)},log:function(e){console.log(e,{constructors:t,constructor:a,params:r})}}}}),n},Zu=Qu([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),ec=function(e,t,n,r){var o=r.getNode(!1===t);return yu(Hn.fromDom(e),Hn.fromDom(n.getNode())).map(function(e){return Ru(e)?Zu.remove(e.dom()):Zu.moveToElement(o)}).orThunk(function(){return E.some(Zu.moveToElement(o))})},tc=function(e,t,n){return Ws.fromPosition(t,e,n).bind(function(r){return t&&vo.isContentEditableFalse(r.getNode())?ec(e,t,n,r):!1===t&&vo.isContentEditableFalse(r.getNode(!0))?ec(e,t,n,r):t&&_a.isAfterContentEditableFalse(n)?E.some(Zu.moveToPosition(r)):!1===t&&_a.isBeforeContentEditableFalse(n)?E.some(Zu.moveToPosition(r)):E.none()})},nc=function(e,t,n){return i=t,a=n.getNode(!1===i),s=i?"after":"before",vo.isElement(a)&&a.getAttribute("data-mce-caret")===s?(r=t,o=n.getNode(!1===t),r&&vo.isContentEditableFalse(o.nextSibling)?E.some(Zu.moveToElement(o.nextSibling)):!1===r&&vo.isContentEditableFalse(o.previousSibling)?E.some(Zu.moveToElement(o.previousSibling)):E.none()).fold(function(){return tc(e,t,n)},E.some):tc(e,t,n).bind(function(t){return r=e,o=n,t.fold(function(e){return E.some(Zu.remove(e))},function(e){return E.some(Zu.moveToElement(e))},function(e){return _a.isInSameBlock(o,e,r)?E.none():E.some(Zu.moveToPosition(e))});var r,o});var r,o,i,a,s},rc=function(e,t,n){var r=_a.normalizeRange(t?1:-1,e,n),o=ia.fromRangeStart(r);return!1===t&&_a.isAfterContentEditableFalse(o)?E.some(Zu.remove(o.getNode(!0))):t&&_a.isBeforeContentEditableFalse(o)?E.some(Zu.remove(o.getNode())):nc(e,t,o)},oc=function(e,t){return r=e,o=(n=t).container(),i=n.offset(),!1===ia.isTextPosition(n)&&o===r.parentNode&&i>ia.before(r).offset()?new ia(t.container(),t.offset()-1):t;var n,r,o,i},ic=function(e){return Ei(e.previousSibling)?E.some((t=e.previousSibling,vo.isText(t)?new ia(t,t.data.length):ia.after(t))):e.previousSibling?Ws.lastPositionIn(e.previousSibling):E.none();var t},ac=function(e){return Ei(e.nextSibling)?E.some((t=e.nextSibling,vo.isText(t)?new ia(t,0):ia.before(t))):e.nextSibling?Ws.firstPositionIn(e.nextSibling):E.none();var t},sc=function(e,t){return ic(t).orThunk(function(){return ac(t)}).orThunk(function(){return n=e,r=t,o=ia.before(r.previousSibling?r.previousSibling:r.parentNode),Ws.prevPosition(n,o).fold(function(){return Ws.nextPosition(n,ia.after(r))},E.some);var n,r,o})},uc=function(e,t){return ac(t).orThunk(function(){return ic(t)}).orThunk(function(){return n=e,r=t,Ws.nextPosition(n,ia.after(r)).fold(function(){return Ws.prevPosition(n,ia.before(r))},E.some);var n,r})},cc=function(e,t,n){return(r=e,o=t,i=n,r?uc(o,i):sc(o,i)).map(y.curry(oc,n));var r,o,i},lc=function(e,t,n){n.fold(function(){e.focus()},function(n){e.selection.setRng(n.toRange(),t)})},fc=function(e,t){return t&&e.schema.getBlockElements().hasOwnProperty(Zn.name(t))},dc=function(e){if(Ru(e)){var t=Hn.fromHtml('<br data-mce-bogus="1">');return Bs.empty(e),ks.append(e,t),E.some(ia.before(t.dom()))}return E.none()},mc=function(e,t,n){var r,o,i,a=cc(t,e.getBody(),n.dom()),s=nu.ancestor(n,y.curry(fc,e),(r=e.getBody(),function(e){return e.dom()===r})),u=(o=n,i=a,hs([Ur.prevSibling(o),Ur.nextSibling(o),i],function(e,t,n){var r,i=e.dom(),a=t.dom();return vo.isText(i)&&vo.isText(a)?(r=i.data.length,i.appendData(a.data),Bs.remove(t),Bs.remove(o),n.container()===a?new ia(i,r):n):(Bs.remove(o),n)}).orThunk(function(){return Bs.remove(o),i}));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):s.bind(dc).fold(function(){lc(e,t,u)},function(n){lc(e,t,E.some(n))})},pc=function(e,t){return rc(e.getBody(),t,e.selection.getRng()).map(function(n){return n.fold((a=e,s=t,function(e){return a._selectionOverrides.hideFakeCaret(),mc(a,s,Hn.fromDom(e)),!0}),(o=e,i=t,function(e){var t=i?ia.before(e):ia.after(e);return o.selection.setRng(t.toRange()),!0}),(r=e,function(e){return r.selection.setRng(e.toRange()),!0}));var r,o,i,a,s}).getOr(!1)},gc=function(e,t){var n,r=e.selection.getNode();return!!vo.isContentEditableFalse(r)&&(n=Hn.fromDom(e.getBody()),M.each(Os(n,".mce-offscreen-selection"),Bs.remove),mc(e,t,Hn.fromDom(e.selection.getNode())),bu(e),!0)},hc=function(e,t){return e.selection.isCollapsed()?pc(e,t):gc(e,t)},vc=function(e){var t,n=function(e,t){for(;t&&t!==e;){if(vo.isContentEditableTrue(t)||vo.isContentEditableFalse(t))return t;t=t.parentNode}return null}(e.getBody(),e.selection.getNode());return vo.isContentEditableTrue(n)&&e.dom.isBlock(n)&&e.dom.isEmpty(n)&&(t=e.dom.create("br",{"data-mce-bogus":"1"}),e.dom.setHTML(n,""),n.appendChild(t),e.selection.setRng(ia.before(t).toRange())),!0},yc=vo.isText,bc=function(e){return yc(e)&&e.data[0]===oi},Cc=function(e){return yc(e)&&e.data[e.data.length-1]===oi},xc=function(e){return e.ownerDocument.createTextNode(oi)},wc=function(e,t){return e?function(e){if(yc(e.previousSibling))return Cc(e.previousSibling)?e.previousSibling:(e.previousSibling.appendData(oi),e.previousSibling);if(yc(e))return bc(e)?e:(e.insertData(0,oi),e);var t=xc(e);return e.parentNode.insertBefore(t,e),t}(t):function(e){if(yc(e.nextSibling))return bc(e.nextSibling)?e.nextSibling:(e.nextSibling.insertData(0,oi),e.nextSibling);if(yc(e))return Cc(e)?e:(e.appendData(oi),e);var t=xc(e);return e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t}(t)},Nc={insertInline:wc,insertInlineBefore:y.curry(wc,!0),insertInlineAfter:y.curry(wc,!1)},Ec=vo.isElement,Sc=vo.isText,kc=function(e){var t=e.parentNode;t&&t.removeChild(e)},Tc=function(e,t){0===t.length?kc(e):e.nodeValue=t},Ac=function(e){var t=ii(e);return{count:e.length-t.length,text:t}},_c=function(e,t){return Dc(e),t},Bc=function(e,t){return t.container()===e?(r=t,o=Ac((n=e).data.substr(0,r.offset())),i=Ac(n.data.substr(r.offset())),(a=o.text+i.text).length>0?(Tc(n,a),new ia(n,r.offset()-o.count)):r):_c(e,t);var n,r,o,i,a},Rc=function(e,t){return t.container()===e.parentNode?(n=e,o=(r=t).container(),i=M.indexOf(o.childNodes,n).map(function(e){return e<r.offset()?new ia(o,r.offset()-1):r}).getOr(r),Dc(n),i):_c(e,t);var n,r,o,i},Dc=function(e){if(Ec(e)&&mi.isCaretContainer(e)&&(mi.hasContent(e)?e.removeAttribute("data-mce-caret"):kc(e)),Sc(e)){var t=ii(function(e){try{return e.nodeValue}catch(t){return""}}(e));Tc(e,t)}},Oc={removeAndReposition:function(e,t){return ia.isTextPosition(t)?Bc(e,t):Rc(e,t)},remove:Dc},Pc=function(e,t){return vo.isText(e.container())?Nc.insertInline(t,e.container()):Nc.insertInline(t,e.getNode())},Ic=function(e,t){var n=t.get();return n&&e.container()===n&&mi.isCaretContainerInline(n)},Lc=function(e,t){return t.fold(function(t){Oc.remove(e.get());var n=Nc.insertInlineBefore(t);return e.set(n),E.some(new ia(n,n.length-1))},function(t){return Ws.firstPositionIn(t).map(function(t){if(Ic(t,e))return new ia(e.get(),1);Oc.remove(e.get());var n=Pc(t,!0);return e.set(n),new ia(n,1)})},function(t){return Ws.lastPositionIn(t).map(function(t){if(Ic(t,e))return new ia(e.get(),e.get().length-1);Oc.remove(e.get());var n=Pc(t,!1);return e.set(n),new ia(n,n.length-1)})},function(t){Oc.remove(e.get());var n=Nc.insertInlineAfter(t);return e.set(n),E.some(new ia(n,1))})},Mc=function(e){return e&&/^(IMG)$/.test(e.nodeName)},Fc=function(e){return e&&3===e.nodeType&&/^([\t \r\n]+|)$/.test(e.nodeValue)},zc=function(e,t,n){return"color"!==n&&"backgroundColor"!==n||(t=e.toHex(t)),"fontWeight"===n&&700===t&&(t="bold"),"fontFamily"===n&&(t=t.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),""+t},Uc={isInlineBlock:Mc,moveStart:function(e,t,n){var r,o,i,a=n.startContainer,s=n.startOffset;if((n.startContainer!==n.endContainer||!Mc(n.startContainer.childNodes[n.startOffset]))&&(3===a.nodeType&&s>=a.nodeValue.length&&(s=e.nodeIndex(a),a=a.parentNode),1===a.nodeType))for(s<(i=a.childNodes).length?(a=i[s],r=new to(a,e.getParent(a,e.isBlock))):(a=i[i.length-1],(r=new to(a,e.getParent(a,e.isBlock))).next(!0)),o=r.current();o;o=r.next())if(3===o.nodeType&&!Fc(o))return n.setStart(o,0),void t.setRng(n)},getNonWhiteSpaceSibling:function(e,t,n){if(e)for(t=t?"nextSibling":"previousSibling",e=n?e:e[t];e;e=e[t])if(1===e.nodeType||!Fc(e))return e},isTextBlock:function(e,t){return t.nodeType&&(t=t.nodeName),!!e.schema.getTextBlockElements()[t.toLowerCase()]},isValid:function(e,t,n){return e.schema.isValidChild(t,n)},isWhiteSpaceNode:Fc,replaceVars:function(e,t){return"string"!=typeof e?e=e(t):t&&(e=e.replace(/%(\w+)/g,function(e,n){return t[n]||e})),e},isEq:function(e,t){return e=e||"",t=t||"",e=""+(e.nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()},normalizeStyleValue:zc,getStyle:function(e,t,n){return zc(e,e.getStyle(t,n),n)},getTextDecoration:function(e,t){var n;return e.getParent(t,function(t){return(n=e.getStyle(t,"text-decoration"))&&"none"!==n}),n},getParents:function(e,t,n){return e.getParents(t,n,e.getRoot())}},Vc=xs.isBookmarkNode,Hc=Uc.getParents,qc=Uc.isWhiteSpaceNode,jc=Uc.isTextBlock,$c=function(e,t){for(void 0===t&&(t=3===e.nodeType?e.length:e.childNodes.length);e&&e.hasChildNodes();)(e=e.childNodes[t])&&(t=3===e.nodeType?e.length:e.childNodes.length);return{node:e,offset:t}},Wc=function(e,t){for(var n=t;n;){if(1===n.nodeType&&e.getContentEditable(n))return"false"===e.getContentEditable(n)?n:t;n=n.parentNode}return t},Kc=function(e,t,n,r){var o,i,a=n.nodeValue;return void 0===r&&(r=e?a.length:0),e?-1===(o=(o=a.lastIndexOf(" ",r))>(i=a.lastIndexOf("\xa0",r))?o:i)||t||o++:(o=a.indexOf(" ",r),i=a.indexOf("\xa0",r),o=-1!==o&&(-1===i||o<i)?o:i),o},Xc=function(e,t,n,r,o,i){var a,s,u,c;if(3===n.nodeType){if(-1!==(u=Kc(o,i,n,r)))return{container:n,offset:u};c=n}for(a=new to(n,e.getParent(n,e.isBlock)||t);s=a[o?"prev":"next"]();)if(3===s.nodeType){if(c=s,-1!==(u=Kc(o,i,s)))return{container:s,offset:u}}else if(e.isBlock(s))break;if(c)return{container:c,offset:r=o?0:c.length}},Yc=function(e,t,n,r,o){var i,a,s,u;for(3===r.nodeType&&0===r.nodeValue.length&&r[o]&&(r=r[o]),i=Hc(e,r),a=0;a<i.length;a++)for(s=0;s<t.length;s++)if(!("collapsed"in(u=t[s])&&u.collapsed!==n.collapsed)&&e.is(i[a],u.selector))return i[a];return r},Gc=function(e,t,n,r){var o,i=e.dom,a=i.getRoot();if(t[0].wrapper||(o=i.getParent(n,t[0].block,a)),!o){var s=i.getParent(n,"LI,TD,TH");o=i.getParent(3===n.nodeType?n.parentNode:n,function(t){return t!==a&&jc(e,t)},s)}if(o&&t[0].wrapper&&(o=Hc(i,o,"ul,ol").reverse()[0]||o),!o)for(o=n;o[r]&&!i.isBlock(o[r])&&(o=o[r],!Uc.isEq(o,"br")););return o||n},Jc=function(e,t,n,r,o,i,a){var s,u,c,l,f,d;if(s=u=a?n:o,l=a?"previousSibling":"nextSibling",f=e.getRoot(),3===s.nodeType&&!qc(s)&&(a?r>0:i<s.nodeValue.length))return s;for(;;){if(!t[0].block_expand&&e.isBlock(u))return u;for(c=u[l];c;c=c[l])if(!Vc(c)&&!qc(c)&&("BR"!==(d=c).nodeName||!d.getAttribute("data-mce-bogus")||d.nextSibling))return u;if(u===f||u.parentNode===f){s=u;break}u=u.parentNode}return s},Qc=function(e,t,n,r){var o,i=t.startContainer,a=t.startOffset,s=t.endContainer,u=t.endOffset,c=e.dom;return 1===i.nodeType&&i.hasChildNodes()&&3===(i=zi(i,a)).nodeType&&(a=0),1===s.nodeType&&s.hasChildNodes()&&3===(s=zi(s,t.collapsed?u:u-1)).nodeType&&(u=s.nodeValue.length),i=Wc(c,i),s=Wc(c,s),(Vc(i.parentNode)||Vc(i))&&3===(i=(i=Vc(i)?i:i.parentNode).nextSibling||i).nodeType&&(a=0),(Vc(s.parentNode)||Vc(s))&&3===(s=(s=Vc(s)?s:s.parentNode).previousSibling||s).nodeType&&(u=s.length),n[0].inline&&(t.collapsed&&((o=Xc(c,e.getBody(),i,a,!0,r))&&(i=o.container,a=o.offset),(o=Xc(c,e.getBody(),s,u,!1,r))&&(s=o.container,u=o.offset)),s=r?s:function(e,t){var n=$c(e,t);if(n.node){for(;n.node&&0===n.offset&&n.node.previousSibling;)n=$c(n.node.previousSibling);n.node&&n.offset>0&&3===n.node.nodeType&&" "===n.node.nodeValue.charAt(n.offset-1)&&n.offset>1&&(e=n.node).splitText(n.offset-1)}return e}(s,u)),(n[0].inline||n[0].block_expand)&&(n[0].inline&&3===i.nodeType&&0!==a||(i=Jc(c,n,i,a,s,u,!0)),n[0].inline&&3===s.nodeType&&u!==s.nodeValue.length||(s=Jc(c,n,i,a,s,u,!1))),n[0].selector&&!1!==n[0].expand&&!n[0].inline&&(i=Yc(c,n,t,i,"previousSibling"),s=Yc(c,n,t,s,"nextSibling")),(n[0].block||n[0].selector)&&(i=Gc(e,n,i,"previousSibling"),s=Gc(e,n,s,"nextSibling"),n[0].block&&(c.isBlock(i)||(i=Jc(c,n,i,a,s,u,!0)),c.isBlock(s)||(s=Jc(c,n,i,a,s,u,!1)))),1===i.nodeType&&(a=c.nodeIndex(i),i=i.parentNode),1===s.nodeType&&(u=c.nodeIndex(s)+1,s=s.parentNode),{startContainer:i,startOffset:a,endContainer:s,endOffset:u}},Zc=Uc.isEq,el=function(e,t,n){var r=e.formatter.get(n);if(r)for(var o=0;o<r.length;o++)if(!1===r[o].inherit&&e.dom.is(t,r[o].selector))return!0;return!1},tl=function(e,t,n,r){var o=e.dom.getRoot();return t!==o&&(t=e.dom.getParent(t,function(t){return!!el(e,t,n)||t.parentNode===o||!!ol(e,t,n,r,!0)}),ol(e,t,n,r))},nl=function(e,t,n){return!!Zc(t,n.inline)||!!Zc(t,n.block)||(n.selector?1===t.nodeType&&e.is(t,n.selector):void 0)},rl=function(e,t,n,r,o,i){var a,s,u,c=n[r];if(n.onmatch)return n.onmatch(t,n,r);if(c)if("undefined"==typeof c.length){for(a in c)if(c.hasOwnProperty(a)){if(s="attributes"===r?e.getAttrib(t,a):Uc.getStyle(e,t,a),o&&!s&&!n.exact)return;if((!o||n.exact)&&!Zc(s,Uc.normalizeStyleValue(e,Uc.replaceVars(c[a],i),a)))return}}else for(u=0;u<c.length;u++)if("attributes"===r?e.getAttrib(t,c[u]):Uc.getStyle(e,t,c[u]))return n;return n},ol=function(e,t,n,r,o){var i,a,s,u,c=e.formatter.get(n),l=e.dom;if(c&&t)for(a=0;a<c.length;a++)if(i=c[a],nl(e.dom,t,i)&&rl(l,t,i,"attributes",o,r)&&rl(l,t,i,"styles",o,r)){if(u=i.classes)for(s=0;s<u.length;s++)if(!e.dom.hasClass(t,u[s]))return;return i}},il={matchNode:ol,matchName:nl,match:function(e,t,n,r){var o;return r?tl(e,r,t,n):(r=e.selection.getNode(),!!tl(e,r,t,n)||!((o=e.selection.getStart())===r||!tl(e,o,t,n)))},matchAll:function(e,t,n){var r,o=[],i={};return r=e.selection.getStart(),e.dom.getParent(r,function(r){var a,s;for(a=0;a<t.length;a++)s=t[a],!i[s]&&ol(e,r,s,n)&&(i[s]=!0,o.push(s))},e.dom.getRoot()),o},canApply:function(e,t){var n,r,o,i,a,s=e.formatter.get(t),u=e.dom;if(s)for(n=e.selection.getStart(),r=Uc.getParents(u,n),i=s.length-1;i>=0;i--){if(!(a=s[i].selector)||s[i].defaultBlock)return!0;for(o=r.length-1;o>=0;o--)if(u.is(r[o],a))return!0}return!1},matchesUnInheritedFormatSelector:el},al=function(e,t){return e.splitText(t)},sl={split:function(e){var t=e.startContainer,n=e.startOffset,r=e.endContainer,o=e.endOffset;return t===r&&vo.isText(t)?n>0&&n<t.nodeValue.length&&(t=(r=al(t,n)).previousSibling,o>n?(t=r=al(r,o-=n).previousSibling,o=r.nodeValue.length,n=0):o=0):(vo.isText(t)&&n>0&&n<t.nodeValue.length&&(t=al(t,n),n=0),vo.isText(r)&&o>0&&o<r.nodeValue.length&&(o=(r=al(r,o).previousSibling).nodeValue.length)),{startContainer:t,startOffset:n,endContainer:r,endOffset:o}}},ul=oi,cl="_mce_caret",ll=function(e){return 1===e.nodeType&&e.id===cl},fl=function(e){return function(e){for(var t=[];e;){if(3===e.nodeType&&e.nodeValue!==ul||e.childNodes.length>1)return[];1===e.nodeType&&t.push(e),e=e.firstChild}return t}(e).length>0},dl=function(e){var t;if(e)for(e=(t=new to(e,e)).current();e;e=t.next())if(3===e.nodeType)return e;return null},ml=function(e){var t=Hn.fromTag("span");return dr.setAll(t,{id:cl,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&ks.append(t,Hn.fromText(ul)),t},pl=function(e,t){for(;t&&t!==e;){if(t.id===cl)return t;t=t.parentNode}return null},gl=function(e,t,n,r){var o,i,a,s;o=t.getRng(!0),i=e.getParent(n,e.isBlock),fl(n)?(!1!==r&&(o.setStartBefore(n),o.setEndBefore(n)),e.remove(n)):((s=dl(n))&&s.nodeValue.charAt(0)===ul&&s.deleteData(0,1),a=s,o.startContainer===a&&o.startOffset>0&&o.setStart(a,o.startOffset-1),o.endContainer===a&&o.endOffset>0&&o.setEnd(a,o.endOffset-1),e.remove(n,!0)),i&&e.isEmpty(i)&&Is(Hn.fromDom(i)),t.setRng(o)},hl=function(e,t,n,r,o){if(r)gl(t,n,r,o);else if(!(r=pl(e,n.getStart())))for(;r=t.get(cl);)gl(t,n,r,!1)},vl=function(e,t,n){var r=e.dom,o=r.getParent(n,ji.curry(Uc.isTextBlock,e));o&&r.isEmpty(o)?n.parentNode.replaceChild(t,n):(Ps(Hn.fromDom(n)),r.isEmpty(n)?n.parentNode.replaceChild(t,n):r.insertAfter(t,n))},yl=function(e,t){return e.appendChild(t),t},bl=function(e,t){var n=M.foldr(e,function(e,t){return yl(e,t.cloneNode(!1))},t);return yl(n,n.ownerDocument.createTextNode(ul))},Cl=function(e){var t=e.dom,n=e.selection,r=e.getBody();e.on("mouseup keydown",function(e){var o,i,a,s;o=r,i=t,a=n,s=e.keyCode,hl(o,i,a,null,!1),8===s&&a.isCollapsed()&&a.getStart().innerHTML===ul&&hl(o,i,a,pl(o,a.getStart())),37!==s&&39!==s||hl(o,i,a,pl(o,a.getStart()))})},xl=function(e,t,n){var r,o,i,a,s,u,c=e.selection;a=(r=c.getRng(!0)).startOffset,u=r.startContainer.nodeValue,(o=pl(e.getBody(),c.getStart()))&&(i=dl(o));var l,f,d=/[^\s\u00a0\u00ad\u200b\ufeff]/;u&&a>0&&a<u.length&&d.test(u.charAt(a))&&d.test(u.charAt(a-1))?(s=c.getBookmark(),r.collapse(!0),r=Qc(e,r,e.formatter.get(t)),r=sl.split(r),e.formatter.apply(t,n,r),c.moveToBookmark(s)):(o&&i.nodeValue===ul?e.formatter.apply(t,n,o):(l=e.getDoc(),f=ml(!0).dom(),i=(o=l.importNode(f,!0)).firstChild,r.insertNode(o),a=1,e.formatter.apply(t,n,o)),c.setCursorLocation(i,a))},wl=function(e,t,n,r){var o,i,a,s,u,c,l,f=e.dom,d=e.selection,m=[],p=d.getRng();for(o=p.startContainer,i=p.startOffset,u=o,3===o.nodeType&&(i!==o.nodeValue.length&&(s=!0),u=u.parentNode);u;){if(il.matchNode(e,u,t,n,r)){c=u;break}u.nextSibling&&(s=!0),m.push(u),u=u.parentNode}if(c)if(s){a=d.getBookmark(),p.collapse(!0);var g=Qc(e,p,e.formatter.get(t),!0);g=sl.split(g),e.formatter.remove(t,n,g),d.moveToBookmark(a)}else{l=pl(e.getBody(),c);var h=ml(!1).dom(),v=bl(m,h);vl(e,h,l||c),gl(f,d,l,!1),d.setCursorLocation(v,1),f.isEmpty(c)&&f.remove(c)}},Nl=ll,El=pl,Sl=function(e,t){var n=ml(!1),r=bl(t,n.dom());return ks.before(Hn.fromDom(e),n),Bs.remove(Hn.fromDom(e)),ia(r,0)},kl=function(e,t){return e.schema.getTextInlineElements().hasOwnProperty(Zn.name(t))&&!ll(t.dom())&&!vo.isBogus(t.dom())},Tl=function(e,t){for(var n=0;n<e.length;n++){var r=e[n].apply(null,t);if(r.isSome())return r}return E.none()},Al=Qu([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),_l=function(e,t){var n=_a.getParentBlock(t,e);return n||e},Bl=function(e,t,n){var r=vu.normalizeForwards(n),o=_l(t,r.container());return vu.findRootInline(e,o,r).fold(function(){return Ws.nextPosition(o,r).bind(y.curry(vu.findRootInline,e,o)).map(function(e){return Al.before(e)})},E.none)},Rl=function(e,t){return null===El(e,t)},Dl=function(e,t,n){return vu.findRootInline(e,t,n).filter(y.curry(Rl,t))},Ol=function(e,t,n){var r=vu.normalizeBackwards(n);return Dl(e,t,r).bind(function(e){return Ws.prevPosition(e,r).isNone()?E.some(Al.start(e)):E.none()})},Pl=function(e,t,n){var r=vu.normalizeForwards(n);return Dl(e,t,r).bind(function(e){return Ws.nextPosition(e,r).isNone()?E.some(Al.end(e)):E.none()})},Il=function(e,t,n){var r=vu.normalizeBackwards(n),o=_l(t,r.container());return vu.findRootInline(e,o,r).fold(function(){return Ws.prevPosition(o,r).bind(y.curry(vu.findRootInline,e,o)).map(function(e){return Al.after(e)})},E.none)},Ll=function(e){return!1===vu.isRtl(Fl(e))},Ml=function(e,t,n){return Tl([Bl,Ol,Pl,Il],[e,t,n]).filter(Ll)},Fl=function(e){return e.fold(y.identity,y.identity,y.identity,y.identity)},zl=function(e){return e.fold(y.constant("before"),y.constant("start"),y.constant("end"),y.constant("after"))},Ul=function(e){return e.fold(Al.before,Al.before,Al.after,Al.after)},Vl=function(e,t,n,r,o,i){return hs([vu.findRootInline(t,n,r),vu.findRootInline(t,n,o)],function(t,r){return t!==r&&vu.hasSameParentBlock(n,t,r)?Al.after(e?t:r):i}).getOr(i)},Hl=function(e,t){return e.fold(y.constant(!0),function(e){return r=t,!(zl(n=e)===zl(r)&&Fl(n)===Fl(r));var n,r})},ql=function(e,t){return e?t.fold(y.compose(E.some,Al.start),E.none,y.compose(E.some,Al.after),E.none):t.fold(E.none,y.compose(E.some,Al.before),E.none,y.compose(E.some,Al.end))},jl=function(e,t,n,r){var o=vu.normalizePosition(e,r),i=Ml(t,n,o);return Ml(t,n,o).bind(y.curry(ql,e)).orThunk(function(){return o=e,a=t,s=n,u=i,c=r,l=vu.normalizePosition(o,c),Ws.fromPosition(o,s,l).map(y.curry(vu.normalizePosition,o)).fold(function(){return u.map(Ul)},function(e){return Ml(a,s,e).map(y.curry(Vl,o,a,s,l,e)).filter(y.curry(Hl,u))}).filter(Ll);var o,a,s,u,c,l})},$l=Ml,Wl=jl,Kl=(y.curry(jl,!1),y.curry(jl,!0),Ul),Xl=function(e){return e.fold(Al.start,Al.start,Al.end,Al.end)},Yl=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return Yl(n())}}},Gl=function(e){return tr.isFunction(e.selection.getSel().modify)},Jl=function(e,t,n){var r=e?1:-1;return t.setRng(ia(n.container(),n.offset()+r).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0},Ql=function(e,t){var n=t.selection.getRng(),r=e?ia.fromRangeEnd(n):ia.fromRangeStart(n);return!!Gl(t)&&(e&&mi.isBeforeInline(r)?Jl(!0,t.selection,r):!(e||!mi.isAfterInline(r))&&Jl(!1,t.selection,r))},Zl=function(e,t){var n=e.dom.createRng();n.setStart(t.container(),t.offset()),n.setEnd(t.container(),t.offset()),e.selection.setRng(n)},ef=function(e){return!1!==e.settings.inline_boundaries},tf=function(e,t){e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},nf=function(e,t,n){return Lc(t,n).map(function(t){return Zl(e,t),n})},rf=function(e,t,n){return function(){return!!ef(t)&&Ql(e,t)}},of={move:function(e,t,n){return function(){return!!ef(e)&&(r=e,o=t,i=n,a=r.getBody(),s=ia.fromRangeStart(r.selection.getRng()),u=y.curry(vu.isInlineTarget,r),Wl(i,u,a,s).bind(function(e){return nf(r,o,e)})).isSome();var r,o,i,a,s,u}},moveNextWord:y.curry(rf,!0),movePrevWord:y.curry(rf,!1),setupSelectedState:function(e){var t=new Yl(null),n=y.curry(vu.isInlineTarget,e);return e.on("NodeChange",function(r){var o,i,a,s,u;ef(e)&&(o=n,i=e.dom,a=r.parents,s=M.filter(i.select('*[data-mce-selected="inline-boundary"]'),o),u=M.filter(a,o),M.each(M.difference(s,u),y.curry(tf,!1)),M.each(M.difference(u,s),y.curry(tf,!0)),function(e,t){if(e.selection.isCollapsed()&&!0!==e.composing&&t.get()){var n=ia.fromRangeStart(e.selection.getRng());ia.isTextPosition(n)&&!1===vu.isAtZwsp(n)&&(Zl(e,Oc.removeAndReposition(t.get(),n)),t.set(null))}}(e,t),function(e,t,n,r){if(t.selection.isCollapsed()){var o=M.filter(r,e);M.each(o,function(r){var o=ia.fromRangeStart(t.selection.getRng());$l(e,t.getBody(),o).bind(function(e){return nf(t,n,e)})})}}(n,e,t,r.parents))}),t},setCaretPosition:Zl},af=function(e,t){return function(n){return Lc(t,n).map(function(t){return of.setCaretPosition(e,t),!0}).getOr(!1)}},sf=function(e,t,n,r){var o=e.getBody(),i=y.curry(vu.isInlineTarget,e);e.undoManager.ignore(function(){var a,s,u;e.selection.setRng((a=n,s=r,(u=document.createRange()).setStart(a.container(),a.offset()),u.setEnd(s.container(),s.offset()),u)),e.execCommand("Delete"),$l(i,o,ia.fromRangeStart(e.selection.getRng())).map(Xl).map(af(e,t))}),e.nodeChanged()},uf=function(e,t,n,r){var o,i,a=(o=e.getBody(),i=r.container(),_a.getParentBlock(i,o)||o),s=y.curry(vu.isInlineTarget,e),u=$l(s,a,r);return u.bind(function(e){return n?e.fold(y.constant(E.some(Xl(e))),E.none,y.constant(E.some(Kl(e))),E.none):e.fold(E.none,y.constant(E.some(Kl(e))),E.none,y.constant(E.some(Xl(e))))}).map(af(e,t)).getOrThunk(function(){var o=Ws.navigate(n,a,r),i=o.bind(function(e){return $l(s,a,e)});return u.isSome()&&i.isSome()?vu.findRootInline(s,a,r).map(function(t){return r=t,!!hs([Ws.firstPositionIn(r),Ws.lastPositionIn(r)],function(e,t){var n=vu.normalizePosition(!0,e),o=vu.normalizePosition(!1,t);return Ws.nextPosition(r,n).map(function(e){return e.isEqual(o)}).getOr(!0)}).getOr(!0)&&(mc(e,n,Hn.fromDom(t)),!0);var r}).getOr(!1):i.bind(function(i){return o.map(function(o){return n?sf(e,t,r,o):sf(e,t,o,r),!0})}).getOr(!1)})},cf=function(e,t,n){if(e.selection.isCollapsed()&&!1!==e.settings.inline_boundaries){var r=ia.fromRangeStart(e.selection.getRng());return uf(e,t,n,r)}return!1},lf=xr("start","end"),ff=xr("rng","table","cells"),df=Qu([{removeTable:["element"]},{emptyCells:["cells"]}]),mf=function(e,t){return Eu(Hn.fromDom(e),"td,th",t)},pf=function(e,t){return wu(e,"table",t)},gf=function(e){return!1===Dr.eq(e.start(),e.end())},hf=function(e,t){return(n=e,r=t,pf(n.start(),r).bind(function(e){return pf(n.end(),r).bind(function(t){return Dr.eq(e,t)?E.some(e):E.none()})})).bind(function(t){var n=Os(t,"td,th");return ff(e,t,n)});var n,r},vf=function(e,t){var n,r,o=y.curry(Dr.eq,e);return(n=t,r=o,hs([mf(n.startContainer,r),mf(n.endContainer,r)],lf).filter(gf)).map(function(e){return hf(e,o)})},yf=function(e,t){return M.findIndex(e,function(e){return Dr.eq(e,t)})},bf=function(e){return(t=e,hs([yf(t.cells(),t.rng().start()),yf(t.cells(),t.rng().end())],function(e,n){return t.cells().slice(e,n+1)})).bind(function(t){var n=e.cells();return t.length===n.length?df.removeTable(e.table()):df.emptyCells(t)});var t},Cf=function(e,t){return vf(e,t).map(bf)},xf=function(e){var t=[];if(e)for(var n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t},wf=xf,Nf=function(e){return M.bind(e,function(e){var t=Fi(e);return t?[Hn.fromDom(t)]:[]})},Ef=function(e){return xf(e).length>1},Sf=function(e){return M.filter(Nf(e),io.isTableCell)},kf=function(e){return Os(e,"td[data-mce-selected],th[data-mce-selected]")},Tf=function(e,t){var n=kf(t),r=Sf(e);return n.length>0?n:r},Af=Tf,_f=function(e){return Tf(wf(e.selection.getSel()),Hn.fromDom(e.getBody()))},Bf=function(e,t){return M.each(t,Is),e.selection.setCursorLocation(t[0].dom(),0),!0},Rf=function(e,t){return mc(e,!1,t),!0},Df=function(e,t,n,r){return Pf(t,r).fold(function(){return r=e,Cf(t,n).map(function(e){return e.fold(y.curry(Rf,r),y.curry(Bf,r))});var r},function(t){return If(e,t)}).getOr(!1)},Of=function(e,t){return M.find(Uu(t,e),io.isTableCell)},Pf=function(e,t){return M.find(Uu(t,e),function(e){return"caption"===Zn.name(e)})},If=function(e,t){return Is(t),e.selection.setCursorLocation(t.dom(),0),E.some(!0)},Lf=function(e,t,n,r,o){return Ws.navigate(n,e.getBody(),o).bind(function(i){return u=r,c=n,l=o,f=i,Ws.firstPositionIn(u.dom()).bind(function(e){return Ws.lastPositionIn(u.dom()).map(function(t){return c?l.isEqual(e)&&f.isEqual(t):l.isEqual(t)&&f.isEqual(e)})}).getOr(!0)?If(e,r):(a=r,s=i,Pf(t,Hn.fromDom(s.getNode())).map(function(e){return!1===Dr.eq(e,a)}));var a,s,u,c,l,f}).or(E.some(!0))},Mf=function(e,t,n,r){var o=ia.fromRangeStart(e.selection.getRng());return Of(n,r).bind(function(r){return Ru(r)?If(e,r):(i=e,a=n,s=t,u=r,c=o,Ws.navigate(s,i.getBody(),c).bind(function(e){return Of(a,Hn.fromDom(e.getNode())).map(function(e){return!1===Dr.eq(e,u)})}));var i,a,s,u,c})},Ff=function(e,t,n){var r=Hn.fromDom(e.getBody());return Pf(r,n).fold(function(){return Mf(e,t,r,n)},function(n){return o=e,i=t,a=r,s=n,u=ia.fromRangeStart(o.selection.getRng()),Ru(s)?If(o,s):Lf(o,a,i,s,u);var o,i,a,s,u}).getOr(!1)},zf=function(e,t){var n,r,o,i,a,s=Hn.fromDom(e.selection.getStart(!0));return e.selection.isCollapsed()?Ff(e,t,s):(n=e,r=s,o=Hn.fromDom(n.getBody()),i=n.selection.getRng(),0!==(a=_f(n)).length?Bf(n,a):Df(n,o,i,r))},Uf=function(e,t){e.getDoc().execCommand(t,!1,null)},Vf=function(e){hc(e,!1)||cf(e,!1)||Ku(e,!1)||zf(e)||Ju(e,!1)||(Uf(e,"Delete"),bu(e))},Hf=function(e){hc(e,!0)||cf(e,!0)||Ku(e,!0)||zf(e)||Ju(e,!0)||Uf(e,"ForwardDelete")},qf=function(e,t){return e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset},jf=xr("container","offset"),$f=function(e,t,n){return null!==function(e,t,n){for(;e&&e!==t;){if(n(e))return e;e=e.parentNode}return null}(e,t,n)},Wf=function(e,t,n){return $f(e,t,function(e){return e.nodeName===n})},Kf=function(e){return e&&"TABLE"===e.nodeName},Xf=function(e,t,n){for(var r=new to(t,e.getParent(t.parentNode,e.isBlock)||e.getRoot());t=r[n?"prev":"next"]();)if(vo.isBr(t))return!0},Yf=function(e,t,n,r,o){var i,a,s,u,c,l,f=e.getRoot(),d=e.schema.getNonEmptyElements();if(s=e.getParent(o.parentNode,e.isBlock)||f,r&&vo.isBr(o)&&t&&e.isEmpty(s))return E.some(jf(o.parentNode,e.nodeIndex(o)));for(i=new to(o,s);u=i[r?"prev":"next"]();){if("false"===e.getContentEditableParent(u)||(c=u,l=f,mi.isCaretContainer(c)&&!1===$f(c,l,Nl)))return E.none();if(vo.isText(u)&&u.nodeValue.length>0)return!1===Wf(u,f,"A")?E.some(jf(u,r?u.nodeValue.length:0)):E.none();if(e.isBlock(u)||d[u.nodeName.toLowerCase()])return E.none();a=u}return n&&a?E.some(jf(a,0)):E.none()},Gf=function(e,t,n,r){var o,i,a,s,u,c,l,f,d,m,p=e.getRoot(),g=!1;if(o=r[(n?"start":"end")+"Container"],i=r[(n?"start":"end")+"Offset"],l=vo.isElement(o)&&i===o.childNodes.length,u=e.schema.getNonEmptyElements(),c=n,mi.isCaretContainer(o))return E.none();if(vo.isElement(o)&&i>o.childNodes.length-1&&(c=!1),vo.isDocument(o)&&(o=p,i=0),o===p){if(c&&(s=o.childNodes[i>0?i-1:0])){if(mi.isCaretContainer(s))return E.none();if(u[s.nodeName]||Kf(s))return E.none()}if(o.hasChildNodes()){if(i=Math.min(!c&&i>0?i-1:i,o.childNodes.length-1),o=o.childNodes[i],i=vo.isText(o)&&l?o.data.length:0,!t&&o===p.lastChild&&Kf(o))return E.none();if(function(e,t){for(;t&&t!==e;){if(vo.isContentEditableFalse(t))return!0;t=t.parentNode}return!1}(p,o)||mi.isCaretContainer(o))return E.none();if(o.hasChildNodes()&&!1===Kf(o)){s=o,a=new to(o,p);do{if(vo.isContentEditableFalse(s)||mi.isCaretContainer(s)){g=!1;break}if(vo.isText(s)&&s.nodeValue.length>0){i=c?0:s.nodeValue.length,o=s,g=!0;break}if(u[s.nodeName.toLowerCase()]&&(!(f=s)||!/^(TD|TH|CAPTION)$/.test(f.nodeName))){i=e.nodeIndex(s),o=s.parentNode,"IMG"!==s.nodeName&&"PRE"!==s.nodeName||c||i++,g=!0;break}}while(s=c?a.next():a.prev())}}}return t&&(vo.isText(o)&&0===i&&Yf(e,l,t,!0,o).each(function(e){o=e.container(),i=e.offset(),g=!0}),vo.isElement(o)&&((s=o.childNodes[i])||(s=o.childNodes[i-1]),!s||!vo.isBr(s)||(m="A",(d=s).previousSibling&&d.previousSibling.nodeName===m)||Xf(e,s,!1)||Xf(e,s,!0)||Yf(e,l,t,!0,s).each(function(e){o=e.container(),i=e.offset(),g=!0}))),c&&!t&&vo.isText(o)&&i===o.nodeValue.length&&Yf(e,l,t,!1,o).each(function(e){o=e.container(),i=e.offset(),g=!0}),g?E.some(jf(o,i)):E.none()},Jf={normalize:function(e,t){var n=t.collapsed,r=t.cloneRange();return Gf(e,n,!0,r).each(function(e){r.setStart(e.container(),e.offset())}),n||Gf(e,n,!1,r).each(function(e){r.setEnd(e.container(),e.offset())}),n&&r.collapse(!0),qf(t,r)?E.none():E.some(r)}},Qf=function(e,t,n){var r=e.create("span",{},"&nbsp;");n.parentNode.insertBefore(r,n),t.scrollIntoView(r),e.remove(r)},Zf=function(e,t,n,r){var o=e.createRng();r?(o.setStartBefore(n),o.setEndBefore(n)):(o.setStartAfter(n),o.setEndAfter(n)),t.setRng(o)},ed=function(e,t){var n,r,o=e.selection,i=e.dom,a=o.getRng();Jf.normalize(i,a).each(function(e){a.setStart(e.startContainer,e.startOffset),a.setEnd(e.endContainer,e.endOffset)});var s=a.startOffset,u=a.startContainer;if(1===u.nodeType&&u.hasChildNodes()){var c=s>u.childNodes.length-1;u=u.childNodes[Math.min(s,u.childNodes.length-1)]||u,s=c&&3===u.nodeType?u.nodeValue.length:0}var l=i.getParent(u,i.isBlock),f=l?i.getParent(l.parentNode,i.isBlock):null,d=f?f.nodeName.toUpperCase():"",m=t&&t.ctrlKey;"LI"!==d||m||(l=f),u&&3===u.nodeType&&s>=u.nodeValue.length&&(function(e,t,n){for(var r,o=new to(t,n),i=e.getNonEmptyElements();r=o.next();)if(i[r.nodeName.toLowerCase()]||r.length>0)return!0}(e.schema,u,l)||(n=i.create("br"),a.insertNode(n),a.setStartAfter(n),a.setEndAfter(n),r=!0)),n=i.create("br"),a.insertNode(n),Qf(i,o,n),Zf(i,o,n,r),e.undoManager.add()},td=function(e,t){var n=Hn.fromTag("br");ks.before(Hn.fromDom(t),n),e.undoManager.add()},nd=function(e,t){rd(e.getBody(),t)||ks.after(Hn.fromDom(t),Hn.fromTag("br"));var n=Hn.fromTag("br");ks.after(Hn.fromDom(t),n),Qf(e.dom,e.selection,n.dom()),Zf(e.dom,e.selection,n.dom(),!1),e.undoManager.add()},rd=function(e,t){return n=ia.after(t),!!vo.isBr(n.getNode())||Ws.nextPosition(e,ia.after(t)).map(function(e){return vo.isBr(e.getNode())}).getOr(!1);var n},od=function(e){return e&&"A"===e.nodeName&&"href"in e},id=function(e){return e.fold(y.constant(!1),od,od,y.constant(!1))},ad=function(e,t){t.fold(y.noop,y.curry(td,e),y.curry(nd,e),y.noop)},sd=function(e,t){var n,r,o,i=(n=e,r=y.curry(vu.isInlineTarget,n),o=ia.fromRangeStart(n.selection.getRng()),$l(r,n.getBody(),o).filter(id));i.isSome()?i.each(y.curry(ad,e)):ed(e,t)},ud=Qu([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),cd=(ud.before,ud.on,ud.after,function(e){return e.fold(y.identity,y.identity,y.identity)}),ld=Qu([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),fd=xr("start","soffset","finish","foffset"),dd={domRange:ld.domRange,relative:ld.relative,exact:ld.exact,exactFromRange:function(e){return ld.exact(e.start(),e.soffset(),e.finish(),e.foffset())},range:fd,getWin:function(e){var t=e.match({domRange:function(e){return Hn.fromDom(e.startContainer)},relative:function(e,t){return cd(e)},exact:function(e,t,n,r){return e}});return Ur.defaultView(t)}},md=Un.detect().browser,pd=function(e,t){var n=Zn.isText(t)?Ds(t).length:Ur.children(t).length+1;return e>n?n:e<0?0:e},gd=function(e){return dd.range(e.start(),pd(e.soffset(),e.start()),e.finish(),pd(e.foffset(),e.finish()))},hd=function(e,t){return Dr.contains(e,t)||Dr.eq(e,t)},vd=function(e){return function(t){return hd(e,t.start())&&hd(e,t.finish())}},yd=function(e){return!0===e.inline||md.isIE()},bd=function(e){return dd.range(Hn.fromDom(e.startContainer),e.startOffset,Hn.fromDom(e.endContainer),e.endOffset)},Cd=function(e){var t=e.getSelection();return(t&&0!==t.rangeCount?E.from(t.getRangeAt(0)):E.none()).map(bd)},xd=function(e){var t=Ur.defaultView(e);return Cd(t.dom()).filter(vd(e))},wd=function(e,t){return E.from(t).filter(vd(e)).map(gd)},Nd=function(e){var t=document.createRange();return t.setStart(e.start().dom(),e.soffset()),t.setEnd(e.finish().dom(),e.foffset()),E.some(t)},Ed=function(e){return(e.bookmark?e.bookmark:E.none()).bind(y.curry(wd,Hn.fromDom(e.getBody()))).bind(Nd)},Sd=function(e){var t=yd(e)?xd(Hn.fromDom(e.getBody())):E.none();e.bookmark=t.isSome()?t:e.bookmark},kd=function(e){Ed(e).each(function(t){e.selection.setRng(t)})},Td=Ed,Ad=Ot.each,_d=Ot.extend,Bd=Ot.map,Rd=Ot.inArray,Dd=Ot.explode,Od=function(e){var t,n,r,o,i={state:{},exec:{},value:{}},a=e.settings;e.on("PreInit",function(){t=e.dom,n=e.selection,a=e.settings,r=e.formatter});var s=function(t){var n;if(!e.quirks.isHidden()&&!e.removed){if(t=t.toLowerCase(),n=i.state[t])return n(t);try{return e.getDoc().queryCommandState(t)}catch(r){}return!1}},u=function(e,t){t=t||"exec",Ad(e,function(e,n){Ad(n.toLowerCase().split(","),function(n){i[t][n]=e})})};_d(this,{execCommand:function(t,n,r,o){var a,s,u=!1;if(!e.removed){if(/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(t)||o&&o.skip_focus?kd(e):e.focus(),(o=e.fire("BeforeExecCommand",{command:t,ui:n,value:r})).isDefaultPrevented())return!1;if(s=t.toLowerCase(),a=i.exec[s])return a(s,n,r),e.fire("ExecCommand",{command:t,ui:n,value:r}),!0;if(Ad(e.plugins,function(o){if(o.execCommand&&o.execCommand(t,n,r))return e.fire("ExecCommand",{command:t,ui:n,value:r}),u=!0,!1}),u)return u;if(e.theme&&e.theme.execCommand&&e.theme.execCommand(t,n,r))return e.fire("ExecCommand",{command:t,ui:n,value:r}),!0;try{u=e.getDoc().execCommand(t,n,r)}catch(c){}return!!u&&(e.fire("ExecCommand",{command:t,ui:n,value:r}),!0)}},queryCommandState:s,queryCommandValue:function(t){var n;if(!e.quirks.isHidden()&&!e.removed){if(t=t.toLowerCase(),n=i.value[t])return n(t);try{return e.getDoc().queryCommandValue(t)}catch(r){}}},queryCommandSupported:function(t){if(t=t.toLowerCase(),i.exec[t])return!0;try{return e.getDoc().queryCommandSupported(t)}catch(n){}return!1},addCommands:u,addCommand:function(t,n,r){t=t.toLowerCase(),i.exec[t]=function(t,o,i,a){return n.call(r||e,o,i,a)}},addQueryStateHandler:function(t,n,r){t=t.toLowerCase(),i.state[t]=function(){return n.call(r||e)}},addQueryValueHandler:function(t,n,r){t=t.toLowerCase(),i.value[t]=function(){return n.call(r||e)}},hasCustomCommand:function(e){return e=e.toLowerCase(),!!i.exec[e]}});var c=function(t,n,r){return n===undefined&&(n=!1),r===undefined&&(r=null),e.getDoc().execCommand(t,n,r)},l=function(e){return r.match(e)},f=function(t,n){r.toggle(t,n?{value:n}:undefined),e.nodeChanged()},d=function(e){o=n.getBookmark(e)},m=function(){n.moveToBookmark(o)};u({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){e.undoManager.add()},"Cut,Copy,Paste":function(t){var n,r=e.getDoc();try{c(t)}catch(i){n=!0}if("paste"!==t||r.queryCommandEnabled(t)||(n=!0),n||!r.queryCommandSupported(t)){var o=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");me.mac&&(o=o.replace(/Ctrl\+/g,"\u2318+")),e.notificationManager.open({text:o,type:"error"})}},unlink:function(){if(n.isCollapsed()){var t=e.dom.getParent(e.selection.getStart(),"a");t&&e.dom.remove(t,!0)}else r.remove("link")},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone":function(e){var t=e.substring(7);"full"===t&&(t="justify"),Ad("left,center,right,justify".split(","),function(e){t!==e&&r.remove("align"+e)}),"none"!==t&&f("align"+t)},"InsertUnorderedList,InsertOrderedList":function(e){var r,o;c(e),(r=t.getParent(n.getNode(),"ol,ul"))&&(o=r.parentNode,/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)&&(d(),t.split(o,r),m()))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){f(e)},"ForeColor,HiliteColor,FontName":function(e,t,n){f(e,n)},FontSize:function(e,t,n){var r,o;n>=1&&n<=7&&(o=Dd(a.font_size_style_values),n=(r=Dd(a.font_size_classes))?r[n-1]||n:o[n-1]||n),f(e,n)},RemoveFormat:function(e){r.remove(e)},mceBlockQuote:function(){f("blockquote")},FormatBlock:function(e,t,n){return f(n||"p")},mceCleanup:function(){var t=n.getBookmark();e.setContent(e.getContent({cleanup:!0}),{cleanup:!0}),n.moveToBookmark(t)},mceRemoveNode:function(t,r,o){var i=o||n.getNode();i!==e.getBody()&&(d(),e.dom.remove(i,!0),m())},mceSelectNodeDepth:function(r,o,i){var a=0;t.getParent(n.getNode(),function(e){if(1===e.nodeType&&a++===i)return n.select(e),!1},e.getBody())},mceSelectNode:function(e,t,r){n.select(r)},mceInsertContent:function(t,n,r){Js(e,r)},mceInsertRawHTML:function(t,r,o){n.setContent("tiny_mce_marker"),e.setContent(e.getContent().replace(/tiny_mce_marker/g,function(){return o}))},mceToggleFormat:function(e,t,n){f(n)},mceSetContent:function(t,n,r){e.setContent(r)},"Indent,Outdent":function(o){var i,u,l;i=a.indentation,u=/[a-z%]+$/i.exec(i),i=parseInt(i,10),s("InsertUnorderedList")||s("InsertOrderedList")?c(o):(a.forced_root_block||t.getParent(n.getNode(),t.isBlock)||r.apply("div"),Ad(n.getSelectedBlocks(),function(n){if("false"!==t.getContentEditable(n)&&"LI"!==n.nodeName){var r=e.getParam("indent_use_margin",!1)?"margin":"padding";r="TABLE"===n.nodeName?"margin":r,r+="rtl"===t.getStyle(n,"direction",!0)?"Right":"Left","outdent"===o?(l=Math.max(0,parseInt(n.style[r]||0,10)-i),t.setStyle(n,r,l?l+u:"")):(l=parseInt(n.style[r]||0,10)+i+u,t.setStyle(n,r,l))}}))},mceRepaint:function(){},InsertHorizontalRule:function(){e.execCommand("mceInsertContent",!1,"<hr />")},mceToggleVisualAid:function(){e.hasVisual=!e.hasVisual,e.addVisual()},mceReplaceContent:function(t,r,o){e.execCommand("mceInsertContent",!1,o.replace(/\{\$selection\}/g,n.getContent({format:"text"})))},mceInsertLink:function(e,o,i){var a;"string"==typeof i&&(i={href:i}),a=t.getParent(n.getNode(),"a"),i.href=i.href.replace(" ","%20"),a&&i.href||r.remove("link"),i.href&&r.apply("link",i,a)},selectAll:function(){var e=t.getParent(n.getStart(),vo.isContentEditableTrue);if(e){var r=t.createRng();r.selectNodeContents(e),n.setRng(r)}},"delete":function(){Vf(e)},forwardDelete:function(){Hf(e)},mceNewDocument:function(){e.setContent("")},InsertLineBreak:function(t,n,r){return sd(e,r),!0}}),u({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(e){var o="align"+e.substring(7),i=n.isCollapsed()?[t.getParent(n.getNode(),t.isBlock)]:n.getSelectedBlocks(),a=Bd(i,function(e){return!!r.matchNode(e,o)});return-1!==Rd(a,!0)},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){return l(e)},mceBlockQuote:function(){return l("blockquote")},Outdent:function(){var e;if(a.inline_styles){if((e=t.getParent(n.getStart(),t.isBlock))&&parseInt(e.style.paddingLeft,10)>0)return!0;if((e=t.getParent(n.getEnd(),t.isBlock))&&parseInt(e.style.paddingLeft,10)>0)return!0}return s("InsertUnorderedList")||s("InsertOrderedList")||!a.inline_styles&&!!t.getParent(n.getNode(),"BLOCKQUOTE")},"InsertUnorderedList,InsertOrderedList":function(e){var r=t.getParent(n.getNode(),"ul,ol");return r&&("insertunorderedlist"===e&&"UL"===r.tagName||"insertorderedlist"===e&&"OL"===r.tagName)}},"state"),u({"FontSize,FontName":function(e){var r,o=0;return(r=t.getParent(n.getNode(),"span"))&&(o="fontsize"===e?r.style.fontSize:r.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()),o}},"value"),u({Undo:function(){e.undoManager.undo()},Redo:function(){e.undoManager.redo()}})},Pd=Ot.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend"," "),Id=function(e){var t,n,r=this,o={},i=function(){return!1},a=function(){return!0};t=(e=e||{}).scope||r,n=e.toggleEvent||i;var s=function(e,t,a,s){var u,c,l;if(!1===t&&(t=i),t)for(t={func:t},s&&Ot.extend(t,s),l=(c=e.toLowerCase().split(" ")).length;l--;)e=c[l],(u=o[e])||(u=o[e]=[],n(e,!0)),a?u.unshift(t):u.push(t);return r},u=function(e,t){var i,a,s,u,c;if(e)for(i=(u=e.toLowerCase().split(" ")).length;i--;){if(e=u[i],a=o[e],!e){for(s in o)n(s,!1),delete o[s];return r}if(a){if(t)for(c=a.length;c--;)a[c].func===t&&(a=a.slice(0,c).concat(a.slice(c+1)),o[e]=a);else a.length=0;a.length||(n(e,!1),delete o[e])}}else{for(e in o)n(e,!1);o={}}return r};r.fire=function(n,r){var s,c,l,f;if(n=n.toLowerCase(),(r=r||{}).type=n,r.target||(r.target=t),r.preventDefault||(r.preventDefault=function(){r.isDefaultPrevented=a},r.stopPropagation=function(){r.isPropagationStopped=a},r.stopImmediatePropagation=function(){r.isImmediatePropagationStopped=a},r.isDefaultPrevented=i,r.isPropagationStopped=i,r.isImmediatePropagationStopped=i),e.beforeFire&&e.beforeFire(r),s=o[n])for(c=0,l=s.length;c<l;c++){if((f=s[c]).once&&u(n,f.func),r.isImmediatePropagationStopped())return r.stopPropagation(),r;if(!1===f.func.call(t,r))return r.preventDefault(),r}return r},r.on=s,r.off=u,r.once=function(e,t,n){return s(e,t,n,{once:!0})},r.has=function(e){return e=e.toLowerCase(),!(!o[e]||0===o[e].length)}};Id.isNative=function(e){return!!Pd[e.toLowerCase()]};var Ld,Md=function(e){return e._eventDispatcher||(e._eventDispatcher=new Id({scope:e,toggleEvent:function(t,n){Id.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,n)}})),e._eventDispatcher},Fd={fire:function(e,t,n){if(this.removed&&"remove"!==e)return t;if(t=Md(this).fire(e,t,n),!1!==n&&this.parent)for(var r=this.parent();r&&!t.isPropagationStopped();)r.fire(e,t,!1),r=r.parent();return t},on:function(e,t,n){return Md(this).on(e,t,n)},off:function(e,t){return Md(this).off(e,t)},once:function(e,t){return Md(this).once(e,t)},hasEventListeners:function(e){return Md(this).has(e)}},zd=Xo.DOM,Ud=function(e,t){return"selectionchange"===t?e.getDoc():!e.inline&&/^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(t)?e.getDoc().documentElement:e.settings.event_root?(e.eventRoot||(e.eventRoot=zd.select(e.settings.event_root)[0]),e.eventRoot):e.getBody()},Vd=function(e,t){var n,r,o=function(e){return!e.hidden&&!e.readonly};if(e.delegates||(e.delegates={}),!e.delegates[t]&&!e.removed)if(n=Ud(e,t),e.settings.event_root){if(Ld||(Ld={},e.editorManager.on("removeEditor",function(){var t;if(!e.editorManager.activeEditor&&Ld){for(t in Ld)e.dom.unbind(Ud(e,t));Ld=null}})),Ld[t])return;r=function(n){for(var r=n.target,i=e.editorManager.get(),a=i.length;a--;){var s=i[a].getBody();(s===r||zd.isChildOf(r,s))&&o(i[a])&&i[a].fire(t,n)}},Ld[t]=r,zd.bind(n,t,r)}else r=function(n){o(e)&&e.fire(t,n)},zd.bind(n,t,r),e.delegates[t]=r},Hd={bindPendingEventDelegates:function(){var e=this;Ot.each(e._pendingNativeEvents,function(t){Vd(e,t)})},toggleNativeEvent:function(e,t){var n=this;"focus"!==e&&"blur"!==e&&(t?n.initialized?Vd(n,e):n._pendingNativeEvents?n._pendingNativeEvents.push(e):n._pendingNativeEvents=[e]:n.initialized&&(n.dom.unbind(Ud(n,e),e,n.delegates[e]),delete n.delegates[e]))},unbindAllNativeEvents:function(){var e,t=this;if(t.delegates){for(e in t.delegates)t.dom.unbind(Ud(t,e),e,t.delegates[e]);delete t.delegates}t.inline||(t.getBody().onload=null,t.dom.unbind(t.getWin()),t.dom.unbind(t.getDoc())),t.dom.unbind(t.getBody()),t.dom.unbind(t.getContainer())}},qd=Hd=Ot.extend({},Fd,Hd),jd=function(e,t,n){try{e.getDoc().execCommand(t,!1,n)}catch(r){}},$d=function(e,t){var n,r,o;e._clickBlocker&&(e._clickBlocker.unbind(),e._clickBlocker=null),t?(e._clickBlocker=(r=(n=e).getBody(),o=function(e){n.dom.getParents(e.target,"a").length>0&&e.preventDefault()},n.dom.bind(r,"click",o),{unbind:function(){n.dom.unbind(r,"click",o)}}),e.selection.controlSelection.hideResizeRect(),e.readonly=!0,e.getBody().contentEditable=!1):(e.readonly=!1,e.getBody().contentEditable=!0,jd(e,"StyleWithCSS",!1),jd(e,"enableInlineTableEditing",!1),jd(e,"enableObjectResizing",!1),e.focus(),e.nodeChanged())},Wd=function(e,t){var n=e.readonly?"readonly":"design";t!==n&&(e.initialized?$d(e,"readonly"===t):e.on("init",function(){$d(e,"readonly"===t)}),e.fire("SwitchMode",{mode:t}))},Kd=Ot.each,Xd=Ot.explode,Yd={f9:120,f10:121,f11:122},Gd=Ot.makeMap("alt,ctrl,shift,meta,access"),Jd=function(e){var t={},n=[],r=function(e){var t,n,r={};for(n in Kd(Xd(e,"+"),function(e){e in Gd?r[e]=!0:/^[0-9]{2,}$/.test(e)?r.keyCode=parseInt(e,10):(r.charCode=e.charCodeAt(0),r.keyCode=Yd[e]||e.toUpperCase().charCodeAt(0))}),t=[r.keyCode],Gd)r[n]?t.push(n):r[n]=!1;return r.id=t.join(","),r.access&&(r.alt=!0,me.mac?r.ctrl=!0:r.shift=!0),r.meta&&(me.mac?r.meta=!0:(r.ctrl=!0,r.meta=!1)),r},o=function(t,n,o,i){var a;return(a=Ot.map(Xd(t,">"),r))[a.length-1]=Ot.extend(a[a.length-1],{func:o,scope:i||e}),Ot.extend(a[0],{desc:e.translate(n),subpatterns:a.slice(1)})},i=function(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)},a=function(e){return e.func?e.func.call(e.scope):null};e.on("keyup keypress keydown",function(e){var r,o;((o=e).altKey||o.ctrlKey||o.metaKey||"keydown"===(r=e).type&&r.keyCode>=112&&r.keyCode<=123)&&!e.isDefaultPrevented()&&(Kd(t,function(t){if(i(e,t))return n=t.subpatterns.slice(0),"keydown"===e.type&&a(t),!0}),i(e,n[0])&&(1===n.length&&"keydown"===e.type&&a(n[0]),n.shift()))}),this.add=function(n,r,i,a){var s;return s=i,"string"==typeof i?i=function(){e.execCommand(s,!1,null)}:Ot.isArray(s)&&(i=function(){e.execCommand(s[0],s[1],s[2])}),Kd(Xd(Ot.trim(n.toLowerCase())),function(e){var n=o(e,r,i,a);t[n.id]=n}),!0},this.remove=function(e){var n=o(e);return!!t[n.id]&&(delete t[n.id],!0)}},Qd=Ot.each,Zd=function(e,t,n){var r,o,i,a,s=1;for(a=e.getShortEndedElements(),(i=/<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g).lastIndex=r=n;o=i.exec(t);){if(r=i.lastIndex,"/"===o[1])s--;else if(!o[1]){if(o[2]in a)continue;s++}if(0===s)break}return r},em=function(e,t){var n=this,r=function(){};e=e||{},n.schema=t=t||Fo(),!1!==e.fix_self_closing&&(e.fix_self_closing=!0),Qd("comment cdata text start end pi doctype".split(" "),function(t){t&&(n[t]=e[t]||r)}),n.parse=function(n){var r,o,i,a,s,u,c,l,f,d,m,p,g,h,v,y,b,C,x,w,N,E,S,k,T,A,_,B,R,D=this,O=0,P=[],I=0,L=Ao.decode,M=Ot.makeMap("src,href,data,background,formaction,poster"),F=/((java|vb)script|mhtml):/i,z=/^data:/i,U=function(e){var t,n;for(t=P.length;t--&&P[t].name!==e;);if(t>=0){for(n=P.length-1;n>=t;n--)(e=P[n]).valid&&D.end(e.name);P.length=t}},V=function(t,n,r,o,i){var s,u,c;if(r=(n=n.toLowerCase())in m?n:L(r||o||i||""),g&&!l&&0==(0===(c=n).indexOf("data-")||0===c.indexOf("aria-"))){if(!(s=C[n])&&x){for(u=x.length;u--&&!(s=x[u]).pattern.test(n););-1===u&&(s=null)}if(!s)return;if(s.validValues&&!(r in s.validValues))return}if(M[n]&&!e.allow_script_urls){var f=r.replace(/[\s\u0000-\u001F]+/g,"");try{f=decodeURIComponent(f)}catch(d){f=unescape(f)}if(F.test(f))return;if(!e.allow_html_data_urls&&z.test(f)&&!/^data:image\//i.test(f))return}l&&(n in M||0===n.indexOf("on"))||(a.map[n]=r,a.push({name:n,value:r}))};for(T=new RegExp("<(?:(?:!--([\\w\\W]*?)--\x3e)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))","g"),A=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g,d=t.getShortEndedElements(),k=e.self_closing_elements||t.getSelfClosingElements(),m=t.getBoolAttrs(),g=e.validate,f=e.remove_internals,R=e.fix_self_closing,_=t.getSpecialElements(),S=n+">";r=T.exec(S);){if(O<r.index&&D.text(L(n.substr(O,r.index-O))),o=r[6])":"===(o=o.toLowerCase()).charAt(0)&&(o=o.substr(1)),U(o);else if(o=r[7]){if(r.index+r[0].length>n.length){D.text(L(n.substr(r.index))),O=r.index+r[0].length;continue}if(":"===(o=o.toLowerCase()).charAt(0)&&(o=o.substr(1)),p=o in d,R&&k[o]&&P.length>0&&P[P.length-1].name===o&&U(o),!g||(h=t.getElementRule(o))){if(v=!0,g&&(C=h.attributes,x=h.attributePatterns),(b=r[8])?((l=-1!==b.indexOf("data-mce-type"))&&f&&(v=!1),(a=[]).map={},b.replace(A,V)):(a=[]).map={},g&&!l){if(w=h.attributesRequired,N=h.attributesDefault,E=h.attributesForced,h.removeEmptyAttrs&&!a.length&&(v=!1),E)for(s=E.length;s--;)c=(y=E[s]).name,"{$uid}"===(B=y.value)&&(B="mce_"+I++),a.map[c]=B,a.push({name:c,value:B});if(N)for(s=N.length;s--;)(c=(y=N[s]).name)in a.map||("{$uid}"===(B=y.value)&&(B="mce_"+I++),a.map[c]=B,a.push({name:c,value:B}));if(w){for(s=w.length;s--&&!(w[s]in a.map););-1===s&&(v=!1)}if(y=a.map["data-mce-bogus"]){if("all"===y){O=Zd(t,n,T.lastIndex),T.lastIndex=O;continue}v=!1}}v&&D.start(o,a,p)}else v=!1;if(i=_[o]){i.lastIndex=O=r.index+r[0].length,(r=i.exec(n))?(v&&(u=n.substr(O,r.index-O)),O=r.index+r[0].length):(u=n.substr(O),O=n.length),v&&(u.length>0&&D.text(u,!0),D.end(o)),T.lastIndex=O;continue}p||(b&&b.indexOf("/")===b.length-1?v&&D.end(o):P.push({name:o,valid:v}))}else(o=r[1])?(">"===o.charAt(0)&&(o=" "+o),e.allow_conditional_comments||"[if"!==o.substr(0,3).toLowerCase()||(o=" "+o),D.comment(o)):(o=r[2])?D.cdata(o.replace(/<!--|-->/g,"")):(o=r[3])?D.doctype(o):(o=r[4])&&D.pi(o,r[5]);O=r.index+r[0].length}for(O<n.length&&D.text(L(n.substr(O))),s=P.length-1;s>=0;s--)(o=P[s]).valid&&D.end(o.name)}};em.findEndTag=Zd;var tm,nm,rm=function(e,t){var n,r,o,i,a,s,u,c,l=t,f=/<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g,d=e.schema;for(s=e.getTempAttrs(),u=l,c=new RegExp(["\\s?("+s.join("|")+')="[^"]+"'].join("|"),"gi"),l=u.replace(c,""),a=d.getShortEndedElements();i=f.exec(l);)r=f.lastIndex,o=i[0].length,n=a[i[1]]?r:em.findEndTag(d,l,r),l=l.substring(0,r-o)+l.substring(n),f.lastIndex=r-o;return l},om=function(e,t){return ii(rm(e,t))},im=rm,am=function(e){var t=e!==undefined?e.dom():document;return E.from(t.activeElement).map(Hn.fromDom)},sm=function(e){var t=Ur.owner(e).dom();return e.dom()===t.activeElement},um=function(e){return am(Ur.owner(e)).filter(function(t){return e.dom().contains(t.dom())})},cm=function(e,t){return(n=t,n.collapsed?E.from(zi(n.startContainer,n.startOffset)).map(Hn.fromDom):E.none()).bind(function(t){return io.isTableSection(t)?E.some(t):!1===Dr.contains(e,t)?E.some(e):E.none()});var n},lm=function(e,t){cm(Hn.fromDom(e.getBody()),t).bind(function(e){return Ws.firstPositionIn(e.dom())}).fold(function(){e.selection.normalize()},function(t){e.selection.setRng(t.toRange())})},fm=function(e){if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},dm=function(e){var t,n=e.getBody();return n&&(t=Hn.fromDom(n),sm(t)||um(t).isSome())},mm=function(e){return e.inline?dm(e):(t=e).iframeElement&&sm(Hn.fromDom(t.iframeElement));var t},pm=function(e){e.editorManager.setActive(e)},gm=function(e,t){e.removed||(t?pm(e):function(e){var t,n,r,o=e.selection,i=e.settings.content_editable,a=e.getBody(),s=o.getRng();if(e.quirks.refreshContentEditable(),n=e,r=o.getNode(),t=n.dom.getParent(r,function(e){return"true"===n.dom.getContentEditable(e)}),e.$.contains(a,t))return fm(t),lm(e,s),void pm(e);e.bookmark!==undefined&&!1===mm(e)&&Td(e).each(function(t){e.selection.setRng(t),s=t}),i||(me.opera||fm(a),e.getWin().focus()),(me.gecko||i)&&(fm(a),lm(e,s)),pm(e)}(e))},hm=mm,vm=function(e,t){return t.dom()[e]},ym=function(e,t){return parseInt(Cr(t,e),10)},bm=y.curry(vm,"clientWidth"),Cm=y.curry(vm,"clientHeight"),xm=y.curry(ym,"margin-top"),wm=y.curry(ym,"margin-left"),Nm=function(e,t,n){var r,o,i,a,s,u,c,l,f,d,m=Hn.fromDom(e.getBody()),p=e.inline?m:Ur.documentElement(m),g=(r=e.inline,i=t,a=n,s=(o=p).dom().getBoundingClientRect(),{x:i-(r?s.left+o.dom().clientLeft+wm(o):0),y:a-(r?s.top+o.dom().clientTop+xm(o):0)});return c=g.x,l=g.y,f=bm(u=p),d=Cm(u),c>=0&&l>=0&&c<=f&&l<=d},Em=function(e){var t,n=e.inline?e.getBody():e.getContentAreaContainer();return(t=n,E.from(t).map(Hn.fromDom)).map(function(e){return Dr.contains(Ur.owner(e),e)}).getOr(!1)},Sm=function(e){var t,n=[],r=function(){var t,n=e.theme;return n&&n.getNotificationManagerImpl?n.getNotificationManagerImpl():{open:t=function(){throw new Error("Theme did not provide a NotificationManager implementation.")},close:t,reposition:t,getArgs:t}},o=function(){n.length>0&&r().reposition(n)},i=function(e){M.findIndex(n,function(t){return t===e}).each(function(e){n.splice(e,1)})},a=function(t){if(!e.removed&&Em(e))return M.find(n,function(e){return n=r().getArgs(e),o=t,!(n.type!==o.type||n.text!==o.text||n.progressBar||n.timeout||o.progressBar||o.timeout);var n,o}).getOrThunk(function(){e.editorManager.setActive(e);var a,s=r().open(t,function(){i(s),o()});return a=s,n.push(a),o(),s})};return(t=e).on("SkinLoaded",function(){var e=t.settings.service_message;e&&a({text:e,type:"warning",timeout:0,icon:""})}),t.on("ResizeEditor ResizeWindow",function(){ye.requestAnimationFrame(o)}),t.on("remove",function(){M.each(n,function(e){r().close(e)})}),{open:a,close:function(){E.from(n[0]).each(function(e){r().close(e),i(e),o()})},getNotifications:function(){return n}}},km=function(e){var t=[],n=function(){var t,n=e.theme;return n&&n.getWindowManagerImpl?n.getWindowManagerImpl():{open:t=function(){throw new Error("Theme did not provide a WindowManager implementation.")},alert:t,confirm:t,close:t,getParams:t,setParams:t}},r=function(e,t){return function(){return t?t.apply(e,arguments):undefined}},o=function(n){var r;t.push(n),r=n,e.fire("OpenWindow",{win:r})},i=function(n){M.findIndex(t,function(e){return e===n}).each(function(r){var o;t.splice(r,1),o=n,e.fire("CloseWindow",{win:o}),0===t.length&&e.focus()})},a=function(){return E.from(t[t.length-1])};return e.on("remove",function(){M.each(t.slice(0),function(e){n().close(e)})}),{windows:t,open:function(t,r){e.editorManager.setActive(e),Sd(e);var a=n().open(t,r,i);return o(a),a},alert:function(e,t,a){var s=n().alert(e,r(a||this,t),i);o(s)},confirm:function(e,t,a){var s=n().confirm(e,r(a||this,t),i);o(s)},close:function(){a().each(function(e){n().close(e),i(e)})},getParams:function(){return a().map(n().getParams).getOr(null)},setParams:function(e){a().each(function(t){n().setParams(t,e)})},getWindows:function(){return t}}},Tm=ti.PluginManager,Am=function(e,t){var n=function(e,t){for(var n in Tm.urls)if(Tm.urls[n]+"/plugin"+t+".js"===e)return n;return null}(t,e.suffix);return n?"Failed to load plugin: "+n+" from url "+t:"Failed to load plugin url: "+t},_m=function(e,t){e.notificationManager.open({type:"error",text:t})},Bm=function(e,t){e._skinLoaded?_m(e,t):e.on("SkinLoaded",function(){_m(e,t)})},Rm=function(e,t){Bm(e,Am(e,t))},Dm=function(e,t){Bm(e,"Failed to upload image: "+t)},Om=Bm,Pm=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=window.console;r&&(r.error?r.error.apply(r,arguments):r.log.apply(r,arguments))},Im=ti.PluginManager,Lm=ti.ThemeManager,Mm=function(){return new(V("XMLHttpRequest"))},Fm=function(e,t){var n={},r=function(e,n,r,o){var i,a;(i=new Mm).open("POST",t.url),i.withCredentials=t.credentials,i.upload.onprogress=function(e){o(e.loaded/e.total*100)},i.onerror=function(){r("Image upload failed due to a XHR Transport error. Code: "+i.status)},i.onload=function(){var e,o,a;i.status<200||i.status>=300?r("HTTP Error: "+i.status):(e=JSON.parse(i.responseText))&&"string"==typeof e.location?n((o=t.basePath,a=e.location,o?o.replace(/\/$/,"")+"/"+a.replace(/^\//,""):a)):r("Invalid JSON: "+i.responseText)},(a=new FormData).append("file",e.blob(),e.filename()),i.send(a)},o=function(e,t){return{url:t,blobInfo:e,status:!0}},i=function(e,t){return{url:"",blobInfo:e,status:!1,error:t}},a=function(e,t){Ot.each(n[e],function(e){e(t)}),delete n[e]},s=function(r,s){return r=Ot.grep(r,function(t){return!e.isUploaded(t.blobUri())}),pe.all(Ot.map(r,function(r){return e.isPending(r.blobUri())?(f=r.blobUri(),new pe(function(e){n[f]=n[f]||[],n[f].push(e)})):(u=r,c=t.handler,l=s,e.markPending(u.blobUri()),new pe(function(t){var n;try{var r=function(){n&&n.close()};c(u,function(n){r(),e.markUploaded(u.blobUri(),n),a(u.blobUri(),o(u,n)),t(o(u,n))},function(n){r(),e.removeFailed(u.blobUri()),a(u.blobUri(),i(u,n)),t(i(u,n))},function(e){e<0||e>100||(n||(n=l()),n.progressBar.value(e))})}catch(s){t(i(u,s.message))}}));var u,c,l,f}))};return t=Ot.extend({credentials:!1,handler:r},t),{upload:function(e,n){return t.url||t.handler!==r?s(e,n):new pe(function(e){e([])})}}},zm=function(e,t){return new(V("Blob"))(e,t)},Um=function(e){return V("atob")(e)},Vm=function(e){var t,n;return e=decodeURIComponent(e).split(","),(n=/data:([^;]+)/.exec(e[0]))&&(t=n[1]),{type:t,data:e[1]}},Hm=function(e){return new pe(function(t){var n,r,o;e=Vm(e);try{n=Um(e.data)}catch(yC){return void t(new zm([]))}for(r=new function(e){return new(V("Uint8Array"))(e)}(n.length),o=0;o<r.length;o++)r[o]=n.charCodeAt(o);t(new zm([r],{type:e.type}))})},qm=function(e){return 0===e.indexOf("blob:")?(t=e,new pe(function(e,n){var r=function(){n("Cannot convert "+t+" to Blob. Resource might not exist or is inaccessible.")};try{var o=new Mm;o.open("GET",t,!0),o.responseType="blob",o.onload=function(){200===this.status?e(this.response):r()},o.onerror=r,o.send()}catch(i){r()}})):0===e.indexOf("data:")?Hm(e):null;var t},jm=function(e){return new pe(function(t){var n=new function(){return new(V("FileReader"))};n.onloadend=function(){t(n.result)},n.readAsDataURL(e)})},$m=Vm,Wm=0,Km=function(e){return(e||"blobid")+Wm++},Xm=function(e,t){var n={};return{findAll:function(r,o){var i,a,s;return o||(o=ji.constant(!0)),i=At.filter((s=r)?s.getElementsByTagName("img"):[],function(t){var n=t.src;return!!me.fileApi&&!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!n||n===me.transparentSrc)&&(0===n.indexOf("blob:")?!e.isUploaded(n):0===n.indexOf("data:")&&o(t))}),a=At.map(i,function(e){var r;return n[e.src]?new pe(function(t){n[e.src].then(function(n){if("string"==typeof n)return n;t({image:e,blobInfo:n.blobInfo})})}):(r=new pe(function(n,r){var o,i,a,s,u,c;o=t,a=n,s=r,0!==(i=e).src.indexOf("blob:")?(u=$m(i.src).data,(c=o.findFirst(function(e){return e.base64()===u}))?a({image:i,blobInfo:c}):qm(i.src).then(function(e){c=o.create(Km(),e,u),o.add(c),a({image:i,blobInfo:c})},function(e){s(e)})):(c=o.getByUri(i.src))?a({image:i,blobInfo:c}):qm(i.src).then(function(e){jm(e).then(function(t){u=$m(t).data,c=o.create(Km(),e,u),o.add(c),a({image:i,blobInfo:c})})},function(e){s(e)})}).then(function(e){return delete n[e.image.src],e})["catch"](function(t){return delete n[e.src],t}),n[e.src]=r,r)}),pe.all(a)}}},Ym=0,Gm=function(e){return e+Ym+++(t=function(){return Math.round(4294967295*Math.random()).toString(36)},"s"+(new Date).getTime().toString(36)+t()+t()+t());var t},Jm=function(e){var t,n,r,o,i,a,s,u,c,l,f=(t=[],n=ji.constant,r=function(e){var t,r,o;if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");return t=e.id||Gm("blobid"),r=e.name||t,{id:n(t),name:n(r),filename:n(r+"."+(o=e.blob.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png"}[o.toLowerCase()]||"dat")),blob:n(e.blob),base64:n(e.base64),blobUri:n(e.blobUri||q(e.blob)),uri:n(e.uri)}},{create:function(e,t,n,o){return r("object"==typeof e?e:{id:e,name:o,blob:t,base64:n})},add:function(e){o(e.id())||t.push(e)},get:o=function(e){return i(function(t){return t.id()===e})},getByUri:function(e){return i(function(t){return t.blobUri()===e})},findFirst:i=function(e){return At.filter(t,e)[0]},removeByUri:function(e){t=At.filter(t,function(t){return t.blobUri()!==e||(j(t.blobUri()),!1)})},destroy:function(){At.each(t,function(e){j(e.blobUri())}),t=[]}}),d=e.settings,m=(u={},c=function(e,t){return{status:e,resultUri:t}},{hasBlobUri:l=function(e){return e in u},getResultUri:function(e){var t=u[e];return t?t.resultUri:null},isPending:function(e){return!!l(e)&&1===u[e].status},isUploaded:function(e){return!!l(e)&&2===u[e].status},markPending:function(e){u[e]=c(1,null)},markUploaded:function(e,t){u[e]=c(2,t)},removeFailed:function(e){delete u[e]},destroy:function(){u={}}}),p=function(t){return function(n){return e.selection?t(n):[]}},g=function(e,t,n){var r=0;do{-1!==(r=e.indexOf(t,r))&&(e=e.substring(0,r)+n+e.substr(r+t.length),r+=n.length-t.length+1)}while(-1!==r);return e},h=function(e,t,n){return e=g(e,'src="'+t+'"','src="'+n+'"'),e=g(e,'data-mce-src="'+t+'"','data-mce-src="'+n+'"')},v=function(t,n){At.each(e.undoManager.data,function(e){"fragmented"===e.type?e.fragments=At.map(e.fragments,function(e){return h(e,t,n)}):e.content=h(e.content,t,n)})},y=function(){return e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0})},b=function(t,n){f.removeByUri(t.src),v(t.src,n),e.$(t).attr({src:d.images_reuse_filename?n+"?"+(new Date).getTime():n,"data-mce-src":e.convertURL(n,"src")})},C=function(t){return a||(a=Fm(m,{url:d.images_upload_url,basePath:d.images_upload_base_path,credentials:d.images_upload_credentials,handler:d.images_upload_handler})),N().then(p(function(n){var r;return r=At.map(n,function(e){return e.blobInfo}),a.upload(r,y).then(p(function(r){var o=At.map(r,function(t,r){var o=n[r].image;return t.status&&!1!==e.settings.images_replace_blob_uris?b(o,t.url):t.error&&Dm(e,t.error),{element:o,status:t.status}});return t&&t(o),o}))}))},x=function(e){if(!1!==d.automatic_uploads)return C(e)},w=function(e){return!d.images_dataimg_filter||d.images_dataimg_filter(e)},N=function(){return s||(s=Xm(m,f)),s.findAll(e.getBody(),w).then(p(function(t){return t=At.filter(t,function(t){return"string"!=typeof t||(Om(e,t),!1)}),At.each(t,function(e){v(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")}),t}))},E=function(t){return t.replace(/src="(blob:[^"]+)"/g,function(t,n){var r=m.getResultUri(n);if(r)return'src="'+r+'"';var o=f.getByUri(n);return o||(o=At.reduce(e.editorManager.get(),function(e,t){return e||t.editorUpload&&t.editorUpload.blobCache.getByUri(n)},null)),o?'src="data:'+o.blob().type+";base64,"+o.base64()+'"':t})};return e.on("setContent",function(){!1!==e.settings.automatic_uploads?x():N()}),e.on("RawSaveContent",function(e){e.content=E(e.content)}),e.on("getContent",function(e){e.source_view||"raw"===e.format||(e.content=E(e.content))}),e.on("PostRender",function(){e.parser.addNodeFilter("img",function(e){At.each(e,function(e){var t=e.attr("src");if(!f.getByUri(t)){var n=m.getResultUri(t);n&&e.attr("src",n)}})})}),{blobCache:f,uploadImages:C,uploadImagesAuto:x,scanForImages:N,destroy:function(){f.destroy(),m.destroy(),s=a=null}}},Qm=function(e,t){return e.hasOwnProperty(t.nodeName)},Zm=function(e){var t,n,r,o,i,a,s,u,c,l,f,d=e.settings,m=e.dom,p=e.selection,g=e.schema,h=g.getBlockElements(),v=p.getStart(),y=e.getBody();if(f=d.forced_root_block,v&&vo.isElement(v)&&f&&(l=y.nodeName.toLowerCase(),g.isValidChild(l,f.toLowerCase())&&(b=h,C=y,x=v,!M.exists(zu(Hn.fromDom(x),Hn.fromDom(C)),function(e){return Qm(b,e.dom())})))){var b,C,x,w,N;for(n=(t=p.getRng()).startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,c=hm(e),v=y.firstChild;v;)if(w=h,N=v,vo.isText(N)||vo.isElement(N)&&!Qm(w,N)&&!xs.isBookmarkNode(N)){if(vo.isText(v)&&0===v.nodeValue.length){s=v,v=v.nextSibling,m.remove(s);continue}a||(a=m.create(f,e.settings.forced_root_block_attrs),v.parentNode.insertBefore(a,v),u=!0),s=v,v=v.nextSibling,a.appendChild(s)}else a=null,v=v.nextSibling;u&&c&&(t.setStart(n,r),t.setEnd(o,i),p.setRng(t),e.nodeChanged())}},ep=function(e){e.settings.forced_root_block&&e.on("NodeChange",y.curry(Zm,e))},tp=function(e){var t,n=[];"onselectionchange"in e.getDoc()||e.on("NodeChange Click MouseUp KeyUp Focus",function(n){var r,o;o={startContainer:(r=e.selection.getRng()).startContainer,startOffset:r.startOffset,endContainer:r.endContainer,endOffset:r.endOffset},"nodechange"!==n.type&&qf(o,t)||e.fire("SelectionChange"),t=o}),e.on("contextmenu",function(){e.fire("SelectionChange")}),e.on("SelectionChange",function(){var t=e.selection.getStart(!0);!t||!me.range&&e.selection.isCollapsed()||!function(t){var r,o;if((o=e.$(t).parentsUntil(e.getBody()).add(t)).length===n.length){for(r=o.length;r>=0&&o[r]===n[r];r--);if(-1===r)return n=o,!0}return n=o,!1}(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})}),e.on("MouseUp",function(t){t.isDefaultPrevented()||("IMG"===e.selection.getNode().nodeName?ye.setEditorTimeout(e,function(){e.nodeChanged()}):e.nodeChanged())}),this.nodeChanged=function(t){var n,r,o,i=e.selection;e.initialized&&i&&!e.settings.disable_nodechange&&!e.readonly&&(o=e.getBody(),(n=i.getStart(!0)||o).ownerDocument===e.getDoc()&&e.dom.isChildOf(n,o)||(n=o),r=[],e.dom.getParent(n,function(e){if(e===o)return!0;r.push(e)}),(t=t||{}).element=n,t.parents=r,e.fire("NodeChange",t))}},np=function(e){var t,n,r,o;return o=e.getBoundingClientRect(),n=(t=e.ownerDocument).documentElement,r=t.defaultView,{top:o.top+r.pageYOffset-n.clientTop,left:o.left+r.pageXOffset-n.clientLeft}},rp=function(e,t){return n=(s=e).inline?np(s.getBody()):{left:0,top:0},a=(i=e).getBody(),r=i.inline?{left:a.scrollLeft,top:a.scrollTop}:{left:0,top:0},{pageX:(o=function(e,t){if(t.target.ownerDocument!==e.getDoc()){var n=np(e.getContentAreaContainer()),r=(i=(o=e).getBody(),a=o.getDoc().documentElement,s={left:i.scrollLeft,top:i.scrollTop},u={left:i.scrollLeft||a.scrollLeft,top:i.scrollTop||a.scrollTop},o.inline?s:u);return{left:t.pageX-n.left+r.left,top:t.pageY-n.top+r.top}}var o,i,a,s,u;return{left:t.pageX,top:t.pageY}}(e,t)).left-n.left+r.left,pageY:o.top-n.top+r.top};var n,r,o,i,a,s},op=vo.isContentEditableFalse,ip=vo.isContentEditableTrue,ap=function(e){e&&e.parentNode&&e.parentNode.removeChild(e)},sp=function(e,t){return function(n){if(0===n.button){var r=At.find(t.dom.getParents(n.target),ji.or(op,ip));if(s=t.getBody(),op(u=r)&&u!==s){var o=t.dom.getPos(r),i=t.getBody(),a=t.getDoc().documentElement;e.element=r,e.screenX=n.screenX,e.screenY=n.screenY,e.maxX=(t.inline?i.scrollWidth:a.offsetWidth)-2,e.maxY=(t.inline?i.scrollHeight:a.offsetHeight)-2,e.relX=n.pageX-o.x,e.relY=n.pageY-o.y,e.width=r.offsetWidth,e.height=r.offsetHeight,e.ghost=function(e,t,n,r){var o=t.cloneNode(!0);e.dom.setStyles(o,{width:n,height:r}),e.dom.setAttrib(o,"data-mce-selected",null);var i=e.dom.create("div",{"class":"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return e.dom.setStyles(i,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:n,height:r}),e.dom.setStyles(o,{margin:0,boxSizing:"border-box"}),i.appendChild(o),i}(t,r,e.width,e.height)}}var s,u}},up=function(e,t){return function(n){if(e.dragging&&(s=t,l=t.selection,f=l.getSel().getRangeAt(0).startContainer,u=3===f.nodeType?f.parentNode:f,c=e.element,u!==c&&!s.dom.isChildOf(u,c)&&!op(u))){var r=(i=e.element,(a=i.cloneNode(!0)).removeAttribute("data-mce-selected"),a),o=t.fire("drop",{targetClone:r,clientX:n.clientX,clientY:n.clientY});o.isDefaultPrevented()||(r=o.targetClone,t.undoManager.transact(function(){ap(e.element),t.insertContent(t.dom.getOuterHTML(r)),t._selectionOverrides.hideFakeCaret()}))}var i,a,s,u,c,l,f;cp(e)}},cp=function(e){e.dragging=!1,e.element=null,ap(e.ghost)},lp=function(e){var t,n,r,o,i,a,s,u,c,l,f,d={};t=Xo.DOM,a=document,n=sp(d,e),s=d,u=e,c=ye.throttle(function(e,t){u._selectionOverrides.hideFakeCaret(),u.selection.placeCaretAt(e,t)},0),r=function(e){var t,n,r,o,i,a,l,f,d,m,p,g,h=Math.max(Math.abs(e.screenX-s.screenX),Math.abs(e.screenY-s.screenY));if(s.element&&!s.dragging&&h>10){if(u.fire("dragstart",{target:s.element}).isDefaultPrevented())return;s.dragging=!0,u.focus()}if(s.dragging){var v=(p=s,{pageX:(g=rp(u,e)).pageX-p.relX,pageY:g.pageY+5});d=s.ghost,m=u.getBody(),d.parentNode!==m&&m.appendChild(d),t=s.ghost,n=v,r=s.width,o=s.height,i=s.maxX,a=s.maxY,l=0,f=0,t.style.left=n.pageX+"px",t.style.top=n.pageY+"px",n.pageX+r>i&&(l=n.pageX+r-i),n.pageY+o>a&&(f=n.pageY+o-a),t.style.width=r-l+"px",t.style.height=o-f+"px",c(e.clientX,e.clientY)}},o=up(d,e),l=d,f=e,i=function(){cp(l),l.dragging&&f.fire("dragend")},e.on("mousedown",n),e.on("mousemove",r),e.on("mouseup",o),t.bind(a,"mousemove",r),t.bind(a,"mouseup",i),e.on("remove",function(){t.unbind(a,"mousemove",r),t.unbind(a,"mouseup",i)})},fp=function(e){var t;lp(e),(t=e).on("drop",function(e){var n="undefined"!=typeof e.clientX?t.getDoc().elementFromPoint(e.clientX,e.clientY):null;(op(n)||op(t.dom.getContentEditableParent(n)))&&e.preventDefault()})},dp=vo.isContentEditableFalse,mp=function(e,t){var n,r,o=null,i=function(){!function(){var t,n,r,o,i;for(t=Qt("*[contentEditable=false]",e),o=0;o<t.length;o++)r=(n=t[o]).previousSibling,mi.endsWithCaretContainer(r)&&(1===(i=r.data).length?r.parentNode.removeChild(r):r.deleteData(i.length-1,1)),r=n.nextSibling,mi.startsWithCaretContainer(r)&&(1===(i=r.data).length?r.parentNode.removeChild(r):r.deleteData(0,1))}(),r&&(Oc.remove(r),r=null),o&&(o.remove(),o=null),clearInterval(n)},a=function(){n=ye.setInterval(function(){e.ownerDocument.activeElement===e?Qt("div.mce-visual-caret",e).toggleClass("mce-visual-caret-hidden"):Qt("div.mce-visual-caret",e).addClass("mce-visual-caret-hidden")},500)};return{show:function(n,s){var u,c,l,f,d,m,p,g,h,v,y;return i(),(l=s)&&/^(TD|TH)$/i.test(l.nodeName)?null:t(s)?(r=mi.insertBlock("p",s,n),d=n,y=Oi((f=s).getBoundingClientRect(),d),"BODY"===e.tagName?(m=e.ownerDocument.documentElement,p=e.scrollLeft||m.scrollLeft,g=e.scrollTop||m.scrollTop):(v=e.getBoundingClientRect(),p=e.scrollLeft-v.left,g=e.scrollTop-v.top),y.left+=p,y.right+=p,y.top+=g,y.bottom+=g,y.width=1,(h=f.offsetWidth-f.clientWidth)>0&&(d&&(h*=-1),y.left+=h,y.right+=h),u=y,Qt(r).css("top",u.top),o=Qt('<div class="mce-visual-caret" data-mce-bogus="all"></div>').css(u).appendTo(e),n&&o.addClass("mce-visual-caret-before"),a(),(c=s.ownerDocument.createRange()).setStart(r,0),c.setEnd(r,0),c):(r=mi.insertInline(s,n),c=s.ownerDocument.createRange(),dp(r.nextSibling)?(c.setStart(r,0),c.setEnd(r,0)):(c.setStart(r,1),c.setEnd(r,1)),c)},hide:i,getCss:function(){return".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}"},destroy:function(){ye.clearInterval(n)}}},pp=function(e){var t=function(t){return At.map(t,function(t){return(t=Di(t)).node=e,t})};if(At.isArray(e))return At.reduce(e,function(e,t){return e.concat(pp(t))},[]);if(vo.isElement(e))return t(e.getClientRects());if(vo.isText(e)){var n=e.ownerDocument.createRange();return n.setStart(e,0),n.setEnd(e,e.data.length),t(n.getClientRects())}},gp={getClientRects:pp},hp=vo.isContentEditableFalse,vp=_a.findNode,yp=ji.curry,bp=function(e,t){return Math.abs(e.left-t)},Cp=function(e,t){return Math.abs(e.right-t)},xp=function(e,t){var n=function(e,t){return e>=t.left&&e<=t.right};return At.reduce(e,function(e,r){var o,i;return o=Math.min(bp(e,t),Cp(e,t)),i=Math.min(bp(r,t),Cp(r,t)),n(t,r)?r:n(t,e)?e:i===o&&hp(r.node)?r:i<o?r:e})},wp=function(e,t,n,r){for(;r=vp(r,e,ki,t);)if(n(r))return},Np=function(e,t){var n=[],r=function(e,r){var o;return o=At.filter(gp.getClientRects(r),function(n){return!e(n,t)}),n=n.concat(o),0===o.length};return n.push(t),wp(-1,e,yp(r,Ii),t.node),wp(1,e,yp(r,Li),t.node),n},Ep=xp,Sp=function(e,t,n){var r,o,i,a,s;return r=gp.getClientRects((i=e,At.filter(At.toArray(i.getElementsByTagName("*")),hp))),r=At.filter(r,function(e){return n>=e.top&&n<=e.bottom}),(o=xp(r,t))&&(o=xp(Np(e,o),t))&&hp(o.node)?(s=t,{node:(a=o).node,before:bp(a,s)<Cp(a,s)}):null},kp=function(e,t,n){return!n.collapsed&&M.foldl(n.getClientRects(),function(n,r){return n||Mi(r,e,t)},!1)},Tp=function(e,t){var n=null;return{cancel:function(){null!==n&&(clearTimeout(n),n=null)},throttle:function(){var r=arguments;null===n&&(n=setTimeout(function(){e.apply(null,r),n=null,r=null},t))}}},Ap=vo.isContentEditableTrue,_p=vo.isContentEditableFalse,Bp=function(e,t,n,r){return t._selectionOverrides.showCaret(e,n,r)},Rp=function(e,t){var n,r;return t=_a.normalizeRange(1,e.getBody(),t),n=ia.fromRangeStart(t),_p(n.getNode())?Bp(1,e,n.getNode(),!n.isAtEnd()):_p(n.getNode(!0))?Bp(1,e,n.getNode(!0),!1):(r=e.dom.getParent(n.getNode(),ji.or(_p,Ap)),_p(r)?Bp(1,e,r,!1):null)},Dp=Bp,Op=function(e,t){var n,r;return e.fire("BeforeObjectSelected",{target:t}).isDefaultPrevented()?null:((r=(n=t).ownerDocument.createRange()).selectNode(n),r)},Pp=Rp,Ip=function(e,t){return t&&t.collapsed&&Rp(e,t)||t},Lp=function(e){var t=Tp(function(){if(!e.removed){var t=Ip(e,e.selection.getRng());e.selection.setRng(t)}},0);e.on("focus",function(){t.throttle()}),e.on("blur",function(){t.cancel()})},Mp={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(e){return e.shiftKey||e.ctrlKey||e.altKey||this.metaKeyPressed(e)},metaKeyPressed:function(e){return me.mac?e.metaKey:e.ctrlKey&&!e.altKey}},Fp=vo.isContentEditableTrue,zp=vo.isContentEditableFalse,Up=_a.isAfterContentEditableFalse,Vp=_a.isBeforeContentEditableFalse,Hp=function(e){var t,n,r,o=e.getBody(),i=mp(e.getBody(),function(t){return e.dom.isBlock(t)}),a="sel-"+e.dom.uniqueId(),s=function(t){t&&e.selection.setRng(t)},u=function(){return e.selection.getRng()},c=function(t,n){e.selection.scrollIntoView(t,n)},l=function(t,n,r){return e.fire("ShowCaret",{target:n,direction:t,before:r}).isDefaultPrevented()?null:(c(n,-1===t),i.show(r,n))},f=function(e,t){return t=_a.normalizeRange(e,o,t),-1===e?ia.fromRangeStart(t):ia.fromRangeEnd(t)},d=function(e){return mi.isCaretContainer(e)||mi.startsWithCaretContainer(e)||mi.endsWithCaretContainer(e)},m=function(e){return d(e.startContainer)||d(e.endContainer)},p=function(n,r){var o,i,s,u,c,d,p,g,v,y,b=e.$,C=e.dom;if(!n)return null;if(n.collapsed){if(!m(n))if(!1===r){if(g=f(-1,n),zp(g.getNode(!0)))return l(-1,g.getNode(!0),!1);if(zp(g.getNode()))return l(-1,g.getNode(),!g.isAtEnd())}else{if(g=f(1,n),zp(g.getNode()))return l(1,g.getNode(),!g.isAtEnd());if(zp(g.getNode(!0)))return l(1,g.getNode(!0),!1)}return null}return u=n.startContainer,c=n.startOffset,d=n.endOffset,3===u.nodeType&&0===c&&zp(u.parentNode)&&(u=u.parentNode,c=C.nodeIndex(u),u=u.parentNode),1!==u.nodeType?null:(d===c+1&&(o=u.childNodes[c]),zp(o)?(v=y=o.cloneNode(!0),(p=e.fire("ObjectSelected",{target:o,targetClone:v})).isDefaultPrevented()?null:(i=Nu(Hn.fromDom(e.getBody()),"#"+a).fold(function(){return b([])},function(e){return b([e.dom()])}),v=p.targetClone,0===i.length&&(i=b('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>').attr("id",a)).appendTo(e.getBody()),n=e.dom.createRng(),v===y&&me.ie?(i.empty().append('<p style="font-size: 0" data-mce-bogus="all">\xa0</p>').append(v),n.setStartAfter(i[0].firstChild.firstChild),n.setEndAfter(v)):(i.empty().append("\xa0").append(v).append("\xa0"),n.setStart(i[0].firstChild,1),n.setEnd(i[0].lastChild,0)),i.css({top:C.getPos(o,e.getBody()).y}),i[0].focus(),(s=e.selection.getSel()).removeAllRanges(),s.addRange(n),M.each(Os(Hn.fromDom(e.getBody()),"*[data-mce-selected]"),function(e){dr.remove(e,"data-mce-selected")}),o.setAttribute("data-mce-selected","1"),t=o,h(),n)):null)},g=function(){t&&(t.removeAttribute("data-mce-selected"),Nu(Hn.fromDom(e.getBody()),"#"+a).each(Bs.remove),t=null)},h=function(){i.hide()};return me.ceFalse&&(function(){var n=function(t){for(var n=e.getBody();t&&t!==n;){if(Fp(t)||zp(t))return t;t=t.parentNode}return null};e.on("mouseup",function(t){var n=u();n.collapsed&&Nm(e,t.clientX,t.clientY)&&s(Pp(e,n))}),e.on("click",function(t){var r;(r=n(t.target))&&(zp(r)&&(t.preventDefault(),e.focus()),Fp(r)&&e.dom.isChildOf(r,e.selection.getNode())&&g())}),e.on("blur NewBlock",function(){g()});var r,i,c=function(t,n){var r,o,i=e.dom.getParent(t,e.dom.isBlock),a=e.dom.getParent(n,e.dom.isBlock);return i&&(r=i,o=a,!(e.dom.getParent(r,e.dom.isBlock)===e.dom.getParent(o,e.dom.isBlock)))&&function(e){var t=Ha(e);if(!e.firstChild)return!1;var n=ia.before(e.firstChild),r=t.next(n);return r&&!Vp(r)&&!Up(r)}(i)};i=!1,(r=e).on("touchstart",function(){i=!1}),r.on("touchmove",function(){i=!0}),r.on("touchend",function(e){var t=n(e.target);zp(t)&&(i||(e.preventDefault(),p(Op(r,t))))}),e.on("mousedown",function(t){var r;if(!1!==Nm(e,t.clientX,t.clientY))if(r=n(t.target))zp(r)?(t.preventDefault(),p(Op(e,r))):(g(),Fp(r)&&t.shiftKey||kp(t.clientX,t.clientY,e.selection.getRng())||e.selection.placeCaretAt(t.clientX,t.clientY));else{g(),h();var i=Sp(o,t.clientX,t.clientY);i&&(c(t.target,i.node)||(t.preventDefault(),e.getBody().focus(),s(l(1,i.node,i.before))))}}),e.on("keypress",function(t){Mp.modifierPressed(t)||(t.keyCode,zp(e.selection.getNode())&&t.preventDefault())}),e.on("getSelectionRange",function(e){var n=e.range;if(t){if(!t.parentNode)return void(t=null);(n=n.cloneRange()).selectNode(t),e.range=n}}),e.on("setSelectionRange",function(e){var t;(t=p(e.range,e.forward))&&(e.range=t)}),e.on("AfterSetSelectionRange",function(t){var n,r=t.range;m(r)||h(),n=r.startContainer.parentNode,e.dom.hasClass(n,"mce-offscreen-selection")||g()}),e.on("copy",function(t){var n,r=t.clipboardData;if(!t.isDefaultPrevented()&&t.clipboardData&&!me.ie){var o=(n=e.dom.get(a))?n.getElementsByTagName("*")[0]:n;o&&(t.preventDefault(),r.clearData(),r.setData("text/html",o.outerHTML),r.setData("text/plain",o.outerText))}}),fp(e),Lp(e)}(),n=e.contentStyles,r=".mce-content-body",n.push(i.getCss()),n.push(r+" .mce-offscreen-selection {position: absolute;left: -9999999999px;max-width: 1000000px;}"+r+" *[contentEditable=false] {cursor: default;}"+r+" *[contentEditable=true] {cursor: text;}")),{showCaret:l,showBlockCaretContainer:function(e){e.hasAttribute("data-mce-caret")&&(mi.showCaretContainerBlock(e),s(u()),c(e[0]))},hideFakeCaret:h,destroy:function(){i.destroy(),t=null}}},qp=0,jp=2,$p=1,Wp=function(e,t){var n=e.length+t.length+2,r=new Array(n),o=new Array(n),i=function(n,r,o,a,u){var c=s(n,r,o,a);if(null===c||c.start===r&&c.diag===r-a||c.end===n&&c.diag===n-o)for(var l=n,f=o;l<r||f<a;)l<r&&f<a&&e[l]===t[f]?(u.push([0,e[l]]),++l,++f):r-n>a-o?(u.push([2,e[l]]),++l):(u.push([1,t[f]]),++f);else{i(n,c.start,o,c.start-c.diag,u);for(var d=c.start;d<c.end;++d)u.push([0,e[d]]);i(c.end,r,c.end-c.diag,a,u)}},a=function(n,r,o,i){for(var a=n;a-r<i&&a<o&&e[a]===t[a-r];)++a;return{start:n,end:a,diag:r}},s=function(n,i,s,u){var c=i-n,l=u-s;if(0===c||0===l)return null;var f,d,m,p,g,h=c-l,v=l+c,y=(v%2==0?v:v+1)/2;for(r[1+y]=n,o[1+y]=i+1,f=0;f<=y;++f){for(d=-f;d<=f;d+=2){for(m=d+y,d===-f||d!==f&&r[m-1]<r[m+1]?r[m]=r[m+1]:r[m]=r[m-1]+1,g=(p=r[m])-n+s-d;p<i&&g<u&&e[p]===t[g];)r[m]=++p,++g;if(h%2!=0&&h-f<=d&&d<=h+f&&o[m-h]<=r[m])return a(o[m-h],d+n-s,i,u)}for(d=h-f;d<=h+f;d+=2){for(m=d+y-h,d===h-f||d!==h+f&&o[m+1]<=o[m-1]?o[m]=o[m+1]-1:o[m]=o[m-1],g=(p=o[m]-1)-n+s-d;p>=n&&g>=s&&e[p]===t[g];)o[m]=p--,g--;if(h%2==0&&-f<=d&&d<=f&&o[m]<=r[m+h])return a(o[m],d+n-s,i,u)}}},u=[];return i(0,e.length,0,t.length,u),u},Kp=function(e){return 1===e.nodeType?e.outerHTML:3===e.nodeType?Ao.encodeRaw(e.data,!1):8===e.nodeType?"\x3c!--"+e.data+"--\x3e":""},Xp=function(e,t,n){var r=function(e){var t,n,r;for(r=document.createElement("div"),t=document.createDocumentFragment(),e&&(r.innerHTML=e);n=r.firstChild;)t.appendChild(n);return t}(t);if(e.hasChildNodes()&&n<e.childNodes.length){var o=e.childNodes[n];o.parentNode.insertBefore(r,o)}else e.appendChild(r)},Yp=function(e){return At.filter(At.map(e.childNodes,Kp),function(e){return e.length>0})},Gp=function(e,t){var n,r,o,i=At.map(t.childNodes,Kp);return n=Wp(i,e),r=t,o=0,At.each(n,function(e){e[0]===qp?o++:e[0]===$p?(Xp(r,e[1],o),o++):e[0]===jp&&function(e,t){if(e.hasChildNodes()&&t<e.childNodes.length){var n=e.childNodes[t];n.parentNode.removeChild(n)}}(r,o)}),t},Jp=function(e){return{type:"fragmented",fragments:e,content:"",bookmark:null,beforeBookmark:null}},Qp=function(e){return{type:"complete",fragments:null,content:e,bookmark:null,beforeBookmark:null}},Zp=function(e){return"fragmented"===e.type?e.fragments.join(""):e.content},eg=function(e){var t,n,r;return t=Yp(e.getBody()),-1!==(n=(r=M.bind(t,function(t){var n=im(e.serializer,t);return n.length>0?[n]:[]})).join("")).indexOf("</iframe>")?Jp(r):Qp(n)},tg=function(e,t,n){"fragmented"===t.type?Gp(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw"}),e.selection.moveToBookmark(n?t.beforeBookmark:t.bookmark)},ng=function(e,t){return!!e&&!!t&&Zp(e)===Zp(t)},rg=function(e){var t,n,r=this,o=0,i=[],a=0,s=function(){return 0===a},u=function(e){s()&&(r.typing=e)},c=function(t){e.setDirty(t)},l=function(e){u(!1),r.add({},e)},f=function(){r.typing&&(u(!1),r.add())};return e.on("init",function(){r.add()}),e.on("BeforeExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t&&(f(),r.beforeChange())}),e.on("ExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t&&l(e)}),e.on("ObjectResizeStart Cut",function(){r.beforeChange()}),e.on("SaveContent ObjectResized blur",l),e.on("DragEnd",l),e.on("KeyUp",function(t){var o=t.keyCode;t.isDefaultPrevented()||((o>=33&&o<=36||o>=37&&o<=40||45===o||t.ctrlKey)&&(l(),e.nodeChanged()),46!==o&&8!==o||e.nodeChanged(),n&&r.typing&&!1===ng(eg(e),i[0])&&(!1===e.isDirty()&&(c(!0),e.fire("change",{level:i[0],lastLevel:null})),e.fire("TypingUndo"),n=!1,e.nodeChanged()))}),e.on("KeyDown",function(e){var t=e.keyCode;if(!e.isDefaultPrevented())if(t>=33&&t<=36||t>=37&&t<=40||45===t)r.typing&&l(e);else{var o=e.ctrlKey&&!e.altKey||e.metaKey;!(t<16||t>20)||224===t||91===t||r.typing||o||(r.beforeChange(),u(!0),r.add({},e),n=!0)}}),e.on("MouseDown",function(e){r.typing&&l(e)}),e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo"),e.on("AddUndo Undo Redo ClearUndos",function(t){t.isDefaultPrevented()||e.nodeChanged()}),r={data:i,typing:!1,beforeChange:function(){s()&&(t=gs.getUndoBookmark(e.selection))},add:function(n,r){var a,u,l,f=e.settings;if(l=eg(e),n=n||{},n=Ot.extend(n,l),!1===s()||e.removed)return null;if(u=i[o],e.fire("BeforeAddUndo",{level:n,lastLevel:u,originalEvent:r}).isDefaultPrevented())return null;if(u&&ng(u,n))return null;if(i[o]&&(i[o].beforeBookmark=t),f.custom_undo_redo_levels&&i.length>f.custom_undo_redo_levels){for(a=0;a<i.length-1;a++)i[a]=i[a+1];i.length--,o=i.length}n.bookmark=gs.getUndoBookmark(e.selection),o<i.length-1&&(i.length=o+1),i.push(n),o=i.length-1;var d={level:n,lastLevel:u,originalEvent:r};return e.fire("AddUndo",d),o>0&&(c(!0),e.fire("change",d)),n},undo:function(){var t;return r.typing&&(r.add(),r.typing=!1,u(!1)),o>0&&(t=i[--o],tg(e,t,!0),c(!0),e.fire("undo",{level:t})),t},redo:function(){var t;return o<i.length-1&&(t=i[++o],tg(e,t,!1),c(!0),e.fire("redo",{level:t})),t},clear:function(){i=[],o=0,r.typing=!1,r.data=i,e.fire("ClearUndos")},hasUndo:function(){return o>0||r.typing&&i[0]&&!ng(eg(e),i[0])},hasRedo:function(){return o<i.length-1&&!r.typing},transact:function(e){return f(),r.beforeChange(),r.ignore(e),r.add()},ignore:function(e){try{a++,e()}finally{a--}},extra:function(t,n){var a,s;r.transact(t)&&(s=i[o].bookmark,a=i[o-1],tg(e,a,!0),r.transact(n)&&(i[o-1].beforeBookmark=s))}}},og={},ig=At.filter,ag=At.each;nm=function(e){var t,n,r=e.selection.getRng();t=vo.matchNodeNames("pre"),r.collapsed||(n=e.selection.getSelectedBlocks(),ag(ig(ig(n,t),function(e){return t(e.previousSibling)&&-1!==At.indexOf(n,e.previousSibling)}),function(e){var t,n;t=e.previousSibling,Qt(n=e).remove(),Qt(t).append("<br><br>").append(n.childNodes)}))},og[tm="pre"]||(og[tm]=[]),og[tm].push(nm);var sg=function(e,t){ag(og[e],function(e){e(t)})},ug=Ot.each,cg={walk:function(e,t,n){var r,o,i,a,s,u,c,l=t.startContainer,f=t.startOffset,d=t.endContainer,m=t.endOffset;if((c=e.select("td[data-mce-selected],th[data-mce-selected]")).length>0)ug(c,function(e){n([e])});else{var p,g,h,v=function(e){var t;return 3===(t=e[0]).nodeType&&t===l&&f>=t.nodeValue.length&&e.splice(0,1),t=e[e.length-1],0===m&&e.length>0&&t===d&&3===t.nodeType&&e.splice(e.length-1,1),e},y=function(e,t,n){for(var r=[];e&&e!==n;e=e[t])r.push(e);return r},b=function(e,t){do{if(e.parentNode===t)return e;e=e.parentNode}while(e)},C=function(e,t,r){var o=r?"nextSibling":"previousSibling";for(s=(a=e).parentNode;a&&a!==t;a=s)s=a.parentNode,(u=y(a===e?a:a[o],o)).length&&(r||u.reverse(),n(v(u)))};if(1===l.nodeType&&l.hasChildNodes()&&(l=l.childNodes[f]),1===d.nodeType&&d.hasChildNodes()&&(g=m,h=(p=d).childNodes,--g>h.length-1?g=h.length-1:g<0&&(g=0),d=h[g]||p),l===d)return n(v([l]));for(r=e.findCommonAncestor(l,d),a=l;a;a=a.parentNode){if(a===d)return C(l,r,!0);if(a===r)break}for(a=d;a;a=a.parentNode){if(a===l)return C(d,r);if(a===r)break}o=b(l,r)||l,i=b(d,r)||d,C(l,o,!0),(u=y(o===l?o:o.nextSibling,"nextSibling",i===d?i.nextSibling:i)).length&&n(v(u)),C(d,i)}}},lg=/^(src|href|style)$/,fg=Ot.each,dg=Uc.isEq,mg=function(e){return/^(TH|TD)$/.test(e.nodeName)},pg=function(e,t,n){var r,o,i;return r=t[n?"startContainer":"endContainer"],o=t[n?"startOffset":"endOffset"],vo.isElement(r)&&(i=r.childNodes.length-1,!n&&o&&o--,r=r.childNodes[o>i?i:o]),vo.isText(r)&&n&&o>=r.nodeValue.length&&(r=new to(r,e.getBody()).next()||r),vo.isText(r)&&!n&&0===o&&(r=new to(r,e.getBody()).prev()||r),r},gg=function(e,t,n,r){var o=e.create(n,r);return t.parentNode.insertBefore(o,t),o.appendChild(t),o},hg=function(e,t,n,r){return!(t=Uc.getNonWhiteSpaceSibling(t,n,r))||"BR"===t.nodeName||e.isBlock(t)},vg=function(e,t,n,r,o){var i,a,s,u,c,l,f,d,m,p,g,h,v,y,b,C=e.dom;if(l=C,!(dg(f=r,(d=t).inline)||dg(f,d.block)||(d.selector?vo.isElement(f)&&l.is(f,d.selector):void 0)||(u=r,c=t,c.links&&"A"===u.tagName)))return!1;if("all"!==t.remove)for(fg(t.styles,function(e,i){e=Uc.normalizeStyleValue(C,Uc.replaceVars(e,n),i),"number"==typeof i&&(i=e,o=0),(t.remove_similar||!o||dg(Uc.getStyle(C,o,i),e))&&C.setStyle(r,i,""),s=1}),s&&""===C.getAttrib(r,"style")&&(r.removeAttribute("style"),r.removeAttribute("data-mce-style")),fg(t.attributes,function(e,t){var i;if(e=Uc.replaceVars(e,n),"number"==typeof t&&(t=e,o=0),!o||dg(C.getAttrib(o,t),e)){if("class"===t&&(e=C.getAttrib(r,t))&&(i="",fg(e.split(/\s+/),function(e){/mce\-\w+/.test(e)&&(i+=(i?" ":"")+e)}),i))return void C.setAttrib(r,t,i);"class"===t&&r.removeAttribute("className"),lg.test(t)&&r.removeAttribute("data-mce-"+t),r.removeAttribute(t)}}),fg(t.classes,function(e){e=Uc.replaceVars(e,n),o&&!C.hasClass(o,e)||C.removeClass(r,e)}),a=C.getAttribs(r),i=0;i<a.length;i++){var x=a[i].nodeName;if(0!==x.indexOf("_")&&0!==x.indexOf("data-"))return!1}return"none"!==t.remove?(m=e,g=t,v=(p=r).parentNode,y=m.dom,b=m.settings.forced_root_block,g.block&&(b?v===y.getRoot()&&(g.list_block&&dg(p,g.list_block)||fg(Ot.grep(p.childNodes),function(e){Uc.isValid(m,b,e.nodeName.toLowerCase())?h?h.appendChild(e):(h=gg(y,e,b),y.setAttribs(h,m.settings.forced_root_block_attrs)):h=0})):y.isBlock(p)&&!y.isBlock(v)&&(hg(y,p,!1)||hg(y,p.firstChild,!0,1)||p.insertBefore(y.create("br"),p.firstChild),hg(y,p,!0)||hg(y,p.lastChild,!1,1)||p.appendChild(y.create("br")))),g.selector&&g.inline&&!dg(g.inline,p)||y.remove(p,1),!0):void 0},yg=vg,bg=function(e,t,n,r,o){var i,a,s=e.formatter.get(t),u=s[0],c=!0,l=e.dom,f=e.selection,d=function(r){var i,a,c,l,f,d,m=(i=e,a=r,c=t,l=n,f=o,fg(Uc.getParents(i.dom,a.parentNode).reverse(),function(e){var t;d||"_start"===e.id||"_end"===e.id||(t=il.matchNode(i,e,c,l,f))&&!1!==t.split&&(d=e)}),d);return function(e,t,n,r,o,i,a,s){var u,c,l,f,d,m,p=e.dom;if(n){for(m=n.parentNode,u=r.parentNode;u&&u!==m;u=u.parentNode){for(c=p.clone(u,!1),d=0;d<t.length;d++)if(vg(e,t[d],s,c,c)){c=0;break}c&&(l&&c.appendChild(l),f||(f=c),l=c)}!i||a.mixed&&p.isBlock(n)||(r=p.split(n,r)),l&&(o.parentNode.insertBefore(l,o),f.appendChild(o))}return r}(e,s,m,r,r,!0,u,n)},m=function(t){var r,o,i,a,f;if(vo.isElement(t)&&l.getContentEditable(t)&&(a=c,c="true"===l.getContentEditable(t),f=!0),r=Ot.grep(t.childNodes),c&&!f)for(o=0,i=s.length;o<i&&!vg(e,s[o],n,t,t);o++);if(u.deep&&r.length){for(o=0,i=r.length;o<i;o++)m(r[o]);f&&(c=a)}},p=function(e){var t=l.get(e?"_start":"_end"),n=t[e?"firstChild":"lastChild"];return xs.isBookmarkNode(n)&&(n=n[e?"firstChild":"lastChild"]),vo.isText(n)&&0===n.data.length&&(n=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),l.remove(t,!0),n},g=function(t){var n,r,o=t.commonAncestorContainer;if(t=Qc(e,t,s,!0),u.split){if((n=pg(e,t,!0))!==(r=pg(e,t))){if(/^(TR|TH|TD)$/.test(n.nodeName)&&n.firstChild&&(n="TR"===n.nodeName?n.firstChild.firstChild||n:n.firstChild||n),o&&/^T(HEAD|BODY|FOOT|R)$/.test(o.nodeName)&&mg(r)&&r.firstChild&&(r=r.firstChild||r),l.isChildOf(n,r)&&n!==r&&!l.isBlock(r)&&!mg(n)&&!mg(r))return n=gg(l,n,"span",{id:"_start","data-mce-type":"bookmark"}),d(n),void(n=p(!0));n=gg(l,n,"span",{id:"_start","data-mce-type":"bookmark"}),r=gg(l,r,"span",{id:"_end","data-mce-type":"bookmark"}),d(n),d(r),n=p(!0),r=p()}else n=r=d(n);t.startContainer=n.parentNode?n.parentNode:n,t.startOffset=l.nodeIndex(n),t.endContainer=r.parentNode?r.parentNode:r,t.endOffset=l.nodeIndex(r)+1}cg.walk(l,t,function(t){fg(t,function(t){m(t),vo.isElement(t)&&"underline"===e.dom.getStyle(t,"text-decoration")&&t.parentNode&&"underline"===Uc.getTextDecoration(l,t.parentNode)&&vg(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:"underline"}},null,t)})})};if(r)r.nodeType?((a=l.createRng()).setStartBefore(r),a.setEndAfter(r),g(a)):g(r);else if("false"!==l.getContentEditable(f.getNode()))f.isCollapsed()&&u.inline&&!l.select("td[data-mce-selected],th[data-mce-selected]").length?wl(e,t,n,o):(i=f.getBookmark(),g(f.getRng()),f.moveToBookmark(i),u.inline&&il.match(e,t,n,f.getStart())&&Uc.moveStart(l,f,f.getRng()),e.nodeChanged());else{r=f.getNode();for(var h=0,v=s.length;h<v&&(!s[h].ceFalseOverride||!vg(e,s[h],n,r,r));h++);}},Cg=Ot.each,xg=function(e){return e&&1===e.nodeType&&!xs.isBookmarkNode(e)&&!Nl(e)&&!vo.isBogus(e)},wg=function(e,t){var n;for(n=e;n;n=n[t]){if(3===n.nodeType&&0!==n.nodeValue.length)return e;if(1===n.nodeType&&!xs.isBookmarkNode(n))return n}return e},Ng=function(e,t,n){var r,o,i=new Ns(e);if(t&&n&&(t=wg(t,"previousSibling"),n=wg(n,"nextSibling"),i.compare(t,n))){for(r=t.nextSibling;r&&r!==n;)o=r,r=r.nextSibling,t.appendChild(o);return e.remove(n),Ot.each(Ot.grep(n.childNodes),function(e){t.appendChild(e)}),t}return n},Eg=function(e,t,n){Cg(e.childNodes,function(e){xg(e)&&(t(e)&&n(e),e.hasChildNodes()&&Eg(e,t,n))})},Sg=function(e,t){return y.curry(function(t,n){return!(!n||!Uc.getStyle(e,n,t))},t)},kg=function(e,t,n){return y.curry(function(t,n,r){e.setStyle(r,t,n),""===r.getAttribute("style")&&r.removeAttribute("style"),Tg(e,r)},t,n)},Tg=function(e,t){"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)},Ag=function(e,t){var n;1===t.nodeType&&t.parentNode&&1===t.parentNode.nodeType&&(n=Uc.getTextDecoration(e,t.parentNode),e.getStyle(t,"color")&&n?e.setStyle(t,"text-decoration",n):e.getStyle(t,"text-decoration")===n&&e.setStyle(t,"text-decoration",null))},_g=function(e,t,n,r){Cg(t,function(t){Cg(e.dom.select(t.inline,r),function(r){xg(r)&&yg(e,t,n,r,t.exact?r:null)}),function(e,t,n){if(t.clear_child_styles){var r=t.links?"*:not(a)":"*";Cg(e.select(r,n),function(n){xg(n)&&Cg(t.styles,function(t,r){e.setStyle(n,r,"")})})}}(e.dom,t,r)})},Bg=function(e,t,n,r){(t.styles.color||t.styles.textDecoration)&&(Ot.walk(r,y.curry(Ag,e),"childNodes"),Ag(e,r))},Rg=function(e,t,n,r){t.styles&&t.styles.backgroundColor&&Eg(r,Sg(e,"fontSize"),kg(e,"backgroundColor",Uc.replaceVars(t.styles.backgroundColor,n)))},Dg=function(e,t,n,r){"sub"!==t.inline&&"sup"!==t.inline||(Eg(r,Sg(e,"fontSize"),kg(e,"fontSize","")),e.remove(e.select("sup"===t.inline?"sub":"sup",r),!0))},Og=function(e,t,n,r){r&&!1!==t.merge_siblings&&(r=Ng(e,Uc.getNonWhiteSpaceSibling(r),r),r=Ng(e,r,Uc.getNonWhiteSpaceSibling(r,!0)))},Pg=function(e,t,n,r,o){il.matchNode(e,o.parentNode,n,r)&&yg(e,t,r,o)||t.merge_with_parents&&e.dom.getParent(o.parentNode,function(i){if(il.matchNode(e,i,n,r))return yg(e,t,r,o),!0})},Ig=Ot.each,Lg=function(e,t,n,r){var o,i,a=e.formatter.get(t),s=a[0],u=!r&&e.selection.isCollapsed(),c=e.dom,l=e.selection,f=function(e,t){if(t=t||s,e){if(t.onformat&&t.onformat(e,t,n,r),Ig(t.styles,function(t,r){c.setStyle(e,r,Uc.replaceVars(t,n))}),t.styles){var o=c.getAttrib(e,"style");o&&e.setAttribute("data-mce-style",o)}Ig(t.attributes,function(t,r){c.setAttrib(e,r,Uc.replaceVars(t,n))}),Ig(t.classes,function(t){t=Uc.replaceVars(t,n),c.hasClass(e,t)||c.addClass(e,t)})}},d=function(e,t){var n=!1;return!!s.selector&&(Ig(e,function(e){if(!("collapsed"in e&&e.collapsed!==u))return c.is(t,e.selector)&&!Nl(t)?(f(t,e),n=!0,!1):void 0}),n)},m=function(r,o,i,u){var c,l,m=[],p=!0;c=s.inline||s.block,l=r.create(c),f(l),cg.walk(r,o,function(o){var i,g=function(o){var h,v,y,b;if(b=p,h=o.nodeName.toLowerCase(),v=o.parentNode.nodeName.toLowerCase(),1===o.nodeType&&r.getContentEditable(o)&&(b=p,p="true"===r.getContentEditable(o),y=!0),Uc.isEq(h,"br"))return i=0,void(s.block&&r.remove(o));if(s.wrapper&&il.matchNode(e,o,t,n))i=0;else{if(p&&!y&&s.block&&!s.wrapper&&Uc.isTextBlock(e,h)&&Uc.isValid(e,v,c))return o=r.rename(o,c),f(o),m.push(o),void(i=0);if(s.selector){var C=d(a,o);if(!s.inline||C)return void(i=0)}!p||y||!Uc.isValid(e,c,h)||!Uc.isValid(e,v,c)||!u&&3===o.nodeType&&1===o.nodeValue.length&&65279===o.nodeValue.charCodeAt(0)||Nl(o)||s.inline&&r.isBlock(o)?(i=0,Ig(Ot.grep(o.childNodes),g),y&&(p=b),i=0):(i||(i=r.clone(l,!1),o.parentNode.insertBefore(i,o),m.push(i)),i.appendChild(o))}};Ig(o,g)}),!0===s.links&&Ig(m,function(e){var t=function(e){"A"===e.nodeName&&f(e,s),Ig(Ot.grep(e.childNodes),t)};t(e)}),Ig(m,function(o){var i,u,c,l,d,p=function(e){var t=!1;return Ig(e.childNodes,function(e){if((n=e)&&1===n.nodeType&&!xs.isBookmarkNode(n)&&!Nl(n)&&!vo.isBogus(n))return t=e,!1;var n}),t};u=0,Ig(o.childNodes,function(e){Uc.isWhiteSpaceNode(e)||xs.isBookmarkNode(e)||u++}),i=u,!(m.length>1)&&r.isBlock(o)||0!==i?(s.inline||s.wrapper)&&(s.exact||1!==i||((l=p(c=o))&&!xs.isBookmarkNode(l)&&il.matchName(r,l,s)&&(d=r.clone(l,!1),f(d),r.replace(d,c,!0),r.remove(l,1)),o=d||c),_g(e,a,n,o),Pg(e,s,t,n,o),Rg(r,s,n,o),Dg(r,s,n,o),Og(r,s,n,o)):r.remove(o,1)})};if("false"!==c.getContentEditable(l.getNode())){if(s){if(r)r.nodeType?d(a,r)||((i=c.createRng()).setStartBefore(r),i.setEndAfter(r),m(c,Qc(e,i,a),0,!0)):m(c,r,0,!0);else if(u&&s.inline&&!c.select("td[data-mce-selected],th[data-mce-selected]").length)xl(e,t,n);else{var p=e.selection.getNode();e.settings.forced_root_block||!a[0].defaultBlock||c.getParent(p,c.isBlock)||Lg(e,a[0].defaultBlock),e.selection.setRng(Xs(e.selection.getRng())),o=l.getBookmark(),m(c,Qc(e,l.getRng(),a)),s.styles&&Bg(c,s,n,p),l.moveToBookmark(o),Uc.moveStart(c,l,l.getRng()),e.nodeChanged()}sg(t,e)}}else{r=l.getNode();for(var g=0,h=a.length;g<h;g++)if(a[g].ceFalseOverride&&c.is(r,a[g].selector))return void f(r,a[g])}},Mg={applyFormat:Lg},Fg=Ot.each,zg=function(e,t,n,r,o){var i,a,s,u,c,l,f,d;null===t.get()&&(a=e,s={},(i=t).set({}),a.on("NodeChange",function(e){var t=Uc.getParents(a.dom,e.element),n={};t=Ot.grep(t,function(e){return 1===e.nodeType&&!e.getAttribute("data-mce-bogus")}),Fg(i.get(),function(e,r){Fg(t,function(o){return a.formatter.matchNode(o,r,{},e.similar)?(s[r]||(Fg(e,function(e){e(!0,{node:o,format:r,parents:t})}),s[r]=e),n[r]=e,!1):!il.matchesUnInheritedFormatSelector(a,o,r)&&void 0})}),Fg(s,function(r,o){n[o]||(delete s[o],Fg(r,function(n){n(!1,{node:e.element,format:o,parents:t})}))})})),c=n,l=r,f=o,d=(u=t).get(),Fg(c.split(","),function(e){d[e]||(d[e]=[],d[e].similar=f),d[e].push(l)}),u.set(d)},Ug=function(e){var t={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"left"},inherit:!1,preview:!1,defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"left"},preview:"font-family font-size"}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size",defaultBlock:"div"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size",defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"right"},preview:"font-family font-size"}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"justify"},inherit:!1,defaultBlock:"div",preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:!0},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",styles:{fontSize:"%value"},clear_child_styles:!0},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:function(){return!0},onformat:function(t,n,r){Ot.each(r,function(n,r){e.setAttrib(t,r,n)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return Ot.each("p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp".split(/\s/),function(e){t[e]={block:e,remove:"all"}}),t},Vg=Ot.each,Hg=Xo.DOM,qg=function(e,t){var n,r,o,i=t&&t.schema||Fo({}),a=function(e){var t,n,o;return r="string"==typeof e?{name:e,classes:[],attrs:{}}:e,t=Hg.create(r.name),n=t,(o=r).classes.length&&Hg.addClass(n,o.classes.join(" ")),Hg.setAttribs(n,o.attrs),t},s=function(e,t,n){var r,o,u,c,l,f,d,m,p=t.length>0&&t[0],g=p&&p.name;if(l=g,f="string"!=typeof(c=e)?c.nodeName.toLowerCase():c,d=i.getElementRule(f),u=!(!(m=d&&d.parentsRequired)||!m.length)&&(l&&-1!==Ot.inArray(m,l)?l:m[0]))g===u?(o=t[0],t=t.slice(1)):o=u;else if(p)o=t[0],t=t.slice(1);else if(!n)return e;return o&&(r=a(o)).appendChild(e),n&&(r||(r=Hg.create("div")).appendChild(e),Ot.each(n,function(t){var n=a(t);r.insertBefore(n,e)})),s(r,t,o&&o.siblings)};return e&&e.length?(r=e[0],n=a(r),(o=Hg.create("div")).appendChild(s(n,e.slice(1),r.siblings)),o):""},jg=function(e){var t,n={classes:[],attrs:{}};return"*"!==(e=n.selector=Ot.trim(e))&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,function(e,t,r,o,i){switch(t){case"#":n.attrs.id=r;break;case".":n.classes.push(r);break;case":":-1!==Ot.inArray("checked disabled enabled read-only required".split(" "),r)&&(n.attrs[r]=r)}if("["===o){var a=i.match(/([\w\-]+)(?:\=\"([^\"]+))?/);a&&(n.attrs[a[1]]=a[2])}return""})),n.name=t||"div",n},$g=function(e){return e&&"string"==typeof e?(e=(e=e.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Ot.map(e.split(/(?:>|\s+(?![^\[\]]+\]))/),function(e){var t=Ot.map(e.split(/(?:~\+|~|\+)/),jg),n=t.pop();return t.length&&(n.siblings=t),n}).reverse()):[]},Wg=function(e,t){var n,r,o,i,a,s,u="";if(!1===(s=e.settings.preview_styles))return"";"string"!=typeof s&&(s="font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow");var c=function(e){return e.replace(/%(\w+)/g,"")};if("string"==typeof t){if(!(t=e.formatter.get(t)))return;t=t[0]}return"preview"in t&&!1===(s=t.preview)?"":(n=t.block||t.inline||"span",(i=$g(t.selector)).length?(i[0].name||(i[0].name=n),n=t.selector,r=qg(i,e)):r=qg([n],e),o=Hg.select(n,r)[0]||r.firstChild,Vg(t.styles,function(e,t){(e=c(e))&&Hg.setStyle(o,t,e)}),Vg(t.attributes,function(e,t){(e=c(e))&&Hg.setAttrib(o,t,e)}),Vg(t.classes,function(e){e=c(e),Hg.hasClass(o,e)||Hg.addClass(o,e)}),e.fire("PreviewFormats"),Hg.setStyles(r,{position:"absolute",left:-65535}),e.getBody().appendChild(r),a=Hg.getStyle(e.getBody(),"fontSize",!0),a=/px$/.test(a)?parseInt(a,10):0,Vg(s.split(" "),function(t){var n=Hg.getStyle(o,t,!0);if(!("background-color"===t&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(n)&&(n=Hg.getStyle(e.getBody(),t,!0),"#ffffff"===Hg.toHex(n).toLowerCase())||"color"===t&&"#000000"===Hg.toHex(n).toLowerCase())){if("font-size"===t&&/em|%$/.test(n)){if(0===a)return;n=(n=parseFloat(n)/(/%$/.test(n)?100:1))*a+"px"}"border"===t&&n&&(u+="padding:0 2px;"),u+=t+":"+n+";"}}),e.fire("AfterPreviewFormats"),Hg.remove(r),u)},Kg=function(e,t,n,r,o){var i=t.get(n);!il.match(e,n,r,o)||"toggle"in i[0]&&!i[0].toggle?Mg.applyFormat(e,n,r,o):bg(e,n,r,o)},Xg=function(e){e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(var t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])},Yg=function(e){var t,n,r,o=(n={},(r=function(e,t){e&&("string"!=typeof e?Ot.each(e,function(e,t){r(t,e)}):(t=t.length?t:[t],Ot.each(t,function(e){"undefined"==typeof e.deep&&(e.deep=!e.selector),"undefined"==typeof e.split&&(e.split=!e.selector||e.inline),"undefined"==typeof e.remove&&e.selector&&!e.inline&&(e.remove="none"),e.selector&&e.inline&&(e.mixed=!0,e.block_expand=!0),"string"==typeof e.classes&&(e.classes=e.classes.split(/\s+/))}),n[e]=t))})(Ug((t=e).dom)),r(t.settings.formats),{get:function(e){return e?n[e]:n},register:r,unregister:function(e){return e&&n[e]&&delete n[e],n}}),i=Yl(null);return Xg(e),Cl(e),{get:o.get,register:o.register,unregister:o.unregister,apply:y.curry(Mg.applyFormat,e),remove:y.curry(bg,e),toggle:y.curry(Kg,e,o),match:y.curry(il.match,e),matchAll:y.curry(il.matchAll,e),matchNode:y.curry(il.matchNode,e),canApply:y.curry(il.canApply,e),formatChanged:y.curry(zg,e,i),getCssText:y.curry(Wg,e)}},Gg=function(e){return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(0===t.length)throw new Error("Can't merge zero objects");for(var r={},o=0;o<t.length;o++){var i=t[o];for(var a in i)i.hasOwnProperty(a)&&(r[a]=e(r[a],i[a]))}return r}},Jg=Gg(function(e,t){return tr.isObject(e)&&tr.isObject(t)?Jg(e,t):t}),Qg=Gg(function(e,t){return t}),Zg={deepMerge:Jg,merge:Qg},eh=function(e,t){return e.fire("PreProcess",t)},th=function(e,t){return e.fire("PostProcess",t)},nh=function(e,t,n){e.addAttributeFilter("data-mce-tabindex",function(e,t){for(var n,r=e.length;r--;)(n=e[r]).attr("tabindex",n.attributes.map["data-mce-tabindex"]),n.attr(t,null)}),e.addAttributeFilter("src,href,style",function(e,r){for(var o,i,a=e.length,s="data-mce-"+r,u=t.url_converter,c=t.url_converter_scope;a--;)(i=(o=e[a]).attributes.map[s])!==undefined?(o.attr(r,i.length>0?i:null),o.attr(s,null)):(i=o.attributes.map[r],"style"===r?i=n.serializeStyle(n.parseStyle(i),o.name):u&&(i=u.call(c,i,r,o.name)),o.attr(r,i.length>0?i:null))}),e.addAttributeFilter("class",function(e){for(var t,n,r=e.length;r--;)(n=(t=e[r]).attr("class"))&&(n=t.attr("class").replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),t.attr("class",n.length>0?n:null))}),e.addAttributeFilter("data-mce-type",function(e,t,n){for(var r,o=e.length;o--;)"bookmark"!==(r=e[o]).attributes.map["data-mce-type"]||n.cleanup||r.remove()}),e.addNodeFilter("noscript",function(e){for(var t,n=e.length;n--;)(t=e[n].firstChild)&&(t.value=Ao.decode(t.value))}),e.addNodeFilter("script,style",function(e,n){for(var r,o,i,a=e.length,s=function(e){return e.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")};a--;)o=(r=e[a]).firstChild?r.firstChild.value:"","script"===n?((i=r.attr("type"))&&r.attr("type","mce-no/type"===i?null:i.replace(/^mce\-/,"")),"xhtml"===t.element_format&&o.length>0&&(r.firstChild.value="// <![CDATA[\n"+s(o)+"\n// ]]>")):"xhtml"===t.element_format&&o.length>0&&(r.firstChild.value="\x3c!--\n"+s(o)+"\n--\x3e")}),e.addNodeFilter("#comment",function(e){for(var t,n=e.length;n--;)0===(t=e[n]).value.indexOf("[CDATA[")?(t.name="#cdata",t.type=4,t.value=t.value.replace(/^\[CDATA\[|\]\]$/g,"")):0===t.value.indexOf("mce:protected ")&&(t.name="#text",t.type=3,t.raw=!0,t.value=unescape(t.value).substr(14))}),e.addNodeFilter("xml:namespace,input",function(e,t){for(var n,r=e.length;r--;)7===(n=e[r]).type?n.remove():1===n.type&&("input"!==t||"type"in n.attributes.map||n.attr("type","text"))}),e.addAttributeFilter("data-mce-type",function(t){M.each(t,function(t){"format-caret"===t.attr("data-mce-type")&&(t.isEmpty(e.schema.getNonEmptyElements())?t.remove():t.unwrap())})}),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-type,data-mce-resize",function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)})},rh=function(e){var t,n,r=function(e){return e&&"br"===e.name};r(t=e.lastChild)&&r(n=t.prev)&&(t.remove(),n.remove())},oh=function(e,t,n){return f=n,(l=e)&&l.hasEventListeners("PreProcess")&&!f.no_events?(o=t,i=n,c=(r=e).dom,o=o.cloneNode(!0),(a=document.implementation).createHTMLDocument&&(s=a.createHTMLDocument(""),Ot.each("BODY"===o.nodeName?o.childNodes:[o],function(e){s.body.appendChild(s.importNode(e,!0))}),o="BODY"!==o.nodeName?s.body.firstChild:s.body,u=c.doc,c.doc=s),eh(r,Zg.merge(i,{node:o})),u&&(c.doc=u),o):t;var r,o,i,a,s,u,c,l,f},ih=function(e,t,n){e.addNodeFilter("font",function(e){M.each(e,function(e){var r,o,i=t.parse(e.attr("style")),a=e.attr("color"),s=e.attr("face"),u=e.attr("size");a&&(i.color=a),s&&(i["font-family"]=s),u&&(i["font-size"]=n[parseInt(e.attr("size"),10)-1]),e.name="span",e.attr("style",t.serialize(i)),r=e,o=["color","face","size"],M.each(o,function(e){r.attr(e,null)})})})},ah=function(e,t){var n,r=zo();t.convert_fonts_to_spans&&ih(e,r,Ot.explode(t.font_size_legacy_values)),n=r,e.addNodeFilter("strike",function(e){M.each(e,function(e){var t=n.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",n.serialize(t))})})},sh=function(e,t){t.inline_styles&&ah(e,t)},uh=/^[ \t\r\n]*$/,ch={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},lh=function(e,t,n){var r,o,i=n?"lastChild":"firstChild",a=n?"prev":"next";if(e[i])return e[i];if(e!==t){if(r=e[a])return r;for(o=e.parent;o&&o!==t;o=o.parent)if(r=o[a])return r}},fh=function(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})};fh.prototype={replace:function(e){return e.parent&&e.remove(),this.insert(e,this),this.remove(),this},attr:function(e,t){var n,r;if("string"!=typeof e){for(r in e)this.attr(r,e[r]);return this}if(n=this.attributes){if(t!==undefined){if(null===t){if(e in n.map)for(delete n.map[e],r=n.length;r--;)if(n[r].name===e)return n=n.splice(r,1),this;return this}if(e in n.map){for(r=n.length;r--;)if(n[r].name===e){n[r].value=t;break}}else n.push({name:e,value:t});return n.map[e]=t,this}return n.map[e]}},clone:function(){var e,t,n,r,o,i=new fh(this.name,this.type);if(n=this.attributes){for((o=[]).map={},e=0,t=n.length;e<t;e++)"id"!==(r=n[e]).name&&(o[o.length]={name:r.name,value:r.value},o.map[r.name]=r.value);i.attributes=o}return i.value=this.value,i.shortEnded=this.shortEnded,i},wrap:function(e){return this.parent.insert(e,this),e.append(this),this},unwrap:function(){var e,t;for(e=this.firstChild;e;)t=e.next,this.insert(e,this,!0),e=t;this.remove()},remove:function(){var e=this.parent,t=this.next,n=this.prev;return e&&(e.firstChild===this?(e.firstChild=t,t&&(t.prev=null)):n.next=t,e.lastChild===this?(e.lastChild=n,n&&(n.next=null)):t.prev=n,this.parent=this.next=this.prev=null),this},append:function(e){var t;return e.parent&&e.remove(),(t=this.lastChild)?(t.next=e,e.prev=t,this.lastChild=e):this.lastChild=this.firstChild=e,e.parent=this,e},insert:function(e,t,n){var r;return e.parent&&e.remove(),r=t.parent||this,n?(t===r.firstChild?r.firstChild=e:t.prev.next=e,e.prev=t.prev,e.next=t,t.prev=e):(t===r.lastChild?r.lastChild=e:t.next.prev=e,e.next=t.next,e.prev=t,t.next=e),e.parent=r,e},getAll:function(e){var t,n=[];for(t=this.firstChild;t;t=lh(t,this))t.name===e&&n.push(t);return n},empty:function(){var e,t,n;if(this.firstChild){for(e=[],n=this.firstChild;n;n=lh(n,this))e.push(n);for(t=e.length;t--;)(n=e[t]).parent=n.firstChild=n.lastChild=n.next=n.prev=null}return this.firstChild=this.lastChild=null,this},isEmpty:function(e,t,n){var r,o,i=this.firstChild;if(t=t||{},i)do{if(1===i.type){if(i.attributes.map["data-mce-bogus"])continue;if(e[i.name])return!1;for(r=i.attributes.length;r--;)if("name"===(o=i.attributes[r].name)||0===o.indexOf("data-mce-bookmark"))return!1}if(8===i.type)return!1;if(3===i.type&&!uh.test(i.value))return!1;if(3===i.type&&i.parent&&t[i.parent.name]&&uh.test(i.value))return!1;if(n&&n(i))return!1}while(i=lh(i,this));return!0},walk:function(e){return lh(this,null,e)}},fh.create=function(e,t){var n,r;if(n=new fh(e,ch[e]||1),t)for(r in t)n.attr(r,t[r]);return n};var dh=Ot.makeMap,mh=Ot.each,ph=Ot.explode,gh=Ot.extend,hh=function(e,t,n,r){(e.padd_empty_with_br||t.insert)&&n[r.name]?r.empty().append(new fh("br","1")).shortEnded=!0:r.empty().append(new fh("#text","3")).value="\xa0"},vh=function(e,t){return e&&e.firstChild&&e.firstChild===e.lastChild&&e.firstChild.name===t},yh=function(e,t,n,r){return r.isEmpty(t,n,function(t){return n=t,(r=e.getElementRule(n.name))&&r.paddEmpty;var n,r})},bh=function(e,t){var n={},r={},o=[],i={},a={};return(e=e||{}).validate=!("validate"in e)||e.validate,e.root_name=e.root_name||"body",n.schema=t=t||Fo(),n.filterNode=function(e){var t,n,s;n in r&&((s=i[n])?s.push(e):i[n]=[e]),t=o.length;for(;t--;)(n=o[t].name)in e.attributes.map&&((s=a[n])?s.push(e):a[n]=[e]);return e},n.addNodeFilter=function(e,t){mh(ph(e),function(e){var n=r[e];n||(r[e]=n=[]),n.push(t)})},n.addAttributeFilter=function(e,t){mh(ph(e),function(e){var n;for(n=0;n<o.length;n++)if(o[n].name===e)return void o[n].callbacks.push(t);o.push({name:e,callbacks:[t]})})},n.parse=function(s,u){var c,l,f,d,m,p,g,h,v,y,b,C,x,w,N,E,S,k,T,A,_,B=[];u=u||{},i={},a={},C=gh(dh("script,style,head,html,body,title,meta,param"),t.getBlockElements()),A=t.getNonEmptyElements(),T=t.children,b=e.validate,_="forced_root_block"in u?u.forced_root_block:e.forced_root_block,k=t.getWhiteSpaceElements(),x=/^[ \t\r\n]+/,N=/[ \t\r\n]+$/,E=/[ \t\r\n]+/g,S=/^[ \t\r\n]+$/;var R=function(e,t){var n,o=new fh(e,t);return e in r&&((n=i[e])?n.push(o):i[e]=[o]),o},D=function(e){var n,r,o,i,a=t.getBlockElements();for(n=e.prev;n&&3===n.type;){if((o=n.value.replace(N,"")).length>0)return void(n.value=o);if(r=n.next){if(3===r.type&&r.value.length){n=n.prev;continue}if(!a[r.name]&&"script"!==r.name&&"style"!==r.name){n=n.prev;continue}}i=n.prev,n.remove(),n=i}};if(c=new em({validate:b,allow_script_urls:e.allow_script_urls,allow_conditional_comments:e.allow_conditional_comments,self_closing_elements:function(e){var t,n={};for(t in e)"li"!==t&&"p"!==t&&(n[t]=e[t]);return n}(t.getSelfClosingElements()),cdata:function(e){f.append(R("#cdata",4)).value=e},text:function(e,t){var n;w||(e=e.replace(E," "),f.lastChild&&C[f.lastChild.name]&&(e=e.replace(x,""))),0!==e.length&&((n=R("#text",3)).raw=!!t,f.append(n).value=e)},comment:function(e){f.append(R("#comment",8)).value=e},pi:function(e,t){f.append(R(e,7)).value=t,D(f)},doctype:function(e){f.append(R("#doctype",10)).value=e,D(f)},start:function(e,n,r){var i,s,u,c,l;if(u=b?t.getElementRule(e):{}){for((i=R(u.outputName||e,1)).attributes=n,i.shortEnded=r,f.append(i),(l=T[f.name])&&T[i.name]&&!l[i.name]&&B.push(i),s=o.length;s--;)(c=o[s].name)in n.map&&((v=a[c])?v.push(i):a[c]=[i]);C[e]&&D(i),r||(f=i),!w&&k[e]&&(w=!0)}},end:function(n){var r,o,i,a,s,c;if(o=b?t.getElementRule(n):{}){if(C[n]&&!w){if((r=f.firstChild)&&3===r.type)if((i=r.value.replace(x,"")).length>0)r.value=i,r=r.next;else for(a=r.next,r.remove(),r=a;r&&3===r.type;)i=r.value,a=r.next,(0===i.length||S.test(i))&&(r.remove(),r=a),r=a;if((r=f.lastChild)&&3===r.type)if((i=r.value.replace(N,"")).length>0)r.value=i,r=r.prev;else for(a=r.prev,r.remove(),r=a;r&&3===r.type;)i=r.value,a=r.prev,(0===i.length||S.test(i))&&(r.remove(),r=a),r=a}if(w&&k[n]&&(w=!1),o.removeEmpty&&yh(t,A,k,f)&&!f.attributes.map.name&&!f.attributes.map.id)return s=f.parent,C[f.name]?f.empty().remove():f.unwrap(),void(f=s);o.paddEmpty&&(vh(c=f,"#text")&&"\xa0"===c.firstChild.value||yh(t,A,k,f))&&hh(e,u,C,f),f=f.parent}}},t),l=f=new fh(u.context||e.root_name,11),c.parse(s),b&&B.length&&(u.context?u.invalid=!0:function(e){var r,o,i,a,s,u,c,l,f,d,m,p,g,h,v,y;for(p=dh("tr,td,th,tbody,thead,tfoot,table"),d=t.getNonEmptyElements(),m=t.getWhiteSpaceElements(),g=t.getTextBlockElements(),h=t.getSpecialElements(),r=0;r<e.length;r++)if((o=e[r]).parent&&!o.fixed)if(g[o.name]&&"li"===o.parent.name){for(v=o.next;v&&g[v.name];)v.name="li",v.fixed=!0,o.parent.insert(v,o.parent),v=v.next;o.unwrap(o)}else{for(a=[o],i=o.parent;i&&!t.isValidChild(i.name,o.name)&&!p[i.name];i=i.parent)a.push(i);if(i&&a.length>1){for(a.reverse(),s=u=n.filterNode(a[0].clone()),f=0;f<a.length-1;f++){for(t.isValidChild(u.name,a[f].name)?(c=n.filterNode(a[f].clone()),u.append(c)):c=u,l=a[f].firstChild;l&&l!==a[f+1];)y=l.next,c.append(l),l=y;u=c}yh(t,d,m,s)?i.insert(o,a[0],!0):(i.insert(s,a[0],!0),i.insert(o,s)),i=a[0],(yh(t,d,m,i)||vh(i,"br"))&&i.empty().remove()}else if(o.parent){if("li"===o.name){if((v=o.prev)&&("ul"===v.name||"ul"===v.name)){v.append(o);continue}if((v=o.next)&&("ul"===v.name||"ul"===v.name)){v.insert(o,v.firstChild,!0);continue}o.wrap(n.filterNode(new fh("ul",1)));continue}t.isValidChild(o.parent.name,"div")&&t.isValidChild("div",o.name)?o.wrap(n.filterNode(new fh("div",1))):h[o.name]?o.empty().remove():o.unwrap()}}}(B)),_&&("body"===l.name||u.isRootContent)&&function(){var n,r,o=l.firstChild,i=function(e){e&&((o=e.firstChild)&&3===o.type&&(o.value=o.value.replace(x,"")),(o=e.lastChild)&&3===o.type&&(o.value=o.value.replace(N,"")))};if(t.isValidChild(l.name,_.toLowerCase())){for(;o;)n=o.next,3===o.type||1===o.type&&"p"!==o.name&&!C[o.name]&&!o.attr("data-mce-type")?r?r.append(o):((r=R(_,1)).attr(e.forced_root_block_attrs),l.insert(r,o),r.append(o)):(i(r),r=null),o=n;i(r)}}(),!u.invalid){for(y in i){for(v=r[y],g=(d=i[y]).length;g--;)d[g].parent||d.splice(g,1);for(m=0,p=v.length;m<p;m++)v[m](d,y,u)}for(m=0,p=o.length;m<p;m++)if((v=o[m]).name in a){for(g=(d=a[v.name]).length;g--;)d[g].parent||d.splice(g,1);for(g=0,h=v.callbacks.length;g<h;g++)v.callbacks[g](d,v.name,u)}}return l},e.remove_trailing_brs&&n.addNodeFilter("br",function(n,r,o){var i,a,s,u,c,l,f,d,m=n.length,p=gh({},t.getBlockElements()),g=t.getNonEmptyElements(),h=t.getNonEmptyElements();for(p.body=1,i=0;i<m;i++)if(s=(a=n[i]).parent,p[a.parent.name]&&a===s.lastChild){for(c=a.prev;c;){if("span"!==(l=c.name)||"bookmark"!==c.attr("data-mce-type")){if("br"!==l)break;if("br"===l){a=null;break}}c=c.prev}a&&(a.remove(),yh(t,g,h,s)&&(f=t.getElementRule(s.name))&&(f.removeEmpty?s.remove():f.paddEmpty&&hh(e,o,p,s)))}else{for(u=a;s&&s.firstChild===u&&s.lastChild===u&&(u=s,!p[s.name]);)s=s.parent;u===s&&!0!==e.padd_empty_with_br&&((d=new fh("#text",3)).value="\xa0",a.replace(d))}}),n.addAttributeFilter("href",function(t){var n,r,o,i=t.length;if(!e.allow_unsafe_link_target)for(;i--;)"a"===(n=t[i]).name&&"_blank"===n.attr("target")&&n.attr("rel",(r=n.attr("rel"),o=r?Ot.trim(r):"",/\b(noopener)\b/g.test(o)?o:o.split(" ").filter(function(e){return e.length>0}).concat(["noopener"]).sort().join(" ")))}),e.allow_html_in_named_anchor||n.addAttributeFilter("id,name",function(e){for(var t,n,r,o,i=e.length;i--;)if("a"===(o=e[i]).name&&o.firstChild&&!o.attr("href")){r=o.parent,t=o.lastChild;do{n=t.prev,r.insert(t,o),t=n}while(t)}}),e.fix_list_elements&&n.addNodeFilter("ul,ol",function(e){for(var t,n,r=e.length;r--;)if("ul"===(n=(t=e[r]).parent).name||"ol"===n.name)if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{var o=new fh("li",1);o.attr("style","list-style-type: none"),t.wrap(o)}}),e.validate&&t.getValidClasses()&&n.addAttributeFilter("class",function(e){for(var n,r,o,i,a,s,u,c=e.length,l=t.getValidClasses();c--;){for(r=(n=e[c]).attr("class").split(" "),a="",o=0;o<r.length;o++)i=r[o],u=!1,(s=l["*"])&&s[i]&&(u=!0),s=l[n.name],!u&&s&&s[i]&&(u=!0),u&&(a&&(a+=" "),a+=i);a.length||(a=null),n.attr("class",a)}}),sh(n,e),n},Ch=function(e,t,n){-1===Ot.inArray(t,n)&&(e.addAttributeFilter(n,function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)}),t.push(n))},xh=function(e,t,n,r,o){var i,a,s,u,c=(i=r,zs(t,n).serialize(i));return a=e,u=c,!(s=o).no_events&&a?th(a,Zg.merge(s,{content:u})).content:u},wh=function(e,t){var n,r,o,i=["data-mce-selected"];return n=t&&t.dom?t.dom:Xo.DOM,r=t&&t.schema?t.schema:Fo(e),e.entity_encoding=e.entity_encoding||"named",e.remove_trailing_brs=!("remove_trailing_brs"in e)||e.remove_trailing_brs,o=bh(e,r),nh(o,e,n),{schema:r,addNodeFilter:o.addNodeFilter,addAttributeFilter:o.addAttributeFilter,serialize:function(i,a){var s,u,c,l,f,d,m,p,g,h=Zg.merge({format:"html"},a||{}),v=oh(t,i,h),y=(s=n,u=v,l=ii((c=h).getInner?u.innerHTML:s.getOuterHTML(u)),c.selection?l:Ot.trim(l)),b=(f=o,d=y,p=(m=h).selection?Zg.merge({forced_root_block:!1},m):m,g=f.parse(d,p),rh(g),g);return"tree"===h.format?b:xh(t,e,r,b,h)},addRules:function(e){r.addValidElements(e)},setRules:function(e){r.setValidElements(e)},addTempAttr:y.curry(Ch,o,i),getTempAttrs:function(){return i}}},Nh=function(e,t){var n=wh(e,t);return{schema:n.schema,addNodeFilter:n.addNodeFilter,addAttributeFilter:n.addAttributeFilter,serialize:n.serialize,addRules:n.addRules,setRules:n.setRules,addTempAttr:n.addTempAttr,getTempAttrs:n.getTempAttrs}},Eh=function(e,t){var n;t.hasAttribute("data-mce-caret")&&(mi.showCaretContainerBlock(t),(n=e).selection.setRng(n.selection.getRng()),e.selection.scrollIntoView(t))},Sh=function(e,t){var n,r=(n=e,Nu(Hn.fromDom(n.getBody()),"*[data-mce-caret]").fold(y.constant(null),function(e){return e.dom()}));if(r)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void Eh(e,r)):void(mi.hasContent(r)&&Eh(e,r))},kh=function(e){e.on("keyup compositionstart",y.curry(Sh,e))};function Th(e){return{getBookmark:y.curry(xs.getBookmark,e),moveToBookmark:y.curry(xs.moveToBookmark,e)}}(Th||(Th={})).isBookmarkNode=xs.isBookmarkNode;var Ah=Th,_h=vo.isContentEditableFalse,Bh=vo.isContentEditableTrue,Rh=function(e,t){var n,r,o,i,a,s,u,c,l,f,d,m,p,g,h,v,y,b=t.dom,C=Ot.each,x=t.getDoc(),w=document,N=Math.abs,E=Math.round,S=t.getBody();i={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]};var k=".mce-content-body";t.contentStyles.push(k+" div.mce-resizehandle {position: absolute;border: 1px solid black;box-sizing: content-box;background: #FFF;width: 7px;height: 7px;z-index: 10000}"+k+" .mce-resizehandle:hover {background: #000}"+k+" img[data-mce-selected],"+k+" hr[data-mce-selected] {outline: 1px solid black;resize: none}"+k+" .mce-clonedresizable {position: absolute;"+(me.gecko?"":"outline: 1px dashed black;")+"opacity: .5;filter: alpha(opacity=50);z-index: 10000}"+k+" .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001}");var T=function(e){return e&&("IMG"===e.nodeName||t.dom.is(e,"figure.image"))},A=function(e){var n,r,o=e.target;n=e,r=t.selection.getRng(),!T(n.target)||kp(n.clientX,n.clientY,r)||e.isDefaultPrevented()||(e.preventDefault(),t.selection.select(o))},_=function(e){return t.dom.is(e,"figure.image")?e.querySelector("img"):e},B=function(e){var n=t.settings.object_resizing;return!1!==n&&!me.iOS&&("string"!=typeof n&&(n="table,img,figure.image,div"),"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&_r.is(Hn.fromDom(e),n))},R=function(e){var i,C,x,w;i=e.screenX-s,C=e.screenY-u,g=i*a[2]+f,h=C*a[3]+d,g=g<5?5:g,h=h<5?5:h,(T(n)&&!1!==t.settings.resize_img_proportional?!Mp.modifierPressed(e):Mp.modifierPressed(e)||T(n)&&a[2]*a[3]!=0)&&(N(i)>N(C)?(h=E(g*m),g=E(h/m)):(g=E(h/m),h=E(g*m))),b.setStyles(_(r),{width:g,height:h}),x=a.startPos.x+i,w=a.startPos.y+C,x=x>0?x:0,w=w>0?w:0,b.setStyles(o,{left:x,top:w,display:"block"}),o.innerHTML=g+" &times; "+h,a[2]<0&&r.clientWidth<=g&&b.setStyle(r,"left",c+(f-g)),a[3]<0&&r.clientHeight<=h&&b.setStyle(r,"top",l+(d-h)),(i=S.scrollWidth-v)+(C=S.scrollHeight-y)!=0&&b.setStyles(o,{left:x-i,top:w-C}),p||(t.fire("ObjectResizeStart",{target:n,width:f,height:d}),p=!0)},D=function(){p=!1;var e=function(e,r){r&&(n.style[e]||!t.schema.isValid(n.nodeName.toLowerCase(),e)?b.setStyle(_(n),e,r):b.setAttrib(_(n),e,r))};e("width",g),e("height",h),b.unbind(x,"mousemove",R),b.unbind(x,"mouseup",D),w!==x&&(b.unbind(w,"mousemove",R),b.unbind(w,"mouseup",D)),b.remove(r),b.remove(o),O(n),t.fire("ObjectResized",{target:n,width:g,height:h}),b.setAttrib(n,"style",b.getAttrib(n,"style")),t.nodeChanged()},O=function(e){var p,N,E,k,T;P(),M(),p=b.getPos(e,S),c=p.x,l=p.y,T=e.getBoundingClientRect(),N=T.width||T.right-T.left,E=T.height||T.bottom-T.top,n!==e&&(n=e,g=h=0),k=t.fire("ObjectSelected",{target:e}),B(e)&&!k.isDefaultPrevented()?C(i,function(e,t){var i;(i=b.get("mceResizeHandle"+t))&&b.remove(i),i=b.add(S,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all","class":"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),me.ie&&(i.contentEditable=!1),b.bind(i,"mousedown",function(t){var i;t.stopImmediatePropagation(),t.preventDefault(),s=(i=t).screenX,u=i.screenY,f=_(n).clientWidth,d=_(n).clientHeight,m=d/f,a=e,e.startPos={x:N*e[0]+c,y:E*e[1]+l},v=S.scrollWidth,y=S.scrollHeight,r=n.cloneNode(!0),b.addClass(r,"mce-clonedresizable"),b.setAttrib(r,"data-mce-bogus","all"),r.contentEditable=!1,r.unSelectabe=!0,b.setStyles(r,{left:c,top:l,margin:0}),r.removeAttribute("data-mce-selected"),S.appendChild(r),b.bind(x,"mousemove",R),b.bind(x,"mouseup",D),w!==x&&(b.bind(w,"mousemove",R),b.bind(w,"mouseup",D)),o=b.add(S,"div",{"class":"mce-resize-helper","data-mce-bogus":"all"},f+" &times; "+d)}),e.elm=i,b.setStyles(i,{left:N*e[0]+c-i.offsetWidth/2,top:E*e[1]+l-i.offsetHeight/2})}):P(),n.setAttribute("data-mce-selected","1")},P=function(){var e,t;for(e in M(),n&&n.removeAttribute("data-mce-selected"),i)(t=b.get("mceResizeHandle"+e))&&(b.unbind(t),b.remove(t))},I=function(n){var r,o=function(e,t){if(e)do{if(e===t)return!0}while(e=e.parentNode)};p||t.removed||(C(b.select("img[data-mce-selected],hr[data-mce-selected]"),function(e){e.removeAttribute("data-mce-selected")}),r="mousedown"===n.type?n.target:e.getNode(),o(r=b.$(r).closest("table,img,figure.image,hr")[0],S)&&(F(),o(e.getStart(!0),r)&&o(e.getEnd(!0),r))?O(r):P())},L=function(e){return _h(function(e,t){for(;t&&t!==e;){if(Bh(t)||_h(t))return t;t=t.parentNode}return null}(t.getBody(),e))},M=function(){for(var e in i){var t=i[e];t.elm&&(b.unbind(t.elm),delete t.elm)}},F=function(){try{t.getDoc().execCommand("enableObjectResizing",!1,!1)}catch(e){}};return t.on("init",function(){F(),me.ie&&me.ie>=11&&(t.on("mousedown click",function(e){var n=e.target,r=n.nodeName;p||!/^(TABLE|IMG|HR)$/.test(r)||L(n)||(2!==e.button&&t.selection.select(n,"TABLE"===r),"mousedown"===e.type&&t.nodeChanged())}),t.dom.bind(S,"mscontrolselect",function(e){var n=function(e){ye.setEditorTimeout(t,function(){t.selection.select(e)})};if(L(e.target))return e.preventDefault(),void n(e.target);/^(TABLE|IMG|HR)$/.test(e.target.nodeName)&&(e.preventDefault(),"IMG"===e.target.tagName&&n(e.target))}));var e=ye.throttle(function(e){t.composing||I(e)});t.on("nodechange ResizeEditor ResizeWindow drop",e),t.on("keyup compositionend",function(t){n&&"TABLE"===n.nodeName&&e(t)}),t.on("hide blur",P),t.on("contextmenu",A)}),t.on("remove",M),{isResizable:B,showResizeRect:O,hideResizeRect:P,updateResizeRect:I,destroy:function(){n=r=null}}},Dh=function(e){for(var t=0,n=0,r=e;r&&r.nodeType;)t+=r.offsetLeft||0,n+=r.offsetTop||0,r=r.offsetParent;return{x:t,y:n}},Oh=function(e,t,n){var r,o,i,a,s,u=e.dom,c=u.getRoot(),l=0;if(s={elm:t,alignToTop:n},e.fire("scrollIntoView",s),!s.isDefaultPrevented()&&vo.isElement(t)){if(!1===n&&(l=t.offsetHeight),"BODY"!==c.nodeName){var f=e.selection.getScrollContainer();if(f)return r=Dh(t).y-Dh(f).y+l,a=f.clientHeight,void((r<(i=f.scrollTop)||r+25>i+a)&&(f.scrollTop=r<i?r:r-a+25))}o=u.getViewPort(e.getWin()),r=u.getPos(t).y+l,i=o.y,a=o.h,(r<o.y||r+25>i+a)&&e.getWin().scrollTo(0,r<i?r:r-a+25)}},Ph=function(e){return vo.isContentEditableTrue(e)||vo.isContentEditableFalse(e)},Ih=function(e,t,n){var r,o,i,a,s,u=n;if(u.caretPositionFromPoint)(o=u.caretPositionFromPoint(e,t))&&((r=n.createRange()).setStart(o.offsetNode,o.offset),r.collapse(!0));else if(n.caretRangeFromPoint)r=n.caretRangeFromPoint(e,t);else if(u.body.createTextRange){r=u.body.createTextRange();try{r.moveToPoint(e,t),r.collapse(!0)}catch(c){r=function(e,t,n){var r,o,i;if(r=n.elementFromPoint(e,t),o=n.body.createTextRange(),r&&"HTML"!==r.tagName||(r=n.body),o.moveToElementText(r),(i=(i=Ot.toArray(o.getClientRects())).sort(function(e,n){return(e=Math.abs(Math.max(e.top-t,e.bottom-t)))-(n=Math.abs(Math.max(n.top-t,n.bottom-t)))})).length>0){t=(i[0].bottom+i[0].top)/2;try{return o.moveToPoint(e,t),o.collapse(!0),o}catch(a){}}return null}(e,t,n)}return i=r,a=n.body,s=i&&i.parentElement?i.parentElement():null,vo.isContentEditableFalse(function(e,t,n){for(;e&&e!==t;){if(n(e))return e;e=e.parentNode}return null}(s,a,Ph))?null:i}return r},Lh=function(e,t){return M.map(t,function(t){var n=e.fire("GetSelectionRange",{range:t});return n.range!==t?n.range:t})},Mh=function(e,t){return Hn.fromDom(e.dom().cloneNode(t))},Fh=function(e){return Mh(e,!0)},zh=function(e){return Mh(e,!1)},Uh=Fh,Vh=function(e,t){var n=(t||document).createDocumentFragment();return M.each(e,function(e){n.appendChild(e.dom())}),Hn.fromDom(n)},Hh=function(e){return Ur.firstChild(e).fold(y.constant([e]),function(t){return[e].concat(Hh(t))})},qh=function(e){return Ur.lastChild(e).fold(y.constant([e]),function(t){return"br"===Zn.name(t)?Ur.prevSibling(t).map(function(t){return[e].concat(qh(t))}).getOr([]):[e].concat(qh(t))})},jh=function(e,t){return hs([(i=t,a=i.startContainer,s=i.startOffset,vo.isText(a)?0===s?E.some(Hn.fromDom(a)):E.none():E.from(a.childNodes[s]).map(Hn.fromDom)),(n=t,r=n.endContainer,o=n.endOffset,vo.isText(r)?o===r.data.length?E.some(Hn.fromDom(r)):E.none():E.from(r.childNodes[o-1]).map(Hn.fromDom))],function(t,n){var r=M.find(Hh(e),y.curry(Dr.eq,t)),o=M.find(qh(e),y.curry(Dr.eq,n));return r.isSome()&&o.isSome()}).getOr(!1);var n,r,o,i,a,s},$h=function(e,t,n,r){var o=n,i=new to(n,o),a=e.schema.getNonEmptyElements();do{if(3===n.nodeType&&0!==Ot.trim(n.nodeValue).length)return void(r?t.setStart(n,0):t.setEnd(n,n.nodeValue.length));if(a[n.nodeName]&&!/^(TD|TH)$/.test(n.nodeName))return void(r?t.setStartBefore(n):"BR"===n.nodeName?t.setEndBefore(n):t.setEndAfter(n));if(me.ie&&me.ie<11&&e.isBlock(n)&&e.isEmpty(n))return void(r?t.setStart(n,0):t.setEnd(n,0))}while(n=r?i.next():i.prev());"BODY"===o.nodeName&&(r?t.setStart(o,0):t.setEnd(o,o.childNodes.length))},Wh=xr("element","width","rows"),Kh=xr("element","cells"),Xh=xr("x","y"),Yh=function(e,t){var n=parseInt(dr.get(e,t),10);return isNaN(n)?1:n},Gh=function(e){return M.foldl(e,function(e,t){return t.cells().length>e?t.cells().length:e},0)},Jh=function(e,t){for(var n=e.rows(),r=0;r<n.length;r++)for(var o=n[r].cells(),i=0;i<o.length;i++)if(Dr.eq(o[i],t))return E.some(Xh(i,r));return E.none()},Qh=function(e,t,n,r,o){for(var i=[],a=e.rows(),s=n;s<=o;s++){var u=a[s].cells(),c=t<r?u.slice(t,r+1):u.slice(r,t+1);i.push(Kh(a[s].element(),c))}return i},Zh=function(e){var t=Wh(zh(e),0,[]);return M.each(Os(e,"tr"),function(e,n){M.each(Os(e,"td,th"),function(r,o){!function(e,t,n,r,o){for(var i=Yh(o,"rowspan"),a=Yh(o,"colspan"),s=e.rows(),u=n;u<n+i;u++){s[u]||(s[u]=Kh(Uh(r),[]));for(var c=t;c<t+a;c++)s[u].cells()[c]=u===n&&c===t?o:zh(o)}}(t,function(e,t,n){for(;r=t,o=n,i=void 0,((i=e.rows())[o]?i[o].cells():[])[r];)t++;var r,o,i;return t}(t,o,n),n,e,r)})}),Wh(t.element(),Gh(t.rows()),t.rows())},ev=function(e){return t=e,i=e,n=M.map(i.rows(),function(e){var t=M.map(e.cells(),function(e){var t=Uh(e);return dr.remove(t,"colspan"),dr.remove(t,"rowspan"),t}),n=zh(e.element());return As(n,t),n}),r=zh(t.element()),o=Hn.fromTag("tbody"),As(o,n),ks.append(r,o),r;var t,n,r,o,i},tv=function(e,t,n){return Jh(e,t).bind(function(t){return Jh(e,n).map(function(n){return r=e,i=n,a=(o=t).x(),s=o.y(),u=i.x(),c=i.y(),l=s<c?Qh(r,a,s,u,c):Qh(r,a,c,u,s),Wh(r.element(),Gh(l),l);var r,o,i,a,s,u,c,l})})},nv=function(e,t){return M.find(e,function(e){return"li"===Zn.name(e)&&jh(e,t)}).fold(y.constant([]),function(t){return(n=e,M.find(n,function(e){return"ul"===Zn.name(e)||"ol"===Zn.name(e)})).map(function(e){return[Hn.fromTag("li"),Hn.fromTag(Zn.name(e))]}).getOr([]);var n})},rv=function(e,t){var n,r=Hn.fromDom(t.commonAncestorContainer),o=Uu(r,e),i=M.filter(o,function(e){return io.isInline(e)||io.isHeading(e)}),a=nv(o,t),s=i.concat(a.length?a:(n=r,io.isListItem(n)?Ur.parent(n).filter(io.isList).fold(y.constant([]),function(e){return[n,e]}):io.isList(n)?[n]:[]));return M.map(s,zh)},ov=function(){return Vh([])},iv=function(e,t){return n=Hn.fromDom(t.cloneContents()),r=rv(e,t),o=M.foldl(r,function(e,t){return ks.append(t,e),t},n),r.length>0?Vh([o]):o;var n,r,o},av=function(e,t){return(n=e,r=t[0],wu(r,"table",y.curry(Dr.eq,n))).bind(function(e){var n=t[0],r=t[t.length-1],o=Zh(e);return tv(o,n,r).map(function(e){return Vh([ev(e)])})}).getOrThunk(ov);var n,r},sv=function(e,t){var n,r,o=Af(t,e);return o.length>0?av(e,o):(n=e,(r=t).length>0&&r[0].collapsed?ov():iv(n,r[0]))},uv=function(e,t){var n,r=e.selection.getRng(),o=e.dom.create("body"),i=e.selection.getSel(),a=Lh(e,wf(i));if((t=t||{}).get=!0,t.format=t.format||"html",t.selection=!0,(t=e.fire("BeforeGetContent",t)).isDefaultPrevented())return e.fire("GetContent",t),t.content;if("text"===t.format)return e.selection.isCollapsed()?"":ii(r.text||(i.toString?i.toString():""));r.cloneContents?(n=t.contextual?sv(Hn.fromDom(e.getBody()),a).dom():r.cloneContents())&&o.appendChild(n):r.item!==undefined||r.htmlText!==undefined?(o.innerHTML="<br>"+(r.item?r.item(0).outerHTML:r.htmlText),o.removeChild(o.firstChild)):o.innerHTML=r.toString(),t.getInner=!0;var s=e.selection.serializer.serialize(o,t);return"tree"===t.format?s:(t.content=e.selection.isCollapsed()?"":s,e.fire("GetContent",t),t.content)},cv=function(e,t,n){var r,o,i,a=e.selection.getRng(),s=e.getDoc();if((n=n||{format:"html"}).set=!0,n.selection=!0,n.content=t,n.no_events||!(n=e.fire("BeforeSetContent",n)).isDefaultPrevented()){if(t=n.content,a.insertNode){t+='<span id="__caret">_</span>',a.startContainer===s&&a.endContainer===s?s.body.innerHTML=t:(a.deleteContents(),0===s.body.childNodes.length?s.body.innerHTML=t:a.createContextualFragment?a.insertNode(a.createContextualFragment(t)):(o=s.createDocumentFragment(),i=s.createElement("div"),o.appendChild(i),i.outerHTML=t,a.insertNode(o))),r=e.dom.get("__caret"),(a=s.createRange()).setStartBefore(r),a.setEndBefore(r),e.selection.setRng(a),e.dom.remove("__caret");try{e.selection.setRng(a)}catch(u){}}else a.item&&(s.execCommand("Delete",!1,null),a=e.getRng()),/^\s+/.test(t)?(a.pasteHTML('<span id="__mce_tmp">_</span>'+t),e.dom.remove("__mce_tmp")):a.pasteHTML(t);n.no_events||e.fire("SetContent",n)}else e.fire("SetContent",n)},lv=function(e,t,n,r,o){var i=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return E.from(i).map(Hn.fromDom).map(function(e){return r&&t.collapsed?e:Ur.child(e,o(e,a)).getOr(e)}).bind(function(e){return Zn.isElement(e)?E.some(e):Ur.parent(e)}).map(function(e){return e.dom()}).getOr(e)},fv=function(e,t,n){return lv(e,t,!0,n,function(e,t){return Math.min(Ur.childNodesCount(e),t)})},dv=function(e,t,n){return lv(e,t,!1,n,function(e,t){return t>0?t-1:t})},mv=function(e,t){for(var n=e;e&&vo.isText(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n},pv=Ot.each,gv=function(e){return!!e.select},hv=function(e){return!(!e||!e.ownerDocument)&&Dr.contains(Hn.fromDom(e.ownerDocument),Hn.fromDom(e))},vv=function(e,t,n,r){var o,i,a,s,u,c=function(e,t){return cv(r,e,t)},l=function(e){var t=d();t.collapse(!!e),m(t)},f=function(){return t.getSelection?t.getSelection():t.document.selection},d=function(){var n,o,i,u,c=function(e,t,n){try{return t.compareBoundaryPoints(e,n)}catch(r){return-1}};if(!t)return null;if(void 0===(u=t.document)||null===u)return null;if(r.bookmark!==undefined&&!1===hm(r)){var l=Td(r);if(l.isSome())return l.map(function(e){return Lh(r,[e])[0]}).getOr(u.createRange())}try{(n=f())&&(o=n.rangeCount>0?n.getRangeAt(0):n.createRange?n.createRange():u.createRange())}catch(d){}return(o=Lh(r,[o])[0])||(o=u.createRange?u.createRange():u.body.createTextRange()),o.setStart&&9===o.startContainer.nodeType&&o.collapsed&&(i=e.getRoot(),o.setStart(i,0),o.setEnd(i,0)),a&&s&&(0===c(o.START_TO_START,o,a)&&0===c(o.END_TO_END,o,a)?o=s:(a=null,s=null)),o},m=function(e,t){var n,o;if((i=e)&&(gv(i)||hv(i.startContainer)&&hv(i.endContainer))){var i,u=gv(e)?e:null;if(u){s=null;try{u.select()}catch(c){}}else{if(n=f(),e=r.fire("SetSelectionRange",{range:e,forward:t}).range,n){s=e;try{n.removeAllRanges(),n.addRange(e)}catch(c){}!1===t&&n.extend&&(n.collapse(e.endContainer,e.endOffset),n.extend(e.startContainer,e.startOffset)),a=n.rangeCount>0?n.getRangeAt(0):null}e.collapsed||e.startContainer!==e.endContainer||!n.setBaseAndExtent||me.ie||e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()&&(o=e.startContainer.childNodes[e.startOffset])&&"IMG"===o.tagName&&(n.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),n.anchorNode===e.startContainer&&n.focusNode===e.endContainer||n.setBaseAndExtent(o,0,o,1)),r.fire("AfterSetSelectionRange",{range:e,forward:t})}}},p=function(){var t,n,r=f();return!(r&&r.anchorNode&&r.focusNode)||((t=e.createRng()).setStart(r.anchorNode,r.anchorOffset),t.collapse(!0),(n=e.createRng()).setStart(r.focusNode,r.focusOffset),n.collapse(!0),t.compareBoundaryPoints(t.START_TO_START,n)<=0)},g={bookmarkManager:null,controlSelection:null,dom:e,win:t,serializer:n,editor:r,collapse:l,setCursorLocation:function(t,n){var o=e.createRng();t?(o.setStart(t,n),o.setEnd(t,n),m(o),l(!1)):($h(e,o,r.getBody(),!0),m(o))},getContent:function(e){return uv(r,e)},setContent:c,getBookmark:function(e,t){return o.getBookmark(e,t)},moveToBookmark:function(e){return o.moveToBookmark(e)},select:function(t,n){var r,o,i;return(r=e,o=t,i=n,E.from(o).map(function(e){var t=r.nodeIndex(e),n=r.createRng();return n.setStart(e.parentNode,t),n.setEnd(e.parentNode,t+1),i&&($h(r,n,e,!0),$h(r,n,e,!1)),n})).each(m),t},isCollapsed:function(){var e=d(),t=f();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isForward:p,setNode:function(t){return c(e.getOuterHTML(t)),t},getNode:function(){return e=r.getBody(),(t=d())?(o=t.startContainer,i=t.endContainer,a=t.startOffset,s=t.endOffset,n=t.commonAncestorContainer,!t.collapsed&&(o===i&&s-a<2&&o.hasChildNodes()&&(n=o.childNodes[a]),3===o.nodeType&&3===i.nodeType&&(o=o.length===a?mv(o.nextSibling,!0):o.parentNode,i=0===s?mv(i.previousSibling,!1):i.parentNode,o&&o===i))?o:n&&3===n.nodeType?n.parentNode:n):e;var e,t,n,o,i,a,s},getSel:f,setRng:m,getRng:d,getStart:function(e){return fv(r.getBody(),d(),e)},getEnd:function(e){return dv(r.getBody(),d(),e)},getSelectedBlocks:function(t,n){return function(e,t,n,r){var o,i,a=[];if(i=e.getRoot(),n=e.getParent(n||fv(i,t,!1),e.isBlock),r=e.getParent(r||dv(i,t,!1),e.isBlock),n&&n!==i&&a.push(n),n&&r&&n!==r){o=n;for(var s=new to(n,i);(o=s.next())&&o!==r;)e.isBlock(o)&&a.push(o)}return r&&n!==r&&r!==i&&a.push(r),a}(e,d(),t,n)},normalize:function(){var t=d();if(!Ef(f())){var n=Jf.normalize(e,t);return n.each(function(e){m(e,p())}),n.getOr(t)}return t},selectorChanged:function(t,n){var o;return u||(u={},o={},r.on("NodeChange",function(t){var n=t.element,r=e.getParents(n,null,e.getRoot()),i={};pv(u,function(t,n){pv(r,function(a){if(e.is(a,n))return o[n]||(pv(t,function(e){e(!0,{node:a,selector:n,parents:r})}),o[n]=t),i[n]=t,!1})}),pv(o,function(e,t){i[t]||(delete o[t],pv(e,function(e){e(!1,{node:n,selector:t,parents:r})}))})})),u[t]||(u[t]=[]),u[t].push(n),g},getScrollContainer:function(){for(var t,n=e.getRoot();n&&"BODY"!==n.nodeName;){if(n.scrollHeight>n.clientHeight){t=n;break}n=n.parentNode}return t},scrollIntoView:function(e,t){return Oh(r,e,t)},placeCaretAt:function(e,t){return m(Ih(e,t,r.getDoc()))},getBoundingClientRect:function(){var e=d();return e.collapsed?ia.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:function(){t=null,i.destroy()}};return o=Ah(g),i=Rh(g,r),g.bookmarkManager=o,g.controlSelection=i,g},yv=ji.curry,bv=function(e,t,n,r,o,i){var a,s,u=0,c=[],l=function(r){var i,a,l;for(l=gp.getClientRects(r),-1===e&&(l=l.reverse()),i=0;i<l.length;i++)if(a=l[i],!n(a,s)){if(c.length>0&&t(a,At.last(c))&&u++,a.line=u,o(a))return!0;c.push(a)}};return(s=At.last(i.getClientRects()))?(l(a=i.getNode()),function(e,t,n,r){for(;r=_a.findNode(r,e,ki,t);)if(n(r))return}(e,r,l,a),c):c},Cv={upUntil:yv(bv,-1,Ii,Li),downUntil:yv(bv,1,Li,Ii),positionsUntil:function(e,t,n,r){var o,i,a,s,u,c,l=Ha(t),f=[],d=0,m=function(e){return At.last(e.getClientRects())};1===e?(o=l.next,i=Li,a=Ii,s=ia.after(r)):(o=l.prev,i=Ii,a=Li,s=ia.before(r)),c=m(s);do{if(s.isVisible()&&!a(u=m(s),c)){if(f.length>0&&i(u,At.last(f))&&d++,(u=Di(u)).position=s,u.line=d,n(u))return f;f.push(u)}}while(s=o(s));return f},isAboveLine:yv(function(e,t){return t.line>e}),isLine:yv(function(e,t){return t.line===e})},xv=vo.isContentEditableFalse,wv=Fi,Nv=_a.isAfterContentEditableFalse,Ev=_a.isBeforeContentEditableFalse,Sv=function(e,t){for(;t=e(t);)if(t.isVisible())return t;return t},kv=function(e,t,n){return n=_a.normalizeRange(e,t,n),-1===e?ia.fromRangeStart(n):ia.fromRangeEnd(n)},Tv=function(e,t,n,r,o){var i,a,s,u,c,l,f,d;return!o.collapsed&&(i=wv(o),xv(i))?Dp(e,t,i,-1===e):(c=o,u=mi.isCaretContainerBlock(c.startContainer),r(a=kv(e,t.getBody(),o))?Op(t,a.getNode(-1===e)):(a=n(a))?r(a)?Dp(e,t,a.getNode(-1===e),1===e):r(s=n(a))&&(l=a,f=s,!(d=_a.isInSameBlock(l,f))&&vo.isBr(l.getNode())||d)?Dp(e,t,s.getNode(-1===e),1===e):u?Ip(t,a.toRange()):null:u?o:null)},Av=function(e,t,n){var r,o,i,a,s=Ha(e.getBody()),u=ji.curry(Sv,s.next),c=ji.curry(Sv,s.prev);if(n.collapsed&&e.settings.forced_root_block){if(!(r=e.dom.getParent(n.startContainer,"PRE")))return;(1===t?u(ia.fromRangeStart(n)):c(ia.fromRangeStart(n)))||(a=(i=e).dom.create(i.settings.forced_root_block),(!me.ie||me.ie>=11)&&(a.innerHTML='<br data-mce-bogus="1">'),o=a,1===t?e.$(r).after(o):e.$(r).before(o),e.selection.select(o,!0),e.selection.collapse())}},_v=function(e,t){var n,r=t?1:-1,o=t?Cv.downUntil:Cv.upUntil,i=e.selection.getRng();return(n=function(e,t,n,r){var o,i,a,s,u,c,l,f,d;if(d=wv(r),o=kv(e,t.getBody(),r),i=n(t.getBody(),Cv.isAboveLine(1),o),a=At.filter(i,Cv.isLine(1)),u=At.last(o.getClientRects()),Ev(o)&&(d=o.getNode()),Nv(o)&&(d=o.getNode(!0)),!u)return null;if(c=u.left,(s=Ep(a,c))&&xv(s.node))return l=Math.abs(c-s.left),f=Math.abs(c-s.right),Dp(e,t,s.node,l<f);if(d){var m=Cv.positionsUntil(e,t.getBody(),Cv.isAboveLine(1),d);if(s=Ep(At.filter(m,Cv.isLine(1)),c))return Ip(t,s.position.toRange());if(s=At.last(At.filter(m,Cv.isLine(0))))return Ip(t,s.position.toRange())}}(r,e,o,i))?n:(n=Av(e,r,i))||null},Bv=function(e,t){return function(){var n,r,o,i,a,s,u,c,l,f,d=(r=t,i=Ha((n=e).getBody()),a=ji.curry(Sv,i.next),s=ji.curry(Sv,i.prev),u=r?1:-1,c=r?a:s,l=r?Ev:Nv,f=n.selection.getRng(),(o=Tv(u,n,c,l,f))?o:(o=Av(n,u,f))||null);return!!d&&(e.selection.setRng(d),!0)}},Rv=function(e,t){return function(){var n=_v(e,t);return!!n&&(e.selection.setRng(n),!0)}},Dv=function(e,t){return M.bind((n=e,M.map(n,function(e){return Zg.merge({shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0,action:y.noop},e)})),function(e){return n=e,(r=t).keyCode===n.keyCode&&r.shiftKey===n.shiftKey&&r.altKey===n.altKey&&r.ctrlKey===n.ctrlKey&&r.metaKey===n.metaKey?[e]:[];var n,r});var n},Ov=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,r)}},Pv=function(e,t){return M.find(Dv(e,t),function(e){return e.action()})},Iv=function(e,t){e.on("keydown",function(n){var r,o,i,a;!1===n.isDefaultPrevented()&&(r=e,o=t,i=n,a=Un.detect().os,Pv([{keyCode:Mp.RIGHT,action:Bv(r,!0)},{keyCode:Mp.LEFT,action:Bv(r,!1)},{keyCode:Mp.UP,action:Rv(r,!1)},{keyCode:Mp.DOWN,action:Rv(r,!0)},{keyCode:Mp.RIGHT,action:of.move(r,o,!0)},{keyCode:Mp.LEFT,action:of.move(r,o,!1)},{keyCode:Mp.RIGHT,ctrlKey:!a.isOSX(),altKey:a.isOSX(),action:of.moveNextWord(r,o)},{keyCode:Mp.LEFT,ctrlKey:!a.isOSX(),altKey:a.isOSX(),action:of.movePrevWord(r,o)}],i).each(function(e){i.preventDefault()}))})},Lv=function(e){return 1===Ur.children(e).length},Mv=function(e,t){var n,r=Hn.fromDom(e.getBody()),o=Hn.fromDom(e.selection.getStart()),i=M.filter((n=Uu(o,r),M.findIndex(n,io.isBlock).fold(y.constant(n),function(e){return n.slice(0,e)})),Lv);return M.last(i).map(function(n){var r=ia.fromRangeStart(e.selection.getRng());return!!Cu(t,r,n.dom())&&(function(e,t,n,r){var o=y.curry(kl,t),i=M.map(M.filter(r,o),function(e){return e.dom()});if(0===i.length)mc(t,e,n);else{var a=Sl(n.dom(),i);t.selection.setRng(a.toRange())}}(t,e,n,i),!0)}).getOr(!1)},Fv=function(e,t){return!!e.selection.isCollapsed()&&Mv(e,t)},zv=function(e,t){e.on("keydown",function(n){var r,o,i;!1===n.isDefaultPrevented()&&(r=e,o=t,i=n,Pv([{keyCode:Mp.BACKSPACE,action:Ov(hc,r,!1)},{keyCode:Mp.DELETE,action:Ov(hc,r,!0)},{keyCode:Mp.BACKSPACE,action:Ov(cf,r,o,!1)},{keyCode:Mp.DELETE,action:Ov(cf,r,o,!0)},{keyCode:Mp.BACKSPACE,action:Ov(Ju,r,!1)},{keyCode:Mp.DELETE,action:Ov(Ju,r,!0)},{keyCode:Mp.BACKSPACE,action:Ov(Ku,r,!1)},{keyCode:Mp.DELETE,action:Ov(Ku,r,!0)},{keyCode:Mp.BACKSPACE,action:Ov(zf,r,!1)},{keyCode:Mp.DELETE,action:Ov(zf,r,!0)},{keyCode:Mp.BACKSPACE,action:Ov(Fv,r,!1)},{keyCode:Mp.DELETE,action:Ov(Fv,r,!0)}],i).each(function(e){i.preventDefault()}))}),e.on("keyup",function(t){var n,r;!1===t.isDefaultPrevented()&&(n=e,r=t,Pv([{keyCode:Mp.BACKSPACE,action:Ov(vc,n)},{keyCode:Mp.DELETE,action:Ov(vc,n)}],r))})},Uv=function(e,t,n){var r=e.getParam(t,n);if(-1!==r.indexOf("=")){var o=e.getParam(t,"","hash");return o.hasOwnProperty(e.id)?o[e.id]:n}return r},Vv=function(e){return e.getParam("iframe_attrs",{})},Hv=function(e){return e.getParam("doctype","<!DOCTYPE html>")},qv=function(e){return e.getParam("document_base_url","")},jv=function(e){return Uv(e,"body_id","tinymce")},$v=function(e){return Uv(e,"body_class","")},Wv=function(e){return e.getParam("content_security_policy","")},Kv=function(e){return e.getParam("br_in_pre",!0)},Xv=function(e){if(e.getParam("force_p_newlines",!1))return"p";var t=e.getParam("forced_root_block","p");return!1===t?"":t},Yv=function(e){return e.getParam("forced_root_block_attrs",{})},Gv=function(e){return e.getParam("br_newline_selector",".mce-toc h2,figcaption,caption")},Jv=function(e){return e.getParam("no_newline_selector","")},Qv=function(e){return e.getParam("keep_styles",!0)},Zv=function(e){return e.getParam("end_container_on_empty_block",!1)},ey=function(e){return E.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock))},ty=function(e,t){var n,r,o,i=t,a=e.dom,s=e.schema.getMoveCaretBeforeOnEnterElements();if(t){if(/^(LI|DT|DD)$/.test(t.nodeName)){var u=function(e){for(;e;){if(1===e.nodeType||3===e.nodeType&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}}(t.firstChild);u&&/^(UL|OL|DL)$/.test(u.nodeName)&&t.insertBefore(a.doc.createTextNode("\xa0"),t.firstChild)}if(o=a.createRng(),t.normalize(),t.hasChildNodes()){for(n=new to(t,t);r=n.current();){if(vo.isText(r)){o.setStart(r,0),o.setEnd(r,0);break}if(s[r.nodeName.toLowerCase()]){o.setStartBefore(r),o.setEndBefore(r);break}i=r,r=n.next()}r||(o.setStart(i,0),o.setEnd(i,0))}else vo.isBr(t)?t.nextSibling&&a.isBlock(t.nextSibling)?(o.setStartBefore(t),o.setEndBefore(t)):(o.setStartAfter(t),o.setEndAfter(t)):(o.setStart(t,0),o.setEnd(t,0));e.selection.setRng(o),a.remove(void 0),e.selection.scrollIntoView(t)}},ny=function(e,t){var n,r,o=e.getRoot();for(n=t;n!==o&&"false"!==e.getContentEditable(n);)"true"===e.getContentEditable(n)&&(r=n),n=n.parentNode;return n!==o?r:o},ry=ey,oy=function(e){return ey(e).fold(y.constant(""),function(e){return e.nodeName.toUpperCase()})},iy=function(e){return ey(e).filter(function(e){return io.isListItem(Hn.fromDom(e))}).isSome()},ay=function(e,t){return e&&e.parentNode&&e.parentNode.nodeName===t},sy=function(e){return e&&/^(OL|UL|LI)$/.test(e.nodeName)},uy=function(e){var t=e.parentNode;return/^(LI|DT|DD)$/.test(t.nodeName)?t:e},cy=function(e,t,n){for(var r=e[n?"firstChild":"lastChild"];r&&!vo.isElement(r);)r=r[n?"nextSibling":"previousSibling"];return r===t},ly=function(e,t,n,r,o){var i=e.dom,a=e.selection.getRng();if(n!==e.getBody()){var s;sy(s=n)&&sy(s.parentNode)&&(o="LI");var u,c,l=o?t(o):i.create("BR");if(cy(n,r,!0)&&cy(n,r,!1))ay(n,"LI")?i.insertAfter(l,uy(n)):i.replace(l,n);else if(cy(n,r,!0))ay(n,"LI")?(i.insertAfter(l,uy(n)),l.appendChild(i.doc.createTextNode(" ")),l.appendChild(n)):n.parentNode.insertBefore(l,n);else if(cy(n,r,!1))i.insertAfter(l,uy(n));else{n=uy(n);var f=a.cloneRange();f.setStartAfter(r),f.setEndAfter(n);var d=f.extractContents();"LI"===o&&(c="LI",(u=d).firstChild&&u.firstChild.nodeName===c)?(l=d.firstChild,i.insertAfter(d,n)):(i.insertAfter(d,n),i.insertAfter(l,n))}i.remove(r),ty(e,l)}},fy=function(e){e.innerHTML='<br data-mce-bogus="1">'},dy=function(e,t){return e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t},my=function(e,t){return t&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&"true"!==e.getContentEditable(t)},py=function(e,t,n){return!1===vo.isText(t)?n:e?1===n&&t.data.charAt(n-1)===oi?0:n:n===t.data.length-1&&t.data.charAt(n)===oi?t.data.length:n},gy=function(e,t){var n,r,o=e.getRoot();for(n=t;n!==o&&"false"!==e.getContentEditable(n);)"true"===e.getContentEditable(n)&&(r=n),n=n.parentNode;return n!==o?r:o},hy=function(e,t){var n=Xv(e);n&&n.toLowerCase()===t.tagName.toLowerCase()&&e.dom.setAttribs(t,Yv(e))},vy=function(e,t){var n,r,o,i,a,s,u,c,l,f,d,m,p,g,h,v,y,b,C=e.dom,x=e.schema,w=x.getNonEmptyElements(),N=e.selection.getRng(),E=function(t){var n,i,s,u=o,c=x.getTextInlineElements();if(t||"TABLE"===f||"HR"===f?(n=C.create(t||m),hy(e,n)):n=a.cloneNode(!1),s=n,!1===Qv(e))C.setAttrib(n,"style",null),C.setAttrib(n,"class",null);else do{if(c[u.nodeName]){if(Nl(u))continue;i=u.cloneNode(!1),C.setAttrib(i,"id",""),n.hasChildNodes()?(i.appendChild(n.firstChild),n.appendChild(i)):(s=i,n.appendChild(i))}}while((u=u.parentNode)&&u!==r);return fy(s),n},S=function(e){var t,n,r,s;if(s=py(e,o,i),vo.isText(o)&&(e?s>0:s<o.nodeValue.length))return!1;if(o.parentNode===a&&p&&!e)return!0;if(e&&vo.isElement(o)&&o===a.firstChild)return!0;if(dy(o,"TABLE")||dy(o,"HR"))return p&&!e||!p&&e;for(t=new to(o,a),vo.isText(o)&&(e&&0===s?t.prev():e||s!==o.nodeValue.length||t.next());n=t.current();){if(vo.isElement(n)){if(!n.getAttribute("data-mce-bogus")&&(r=n.nodeName.toLowerCase(),w[r]&&"br"!==r))return!1}else if(vo.isText(n)&&!/^[ \t\r\n]*$/.test(n.nodeValue))return!1;e?t.prev():t.next()}return!0},k=function(){u=/^(H[1-6]|PRE|FIGURE)$/.test(f)&&"HGROUP"!==d?E(m):E(),Zv(e)&&my(C,l)&&C.isEmpty(a)?u=C.split(l,a):C.insertAfter(u,a),ty(e,u)};Jf.normalize(C,N).each(function(e){N.setStart(e.startContainer,e.startOffset),N.setEnd(e.endContainer,e.endOffset)}),o=N.startContainer,i=N.startOffset,m=Xv(e),s=t.shiftKey,vo.isElement(o)&&o.hasChildNodes()&&(p=i>o.childNodes.length-1,o=o.childNodes[Math.min(i,o.childNodes.length-1)]||o,i=p&&vo.isText(o)?o.nodeValue.length:0),(r=gy(C,o))&&((m&&!s||!m&&s)&&(o=function(e,t,n,r,o){var i,a,s,u,c,l,f,d=t||"P",m=e.dom,p=gy(m,r);if(!(a=m.getParent(r,m.isBlock))||!my(m,a)){if(l=(a=a||p)===e.getBody()||(f=a)&&/^(TD|TH|CAPTION)$/.test(f.nodeName)?a.nodeName.toLowerCase():a.parentNode.nodeName.toLowerCase(),!a.hasChildNodes())return i=m.create(d),hy(e,i),a.appendChild(i),n.setStart(i,0),n.setEnd(i,0),i;for(u=r;u.parentNode!==a;)u=u.parentNode;for(;u&&!m.isBlock(u);)s=u,u=u.previousSibling;if(s&&e.schema.isValidChild(l,d.toLowerCase())){for(i=m.create(d),hy(e,i),s.parentNode.insertBefore(i,s),u=s;u&&!m.isBlock(u);)c=u.nextSibling,i.appendChild(u),u=c;n.setStart(r,o),n.setEnd(r,o)}}return r}(e,m,N,o,i)),a=C.getParent(o,C.isBlock),l=a?C.getParent(a.parentNode,C.isBlock):null,f=a?a.nodeName.toUpperCase():"","LI"!==(d=l?l.nodeName.toUpperCase():"")||t.ctrlKey||(a=l,l=l.parentNode,f=d),/^(LI|DT|DD)$/.test(f)&&C.isEmpty(a)?ly(e,E,l,a,m):m&&a===e.getBody()||(m=m||"P",mi.isCaretContainerBlock(a)?(u=mi.showCaretContainerBlock(a),C.isEmpty(a)&&fy(a),ty(e,u)):S()?k():S(!0)?(u=a.parentNode.insertBefore(E(),a),ty(e,dy(a,"HR")?u:a)):((n=(y=N,b=y.cloneRange(),b.setStart(y.startContainer,py(!0,y.startContainer,y.startOffset)),b.setEnd(y.endContainer,py(!1,y.endContainer,y.endOffset)),b).cloneRange()).setEndAfter(a),function(e){do{vo.isText(e)&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild}while(e)}(c=n.extractContents()),u=c.firstChild,C.insertAfter(c,a),function(e,t,n){var r,o=n,i=[];if(o){for(;o=o.firstChild;){if(e.isBlock(o))return;vo.isElement(o)&&!t[o.nodeName.toLowerCase()]&&i.push(o)}for(r=i.length;r--;)!(o=i[r]).hasChildNodes()||o.firstChild===o.lastChild&&""===o.firstChild.nodeValue?e.remove(o):(a=o)&&"A"===a.nodeName&&0===Ot.trim(ii(a.innerText||a.textContent)).length&&e.remove(o);var a}}(C,w,u),g=C,(h=a).normalize(),(v=h.lastChild)&&!/^(left|right)$/gi.test(g.getStyle(v,"float",!0))||g.add(h,"br"),C.isEmpty(a)&&fy(a),u.normalize(),C.isEmpty(u)?(C.remove(u),k()):ty(e,u)),C.setAttrib(u,"id",""),e.fire("NewBlock",{newBlock:u})))},yy=function(e,t){return ry(e).filter(function(e){return t.length>0&&_r.is(Hn.fromDom(e),t)}).isSome()},by=function(e){return yy(e,Gv(e))},Cy=function(e){return yy(e,Jv(e))},xy=Qu([{br:[]},{block:[]},{none:[]}]),wy=function(e,t){return Cy(e)},Ny=function(e){return function(t,n){return""===Xv(t)===e}},Ey=function(e){return function(t,n){return iy(t)===e}},Sy=function(e){return function(t,n){return"PRE"===oy(t)===e}},ky=function(e){return function(t,n){return Kv(t)===e}},Ty=function(e,t){return by(e)},Ay=function(e,t){return t},_y=function(e){var t=Xv(e),n=ny(e.dom,e.selection.getStart());return n&&e.schema.isValidChild(n.nodeName,t||"P")},By=function(e,t){return function(n,r){return M.foldl(e,function(e,t){return e&&t(n,r)},!0)?E.some(t):E.none()}},Ry=function(e,t){return Tl([By([wy],xy.none()),By([Sy(!0),ky(!1),Ay],xy.br()),By([Sy(!0),ky(!1)],xy.block()),By([Sy(!0),ky(!0),Ay],xy.block()),By([Sy(!0),ky(!0)],xy.br()),By([Ey(!0),Ay],xy.br()),By([Ey(!0)],xy.block()),By([Ny(!0),Ay,_y],xy.block()),By([Ny(!0)],xy.br()),By([Ty],xy.br()),By([Ny(!1),Ay],xy.br()),By([_y],xy.block())],[e,t.shiftKey]).getOr(xy.none())},Dy=function(e,t){Ry(e,t).fold(function(){sd(e,t)},function(){vy(e,t)},y.noop)},Oy=function(e){e.on("keydown",function(t){var n,r,o;t.keyCode===Mp.ENTER&&(n=e,(r=t).isDefaultPrevented()||(r.preventDefault(),(o=n.undoManager).typing&&(o.typing=!1,o.add()),n.undoManager.transact(function(){!1===n.selection.isCollapsed()&&n.execCommand("Delete"),Dy(n,r)})))})},Py=function(e,t,n){return s=t,!(!Iy(n)||!vo.isText(s.container())||(r=e,i=(o=t).container(),a=o.offset(),i.insertData(a,"\xa0"),r.selection.setCursorLocation(i,a+1),0));var r,o,i,a,s},Iy=function(e){return e.fold(y.constant(!1),y.constant(!0),y.constant(!0),y.constant(!1))},Ly=function(e){return!!e.selection.isCollapsed()&&(t=e,n=y.curry(vu.isInlineTarget,t),r=ia.fromRangeStart(t.selection.getRng()),$l(n,t.getBody(),r).map(y.curry(Py,t,r)).getOr(!1));var t,n,r},My=function(e){e.on("keydown",function(t){var n,r;!1===t.isDefaultPrevented()&&(n=e,r=t,Pv([{keyCode:Mp.SPACEBAR,action:Ov(Ly,n)}],r).each(function(e){r.preventDefault()}))})},Fy=function(e){var t=of.setupSelectedState(e);Iv(e,t),zv(e,t),Oy(e),My(e)},zy=function(e){var t,n,r,o=Ot.each,i=Mp.BACKSPACE,a=Mp.DELETE,s=e.dom,u=e.selection,c=e.settings,l=e.parser,f=me.gecko,d=me.ie,m=me.webkit,p="data:text/mce-internal,",g=d?"Text":"URL",h=function(t,n){try{e.getDoc().execCommand(t,!1,n)}catch(r){}},v=function(e){return e.isDefaultPrevented()},y=function(){e.shortcuts.add("meta+a",null,"SelectAll")},b=function(){e.on("keydown",function(e){if(!v(e)&&e.keyCode===i&&u.isCollapsed()&&0===u.getRng().startOffset){var t=u.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}})},C=function(){e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",function(t){var n;if("HTML"===t.target.nodeName){if(me.ie>11)return void e.getBody().focus();n=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(n),e.selection.normalize(),e.nodeChanged()}}))};return e.on("keydown",function(t){var n,r,o,i,a;if(!v(t)&&t.keyCode===Mp.BACKSPACE&&(r=(n=u.getRng()).startContainer,o=n.startOffset,i=s.getRoot(),a=r,n.collapsed&&0===o)){for(;a&&a.parentNode&&a.parentNode.firstChild===a&&a.parentNode!==i;)a=a.parentNode;"BLOCKQUOTE"===a.tagName&&(e.formatter.toggle("blockquote",null,a),(n=s.createRng()).setStart(r,0),n.setEnd(r,0),u.setRng(n))}}),t=function(e){var t=s.create("body"),n=e.cloneContents();return t.appendChild(n),u.serializer.serialize(t,{format:"html"})},e.on("keydown",function(n){var r,o,u,c,l,f=n.keyCode;if(!v(n)&&(f===a||f===i)){if(r=e.selection.isCollapsed(),o=e.getBody(),r&&!s.isEmpty(o))return;if(!r&&(u=e.selection.getRng(),c=t(u),(l=s.createRng()).selectNode(e.getBody()),c!==t(l)))return;n.preventDefault(),e.setContent(""),o.firstChild&&s.isBlock(o.firstChild)?e.selection.setCursorLocation(o.firstChild,0):e.selection.setCursorLocation(o,0),e.nodeChanged()}}),me.windowsPhone||e.on("keyup focusin mouseup",function(e){Mp.modifierPressed(e)||u.normalize()},!0),m&&(e.settings.content_editable||s.bind(e.getDoc(),"mousedown mouseup",function(t){var n;if(t.target===e.getDoc().documentElement)if(n=u.getRng(),e.getBody().focus(),"mousedown"===t.type){if(mi.isCaretContainer(n.startContainer))return;u.placeCaretAt(t.clientX,t.clientY)}else u.setRng(n)}),e.on("click",function(t){var n=t.target;/^(IMG|HR)$/.test(n.nodeName)&&"false"!==s.getContentEditableParent(n)&&(t.preventDefault(),e.selection.select(n),e.nodeChanged()),"A"===n.nodeName&&s.hasClass(n,"mce-item-anchor")&&(t.preventDefault(),u.select(n))}),c.forced_root_block&&e.on("init",function(){h("DefaultParagraphSeparator",c.forced_root_block)}),e.on("init",function(){e.dom.bind(e.getBody(),"submit",function(e){e.preventDefault()})}),b(),l.addNodeFilter("br",function(e){for(var t=e.length;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()}),me.iOS?(e.inline||e.on("keydown",function(){document.activeElement===document.body&&e.getWin().focus()}),C(),e.on("click",function(e){var t=e.target;do{if("A"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)}),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")):y()),me.ie>=11&&(C(),b()),me.ie&&(y(),h("AutoUrlDetect",!1),e.on("dragstart",function(t){var n,r,o;(n=t).dataTransfer&&(e.selection.isCollapsed()&&"IMG"===n.target.tagName&&u.select(n.target),(r=e.selection.getContent()).length>0&&(o=p+escape(e.id)+","+escape(r),n.dataTransfer.setData(g,o)))}),e.on("drop",function(t){if(!v(t)){var n=(a=t).dataTransfer&&(s=a.dataTransfer.getData(g))&&s.indexOf(p)>=0?(s=s.substr(p.length).split(","),{id:unescape(s[0]),html:unescape(s[1])}):null;if(n&&n.id!==e.id){t.preventDefault();var r=Ih(t.x,t.y,e.getDoc());u.setRng(r),o=n.html,i=!0,e.queryCommandSupported("mceInsertClipboardContent")?e.execCommand("mceInsertClipboardContent",!1,{content:o,internal:i}):e.execCommand("mceInsertContent",!1,o)}}var o,i,a,s})),f&&(e.on("keydown",function(t){if(!v(t)&&t.keyCode===i){if(!e.getBody().getElementsByTagName("hr").length)return;if(u.isCollapsed()&&0===u.getRng().startOffset){var n=u.getNode(),r=n.previousSibling;if("HR"===n.nodeName)return s.remove(n),void t.preventDefault();r&&r.nodeName&&"hr"===r.nodeName.toLowerCase()&&(s.remove(r),t.preventDefault())}}}),Range.prototype.getClientRects||e.on("mousedown",function(t){if(!v(t)&&"HTML"===t.target.nodeName){var n=e.getBody();n.blur(),ye.setEditorTimeout(e,function(){n.focus()})}}),n=function(){var t=s.getAttribs(u.getStart().cloneNode(!1));return function(){var n=u.getStart();n!==e.getBody()&&(s.setAttrib(n,"style",null),o(t,function(e){n.setAttributeNode(e.cloneNode(!0))}))}},r=function(){return!u.isCollapsed()&&s.getParent(u.getStart(),s.isBlock)!==s.getParent(u.getEnd(),s.isBlock)},e.on("keypress",function(t){var o;if(!v(t)&&(8===t.keyCode||46===t.keyCode)&&r())return o=n(),e.getDoc().execCommand("delete",!1,null),o(),t.preventDefault(),!1}),s.bind(e.getDoc(),"cut",function(t){var o;!v(t)&&r()&&(o=n(),ye.setEditorTimeout(e,function(){o()}))}),c.readonly||e.on("BeforeExecCommand MouseDown",function(){h("StyleWithCSS",!1),h("enableInlineTableEditing",!1),c.object_resizing||h("enableObjectResizing",!1)}),e.on("SetContent ExecCommand",function(e){"setcontent"!==e.type&&"mceInsertLink"!==e.command||o(s.select("a"),function(e){var t=e.parentNode,n=s.getRoot();if(t.lastChild===e){for(;t&&!s.isBlock(t);){if(t.parentNode.lastChild!==t||t===n)return;t=t.parentNode}s.add(t,"br",{"data-mce-bogus":1})}})}),e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}"),me.mac&&e.on("keydown",function(t){!Mp.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))}),b()),{refreshContentEditable:function(){},isHidden:function(){var t;return!f||e.removed?0:!(t=e.selection.getSel())||!t.rangeCount||0===t.rangeCount}}},Uy=Xo.DOM,Vy=function(e){var t;e.bindPendingEventDelegates(),e.initialized=!0,e.fire("init"),e.focus(!0),e.nodeChanged({initial:!0}),e.execCallback("init_instance_callback",e),(t=e).settings.auto_focus&&ye.setEditorTimeout(t,function(){var e;(e=!0===t.settings.auto_focus?t:t.editorManager.get(t.settings.auto_focus)).destroyed||e.focus()},100)},Hy=function(e,t){var n,r,o,i,a,s,u,c,l,f=e.settings,d=e.getElement(),m=e.getDoc();f.inline||(e.getElement().style.visibility=e.orgVisibility),t||f.content_editable||(m.open(),m.write(e.iframeHTML),m.close()),f.content_editable&&(e.on("remove",function(){var e=this.getBody();Uy.removeClass(e,"mce-content-body"),Uy.removeClass(e,"mce-edit-focus"),Uy.setAttrib(e,"contentEditable",null)}),Uy.addClass(d,"mce-content-body"),e.contentDocument=m=f.content_document||document,e.contentWindow=f.content_window||window,e.bodyElement=d,f.content_document=f.content_window=null,f.root_name=d.nodeName.toLowerCase()),(n=e.getBody()).disabled=!0,e.readonly=f.readonly,e.readonly||(e.inline&&"static"===Uy.getStyle(n,"position",!0)&&(n.style.position="relative"),n.contentEditable=e.getParam("content_editable_state",!0)),n.disabled=!1,e.editorUpload=Jm(e),e.schema=Fo(f),e.dom=new Xo(m,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,hex_colors:f.force_hex_style_colors,class_filter:f.class_filter,update_styles:!0,root_element:e.inline?e.getBody():null,collect:f.content_editable,schema:e.schema,onSetAttrib:function(t){e.fire("SetAttrib",t)}}),e.parser=((i=bh((o=e).settings,o.schema)).addAttributeFilter("src,href,style,tabindex",function(e,t){for(var n,r,i,a=e.length,s=o.dom;a--;)if(r=(n=e[a]).attr(t),i="data-mce-"+t,!n.attributes.map[i]){if(0===r.indexOf("data:")||0===r.indexOf("blob:"))continue;"style"===t?((r=s.serializeStyle(s.parseStyle(r),n.name)).length||(r=null),n.attr(i,r),n.attr(t,r)):"tabindex"===t?(n.attr(i,r),n.attr(t,null)):n.attr(i,o.convertURL(r,t,n.name))}}),i.addNodeFilter("script",function(e){for(var t,n,r=e.length;r--;)0!==(n=(t=e[r]).attr("type")||"no/type").indexOf("mce-")&&t.attr("type","mce-"+n)}),i.addNodeFilter("#cdata",function(e){for(var t,n=e.length;n--;)(t=e[n]).type=8,t.name="#comment",t.value="[CDATA["+t.value+"]]"}),i.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(e){for(var t,n=e.length,r=o.schema.getNonEmptyElements();n--;)(t=e[n]).isEmpty(r)&&0===t.getAll("br").length&&(t.append(new fh("br",1)).shortEnded=!0)}),i),e.serializer=Nh(f,e),e.selection=vv(e.dom,e.getWin(),e.serializer,e),e.formatter=Yg(e),e.undoManager=rg(e),e._nodeChangeDispatcher=new tp(e),e._selectionOverrides=Hp(e),kh(e),Fy(e),ep(e),e.fire("PreInit"),f.browser_spellcheck||f.gecko_spellcheck||(m.body.spellcheck=!1,Uy.setAttrib(n,"spellcheck","false")),e.quirks=zy(e),e.fire("PostRender"),f.directionality&&(n.dir=f.directionality),f.nowrap&&(n.style.whiteSpace="nowrap"),f.protect&&e.on("BeforeSetContent",function(e){Ot.each(f.protect,function(t){e.content=e.content.replace(t,function(e){return"\x3c!--mce:protected "+escape(e)+"--\x3e"})})}),e.on("SetContent",function(){e.addVisual(e.getBody())}),f.padd_empty_editor&&e.on("PostProcess",function(e){e.content=e.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|<br \/>|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")}),e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"}),e.on("compositionstart compositionend",function(t){e.composing="compositionstart"===t.type}),e.contentStyles.length>0&&(r="",Ot.each(e.contentStyles,function(e){r+=e+"\r\n"}),e.dom.addStyle(r)),(a=e,a.inline?Uy.styleSheetLoader:a.dom.styleSheetLoader).loadAll(e.contentCSS,function(t){Vy(e)},function(t){Vy(e)}),f.content_style&&(s=e,u=f.content_style,c=Hn.fromDom(s.getDoc().head),l=Hn.fromTag("style"),dr.set(l,"type","text/css"),ks.append(l,Hn.fromText(u)),ks.append(c,l))},qy=Xo.DOM,jy=function(e,t){var n,r,o,i,a,s,u,c=e.editorManager.translate("Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help"),l=(n=e.id,r=c,o=t.height,i=Vv(e),u=Hn.fromTag("iframe"),dr.setAll(u,i),dr.setAll(u,{id:n+"_ifr",frameBorder:"0",allowTransparency:"true",title:r}),br(u,{width:"100%",height:(a=o,s="number"==typeof a?a+"px":a,s||""),display:"block"}),u).dom();l.onload=function(){l.onload=null,e.fire("load")};var f,d,m,p,g=function(e,t){if(document.domain!==window.location.hostname&&me.ie&&me.ie<12){var n=Gm("mce");e[n]=function(){Hy(e)};var r='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinymce.get("'+e.id+'");document.write(ed.iframeHTML);document.close();ed.'+n+"(true);})()";return qy.setAttrib(t,"src",r),!0}return!1}(e,l);return e.contentAreaContainer=t.iframeContainer,e.iframeElement=l,e.iframeHTML=(p=Hv(f=e)+"<html><head>",qv(f)!==f.documentBaseUrl&&(p+='<base href="'+f.documentBaseURI.getURI()+'" />'),p+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',d=jv(f),m=$v(f),Wv(f)&&(p+='<meta http-equiv="Content-Security-Policy" content="'+Wv(f)+'" />'),p+='</head><body id="'+d+'" class="mce-content-body '+m+'" data-id="'+f.id+'"><br></body></html>'),qy.add(t.iframeContainer,l),g},$y=function(e,t){var n=jy(e,t);t.editorContainer&&(qy.get(t.editorContainer).style.display=e.orgDisplay,e.hidden=qy.isHidden(t.editorContainer)),e.getElement().style.display="none",qy.setAttrib(e.id,"aria-hidden",!0),n||Hy(e)},Wy=Xo.DOM,Ky=function(e,t,n){var r,o,i=Im.get(n);if(r=Im.urls[n]||e.documentBaseUrl.replace(/\/$/,""),n=Ot.trim(n),i&&-1===Ot.inArray(t,n)){if(Ot.each(Im.dependencies(n),function(n){Ky(e,t,n)}),e.plugins[n])return;o=new i(e,r,e.$),e.plugins[n]=o,o.init&&(o.init(e,r),t.push(n))}},Xy=function(e){return e.replace(/^\-/,"")},Yy=function(e){return{editorContainer:e,iframeContainer:e}},Gy=function(e){var t,n,r=e.getElement();return e.inline?Yy(null):(t=r,n=Wy.create("div"),Wy.insertAfter(n,t),Yy(n))},Jy=function(e){var t,n,r,o,i,a,s,u,c,l,f,d=e.settings,m=e.getElement();return e.orgDisplay=m.style.display,tr.isString(d.theme)?(l=(o=e).settings,f=o.getElement(),i=l.width||Wy.getStyle(f,"width")||"100%",a=l.height||Wy.getStyle(f,"height")||f.offsetHeight,s=l.min_height||100,(u=/^[0-9\.]+(|px)$/i).test(""+i)&&(i=Math.max(parseInt(i,10),100)),u.test(""+a)&&(a=Math.max(parseInt(a,10),s)),c=o.theme.renderUI({targetNode:f,width:i,height:a,deltaWidth:l.delta_width,deltaHeight:l.delta_height}),l.content_editable||(a=(c.iframeHeight||a)+("number"==typeof a?c.deltaHeight||0:""))<s&&(a=s),c.height=a,c):tr.isFunction(d.theme)?(r=(t=e).getElement(),(n=t.settings.theme(t,r)).editorContainer.nodeType&&(n.editorContainer.id=n.editorContainer.id||t.id+"_parent"),n.iframeContainer&&n.iframeContainer.nodeType&&(n.iframeContainer.id=n.iframeContainer.id||t.id+"_iframecontainer"),n.height=n.iframeHeight?n.iframeHeight:r.offsetHeight,n):Gy(e)},Qy=function(e){var t,n,r,o,i,a,s=e.settings,u=e.getElement();return e.rtl=s.rtl_ui||e.editorManager.i18n.rtl,e.editorManager.i18n.setCode(s.language),s.aria_label=s.aria_label||Wy.getAttrib(u,"aria-label",e.getLang("aria.rich_text_area")),e.fire("ScriptsLoaded"),o=(n=e).settings.theme,tr.isString(o)?(n.settings.theme=Xy(o),r=Lm.get(o),n.theme=new r(n,Lm.urls[o]),n.theme.init&&n.theme.init(n,Lm.urls[o]||n.documentBaseUrl.replace(/\/$/,""),n.$)):n.theme={},i=e,a=[],Ot.each(i.settings.plugins.split(/[ ,]/),function(e){Ky(i,a,Xy(e))}),t=Jy(e),e.editorContainer=t.editorContainer?t.editorContainer:null,s.content_css&&Ot.each(Ot.explode(s.content_css),function(t){e.contentCSS.push(e.documentBaseURI.toAbsolute(t))}),s.content_editable?Hy(e):$y(e,t)},Zy=Xo.DOM,eb=function(e){return"-"===e.charAt(0)},tb=function(e,t){var n=Zo.ScriptLoader;!function(e,t,n,r){var o=t.settings,i=o.theme;if(tr.isString(i)){if(!eb(i)&&!Lm.urls.hasOwnProperty(i)){var a=o.theme_url;a?Lm.load(i,t.documentBaseURI.toAbsolute(a)):Lm.load(i,"themes/"+i+"/theme"+n+".js")}e.loadQueue(function(){Lm.waitFor(i,r)})}else r()}(n,e,t,function(){var r,o,i,a,s;r=n,(i=(o=e).settings).language&&"en"!==i.language&&!i.language_url&&(i.language_url=o.editorManager.baseURL+"/langs/"+i.language+".js"),i.language_url&&!o.editorManager.i18n.data[i.language]&&r.add(i.language_url),a=e.settings,s=t,Ot.isArray(a.plugins)&&(a.plugins=a.plugins.join(" ")),Ot.each(a.external_plugins,function(e,t){Im.load(t,e),a.plugins+=" "+t}),Ot.each(a.plugins.split(/[ ,]/),function(e){if((e=Ot.trim(e))&&!Im.urls[e])if(eb(e)){e=e.substr(1,e.length);var t=Im.dependencies(e);Ot.each(t,function(e){var t={prefix:"plugins/",resource:e,suffix:"/plugin"+s+".js"};e=Im.createUrl(t,e),Im.load(e.resource,e)})}else Im.load(e,{prefix:"plugins/",resource:e,suffix:"/plugin"+s+".js"})}),n.loadQueue(function(){e.removed||Qy(e)},e,function(t){Rm(e,t[0]),e.removed||Qy(e)})})},nb=function(e){var t=e.settings,n=e.id,r=function(){Zy.unbind(window,"ready",r),e.render()};if(Te.Event.domLoaded){if(e.getElement()&&me.contentEditable){t.inline?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");var o=e.getElement().form||Zy.getParent(n,"form");o&&(e.formElement=o,t.hidden_input&&!/TEXTAREA|INPUT/i.test(e.getElement().nodeName)&&(Zy.insertAfter(Zy.create("input",{type:"hidden",name:n}),n),e.hasHiddenInput=!0),e.formEventDelegate=function(t){e.fire(t.type,t)},Zy.bind(o,"submit reset",e.formEventDelegate),e.on("reset",function(){e.setContent(e.startContent,{format:"raw"})}),!t.submit_patch||o.submit.nodeType||o.submit.length||o._mceOldSubmit||(o._mceOldSubmit=o.submit,o.submit=function(){return e.editorManager.triggerSave(),e.setDirty(!1),o._mceOldSubmit(o)})),e.windowManager=km(e),e.notificationManager=Sm(e),"xml"===t.encoding&&e.on("GetContent",function(e){e.save&&(e.content=Zy.encode(e.content))}),t.add_form_submit_trigger&&e.on("submit",function(){e.initialized&&e.save()}),t.add_unload_trigger&&(e._beforeUnload=function(){!e.initialized||e.destroyed||e.isHidden()||e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),tb(e,e.suffix)}}else Zy.bind(window,"ready",r)},rb=function(e,t,n){var r=e.sidebars?e.sidebars:[];r.push({name:t,settings:n}),e.sidebars=r},ob=Ot.each,ib=Ot.trim,ab="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),sb={ftp:21,http:80,https:443,mailto:25},ub=function(e,t){var n,r,o=this;if(e=ib(e),n=(t=o.settings=t||{}).base_uri,/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))o.source=e;else{var i=0===e.indexOf("//");0!==e.indexOf("/")||i||(e=(n&&n.protocol||"http")+"://mce_host"+e),/^[\w\-]*:?\/\//.test(e)||(r=t.base_uri?t.base_uri.path:new ub(document.location.href).directory,""==t.base_uri.protocol?e="//mce_host"+o.toAbsPath(r,e):(e=/([^#?]*)([#?]?.*)/.exec(e),e=(n&&n.protocol||"http")+"://mce_host"+o.toAbsPath(r,e[1])+e[2])),e=e.replace(/@@/g,"(mce_at)"),e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e),ob(ab,function(t,n){var r=e[n];r&&(r=r.replace(/\(mce_at\)/g,"@@")),o[t]=r}),n&&(o.protocol||(o.protocol=n.protocol),o.userInfo||(o.userInfo=n.userInfo),o.port||"mce_host"!==o.host||(o.port=n.port),o.host&&"mce_host"!==o.host||(o.host=n.host),o.source=""),i&&(o.protocol="")}};ub.prototype={setPath:function(e){e=/^(.*?)\/?(\w+)?$/.exec(e),this.path=e[0],this.directory=e[1],this.file=e[2],this.source="",this.getURI()},toRelative:function(e){var t;if("./"===e)return e;if("mce_host"!==(e=new ub(e,{base_uri:this})).host&&this.host!==e.host&&e.host||this.port!==e.port||this.protocol!==e.protocol&&""!==e.protocol)return e.getURI();var n=this.getURI(),r=e.getURI();return n===r||"/"===n.charAt(n.length-1)&&n.substr(0,n.length-1)===r?n:(t=this.toRelPath(this.path,e.path),e.query&&(t+="?"+e.query),e.anchor&&(t+="#"+e.anchor),t)},toAbsolute:function(e,t){return(e=new ub(e,{base_uri:this})).getURI(t&&this.isSameOrigin(e))},isSameOrigin:function(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;var t=sb[this.protocol];if(t&&(this.port||t)==(e.port||t))return!0}return!1},toRelPath:function(e,t){var n,r,o,i=0,a="";if(e=(e=e.substring(0,e.lastIndexOf("/"))).split("/"),n=t.split("/"),e.length>=n.length)for(r=0,o=e.length;r<o;r++)if(r>=n.length||e[r]!==n[r]){i=r+1;break}if(e.length<n.length)for(r=0,o=n.length;r<o;r++)if(r>=e.length||e[r]!==n[r]){i=r+1;break}if(1===i)return t;for(r=0,o=e.length-(i-1);r<o;r++)a+="../";for(r=i-1,o=n.length;r<o;r++)a+=r!==i-1?"/"+n[r]:n[r];return a},toAbsPath:function(e,t){var n,r,o,i=0,a=[];for(r=/\/$/.test(t)?"/":"",e=e.split("/"),t=t.split("/"),ob(e,function(e){e&&a.push(e)}),e=a,n=t.length-1,a=[];n>=0;n--)0!==t[n].length&&"."!==t[n]&&(".."!==t[n]?i>0?i--:a.push(t[n]):i++);return 0!==(o=(n=e.length-i)<=0?a.reverse().join("/"):e.slice(0,n).join("/")+"/"+a.reverse().join("/")).indexOf("/")&&(o="/"+o),r&&o.lastIndexOf("/")!==o.length-1&&(o+=r),o},getURI:function(e){var t,n=this;return n.source&&!e||(t="",e||(n.protocol?t+=n.protocol+"://":t+="//",n.userInfo&&(t+=n.userInfo+"@"),n.host&&(t+=n.host),n.port&&(t+=":"+n.port)),n.path&&(t+=n.path),n.query&&(t+="?"+n.query),n.anchor&&(t+="#"+n.anchor),n.source=t),n.source}},ub.parseDataUri=function(e){var t,n;return e=decodeURIComponent(e).split(","),(n=/data:([^;]+)/.exec(e[0]))&&(t=n[1]),{type:t,data:e[1]}},ub.getDocumentBaseUrl=function(e){var t;return t=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?e.href:e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(t)&&(t=t.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(t)||(t+="/")),t};var cb=Xo.DOM,lb=Ot.extend,fb=Ot.each,db=Ot.trim,mb=Ot.resolve,pb=me.ie,gb=function(e,t,n){var r,o,i,a,s,u,c,l,f,d=this;r=d.documentBaseUrl=n.documentBaseURL,o=n.baseURI,i=d,a=e,s=r,u=n.defaultSettings,c=t,f={id:a,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:s,add_form_submit_trigger:!0,submit_patch:!0,add_unload_trigger:!0,convert_urls:!0,relative_urls:!0,remove_script_host:!0,object_resizing:!0,doctype:"<!DOCTYPE html>",visual:!0,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:!0,padd_empty_editor:!0,render_ui:!0,indentation:"30px",inline_styles:!0,convert_fonts_to_spans:!0,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist",entity_encoding:"named",url_converter:(l=i).convertURL,url_converter_scope:l,ie7_compat:!0},t=lu(ou,f,u,c),d.settings=t,ti.language=t.language||"en",ti.languageLoad=t.language_load,ti.baseURL=n.baseURL,d.id=e,d.setDirty(!1),d.plugins={},d.documentBaseURI=new ub(t.document_base_url,{base_uri:o}),d.baseURI=o,d.contentCSS=[],d.contentStyles=[],d.shortcuts=new Jd(d),d.loadedCSS={},d.editorCommands=new Od(d),d.suffix=n.suffix,d.editorManager=n,d.inline=t.inline,d.buttons={},d.menuItems={},t.cache_suffix&&(me.cacheSuffix=t.cache_suffix.replace(/^[\?\&]+/,"")),!1===t.override_viewport&&(me.overrideViewPort=!1),n.fire("SetupEditor",d),d.execCallback("setup",d),d.$=Qt.overrideDefaults(function(){return{context:d.inline?d.getBody():d.getDoc(),element:d.getBody()}})};lb(gb.prototype={render:function(){nb(this)},focus:function(e){gm(this,e)},execCallback:function(e){var t,n=this.settings[e];if(n)return this.callbackLookup&&(t=this.callbackLookup[e])&&(n=t.func,t=t.scope),"string"==typeof n&&(t=(t=n.replace(/\.\w+$/,""))?mb(t):0,n=mb(n),this.callbackLookup=this.callbackLookup||{},this.callbackLookup[e]={func:n,scope:t}),n.apply(t||this,Array.prototype.slice.call(arguments,1))},translate:function(e){if(e&&Ot.is(e,"string")){var t=this.settings.language||"en",n=this.editorManager.i18n;e=n.data[t+"."+e]||e.replace(/\{\#([^\}]+)\}/g,function(e,r){return n.data[t+"."+r]||"{#"+r+"}"})}return this.editorManager.translate(e)},getLang:function(e,t){return this.editorManager.i18n.data[(this.settings.language||"en")+"."+e]||(t!==undefined?t:"{#"+e+"}")},getParam:function(e,t,n){return mu(this,e,t,n)},nodeChanged:function(e){this._nodeChangeDispatcher.nodeChanged(e)},addButton:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),t.stateSelector&&"undefined"==typeof t.active&&(t.active=!1),t.text||t.icon||(t.icon=e),n.buttons=n.buttons,t.tooltip=t.tooltip||t.title,n.buttons[e]=t},addSidebar:function(e,t){return rb(this,e,t)},addMenuItem:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),n.menuItems=n.menuItems,n.menuItems[e]=t},addContextToolbar:function(e,t){var n,r=this;r.contextToolbars=r.contextToolbars||[],"string"==typeof e&&(n=e,e=function(e){return r.dom.is(e,n)}),r.contextToolbars.push({id:Gm("mcet"),predicate:e,items:t})},addCommand:function(e,t,n){this.editorCommands.addCommand(e,t,n)},addQueryStateHandler:function(e,t,n){this.editorCommands.addQueryStateHandler(e,t,n)},addQueryValueHandler:function(e,t,n){this.editorCommands.addQueryValueHandler(e,t,n)},addShortcut:function(e,t,n,r){this.shortcuts.add(e,t,n,r)},execCommand:function(e,t,n,r){return this.editorCommands.execCommand(e,t,n,r)},queryCommandState:function(e){return this.editorCommands.queryCommandState(e)},queryCommandValue:function(e){return this.editorCommands.queryCommandValue(e)},queryCommandSupported:function(e){return this.editorCommands.queryCommandSupported(e)},show:function(){this.hidden&&(this.hidden=!1,this.inline?this.getBody().contentEditable=!0:(cb.show(this.getContainer()),cb.hide(this.id)),this.load(),this.fire("show"))},hide:function(){var e=this,t=e.getDoc();e.hidden||(pb&&t&&!e.inline&&t.execCommand("SelectAll"),e.save(),e.inline?(e.getBody().contentEditable=!1,e===e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(cb.hide(e.getContainer()),cb.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.fire("hide"))},isHidden:function(){return!!this.hidden},setProgressState:function(e,t){this.fire("ProgressState",{state:e,time:t})},load:function(e){var t,n=this.getElement();return this.removed?"":n?((e=e||{}).load=!0,t=this.setContent(n.value!==undefined?n.value:n.innerHTML,e),e.element=n,e.no_events||this.fire("LoadContent",e),e.element=n=null,t):void 0},save:function(e){var t,n,r=this,o=r.getElement();if(o&&r.initialized&&!r.removed)return(e=e||{}).save=!0,e.element=o,e.content=r.getContent(e),e.no_events||r.fire("SaveContent",e),"raw"===e.format&&r.fire("RawSaveContent",e),t=e.content,/TEXTAREA|INPUT/i.test(o.nodeName)?o.value=t:(r.inline||(o.innerHTML=t),(n=cb.getParent(r.id,"form"))&&fb(n.elements,function(e){if(e.name===r.id)return e.value=t,!1})),e.element=o=null,!1!==e.set_dirty&&r.setDirty(!1),t},setContent:function(e,t){var n,r,o=this,i=o.getBody();return(t=t||{}).format=t.format||"html",t.set=!0,t.content=e,t.no_events||o.fire("BeforeSetContent",t),0===(e=t.content).length||/^\s+$/.test(e)?(r=pb&&pb<11?"":'<br data-mce-bogus="1">',"TABLE"===i.nodeName?e="<tr><td>"+r+"</td></tr>":/^(UL|OL)$/.test(i.nodeName)&&(e="<li>"+r+"</li>"),(n=o.settings.forced_root_block)&&o.schema.isValidChild(i.nodeName.toLowerCase(),n.toLowerCase())?(e=r,e=o.dom.createHTML(n,o.settings.forced_root_block_attrs,e)):pb||e||(e='<br data-mce-bogus="1">'),o.dom.setHTML(i,e),o.fire("SetContent",t)):("raw"!==t.format&&(e=zs({validate:o.validate},o.schema).serialize(o.parser.parse(e,{isRootContent:!0,insert:!0}))),t.content=db(e),o.dom.setHTML(i,t.content),t.no_events||o.fire("SetContent",t)),t.content},getContent:function(e){var t,n=this.getBody();if(this.removed)return"";if((e=e||{}).format=e.format||"html",e.get=!0,e.getInner=!0,e.no_events||this.fire("BeforeGetContent",e),"raw"===e.format)t=Ot.trim(om(this.serializer,n.innerHTML));else if("text"===e.format)t=n.innerText||n.textContent;else{if("tree"===e.format)return this.serializer.serialize(n,e);t=this.serializer.serialize(n,e)}return"text"!==e.format?e.content=db(t):e.content=t,e.no_events||this.fire("GetContent",e),e.content},insertContent:function(e,t){t&&(e=lb({content:e},t)),this.execCommand("mceInsertContent",!1,e)},isDirty:function(){return!this.isNotDirty},setDirty:function(e){var t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.fire("dirty")},setMode:function(e){Wd(this,e)},getContainer:function(){return this.container||(this.container=cb.get(this.editorContainer||this.id+"_parent")),this.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return this.targetElm||(this.targetElm=cb.get(this.id)),this.targetElm},getWin:function(){var e;return this.contentWindow||(e=this.iframeElement)&&(this.contentWindow=e.contentWindow),this.contentWindow},getDoc:function(){var e;return this.contentDocument||(e=this.getWin())&&(this.contentDocument=e.document),this.contentDocument},getBody:function(){var e=this.getDoc();return this.bodyElement||(e?e.body:null)},convertURL:function(e,t,n){var r=this.settings;return r.urlconverter_callback?this.execCallback("urlconverter_callback",e,n,!0,t):!r.convert_urls||n&&"LINK"===n.nodeName||0===e.indexOf("file:")||0===e.length?e:r.relative_urls?this.documentBaseURI.toRelative(e):e=this.documentBaseURI.toAbsolute(e,r.remove_script_host)},addVisual:function(e){var t,n=this,r=n.settings,o=n.dom;e=e||n.getBody(),n.hasVisual===undefined&&(n.hasVisual=r.visual),fb(o.select("table,a",e),function(e){var i;switch(e.nodeName){case"TABLE":return t=r.visual_table_class||"mce-item-table",void((i=o.getAttrib(e,"border"))&&"0"!==i||!n.hasVisual?o.removeClass(e,t):o.addClass(e,t));case"A":return void(o.getAttrib(e,"href",!1)||(i=o.getAttrib(e,"name")||e.id,t=r.visual_anchor_class||"mce-item-anchor",i&&n.hasVisual?o.addClass(e,t):o.removeClass(e,t)))}}),n.fire("VisualAid",{element:e,hasVisual:n.hasVisual})},remove:function(){var e=this;e.removed||(e.save(),e.removed=1,e.unbindAllNativeEvents(),e.hasHiddenInput&&cb.remove(e.getElement().nextSibling),e.inline||(pb&&pb<10&&e.getDoc().execCommand("SelectAll",!1,null),cb.setStyle(e.id,"display",e.orgDisplay),e.getBody().onload=null),e.fire("remove"),e.editorManager.remove(e),cb.remove(e.getContainer()),e._selectionOverrides.destroy(),e.editorUpload.destroy(),e.destroy())},destroy:function(e){var t,n=this;n.destroyed||(e||n.removed?(e||(n.editorManager.off("beforeunload",n._beforeUnload),n.theme&&n.theme.destroy&&n.theme.destroy(),n.selection.destroy(),n.dom.destroy()),(t=n.formElement)&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,t._mceOldSubmit=null),cb.unbind(t,"submit reset",n.formEventDelegate)),n.contentAreaContainer=n.formElement=n.container=n.editorContainer=null,n.bodyElement=n.contentDocument=n.contentWindow=null,n.iframeElement=n.targetElm=null,n.selection&&(n.selection=n.selection.win=n.selection.dom=n.selection.dom.doc=null),n.destroyed=1):n.remove())},uploadImages:function(e){return this.editorUpload.uploadImages(e)},_scanForImages:function(){return this.editorUpload.scanForImages()}},qd);var hb,vb,yb,bb={isEditorUIElement:function(e){return-1!==e.className.toString().indexOf("mce-")}},Cb=function(e,t){var n,r,o=Un.detect().browser;o.isIE()||o.isEdge()?(r=e).on("focusout",function(){Sd(r)}):(n=t,e.on("mouseup touchend",function(e){n.throttle()})),e.on("keyup nodechange",function(t){var n;"nodechange"===(n=t).type&&n.selectionChange||Sd(e)})},xb=function(e){var t,n,r,o=Tp(function(){Sd(e)},0);e.inline&&(t=e,n=o,r=function(){n.throttle()},Xo.DOM.bind(document,"mouseup",r),t.on("remove",function(){Xo.DOM.unbind(document,"mouseup",r)})),e.on("init",function(){Cb(e,o)}),e.on("remove",function(){o.cancel()})},wb=Xo.DOM,Nb=function(e){return bb.isEditorUIElement(e)},Eb=function(e,t){var n=e?e.settings.custom_ui_selector:"";return null!==wb.getParent(t,function(t){return Nb(t)||!!n&&e.dom.is(t,n)})},Sb=function(e,t){var n=t.editor;xb(n),n.on("focusin",function(){var t=e.focusedEditor;t!==this&&(t&&t.fire("blur",{focusedEditor:this}),e.setActive(this),e.focusedEditor=this,this.fire("focus",{blurredEditor:t}),this.focus(!0))}),n.on("focusout",function(){var t=this;ye.setEditorTimeout(t,function(){var n=e.focusedEditor;Eb(t,function(){try{return document.activeElement}catch(e){return document.body}}())||n!==t||(t.fire("blur",{focusedEditor:null}),e.focusedEditor=null)})}),hb||(hb=function(t){var n,r=e.activeEditor;n=t.target,r&&n.ownerDocument===document&&(n===document.body||Eb(r,n)||e.focusedEditor!==r||(r.fire("blur",{focusedEditor:null}),e.focusedEditor=null))},wb.bind(document,"focusin",hb))},kb=function(e,t){e.focusedEditor===t.editor&&(e.focusedEditor=null),e.activeEditor||(wb.unbind(document,"focusin",hb),hb=null)},Tb=function(e){e.on("AddEditor",y.curry(Sb,e)),e.on("RemoveEditor",y.curry(kb,e))},Ab={},_b="en",Bb={setCode:function(e){e&&(_b=e,this.rtl=!!this.data[e]&&"rtl"===this.data[e]._dir)},getCode:function(){return _b},rtl:!1,add:function(e,t){var n=Ab[e];for(var r in n||(Ab[e]=n={}),t)n[r]=t[r];this.setCode(e)},translate:function(e){var t=Ab[_b]||{},n=function(e){return Ot.is(e,"function")?Object.prototype.toString.call(e):r(e)?"":""+e},r=function(e){return""===e||null===e||Ot.is(e,"undefined")},o=function(e){return e=n(e),Ot.hasOwn(t,e)?n(t[e]):e};if(r(e))return"";if(Ot.is(e,"object")&&Ot.hasOwn(e,"raw"))return n(e.raw);if(Ot.is(e,"array")){var i=e.slice(1);e=o(e[0]).replace(/\{([0-9]+)\}/g,function(e,t){return Ot.hasOwn(i,t)?n(i[t]):e})}return o(e).replace(/{context:\w+}$/,"")},data:Ab},Rb=Xo.DOM,Db=Ot.explode,Ob=Ot.each,Pb=Ot.extend,Ib=0,Lb=!1,Mb=[],Fb=[],zb=function(e){Ob(yb.get(),function(t){"scroll"===e.type?t.fire("ScrollWindow",e):t.fire("ResizeWindow",e)})},Ub=function(e){e!==Lb&&(e?Qt(window).on("resize scroll",zb):Qt(window).off("resize scroll",zb),Lb=e)},Vb=function(e){var t=Fb;delete Mb[e.id];for(var n=0;n<Mb.length;n++)if(Mb[n]===e){Mb.splice(n,1);break}return Fb=M.filter(Fb,function(t){return e!==t}),yb.activeEditor===e&&(yb.activeEditor=Fb.length>0?Fb[0]:null),yb.focusedEditor===e&&(yb.focusedEditor=null),t.length!==Fb.length};Pb(yb={defaultSettings:{},$:Qt,majorVersion:"4",minorVersion:"7.5",releaseDate:"2018-01-22",editors:Mb,i18n:Bb,activeEditor:null,settings:{},setup:function(){var e,t,n,r,o="";if(t=ub.getDocumentBaseUrl(document.location),/^[^:]+:\/\/\/?[^\/]+\//.test(t)&&(t=t.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(t)||(t+="/")),n=window.tinymce||window.tinyMCEPreInit)e=n.base||n.baseURL,o=n.suffix;else{for(var i=document.getElementsByTagName("script"),a=0;a<i.length;a++){var s=(r=i[a].src).substring(r.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(r)){-1!==s.indexOf(".min")&&(o=".min"),e=r.substring(0,r.lastIndexOf("/"));break}}!e&&document.currentScript&&(-1!==(r=document.currentScript.src).indexOf(".min")&&(o=".min"),e=r.substring(0,r.lastIndexOf("/")))}this.baseURL=new ub(t).toAbsolute(e),this.documentBaseURL=t,this.baseURI=new ub(this.baseURL),this.suffix=o,Tb(this)},overrideDefaults:function(e){var t,n;(t=e.base_url)&&(this.baseURL=new ub(this.documentBaseURL).toAbsolute(t.replace(/\/+$/,"")),this.baseURI=new ub(this.baseURL)),n=e.suffix,e.suffix&&(this.suffix=n),this.defaultSettings=e;var r=e.plugin_base_urls;for(var o in r)ti.PluginManager.urls[o]=r[o]},init:function(e){var t,n,r=this;n=Ot.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option tbody tfoot thead tr script noscript style textarea video audio iframe object menu"," ");var o=function(e){var t=e.id;return t||(t=(t=e.name)&&!Rb.get(t)?e.name:Rb.uniqueId(),e.setAttribute("id",t)),t},i=function(e,t){return t.constructor===RegExp?t.test(e.className):Rb.hasClass(e,t)},a=function(e){t=e},s=function(){var t,u=0,c=[],l=function(e,n,o){var i=new gb(e,n,r);c.push(i),i.on("init",function(){++u===t.length&&a(c)}),i.targetElm=i.targetElm||o,i.render()};Rb.unbind(window,"ready",s),function(t){var n=e[t];n&&n.apply(r,Array.prototype.slice.call(arguments,2))}("onpageload"),t=Qt.unique(function(e){var t,n=[];if(me.ie&&me.ie<11)return Pm("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/"),[];if(e.types)return Ob(e.types,function(e){n=n.concat(Rb.select(e.selector))}),n;if(e.selector)return Rb.select(e.selector);if(e.target)return[e.target];switch(e.mode){case"exact":(t=e.elements||"").length>0&&Ob(Db(t),function(e){var t;(t=Rb.get(e))?n.push(t):Ob(document.forms,function(t){Ob(t.elements,function(t){t.name===e&&(e="mce_editor_"+Ib++,Rb.setAttrib(t,"id",e),n.push(t))})})});break;case"textareas":case"specific_textareas":Ob(Rb.select("textarea"),function(t){e.editor_deselector&&i(t,e.editor_deselector)||e.editor_selector&&!i(t,e.editor_selector)||n.push(t)})}return n}(e)),e.types?Ob(e.types,function(n){Ot.each(t,function(t){return!Rb.is(t,n.selector)||(l(o(t),Pb({},e,n),t),!1)})}):(Ot.each(t,function(e){var t;(t=r.get(e.id))&&t.initialized&&!(t.getContainer()||t.getBody()).parentNode&&(Vb(t),t.unbindAllNativeEvents(),t.destroy(!0),t.removed=!0,t=null)}),0===(t=Ot.grep(t,function(e){return!r.get(e.id)})).length?a([]):Ob(t,function(t){var r;r=t,e.inline&&r.tagName.toLowerCase()in n?Pm("Could not initialize inline editor on invalid inline target element",t):l(o(t),e,t)}))};return r.settings=e,Rb.bind(window,"ready",s),new pe(function(e){t?e(t):a=function(t){e(t)}})},get:function(e){return 0===arguments.length?Fb.slice(0):tr.isString(e)?M.find(Fb,function(t){return t.id===e}).getOr(null):tr.isNumber(e)&&Fb[e]?Fb[e]:null},add:function(e){var t=this;return Mb[e.id]===e?e:(null===t.get(e.id)&&("length"!==e.id&&(Mb[e.id]=e),Mb.push(e),Fb.push(e)),Ub(!0),t.activeEditor=e,t.fire("AddEditor",{editor:e}),vb||(vb=function(){t.fire("BeforeUnload")},Rb.bind(window,"beforeunload",vb)),e)},createEditor:function(e,t){return this.add(new gb(e,t,this))},remove:function(e){var t,n,r=this;if(e)return tr.isString(e)?(e=e.selector||e,void Ob(Rb.select(e),function(e){(n=r.get(e.id))&&r.remove(n)})):(n=e,tr.isNull(r.get(n.id))?null:(Vb(n)&&r.fire("RemoveEditor",{editor:n}),0===Fb.length&&Rb.unbind(window,"beforeunload",vb),n.remove(),Ub(Fb.length>0),n));for(t=Fb.length-1;t>=0;t--)r.remove(Fb[t])},execCommand:function(e,t,n){var r=this.get(n);switch(e){case"mceAddEditor":return this.get(n)||new gb(n,this.settings,this).render(),!0;case"mceRemoveEditor":return r&&r.remove(),!0;case"mceToggleEditor":return r?(r.isHidden()?r.show():r.hide(),!0):(this.execCommand("mceAddEditor",0,n),!0)}return!!this.activeEditor&&this.activeEditor.execCommand(e,t,n)},triggerSave:function(){Ob(Fb,function(e){e.save()})},addI18n:function(e,t){Bb.add(e,t)},translate:function(e){return Bb.translate(e)},setActive:function(e){var t=this.activeEditor;this.activeEditor!==e&&(t&&t.fire("deactivate",{relatedTarget:e}),e.fire("activate",{relatedTarget:t})),this.activeEditor=e}},Fd),yb.setup();var Hb,qb=yb;function jb(e){return{walk:function(t,n){return cg.walk(e,t,n)},split:sl.split,normalize:function(t){return Jf.normalize(e,t).fold(y.constant(!1),function(e){return t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0})}}}(Hb=jb||(jb={})).compareRanges=qf,Hb.getCaretRangeFromPoint=Ih,Hb.getSelectedNode=Fi,Hb.getNode=zi;var $b,Wb,Kb=jb,Xb=Math.min,Yb=Math.max,Gb=Math.round,Jb=function(e,t,n){var r,o,i,a,s,u;return r=t.x,o=t.y,i=e.w,a=e.h,s=t.w,u=t.h,"b"===(n=(n||"").split(""))[0]&&(o+=u),"r"===n[1]&&(r+=s),"c"===n[0]&&(o+=Gb(u/2)),"c"===n[1]&&(r+=Gb(s/2)),"b"===n[3]&&(o-=a),"r"===n[4]&&(r-=i),"c"===n[3]&&(o-=Gb(a/2)),"c"===n[4]&&(r-=Gb(i/2)),Qb(r,o,i,a)},Qb=function(e,t,n,r){return{x:e,y:t,w:n,h:r}},Zb={inflate:function(e,t,n){return Qb(e.x-t,e.y-n,e.w+2*t,e.h+2*n)},relativePosition:Jb,findBestRelativePosition:function(e,t,n,r){var o,i;for(i=0;i<r.length;i++)if((o=Jb(e,t,r[i])).x>=n.x&&o.x+o.w<=n.w+n.x&&o.y>=n.y&&o.y+o.h<=n.h+n.y)return r[i];return null},intersect:function(e,t){var n,r,o,i;return n=Yb(e.x,t.x),r=Yb(e.y,t.y),o=Xb(e.x+e.w,t.x+t.w),i=Xb(e.y+e.h,t.y+t.h),o-n<0||i-r<0?null:Qb(n,r,o-n,i-r)},clamp:function(e,t,n){var r,o,i,a,s,u,c,l,f,d;return s=e.x,u=e.y,c=e.x+e.w,l=e.y+e.h,f=t.x+t.w,d=t.y+t.h,r=Yb(0,t.x-s),o=Yb(0,t.y-u),i=Yb(0,c-f),a=Yb(0,l-d),s+=r,u+=o,n&&(c+=r,l+=o,s-=i,u-=a),Qb(s,u,(c-=i)-s,(l-=a)-u)},create:Qb,fromClientRect:function(e){return Qb(e.left,e.top,e.width,e.height)}},eC={},tC={add:function(e,t){eC[e.toLowerCase()]=t},has:function(e){return!!eC[e.toLowerCase()]},get:function(e){var t=e.toLowerCase(),n=eC.hasOwnProperty(t)?eC[t]:null;if(null===n)throw new Error("Could not find module for type: "+e);return n},create:function(e,t){var n;if("string"==typeof e?(t=t||{}).type=e:e=(t=e).type,e=e.toLowerCase(),!(n=eC[e]))throw new Error("Could not find control by type: "+e);return(n=new n(t)).type=e,n}},nC=Ot.each,rC=Ot.extend,oC=function(){};oC.extend=$b=function(e){var t,n,r,o=this.prototype,i=function(){var e,t,n;if(!Wb&&(this.init&&this.init.apply(this,arguments),t=this.Mixins))for(e=t.length;e--;)(n=t[e]).init&&n.init.apply(this,arguments)},a=function(){return this},s=function(e,t){return function(){var n,r=this._super;return this._super=o[e],n=t.apply(this,arguments),this._super=r,n}};for(n in Wb=!0,t=new this,Wb=!1,e.Mixins&&(nC(e.Mixins,function(t){for(var n in t)"init"!==n&&(e[n]=t[n])}),o.Mixins&&(e.Mixins=o.Mixins.concat(e.Mixins))),e.Methods&&nC(e.Methods.split(","),function(t){e[t]=a}),e.Properties&&nC(e.Properties.split(","),function(t){var n="_"+t;e[t]=function(e){return e!==undefined?(this[n]=e,this):this[n]}}),e.Statics&&nC(e.Statics,function(e,t){i[t]=e}),e.Defaults&&o.Defaults&&(e.Defaults=rC({},o.Defaults,e.Defaults)),e)"function"==typeof(r=e[n])&&o[n]?t[n]=s(n,r):t[n]=r;return i.prototype=t,i.constructor=i,i.extend=$b,i};var iC=Math.min,aC=Math.max,sC=Math.round,uC=function(e,t){var n,r,o,i;if(t=t||'"',null===e)return"null";if("string"==(o=typeof e))return r="\bb\tt\nn\ff\rr\"\"''\\\\",t+e.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(e,o){return'"'===t&&"'"===e?e:(n=r.indexOf(o))+1?"\\"+r.charAt(n+1):(e=o.charCodeAt().toString(16),"\\u"+"0000".substring(e.length)+e)})+t;if("object"===o){if(e.hasOwnProperty&&"[object Array]"===Object.prototype.toString.call(e)){for(n=0,r="[";n<e.length;n++)r+=(n>0?",":"")+uC(e[n],t);return r+"]"}for(i in r="{",e)e.hasOwnProperty(i)&&(r+="function"!=typeof e[i]?(r.length>1?","+t:t)+i+t+":"+uC(e[i],t):"");return r+"}"}return""+e},cC={serialize:uC,parse:function(e){try{return window[String.fromCharCode(101)+"val"]("("+e+")")}catch(t){}}},lC={callbacks:{},count:0,send:function(e){var t=this,n=Xo.DOM,r=e.count!==undefined?e.count:t.count,o="tinymce_jsonp_"+r;t.callbacks[r]=function(i){n.remove(o),delete t.callbacks[r],e.callback(i)},n.add(n.doc.body,"script",{id:o,src:e.url,type:"text/javascript"}),t.count++}},fC={send:function(e){var t,n=0,r=function(){!e.async||4===t.readyState||n++>1e4?(e.success&&n<1e4&&200===t.status?e.success.call(e.success_scope,""+t.responseText,t,e):e.error&&e.error.call(e.error_scope,n>1e4?"TIMED_OUT":"GENERAL",t,e),t=null):setTimeout(r,10)};if(e.scope=e.scope||this,e.success_scope=e.success_scope||e.scope,e.error_scope=e.error_scope||e.scope,e.async=!1!==e.async,e.data=e.data||"",fC.fire("beforeInitialize",{settings:e}),t=new Mm){if(t.overrideMimeType&&t.overrideMimeType(e.content_type),t.open(e.type||(e.data?"POST":"GET"),e.url,e.async),e.crossDomain&&(t.withCredentials=!0),e.content_type&&t.setRequestHeader("Content-Type",e.content_type),e.requestheaders&&Ot.each(e.requestheaders,function(e){t.setRequestHeader(e.key,e.value)}),t.setRequestHeader("X-Requested-With","XMLHttpRequest"),(t=fC.fire("beforeSend",{xhr:t,settings:e}).xhr).send(e.data),!e.async)return r();setTimeout(r,10)}}};Ot.extend(fC,Fd);var dC=Ot.extend,mC=function(e){this.settings=dC({},e),this.count=0};mC.sendRPC=function(e){return(new mC).send(e)},mC.prototype={send:function(e){var t=e.error,n=e.success;(e=dC(this.settings,e)).success=function(r,o){void 0===(r=cC.parse(r))&&(r={error:"JSON Parse error."}),r.error?t.call(e.error_scope||e.scope,r.error,o):n.call(e.success_scope||e.scope,r.result)},e.error=function(n,r){t&&t.call(e.error_scope||e.scope,n,r)},e.data=cC.serialize({id:e.id||"c"+this.count++,method:e.method,params:e.params}),e.content_type="application/json",fC.send(e)}};var pC,gC=window.localStorage,hC=qb,vC={geom:{Rect:Zb},util:{Promise:pe,Delay:ye,Tools:Ot,VK:Mp,URI:ub,Class:oC,EventDispatcher:Id,Observable:Fd,I18n:Bb,XHR:fC,JSON:cC,JSONRequest:mC,JSONP:lC,LocalStorage:gC,Color:function(e){var t={},n=0,r=0,o=0,i=function(e){var i;return"object"==typeof e?"r"in e?(n=e.r,r=e.g,o=e.b):"v"in e&&function(e,t,i){var a,s,u,c;if(e=(parseInt(e,10)||0)%360,t=parseInt(t,10)/100,i=parseInt(i,10)/100,t=aC(0,iC(t,1)),i=aC(0,iC(i,1)),0!==t){switch(a=e/60,u=(s=i*t)*(1-Math.abs(a%2-1)),c=i-s,Math.floor(a)){case 0:n=s,r=u,o=0;break;case 1:n=u,r=s,o=0;break;case 2:n=0,r=s,o=u;break;case 3:n=0,r=u,o=s;break;case 4:n=u,r=0,o=s;break;case 5:n=s,r=0,o=u;break;default:n=r=o=0}n=sC(255*(n+c)),r=sC(255*(r+c)),o=sC(255*(o+c))}else n=r=o=sC(255*i)}(e.h,e.s,e.v):(i=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(e))?(n=parseInt(i[1],10),r=parseInt(i[2],10),o=parseInt(i[3],10)):(i=/#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(e))?(n=parseInt(i[1],16),r=parseInt(i[2],16),o=parseInt(i[3],16)):(i=/#([0-F])([0-F])([0-F])/gi.exec(e))&&(n=parseInt(i[1]+i[1],16),r=parseInt(i[2]+i[2],16),o=parseInt(i[3]+i[3],16)),n=n<0?0:n>255?255:n,r=r<0?0:r>255?255:r,o=o<0?0:o>255?255:o,t};return e&&i(e),t.toRgb=function(){return{r:n,g:r,b:o}},t.toHsv=function(){return e=n,t=r,i=o,s=0,(u=iC(e/=255,iC(t/=255,i/=255)))===(c=aC(e,aC(t,i)))?{h:0,s:0,v:100*(s=u)}:(a=(c-u)/c,s=c,{h:sC(60*((e===u?3:i===u?1:5)-(e===u?t-i:i===u?e-t:i-e)/(c-u))),s:sC(100*a),v:sC(100*s)});var e,t,i,a,s,u,c},t.toHex=function(){var e=function(e){return(e=parseInt(e,10).toString(16)).length>1?e:"0"+e};return"#"+e(n)+e(r)+e(o)},t.parse=i,t}},dom:{EventUtils:Te,Sizzle:lt,DomQuery:Qt,TreeWalker:to,DOMUtils:Xo,ScriptLoader:Zo,RangeUtils:Kb,Serializer:Nh,ControlSelection:Rh,BookmarkManager:Ah,Selection:vv,Event:Te.Event},html:{Styles:zo,Entities:Ao,Node:fh,Schema:Fo,SaxParser:em,DomParser:bh,Writer:Fs,Serializer:zs},ui:{Factory:tC},Env:me,AddOnManager:ti,Formatter:Yg,UndoManager:rg,EditorCommands:Od,WindowManager:km,NotificationManager:Sm,EditorObservable:qd,Shortcuts:Jd,Editor:gb,FocusManager:bb,EditorManager:qb,DOM:Xo.DOM,ScriptLoader:Zo.ScriptLoader,PluginManager:ti.PluginManager,ThemeManager:ti.ThemeManager,trim:Ot.trim,isArray:Ot.isArray,is:Ot.is,toArray:Ot.toArray,makeMap:Ot.makeMap,each:Ot.each,map:Ot.map,grep:Ot.grep,inArray:Ot.inArray,extend:Ot.extend,create:Ot.create,walk:Ot.walk,createNS:Ot.createNS,resolve:Ot.resolve,explode:Ot.explode,_addCacheSuffix:Ot._addCacheSuffix,isOpera:me.opera,isWebKit:me.webkit,isIE:me.ie,isGecko:me.gecko,isMac:me.mac};hC=Ot.extend(hC,vC),pC=hC,window.tinymce=pC,window.tinyMCE=pC}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n="[-'\\.\u2018\u2019\u2024\ufe52\uff07\uff0e]",t="[:\xb7\xb7\u05f4\u2027\ufe13\ufe55\uff1a]",r="[+*/,;;\u0589\u060c\u060d\u066c\u07f8\u2044\ufe10\ufe14\ufe50\ufe54\uff0c\uff1b]",E="[0-9\u0660-\u0669\u066b\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\uaa50-\uaa59\uabf0-\uabf9]",T="\\r",u="\\n",i="[\x0B\f\x85\u2028\u2029]",o="[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f\u109a-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b6-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u192b\u1930-\u193b\u19b0-\u19c0\u19c8\u19c9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f\u1b00-\u1b04\u1b34-\u1b44\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1baa\u1be6-\u1bf3\u1c24-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe3-\uabea\uabec\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]",c="[\xad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200e\u200f\u202a-\u202e\u2060-\u2064\u206a-\u206f\ufeff\ufff9-\ufffb]",a="[\u3031-\u3035\u309b\u309c\u30a0-\u30fa\u30fc-\u30ff\u31f0-\u31ff\u32d0-\u32fe\u3300-\u3357\uff66-\uff9d]",R="[=_\u203f\u2040\u2054\ufe33\ufe34\ufe4d-\ufe4f\uff3f\u2200-\u22ff<>]",f="[!-#%-*,-\\/:;?@\\[-\\]_{}\xa1\xab\xb7\xbb\xbf;\xb7\u055a-\u055f\u0589\u058a\u05be\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1361-\u1368\u1400\u166d\u166e\u169b\u169c\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cd3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205e\u207d\u207e\u208d\u208e\u3008\u3009\u2768-\u2775\u27c5\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc\u29fd\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e2e\u2e30\u2e31\u3001-\u3003\u3008-\u3011\u3014-\u301f\u3030\u303d\u30a0\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uabeb\ufd3e\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a\uff1b\uff1f\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]",A={characterIndices:{ALETTER:0,MIDNUMLET:1,MIDLETTER:2,MIDNUM:3,NUMERIC:4,CR:5,LF:6,NEWLINE:7,EXTEND:8,FORMAT:9,KATAKANA:10,EXTENDNUMLET:11,AT:12,OTHER:13},SETS:[new RegExp("[A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f3\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u10a0-\u10c5\u10d0-\u10fa\u10fc\u1100-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bc0-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u24b6-\u24e9\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2d00-\u2d25\u2d30-\u2d65\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u303b\u303c\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790\ua791\ua7a0-\ua7a9\ua7fa-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]"),new RegExp(n),new RegExp(t),new RegExp(r),new RegExp(E),new RegExp(T),new RegExp(u),new RegExp(i),new RegExp(o),new RegExp(c),new RegExp(a),new RegExp(R),new RegExp("@")],EMPTY_STRING:"",PUNCTUATION:new RegExp("^"+f+"$"),WHITESPACE:/^\s+$/},N=function(e,n,t){var r,E;if(!e)return 0;if(t=t||e,e.length!==undefined){for(r=0,E=e.length;r<E;r++)if(!1===n.call(t,e[r],r,e))return 0}else for(r in e)if(e.hasOwnProperty(r)&&!1===n.call(t,e[r],r,e))return 0;return 1},s=function(e,n){var t=[];return N(e,function(r,E){t.push(n(r,E,e))}),t},l=A.SETS,M=A.characterIndices.OTHER,d=function(e){var n,t,r=M,E=l.length;for(n=0;n<E;++n)if((t=l[n])&&t.test(e)){r=n;break}return r},I=function(e){var n,t,r=(n=d,t={},function(e){if(t[e])return t[e];var r=n(e);return t[e]=r,r});return s(e.split(""),r)},L=A.characterIndices,g=function(e,n){var t,r,E=e[n],T=e[n+1];return!(n<0||n>e.length-1&&0!==n||E===L.ALETTER&&T===L.ALETTER||(r=e[n+2],E===L.ALETTER&&(T===L.MIDLETTER||T===L.MIDNUMLET||T===L.AT)&&r===L.ALETTER||(t=e[n-1],(E===L.MIDLETTER||E===L.MIDNUMLET||T===L.AT)&&T===L.ALETTER&&t===L.ALETTER||!(E!==L.NUMERIC&&E!==L.ALETTER||T!==L.NUMERIC&&T!==L.ALETTER)||(E===L.MIDNUM||E===L.MIDNUMLET)&&T===L.NUMERIC&&t===L.NUMERIC||E===L.NUMERIC&&(T===L.MIDNUM||T===L.MIDNUMLET)&&r===L.NUMERIC||E===L.EXTEND||E===L.FORMAT||t===L.EXTEND||t===L.FORMAT||T===L.EXTEND||T===L.FORMAT||E===L.CR&&T===L.LF||E!==L.NEWLINE&&E!==L.CR&&E!==L.LF&&T!==L.NEWLINE&&T!==L.CR&&T!==L.LF&&(E===L.KATAKANA&&T===L.KATAKANA||T===L.EXTENDNUMLET&&(E===L.ALETTER||E===L.NUMERIC||E===L.KATAKANA||E===L.EXTENDNUMLET)||E===L.EXTENDNUMLET&&(T===L.ALETTER||T===L.NUMERIC||T===L.KATAKANA)||E===L.AT))))},p=A.EMPTY_STRING,U=A.WHITESPACE,w=A.PUNCTUATION,h=function(e,n,t){var r=function(e,n){var t;for(t=n;t<e.length;++t){var r=e.charAt(t);if(U.test(r))break}return t}(n,t+1),E=n.substring(t+1,r);return"://"===E.substr(0,3)?{word:e+E,index:r}:{word:e,index:t}},v=function(e,n){return function(e,n){var t,r,E,T,u=0,i=I(e),o=i.length,c=[],a=[];for(n||(n={}),n.ignoreCase&&(e=e.toLowerCase()),r=n.includePunctuation,E=n.includeWhitespace;u<o;++u)if(t=e.charAt(u),c.push(t),g(i,u)){if((c=c.join(p))&&(E||!U.test(c))&&(r||!w.test(c)))if("http"===(T=c)||"https"===T){var R=h(c,e,u);a.push(R.word),u=R.index}else a.push(c);c=[]}return a}(e.replace(/\ufeff/g,""),n)},x=function(e){return v((n=e,n.removed?"":n.getBody().innerText)).length;var n},C=function(e){return{getCount:function(){return x(e)}}},D=tinymce.util.Tools.resolve("tinymce.util.Delay"),m=tinymce.util.Tools.resolve("tinymce.util.I18n"),y=function(e){var n=function(e){return m.translate(["{0} words",x(e)])},t=function(){e.theme.panel.find("#wordcount").text(n(e))};e.on("init",function(){var r=e.theme.panel&&e.theme.panel.find("#statusbar")[0],E=D.debounce(t,300);r&&D.setEditorTimeout(e,function(){r.insert({type:"label",name:"wordcount",text:n(e),classes:"wordcount",disabled:e.settings.readonly},0),e.on("setcontent beforeaddundo undo redo keyup",E)},0)})};e.add("wordcount",function(e){return y(e),C(e)})}();!function(){"use strict";var n,e,t,r,o=function(n){var e=n,t=function(){return e};return{get:t,set:function(n){e=n},clone:function(){return o(t())}}},u=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(n){return{isEnabled:function(){return n.get()}}},c=function(n,e){return n.fire("VisualChars",{state:e})},a={"\xa0":"nbsp","\xad":"shy"},f=function(n,e){var t,r="";for(t in n)r+=t;return new RegExp("["+r+"]",e?"g":"")},l=function(n){var e,t="";for(e in n)t&&(t+=","),t+="span.mce-"+n[e];return t},s={charMap:a,regExp:f(a),regExpGlobal:f(a,!0),selector:l(a),charMapToRegExp:f,charMapToSelector:l},d=function(n){return function(){return n}},m={noop:function(){},noarg:function(n){return function(){return n()}},compose:function(n,e){return function(){return n(e.apply(null,arguments))}},constant:d,identity:function(n){return n},tripleEquals:function(n,e){return n===e},curry:function(n){for(var e=new Array(arguments.length-1),t=1;t<arguments.length;t++)e[t-1]=arguments[t];return function(){for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var o=e.concat(t);return n.apply(null,o)}},not:function(n){return function(){return!n.apply(null,arguments)}},die:function(n){return function(){throw new Error(n)}},apply:function(n){return n()},call:function(n){n()},never:d(!1),always:d(!0)},p=m.never,h=m.always,v=function(){return g},g=(r={fold:function(n,e){return n()},is:p,isSome:p,isNone:h,getOr:t=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},or:t,orThunk:e,map:v,ap:v,each:function(){},bind:v,flatten:v,exists:p,forall:h,filter:v,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:m.constant("none()")},Object.freeze&&Object.freeze(r),r),y=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:h,isNone:p,getOr:e,getOrThunk:e,getOrDie:e,or:t,orThunk:t,map:function(e){return y(e(n))},ap:function(e){return e.fold(v,function(e){return y(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:g},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(p,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},T={some:y,none:v,from:function(n){return null===n||n===undefined?g:y(n)}},w=(Array.prototype.indexOf,undefined,function(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var u=n[o];r[o]=e(u,o,n)}return r}),x=function(n,e){for(var t=0,r=n.length;t<r;t++)e(n[t],t,n)},E=(Array.prototype.push,Array.prototype.slice,w),b=x,k=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:m.constant(n)}},N={fromHtml:function(n,e){var t=(e||document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||t.childNodes.length>1)throw console.error("HTML does not have a single root node",n),"HTML must have a single root node";return k(t.childNodes[0])},fromTag:function(n,e){var t=(e||document).createElement(n);return k(t)},fromText:function(n,e){var t=(e||document).createTextNode(n);return k(t)},fromDom:k,fromPoint:function(n,e,t){return T.from(n.dom().elementFromPoint(e,t)).map(k)}},C=8,M=9,D=3,O=function(n){return n.dom().nodeName.toLowerCase()},A=function(n){return n.dom().nodeType},S=function(n){return function(e){return A(e)===n}},B=S(1),P=S(D),V=S(M),q={name:O,type:A,value:function(n){return n.dom().nodeValue},isElement:B,isText:P,isDocument:V,isComment:function(n){return A(n)===C||"#comment"===O(n)}},H=function(n){return'<span data-mce-bogus="1" class="mce-'+s.charMap[n]+'">'+n+"</span>"},L=function(n,e){var t=[],r=n.dom(),o=E(r.childNodes,N.fromDom);return b(o,function(n){e(n)&&(t=t.concat([n])),t=t.concat(L(n,e))}),t},R={isMatch:function(n){return q.isText(n)&&q.value(n)!==undefined&&s.regExp.test(q.value(n))},filterDescendants:L,findParentElm:function(n,e){for(;n.parentNode;){if(n.parentNode===e)return n;n=n.parentNode}},replaceWithSpans:function(n){return n.replace(s.regExpGlobal,H)}},_=function(n,e){var t,r,o=R.filterDescendants(N.fromDom(e),R.isMatch);b(o,function(e){var o=R.replaceWithSpans(q.value(e));for(r=n.dom.create("div",null,o);t=r.lastChild;)n.dom.insertAfter(t,e.dom());n.dom.remove(e.dom())})},j=function(n,e){var t=n.dom.select(s.selector,e);b(t,function(e){n.dom.remove(e,1)})},z=_,G=j,W=function(n){var e=n.getBody(),t=n.selection.getBookmark(),r=R.findParentElm(n.selection.getNode(),e);r=r!==undefined?r:e,j(n,r),_(n,r),n.selection.moveToBookmark(t)},F=function(n,e){var t,r=n.getBody(),o=n.selection;e.set(!e.get()),c(n,e.get()),t=o.getBookmark(),!0===e.get()?z(n,r):G(n,r),o.moveToBookmark(t)},I=function(n,e){n.addCommand("mceVisualChars",function(){F(n,e)})},J=tinymce.util.Tools.resolve("tinymce.util.Delay"),K=function(n,e){var t=J.debounce(function(){W(n)},300);!1!==n.settings.forced_root_block&&n.on("keydown",function(r){!0===e.get()&&(13===r.keyCode?W(n):t())})},Q=function(n){return function(e){var t=e.control;n.on("VisualChars",function(n){t.active(n.state)})}};u.add("visualchars",function(n){var e,t=o(!1);return I(n,t),(e=n).addButton("visualchars",{active:!1,title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:Q(e)}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:Q(e),selectable:!0,context:"view",prependToContext:!0}),K(n,t),i(t)})}();!function(){"use strict";var e=function(t){var n=t,o=function(){return n};return{get:o,set:function(e){n=e},clone:function(){return e(o())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e,t){e.fire("VisualBlocks",{state:t})},o=function(e){return e.getParam("visualblocks_default_state",!1)},s=function(e){return e.settings.visualblocks_content_css},i=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=i.DOM.uniqueId(),u=function(e,t){var n=c.toArray(e.getElementsByTagName("link"));if(0===c.grep(n,function(e){return e.id===l}).length){var o=i.DOM.create("link",{id:l,rel:"stylesheet",href:t});e.getElementsByTagName("head")[0].appendChild(o)}},a=function(e,t,o){var i=e.dom,c=s(e);u(e.getDoc(),c||t+"/css/visualblocks.css"),i.toggleClass(e.getBody(),"mce-visualblocks"),o.set(!o.get()),n(e,o.get())},r=function(e,t,n){e.addCommand("mceVisualBlocks",function(){a(e,t,n)})},m=function(e,t,n){e.on("PreviewFormats AfterPreviewFormats",function(t){n.get()&&e.dom.toggleClass(e.getBody(),"mce-visualblocks","afterpreviewformats"===t.type)}),e.on("init",function(){o(e)&&a(e,t,n)}),e.on("remove",function(){e.dom.removeClass(e.getBody(),"mce-visualblocks")})},f=function(e,t){return function(n){var o=n.control;o.active(t.get()),e.on("VisualBlocks",function(e){o.active(e.state)})}},d=function(e,t){e.addButton("visualblocks",{active:!1,title:"Show blocks",cmd:"mceVisualBlocks",onPostRender:f(e,t)}),e.addMenuItem("visualblocks",{text:"Show blocks",cmd:"mceVisualBlocks",onPostRender:f(e,t),selectable:!0,context:"view",prependToContext:!0})};t.add("visualblocks",function(t,n){var o=e(!1);r(t,n,o),d(t,o),m(t,n,o)})}();!function(){"use strict";var t=function(e){var n=e,r=function(){return n};return{get:r,set:function(t){n=t},clone:function(){return t(r())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(t){return{setPatterns:function(e){t.set(e)},getPatterns:function(){return t.get()}}},r=[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"***",end:"***",format:["bold","italic"]},{start:"#",format:"h1"},{start:"##",format:"h2"},{start:"###",format:"h3"},{start:"####",format:"h4"},{start:"#####",format:"h5"},{start:"######",format:"h6"},{start:"1. ",cmd:"InsertOrderedList"},{start:"* ",cmd:"InsertUnorderedList"},{start:"- ",cmd:"InsertUnorderedList"}],a=function(t){return t.textpattern_patterns!==undefined?t.textpattern_patterns:r},o=tinymce.util.Tools.resolve("tinymce.util.Delay"),i=tinymce.util.Tools.resolve("tinymce.util.VK"),s=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),l=tinymce.util.Tools.resolve("tinymce.util.Tools"),d=function(t,e){for(var n=0;n<t.length;n++)if(0===e.indexOf(t[n].start)&&(!t[n].end||e.lastIndexOf(t[n].end)===e.length-t[n].end.length))return t[n]},f=function(t,e,n,r){var a,o,i,s,l,d,f=t.sort(function(t,e){return t.start.length>e.start.length?-1:t.start.length<e.start.length?1:0});for(o=0;o<f.length;o++)if((a=f[o]).end!==undefined&&(s=a,l=n,d=r,e.substr(l-s.end.length-d,s.end.length)===s.end)&&n-r-(i=a).end.length-i.start.length>0)return a},c=function(t,e,n){if(!1!==e.collapsed){var r=e.startContainer,a=r.data,o=!0===n?1:0;if(3===r.nodeType){var i=f(t,a,e.startOffset,o);if(i!==undefined){var s=a.lastIndexOf(i.end,e.startOffset-o),l=a.lastIndexOf(i.start,s-i.end.length);if(s=a.indexOf(i.end,l+i.start.length),-1!==l){var c=document.createRange();c.setStart(r,l),c.setEnd(r,s+i.end.length);var u=d(t,c.toString());if(!(i===undefined||u!==i||r.data.length<=i.start.length+i.end.length))return{pattern:i,startOffset:l,endOffset:s}}}}}},u=function(t,e,n){var r=t.selection.getRng(!0),a=c(e,r,n);if(a)return function(t,e,n,r){var a=l.isArray(n.pattern.format)?n.pattern.format:[n.pattern.format];if(0!==l.grep(a,function(e){var n=t.formatter.get(e);return n&&n[0].inline}).length)return t.undoManager.transact(function(){var r,o,i,s;r=e,o=n.pattern,i=n.endOffset,s=n.startOffset,(r=s>0?r.splitText(s):r).splitText(i-s+o.end.length),r.deleteData(0,o.start.length),r.deleteData(r.data.length-o.end.length,o.end.length),e=r,a.forEach(function(n){t.formatter.apply(n,{},e)})}),e}(t,r.startContainer,a)},g={patternFromRng:c,applyInlineFormatSpace:function(t,e){return u(t,e,!0)},applyInlineFormatEnter:function(t,e){return u(t,e,!1)},applyBlockFormat:function(t,e){var n,r,a,o,i,f,c,u,g,h,m;if(n=t.selection,r=t.dom,n.isCollapsed()&&(c=r.getParent(n.getStart(),"p"))){for(g=new s(c,c);i=g.next();)if(3===i.nodeType){o=i;break}if(o){if(!(u=d(e,o.data)))return;if(a=(h=n.getRng(!0)).startContainer,m=h.startOffset,o===a&&(m=Math.max(0,m-u.start.length)),l.trim(o.data).length===u.start.length)return;u.format&&(f=t.formatter.get(u.format))&&f[0].block&&(o.deleteData(0,u.start.length),t.formatter.apply(u.format,{},o),h.setStart(a,m),h.collapse(!0),n.setRng(h)),u.cmd&&t.undoManager.transact(function(){o.deleteData(0,u.start.length),t.execCommand(u.cmd)})}}}},h=function(t,e,n){for(var r=0;r<t.length;r++)if(n(t[r],e))return!0},m={handleEnter:function(t,e){var n,r;(n=g.applyInlineFormatEnter(t,e))&&((r=t.dom.createRng()).setStart(n,n.data.length),r.setEnd(n,n.data.length),t.selection.setRng(r)),g.applyBlockFormat(t,e)},handleInlineKey:function(t,e){var n,r,a,o,i;(n=g.applyInlineFormatSpace(t,e))&&(i=t.dom,r=n.data.slice(-1),/[\u00a0 ]/.test(r)&&(n.deleteData(n.data.length-1,1),a=i.doc.createTextNode(r),i.insertAfter(a,n.parentNode),(o=i.createRng()).setStart(a,1),o.setEnd(a,1),t.selection.setRng(o)))},checkCharCode:function(t,e){return h(t,e,function(t,e){return t.charCodeAt(0)===e.charCode})},checkKeyCode:function(t,e){return h(t,e,function(t,e){return t===e.keyCode&&!1===i.modifierPressed(e)})}},p=function(t,e){var n=[",",".",";",":","!","?"],r=[32];t.on("keydown",function(n){13!==n.keyCode||i.modifierPressed(n)||m.handleEnter(t,e.get())},!0),t.on("keyup",function(n){m.checkKeyCode(r,n)&&m.handleInlineKey(t,e.get())}),t.on("keypress",function(r){m.checkCharCode(n,r)&&o.setEditorTimeout(t,function(){m.handleInlineKey(t,e.get())})})};e.add("textpattern",function(e){var r=t(a(e.settings));return p(e,r),n(r)})}();!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(t,e){var o;return t.dom.getParents(t.selection.getStart(),function(t){var r;(r=t.style["forecolor"===e?"color":"background-color"])&&(o=r)}),o},o=function(t){var e,o=[];for(e=0;e<t.length;e+=2)o.push({text:t[e+1],color:"#"+t[e]});return o},r=function(t,e,o){t.undoManager.transact(function(){t.focus(),t.formatter.apply(e,{value:o}),t.nodeChanged()})},n=function(t,e){t.undoManager.transact(function(){t.focus(),t.formatter.remove(e,{value:null},null,!0),t.nodeChanged()})},a=function(t){t.addCommand("mceApplyTextcolor",function(e,o){r(t,e,o)}),t.addCommand("mceRemoveTextcolor",function(e){n(t,e)})},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],u=function(t){return t.getParam("textcolor_map",i)},m=function(t){return t.getParam("textcolor_rows",5)},s=function(t){return t.getParam("textcolor_cols",8)},d=function(t){return t.getParam("color_picker_callback",null)},f=function(t){return t.getParam("forecolor_map",u(t))},g=function(t){return t.getParam("backcolor_map",u(t))},F=function(t){return t.getParam("forecolor_rows",m(t))},b=function(t){return t.getParam("backcolor_rows",m(t))},p=function(t){return t.getParam("forecolor_cols",s(t))},C=function(t){return t.getParam("backcolor_cols",s(t))},y=d,v=function(t){return"function"==typeof d(t)},h=tinymce.util.Tools.resolve("tinymce.util.I18n"),P=function(t,e,r,n){var a,c,i,u,m,s,d,f=0,g=l.DOM.uniqueId("mcearia"),F=function(t,e){var o="transparent"===t;return'<td class="mce-grid-cell'+(o?" mce-colorbtn-trans":"")+'"><div id="'+g+"-"+f+++'" data-mce-color="'+(t||"")+'" role="option" tabIndex="-1" style="'+(t?"background-color: "+t:"")+'" title="'+h.translate(e)+'">'+(o?"&#215;":"")+"</div></td>"};for((a=o(r)).push({text:h.translate("No color"),color:"transparent"}),i='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',u=a.length-1,s=0;s<e;s++){for(i+="<tr>",m=0;m<t;m++)i+=(d=s*t+m)>u?"<td></td>":F((c=a[d]).color,c.text);i+="</tr>"}if(n){for(i+='<tr><td colspan="'+t+'" class="mce-custom-color-btn"><div id="'+g+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+g+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+h.translate("Custom...")+"</button></div></td></tr>",i+="<tr>",m=0;m<t;m++)i+=F("","Custom color");i+="</tr>"}return i+="</tbody></table>"},k=function(t,e){t.style.background=e,t.setAttribute("data-mce-color",e)},x=function(t){return function(e){var o=e.control;o._color?t.execCommand("mceApplyTextcolor",o.settings.format,o._color):t.execCommand("mceRemoveTextcolor",o.settings.format)}},T=function(t,o){return function(r){var n,a=this.parent(),i=e(t,a.settings.format),u=function(e){a.hidePanel(),a.color(e),t.execCommand("mceApplyTextcolor",a.settings.format,e)};l.DOM.getParent(r.target,".mce-custom-color-btn")&&(a.hidePanel(),y(t).call(t,function(t){var e,r,n,l=a.panel.getEl().getElementsByTagName("table")[0];for(e=c.map(l.rows[l.rows.length-1].childNodes,function(t){return t.firstChild}),n=0;n<e.length&&(r=e[n]).getAttribute("data-mce-color");n++);if(n===o)for(n=0;n<o-1;n++)k(e[n],e[n+1].getAttribute("data-mce-color"));k(r,t),u(t)},i)),(n=r.target.getAttribute("data-mce-color"))?(this.lastId&&l.DOM.get(this.lastId).setAttribute("aria-selected",!1),r.target.setAttribute("aria-selected",!0),this.lastId=r.target.id,"transparent"===n?(a.hidePanel(),a.resetColor(),t.execCommand("mceRemoveTextcolor",a.settings.format)):u(n)):null!==n&&a.hidePanel()}},_=function(t,e){return function(){var o=e?p(t):C(t),r=e?F(t):b(t),n=e?f(t):g(t),a=v(t);return P(o,r,n,a)}},A=function(t){t.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{role:"application",ariaRemember:!0,html:_(t,!0),onclick:T(t,p(t))},onclick:x(t)}),t.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{role:"application",ariaRemember:!0,html:_(t,!1),onclick:T(t,C(t))},onclick:x(t)})};t.add("textcolor",function(t){a(t),A(t)})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e){return function(){return e}},n=function(e){for(var t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[n-1]=arguments[n];return function(){for(var n=new Array(arguments.length),a=0;a<n.length;a++)n[a]=arguments[a];var r=t.concat(n);return e.apply(null,r)}},a=(t(!1),t(!0),tinymce.util.Tools.resolve("tinymce.util.Tools")),r=tinymce.util.Tools.resolve("tinymce.util.XHR"),l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=function(e){return e.getParam("template_cdate_classes","cdate")},o=function(e){return e.getParam("template_mdate_classes","mdate")},i=function(e){return e.getParam("template_selected_content_classes","selcontent")},s=function(e){return e.getParam("template_preview_replace_values")},u=function(e){return e.getParam("template_replace_values")},p=function(e){return e.templates},m=function(e){return e.getParam("template_cdate_format",e.getLang("template.cdate_format"))},d=function(e){return e.getParam("template_mdate_format",e.getLang("template.mdate_format"))},f=function(e){return e.getParam("template_popup_width",600)},g=function(e){return Math.min(l.DOM.getViewPort().h,e.getParam("template_popup_height",500))},h=function(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e},y=function(e,t,n){var a="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),l="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),c="January February March April May June July August September October November December".split(" ");return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",h(n.getMonth()+1,2))).replace("%d",h(n.getDate(),2))).replace("%H",""+h(n.getHours(),2))).replace("%M",""+h(n.getMinutes(),2))).replace("%S",""+h(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(c[n.getMonth()]))).replace("%b",""+e.translate(l[n.getMonth()]))).replace("%A",""+e.translate(r[n.getDay()]))).replace("%a",""+e.translate(a[n.getDay()]))).replace("%%","%")},v=function(e,t,n){return a.each(n,function(e,n){"function"==typeof e&&(e=e(n)),t=t.replace(new RegExp("\\{\\$"+n+"\\}","g"),e)}),t},M=function(e,t){var n=e.dom,r=u(e);a.each(n.select("*",t),function(e){a.each(r,function(t,a){n.hasClass(e,a)&&"function"==typeof r[a]&&r[a](e)})})},_=function(e,t){return new RegExp("\\b"+t+"\\b","g").test(e.className)},b=function(e,t){return function(){var n=p(e);"function"!=typeof n?"string"==typeof n?r.send({url:n,success:function(e){t(JSON.parse(e))}}):t(n):n(t)}},T=v,x=M,P=function(e,t,n){var r,l,s=e.dom,p=e.selection.getContent();n=v(0,n,u(e)),r=s.create("div",null,n),(l=s.select(".mceTmpl",r))&&l.length>0&&(r=s.create("div",null)).appendChild(l[0].cloneNode(!0)),a.each(s.select("*",r),function(t){_(t,c(e).replace(/\s+/g,"|"))&&(t.innerHTML=y(e,m(e))),_(t,o(e).replace(/\s+/g,"|"))&&(t.innerHTML=y(e,d(e))),_(t,i(e).replace(/\s+/g,"|"))&&(t.innerHTML=p)}),M(e,r),e.execCommand("mceInsertContent",!1,r.innerHTML),e.addVisual()},S=function(e){e.addCommand("mceInsertTemplate",n(P,e))},w=function(e){e.on("PreProcess",function(t){var n=e.dom,r=d(e);a.each(n.select("div",t.node),function(t){n.hasClass(t,"mceTmpl")&&(a.each(n.select("*",t),function(t){n.hasClass(t,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(t.innerHTML=y(e,r))}),x(e,t))})})},D=function(e,t,n){if(-1===n.indexOf("<html>")){var r="";a.each(e.contentCSS,function(t){r+='<link type="text/css" rel="stylesheet" href="'+e.documentBaseURI.toAbsolute(t)+'">'});var l=e.settings.body_class||"";-1!==l.indexOf("=")&&(l=(l=e.getParam("body_class","","hash"))[e.id]||""),n="<!DOCTYPE html><html><head>"+r+'</head><body class="'+l+'">'+n+"</body></html>"}n=T(e,n,s(e));var c=t.find("iframe")[0].getEl().contentWindow.document;c.open(),c.write(n),c.close()},H=function(e,t){var n,l,c=[];if(t&&0!==t.length)a.each(t,function(e){c.push({selected:!c.length,text:e.title,value:{url:e.url,content:e.content,description:e.description}})}),(n=e.windowManager.open({title:"Insert template",layout:"flex",direction:"column",align:"stretch",padding:15,spacing:10,items:[{type:"form",flex:0,padding:0,items:[{type:"container",label:"Templates",items:{type:"listbox",label:"Templates",name:"template",values:c,onselect:function(t){var a=t.control.value();a.url?r.send({url:a.url,success:function(t){D(e,n,l=t)}}):(l=a.content,D(e,n,l)),n.find("#description")[0].text(t.control.value().description)}}}]},{type:"label",name:"description",label:"Description",text:"\xa0"},{type:"iframe",flex:1,border:1}],onsubmit:function(){P(e,!1,l)},minWidth:f(e),minHeight:g(e)})).find("listbox")[0].fire("select");else{var o=e.translate("No templates defined.");e.notificationManager.open({text:o,type:"info"})}},C=function(e){return function(t){H(e,t)}},A=function(e){e.addButton("template",{title:"Insert template",onclick:b(e.settings,C(e))}),e.addMenuItem("template",{text:"Template",onclick:b(e.settings,C(e)),icon:"template",context:"insert"})};e.add("template",function(e){A(e),S(e),w(e)})}();!function(){"use strict";var n,t,e,r,o,i,u,a,c,l,s,f=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=function(n){return function(){return n}},m={noop:function(){},noarg:function(n){return function(){return n()}},compose:function(n,t){return function(){return n(t.apply(null,arguments))}},constant:d,identity:function(n){return n},tripleEquals:function(n,t){return n===t},curry:function(n){for(var t=new Array(arguments.length-1),e=1;e<arguments.length;e++)t[e-1]=arguments[e];return function(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var o=t.concat(e);return n.apply(null,o)}},not:function(n){return function(){return!n.apply(null,arguments)}},die:function(n){return function(){throw new Error(n)}},apply:function(n){return n()},call:function(n){n()},never:d(!1),always:d(!0)},g=m.never,p=m.always,h=function(){return v},v=(r={fold:function(n,t){return n()},is:g,isSome:g,isNone:p,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},or:e,orThunk:t,map:h,ap:h,each:function(){},bind:h,flatten:h,exists:g,forall:p,filter:h,equals:n=function(n){return n.isNone()},equals_:n,toArray:function(){return[]},toString:m.constant("none()")},Object.freeze&&Object.freeze(r),r),b=function(n){var t=function(){return n},e=function(){return o},r=function(t){return t(n)},o={fold:function(t,e){return e(n)},is:function(t){return n===t},isSome:p,isNone:g,getOr:t,getOrThunk:t,getOrDie:t,or:e,orThunk:e,map:function(t){return b(t(n))},ap:function(t){return t.fold(h,function(t){return b(t(n))})},each:function(t){t(n)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(n)?o:v},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(g,function(t){return e(n,t)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},w={some:b,none:h,from:function(n){return null===n||n===undefined?v:b(n)}},y=(o=Array.prototype.indexOf)===undefined?function(n,t){return A(n,t)}:function(n,t){return o.call(n,t)},x=function(n,t){return y(n,t)>-1},C=function(n,t){for(var e=n.length,r=new Array(e),o=0;o<e;o++){var i=n[o];r[o]=t(i,o,n)}return r},S=function(n,t){for(var e=0,r=n.length;e<r;e++)t(n[e],e,n)},R=function(n,t){for(var e=n.length-1;e>=0;e--)t(n[e],e,n)},T=function(n,t){for(var e=[],r=0,o=n.length;r<o;r++){var i=n[r];t(i,r,n)&&e.push(i)}return e},D=function(n,t){for(var e=0,r=n.length;e<r;e++)if(t(n[e],e,n))return w.some(e);return w.none()},A=function(n,t){for(var e=0,r=n.length;e<r;++e)if(n[e]===t)return e;return-1},k=Array.prototype.push,N=function(n){for(var t=[],e=0,r=n.length;e<r;++e){if(!Array.prototype.isPrototypeOf(n[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+n);k.apply(t,n[e])}return t},O=function(n,t){for(var e=0,r=n.length;e<r;++e)if(!0!==t(n[e],e,n))return!1;return!0},E=Array.prototype.slice,B={map:C,each:S,eachr:R,partition:function(n,t){for(var e=[],r=[],o=0,i=n.length;o<i;o++){var u=n[o];(t(u,o,n)?e:r).push(u)}return{pass:e,fail:r}},filter:T,groupBy:function(n,t){if(0===n.length)return[];for(var e=t(n[0]),r=[],o=[],i=0,u=n.length;i<u;i++){var a=n[i],c=t(a);c!==e&&(r.push(o),o=[]),e=c,o.push(a)}return 0!==o.length&&r.push(o),r},indexOf:function(n,t){var e=y(n,t);return-1===e?w.none():w.some(e)},foldr:function(n,t,e){return R(n,function(n){e=t(e,n)}),e},foldl:function(n,t,e){return S(n,function(n){e=t(e,n)}),e},find:function(n,t){for(var e=0,r=n.length;e<r;e++){var o=n[e];if(t(o,e,n))return w.some(o)}return w.none()},findIndex:D,flatten:N,bind:function(n,t){var e=C(n,t);return N(e)},forall:O,exists:function(n,t){return D(n,t).isSome()},contains:x,equal:function(n,t){return n.length===t.length&&O(n,function(n,e){return n===t[e]})},reverse:function(n){var t=E.call(n,0);return t.reverse(),t},chunk:function(n,t){for(var e=[],r=0;r<n.length;r+=t){var o=n.slice(r,r+t);e.push(o)}return e},difference:function(n,t){return T(n,function(n){return!x(t,n)})},mapToObject:function(n,t){for(var e={},r=0,o=n.length;r<o;r++){var i=n[r];e[String(i)]=t(i,r)}return e},pure:function(n){return[n]},sort:function(n,t){var e=E.call(n,0);return e.sort(t),e},range:function(n,t){for(var e=[],r=0;r<n;r++)e.push(t(r));return e},head:function(n){return 0===n.length?w.none():w.some(n[0])},last:function(n){return 0===n.length?w.none():w.some(n[n.length-1])}},I=(i=Object.keys)===undefined?function(n){var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t}:i,P=function(n,t){for(var e=I(n),r=0,o=e.length;r<o;r++){var i=e[r];t(n[i],i,n)}},W=function(n,t){var e={};return P(n,function(r,o){var i=t(r,o,n);e[i.k]=i.v}),e},_=function(n,t){var e=[];return P(n,function(n,r){e.push(t(n,r))}),e},M=function(n){return _(n,function(n){return n})},L={bifilter:function(n,t){var e={},r={};return P(n,function(n,o){(t(n,o)?e:r)[o]=n}),{t:e,f:r}},each:P,map:function(n,t){return W(n,function(n,e,r){return{k:e,v:t(n,e,r)}})},mapToArray:_,tupleMap:W,find:function(n,t){for(var e=I(n),r=0,o=e.length;r<o;r++){var i=e[r],u=n[i];if(t(u,i,n))return w.some(u)}return w.none()},keys:I,values:M,size:function(n){return M(n).length}},q=function(n){return function(t){return function(n){if(null===n)return"null";var t=typeof n;return"object"===t&&Array.prototype.isPrototypeOf(n)?"array":"object"===t&&String.prototype.isPrototypeOf(n)?"string":t}(t)===n}},z={isString:q("string"),isObject:q("object"),isArray:q("array"),isNull:q("null"),isBoolean:q("boolean"),isUndefined:q("undefined"),isFunction:q("function"),isNumber:q("number")},F=function(n){return n.slice(0).sort()},j=function(n,t){throw new Error("All required keys ("+F(n).join(", ")+") were not specified. Specified keys were: "+F(t).join(", ")+".")},H=function(n){throw new Error("Unsupported keys for object: "+F(n).join(", "))},V=function(n,t){if(!z.isArray(t))throw new Error("The "+n+" fields must be an array. Was: "+t+".");B.each(t,function(t){if(!z.isString(t))throw new Error("The value "+t+" in the "+n+" fields was not a string.")})},U=function(n,t){throw new Error("All values need to be of type: "+t+". Keys ("+F(n).join(", ")+") were not.")},G=function(n){var t=F(n);B.find(t,function(n,e){return e<t.length-1&&n===t[e+1]}).each(function(n){throw new Error("The field: "+n+" occurs more than once in the combined fields: ["+t.join(", ")+"].")})},X={immutable:function(){var n=arguments;return function(){for(var t=new Array(arguments.length),e=0;e<t.length;e++)t[e]=arguments[e];if(n.length!==t.length)throw new Error('Wrong number of arguments to struct. Expected "['+n.length+']", got '+t.length+" arguments");var r={};return B.each(n,function(n,e){r[n]=m.constant(t[e])}),r}},immutableBag:function(n,t){var e=n.concat(t);if(0===e.length)throw new Error("You must specify at least one required or optional field.");return V("required",n),V("optional",t),G(e),function(r){var o=L.keys(r);B.forall(n,function(n){return B.contains(o,n)})||j(n,o);var i=B.filter(o,function(n){return!B.contains(e,n)});i.length>0&&H(i);var u={};return B.each(n,function(n){u[n]=m.constant(r[n])}),B.each(t,function(n){u[n]=m.constant(Object.prototype.hasOwnProperty.call(r,n)?w.some(r[n]):w.none())}),u}}},Y=X.immutable("width","height"),$=X.immutable("rows","columns"),K=X.immutable("row","column"),J=X.immutable("x","y"),Q=X.immutable("element","rowspan","colspan"),Z=X.immutable("element","rowspan","colspan","isNew"),nn={dimensions:Y,grid:$,address:K,coords:J,extended:X.immutable("element","rowspan","colspan","row","column"),detail:Q,detailnew:Z,rowdata:X.immutable("element","cells","section"),elementnew:X.immutable("element","isNew"),rowdatanew:X.immutable("element","cells","section","isNew"),rowcells:X.immutable("cells","section"),rowdetails:X.immutable("details","section"),bounds:X.immutable("startRow","startCol","finishRow","finishCol")},tn=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:m.constant(n)}},en={fromHtml:function(n,t){var e=(t||document).createElement("div");if(e.innerHTML=n,!e.hasChildNodes()||e.childNodes.length>1)throw console.error("HTML does not have a single root node",n),"HTML must have a single root node";return tn(e.childNodes[0])},fromTag:function(n,t){var e=(t||document).createElement(n);return tn(e)},fromText:function(n,t){var e=(t||document).createTextNode(n);return tn(e)},fromDom:tn,fromPoint:function(n,t,e){return w.from(n.dom().elementFromPoint(t,e)).map(tn)}},rn=8,on=9,un=1,an=3,cn=un,ln=on,sn=function(n){return n.nodeType!==cn&&n.nodeType!==ln||0===n.childElementCount},fn={all:function(n,t){var e=t===undefined?document:t.dom();return sn(e)?[]:B.map(e.querySelectorAll(n),en.fromDom)},is:function(n,t){var e=n.dom();if(e.nodeType!==cn)return!1;if(e.matches!==undefined)return e.matches(t);if(e.msMatchesSelector!==undefined)return e.msMatchesSelector(t);if(e.webkitMatchesSelector!==undefined)return e.webkitMatchesSelector(t);if(e.mozMatchesSelector!==undefined)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},one:function(n,t){var e=t===undefined?document:t.dom();return sn(e)?w.none():w.from(e.querySelector(n)).map(en.fromDom)}},dn=function(n,t){var e=[],r=function(n){return e.push(n),t(n)},o=t(n);do{o=o.bind(r)}while(o.isSome());return e},mn="undefined"!=typeof window?window:Function("return this;")(),gn=function(n,t){for(var e=t!==undefined&&null!==t?t:mn,r=0;r<n.length&&e!==undefined&&null!==e;++r)e=e[n[r]];return e},pn=function(n,t){var e=n.split(".");return gn(e,t)},hn=function(n,t){var e=pn(n,t);if(e===undefined||null===e)throw n+" not available on this browser";return e},vn=function(){return hn("Node")},bn=function(n,t,e){return 0!=(n.compareDocumentPosition(t)&e)},wn=function(n,t){return bn(n,t,vn().DOCUMENT_POSITION_CONTAINED_BY)},yn=function(n){var t,e=!1;return function(){return e||(e=!0,t=n.apply(null,arguments)),t}},xn=function(n,t){var e=function(n,t){for(var e=0;e<n.length;e++){var r=n[e];if(r.test(t))return r}return undefined}(n,t);if(!e)return{major:0,minor:0};var r=function(n){return Number(t.replace(e,"$"+n))};return Sn(r(1),r(2))},Cn=function(){return Sn(0,0)},Sn=function(n,t){return{major:n,minor:t}},Rn={nu:Sn,detect:function(n,t){var e=String(t).toLowerCase();return 0===n.length?Cn():xn(n,e)},unknown:Cn},Tn="Firefox",Dn=function(n,t){return function(){return t===n}},An=function(n){var t=n.current;return{current:t,version:n.version,isEdge:Dn("Edge",t),isChrome:Dn("Chrome",t),isIE:Dn("IE",t),isOpera:Dn("Opera",t),isFirefox:Dn(Tn,t),isSafari:Dn("Safari",t)}},kn={unknown:function(){return An({current:undefined,version:Rn.unknown()})},nu:An,edge:m.constant("Edge"),chrome:m.constant("Chrome"),ie:m.constant("IE"),opera:m.constant("Opera"),firefox:m.constant(Tn),safari:m.constant("Safari")},Nn="Windows",On="Android",En="Solaris",Bn="FreeBSD",In=function(n,t){return function(){return t===n}},Pn=function(n){var t=n.current;return{current:t,version:n.version,isWindows:In(Nn,t),isiOS:In("iOS",t),isAndroid:In(On,t),isOSX:In("OSX",t),isLinux:In("Linux",t),isSolaris:In(En,t),isFreeBSD:In(Bn,t)}},Wn={unknown:function(){return Pn({current:undefined,version:Rn.unknown()})},nu:Pn,windows:m.constant(Nn),ios:m.constant("iOS"),android:m.constant(On),linux:m.constant("Linux"),osx:m.constant("OSX"),solaris:m.constant(En),freebsd:m.constant(Bn)},_n=function(n,t){var e=String(t).toLowerCase();return B.find(n,function(n){return n.search(e)})},Mn=function(n,t){return _n(n,t).map(function(n){var e=Rn.detect(n.versionRegexes,t);return{current:n.name,version:e}})},Ln=function(n,t){return _n(n,t).map(function(n){var e=Rn.detect(n.versionRegexes,t);return{current:n.name,version:e}})},qn=function(n,t){return t+n},zn=function(n,t){return n+t},Fn=function(n,t){return n.substring(t)},jn=function(n,t){return n.substring(0,n.length-t)},Hn=function(n){return""===n?w.none():w.some(n.substr(0,1))},Vn=function(n){return""===n?w.none():w.some(n.substring(1))},Un=function(n,t,e){return""===t||!(n.length<t.length)&&n.substr(e,e+t.length)===t},Gn=function(n,t){return Un(n,t,0)},Xn=function(n,t){return Un(n,t,n.length-t.length)},Yn={supplant:function(n,t){return n.replace(/\${([^{}]*)}/g,function(n,e){var r,o=t[e];return"string"==(r=typeof o)||"number"===r?o:n})},startsWith:Gn,removeLeading:function(n,t){return Gn(n,t)?Fn(n,t.length):n},removeTrailing:function(n,t){return Xn(n,t)?jn(n,t.length):n},ensureLeading:function(n,t){return Gn(n,t)?n:qn(n,t)},ensureTrailing:function(n,t){return Xn(n,t)?n:zn(n,t)},endsWith:Xn,contains:function(n,t){return-1!==n.indexOf(t)},trim:function(n){return n.replace(/^\s+|\s+$/g,"")},lTrim:function(n){return n.replace(/^\s+/g,"")},rTrim:function(n){return n.replace(/\s+$/g,"")},capitalize:function(n){return Hn(n).bind(function(t){return Vn(n).map(function(n){return t.toUpperCase()+n})}).getOr(n)}},$n=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Kn=function(n){return function(t){return Yn.contains(t,n)}},Jn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(n){return Yn.contains(n,"edge/")&&Yn.contains(n,"chrome")&&Yn.contains(n,"safari")&&Yn.contains(n,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,$n],search:function(n){return Yn.contains(n,"chrome")&&!Yn.contains(n,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(n){return Yn.contains(n,"msie")||Yn.contains(n,"trident")}},{name:"Opera",versionRegexes:[$n,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Kn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Kn("firefox")},{name:"Safari",versionRegexes:[$n,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(n){return(Yn.contains(n,"safari")||Yn.contains(n,"mobile/"))&&Yn.contains(n,"applewebkit")}}],Qn=[{name:"Windows",search:Kn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(n){return Yn.contains(n,"iphone")||Yn.contains(n,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Kn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Kn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Kn("linux"),versionRegexes:[]},{name:"Solaris",search:Kn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Kn("freebsd"),versionRegexes:[]}],Zn={browsers:m.constant(Jn),oses:m.constant(Qn)},nt=function(n){var t,e,r,o,i,u,a,c,l,s,f,d=Zn.browsers(),g=Zn.oses(),p=Mn(d,n).fold(kn.unknown,kn.nu),h=Ln(g,n).fold(Wn.unknown,Wn.nu);return{browser:p,os:h,deviceType:(e=p,r=n,o=(t=h).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,c=o||u||a&&!0===/mobile/i.test(r),l=t.isiOS()||t.isAndroid(),s=l&&!c,f=e.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:m.constant(o),isiPhone:m.constant(i),isTablet:m.constant(c),isPhone:m.constant(s),isTouch:m.constant(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:m.constant(f)})}},tt={detect:yn(function(){var n=navigator.userAgent;return nt(n)})},et=function(n,t){return n.dom()===t.dom()},rt=tt.detect().browser.isIE()?function(n,t){return wn(n.dom(),t.dom())}:function(n,t){var e=n.dom(),r=t.dom();return e!==r&&e.contains(r)},ot={eq:et,isEqualNode:function(n,t){return n.dom().isEqualNode(t.dom())},member:function(n,t){return B.exists(t,m.curry(et,n))},contains:rt,is:fn.is},it=function(n){return en.fromDom(n.dom().ownerDocument)},ut=function(n){var t=n.dom();return w.from(t.parentNode).map(en.fromDom)},at=function(n){var t=n.dom();return w.from(t.previousSibling).map(en.fromDom)},ct=function(n){var t=n.dom();return w.from(t.nextSibling).map(en.fromDom)},lt=function(n){var t=n.dom();return B.map(t.childNodes,en.fromDom)},st=function(n,t){var e=n.dom().childNodes;return w.from(e[t]).map(en.fromDom)},ft=X.immutable("element","offset"),dt={owner:it,defaultView:function(n){var t=n.dom().ownerDocument.defaultView;return en.fromDom(t)},documentElement:function(n){var t=it(n);return en.fromDom(t.dom().documentElement)},parent:ut,findIndex:function(n){return ut(n).bind(function(t){var e=lt(t);return B.findIndex(e,function(t){return ot.eq(n,t)})})},parents:function(n,t){for(var e=z.isFunction(t)?t:m.constant(!1),r=n.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=en.fromDom(i);if(o.push(u),!0===e(u))break;r=i}return o},siblings:function(n){return ut(n).map(lt).map(function(t){return B.filter(t,function(t){return!ot.eq(n,t)})}).getOr([])},prevSibling:at,offsetParent:function(n){var t=n.dom();return w.from(t.offsetParent).map(en.fromDom)},prevSiblings:function(n){return B.reverse(dn(n,at))},nextSibling:ct,nextSiblings:function(n){return dn(n,ct)},children:lt,child:st,firstChild:function(n){return st(n,0)},lastChild:function(n){return st(n,n.dom().childNodes.length-1)},childNodesCount:function(n){return n.dom().childNodes.length},hasChildNodes:function(n){return n.dom().hasChildNodes()},leaf:function(n,t){var e=lt(n);return e.length>0&&t<e.length?ft(e[t],0):ft(n,t)}},mt=function(n,t,e){return B.bind(dt.children(n),function(n){return fn.is(n,t)?e(n)?[n]:[]:mt(n,t,e)})},gt={firstLayer:function(n,t){return mt(n,t,m.constant(!0))},filterFirstLayer:mt},pt=function(n){return n.dom().nodeName.toLowerCase()},ht=function(n){return n.dom().nodeType},vt=function(n){return function(t){return ht(t)===n}},bt=vt(un),wt=vt(an),yt=vt(on),xt={name:pt,type:ht,value:function(n){return n.dom().nodeValue},isElement:bt,isText:wt,isDocument:yt,isComment:function(n){return ht(n)===rn||"#comment"===pt(n)}},Ct=function(n,t,e){if(!(z.isString(e)||z.isBoolean(e)||z.isNumber(e)))throw console.error("Invalid call to Attr.set. Key ",t,":: Value ",e,":: Element ",n),new Error("Attribute value was not simple");n.setAttribute(t,e+"")},St=function(n,t,e){Ct(n.dom(),t,e)},Rt=function(n,t){var e=n.dom().getAttribute(t);return null===e?undefined:e},Tt=function(n,t){var e=n.dom();return!(!e||!e.hasAttribute)&&e.hasAttribute(t)},Dt={clone:function(n){return B.foldl(n.dom().attributes,function(n,t){return n[t.name]=t.value,n},{})},set:St,setAll:function(n,t){var e=n.dom();L.each(t,function(n,t){Ct(e,t,n)})},get:Rt,has:Tt,remove:function(n,t){n.dom().removeAttribute(t)},hasNone:function(n){var t=n.dom().attributes;return t===undefined||null===t||0===t.length},transfer:function(n,t,e){xt.isElement(n)&&xt.isElement(t)&&B.each(e,function(e){var r,o,i;o=t,Tt(r=n,i=e)&&!Tt(o,i)&&St(o,i,Rt(r,i))})}},At=yn(function(){return kt(en.fromDom(document))}),kt=function(n){var t=n.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return en.fromDom(t)},Nt={body:At,getBody:kt,inBody:function(n){var t=xt.isText(n)?n.dom().parentNode:n.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}},Ot=function(n,t){var e=[];return B.each(dt.children(n),function(n){t(n)&&(e=e.concat([n])),e=e.concat(Ot(n,t))}),e},Et={all:function(n){return Ot(Nt.body(),n)},ancestors:function(n,t,e){return B.filter(dt.parents(n,e),t)},siblings:function(n,t){return B.filter(dt.siblings(n),t)},children:function(n,t){return B.filter(dt.children(n),t)},descendants:Ot},Bt={all:function(n){return fn.all(n)},ancestors:function(n,t,e){return Et.ancestors(n,function(n){return fn.is(n,t)},e)},siblings:function(n,t){return Et.siblings(n,function(n){return fn.is(n,t)})},children:function(n,t){return Et.children(n,function(n){return fn.is(n,t)})},descendants:function(n,t){return fn.all(t,n)}},It=function(n,t,e,r,o){return n(e,r)?w.some(e):z.isFunction(o)&&o(e)?w.none():t(e,r,o)},Pt=function(n,t,e){for(var r=n.dom(),o=z.isFunction(e)?e:m.constant(!1);r.parentNode;){r=r.parentNode;var i=en.fromDom(r);if(t(i))return w.some(i);if(o(i))break}return w.none()},Wt=function(n,t){return B.find(n.dom().childNodes,m.compose(t,en.fromDom)).map(en.fromDom)},_t=function(n,t){var e=function(n){for(var r=0;r<n.childNodes.length;r++){if(t(en.fromDom(n.childNodes[r])))return w.some(en.fromDom(n.childNodes[r]));var o=e(n.childNodes[r]);if(o.isSome())return o}return w.none()};return e(n.dom())},Mt={first:function(n){return _t(Nt.body(),n)},ancestor:Pt,closest:function(n,t,e){return It(function(n){return t(n)},Pt,n,t,e)},sibling:function(n,t){var e=n.dom();return e.parentNode?Wt(en.fromDom(e.parentNode),function(e){return!ot.eq(n,e)&&t(e)}):w.none()},child:Wt,descendant:_t},Lt=function(n,t,e){return Mt.ancestor(n,function(n){return fn.is(n,t)},e)},qt={first:function(n){return fn.one(n)},ancestor:Lt,sibling:function(n,t){return Mt.sibling(n,function(n){return fn.is(n,t)})},child:function(n,t){return Mt.child(n,function(n){return fn.is(n,t)})},descendant:function(n,t){return fn.one(t,n)},closest:function(n,t,e){return It(fn.is,Lt,n,t,e)}},zt=function(n,t,e){var r=e!==undefined?e:m.constant(!1);return r(t)?w.none():B.contains(n,xt.name(t))?w.some(t):qt.ancestor(t,n.join(","),function(n){return fn.is(n,"table")||r(n)})},Ft=function(n,t){return dt.parent(t).map(function(t){return Bt.children(t,n)})},jt=function(n,t){return zt(["td","th"],n,t)},Ht=function(n){return gt.firstLayer(n,"th,td")},Vt=(m.curry(Ft,"th,td"),function(n,t){return qt.closest(n,"table",t)}),Ut=function(n){return gt.firstLayer(n,"tr")},Gt=(m.curry(Ft,"tr"),function(n){var t=Ut(n);return B.map(t,function(n){var t=n,e=dt.parent(t).bind(function(n){var t=xt.name(n);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}),r=B.map(Ht(n),function(n){var t=Dt.has(n,"rowspan")?parseInt(Dt.get(n,"rowspan"),10):1,e=Dt.has(n,"colspan")?parseInt(Dt.get(n,"colspan"),10):1;return nn.detail(n,t,e)});return nn.rowdata(t,r,e)})}),Xt=function(n,t){return B.map(n,function(n){var e=B.map(Ht(n),function(n){var t=Dt.has(n,"rowspan")?parseInt(Dt.get(n,"rowspan"),10):1,e=Dt.has(n,"colspan")?parseInt(Dt.get(n,"colspan"),10):1;return nn.detail(n,t,e)});return nn.rowdata(n,e,t.section())})},Yt=function(n,t){return n+","+t},$t=function(n,t){var e=B.bind(n.all(),function(n){return n.cells()});return B.filter(e,t)},Kt={generate:function(n){var t={},e=[],r=n.length,o=0;B.each(n,function(n,r){var i=[];B.each(n.cells(),function(n,e){for(var u=0;t[Yt(r,u)]!==undefined;)u++;for(var a=nn.extended(n.element(),n.rowspan(),n.colspan(),r,u),c=0;c<n.colspan();c++)for(var l=0;l<n.rowspan();l++){var s=u+c,f=Yt(r+l,s);t[f]=a,o=Math.max(o,s+1)}i.push(a)}),e.push(nn.rowdata(n.element(),i,n.section()))});var i=nn.grid(r,o);return{grid:m.constant(i),access:m.constant(t),all:m.constant(e)}},getAt:function(n,t,e){var r=n.access()[Yt(t,e)];return r!==undefined?w.some(r):w.none()},findItem:function(n,t,e){var r=$t(n,function(n){return e(t,n.element())});return r.length>0?w.some(r[0]):w.none()},filterItems:$t,justCells:function(n){var t=B.map(n.all(),function(n){return n.cells()});return B.flatten(t)}},Jt=function(n){return n.style!==undefined},Qt=function(n,t,e){if(!z.isString(e))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",e,":: Element ",n),new Error("CSS value must be a string: "+e);Jt(n)&&n.style.setProperty(t,e)},Zt=function(n,t){Jt(n)&&n.style.removeProperty(t)},ne=function(n,t,e){var r=n.dom();Qt(r,t,e)},te=function(n,t){return Jt(n)?n.style.getPropertyValue(t):""},ee=function(n,t){var e=n.dom(),r=te(e,t);return w.from(r).filter(function(n){return n.length>0})},re={copy:function(n,t){var e=n.dom(),r=t.dom();Jt(e)&&Jt(r)&&(r.style.cssText=e.style.cssText)},set:ne,preserve:function(n,t){var e=Dt.get(n,"style"),r=t(n);return(e===undefined?Dt.remove:Dt.set)(n,"style",e),r},setAll:function(n,t){var e=n.dom();L.each(t,function(n,t){Qt(e,t,n)})},setOptions:function(n,t){var e=n.dom();L.each(t,function(n,t){n.fold(function(){Zt(e,t)},function(n){Qt(e,t,n)})})},remove:function(n,t){var e=n.dom();Zt(e,t),Dt.has(n,"style")&&""===Yn.trim(Dt.get(n,"style"))&&Dt.remove(n,"style")},get:function(n,t){var e=n.dom(),r=window.getComputedStyle(e).getPropertyValue(t),o=""!==r||Nt.inBody(n)?r:te(e,t);return null===o?undefined:o},getRaw:ee,getAllRaw:function(n){var t={},e=n.dom();if(Jt(e))for(var r=0;r<e.style.length;r++){var o=e.style.item(r);t[o]=e.style[o]}return t},isValidValue:function(n,t,e){var r=en.fromTag(n);return ne(r,t,e),ee(r,t).isSome()},reflow:function(n){return n.dom().offsetWidth},transfer:function(n,t,e){xt.isElement(n)&&xt.isElement(t)&&B.each(e,function(e){var r,o;r=t,ee(n,o=e).each(function(n){ee(r,o).isNone()&&ne(r,o,n)})})}},oe=function(n,t){dt.parent(n).each(function(e){e.dom().insertBefore(t.dom(),n.dom())})},ie=function(n,t){n.dom().appendChild(t.dom())},ue={before:oe,after:function(n,t){dt.nextSibling(n).fold(function(){dt.parent(n).each(function(n){ie(n,t)})},function(n){oe(n,t)})},prepend:function(n,t){dt.firstChild(n).fold(function(){ie(n,t)},function(e){n.dom().insertBefore(t.dom(),e.dom())})},append:ie,appendAt:function(n,t,e){dt.child(n,e).fold(function(){ie(n,t)},function(n){oe(n,t)})},wrap:function(n,t){oe(n,t),ie(t,n)}},ae={before:function(n,t){B.each(t,function(t){ue.before(n,t)})},after:function(n,t){B.each(t,function(e,r){var o=0===r?n:t[r-1];ue.after(o,e)})},prepend:function(n,t){B.each(t.slice().reverse(),function(t){ue.prepend(n,t)})},append:function(n,t){B.each(t,function(t){ue.append(n,t)})}},ce=function(n){var t=n.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},le={empty:function(n){n.dom().textContent="",B.each(dt.children(n),function(n){ce(n)})},remove:ce,unwrap:function(n){var t=dt.children(n);t.length>0&&ae.before(n,t),ce(n)}},se=X.immutable("minRow","minCol","maxRow","maxCol"),fe=function(n,t){var e,r,o,i,u,a,c,l,s,f,d=function(n){return fn.is(n.element(),t)},m=Gt(n),g=Kt.generate(m),p=(r=d,o=(e=g).grid().columns(),i=e.grid().rows(),u=o,a=0,c=0,L.each(e.access(),function(n){if(r(n)){var t=n.row(),e=t+n.rowspan()-1,o=n.column(),l=o+n.colspan()-1;t<i?i=t:e>a&&(a=e),o<u?u=o:l>c&&(c=l)}}),se(i,u,a,c)),h="th:not("+t+"),td:not("+t+")",v=gt.filterFirstLayer(n,"th,td",function(n){return fn.is(n,h)});return B.each(v,le.remove),function(n,t,e,r){for(var o,i,u,a=t.grid().columns(),c=t.grid().rows(),l=0;l<c;l++)for(var s=!1,f=0;f<a;f++)l<e.minRow()||l>e.maxRow()||f<e.minCol()||f>e.maxCol()||(Kt.getAt(t,l,f).filter(r).isNone()?(o=s,i=n[l].element(),u=en.fromTag("td"),ue.append(u,en.fromTag("br")),(o?ue.append:ue.prepend)(i,u)):s=!0)}(m,g,p,d),l=n,s=p,f=B.filter(gt.firstLayer(l,"tr"),function(n){return 0===n.dom().childElementCount}),B.each(f,le.remove),s.minCol()!==s.maxCol()&&s.minRow()!==s.maxRow()||B.each(gt.firstLayer(l,"th,td"),function(n){Dt.remove(n,"rowspan"),Dt.remove(n,"colspan")}),Dt.remove(l,"width"),Dt.remove(l,"height"),re.remove(l,"width"),re.remove(l,"height"),n},de=function(n,t){return en.fromDom(n.dom().cloneNode(t))},me=function(n){return de(n,!0)},ge=function(n,t){var e=en.fromTag(t),r=Dt.clone(n);return Dt.setAll(e,r),e},pe=function(n){return de(n,!1)},he=me,ve=function(n,t){var e=ge(n,t),r=dt.children(me(n));return ae.append(e,r),e},be=(u=xt.isText,a="text",c=function(n){return u(n)?w.from(n.dom().nodeValue):w.none()},l=tt.detect().browser,{get:function(n){if(!u(n))throw new Error("Can only get "+a+" value of a "+a+" node");return s(n).getOr("")},getOption:s=l.isIE()&&10===l.version.major?function(n){try{return c(n)}catch(t){return w.none()}}:c,set:function(n,t){if(!u(n))throw new Error("Can only set raw "+a+" value of a "+a+" node");n.dom().nodeValue=t}}),we={get:function(n){return be.get(n)},getOption:function(n){return be.getOption(n)},set:function(n,t){be.set(n,t)}},ye=function(n){return"img"===xt.name(n)?1:we.getOption(n).fold(function(){return dt.children(n).length},function(n){return n.length})},xe=["img","br"],Ce=ye,Se=function(n){return we.getOption(n).filter(function(n){return 0!==n.trim().length||n.indexOf("\xa0")>-1}).isSome()||B.contains(xe,xt.name(n))},Re=function(n,t){var e=function(n){for(var r=dt.children(n),o=r.length-1;o>=0;o--){var i=r[o];if(t(i))return w.some(i);var u=e(i);if(u.isSome())return u}return w.none()};return e(n)},Te={first:function(n){return Mt.descendant(n,Se)},last:function(n){return Re(n,Se)}},De=function(){var n=en.fromTag("td");return ue.append(n,en.fromTag("br")),n},Ae=function(n,t,e){var r=ve(n,t);return L.each(e,function(n,t){null===n?Dt.remove(r,t):Dt.set(r,t,n)}),r},ke=function(n){return n},Ne=function(n){return function(){return en.fromTag("tr",n.dom())}},Oe=function(n,t,e){return{row:Ne(t),cell:function(t){var r,o,i,u=dt.owner(t.element()),a=en.fromTag(xt.name(t.element()),u.dom()),c=e.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),l=c.length>0?(r=t.element(),o=a,i=c,Te.first(r).map(function(n){var t=i.join(","),e=Bt.ancestors(n,t,function(n){return ot.eq(n,r)});return B.foldr(e,function(n,t){var e=pe(t);return ue.append(n,e),e},o)}).getOr(o)):a;return ue.append(l,en.fromTag("br")),re.copy(t.element(),a),re.remove(a,"height"),1!==t.colspan()&&re.remove(t.element(),"width"),n(t.element(),a),a},replace:Ae,gap:De}},Ee=function(n){return{row:Ne(n),cell:De,replace:ke,gap:De}},Be=function(n,t){var e=(t||document).createElement("div");return e.innerHTML=n,dt.children(en.fromDom(e))},Ie=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Pe=function(){return{up:m.constant({selector:qt.ancestor,closest:qt.closest,predicate:Mt.ancestor,all:dt.parents}),down:m.constant({selector:Bt.descendants,predicate:Et.descendants}),styles:m.constant({get:re.get,getRaw:re.getRaw,set:re.set,remove:re.remove}),attrs:m.constant({get:Dt.get,set:Dt.set,remove:Dt.remove,copyTo:function(n,t){var e=Dt.clone(n);Dt.setAll(t,e)}}),insert:m.constant({before:ue.before,after:ue.after,afterAll:ae.after,append:ue.append,appendAll:ae.append,prepend:ue.prepend,wrap:ue.wrap}),remove:m.constant({unwrap:le.unwrap,remove:le.remove}),create:m.constant({nu:en.fromTag,clone:function(n){return en.fromDom(n.dom().cloneNode(!1))},text:en.fromText}),query:m.constant({comparePosition:function(n,t){return n.dom().compareDocumentPosition(t.dom())},prevSibling:dt.prevSibling,nextSibling:dt.nextSibling}),property:m.constant({children:dt.children,name:xt.name,parent:dt.parent,isText:xt.isText,isComment:xt.isComment,isElement:xt.isElement,getText:we.get,setText:we.set,isBoundary:function(n){return!!xt.isElement(n)&&("body"===xt.name(n)||B.contains(Ie,xt.name(n)))},isEmptyTag:function(n){return!!xt.isElement(n)&&B.contains(["br","img","hr","input"],xt.name(n))}}),eq:ot.eq,is:ot.is}},We=(X.immutable("left","right"),function(n,t,e,r){var o=t(n,e);return B.foldr(r,function(e,r){var o=t(n,r);return _e(n,e,o)},o)}),_e=function(n,t,e){return t.bind(function(t){return e.filter(m.curry(n.eq,t))})},Me=function(n,t,e){return e.length>0?We(n,t,(r=e)[0],r.slice(1)):w.none();var r},Le=function(n,t){return m.curry(n.eq,t)},qe=function(n,t,e,r){var o=r!==undefined?r:m.constant(!1),i=[t].concat(n.up().all(t)),u=[e].concat(n.up().all(e)),a=function(n){return B.findIndex(n,o).fold(function(){return n},function(t){return n.slice(0,t+1)})},c=a(i),l=a(u),s=B.find(c,function(t){return B.exists(l,Le(n,t))});return{firstpath:m.constant(c),secondpath:m.constant(l),shared:m.constant(s)}},ze=qe,Fe=function(n,t,e){return Me(n,t,e)},je=function(n,t,e,r){return ze(n,t,e,r)},He=Pe(),Ve=function(n,t){return Fe(He,function(t,e){return n(e)},t)},Ue=function(n,t,e){return je(He,n,t,e)},Ge=function(n,t){return t.column()>=n.startCol()&&t.column()+t.colspan()-1<=n.finishCol()&&t.row()>=n.startRow()&&t.row()+t.rowspan()-1<=n.finishRow()},Xe=function(n,t){var e=t.column(),r=t.column()+t.colspan()-1,o=t.row(),i=t.row()+t.rowspan()-1;return e<=n.finishCol()&&r>=n.startCol()&&o<=n.finishRow()&&i>=n.startRow()},Ye=function(n,t){for(var e=!0,r=m.curry(Ge,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)e=e&&Kt.getAt(n,o,i).exists(r);return e?w.some(t):w.none()},$e=function(n,t,e){var r=Kt.findItem(n,t,ot.eq),o=Kt.findItem(n,e,ot.eq);return r.bind(function(n){return o.map(function(t){return e=n,r=t,nn.bounds(Math.min(e.row(),r.row()),Math.min(e.column(),r.column()),Math.max(e.row()+e.rowspan()-1,r.row()+r.rowspan()-1),Math.max(e.column()+e.colspan()-1,r.column()+r.colspan()-1));var e,r})})},Ke=$e,Je=function(n,t,e){return $e(n,t,e).bind(function(t){return Ye(n,t)})},Qe=function(n,t,e,r){return Kt.findItem(n,t,ot.eq).bind(function(t){var o=e>0?t.row()+t.rowspan()-1:t.row(),i=r>0?t.column()+t.colspan()-1:t.column();return Kt.getAt(n,o+e,i+r).map(function(n){return n.element()})})},Ze=function(n,t,e){return Ke(n,t,e).map(function(t){var e=Kt.filterItems(n,m.curry(Xe,t));return B.map(e,function(n){return n.element()})})},nr=function(n,t){return Kt.findItem(n,t,function(n,t){return ot.contains(t,n)}).bind(function(n){return n.element()})},tr=function(n){var t=Gt(n);return Kt.generate(t)},er=function(n,t,e){return Vt(n).bind(function(r){var o=tr(r);return Qe(o,n,t,e)})},rr=function(n,t,e){var r=tr(n);return Ze(r,t,e)},or=function(n,t,e,r,o){var i=tr(n),u=ot.eq(n,e)?t:nr(i,t),a=ot.eq(n,o)?r:nr(i,r);return Ze(i,u,a)},ir=function(n,t,e){var r=tr(n);return Je(r,t,e)},ur=function(n,t){return qt.ancestor(n,"table")},ar=X.immutableBag(["boxes","start","finish"],[]),cr=function(n,t,e){var r=function(n){return function(t){return e(t)||ot.eq(t,n)}};return ot.eq(n,t)?w.some(ar({boxes:w.some([n]),start:n,finish:t})):ur(n).bind(function(o){return ur(t).bind(function(i){if(ot.eq(o,i))return w.some(ar({boxes:rr(o,n,t),start:n,finish:t}));if(ot.contains(o,i)){var u=(a=Bt.ancestors(t,"td,th",r(o))).length>0?a[a.length-1]:t;return w.some(ar({boxes:or(o,n,o,t,i),start:n,finish:u}))}if(ot.contains(i,o)){var a,c=(a=Bt.ancestors(n,"td,th",r(i))).length>0?a[a.length-1]:n;return w.some(ar({boxes:or(i,n,o,t,i),start:n,finish:c}))}return Ue(n,t).shared().bind(function(u){return qt.closest(u,"table",e).bind(function(e){var u=Bt.ancestors(t,"td,th",r(e)),a=u.length>0?u[u.length-1]:t,c=Bt.ancestors(n,"td,th",r(e)),l=c.length>0?c[c.length-1]:n;return w.some(ar({boxes:or(e,n,o,t,i),start:l,finish:a}))})})})})},lr=cr,sr=function(n,t){var e=Bt.descendants(n,t);return e.length>0?w.some(e):w.none()},fr=function(n,t,e,r,o){return(i=n,u=o,B.find(i,function(n){return fn.is(n,u)})).bind(function(n){return er(n,t,e).bind(function(n){return e=r,qt.ancestor(t=n,"table").bind(function(n){return qt.descendant(n,e).bind(function(n){return cr(n,t).bind(function(n){return n.boxes().map(function(t){return{boxes:m.constant(t),start:m.constant(n.start()),finish:m.constant(n.finish())}})})})});var t,e})});var i,u},dr=function(n,t,e){return qt.descendant(n,t).bind(function(t){return qt.descendant(n,e).bind(function(n){return Ve(ur,[t,n]).map(function(e){return{first:m.constant(t),last:m.constant(n),table:m.constant(e)}})})})},mr=function(n,t){return sr(n,t)},gr=function(n,t,e){return dr(n,t,e).bind(function(t){var e=function(t){return ot.eq(n,t)},r=qt.ancestor(t.first(),"thead,tfoot,tbody,table",e),o=qt.ancestor(t.last(),"thead,tfoot,tbody,table",e);return r.bind(function(n){return o.bind(function(e){return ot.eq(n,e)?ir(t.table(),t.first(),t.last()):w.none()})})})},pr="data-mce-selected",hr="data-mce-first-selected",vr="data-mce-last-selected",br={selected:m.constant(pr),selectedSelector:m.constant("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:m.constant("[data-mce-selected]"),firstSelected:m.constant(hr),firstSelectedSelector:m.constant("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:m.constant(vr),lastSelectedSelector:m.constant("td[data-mce-last-selected],th[data-mce-last-selected]")},wr=function(n){if(!z.isArray(n))throw new Error("cases must be an array");if(0===n.length)throw new Error("there must be at least one case");var t=[],e={};return B.each(n,function(r,o){var i=L.keys(r);if(1!==i.length)throw new Error("one and only one name per case");var u=i[0],a=r[u];if(e[u]!==undefined)throw new Error("duplicate key detected:"+u);if("cata"===u)throw new Error("cannot have a case named cata (sorry)");if(!z.isArray(a))throw new Error("case arguments must be an array");t.push(u),e[u]=function(){var e=arguments.length;if(e!==a.length)throw new Error("Wrong number of arguments to case "+u+". Expected "+a.length+" ("+a+"), got "+e);for(var r=new Array(e),i=0;i<r.length;i++)r[i]=arguments[i];return{fold:function(){if(arguments.length!==n.length)throw new Error("Wrong number of arguments to fold. Expected "+n.length+", got "+arguments.length);return arguments[o].apply(null,r)},match:function(n){var e=L.keys(n);if(t.length!==e.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+e.join(","));if(!B.forall(t,function(n){return B.contains(e,n)}))throw new Error("Not all branches were specified when using match. Specified: "+e.join(", ")+"\nRequired: "+t.join(", "));return n[u].apply(null,r)},log:function(n){console.log(n,{constructors:t,constructor:u,params:r})}}}}),e},yr=wr([{none:[]},{multiple:["elements"]},{single:["selection"]}]),xr={cata:function(n,t,e,r){return n.fold(t,e,r)},none:yr.none,multiple:yr.multiple,single:yr.single},Cr=function(n,t){return xr.cata(t.get(),m.constant([]),m.identity,m.constant([n]))},Sr=function(n,t){return xr.cata(t.get(),w.none,function(t,e){return 0===t.length?w.none():gr(n,br.firstSelectedSelector(),br.lastSelectedSelector()).bind(function(n){return t.length>1?w.some({bounds:m.constant(n),cells:m.constant(t)}):w.none()})},w.none)},Rr=function(n,t){var e=Cr(n,t);return e.length>0&&B.forall(e,function(n){return Dt.has(n,"rowspan")&&parseInt(Dt.get(n,"rowspan"),10)>1||Dt.has(n,"colspan")&&parseInt(Dt.get(n,"colspan"),10)>1})?w.some(e):w.none()},Tr=Cr,Dr=function(n){return{element:m.constant(n),mergable:w.none,unmergable:w.none,selection:m.constant([n])}},Ar=X.immutable("element","clipboard","generators"),kr={noMenu:Dr,forMenu:function(n,t,e){return{element:m.constant(e),mergable:m.constant(Sr(t,n)),unmergable:m.constant(Rr(e,n)),selection:m.constant(Tr(e,n))}},notCell:function(n){return Dr(n)},paste:Ar,pasteRows:function(n,t,e,r,o){return{element:m.constant(e),mergable:w.none,unmergable:w.none,selection:m.constant(Tr(e,n)),clipboard:m.constant(r),generators:m.constant(o)}}},Nr={registerEvents:function(n,t,e,r){n.on("BeforeGetContent",function(e){!0===e.selection&&xr.cata(t.get(),m.noop,function(t){var r;e.preventDefault(),(r=t,Vt(r[0]).map(he).map(function(n){return[fe(n,br.attributeSelector())]})).each(function(t){e.content=B.map(t,function(t){return e=t,n.selection.serializer.serialize(e.dom(),{});var e}).join("")})},m.noop)}),n.on("BeforeSetContent",function(t){!0===t.selection&&!0===t.paste&&w.from(n.dom.getParent(n.selection.getStart(),"th,td")).each(function(o){var i=en.fromDom(o);Vt(i).bind(function(o){var u=B.filter(Be(t.content),function(n){return"meta"!==xt.name(n)});if(1===u.length&&"table"===xt.name(u[0])){t.preventDefault();var a=en.fromDom(n.getDoc()),c=Ee(a),l=kr.paste(i,u[0],c);e.pasteCells(o,l).each(function(t){n.selection.setRng(t),n.focus(),r.clear(o)})}})})})}},Or={render:function(n,t,e,r){var o=en.fromTag("table");re.setAll(o,{"border-collapse":"collapse",width:"100%"}),Dt.set(o,"border","1");var i=en.fromTag("tbody");ue.append(o,i);for(var u=[],a=0;a<n;a++){for(var c=en.fromTag("tr"),l=0;l<t;l++){var s=a<e||l<r?en.fromTag("th"):en.fromTag("td");l<r&&Dt.set(s,"scope","row"),a<e&&Dt.set(s,"scope","col"),ue.append(s,en.fromTag("br")),re.set(s,"width",100/t+"%"),ue.append(c,s)}u.push(c)}return ae.append(i,u),o}},Er=function(n){return n.dom().innerHTML},Br=function(n){var t=en.fromTag("div"),e=en.fromDom(n.dom().cloneNode(!0));return ue.append(t,e),Er(t)},Ir=function(n,t){n.selection.select(t.dom(),!0),n.selection.collapse(!0)},Pr={insert:function(n,t,e){var r,o=Or.render(e,t,0,0);Dt.set(o,"id","__mce");var i,u,a=Br(o);return n.insertContent(a),r=n.dom.get("__mce"),n.dom.setAttrib(r,"id",null),n.$("tr",r).each(function(t,e){n.fire("newrow",{node:e}),n.$("th,td",e).each(function(t,e){n.fire("newcell",{node:e})})}),n.dom.setAttribs(r,n.settings.table_default_attributes||{}),n.dom.setStyles(r,n.settings.table_default_styles||{}),i=n,u=en.fromDom(r),qt.descendant(u,"td,th").each(m.curry(Ir,i)),r}},Wr=function(n,t){var e=function(e){var r=t(e);if(r<=0||null===r){var o=re.get(e,n);return parseFloat(o)||0}return r},r=function(n,t){return B.foldl(t,function(t,e){var r=re.get(n,e),o=r===undefined?0:parseInt(r,10);return isNaN(o)?t:t+o},0)};return{set:function(t,e){if(!z.isNumber(e)&&!e.match(/^[0-9]+$/))throw n+".set accepts only positive integer values. Value was "+e;var r=t.dom();Jt(r)&&(r.style[n]=e+"px")},get:e,getOuter:e,aggregate:r,max:function(n,t,e){var o=r(n,e);return t>o?t-o:0}}},_r=Wr("height",function(n){return Nt.inBody(n)?n.dom().getBoundingClientRect().height:n.dom().offsetHeight}),Mr=function(n){return _r.get(n)},Lr=function(n){return _r.getOuter(n)},qr=Wr("width",function(n){return n.dom().offsetWidth}),zr=function(n){return qr.get(n)},Fr=function(n){return qr.getOuter(n)},jr=tt.detect(),Hr=function(n,t,e){return r=re.get(n,t),o=e,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},Vr=function(n){return jr.browser.isIE()||jr.browser.isEdge()?(e=Hr(t=n,"padding-top",0),r=Hr(t,"padding-bottom",0),o=Hr(t,"border-top-width",0),i=Hr(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===re.get(t,"box-sizing")?u:u-e-r-(o+i)):Hr(n,"height",Mr(n));var t,e,r,o,i,u},Ur=/(\d+(\.\d+)?)(\w|%)*/,Gr=/(\d+(\.\d+)?)%/,Xr=/(\d+(\.\d+)?)px|em/,Yr=function(n,t){re.set(n,"height",t+"px")},$r=function(n,t,e,r){var o,i,u,a,c,l=parseInt(n,10);return Yn.endsWith(n,"%")&&"table"!==xt.name(t)?(i=l,u=e,a=r,c=Vt(o=t).map(function(n){var t=u(n);return Math.floor(i/100*t)}).getOr(i),a(o,c),c):l},Kr=function(n){var t,e=re.getRaw(t=n,"height").getOrThunk(function(){return Vr(t)+"px"});return e?$r(e,n,Mr,Yr):Mr(n)},Jr=function(n,t){return Dt.has(n,t)?parseInt(Dt.get(n,t),10):1},Qr=function(n){return re.getRaw(n,"width").fold(function(){return w.from(Dt.get(n,"width"))},function(n){return w.some(n)})},Zr=function(n,t){return n/t.pixelWidth()*100},no={percentageBasedSizeRegex:m.constant(Gr),pixelBasedSizeRegex:m.constant(Xr),setPixelWidth:function(n,t){re.set(n,"width",t+"px")},setPercentageWidth:function(n,t){re.set(n,"width",t+"%")},setHeight:Yr,getPixelWidth:function(n,t){return Qr(n).fold(function(){var t=zr(n);return parseInt(t,10)},function(e){return function(n,t,e){if(Xr.test(t)){var r=Xr.exec(t);return parseInt(r[1],10)}if(Gr.test(t)){var o=Gr.exec(t),i=parseFloat(o[1]);return i/100*e.pixelWidth()}var u=zr(n);return parseInt(u,10)}(n,e,t)})},getPercentageWidth:function(n,t){return Qr(n).fold(function(){var e=zr(n),r=parseInt(e,10);return Zr(r,t)},function(e){return function(n,t,e){if(Gr.test(t)){var r=Gr.exec(t);return parseFloat(r[1])}var o=zr(n),i=parseInt(o,10);return Zr(i,e)}(n,e,t)})},getGenericWidth:function(n){return Qr(n).bind(function(n){if(Ur.test(n)){var t=Ur.exec(n);return w.some({width:m.constant(t[1]),unit:m.constant(t[3])})}return w.none()})},setGenericWidth:function(n,t,e){re.set(n,"width",t+e)},getHeight:function(n){return e="rowspan",Kr(t=n)/Jr(t,e);var t,e},getRawWidth:Qr},to=function(n,t){no.getGenericWidth(n).each(function(e){var r=e.width()/2;no.setGenericWidth(n,r,e.unit()),no.setGenericWidth(t,r,e.unit())})},eo=function(n,t){var e=t||en.fromDom(document.documentElement);return Mt.ancestor(n,m.curry(ot.eq,e)).isSome()},ro=function(n){var t=n.dom();return t===t.window?n:xt.isDocument(n)?t.defaultView||t.parentWindow:null},oo=function(n,t){return{left:m.constant(n),top:m.constant(t),translate:function(e,r){return oo(n+e,t+r)}}},io=function(n,t){return n!==undefined?n:t!==undefined?t:0},uo=function(n){var t,e=n.dom(),r=e.ownerDocument,o=r.body,i=en.fromDom(r.documentElement);return o===e?oo(o.offsetLeft,o.offsetTop):eo(n,i)?(t=e.getBoundingClientRect(),oo(t.left,t.top)):oo(0,0)},ao=function(n){var t=n.dom().ownerDocument,e=t.body,r=ro(en.fromDom(t)),o=t.documentElement,i=io(r.pageYOffset,o.scrollTop),u=io(r.pageXOffset,o.scrollLeft),a=io(o.clientTop,e.clientTop),c=io(o.clientLeft,e.clientLeft);return uo(n).translate(u-c,i-a)},co=X.immutable("row","y"),lo=X.immutable("col","x"),so=function(n){return ao(n).left()+Fr(n)},fo=function(n){return ao(n).left()},mo=function(n,t){return lo(n,fo(t))},go=function(n,t){return lo(n,so(t))},po=function(n){return ao(n).top()},ho=function(n,t,e){if(0===e.length)return[];var r=B.map(e.slice(1),function(t,e){return t.map(function(t){return n(e,t)})}),o=e[e.length-1].map(function(n){return t(e.length-1,n)});return r.concat([o])},vo={delta:m.identity,positions:m.curry(ho,function(n,t){return co(n,po(t))},function(n,t){return co(n,po(t)+Lr(t))}),edge:po},bo={delta:m.identity,edge:fo,positions:m.curry(ho,mo,go)},wo={height:vo,rtl:{delta:function(n,t){return-n},edge:so,positions:m.curry(ho,go,mo)},ltr:bo},yo={ltr:wo.ltr,rtl:wo.rtl},xo=function(n){var t=function(t){return n(t).isRtl()?yo.rtl:yo.ltr};return{delta:function(n,e){return t(e).delta(n,e)},edge:function(n){return t(n).edge(n)},positions:function(n,e){return t(e).positions(n,e)}}},Co=function(n){var t=Gt(n);return Kt.generate(t).grid()},So=function(n){var t=n,e=function(){return t};return{get:e,set:function(n){t=n},clone:function(){return So(e())}}},Ro=function(n,t){return To(n,t,{validate:z.isFunction,label:"function"})},To=function(n,t,e){if(0===t.length)throw new Error("You must specify at least one required field.");return V("required",t),G(t),function(r){var o=L.keys(r);B.forall(t,function(n){return B.contains(o,n)})||j(t,o),n(t,o);var i=B.filter(t,function(n){return!e.validate(r[n],n)});return i.length>0&&U(i,e.label),r}},Do=m.noop,Ao={exactly:m.curry(Ro,function(n,t){var e=B.filter(t,function(t){return!B.contains(n,t)});e.length>0&&H(e)}),ensure:m.curry(Ro,Do),ensureWith:m.curry(To,Do)},ko=function(n){var t=Dt.has(n,"colspan")?parseInt(Dt.get(n,"colspan"),10):1,e=Dt.has(n,"rowspan")?parseInt(Dt.get(n,"rowspan"),10):1;return{element:m.constant(n),colspan:m.constant(t),rowspan:m.constant(e)}},No=Ao.exactly(["cell","row","replace","gap"]),Oo=function(n,t){No(n);var e=So(w.none()),r=t!==undefined?t:ko,o=function(t){var e,o=r(t);return e=o,n.cell(e)},i=function(n){var t=o(n);return e.get().isNone()&&e.set(w.some(t)),u=w.some({item:n,replacement:t}),t},u=w.none();return{getOrInit:function(n,t){return u.fold(function(){return i(n)},function(e){return t(n,e.item)?e.replacement:i(n)})},cursor:e.get}},Eo=function(n,t){return function(e){var r=So(w.none());No(e);var o=[],i=function(i){var u=e.replace(i,t,{scope:n});return o.push({item:i,sub:u}),r.get().isNone()&&r.set(w.some(u)),u};return{replaceOrInit:function(n,t){return(e=n,r=t,B.find(o,function(n){return r(n.item,e)})).fold(function(){return i(n)},function(e){return t(n,e.item)?e.sub:i(n)});var e,r},cursor:r.get}}},Bo=function(n){No(n);var t=So(w.none());return{combine:function(e){return t.get().isNone()&&t.set(w.some(e)),function(){var t=n.cell({element:m.constant(e),colspan:m.constant(1),rowspan:m.constant(1)});return re.remove(t,"width"),re.remove(e,"width"),t}},cursor:t.get}},Io=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Po=function(n,t){var e=n.property().name(t);return B.contains(Io,e)},Wo=function(n,t){return B.contains(["br","img","hr","input"],n.property().name(t))},_o=Po,Mo=function(n,t){var e=n.property().name(t);return B.contains(["ol","ul"],e)},Lo=Wo,qo=Pe(),zo=function(n){return _o(qo,n)},Fo=function(n){return Mo(qo,n)},jo=function(n){return Lo(qo,n)},Ho=function(n){var t,e=function(n){return"br"===xt.name(n)},r=function(n){return Te.last(n).bind(function(t){var r,o=(r=t,dt.nextSibling(r).map(function(n){return!!zo(n)||(jo(n)?"img"!==xt.name(n):void 0)}).getOr(!1));return dt.parent(t).map(function(r){return!0===o||(i=r,"li"===xt.name(i)||Mt.ancestor(i,Fo).isSome())||e(t)||zo(r)&&!ot.eq(n,r)?[]:[en.fromTag("br")];var i})}).getOr([])},o=0===(t=B.bind(n,function(n){var t,o=dt.children(n);return t=o,B.forall(t,function(n){return e(n)||xt.isText(n)&&0===we.get(n).trim().length})?[]:o.concat(r(n))})).length?[en.fromTag("br")]:t;le.empty(n[0]),ae.append(n[0],o)},Vo=function(n){return function(){for(var t=new Array(arguments.length),e=0;e<t.length;e++)t[e]=arguments[e];if(0===t.length)throw new Error("Can't merge zero objects");for(var r={},o=0;o<t.length;o++){var i=t[o];for(var u in i)i.hasOwnProperty(u)&&(r[u]=n(r[u],i[u]))}return r}},Uo=Vo(function(n,t){return z.isObject(n)&&z.isObject(t)?Uo(n,t):t}),Go=Vo(function(n,t){return t}),Xo={deepMerge:Uo,merge:Go},Yo=function(n){for(var t=[],e=function(n){t.push(n)},r=0;r<n.length;r++)n[r].each(e);return t},$o=function(n,t){for(var e=0;e<n.length;e++){var r=t(n[e],e);if(r.isSome())return r}return w.none()},Ko=function(n,t){return nn.rowcells(t,n.section())},Jo=function(n,t){return n.cells()[t]},Qo={addCell:function(n,t,e){var r=n.cells(),o=r.slice(0,t),i=r.slice(t),u=o.concat([e]).concat(i);return Ko(n,u)},setCells:Ko,mutateCell:function(n,t,e){n.cells()[t]=e},getCell:Jo,getCellElement:function(n,t){return Jo(n,t).element()},mapCells:function(n,t){var e=n.cells(),r=B.map(e,t);return nn.rowcells(r,n.section())},cellLength:function(n){return n.cells().length}},Zo=function(n,t){if(0===n.length)return 0;var e=n[0];return B.findIndex(n,function(n){return!t(e.element(),n.element())}).fold(function(){return n.length},function(n){return n})},ni=function(n,t,e,r){var o,i,u,a,c=(o=n,i=t,o[i]).cells().slice(e),l=Zo(c,r),s=(u=n,a=e,B.map(u,function(n){return Qo.getCell(n,a)})).slice(t),f=Zo(s,r);return{colspan:m.constant(l),rowspan:m.constant(f)}},ti=function(n,t){var e=B.map(n,function(n,t){return B.map(n.cells(),function(n,t){return!1})});return B.map(n,function(r,o){var i=B.bind(r.cells(),function(r,i){if(!1===e[o][i]){var u=ni(n,o,i,t);return function(n,t,r,o){for(var i=n;i<n+r;i++)for(var u=t;u<t+o;u++)e[i][u]=!0}(o,i,u.rowspan(),u.colspan()),[nn.detailnew(r.element(),u.rowspan(),u.colspan(),r.isNew())]}return[]});return nn.rowdetails(i,r.section())})},ei=function(n,t,e){for(var r=[],o=0;o<n.grid().rows();o++){for(var i=[],u=0;u<n.grid().columns();u++){var a=Kt.getAt(n,o,u).map(function(n){return nn.elementnew(n.element(),e)}).getOrThunk(function(){return nn.elementnew(t.gap(),!0)});i.push(a)}var c=nn.rowcells(i,n.all()[o].section());r.push(c)}return r},ri=function(n,t,e,r){e===r?Dt.remove(n,t):Dt.set(n,t,e)},oi=function(n,t){var e=[],r=[],o=function(t,o){t.length>0?function(t,o){var i=qt.child(n,o).getOrThunk(function(){var t=en.fromTag(o,dt.owner(n).dom());return ue.append(n,t),t});le.empty(i);var u=B.map(t,function(n){n.isNew()&&e.push(n.element());var t=n.element();return le.empty(t),B.each(n.cells(),function(n){n.isNew()&&r.push(n.element()),ri(n.element(),"colspan",n.colspan(),1),ri(n.element(),"rowspan",n.rowspan(),1),ue.append(t,n.element())}),t});ae.append(i,u)}(t,o):qt.child(n,o).bind(le.remove)},i=[],u=[],a=[];return B.each(t,function(n){switch(n.section()){case"thead":i.push(n);break;case"tbody":u.push(n);break;case"tfoot":a.push(n)}}),o(i,"thead"),o(u,"tbody"),o(a,"tfoot"),{newRows:m.constant(e),newCells:m.constant(r)}},ii=function(n){return B.map(n,function(n){var t=pe(n.element());return B.each(n.cells(),function(n){var e=he(n.element());ri(e,"colspan",n.colspan(),1),ri(e,"rowspan",n.rowspan(),1),ue.append(t,e)}),t})},ui=function(n,t){for(var e=[],r=0;r<n;r++)e.push(t(r));return e},ai=function(n,t){for(var e=[],r=n;r<t;r++)e.push(r);return e},ci=function(n,t){if(t<0||t>=n.length-1)return w.none();var e=n[t].fold(function(){var e=B.reverse(n.slice(0,t));return $o(e,function(n,t){return n.map(function(n){return{value:n,delta:t+1}})})},function(n){return w.some({value:n,delta:0})}),r=n[t+1].fold(function(){var e=n.slice(t+1);return $o(e,function(n,t){return n.map(function(n){return{value:n,delta:t+1}})})},function(n){return w.some({value:n,delta:1})});return e.bind(function(n){return r.map(function(t){var e=t.delta+n.delta;return Math.abs(t.value-n.value)/e})})},li=function(n,t,e){var r=n();return B.find(r,t).orThunk(function(){return w.from(r[0]).orThunk(e)}).map(function(n){return n.element()})},si=function(n){var t=n.grid(),e=ai(0,t.columns()),r=ai(0,t.rows());return B.map(e,function(t){return li(function(){return B.bind(r,function(e){return Kt.getAt(n,e,t).filter(function(n){return n.column()===t}).fold(m.constant([]),function(n){return[n]})})},function(n){return 1===n.colspan()},function(){return Kt.getAt(n,0,t)})})},fi=function(n){var t=n.grid(),e=ai(0,t.rows()),r=ai(0,t.columns());return B.map(e,function(t){return li(function(){return B.bind(r,function(e){return Kt.getAt(n,t,e).filter(function(n){return n.row()===t}).fold(m.constant([]),function(n){return[n]})})},function(n){return 1===n.rowspan()},function(){return Kt.getAt(n,t,0)})})},di=function(n,t,e,r,o){var i=en.fromTag("div");return re.setAll(i,{position:"absolute",left:t-r/2+"px",top:e+"px",height:o+"px",width:r+"px"}),Dt.setAll(i,{"data-column":n,role:"presentation"}),i},mi=function(n,t,e,r,o){var i=en.fromTag("div");return re.setAll(i,{position:"absolute",left:t+"px",top:e-o/2+"px",height:o+"px",width:r+"px"}),Dt.setAll(i,{"data-row":n,role:"presentation"}),i},gi=function(n){var t=n.replace(/\./g,"-");return{resolve:function(n){return t+"-"+n}}},pi={resolve:gi("ephox-snooker").resolve},hi=function(n,t){var e=Dt.get(n,t);return e===undefined||""===e?[]:e.split(" ")},vi=hi,bi=function(n,t,e){var r=hi(n,t).concat([e]);Dt.set(n,t,r.join(" "))},wi=function(n,t,e){var r=B.filter(hi(n,t),function(n){return n!==e});r.length>0?Dt.set(n,t,r.join(" ")):Dt.remove(n,t)},yi=function(n){return vi(n,"class")},xi=function(n,t){return bi(n,"class",t)},Ci=function(n,t){return wi(n,"class",t)},Si=yi,Ri=xi,Ti=Ci,Di=function(n,t){B.contains(yi(n),t)?Ci(n,t):xi(n,t)},Ai=function(n){return n.dom().classList!==undefined},ki=function(n,t){return Ai(n)&&n.dom().classList.contains(t)},Ni={add:function(n,t){Ai(n)?n.dom().classList.add(t):Ri(n,t)},remove:function(n,t){var e;Ai(n)?n.dom().classList.remove(t):Ti(n,t),0===(Ai(e=n)?e.dom().classList:Si(e)).length&&Dt.remove(e,"class")},toggle:function(n,t){return Ai(n)?n.dom().classList.toggle(t):Di(n,t)},toggler:function(n,t){var e,r,o,i,u,a,c=Ai(n),l=n.dom().classList;return e=function(){c?l.remove(t):Ti(n,t)},r=function(){c?l.add(t):Ri(n,t)},o=ki(n,t),i=o||!1,{on:u=function(){r(),i=!0},off:a=function(){e(),i=!1},toggle:function(){(i?a:u)()},isOn:function(){return i}}},has:ki},Oi=pi.resolve("resizer-bar"),Ei=pi.resolve("resizer-rows"),Bi=pi.resolve("resizer-cols"),Ii=function(n){var t=Bt.descendants(n.parent(),"."+Oi);B.each(t,le.remove)},Pi=function(n,t,e){var r=n.origin();B.each(t,function(t,o){t.each(function(t){var o=e(r,t);Ni.add(o,Oi),ue.append(n.parent(),o)})})},Wi=function(n,t,e,r,o,i){var u,a,c,l,s=ao(t),f=e.length>0?o.positions(e,t):[];u=n,a=f,c=s,l=Fr(t),Pi(u,a,function(n,t){var e=mi(t.row(),c.left()-n.left(),t.y()-n.top(),l,7);return Ni.add(e,Ei),e});var d,m,g,p,h=r.length>0?i.positions(r,t):[];d=n,m=h,g=s,p=Lr(t),Pi(d,m,function(n,t){var e=di(t.col(),t.x()-n.left(),g.top()-n.top(),7,p);return Ni.add(e,Bi),e})},_i=function(n,t){var e=Bt.descendants(n.parent(),"."+Oi);B.each(e,t)},Mi=function(n,t,e,r){Ii(n);var o=Gt(t),i=Kt.generate(o),u=fi(i),a=si(i);Wi(n,t,u,a,e,r)},Li=function(n){_i(n,function(n){re.set(n,"display","none")})},qi=function(n){_i(n,function(n){re.set(n,"display","block")})},zi=Ii,Fi=function(n){return Ni.has(n,Ei)},ji=function(n){return Ni.has(n,Bi)},Hi=function(n,t){return B.map(n,function(n){var e,r=(e=n.details(),$o(e,function(n){return dt.parent(n.element()).map(function(n){var t=dt.parent(n).isNone();return nn.elementnew(n,t)})}).getOrThunk(function(){return nn.elementnew(t.row(),!0)}));return nn.rowdatanew(r.element(),n.details(),n.section(),r.isNew())})},Vi=function(n,t){var e=ti(n,ot.eq);return Hi(e,t)},Ui=function(n,t){var e=B.flatten(B.map(n.all(),function(n){return n.cells()}));return B.find(e,function(n){return ot.eq(t,n.element())})},Gi=function(n,t,e,r,o){return function(i,u,a,c,l){var s=Gt(u),f=Kt.generate(s);return t(f,a).map(function(t){var e=ei(f,c,!1),r=n(e,t,ot.eq,o(c)),i=Vi(r.grid(),c);return{grid:m.constant(i),cursor:r.cursor}}).fold(function(){return w.none()},function(n){var t=oi(u,n.grid());return e(u,n.grid(),l),r(u),Mi(i,u,wo.height,l),w.some({cursor:n.cursor,newRows:t.newRows,newCells:t.newCells})})}},Xi=Vi,Yi=function(n,t){return jt(t.element()).bind(function(t){return Ui(n,t)})},$i=function(n,t){var e=B.map(t.selection(),function(t){return jt(t).bind(function(t){return Ui(n,t)})}),r=Yo(e);return r.length>0?w.some(r):w.none()},Ki=function(n,t){return jt(t.element()).bind(function(e){return Ui(n,e).map(function(n){return Xo.merge(n,{generators:t.generators,clipboard:t.clipboard})})})},Ji=function(n,t){var e=B.map(t.selection(),function(t){return jt(t).bind(function(t){return Ui(n,t)})}),r=Yo(e);return r.length>0?w.some(Xo.merge({cells:r},{generators:t.generators,clipboard:t.clipboard})):w.none()},Qi=function(n,t){return t.mergable()},Zi=function(n,t){return t.unmergable()},nu=function(n){return{is:function(t){return n===t},isValue:m.constant(!0),isError:m.constant(!1),getOr:m.constant(n),getOrThunk:m.constant(n),getOrDie:m.constant(n),or:function(t){return nu(n)},orThunk:function(t){return nu(n)},fold:function(t,e){return e(n)},map:function(t){return nu(t(n))},each:function(t){t(n)},bind:function(t){return t(n)},exists:function(t){return t(n)},forall:function(t){return t(n)},toOption:function(){return w.some(n)}}},tu=function(n){return{is:m.constant(!1),isValue:m.constant(!1),isError:m.constant(!0),getOr:m.identity,getOrThunk:function(n){return n()},getOrDie:function(){return m.die(n)()},or:function(n){return n},orThunk:function(n){return n()},fold:function(t,e){return t(n)},map:function(t){return tu(n)},each:m.noop,bind:function(t){return tu(n)},exists:m.constant(!1),forall:m.constant(!0),toOption:w.none}},eu={value:nu,error:tu},ru=function(n,t){return B.map(n,function(){return nn.elementnew(t.cell(),!0)})},ou=function(n,t,e){return n.concat(ui(t,function(t){return Qo.setCells(n[n.length-1],ru(n[n.length-1].cells(),e))}))},iu=function(n,t,e){return B.map(n,function(n){return Qo.setCells(n,n.cells().concat(ru(ai(0,t),e)))})},uu=function(n,t,e){if(n.row()>=t.length||n.column()>Qo.cellLength(t[0]))return eu.error("invalid start address out of table bounds, row: "+n.row()+", column: "+n.column());var r=t.slice(n.row()),o=r[0].cells().slice(n.column()),i=Qo.cellLength(e[0]),u=e.length;return eu.value({rowDelta:m.constant(r.length-u),colDelta:m.constant(o.length-i)})},au=function(n,t){var e=Qo.cellLength(n[0]),r=Qo.cellLength(t[0]);return{rowDelta:m.constant(0),colDelta:m.constant(e-r)}},cu=function(n,t,e){var r=t.colDelta()<0?iu:m.identity;return(t.rowDelta()<0?ou:m.identity)(r(n,Math.abs(t.colDelta()),e),Math.abs(t.rowDelta()),e)},lu=function(n,t,e,r){if(0===n.length)return n;for(var o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)Qo.mutateCell(n[o],i,nn.elementnew(r(),!1));return n},su=function(n,t,e,r){for(var o=!0,i=0;i<n.length;i++)for(var u=0;u<Qo.cellLength(n[0]);u++){var a=e(Qo.getCellElement(n[i],u),t);!0===a&&!1===o?Qo.mutateCell(n[i],u,nn.elementnew(r(),!0)):!0===a&&(o=!1)}return n},fu=function(n,t,e,r){if(t>0&&t<n.length){var o=n[t-1].cells(),i=(u=o,a=e,B.foldl(u,function(n,t){return B.exists(n,function(n){return a(n.element(),t.element())})?n:n.concat([t])},[]));B.each(i,function(o){for(var i=w.none(),u=t;u<n.length;u++)for(var a=0;a<Qo.cellLength(n[0]);a++){var c=n[u].cells()[a];e(c.element(),o.element())&&(i.isNone()&&(i=w.some(r())),i.each(function(t){Qo.mutateCell(n[u],a,nn.elementnew(t,!0))}))}})}var u,a;return n},du=function(n,t,e,r,o){return uu(n,t,e).map(function(i){var u=cu(t,i,r);return function(n,t,e,r,o){for(var i,u,a,c,l,s,f,d=n.row(),g=n.column(),p=d+e.length,h=g+Qo.cellLength(e[0]),v=d;v<p;v++)for(var b=g;b<h;b++){i=t,u=v,a=b,c=o,l=void 0,s=void 0,l=Qo.getCell(i[u],a),s=m.curry(c,l.element()),f=i[u],i.length>1&&Qo.cellLength(f)>1&&(a>0&&s(Qo.getCellElement(f,a-1))||a<f.length-1&&s(Qo.getCellElement(f,a+1))||u>0&&s(Qo.getCellElement(i[u-1],a))||u<i.length-1&&s(Qo.getCellElement(i[u+1],a)))&&su(t,Qo.getCellElement(t[v],b),o,r.cell);var w=Qo.getCellElement(e[v-d],b-g),y=r.replace(w);Qo.mutateCell(t[v],b,nn.elementnew(y,!0))}return t}(n,u,e,r,o)})},mu=function(n,t,e,r,o){fu(t,n,o,r.cell);var i=au(e,t),u=cu(e,i,r),a=au(t,u),c=cu(t,a,r);return c.slice(0,n).concat(u).concat(c.slice(n,c.length))},gu=function(n,t,e,r,o){var i=n.slice(0,t),u=n.slice(t),a=Qo.mapCells(n[e],function(e,i){return t>0&&t<n.length&&r(Qo.getCellElement(n[t-1],i),Qo.getCellElement(n[t],i))?Qo.getCell(n[t],i):nn.elementnew(o(e.element(),r),!0)});return i.concat([a]).concat(u)},pu=function(n,t,e,r,o){return B.map(n,function(n){var i=t>0&&t<Qo.cellLength(n)&&r(Qo.getCellElement(n,t-1),Qo.getCellElement(n,t))?Qo.getCell(n,t):nn.elementnew(o(Qo.getCellElement(n,e),r),!0);return Qo.addCell(n,t,i)})},hu=function(n,t,e,r,o){var i=e+1;return B.map(n,function(n,u){var a=u===t?nn.elementnew(o(Qo.getCellElement(n,e),r),!0):Qo.getCell(n,e);return Qo.addCell(n,i,a)})},vu=function(n,t,e,r,o){var i=t+1,u=n.slice(0,i),a=n.slice(i),c=Qo.mapCells(n[t],function(n,t){return t===e?nn.elementnew(o(n.element(),r),!0):n});return u.concat([c]).concat(a)},bu=function(n,t,e){return n.slice(0,t).concat(n.slice(e+1))},wu=function(n,t,e){var r=B.map(n,function(n){var r=n.cells().slice(0,t).concat(n.cells().slice(e+1));return nn.rowcells(r,n.section())});return B.filter(r,function(n){return n.cells().length>0})},yu=function(n,t,e,r){return B.map(n,function(n){return Qo.mapCells(n,function(n){return o=n,B.exists(t,function(n){return e(o.element(),n.element())})?nn.elementnew(r(n.element(),e),!0):n;var o})})},xu=function(n,t,e,r){return Qo.getCellElement(n[t],e)!==undefined&&t>0&&r(Qo.getCellElement(n[t-1],e),Qo.getCellElement(n[t],e))},Cu=function(n,t,e){return t>0&&e(Qo.getCellElement(n,t-1),Qo.getCellElement(n,t))},Su=function(n,t,e,r){var o=B.bind(n,function(r,o){return xu(n,o,t,e)||Cu(r,t,e)?[]:[Qo.getCell(r,t)]});return yu(n,o,e,r)},Ru=function(n,t,e,r){var o=n[t],i=B.bind(o.cells(),function(r,i){return xu(n,t,i,e)||Cu(o,i,e)?[]:[r]});return yu(n,i,e,r)},Tu=function(n){return{fold:n}},Du=function(){return Tu(function(n,t,e,r,o){return n()})},Au=function(n){return Tu(function(t,e,r,o,i){return e(n)})},ku=function(n,t){return Tu(function(e,r,o,i,u){return o(n,t)})},Nu=function(n,t,e){return Tu(function(r,o,i,u,a){return u(n,t,e)})},Ou=function(n,t){return Tu(function(e,r,o,i,u){return u(n,t)})},Eu=function(n,t,e,r){var o,i,u=n.slice(0),a=(i=t,0===(o=n).length?Du():1===o.length?Au(0):0===i?ku(0,1):i===o.length-1?Ou(i-1,i):i>0&&i<o.length-1?Nu(i-1,i,i+1):Du()),c=function(n){return B.map(n,m.constant(0))},l=m.constant(c(u)),s=function(n,t){if(e>=0){var o=Math.max(r.minCellWidth(),u[t]-e);return c(u.slice(0,n)).concat([e,o-u[t]]).concat(c(u.slice(t+1)))}var i=Math.max(r.minCellWidth(),u[n]+e),a=u[n]-i;return c(u.slice(0,n)).concat([i-u[n],a]).concat(c(u.slice(t+1)))},f=s;return a.fold(l,function(n){return r.singleColumnWidth(u[n],e)},f,function(n,t,e){return s(t,e)},function(n,t){if(e>=0)return c(u.slice(0,t)).concat([e]);var o=Math.max(r.minCellWidth(),u[t]+e);return c(u.slice(0,t)).concat([o-u[t]])})},Bu=function(n,t){return Dt.has(n,t)&&parseInt(Dt.get(n,t),10)>1},Iu={hasColspan:function(n){return Bu(n,"colspan")},hasRowspan:function(n){return Bu(n,"rowspan")},minWidth:m.constant(10),minHeight:m.constant(10),getInt:function(n,t){return parseInt(re.get(n,t),10)}},Pu=function(n,t,e){return re.getRaw(n,t).fold(function(){return e(n)+"px"},function(n){return n})},Wu=function(n){return Pu(n,"width",no.getPixelWidth)},_u=function(n){return Pu(n,"height",no.getHeight)},Mu=function(n,t,e,r,o){var i=si(n),u=B.map(i,function(n){return n.map(t.edge)});return B.map(i,function(n,t){return n.filter(m.not(Iu.hasColspan)).fold(function(){var n=ci(u,t);return r(n)},function(n){return e(n,o)})})},Lu=function(n){return n.map(function(n){return n+"px"}).getOr("")},qu=function(n,t,e,r){var o=fi(n),i=B.map(o,function(n){return n.map(t.edge)});return B.map(o,function(n,t){return n.filter(m.not(Iu.hasRowspan)).fold(function(){var n=ci(i,t);return r(n)},function(n){return e(n)})})},zu={getRawWidths:function(n,t){return Mu(n,t,Wu,Lu)},getPixelWidths:function(n,t,e){return Mu(n,t,no.getPixelWidth,function(n){return n.getOrThunk(e.minCellWidth)},e)},getPercentageWidths:function(n,t,e){return Mu(n,t,no.getPercentageWidth,function(n){return n.fold(function(){return e.minCellWidth()},function(n){return n/e.pixelWidth()*100})},e)},getPixelHeights:function(n,t){return qu(n,t,no.getHeight,function(n){return n.getOrThunk(Iu.minHeight)})},getRawHeights:function(n,t){return qu(n,t,_u,Lu)}},Fu=function(n,t,e){for(var r=0,o=n;o<t;o++)r+=e[o]!==undefined?e[o]:0;return r},ju=function(n,t){var e=Kt.justCells(n);return B.map(e,function(n){var e=Fu(n.column(),n.column()+n.colspan(),t);return{element:n.element,width:m.constant(e),colspan:n.colspan}})},Hu=function(n,t){var e=Kt.justCells(n);return B.map(e,function(n){var e=Fu(n.row(),n.row()+n.rowspan(),t);return{element:n.element,height:m.constant(e),rowspan:n.rowspan}})},Vu=function(n,t){return B.map(n.all(),function(n,e){return{element:n.element,height:m.constant(t[e])}})},Uu=function(n){var t=parseInt(n,10),e=m.identity;return{width:m.constant(t),pixelWidth:m.constant(t),getWidths:zu.getPixelWidths,getCellDelta:e,singleColumnWidth:function(n,t){return[Math.max(Iu.minWidth(),n+t)-n]},minCellWidth:Iu.minWidth,setElementWidth:no.setPixelWidth,setTableWidth:function(n,t,e){var r=B.foldr(t,function(n,t){return n+t},0);no.setPixelWidth(n,r)}}},Gu=function(n,t){if(no.percentageBasedSizeRegex().test(t)){var e=no.percentageBasedSizeRegex().exec(t);return o=e[1],i=n,u=parseFloat(o),a=zr(i),{width:m.constant(u),pixelWidth:m.constant(a),getWidths:zu.getPercentageWidths,getCellDelta:function(n){return n/a*100},singleColumnWidth:function(n,t){return[100-n]},minCellWidth:function(){return Iu.minWidth()/a*100},setElementWidth:no.setPercentageWidth,setTableWidth:function(n,t,e){var r=u+e;no.setPercentageWidth(n,r)}}}if(no.pixelBasedSizeRegex().test(t)){var r=no.pixelBasedSizeRegex().exec(t);return Uu(r[1])}var o,i,u,a,c=zr(n);return Uu(c)},Xu=function(n){return no.getRawWidth(n).fold(function(){var t=zr(n);return Uu(t)},function(t){return Gu(n,t)})},Yu=function(n){return Kt.generate(n)},$u=function(n){var t=Gt(n);return Yu(t)},Ku=function(n,t,e,r){var o=Xu(n),i=o.getCellDelta(t),u=$u(n),a=o.getWidths(u,r,o),c=Eu(a,e,i,o),l=B.map(c,function(n,t){return n+a[t]}),s=ju(u,l);B.each(s,function(n){o.setElementWidth(n.element(),n.width())}),e===u.grid().columns()-1&&o.setTableWidth(n,l,i)},Ju=function(n,t,e,r){var o=$u(n),i=zu.getPixelHeights(o,r),u=B.map(i,function(n,r){return e===r?Math.max(t+n,Iu.minHeight()):n}),a=Hu(o,u),c=Vu(o,u);B.each(c,function(n){no.setHeight(n.element(),n.height())}),B.each(a,function(n){no.setHeight(n.element(),n.height())});var l,s=(l=u,B.foldr(l,function(n,t){return n+t},0));no.setHeight(n,s)},Qu=function(n,t,e){var r=Xu(n),o=Yu(t),i=r.getWidths(o,e,r),u=ju(o,i);B.each(u,function(n){r.setElementWidth(n.element(),n.width())});var a=B.foldr(i,function(n,t){return t+n},0);u.length>0&&r.setElementWidth(n,a)},Zu=function(n){0===Ht(n).length&&le.remove(n)},na=X.immutable("grid","cursor"),ta=function(n,t,e){return ea(n,t,e).orThunk(function(){return ea(n,0,0)})},ea=function(n,t,e){return w.from(n[t]).bind(function(n){return w.from(n.cells()[e]).bind(function(n){return w.from(n.element())})})},ra=function(n,t,e){return na(n,ea(n,t,e))},oa=function(n){return B.foldl(n,function(n,t){return B.exists(n,function(n){return n.row()===t.row()})?n:n.concat([t])},[]).sort(function(n,t){return n.row()-t.row()})},ia=function(n){return B.foldl(n,function(n,t){return B.exists(n,function(n){return n.column()===t.column()})?n:n.concat([t])},[]).sort(function(n,t){return n.column()-t.column()})},ua=function(n,t,e){var r=Xt(n,e),o=Kt.generate(r);return ei(o,t,!0)},aa=Qu,ca={insertRowBefore:Gi(function(n,t,e,r){var o=t.row(),i=t.row(),u=gu(n,i,o,e,r.getOrInit);return ra(u,i,t.column())},Yi,m.noop,m.noop,Oo),insertRowsBefore:Gi(function(n,t,e,r){var o=t[0].row(),i=t[0].row(),u=oa(t),a=B.foldl(u,function(n,t){return gu(n,i,o,e,r.getOrInit)},n);return ra(a,i,t[0].column())},$i,m.noop,m.noop,Oo),insertRowAfter:Gi(function(n,t,e,r){var o=t.row(),i=t.row()+t.rowspan(),u=gu(n,i,o,e,r.getOrInit);return ra(u,i,t.column())},Yi,m.noop,m.noop,Oo),insertRowsAfter:Gi(function(n,t,e,r){var o=oa(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),a=B.foldl(o,function(n,t){return gu(n,u,i,e,r.getOrInit)},n);return ra(a,u,t[0].column())},$i,m.noop,m.noop,Oo),insertColumnBefore:Gi(function(n,t,e,r){var o=t.column(),i=t.column(),u=pu(n,i,o,e,r.getOrInit);return ra(u,t.row(),i)},Yi,aa,m.noop,Oo),insertColumnsBefore:Gi(function(n,t,e,r){var o=ia(t),i=o[0].column(),u=o[0].column(),a=B.foldl(o,function(n,t){return pu(n,u,i,e,r.getOrInit)},n);return ra(a,t[0].row(),u)},$i,aa,m.noop,Oo),insertColumnAfter:Gi(function(n,t,e,r){var o=t.column(),i=t.column()+t.colspan(),u=pu(n,i,o,e,r.getOrInit);return ra(u,t.row(),i)},Yi,aa,m.noop,Oo),insertColumnsAfter:Gi(function(n,t,e,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=ia(t),a=B.foldl(u,function(n,t){return pu(n,i,o,e,r.getOrInit)},n);return ra(a,t[0].row(),i)},$i,aa,m.noop,Oo),splitCellIntoColumns:Gi(function(n,t,e,r){var o=hu(n,t.row(),t.column(),e,r.getOrInit);return ra(o,t.row(),t.column())},Yi,aa,m.noop,Oo),splitCellIntoRows:Gi(function(n,t,e,r){var o=vu(n,t.row(),t.column(),e,r.getOrInit);return ra(o,t.row(),t.column())},Yi,m.noop,m.noop,Oo),eraseColumns:Gi(function(n,t,e,r){var o=ia(t),i=wu(n,o[0].column(),o[o.length-1].column()),u=ta(i,t[0].row(),t[0].column());return na(i,u)},$i,aa,Zu,Oo),eraseRows:Gi(function(n,t,e,r){var o=oa(t),i=bu(n,o[0].row(),o[o.length-1].row()),u=ta(i,t[0].row(),t[0].column());return na(i,u)},$i,m.noop,Zu,Oo),makeColumnHeader:Gi(function(n,t,e,r){var o=Su(n,t.column(),e,r.replaceOrInit);return ra(o,t.row(),t.column())},Yi,m.noop,m.noop,Eo("row","th")),unmakeColumnHeader:Gi(function(n,t,e,r){var o=Su(n,t.column(),e,r.replaceOrInit);return ra(o,t.row(),t.column())},Yi,m.noop,m.noop,Eo(null,"td")),makeRowHeader:Gi(function(n,t,e,r){var o=Ru(n,t.row(),e,r.replaceOrInit);return ra(o,t.row(),t.column())},Yi,m.noop,m.noop,Eo("col","th")),unmakeRowHeader:Gi(function(n,t,e,r){var o=Ru(n,t.row(),e,r.replaceOrInit);return ra(o,t.row(),t.column())},Yi,m.noop,m.noop,Eo(null,"td")),mergeCells:Gi(function(n,t,e,r){var o=t.cells();Ho(o);var i=lu(n,t.bounds(),e,m.constant(o[0]));return na(i,w.from(o[0]))},Qi,m.noop,m.noop,Bo),unmergeCells:Gi(function(n,t,e,r){var o=B.foldr(t,function(n,t){return su(n,t,e,r.combine(t))},n);return na(o,w.from(t[0]))},Zi,aa,m.noop,Bo),pasteCells:Gi(function(n,t,e,r){var o,i,u,a,c=(o=t.clipboard(),i=t.generators(),u=Gt(o),a=Kt.generate(u),ei(a,i,!0)),l=nn.address(t.row(),t.column());return du(l,n,c,t.generators(),e).fold(function(){return na(n,w.some(t.element()))},function(n){var e=ta(n,t.row(),t.column());return na(n,e)})},Ki,aa,m.noop,Oo),pasteRowsBefore:Gi(function(n,t,e,r){var o=n[t.cells[0].row()],i=t.cells[0].row(),u=ua(t.clipboard(),t.generators(),o),a=mu(i,n,u,t.generators(),e),c=ta(a,t.cells[0].row(),t.cells[0].column());return na(a,c)},Ji,m.noop,m.noop,Oo),pasteRowsAfter:Gi(function(n,t,e,r){var o=n[t.cells[0].row()],i=t.cells[t.cells.length-1].row()+t.cells[t.cells.length-1].rowspan(),u=ua(t.clipboard(),t.generators(),o),a=mu(i,n,u,t.generators(),e),c=ta(a,t.cells[0].row(),t.cells[0].column());return na(a,c)},Ji,m.noop,m.noop,Oo)},la=function(n){return en.fromDom(n.getBody())},sa={getBody:la,getIsRoot:function(n){return function(t){return ot.eq(t,la(n))}},addSizeSuffix:function(n){return/^[0-9]+$/.test(n)&&(n+="px"),n},removePxSuffix:function(n){return n?n.replace(/px$/,""):""}},fa=function(n){return"rtl"===re.get(n,"direction")?"rtl":"ltr"},da={onDirection:function(n,t){return function(e){return"rtl"===fa(e)?t:n}},getDirection:fa},ma={isRtl:m.constant(!1)},ga={isRtl:m.constant(!0)},pa=function(n){return"rtl"===da.getDirection(n)?ga:ma},ha=function(n,t){var e,r=function(n){return"table"===xt.name(sa.getBody(n))};!1!==n.settings.table_clone_elements&&("string"==typeof n.settings.table_clone_elements?e=n.settings.table_clone_elements.split(/[ ,]/):Array.isArray(n.settings.table_clone_elements)&&(e=n.settings.table_clone_elements));var o=w.from(e),i=function(t,e,r,i){return function(u,a){var c=Bt.descendants(u,"td[data-mce-style],th[data-mce-style]");B.each(c,function(n){Dt.remove(n,"data-mce-style")});var l=i(),s=en.fromDom(n.getDoc()),f=xo(pa),d=Oe(r,s,o);return e(u)?t(l,u,a,d,f).bind(function(t){return B.each(t.newRows(),function(t){var e;e=t,n.fire("newrow",{node:e.dom()}),e.dom()}),B.each(t.newCells(),function(t){var e;e=t,n.fire("newcell",{node:e.dom()}),e.dom()}),t.cursor().map(function(t){var e=n.dom.createRng();return e.setStart(t.dom(),0),e.setEnd(t.dom(),0),e})}):w.none()}};return{deleteRow:i(ca.eraseRows,function(t){var e=Co(t);return!1===r(n)||e.rows()>1},m.noop,t),deleteColumn:i(ca.eraseColumns,function(t){var e=Co(t);return!1===r(n)||e.columns()>1},m.noop,t),insertRowsBefore:i(ca.insertRowsBefore,m.always,m.noop,t),insertRowsAfter:i(ca.insertRowsAfter,m.always,m.noop,t),insertColumnsBefore:i(ca.insertColumnsBefore,m.always,to,t),insertColumnsAfter:i(ca.insertColumnsAfter,m.always,to,t),mergeCells:i(ca.mergeCells,m.always,m.noop,t),unmergeCells:i(ca.unmergeCells,m.always,m.noop,t),pasteRowsBefore:i(ca.pasteRowsBefore,m.always,m.noop,t),pasteRowsAfter:i(ca.pasteRowsAfter,m.always,m.noop,t),pasteCells:i(ca.pasteCells,m.always,m.noop,t)}},va=function(n,t,e){var r=Gt(n),o=Kt.generate(r);return $i(o,t).map(function(n){var t=ei(o,e,!1).slice(n[0].row(),n[n.length-1].row()+n[n.length-1].rowspan()),r=Xi(t,e);return ii(r)})},ba=tinymce.util.Tools.resolve("tinymce.util.Tools"),wa=tinymce.util.Tools.resolve("tinymce.Env"),ya={applyAlign:function(n,t,e){e&&n.formatter.apply("align"+e,{},t)},applyVAlign:function(n,t,e){e&&n.formatter.apply("valign"+e,{},t)},unApplyAlign:function(n,t){ba.each("left center right".split(" "),function(e){n.formatter.remove("align"+e,{},t)})},unApplyVAlign:function(n,t){ba.each("top middle bottom".split(" "),function(e){n.formatter.remove("valign"+e,{},t)})},getTDTHOverallStyle:function(n,t,e){var r;return r=function(t,r){for(var o=0;o<r.length;o++){var i=n.getStyle(r[o],e);if(void 0===t&&(t=i),t!==i)return""}return t}(r,n.select("td,th",t))}},xa=function(n,t){var e=n.dom,r=t.control.rootControl,o=r.toJSON(),i=e.parseStyle(o.style);"style"===t.control.name()?(r.find("#borderStyle").value(i["border-style"]||"")[0].fire("select"),r.find("#borderColor").value(i["border-color"]||"")[0].fire("change"),r.find("#backgroundColor").value(i["background-color"]||"")[0].fire("change"),r.find("#width").value(i.width||"").fire("change"),r.find("#height").value(i.height||"").fire("change")):(i["border-style"]=o.borderStyle,i["border-color"]=o.borderColor,i["background-color"]=o.backgroundColor,i.width=o.width?sa.addSizeSuffix(o.width):"",i.height=o.height?sa.addSizeSuffix(o.height):""),r.find("#style").value(e.serializeStyle(e.parseStyle(e.serializeStyle(i))))},Ca={createStyleForm:function(n){var t=function(){var t=n.settings.color_picker_callback;if(t)return function(e){return t.call(n,function(n){e.control.value(n).fire("change")},e.control.value())}};return{title:"Advanced",type:"form",defaults:{onchange:m.curry(xa,n)},items:[{label:"Style",name:"style",type:"textbox"},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border style",type:"listbox",name:"borderStyle",width:90,onselect:m.curry(xa,n),values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]},{label:"Border color",type:"colorbox",name:"borderColor",onaction:t()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:t()}]}]}},buildListItems:function(n,t,e){var r=function(n,e){return e=e||[],ba.each(n,function(n){var o={text:n.text||n.title};n.menu?o.menu=r(n.menu):(o.value=n.value,t&&t(o)),e.push(o)}),e};return r(n,e||[])},updateStyleField:xa,extractAdvancedStyles:function(n,t){var e=n.parseStyle(n.getAttrib(t,"style")),r={};return e["border-style"]&&(r.borderStyle=e["border-style"]),e["border-color"]&&(r.borderColor=e["border-color"]),e["background-color"]&&(r.backgroundColor=e["background-color"]),r.style=n.serializeStyle(e),r}};function Sa(n,t,e,r){if("TD"===t.tagName||"TH"===t.tagName)n.setStyle(t,e,r);else if(t.children)for(var o=0;o<t.children.length;o++)Sa(n,t.children[o],e,r)}var Ra=function(n,t,e){var r,o,i=n.dom;Ca.updateStyleField(n,e),!1===(o=e.control.rootControl.toJSON())["class"]&&delete o["class"],n.undoManager.transact(function(){t||(t=Pr.insert(n,o.cols||1,o.rows||1)),function(n,t,e){var r=n.dom,o={},i={};if(o["class"]=e["class"],i.height=sa.addSizeSuffix(e.height),r.getAttrib(t,"width")&&!n.settings.table_style_by_css?o.width=sa.removePxSuffix(e.width):i.width=sa.addSizeSuffix(e.width),n.settings.table_style_by_css?(i["border-width"]=sa.addSizeSuffix(e.border),i["border-spacing"]=sa.addSizeSuffix(e.cellspacing),ba.extend(o,{"data-mce-border-color":e.borderColor,"data-mce-cell-padding":e.cellpadding,"data-mce-border":e.border})):ba.extend(o,{border:e.border,cellpadding:e.cellpadding,cellspacing:e.cellspacing}),n.settings.table_style_by_css&&t.children)for(var u=0;u<t.children.length;u++)Sa(r,t.children[u],{"border-width":sa.addSizeSuffix(e.border),"border-color":e.borderColor,padding:sa.addSizeSuffix(e.cellpadding)});e.style?ba.extend(i,r.parseStyle(e.style)):i=ba.extend({},r.parseStyle(r.getAttrib(t,"style")),i),o.style=r.serializeStyle(i),r.setAttribs(t,o)}(n,t,o),(r=i.select("caption",t)[0])&&!o.caption&&i.remove(r),!r&&o.caption&&((r=i.create("caption")).innerHTML=wa.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(r,t.firstChild)),ya.unApplyAlign(n,t),o.align&&ya.applyAlign(n,t,o.align),n.focus(),n.addVisual()})},Ta=function(n,t){var e,r,o,i,u,a,c,l,s,f=n.dom,d={};!0===t?(e=f.getParent(n.selection.getStart(),"table"))&&(c=e,l=(a=n).dom,s={width:l.getStyle(c,"width")||l.getAttrib(c,"width"),height:l.getStyle(c,"height")||l.getAttrib(c,"height"),cellspacing:l.getStyle(c,"border-spacing")||l.getAttrib(c,"cellspacing"),cellpadding:l.getAttrib(c,"data-mce-cell-padding")||l.getAttrib(c,"cellpadding")||ya.getTDTHOverallStyle(a.dom,c,"padding"),border:l.getAttrib(c,"data-mce-border")||l.getAttrib(c,"border")||ya.getTDTHOverallStyle(a.dom,c,"border"),borderColor:l.getAttrib(c,"data-mce-border-color"),caption:!!l.select("caption",c)[0],"class":l.getAttrib(c,"class")},ba.each("left center right".split(" "),function(n){a.formatter.matchNode(c,"align"+n)&&(s.align=n)}),!1!==a.settings.table_advtab&&ba.extend(s,Ca.extractAdvancedStyles(l,c)),d=s):(r={label:"Cols",name:"cols"},o={label:"Rows",name:"rows"}),n.settings.table_class_list&&(d["class"]&&(d["class"]=d["class"].replace(/\s*mce\-item\-table\s*/g,"")),i={name:"class",type:"listbox",label:"Class",values:Ca.buildListItems(n.settings.table_class_list,function(t){t.value&&(t.textStyle=function(){return n.formatter.getCssText({block:"table",classes:[t.value]})})})}),u={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:!1!==n.settings.table_appearance_options?[r,o,{label:"Width",name:"width",onchange:m.curry(Ca.updateStyleField,n)},{label:"Height",name:"height",onchange:m.curry(Ca.updateStyleField,n)},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[r,o,{label:"Width",name:"width",onchange:m.curry(Ca.updateStyleField,n)},{label:"Height",name:"height",onchange:m.curry(Ca.updateStyleField,n)}]},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},i]},!1!==n.settings.table_advtab?n.windowManager.open({title:"Table properties",data:d,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},Ca.createStyleForm(n)],onsubmit:m.curry(Ra,n,e)}):n.windowManager.open({title:"Table properties",data:d,body:u,onsubmit:m.curry(Ra,n,e)})},Da=function(n,t,e){var r=n.getParent(t,"table"),o=t.parentNode,i=n.select(e,r)[0];i||(i=n.create(e),r.firstChild?"CAPTION"===r.firstChild.nodeName?n.insertAfter(i,r.firstChild):r.insertBefore(i,r.firstChild):r.appendChild(i)),i.appendChild(t),o.hasChildNodes()||n.remove(o)};function Aa(n,t,e){var r,o=n.dom;function i(n,t,e){e&&o.setAttrib(n,t,e)}Ca.updateStyleField(n,e),r=e.control.rootControl.toJSON(),n.undoManager.transact(function(){ba.each(t,function(e){var u,a,c;i(e,"scope",r.scope),i(e,"style",r.style),i(e,"class",r["class"]),u=e,a="height",(c=sa.addSizeSuffix(r.height))&&o.setStyle(u,a,c),r.type!==e.parentNode.nodeName.toLowerCase()&&Da(n.dom,e,r.type),1===t.length&&ya.unApplyAlign(n,e),r.align&&ya.applyAlign(n,e,r.align)}),n.focus()})}var ka=function(n){var t,e,r,o,i,u,a,c,l,s,f=n.dom,d=[];t=f.getParent(n.selection.getStart(),"table"),e=f.getParent(n.selection.getStart(),"td,th"),ba.each(t.rows,function(n){ba.each(n.cells,function(t){if(f.getAttrib(t,"data-mce-selected")||t===e)return d.push(n),!1})}),(r=d[0])&&(d.length>1?i={height:"",scope:"","class":"",align:"",type:r.parentNode.nodeName.toLowerCase()}:(c=r,l=(a=n).dom,(s={height:l.getStyle(c,"height")||l.getAttrib(c,"height"),scope:l.getAttrib(c,"scope"),"class":l.getAttrib(c,"class")}).type=c.parentNode.nodeName.toLowerCase(),ba.each("left center right".split(" "),function(n){a.formatter.matchNode(c,"align"+n)&&(s.align=n)}),!1!==a.settings.table_row_advtab&&ba.extend(s,Ca.extractAdvancedStyles(l,c)),i=s),n.settings.table_row_class_list&&(o={name:"class",type:"listbox",label:"Class",values:Ca.buildListItems(n.settings.table_row_class_list,function(t){t.value&&(t.textStyle=function(){return n.formatter.getCssText({block:"tr",classes:[t.value]})})})}),u={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"Header",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},o]},!1!==n.settings.table_row_advtab?n.windowManager.open({title:"Row properties",data:i,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},Ca.createStyleForm(n)],onsubmit:m.curry(Aa,n,d)}):n.windowManager.open({title:"Row properties",data:i,body:u,onsubmit:m.curry(Aa,n,d)}))},Na=function(n,t,e){var r,o=n.dom;function i(n,t,e){e&&o.setAttrib(n,t,e)}function u(n,t,e){e&&o.setStyle(n,t,e)}Ca.updateStyleField(n,e),r=e.control.rootControl.toJSON(),n.undoManager.transact(function(){ba.each(t,function(e){var a,c;i(e,"scope",r.scope),1===t.length?i(e,"style",r.style):(a=e,c=r.style,a.style.cssText+=";"+c),i(e,"class",r["class"]),u(e,"width",sa.addSizeSuffix(r.width)),u(e,"height",sa.addSizeSuffix(r.height)),r.type&&e.nodeName.toLowerCase()!==r.type&&(e=o.rename(e,r.type)),1===t.length&&(ya.unApplyAlign(n,e),ya.unApplyVAlign(n,e)),r.align&&ya.applyAlign(n,e,r.align),r.valign&&ya.applyVAlign(n,e,r.valign)}),n.focus()})},Oa=function(n){var t,e,r,o=[];if(o=n.dom.select("td[data-mce-selected],th[data-mce-selected]"),t=n.dom.getParent(n.selection.getStart(),"td,th"),!o.length&&t&&o.push(t),t=t||o[0]){var i,u,a,c;o.length>1?e={width:"",height:"",scope:"","class":"",align:"",style:"",type:t.nodeName.toLowerCase()}:(u=t,a=(i=n).dom,(c={width:a.getStyle(u,"width")||a.getAttrib(u,"width"),height:a.getStyle(u,"height")||a.getAttrib(u,"height"),scope:a.getAttrib(u,"scope"),"class":a.getAttrib(u,"class")}).type=u.nodeName.toLowerCase(),ba.each("left center right".split(" "),function(n){i.formatter.matchNode(u,"align"+n)&&(c.align=n)}),ba.each("top middle bottom".split(" "),function(n){i.formatter.matchNode(u,"valign"+n)&&(c.valign=n)}),!1!==i.settings.table_cell_advtab&&ba.extend(c,Ca.extractAdvancedStyles(a,u)),e=c),n.settings.table_cell_class_list&&(r={name:"class",type:"listbox",label:"Class",values:Ca.buildListItems(n.settings.table_cell_class_list,function(t){t.value&&(t.textStyle=function(){return n.formatter.getCssText({block:"td",classes:[t.value]})})})});var l={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width",onchange:m.curry(Ca.updateStyleField,n)},{label:"Height",name:"height",onchange:m.curry(Ca.updateStyleField,n)},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},r]};!1!==n.settings.table_cell_advtab?n.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:e,body:[{title:"General",type:"form",items:l},Ca.createStyleForm(n)],onsubmit:m.curry(Na,n,o)}):n.windowManager.open({title:"Cell properties",data:e,body:l,onsubmit:m.curry(Na,n,o)})}},Ea=ba.each,Ba=w.none(),Ia={registerCommands:function(n,t,e,r){var o=sa.getIsRoot(n),i=function(){return en.fromDom(n.dom.getParent(n.selection.getStart(),"th,td"))},u=function(n){return Vt(n,o)},a=function(t){var o=i();u(o).each(function(i){var u=kr.forMenu(r,i,o);t(i,u).each(function(t){n.selection.setRng(t),n.focus(),e.clear(i)})})},c=function(t){var e=i();return u(e).bind(function(t){var o=en.fromDom(n.getDoc()),i=kr.forMenu(r,t,e),u=Oe(m.noop,o,w.none());return va(t,i,u)})},l=function(t){Ba.each(function(o){var a=B.map(o,function(n){return he(n)}),c=i();u(c).bind(function(o){var i=en.fromDom(n.getDoc()),u=Ee(i),l=kr.pasteRows(r,o,c,a,u);t(o,l).each(function(t){n.selection.setRng(t),n.focus(),e.clear(o)})})})};Ea({mceTableSplitCells:function(){a(t.unmergeCells)},mceTableMergeCells:function(){a(t.mergeCells)},mceTableInsertRowBefore:function(){a(t.insertRowsBefore)},mceTableInsertRowAfter:function(){a(t.insertRowsAfter)},mceTableInsertColBefore:function(){a(t.insertColumnsBefore)},mceTableInsertColAfter:function(){a(t.insertColumnsAfter)},mceTableDeleteCol:function(){a(t.deleteColumn)},mceTableDeleteRow:function(){a(t.deleteRow)},mceTableCutRow:function(n){Ba=c(),a(t.deleteRow)},mceTableCopyRow:function(n){Ba=c()},mceTablePasteRowBefore:function(n){l(t.pasteRowsBefore)},mceTablePasteRowAfter:function(n){l(t.pasteRowsAfter)},mceTableDelete:function(){var t=en.fromDom(n.dom.getParent(n.selection.getStart(),"th,td"));Vt(t,o).filter(m.not(o)).each(function(t){var e=en.fromText("");ue.after(t,e),le.remove(t);var r=n.dom.createRng();r.setStart(e.dom(),0),r.setEnd(e.dom(),0),n.selection.setRng(r)})}},function(t,e){n.addCommand(e,t)}),Ea({mceInsertTable:m.curry(Ta,n),mceTableProps:m.curry(Ta,n,!0),mceTableRowProps:m.curry(ka,n),mceTableCellProps:m.curry(Oa,n)},function(t,e){n.addCommand(e,function(n,e){t(e)})})},getClipboardRows:function(){return Ba.fold(function(){},function(n){return B.map(n,function(n){return n.dom()})})},setClipboardRows:function(n){var t=B.map(n,en.fromDom);Ba=w.from(t)}},Pa=function(n){var t=w.from(n.dom().documentElement).map(en.fromDom).getOr(n);return{parent:m.constant(t),view:m.constant(n),origin:m.constant(oo(0,0))}},Wa=function(n,t){return{parent:m.constant(t),view:m.constant(n),origin:m.constant(oo(0,0))}},_a=function(n){var t=X.immutable.apply(null,n),e=[];return{bind:function(n){if(n===undefined)throw"Event bind error: undefined handler";e.push(n)},unbind:function(n){e=B.filter(e,function(t){return t!==n})},trigger:function(){var n=t.apply(null,arguments);B.each(e,function(t){t(n)})}}},Ma=function(n){return{registry:L.map(n,function(n){return{bind:n.bind,unbind:n.unbind}}),trigger:L.map(n,function(n){return n.trigger})}},La={mode:Ao.exactly(["compare","extract","mutate","sink"]),sink:Ao.exactly(["element","start","stop","destroy"]),api:Ao.exactly(["forceDrop","drop","move","delayDrop"])},qa={resolve:gi("ephox-dragster").resolve},za=function(n,t){return function(e){if(n(e)){var r,o,i,u,a,c,l,s=en.fromDom(e.target),f=function(){e.stopPropagation()},d=function(){e.preventDefault()},g=m.compose(d,f),p=(r=s,o=e.clientX,i=e.clientY,u=f,a=d,c=g,l=e,{target:m.constant(r),x:m.constant(o),y:m.constant(i),stop:u,prevent:a,kill:c,raw:m.constant(l)});t(p)}}},Fa=function(n,t,e,r,o){var i=za(e,r);return n.dom().addEventListener(t,i,o),{unbind:m.curry(ja,n,t,i,o)}},ja=function(n,t,e,r){n.dom().removeEventListener(t,e,r)},Ha=function(n,t,e,r){return Fa(n,t,e,r,!1)},Va=m.constant(!0),Ua=function(n,t,e){return Ha(n,t,Va,e)},Ga=La.mode({compare:function(n,t){return oo(t.left()-n.left(),t.top()-n.top())},extract:function(n){return w.some(oo(n.x(),n.y()))},sink:function(n,t){var e,r,o,i=(e=t,r=Xo.merge({layerClass:qa.resolve("blocker")},e),o=en.fromTag("div"),Dt.set(o,"role","presentation"),re.setAll(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Ni.add(o,qa.resolve("blocker")),Ni.add(o,r.layerClass),{element:function(){return o},destroy:function(){le.remove(o)}}),u=Ua(i.element(),"mousedown",n.forceDrop),a=Ua(i.element(),"mouseup",n.drop),c=Ua(i.element(),"mousemove",n.move),l=Ua(i.element(),"mouseout",n.delayDrop);return La.sink({element:i.element,start:function(n){ue.append(n,i.element())},stop:function(){le.remove(i.element())},destroy:function(){i.destroy(),a.unbind(),c.unbind(),l.unbind(),u.unbind()}})},mutate:function(n,t){n.mutate(t.left(),t.top())}}),Xa=function(){var n=w.none(),t=Ma({move:_a(["info"])});return{onEvent:function(e,r){r.extract(e).each(function(e){var o,i,u;(o=r,i=e,u=n.map(function(n){return o.compare(n,i)}),n=w.some(i),u).each(function(n){t.trigger.move(n)})})},reset:function(){n=w.none()},events:t.registry}},Ya=function(){var n={onEvent:function(n,t){},reset:m.noop},t=Xa(),e=n;return{on:function(){e.reset(),e=t},off:function(){e.reset(),e=n},isOn:function(){return e===t},onEvent:function(n,t){e.onEvent(n,t)},events:t.events}},$a=function(n,t){var e=null;return{cancel:function(){null!==e&&(clearTimeout(e),e=null)},throttle:function(){var r=arguments;null!==e&&clearTimeout(e),e=setTimeout(function(){n.apply(null,r),e=null,r=null},t)}}},Ka=function(n,t,e){var r=!1,o=Ma({start:_a([]),stop:_a([])}),i=Ya(),u=function(){l.stop(),i.isOn()&&(i.off(),o.trigger.stop())},a=$a(u,200);i.events.move.bind(function(e){t.mutate(n,e.info())});var c=function(n){return function(){var t=Array.prototype.slice.call(arguments,0);if(r)return n.apply(null,t)}},l=t.sink(La.api({forceDrop:u,drop:c(u),move:c(function(n,e){a.cancel(),i.onEvent(n,t)}),delayDrop:c(a.throttle)}),e);return{element:l.element,go:function(n){l.start(n),i.on(),o.trigger.start()},on:function(){r=!0},off:function(){r=!1},destroy:function(){l.destroy()},events:o.registry}},Ja=function(n,t){var e=t!==undefined?t:{},r=e.mode!==undefined?e.mode:Ga;return Ka(n,r,t)},Qa=function(){var n,t=Ma({drag:_a(["xDelta","yDelta","target"])}),e=w.none(),r={mutate:function(t,e){n.trigger.drag(t,e)},events:(n=Ma({drag:_a(["xDelta","yDelta"])})).registry};return r.events.drag.bind(function(n){e.each(function(e){t.trigger.drag(n.xDelta(),n.yDelta(),e)})}),{assign:function(n){e=w.some(n)},get:function(){return e},mutate:r.mutate,events:t.registry}},Za=function(n,t,e){return qt.ancestor(n,t,e).isSome()},nc=pi.resolve("resizer-bar-dragging"),tc=function(n,t){var e=wo.height,r=function(n,t,e){var r=Qa(),o=Ja(r,{}),i=w.none(),u=function(n,t){return w.from(Dt.get(n,t))};r.events.drag.bind(function(n){u(n.target(),"data-row").each(function(t){var e=Iu.getInt(n.target(),"top");re.set(n.target(),"top",e+n.yDelta()+"px")}),u(n.target(),"data-column").each(function(t){var e=Iu.getInt(n.target(),"left");re.set(n.target(),"left",e+n.xDelta()+"px")})});var a=function(n,t){return Iu.getInt(n,t)-parseInt(Dt.get(n,"data-initial-"+t),10)};o.events.stop.bind(function(){r.get().each(function(r){i.each(function(o){u(r,"data-row").each(function(n){var t=a(r,"top");Dt.remove(r,"data-initial-top"),d.trigger.adjustHeight(o,t,parseInt(n,10))}),u(r,"data-column").each(function(n){var t=a(r,"left");Dt.remove(r,"data-initial-left"),d.trigger.adjustWidth(o,t,parseInt(n,10))}),Mi(n,o,e,t)})})});var c=function(t,e){d.trigger.startAdjust(),r.assign(t),Dt.set(t,"data-initial-"+e,parseInt(re.get(t,e),10)),Ni.add(t,nc),re.set(t,"opacity","0.2"),o.go(n.parent())},l=Ua(n.parent(),"mousedown",function(n){Fi(n.target())&&c(n.target(),"top"),ji(n.target())&&c(n.target(),"left")}),s=function(t){return ot.eq(t,n.view())},f=Ua(n.view(),"mouseover",function(r){"table"===xt.name(r.target())||Za(r.target(),"table",s)?(i="table"===xt.name(r.target())?w.some(r.target()):qt.ancestor(r.target(),"table",s)).each(function(r){Mi(n,r,e,t)}):Nt.inBody(r.target())&&zi(n)}),d=Ma({adjustHeight:_a(["table","delta","row"]),adjustWidth:_a(["table","delta","column"]),startAdjust:_a([])});return{destroy:function(){l.unbind(),f.unbind(),o.destroy(),zi(n)},refresh:function(r){Mi(n,r,e,t)},on:o.on,off:o.off,hideBars:m.curry(Li,n),showBars:m.curry(qi,n),events:d.registry}}(n,t,e),o=Ma({beforeResize:_a(["table"]),afterResize:_a(["table"]),startDrag:_a([])});return r.events.adjustHeight.bind(function(n){o.trigger.beforeResize(n.table());var t=e.delta(n.delta(),n.table());Ju(n.table(),t,n.row(),e),o.trigger.afterResize(n.table())}),r.events.startAdjust.bind(function(n){o.trigger.startDrag()}),r.events.adjustWidth.bind(function(n){o.trigger.beforeResize(n.table());var e=t.delta(n.delta(),n.table());Ku(n.table(),e,n.column(),t),o.trigger.afterResize(n.table())}),{on:r.on,off:r.off,hideBars:r.hideBars,showBars:r.showBars,destroy:r.destroy,events:o.registry}},ec=function(n,t){return n.inline?Wa(sa.getBody(n),(e=en.fromTag("div"),re.setAll(e,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),ue.append(Nt.body(),e),e)):Pa(en.fromDom(n.getDoc()));var e},rc=function(n,t){n.inline&&le.remove(t.parent())},oc=function(n){var t,e,r=w.none(),o=w.none(),i=w.none(),u=/(\d+(\.\d+)?)%/,a=function(n){return"TABLE"===n.nodeName};return n.on("init",function(){var t=xo(pa),e=ec(n);if(i=w.some(e),n.settings.object_resizing&&!1!==n.settings.table_resize_bars&&(!0===n.settings.object_resizing||"table"===n.settings.object_resizing)){var u=tc(e,t);u.on(),u.events.startDrag.bind(function(t){r=w.some(n.selection.getRng())}),u.events.afterResize.bind(function(t){var e=t.table(),o=Bt.descendants(e,"td[data-mce-style],th[data-mce-style]");B.each(o,function(n){Dt.remove(n,"data-mce-style")}),r.each(function(t){n.selection.setRng(t),n.focus()}),n.undoManager.add()}),o=w.some(u)}}),n.on("ObjectResizeStart",function(r){var o;a(r.target)&&(t=r.width,o=r.target,e=n.dom.getStyle(o,"width")||n.dom.getAttrib(o,"width"))}),n.on("ObjectResized",function(r){if(a(r.target)){var o=r.target;if(u.test(e)){var i=parseFloat(u.exec(e)[1]),c=r.width*i/t;n.dom.setStyle(o,"width",c+"%")}else{var l=[];ba.each(o.rows,function(t){ba.each(t.cells,function(t){var e=n.dom.getStyle(t,"width",!0);l.push({cell:t,width:e})})}),ba.each(l,function(t){n.dom.setStyle(t.cell,"width",t.width),n.dom.setAttrib(t.cell,"width",null)})}}}),{lazyResize:function(){return o},lazyWire:function(){return i.getOr(Pa(en.fromDom(n.getBody())))},destroy:function(){o.each(function(n){n.destroy()}),i.each(function(t){rc(n,t)})}}},ic=function(n){return{fold:n}},uc=function(n){return ic(function(t,e,r,o){return t(n)})},ac=function(n){return ic(function(t,e,r,o){return e(n)})},cc=function(n,t){return ic(function(e,r,o,i){return o(n,t)})},lc=function(n){return ic(function(t,e,r,o){return o(n)})},sc=function(n,t){return Vt(n,t).bind(function(t){var e=Ht(t);return B.findIndex(e,function(t){return ot.eq(n,t)}).map(function(n){return{index:m.constant(n),all:m.constant(e)}})})},fc=function(n,t){return sc(n,t).fold(function(){return uc(n)},function(t){return t.index()+1<t.all().length?cc(n,t.all()[t.index()+1]):lc(n)})},dc=function(n,t){return sc(n,t).fold(function(){return uc()},function(t){return t.index()-1>=0?cc(n,t.all()[t.index()-1]):ac(n)})},mc=wr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),gc={before:mc.before,on:mc.on,after:mc.after,cata:function(n,t,e,r){return n.fold(t,e,r)},getStart:function(n){return n.fold(m.identity,m.identity,m.identity)}},pc=wr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),hc=X.immutable("start","soffset","finish","foffset"),vc={domRange:pc.domRange,relative:pc.relative,exact:pc.exact,exactFromRange:function(n){return pc.exact(n.start(),n.soffset(),n.finish(),n.foffset())},range:hc,getWin:function(n){var t=n.match({domRange:function(n){return en.fromDom(n.startContainer)},relative:function(n,t){return gc.getStart(n)},exact:function(n,t,e,r){return n}});return dt.defaultView(t)}},bc=function(n,t,e,r){var o=dt.owner(n).dom().createRange();return o.setStart(n.dom(),t),o.setEnd(e.dom(),r),o},wc=function(n,t,e,r){var o=bc(n,t,e,r),i=ot.eq(n,e)&&t===r;return o.collapsed&&!i},yc=function(n,t){n.selectNodeContents(t.dom())},xc=function(n){n.deleteContents()},Cc=function(n){return{left:m.constant(n.left),top:m.constant(n.top),right:m.constant(n.right),bottom:m.constant(n.bottom),width:m.constant(n.width),height:m.constant(n.height)}},Sc={create:function(n){return n.document.createRange()},replaceWith:function(n,t){xc(n),n.insertNode(t.dom())},selectNodeContents:function(n,t){var e=n.document.createRange();return yc(e,t),e},selectNodeContentsUsing:yc,relativeToNative:function(n,t,e){var r,o,i=n.document.createRange();return r=i,t.fold(function(n){r.setStartBefore(n.dom())},function(n,t){r.setStart(n.dom(),t)},function(n){r.setStartAfter(n.dom())}),o=i,e.fold(function(n){o.setEndBefore(n.dom())},function(n,t){o.setEnd(n.dom(),t)},function(n){o.setEndAfter(n.dom())}),i},exactToNative:function(n,t,e,r,o){var i=n.document.createRange();return i.setStart(t.dom(),e),i.setEnd(r.dom(),o),i},deleteContents:xc,cloneFragment:function(n){var t=n.cloneContents();return en.fromDom(t)},getFirstRect:function(n){var t=n.getClientRects(),e=t.length>0?t[0]:n.getBoundingClientRect();return e.width>0||e.height>0?w.some(e).map(Cc):w.none()},getBounds:function(n){var t=n.getBoundingClientRect();return t.width>0||t.height>0?w.some(t).map(Cc):w.none()},isWithin:function(n,t){return t.compareBoundaryPoints(n.END_TO_START,n)<1&&t.compareBoundaryPoints(n.START_TO_END,n)>-1},toString:function(n){return n.toString()}},Rc=wr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Tc=function(n,t,e){return t(en.fromDom(e.startContainer),e.startOffset,en.fromDom(e.endContainer),e.endOffset)},Dc=function(n,t){var e,r,o,i=(e=n,t.match({domRange:function(n){return{ltr:m.constant(n),rtl:w.none}},relative:function(n,t){return{ltr:yn(function(){return Sc.relativeToNative(e,n,t)}),rtl:yn(function(){return w.some(Sc.relativeToNative(e,t,n))})}},exact:function(n,t,r,o){return{ltr:yn(function(){return Sc.exactToNative(e,n,t,r,o)}),rtl:yn(function(){return w.some(Sc.exactToNative(e,r,o,n,t))})}}}));return(o=(r=i).ltr()).collapsed?r.rtl().filter(function(n){return!1===n.collapsed}).map(function(n){return Rc.rtl(en.fromDom(n.endContainer),n.endOffset,en.fromDom(n.startContainer),n.startOffset)}).getOrThunk(function(){return Tc(0,Rc.ltr,o)}):Tc(0,Rc.ltr,o)},Ac=(Rc.ltr,Rc.rtl,Dc),kc=function(n,t){return Dc(n,t).match({ltr:function(t,e,r,o){var i=n.document.createRange();return i.setStart(t.dom(),e),i.setEnd(r.dom(),o),i},rtl:function(t,e,r,o){var i=n.document.createRange();return i.setStart(r.dom(),o),i.setEnd(t.dom(),e),i}})},Nc=function(n,t,e){return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom},Oc=function(n,t,e,r,o){if(0===o)return 0;if(t===r)return o-1;for(var i=r,u=1;u<o;u++){var a=n(u),c=Math.abs(t-a.left);if(e>a.bottom);else{if(e<a.top||c>i)return u-1;i=c}}return 0},Ec={locate:function(n,t,e,r){var o=n.dom().createRange();o.selectNode(t.dom());var i=o.getClientRects();return $o(i,function(n){return Nc(n,e,r)?w.some(n):w.none()}).map(function(o){return i=n,a=e,c=r,l=o,s=function(n){var t=i.dom().createRange();return t.setStart(u.dom(),n),t.collapse(!0),t},f=we.get(u=t).length,d=Oc(function(n){return s(n).getBoundingClientRect()},a,c,l.right,f),s(d);var i,u,a,c,l,s,f,d})}},Bc=function(n,t,e,r){var o=n.dom().createRange(),i=dt.children(t);return $o(i,function(t){return o.selectNode(t.dom()),Nc(o.getBoundingClientRect(),e,r)?Ic(n,t,e,r):w.none()})},Ic=function(n,t,e,r){return(xt.isText(t)?Ec.locate:Bc)(n,t,e,r)},Pc=function(n,t,e,r){var o=n.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,e)),a=Math.max(i.top,Math.min(i.bottom,r));return Ic(n,t,u,a)},Wc=function(n,t){return t-n.left<n.right-t},_c=function(n,t,e){var r=n.dom().createRange();return r.selectNode(t.dom()),r.collapse(e),r},Mc=function(n,t,e){var r=n.dom().createRange();r.selectNode(t.dom());var o=r.getBoundingClientRect(),i=Wc(o,e);return(!0===i?Te.first:Te.last)(t).map(function(t){return _c(n,t,i)})},Lc=function(n,t,e){var r=t.dom().getBoundingClientRect(),o=Wc(r,e);return w.some(_c(n,t,o))},qc=function(n,t,e){return(0===dt.children(t).length?Lc:Mc)(n,t,e)},zc=document.caretPositionFromPoint?function(n,t,e){return w.from(n.dom().caretPositionFromPoint(t,e)).bind(function(t){if(null===t.offsetNode)return w.none();var e=n.dom().createRange();return e.setStart(t.offsetNode,t.offset),e.collapse(),w.some(e)})}:document.caretRangeFromPoint?function(n,t,e){return w.from(n.dom().caretRangeFromPoint(t,e))}:function(n,t,e){return en.fromPoint(n,t,e).bind(function(r){var o=function(){return qc(n,r,t)};return 0===dt.children(r).length?o():function(n,t,e,r){var o=n.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,e)),a=Math.max(i.top,Math.min(i.bottom,r));return Pc(n,t,u,a)}(n,r,t,e).orThunk(o)})},Fc=function(n,t,e){var r=en.fromDom(n.document);return zc(r,t,e).map(function(n){return vc.range(en.fromDom(n.startContainer),n.startOffset,en.fromDom(n.endContainer),n.endOffset)})},jc=function(n,t){var e=xt.name(n);return"input"===e?gc.after(n):B.contains(["br","img"],e)?0===t?gc.before(n):gc.after(n):gc.on(n,t)},Hc=function(n,t){var e=n.fold(gc.before,jc,gc.after),r=t.fold(gc.before,jc,gc.after);return vc.relative(e,r)},Vc=function(n,t,e,r){var o=jc(n,t),i=jc(e,r);return vc.relative(o,i)},Uc=function(n){return n.match({domRange:function(n){var t=en.fromDom(n.startContainer),e=en.fromDom(n.endContainer);return Vc(t,n.startOffset,e,n.endOffset)},relative:Hc,exact:Vc})},Gc=Hc,Xc=Vc,Yc=function(n,t){w.from(n.getSelection()).each(function(n){n.removeAllRanges(),n.addRange(t)})},$c=function(n,t,e,r,o){var i=Sc.exactToNative(n,t,e,r,o);Yc(n,i)},Kc=function(n,t){return Ac(n,t).match({ltr:function(t,e,r,o){$c(n,t,e,r,o)},rtl:function(t,e,r,o){var i=n.getSelection();i.extend?(i.collapse(t.dom(),e),i.extend(r.dom(),o)):$c(n,r,o,t,e)}})},Jc=function(n){var t=en.fromDom(n.anchorNode),e=en.fromDom(n.focusNode);return wc(t,n.anchorOffset,e,n.focusOffset)?w.some(vc.range(en.fromDom(n.anchorNode),n.anchorOffset,en.fromDom(n.focusNode),n.focusOffset)):function(n){if(n.rangeCount>0){var t=n.getRangeAt(0),e=n.getRangeAt(n.rangeCount-1);return w.some(vc.range(en.fromDom(t.startContainer),t.startOffset,en.fromDom(e.endContainer),e.endOffset))}return w.none()}(n)},Qc=function(n){var t=n.getSelection();return t.rangeCount>0?Jc(t):w.none()},Zc=function(n,t,e,r,o){var i=Xc(t,e,r,o);Kc(n,i)},nl=function(n){return Qc(n).map(function(n){return vc.exact(n.start(),n.soffset(),n.finish(),n.foffset())})},tl=function(n,t,e){var r=Gc(t,e);Kc(n,r)},el=function(n){var t=vc.getWin(n).dom(),e=function(n,e,r,o){return Sc.exactToNative(t,n,e,r,o)},r=Uc(n);return Ac(t,r).match({ltr:e,rtl:e})},rl=function(n,t){var e=Sc.selectNodeContents(n,t);Yc(n,e)},ol=function(n){n.getSelection().removeAllRanges()},il=function(n,t){var e=kc(n,t);return Sc.getFirstRect(e)},ul=function(n,t,e){return Fc(n,t,e)},al=tinymce.util.Tools.resolve("tinymce.util.VK"),cl=function(n,t,e,r){return fl(n,t,fc(e),r)},ll=function(n,t,e,r){return fl(n,t,dc(e),r)},sl=function(n,t){var e=vc.exact(t,0,t,0);return el(e)},fl=function(n,t,e,r,o){return e.fold(w.none,w.none,function(n,t){return Te.first(t).map(function(n){return sl(0,n)})},function(e){return Vt(e,t).bind(function(t){var o,i=kr.noMenu(e);return n.undoManager.transact(function(){r.insertRowsAfter(t,i)}),o=Bt.descendants(t,"tr"),B.last(o).bind(function(n){return qt.descendant(n,"td,th").map(function(n){return sl(0,n)})})})})},dl=["table","li","dl"],ml={handle:function(n,t,e,r){if(n.keyCode===al.TAB){var o=sa.getBody(t),i=function(n){var t=xt.name(n);return ot.eq(n,o)||B.contains(dl,t)},u=t.selection.getRng();if(u.collapsed){var a=en.fromDom(u.startContainer);jt(a,i).each(function(o){n.preventDefault(),(n.shiftKey?ll:cl)(t,i,o,e,r).each(function(n){t.selection.setRng(n)})})}}}},gl={response:X.immutable("selection","kill")},pl=function(n){return function(t){return t===n}},hl=pl(38),vl=pl(40),bl={ltr:{isBackward:pl(37),isForward:pl(39)},rtl:{isBackward:pl(39),isForward:pl(37)},isUp:hl,isDown:vl,isNavigation:function(n){return n>=37&&n<=40}},wl=function(n,t){var e=kc(n,t);return{start:m.constant(en.fromDom(e.startContainer)),soffset:m.constant(e.startOffset),finish:m.constant(en.fromDom(e.endContainer)),foffset:m.constant(e.endOffset)}},yl=function(n,t,e,r){return{start:m.constant(gc.on(n,t)),finish:m.constant(gc.on(e,r))}},xl=(tt.detect().browser.isSafari(),function(n){var t=n!==undefined?n.dom():document,e=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop;return oo(e,r)}),Cl=xl,Sl=function(n,t,e){(e!==undefined?e.dom():document).defaultView.scrollBy(n,t)},Rl=function(n){return{elementFromPoint:function(t,e){return w.from(n.document.elementFromPoint(t,e)).map(en.fromDom)},getRect:function(n){return n.dom().getBoundingClientRect()},getRangedRect:function(t,e,r,o){var i=vc.exact(t,e,r,o);return il(n,i).map(function(n){return L.map(n,m.apply)})},getSelection:function(){return nl(n).map(function(t){return wl(n,t)})},fromSitus:function(t){var e=vc.relative(t.start(),t.finish());return wl(n,e)},situsFromPoint:function(t,e){return ul(n,t,e).map(function(n){return{start:m.constant(gc.on(n.start(),n.soffset())),finish:m.constant(gc.on(n.finish(),n.foffset()))}})},clearSelection:function(){ol(n)},setSelection:function(t){Zc(n,t.start(),t.soffset(),t.finish(),t.foffset())},setRelativeSelection:function(t,e){tl(n,t,e)},selectContents:function(t){rl(n,t)},getInnerHeight:function(){return n.innerHeight},getScrollY:function(){return Cl(en.fromDom(n.document)).top()},scrollBy:function(t,e){Sl(t,e,en.fromDom(n.document))}}},Tl=function(n,t,e,r,o){if(!ot.eq(e,r))return lr(e,r,t).bind(function(t){var r=t.boxes().getOr([]);return r.length>0?(o(n,r,t.start(),t.finish()),w.some(gl.response(w.some(yl(e,0,e,Ce(e))),!0))):w.none()})},Dl={sync:function(n,t,e,r,o,i,u){return ot.eq(e,o)&&r===i?w.none():qt.closest(e,"td,th",t).bind(function(e){return qt.closest(o,"td,th",t).bind(function(r){return Tl(n,t,e,r,u)})})},detect:Tl,update:function(n,t,e,r,o){return fr(r,n,t,o.firstSelectedSelector(),o.lastSelectedSelector()).map(function(n){return o.clear(e),o.selectRange(e,n.boxes(),n.start(),n.finish()),n.boxes()})}},Al=X.immutableBag(["left","top","right","bottom"],[]),kl={nu:Al,moveUp:function(n,t){return Al({left:n.left(),top:n.top()-t,right:n.right(),bottom:n.bottom()-t})},moveDown:function(n,t){return Al({left:n.left(),top:n.top()+t,right:n.right(),bottom:n.bottom()+t})},moveBottomTo:function(n,t){var e=n.bottom()-n.top();return Al({left:n.left(),top:t-e,right:n.right(),bottom:t})},moveTopTo:function(n,t){var e=n.bottom()-n.top();return Al({left:n.left(),top:t,right:n.right(),bottom:t+e})},getTop:function(n){return n.top()},getBottom:function(n){return n.bottom()},translate:function(n,t,e){return Al({left:n.left()+t,top:n.top()+e,right:n.right()+t,bottom:n.bottom()+e})},toString:function(n){return"("+n.left()+", "+n.top()+") -> ("+n.right()+", "+n.bottom()+")"}},Nl=function(n){return kl.nu({left:n.left,top:n.top,right:n.right,bottom:n.bottom})},Ol=function(n,t){return w.some(n.getRect(t))},El=function(n,t,e){return xt.isElement(t)?Ol(n,t).map(Nl):xt.isText(t)?(r=n,o=t,i=e,i>=0&&i<Ce(o)?r.getRangedRect(o,i,o,i+1):i>0?r.getRangedRect(o,i-1,o,i):w.none()).map(Nl):w.none();var r,o,i},Bl=function(n,t){return xt.isElement(t)?Ol(n,t).map(Nl):xt.isText(t)?n.getRangedRect(t,0,t,Ce(t)).map(Nl):w.none()},Il=X.immutable("item","mode"),Pl=function(n,t,e,r){var o=r!==undefined?r:Wl;return n.property().parent(t).map(function(n){return Il(n,o)})},Wl=function(n,t,e,r){var o=r!==undefined?r:_l;return e.sibling(n,t).map(function(n){return Il(n,o)})},_l=function(n,t,e,r){var o=r!==undefined?r:_l,i=n.property().children(t);return e.first(i).map(function(n){return Il(n,o)})},Ml=[{current:Pl,next:Wl,fallback:w.none()},{current:Wl,next:_l,fallback:w.some(Pl)},{current:_l,next:_l,fallback:w.some(Wl)}],Ll=function(n,t,e,r,o){return o=o!==undefined?o:Ml,B.find(o,function(n){return n.current===e}).bind(function(e){return e.current(n,t,r,e.next).orThunk(function(){return e.fallback.bind(function(e){return Ll(n,t,e,r)})})})},ql={backtrack:Pl,sidestep:Wl,advance:_l,go:Ll},zl={left:function(){return{sibling:function(n,t){return n.query().prevSibling(t)},first:function(n){return n.length>0?w.some(n[n.length-1]):w.none()}}},right:function(){return{sibling:function(n,t){return n.query().nextSibling(t)},first:function(n){return n.length>0?w.some(n[0]):w.none()}}}},Fl=function(n,t,e,r,o,i){return ql.go(n,t,r,o).bind(function(t){return i(t.item())?w.none():e(t.item())?w.some(t.item()):Fl(n,t.item(),e,t.mode(),o,i)})},jl=function(n,t,e,r){return Fl(n,t,e,ql.sidestep,zl.left(),r)},Hl=function(n,t,e,r){return Fl(n,t,e,ql.sidestep,zl.right(),r)},Vl=function(n,t){return 0===n.property().children(t).length},Ul=function(n,t,e,r){return jl(n,t,e,r)},Gl=function(n,t,e,r){return Hl(n,t,e,r)},Xl={before:function(n,t,e){return Ul(n,t,m.curry(Vl,n),e)},after:function(n,t,e){return Gl(n,t,m.curry(Vl,n),e)},seekLeft:Ul,seekRight:Gl,walkers:function(){return{left:zl.left,right:zl.right}},walk:function(n,t,e,r,o){return ql.go(n,t,e,r,o)},backtrack:ql.backtrack,sidestep:ql.sidestep,advance:ql.advance},Yl=Pe(),$l={gather:function(n,t,e){return Xl.gather(Yl,n,t,e)},before:function(n,t){return Xl.before(Yl,n,t)},after:function(n,t){return Xl.after(Yl,n,t)},seekLeft:function(n,t,e){return Xl.seekLeft(Yl,n,t,e)},seekRight:function(n,t,e){return Xl.seekRight(Yl,n,t,e)},walkers:function(){return Xl.walkers()},walk:function(n,t,e,r){return Xl.walk(Yl,n,t,e,r)}},Kl=wr([{none:[]},{retry:["caret"]}]),Jl=function(n,t,e){return Mt.closest(t,zo).fold(m.constant(!1),function(t){return Bl(n,t).exists(function(n){return r=n,(t=e).left()<r.left()||Math.abs(r.right()-t.left())<1||t.left()>r.right();var t,r})})},Ql={point:kl.getTop,adjuster:function(n,t,e,r,o){var i=kl.moveUp(o,5);return Math.abs(e.top()-r.top())<1?Kl.retry(i):e.bottom()<o.top()?Kl.retry(i):e.bottom()===o.top()?Kl.retry(kl.moveUp(o,1)):Jl(n,t,o)?Kl.retry(kl.translate(i,5,0)):Kl.none()},move:kl.moveUp,gather:$l.before},Zl={point:kl.getBottom,adjuster:function(n,t,e,r,o){var i=kl.moveDown(o,5);return Math.abs(e.bottom()-r.bottom())<1?Kl.retry(i):e.top()>o.bottom()?Kl.retry(i):e.top()===o.bottom()?Kl.retry(kl.moveDown(o,1)):Jl(n,t,o)?Kl.retry(kl.translate(i,5,0)):Kl.none()},move:kl.moveDown,gather:$l.after},ns=function(n,t,e,r,o){return 0===o?w.some(r):(c=n,l=r.left(),s=t.point(r),c.elementFromPoint(l,s).filter(function(n){return"table"===xt.name(n)}).isSome()?(u=r,a=o-1,ns(n,i=t,e,i.move(u,5),a)):n.situsFromPoint(r.left(),t.point(r)).bind(function(i){return i.start().fold(w.none,function(i,u){return Bl(n,i,u).bind(function(u){return t.adjuster(n,i,u,e,r).fold(w.none,function(r){return ns(n,t,e,r,o-1)})}).orThunk(function(){return w.some(r)})},w.none)}));var i,u,a,c,l,s},ts=function(n,t,e){var r,o,i,u=n.move(e,5),a=ns(t,n,e,u,100).getOr(u);return(r=n,o=a,i=t,r.point(o)>i.getInnerHeight()?w.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?w.some(-r.point(o)):w.none()).fold(function(){return t.situsFromPoint(a.left(),n.point(a))},function(e){return t.scrollBy(0,e),t.situsFromPoint(a.left(),n.point(a)-e)})},es={tryUp:m.curry(ts,Ql),tryDown:m.curry(ts,Zl),ieTryUp:function(n,t){return n.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(n,t){return n.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:m.constant(5)},rs=wr([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),os=function(n){return qt.closest(n,"tr")},is={verify:function(n,t,e,r,o,i,u){return qt.closest(r,"td,th",u).bind(function(e){return qt.closest(t,"td,th",u).map(function(t){return ot.eq(e,t)?ot.eq(r,e)&&Ce(e)===o?i(t):rs.none("in same cell"):Ve(os,[e,t]).fold(function(){return o=t,u=e,a=(r=n).getRect(o),(c=r.getRect(u)).right>a.left&&c.left<a.right?rs.success():i(t);var r,o,u,a,c},function(n){return i(t)})})}).getOr(rs.none("default"))},cata:function(n,t,e,r,o){return n.fold(t,e,r,o)},adt:rs},us={point:X.immutable("element","offset"),delta:X.immutable("element","deltaOffset"),range:X.immutable("element","start","finish"),points:X.immutable("begin","end"),text:X.immutable("element","text")},as=(X.immutable("ancestor","descendants","element","index"),X.immutable("parent","children","element","index")),cs=function(n,t){return B.findIndex(n,m.curry(ot.eq,t))},ls=function(n){return dt.parent(n).bind(function(t){var e=dt.children(t);return cs(e,n).map(function(r){return as(t,e,n,r)})})},ss=function(n){return"br"===xt.name(n)},fs=function(n,t,e){return t(n,e).bind(function(n){return xt.isText(n)&&0===we.get(n).trim().length?fs(n,t,e):w.some(n)})},ds=function(n,t,e,r){return(o=t,i=e,dt.child(o,i).filter(ss).orThunk(function(){return dt.child(o,i-1).filter(ss)})).bind(function(t){return r.traverse(t).fold(function(){return fs(t,r.gather,n).map(r.relative)},function(n){return ls(n).map(function(n){return gc.on(n.parent(),n.index())})})});var o,i},ms=function(n,t,e,r){var o,i,u;return(ss(t)?(o=n,i=t,(u=r).traverse(i).orThunk(function(){return fs(i,u.gather,o)}).map(u.relative)):ds(n,t,e,r)).map(function(n){return{start:m.constant(n),finish:m.constant(n)}})},gs=function(n){return is.cata(n,function(n){return w.none("BR ADT: none")},function(){return w.none()},function(n){return w.some(us.point(n,0))},function(n){return w.some(us.point(n,Ce(n)))})},ps=tt.detect(),hs=function(n,t,e,r,o,i){return 0===i?w.none():ws(n,t,e,r,o).bind(function(u){var a=n.fromSitus(u),c=is.verify(n,e,r,a.finish(),a.foffset(),o.failure,t);return is.cata(c,function(){return w.none()},function(){return w.some(u)},function(u){return ot.eq(e,u)&&0===r?vs(n,e,r,kl.moveUp,o):hs(n,t,u,0,o,i-1)},function(u){return ot.eq(e,u)&&r===Ce(u)?vs(n,e,r,kl.moveDown,o):hs(n,t,u,Ce(u),o,i-1)})})},vs=function(n,t,e,r,o){return El(n,t,e).bind(function(t){return bs(n,o,r(t,es.getJumpSize()))})},bs=function(n,t,e){return ps.browser.isChrome()||ps.browser.isSafari()||ps.browser.isFirefox()||ps.browser.isEdge()?t.otherRetry(n,e):ps.browser.isIE()?t.ieRetry(n,e):w.none()},ws=function(n,t,e,r,o){return El(n,e,r).bind(function(t){return bs(n,o,t)})},ys=function(n,t,e){return(r=n,o=t,i=e,r.getSelection().bind(function(n){return ms(o,n.finish(),n.foffset(),i).fold(function(){return w.some(us.point(n.finish(),n.foffset()))},function(t){var e=r.fromSitus(t),u=is.verify(r,n.finish(),n.foffset(),e.finish(),e.foffset(),i.failure,o);return gs(u)})})).bind(function(r){return hs(n,t,r.element(),r.offset(),e,20).map(n.fromSitus)});var r,o,i},xs=function(n,t,e){return Mt.ancestor(n,t,e).isSome()},Cs=tt.detect(),Ss=function(n,t,e,r,o){return qt.closest(r,"td,th",t).bind(function(r){return qt.closest(r,"table",t).bind(function(i){return u=i,xs(o,function(n){return dt.parent(n).exists(function(n){return ot.eq(n,u)})})?ys(n,t,e).bind(function(n){return qt.closest(n.finish(),"td,th",t).map(function(t){return{start:m.constant(r),finish:m.constant(t),range:m.constant(n)}})}):w.none();var u})})},Rs=function(n,t,e,r,o,i){return Cs.browser.isIE()?w.none():i(r,t).orThunk(function(){return Ss(n,t,e,r,o).map(function(n){var t=n.range();return gl.response(w.some(yl(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},Ts=function(n,t,e,r,o,i,u){return Ss(n,e,r,o,i).bind(function(n){return Dl.detect(t,e,n.start(),n.finish(),u)})},Ds=function(n,t){return qt.closest(n,"tr",t).bind(function(n){return qt.closest(n,"table",t).bind(function(e){var r=Bt.descendants(e,"tr");return ot.eq(n,r[0])?$l.seekLeft(e,function(n){return Te.last(n).isSome()},t).map(function(n){var t=Ce(n);return gl.response(w.some(yl(n,t,n,t)),!0)}):w.none()})})},As=function(n,t){return qt.closest(n,"tr",t).bind(function(n){return qt.closest(n,"table",t).bind(function(e){var r=Bt.descendants(e,"tr");return ot.eq(n,r[r.length-1])?$l.seekRight(e,function(n){return Te.first(n).isSome()},t).map(function(n){return gl.response(w.some(yl(n,0,n,0)),!0)}):w.none()})})},ks=function(n,t){return qt.closest(n,"td,th",t)},Ns={down:{traverse:dt.nextSibling,gather:$l.after,relative:gc.before,otherRetry:es.tryDown,ieRetry:es.ieTryDown,failure:is.adt.failedDown},up:{traverse:dt.prevSibling,gather:$l.before,relative:gc.before,otherRetry:es.tryUp,ieRetry:es.ieTryUp,failure:is.adt.failedUp}},Os=X.immutable("rows","cols"),Es=function(n,t,e,r){var o,i,u,a,c,l,s=Rl(n),f=(o=s,i=t,u=e,a=r,c=w.none(),l=function(){c=w.none()},{mousedown:function(n){a.clear(i),c=ks(n.target(),u)},mouseover:function(n){c.each(function(t){a.clear(i),ks(n.target(),u).each(function(n){lr(t,n,u).each(function(e){var r=e.boxes().getOr([]);(r.length>1||1===r.length&&!ot.eq(t,n))&&(a.selectRange(i,r,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(){c.each(l)}});return{mousedown:f.mousedown,mouseover:f.mouseover,mouseup:f.mouseup}},Bs=function(n,t,e,r){var o=Rl(n),i=function(){return r.clear(t),w.none()};return{keydown:function(n,u,a,c,l,s){var f=n.raw().which,d=!0===n.raw().shiftKey;return sr(t,r.selectedSelector()).fold(function(){return bl.isDown(f)&&d?m.curry(Ts,o,t,e,Ns.down,c,u,r.selectRange):bl.isUp(f)&&d?m.curry(Ts,o,t,e,Ns.up,c,u,r.selectRange):bl.isDown(f)?m.curry(Rs,o,e,Ns.down,c,u,As):bl.isUp(f)?m.curry(Rs,o,e,Ns.up,c,u,Ds):w.none},function(n){var e=function(e){return function(){return $o(e,function(e){return Dl.update(e.rows(),e.cols(),t,n,r)}).fold(function(){return dr(t,r.firstSelectedSelector(),r.lastSelectedSelector()).map(function(n){var e=bl.isDown(f)||s.isForward(f)?gc.after:gc.before;return o.setRelativeSelection(gc.on(n.first(),0),e(n.table())),r.clear(t),gl.response(w.none(),!0)})},function(n){return w.some(gl.response(w.none(),!0))})}};return bl.isDown(f)&&d?e([Os(1,0)]):bl.isUp(f)&&d?e([Os(-1,0)]):s.isBackward(f)&&d?e([Os(0,-1),Os(-1,0)]):s.isForward(f)&&d?e([Os(0,1),Os(1,0)]):bl.isNavigation(f)&&!1===d?i:w.none})()},keyup:function(n,o,i,u,a){return sr(t,r.selectedSelector()).fold(function(){var c=n.raw().which;return 0==(!0===n.raw().shiftKey)?w.none():bl.isNavigation(c)?Dl.sync(t,e,o,i,u,a,r.selectRange):w.none()},w.none)}}},Is=function(n){var t=function(t){Dt.remove(t,n.selected()),Dt.remove(t,n.firstSelected()),Dt.remove(t,n.lastSelected())},e=function(t){Dt.set(t,n.selected(),"1")},r=function(e){var r=Bt.descendants(e,n.selectedSelector());B.each(r,t)};return{clear:r,selectRange:function(t,o,i,u){r(t),B.each(o,e),Dt.set(i,n.firstSelected(),"1"),Dt.set(u,n.lastSelected(),"1")},selectedSelector:n.selectedSelector,firstSelectedSelector:n.firstSelectedSelector,lastSelectedSelector:n.lastSelectedSelector}},Ps=function(n,t){var e=X.immutableBag(["mousedown","mouseover","mouseup","keyup","keydown"],[]),r=w.none(),o=Is(br);return n.on("init",function(i){var u=n.getWin(),a=sa.getBody(n),c=sa.getIsRoot(n),l=Es(u,a,c,o),s=Bs(u,a,c,o),f=function(t,e){e.kill()&&t.kill(),e.selection().each(function(t){var e=vc.relative(t.start(),t.finish()),r=kc(u,e);n.selection.setRng(r)})},d=function(t){var e=h(t);if(e.raw().shiftKey&&bl.isNavigation(e.raw().which)){var r=n.selection.getRng(),o=en.fromDom(r.startContainer),i=en.fromDom(r.endContainer);s.keyup(e,o,r.startOffset,i,r.endOffset).each(function(n){f(e,n)})}},g=function(n){return!(Dt.has(n,"data-mce-bogus")||"br"===xt.name(n)||xt.isText(n)&&0===we.get(n).length)},p=function(e){var r,o,i=h(e);t().each(function(n){n.hideBars()}),40===e.which&&(r=en.fromDom(n.getBody()),o=function(n){return dt.prevSibling(n).bind(function(n){return g(n)?w.some(n):o(n)})},dt.lastChild(r).bind(function(n){return g(n)?w.some(n):o(n)})).each(function(t){"table"===xt.name(t)&&(n.settings.forced_root_block?n.dom.add(n.getBody(),n.settings.forced_root_block,n.settings.forced_root_block_attrs,"<br/>"):n.dom.add(n.getBody(),"br"))});var u=n.selection.getRng(),a=en.fromDom(n.selection.getStart()),c=en.fromDom(u.startContainer),l=en.fromDom(u.endContainer),d=pa(a).isRtl()?bl.rtl:bl.ltr;s.keydown(i,c,u.startOffset,l,u.endOffset,d).each(function(n){f(i,n)}),t().each(function(n){n.showBars()})},h=function(n){var t=en.fromDom(n.target),e=function(){n.stopPropagation()},r=function(){n.preventDefault()},o=m.compose(r,e);return{target:m.constant(t),x:m.constant(n.x),y:m.constant(n.y),stop:e,prevent:r,kill:o,raw:m.constant(n)}},v=function(n){return 0===n.button},b=function(n){v(n)&&l.mousedown(h(n))},y=function(n){var t;((t=n).buttons===undefined||0!=(1&t.buttons))&&l.mouseover(h(n))},x=function(n){v&&l.mouseup(h(n))};n.on("mousedown",b),n.on("mouseover",y),n.on("mouseup",x),n.on("keyup",d),n.on("keydown",p),n.on("nodechange",function(){var t=n.selection,e=en.fromDom(t.getStart()),r=en.fromDom(t.getEnd()),i=Vt(e),u=Vt(r);i.bind(function(n){return u.bind(function(t){return ot.eq(n,t)?w.some(!0):w.none()})}).fold(function(){o.clear(a)},m.noop)}),r=w.some(e({mousedown:b,mouseover:y,mouseup:x,keyup:d,keydown:p}))}),{clear:o.clear,destroy:function(){r.each(function(n){})}}},Ws=function(n){return{get:function(){var t=sa.getBody(n);return mr(t,br.selectedSelector()).fold(function(){return n.selection.getStart()===undefined?xr.none():xr.single(n.selection)},function(n){return xr.multiple(n)})}}},_s=ba.each,Ms={addButtons:function(n){var t=[];function e(t){return function(){n.execCommand(t)}}_s("inserttable tableprops deletetable | cell row column".split(" "),function(e){"|"===e?t.push({text:"-"}):t.push(n.menuItems[e])}),n.addButton("table",{type:"menubutton",title:"Table",menu:t}),n.addButton("tableprops",{title:"Table properties",onclick:m.curry(Ta,n,!0),icon:"table"}),n.addButton("tabledelete",{title:"Delete table",onclick:e("mceTableDelete")}),n.addButton("tablecellprops",{title:"Cell properties",onclick:e("mceTableCellProps")}),n.addButton("tablemergecells",{title:"Merge cells",onclick:e("mceTableMergeCells")}),n.addButton("tablesplitcells",{title:"Split cell",onclick:e("mceTableSplitCells")}),n.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:e("mceTableInsertRowBefore")}),n.addButton("tableinsertrowafter",{title:"Insert row after",onclick:e("mceTableInsertRowAfter")}),n.addButton("tabledeleterow",{title:"Delete row",onclick:e("mceTableDeleteRow")}),n.addButton("tablerowprops",{title:"Row properties",onclick:e("mceTableRowProps")}),n.addButton("tablecutrow",{title:"Cut row",onclick:e("mceTableCutRow")}),n.addButton("tablecopyrow",{title:"Copy row",onclick:e("mceTableCopyRow")}),n.addButton("tablepasterowbefore",{title:"Paste row before",onclick:e("mceTablePasteRowBefore")}),n.addButton("tablepasterowafter",{title:"Paste row after",onclick:e("mceTablePasteRowAfter")}),n.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:e("mceTableInsertColBefore")}),n.addButton("tableinsertcolafter",{title:"Insert column after",onclick:e("mceTableInsertColAfter")}),n.addButton("tabledeletecol",{title:"Delete column",onclick:e("mceTableDeleteCol")})},addToolbars:function(n){var t=n.settings.table_toolbar;""!==t&&!1!==t&&(t||(t="tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"),n.addContextToolbar(function(t){return n.dom.is(t,"table")&&n.getBody().contains(t)},t))}},Ls={addMenuItems:function(n,t){var e=w.none(),r=[],o=[],i=[],u=[],a=function(n){n.disabled(!0)},c=function(n){n.disabled(!1)},l=function(){var n=this;r.push(n),e.fold(function(){a(n)},function(t){c(n)})},s=function(){var n=this;o.push(n),e.fold(function(){a(n)},function(t){c(n)})};n.on("init",function(){n.on("nodechange",function(l){var s=w.from(n.dom.getParent(n.selection.getStart(),"th,td"));(e=s.bind(function(n){var e=en.fromDom(n);return Vt(e).map(function(n){return kr.forMenu(t,n,e)})})).fold(function(){B.each(r,a),B.each(o,a),B.each(i,a),B.each(u,a)},function(n){B.each(r,c),B.each(o,c),B.each(i,function(t){t.disabled(n.mergable().isNone())}),B.each(u,function(t){t.disabled(n.unmergable().isNone())})})})});var f=function(n,t,e,r){var o,i,u,a,c,l=r.getEl().getElementsByTagName("table")[0],s=r.isRtl()||"tl-tr"===r.parent().rel;for(l.nextSibling.innerHTML=t+1+" x "+(e+1),s&&(t=9-t),i=0;i<10;i++)for(o=0;o<10;o++)a=l.rows[i].childNodes[o].firstChild,c=(s?o>=t:o<=t)&&i<=e,n.dom.toggleClass(a,"mce-active",c),c&&(u=a);return u.parentNode},d=!1===n.settings.table_grid?{text:"Table",icon:"table",context:"table",onclick:m.curry(Ta,n)}:{text:"Table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(t){t.aria&&(this.parent().hideAll(),t.stopImmediatePropagation(),Ta(n))},onshow:function(){f(n,0,0,this.menu.items()[0])},onhide:function(){var t=this.menu.items()[0].getEl().getElementsByTagName("a");n.dom.removeClass(t,"mce-active"),n.dom.addClass(t[0],"mce-active")},menu:[{type:"container",html:function(){var n="";n='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;t<10;t++){n+="<tr>";for(var e=0;e<10;e++)n+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+e)+'" href="#" data-mce-x="'+e+'" data-mce-y="'+t+'"></a></td>';n+="</tr>"}return n+="</table>",n+='<div class="mce-text-center" role="presentation">1 x 1</div>'}(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(t){var e,r,o=t.target;"A"===o.tagName.toUpperCase()&&(e=parseInt(o.getAttribute("data-mce-x"),10),r=parseInt(o.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"===this.parent().rel)&&(e=9-e),e===this.lastX&&r===this.lastY||(f(n,e,r,t.control),this.lastX=e,this.lastY=r))},onclick:function(t){var e=this;"A"===t.target.tagName.toUpperCase()&&(t.preventDefault(),t.stopPropagation(),e.parent().cancel(),n.undoManager.transact(function(){Pr.insert(n,e.lastX+1,e.lastY+1)}),n.addVisual())}}]};function g(t){return function(){n.execCommand(t)}}var p={text:"Table properties",context:"table",onPostRender:l,onclick:m.curry(Ta,n,!0)},h={text:"Delete table",context:"table",onPostRender:l,cmd:"mceTableDelete"},v={text:"Row",context:"table",menu:[{text:"Insert row before",onclick:g("mceTableInsertRowBefore"),onPostRender:s},{text:"Insert row after",onclick:g("mceTableInsertRowAfter"),onPostRender:s},{text:"Delete row",onclick:g("mceTableDeleteRow"),onPostRender:s},{text:"Row properties",onclick:g("mceTableRowProps"),onPostRender:s},{text:"-"},{text:"Cut row",onclick:g("mceTableCutRow"),onPostRender:s},{text:"Copy row",onclick:g("mceTableCopyRow"),onPostRender:s},{text:"Paste row before",onclick:g("mceTablePasteRowBefore"),onPostRender:s},{text:"Paste row after",onclick:g("mceTablePasteRowAfter"),onPostRender:s}]},b={text:"Column",context:"table",menu:[{text:"Insert column before",onclick:g("mceTableInsertColBefore"),onPostRender:s},{text:"Insert column after",onclick:g("mceTableInsertColAfter"),onPostRender:s},{text:"Delete column",onclick:g("mceTableDeleteCol"),onPostRender:s}]},y={separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:g("mceTableCellProps"),onPostRender:s},{text:"Merge cells",onclick:g("mceTableMergeCells"),onPostRender:function(){var n=this;i.push(n),e.fold(function(){a(n)},function(t){n.disabled(t.mergable().isNone())})}},{text:"Split cell",onclick:g("mceTableSplitCells"),onPostRender:function(){var n=this;u.push(n),e.fold(function(){a(n)},function(t){n.disabled(t.unmergable().isNone())})}}]};n.addMenuItem("inserttable",d),n.addMenuItem("tableprops",p),n.addMenuItem("deletetable",h),n.addMenuItem("row",v),n.addMenuItem("column",b),n.addMenuItem("cell",y)}};f.add("table",function(n){var t=oc(n),e=Ps(n,t.lazyResize),r=ha(n,t.lazyWire),o=Ws(n);Ia.registerCommands(n,r,e,o),Nr.registerEvents(n,o,r,e),Ls.addMenuItems(n,o),Ms.addButtons(n),Ms.addToolbars(n),n.on("PreInit",function(){n.serializer.addTempAttr(br.firstSelected()),n.serializer.addTempAttr(br.lastSelected())}),!1!==n.settings.table_tab_navigation&&n.on("keydown",function(e){ml.handle(e,n,r,t.lazyWire)}),n.on("remove",function(){t.destroy(),e.destroy()}),this.insertTable=function(t,e){return Pr.insert(n,t,e)},this.setClipboardRows=Ia.setClipboardRows,this.getClipboardRows=Ia.getClipboardRows})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),n=tinymce.util.Tools.resolve("tinymce.EditorManager"),i=tinymce.util.Tools.resolve("tinymce.Env"),o=tinymce.util.Tools.resolve("tinymce.util.Delay"),l=tinymce.util.Tools.resolve("tinymce.util.Tools"),u=tinymce.util.Tools.resolve("tinymce.util.VK"),r={getTabFocus:function(e){return e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))}},c=t.DOM,s=function(e){e.keyCode!==u.TAB||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()},a=function(e){function t(t){var s,a,y,f;if(!(t.keyCode!==u.TAB||t.ctrlKey||t.altKey||t.metaKey||t.isDefaultPrevented())&&(1===(y=l.explode(r.getTabFocus(e))).length&&(y[1]=y[0],y[0]=":prev"),a=t.shiftKey?":prev"===y[0]?m(-1):c.get(y[0]):":next"===y[1]?m(1):c.get(y[1]))){var d=n.get(a.id||a.name);a.id&&d?d.focus():o.setTimeout(function(){i.webkit||window.focus(),a.focus()},10),t.preventDefault()}function m(i){function o(e){return/INPUT|TEXTAREA|BUTTON/.test(e.tagName)&&n.get(t.id)&&-1!==e.tabIndex&&function i(e){return"BODY"===e.nodeName||"hidden"!==e.type&&"none"!==e.style.display&&"hidden"!==e.style.visibility&&i(e.parentNode)}(e)}if(a=c.select(":input:enabled,*[tabindex]:not(iframe)"),l.each(a,function(t,n){if(t.id===e.id)return s=n,!1}),i>0){for(f=s+1;f<a.length;f++)if(o(a[f]))return a[f]}else for(f=s-1;f>=0;f--)if(o(a[f]))return a[f];return null}}e.on("init",function(){e.inline&&c.setAttrib(e.getBody(),"tabIndex",null),e.on("keyup",s),i.gecko?e.on("keypress keydown",t):e.on("keydown",t)})};e.add("tabfocus",function(e){a(e)})}();!function(){"use strict";var e=function(t){var n=t,r=function(){return n};return{get:r,set:function(e){n=e},clone:function(){return e(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return!(!/(^|[ ,])tinymcespellchecker([, ]|$)/.test(e.settings.plugins)||!t.get("tinymcespellchecker")||("undefined"!=typeof window.console&&window.console.log&&window.console.log("Spell Checker Pro is incompatible with Spell Checker plugin! Remove 'spellchecker' from the 'plugins' option."),0))},r=function(e){return e.getParam("spellchecker_languages","English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr_FR,German=de,Italian=it,Polish=pl,Portuguese=pt_BR,Spanish=es,Swedish=sv")},o=function(e){var t=e.getParam("language","en");return e.getParam("spellchecker_language",t)},i=function(e){return e.getParam("spellchecker_rpc_url")},c=function(e){return e.getParam("spellchecker_callback")},a=function(e){var t=new RegExp('[^\\s!"#$%&()*+,-./:;<=>?@[\\]^_{|}`\xa7\xa9\xab\xae\xb1\xb6\xb7\xb8\xbb\xbc\xbd\xbe\xbf\xd7\xf7\xa4\u201d\u201c\u201e\xa0\u2002\u2003\u2009]+',"g");return e.getParam("spellchecker_wordchar_pattern",t)},l=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=tinymce.util.Tools.resolve("tinymce.util.URI"),u=tinymce.util.Tools.resolve("tinymce.util.XHR"),d=function(e){return e.fire("SpellcheckStart")},f=function(e){return e.fire("SpellcheckEnd")};function h(e){return e&&1===e.nodeType&&"false"===e.contentEditable}var g,m=function(e,t){var n,r,o,i,c,a=[],l=t.dom;function s(e,t){if(!e[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return{start:e.index,end:e.index+e[0].length,text:e[0],data:t}}function u(t){var n=e.getElementsByTagName("*"),r=[];t="number"==typeof t?""+t:null;for(var o=0;o<n.length;o++){var i=n[o],c=i.getAttribute("data-mce-index");null!==c&&c.length&&-1!==i.className.indexOf("mce-spellchecker-word")&&(c!==t&&null!==t||r.push(i))}return r}function d(e){for(var t=a.length;t--;)if(a[t]===e)return t;return-1}function f(e){for(var t=0,n=a.length;t<n&&!1!==e(a[t],t);t++);return this}function g(e){var t,n,r=u(e?d(e):null);for(t=r.length;t--;)(n=r[t]).parentNode.insertBefore(n.firstChild,n),n.parentNode.removeChild(n);return this}function m(e){var n=u(d(e)),r=t.dom.createRng();return r.setStartBefore(n[0]),r.setEndAfter(n[n.length-1]),r}return o=t.schema.getBlockElements(),i=t.schema.getWhiteSpaceElements(),c=t.schema.getShortEndedElements(),{text:r=function p(e){var t;if(3===e.nodeType)return e.data;if(i[e.nodeName]&&!o[e.nodeName])return"";if(h(e))return"\n";if(t="",(o[e.nodeName]||c[e.nodeName])&&(t+="\n"),e=e.firstChild)do{t+=p(e)}while(e=e.nextSibling);return t}(e),matches:a,each:f,filter:function(e){var t=[];return f(function(n,r){e(n,r)&&t.push(n)}),a=t,this},reset:function(){return a.splice(0,a.length),g(),this},matchFromElement:function(e){return a[e.getAttribute("data-mce-index")]},elementFromMatch:function(e){return u(d(e))[0]},find:function(e,t){if(r&&e.global)for(;n=e.exec(r);)a.push(s(n,t));return this},add:function(e,t,n){return a.push({start:e,end:e+t,text:r.substr(e,t),data:n}),this},wrap:function(t){return a.length&&function(e,t,n){var r,a,l,s,u,d=[],f=0,g=e,m=0;(t=t.slice(0)).sort(function(e,t){return e.start-t.start}),u=t.shift();e:for(;;){if((o[g.nodeName]||c[g.nodeName]||h(g))&&f++,3===g.nodeType&&(!a&&g.length+f>=u.end?(a=g,s=u.end-f):r&&d.push(g),!r&&g.length+f>u.start&&(r=g,l=u.start-f),f+=g.length),r&&a){if(g=n({startNode:r,startNodeIndex:l,endNode:a,endNodeIndex:s,innerNodes:d,match:u.text,matchIndex:m}),f-=a.length-s,r=null,a=null,d=[],m++,!(u=t.shift()))break}else if(i[g.nodeName]&&!o[g.nodeName]||!g.firstChild){if(g.nextSibling){g=g.nextSibling;continue}}else if(!h(g)){g=g.firstChild;continue}for(;;){if(g.nextSibling){g=g.nextSibling;break}if(g.parentNode===e)break e;g=g.parentNode}}}(e,a,function(e){function t(t,n){var r=a[n];r.stencil||(r.stencil=e(r));var o=r.stencil.cloneNode(!1);return o.setAttribute("data-mce-index",n),t&&o.appendChild(l.doc.createTextNode(t)),o}return function(e){var n,r,o,i=e.startNode,c=e.endNode,a=e.matchIndex,s=l.doc;if(i===c){var u=i;o=u.parentNode,e.startNodeIndex>0&&(n=s.createTextNode(u.data.substring(0,e.startNodeIndex)),o.insertBefore(n,u));var d=t(e.match,a);return o.insertBefore(d,u),e.endNodeIndex<u.length&&(r=s.createTextNode(u.data.substring(e.endNodeIndex)),o.insertBefore(r,u)),u.parentNode.removeChild(u),d}n=s.createTextNode(i.data.substring(0,e.startNodeIndex)),r=s.createTextNode(c.data.substring(e.endNodeIndex));for(var f=t(i.data.substring(e.startNodeIndex),a),h=[],g=0,m=e.innerNodes.length;g<m;++g){var p=e.innerNodes[g],v=t(p.data,a);p.parentNode.replaceChild(v,p),h.push(v)}var x=t(c.data.substring(0,e.endNodeIndex),a);return(o=i.parentNode).insertBefore(n,i),o.insertBefore(f,i),o.removeChild(i),(o=c.parentNode).insertBefore(x,c),o.insertBefore(r,c),o.removeChild(c),x}}(t)),this},unwrap:g,replace:function(e,n){var r=m(e);return r.deleteContents(),n.length>0&&r.insertNode(t.dom.doc.createTextNode(n)),r},rangeFromMatch:m,indexOf:d}},p=function(e,t){if(!t.get()){var n=m(e.getBody(),e);t.set(n)}return t.get()},v=function(e,t,n,r,o,a,d){var f,h,g,m=c(e);(m||(f=e,h=t,g=n,function(e,t,n,r){var o={method:e,lang:g.get()},c="";o["addToDictionary"===e?"word":"text"]=t,l.each(o,function(e,t){c&&(c+="&"),c+=t+"="+encodeURIComponent(e)}),u.send({url:new s(h).toAbsolute(i(f)),type:"post",content_type:"application/x-www-form-urlencoded",data:c,success:function(e){if(e=JSON.parse(e))e.error?r(e.error):n(e);else{var t=f.translate("Server response wasn't proper JSON.");r(t)}},error:function(){var e=f.translate("The spelling service was not found: (")+i(f)+f.translate(")");r(e)}})})).call(e.plugins.spellchecker,r,o,a,d)},x=function(e,t,n){e.dom.select("span.mce-spellchecker-word").length||N(e,t,n)},N=function(e,t,n){if(p(e,n).reset(),n.set(null),t.get())return t.set(!1),f(e),!0},k=function(e){var t=e.getAttribute("data-mce-index");return"number"==typeof t?""+t:t},y=function(e,t,n,r,o){var i,c;if(o.words?(c=!!o.dictionary,i=o.words):i=o,e.setProgressState(!1),function(e){for(var t in e)return!1;return!0}(i)){var l=e.translate("No misspellings found.");return e.notificationManager.open({text:l,type:"info"}),void t.set(!1)}r.set({suggestions:i,hasDictionarySupport:c}),p(e,n).find(a(e)).filter(function(e){return!!i[e.text]}).wrap(function(t){return e.dom.create("span",{"class":"mce-spellchecker-word","data-mce-bogus":1,"data-mce-word":t.text})}),t.set(!0),d(e)},S={spellcheck:function(e,t,n,r,o,i){N(e,n,r)||(e.setProgressState(!0),v(e,t,i,"spellcheck",p(e,r).text,function(t){y(e,n,r,o,t)},function(t){e.notificationManager.open({text:t,type:"error"}),e.setProgressState(!1),N(e,n,r)}),e.focus())},checkIfFinished:x,addToDictionary:function(e,t,n,r,o,i){e.setProgressState(!0),v(e,t,"addToDictionary",o,function(){e.setProgressState(!1),e.dom.remove(i,!0),x(e,n,r)},function(t){e.notificationManager.open({text:t,type:"error"}),e.setProgressState(!1)})},ignoreWord:function(e,t,n,r,o,i){e.selection.collapse(),i?l.each(e.dom.select("span.mce-spellchecker-word"),function(t){t.getAttribute("data-mce-word")===r&&e.dom.remove(t,!0)}):e.dom.remove(o,!0),x(e,t,n)},findSpansByIndex:function(e,t){var n,r=[];if((n=l.toArray(e.getBody().getElementsByTagName("span"))).length)for(var o=0;o<n.length;o++){var i=k(n[o]);null!==i&&i.length&&i===t.toString()&&r.push(n[o])}return r},getElmIndex:k,markErrors:y},w=function(e,t,n,r,i){return{getTextMatcher:function(){return r.get()},getWordCharPattern:function(){return a(e)},markErrors:function(o){S.markErrors(e,t,r,n,o)},getLanguage:function(){return o(e)}}},b=function(e,t,n,r,o,i){e.addCommand("mceSpellCheck",function(){S.spellcheck(e,t,n,r,o,i)})},T=function(e,t,n,i,c,a){var s,u,d,f,h=(d=e,s=l.map(r(d).split(","),function(e){return{name:(e=e.split("="))[0],value:e[1]}}),u=[],l.each(s,function(e){u.push({selectable:!0,text:e.name,data:e.value})}),u),g=function(){S.spellcheck(e,t,n,i,a,c)},m={tooltip:"Spellcheck",onclick:g,onPostRender:function(t){var r=t.control;e.on("SpellcheckStart SpellcheckEnd",function(){r.active(n.get())})}};h.length>1&&(m.type="splitbutton",m.menu=h,m.onshow=(f=e,function(e){var t=o(f);e.control.items().each(function(e){e.active(e.settings.data===t)})}),m.onselect=function(e){c.set(e.control.settings.data)}),e.addButton("spellchecker",m),e.addMenuItem("spellchecker",{text:"Spellcheck",context:"tools",onclick:g,selectable:!0,onPostRender:function(){var t=this;t.active(n.get()),e.on("SpellcheckStart SpellcheckEnd",function(){t.active(n.get())})}})},I=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),E=tinymce.util.Tools.resolve("tinymce.ui.Factory"),P=function(e,t,n,r,o){e.on("click",function(i){var c=i.target;if("mce-spellchecker-word"===c.className){i.preventDefault();var a=S.findSpansByIndex(e,S.getElmIndex(c));if(a.length>0){var s=e.dom.createRng();s.setStartBefore(a[0]),s.setEndAfter(a[a.length-1]),e.selection.setRng(s),function(e,t,n,r,o,i,c){var a=[],s=n.get().suggestions[i];l.each(s,function(t){a.push({text:t,onclick:function(){e.insertContent(e.dom.encode(t)),e.dom.remove(c),S.checkIfFinished(e,r,o)}})}),a.push({text:"-"}),n.get().hasDictionarySupport&&a.push({text:"Add to Dictionary",onclick:function(){S.addToDictionary(e,t,r,o,i,c)}}),a.push.apply(a,[{text:"Ignore",onclick:function(){S.ignoreWord(e,r,o,i,c)}},{text:"Ignore all",onclick:function(){S.ignoreWord(e,r,o,i,c,!0)}}]),(g=E.create("menu",{items:a,context:"contextmenu",onautohide:function(e){-1!==e.target.className.indexOf("spellchecker")&&e.preventDefault()},onhide:function(){g.remove(),g=null}})).renderTo(document.body);var u=I.DOM.getPos(e.getContentAreaContainer()),d=e.dom.getPos(c[0]),f=e.dom.getRoot();"BODY"===f.nodeName?(d.x-=f.ownerDocument.documentElement.scrollLeft||f.scrollLeft,d.y-=f.ownerDocument.documentElement.scrollTop||f.scrollTop):(d.x-=f.scrollLeft,d.y-=f.scrollTop),u.x+=d.x,u.y+=d.y,g.moveTo(u.x,u.y+c[0].offsetHeight)}(e,t,n,r,o,c.getAttribute("data-mce-word"),a)}}})};t.add("spellchecker",function(t,r){if(!1===n(t)){var i=e(!1),c=e(o(t)),a=e(null),l=e({});return T(t,r,i,a,c,l),P(t,r,l,i,a),b(t,r,i,a,l,c),w(t,i,l,a,r)}})}();!function(){"use strict";var e=function(t){var n=t,r=function(){return n};return{get:r,set:function(e){n=e},clone:function(){return e(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools");function r(e){return e&&1===e.nodeType&&"false"===e.contentEditable}var a={findAndReplaceDOMText:function(e,t,n,a,i){var o,d,c,l,s,u,f=[],p=0;function g(e,t){if(t=t||0,!e[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");var n=e.index;if(t>0){var r=e[t];if(!r)throw new Error("Invalid capture group");n+=e[0].indexOf(r),e[0]=r}return[n,n+e[0].length,[e[0]]]}if(c=t.ownerDocument,l=i.getBlockElements(),s=i.getWhiteSpaceElements(),u=i.getShortEndedElements(),d=function h(e){var t;if(3===e.nodeType)return e.data;if(s[e.nodeName]&&!l[e.nodeName])return"";if(t="",r(e))return"\n";if((l[e.nodeName]||u[e.nodeName])&&(t+="\n"),e=e.firstChild)do{t+=h(e)}while(e=e.nextSibling);return t}(t)){if(e.global)for(;o=e.exec(d);)f.push(g(o,a));else o=d.match(e),f.push(g(o,a));return f.length&&(p=f.length,function(e,t,n){var a,i,o,d,c=[],f=0,p=e,g=t.shift(),h=0;e:for(;;){if((l[p.nodeName]||u[p.nodeName]||r(p))&&f++,3===p.nodeType&&(!i&&p.length+f>=g[1]?(i=p,d=g[1]-f):a&&c.push(p),!a&&p.length+f>g[0]&&(a=p,o=g[0]-f),f+=p.length),a&&i){if(p=n({startNode:a,startNodeIndex:o,endNode:i,endNodeIndex:d,innerNodes:c,match:g[2],matchIndex:h}),f-=i.length-d,a=null,i=null,c=[],h++,!(g=t.shift()))break}else if(s[p.nodeName]&&!l[p.nodeName]||!p.firstChild){if(p.nextSibling){p=p.nextSibling;continue}}else if(!r(p)){p=p.firstChild;continue}for(;;){if(p.nextSibling){p=p.nextSibling;break}if(p.parentNode===e)break e;p=p.parentNode}}}(t,f,function(e){var t;if("function"!=typeof e){var n=e.nodeType?e:c.createElement(e);t=function(e,t){var r=n.cloneNode(!1);return r.setAttribute("data-mce-index",t),e&&r.appendChild(c.createTextNode(e)),r}}else t=e;return function(e){var n,r,a,i=e.startNode,o=e.endNode,d=e.matchIndex;if(i===o){var l=i;a=l.parentNode,e.startNodeIndex>0&&(n=c.createTextNode(l.data.substring(0,e.startNodeIndex)),a.insertBefore(n,l));var s=t(e.match[0],d);return a.insertBefore(s,l),e.endNodeIndex<l.length&&(r=c.createTextNode(l.data.substring(e.endNodeIndex)),a.insertBefore(r,l)),l.parentNode.removeChild(l),s}n=c.createTextNode(i.data.substring(0,e.startNodeIndex)),r=c.createTextNode(o.data.substring(e.endNodeIndex));for(var u=t(i.data.substring(e.startNodeIndex),d),f=[],p=0,g=e.innerNodes.length;p<g;++p){var h=e.innerNodes[p],m=t(h.data,d);h.parentNode.replaceChild(m,h),f.push(m)}var v=t(o.data.substring(0,e.endNodeIndex),d);return(a=i.parentNode).insertBefore(n,i),a.insertBefore(u,i),a.removeChild(i),(a=o.parentNode).insertBefore(v,o),a.insertBefore(r,o),a.removeChild(o),v}}(n))),p}}},i=function(e){var t=e.getAttribute("data-mce-index");return"number"==typeof t?""+t:t},o=function(e){var t=e.parentNode;e.firstChild&&t.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)},d=function(e,t){var r,a=[];if((r=n.toArray(e.getBody().getElementsByTagName("span"))).length)for(var o=0;o<r.length;o++){var d=i(r[o]);null!==d&&d.length&&d===t.toString()&&a.push(r[o])}return a},c=function(e,t,n){var r=t.get(),a=e.dom;(n=!1!==n)?r++:r--,a.removeClass(d(e,t.get()),"mce-match-marker-selected");var i=d(e,r);return i.length?(a.addClass(d(e,r),"mce-match-marker-selected"),e.selection.scrollIntoView(i[0]),r):-1},l=function(e,t){var n=t.parentNode;e.remove(t),e.isEmpty(n)&&e.remove(n)},s=function(e,t){var n=c(e,t,!0);-1!==n&&t.set(n)},u=function(e,t){var n=c(e,t,!1);-1!==n&&t.set(n)},f=function(e){var t=i(e);return null!==t&&t.length>0},p=function(e,t,r){var a,d,c,l;for(d=n.toArray(e.getBody().getElementsByTagName("span")),a=0;a<d.length;a++){var s=i(d[a]);null!==s&&s.length&&(s===t.get().toString()&&(c||(c=d[a].firstChild),l=d[a].firstChild),o(d[a]))}if(c&&l){var u=e.dom.createRng();return u.setStart(c,0),u.setEnd(l,l.data.length),!1!==r&&e.selection.setRng(u),u}},g=function(e,t){return d(e,t.get()+1).length>0},h=function(e,t){return d(e,t.get()-1).length>0},m={done:p,find:function(e,t,n,r,i){n=(n=n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")).replace(/\s/g,"\\s"),n=i?"\\b"+n+"\\b":n;var o,d,l,s,u,f=(o=e,d=t,l=new RegExp(n,r?"g":"gi"),(u=o.dom.create("span",{"data-mce-bogus":1})).className="mce-match-marker",s=o.getBody(),p(o,d,!1),a.findAndReplaceDOMText(l,s,u,!1,o.schema));return f&&(t.set(-1),t.set(c(e,t,!0))),f},next:s,prev:u,replace:function(e,t,r,a,d){var c,p,m,v,x,b,N=t.get();for(a=!1!==a,m=e.getBody(),p=n.grep(n.toArray(m.getElementsByTagName("span")),f),c=0;c<p.length;c++){var y=i(p[c]);if(v=x=parseInt(y,10),d||v===t.get()){for(r.length?(p[c].firstChild.nodeValue=r,o(p[c])):l(e.dom,p[c]);p[++c];){if((v=parseInt(i(p[c]),10))!==x){c--;break}l(e.dom,p[c])}a&&N--}else x>t.get()&&p[c].setAttribute("data-mce-index",x-1)}return t.set(N),a?(b=g(e,t),s(e,t)):(b=h(e,t),u(e,t)),!d&&b},hasNext:g,hasPrev:h},v=function(e,t){return{done:function(n){return m.done(e,t,n)},find:function(n,r,a){return m.find(e,t,n,r,a)},next:function(){return m.next(e,t)},prev:function(){return m.prev(e,t)},replace:function(n,r,a){return m.replace(e,t,n,r,a)}}},x=function(e,t){var r,a={};function i(){d.statusbar.find("#next").disabled(!1===m.hasNext(e,t)),d.statusbar.find("#prev").disabled(!1===m.hasPrev(e,t))}function o(){e.windowManager.alert("Could not find the specified string.",function(){d.find("#find")[0].focus()})}e.undoManager.add(),r=n.trim(e.selection.getContent({format:"text"}));var d=e.windowManager.open({layout:"flex",pack:"center",align:"center",onClose:function(){e.focus(),m.done(e,t),e.undoManager.add()},onSubmit:function(n){var r,c,l,s;return n.preventDefault(),c=d.find("#case").checked(),s=d.find("#words").checked(),(l=d.find("#find").value()).length?a.text===l&&a.caseState===c&&a.wholeWord===s?m.hasNext(e,t)?(m.next(e,t),void i()):void o():((r=m.find(e,t,l,c,s))||o(),d.statusbar.items().slice(1).disabled(0===r),i(),void(a={text:l,caseState:c,wholeWord:s})):(m.done(e,t,!1),void d.statusbar.items().slice(1).disabled(!0))},buttons:[{text:"Find",subtype:"primary",onclick:function(){d.submit()}},{text:"Replace",disabled:!0,onclick:function(){m.replace(e,t,d.find("#replace").value())||(d.statusbar.items().slice(1).disabled(!0),t.set(-1),a={})}},{text:"Replace all",disabled:!0,onclick:function(){m.replace(e,t,d.find("#replace").value(),!0,!0),d.statusbar.items().slice(1).disabled(!0),a={}}},{type:"spacer",flex:1},{text:"Prev",name:"prev",disabled:!0,onclick:function(){m.prev(e,t),i()}},{text:"Next",name:"next",disabled:!0,onclick:function(){m.next(e,t),i()}}],title:"Find and replace",items:{type:"form",padding:20,labelGap:30,spacing:10,items:[{type:"textbox",name:"find",size:40,label:"Find",value:r},{type:"textbox",name:"replace",size:40,label:"Replace with"},{type:"checkbox",name:"case",text:"Match case",label:" "},{type:"checkbox",name:"words",text:"Whole words",label:" "}]}})},b=function(e,t){e.addCommand("SearchReplace",function(){x(e,t)})},N=function(e,t){return function(){x(e,t)}},y=function(e,t){e.addMenuItem("searchreplace",{text:"Find and replace",shortcut:"Meta+F",onclick:N(e,t),separator:"before",context:"edit"}),e.addButton("searchreplace",{tooltip:"Find and replace",onclick:N(e,t)}),e.shortcuts.add("Meta+F","",N(e,t))};t.add("searchreplace",function(t){var n=e(-1);return b(t,n),y(t,n),v(t,n)})}();!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(n){return n.getParam("save_enablewhendirty",!0)},o=function(n){return!!n.getParam("save_onsavecallback")},c=function(n){return!!n.getParam("save_oncancelcallback")},i=function(n,e){n.notificationManager.open({text:n.translate(e),type:"error"})},r=function(n){var t;if(t=e.DOM.getParent(n.id,"form"),!a(n)||n.isDirty()){if(n.save(),o(n))return n.execCallback("save_onsavecallback",n),void n.nodeChanged();t?(n.setDirty(!1),t.onsubmit&&!t.onsubmit()||("function"==typeof t.submit?t.submit():i(n,"Error: Form submit field collision.")),n.nodeChanged()):i(n,"Error: No form element found.")}},l=function(n){var e=t.trim(n.startContent);c(n)?n.execCallback("save_oncancelcallback",n):(n.setContent(e),n.undoManager.clear(),n.nodeChanged())},d=function(n){n.addCommand("mceSave",function(){r(n)}),n.addCommand("mceCancel",function(){l(n)})},s=function(n){return function(e){var t=e.control;n.on("nodeChange dirty",function(){t.disabled(a(n)&&!n.isDirty())})}},u=function(n){n.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:s(n)}),n.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:s(n)}),n.addShortcut("Meta+S","","mceSave")};n.add("save",function(n){u(n),d(n)})}();!function(){"use strict";var t=function(t){t.addCommand("mcePrint",function(){t.getWin().print()})},n=function(t){t.addButton("print",{title:"Print",cmd:"mcePrint"}),t.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print"})};tinymce.util.Tools.resolve("tinymce.PluginManager").add("print",function(i){t(i),n(i),i.addShortcut("Meta+P","","mcePrint")})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return parseInt(e.getParam("plugin_preview_width","650"),10)},i=function(e){return parseInt(e.getParam("plugin_preview_height","500"),10)},o=function(e){return e.getParam("content_style","")},r=tinymce.util.Tools.resolve("tinymce.util.Tools"),c=function(e){var t="",n=e.dom.encode,i=o(e);t+='<base href="'+n(e.documentBaseURI.getURI())+'">',i&&(t+='<style type="text/css">'+i+"</style>"),r.each(e.contentCSS,function(i){t+='<link type="text/css" rel="stylesheet" href="'+n(e.documentBaseURI.toAbsolute(i))+'">'});var c=e.settings.body_id||"tinymce";-1!==c.indexOf("=")&&(c=(c=e.getParam("body_id","","hash"))[e.id]||c);var a=e.settings.body_class||"";-1!==a.indexOf("=")&&(a=(a=e.getParam("body_class","","hash"))[e.id]||"");var s=e.settings.directionality?' dir="'+e.settings.directionality+'"':"";return"<!DOCTYPE html><html><head>"+t+'</head><body id="'+n(c)+'" class="mce-content-body '+n(a)+'"'+n(s)+">"+e.getContent()+'<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A") {e.preventDefault();}}}, false);<\/script> </body></html>'},a=function(e,t,n){var i=c(e);if(n)t.src="data:text/html;charset=utf-8,"+encodeURIComponent(i);else{var o=t.contentWindow.document;o.open(),o.write(i),o.close()}},s=function(e){var o=!t.ie,r='<iframe src="javascript:\'\'" frameborder="0"'+(o?' sandbox="allow-scripts"':"")+"></iframe>",c=n(e),s=i(e);e.windowManager.open({title:"Preview",width:c,height:s,html:r,buttons:{text:"Close",onclick:function(e){e.control.parent().parent().close()}},onPostRender:function(t){var n=t.control.getEl("body").firstChild;a(e,n,o)}})},d=function(e){e.addCommand("mcePreview",function(){s(e)})},l=function(e){e.addButton("preview",{title:"Preview",cmd:"mcePreview"}),e.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})};e.add("preview",function(e){d(e),l(e)})}();!function(){"use strict";var e=function(t){var n=t,r=function(){return n};return{get:r,set:function(e){n=e},clone:function(){return e(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(e.settings.plugins)||!t.get("powerpaste")||("undefined"!=typeof window.console&&window.console.log&&window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))},r=function(e,t){return{clipboard:e,quirks:t}},a={firePastePreProcess:function(e,t,n,r){return e.fire("PastePreProcess",{content:t,internal:n,wordContent:r})},firePastePostProcess:function(e,t,n,r){return e.fire("PastePostProcess",{node:t,internal:n,wordContent:r})},firePastePlainTextToggle:function(e,t){return e.fire("PastePlainTextToggle",{state:t})},firePaste:function(e,t){return e.fire("paste",{ieFake:t})}},i={shouldPlainTextInform:function(e){return e.getParam("paste_plaintext_inform",!0)},shouldBlockDrop:function(e){return e.getParam("paste_block_drop",!1)},shouldPasteDataImages:function(e){return e.getParam("paste_data_images",!1)},shouldFilterDrop:function(e){return e.getParam("paste_filter_drop",!0)},getPreProcess:function(e){return e.getParam("paste_preprocess")},getPostProcess:function(e){return e.getParam("paste_postprocess")},getWebkitStyles:function(e){return e.getParam("paste_webkit_styles")},shouldRemoveWebKitStyles:function(e){return e.getParam("paste_remove_styles_if_webkit",!0)},shouldMergeFormats:function(e){return e.getParam("paste_merge_formats",!0)},isSmartPasteEnabled:function(e){return e.getParam("smart_paste",!0)},isPasteAsTextEnabled:function(e){return e.getParam("paste_as_text",!1)},getRetainStyleProps:function(e){return e.getParam("paste_retain_style_properties")},getWordValidElements:function(e){return e.getParam("paste_word_valid_elements","-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")},shouldConvertWordFakeLists:function(e){return e.getParam("paste_convert_word_fake_lists",!0)},shouldUseDefaultFilters:function(e){return e.getParam("paste_enable_default_filters",!0)}},o=function(e,t,n){var r,o,s;"text"===t.pasteFormat?(t.pasteFormat="html",a.firePastePlainTextToggle(e,!1)):(t.pasteFormat="text",a.firePastePlainTextToggle(e,!0),s=e,!1===n.get()&&i.shouldPlainTextInform(s)&&(o="Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",(r=e).notificationManager.open({text:r.translate(o),type:"info"}),n.set(!0))),e.focus()},s=function(e,t,n){e.addCommand("mceTogglePlainTextPaste",function(){o(e,t,n)}),e.addCommand("mceInsertClipboardContent",function(e,n){n.content&&t.pasteHtml(n.content,n.internal),n.text&&t.pasteText(n.text)})},l=tinymce.util.Tools.resolve("tinymce.Env"),u=tinymce.util.Tools.resolve("tinymce.util.Delay"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),f=tinymce.util.Tools.resolve("tinymce.util.VK"),d="x-tinymce/html",m="\x3c!-- "+d+" --\x3e",p={mark:function(e){return m+e},unmark:function(e){return e.replace(m,"")},isMarked:function(e){return-1!==e.indexOf(m)},internalHtmlMime:function(){return d}},g=tinymce.util.Tools.resolve("tinymce.html.Entities"),v=function(e){return e.replace(/\r?\n/g,"<br>")},h=function(e,t,n){var r=e.split(/\n\n/),a=function(e,t){var n,r=[],a="<"+e;if("object"==typeof t){for(n in t)t.hasOwnProperty(n)&&r.push(n+'="'+g.encodeAllRaw(t[n])+'"');r.length&&(a+=" "+r.join(" "))}return a+">"}(t,n),i="</"+t+">",o=c.map(r,function(e){return e.split(/\n/).join("<br />")});return 1===o.length?o[0]:c.map(o,function(e){return a+e+i}).join("")},P={isPlainText:function(e){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e)},convert:function(e,t,n){return t?h(e,t,n):v(e)},toBRs:v,toBlockElements:h},y=tinymce.util.Tools.resolve("tinymce.html.DomParser"),b=tinymce.util.Tools.resolve("tinymce.html.Node"),x=tinymce.util.Tools.resolve("tinymce.html.Schema"),w=tinymce.util.Tools.resolve("tinymce.html.Serializer");function T(e,t){return c.each(t,function(t){e=t.constructor===RegExp?e.replace(t,""):e.replace(t[0],t[1])}),e}var C={filter:T,innerText:function(e){var t=x(),n=y({},t),r="",a=t.getShortEndedElements(),i=c.makeMap("script noscript style textarea video audio iframe object"," "),o=t.getBlockElements();return e=T(e,[/<!\[[^\]]+\]>/g]),function s(e){var t=e.name,n=e;if("br"!==t)if(a[t]&&(r+=" "),i[t])r+=" ";else{if(3===e.type&&(r+=e.value),!e.shortEnded&&(e=e.firstChild))do{s(e)}while(e=e.next);o[t]&&n.next&&(r+="\n","p"===t&&(r+="\n"))}else r+="\n"}(n.parse(e)),r},trimHtml:function(e){return e=T(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,function(e,t,n){return t||n?"\xa0":" "}],/<br class="Apple-interchange-newline">/g,/<br>$/i])},createIdGenerator:function(e){var t=0;return function(){return e+t++}},isMsEdge:function(){return-1!==navigator.userAgent.indexOf(" Edge/")}};function _(e){var t,n;return n=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],e=e.replace(/^[\u00a0 ]+/,""),c.each(n,function(n){if(n.test(e))return t=!0,!1}),t}function D(e){var t,n,r=1;function a(e){var t="";if(3===e.type)return e.value;if(e=e.firstChild)do{t+=a(e)}while(e=e.next);return t}function i(e,t){if(3===e.type&&t.test(e.value))return e.value=e.value.replace(t,""),!1;if(e=e.firstChild)do{if(!i(e,t))return!1}while(e=e.next);return!0}function o(e,a,o){var s=e._listLevel||r;s!==r&&(s<r?t&&(t=t.parent.parent):(n=t,t=null)),t&&t.name===a?t.append(e):(n=n||t,t=new b(a,1),o>1&&t.attr("start",""+o),e.wrap(t)),e.name="li",s>r&&n&&n.lastChild.append(t),r=s,function l(e){if(e._listIgnore)e.remove();else if(e=e.firstChild)do{l(e)}while(e=e.next)}(e),i(e,/^\u00a0+/),i(e,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),i(e,/^\u00a0+/)}for(var s=[],l=e.firstChild;void 0!==l&&null!==l;)if(s.push(l),null!==(l=l.walk()))for(;void 0!==l&&l.parent!==e;)l=l.walk();for(var u=0;u<s.length;u++)if("p"===(e=s[u]).name&&e.firstChild){var c=a(e);if(/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(c)){o(e,"ul");continue}if(_(c)){var f=/([0-9]+)\./.exec(c),d=1;f&&(d=parseInt(f[1],10)),o(e,"ol",d);continue}if(e._listLevel){o(e,"ul",1);continue}t=null}else n=t,t=null}function k(e,t,n,r){var a,o={},s=e.dom.parseStyle(r);return c.each(s,function(s,l){switch(l){case"mso-list":(a=/\w+ \w+([0-9]+)/i.exec(r))&&(n._listLevel=parseInt(a[1],10)),/Ignore/i.test(s)&&n.firstChild&&(n._listIgnore=!0,n.firstChild._listIgnore=!0);break;case"horiz-align":l="text-align";break;case"vert-align":l="vertical-align";break;case"font-color":case"mso-foreground":l="color";break;case"mso-background":case"mso-highlight":l="background";break;case"font-weight":case"font-style":return void("normal"!==s&&(o[l]=s));case"mso-element":if(/^(comment|comment-list)$/i.test(s))return void n.remove()}0!==l.indexOf("mso-comment")?0!==l.indexOf("mso-")&&("all"===i.getRetainStyleProps(e)||t&&t[l])&&(o[l]=s):n.remove()}),/(bold)/i.test(o["font-weight"])&&(delete o["font-weight"],n.wrap(new b("b",1))),/(italic)/i.test(o["font-style"])&&(delete o["font-style"],n.wrap(new b("i",1))),(o=e.dom.serializeStyle(o,n.name))||null}var R={preProcess:function(e,t){return i.shouldUseDefaultFilters(e)?function(e,t){var n,r;(n=i.getRetainStyleProps(e))&&(r=c.makeMap(n.split(/[, ]/))),t=C.filter(t,[/<br class="?Apple-interchange-newline"?>/gi,/<b[^>]+id="?docs-internal-[^>]*>/gi,/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(e,t){return t.length>0?t.replace(/./," ").slice(Math.floor(t.length/2)).split("").join("\xa0"):""}]]);var a=i.getWordValidElements(e),o=x({valid_elements:a,valid_children:"-li[p]"});c.each(o.elements,function(e){e.attributes["class"]||(e.attributes["class"]={},e.attributesOrder.push("class")),e.attributes.style||(e.attributes.style={},e.attributesOrder.push("style"))});var s=y({},o);s.addAttributeFilter("style",function(t){for(var n,a=t.length;a--;)(n=t[a]).attr("style",k(e,r,n,n.attr("style"))),"span"===n.name&&n.parent&&!n.attributes.length&&n.unwrap()}),s.addAttributeFilter("class",function(e){for(var t,n,r=e.length;r--;)n=(t=e[r]).attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(n)&&t.remove(),t.attr("class",null)}),s.addNodeFilter("del",function(e){for(var t=e.length;t--;)e[t].remove()}),s.addNodeFilter("a",function(e){for(var t,n,r,a=e.length;a--;)if(n=(t=e[a]).attr("href"),r=t.attr("name"),n&&-1!==n.indexOf("#_msocom_"))t.remove();else if(n&&0===n.indexOf("file://")&&(n=n.split("#")[1])&&(n="#"+n),n||r){if(r&&!/^_?(?:toc|edn|ftn)/i.test(r)){t.unwrap();continue}t.attr({href:n,name:r})}else t.unwrap()});var l=s.parse(t);return i.shouldConvertWordFakeLists(e)&&D(l),t=w({validate:e.settings.validate},o).serialize(l)}(e,t):t},isWordContent:function(e){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(e)||/class="OutlineElement/.test(e)||/id="?docs\-internal\-guid\-/.test(e)}},E=function(e,t){return{content:e,cancelled:t}},F=function(e,t,n,r){var i,o,s,l,u,c,f=a.firePastePreProcess(e,t,n,r);return e.hasEventListeners("PastePostProcess")&&!f.isDefaultPrevented()?(i=e,o=f.content,s=n,l=r,u=i.dom.create("div",{style:"display:none"},o),c=a.firePastePostProcess(i,u,s,l),E(c.node.innerHTML,c.isDefaultPrevented())):E(f.content,f.isDefaultPrevented())},M={process:function(e,t,n){var r=R.isWordContent(t),a=r?R.preProcess(e,t):t;return F(e,a,n,r)}},S=function(e){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(e)},I=function(e){return S(e)&&/.(gif|jpe?g|png)$/.test(e)},A=function(e,t,n){return!(!1!==e.selection.isCollapsed()||!S(t)||(a=t,i=n,(r=e).undoManager.extra(function(){i(r,a)},function(){r.execCommand("mceInsertLink",!1,a)}),0));var r,a,i},O=function(e,t,n){return!!I(t)&&(a=t,i=n,(r=e).undoManager.extra(function(){i(r,a)},function(){r.insertContent('<img src="'+a+'">')}),!0);var r,a,i},B=function(e,t){return e.insertContent(t,{merge:i.shouldMergeFormats(e),paste:!0}),!0},H={isImageUrl:I,isAbsoluteUrl:S,insertContent:function(e,t){var n,r;!1===i.isSmartPasteEnabled(e)?B(e,t):(n=e,r=t,c.each([A,O,B],function(e){return!0!==e(n,r,B)}))}},N=function(e){var t,n,r,o,s,d,m=this,g=0,v=(t=e,r="%MCEPASTEBIN%",{create:function(){var e,a,i=t.dom,o=t.getBody(),s=t.dom.getViewPort(t.getWin()).y,u=20;if(n=t.selection.getRng(),t.inline&&(a=t.selection.getScrollContainer())&&a.scrollTop>0&&(s=a.scrollTop),n.getClientRects){var c=function(e){var t,r,a,o=e.startContainer;if((t=e.getClientRects()).length)return t[0];if(e.collapsed&&1===o.nodeType){for(a=o.childNodes[n.startOffset];a&&3===a.nodeType&&!a.data.length;)a=a.nextSibling;if(a)return"BR"===a.tagName&&(r=i.doc.createTextNode("\ufeff"),a.parentNode.insertBefore(r,a),(e=i.createRng()).setStartBefore(r),e.setEndAfter(r),t=e.getClientRects(),i.remove(r)),t.length?t[0]:void 0}}(n);if(c)u=s+(c.top-i.getPos(o).y);else{u=s;var f=n.startContainer;f&&(3===f.nodeType&&f.parentNode!==o&&(f=f.parentNode),1===f.nodeType&&(u=i.getPos(f,a||o).y))}}e=t.dom.add(t.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: absolute; top: "+u+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"},r),(l.ie||l.gecko)&&i.setStyle(e,"left","rtl"===i.getStyle(o,"direction",!0)?65535:-65535),i.bind(e,"beforedeactivate focusin focusout",function(e){e.stopPropagation()}),e.focus(),t.selection.select(e,!0)},remove:function(){if(o()){for(var e=void 0;e=t.dom.get("mcepastebin");)t.dom.remove(e),t.dom.unbind(e);n&&t.selection.setRng(n)}n=null},getEl:o=function(){return t.dom.get("mcepastebin")},getHtml:function(){var e,n,r,a,i,o=function(e,n){e.appendChild(n),t.dom.remove(n,!0)};for(n=c.grep(t.getBody().childNodes,function(e){return"mcepastebin"===e.id}),e=n.shift(),c.each(n,function(t){o(e,t)}),r=(a=t.dom.select("div[id=mcepastebin]",e)).length-1;r>=0;r--)i=t.dom.create("div"),e.insertBefore(i,a[r]),o(i,a[r]);return e?e.innerHTML:""},getLastRng:function(){return n},isDefault:function(){var e,t=o();return(e=t)&&"mcepastebin"===e.id&&s(t.innerHTML)},isDefaultContent:s=function(e){return e===r}}),h="data:text/mce-internal,",y=C.createIdGenerator("mceclip");function b(t,n){var r=n||p.isMarked(t),a=M.process(e,p.unmark(t),r);!1===a.cancelled&&H.insertContent(e,a.content)}function x(t){t=e.dom.encode(t).replace(/\r\n/g,"\n"),b(t=P.convert(t,e.settings.forced_root_block,e.settings.forced_root_block_attrs),!1)}function w(e){var t={};if(e){if(e.getData){var n=e.getData("Text");n&&n.length>0&&-1===n.indexOf(h)&&(t["text/plain"]=n)}if(e.types)for(var r=0;r<e.types.length;r++){var a=e.types[r];try{t[a]=e.getData(a)}catch(i){t[a]=""}}}return t}function T(e){return k(e,"text/html")||k(e,"text/plain")}function _(t,n,r){t&&(e.selection.setRng(t),t=null);var a,i,o,s,l,u,c=n.result,f=-1!==(i=(a=c).indexOf(","))?a.substr(i+1):null,d=y(),m=e.settings.images_reuse_filename&&r.name?(o=r.name,(s=o.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i))?e.dom.encode(s[1]):null):d,p=new Image;if(p.src=c,l=e.settings,u=p,!l.images_dataimg_filter||l.images_dataimg_filter(u)){var g,v=e.editorUpload.blobCache,h=void 0;(g=v.findFirst(function(e){return e.base64()===f}))?h=g:(h=v.create(d,r,f,m),v.add(h)),b('<img src="'+h.blobUri()+'">',!1)}else b('<img src="'+c+'">',!1)}function D(t,n){var r=t.clipboardData||t.dataTransfer;function a(e){var r,a,i,o=!1;if(e)for(r=0;r<e.length;r++)if(a=e[r],/^image\/(jpeg|png|gif|bmp)$/.test(a.type)){var s=a.getAsFile?a.getAsFile():a;(i=new window.FileReader).onload=_.bind(null,n,i,s),i.readAsDataURL(s),t.preventDefault(),o=!0}return o}if(e.settings.paste_data_images&&r)return a(r.items)||a(r.files)}function k(e,t){return t in e&&e[t].length>0}function R(e){return f.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode}function E(){function t(t,n,r,a){var i,o;k(t,"text/html")?i=t["text/html"]:(i=v.getHtml(),a=a||p.isMarked(i),v.isDefaultContent(i)&&(r=!0)),i=C.trimHtml(i),v.remove(),o=!1===a&&P.isPlainText(i),i.length&&!o||(r=!0),r&&(i=k(t,"text/plain")&&o?t["text/plain"]:C.innerText(i)),v.isDefaultContent(i)?n||e.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):r?x(i):b(i,a)}e.on("keydown",function(t){function n(e){R(e)&&!e.isDefaultPrevented()&&v.remove()}if(R(t)&&!t.isDefaultPrevented()){if((d=t.shiftKey&&86===t.keyCode)&&l.webkit&&-1!==navigator.userAgent.indexOf("Version/"))return;if(t.stopImmediatePropagation(),g=(new Date).getTime(),l.ie&&d)return t.preventDefault(),void a.firePaste(e,!0);v.remove(),v.create(),e.once("keyup",n),e.once("paste",function(){e.off("keyup",n)})}}),e.on("paste",function(n){var r,a,i=(new Date).getTime(),o=(r=w(n.clipboardData||e.getDoc().dataTransfer),C.isMsEdge()?c.extend(r,{"text/html":""}):r),s=(new Date).getTime()-i,f=(new Date).getTime()-g-s<1e3,h="text"===m.pasteFormat||d,P=k(o,p.internalHtmlMime());d=!1,n.isDefaultPrevented()||(a=n.clipboardData,-1!==navigator.userAgent.indexOf("Android")&&a&&a.items&&0===a.items.length)?v.remove():T(o)||!D(n,v.getLastRng()||e.selection.getRng())?(f||n.preventDefault(),!l.ie||f&&!n.ieFake||k(o,"text/html")||(v.create(),e.dom.bind(v.getEl(),"paste",function(e){e.stopPropagation()}),e.getDoc().execCommand("Paste",!1,null),o["text/html"]=v.getHtml()),k(o,"text/html")?(n.preventDefault(),P||(P=p.isMarked(o["text/html"])),t(o,f,h,P)):u.setEditorTimeout(e,function(){t(o,f,h,P)},0)):v.remove()})}m.pasteFormat=i.isPasteAsTextEnabled(e)?"text":"html",m.pasteHtml=b,m.pasteText=x,m.pasteImageData=D,m.getDataTransferItems=w,m.hasHtmlOrText=T,m.hasContentType=k,e.on("preInit",function(){var t;E(),e.parser.addNodeFilter("img",function(n,r,a){function i(e){e.attr("data-mce-object")||t===l.transparentSrc||e.remove()}if(!e.settings.paste_data_images&&(s=a).data&&!0===s.data.paste)for(var o=n.length;o--;)(t=n[o].attributes.map.src)&&(0===t.indexOf("webkit-fake-url")?i(n[o]):e.settings.allow_html_data_urls||0!==t.indexOf("data:")||i(n[o]));var s})})},L=function(){},$=function(e,t,n){if(r=e,!1!==l.iOS||r===undefined||"function"!=typeof r.setData||!0===C.isMsEdge())return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(p.internalHtmlMime(),t),!0}catch(a){return!1}var r},W=function(e,t,n,r){$(e.clipboardData,t.html,t.text)?(e.preventDefault(),r()):n(t.html,r)},j=function(e){return function(t,n){var r=p.mark(t),a=e.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),i=e.dom.create("div",{contenteditable:"true"},r);e.dom.setStyles(a,{position:"fixed",left:"-3000px",width:"1000px",overflow:"hidden"}),a.appendChild(i),e.dom.add(e.getBody(),a);var o=e.selection.getRng();i.focus();var s=e.dom.createRng();s.selectNodeContents(i),e.selection.setRng(s),setTimeout(function(){a.parentNode.removeChild(a),e.selection.setRng(o),n()},0)}},U=function(e){return{html:e.selection.getContent({contextual:!0}),text:e.selection.getContent({format:"text"})}},V=function(e){var t,n;e.on("cut",(t=e,function(e){!1===t.selection.isCollapsed()&&W(e,U(t),j(t),function(){setTimeout(function(){t.execCommand("Delete")},0)})})),e.on("copy",(n=e,function(e){!1===n.selection.isCollapsed()&&W(e,U(n),j(n),L)}))},z=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),K=function(e,t){return z.getCaretRangeFromPoint(t.clientX,t.clientY,e.getDoc())},G=function(e,t){e.focus(),e.selection.setRng(t)},X=function(e,t,n){i.shouldBlockDrop(e)&&e.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault(),e.stopPropagation()}),i.shouldPasteDataImages(e)||e.on("drop",function(e){var t=e.dataTransfer;t&&t.files&&t.files.length>0&&e.preventDefault()}),e.on("drop",function(r){var a,o;if(o=K(e,r),!r.isDefaultPrevented()&&!n.get()){a=t.getDataTransferItems(r.dataTransfer);var s,l=t.hasContentType(a,p.internalHtmlMime());if((t.hasHtmlOrText(a)&&(!(s=a["text/plain"])||0!==s.indexOf("file://"))||!t.pasteImageData(r,o))&&o&&i.shouldFilterDrop(e)){var c=a["mce-internal"]||a["text/html"]||a["text/plain"];c&&(r.preventDefault(),u.setEditorTimeout(e,function(){e.undoManager.transact(function(){a["mce-internal"]&&e.execCommand("Delete"),G(e,o),c=C.trimHtml(c),a["text/html"]?t.pasteHtml(c,l):t.pasteText(c)})}))}}}),e.on("dragstart",function(e){n.set(!0)}),e.on("dragover dragend",function(t){i.shouldPasteDataImages(e)&&!1===n.get()&&(t.preventDefault(),G(e,K(e,t))),"dragend"===t.type&&n.set(!1)})},q=function(e){var t=e.plugins.paste,n=i.getPreProcess(e);n&&e.on("PastePreProcess",function(e){n.call(t,t,e)});var r=i.getPostProcess(e);r&&e.on("PastePostProcess",function(e){r.call(t,t,e)})};function Y(e,t){e.on("PastePreProcess",function(n){n.content=t(e,n.content,n.internal,n.wordContent)})}function Z(e,t){if(!R.isWordContent(t))return t;var n=[];c.each(e.schema.getBlockElements(),function(e,t){n.push(t)});var r=new RegExp("(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?("+n.join("|")+")[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*","g");return t=C.filter(t,[[r,"$1"]]),t=C.filter(t,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function J(e,t,n,r){if(r||n)return t;var a=i.getWebkitStyles(e);if(!1===i.shouldRemoveWebKitStyles(e)||"all"===a)return t;if(a&&(a=a.split(/[, ]/)),a){var o=e.dom,s=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(e,t,n,r){var i=o.parseStyle(o.decode(n),"span"),l={};if("none"===a)return t+r;for(var u=0;u<a.length;u++){var c=i[a[u]],f=o.getStyle(s,a[u],!0);/color/.test(a[u])&&(c=o.toHex(c),f=o.toHex(f)),f!==c&&(l[a[u]]=c)}return(l=o.serializeStyle(l,"span"))?t+' style="'+l+'"'+r:t+r})}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(e,t,n,r){return t+' style="'+n+'"'+r})}function Q(e,t){e.$("a",t).find("font,u").each(function(t,n){e.dom.remove(n,!0)})}var ee=function(e){var t,n;l.webkit&&Y(e,J),l.ie&&(Y(e,Z),n=Q,(t=e).on("PastePostProcess",function(e){n(t,e.node)}))},te=function(e){return function(){return e}},ne=function(e){for(var t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[n-1]=arguments[n];return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var a=t.concat(n);return e.apply(null,a)}},re=(te(!1),te(!0),function(e,t){var n=ne((te(!1),te(!0),function(e,t,n){var r=n.control;r.active("text"===t.pasteFormat),e.on("PastePlainTextToggle",function(e){r.active(e.state)})}),e,t);e.addButton("pastetext",{active:!1,icon:"pastetext",tooltip:"Paste as text",cmd:"mceTogglePlainTextPaste",onPostRender:n}),e.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:t.pasteFormat,cmd:"mceTogglePlainTextPaste",onPostRender:n})}),ae=e(!1);t.add("paste",function(t){if(!1===n(t)){var a=new N(t),i=ee(t),o=e(!1);return re(t,a),s(t,a,ae),q(t),V(t),X(t,a,o),r(a,i)}})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return e.getParam("pagebreak_separator","\x3c!-- pagebreak --\x3e")},t=function(e){return e.getParam("pagebreak_split_block",!1)},r=function(){return"mce-pagebreak"},c=function(){return'<img src="'+a.transparentSrc+'" class="mce-pagebreak" data-mce-resize="false" data-mce-placeholder />'},o=function(e){var a=n(e),r=new RegExp(a.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi");e.on("BeforeSetContent",function(e){e.content=e.content.replace(r,c())}),e.on("PreInit",function(){e.serializer.addNodeFilter("img",function(n){for(var r,c,o=n.length;o--;)if((c=(r=n[o]).attr("class"))&&-1!==c.indexOf("mce-pagebreak")){var i=r.parent;if(e.schema.getBlockElements()[i.name]&&t(e)){i.type=3,i.value=a,i.raw=!0,r.remove();continue}r.type=3,r.value=a,r.raw=!0}})})},i=c,g=r,u=function(e){e.addCommand("mcePageBreak",function(){e.settings.pagebreak_split_block?e.insertContent("<p>"+i()+"</p>"):e.insertContent(i())})},m=function(e){e.on("ResolveName",function(a){"IMG"===a.target.nodeName&&e.dom.hasClass(a.target,g())&&(a.name="pagebreak")})},s=function(e){e.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),e.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"})};e.add("pagebreak",function(e){u(e),s(e),o(e),m(e)})}();!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(t){return t.getParam("noneditable_noneditable_class","mceNonEditable")},r=function(t){return t.getParam("noneditable_editable_class","mceEditable")},a=function(t){var n=t.getParam("noneditable_regexp",[]);return n&&n.constructor===RegExp?[n]:n},i=function(t){return function(n){return-1!==(" "+n.attr("class")+" ").indexOf(t)}},o=function(t,n,e){return function(r){var a=arguments,i=a[a.length-2],o=i>0?n.charAt(i-1):"";if('"'===o)return r;if(">"===o){var c=n.lastIndexOf("<",i);if(-1!==c&&-1!==n.substring(c,i).indexOf('contenteditable="false"'))return r}return'<span class="'+e+'" data-mce-content="'+t.dom.encode(a[0])+'">'+t.dom.encode("string"==typeof a[1]?a[1]:a[0])+"</span>"}},c=function(t){var c,l,u="contenteditable";c=" "+n.trim(r(t))+" ",l=" "+n.trim(e(t))+" ";var f=i(c),s=i(l),d=a(t);t.on("PreInit",function(){d.length>0&&t.on("BeforeSetContent",function(n){!function(t,n,r){var a=n.length,i=r.content;if("raw"!==r.format){for(;a--;)i=i.replace(n[a],o(t,i,e(t)));r.content=i}}(t,d,n)}),t.parser.addAttributeFilter("class",function(t){for(var n,e=t.length;e--;)n=t[e],f(n)?n.attr(u,"true"):s(n)&&n.attr(u,"false")}),t.serializer.addAttributeFilter(u,function(t){for(var n,e=t.length;e--;)n=t[e],(f(n)||s(n))&&(d.length>0&&n.attr("data-mce-content")?(n.name="#text",n.type=3,n.raw=!0,n.value=n.attr("data-mce-content")):n.attr(u,null))})})};t.add("noneditable",function(t){c(t)})}();!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(n,e){var t,a=(t=n).plugins.visualchars&&t.plugins.visualchars.isEnabled()?'<span class="mce-nbsp">&nbsp;</span>':"&nbsp;";n.insertContent(function(n,e){for(var t="",a=0;a<e;a++)t+=n;return t}(a,e)),n.dom.setAttrib(n.dom.select("span.mce-nbsp"),"data-mce-bogus","1")},t=function(n){n.addCommand("mceNonBreaking",function(){e(n,1)})},a=tinymce.util.Tools.resolve("tinymce.util.VK"),i=function(n){var e=n.getParam("nonbreaking_force_tab",0);return"boolean"==typeof e?!0===e?3:0:e},o=function(n){var t=i(n);t>0&&n.on("keydown",function(i){if(i.keyCode===a.TAB&&!i.isDefaultPrevented()){if(i.shiftKey)return;i.preventDefault(),i.stopImmediatePropagation(),e(n,t)}})},r=function(n){n.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),n.addMenuItem("nonbreaking",{text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"})};n.add("nonbreaking",function(n){t(n),r(n),o(n)})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(e){return e.getParam("media_scripts")},a=function(e){return e.getParam("audio_template_callback")},o=function(e){return e.getParam("video_template_callback")},n=function(e){return e.getParam("media_live_embeds",!0)},c=function(e){return e.getParam("media_filter_html",!0)},s=function(e){return e.getParam("media_url_resolver")},u=function(e){return e.getParam("media_alt_source",!0)},l=function(e){return e.getParam("media_poster",!0)},m=function(e){return e.getParam("media_dimensions",!0)},d=tinymce.util.Tools.resolve("tinymce.html.SaxParser"),h=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),p=function(e,t){if(e)for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r].filter))return e[r]},f=function(e){return function(t){return t?t.style[e].replace(/px$/,""):""}},g=function(e){return function(t,r){var i;t&&(t.style[e]=/^[0-9.]+$/.test(i=r)?i+"px":i)}},w={getMaxWidth:f("maxWidth"),getMaxHeight:f("maxHeight"),setMaxWidth:g("maxWidth"),setMaxHeight:g("maxHeight")},v=h.DOM,b=function(e){return v.getAttrib(e,"data-ephox-embed-iri")},y=function(e,t){return s=t,u=v.createFragment(s),""!==b(u.firstChild)?(n=t,c=v.createFragment(n).firstChild,{type:"ephox-embed-iri",source1:b(c),source2:"",poster:"",width:w.getMaxWidth(c),height:w.getMaxHeight(c)}):(i=e,a=t,o={},new d({validate:!1,allow_conditional_comments:!0,special:"script,noscript",start:function(e,t){if(o.source1||"param"!==e||(o.source1=t.map.movie),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(o.type||(o.type=e),o=r.extend(t.map,o)),"script"===e){var a=p(i,t.map.src);if(!a)return;o={type:"script",source1:t.map.src,width:a.width,height:a.height}}"source"===e&&(o.source1?o.source2||(o.source2=t.map.src):o.source1=t.map.src),"img"!==e||o.poster||(o.poster=t.map.src)}}).parse(a),o.source1=o.source1||o.src||o.data,o.source2=o.source2||"",o.poster=o.poster||"",o);var i,a,o,n,c,s,u},x=tinymce.util.Tools.resolve("tinymce.util.Promise"),j=function(e){var t={mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"}[e.toLowerCase().split(".").pop()];return t||""},M=tinymce.util.Tools.resolve("tinymce.html.Writer"),_=tinymce.util.Tools.resolve("tinymce.html.Schema"),C=h.DOM,S=function(e,t){var r,i,a,o;for(r in t)if(a=""+t[r],e.map[r])for(i=e.length;i--;)(o=e[i]).name===r&&(a?(e.map[r]=a,o.value=a):(delete e.map[r],e.splice(i,1)));else a&&(e.push({name:r,value:a}),e.map[r]=a)},k=function(e,t){var r,i,a=C.createFragment(e).firstChild;return w.setMaxWidth(a,t.width),w.setMaxHeight(a,t.height),r=a.outerHTML,i=M(),new d(i).parse(r),i.getContent()},A=function(e,t,r){return u=e,l=C.createFragment(u),""!==C.getAttrib(l.firstChild,"data-ephox-embed-iri")?k(e,t):(i=e,a=t,o=r,c=M(),s=0,new d({validate:!1,allow_conditional_comments:!0,special:"script,noscript",comment:function(e){c.comment(e)},cdata:function(e){c.cdata(e)},text:function(e,t){c.text(e,t)},start:function(e,t,r){switch(e){case"video":case"object":case"embed":case"img":case"iframe":a.height!==undefined&&a.width!==undefined&&S(t,{width:a.width,height:a.height})}if(o)switch(e){case"video":S(t,{poster:a.poster,src:""}),a.source2&&S(t,{src:""});break;case"iframe":S(t,{src:a.source1});break;case"source":if(++s<=2&&(S(t,{src:a["source"+s],type:a["source"+s+"mime"]}),!a["source"+s]))return;break;case"img":if(!a.poster)return;n=!0}c.start(e,t,r)},end:function(e){if("video"===e&&o)for(var t=1;t<=2;t++)if(a["source"+t]){var r=[];r.map={},s<t&&(S(r,{src:a["source"+t],type:a["source"+t+"mime"]}),c.start("source",r,!0))}if(a.poster&&"object"===e&&o&&!n){var i=[];i.map={},S(i,{src:a.poster,width:a.width,height:a.height}),c.start("img",i,!0)}c.end(e)}},_({})).parse(i),c.getContent());var i,a,o,n,c,s,u,l},F=[{regex:/youtu\.be\/([\w\-.]+)/,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)/,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$2",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\-_]+(?:\?.+)?)/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowfullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&amp;byline=0",allowfullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],N=function(e,t){var n=r.extend({},t);if(!n.source1&&(r.extend(n,y(i(e),n.embed)),!n.source1))return"";if(n.source2||(n.source2=""),n.poster||(n.poster=""),n.source1=e.convertURL(n.source1,"source"),n.source2=e.convertURL(n.source2,"source"),n.source1mime=j(n.source1),n.source2mime=j(n.source2),n.poster=e.convertURL(n.poster,"poster"),r.each(F,function(e){var t,r,i=e.regex.exec(n.source1);if(i){for(r=e.url,t=0;i[t];t++)r=r.replace("$"+t,function(){return i[t]});n.source1=r,n.type=e.type,n.allowFullscreen=e.allowFullscreen,n.width=n.width||e.w,n.height=n.height||e.h}}),n.embed)return A(n.embed,n,!0);var c=p(i(e),n.source1);c&&(n.type="script",n.width=c.width,n.height=c.height);var s,u,l,m,d,h,f,g,w=a(e),v=o(e);return n.width=n.width||300,n.height=n.height||150,r.each(n,function(t,r){n[r]=e.dom.encode(t)}),"iframe"===n.type?(g=(f=n).allowFullscreen?' allowFullscreen="1"':"",'<iframe src="'+f.source1+'" width="'+f.width+'" height="'+f.height+'"'+g+"></iframe>"):"application/x-shockwave-flash"===n.source1mime?(h='<object data="'+(d=n).source1+'" width="'+d.width+'" height="'+d.height+'" type="application/x-shockwave-flash">',d.poster&&(h+='<img src="'+d.poster+'" width="'+d.width+'" height="'+d.height+'" />'),h+="</object>"):-1!==n.source1mime.indexOf("audio")?(l=n,(m=w)?m(l):'<audio controls="controls" src="'+l.source1+'">'+(l.source2?'\n<source src="'+l.source2+'"'+(l.source2mime?' type="'+l.source2mime+'"':"")+" />\n":"")+"</audio>"):"script"===n.type?'<script src="'+n.source1+'"><\/script>':(s=n,(u=v)?u(s):'<video width="'+s.width+'" height="'+s.height+'"'+(s.poster?' poster="'+s.poster+'"':"")+' controls="controls">\n<source src="'+s.source1+'"'+(s.source1mime?' type="'+s.source1mime+'"':"")+" />\n"+(s.source2?'<source src="'+s.source2+'"'+(s.source2mime?' type="'+s.source2mime+'"':"")+" />\n":"")+"</video>")},O={},P=function(e){return function(t){return N(e,t)}},T=function(e,t){var r,i,a,o,n,c=s(e);return c?(a=t,o=P(e),n=c,new x(function(e,t){var r=function(t){return t.html&&(O[a.source1]=t),e({url:a.source1,html:t.html?t.html:o(a)})};O[a.source1]?r(O[a.source1]):n({url:a.source1},r,t)})):(r=t,i=P(e),new x(function(e){e({html:i(r),url:r.source1})}))},z=function(e){return O.hasOwnProperty(e)},$=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},L=function(e,t){var r=e.find("#width")[0],i=e.find("#height")[0],a=e.find("#constrain")[0];r&&i&&a&&t(r,i,a.checked())},H=function(e,t,r){var i=e.state.get("oldVal"),a=t.state.get("oldVal"),o=e.value(),n=t.value();r&&i&&a&&o&&n&&(o!==i?(n=Math.round(o/i*n),isNaN(n)||t.value(n)):(o=Math.round(n/a*o),isNaN(o)||e.value(o))),$(e,t)},W=function(e){L(e,H)},J=function(e){var t=function(){e(function(e){W(e)})};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},R=function(e){L(e,$)},D=W,E=t.ie&&t.ie<=8?"onChange":"onInput",I=function(e){return function(t){var r=t&&t.msg?"Media embed handler error: "+t.msg:"Media embed handler threw unknown error.";e.notificationManager.open({type:"error",text:r})}},U=function(e,t){return function(a){var o=a.html,n=e.find("#embed")[0],c=r.extend(y(i(t),o),{source1:a.url});e.fromJSON(c),n&&(n.value(o),D(e))}},V=function(e,t){var r=e.dom.select("img[data-mce-object]");e.insertContent(t),function(e,t){var r,i,a=e.dom.select("img[data-mce-object]");for(r=0;r<t.length;r++)for(i=a.length-1;i>=0;i--)t[r]===a[i]&&a.splice(i,1);e.selection.select(a[0])}(e,r),e.nodeChanged()},B=function(e){var t,a,o,n,c,s=[{name:"source1",type:"filepicker",filetype:"media",size:40,autofocus:!0,label:"Source",onpaste:function(){setTimeout(function(){T(e,t.toJSON()).then(U(t,e))["catch"](I(e))},1)},onchange:function(i){var a,o;T(e,t.toJSON()).then(U(t,e))["catch"](I(e)),a=t,o=i.meta,r.each(o,function(e,t){a.find("#"+t).value(e)})},onbeforecall:function(e){e.meta=t.toJSON()}}],d=[];if(u(e)&&d.push({name:"source2",type:"filepicker",filetype:"media",size:40,label:"Alternative source"}),l(e)&&d.push({name:"poster",type:"filepicker",filetype:"image",size:40,label:"Poster"}),m(e)){var h=J(function(e){e(t),a=t.toJSON(),t.find("#embed").value(A(a.embed,a))});s.push(h)}n=(o=e).selection.getNode(),c=n.getAttribute("data-ephox-embed-iri"),a=c?{source1:c,"data-ephox-embed-iri":c,width:w.getMaxWidth(n),height:w.getMaxHeight(n)}:n.getAttribute("data-mce-object")?y(i(o),o.serializer.serialize(n,{selection:!0})):{};var p={id:"mcemediasource",type:"textbox",flex:1,name:"embed",value:function(e){var t=e.selection.getNode();if(t.getAttribute("data-mce-object")||t.getAttribute("data-ephox-embed-iri"))return e.selection.getContent()}(e),multiline:!0,rows:5,label:"Source"};p[E]=function(){a=r.extend({},y(i(e),this.value())),this.parent().parent().fromJSON(a)},t=e.windowManager.open({title:"Insert/edit media",data:a,bodyType:"tabpanel",body:[{title:"General",type:"form",items:s},{title:"Embed",type:"container",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,items:[{type:"label",text:"Paste your embed code below:",forId:"mcemediasource"},p]},{title:"Advanced",type:"form",items:d}],onSubmit:function(){var r,i;D(t),r=e,(i=t.toJSON()).embed=A(i.embed,i),i.embed&&z(i.source1)?V(r,i.embed):T(r,i).then(function(e){V(r,e.html)})["catch"](I(r))}}),R(t)},G=function(e){return{showDialog:function(){B(e)}}},q=function(e){e.addCommand("mceMedia",function(){B(e)})},K=tinymce.util.Tools.resolve("tinymce.html.Node"),Q=function(e,t){if(!1===c(e))return t;var r,i=M();return new d({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(e){i.comment(e)},cdata:function(e){i.cdata(e)},text:function(e,t){i.text(e,t)},start:function(t,a,o){if(r=!0,"script"!==t&&"noscript"!==t){for(var n=0;n<a.length;n++){if(0===a[n].name.indexOf("on"))return;"style"===a[n].name&&(a[n].value=e.dom.serializeStyle(e.dom.parseStyle(a[n].value),t))}i.start(t,a,o),r=!1}},end:function(e){r||i.end(e)}},_({})).parse(t),i.getContent()},X=function(e,r){var i,a=r.name;return(i=new K("img",1)).shortEnded=!0,Z(e,r,i),i.attr({width:r.attr("width")||"300",height:r.attr("height")||("audio"===a?"30":"150"),style:r.attr("style"),src:t.transparentSrc,"data-mce-object":a,"class":"mce-object mce-object-"+a}),i},Y=function(e,t){var r,i,a,o=t.name;return(r=new K("span",1)).attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":o,"class":"mce-preview-object mce-object-"+o}),Z(e,t,r),(i=new K(o,1)).attr({src:t.attr("src"),allowfullscreen:t.attr("allowfullscreen"),width:t.attr("width")||"300",height:t.attr("height")||("audio"===o?"30":"150"),frameborder:"0"}),(a=new K("span",1)).attr("class","mce-shim"),r.append(i),r.append(a),r},Z=function(e,t,r){var i,a,o,n,c;for(n=(o=t.attributes).length;n--;)i=o[n].name,a=o[n].value,"width"!==i&&"height"!==i&&"style"!==i&&("data"!==i&&"src"!==i||(a=e.convertURL(a,i)),r.attr("data-mce-p-"+i,a));(c=t.firstChild&&t.firstChild.value)&&(r.attr("data-mce-html",escape(Q(e,c))),r.firstChild=null)},ee=function(e){for(;e=e.parent;)if(e.attr("data-ephox-embed-iri"))return!0;return!1},te=function(e){return function(r){for(var a,o,c=r.length;c--;)(a=r[c]).parent&&(a.parent.attr("data-mce-object")||("script"!==a.name||(o=p(i(e),a.attr("src"))))&&(o&&(o.width&&a.attr("width",o.width.toString()),o.height&&a.attr("height",o.height.toString())),"iframe"===a.name&&n(e)&&t.ceFalse?ee(a)||a.replace(Y(e,a)):ee(a)||a.replace(X(e,a))))}},re=function(e){e.on("preInit",function(){var t=e.schema.getSpecialElements();r.each("video audio iframe object".split(" "),function(e){t[e]=new RegExp("</"+e+"[^>]*>","gi")});var i=e.schema.getBoolAttrs();r.each("webkitallowfullscreen mozallowfullscreen allowfullscreen".split(" "),function(e){i[e]={}}),e.parser.addNodeFilter("iframe,video,audio,object,embed,script",te(e)),e.serializer.addAttributeFilter("data-mce-object",function(t,r){for(var i,a,o,n,c,s,u,l,m=t.length;m--;)if((i=t[m]).parent){for(u=i.attr(r),a=new K(u,1),"audio"!==u&&"script"!==u&&((l=i.attr("class"))&&-1!==l.indexOf("mce-preview-object")?a.attr({width:i.firstChild.attr("width"),height:i.firstChild.attr("height")}):a.attr({width:i.attr("width"),height:i.attr("height")})),a.attr({style:i.attr("style")}),o=(n=i.attributes).length;o--;){var d=n[o].name;0===d.indexOf("data-mce-p-")&&a.attr(d.substr(11),n[o].value)}"script"===u&&a.attr("type","text/javascript"),(c=i.attr("data-mce-html"))&&((s=new K("#text",3)).raw=!0,s.value=Q(e,unescape(c)),a.append(s)),i.replace(a)}})}),e.on("setContent",function(){e.$("span.mce-preview-object").each(function(t,r){var i=e.$(r);0===i.find("span.mce-shim",r).length&&i.append('<span class="mce-shim"></span>')})})},ie=function(e){e.on("ResolveName",function(e){var t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)})},ae=function(e){e.on("click keyup",function(){var t=e.selection.getNode();t&&e.dom.hasClass(t,"mce-preview-object")&&e.dom.getAttrib(t,"data-mce-selected")&&t.setAttribute("data-mce-selected","2")}),e.on("ObjectSelected",function(e){var t=e.target.getAttribute("data-mce-object");"audio"!==t&&"script"!==t||e.preventDefault()}),e.on("objectResized",function(e){var t,r=e.target;r.getAttribute("data-mce-object")&&(t=r.getAttribute("data-mce-html"))&&(t=unescape(t),r.setAttribute("data-mce-html",escape(A(t,{width:e.width,height:e.height}))))})},oe=function(e){e.addButton("media",{tooltip:"Insert/edit media",cmd:"mceMedia",stateSelector:["img[data-mce-object]","span[data-mce-object]","div[data-ephox-embed-iri]"]}),e.addMenuItem("media",{icon:"media",text:"Media",cmd:"mceMedia",context:"insert",prependToContext:!0})};e.add("media",function(e){return q(e),oe(e),ie(e),re(e),ae(e),G(e)})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),n=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),o=tinymce.util.Tools.resolve("tinymce.util.VK"),r=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager"),i=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=function(e){return e&&"BR"===e.nodeName},d=function(e){return e&&3===e.nodeType},l=function(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)},c=function(e){return e&&/^(LI|DT|DD)$/.test(e.nodeName)},f=function(e){return e&&/^(TH|TD)$/.test(e.nodeName)},u=s,m=function(e){return e.parentNode.firstChild===e},g=function(e){return e.parentNode.lastChild===e},p=function(e,t){return t&&!!e.schema.getTextBlockElements()[t.nodeName]},v=function(e,t){return e&&e.nodeName in t},h=function(e,t){return!!s(t)&&!(!e.isBlock(t.nextSibling)||s(t.previousSibling))},C=function(e,t,n){var o=e.isEmpty(t);return!(n&&e.select("span[data-mce-type=bookmark]",t).length>0)&&o},y=function(e,t){return e.isChildOf(t,e.getRoot())},N=function(e,n){var o=t.getNode(e,n);return c(e)&&d(o)?{container:o,offset:n>=e.childNodes.length?o.data.length:0}:{container:e,offset:n}},L=function(e){var t=e.cloneRange(),n=N(e.startContainer,e.startOffset);t.setStart(n.container,n.offset);var o=N(e.endContainer,e.endOffset);return t.setEnd(o.container,o.offset),t},S=a.DOM,b=function(e){var t={},n=function(n){var o,r,i;r=e[n?"startContainer":"endContainer"],i=e[n?"startOffset":"endOffset"],1===r.nodeType&&(o=S.create("span",{"data-mce-type":"bookmark"}),r.hasChildNodes()?(i=Math.min(i,r.childNodes.length-1),n?r.insertBefore(o,r.childNodes[i]):S.insertAfter(o,r.childNodes[i])):r.appendChild(o),r=o,i=0),t[n?"startContainer":"endContainer"]=r,t[n?"startOffset":"endOffset"]=i};return n(!0),e.collapsed||n(),t},D=function(e){function t(t){var n,o,r;n=r=e[t?"startContainer":"endContainer"],o=e[t?"startOffset":"endOffset"],n&&(1===n.nodeType&&(o=function(e){for(var t=e.parentNode.firstChild,n=0;t;){if(t===e)return n;1===t.nodeType&&"bookmark"===t.getAttribute("data-mce-type")||n++,t=t.nextSibling}return-1}(n),n=n.parentNode,S.remove(r),!n.hasChildNodes()&&S.isBlock(n)&&n.appendChild(S.create("br"))),e[t?"startContainer":"endContainer"]=n,e[t?"startOffset":"endOffset"]=o)}t(!0),t();var n=S.createRng();return n.setStart(e.startContainer,e.startOffset),e.endContainer&&n.setEnd(e.endContainer,e.endOffset),L(n)},k=a.DOM,T=function(e,t){var n,o=t.parentNode;"LI"===o.nodeName&&o.firstChild===t&&((n=o.previousSibling)&&"LI"===n.nodeName?(n.appendChild(t),C(e,o)&&k.remove(o)):k.setStyle(o,"listStyleType","none")),l(o)&&(n=o.previousSibling)&&"LI"===n.nodeName&&n.appendChild(t)},I=function(e,t){i.each(i.grep(e.select("ol,ul",t)),function(t){T(e,t)})},B=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),R=function(e){var t=e.selection.getStart(!0);return e.dom.getParent(t,"OL,UL,DL",O(e,t))},O=function(e,t){var n=e.dom.getParents(t,"TD,TH");return n.length>0?n[0]:e.getBody()},E={getParentList:R,getSelectedSubLists:function(e){var t,n,o,r=R(e),a=e.selection.getSelectedBlocks();return o=a,(n=r)&&1===o.length&&o[0]===n?(t=r,i.grep(t.querySelectorAll("ol,ul,dl"),function(e){return l(e)})):i.grep(a,function(e){return l(e)&&r!==e})},getSelectedListItems:function(e){var t,n,o,r=e.selection.getSelectedBlocks();return i.grep((t=e,n=r,o=i.map(n,function(e){var n=t.dom.getParent(e,"li,dd,dt",O(t,e));return n||e}),B.unique(o)),function(e){return c(e)})},getClosestListRootElm:O},A=tinymce.util.Tools.resolve("tinymce.Env"),P=a.DOM,x=function(e,t,n){var o,r,i,a=P.createFragment(),s=e.schema.getBlockElements();if(e.settings.forced_root_block&&(n=n||e.settings.forced_root_block),n&&((r=P.create(n)).tagName===e.settings.forced_root_block&&P.setAttribs(r,e.settings.forced_root_block_attrs),v(t.firstChild,s)||a.appendChild(r)),t)for(;o=t.firstChild;){var d=o.nodeName;i||"SPAN"===d&&"bookmark"===o.getAttribute("data-mce-type")||(i=!0),v(o,s)?(a.appendChild(o),r=null):n?(r||(r=P.create(n),a.appendChild(r)),r.appendChild(o)):a.appendChild(o)}return e.settings.forced_root_block?i||A.ie&&!(A.ie>10)||r.appendChild(P.create("br",{"data-mce-bogus":"1"})):a.appendChild(P.create("br")),a},_=a.DOM,M=function(e,t,n,o){var r,a,s,d,l;for(s=_.select('span[data-mce-type="bookmark"]',t),o=o||x(e,n),(r=_.createRng()).setStartAfter(n),r.setEndAfter(t),d=(a=r.extractContents()).firstChild;d;d=d.firstChild)if("LI"===d.nodeName&&e.dom.isEmpty(d)){_.remove(d);break}e.dom.isEmpty(a)||_.insertAfter(a,t),_.insertAfter(o,t),C(e.dom,n.parentNode)&&(l=n.parentNode,i.each(s,function(e){l.parentNode.insertBefore(e,n.parentNode)}),_.remove(l)),_.remove(n),C(e.dom,t)&&_.remove(t)},U=a.DOM,H=function(e,t){C(e,t)&&U.remove(t)},$=function(e,t){var n,o=t.parentNode,r=o.parentNode;return!(o!==e.getBody()&&("DD"===t.nodeName?(U.rename(t,"DT"),0):m(t)&&g(t)?("LI"===r.nodeName?(U.insertAfter(t,r),H(e.dom,r),U.remove(o)):l(r)?U.remove(o,!0):(r.insertBefore(x(e,t),o),U.remove(o)),0):m(t)?("LI"===r.nodeName?(U.insertAfter(t,r),t.appendChild(o),H(e.dom,r)):l(r)?r.insertBefore(t,o):(r.insertBefore(x(e,t),o),U.remove(t)),0):g(t)?("LI"===r.nodeName?U.insertAfter(t,r):l(r)?U.insertAfter(t,o):(U.insertAfter(x(e,t),o),U.remove(t)),0):("LI"===r.nodeName?(o=r,n=x(e,t,"LI")):n=l(r)?x(e,t,"LI"):x(e,t),M(e,o,t,n),I(e.dom,o.parentNode),0)))},w=$,K=function(e){var t=E.getSelectedListItems(e);if(t.length){var n=b(e.selection.getRng(!0)),o=void 0,r=void 0,i=E.getClosestListRootElm(e,e.selection.getStart(!0));for(o=t.length;o--;)for(var a=t[o].parentNode;a&&a!==i;){for(r=t.length;r--;)if(t[r]===a){t.splice(o,1);break}a=a.parentNode}for(o=0;o<t.length&&($(e,t[o])||0!==o);o++);return e.selection.setRng(D(n)),e.nodeChanged(),!0}},Q=function(e,t){i.each(t,function(t,n){e.setAttribute(n,t)})},W=function(e,t,n){var o,r,a,s,d,l,c;o=e,r=t,s=(a=n)["list-style-type"]?a["list-style-type"]:null,o.setStyle(r,"list-style-type",s),d=e,Q(l=t,(c=n)["list-attributes"]),i.each(d.select("li",l),function(e){Q(e,c["list-item-attributes"])})},j=function(e,t,n,o){var r,i;for(r=t[n?"startContainer":"endContainer"],i=t[n?"startOffset":"endOffset"],1===r.nodeType&&(r=r.childNodes[Math.min(i,r.childNodes.length-1)]||r),!n&&u(r.nextSibling)&&(r=r.nextSibling);r.parentNode!==o;){if(p(e,r))return r;if(/^(TD|TH)$/.test(r.parentNode.nodeName))return r;r=r.parentNode}return r},q=function(e,t,n){var o,a=e.selection.getRng(!0),s="LI",d=E.getClosestListRootElm(e,e.selection.getStart(!0)),c=e.dom;n=n||{},"false"!==c.getContentEditable(e.selection.getNode())&&("DL"===(t=t.toUpperCase())&&(s="DT"),o=b(a),i.each(function(e,t,n){for(var o,a=[],s=e.dom,d=j(e,t,!0,n),l=j(e,t,!1,n),c=[],f=d;f&&(c.push(f),f!==l);f=f.nextSibling);return i.each(c,function(t){if(p(e,t))return a.push(t),void(o=null);if(s.isBlock(t)||u(t))return u(t)&&s.remove(t),void(o=null);var i=t.nextSibling;r.isBookmarkNode(t)&&(p(e,i)||!i&&t.parentNode===n)?o=null:(o||(o=s.create("p"),t.parentNode.insertBefore(o,t),a.push(o)),o.appendChild(t))}),a}(e,a,d),function(o){var r,i,a,d,f,u;(i=o.previousSibling)&&l(i)&&i.nodeName===t&&(a=i,d=n,f=c.getStyle(a,"list-style-type"),u=d?d["list-style-type"]:"",f===(u=null===u?"":u))?(r=i,o=c.rename(o,s),i.appendChild(o)):(r=c.create(t),o.parentNode.insertBefore(r,o),r.appendChild(o),o=c.rename(o,s)),W(c,r,n),z(e.dom,r)}),e.selection.setRng(D(o)))},F=function(e){var t=b(e.selection.getRng(!0)),n=E.getClosestListRootElm(e,e.selection.getStart(!0)),o=E.getSelectedListItems(e),r=i.grep(o,function(t){return e.dom.isEmpty(t)});o=i.grep(o,function(t){return!e.dom.isEmpty(t)}),i.each(r,function(t){C(e.dom,t)&&w(e,t)}),i.each(o,function(t){var o,r;if(t.parentNode!==e.getBody()){for(o=t;o&&o!==n;o=o.parentNode)l(o)&&(r=o);M(e,r,t),I(e.dom,r.parentNode)}}),e.selection.setRng(D(t))},V=function(e,t,n){return d=n,(s=t)&&d&&l(s)&&s.nodeName===d.nodeName&&(i=t,a=n,(r=e).getStyle(i,"list-style-type",!0)===r.getStyle(a,"list-style-type",!0))&&(o=n,t.className===o.className);var o,r,i,a,s,d},z=function(e,t){var n,o;if(n=t.nextSibling,V(e,t,n)){for(;o=n.firstChild;)t.appendChild(o);e.remove(n)}if(n=t.previousSibling,V(e,t,n)){for(;o=n.lastChild;)t.insertBefore(o,t.firstChild);e.remove(n)}},G=function(e,t,n,o,r){if(t.nodeName!==o||J(r)){var a=b(e.selection.getRng(!0));i.each([t].concat(n),function(t){!function(e,t,n,o){if(t.nodeName!==n){var r=e.rename(t,n);W(e,r,o)}else W(e,t,o)}(e.dom,t,o,r)}),e.selection.setRng(D(a))}else F(e)},J=function(e){return"list-style-type"in e},X={toggleList:function(e,t,n){var o=E.getParentList(e),r=E.getSelectedSubLists(e);n=n||{},o&&r.length>0?G(e,o,r,t,n):function(e,t,n,o){if(t!==e.getBody())if(t)if(t.nodeName!==n||J(o)){var r=b(e.selection.getRng(!0));W(e.dom,t,o),z(e.dom,e.dom.rename(t,n)),e.selection.setRng(D(r))}else F(e);else q(e,n,o)}(e,o,t,n)},removeList:F,mergeWithAdjacentLists:z},Y=function(e,o,r,i){var a,s,d=o.startContainer,l=o.startOffset;if(3===d.nodeType&&(r?l<d.data.length:l>0))return d;for(a=e.schema.getNonEmptyElements(),1===d.nodeType&&(d=t.getNode(d,l)),s=new n(d,i),r&&h(e.dom,d)&&s.next();d=s[r?"next":"prev2"]();){if("LI"===d.nodeName&&!d.hasChildNodes())return d;if(a[d.nodeName])return d;if(3===d.nodeType&&d.data.length>0)return d}},Z=function(e,t){var n=t.childNodes;return 1===n.length&&!l(n[0])&&e.isBlock(n[0])},ee=function(e,t,n){var o,r,i,a;if(r=Z(e,n)?n.firstChild:n,Z(i=e,a=t)&&i.remove(a.firstChild,!0),!C(e,t,!0))for(;o=t.firstChild;)r.appendChild(o)},te=function(e,t,n){var o,r,i=t.parentNode;y(e,t)&&y(e,n)&&(l(n.lastChild)&&(r=n.lastChild),i===n.lastChild&&u(i.previousSibling)&&e.remove(i.previousSibling),(o=n.lastChild)&&u(o)&&t.hasChildNodes()&&e.remove(o),C(e,n,!0)&&e.$(n).empty(),ee(e,t,n),r&&n.appendChild(r),e.remove(t),C(e,i)&&i!==e.getRoot()&&e.remove(i))},ne=function(e,t,n,o){var r,i,a,s=e.dom;if(s.isEmpty(o))i=n,a=o,(r=e).dom.$(a).empty(),te(r.dom,i,a),r.selection.setCursorLocation(a);else{var d=b(t);te(s,n,o),e.selection.setRng(D(d))}},oe=function(e,t){var n,o,r,i=e.dom,a=e.selection,s=a.getStart(),d=E.getClosestListRootElm(e,s),l=i.getParent(a.getStart(),"LI",d);if(l){if((n=l.parentNode)===e.getBody()&&C(i,n))return!0;if(o=L(a.getRng(!0)),(r=i.getParent(Y(e,o,t,d),"LI",d))&&r!==l)return t?ne(e,o,r,l):function(e,t,n,o){var r=b(t);te(e.dom,n,o);var i=D(r);e.selection.setRng(i)}(e,o,l,r),!0;if(!r&&!t&&X.removeList(e))return!0}return!1},re=function(e,t){return oe(e,t)||function(e,t){var n=e.dom,o=e.selection.getStart(),r=E.getClosestListRootElm(e,o),i=n.getParent(o,n.isBlock,r);if(i&&n.isEmpty(i)){var a=L(e.selection.getRng(!0)),s=n.getParent(Y(e,a,t,r),"LI",r);if(s)return e.undoManager.transact(function(){var o,a,d,l;a=i,d=r,l=(o=n).getParent(a.parentNode,o.isBlock,d),o.remove(a),l&&o.isEmpty(l)&&o.remove(l),X.mergeWithAdjacentLists(n,s.parentNode),e.selection.select(s,!0),e.selection.collapse(t)}),!0}return!1}(e,t)},ie=function(e,t){return e.selection.isCollapsed()?re(e,t):(o=(n=e).selection.getStart(),r=E.getClosestListRootElm(n,o),!!(n.dom.getParent(o,"LI,DT,DD",r)||E.getSelectedListItems(n).length>0)&&(n.undoManager.transact(function(){n.execCommand("Delete"),I(n.dom,n.getBody())}),!0));var n,o,r},ae=function(e){e.on("keydown",function(t){t.keyCode===o.BACKSPACE?ie(e,!1)&&t.preventDefault():t.keyCode===o.DELETE&&ie(e,!0)&&t.preventDefault()})},se=ie,de=function(e){return{backspaceDelete:function(t){se(e,t)}}},le=a.DOM,ce=function(e,t){var n;if(l(e)){for(;n=e.firstChild;)t.appendChild(n);le.remove(e)}},fe=function(e){var t,n,o,r,i=E.getSelectedListItems(e);if(i.length){for(var a=b(e.selection.getRng(!0)),s=0;s<i.length&&(t=i[s],n=void 0,o=void 0,r=void 0,("DT"===t.nodeName?(le.rename(t,"DD"),1):(n=t.previousSibling)&&l(n)?(n.appendChild(t),1):n&&"LI"===n.nodeName&&l(n.lastChild)?(n.lastChild.appendChild(t),ce(t.lastChild,n.lastChild),1):(n=t.nextSibling)&&l(n)?(n.insertBefore(t,n.firstChild),1):(n=t.previousSibling)&&"LI"===n.nodeName&&(o=le.create(t.parentNode.nodeName),(r=le.getStyle(t.parentNode,"listStyleType"))&&le.setStyle(o,"listStyleType",r),n.appendChild(o),o.appendChild(t),ce(t.lastChild,o),1))||0!==s);s++);return e.selection.setRng(D(a)),e.nodeChanged(),!0}},ue=function(e,t){return function(){var n=e.dom.getParent(e.selection.getStart(),"UL,OL,DL");return n&&n.nodeName===t}},me=function(e){e.on("BeforeExecCommand",function(t){var n,o=t.command.toLowerCase();if("indent"===o?fe(e)&&(n=!0):"outdent"===o&&K(e)&&(n=!0),n)return e.fire("ExecCommand",{command:t.command}),t.preventDefault(),!0}),e.addCommand("InsertUnorderedList",function(t,n){X.toggleList(e,"UL",n)}),e.addCommand("InsertOrderedList",function(t,n){X.toggleList(e,"OL",n)}),e.addCommand("InsertDefinitionList",function(t,n){X.toggleList(e,"DL",n)}),e.addQueryStateHandler("InsertUnorderedList",ue(e,"UL")),e.addQueryStateHandler("InsertOrderedList",ue(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",ue(e,"DL"))},ge=function(e){return e.getParam("lists_indent_on_tab",!0)},pe=function(e){var t;ge(e)&&(t=e).on("keydown",function(e){e.keyCode!==o.TAB||o.metaKeyPressed(e)||t.dom.getParent(t.selection.getStart(),"LI,DT,DD")&&(e.preventDefault(),e.shiftKey?K(t):fe(t))}),ae(e)},ve=function(e,t){return function(n){var o=n.control;e.on("NodeChange",function(e){var n=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}(e.parents,f),r=-1!==n?e.parents.slice(0,n):e.parents,a=i.grep(r,l);o.active(a.length>0&&a[0].nodeName===t)})}},he=function(e){var t,n,o,r;n="advlist",o=(t=e).settings.plugins?t.settings.plugins:"",-1===i.inArray(o.split(/[ ,]/),n)&&(e.addButton("numlist",{active:!1,title:"Numbered list",cmd:"InsertOrderedList",onPostRender:ve(e,"OL")}),e.addButton("bullist",{active:!1,title:"Bullet list",cmd:"InsertUnorderedList",onPostRender:ve(e,"UL")})),e.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:(r=e,function(e){var t=e.control;r.on("nodechange",function(){var e=E.getSelectedListItems(r),n=e.length>0&&m(e[0]);t.disabled(n)})})})};e.add("lists",function(e){return pe(e),he(e),me(e),de(e)})}();!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.VK"),n=function(t){return t.target_list},o=function(t){return t.rel_list},i=function(t){return t.link_class_list},r=function(t){return"boolean"==typeof t.link_assume_external_targets&&t.link_assume_external_targets},a=function(t){return"boolean"==typeof t.link_context_toolbar&&t.link_context_toolbar},l=function(t){return t.link_list},u=function(t){return"string"==typeof t.default_link_target},c=function(t){return t.default_link_target},s=n,f=function(t,e){t.settings.target_list=e},d=function(t){return!1!==n(t)},m=o,v=function(t){return o(t)!==undefined},g=i,h=function(t){return i(t)!==undefined},x=function(t){return!1!==t.link_title},p=function(t){return"boolean"==typeof t.allow_unsafe_link_target&&t.allow_unsafe_link_target},y=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),k=tinymce.util.Tools.resolve("tinymce.Env"),b=function(t){if(!k.ie||k.ie>10){var e=document.createElement("a");e.target="_blank",e.href=t,e.rel="noreferrer noopener";var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r=e,a=n,document.body.appendChild(r),r.dispatchEvent(a),document.body.removeChild(r)}else{var o=window.open("","_blank");if(o){o.opener=null;var i=o.document;i.open(),i.write('<meta http-equiv="refresh" content="0; url='+y.DOM.encode(t)+'">'),i.close()}}var r,a},_=tinymce.util.Tools.resolve("tinymce.util.Tools"),w=function(t,e){var n,o,i=["noopener"],r=t?t.split(/\s+/):[],a=function(t){return t.filter(function(t){return-1===_.inArray(i,t)})};return(r=e?(n=a(n=r)).length?n.concat(i):i:a(r)).length?(o=r,_.trim(o.sort().join(" "))):null},T=function(t,e){return e=e||t.selection.getNode(),M(e)?t.dom.select("a[href]",e)[0]:t.dom.getParent(e,"a[href]")},C=function(t){return t&&"A"===t.nodeName&&t.href},M=function(t){return t&&"FIGURE"===t.nodeName&&/\bimage\b/i.test(t.className)},O=function(t,e){var n,o;(o=t.dom.select("img",e)[0])&&(n=t.dom.getParents(o,"a[href]",e)[0])&&(n.parentNode.insertBefore(o,n),t.dom.remove(n))},N=function(t,e,n){var o,i;(i=t.dom.select("img",e)[0])&&(o=t.dom.create("a",n),i.parentNode.insertBefore(o,i),o.appendChild(i))},R=function(t,e){return function(n){t.undoManager.transact(function(){var o=t.selection.getNode(),i=T(t,o),r={href:n.href,target:n.target?n.target:null,rel:n.rel?n.rel:null,"class":n["class"]?n["class"]:null,title:n.title?n.title:null};v(t.settings)||!1!==p(t.settings)||(r.rel=w(r.rel,"_blank"===r.target)),n.href===e.href&&(e.attach(),e={}),i?(t.focus(),n.hasOwnProperty("text")&&("innerText"in i?i.innerText=n.text:i.textContent=n.text),t.dom.setAttribs(i,r),t.selection.select(i),t.undoManager.add()):M(o)?N(t,o,r):n.hasOwnProperty("text")?t.insertContent(t.dom.createHTML("a",r,t.dom.encode(n.text))):t.execCommand("mceInsertLink",!1,r)})}},A=function(t){return function(){t.undoManager.transact(function(){var e=t.selection.getNode();M(e)?O(t,e):t.execCommand("unlink")})}},L=C,P=function(t){return _.grep(t,C).length>0},E=function(t){return!(/</.test(t)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(t)||-1===t.indexOf("href=")))},K=T,S=function(t,e){var n=e?e.innerText||e.textContent:t.getContent({format:"text"});return n.replace(/\uFEFF/g,"")},U=w,D=tinymce.util.Tools.resolve("tinymce.util.Delay"),I=tinymce.util.Tools.resolve("tinymce.util.XHR"),B={},F=function(t,e,n){var o=function(t,n){return n=n||[],_.each(t,function(t){var i={text:t.text||t.title};t.menu?i.menu=o(t.menu):(i.value=t.value,e&&e(i)),n.push(i)}),n};return o(t,n||[])},q=function(t,e,n){var o=t.selection.getRng();D.setEditorTimeout(t,function(){t.windowManager.confirm(e,function(e){t.selection.setRng(o),n(e)})})},V=function(t,e){var n,o,i,a,l,y,k,b,w,T,C,M={},O=t.selection,N=t.dom,L=function(t){var e=i.find("#text");(!e.value()||t.lastControl&&e.value()===t.lastControl.text())&&e.value(t.control.text()),i.find("#href").value(t.control.value())},P=function(){o||!a||M.text||this.parent().parent().find("#text")[0].value(this.value())};a=E(O.getContent()),n=K(t),M.text=o=S(t.selection,n),M.href=n?N.getAttrib(n,"href"):"",n?M.target=N.getAttrib(n,"target"):u(t.settings)&&(M.target=c(t.settings)),(C=N.getAttrib(n,"rel"))&&(M.rel=C),(C=N.getAttrib(n,"class"))&&(M["class"]=C),(C=N.getAttrib(n,"title"))&&(M.title=C),a&&(l={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){M.text=this.value()}}),e&&(y={type:"listbox",label:"Link list",values:F(e,function(e){e.value=t.convertURL(e.value||e.url,"href")},[{text:"None",value:""}]),onselect:L,value:t.convertURL(M.href,"href"),onPostRender:function(){y=this}}),d(t.settings)&&(s(t.settings)===undefined&&f(t,[{text:"None",value:""},{text:"New window",value:"_blank"}]),b={name:"target",type:"listbox",label:"Target",values:F(s(t.settings))}),v(t.settings)&&(k={name:"rel",type:"listbox",label:"Rel",values:F(m(t.settings),function(e){!1===p(t.settings)&&(e.value=U(e.value,"_blank"===M.target))})}),h(t.settings)&&(w={name:"class",type:"listbox",label:"Class",values:F(g(t.settings),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({inline:"a",classes:[e.value]})})})}),x(t.settings)&&(T={name:"title",type:"textbox",label:"Title",value:M.title}),i=t.windowManager.open({title:"Insert link",data:M,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:function(e){var n=e.meta||{};y&&y.value(t.convertURL(this.value(),"href")),_.each(e.meta,function(t,e){var n=i.find("#"+e);"text"===e?0===o.length&&(n.value(t),M.text=t):n.value(t)}),n.attach&&(B={href:this.value(),attach:n.attach}),n.text||P.call(this)},onkeyup:P,onbeforecall:function(t){t.meta=i.toJSON()}},l,T,function(e){var n=[];if(_.each(t.dom.select("a:not([href])"),function(t){var o=t.name||t.id;o&&n.push({text:o,value:"#"+o,selected:-1!==e.indexOf("#"+o)})}),n.length)return n.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:n,onselect:L}}(M.href),y,k,b,w],onSubmit:function(e){var n=r(t.settings),i=R(t,B),l=A(t),u=_.extend({},M,e.data),c=u.href;c?(a&&u.text!==o||delete u.text,c.indexOf("@")>0&&-1===c.indexOf("//")&&-1===c.indexOf("mailto:")?q(t,"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(t){t&&(u.href="mailto:"+c),i(u)}):!0===n&&!/^\w+:/i.test(c)||!1===n&&/^\s*www[\.|\d\.]/i.test(c)?q(t,"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(t){t&&(u.href="http://"+c),i(u)}):i(u)):l()}})},z=function(t){var e,n,o;n=V,"string"==typeof(o=l((e=t).settings))?I.send({url:o,success:function(t){n(e,JSON.parse(t))}}):"function"==typeof o?o(function(t){n(e,t)}):n(e,o)},H=function(t,e){return t.dom.getParent(e,"a[href]")},J=function(t){return H(t,t.selection.getStart())},$=function(t,e){if(e){var n=(i=e).getAttribute("data-mce-href")||i.getAttribute("href");if(/^#/.test(n)){var o=t.$(n);o.length&&t.selection.scrollIntoView(o[0],!0)}else b(e.href)}var i},j=function(t){return function(){z(t)}},G=function(t){return function(){$(t,J(t))}},X=function(t){return function(e){var n,o,i,r,l;return!!(a(t.settings)&&(r=t,l=r.plugins.contextmenu,!l||!l.isContextMenuVisible())&&L(e)&&3===(i=(o=(n=t.selection).getRng()).startContainer).nodeType&&n.isCollapsed()&&o.startOffset>0&&o.startOffset<i.data.length)}},Q=function(t){t.on("click",function(n){var o=H(t,n.target);o&&e.metaKeyPressed(n)&&(n.preventDefault(),$(t,o))}),t.on("keydown",function(e){var n,o=J(t);o&&13===e.keyCode&&!0===(n=e).altKey&&!1===n.shiftKey&&!1===n.ctrlKey&&!1===n.metaKey&&(e.preventDefault(),$(t,o))})},W=function(t){return function(){var e=this;t.on("nodechange",function(n){e.active(!t.readonly&&!!K(t,n.element))})}},Y=function(t){return function(){var e=this,n=function(t){P(t.parents)?e.show():e.hide()};P(t.dom.getParents(t.selection.getStart()))||e.hide(),t.on("nodechange",n),e.on("remove",function(){t.off("nodechange",n)})}},Z=function(t){t.addCommand("mceLink",j(t))},tt=function(t){t.addShortcut("Meta+K","",j(t))},et=function(t){t.addButton("link",{active:!1,icon:"link",tooltip:"Insert/edit link",onclick:j(t),onpostrender:W(t)}),t.addButton("unlink",{active:!1,icon:"unlink",tooltip:"Remove link",onclick:A(t),onpostrender:W(t)}),t.addContextToolbar&&t.addButton("openlink",{icon:"newtab",tooltip:"Open link",onclick:G(t)})},nt=function(t){t.addMenuItem("openlink",{text:"Open link",icon:"newtab",onclick:G(t),onPostRender:Y(t),prependToContext:!0}),t.addMenuItem("link",{icon:"link",text:"Link",shortcut:"Meta+K",onclick:j(t),stateSelector:"a[href]",context:"insert",prependToContext:!0})},ot=function(t){t.addContextToolbar&&t.addContextToolbar(X(t),"openlink | link unlink")};t.add("link",function(t){et(t),nt(t),ot(t),Q(t),Z(t),tt(t)})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=function(e){e.settings.inline_styles=!1,e.on("init",function(){var n,i,a,o;n=e,i="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",a=t.explode(n.settings.font_size_style_values),o=n.schema,n.formatter.register({alignleft:{selector:i,attributes:{align:"left"}},aligncenter:{selector:i,attributes:{align:"center"}},alignright:{selector:i,attributes:{align:"right"}},alignjustify:{selector:i,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(e){return t.inArray(a,e.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),t.each("b,i,u,strike".split(","),function(e){o.addValidElements(e+"[*]")}),o.getElementRule("font")||o.addValidElements("font[face|size|color|style]"),t.each(i.split(","),function(e){var t=o.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})})},i=function(e){e.addButton("fontsizeselect",function(){var t=[],n=e.settings.fontsizeFormats||"8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7";return e.$.each(n.split(" "),function(e,n){var i=n,a=n,o=n.split("=");o.length>1&&(i=o[0],a=o[1]),t.push({text:i,value:a})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:t,fixedWidth:!0,onPostRender:function(){var t=this;e.on("NodeChange",function(){var n;(n=e.dom.getParent(e.selection.getNode(),"font"))?t.value(n.size):t.value("")})},onclick:function(t){t.control.settings.value&&e.execCommand("FontSize",!1,t.control.settings.value)}}}),e.addButton("fontselect",function(){var t=[],n=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(e.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");return e.$.each(n,function(e,n){t.push({text:{raw:n[0]},value:n[1],textStyle:-1===n[1].indexOf("dings")?"font-family:"+n[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:t,fixedWidth:!0,onPostRender:function(){var t=this;e.on("NodeChange",function(){var n;(n=e.dom.getParent(e.selection.getNode(),"font"))?t.value(n.face):t.value("")})},onselect:function(t){t.control.settings.value&&e.execCommand("FontName",!1,t.control.settings.value)}}})};e.add("legacyoutput",function(e){n(e),i(e)})}();!function(){"use strict";var e=function(t){var n=t,r=function(){return n};return{get:r,set:function(e){n=e},clone:function(){return e(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))},r=function(e){return e.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])},a=function(e){return e.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d"))},i=n,o=r,u=function(e){var t=r(e);return t.length>0?t[0]:n(e)},c=function(e){return e.getParam("insertdatetime_element",!1)},l="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),m="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),s="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),d="January February March April May June July August September October November December".split(" "),p=function(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e},f=function(e,t,n){return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",p(n.getMonth()+1,2))).replace("%d",p(n.getDate(),2))).replace("%H",""+p(n.getHours(),2))).replace("%M",""+p(n.getMinutes(),2))).replace("%S",""+p(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(d[n.getMonth()]))).replace("%b",""+e.translate(s[n.getMonth()]))).replace("%A",""+e.translate(m[n.getDay()]))).replace("%a",""+e.translate(l[n.getDay()]))).replace("%%","%")},g=function(e,t){if(c(e)){var n=f(e,t),r=void 0;r=/%[HMSIp]/.test(t)?f(e,"%Y-%m-%dT%H:%M"):f(e,"%Y-%m-%d");var a=e.dom.getParent(e.selection.getStart(),"time");a?(o=a,u=r,l=n,m=(i=e).dom.create("time",{datetime:u},l),o.parentNode.insertBefore(m,o),i.dom.remove(o),i.selection.select(m,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")}else e.insertContent(f(e,t));var i,o,u,l,m},y=f,M=function(e){e.addCommand("mceInsertDate",function(){g(e,a(e))}),e.addCommand("mceInsertTime",function(){g(e,i(e))})},v=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(e,t){var n,r,a,i=(r=t,a=o(n=e),v.map(a,function(e){return{text:y(n,e),onclick:function(){r.set(e),g(n,e)}}}));e.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",menu:i,onclick:function(){var n=t.get();g(e,n||u(e))}}),e.addMenuItem("insertdatetime",{icon:"date",text:"Date/time",menu:i,context:"insert"})};t.add("insertdatetime",function(t){var n=e(null);M(t),S(t,n)})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),n=tinymce.util.Tools.resolve("tinymce.EditorManager"),r=tinymce.util.Tools.resolve("tinymce.Env"),i=tinymce.util.Tools.resolve("tinymce.util.Tools"),c=function(e){return e.getParam("importcss_merge_classes")},o=function(e){return e.getParam("importcss_exclusive")},s=function(e){return e.getParam("importcss_selector_converter")},u=function(e){return e.getParam("importcss_selector_filter")},l=function(e){return e.getParam("importcss_groups")},a=function(e){return e.getParam("importcss_append")},f=function(e){return e.getParam("importcss_file_filter")},m=function(e){var t=r.cacheSuffix;return"string"==typeof e&&(e=e.replace("?"+t,"").replace("&"+t,"")),e},g=function(e,t){var r=e.settings,i=!1!==r.skin&&(r.skin||"lightgray");return!!i&&t===(r.skin_url?e.documentBaseURI.toAbsolute(r.skin_url):n.baseURL+"/skins/"+i)+"/content"+(e.inline?".inline":"")+".min.css"},p=function(e){return"string"==typeof e?function(t){return-1!==t.indexOf(e)}:e instanceof RegExp?function(t){return e.test(t)}:e},v=function(e,t,n){var r=[],c={};i.each(e.contentCSS,function(e){c[e]=!0}),n||(n=function(e,t){return t||c[e]});try{i.each(t.styleSheets,function(t){!function c(t,o){var s,u=t.href;if((u=m(u))&&n(u,o)&&!g(e,u)){i.each(t.imports,function(e){c(e,!0)});try{s=t.cssRules||t.rules}catch(l){}i.each(s,function(e){e.styleSheet?c(e.styleSheet,!0):e.selectorText&&i.each(e.selectorText.split(","),function(e){r.push(i.trim(e))})})}}(t)})}catch(o){}return r},h=function(e,t){var n,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(t);if(r){var o=r[1],s=r[2].substr(1).split(".").join(" "),u=i.makeMap("a,img");return r[1]?(n={title:t},e.schema.getTextBlockElements()[o]?n.block=o:e.schema.getBlockElements()[o]||u[o.toLowerCase()]?n.selector=o:n.inline=o):r[2]&&(n={inline:"span",title:t.substr(1),classes:s}),!1!==c(e)?n.classes=s:n.attributes={"class":s},n}},d=function(e,t){return null===t||!1!==o(e)},y=h,_=function(e){e.on("renderFormatsMenu",function(n){var r,c={},o=p(u(e)),m=n.control,g=(r=l(e),i.map(r,function(e){return i.extend({},e,{original:e,selectors:{},filter:p(e.filter),item:{text:e.title,menu:[]}})})),y=function(n,r){if(_=n,T=c,!(d(e,x=r)?_ in T:_ in x.selectors)){p=n,y=c,d(e,v=r)?y[p]=!0:v.selectors[p]=!0;var o=(l=e,a=e.plugins.importcss,f=n,((g=r)&&g.selector_converter?g.selector_converter:s(l)?s(l):function(){return h(l,f)}).call(a,f,g));if(o){var u=o.name||t.DOM.uniqueId();return e.formatter.register(u,o),i.extend({},m.settings.itemDefaults,{text:o.title,format:u})}}var l,a,f,g,p,v,y,_,x,T;return null};a(e)||m.items().remove(),i.each(v(e,n.doc||e.getDoc(),p(f(e))),function(e){if(-1===e.indexOf(".mce-")&&(!o||o(e))){var t=(r=g,c=e,i.grep(r,function(e){return!e.filter||e.filter(c)}));if(t.length>0)i.each(t,function(t){var n=y(e,t);n&&t.item.menu.push(n)});else{var n=y(e,null);n&&m.add(n)}}var r,c}),i.each(g,function(e){e.item.menu.length>0&&m.add(e.item)}),n.control.renderNew()})},x=function(e){return{convertSelectorToFormat:function(t){return y(e,t)}}};e.add("importcss",function(e){return _(e),x(e)})}();!function(){"use strict";var t=function(e){var n=e,o=function(){return n};return{get:o,set:function(t){n=t},clone:function(){return t(o())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools");function o(t,e){return i(document.createElement("canvas"),t,e)}function r(t){return t.getContext("2d")}function i(t,e,n){return t.width=e,t.height=n,t}var a,u,c,l,s={create:o,clone:function(t){var e;return r(e=o(t.width,t.height)).drawImage(t,0,0),e},resize:i,get2dContext:r,get3dContext:function(t){var e=null;try{e=t.getContext("webgl")||t.getContext("experimental-webgl")}catch(n){}return e||(e=null),e}},f={getWidth:function(t){return t.naturalWidth||t.width},getHeight:function(t){return t.naturalHeight||t.height}},d=window.Promise?window.Promise:function(){var t=function(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],c(t,n(i,this),n(a,this))},e=t.immediateFn||"function"==typeof setImmediate&&setImmediate||function(t){setTimeout(t,1)};function n(t,e){return function(){t.apply(e,arguments)}}var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function r(t){var n=this;null!==this._state?e(function(){var e=n._state?t.onFulfilled:t.onRejected;if(null!==e){var o;try{o=e(n._value)}catch(r){return void t.reject(r)}t.resolve(o)}else(n._state?t.resolve:t.reject)(n._value)}):this._deferreds.push(t)}function i(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void c(n(e,t),n(i,this),n(a,this))}this._state=!0,this._value=t,u.call(this)}catch(o){a.call(this,o)}}function a(t){this._state=!1,this._value=t,u.call(this)}function u(){for(var t=0,e=this._deferreds.length;t<e;t++)r.call(this,this._deferreds[t]);this._deferreds=null}function c(t,e,n){var o=!1;try{t(function(t){o||(o=!0,e(t))},function(t){o||(o=!0,n(t))})}catch(r){if(o)return;o=!0,n(r)}}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype.then=function(e,n){var o=this;return new t(function(t,i){r.call(o,new function(t,e,n,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=o}(e,n,t,i))})},t.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&o(arguments[0])?arguments[0]:arguments);return new t(function(t,n){if(0===e.length)return t([]);var o=e.length;function r(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var u=a.then;if("function"==typeof u)return void u.call(a,function(t){r(i,t)},n)}e[i]=a,0==--o&&t(e)}catch(c){n(c)}}for(var i=0;i<e.length;i++)r(i,e[i])})},t.resolve=function(e){return e&&"object"==typeof e&&e.constructor===t?e:new t(function(t){t(e)})},t.reject=function(e){return new t(function(t,n){n(e)})},t.race=function(e){return new t(function(t,n){for(var o=0,r=e.length;o<r;o++)e[o].then(t,n)})},t}(),h=function(t){return function(){return t}},p={noop:function(){},noarg:function(t){return function(){return t()}},compose:function(t,e){return function(){return t(e.apply(null,arguments))}},constant:h,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),o=0;o<n.length;o++)n[o]=arguments[o];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:h(!1),always:h(!0)},m=p.never,g=p.always,v=function(){return y},y=(l={fold:function(t,e){return t()},is:m,isSome:m,isNone:g,getOr:c=function(t){return t},getOrThunk:u=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},or:c,orThunk:u,map:v,ap:v,each:function(){},bind:v,flatten:v,exists:m,forall:g,filter:v,equals:a=function(t){return t.isNone()},equals_:a,toArray:function(){return[]},toString:p.constant("none()")},Object.freeze&&Object.freeze(l),l),b=function(t){var e=function(){return t},n=function(){return r},o=function(e){return e(t)},r={fold:function(e,n){return n(t)},is:function(e){return t===e},isSome:g,isNone:m,getOr:e,getOrThunk:e,getOrDie:e,or:n,orThunk:n,map:function(e){return b(e(t))},ap:function(e){return e.fold(v,function(e){return b(e(t))})},each:function(e){e(t)},bind:o,flatten:e,exists:o,forall:o,filter:function(e){return e(t)?r:y},equals:function(e){return e.is(t)},equals_:function(e,n){return e.fold(m,function(e){return n(t,e)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return r},w={some:b,none:v,from:function(t){return null===t||t===undefined?y:b(t)}},x="undefined"!=typeof window?window:Function("return this;")(),R=function(t,e){for(var n=e!==undefined&&null!==e?e:x,o=0;o<t.length&&n!==undefined&&null!==n;++o)n=n[t[o]];return n},I=function(t,e){var n=t.split(".");return R(n,e)},T=function(t,e){var n=I(t,e);if(n===undefined||null===n)throw t+" not available on this browser";return n},k=function(t,e){return new(T("Blob"))(t,e)},C=function(){return new(T("FileReader"))},B=function(t){return new(T("Uint8Array"))(t)},U={atob:function(t){return T("atob")(t)},requestAnimationFrame:function(t){T("requestAnimationFrame")(t)}};function M(t){return new d(function(e,n){var o=URL.createObjectURL(t),r=new Image,i=function(){r.removeEventListener("load",a),r.removeEventListener("error",u)};function a(){i(),e(r)}function u(){i(),n("Unable to load data of type "+t.type+": "+o)}r.addEventListener("load",a),r.addEventListener("error",u),r.src=o,r.complete&&a()})}function j(t){return new d(function(e){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="blob",n.onload=function(){200==this.status&&e(this.response)},n.send()})}function A(t){var e=t.split(","),n=/data:([^;]+)/.exec(e[0]);if(!n)return w.none();for(var o=n[1],r=e[1],i=U.atob(r),a=i.length,u=Math.ceil(a/1024),c=new Array(u),l=0;l<u;++l){for(var s=1024*l,f=Math.min(s+1024,a),d=new Array(f-s),h=s,p=0;h<f;++p,++h)d[p]=i[h].charCodeAt(0);c[l]=B(d)}return w.some(k(c,{type:o}))}function z(t){return new d(function(e,n){A(t).fold(function(){n("uri is not base64: "+t)},e)})}function E(t){return new d(function(e){var n=new C;n.onloadend=function(){e(n.result)},n.readAsDataURL(t)})}var S={blobToImage:M,imageToBlob:function(t){return(e=t,new d(function(t){e.complete?t(e):e.addEventListener("load",function n(){e.removeEventListener("load",n),t(e)})})).then(function(t){var e=t.src;return 0===e.indexOf("blob:")?j(e):0===e.indexOf("data:")?z(e):j(e)});var e},blobToDataUri:E,blobToBase64:function(t){return E(t).then(function(t){return t.split(",")[1]})},dataUriToBlobSync:A,canvasToBlob:function(t,e,n){return e=e||"image/png",HTMLCanvasElement.prototype.toBlob?new d(function(o){t.toBlob(function(t){o(t)},e,n)}):z(t.toDataURL(e,n))},canvasToDataURL:function(t,e,n){return e=e||"image/png",t.then(function(t){return t.toDataURL(e,n)})},blobToCanvas:function(t){return M(t).then(function(t){var e,n;return e=t,URL.revokeObjectURL(e.src),n=s.create(f.getWidth(t),f.getHeight(t)),s.get2dContext(n).drawImage(t,0,0),n})},uriToBlob:function(t){return 0===t.indexOf("blob:")?j(t):0===t.indexOf("data:")?z(t):null}},L=function(t){return S.blobToImage(t)},H=function(t){return S.imageToBlob(t)};function O(t,e,n){var o=e.type;function r(e,n){return t.then(function(t){return S.canvasToDataURL(t,e,n)})}return{getType:p.constant(o),toBlob:function(){return d.resolve(e)},toDataURL:function(){return n},toBase64:function(){return n.split(",")[1]},toAdjustedBlob:function(e,n){return t.then(function(t){return S.canvasToBlob(t,e,n)})},toAdjustedDataURL:r,toAdjustedBase64:function(t,e){return r(t,e).then(function(t){return t.split(",")[1]})},toCanvas:function(){return t.then(s.clone)}}}function _(t){return S.blobToDataUri(t).then(function(e){return O(S.blobToCanvas(t),t,e)})}var D={fromBlob:_,fromCanvas:function(t,e){return S.canvasToBlob(t,e).then(function(e){return O(d.resolve(t),e,t.toDataURL())})},fromImage:function(t){return S.imageToBlob(t).then(function(t){return _(t)})},fromBlobAndUrlSync:function(t,e){return O(S.blobToCanvas(t),t,e)}};function F(t,e,n){return(t=parseFloat(t))>n?t=n:t<e&&(t=e),t}var P=[0,.01,.02,.04,.05,.06,.07,.08,.1,.11,.12,.14,.15,.16,.17,.18,.2,.21,.22,.24,.25,.27,.28,.3,.32,.34,.36,.38,.4,.42,.44,.46,.48,.5,.53,.56,.59,.62,.65,.68,.71,.74,.77,.8,.83,.86,.89,.92,.95,.98,1,1.06,1.12,1.18,1.24,1.3,1.36,1.42,1.48,1.54,1.6,1.66,1.72,1.78,1.84,1.9,1.96,2,2.12,2.25,2.37,2.5,2.62,2.75,2.87,3,3.2,3.4,3.6,3.8,4,4.3,4.7,4.9,5,5.5,6,6.5,6.8,7,7.3,7.5,7.8,8,8.4,8.7,9,9.4,9.6,9.8,10];function W(t,e){var n,o,r,i,a=[],u=new Array(10);for(n=0;n<5;n++){for(o=0;o<5;o++)a[o]=e[o+5*n];for(o=0;o<5;o++){for(i=0,r=0;r<5;r++)i+=t[o+5*r]*a[r];u[o+5*n]=i}}return u}function q(t,e){return e=F(e,0,1),t.map(function(t,n){return n%6==0?t=1-(1-t)*e:t*=e,F(t,0,1)})}var V={identity:function(){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1]},adjust:q,multiply:W,adjustContrast:function(t,e){var n;return e=F(e,-1,1),W(t,[(n=(e*=100)<0?127+e/100*127:127*(n=0==(n=e%1)?P[e]:P[Math.floor(e)]*(1-n)+P[Math.floor(e)+1]*n)+127)/127,0,0,0,.5*(127-n),0,n/127,0,0,.5*(127-n),0,0,n/127,0,.5*(127-n),0,0,0,1,0,0,0,0,0,1])},adjustBrightness:function(t,e){return W(t,[1,0,0,0,e=F(255*e,-255,255),0,1,0,0,e,0,0,1,0,e,0,0,0,1,0,0,0,0,0,1])},adjustSaturation:function(t,e){var n,o,r;return W(t,[(o=.3086)*(1-(n=1+((e=F(e,-1,1))>0?3*e:e)))+n,(r=.6094)*(1-n),.082*(1-n),0,0,o*(1-n),r*(1-n)+n,.082*(1-n),0,0,o*(1-n),r*(1-n),.082*(1-n)+n,0,0,0,0,0,1,0,0,0,0,0,1])},adjustHue:function(t,e){var n,o,r,i,a;return e=F(e,-180,180)/180*Math.PI,n=Math.cos(e),o=Math.sin(e),W(t,[(r=.213)+.787*n+o*-r,(i=.715)+n*-i+o*-i,(a=.072)+n*-a+.928*o,0,0,r+n*-r+.143*o,i+n*(1-i)+.14*o,a+n*-a+-.283*o,0,0,r+n*-r+-.787*o,i+n*-i+o*i,a+.928*n+o*a,0,0,0,0,0,1,0,0,0,0,0,1])},adjustColors:function(t,e,n,o){return W(t,[e=F(e,0,2),0,0,0,0,0,n=F(n,0,2),0,0,0,0,0,o=F(o,0,2),0,0,0,0,0,1,0,0,0,0,0,1])},adjustSepia:function(t,e){return W(t,q([.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0,0,0,0,0,1],e=F(e,0,1)))},adjustGrayscale:function(t,e){return W(t,q([.33,.34,.33,0,0,.33,.34,.33,0,0,.33,.34,.33,0,0,0,0,0,1,0,0,0,0,0,1],e=F(e,0,1)))}};function N(t,e){return t.toCanvas().then(function(n){return o=n,r=t.getType(),i=e,u=s.get2dContext(o),a=function(t,e){var n,o,r,i,a,u=t.data,c=e[0],l=e[1],s=e[2],f=e[3],d=e[4],h=e[5],p=e[6],m=e[7],g=e[8],v=e[9],y=e[10],b=e[11],w=e[12],x=e[13],R=e[14],I=e[15],T=e[16],k=e[17],C=e[18],B=e[19];for(a=0;a<u.length;a+=4)n=u[a],o=u[a+1],r=u[a+2],i=u[a+3],u[a]=n*c+o*l+r*s+i*f+d,u[a+1]=n*h+o*p+r*m+i*g+v,u[a+2]=n*y+o*b+r*w+i*x+R,u[a+3]=n*I+o*T+r*k+i*C+B;return t}(u.getImageData(0,0,o.width,o.height),i),u.putImageData(a,0,0),D.fromCanvas(o,r);var o,r,i,a,u})}function X(t,e){return t.toCanvas().then(function(n){return o=n,r=t.getType(),i=e,c=s.get2dContext(o),a=c.getImageData(0,0,o.width,o.height),u=c.getImageData(0,0,o.width,o.height),u=function(t,e,n){var o,r,i,a,u,c,l,s,f,d,h,p,m,g,v,y,b;function w(t,e,n){return t>n?t=n:t<e&&(t=e),t}for(i=Math.round(Math.sqrt(n.length)),a=Math.floor(i/2),o=t.data,r=e.data,y=t.width,b=t.height,c=0;c<b;c++)for(u=0;u<y;u++){for(l=s=f=0,h=0;h<i;h++)for(d=0;d<i;d++)p=w(u+d-a,0,y-1),m=w(c+h-a,0,b-1),g=4*(m*y+p),v=n[h*i+d],l+=o[g]*v,s+=o[g+1]*v,f+=o[g+2]*v;r[g=4*(c*y+u)]=w(l,0,255),r[g+1]=w(s,0,255),r[g+2]=w(f,0,255)}return e}(a,u,i),c.putImageData(u,0,0),D.fromCanvas(o,r);var o,r,i,a,u,c})}function $(t){return function(e,n){return e.toCanvas().then(function(o){return function(e,n,o){var r,i,a=s.get2dContext(e),u=new Array(256);for(i=0;i<u.length;i++)u[i]=t(i,o);return r=function(t,e){var n,o=t.data;for(n=0;n<o.length;n+=4)o[n]=e[o[n]],o[n+1]=e[o[n+1]],o[n+2]=e[o[n+2]];return t}(a.getImageData(0,0,e.width,e.height),u),a.putImageData(r,0,0),D.fromCanvas(e,n)}(o,e.getType(),n)})}}function G(t){return function(e,n){return N(e,t(V.identity(),n))}}function Y(t){return function(e){return X(e,t)}}var J,K={invert:(J=[-1,0,0,0,255,0,-1,0,0,255,0,0,-1,0,255,0,0,0,1,0],function(t){return N(t,J)}),brightness:G(V.adjustBrightness),hue:G(V.adjustHue),saturate:G(V.adjustSaturation),contrast:G(V.adjustContrast),grayscale:G(V.adjustGrayscale),sepia:G(V.adjustSepia),colorize:function(t,e,n,o){return N(t,V.adjustColors(V.identity(),e,n,o))},sharpen:Y([0,-1,0,-1,5,-1,0,-1,0]),emboss:Y([-2,-1,0,-1,1,1,0,1,2]),gamma:$(function(t,e){return 255*Math.pow(t/255,1-e)}),exposure:$(function(t,e){return 255*(1-Math.exp(-t/255*e))}),colorFilter:N,convoluteFilter:X},Z={scale:function te(t,e,n){var o=f.getWidth(t),r=f.getHeight(t),i=e/o,a=n/r,u=!1;(i<.5||i>2)&&(i=i<.5?.5:2,u=!0),(a<.5||a>2)&&(a=a<.5?.5:2,u=!0);var c,l,h,p=(c=t,l=i,h=a,new d(function(t){var e=f.getWidth(c),n=f.getHeight(c),o=Math.floor(e*l),r=Math.floor(n*h),i=s.create(o,r),a=s.get2dContext(i);a.drawImage(c,0,0,e,n,0,0,o,r),t(i)}));return u?p.then(function(t){return te(t,e,n)}):p}},Q={rotate:function(t,e){return t.toCanvas().then(function(n){return o=n,r=t.getType(),i=e,a=s.create(o.width,o.height),u=s.get2dContext(a),c=0,l=0,90!=(i=i<0?360+i:i)&&270!=i||s.resize(a,a.height,a.width),90!=i&&180!=i||(c=a.width),270!=i&&180!=i||(l=a.height),u.translate(c,l),u.rotate(i*Math.PI/180),u.drawImage(o,0,0),D.fromCanvas(a,r);var o,r,i,a,u,c,l})},flip:function(t,e){return t.toCanvas().then(function(n){return o=n,r=t.getType(),i=e,a=s.create(o.width,o.height),u=s.get2dContext(a),"v"==i?(u.scale(1,-1),u.drawImage(o,0,-a.height)):(u.scale(-1,1),u.drawImage(o,-a.width,0)),D.fromCanvas(a,r);var o,r,i,a,u})},crop:function(t,e,n,o,r){return t.toCanvas().then(function(i){return a=i,u=t.getType(),c=e,l=n,f=o,d=r,h=s.create(f,d),s.get2dContext(h).drawImage(a,-c,-l),D.fromCanvas(h,u);var a,u,c,l,f,d,h})},resize:function(t,e,n){return t.toCanvas().then(function(o){return Z.scale(o,e,n).then(function(e){return D.fromCanvas(e,t.getType())})})}},tt={invert:function(t){return K.invert(t)},sharpen:function(t){return K.sharpen(t)},emboss:function(t){return K.emboss(t)},brightness:function(t,e){return K.brightness(t,e)},hue:function(t,e){return K.hue(t,e)},saturate:function(t,e){return K.saturate(t,e)},contrast:function(t,e){return K.contrast(t,e)},grayscale:function(t,e){return K.grayscale(t,e)},sepia:function(t,e){return K.sepia(t,e)},colorize:function(t,e,n,o){return K.colorize(t,e,n,o)},gamma:function(t,e){return K.gamma(t,e)},exposure:function(t,e){return K.exposure(t,e)},flip:function(t,e){return Q.flip(t,e)},crop:function(t,e,n,o,r){return Q.crop(t,e,n,o,r)},resize:function(t,e,n){return Q.resize(t,e,n)},rotate:function(t,e){return Q.rotate(t,e)}},et=function(t){return t.toBlob()},nt={blobToImageResult:function(t){return D.fromBlob(t)},fromBlobAndUrlSync:function(t,e){return D.fromBlobAndUrlSync(t,e)},imageToImageResult:function(t){return D.fromImage(t)},imageResultToBlob:function(t,e,n){return e===undefined&&n===undefined?et(t):t.toAdjustedBlob(e,n)},imageResultToOriginalBlob:et,imageResultToDataURL:function(t){return t.toDataURL()}},ot=function(){return T("URL")},rt={createObjectURL:function(t){return ot().createObjectURL(t)},revokeObjectURL:function(t){ot().revokeObjectURL(t)}},it=tinymce.util.Tools.resolve("tinymce.util.Delay"),at=tinymce.util.Tools.resolve("tinymce.util.Promise"),ut=tinymce.util.Tools.resolve("tinymce.util.URI"),ct=function(t){return t.getParam("imagetools_toolbar","rotateleft rotateright | flipv fliph | crop editimage imageoptions")},lt=function(t){return t.getParam("imagetools_proxy")},st={getImageSize:function(t){var e,n;function o(t){return/^[0-9\.]+px$/.test(t)}return e=t.style.width,n=t.style.height,e||n?o(e)&&o(n)?{w:parseInt(e,10),h:parseInt(n,10)}:null:(e=t.width,n=t.height,e&&n?{w:parseInt(e,10),h:parseInt(n,10)}:null)},setImageSize:function(t,e){var n,o;e&&(n=t.style.width,o=t.style.height,(n||o)&&(t.style.width=e.w+"px",t.style.height=e.h+"px",t.removeAttribute("data-mce-style")),n=t.width,o=t.height,(n||o)&&(t.setAttribute("width",e.w),t.setAttribute("height",e.h)))},getNaturalImageSize:function(t){return{w:t.naturalWidth,h:t.naturalHeight}}},ft=(Array.prototype.indexOf,undefined,Array.prototype.push,Array.prototype.slice,function(t,e){for(var n=0,o=t.length;n<o;n++){var r=t[n];if(e(r,n,t))return w.some(r)}return w.none()}),dt=function(t){return null!==t&&t!==undefined},ht={traverse:function(t,e){var n;return n=e.reduce(function(t,e){return dt(t)?t[e]:undefined},t),dt(n)?n:null},readBlob:function(t){return new at(function(e){var n=new C;n.onload=function(t){var n=t.target;e(n.result)},n.readAsText(t)})},requestUrlAsBlob:function(t,e){return new at(function(o){var r;(r=new function(){return new(T("XMLHttpRequest"))}).onreadystatechange=function(){4===r.readyState&&o({status:r.status,blob:this.response})},r.open("GET",t,!0),n.each(e,function(t,e){r.setRequestHeader(e,t)}),r.responseType="blob",r.send()})},parseJson:function(t){var e;try{e=JSON.parse(t)}catch(n){}return e}},pt=[{code:404,message:"Could not find Image Proxy"},{code:403,message:"Rejected request"},{code:0,message:"Incorrect Image Proxy URL"}],mt=[{type:"key_missing",message:"The request did not include an api key."},{type:"key_not_found",message:"The provided api key could not be found."},{type:"domain_not_trusted",message:"The api key is not valid for the request origins."}],gt=function(t){return"ImageProxy HTTP error: "+ft(pt,function(e){return t===e.code}).fold(p.constant("Unknown ImageProxy error"),function(t){return t.message})},vt=function(t){var e=gt(t);return at.reject(e)},yt=function(t){return ft(mt,function(e){return e.type===t}).fold(p.constant("Unknown service error"),function(t){return t.message})},bt=function(t,e){return ht.readBlob(e).then(function(t){var e,n,o,r=(e=t,n=ht.parseJson(e),"ImageProxy Service error: "+((o=ht.traverse(n,["error","type"]))?yt(o):"Invalid JSON in service error message"));return at.reject(r)})},wt={handleServiceErrorResponse:function(t,e){return 400===(n=t)||403===n||500===n?bt(0,e):vt(t);var n},handleHttpError:vt,getHttpErrorMsg:gt,getServiceErrorMsg:yt},xt=function(t,e){return ht.requestUrlAsBlob((n=t,o=e,r=-1===n.indexOf("?")?"?":"&",/[?&]apiKey=/.test(n)||!o?n:n+r+"apiKey="+encodeURIComponent(o)),{"Content-Type":"application/json;charset=UTF-8","tiny-api-key":e}).then(function(t){return t.status<200||t.status>=300?wt.handleServiceErrorResponse(t.status,t.blob):at.resolve(t.blob)});var n,o,r},Rt=function(t,e){return e?xt(t,e):(n=t,ht.requestUrlAsBlob(n,{}).then(function(t){return t.status<200||t.status>=300?wt.handleHttpError(t.status):at.resolve(t.blob)}));var n},It=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),Tt=tinymce.util.Tools.resolve("tinymce.ui.Factory"),kt=function(){var t=[],e=-1;function n(){return e>0}function o(){return-1!==e&&e<t.length-1}return{data:t,add:function(n){var o;return o=t.splice(++e),t.push(n),{state:n,removed:o}},undo:function(){if(n())return t[--e]},redo:function(){if(o())return t[++e]},canUndo:n,canRedo:o}},Ct=tinymce.util.Tools.resolve("tinymce.geom.Rect"),Bt=function(t){return new at(function(e){var n=function(){t.removeEventListener("load",n),e(t)};t.complete?e(t):t.addEventListener("load",n)})},Ut=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Mt=tinymce.util.Tools.resolve("tinymce.util.Observable"),jt=tinymce.util.Tools.resolve("tinymce.util.VK"),At=0,zt=function(t,e,o,r,i){var a,u,c,l,s="mce-",f=s+"crid-"+At++;function d(t,e){return{x:e.x-t.x,y:e.y-t.y,w:e.w,h:e.h}}function h(e,n,r,i){var u,c,l,s,f;u=n.x,c=n.y,l=n.w,s=n.h,u+=r*e.deltaX,c+=i*e.deltaY,l+=r*e.deltaW,s+=i*e.deltaH,l<20&&(l=20),s<20&&(s=20),f=t=Ct.clamp({x:u,y:c,w:l,h:s},o,"move"===e.name),f=d(o,f),a.fire("updateRect",{rect:f}),g(f)}function p(t){function o(t,e){e.h<0&&(e.h=0),e.w<0&&(e.w=0),Ut("#"+f+"-"+t,r).css({left:e.x,top:e.y,width:e.w,height:e.h})}n.each(u,function(e){Ut("#"+f+"-"+e.name,r).css({left:t.w*e.xMul+t.x,top:t.h*e.yMul+t.y})}),o("top",{x:e.x,y:e.y,w:e.w,h:t.y-e.y}),o("right",{x:t.x+t.w,y:t.y,w:e.w-t.x-t.w+e.x,h:t.h}),o("bottom",{x:e.x,y:t.y+t.h,w:e.w,h:e.h-t.y-t.h+e.y}),o("left",{x:e.x,y:t.y,w:t.x-e.x,h:t.h}),o("move",t)}function m(e){p(t=e)}function g(t){var e,n;m((e=o,{x:(n=t).x+e.x,y:n.y+e.y,w:n.w,h:n.h}))}return u=[{name:"move",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:0,deltaH:0,label:"Crop Mask"},{name:"nw",xMul:0,yMul:0,deltaX:1,deltaY:1,deltaW:-1,deltaH:-1,label:"Top Left Crop Handle"},{name:"ne",xMul:1,yMul:0,deltaX:0,deltaY:1,deltaW:1,deltaH:-1,label:"Top Right Crop Handle"},{name:"sw",xMul:0,yMul:1,deltaX:1,deltaY:0,deltaW:-1,deltaH:1,label:"Bottom Left Crop Handle"},{name:"se",xMul:1,yMul:1,deltaX:0,deltaY:0,deltaW:1,deltaH:1,label:"Bottom Right Crop Handle"}],l=["top","right","bottom","left"],Ut('<div id="'+f+'" class="'+s+'croprect-container" role="grid" aria-dropeffect="execute">').appendTo(r),n.each(l,function(t){Ut("#"+f,r).append('<div id="'+f+"-"+t+'"class="'+s+'croprect-block" style="display: none" data-mce-bogus="all">')}),n.each(u,function(t){Ut("#"+f,r).append('<div id="'+f+"-"+t.name+'" class="'+s+"croprect-handle "+s+"croprect-handle-"+t.name+'"style="display: none" data-mce-bogus="all" role="gridcell" tabindex="-1" aria-label="'+t.label+'" aria-grabbed="false">')}),c=n.map(u,function(e){var n;return new(Tt.get("DragHelper"))(f,{document:r.ownerDocument,handle:f+"-"+e.name,start:function(){n=t},drag:function(t){h(e,n,t.deltaX,t.deltaY)}})}),p(t),Ut(r).on("focusin focusout",function(t){Ut(t.target).attr("aria-grabbed","focus"===t.type)}),Ut(r).on("keydown",function(e){var o;function r(t,e,n,r,i){t.stopPropagation(),t.preventDefault(),h(o,n,r,i)}switch(n.each(u,function(t){if(e.target.id===f+"-"+t.name)return o=t,!1}),e.keyCode){case jt.LEFT:r(e,0,t,-10,0);break;case jt.RIGHT:r(e,0,t,10,0);break;case jt.UP:r(e,0,t,0,-10);break;case jt.DOWN:r(e,0,t,0,10);break;case jt.ENTER:case jt.SPACEBAR:e.preventDefault(),i()}}),a=n.extend({toggleVisibility:function(t){var e;e=n.map(u,function(t){return"#"+f+"-"+t.name}).concat(n.map(l,function(t){return"#"+f+"-"+t})).join(","),t?Ut(e,r).show():Ut(e,r).hide()},setClampRect:function(e){o=e,p(t)},setRect:m,getInnerRect:function(){return d(o,t)},setInnerRect:g,setViewPortRect:function(n){e=n,p(t)},destroy:function(){n.each(c,function(t){t.destroy()}),c=[]}},Mt)},Et={create:function(t){return new(Tt.get("Control").extend({Defaults:{classes:"imagepanel"},selection:function(t){return arguments.length?(this.state.set("rect",t),this):this.state.get("rect")},imageSize:function(){var t=this.state.get("viewRect");return{w:t.w,h:t.h}},toggleCropRect:function(t){this.state.set("cropEnabled",t)},imageSrc:function(t){var e=this,n=new Image;n.src=t,Bt(n).then(function(){var t,o,r=e.state.get("viewRect");if((o=e.$el.find("img"))[0])o.replaceWith(n);else{var i=document.createElement("div");i.className="mce-imagepanel-bg",e.getEl().appendChild(i),e.getEl().appendChild(n)}t={x:0,y:0,w:n.naturalWidth,h:n.naturalHeight},e.state.set("viewRect",t),e.state.set("rect",Ct.inflate(t,-20,-20)),r&&r.w===t.w&&r.h===t.h||e.zoomFit(),e.repaintImage(),e.fire("load")})},zoom:function(t){return arguments.length?(this.state.set("zoom",t),this):this.state.get("zoom")},postRender:function(){return this.imageSrc(this.settings.imageSrc),this._super()},zoomFit:function(){var t,e,n,o,r,i;t=this.$el.find("img"),e=this.getEl().clientWidth,n=this.getEl().clientHeight,o=t[0].naturalWidth,r=t[0].naturalHeight,(i=Math.min((e-10)/o,(n-10)/r))>=1&&(i=1),this.zoom(i)},repaintImage:function(){var t,e,n,o,r,i,a,u,c,l,s;s=this.getEl(),c=this.zoom(),l=this.state.get("rect"),a=this.$el.find("img"),u=this.$el.find(".mce-imagepanel-bg"),r=s.offsetWidth,i=s.offsetHeight,n=a[0].naturalWidth*c,o=a[0].naturalHeight*c,t=Math.max(0,r/2-n/2),e=Math.max(0,i/2-o/2),a.css({left:t,top:e,width:n,height:o}),u.css({left:t,top:e,width:n,height:o}),this.cropRect&&(this.cropRect.setRect({x:l.x*c+t,y:l.y*c+e,w:l.w*c,h:l.h*c}),this.cropRect.setClampRect({x:t,y:e,w:n,h:o}),this.cropRect.setViewPortRect({x:0,y:0,w:r,h:i}))},bindStates:function(){var t=this;t.state.on("change:cropEnabled",function(e){t.cropRect.toggleVisibility(e.value),t.repaintImage()}),t.state.on("change:zoom",function(){t.repaintImage()}),t.state.on("change:rect",function(e){var n,o=e.value;t.cropRect||(n=o,t.cropRect=zt(n,t.state.get("viewRect"),t.state.get("viewRect"),t.getEl(),function(){t.fire("crop")}),t.cropRect.on("updateRect",function(e){var n=e.rect,o=t.zoom();n={x:Math.round(n.x/o),y:Math.round(n.y/o),w:Math.round(n.w/o),h:Math.round(n.h/o)},t.state.set("rect",n)}),t.on("remove",t.cropRect.destroy)),t.cropRect.setRect(o)})}}))(t)}};function St(t){return{blob:t,url:rt.createObjectURL(t)}}function Lt(t){t&&rt.revokeObjectURL(t.url)}function Ht(t){n.each(t,Lt)}function Ot(t,e,o,r){var i,a,u,c,l,s,f,d,h,p,m,g,v,y,b,w,x,R,I,T,k,C,B,U,M,j,A,z=kt();function E(t){var e,n,o,r;e=i.find("#w")[0],n=i.find("#h")[0],o=parseInt(e.value(),10),r=parseInt(n.value(),10),i.find("#constrain")[0].checked()&&U&&M&&o&&r&&("w"===t.control.settings.name?(r=Math.round(o*j),n.value(r)):(o=Math.round(r*A),e.value(o))),U=o,M=r}function S(t){return Math.round(100*t)+"%"}function L(){i.find("#undo").disabled(!z.canUndo()),i.find("#redo").disabled(!z.canRedo()),i.statusbar.find("#save").disabled(!z.canUndo())}function H(){i.find("#undo").disabled(!0),i.find("#redo").disabled(!0)}function O(t){t&&d.imageSrc(t.url)}function _(t){return function(){var e=n.grep(B,function(e){return e.settings.name!==t});n.each(e,function(t){t.hide()}),t.show(),t.focus()}}function D(t){O(c=St(t))}function F(t){O(e=St(t)),Ht(z.add(e).removed),L()}function P(){var t=d.selection();nt.blobToImageResult(e.blob).then(function(e){tt.crop(e,t.x,t.y,t.w,t.h).then(X).then(function(t){F(t),q()})})}var W=function(t){var n=[].slice.call(arguments,1);return function(){var o=c||e;nt.blobToImageResult(o.blob).then(function(e){t.apply(this,[e].concat(n)).then(X).then(D)})}};function q(){O(e),Lt(c),_(a)(),L()}function V(){c?(F(c.blob),q()):function e(n,o){c?o():setTimeout(function(){n-- >0?e(n,o):t.windowManager.alert("Error: failed to apply image operation.")},10)}(100,V)}function N(t){return Tt.create("Form",{layout:"flex",direction:"row",labelGap:5,border:"0 0 1 0",align:"center",pack:"center",padding:"0 10 0 10",spacing:5,flex:0,minHeight:60,defaults:{classes:"imagetool",type:"button"},items:t})}var X=function(t){return t.toBlob()};function $(t,n){return N([{text:"Back",onclick:q},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:V}]).hide().on("show",function(){H(),nt.blobToImageResult(e.blob).then(function(t){return n(t)}).then(X).then(function(t){var e=St(t);O(e),Lt(c),c=e})})}function G(t,n,o,r,i){return N([{text:"Back",onclick:q},{type:"spacer",flex:1},{type:"slider",flex:1,ondragend:function(t){var o;o=t.value,nt.blobToImageResult(e.blob).then(function(t){return n(t,o)}).then(X).then(function(t){var e=St(t);O(e),Lt(c),c=e})},minValue:r,maxValue:i,value:o,previewFilter:S},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:V}]).hide().on("show",function(){this.find("slider").value(o),H()})}l=N([{text:"Back",onclick:q},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:P}]).hide().on("show hide",function(t){d.toggleCropRect("show"===t.type)}).on("show",H),s=N([{text:"Back",onclick:q},{type:"spacer",flex:1},{type:"textbox",name:"w",label:"Width",size:4,onkeyup:E},{type:"textbox",name:"h",label:"Height",size:4,onkeyup:E},{type:"checkbox",name:"constrain",text:"Constrain proportions",checked:!0,onchange:function(t){!0===t.control.value()&&(j=M/U,A=U/M)}},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:"submit"}]).hide().on("submit",function(t){var n=parseInt(i.find("#w").value(),10),o=parseInt(i.find("#h").value(),10);t.preventDefault(),function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];var r=[].slice.call(arguments,1);return function(){nt.blobToImageResult(e.blob).then(function(e){t.apply(this,[e].concat(r)).then(X).then(F)})}}(tt.resize,n,o)(),q()}).on("show",H),f=N([{text:"Back",onclick:q},{type:"spacer",flex:1},{icon:"fliph",tooltip:"Flip horizontally",onclick:W(tt.flip,"h")},{icon:"flipv",tooltip:"Flip vertically",onclick:W(tt.flip,"v")},{icon:"rotateleft",tooltip:"Rotate counterclockwise",onclick:W(tt.rotate,-90)},{icon:"rotateright",tooltip:"Rotate clockwise",onclick:W(tt.rotate,90)},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:V}]).hide().on("show",H),m=$(0,tt.invert),I=$(0,tt.sharpen),T=$(0,tt.emboss),g=G(0,tt.brightness,0,-1,1),v=G(0,tt.hue,180,0,360),y=G(0,tt.saturate,0,-1,1),b=G(0,tt.contrast,0,-1,1),w=G(0,tt.grayscale,0,0,1),x=G(0,tt.sepia,0,0,1),R=function(t,n){function o(){var t,o,r;t=i.find("#r")[0].value(),o=i.find("#g")[0].value(),r=i.find("#b")[0].value(),nt.blobToImageResult(e.blob).then(function(e){return n(e,t,o,r)}).then(X).then(function(t){var e=St(t);O(e),Lt(c),c=e})}return N([{text:"Back",onclick:q},{type:"spacer",flex:1},{type:"slider",label:"R",name:"r",minValue:0,value:1,maxValue:2,ondragend:o,previewFilter:S},{type:"slider",label:"G",name:"g",minValue:0,value:1,maxValue:2,ondragend:o,previewFilter:S},{type:"slider",label:"B",name:"b",minValue:0,value:1,maxValue:2,ondragend:o,previewFilter:S},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:V}]).hide().on("show",function(){i.find("#r,#g,#b").value(1),H()})}(0,tt.colorize),k=G(0,tt.gamma,0,-1,1),C=G(0,tt.exposure,1,0,2),u=N([{text:"Back",onclick:q},{type:"spacer",flex:1},{text:"hue",icon:"hue",onclick:_(v)},{text:"saturate",icon:"saturate",onclick:_(y)},{text:"sepia",icon:"sepia",onclick:_(x)},{text:"emboss",icon:"emboss",onclick:_(T)},{text:"exposure",icon:"exposure",onclick:_(C)},{type:"spacer",flex:1}]).hide(),a=N([{tooltip:"Crop",icon:"crop",onclick:_(l)},{tooltip:"Resize",icon:"resize2",onclick:_(s)},{tooltip:"Orientation",icon:"orientation",onclick:_(f)},{tooltip:"Brightness",icon:"sun",onclick:_(g)},{tooltip:"Sharpen",icon:"sharpen",onclick:_(I)},{tooltip:"Contrast",icon:"contrast",onclick:_(b)},{tooltip:"Color levels",icon:"drop",onclick:_(R)},{tooltip:"Gamma",icon:"gamma",onclick:_(k)},{tooltip:"Invert",icon:"invert",onclick:_(m)}]),d=Et.create({flex:1,imageSrc:e.url}),h=Tt.create("Container",{layout:"flex",direction:"column",border:"0 1 0 0",padding:5,spacing:5,items:[{type:"button",icon:"undo",tooltip:"Undo",name:"undo",onclick:function(){O(e=z.undo()),L()}},{type:"button",icon:"redo",tooltip:"Redo",name:"redo",onclick:function(){O(e=z.redo()),L()}},{type:"button",icon:"zoomin",tooltip:"Zoom in",onclick:function(){var t=d.zoom();t<2&&(t+=.1),d.zoom(t)}},{type:"button",icon:"zoomout",tooltip:"Zoom out",onclick:function(){var t=d.zoom();t>.1&&(t-=.1),d.zoom(t)}}]}),p=Tt.create("Container",{type:"container",layout:"flex",direction:"row",align:"stretch",flex:1,items:[h,d]}),B=[a,l,s,f,u,m,g,v,y,b,w,x,R,I,T,k,C],(i=t.windowManager.open({layout:"flex",direction:"column",align:"stretch",minWidth:Math.min(It.DOM.getViewPort().w,800),minHeight:Math.min(It.DOM.getViewPort().h,650),title:"Edit image",items:B.concat([p]),buttons:[{text:"Save",name:"save",subtype:"primary",onclick:function(){o(e.blob),i.close()}},{text:"Cancel",onclick:"close"}]})).on("close",function(){r(),Ht(z.data),z=null,c=null}),z.add(e),L(),d.on("load",function(){U=d.imageSize().w,M=d.imageSize().h,j=M/U,A=U/M,i.find("#w").value(U),i.find("#h").value(M)}),d.on("crop",P)}var _t={edit:function(t,e){return new at(function(n,o){return e.toBlob().then(function(e){Ot(t,St(e),n,o)})})}},Dt=0,Ft=function(t,e){t.notificationManager.open({text:e,type:"error"})},Pt=function(t){return t.selection.getNode()},Wt=function(t,e){var n=e.src;return 0===n.indexOf("data:")||0===n.indexOf("blob:")||new ut(n).host===t.documentBaseURI.host},qt=function(t,e){return-1!==n.inArray(t.settings.imagetools_cors_hosts,new ut(e.src).host)},Vt=function(t){var e,n,o,r,i,a;return(e=t.editorUpload.blobCache.getByUri(Pt(t).src))?at.resolve(e.blob()):(n=t,o=Pt(t),a=o.src,qt(n,o)?Rt(o.src,null):Wt(n,o)?H(o):(a=lt(n),a+=(-1===a.indexOf("?")?"?":"&")+"url="+encodeURIComponent(o.src),r=(i=n).settings.api_key||i.settings.imagetools_api_key,Rt(a,r)))},Nt=function(t,e){var n=it.setEditorTimeout(t,function(){t.editorUpload.uploadImagesAuto()},t.settings.images_upload_timeout||3e4);e.set(n)},Xt=function(t){clearTimeout(t.get())},$t=function(t,e,n,o){return e.toBlob().then(function(r){var i,a,u,c,l,s,f;return u=t.editorUpload.blobCache,i=(l=Pt(t)).src,t.settings.images_reuse_filename&&((c=u.getByUri(i))?(i=c.uri(),a=c.name()):(s=t,a=(f=i.match(/\/([^\/\?]+)?\.(?:jpeg|jpg|png|gif)(?:\?|$)/i))?s.dom.encode(f[1]):null)),c=u.create({id:"imagetools"+Dt++,blob:r,base64:e.toBase64(),uri:i,name:a}),u.add(c),t.undoManager.transact(function(){t.$(l).on("load",function e(){t.$(l).off("load",e),t.nodeChanged(),n?t.editorUpload.uploadImagesAuto():(Xt(o),Nt(t,o))}),t.$(l).attr({src:c.blobUri()}).removeAttr("data-mce-src")}),c})},Gt=function(t,e,n){return function(){return t._scanForImages().then(p.curry(Vt,t)).then(nt.blobToImageResult).then(n).then(function(n){return $t(t,n,!1,e)},function(e){Ft(t,e)})}},Yt={rotate:function(t,e,n){return function(){return Gt(t,e,function(e){var o=st.getImageSize(Pt(t));return o&&st.setImageSize(Pt(t),{w:o.h,h:o.w}),tt.rotate(e,n)})()}},flip:function(t,e,n){return function(){return Gt(t,e,function(t){return tt.flip(t,n)})()}},editImageDialog:function(t,e){return function(){var n=Pt(t),o=st.getNaturalImageSize(n),r=function(t){return new at(function(e){L(t).then(function(r){var i=st.getNaturalImageSize(r);o.w===i.w&&o.h===i.h||st.getImageSize(n)&&st.setImageSize(n,i),rt.revokeObjectURL(r.src),e(t)})})};Vt(t).then(nt.blobToImageResult).then(p.curry(function(t,n){return _t.edit(t,n).then(r).then(nt.blobToImageResult).then(function(n){return $t(t,n,!0,e)},function(){})},t),function(e){Ft(t,e)})}},isEditableImage:function(t,e){return t.dom.is(e,"img:not([data-mce-object],[data-mce-placeholder])")&&(Wt(t,e)||qt(t,e)||t.settings.imagetools_proxy)},cancelTimedUpload:Xt},Jt=function(t,e){n.each({mceImageRotateLeft:Yt.rotate(t,e,-90),mceImageRotateRight:Yt.rotate(t,e,90),mceImageFlipVertical:Yt.flip(t,e,"v"),mceImageFlipHorizontal:Yt.flip(t,e,"h"),mceEditImage:Yt.editImageDialog(t,e)},function(e,n){t.addCommand(n,e)})},Kt=function(t,e,n){t.on("NodeChange",function(o){var r=n.get();r&&r.src!==o.element.src&&(Yt.cancelTimedUpload(e),t.editorUpload.uploadImagesAuto(),n.set(null)),Yt.isEditableImage(t,o.element)&&n.set(o.element)})},Zt=function(t){t.addButton("rotateleft",{title:"Rotate counterclockwise",cmd:"mceImageRotateLeft"}),t.addButton("rotateright",{title:"Rotate clockwise",cmd:"mceImageRotateRight"}),t.addButton("flipv",{title:"Flip vertically",cmd:"mceImageFlipVertical"}),t.addButton("fliph",{title:"Flip horizontally",cmd:"mceImageFlipHorizontal"}),t.addButton("editimage",{title:"Edit image",cmd:"mceEditImage"}),t.addButton("imageoptions",{title:"Image options",icon:"options",cmd:"mceImage"})},Qt=function(t){t.addContextToolbar(p.curry(Yt.isEditableImage,t),ct(t))};e.add("imagetools",function(e){var n=t(0),o=t(null);Jt(e,n),Zt(e),Qt(e),Kt(e,n,o)})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),n={hasDimensions:function(e){return!1!==e.settings.image_dimensions},hasAdvTab:function(e){return!0===e.settings.image_advtab},getPrependUrl:function(e){return e.getParam("image_prepend_url","")},getClassList:function(e){return e.getParam("image_class_list")},hasDescription:function(e){return!1!==e.settings.image_description},hasImageTitle:function(e){return!0===e.settings.image_title},hasImageCaption:function(e){return!0===e.settings.image_caption},getImageList:function(e){return e.getParam("image_list",!1)},hasUploadUrl:function(e){return e.getParam("images_upload_url",!1)},hasUploadHandler:function(e){return e.getParam("images_upload_handler",!1)},getUploadUrl:function(e){return e.getParam("images_upload_url")},getUploadHandler:function(e){return e.getParam("images_upload_handler")},getUploadBasePath:function(e){return e.getParam("images_upload_base_path")},getUploadCredentials:function(e){return e.getParam("images_upload_credentials")}},a="undefined"!=typeof window?window:Function("return this;")(),i=function(e,t){for(var n=t!==undefined&&null!==t?t:a,i=0;i<e.length&&n!==undefined&&null!==n;++i)n=n[e[i]];return n},r=function(e,t){var n=e.split(".");return i(n,t)},o=function(e,t){var n=r(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n},l=function(){return new(o("FileReader"))},s=tinymce.util.Tools.resolve("tinymce.util.Promise"),c=tinymce.util.Tools.resolve("tinymce.util.XHR"),u=function(e,t){return Math.max(parseInt(e,10),parseInt(t,10))},g={getImageSize:function(e,t){var n=document.createElement("img");function a(e,a){n.parentNode&&n.parentNode.removeChild(n),t({width:e,height:a})}n.onload=function(){a(u(n.width,n.clientWidth),u(n.height,n.clientHeight))},n.onerror=function(){a(0,0)};var i=n.style;i.visibility="hidden",i.position="fixed",i.bottom=i.left="0px",i.width=i.height="auto",document.body.appendChild(n),n.src=e},buildListItems:function(e,n,a){return function i(e,a){return a=a||[],t.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=i(e.menu):(t.value=e.value,n(t)),a.push(t)}),a}(e,a||[])},removePixelSuffix:function(e){return e&&(e=e.replace(/px$/,"")),e},addPixelSuffix:function(e){return e.length>0&&/^[0-9]+$/.test(e)&&(e+="px"),e},mergeMargins:function(e){if(e.margin){var t=e.margin.split(" ");switch(t.length){case 1:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[0],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[0];break;case 2:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[1];break;case 3:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[1];break;case 4:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[3]}delete e.margin}return e},createImageList:function(e,t){var a=n.getImageList(e);"string"==typeof a?c.send({url:a,success:function(e){t(JSON.parse(e))}}):"function"==typeof a?a(t):t(a)},waitLoadImage:function(e,t,a){function i(){a.onload=a.onerror=null,e.selection&&(e.selection.select(a),e.nodeChanged())}a.onload=function(){t.width||t.height||!n.hasDimensions(e)||e.dom.setAttribs(a,{width:a.clientWidth,height:a.clientHeight}),i()},a.onerror=i},blobToDataUri:function(e){return new s(function(t,n){var a=new l;a.onload=function(){t(a.result)},a.onerror=function(){n(l.error.message)},a.readAsDataURL(e)})}},d={makeTab:function(e,t){return{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:(a=e,function(e){var t=a.dom,i=e.control.rootControl;if(n.hasAdvTab(a)){var r=i.toJSON(),o=t.parseStyle(r.style);i.find("#vspace").value(""),i.find("#hspace").value(""),((o=g.mergeMargins(o))["margin-top"]&&o["margin-bottom"]||o["margin-right"]&&o["margin-left"])&&(o["margin-top"]===o["margin-bottom"]?i.find("#vspace").value(g.removePixelSuffix(o["margin-top"])):i.find("#vspace").value(""),o["margin-right"]===o["margin-left"]?i.find("#hspace").value(g.removePixelSuffix(o["margin-right"])):i.find("#hspace").value("")),o["border-width"]&&i.find("#border").value(g.removePixelSuffix(o["border-width"])),i.find("#style").value(t.serializeStyle(t.parseStyle(t.serializeStyle(o))))}})},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:function(n){t(e,n.control.rootControl)}},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]};var a}},m=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},f=function(e,t){var n=e.find("#width")[0],a=e.find("#height")[0],i=e.find("#constrain")[0];n&&a&&i&&t(n,a,i.checked())},p=function(e,t,n){var a=e.state.get("oldVal"),i=t.state.get("oldVal"),r=e.value(),o=t.value();n&&a&&i&&r&&o&&(r!==a?(o=Math.round(r/a*o),isNaN(o)||t.value(o)):(r=Math.round(o/i*r),isNaN(r)||e.value(r))),m(e,t)},h=function(e){f(e,p)},b={createUi:function(){var e=function(e){h(e.control.rootControl)};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},syncSize:function(e){f(e,m)},updateSize:h},v=function(e){e.meta=e.control.rootControl.toJSON()},y=function(e,a){var i=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:function(a){var i,r,o,l,s,c,u,d,m;r=e,c=(i=a).meta||{},u=i.control,d=u.rootControl,(m=d.find("#image-list")[0])&&m.value(r.convertURL(u.value(),"src")),t.each(c,function(e,t){d.find("#"+t).value(e)}),c.width||c.height||(o=r.convertURL(u.value(),"src"),l=n.getPrependUrl(r),s=new RegExp("^(?:[a-z]+:)?//","i"),l&&!s.test(o)&&o.substring(0,l.length)!==l&&(o=l+o),u.value(o),g.getImageSize(r.documentBaseURI.toAbsolute(u.value()),function(e){e.width&&e.height&&n.hasDimensions(r)&&(d.find("#width").value(e.width),d.find("#height").value(e.height),b.updateSize(d))}))},onbeforecall:v},a];return n.hasDescription(e)&&i.push({name:"alt",type:"textbox",label:"Image description"}),n.hasImageTitle(e)&&i.push({name:"title",type:"textbox",label:"Image Title"}),n.hasDimensions(e)&&i.push(b.createUi()),n.getClassList(e)&&i.push({name:"class",type:"listbox",label:"Class",values:g.buildListItems(n.getClassList(e),function(t){t.value&&(t.textStyle=function(){return e.formatter.getCssText({inline:"img",classes:[t.value]})})})}),n.hasImageCaption(e)&&i.push({name:"caption",type:"checkbox",label:"Caption"}),i},x={makeTab:function(e,t){return{title:"General",type:"form",items:y(e,t)}},getGeneralItems:y},w=function(){return o("URL")},S=function(e){return w().createObjectURL(e)},U=function(e){w().revokeObjectURL(e)},T=tinymce.util.Tools.resolve("tinymce.ui.Factory"),C=function(){},I=function(e){var n=function(t,n,a,i){var r,l;(r=new function(){return new(o("XMLHttpRequest"))}).open("POST",e.url),r.withCredentials=e.credentials,r.upload.onprogress=function(e){i(e.loaded/e.total*100)},r.onerror=function(){a("Image upload failed due to a XHR Transport error. Code: "+r.status)},r.onload=function(){var t,i,o;r.status<200||r.status>=300?a("HTTP Error: "+r.status):(t=JSON.parse(r.responseText))&&"string"==typeof t.location?n((i=e.basePath,o=t.location,i?i.replace(/\/$/,"")+"/"+o.replace(/^\//,""):o)):a("Invalid JSON: "+r.responseText)},(l=new FormData).append("file",t.blob(),t.filename()),r.send(l)};return e=t.extend({credentials:!1,handler:n},e),{upload:function(t){return e.url||e.handler!==n?(a=t,i=e.handler,new s(function(e,t){try{i(a,e,t,C)}catch(n){t(n.message)}})):s.reject("Upload url missing from the settings.");var a,i}}},P=function(e){return function(t){var a=T.get("Throbber"),i=t.control.rootControl,r=new a(i.getEl()),o=t.control.value(),l=S(o),s=I({url:n.getUploadUrl(e),basePath:n.getUploadBasePath(e),credentials:n.getUploadCredentials(e),handler:n.getUploadHandler(e)}),c=function(){r.hide(),U(l)};return r.show(),g.blobToDataUri(o).then(function(t){var n=e.editorUpload.blobCache.create({blob:o,blobUri:l,name:o.name?o.name.replace(/\.[^\.]+$/,""):null,base64:t.split(",")[1]});return s.upload(n).then(function(e){var t=i.find("#src");return t.value(e),i.find("tabpanel")[0].activateTab(0),t.fire("change"),c(),e})})["catch"](function(t){e.windowManager.alert(t),c()})}},L=".jpg,.jpeg,.png,.gif",_={makeTab:function(e){return{title:"Upload",type:"form",layout:"flex",direction:"column",align:"stretch",padding:"20 20 20 20",items:[{type:"container",layout:"flex",direction:"column",align:"center",spacing:10,items:[{text:"Browse for an image",type:"browsebutton",accept:L,onchange:P(e)},{text:"OR",type:"label"}]},{text:"Drop an image here",type:"dropzone",accept:L,height:100,onchange:P(e)}]}}},N=function(e){var a=function(e,t){if(n.hasAdvTab(e)){var a=e.dom,i=t.toJSON(),r=a.parseStyle(i.style);r=g.mergeMargins(r),i.vspace&&(r["margin-top"]=r["margin-bottom"]=g.addPixelSuffix(i.vspace)),i.hspace&&(r["margin-left"]=r["margin-right"]=g.addPixelSuffix(i.hspace)),i.border&&(r["border-width"]=g.addPixelSuffix(i.border)),t.find("#style").value(a.serializeStyle(a.parseStyle(a.serializeStyle(r))))}};function i(i){var r,o,l,s,c={},u=e.dom;function m(){var n,i;b.updateSize(r),a(e,r),(c=t.extend(c,r.toJSON())).alt||(c.alt=""),c.title||(c.title=""),""===c.width&&(c.width=null),""===c.height&&(c.height=null),c.style||(c.style=null),c={src:c.src,alt:c.alt,title:c.title,width:c.width,height:c.height,style:c.style,caption:c.caption,"class":c["class"]},e.undoManager.transact(function(){if(c.src){if(""===c.title&&(c.title=null),o?u.setAttribs(o,c):(c.id="__mcenew",e.focus(),e.selection.setContent(u.createHTML("img",c)),o=u.get("__mcenew"),u.setAttrib(o,"id",null)),e.editorUpload.uploadImagesAuto(),!1===c.caption&&u.is(o.parentNode,"figure.image")&&(n=o.parentNode,u.insertAfter(o,n),u.remove(n)),!0!==c.caption)g.waitLoadImage(e,c,o);else if(!u.is(o.parentNode,"figure.image")){i=o,o=o.cloneNode(!0),(n=u.create("figure",{"class":"image"})).appendChild(o),n.appendChild(u.create("figcaption",{contentEditable:!0},"Caption")),n.contentEditable=!1;var t=u.getParent(i,function(t){return e.schema.getTextBlockElements()[t.nodeName]});t?u.split(t,i,n):u.replace(n,i),e.selection.select(n)}}else if(o){var a=u.is(o.parentNode,"figure.image")?o.parentNode:o;u.remove(a),e.focus(),e.nodeChanged(),u.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}})}if(o=e.selection.getNode(),(l=u.getParent(o,"figure.image"))&&(o=u.select("img",l)[0]),o&&("IMG"!==o.nodeName||o.getAttribute("data-mce-object")||o.getAttribute("data-mce-placeholder"))&&(o=null),o&&(c={src:u.getAttrib(o,"src"),alt:u.getAttrib(o,"alt"),title:u.getAttrib(o,"title"),"class":u.getAttrib(o,"class"),width:u.getAttrib(o,"width"),height:u.getAttrib(o,"height"),caption:!!l}),i&&(s={type:"listbox",label:"Image list",name:"image-list",values:g.buildListItems(i,function(t){t.value=e.convertURL(t.value||t.url,"src")},[{text:"None",value:""}]),value:c.src&&e.convertURL(c.src,"src"),onselect:function(e){var t=r.find("#alt");(!t.value()||e.lastControl&&t.value()===e.lastControl.text())&&t.value(e.control.text()),r.find("#src").value(e.control.value()).fire("change")},onPostRender:function(){s=this}}),n.hasAdvTab(e)||n.hasUploadUrl(e)||n.hasUploadHandler(e)){var f=[x.makeTab(e,s)];n.hasAdvTab(e)&&(o&&(o.style.marginLeft&&o.style.marginRight&&o.style.marginLeft===o.style.marginRight&&(c.hspace=g.removePixelSuffix(o.style.marginLeft)),o.style.marginTop&&o.style.marginBottom&&o.style.marginTop===o.style.marginBottom&&(c.vspace=g.removePixelSuffix(o.style.marginTop)),o.style.borderWidth&&(c.border=g.removePixelSuffix(o.style.borderWidth)),c.style=e.dom.serializeStyle(e.dom.parseStyle(e.dom.getAttrib(o,"style")))),f.push(d.makeTab(e,a))),(n.hasUploadUrl(e)||n.hasUploadHandler(e))&&f.push(_.makeTab(e)),r=e.windowManager.open({title:"Insert/edit image",data:c,bodyType:"tabpanel",body:f,onSubmit:m})}else r=e.windowManager.open({title:"Insert/edit image",data:c,body:x.getGeneralItems(e,s),onSubmit:m});b.syncSize(r)}return{open:function(){g.createImageList(e,i)}}},A=function(e){e.addCommand("mceImage",N(e).open)},k=function(e){return function(n){for(var a,i,r=n.length,o=function(t){t.attr("contenteditable",e?"true":null)};r--;)a=n[r],(i=a.attr("class"))&&/\bimage\b/.test(i)&&(a.attr("contenteditable",e?"false":null),t.each(a.getAll("figcaption"),o))}},z=function(e){e.on("preInit",function(){e.parser.addNodeFilter("figure",k(!0)),e.serializer.addNodeFilter("figure",k(!1))})},R=function(e){e.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:N(e).open,stateSelector:"img:not([data-mce-object],[data-mce-placeholder]),figure.image"}),e.addMenuItem("image",{icon:"image",text:"Image",onclick:N(e).open,context:"insert",prependToContext:!0})};e.add("image",function(e){z(e),R(e),A(e)})}();!function(){"use strict";var n=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"<hr />")})},t=function(n){n.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),n.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};tinymce.util.Tools.resolve("tinymce.PluginManager").add("hr",function(o){n(o),t(o)})}();!function(){"use strict";var e=function(t){var n=t,i=function(){return n};return{get:i,set:function(e){n=e},clone:function(){return e(i())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return{isFullscreen:function(){return null!==e.get()}}},i=function(e,t){e.fire("FullscreenStateChanged",{state:t})},r=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils").DOM,l=function(e,t){var n,l,o,c,s,u,d=document.body,a=document.documentElement,h=t.get(),f=function(){var e,t,n,i;r.setStyle(o,"height",(n=window,i=document.body,i.offsetWidth&&(e=i.offsetWidth,t=i.offsetHeight),n.innerWidth&&n.innerHeight&&(e=n.innerWidth,t=n.innerHeight),{w:e,h:t}).h-(l.clientHeight-o.clientHeight))},m=function(){r.unbind(window,"resize",f)};if(n=(l=e.getContainer()).style,c=(o=e.getContentAreaContainer().firstChild).style,h)c.width=h.iframeWidth,c.height=h.iframeHeight,h.containerWidth&&(n.width=h.containerWidth),h.containerHeight&&(n.height=h.containerHeight),r.removeClass(d,"mce-fullscreen"),r.removeClass(a,"mce-fullscreen"),r.removeClass(l,"mce-fullscreen"),s=h.scrollPos,window.scrollTo(s.x,s.y),r.unbind(window,"resize",h.resizeHandler),e.off("remove",h.removeHandler),t.set(null),i(e,!1);else{var g={scrollPos:(u=r.getViewPort(),{x:u.x,y:u.y}),containerWidth:n.width,containerHeight:n.height,iframeWidth:c.width,iframeHeight:c.height,resizeHandler:f,removeHandler:m};c.width=c.height="100%",n.width=n.height="",r.addClass(d,"mce-fullscreen"),r.addClass(a,"mce-fullscreen"),r.addClass(l,"mce-fullscreen"),r.bind(window,"resize",f),e.on("remove",m),f(),t.set(g),i(e,!0)}},o=function(e,t){e.addCommand("mceFullScreen",function(){l(e,t)})},c=function(e){return function(t){var n=t.control;e.on("FullscreenStateChanged",function(e){n.active(e.state)})}},s=function(e){e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,cmd:"mceFullScreen",onPostRender:c(e),context:"view"}),e.addButton("fullscreen",{active:!1,tooltip:"Fullscreen",cmd:"mceFullScreen",onPostRender:c(e)})};t.add("fullscreen",function(t){var i=e(null);return o(t,i),s(t),t.addShortcut("Ctrl+Shift+F","","mceFullScreen"),n(i)})}();!function(){"use strict";var e=function(t){var n=t,l=function(){return n};return{get:l,set:function(e){n=e},clone:function(){return e(l())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=tinymce.util.Tools.resolve("tinymce.html.DomParser"),i=tinymce.util.Tools.resolve("tinymce.html.Node"),r=tinymce.util.Tools.resolve("tinymce.html.Serializer"),o=function(e){return e.getParam("fullpage_hide_in_source_view")},a=function(e){return e.getParam("fullpage_default_xml_pi")},c=function(e){return e.getParam("fullpage_default_encoding")},s=function(e){return e.getParam("fullpage_default_font_family")},u=function(e){return e.getParam("fullpage_default_font_size")},d=function(e){return e.getParam("fullpage_default_text_color")},f=function(e){return e.getParam("fullpage_default_title")},g=function(e){return e.getParam("fullpage_default_doctype","<!DOCTYPE html>")},m=function(e){return l({validate:!1,root_name:"#document"}).parse(e)},h=m,p=function(e,t){var l,i,r=m(t),o={};function a(e,t){return e.attr(t)||""}return o.fontface=s(e),o.fontsize=u(e),7===(l=r.firstChild).type&&(o.xml_pi=!0,(i=/encoding="([^"]+)"/.exec(l.value))&&(o.docencoding=i[1])),(l=r.getAll("#doctype")[0])&&(o.doctype="<!DOCTYPE"+l.value+">"),(l=r.getAll("title")[0])&&l.firstChild&&(o.title=l.firstChild.value),n.each(r.getAll("meta"),function(e){var t,n=e.attr("name"),l=e.attr("http-equiv");n?o[n.toLowerCase()]=e.attr("content"):"Content-Type"===l&&(t=/charset\s*=\s*(.*)\s*/gi.exec(e.attr("content")))&&(o.docencoding=t[1])}),(l=r.getAll("html")[0])&&(o.langcode=a(l,"lang")||a(l,"xml:lang")),o.stylesheets=[],n.each(r.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&o.stylesheets.push(e.attr("href"))}),(l=r.getAll("body")[0])&&(o.langdir=a(l,"dir"),o.style=a(l,"style"),o.visited_color=a(l,"vlink"),o.link_color=a(l,"link"),o.active_color=a(l,"alink")),o},y=function(e,t,l){var o,a,c,s,u,d=e.dom;function f(e,t,n){e.attr(t,n||undefined)}function g(e){a.firstChild?a.insert(e,a.firstChild):a.append(e)}o=m(l),(a=o.getAll("head")[0])||(s=o.getAll("html")[0],a=new i("head",1),s.firstChild?s.insert(a,s.firstChild,!0):s.append(a)),s=o.firstChild,t.xml_pi?(u='version="1.0"',t.docencoding&&(u+=' encoding="'+t.docencoding+'"'),7!==s.type&&(s=new i("xml",7),o.insert(s,o.firstChild,!0)),s.value=u):s&&7===s.type&&s.remove(),s=o.getAll("#doctype")[0],t.doctype?(s||(s=new i("#doctype",10),t.xml_pi?o.insert(s,o.firstChild):g(s)),s.value=t.doctype.substring(9,t.doctype.length-1)):s&&s.remove(),s=null,n.each(o.getAll("meta"),function(e){"Content-Type"===e.attr("http-equiv")&&(s=e)}),t.docencoding?(s||((s=new i("meta",1)).attr("http-equiv","Content-Type"),s.shortEnded=!0,g(s)),s.attr("content","text/html; charset="+t.docencoding)):s&&s.remove(),s=o.getAll("title")[0],t.title?(s?s.empty():g(s=new i("title",1)),s.append(new i("#text",3)).value=t.title):s&&s.remove(),n.each("keywords,description,author,copyright,robots".split(","),function(e){var n,l,r=o.getAll("meta"),a=t[e];for(n=0;n<r.length;n++)if((l=r[n]).attr("name")===e)return void(a?l.attr("content",a):l.remove());a&&((s=new i("meta",1)).attr("name",e),s.attr("content",a),s.shortEnded=!0,g(s))});var h={};return n.each(o.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&(h[e.attr("href")]=e)}),n.each(t.stylesheets,function(e){h[e]||((s=new i("link",1)).attr({rel:"stylesheet",text:"text/css",href:e}),s.shortEnded=!0,g(s)),delete h[e]}),n.each(h,function(e){e.remove()}),(s=o.getAll("body")[0])&&(f(s,"dir",t.langdir),f(s,"style",t.style),f(s,"vlink",t.visited_color),f(s,"link",t.link_color),f(s,"alink",t.active_color),d.setAttribs(e.getBody(),{style:t.style,dir:t.dir,vLink:t.visited_color,link:t.link_color,aLink:t.active_color})),(s=o.getAll("html")[0])&&(f(s,"lang",t.langcode),f(s,"xml:lang",t.langcode)),a.firstChild||a.remove(),(c=r({validate:!1,indent:!0,apply_source_formatting:!0,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(o)).substring(0,c.indexOf("</body>"))},v=function(e,t){var l=p(e,t.get());e.windowManager.open({title:"Document properties",data:l,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(i){var r=y(e,n.extend(l,i.data),t.get());t.set(r)}})},_=function(e,t){e.addCommand("mceFullPageProperties",function(){v(e,t)})},b=function(e,t){return n.each(e,function(e){t=t.replace(e,function(e){return"\x3c!--mce:protected "+escape(e)+"--\x3e"})}),t},x=function(e){return e.replace(/<!--mce:protected ([\s\S]*?)-->/g,function(e,t){return unescape(t)})},k=n.each,C=function(e){return e.replace(/<\/?[A-Z]+/g,function(e){return e.toLowerCase()})},A=function(e){var t,n="",l="";if(a(e)){var i=c(e);n+='<?xml version="1.0" encoding="'+(i||"ISO-8859-1")+'" ?>\n'}return n+=g(e),n+="\n<html>\n<head>\n",(t=f(e))&&(n+="<title>"+t+"</title>\n"),(t=c(e))&&(n+='<meta http-equiv="Content-Type" content="text/html; charset='+t+'" />\n'),(t=s(e))&&(l+="font-family: "+t+";"),(t=u(e))&&(l+="font-size: "+t+";"),(t=d(e))&&(l+="color: "+t+";"),n+="</head>\n<body"+(l?' style="'+l+'"':"")+">\n"},w=function(e,t,l){e.on("BeforeSetContent",function(i){!function(e,t,l,i){var r,a,c,s,u,d="",f=e.dom;if(!(i.selection||(c=b(e.settings.protect,i.content),"raw"===i.format&&t.get()||i.source_view&&o(e)))){0!==c.length||i.source_view||(c=n.trim(t.get())+"\n"+n.trim(c)+"\n"+n.trim(l.get())),-1!==(r=(c=c.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("<body"))?(r=c.indexOf(">",r),t.set(C(c.substring(0,r+1))),-1===(a=c.indexOf("</body",r))&&(a=c.length),i.content=n.trim(c.substring(r+1,a)),l.set(C(c.substring(a)))):(t.set(A(e)),l.set("\n</body>\n</html>")),s=h(t.get()),k(s.getAll("style"),function(e){e.firstChild&&(d+=e.firstChild.value)}),(u=s.getAll("body")[0])&&f.setAttribs(e.getBody(),{style:u.attr("style")||"",dir:u.attr("dir")||"",vLink:u.attr("vlink")||"",link:u.attr("link")||"",aLink:u.attr("alink")||""}),f.remove("fullpage_styles");var g=e.getDoc().getElementsByTagName("head")[0];d&&(f.add(g,"style",{id:"fullpage_styles"},d),(u=f.get("fullpage_styles")).styleSheet&&(u.styleSheet.cssText=d));var m={};n.each(g.getElementsByTagName("link"),function(e){"stylesheet"===e.rel&&e.getAttribute("data-mce-fullpage")&&(m[e.href]=e)}),n.each(s.getAll("link"),function(e){var t=e.attr("href");if(!t)return!0;m[t]||"stylesheet"!==e.attr("rel")||f.add(g,"link",{rel:"stylesheet",text:"text/css",href:t,"data-mce-fullpage":"1"}),delete m[t]}),n.each(m,function(e){e.parentNode.removeChild(e)})}}(e,t,l,i)}),e.on("GetContent",function(i){var r,a,c,s;r=e,a=t.get(),c=l.get(),(s=i).selection||s.source_view&&o(r)||(s.content=x(n.trim(a)+"\n"+n.trim(s.content)+"\n"+n.trim(c)))})},P=function(e){e.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),e.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"})};t.add("fullpage",function(t){var n=e(""),l=e("");_(t,n),P(t),w(t,n,l)})}();!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]],o=function(t){var o;return o='<table role="list" class="mce-grid">',e.each(i,function(i){o+="<tr>",e.each(i,function(e){var i=t+"/img/smiley-"+e+".gif";o+='<td><a href="#" data-mce-url="'+i+'" data-mce-alt="'+e+'" tabindex="-1" role="option" aria-label="'+e+'"><img src="'+i+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),o+="</tr>"}),o+="</table>"},n=function(t,e){var i=o(e);t.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:i,onclick:function(e){var i,o,n,a=t.dom.getParent(e.target,"a");a&&(i=t,o=a.getAttribute("data-mce-url"),n=a.getAttribute("data-mce-alt"),i.insertContent(i.dom.createHTML("img",{src:o,alt:n})),this.hide())}},tooltip:"Emoticons"})};t.add("emoticons",function(t,e){n(t,e)})}();!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(t,i){var n,o=t.dom,c=t.selection.getSelectedBlocks();c.length&&(n=o.getAttrib(c[0],"dir"),e.each(c,function(t){o.getParent(t.parentNode,'*[dir="'+i+'"]',o.getRoot())||o.setAttrib(t,"dir",n!==i?i:null)}),t.nodeChanged())},n=function(t){t.addCommand("mceDirectionLTR",function(){i(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){i(t,"rtl")})},o=function(t){var i=[];return e.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(e){i.push(e+"[dir="+t+"]")}),i.join(",")},c=function(t){t.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:o("ltr")}),t.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:o("rtl")})};t.add("directionality",function(t){n(t),c(t)})}();!function(){"use strict";var t=function(n){var e=n,o=function(){return e};return{get:o,set:function(t){e=t},clone:function(){return t(o())}}},n=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(t){return{isContextMenuVisible:function(){return t.get()}}},o=function(t){return t.settings.contextmenu_never_use_native},r=function(t){return t.getParam("contextmenu","link openlink image inserttable | cell row column deletetable")},i=tinymce.util.Tools.resolve("tinymce.Env"),u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=function(t,n){return{x:t,y:n}},l=function(t,n,e){return c(t.x+n,t.y+e)},s=function(t,n){if(t&&"static"!==u.DOM.getStyle(t,"position",!0)){var e=u.DOM.getPos(t),o=e.x-t.scrollLeft,r=e.y-t.scrollTop;return l(n,-o,-r)}return l(n,0,0)},a=function(t){return i.container},f=function(t,n){if(t.inline)return s(a(),c((f=n).pageX,f.pageY));var e,o,r,i,f,m=(e=t.getContentAreaContainer(),o=c((i=n).clientX,i.clientY),r=u.DOM.getPos(e),l(o,r.x,r.y));return s(a(),m)},m=tinymce.util.Tools.resolve("tinymce.ui.Factory"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(t,n,e,o){null===o.get()?o.set(function(t,n){var e,o,i=[];o=r(t),v.each(o.split(/[ ,]/),function(n){var e=t.menuItems[n];"|"===n&&(e={text:n}),e&&(e.shortcut="",i.push(e))});for(var u=0;u<i.length;u++)"|"===i[u].text&&(0!==u&&u!==i.length-1||i.splice(u,1));return(e=m.create("menu",{items:i,context:"contextmenu",classes:"contextmenu"}).renderTo()).on("hide",function(t){t.control===this&&n.set(!1)}),t.on("remove",function(){e.remove(),e=null}),e}(t,e)):o.get().show(),o.get().moveTo(n.x,n.y),e.set(!0)},y=function(t,n,e){t.on("contextmenu",function(r){var i;i=t,(!r.ctrlKey||o(i))&&(r.preventDefault(),g(t,f(t,r),n,e))})};n.add("contextmenu",function(n){var o=t(null),r=t(!1);return y(n,r,o),e(r)})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Color"),i=function(e,n){e.find("#preview")[0].getEl().style.background=n},t=function(e,t){var l=n(t),a=l.toRgb();e.fromJSON({r:a.r,g:a.g,b:a.b,hex:l.toHex().substr(1)}),i(e,l.toHex())},l=function(e,n,l){var a=e.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:l,onchange:function(){var e=this.rgb();a&&(a.find("#r").value(e.r),a.find("#g").value(e.g),a.find("#b").value(e.b),a.find("#hex").value(this.value().substr(1)),i(a,this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var e,n,i=a.find("colorpicker")[0];if(e=this.name(),n=this.value(),"hex"===e)return t(a,n="#"+n),void i.value(n);n={r:a.find("#r").value(),g:a.find("#g").value(),b:a.find("#b").value()},i.value(n),t(a,n)}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){n("#"+a.toJSON().hex)}});t(a,l)};e.add("colorpicker",function(e){e.settings.color_picker_callback||(e.settings.color_picker_callback=function(n,i){l(e,n,i)})})}();!function(){"use strict";var e=function(t){var a=t,n=function(){return a};return{get:n,set:function(e){a=e},clone:function(){return e(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),n=function(e){return e.settings.codesample_content_css},i=function(e){return e.settings.codesample_languages},r=function(e){return Math.min(a.DOM.getViewPort().w,e.getParam("codesample_dialog_width",800))},s=function(e){return Math.min(a.DOM.getViewPort().w,e.getParam("codesample_dialog_height",650))},o={},l=void 0!==o?o:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},c=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=l.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){switch(t.util.type(e)){case"Object":var a={};for(var n in e)e.hasOwnProperty(n)&&(a[n]=t.util.clone(e[n]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,a){var n=t.util.clone(t.languages[e]);for(var i in a)n[i]=a[i];return n},insertBefore:function(e,a,n,i){var r=(i=i||t.languages)[e];if(2===arguments.length){for(var s in n=arguments[1])n.hasOwnProperty(s)&&(r[s]=n[s]);return r}var o={};for(var l in r)if(r.hasOwnProperty(l)){if(l===a)for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);o[l]=r[l]}return t.languages.DFS(t.languages,function(t,a){a===i[e]&&t!==e&&(this[t]=o)}),i[e]=o},DFS:function(e,a,n){for(var i in e)e.hasOwnProperty(i)&&(a.call(e,i,e[i],n||i),"Object"===t.util.type(e[i])?t.languages.DFS(e[i],a):"Array"===t.util.type(e[i])&&t.languages.DFS(e[i],a,i))}},plugins:{},highlightAll:function(e,a){for(var n=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0,r=void 0;r=n[i++];)t.highlightElement(r,!0===e,a)},highlightElement:function(a,n,i){for(var r,s,o=a;o&&!e.test(o.className);)o=o.parentNode;o&&(r=(o.className.match(e)||[,""])[1],s=t.languages[r]),a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+r,o=a.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+r);var c=a.textContent,u={element:a,language:r,grammar:s,code:c};if(c&&s)if(t.hooks.run("before-highlight",u),n&&l.Worker){var g=new Worker(t.filename);g.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(u.element),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(a),t.hooks.run("after-highlight",u),t.hooks.run("complete",u);else t.hooks.run("complete",u)},highlight:function(e,n,i){var r=t.tokenize(e,n);return a.stringify(t.util.encode(r),i)},tokenize:function(e,a,n){var i=t.Token,r=[e],s=a.rest;if(s){for(var o in s)a[o]=s[o];delete a.rest}e:for(var o in a)if(a.hasOwnProperty(o)&&a[o]){var l=a[o];l="Array"===t.util.type(l)?l:[l];for(var c=0;c<l.length;++c){var u=l[c],g=u.inside,d=!!u.lookbehind,p=0,f=u.alias;u=u.pattern||u;for(var h=0;h<r.length;h++){var m=r[h];if(r.length>e.length)break e;if(!(m instanceof i)){u.lastIndex=0;var b=u.exec(m);if(b){d&&(p=b[1].length);var y=b.index-1+p,v=y+(b=b[0].slice(p)).length,k=m.slice(0,y+1),w=m.slice(v+1),x=[h,1];k&&x.push(k);var S=new i(o,g?t.tokenize(b,g):b,f);x.push(S),w&&x.push(w),Array.prototype.splice.apply(r,x)}}}}}return r},hooks:{all:{},add:function(e,a){var n=t.hooks.all;n[e]=n[e]||[],n[e].push(a)},run:function(e,a){var n=t.hooks.all[e];if(n&&n.length)for(var i=0,r=void 0;r=n[i++];)r(a)}}},a=t.Token=function(e,t,a){this.type=e,this.content=t,this.alias=a};if(a.stringify=function(e,n,i){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return a.stringify(t,n,e)}).join("");var r={type:e.type,content:a.stringify(e.content,n,i),tag:"span",classes:["token",e.type],attributes:{},language:n,parent:i};if("comment"===r.type&&(r.attributes.spellcheck="true"),e.alias){var s="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(r.classes,s)}t.hooks.run("wrap",r);var o="";for(var l in r.attributes)o+=(o?" ":"")+l+'="'+(r.attributes[l]||"")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'" '+o+">"+r.content+"</"+r.tag+">"},!l.document)return l.addEventListener?(l.addEventListener("message",function(e){var a=JSON.parse(e.data),n=a.language,i=a.code,r=a.immediateClose;l.postMessage(t.highlight(i,t.languages[n],n)),r&&l.close()},!1),l.Prism):l.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=c),"undefined"!=typeof global&&(global.Prism=c),c.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},c.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},c.languages.css.atrule.inside.rest=c.util.clone(c.languages.css),c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/i,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/i,inside:c.languages.markup.tag.inside},rest:c.languages.css},alias:"language-css"}}),c.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:c.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:c.languages.css}},alias:"language-css"}},c.languages.markup.tag)),c.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},c.languages.javascript=c.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),c.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),c.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:c.languages.javascript}},string:/[\s\S]+/}}}),c.languages.markup&&c.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/i,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/i,inside:c.languages.markup.tag.inside},rest:c.languages.javascript},alias:"language-javascript"}}),c.languages.js=c.languages.javascript,c.languages.c=c.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i}),c.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,lookbehind:!0}}}}),delete c.languages.c["class-name"],delete c.languages.c["boolean"],c.languages.csharp=c.languages.extend("clike",{keyword:/\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,string:[/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,/("|')(\\?.)*?\1/],number:/\b-?(0x[\da-f]+|\d*\.?\d+)\b/i}),c.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}}),c.languages.cpp=c.languages.extend("c",{keyword:/\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(true|false)\b/,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),c.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}}),c.languages.java=c.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,operator:{pattern:/(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,lookbehind:!0}}),c.languages.php=c.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),c.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),c.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),c.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),c.languages.markup&&(c.hooks.add("before-highlight",function(e){"php"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(t){return e.tokenStack.push(t),"{{{PHP"+e.tokenStack.length+"}}}"}))}),c.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),c.hooks.add("after-highlight",function(e){if("php"===e.language){for(var t=0,a=void 0;a=e.tokenStack[t];t++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(t+1)+"}}}",c.highlight(a,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),c.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'<span class="token php">$1</span>'))}),c.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:c.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})),c.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/},function(e){e.languages.ruby=e.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var t={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.util.clone(e.languages.ruby)}};e.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:t}},{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:t}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:t}}]}(c);var u={isCodeSample:function(e){return e&&"PRE"===e.nodeName&&-1!==e.className.indexOf("language-")},trimArg:function(e){return function(t,a){return e(a)}}},g=function(e){var t=e.selection.getNode();return u.isCodeSample(t)?t:null},d=g,p=function(e,t,n){e.undoManager.transact(function(){var i=g(e);n=a.DOM.encode(n),i?(e.dom.setAttrib(i,"class","language-"+t),i.innerHTML=n,c.highlightElement(i),e.selection.select(i)):(e.insertContent('<pre id="__new" class="language-'+t+'">'+n+"</pre>"),e.selection.select(e.$("#__new").removeAttr("id")[0]))})},f=function(e){var t=g(e);return t?t.textContent:""},h=function(e){var t=i(e);return t||[{text:"HTML/XML",value:"markup"},{text:"JavaScript",value:"javascript"},{text:"CSS",value:"css"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"}]},m=function(e){var t,a=d(e);return a&&(t=a.className.match(/language-(\w+)/))?t[1]:""},b=function(e){var t=r(e),a=s(e),n=m(e),i=h(e),o=f(e);e.windowManager.open({title:"Insert/Edit code sample",minWidth:t,minHeight:a,layout:"flex",direction:"column",align:"stretch",body:[{type:"listbox",name:"language",label:"Language",maxWidth:200,value:n,values:i},{type:"textbox",name:"code",multiline:!0,spellcheck:!1,ariaLabel:"Code view",flex:1,style:"direction: ltr; text-align: left",classes:"monospace",value:o,autofocus:!0}],onSubmit:function(t){p(e,t.data.language,t.data.code)}})},y=function(e){e.addCommand("codesample",function(){var t=e.selection.getNode();e.selection.isCollapsed()||u.isCodeSample(t)?b(e):e.formatter.toggle("code")})},v=function(e){var t=e.$;e.on("PreProcess",function(e){t("pre[contenteditable=false]",e.node).filter(u.trimArg(u.isCodeSample)).each(function(e,a){var n=t(a),i=a.textContent;n.attr("class",t.trim(n.attr("class"))),n.removeAttr("contentEditable"),n.empty().append(t("<code></code>").each(function(){this.textContent=i}))})}),e.on("SetContent",function(){var a=t("pre").filter(u.trimArg(u.isCodeSample)).filter(function(e,t){return"false"!==t.contentEditable});a.length&&e.undoManager.transact(function(){a.each(function(a,n){t(n).find("br").each(function(t,a){a.parentNode.replaceChild(e.getDoc().createTextNode("\n"),a)}),n.contentEditable=!1,n.innerHTML=e.dom.encode(n.textContent),c.highlightElement(n),n.className=t.trim(n.className)})})})},k=function(e,t,a,i){var r,s=n(e);e.inline&&a.get()||!e.inline&&i.get()||(e.inline?a.set(!0):i.set(!0),!1!==s&&(r=e.dom.create("link",{rel:"stylesheet",href:s||t+"/css/prism.css"}),e.getDoc().getElementsByTagName("head")[0].appendChild(r)))},w=function(e){e.addButton("codesample",{cmd:"codesample",title:"Insert/Edit code sample"}),e.addMenuItem("codesample",{cmd:"codesample",text:"Code sample",icon:"codesample"})},x=e(!1);t.add("codesample",function(t,a){var n=e(!1);v(t),w(t),y(t),t.on("init",function(){k(t,a,x,n)}),t.on("dblclick",function(e){u.isCodeSample(e.target)&&b(t)})})}();!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),e=function(t){return t.getParam("code_dialog_width",600)},o=function(t){return t.getParam("code_dialog_height",Math.min(n.DOM.getViewPort().h-200,500))},i=function(t,n){t.focus(),t.undoManager.transact(function(){t.setContent(n)}),t.selection.setCursorLocation(),t.nodeChanged()},c=function(t){return t.getContent({source_view:!0})},d=function(t){var n=e(t),d=o(t);t.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:n,minHeight:d,spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(n){i(t,n.data.code)}}).find("#code").value(c(t))},u=function(t){t.addCommand("mceCodeEditor",function(){d(t)})},a=function(t){t.addButton("code",{icon:"code",tooltip:"Source code",onclick:function(){d(t)}}),t.addMenuItem("code",{icon:"code",text:"Source code",onclick:function(){d(t)}})};t.add("code",function(t){return u(t),a(t),{}})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e,t){return e.fire("insertCustomChar",{chr:t})},a=function(e,a){var i=t(e,a).chr;e.execCommand("mceInsertContent",!1,i)},i=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=function(e){return e.settings.charmap},n=function(e){return e.settings.charmap_append},o=i.isArray,l=function(e){return o(e)?[].concat((t=e,i.grep(t,function(e){return o(e)&&2===e.length}))):"function"==typeof e?e():[];var t},c=function(e){return function(e,t){var a=r(e);a&&(t=l(a));var i=n(e);return i?[].concat(t).concat(l(i)):t}(e,[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["256","A - macron"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["274","E - macron"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["298","I - macron"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["332","O - macron"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["362","U - macron"],["221","Y - acute"],["376","Y - diaeresis"],["562","Y - macron"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["257","a - macron"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["275","e - macron"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["299","i - macron"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["333","o macron"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["363","u - macron"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["563","y - macron"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]])},s=function(e){return{getCharMap:function(){return c(e)},insertChar:function(t){a(e,t)}}},u=function(e){var t,a,i,r=Math.min(e.length,25),n=Math.ceil(e.length/r);for(t='<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>',i=0;i<n;i++){for(t+="<tr>",a=0;a<r;a++){var o=i*r+a;if(o<e.length){var l=e[o],c=parseInt(l[0],10),s=l?String.fromCharCode(c):"&nbsp;";t+='<td title="'+l[1]+'"><div tabindex="-1" title="'+l[1]+'" role="button" data-chr="'+c+'">'+s+"</div></td>"}else t+="<td />"}t+="</tr>"}return t+="</tbody></table>"},d=function(e){for(;e;){if("TD"===e.nodeName)return e;e=e.parentNode}},m=function(e){var t,i={type:"container",html:u(c(e)),onclick:function(i){var r=i.target;if(/^(TD|DIV)$/.test(r.nodeName)){var n=d(r).firstChild;if(n&&n.hasAttribute("data-chr")){var o=n.getAttribute("data-chr"),l=parseInt(o,10);isNaN(l)||a(e,String.fromCharCode(l)),i.ctrlKey||t.close()}}},onmouseover:function(e){var a=d(e.target);a&&a.firstChild?(t.find("#preview").text(a.firstChild.firstChild.data),t.find("#previewTitle").text(a.title)):(t.find("#preview").text(" "),t.find("#previewTitle").text(" "))}};t=e.windowManager.open({title:"Special character",spacing:10,padding:10,items:[i,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){t.close()}}]})},g=function(e){e.addCommand("mceShowCharmap",function(){m(e)})},p=function(e){e.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),e.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"})};e.add("charmap",function(e){return g(e),p(e),s(e)})}();!function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(o){o=t.trim(o);var e=function(t,e){o=o.replace(t,e)};return e(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),e(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),e(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),e(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),e(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),e(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),e(/<font>(.*?)<\/font>/gi,"$1"),e(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),e(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),e(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),e(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),e(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),e(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),e(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),e(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),e(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),e(/<\/(strong|b)>/gi,"[/b]"),e(/<(strong|b)>/gi,"[b]"),e(/<\/(em|i)>/gi,"[/i]"),e(/<(em|i)>/gi,"[i]"),e(/<\/u>/gi,"[/u]"),e(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),e(/<u>/gi,"[u]"),e(/<blockquote[^>]*>/gi,"[quote]"),e(/<\/blockquote>/gi,"[/quote]"),e(/<br \/>/gi,"\n"),e(/<br\/>/gi,"\n"),e(/<br>/gi,"\n"),e(/<p>/gi,""),e(/<\/p>/gi,"\n"),e(/&nbsp;|\u00a0/gi," "),e(/&quot;/gi,'"'),e(/&lt;/gi,"<"),e(/&gt;/gi,">"),e(/&amp;/gi,"&"),o},i=function(o){o=t.trim(o);var e=function(t,e){o=o.replace(t,e)};return e(/\n/gi,"<br />"),e(/\[b\]/gi,"<strong>"),e(/\[\/b\]/gi,"</strong>"),e(/\[i\]/gi,"<em>"),e(/\[\/i\]/gi,"</em>"),e(/\[u\]/gi,"<u>"),e(/\[\/u\]/gi,"</u>"),e(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),e(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),e(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),e(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),e(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span>&nbsp;'),e(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;'),o};o.add("bbcode",function(){return{init:function(o){o.on("beforeSetContent",function(o){o.content=i(o.content)}),o.on("postProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=e(o.content))})}}})}();!function(){"use strict";var t=function(e){var r=e,n=function(){return r};return{get:n,set:function(t){r=t},clone:function(){return t(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(t){return t.fire("RestoreDraft")},o=function(t){return t.fire("StoreDraft")},i=function(t){return t.fire("RemoveDraft")},s=function(t,e){return((t=/^(\d+)([ms]?)$/.exec(""+(t||e)))[2]?{s:1e3,m:6e4}[t[2]]:1)*parseInt(t,10)},u=function(t){return t.getParam("autosave_ask_before_unload",!0)},f=function(t){var e=t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return e=(e=(e=(e=e.replace(/\{path\}/g,document.location.pathname)).replace(/\{query\}/g,document.location.search)).replace(/\{hash\}/g,document.location.hash)).replace(/\{id\}/g,t.id)},c=function(t){return s(t.settings.autosave_interval,"30s")},l=function(t){return s(t.settings.autosave_retention,"20m")},m=function(t,e){var r=t.settings.forced_root_block;return""===(e=n.trim(void 0===e?t.getBody().innerHTML:e))||new RegExp("^<"+r+"[^>]*>((\xa0|&nbsp;|[ \t]|<br[^>]*>)+?|)</"+r+">|<br>$","i").test(e)},v=function(t){var e=parseInt(r.getItem(f(t)+"time"),10)||0;return!((new Date).getTime()-e>l(t)&&(d(t,!1),1))},d=function(t,e){var n=f(t);r.removeItem(n+"draft"),r.removeItem(n+"time"),!1!==e&&i(t)},D=function(t){var e=f(t);!m(t)&&t.isDirty()&&(r.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),r.setItem(e+"time",(new Date).getTime().toString()),o(t))},g=function(t){var e=f(t);v(t)&&(t.setContent(r.getItem(e+"draft"),{format:"raw"}),a(t))},y={isEmpty:m,hasDraft:v,removeDraft:d,storeDraft:D,restoreDraft:g,startStoreDraft:function(t,e){var r=c(t);e.get()||(setInterval(function(){t.removed||D(t)},r),e.set(!0))},restoreLastDraft:function(t){t.undoManager.transact(function(){g(t),d(t)}),t.focus()}},p=function(t,e){return function(){var r=Array.prototype.slice.call(arguments);return t.apply(null,[e].concat(r))}},h=function(t){return{hasDraft:p(y.hasDraft,t),storeDraft:p(y.storeDraft,t),restoreDraft:p(y.restoreDraft,t),removeDraft:p(y.removeDraft,t),isEmpty:p(y.isEmpty,t)}},_=tinymce.util.Tools.resolve("tinymce.EditorManager");_._beforeUnloadHandler=function(){var t;return n.each(_.get(),function(e){e.plugins.autosave&&e.plugins.autosave.storeDraft(),!t&&e.isDirty()&&u(e)&&(t=e.translate("You have unsaved changes are you sure you want to navigate away?"))}),t};var b=function(t){window.onbeforeunload=_._beforeUnloadHandler},I=function(t,e){return function(r){var n=r.control;n.disabled(!y.hasDraft(t)),t.on("StoreDraft RestoreDraft RemoveDraft",function(){n.disabled(!y.hasDraft(t))}),y.startStoreDraft(t,e)}},w=function(t,e){t.addButton("restoredraft",{title:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e)}),t.addMenuItem("restoredraft",{text:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e),context:"file"})};e.add("autosave",function(e){var r=t(!1);return b(e),w(e,r),h(e)})}();!function(){"use strict";var t=function(e){var n=e,i=function(){return n};return{get:i,set:function(t){n=t},clone:function(){return t(i())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.Env"),i=tinymce.util.Tools.resolve("tinymce.util.Delay"),o=function(t){return parseInt(t.getParam("autoresize_min_height",t.getElement().offsetHeight),10)},r=function(t){return parseInt(t.getParam("autoresize_max_height",0),10)},a=function(t){return t.getParam("autoresize_overflow_padding",1)},u=function(t){return t.getParam("autoresize_bottom_margin",50)},s=function(t){return t.getParam("autoresize_on_init",!0)},l=function(t,e,n,o,r){i.setEditorTimeout(t,function(){c(t,e),n--?l(t,e,n,o,r):r&&r()},o)},g=function(t,e){var n=t.getBody();n&&(n.style.overflowY=e?"":"hidden",e||(n.scrollTop=0))},c=function(t,e){var i,a,u,s,l,f,d,m,p,y,h,v=t.dom;if(a=t.getDoc())if((S=t).plugins.fullscreen&&S.plugins.fullscreen.isFullscreen())g(t,!0);else{var S;u=a.body,s=o(t),f=v.getStyle(u,"margin-top",!0),d=v.getStyle(u,"margin-bottom",!0),m=v.getStyle(u,"padding-top",!0),p=v.getStyle(u,"padding-bottom",!0),y=v.getStyle(u,"border-top-width",!0),h=v.getStyle(u,"border-bottom-width",!0),l=u.offsetHeight+parseInt(f,10)+parseInt(d,10)+parseInt(m,10)+parseInt(p,10)+parseInt(y,10)+parseInt(h,10),(isNaN(l)||l<=0)&&(l=n.ie?u.scrollHeight:n.webkit&&0===u.clientHeight?0:u.offsetHeight),l>o(t)&&(s=l);var _=r(t);_&&l>_?(s=_,g(t,!0)):g(t,!1),s!==e.get()&&(i=s-e.get(),v.setStyle(t.iframeElement,"height",s+"px"),e.set(s),n.webkit&&i<0&&c(t,e))}},f={setup:function(t,e){t.on("init",function(){var e,n,i=t.dom;e=a(t),n=u(t),!1!==e&&i.setStyles(t.getBody(),{paddingLeft:e,paddingRight:e}),!1!==n&&i.setStyles(t.getBody(),{paddingBottom:n})}),t.on("nodechange setcontent keyup FullscreenStateChanged",function(n){c(t,e)}),s(t)&&t.on("init",function(){l(t,e,20,100,function(){l(t,e,5,1e3)})})},resize:c},d=function(t,e){t.addCommand("mceAutoResize",function(){f.resize(t,e)})};e.add("autoresize",function(e){if(!e.inline){var n=t(0);d(e,n),f.setup(e,n)}})}();!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env"),n=function(e){return e.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i)},i=function(e){return e.getParam("default_link_target","")},o=function(e,t){if(t<0&&(t=0),3===e.nodeType){var n=e.data.length;t>n&&(t=n)}return t},r=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,o(t,n)):e.setStartBefore(t)},a=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,o(t,n)):e.setEndAfter(t)},d=function(e,t,o){var d,f,s,l,c,u,g,h,C,m,y=n(e),k=i(e);if("A"!==e.selection.getNode().tagName){if((d=e.selection.getRng(!0).cloneRange()).startOffset<5){if(!(h=d.endContainer.previousSibling)){if(!d.endContainer.firstChild||!d.endContainer.firstChild.nextSibling)return;h=d.endContainer.firstChild.nextSibling}if(C=h.length,r(d,h,C),a(d,h,C),d.endOffset<5)return;f=d.endOffset,l=h}else{if(3!==(l=d.endContainer).nodeType&&l.firstChild){for(;3!==l.nodeType&&l.firstChild;)l=l.firstChild;3===l.nodeType&&(r(d,l,0),a(d,l,l.nodeValue.length))}f=1===d.endOffset?2:d.endOffset-1-t}s=f;do{r(d,l,f>=2?f-2:0),a(d,l,f>=1?f-1:0),f-=1,m=d.toString()}while(" "!==m&&""!==m&&160!==m.charCodeAt(0)&&f-2>=0&&m!==o);var p;(p=d.toString())===o||" "===p||160===p.charCodeAt(0)?(r(d,l,f),a(d,l,s),f+=1):0===d.startOffset?(r(d,l,0),a(d,l,s)):(r(d,l,f),a(d,l,s)),"."===(u=d.toString()).charAt(u.length-1)&&a(d,l,s-1),(g=(u=d.toString().trim()).match(y))&&("www."===g[1]?g[1]="http://www.":/@$/.test(g[1])&&!/^mailto:/.test(g[1])&&(g[1]="mailto:"+g[1]),c=e.selection.getBookmark(),e.selection.setRng(d),e.execCommand("createlink",!1,g[1]+g[2]),k&&e.dom.setAttrib(e.selection.getNode(),"target",k),e.selection.moveToBookmark(c),e.nodeChanged())}},f=function(e){var n;e.on("keydown",function(t){13!==t.keyCode||d(e,-1,"")}),t.ie?e.on("focus",function(){if(!n){n=!0;try{e.execCommand("AutoUrlDetect",!1,!0)}catch(t){}}}):(e.on("keypress",function(t){41!==t.keyCode||d(e,-1,"(")}),e.on("keyup",function(t){32!==t.keyCode||d(e,0,"")}))};e.add("autolink",function(e){f(e)})}();!function(){"use strict";var t=function(t){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)},e=function(t){var e=t.selection.getNode();return"A"===e.tagName&&""===t.dom.getAttrib(e,"href")?e.id||e.name:""},n=function(t,e){var n=t.selection.getNode();"A"===n.tagName&&""===t.dom.getAttrib(n,"href")?(n.removeAttribute("name"),n.id=e):(t.focus(),t.selection.collapse(!0),t.execCommand("mceInsertContent",!1,t.dom.createHTML("a",{id:e})))},o=function(o){var r=e(o);o.windowManager.open({title:"Anchor",body:{type:"textbox",name:"id",size:40,label:"Id",value:r},onsubmit:function(e){var r,a,i=e.data.id;r=o,(t(a=i)?(n(r,a),0):(r.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),1))&&e.preventDefault()}})},r=function(t){t.addCommand("mceAnchor",function(){o(t)})},a=function(t){return function(e){for(var n=0;n<e.length;n++)(o=e[n]).attr("href")||!o.attr("id")&&!o.attr("name")||o.firstChild||e[n].attr("contenteditable",t);var o}},i=function(t){t.on("PreInit",function(){t.parser.addNodeFilter("a",a("false")),t.serializer.addNodeFilter("a",a(null))})},c=function(t){t.addButton("anchor",{icon:"anchor",tooltip:"Anchor",cmd:"mceAnchor",stateSelector:"a:not([href])"}),t.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",cmd:"mceAnchor"})};tinymce.util.Tools.resolve("tinymce.PluginManager").add("anchor",function(t){i(t),r(t),c(t)})}();!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=function(t,e,n){var r="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(r,!1,!1===n?null:{"list-style-type":n})},r=function(t){t.addCommand("ApplyUnorderedListStyle",function(e,r){n(t,"UL",r["list-style-type"])}),t.addCommand("ApplyOrderedListStyle",function(e,r){n(t,"OL",r["list-style-type"])})},o=function(t){var e=t.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return e?e.split(/[ ,]/):[]},i=function(t){var e=t.getParam("advlist_bullet_styles","default,circle,disc,square");return e?e.split(/[ ,]/):[]},l=function(t){return t&&/^(TH|TD)$/.test(t.nodeName)},a=function(t){return function(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)&&(r=e,(n=t).$.contains(n.getBody(),r));var n,r}},s=function(t){var e=t.dom.getParent(t.selection.getNode(),"ol,ul");return t.dom.getStyle(e,"listStyleType")||""},u=function(t){return e.map(t,function(t){return{text:t.replace(/\-/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()}),data:"default"===t?"":t}})},c=function(t,n){return function(r){var o=r.control;t.on("NodeChange",function(r){var i=function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}(r.parents,l),s=-1!==i?r.parents.slice(0,i):r.parents,u=e.grep(s,a(t));o.active(u.length>0&&u[0].nodeName===n)})}},d=function(t,e,r,o,i,l){var a;t.addButton(e,{active:!1,type:"splitbutton",tooltip:r,menu:u(l),onPostRender:c(t,i),onshow:(a=t,function(t){var e=s(a);t.control.items().each(function(t){t.active(t.settings.data===e)})}),onselect:function(e){n(t,i,e.control.settings.data)},onclick:function(){t.execCommand(o)}})},p=function(t,e,n,r,o,i){var l,a,s,u,p;i.length>0?d(t,e,n,r,o,i):(a=e,s=n,u=r,p=o,(l=t).addButton(a,{active:!1,type:"button",tooltip:s,onPostRender:c(l,p),onclick:function(){l.execCommand(u)}}))},f=function(t){p(t,"numlist","Numbered list","InsertOrderedList","OL",o(t)),p(t,"bullist","Bullet list","InsertUnorderedList","UL",i(t))};t.add("advlist",function(t){var n,o,i;o="lists",i=(n=t).settings.plugins?n.settings.plugins:"",-1!==e.inArray(i.split(/[ ,]/),o)&&(f(t),r(t))})}();!function(){"use strict";var e,t,n,i,r,o=tinymce.util.Tools.resolve("tinymce.ThemeManager"),s=tinymce.util.Tools.resolve("tinymce.EditorManager"),a=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=function(e){return!1!==u(e)},u=function(e){return e.getParam("menubar")},c=function(e){return e.getParam("toolbar_items_size")},d=function(e){return e.getParam("menu")},f=function(e){return!1===e.settings.skin},h=function(e){var t=e.getParam("resize","vertical");return!1===t?"none":"both"===t?"both":"vertical"},m=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),g=tinymce.util.Tools.resolve("tinymce.ui.Factory"),p=tinymce.util.Tools.resolve("tinymce.util.I18n"),v=function(e){return e.fire("SkinLoaded")},b=function(e){return e.fire("ResizeEditor")},y=function(e){return e.fire("BeforeRenderUI")},x=function(e,t){return function(){var n=e.find(t)[0];n&&n.focus(!0)}},w=function(e,t){e.shortcuts.add("Alt+F9","",x(t,"menubar")),e.shortcuts.add("Alt+F10,F10","",x(t,"toolbar")),e.shortcuts.add("Alt+F11","",x(t,"elementpath")),t.on("cancel",function(){e.focus()})},_=tinymce.util.Tools.resolve("tinymce.Env"),R=tinymce.util.Tools.resolve("tinymce.geom.Rect"),C=tinymce.util.Tools.resolve("tinymce.util.Delay"),k=function(e){return function(){return e}},E={noop:function(){},noarg:function(e){return function(){return e()}},compose:function(e,t){return function(){return e(t.apply(null,arguments))}},constant:k,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(e){for(var t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[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=t.concat(n);return e.apply(null,r)}},not:function(e){return function(){return!e.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:k(!1),always:k(!0)},H=E.never,S=E.always,M=function(){return T},T=(i={fold:function(e,t){return e()},is:H,isSome:H,isNone:S,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:M,ap:M,each:function(){},bind:M,flatten:M,exists:H,forall:S,filter:M,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:E.constant("none()")},Object.freeze&&Object.freeze(i),i),P=function(e){var t=function(){return e},n=function(){return r},i=function(t){return t(e)},r={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:S,isNone:H,getOr:t,getOrThunk:t,getOrDie:t,or:n,orThunk:n,map:function(t){return P(t(e))},ap:function(t){return t.fold(M,function(t){return P(t(e))})},each:function(t){t(e)},bind:i,flatten:t,exists:i,forall:i,filter:function(t){return t(e)?r:T},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(H,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return r},W={some:P,none:M,from:function(e){return null===e||e===undefined?T:P(e)}},D=function(){var e=_.container;if(e&&"static"!==m.DOM.getStyle(e,"position",!0)){var t=m.DOM.getPos(e),n=e.scrollLeft-t.x,i=e.scrollTop-t.y;return W.some({x:n,y:i})}return W.none()},N=function(e,t,n){var i,r=[];if(t)return a.each(t.split(/[ ,]/),function(t){var o,s=function(){var n=e.selection;t.settings.stateSelector&&n.selectorChanged(t.settings.stateSelector,function(e){t.active(e)},!0),t.settings.disabledStateSelector&&n.selectorChanged(t.settings.disabledStateSelector,function(e){t.disabled(e)})};"|"===t?i=null:(i||(i={type:"buttongroup",items:[]},r.push(i)),e.buttons[t]&&(o=t,"function"==typeof(t=e.buttons[o])&&(t=t()),t.type=t.type||"button",t.size=n,t=g.create(t),i.items.push(t),e.initialized?s():e.on("init",s)))}),{type:"toolbar",layout:"flow",items:r}},A=N,B=function(e,t){var n,i,r=[];if(a.each(!1===(i=(n=e).getParam("toolbar"))?[]:a.isArray(i)?a.grep(i,function(e){return e.length>0}):function(e,t){for(var n=[],i=1;i<10;i++){var r=e["toolbar"+i];if(!r)break;n.push(r)}var o=e.toolbar?[e.toolbar]:[t];return n.length>0?n:o}(n.settings,"undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"),function(n){var i;(i=n)&&r.push(N(e,i,t))}),r.length)return{type:"panel",layout:"stack",classes:"toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:r}},O=m.DOM,z=function(e){return{left:e.x,top:e.y,width:e.w,height:e.h,right:e.x+e.w,bottom:e.y+e.h}},L=function(e,t){e.moveTo(t.left,t.top)},I=function(e,t,n,i,r,o){return o=z({x:t,y:n,w:o.w,h:o.h}),e&&(o=e({elementRect:z(i),contentAreaRect:z(r),panelRect:o})),o},F=function(e){var t,n=function(){return e.contextToolbars||[]},i=function(t,n){var i,r,o,s,l,u,c,d=e.getParam("inline_toolbar_position_handler");if(!e.removed){if(!t||!t.toolbar.panel)return f=e,void a.each(f.contextToolbars,function(e){e.panel&&e.panel.hide()});var f,h,m,g,p;c=["bc-tc","tc-bc","tl-bl","bl-tl","tr-br","br-tr"],l=t.toolbar.panel,n&&l.show(),h=t.element,m=O.getPos(e.getContentAreaContainer()),g=e.dom.getRect(h),"BODY"===(p=e.dom.getRoot()).nodeName&&(g.x-=p.ownerDocument.documentElement.scrollLeft||p.scrollLeft,g.y-=p.ownerDocument.documentElement.scrollTop||p.scrollTop),g.x+=m.x,g.y+=m.y,o=g,r=O.getRect(l.getEl()),s=O.getRect(e.getContentAreaContainer()||e.getBody());var v,b,y,x=D().getOr({x:0,y:0});if(o.x+=x.x,o.y+=x.y,r.x+=x.x,r.y+=x.y,s.x+=x.x,s.y+=x.y,"inline"!==O.getStyle(t.element,"display",!0)){var w=t.element.getBoundingClientRect();o.w=w.width,o.h=w.height}e.inline||(s.w=e.getDoc().documentElement.offsetWidth),e.selection.controlSelection.isResizable(t.element)&&o.w<25&&(o=R.inflate(o,0,8)),i=R.findBestRelativePosition(r,o,s,c),o=R.clamp(o,s),i?(u=R.relativePosition(r,o,i),L(l,I(d,u.x,u.y,o,s,r))):(s.h+=r.h,(o=R.intersect(s,o))?(i=R.findBestRelativePosition(r,o,s,["bc-tc","bl-tl","br-tr"]))?(u=R.relativePosition(r,o,i),L(l,I(d,u.x,u.y,o,s,r))):L(l,I(d,o.x,o.y,o,s,r)):l.hide()),v=l,y=function(e,t){return e===t},b=(b=i)?b.substr(0,2):"",a.each({t:"down",b:"up"},function(e,t){v.classes.toggle("arrow-"+e,y(t,b.substr(0,1)))}),a.each({l:"left",r:"right"},function(e,t){v.classes.toggle("arrow-"+e,y(t,b.substr(1,1)))})}},r=function(t){return function(){C.requestAnimationFrame(function(){e.selection&&i(l(e.selection.getNode()),t)})}},o=function(n){var o;if(n.toolbar.panel)return n.toolbar.panel.show(),void i(n);!function(){if(!t){var n=r(!0);t=e.selection.getScrollContainer()||e.getWin(),O.bind(t,"scroll",n),O.bind(_.container,"scroll",n),e.on("remove",function(){O.unbind(t,"scroll",n),O.unbind(_.container,"scroll",n)})}}(),o=g.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:A(e,n.toolbar.items),oncancel:function(){e.focus()}}),n.toolbar.panel=o,o.renderTo().reflow(),i(n)},s=function(){a.each(n(),function(e){e.panel&&e.panel.hide()})},l=function(t){var i,r,o,s=n();for(i=(o=e.$(t).parents().add(t)).length-1;i>=0;i--)for(r=s.length-1;r>=0;r--)if(s[r].predicate(o[i]))return{toolbar:s[r],element:o[i]};return null};e.on("click keyup setContent ObjectResized",function(t){("setcontent"!==t.type||t.selection)&&C.setEditorTimeout(e,function(){var t;(t=l(e.selection.getNode()))?(s(),o(t)):s()})}),e.on("blur hide contextmenu",s),e.on("ObjectResizeStart",function(){var t=l(e.selection.getNode());t&&t.toolbar.panel&&t.toolbar.panel.hide()}),e.on("ResizeEditor ResizeWindow",r(!0)),e.on("nodeChange",r(!1)),e.on("remove",function(){a.each(n(),function(e){e.panel&&e.panel.remove()}),e.contextToolbars={}}),e.shortcuts.add("ctrl+shift+e > ctrl+shift+p","",function(){var t=l(e.selection.getNode());t&&t.toolbar.panel&&t.toolbar.panel.items()[0].focus()})},V=(r=Array.prototype.indexOf)===undefined?function(e,t){return J(e,t)}:function(e,t){return r.call(e,t)},U=function(e,t){return V(e,t)>-1},Y=function(e,t){for(var n=e.length,i=new Array(n),r=0;r<n;r++){var o=e[r];i[r]=t(o,r,e)}return i},$=function(e,t){for(var n=0,i=e.length;n<i;n++)t(e[n],n,e)},j=function(e,t){for(var n=e.length-1;n>=0;n--)t(e[n],n,e)},q=function(e,t){for(var n=[],i=0,r=e.length;i<r;i++){var o=e[i];t(o,i,e)&&n.push(o)}return n},X=function(e,t){for(var n=0,i=e.length;n<i;n++)if(t(e[n],n,e))return W.some(n);return W.none()},J=function(e,t){for(var n=0,i=e.length;n<i;++n)if(e[n]===t)return n;return-1},G=Array.prototype.push,K=function(e){for(var t=[],n=0,i=e.length;n<i;++n){if(!Array.prototype.isPrototypeOf(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);G.apply(t,e[n])}return t},Z=function(e,t){for(var n=0,i=e.length;n<i;++n)if(!0!==t(e[n],n,e))return!1;return!0},Q=Array.prototype.slice,ee={map:Y,each:$,eachr:j,partition:function(e,t){for(var n=[],i=[],r=0,o=e.length;r<o;r++){var s=e[r];(t(s,r,e)?n:i).push(s)}return{pass:n,fail:i}},filter:q,groupBy:function(e,t){if(0===e.length)return[];for(var n=t(e[0]),i=[],r=[],o=0,s=e.length;o<s;o++){var a=e[o],l=t(a);l!==n&&(i.push(r),r=[]),n=l,r.push(a)}return 0!==r.length&&i.push(r),i},indexOf:function(e,t){var n=V(e,t);return-1===n?W.none():W.some(n)},foldr:function(e,t,n){return j(e,function(e){n=t(n,e)}),n},foldl:function(e,t,n){return $(e,function(e){n=t(n,e)}),n},find:function(e,t){for(var n=0,i=e.length;n<i;n++){var r=e[n];if(t(r,n,e))return W.some(r)}return W.none()},findIndex:X,flatten:K,bind:function(e,t){var n=Y(e,t);return K(n)},forall:Z,exists:function(e,t){return X(e,t).isSome()},contains:U,equal:function(e,t){return e.length===t.length&&Z(e,function(e,n){return e===t[n]})},reverse:function(e){var t=Q.call(e,0);return t.reverse(),t},chunk:function(e,t){for(var n=[],i=0;i<e.length;i+=t){var r=e.slice(i,i+t);n.push(r)}return n},difference:function(e,t){return q(e,function(e){return!U(t,e)})},mapToObject:function(e,t){for(var n={},i=0,r=e.length;i<r;i++){var o=e[i];n[String(o)]=t(o,i)}return n},pure:function(e){return[e]},sort:function(e,t){var n=Q.call(e,0);return n.sort(t),n},range:function(e,t){for(var n=[],i=0;i<e;i++)n.push(t(i));return n},head:function(e){return 0===e.length?W.none():W.some(e[0])},last:function(e){return 0===e.length?W.none():W.some(e[e.length-1])}},te={file:{title:"File",items:"newdocument restoredraft | preview | print"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen"},insert:{title:"Insert",items:"image link media template codesample inserttable | charmap hr | pagebreak nonbreaking anchor toc | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | blockformats align | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck"},table:{title:"Table"},help:{title:"Help"}},ne=function(e,t){return"|"===e?{name:"|",item:{text:"|"}}:t?{name:e,item:t}:null},ie=function(e){return e&&"|"===e.item.text},re=function(e,t,n,i){var r,o,s,l,u,c,d,f;return t?(o=t[i],l=!0):o=te[i],o&&(r={text:o.title},s=[],a.each((o.items||"").split(/[ ,]/),function(t){var n=ne(t,e[t]);n&&s.push(n)}),l||a.each(e,function(e,t){var n,r;e.context!==i||(n=s,r=t,ee.findIndex(n,function(e){return e.name===r}).isSome())||("before"===e.separator&&s.push({name:"|",item:{text:"|"}}),e.prependToContext?s.unshift(ne(t,e)):s.push(ne(t,e)),"after"===e.separator&&s.push({name:"|",item:{text:"|"}}))}),r.menu=ee.map((u=s,c=n,d=ee.filter(u,function(e){return!1===c.hasOwnProperty(e.name)}),f=ee.filter(d,function(e,t,n){return!ie(e)||!ie(n[t-1])}),ee.filter(f,function(e,t,n){return!ie(e)||t>0&&t<n.length-1})),function(e){return e.item}),!r.menu.length)?null:r},oe=function(e){for(var t,n=[],i=function(e){var t,n=[],i=d(e);if(i)for(t in i)n.push(t);else for(t in te)n.push(t);return n}(e),r=a.makeMap((t=e,t.getParam("removed_menuitems","")).split(/[ ,]/)),o=u(e),s="string"==typeof o?o.split(/[ ,]/):i,l=0;l<s.length;l++){var c=s[l],f=re(e.menuItems,d(e),r,c);f&&n.push(f)}return n},se=m.DOM,ae=function(e){return{width:e.clientWidth,height:e.clientHeight}},le=function(e,t,n){var i,r,o,s;i=e.getContainer(),r=e.getContentAreaContainer().firstChild,o=ae(i),s=ae(r),null!==t&&(t=Math.max(e.getParam("min_width",100,"number"),t),t=Math.min(e.getParam("max_width",65535,"number"),t),se.setStyle(i,"width",t+(o.width-s.width)),se.setStyle(r,"width",t)),n=Math.max(e.getParam("min_height",100,"number"),n),n=Math.min(e.getParam("max_height",65535,"number"),n),se.setStyle(r,"height",n),b(e)},ue=le,ce=function(e,t,n){var i=e.getContentAreaContainer();le(e,i.clientWidth+t,i.clientHeight+n)},de=function(e,t,n){var i,r=e.settings[n];r&&r((i=t.getEl("body"),{element:function(){return i}}))},fe=function(e,t,n){return function(i){var r,o,s,l,u,c=i.control,d=c.parents().filter("panel")[0],f=d.find("#"+t)[0],h=(r=n,o=t,a.grep(r,function(e){return e.name===o})[0]);s=t,l=d,u=n,a.each(u,function(e){var t=l.items().filter("#"+e.name)[0];t&&t.visible()&&e.name!==s&&(de(e,t,"onhide"),t.visible(!1))}),c.parent().items().each(function(e){e.active(!1)}),f&&f.visible()?(de(h,f,"onhide"),f.hide(),c.active(!1)):(f?(f.show(),de(h,f,"onshow")):(f=g.create({type:"container",name:t,layout:"stack",classes:"sidebar-panel",html:""}),d.prepend(f),de(h,f,"onrender"),de(h,f,"onshow")),c.active(!0)),b(e)}},he=function(e){return!(_.ie&&!(_.ie>=11)||!e.sidebars)&&e.sidebars.length>0},me=function(e){return{type:"panel",name:"sidebar",layout:"stack",classes:"sidebar",items:[{type:"toolbar",layout:"stack",classes:"sidebar-toolbar",items:a.map(e.sidebars,function(t){var n=t.settings;return{type:"button",icon:n.icon,image:n.image,tooltip:n.tooltip,onclick:fe(e,t.name,e.sidebars)}})}]}},ge=function(e){var t=function(){e._skinLoaded=!0,v(e)};return function(){e.initialized?t():e.on("init",t)}},pe=m.DOM,ve=function(e){return{type:"panel",name:"iframe",layout:"stack",classes:"edit-area",border:e,html:""}},be=function(e,t,n){var i,r,o,s,a;if(!1===f(e)&&n.skinUiCss?pe.styleSheetLoader.load(n.skinUiCss,ge(e)):ge(e)(),i=t.panel=g.create({type:"panel",role:"application",classes:"tinymce",style:"visibility: hidden",layout:"stack",border:1,items:[{type:"container",classes:"top-part",items:[!1===l(e)?null:{type:"menubar",border:"0 0 1 0",items:oe(e)},B(e,c(e))]},he(e)?(s=e,{type:"panel",layout:"stack",classes:"edit-aria-container",border:"1 0 0 0",items:[ve("0"),me(s)]}):ve("1 0 0 0")]}),"none"!==h(e)&&(r={type:"resizehandle",direction:h(e),onResizeStart:function(){var t=e.getContentAreaContainer().firstChild;o={width:t.clientWidth,height:t.clientHeight}},onResize:function(t){"both"===h(e)?ue(e,o.width+t.deltaX,o.height+t.deltaY):ue(e,null,o.height+t.deltaY)}}),e.getParam("statusbar",!0,"boolean")){var u=p.translate(["Powered by {0}",'<a href="https://www.tinymce.com/?utm_campaign=editor_referral&utm_medium=poweredby&utm_source=tinymce" rel="noopener" target="_blank" role="presentation" tabindex="-1">tinymce</a>']),d=e.getParam("branding",!0,"boolean")?{type:"label",classes:"branding",html:" "+u}:null;i.add({type:"panel",name:"statusbar",classes:"statusbar",layout:"flow",border:"1 0 0 0",ariaRoot:!0,items:[{type:"elementpath",editor:e},r,d]})}return y(e),e.on("SwitchMode",(a=i,function(e){a.find("*").disabled("readonly"===e.mode)})),i.renderBefore(n.targetNode).reflow(),e.getParam("readonly",!1,"boolean")&&e.setMode("readonly"),n.width&&pe.setStyle(i.getEl(),"width",n.width),e.on("remove",function(){i.remove(),i=null}),w(e,i),F(e),{iframeContainer:i.find("#iframe")[0].getEl(),editorContainer:i.getEl()}},ye=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),xe=0,we={id:function(){return"mceu_"+xe++},create:function(e,t,n){var i=document.createElement(e);return m.DOM.setAttribs(i,t),"string"==typeof n?i.innerHTML=n:a.each(n,function(e){e.nodeType&&i.appendChild(e)}),i},createFragment:function(e){return m.DOM.createFragment(e)},getWindowSize:function(){return m.DOM.getViewPort()},getSize:function(e){var t,n;if(e.getBoundingClientRect){var i=e.getBoundingClientRect();t=Math.max(i.width||i.right-i.left,e.offsetWidth),n=Math.max(i.height||i.bottom-i.bottom,e.offsetHeight)}else t=e.offsetWidth,n=e.offsetHeight;return{width:t,height:n}},getPos:function(e,t){return m.DOM.getPos(e,t||we.getContainer())},getContainer:function(){return _.container?_.container:document.body},getViewPort:function(e){return m.DOM.getViewPort(e)},get:function(e){return document.getElementById(e)},addClass:function(e,t){return m.DOM.addClass(e,t)},removeClass:function(e,t){return m.DOM.removeClass(e,t)},hasClass:function(e,t){return m.DOM.hasClass(e,t)},toggleClass:function(e,t,n){return m.DOM.toggleClass(e,t,n)},css:function(e,t,n){return m.DOM.setStyle(e,t,n)},getRuntimeStyle:function(e,t){return m.DOM.getStyle(e,t,!0)},on:function(e,t,n,i){return m.DOM.bind(e,t,n,i)},off:function(e,t,n){return m.DOM.unbind(e,t,n)},fire:function(e,t,n){return m.DOM.fire(e,t,n)},innerHtml:function(e,t){m.DOM.setHTML(e,t)}};function _e(e,t,n){var i,r,o,s,a,l,u,c,d,f;return d=we.getViewPort(),o=(r=we.getPos(t)).x,s=r.y,e.state.get("fixed")&&"static"===we.getRuntimeStyle(document.body,"position")&&(o-=d.x,s-=d.y),i=e.getEl(),a=(f=we.getSize(i)).width,l=f.height,u=(f=we.getSize(t)).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 Re={testMoveRel:function(e,t){for(var n=we.getViewPort(),i=0;i<t.length;i++){var r=_e(this,e,t[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 t[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 t[i]}return t[0]},moveRel:function(e,t){"string"!=typeof t&&(t=this.testMoveRel(e,t));var n=_e(this,e,t);return this.moveTo(n.x,n.y)},moveBy:function(e,t){var n=this.layoutRect();return this.moveTo(n.x+e,n.y+t),this},moveTo:function(e,t){var n=this;function i(e,t,n){return e<0?0:e+n>t&&(e=t-n)<0?0:e}if(n.settings.constrainToViewport){var r=we.getViewPort(window),o=n.layoutRect();e=i(e,r.w+r.x,o.w),t=i(t,r.h+r.y,o.h)}return n.state.get("rendered")?n.layoutRect({x:e,y:t}).repaint():(n.settings.x=e,n.settings.y=t),n.fire("move",{x:e,y:t}),n}},Ce=tinymce.util.Tools.resolve("tinymce.util.Class"),ke=tinymce.util.Tools.resolve("tinymce.util.EventDispatcher"),Ee=function(e){var t;if(e)return"number"==typeof e?{top:e=e||0,left:e,bottom:e,right:e}:(1===(t=(e=e.split(" ")).length)?e[1]=e[2]=e[3]=e[0]:2===t?(e[2]=e[0],e[3]=e[1]):3===t&&(e[3]=e[1]),{top:parseInt(e[0],10)||0,right:parseInt(e[1],10)||0,bottom:parseInt(e[2],10)||0,left:parseInt(e[3],10)||0})},He=function(e,t){function n(t){var n=parseFloat(function(t){var n=e.ownerDocument.defaultView;if(n){var i=n.getComputedStyle(e,null);return i?(t=t.replace(/[A-Z]/g,function(e){return"-"+e}),i.getPropertyValue(t)):null}return e.currentStyle[t]}(t));return isNaN(n)?0:n}return{top:n(t+"TopWidth"),right:n(t+"RightWidth"),bottom:n(t+"BottomWidth"),left:n(t+"LeftWidth")}};function Se(){}function Me(e){this.cls=[],this.cls._map={},this.onchange=e||Se,this.prefix=""}a.extend(Me.prototype,{add:function(e){return e&&!this.contains(e)&&(this.cls._map[e]=!0,this.cls.push(e),this._change()),this},remove:function(e){if(this.contains(e)){var t=void 0;for(t=0;t<this.cls.length&&this.cls[t]!==e;t++);this.cls.splice(t,1),delete this.cls._map[e],this._change()}return this},toggle:function(e,t){var n=this.contains(e);return n!==t&&(n?this.remove(e):this.add(e),this._change()),this},contains:function(e){return!!this.cls._map[e]},_change:function(){delete this.clsValue,this.onchange.call(this)}}),Me.prototype.toString=function(){var e;if(this.clsValue)return this.clsValue;e="";for(var t=0;t<this.cls.length;t++)t>0&&(e+=" "),e+=this.prefix+this.cls[t];return e};var Te,Pe,We,De=/^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,Ne=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,Ae=/^\s*|\s*$/g,Be=Ce.extend({init:function(e){var t=this.match;function n(e,n,r){var o;function s(e){e&&n.push(e)}return s(function(e){if(e)return e=e.toLowerCase(),function(t){return"*"===e||t.type===e}}((o=De.exec(e.replace(Ae,"")))[1])),s(function(e){if(e)return function(t){return t._name===e}}(o[2])),s(function(e){if(e)return e=e.split("."),function(t){for(var n=e.length;n--;)if(!t.classes.contains(e[n]))return!1;return!0}}(o[3])),s(function(e,t,n){if(e)return function(i){var r=i[e]?i[e]():"";return t?"="===t?r===n:"*="===t?r.indexOf(n)>=0:"~="===t?(" "+r+" ").indexOf(" "+n+" ")>=0:"!="===t?r!==n:"^="===t?0===r.indexOf(n):"$="===t&&r.substr(r.length-n.length)===n:!!n}}(o[4],o[5],o[6])),s(function(e){var n;if(e)return(e=/(?:not\((.+)\))|(.+)/i.exec(e))[1]?(n=i(e[1],[]),function(e){return!t(e,n)}):(e=e[2],function(t,n,i){return"first"===e?0===n:"last"===e?n===i-1:"even"===e?n%2==0:"odd"===e?n%2==1:!!t[e]&&t[e]()})}(o[7])),n.pseudo=!!o[7],n.direct=r,n}function i(e,t){var r,o,s,a=[];do{if(Ne.exec(""),(o=Ne.exec(e))&&(e=o[3],a.push(o[1]),o[2])){r=o[3];break}}while(o);for(r&&i(r,t),e=[],s=0;s<a.length;s++)">"!==a[s]&&e.push(n(a[s],[],">"===a[s-1]));return t.push(e),t}this._selectors=i(e,[])},match:function(e,t){var n,i,r,o,s,a,l,u,c,d,f,h,m;for(n=0,i=(t=t||this._selectors).length;n<i;n++){for(m=e,h=0,r=(o=(s=t[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(e){var t,n,i=[],r=this._selectors;function o(e,t,n){var r,s,a,l,u,c=t[n];for(r=0,s=e.length;r<s;r++){for(u=e[r],a=0,l=c.length;a<l;a++)if(!c[a](u,r,s)){a=l+1;break}if(a===l)n===t.length-1?i.push(u):u.items&&o(u.items(),t,n+1);else if(c.direct)return;u.items&&o(u.items(),t,n)}}if(e.items){for(t=0,n=r.length;t<n;t++)o(e.items(),r[t],0);n>1&&(i=function(e){for(var t,n=[],i=e.length;i--;)(t=e[i]).__checked||(n.push(t),t.__checked=1);for(i=n.length;i--;)delete n[i].__checked;return n}(i))}return Te||(Te=Be.Collection),new Te(i)}}),Oe=Array.prototype.push,ze=Array.prototype.slice;We={length:0,init:function(e){e&&this.add(e)},add:function(e){return a.isArray(e)?Oe.apply(this,e):e instanceof Pe?this.add(e.toArray()):Oe.call(this,e),this},set:function(e){var t,n=this,i=n.length;for(n.length=0,n.add(e),t=n.length;t<i;t++)delete n[t];return n},filter:function(e){var t,n,i,r,o=[];for("string"==typeof e?(e=new Be(e),r=function(t){return e.match(t)}):r=e,t=0,n=this.length;t<n;t++)r(i=this[t])&&o.push(i);return new Pe(o)},slice:function(){return new Pe(ze.apply(this,arguments))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},each:function(e){return a.each(this,e),this},toArray:function(){return a.toArray(this)},indexOf:function(e){for(var t=this.length;t--&&this[t]!==e;);return t},reverse:function(){return new Pe(a.toArray(this).reverse())},hasClass:function(e){return!!this[0]&&this[0].classes.contains(e)},prop:function(e,t){var n;return t!==undefined?(this.each(function(n){n[e]&&n[e](t)}),this):(n=this[0])&&n[e]?n[e]():void 0},exec:function(e){var t=a.toArray(arguments).slice(1);return this.each(function(n){n[e]&&n[e].apply(n,t)}),this},remove:function(){for(var e=this.length;e--;)this[e].remove();return this},addClass:function(e){return this.each(function(t){t.classes.add(e)})},removeClass:function(e){return this.each(function(t){t.classes.remove(e)})}},a.each("fire on off show hide append prepend before after reflow".split(" "),function(e){We[e]=function(){var t=a.toArray(arguments);return this.each(function(n){e in n&&n[e].apply(n,t)}),this}}),a.each("text name disabled active selected checked visible parent value data".split(" "),function(e){We[e]=function(t){return this.prop(e,t)}}),Pe=Ce.extend(We),Be.Collection=Pe;var Le=Pe,Ie=function(e){this.create=e.create};Ie.create=function(e,t){return new Ie({create:function(n,i){var r,o=function(e){n.set(i,e.value)};return n.on("change:"+i,function(n){e.set(t,n.value)}),e.on("change:"+t,o),(r=n._bindings)||(r=n._bindings=[],n.on("destroy",function(){for(var e=r.length;e--;)r[e]()})),r.push(function(){e.off("change:"+t,o)}),e.get(t)}})};var Fe=tinymce.util.Tools.resolve("tinymce.util.Observable");function Ve(e){return e.nodeType>0}var Ue,Ye,$e=Ce.extend({Mixins:[Fe],init:function(e){var t,n;for(t in e=e||{})(n=e[t])instanceof Ie&&(e[t]=n.create(this,t));this.data=e},set:function(e,t){var n,i,r=this.data[e];if(t instanceof Ie&&(t=t.create(this,e)),"object"==typeof e){for(n in e)this.set(n,e[n]);return this}return function o(e,t){var n,i;if(e===t)return!0;if(null===e||null===t)return e===t;if("object"!=typeof e||"object"!=typeof t)return e===t;if(a.isArray(t)){if(e.length!==t.length)return!1;for(n=e.length;n--;)if(!o(e[n],t[n]))return!1}if(Ve(e)||Ve(t))return e===t;for(n in i={},t){if(!o(e[n],t[n]))return!1;i[n]=!0}for(n in e)if(!i[n]&&!o(e[n],t[n]))return!1;return!0}(r,t)||(this.data[e]=t,i={target:this,name:e,value:t,oldValue:r},this.fire("change:"+e,i),this.fire("change",i)),this},get:function(e){return this.data[e]},has:function(e){return e in this.data},bind:function(e){return Ie.create(this,e)},destroy:function(){this.fire("destroy")}}),je={},qe={add:function(e){var t=e.parent();if(t){if(!t._layout||t._layout.isNative())return;je[t._id]||(je[t._id]=t),Ue||(Ue=!0,C.requestAnimationFrame(function(){var e,t;for(e in Ue=!1,je)(t=je[e]).state.get("rendered")&&t.reflow();je={}},document.body))}},remove:function(e){je[e._id]&&delete je[e._id]}},Xe="onmousewheel"in document,Je=!1,Ge=0,Ke={Statics:{classPrefix:"mce-"},isRtl:function(){return Ye.rtl},classPrefix:"mce-",init:function(e){var t,n,i=this;function r(e){var t;for(e=e.split(" "),t=0;t<e.length;t++)i.classes.add(e[t])}i.settings=e=a.extend({},i.Defaults,e),i._id=e.id||"mceu_"+Ge++,i._aria={role:e.role},i._elmCache={},i.$=ye,i.state=new $e({visible:!0,active:!1,disabled:!1,value:""}),i.data=new $e(e.data),i.classes=new Me(function(){i.state.get("rendered")&&(i.getEl().className=this.toString())}),i.classes.prefix=i.classPrefix,(t=e.classes)&&(i.Defaults&&(n=i.Defaults.classes)&&t!==n&&r(n),r(t)),a.each("title text name visible disabled active value".split(" "),function(t){t in e&&i[t](e[t])}),i.on("click",function(){if(i.disabled())return!1}),i.settings=e,i.borderBox=Ee(e.border),i.paddingBox=Ee(e.padding),i.marginBox=Ee(e.margin),e.hidden&&i.hide()},Properties:"parent,name",getContainerElm:function(){return we.getContainer()},getParentCtrl:function(e){for(var t,n=this.getRoot().controlIdLookup;e&&n&&!(t=n[e.id]);)e=e.parentNode;return t},initLayoutRect:function(){var e,t,n,i,r,o,s,a,l,u,c=this,d=c.settings,f=c.getEl();e=c.borderBox=c.borderBox||He(f,"border"),c.paddingBox=c.paddingBox||He(f,"padding"),c.marginBox=c.marginBox||He(f,"margin"),u=we.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=e.left+e.right,m=e.top+e.bottom,g=d.maxWidth||65535,p=d.maxHeight||65535;return c._layoutRect=t={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={},t},layoutRect:function(e){var t,n,i,r,o,s=this,a=s._layoutRect;return a||(a=s.initLayoutRect()),e?(i=a.deltaW,r=a.deltaH,e.x!==undefined&&(a.x=e.x),e.y!==undefined&&(a.y=e.y),e.minW!==undefined&&(a.minW=e.minW),e.minH!==undefined&&(a.minH=e.minH),(n=e.w)!==undefined&&(n=(n=n<a.minW?a.minW:n)>a.maxW?a.maxW:n,a.w=n,a.innerW=n-i),(n=e.h)!==undefined&&(n=(n=n<a.minH?a.minH:n)>a.maxH?a.maxH:n,a.h=n,a.innerH=n-r),(n=e.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=e.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),e.contentW!==undefined&&(a.contentW=e.contentW),e.contentH!==undefined&&(a.contentH=e.contentH),(t=s._lastLayoutRect).x===a.x&&t.y===a.y&&t.w===a.w&&t.h===a.h||((o=Ye.repaintControls)&&o.map&&!o.map[s._id]&&(o.push(s),o.map[s._id]=!0),t.x=a.x,t.y=a.y,t.w=a.w,t.h=a.h),s):a},repaint:function(){var e,t,n,i,r,o,s,a,l,u,c=this;l=document.createRange?function(e){return e}:Math.round,e=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&&(e.left=l(i.x)+"px",a.x=i.x),i.y!==a.y&&(e.top=l(i.y)+"px",a.y=i.y),i.w!==a.w&&(u=l(i.w-o),e.width=(u>=0?u:0)+"px",a.w=i.w),i.h!==a.h&&(u=l(i.h-s),e.height=(u>=0?u:0)+"px",a.h=i.h),c._hasBody&&i.innerW!==a.innerW&&(u=l(i.innerW),(n=c.getEl("body"))&&((t=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"))&&((t=t||n.style).height=(u>=0?u:0)+"px"),a.innerH=i.innerH),c._lastRepaintRect=a,c.fire("repaint",{},!1)},updateLayoutRect:function(){var e=this;e.parent()._lastRect=null,we.css(e.getEl(),{width:"",height:""}),e._layoutRect=e._lastRepaintRect=e._lastLayoutRect=null,e.initLayoutRect()},on:function(e,t){var n,i,r,o=this;return Ze(o).on(e,"string"!=typeof(n=t)?n:function(e){return i||o.parentsAndSelf().each(function(e){var t=e.settings.callbacks;if(t&&(i=t[n]))return r=e,!1}),i?i.call(r,e):(e.action=n,void this.fire("execute",e))}),o},off:function(e,t){return Ze(this).off(e,t),this},fire:function(e,t,n){if((t=t||{}).control||(t.control=this),t=Ze(this).fire(e,t),!1!==n&&this.parent)for(var i=this.parent();i&&!t.isPropagationStopped();)i.fire(e,t,!1),i=i.parent();return t},hasEventListeners:function(e){return Ze(this).has(e)},parents:function(e){var t,n=new Le;for(t=this.parent();t;t=t.parent())n.add(t);return e&&(n=n.filter(e)),n},parentsAndSelf:function(e){return new Le(this).add(this.parents(e))},next:function(){var e=this.parent().items();return e[e.indexOf(this)+1]},prev:function(){var e=this.parent().items();return e[e.indexOf(this)-1]},innerHtml:function(e){return this.$el.html(e),this},getEl:function(e){var t=e?this._id+"-"+e:this._id;return this._elmCache[t]||(this._elmCache[t]=ye("#"+t)[0]),this._elmCache[t]},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(e){}return this},blur:function(){return this.getEl().blur(),this},aria:function(e,t){var n=this,i=n.getEl(n.ariaTarget);return void 0===t?n._aria[e]:(n._aria[e]=t,n.state.get("rendered")&&i.setAttribute("role"===e?e:"aria-"+e,t),n)},encode:function(e,t){return!1!==t&&(e=this.translate(e)),(e||"").replace(/[&<>"]/g,function(e){return"&#"+e.charCodeAt(0)+";"})},translate:function(e){return Ye.translate?Ye.translate(e):e},before:function(e){var t=this.parent();return t&&t.insert(e,t.items().indexOf(this),!0),this},after:function(e){var t=this.parent();return t&&t.insert(e,t.items().indexOf(this)),this},remove:function(){var e,t,n=this,i=n.getEl(),r=n.parent();if(n.items){var o=n.items().toArray();for(t=o.length;t--;)o[t].remove()}r&&r.items&&(e=[],r.items().each(function(t){t!==n&&e.push(t)}),r.items().set(e),r._lastRect=null),n._eventsRoot&&n._eventsRoot===n&&ye(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(e){return ye(e).before(this.renderHtml()),this.postRender(),this},renderTo:function(e){return ye(e||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 e,t,n,i,r,o=this,s=o.settings;for(i in o.$el=ye(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}Qe(o),s.style&&(e=o.getEl())&&(e.setAttribute("style",s.style),e.style.cssText=s.style),o.settings.border&&(t=o.borderBox,o.$el.css({"border-top-width":t.top,"border-right-width":t.right,"border-bottom-width":t.bottom,"border-left-width":t.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(e){var t,n=e.value;o.state.get("rendered")&&(o.getEl().style.display=!1===n?"none":"",o.getEl().getBoundingClientRect()),(t=o.parent())&&(t._lastRect=null),o.fire(n?"show":"hide"),qe.add(o)}),o.fire("postrender",{},!1)},bindStates:function(){},scrollIntoView:function(e){var t,n,i,r,o,s,a=this.getEl(),l=a.parentNode,u=function(e,t){var n,i,r=e;for(n=i=0;r&&r!==t&&r.nodeType;)n+=r.offsetLeft||0,i+=r.offsetTop||0,r=r.offsetParent;return{x:n,y:i}}(a,l);return t=u.x,n=u.y,i=a.offsetWidth,r=a.offsetHeight,o=l.clientWidth,s=l.clientHeight,"end"===e?(t-=o-i,n-=s-r):"center"===e&&(t-=o/2-i/2,n-=s/2-r/2),l.scrollLeft=t,l.scrollTop=n,this},getRoot:function(){for(var e,t=this,n=[];t;){if(t.rootControl){e=t.rootControl;break}n.push(t),e=t,t=t.parent()}e||(e=this);for(var i=n.length;i--;)n[i].rootControl=e;return e},reflow:function(){qe.remove(this);var e=this.parent();return e&&e._layout&&!e._layout.isNative()&&e.reflow(),this}};function Ze(e){return e._eventDispatcher||(e._eventDispatcher=new ke({scope:e,toggleEvent:function(t,n){n&&ke.isNative(t)&&(e._nativeEvents||(e._nativeEvents={}),e._nativeEvents[t]=!0,e.state.get("rendered")&&Qe(e))}})),e._eventDispatcher}function Qe(e){var t,n,i,r,o,s;function a(t){var n=e.getParentCtrl(t.target);n&&n.fire(t.type,t)}function l(){var e=r._lastHoverCtrl;e&&(e.fire("mouseleave",{target:e.getEl()}),e.parents().each(function(e){e.fire("mouseleave",{target:e.getEl()})}),r._lastHoverCtrl=null)}function u(t){var n,i,o,s=e.getParentCtrl(t.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(t){t.preventDefault(),"mousewheel"===t.type?(t.deltaY=-.025*t.wheelDelta,t.wheelDeltaX&&(t.deltaX=-.025*t.wheelDeltaX)):(t.deltaX=0,t.deltaY=t.detail),t=e.fire("wheel",t)}if(o=e._nativeEvents){for((i=e.parents().toArray()).unshift(e),t=0,n=i.length;!r&&t<n;t++)r=i[t]._eventsRoot;for(r||(r=i[i.length-1]||e),e._eventsRoot=r,n=t,t=0;t<n;t++)i[t]._eventsRoot=r;var d=r._delegates;for(s in d||(d=r._delegates={}),o){if(!o)return!1;"wheel"!==s||Je?("mouseenter"===s||"mouseleave"===s?r._hasMouseEnter||(ye(r.getEl()).on("mouseleave",l).on("mouseover",u),r._hasMouseEnter=1):d[s]||(ye(r.getEl()).on(s,a),d[s]=!0),o[s]=!1):Xe?ye(e.getEl()).on("mousewheel",c):ye(e.getEl()).on("DOMMouseScroll",c)}}}a.each("text title visible disabled active value".split(" "),function(e){Ke[e]=function(t){return 0===arguments.length?this.state.get(e):(void 0!==t&&this.state.set(e,t),this)}});var et=Ye=Ce.extend(Ke),tt=function(e){return!!e.getAttribute("data-mce-tabstop")},nt=function(e){var t,n,i=e.root;function r(e){return e&&1===e.nodeType}try{t=document.activeElement}catch(y){t=document.body}function o(e){return r(e=e||t)?e.getAttribute("role"):null}function s(e){for(var n,i=e||t;i=i.parentNode;)if(n=o(i))return n}function a(e){var n=t;if(r(n))return n.getAttribute("aria-"+e)}function l(e){var t=e.tagName.toUpperCase();return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}function u(e){var t=[];return function n(e){if(1===e.nodeType&&"none"!==e.style.display&&!e.disabled){var i;(l(i=e)&&!i.hidden||tt(i)||/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(o(i)))&&t.push(e);for(var r=0;r<e.childNodes.length;r++)n(e.childNodes[r])}}(e||i.getEl()),t}function c(e){var t,i;(i=(e=e||n).parents().toArray()).unshift(e);for(var r=0;r<i.length&&!(t=i[r]).settings.ariaRoot;r++);return t}function d(e,t){return e<0?e=t.length-1:e>=t.length&&(e=0),t[e]&&t[e].focus(),e}function f(e,n){var i=-1,r=c();n=n||u(r.getEl());for(var o=0;o<n.length;o++)n[o]===t&&(i=o);i+=e,r.lastAriaIndex=d(i,n)}function h(){"tablist"===s()?f(-1,u(t.parentNode)):n.parent().submenu?v():f(-1)}function m(){var e=o(),n=s();"tablist"===n?f(1,u(t.parentNode)):"menuitem"===e&&"menu"===n&&a("haspopup")?b():f(1)}function g(){f(-1)}function p(){var e=o(),t=s();"menuitem"===e&&"menubar"===t?b():"button"===e&&a("haspopup")?b({key:"down"}):f(1)}function v(){n.fire("cancel")}function b(e){e=e||{},n.fire("click",{target:t,aria:e})}return n=i.getParentCtrl(t),i.on("keydown",function(e){function i(e,n){l(t)||tt(t)||"slider"!==o(t)&&!1!==n(e)&&e.preventDefault()}if(!e.isDefaultPrevented())switch(e.keyCode){case 37:i(e,h);break;case 39:i(e,m);break;case 38:i(e,g);break;case 40:i(e,p);break;case 27:v();break;case 14:case 13:case 32:i(e,b);break;case 9:!function(e){if("tablist"===s()){var t=u(n.getEl("body"))[0];t&&t.focus()}else f(e.shiftKey?-1:1)}(e),e.preventDefault()}}),i.on("focusin",function(e){t=e.target,n=e.control}),{focusFirst:function(e){var t=c(e),n=u(t.getEl());t.settings.ariaRemember&&"lastAriaIndex"in t?d(t.lastAriaIndex,n):d(0,n)}}},it={},rt=et.extend({init:function(e){var t=this;t._super(e),(e=t.settings).fixed&&t.state.set("fixed",!0),t._items=new Le,t.isRtl()&&t.classes.add("rtl"),t.bodyClasses=new Me(function(){t.state.get("rendered")&&(t.getEl("body").className=this.toString())}),t.bodyClasses.prefix=t.classPrefix,t.classes.add("container"),t.bodyClasses.add("container-body"),e.containerCls&&t.classes.add(e.containerCls),t._layout=g.create((e.layout||"")+"layout"),t.settings.items?t.add(t.settings.items):t.add(t.render()),t._hasBody=!0},items:function(){return this._items},find:function(e){return(e=it[e]=it[e]||new Be(e)).find(this)},add:function(e){return this.items().add(this.create(e)).parent(this),this},focus:function(e){var t,n,i,r=this;if(!e||!(n=r.keyboardNav||r.parents().eq(-1)[0].keyboardNav))return i=r.find("*"),r.statusbar&&i.add(r.statusbar.items()),i.each(function(e){if(e.settings.autofocus)return t=null,!1;e.canFocus&&(t=t||e)}),t&&t.focus(),r;n.focusFirst(r)},replace:function(e,t){for(var n,i=this.items(),r=i.length;r--;)if(i[r]===e){i[r]=t;break}r>=0&&((n=t.getEl())&&n.parentNode.removeChild(n),(n=e.getEl())&&n.parentNode.removeChild(n)),t.parent(this)},create:function(e){var t,n=this,i=[];return a.isArray(e)||(e=[e]),a.each(e,function(e){e&&(e instanceof et||("string"==typeof e&&(e={type:e}),t=a.extend({},n.settings.defaults,e),e.type=t.type=t.type||e.type||n.settings.defaultType||(t.defaults?t.defaults.type:null),e=g.create(t)),i.push(e))}),i},renderNew:function(){var e=this;return e.items().each(function(t,n){var i;t.parent(e),t.state.get("rendered")||((i=e.getEl("body")).hasChildNodes()&&n<=i.childNodes.length-1?ye(i.childNodes[n]).before(t.renderHtml()):ye(i).append(t.renderHtml()),t.postRender(),qe.add(t))}),e._layout.applyClasses(e.items().filter(":visible")),e._lastRect=null,e},append:function(e){return this.add(e).renderNew()},prepend:function(e){return this.items().set(this.create(e).concat(this.items().toArray())),this.renderNew()},insert:function(e,t,n){var i,r,o;return e=this.create(e),i=this.items(),!n&&t<i.length-1&&(t+=1),t>=0&&t<i.length&&(r=i.slice(0,t).toArray(),o=i.slice(t).toArray(),i.set(r.concat(e,o))),this.renderNew()},fromJSON:function(e){for(var t in e)this.find("#"+t).value(e[t]);return this},toJSON:function(){var e={};return this.find("*").each(function(t){var n=t.name(),i=t.value();n&&void 0!==i&&(e[n]=i)}),e},renderHtml:function(){var e=this,t=e._layout,n=this.settings.role;return e.preRender(),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes+'"'+(n?' role="'+this.settings.role+'"':"")+'><div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"},postRender:function(){var e,t=this;return t.items().exec("postRender"),t._super(),t._layout.postRender(t),t.state.set("rendered",!0),t.settings.style&&t.$el.css(t.settings.style),t.settings.border&&(e=t.borderBox,t.$el.css({"border-top-width":e.top,"border-right-width":e.right,"border-bottom-width":e.bottom,"border-left-width":e.left})),t.parent()||(t.keyboardNav=nt({root:t})),t},initLayoutRect:function(){var e=this._super();return this._layout.recalc(this),e},recalc:function(){var e=this,t=e._layoutRect,n=e._lastRect;if(!n||n.w!==t.w||n.h!==t.h)return e._layout.recalc(e),t=e.layoutRect(),e._lastRect={x:t.x,y:t.y,w:t.w,h:t.h},!0},reflow:function(){var e;if(qe.remove(this),this.visible()){for(et.repaintControls=[],et.repaintControls.map={},this.recalc(),e=et.repaintControls.length;e--;)et.repaintControls[e].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),et.repaintControls=[]}return this}});function ot(e){var t,n;if(e.changedTouches)for(t="screenX screenY pageX pageY clientX clientY".split(" "),n=0;n<t.length;n++)e[t[n]]=e.changedTouches[0][t[n]]}var st,at,lt,ut,ct=function(e,t){var n,i,r,o,s,a,l,u=t.document||document;function c(){return u.getElementById(t.handle||e)}t=t||{},r=function(e){var r,d,f,h,m,g,p,v,b,y,x,w,_=(r=u,y=Math.max,d=r.documentElement,f=r.body,h=y(d.scrollWidth,f.scrollWidth),m=y(d.clientWidth,f.clientWidth),g=y(d.offsetWidth,f.offsetWidth),p=y(d.scrollHeight,f.scrollHeight),v=y(d.clientHeight,f.clientHeight),b=y(d.offsetHeight,f.offsetHeight),{width:h<g?m:h,height:p<b?v:p});ot(e),e.preventDefault(),i=e.button,x=c(),a=e.screenX,l=e.screenY,w=window.getComputedStyle?window.getComputedStyle(x,null).getPropertyValue("cursor"):x.runtimeStyle.cursor,n=ye("<div></div>").css({position:"absolute",top:0,left:0,width:_.width,height:_.height,zIndex:2147483647,opacity:1e-4,cursor:w}).appendTo(u.body),ye(u).on("mousemove touchmove",s).on("mouseup touchend",o),t.start(e)},s=function(e){if(ot(e),e.button!==i)return o(e);e.deltaX=e.screenX-a,e.deltaY=e.screenY-l,e.preventDefault(),t.drag(e)},o=function(e){ot(e),ye(u).off("mousemove touchmove",s).off("mouseup touchend",o),n.remove(),t.stop&&t.stop(e)},this.destroy=function(){ye(c()).off()},ye(c()).on("mousedown touchstart",r)},dt={init:function(){this.on("repaint",this.renderScroll)},renderScroll:function(){var e=this,t=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=e.getEl("scroll"+r)){if(p=o.toLowerCase(),v=s.toLowerCase(),ye(e.getEl("absend")).css(p,e.layoutRect()[a]-1),!l)return void ye(d).css("display","none");ye(d).css("display","block"),c=e.getEl("body"),f=e.getEl("scroll"+r+"t"),h=c["client"+s]-2*t,m=(h-=n&&i?d["client"+u]:0)/c["scroll"+s],(g={})[p]=c["offset"+o]+t,g[v]=h,ye(d).css(g),(g={})[p]=c["scroll"+o]*m,g[v]=h*m,ye(f).css(g)}}r=e.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")}e.settings.autoScroll&&(e._hasScroll||(e._hasScroll=!0,function(){function n(n,i,r,o,s){var a,l=e._id+"-scroll"+n,u=e.classPrefix;ye(e.getEl()).append('<div id="'+l+'" class="'+u+"scrollbar "+u+"scrollbar-"+n+'"><div id="'+l+'t" class="'+u+'scrollbar-thumb"></div></div>'),e.draghelper=new ct(l+"t",{start:function(){a=e.getEl("body")["scroll"+i],ye("#"+l).addClass(u+"active")},drag:function(l){var u,c,d,f,h=e.layoutRect();c=h.contentW>h.innerW,d=h.contentH>h.innerH,f=e.getEl("body")["client"+r]-2*t,u=(f-=c&&d?e.getEl("scroll"+n)["client"+s]:0)/e.getEl("body")["scroll"+r],e.getEl("body")["scroll"+i]=a+l["delta"+o]/u},stop:function(){ye("#"+l).removeClass(u+"active")}})}e.classes.add("scroll"),n("v","Top","Height","Y","Width"),n("h","Left","Width","X","Height")}(),e.on("wheel",function(t){var i=e.getEl("body");i.scrollLeft+=10*(t.deltaX||0),i.scrollTop+=10*t.deltaY,n()}),ye(e.getEl("body")).on("scroll",n)),n())}},ft=rt.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[dt],renderHtml:function(){var e=this,t=e._layout,n=e.settings.html;return e.preRender(),t.preRender(e),void 0===n?n='<div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+t.renderHtml(e)+"</div>":("function"==typeof n&&(n=n.call(e)),e._hasBody=!1),'<div id="'+e._id+'" class="'+e.classes+'" hidefocus="1" tabindex="-1" role="group">'+(e._preBodyHtml||"")+n+"</div>"}}),ht={resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo:function(e,t){if(e<=1||t<=1){var n=we.getWindowSize();e=e<=1?e*n.w:e,t=t<=1?t*n.h:t}return this._layoutRect.autoResize=!1,this.layoutRect({minW:e,minH:t,w:e,h:t}).reflow()},resizeBy:function(e,t){var n=this.layoutRect();return this.resizeTo(n.w+e,n.h+t)}},mt=[],gt=[];function pt(e,t){for(;e;){if(e===t)return!0;e=e.parent()}}function vt(){st||(st=function(e){2!==e.button&&function(e){for(var t=mt.length;t--;){var n=mt[t],i=n.getParentCtrl(e.target);if(n.settings.autohide){if(i&&(pt(i,n)||n.parent()===i))continue;(e=n.fire("autohide",{target:e.target})).isDefaultPrevented()||n.hide()}}}(e)},ye(document).on("click touchstart",st))}function bt(e){var t=we.getViewPort().y;function n(t,n){for(var i,r=0;r<mt.length;r++)if(mt[r]!==e)for(i=mt[r].parent();i&&(i=i.parent());)i===e&&mt[r].fixed(t).moveBy(0,n).repaint()}e.settings.autofix&&(e.state.get("fixed")?e._autoFixY>t&&(e.fixed(!1).layoutRect({y:e._autoFixY}).repaint(),n(!1,e._autoFixY-t)):(e._autoFixY=e.layoutRect().y,e._autoFixY<t&&(e.fixed(!0).layoutRect({y:0}).repaint(),n(!0,t-e._autoFixY))))}function yt(e,t){var n,i,r=xt.zIndex||65535;if(e)gt.push(t);else for(n=gt.length;n--;)gt[n]===t&&gt.splice(n,1);if(gt.length)for(n=0;n<gt.length;n++)gt[n].modal&&(r++,i=gt[n]),gt[n].getEl().style.zIndex=r,gt[n].zIndex=r,r++;var o=ye("#"+t.classPrefix+"modal-block",t.getContainerElm())[0];i?ye(o).css("z-index",i.zIndex-1):o&&(o.parentNode.removeChild(o),ut=!1),xt.currentZIndex=r}var xt=ft.extend({Mixins:[Re,ht],init:function(e){var t=this;t._super(e),t._eventsRoot=t,t.classes.add("floatpanel"),e.autohide&&(vt(),function(){if(!lt){var e=document.documentElement,t=e.clientWidth,n=e.clientHeight;lt=function(){document.all&&t===e.clientWidth&&n===e.clientHeight||(t=e.clientWidth,n=e.clientHeight,xt.hideAll())},ye(window).on("resize",lt)}}(),mt.push(t)),e.autofix&&(at||(at=function(){var e;for(e=mt.length;e--;)bt(mt[e])},ye(window).on("scroll",at)),t.on("move",function(){bt(this)})),t.on("postrender show",function(e){if(e.control===t){var n,i=t.classPrefix;t.modal&&!ut&&((n=ye("#"+i+"modal-block",t.getContainerElm()))[0]||(n=ye('<div id="'+i+'modal-block" class="'+i+"reset "+i+'fade"></div>').appendTo(t.getContainerElm())),C.setTimeout(function(){n.addClass(i+"in"),ye(t.getEl()).addClass(i+"in")}),ut=!0),yt(!0,t)}}),t.on("show",function(){t.parents().each(function(e){if(e.state.get("fixed"))return t.fixed(!0),!1})}),e.popover&&(t._preBodyHtml='<div class="'+t.classPrefix+'arrow"></div>',t.classes.add("popover").add("bottom").add(t.isRtl()?"end":"start")),t.aria("label",e.ariaLabel),t.aria("labelledby",t._id),t.aria("describedby",t.describedBy||t._id+"-none")},fixed:function(e){var t=this;if(t.state.get("fixed")!==e){if(t.state.get("rendered")){var n=we.getViewPort();e?t.layoutRect().y-=n.y:t.layoutRect().y+=n.y}t.classes.toggle("fixed",e),t.state.set("fixed",e)}return t},show:function(){var e,t=this._super();for(e=mt.length;e--&&mt[e]!==this;);return-1===e&&mt.push(this),t},hide:function(){return wt(this),yt(!1,this),this._super()},hideAll:function(){xt.hideAll()},close:function(){return this.fire("close").isDefaultPrevented()||(this.remove(),yt(!1,this)),this},remove:function(){wt(this),this._super()},postRender:function(){return this.settings.bodyRole&&this.getEl("body").setAttribute("role",this.settings.bodyRole),this._super()}});function wt(e){var t;for(t=mt.length;t--;)mt[t]===e&&mt.splice(t,1);for(t=gt.length;t--;)gt[t]===e&&gt.splice(t,1)}xt.hideAll=function(){for(var e=mt.length;e--;){var t=mt[e];t&&t.settings.autohide&&(t.hide(),mt.splice(e,1))}};var _t,Rt=function(e){return!(!e||_.container)},Ct=function(e,t,n){var i,r,o=m.DOM,s=e.getParam("fixed_toolbar_container");s&&(r=o.select(s)[0]);var a=function(){if(i&&i.moveRel&&i.visible()&&!i._fixed){var t=e.selection.getScrollContainer(),n=e.getBody(),r=0,s=0;if(t){var a=o.getPos(n),l=o.getPos(t);r=Math.max(0,l.x-a.x),s=Math.max(0,l.y-a.y)}i.fixed(!1).moveRel(n,e.rtl?["tr-br","br-tr"]:["tl-bl","bl-tl","tr-br"]).moveBy(r,s)}},u=function(){i&&(i.show(),a(),o.addClass(e.getBody(),"mce-edit-focus"))},d=function(){i&&(i.hide(),xt.hideAll(),o.removeClass(e.getBody(),"mce-edit-focus"))},h=function(){i?i.visible()||u():(i=t.panel=g.create({type:r?"panel":"floatpanel",role:"application",classes:"tinymce tinymce-inline",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:Rt(r),fixed:Rt(r),border:1,items:[!1===l(e)?null:{type:"menubar",border:"0 0 1 0",items:oe(e)},B(e,c(e))]}),y(e),r?i.renderTo(r).reflow():i.renderTo().reflow(),w(e,i),u(),F(e),e.on("nodeChange",a),e.on("ResizeWindow",a),e.on("activate",u),e.on("deactivate",d),e.nodeChanged())};return e.settings.content_editable=!0,e.on("focus",function(){!1===f(e)&&n.skinUiCss?o.styleSheetLoader.load(n.skinUiCss,h,h):h()}),e.on("blur hide",d),e.on("remove",function(){i&&(i.remove(),i=null)}),!1===f(e)&&n.skinUiCss?o.styleSheetLoader.load(n.skinUiCss,ge(e)):ge(e)(),{}},kt=function(e,t){var n,i,r=this,o=et.classPrefix;r.show=function(s,a){function l(){n&&(ye(e).append('<div class="'+o+"throbber"+(t?" "+o+"throbber-inline":"")+'"></div>'),a&&a())}return r.hide(),n=!0,s?i=C.setTimeout(l,s):l(),r},r.hide=function(){var t=e.lastChild;return C.clearTimeout(i),t&&-1!==t.className.indexOf("throbber")&&t.parentNode.removeChild(t),n=!1,r}},Et=function(e,t){var n;e.on("ProgressState",function(e){n=n||new kt(t.panel.getEl("body")),e.state?n.show(e.time):n.hide()})},Ht=function(e,t,n){var i=function(e){var t=e.settings,n=t.skin,i=t.skin_url;if(!1!==n){var r=n||"lightgray";i=i?e.documentBaseURI.toAbsolute(i):s.baseURL+"/skins/"+r}return i}(e);return i&&(n.skinUiCss=i+"/skin.min.css",e.contentCSS.push(i+"/content"+(e.inline?".inline":"")+".min.css")),Et(e,t),e.getParam("inline",!1,"boolean")?Ct(e,t,n):be(e,t,n)},St=et.extend({Mixins:[Re],Defaults:{classes:"widget tooltip tooltip-n"},renderHtml:function(){var e=this,t=e.classPrefix;return'<div id="'+e._id+'" class="'+e.classes+'" role="presentation"><div class="'+t+'tooltip-arrow"></div><div class="'+t+'tooltip-inner">'+e.encode(e.state.get("text"))+"</div></div>"},bindStates:function(){var e=this;return e.state.on("change:text",function(t){e.getEl().lastChild.innerHTML=e.encode(t.value)}),e._super()},repaint:function(){var e,t;e=this.getEl().style,t=this._layoutRect,e.left=t.x+"px",e.top=t.y+"px",e.zIndex=131070}}),Mt=et.extend({init:function(e){var t=this;t._super(e),e=t.settings,t.canFocus=!0,e.tooltip&&!1!==Mt.tooltips&&(t.on("mouseenter",function(n){var i=t.tooltip().moveTo(-65535);if(n.control===t){var r=i.text(e.tooltip).show().testMoveRel(t.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(t.getEl(),r)}else i.hide()}),t.on("mouseleave mousedown click",function(){t.tooltip().hide()})),t.aria("label",e.ariaLabel||e.tooltip)},tooltip:function(){return _t||(_t=new St({type:"tooltip"})).renderTo(),_t},postRender:function(){var e=this,t=e.settings;e._super(),e.parent()||!t.width&&!t.height||(e.initLayoutRect(),e.repaint()),t.autofocus&&e.focus()},bindStates:function(){var e=this;function t(t){e.aria("disabled",t),e.classes.toggle("disabled",t)}function n(t){e.aria("pressed",t),e.classes.toggle("active",t)}return e.state.on("change:disabled",function(e){t(e.value)}),e.state.on("change:active",function(e){n(e.value)}),e.state.get("disabled")&&t(!0),e.state.get("active")&&n(!0),e._super()},remove:function(){this._super(),_t&&(_t.remove(),_t=null)}}),Tt=Mt.extend({Defaults:{value:0},init:function(e){this._super(e),this.classes.add("progress"),this.settings.filter||(this.settings.filter=function(e){return Math.round(e)})},renderHtml:function(){var e=this._id,t=this.classPrefix;return'<div id="'+e+'" class="'+this.classes+'"><div class="'+t+'bar-container"><div class="'+t+'bar"></div></div><div class="'+t+'text">0%</div></div>'},postRender:function(){return this._super(),this.value(this.settings.value),this},bindStates:function(){var e=this;function t(t){t=e.settings.filter(t),e.getEl().lastChild.innerHTML=t+"%",e.getEl().firstChild.firstChild.style.width=t+"%"}return e.state.on("change:value",function(e){t(e.value)}),t(e.state.get("value")),e._super()}}),Pt=function(e,t){e.getEl().lastChild.textContent=t+(e.progressBar?" "+e.progressBar.value()+"%":"")},Wt=et.extend({Mixins:[Re],Defaults:{classes:"widget notification"},init:function(e){var t=this;t._super(e),t.maxWidth=e.maxWidth,e.text&&t.text(e.text),e.icon&&(t.icon=e.icon),e.color&&(t.color=e.color),e.type&&t.classes.add("notification-"+e.type),e.timeout&&(e.timeout<0||e.timeout>0)&&!e.closeButton?t.closeButton=!1:(t.classes.add("has-close"),t.closeButton=!0),e.progressBar&&(t.progressBar=new Tt),t.on("click",function(e){-1!==e.target.className.indexOf(t.classPrefix+"close")&&t.close()})},renderHtml:function(){var e,t=this,n=t.classPrefix,i="",r="",o="";return t.icon&&(i='<i class="'+n+"ico "+n+"i-"+t.icon+'"></i>'),e=' style="max-width: '+t.maxWidth+"px;"+(t.color?"background-color: "+t.color+';"':'"'),t.closeButton&&(r='<button type="button" class="'+n+'close" aria-hidden="true">\xd7</button>'),t.progressBar&&(o=t.progressBar.renderHtml()),'<div id="'+t._id+'" class="'+t.classes+'"'+e+' role="presentation">'+i+'<div class="'+n+'notification-inner">'+t.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 e=this;return C.setTimeout(function(){e.$el.addClass(e.classPrefix+"in"),Pt(e,e.state.get("text"))},100),e._super()},bindStates:function(){var e=this;return e.state.on("change:text",function(t){e.getEl().firstChild.innerHTML=t.value,Pt(e,t.value)}),e.progressBar&&(e.progressBar.bindStates(),e.progressBar.state.on("change:value",function(t){Pt(e,e.state.get("text"))})),e._super()},close:function(){return this.fire("close").isDefaultPrevented()||this.remove(),this},repaint:function(){var e,t;e=this.getEl().style,t=this._layoutRect,e.left=t.x+"px",e.top=t.y+"px",e.zIndex=65534}}),Dt=function(e){var t=function(e){return e.inline?e.getElement():e.getContentAreaContainer()};return{open:function(n,i){var r,o=a.extend(n,{maxWidth:(r=t(e),we.getSize(r).width)}),s=new Wt(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(e){e.close()},reposition:function(n){var i;i=n,ee.each(i,function(e){e.moveTo(0,0)}),function(n){if(n.length>0){var i=n.slice(0,1)[0],r=t(e);i.moveRel(r,"tc-tc"),ee.each(n,function(e,t){t>0&&e.moveRel(n[t-1].getEl(),"bc-tc")})}}(n)},getArgs:function(e){return e.args}}},Nt=[],At="";function Bt(e){var t,n=ye("meta[name=viewport]")[0];!1!==_.overrideViewPort&&(n||((n=document.createElement("meta")).setAttribute("name","viewport"),document.getElementsByTagName("head")[0].appendChild(n)),(t=n.getAttribute("content"))&&void 0!==At&&(At=t),n.setAttribute("content",e?"width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0":At))}function Ot(e,t){(function(){for(var e=0;e<Nt.length;e++)if(Nt[e]._fullscreen)return!0;return!1})()&&!1===t&&ye([document.documentElement,document.body]).removeClass(e+"fullscreen")}var zt=xt.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(e){var t=this;t._super(e),t.isRtl()&&t.classes.add("rtl"),t.classes.add("window"),t.bodyClasses.add("window-body"),t.state.set("fixed",!0),e.buttons&&(t.statusbar=new ft({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:t.isRtl()?"start":"end",defaults:{type:"button"},items:e.buttons}),t.statusbar.classes.add("foot"),t.statusbar.parent(t)),t.on("click",function(e){var n=t.classPrefix+"close";(we.hasClass(e.target,n)||we.hasClass(e.target.parentNode,n))&&t.close()}),t.on("cancel",function(){t.close()}),t.aria("describedby",t.describedBy||t._id+"-none"),t.aria("label",e.title),t._fullscreen=!1},recalc:function(){var e,t,n,i,r=this,o=r.statusbar;r._fullscreen&&(r.layoutRect(we.getWindowSize()),r.layoutRect().contentH=r.layoutRect().innerH),r._super(),e=r.layoutRect(),r.settings.title&&!r._fullscreen&&(t=e.headerW)>e.w&&(n=e.x-Math.max(0,t/2),r.layoutRect({w:t,x:n}),i=!0),o&&(o.layoutRect({w:r.layoutRect().innerW}).recalc(),(t=o.layoutRect().minW+e.deltaW)>e.w&&(n=e.x-Math.max(0,t-e.w),r.layoutRect({w:t,x:n}),i=!0)),i&&r.recalc()},initLayoutRect:function(){var e,t=this,n=t._super(),i=0;if(t.settings.title&&!t._fullscreen){e=t.getEl("head");var r=we.getSize(e);n.headerW=r.width,n.headerH=r.height,i+=n.headerH}t.statusbar&&(i+=t.statusbar.layoutRect().h),n.deltaH+=i,n.minH+=i,n.h+=i;var o=we.getWindowSize();return n.x=t.settings.x||Math.max(0,o.w/2-n.w/2),n.y=t.settings.y||Math.max(0,o.h/2-n.h/2),n},renderHtml:function(){var e=this,t=e._layout,n=e._id,i=e.classPrefix,r=e.settings,o="",s="",a=r.html;return e.preRender(),t.preRender(e),r.title&&(o='<div id="'+n+'-head" class="'+i+'window-head"><div id="'+n+'-title" class="'+i+'title">'+e.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=t.renderHtml(e)),e.statusbar&&(s=e.statusbar.renderHtml()),'<div id="'+n+'" class="'+e.classes+'" hidefocus="1"><div class="'+e.classPrefix+'reset" role="application">'+o+'<div id="'+n+'-body" class="'+e.bodyClasses+'">'+a+"</div>"+s+"</div></div>"},fullscreen:function(e){var t,n,i=this,r=document.documentElement,o=i.classPrefix;if(e!==i._fullscreen)if(ye(window).on("resize",function(){var e;if(i._fullscreen)if(t)i._timer||(i._timer=C.setTimeout(function(){var e=we.getWindowSize();i.moveTo(0,0).resizeTo(e.w,e.h),i._timer=0},50));else{e=(new Date).getTime();var n=we.getWindowSize();i.moveTo(0,0).resizeTo(n.w,n.h),(new Date).getTime()-e>50&&(t=!0)}}),n=i.layoutRect(),i._fullscreen=e,e){i._initial={x:n.x,y:n.y,w:n.w,h:n.h},i.borderBox=Ee("0"),i.getEl("head").style.display="none",n.deltaH-=n.headerH+2,ye([r,document.body]).addClass(o+"fullscreen"),i.classes.add("fullscreen");var s=we.getWindowSize();i.moveTo(0,0).resizeTo(s.w,s.h)}else i.borderBox=Ee(i.settings.border),i.getEl("head").style.display="",n.deltaH+=n.headerH,ye([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 e,t=this;setTimeout(function(){t.classes.add("in"),t.fire("open")},0),t._super(),t.statusbar&&t.statusbar.postRender(),t.focus(),this.dragHelper=new ct(t._id+"-dragh",{start:function(){e={x:t.layoutRect().x,y:t.layoutRect().y}},drag:function(n){t.moveTo(e.x+n.deltaX,e.y+n.deltaY)}}),t.on("submit",function(e){e.isDefaultPrevented()||t.close()}),Nt.push(t),Bt(!0)},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var e,t=this;for(t.dragHelper.destroy(),t._super(),t.statusbar&&this.statusbar.remove(),Ot(t.classPrefix,!1),e=Nt.length;e--;)Nt[e]===t&&Nt.splice(e,1);Bt(Nt.length>0)},getContentWindow:function(){var e=this.getEl().getElementsByTagName("iframe")[0];return e?e.contentWindow:null}});!function(){if(!_.desktop){var e={w:window.innerWidth,h:window.innerHeight};C.setInterval(function(){var t=window.innerWidth,n=window.innerHeight;e.w===t&&e.h===n||(e={w:t,h:n},ye(window).trigger("resize"))},100)}ye(window).on("resize",function(){var e,t,n=we.getWindowSize();for(e=0;e<Nt.length;e++)t=Nt[e].layoutRect(),Nt[e].moveTo(Nt[e].settings.x||Math.max(0,n.w/2-t.w/2),Nt[e].settings.y||Math.max(0,n.h/2-t.h/2))})}();var Lt=zt.extend({init:function(e){e={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(e)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(e){var t,n=e.callback||function(){};function i(e,t,i){return{type:"button",text:e,subtype:i?"primary":"",onClick:function(e){e.control.parents()[1].close(),n(t)}}}switch(e.buttons){case Lt.OK_CANCEL:t=[i("Ok",!0,!0),i("Cancel",!1)];break;case Lt.YES_NO:case Lt.YES_NO_CANCEL:t=[i("Yes",1,!0),i("No",0)],e.buttons===Lt.YES_NO_CANCEL&&t.push(i("Cancel",-1));break;default:t=[i("Ok",!0,!0)]}return new zt({padding:20,x:e.x,y:e.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:t,title:e.title,role:"alertdialog",items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200,text:e.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:e.onClose,onCancel:function(){n(!1)}}).renderTo(document.body).reflow()},alert:function(e,t){return"string"==typeof e&&(e={text:e}),e.callback=t,Lt.msgBox(e)},confirm:function(e,t){return"string"==typeof e&&(e={text:e}),e.callback=t,e.buttons=Lt.OK_CANCEL,Lt.msgBox(e)}}}),It=function(e){return{renderUI:function(t){return Ht(e,this,t)},resizeTo:function(t,n){return ue(e,t,n)},resizeBy:function(t,n){return ce(e,t,n)},getNotificationManagerImpl:function(){return Dt(e)},getWindowManagerImpl:function(){return{open:function(e,t,n){var i;return e.title=e.title||" ",e.url=e.url||e.file,e.url&&(e.width=parseInt(e.width||320,10),e.height=parseInt(e.height||240,10)),e.body&&(e.items={defaults:e.defaults,type:e.bodyType||"form",items:e.body,data:e.data,callbacks:e.commands}),e.url||e.buttons||(e.buttons=[{text:"Ok",subtype:"primary",onclick:function(){i.find("form")[0].submit()}},{text:"Cancel",onclick:function(){i.close()}}]),(i=new zt(e)).on("close",function(){n(i)}),e.data&&i.on("postRender",function(){this.find("*").each(function(t){var n=t.name();n in e.data&&t.value(e.data[n])})}),i.features=e||{},i.params=t||{},i=i.renderTo().reflow()},alert:function(e,t,n){var i;return(i=Lt.alert(e,function(){t()})).on("close",function(){n(i)}),i},confirm:function(e,t,n){var i;return(i=Lt.confirm(e,function(e){t(e)})).on("close",function(){n(i)}),i},close:function(e){e.close()},getParams:function(e){return e.params},setParams:function(e,t){e.params=t}}}}},Ft=Ce.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(e){this.settings=a.extend({},this.Defaults,e)},preRender:function(e){e.bodyClasses.add(this.settings.containerClass)},applyClasses:function(e){var t,n,i,r,o=this.settings;t=o.firstControlClass,n=o.lastControlClass,e.each(function(e){e.classes.remove(t).remove(n).add(o.controlClass),e.visible()&&(i||(i=e),r=e)}),i&&i.classes.add(t),r&&r.classes.add(n)},renderHtml:function(e){var t="";return this.applyClasses(e.items()),e.items().each(function(e){t+=e.renderHtml()}),t},recalc:function(){},postRender:function(){},isNative:function(){return!1}}),Vt=Ft.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(e){e.items().filter(":visible").each(function(e){var t=e.settings;e.layoutRect({x:t.x,y:t.y,w:t.w,h:t.h}),e.recalc&&e.recalc()})},renderHtml:function(e){return'<div id="'+e._id+'-absend" class="'+e.classPrefix+'abs-end"></div>'+this._super(e)}}),Ut=Mt.extend({Defaults:{classes:"widget btn",role:"button"},init:function(e){var t,n=this;n._super(e),e=n.settings,t=n.settings.size,n.on("click mousedown",function(e){e.preventDefault()}),n.on("touchstart",function(e){n.fire("click",e),e.preventDefault()}),e.subtype&&n.classes.add(e.subtype),t&&n.classes.add("btn-"+t),e.icon&&n.icon(e.icon)},icon:function(e){return arguments.length?(this.state.set("icon",e),this):this.state.get("icon")},repaint:function(){var e,t=this.getEl().firstChild;t&&((e=t.style).width=e.height="100%"),this._super()},renderHtml:function(){var e,t,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a="",l=n.settings;return(e=l.image)?(o="none","string"!=typeof e&&(e=window.getSelection?e[0]:e[1]),e=" style=\"background-image: url('"+e+"')\""):e="",s&&(n.classes.add("btn-has-text"),a='<span class="'+r+'txt">'+n.encode(s)+"</span>"),o=o?r+"ico "+r+"i-"+o:"",t="boolean"==typeof l.active?' aria-pressed="'+l.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" tabindex="-1"'+t+'><button id="'+i+'-button" role="presentation" type="button" tabindex="-1">'+(o?'<i class="'+o+'"'+e+"></i>":"")+a+"</button></div>"},bindStates:function(){var e=this,t=e.$,n=e.classPrefix+"txt";function i(i){var r=t("span."+n,e.getEl());i?(r[0]||(t("button:first",e.getEl()).append('<span class="'+n+'"></span>'),r=t("span."+n,e.getEl())),r.html(e.encode(i))):r.remove(),e.classes.toggle("btn-has-text",!!i)}return e.state.on("change:text",function(e){i(e.value)}),e.state.on("change:icon",function(t){var n=t.value,r=e.classPrefix;e.settings.icon=n,n=n?r+"ico "+r+"i-"+e.settings.icon:"";var o=e.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(e.state.get("text"))}),e._super()}}),Yt=Ut.extend({init:function(e){e=a.extend({text:"Browse...",multiple:!1,accept:null},e),this._super(e),this.classes.add("browsebutton"),e.multiple&&this.classes.add("multiple")},postRender:function(){var e=this,t=we.create("input",{type:"file",id:e._id+"-browse",accept:e.settings.accept});e._super(),ye(t).on("change",function(t){var n=t.target.files;e.value=function(){return n.length?e.settings.multiple?n:n[0]:null},t.preventDefault(),n.length&&e.fire("change",t)}),ye(t).on("click",function(e){e.stopPropagation()}),ye(e.getEl("button")).on("click",function(e){e.stopPropagation(),t.click()}),e.getEl().appendChild(t)},remove:function(){ye(this.getEl("button")).off(),ye(this.getEl("input")).off(),this._super()}}),$t=rt.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var e=this,t=e._layout;return e.classes.add("btn-group"),e.preRender(),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes+'"><div id="'+e._id+'-body">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"}}),jt=Mt.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(e){var t=this;t._super(e),t.on("click mousedown",function(e){e.preventDefault()}),t.on("click",function(e){e.preventDefault(),t.disabled()||t.checked(!t.checked())}),t.checked(t.settings.checked)},checked:function(e){return arguments.length?(this.state.set("checked",e),this):this.state.get("checked")},value:function(e){return arguments.length?this.checked(e):this.checked()},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix;return'<div id="'+t+'" class="'+e.classes+'" unselectable="on" aria-labelledby="'+t+'-al" tabindex="-1"><i class="'+n+"ico "+n+'i-checkbox"></i><span id="'+t+'-al" class="'+n+'label">'+e.encode(e.state.get("text"))+"</span></div>"},bindStates:function(){var e=this;function t(t){e.classes.toggle("checked",t),e.aria("checked",t)}return e.state.on("change:text",function(t){e.getEl("al").firstChild.data=e.translate(t.value)}),e.state.on("change:checked change:value",function(n){e.fire("change"),t(n.value)}),e.state.on("change:icon",function(t){var n=t.value,i=e.classPrefix;if(void 0===n)return e.settings.icon;e.settings.icon=n,n=n?i+"ico "+i+"i-"+e.settings.icon:"";var r=e.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)}),e.state.get("checked")&&t(!0),e._super()}}),qt=tinymce.util.Tools.resolve("tinymce.util.VK"),Xt=Mt.extend({init:function(e){var t=this;t._super(e),e=t.settings,t.classes.add("combobox"),t.subinput=!0,t.ariaTarget="inp",e.menu=e.menu||e.values,e.menu&&(e.icon="caret"),t.on("click",function(n){var i=n.target,r=t.getEl();if(ye.contains(r,i)||i===r)for(;i&&i!==r;)i.id&&-1!==i.id.indexOf("-open")&&(t.fire("action"),e.menu&&(t.showMenu(),n.aria&&t.menu.items()[0].focus())),i=i.parentNode}),t.on("keydown",function(e){var n;13===e.keyCode&&"INPUT"===e.target.nodeName&&(e.preventDefault(),t.parents().reverse().each(function(e){if(e.toJSON)return n=e,!1}),t.fire("submit",{data:n.toJSON()}))}),t.on("keyup",function(e){if("INPUT"===e.target.nodeName){var n=t.state.get("value"),i=e.target.value;i!==n&&(t.state.set("value",i),t.fire("autocomplete",e))}}),t.on("mouseover",function(e){var n=t.tooltip().moveTo(-65535);if(t.statusLevel()&&-1!==e.target.className.indexOf(t.classPrefix+"status")){var i=t.statusMessage()||"Ok",r=n.text(i).show().testMoveRel(e.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(e.target,r)}})},statusLevel:function(e){return arguments.length>0&&this.state.set("statusLevel",e),this.state.get("statusLevel")},statusMessage:function(e){return arguments.length>0&&this.state.set("statusMessage",e),this.state.get("statusMessage")},showMenu:function(){var e,t=this,n=t.settings;t.menu||((e=n.menu||[]).length?e={type:"menu",items:e}:e.type=e.type||"menu",t.menu=g.create(e).parent(t).renderTo(t.getContainerElm()),t.fire("createmenu"),t.menu.reflow(),t.menu.on("cancel",function(e){e.control===t.menu&&t.focus()}),t.menu.on("show hide",function(e){e.control.items().each(function(e){e.active(e.value()===t.value())})}).fire("show"),t.menu.on("select",function(e){t.value(e.control.value())}),t.on("focusin",function(e){"INPUT"===e.target.tagName.toUpperCase()&&t.menu.hide()}),t.aria("expanded",!0)),t.menu.show(),t.menu.layoutRect({w:t.layoutRect().w}),t.menu.moveRel(t.getEl(),t.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},focus:function(){this.getEl("inp").focus()},repaint:function(){var e,t,n=this,i=n.getEl(),r=n.getEl("open"),o=n.layoutRect(),s=0,a=i.firstChild;n.statusLevel()&&"none"!==n.statusLevel()&&(s=parseInt(we.getRuntimeStyle(a,"padding-right"),10)-parseInt(we.getRuntimeStyle(a,"padding-left"),10)),e=r?o.w-we.getSize(r).width-10:o.w-10;var l=document;return l.all&&(!l.documentMode||l.documentMode<=8)&&(t=n.layoutRect().h-2+"px"),ye(a).css({width:e-s,lineHeight:t}),n._super(),n},postRender:function(){var e=this;return ye(this.getEl("inp")).on("change",function(t){e.state.set("value",t.target.value),e.fire("change",t)}),e._super()},renderHtml:function(){var e,t,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"'),(e=o.icon)&&"caret"!==e&&(e=s+"ico "+s+"i-"+o.icon),t=i.state.get("text"),(e||t)&&(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"!==e?'<i class="'+e+'"></i>':'<i class="'+s+'caret"></i>')+(t?(e?" ":"")+t:"")+"</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(e){return arguments.length?(this.state.set("value",e),this):(this.state.get("rendered")&&this.state.set("value",this.getEl("inp").value),this.state.get("value"))},showAutoComplete:function(e,t){var n=this;if(0!==e.length){n.menu?n.menu.items().remove():n.menu=g.create({type:"menu",classes:"combobox-menu",layout:"flow"}).parent(n).renderTo(),a.each(e,function(e){var i,r;n.menu.add({text:e.title,url:e.previewUrl,match:t,classes:"menu-item-ellipsis",onclick:(i=e.value,r=e.title,function(){n.fire("selectitem",{title:r,value:i})})})}),n.menu.renderNew(),n.hideMenu(),n.menu.on("cancel",function(e){e.control.parent()===n.menu&&(e.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 e=this;e.state.on("change:value",function(t){e.getEl("inp").value!==t.value&&(e.getEl("inp").value=t.value)}),e.state.on("change:disabled",function(t){e.getEl("inp").disabled=t.value}),e.state.on("change:statusLevel",function(t){var n=e.getEl("status"),i=e.classPrefix,r=t.value;we.css(n,"display","none"===r?"none":""),we.toggleClass(n,i+"i-checkmark","ok"===r),we.toggleClass(n,i+"i-warning","warn"===r),we.toggleClass(n,i+"i-error","error"===r),e.classes.toggle("has-status","none"!==r),e.repaint()}),we.on(e.getEl("status"),"mouseleave",function(){e.tooltip().hide()}),e.on("cancel",function(t){e.menu&&e.menu.visible()&&(t.stopPropagation(),e.hideMenu())});var t=function(e,t){t&&t.items().length>0&&t.items().eq(e)[0].focus()};return e.on("keydown",function(n){var i=n.keyCode;"INPUT"===n.target.nodeName&&(i===qt.DOWN?(n.preventDefault(),e.fire("autocomplete"),t(0,e.menu)):i===qt.UP&&(n.preventDefault(),t(-1,e.menu)))}),e._super()},remove:function(){ye(this.getEl("inp")).off(),this.menu&&this.menu.remove(),this._super()}}),Jt=Xt.extend({init:function(e){var t=this;e.spellcheck=!1,e.onaction&&(e.icon="none"),t._super(e),t.classes.add("colorbox"),t.on("change keyup postrender",function(){t.repaintColor(t.value())})},repaintColor:function(e){var t=this.getEl("open"),n=t?t.getElementsByTagName("i")[0]:null;if(n)try{n.style.background=e}catch(i){}},bindStates:function(){var e=this;return e.state.on("change:value",function(t){e.state.get("rendered")&&e.repaintColor(t.value)}),e._super()}}),Gt=Ut.extend({showPanel:function(){var e=this,t=e.settings;if(e.classes.add("opened"),e.panel)e.panel.show();else{var n=t.panel;n.type&&(n={layout:"grid",items:n}),n.role=n.role||"dialog",n.popover=!0,n.autohide=!0,n.ariaRoot=!0,e.panel=new xt(n).on("hide",function(){e.classes.remove("opened")}).on("cancel",function(t){t.stopPropagation(),e.focus(),e.hidePanel()}).parent(e).renderTo(e.getContainerElm()),e.panel.fire("show"),e.panel.reflow()}var i=e.panel.testMoveRel(e.getEl(),t.popoverAlign||(e.isRtl()?["bc-tc","bc-tl","bc-tr"]:["bc-tc","bc-tr","bc-tl"]));e.panel.classes.toggle("start","bc-tl"===i),e.panel.classes.toggle("end","bc-tr"===i),e.panel.moveRel(e.getEl(),i)},hidePanel:function(){this.panel&&this.panel.hide()},postRender:function(){var e=this;return e.aria("haspopup",!0),e.on("click",function(t){t.control===e&&(e.panel&&e.panel.visible()?e.hidePanel():(e.showPanel(),e.panel.focus(!!t.aria)))}),e._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}}),Kt=m.DOM,Zt=Gt.extend({init:function(e){this._super(e),this.classes.add("splitbtn"),this.classes.add("colorbutton")},color:function(e){return e?(this._color=e,this.getEl("preview").style.backgroundColor=e,this):this._color},resetColor:function(){return this._color=null,this.getEl("preview").style.backgroundColor=null,this},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,i=e.state.get("text"),r=e.settings.icon?n+"ico "+n+"i-"+e.settings.icon:"",o=e.settings.image?" style=\"background-image: url('"+e.settings.image+"')\"":"",s="";return i&&(e.classes.add("btn-has-text"),s='<span class="'+n+'txt">'+e.encode(i)+"</span>"),'<div id="'+t+'" class="'+e.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="'+t+'-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 e=this,t=e.settings.onclick;return e.on("click",function(n){n.aria&&"down"===n.aria.key||n.control!==e||Kt.getParent(n.target,"."+e.classPrefix+"open")||(n.stopImmediatePropagation(),t.call(e,n))}),delete e.settings.onclick,e._super()}}),Qt=tinymce.util.Tools.resolve("tinymce.util.Color"),en=Mt.extend({Defaults:{classes:"widget colorpicker"},init:function(e){this._super(e)},postRender:function(){var e,t,n,i,r,o=this,s=o.color();function a(e,t){var n,i,r=we.getPos(e);return n=t.pageX-r.x,i=t.pageY-r.y,{x:n=Math.max(0,Math.min(n/e.clientWidth,1)),y:i=Math.max(0,Math.min(i/e.clientHeight,1))}}function l(e,t){var s=(360-e.h)/360;we.css(n,{top:100*s+"%"}),t||we.css(r,{left:e.s+"%",top:100-e.v+"%"}),i.style.background=Qt({s:100,v:100,h:e.h}).toHex(),o.color().parse({s:e.s,v:e.v,h:e.h})}function u(t){var n;n=a(i,t),e.s=100*n.x,e.v=100*(1-n.y),l(e),o.fire("change")}function c(n){var i;i=a(t,n),(e=s.toHsv()).h=360*(1-i.y),l(e,!0),o.fire("change")}t=o.getEl("h"),n=o.getEl("hp"),i=o.getEl("sv"),r=o.getEl("svp"),o._repaint=function(){l(e=s.toHsv())},o._super(),o._svdraghelper=new ct(o._id+"-sv",{start:u,drag:u}),o._hdraghelper=new ct(o._id+"-h",{start:c,drag:c}),o._repaint()},rgb:function(){return this.color().toRgb()},value:function(e){if(!arguments.length)return this.color().toHex();this.color().parse(e),this._rendered&&this._repaint()},color:function(){return this._color||(this._color=Qt()),this._color},renderHtml:function(){var e,t=this._id,n=this.classPrefix,i="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000";return e='<div id="'+t+'-h" class="'+n+'colorpicker-h" style="background: -ms-linear-gradient(top,'+i+");background: linear-gradient(to bottom,"+i+');">'+function(){var e,t,r,o,s="";for(r="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",e=0,t=(o=i.split(",")).length-1;e<t;e++)s+='<div class="'+n+'colorpicker-h-chunk" style="height:'+100/t+"%;"+r+o[e]+",endColorstr="+o[e+1]+");-ms-"+r+o[e]+",endColorstr="+o[e+1]+')"></div>';return s}()+'<div id="'+t+'-hp" class="'+n+'colorpicker-h-marker"></div></div>','<div id="'+t+'" class="'+this.classes+'"><div id="'+t+'-sv" class="'+n+'colorpicker-sv"><div class="'+n+'colorpicker-overlay1"><div class="'+n+'colorpicker-overlay2"><div id="'+t+'-svp" class="'+n+'colorpicker-selector1"><div class="'+n+'colorpicker-selector2"></div></div></div></div></div>'+e+"</div>"}}),tn=Mt.extend({init:function(e){e=a.extend({height:100,text:"Drop an image here",multiple:!1,accept:null},e),this._super(e),this.classes.add("dropzone"),e.multiple&&this.classes.add("multiple")},renderHtml:function(){var e,t,n=this.settings;return e={id:this._id,hidefocus:"1"},t=we.create("div",e,"<span>"+this.translate(n.text)+"</span>"),n.height&&we.css(t,"height",n.height+"px"),n.width&&we.css(t,"width",n.width+"px"),t.className=this.classes,t.outerHTML},postRender:function(){var e=this,t=function(t){t.preventDefault(),e.classes.toggle("dragenter"),e.getEl().className=e.classes};e._super(),e.$el.on("dragover",function(e){e.preventDefault()}),e.$el.on("dragenter",t),e.$el.on("dragleave",t),e.$el.on("drop",function(t){if(t.preventDefault(),!e.state.get("disabled")){var n=function(t){var n=e.settings.accept;if("string"!=typeof n)return t;var i=new RegExp("("+n.split(/\s*,\s*/).join("|")+")$","i");return a.grep(t,function(e){return i.test(e.name)})}(t.dataTransfer.files);e.value=function(){return n.length?e.settings.multiple?n:n[0]:null},n.length&&e.fire("change",t)}})},remove:function(){this.$el.off(),this._super()}}),nn=Mt.extend({init:function(e){var t=this;e.delimiter||(e.delimiter="\xbb"),t._super(e),t.classes.add("path"),t.canFocus=!0,t.on("click",function(e){var n;(n=e.target.getAttribute("data-index"))&&t.fire("select",{value:t.row()[n],index:n})}),t.row(t.settings.row)},focus:function(){return this.getEl().firstChild.focus(),this},row:function(e){return arguments.length?(this.state.set("row",e),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 e=this;return e.state.on("change:row",function(t){e.innerHtml(e._getDataPathHtml(t.value))}),e._super()},_getDataPathHtml:function(e){var t,n,i=e||[],r="",o=this.classPrefix;for(t=0,n=i.length;t<n;t++)r+=(t>0?'<div class="'+o+'divider" aria-hidden="true"> '+this.settings.delimiter+" </div>":"")+'<div role="button" class="'+o+"path-item"+(t===n-1?" "+o+"last":"")+'" data-index="'+t+'" tabindex="-1" id="'+this._id+"-"+t+'" aria-level="'+(t+1)+'">'+i[t].name+"</div>";return r||(r='<div class="'+o+'path-item">\xa0</div>'),r}}),rn=nn.extend({postRender:function(){var e=this,t=e.settings.editor;function n(e){if(1===e.nodeType){if("BR"===e.nodeName||e.getAttribute("data-mce-bogus"))return!0;if("bookmark"===e.getAttribute("data-mce-type"))return!0}return!1}return!1!==t.settings.elementpath&&(e.on("select",function(e){t.focus(),t.selection.select(this.row()[e.index].element),t.nodeChanged()}),t.on("nodeChange",function(i){for(var r=[],o=i.parents,s=o.length;s--;)if(1===o[s].nodeType&&!n(o[s])){var a=t.fire("ResolveName",{name:o[s].nodeName.toLowerCase(),target:o[s]});if(a.isDefaultPrevented()||r.push({name:a.name,element:o[s]}),a.isPropagationStopped())break}e.row(r)})),e._super()}}),on=rt.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var e=this,t=e._layout,n=e.classPrefix;return e.classes.add("formitem"),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes+'" hidefocus="1" tabindex="-1">'+(e.settings.title?'<div id="'+e._id+'-title" class="'+n+'title">'+e.settings.title+"</div>":"")+'<div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"}}),sn=rt.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 e=this,t=e.items();e.settings.formItemDefaults||(e.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),t.each(function(t){var n,i=t.settings.label;i&&((n=new on(a.extend({items:{type:"label",id:t._id+"-l",text:i,flex:0,forId:t._id,disabled:t.disabled()}},e.settings.formItemDefaults))).type="formitem",t.aria("labelledby",t._id+"-l"),"undefined"==typeof t.settings.flex&&(t.settings.flex=1),e.replace(t,n),n.add(t))})},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){this._super(),this.fromJSON(this.settings.data)},bindStates:function(){var e=this;function t(){var t,n,i=0,r=[];if(!1!==e.settings.labelGapCalc)for(("children"===e.settings.labelGapCalc?e.find("formitem"):e.items()).filter("formitem").each(function(e){var t=e.items()[0],n=t.getEl().clientWidth;i=n>i?n:i,r.push(t)}),n=e.settings.labelGap||0,t=r.length;t--;)r[t].settings.minWidth=i+n}e._super(),e.on("show",t),t()}}),an=sn.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 e=this,t=e._layout,n=e.classPrefix;return e.preRender(),t.preRender(e),'<fieldset id="'+e._id+'" class="'+e.classes+'" hidefocus="1" tabindex="-1">'+(e.settings.title?'<legend id="'+e._id+'-title" class="'+n+'fieldset-title">'+e.settings.title+"</legend>":"")+'<div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></fieldset>"}}),ln=0,un=function(e){var t=(new Date).getTime();return e+"_"+Math.floor(1e9*Math.random())+ ++ln+String(t)},cn=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:E.constant(e)}},dn={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1)throw console.error("HTML does not have a single root node",e),"HTML must have a single root node";return cn(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return cn(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return cn(n)},fromDom:cn,fromPoint:function(e,t,n){return W.from(e.dom().elementFromPoint(t,n)).map(cn)}},fn=function(e){var t,n=!1;return function(){return n||(n=!0,t=e.apply(null,arguments)),t}},hn=8,mn=9,gn=1,pn=3,vn=function(e){return e.dom().nodeName.toLowerCase()},bn=function(e){return e.dom().nodeType},yn=function(e){return function(t){return bn(t)===e}},xn=yn(gn),wn=yn(pn),_n=yn(mn),Rn={name:vn,type:bn,value:function(e){return e.dom().nodeValue},isElement:xn,isText:wn,isDocument:_n,isComment:function(e){return bn(e)===hn||"#comment"===vn(e)}},Cn=(fn(function(){return Cn(dn.fromDom(document))}),function(e){var t=e.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return dn.fromDom(t)}),kn=function(e){return function(t){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(t)===e}},En=(kn("string"),kn("object"),kn("array"),kn("null"),kn("boolean"),kn("undefined"),kn("function"),kn("number"),Object.keys,undefined,function(){var e=arguments;return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(e.length!==t.length)throw new Error('Wrong number of arguments to struct. Expected "['+e.length+']", got '+t.length+" arguments");var i={};return ee.each(e,function(e,n){i[e]=E.constant(t[n])}),i}}),Hn=("undefined"!=typeof window?window:Function("return this;")(),function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(i.test(t))return i}return undefined}(e,t);if(!n)return{major:0,minor:0};var i=function(e){return Number(t.replace(n,"$"+e))};return Mn(i(1),i(2))}),Sn=function(){return Mn(0,0)},Mn=function(e,t){return{major:e,minor:t}},Tn={nu:Mn,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?Sn():Hn(e,n)},unknown:Sn},Pn="Firefox",Wn=function(e,t){return function(){return t===e}},Dn=function(e){var t=e.current;return{current:t,version:e.version,isEdge:Wn("Edge",t),isChrome:Wn("Chrome",t),isIE:Wn("IE",t),isOpera:Wn("Opera",t),isFirefox:Wn(Pn,t),isSafari:Wn("Safari",t)}},Nn={unknown:function(){return Dn({current:undefined,version:Tn.unknown()})},nu:Dn,edge:E.constant("Edge"),chrome:E.constant("Chrome"),ie:E.constant("IE"),opera:E.constant("Opera"),firefox:E.constant(Pn),safari:E.constant("Safari")},An="Windows",Bn="Android",On="Solaris",zn="FreeBSD",Ln=function(e,t){return function(){return t===e}},In=function(e){var t=e.current;return{current:t,version:e.version,isWindows:Ln(An,t),isiOS:Ln("iOS",t),isAndroid:Ln(Bn,t),isOSX:Ln("OSX",t),isLinux:Ln("Linux",t),isSolaris:Ln(On,t),isFreeBSD:Ln(zn,t)}},Fn={unknown:function(){return In({current:undefined,version:Tn.unknown()})},nu:In,windows:E.constant(An),ios:E.constant("iOS"),android:E.constant(Bn),linux:E.constant("Linux"),osx:E.constant("OSX"),solaris:E.constant(On),freebsd:E.constant(zn)},Vn=function(e,t){var n=String(t).toLowerCase();return ee.find(e,function(e){return e.search(n)})},Un=function(e,t){return Vn(e,t).map(function(e){var n=Tn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Yn=function(e,t){return Vn(e,t).map(function(e){var n=Tn.detect(e.versionRegexes,t);return{current:e.name,version:n}})},$n=function(e,t){return-1!==e.indexOf(t)},jn=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,qn=function(e){return function(t){return $n(t,e)}},Xn=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return $n(e,"edge/")&&$n(e,"chrome")&&$n(e,"safari")&&$n(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,jn],search:function(e){return $n(e,"chrome")&&!$n(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return $n(e,"msie")||$n(e,"trident")}},{name:"Opera",versionRegexes:[jn,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:qn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:qn("firefox")},{name:"Safari",versionRegexes:[jn,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return($n(e,"safari")||$n(e,"mobile/"))&&$n(e,"applewebkit")}}],Jn=[{name:"Windows",search:qn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return $n(e,"iphone")||$n(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:qn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:qn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:qn("linux"),versionRegexes:[]},{name:"Solaris",search:qn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:qn("freebsd"),versionRegexes:[]}],Gn={browsers:E.constant(Xn),oses:E.constant(Jn)},Kn=function(e){var t,n,i,r,o,s,a,l,u,c,d,f=Gn.browsers(),h=Gn.oses(),m=Un(f,e).fold(Nn.unknown,Nn.nu),g=Yn(h,e).fold(Fn.unknown,Fn.nu);return{browser:m,os:g,deviceType:(n=m,i=e,r=(t=g).isiOS()&&!0===/ipad/i.test(i),o=t.isiOS()&&!r,s=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,l=r||s||a&&!0===/mobile/i.test(i),u=t.isiOS()||t.isAndroid(),c=u&&!l,d=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(i),{isiPad:E.constant(r),isiPhone:E.constant(o),isTablet:E.constant(l),isPhone:E.constant(c),isTouch:E.constant(u),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:E.constant(d)})}},Zn=gn,Qn=mn,ei=function(e){return e.nodeType!==Zn&&e.nodeType!==Qn||0===e.childElementCount},ti={all:function(e,t){var n=t===undefined?document:t.dom();return ei(n)?[]:ee.map(n.querySelectorAll(e),dn.fromDom)},is:function(e,t){var n=e.dom();if(n.nodeType!==Zn)return!1;if(n.matches!==undefined)return n.matches(t);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(t);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(t);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},one:function(e,t){var n=t===undefined?document:t.dom();return ei(n)?W.none():W.from(n.querySelector(e)).map(dn.fromDom)}},ni=(fn(function(){var e=navigator.userAgent;return Kn(e)})().browser.isIE(),En("element","offset"),function(e,t){return ti.all(t,e)}),ii=a.trim,ri=function(e){return function(t){if(t&&1===t.nodeType){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1}},oi=ri("true"),si=ri("false"),ai=function(e,t,n,i,r){return{type:e,title:t,url:n,level:i,attach:r}},li=function(e){return e.innerText||e.textContent},ui=function(e){return(t=e)&&"A"===t.nodeName&&(t.id||t.name)&&di(e);var t},ci=function(e){return e&&/^(H[1-6])$/.test(e.nodeName)},di=function(e){return function(e){for(;e=e.parentNode;){var t=e.contentEditable;if(t&&"inherit"!==t)return oi(e)}return!1}(e)&&!si(e)},fi=function(e){return ci(e)&&di(e)},hi=function(e){var t,n,i=(t=e).id?t.id:un("h");return ai("header",li(e),"#"+i,ci(n=e)?parseInt(n.nodeName.substr(1),10):0,function(){e.id=i})},mi=function(e){var t=e.id||e.name,n=li(e);return ai("anchor",n||"#"+t,"#"+t,0,E.noop)},gi=function(e){var t,n;return t="h1,h2,h3,h4,h5,h6,a:not([href])",n=e,ee.map(ni(dn.fromDom(n),t),function(e){return e.dom()})},pi=function(e){return ii(e.title).length>0},vi=function(e){var t,n,i=gi(e);return ee.filter((n=i,ee.map(ee.filter(n,fi),hi)).concat((t=i,ee.map(ee.filter(t,ui),mi))),pi)},bi={},yi=function(e){return{title:e.title,value:{title:{raw:e.title},url:e.url,attach:e.attach}}},xi=function(e,t){return{title:e,value:{title:e,url:t,attach:E.noop}}},wi=function(e,t,n){var i=t in e?e[t]:n;return!1===i?null:i},_i=function(e,t,n,i){var r,o,s,l,u={title:"-"},c=function(e){var i=e.hasOwnProperty(n)?e[n]:[],r=ee.filter(i,function(e){return n=e,i=t,!ee.exists(i,function(e){return e.url===n});var n,i});return a.map(r,function(e){return{title:e,value:{title:e,url:e,attach:E.noop}}})},d=function(e){var n,i=ee.filter(t,function(t){return t.type===e});return n=i,a.map(n,yi)};return!1===i.typeahead_urls?[]:"file"===n?(r=[Ri(e,c(bi)),Ri(e,d("header")),Ri(e,(o=d("anchor"),s=wi(i,"anchor_top","#top"),l=wi(i,"anchor_bottom","#bottom"),null!==s&&o.unshift(xi("<top>",s)),null!==l&&o.push(xi("<bottom>",l)),o))],ee.foldl(r,function(e,t){return 0===e.length||0===t.length?e.concat(t):e.concat(u,t)},[])):Ri(e,c(bi))},Ri=function(e,t){var n=e.toLowerCase(),i=a.grep(t,function(e){return-1!==e.title.toLowerCase().indexOf(n)});return 1===i.length&&i[0].title===e?[]:i},Ci=function(e,t,n,i){var r=function(r){var o=vi(n),s=_i(r,o,i,t);e.showAutoComplete(s,r)};e.on("autocomplete",function(){r(e.value())}),e.on("selectitem",function(t){var n=t.value;e.value(n.url);var r,o=(r=n.title).raw?r.raw:r;"image"===i?e.fire("change",{meta:{alt:o,attach:n.attach}}):e.fire("change",{meta:{text:o,attach:n.attach}}),e.focus()}),e.on("click",function(t){0===e.value().length&&"INPUT"===t.target.nodeName&&r("")}),e.on("PostRender",function(){e.getRoot().on("submit",function(t){var n,r,o;t.isDefaultPrevented()||(n=e.value(),o=bi[r=i],/^https?/.test(n)&&(o?-1===ee.indexOf(o,n)&&(bi[r]=o.slice(0,5).concat(n)):bi[r]=[n]))})})},ki=function(e,t,n){var i=t.filepicker_validator_handler;i&&e.state.on("change:value",function(t){var r;0!==(r=t.value).length?i({url:r,type:n},function(t){var n,i,r,o=(i=(n=t).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:""});e.statusMessage(o.message),e.statusLevel(o.status)}):e.statusLevel("none")})},Ei=Xt.extend({Statics:{clearHistory:function(){bi={}}},init:function(e){var t,n,i,r=this,o=window.tinymce?window.tinymce.activeEditor:s.activeEditor,l=o.settings,u=e.filetype;e.spellcheck=!1,(i=l.file_picker_types||l.file_browser_callback_types)&&(i=a.makeMap(i,/[, ]/)),i&&!i[u]||(!(n=l.file_picker_callback)||i&&!i[u]?!(n=l.file_browser_callback)||i&&!i[u]||(t=function(){n(r.getEl("inp").id,r.value(),u,window)}):t=function(){var e=r.fire("beforecall").meta;e=a.extend({filetype:u},e),n.call(o,function(e,t){r.value(e).fire("change",{meta:t})},r.value(),e)}),t&&(e.icon="browse",e.onaction=t),r._super(e),r.classes.add("filepicker"),Ci(r,l,o.getBody(),u),ki(r,l,u)}}),Hi=Vt.extend({recalc:function(e){var t=e.layoutRect(),n=e.paddingBox;e.items().filter(":visible").each(function(e){e.layoutRect({x:n.left,y:n.top,w:t.innerW-n.right-n.left,h:t.innerH-n.top-n.bottom}),e.recalc&&e.recalc()})}}),Si=Vt.extend({recalc:function(e){var t,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,b,y,x,w,_,R,C,k,E,H,S,M,T,P,W,D,N,A,B,O,z=[],L=Math.max,I=Math.min;for(i=e.items().filter(":visible"),r=e.layoutRect(),o=e.paddingBox,s=e.settings,f=e.isRtl()?s.direction||"row-reversed":s.direction,a=s.align,l=e.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?(C="y",_="h",R="minH",k="maxH",H="innerH",E="top",S="deltaH",M="contentH",N="left",W="w",T="x",P="innerW",D="minW",A="right",B="deltaW",O="contentW"):(C="x",_="w",R="minW",k="maxW",H="innerW",E="left",S="deltaW",M="contentW",N="top",W="h",T="y",P="innerH",D="minH",A="bottom",B="deltaH",O="contentH"),d=r[H]-o[E]-o[E],w=c=0,t=0,n=i.length;t<n;t++)m=(h=i[t]).layoutRect(),g=h.settings.flex,d-=t<n-1?u:0,g>0&&(c+=g,m[k]&&z.push(h),m.flex=g),d-=m[R],(p=o[N]+m[D]+o[A])>w&&(w=p);if((y={})[R]=d<0?r[R]-d+r[S]:r[H]-d+r[S],y[D]=w+r[B],y[M]=r[H]-d,y[O]=w,y.minW=I(y.minW,r.maxW),y.minH=I(y.minH,r.maxH),y.minW=L(y.minW,r.startMinWidth),y.minH=L(y.minH,r.startMinHeight),!r.autoResize||y.minW===r.minW&&y.minH===r.minH){for(b=d/c,t=0,n=z.length;t<n;t++)v=(m=(h=z[t]).layoutRect())[k],(p=m[R]+m.flex*b)>v?(d-=m[k]-m[R],c-=m.flex,m.flex=0,m.maxFlexSize=v):m.maxFlexSize=0;for(b=d/c,x=o[E],y={},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)))),y[T]=o[N],t=0,n=i.length;t<n;t++)p=(m=(h=i[t]).layoutRect()).maxFlexSize||m[R],"center"===a?y[T]=Math.round(r[P]/2-m[W]/2):"stretch"===a?(y[W]=L(m[D]||0,r[P]-o[N]-o[A]),y[T]=o[N]):"end"===a&&(y[T]=r[P]-m[W]-o.top),m.flex>0&&(p+=m.flex*b),y[_]=p,y[C]=x,h.layoutRect(y),h.recalc&&h.recalc(),x+=p+u}else if(y.w=y.minW,y.h=y.minH,e.layoutRect(y),this.recalc(e),null===e._lastRect){var F=e.parent();F&&(F._lastRect=null,F.recalc())}}}),Mi=Ft.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(e){e.items().filter(":visible").each(function(e){e.recalc&&e.recalc()})},isNative:function(){return!0}}),Ti=function(e,t){return ti.one(t,e)},Pi=function(e,t){return function(){e.execCommand("mceToggleFormat",!1,t)}},Wi=function(e,t){return function(){var n=this;e.formatter?e.formatter.formatChanged(t,function(e){n.active(e)}):e.on("init",function(){e.formatter.formatChanged(t,function(e){n.active(e)})})}},Di=function(e){e.addMenuItem("align",{text:"Align",menu:[{text:"Left",icon:"alignleft",onclick:Pi(e,"alignleft")},{text:"Center",icon:"aligncenter",onclick:Pi(e,"aligncenter")},{text:"Right",icon:"alignright",onclick:Pi(e,"alignright")},{text:"Justify",icon:"alignjustify",onclick:Pi(e,"alignjustify")}]}),a.each({alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"],alignnone:["No alignment","JustifyNone"]},function(t,n){e.addButton(n,{active:!1,tooltip:t[0],cmd:t[1],onPostRender:Wi(e,n)})})},Ni=function(e){return function(t,n){return W.from(n).map(dn.fromDom).filter(Rn.isElement).bind(function(n){return function(e,t,n){for(;n!==t;){if(n.style[e]){var i=n.style[e];return""!==i?W.some(i):W.none()}n=n.parentNode}return W.none()}(e,t,n.dom()).or((i=e,r=n.dom(),W.from(m.DOM.getStyle(r,i,!0))));var i,r}).getOr("")}},Ai={getFontSize:Ni("fontSize"),getFontFamily:E.compose(function(e){return e.replace(/[\'\"]/g,"").replace(/,\s+/g,",")},Ni("fontFamily")),toPt:function(e,t){return/[0-9.]+px$/.test(e)?(n=72*parseInt(e,10)/96,i=t||0,r=Math.pow(10,i),Math.round(n*r)/r+"pt"):e;var n,i,r}},Bi=function(e){return e?e.split(",")[0]:""},Oi=function(e,t){return function(){var n=this;e.on("init nodeChange",function(i){var r,o,s,l=Ai.getFontFamily(e.getBody(),i.element),u=(r=t,o=l,a.each(r,function(e){e.value.toLowerCase()===o.toLowerCase()&&(s=e.value)}),a.each(r,function(e){s||Bi(e.value).toLowerCase()!==Bi(o).toLowerCase()||(s=e.value)}),s);n.value(u||null),!u&&l&&n.text(Bi(l))})}},zi=function(e){e.addButton("fontselect",function(){var t,n=(t=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(e.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"),a.map(t,function(e){return{text:{raw:e[0]},value:e[1],textStyle:-1===e[1].indexOf("dings")?"font-family:"+e[1]:""}}));return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:n,fixedWidth:!0,onPostRender:Oi(e,n),onselect:function(t){t.control.settings.value&&e.execCommand("FontName",!1,t.control.settings.value)}}})},Li=function(e){zi(e)},Ii=function(e,t,n){var i;return a.each(e,function(e){e.value===n?i=n:e.value===t&&(i=t)}),i},Fi=function(e){e.addButton("fontsizeselect",function(){var t,n,i,r=(t=e.settings.fontsize_formats||"8pt 10pt 12pt 14pt 18pt 24pt 36pt",a.map(t.split(" "),function(e){var t=e,n=e,i=e.split("=");return i.length>1&&(t=i[0],n=i[1]),{text:t,value:n}}));return{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:r,fixedWidth:!0,onPostRender:(n=e,i=r,function(){var e=this;n.on("init nodeChange",function(t){var r,o,s,a;if(r=Ai.getFontSize(n.getBody(),t.element))for(s=3;!a&&s>=0;s--)o=Ai.toPt(r,s),a=Ii(i,o,r);e.value(a||null),a||e.text(o)})}),onclick:function(t){t.control.settings.value&&e.execCommand("FontSize",!1,t.control.settings.value)}}})},Vi=function(e){Fi(e)},Ui=function(e,t){return function(){var n,i,r,o=[];return a.each(t,function(t){o.push({text:t[0],value:t[1],textStyle:function(){return e.formatter.getCssText(t[1])}})}),{type:"listbox",text:t[0][0],values:o,fixedWidth:!0,onselect:function(t){if(t.control){var n=t.control.value();Pi(e,n)()}},onPostRender:(n=e,i=o,function(){var e=this;n.on("nodeChange",function(t){var o=n.formatter,s=null;a.each(t.parents,function(e){if(a.each(i,function(t){if(r?o.matchNode(e,r,{value:t.value})&&(s=t.value):o.matchNode(e,t.value)&&(s=t.value),s)return!1}),s)return!1}),e.value(s)})})}}},Yi=function(e){var t,n,i=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(e.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");e.addMenuItem("blockformats",{text:"Blocks",menu:(t=e,n=i,a.map(n,function(e){return{text:e[0],onclick:Pi(t,e[1]),textStyle:function(){return t.formatter.getCssText(e[1])}}}))}),e.addButton("formatselect",Ui(e,i))},$i=function(e,t){var n=t.length;return a.each(t,function(t){t.menu&&(t.hidden=0===$i(e,t.menu));var i=t.format;i&&(t.hidden=!e.formatter.canApply(i)),t.hidden&&n--}),n},ji=function(e,t){var n=t.items().length;return t.items().each(function(t){t.menu&&t.visible(ji(e,t.menu)>0),!t.menu&&t.settings.menu&&t.visible($i(e,t.settings.menu)>0);var i=t.settings.format;i&&t.visible(e.formatter.canApply(i)),t.visible()||n--}),n},qi=function(e){var t,n,i,r,o,s,l,u,c=(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(e){var t=[];if(e)return a.each(e,function(e){var r={text:e.title,icon:e.icon};if(e.items)r.menu=o(e.items);else{var s=e.format||"custom"+n++;e.format||(e.name=s,i.push(e)),r.format=s,r.cmd=e.cmd}t.push(r)}),t},(t=e).on("init",function(){a.each(i,function(e){t.formatter.register(e.name,e)})}),{type:"menu",items:t.settings.style_formats_merge?t.settings.style_formats?o(r.concat(t.settings.style_formats)):o(r):o(t.settings.style_formats||r),onPostRender:function(e){t.fire("renderFormatsMenu",{control:e.control})},itemDefaults:{preview:!0,textStyle:function(){if(this.settings.format)return t.formatter.getCssText(this.settings.format)},onPostRender:function(){var e=this;e.parent().on("show",function(){var n,i;(n=e.settings.format)&&(e.disabled(!t.formatter.canApply(n)),e.active(t.formatter.match(n))),(i=e.settings.cmd)&&e.active(t.queryCommandState(i))})},onclick:function(){this.settings.format&&Pi(t,this.settings.format)(),this.settings.cmd&&t.execCommand(this.settings.cmd)}}});s=c,e.addMenuItem("formats",{text:"Formats",menu:s}),u=c,(l=e).addButton("styleselect",{type:"menubutton",text:"Formats",menu:u,onShowMenu:function(){l.settings.style_formats_autohide&&ji(l,this.menu)}})},Xi=function(e,t){var n,i;if("string"==typeof t)i=t.split(" ");else if(a.isArray(t))return ee.flatten(a.map(t,function(t){return Xi(e,t)}));return n=a.grep(i,function(t){return"|"===t||t in e.menuItems}),a.map(n,function(t){return"|"===t?{text:"-"}:e.menuItems[t]})},Ji=function(e){return e&&"-"===e.text},Gi=function(e){var t=ee.filter(e,function(e,t,n){return!Ji(e)||!Ji(n[t-1])});return ee.filter(t,function(e,t,n){return!Ji(e)||t>0&&t<n.length-1})},Ki=function(e){var t,n,i,r,o=e.settings.insert_button_items;return Gi(o?Xi(e,o):(t=e,n="insert",i=[{text:"-"}],r=a.grep(t.menuItems,function(e){return e.context===n}),a.each(r,function(e){"before"===e.separator&&i.push({text:"|"}),e.prependToContext?i.unshift(e):i.push(e),"after"===e.separator&&i.push({text:"|"})}),i))},Zi=function(e){var t;(t=e).addButton("insert",{type:"menubutton",icon:"insert",menu:[],oncreatemenu:function(){this.menu.add(Ki(t)),this.menu.renderNew()}})},Qi=function(e){var t,n,i;t=e,a.each({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(e,n){t.addButton(n,{active:!1,tooltip:e,onPostRender:Wi(t,n),onclick:Pi(t,n)})}),n=e,a.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(e,t){n.addButton(t,{tooltip:e[0],cmd:e[1]})}),i=e,a.each({blockquote:["Blockquote","mceBlockQuote"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"]},function(e,t){i.addButton(t,{active:!1,tooltip:e[0],cmd:e[1],onPostRender:Wi(i,t)})})},er=function(e){var t;Qi(e),t=e,a.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(e,n){t.addMenuItem(n,{text:e[0],icon:n,shortcut:e[2],cmd:e[1]})}),t.addMenuItem("codeformat",{text:"Code",icon:"code",onclick:Pi(t,"code")})},tr=function(e,t){return function(){var n=this,i=function(){var n="redo"===t?"hasRedo":"hasUndo";return!!e.undoManager&&e.undoManager[n]()};n.disabled(!i()),e.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",function(){n.disabled(e.readonly||!i())})}},nr=function(e){var t,n;(t=e).addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:tr(t,"undo"),cmd:"undo"}),t.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:tr(t,"redo"),cmd:"redo"}),(n=e).addButton("undo",{tooltip:"Undo",onPostRender:tr(n,"undo"),cmd:"undo"}),n.addButton("redo",{tooltip:"Redo",onPostRender:tr(n,"redo"),cmd:"redo"})},ir=function(e){var t,n;(t=e).addMenuItem("visualaid",{text:"Visual aids",selectable:!0,onPostRender:(n=t,function(){var e=this;n.on("VisualAid",function(t){e.active(t.hasVisual)}),e.active(n.hasVisual)}),cmd:"mceToggleVisualAid"})},rr={setup:function(e){var t;e.rtl&&(et.rtl=!0),e.on("mousedown",function(){xt.hideAll()}),(t=e).settings.ui_container&&(_.container=Ti(dn.fromDom(document.body),t.settings.ui_container).fold(E.constant(null),function(e){return e.dom()})),Mt.tooltips=!_.iOS,et.translate=function(e){return s.translate(e)},Yi(e),Di(e),er(e),nr(e),Vi(e),Li(e),qi(e),ir(e),Zi(e)}},or=Vt.extend({recalc:function(e){var t,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,b,y,x,w,_,R,C,k,E,H,S,M=[],T=[];t=e.settings,r=e.items().filter(":visible"),o=e.layoutRect(),i=t.columns||Math.ceil(Math.sqrt(r.length)),n=Math.ceil(r.length/i),b=t.spacingH||t.spacing||0,y=t.spacingV||t.spacing||0,x=t.alignH||t.align,w=t.alignV||t.align,p=e.paddingBox,S="reverseRows"in t?t.reverseRows:e.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++)C=(u=c.layoutRect()).minW,k=u.minH,M[d]=C>M[d]?C:M[d],T[f]=k>T[f]?k:T[f];for(E=o.innerW-p.left-p.right,_=0,d=0;d<i;d++)_+=M[d]+(d>0?b:0),E-=(d>0?b:0)+M[d];for(H=o.innerH-p.top-p.bottom,R=0,f=0;f<n;f++)R+=T[f]+(f>0?y:0),H-=(f>0?y: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=e.layoutRect(l)).contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH),P="start"===t.packV?0:H>0?Math.floor(H/n):0;var W=0,D=t.flexWidths;if(D)for(d=0;d<D.length;d++)W+=D[d];else W=i;var N=E/W;for(d=0;d<i;d++)M[d]+=D?D[d]*N:N;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+b,c.recalc&&c.recalc();m+=a+y}}else if(l.w=l.minW,l.h=l.minH,e.layoutRect(l),this.recalc(e),null===e._lastRect){var A=e.parent();A&&(A._lastRect=null,A.recalc())}}}),sr=Mt.extend({renderHtml:function(){var e=this;return e.classes.add("iframe"),e.canFocus=!1,'<iframe id="'+e._id+'" class="'+e.classes+'" tabindex="-1" src="'+(e.settings.url||"javascript:''")+'" frameborder="0"></iframe>'},src:function(e){this.getEl().src=e},html:function(e,t){var n=this,i=this.getEl().contentWindow.document.body;return i?(i.innerHTML=e,t&&t()):C.setTimeout(function(){n.html(e)}),this}}),ar=Mt.extend({init:function(e){this._super(e),this.classes.add("widget").add("infobox"),this.canFocus=!1},severity:function(e){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(e)},help:function(e){this.state.set("help",e)},renderHtml:function(){var e=this,t=e.classPrefix;return'<div id="'+e._id+'" class="'+e.classes+'"><div id="'+e._id+'-body">'+e.encode(e.state.get("text"))+'<button role="button" tabindex="-1"><i class="'+t+"ico "+t+'i-help"></i></button></div></div>'},bindStates:function(){var e=this;return e.state.on("change:text",function(t){e.getEl("body").firstChild.data=e.encode(t.value),e.state.get("rendered")&&e.updateLayoutRect()}),e.state.on("change:help",function(t){e.classes.toggle("has-help",t.value),e.state.get("rendered")&&e.updateLayoutRect()}),e._super()}}),lr=Mt.extend({init:function(e){var t=this;t._super(e),t.classes.add("widget").add("label"),t.canFocus=!1,e.multiline&&t.classes.add("autoscroll"),e.strong&&t.classes.add("strong")},initLayoutRect:function(){var e=this,t=e._super();return e.settings.multiline&&(we.getSize(e.getEl()).width>t.maxW&&(t.minW=t.maxW,e.classes.add("multiline")),e.getEl().style.width=t.minW+"px",t.startMinH=t.h=t.minH=Math.min(t.maxH,we.getSize(e.getEl()).height)),t},repaint:function(){return this.settings.multiline||(this.getEl().style.lineHeight=this.layoutRect().h+"px"),this._super()},severity:function(e){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(e)},renderHtml:function(){var e,t,n=this,i=n.settings.forId,r=n.settings.html?n.settings.html:n.encode(n.state.get("text"));return!i&&(t=n.settings.forName)&&(e=n.getRoot().find("#"+t)[0])&&(i=e._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 e=this;return e.state.on("change:text",function(t){e.innerHtml(e.encode(t.value)),e.state.get("rendered")&&e.updateLayoutRect()}),e._super()}}),ur=rt.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(e){this._super(e),this.classes.add("toolbar")},postRender:function(){return this.items().each(function(e){e.classes.add("toolbar-item")}),this._super()}}),cr=ur.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}}),dr=Ut.extend({init:function(e){var t=this;t._renderOpen=!0,t._super(e),e=t.settings,t.classes.add("menubtn"),e.fixedWidth&&t.classes.add("fixed-width"),t.aria("haspopup",!0),t.state.set("menu",e.menu||t.render())},showMenu:function(e){var t,n=this;if(n.menu&&n.menu.visible()&&!1!==e)return n.hideMenu();n.menu||(t=n.state.get("menu")||[],n.classes.add("opened"),t.length?t={type:"menu",animate:!0,items:t}:(t.type=t.type||"menu",t.animate=!0),t.renderTo?n.menu=t.parent(n).show().renderTo():n.menu=g.create(t).parent(n).renderTo(),n.fire("createmenu"),n.menu.reflow(),n.menu.on("cancel",function(e){e.control.parent()===n.menu&&(e.stopPropagation(),n.focus(),n.hideMenu())}),n.menu.on("select",function(){n.focus()}),n.menu.on("show hide",function(e){e.control===n.menu&&(n.activeMenu("show"===e.type),n.classes.toggle("opened","show"===e.type)),n.aria("expanded","show"===e.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(e){e.hideMenu&&e.hideMenu()}),this.menu.hide())},activeMenu:function(e){this.classes.toggle("active",e)},renderHtml:function(){var e,t=this,n=t._id,i=t.classPrefix,r=t.settings.icon,o=t.state.get("text"),s="";return(e=t.settings.image)?(r="none","string"!=typeof e&&(e=window.getSelection?e[0]:e[1]),e=" style=\"background-image: url('"+e+"')\""):e="",o&&(t.classes.add("btn-has-text"),s='<span class="'+i+'txt">'+t.encode(o)+"</span>"),r=t.settings.icon?i+"ico "+i+"i-"+r:"",t.aria("role",t.parent()instanceof cr?"menuitem":"button"),'<div id="'+n+'" class="'+t.classes+'" tabindex="-1" aria-labelledby="'+n+'"><button id="'+n+'-open" role="presentation" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+e+"></i>":"")+s+' <i class="'+i+'caret"></i></button></div>'},postRender:function(){var e=this;return e.on("click",function(t){t.control===e&&function(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1}(t.target,e.getEl())&&(e.focus(),e.showMenu(!t.aria),t.aria&&e.menu.items().filter(":visible")[0].focus())}),e.on("mouseenter",function(t){var n,i=t.control,r=e.parent();i&&r&&i instanceof dr&&i.parent()===r&&(r.items().filter("MenuButton").each(function(e){e.hideMenu&&e!==i&&(e.menu&&e.menu.visible()&&(n=!0),e.hideMenu())}),n&&(i.focus(),i.showMenu()))}),e._super()},bindStates:function(){var e=this;return e.state.on("change:menu",function(){e.menu&&e.menu.remove(),e.menu=null}),e._super()},remove:function(){this._super(),this.menu&&this.menu.remove()}}),fr=xt.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(e){if(e.autohide=!0,e.constrainToViewport=!0,"function"==typeof e.items&&(e.itemsFactory=e.items,e.items=[]),e.itemDefaults)for(var t=e.items,n=t.length;n--;)t[n]=a.extend({},e.itemDefaults,t[n]);this._super(e),this.classes.add("menu"),e.animate&&11!==_.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 e,t=this;function n(){t.throbber&&(t.throbber.hide(),t.throbber=null)}t.settings.itemsFactory&&(t.throbber||(t.throbber=new kt(t.getEl("body"),!0),0===t.items().length?(t.throbber.show(),t.fire("loading")):t.throbber.show(100,function(){t.items().remove(),t.fire("loading")}),t.on("hide close",n)),t.requestTime=e=(new Date).getTime(),t.settings.itemsFactory(function(i){0!==i.length?t.requestTime===e&&(t.getEl().style.width="",t.getEl("body").style.width="",n(),t.items().remove(),t.getEl("body").innerHTML="",t.add(i),t.renderNew(),t.fire("loaded")):t.hide()}))},hideAll:function(){return this.find("menuitem").exec("hideMenu"),this._super()},preRender:function(){var e=this;return e.items().each(function(t){var n=t.settings;if(n.icon||n.image||n.selectable)return e._hasIcons=!0,!1}),e.settings.itemsFactory&&e.on("postrender",function(){e.settings.itemsFactory&&e.load()}),e.on("show hide",function(t){t.control===e&&("show"===t.type?C.setTimeout(function(){e.classes.add("in")},0):e.classes.remove("in"))}),e._super()}}),hr=dr.extend({init:function(e){var t,n,i,r,o=this;o._super(e),e=o.settings,o._values=t=e.values,t&&("undefined"!=typeof e.value&&function s(t){for(var r=0;r<t.length;r++){if(n=t[r].selected||e.value===t[r].value)return i=i||t[r].text,o.state.set("value",t[r].value),!0;if(t[r].menu&&s(t[r].menu))return!0}}(t),!n&&t.length>0&&(i=t[0].text,o.state.set("value",t[0].value)),o.state.set("menu",t)),o.state.set("text",e.text||i),o.classes.add("listbox"),o.on("select",function(t){var n=t.control;r&&(t.lastControl=r),e.multiple?n.active(!n.active()):o.value(t.control.value()),r=n})},bindStates:function(){var e=this;return e.on("show",function(t){var n,i;n=t.control,i=e.value(),n instanceof fr&&n.items().each(function(e){e.hasMenus()||e.active(e.value()===i)})}),e.state.on("change:value",function(t){var n=function i(e,t){var n;if(e)for(var r=0;r<e.length;r++){if(e[r].value===t)return e[r];if(e[r].menu&&(n=i(e[r].menu,t)))return n}}(e.state.get("menu"),t.value);n?e.text(n.text):e.text(e.settings.text)}),e._super()}}),mr=Mt.extend({Defaults:{border:0,role:"menuitem"},init:function(e){var t,n=this;n._super(e),e=n.settings,n.classes.add("menu-item"),e.menu&&n.classes.add("menu-item-expand"),e.preview&&n.classes.add("menu-item-preview"),"-"!==(t=n.state.get("text"))&&"|"!==t||(n.classes.add("menu-item-sep"),n.aria("role","separator"),n.state.set("text","-")),e.selectable&&(n.aria("role","menuitemcheckbox"),n.classes.add("menu-item-checkbox"),e.icon="selected"),e.preview||e.selectable||n.classes.add("menu-item-normal"),n.on("mousedown",function(e){e.preventDefault()}),e.menu&&!e.ariaHideMenu&&n.aria("haspopup",!0)},hasMenus:function(){return!!this.settings.menu},showMenu:function(){var e,t=this,n=t.settings,i=t.parent();if(i.items().each(function(e){e!==t&&e.hideMenu()}),n.menu){(e=t.menu)?e.show():((e=n.menu).length?e={type:"menu",animate:!0,items:e}:(e.type=e.type||"menu",e.animate=!0),i.settings.itemDefaults&&(e.itemDefaults=i.settings.itemDefaults),(e=t.menu=g.create(e).parent(t).renderTo()).reflow(),e.on("cancel",function(n){n.stopPropagation(),t.focus(),e.hide()}),e.on("show hide",function(e){e.control.items&&e.control.items().each(function(e){e.active(e.settings.selected)})}).fire("show"),e.on("hide",function(n){n.control===e&&t.classes.remove("selected")}),e.submenu=!0),e._parentMenu=i,e.classes.add("menu-sub");var r=e.testMoveRel(t.getEl(),t.isRtl()?["tl-tr","bl-br","tr-tl","br-bl"]:["tr-tl","br-bl","tl-tr","bl-br"]);e.moveRel(t.getEl(),r),e.rel=r,r="menu-sub-"+r,e.classes.remove(e._lastRel).add(r),e._lastRel=r,t.classes.add("selected"),t.aria("expanded",!0)}},hideMenu:function(){var e=this;return e.menu&&(e.menu.items().each(function(e){e.hideMenu&&e.hideMenu()}),e.menu.hide(),e.aria("expanded",!1)),e},renderHtml:function(){var e,t=this,n=t._id,i=t.settings,r=t.classPrefix,o=t.state.get("text"),s=t.settings.icon,a="",l=i.shortcut,u=t.encode(i.url);function c(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d(e){var t=i.match||"";return t?e.replace(new RegExp(c(t),"gi"),function(e){return"!mce~match["+e+"]mce~match!"}):e}function f(e){return e.replace(new RegExp(c("!mce~match["),"g"),"<b>").replace(new RegExp(c("]mce~match!"),"g"),"</b>")}return s&&t.parent().classes.add("menu-has-icons"),i.image&&(a=" style=\"background-image: url('"+i.image+"')\""),l&&(l=function(e){var t,n,i={};for(i=_.mac?{alt:"&#x2325;",ctrl:"&#x2318;",shift:"&#x21E7;",meta:"&#x2318;"}:{meta:"Ctrl"},e=e.split("+"),t=0;t<e.length;t++)(n=i[e[t].toLowerCase()])&&(e[t]=n);return e.join("+")}(l)),s=r+"ico "+r+"i-"+(t.settings.icon||"none"),e="-"!==o?'<i class="'+s+'"'+a+"></i>\xa0":"",o=f(t.encode(d(o))),u=f(t.encode(d(u))),'<div id="'+n+'" class="'+t.classes+'" tabindex="-1">'+e+("-"!==o?'<span id="'+n+'-text" class="'+r+'text">'+o+"</span>":"")+(l?'<div id="'+n+'-shortcut" class="'+r+'menu-shortcut">'+l+"</div>":"")+(i.menu?'<div class="'+r+'caret"></div>':"")+(u?'<div class="'+r+'menu-item-link">'+u+"</div>":"")+"</div>"},postRender:function(){var e=this,t=e.settings,n=t.textStyle;if("function"==typeof n&&(n=n.call(this)),n){var i=e.getEl("text");i&&(i.setAttribute("style",n),e._textStyle=n)}return e.on("mouseenter click",function(n){n.control===e&&(t.menu||"click"!==n.type?(e.showMenu(),n.aria&&e.menu.focus(!0)):(e.fire("select"),C.requestAnimationFrame(function(){e.parent().hideAll()})))}),e._super(),e},hover:function(){return this.parent().items().each(function(e){e.classes.remove("selected")}),this.classes.toggle("selected",!0),this},active:function(e){return function(e,t){var n=e._textStyle;if(n){var i=e.getEl("text");i.setAttribute("style",n),t&&(i.style.color="",i.style.backgroundColor="")}}(this,e),void 0!==e&&this.aria("checked",e),this._super(e)},remove:function(){this._super(),this.menu&&this.menu.remove()}}),gr=jt.extend({Defaults:{classes:"radio",role:"radio"}}),pr=Mt.extend({renderHtml:function(){var e=this,t=e.classPrefix;return e.classes.add("resizehandle"),"both"===e.settings.direction&&e.classes.add("resizehandle-both"),e.canFocus=!1,'<div id="'+e._id+'" class="'+e.classes+'"><i class="'+t+"ico "+t+'i-resize"></i></div>'},postRender:function(){var e=this;e._super(),e.resizeDragHelper=new ct(this._id,{start:function(){e.fire("ResizeStart")},drag:function(t){"both"!==e.settings.direction&&(t.deltaX=0),e.fire("Resize",t)},stop:function(){e.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}});function vr(e){var t="";if(e)for(var n=0;n<e.length;n++)t+='<option value="'+e[n]+'">'+e[n]+"</option>";return t}var br=Mt.extend({Defaults:{classes:"selectbox",role:"selectbox",options:[]},init:function(e){var t=this;t._super(e),t.settings.size&&(t.size=t.settings.size),t.settings.options&&(t._options=t.settings.options),t.on("keydown",function(e){var n;13===e.keyCode&&(e.preventDefault(),t.parents().reverse().each(function(e){if(e.toJSON)return n=e,!1}),t.fire("submit",{data:n.toJSON()}))})},options:function(e){return arguments.length?(this.state.set("options",e),this):this.state.get("options")},renderHtml:function(){var e,t=this,n="";return e=vr(t._options),t.size&&(n=' size = "'+t.size+'"'),'<select id="'+t._id+'" class="'+t.classes+'"'+n+">"+e+"</select>"},bindStates:function(){var e=this;return e.state.on("change:options",function(t){e.getEl().innerHTML=vr(t.value)}),e._super()}});function yr(e,t,n){return e<t&&(e=t),e>n&&(e=n),e}function xr(e,t,n){e.setAttribute("aria-"+t,n)}function wr(e,t){var n,i,r,o,s;"v"===e.settings.orientation?(r="top",i="height",n="h"):(r="left",i="width",n="w"),s=e.getEl("handle"),o=((e.layoutRect()[n]||100)-we.getSize(s)[i])*((t-e._minValue)/(e._maxValue-e._minValue))+"px",s.style[r]=o,s.style.height=e.layoutRect().h+"px",xr(s,"valuenow",t),xr(s,"valuetext",""+e.settings.previewFilter(t)),xr(s,"valuemin",e._minValue),xr(s,"valuemax",e._maxValue)}var _r=Mt.extend({init:function(e){var t=this;e.previewFilter||(e.previewFilter=function(e){return Math.round(100*e)/100}),t._super(e),t.classes.add("slider"),"v"===e.orientation&&t.classes.add("vertical"),t._minValue=e.minValue||0,t._maxValue=e.maxValue||100,t._initValue=t.state.get("value")},renderHtml:function(){var e=this._id,t=this.classPrefix;return'<div id="'+e+'" class="'+this.classes+'"><div id="'+e+'-handle" class="'+t+'slider-handle" role="slider" tabindex="-1"></div></div>'},reset:function(){this.value(this._initValue).repaint()},postRender:function(){var e,t,n,i,r,o,s,a,l,u,c,d,f,h,m=this;e=m._minValue,t=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(e,t){function n(n){var i,r,o;i=yr(i=(((i=m.value())+(o=e))/(t-o)+.05*n)*(t-(r=e))-r,e,t),m.value(i),m.fire("dragstart",{value:i}),m.fire("drag",{value:i}),m.fire("dragend",{value:i})}m.on("keydown",function(e){switch(e.keyCode){case 37:case 38:n(-1);break;case 39:case 40:n(1)}})}(e,t),s=e,a=t,l=m.getEl("handle"),m._dragHelper=new ct(m._id,{handle:m._id+"-handle",start:function(e){u=e[n],c=parseInt(m.getEl("handle").style[i],10),d=(m.layoutRect()[o]||100)-we.getSize(l)[r],m.fire("dragstart",{value:h})},drag:function(e){var t=e[n]-u;f=yr(c+t,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(),wr(this,this.value())},bindStates:function(){var e=this;return e.state.on("change:value",function(t){wr(e,t.value)}),e._super()}}),Rr=Mt.extend({renderHtml:function(){return this.classes.add("spacer"),this.canFocus=!1,'<div id="'+this._id+'" class="'+this.classes+'"></div>'}}),Cr=dr.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var e,t,n=this.getEl(),i=this.layoutRect();return this._super(),e=n.firstChild,t=n.lastChild,ye(e).css({width:i.w-we.getSize(t).width,height:i.h-2}),ye(t).css({height:i.h-2}),this},activeMenu:function(e){ye(this.getEl().lastChild).toggleClass(this.classPrefix+"active",e)},renderHtml:function(){var e,t,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a=n.settings,l="";return(e=a.image)?(o="none","string"!=typeof e&&(e=window.getSelection?e[0]:e[1]),e=" style=\"background-image: url('"+e+"')\""):e="",o=a.icon?r+"ico "+r+"i-"+o:"",s&&(n.classes.add("btn-has-text"),l='<span class="'+r+'txt">'+n.encode(s)+"</span>"),t="boolean"==typeof a.active?' aria-pressed="'+a.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" role="button"'+t+' tabindex="-1"><button type="button" hidefocus="1" tabindex="-1">'+(o?'<i class="'+o+'"'+e+"></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 e=this.settings.onclick;return this.on("click",function(t){var n=t.target;if(t.control===this)for(;n;){if(t.aria&&"down"!==t.aria.key||"BUTTON"===n.nodeName&&-1===n.className.indexOf("open"))return t.stopImmediatePropagation(),void(e&&e.call(this,t));n=n.parentNode}}),delete this.settings.onclick,this._super()}}),kr=Mi.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"},isNative:function(){return!0}}),Er=ft.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(e){var t;this.activeTabId&&(t=this.getEl(this.activeTabId),ye(t).removeClass(this.classPrefix+"active"),t.setAttribute("aria-selected","false")),this.activeTabId="t"+e,(t=this.getEl("t"+e)).setAttribute("aria-selected","true"),ye(t).addClass(this.classPrefix+"active"),this.items()[e].show().fire("showtab"),this.reflow(),this.items().each(function(t,n){e!==n&&t.hide()})},renderHtml:function(){var e=this,t=e._layout,n="",i=e.classPrefix;return e.preRender(),t.preRender(e),e.items().each(function(t,r){var o=e._id+"-t"+r;t.aria("role","tabpanel"),t.aria("labelledby",o),n+='<div id="'+o+'" class="'+i+'tab" unselectable="on" role="tab" aria-controls="'+t._id+'" aria-selected="false" tabIndex="-1">'+e.encode(t.settings.title)+"</div>"}),'<div id="'+e._id+'" class="'+e.classes+'" hidefocus="1" tabindex="-1"><div id="'+e._id+'-head" class="'+i+'tabs" role="tablist">'+n+'</div><div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+t.renderHtml(e)+"</div></div>"},postRender:function(){var e=this;e._super(),e.settings.activeTab=e.settings.activeTab||0,e.activateTab(e.settings.activeTab),this.on("click",function(t){var n=t.target.parentNode;if(n&&n.id===e._id+"-head")for(var i=n.childNodes.length;i--;)n.childNodes[i]===t.target&&e.activateTab(i)})},initLayoutRect:function(){var e,t,n,i=this;t=(t=we.getSize(i.getEl("head")).width)<0?0:t,n=0,i.items().each(function(e){t=Math.max(t,e.layoutRect().minW),n=Math.max(n,e.layoutRect().minH)}),i.items().each(function(e){e.settings.x=0,e.settings.y=0,e.settings.w=t,e.settings.h=n,e.layoutRect({x:0,y:0,w:t,h:n})});var r=we.getSize(i.getEl("head")).height;return i.settings.minWidth=t,i.settings.minHeight=n+r,(e=i._super()).deltaH+=r,e.innerH=e.h-e.deltaH,e}}),Hr=Mt.extend({init:function(e){var t=this;t._super(e),t.classes.add("textbox"),e.multiline?t.classes.add("multiline"):(t.on("keydown",function(e){var n;13===e.keyCode&&(e.preventDefault(),t.parents().reverse().each(function(e){if(e.toJSON)return n=e,!1}),t.fire("submit",{data:n.toJSON()}))}),t.on("keyup",function(e){t.state.set("value",e.target.value)}))},repaint:function(){var e,t,n,i,r,o=this,s=0;e=o.getEl().style,t=o._layoutRect,r=o._lastRepaintRect||{};var a=document;return!o.settings.multiline&&a.all&&(!a.documentMode||a.documentMode<=8)&&(e.lineHeight=t.h-s+"px"),i=(n=o.borderBox).left+n.right+8,s=n.top+n.bottom+(o.settings.multiline?8:0),t.x!==r.x&&(e.left=t.x+"px",r.x=t.x),t.y!==r.y&&(e.top=t.y+"px",r.y=t.y),t.w!==r.w&&(e.width=t.w-i+"px",r.w=t.w),t.h!==r.h&&(e.height=t.h-s+"px",r.h=t.h),o._lastRepaintRect=r,o.fire("repaint",{},!1),o},renderHtml:function(){var e,t,n=this,i=n.settings;return e={id:n._id,hidefocus:"1"},a.each(["rows","spellcheck","maxLength","size","readonly","min","max","step","list","pattern","placeholder","required","multiple"],function(t){e[t]=i[t]}),n.disabled()&&(e.disabled="disabled"),i.subtype&&(e.type=i.subtype),(t=we.create(i.multiline?"textarea":"input",e)).value=n.state.get("value"),t.className=n.classes,t.outerHTML},value:function(e){return arguments.length?(this.state.set("value",e),this):(this.state.get("rendered")&&this.state.set("value",this.getEl().value),this.state.get("value"))},postRender:function(){var e=this;e.getEl().value=e.state.get("value"),e._super(),e.$el.on("change",function(t){e.state.set("value",t.target.value),e.fire("change",t)})},bindStates:function(){var e=this;return e.state.on("change:value",function(t){e.getEl().value!==t.value&&(e.getEl().value=t.value)}),e.state.on("change:disabled",function(t){e.getEl().disabled=t.value}),e._super()},remove:function(){this.$el.off(),this._super()}}),Sr=function(){return{Selector:Be,Collection:Le,ReflowQueue:qe,Control:et,Factory:g,KeyboardNavigation:nt,Container:rt,DragHelper:ct,Scrollable:dt,Panel:ft,Movable:Re,Resizable:ht,FloatPanel:xt,Window:zt,MessageBox:Lt,Tooltip:St,Widget:Mt,Progress:Tt,Notification:Wt,Layout:Ft,AbsoluteLayout:Vt,Button:Ut,ButtonGroup:$t,Checkbox:jt,ComboBox:Xt,ColorBox:Jt,PanelButton:Gt,ColorButton:Zt,ColorPicker:en,Path:nn,ElementPath:rn,FormItem:on,Form:sn,FieldSet:an,FilePicker:Ei,FitLayout:Hi,FlexLayout:Si,FlowLayout:Mi,FormatControls:rr,GridLayout:or,Iframe:sr,InfoBox:ar,Label:lr,Toolbar:ur,MenuBar:cr,MenuButton:dr,MenuItem:mr,Throbber:kt,Menu:fr,ListBox:hr,Radio:gr,ResizeHandle:pr,SelectBox:br,Slider:_r,Spacer:Rr,SplitButton:Cr,StackLayout:kr,TabPanel:Er,TextBox:Hr,DropZone:tn,BrowseButton:Yt}},Mr=function(e){e.ui?a.each(Sr(),function(t,n){e.ui[n]=t}):e.ui=Sr()};a.each(Sr(),function(e,t){g.add(t,e)}),Mr(window.tinymce?window.tinymce:{}),o.add("modern",function(e){return rr.setup(e),It(e)})}();