Vergleich jscripts/sceditor/jquery.sceditor.min.js - 1.8.0 - 1.8.33

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
/* SCEditor v1.4.5 | (C) 2011-2013, Sam Clarke | sceditor.com/license */
!function(a,b,c){"use strict";var d={html:'<!DOCTYPE html><html><head><style>.ie * {min-height: auto !important}</style><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true" {spellcheck}></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="link">{url}</label> <input type="text" id="image" value="http://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" value="http://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" value="http://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="{id}" frameborder="0" allowfullscreen></iframe>'},e=function(b,c,e){var f=d[b];return a.each(c,function(a,b){f=f.replace(new RegExp("\\{"+a+"\\}","g"),b)}),e&&(f=a(f)),f};a.sceditor=function(d,f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb=a.sceditor.ie,kb=jb&&11>jb,lb=this,mb=d.get?d.get(0):d,nb=a(mb),ob=[],pb=[],qb=[],rb=[],sb={},tb=[];lb.commands=a.extend(!0,{},f.commands||a.sceditor.commands),lb.opts=f=a.extend({},a.sceditor.defaultOptions,f),A=function(){nb.data("sceditor",lb),a.each(f,function(b,c){a.isPlainObject(c)&&(f[b]=a.extend(!0,{},c))}),f.locale&&"en"!==f.locale&&G(),g=a('<div class="sceditor-container" />').insertAfter(nb).css("z-index",f.zIndex),jb&&g.addClass("ie ie"+jb),y=!!nb.attr("required"),nb.removeAttr("required"),F(),M(),H(),E(),K(),I(),J(),a.sceditor.isWysiwygSupported||lb.toggleSourceMode(),Z();var d=function(){a(b).unbind("load",d),f.autofocus&&cb(),f.autoExpand&&lb.expandToContent(),X(),t.call("ready")};a(b).load(d),c.readyState&&"complete"===c.readyState&&d()},F=function(){var b=f.plugins;b=b?b.toString().split(","):[],t=new a.sceditor.PluginManager(lb),a.each(b,function(b,c){t.register(a.trim(c))})},G=function(){var b;q=a.sceditor.locale[f.locale],q||(b=f.locale.split("-"),q=a.sceditor.locale[b[0]]),q&&q.dateFormat&&(f.dateFormat=q.dateFormat)},E=function(){var c,d;m=a("<textarea></textarea>").hide(),i=a('<iframe frameborder="0"></iframe>'),f.spellcheck||m.attr("spellcheck","false"),"https:"===b.location.protocol&&i.attr("src","javascript:false"),g.append(i).append(m),j=i[0],n=m[0],lb.dimensions(f.width||nb.width(),f.height||nb.height()),c=N(),c.open(),c.write(e("html",{spellcheck:f.spellcheck?"":'spellcheck="false"',charset:f.charset,style:f.style})),c.close(),l=a(c),k=a(c.body),lb.readOnly(!!f.readOnly),jb&&l.find("html").addClass("ie ie"+jb),(a.sceditor.ios||jb)&&(k.height("100%"),jb||k.bind("touchend",lb.focus)),r=new a.sceditor.rangeHelper(j.contentWindow),lb.val(nb.hide().val()),d=nb.attr("tabindex"),m.attr("tabindex",d),i.attr("tabindex",d)},I=function(){f.autoUpdate&&(k.bind("blur",lb.updateOriginal),m.bind("blur",lb.updateOriginal)),null===f.rtl&&(f.rtl="rtl"===m.css("direction")),lb.rtl(!!f.rtl),f.autoExpand&&l.bind("keyup",lb.expandToContent),f.resizeEnabled&&L(),g.attr("id",f.id),lb.emoticons(f.emoticonsEnabled)},J=function(){a(c).click(W),a(mb.form).bind("reset",T).submit(lb.updateOriginal),a(b).bind("resize orientationChanged",X),k.keypress(S).keydown(Q).keydown(R).keyup(_).bind("blur",hb).keyup(ib).bind("paste",O).bind(jb?"selectionchange":"keyup focus blur contextmenu mouseup touchend click",ab).bind("keydown keyup keypress focus blur contextmenu",V),f.emoticonsCompat&&b.getSelection&&k.keyup(eb),m.bind("blur",hb).keyup(ib).bind("keydown keyup keypress focus blur contextmenu",V).keydown(Q),l.mousedown(U).bind("blur",hb).bind(jb?"selectionchange":"focus blur contextmenu mouseup click",ab).bind("beforedeactivate keyup",D).keyup(_).focus(function(){p=null}),g.bind("selectionchanged",bb).bind("selectionchanged",Z).bind("selectionchanged valuechanged nodechanged",V)},H=function(){var b,c,d,i=lb.commands,j=(f.toolbarExclude||"").split(","),k=f.toolbar.split("|");h=a('<div class="sceditor-toolbar" unselectable="on" />'),a.each(k,function(f,g){b=a('<div class="sceditor-group" />'),a.each(g.split(","),function(f,g){!i[g]||a.inArray(g,j)>-1||(d=i[g].shortcut?" ("+i[g].shortcut+")":"",c=e("toolbarButton",{name:g,dispName:lb._(i[g].tooltip||g)+d},!0),c.data("sceditor-txtmode",!!i[g].txtExec),c.data("sceditor-wysiwygmode",!!i[g].exec),c.click(function(){var b=a(this);return b.hasClass("disabled")||C(b,i[g]),Z(),!1}),i[g].tooltip&&c.attr("title",lb._(i[g].tooltip)),i[g].exec||c.addClass("disabled"),i[g].shortcut&&(lb.addShortcut(i[g].shortcut,g),c.attr("title",c.attr("title")+d)),b.append(c))}),b[0].firstChild&&h.append(b)}),a(f.toolbarContainer||g).append(h)},K=function(){a.each(lb.commands,function(b,c){c.keyPress&&ob.push(c.keyPress),c.forceNewLineAfter&&a.isArray(c.forceNewLineAfter)&&(qb=a.merge(qb,c.forceNewLineAfter)),c.state?rb.push({name:b,state:c.state}):"string"==typeof c.exec&&rb.push({name:b,state:c.exec})}),_()},L=function(){var d,e,h,i,j,k,l=a('<div class="sceditor-grip" />'),m=a('<div class="sceditor-resize-cover" />'),n=0,o=0,p=0,q=0,r=g.width(),s=g.height(),t=!1,u=lb.rtl();d=f.resizeMinHeight||s/1.5,e=f.resizeMaxHeight||2.5*s,h=f.resizeMinWidth||r/1.25,i=f.resizeMaxWidth||1.25*r,j=function(a){"touchmove"===a.type&&(a=b.event);var c=q+(a.pageY-o),j=u?p-(a.pageX-n):p+(a.pageX-n);i>0&&j>i&&(j=i),e>0&&c>e&&(c=e),(!f.resizeWidth||h>j||i>0&&j>i)&&(j=!1),(!f.resizeHeight||d>c||e>0&&c>e)&&(c=!1),(j||c)&&(lb.dimensions(j,c),7>jb&&g.height(c)),a.preventDefault()},k=function(b){t&&(t=!1,m.hide(),g.removeClass("resizing").height("auto"),a(c).unbind("touchmove mousemove",j),a(c).unbind("touchend mouseup",k),b.preventDefault())},g.append(l),g.append(m.hide()),l.bind("touchstart mousedown",function(d){"touchstart"===d.type&&(d=b.event),n=d.pageX,o=d.pageY,p=g.width(),q=g.height(),t=!0,g.addClass("resizing"),m.show(),a(c).bind("touchmove mousemove",j),a(c).bind("touchend mouseup",k),7>jb&&g.height(q),d.preventDefault()})},M=function(){var b,d=f.emoticons,e=f.emoticonsRoot;a.isPlainObject(d)&&f.emoticonsEnabled&&a.each(d,function(f,g){a.each(g,function(a,g){e&&(g={url:e+(g.url||g),tooltip:g.tooltip||a},d[f][a]=g),b=c.createElement("img"),b.src=g.url||g,pb.push(b)})})},cb=function(){var b,c,d,e=l[0],h=k[0],i=!!f.autofocusEnd;if(g.is(":visible")){if(lb.sourceMode())d=n.value.length,n.setSelectionRange?n.setSelectionRange(d,d):n.createTextRange&&(b=n.createTextRange(),b.moveEnd("character",d),b.moveStart("character",d),r.selectRange(b));else{if(a.sceditor.dom.removeWhiteSpace(h),i)for((c=h.lastChild)||k.append(c=e.createElement("div"));c.lastChild;)c=c.lastChild,/br/i.test(c.nodeName)&&c.previousSibling&&(c=c.previousSibling);else c=h.firstChild;e.createRange?(b=e.createRange(),/br/i.test(c.nodeName)?b.setStartBefore(c):b.selectNodeContents(c),b.collapse(!1)):(b=h.createTextRange(),b.moveToElementText(3!==c.nodeType?c:c.parentNode),b.collapse(!1)),r.selectRange(b),i&&(l.scrollTop(h.scrollHeight),k.scrollTop(h.scrollHeight))}lb.focus()}},lb.readOnly=function(a){return"boolean"!=typeof a?"readonly"===m.attr("readonly"):(k[0].contentEditable=!a,a?m.attr("readonly","readonly"):m.removeAttr("readonly"),Y(a),this)},lb.rtl=function(a){var b=a?"rtl":"ltr";return"boolean"!=typeof a?"rtl"===m.attr("dir"):(k.attr("dir",b),m.attr("dir",b),g.removeClass("rtl").removeClass("ltr").addClass(b),this)},Y=function(b){var c=lb.inSourceMode();h.find(".sceditor-button").removeClass("disabled").each(function(){var d=a(this);b===!0||c&&!d.data("sceditor-txtmode")?d.addClass("disabled"):c||d.data("sceditor-wysiwygmode")||d.addClass("disabled")})},lb.width=function(a,b){return a||0===a?(lb.dimensions(a,null,b),this):g.width()},lb.dimensions=function(b,d,e){var j=8>jb||c.documentMode<8?2:0;return b=b||0===b?b:!1,d=d||0===d?d:!1,b===!1&&d===!1?{width:lb.width(),height:lb.height()}:("undefined"==typeof i.data("outerWidthOffset")&&lb.updateStyleCache(),b!==!1&&(e!==!1&&(f.width=b),d===!1&&(d=g.height(),e=!1),g.width(b),b&&b.toString().indexOf("%")>-1&&(b=g.width()),i.width(b-i.data("outerWidthOffset")),m.width(b-m.data("outerWidthOffset")),a.sceditor.ios&&k&&k.width(b-i.data("outerWidthOffset")-(k.outerWidth(!0)-k.width()))),d!==!1&&(e!==!1&&(f.height=d),d&&d.toString().indexOf("%")>-1&&(d=g.height(d).height(),g.height("auto")),d-=f.toolbarContainer?0:h.outerHeight(!0),i.height(d-i.data("outerHeightOffset")),m.height(d-j-m.data("outerHeightOffset"))),this)},lb.updateStyleCache=function(){i.data("outerWidthOffset",i.outerWidth(!0)-i.width()),m.data("outerWidthOffset",m.outerWidth(!0)-m.width()),i.data("outerHeightOffset",i.outerHeight(!0)-i.height()),m.data("outerHeightOffset",m.outerHeight(!0)-m.height())},lb.height=function(a,b){return a||0===a?(lb.dimensions(null,a,b),this):g.height()},lb.maximize=function(b){return"undefined"==typeof b?g.is(".sceditor-maximize"):(b=!!b,7>jb&&a("html, body").toggleClass("sceditor-maximize",b),g.toggleClass("sceditor-maximize",b),lb.width(b?"100%":f.width,!1),lb.height(b?"100%":f.height,!1),this)},lb.expandToContent=function(a){var b=g.height(),c=k[0].scrollHeight||l[0].documentElement.scrollHeight,d=b-i.height(),e=f.resizeMaxHeight||2*(f.height||nb.height());c+=d,a!==!0&&c>e&&(c=e),c>b&&lb.height(c)},lb.destroy=function(){t&&(t.destroy(),r=null,p=null,t=null,a(c).unbind("click",W),a(b).unbind("resize orientationChanged",X),a(mb.form).unbind("reset",T).unbind("submit",lb.updateOriginal),k.unbind(),l.unbind().find("*").remove(),m.unbind().remove(),h.remove(),g.unbind().find("*").unbind().remove(),g.remove(),nb.removeData("sceditor").removeData("sceditorbbcode").show(),y&&nb.attr("required","required"))},lb.createDropDown=function(b,c,d,e){var g,h=o&&o.is(".sceditor-"+c);lb.closeDropDown(),h||(e!==!1&&a(d).find(":not(input,textarea)").filter(function(){return 1===this.nodeType}).attr("unselectable","on"),g={top:b.offset().top,left:b.offset().left,marginTop:b.outerHeight()},a.extend(g,f.dropDownCss),o=a('<div class="sceditor-dropdown sceditor-'+c+'" />').css(g).append(d).appendTo(a("body")).on("click focusin",function(a){a.stopPropagation()}))},W=function(a){3!==a.which&&lb.closeDropDown()},O=function(a){var b,d,e,g=k[0],h=l[0],i=0,j=c.createElement("div"),m=h.createDocumentFragment();if(f.disablePasting)return!1;if(f.enablePasteFiltering){if(r.saveRange(),c.body.appendChild(j),a&&a.clipboardData&&a.clipboardData.getData&&((b=a.clipboardData.getData("text/html"))||(b=a.clipboardData.getData("text/plain"))))return j.innerHTML=b,P(g,j),!1;for(e=k.scrollTop()||l.scrollTop();g.firstChild;)m.appendChild(g.firstChild);return d=function(a,b){if(a.childNodes.length>0||i>25){for(;a.firstChild;)b.appendChild(a.firstChild);for(;m.firstChild;)a.appendChild(m.firstChild);k.scrollTop(e),l.scrollTop(e),b.childNodes.length>0?P(a,b):r.restoreRange()}else i++,setTimeout(function(){d(a,b)},20)},d(g,j),lb.focus(),!0}},P=function(b,c){a.sceditor.dom.fixNesting(c);var d=c.innerHTML;t.hasHandler("toSource")&&(d=t.callOnlyFirst("toSource",d,a(c))),c.parentNode.removeChild(c),t.hasHandler("toWysiwyg")&&(d=t.callOnlyFirst("toWysiwyg",d,!0)),r.restoreRange(),lb.wysiwygEditorInsertHtml(d,null,!0)},lb.closeDropDown=function(a){o&&(o.unbind().remove(),o=null),a===!0&&lb.focus()},N=function(){return j.contentDocument?j.contentDocument:j.contentWindow&&j.contentWindow.document?j.contentWindow.document:j.document?j.document:null},lb.wysiwygEditorInsertHtml=function(b,c,d){var e,f,g,h=i.height();lb.focus(),(d||!a(v).is("code")&&0===a(v).parents("code").length)&&(r.insertHTML(b,c),r.saveRange(),B(k[0]),e=k.find("#sceditor-end-marker").show(),f=k.scrollTop()||l.scrollTop(),g=a.sceditor.dom.getOffset(e[0]).top+1.5*e.outerHeight(!0)-h,e.hide(),(g>f||f>g+h)&&(k.scrollTop(g),l.scrollTop(g)),gb(!1),r.restoreRange(),_())},lb.wysiwygEditorInsertText=function(b,c){lb.wysiwygEditorInsertHtml(a.sceditor.escapeEntities(b),a.sceditor.escapeEntities(c))},lb.insertText=function(a,b){return lb.inSourceMode()?lb.sourceEditorInsertText(a,b):lb.wysiwygEditorInsertText(a,b),this},lb.sourceEditorInsertText=function(a,b){var d,e,f,g,h;h=n.scrollTop,n.focus(),"undefined"!=typeof n.selectionStart?(e=n.selectionStart,f=n.selectionEnd,g=a.length,b&&(a+=n.value.substring(e,f)+b),n.value=n.value.substring(0,e)+a+n.value.substring(f,n.value.length),n.selectionStart=e+a.length-(b?b.length:0),n.selectionEnd=n.selectionStart):"undefined"!=typeof c.selection.createRange?(d=c.selection.createRange(),b&&(a+=d.text+b),d.text=a,b&&d.moveEnd("character",0-b.length),d.moveStart("character",d.End-d.Start),d.select()):n.value+=a+b,n.scrollTop=h,n.focus(),gb()},lb.getRangeHelper=function(){return r},lb.sourceEditorCaret=function(a){var b={};return"undefined"!=typeof n.selectionStart?a?(n.selectionStart=a.start,n.selectionEnd=a.end):(b.start=n.selectionStart,b.end=n.selectionEnd):(range=c.selection.createRange(),a?(range.moveStart("character",a.start),range.moveEnd("character",a.end),range.select()):(b.start=range.Start,b.end=range.End)),a?this:b},lb.val=function(a,b){return"string"==typeof a?(lb.inSourceMode()?lb.setSourceEditorValue(a):(b!==!1&&t.hasHandler("toWysiwyg")&&(a=t.callOnlyFirst("toWysiwyg",a)),lb.setWysiwygEditorValue(a)),this):lb.inSourceMode()?lb.getSourceEditorValue(!1):lb.getWysiwygEditorValue()},lb.insert=function(b,c,d,e,f){if(lb.inSourceMode())lb.sourceEditorInsertText(b,c);else{if(c){var g=lb.getRangeHelper().selectedHtml(),h=a("<div>").appendTo(a("body")).hide().html(g);d!==!1&&t.hasHandler("toSource")&&(g=t.callOnlyFirst("toSource",g,h)),h.remove(),b+=g+c}d!==!1&&t.hasHandler("toWysiwyg")&&(b=t.callOnlyFirst("toWysiwyg",b,!0)),d!==!1&&f===!0&&(b=b.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")),lb.wysiwygEditorInsertHtml(b)}return this},lb.getWysiwygEditorValue=function(b){var c,d,e=r.hasSelection();return e?r.saveRange():p&&p.getBookmark&&(d=p.getBookmark()),a.sceditor.dom.fixNesting(k[0]),c=k.html(),b!==!1&&t.hasHandler("toSource")&&(c=t.callOnlyFirst("toSource",c,k)),e?(r.restoreRange(),p=null):d&&(p.moveToBookmark(d),p=null),c},lb.getBody=function(){return k},lb.getContentAreaContainer=function(){return i},lb.getSourceEditorValue=function(a){var b=m.val();return a!==!1&&t.hasHandler("toWysiwyg")&&(b=t.callOnlyFirst("toWysiwyg",b)),b},lb.setWysiwygEditorValue=function(a){a||(a="<p>"+(jb?"":"<br />")+"</p>"),k[0].innerHTML=a,B(k[0]),_(),gb()},lb.setSourceEditorValue=function(a){m.val(a),gb()},lb.updateOriginal=function(){nb.val(lb.val())},B=function(b){if(f.emoticonsEnabled&&!a(b).parents("code").length){var c=b.ownerDocument,d=[],g=[],h=a.extend({},f.emoticons.more,f.emoticons.dropdown,f.emoticons.hidden);a.each(h,function(b){f.emoticonsCompat&&(g[b]=new RegExp("(>|^|\\s| | | | |&nbsp;)"+a.sceditor.regexEscape(b)+"(\\s|$|<| | | | |&nbsp;)")),d.push(b)}),function i(b){for(b=b.firstChild;null!=b;){var j,k,l,m,n,o,p,q=b.parentNode,r=b.nodeValue;if(3!==b.nodeType)a(b).is("code")||i(b);else if(r)for(n=d.length;n--;)k=d[n],p=f.emoticonsCompat?r.search(g[k]):r.indexOf(k),p>-1&&(o=b.nextSibling,l=h[k],j=r.substr(p).split(k),r=r.substr(0,p)+j.shift(),b.nodeValue=r,m=a.sceditor.dom.parseHTML(e("emoticon",{key:k,url:l.url||l,tooltip:l.tooltip||k}),c),q.insertBefore(m[0],o),q.insertBefore(c.createTextNode(j.join(k)),o));b=b.nextSibling}}(b),f.emoticonsCompat&&(tb=k.find("img[data-sceditor-emoticon]"))}},lb.inSourceMode=function(){return g.hasClass("sourceMode")},lb.sourceMode=function(a){return"boolean"!=typeof a?lb.inSourceMode():((lb.inSourceMode()&&!a||!lb.inSourceMode()&&a)&&lb.toggleSourceMode(),this)},lb.toggleSourceMode=function(){(a.sceditor.isWysiwygSupported||!lb.inSourceMode())&&(lb.blur(),lb.inSourceMode()?lb.setWysiwygEditorValue(lb.getSourceEditorValue()):lb.setSourceEditorValue(lb.getWysiwygEditorValue()),p=null,m.toggle(),i.toggle(),lb.inSourceMode()?g.removeClass("sourceMode").addClass("wysiwygMode"):g.removeClass("wysiwygMode").addClass("sourceMode"),Y(),Z())},$=function(){return n.focus(),null!=n.selectionStart?n.value.substring(n.selectionStart,n.selectionEnd):c.selection.createRange?c.selection.createRange().text:void 0},C=function(b,c){return lb.inSourceMode()?void(c.txtExec&&(a.isArray(c.txtExec)?lb.sourceEditorInsertText.apply(lb,c.txtExec):c.txtExec.call(lb,b,$()))):void(c.exec&&(a.isFunction(c.exec)?c.exec.call(lb,b):lb.execCommand(c.exec,c.hasOwnProperty("execParam")?c.execParam:null)))},D=function(){jb&&(p=r.selectedRange())},lb.execCommand=function(b,c){var d=!1,e=a(r.parentNode());if(lb.focus(),!e.is("code")&&0===e.parents("code").length){try{d=l[0].execCommand(b,!1,c)}catch(f){}!d&&lb.commands[b]&&lb.commands[b].errorMessage&&alert(lb._(lb.commands[b].errorMessage))}},ab=function(){var b=function(){r&&!r.compare(w)&&(w=r.cloneSelected(),g.trigger(a.Event("selectionchanged"))),x=!1};x||(x=!0,jb?b():setTimeout(b,100))},bb=function(){var b,c=r.parentNode();u!==c&&(b=u,u=c,v=r.getFirstBlockParent(c),g.trigger(a.Event("nodechanged",{oldNode:b,newNode:u})))},lb.currentNode=function(){return u},lb.currentBlockNode=function(){return v},Z=function(a){var b,c,d,e,f,g=l[0],i=rb.length,j=lb.sourceMode();if(lb.sourceMode()||lb.readOnly())h.find(".sceditor-button").removeClass("active");else for(f=a?a.newNode:r.parentNode(),d=r.getFirstBlockParent(f);i--;)if(b=0,c=rb[i],e=h.find(".sceditor-button-"+c.name),j&&!e.data("sceditor-txtmode"))e.addClass("disabled");else if(j||e.data("sceditor-wysiwygmode")){if("string"==typeof c.state)try{b=g.queryCommandEnabled(c.state)?0:-1,b>-1&&(b=g.queryCommandState(c.state)?1:0)}catch(k){}else b=c.state.call(lb,f,d);0>b?e.addClass("disabled"):e.removeClass("disabled"),b>0?e.addClass("active"):e.removeClass("active")}else e.addClass("disabled")},S=function(b){var c,d;if(!b.originalEvent.defaultPrevented){if(lb.closeDropDown(),c=a(u),13===b.which&&(c.is("code,blockquote,pre")||0!==c.parents("code,blockquote,pre").length))return p=null,lb.wysiwygEditorInsertHtml("<br />",null,!0),!1;if(!c.is("code")&&0===c.parents("code").length)for(d=ob.length;d--;)ob[d].call(lb,b,j,m)}},_=function(){var b,c,d;a.sceditor.dom.rTraverse(k[0],function(e){return b=e.nodeName.toLowerCase(),a.inArray(b,qb)>-1&&(c=!0),3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||"br"===b||kb&&!e.firstChild&&!a.sceditor.dom.isInline(e,!1)?(c&&(d=k[0].ownerDocument.createElement("div"),d.className="sceditor-nlf",d.innerHTML=kb?"":"<br />",k[0].appendChild(d)),!1):void 0})},T=function(){lb.val(nb.val())},U=function(){lb.closeDropDown(),p=null},X=function(){var a=f.height,b=f.width;lb.maximize()?lb.dimensions("100%","100%",!1):(a&&a.toString().indexOf("%")>-1||b&&b.toString().indexOf("%")>-1)&&lb.dimensions(b,a)},lb._=function(){var a,b=arguments;return q&&q[b[0]]&&(b[0]=q[b[0]]),b[0].replace(/\{(\d+)\}/g,function(c,d){return b[d-0+1]!==a?b[d-0+1]:"{"+d+"}"})},V=function(b){var c,d=a.extend({},b);t.call(d.type+"Event",b,lb),delete d.type,c=a.Event((b.target===n?"scesrc":"scewys")+b.type,d),g.trigger(c,lb),c.isDefaultPrevented()&&b.preventDefault(),c.isImmediatePropagationStopped()&&c.stopImmediatePropagation(),c.isPropagationStopped()&&c.stopPropagation()},lb.bind=function(b,c,d,e){b=b.split(" ");for(var f=b.length;f--;)a.isFunction(c)&&(d||g.bind("scewys"+b[f],c),e||g.bind("scesrc"+b[f],c),"valuechanged"===b[f]&&(gb.hasHandler=!0));return this},lb.unbind=function(b,c,d,e){b=b.split(" ");for(var f=b.length;f--;)a.isFunction(c)&&(d||g.unbind("scewys"+b[f],c),e||g.unbind("scesrc"+b[f],c));return this},lb.blur=function(b,c,d){return a.isFunction(b)?lb.bind("blur",b,c,d):lb.sourceMode()?m.blur():(s||(s=a('<input style="position:absolute;width:0;height:0;opacity:0;border:0;padding:0;filter:alpha(opacity=0)" type="text" />').appendTo(g)),s.removeAttr("disabled").show().focus().blur().hide().attr("disabled","disabled")),this},lb.focus=function(b,c,d){return a.isFunction(b)?lb.bind("focus",b,c,d):lb.inSourceMode()?n.focus():(j.contentWindow.focus(),k[0].focus(),p&&(r.selectRange(p),p=null)),this},lb.keyDown=function(a,b,c){return lb.bind("keydown",a,b,c)},lb.keyPress=function(a,b,c){return lb.bind("keypress",a,b,c)},lb.keyUp=function(a,b,c){return lb.bind("keyup",a,b,c)},lb.nodeChanged=function(a){return lb.bind("nodechanged",a,!1,!0)},lb.selectionChanged=function(a){return lb.bind("selectionchanged",a,!1,!0)},lb.valueChanged=function(a,b,c){return lb.bind("valuechanged",a,b,c)},db=function(b){var c=0,d=String.fromCharCode(b.which);if(!a(v).is("code")&&!a(v).parents("code").length)return lb.emoticonsCache||(lb.emoticonsCache=[],a.each(a.extend({},f.emoticons.more,f.emoticons.dropdown,f.emoticons.hidden),function(a,b){lb.emoticonsCache[c++]=[a,e("emoticon",{key:a,url:b.url||b,tooltip:b.tooltip||a})]}),lb.emoticonsCache.sort(function(a,b){return a[0].length-b[0].length}),lb.longestEmoticonCode=lb.emoticonsCache[lb.emoticonsCache.length-1][0].length),lb.getRangeHelper().raplaceKeyword(lb.emoticonsCache,!0,!0,lb.longestEmoticonCode,f.emoticonsCompat,d)?(f.emoticonsCompat&&(tb=k.find("img[data-sceditor-emoticon]")),/^\s$/.test(d)&&f.emoticonsCompat):void 0},eb=function(){if(tb.length){var b,c,d,e,f,g,h=lb.currentBlockNode(),i=!1,j=/[^\s\xA0\u2002\u2003\u2009\u00a0]+/;tb=a.map(tb,function(k){return k&&k.parentNode?a.contains(h,k)?(b=k.previousSibling,c=k.nextSibling,f=b.nodeValue,null===f&&(f=b.innerText||""),b&&j.test(b.nodeValue.slice(-1))||c&&j.test((c.nodeValue||"")[0])?(d=k.parentNode,e=r.cloneSelected(),g=e.startContainer,f+=a(k).data("sceditor-emoticon"),g===c?i=f.length+e.startOffset:g===h&&h.childNodes[e.startOffset]===c?i=f.length:g===b&&(i=e.startOffset),c&&3===c.nodeType||(c=d.insertBefore(d.ownerDocument.createTextNode(""),c)),c.insertData(0,f),d.removeChild(b),d.removeChild(k),i!==!1&&(e.setStart(c,i),e.collapse(!0),r.selectRange(e)),null):k):k:null})}},lb.emoticons=function(b){return b||b===!1?(f.emoticonsEnabled=b,b?(k.keypress(db),lb.sourceMode()||(r.saveRange(),B(k[0]),tb=k.find("img[data-sceditor-emoticon]"),gb(!1),r.restoreRange())):(k.find("img[data-sceditor-emoticon]").replaceWith(function(){return a(this).data("sceditor-emoticon")}),tb=[],k.unbind("keypress",db),gb()),this):f.emoticonsEnabled},lb.css=function(b){return z||(z=a('<style id="#inline" />').appendTo(l.find("head"))[0]),"string"!=typeof b?z.styleSheet?z.styleSheet.cssText:z.innerHTML:(z.styleSheet?z.styleSheet.cssText=b:z.innerHTML=b,this)},Q=function(a){var b=[],c={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|","[":"{","]":"}"},d={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},e={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},f=a.which,g=d[f]||String.fromCharCode(f).toLowerCase();return a.ctrlKey&&b.push("ctrl"),a.altKey&&b.push("alt"),a.shiftKey&&(b.push("shift"),e[f]?g=e[f]:c[g]&&(g=c[g])),g&&(16>f||f>18)&&b.push(g),b=b.join("+"),sb[b]?sb[b].call(lb):void 0},lb.addShortcut=function(a,b){return a=a.toLowerCase(),sb[a]="string"==typeof b?function(){return C(h.find(".sceditor-button-"+b),lb.commands[b]),!1}:b,this},lb.removeShortcut=function(a){return delete sb[a.toLowerCase()],this},R=function(c){var d,e,g,h,i;if(!jb&&!f.disableBlockRemove&&8===c.which&&(h=r.selectedRange())&&(b.getSelection?(d=h.startContainer,e=h.startOffset):(d=h.parentElement(),g=l[0].selection.createRange(),g.moveToElementText(d),g.setEndPoint("EndToStart",h),e=g.text.length),0===e&&(i=fb()))){for(;d!==i;){for(;d.previousSibling;)if(d=d.previousSibling,3!==d.nodeType||d.nodeValue)return;if(!(d=d.parentNode))return}if(i&&!a(i).is("body"))return lb.clearBlockFormatting(i),!1}},fb=function(){for(var b=v;!a.sceditor.dom.hasStyling(b);)if(!(b=b.parentNode)||a(b).is("body"))return;return b},lb.clearBlockFormatting=function(b){return b=b||fb(),!b||a(b).is("body")?this:(r.saveRange(),p=null,b.className="",a(b).attr("style",""),a(b).is("p,div")||a.sceditor.dom.convertElement(b,"p"),r.restoreRange(),this)},gb=function(b){if(t.hasHandler("valuechangedEvent")||gb.hasHandler){var c,d=lb.sourceMode(),e=!d&&r.hasSelection();b=b!==!1&&!l[0].getElementById("sceditor-start-marker"),ib.timer&&(clearTimeout(ib.timer),ib.timer=!1),e&&b&&r.saveRange(),c=k.html(),c!==gb.lastHtmlValue&&(gb.lastHtmlValue=c,g.trigger(a.Event("valuechanged",{rawValue:d?lb.val():c}))),e&&b&&r.removeMarkers()}},hb=function(){ib.timer&&gb()},ib=function(a){var b=a.which,c=ib.lastChar,d=13===c||32===c,e=8===c||46===c;ib.lastChar=b,13===b||32===b?d?ib.triggerNextChar=!0:gb():8===b||46===b?e?ib.triggerNextChar=!0:gb():ib.triggerNextChar&&(gb(),ib.triggerNextChar=!1),ib.timer&&clearTimeout(ib.timer),ib.timer=setTimeout(function(){gb()},1500)},A()},a.sceditor.ie=function(){var a,d=3,e=c.createElement("div"),f=e.getElementsByTagName("i");do e.innerHTML="<!--[if gt IE "+ ++d+"]><i></i><![endif]-->";while(f[0]);return c.documentMode&&c.all&&b.atob&&(d=10),4===d&&c.documentMode&&(d=11),d>4?d:a}(),a.sceditor.ios=/iPhone|iPod|iPad| wosbrowser\//i.test(navigator.userAgent),a.sceditor.isWysiwygSupported=function(){var b,c,d=a('<div contenteditable="true">')[0].contentEditable,e="undefined"!=typeof d&&"inherit"!==d,f=navigator.userAgent;return e?(c=/Opera Mobi|Opera Mini/i.test(f),/Android/i.test(f)&&(c=!0,/Safari/.test(f)&&(b=/Safari\/(\d+)/.exec(f),c=b&&b[1]?b[1]<534:!0)),/ Silk\//i.test(f)&&(b=/AppleWebKit\/(\d+)/.exec(f),c=b&&b[1]?b[1]<534:!0),a.sceditor.ios&&(c=!/OS [5-9](_\d)+ like Mac OS X/i.test(f)),/fennec/i.test(f)&&(c=!1),/OneBrowser/i.test(f)&&(c=!1),"UCWEB"===navigator.vendor&&(c=!1),!c):!1}(),a.sceditor.regexEscape=function(a){return a.replace(/([\-.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")},a.sceditor.escapeEntities=function(a,b){return a?(a=a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ {2}/g," &nbsp;").replace(/\r\n|\r/g,"\n").replace(/\n/g,"<br />"),b&&(a=a.replace(/"/g,"&#34;").replace(/'/g,"&#39;")),a):a},a.sceditor.escapeUriScheme=function(a){var c,d=/^(?:https?|s?ftp|mailto|spotify|skype|ssh|teamspeak|tel):|(?:\/\/)/i,e=/^[^\/]*:/i,f=b.location;return a&&e.test(a)&&!d.test(a)?(c=f.pathname.split("/"),c.pop(),f.protocol+"://"+f.host+c.join("/")+"/"+a):a},a.sceditor.locale={},a.sceditor.commands={bold:{exec:"bold",tooltip:"Bold",shortcut:"ctrl+b"},italic:{exec:"italic",tooltip:"Italic",shortcut:"ctrl+i"},underline:{exec:"underline",tooltip:"Underline",shortcut:"ctrl+u"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(b,c,d){for(var f=b.opts.fonts.split(","),g=a("<div />"),h=function(){return d(a(this).data("font")),b.closeDropDown(!0),!1},i=0;i<f.length;i++)g.append(e("fontOpt",{font:f[i]},!0).click(h));b.createDropDown(c,"font-picker",g)},exec:function(b){var c=this;a.sceditor.command.get("font")._dropDown(c,b,function(a){c.execCommand("fontname",a)})},tooltip:"Font Name"},size:{_dropDown:function(b,c,d){for(var f=a("<div />"),g=function(c){d(a(this).data("size")),b.closeDropDown(!0),c.preventDefault()},h=1;7>=h;h++)f.append(e("sizeOpt",{size:h},!0).click(g));b.createDropDown(c,"fontsize-picker",f)},exec:function(b){var c=this;a.sceditor.command.get("size")._dropDown(c,b,function(a){c.execCommand("fontsize",a)})},tooltip:"Font Size"},color:{_dropDown:function(b,c,d){var e,f,g,h,i={r:255,g:255,b:255},j=a("<div />"),k=b.opts.colors?b.opts.colors.split("|"):new Array(21),l=[],m=a.sceditor.command.get("color");if(!m._htmlCache){for(e=0;e<k.length;++e){for(h=k[e]?k[e].split(","):new Array(21),l.push('<div class="sceditor-color-column">'),f=0;f<h.length;++f)g=h[f]||"#"+i.r.toString(16)+i.g.toString(16)+i.b.toString(16),l.push('<a href="#" class="sceditor-color-option" style="background-color: '+g+'" data-color="'+g+'"></a>'),f%5===0?(i.g-=51,i.b=255):i.b-=51;l.push("</div>"),e%5===0?(i.r-=51,i.g=255,i.b=255):(i.g=255,i.b=255)}m._htmlCache=l.join("")}j.append(m._htmlCache).find("a").click(function(c){d(a(this).attr("data-color")),b.closeDropDown(!0),c.preventDefault()}),b.createDropDown(c,"color-picker",j)},exec:function(b){var c=this;a.sceditor.command.get("color")._dropDown(c,b,function(a){c.execCommand("forecolor",a)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(a){var b,c=this,d=e("pastetext",{label:c._("Paste your text inside the following box:"),insert:c._("Insert")},!0);d.find(".button").click(function(a){b=d.find("#txt").val(),b&&c.wysiwygEditorInsertText(b),c.closeDropDown(!0),a.preventDefault()}),c.createDropDown(a,"pastetext",d)},tooltip:"Paste Text"},bulletlist:{exec:"insertunorderedlist",tooltip:"Bullet list"},orderedlist:{exec:"insertorderedlist",tooltip:"Numbered list"},indent:{state:function(c,d){var e,f,g,h=a(d),i=h.parents("ul,ol,menu"),j=i.first();if(i.length>1||j.children().length>1)return 0;if(h.is("ul,ol,menu")){if(e=this.getRangeHelper().selectedRange(),!(b.Range&&e instanceof Range))return h.is("li,ul,ol,menu")?0:-1;if(f=e.startContainer.parentNode,g=e.endContainer.parentNode,f!==f.parentNode.firstElementChild||a(g).is("li")&&g!==g.parentNode.lastElementChild)return 0}return-1},exec:function(){var b=this,c=a(b.getRangeHelper().getFirstBlockParent());b.focus(),c.parents("ul,ol,menu")&&b.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(b,c){return a(c).is("ul,ol,menu")||a(c).parents("ul,ol,menu").length>0?0:-1},exec:function(){var b=this,c=a(b.getRangeHelper().getFirstBlockParent());c.parents("ul,ol,menu")&&b.execCommand("outdent")},tooltip:"Remove one indent"},table:{exec:function(b){var c=this,d=e("table",{rows:c._("Rows:"),cols:c._("Cols:"),insert:c._("Insert")},!0);
d.find(".button").click(function(b){var e=a.sceditor.ie,f=d.find("#rows").val()-0,g=d.find("#cols").val()-0,h="<table>";if(!(1>f||1>g)){for(var i=0;f>i;i++){h+="<tr>";for(var j=0;g>j;j++)h+="<td>"+(e&&11>e?"":"<br />")+"</td>";h+="</tr>"}h+="</table>",c.wysiwygEditorInsertHtml(h),c.closeDropDown(!0),b.preventDefault()}}),c.createDropDown(b,"inserttable",d)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{forceNewLineAfter:["code"],exec:function(){this.wysiwygEditorInsertHtml("<code>","<br /></code>")},tooltip:"Code"},image:{exec:function(a){var b=this,c=e("image",{url:b._("URL:"),width:b._("Width (optional):"),height:b._("Height (optional):"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#image").val(),e=c.find("#width").val(),f=c.find("#height").val(),g="";e&&(g+=' width="'+e+'"'),f&&(g+=' height="'+f+'"'),d&&"http://"!==d&&b.wysiwygEditorInsertHtml("<img"+g+' src="'+d+'" />'),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertimage",c)},tooltip:"Insert an image"},email:{exec:function(a){var b=this,c=e("email",{label:b._("E-mail:"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#email").val();d&&(b.focus(),b.getRangeHelper().selectedHtml()?b.execCommand("createlink","mailto:"+d):b.wysiwygEditorInsertHtml('<a href="mailto:'+d+'">'+d+"</a>")),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertemail",c)},tooltip:"Insert an email"},link:{exec:function(a){var b=this,c=e("link",{url:b._("URL:"),desc:b._("Description (optional):"),ins:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#link").val(),e=c.find("#des").val();d&&"http://"!==d&&(b.focus(),!b.getRangeHelper().selectedHtml()||e?(e||(e=d),b.wysiwygEditorInsertHtml('<a href="'+d+'">'+e+"</a>")):b.execCommand("createlink",d)),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertlink",c)},tooltip:"Insert a link"},unlink:{state:function(){var b=a(this.currentNode());return b.is("a")||b.parents("a").length>0?0:-1},exec:function(){var b=a(this.currentNode()),c=b.is("a")?b:b.parents("a").first();c.length&&c.replaceWith(c.contents())},tooltip:"Unlink"},quote:{forceNewLineAfter:["blockquote"],exec:function(b,c,d){var e=a.sceditor.ie,f="<blockquote>",g="</blockquote>";c?(d=d?"<cite>"+d+"</cite>":"",f=f+d+c+g,g=null):""===this.getRangeHelper().selectedHtml()&&(g=e&&11>e?"":"<br />"+g),this.wysiwygEditorInsertHtml(f,g)},tooltip:"Insert a Quote"},emoticon:{exec:function(b){var c=this,d=function(e){var f=c.opts.emoticonsCompat,g=c.getRangeHelper(),h=f&&" "!==g.getOuterText(!0,1)?" ":"",i=f&&" "!==g.getOuterText(!1,1)?" ":"",j=a("<div />"),k=a("<div />").appendTo(j),l=a.extend({},c.opts.emoticons.dropdown,e?c.opts.emoticons.more:{}),m=0;return a.each(l,function(){m++}),m=Math.sqrt(m),a.each(l,function(b,d){k.append(a("<img />").attr({src:d.url||d,alt:b,title:d.tooltip||b}).click(function(){return c.insert(h+a(this).attr("alt")+i,null,!1).closeDropDown(!0),!1})),k.children().length>=m&&(k=a("<div />").appendTo(j))}),e||j.append(a(c._('<a class="sceditor-more">{0}</a>',c._("More"))).click(function(){return c.createDropDown(b,"more-emoticons",d(!0)),!1})),j};c.createDropDown(b,"emoticons",d(!1))},txtExec:function(b){a.sceditor.command.get("emoticon").exec.call(this,b)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(a,b,c){var d,f=e("youtubeMenu",{label:a._("Video URL:"),insert:a._("Insert")},!0);f.find(".button").click(function(b){var e=f.find("#link").val().replace("http://","");""!==e&&(d=e.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),d&&(e=d[1]),/^[a-zA-Z0-9_\-]{11}$/.test(e)?c(e):alert("Invalid YouTube video")),a.closeDropDown(!0),b.preventDefault()}),a.createDropDown(b,"insertlink",f)},exec:function(b){var c=this;a.sceditor.command.get("youtube")._dropDown(c,b,function(a){c.wysiwygEditorInsertHtml(e("youtube",{id:a}))})},tooltip:"Insert a YouTube video"},date:{_date:function(a){var b=new Date,c=b.getYear(),d=b.getMonth()+1,e=b.getDate();return 2e3>c&&(c=1900+c),10>d&&(d="0"+d),10>e&&(e="0"+e),a.opts.dateFormat.replace(/year/i,c).replace(/month/i,d).replace(/day/i,e)},exec:function(){this.insertText(a.sceditor.command.get("date")._date(this))},txtExec:function(){this.insertText(a.sceditor.command.get("date")._date(this))},tooltip:"Insert current date"},time:{_time:function(){var a=new Date,b=a.getHours(),c=a.getMinutes(),d=a.getSeconds();return 10>b&&(b="0"+b),10>c&&(c="0"+c),10>d&&(d="0"+d),b+":"+c+":"+d},exec:function(){this.insertText(a.sceditor.command.get("time")._time())},txtExec:function(){this.insertText(a.sceditor.command.get("time")._time())},tooltip:"Insert current time"},ltr:{state:function(a,b){return b&&"ltr"===b.style.direction},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus(),(c&&!d.is("body")||(b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c),c&&!d.is("body")))&&("ltr"===d.css("direction")?d.css("direction",""):d.css("direction","ltr"))},tooltip:"Left-to-Right"},rtl:{state:function(a,b){return b&&"rtl"===b.style.direction},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus(),(c&&!d.is("body")||(b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c),c&&!d.is("body")))&&("rtl"===d.css("direction")?d.css("direction",""):d.css("direction","rtl"))},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize",shortcut:"ctrl+shift+m"},source:{exec:function(){this.toggleSourceMode()},txtExec:function(){this.toggleSourceMode()},tooltip:"View source",shortcut:"ctrl+shift+s"},ignore:{}},a.sceditor.rangeHelper=function(b,c){var d,e,f,g=c||b.contentDocument||b.document,h=b,i=!!b.getSelection,j="sceditor-start-marker",k="sceditor-end-marker",l="character",m=this;m.insertHTML=function(a,b){var c,d,e=m.selectedRange();if(i){for(b&&(a+=m.selectedHtml()+b),d=g.createElement("div"),c=g.createDocumentFragment(),d.innerHTML=a;d.firstChild;)c.appendChild(d.firstChild);m.insertNode(c)}else{if(!e)return!1;e.pasteHTML(f(a,b,!0))}},f=function(b,c,e){var f,h,i,l=g.createElement("div");if("string"==typeof b?(c&&(b+=m.selectedHtml()+c),l.innerHTML=b):(l.appendChild(b),c&&(l.appendChild(range.extractContents()),l.appendChild(c))),f=l.lastChild){if(m.removeMarkers(),h=a(f),a.sceditor.dom.canHaveChildren(f)?(f.lastChild||h.append(g.createTextNode("​")),h.append(d(k)).append(d(j))):h.after(d(j)).after(d(k)),e)return l.innerHTML;for(i=g.createDocumentFragment();l.firstChild;)i.appendChild(l.firstChild);return i}},m.insertNode=function(a,b){if(i){var c=f(a,b),d=m.selectedRange(),e=d.commonAncestorContainer;if(!c)return!1;d.deleteContents(),e&&/^(br|hr)$/i.test(e.nodeName)?e.parentNode.insertBefore(c,e):d.insertNode(c),m.restoreRange()}else m.insertHTML(a.outerHTML,b?b.outerHTML:null)},m.cloneSelected=function(){var a=m.selectedRange();return a?i?a.cloneRange():a.duplicate():void 0},m.selectedRange=function(){var a,b,c=i?h.getSelection():g.selection;if(c){if(c.getRangeAt&&c.rangeCount<=0){for(b=g.body;b.firstChild;)b=b.firstChild;a=g.createRange(),a.setStart(b,0),c.addRange(a)}return i&&(a=c.getRangeAt(0)),i||"Control"===c.type||(a=c.createRange()),e(a)?a:null}},e=function(a){var b;return a&&a.parentElement&&(b=a.parentElement())?b.ownerDocument===g:!0},m.hasSelection=function(){var a,b=i?h.getSelection():g.selection;return i||!b?b&&b.rangeCount>0:(a=b.createRange(),a&&e(a))},m.selectedHtml=function(){var a,b=m.selectedRange();return b?!i&&""!==b.text&&b.htmlText?b.htmlText:i?(a=g.createElement("div"),a.appendChild(b.cloneContents()),a.innerHTML):"":""},m.parentNode=function(){var a=m.selectedRange();return a?a.parentElement?a.parentElement():a.commonAncestorContainer:void 0},m.getFirstBlockParent=function(b){var c=function(b){return a.sceditor.dom.isInline(b,!0)?(b=b?b.parentNode:null,b?c(b):null):b};return c(b||m.parentNode())},m.insertNodeAt=function(a,b){var c=m.selectedRange(),d=m.cloneSelected();return d?(d.collapse(a),d.insertNode?d.insertNode(b):d.pasteHTML(b.outerHTML),void m.selectRange(c)):!1},d=function(a){m.removeMarker(a);var b=g.createElement("span");return b.id=a,b.style.lineHeight="0",b.style.display="none",b.className="sceditor-selection sceditor-ignore",b.innerHTML=" ",b},m.insertMarkers=function(){m.insertNodeAt(!0,d(j)),m.insertNodeAt(!1,d(k))},m.getMarker=function(a){return g.getElementById(a)},m.removeMarker=function(a){var b=m.getMarker(a);b&&b.parentNode.removeChild(b)},m.removeMarkers=function(){m.removeMarker(j),m.removeMarker(k)},m.saveRange=function(){m.insertMarkers()},m.selectRange=function(a){i?(h.getSelection().removeAllRanges(),h.getSelection().addRange(a)):a.select()},m.restoreRange=function(){var a,b=m.selectedRange(),c=m.getMarker(j),d=m.getMarker(k);return c&&d&&b?(i?(b=g.createRange(),b.setStartBefore(c),b.setEndAfter(d)):(b=g.body.createTextRange(),a=g.body.createTextRange(),a.moveToElementText(c),b.setEndPoint("StartToStart",a),b.moveStart(l,0),a.moveToElementText(d),b.setEndPoint("EndToStart",a),b.moveEnd(l,0)),m.selectRange(b),void m.removeMarkers()):!1},m.selectOuterText=function(a,b){var c=m.cloneSelected();return c?(c.collapse(!1),i?(c.setStart(c.startContainer,c.startOffset-a),c.setEnd(c.endContainer,c.endOffset+b)):(c.moveStart(l,0-a),c.moveEnd(l,b)),void m.selectRange(c)):!1},m.getOuterText=function(a,b){var c="",d=m.cloneSelected();return d?(d.collapse(!1),a?i?(c=d.startContainer.textContent.substr(0,d.startOffset),c=c.substr(Math.max(0,c.length-b))):(d.moveStart(l,0-b),c=d.text):i?c=d.startContainer.textContent.substr(d.startOffset,b):(d.moveEnd(l,b),c=d.text),c):""},m.raplaceKeyword=function(b,c,d,e,f,g){d||b.sort(function(a,b){return a.length-b.length});var h,j,k,l,n,o,p,q=b.length,r=e||b[q-1][0].length;if(f){if(!i)return!1;++r}for(h=m.getOuterText(!0,r),j=h+(null!=g?g:""),c&&(j+=m.getOuterText(!1,r));q--;)if(p=b[q][0],n=new RegExp("(?:[\\s    ])"+a.sceditor.regexEscape(p)+"(?=[\\s    ])"),o=h.length-1-p.length,f&&--o,o=Math.max(0,o),(k=f?j.substr(o).search(n):j.indexOf(p,o))>-1){if(f&&(k+=o+1),k>h.length||k+p.length+(f?1:0)<h.length)continue;return l=h.length-k,m.selectOuterText(l,p.length-l-(null!=g&&/^\S/.test(g)?1:0)),m.insertHTML(b[q][1]),!0}return!1},m.compare=function(a,b){return b||(b=m.selectedRange()),a&&b?i?0===a.compareBoundaryPoints(Range.END_TO_END,b)&&0===a.compareBoundaryPoints(Range.START_TO_START,b):e(a)&&e(b)&&0===a.compareEndPoints("EndToEnd",b)&&0===a.compareEndPoints("StartToStart",b):!a&&!b}},a.sceditor.dom={traverse:function(a,b,c,d,e){if(a)for(a=e?a.lastChild:a.firstChild;null!=a;){var f=e?a.previousSibling:a.nextSibling;if(!c&&b(a)===!1)return!1;if(!d&&this.traverse(a,b,c,d,e)===!1)return!1;if(c&&b(a)===!1)return!1;a=f}},rTraverse:function(a,b,c,d){this.traverse(a,b,c,d,!0)},parseHTML:function(b,d){var e=[],f=(d||c).createElement("div");return f.innerHTML=b,a.merge(e,f.childNodes),e},hasStyling:function(b){var c=a(b);return b&&(!c.is("p,div")||b.className||c.attr("style")||!a.isEmptyObject(c.data()))},convertElement:function(b,c){for(var d,e,f=b.attributes.length,g=b.ownerDocument.createElement(c);f--;)e=b.attributes[f],(!a.sceditor.ie||e.specified)&&(a.sceditor.ie<8&&/style/i.test(e.name)?b.style.cssText=b.style.cssText:g.setAttribute(e.name,e.value));for(;d=b.firstChild;)g.appendChild(d);return b.parentNode.replaceChild(g,b),g},blockLevelList:"|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|",canHaveChildren:function(a){return/11?|9/.test(a.nodeType)?"hr,br,img,input,meta,link,iframe,".indexOf(a.nodeName.toLowerCase()+",")<0:!1},isInline:function(b,c){return b&&1===b.nodeType?(b=b.tagName.toLowerCase(),"code"===b?!c:a.sceditor.dom.blockLevelList.indexOf("|"+b+"|")<0):!0},copyCSS:function(a,b){b.style.cssText=a.style.cssText+b.style.cssText},fixNesting:function(a){var b=this,c=function(a){for(;b.isInline(a.parentNode,!0);)a=a.parentNode;return a};b.traverse(a,function(a){if(1===a.nodeType&&!b.isInline(a,!0)&&b.isInline(a.parentNode,!0)){var d=c(a),e=d.parentNode,f=b.extractContents(d,a),g=a;b.copyCSS(d,g),e.insertBefore(f,d),e.insertBefore(g,d)}})},findCommonAncestor:function(b,c){return a(b).parents().has(a(c)).first()},getSibling:function(b,c){var d;return b?(d=b[c?"previousSibling":"nextSibling"])?d:a.sceditor.dom.getSibling(b.parentNode,c):null},removeWhiteSpace:function(b,c){for(var d,e,f,g,h,i,j,k,l=a.sceditor.dom.getSibling,m=a.sceditor.dom.isInline,n=b.firstChild,o=/[\t ]+/g,p=/[\t\n\r ]+/g;n;){if(i=n.nextSibling,d=n.nodeValue,e=n.nodeType,1===e&&n.firstChild&&(h=a(n).css("whiteSpace"),/pre(?:\-wrap)?$/i.test(h)||a.sceditor.dom.removeWhiteSpace(n,/line$/i.test(h))),3===e&&d){for(f=l(n),g=l(n,!0),k=g,j=!1;a(k).hasClass("sceditor-ignore");)k=l(k,!0);if(m(n)&&k){for(;k.lastChild;)k=k.lastChild;j=3===k.nodeType?/[\t\n\r ]$/.test(k.nodeValue):!m(k)}m(n)&&g&&m(g)&&!j||(d=d.replace(/^[\t\n\r ]+/,"")),m(n)&&f&&m(f)||(d=d.replace(/[\t\n\r ]+$/,"")),d=d.replace(/\u200B/g,""),d.length?n.nodeValue=d.replace(c?o:p," "):b.removeChild(n)}n=i}},extractContents:function(a,b){var c=this,d=c.findCommonAncestor(a,b),e=d?d[0]:null,f=!1,g=!1;return function h(d){var e=a.ownerDocument.createDocumentFragment();return c.traverse(d,function(c){if(g||c===b&&f)return g=!0,!1;c===a&&(f=!0);var d,i;f?jQuery.contains(c,b)&&1===c.nodeType?(d=h(c),i=c.cloneNode(!1),i.appendChild(d),e.appendChild(i)):e.appendChild(c):jQuery.contains(c,a)&&1===c.nodeType&&(d=h(c),i=c.cloneNode(!1),i.appendChild(d),e.appendChild(i))},!1),e}(e)},getOffset:function(a){for(var b=0,c=0;a;)b+=a.offsetLeft,c+=a.offsetTop,a=a.offsetParent;return{left:b,top:c}},getStyle:function(b,c){var d,e,f,g,h=b.style;if(!h)return null;if(a.sceditor.dom._propertyCache||(a.sceditor.dom._propertyCache={}),f=a.sceditor.dom._propertyCache,f[c]||(f[c]=a.camelCase(c)),c=f[c],g=h[c],"textAlign"===c){if(d=a(b),e=h.direction,g=g||d.css(c),d.parent().css(c)===g||"block"!==d.css("display")||d.is("hr")||d.is("th"))return null;if(e&&g&&(/right/i.test(g)&&"rtl"===e||/left/i.test(g)&&"ltr"===e))return null}return g},hasStyle:function(b,c,d){var e=a.sceditor.dom.getStyle(b,c);return e?!1:!d||e===d||a.isArray(d)&&a.inArray(e,d)>-1}},a.sceditor.plugins={},a.sceditor.PluginManager=function(b){var c=this,d=[],e=b,f=function(a){return"signal"+a.charAt(0).toUpperCase()+a.slice(1)},g=function(a,b){a=[].slice.call(a);for(var c=d.length,g=f(a.shift());c--;)if(g in d[c]){if(b)return d[c][g].apply(e,a);d[c][g].apply(e,a)}};c.call=function(){g(arguments,!1)},c.callOnlyFirst=function(){return g(arguments,!0)},c.iter=function(a){return a=f(a),function(){var b=d.length;return{callNext:function(c){for(;b--;)if(d[b]&&a in d[b])return d[b].apply(e,c)},hasNext:function(){for(var c=b;c--;)if(d[c]&&a in d[c])return!0;return!1}}}()},c.hasHandler=function(a){var b=d.length;for(a=f(a);b--;)if(a in d[b])return!0;return!1},c.exists=function(b){return b in a.sceditor.plugins?(b=a.sceditor.plugins[b],"function"==typeof b&&"object"==typeof b.prototype):!1},c.isRegistered=function(b){var e=d.length;if(!c.exists(b))return!1;for(;e--;)if(d[e]instanceof a.sceditor.plugins[b])return!0;return!1},c.register=function(b){return c.exists(b)?(b=new a.sceditor.plugins[b],d.push(b),"init"in b&&b.init.apply(e),!0):!1},c.deregister=function(b){var f,g=d.length,h=!1;if(!c.isRegistered(b))return!1;for(;g--;)d[g]instanceof a.sceditor.plugins[b]&&(f=d.splice(g,1)[0],h=!0,"destroy"in f&&f.destroy.apply(e));return h},c.destroy=function(){for(var a=d.length;a--;)"destroy"in d[a]&&d[a].destroy.apply(e);d=null,e=null}},a.sceditor.command={get:function(b){return a.sceditor.commands[b]||null},set:function(b,c){return b&&c?(c=a.extend(a.sceditor.commands[b]||{},c),c.remove=function(){a.sceditor.command.remove(b)},a.sceditor.commands[b]=c,this):!1},remove:function(b){return a.sceditor.commands[b]&&delete a.sceditor.commands[b],this}},a.sceditor.defaultOptions={toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,paste,pastetext|bulletlist,orderedlist,indent,outdent|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",toolbarExclude:null,style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:null,locale:a("html").attr("lang")||"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,getHtmlHandler:null,getTextHandler:null,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,spellcheck:!0,runWithoutWysiwygSupport:!1,id:null,plugins:"",zIndex:null,bbcodeTrim:!1,disableBlockRemove:!1,parserOptions:{},dropDownCss:{}},a.fn.sceditor=function(b){var c,d=[];return b=b||{},b.runWithoutWysiwygSupport||a.sceditor.isWysiwygSupported?(this.each(function(){c=this.jquery?this:a(this),c.parents(".sceditor-container").length>0||("state"===b?d.push(!!c.data("sceditor")):"instance"===b?d.push(c.data("sceditor")):c.data("sceditor")||new a.sceditor(this,b))}),d.length?1===d.length?d[0]:a(d):this):void 0}}(jQuery,window,document);

/* SCEditor v3.1.1 | (C) 2017, Sam Clarke | sceditor.com/license */

!function(){"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=e(jQuery);function t(e,t){return typeof t===e}var ye=t.bind(null,"string"),be=t.bind(null,"undefined"),xe=t.bind(null,"function"),r=t.bind(null,"number");function n(e){return!Object.keys(e).length}function we(e,t){var n=e===!!e,o=n?2:1,r=n?t:e,i=n&&e;function a(e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype}for(;o<arguments.length;o++){var l,s=arguments[o];for(l in s){var c,u,d=r[l],f=s[l];be(f)||"__proto__"!==l&&"constructor"!==l&&(u=a(f),c=Array.isArray(f),i&&(u||c)?(u=a(d)===u&&Array.isArray(d)===c,r[l]=we(!0,u?d:c?[]:{},f)):r[l]=f)}}return r}function Te(e,t){t=e.indexOf(t);-1<t&&e.splice(t,1)}function Ce(t,n){if(Array.isArray(t)||"length"in t&&r(t.length))for(var e=0;e<t.length;e++)n(e,t[e]);else Object.keys(t).forEach(function(e){n(e,t[e])})}var i={},Se=1,ke=3,l=8;function a(e){return e=parseFloat(e),isFinite(e)?e:0}function De(e,t,n){var o=(n||document).createElement(e);return Ce(t||{},function(e,t){"style"===e?o.style.cssText=t:e in o?o[e]=t:o.setAttribute(e,t)}),o}function Ee(e,t){for(var n=e||{};(n=n.parentNode)&&!/(9|11)/.test(n.nodeType);)if(!t||Ue(n,t))return n}function Ne(e,t){return Ue(e,t)?e:Ee(e,t)}function Me(e){e.parentNode&&e.parentNode.removeChild(e)}function Ae(e,t){e.appendChild(t)}function Re(e,t){return e.querySelectorAll(t)}var _e=!0;function Fe(n,e,o,r,i){e.split(" ").forEach(function(e){var t;ye(o)?(t=r["_sce-event-"+e+o]||function(e){for(var t=e.target;t&&t!==n;){if(Ue(t,o))return void r.call(t,e);t=t.parentNode}},r["_sce-event-"+e+o]=t):(t=o,i=r),n.addEventListener(e,t,i||!1)})}function Oe(n,e,o,r,i){e.split(" ").forEach(function(e){var t;ye(o)?t=r["_sce-event-"+e+o]:(t=o,i=r),n.removeEventListener(e,t,i||!1)})}function He(e,t,n){if(arguments.length<3)return e.getAttribute(t);null==n?ze(e,t):e.setAttribute(t,n)}function ze(e,t){e.removeAttribute(t)}function Le(e){Pe(e,"display","none")}function Ie(e){Pe(e,"display","")}function Be(e){(Ze(e)?Le:Ie)(e)}function Pe(n,e,t){if(arguments.length<3){if(ye(e))return 1===n.nodeType?getComputedStyle(n)[e]:null;Ce(e,function(e,t){Pe(n,e,t)})}else{var o=(t||0===t)&&!isNaN(t);n.style[e]=o?t+"px":t}}function je(e,t,n){var o=arguments.length,r={};if(e.nodeType===Se)return 1===o?(Ce(e.attributes,function(e,t){/^data\-/i.test(t.name)&&(r[t.name.substr(5)]=t.value)}),r):2===o?He(e,"data-"+t):void He(e,"data-"+t,String(n))}function Ue(e,t){var n=!1;return n=e&&e.nodeType===Se?(e.matches||e.msMatchesSelector||e.webkitMatchesSelector).call(e,t):n}function We(e,t){return t.parentNode.insertBefore(e,t)}function s(e){return e.className.trim().split(/\s+/)}function Ve(e,t){return Ue(e,"."+t)}function qe(e,t){var n=s(e);n.indexOf(t)<0&&n.push(t),e.className=n.join(" ")}function Ge(e,t){var n=s(e);Te(n,t),e.className=n.join(" ")}function $e(e,t,n){((n=be(n)?!Ve(e,t):n)?qe:Ge)(e,t)}function Ye(e,t){if(be(t)){var n=getComputedStyle(e),o=a(n.paddingLeft)+a(n.paddingRight),n=a(n.borderLeftWidth)+a(n.borderRightWidth);return e.offsetWidth-o-n}Pe(e,"width",t)}function Ke(e,t){if(be(t)){var n=getComputedStyle(e),o=a(n.paddingTop)+a(n.paddingBottom),n=a(n.borderTopWidth)+a(n.borderBottomWidth);return e.offsetHeight-o-n}Pe(e,"height",t)}function Xe(e,t,n){var o;xe(window.CustomEvent)?o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(o=e.ownerDocument.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n),e.dispatchEvent(o)}function Ze(e){return e.getClientRects().length}function Qe(e,t,n,o,r){for(e=r?e.lastChild:e.firstChild;e;){var i=r?e.previousSibling:e.nextSibling;if(!n&&!1===t(e)||!o&&!1===Qe(e,t,n,o,r)||n&&!1===t(e))return!1;e=i}}function Je(e,t,n,o){Qe(e,t,n,o,!0)}function et(e,t){var n=(t=t||document).createDocumentFragment(),o=De("div",{},t);for(o.innerHTML=e;o.firstChild;)Ae(n,o.firstChild);return n}function tt(e){return e&&(!Ue(e,"p,div")||e.className||He(e,"style")||!n(je(e)))}function nt(e,t){var n=De(t,{},e.ownerDocument);for(Ce(e.attributes,function(e,t){try{He(n,t.name,t.value)}catch(e){}});e.firstChild;)Ae(n,e.firstChild);return e.parentNode.replaceChild(n,e),n}var c="|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|details|section|article|aside|nav|main|header|hgroup|footer|fieldset|dl|dt|dd|figure|figcaption|";function ot(e){return!!/11?|9/.test(e.nodeType)&&"|iframe|area|base|basefont|br|col|frame|hr|img|input|wbr|isindex|link|meta|param|command|embed|keygen|source|track|object|".indexOf("|"+e.nodeName.toLowerCase()+"|")<0}function rt(e,t){var n=(e||{}).nodeType||ke;return n!==Se?n===ke:"code"===(e=e.tagName.toLowerCase())?!t:c.indexOf("|"+e+"|")<0}function d(e){return e.lastChild&&d(e.lastChild)&&Me(e.lastChild),3===e.nodeType?!e.nodeValue:ot(e)&&!e.childNodes.length}function it(e){Qe(e,function(e){var t=!rt(e,!0)&&e.nodeType!==l,n=e.parentNode;if(t&&(rt(n,!0)||"P"===n.tagName)){for(var o=e;rt(o.parentNode,!0)||"P"===o.parentNode.tagName;)o=o.parentNode;for(var r=f(o,e),i=e;n&&rt(n,!0);){if(n.nodeType===Se){for(var a=n.cloneNode();i.firstChild;)Ae(a,i.firstChild);Ae(i,a)}n=n.parentNode}We(i,o),d(r)||We(r,i),d(o)&&Me(o)}t&&Ue(e,"ul,ol")&&Ue(e.parentNode,"ul,ol")&&(r="li",t=(t=e).previousElementSibling,(t=!r||!t||Ue(t,r)?t:null)||We(t=De("li"),e),Ae(t,e))})}function u(e,t){return e?(t?e.previousSibling:e.nextSibling)||u(e.parentNode,t):null}function at(e){var t,n,o,r,i,a,l=Pe(e,"whiteSpace"),s=/line$/i.test(l),c=e.firstChild;if(!/pre(\-wrap)?$/i.test(l))for(;c;){if(i=c.nextSibling,t=c.nodeValue,(a=c.nodeType)===Se&&c.firstChild&&at(c),a===ke){for(n=u(c),o=u(c,!0),a=!1;Ve(o,"sceditor-ignore");)o=u(o,!0);if(rt(c)&&o){for(r=o;r.lastChild;)for(r=r.lastChild;Ve(r,"sceditor-ignore");)r=u(r,!0);a=r.nodeType===ke?/[\t\n\r ]$/.test(r.nodeValue):!rt(r)}t=t.replace(/\u200B/g,""),o&&rt(o)&&!a||(t=t.replace(s?/^[\t ]+/:/^[\t\n\r ]+/,"")),(t=!n||!rt(n)?t.replace(s?/[\t ]+$/:/[\t\n\r ]+$/,""):t).length?c.nodeValue=t.replace(s?/[\t ]+/g:/[\t\n\r ]+/g," "):Me(c)}c=i}}function f(e,t){var n=e.ownerDocument.createRange();return n.setStartBefore(e),n.setEndAfter(t),n.extractContents()}function lt(e){for(var t=0,n=0;e;)t+=e.offsetLeft,n+=e.offsetTop,e=e.offsetParent;return{left:t,top:n}}function p(e,t){var n=e.style;return i[t]||(i[t]=t.replace(/^-ms-/,"ms-").replace(/-(\w)/g,function(e,t){return t.toUpperCase()})),n=n[t=i[t]],"textAlign"===t&&(n=n||Pe(e,t),Pe(e.parentNode,t)===n||"block"!==Pe(e,"display")||Ue(e,"hr,th"))?"":n}function st(e,t){var n=e.attributes.length;if(n===t.attributes.length){for(;n--;){var o=e.attributes[n];if("style"===o.name?!function(e,t){var n=e.style.length;if(n===t.style.length){for(;n--;){var o=e.style[n];if(e.style[o]!==t.style[o])return}return 1}}(e,t):o.value!==He(t,o.name))return}return 1}}function ct(e){for(;e.firstChild;)We(e.firstChild,e);Me(e)}var ut={toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,pastetext|bulletlist,orderedlist,indent,outdent|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",toolbarExclude:null,style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:"#000000,#44B8FF,#1E92F7,#0074D9,#005DC2,#00369B,#b3d5f4|#444444,#C3FFFF,#9DF9FF,#7FDBFF,#68C4E8,#419DC1,#d9f4ff|#666666,#72FF84,#4CEA5E,#2ECC40,#17B529,#008E02,#c0f0c6|#888888,#FFFF44,#FFFA1E,#FFDC00,#E8C500,#C19E00,#fff5b3|#aaaaaa,#FFC95F,#FFA339,#FF851B,#E86E04,#C14700,#ffdbbb|#cccccc,#FF857A,#FF5F54,#FF4136,#E82A1F,#C10300,#ffc6c3|#eeeeee,#FF56FF,#FF30DC,#F012BE,#D900A7,#B20080,#fbb8ec|#ffffff,#F551FF,#CF2BE7,#B10DC9,#9A00B2,#9A00B2,#e8b6ef",locale:He(document.documentElement,"lang")||"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,spellcheck:!0,runWithoutWysiwygSupport:!1,startInSourceMode:!1,id:null,plugins:"",zIndex:null,bbcodeTrim:!1,disableBlockRemove:!1,allowedIframeUrls:[],parserOptions:{},dropDownCss:{}},m=/^(https?|s?ftp|mailto|spotify|skype|ssh|teamspeak|tel):|(\/\/)|data:image\/(png|bmp|gif|p?jpe?g);/i;function dt(e){return e.replace(/([\-.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}function ft(e,t){if(!e)return e;var n={"&":"&amp;","<":"&lt;",">":"&gt;"," ":"&nbsp; ","\r\n":"<br />","\r":"<br />","\n":"<br />"};return!1!==t&&(n['"']="&#34;",n["'"]="&#39;",n["`"]="&#96;"),e=e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var g={html:'<!DOCTYPE html><html{attrs}><head><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true" {spellcheck}><p></p></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="image">{url}</label> <input type="text" id="image" dir="ltr" placeholder="https://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" dir="ltr" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" dir="ltr" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" dir="ltr" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" dir="ltr" placeholder="https://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" dir="ltr" placeholder="https://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" frameborder="0" allowfullscreen src="https://www.youtube-nocookie.com/embed/{id}?wmode=opaque&start={time}" data-youtube-id="{id}"></iframe>'};function pt(e,t,n){var o=g[e];return Object.keys(t).forEach(function(e){o=o.replace(new RegExp(dt("{"+e+"}"),"g"),t[e])}),o=n?et(o):o}function h(e){if("mozHidden"in document)for(var t,n=e.getBody();n;){if((t=n).firstChild)t=t.firstChild;else{for(;t&&!t.nextSibling;)t=t.parentNode;t=t&&t.nextSibling}3===n.nodeType&&/[\n\r\t]+/.test(n.nodeValue)&&(/^pre/.test(Pe(n.parentNode,"whiteSpace"))||Me(n)),n=t}}var mt={bold:{exec:"bold",tooltip:"Bold",shortcut:"Ctrl+B"},italic:{exec:"italic",tooltip:"Italic",shortcut:"Ctrl+I"},underline:{exec:"underline",tooltip:"Underline",shortcut:"Ctrl+U"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{state:function(e){if(e=e&&3===e.nodeType?e.parentNode:e){var t="ltr"===Pe(e,"direction"),e=Pe(e,"textAlign");return/left/.test(e)||e===(t?"start":"end")}},exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{state:function(e){if(e=e&&3===e.nodeType?e.parentNode:e){var t="ltr"===Pe(e,"direction"),e=Pe(e,"textAlign");return/right/.test(e)||e===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var o=De("div");Fe(o,"click","a",function(e){n(je(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){Ae(o,pt("fontOpt",{font:e},!0))}),t.createDropDown(e,"font-picker",o)},exec:function(e){var t=this;mt.font._dropDown(t,e,function(e){t.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,e,n){var o=De("div");Fe(o,"click","a",function(e){n(je(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var r=1;r<=7;r++)Ae(o,pt("sizeOpt",{size:r},!0));t.createDropDown(e,"fontsize-picker",o)},exec:function(e){var t=this;mt.size._dropDown(t,e,function(e){t.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,e,n){var o=De("div"),r="",i=mt.color;i._htmlCache||(t.opts.colors.split("|").forEach(function(e){r+='<div class="sceditor-color-column">',e.split(",").forEach(function(e){r+='<a href="#" class="sceditor-color-option" style="background-color: '+e+'" data-color="'+e+'"></a>'}),r+="</div>"}),i._htmlCache=r),Ae(o,et(i._htmlCache)),Fe(o,"click","a",function(e){n(je(this,"color")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"color-picker",o)},exec:function(e){var t=this;mt.color._dropDown(t,e,function(e){t.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=De("div"),o=this;Ae(n,pt("pastetext",{label:o._("Paste your text inside the following box:"),insert:o._("Insert")},!0)),Fe(n,"click",".button",function(e){(t=Re(n,"#txt")[0].value)&&o.wysiwygEditorInsertText(t),o.closeDropDown(!0),e.preventDefault()}),o.createDropDown(e,"pastetext",n)},tooltip:"Paste Text"},bulletlist:{exec:function(){h(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){h(this),this.execCommand("insertorderedlist")},tooltip:"Numbered list"},indent:{state:function(e,t){var n;return Ue(t,"li")||Ue(t,"ul,ol,menu")&&(t=(n=this.getRangeHelper().selectedRange()).startContainer.parentNode,n=n.endContainer.parentNode,t!==t.parentNode.firstElementChild||Ue(n,"li")&&n!==n.parentNode.lastElementChild)?0:-1},exec:function(){var e=this.getRangeHelper().getFirstBlockParent();this.focus(),Ne(e,"ul,ol,menu")&&this.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(e,t){return Ne(t,"ul,ol,menu")?0:-1},exec:function(){Ne(this.getRangeHelper().getFirstBlockParent(),"ul,ol,menu")&&this.execCommand("outdent")},tooltip:"Remove one indent"},table:{exec:function(e){var r=this,i=De("div");Ae(i,pt("table",{rows:r._("Rows:"),cols:r._("Cols:"),insert:r._("Insert")},!0)),Fe(i,"click",".button",function(e){var t=Number(Re(i,"#rows")[0].value),n=Number(Re(i,"#cols")[0].value),o="<table>";0<t&&0<n&&(o+=Array(t+1).join("<tr>"+Array(n+1).join("<td><br /></td>")+"</tr>"),o+="</table>",r.wysiwygEditorInsertHtml(o),r.closeDropDown(!0),e.preventDefault())}),r.createDropDown(e,"inserttable",i)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{exec:function(){this.wysiwygEditorInsertHtml("<code>","<br /></code>")},tooltip:"Code"},image:{_dropDown:function(t,e,n,o){var r=De("div");Ae(r,pt("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0));var i=Re(r,"#image")[0];i.value=n,Fe(r,"click",".button",function(e){i.value&&o(i.value,Re(r,"#width")[0].value,Re(r,"#height")[0].value),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",r)},exec:function(e){var r=this;mt.image._dropDown(r,e,"",function(e,t,n){var o="";t&&(o+=' width="'+parseInt(t,10)+'"'),n&&(o+=' height="'+parseInt(n,10)+'"'),o+=' src="'+ft(e)+'"',r.wysiwygEditorInsertHtml("<img"+o+" />")})},tooltip:"Insert an image"},email:{_dropDown:function(n,e,o){var r=De("div");Ae(r,pt("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),Fe(r,"click",".button",function(e){var t=Re(r,"#email")[0].value;t&&o(t,Re(r,"#des")[0].value),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"insertemail",r)},exec:function(e){var n=this;mt.email._dropDown(n,e,function(e,t){!n.getRangeHelper().selectedHtml()||t?n.wysiwygEditorInsertHtml('<a href="mailto:'+ft(e)+'">'+ft(t||e)+"</a>"):n.execCommand("createlink","mailto:"+e)})},tooltip:"Insert an email"},link:{_dropDown:function(t,e,n){var o=De("div");Ae(o,pt("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0));var r=Re(o,"#link")[0];function i(e){r.value&&n(r.value,Re(o,"#des")[0].value),t.closeDropDown(!0),e.preventDefault()}Fe(o,"click",".button",i),Fe(o,"keypress",function(e){13===e.which&&r.value&&i(e)},_e),t.createDropDown(e,"insertlink",o)},exec:function(e){var n=this;mt.link._dropDown(n,e,function(e,t){t||!n.getRangeHelper().selectedHtml()?n.wysiwygEditorInsertHtml('<a href="'+ft(e)+'">'+ft(t||e)+"</a>"):n.execCommand("createlink",e)})},tooltip:"Insert a link"},unlink:{state:function(){return Ne(this.currentNode(),"a")?0:-1},exec:function(){var e=Ne(this.currentNode(),"a");if(e){for(;e.firstChild;)We(e.firstChild,e);Me(e)}},tooltip:"Unlink"},quote:{exec:function(e,t,n){var o="<blockquote>",r="</blockquote>";t?(o=o+(n=n?"<cite>"+ft(n)+"</cite>":"")+t+r,r=null):""===this.getRangeHelper().selectedHtml()&&(r="<br />"+r),this.wysiwygEditorInsertHtml(o,r)},tooltip:"Insert a Quote"},emoticon:{exec:function(u){var d=this,f=function(e){var n,t=d.opts,o=t.emoticonsRoot||"",r=t.emoticonsCompat,i=d.getRangeHelper(),a=r&&" "!==i.getOuterText(!0,1)?" ":"",l=r&&" "!==i.getOuterText(!1,1)?" ":"",s=De("div"),c=De("div"),i=we({},t.emoticons.dropdown,e?t.emoticons.more:{});return Ae(s,c),n=Math.sqrt(Object.keys(i).length),Fe(s,"click","img",function(e){d.insert(a+He(this,"alt")+l,null,!1).closeDropDown(!0),e.preventDefault()}),Ce(i,function(e,t){Ae(c,De("img",{src:o+(t.url||t),alt:e,title:t.tooltip||e})),c.children.length>=n&&(c=De("div"),Ae(s,c))}),!e&&t.emoticons.more&&(Ae(t=De("a",{className:"sceditor-more"}),document.createTextNode(d._("More"))),Fe(t,"click",function(e){d.createDropDown(u,"more-emoticons",f(!0)),e.preventDefault()}),Ae(s,t)),s};d.createDropDown(u,"emoticons",f(!1))},txtExec:function(e){mt.emoticon.exec.call(this,e)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(r,e,i){var a=De("div");Ae(a,pt("youtubeMenu",{label:r._("Video URL:"),insert:r._("Insert")},!0)),Fe(a,"click",".button",function(e){var t=Re(a,"#link")[0].value,n=t.match(/(?:v=|v\/|embed\/|youtu.be\/)?([a-zA-Z0-9_-]{11})/),t=t.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),o=0;t&&Ce(t[1].split(/[hms]/),function(e,t){""!==t&&(o=60*o+Number(t))}),n&&/^[a-zA-Z0-9_\-]{11}$/.test(n[1])&&i(n[1],o),r.closeDropDown(!0),e.preventDefault()}),r.createDropDown(e,"insertlink",a)},exec:function(e){var n=this;mt.youtube._dropDown(n,e,function(e,t){n.wysiwygEditorInsertHtml(pt("youtube",{id:e,time:t}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,t=t.getDate();return n<2e3&&(n=1900+n),o<10&&(o="0"+o),t<10&&(t="0"+t),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,t)},exec:function(){this.insertText(mt.date._date(this))},txtExec:function(){this.insertText(mt.date._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes(),e=e.getSeconds();return(t=t<10?"0"+t:t)+":"+(n=n<10?"0"+n:n)+":"+(e=e<10?"0"+e:e)},exec:function(){this.insertText(mt.time._time())},txtExec:function(){this.insertText(mt.time._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!Ue(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!Ue(t,"body")))&&(e="ltr"===Pe(t,"direction")?"":"ltr",Pe(t,"direction",e))},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!Ue(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!Ue(t,"body")))&&(e="rtl"===Pe(t,"direction")?"":"rtl",Pe(t,"direction",e))},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize()),this.focus()},txtExec:function(){this.maximize(!this.maximize()),this.focus()},tooltip:"Maximize",shortcut:"Ctrl+Shift+M"},source:{state:function(){return this.sourceMode()},exec:function(){this.toggleSourceMode(),this.focus()},txtExec:function(){this.toggleSourceMode(),this.focus()},tooltip:"View source",shortcut:"Ctrl+Shift+S"},ignore:{}},v={};function gt(i){function a(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)}function e(e,t){e=[].slice.call(e);for(var n,o=a(e.shift()),r=0;r<l.length;r++)if(o in l[r]&&(n=l[r][o].apply(i,e),t))return n}var r=this,l=[];r.call=function(){e(arguments,!1)},r.callOnlyFirst=function(){return e(arguments,!0)},r.hasHandler=function(e){var t=l.length;for(e=a(e);t--;)if(e in l[t])return!0;return!1},r.exists=function(e){return e in v&&("function"==typeof(e=v[e])&&"object"==typeof e.prototype)},r.isRegistered=function(e){if(r.exists(e))for(var t=l.length;t--;)if(l[t]instanceof v[e])return!0;return!1},r.register=function(e){return!(!r.exists(e)||r.isRegistered(e))&&(e=new v[e],l.push(e),"init"in e&&e.init.call(i),!0)},r.deregister=function(e){var t,n=l.length,o=!1;if(!r.isRegistered(e))return o;for(;n--;)l[n]instanceof v[e]&&(o=!0,"destroy"in(t=l.splice(n,1)[0])&&t.destroy.call(i));return o},r.destroy=function(){for(var e=l.length;e--;)"destroy"in l[e]&&l[e].destroy.call(i);l=[],i=null}}gt.plugins=v;var y=function(e,t,n){var o,r,i,a,l,s="",c=e.startContainer,u=e.startOffset;for(c&&3!==c.nodeType&&(c=c.childNodes[u],u=0),i=a=u;n>s.length&&c&&3===c.nodeType;)o=c.nodeValue,r=n-s.length,l&&(a=o.length,i=0),l=c,c=t?(u=i=Math.max(a-r,0),s=o.substr(i,a-i)+s,l.previousSibling):(u=i+(a=Math.min(r,o.length)),s+=o.substr(i,a),l.nextSibling);return{node:l||c,offset:u,text:s}};function ht(r,e,i){var a,l,s=e||r.contentDocument||r.document,c="sceditor-start-marker",u="sceditor-end-marker",h=this;h.insertHTML=function(e,t){var n,o;if(!h.selectedRange())return!1;for(t&&(e+=h.selectedHtml()+t),o=De("p",{},s),n=s.createDocumentFragment(),o.innerHTML=i(e);o.firstChild;)Ae(n,o.firstChild);h.insertNode(n)},l=function(e,t,n){var o,r=s.createDocumentFragment();if("string"==typeof e?(t&&(e+=h.selectedHtml()+t),r=et(e)):(Ae(r,e),t&&(Ae(r,h.selectedRange().extractContents()),Ae(r,t))),o=r.lastChild){for(;!rt(o.lastChild,!0);)o=o.lastChild;if(ot(o)?o.lastChild||Ae(o,document.createTextNode("​")):o=r,h.removeMarkers(),Ae(o,a(c)),Ae(o,a(u)),n){n=De("div");return Ae(n,r),n.innerHTML}return r}},h.insertNode=function(e,t){var n,o,r=l(e,t),e=h.selectedRange(),t=e.commonAncestorContainer,i=[];if(!r)return!1;function a(e){e&&d(e)&&i.indexOf(e)<0&&Me(e)}e.startContainer!==e.endContainer&&(Ce(t.childNodes,function(e,t){d(t)&&i.push(t)}),n=r.firstChild,o=r.lastChild),e.deleteContents(),t&&3!==t.nodeType&&!ot(t)?We(r,t):(e.insertNode(r),a(n&&n.previousSibling),a(o&&o.nextSibling)),h.restoreRange()},h.cloneSelected=function(){var e=h.selectedRange();if(e)return e.cloneRange()},h.selectedRange=function(){var e,t,n=r.getSelection();if(n){if(n.rangeCount<=0){for(t=s.body;t.firstChild;)t=t.firstChild;(e=s.createRange()).setStartBefore(t),n.addRange(e)}return e=0<n.rangeCount?n.getRangeAt(0):e}},h.hasSelection=function(){var e=r.getSelection();return e&&0<e.rangeCount},h.selectedHtml=function(){var e,t=h.selectedRange();return t?(Ae(e=De("p",{},s),t.cloneContents()),e.innerHTML):""},h.parentNode=function(){var e=h.selectedRange();if(e)return e.commonAncestorContainer},h.getFirstBlockParent=function(e){var t=function(e){return rt(e,!0)?(e=e?e.parentNode:null)&&t(e):e};return t(e||h.parentNode())},h.insertNodeAt=function(e,t){var n=h.selectedRange(),o=h.cloneSelected();if(!o)return!1;o.collapse(e),o.insertNode(t),h.selectRange(n)},a=function(e){h.removeMarker(e);e=De("span",{id:e,className:"sceditor-selection sceditor-ignore",style:"display:none;line-height:0"},s);return e.innerHTML=" ",e},h.insertMarkers=function(){var e=h.selectedRange(),t=a(c);h.removeMarkers(),h.insertNodeAt(!0,t),e&&e.collapsed?t.parentNode.insertBefore(a(u),t.nextSibling):h.insertNodeAt(!1,a(u))},h.getMarker=function(e){return s.getElementById(e)},h.removeMarker=function(e){e=h.getMarker(e);e&&Me(e)},h.removeMarkers=function(){h.removeMarker(c),h.removeMarker(u)},h.saveRange=function(){h.insertMarkers()},h.selectRange=function(e){var t,n=r.getSelection(),o=e.endContainer;if(e.collapsed&&o&&!rt(o,!0)){for(t=o.lastChild;t&&Ue(t,".sceditor-ignore");)t=t.previousSibling;Ue(t,"br")&&((o=s.createRange()).setEndAfter(t),o.collapse(!1),h.compare(e,o)&&(e.setStartBefore(t),e.collapse(!0)))}n&&(h.clear(),n.addRange(e))},h.restoreRange=function(){var e,t=h.selectedRange(),n=h.getMarker(c),o=h.getMarker(u);if(!n||!o||!t)return!1;e=n.nextSibling===o,(t=s.createRange()).setStartBefore(n),t.setEndAfter(o),e&&t.collapse(!0),h.selectRange(t),h.removeMarkers()},h.selectOuterText=function(e,t){var n=h.cloneSelected();if(!n)return!1;n.collapse(!1),e=y(n,!0,e),t=y(n,!1,t),n.setStart(e.node,e.offset),n.setEnd(t.node,t.offset),h.selectRange(n)},h.getOuterText=function(e,t){var n=h.cloneSelected();return n?(n.collapse(!e),y(n,e,t).text):""},h.replaceKeyword=function(e,t,n,o,r,i){n||e.sort(function(e,t){return e[0].length-t[0].length});var a,l,s,c,u,d,f,p="(^|[\\s    ])",m=e.length,g=r?1:0,o=o||e[m-1][0].length;for(r&&o++,i=i||"",c=(a=h.getOuterText(!0,o)).length,a+=i,t&&(a+=h.getOuterText(!1,o));m--;)if(d=e[m][0],f=d.length,s=Math.max(0,c-f-g),u=-1,r?(l=a.substr(s).match(new RegExp(p+dt(d)+p)))&&(u=l.index+s+l[1].length):u=a.indexOf(d,s),-1<u&&u<=c&&c<=u+f+g)return u=c-u,h.selectOuterText(u,f-u-(/^\S/.test(i)?1:0)),h.insertHTML(e[m][1]),!0;return!1},h.compare=function(e,t){return t=t||h.selectedRange(),e&&t?0===e.compareBoundaryPoints(Range.END_TO_END,t)&&0===e.compareBoundaryPoints(Range.START_TO_START,t):!e&&!t},h.clear=function(){var e=r.getSelection();e&&(e.removeAllRanges?e.removeAllRanges():e.empty&&e.empty())}}var b,x,w,T=navigator.userAgent,vt=/iPhone|iPod|iPad| wosbrowser\//i.test(T),yt=(x=!!window.document.documentMode,N="-ms-ime-align"in document.documentElement.style,(A=document.createElement("div")).contentEditable=!0,"contentEditable"in document.documentElement&&"true"===A.contentEditable&&(A=/Opera Mobi|Opera Mini/i.test(T),/Android/i.test(T)&&(A=!0,/Safari/.test(T)&&(A=!(b=/Safari\/(\d+)/.exec(T))||!b[1]||b[1]<534)),/ Silk\//i.test(T)&&(A=!(b=/AppleWebKit\/(\d+)/.exec(T))||!b[1]||b[1]<534),vt&&(A=/OS [0-4](_\d)+ like Mac/i.test(T)),/Firefox/i.test(T)&&(A=!1),/OneBrowser/i.test(T)&&(A=!1),"UCWEB"===navigator.vendor&&(A=!1),!(A=x||N?!0:A))),C=Object.hasOwnProperty,S=Object.setPrototypeOf,k=Object.isFrozen,D=Object.getPrototypeOf,E=Object.getOwnPropertyDescriptor,bt=Object.freeze,N=Object.seal,M=Object.create,A="undefined"!=typeof Reflect&&Reflect,R=(R=A.apply)||function(e,t,n){return e.apply(t,n)},bt=bt||function(e){return e},N=N||function(e){return e},_=(_=A.construct)||function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))},xt=F(Array.prototype.forEach),wt=F(Array.prototype.pop),Tt=F(Array.prototype.push),Ct=F(String.prototype.toLowerCase),St=F(String.prototype.match),kt=F(String.prototype.replace),Dt=F(String.prototype.indexOf),Et=F(String.prototype.trim),Nt=F(RegExp.prototype.test),Mt=(w=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return _(w,t)});function F(r){return function(e){for(var t=arguments.length,n=Array(1<t?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return R(r,e,n)}}function At(e,t){S&&S(e,null);for(var n=t.length;n--;){var o,r=t[n];"string"!=typeof r||(o=Ct(r))!==r&&(k(t)||(t[n]=o),r=o),e[r]=!0}return e}function Rt(e){var t=M(null),n=void 0;for(n in e)R(C,e,[n])&&(t[n]=e[n]);return t}function _t(e,t){for(;null!==e;){var n=E(e,t);if(n){if(n.get)return F(n.get);if("function"==typeof n.value)return F(n.value)}e=D(e)}return null}var Ft=bt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ot=bt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ht=bt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zt=bt(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Lt=bt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),It=bt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Bt=bt(["#text"]),Pt=bt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns"]),jt=bt(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ut=bt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Wt=bt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vt=N(/\{\{[\s\S]*|[\s\S]*\}\}/gm),qt=N(/<%[\s\S]*|[\s\S]*%>/gm),Gt=N(/^data-[\-\w.\u00B7-\uFFFF]/),$t=N(/^aria-[\-\w]+$/),Yt=N(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kt=N(/^(?:\w+script|data):/i),Xt=N(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Qt(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var Jt=function(){return"undefined"==typeof window?null:window},en=function(e,t){if("object"!==(void 0===e?"undefined":Zt(e))||"function"!=typeof e.createPolicy)return null;var n=null,o="data-tt-policy-suffix",r="dompurify"+((n=t.currentScript&&t.currentScript.hasAttribute(o)?t.currentScript.getAttribute(o):n)?"#"+n:"");try{return e.createPolicy(r,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}},tn=function t(e){function u(e){return t(e)}var l=0<arguments.length&&void 0!==e?e:Jt();if(u.version="2.2.6",u.removed=[],!l||!l.document||9!==l.document.nodeType)return u.isSupported=!1,u;var s=l.document,i=l.document,c=l.DocumentFragment,n=l.HTMLTemplateElement,d=l.Node,a=l.Element,o=l.NodeFilter,r=l.NamedNodeMap,f=void 0===r?l.NamedNodeMap||l.MozNamedAttrMap:r,p=l.Text,m=l.Comment,g=l.DOMParser,e=l.trustedTypes,r=a.prototype,h=_t(r,"cloneNode"),v=_t(r,"nextSibling"),y=_t(r,"childNodes"),b=_t(r,"parentNode");"function"!=typeof n||(n=i.createElement("template")).content&&n.content.ownerDocument&&(i=n.content.ownerDocument);var x=en(e,s),w=x&&ee?x.createHTML(""):"",T=i.implementation,C=i.createNodeIterator,S=i.getElementsByTagName,k=i.createDocumentFragment,D=s.importNode,E={};try{E=Rt(i).documentMode?i.documentMode:{}}catch(e){}var N={};u.isSupported=T&&void 0!==T.createHTMLDocument&&9!==E;function M(e){ce&&ce===e||(e=Rt(e=e&&"object"===(void 0===e?"undefined":Zt(e))?e:{}),I="ALLOWED_TAGS"in e?At({},e.ALLOWED_TAGS):B,P="ALLOWED_ATTR"in e?At({},e.ALLOWED_ATTR):j,le="ADD_URI_SAFE_ATTR"in e?At(Rt(se),e.ADD_URI_SAFE_ATTR):se,ie="ADD_DATA_URI_TAGS"in e?At(Rt(ae),e.ADD_DATA_URI_TAGS):ae,U="FORBID_TAGS"in e?At({},e.FORBID_TAGS):{},W="FORBID_ATTR"in e?At({},e.FORBID_ATTR):{},A="USE_PROFILES"in e&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,G=e.ALLOW_UNKNOWN_PROTOCOLS||!1,$=e.SAFE_FOR_TEMPLATES||!1,Y=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,J=!1!==e.RETURN_DOM_IMPORT,ee=e.RETURN_TRUSTED_TYPE||!1,X=e.FORCE_BODY||!1,te=!1!==e.SANITIZE_DOM,ne=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||L,$&&(q=!1),Q&&(Z=!0),A&&(I=At({},[].concat(Qt(Bt))),P=[],!0===A.html&&(At(I,Ft),At(P,Pt)),!0===A.svg&&(At(I,Ot),At(P,jt),At(P,Wt)),!0===A.svgFilters&&(At(I,Ht),At(P,jt),At(P,Wt)),!0===A.mathMl&&(At(I,Lt),At(P,Ut),At(P,Wt))),e.ADD_TAGS&&At(I=I===B?Rt(I):I,e.ADD_TAGS),e.ADD_ATTR&&At(P=P===j?Rt(P):P,e.ADD_ATTR),e.ADD_URI_SAFE_ATTR&&At(le,e.ADD_URI_SAFE_ATTR),ne&&(I["#text"]=!0),Y&&At(I,["html","head","body"]),I.table&&(At(I,["tbody"]),delete U.tbody),bt&&bt(e),ce=e)}var A,R=Vt,_=qt,F=Gt,O=$t,H=Kt,z=Xt,L=Yt,I=null,B=At({},[].concat(Qt(Ft),Qt(Ot),Qt(Ht),Qt(Lt),Qt(Bt))),P=null,j=At({},[].concat(Qt(Pt),Qt(jt),Qt(Ut),Qt(Wt))),U=null,W=null,V=!0,q=!0,G=!1,$=!1,Y=!1,K=!1,X=!1,Z=!1,Q=!1,J=!0,ee=!1,te=!0,ne=!0,oe=!1,re=At({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ie=null,ae=At({},["audio","video","img","source","image","track"]),le=null,se=At({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ce=null,ue=i.createElement("form"),de=At({},["mi","mo","mn","ms","mtext"]),fe=At({},["foreignobject","desc","title","annotation-xml"]),pe=At({},Ot);At(pe,Ht),At(pe,zt);var me=At({},Lt);At(me,It);function ge(t){Tt(u.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=w}catch(e){t.remove()}}}function he(e,t){try{Tt(u.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Tt(u.removed,{attribute:null,from:t})}t.removeAttribute(e)}function ve(e){var t=void 0,n=void 0;X?e="<remove></remove>"+e:n=(o=St(e,/^[\r\n\t ]+/))&&o[0];var o,r=x?x.createHTML(e):e;try{t=(new g).parseFromString(r,"text/html")}catch(e){}return t&&t.documentElement||((o=(t=T.createHTMLDocument("")).body).parentNode.removeChild(o.parentNode.firstElementChild),o.outerHTML=r),e&&n&&t.body.insertBefore(i.createTextNode(n),t.body.childNodes[0]||null),S.call(t,Y?"html":"body")[0]}function ye(e){return C.call(e.ownerDocument||e,e,o.SHOW_ELEMENT|o.SHOW_COMMENT|o.SHOW_TEXT,function(){return o.FILTER_ACCEPT},!1)}function be(e){return"object"===(void 0===d?"undefined":Zt(d))?e instanceof d:e&&"object"===(void 0===e?"undefined":Zt(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function xe(e,t,n){N[e]&&xt(N[e],function(e){e.call(u,t,n,ce)})}function we(e){var t;if(xe("beforeSanitizeElements",e,null),!((n=e)instanceof p||n instanceof m||"string"==typeof n.nodeName&&"string"==typeof n.textContent&&"function"==typeof n.removeChild&&n.attributes instanceof f&&"function"==typeof n.removeAttribute&&"function"==typeof n.setAttribute&&"string"==typeof n.namespaceURI&&"function"==typeof n.insertBefore))return ge(e),1;if(St(e.nodeName,/[\u0080-\uFFFF]/))return ge(e),1;var n=Ct(e.nodeName);if(xe("uponSanitizeElement",e,{tagName:n,allowedTags:I}),!be(e.firstElementChild)&&(!be(e.content)||!be(e.content.firstElementChild))&&Nt(/<[/\w]/g,e.innerHTML)&&Nt(/<[/\w]/g,e.textContent))return ge(e),1;if(I[n]&&!U[n])return e instanceof a&&!function(e){var t=b(e);t&&t.tagName||(t={namespaceURI:Ee,tagName:"template"});var n=Ct(e.tagName),o=Ct(t.tagName);return e.namespaceURI===De?t.namespaceURI===Ee?"svg"===n:t.namespaceURI===ke?"svg"===n&&("annotation-xml"===o||de[o]):Boolean(pe[n]):e.namespaceURI===ke?t.namespaceURI===Ee?"math"===n:t.namespaceURI===De?"math"===n&&fe[o]:Boolean(me[n]):e.namespaceURI===Ee&&((t.namespaceURI!==De||fe[o])&&((t.namespaceURI!==ke||de[o])&&(o=At({},["title","style","font","a","script"]),!me[n]&&(o[n]||!pe[n]))))}(e)||("noscript"===n||"noembed"===n)&&Nt(/<\/no(script|embed)/i,e.innerHTML)?(ge(e),1):($&&3===e.nodeType&&(t=e.textContent,t=kt(t,R," "),t=kt(t,_," "),e.textContent!==t&&(Tt(u.removed,{element:e.cloneNode()}),e.textContent=t)),xe("afterSanitizeElements",e,null),0);if(ne&&!re[n])for(var o=b(e),r=y(e),i=r.length-1;0<=i;--i)o.insertBefore(h(r[i],!0),v(e));return ge(e),1}function Te(e,t,n){if(te&&("id"===t||"name"===t)&&(n in i||n in ue))return!1;if(!(q&&Nt(F,t)||V&&Nt(O,t))){if(!P[t]||W[t])return!1;if(!le[t]&&!Nt(L,kt(n,z,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Dt(n,"data:")||!ie[e])&&(!G||Nt(H,kt(n,z,"")))&&n)return!1}return!0}function Ce(e){var t=void 0,n=void 0,o=void 0;xe("beforeSanitizeAttributes",e,null);var r=e.attributes;if(r){for(var i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P},o=r.length;o--;){var a=(t=r[o]).name,l=t.namespaceURI,n=Et(t.value),s=Ct(a);if(i.attrName=s,i.attrValue=n,i.keepAttr=!0,i.forceKeepAttr=void 0,xe("uponSanitizeAttribute",e,i),n=i.attrValue,!i.forceKeepAttr&&(he(a,e),i.keepAttr))if(Nt(/\/>/i,n))he(a,e);else{$&&(n=kt(n,R," "),n=kt(n,_," "));var c=e.nodeName.toLowerCase();if(Te(c,s,n))try{l?e.setAttributeNS(l,a,n):e.setAttribute(a,n),wt(u.removed)}catch(e){}}}xe("afterSanitizeAttributes",e,null)}}function Se(e){var t,n=ye(e);for(xe("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)xe("uponSanitizeShadowNode",t,null),we(t)||(t.content instanceof c&&Se(t.content),Ce(t));xe("afterSanitizeShadowDOM",e,null)}var ke="http://www.w3.org/1998/Math/MathML",De="http://www.w3.org/2000/svg",Ee="http://www.w3.org/1999/xhtml";return u.sanitize=function(e,t){var n,o=void 0,r=void 0,i=void 0;if("string"!=typeof(e=e||"\x3c!--\x3e")&&!be(e)){if("function"!=typeof e.toString)throw Mt("toString is not a function");if("string"!=typeof(e=e.toString()))throw Mt("dirty is not a string, aborting")}if(!u.isSupported){if("object"===Zt(l.toStaticHTML)||"function"==typeof l.toStaticHTML){if("string"==typeof e)return l.toStaticHTML(e);if(be(e))return l.toStaticHTML(e.outerHTML)}return e}if(K||M(t),u.removed=[],"string"==typeof e&&(oe=!1),!oe)if(e instanceof d)1===(t=(o=ve("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===t.nodeName||"HTML"===t.nodeName?o=t:o.appendChild(t);else{if(!Z&&!$&&!Y&&-1===e.indexOf("<"))return x&&ee?x.createHTML(e):e;if(!(o=ve(e)))return Z?null:w}o&&X&&ge(o.firstChild);for(var a=ye(oe?e:o);n=a.nextNode();)3===n.nodeType&&n===r||we(n)||(n.content instanceof c&&Se(n.content),Ce(n),r=n);if(r=null,oe)return e;if(Z){if(Q)for(i=k.call(o.ownerDocument);o.firstChild;)i.appendChild(o.firstChild);else i=o;return i=J?D.call(s,i,!0):i}return e=Y?o.outerHTML:o.innerHTML,$&&(e=kt(e,R," "),e=kt(e,_," ")),x&&ee?x.createHTML(e):e},u.setConfig=function(e){M(e),K=!0},u.clearConfig=function(){ce=null,K=!1},u.isValidAttribute=function(e,t,n){return ce||M({}),e=Ct(e),t=Ct(t),Te(e,t,n)},u.addHook=function(e,t){"function"==typeof t&&(N[e]=N[e]||[],Tt(N[e],t))},u.removeHook=function(e){N[e]&&wt(N[e])},u.removeHooks=function(e){N[e]&&(N[e]=[])},u.removeAllHooks=function(){N={}},u}(),nn=window,on=document,rn=/^image\/(p?jpe?g|gif|png|bmp)$/i;function an(r,e){var a,x,u,i,l,f,d,s,o,c,p,t,m,g,h,v,y,b,n,w,T,C,S,k,D,E,N,M,A,R,_,F,O,H,z,L,I,B,P,j,U,W,V,q,G,$,Y,K,X,Z,Q,J,ee,te,ne,oe,re,ie,ae,le,se=this,ce={},ue=[],de=[],fe={},pe={},me={};se.commands=we(!0,{},e.commands||mt);var ge=se.opts=we(!0,{},ut,e);se.opts.emoticons=e.emoticons||ut.emoticons,Array.isArray(ge.allowedIframeUrls)||(ge.allowedIframeUrls=[]),ge.allowedIframeUrls.push("https://www.youtube-nocookie.com/embed/");var he=tn();function ve(e){return he.sanitize(e,{ADD_TAGS:["iframe"],ADD_ATTR:["allowfullscreen","frameborder","target"]})}he.addHook("uponSanitizeElement",function(e,t){var n=ge.allowedIframeUrls;if("iframe"===t.tagName){for(var o=He(e,"src")||"",r=0;r<n.length;r++){var i=n[r];if(ye(i)&&o.substr(0,i.length)===i)return;if(i.test&&i.test(o))return}Me(e)}}),he.addHook("afterSanitizeAttributes",function(e){"target"in e&&He(e,"data-sce-target",He(e,"target")),ze(e,"target")}),e=function(){r._sceditor=se,ge.locale&&"en"!==ge.locale&&A(),We(x=De("div",{className:"sceditor-container"}),r),Pe(x,"z-index",ge.zIndex),n=r.required,r.required=!1;var e=an.formats[ge.format];a=e?new e:{},g=new gt(se),(ge.plugins||"").split(",").forEach(function(e){g.register(e.trim())}),"init"in a&&a.init.call(se),H(),R(),M(),_(),F(),yt||se.toggleSourceMode(),Y();var t=function(){Oe(nn,"load",t),ge.autofocus&&J(!!ge.autofocusEnd),le(),X(),g.call("ready"),"onReady"in a&&a.onReady.call(se)};Fe(nn,"load",t),"complete"===on.readyState&&t()},A=function(){var e;(t=an.locale[ge.locale])||(e=ge.locale.split("-"),t=an.locale[e[0]]),t&&t.dateFormat&&(ge.dateFormat=t.dateFormat)},M=function(){s=De("textarea"),i=De("iframe",{frameborder:0,allowfullscreen:!0}),ge.startInSourceMode?(qe(x,"sourceMode"),Le(i)):(qe(x,"wysiwygMode"),Le(s)),ge.spellcheck||He(x,"spellcheck","false"),"https:"===nn.location.protocol&&He(i,"src","about:blank"),Ae(x,i),Ae(x,s),se.dimensions(ge.width||Ye(r),ge.height||Ke(r));var e=vt?" ios":"";(d=i.contentDocument).open(),d.write(pt("html",{attrs:' class="'+e+'"',spellcheck:ge.spellcheck?"":'spellcheck="false"',charset:ge.charset,style:ge.style})),d.close(),f=d.body,l=i.contentWindow,se.readOnly(!!ge.readOnly),vt&&(Ke(f,"100%"),Fe(f,"touchend",se.focus));e=He(r,"tabindex");He(s,"tabindex",e),He(i,"tabindex",e),m=new ht(l,null,ve),Le(r),se.val(r.value);e=ge.placeholder||He(r,"placeholder");e&&(s.placeholder=e,He(f,"placeholder",e))},_=function(){ge.autoUpdate&&(Fe(f,"blur",ae),Fe(s,"blur",ae)),null===ge.rtl&&(ge.rtl="rtl"===Pe(s,"direction")),se.rtl(!!ge.rtl),ge.autoExpand&&(Fe(f,"load",le,_e),Fe(f,"input keyup",le)),ge.resizeEnabled&&O(),He(x,"id",ge.id),se.emoticons(ge.emoticonsEnabled)},F=function(){var e=r.form,t="compositionstart compositionend",n="keydown keyup keypress focus blur contextmenu input",o="onselectionchange"in d?"selectionchange":"keyup focus blur contextmenu mouseup touchend click";Fe(on,"click",G),e&&(Fe(e,"reset",U),Fe(e,"submit",se.updateOriginal,_e)),Fe(window,"pagehide",se.updateOriginal),Fe(window,"pageshow",U),Fe(f,"keypress",j),Fe(f,"keydown",B),Fe(f,"keydown",P),Fe(f,"keyup",X),Fe(f,"blur",re),Fe(f,"keyup",ie),Fe(f,"paste",z),Fe(f,"cut copy",L),Fe(f,t,V),Fe(f,o,Z),Fe(f,n,q),ge.emoticonsCompat&&nn.getSelection&&Fe(f,"keyup",te),Fe(f,"blur",function(){se.val()||qe(f,"placeholder")}),Fe(f,"focus",function(){Ge(f,"placeholder")}),Fe(s,"blur",re),Fe(s,"keyup",ie),Fe(s,"keydown",B),Fe(s,t,V),Fe(s,n,q),Fe(d,"mousedown",W),Fe(d,o,Z),Fe(d,"keyup",X),Fe(x,"selectionchanged",Q),Fe(x,"selectionchanged",Y),Fe(x,"selectionchanged valuechanged nodechanged pasteraw paste",q)},R=function(){var i,a=se.commands,l=(ge.toolbarExclude||"").split(","),e=ge.toolbar.split("|");u=De("div",{className:"sceditor-toolbar",unselectable:"on"}),ge.icons in an.icons&&(D=new an.icons[ge.icons]),Ce(e,function(e,t){i=De("div",{className:"sceditor-group"}),Ce(t.split(","),function(e,t){var n,o,r=a[t];!r||-1<l.indexOf(t)||(n=r.shortcut,o=pt("toolbarButton",{name:t,dispName:se._(r.name||r.tooltip||t)},!0).firstChild,D&&D.create&&D.create(t)&&(We(D.create(t),o.firstChild),qe(o,"has-icon")),o._sceTxtMode=!!r.txtExec,o._sceWysiwygMode=!!r.exec,$e(o,"disabled",!r.exec),Fe(o,"click",function(e){Ve(o,"disabled")||N(o,r),Y(),e.preventDefault()}),Fe(o,"mousedown",function(e){se.closeDropDown(),e.preventDefault()}),r.tooltip&&He(o,"title",se._(r.tooltip)+(n?" ("+n+")":"")),n&&se.addShortcut(n,t),r.state?de.push({name:t,state:r.state}):ye(r.exec)&&de.push({name:t,state:r.exec}),Ae(i,o),pe[t]=o)}),i.firstChild&&Ae(u,i)}),Ae(ge.toolbarContainer||x,u)},O=function(){var e=De("div",{className:"sceditor-grip"}),t=De("div",{className:"sceditor-resize-cover"}),n="touchmove mousemove",o="touchcancel touchend mouseup",r=0,i=0,a=0,l=0,s=0,c=0,u=Ye(x),d=Ke(x),f=!1,p=se.rtl(),m=ge.resizeMinHeight||d/1.5,g=ge.resizeMaxHeight||2.5*d,h=ge.resizeMinWidth||u/1.25,v=ge.resizeMaxWidth||1.25*u,y=function(e){l="touchmove"===e.type?(e=nn.event,a=e.changedTouches[0].pageX,e.changedTouches[0].pageY):(a=e.pageX,e.pageY);var t=c+(l-i),n=p?s-(a-r):s+(a-r);0<v&&v<n&&(n=v),0<h&&n<h&&(n=h),ge.resizeWidth||(n=!1),0<g&&g<t&&(t=g),0<m&&t<m&&(t=m),ge.resizeHeight||(t=!1),(n||t)&&se.dimensions(n,t),e.preventDefault()},b=function(e){f&&(f=!1,Le(t),Ge(x,"resizing"),Oe(on,n,y),Oe(on,o,b),e.preventDefault())};D&&D.create&&((u=D.create("grip"))&&(Ae(e,u),qe(e,"has-icon"))),Ae(x,e),Ae(x,t),Le(t),Fe(e,"touchstart mousedown",function(e){i="touchstart"===e.type?(e=nn.event,r=e.touches[0].pageX,e.touches[0].pageY):(r=e.pageX,e.pageY),s=Ye(x),c=Ke(x),f=!0,qe(x,"resizing"),Ie(t),Fe(on,n,y),Fe(on,o,b),e.preventDefault()})},H=function(){var e=ge.emoticons,n=ge.emoticonsRoot||"";Ce(me=e?we({},e.more,e.dropdown,e.hidden):me,function(e,t){me[e]=pt("emoticon",{key:e,url:n+(t.url||t),tooltip:t.tooltip||e}),ge.emoticonsEnabled&&ue.push(De("img",{src:n+(t.url||t)}))})},J=function(e){var t,n=f.firstChild;if(Ze(x)){if(se.sourceMode())return t=e?s.value.length:0,void s.setSelectionRange(t,t);if(at(f),e)for((n=f.lastChild)||(n=De("p",{},d),Ae(f,n));n.lastChild;)Ue(n=n.lastChild,"br")&&n.previousSibling&&(n=n.previousSibling);t=d.createRange(),ot(n)?t.selectNodeContents(n):(t.setStartBefore(n),e&&t.setStartAfter(n)),t.collapse(!e),m.selectRange(t),y=t,e&&(f.scrollTop=f.scrollHeight),se.focus()}},se.readOnly=function(e){return"boolean"!=typeof e?!s.readonly:(f.contentEditable=!e,s.readonly=!e,$(e),se)},se.rtl=function(e){var t=e?"rtl":"ltr";return"boolean"!=typeof e?"rtl"===He(s,"dir"):(He(f,"dir",t),He(s,"dir",t),Ge(x,"rtl"),Ge(x,"ltr"),qe(x,t),D&&D.rtl&&D.rtl(e),se)},$=function(n){var o=se.inSourceMode()?"_sceTxtMode":"_sceWysiwygMode";Ce(pe,function(e,t){$e(t,"disabled",n||!t[o])})},se.width=function(e,t){return e||0===e?(se.dimensions(e,null,t),se):Ye(x)},se.dimensions=function(e,t,n){return t=!(!t&&0!==t)&&t,!1===(e=!(!e&&0!==e)&&e)&&!1===t?{width:se.width(),height:se.height()}:(!1!==e&&(!1!==n&&(ge.width=e),Ye(x,e)),!1!==t&&(!1!==n&&(ge.height=t),Ke(x,t)),se)},se.height=function(e,t){return e||0===e?(se.dimensions(null,e,t),se):Ke(x)},se.maximize=function(e){var t="sceditor-maximize";return be(e)?Ve(x,t):((e=!!e)&&(S=nn.pageYOffset),$e(on.documentElement,t,e),$e(on.body,t,e),$e(x,t,e),se.width(e?"100%":ge.width,!1),se.height(e?"100%":ge.height,!1),e||nn.scrollTo(0,S),le(),se)},le=function(){ge.autoExpand&&!C&&(C=setTimeout(se.expandToContent,200))},se.expandToContent=function(e){var t,n;se.maximize()||(clearTimeout(C),C=!1,T||(t=ge.resizeMinHeight||ge.height||Ke(r),T={min:t,max:ge.resizeMaxHeight||2*t}),(n=on.createRange()).selectNodeContents(f),t=n.getBoundingClientRect(),n=d.documentElement.clientHeight-1,t=t.bottom-t.top,n=se.height()+1+(t-n),e||-1===T.max||(n=Math.min(n,T.max)),se.height(Math.ceil(Math.max(n,T.min))))},se.destroy=function(){var e;g&&(g.destroy(),g=m=null,o&&Me(o),Oe(on,"click",G),(e=r.form)&&(Oe(e,"reset",U),Oe(e,"submit",se.updateOriginal,_e)),Oe(window,"pagehide",se.updateOriginal),Oe(window,"pageshow",U),Me(s),Me(u),Me(x),delete r._sceditor,Ie(r),r.required=n)},se.createDropDown=function(e,t,n){t="sceditor-"+t;se.closeDropDown(),o&&Ve(o,t)||(e=we({top:e.offsetTop,left:e.offsetLeft,marginTop:e.clientHeight},ge.dropDownCss),Pe(o=De("div",{className:"sceditor-dropdown "+t}),e),Ae(o,n),Ae(x,o),Fe(o,"click focusin",function(e){e.stopPropagation()}),!o||(n=Re(o,"input,textarea")[0])&&n.focus())},G=function(e){3!==e.which&&o&&!e.defaultPrevented&&(ae(),se.closeDropDown())},L=function(e){var t=m.selectedRange();if(t){for(var n,o,r=De("div",{},d),i=t.commonAncestorContainer;i&&rt(i,!0);)i.nodeType===Se&&(o=i.cloneNode(),r.firstChild&&Ae(o,r.firstChild),Ae(r,o),n=n||o),i=i.parentNode;Ae(n||r,t.cloneContents()),at(r),e.clipboardData.setData("text/html",r.innerHTML),Ce(Re(r,"p"),function(e,t){nt(t,"div")}),Ce(Re(r,"br"),function(e,t){t.nextSibling&&rt(t.nextSibling,!0)||Me(t)}),Ae(f,r),e.clipboardData.setData("text/plain",r.innerText),Me(r),"cut"===e.type&&t.deleteContents(),e.preventDefault()}},z=function(e){var t,n,o=f,r=e.clipboardData;if(r){var i={},a=r.types,l=r.items;e.preventDefault();for(var s=0;s<a.length;s++){if(a.indexOf("text/html")<0&&nn.FileReader&&l&&rn.test(l[s].type))return t=r.items[s].getAsFile(),n=void 0,(n=new FileReader).onload=function(e){I({html:'<img src="'+e.target.result+'" />'})},void n.readAsDataURL(t);i[a[s]]=r.getData(a[s])}i.text=i["text/plain"],i.html=ve(i["text/html"]),I(i)}else if(!k){var c=o.scrollTop;for(m.saveRange(),k=on.createDocumentFragment();o.firstChild;)Ae(k,o.firstChild);setTimeout(function(){var e=o.innerHTML;o.innerHTML="",Ae(o,k),o.scrollTop=c,k=!1,m.restoreRange(),I({html:ve(e)})},0)}},I=function(e){var t=De("div",{},d);g.call("pasteRaw",e),Xe(x,"pasteraw",e),e.html?(t.innerHTML=ve(e.html),it(t)):t.innerHTML=ft(e.text||"");e={val:t.innerHTML};"fragmentToSource"in a&&(e.val=a.fragmentToSource(e.val,d,h)),g.call("paste",e),Xe(x,"paste",e),"fragmentToHtml"in a&&(e.val=a.fragmentToHtml(e.val,h)),g.call("pasteHtml",e);t=m.getFirstBlockParent();se.wysiwygEditorInsertHtml(e.val,null,!0),function e(t){if(t.nodeType===Se){for(var n=t.parentNode,o=t.tagName,r=t.childNodes.length;r--;)e(t.childNodes[r]);if(rt(t)){for(r=t.style.length;r--;){var i=t.style[r];Pe(n,i)===Pe(t,i)&&t.style.removeProperty(i)}if(!t.style.length)if(ze(t,"style"),"FONT"===o&&(Pe(t,"fontFamily").toLowerCase()===Pe(n,"fontFamily").toLowerCase()&&ze(t,"face"),Pe(t,"color")===Pe(n,"color")&&ze(t,"color"),Pe(t,"fontSize")===Pe(n,"fontSize")&&ze(t,"size")),!t.attributes.length&&/SPAN|FONT/.test(o))ct(t);else if(/B|STRONG|EM|SPAN|FONT/.test(o))for(var a=/B|STRONG/.test(o),l="EM"===o;n&&rt(n)&&(!a||/bold|700/i.test(Pe(n,"fontWeight")))&&(!l||"italic"===Pe(n,"fontStyle"));){if((n.tagName===o||a&&/B|STRONG/.test(n.tagName))&&st(n,t)){ct(t);break}n=n.parentNode}var s=t.nextSibling;s&&s.tagName===o&&st(s,t)&&(Ae(t,s),ct(s))}}}(t)},se.closeDropDown=function(e){o&&(Me(o),o=null),!0===e&&se.focus()},se.wysiwygEditorInsertHtml=function(e,t,n){var o=Ke(i);se.focus(),!n&&Ne(v,"code")||(m.insertHTML(e,t),m.saveRange(),E(),it(f),Ie(n=Re(f,"#sceditor-end-marker")[0]),e=f.scrollTop,t=lt(n).top+1.5*n.offsetHeight-o,Le(n),(e<t||t+o<e)&&(f.scrollTop=t),oe(!1),m.restoreRange(),X())},se.wysiwygEditorInsertText=function(e,t){se.wysiwygEditorInsertHtml(ft(e),ft(t))},se.insertText=function(e,t){return se.inSourceMode()?se.sourceEditorInsertText(e,t):se.wysiwygEditorInsertText(e,t),se},se.sourceEditorInsertText=function(e,t){var n,o=s.selectionStart,r=s.selectionEnd,i=s.scrollTop;s.focus(),n=s.value,t&&(e+=n.substring(o,r)+t),s.value=n.substring(0,o)+e+n.substring(r,n.length),s.selectionStart=o+e.length-(t?t.length:0),s.selectionEnd=s.selectionStart,s.scrollTop=i,s.focus(),oe()},se.getRangeHelper=function(){return m},se.sourceEditorCaret=function(e){return s.focus(),e?(s.selectionStart=e.start,s.selectionEnd=e.end,this):{start:s.selectionStart,end:s.selectionEnd}},se.val=function(e,t){return ye(e)?(se.inSourceMode()?se.setSourceEditorValue(e):(!1!==t&&"toHtml"in a&&(e=a.toHtml(e)),se.setWysiwygEditorValue(e)),se):se.inSourceMode()?se.getSourceEditorValue(!1):se.getWysiwygEditorValue(t)},se.insert=function(e,t,n,o,r){return se.inSourceMode()?se.sourceEditorInsertText(e,t):(t&&(i=m.selectedHtml(),e+=(i=!1!==n&&"fragmentToSource"in a?a.fragmentToSource(i,d,h):i)+t),!1!==n&&"fragmentToHtml"in a&&(e=a.fragmentToHtml(e,h)),!1!==n&&!0===r&&(e=e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")),se.wysiwygEditorInsertHtml(e)),se;var i},se.getWysiwygEditorValue=function(e){for(var t,n=De("div",{},d),o=f.childNodes,r=0;r<o.length;r++)Ae(n,o[r].cloneNode(!0));return Ae(f,n),it(n),Me(n),t=n.innerHTML,t=!1!==e&&a.hasOwnProperty("toSource")?a.toSource(t,d):t},se.getBody=function(){return f},se.getContentAreaContainer=function(){return i},se.getSourceEditorValue=function(e){var t=s.value;return t=!1!==e&&"toHtml"in a?a.toHtml(t):t},se.setWysiwygEditorValue=function(e){e=e||"<p><br /></p>",f.innerHTML=ve(e),E(),X(),oe(),le()},se.setSourceEditorValue=function(e){s.value=e,oe()},se.updateOriginal=function(){r.value=se.val()},E=function(){var e,l,s,c,t,u,d;ge.emoticonsEnabled&&(e=f,l=me,s=ge.emoticonsCompat,c=e.ownerDocument,t="(^|\\s| | | | |$)",u=[],d={},Ee(e,"code")||(Ce(l,function(e){d[e]=new RegExp(t+dt(e)+t),u.push(e)}),u.sort(function(e,t){return t.length-e.length}),function e(t){for(t=t.firstChild;t;){if(t.nodeType!==Se||Ue(t,"code")||e(t),t.nodeType===ke)for(var n=0;n<u.length;n++){var o,r=t.nodeValue,i=u[n],a=s?r.search(d[i]):r.indexOf(i);-1<a&&(o=r.indexOf(i,a),a=et(l[i],c),i=r.substr(o+i.length),a.appendChild(c.createTextNode(i)),t.nodeValue=r.substr(0,o),t.parentNode.insertBefore(a,t.nextSibling))}t=t.nextSibling}}(e)))},se.inSourceMode=function(){return Ve(x,"sourceMode")},se.sourceMode=function(e){var t=se.inSourceMode();return"boolean"!=typeof e?t:((t&&!e||!t&&e)&&se.toggleSourceMode(),se)},se.toggleSourceMode=function(){var e=se.inSourceMode();!yt&&e||(e||(m.saveRange(),m.clear()),y=null,se.blur(),e?se.setWysiwygEditorValue(se.getSourceEditorValue()):se.setSourceEditorValue(se.getWysiwygEditorValue()),Be(s),Be(i),$e(x,"wysiwygMode",e),$e(x,"sourceMode",!e),$(),Y())},K=function(){return s.focus(),s.value.substring(s.selectionStart,s.selectionEnd)},N=function(e,t){se.inSourceMode()?t.txtExec&&(Array.isArray(t.txtExec)?se.sourceEditorInsertText.apply(se,t.txtExec):t.txtExec.call(se,e,K())):t.exec&&(xe(t.exec)?t.exec.call(se,e):se.execCommand(t.exec,t.hasOwnProperty("execParam")?t.execParam:null))},se.execCommand=function(e,t){var n=!1,o=se.commands[e];if(se.focus(),!Ne(m.parentNode(),"code")){try{n=d.execCommand(e,!1,t)}catch(e){}!n&&o&&o.errorMessage&&alert(se._(o.errorMessage)),Y()}},Z=function(){function e(){if(l.getSelection()&&l.getSelection().rangeCount<=0)y=null;else if(m&&!m.compare(y)){if((y=m.cloneSelected())&&y.collapsed){var e=y.startContainer,t=y.startOffset;for(t&&e.nodeType!==ke&&(e=e.childNodes[t]);e&&e.parentNode!==f;)e=e.parentNode;e&&rt(e,!0)&&(m.saveRange(),n=d,Qe(f,function(e){rt(e,!0)?(o||e.nodeType===ke?/\S/.test(e.nodeValue):!Ue(e,".sceditor-ignore"))&&(o||We(o=De("p",{},n),e),Ae(o,e)):o=null},!1,!0),m.restoreRange())}Xe(x,"selectionchanged")}var n,o;b=!1}b||(b=!0,"onselectionchange"in d?e():setTimeout(e,100))},Q=function(){var e,t=m.parentNode();h!==t&&(e=h,h=t,v=m.getFirstBlockParent(t),Xe(x,"nodechanged",{oldNode:e,newNode:h}))},se.currentNode=function(){return h},se.currentBlockNode=function(){return v},Y=function(){var e,t,n="active",o=d,r=se.sourceMode();if(se.readOnly())Ce(Re(u,n),function(e,t){Ge(t,n)});else{r||(t=m.parentNode(),e=m.getFirstBlockParent(t));for(var i=0;i<de.length;i++){var a=0,l=pe[de[i].name],s=de[i].state,c=r&&!l._sceTxtMode||!r&&!l._sceWysiwygMode;if(ye(s)){if(!r)try{-1<(a=o.queryCommandEnabled(s)?0:-1)&&(a=o.queryCommandState(s)?1:0)}catch(e){}}else c||(a=s.call(se,t,e));$e(l,"disabled",c||a<0),$e(l,n,0<a)}D&&D.update&&D.update(r,t,e)}},j=function(e){var t,n,o;e.defaultPrevented||(se.closeDropDown(),13!==e.which||!Ue(v,"li,ul,ol")&&tt(v)&&(t=De("br",{},d),m.insertNode(t),(o=(n=t.parentNode).lastChild)&&o.nodeType===ke&&""===o.nodeValue&&(Me(o),o=n.lastChild),!rt(n,!0)&&o===t&&rt(t.previousSibling)&&m.insertHTML("<br>"),e.preventDefault()))},X=function(){Je(f,function(e){if(e.nodeType===Se&&!/inline/.test(Pe(e,"display"))&&!Ue(e,".sceditor-nlf")&&tt(e)){var t=De("p",{},d);return t.className="sceditor-nlf",t.innerHTML="<br />",Ae(f,t),!1}if(3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||Ue(e,"br"))return!1})},U=function(){se.val(r.value)},W=function(){se.closeDropDown()},se._=function(){var n=arguments;return t&&t[n[0]]&&(n[0]=t[n[0]]),n[0].replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[+t+1]?n[+t+1]:"{"+t+"}"})},q=function(t){g&&g.call(t.type+"Event",t,se);var e=(t.target===s?"scesrc":"scewys")+t.type;ce[e]&&ce[e].forEach(function(e){e.call(se,t)})},se.bind=function(e,t,n,o){for(var r,i,a=(e=e.split(" ")).length;a--;)xe(t)&&(r="scewys"+e[a],i="scesrc"+e[a],n||(ce[r]=ce[r]||[],ce[r].push(t)),o||(ce[i]=ce[i]||[],ce[i].push(t)),"valuechanged"===e[a]&&(oe.hasHandler=!0));return se},se.unbind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)xe(t)&&(n||Te(ce["scewys"+e[r]]||[],t),o||Te(ce["scesrc"+e[r]]||[],t));return se},se.blur=function(e,t,n){return xe(e)?se.bind("blur",e,t,n):(se.sourceMode()?s:f).blur(),se},se.focus=function(e,t,n){if(xe(e))se.bind("focus",e,t,n);else if(se.inSourceMode())s.focus();else{if(Re(d,":focus").length)return;var o,n=m.selectedRange();y||J(!0),n&&1===n.endOffset&&n.collapsed&&(o=n.endContainer)&&1===o.childNodes.length&&Ue(o.firstChild,"br")&&(n.setStartBefore(o.firstChild),n.collapse(!0),m.selectRange(n)),l.focus(),f.focus()}return Y(),se},se.keyDown=function(e,t,n){return se.bind("keydown",e,t,n)},se.keyPress=function(e,t,n){return se.bind("keypress",e,t,n)},se.keyUp=function(e,t,n){return se.bind("keyup",e,t,n)},se.nodeChanged=function(e){return se.bind("nodechanged",e,!1,!0)},se.selectionChanged=function(e){return se.bind("selectionchanged",e,!1,!0)},se.valueChanged=function(e,t,n){return se.bind("valuechanged",e,t,n)},ee=function(e){var n=0,o=se.emoticonsCache,t=String.fromCharCode(e.which);Ne(v,"code")||(o||(o=[],Ce(me,function(e,t){o[n++]=[e,t]}),o.sort(function(e,t){return e[0].length-t[0].length}),se.emoticonsCache=o,se.longestEmoticonCode=o[o.length-1][0].length),m.replaceKeyword(se.emoticonsCache,!0,!0,se.longestEmoticonCode,ge.emoticonsCompat,t)&&(ge.emoticonsCompat&&/^\s$/.test(t)||e.preventDefault()))},te=function(){!function(e,t){var n=/[^\s\xA0\u2002\u2003\u2009]+/,o=e&&Re(e,"img[data-sceditor-emoticon]");if(e&&o.length)for(var r=0;r<o.length;r++){var i,a,l,s,c=o[r],u=c.parentNode,d=c.previousSibling,f=c.nextSibling;(d&&n.test(d.nodeValue.slice(-1))||f&&n.test((f.nodeValue||"")[0]))&&(a=-1,l=(i=t.cloneSelected()).startContainer,s=d.nodeValue||"",s+=je(c,"sceditor-emoticon"),l===f&&(a=s.length+i.startOffset),l===e&&e.childNodes[i.startOffset]===f&&(a=s.length),l===d&&(a=i.startOffset),(f=!f||f.nodeType!==ke?u.insertBefore(u.ownerDocument.createTextNode(""),f):f).insertData(0,s),Me(d),Me(c),-1<a&&(i.setStart(f,a),i.collapse(!0),t.selectRange(i)))}}(v,m)},se.emoticons=function(e){return e||!1===e?((ge.emoticonsEnabled=e)?(Fe(f,"keypress",ee),se.sourceMode()||(m.saveRange(),E(),oe(!1),m.restoreRange())):(Ce(Re(f,"img[data-sceditor-emoticon]"),function(e,t){var n=je(t,"sceditor-emoticon"),n=d.createTextNode(n);t.parentNode.replaceChild(n,t)}),Oe(f,"keypress",ee),oe()),se):ge.emoticonsEnabled},se.css=function(e){return w||(w=De("style",{id:"inline"},d),Ae(d.head,w)),ye(e)?(w.styleSheet?w.styleSheet.cssText=e:w.innerHTML=e,se):w.styleSheet?w.styleSheet.cssText:w.innerHTML},B=function(e){var t=[],n={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|","[":"{","]":"}"},o={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},r=e.which,i={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[r]||String.fromCharCode(r).toLowerCase();(e.ctrlKey||e.metaKey)&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&(t.push("shift"),o[r]?i=o[r]:n[i]&&(i=n[i])),i&&(r<16||18<r)&&t.push(i),t=t.join("+"),fe[t]&&!1===fe[t].call(se)&&(e.stopPropagation(),e.preventDefault())},se.addShortcut=function(e,t){return e=e.toLowerCase(),ye(t)?fe[e]=function(){return N(pe[t],se.commands[t]),!1}:fe[e]=t,se},se.removeShortcut=function(e){return delete fe[e.toLowerCase()],se},P=function(e){var t,n,o;if(!ge.disableBlockRemove&&8===e.which&&(n=m.selectedRange())&&(t=n.startContainer,0===n.startOffset&&(o=ne())&&!Ue(o,"body"))){for(;t!==o;){for(;t.previousSibling;)if((t=t.previousSibling).nodeType!==ke||t.nodeValue)return;if(!(t=t.parentNode))return}se.clearBlockFormatting(o),e.preventDefault()}},ne=function(){for(var e=v;!tt(e)||rt(e,!0);)if(!(e=e.parentNode)||Ue(e,"body"))return;return e},se.clearBlockFormatting=function(e){return!(e=e||ne())||Ue(e,"body")||(m.saveRange(),e.className="",He(e,"style",""),Ue(e,"p,div,td")||nt(e,"p"),m.restoreRange()),se},oe=function(e){var t,n,o;g&&(g.hasHandler("valuechangedEvent")||oe.hasHandler)&&(o=!(n=se.sourceMode())&&m.hasSelection(),e=(c=!1)!==e&&!d.getElementById("sceditor-start-marker"),p&&(clearTimeout(p),p=!1),o&&e&&m.saveRange(),(t=n?s.value:f.innerHTML)!==oe.lastVal&&(oe.lastVal=t,Xe(x,"valuechanged",{rawValue:n?se.val():t})),o&&e&&m.removeMarkers())},re=function(){p&&oe()},ie=function(e){var t=e.which,n=ie.lastChar,e=13===n||32===n,n=8===n||46===n;ie.lastChar=t,c||(13===t||32===t?e?ie.triggerNext=!0:oe():8===t||46===t?n?ie.triggerNext=!0:oe():ie.triggerNext&&(oe(),ie.triggerNext=!1),clearTimeout(p),p=setTimeout(function(){c||oe()},1500))},V=function(e){(c=/start/i.test(e.type))||oe()},ae=function(){se.updateOriginal()},e()}an.locale={},an.formats={},an.icons={},an.command={get:function(e){return mt[e]||null},set:function(e,t){return!(!e||!t)&&((t=we(mt[e]||{},t)).remove=function(){an.command.remove(e)},mt[e]=t,this)},remove:function(e){return mt[e]&&delete mt[e],this}},window.sceditor={command:an.command,commands:mt,defaultOptions:ut,ios:vt,isWysiwygSupported:yt,regexEscape:dt,escapeEntities:ft,escapeUriScheme:function(e){var t,n=window.location;return e&&/^[^\/]*:/i.test(e)&&!m.test(e)?((t=n.pathname.split("/")).pop(),n.protocol+"//"+n.host+t.join("/")+"/"+e):e},dom:{css:Pe,attr:He,removeAttr:ze,is:Ue,closest:Ne,width:Ye,height:Ke,traverse:Qe,rTraverse:Je,parseHTML:et,hasStyling:tt,convertElement:nt,blockLevelList:c,canHaveChildren:ot,isInline:rt,copyCSS:function(e,t){t.style&&e.style&&(t.style.cssText=e.style.cssText+t.style.cssText)},fixNesting:it,findCommonAncestor:function(e,t){for(;e=e.parentNode;)if((n=e)!==(o=t)&&n.contains&&n.contains(o))return e;var n,o},getSibling:u,removeWhiteSpace:at,extractContents:f,getOffset:lt,getStyle:p,hasStyle:function(e,t,n){return!!(t=p(e,t))&&(!n||t===n||Array.isArray(n)&&-1<n.indexOf(t))}},locale:an.locale,icons:an.icons,utils:{each:Ce,isEmptyObject:n,extend:we},plugins:gt.plugins,formats:an.formats,create:function(e,t){t=t||{},Ee(e,".sceditor-container")||(t.runWithoutWysiwygSupport||yt)&&new an(e,t)},instance:function(e){return e._sceditor}},o.default.sceditor=window.sceditor,o.default.fn.sceditor=function(e){var t,n=[];return this.each(function(){t=this._sceditor,"state"===e?n.push(!!t):"instance"===e?n.push(t):t||o.default.sceditor.create(this,e)}),n.length?1===n.length?n[0]:n:this}}();