').css(n).appendTo(a)[0];return c.set(A.some({caret:i,element:e,before:t})),c.get().each(function(e){t&&pn(e.caret).addClass("mce-visual-caret-before")}),f(),(r=e.ownerDocument.createRange()).setStart(s,0),r.setEnd(s,0),r},hide:l,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;}"},reposition:function(){c.get().each(function(e){var t=xc(a,e.element,e.before);pn(e.caret).css(t)})},destroy:function(){return Le.clearInterval(t)}}},Nc=function(e){return Cc(e)||Do.isTable(e)&&cc()},Ec=Do.isContentEditableFalse,Sc=Do.matchStyleValues("display","block table table-cell table-caption list-item"),Tc=Aa,kc=Ta,Ac=ya.curry,_c=Do.isElement,Rc=ja,Dc=function(e){return 0=o.data.length-1)return 1===e&&(r=s(o))?zc(r):n;if(Oa(o)&&i<=1)return-1===e&&(r=u(o))?Vc(r):n;if(i===o.data.length)return(r=s(o))?zc(r):n;if(0===i)return(r=u(o))?Vc(r):n}return n},Hc=function(e,t){var n=Mc(e,t);return Ec(n)&&!Do.isBogusAll(n)},jc=function(e,t){return Do.isTable(Mc(e,t))},$c=function(e,t){return A.from(Mc(e?0:-1,t)).filter(Ec)},Wc=function(e,t,n){var r=qc(e,t,n);return-1===e?wu.fromRangeStart(r):wu.fromRangeEnd(r)},Kc=Ac(Hc,0),Xc=Ac(Hc,-1),Yc=Ac(jc,0),Gc=Ac(jc,-1),Jc=function(e){return Su.isTextPosition(e)?0===e.offset():ja(e.getNode())},Qc=function(e){if(Su.isTextPosition(e)){var t=e.container();return e.offset()===t.data.length}return ja(e.getNode(!0))},Zc=function(e,t){return!Su.isTextPosition(e)&&!Su.isTextPosition(t)&&e.getNode()===t.getNode(!0)},el=function(e,t,n){return e?!Zc(t,n)&&(r=t,!(!Su.isTextPosition(r)&&Do.isBr(r.getNode())))&&Qc(t)&&Jc(n):!Zc(n,t)&&Jc(t)&&Qc(n);var r},tl=function(e,t,n){var r=Ns(t);return A.from(e?r.next(n):r.prev(n))},nl=function(e,t){var n,r,o,i,a,u=e?t.firstChild:t.lastChild;return Do.isText(u)?A.some(Su(u,e?0:u.data.length)):u?ja(u)?A.some(e?Su.before(u):(a=u,Do.isBr(a)?Su.before(a):Su.after(a))):(r=t,o=u,i=(n=e)?Su.before(o):Su.after(o),tl(n,r,i)):A.none()},rl={fromPosition:tl,nextPosition:b(tl,!0),prevPosition:b(tl,!1),navigate:function(t,n,r){return tl(t,n,r).bind(function(e){return Ic(r,e,n)&&el(t,r,e)?tl(t,n,e):A.some(e)})},positionIn:nl,firstPositionIn:b(nl,!0),lastPositionIn:b(nl,!1)},ol=function(e,t){return!e.isBlock(t)||t.innerHTML||Re.ie||(t.innerHTML='
'),t},il=function(e,t){return rl.lastPositionIn(e).fold(function(){return!1},function(e){return t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0})},al=function(e,t,n){return!(!1!==t.hasChildNodes()||!Xu(e,t)||(o=n,i=(r=t).ownerDocument.createTextNode(wa),r.appendChild(i),o.setStart(i,0),o.setEnd(i,0),0));var r,o,i},ul=function(e,t,n,r){var o,i,a,u,s=n[t?"start":"end"],c=e.getRoot();if(s){for(a=s[0],i=c,o=s.length-1;1<=o;o--){if(u=i.childNodes,al(c,i,r))return!0;if(s[o]>u.length-1)return!!al(c,i,r)||il(i,r);i=u[s[o]]}3===i.nodeType&&(a=Math.min(s[0],i.nodeValue.length)),1===i.nodeType&&(a=Math.min(s[0],i.childNodes.length)),t?r.setStart(i,a):r.setEnd(i,a)}return!0},sl=function(e){return Do.isText(e)&&0=t.nodeValue.length&&e.splice(0,1),t=e[e.length-1],0===m&&0h.length-1?p=h.length-1:p<0&&(p=0),d=h[p]||g),l===d)return o(v([l]));for(n=e.findCommonAncestor(l,d),a=l;a;a=a.parentNode){if(a===d)return C(l,n,!0);if(a===n)break}for(a=d;a;a=a.parentNode){if(a===l)return C(d,n);if(a===n)break}r=y(l,n)||l,i=y(d,n)||d,C(l,r,!0),(s=b(r===l?r:r.nextSibling,"nextSibling",i===d?i.nextSibling:i)).length&&o(v(s)),C(d,i)}},Bl=(Es=sr.isText,Ss="text",Ts=function(e){return Es(e)?A.from(e.dom().nodeValue):A.none()},ks=Qn.detect().browser,{get:function(e){if(!Es(e))throw new Error("Can only get "+Ss+" value of a "+Ss+" node");return As(e).getOr("")},getOption:As=ks.isIE()&&10===ks.version.major?function(e){try{return Ts(e)}catch(Kw){return A.none()}}:Ts,set:function(e,t){if(!Es(e))throw new Error("Can only set raw "+Ss+" value of a "+Ss+" node");e.dom().nodeValue=t}}),Ol=function(e){return Bl.get(e)},Pl=function(r,o,i,a){return $r.parent(o).fold(function(){return"skipping"},function(e){return"br"===a||(n=o,sr.isText(n)&&"\ufeff"===Ol(n))?"skipping":(t=o,sr.isElement(t)&&Wi.has(t,oa())?"existing":Ku(o)?"caret":vl.isValid(r,i,a)&&vl.isValid(r,sr.name(e),i)?"valid":"invalid-child");var t,n})},Ll=undefined&&undefined.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o'))},Ql=function(n){$r.lastChild(n).each(function(t){$r.prevSibling(t).each(function(e){lo(n)&&mo(t)&&lo(e)&&Ri.remove(t)})})},Zl=Yt.makeMap;function ef(e){var u,s,c,l,f,d=[];return u=(e=e||{}).indent,s=Zl(e.indent_before||""),c=Zl(e.indent_after||""),l=$o.getEncodeFunc(e.entity_encoding||"raw",e.entities),f="html"===e.element_format,{start:function(e,t,n){var r,o,i,a;if(u&&s[e]&&0":" />",n&&u&&c[e]&&0"),u&&c[e]&&0")},comment:function(e){d.push("\x3c!--",e,"--\x3e")},pi:function(e,t){t?d.push("",e," ",l(t),"?>"):d.push("",e,"?>"),u&&d.push("\n")},doctype:function(e){d.push("",u?"\n":"")},reset:function(){d.length=0},getContent:function(){return d.join("").replace(/\n$/,"")}}}function tf(t,g){void 0===g&&(g=ni());var p=ef(t);return(t=t||{}).validate=!("validate"in t)||t.validate,{serialize:function(e){var f,d;d=t.validate,f={3:function(e){p.text(e.value,e.raw)},8:function(e){p.comment(e.value)},7:function(e){p.pi(e.name,e.value)},10:function(e){p.doctype(e.value)},4:function(e){p.cdata(e.value)},11:function(e){if(e=e.firstChild)for(;m(e),e=e.next;);}},p.reset();var m=function(e){var t,n,r,o,i,a,u,s,c,l=f[e.type];if(l)l(e);else{if(t=e.name,n=e.shortEnded,r=e.attributes,d&&r&&1|)$/," "):o("nextSibling")||(e=e.replace(/( | )(
|)$/," "))),e}(e)),n=o.parser,g=t.merge,r=tf({validate:o.settings.validate},o.schema),m='',s={content:e,format:"html",selection:!0,paste:t.paste},(s=o.fire("BeforeSetContent",s)).isDefaultPrevented())o.fire("SetContent",{content:s.content,format:"html",selection:!0,paste:t.paste});else{-1===(e=s.content).indexOf("{$caret}")&&(e+="{$caret}"),e=e.replace(/\{\$caret\}/,m);var b,y,C,x,w=(l=h.getRng()).startContainer||(l.parentElement?l.parentElement():null),N=o.getBody();w===N&&h.isCollapsed()&&v.isBlock(N.firstChild)&&(b=N.firstChild)&&!o.schema.getShortEndedElements()[b.nodeName]&&v.isEmpty(N.firstChild)&&((l=v.createRng()).setStart(N.firstChild,0),l.setEnd(N.firstChild,0),h.setRng(l)),h.isCollapsed()||(o.selection.setRng(rf(o.selection.getRng())),o.getDoc().execCommand("Delete",!1,null),C=(y=h.getRng()).startContainer,x=y.startOffset,3===C.nodeType&&y.collapsed&&("\xa0"===C.data[x]?(C.deleteData(x,1),/[\u00a0| ]$/.test(e)||(e+=" ")):"\xa0"===C.data[x-1]&&(C.deleteData(x-1,1),/[\u00a0| ]$/.test(e)||(e=" "+e))));var E,S,T,k={context:(i=h.getNode()).nodeName.toLowerCase(),data:t.data,insert:!0};if(u=n.parse(e,k),!0===t.paste&&$l(o.schema,u)&&Kl(v,i))return l=Wl(r,v,o.selection.getRng(),u),o.selection.setRng(l),void o.fire("SetContent",s);if(function(e){for(var t=e;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")}(u),"mce_marker"===(f=u.lastChild).attr("id"))for(f=(c=f).prev;f;f=f.walk(!0))if(3===f.type||!v.isBlock(f.name)){o.schema.isValidChild(f.parent.name,"span")&&f.parent.insert(c,f,"br"===f.name);break}if(o._selectionOverrides.showBlockCaretContainer(i),k.invalid){for(h.setContent(m),i=h.getNode(),a=o.getBody(),9===i.nodeType?i=f=a:f=i;f!==a;)f=(i=f).parentNode;e=i===a?a.innerHTML:v.getOuterHTML(i),e=r.serialize(n.parse(e.replace(//i,function(){return r.serialize(u)}))),i===a?v.setHTML(a,e):v.setOuterHTML(i,e)}else e=r.serialize(u),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)}}(o,e,i);!function(){if(g){var n=o.getBody(),r=new Yl(v);Yt.each(v.select("*[data-mce-fragment]"),function(e){for(var t=e.parentNode;t&&t!==n;t=t.parentNode)p[e.nodeName.toLowerCase()]&&r.compare(t,e)&&v.remove(e,!0)})}}(),function(e){var t,n,r;if(e){if(h.scrollIntoView(e),t=function(e){for(var t=o.getBody();e&&e!==t;e=e.parentNode)if("false"===o.dom.getContentEditable(e))return e;return null}(e))return v.remove(e),h.select(t);l=v.createRng(),(f=e.previousSibling)&&3===f.nodeType?(l.setStart(f,f.nodeValue.length),Re.ie||(d=e.nextSibling)&&3===d.nodeType&&(f.appendData(d.data),d.parentNode.removeChild(d))):(l.setStartBefore(e),l.setEndBefore(e)),n=v.getParent(e,v.isBlock),v.remove(e),n&&v.isEmpty(n)&&(o.$(n).empty(),l.setStart(n,0),l.setEnd(n,0),of(n)||n.getAttribute("data-mce-fragment")||!(r=function(e){var t=Su.fromRangeStart(e);if(t=Ns(o.getBody()).next(t))return t.toRange()}(l))?v.add(n,v.create("br",{"data-mce-bogus":"1"})):(l=r,v.remove(n))),h.setRng(l)}}(v.get("mce_marker")),E=o.getBody(),Yt.each(E.getElementsByTagName("*"),function(e){e.removeAttribute("data-mce-fragment")}),S=o.dom,T=o.selection.getStart(),A.from(S.getParent(T,"td,th")).map(er.fromDom).each(Ql),o.fire("SetContent",s),o.addVisual()}},uf=function(e,t){var n,r,o="string"!=typeof(n=t)?(r=Yt.extend({paste:n.paste,data:{paste:n.paste}},n),{content:n.content,details:r}):{content:n,details:{}};af(e,o.content,o.details)},sf=kr("sections","settings"),cf=Qn.detect().deviceType.isTouch(),lf=["lists","autolink","autosave"],ff={theme:"mobile"},df=function(e){var t=R(e)?e.join(" "):e,n=$(k(t)?t.split(" "):[],$n);return U(n,function(e){return 0Su.before(r).offset()?Su(t.container(),t.offset()-1):t;var n,r,o,i},id=function(e){return ja(e.previousSibling)?A.some((t=e.previousSibling,Do.isText(t)?Su(t,t.data.length):Su.after(t))):e.previousSibling?rl.lastPositionIn(e.previousSibling):A.none();var t},ad=function(e){return ja(e.nextSibling)?A.some((t=e.nextSibling,Do.isText(t)?Su(t,0):Su.before(t))):e.nextSibling?rl.firstPositionIn(e.nextSibling):A.none();var t},ud=function(r,o){return id(o).orThunk(function(){return ad(o)}).orThunk(function(){return e=r,t=o,n=Su.before(t.previousSibling?t.previousSibling:t.parentNode),rl.prevPosition(e,n).fold(function(){return rl.nextPosition(e,Su.after(t))},A.some);var e,t,n})},sd=function(n,r){return ad(r).orThunk(function(){return id(r)}).orThunk(function(){return e=n,t=r,rl.nextPosition(e,Su.after(t)).fold(function(){return rl.prevPosition(e,Su.before(t))},A.some);var e,t})},cd=function(e,t,n){return(r=e,o=t,i=n,r?sd(o,i):ud(o,i)).map(b(od,n));var r,o,i},ld=function(t,n,e){e.fold(function(){t.focus()},function(e){t.selection.setRng(e.toRange(),n)})},fd=function(e,t){return t&&e.schema.getBlockElements().hasOwnProperty(sr.name(t))},dd=function(e){if(Bf(e)){var t=er.fromHtml('
');return Ri.empty(e),Ti.append(e,t),A.some(Su.before(t.dom()))}return A.none()},md=function(t,n,e){var r,a,o,i=cd(n,t.getBody(),e.dom()),u=Zi.ancestor(e,b(fd,t),(r=t.getBody(),function(e){return e.dom()===r})),s=(a=e,o=i,ru([$r.prevSibling(a),$r.nextSibling(a),o],function(e,t,n){var r,o=e.dom(),i=t.dom();return Do.isText(o)&&Do.isText(i)?(r=o.data.length,o.appendData(i.data),Ri.remove(t),Ri.remove(a),n.container()===i?Su(o,r):n):(Ri.remove(a),n)}).orThunk(function(){return Ri.remove(a),o}));t.dom.isEmpty(t.getBody())?(t.setContent(""),t.selection.setCursorLocation()):u.bind(dd).fold(function(){ld(t,n,s)},function(e){ld(t,n,A.some(e))})},gd=function(a,u){var e,t,n,r,o;return(e=a.getBody(),t=u,n=a.selection.getRng(),r=qc(t?1:-1,e,n),o=Su.fromRangeStart(r),!1===t&&Xc(o)?A.some(ed.remove(o.getNode(!0))):t&&Kc(o)?A.some(ed.remove(o.getNode())):rd(e,t,o)).map(function(e){return e.fold((o=a,i=u,function(e){return o._selectionOverrides.hideFakeCaret(),md(o,i,er.fromDom(e)),!0}),(n=a,r=u,function(e){var t=r?Su.before(e):Su.after(e);return n.selection.setRng(t.toRange()),!0}),(t=a,function(e){return t.selection.setRng(e.toRange()),!0}));var t,n,r,o,i}).getOr(!1)},pd=function(e,t){var n,r=e.selection.getNode();return!!Do.isContentEditableFalse(r)&&(n=er.fromDom(e.getBody()),F(Ki(n,".mce-offscreen-selection"),Ri.remove),md(e,t,er.fromDom(e.selection.getNode())),Ef(e),!0)},hd=function(e,t){return e.selection.isCollapsed()?gd(e,t):pd(e,t)},vd=function(e){var t,n=function(e,t){for(;t&&t!==e;){if(Do.isContentEditableTrue(t)||Do.isContentEditableFalse(t))return t;t=t.parentNode}return null}(e.getBody(),e.selection.getNode());return Do.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(Su.before(t).toRange())),!0},bd=Do.isText,yd=function(e){return bd(e)&&e.data[0]===wa},Cd=function(e){return bd(e)&&e.data[e.data.length-1]===wa},xd=function(e){return e.ownerDocument.createTextNode(wa)},wd=function(e,t){return e?function(e){if(bd(e.previousSibling))return Cd(e.previousSibling)||e.previousSibling.appendData(wa),e.previousSibling;if(bd(e))return yd(e)||e.insertData(0,wa),e;var t=xd(e);return e.parentNode.insertBefore(t,e),t}(t):function(e){if(bd(e.nextSibling))return yd(e.nextSibling)||e.nextSibling.insertData(0,wa),e.nextSibling;if(bd(e))return Cd(e)||e.appendData(wa),e;var t=xd(e);return e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t}(t)},Nd=b(wd,!0),Ed=b(wd,!1),Sd=function(e,t){return Do.isText(e.container())?wd(t,e.container()):wd(t,e.getNode())},Td=function(e,t){var n=t.get();return n&&e.container()===n&&ka(n)},kd=function(n,e){return e.fold(function(e){os.remove(n.get());var t=Nd(e);return n.set(t),A.some(Su(t,t.length-1))},function(e){return rl.firstPositionIn(e).map(function(e){if(Td(e,n))return Su(n.get(),1);os.remove(n.get());var t=Sd(e,!0);return n.set(t),Su(t,1)})},function(e){return rl.lastPositionIn(e).map(function(e){if(Td(e,n))return Su(n.get(),n.get().length-1);os.remove(n.get());var t=Sd(e,!1);return n.set(t),Su(t,t.length-1)})},function(e){os.remove(n.get());var t=Ed(e);return n.set(t),A.some(Su(t,1))})},Ad=function(e,t){for(var n=0;no.childNodes.length-1&&(c=!1),Do.isDocument(o)&&(o=g,i=0),o===g){if(c&&(u=o.childNodes[0s.childNodes.length-1;s=s.childNodes[Math.min(u,s.childNodes.length-1)]||s,u=c&&3===s.nodeType?s.nodeValue.length:0}var l=i.getParent(s,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),s&&3===s.nodeType&&u>=s.nodeValue.length&&(function(e,t,n){for(var r,o=new oo(t,n),i=e.getNonEmptyElements();r=o.next();)if(i[r.nodeName.toLowerCase()]||0")},mceToggleVisualAid:function(){s.hasVisual=!s.hasVisual,s.addVisual()},mceReplaceContent:function(e,t,n){s.execCommand("mceInsertContent",!1,n.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(e,t,n){var r;"string"==typeof n&&(n={href:n}),r=o.getParent(i.getNode(),"a"),n.href=n.href.replace(" ","%20"),r&&n.href||a.remove("link"),n.href&&a.apply("link",n,r)},selectAll:function(){var e=o.getParent(i.getStart(),Do.isContentEditableTrue);if(e){var t=o.createRng();t.selectNodeContents(e),i.setRng(t)}},"delete":function(){Hm(s)},forwardDelete:function(){jm(s)},mceNewDocument:function(){s.setContent("")},InsertLineBreak:function(e,t,n){return mg(s,n),!0}});var p=function(n){return function(){var e=i.isCollapsed()?[o.getParent(i.getNode(),o.isBlock)]:i.getSelectedBlocks(),t=Mg(e,function(e){return!!a.matchNode(e,n)});return-1!==Fg(t,!0)}};e({JustifyLeft:p("alignleft"),JustifyCenter:p("aligncenter"),JustifyRight:p("alignright"),JustifyFull:p("alignjustify"),"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){return f(e)},mceBlockQuote:function(){return f("blockquote")},Outdent:function(){var e;if(n.inline_styles){if((e=o.getParent(i.getStart(),o.isBlock))&&0"),u))[o.length-1]=Yt.extend(o[o.length-1],{func:n,scope:r||i}),Yt.extend(o[0],{desc:i.translate(t),subpatterns:o.slice(1)})},o=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)},c=function(e){return e.func?e.func.call(e.scope):null};i.on("keyup keypress keydown",function(t){var e,n;((n=t).altKey||n.ctrlKey||n.metaKey||"keydown"===(e=t).type&&112<=e.keyCode&&e.keyCode<=123)&&!t.isDefaultPrevented()&&(ap(a,function(e){if(o(t,e))return r=e.subpatterns.slice(0),"keydown"===t.type&&c(e),!0}),o(t,r[0])&&(1===r.length&&"keydown"===t.type&&c(r[0]),r.shift()))}),this.add=function(e,n,r,o){var t;return"string"==typeof(t=r)?r=function(){i.execCommand(t,!1,null)}:Yt.isArray(t)&&(r=function(){i.execCommand(t[0],t[1],t[2])}),ap(up(Yt.trim(e.toLowerCase())),function(e){var t=s(e,n,r,o);a[t.id]=t}),!0},this.remove=function(e){var t=s(e);return!!a[t.id]&&(delete a[t.id],!0)}}var fp=function(e){var t=e!==undefined?e.dom():document;return A.from(t.activeElement).map(er.fromDom)},dp=function(e){var t=$r.owner(e).dom();return e.dom()===t.activeElement},mp=function(t){return fp($r.owner(t)).filter(function(e){return t.dom().contains(e.dom())})},gp=function(t,e){return(n=e,n.collapsed?A.from(eu(n.startContainer,n.startOffset)).map(er.fromDom):A.none()).bind(function(e){return bo(e)?A.some(e):!1===Fr.contains(t,e)?A.some(t):A.none()});var n},pp=function(t,e){gp(er.fromDom(t.getBody()),e).bind(function(e){return rl.firstPositionIn(e.dom())}).fold(function(){t.selection.normalize()},function(e){return t.selection.setRng(e.toRange())})},hp=function(e){if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},vp=function(e){var t,n=e.getBody();return n&&(t=er.fromDom(n),dp(t)||mp(t).isSome())},bp=function(e){return e.inline?vp(e):(t=e).iframeElement&&dp(er.fromDom(t.iframeElement));var t},yp=function(e){return e.editorManager.setActive(e)},Cp=function(e,t){e.removed||(t?yp(e):function(t){var e=t.selection,n=t.settings.content_editable,r=t.getBody(),o=e.getRng();t.quirks.refreshContentEditable();var i,a,u=(i=t,a=e.getNode(),i.dom.getParent(a,function(e){return"true"===i.dom.getContentEditable(e)}));if(t.$.contains(r,u))return hp(u),pp(t,o),yp(t);t.bookmark!==undefined&&!1===bp(t)&&Og(t).each(function(e){t.selection.setRng(e),o=e}),n||(Re.opera||hp(r),t.getWin().focus()),(Re.gecko||n)&&(hp(r),pp(t,o)),yp(t)}(e))},xp=bp,wp=function(e,t){return t.dom()[e]},Np=function(e,t){return parseInt(Sr(t,e),10)},Ep=b(wp,"clientWidth"),Sp=b(wp,"clientHeight"),Tp=b(Np,"margin-top"),kp=b(Np,"margin-left"),Ap=function(e,t,n){var r,o,i,a,u,s,c,l,f,d,m=er.fromDom(e.getBody()),g=e.inline?m:$r.documentElement(m),p=(r=e.inline,i=t,a=n,u=(o=g).dom().getBoundingClientRect(),{x:i-(r?u.left+o.dom().clientLeft+kp(o):0),y:a-(r?u.top+o.dom().clientTop+Tp(o):0)});return c=p.x,l=p.y,f=Ep(s=g),d=Sp(s),0<=c&&0<=l&&c<=f&&l<=d},_p=function(e){var t,n=e.inline?e.getBody():e.getContentAreaContainer();return(t=n,A.from(t).map(er.fromDom)).map(function(e){return Fr.contains($r.owner(e),e)}).getOr(!1)};function Rp(n){var t,o=[],i=function(){var e,t=n.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():{open:e=function(){throw new Error("Theme did not provide a NotificationManager implementation.")},close:e,reposition:e,getArgs:e}},a=function(){0i&&(u=n.pageX+r-i),n.pageY+o>a&&(s=n.pageY+o-a),t.style.width=r-u+"px",t.style.height=o-s+"px",v(e.clientX,e.clientY)}},o=Nh(c,e),u=c,i=function(){u.dragging&&s.fire("dragend"),Eh(u)},(s=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)})},Th=function(e){var n;Sh(e),(n=e).on("drop",function(e){var t="undefined"!=typeof e.clientX?n.getDoc().elementFromPoint(e.clientX,e.clientY):null;(yh(t)||yh(n.dom.getContentEditableParent(t)))&&e.preventDefault()})},kh=function(e){return jt.reduce(e,function(e,t){return e.concat(function(t){var e=function(e){return jt.map(e,function(e){return(e=Xa(e)).node=t,e})};if(Do.isElement(t))return e(t.getClientRects());if(Do.isText(t)){var n=t.ownerDocument.createRange();return n.setStart(t,0),n.setEnd(t,t.data.length),e(n.getClientRects())}}(t))},[])};(hh=ph||(ph={}))[hh.Up=-1]="Up",hh[hh.Down=1]="Down";var Ah=function(o,i,a,e,u,t){var n,s,c=0,l=[],r=function(e){var t,n,r;for(r=kh([e]),-1===o&&(r=r.reverse()),t=0;tt;var t}},Bh=function(n){return function(e){return t=n,e.line===t;var t}},Oh=Do.isContentEditableFalse,Ph=Pc,Lh=function(e,t){return Math.abs(e.left-t)},Ih=function(e,t){return Math.abs(e.right-t)},Mh=function(e,t){return e>=t.left&&e<=t.right},Fh=function(e,o){return jt.reduce(e,function(e,t){var n,r;return n=Math.min(Lh(e,o),Ih(e,o)),r=Math.min(Lh(t,o),Ih(t,o)),Mh(o,t)?t:Mh(o,e)?e:r===n&&Oh(t.node)?t:r=e.top&&n<=e.bottom});return(r=Fh(d,t))&&(r=Fh((u=e,l=function(t,e){var n;return n=jt.filter(kh([e]),function(e){return!t(e,s)}),c=c.concat(n),0===n.length},(c=[]).push(s=r),Uh(ph.Up,u,b(l,Ja),s.node),Uh(ph.Down,u,b(l,Qa),s.node),c),t))&&Nc(r.node)?(a=t,{node:(i=r).node,before:Lh(i,a)=(n=t).left&&r<=n.right&&o>=n.top&&o<=n.bottom);var n,r,o},!1)},qh=function(t){var e=Di(function(){if(!t.removed&&t.selection.getRng().collapsed){var e=ls(t,t.selection.getRng(),!1);t.selection.setRng(e)}},0);t.on("focus",function(){e.throttle()}),t.on("blur",function(){e.cancel()})},Hh={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 Re.mac?e.metaKey:e.ctrlKey&&!e.altKey}},jh=Do.isContentEditableTrue,$h=Do.isContentEditableFalse,Wh=Xc,Kh=Kc,Xh=function(e,t){for(var n=e.getBody();t&&t!==n;){if(jh(t)||$h(t))return t;t=t.parentNode}return null},Yh=function(g){var p,e,t,a=g.getBody(),o=wc(g.getBody(),function(e){return g.dom.isBlock(e)},function(){return xp(g)}),h="sel-"+g.dom.uniqueId(),u=function(e){e&&g.selection.setRng(e)},s=function(){return g.selection.getRng()},v=function(e,t,n,r){return void 0===r&&(r=!0),g.fire("ShowCaret",{target:t,direction:e,before:n}).isDefaultPrevented()?null:(r&&g.selection.scrollIntoView(t,-1===e),o.show(n,t))},b=function(e,t){return t=qc(e,a,t),-1===e?Su.fromRangeStart(t):Su.fromRangeEnd(t)},n=function(e){return Aa(e)||Oa(e)||Pa(e)},y=function(e){return n(e.startContainer)||n(e.endContainer)},c=function(e,t){var n,r,o,i,a,u,s,c,l,f,d=g.$,m=g.dom;if(!e)return null;if(e.collapsed){if(!y(e))if(!1===t){if(c=b(-1,e),Nc(c.getNode(!0)))return v(-1,c.getNode(!0),!1,!1);if(Nc(c.getNode()))return v(-1,c.getNode(),!c.isAtEnd(),!1)}else{if(c=b(1,e),Nc(c.getNode()))return v(1,c.getNode(),!c.isAtEnd(),!1);if(Nc(c.getNode(!0)))return v(1,c.getNode(!0),!1,!1)}return null}return i=e.startContainer,a=e.startOffset,u=e.endOffset,3===i.nodeType&&0===a&&$h(i.parentNode)&&(i=i.parentNode,a=m.nodeIndex(i),i=i.parentNode),1!==i.nodeType?null:(u===a+1&&(n=i.childNodes[a]),$h(n)?(l=f=n.cloneNode(!0),(s=g.fire("ObjectSelected",{target:n,targetClone:l})).isDefaultPrevented()?null:(r=na(er.fromDom(g.getBody()),"#"+h).fold(function(){return d([])},function(e){return d([e.dom()])}),l=s.targetClone,0===r.length&&(r=d('').attr("id",h)).appendTo(g.getBody()),e=g.dom.createRng(),l===f&&Re.ie?(r.empty().append('\xa0
').append(l),e.setStartAfter(r[0].firstChild.firstChild),e.setEndAfter(l)):(r.empty().append("\xa0").append(l).append("\xa0"),e.setStart(r[0].firstChild,1),e.setEnd(r[0].lastChild,0)),r.css({top:m.getPos(n,g.getBody()).y}),r[0].focus(),(o=g.selection.getSel()).removeAllRanges(),o.addRange(e),F(Ki(er.fromDom(g.getBody()),"*[data-mce-selected]"),function(e){hr.remove(e,"data-mce-selected")}),n.setAttribute("data-mce-selected","1"),p=n,C(),e)):null)},l=function(){p&&(p.removeAttribute("data-mce-selected"),na(er.fromDom(g.getBody()),"#"+h).each(Ri.remove),p=null),na(er.fromDom(g.getBody()),"#"+h).each(Ri.remove),p=null},C=function(){o.hide()};return Re.ceFalse&&(function(){g.on("mouseup",function(e){var t=s();t.collapsed&&Ap(g,e.clientX,e.clientY)&&u(cs(g,t,!1))}),g.on("click",function(e){var t;(t=Xh(g,e.target))&&($h(t)&&(e.preventDefault(),g.focus()),jh(t)&&g.dom.isChildOf(t,g.selection.getNode())&&l())}),g.on("blur NewBlock",function(){l()}),g.on("ResizeWindow FullscreenStateChanged",function(){return o.reposition()});var n,r,i=function(e,t){var n,r,o=g.dom.getParent(e,g.dom.isBlock),i=g.dom.getParent(t,g.dom.isBlock);return!(!o||!g.dom.isChildOf(o,i)||!1!==$h(Xh(g,o)))||o&&(n=o,r=i,!(g.dom.getParent(n,g.dom.isBlock)===g.dom.getParent(r,g.dom.isBlock)))&&function(e){var t=Ns(e);if(!e.firstChild)return!1;var n=Su.before(e.firstChild),r=t.next(n);return r&&!Kh(r)&&!Wh(r)}(o)};r=!1,(n=g).on("touchstart",function(){r=!1}),n.on("touchmove",function(){r=!0}),n.on("touchend",function(e){var t=Xh(n,e.target);$h(t)&&(r||(e.preventDefault(),c(ss(n,t))))}),g.on("mousedown",function(e){var t,n=e.target;if((n===a||"HTML"===n.nodeName||g.dom.isChildOf(n,a))&&!1!==Ap(g,e.clientX,e.clientY))if(t=Xh(g,n))$h(t)?(e.preventDefault(),c(ss(g,t))):(l(),jh(t)&&e.shiftKey||Vh(e.clientX,e.clientY,g.selection.getRng())||(C(),g.selection.placeCaretAt(e.clientX,e.clientY)));else if(!1===Nc(n)){l(),C();var r=zh(a,e.clientX,e.clientY);if(r&&!i(e.target,r.node)){e.preventDefault();var o=v(1,r.node,r.before,!1);g.getBody().focus(),u(o)}}}),g.on("keypress",function(e){Hh.modifierPressed(e)||(e.keyCode,$h(g.selection.getNode())&&e.preventDefault())}),g.on("getSelectionRange",function(e){var t=e.range;if(p){if(!p.parentNode)return void(p=null);(t=t.cloneRange()).selectNode(p),e.range=t}}),g.on("setSelectionRange",function(e){var t;(t=c(e.range,e.forward))&&(e.range=t)}),g.on("AfterSetSelectionRange",function(e){var t,n=e.range;y(n)||"mcepastebin"===n.startContainer.parentNode.id||C(),t=n.startContainer.parentNode,g.dom.hasClass(t,"mce-offscreen-selection")||l()}),g.on("copy",function(e){var t,n=e.clipboardData;if(!e.isDefaultPrevented()&&e.clipboardData&&!Re.ie){var r=(t=g.dom.get(h))?t.getElementsByTagName("*")[0]:t;r&&(e.preventDefault(),n.clearData(),n.setData("text/html",r.outerHTML),n.setData("text/plain",r.outerText))}}),Th(g),qh(g)}(),e=g.contentStyles,t=".mce-content-body",e.push(o.getCss()),e.push(t+" .mce-offscreen-selection {position: absolute;left: -9999999999px;max-width: 1000000px;}"+t+" *[contentEditable=false] {cursor: default;}"+t+" *[contentEditable=true] {cursor: text;}")),{showCaret:v,showBlockCaretContainer:function(e){e.hasAttribute("data-mce-caret")&&(La(e),u(s()),g.selection.scrollIntoView(e[0]))},hideFakeCaret:C,destroy:function(){o.destroy(),p=null}}},Gh=function(e,t,n){var r,o,i,a,u=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])u--;else if(!o[1]){if(o[2]in a)continue;u++}if(0===u)break}return r};function Jh(F,U){void 0===U&&(U=ni());var e=function(){};!1!==(F=F||{}).fix_self_closing&&(F.fix_self_closing=!0);var z=F.comment?F.comment:e,V=F.cdata?F.cdata:e,q=F.text?F.text:e,H=F.start?F.start:e,j=F.end?F.end:e,$=F.pi?F.pi:e,W=F.doctype?F.doctype:e;return{parse:function(e){var t,n,r,d,o,i,a,m,u,s,g,c,p,l,f,h,v,b,y,C,x,w,N,E,S,T,k,A,_,R=0,D=[],B=0,O=$o.decode,P=Yt.makeMap("src,href,data,background,formaction,poster,xlink:href"),L=/((java|vb)script|mhtml):/i,I=function(e){var t,n;for(t=D.length;t--&&D[t].name!==e;);if(0<=t){for(n=D.length-1;t<=n;n--)(e=D[n]).valid&&j(e.name);D.length=t}},M=function(e,t,n,r,o){var i,a,u,s,c;if(n=(t=t.toLowerCase())in g?t:O(n||r||o||""),p&&!m&&0==(0===(u=t).indexOf("data-")||0===u.indexOf("aria-"))){if(!(i=b[t])&&y){for(a=y.length;a--&&!(i=y[a]).pattern.test(t););-1===a&&(i=null)}if(!i)return;if(i.validValues&&!(n in i.validValues))return}if(P[t]&&!F.allow_script_urls){var l=n.replace(/[\s\u0000-\u001F]+/g,"");try{l=decodeURIComponent(l)}catch(f){l=unescape(l)}if(L.test(l))return;if(c=l,!(s=F).allow_html_data_urls&&(/^data:image\//i.test(c)?!1===s.allow_svg_data_urls&&/^data:image\/svg\+xml/i.test(c):/^data:/i.test(c)))return}m&&(t in P||0===t.indexOf("on"))||(d.map[t]=n,d.push({name:t,value:n}))};for(S=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"),T=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g,s=U.getShortEndedElements(),E=F.self_closing_elements||U.getSelfClosingElements(),g=U.getBoolAttrs(),p=F.validate,u=F.remove_internals,_=F.fix_self_closing,k=U.getSpecialElements(),N=e+">";t=S.exec(N);){if(Re.length){q(O(e.substr(t.index))),R=t.index+t[0].length;continue}if(":"===(n=n.toLowerCase()).charAt(0)&&(n=n.substr(1)),c=n in s,_&&E[n]&&0"===n.charAt(0)&&(n=" "+n),F.allow_conditional_comments||"[if"!==n.substr(0,3).toLowerCase()||(n=" "+n),z(n)):(n=t[2])?V(n.replace(//g,"")):(n=t[3])?W(n):(n=t[4])&&$(n,t[5]);R=t.index+t[0].length}for(R]*data-mce-bogus="all"[^>]*>/g,d=e.schema;for(u=e.getTempAttrs(),s=l,c=new RegExp(["\\s?("+u.join("|")+')="[^"]+"'].join("|"),"gi"),l=s.replace(c,""),a=d.getShortEndedElements();i=f.exec(l);)r=f.lastIndex,o=i[0].length,n=a[i[1]]?r:Qh.findEndTag(d,l,r),l=l.substring(0,r-o)+l.substring(n),f.lastIndex=r-o;return Na(l)},ev={trimExternal:Zh,trimInternal:Zh},tv=0,nv=2,rv=1,ov=function(g,p){var e=g.length+p.length+2,h=new Array(e),v=new Array(e),c=function(e,t,n,r,o){var i=l(e,t,n,r);if(null===i||i.start===t&&i.diag===t-r||i.end===e&&i.diag===e-n)for(var a=e,u=n;a")?gv(r):pv(t)},yv=function(e,t,n){"fragmented"===t.type?sv(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw"}),e.selection.moveToBookmark(n?t.beforeBookmark:t.bookmark)},Cv=function(e,t){return!(!e||!t)&&(r=t,hv(e)===hv(r)||(n=t,vv(e)===vv(n)));var n,r};function xv(u){var s,r,o=this,c=0,l=[],t=0,f=function(){return 0===t},i=function(e){f()&&(o.typing=e)},d=function(e){u.setDirty(e)},a=function(e){i(!1),o.add({},e)},n=function(){o.typing&&(i(!1),o.add())};return u.on("init",function(){o.add()}),u.on("BeforeExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t&&(n(),o.beforeChange())}),u.on("ExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t&&a(e)}),u.on("ObjectResizeStart Cut",function(){o.beforeChange()}),u.on("SaveContent ObjectResized blur",a),u.on("DragEnd",a),u.on("KeyUp",function(e){var t=e.keyCode;e.isDefaultPrevented()||((33<=t&&t<=36||37<=t&&t<=40||45===t||e.ctrlKey)&&(a(),u.nodeChanged()),46!==t&&8!==t||u.nodeChanged(),r&&o.typing&&!1===Cv(bv(u),l[0])&&(!1===u.isDirty()&&(d(!0),u.fire("change",{level:l[0],lastLevel:null})),u.fire("TypingUndo"),r=!1,u.nodeChanged()))}),u.on("KeyDown",function(e){var t=e.keyCode;if(!e.isDefaultPrevented())if(33<=t&&t<=36||37<=t&&t<=40||45===t)o.typing&&a(e);else{var n=e.ctrlKey&&!e.altKey||e.metaKey;!(t<16||20i.custom_undo_redo_levels){for(n=0;n
").append(n.childNodes)}))},$v[wv="pre"]||($v[wv]=[]),$v[wv].push(Nv);var Xv=function(e,t){Kv($v[e],function(e){e(t)})},Yv=/^(src|href|style)$/,Gv=Yt.each,Jv=vl.isEq,Qv=function(e){return/^(TH|TD)$/.test(e.nodeName)},Zv=function(e,t,n){var r,o,i;return r=t[n?"startContainer":"endContainer"],o=t[n?"startOffset":"endOffset"],Do.isElement(r)&&(i=r.childNodes.length-1,!n&&o&&o--,r=r.childNodes[i=r.nodeValue.length&&(r=new oo(r,e.getBody()).next()||r),Do.isText(r)&&!n&&0===o&&(r=new oo(r,e.getBody()).prev()||r),r},eb=function(e,t,n,r){var o=e.create(n,r);return t.parentNode.insertBefore(o,t),o.appendChild(t),o},tb=function(e,t,n,r){return!(t=vl.getNonWhiteSpaceSibling(t,n,r))||"BR"===t.nodeName||e.isBlock(t)},nb=function(e,n,r,o,i){var t,a,u,s,c,l,f,d,m,g,p,h,v,b,y=e.dom;if(c=y,!(Jv(l=o,(f=n).inline)||Jv(l,f.block)||(f.selector?Do.isElement(l)&&c.is(l,f.selector):void 0)||(s=o,n.links&&"A"===s.tagName)))return!1;if("all"!==n.remove)for(Gv(n.styles,function(e,t){e=vl.normalizeStyleValue(y,vl.replaceVars(e,r),t),"number"==typeof t&&(t=e,i=0),(n.remove_similar||!i||Jv(vl.getStyle(y,i,t),e))&&y.setStyle(o,t,""),u=1}),u&&""===y.getAttrib(o,"style")&&(o.removeAttribute("style"),o.removeAttribute("data-mce-style")),Gv(n.attributes,function(e,t){var n;if(e=vl.replaceVars(e,r),"number"==typeof t&&(t=e,i=0),!i||Jv(y.getAttrib(i,t),e)){if("class"===t&&(e=y.getAttrib(o,t))&&(n="",Gv(e.split(/\s+/),function(e){/mce\-\w+/.test(e)&&(n+=(n?" ":"")+e)}),n))return void y.setAttrib(o,t,n);"class"===t&&o.removeAttribute("className"),Yv.test(t)&&o.removeAttribute("data-mce-"+t),o.removeAttribute(t)}}),Gv(n.classes,function(e){e=vl.replaceVars(e,r),i&&!y.hasClass(i,e)||y.removeClass(o,e)}),a=y.getAttribs(o),t=0;t)\s*/g,"$1"),Yt.map(e.split(/(?:>|\s+(?![^\[\]]+\]))/),function(e){var t=Yt.map(e.split(/(?:~\+|~|\+)/),_b),n=t.pop();return t.length&&(n.siblings=t),n}).reverse()):[]},Db=function(n,e){var t,r,o,i,a,u,s="";if(!1===(u=n.settings.preview_styles))return"";"string"!=typeof u&&(u="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 e){if(!(e=n.formatter.get(e)))return;e=e[0]}return"preview"in e&&!1===(u=e.preview)?"":(t=e.block||e.inline||"span",(i=Rb(e.selector)).length?(i[0].name||(i[0].name=t),t=e.selector,r=Ab(i,n)):r=Ab([t],n),o=kb.select(t,r)[0]||r.firstChild,Tb(e.styles,function(e,t){(e=c(e))&&kb.setStyle(o,t,e)}),Tb(e.attributes,function(e,t){(e=c(e))&&kb.setAttrib(o,t,e)}),Tb(e.classes,function(e){e=c(e),kb.hasClass(o,e)||kb.addClass(o,e)}),n.fire("PreviewFormats"),kb.setStyles(r,{position:"absolute",left:-65535}),n.getBody().appendChild(r),a=kb.getStyle(n.getBody(),"fontSize",!0),a=/px$/.test(a)?parseInt(a,10):0,Tb(u.split(" "),function(e){var t=kb.getStyle(o,e,!0);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=kb.getStyle(n.getBody(),e,!0),"#ffffff"===kb.toHex(t).toLowerCase())||"color"===e&&"#000000"===kb.toHex(t).toLowerCase())){if("font-size"===e&&/em|%$/.test(t)){if(0===a)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*a+"px"}"border"===e&&t&&(s+="padding:0 2px;"),s+=e+":"+t+";"}}),n.fire("AfterPreviewFormats"),kb.remove(r),s)},Bb=function(e,t,n,r,o){var i=t.get(n);!Rv.match(e,n,r,o)||"toggle"in i[0]&&!i[0].toggle?wb.applyFormat(e,n,r,o):ob(e,n,r,o)},Ob=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"])};function Pb(e){var t,n,r,o=(t=e,n={},(r=function(e,t){e&&("string"!=typeof e?Yt.each(e,function(e,t){r(t,e)}):(t=t.length?t:[t],Yt.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))})(Sb.get(t.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=Bi(null);return Ob(e),Hv(e),{get:o.get,register:o.register,unregister:o.unregister,apply:b(wb.applyFormat,e),remove:b(ob,e),toggle:b(Bb,e,o),match:b(Rv.match,e),matchAll:b(Rv.matchAll,e),matchNode:b(Rv.matchNode,e),canApply:b(Rv.canApply,e),formatChanged:b(Eb,e,i),getCssText:b(Db,e)}}var Lb,Ib=Object.prototype.hasOwnProperty,Mb=(Lb=function(e,t){return t},function(){for(var e=new Array(arguments.length),t=0;t)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")};i--;)r=(n=e[i]).firstChild?n.firstChild.value:"","script"===t?((o=n.attr("type"))&&n.attr("type","mce-no/type"===o?null:o.replace(/^mce\-/,"")),"xhtml"===s.element_format&&0")):"xhtml"===s.element_format&&0k(n)?(C=A(y*b),y=A(C/b)):(y=A(C/b),C=A(y*b))),N.setStyles(D(s),{width:y,height:C}),r=0<(r=f.startPos.x+t)?r:0,o=0<(o=f.startPos.y+n)?o:0,N.setStyles(c,{left:r,top:o,display:"block"}),c.innerHTML=y+" × "+C,f[2]<0&&s.clientWidth<=y&&N.setStyle(s,"left",g+(h-y)),f[3]<0&&s.clientHeight<=C&&N.setStyle(s,"top",p+(v-C)),(t=_.scrollWidth-x)+(n=_.scrollHeight-w)!=0&&N.setStyles(c,{left:r-t,top:o-n}),i||(Yg(a,u,h,v),i=!0)},P=function(){i=!1;var e=function(e,t){t&&(u.style[e]||!a.schema.isValid(u.nodeName.toLowerCase(),e)?N.setStyle(D(u),e,t):N.setAttrib(D(u),e,t))};e("width",y),e("height",C),N.unbind(S,"mousemove",O),N.unbind(S,"mouseup",P),T!==S&&(N.unbind(T,"mousemove",O),N.unbind(T,"mouseup",P)),N.remove(s),N.remove(c),o(u),Gg(a,u,y,C),N.setAttrib(u,"style",N.getAttrib(u,"style")),a.nodeChanged()},o=function(e){var t,r,o,n,i;L(),F(),t=N.getPos(e,_),g=t.x,p=t.y,i=e.getBoundingClientRect(),r=i.width||i.right-i.left,o=i.height||i.bottom-i.top,u!==e&&(u=e,y=C=0),n=a.fire("ObjectSelected",{target:e}),B(e)&&!n.isDefaultPrevented()?E(l,function(n,e){var t;(t=N.get("mceResizeHandle"+e))&&N.remove(t),t=N.add(_,"div",{id:"mceResizeHandle"+e,"data-mce-bogus":"all","class":"mce-resizehandle",unselectable:!0,style:"cursor:"+e+"-resize; margin:0; padding:0"}),11===Re.ie&&(t.contentEditable=!1),N.bind(t,"mousedown",function(e){var t;e.stopImmediatePropagation(),e.preventDefault(),d=(t=e).screenX,m=t.screenY,h=D(u).clientWidth,v=D(u).clientHeight,b=v/h,(f=n).startPos={x:r*n[0]+g,y:o*n[1]+p},x=_.scrollWidth,w=_.scrollHeight,s=u.cloneNode(!0),N.addClass(s,"mce-clonedresizable"),N.setAttrib(s,"data-mce-bogus","all"),s.contentEditable=!1,s.unSelectabe=!0,N.setStyles(s,{left:g,top:p,margin:0}),s.removeAttribute("data-mce-selected"),_.appendChild(s),N.bind(S,"mousemove",O),N.bind(S,"mouseup",P),T!==S&&(N.bind(T,"mousemove",O),N.bind(T,"mouseup",P)),c=N.add(_,"div",{"class":"mce-resize-helper","data-mce-bogus":"all"},h+" × "+v)}),n.elm=t,N.setStyles(t,{left:r*n[0]+g-t.offsetWidth/2,top:o*n[1]+p-t.offsetHeight/2})}):L(),u.setAttribute("data-mce-selected","1")},L=function(){var e,t;for(e in F(),u&&u.removeAttribute("data-mce-selected"),l)(t=N.get("mceResizeHandle"+e))&&(N.unbind(t),N.remove(t))},I=function(e){var t,n=function(e,t){if(e)do{if(e===t)return!0}while(e=e.parentNode)};i||a.removed||(E(N.select("img[data-mce-selected],hr[data-mce-selected]"),function(e){e.removeAttribute("data-mce-selected")}),t="mousedown"===e.type?e.target:r.getNode(),n(t=N.$(t).closest("table,img,figure.image,hr")[0],_)&&(U(),n(r.getStart(!0),t)&&n(r.getEnd(!0),t))?o(t):L())},M=function(e){return fy(function(e,t){for(;t&&t!==e;){if(dy(t)||fy(t))return t;t=t.parentNode}return null}(a.getBody(),e))},F=function(){for(var e in l){var t=l[e];t.elm&&(N.unbind(t.elm),delete t.elm)}},U=function(){try{a.getDoc().execCommand("enableObjectResizing",!1,!1)}catch(e){}};return a.on("init",function(){U(),Re.ie&&11<=Re.ie&&(a.on("mousedown click",function(e){var t=e.target,n=t.nodeName;i||!/^(TABLE|IMG|HR)$/.test(n)||M(t)||(2!==e.button&&a.selection.select(t,"TABLE"===n),"mousedown"===e.type&&a.nodeChanged())}),a.dom.bind(_,"mscontrolselect",function(e){var t=function(e){Le.setEditorTimeout(a,function(){a.selection.select(e)})};if(M(e.target))return e.preventDefault(),void t(e.target);/^(TABLE|IMG|HR)$/.test(e.target.nodeName)&&(e.preventDefault(),"IMG"===e.target.tagName&&t(e.target))}));var t=Le.throttle(function(e){a.composing||I(e)});a.on("nodechange ResizeEditor ResizeWindow drop FullscreenStateChanged",t),a.on("keyup compositionend",function(e){u&&"TABLE"===u.nodeName&&t(e)}),a.on("hide blur",L),a.on("contextmenu",n)}),a.on("remove",F),{isResizable:B,showResizeRect:o,hideResizeRect:L,updateResizeRect:I,destroy:function(){u=s=null}}},gy=function(e){return Do.isContentEditableTrue(e)||Do.isContentEditableFalse(e)},py=function(e,t,n){var r,o,i,a,u,s=n;if(s.caretPositionFromPoint)(o=s.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(s.body.createTextRange){r=s.body.createTextRange();try{r.moveToPoint(e,t),r.collapse(!0)}catch(c){r=function(e,n,t){var r,o,i;if(r=t.elementFromPoint(e,n),o=t.body.createTextRange(),r&&"HTML"!==r.tagName||(r=t.body),o.moveToElementText(r),0<(i=(i=Yt.toArray(o.getClientRects())).sort(function(e,t){return(e=Math.abs(Math.max(e.top-n,e.bottom-n)))-(t=Math.abs(Math.max(t.top-n,t.bottom-n)))})).length){n=(i[0].bottom+i[0].top)/2;try{return o.moveToPoint(e,n),o.collapse(!0),o}catch(a){}}return null}(e,t,n)}return i=r,a=n.body,u=i&&i.parentElement?i.parentElement():null,Do.isContentEditableFalse(function(e,t,n){for(;e&&e!==t;){if(n(e))return e;e=e.parentNode}return null}(u,a,gy))?null:i}return r},hy=function(n,e){return $(e,function(e){var t=n.fire("GetSelectionRange",{range:e});return t.range!==e?t.range:e})},vy=function(e,t){var n=(t||document).createDocumentFragment();return F(e,function(e){n.appendChild(e.dom())}),er.fromDom(n)},by=kr("element","width","rows"),yy=kr("element","cells"),Cy=kr("x","y"),xy=function(e,t){var n=parseInt(hr.get(e,t),10);return isNaN(n)?1:n},wy=function(e){return z(e,function(e,t){return t.cells().length>e?t.cells().length:e},0)},Ny=function(e,t){for(var n=e.rows(),r=0;r"+(r.item?r.item(0).outerHTML:r.htmlText),o.removeChild(o.firstChild)):o.innerHTML=r.toString(),t.getInner=!0;var u=e.selection.serializer.serialize(o,t);return"tree"===t.format?u:(t.content=e.selection.isCollapsed()?"":u,e.fire("GetContent",t),t.content)},Ly=function(e,t,n){var r,o,i,a=e.selection.getRng(),u=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+='_',a.startContainer===u&&a.endContainer===u?u.body.innerHTML=t:(a.deleteContents(),0===u.body.childNodes.length?u.body.innerHTML=t:a.createContextualFragment?a.insertNode(a.createContextualFragment(t)):(o=u.createDocumentFragment(),i=u.createElement("div"),o.appendChild(i),i.outerHTML=t,a.insertNode(o))),r=e.dom.get("__caret"),(a=u.createRange()).setStartBefore(r),a.setEndBefore(r),e.selection.setRng(a),e.dom.remove("__caret");try{e.selection.setRng(a)}catch(s){}}else a.item&&(u.execCommand("Delete",!1,null),a=e.getRng()),/^\s+/.test(t)?(a.pasteHTML('_'+t),e.dom.remove("__mce_tmp")):a.pasteHTML(t);n.no_events||e.fire("SetContent",n)}else e.fire("SetContent",n)},Iy=function(e,t,n,r,o){var i=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return A.from(i).map(er.fromDom).map(function(e){return r&&t.collapsed?e:$r.child(e,o(e,a)).getOr(e)}).bind(function(e){return sr.isElement(e)?A.some(e):$r.parent(e)}).map(function(e){return e.dom()}).getOr(e)},My=function(e,t,n){return Iy(e,t,!0,n,function(e,t){return Math.min($r.childNodesCount(e),t)})},Fy=function(e,t,n){return Iy(e,t,!1,n,function(e,t){return 0t.clientHeight){e=t;break}t=t.parentNode}return e},scrollIntoView:function(e,t){return js(c,e,t)},placeCaretAt:function(e,t){return i(py(e,t,c.getDoc()))},getBoundingClientRect:function(){var e=m();return e.collapsed?Su.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:function(){s=l=f=null,t.destroy()}};return n=ly(p),t=my(p,c),p.bookmarkManager=n,p.controlSelection=t,p},jy=Do.isContentEditableFalse,$y=Za,Wy=Xc,Ky=Kc,Xy=function(e,t){for(;t=e(t);)if(t.isVisible())return t;return t},Yy=function(e,t,n,r){var o,i,a,u,s,c,l=e===Nu.Forwards,f=l?Ky:Wy;return!r.collapsed&&(o=$y(r),jy(o))?us(e,t,o,e===Nu.Backwards,!0):(u=Ta(r.startContainer),f(i=Wc(e,t.getBody(),r))?ss(t,i.getNode(!l)):(i=n(i))?f(i)?us(e,t,i.getNode(!l),l,!0):f(a=n(i))&&(!(c=Ic(s=i,a))&&Do.isBr(s.getNode())||c)?us(e,t,a.getNode(!l),l,!0):u?ls(t,i.toRange(),!0):null:u?r:null)},Gy=function(e,t,n,r){var o,i,a,u,s,c,l,f,d;if(d=$y(r),o=Wc(e,t.getBody(),r),i=n(t.getBody(),Dh(1),o),a=jt.filter(i,Bh(1)),s=jt.last(o.getClientRects()),(Ky(o)||Yc(o))&&(d=o.getNode()),(Wy(o)||Gc(o))&&(d=o.getNode(!0)),!s)return null;if(c=s.left,(u=Fh(a,c))&&jy(u.node))return l=Math.abs(c-u.left),f=Math.abs(c-u.right),us(e,t,u.node,l'),o=a,1===t?e.$(r).after(o):e.$(r).before(o),e.selection.select(o,!0),e.selection.collapse())}},Qy=function(l,f){return function(){var e,t,n,r,o,i,a,u,s,c=(t=f,r=Ns((e=l).getBody()),o=ya.curry(Xy,r.next),i=ya.curry(Xy,r.prev),a=t?Nu.Forwards:Nu.Backwards,u=t?o:i,s=e.selection.getRng(),(n=Yy(a,e,u,s))?n:(n=Jy(e,a,s))||null);return!!c&&(l.selection.setRng(c),!0)}},Zy=function(u,s){return function(){var e,t,n,r,o,i,a=(r=(t=s)?1:-1,o=t?Rh:_h,i=(e=u).selection.getRng(),(n=Gy(r,e,o,i))?n:(n=Jy(e,r,i))||null);return!!a&&(u.selection.setRng(a),!0)}},eC=function(e,r){return G($(e,function(e){return Mb({shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0,action:v},e)}),function(e){return t=e,(n=r).keyCode===t.keyCode&&n.shiftKey===t.shiftKey&&n.altKey===t.altKey&&n.ctrlKey===t.ctrlKey&&n.metaKey===t.metaKey?[e]:[];var t,n})},tC=function(e){for(var t=[],n=1;n'},xC=function(e,t){return e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t},wC=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)},NC=function(e,t,n){return!1===Do.isText(t)?n:e?1===n&&t.data.charAt(n-1)===wa?0:n:n===t.data.length-1&&t.data.charAt(n)===wa?t.data.length:n},EC=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},SC=function(e,t){var n=ec(e);n&&n.toLowerCase()===t.tagName.toLowerCase()&&e.dom.setAttribs(t,tc(e))},TC=function(a,e){var t,u,s,i,c,n,r,o,l,f,d,m,g,p,h,v,b,y,C=a.dom,x=a.schema,w=x.getNonEmptyElements(),N=a.selection.getRng(),E=function(e){var t,n,r,o=s,i=x.getTextInlineElements();if(e||"TABLE"===f||"HR"===f?(t=C.create(e||m),SC(a,t)):t=c.cloneNode(!1),r=t,!1===oc(a))C.setAttrib(t,"style",null),C.setAttrib(t,"class",null);else do{if(i[o.nodeName]){if(Ku(o))continue;n=o.cloneNode(!1),C.setAttrib(n,"id",""),t.hasChildNodes()?n.appendChild(t.firstChild):r=n,t.appendChild(n)}}while((o=o.parentNode)&&o!==u);return CC(r),t},S=function(e){var t,n,r,o;if(o=NC(e,s,i),Do.isText(s)&&(e?0s.childNodes.length-1,s=s.childNodes[Math.min(i,s.childNodes.length-1)]||s,i=g&&Do.isText(s)?s.nodeValue.length:0),(u=EC(C,s))&&((m&&!n||!m&&n)&&(s=function(e,t,n,r,o){var i,a,u,s,c,l,f,d=t||"P",m=e.dom,g=EC(m,r);if(!(a=m.getParent(r,m.isBlock))||!wC(m,a)){if(l=(a=a||g)===e.getBody()||(f=a)&&/^(TD|TH|CAPTION)$/.test(f.nodeName)?a.nodeName.toLowerCase():a.parentNode.nodeName.toLowerCase(),!a.hasChildNodes())return i=m.create(d),SC(e,i),a.appendChild(i),n.setStart(i,0),n.setEnd(i,0),i;for(s=r;s.parentNode!==a;)s=s.parentNode;for(;s&&!m.isBlock(s);)s=(u=s).previousSibling;if(u&&e.schema.isValidChild(l,d.toLowerCase())){for(i=m.create(d),SC(e,i),u.parentNode.insertBefore(i,u),s=u;s&&!m.isBlock(s);)c=s.nextSibling,i.appendChild(s),s=c;n.setStart(r,o),n.setEnd(r,o)}}return r}(a,m,N,s,i)),c=C.getParent(s,C.isBlock),l=c?C.getParent(c.parentNode,C.isBlock):null,f=c?c.nodeName.toUpperCase():"","LI"!==(d=l?l.nodeName.toUpperCase():"")||e.ctrlKey||(l=(c=l).parentNode,f=d),/^(LI|DT|DD)$/.test(f)&&C.isEmpty(c)?yC(a,E,l,c,m):m&&c===a.getBody()||(m=m||"P",Ta(c)?(r=La(c),C.isEmpty(c)&&CC(c),lC(a,r)):S()?T():S(!0)?(r=c.parentNode.insertBefore(E(),c),lC(a,xC(c,"HR")?r:c)):((t=(b=N,y=b.cloneRange(),y.setStart(b.startContainer,NC(!0,b.startContainer,b.startOffset)),y.setEnd(b.endContainer,NC(!1,b.endContainer,b.endOffset)),y).cloneRange()).setEndAfter(c),function(e){for(;Do.isText(e)&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;);}(o=t.extractContents()),r=o.firstChild,C.insertAfter(o,c),function(e,t,n){var r,o=n,i=[];if(o){for(;o=o.firstChild;){if(e.isBlock(o))return;Do.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===Yt.trim(Na(a.innerText||a.textContent)).length&&e.remove(o);var a}}(C,w,r),p=C,(h=c).normalize(),(v=h.lastChild)&&!/^(left|right)$/gi.test(p.getStyle(v,"float",!0))||p.add(h,"br"),C.isEmpty(c)&&CC(c),r.normalize(),C.isEmpty(r)?(C.remove(r),T()):lC(a,r)),C.setAttrib(r,"id",""),a.fire("NewBlock",{newBlock:r})))},kC=function(e,t){return dC(e).filter(function(e){return 0",Ys(f)!==f.documentBaseUrl&&(g+=''),g+='',d=Gs(f),m=Js(f),Qs(f)&&(g+=''),g+='