3 lines
No EOL
86 KiB
JavaScript
3 lines
No EOL
86 KiB
JavaScript
/* SCEditor v3.0.0 | (C) 2017, Sam Clarke | sceditor.com/license */
|
||
// custom build
|
||
!function(){"use strict";var o=(A=jQuery)&&"object"==typeof A&&"default"in A?A:{default:A};function e(e,t){return typeof t===e}var ye=e.bind(null,"string"),be=e.bind(null,"undefined"),xe=e.bind(null,"function"),r=e.bind(null,"number");function t(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=r[l],d=s[l],f="__proto__"===l||"constructor"===l;be(d)||f||(c=a(d),f=Array.isArray(d),i&&(c||f)?(c=a(u)===c&&Array.isArray(u)===f,r[l]=we(!0,c?u:f?[]:{},d)):r[l]=d)}}return r}function ke(e,t){-1<(t=e.indexOf(t))&&e.splice(t,1)}function Te(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={},Ce=1,Se=3,l=8;function a(e){return e=parseFloat(e),isFinite(e)?e:0}function Ee(e,t,n){var o=(n||document).createElement(e);return Te(t||{},function(e,t){"style"===e?o.style.cssText=t:e in o?o[e]=t:o.setAttribute(e,t)}),o}function De(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:De(e,t)}function Ae(e){e.parentNode&&e.parentNode.removeChild(e)}function Me(e,t){e.appendChild(t)}function Re(e,t){return e.querySelectorAll(t)}var _e=!0;function Oe(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 Be(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 Fe(e,t,n){if(arguments.length<3)return e.getAttribute(t);null==n?Ie(e,t):e.setAttribute(t,n)}function Ie(e,t){e.removeAttribute(t)}function He(e){je(e,"display","none")}function ze(e){je(e,"display","")}function Le(e){(Qe(e)?He:ze)(e)}function je(n,e,t){if(arguments.length<3){if(ye(e))return 1===n.nodeType?getComputedStyle(n)[e]:null;Te(e,function(e,t){je(n,e,t)})}else{var o=(t||0===t)&&!isNaN(t);n.style[e]=o?t+"px":t}}function Pe(e,t,n){var o=arguments.length,r={};if(e.nodeType===Ce)return 1===o?(Te(e.attributes,function(e,t){/^data\-/i.test(t.name)&&(r[t.name.substr(5)]=t.value)}),r):2===o?Fe(e,"data-"+t):void Fe(e,"data-"+t,String(n))}function Ue(e,t){var n=!1;return e&&e.nodeType===Ce?(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 qe(e,t){return Ue(e,"."+t)}function Ve(e,t){var n=s(e);n.indexOf(t)<0&&n.push(t),e.className=n.join(" ")}function $e(e,t){var n=s(e);ke(n,t),e.className=n.join(" ")}function Ge(e,t,n){((n=be(n)?!qe(e,t):n)?Ve:$e)(e,t)}function Ye(e,t){if(be(t)){var n=a((o=getComputedStyle(e)).paddingLeft)+a(o.paddingRight),o=a(o.borderLeftWidth)+a(o.borderRightWidth);return e.offsetWidth-n-o}je(e,"width",t)}function Ke(e,t){if(be(t)){var n=a((o=getComputedStyle(e)).paddingTop)+a(o.paddingBottom),o=a(o.borderTopWidth)+a(o.borderBottomWidth);return e.offsetHeight-n-o}je(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 Qe(e){return e.getClientRects().length}function Ze(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===Ze(e,t,n,o,r)||n&&!1===t(e))return!1;e=i}}function Je(e,t,n,o){Ze(e,t,n,o,!0)}function et(e,t){var n=(t=t||document).createDocumentFragment(),o=Ee("div",{},t);for(o.innerHTML=e;o.firstChild;)Me(n,o.firstChild);return n}function tt(e){return e&&(!Ue(e,"p,div")||e.className||Fe(e,"style")||!t(Pe(e)))}function nt(e,t){var n=Ee(t,{},e.ownerDocument);for(Te(e.attributes,function(e,t){try{Fe(n,t.name,t.value)}catch(e){}});e.firstChild;)Me(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||Se;return n!==Ce?n===Se:"code"===(e=e.tagName.toLowerCase())?!t:c.indexOf("|"+e+"|")<0}function d(e){return e.lastChild&&d(e.lastChild)&&Ae(e.lastChild),3===e.nodeType?!e.nodeValue:ot(e)&&!e.childNodes.length}function it(e){Ze(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===Ce){for(var a=n.cloneNode();i.firstChild;)Me(a,i.firstChild);Me(i,a)}n=n.parentNode}We(i,o),d(r)||We(r,i),d(o)&&Ae(o)}t&&Ue(e,"ul,ol")&&Ue(e.parentNode,"ul,ol")&&(r="li",t=(t=e).previousElementSibling,(t=r&&t&&!Ue(t,r)?null:t)||We(t=Ee("li"),e),Me(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=je(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)===Ce&&c.firstChild&&at(c),a===Se){for(n=u(c),o=u(c,!0),a=!1;qe(o,"sceditor-ignore");)o=u(o,!0);if(rt(c)&&o){for(r=o;r.lastChild;)for(r=r.lastChild;qe(r,"sceditor-ignore");)r=u(r,!0);a=r.nodeType===Se?/[\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:t.replace(s?/[\t ]+$/:/[\t\n\r ]+$/,"")).length?c.nodeValue=t.replace(s?/[\t ]+/g:/[\t\n\r ]+/g," "):Ae(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||je(e,t),je(e.parentNode,t)===n||"block"!==je(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!==Fe(t,o.name))return}return 1}}function ct(e){for(;e.firstChild;)We(e.firstChild,e);Ae(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:Fe(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={"&":"&","<":"<",">":">"," ":" ","\r\n":"<br />","\r":"<br />","\n":"<br />"};return!1!==t&&(n['"']=""",n["'"]="'",n["`"]="`"),e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var h={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=h[e];return Object.keys(t).forEach(function(e){o=o.replace(new RegExp(dt("{"+e+"}"),"g"),t[e])}),o=n?et(o):o}function n(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(je(n.parentNode,"whiteSpace"))||Ae(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"===je(e,"direction");return"left"===(e=je(e,"textAlign"))||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"===je(e,"direction");return"right"===(e=je(e,"textAlign"))||e===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var o=Ee("div");Oe(o,"click","a",function(e){n(Pe(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){Me(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=Ee("div");Oe(o,"click","a",function(e){n(Pe(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var r=1;r<=7;r++)Me(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=Ee("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),Me(o,et(i._htmlCache)),Oe(o,"click","a",function(e){n(Pe(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=Ee("div"),o=this;Me(n,pt("pastetext",{label:o._("Paste your text inside the following box:"),insert:o._("Insert")},!0)),Oe(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(){n(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){n(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=Ee("div");Me(i,pt("table",{rows:r._("Rows:"),cols:r._("Cols:"),insert:r._("Insert")},!0)),Oe(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=Ee("div");Me(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,Oe(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=Ee("div");Me(r,pt("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),Oe(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=Ee("div");Me(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()}Oe(o,"click",".button",i),Oe(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);Ae(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=Ee("div"),c=Ee("div"),i=we({},t.emoticons.dropdown,e?t.emoticons.more:{});return Me(s,c),n=Math.sqrt(Object.keys(i).length),Oe(s,"click","img",function(e){d.insert(a+Fe(this,"alt")+l,null,!1).closeDropDown(!0),e.preventDefault()}),Te(i,function(e,t){Me(c,Ee("img",{src:o+(t.url||t),alt:e,title:t.tooltip||e})),c.children.length>=n&&(c=Ee("div"),Me(s,c))}),!e&&t.emoticons.more&&(Me(t=Ee("a",{className:"sceditor-more"}),document.createTextNode(d._("More"))),Oe(t,"click",function(e){d.createDropDown(u,"more-emoticons",f(!0)),e.preventDefault()}),Me(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=Ee("div");Me(a,pt("youtubeMenu",{label:r._("Video URL:"),insert:r._("Insert")},!0)),Oe(a,"click",".button",function(e){var t=(n=Re(a,"#link")[0].value).match(/(?:v=|v\/|embed\/|youtu.be\/)?([a-zA-Z0-9_-]{11})/),n=n.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),o=0;n&&Te(n[1].split(/[hms]/),function(e,t){""!==t&&(o=60*o+Number(t))}),t&&/^[a-zA-Z0-9_\-]{11}$/.test(t[1])&&i(t[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;return n<2e3&&(n=1900+n),o<10&&(o="0"+o),(t=t.getDate())<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();return(t=t<10?"0"+t:t)+":"+(n=n<10?"0"+n:n)+":"+((e=e.getSeconds())<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"===je(t,"direction")?"":"ltr",je(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"===je(t,"direction")?"":"rtl",je(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:{}},g={};function ht(i){function a(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)}function e(e,t){for(var n,o=a((e=[].slice.call(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 g&&"function"==typeof(e=g[e])&&"object"==typeof e.prototype},r.isRegistered=function(e){if(r.exists(e))for(var t=l.length;t--;)if(l[t]instanceof g[e])return!0;return!1},r.register=function(e){return!(!r.exists(e)||r.isRegistered(e)||(e=new g[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 g[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}}ht.plugins=g;var v=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 gt(r,e,i){var a,l,s=e||r.contentDocument||r.document,c="sceditor-start-marker",u="sceditor-end-marker",g=this;g.insertHTML=function(e,t){var n,o;if(!g.selectedRange())return!1;for(t&&(e+=g.selectedHtml()+t),o=Ee("p",{},s),n=s.createDocumentFragment(),o.innerHTML=i(e);o.firstChild;)Me(n,o.firstChild);g.insertNode(n)},l=function(e,t,n){var o,r=s.createDocumentFragment();if("string"==typeof e?(t&&(e+=g.selectedHtml()+t),r=et(e)):(Me(r,e),t&&(Me(r,g.selectedRange().extractContents()),Me(r,t))),o=r.lastChild){for(;!rt(o.lastChild,!0);)o=o.lastChild;return(ot(o)?o.lastChild||Me(o,document.createTextNode("")):o=r,g.removeMarkers(),Me(o,a(c)),Me(o,a(u)),n)?(Me(n=Ee("div"),r),n.innerHTML):r}},g.insertNode=function(e,t){var n,o,r=l(e,t),t=(e=g.selectedRange()).commonAncestorContainer,i=[];if(!r)return!1;function a(e){e&&d(e)&&i.indexOf(e)<0&&Ae(e)}e.startContainer!==e.endContainer&&(Te(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)),g.restoreRange()},g.cloneSelected=function(){var e=g.selectedRange();if(e)return e.cloneRange()},g.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 0<n.rangeCount?n.getRangeAt(0):e}},g.hasSelection=function(){var e=r.getSelection();return e&&0<e.rangeCount},g.selectedHtml=function(){var e,t=g.selectedRange();return t?(Me(e=Ee("p",{},s),t.cloneContents()),e.innerHTML):""},g.parentNode=function(){var e=g.selectedRange();if(e)return e.commonAncestorContainer},g.getFirstBlockParent=function(e){var t=function(e){return rt(e,!0)?(e=e?e.parentNode:null)&&t(e):e};return t(e||g.parentNode())},g.insertNodeAt=function(e,t){var n=g.selectedRange(),o=g.cloneSelected();if(!o)return!1;o.collapse(e),o.insertNode(t),g.selectRange(n)},a=function(e){return g.removeMarker(e),(e=Ee("span",{id:e,className:"sceditor-selection sceditor-ignore",style:"display:none;line-height:0"},s)).innerHTML=" ",e},g.insertMarkers=function(){var e=g.selectedRange(),t=a(c);g.removeMarkers(),g.insertNodeAt(!0,t),e&&e.collapsed?t.parentNode.insertBefore(a(u),t.nextSibling):g.insertNodeAt(!1,a(u))},g.getMarker=function(e){return s.getElementById(e)},g.removeMarker=function(e){(e=g.getMarker(e))&&Ae(e)},g.removeMarkers=function(){g.removeMarker(c),g.removeMarker(u)},g.saveRange=function(){g.insertMarkers()},g.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),g.compare(e,o)&&(e.setStartBefore(t),e.collapse(!0)))}n&&(g.clear(),n.addRange(e))},g.restoreRange=function(){var e,t=g.selectedRange(),n=g.getMarker(c),o=g.getMarker(u);if(!n||!o||!t)return!1;e=n.nextSibling===o,(t=s.createRange()).setStartBefore(n),t.setEndAfter(o),e&&t.collapse(!0),g.selectRange(t),g.removeMarkers()},g.selectOuterText=function(e,t){var n=g.cloneSelected();if(!n)return!1;n.collapse(!1),e=v(n,!0,e),t=v(n,!1,t),n.setStart(e.node,e.offset),n.setEnd(t.node,t.offset),g.selectRange(n)},g.getOuterText=function(e,t){var n=g.cloneSelected();return n?(n.collapse(!e),v(n,e,t).text):""},g.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,h=r?1:0,o=o||e[m-1][0].length;for(r&&o++,i=i||"",c=(a=g.getOuterText(!0,o)).length,a+=i,t&&(a+=g.getOuterText(!1,o));m--;)if(f=(d=e[m][0]).length,s=Math.max(0,c-f-h),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+h)return u=c-u,g.selectOuterText(u,f-u-(/^\S/.test(i)?1:0)),g.insertHTML(e[m][1]),!0;return!1},g.compare=function(e,t){return t=t||g.selectedRange(),e&&t?0===e.compareBoundaryPoints(Range.END_TO_END,t)&&0===e.compareBoundaryPoints(Range.START_TO_START,t):!e&&!t},g.clear=function(){var e=r.getSelection();e&&(e.removeAllRanges?e.removeAllRanges():e.empty&&e.empty())}}var y,b,x,w=navigator.userAgent,vt=/iPhone|iPod|iPad| wosbrowser\//i.test(w),yt=(b=!!window.document.documentMode,D="-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(w),/Android/i.test(w)&&(A=!0,/Safari/.test(w)&&(A=!(y=/Safari\/(\d+)/.exec(w))||!y[1]||y[1]<534)),/ Silk\//i.test(w)&&(A=!(y=/AppleWebKit\/(\d+)/.exec(w))||!y[1]||y[1]<534),vt&&(A=/OS [0-4](_\d)+ like Mac/i.test(w)),/Firefox/i.test(w)&&(A=!1),/OneBrowser/i.test(w)&&(A=!1),"UCWEB"===navigator.vendor&&(A=!1),!(A=!(!b&&!D)||A))),k=Object.hasOwnProperty,T=Object.setPrototypeOf,C=Object.isFrozen,S=Object.getPrototypeOf,E=Object.getOwnPropertyDescriptor,bt=Object.freeze,D=Object.seal,N=Object.create,A="undefined"!=typeof Reflect&&Reflect,M=(M=A.apply)||function(e,t,n){return e.apply(t,n)},bt=bt||function(e){return e},D=D||function(e){return e},R=(R=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=_(Array.prototype.forEach),wt=_(Array.prototype.pop),kt=_(Array.prototype.push),Tt=_(String.prototype.toLowerCase),Ct=_(String.prototype.match),St=_(String.prototype.replace),Et=_(String.prototype.indexOf),Dt=_(String.prototype.trim),Nt=_(RegExp.prototype.test),At=(x=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return R(x,t)});function _(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 M(r,e,n)}}function Mt(e,t){T&&T(e,null);for(var n=t.length;n--;){var o,r=t[n];"string"!=typeof r||(o=Tt(r))!==r&&(C(t)||(t[n]=o),r=o),e[r]=!0}return e}function Rt(e){var t=N(null),n=void 0;for(n in e)M(k,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 _(n.get);if("function"==typeof n.value)return _(n.value)}e=S(e)}return null}var Ot=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"]),Bt=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"]),Ft=bt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),It=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"]),Ht=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"]),zt=bt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Lt=bt(["#text"]),jt=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"]),Pt=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"]),qt=D(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Vt=D(/<%[\s\S]*|[\s\S]*%>/gm),$t=D(/^data-[\-\w.\u00B7-\uFFFF]/),Gt=D(/^aria-[\-\w]+$/),Yt=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kt=D(/^(?:\w+script|data):/i),Xt=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Qt="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 Zt(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 t(e){function c(e){return t(e)}var l=0<arguments.length&&void 0!==e?e:"undefined"==typeof window?null:window;if(c.version="2.2.6",c.removed=[],!l||!l.document||9!==l.document.nodeType)return c.isSupported=!1,c;var s=l.document,i=l.document,u=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,h=l.DOMParser,e=l.trustedTypes,g=_t(r=a.prototype,"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=function(e,t){if("object"!==(void 0===e?"undefined":Qt(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}}(e,s),w=x&&ee?x.createHTML(""):"",k=i.implementation,T=i.createNodeIterator,C=i.getElementsByTagName,S=i.createDocumentFragment,E=s.importNode,D={};try{D=Rt(i).documentMode?i.documentMode:{}}catch(e){}var N={};function A(e){ce&&ce===e||(e=Rt(e=e&&"object"===(void 0===e?"undefined":Qt(e))?e:{}),z="ALLOWED_TAGS"in e?Mt({},e.ALLOWED_TAGS):L,j="ALLOWED_ATTR"in e?Mt({},e.ALLOWED_ATTR):P,le="ADD_URI_SAFE_ATTR"in e?Mt(Rt(se),e.ADD_URI_SAFE_ATTR):se,ie="ADD_DATA_URI_TAGS"in e?Mt(Rt(ae),e.ADD_DATA_URI_TAGS):ae,U="FORBID_TAGS"in e?Mt({},e.FORBID_TAGS):{},W="FORBID_ATTR"in e?Mt({},e.FORBID_ATTR):{},M="USE_PROFILES"in e&&e.USE_PROFILES,q=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,$=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=e.SAFE_FOR_TEMPLATES||!1,Y=e.WHOLE_DOCUMENT||!1,Q=e.RETURN_DOM||!1,Z=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,H=e.ALLOWED_URI_REGEXP||H,G&&(V=!1),Z&&(Q=!0),M&&(z=Mt({},[].concat(Zt(Lt))),j=[],!0===M.html&&(Mt(z,Ot),Mt(j,jt)),!0===M.svg&&(Mt(z,Bt),Mt(j,Pt),Mt(j,Wt)),!0===M.svgFilters&&(Mt(z,Ft),Mt(j,Pt),Mt(j,Wt)),!0===M.mathMl&&(Mt(z,Ht),Mt(j,Ut),Mt(j,Wt))),e.ADD_TAGS&&Mt(z=z===L?Rt(z):z,e.ADD_TAGS),e.ADD_ATTR&&Mt(j=j===P?Rt(j):j,e.ADD_ATTR),e.ADD_URI_SAFE_ATTR&&Mt(le,e.ADD_URI_SAFE_ATTR),ne&&(z["#text"]=!0),Y&&Mt(z,["html","head","body"]),z.table&&(Mt(z,["tbody"]),delete U.tbody),bt&&bt(e),ce=e)}c.isSupported=k&&void 0!==k.createHTMLDocument&&9!==D;var M,R=qt,_=Vt,O=$t,B=Gt,F=Kt,I=Xt,H=Yt,z=null,L=Mt({},[].concat(Zt(Ot),Zt(Bt),Zt(Ft),Zt(Ht),Zt(Lt))),j=null,P=Mt({},[].concat(Zt(jt),Zt(Pt),Zt(Ut),Zt(Wt))),U=null,W=null,q=!0,V=!0,$=!1,G=!1,Y=!1,K=!1,X=!1,Q=!1,Z=!1,J=!0,ee=!1,te=!0,ne=!0,oe=!1,re=Mt({},["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=Mt({},["audio","video","img","source","image","track"]),le=null,se=Mt({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ce=null,ue=i.createElement("form"),de=Mt({},["mi","mo","mn","ms","mtext"]),fe=Mt({},["foreignobject","desc","title","annotation-xml"]),pe=Mt({},Bt);Mt(pe,Ft),Mt(pe,It);var me=Mt({},Ht);function he(t){kt(c.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=w}catch(e){t.remove()}}}function ge(e,t){try{kt(c.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){kt(c.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=Ct(e,/^[\r\n\t ]+/))&&o[0];var o,r=x?x.createHTML(e):e;try{t=(new h).parseFromString(r,"text/html")}catch(e){}return t&&t.documentElement||((o=(t=k.createHTMLDocument("")).body).parentNode.removeChild(o.parentNode.firstElementChild),o.outerHTML=r),e&&n&&t.body.insertBefore(i.createTextNode(n),t.body.childNodes[0]||null),C.call(t,Y?"html":"body")[0]}function ye(e){return T.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":Qt(d))?e instanceof d:e&&"object"===(void 0===e?"undefined":Qt(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function xe(e,t,n){N[e]&&xt(N[e],function(e){e.call(c,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 he(e),1;if(Ct(e.nodeName,/[\u0080-\uFFFF]/))return he(e),1;var n=Tt(e.nodeName);if(xe("uponSanitizeElement",e,{tagName:n,allowedTags:z}),!be(e.firstElementChild)&&(!be(e.content)||!be(e.content.firstElementChild))&&Nt(/<[/\w]/g,e.innerHTML)&&Nt(/<[/\w]/g,e.textContent))return he(e),1;if(z[n]&&!U[n])return e instanceof a&&!function(e){var t=b(e);t&&t.tagName||(t={namespaceURI:Ee,tagName:"template"});var n=Tt(e.tagName),o=Tt(t.tagName);return e.namespaceURI===Se?t.namespaceURI===Ee?"svg"===n:t.namespaceURI===Ce?"svg"===n&&("annotation-xml"===o||de[o]):Boolean(pe[n]):e.namespaceURI===Ce?t.namespaceURI===Ee?"math"===n:t.namespaceURI===Se?"math"===n&&fe[o]:Boolean(me[n]):e.namespaceURI===Ee&&(t.namespaceURI!==Se||fe[o])&&(t.namespaceURI!==Ce||de[o])&&(o=Mt({},["title","style","font","a","script"]),!me[n]&&(o[n]||!pe[n]))}(e)||("noscript"===n||"noembed"===n)&&Nt(/<\/no(script|embed)/i,e.innerHTML)?(he(e),1):(G&&3===e.nodeType&&(t=e.textContent,t=St(t,R," "),t=St(t,_," "),e.textContent!==t&&(kt(c.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(g(r[i],!0),v(e));return he(e),1}function ke(e,t,n){if(te&&("id"===t||"name"===t)&&(n in i||n in ue))return!1;if(!(V&&Nt(O,t)||q&&Nt(B,t))){if(!j[t]||W[t])return!1;if(!le[t]&&!Nt(H,St(n,I,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Et(n,"data:")||!ie[e])&&(!$||Nt(F,St(n,I,"")))&&n)return!1}return!0}function Te(e){var t,n=void 0,o=void 0;xe("beforeSanitizeAttributes",e,null);var r=e.attributes;if(r){for(var i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j},o=r.length;o--;){var a=(t=r[o]).name,l=t.namespaceURI,n=Dt(t.value),s=Tt(a);if(i.attrName=s,i.attrValue=n,i.keepAttr=!0,i.forceKeepAttr=void 0,xe("uponSanitizeAttribute",e,i),n=i.attrValue,!i.forceKeepAttr&&(ge(a,e),i.keepAttr))if(Nt(/\/>/i,n))ge(a,e);else if(G&&(n=St(n,R," "),n=St(n,_," ")),ke(e.nodeName.toLowerCase(),s,n))try{l?e.setAttributeNS(l,a,n):e.setAttribute(a,n),wt(c.removed)}catch(e){}}xe("afterSanitizeAttributes",e,null)}}Mt(me,zt);var Ce="http://www.w3.org/1998/Math/MathML",Se="http://www.w3.org/2000/svg",Ee="http://www.w3.org/1999/xhtml";return c.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 At("toString is not a function");if("string"!=typeof(e=e.toString()))throw At("dirty is not a string, aborting")}if(!c.isSupported){if("object"===Qt(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||A(t),c.removed=[],!(oe="string"==typeof e?!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(!Q&&!G&&!Y&&-1===e.indexOf("<"))return x&&ee?x.createHTML(e):e;if(!(o=ve(e)))return Q?null:w}o&&X&&he(o.firstChild);for(var a=ye(oe?e:o);n=a.nextNode();)3===n.nodeType&&n===r||we(n)||(n.content instanceof u&&function e(t){var n,o=ye(t);for(xe("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)xe("uponSanitizeShadowNode",n,null),we(n)||(n.content instanceof u&&e(n.content),Te(n));xe("afterSanitizeShadowDOM",t,null)}(n.content),Te(n),r=n);if(r=null,oe)return e;if(Q){if(Z)for(i=S.call(o.ownerDocument);o.firstChild;)i.appendChild(o.firstChild);else i=o;return J?E.call(s,i,!0):i}return e=Y?o.outerHTML:o.innerHTML,G&&(e=St(e,R," "),e=St(e,_," ")),x&&ee?x.createHTML(e):e},c.setConfig=function(e){A(e),K=!0},c.clearConfig=function(){ce=null,K=!1},c.isValidAttribute=function(e,t,n){return ce||A({}),ke(e=Tt(e),t=Tt(t),n)},c.addHook=function(e,t){"function"==typeof t&&(N[e]=N[e]||[],kt(N[e],t))},c.removeHook=function(e){N[e]&&wt(N[e])},c.removeHooks=function(e){N[e]&&(N[e]=[])},c.removeAllHooks=function(){N={}},c}(),en=window,tn=document,nn=/^image\/(p?jpe?g|gif|png|bmp)$/i;function on(r,e){var a,x,u,i,l,f,d,s,o,c,p,t,m,h,g,v,y,b,n,w,k,T,C,S,E,D,N,A,M,R,_,O,B,F,I,H,z,L,j,P,U,W,q,V,$,G,Y,K,X,Q,Z,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 he=se.opts=we(!0,{},ut,e);se.opts.emoticons=e.emoticons||ut.emoticons,Array.isArray(he.allowedIframeUrls)||(he.allowedIframeUrls=[]),he.allowedIframeUrls.push("https://www.youtube-nocookie.com/embed/");var ge=Jt();function ve(e){return ge.sanitize(e,{ADD_TAGS:["iframe"],ADD_ATTR:["allowfullscreen","frameborder","target"]})}ge.addHook("uponSanitizeElement",function(e,t){var n=he.allowedIframeUrls;if("iframe"===t.tagName){for(var o=Fe(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}Ae(e)}}),ge.addHook("afterSanitizeAttributes",function(e){"target"in e&&Fe(e,"data-sce-target",Fe(e,"target")),Ie(e,"target")}),e=function(){r._sceditor=se,he.locale&&"en"!==he.locale&&M(),We(x=Ee("div",{className:"sceditor-container"}),r),je(x,"z-index",he.zIndex),n=r.required,r.required=!1;var e=on.formats[he.format];a=e?new e:{},h=new ht(se),(he.plugins||"").split(",").forEach(function(e){h.register(e.trim())}),"init"in a&&a.init.call(se),F(),R(),A(),_(),O(),yt||se.toggleSourceMode(),Y();var t=function(){Be(en,"load",t),he.autofocus&&J(),le(),X(),h.call("ready"),"onReady"in a&&a.onReady.call(se)};Oe(en,"load",t),"complete"===tn.readyState&&t()},M=function(){var e;(t=on.locale[he.locale])||(e=he.locale.split("-"),t=on.locale[e[0]]),t&&t.dateFormat&&(he.dateFormat=t.dateFormat)},A=function(){s=Ee("textarea"),i=Ee("iframe",{frameborder:0,allowfullscreen:!0}),he.startInSourceMode?(Ve(x,"sourceMode"),He(i)):(Ve(x,"wysiwygMode"),He(s)),he.spellcheck||Fe(x,"spellcheck","false"),"https:"===en.location.protocol&&Fe(i,"src","about:blank"),Me(x,i),Me(x,s),se.dimensions(he.width||Ye(r),he.height||Ke(r));var e=vt?" ios":"";(d=i.contentDocument).open(),d.write(pt("html",{attrs:' class="'+e+'"',spellcheck:he.spellcheck?"":'spellcheck="false"',charset:he.charset,style:he.style})),d.close(),f=d.body,l=i.contentWindow,se.readOnly(!!he.readOnly),vt&&(Ke(f,"100%"),Oe(f,"touchend",se.focus)),e=Fe(r,"tabindex"),Fe(s,"tabindex",e),Fe(i,"tabindex",e),m=new gt(l,null,ve),He(r),se.val(r.value),(e=he.placeholder||Fe(r,"placeholder"))&&(s.placeholder=e,Fe(f,"placeholder",e))},_=function(){he.autoUpdate&&(Oe(f,"blur",ae),Oe(s,"blur",ae)),null===he.rtl&&(he.rtl="rtl"===je(s,"direction")),se.rtl(!!he.rtl),he.autoExpand&&(Oe(f,"load",le,_e),Oe(f,"input keyup",le)),he.resizeEnabled&&B(),Fe(x,"id",he.id),se.emoticons(he.emoticonsEnabled)},O=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";Oe(tn,"click",$),e&&(Oe(e,"reset",U),Oe(e,"submit",se.updateOriginal,_e)),Oe(f,"keypress",P),Oe(f,"keydown",L),Oe(f,"keydown",j),Oe(f,"keyup",X),Oe(f,"blur",re),Oe(f,"keyup",ie),Oe(f,"paste",I),Oe(f,"cut copy",H),Oe(f,t,q),Oe(f,o,Q),Oe(f,n,V),he.emoticonsCompat&&en.getSelection&&Oe(f,"keyup",te),Oe(f,"blur",function(){se.val()||Ve(f,"placeholder")}),Oe(f,"focus",function(){$e(f,"placeholder")}),Oe(s,"blur",re),Oe(s,"keyup",ie),Oe(s,"keydown",L),Oe(s,t,q),Oe(s,n,V),Oe(d,"mousedown",W),Oe(d,o,Q),Oe(d,"keyup",X),Oe(x,"selectionchanged",Z),Oe(x,"selectionchanged",Y),Oe(x,"selectionchanged valuechanged nodechanged pasteraw paste",V)},R=function(){var i,a=se.commands,l=(he.toolbarExclude||"").split(","),e=he.toolbar.split("|");u=Ee("div",{className:"sceditor-toolbar",unselectable:"on"}),he.icons in on.icons&&(E=new on.icons[he.icons]),Te(e,function(e,t){i=Ee("div",{className:"sceditor-group"}),Te(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,E&&E.create&&E.create(t)&&(We(E.create(t),o.firstChild),Ve(o,"has-icon")),o._sceTxtMode=!!r.txtExec,o._sceWysiwygMode=!!r.exec,Ge(o,"disabled",!r.exec),Oe(o,"click",function(e){qe(o,"disabled")||N(o,r),Y(),e.preventDefault()}),Oe(o,"mousedown",function(e){se.closeDropDown(),e.preventDefault()}),r.tooltip&&Fe(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}),Me(i,o),pe[t]=o)}),i.firstChild&&Me(u,i)}),Me(he.toolbarContainer||x,u)},B=function(){function t(e){o="touchmove"===e.type?(e=en.event,s=e.changedTouches[0].pageX,e.changedTouches[0].pageY):(s=e.pageX,e.pageY);var t=u+(o-l),n=m?c-(s-a):c+(s-a);0<y&&y<n&&(n=y),0<v&&n<v&&(n=v),he.resizeWidth||(n=!1),0<g&&g<t&&(t=g),0<h&&t<h&&(t=h),he.resizeHeight||(t=!1),(n||t)&&se.dimensions(n,t),e.preventDefault()}var o,e=Ee("div",{className:"sceditor-grip"}),n=Ee("div",{className:"sceditor-resize-cover"}),r="touchmove mousemove",i="touchcancel touchend mouseup",a=0,l=0,s=0,c=0,u=0,d=Ye(x),f=Ke(x),p=!1,m=se.rtl(),h=he.resizeMinHeight||f/1.5,g=he.resizeMaxHeight||2.5*f,v=he.resizeMinWidth||d/1.25,y=he.resizeMaxWidth||1.25*d,b=function(e){p&&(p=!1,He(n),$e(x,"resizing"),Be(tn,r,t),Be(tn,i,b),e.preventDefault())};E&&E.create&&(d=E.create("grip"))&&(Me(e,d),Ve(e,"has-icon")),Me(x,e),Me(x,n),He(n),Oe(e,"touchstart mousedown",function(e){l="touchstart"===e.type?(e=en.event,a=e.touches[0].pageX,e.touches[0].pageY):(a=e.pageX,e.pageY),c=Ye(x),u=Ke(x),p=!0,Ve(x,"resizing"),ze(n),Oe(tn,r,t),Oe(tn,i,b),e.preventDefault()})},F=function(){var e=he.emoticons,n=he.emoticonsRoot||"";Te(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}),he.emoticonsEnabled&&ue.push(Ee("img",{src:n+(t.url||t)}))})},J=function(){var e,t=f.firstChild,n=!!he.autofocusEnd;if(Qe(x)){if(se.sourceMode())return e=n?s.value.length:0,void s.setSelectionRange(e,e);if(at(f),n)for((t=f.lastChild)||(t=Ee("p",{},d),Me(f,t));t.lastChild;)Ue(t=t.lastChild,"br")&&t.previousSibling&&(t=t.previousSibling);e=d.createRange(),ot(t)?e.selectNodeContents(t):(e.setStartBefore(t),n&&e.setStartAfter(t)),e.collapse(!n),m.selectRange(e),y=e,n&&(f.scrollTop=f.scrollHeight),se.focus()}},se.readOnly=function(e){return"boolean"!=typeof e?!s.readonly:(f.contentEditable=!e,s.readonly=!e,G(e),se)},se.rtl=function(e){var t=e?"rtl":"ltr";return"boolean"!=typeof e?"rtl"===Fe(s,"dir"):(Fe(f,"dir",t),Fe(s,"dir",t),$e(x,"rtl"),$e(x,"ltr"),Ve(x,t),E&&E.rtl&&E.rtl(e),se)},G=function(n){var o=se.inSourceMode()?"_sceTxtMode":"_sceWysiwygMode";Te(pe,function(e,t){Ge(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&&(he.width=e),Ye(x,e)),!1!==t&&(!1!==n&&(he.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)?qe(x,t):((e=!!e)&&(C=en.pageYOffset),Ge(tn.documentElement,t,e),Ge(tn.body,t,e),Ge(x,t,e),se.width(e?"100%":he.width,!1),se.height(e?"100%":he.height,!1),e||en.scrollTo(0,C),le(),se)},le=function(){he.autoExpand&&!T&&(T=setTimeout(se.expandToContent,200))},se.expandToContent=function(e){var t,n;se.maximize()||(clearTimeout(T),T=!1,k||(t=he.resizeMinHeight||he.height||Ke(r),k={min:t,max:he.resizeMaxHeight||2*t}),(n=tn.createRange()).selectNodeContents(f),t=n.getBoundingClientRect(),n=d.documentElement.clientHeight-1,t=t.bottom-t.top,n=se.height()+1+(t-n),e||-1===k.max||(n=Math.min(n,k.max)),se.height(Math.ceil(Math.max(n,k.min))))},se.destroy=function(){var e;h&&(h.destroy(),h=m=null,o&&Ae(o),Be(tn,"click",$),(e=r.form)&&(Be(e,"reset",U),Be(e,"submit",se.updateOriginal,_e)),Ae(s),Ae(u),Ae(x),delete r._sceditor,ze(r),r.required=n)},se.createDropDown=function(e,t,n){t="sceditor-"+t,se.closeDropDown(),o&&qe(o,t)||(e=we({top:e.offsetTop,left:e.offsetLeft,marginTop:e.clientHeight},he.dropDownCss),je(o=Ee("div",{className:"sceditor-dropdown "+t}),e),Me(o,n),Me(x,o),Oe(o,"click focusin",function(e){e.stopPropagation()}),!o||(n=Re(o,"input,textarea")[0])&&n.focus())},$=function(e){3!==e.which&&o&&!e.defaultPrevented&&(ae(),se.closeDropDown())},H=function(e){var t=m.selectedRange();if(t){for(var n,o,r=Ee("div",{},d),i=t.commonAncestorContainer;i&&rt(i,!0);)i.nodeType===Ce&&(o=i.cloneNode(),r.firstChild&&Me(o,r.firstChild),Me(r,o),n=n||o),i=i.parentNode;Me(n||r,t.cloneContents()),e.clipboardData.setData("text/html",r.innerHTML),e.clipboardData.setData("text/plain",t.toString()),"cut"===e.type&&t.deleteContents(),e.preventDefault()}},I=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&&en.FileReader&&l&&nn.test(l[s].type))return t=r.items[s].getAsFile(),n=void 0,(n=new FileReader).onload=function(e){z({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"]),z(i)}else if(!S){var c=o.scrollTop;for(m.saveRange(),S=tn.createDocumentFragment();o.firstChild;)Me(S,o.firstChild);setTimeout(function(){var e=o.innerHTML;o.innerHTML="",Me(o,S),o.scrollTop=c,S=!1,m.restoreRange(),z({html:ve(e)})},0)}},z=function(e){var t=Ee("div",{},d);h.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,g)),h.call("paste",e),Xe(x,"paste",e),"fragmentToHtml"in a&&(e.val=a.fragmentToHtml(e.val,g)),h.call("pasteHtml",e),t=m.getFirstBlockParent(),se.wysiwygEditorInsertHtml(e.val,null,!0),it(t),function e(t){if(t.nodeType===Ce){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];je(n,i)===je(t,i)&&t.style.removeProperty(i)}if(!t.style.length)if(Ie(t,"style"),"FONT"===o&&(je(t,"fontFamily").toLowerCase()===je(n,"fontFamily").toLowerCase()&&Ie(t,"face"),je(t,"color")===je(n,"color")&&Ie(t,"color"),je(t,"fontSize")===je(n,"fontSize")&&Ie(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(je(n,"fontWeight")))&&(!l||"italic"===je(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)&&(Me(t,s),ct(s))}}}(t)},se.closeDropDown=function(e){o&&(Ae(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(),D(),it(f),ze(n=Re(f,"#sceditor-end-marker")[0]),e=f.scrollTop,t=lt(n).top+1.5*n.offsetHeight-o,He(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,g):i)+t),!1!==n&&"fragmentToHtml"in a&&(e=a.fragmentToHtml(e,g)),!1!==n&&!0===r&&(e=e.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")),se.wysiwygEditorInsertHtml(e)),se;var i},se.getWysiwygEditorValue=function(e){for(var t,n=Ee("div",{},d),o=f.childNodes,r=0;r<o.length;r++)Me(n,o[r].cloneNode(!0));return Me(f,n),it(n),Ae(n),t=n.innerHTML,!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!1!==e&&"toHtml"in a?a.toHtml(t):t},se.setWysiwygEditorValue=function(e){e=e||"<p><br /></p>",f.innerHTML=ve(e),D(),X(),oe(),le()},se.setSourceEditorValue=function(e){s.value=e,oe()},se.updateOriginal=function(){r.value=se.val()},D=function(){var e,l,s,c,t,u,d;he.emoticonsEnabled&&(e=f,l=me,s=he.emoticonsCompat,c=e.ownerDocument,t="(^|\\s| | | | |$)",u=[],d={},De(e,"code")||(Te(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!==Ce||Ue(t,"code")||e(t),t.nodeType===Se)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 qe(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()),se.blur(),e?se.setWysiwygEditorValue(se.getSourceEditorValue()):se.setSourceEditorValue(se.getWysiwygEditorValue()),Le(s),Le(i),Ge(x,"wysiwygMode",e),Ge(x,"sourceMode",!e),G(),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()}},Q=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!==Se&&(e=e.childNodes[t]);e&&e.parentNode!==f;)e=e.parentNode;e&&rt(e,!0)&&(m.saveRange(),n=d,Ze(f,function(e){rt(e,!0)?(o||e.nodeType===Se?/\S/.test(e.nodeValue):!Ue(e,".sceditor-ignore"))&&(o||We(o=Ee("p",{},n),e),Me(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))},Z=function(){var e,t=m.parentNode();g!==t&&(e=g,g=t,v=m.getFirstBlockParent(t),Xe(x,"nodechanged",{oldNode:e,newNode:g}))},se.currentNode=function(){return g},se.currentBlockNode=function(){return v},Y=function(){var e,t,n="active",o=d,r=se.sourceMode();if(se.readOnly())Te(Re(u,n),function(e,t){$e(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));Ge(l,"disabled",c||a<0),Ge(l,n,0<a)}E&&E.update&&E.update(r,t,e)}},P=function(e){var t,n,o;e.defaultPrevented||(se.closeDropDown(),13!==e.which||!Ue(v,"li,ul,ol")&&tt(v)&&(t=Ee("br",{},d),m.insertNode(t),(o=(n=t.parentNode).lastChild)&&o.nodeType===Se&&""===o.nodeValue&&(Ae(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===Ce&&!/inline/.test(je(e,"display"))&&!Ue(e,".sceditor-nlf")&&tt(e)){var t=Ee("p",{},d);return t.className="sceditor-nlf",t.innerHTML="<br />",Me(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+"}"})},V=function(t){h&&h.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||ke(ce["scewys"+e[r]]||[],t),o||ke(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(),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=[],Te(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,he.emoticonsCompat,t)&&(he.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+=Pe(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===Se?f:u.insertBefore(u.ownerDocument.createTextNode(""),f)).insertData(0,s),Ae(d),Ae(c),-1<a&&(i.setStart(f,a),i.collapse(!0),t.selectRange(i)))}}(v,m)},se.emoticons=function(e){return e||!1===e?((he.emoticonsEnabled=e)?(Oe(f,"keypress",ee),se.sourceMode()||(m.saveRange(),D(),oe(!1),m.restoreRange())):(Te(Re(f,"img[data-sceditor-emoticon]"),function(e,t){var n=Pe(t,"sceditor-emoticon"),n=d.createTextNode(n);t.parentNode.replaceChild(n,t)}),Be(f,"keypress",ee),oe()),se):he.emoticonsEnabled},se.css=function(e){return w||(w=Ee("style",{id:"inline"},d),Me(d.head,w)),ye(e)?(w.styleSheet?w.styleSheet.cssText=e:w.innerHTML=e,se):w.styleSheet?w.styleSheet.cssText:w.innerHTML},L=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},j=function(e){var t,n,o;if(!he.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!==Se||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="",Fe(e,"style",""),Ue(e,"p,div,td")||nt(e,"p"),m.restoreRange()),se},oe=function(e){var t,n,o;h&&(h.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,e=13===(n=ie.lastChar)||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))},q=function(e){(c=/start/i.test(e.type))||oe()},ae=function(){se.updateOriginal()},e()}on.locale={},on.formats={},on.icons={},on.command={get:function(e){return mt[e]||null},set:function(e,t){return!(!e||!t)&&((t=we(mt[e]||{},t)).remove=function(){on.command.remove(e)},mt[e]=t,this)},remove:function(e){return mt[e]&&delete mt[e],this}},window.sceditor={command:on.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:je,attr:Fe,removeAttr:Ie,is:Ue,closest:Ne,width:Ye,height:Ke,traverse:Ze,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(e!==t&&e.contains&&e.contains(t))return e},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:on.locale,icons:on.icons,utils:{each:Te,isEmptyObject:t,extend:we},plugins:ht.plugins,formats:on.formats,create:function(e,t){t=t||{},De(e,".sceditor-container")||(t.runWithoutWysiwygSupport||yt)&&new on(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}}(),function(e){"use strict";var d=e.escapeEntities,a=e.escapeUriScheme,h=e.dom,t=e.utils,g=h.css,v=h.attr,y=h.is,o=t.extend,r=t.each,b="data-sceditor-emoticon",i=e.command.get,x={always:1,never:2,auto:3},w={all:1,any:2},l={bold:{txtExec:["[b]","[/b]"]},italic:{txtExec:["[i]","[/i]"]},underline:{txtExec:["[u]","[/u]"]},strike:{txtExec:["[s]","[/s]"]},subscript:{txtExec:["[sub]","[/sub]"]},superscript:{txtExec:["[sup]","[/sup]"]},left:{txtExec:["[left]","[/left]"]},center:{txtExec:["[center]","[/center]"]},right:{txtExec:["[right]","[/right]"]},justify:{txtExec:["[justify]","[/justify]"]},font:{txtExec:function(e){var t=this;i("font")._dropDown(t,e,function(e){t.insertText("[font="+e+"]","[/font]")})}},size:{txtExec:function(e){var t=this;i("size")._dropDown(t,e,function(e){t.insertText("[size="+e+"]","[/size]")})}},color:{txtExec:function(e){var t=this;i("color")._dropDown(t,e,function(e){t.insertText("[color="+e+"]","[/color]")})}},bulletlist:{txtExec:function(e,t){this.insertText("[ul]\n[li]"+t.split(/\r?\n/).join("[/li]\n[li]")+"[/li]\n[/ul]")}},orderedlist:{txtExec:function(e,t){this.insertText("[ol]\n[li]"+t.split(/\r?\n/).join("[/li]\n[li]")+"[/li]\n[/ol]")}},table:{txtExec:["[table][tr][td]","[/td][/tr][/table]"]},horizontalrule:{txtExec:["[hr]"]},code:{txtExec:["[code]","[/code]"]},image:{txtExec:function(e,t){var r=this;i("image")._dropDown(r,e,t,function(e,t,n){var o="";t&&(o+=" width="+t),n&&(o+=" height="+n),r.insertText("[img"+o+"]"+e+"[/img]")})}},email:{txtExec:function(e,n){var o=this;i("email")._dropDown(o,e,function(e,t){o.insertText("[email="+e+"]"+(t||n||e)+"[/email]")})}},link:{txtExec:function(e,n){var o=this;i("link")._dropDown(o,e,function(e,t){o.insertText("[url="+e+"]"+(t||n||e)+"[/url]")})}},quote:{txtExec:["[quote]","[/quote]"]},youtube:{txtExec:function(e){var t=this;i("youtube")._dropDown(t,e,function(e){t.insertText("[youtube]"+e+"[/youtube]")})}},rtl:{txtExec:["[rtl]","[/rtl]"]},ltr:{txtExec:["[ltr]","[/ltr]"]}},k={b:{tags:{b:null,strong:null},styles:{"font-weight":["bold","bolder","401","700","800","900"]},format:"[b]{0}[/b]",html:"<strong>{0}</strong>"},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"<em>{0}</em>"},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"<u>{0}</u>"},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"<s>{0}</s>"},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"<sub>{0}</sub>"},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"<sup>{0}</sup>"},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:x.never,format:function(e,t){var n;return"[font="+S(n=!y(e,"font")||!(n=v(e,"face"))?g(e,"font-family"):n)+"]"+t+"[/font]"},html:'<font face="{defaultattr}">{0}</font>'},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(e,t){var n=v(e,"size"),o=2;return-1<(n=n||g(e,"fontSize")).indexOf("px")?((n=+n.replace("px",""))<12&&(o=1),15<n&&(o=3),17<n&&(o=4),23<n&&(o=5),31<n&&(o=6),47<n&&(o=7)):o=n,"[size="+o+"]"+t+"[/size]"},html:'<font size="{defaultattr}">{!0}</font>'},color:{tags:{font:{color:null}},styles:{color:null},quoteType:x.never,format:function(e,t){var n;return"[color="+c(n=!y(e,"font")||!(n=v(e,"color"))?e.style.color||g(e,"color"):n)+"]"+t+"[/color]"},html:function(e,t,n){return'<font color="'+d(c(t.defaultattr),!0)+'">'+n+"</font>"}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:"<ul>{0}</ul>"},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:"<ul>{0}</ul>"},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"<ol>{0}</ol>"},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"<li>{0}</li>"},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"<li>{0}</li>"},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:"<table>{0}</table>"},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"<tr>{0}</tr>"},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"<th>{0}</th>"},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"<td>{0}</td>"},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(e,t){return v(e,b)+t},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:"<hr />"},img:{allowsEmpty:!0,tags:{img:{src:null}},allowedChildren:["#"],quoteType:x.never,format:function(t,e){var n="",o=function(e){return t.style?t.style[e]:null};return v(t,b)?e:(e=v(t,"width")||o("width"),o=v(t,"height")||o("height"),"[img"+(n=t.complete&&(e||o)||e&&o?"="+h.width(t)+"x"+h.height(t):n)+"]"+v(t,"src")+"[/img]")},html:function(e,t,n){var o="",r=t.width,i=t.height;return t.defaultattr&&(r=(t=t.defaultattr.split(/x/i))[0],i=2===t.length?t[1]:t[0]),void 0!==r&&(o+=' width="'+d(r,!0)+'"'),void 0!==i&&(o+=' height="'+d(i,!0)+'"'),"<img"+o+' src="'+a(n)+'" />'}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:x.never,format:function(e,t){e=v(e,"href");return"mailto:"===e.substr(0,7)?'[email="'+e.substr(7)+'"]'+t+"[/email]":"[url="+e+"]"+t+"[/url]"},html:function(e,t,n){return t.defaultattr=d(t.defaultattr,!0)||n,'<a href="'+a(t.defaultattr)+'">'+n+"</a>"}},email:{quoteType:x.never,html:function(e,t,n){return'<a href="mailto:'+(d(t.defaultattr,!0)||n)+'">'+n+"</a>"}},quote:{tags:{blockquote:null},isInline:!1,quoteType:x.never,format:function(e,t){for(var n,o="data-author",r="",i=e.children,a=0;!n&&a<i.length;a++)y(i[a],"cite")&&(n=i[a]);return(n||v(e,o))&&(r=n&&n.textContent||v(e,o),v(e,o,r),n&&e.removeChild(n),t=this.elementToBbcode(e),r="="+r.replace(/(^\s+|\s+$)/g,""),n&&e.insertBefore(n,e.firstChild)),"[quote"+r+"]"+t+"[/quote]"},html:function(e,t,n){return"<blockquote>"+(n=t.defaultattr?"<cite>"+d(t.defaultattr)+"</cite>"+n:n)+"</blockquote>"}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"<code>{0}</code>"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,allowsEmpty:!0,format:"[left]{0}[/left]",html:'<div align="left">{0}</div>'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,allowsEmpty:!0,format:"[center]{0}[/center]",html:'<div align="center">{0}</div>'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,allowsEmpty:!0,format:"[right]{0}[/right]",html:'<div align="right">{0}</div>'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,allowsEmpty:!0,format:"[justify]{0}[/justify]",html:'<div align="justify">{0}</div>'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(e,t){return(e=v(e,"data-youtube-id"))?"[youtube]"+e+"[/youtube]":t},html:'<iframe width="560" height="315" frameborder="0" src="https://www.youtube-nocookie.com/embed/{0}?wmode=opaque" data-youtube-id="{0}" allowfullscreen></iframe>'},rtl:{styles:{direction:["rtl"]},isInline:!1,format:"[rtl]{0}[/rtl]",html:'<div style="direction: rtl">{0}</div>'},ltr:{styles:{direction:["ltr"]},isInline:!1,format:"[ltr]{0}[/ltr]",html:'<div style="direction: ltr">{0}</div>'},ignore:{}};function T(e,o){return e.replace(/\{([^}]+)\}/g,function(e,t){var n=!0;return"!"===t.charAt(0)&&(n=!1,t=t.substring(1)),"0"===t&&(n=!1),void 0===o[t]?e:n?d(o[t],!0):o[t]})}function C(e){return"function"==typeof e}function S(e){return e&&e.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2")}function E(e){var n=arguments;return e.replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[+t+1]?n[+t+1]:"{"+t+"}"})}var D="open",N="content",A="newline",M="close";function s(e,t,n,o,r,i){var a=this;a.type=e,a.name=t,a.val=n,a.attrs=o||{},a.children=r||[],a.closing=i||null}function R(e){var m=this;function a(e,t){var n,o,r;return e===D&&(n=t.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))&&(r=i(n[1]),n[2]&&(n[2]=n[2].trim())&&(o=function(e){var t,n=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,o={};if("="===e.charAt(0)&&e.indexOf("=",1)<0)o.defaultattr=S(e.substr(1));else for("="===e.charAt(0)&&(e="defaultattr"+e);t=n.exec(e);)o[i(t[1])]=S(t[3])||t[4];return o}(n[2]))),e===M&&(n=t.match(/\[\/([^\[\]]+)\]/))&&(r=i(n[1])),(r=e===A?"#newline":r)&&(e!==D&&e!==M||k[r])||(e=N,r="#"),new s(e,r,t,o)}function f(e,t,n){for(var o=n.length;o--;)if(n[o].type===t&&n[o].name===e)return 1}function p(e,t){e=(e?k[e.name]:{}).allowedChildren;return!m.opts.fixInvalidChildren||!e||-1<e.indexOf(t.name||"#")}function h(e,t,n){var o=/\s|=/.test(e);return C(t)?t(e,n):t===x.never||t===x.auto&&!o?e:'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function g(e){return e.length?e[e.length-1]:null}function i(e){return e.toLowerCase()}m.opts=o({},R.defaults,e),m.tokenize=function(e){var t,n,o,r=[],i=[{type:N,regex:/^([^\[\r\n]+|\[)/},{type:A,regex:/^(\r\n|\r|\n)/},{type:D,regex:/^\[[^\[\]]+\]/},{type:M,regex:/^\[\/[^\[\]]+\]/}];e:for(;e.length;){for(o=i.length;o--;)if(n=i[o].type,(t=e.match(i[o].regex))&&t[0]){r.push(a(n,t[0])),e=e.substr(t[0].length);continue e}e.length&&r.push(a(N,e)),e=""}return r},m.parse=function(e,t){var n=function(e){function t(){return g(d)}function n(e){(t()?t().children:u).push(e)}function o(e){return t()&&(i=k[t().name])&&i.closedBy&&-1<i.closedBy.indexOf(e)}var r,i,a,l,s,c=[],u=[],d=[];for(;r=e.shift();)switch(s=e[0],p(t(),r)||r.type===M&&t()&&r.name===t().name||(r.name="#",r.type=N),r.type){case D:o(r.name)&&d.pop(),n(r),(i=k[r.name])&&!i.isSelfClosing&&(i.closedBy||f(r.name,M,e))?d.push(r):i&&i.isSelfClosing||(r.type=N);break;case M:if(t()&&r.name!==t().name&&o("/"+r.name)&&d.pop(),t()&&r.name===t().name)t().closing=r,d.pop();else if(f(r.name,D,d)){for(;a=d.pop();){if(a.name===r.name){a.closing=r;break}a=a.clone(),c.length&&a.children.push(g(c)),c.push(a)}for(s&&s.type===A&&(i=k[r.name])&&!1===i.isInline&&(n(s),e.shift()),n(g(c)),l=c.length;l--;)d.push(c[l]);c.length=0}else r.type=N,n(r);break;case A:t()&&s&&o((s.type===M?"/":"")+s.name)&&(s.type===M&&s.name===t().name||((i=k[t().name])&&i.breakAfter||i&&!1===i.isInline&&m.opts.breakAfterBlock&&!1!==i.breakAfter)&&d.pop()),n(r);break;default:n(r)}return u}(m.tokenize(e)),e=m.opts;return e.fixInvalidNesting&&function e(t,n,o,r){var i,a,l,s;var c=function(e){var e=k[e.name];return!e||!1!==e.isInline};n=n||[];r=r||t;for(a=0;a<t.length;a++)if((i=t[a])&&i.type===D){var u;if(o&&!c(i))if(d=g(n),s=d.splitAt(i),l=1<n.length?n[n.length-2].children:r,p(i,d)&&((u=d.clone()).children=i.children,i.children=[u]),-1<(u=l.indexOf(d))){s.children.splice(0,1),l.splice(u+1,0,i,s);var d=s.children[0];return void(d&&d.type===A&&(c(i)||(s.children.splice(0,1),l.splice(u+2,0,d))))}n.push(i),e(i.children,n,o||c(i),r),n.pop()}}(n),function e(t,n,o){var r,i,a,l,s,c,u,d;var f=t.length;n&&(l=k[n.name]);var p=f;for(;p--;)(r=t[p])&&(r.type===A?(i=0<p?t[p-1]:null,a=p<f-1?t[p+1]:null,d=!1,!o&&l&&!0!==l.isSelfClosing&&(i?c||a||(!1===l.isInline&&m.opts.breakEndBlock&&!1!==l.breakEnd&&(d=!0),l.breakEnd&&(d=!0),c=d):(!1===l.isInline&&m.opts.breakStartBlock&&!1!==l.breakStart&&(d=!0),l.breakStart&&(d=!0))),i&&i.type===D&&(s=k[i.name])&&(o?!1===s.isInline&&(d=!0):(!1===s.isInline&&m.opts.breakAfterBlock&&!1!==s.breakAfter&&(d=!0),s.breakAfter&&(d=!0))),!o&&!u&&a&&a.type===D&&(s=k[a.name])&&(!1===s.isInline&&m.opts.breakBeforeBlock&&!1!==s.breakBefore&&(d=!0),s.breakBefore&&(d=!0),u=d)?t.splice(p,1):(d&&t.splice(p,1),u=!1)):r.type===D&&e(r.children,r,o))}(n,null,t),e.removeEmptyTags&&function e(t){var n,o;var r=function(e){for(var t=e.length;t--;){var n=e[t].type;if(n===D||n===M)return!1;if(n===N&&/\S|\u00A0/.test(e[t].val))return!1}return!0};var i=t.length;for(;i--;)(n=t[i])&&n.type===D&&(o=k[n.name],e(n.children),r(n.children)&&o&&!o.isSelfClosing&&!o.allowsEmpty&&t.splice.apply(t,[i,1].concat(n.children)))}(n),n},m.toHTML=function(e,t){return function e(t,n){var o,r,i,a,l,s,c,u="";s=function(e){return!1!==(!e||(void 0!==e.isHtmlInline?e.isHtmlInline:e.isInline))};for(;0<t.length;)if(o=t.shift()){if(o.type===D)c=o.children[o.children.length-1]||{},r=k[o.name],a=n&&s(r),i=e(o.children,!1),i=r&&r.html?(s(r)||!s(k[c.name])||r.isPreFormatted||r.skipLastLineBreak||(i+="<br />"),C(r.html)?r.html.call(m,o,o.attrs,i):(o.attrs[0]=i,T(r.html,o.attrs))):o.val+i+(o.closing?o.closing.val:"");else{if(o.type===A){if(!n){u+="<br />";continue}l||(u+="<div>"),u+="<br />",t.length||(u+="<br />"),u+="</div>\n",l=!1;continue}a=n,i=d(o.val,!0)}a&&!l?(u+="<div>",l=!0):!a&&l&&(u+="</div>\n",l=!1),u+=i}l&&(u+="</div>\n");return u}(m.parse(e,t),!0)},m.toBBCode=function(e,t){return function e(t){var n,o,r,i,a,l,s,c,u,d="";for(;0<t.length;)if(n=t.shift())if(r=k[n.name],u=!(!r||!1!==r.isInline),i=r&&r.isSelfClosing,l=u&&m.opts.breakBeforeBlock&&!1!==r.breakBefore||r&&r.breakBefore,s=u&&!i&&m.opts.breakStartBlock&&!1!==r.breakStart||r&&r.breakStart,c=u&&m.opts.breakEndBlock&&!1!==r.breakEnd||r&&r.breakEnd,u=u&&m.opts.breakAfterBlock&&!1!==r.breakAfter||r&&r.breakAfter,a=(r?r.quoteType:null)||m.opts.quoteType||x.auto,r||n.type!==D)if(n.type===D){if(l&&(d+="\n"),d+="["+n.name,n.attrs)for(o in n.attrs.defaultattr&&(d+="="+h(n.attrs.defaultattr,a,"defaultattr"),delete n.attrs.defaultattr),n.attrs)n.attrs.hasOwnProperty(o)&&(d+=" "+o+"="+h(n.attrs[o],a,o));d+="]",s&&(d+="\n"),n.children&&(d+=e(n.children)),i||r.excludeClosing||(c&&(d+="\n"),d+="[/"+n.name+"]"),u&&(d+="\n"),n.closing&&i&&(d+=n.closing.val)}else d+=n.val;else d+=n.val,n.children&&(d+=e(n.children)),n.closing&&(d+=n.closing.val);return d}(m.parse(e,t))}}function n(e){return e=parseInt(e,10),isNaN(e)?"00":(e=Math.max(0,Math.min(e,255)).toString(16)).length<2?"0"+e:e}function c(e){var t;return(t=(e=e||"#000").match(/rgb\((\d{1,3}),\s*?(\d{1,3}),\s*?(\d{1,3})\)/i))?"#"+n(t[1])+n(t[2])+n(t[3]):(t=e.match(/#([0-f])([0-f])([0-f])\s*?$/i))?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:e}function u(){var u=this;u.stripQuotes=S;var d={},s=[],f={ul:["li","ol","ul"],ol:["li","ol","ul"],table:["tr"],tr:["td","th"],code:["br","p","div"]};function e(){r(k,function(e,n){var t=k[e].tags,e=k[e].styles;t&&r(t,function(e,t){d[e]=d[e]||[],d[e].push([(e=t)instanceof Object&&e.constructor===Object?Object.entries(t):t,n.matchAttrs||u.opts.matchAttrs||2,n.format,!1===n.isInline])}),e&&r(e,function(e,t){s.push([e,t,n])})})}function p(e,t,n){for(var o,r,i,a,l=0;l<s.length;l++)o=s[l][0],r=s[l][1],!1===(i=s[l][2]).isInline===n&&(!(a=h.getStyle(e,o))||e.parentNode&&h.hasStyle(e.parentNode,o,a)||r&&!r.includes(a)||(t=C(i.format)?i.format.call(u,e,t):E(i.format,t)));return t}function m(n,e,t){function o(e){var t=v(n,e[0]);return t&&(!e[1]||e[1].includes(t))}var r,i,a,l,s=n.nodeName.toLowerCase(),c=d[s];if(c)for(r=0;r<c.length;r++)i=c[r][0],a=c[r][1],l=c[r][2],c[r][3]===t&&(a=Array.prototype[a===w.all?"every":"some"],i&&!a.call(i,o)||(e=C(l)?l.call(u,n,e):E(l,e)));return e}function c(e){var c=function(e,l){var s="";return h.traverse(e,function(e){var t="",n=e.nodeType,o=e.nodeName.toLowerCase(),r=f[o],i=e.firstChild,a=!0;"object"==typeof l&&(a=-1<l.indexOf(o),(a=y(e,"img")&&v(e,b)?!0:a)||(r=l)),3!==n&&1!==n||(1===n?y(e,".sceditor-nlf")&&!i||("iframe"!==o&&(t=c(e,r)),a?("code"!==o&&(t=p(e,t,!1),t=p(e,t=m(e,t,!1),!0)),t=m(e,t,!0),s+=function(e,t){var n=e.nodeName.toLowerCase(),o=h.isInline;if(!o(e,!0)||"br"===n){for(var r,i,a=e.previousSibling;a&&1===a.nodeType&&!y(a,"br")&&o(a,!0)&&!a.firstChild;)a=a.previousSibling;for(;r=((i=e.parentNode)&&i.lastChild)===e,e=i,i&&r&&o(i,!0););r&&"li"!==n||(t+="\n"),"br"!==n&&a&&!y(a,"br")&&o(a,!0)&&(t="\n"+t)}return t}(e,t)):s+=t):s+=e.nodeValue)},!1,!0),s};return c(e)}function t(e,t,n){var o,r,t=new R(u.opts.parserOptions).toHTML(u.opts.bbcodeTrim?t.trim():t);return e||n?(e=t,r=document.createElement("div"),n=function(e,t){if(!h.hasStyling(e)){if(1!==e.childNodes.length||!y(e.firstChild,"br"))for(;o=e.firstChild;)r.insertBefore(o,e);!t||e!==(t=r.lastChild)&&y(t,"div")&&e.nextSibling===t&&r.insertBefore(document.createElement("br"),e),r.removeChild(e)}},g(r,"display","none"),r.innerHTML=e.replace(/<\/div>\n/g,"</div>"),(e=r.firstChild)&&y(e,"div")&&n(e,!0),(e=r.lastChild)&&y(e,"div")&&n(e),r.innerHTML):t}function n(e,t,n,o){var r,i=(n=n||document).createElement("div"),a=n.createElement("div"),l=new R(u.opts.parserOptions);for(a.innerHTML=t,g(i,"visibility","hidden"),i.appendChild(a),n.body.appendChild(i),e&&(i.insertBefore(n.createTextNode("#"),i.firstChild),i.appendChild(n.createTextNode("#"))),o&&g(a,"whiteSpace",g(o,"whiteSpace")),r=a.getElementsByClassName("sceditor-ignore");r.length;)r[0].parentNode.removeChild(r[0]);return h.removeWhiteSpace(i),a=c(a),n.body.removeChild(i),a=l.toBBCode(a,!0),a=u.opts.bbcodeTrim?a.trim():a}u.init=function(){u.opts=this.opts,u.elementToBbcode=c,e(),this.commands=o(!0,{},l,this.commands),this.toBBCode=u.toSource,this.fromBBCode=u.toHtml},u.toHtml=t.bind(null,!1),u.fragmentToHtml=t.bind(null,!0),u.toSource=n.bind(null,!1),u.fragmentToSource=n.bind(null,!0)}s.prototype={clone:function(){var e=this;return new s(e.type,e.name,e.val,o({},e.attrs),[],e.closing?e.closing.clone():null)},splitAt:function(e){var t=this.clone(),n=this.children.indexOf(e);return-1<n&&(e=this.children.length-n,t.children=this.children.splice(n,e)),t}},R.QuoteType=x,R.MatchingMode=w,R.defaults={breakBeforeBlock:!1,breakStartBlock:!1,breakEndBlock:!1,breakAfterBlock:!0,removeEmptyTags:!0,fixInvalidNesting:!0,fixInvalidChildren:!0,quoteType:x.auto,matchAttrs:w.any},u.get=function(e){return k[e]||null},u.set=function(e,t){return e&&t&&((t=o(k[e]||{},t)).remove=function(){delete k[e]},k[e]=t),this},u.rename=function(e,t){return e in k&&(k[t]=k[e],delete k[e]),this},u.remove=function(e){return e in k&&delete k[e],this},u.formatBBCodeString=T,e.formats.bbcode=u,e.BBCodeParser=R}(sceditor); |