From e0b09bce0d9788eca5e549c18bd24e7a93b8c50e Mon Sep 17 00:00:00 2001 From: james-song Date: Sun, 2 Apr 2023 12:52:44 +0900 Subject: [PATCH 1/6] Fixed #1205, removed image style in preview page --- src/lib/core.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/lib/core.js b/src/lib/core.js index 5ef4173f..92d304d1 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -5349,11 +5349,27 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re const sv = m.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/); if (!v) v = []; if (sv) { - w = sv[0].match(/width:(.+);/); - w = util.getNumber(w ? w[1] : '', -1) || ''; - h = sv[0].match(/height:(.+);/); - h = util.getNumber(h ? h[1] : '', -1) || ''; - } + let w_px = ''; + let h_px = ''; + let w_per = ''; + let h_per = ''; + + w_px = sv[0].match(/width:(.+)px;/); + w_px = util.getNumber(w_px ? w_px[1] : '', -1) || null; + h_px = sv[0].match(/height:(.+)px;/); + h_px = util.getNumber(h_px ? h_px[1] : '', -1) || null; + + w_per = sv[0].match(/width:(.+)%;/); + w_per = util.getNumber(w_per ? w_per[1] : '', -1) || null; + h_per = sv[0].match(/height:(.+)%;/); + h_per = util.getNumber(h_per ? h_per[1] : '', -1) || null; + + w = w_px || w_per; + h = h_px || h_per; + let w_ = w_px ? w_px + 'px' : w_per ? w_per + '%' : 'auto'; + let h_ = h_px ? h_px + 'px' : h_per ? w_per + '%' : 'auto'; + v.push(`style="width: ${w_}; height: ${h_}"`); + } if (!w || !h) { const avw = m.match(/width\s*=\s*((?:"|')[^"']*(?:"|'))/); From 281a9514edc8c7193bbf0339c8bcbaefa8bb24b8 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Mon, 3 Apr 2023 14:48:10 +0900 Subject: [PATCH 2/6] fix: #1205 removed component style when get --- src/lib/core.js | 7 +++---- src/lib/util.js | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/core.js b/src/lib/core.js index 92d304d1..de97c7f2 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -5344,11 +5344,13 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re } // img - if (tagName === 'img') { + if (util.isFigures(tagName)) { let w = '', h = ''; const sv = m.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/); if (!v) v = []; if (sv) { + v.push(sv[0]); + let w_px = ''; let h_px = ''; let w_per = ''; @@ -5366,9 +5368,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re w = w_px || w_per; h = h_px || h_per; - let w_ = w_px ? w_px + 'px' : w_per ? w_per + '%' : 'auto'; - let h_ = h_px ? h_px + 'px' : h_per ? w_per + '%' : 'auto'; - v.push(`style="width: ${w_}; height: ${h_}"`); } if (!w || !h) { diff --git a/src/lib/util.js b/src/lib/util.js index fa56ef22..f988d821 100755 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -857,6 +857,15 @@ const util = { return node && /^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test(typeof node === 'string' ? node : node.nodeName); }, + /** + * @description Check the node is a figure tag or util.isMedia() + * @param {Node|String} node The element or element name to check + * @returns {Boolean} + */ + isFigures: function (node) { + return node && (this.isMedia(node) || /^(FIGURE)$/i.test(typeof node === 'string' ? node : node.nodeName)); + }, + /** * @description Checks for numeric (with decimal point). * @param {String|Number} text Text string or number From 969e6ba87a833a0ec9401aad436f99210f036bbf Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Fri, 7 Apr 2023 20:22:51 +0900 Subject: [PATCH 3/6] fix: #1207 font-size unit convert --- src/lib/core.js | 10 +++++----- src/lib/util.js | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/core.js b/src/lib/core.js index de97c7f2..9b65916a 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -5221,8 +5221,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re _convertFontSize: function (to, size) { const math = this._w.Math; const value = size.match(/(\d+(?:\.\d+)?)(.+)/); - const sizeNum = value[1] * 1; - const from = value[2]; + const sizeNum = value ? value[1] * 1 : util.fontValueMap[size]; + const from = value ? value[2] : 'rem'; let pxSize = sizeNum; if (/em/.test(from)) { @@ -5263,7 +5263,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re const allowedStyle = []; for (let i = 0, len = style.length, r; i < len; i++) { r = style[i].match(/([a-zA-Z0-9-]+)(:)([^:]+$)/); - if (r && !/inherit|initial/i.test(r[3])) { + if (r && !/inherit|initial|revert|unset/i.test(r[3])) { const k = util.kebabToCamelCase(r[1].trim()); const v = this.wwComputedStyle[k].replace(/"/g, ''); const c = r[3].trim(); @@ -5274,7 +5274,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re case 'fontSize': if (!options.plugins.fontSize) continue; if (!this._cleanStyleRegExp.fontSizeUnit.test(r[0])) { - r[0] = r[0].replace(this._w.RegExp('\\d+' + r[0].match(/\d+(.+$)/)[1]), this._convertFontSize.bind(this, options.fontSizeUnit)); + r[0] = r[0].replace((r[0].match(/:\s*([^;]+)/) || [])[1], this._convertFontSize.bind(this, options.fontSizeUnit)); } break; case 'color': @@ -5323,7 +5323,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re else v = m.match(lowLevelCheck ? this._attributesWhitelistRegExp : this._attributesWhitelistRegExp_all_data); // attribute - if (lowLevelCheck) { + if (lowLevelCheck || tagName === 'span') { if (tagName === 'a') { const sv = m.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g); if (sv) { diff --git a/src/lib/util.js b/src/lib/util.js index f988d821..8832880c 100755 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -59,6 +59,16 @@ const util = { */ onlyZeroWidthRegExp: new RegExp('^' + String.fromCharCode(8203) + '+$'), + fontValueMap: { + 'xx-small': 1, + 'x-small': 2, + 'small': 3, + 'medium': 4, + 'large': 5, + 'x-large': 6, + 'xx-large': 7 + }, + /** * @description A method that checks If the text is blank or to see if it contains 'ZERO WIDTH SPACE' or empty (util.zeroWidthSpace) * @param {String|Node} text String value or Node From c819a6dcf8e67bc45861ba5d578f0325b65a39d2 Mon Sep 17 00:00:00 2001 From: Yi JiHong <0125ses@hanmail.net> Date: Sun, 9 Apr 2023 21:10:54 +0900 Subject: [PATCH 4/6] version up: 2.44.7 --- dist/suneditor.min.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index 7214682d..cf1e66c0 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this._onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},_onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(e){(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.options.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,"function"==typeof this.plugins[e].init&&this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},JhlZ:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(e){const t=e.context;t.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let n=e.util.createElement("DIV");n.className="se-file-browser sun-editor-common";let i=e.util.createElement("DIV");i.className="se-file-browser-back";let l=e.util.createElement("DIV");l.className="se-file-browser-inner",l.innerHTML=this.set_browser(e),n.appendChild(i),n.appendChild(l),this._loading=n.querySelector(".se-loading-box"),t.fileBrowser.area=n,t.fileBrowser.header=l.querySelector(".se-file-browser-header"),t.fileBrowser.titleArea=l.querySelector(".se-file-browser-title"),t.fileBrowser.tagArea=l.querySelector(".se-file-browser-tags"),t.fileBrowser.body=l.querySelector(".se-file-browser-body"),t.fileBrowser.list=l.querySelector(".se-file-browser-list"),t.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(e)),t.fileBrowser.list.addEventListener("click",this.onClickFile.bind(e)),l.addEventListener("mousedown",this._onMouseDown_browser.bind(e)),l.addEventListener("click",this._onClick_browser.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},set_browser:function(e){const t=e.lang;return'
'},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.options.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url,this.context[e].header)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e,t){const n=this.plugins.fileBrowser,i=n._xmlHttp=this.util.getXMLHttpRequest();if(i.onreadystatechange=n._callBackGet.bind(this,i),i.open("get",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)i.setRequestHeader(e,t[e]);i.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{const t=JSON.parse(e.responseText);t.result.length>0?this.plugins.fileBrowser._drawListItem.call(this,t.result,!0):t.nullMessage&&(this.context.fileBrowser.list.innerHTML=t.nullMessage)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],s=e.length,o=i.columnSize||n.columnSize,a=o<=1?1:Math.round(s/o)||1,r=i.itemTemplateHandler;let c="",d='
',u=1;for(let n,i,h=0;h
'),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,s=l.tagArea.querySelector('a[title="'+n+'"]'),o=l.selectedTags,a=o.indexOf(n);a>-1?(o.splice(a,1),this.util.removeClass(s,"on")):(o.push(n),this.util.addClass(s,"on")),i._drawListItem.call(this,0===o.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return o.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const s=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),s(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",dir_ltr:"Left to right",dir_rtl:"Right to left",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window",downloadLinkCheck:"Download link",bookmark:"Bookmark"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]},t.colorPicker.colorListHTML=this.createColorList(e,this._makeColorList)},createColorList:function(e,t){const n=e.options,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];let s=[],o='
';for(let e,n=0,i=l.length;n0&&(o+='
'+t(s)+"
",s=[]),"object"==typeof e&&(o+='
'+t(e)+"
")));return o+='
",o},_makeColorList:function(e){let t="";t+='
    ';for(let n,i=0,l=e.length;i');return t+="
",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.color;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},s={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.backgroundColor;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#ffffff",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},o={name:"template",display:"submenu",add:function(e,t){e.context.template={selectedIndex:-1};let n=this.setSubmenu(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(e){const t=e.options.templates;if(!t||0===t.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const n=e.util.createElement("DIV");n.className="se-list-layer";let i='
    ';for(let e,n=0,l=t.length;n";return i+="
",n.innerHTML=i,n},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation(),this.context.template.selectedIndex=1*e.target.getAttribute("data-value");const t=this.options.templates[this.context.template.selectedIndex];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"selectMenu",add:function(e){e.context.selectMenu={caller:{},callerContext:null}},setForm:function(){return'
'},createList:function(e,t,n){e.form.innerHTML="
    "+n+"
",e.items=t,e.menus=e.form.querySelectorAll("li")},initEvent:function(e,t){const n=t.querySelector(".se-select-list"),i=this.context.selectMenu.caller[e]={form:n,items:[],menus:[],index:-1,item:null,clickMethod:null,callerName:e};n.addEventListener("mousedown",this.plugins.selectMenu.onMousedown_list),n.addEventListener("mousemove",this.plugins.selectMenu.onMouseMove_list.bind(this,i)),n.addEventListener("click",this.plugins.selectMenu.onClick_list.bind(this,i))},onMousedown_list:function(e){e.preventDefault(),e.stopPropagation()},onMouseMove_list:function(e,t){this.util.addClass(e.form,"__se_select-menu-mouse-move");const n=t.target.getAttribute("data-index");n&&(e.index=1*n)},onClick_list:function(e,t){const n=t.target.getAttribute("data-index");n&&e.clickMethod.call(this,e.items[n])},moveItem:function(e,t){this.util.removeClass(e.form,"__se_select-menu-mouse-move"),t=e.index+t;const n=e.menus,i=n.length,l=e.index=t>=i?0:t<0?i-1:t;for(let e=0;e
"+e.plugins.selectMenu.setForm()+'
'+l.bookmark+''+l.download+'
",s.innerHTML=o,s},initEvent:function(e,t){const n=this.plugins.anchor,i=this.context.anchor.caller[e]={modal:t,urlInput:null,linkDefaultRel:this.options.linkRelDefault,defaultRel:this.options.linkRelDefault.default||"",currentRel:[],linkAnchor:null,linkValue:"",_change:!1,callerName:e};"string"==typeof i.linkDefaultRel.default&&(i.linkDefaultRel.default=i.linkDefaultRel.default.trim()),"string"==typeof i.linkDefaultRel.check_new_window&&(i.linkDefaultRel.check_new_window=i.linkDefaultRel.check_new_window.trim()),"string"==typeof i.linkDefaultRel.check_bookmark&&(i.linkDefaultRel.check_bookmark=i.linkDefaultRel.check_bookmark.trim()),i.urlInput=t.querySelector(".se-input-url"),i.anchorText=t.querySelector("._se_anchor_text"),i.newWindowCheck=t.querySelector("._se_anchor_check"),i.downloadCheck=t.querySelector("._se_anchor_download"),i.download=t.querySelector("._se_anchor_download_icon"),i.preview=t.querySelector(".se-link-preview"),i.bookmark=t.querySelector("._se_anchor_bookmark_icon"),i.bookmarkButton=t.querySelector("._se_bookmark_button"),this.plugins.selectMenu.initEvent.call(this,e,t);const l=this.context.selectMenu.caller[e];this.options.linkRel.length>0&&(i.relButton=t.querySelector(".se-anchor-rel-btn"),i.relList=t.querySelector(".se-list-layer"),i.relPreview=t.querySelector(".se-anchor-rel-preview"),i.relButton.addEventListener("click",n.onClick_relButton.bind(this,i)),i.relList.addEventListener("click",n.onClick_relList.bind(this,i))),i.newWindowCheck.addEventListener("change",n.onChange_newWindowCheck.bind(this,i)),i.downloadCheck.addEventListener("change",n.onChange_downloadCheck.bind(this,i)),i.anchorText.addEventListener("input",n.onChangeAnchorText.bind(this,i)),i.urlInput.addEventListener("input",n.onChangeUrlInput.bind(this,i)),i.urlInput.addEventListener("keydown",n.onKeyDownUrlInput.bind(this,l)),i.urlInput.addEventListener("focus",n.onFocusUrlInput.bind(this,i,l)),i.urlInput.addEventListener("blur",n.onBlurUrlInput.bind(this,l)),i.bookmarkButton.addEventListener("click",n.onClick_bookmarkButton.bind(this,i))},on:function(e,t){const n=this.plugins.anchor;if(t){if(e.linkAnchor){this.context.dialog.updateModal=!0;const t=e.linkAnchor.getAttribute("href");e.linkValue=e.preview.textContent=e.urlInput.value=n.selfPathBookmark.call(this,t)?t.substr(t.lastIndexOf("#")):t,e.anchorText.value=e.linkAnchor.textContent,e.newWindowCheck.checked=!!/_blank/i.test(e.linkAnchor.target),e.downloadCheck.checked=e.linkAnchor.download}}else n.init.call(this,e),e.anchorText.value=this.getSelection().toString().trim(),e.newWindowCheck.checked=this.options.linkTargetNewWindow;this.context.anchor.callerContext=e,n.setRel.call(this,e,t&&e.linkAnchor?e.linkAnchor.rel:e.defaultRel),n.setLinkPreview.call(this,e,e.linkValue),this.plugins.selectMenu.on.call(this,e.callerName,this.plugins.anchor.setHeaderBookmark)},selfPathBookmark:function(e){const t=this._w.location.href.replace(/\/$/,"");return 0===e.indexOf("#")||0===e.indexOf(t)&&e.indexOf("#")===(-1===t.indexOf("#")?t.length:t.substr(0,t.indexOf("#")).length)},_closeRelMenu:null,toggleRelList:function(e,t){if(t){const t=e.relButton,n=e.relList;this.util.addClass(t,"active"),n.style.visibility="hidden",n.style.display="block",this.options.rtl?n.style.left=t.offsetLeft-n.offsetWidth-1+"px":n.style.left=t.offsetLeft+t.offsetWidth+1+"px",n.style.top=t.offsetTop+t.offsetHeight/2-n.offsetHeight/2+"px",n.style.visibility="",this.plugins.anchor._closeRelMenu=function(e,t,n){n&&(e.relButton.contains(n.target)||e.relList.contains(n.target))||(this.util.removeClass(t,"active"),e.relList.style.display="none",this.modalForm.removeEventListener("click",this.plugins.anchor._closeRelMenu),this.plugins.anchor._closeRelMenu=null)}.bind(this,e,t),this.modalForm.addEventListener("click",this.plugins.anchor._closeRelMenu)}else this.plugins.anchor._closeRelMenu&&this.plugins.anchor._closeRelMenu()},onClick_relButton:function(e,t){this.plugins.anchor.toggleRelList.call(this,e,!this.util.hasClass(t.target,"active"))},onClick_relList:function(e,t){const n=t.target,i=n.getAttribute("data-command");if(!i)return;const l=e.currentRel,s=this.util.toggleClass(n,"se-checked"),o=l.indexOf(i);s?-1===o&&l.push(i):o>-1&&l.splice(o,1),e.relPreview.title=e.relPreview.textContent=l.join(" ")},setRel:function(e,t){const n=e.relList,i=e.currentRel=t?t.split(" "):[];if(!n)return;const l=n.querySelectorAll("button");for(let e,t=0,n=l.length;t-1?this.util.addClass(l[t],"se-checked"):this.util.removeClass(l[t],"se-checked");e.relPreview.title=e.relPreview.textContent=i.join(" ")},createHeaderList:function(e,t,n){const i=this.util.getListChildren(this.context.element.wysiwyg,(function(e){return/h[1-6]/i.test(e.nodeName)}));if(0===i.length)return;const l=new this._w.RegExp("^"+n.replace(/^#/,""),"i"),s=[];let o="";for(let e,t=0,n=i.length;t'+e.textContent+"");0===s.length?this.plugins.selectMenu.close.call(this,t):(this.plugins.selectMenu.createList(t,s,o),this.plugins.selectMenu.open.call(this,t,this.plugins.anchor._setMenuListPosition.bind(this,e)))},_setMenuListPosition:function(e,t){t.style.top=e.urlInput.offsetHeight+1+"px"},onKeyDownUrlInput:function(e,t){switch(t.keyCode){case 38:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,-1);break;case 40:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,1);break;case 13:e.index>-1&&(t.preventDefault(),t.stopPropagation(),this.plugins.anchor.setHeaderBookmark.call(this,this.plugins.selectMenu.getItem(e,null)))}},setHeaderBookmark:function(e){const t=this.context.anchor.callerContext,n=e.id||"h_"+this._w.Math.random().toString().replace(/.+\./,"");e.id=n,t.urlInput.value="#"+n,t.anchorText.value.trim()&&t._change||(t.anchorText.value=e.textContent),this.plugins.anchor.setLinkPreview.call(this,t,t.urlInput.value),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext),this.context.anchor.callerContext.urlInput.focus()},onChangeAnchorText:function(e,t){e._change=!!t.target.value.trim()},onChangeUrlInput:function(e,t){const n=t.target.value.trim();this.plugins.anchor.setLinkPreview.call(this,e,n),this.plugins.anchor.selfPathBookmark.call(this,n)?this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,n):this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)},onFocusUrlInput:function(e,t){const n=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,n)&&this.plugins.anchor.createHeaderList.call(this,e,t,n)},onBlurUrlInput:function(e){this.plugins.selectMenu.close.call(this,e)},setLinkPreview:function(e,t){const n=e.preview,i=this.options.linkProtocol,l=this.options.linkNoPrefix,s=/^(mailto\:|tel\:|sms\:|https*\:\/\/|#)/.test(t),o=!!i&&this._w.RegExp("^"+t.substr(0,i.length)).test(i);t=e.linkValue=n.textContent=t?l?t:!i||s||o?s?t:/^www\./.test(t)?"http://"+t:this.context.anchor.host+(/^\//.test(t)?"":"/")+t:i+t:"",this.plugins.anchor.selfPathBookmark.call(this,t)?(e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active")):(e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active")),!this.plugins.anchor.selfPathBookmark.call(this,t)&&e.downloadCheck.checked?e.download.style.display="block":e.download.style.display="none"},setCtx:function(e,t){e&&(t.linkAnchor=e,t.linkValue=e.href,t.currentRel=e.rel.split(" "))},updateAnchor:function(e,t,n,i,l){!this.plugins.anchor.selfPathBookmark.call(this,t)&&i.downloadCheck.checked?e.setAttribute("download",n||t):e.removeAttribute("download"),i.newWindowCheck.checked?e.target="_blank":e.removeAttribute("target");const s=i.currentRel.join(" ");s?e.rel=s:e.removeAttribute("rel"),e.href=t,l?0===e.children.length&&(e.textContent=""):e.textContent=n},createAnchor:function(e,t){if(0===e.linkValue.length)return null;const n=e.linkValue,i=e.anchorText,l=0===i.value.length?n:i.value,s=e.linkAnchor||this.util.createElement("A");return this.plugins.anchor.updateAnchor.call(this,s,n,l,e,t),e.linkValue=e.preview.textContent=e.urlInput.value=e.anchorText.value="",s},onClick_bookmarkButton:function(e){let t=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,t)?(t=t.substr(1),e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)):(t="#"+t,e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active"),e.downloadCheck.checked=!1,e.download.style.display="none",this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,t)),e.urlInput.value=t,this.plugins.anchor.setLinkPreview.call(this,e,t),e.urlInput.focus()},onChange_newWindowCheck:function(e,t){"string"==typeof e.linkDefaultRel.check_new_window&&(t.target.checked?this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_new_window)):this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_new_window)))},onChange_downloadCheck:function(e,t){t.target.checked?(e.download.style.display="block",e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),e.linkValue=e.preview.textContent=e.urlInput.value=e.urlInput.value.replace(/^\#+/,""),"string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_bookmark))):(e.download.style.display="none","string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_bookmark)))},_relMerge:function(e,t){const n=e.currentRel;if(!t)return n.join(" ");if(/^only\:/.test(t))return t=t.replace(/^only\:/,"").trim(),e.currentRel=t.split(" "),t;const i=t.split(" ");for(let e,t=0,l=i.length;t'+i.cancel+''+t.dialogBox.linkBox.title+""+e.context.anchor.forms.innerHTML+'";return n.innerHTML=l,n},setController_LinkButton:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
",i},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();try{const e=this.plugins.anchor.createAnchor.call(this,this.context.anchor.caller.link,!1);if(null===e)return;if(this.context.dialog.updateModal){const e=this.context.link._linkAnchor.childNodes[0];this.setRange(e,0,e,e.textContent.length)}else{const t=this.getSelectedElements();if(t.length>1){const n=this.util.createElement(t[0].nodeName);if(n.appendChild(e),!this.insertNode(n,null,!0))return}else if(!this.insertNode(e,null,!0))return;this.setRange(e.childNodes[0],0,e.childNodes[0],e.textContent.length)}}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){this.plugins.anchor.on.call(this,this.context.anchor.caller.link,e)},call_controller:function(e){this.editLink=this.context.link._linkAnchor=this.context.anchor.caller.link.linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent,this.util.addClass(e,"on"),this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"link",this.util.removeClass.bind(this.util,this.context.link._linkAnchor,"on"))},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t))this.plugins.dialog.open.call(this,"link",!0);else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.anchor.caller.link.linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){this.context.link.linkController.style.display="none",this.plugins.anchor.init.call(this,this.context.anchor.caller.link)}},h=n("ZED3"),g=n.n(h),p=n("ee5k"),m=n.n(p),f=n("gjS+"),_=n.n(f),b={name:"image",display:"dialog",add:function(e){e.addModule([r.a,d,g.a,m.a,_.a]);const t=e.options,n=e.context,i=n.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:t._imageSizeUnit,_linkElement:"",_altText:"",_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_src:{_linkValue:""},svgDefaultSize:"30%",base64RenderIndex:0,_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.imageWidth?"":t.imageWidth,_origin_h:"auto"===t.imageHeight?"":t.imageHeight,_proportionChecked:!0,_resizing:t.imageResizing,_resizeDotHide:!t.imageHeightShow,_rotation:t.imageRotation,_alignHide:!t.imageAlignShow,_onlyPercentage:t.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let l=this.setDialog(e);i.modal=l,i.imgInputFile=l.querySelector("._se_image_file"),i.imgUrlFile=l.querySelector("._se_image_url"),i.focusElement=i.imgInputFile||i.imgUrlFile,i.altText=l.querySelector("._se_image_alt"),i.captionCheckEl=l.querySelector("._se_image_check_caption"),i.previewSrc=l.querySelector("._se_tab_content_image .se-link-preview"),l.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),l.querySelector("form").addEventListener("submit",this.submit.bind(e)),i.imgInputFile&&l.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(i.imgInputFile,i.imgUrlFile,i.previewSrc)),i.imgUrlFile&&i.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(i.previewSrc,i._v_src,t.linkProtocol)),i.imgInputFile&&i.imgUrlFile&&i.imgInputFile.addEventListener("change",this._fileInputChange.bind(i));const s=l.querySelector(".__se__gallery");s&&s.addEventListener("click",this._openGallery.bind(e)),i.proportion={},i.inputX={},i.inputY={},t.imageResizing&&(i.proportion=l.querySelector("._se_image_check_proportion"),i.inputX=l.querySelector("._se_image_size_x"),i.inputY=l.querySelector("._se_image_size_y"),i.inputX.value=t.imageWidth,i.inputY.value=t.imageHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),i.inputX.addEventListener("change",this.setRatio.bind(e)),i.inputY.addEventListener("change",this.setRatio.bind(e)),i.proportion.addEventListener("change",this.setRatio.bind(e)),l.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),n.dialog.modal.appendChild(l),e.plugins.anchor.initEvent.call(e,"image",l.querySelector("._se_tab_content_url")),i.anchorCtx=e.context.anchor.caller.image,l=null},setDialog:function(e){const t=e.options,n=e.lang,i=e.util.createElement("DIV");i.className="se-dialog-content se-dialog-image",i.style.display="none";let l='
'+n.dialogBox.imageBox.title+'
';if(t.imageFileInput&&(l+='
"),t.imageUrlInput&&(l+='
'+(t.imageGalleryUrl&&e.plugins.imageGallery?'":"")+'
'),l+='
',t.imageResizing){const i=t.imageSizeOnlyPercentage,s=i?' style="display: none !important;"':"",o=t.imageHeightShow?"":' style="display: none !important;"';l+='
',i||!t.imageHeightShow?l+='
":l+='
",l+=' '+n.dialogBox.proportion+'
"}return l+='
",i.innerHTML=l,i},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.imageWidth===t._defaultSizeX?"":this.options.imageWidth,t.inputY.value=t._origin_h=this.options.imageHeight===t._defaultSizeY?"":this.options.imageHeight,t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple")),this.plugins.anchor.on.call(this,t.anchorCtx,e)},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,s,o;for(s=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this,t._v_src._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const s={anchor:this.plugins.anchor.createAnchor.call(this,l.anchorCtx,!0),inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,alt:l._altText,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,s,e):this.plugins.image.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.options.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e'+e.icons.cancel+''+n.dialogBox.videoBox.title+'
';if(t.videoFileInput&&(l+='
"),t.videoUrlInput&&(l+='
'),t.videoResizing){const i=t.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],s=t.videoRatio,o=t.videoSizeOnlyPercentage,a=o?' style="display: none !important;"':"",r=t.videoHeightShow?"":' style="display: none !important;"',c=t.videoRatioShow?"":' style="display: none !important;"',d=o||t.videoHeightShow||t.videoRatioShow?"":' style="display: none !important;"';l+='
"}return l+='
",i.innerHTML=l,i},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.videoWidth===t._defaultSizeX?"":this.options.videoWidth,t.inputY.value=t._origin_h=this.options.videoHeight===t._defaultSizeY?"":this.options.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const s={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,s,e):this.plugins.video.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.options.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(e)){if(0===(e=(new this._w.DOMParser).parseFromString(e,"text/html").querySelector("iframe").src).length)return!1}if(/youtu\.?be/.test(e)){if(/^http/.test(e)||(e="https://"+e),e=e.replace("watch?v=",""),/^\/\/.+\/embed\//.test(e)||(e=e.replace(e.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t._youtubeQuery.length>0)if(/\?/.test(e)){const n=e.split("?");e=n[0]+"?"+t._youtubeQuery+"&"+n[1]}else e+="?"+t._youtubeQuery}else/vimeo\.com/.test(e)&&(e.endsWith("/")&&(e=e.slice(0,-1)),e="https://player.vimeo.com/video/"+e.slice(e.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video[/embed|iframe|player|\/e\/|\.php|\.html?/.test(e)||/vimeo\.com/.test(e)?"createIframeTag":"createVideoTag"].call(this),e,t.inputX.value,t.inputY.value,t._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,s,o){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(o){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!o||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;if(o)a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null);else if(p=this.insertComponent(c,!1,!0,!this.options.mediaAutoSelect),!this.options.mediaAutoSelect){const e=this.appendFormatTag(c,null);e&&this.setRange(e,0,e,0)}p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,s,!0),o&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);let n=this.util.isRangeFormatElement(e.parentNode)||this.util.isWysiwygDiv(e.parentNode)?e:this.util.getFormatElement(e)||e;const i=e;t._element=e=e.cloneNode(!0);const l=t._cover=this.plugins.component.set_cover.call(this,e),s=t._container=this.plugins.component.set_container.call(this,l,"se-video-container");try{const o=n.querySelector("figcaption");let a=null;o&&(a=this.util.createElement("DIV"),a.innerHTML=o.innerHTML,this.util.removeItem(o));const r=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,r[0]||i.style.width||i.width||"",r[1]||i.style.height||i.height||"");const c=this.util.getFormatElement(i);if(c&&(t._align=c.style.textAlign||c.style.float),this.plugins.video.setAlign.call(this,null,e,l,s),this.util.getParentElement(i,this.util.isNotCheckingNode))i.parentNode.replaceChild(s,i);else if(this.util.isListCell(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n.insertBefore(s,e),this.util.removeItem(i),this.util.removeEmptyNode(e,null,!0)}else if(this.util.isFormatElement(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n=this.util.splitElement(n,e),n.parentNode.insertBefore(s,n),this.util.removeItem(i),this.util.removeEmptyNode(n,null,!0),0===n.children.length&&(n.innerHTML=this.util.htmlRemoveWhiteSpace(n.innerHTML))}else n.parentNode.replaceChild(s,n);a&&n.parentNode.insertBefore(a,s.nextElementSibling)}catch(e){console.warn("[SUNEDITOR.video.error] Maybe the video tag is nested.",e)}this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0),this.plugins.video.init.call(this)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.style.float||e.getAttribute("data-align")||"none",e.style.float="",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i,l,s=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");s?(s=s.split(","),i=s[0],l=s[1]):t&&(i=t.w,l=t.h),n._origin_w=i||e.style.width||e.width||"",n._origin_h=l||e.style.height||e.height||""},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),(t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]')||t.modal.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,s=i.length;l'+e.icons.cancel+''+n.dialogBox.audioBox.title+'
';return t.audioFileInput&&(l+='
"),t.audioUrlInput&&(l+='
'),l+='
",i.innerHTML=l,i},setController:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
",i},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const s={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,s,e):this.plugins.audio.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.options.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+e.icons.cancel+''+t.dialogBox.mathBox.title+'

",e.context.math.defaultFontSize=l,n.innerHTML=s,n},setController_MathButton:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
",n},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp")||!this.options.katex)return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){let t="";try{this.util.removeClass(this.context.math.focusElement,"se-error"),t=this.options.katex.src.renderToString(e,{throwOnError:!0,displayMode:!0})}catch(e){this.util.addClass(this.context.math.focusElement,"se-error"),t='Katex syntax error. (Refer KaTeX)',console.warn("[SUNEDITOR.math.Katex.error] ",e)}return t},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController;this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},w=n("JhlZ"),x=n.n(w),E={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_itemMenu:null,_alignList:null,currentAlign:"",defaultDir:e.options.rtl?"right":"left",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu(e),s=i.align._itemMenu=l.querySelector("ul");s.addEventListener("click",this.pickup.bind(e)),i.align._alignList=s.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,s=null},setSubmenu:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV"),l=e.options.alignItems;let s="";for(let e,i,o=0;o";return i.className="se-submenu se-list-layer se-list-align",i.innerHTML='
    '+s+"
",i},active:function(e){const t=this.context.align,n=t.targetButton,i=n.firstElementChild;if(e){if(this.util.isFormatElement(e)){const l=e.style.textAlign;if(l)return this.util.changeElement(i,t.icons[l]||t.icons[t.defaultDir]),n.setAttribute("data-focus",l),!0}}else this.util.changeElement(i,t.icons[t.defaultDir]),n.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||e.defaultDir;if(n!==e.currentAlign){for(let e=0,i=t.length;e
  • ";for(s=0,o=a.length;s";return r+="
",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,this.lang.toolbar.font+" ("+i+")"),!0}}else{const e=this.hasFocus?this.wwComputedStyle.fontFamily:this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,this.hasFocus?this.lang.toolbar.font+(e?" ("+e+")":""):e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+n.toolbar.default+")";for(let e,n=0,i=t.fontSizeUnit,o=l.length;n";return s+="",i.innerHTML=s,i},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,this._convertFontSize.call(this,this.options.fontSizeUnit,e.style.fontSize)),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.hasFocus?this._convertFontSize.call(this,this.options.fontSizeUnit,this.wwComputedStyle.fontSize):this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e";return n.className="se-submenu se-list-layer se-list-line",n.innerHTML='
    '+l+"
",n},active:function(e){if(e){if(/HR/i.test(e.nodeName))return this.context.horizontalRule.currentHR=e,this.util.hasClass(e,"on")||(this.util.addClass(e,"on"),this.controllersOn("hr",this.util.removeClass.bind(this.util,e,"on"))),!0}else this.util.hasClass(this.context.horizontalRule.currentHR,"on")&&this.controllersOff();return!1},appendHr:function(e){return this.focus(),this.insertComponent(e.cloneNode(!1),!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=t.getAttribute("data-command");for(;!n&&!/UL/i.test(t.tagName);)t=t.parentNode,n=t.getAttribute("data-command");if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,t.firstElementChild);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML='
",n},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}return t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active"),!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(h=a),r&&f===p&&!s.isRangeFormatElement(_)||(d||(d=a),i&&r&&f===p||r&&s.isList(p)&&p===c||a.parentNode!==f&&f.insertBefore(a,_)),s.removeItem(n),i&&null===g&&(g=a.children.length-1),r&&(s.getRangeFormatElement(p,m)!==s.getRangeFormatElement(c,m)||s.isList(p)&&s.isList(c)&&s.getElementDepth(p)!==s.getElementDepth(c))&&(a=s.createElement(e)),b&&0===b.children.length&&s.removeItem(b)}else s.removeItem(n);g&&(d=d.children[g]),o&&(p=a.children.length-1,a.innerHTML+=c.innerHTML,h=a.children[p],s.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=s.getRangeFormatElement(o),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(s);i||(r=s.createElement(e));for(let t,o,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,s=this.util.getPositionIndex(i);for(;t[s];)e.appendChild(t[s]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(o);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],s=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;s=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),o=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,s=0,c=n;s span > span"),i.columnFixedButton=o.querySelector("._se_table_fixed_column"),i.headerButton=o.querySelector("._se_table_header");let a=this.setController_tableEditor(e,i.cellControllerTop);i.resizeDiv=a,i.splitMenu=a.querySelector(".se-btn-group-sub"),i.mergeButton=a.querySelector("._se_table_merge_button"),i.splitButton=a.querySelector("._se_table_split_button"),i.insertRowAboveButton=a.querySelector("._se_table_insert_row_a"),i.insertRowBelowButton=a.querySelector("._se_table_insert_row_b"),s.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e,i)),s.addEventListener("click",this.appendTable.bind(e)),a.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,l),n.element.relative.appendChild(a),n.element.relative.appendChild(o),l=null,s=null,a=null,o=null,i=null},setSubmenu:function(e){const t=e.util.createElement("DIV");return t.className="se-submenu se-selector-table",t.innerHTML='
1 x 1
',t},setController_table:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-table",i.innerHTML='
",i},setController_tableEditor:function(e,t){const n=e.lang,i=e.icons,l=e.util.createElement("DIV");return l.className="se-controller se-controller-table-cell",l.innerHTML=(t?"":'
')+'
  • '+n.controller.VerticalSplit+'
  • '+n.controller.HorizontalSplit+"
",l},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

",t}{let n="";for(;t>0;)n+="<"+e+">

",t--;return n}},onMouseMove_tablePicker:function(e,t){t.stopPropagation();let n=this._w.Math.ceil(t.offsetX/18),i=this._w.Math.ceil(t.offsetY/18);n=n<1?1:n,i=i<1?1:i,e._rtl&&(e.tableHighlight.style.left=18*n-13+"px",n=11-n),e.tableHighlight.style.width=n+"em",e.tableHighlight.style.height=i+"em",this.util.changeTxt(e.tableDisplay,n+" x "+i),e._tableXY=[n,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;ts||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)));if(s===o&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,s="row"===e;if(s){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(s)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,s=l.length;no&&o>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[s+1];if(e){const t=[];let n=r[s].cells,i=0;for(let e,l,s=0,o=n.length;s1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let s,o,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,s),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!s[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+o?h.push(e):p<=t+o&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+o,p,p+r):n>0&&(pt+o)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&s.length>0&&(p=this.plugins.table.createCells.call(this,s[0].nodeName,0,!0),p=e.insertBefore(p,s[t]))}}if(l){let e,t;for(let n,l=0,s=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,o.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let o,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:s+1,rs:d,row:-1}),i!==l&&u<=a&&u+s>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=s}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}o.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(s,o)+n;for(let e,t,n=0;n=a));c++)l=e[c],s=l.rowSpan-1,s>0&&s+n>=r&&o=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||s===o-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=o.cells;for(let e=0,t=a.length;e0&&o+s>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,o,o+s));else s.push(e[o]);for(let e=0,t=s.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,s,o;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(s=t.icons.reduction,o=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(s=t.icons.expansion,o=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,s),this.util.changeTxt(l,o)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,s=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=s.length;e0)for(let e,t=0;td||(u>=e.index?(s+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(o){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){o=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==s){c.cs=e,c.ce=t,c.rs=n,c.re=s,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),s+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(t=e.toLowerCase(),i="blockquote"===t?"range":"pre"===t?"free":"replace",r=/^h/.test(t)?t.match(/\d+/)[0]:"",a=n["tag_"+(r?"h":t)]+r,d="",c=""):(t=e.tag.toLowerCase(),i=e.command,a=e.name||t,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",i.innerHTML=o,i},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText;if(e){if(this.util.isFormatElement(e)){const i=this.context.formatBlock._formatList,l=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,o=i.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),s=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),o=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,o?o.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!s||!c||/
    $/i.test(s)?s:s+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),s&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,o=p.length;n('+n.toolbar.default+")";for(let e,t=0,n=l.length;t";return s+="",i.innerHTML=s,i},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",n.innerHTML=o,n},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return s+="",n.innerHTML=s,n},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,s,o=0,a=t.length;o'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.plugins.image.create_image.call(this,e.getAttribute("data-value"),null,this.context.image._origin_w,this.context.image._origin_h,"none",t,e.alt)}.bind(this),null)}}},S={rtl:{italic:'',indent:'',outdent:'',list_bullets:'',list_number:'',link:'',unlink:''},redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',bookmark:'',download:'',dir_ltr:'',dir_rtl:'',alert_outline:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},N=n("P6u4"),T=n.n(N);const k={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,isChromium:null,isResizeObserverSupported:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform),this.isChromium=!!window.chrome,this.isResizeObserverSupported="function"==typeof ResizeObserver)},_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas",_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return null!=e&&("string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e))},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},getValues:function(e){return e?this._w.Object.keys(e).map((function(t){return e[t]})):[]},camelToKebabCase:function(e){return"string"==typeof e?e.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},kebabToCamelCase:function(e){return"string"==typeof e?e.replace(/-[a-zA-Z]/g,(function(e){return e.replace("-","").toUpperCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",s="js"===t?"src":"href";let o="(?:";for(let t=0,n=e.length;t0?i[0][s]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){if(!e||!e.toString)return 0;e=e.toString();const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e)).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isUneditableComponent:function(e){return e&&this.hasClass(e,"__se__uneditable")},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t,n){t.style.cssText&&(e.style.cssText+=t.style.cssText);const i=t.attributes;for(let t=0,l=i.length;t-1||e.setAttribute(i[t].name,i[t].value);const l=e.attributes;for(let t=0,n=l.length;to?1:s0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const s=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==s;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const o=t&&/iframe/i.test(t.nodeName);return{left:n+(o?t.parentElement.offsetLeft:0),top:i-(s?s.scrollTop:0)+(o?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;let n=!1;const i=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");return i.test(e.className)?e.className=e.className.replace(i," ").trim():(e.className+=" "+t,n=!0),e.className.trim()||e.removeAttribute("class"),n},isImportantDisabled:function(e){return e.hasAttribute("data-important-disabled")},setDisabledButtons:function(e,t,n){for(let i=0,l=t.length;ii))continue;s.appendChild(n[e])}e--,t--,i--}return l.childNodes.length>0&&e.parentNode.insertBefore(l,e),s.childNodes.length>0&&e.parentNode.insertBefore(s,e.nextElementSibling),e}const i=e.parentNode;let l,s,o,a=0,r=!0;if((!n||n<0)&&(n=0),3===e.nodeType){if(a=this.getPositionIndex(e),t>=0&&e.length!==t){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,o=l,l=c.cloneNode(!1),s=c.childNodes,o&&(this.isListCell(l)&&this.isList(o)&&o.firstElementChild?(l.innerHTML=o.firstElementChild.innerHTML,k.removeItem(o.firstElementChild),o.children.length>0&&l.appendChild(o)):l.appendChild(o));s[a];)l.appendChild(s[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let s=null;return l&&(s=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(o,a,r){const c=o.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(s.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,s=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,o),o.parentNode.insertBefore(d,o),i.removeItem(o)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const o=d.lastChild,c=u.firstChild;let g=0;if(o&&c){const e=3===o.nodeType&&3===c.nodeType;g=o.textContent.length;let i=o.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===o.nodeType&&3===c.nodeType&&(o.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&o&&3===o.nodeType&&c&&3===c.nodeType&&(s[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,s[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),s},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)[^>^<]+>\s+(?=<)/gi,(function(e){return e.replace(/\n/g,"").replace(/\s+/," ")})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e]*>","gi")},createTagsBlacklist:function(e){return new RegExp("<\\/?\\b(?:\\b"+(e||"^").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},_consistencyCheckOfHTML:function(e,t,n,i){const l=[],s=[],o=[],a=[],r=this.getListChildNodes(e,function(r){if(1!==r.nodeType)return this.isList(r.parentElement)&&l.push(r),!1;if(n.test(r.nodeName)||!t.test(r.nodeName)&&0===r.childNodes.length&&this.isNotCheckingNode(r))return l.push(r),!1;const c=!this.getParentElement(r,this.isNotCheckingNode);if(!this.isTable(r)&&!this.isListCell(r)&&!this.isAnchor(r)&&(this.isFormatElement(r)||this.isRangeFormatElement(r)||this.isTextStyleElement(r))&&0===r.childNodes.length&&c)return s.push(r),!1;if(this.isList(r.parentNode)&&!this.isList(r)&&!this.isListCell(r))return o.push(r),!1;if(this.isCell(r)){const e=r.firstElementChild;if(!this.isFormatElement(e)&&!this.isRangeFormatElement(e)&&!this.isComponent(e))return a.push(r),!1}if(i&&c&&r.className){const e=new this._w.Array(r.classList).map(this._classNameFilter).join(" ").trim();e?r.className=e:r.removeAttribute("class")}return r.parentNode!==e&&c&&(this.isListCell(r)&&!this.isList(r.parentNode)||i&&(this.isFormatElement(r)||this.isComponent(r))&&!this.isRangeFormatElement(r.parentNode)&&!this.getParentElement(r,this.isComponent))}.bind(this));for(let e=0,t=l.length;e=0;l--)t.insertBefore(e,n[l]);c.push(e)}else t.parentNode.insertBefore(e,t),c.push(t);for(let e,t=0,n=c.length;t":e.innerHTML,e.innerHTML=t.outerHTML},_classNameFilter:function(e){return/(^__se__|^se-|katex)/.test(e)?e:""},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",s="";const o=(t=n+t).split(";");for(let t,n=0,a=o.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className=t._editableClass,e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,s=t.length;l'}return i+("auto"===e.height?"":"")}};var L=k,B={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor"+(t.rtl?" se-rtl":""),e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const s=this._createToolBar(n,t.buttonList,t.plugins,t),o=s.element.cloneNode(!1);o.className+=" se-toolbar-shadow",s.element.style.visibility="hidden",s.pluginCallButtons.math&&this._checkKatexMath(t.katex);const a=n.createElement("DIV");a.className="se-arrow";const r=n.createElement("DIV");r.className="se-toolbar-sticky-dummy";const c=n.createElement("DIV");c.className="se-wrapper";const d=this._initElements(t,i,s.element,a),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;const m=u.resizingBar,f=u.navigation,_=u.charWrapper,b=u.charCounter,v=n.createElement("DIV");v.className="se-loading-box sun-editor-common",v.innerHTML='
    ';const y=n.createElement("DIV");y.className="se-line-breaker",y.innerHTML='";const C=n.createElement("DIV");C.className+="se-line-breaker-component";const w=C.cloneNode(!0);C.innerHTML=w.innerHTML=t.icons.line_break;const x=n.createElement("DIV");x.className="se-resizing-back";const E=t.toolbarContainer;E&&(E.appendChild(s.element),E.appendChild(o));const S=t.resizingBarContainer;return m&&S&&S.appendChild(m),c.appendChild(p),g&&c.appendChild(g),E||(l.appendChild(s.element),l.appendChild(o)),l.appendChild(r),l.appendChild(c),l.appendChild(x),l.appendChild(v),l.appendChild(y),l.appendChild(C),l.appendChild(w),m&&!S&&l.appendChild(m),i.appendChild(l),p=this._checkCodeMirror(t,p),{constructed:{_top:i,_relative:l,_toolBar:s.element,_toolbarShadow:o,_menuTray:s._menuTray,_editorArea:c,_wysiwygArea:h,_codeArea:p,_placeholder:g,_resizingBar:m,_navigation:f,_charWrapper:_,_charCounter:b,_loading:v,_lineBreaker:y,_lineBreaker_t:C,_lineBreaker_b:w,_resizeBack:x,_stickyDummy:r,_arrow:a},options:t,plugins:s.plugins,pluginCallButtons:s.pluginCallButtons,_responsiveButtons:s.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n){this._initOptions(t.element.originElement,e);const i=t.element,l=i.relative,s=i.editorArea,o=e.toolbarContainer&&e.toolbarContainer!==n.toolbarContainer,a=e.lang!==n.lang||e.buttonList!==n.buttonList||e.mode!==n.mode||o,r=this._createToolBar(document,a?e.buttonList:n.buttonList,e.plugins,e);r.pluginCallButtons.math&&this._checkKatexMath(e.katex);const c=document.createElement("DIV");c.className="se-arrow",a&&(r.element.style.visibility="hidden",o?(e.toolbarContainer.appendChild(r.element),i.toolbar.parentElement.removeChild(i.toolbar)):i.toolbar.parentElement.replaceChild(r.element,i.toolbar),i.toolbar=r.element,i._menuTray=r._menuTray,i._arrow=c);const d=this._initElements(e,i.topArea,a?r.element:i.toolbar,c),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;return i.resizingBar&&L.removeItem(i.resizingBar),u.resizingBar&&(e.resizingBarContainer&&e.resizingBarContainer!==n.resizingBarContainer?e.resizingBarContainer.appendChild(u.resizingBar):l.appendChild(u.resizingBar)),s.innerHTML="",s.appendChild(p),g&&s.appendChild(g),p=this._checkCodeMirror(e,p),i.resizingBar=u.resizingBar,i.navigation=u.navigation,i.charWrapper=u.charWrapper,i.charCounter=u.charCounter,i.wysiwygFrame=h,i.code=p,i.placeholder=g,e.rtl?L.addClass(i.topArea,"se-rtl"):L.removeClass(i.topArea,"se-rtl"),{callButtons:r.pluginCallButtons,plugins:r.plugins,toolbar:r}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");if(l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe)l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame,l.className+=e.className;else{l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto");for(let t in e.iframeAttributes)l.setAttribute(t,e.iframeAttributes[t]);l.className+=" "+e._editableClass,l.style.cssText=e._editorStyles.frame+e._editorStyles.editor,l.className+=e.className}const s=document.createElement("TEXTAREA");s.className="se-wrapper-inner se-wrapper-code"+e.className,s.style.cssText=e._editorStyles.frame,s.style.display="none","auto"===e.height&&(s.style.overflow="hidden");let o=null,a=null,r=null,c=null;if(e.resizingBar&&(o=document.createElement("DIV"),o.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",o.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}o.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:o,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:s,placeholder:d}},_initOptions:function(e,t){const n={};if(t.plugins){const e=t.plugins,i=e.length?e:Object.keys(e).map((function(t){return e[t]}));for(let e,t=0,l=i.length;t0?t.defaultTag:"p";const i=t.textTags=[{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",sub:"SUB",sup:"SUP"},t.textTags||{}].reduce((function(e,t){for(let n in t)e[n]=t[n];return e}),{});t._textTagsMap={strong:i.bold.toLowerCase(),b:i.bold.toLowerCase(),u:i.underline.toLowerCase(),ins:i.underline.toLowerCase(),em:i.italic.toLowerCase(),i:i.italic.toLowerCase(),del:i.strike.toLowerCase(),strike:i.strike.toLowerCase(),s:i.strike.toLowerCase(),sub:i.sub.toLowerCase(),sup:i.sup.toLowerCase()},t._defaultCommand={bold:t.textTags.bold,underline:t.textTags.underline,italic:t.textTags.italic,strike:t.textTags.strike,subscript:t.textTags.sub,superscript:t.textTags.sup};t.tagsBlacklist=t.tagsBlacklist||"",t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",t._editorTagsWhitelist="*"===t.addTagsWhitelist?"*":this._setWhitelist(t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.tagsBlacklist),t.pasteTagsBlacklist=t.tagsBlacklist+(t.tagsBlacklist&&t.pasteTagsBlacklist?"|"+t.pasteTagsBlacklist:t.pasteTagsBlacklist||""),t.pasteTagsWhitelist="*"===t.pasteTagsWhitelist?"*":this._setWhitelist("string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.pasteTagsBlacklist),t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.attributesBlacklist=t.attributesBlacklist&&"object"==typeof t.attributesBlacklist?t.attributesBlacklist:null,t.mode=t.mode||"classic",t.rtl=!!t.rtl,t.lineAttrReset="string"==typeof t.lineAttrReset&&t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):null,t._editableClass="sun-editor-editable"+(t.rtl?" se-rtl":""),t._printClass="string"==typeof t._printClass?t._printClass:null,t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer="string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.hideToolbar=!!t.hideToolbar,t.fullScreenOffset=void 0===t.fullScreenOffset?0:/^\d+/.test(t.fullScreenOffset)?L.getNumber(t.fullScreenOffset,0):0,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||!!t.iframe,t.iframeAttributes=t.iframeAttributes||{},t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.previewTemplate="string"==typeof t.previewTemplate?t.previewTemplate:null,t.printTemplate="string"==typeof t.printTemplate?t.printTemplate:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.mathFontSize=t.mathFontSize?t.mathFontSize:[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.resizeEnable=void 0===t.resizeEnable||!!t.resizeEnable,t.resizingBarContainer="string"==typeof t.resizingBarContainer?document.querySelector(t.resizingBarContainer):t.resizingBarContainer,t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.className="string"==typeof t.className&&t.className.length>0?" "+t.className:"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim().toLowerCase()||"px",t.alignItems="object"==typeof t.alignItems?t.alignItems:t.rtl?["right","center","left","justify"]:["left","center","right","justify"],t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageAlignShow=void 0===t.imageAlignShow||!!t.imageAlignShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.imageGalleryHeader=t.imageGalleryHeader||null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoAlignShow=void 0===t.videoAlignShow||!!t.videoAlignShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.linkTargetNewWindow=!!t.linkTargetNewWindow,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.linkRel=Array.isArray(t.linkRel)?t.linkRel:[],t.linkRelDefault=t.linkRelDefault||{},t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)?t.shortcutsDisable:[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.mediaAutoSelect=void 0===t.mediaAutoSelect||!!t.mediaAutoSelect,t.buttonList=t.buttonList?t.buttonList:[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.rtl&&(t.buttonList=t.buttonList.reverse()),t.icons=t.icons&&"object"==typeof t.icons?[S,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):S,t.icons=t.rtl?[t.icons,t.icons.rtl].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):t.icons,t.__listCommonStyle=t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"],t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_setWhitelist:function(e,t){if("string"!=typeof t)return e;t=t.split("|"),e=e.split("|");for(let n,i=0,l=t.length;i-1&&e.splice(n,1);return e.join("|")},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=L.isOSX_IOS?"⇧":"+SHIFT",s=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent","save"],o=e.rtl?["[","]"]:["]","["],a=e.rtl?[t.outdent,t.indent]:[t.indent,t.outdent];return{bold:["",n.toolbar.bold+''+(s.indexOf("bold")>-1?"":i+'+B')+"","bold","",t.bold],underline:["",n.toolbar.underline+''+(s.indexOf("underline")>-1?"":i+'+U')+"","underline","",t.underline],italic:["",n.toolbar.italic+''+(s.indexOf("italic")>-1?"":i+'+I')+"","italic","",t.italic],strike:["",n.toolbar.strike+''+(s.indexOf("strike")>-1?"":i+l+'+S')+"","strike","",t.strike],subscript:["",n.toolbar.subscript,"SUB","",t.subscript],superscript:["",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["",n.toolbar.indent+''+(s.indexOf("indent")>-1?"":i+'+'+o[0]+"")+"","indent","",a[0]],outdent:["",n.toolbar.outdent+''+(s.indexOf("indent")>-1?"":i+'+'+o[1]+"")+"","outdent","",a[1]],fullScreen:["se-code-view-enabled se-resizing-enabled",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled",n.toolbar.codeView,"codeView","",t.code_view],undo:["",n.toolbar.undo+''+(s.indexOf("undo")>-1?"":i+'+Z')+"","undo","",t.undo],redo:["",n.toolbar.redo+''+(s.indexOf("undo")>-1?"":i+'+Y / '+i+l+'+Z')+"","redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],dir:["",n.toolbar[e.rtl?"dir_ltr":"dir_rtl"],"dir","",t[e.rtl?"dir_ltr":"dir_rtl"]],dir_ltr:["",n.toolbar.dir_ltr,"dir_ltr","",t.dir_ltr],dir_rtl:["",n.toolbar.dir_rtl,"dir_rtl","",t.dir_rtl],save:["se-resizing-enabled",n.toolbar.save+''+(s.indexOf("save")>-1?"":i+'+S')+"","save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",e.rtl?t.align_right:t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,s,o){const a=L.createElement("LI"),r=L.createElement("BUTTON"),c=t||n;return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("aria-label",c.replace(//,"")),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=o[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+c+"",s&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const s=e.createElement("DIV");s.className="se-toolbar sun-editor-common";const o=e.createElement("DIV");o.className="se-btn-tray",s.appendChild(o),t=JSON.parse(JSON.stringify(t));const a=i.icons,r=this._defaultButtons(i),c={},d=[];let u=null,h=null,g=null,p=null,m="",f=!1;const _=L.createElement("DIV");_.className="se-toolbar-more-layer";e:for(let i,s,b,v,y,C=0;C",_.appendChild(s),s=s.firstElementChild.firstElementChild)}if(f){const e=l.cloneNode(!1);o.appendChild(e)}o.appendChild(g.div),f=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",o.appendChild(t),f=!1}switch(o.children.length){case 0:o.style.display="none";break;case 1:L.removeClass(o.firstElementChild,"se-btn-module-border");break;default:if(i.rtl){const e=l.cloneNode(!1);e.style.float=o.lastElementChild.style.float,o.appendChild(e)}}d.length>0&&d.unshift(t),_.children.length>0&&o.appendChild(_);const b=e.createElement("DIV");b.className="se-menu-tray",s.appendChild(b);const v=e.createElement("DIV");return v.className="se-toolbar-cover",s.appendChild(v),i.hideToolbar&&(s.style.display="none"),{element:s,plugins:n,pluginCallButtons:c,responsiveButtons:d,_menuTray:b,_buttonTray:o}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_toolbarShadow:t._toolbarShadow,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector('[data-command="bold"]'),underline:t._toolBar.querySelector('[data-command="underline"]'),italic:t._toolBar.querySelector('[data-command="italic"]'),strike:t._toolBar.querySelector('[data-command="strike"]'),sub:t._toolBar.querySelector('[data-command="SUB"]'),sup:t._toolBar.querySelector('[data-command="SUP"]'),undo:t._toolBar.querySelector('[data-command="undo"]'),redo:t._toolBar.querySelector('[data-command="redo"]'),save:t._toolBar.querySelector('[data-command="save"]'),outdent:t._toolBar.querySelector('[data-command="outdent"]'),indent:t._toolBar.querySelector('[data-command="indent"]'),fullScreen:t._toolBar.querySelector('[data-command="fullScreen"]'),showBlocks:t._toolBar.querySelector('[data-command="showBlocks"]'),codeView:t._toolBar.querySelector('[data-command="codeView"]'),dir:t._toolBar.querySelector('[data-command="dir"]'),dir_ltr:t._toolBar.querySelector('[data-command="dir_ltr"]'),dir_rtl:t._toolBar.querySelector('[data-command="dir_rtl"]')},options:n,option:n}},z={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},M={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=B.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,s){const o=e.element.originElement.ownerDocument||document,a=o.defaultView||window,r=L,c=l.icons,d={_d:o,_w:a,_parser:new a.DOMParser,_prevRtl:l.rtl,_editorHeight:0,_editorHeightPadding:0,_listCamel:l.__listCommonStyle,_listKebab:r.camelToKebabCase(l.__listCommonStyle),_wd:null,_ww:null,_shadowRoot:null,_shadowRootControllerEventTarget:null,util:r,functions:null,options:null,wwComputedStyle:null,notice:z,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:[],resizingDisabledButtons:[],_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_htmlCheckBlacklistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,editorTagsBlacklistRegExp:null,pasteTagsWhitelistRegExp:null,pasteTagsBlacklistRegExp:null,hasFocus:!1,isDisabled:!1,isReadOnly:!1,_attributesWhitelistRegExp:null,_attributesWhitelistRegExp_all_data:null,_attributesBlacklistRegExp:null,_attributesTagsWhitelist:null,_attributesTagsBlacklist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:{},_commandMapStyles:{STRONG:["font-weight"],U:["text-decoration"],EM:["font-style"],DEL:["text-decoration"]},_styleCommandMap:null,_cleanStyleRegExp:{span:new a.RegExp("\\s*[^-a-zA-Z](font-family|font-size|color|background-color)\\s*:[^;]+(?!;)*","ig"),format:new a.RegExp("\\s*[^-a-zA-Z](text-align|margin-left|margin-right)\\s*:[^;]+(?!;)*","ig"),fontSizeUnit:new a.RegExp("\\d+"+l.fontSizeUnit+"$","i")},_variable:{isChanged:!1,isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:2,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},_formatAttrsTemp:null,_saveButtonStates:function(){this.allCommandButtons||(this.allCommandButtons={});const e=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let t,n,i=0;ie?c-e:0,l=i>0?0:e-c;n.style.left=d-i+l+"px",o.left>u._getEditorOffsets(n).left&&(n.style.left="0px")}else{const e=s<=c?0:s-(d+c);n.style.left=e<0?d+e+"px":d+"px"}let h=0,g=t;for(;g&&g!==i;)h+=g.offsetTop,g=g.offsetParent;const p=h;this._isBalloon?h+=i.offsetTop+t.offsetHeight:h-=t.offsetHeight;const m=o.top,f=n.offsetHeight,_=this.getGlobalScrollOffset().top,b=a.innerHeight-(m-_+p+t.parentElement.offsetHeight);if(bb?(n.style.height=l+"px",e=-1*(l-p+3)):(n.style.height=b+"px",e=p+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=p+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0)for(let e=0;e0){for(let e=0;eu?d-u:0,i=n>0?0:u-d;t.style.left=c-n+i+"px",n>0&&h&&(h.style.left=(d-14<10+n?d-14:10+n)+"px");const l=e.element.wysiwygFrame.offsetLeft-t.offsetLeft;l>0&&(t.style.left="0px",h&&(h.style.left=l+"px"))}else{t.style.left=c+"px";const n=e.element.wysiwygFrame.offsetWidth-(t.offsetLeft+d);n<0?(t.style.left=t.offsetLeft+n+"px",h&&(h.style.left=20-n+"px")):h&&(h.style.left="20px")}t.style.visibility=""},execCommand:function(e,t,n){this._wd.execCommand(e,t,"formatBlock"===e?"<"+n+">":n),this.history.push(!0)},nativeFocus:function(){this.__focus(),this._editorRange()},__focus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const n=t.commonAncestorContainer.children[t.startOffset];if(!r.isFormatElement(n)&&!r.isComponent(n)){const t=r.createElement(l.defaultTag),i=r.createElement("BR");return t.appendChild(i),e.element.wysiwyg.insertBefore(t,n),void this.setRange(i,0,i,0)}}this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},blur:function(){l.iframe?e.element.wysiwygFrame.blur():e.element.wysiwyg.blur()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length),r.isFormatElement(e)&&(e=e.childNodes[t]||e.childNodes[t-1]||e,t=t>0?1===e.nodeType?1:e.textContent?e.textContent.length:0:0),r.isFormatElement(n)&&(n=n.childNodes[i]||n.childNodes[i-1]||n,i=i>0?1===n.nodeType?1:n.textContent?n.textContent.length:0:0);const s=this._wd.createRange();try{s.setStart(e,t),s.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const o=this.getSelection();return o.removeAllRanges&&o.removeAllRanges(),o.addRange(s),this._rangeInfo(s,this.getSelection()),l.iframe&&this.__focus(),s},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.hasFocus&&this.getSelection().removeAllRanges(),this._setKeyEffect([])},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,s=r.compareElements(e,t),o=s.ancestor&&(0===s.result?i<=l:s.result>1);return this.setRange(o?e:t,o?i:l,o?t:e,o?l:i)}},getRange_addLine:function(t,n){if(this._selectionVoid(t)){const i=e.element.wysiwyg,s=r.createElement(l.defaultTag);s.innerHTML="
    ",i.insertBefore(s,n&&n!==i?n.nextElementSibling:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){const t=this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection();return this._variable._range||e.element.wysiwyg.contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t},getSelectionNode:function(){if(e.element.wysiwyg.contains(this._variable._selectionNode)||this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),r.isFormatElement(t.endContainer)&&0===t.endOffset&&(t=this.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.length)),this._rangeInfo(t,e)},_rangeInfo:function(e,t){let n=null;this._variable._range=e,n=e.collapsed?r.isWysiwygDiv(e.commonAncestorContainer)&&e.commonAncestorContainer.children[e.startOffset]||e.commonAncestorContainer:t.extentNode||t.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg,n=this._wd.createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=r.createElement("BR"),i.appendChild(s))):(i=r.createElement(l.defaultTag),s=r.createElement("BR"),i.appendChild(s),t.appendChild(i)),n.setStart(s,0),n.setEnd(s,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,s,o=t.startContainer,a=t.startOffset,c=t.endContainer,d=t.endOffset;if(r.isFormatElement(o))for(o.childNodes[a]?(o=o.childNodes[a]||o,a=0):(o=o.lastChild||o,a=o.textContent.length);o&&1===o.nodeType&&o.firstChild;)o=o.firstChild||o,a=0;if(r.isFormatElement(c)){for(c=c.childNodes[d]||c.lastChild||c;c&&1===c.nodeType&&c.lastChild;)c=c.lastChild;d=c.textContent.length}if(n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=a,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===c&&(c=n,d=1)}}if(o=n,a=i,n=r.isWysiwygDiv(c)?e.element.wysiwyg.lastChild:c,i=d,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(s=n.childNodes,0!==s.length);)n=s[i>0?i-1:i]||!/FIGURE/i.test(s[0].nodeName)?s[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(c)}}return c=n,d=i,this.setRange(o,a,c,d),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,s=n.commonAncestorContainer,o=r.getListChildren(s,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(s)||r.isRangeFormatElement(s)||o.unshift(r.getFormatElement(s,null)),i===l||1===o.length)return o;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=o.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t,n){return"end"!==n&&0===t||(!n||"front"!==n)&&!e.nodeValue&&1===t||(!n||"end"===n)&&!!e.nodeValue&&t===e.nodeValue.length},_isEdgeFormat:function(e,t,n){if(!this.isEdgePoint(e,t,n))return!1;const i=[];for(n="front"===n?"previousSibling":"nextSibling";e&&!r.isFormatElement(e)&&!r.isWysiwygDiv(e);){if(e[n]&&(!r.isBreak(e[n])||e[n][n]))return null;1===e.nodeType&&i.push(e.cloneNode(!1)),e=e.parentNode}return i},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){if(!e||!e.parentNode)return null;const n=r.getFormatElement(this.getSelectionNode(),null);let i=null;if(!r.isFormatElement(e)&&r.isFreeFormatElement(n||e.parentNode))i=r.createElement("BR");else{const e=t?"string"==typeof t?t:t.nodeName:!r.isFormatElement(n)||r.isRangeFormatElement(n)||r.isFreeFormatElement(n)?l.defaultTag:n.nodeName;i=r.createElement(e),i.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(i,t||n,["id"])}return r.isCell(e)?e.insertBefore(i,e.nextElementSibling):e.parentNode.insertBefore(i,e.nextElementSibling),i},insertComponent:function(e,t,n,i){if(this.isReadOnly||n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange(),l.container);let s=null,o=this.getSelectionNode(),a=r.getFormatElement(o,null);if(r.isListCell(a))this.insertNode(e,o===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));s=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),s&&(a=s.previousSibling)}this.insertNode(e,r.isRangeFormatElement(a)?null:a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){this.setRange(e,0,e,0);const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):s&&(s=r.getEdgeChildNodes(s,null).sc||s,this.setRange(s,0,s,0))}return t||this.history.push(1),s||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){if(r.isUneditableComponent(r.getParentElement(e,r.isComponent))||r.isUneditableComponent(e))return!1;this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,s="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,o=r.isListCell(n.parentNode);let a,c,d;(o?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(s).left+d+"px",i.display="block"),(o?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2),l.top=a+s.offsetHeight-c-12+"px",l.left=r.getOffset(s).left+s.offsetWidth-d-24+"px",l.display="block")},_checkDuplicateNode:function(e,t){!function e(n){d._dupleCheck(n,t);const i=n.childNodes;for(let t=0,n=i.length;t-1&&n.splice(e,1);for(let t=0,n=s.classList.length;t_?m.splitText(_):m.nextSibling;else if(r.isBreak(s))n=s,s=s.parentNode;else{let e=s.childNodes[f];const i=e&&3===e.nodeType&&r.onlyZeroWidthSpace(e)&&r.isBreak(e.nextSibling)?e.nextSibling:e;i?!i.nextSibling&&r.isBreak(i)?(s.removeChild(i),n=null):n=r.isBreak(i)&&!r.isBreak(t)?i:i.nextSibling:n=null}else{if(v===y){n=this.isEdgePoint(y,_)?y.nextSibling:y.splitText(_);let e=v;this.isEdgePoint(v,f)||(e=v.splitText(f)),s.removeChild(e),0===s.childNodes.length&&p&&(s.innerHTML="
    ")}else{const e=this.removeNode(),i=e.container,o=e.prevContainer;if(i&&0===i.childNodes.length&&p&&(r.isFormatElement(i)?i.innerHTML="
    ":r.isRangeFormatElement(i)&&(i.innerHTML="<"+l.defaultTag+">
    ")),r.isListCell(i)&&3===t.nodeType)s=i,n=null;else if(!p&&o)if(s=3===o.nodeType?o.parentNode:o,s.contains(i)){let e=!0;for(n=i;n.parentNode&&n.parentNode!==s;)n=n.parentNode,e=!1;e&&i===o&&(n=n.nextSibling)}else n=null;else r.isWysiwygDiv(i)&&!r.isFormatElement(t)?(s=i.appendChild(r.createElement(l.defaultTag)),n=null):s=(n=p?y:i===o?i.nextSibling:i)&&n.parentNode?n.parentNode:m;for(;n&&!r.isFormatElement(n)&&n.parentNode!==m;)n=n.parentNode}}try{if(!u){if((r.isWysiwygDiv(n)||s===e.element.wysiwyg.parentNode)&&(s=e.element.wysiwyg,n=null),r.isFormatElement(t)||r.isRangeFormatElement(t)||!r.isListCell(s)&&r.isComponent(t)){const e=s;if(r.isList(n))s=n,n=null;else if(r.isListCell(n))s=n.previousElementSibling||n;else if(!o&&!n){const e=this.removeNode(),t=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(t)||r.isRangeFormatElement(t);s=i?t:t.parentNode,n=i?null:t.nextSibling}0===e.childNodes.length&&s!==e&&r.removeItem(e)}if(!p||g||r.isRangeFormatElement(s)||r.isListCell(s)||r.isWysiwygDiv(s)||(n=s.nextElementSibling,s=s.parentNode),r.isWysiwygDiv(s)&&(3===t.nodeType||r.isBreak(t))){const e=r.createElement(l.defaultTag);e.appendChild(t),t=e}}if(u?h.parentNode?(s=h,n=a):(s=e.element.wysiwyg,n=null):n=s===n?s.lastChild:n,r.isListCell(t)&&!r.isList(s)){if(r.isListCell(s))n=s.nextElementSibling,s=s.parentNode;else{const e=r.createElement("ol");s.insertBefore(e,n),s=e,n=null}u=!0}if(this._checkDuplicateNode(t,s),s.insertBefore(t,n),u)if(r.onlyZeroWidthSpace(d.textContent.trim()))r.removeItem(d),t=t.lastChild;else{const e=r.getArrayItem(d.children,r.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(s.appendChild(t),t=s),r.onlyZeroWidthSpace(d.textContent.trim())&&r.removeItem(d))}}catch(e){s.appendChild(t),console.warn("[SUNEDITOR.insertNode.warn] "+e)}finally{const e=s.querySelectorAll("[data-se-duple]");if(e.length>0)for(let n,i,l,s,o=0,a=e.length;o0&&(t.textContent=i+t.textContent,r.removeItem(e)),n&&n.length>0&&(t.textContent+=l,r.removeItem(n));const s={container:t,startOffset:i.length,endOffset:t.textContent.length-l.length};return this.setRange(t,s.startOffset,t,s.endOffset),s}if(!r.isBreak(t)&&!r.isListCell(t)&&r.isFormatElement(s)){let n=null;t.previousSibling&&!r.isBreak(t.previousSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t)),t.nextSibling&&!r.isBreak(t.nextSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t.nextSibling)),r._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0)}this.setRange(t,e,t,e)}return this.history.push(!0),t}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode();const t=this.getRange();let n,i=0,l=t.startContainer,s=t.endContainer,o=t.startOffset,a=t.endOffset;const c=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===l.parentNode?l.parentNode:t.commonAncestorContainer;if(c===l&&c===s&&(l=c.children[o],s=c.children[a],o=a=0),!l||!s)return{container:c,offset:0};if(l===s&&t.collapsed&&l.textContent&&r.onlyZeroWidthSpace(l.textContent.substr(o)))return{container:l,offset:o,prevContainer:l&&l.parentNode?l:null};let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,s);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===o&&(g=e,t=t.parentNode);for(let e=p-1,t=s;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};if(3===c.nodeType)return{container:c,offset:a};h.push(c),l=s=c}else if(l=s=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:r.isMedia(c)?c:l,offset:0};g=p=0}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)this._nodeRemoveListItem(t);else if(t!==l)if(t!==s)this._nodeRemoveListItem(t);else{if(1===s.nodeType){if(r.isComponent(s))continue;u=r.createTextNode(s.textContent)}else u=r.createTextNode(s.substringData(a,s.length-a));u.length>0?s.data=u.data:this._nodeRemoveListItem(s)}else{if(1===l.nodeType){if(r.isComponent(l))continue;d=r.createTextNode(l.textContent)}else t===s?(d=r.createTextNode(l.substringData(0,o)+s.substringData(a,s.length-a)),i=o):d=r.createTextNode(l.substringData(0,o));if(d.length>0?l.data=d.data:this._nodeRemoveListItem(l),t===s)break}}const m=r.getParentElement(s,"ul"),f=r.getParentElement(l,"li");if(m&&f&&f.contains(m)?(n=m.previousSibling,i=n.textContent.length):n=s&&s.parentNode?s:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)&&0===n.childNodes.length){const t=r.removeItemAllParents(n,null,null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},_nodeRemoveListItem:function(e){const t=r.getFormatElement(e,null);r.removeItem(e),r.isListCell(t)&&(r.removeItemAllParents(t,null,null),t&&r.isList(t.firstChild)&&t.insertBefore(r.createTextNode(r.zeroWidthSpace),t.firstChild))},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange(),null);const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,s,o,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,s=t.indexOf(i),o=t.indexOf(l),t.splice(s,o-s+1),c=t.length}else;let n,i,l,s=t[t.length-1];n=r.isRangeFormatElement(s)||r.isFormatElement(s)?s:r.getRangeFormatElement(s,null)||r.getFormatElement(s,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let o=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,s,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],s=n.parentNode,s&&!e.contains(s))if(u=r.getElementDepth(n),r.isList(s)){if(null===a&&(p?(a=p,m=!0,p=null):a=s.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==s){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=s.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(s,c,null,!0,!0);o>=u?(o=u,l=_.cc,i=d(l,s,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(o=u,l=s,i=n.nextSibling),e.appendChild(n),l!==s&&(h=d(l,s),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,s){const o=this.getRange();let a=o.startOffset,c=o.endOffset,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),u=e.parentNode,h=null,g=null,p=e.cloneNode(!1);const m=[],f=r.isList(n);let _=!1,b=!1,v=!1;function y(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace,a=c=1),3===n.nodeType)return t.insertBefore(n,i),n;const s=(v?n:l).childNodes;let o=n.cloneNode(!1),d=null,u=null;for(;s[0];)u=s[0],!r._notTextNode(u)||r.isBreak(u)||r.isListCell(o)?o.appendChild(u):(o.childNodes.length>0&&(d||(d=o),t.insertBefore(o,i),o=n.cloneNode(!1)),t.insertBefore(u,i),d||(d=u));if(o.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(o)&&r.isList(i))if(f){for(d=i;i;)o.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(o,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=o.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,b=!0}}else t.insertBefore(o,i);d||(d=o)}return d}for(let s,o,a,c=0,C=d.length;c0&&(u.insertBefore(p,e),p=null),!f&&r.isListCell(s))if(a&&r.getElementDepth(s)!==r.getElementDepth(a)&&(r.isListCell(u)||r.getArrayItem(s.children,r.isList,!1))){const t=s.nextElementSibling,n=r.detachNestedList(s,!1);e===n&&t===s.nextElementSibling||(e=n,b=!0)}else{const t=s;s=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":l.defaultTag);const n=r.isListCell(s),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)s.appendChild(o[0]);r.copyFormatAttributes(s,t),v=!0}else s=s.cloneNode(!1);if(!b&&(i?(m.push(s),r.removeItem(d[c])):(n?(_||(u.insertBefore(n,e),_=!0),s=y(n,s,null,d[c])):s=y(u,s,e,d[c]),b||(t?(g=s,h||(h=s)):h||(h=g=s))),b)){b=v=!1,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),p=e.cloneNode(!1),u=e.parentNode,c=-1,C=d.length;continue}}const C=e.parentNode;let w=e.nextSibling;p&&p.children.length>0&&C.insertBefore(p,w),n?h=n.previousSibling:h||(h=e.previousSibling),w=e.nextSibling!==p?e.nextSibling:p?p.nextSibling:null,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null,!1);let x=null;if(i)x={cc:C,sc:h,so:a,ec:w,eo:c,removeArray:m};else{h||(h=g),g||(g=h);const e=r.getEdgeChildNodes(h,g.parentNode?h:g);x={cc:(e.sc||e.ec).parentNode,sc:e.sc,so:a,ec:e.ec,eo:c,removeArray:null}}if(this.effectNode=null,s)return x;!i&&x&&(t?this.setRange(x.sc,a,x.ec,c):this.setRange(x.sc,0,x.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,s=null,o=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const s=!e,o=s&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(o&&l.collapsed&&r.isFormatElement(c.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c)){const e=c.parentNode;if(!r.isListCell(e)||!r.getValues(e.style).some(function(e){return this._listKebab.indexOf(e)>-1}.bind(this)))return}if(l.collapsed&&!o&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),s&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!o&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!s||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=o||s&&function(e){for(let t=0,n=e.length;t0&&this._resetCommonListCell(E[N],t)&&(n=!0),this._resetCommonListCell(E[0],t)&&(n=!0),n&&this.setRange(c,d,u,h),N>0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,o,s,w,L,B));for(let n,i=N-1;i>0;i--)this._resetCommonListCell(E[i],t),m=e.cloneNode(!1),n=this._nodeChange_middleLine(E[i],m,x,o,s,w,_.container),n.endContainer&&n.ancestor.contains(n.endContainer)&&(_.ancestor=null,_.container=n.endContainer),this._setCommonListStyle(n.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,o,s,w,L,B,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_resetCommonListCell:function(e,t){if(!r.isListCell(e))return;t||(t=this._listKebab);const n=r.getArrayItem(e.childNodes,(function(e){return!r.isBreak(e)}),!0),i=e.style,s=[],o=[],a=r.getValues(i);for(let e=0,n=this._listKebab.length;e-1&&t.indexOf(this._listKebab[e])>-1&&(s.push(this._listCamel[e]),o.push(this._listKebab[e]));if(!s.length)return;const c=r.createElement("SPAN");for(let e=0,t=s.length;e0&&(e.insertBefore(d,u),d=c.cloneNode(!1),u=null,h=!0));return d.childNodes.length>0&&(e.insertBefore(d,u),h=!0),i.length||e.removeAttribute("style"),h},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)}),!0);if(!(t=n[0])||n.length>1||1!==t.nodeType)return;const i=t.style,s=e.style,o=t.nodeName.toLowerCase();let a=!1;l._textTagsMap[o]===l._defaultCommand.bold.toLowerCase()&&(s.fontWeight="bold"),l._textTagsMap[o]===l._defaultCommand.italic.toLowerCase()&&(s.fontStyle="italic");const c=r.getValues(i);if(c.length>0)for(let e=0,t=this._listCamel.length;e-1&&(s[this._listCamel[e]]=i[this._listCamel[e]],i.removeProperty(this._listKebab[e]),a=!0);if(this._setCommonListStyle(e,t),a&&!i.length){const e=t.childNodes,n=t.parentNode,i=t.nextSibling;for(;e.length>0;)n.insertBefore(e[0],i);r.removeItem(t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,s,o,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===s.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(s.textContent.slice(o))){const n=m.childNodes;let a=!0;for(let e,t,l,o,c=0,d=n.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o=N?k-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(s)||l.appendChild(s);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||o;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=o,N=0,L=!0,C!==o&&C.appendChild(S),!v)continue}if(B||a!==T){if(L){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const s=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=B?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||s.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(s);const o=y.pop()||a;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!p(t.parentNode)||p(o)||r.onlyZeroWidthSpace(t)||(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),B||E||!p(o))o===a?l=B?b:t:B?(b.appendChild(o),l=C):(t.appendChild(o),l=C);else{t=t.cloneNode(!1);const e=o.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(k,T.length-k)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,k));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const s=y.pop()||l;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(s),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(s),T=l,k=l.data.length,B=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:s,endOffset:o};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t,!1),u&&(N=S.textContent.length,k=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),k=M?T.textContent.length:k;const I={s:0,e:0},H=r.getNodePath(S,b,I),R=!T.parentNode;R&&(T=S);const O={s:0,e:0},D=r.getNodePath(T,b,R||M?null:O);N+=I.s,k=u?N:R?S.textContent.length:M?k+I.s:k+O.s;const F=r.mergeSameTags(b,[H,D],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(H,b),T=r.getNodeFromPath(D,b),{ancestor:b,startContainer:S,startOffset:N+F[0],endContainer:T,endOffset:k+F[1]}},_nodeChange_startLine:function(e,t,n,i,l,s,o,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!o&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,s=i.previousSibling;for(;s;){if(!r.onlyZeroWidthSpace(s)){n=!1;break}s=s.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const s=i.childNodes;for(let i,o,a=0,h=s.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=o,C=0,w=!0,l.appendChild(y)}}}(e,m),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(s=s&&o)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}s.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const s=i.childNodes;for(let i,u,h=0,g=s.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,o&&g.contains(o)){const e=r.getNodePath(o,g);o=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!s.v)return{ancestor:e,endContainer:o};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else o?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),s=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const o=m.pop()||l;for(_=f=o;m.length>0;)f=m.pop(),_.appendChild(f),_=f;o!==l?(t.insertBefore(o,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=s,y=s.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l};if(s=s&&o)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,this._commandMapStyles[n]||null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],s="indent"!==e,o=l.rtl?"marginRight":"marginLeft";let a=t.startContainer,c=t.endContainer,d=t.startOffset,u=t.endOffset;for(let e,t,l=0,a=n.length;l0&&this.plugins.list.editInsideList.call(this,s,i),this.effectNode=null,this.setRange(a,d,c,u),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(r.isNonEditable(e.element.wysiwygFrame)||this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),r.isNonEditable(e.element.wysiwygFrame)||(this.history.push(!1),this.history._resetCachingButton())):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable.isFullScreen?e.element.code.style.height="100%":"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),this.isReadOnly&&r.setDisabledButtons(!0,this.resizingDisabledButtons),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"<"+l.defaultTag+">
    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg,!1);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,s=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff();const m="none"===i.style.display||this._isInline&&!this._inlineToolbarAttr.isShow;p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",s.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,o.body.style.overflow=p._bodyOverflow,"auto"!==l.height||l.codeMirrorEditor||u._codeViewAutoHeight(),l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),t&&r.changeElement(t.firstElementChild,c.expansion),e.element.topArea.style.marginTop="",r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,s),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=o.body.style.overflow,o.body.style.overflow="hidden",p._editorAreaOriginCssText=s.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,s.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+l._editorStyles.editor,g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,s.style.height=p.innerHeight_fullScreen-l.fullScreenOffset+"px",t&&r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(s.style.overflow="auto",this._iframeAutoHeight()),e.element.topArea.style.marginTop=l.fullScreenOffset+"px",r.addClass(this._styleCommandMap.fullScreen,"active")),m&&h.toolbar.hide(),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",o.body.appendChild(e);const t=l.printTemplate?l.printTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),n=r.getIframeDocument(e),i=this._wd;if(l.iframe){const e=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="'+l._editableClass+'"';n.write(""+i.head.innerHTML+""+t+"")}else{const e=o.head.getElementsByTagName("link"),i=o.head.getElementsByTagName("style");let s="";for(let t=0,n=e.length;t"+s+''+t+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||r.isChromium||o.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const e=l.previewTemplate?l.previewTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),t=a.open("","_blank");t.mimeType="text/html";const n=this._wd;if(l.iframe){const i=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(n.body,["contenteditable"]):'class="'+l._editableClass+'"';t.document.write(""+n.head.innerHTML+""+e+"")}else{const n=o.head.getElementsByTagName("link"),s=o.head.getElementsByTagName("style");let a="";for(let e=0,t=n.length;e'+i.toolbar.preview+""+a+''+e+"")}},setDir:function(t){const n="rtl"===t,s=this._prevRtl!==n;this._prevRtl=l.rtl=n,s&&(this.plugins.align&&this.plugins.align.exchangeDir.call(this),e.tool.indent&&r.changeElement(e.tool.indent.firstElementChild,c.indent),e.tool.outdent&&r.changeElement(e.tool.outdent.firstElementChild,c.outdent));const o=e.element;n?(r.addClass(o.topArea,"se-rtl"),r.addClass(o.wysiwygFrame,"se-rtl")):(r.removeClass(o.topArea,"se-rtl"),r.removeClass(o.wysiwygFrame,"se-rtl"));const a=r.getListChildren(o.wysiwyg,(function(e){return r.isFormatElement(e)&&(e.style.marginRight||e.style.marginLeft||e.style.textAlign)}));for(let e,t,n,i=0,l=a.length;i[\s\S]*<\/script>/gi,"")),e.body&&(this._wd.body.innerHTML=this.convertContentsForEditor(e.body)),this._resetComponents()},getContents:function(t){const n=this.cleanHTML(e.element.wysiwyg.innerHTML,null,null),i=r.createElement("DIV");i.innerHTML=n;const s=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=s.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},getFullContents:function(e){return'
    '+this.getContents(e)+"
    "},_makeLine:function(e,t){const n=l.defaultTag;if(1===e.nodeType){if(r._disallowedTags(e))return"";if(/__se__tag/.test(e.className))return e.outerHTML;const i=r.getListChildNodes(e,(function(e){return r.isSpanWithoutAttr(e)&&!r.getParentElement(e,r.isNotCheckingNode)}))||[];for(let e=i.length-1;e>=0;e--)i[e].outerHTML=i[e].innerHTML;return!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML:"<"+n+">"+(r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML)+""}if(3===e.nodeType){if(!t)return r._HTMLConvertor(e.textContent);const i=e.textContent.split(/\n/g);let l="";for(let e,t=0,s=i.length;t0&&(l+="<"+n+">"+r._HTMLConvertor(e)+"");return l}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t=l._textTagsMap;return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i,l){return n+("string"==typeof t[i]?t[i]:i)+(l?" "+l:"")}))},_deleteDisallowedTags:function(e){return e=e.replace(/<(script|style)[\s\S]*>[\s\S]*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,""),/\bfont\b/i.test(this.options._editorTagsWhitelist)||(e=e.replace(/(<\/?)font(\s?)/gi,"$1span$2")),e.replace(this.editorTagsWhitelistRegExp,"").replace(this.editorTagsBlacklistRegExp,"")},_convertFontSize:function(e,t){const n=this._w.Math,i=t.match(/(\d+(?:\.\d+)?)(.+)/),l=1*i[1],s=i[2];let o=l;switch(/em/.test(s)?o=n.round(l/.0625):"pt"===s?o=n.round(1.333*l):"%"===s&&(o=l/100),e){case"em":case"rem":case"%":return(.0625*o).toFixed(2)+e;case"pt":return n.floor(o/1.333)+e;default:return o+e}},_cleanStyle:function(e,t,n){let i=(e.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(/span/i.test(n)&&!i&&(e.match(/0&&t.push('style="'+n.join(";")+'"')}}return t},_cleanTags:function(e,t,n){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(t))return t;let i=null;const l=n.match(/(?!<)[a-zA-Z0-9\-]+/)[0].toLowerCase(),s=this._attributesTagsBlacklist[l];t=t.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),t=s?t.replace(s,""):t.replace(this._attributesBlacklistRegExp,"");const o=this._attributesTagsWhitelist[l];if(i=o?t.match(o):t.match(e?this._attributesWhitelistRegExp:this._attributesWhitelistRegExp_all_data),e)if("a"===l){const e=t.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);e&&(i||(i=[]),i.push(e[0]))}else i&&/style=/i.test(i.toString())||("span"===l?i=this._cleanStyle(t,i,"span"):/^(P|DIV|H[1-6]|PRE)$/i.test(l)&&(i=this._cleanStyle(t,i,"format")));else{const e=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);e&&!i?i=[e[0]]:e&&!i.some((function(e){return/^style/.test(e.trim())}))&&i.push(e[0])}if("img"===l){let e="",n="";const l=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);if(i||(i=[]),l&&(e=l[0].match(/width:(.+);/),e=r.getNumber(e?e[1]:"",-1)||"",n=l[0].match(/height:(.+);/),n=r.getNumber(n?n[1]:"",-1)||""),!e||!n){const i=t.match(/width\s*=\s*((?:"|')[^"']*(?:"|'))/),l=t.match(/height\s*=\s*((?:"|')[^"']*(?:"|'))/);(i||l)&&(e=e||(r.getNumber(i?i[1]:"")||""),n=n||(r.getNumber(l?l[1]:"")||""))}i.push('data-origin="'+e+","+n+'"')}if(i)for(let e=0,t=i.length;e"+(n.innerHTML.trim()||"
    ")+"":r.isRangeFormatElement(n)&&!r.isTable(n)?t+=this._convertListCell(n):t+="
  • "+n.outerHTML+"
  • ":t+="
  • "+(n.textContent||"
    ")+"
  • ";return t},_isFormatData:function(e){let t=!1;for(let n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!0));const i=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(i,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!0)}catch(e){console.warn("[SUNEDITOR.cleanHTML.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=i.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!1));const t=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(t,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!1)}catch(e){console.warn("[SUNEDITOR.convertContentsForEditor.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=t.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i
    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e,t){let n="";const i=a.RegExp,l=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),s="string"==typeof e?o.createRange().createContextualFragment(e):e,c=function(e){return this.isFormatElement(e)||this.isComponent(e)}.bind(r),d=t?"":"\n";let u=t?0:1*this._variable.codeIndent;return u=u>0?new a.Array(u+1).join(" "):"",function e(t,s){const o=t.childNodes,h=l.test(t.nodeName),g=h?s:"";for(let p,m,f,_,b,v,y=0,C=o.length;y]*>","i"))[0]+m,e(p,s+u),n+=(/\n$/.test(n)?v:"")+""+(f||m||h||/^(TH|TD)$/i.test(p.nodeName)?d:"")):n+=(new a.XMLSerializer).serializeToString(p):n+=(/^HR$/i.test(p.nodeName)?d:"")+(/^PRE$/i.test(p.parentElement.nodeName)&&/^BR$/i.test(p.nodeName)?"":g)+p.outerHTML+m:r.isList(p.parentElement)||(n+=r._HTMLConvertor(/^\n+$/.test(p.data)?"":p.data)):n+="\n\x3c!-- "+p.textContent.trim()+" --\x3e"+m}(s,""),n.trim()+d},addDocEvent:function(e,t,n){o.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){o.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,s=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,s<0?0:s)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML&&1===e.nodeType?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},resetResponsiveToolbar:function(){d.controllersOff();const t=u._responsiveButtonSize;if(t){let n=0;n=(d._isBalloon||d._isInline)&&"auto"===l.toolbarWidth?e.element.topArea.offsetWidth:e.element.toolbar.offsetWidth;let i="default";for(let e=1,l=t.length;e-1||!r.hasOwn(t,l)||(i.indexOf(l)>-1?n[l].active.call(this,null):t.OUTDENT&&/^OUTDENT$/i.test(l)?r.isImportantDisabled(t.OUTDENT)||t.OUTDENT.setAttribute("disabled",!0):t.INDENT&&/^INDENT$/i.test(l)?r.isImportantDisabled(t.INDENT)||t.INDENT.removeAttribute("disabled"):r.removeClass(t[l],"active"))},_init:function(i,s){const c=a.RegExp;if(this._ww=l.iframe?e.element.wysiwygFrame.contentWindow:a,this._wd=o,this._charTypeHTML="byte-html"===l.charCounterType,this.wwComputedStyle=a.getComputedStyle(e.element.wysiwyg),this._editorHeight=e.element.wysiwygFrame.offsetHeight,this._editorHeightPadding=r.getNumber(this.wwComputedStyle.getPropertyValue("padding-top"))+r.getNumber(this.wwComputedStyle.getPropertyValue("padding-bottom")),!l.iframe&&"function"==typeof a.ShadowRoot){let t=e.element.wysiwygFrame;for(;t;){if(t.shadowRoot){this._shadowRoot=t.shadowRoot;break}if(t instanceof a.ShadowRoot){this._shadowRoot=t;break}t=t.parentNode}this._shadowRoot&&(this._shadowRootControllerEventTarget=[])}const d=a.Object.keys(l._textTagsMap),u=l.addTagsWhitelist?l.addTagsWhitelist.split("|").filter((function(e){return/b|i|ins|s|strike/i.test(e)})):[];for(let e=0;e^<]+)?\\s*(?=>)","gi");const h=function(e,t){return e?"*"===e?"[a-z-]+":t?e+"|"+t:e:"^"},g="contenteditable|colspan|rowspan|target|href|download|rel|src|alt|class|type|controls|origin-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1||"*"===l._editorTagsWhitelist,this._htmlCheckWhitelistRegExp=new c("^("+h(l._editorTagsWhitelist.replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new c("^("+(l.tagsBlacklist||"^")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(h(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e"),"")),this.editorTagsBlacklistRegExp=r.createTagsBlacklist(l.tagsBlacklist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(h(l.pasteTagsWhitelist,"")),this.pasteTagsBlacklistRegExp=r.createTagsBlacklist(l.pasteTagsBlacklist);const p='\\s*=\\s*(")[^"]*\\1',m=l.attributesWhitelist;let f={},_="";if(m)for(let e in m)r.hasOwn(m,e)&&!/^on[a-z]+$/i.test(m[e])&&("all"===e?_=h(m[e],g):f[e]=new c("\\s(?:"+h(m[e],"")+")"+p,"ig"));this._attributesWhitelistRegExp=new c("\\s(?:"+(_||g+"|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|data-exp|data-font-size")+")"+p,"ig"),this._attributesWhitelistRegExp_all_data=new c("\\s(?:"+(_||g)+"|data-[a-z0-9\\-]+)"+p,"ig"),this._attributesTagsWhitelist=f;const b=l.attributesBlacklist;if(f={},_="",b)for(let e in b)r.hasOwn(b,e)&&("all"===e?_=h(b[e],""):f[e]=new c("\\s(?:"+h(b[e],"")+")"+p,"ig"));this._attributesBlacklistRegExp=new c("\\s(?:"+(_||"^")+")"+p,"ig"),this._attributesTagsBlacklist=f,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const v=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let y,C,w=[];for(let e in n)if(r.hasOwn(n,e)){if(y=n[e],C=t[e],(y.active||y.action)&&C&&this.callPlugin(e,null,C),"function"==typeof y.checkFileInfo&&"function"==typeof y.resetFileInfo&&(this.callPlugin(e,null,C),this._fileInfoPluginsCheck.push(y.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(y.resetFileInfo.bind(this))),a.Array.isArray(y.fileTags)){const t=y.fileTags;this.callPlugin(e,null,C),this._fileManager.tags=this._fileManager.tags.concat(t),w.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&o&&o.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},getCurrentIndex:function(){return c},reset:function(n){o&&o.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){s=e.context.element,o=e.context.tool.undo,a=e.context.tool.redo,0===c?(o&&o.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([z]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,s)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-code-view-enabled"]):not([data-display="MORE"])'),this.resizingDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-resizing-enabled"]):not([data-display="MORE"])');const t=e.tool,n=this.commandMap;n.INDENT=t.indent,n.OUTDENT=t.outdent,n[l.textTags.bold.toUpperCase()]=t.bold,n[l.textTags.underline.toUpperCase()]=t.underline,n[l.textTags.italic.toUpperCase()]=t.italic,n[l.textTags.strike.toUpperCase()]=t.strike,n[l.textTags.sub.toUpperCase()]=t.subscript,n[l.textTags.sup.toUpperCase()]=t.superscript,this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView},this._saveButtonStates()},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){this.hasFocus&&u._applyTagEffects(),this._variable.isChanged=!0,e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this),"block"===e.element.toolbar.style.display&&u._showToolbarBalloon()},_iframeAutoHeight:function(){this._iframeAuto?a.setTimeout((function(){const t=d._iframeAuto.offsetHeight;e.element.wysiwygFrame.style.height=t+"px",r.isResizeObserverSupported||d.__callResizeFunction(t,null)})):r.isResizeObserverSupported||d.__callResizeFunction(e.element.wysiwygFrame.offsetHeight,null)},__callResizeFunction:function(e,t){e=-1===e?t.borderBoxSize&&t.borderBoxSize[0]?t.borderBoxSize[0].blockSize:t.contentRect.height+this._editorHeightPadding:e,this._editorHeight!==e&&("function"==typeof h.onResizeEditor&&h.onResizeEditor(e,this._editorHeight,d,t),this._editorHeight=e)},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(r._allowedEmptyNodeList)||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,s=r.getRangeFormatElement(n,null);let o,a,c;const d=r.getParentElement(n,r.isComponent);if(!d||r.isTable(d)){if(1===n.nodeType&&"true"===n.getAttribute("data-se-embed")){let e=n.nextElementSibling;return r.isFormatElement(e)||(e=this.appendFormatTag(n,l.defaultTag)),void this.setRange(e.firstChild,0,e.firstChild,0)}if(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.children[t.startOffset])&&!r.isComponent(i.children[t.startOffset-1])){if(r.getParentElement(n,r.isNotCheckingNode))return null;if(s)return c=r.createElement(e||l.defaultTag),c.innerHTML=s.innerHTML,0===c.childNodes.length&&(c.innerHTML=r.zeroWidthSpace),s.innerHTML=c.outerHTML,c=s.firstChild,o=r.getEdgeChildNodes(c,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),c.insertBefore(o,c.firstChild)),a=o.textContent.length,void this.setRange(o,a,o,a);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||l.defaultTag),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,c=r.getFormatElement(o,null),!c)return this.removeRange(),void this._editorRange();if(r.isBreak(c.nextSibling)&&r.removeItem(c.nextSibling),r.isBreak(c.previousSibling)&&r.removeItem(c.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="";const i=l.frameAttrbutes;for(let t in i)e.element.wysiwyg.setAttribute(t,i[t]);this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),a.setTimeout(function(){u._resizeObserver&&u._resizeObserver.observe(e.element.wysiwygFrame),u._toolbarObserver&&u._toolbarObserver.observe(e.element._toolbarShadow),this._resourcesStateChange(),"function"==typeof h.onload&&h.onload(d,t)}.bind(this))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_toolbarShadow:e._toolbarShadow,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^("+a.Object.keys(l._textTagsMap).join("|")+")$","i"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;const i=u._keyCodeShortcut[e];switch(i){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="bold");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")?n="strike":t||-1!==l.shortcutsDisable.indexOf("save")||(n="save");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="underline");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="italic");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"indent":"outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"outdent":"indent")}return n?(d.commandHandler(d.commandMap[n],n),!0):!!i},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=l.rtl?"marginRight":"marginLeft",s=d.commandMap,o=u._onButtonsCheck,a=[],c=[],h=d.activePlugins,g=h.length;let p="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){if(p=e.nodeName.toUpperCase(),c.push(p),!d.isReadOnly)for(let t,i=0;i0)&&(a.push("OUTDENT"),s.OUTDENT.removeAttribute("disabled")),-1===a.indexOf("INDENT")&&s.INDENT&&!r.isImportantDisabled(s.INDENT)&&(a.push("INDENT"),r.isListCell(e)&&!e.previousElementSibling?s.INDENT.setAttribute("disabled",!0):s.INDENT.removeAttribute("disabled"))):o&&o.test(p)&&(a.push(p),r.addClass(s[p],"active"))}d._setKeyEffect(a),d._variable.currentNodes=c.reverse(),d._variable.currentNodesMap=a,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(d.controllersOff();t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||d.actionCall(i,n,t))},onMouseDown_wysiwyg:function(t){if(d.isReadOnly||r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onMouseDown&&!1===h.onMouseDown(t,d))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault()},onClick_wysiwyg:function(t){const n=t.target;if(d.isReadOnly)return t.preventDefault(),r.isAnchor(n)&&a.open(n.href,n.target),!1;if(r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onClick&&!1===h.onClick(t,d))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const s=r.getParentElement(n,"FIGCAPTION");if(s&&(r.isNonEditable(s)||!s.getAttribute("contenteditable"))&&(t.preventDefault(),s.setAttribute("contenteditable",!0),s.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),s.removeEventListener("blur",e)};s.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),c=r.getFormatElement(o,null),g=r.getRangeFormatElement(o,null);if(c||r.isNonEditable(n)||r.isList(g))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer))if(r.isList(g)){t.preventDefault();const e=r.createElement("LI"),n=o.nextElementSibling;e.appendChild(o),g.insertBefore(e,n),d.focus()}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||null===d._setDefaultFormat(r.isRangeFormatElement(g)?"DIV":l.defaultTag)?u._applyTagEffects():(t.preventDefault(),d.focus())}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,s=e.element.topArea,o=d.getSelection();let c;if(d._isBalloonAlways&&n.collapsed)c=!0;else if(o.focusNode===o.anchorNode)c=o.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name)}else{const e=r.createElement(l.defaultTag);e.innerHTML="
    ",f.parentElement.replaceChild(e,f)}return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}if(u._isUneditableNode(g,!0)){t.preventDefault(),t.stopPropagation();break}!p&&d._isEdgeFormat(g.startContainer,g.startOffset,"start")&&r.isFormatElement(f.previousElementSibling)&&(d._formatAttrsTemp=f.previousElementSibling.attributes);const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,s=f.childNodes;let o=i,a=s[0];for(;a=s[0];)e.insertBefore(a,o.nextSibling),o=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&f&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=f.previousSibling,l=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(e&&!e.previousSibling&&(n&&r.isComponent(n.previousSibling)||l&&r.isComponent(i))){const e=d.getFileComponent(i);e?(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),!1===d.selectComponent(e.target,e.pluginName)&&d.blur()):r.isComponent(i)&&(t.preventDefault(),t.stopPropagation(),r.removeItem(i));break}if(e&&r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if(u._isUneditableNode(g,!1)){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){const e=f.nextElementSibling;if(!e)break;if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n?(t.stopPropagation(),!1===d.selectComponent(n.target,n.pluginName)&&d.blur()):r.isComponent(e)&&(t.stopPropagation(),r.removeItem(e));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f&&f.childNodes[g.startOffset]||c;if(e&&r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}if(r.isComponent(e)){t.preventDefault(),t.stopPropagation(),r.removeItem(e);break}}if(!p&&d._isEdgeFormat(g.endContainer,g.endOffset,"end")&&r.isFormatElement(f.nextElementSibling)&&(d._formatAttrsTemp=f.attributes),f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),s||o||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let s=n[l];if(!s)break;s=s.firstElementChild||s,d.setRange(s,0,s,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i){const e=d._isEdgeFormat(g.endContainer,g.endOffset,"end"),n=d._isEdgeFormat(g.startContainer,g.startOffset,"start");if(e&&(/^H[1-6]$/i.test(f.nodeName)||/^HR$/i.test(f.nodeName))){t.preventDefault();let n=null;const i=d.appendFormatTag(f,l.defaultTag);if(e&&e.length>0){n=e.pop();const t=n;for(;e.length>0;)n=n.appendChild(e.pop());i.appendChild(t)}n=n?n.appendChild(i.firstChild):i.firstChild,d.setRange(n,0,n,0);break}if(n||e){t.preventDefault();const i=r.createElement("BR"),s=r.createElement(f.nodeName);s.appendChild(i),r.copyTagAttributes(s,f,["id"].concat(l.lineAttrReset)),f.parentNode.insertBefore(s,n?f:f.nextElementSibling),e&&d.setRange(i,1,i,1);break}if(d._formatAttrsTemp=f.attributes,l.lineAttrReset&&f&&!r.isListCell(f)){let e;if(t.preventDefault(),t.stopPropagation(),g.collapsed)e=r.onlyZeroWidthSpace(f)?d.appendFormatTag(f,f.cloneNode(!1)):r.splitElement(g.endContainer,g.endOffset,0);else{const t=r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null),n=d.removeNode();if(t)if(e=r.getFormatElement(n.container,null),n.prevContainer)e!==f&&e.nextElementSibling===f&&(e=f);else{const t=f.cloneNode(!1);t.innerHTML="
    ",e.parentNode.insertBefore(t,e)}else e=r.splitElement(n.container,n.offset,0)}const n=l.lineAttrReset,i=e.attributes;let s=0;for(;i[s];)n&&n.indexOf(i[s].name.toLowerCase())>-1?s++:e.removeAttribute(i[s].name);d.setRange(e.firstChild,0,e.firstChild,0);break}if(S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,s=c.previousElementSibling,o=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(s)&&(r.isBreak(s.previousSibling)||!r.onlyZeroWidthSpace(s.previousSibling.textContent))&&(!o||!r.isBreak(o)&&r.onlyZeroWidthSpace(o.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)&&!r.isRangeFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)&&!r.isRangeFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)&&!r.isRangeFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:l.defaultTag;e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,s=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(s)&&!r.isRangeFormatElement(s)?s.nodeName:l.defaultTag),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){!1===d.selectComponent(n._element,m)&&d.blur()}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&16===n){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}else if(i&&(r.isOSX_IOS?o:s)&&32===n){t.preventDefault(),t.stopPropagation();const e=d.insertNode(r.createTextNode(" "));if(e&&e.container)return void d.setRange(e.container,e.endOffset,e.container,e.endOffset)}if(r.isIE&&!s&&!o&&!p&&!u._nonTextKeyCode.test(n)&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=e.keyCode,n=e.ctrlKey||e.metaKey||91===t||92===t||224===t,i=e.altKey;if(d.isReadOnly)return void(!n&&u._directionKeyCode.test(t)&&u._applyTagEffects());const s=d.getRange();let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==t||!s.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==t&&u._showToolbarBalloonDelay()}if(8===t&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:l.defaultTag);return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const a=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null),g=d._formatAttrsTemp;if(g){for(let e=0,n=g.length;e0?i-s-e.element.toolbar.offsetHeight:0;i=n+s?(d._sticky||u._onStickyToolbar(a),t.toolbar.style.top=a+n+s+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=s&&u._onStickyToolbar(a)},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,s=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,s+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:s}},_getPageBottomSpace:function(){return o.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(t){const n=e.element;d._isInline||l.toolbarContainer||(n._stickyDummy.style.height=n.toolbar.offsetHeight+"px",n._stickyDummy.style.display="block"),n.toolbar.style.top=l.stickyToolbar+t+"px",n.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:n.toolbar.offsetWidth+"px",r.addClass(n.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){d._variable.isFullScreen||(e.element.code.style.height=e.element.code.scrollHeight+"px")},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),s=r.isCell(i),o=r.isCell(l),a=e.commonAncestorContainer;if((s&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||o&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(s){if(o)return r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode}))),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode})))}else r.removeItem(r.getParentElement(l,(function(e){return a===e.parentNode})));const c=1===t.nodeType?r.getParentElement(t,".se-component"):null,u=1===n.nodeType?r.getParentElement(n,".se-component"):null;return c&&r.removeItem(c),u&&r.removeItem(u),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!1===h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onSave_wysiwyg:function(e){"function"!=typeof h.onSave||h.onSave(e,d)},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!1===h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){if(d.isReadOnly||r.isIE)return e.preventDefault(),e.stopPropagation(),!1;const t=e.dataTransfer;return!t||(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,s;if(r.isIE){l=i.getData("Text");const o=d.getRange(),c=r.createElement("DIV"),h={sc:o.startContainer,so:o.startOffset,ec:o.endContainer,eo:o.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){s=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,s,i)})),!0}if(l=i.getData("text/plain"),s=i.getData("text/html"),!1===u._setClipboardData(t,n,l,s,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){const s=/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)||/content=["']*Excel.Sheet/i.test(i);!i?i=r._HTMLConvertor(n).replace(/\n/g,"
    "):(i=i.replace(/^\r?\n?\r?\n?\x3C!--StartFragment--\>|\x3C!--EndFragment-->\r?\n?<\/body\>\r?\n?<\/html>$/g,""),s&&(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp,d.pasteTagsBlacklistRegExp));const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste){const e=h.onPaste(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}if("drop"===e&&"function"==typeof h.onDrop){const e=h.onDrop(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}const a=l.files;return a.length>0&&!s?(/^image/.test(a[0].type)&&d.plugins.image&&h.insertImage(a),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled||d.isReadOnly)return!1;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){const s=e.element;let o=0,a=s.wysiwyg;do{o+=a.scrollTop,a=a.parentElement}while(a&&!/^(BODY|HTML)$/i.test(a.nodeName));const c=s.wysiwyg.scrollTop,h=u._getEditorOffsets(null),g=r.getOffset(n,s.wysiwygFrame).top+c,p=t.pageY+o+(l.iframe&&!l.toolbarContainer?s.toolbar.offsetHeight:0),m=g+(l.iframe?o:h.top),f=r.isListCell(n.parentNode);let _="",b="";if((f?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&pm+n.offsetHeight-20))return void(i.display="none");b=g+n.offsetHeight,_="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=_,i.top=b-c+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),s=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":l.defaultTag);if(i||(s.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(s.outerHTML,"byte-html"))return;t.parentNode.insertBefore(s,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?s:s.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_resizeObserver:null,_toolbarObserver:null,_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;r.isResizeObserverSupported&&(this._resizeObserver=new a.ResizeObserver((function(e){d.__callResizeFunction(-1,e[0])}))),e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)&&l.resizeEnable?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),r.isResizeObserverSupported&&(this._toolbarObserver=new a.ResizeObserver(d.resetResponsiveToolbar)),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),u._resizeObserver&&(u._resizeObserver.unobserve(e.element.wysiwygFrame),u._resizeObserver=null),u._toolbarObserver&&(u._toolbarObserver.unobserve(e.element._toolbarShadow),u._toolbarObserver=null),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===s.length)return void(s=null);u._responsiveCurrentSize="default";const e=u._responsiveButtonSize=[],t=u._responsiveButtons={default:s[0]};for(let n,i,l=1,o=s.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button(e);n.resizing.resizeButton=l;let s=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),s[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,s=null},setController_resize:function(e){const t=e.util.createElement("DIV");return t.className="se-controller se-resizing-container",t.style.display="none",t.innerHTML='
    ',t},setController_button:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-resizing",i.innerHTML='
    ",i},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,s=n.resizeDiv,o=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=o.top,u=o.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",s.style.top="0px",s.style.left="0px",s.style.width=r+"px",s.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;o.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,o,null,null),this.selectComponent(o,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(o,l);break;case"caption":const g=!s._captionChecked;if(a.openModify.call(this,!0),s._captionChecked=s.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(s._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):s._caption.focus(),this.controllersOff()}else this.selectComponent(o,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(o,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,s=1*e.getAttribute("data-rotate");let o="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";o=90===s||-270===s?t:e}}e.style.transformOrigin=o,this.plugins.resizing._setTransForm(e,s.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),s="";if(/[1-9]/.test(t)&&(n||i))switch(s=n?"Y":"X",t){case"90":s=n&&i?"X":i?s:"";break;case"270":l*=-1,s=n&&i?"Y":n?s:"";break;case"-90":s=n&&i?"Y":n?s:"";break;case"-270":l*=-1,s=n&&i?"X":i?s:"";break;default:s=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(s?" translate"+s+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const s=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),s&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,s=i.clientY;let o=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?s-e._resizeClientY:e._resizeClientY-s),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=o,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(o)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),t&&this.plugins.resizing.setTransformSize.call(this,this.context[this.context.resizing._resize_plugin]._element,n,i),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,_checkMediaComponent:function(e){return!/IMG/i.test(e)||!/FIGURE/i.test(e.parentElement.nodeName)||!/FIGURE/i.test(e.parentElement.parentElement.nodeName)},upload:function(e,t,n,i,l){this.showLoading();const s=this.plugins.fileManager,o=s._xmlHttp=this.util.getXMLHttpRequest();if(o.onreadystatechange=s._callBackUpload.bind(this,o,i,l),o.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)o.setRequestHeader(e,t[e]);o.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let s=[];for(let e=0,n=t.length;e0;){const t=s.shift();this.util.getParentElement(t,this.util.isMediaComponent)&&o._checkMediaComponent(t)?!t.getAttribute("data-index")||h.indexOf(1*t.getAttribute("data-index"))<0?(u.push(a._infoIndex),t.removeAttribute("data-index"),c(e,t,n,null,l)):u.push(1*t.getAttribute("data-index")):(u.push(a._infoIndex),i(t))}for(let e,t=0;t-1||(r.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=d)},setInfo:function(e,t,n,i,l){const s=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const o=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.options.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url,this.context[e].header)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e,t){const n=this.plugins.fileBrowser,i=n._xmlHttp=this.util.getXMLHttpRequest();if(i.onreadystatechange=n._callBackGet.bind(this,i),i.open("get",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)i.setRequestHeader(e,t[e]);i.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{const t=JSON.parse(e.responseText);t.result.length>0?this.plugins.fileBrowser._drawListItem.call(this,t.result,!0):t.nullMessage&&(this.context.fileBrowser.list.innerHTML=t.nullMessage)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],s=e.length,o=i.columnSize||n.columnSize,a=o<=1?1:Math.round(s/o)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,s=l.tagArea.querySelector('a[title="'+n+'"]'),o=l.selectedTags,a=o.indexOf(n);a>-1?(o.splice(a,1),this.util.removeClass(s,"on")):(o.push(n),this.util.addClass(s,"on")),i._drawListItem.call(this,0===o.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return o.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const s=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),s(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",dir_ltr:"Left to right",dir_rtl:"Right to left",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window",downloadLinkCheck:"Download link",bookmark:"Bookmark"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]},t.colorPicker.colorListHTML=this.createColorList(e,this._makeColorList)},createColorList:function(e,t){const n=e.options,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];let s=[],o='
    ';for(let e,n=0,i=l.length;n0&&(o+='
    '+t(s)+"
    ",s=[]),"object"==typeof e&&(o+='
    '+t(e)+"
    ")));return o+='
    ",o},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.color;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},s={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.backgroundColor;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#ffffff",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},o={name:"template",display:"submenu",add:function(e,t){e.context.template={selectedIndex:-1};let n=this.setSubmenu(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(e){const t=e.options.templates;if(!t||0===t.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const n=e.util.createElement("DIV");n.className="se-list-layer";let i='
      ';for(let e,n=0,l=t.length;n";return i+="
    ",n.innerHTML=i,n},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation(),this.context.template.selectedIndex=1*e.target.getAttribute("data-value");const t=this.options.templates[this.context.template.selectedIndex];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"selectMenu",add:function(e){e.context.selectMenu={caller:{},callerContext:null}},setForm:function(){return'
    '},createList:function(e,t,n){e.form.innerHTML="
      "+n+"
    ",e.items=t,e.menus=e.form.querySelectorAll("li")},initEvent:function(e,t){const n=t.querySelector(".se-select-list"),i=this.context.selectMenu.caller[e]={form:n,items:[],menus:[],index:-1,item:null,clickMethod:null,callerName:e};n.addEventListener("mousedown",this.plugins.selectMenu.onMousedown_list),n.addEventListener("mousemove",this.plugins.selectMenu.onMouseMove_list.bind(this,i)),n.addEventListener("click",this.plugins.selectMenu.onClick_list.bind(this,i))},onMousedown_list:function(e){e.preventDefault(),e.stopPropagation()},onMouseMove_list:function(e,t){this.util.addClass(e.form,"__se_select-menu-mouse-move");const n=t.target.getAttribute("data-index");n&&(e.index=1*n)},onClick_list:function(e,t){const n=t.target.getAttribute("data-index");n&&e.clickMethod.call(this,e.items[n])},moveItem:function(e,t){this.util.removeClass(e.form,"__se_select-menu-mouse-move"),t=e.index+t;const n=e.menus,i=n.length,l=e.index=t>=i?0:t<0?i-1:t;for(let e=0;e
    "+e.plugins.selectMenu.setForm()+'
    '+l.bookmark+''+l.download+'
    ",s.innerHTML=o,s},initEvent:function(e,t){const n=this.plugins.anchor,i=this.context.anchor.caller[e]={modal:t,urlInput:null,linkDefaultRel:this.options.linkRelDefault,defaultRel:this.options.linkRelDefault.default||"",currentRel:[],linkAnchor:null,linkValue:"",_change:!1,callerName:e};"string"==typeof i.linkDefaultRel.default&&(i.linkDefaultRel.default=i.linkDefaultRel.default.trim()),"string"==typeof i.linkDefaultRel.check_new_window&&(i.linkDefaultRel.check_new_window=i.linkDefaultRel.check_new_window.trim()),"string"==typeof i.linkDefaultRel.check_bookmark&&(i.linkDefaultRel.check_bookmark=i.linkDefaultRel.check_bookmark.trim()),i.urlInput=t.querySelector(".se-input-url"),i.anchorText=t.querySelector("._se_anchor_text"),i.newWindowCheck=t.querySelector("._se_anchor_check"),i.downloadCheck=t.querySelector("._se_anchor_download"),i.download=t.querySelector("._se_anchor_download_icon"),i.preview=t.querySelector(".se-link-preview"),i.bookmark=t.querySelector("._se_anchor_bookmark_icon"),i.bookmarkButton=t.querySelector("._se_bookmark_button"),this.plugins.selectMenu.initEvent.call(this,e,t);const l=this.context.selectMenu.caller[e];this.options.linkRel.length>0&&(i.relButton=t.querySelector(".se-anchor-rel-btn"),i.relList=t.querySelector(".se-list-layer"),i.relPreview=t.querySelector(".se-anchor-rel-preview"),i.relButton.addEventListener("click",n.onClick_relButton.bind(this,i)),i.relList.addEventListener("click",n.onClick_relList.bind(this,i))),i.newWindowCheck.addEventListener("change",n.onChange_newWindowCheck.bind(this,i)),i.downloadCheck.addEventListener("change",n.onChange_downloadCheck.bind(this,i)),i.anchorText.addEventListener("input",n.onChangeAnchorText.bind(this,i)),i.urlInput.addEventListener("input",n.onChangeUrlInput.bind(this,i)),i.urlInput.addEventListener("keydown",n.onKeyDownUrlInput.bind(this,l)),i.urlInput.addEventListener("focus",n.onFocusUrlInput.bind(this,i,l)),i.urlInput.addEventListener("blur",n.onBlurUrlInput.bind(this,l)),i.bookmarkButton.addEventListener("click",n.onClick_bookmarkButton.bind(this,i))},on:function(e,t){const n=this.plugins.anchor;if(t){if(e.linkAnchor){this.context.dialog.updateModal=!0;const t=e.linkAnchor.getAttribute("href");e.linkValue=e.preview.textContent=e.urlInput.value=n.selfPathBookmark.call(this,t)?t.substr(t.lastIndexOf("#")):t,e.anchorText.value=e.linkAnchor.textContent,e.newWindowCheck.checked=!!/_blank/i.test(e.linkAnchor.target),e.downloadCheck.checked=e.linkAnchor.download}}else n.init.call(this,e),e.anchorText.value=this.getSelection().toString().trim(),e.newWindowCheck.checked=this.options.linkTargetNewWindow;this.context.anchor.callerContext=e,n.setRel.call(this,e,t&&e.linkAnchor?e.linkAnchor.rel:e.defaultRel),n.setLinkPreview.call(this,e,e.linkValue),this.plugins.selectMenu.on.call(this,e.callerName,this.plugins.anchor.setHeaderBookmark)},selfPathBookmark:function(e){const t=this._w.location.href.replace(/\/$/,"");return 0===e.indexOf("#")||0===e.indexOf(t)&&e.indexOf("#")===(-1===t.indexOf("#")?t.length:t.substr(0,t.indexOf("#")).length)},_closeRelMenu:null,toggleRelList:function(e,t){if(t){const t=e.relButton,n=e.relList;this.util.addClass(t,"active"),n.style.visibility="hidden",n.style.display="block",this.options.rtl?n.style.left=t.offsetLeft-n.offsetWidth-1+"px":n.style.left=t.offsetLeft+t.offsetWidth+1+"px",n.style.top=t.offsetTop+t.offsetHeight/2-n.offsetHeight/2+"px",n.style.visibility="",this.plugins.anchor._closeRelMenu=function(e,t,n){n&&(e.relButton.contains(n.target)||e.relList.contains(n.target))||(this.util.removeClass(t,"active"),e.relList.style.display="none",this.modalForm.removeEventListener("click",this.plugins.anchor._closeRelMenu),this.plugins.anchor._closeRelMenu=null)}.bind(this,e,t),this.modalForm.addEventListener("click",this.plugins.anchor._closeRelMenu)}else this.plugins.anchor._closeRelMenu&&this.plugins.anchor._closeRelMenu()},onClick_relButton:function(e,t){this.plugins.anchor.toggleRelList.call(this,e,!this.util.hasClass(t.target,"active"))},onClick_relList:function(e,t){const n=t.target,i=n.getAttribute("data-command");if(!i)return;const l=e.currentRel,s=this.util.toggleClass(n,"se-checked"),o=l.indexOf(i);s?-1===o&&l.push(i):o>-1&&l.splice(o,1),e.relPreview.title=e.relPreview.textContent=l.join(" ")},setRel:function(e,t){const n=e.relList,i=e.currentRel=t?t.split(" "):[];if(!n)return;const l=n.querySelectorAll("button");for(let e,t=0,n=l.length;t-1?this.util.addClass(l[t],"se-checked"):this.util.removeClass(l[t],"se-checked");e.relPreview.title=e.relPreview.textContent=i.join(" ")},createHeaderList:function(e,t,n){const i=this.util.getListChildren(this.context.element.wysiwyg,(function(e){return/h[1-6]/i.test(e.nodeName)}));if(0===i.length)return;const l=new this._w.RegExp("^"+n.replace(/^#/,""),"i"),s=[];let o="";for(let e,t=0,n=i.length;t'+e.textContent+"");0===s.length?this.plugins.selectMenu.close.call(this,t):(this.plugins.selectMenu.createList(t,s,o),this.plugins.selectMenu.open.call(this,t,this.plugins.anchor._setMenuListPosition.bind(this,e)))},_setMenuListPosition:function(e,t){t.style.top=e.urlInput.offsetHeight+1+"px"},onKeyDownUrlInput:function(e,t){switch(t.keyCode){case 38:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,-1);break;case 40:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,1);break;case 13:e.index>-1&&(t.preventDefault(),t.stopPropagation(),this.plugins.anchor.setHeaderBookmark.call(this,this.plugins.selectMenu.getItem(e,null)))}},setHeaderBookmark:function(e){const t=this.context.anchor.callerContext,n=e.id||"h_"+this._w.Math.random().toString().replace(/.+\./,"");e.id=n,t.urlInput.value="#"+n,t.anchorText.value.trim()&&t._change||(t.anchorText.value=e.textContent),this.plugins.anchor.setLinkPreview.call(this,t,t.urlInput.value),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext),this.context.anchor.callerContext.urlInput.focus()},onChangeAnchorText:function(e,t){e._change=!!t.target.value.trim()},onChangeUrlInput:function(e,t){const n=t.target.value.trim();this.plugins.anchor.setLinkPreview.call(this,e,n),this.plugins.anchor.selfPathBookmark.call(this,n)?this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,n):this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)},onFocusUrlInput:function(e,t){const n=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,n)&&this.plugins.anchor.createHeaderList.call(this,e,t,n)},onBlurUrlInput:function(e){this.plugins.selectMenu.close.call(this,e)},setLinkPreview:function(e,t){const n=e.preview,i=this.options.linkProtocol,l=this.options.linkNoPrefix,s=/^(mailto\:|tel\:|sms\:|https*\:\/\/|#)/.test(t),o=!!i&&this._w.RegExp("^"+t.substr(0,i.length)).test(i);t=e.linkValue=n.textContent=t?l?t:!i||s||o?s?t:/^www\./.test(t)?"http://"+t:this.context.anchor.host+(/^\//.test(t)?"":"/")+t:i+t:"",this.plugins.anchor.selfPathBookmark.call(this,t)?(e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active")):(e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active")),!this.plugins.anchor.selfPathBookmark.call(this,t)&&e.downloadCheck.checked?e.download.style.display="block":e.download.style.display="none"},setCtx:function(e,t){e&&(t.linkAnchor=e,t.linkValue=e.href,t.currentRel=e.rel.split(" "))},updateAnchor:function(e,t,n,i,l){!this.plugins.anchor.selfPathBookmark.call(this,t)&&i.downloadCheck.checked?e.setAttribute("download",n||t):e.removeAttribute("download"),i.newWindowCheck.checked?e.target="_blank":e.removeAttribute("target");const s=i.currentRel.join(" ");s?e.rel=s:e.removeAttribute("rel"),e.href=t,l?0===e.children.length&&(e.textContent=""):e.textContent=n},createAnchor:function(e,t){if(0===e.linkValue.length)return null;const n=e.linkValue,i=e.anchorText,l=0===i.value.length?n:i.value,s=e.linkAnchor||this.util.createElement("A");return this.plugins.anchor.updateAnchor.call(this,s,n,l,e,t),e.linkValue=e.preview.textContent=e.urlInput.value=e.anchorText.value="",s},onClick_bookmarkButton:function(e){let t=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,t)?(t=t.substr(1),e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)):(t="#"+t,e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active"),e.downloadCheck.checked=!1,e.download.style.display="none",this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,t)),e.urlInput.value=t,this.plugins.anchor.setLinkPreview.call(this,e,t),e.urlInput.focus()},onChange_newWindowCheck:function(e,t){"string"==typeof e.linkDefaultRel.check_new_window&&(t.target.checked?this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_new_window)):this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_new_window)))},onChange_downloadCheck:function(e,t){t.target.checked?(e.download.style.display="block",e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),e.linkValue=e.preview.textContent=e.urlInput.value=e.urlInput.value.replace(/^\#+/,""),"string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_bookmark))):(e.download.style.display="none","string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_bookmark)))},_relMerge:function(e,t){const n=e.currentRel;if(!t)return n.join(" ");if(/^only\:/.test(t))return t=t.replace(/^only\:/,"").trim(),e.currentRel=t.split(" "),t;const i=t.split(" ");for(let e,t=0,l=i.length;t'+i.cancel+''+t.dialogBox.linkBox.title+""+e.context.anchor.forms.innerHTML+'";return n.innerHTML=l,n},setController_LinkButton:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
    ",i},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();try{const e=this.plugins.anchor.createAnchor.call(this,this.context.anchor.caller.link,!1);if(null===e)return;if(this.context.dialog.updateModal){const e=this.context.link._linkAnchor.childNodes[0];this.setRange(e,0,e,e.textContent.length)}else{const t=this.getSelectedElements();if(t.length>1){const n=this.util.createElement(t[0].nodeName);if(n.appendChild(e),!this.insertNode(n,null,!0))return}else if(!this.insertNode(e,null,!0))return;this.setRange(e.childNodes[0],0,e.childNodes[0],e.textContent.length)}}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){this.plugins.anchor.on.call(this,this.context.anchor.caller.link,e)},call_controller:function(e){this.editLink=this.context.link._linkAnchor=this.context.anchor.caller.link.linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent,this.util.addClass(e,"on"),this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"link",this.util.removeClass.bind(this.util,this.context.link._linkAnchor,"on"))},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t))this.plugins.dialog.open.call(this,"link",!0);else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.anchor.caller.link.linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){this.context.link.linkController.style.display="none",this.plugins.anchor.init.call(this,this.context.anchor.caller.link)}},h=n("ZED3"),g=n.n(h),p=n("ee5k"),m=n.n(p),f=n("gjS+"),_=n.n(f),b={name:"image",display:"dialog",add:function(e){e.addModule([r.a,d,g.a,m.a,_.a]);const t=e.options,n=e.context,i=n.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:t._imageSizeUnit,_linkElement:"",_altText:"",_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_src:{_linkValue:""},svgDefaultSize:"30%",base64RenderIndex:0,_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.imageWidth?"":t.imageWidth,_origin_h:"auto"===t.imageHeight?"":t.imageHeight,_proportionChecked:!0,_resizing:t.imageResizing,_resizeDotHide:!t.imageHeightShow,_rotation:t.imageRotation,_alignHide:!t.imageAlignShow,_onlyPercentage:t.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let l=this.setDialog(e);i.modal=l,i.imgInputFile=l.querySelector("._se_image_file"),i.imgUrlFile=l.querySelector("._se_image_url"),i.focusElement=i.imgInputFile||i.imgUrlFile,i.altText=l.querySelector("._se_image_alt"),i.captionCheckEl=l.querySelector("._se_image_check_caption"),i.previewSrc=l.querySelector("._se_tab_content_image .se-link-preview"),l.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),l.querySelector("form").addEventListener("submit",this.submit.bind(e)),i.imgInputFile&&l.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(i.imgInputFile,i.imgUrlFile,i.previewSrc)),i.imgUrlFile&&i.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(i.previewSrc,i._v_src,t.linkProtocol)),i.imgInputFile&&i.imgUrlFile&&i.imgInputFile.addEventListener("change",this._fileInputChange.bind(i));const s=l.querySelector(".__se__gallery");s&&s.addEventListener("click",this._openGallery.bind(e)),i.proportion={},i.inputX={},i.inputY={},t.imageResizing&&(i.proportion=l.querySelector("._se_image_check_proportion"),i.inputX=l.querySelector("._se_image_size_x"),i.inputY=l.querySelector("._se_image_size_y"),i.inputX.value=t.imageWidth,i.inputY.value=t.imageHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),i.inputX.addEventListener("change",this.setRatio.bind(e)),i.inputY.addEventListener("change",this.setRatio.bind(e)),i.proportion.addEventListener("change",this.setRatio.bind(e)),l.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),n.dialog.modal.appendChild(l),e.plugins.anchor.initEvent.call(e,"image",l.querySelector("._se_tab_content_url")),i.anchorCtx=e.context.anchor.caller.image,l=null},setDialog:function(e){const t=e.options,n=e.lang,i=e.util.createElement("DIV");i.className="se-dialog-content se-dialog-image",i.style.display="none";let l='
    '+n.dialogBox.imageBox.title+'
    ';if(t.imageFileInput&&(l+='
    "),t.imageUrlInput&&(l+='
    '+(t.imageGalleryUrl&&e.plugins.imageGallery?'":"")+'
    '),l+='
    ',t.imageResizing){const i=t.imageSizeOnlyPercentage,s=i?' style="display: none !important;"':"",o=t.imageHeightShow?"":' style="display: none !important;"';l+='
    ',i||!t.imageHeightShow?l+='
    ":l+='
    ",l+=' '+n.dialogBox.proportion+'
    "}return l+='
    ",i.innerHTML=l,i},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.imageWidth===t._defaultSizeX?"":this.options.imageWidth,t.inputY.value=t._origin_h=this.options.imageHeight===t._defaultSizeY?"":this.options.imageHeight,t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple")),this.plugins.anchor.on.call(this,t.anchorCtx,e)},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,s,o;for(s=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this,t._v_src._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const s={anchor:this.plugins.anchor.createAnchor.call(this,l.anchorCtx,!0),inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,alt:l._altText,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,s,e):this.plugins.image.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.options.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e'+e.icons.cancel+''+n.dialogBox.videoBox.title+'
    ';if(t.videoFileInput&&(l+='
    "),t.videoUrlInput&&(l+='
    '),t.videoResizing){const i=t.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],s=t.videoRatio,o=t.videoSizeOnlyPercentage,a=o?' style="display: none !important;"':"",r=t.videoHeightShow?"":' style="display: none !important;"',c=t.videoRatioShow?"":' style="display: none !important;"',d=o||t.videoHeightShow||t.videoRatioShow?"":' style="display: none !important;"';l+='
    "}return l+='
    ",i.innerHTML=l,i},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.videoWidth===t._defaultSizeX?"":this.options.videoWidth,t.inputY.value=t._origin_h=this.options.videoHeight===t._defaultSizeY?"":this.options.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const s={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,s,e):this.plugins.video.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.options.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(e)){if(0===(e=(new this._w.DOMParser).parseFromString(e,"text/html").querySelector("iframe").src).length)return!1}if(/youtu\.?be/.test(e)){if(/^http/.test(e)||(e="https://"+e),e=e.replace("watch?v=",""),/^\/\/.+\/embed\//.test(e)||(e=e.replace(e.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t._youtubeQuery.length>0)if(/\?/.test(e)){const n=e.split("?");e=n[0]+"?"+t._youtubeQuery+"&"+n[1]}else e+="?"+t._youtubeQuery}else/vimeo\.com/.test(e)&&(e.endsWith("/")&&(e=e.slice(0,-1)),e="https://player.vimeo.com/video/"+e.slice(e.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video[/embed|iframe|player|\/e\/|\.php|\.html?/.test(e)||/vimeo\.com/.test(e)?"createIframeTag":"createVideoTag"].call(this),e,t.inputX.value,t.inputY.value,t._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,s,o){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(o){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!o||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;if(o)a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null);else if(p=this.insertComponent(c,!1,!0,!this.options.mediaAutoSelect),!this.options.mediaAutoSelect){const e=this.appendFormatTag(c,null);e&&this.setRange(e,0,e,0)}p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,s,!0),o&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);let n=this.util.isRangeFormatElement(e.parentNode)||this.util.isWysiwygDiv(e.parentNode)?e:this.util.getFormatElement(e)||e;const i=e;t._element=e=e.cloneNode(!0);const l=t._cover=this.plugins.component.set_cover.call(this,e),s=t._container=this.plugins.component.set_container.call(this,l,"se-video-container");try{const o=n.querySelector("figcaption");let a=null;o&&(a=this.util.createElement("DIV"),a.innerHTML=o.innerHTML,this.util.removeItem(o));const r=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,r[0]||i.style.width||i.width||"",r[1]||i.style.height||i.height||"");const c=this.util.getFormatElement(i);if(c&&(t._align=c.style.textAlign||c.style.float),this.plugins.video.setAlign.call(this,null,e,l,s),this.util.getParentElement(i,this.util.isNotCheckingNode))i.parentNode.replaceChild(s,i);else if(this.util.isListCell(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n.insertBefore(s,e),this.util.removeItem(i),this.util.removeEmptyNode(e,null,!0)}else if(this.util.isFormatElement(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n=this.util.splitElement(n,e),n.parentNode.insertBefore(s,n),this.util.removeItem(i),this.util.removeEmptyNode(n,null,!0),0===n.children.length&&(n.innerHTML=this.util.htmlRemoveWhiteSpace(n.innerHTML))}else n.parentNode.replaceChild(s,n);a&&n.parentNode.insertBefore(a,s.nextElementSibling)}catch(e){console.warn("[SUNEDITOR.video.error] Maybe the video tag is nested.",e)}this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0),this.plugins.video.init.call(this)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.style.float||e.getAttribute("data-align")||"none",e.style.float="",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i,l,s=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");s?(s=s.split(","),i=s[0],l=s[1]):t&&(i=t.w,l=t.h),n._origin_w=i||e.style.width||e.width||"",n._origin_h=l||e.style.height||e.height||""},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),(t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]')||t.modal.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,s=i.length;l'+e.icons.cancel+''+n.dialogBox.audioBox.title+'
    ';return t.audioFileInput&&(l+='
    "),t.audioUrlInput&&(l+='
    '),l+='
    ",i.innerHTML=l,i},setController:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
    ",i},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const s={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,s,e):this.plugins.audio.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.options.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+e.icons.cancel+''+t.dialogBox.mathBox.title+'

    ",e.context.math.defaultFontSize=l,n.innerHTML=s,n},setController_MathButton:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp")||!this.options.katex)return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){let t="";try{this.util.removeClass(this.context.math.focusElement,"se-error"),t=this.options.katex.src.renderToString(e,{throwOnError:!0,displayMode:!0})}catch(e){this.util.addClass(this.context.math.focusElement,"se-error"),t='Katex syntax error. (Refer KaTeX)',console.warn("[SUNEDITOR.math.Katex.error] ",e)}return t},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController;this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},w=n("JhlZ"),x=n.n(w),E={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_itemMenu:null,_alignList:null,currentAlign:"",defaultDir:e.options.rtl?"right":"left",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu(e),s=i.align._itemMenu=l.querySelector("ul");s.addEventListener("click",this.pickup.bind(e)),i.align._alignList=s.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,s=null},setSubmenu:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV"),l=e.options.alignItems;let s="";for(let e,i,o=0;o";return i.className="se-submenu se-list-layer se-list-align",i.innerHTML='
      '+s+"
    ",i},active:function(e){const t=this.context.align,n=t.targetButton,i=n.firstElementChild;if(e){if(this.util.isFormatElement(e)){const l=e.style.textAlign;if(l)return this.util.changeElement(i,t.icons[l]||t.icons[t.defaultDir]),n.setAttribute("data-focus",l),!0}}else this.util.changeElement(i,t.icons[t.defaultDir]),n.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||e.defaultDir;if(n!==e.currentAlign){for(let e=0,i=t.length;e
    • ";for(s=0,o=a.length;s";return r+="
    ",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,this.lang.toolbar.font+" ("+i+")"),!0}}else{const e=this.hasFocus?this.wwComputedStyle.fontFamily:this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,this.hasFocus?this.lang.toolbar.font+(e?" ("+e+")":""):e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+n.toolbar.default+")";for(let e,n=0,i=t.fontSizeUnit,o=l.length;n";return s+="",i.innerHTML=s,i},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,this._convertFontSize.call(this,this.options.fontSizeUnit,e.style.fontSize)),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.hasFocus?this._convertFontSize.call(this,this.options.fontSizeUnit,this.wwComputedStyle.fontSize):this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e";return n.className="se-submenu se-list-layer se-list-line",n.innerHTML='
      '+l+"
    ",n},active:function(e){if(e){if(/HR/i.test(e.nodeName))return this.context.horizontalRule.currentHR=e,this.util.hasClass(e,"on")||(this.util.addClass(e,"on"),this.controllersOn("hr",this.util.removeClass.bind(this.util,e,"on"))),!0}else this.util.hasClass(this.context.horizontalRule.currentHR,"on")&&this.controllersOff();return!1},appendHr:function(e){return this.focus(),this.insertComponent(e.cloneNode(!1),!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=t.getAttribute("data-command");for(;!n&&!/UL/i.test(t.tagName);)t=t.parentNode,n=t.getAttribute("data-command");if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,t.firstElementChild);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML='
    ",n},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}return t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active"),!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(h=a),r&&f===p&&!s.isRangeFormatElement(_)||(d||(d=a),i&&r&&f===p||r&&s.isList(p)&&p===c||a.parentNode!==f&&f.insertBefore(a,_)),s.removeItem(n),i&&null===g&&(g=a.children.length-1),r&&(s.getRangeFormatElement(p,m)!==s.getRangeFormatElement(c,m)||s.isList(p)&&s.isList(c)&&s.getElementDepth(p)!==s.getElementDepth(c))&&(a=s.createElement(e)),b&&0===b.children.length&&s.removeItem(b)}else s.removeItem(n);g&&(d=d.children[g]),o&&(p=a.children.length-1,a.innerHTML+=c.innerHTML,h=a.children[p],s.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=s.getRangeFormatElement(o),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(s);i||(r=s.createElement(e));for(let t,o,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,s=this.util.getPositionIndex(i);for(;t[s];)e.appendChild(t[s]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(o);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],s=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;s=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),o=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,s=0,c=n;s span > span"),i.columnFixedButton=o.querySelector("._se_table_fixed_column"),i.headerButton=o.querySelector("._se_table_header");let a=this.setController_tableEditor(e,i.cellControllerTop);i.resizeDiv=a,i.splitMenu=a.querySelector(".se-btn-group-sub"),i.mergeButton=a.querySelector("._se_table_merge_button"),i.splitButton=a.querySelector("._se_table_split_button"),i.insertRowAboveButton=a.querySelector("._se_table_insert_row_a"),i.insertRowBelowButton=a.querySelector("._se_table_insert_row_b"),s.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e,i)),s.addEventListener("click",this.appendTable.bind(e)),a.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,l),n.element.relative.appendChild(a),n.element.relative.appendChild(o),l=null,s=null,a=null,o=null,i=null},setSubmenu:function(e){const t=e.util.createElement("DIV");return t.className="se-submenu se-selector-table",t.innerHTML='
    1 x 1
    ',t},setController_table:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-table",i.innerHTML='
    ",i},setController_tableEditor:function(e,t){const n=e.lang,i=e.icons,l=e.util.createElement("DIV");return l.className="se-controller se-controller-table-cell",l.innerHTML=(t?"":'
    ')+'
    • '+n.controller.VerticalSplit+'
    • '+n.controller.HorizontalSplit+"
    ",l},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e,t){t.stopPropagation();let n=this._w.Math.ceil(t.offsetX/18),i=this._w.Math.ceil(t.offsetY/18);n=n<1?1:n,i=i<1?1:i,e._rtl&&(e.tableHighlight.style.left=18*n-13+"px",n=11-n),e.tableHighlight.style.width=n+"em",e.tableHighlight.style.height=i+"em",this.util.changeTxt(e.tableDisplay,n+" x "+i),e._tableXY=[n,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;ts||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)));if(s===o&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,s="row"===e;if(s){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(s)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,s=l.length;no&&o>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[s+1];if(e){const t=[];let n=r[s].cells,i=0;for(let e,l,s=0,o=n.length;s1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let s,o,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,s),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!s[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+o?h.push(e):p<=t+o&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+o,p,p+r):n>0&&(pt+o)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&s.length>0&&(p=this.plugins.table.createCells.call(this,s[0].nodeName,0,!0),p=e.insertBefore(p,s[t]))}}if(l){let e,t;for(let n,l=0,s=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,o.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let o,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:s+1,rs:d,row:-1}),i!==l&&u<=a&&u+s>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=s}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}o.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(s,o)+n;for(let e,t,n=0;n=a));c++)l=e[c],s=l.rowSpan-1,s>0&&s+n>=r&&o=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||s===o-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=o.cells;for(let e=0,t=a.length;e0&&o+s>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,o,o+s));else s.push(e[o]);for(let e=0,t=s.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,s,o;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(s=t.icons.reduction,o=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(s=t.icons.expansion,o=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,s),this.util.changeTxt(l,o)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,s=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=s.length;e0)for(let e,t=0;td||(u>=e.index?(s+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(o){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){o=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==s){c.cs=e,c.ce=t,c.rs=n,c.re=s,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),s+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(t=e.toLowerCase(),i="blockquote"===t?"range":"pre"===t?"free":"replace",r=/^h/.test(t)?t.match(/\d+/)[0]:"",a=n["tag_"+(r?"h":t)]+r,d="",c=""):(t=e.tag.toLowerCase(),i=e.command,a=e.name||t,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",i.innerHTML=o,i},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText;if(e){if(this.util.isFormatElement(e)){const i=this.context.formatBlock._formatList,l=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,o=i.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),s=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),o=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,o?o.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!s||!c||/
    $/i.test(s)?s:s+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),s&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,o=p.length;n('+n.toolbar.default+")";for(let e,t=0,n=l.length;t";return s+="",i.innerHTML=s,i},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",n.innerHTML=o,n},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return s+="",n.innerHTML=s,n},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,s,o=0,a=t.length;o'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.plugins.image.create_image.call(this,e.getAttribute("data-value"),null,this.context.image._origin_w,this.context.image._origin_h,"none",t,e.alt)}.bind(this),null)}}},S={rtl:{italic:'',indent:'',outdent:'',list_bullets:'',list_number:'',link:'',unlink:''},redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',bookmark:'',download:'',dir_ltr:'',dir_rtl:'',alert_outline:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},N=n("P6u4"),T=n.n(N);const k={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,isChromium:null,isResizeObserverSupported:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform),this.isChromium=!!window.chrome,this.isResizeObserverSupported="function"==typeof ResizeObserver)},_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas",_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),fontValueMap:{"xx-small":1,"x-small":2,small:3,medium:4,large:5,"x-large":6,"xx-large":7},onlyZeroWidthSpace:function(e){return null!=e&&("string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e))},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},getValues:function(e){return e?this._w.Object.keys(e).map((function(t){return e[t]})):[]},camelToKebabCase:function(e){return"string"==typeof e?e.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},kebabToCamelCase:function(e){return"string"==typeof e?e.replace(/-[a-zA-Z]/g,(function(e){return e.replace("-","").toUpperCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",s="js"===t?"src":"href";let o="(?:";for(let t=0,n=e.length;t0?i[0][s]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){if(!e||!e.toString)return 0;e=e.toString();const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e)).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isUneditableComponent:function(e){return e&&this.hasClass(e,"__se__uneditable")},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t,n){t.style.cssText&&(e.style.cssText+=t.style.cssText);const i=t.attributes;for(let t=0,l=i.length;t-1||e.setAttribute(i[t].name,i[t].value);const l=e.attributes;for(let t=0,n=l.length;to?1:s0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const s=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==s;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const o=t&&/iframe/i.test(t.nodeName);return{left:n+(o?t.parentElement.offsetLeft:0),top:i-(s?s.scrollTop:0)+(o?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;let n=!1;const i=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");return i.test(e.className)?e.className=e.className.replace(i," ").trim():(e.className+=" "+t,n=!0),e.className.trim()||e.removeAttribute("class"),n},isImportantDisabled:function(e){return e.hasAttribute("data-important-disabled")},setDisabledButtons:function(e,t,n){for(let i=0,l=t.length;ii))continue;s.appendChild(n[e])}e--,t--,i--}return l.childNodes.length>0&&e.parentNode.insertBefore(l,e),s.childNodes.length>0&&e.parentNode.insertBefore(s,e.nextElementSibling),e}const i=e.parentNode;let l,s,o,a=0,r=!0;if((!n||n<0)&&(n=0),3===e.nodeType){if(a=this.getPositionIndex(e),t>=0&&e.length!==t){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,o=l,l=c.cloneNode(!1),s=c.childNodes,o&&(this.isListCell(l)&&this.isList(o)&&o.firstElementChild?(l.innerHTML=o.firstElementChild.innerHTML,k.removeItem(o.firstElementChild),o.children.length>0&&l.appendChild(o)):l.appendChild(o));s[a];)l.appendChild(s[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let s=null;return l&&(s=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(o,a,r){const c=o.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(s.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,s=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,o),o.parentNode.insertBefore(d,o),i.removeItem(o)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const o=d.lastChild,c=u.firstChild;let g=0;if(o&&c){const e=3===o.nodeType&&3===c.nodeType;g=o.textContent.length;let i=o.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===o.nodeType&&3===c.nodeType&&(o.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&o&&3===o.nodeType&&c&&3===c.nodeType&&(s[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,s[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),s},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)[^>^<]+>\s+(?=<)/gi,(function(e){return e.replace(/\n/g,"").replace(/\s+/," ")})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e]*>","gi")},createTagsBlacklist:function(e){return new RegExp("<\\/?\\b(?:\\b"+(e||"^").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},_consistencyCheckOfHTML:function(e,t,n,i){const l=[],s=[],o=[],a=[],r=this.getListChildNodes(e,function(r){if(1!==r.nodeType)return this.isList(r.parentElement)&&l.push(r),!1;if(n.test(r.nodeName)||!t.test(r.nodeName)&&0===r.childNodes.length&&this.isNotCheckingNode(r))return l.push(r),!1;const c=!this.getParentElement(r,this.isNotCheckingNode);if(!this.isTable(r)&&!this.isListCell(r)&&!this.isAnchor(r)&&(this.isFormatElement(r)||this.isRangeFormatElement(r)||this.isTextStyleElement(r))&&0===r.childNodes.length&&c)return s.push(r),!1;if(this.isList(r.parentNode)&&!this.isList(r)&&!this.isListCell(r))return o.push(r),!1;if(this.isCell(r)){const e=r.firstElementChild;if(!this.isFormatElement(e)&&!this.isRangeFormatElement(e)&&!this.isComponent(e))return a.push(r),!1}if(i&&c&&r.className){const e=new this._w.Array(r.classList).map(this._classNameFilter).join(" ").trim();e?r.className=e:r.removeAttribute("class")}return r.parentNode!==e&&c&&(this.isListCell(r)&&!this.isList(r.parentNode)||i&&(this.isFormatElement(r)||this.isComponent(r))&&!this.isRangeFormatElement(r.parentNode)&&!this.getParentElement(r,this.isComponent))}.bind(this));for(let e=0,t=l.length;e=0;l--)t.insertBefore(e,n[l]);c.push(e)}else t.parentNode.insertBefore(e,t),c.push(t);for(let e,t=0,n=c.length;t":e.innerHTML,e.innerHTML=t.outerHTML},_classNameFilter:function(e){return/(^__se__|^se-|katex)/.test(e)?e:""},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",s="";const o=(t=n+t).split(";");for(let t,n=0,a=o.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className=t._editableClass,e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,s=t.length;l'}return i+("auto"===e.height?"":"")}};var L=k,B={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor"+(t.rtl?" se-rtl":""),e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const s=this._createToolBar(n,t.buttonList,t.plugins,t),o=s.element.cloneNode(!1);o.className+=" se-toolbar-shadow",s.element.style.visibility="hidden",s.pluginCallButtons.math&&this._checkKatexMath(t.katex);const a=n.createElement("DIV");a.className="se-arrow";const r=n.createElement("DIV");r.className="se-toolbar-sticky-dummy";const c=n.createElement("DIV");c.className="se-wrapper";const d=this._initElements(t,i,s.element,a),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;const m=u.resizingBar,f=u.navigation,_=u.charWrapper,b=u.charCounter,v=n.createElement("DIV");v.className="se-loading-box sun-editor-common",v.innerHTML='
    ';const y=n.createElement("DIV");y.className="se-line-breaker",y.innerHTML='";const C=n.createElement("DIV");C.className+="se-line-breaker-component";const w=C.cloneNode(!0);C.innerHTML=w.innerHTML=t.icons.line_break;const x=n.createElement("DIV");x.className="se-resizing-back";const E=t.toolbarContainer;E&&(E.appendChild(s.element),E.appendChild(o));const S=t.resizingBarContainer;return m&&S&&S.appendChild(m),c.appendChild(p),g&&c.appendChild(g),E||(l.appendChild(s.element),l.appendChild(o)),l.appendChild(r),l.appendChild(c),l.appendChild(x),l.appendChild(v),l.appendChild(y),l.appendChild(C),l.appendChild(w),m&&!S&&l.appendChild(m),i.appendChild(l),p=this._checkCodeMirror(t,p),{constructed:{_top:i,_relative:l,_toolBar:s.element,_toolbarShadow:o,_menuTray:s._menuTray,_editorArea:c,_wysiwygArea:h,_codeArea:p,_placeholder:g,_resizingBar:m,_navigation:f,_charWrapper:_,_charCounter:b,_loading:v,_lineBreaker:y,_lineBreaker_t:C,_lineBreaker_b:w,_resizeBack:x,_stickyDummy:r,_arrow:a},options:t,plugins:s.plugins,pluginCallButtons:s.pluginCallButtons,_responsiveButtons:s.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n){this._initOptions(t.element.originElement,e);const i=t.element,l=i.relative,s=i.editorArea,o=e.toolbarContainer&&e.toolbarContainer!==n.toolbarContainer,a=e.lang!==n.lang||e.buttonList!==n.buttonList||e.mode!==n.mode||o,r=this._createToolBar(document,a?e.buttonList:n.buttonList,e.plugins,e);r.pluginCallButtons.math&&this._checkKatexMath(e.katex);const c=document.createElement("DIV");c.className="se-arrow",a&&(r.element.style.visibility="hidden",o?(e.toolbarContainer.appendChild(r.element),i.toolbar.parentElement.removeChild(i.toolbar)):i.toolbar.parentElement.replaceChild(r.element,i.toolbar),i.toolbar=r.element,i._menuTray=r._menuTray,i._arrow=c);const d=this._initElements(e,i.topArea,a?r.element:i.toolbar,c),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;return i.resizingBar&&L.removeItem(i.resizingBar),u.resizingBar&&(e.resizingBarContainer&&e.resizingBarContainer!==n.resizingBarContainer?e.resizingBarContainer.appendChild(u.resizingBar):l.appendChild(u.resizingBar)),s.innerHTML="",s.appendChild(p),g&&s.appendChild(g),p=this._checkCodeMirror(e,p),i.resizingBar=u.resizingBar,i.navigation=u.navigation,i.charWrapper=u.charWrapper,i.charCounter=u.charCounter,i.wysiwygFrame=h,i.code=p,i.placeholder=g,e.rtl?L.addClass(i.topArea,"se-rtl"):L.removeClass(i.topArea,"se-rtl"),{callButtons:r.pluginCallButtons,plugins:r.plugins,toolbar:r}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");if(l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe)l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame,l.className+=e.className;else{l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto");for(let t in e.iframeAttributes)l.setAttribute(t,e.iframeAttributes[t]);l.className+=" "+e._editableClass,l.style.cssText=e._editorStyles.frame+e._editorStyles.editor,l.className+=e.className}const s=document.createElement("TEXTAREA");s.className="se-wrapper-inner se-wrapper-code"+e.className,s.style.cssText=e._editorStyles.frame,s.style.display="none","auto"===e.height&&(s.style.overflow="hidden");let o=null,a=null,r=null,c=null;if(e.resizingBar&&(o=document.createElement("DIV"),o.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",o.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}o.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:o,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:s,placeholder:d}},_initOptions:function(e,t){const n={};if(t.plugins){const e=t.plugins,i=e.length?e:Object.keys(e).map((function(t){return e[t]}));for(let e,t=0,l=i.length;t0?t.defaultTag:"p";const i=t.textTags=[{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",sub:"SUB",sup:"SUP"},t.textTags||{}].reduce((function(e,t){for(let n in t)e[n]=t[n];return e}),{});t._textTagsMap={strong:i.bold.toLowerCase(),b:i.bold.toLowerCase(),u:i.underline.toLowerCase(),ins:i.underline.toLowerCase(),em:i.italic.toLowerCase(),i:i.italic.toLowerCase(),del:i.strike.toLowerCase(),strike:i.strike.toLowerCase(),s:i.strike.toLowerCase(),sub:i.sub.toLowerCase(),sup:i.sup.toLowerCase()},t._defaultCommand={bold:t.textTags.bold,underline:t.textTags.underline,italic:t.textTags.italic,strike:t.textTags.strike,subscript:t.textTags.sub,superscript:t.textTags.sup};t.tagsBlacklist=t.tagsBlacklist||"",t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",t._editorTagsWhitelist="*"===t.addTagsWhitelist?"*":this._setWhitelist(t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.tagsBlacklist),t.pasteTagsBlacklist=t.tagsBlacklist+(t.tagsBlacklist&&t.pasteTagsBlacklist?"|"+t.pasteTagsBlacklist:t.pasteTagsBlacklist||""),t.pasteTagsWhitelist="*"===t.pasteTagsWhitelist?"*":this._setWhitelist("string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.pasteTagsBlacklist),t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.attributesBlacklist=t.attributesBlacklist&&"object"==typeof t.attributesBlacklist?t.attributesBlacklist:null,t.mode=t.mode||"classic",t.rtl=!!t.rtl,t.lineAttrReset="string"==typeof t.lineAttrReset&&t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):null,t._editableClass="sun-editor-editable"+(t.rtl?" se-rtl":""),t._printClass="string"==typeof t._printClass?t._printClass:null,t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer="string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.hideToolbar=!!t.hideToolbar,t.fullScreenOffset=void 0===t.fullScreenOffset?0:/^\d+/.test(t.fullScreenOffset)?L.getNumber(t.fullScreenOffset,0):0,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||!!t.iframe,t.iframeAttributes=t.iframeAttributes||{},t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.previewTemplate="string"==typeof t.previewTemplate?t.previewTemplate:null,t.printTemplate="string"==typeof t.printTemplate?t.printTemplate:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.mathFontSize=t.mathFontSize?t.mathFontSize:[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.resizeEnable=void 0===t.resizeEnable||!!t.resizeEnable,t.resizingBarContainer="string"==typeof t.resizingBarContainer?document.querySelector(t.resizingBarContainer):t.resizingBarContainer,t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.className="string"==typeof t.className&&t.className.length>0?" "+t.className:"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim().toLowerCase()||"px",t.alignItems="object"==typeof t.alignItems?t.alignItems:t.rtl?["right","center","left","justify"]:["left","center","right","justify"],t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageAlignShow=void 0===t.imageAlignShow||!!t.imageAlignShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.imageGalleryHeader=t.imageGalleryHeader||null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoAlignShow=void 0===t.videoAlignShow||!!t.videoAlignShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.linkTargetNewWindow=!!t.linkTargetNewWindow,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.linkRel=Array.isArray(t.linkRel)?t.linkRel:[],t.linkRelDefault=t.linkRelDefault||{},t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)?t.shortcutsDisable:[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.mediaAutoSelect=void 0===t.mediaAutoSelect||!!t.mediaAutoSelect,t.buttonList=t.buttonList?t.buttonList:[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.rtl&&(t.buttonList=t.buttonList.reverse()),t.icons=t.icons&&"object"==typeof t.icons?[S,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):S,t.icons=t.rtl?[t.icons,t.icons.rtl].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):t.icons,t.__listCommonStyle=t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"],t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_setWhitelist:function(e,t){if("string"!=typeof t)return e;t=t.split("|"),e=e.split("|");for(let n,i=0,l=t.length;i-1&&e.splice(n,1);return e.join("|")},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=L.isOSX_IOS?"⇧":"+SHIFT",s=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent","save"],o=e.rtl?["[","]"]:["]","["],a=e.rtl?[t.outdent,t.indent]:[t.indent,t.outdent];return{bold:["",n.toolbar.bold+''+(s.indexOf("bold")>-1?"":i+'+B')+"","bold","",t.bold],underline:["",n.toolbar.underline+''+(s.indexOf("underline")>-1?"":i+'+U')+"","underline","",t.underline],italic:["",n.toolbar.italic+''+(s.indexOf("italic")>-1?"":i+'+I')+"","italic","",t.italic],strike:["",n.toolbar.strike+''+(s.indexOf("strike")>-1?"":i+l+'+S')+"","strike","",t.strike],subscript:["",n.toolbar.subscript,"SUB","",t.subscript],superscript:["",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["",n.toolbar.indent+''+(s.indexOf("indent")>-1?"":i+'+'+o[0]+"")+"","indent","",a[0]],outdent:["",n.toolbar.outdent+''+(s.indexOf("indent")>-1?"":i+'+'+o[1]+"")+"","outdent","",a[1]],fullScreen:["se-code-view-enabled se-resizing-enabled",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled",n.toolbar.codeView,"codeView","",t.code_view],undo:["",n.toolbar.undo+''+(s.indexOf("undo")>-1?"":i+'+Z')+"","undo","",t.undo],redo:["",n.toolbar.redo+''+(s.indexOf("undo")>-1?"":i+'+Y / '+i+l+'+Z')+"","redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],dir:["",n.toolbar[e.rtl?"dir_ltr":"dir_rtl"],"dir","",t[e.rtl?"dir_ltr":"dir_rtl"]],dir_ltr:["",n.toolbar.dir_ltr,"dir_ltr","",t.dir_ltr],dir_rtl:["",n.toolbar.dir_rtl,"dir_rtl","",t.dir_rtl],save:["se-resizing-enabled",n.toolbar.save+''+(s.indexOf("save")>-1?"":i+'+S')+"","save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",e.rtl?t.align_right:t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,s,o){const a=L.createElement("LI"),r=L.createElement("BUTTON"),c=t||n;return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("aria-label",c.replace(//,"")),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=o[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+c+"",s&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const s=e.createElement("DIV");s.className="se-toolbar sun-editor-common";const o=e.createElement("DIV");o.className="se-btn-tray",s.appendChild(o),t=JSON.parse(JSON.stringify(t));const a=i.icons,r=this._defaultButtons(i),c={},d=[];let u=null,h=null,g=null,p=null,m="",f=!1;const _=L.createElement("DIV");_.className="se-toolbar-more-layer";e:for(let i,s,b,v,y,C=0;C",_.appendChild(s),s=s.firstElementChild.firstElementChild)}if(f){const e=l.cloneNode(!1);o.appendChild(e)}o.appendChild(g.div),f=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",o.appendChild(t),f=!1}switch(o.children.length){case 0:o.style.display="none";break;case 1:L.removeClass(o.firstElementChild,"se-btn-module-border");break;default:if(i.rtl){const e=l.cloneNode(!1);e.style.float=o.lastElementChild.style.float,o.appendChild(e)}}d.length>0&&d.unshift(t),_.children.length>0&&o.appendChild(_);const b=e.createElement("DIV");b.className="se-menu-tray",s.appendChild(b);const v=e.createElement("DIV");return v.className="se-toolbar-cover",s.appendChild(v),i.hideToolbar&&(s.style.display="none"),{element:s,plugins:n,pluginCallButtons:c,responsiveButtons:d,_menuTray:b,_buttonTray:o}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_toolbarShadow:t._toolbarShadow,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector('[data-command="bold"]'),underline:t._toolBar.querySelector('[data-command="underline"]'),italic:t._toolBar.querySelector('[data-command="italic"]'),strike:t._toolBar.querySelector('[data-command="strike"]'),sub:t._toolBar.querySelector('[data-command="SUB"]'),sup:t._toolBar.querySelector('[data-command="SUP"]'),undo:t._toolBar.querySelector('[data-command="undo"]'),redo:t._toolBar.querySelector('[data-command="redo"]'),save:t._toolBar.querySelector('[data-command="save"]'),outdent:t._toolBar.querySelector('[data-command="outdent"]'),indent:t._toolBar.querySelector('[data-command="indent"]'),fullScreen:t._toolBar.querySelector('[data-command="fullScreen"]'),showBlocks:t._toolBar.querySelector('[data-command="showBlocks"]'),codeView:t._toolBar.querySelector('[data-command="codeView"]'),dir:t._toolBar.querySelector('[data-command="dir"]'),dir_ltr:t._toolBar.querySelector('[data-command="dir_ltr"]'),dir_rtl:t._toolBar.querySelector('[data-command="dir_rtl"]')},options:n,option:n}},z={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},M={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=B.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,s){const o=e.element.originElement.ownerDocument||document,a=o.defaultView||window,r=L,c=l.icons,d={_d:o,_w:a,_parser:new a.DOMParser,_prevRtl:l.rtl,_editorHeight:0,_editorHeightPadding:0,_listCamel:l.__listCommonStyle,_listKebab:r.camelToKebabCase(l.__listCommonStyle),_wd:null,_ww:null,_shadowRoot:null,_shadowRootControllerEventTarget:null,util:r,functions:null,options:null,wwComputedStyle:null,notice:z,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:[],resizingDisabledButtons:[],_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_htmlCheckBlacklistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,editorTagsBlacklistRegExp:null,pasteTagsWhitelistRegExp:null,pasteTagsBlacklistRegExp:null,hasFocus:!1,isDisabled:!1,isReadOnly:!1,_attributesWhitelistRegExp:null,_attributesWhitelistRegExp_all_data:null,_attributesBlacklistRegExp:null,_attributesTagsWhitelist:null,_attributesTagsBlacklist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:{},_commandMapStyles:{STRONG:["font-weight"],U:["text-decoration"],EM:["font-style"],DEL:["text-decoration"]},_styleCommandMap:null,_cleanStyleRegExp:{span:new a.RegExp("\\s*[^-a-zA-Z](font-family|font-size|color|background-color)\\s*:[^;]+(?!;)*","ig"),format:new a.RegExp("\\s*[^-a-zA-Z](text-align|margin-left|margin-right)\\s*:[^;]+(?!;)*","ig"),fontSizeUnit:new a.RegExp("\\d+"+l.fontSizeUnit+"$","i")},_variable:{isChanged:!1,isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:2,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},_formatAttrsTemp:null,_saveButtonStates:function(){this.allCommandButtons||(this.allCommandButtons={});const e=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let t,n,i=0;ie?c-e:0,l=i>0?0:e-c;n.style.left=d-i+l+"px",o.left>u._getEditorOffsets(n).left&&(n.style.left="0px")}else{const e=s<=c?0:s-(d+c);n.style.left=e<0?d+e+"px":d+"px"}let h=0,g=t;for(;g&&g!==i;)h+=g.offsetTop,g=g.offsetParent;const p=h;this._isBalloon?h+=i.offsetTop+t.offsetHeight:h-=t.offsetHeight;const m=o.top,f=n.offsetHeight,_=this.getGlobalScrollOffset().top,b=a.innerHeight-(m-_+p+t.parentElement.offsetHeight);if(bb?(n.style.height=l+"px",e=-1*(l-p+3)):(n.style.height=b+"px",e=p+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=p+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0)for(let e=0;e0){for(let e=0;eu?d-u:0,i=n>0?0:u-d;t.style.left=c-n+i+"px",n>0&&h&&(h.style.left=(d-14<10+n?d-14:10+n)+"px");const l=e.element.wysiwygFrame.offsetLeft-t.offsetLeft;l>0&&(t.style.left="0px",h&&(h.style.left=l+"px"))}else{t.style.left=c+"px";const n=e.element.wysiwygFrame.offsetWidth-(t.offsetLeft+d);n<0?(t.style.left=t.offsetLeft+n+"px",h&&(h.style.left=20-n+"px")):h&&(h.style.left="20px")}t.style.visibility=""},execCommand:function(e,t,n){this._wd.execCommand(e,t,"formatBlock"===e?"<"+n+">":n),this.history.push(!0)},nativeFocus:function(){this.__focus(),this._editorRange()},__focus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const n=t.commonAncestorContainer.children[t.startOffset];if(!r.isFormatElement(n)&&!r.isComponent(n)){const t=r.createElement(l.defaultTag),i=r.createElement("BR");return t.appendChild(i),e.element.wysiwyg.insertBefore(t,n),void this.setRange(i,0,i,0)}}this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},blur:function(){l.iframe?e.element.wysiwygFrame.blur():e.element.wysiwyg.blur()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length),r.isFormatElement(e)&&(e=e.childNodes[t]||e.childNodes[t-1]||e,t=t>0?1===e.nodeType?1:e.textContent?e.textContent.length:0:0),r.isFormatElement(n)&&(n=n.childNodes[i]||n.childNodes[i-1]||n,i=i>0?1===n.nodeType?1:n.textContent?n.textContent.length:0:0);const s=this._wd.createRange();try{s.setStart(e,t),s.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const o=this.getSelection();return o.removeAllRanges&&o.removeAllRanges(),o.addRange(s),this._rangeInfo(s,this.getSelection()),l.iframe&&this.__focus(),s},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.hasFocus&&this.getSelection().removeAllRanges(),this._setKeyEffect([])},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,s=r.compareElements(e,t),o=s.ancestor&&(0===s.result?i<=l:s.result>1);return this.setRange(o?e:t,o?i:l,o?t:e,o?l:i)}},getRange_addLine:function(t,n){if(this._selectionVoid(t)){const i=e.element.wysiwyg,s=r.createElement(l.defaultTag);s.innerHTML="
    ",i.insertBefore(s,n&&n!==i?n.nextElementSibling:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){const t=this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection();return this._variable._range||e.element.wysiwyg.contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t},getSelectionNode:function(){if(e.element.wysiwyg.contains(this._variable._selectionNode)||this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),r.isFormatElement(t.endContainer)&&0===t.endOffset&&(t=this.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.length)),this._rangeInfo(t,e)},_rangeInfo:function(e,t){let n=null;this._variable._range=e,n=e.collapsed?r.isWysiwygDiv(e.commonAncestorContainer)&&e.commonAncestorContainer.children[e.startOffset]||e.commonAncestorContainer:t.extentNode||t.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg,n=this._wd.createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=r.createElement("BR"),i.appendChild(s))):(i=r.createElement(l.defaultTag),s=r.createElement("BR"),i.appendChild(s),t.appendChild(i)),n.setStart(s,0),n.setEnd(s,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,s,o=t.startContainer,a=t.startOffset,c=t.endContainer,d=t.endOffset;if(r.isFormatElement(o))for(o.childNodes[a]?(o=o.childNodes[a]||o,a=0):(o=o.lastChild||o,a=o.textContent.length);o&&1===o.nodeType&&o.firstChild;)o=o.firstChild||o,a=0;if(r.isFormatElement(c)){for(c=c.childNodes[d]||c.lastChild||c;c&&1===c.nodeType&&c.lastChild;)c=c.lastChild;d=c.textContent.length}if(n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=a,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===c&&(c=n,d=1)}}if(o=n,a=i,n=r.isWysiwygDiv(c)?e.element.wysiwyg.lastChild:c,i=d,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(s=n.childNodes,0!==s.length);)n=s[i>0?i-1:i]||!/FIGURE/i.test(s[0].nodeName)?s[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(c)}}return c=n,d=i,this.setRange(o,a,c,d),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,s=n.commonAncestorContainer,o=r.getListChildren(s,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(s)||r.isRangeFormatElement(s)||o.unshift(r.getFormatElement(s,null)),i===l||1===o.length)return o;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=o.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t,n){return"end"!==n&&0===t||(!n||"front"!==n)&&!e.nodeValue&&1===t||(!n||"end"===n)&&!!e.nodeValue&&t===e.nodeValue.length},_isEdgeFormat:function(e,t,n){if(!this.isEdgePoint(e,t,n))return!1;const i=[];for(n="front"===n?"previousSibling":"nextSibling";e&&!r.isFormatElement(e)&&!r.isWysiwygDiv(e);){if(e[n]&&(!r.isBreak(e[n])||e[n][n]))return null;1===e.nodeType&&i.push(e.cloneNode(!1)),e=e.parentNode}return i},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){if(!e||!e.parentNode)return null;const n=r.getFormatElement(this.getSelectionNode(),null);let i=null;if(!r.isFormatElement(e)&&r.isFreeFormatElement(n||e.parentNode))i=r.createElement("BR");else{const e=t?"string"==typeof t?t:t.nodeName:!r.isFormatElement(n)||r.isRangeFormatElement(n)||r.isFreeFormatElement(n)?l.defaultTag:n.nodeName;i=r.createElement(e),i.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(i,t||n,["id"])}return r.isCell(e)?e.insertBefore(i,e.nextElementSibling):e.parentNode.insertBefore(i,e.nextElementSibling),i},insertComponent:function(e,t,n,i){if(this.isReadOnly||n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange(),l.container);let s=null,o=this.getSelectionNode(),a=r.getFormatElement(o,null);if(r.isListCell(a))this.insertNode(e,o===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));s=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),s&&(a=s.previousSibling)}this.insertNode(e,r.isRangeFormatElement(a)?null:a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){this.setRange(e,0,e,0);const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):s&&(s=r.getEdgeChildNodes(s,null).sc||s,this.setRange(s,0,s,0))}return t||this.history.push(1),s||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){if(r.isUneditableComponent(r.getParentElement(e,r.isComponent))||r.isUneditableComponent(e))return!1;this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,s="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,o=r.isListCell(n.parentNode);let a,c,d;(o?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(s).left+d+"px",i.display="block"),(o?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2),l.top=a+s.offsetHeight-c-12+"px",l.left=r.getOffset(s).left+s.offsetWidth-d-24+"px",l.display="block")},_checkDuplicateNode:function(e,t){!function e(n){d._dupleCheck(n,t);const i=n.childNodes;for(let t=0,n=i.length;t-1&&n.splice(e,1);for(let t=0,n=s.classList.length;t_?m.splitText(_):m.nextSibling;else if(r.isBreak(s))n=s,s=s.parentNode;else{let e=s.childNodes[f];const i=e&&3===e.nodeType&&r.onlyZeroWidthSpace(e)&&r.isBreak(e.nextSibling)?e.nextSibling:e;i?!i.nextSibling&&r.isBreak(i)?(s.removeChild(i),n=null):n=r.isBreak(i)&&!r.isBreak(t)?i:i.nextSibling:n=null}else{if(v===y){n=this.isEdgePoint(y,_)?y.nextSibling:y.splitText(_);let e=v;this.isEdgePoint(v,f)||(e=v.splitText(f)),s.removeChild(e),0===s.childNodes.length&&p&&(s.innerHTML="
    ")}else{const e=this.removeNode(),i=e.container,o=e.prevContainer;if(i&&0===i.childNodes.length&&p&&(r.isFormatElement(i)?i.innerHTML="
    ":r.isRangeFormatElement(i)&&(i.innerHTML="<"+l.defaultTag+">
    ")),r.isListCell(i)&&3===t.nodeType)s=i,n=null;else if(!p&&o)if(s=3===o.nodeType?o.parentNode:o,s.contains(i)){let e=!0;for(n=i;n.parentNode&&n.parentNode!==s;)n=n.parentNode,e=!1;e&&i===o&&(n=n.nextSibling)}else n=null;else r.isWysiwygDiv(i)&&!r.isFormatElement(t)?(s=i.appendChild(r.createElement(l.defaultTag)),n=null):s=(n=p?y:i===o?i.nextSibling:i)&&n.parentNode?n.parentNode:m;for(;n&&!r.isFormatElement(n)&&n.parentNode!==m;)n=n.parentNode}}try{if(!u){if((r.isWysiwygDiv(n)||s===e.element.wysiwyg.parentNode)&&(s=e.element.wysiwyg,n=null),r.isFormatElement(t)||r.isRangeFormatElement(t)||!r.isListCell(s)&&r.isComponent(t)){const e=s;if(r.isList(n))s=n,n=null;else if(r.isListCell(n))s=n.previousElementSibling||n;else if(!o&&!n){const e=this.removeNode(),t=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(t)||r.isRangeFormatElement(t);s=i?t:t.parentNode,n=i?null:t.nextSibling}0===e.childNodes.length&&s!==e&&r.removeItem(e)}if(!p||g||r.isRangeFormatElement(s)||r.isListCell(s)||r.isWysiwygDiv(s)||(n=s.nextElementSibling,s=s.parentNode),r.isWysiwygDiv(s)&&(3===t.nodeType||r.isBreak(t))){const e=r.createElement(l.defaultTag);e.appendChild(t),t=e}}if(u?h.parentNode?(s=h,n=a):(s=e.element.wysiwyg,n=null):n=s===n?s.lastChild:n,r.isListCell(t)&&!r.isList(s)){if(r.isListCell(s))n=s.nextElementSibling,s=s.parentNode;else{const e=r.createElement("ol");s.insertBefore(e,n),s=e,n=null}u=!0}if(this._checkDuplicateNode(t,s),s.insertBefore(t,n),u)if(r.onlyZeroWidthSpace(d.textContent.trim()))r.removeItem(d),t=t.lastChild;else{const e=r.getArrayItem(d.children,r.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(s.appendChild(t),t=s),r.onlyZeroWidthSpace(d.textContent.trim())&&r.removeItem(d))}}catch(e){s.appendChild(t),console.warn("[SUNEDITOR.insertNode.warn] "+e)}finally{const e=s.querySelectorAll("[data-se-duple]");if(e.length>0)for(let n,i,l,s,o=0,a=e.length;o0&&(t.textContent=i+t.textContent,r.removeItem(e)),n&&n.length>0&&(t.textContent+=l,r.removeItem(n));const s={container:t,startOffset:i.length,endOffset:t.textContent.length-l.length};return this.setRange(t,s.startOffset,t,s.endOffset),s}if(!r.isBreak(t)&&!r.isListCell(t)&&r.isFormatElement(s)){let n=null;t.previousSibling&&!r.isBreak(t.previousSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t)),t.nextSibling&&!r.isBreak(t.nextSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t.nextSibling)),r._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0)}this.setRange(t,e,t,e)}return this.history.push(!0),t}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode();const t=this.getRange();let n,i=0,l=t.startContainer,s=t.endContainer,o=t.startOffset,a=t.endOffset;const c=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===l.parentNode?l.parentNode:t.commonAncestorContainer;if(c===l&&c===s&&(l=c.children[o],s=c.children[a],o=a=0),!l||!s)return{container:c,offset:0};if(l===s&&t.collapsed&&l.textContent&&r.onlyZeroWidthSpace(l.textContent.substr(o)))return{container:l,offset:o,prevContainer:l&&l.parentNode?l:null};let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,s);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===o&&(g=e,t=t.parentNode);for(let e=p-1,t=s;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};if(3===c.nodeType)return{container:c,offset:a};h.push(c),l=s=c}else if(l=s=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:r.isMedia(c)?c:l,offset:0};g=p=0}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)this._nodeRemoveListItem(t);else if(t!==l)if(t!==s)this._nodeRemoveListItem(t);else{if(1===s.nodeType){if(r.isComponent(s))continue;u=r.createTextNode(s.textContent)}else u=r.createTextNode(s.substringData(a,s.length-a));u.length>0?s.data=u.data:this._nodeRemoveListItem(s)}else{if(1===l.nodeType){if(r.isComponent(l))continue;d=r.createTextNode(l.textContent)}else t===s?(d=r.createTextNode(l.substringData(0,o)+s.substringData(a,s.length-a)),i=o):d=r.createTextNode(l.substringData(0,o));if(d.length>0?l.data=d.data:this._nodeRemoveListItem(l),t===s)break}}const m=r.getParentElement(s,"ul"),f=r.getParentElement(l,"li");if(m&&f&&f.contains(m)?(n=m.previousSibling,i=n.textContent.length):n=s&&s.parentNode?s:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)&&0===n.childNodes.length){const t=r.removeItemAllParents(n,null,null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},_nodeRemoveListItem:function(e){const t=r.getFormatElement(e,null);r.removeItem(e),r.isListCell(t)&&(r.removeItemAllParents(t,null,null),t&&r.isList(t.firstChild)&&t.insertBefore(r.createTextNode(r.zeroWidthSpace),t.firstChild))},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange(),null);const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,s,o,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,s=t.indexOf(i),o=t.indexOf(l),t.splice(s,o-s+1),c=t.length}else;let n,i,l,s=t[t.length-1];n=r.isRangeFormatElement(s)||r.isFormatElement(s)?s:r.getRangeFormatElement(s,null)||r.getFormatElement(s,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let o=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,s,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],s=n.parentNode,s&&!e.contains(s))if(u=r.getElementDepth(n),r.isList(s)){if(null===a&&(p?(a=p,m=!0,p=null):a=s.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==s){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=s.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(s,c,null,!0,!0);o>=u?(o=u,l=_.cc,i=d(l,s,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(o=u,l=s,i=n.nextSibling),e.appendChild(n),l!==s&&(h=d(l,s),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,s){const o=this.getRange();let a=o.startOffset,c=o.endOffset,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),u=e.parentNode,h=null,g=null,p=e.cloneNode(!1);const m=[],f=r.isList(n);let _=!1,b=!1,v=!1;function y(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace,a=c=1),3===n.nodeType)return t.insertBefore(n,i),n;const s=(v?n:l).childNodes;let o=n.cloneNode(!1),d=null,u=null;for(;s[0];)u=s[0],!r._notTextNode(u)||r.isBreak(u)||r.isListCell(o)?o.appendChild(u):(o.childNodes.length>0&&(d||(d=o),t.insertBefore(o,i),o=n.cloneNode(!1)),t.insertBefore(u,i),d||(d=u));if(o.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(o)&&r.isList(i))if(f){for(d=i;i;)o.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(o,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=o.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,b=!0}}else t.insertBefore(o,i);d||(d=o)}return d}for(let s,o,a,c=0,C=d.length;c0&&(u.insertBefore(p,e),p=null),!f&&r.isListCell(s))if(a&&r.getElementDepth(s)!==r.getElementDepth(a)&&(r.isListCell(u)||r.getArrayItem(s.children,r.isList,!1))){const t=s.nextElementSibling,n=r.detachNestedList(s,!1);e===n&&t===s.nextElementSibling||(e=n,b=!0)}else{const t=s;s=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":l.defaultTag);const n=r.isListCell(s),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)s.appendChild(o[0]);r.copyFormatAttributes(s,t),v=!0}else s=s.cloneNode(!1);if(!b&&(i?(m.push(s),r.removeItem(d[c])):(n?(_||(u.insertBefore(n,e),_=!0),s=y(n,s,null,d[c])):s=y(u,s,e,d[c]),b||(t?(g=s,h||(h=s)):h||(h=g=s))),b)){b=v=!1,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),p=e.cloneNode(!1),u=e.parentNode,c=-1,C=d.length;continue}}const C=e.parentNode;let w=e.nextSibling;p&&p.children.length>0&&C.insertBefore(p,w),n?h=n.previousSibling:h||(h=e.previousSibling),w=e.nextSibling!==p?e.nextSibling:p?p.nextSibling:null,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null,!1);let x=null;if(i)x={cc:C,sc:h,so:a,ec:w,eo:c,removeArray:m};else{h||(h=g),g||(g=h);const e=r.getEdgeChildNodes(h,g.parentNode?h:g);x={cc:(e.sc||e.ec).parentNode,sc:e.sc,so:a,ec:e.ec,eo:c,removeArray:null}}if(this.effectNode=null,s)return x;!i&&x&&(t?this.setRange(x.sc,a,x.ec,c):this.setRange(x.sc,0,x.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,s=null,o=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const s=!e,o=s&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(o&&l.collapsed&&r.isFormatElement(c.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c)){const e=c.parentNode;if(!r.isListCell(e)||!r.getValues(e.style).some(function(e){return this._listKebab.indexOf(e)>-1}.bind(this)))return}if(l.collapsed&&!o&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),s&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!o&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!s||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=o||s&&function(e){for(let t=0,n=e.length;t0&&this._resetCommonListCell(E[N],t)&&(n=!0),this._resetCommonListCell(E[0],t)&&(n=!0),n&&this.setRange(c,d,u,h),N>0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,o,s,w,L,B));for(let n,i=N-1;i>0;i--)this._resetCommonListCell(E[i],t),m=e.cloneNode(!1),n=this._nodeChange_middleLine(E[i],m,x,o,s,w,_.container),n.endContainer&&n.ancestor.contains(n.endContainer)&&(_.ancestor=null,_.container=n.endContainer),this._setCommonListStyle(n.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,o,s,w,L,B,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_resetCommonListCell:function(e,t){if(!r.isListCell(e))return;t||(t=this._listKebab);const n=r.getArrayItem(e.childNodes,(function(e){return!r.isBreak(e)}),!0),i=e.style,s=[],o=[],a=r.getValues(i);for(let e=0,n=this._listKebab.length;e-1&&t.indexOf(this._listKebab[e])>-1&&(s.push(this._listCamel[e]),o.push(this._listKebab[e]));if(!s.length)return;const c=r.createElement("SPAN");for(let e=0,t=s.length;e0&&(e.insertBefore(d,u),d=c.cloneNode(!1),u=null,h=!0));return d.childNodes.length>0&&(e.insertBefore(d,u),h=!0),i.length||e.removeAttribute("style"),h},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)}),!0);if(!(t=n[0])||n.length>1||1!==t.nodeType)return;const i=t.style,s=e.style,o=t.nodeName.toLowerCase();let a=!1;l._textTagsMap[o]===l._defaultCommand.bold.toLowerCase()&&(s.fontWeight="bold"),l._textTagsMap[o]===l._defaultCommand.italic.toLowerCase()&&(s.fontStyle="italic");const c=r.getValues(i);if(c.length>0)for(let e=0,t=this._listCamel.length;e-1&&(s[this._listCamel[e]]=i[this._listCamel[e]],i.removeProperty(this._listKebab[e]),a=!0);if(this._setCommonListStyle(e,t),a&&!i.length){const e=t.childNodes,n=t.parentNode,i=t.nextSibling;for(;e.length>0;)n.insertBefore(e[0],i);r.removeItem(t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,s,o,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===s.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(s.textContent.slice(o))){const n=m.childNodes;let a=!0;for(let e,t,l,o,c=0,d=n.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o=N?k-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(s)||l.appendChild(s);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||o;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=o,N=0,L=!0,C!==o&&C.appendChild(S),!v)continue}if(B||a!==T){if(L){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const s=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=B?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||s.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(s);const o=y.pop()||a;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!p(t.parentNode)||p(o)||r.onlyZeroWidthSpace(t)||(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),B||E||!p(o))o===a?l=B?b:t:B?(b.appendChild(o),l=C):(t.appendChild(o),l=C);else{t=t.cloneNode(!1);const e=o.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(k,T.length-k)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,k));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const s=y.pop()||l;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(s),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(s),T=l,k=l.data.length,B=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:s,endOffset:o};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t,!1),u&&(N=S.textContent.length,k=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),k=M?T.textContent.length:k;const I={s:0,e:0},H=r.getNodePath(S,b,I),R=!T.parentNode;R&&(T=S);const O={s:0,e:0},D=r.getNodePath(T,b,R||M?null:O);N+=I.s,k=u?N:R?S.textContent.length:M?k+I.s:k+O.s;const F=r.mergeSameTags(b,[H,D],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(H,b),T=r.getNodeFromPath(D,b),{ancestor:b,startContainer:S,startOffset:N+F[0],endContainer:T,endOffset:k+F[1]}},_nodeChange_startLine:function(e,t,n,i,l,s,o,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!o&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,s=i.previousSibling;for(;s;){if(!r.onlyZeroWidthSpace(s)){n=!1;break}s=s.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const s=i.childNodes;for(let i,o,a=0,h=s.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=o,C=0,w=!0,l.appendChild(y)}}}(e,m),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(s=s&&o)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}s.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const s=i.childNodes;for(let i,u,h=0,g=s.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,o&&g.contains(o)){const e=r.getNodePath(o,g);o=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!s.v)return{ancestor:e,endContainer:o};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else o?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),s=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const o=m.pop()||l;for(_=f=o;m.length>0;)f=m.pop(),_.appendChild(f),_=f;o!==l?(t.insertBefore(o,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=s,y=s.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l};if(s=s&&o)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,this._commandMapStyles[n]||null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],s="indent"!==e,o=l.rtl?"marginRight":"marginLeft";let a=t.startContainer,c=t.endContainer,d=t.startOffset,u=t.endOffset;for(let e,t,l=0,a=n.length;l0&&this.plugins.list.editInsideList.call(this,s,i),this.effectNode=null,this.setRange(a,d,c,u),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(r.isNonEditable(e.element.wysiwygFrame)||this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),r.isNonEditable(e.element.wysiwygFrame)||(this.history.push(!1),this.history._resetCachingButton())):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable.isFullScreen?e.element.code.style.height="100%":"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),this.isReadOnly&&r.setDisabledButtons(!0,this.resizingDisabledButtons),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"<"+l.defaultTag+">
    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg,!1);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,s=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff();const m="none"===i.style.display||this._isInline&&!this._inlineToolbarAttr.isShow;p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",s.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,o.body.style.overflow=p._bodyOverflow,"auto"!==l.height||l.codeMirrorEditor||u._codeViewAutoHeight(),l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),t&&r.changeElement(t.firstElementChild,c.expansion),e.element.topArea.style.marginTop="",r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,s),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=o.body.style.overflow,o.body.style.overflow="hidden",p._editorAreaOriginCssText=s.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,s.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+l._editorStyles.editor,g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,s.style.height=p.innerHeight_fullScreen-l.fullScreenOffset+"px",t&&r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(s.style.overflow="auto",this._iframeAutoHeight()),e.element.topArea.style.marginTop=l.fullScreenOffset+"px",r.addClass(this._styleCommandMap.fullScreen,"active")),m&&h.toolbar.hide(),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",o.body.appendChild(e);const t=l.printTemplate?l.printTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),n=r.getIframeDocument(e),i=this._wd;if(l.iframe){const e=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="'+l._editableClass+'"';n.write(""+i.head.innerHTML+""+t+"")}else{const e=o.head.getElementsByTagName("link"),i=o.head.getElementsByTagName("style");let s="";for(let t=0,n=e.length;t"+s+''+t+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||r.isChromium||o.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const e=l.previewTemplate?l.previewTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),t=a.open("","_blank");t.mimeType="text/html";const n=this._wd;if(l.iframe){const i=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(n.body,["contenteditable"]):'class="'+l._editableClass+'"';t.document.write(""+n.head.innerHTML+""+e+"")}else{const n=o.head.getElementsByTagName("link"),s=o.head.getElementsByTagName("style");let a="";for(let e=0,t=n.length;e'+i.toolbar.preview+""+a+''+e+"")}},setDir:function(t){const n="rtl"===t,s=this._prevRtl!==n;this._prevRtl=l.rtl=n,s&&(this.plugins.align&&this.plugins.align.exchangeDir.call(this),e.tool.indent&&r.changeElement(e.tool.indent.firstElementChild,c.indent),e.tool.outdent&&r.changeElement(e.tool.outdent.firstElementChild,c.outdent));const o=e.element;n?(r.addClass(o.topArea,"se-rtl"),r.addClass(o.wysiwygFrame,"se-rtl")):(r.removeClass(o.topArea,"se-rtl"),r.removeClass(o.wysiwygFrame,"se-rtl"));const a=r.getListChildren(o.wysiwyg,(function(e){return r.isFormatElement(e)&&(e.style.marginRight||e.style.marginLeft||e.style.textAlign)}));for(let e,t,n,i=0,l=a.length;i[\s\S]*<\/script>/gi,"")),e.body&&(this._wd.body.innerHTML=this.convertContentsForEditor(e.body)),this._resetComponents()},getContents:function(t){const n=this.cleanHTML(e.element.wysiwyg.innerHTML,null,null),i=r.createElement("DIV");i.innerHTML=n;const s=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=s.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},getFullContents:function(e){return'
    '+this.getContents(e)+"
    "},_makeLine:function(e,t){const n=l.defaultTag;if(1===e.nodeType){if(r._disallowedTags(e))return"";if(/__se__tag/.test(e.className))return e.outerHTML;const i=r.getListChildNodes(e,(function(e){return r.isSpanWithoutAttr(e)&&!r.getParentElement(e,r.isNotCheckingNode)}))||[];for(let e=i.length-1;e>=0;e--)i[e].outerHTML=i[e].innerHTML;return!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML:"<"+n+">"+(r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML)+""}if(3===e.nodeType){if(!t)return r._HTMLConvertor(e.textContent);const i=e.textContent.split(/\n/g);let l="";for(let e,t=0,s=i.length;t0&&(l+="<"+n+">"+r._HTMLConvertor(e)+"");return l}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t=l._textTagsMap;return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i,l){return n+("string"==typeof t[i]?t[i]:i)+(l?" "+l:"")}))},_deleteDisallowedTags:function(e){return e=e.replace(/<(script|style)[\s\S]*>[\s\S]*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,""),/\bfont\b/i.test(this.options._editorTagsWhitelist)||(e=e.replace(/(<\/?)font(\s?)/gi,"$1span$2")),e.replace(this.editorTagsWhitelistRegExp,"").replace(this.editorTagsBlacklistRegExp,"")},_convertFontSize:function(e,t){const n=this._w.Math,i=t.match(/(\d+(?:\.\d+)?)(.+)/),l=i?1*i[1]:r.fontValueMap[t],s=i?i[2]:"rem";let o=l;switch(/em/.test(s)?o=n.round(l/.0625):"pt"===s?o=n.round(1.333*l):"%"===s&&(o=l/100),e){case"em":case"rem":case"%":return(.0625*o).toFixed(2)+e;case"pt":return n.floor(o/1.333)+e;default:return o+e}},_cleanStyle:function(e,t,n){let i=(e.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(/span/i.test(n)&&!i&&(e.match(/0&&t.push('style="'+n.join(";")+'"')}}return t},_cleanTags:function(e,t,n){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(t))return t;let i=null;const l=n.match(/(?!<)[a-zA-Z0-9\-]+/)[0].toLowerCase(),s=this._attributesTagsBlacklist[l];t=t.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),t=s?t.replace(s,""):t.replace(this._attributesBlacklistRegExp,"");const o=this._attributesTagsWhitelist[l];if(i=o?t.match(o):t.match(e?this._attributesWhitelistRegExp:this._attributesWhitelistRegExp_all_data),e||"span"===l)if("a"===l){const e=t.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);e&&(i||(i=[]),i.push(e[0]))}else i&&/style=/i.test(i.toString())||("span"===l?i=this._cleanStyle(t,i,"span"):/^(P|DIV|H[1-6]|PRE)$/i.test(l)&&(i=this._cleanStyle(t,i,"format")));else{const e=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);e&&!i?i=[e[0]]:e&&!i.some((function(e){return/^style/.test(e.trim())}))&&i.push(e[0])}if(r.isFigures(l)){let e="",n="";const l=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);if(i||(i=[]),l){i.push(l[0]);let t="",s="",o="",a="";t=l[0].match(/width:(.+)px;/),t=r.getNumber(t?t[1]:"",-1)||null,s=l[0].match(/height:(.+)px;/),s=r.getNumber(s?s[1]:"",-1)||null,o=l[0].match(/width:(.+)%;/),o=r.getNumber(o?o[1]:"",-1)||null,a=l[0].match(/height:(.+)%;/),a=r.getNumber(a?a[1]:"",-1)||null,e=t||o,n=s||a}if(!e||!n){const i=t.match(/width\s*=\s*((?:"|')[^"']*(?:"|'))/),l=t.match(/height\s*=\s*((?:"|')[^"']*(?:"|'))/);(i||l)&&(e=e||(r.getNumber(i?i[1]:"")||""),n=n||(r.getNumber(l?l[1]:"")||""))}i.push('data-origin="'+e+","+n+'"')}if(i)for(let e=0,t=i.length;e"+(n.innerHTML.trim()||"
    ")+"":r.isRangeFormatElement(n)&&!r.isTable(n)?t+=this._convertListCell(n):t+="
  • "+n.outerHTML+"
  • ":t+="
  • "+(n.textContent||"
    ")+"
  • ";return t},_isFormatData:function(e){let t=!1;for(let n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!0));const i=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(i,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!0)}catch(e){console.warn("[SUNEDITOR.cleanHTML.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=i.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!1));const t=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(t,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!1)}catch(e){console.warn("[SUNEDITOR.convertContentsForEditor.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=t.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i
    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e,t){let n="";const i=a.RegExp,l=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),s="string"==typeof e?o.createRange().createContextualFragment(e):e,c=function(e){return this.isFormatElement(e)||this.isComponent(e)}.bind(r),d=t?"":"\n";let u=t?0:1*this._variable.codeIndent;return u=u>0?new a.Array(u+1).join(" "):"",function e(t,s){const o=t.childNodes,h=l.test(t.nodeName),g=h?s:"";for(let p,m,f,_,b,v,y=0,C=o.length;y]*>","i"))[0]+m,e(p,s+u),n+=(/\n$/.test(n)?v:"")+""+(f||m||h||/^(TH|TD)$/i.test(p.nodeName)?d:"")):n+=(new a.XMLSerializer).serializeToString(p):n+=(/^HR$/i.test(p.nodeName)?d:"")+(/^PRE$/i.test(p.parentElement.nodeName)&&/^BR$/i.test(p.nodeName)?"":g)+p.outerHTML+m:r.isList(p.parentElement)||(n+=r._HTMLConvertor(/^\n+$/.test(p.data)?"":p.data)):n+="\n\x3c!-- "+p.textContent.trim()+" --\x3e"+m}(s,""),n.trim()+d},addDocEvent:function(e,t,n){o.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){o.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,s=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,s<0?0:s)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML&&1===e.nodeType?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},resetResponsiveToolbar:function(){d.controllersOff();const t=u._responsiveButtonSize;if(t){let n=0;n=(d._isBalloon||d._isInline)&&"auto"===l.toolbarWidth?e.element.topArea.offsetWidth:e.element.toolbar.offsetWidth;let i="default";for(let e=1,l=t.length;e-1||!r.hasOwn(t,l)||(i.indexOf(l)>-1?n[l].active.call(this,null):t.OUTDENT&&/^OUTDENT$/i.test(l)?r.isImportantDisabled(t.OUTDENT)||t.OUTDENT.setAttribute("disabled",!0):t.INDENT&&/^INDENT$/i.test(l)?r.isImportantDisabled(t.INDENT)||t.INDENT.removeAttribute("disabled"):r.removeClass(t[l],"active"))},_init:function(i,s){const c=a.RegExp;if(this._ww=l.iframe?e.element.wysiwygFrame.contentWindow:a,this._wd=o,this._charTypeHTML="byte-html"===l.charCounterType,this.wwComputedStyle=a.getComputedStyle(e.element.wysiwyg),this._editorHeight=e.element.wysiwygFrame.offsetHeight,this._editorHeightPadding=r.getNumber(this.wwComputedStyle.getPropertyValue("padding-top"))+r.getNumber(this.wwComputedStyle.getPropertyValue("padding-bottom")),!l.iframe&&"function"==typeof a.ShadowRoot){let t=e.element.wysiwygFrame;for(;t;){if(t.shadowRoot){this._shadowRoot=t.shadowRoot;break}if(t instanceof a.ShadowRoot){this._shadowRoot=t;break}t=t.parentNode}this._shadowRoot&&(this._shadowRootControllerEventTarget=[])}const d=a.Object.keys(l._textTagsMap),u=l.addTagsWhitelist?l.addTagsWhitelist.split("|").filter((function(e){return/b|i|ins|s|strike/i.test(e)})):[];for(let e=0;e^<]+)?\\s*(?=>)","gi");const h=function(e,t){return e?"*"===e?"[a-z-]+":t?e+"|"+t:e:"^"},g="contenteditable|colspan|rowspan|target|href|download|rel|src|alt|class|type|controls|origin-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1||"*"===l._editorTagsWhitelist,this._htmlCheckWhitelistRegExp=new c("^("+h(l._editorTagsWhitelist.replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new c("^("+(l.tagsBlacklist||"^")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(h(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e"),"")),this.editorTagsBlacklistRegExp=r.createTagsBlacklist(l.tagsBlacklist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(h(l.pasteTagsWhitelist,"")),this.pasteTagsBlacklistRegExp=r.createTagsBlacklist(l.pasteTagsBlacklist);const p='\\s*=\\s*(")[^"]*\\1',m=l.attributesWhitelist;let f={},_="";if(m)for(let e in m)r.hasOwn(m,e)&&!/^on[a-z]+$/i.test(m[e])&&("all"===e?_=h(m[e],g):f[e]=new c("\\s(?:"+h(m[e],"")+")"+p,"ig"));this._attributesWhitelistRegExp=new c("\\s(?:"+(_||g+"|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|data-exp|data-font-size")+")"+p,"ig"),this._attributesWhitelistRegExp_all_data=new c("\\s(?:"+(_||g)+"|data-[a-z0-9\\-]+)"+p,"ig"),this._attributesTagsWhitelist=f;const b=l.attributesBlacklist;if(f={},_="",b)for(let e in b)r.hasOwn(b,e)&&("all"===e?_=h(b[e],""):f[e]=new c("\\s(?:"+h(b[e],"")+")"+p,"ig"));this._attributesBlacklistRegExp=new c("\\s(?:"+(_||"^")+")"+p,"ig"),this._attributesTagsBlacklist=f,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const v=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let y,C,w=[];for(let e in n)if(r.hasOwn(n,e)){if(y=n[e],C=t[e],(y.active||y.action)&&C&&this.callPlugin(e,null,C),"function"==typeof y.checkFileInfo&&"function"==typeof y.resetFileInfo&&(this.callPlugin(e,null,C),this._fileInfoPluginsCheck.push(y.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(y.resetFileInfo.bind(this))),a.Array.isArray(y.fileTags)){const t=y.fileTags;this.callPlugin(e,null,C),this._fileManager.tags=this._fileManager.tags.concat(t),w.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&o&&o.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},getCurrentIndex:function(){return c},reset:function(n){o&&o.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){s=e.context.element,o=e.context.tool.undo,a=e.context.tool.redo,0===c?(o&&o.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([z]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,s)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-code-view-enabled"]):not([data-display="MORE"])'),this.resizingDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-resizing-enabled"]):not([data-display="MORE"])');const t=e.tool,n=this.commandMap;n.INDENT=t.indent,n.OUTDENT=t.outdent,n[l.textTags.bold.toUpperCase()]=t.bold,n[l.textTags.underline.toUpperCase()]=t.underline,n[l.textTags.italic.toUpperCase()]=t.italic,n[l.textTags.strike.toUpperCase()]=t.strike,n[l.textTags.sub.toUpperCase()]=t.subscript,n[l.textTags.sup.toUpperCase()]=t.superscript,this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView},this._saveButtonStates()},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){this.hasFocus&&u._applyTagEffects(),this._variable.isChanged=!0,e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this),"block"===e.element.toolbar.style.display&&u._showToolbarBalloon()},_iframeAutoHeight:function(){this._iframeAuto?a.setTimeout((function(){const t=d._iframeAuto.offsetHeight;e.element.wysiwygFrame.style.height=t+"px",r.isResizeObserverSupported||d.__callResizeFunction(t,null)})):r.isResizeObserverSupported||d.__callResizeFunction(e.element.wysiwygFrame.offsetHeight,null)},__callResizeFunction:function(e,t){e=-1===e?t.borderBoxSize&&t.borderBoxSize[0]?t.borderBoxSize[0].blockSize:t.contentRect.height+this._editorHeightPadding:e,this._editorHeight!==e&&("function"==typeof h.onResizeEditor&&h.onResizeEditor(e,this._editorHeight,d,t),this._editorHeight=e)},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(r._allowedEmptyNodeList)||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,s=r.getRangeFormatElement(n,null);let o,a,c;const d=r.getParentElement(n,r.isComponent);if(!d||r.isTable(d)){if(1===n.nodeType&&"true"===n.getAttribute("data-se-embed")){let e=n.nextElementSibling;return r.isFormatElement(e)||(e=this.appendFormatTag(n,l.defaultTag)),void this.setRange(e.firstChild,0,e.firstChild,0)}if(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.children[t.startOffset])&&!r.isComponent(i.children[t.startOffset-1])){if(r.getParentElement(n,r.isNotCheckingNode))return null;if(s)return c=r.createElement(e||l.defaultTag),c.innerHTML=s.innerHTML,0===c.childNodes.length&&(c.innerHTML=r.zeroWidthSpace),s.innerHTML=c.outerHTML,c=s.firstChild,o=r.getEdgeChildNodes(c,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),c.insertBefore(o,c.firstChild)),a=o.textContent.length,void this.setRange(o,a,o,a);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||l.defaultTag),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,c=r.getFormatElement(o,null),!c)return this.removeRange(),void this._editorRange();if(r.isBreak(c.nextSibling)&&r.removeItem(c.nextSibling),r.isBreak(c.previousSibling)&&r.removeItem(c.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="";const i=l.frameAttrbutes;for(let t in i)e.element.wysiwyg.setAttribute(t,i[t]);this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),a.setTimeout(function(){u._resizeObserver&&u._resizeObserver.observe(e.element.wysiwygFrame),u._toolbarObserver&&u._toolbarObserver.observe(e.element._toolbarShadow),this._resourcesStateChange(),"function"==typeof h.onload&&h.onload(d,t)}.bind(this))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_toolbarShadow:e._toolbarShadow,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^("+a.Object.keys(l._textTagsMap).join("|")+")$","i"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;const i=u._keyCodeShortcut[e];switch(i){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="bold");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")?n="strike":t||-1!==l.shortcutsDisable.indexOf("save")||(n="save");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="underline");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="italic");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"indent":"outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"outdent":"indent")}return n?(d.commandHandler(d.commandMap[n],n),!0):!!i},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=l.rtl?"marginRight":"marginLeft",s=d.commandMap,o=u._onButtonsCheck,a=[],c=[],h=d.activePlugins,g=h.length;let p="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){if(p=e.nodeName.toUpperCase(),c.push(p),!d.isReadOnly)for(let t,i=0;i0)&&(a.push("OUTDENT"),s.OUTDENT.removeAttribute("disabled")),-1===a.indexOf("INDENT")&&s.INDENT&&!r.isImportantDisabled(s.INDENT)&&(a.push("INDENT"),r.isListCell(e)&&!e.previousElementSibling?s.INDENT.setAttribute("disabled",!0):s.INDENT.removeAttribute("disabled"))):o&&o.test(p)&&(a.push(p),r.addClass(s[p],"active"))}d._setKeyEffect(a),d._variable.currentNodes=c.reverse(),d._variable.currentNodesMap=a,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(d.controllersOff();t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||d.actionCall(i,n,t))},onMouseDown_wysiwyg:function(t){if(d.isReadOnly||r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onMouseDown&&!1===h.onMouseDown(t,d))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault()},onClick_wysiwyg:function(t){const n=t.target;if(d.isReadOnly)return t.preventDefault(),r.isAnchor(n)&&a.open(n.href,n.target),!1;if(r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onClick&&!1===h.onClick(t,d))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const s=r.getParentElement(n,"FIGCAPTION");if(s&&(r.isNonEditable(s)||!s.getAttribute("contenteditable"))&&(t.preventDefault(),s.setAttribute("contenteditable",!0),s.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),s.removeEventListener("blur",e)};s.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),c=r.getFormatElement(o,null),g=r.getRangeFormatElement(o,null);if(c||r.isNonEditable(n)||r.isList(g))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer))if(r.isList(g)){t.preventDefault();const e=r.createElement("LI"),n=o.nextElementSibling;e.appendChild(o),g.insertBefore(e,n),d.focus()}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||null===d._setDefaultFormat(r.isRangeFormatElement(g)?"DIV":l.defaultTag)?u._applyTagEffects():(t.preventDefault(),d.focus())}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,s=e.element.topArea,o=d.getSelection();let c;if(d._isBalloonAlways&&n.collapsed)c=!0;else if(o.focusNode===o.anchorNode)c=o.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name)}else{const e=r.createElement(l.defaultTag);e.innerHTML="
    ",f.parentElement.replaceChild(e,f)}return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}if(u._isUneditableNode(g,!0)){t.preventDefault(),t.stopPropagation();break}!p&&d._isEdgeFormat(g.startContainer,g.startOffset,"start")&&r.isFormatElement(f.previousElementSibling)&&(d._formatAttrsTemp=f.previousElementSibling.attributes);const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,s=f.childNodes;let o=i,a=s[0];for(;a=s[0];)e.insertBefore(a,o.nextSibling),o=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&f&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=f.previousSibling,l=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(e&&!e.previousSibling&&(n&&r.isComponent(n.previousSibling)||l&&r.isComponent(i))){const e=d.getFileComponent(i);e?(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),!1===d.selectComponent(e.target,e.pluginName)&&d.blur()):r.isComponent(i)&&(t.preventDefault(),t.stopPropagation(),r.removeItem(i));break}if(e&&r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if(u._isUneditableNode(g,!1)){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){const e=f.nextElementSibling;if(!e)break;if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n?(t.stopPropagation(),!1===d.selectComponent(n.target,n.pluginName)&&d.blur()):r.isComponent(e)&&(t.stopPropagation(),r.removeItem(e));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f&&f.childNodes[g.startOffset]||c;if(e&&r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}if(r.isComponent(e)){t.preventDefault(),t.stopPropagation(),r.removeItem(e);break}}if(!p&&d._isEdgeFormat(g.endContainer,g.endOffset,"end")&&r.isFormatElement(f.nextElementSibling)&&(d._formatAttrsTemp=f.attributes),f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),s||o||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let s=n[l];if(!s)break;s=s.firstElementChild||s,d.setRange(s,0,s,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i){const e=d._isEdgeFormat(g.endContainer,g.endOffset,"end"),n=d._isEdgeFormat(g.startContainer,g.startOffset,"start");if(e&&(/^H[1-6]$/i.test(f.nodeName)||/^HR$/i.test(f.nodeName))){t.preventDefault();let n=null;const i=d.appendFormatTag(f,l.defaultTag);if(e&&e.length>0){n=e.pop();const t=n;for(;e.length>0;)n=n.appendChild(e.pop());i.appendChild(t)}n=n?n.appendChild(i.firstChild):i.firstChild,d.setRange(n,0,n,0);break}if(n||e){t.preventDefault();const i=r.createElement("BR"),s=r.createElement(f.nodeName);s.appendChild(i),r.copyTagAttributes(s,f,["id"].concat(l.lineAttrReset)),f.parentNode.insertBefore(s,n?f:f.nextElementSibling),e&&d.setRange(i,1,i,1);break}if(d._formatAttrsTemp=f.attributes,l.lineAttrReset&&f&&!r.isListCell(f)){let e;if(t.preventDefault(),t.stopPropagation(),g.collapsed)e=r.onlyZeroWidthSpace(f)?d.appendFormatTag(f,f.cloneNode(!1)):r.splitElement(g.endContainer,g.endOffset,0);else{const t=r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null),n=d.removeNode();if(t)if(e=r.getFormatElement(n.container,null),n.prevContainer)e!==f&&e.nextElementSibling===f&&(e=f);else{const t=f.cloneNode(!1);t.innerHTML="
    ",e.parentNode.insertBefore(t,e)}else e=r.splitElement(n.container,n.offset,0)}const n=l.lineAttrReset,i=e.attributes;let s=0;for(;i[s];)n&&n.indexOf(i[s].name.toLowerCase())>-1?s++:e.removeAttribute(i[s].name);d.setRange(e.firstChild,0,e.firstChild,0);break}if(S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,s=c.previousElementSibling,o=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(s)&&(r.isBreak(s.previousSibling)||!r.onlyZeroWidthSpace(s.previousSibling.textContent))&&(!o||!r.isBreak(o)&&r.onlyZeroWidthSpace(o.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)&&!r.isRangeFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)&&!r.isRangeFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)&&!r.isRangeFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:l.defaultTag;e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,s=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(s)&&!r.isRangeFormatElement(s)?s.nodeName:l.defaultTag),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){!1===d.selectComponent(n._element,m)&&d.blur()}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&16===n){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}else if(i&&(r.isOSX_IOS?o:s)&&32===n){t.preventDefault(),t.stopPropagation();const e=d.insertNode(r.createTextNode(" "));if(e&&e.container)return void d.setRange(e.container,e.endOffset,e.container,e.endOffset)}if(r.isIE&&!s&&!o&&!p&&!u._nonTextKeyCode.test(n)&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=e.keyCode,n=e.ctrlKey||e.metaKey||91===t||92===t||224===t,i=e.altKey;if(d.isReadOnly)return void(!n&&u._directionKeyCode.test(t)&&u._applyTagEffects());const s=d.getRange();let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==t||!s.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==t&&u._showToolbarBalloonDelay()}if(8===t&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:l.defaultTag);return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const a=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null),g=d._formatAttrsTemp;if(g){for(let e=0,n=g.length;e0?i-s-e.element.toolbar.offsetHeight:0;i=n+s?(d._sticky||u._onStickyToolbar(a),t.toolbar.style.top=a+n+s+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=s&&u._onStickyToolbar(a)},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,s=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,s+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:s}},_getPageBottomSpace:function(){return o.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(t){const n=e.element;d._isInline||l.toolbarContainer||(n._stickyDummy.style.height=n.toolbar.offsetHeight+"px",n._stickyDummy.style.display="block"),n.toolbar.style.top=l.stickyToolbar+t+"px",n.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:n.toolbar.offsetWidth+"px",r.addClass(n.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){d._variable.isFullScreen||(e.element.code.style.height=e.element.code.scrollHeight+"px")},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),s=r.isCell(i),o=r.isCell(l),a=e.commonAncestorContainer;if((s&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||o&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(s){if(o)return r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode}))),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode})))}else r.removeItem(r.getParentElement(l,(function(e){return a===e.parentNode})));const c=1===t.nodeType?r.getParentElement(t,".se-component"):null,u=1===n.nodeType?r.getParentElement(n,".se-component"):null;return c&&r.removeItem(c),u&&r.removeItem(u),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!1===h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onSave_wysiwyg:function(e){"function"!=typeof h.onSave||h.onSave(e,d)},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!1===h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){if(d.isReadOnly||r.isIE)return e.preventDefault(),e.stopPropagation(),!1;const t=e.dataTransfer;return!t||(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,s;if(r.isIE){l=i.getData("Text");const o=d.getRange(),c=r.createElement("DIV"),h={sc:o.startContainer,so:o.startOffset,ec:o.endContainer,eo:o.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){s=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,s,i)})),!0}if(l=i.getData("text/plain"),s=i.getData("text/html"),!1===u._setClipboardData(t,n,l,s,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){const s=/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)||/content=["']*Excel.Sheet/i.test(i);!i?i=r._HTMLConvertor(n).replace(/\n/g,"
    "):(i=i.replace(/^\r?\n?\r?\n?\x3C!--StartFragment--\>|\x3C!--EndFragment-->\r?\n?<\/body\>\r?\n?<\/html>$/g,""),s&&(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp,d.pasteTagsBlacklistRegExp));const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste){const e=h.onPaste(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}if("drop"===e&&"function"==typeof h.onDrop){const e=h.onDrop(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}const a=l.files;return a.length>0&&!s?(/^image/.test(a[0].type)&&d.plugins.image&&h.insertImage(a),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled||d.isReadOnly)return!1;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){const s=e.element;let o=0,a=s.wysiwyg;do{o+=a.scrollTop,a=a.parentElement}while(a&&!/^(BODY|HTML)$/i.test(a.nodeName));const c=s.wysiwyg.scrollTop,h=u._getEditorOffsets(null),g=r.getOffset(n,s.wysiwygFrame).top+c,p=t.pageY+o+(l.iframe&&!l.toolbarContainer?s.toolbar.offsetHeight:0),m=g+(l.iframe?o:h.top),f=r.isListCell(n.parentNode);let _="",b="";if((f?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&pm+n.offsetHeight-20))return void(i.display="none");b=g+n.offsetHeight,_="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=_,i.top=b-c+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),s=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":l.defaultTag);if(i||(s.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(s.outerHTML,"byte-html"))return;t.parentNode.insertBefore(s,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?s:s.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_resizeObserver:null,_toolbarObserver:null,_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;r.isResizeObserverSupported&&(this._resizeObserver=new a.ResizeObserver((function(e){d.__callResizeFunction(-1,e[0])}))),e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)&&l.resizeEnable?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),r.isResizeObserverSupported&&(this._toolbarObserver=new a.ResizeObserver(d.resetResponsiveToolbar)),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),u._resizeObserver&&(u._resizeObserver.unobserve(e.element.wysiwygFrame),u._resizeObserver=null),u._toolbarObserver&&(u._toolbarObserver.unobserve(e.element._toolbarShadow),u._toolbarObserver=null),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===s.length)return void(s=null);u._responsiveCurrentSize="default";const e=u._responsiveButtonSize=[],t=u._responsiveButtons={default:s[0]};for(let n,i,l=1,o=s.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button(e);n.resizing.resizeButton=l;let s=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),s[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,s=null},setController_resize:function(e){const t=e.util.createElement("DIV");return t.className="se-controller se-resizing-container",t.style.display="none",t.innerHTML='
    ',t},setController_button:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-resizing",i.innerHTML='
    ",i},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,s=n.resizeDiv,o=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=o.top,u=o.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",s.style.top="0px",s.style.left="0px",s.style.width=r+"px",s.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;o.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,o,null,null),this.selectComponent(o,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(o,l);break;case"caption":const g=!s._captionChecked;if(a.openModify.call(this,!0),s._captionChecked=s.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(s._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):s._caption.focus(),this.controllersOff()}else this.selectComponent(o,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(o,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,s=1*e.getAttribute("data-rotate");let o="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";o=90===s||-270===s?t:e}}e.style.transformOrigin=o,this.plugins.resizing._setTransForm(e,s.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),s="";if(/[1-9]/.test(t)&&(n||i))switch(s=n?"Y":"X",t){case"90":s=n&&i?"X":i?s:"";break;case"270":l*=-1,s=n&&i?"Y":n?s:"";break;case"-90":s=n&&i?"Y":n?s:"";break;case"-270":l*=-1,s=n&&i?"X":i?s:"";break;default:s=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(s?" translate"+s+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const s=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),s&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,s=i.clientY;let o=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?s-e._resizeClientY:e._resizeClientY-s),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=o,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(o)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),t&&this.plugins.resizing.setTransformSize.call(this,this.context[this.context.resizing._resize_plugin]._element,n,i),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,_checkMediaComponent:function(e){return!/IMG/i.test(e)||!/FIGURE/i.test(e.parentElement.nodeName)||!/FIGURE/i.test(e.parentElement.parentElement.nodeName)},upload:function(e,t,n,i,l){this.showLoading();const s=this.plugins.fileManager,o=s._xmlHttp=this.util.getXMLHttpRequest();if(o.onreadystatechange=s._callBackUpload.bind(this,o,i,l),o.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)o.setRequestHeader(e,t[e]);o.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let s=[];for(let e=0,n=t.length;e0;){const t=s.shift();this.util.getParentElement(t,this.util.isMediaComponent)&&o._checkMediaComponent(t)?!t.getAttribute("data-index")||h.indexOf(1*t.getAttribute("data-index"))<0?(u.push(a._infoIndex),t.removeAttribute("data-index"),c(e,t,n,null,l)):u.push(1*t.getAttribute("data-index")):(u.push(a._infoIndex),i(t))}for(let e,t=0;t-1||(r.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=d)},setInfo:function(e,t,n,i,l){const s=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const o=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e Date: Sun, 9 Apr 2023 21:51:37 +0900 Subject: [PATCH 5/6] fix: figure size --- src/lib/core.js | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/lib/core.js b/src/lib/core.js index 9b65916a..7f104afc 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -5343,31 +5343,19 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re else if (sv && !v.some(function (v) { return /^style/.test(v.trim()); })) v.push(sv[0]); } - // img + // figure if (util.isFigures(tagName)) { let w = '', h = ''; const sv = m.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/); if (!v) v = []; if (sv) { - v.push(sv[0]); - - let w_px = ''; - let h_px = ''; - let w_per = ''; - let h_per = ''; - - w_px = sv[0].match(/width:(.+)px;/); - w_px = util.getNumber(w_px ? w_px[1] : '', -1) || null; - h_px = sv[0].match(/height:(.+)px;/); - h_px = util.getNumber(h_px ? h_px[1] : '', -1) || null; - - w_per = sv[0].match(/width:(.+)%;/); - w_per = util.getNumber(w_per ? w_per[1] : '', -1) || null; - h_per = sv[0].match(/height:(.+)%;/); - h_per = util.getNumber(h_per ? h_per[1] : '', -1) || null; - - w = w_px || w_per; - h = h_px || h_per; + const wsize = sv[0].match(/width\s?:\s?(\d+)(px|%)/); + const hsize = sv[0].match(/height\s?:\s?(\d+)(px|%)/); + const w_ = wsize && wsize[1] && wsize[2] ? wsize[1] + wsize[2] : 'auto'; + const h_ = hsize && hsize[1] && hsize[2] ? hsize[1] + hsize[2] : 'auto'; + w = util.getNumber(w_, -1) || ''; + h = util.getNumber(h_, -1) || ''; + v.push('style="width:'+ w_ + '; height:'+ h_ + ';"'); } if (!w || !h) { @@ -5378,7 +5366,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re h = !h ? util.getNumber(avh ? avh[1] : '') || '' : h; } } - v.push('data-origin="' + (w + ',' + h) + '"'); } if (v) { From fccf99cc9b7b93f1d460e03793b5afab01ebc9cf Mon Sep 17 00:00:00 2001 From: Yi JiHong <0125ses@hanmail.net> Date: Sun, 9 Apr 2023 22:00:33 +0900 Subject: [PATCH 6/6] version fix: 2.44.7 --- dist/suneditor.min.js | 4 ++-- src/lib/core.js | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index cf1e66c0..ab6a3e12 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this._onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this._onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},_onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},_onClick_dialog:function(e){(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.options.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,"function"==typeof this.plugins[e].init&&this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"dialog",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},JhlZ:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(e){const t=e.context;t.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let n=e.util.createElement("DIV");n.className="se-file-browser sun-editor-common";let i=e.util.createElement("DIV");i.className="se-file-browser-back";let l=e.util.createElement("DIV");l.className="se-file-browser-inner",l.innerHTML=this.set_browser(e),n.appendChild(i),n.appendChild(l),this._loading=n.querySelector(".se-loading-box"),t.fileBrowser.area=n,t.fileBrowser.header=l.querySelector(".se-file-browser-header"),t.fileBrowser.titleArea=l.querySelector(".se-file-browser-title"),t.fileBrowser.tagArea=l.querySelector(".se-file-browser-tags"),t.fileBrowser.body=l.querySelector(".se-file-browser-body"),t.fileBrowser.list=l.querySelector(".se-file-browser-list"),t.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(e)),t.fileBrowser.list.addEventListener("click",this.onClickFile.bind(e)),l.addEventListener("mousedown",this._onMouseDown_browser.bind(e)),l.addEventListener("click",this._onClick_browser.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},set_browser:function(e){const t=e.lang;return'
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.options.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url,this.context[e].header)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e,t){const n=this.plugins.fileBrowser,i=n._xmlHttp=this.util.getXMLHttpRequest();if(i.onreadystatechange=n._callBackGet.bind(this,i),i.open("get",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)i.setRequestHeader(e,t[e]);i.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{const t=JSON.parse(e.responseText);t.result.length>0?this.plugins.fileBrowser._drawListItem.call(this,t.result,!0):t.nullMessage&&(this.context.fileBrowser.list.innerHTML=t.nullMessage)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],s=e.length,o=i.columnSize||n.columnSize,a=o<=1?1:Math.round(s/o)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,s=l.tagArea.querySelector('a[title="'+n+'"]'),o=l.selectedTags,a=o.indexOf(n);a>-1?(o.splice(a,1),this.util.removeClass(s,"on")):(o.push(n),this.util.addClass(s,"on")),i._drawListItem.call(this,0===o.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return o.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const s=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),s(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",dir_ltr:"Left to right",dir_rtl:"Right to left",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window",downloadLinkCheck:"Download link",bookmark:"Bookmark"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]},t.colorPicker.colorListHTML=this.createColorList(e,this._makeColorList)},createColorList:function(e,t){const n=e.options,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];let s=[],o='
    ';for(let e,n=0,i=l.length;n0&&(o+='
    '+t(s)+"
    ",s=[]),"object"==typeof e&&(o+='
    '+t(e)+"
    ")));return o+='
    ",o},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.color;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},s={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.backgroundColor;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#ffffff",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},o={name:"template",display:"submenu",add:function(e,t){e.context.template={selectedIndex:-1};let n=this.setSubmenu(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(e){const t=e.options.templates;if(!t||0===t.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const n=e.util.createElement("DIV");n.className="se-list-layer";let i='
      ';for(let e,n=0,l=t.length;n";return i+="
    ",n.innerHTML=i,n},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation(),this.context.template.selectedIndex=1*e.target.getAttribute("data-value");const t=this.options.templates[this.context.template.selectedIndex];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"selectMenu",add:function(e){e.context.selectMenu={caller:{},callerContext:null}},setForm:function(){return'
    '},createList:function(e,t,n){e.form.innerHTML="
      "+n+"
    ",e.items=t,e.menus=e.form.querySelectorAll("li")},initEvent:function(e,t){const n=t.querySelector(".se-select-list"),i=this.context.selectMenu.caller[e]={form:n,items:[],menus:[],index:-1,item:null,clickMethod:null,callerName:e};n.addEventListener("mousedown",this.plugins.selectMenu.onMousedown_list),n.addEventListener("mousemove",this.plugins.selectMenu.onMouseMove_list.bind(this,i)),n.addEventListener("click",this.plugins.selectMenu.onClick_list.bind(this,i))},onMousedown_list:function(e){e.preventDefault(),e.stopPropagation()},onMouseMove_list:function(e,t){this.util.addClass(e.form,"__se_select-menu-mouse-move");const n=t.target.getAttribute("data-index");n&&(e.index=1*n)},onClick_list:function(e,t){const n=t.target.getAttribute("data-index");n&&e.clickMethod.call(this,e.items[n])},moveItem:function(e,t){this.util.removeClass(e.form,"__se_select-menu-mouse-move"),t=e.index+t;const n=e.menus,i=n.length,l=e.index=t>=i?0:t<0?i-1:t;for(let e=0;e
    "+e.plugins.selectMenu.setForm()+'
    '+l.bookmark+''+l.download+'
    ",s.innerHTML=o,s},initEvent:function(e,t){const n=this.plugins.anchor,i=this.context.anchor.caller[e]={modal:t,urlInput:null,linkDefaultRel:this.options.linkRelDefault,defaultRel:this.options.linkRelDefault.default||"",currentRel:[],linkAnchor:null,linkValue:"",_change:!1,callerName:e};"string"==typeof i.linkDefaultRel.default&&(i.linkDefaultRel.default=i.linkDefaultRel.default.trim()),"string"==typeof i.linkDefaultRel.check_new_window&&(i.linkDefaultRel.check_new_window=i.linkDefaultRel.check_new_window.trim()),"string"==typeof i.linkDefaultRel.check_bookmark&&(i.linkDefaultRel.check_bookmark=i.linkDefaultRel.check_bookmark.trim()),i.urlInput=t.querySelector(".se-input-url"),i.anchorText=t.querySelector("._se_anchor_text"),i.newWindowCheck=t.querySelector("._se_anchor_check"),i.downloadCheck=t.querySelector("._se_anchor_download"),i.download=t.querySelector("._se_anchor_download_icon"),i.preview=t.querySelector(".se-link-preview"),i.bookmark=t.querySelector("._se_anchor_bookmark_icon"),i.bookmarkButton=t.querySelector("._se_bookmark_button"),this.plugins.selectMenu.initEvent.call(this,e,t);const l=this.context.selectMenu.caller[e];this.options.linkRel.length>0&&(i.relButton=t.querySelector(".se-anchor-rel-btn"),i.relList=t.querySelector(".se-list-layer"),i.relPreview=t.querySelector(".se-anchor-rel-preview"),i.relButton.addEventListener("click",n.onClick_relButton.bind(this,i)),i.relList.addEventListener("click",n.onClick_relList.bind(this,i))),i.newWindowCheck.addEventListener("change",n.onChange_newWindowCheck.bind(this,i)),i.downloadCheck.addEventListener("change",n.onChange_downloadCheck.bind(this,i)),i.anchorText.addEventListener("input",n.onChangeAnchorText.bind(this,i)),i.urlInput.addEventListener("input",n.onChangeUrlInput.bind(this,i)),i.urlInput.addEventListener("keydown",n.onKeyDownUrlInput.bind(this,l)),i.urlInput.addEventListener("focus",n.onFocusUrlInput.bind(this,i,l)),i.urlInput.addEventListener("blur",n.onBlurUrlInput.bind(this,l)),i.bookmarkButton.addEventListener("click",n.onClick_bookmarkButton.bind(this,i))},on:function(e,t){const n=this.plugins.anchor;if(t){if(e.linkAnchor){this.context.dialog.updateModal=!0;const t=e.linkAnchor.getAttribute("href");e.linkValue=e.preview.textContent=e.urlInput.value=n.selfPathBookmark.call(this,t)?t.substr(t.lastIndexOf("#")):t,e.anchorText.value=e.linkAnchor.textContent,e.newWindowCheck.checked=!!/_blank/i.test(e.linkAnchor.target),e.downloadCheck.checked=e.linkAnchor.download}}else n.init.call(this,e),e.anchorText.value=this.getSelection().toString().trim(),e.newWindowCheck.checked=this.options.linkTargetNewWindow;this.context.anchor.callerContext=e,n.setRel.call(this,e,t&&e.linkAnchor?e.linkAnchor.rel:e.defaultRel),n.setLinkPreview.call(this,e,e.linkValue),this.plugins.selectMenu.on.call(this,e.callerName,this.plugins.anchor.setHeaderBookmark)},selfPathBookmark:function(e){const t=this._w.location.href.replace(/\/$/,"");return 0===e.indexOf("#")||0===e.indexOf(t)&&e.indexOf("#")===(-1===t.indexOf("#")?t.length:t.substr(0,t.indexOf("#")).length)},_closeRelMenu:null,toggleRelList:function(e,t){if(t){const t=e.relButton,n=e.relList;this.util.addClass(t,"active"),n.style.visibility="hidden",n.style.display="block",this.options.rtl?n.style.left=t.offsetLeft-n.offsetWidth-1+"px":n.style.left=t.offsetLeft+t.offsetWidth+1+"px",n.style.top=t.offsetTop+t.offsetHeight/2-n.offsetHeight/2+"px",n.style.visibility="",this.plugins.anchor._closeRelMenu=function(e,t,n){n&&(e.relButton.contains(n.target)||e.relList.contains(n.target))||(this.util.removeClass(t,"active"),e.relList.style.display="none",this.modalForm.removeEventListener("click",this.plugins.anchor._closeRelMenu),this.plugins.anchor._closeRelMenu=null)}.bind(this,e,t),this.modalForm.addEventListener("click",this.plugins.anchor._closeRelMenu)}else this.plugins.anchor._closeRelMenu&&this.plugins.anchor._closeRelMenu()},onClick_relButton:function(e,t){this.plugins.anchor.toggleRelList.call(this,e,!this.util.hasClass(t.target,"active"))},onClick_relList:function(e,t){const n=t.target,i=n.getAttribute("data-command");if(!i)return;const l=e.currentRel,s=this.util.toggleClass(n,"se-checked"),o=l.indexOf(i);s?-1===o&&l.push(i):o>-1&&l.splice(o,1),e.relPreview.title=e.relPreview.textContent=l.join(" ")},setRel:function(e,t){const n=e.relList,i=e.currentRel=t?t.split(" "):[];if(!n)return;const l=n.querySelectorAll("button");for(let e,t=0,n=l.length;t-1?this.util.addClass(l[t],"se-checked"):this.util.removeClass(l[t],"se-checked");e.relPreview.title=e.relPreview.textContent=i.join(" ")},createHeaderList:function(e,t,n){const i=this.util.getListChildren(this.context.element.wysiwyg,(function(e){return/h[1-6]/i.test(e.nodeName)}));if(0===i.length)return;const l=new this._w.RegExp("^"+n.replace(/^#/,""),"i"),s=[];let o="";for(let e,t=0,n=i.length;t'+e.textContent+"");0===s.length?this.plugins.selectMenu.close.call(this,t):(this.plugins.selectMenu.createList(t,s,o),this.plugins.selectMenu.open.call(this,t,this.plugins.anchor._setMenuListPosition.bind(this,e)))},_setMenuListPosition:function(e,t){t.style.top=e.urlInput.offsetHeight+1+"px"},onKeyDownUrlInput:function(e,t){switch(t.keyCode){case 38:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,-1);break;case 40:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,1);break;case 13:e.index>-1&&(t.preventDefault(),t.stopPropagation(),this.plugins.anchor.setHeaderBookmark.call(this,this.plugins.selectMenu.getItem(e,null)))}},setHeaderBookmark:function(e){const t=this.context.anchor.callerContext,n=e.id||"h_"+this._w.Math.random().toString().replace(/.+\./,"");e.id=n,t.urlInput.value="#"+n,t.anchorText.value.trim()&&t._change||(t.anchorText.value=e.textContent),this.plugins.anchor.setLinkPreview.call(this,t,t.urlInput.value),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext),this.context.anchor.callerContext.urlInput.focus()},onChangeAnchorText:function(e,t){e._change=!!t.target.value.trim()},onChangeUrlInput:function(e,t){const n=t.target.value.trim();this.plugins.anchor.setLinkPreview.call(this,e,n),this.plugins.anchor.selfPathBookmark.call(this,n)?this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,n):this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)},onFocusUrlInput:function(e,t){const n=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,n)&&this.plugins.anchor.createHeaderList.call(this,e,t,n)},onBlurUrlInput:function(e){this.plugins.selectMenu.close.call(this,e)},setLinkPreview:function(e,t){const n=e.preview,i=this.options.linkProtocol,l=this.options.linkNoPrefix,s=/^(mailto\:|tel\:|sms\:|https*\:\/\/|#)/.test(t),o=!!i&&this._w.RegExp("^"+t.substr(0,i.length)).test(i);t=e.linkValue=n.textContent=t?l?t:!i||s||o?s?t:/^www\./.test(t)?"http://"+t:this.context.anchor.host+(/^\//.test(t)?"":"/")+t:i+t:"",this.plugins.anchor.selfPathBookmark.call(this,t)?(e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active")):(e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active")),!this.plugins.anchor.selfPathBookmark.call(this,t)&&e.downloadCheck.checked?e.download.style.display="block":e.download.style.display="none"},setCtx:function(e,t){e&&(t.linkAnchor=e,t.linkValue=e.href,t.currentRel=e.rel.split(" "))},updateAnchor:function(e,t,n,i,l){!this.plugins.anchor.selfPathBookmark.call(this,t)&&i.downloadCheck.checked?e.setAttribute("download",n||t):e.removeAttribute("download"),i.newWindowCheck.checked?e.target="_blank":e.removeAttribute("target");const s=i.currentRel.join(" ");s?e.rel=s:e.removeAttribute("rel"),e.href=t,l?0===e.children.length&&(e.textContent=""):e.textContent=n},createAnchor:function(e,t){if(0===e.linkValue.length)return null;const n=e.linkValue,i=e.anchorText,l=0===i.value.length?n:i.value,s=e.linkAnchor||this.util.createElement("A");return this.plugins.anchor.updateAnchor.call(this,s,n,l,e,t),e.linkValue=e.preview.textContent=e.urlInput.value=e.anchorText.value="",s},onClick_bookmarkButton:function(e){let t=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,t)?(t=t.substr(1),e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)):(t="#"+t,e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active"),e.downloadCheck.checked=!1,e.download.style.display="none",this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,t)),e.urlInput.value=t,this.plugins.anchor.setLinkPreview.call(this,e,t),e.urlInput.focus()},onChange_newWindowCheck:function(e,t){"string"==typeof e.linkDefaultRel.check_new_window&&(t.target.checked?this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_new_window)):this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_new_window)))},onChange_downloadCheck:function(e,t){t.target.checked?(e.download.style.display="block",e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),e.linkValue=e.preview.textContent=e.urlInput.value=e.urlInput.value.replace(/^\#+/,""),"string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_bookmark))):(e.download.style.display="none","string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_bookmark)))},_relMerge:function(e,t){const n=e.currentRel;if(!t)return n.join(" ");if(/^only\:/.test(t))return t=t.replace(/^only\:/,"").trim(),e.currentRel=t.split(" "),t;const i=t.split(" ");for(let e,t=0,l=i.length;t'+i.cancel+''+t.dialogBox.linkBox.title+""+e.context.anchor.forms.innerHTML+'";return n.innerHTML=l,n},setController_LinkButton:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
    ",i},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();try{const e=this.plugins.anchor.createAnchor.call(this,this.context.anchor.caller.link,!1);if(null===e)return;if(this.context.dialog.updateModal){const e=this.context.link._linkAnchor.childNodes[0];this.setRange(e,0,e,e.textContent.length)}else{const t=this.getSelectedElements();if(t.length>1){const n=this.util.createElement(t[0].nodeName);if(n.appendChild(e),!this.insertNode(n,null,!0))return}else if(!this.insertNode(e,null,!0))return;this.setRange(e.childNodes[0],0,e.childNodes[0],e.textContent.length)}}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){this.plugins.anchor.on.call(this,this.context.anchor.caller.link,e)},call_controller:function(e){this.editLink=this.context.link._linkAnchor=this.context.anchor.caller.link.linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent,this.util.addClass(e,"on"),this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"link",this.util.removeClass.bind(this.util,this.context.link._linkAnchor,"on"))},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t))this.plugins.dialog.open.call(this,"link",!0);else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.anchor.caller.link.linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){this.context.link.linkController.style.display="none",this.plugins.anchor.init.call(this,this.context.anchor.caller.link)}},h=n("ZED3"),g=n.n(h),p=n("ee5k"),m=n.n(p),f=n("gjS+"),_=n.n(f),b={name:"image",display:"dialog",add:function(e){e.addModule([r.a,d,g.a,m.a,_.a]);const t=e.options,n=e.context,i=n.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:t._imageSizeUnit,_linkElement:"",_altText:"",_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_src:{_linkValue:""},svgDefaultSize:"30%",base64RenderIndex:0,_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.imageWidth?"":t.imageWidth,_origin_h:"auto"===t.imageHeight?"":t.imageHeight,_proportionChecked:!0,_resizing:t.imageResizing,_resizeDotHide:!t.imageHeightShow,_rotation:t.imageRotation,_alignHide:!t.imageAlignShow,_onlyPercentage:t.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let l=this.setDialog(e);i.modal=l,i.imgInputFile=l.querySelector("._se_image_file"),i.imgUrlFile=l.querySelector("._se_image_url"),i.focusElement=i.imgInputFile||i.imgUrlFile,i.altText=l.querySelector("._se_image_alt"),i.captionCheckEl=l.querySelector("._se_image_check_caption"),i.previewSrc=l.querySelector("._se_tab_content_image .se-link-preview"),l.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),l.querySelector("form").addEventListener("submit",this.submit.bind(e)),i.imgInputFile&&l.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(i.imgInputFile,i.imgUrlFile,i.previewSrc)),i.imgUrlFile&&i.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(i.previewSrc,i._v_src,t.linkProtocol)),i.imgInputFile&&i.imgUrlFile&&i.imgInputFile.addEventListener("change",this._fileInputChange.bind(i));const s=l.querySelector(".__se__gallery");s&&s.addEventListener("click",this._openGallery.bind(e)),i.proportion={},i.inputX={},i.inputY={},t.imageResizing&&(i.proportion=l.querySelector("._se_image_check_proportion"),i.inputX=l.querySelector("._se_image_size_x"),i.inputY=l.querySelector("._se_image_size_y"),i.inputX.value=t.imageWidth,i.inputY.value=t.imageHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),i.inputX.addEventListener("change",this.setRatio.bind(e)),i.inputY.addEventListener("change",this.setRatio.bind(e)),i.proportion.addEventListener("change",this.setRatio.bind(e)),l.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),n.dialog.modal.appendChild(l),e.plugins.anchor.initEvent.call(e,"image",l.querySelector("._se_tab_content_url")),i.anchorCtx=e.context.anchor.caller.image,l=null},setDialog:function(e){const t=e.options,n=e.lang,i=e.util.createElement("DIV");i.className="se-dialog-content se-dialog-image",i.style.display="none";let l='
    '+n.dialogBox.imageBox.title+'
    ';if(t.imageFileInput&&(l+='
    "),t.imageUrlInput&&(l+='
    '+(t.imageGalleryUrl&&e.plugins.imageGallery?'":"")+'
    '),l+='
    ',t.imageResizing){const i=t.imageSizeOnlyPercentage,s=i?' style="display: none !important;"':"",o=t.imageHeightShow?"":' style="display: none !important;"';l+='
    ',i||!t.imageHeightShow?l+='
    ":l+='
    ",l+=' '+n.dialogBox.proportion+'
    "}return l+='
    ",i.innerHTML=l,i},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.imageWidth===t._defaultSizeX?"":this.options.imageWidth,t.inputY.value=t._origin_h=this.options.imageHeight===t._defaultSizeY?"":this.options.imageHeight,t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple")),this.plugins.anchor.on.call(this,t.anchorCtx,e)},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,s,o;for(s=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this,t._v_src._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const s={anchor:this.plugins.anchor.createAnchor.call(this,l.anchorCtx,!0),inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,alt:l._altText,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,s,e):this.plugins.image.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.options.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e'+e.icons.cancel+''+n.dialogBox.videoBox.title+'
    ';if(t.videoFileInput&&(l+='
    "),t.videoUrlInput&&(l+='
    '),t.videoResizing){const i=t.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],s=t.videoRatio,o=t.videoSizeOnlyPercentage,a=o?' style="display: none !important;"':"",r=t.videoHeightShow?"":' style="display: none !important;"',c=t.videoRatioShow?"":' style="display: none !important;"',d=o||t.videoHeightShow||t.videoRatioShow?"":' style="display: none !important;"';l+='
    "}return l+='
    ",i.innerHTML=l,i},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.videoWidth===t._defaultSizeX?"":this.options.videoWidth,t.inputY.value=t._origin_h=this.options.videoHeight===t._defaultSizeY?"":this.options.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const s={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,s,e):this.plugins.video.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.options.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(e)){if(0===(e=(new this._w.DOMParser).parseFromString(e,"text/html").querySelector("iframe").src).length)return!1}if(/youtu\.?be/.test(e)){if(/^http/.test(e)||(e="https://"+e),e=e.replace("watch?v=",""),/^\/\/.+\/embed\//.test(e)||(e=e.replace(e.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t._youtubeQuery.length>0)if(/\?/.test(e)){const n=e.split("?");e=n[0]+"?"+t._youtubeQuery+"&"+n[1]}else e+="?"+t._youtubeQuery}else/vimeo\.com/.test(e)&&(e.endsWith("/")&&(e=e.slice(0,-1)),e="https://player.vimeo.com/video/"+e.slice(e.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video[/embed|iframe|player|\/e\/|\.php|\.html?/.test(e)||/vimeo\.com/.test(e)?"createIframeTag":"createVideoTag"].call(this),e,t.inputX.value,t.inputY.value,t._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,s,o){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(o){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!o||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;if(o)a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null);else if(p=this.insertComponent(c,!1,!0,!this.options.mediaAutoSelect),!this.options.mediaAutoSelect){const e=this.appendFormatTag(c,null);e&&this.setRange(e,0,e,0)}p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,s,!0),o&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);let n=this.util.isRangeFormatElement(e.parentNode)||this.util.isWysiwygDiv(e.parentNode)?e:this.util.getFormatElement(e)||e;const i=e;t._element=e=e.cloneNode(!0);const l=t._cover=this.plugins.component.set_cover.call(this,e),s=t._container=this.plugins.component.set_container.call(this,l,"se-video-container");try{const o=n.querySelector("figcaption");let a=null;o&&(a=this.util.createElement("DIV"),a.innerHTML=o.innerHTML,this.util.removeItem(o));const r=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,r[0]||i.style.width||i.width||"",r[1]||i.style.height||i.height||"");const c=this.util.getFormatElement(i);if(c&&(t._align=c.style.textAlign||c.style.float),this.plugins.video.setAlign.call(this,null,e,l,s),this.util.getParentElement(i,this.util.isNotCheckingNode))i.parentNode.replaceChild(s,i);else if(this.util.isListCell(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n.insertBefore(s,e),this.util.removeItem(i),this.util.removeEmptyNode(e,null,!0)}else if(this.util.isFormatElement(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n=this.util.splitElement(n,e),n.parentNode.insertBefore(s,n),this.util.removeItem(i),this.util.removeEmptyNode(n,null,!0),0===n.children.length&&(n.innerHTML=this.util.htmlRemoveWhiteSpace(n.innerHTML))}else n.parentNode.replaceChild(s,n);a&&n.parentNode.insertBefore(a,s.nextElementSibling)}catch(e){console.warn("[SUNEDITOR.video.error] Maybe the video tag is nested.",e)}this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0),this.plugins.video.init.call(this)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.style.float||e.getAttribute("data-align")||"none",e.style.float="",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i,l,s=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");s?(s=s.split(","),i=s[0],l=s[1]):t&&(i=t.w,l=t.h),n._origin_w=i||e.style.width||e.width||"",n._origin_h=l||e.style.height||e.height||""},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),(t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]')||t.modal.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,s=i.length;l'+e.icons.cancel+''+n.dialogBox.audioBox.title+'
    ';return t.audioFileInput&&(l+='
    "),t.audioUrlInput&&(l+='
    '),l+='
    ",i.innerHTML=l,i},setController:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
    ",i},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const s={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,s,e):this.plugins.audio.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.options.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+e.icons.cancel+''+t.dialogBox.mathBox.title+'

    ",e.context.math.defaultFontSize=l,n.innerHTML=s,n},setController_MathButton:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp")||!this.options.katex)return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){let t="";try{this.util.removeClass(this.context.math.focusElement,"se-error"),t=this.options.katex.src.renderToString(e,{throwOnError:!0,displayMode:!0})}catch(e){this.util.addClass(this.context.math.focusElement,"se-error"),t='Katex syntax error. (Refer KaTeX)',console.warn("[SUNEDITOR.math.Katex.error] ",e)}return t},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController;this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},w=n("JhlZ"),x=n.n(w),E={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_itemMenu:null,_alignList:null,currentAlign:"",defaultDir:e.options.rtl?"right":"left",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu(e),s=i.align._itemMenu=l.querySelector("ul");s.addEventListener("click",this.pickup.bind(e)),i.align._alignList=s.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,s=null},setSubmenu:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV"),l=e.options.alignItems;let s="";for(let e,i,o=0;o";return i.className="se-submenu se-list-layer se-list-align",i.innerHTML='
      '+s+"
    ",i},active:function(e){const t=this.context.align,n=t.targetButton,i=n.firstElementChild;if(e){if(this.util.isFormatElement(e)){const l=e.style.textAlign;if(l)return this.util.changeElement(i,t.icons[l]||t.icons[t.defaultDir]),n.setAttribute("data-focus",l),!0}}else this.util.changeElement(i,t.icons[t.defaultDir]),n.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||e.defaultDir;if(n!==e.currentAlign){for(let e=0,i=t.length;e
    • ";for(s=0,o=a.length;s";return r+="
    ",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,this.lang.toolbar.font+" ("+i+")"),!0}}else{const e=this.hasFocus?this.wwComputedStyle.fontFamily:this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,this.hasFocus?this.lang.toolbar.font+(e?" ("+e+")":""):e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+n.toolbar.default+")";for(let e,n=0,i=t.fontSizeUnit,o=l.length;n";return s+="",i.innerHTML=s,i},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,this._convertFontSize.call(this,this.options.fontSizeUnit,e.style.fontSize)),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.hasFocus?this._convertFontSize.call(this,this.options.fontSizeUnit,this.wwComputedStyle.fontSize):this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e";return n.className="se-submenu se-list-layer se-list-line",n.innerHTML='
      '+l+"
    ",n},active:function(e){if(e){if(/HR/i.test(e.nodeName))return this.context.horizontalRule.currentHR=e,this.util.hasClass(e,"on")||(this.util.addClass(e,"on"),this.controllersOn("hr",this.util.removeClass.bind(this.util,e,"on"))),!0}else this.util.hasClass(this.context.horizontalRule.currentHR,"on")&&this.controllersOff();return!1},appendHr:function(e){return this.focus(),this.insertComponent(e.cloneNode(!1),!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=t.getAttribute("data-command");for(;!n&&!/UL/i.test(t.tagName);)t=t.parentNode,n=t.getAttribute("data-command");if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,t.firstElementChild);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML='
    ",n},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}return t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active"),!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(h=a),r&&f===p&&!s.isRangeFormatElement(_)||(d||(d=a),i&&r&&f===p||r&&s.isList(p)&&p===c||a.parentNode!==f&&f.insertBefore(a,_)),s.removeItem(n),i&&null===g&&(g=a.children.length-1),r&&(s.getRangeFormatElement(p,m)!==s.getRangeFormatElement(c,m)||s.isList(p)&&s.isList(c)&&s.getElementDepth(p)!==s.getElementDepth(c))&&(a=s.createElement(e)),b&&0===b.children.length&&s.removeItem(b)}else s.removeItem(n);g&&(d=d.children[g]),o&&(p=a.children.length-1,a.innerHTML+=c.innerHTML,h=a.children[p],s.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=s.getRangeFormatElement(o),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(s);i||(r=s.createElement(e));for(let t,o,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,s=this.util.getPositionIndex(i);for(;t[s];)e.appendChild(t[s]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(o);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],s=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;s=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),o=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,s=0,c=n;s span > span"),i.columnFixedButton=o.querySelector("._se_table_fixed_column"),i.headerButton=o.querySelector("._se_table_header");let a=this.setController_tableEditor(e,i.cellControllerTop);i.resizeDiv=a,i.splitMenu=a.querySelector(".se-btn-group-sub"),i.mergeButton=a.querySelector("._se_table_merge_button"),i.splitButton=a.querySelector("._se_table_split_button"),i.insertRowAboveButton=a.querySelector("._se_table_insert_row_a"),i.insertRowBelowButton=a.querySelector("._se_table_insert_row_b"),s.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e,i)),s.addEventListener("click",this.appendTable.bind(e)),a.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,l),n.element.relative.appendChild(a),n.element.relative.appendChild(o),l=null,s=null,a=null,o=null,i=null},setSubmenu:function(e){const t=e.util.createElement("DIV");return t.className="se-submenu se-selector-table",t.innerHTML='
    1 x 1
    ',t},setController_table:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-table",i.innerHTML='
    ",i},setController_tableEditor:function(e,t){const n=e.lang,i=e.icons,l=e.util.createElement("DIV");return l.className="se-controller se-controller-table-cell",l.innerHTML=(t?"":'
    ')+'
    • '+n.controller.VerticalSplit+'
    • '+n.controller.HorizontalSplit+"
    ",l},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e,t){t.stopPropagation();let n=this._w.Math.ceil(t.offsetX/18),i=this._w.Math.ceil(t.offsetY/18);n=n<1?1:n,i=i<1?1:i,e._rtl&&(e.tableHighlight.style.left=18*n-13+"px",n=11-n),e.tableHighlight.style.width=n+"em",e.tableHighlight.style.height=i+"em",this.util.changeTxt(e.tableDisplay,n+" x "+i),e._tableXY=[n,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;ts||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)));if(s===o&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,s="row"===e;if(s){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(s)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,s=l.length;no&&o>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[s+1];if(e){const t=[];let n=r[s].cells,i=0;for(let e,l,s=0,o=n.length;s1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let s,o,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,s),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!s[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+o?h.push(e):p<=t+o&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+o,p,p+r):n>0&&(pt+o)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&s.length>0&&(p=this.plugins.table.createCells.call(this,s[0].nodeName,0,!0),p=e.insertBefore(p,s[t]))}}if(l){let e,t;for(let n,l=0,s=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,o.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let o,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:s+1,rs:d,row:-1}),i!==l&&u<=a&&u+s>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=s}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}o.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(s,o)+n;for(let e,t,n=0;n=a));c++)l=e[c],s=l.rowSpan-1,s>0&&s+n>=r&&o=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||s===o-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=o.cells;for(let e=0,t=a.length;e0&&o+s>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,o,o+s));else s.push(e[o]);for(let e=0,t=s.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,s,o;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(s=t.icons.reduction,o=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(s=t.icons.expansion,o=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,s),this.util.changeTxt(l,o)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,s=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=s.length;e0)for(let e,t=0;td||(u>=e.index?(s+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(o){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){o=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==s){c.cs=e,c.ce=t,c.rs=n,c.re=s,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),s+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(t=e.toLowerCase(),i="blockquote"===t?"range":"pre"===t?"free":"replace",r=/^h/.test(t)?t.match(/\d+/)[0]:"",a=n["tag_"+(r?"h":t)]+r,d="",c=""):(t=e.tag.toLowerCase(),i=e.command,a=e.name||t,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",i.innerHTML=o,i},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText;if(e){if(this.util.isFormatElement(e)){const i=this.context.formatBlock._formatList,l=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,o=i.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),s=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),o=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,o?o.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!s||!c||/
    $/i.test(s)?s:s+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),s&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,o=p.length;n('+n.toolbar.default+")";for(let e,t=0,n=l.length;t";return s+="",i.innerHTML=s,i},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",n.innerHTML=o,n},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return s+="",n.innerHTML=s,n},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,s,o=0,a=t.length;o'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.plugins.image.create_image.call(this,e.getAttribute("data-value"),null,this.context.image._origin_w,this.context.image._origin_h,"none",t,e.alt)}.bind(this),null)}}},S={rtl:{italic:'',indent:'',outdent:'',list_bullets:'',list_number:'',link:'',unlink:''},redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',bookmark:'',download:'',dir_ltr:'',dir_rtl:'',alert_outline:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},N=n("P6u4"),T=n.n(N);const k={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,isChromium:null,isResizeObserverSupported:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform),this.isChromium=!!window.chrome,this.isResizeObserverSupported="function"==typeof ResizeObserver)},_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas",_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),fontValueMap:{"xx-small":1,"x-small":2,small:3,medium:4,large:5,"x-large":6,"xx-large":7},onlyZeroWidthSpace:function(e){return null!=e&&("string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e))},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},getValues:function(e){return e?this._w.Object.keys(e).map((function(t){return e[t]})):[]},camelToKebabCase:function(e){return"string"==typeof e?e.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},kebabToCamelCase:function(e){return"string"==typeof e?e.replace(/-[a-zA-Z]/g,(function(e){return e.replace("-","").toUpperCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",s="js"===t?"src":"href";let o="(?:";for(let t=0,n=e.length;t0?i[0][s]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){if(!e||!e.toString)return 0;e=e.toString();const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e)).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isUneditableComponent:function(e){return e&&this.hasClass(e,"__se__uneditable")},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t,n){t.style.cssText&&(e.style.cssText+=t.style.cssText);const i=t.attributes;for(let t=0,l=i.length;t-1||e.setAttribute(i[t].name,i[t].value);const l=e.attributes;for(let t=0,n=l.length;to?1:s0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const s=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==s;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const o=t&&/iframe/i.test(t.nodeName);return{left:n+(o?t.parentElement.offsetLeft:0),top:i-(s?s.scrollTop:0)+(o?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;let n=!1;const i=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");return i.test(e.className)?e.className=e.className.replace(i," ").trim():(e.className+=" "+t,n=!0),e.className.trim()||e.removeAttribute("class"),n},isImportantDisabled:function(e){return e.hasAttribute("data-important-disabled")},setDisabledButtons:function(e,t,n){for(let i=0,l=t.length;ii))continue;s.appendChild(n[e])}e--,t--,i--}return l.childNodes.length>0&&e.parentNode.insertBefore(l,e),s.childNodes.length>0&&e.parentNode.insertBefore(s,e.nextElementSibling),e}const i=e.parentNode;let l,s,o,a=0,r=!0;if((!n||n<0)&&(n=0),3===e.nodeType){if(a=this.getPositionIndex(e),t>=0&&e.length!==t){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,o=l,l=c.cloneNode(!1),s=c.childNodes,o&&(this.isListCell(l)&&this.isList(o)&&o.firstElementChild?(l.innerHTML=o.firstElementChild.innerHTML,k.removeItem(o.firstElementChild),o.children.length>0&&l.appendChild(o)):l.appendChild(o));s[a];)l.appendChild(s[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let s=null;return l&&(s=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(o,a,r){const c=o.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(s.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,s=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,o),o.parentNode.insertBefore(d,o),i.removeItem(o)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const o=d.lastChild,c=u.firstChild;let g=0;if(o&&c){const e=3===o.nodeType&&3===c.nodeType;g=o.textContent.length;let i=o.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===o.nodeType&&3===c.nodeType&&(o.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&o&&3===o.nodeType&&c&&3===c.nodeType&&(s[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,s[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),s},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)[^>^<]+>\s+(?=<)/gi,(function(e){return e.replace(/\n/g,"").replace(/\s+/," ")})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e]*>","gi")},createTagsBlacklist:function(e){return new RegExp("<\\/?\\b(?:\\b"+(e||"^").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},_consistencyCheckOfHTML:function(e,t,n,i){const l=[],s=[],o=[],a=[],r=this.getListChildNodes(e,function(r){if(1!==r.nodeType)return this.isList(r.parentElement)&&l.push(r),!1;if(n.test(r.nodeName)||!t.test(r.nodeName)&&0===r.childNodes.length&&this.isNotCheckingNode(r))return l.push(r),!1;const c=!this.getParentElement(r,this.isNotCheckingNode);if(!this.isTable(r)&&!this.isListCell(r)&&!this.isAnchor(r)&&(this.isFormatElement(r)||this.isRangeFormatElement(r)||this.isTextStyleElement(r))&&0===r.childNodes.length&&c)return s.push(r),!1;if(this.isList(r.parentNode)&&!this.isList(r)&&!this.isListCell(r))return o.push(r),!1;if(this.isCell(r)){const e=r.firstElementChild;if(!this.isFormatElement(e)&&!this.isRangeFormatElement(e)&&!this.isComponent(e))return a.push(r),!1}if(i&&c&&r.className){const e=new this._w.Array(r.classList).map(this._classNameFilter).join(" ").trim();e?r.className=e:r.removeAttribute("class")}return r.parentNode!==e&&c&&(this.isListCell(r)&&!this.isList(r.parentNode)||i&&(this.isFormatElement(r)||this.isComponent(r))&&!this.isRangeFormatElement(r.parentNode)&&!this.getParentElement(r,this.isComponent))}.bind(this));for(let e=0,t=l.length;e=0;l--)t.insertBefore(e,n[l]);c.push(e)}else t.parentNode.insertBefore(e,t),c.push(t);for(let e,t=0,n=c.length;t":e.innerHTML,e.innerHTML=t.outerHTML},_classNameFilter:function(e){return/(^__se__|^se-|katex)/.test(e)?e:""},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",s="";const o=(t=n+t).split(";");for(let t,n=0,a=o.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className=t._editableClass,e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,s=t.length;l'}return i+("auto"===e.height?"":"")}};var L=k,B={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor"+(t.rtl?" se-rtl":""),e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const s=this._createToolBar(n,t.buttonList,t.plugins,t),o=s.element.cloneNode(!1);o.className+=" se-toolbar-shadow",s.element.style.visibility="hidden",s.pluginCallButtons.math&&this._checkKatexMath(t.katex);const a=n.createElement("DIV");a.className="se-arrow";const r=n.createElement("DIV");r.className="se-toolbar-sticky-dummy";const c=n.createElement("DIV");c.className="se-wrapper";const d=this._initElements(t,i,s.element,a),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;const m=u.resizingBar,f=u.navigation,_=u.charWrapper,b=u.charCounter,v=n.createElement("DIV");v.className="se-loading-box sun-editor-common",v.innerHTML='
    ';const y=n.createElement("DIV");y.className="se-line-breaker",y.innerHTML='";const C=n.createElement("DIV");C.className+="se-line-breaker-component";const w=C.cloneNode(!0);C.innerHTML=w.innerHTML=t.icons.line_break;const x=n.createElement("DIV");x.className="se-resizing-back";const E=t.toolbarContainer;E&&(E.appendChild(s.element),E.appendChild(o));const S=t.resizingBarContainer;return m&&S&&S.appendChild(m),c.appendChild(p),g&&c.appendChild(g),E||(l.appendChild(s.element),l.appendChild(o)),l.appendChild(r),l.appendChild(c),l.appendChild(x),l.appendChild(v),l.appendChild(y),l.appendChild(C),l.appendChild(w),m&&!S&&l.appendChild(m),i.appendChild(l),p=this._checkCodeMirror(t,p),{constructed:{_top:i,_relative:l,_toolBar:s.element,_toolbarShadow:o,_menuTray:s._menuTray,_editorArea:c,_wysiwygArea:h,_codeArea:p,_placeholder:g,_resizingBar:m,_navigation:f,_charWrapper:_,_charCounter:b,_loading:v,_lineBreaker:y,_lineBreaker_t:C,_lineBreaker_b:w,_resizeBack:x,_stickyDummy:r,_arrow:a},options:t,plugins:s.plugins,pluginCallButtons:s.pluginCallButtons,_responsiveButtons:s.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n){this._initOptions(t.element.originElement,e);const i=t.element,l=i.relative,s=i.editorArea,o=e.toolbarContainer&&e.toolbarContainer!==n.toolbarContainer,a=e.lang!==n.lang||e.buttonList!==n.buttonList||e.mode!==n.mode||o,r=this._createToolBar(document,a?e.buttonList:n.buttonList,e.plugins,e);r.pluginCallButtons.math&&this._checkKatexMath(e.katex);const c=document.createElement("DIV");c.className="se-arrow",a&&(r.element.style.visibility="hidden",o?(e.toolbarContainer.appendChild(r.element),i.toolbar.parentElement.removeChild(i.toolbar)):i.toolbar.parentElement.replaceChild(r.element,i.toolbar),i.toolbar=r.element,i._menuTray=r._menuTray,i._arrow=c);const d=this._initElements(e,i.topArea,a?r.element:i.toolbar,c),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;return i.resizingBar&&L.removeItem(i.resizingBar),u.resizingBar&&(e.resizingBarContainer&&e.resizingBarContainer!==n.resizingBarContainer?e.resizingBarContainer.appendChild(u.resizingBar):l.appendChild(u.resizingBar)),s.innerHTML="",s.appendChild(p),g&&s.appendChild(g),p=this._checkCodeMirror(e,p),i.resizingBar=u.resizingBar,i.navigation=u.navigation,i.charWrapper=u.charWrapper,i.charCounter=u.charCounter,i.wysiwygFrame=h,i.code=p,i.placeholder=g,e.rtl?L.addClass(i.topArea,"se-rtl"):L.removeClass(i.topArea,"se-rtl"),{callButtons:r.pluginCallButtons,plugins:r.plugins,toolbar:r}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");if(l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe)l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame,l.className+=e.className;else{l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto");for(let t in e.iframeAttributes)l.setAttribute(t,e.iframeAttributes[t]);l.className+=" "+e._editableClass,l.style.cssText=e._editorStyles.frame+e._editorStyles.editor,l.className+=e.className}const s=document.createElement("TEXTAREA");s.className="se-wrapper-inner se-wrapper-code"+e.className,s.style.cssText=e._editorStyles.frame,s.style.display="none","auto"===e.height&&(s.style.overflow="hidden");let o=null,a=null,r=null,c=null;if(e.resizingBar&&(o=document.createElement("DIV"),o.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",o.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}o.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:o,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:s,placeholder:d}},_initOptions:function(e,t){const n={};if(t.plugins){const e=t.plugins,i=e.length?e:Object.keys(e).map((function(t){return e[t]}));for(let e,t=0,l=i.length;t0?t.defaultTag:"p";const i=t.textTags=[{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",sub:"SUB",sup:"SUP"},t.textTags||{}].reduce((function(e,t){for(let n in t)e[n]=t[n];return e}),{});t._textTagsMap={strong:i.bold.toLowerCase(),b:i.bold.toLowerCase(),u:i.underline.toLowerCase(),ins:i.underline.toLowerCase(),em:i.italic.toLowerCase(),i:i.italic.toLowerCase(),del:i.strike.toLowerCase(),strike:i.strike.toLowerCase(),s:i.strike.toLowerCase(),sub:i.sub.toLowerCase(),sup:i.sup.toLowerCase()},t._defaultCommand={bold:t.textTags.bold,underline:t.textTags.underline,italic:t.textTags.italic,strike:t.textTags.strike,subscript:t.textTags.sub,superscript:t.textTags.sup};t.tagsBlacklist=t.tagsBlacklist||"",t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",t._editorTagsWhitelist="*"===t.addTagsWhitelist?"*":this._setWhitelist(t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.tagsBlacklist),t.pasteTagsBlacklist=t.tagsBlacklist+(t.tagsBlacklist&&t.pasteTagsBlacklist?"|"+t.pasteTagsBlacklist:t.pasteTagsBlacklist||""),t.pasteTagsWhitelist="*"===t.pasteTagsWhitelist?"*":this._setWhitelist("string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.pasteTagsBlacklist),t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.attributesBlacklist=t.attributesBlacklist&&"object"==typeof t.attributesBlacklist?t.attributesBlacklist:null,t.mode=t.mode||"classic",t.rtl=!!t.rtl,t.lineAttrReset="string"==typeof t.lineAttrReset&&t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):null,t._editableClass="sun-editor-editable"+(t.rtl?" se-rtl":""),t._printClass="string"==typeof t._printClass?t._printClass:null,t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer="string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.hideToolbar=!!t.hideToolbar,t.fullScreenOffset=void 0===t.fullScreenOffset?0:/^\d+/.test(t.fullScreenOffset)?L.getNumber(t.fullScreenOffset,0):0,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||!!t.iframe,t.iframeAttributes=t.iframeAttributes||{},t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.previewTemplate="string"==typeof t.previewTemplate?t.previewTemplate:null,t.printTemplate="string"==typeof t.printTemplate?t.printTemplate:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.mathFontSize=t.mathFontSize?t.mathFontSize:[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.resizeEnable=void 0===t.resizeEnable||!!t.resizeEnable,t.resizingBarContainer="string"==typeof t.resizingBarContainer?document.querySelector(t.resizingBarContainer):t.resizingBarContainer,t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.className="string"==typeof t.className&&t.className.length>0?" "+t.className:"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim().toLowerCase()||"px",t.alignItems="object"==typeof t.alignItems?t.alignItems:t.rtl?["right","center","left","justify"]:["left","center","right","justify"],t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageAlignShow=void 0===t.imageAlignShow||!!t.imageAlignShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.imageGalleryHeader=t.imageGalleryHeader||null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoAlignShow=void 0===t.videoAlignShow||!!t.videoAlignShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.linkTargetNewWindow=!!t.linkTargetNewWindow,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.linkRel=Array.isArray(t.linkRel)?t.linkRel:[],t.linkRelDefault=t.linkRelDefault||{},t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)?t.shortcutsDisable:[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.mediaAutoSelect=void 0===t.mediaAutoSelect||!!t.mediaAutoSelect,t.buttonList=t.buttonList?t.buttonList:[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.rtl&&(t.buttonList=t.buttonList.reverse()),t.icons=t.icons&&"object"==typeof t.icons?[S,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):S,t.icons=t.rtl?[t.icons,t.icons.rtl].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):t.icons,t.__listCommonStyle=t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"],t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_setWhitelist:function(e,t){if("string"!=typeof t)return e;t=t.split("|"),e=e.split("|");for(let n,i=0,l=t.length;i-1&&e.splice(n,1);return e.join("|")},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=L.isOSX_IOS?"⇧":"+SHIFT",s=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent","save"],o=e.rtl?["[","]"]:["]","["],a=e.rtl?[t.outdent,t.indent]:[t.indent,t.outdent];return{bold:["",n.toolbar.bold+''+(s.indexOf("bold")>-1?"":i+'+B')+"","bold","",t.bold],underline:["",n.toolbar.underline+''+(s.indexOf("underline")>-1?"":i+'+U')+"","underline","",t.underline],italic:["",n.toolbar.italic+''+(s.indexOf("italic")>-1?"":i+'+I')+"","italic","",t.italic],strike:["",n.toolbar.strike+''+(s.indexOf("strike")>-1?"":i+l+'+S')+"","strike","",t.strike],subscript:["",n.toolbar.subscript,"SUB","",t.subscript],superscript:["",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["",n.toolbar.indent+''+(s.indexOf("indent")>-1?"":i+'+'+o[0]+"")+"","indent","",a[0]],outdent:["",n.toolbar.outdent+''+(s.indexOf("indent")>-1?"":i+'+'+o[1]+"")+"","outdent","",a[1]],fullScreen:["se-code-view-enabled se-resizing-enabled",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled",n.toolbar.codeView,"codeView","",t.code_view],undo:["",n.toolbar.undo+''+(s.indexOf("undo")>-1?"":i+'+Z')+"","undo","",t.undo],redo:["",n.toolbar.redo+''+(s.indexOf("undo")>-1?"":i+'+Y / '+i+l+'+Z')+"","redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],dir:["",n.toolbar[e.rtl?"dir_ltr":"dir_rtl"],"dir","",t[e.rtl?"dir_ltr":"dir_rtl"]],dir_ltr:["",n.toolbar.dir_ltr,"dir_ltr","",t.dir_ltr],dir_rtl:["",n.toolbar.dir_rtl,"dir_rtl","",t.dir_rtl],save:["se-resizing-enabled",n.toolbar.save+''+(s.indexOf("save")>-1?"":i+'+S')+"","save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",e.rtl?t.align_right:t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,s,o){const a=L.createElement("LI"),r=L.createElement("BUTTON"),c=t||n;return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("aria-label",c.replace(//,"")),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=o[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+c+"",s&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const s=e.createElement("DIV");s.className="se-toolbar sun-editor-common";const o=e.createElement("DIV");o.className="se-btn-tray",s.appendChild(o),t=JSON.parse(JSON.stringify(t));const a=i.icons,r=this._defaultButtons(i),c={},d=[];let u=null,h=null,g=null,p=null,m="",f=!1;const _=L.createElement("DIV");_.className="se-toolbar-more-layer";e:for(let i,s,b,v,y,C=0;C",_.appendChild(s),s=s.firstElementChild.firstElementChild)}if(f){const e=l.cloneNode(!1);o.appendChild(e)}o.appendChild(g.div),f=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",o.appendChild(t),f=!1}switch(o.children.length){case 0:o.style.display="none";break;case 1:L.removeClass(o.firstElementChild,"se-btn-module-border");break;default:if(i.rtl){const e=l.cloneNode(!1);e.style.float=o.lastElementChild.style.float,o.appendChild(e)}}d.length>0&&d.unshift(t),_.children.length>0&&o.appendChild(_);const b=e.createElement("DIV");b.className="se-menu-tray",s.appendChild(b);const v=e.createElement("DIV");return v.className="se-toolbar-cover",s.appendChild(v),i.hideToolbar&&(s.style.display="none"),{element:s,plugins:n,pluginCallButtons:c,responsiveButtons:d,_menuTray:b,_buttonTray:o}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_toolbarShadow:t._toolbarShadow,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector('[data-command="bold"]'),underline:t._toolBar.querySelector('[data-command="underline"]'),italic:t._toolBar.querySelector('[data-command="italic"]'),strike:t._toolBar.querySelector('[data-command="strike"]'),sub:t._toolBar.querySelector('[data-command="SUB"]'),sup:t._toolBar.querySelector('[data-command="SUP"]'),undo:t._toolBar.querySelector('[data-command="undo"]'),redo:t._toolBar.querySelector('[data-command="redo"]'),save:t._toolBar.querySelector('[data-command="save"]'),outdent:t._toolBar.querySelector('[data-command="outdent"]'),indent:t._toolBar.querySelector('[data-command="indent"]'),fullScreen:t._toolBar.querySelector('[data-command="fullScreen"]'),showBlocks:t._toolBar.querySelector('[data-command="showBlocks"]'),codeView:t._toolBar.querySelector('[data-command="codeView"]'),dir:t._toolBar.querySelector('[data-command="dir"]'),dir_ltr:t._toolBar.querySelector('[data-command="dir_ltr"]'),dir_rtl:t._toolBar.querySelector('[data-command="dir_rtl"]')},options:n,option:n}},z={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},M={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=B.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,s){const o=e.element.originElement.ownerDocument||document,a=o.defaultView||window,r=L,c=l.icons,d={_d:o,_w:a,_parser:new a.DOMParser,_prevRtl:l.rtl,_editorHeight:0,_editorHeightPadding:0,_listCamel:l.__listCommonStyle,_listKebab:r.camelToKebabCase(l.__listCommonStyle),_wd:null,_ww:null,_shadowRoot:null,_shadowRootControllerEventTarget:null,util:r,functions:null,options:null,wwComputedStyle:null,notice:z,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:[],resizingDisabledButtons:[],_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_htmlCheckBlacklistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,editorTagsBlacklistRegExp:null,pasteTagsWhitelistRegExp:null,pasteTagsBlacklistRegExp:null,hasFocus:!1,isDisabled:!1,isReadOnly:!1,_attributesWhitelistRegExp:null,_attributesWhitelistRegExp_all_data:null,_attributesBlacklistRegExp:null,_attributesTagsWhitelist:null,_attributesTagsBlacklist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:{},_commandMapStyles:{STRONG:["font-weight"],U:["text-decoration"],EM:["font-style"],DEL:["text-decoration"]},_styleCommandMap:null,_cleanStyleRegExp:{span:new a.RegExp("\\s*[^-a-zA-Z](font-family|font-size|color|background-color)\\s*:[^;]+(?!;)*","ig"),format:new a.RegExp("\\s*[^-a-zA-Z](text-align|margin-left|margin-right)\\s*:[^;]+(?!;)*","ig"),fontSizeUnit:new a.RegExp("\\d+"+l.fontSizeUnit+"$","i")},_variable:{isChanged:!1,isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:2,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},_formatAttrsTemp:null,_saveButtonStates:function(){this.allCommandButtons||(this.allCommandButtons={});const e=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let t,n,i=0;ie?c-e:0,l=i>0?0:e-c;n.style.left=d-i+l+"px",o.left>u._getEditorOffsets(n).left&&(n.style.left="0px")}else{const e=s<=c?0:s-(d+c);n.style.left=e<0?d+e+"px":d+"px"}let h=0,g=t;for(;g&&g!==i;)h+=g.offsetTop,g=g.offsetParent;const p=h;this._isBalloon?h+=i.offsetTop+t.offsetHeight:h-=t.offsetHeight;const m=o.top,f=n.offsetHeight,_=this.getGlobalScrollOffset().top,b=a.innerHeight-(m-_+p+t.parentElement.offsetHeight);if(bb?(n.style.height=l+"px",e=-1*(l-p+3)):(n.style.height=b+"px",e=p+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=p+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0)for(let e=0;e0){for(let e=0;eu?d-u:0,i=n>0?0:u-d;t.style.left=c-n+i+"px",n>0&&h&&(h.style.left=(d-14<10+n?d-14:10+n)+"px");const l=e.element.wysiwygFrame.offsetLeft-t.offsetLeft;l>0&&(t.style.left="0px",h&&(h.style.left=l+"px"))}else{t.style.left=c+"px";const n=e.element.wysiwygFrame.offsetWidth-(t.offsetLeft+d);n<0?(t.style.left=t.offsetLeft+n+"px",h&&(h.style.left=20-n+"px")):h&&(h.style.left="20px")}t.style.visibility=""},execCommand:function(e,t,n){this._wd.execCommand(e,t,"formatBlock"===e?"<"+n+">":n),this.history.push(!0)},nativeFocus:function(){this.__focus(),this._editorRange()},__focus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const n=t.commonAncestorContainer.children[t.startOffset];if(!r.isFormatElement(n)&&!r.isComponent(n)){const t=r.createElement(l.defaultTag),i=r.createElement("BR");return t.appendChild(i),e.element.wysiwyg.insertBefore(t,n),void this.setRange(i,0,i,0)}}this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},blur:function(){l.iframe?e.element.wysiwygFrame.blur():e.element.wysiwyg.blur()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length),r.isFormatElement(e)&&(e=e.childNodes[t]||e.childNodes[t-1]||e,t=t>0?1===e.nodeType?1:e.textContent?e.textContent.length:0:0),r.isFormatElement(n)&&(n=n.childNodes[i]||n.childNodes[i-1]||n,i=i>0?1===n.nodeType?1:n.textContent?n.textContent.length:0:0);const s=this._wd.createRange();try{s.setStart(e,t),s.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const o=this.getSelection();return o.removeAllRanges&&o.removeAllRanges(),o.addRange(s),this._rangeInfo(s,this.getSelection()),l.iframe&&this.__focus(),s},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.hasFocus&&this.getSelection().removeAllRanges(),this._setKeyEffect([])},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,s=r.compareElements(e,t),o=s.ancestor&&(0===s.result?i<=l:s.result>1);return this.setRange(o?e:t,o?i:l,o?t:e,o?l:i)}},getRange_addLine:function(t,n){if(this._selectionVoid(t)){const i=e.element.wysiwyg,s=r.createElement(l.defaultTag);s.innerHTML="
    ",i.insertBefore(s,n&&n!==i?n.nextElementSibling:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){const t=this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection();return this._variable._range||e.element.wysiwyg.contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t},getSelectionNode:function(){if(e.element.wysiwyg.contains(this._variable._selectionNode)||this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),r.isFormatElement(t.endContainer)&&0===t.endOffset&&(t=this.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.length)),this._rangeInfo(t,e)},_rangeInfo:function(e,t){let n=null;this._variable._range=e,n=e.collapsed?r.isWysiwygDiv(e.commonAncestorContainer)&&e.commonAncestorContainer.children[e.startOffset]||e.commonAncestorContainer:t.extentNode||t.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg,n=this._wd.createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=r.createElement("BR"),i.appendChild(s))):(i=r.createElement(l.defaultTag),s=r.createElement("BR"),i.appendChild(s),t.appendChild(i)),n.setStart(s,0),n.setEnd(s,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,s,o=t.startContainer,a=t.startOffset,c=t.endContainer,d=t.endOffset;if(r.isFormatElement(o))for(o.childNodes[a]?(o=o.childNodes[a]||o,a=0):(o=o.lastChild||o,a=o.textContent.length);o&&1===o.nodeType&&o.firstChild;)o=o.firstChild||o,a=0;if(r.isFormatElement(c)){for(c=c.childNodes[d]||c.lastChild||c;c&&1===c.nodeType&&c.lastChild;)c=c.lastChild;d=c.textContent.length}if(n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=a,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===c&&(c=n,d=1)}}if(o=n,a=i,n=r.isWysiwygDiv(c)?e.element.wysiwyg.lastChild:c,i=d,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(s=n.childNodes,0!==s.length);)n=s[i>0?i-1:i]||!/FIGURE/i.test(s[0].nodeName)?s[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(c)}}return c=n,d=i,this.setRange(o,a,c,d),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,s=n.commonAncestorContainer,o=r.getListChildren(s,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(s)||r.isRangeFormatElement(s)||o.unshift(r.getFormatElement(s,null)),i===l||1===o.length)return o;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=o.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t,n){return"end"!==n&&0===t||(!n||"front"!==n)&&!e.nodeValue&&1===t||(!n||"end"===n)&&!!e.nodeValue&&t===e.nodeValue.length},_isEdgeFormat:function(e,t,n){if(!this.isEdgePoint(e,t,n))return!1;const i=[];for(n="front"===n?"previousSibling":"nextSibling";e&&!r.isFormatElement(e)&&!r.isWysiwygDiv(e);){if(e[n]&&(!r.isBreak(e[n])||e[n][n]))return null;1===e.nodeType&&i.push(e.cloneNode(!1)),e=e.parentNode}return i},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){if(!e||!e.parentNode)return null;const n=r.getFormatElement(this.getSelectionNode(),null);let i=null;if(!r.isFormatElement(e)&&r.isFreeFormatElement(n||e.parentNode))i=r.createElement("BR");else{const e=t?"string"==typeof t?t:t.nodeName:!r.isFormatElement(n)||r.isRangeFormatElement(n)||r.isFreeFormatElement(n)?l.defaultTag:n.nodeName;i=r.createElement(e),i.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(i,t||n,["id"])}return r.isCell(e)?e.insertBefore(i,e.nextElementSibling):e.parentNode.insertBefore(i,e.nextElementSibling),i},insertComponent:function(e,t,n,i){if(this.isReadOnly||n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange(),l.container);let s=null,o=this.getSelectionNode(),a=r.getFormatElement(o,null);if(r.isListCell(a))this.insertNode(e,o===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));s=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),s&&(a=s.previousSibling)}this.insertNode(e,r.isRangeFormatElement(a)?null:a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){this.setRange(e,0,e,0);const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):s&&(s=r.getEdgeChildNodes(s,null).sc||s,this.setRange(s,0,s,0))}return t||this.history.push(1),s||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){if(r.isUneditableComponent(r.getParentElement(e,r.isComponent))||r.isUneditableComponent(e))return!1;this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,s="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,o=r.isListCell(n.parentNode);let a,c,d;(o?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(s).left+d+"px",i.display="block"),(o?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2),l.top=a+s.offsetHeight-c-12+"px",l.left=r.getOffset(s).left+s.offsetWidth-d-24+"px",l.display="block")},_checkDuplicateNode:function(e,t){!function e(n){d._dupleCheck(n,t);const i=n.childNodes;for(let t=0,n=i.length;t-1&&n.splice(e,1);for(let t=0,n=s.classList.length;t_?m.splitText(_):m.nextSibling;else if(r.isBreak(s))n=s,s=s.parentNode;else{let e=s.childNodes[f];const i=e&&3===e.nodeType&&r.onlyZeroWidthSpace(e)&&r.isBreak(e.nextSibling)?e.nextSibling:e;i?!i.nextSibling&&r.isBreak(i)?(s.removeChild(i),n=null):n=r.isBreak(i)&&!r.isBreak(t)?i:i.nextSibling:n=null}else{if(v===y){n=this.isEdgePoint(y,_)?y.nextSibling:y.splitText(_);let e=v;this.isEdgePoint(v,f)||(e=v.splitText(f)),s.removeChild(e),0===s.childNodes.length&&p&&(s.innerHTML="
    ")}else{const e=this.removeNode(),i=e.container,o=e.prevContainer;if(i&&0===i.childNodes.length&&p&&(r.isFormatElement(i)?i.innerHTML="
    ":r.isRangeFormatElement(i)&&(i.innerHTML="<"+l.defaultTag+">
    ")),r.isListCell(i)&&3===t.nodeType)s=i,n=null;else if(!p&&o)if(s=3===o.nodeType?o.parentNode:o,s.contains(i)){let e=!0;for(n=i;n.parentNode&&n.parentNode!==s;)n=n.parentNode,e=!1;e&&i===o&&(n=n.nextSibling)}else n=null;else r.isWysiwygDiv(i)&&!r.isFormatElement(t)?(s=i.appendChild(r.createElement(l.defaultTag)),n=null):s=(n=p?y:i===o?i.nextSibling:i)&&n.parentNode?n.parentNode:m;for(;n&&!r.isFormatElement(n)&&n.parentNode!==m;)n=n.parentNode}}try{if(!u){if((r.isWysiwygDiv(n)||s===e.element.wysiwyg.parentNode)&&(s=e.element.wysiwyg,n=null),r.isFormatElement(t)||r.isRangeFormatElement(t)||!r.isListCell(s)&&r.isComponent(t)){const e=s;if(r.isList(n))s=n,n=null;else if(r.isListCell(n))s=n.previousElementSibling||n;else if(!o&&!n){const e=this.removeNode(),t=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(t)||r.isRangeFormatElement(t);s=i?t:t.parentNode,n=i?null:t.nextSibling}0===e.childNodes.length&&s!==e&&r.removeItem(e)}if(!p||g||r.isRangeFormatElement(s)||r.isListCell(s)||r.isWysiwygDiv(s)||(n=s.nextElementSibling,s=s.parentNode),r.isWysiwygDiv(s)&&(3===t.nodeType||r.isBreak(t))){const e=r.createElement(l.defaultTag);e.appendChild(t),t=e}}if(u?h.parentNode?(s=h,n=a):(s=e.element.wysiwyg,n=null):n=s===n?s.lastChild:n,r.isListCell(t)&&!r.isList(s)){if(r.isListCell(s))n=s.nextElementSibling,s=s.parentNode;else{const e=r.createElement("ol");s.insertBefore(e,n),s=e,n=null}u=!0}if(this._checkDuplicateNode(t,s),s.insertBefore(t,n),u)if(r.onlyZeroWidthSpace(d.textContent.trim()))r.removeItem(d),t=t.lastChild;else{const e=r.getArrayItem(d.children,r.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(s.appendChild(t),t=s),r.onlyZeroWidthSpace(d.textContent.trim())&&r.removeItem(d))}}catch(e){s.appendChild(t),console.warn("[SUNEDITOR.insertNode.warn] "+e)}finally{const e=s.querySelectorAll("[data-se-duple]");if(e.length>0)for(let n,i,l,s,o=0,a=e.length;o0&&(t.textContent=i+t.textContent,r.removeItem(e)),n&&n.length>0&&(t.textContent+=l,r.removeItem(n));const s={container:t,startOffset:i.length,endOffset:t.textContent.length-l.length};return this.setRange(t,s.startOffset,t,s.endOffset),s}if(!r.isBreak(t)&&!r.isListCell(t)&&r.isFormatElement(s)){let n=null;t.previousSibling&&!r.isBreak(t.previousSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t)),t.nextSibling&&!r.isBreak(t.nextSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t.nextSibling)),r._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0)}this.setRange(t,e,t,e)}return this.history.push(!0),t}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode();const t=this.getRange();let n,i=0,l=t.startContainer,s=t.endContainer,o=t.startOffset,a=t.endOffset;const c=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===l.parentNode?l.parentNode:t.commonAncestorContainer;if(c===l&&c===s&&(l=c.children[o],s=c.children[a],o=a=0),!l||!s)return{container:c,offset:0};if(l===s&&t.collapsed&&l.textContent&&r.onlyZeroWidthSpace(l.textContent.substr(o)))return{container:l,offset:o,prevContainer:l&&l.parentNode?l:null};let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,s);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===o&&(g=e,t=t.parentNode);for(let e=p-1,t=s;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};if(3===c.nodeType)return{container:c,offset:a};h.push(c),l=s=c}else if(l=s=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:r.isMedia(c)?c:l,offset:0};g=p=0}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)this._nodeRemoveListItem(t);else if(t!==l)if(t!==s)this._nodeRemoveListItem(t);else{if(1===s.nodeType){if(r.isComponent(s))continue;u=r.createTextNode(s.textContent)}else u=r.createTextNode(s.substringData(a,s.length-a));u.length>0?s.data=u.data:this._nodeRemoveListItem(s)}else{if(1===l.nodeType){if(r.isComponent(l))continue;d=r.createTextNode(l.textContent)}else t===s?(d=r.createTextNode(l.substringData(0,o)+s.substringData(a,s.length-a)),i=o):d=r.createTextNode(l.substringData(0,o));if(d.length>0?l.data=d.data:this._nodeRemoveListItem(l),t===s)break}}const m=r.getParentElement(s,"ul"),f=r.getParentElement(l,"li");if(m&&f&&f.contains(m)?(n=m.previousSibling,i=n.textContent.length):n=s&&s.parentNode?s:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)&&0===n.childNodes.length){const t=r.removeItemAllParents(n,null,null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},_nodeRemoveListItem:function(e){const t=r.getFormatElement(e,null);r.removeItem(e),r.isListCell(t)&&(r.removeItemAllParents(t,null,null),t&&r.isList(t.firstChild)&&t.insertBefore(r.createTextNode(r.zeroWidthSpace),t.firstChild))},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange(),null);const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,s,o,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,s=t.indexOf(i),o=t.indexOf(l),t.splice(s,o-s+1),c=t.length}else;let n,i,l,s=t[t.length-1];n=r.isRangeFormatElement(s)||r.isFormatElement(s)?s:r.getRangeFormatElement(s,null)||r.getFormatElement(s,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let o=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,s,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],s=n.parentNode,s&&!e.contains(s))if(u=r.getElementDepth(n),r.isList(s)){if(null===a&&(p?(a=p,m=!0,p=null):a=s.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==s){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=s.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(s,c,null,!0,!0);o>=u?(o=u,l=_.cc,i=d(l,s,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(o=u,l=s,i=n.nextSibling),e.appendChild(n),l!==s&&(h=d(l,s),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,s){const o=this.getRange();let a=o.startOffset,c=o.endOffset,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),u=e.parentNode,h=null,g=null,p=e.cloneNode(!1);const m=[],f=r.isList(n);let _=!1,b=!1,v=!1;function y(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace,a=c=1),3===n.nodeType)return t.insertBefore(n,i),n;const s=(v?n:l).childNodes;let o=n.cloneNode(!1),d=null,u=null;for(;s[0];)u=s[0],!r._notTextNode(u)||r.isBreak(u)||r.isListCell(o)?o.appendChild(u):(o.childNodes.length>0&&(d||(d=o),t.insertBefore(o,i),o=n.cloneNode(!1)),t.insertBefore(u,i),d||(d=u));if(o.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(o)&&r.isList(i))if(f){for(d=i;i;)o.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(o,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=o.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,b=!0}}else t.insertBefore(o,i);d||(d=o)}return d}for(let s,o,a,c=0,C=d.length;c0&&(u.insertBefore(p,e),p=null),!f&&r.isListCell(s))if(a&&r.getElementDepth(s)!==r.getElementDepth(a)&&(r.isListCell(u)||r.getArrayItem(s.children,r.isList,!1))){const t=s.nextElementSibling,n=r.detachNestedList(s,!1);e===n&&t===s.nextElementSibling||(e=n,b=!0)}else{const t=s;s=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":l.defaultTag);const n=r.isListCell(s),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)s.appendChild(o[0]);r.copyFormatAttributes(s,t),v=!0}else s=s.cloneNode(!1);if(!b&&(i?(m.push(s),r.removeItem(d[c])):(n?(_||(u.insertBefore(n,e),_=!0),s=y(n,s,null,d[c])):s=y(u,s,e,d[c]),b||(t?(g=s,h||(h=s)):h||(h=g=s))),b)){b=v=!1,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),p=e.cloneNode(!1),u=e.parentNode,c=-1,C=d.length;continue}}const C=e.parentNode;let w=e.nextSibling;p&&p.children.length>0&&C.insertBefore(p,w),n?h=n.previousSibling:h||(h=e.previousSibling),w=e.nextSibling!==p?e.nextSibling:p?p.nextSibling:null,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null,!1);let x=null;if(i)x={cc:C,sc:h,so:a,ec:w,eo:c,removeArray:m};else{h||(h=g),g||(g=h);const e=r.getEdgeChildNodes(h,g.parentNode?h:g);x={cc:(e.sc||e.ec).parentNode,sc:e.sc,so:a,ec:e.ec,eo:c,removeArray:null}}if(this.effectNode=null,s)return x;!i&&x&&(t?this.setRange(x.sc,a,x.ec,c):this.setRange(x.sc,0,x.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,s=null,o=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const s=!e,o=s&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(o&&l.collapsed&&r.isFormatElement(c.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c)){const e=c.parentNode;if(!r.isListCell(e)||!r.getValues(e.style).some(function(e){return this._listKebab.indexOf(e)>-1}.bind(this)))return}if(l.collapsed&&!o&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),s&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!o&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!s||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=o||s&&function(e){for(let t=0,n=e.length;t0&&this._resetCommonListCell(E[N],t)&&(n=!0),this._resetCommonListCell(E[0],t)&&(n=!0),n&&this.setRange(c,d,u,h),N>0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,o,s,w,L,B));for(let n,i=N-1;i>0;i--)this._resetCommonListCell(E[i],t),m=e.cloneNode(!1),n=this._nodeChange_middleLine(E[i],m,x,o,s,w,_.container),n.endContainer&&n.ancestor.contains(n.endContainer)&&(_.ancestor=null,_.container=n.endContainer),this._setCommonListStyle(n.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,o,s,w,L,B,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_resetCommonListCell:function(e,t){if(!r.isListCell(e))return;t||(t=this._listKebab);const n=r.getArrayItem(e.childNodes,(function(e){return!r.isBreak(e)}),!0),i=e.style,s=[],o=[],a=r.getValues(i);for(let e=0,n=this._listKebab.length;e-1&&t.indexOf(this._listKebab[e])>-1&&(s.push(this._listCamel[e]),o.push(this._listKebab[e]));if(!s.length)return;const c=r.createElement("SPAN");for(let e=0,t=s.length;e0&&(e.insertBefore(d,u),d=c.cloneNode(!1),u=null,h=!0));return d.childNodes.length>0&&(e.insertBefore(d,u),h=!0),i.length||e.removeAttribute("style"),h},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)}),!0);if(!(t=n[0])||n.length>1||1!==t.nodeType)return;const i=t.style,s=e.style,o=t.nodeName.toLowerCase();let a=!1;l._textTagsMap[o]===l._defaultCommand.bold.toLowerCase()&&(s.fontWeight="bold"),l._textTagsMap[o]===l._defaultCommand.italic.toLowerCase()&&(s.fontStyle="italic");const c=r.getValues(i);if(c.length>0)for(let e=0,t=this._listCamel.length;e-1&&(s[this._listCamel[e]]=i[this._listCamel[e]],i.removeProperty(this._listKebab[e]),a=!0);if(this._setCommonListStyle(e,t),a&&!i.length){const e=t.childNodes,n=t.parentNode,i=t.nextSibling;for(;e.length>0;)n.insertBefore(e[0],i);r.removeItem(t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,s,o,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===s.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(s.textContent.slice(o))){const n=m.childNodes;let a=!0;for(let e,t,l,o,c=0,d=n.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o=N?k-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(s)||l.appendChild(s);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||o;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=o,N=0,L=!0,C!==o&&C.appendChild(S),!v)continue}if(B||a!==T){if(L){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const s=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=B?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||s.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(s);const o=y.pop()||a;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!p(t.parentNode)||p(o)||r.onlyZeroWidthSpace(t)||(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),B||E||!p(o))o===a?l=B?b:t:B?(b.appendChild(o),l=C):(t.appendChild(o),l=C);else{t=t.cloneNode(!1);const e=o.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(k,T.length-k)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,k));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const s=y.pop()||l;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(s),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(s),T=l,k=l.data.length,B=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:s,endOffset:o};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t,!1),u&&(N=S.textContent.length,k=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),k=M?T.textContent.length:k;const I={s:0,e:0},H=r.getNodePath(S,b,I),R=!T.parentNode;R&&(T=S);const O={s:0,e:0},D=r.getNodePath(T,b,R||M?null:O);N+=I.s,k=u?N:R?S.textContent.length:M?k+I.s:k+O.s;const F=r.mergeSameTags(b,[H,D],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(H,b),T=r.getNodeFromPath(D,b),{ancestor:b,startContainer:S,startOffset:N+F[0],endContainer:T,endOffset:k+F[1]}},_nodeChange_startLine:function(e,t,n,i,l,s,o,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!o&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,s=i.previousSibling;for(;s;){if(!r.onlyZeroWidthSpace(s)){n=!1;break}s=s.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const s=i.childNodes;for(let i,o,a=0,h=s.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=o,C=0,w=!0,l.appendChild(y)}}}(e,m),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(s=s&&o)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}s.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const s=i.childNodes;for(let i,u,h=0,g=s.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,o&&g.contains(o)){const e=r.getNodePath(o,g);o=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!s.v)return{ancestor:e,endContainer:o};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else o?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),s=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const o=m.pop()||l;for(_=f=o;m.length>0;)f=m.pop(),_.appendChild(f),_=f;o!==l?(t.insertBefore(o,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=s,y=s.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l};if(s=s&&o)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,this._commandMapStyles[n]||null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],s="indent"!==e,o=l.rtl?"marginRight":"marginLeft";let a=t.startContainer,c=t.endContainer,d=t.startOffset,u=t.endOffset;for(let e,t,l=0,a=n.length;l0&&this.plugins.list.editInsideList.call(this,s,i),this.effectNode=null,this.setRange(a,d,c,u),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(r.isNonEditable(e.element.wysiwygFrame)||this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),r.isNonEditable(e.element.wysiwygFrame)||(this.history.push(!1),this.history._resetCachingButton())):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable.isFullScreen?e.element.code.style.height="100%":"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),this.isReadOnly&&r.setDisabledButtons(!0,this.resizingDisabledButtons),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"<"+l.defaultTag+">
    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg,!1);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,s=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff();const m="none"===i.style.display||this._isInline&&!this._inlineToolbarAttr.isShow;p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",s.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,o.body.style.overflow=p._bodyOverflow,"auto"!==l.height||l.codeMirrorEditor||u._codeViewAutoHeight(),l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),t&&r.changeElement(t.firstElementChild,c.expansion),e.element.topArea.style.marginTop="",r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,s),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=o.body.style.overflow,o.body.style.overflow="hidden",p._editorAreaOriginCssText=s.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,s.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+l._editorStyles.editor,g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,s.style.height=p.innerHeight_fullScreen-l.fullScreenOffset+"px",t&&r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(s.style.overflow="auto",this._iframeAutoHeight()),e.element.topArea.style.marginTop=l.fullScreenOffset+"px",r.addClass(this._styleCommandMap.fullScreen,"active")),m&&h.toolbar.hide(),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",o.body.appendChild(e);const t=l.printTemplate?l.printTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),n=r.getIframeDocument(e),i=this._wd;if(l.iframe){const e=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="'+l._editableClass+'"';n.write(""+i.head.innerHTML+""+t+"")}else{const e=o.head.getElementsByTagName("link"),i=o.head.getElementsByTagName("style");let s="";for(let t=0,n=e.length;t"+s+''+t+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||r.isChromium||o.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const e=l.previewTemplate?l.previewTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),t=a.open("","_blank");t.mimeType="text/html";const n=this._wd;if(l.iframe){const i=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(n.body,["contenteditable"]):'class="'+l._editableClass+'"';t.document.write(""+n.head.innerHTML+""+e+"")}else{const n=o.head.getElementsByTagName("link"),s=o.head.getElementsByTagName("style");let a="";for(let e=0,t=n.length;e'+i.toolbar.preview+""+a+''+e+"")}},setDir:function(t){const n="rtl"===t,s=this._prevRtl!==n;this._prevRtl=l.rtl=n,s&&(this.plugins.align&&this.plugins.align.exchangeDir.call(this),e.tool.indent&&r.changeElement(e.tool.indent.firstElementChild,c.indent),e.tool.outdent&&r.changeElement(e.tool.outdent.firstElementChild,c.outdent));const o=e.element;n?(r.addClass(o.topArea,"se-rtl"),r.addClass(o.wysiwygFrame,"se-rtl")):(r.removeClass(o.topArea,"se-rtl"),r.removeClass(o.wysiwygFrame,"se-rtl"));const a=r.getListChildren(o.wysiwyg,(function(e){return r.isFormatElement(e)&&(e.style.marginRight||e.style.marginLeft||e.style.textAlign)}));for(let e,t,n,i=0,l=a.length;i[\s\S]*<\/script>/gi,"")),e.body&&(this._wd.body.innerHTML=this.convertContentsForEditor(e.body)),this._resetComponents()},getContents:function(t){const n=this.cleanHTML(e.element.wysiwyg.innerHTML,null,null),i=r.createElement("DIV");i.innerHTML=n;const s=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=s.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},getFullContents:function(e){return'
    '+this.getContents(e)+"
    "},_makeLine:function(e,t){const n=l.defaultTag;if(1===e.nodeType){if(r._disallowedTags(e))return"";if(/__se__tag/.test(e.className))return e.outerHTML;const i=r.getListChildNodes(e,(function(e){return r.isSpanWithoutAttr(e)&&!r.getParentElement(e,r.isNotCheckingNode)}))||[];for(let e=i.length-1;e>=0;e--)i[e].outerHTML=i[e].innerHTML;return!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML:"<"+n+">"+(r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML)+""}if(3===e.nodeType){if(!t)return r._HTMLConvertor(e.textContent);const i=e.textContent.split(/\n/g);let l="";for(let e,t=0,s=i.length;t0&&(l+="<"+n+">"+r._HTMLConvertor(e)+"");return l}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t=l._textTagsMap;return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i,l){return n+("string"==typeof t[i]?t[i]:i)+(l?" "+l:"")}))},_deleteDisallowedTags:function(e){return e=e.replace(/<(script|style)[\s\S]*>[\s\S]*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,""),/\bfont\b/i.test(this.options._editorTagsWhitelist)||(e=e.replace(/(<\/?)font(\s?)/gi,"$1span$2")),e.replace(this.editorTagsWhitelistRegExp,"").replace(this.editorTagsBlacklistRegExp,"")},_convertFontSize:function(e,t){const n=this._w.Math,i=t.match(/(\d+(?:\.\d+)?)(.+)/),l=i?1*i[1]:r.fontValueMap[t],s=i?i[2]:"rem";let o=l;switch(/em/.test(s)?o=n.round(l/.0625):"pt"===s?o=n.round(1.333*l):"%"===s&&(o=l/100),e){case"em":case"rem":case"%":return(.0625*o).toFixed(2)+e;case"pt":return n.floor(o/1.333)+e;default:return o+e}},_cleanStyle:function(e,t,n){let i=(e.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(/span/i.test(n)&&!i&&(e.match(/0&&t.push('style="'+n.join(";")+'"')}}return t},_cleanTags:function(e,t,n){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(t))return t;let i=null;const l=n.match(/(?!<)[a-zA-Z0-9\-]+/)[0].toLowerCase(),s=this._attributesTagsBlacklist[l];t=t.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),t=s?t.replace(s,""):t.replace(this._attributesBlacklistRegExp,"");const o=this._attributesTagsWhitelist[l];if(i=o?t.match(o):t.match(e?this._attributesWhitelistRegExp:this._attributesWhitelistRegExp_all_data),e||"span"===l)if("a"===l){const e=t.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);e&&(i||(i=[]),i.push(e[0]))}else i&&/style=/i.test(i.toString())||("span"===l?i=this._cleanStyle(t,i,"span"):/^(P|DIV|H[1-6]|PRE)$/i.test(l)&&(i=this._cleanStyle(t,i,"format")));else{const e=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);e&&!i?i=[e[0]]:e&&!i.some((function(e){return/^style/.test(e.trim())}))&&i.push(e[0])}if(r.isFigures(l)){let e="",n="";const l=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);if(i||(i=[]),l){i.push(l[0]);let t="",s="",o="",a="";t=l[0].match(/width:(.+)px;/),t=r.getNumber(t?t[1]:"",-1)||null,s=l[0].match(/height:(.+)px;/),s=r.getNumber(s?s[1]:"",-1)||null,o=l[0].match(/width:(.+)%;/),o=r.getNumber(o?o[1]:"",-1)||null,a=l[0].match(/height:(.+)%;/),a=r.getNumber(a?a[1]:"",-1)||null,e=t||o,n=s||a}if(!e||!n){const i=t.match(/width\s*=\s*((?:"|')[^"']*(?:"|'))/),l=t.match(/height\s*=\s*((?:"|')[^"']*(?:"|'))/);(i||l)&&(e=e||(r.getNumber(i?i[1]:"")||""),n=n||(r.getNumber(l?l[1]:"")||""))}i.push('data-origin="'+e+","+n+'"')}if(i)for(let e=0,t=i.length;e"+(n.innerHTML.trim()||"
    ")+"":r.isRangeFormatElement(n)&&!r.isTable(n)?t+=this._convertListCell(n):t+="
  • "+n.outerHTML+"
  • ":t+="
  • "+(n.textContent||"
    ")+"
  • ";return t},_isFormatData:function(e){let t=!1;for(let n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!0));const i=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(i,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!0)}catch(e){console.warn("[SUNEDITOR.cleanHTML.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=i.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!1));const t=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(t,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!1)}catch(e){console.warn("[SUNEDITOR.convertContentsForEditor.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=t.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i
    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e,t){let n="";const i=a.RegExp,l=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),s="string"==typeof e?o.createRange().createContextualFragment(e):e,c=function(e){return this.isFormatElement(e)||this.isComponent(e)}.bind(r),d=t?"":"\n";let u=t?0:1*this._variable.codeIndent;return u=u>0?new a.Array(u+1).join(" "):"",function e(t,s){const o=t.childNodes,h=l.test(t.nodeName),g=h?s:"";for(let p,m,f,_,b,v,y=0,C=o.length;y]*>","i"))[0]+m,e(p,s+u),n+=(/\n$/.test(n)?v:"")+""+(f||m||h||/^(TH|TD)$/i.test(p.nodeName)?d:"")):n+=(new a.XMLSerializer).serializeToString(p):n+=(/^HR$/i.test(p.nodeName)?d:"")+(/^PRE$/i.test(p.parentElement.nodeName)&&/^BR$/i.test(p.nodeName)?"":g)+p.outerHTML+m:r.isList(p.parentElement)||(n+=r._HTMLConvertor(/^\n+$/.test(p.data)?"":p.data)):n+="\n\x3c!-- "+p.textContent.trim()+" --\x3e"+m}(s,""),n.trim()+d},addDocEvent:function(e,t,n){o.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){o.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,s=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,s<0?0:s)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML&&1===e.nodeType?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},resetResponsiveToolbar:function(){d.controllersOff();const t=u._responsiveButtonSize;if(t){let n=0;n=(d._isBalloon||d._isInline)&&"auto"===l.toolbarWidth?e.element.topArea.offsetWidth:e.element.toolbar.offsetWidth;let i="default";for(let e=1,l=t.length;e-1||!r.hasOwn(t,l)||(i.indexOf(l)>-1?n[l].active.call(this,null):t.OUTDENT&&/^OUTDENT$/i.test(l)?r.isImportantDisabled(t.OUTDENT)||t.OUTDENT.setAttribute("disabled",!0):t.INDENT&&/^INDENT$/i.test(l)?r.isImportantDisabled(t.INDENT)||t.INDENT.removeAttribute("disabled"):r.removeClass(t[l],"active"))},_init:function(i,s){const c=a.RegExp;if(this._ww=l.iframe?e.element.wysiwygFrame.contentWindow:a,this._wd=o,this._charTypeHTML="byte-html"===l.charCounterType,this.wwComputedStyle=a.getComputedStyle(e.element.wysiwyg),this._editorHeight=e.element.wysiwygFrame.offsetHeight,this._editorHeightPadding=r.getNumber(this.wwComputedStyle.getPropertyValue("padding-top"))+r.getNumber(this.wwComputedStyle.getPropertyValue("padding-bottom")),!l.iframe&&"function"==typeof a.ShadowRoot){let t=e.element.wysiwygFrame;for(;t;){if(t.shadowRoot){this._shadowRoot=t.shadowRoot;break}if(t instanceof a.ShadowRoot){this._shadowRoot=t;break}t=t.parentNode}this._shadowRoot&&(this._shadowRootControllerEventTarget=[])}const d=a.Object.keys(l._textTagsMap),u=l.addTagsWhitelist?l.addTagsWhitelist.split("|").filter((function(e){return/b|i|ins|s|strike/i.test(e)})):[];for(let e=0;e^<]+)?\\s*(?=>)","gi");const h=function(e,t){return e?"*"===e?"[a-z-]+":t?e+"|"+t:e:"^"},g="contenteditable|colspan|rowspan|target|href|download|rel|src|alt|class|type|controls|origin-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1||"*"===l._editorTagsWhitelist,this._htmlCheckWhitelistRegExp=new c("^("+h(l._editorTagsWhitelist.replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new c("^("+(l.tagsBlacklist||"^")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(h(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e"),"")),this.editorTagsBlacklistRegExp=r.createTagsBlacklist(l.tagsBlacklist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(h(l.pasteTagsWhitelist,"")),this.pasteTagsBlacklistRegExp=r.createTagsBlacklist(l.pasteTagsBlacklist);const p='\\s*=\\s*(")[^"]*\\1',m=l.attributesWhitelist;let f={},_="";if(m)for(let e in m)r.hasOwn(m,e)&&!/^on[a-z]+$/i.test(m[e])&&("all"===e?_=h(m[e],g):f[e]=new c("\\s(?:"+h(m[e],"")+")"+p,"ig"));this._attributesWhitelistRegExp=new c("\\s(?:"+(_||g+"|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|data-exp|data-font-size")+")"+p,"ig"),this._attributesWhitelistRegExp_all_data=new c("\\s(?:"+(_||g)+"|data-[a-z0-9\\-]+)"+p,"ig"),this._attributesTagsWhitelist=f;const b=l.attributesBlacklist;if(f={},_="",b)for(let e in b)r.hasOwn(b,e)&&("all"===e?_=h(b[e],""):f[e]=new c("\\s(?:"+h(b[e],"")+")"+p,"ig"));this._attributesBlacklistRegExp=new c("\\s(?:"+(_||"^")+")"+p,"ig"),this._attributesTagsBlacklist=f,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const v=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let y,C,w=[];for(let e in n)if(r.hasOwn(n,e)){if(y=n[e],C=t[e],(y.active||y.action)&&C&&this.callPlugin(e,null,C),"function"==typeof y.checkFileInfo&&"function"==typeof y.resetFileInfo&&(this.callPlugin(e,null,C),this._fileInfoPluginsCheck.push(y.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(y.resetFileInfo.bind(this))),a.Array.isArray(y.fileTags)){const t=y.fileTags;this.callPlugin(e,null,C),this._fileManager.tags=this._fileManager.tags.concat(t),w.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&o&&o.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},getCurrentIndex:function(){return c},reset:function(n){o&&o.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){s=e.context.element,o=e.context.tool.undo,a=e.context.tool.redo,0===c?(o&&o.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([z]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,s)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-code-view-enabled"]):not([data-display="MORE"])'),this.resizingDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-resizing-enabled"]):not([data-display="MORE"])');const t=e.tool,n=this.commandMap;n.INDENT=t.indent,n.OUTDENT=t.outdent,n[l.textTags.bold.toUpperCase()]=t.bold,n[l.textTags.underline.toUpperCase()]=t.underline,n[l.textTags.italic.toUpperCase()]=t.italic,n[l.textTags.strike.toUpperCase()]=t.strike,n[l.textTags.sub.toUpperCase()]=t.subscript,n[l.textTags.sup.toUpperCase()]=t.superscript,this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView},this._saveButtonStates()},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){this.hasFocus&&u._applyTagEffects(),this._variable.isChanged=!0,e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this),"block"===e.element.toolbar.style.display&&u._showToolbarBalloon()},_iframeAutoHeight:function(){this._iframeAuto?a.setTimeout((function(){const t=d._iframeAuto.offsetHeight;e.element.wysiwygFrame.style.height=t+"px",r.isResizeObserverSupported||d.__callResizeFunction(t,null)})):r.isResizeObserverSupported||d.__callResizeFunction(e.element.wysiwygFrame.offsetHeight,null)},__callResizeFunction:function(e,t){e=-1===e?t.borderBoxSize&&t.borderBoxSize[0]?t.borderBoxSize[0].blockSize:t.contentRect.height+this._editorHeightPadding:e,this._editorHeight!==e&&("function"==typeof h.onResizeEditor&&h.onResizeEditor(e,this._editorHeight,d,t),this._editorHeight=e)},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(r._allowedEmptyNodeList)||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,s=r.getRangeFormatElement(n,null);let o,a,c;const d=r.getParentElement(n,r.isComponent);if(!d||r.isTable(d)){if(1===n.nodeType&&"true"===n.getAttribute("data-se-embed")){let e=n.nextElementSibling;return r.isFormatElement(e)||(e=this.appendFormatTag(n,l.defaultTag)),void this.setRange(e.firstChild,0,e.firstChild,0)}if(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.children[t.startOffset])&&!r.isComponent(i.children[t.startOffset-1])){if(r.getParentElement(n,r.isNotCheckingNode))return null;if(s)return c=r.createElement(e||l.defaultTag),c.innerHTML=s.innerHTML,0===c.childNodes.length&&(c.innerHTML=r.zeroWidthSpace),s.innerHTML=c.outerHTML,c=s.firstChild,o=r.getEdgeChildNodes(c,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),c.insertBefore(o,c.firstChild)),a=o.textContent.length,void this.setRange(o,a,o,a);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||l.defaultTag),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,c=r.getFormatElement(o,null),!c)return this.removeRange(),void this._editorRange();if(r.isBreak(c.nextSibling)&&r.removeItem(c.nextSibling),r.isBreak(c.previousSibling)&&r.removeItem(c.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="";const i=l.frameAttrbutes;for(let t in i)e.element.wysiwyg.setAttribute(t,i[t]);this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),a.setTimeout(function(){u._resizeObserver&&u._resizeObserver.observe(e.element.wysiwygFrame),u._toolbarObserver&&u._toolbarObserver.observe(e.element._toolbarShadow),this._resourcesStateChange(),"function"==typeof h.onload&&h.onload(d,t)}.bind(this))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_toolbarShadow:e._toolbarShadow,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^("+a.Object.keys(l._textTagsMap).join("|")+")$","i"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;const i=u._keyCodeShortcut[e];switch(i){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="bold");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")?n="strike":t||-1!==l.shortcutsDisable.indexOf("save")||(n="save");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="underline");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="italic");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"indent":"outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"outdent":"indent")}return n?(d.commandHandler(d.commandMap[n],n),!0):!!i},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=l.rtl?"marginRight":"marginLeft",s=d.commandMap,o=u._onButtonsCheck,a=[],c=[],h=d.activePlugins,g=h.length;let p="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){if(p=e.nodeName.toUpperCase(),c.push(p),!d.isReadOnly)for(let t,i=0;i0)&&(a.push("OUTDENT"),s.OUTDENT.removeAttribute("disabled")),-1===a.indexOf("INDENT")&&s.INDENT&&!r.isImportantDisabled(s.INDENT)&&(a.push("INDENT"),r.isListCell(e)&&!e.previousElementSibling?s.INDENT.setAttribute("disabled",!0):s.INDENT.removeAttribute("disabled"))):o&&o.test(p)&&(a.push(p),r.addClass(s[p],"active"))}d._setKeyEffect(a),d._variable.currentNodes=c.reverse(),d._variable.currentNodesMap=a,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(d.controllersOff();t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||d.actionCall(i,n,t))},onMouseDown_wysiwyg:function(t){if(d.isReadOnly||r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onMouseDown&&!1===h.onMouseDown(t,d))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault()},onClick_wysiwyg:function(t){const n=t.target;if(d.isReadOnly)return t.preventDefault(),r.isAnchor(n)&&a.open(n.href,n.target),!1;if(r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onClick&&!1===h.onClick(t,d))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const s=r.getParentElement(n,"FIGCAPTION");if(s&&(r.isNonEditable(s)||!s.getAttribute("contenteditable"))&&(t.preventDefault(),s.setAttribute("contenteditable",!0),s.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),s.removeEventListener("blur",e)};s.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),c=r.getFormatElement(o,null),g=r.getRangeFormatElement(o,null);if(c||r.isNonEditable(n)||r.isList(g))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer))if(r.isList(g)){t.preventDefault();const e=r.createElement("LI"),n=o.nextElementSibling;e.appendChild(o),g.insertBefore(e,n),d.focus()}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||null===d._setDefaultFormat(r.isRangeFormatElement(g)?"DIV":l.defaultTag)?u._applyTagEffects():(t.preventDefault(),d.focus())}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,s=e.element.topArea,o=d.getSelection();let c;if(d._isBalloonAlways&&n.collapsed)c=!0;else if(o.focusNode===o.anchorNode)c=o.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name)}else{const e=r.createElement(l.defaultTag);e.innerHTML="
    ",f.parentElement.replaceChild(e,f)}return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}if(u._isUneditableNode(g,!0)){t.preventDefault(),t.stopPropagation();break}!p&&d._isEdgeFormat(g.startContainer,g.startOffset,"start")&&r.isFormatElement(f.previousElementSibling)&&(d._formatAttrsTemp=f.previousElementSibling.attributes);const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,s=f.childNodes;let o=i,a=s[0];for(;a=s[0];)e.insertBefore(a,o.nextSibling),o=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&f&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=f.previousSibling,l=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(e&&!e.previousSibling&&(n&&r.isComponent(n.previousSibling)||l&&r.isComponent(i))){const e=d.getFileComponent(i);e?(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),!1===d.selectComponent(e.target,e.pluginName)&&d.blur()):r.isComponent(i)&&(t.preventDefault(),t.stopPropagation(),r.removeItem(i));break}if(e&&r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if(u._isUneditableNode(g,!1)){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){const e=f.nextElementSibling;if(!e)break;if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n?(t.stopPropagation(),!1===d.selectComponent(n.target,n.pluginName)&&d.blur()):r.isComponent(e)&&(t.stopPropagation(),r.removeItem(e));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f&&f.childNodes[g.startOffset]||c;if(e&&r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}if(r.isComponent(e)){t.preventDefault(),t.stopPropagation(),r.removeItem(e);break}}if(!p&&d._isEdgeFormat(g.endContainer,g.endOffset,"end")&&r.isFormatElement(f.nextElementSibling)&&(d._formatAttrsTemp=f.attributes),f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),s||o||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let s=n[l];if(!s)break;s=s.firstElementChild||s,d.setRange(s,0,s,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i){const e=d._isEdgeFormat(g.endContainer,g.endOffset,"end"),n=d._isEdgeFormat(g.startContainer,g.startOffset,"start");if(e&&(/^H[1-6]$/i.test(f.nodeName)||/^HR$/i.test(f.nodeName))){t.preventDefault();let n=null;const i=d.appendFormatTag(f,l.defaultTag);if(e&&e.length>0){n=e.pop();const t=n;for(;e.length>0;)n=n.appendChild(e.pop());i.appendChild(t)}n=n?n.appendChild(i.firstChild):i.firstChild,d.setRange(n,0,n,0);break}if(n||e){t.preventDefault();const i=r.createElement("BR"),s=r.createElement(f.nodeName);s.appendChild(i),r.copyTagAttributes(s,f,["id"].concat(l.lineAttrReset)),f.parentNode.insertBefore(s,n?f:f.nextElementSibling),e&&d.setRange(i,1,i,1);break}if(d._formatAttrsTemp=f.attributes,l.lineAttrReset&&f&&!r.isListCell(f)){let e;if(t.preventDefault(),t.stopPropagation(),g.collapsed)e=r.onlyZeroWidthSpace(f)?d.appendFormatTag(f,f.cloneNode(!1)):r.splitElement(g.endContainer,g.endOffset,0);else{const t=r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null),n=d.removeNode();if(t)if(e=r.getFormatElement(n.container,null),n.prevContainer)e!==f&&e.nextElementSibling===f&&(e=f);else{const t=f.cloneNode(!1);t.innerHTML="
    ",e.parentNode.insertBefore(t,e)}else e=r.splitElement(n.container,n.offset,0)}const n=l.lineAttrReset,i=e.attributes;let s=0;for(;i[s];)n&&n.indexOf(i[s].name.toLowerCase())>-1?s++:e.removeAttribute(i[s].name);d.setRange(e.firstChild,0,e.firstChild,0);break}if(S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,s=c.previousElementSibling,o=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(s)&&(r.isBreak(s.previousSibling)||!r.onlyZeroWidthSpace(s.previousSibling.textContent))&&(!o||!r.isBreak(o)&&r.onlyZeroWidthSpace(o.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)&&!r.isRangeFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)&&!r.isRangeFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)&&!r.isRangeFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:l.defaultTag;e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,s=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(s)&&!r.isRangeFormatElement(s)?s.nodeName:l.defaultTag),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){!1===d.selectComponent(n._element,m)&&d.blur()}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&16===n){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}else if(i&&(r.isOSX_IOS?o:s)&&32===n){t.preventDefault(),t.stopPropagation();const e=d.insertNode(r.createTextNode(" "));if(e&&e.container)return void d.setRange(e.container,e.endOffset,e.container,e.endOffset)}if(r.isIE&&!s&&!o&&!p&&!u._nonTextKeyCode.test(n)&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=e.keyCode,n=e.ctrlKey||e.metaKey||91===t||92===t||224===t,i=e.altKey;if(d.isReadOnly)return void(!n&&u._directionKeyCode.test(t)&&u._applyTagEffects());const s=d.getRange();let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==t||!s.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==t&&u._showToolbarBalloonDelay()}if(8===t&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:l.defaultTag);return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const a=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null),g=d._formatAttrsTemp;if(g){for(let e=0,n=g.length;e0?i-s-e.element.toolbar.offsetHeight:0;i=n+s?(d._sticky||u._onStickyToolbar(a),t.toolbar.style.top=a+n+s+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=s&&u._onStickyToolbar(a)},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,s=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,s+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:s}},_getPageBottomSpace:function(){return o.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(t){const n=e.element;d._isInline||l.toolbarContainer||(n._stickyDummy.style.height=n.toolbar.offsetHeight+"px",n._stickyDummy.style.display="block"),n.toolbar.style.top=l.stickyToolbar+t+"px",n.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:n.toolbar.offsetWidth+"px",r.addClass(n.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){d._variable.isFullScreen||(e.element.code.style.height=e.element.code.scrollHeight+"px")},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),s=r.isCell(i),o=r.isCell(l),a=e.commonAncestorContainer;if((s&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||o&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(s){if(o)return r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode}))),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode})))}else r.removeItem(r.getParentElement(l,(function(e){return a===e.parentNode})));const c=1===t.nodeType?r.getParentElement(t,".se-component"):null,u=1===n.nodeType?r.getParentElement(n,".se-component"):null;return c&&r.removeItem(c),u&&r.removeItem(u),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!1===h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onSave_wysiwyg:function(e){"function"!=typeof h.onSave||h.onSave(e,d)},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!1===h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){if(d.isReadOnly||r.isIE)return e.preventDefault(),e.stopPropagation(),!1;const t=e.dataTransfer;return!t||(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,s;if(r.isIE){l=i.getData("Text");const o=d.getRange(),c=r.createElement("DIV"),h={sc:o.startContainer,so:o.startOffset,ec:o.endContainer,eo:o.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){s=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,s,i)})),!0}if(l=i.getData("text/plain"),s=i.getData("text/html"),!1===u._setClipboardData(t,n,l,s,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){const s=/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)||/content=["']*Excel.Sheet/i.test(i);!i?i=r._HTMLConvertor(n).replace(/\n/g,"
    "):(i=i.replace(/^\r?\n?\r?\n?\x3C!--StartFragment--\>|\x3C!--EndFragment-->\r?\n?<\/body\>\r?\n?<\/html>$/g,""),s&&(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp,d.pasteTagsBlacklistRegExp));const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste){const e=h.onPaste(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}if("drop"===e&&"function"==typeof h.onDrop){const e=h.onDrop(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}const a=l.files;return a.length>0&&!s?(/^image/.test(a[0].type)&&d.plugins.image&&h.insertImage(a),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled||d.isReadOnly)return!1;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){const s=e.element;let o=0,a=s.wysiwyg;do{o+=a.scrollTop,a=a.parentElement}while(a&&!/^(BODY|HTML)$/i.test(a.nodeName));const c=s.wysiwyg.scrollTop,h=u._getEditorOffsets(null),g=r.getOffset(n,s.wysiwygFrame).top+c,p=t.pageY+o+(l.iframe&&!l.toolbarContainer?s.toolbar.offsetHeight:0),m=g+(l.iframe?o:h.top),f=r.isListCell(n.parentNode);let _="",b="";if((f?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&pm+n.offsetHeight-20))return void(i.display="none");b=g+n.offsetHeight,_="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=_,i.top=b-c+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),s=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":l.defaultTag);if(i||(s.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(s.outerHTML,"byte-html"))return;t.parentNode.insertBefore(s,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?s:s.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_resizeObserver:null,_toolbarObserver:null,_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;r.isResizeObserverSupported&&(this._resizeObserver=new a.ResizeObserver((function(e){d.__callResizeFunction(-1,e[0])}))),e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)&&l.resizeEnable?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),r.isResizeObserverSupported&&(this._toolbarObserver=new a.ResizeObserver(d.resetResponsiveToolbar)),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),u._resizeObserver&&(u._resizeObserver.unobserve(e.element.wysiwygFrame),u._resizeObserver=null),u._toolbarObserver&&(u._toolbarObserver.unobserve(e.element._toolbarShadow),u._toolbarObserver=null),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===s.length)return void(s=null);u._responsiveCurrentSize="default";const e=u._responsiveButtonSize=[],t=u._responsiveButtons={default:s[0]};for(let n,i,l=1,o=s.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button(e);n.resizing.resizeButton=l;let s=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),s[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,s=null},setController_resize:function(e){const t=e.util.createElement("DIV");return t.className="se-controller se-resizing-container",t.style.display="none",t.innerHTML='
    ',t},setController_button:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-resizing",i.innerHTML='
    ",i},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,s=n.resizeDiv,o=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=o.top,u=o.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",s.style.top="0px",s.style.left="0px",s.style.width=r+"px",s.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;o.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,o,null,null),this.selectComponent(o,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(o,l);break;case"caption":const g=!s._captionChecked;if(a.openModify.call(this,!0),s._captionChecked=s.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(s._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):s._caption.focus(),this.controllersOff()}else this.selectComponent(o,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(o,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,s=1*e.getAttribute("data-rotate");let o="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";o=90===s||-270===s?t:e}}e.style.transformOrigin=o,this.plugins.resizing._setTransForm(e,s.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),s="";if(/[1-9]/.test(t)&&(n||i))switch(s=n?"Y":"X",t){case"90":s=n&&i?"X":i?s:"";break;case"270":l*=-1,s=n&&i?"Y":n?s:"";break;case"-90":s=n&&i?"Y":n?s:"";break;case"-270":l*=-1,s=n&&i?"X":i?s:"";break;default:s=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(s?" translate"+s+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const s=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),s&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,s=i.clientY;let o=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?s-e._resizeClientY:e._resizeClientY-s),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=o,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(o)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),t&&this.plugins.resizing.setTransformSize.call(this,this.context[this.context.resizing._resize_plugin]._element,n,i),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,_checkMediaComponent:function(e){return!/IMG/i.test(e)||!/FIGURE/i.test(e.parentElement.nodeName)||!/FIGURE/i.test(e.parentElement.parentElement.nodeName)},upload:function(e,t,n,i,l){this.showLoading();const s=this.plugins.fileManager,o=s._xmlHttp=this.util.getXMLHttpRequest();if(o.onreadystatechange=s._callBackUpload.bind(this,o,i,l),o.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)o.setRequestHeader(e,t[e]);o.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let s=[];for(let e=0,n=t.length;e0;){const t=s.shift();this.util.getParentElement(t,this.util.isMediaComponent)&&o._checkMediaComponent(t)?!t.getAttribute("data-index")||h.indexOf(1*t.getAttribute("data-index"))<0?(u.push(a._infoIndex),t.removeAttribute("data-index"),c(e,t,n,null,l)):u.push(1*t.getAttribute("data-index")):(u.push(a._infoIndex),i(t))}for(let e,t=0;t-1||(r.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=d)},setInfo:function(e,t,n,i,l){const s=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const o=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
    '},_onMouseDown_browser:function(e){/se-file-browser-inner/.test(e.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(e,t){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.fileBrowser.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const n=this.context.fileBrowser;n.contextPlugin=e,n.selectorHandler=t;const i=this.context[e],l=i.listClass;this.util.hasClass(n.list,l)||(n.list.className="se-file-browser-list "+l),"full"===this.options.popupDisplay?n.area.style.position="fixed":n.area.style.position="absolute",n.titleArea.textContent=i.title,n.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[e].url,this.context[e].header)},_bindClose:null,close:function(){const e=this.plugins.fileBrowser;e._xmlHttp&&e._xmlHttp.abort(),e._bindClose&&(this._d.removeEventListener("keydown",e._bindClose),e._bindClose=null);const t=this.context.fileBrowser;t.area.style.display="none",t.selectorHandler=null,t.selectedTags=[],t.items=[],t.list.innerHTML=t.tagArea.innerHTML=t.titleArea.textContent="","function"==typeof this.plugins[t.contextPlugin].init&&this.plugins[t.contextPlugin].init.call(this),t.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(e,t){const n=this.plugins.fileBrowser,i=n._xmlHttp=this.util.getXMLHttpRequest();if(i.onreadystatechange=n._callBackGet.bind(this,i),i.open("get",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)i.setRequestHeader(e,t[e]);i.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(e){if(4===e.readyState)if(this.plugins.fileBrowser._xmlHttp=null,200===e.status)try{const t=JSON.parse(e.responseText);t.result.length>0?this.plugins.fileBrowser._drawListItem.call(this,t.result,!0):t.nullMessage&&(this.context.fileBrowser.list.innerHTML=t.nullMessage)}catch(e){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+e.message+'"')}finally{this.plugins.fileBrowser.closeBrowserLoading(),this.context.fileBrowser.body.style.maxHeight=this._w.innerHeight-this.context.fileBrowser.header.offsetHeight-50+"px"}else if(this.plugins.fileBrowser.closeBrowserLoading(),0!==e.status){const t=e.responseText?JSON.parse(e.responseText):e,n="[SUNEDITOR.fileBrowser.get.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw Error(n)}},_drawListItem:function(e,t){const n=this.context.fileBrowser,i=this.context[n.contextPlugin],l=[],s=e.length,o=i.columnSize||n.columnSize,a=o<=1?1:Math.round(s/o)||1,r=i.itemTemplateHandler;let c="",d='
    ',u=1;for(let n,i,h=0;h
    '),t&&i.length>0)for(let e,t=0,n=i.length;t'+e+"");d+="
    ",n.list.innerHTML=d,t&&(n.items=e,n.tagArea.innerHTML=c,n.tagElements=n.tagArea.querySelectorAll("A"))},onClickTag:function(e){const t=e.target;if(!this.util.isAnchor(t))return;const n=t.textContent,i=this.plugins.fileBrowser,l=this.context.fileBrowser,s=l.tagArea.querySelector('a[title="'+n+'"]'),o=l.selectedTags,a=o.indexOf(n);a>-1?(o.splice(a,1),this.util.removeClass(s,"on")):(o.push(n),this.util.addClass(s,"on")),i._drawListItem.call(this,0===o.length?l.items:l.items.filter((function(e){return e.tag.some((function(e){return o.indexOf(e)>-1}))})),!1)},onClickFile:function(e){e.preventDefault(),e.stopPropagation();const t=this.context.fileBrowser,n=t.list;let i=e.target,l=null;if(i===n)return;for(;n!==i.parentNode&&(l=i.getAttribute("data-command"),!l);)i=i.parentNode;if(!l)return;const s=t.selectorHandler||this.context[t.contextPlugin].selectorHandler;this.plugins.fileBrowser.close.call(this),s(i)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileBrowser",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={code:"en",toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",audio:"Audio",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style",imageGallery:"Image gallery",dir_ltr:"Left to right",dir_rtl:"Right to left",mention:"Mention"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window",downloadLinkCheck:"Download link",bookmark:"Bookmark"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",file:"Select from files",url:"Media embed URL, YouTube/Vimeo"},audioBox:{title:"Insert Audio",file:"Select from files",url:"Audio URL"},browser:{tags:"Tags",search:"Search"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",fixedColumnWidth:"Fixed column width",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow",code:"Code"}};return void 0===t&&(e.SUNEDITOR_LANG||Object.defineProperty(e,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]},t.colorPicker.colorListHTML=this.createColorList(e,this._makeColorList)},createColorList:function(e,t){const n=e.options,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];let s=[],o='
    ';for(let e,n=0,i=l.length;n0&&(o+='
    '+t(s)+"
    ",s=[]),"object"==typeof e&&(o+='
    '+t(e)+"
    ")));return o+='
    ",o},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.color;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},s={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(e){const t=e.context.colorPicker.colorListHTML,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML=t,n},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput;const n=this.wwComputedStyle.backgroundColor;e._defaultColor=n?this.plugins.colorPicker.isHexColor(n)?n:this.plugins.colorPicker.rgb2hex(n):"#ffffff",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},o={name:"template",display:"submenu",add:function(e,t){e.context.template={selectedIndex:-1};let n=this.setSubmenu(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(e){const t=e.options.templates;if(!t||0===t.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const n=e.util.createElement("DIV");n.className="se-list-layer";let i='
      ';for(let e,n=0,l=t.length;n";return i+="
    ",n.innerHTML=i,n},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation(),this.context.template.selectedIndex=1*e.target.getAttribute("data-value");const t=this.options.templates[this.context.template.selectedIndex];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"selectMenu",add:function(e){e.context.selectMenu={caller:{},callerContext:null}},setForm:function(){return'
    '},createList:function(e,t,n){e.form.innerHTML="
      "+n+"
    ",e.items=t,e.menus=e.form.querySelectorAll("li")},initEvent:function(e,t){const n=t.querySelector(".se-select-list"),i=this.context.selectMenu.caller[e]={form:n,items:[],menus:[],index:-1,item:null,clickMethod:null,callerName:e};n.addEventListener("mousedown",this.plugins.selectMenu.onMousedown_list),n.addEventListener("mousemove",this.plugins.selectMenu.onMouseMove_list.bind(this,i)),n.addEventListener("click",this.plugins.selectMenu.onClick_list.bind(this,i))},onMousedown_list:function(e){e.preventDefault(),e.stopPropagation()},onMouseMove_list:function(e,t){this.util.addClass(e.form,"__se_select-menu-mouse-move");const n=t.target.getAttribute("data-index");n&&(e.index=1*n)},onClick_list:function(e,t){const n=t.target.getAttribute("data-index");n&&e.clickMethod.call(this,e.items[n])},moveItem:function(e,t){this.util.removeClass(e.form,"__se_select-menu-mouse-move"),t=e.index+t;const n=e.menus,i=n.length,l=e.index=t>=i?0:t<0?i-1:t;for(let e=0;e
    "+e.plugins.selectMenu.setForm()+'
    '+l.bookmark+''+l.download+'
    ",s.innerHTML=o,s},initEvent:function(e,t){const n=this.plugins.anchor,i=this.context.anchor.caller[e]={modal:t,urlInput:null,linkDefaultRel:this.options.linkRelDefault,defaultRel:this.options.linkRelDefault.default||"",currentRel:[],linkAnchor:null,linkValue:"",_change:!1,callerName:e};"string"==typeof i.linkDefaultRel.default&&(i.linkDefaultRel.default=i.linkDefaultRel.default.trim()),"string"==typeof i.linkDefaultRel.check_new_window&&(i.linkDefaultRel.check_new_window=i.linkDefaultRel.check_new_window.trim()),"string"==typeof i.linkDefaultRel.check_bookmark&&(i.linkDefaultRel.check_bookmark=i.linkDefaultRel.check_bookmark.trim()),i.urlInput=t.querySelector(".se-input-url"),i.anchorText=t.querySelector("._se_anchor_text"),i.newWindowCheck=t.querySelector("._se_anchor_check"),i.downloadCheck=t.querySelector("._se_anchor_download"),i.download=t.querySelector("._se_anchor_download_icon"),i.preview=t.querySelector(".se-link-preview"),i.bookmark=t.querySelector("._se_anchor_bookmark_icon"),i.bookmarkButton=t.querySelector("._se_bookmark_button"),this.plugins.selectMenu.initEvent.call(this,e,t);const l=this.context.selectMenu.caller[e];this.options.linkRel.length>0&&(i.relButton=t.querySelector(".se-anchor-rel-btn"),i.relList=t.querySelector(".se-list-layer"),i.relPreview=t.querySelector(".se-anchor-rel-preview"),i.relButton.addEventListener("click",n.onClick_relButton.bind(this,i)),i.relList.addEventListener("click",n.onClick_relList.bind(this,i))),i.newWindowCheck.addEventListener("change",n.onChange_newWindowCheck.bind(this,i)),i.downloadCheck.addEventListener("change",n.onChange_downloadCheck.bind(this,i)),i.anchorText.addEventListener("input",n.onChangeAnchorText.bind(this,i)),i.urlInput.addEventListener("input",n.onChangeUrlInput.bind(this,i)),i.urlInput.addEventListener("keydown",n.onKeyDownUrlInput.bind(this,l)),i.urlInput.addEventListener("focus",n.onFocusUrlInput.bind(this,i,l)),i.urlInput.addEventListener("blur",n.onBlurUrlInput.bind(this,l)),i.bookmarkButton.addEventListener("click",n.onClick_bookmarkButton.bind(this,i))},on:function(e,t){const n=this.plugins.anchor;if(t){if(e.linkAnchor){this.context.dialog.updateModal=!0;const t=e.linkAnchor.getAttribute("href");e.linkValue=e.preview.textContent=e.urlInput.value=n.selfPathBookmark.call(this,t)?t.substr(t.lastIndexOf("#")):t,e.anchorText.value=e.linkAnchor.textContent,e.newWindowCheck.checked=!!/_blank/i.test(e.linkAnchor.target),e.downloadCheck.checked=e.linkAnchor.download}}else n.init.call(this,e),e.anchorText.value=this.getSelection().toString().trim(),e.newWindowCheck.checked=this.options.linkTargetNewWindow;this.context.anchor.callerContext=e,n.setRel.call(this,e,t&&e.linkAnchor?e.linkAnchor.rel:e.defaultRel),n.setLinkPreview.call(this,e,e.linkValue),this.plugins.selectMenu.on.call(this,e.callerName,this.plugins.anchor.setHeaderBookmark)},selfPathBookmark:function(e){const t=this._w.location.href.replace(/\/$/,"");return 0===e.indexOf("#")||0===e.indexOf(t)&&e.indexOf("#")===(-1===t.indexOf("#")?t.length:t.substr(0,t.indexOf("#")).length)},_closeRelMenu:null,toggleRelList:function(e,t){if(t){const t=e.relButton,n=e.relList;this.util.addClass(t,"active"),n.style.visibility="hidden",n.style.display="block",this.options.rtl?n.style.left=t.offsetLeft-n.offsetWidth-1+"px":n.style.left=t.offsetLeft+t.offsetWidth+1+"px",n.style.top=t.offsetTop+t.offsetHeight/2-n.offsetHeight/2+"px",n.style.visibility="",this.plugins.anchor._closeRelMenu=function(e,t,n){n&&(e.relButton.contains(n.target)||e.relList.contains(n.target))||(this.util.removeClass(t,"active"),e.relList.style.display="none",this.modalForm.removeEventListener("click",this.plugins.anchor._closeRelMenu),this.plugins.anchor._closeRelMenu=null)}.bind(this,e,t),this.modalForm.addEventListener("click",this.plugins.anchor._closeRelMenu)}else this.plugins.anchor._closeRelMenu&&this.plugins.anchor._closeRelMenu()},onClick_relButton:function(e,t){this.plugins.anchor.toggleRelList.call(this,e,!this.util.hasClass(t.target,"active"))},onClick_relList:function(e,t){const n=t.target,i=n.getAttribute("data-command");if(!i)return;const l=e.currentRel,s=this.util.toggleClass(n,"se-checked"),o=l.indexOf(i);s?-1===o&&l.push(i):o>-1&&l.splice(o,1),e.relPreview.title=e.relPreview.textContent=l.join(" ")},setRel:function(e,t){const n=e.relList,i=e.currentRel=t?t.split(" "):[];if(!n)return;const l=n.querySelectorAll("button");for(let e,t=0,n=l.length;t-1?this.util.addClass(l[t],"se-checked"):this.util.removeClass(l[t],"se-checked");e.relPreview.title=e.relPreview.textContent=i.join(" ")},createHeaderList:function(e,t,n){const i=this.util.getListChildren(this.context.element.wysiwyg,(function(e){return/h[1-6]/i.test(e.nodeName)}));if(0===i.length)return;const l=new this._w.RegExp("^"+n.replace(/^#/,""),"i"),s=[];let o="";for(let e,t=0,n=i.length;t'+e.textContent+"");0===s.length?this.plugins.selectMenu.close.call(this,t):(this.plugins.selectMenu.createList(t,s,o),this.plugins.selectMenu.open.call(this,t,this.plugins.anchor._setMenuListPosition.bind(this,e)))},_setMenuListPosition:function(e,t){t.style.top=e.urlInput.offsetHeight+1+"px"},onKeyDownUrlInput:function(e,t){switch(t.keyCode){case 38:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,-1);break;case 40:t.preventDefault(),t.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,e,1);break;case 13:e.index>-1&&(t.preventDefault(),t.stopPropagation(),this.plugins.anchor.setHeaderBookmark.call(this,this.plugins.selectMenu.getItem(e,null)))}},setHeaderBookmark:function(e){const t=this.context.anchor.callerContext,n=e.id||"h_"+this._w.Math.random().toString().replace(/.+\./,"");e.id=n,t.urlInput.value="#"+n,t.anchorText.value.trim()&&t._change||(t.anchorText.value=e.textContent),this.plugins.anchor.setLinkPreview.call(this,t,t.urlInput.value),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext),this.context.anchor.callerContext.urlInput.focus()},onChangeAnchorText:function(e,t){e._change=!!t.target.value.trim()},onChangeUrlInput:function(e,t){const n=t.target.value.trim();this.plugins.anchor.setLinkPreview.call(this,e,n),this.plugins.anchor.selfPathBookmark.call(this,n)?this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,n):this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)},onFocusUrlInput:function(e,t){const n=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,n)&&this.plugins.anchor.createHeaderList.call(this,e,t,n)},onBlurUrlInput:function(e){this.plugins.selectMenu.close.call(this,e)},setLinkPreview:function(e,t){const n=e.preview,i=this.options.linkProtocol,l=this.options.linkNoPrefix,s=/^(mailto\:|tel\:|sms\:|https*\:\/\/|#)/.test(t),o=!!i&&this._w.RegExp("^"+t.substr(0,i.length)).test(i);t=e.linkValue=n.textContent=t?l?t:!i||s||o?s?t:/^www\./.test(t)?"http://"+t:this.context.anchor.host+(/^\//.test(t)?"":"/")+t:i+t:"",this.plugins.anchor.selfPathBookmark.call(this,t)?(e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active")):(e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active")),!this.plugins.anchor.selfPathBookmark.call(this,t)&&e.downloadCheck.checked?e.download.style.display="block":e.download.style.display="none"},setCtx:function(e,t){e&&(t.linkAnchor=e,t.linkValue=e.href,t.currentRel=e.rel.split(" "))},updateAnchor:function(e,t,n,i,l){!this.plugins.anchor.selfPathBookmark.call(this,t)&&i.downloadCheck.checked?e.setAttribute("download",n||t):e.removeAttribute("download"),i.newWindowCheck.checked?e.target="_blank":e.removeAttribute("target");const s=i.currentRel.join(" ");s?e.rel=s:e.removeAttribute("rel"),e.href=t,l?0===e.children.length&&(e.textContent=""):e.textContent=n},createAnchor:function(e,t){if(0===e.linkValue.length)return null;const n=e.linkValue,i=e.anchorText,l=0===i.value.length?n:i.value,s=e.linkAnchor||this.util.createElement("A");return this.plugins.anchor.updateAnchor.call(this,s,n,l,e,t),e.linkValue=e.preview.textContent=e.urlInput.value=e.anchorText.value="",s},onClick_bookmarkButton:function(e){let t=e.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,t)?(t=t.substr(1),e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)):(t="#"+t,e.bookmark.style.display="block",this.util.addClass(e.bookmarkButton,"active"),e.downloadCheck.checked=!1,e.download.style.display="none",this.plugins.anchor.createHeaderList.call(this,e,this.context.selectMenu.callerContext,t)),e.urlInput.value=t,this.plugins.anchor.setLinkPreview.call(this,e,t),e.urlInput.focus()},onChange_newWindowCheck:function(e,t){"string"==typeof e.linkDefaultRel.check_new_window&&(t.target.checked?this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_new_window)):this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_new_window)))},onChange_downloadCheck:function(e,t){t.target.checked?(e.download.style.display="block",e.bookmark.style.display="none",this.util.removeClass(e.bookmarkButton,"active"),e.linkValue=e.preview.textContent=e.urlInput.value=e.urlInput.value.replace(/^\#+/,""),"string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relMerge.call(this,e,e.linkDefaultRel.check_bookmark))):(e.download.style.display="none","string"==typeof e.linkDefaultRel.check_bookmark&&this.plugins.anchor.setRel.call(this,e,this.plugins.anchor._relDelete.call(this,e,e.linkDefaultRel.check_bookmark)))},_relMerge:function(e,t){const n=e.currentRel;if(!t)return n.join(" ");if(/^only\:/.test(t))return t=t.replace(/^only\:/,"").trim(),e.currentRel=t.split(" "),t;const i=t.split(" ");for(let e,t=0,l=i.length;t'+i.cancel+''+t.dialogBox.linkBox.title+""+e.context.anchor.forms.innerHTML+'";return n.innerHTML=l,n},setController_LinkButton:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
    ",i},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();try{const e=this.plugins.anchor.createAnchor.call(this,this.context.anchor.caller.link,!1);if(null===e)return;if(this.context.dialog.updateModal){const e=this.context.link._linkAnchor.childNodes[0];this.setRange(e,0,e,e.textContent.length)}else{const t=this.getSelectedElements();if(t.length>1){const n=this.util.createElement(t[0].nodeName);if(n.appendChild(e),!this.insertNode(n,null,!0))return}else if(!this.insertNode(e,null,!0))return;this.setRange(e.childNodes[0],0,e.childNodes[0],e.textContent.length)}}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.history.push(!1)}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){this.plugins.anchor.on.call(this,this.context.anchor.caller.link,e)},call_controller:function(e){this.editLink=this.context.link._linkAnchor=this.context.anchor.caller.link.linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent,this.util.addClass(e,"on"),this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"link",this.util.removeClass.bind(this.util,this.context.link._linkAnchor,"on"))},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t))this.plugins.dialog.open.call(this,"link",!0);else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.anchor.caller.link.linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){this.context.link.linkController.style.display="none",this.plugins.anchor.init.call(this,this.context.anchor.caller.link)}},h=n("ZED3"),g=n.n(h),p=n("ee5k"),m=n.n(p),f=n("gjS+"),_=n.n(f),b={name:"image",display:"dialog",add:function(e){e.addModule([r.a,d,g.a,m.a,_.a]);const t=e.options,n=e.context,i=n.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:t._imageSizeUnit,_linkElement:"",_altText:"",_align:"none",_floatClassRegExp:"__se__float\\-[a-z]+",_v_src:{_linkValue:""},svgDefaultSize:"30%",base64RenderIndex:0,_element:null,_cover:null,_container:null,inputX:null,inputY:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.imageWidth?"":t.imageWidth,_origin_h:"auto"===t.imageHeight?"":t.imageHeight,_proportionChecked:!0,_resizing:t.imageResizing,_resizeDotHide:!t.imageHeightShow,_rotation:t.imageRotation,_alignHide:!t.imageAlignShow,_onlyPercentage:t.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let l=this.setDialog(e);i.modal=l,i.imgInputFile=l.querySelector("._se_image_file"),i.imgUrlFile=l.querySelector("._se_image_url"),i.focusElement=i.imgInputFile||i.imgUrlFile,i.altText=l.querySelector("._se_image_alt"),i.captionCheckEl=l.querySelector("._se_image_check_caption"),i.previewSrc=l.querySelector("._se_tab_content_image .se-link-preview"),l.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),l.querySelector("form").addEventListener("submit",this.submit.bind(e)),i.imgInputFile&&l.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(i.imgInputFile,i.imgUrlFile,i.previewSrc)),i.imgUrlFile&&i.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(i.previewSrc,i._v_src,t.linkProtocol)),i.imgInputFile&&i.imgUrlFile&&i.imgInputFile.addEventListener("change",this._fileInputChange.bind(i));const s=l.querySelector(".__se__gallery");s&&s.addEventListener("click",this._openGallery.bind(e)),i.proportion={},i.inputX={},i.inputY={},t.imageResizing&&(i.proportion=l.querySelector("._se_image_check_proportion"),i.inputX=l.querySelector("._se_image_size_x"),i.inputY=l.querySelector("._se_image_size_y"),i.inputX.value=t.imageWidth,i.inputY.value=t.imageHeight,i.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),i.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),i.inputX.addEventListener("change",this.setRatio.bind(e)),i.inputY.addEventListener("change",this.setRatio.bind(e)),i.proportion.addEventListener("change",this.setRatio.bind(e)),l.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),n.dialog.modal.appendChild(l),e.plugins.anchor.initEvent.call(e,"image",l.querySelector("._se_tab_content_url")),i.anchorCtx=e.context.anchor.caller.image,l=null},setDialog:function(e){const t=e.options,n=e.lang,i=e.util.createElement("DIV");i.className="se-dialog-content se-dialog-image",i.style.display="none";let l='
    '+n.dialogBox.imageBox.title+'
    ';if(t.imageFileInput&&(l+='
    "),t.imageUrlInput&&(l+='
    '+(t.imageGalleryUrl&&e.plugins.imageGallery?'":"")+'
    '),l+='
    ',t.imageResizing){const i=t.imageSizeOnlyPercentage,s=i?' style="display: none !important;"':"",o=t.imageHeightShow?"":' style="display: none !important;"';l+='
    ',i||!t.imageHeightShow?l+='
    ":l+='
    ",l+=' '+n.dialogBox.proportion+'
    "}return l+='
    ",i.innerHTML=l,i},_fileInputChange:function(){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(e){this.altText.value=e.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=e.src,this.imgUrlFile.focus()},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["img"],select:function(e){this.plugins.image.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"image"))},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"image",i,this.functions.onImageUpload),this.history.push(!1)},on:function(e){const t=this.context.image;e?t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.imageWidth===t._defaultSizeX?"":this.options.imageWidth,t.inputY.value=t._origin_h=this.options.imageHeight===t._defaultSizeY?"":this.options.imageHeight,t.imgInputFile&&this.options.imageMultipleFile&&t.imgInputFile.setAttribute("multiple","multiple")),this.plugins.anchor.on.call(this,t.anchorCtx,e)},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,s,o;for(s=t.getElementsByClassName("_se_tab_content"),l=0;l0?(this.showLoading(),n.submitAction.call(this,this.context.image.imgInputFile.files)):t.imgUrlFile&&t._v_src._linkValue.length>0&&(this.showLoading(),n.onRender_imgUrl.call(this,t._v_src._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.image._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.image;l._uploadFileLength=n.length;const s={anchor:this.plugins.anchor.createAnchor.call(this,l.anchorCtx,!0),inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,alt:l._altText,element:l._element};if("function"==typeof this.functions.onImageUploadBefore){const e=this.functions.onImageUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.image.register.call(this,s,e):this.plugins.image.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();this._w.Array.isArray(e)&&e.length>0&&(n=e)}this.plugins.image.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onImageUploadError||this.functions.onImageUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.image.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.image.error.call(this,t,null);const n=this.options.imageUploadUrl,i=this.context.dialog.updateModal?1:t.length;if("string"==typeof n&&n.length>0){const l=new FormData;for(let e=0;e'+e.icons.cancel+''+n.dialogBox.videoBox.title+'
    ';if(t.videoFileInput&&(l+='
    "),t.videoUrlInput&&(l+='
    '),t.videoResizing){const i=t.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],s=t.videoRatio,o=t.videoSizeOnlyPercentage,a=o?' style="display: none !important;"':"",r=t.videoHeightShow?"":' style="display: none !important;"',c=t.videoRatioShow?"":' style="display: none !important;"',d=o||t.videoHeightShow||t.videoRatioShow?"":' style="display: none !important;"';l+='
    "}return l+='
    ",i.innerHTML=l,i},_fileInputChange:function(){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();/^$/.test(i)?(e._linkValue=i,this.textContent=''):e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.videoTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createVideoTag:function(){const e=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,e),e},_setIframeAttrs:function(e){e.frameBorder="0",e.allowFullscreen=!0;const t=this.options.videoIframeAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},createIframeTag:function(){const e=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,e),e},fileTags:["iframe","video"],select:function(e){this.plugins.video.onModifyMode.call(this,e,this.plugins.resizing.call_controller_resize.call(this,e,"video"))},destroy:function(e){const t=e||this.context.video._element,n=this.context.video._container,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;const s=n.parentNode;this.util.removeItem(n),this.plugins.video.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"video",i,this.functions.onVideoUpload),this.history.push(!1)},on:function(e){const t=this.context.video;e?t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.removeAttribute("multiple"):(t.inputX.value=t._origin_w=this.options.videoWidth===t._defaultSizeX?"":this.options.videoWidth,t.inputY.value=t._origin_h=this.options.videoHeight===t._defaultSizeY?"":this.options.videoHeight,t.proportion.disabled=!0,t.videoInputFile&&this.options.videoMultipleFile&&t.videoInputFile.setAttribute("multiple","multiple")),t._resizing&&this.plugins.video.setVideoRatioSelect.call(this,t._origin_h||t._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(e){const t=this.context.video,n=this.plugins.video;e.preventDefault(),e.stopPropagation(),t._align=t.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{t.videoInputFile&&t.videoInputFile.files.length>0?(this.showLoading(),n.submitAction.call(this,this.context.video.videoInputFile.files)):t.videoUrlFile&&t._linkValue.length>0&&(this.showLoading(),n.setup_url.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.video._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.video;l._uploadFileLength=n.length;const s={inputWidth:l.inputX.value,inputHeight:l.inputY.value,align:l._align,isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onVideoUploadBefore){const e=this.functions.onVideoUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.video.register.call(this,s,e):this.plugins.video.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.video.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onVideoUploadError||this.functions.onVideoUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.video.error] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.video.error.call(this,t,null);const n=this.options.videoUploadUrl,i=this.context.dialog.updateModal?1:t.length;if(!("string"==typeof n&&n.length>0))throw Error('[SUNEDITOR.videoUpload.fail] cause : There is no "videoUploadUrl" option.');{const l=new FormData;for(let e=0;e$/.test(e)){if(0===(e=(new this._w.DOMParser).parseFromString(e,"text/html").querySelector("iframe").src).length)return!1}if(/youtu\.?be/.test(e)){if(/^http/.test(e)||(e="https://"+e),e=e.replace("watch?v=",""),/^\/\/.+\/embed\//.test(e)||(e=e.replace(e.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t._youtubeQuery.length>0)if(/\?/.test(e)){const n=e.split("?");e=n[0]+"?"+t._youtubeQuery+"&"+n[1]}else e+="?"+t._youtubeQuery}else/vimeo\.com/.test(e)&&(e.endsWith("/")&&(e=e.slice(0,-1)),e="https://player.vimeo.com/video/"+e.slice(e.lastIndexOf("/")+1));this.plugins.video.create_video.call(this,this.plugins.video[/embed|iframe|player|\/e\/|\.php|\.html?/.test(e)||/vimeo\.com/.test(e)?"createIframeTag":"createVideoTag"].call(this),e,t.inputX.value,t.inputY.value,t._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(e,t,n,i,l,s,o){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,d=!1;if(o){if((e=a._element).src!==t){d=!0;const n=/youtu\.?be/.test(t),i=/vimeo\.com/.test(t);if(!n&&!i||/^iframe$/i.test(e.nodeName))if(n||i||/^videoo$/i.test(e.nodeName))e.src=t;else{const n=this.plugins.video.createVideoTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}else{const n=this.plugins.video.createIframeTag.call(this);n.src=t,e.parentNode.replaceChild(n,e),a._element=e=n}}c=a._container,r=this.util.getParentElement(e,"FIGURE")}else d=!0,e.src=t,a._element=e,r=this.plugins.component.set_cover.call(this,e),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const u=this.plugins.resizing._module_getSizeX.call(this,a)!==(n||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(i||a._videoRatio),h=!o||u;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,e.setAttribute("data-proportion",a._proportionChecked));let g=!1;h&&(g=this.plugins.video.applySize.call(this)),g&&"center"===l||this.plugins.video.setAlign.call(this,null,e,r,c);let p=!0;if(o)a._resizing&&this.context.resizing._rotateVertical&&h&&this.plugins.resizing.setTransformSize.call(this,e,null,null);else if(p=this.insertComponent(c,!1,!0,!this.options.mediaAutoSelect),!this.options.mediaAutoSelect){const e=this.appendFormatTag(c,null);e&&this.setRange(e,0,e,0)}p&&(d&&this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,s,!0),o&&(this.selectComponent(e,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(e){if(!e)return;const t=this.context.video;/^video$/i.test(e.nodeName)?this.plugins.video._setTagAttrs.call(this,e):this.plugins.video._setIframeAttrs.call(this,e);let n=this.util.isRangeFormatElement(e.parentNode)||this.util.isWysiwygDiv(e.parentNode)?e:this.util.getFormatElement(e)||e;const i=e;t._element=e=e.cloneNode(!0);const l=t._cover=this.plugins.component.set_cover.call(this,e),s=t._container=this.plugins.component.set_container.call(this,l,"se-video-container");try{const o=n.querySelector("figcaption");let a=null;o&&(a=this.util.createElement("DIV"),a.innerHTML=o.innerHTML,this.util.removeItem(o));const r=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,r[0]||i.style.width||i.width||"",r[1]||i.style.height||i.height||"");const c=this.util.getFormatElement(i);if(c&&(t._align=c.style.textAlign||c.style.float),this.plugins.video.setAlign.call(this,null,e,l,s),this.util.getParentElement(i,this.util.isNotCheckingNode))i.parentNode.replaceChild(s,i);else if(this.util.isListCell(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n.insertBefore(s,e),this.util.removeItem(i),this.util.removeEmptyNode(e,null,!0)}else if(this.util.isFormatElement(n)){const e=this.util.getParentElement(i,(function(e){return e.parentNode===n}));n=this.util.splitElement(n,e),n.parentNode.insertBefore(s,n),this.util.removeItem(i),this.util.removeEmptyNode(n,null,!0),0===n.children.length&&(n.innerHTML=this.util.htmlRemoveWhiteSpace(n.innerHTML))}else n.parentNode.replaceChild(s,n);a&&n.parentNode.insertBefore(a,s.nextElementSibling)}catch(e){console.warn("[SUNEDITOR.video.error] Maybe the video tag is nested.",e)}this.plugins.fileManager.setInfo.call(this,"video",e,this.functions.onVideoUpload,null,!0),this.plugins.video.init.call(this)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.style.float||e.getAttribute("data-align")||"none",e.style.float="",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i,l,s=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");s?(s=s.split(","),i=s[0],l=s[1]):t&&(i=t.w,l=t.h),n._origin_w=i||e.style.width||e.width||"",n._origin_h=l||e.style.height||e.height||""},openModify:function(e){const t=this.context.video;if(t.videoUrlFile&&(t._linkValue=t.preview.textContent=t.videoUrlFile.value=t._element.src||(t._element.querySelector("source")||"").src||""),(t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]')||t.modal.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,s=i.length;l'+e.icons.cancel+''+n.dialogBox.audioBox.title+'
    ';return t.audioFileInput&&(l+='
    "),t.audioUrlInput&&(l+='
    '),l+='
    ",i.innerHTML=l,i},setController:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
    ",i},_fileInputChange:function(){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},_removeSelectedFiles:function(e,t){this.value="",e&&(e.removeAttribute("disabled"),t.style.textDecoration="")},_createAudioTag:function(){const e=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,e);const t=this.context.audio._origin_w,n=this.context.audio._origin_h;return e.setAttribute("origin-size",t+","+n),e.style.cssText=(t?"width:"+t+"; ":"")+(n?"height:"+n+";":""),e},_setTagAttrs:function(e){e.setAttribute("controls",!0);const t=this.options.audioTagAttrs;if(t)for(let n in t)this.util.hasOwn(t,n)&&e.setAttribute(n,t[n])},_onLinkPreview:function(e,t,n){const i=n.target.value.trim();e._linkValue=this.textContent=i?t&&-1===i.indexOf("://")&&0!==i.indexOf("#")?t+i:-1===i.indexOf("://")?"/"+i:i:""},fileTags:["audio"],select:function(e){this.plugins.audio.onModifyMode.call(this,e)},destroy:function(e){e=e||this.context.audio._element;const t=this.util.getParentElement(e,this.util.isComponent)||e,n=1*e.getAttribute("data-index"),i=t.previousElementSibling||t.nextElementSibling,l=t.parentNode;this.util.removeItem(t),this.plugins.audio.init.call(this),this.controllersOff(),l!==this.context.element.wysiwyg&&this.util.removeItemAllParents(l,(function(e){return 0===e.childNodes.length}),null),this.focusEdge(i),this.plugins.fileManager.deleteInfo.call(this,"audio",n,this.functions.onAudioUpload),this.history.push(!1)},checkFileInfo:function(){this.plugins.fileManager.checkInfo.call(this,"audio",["audio"],this.functions.onAudioUpload,this.plugins.audio.updateCover.bind(this),!1)},resetFileInfo:function(){this.plugins.fileManager.resetInfo.call(this,"audio",this.functions.onAudioUpload)},on:function(e){const t=this.context.audio;e?t._element?(this.context.dialog.updateModal=!0,t._linkValue=t.preview.textContent=t.audioUrlFile.value=t._element.src,t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple")):t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),t.audioInputFile&&this.options.audioMultipleFile&&t.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio","audio"===this.currentControllerName)},submit:function(e){const t=this.context.audio;e.preventDefault(),e.stopPropagation();try{t.audioInputFile&&t.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,t.audioInputFile.files)):t.audioUrlFile&&t._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,t._linkValue))}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(e){if(0===e.length)return;let t=0,n=[];for(let i=0,l=e.length;i0){let e=0;const n=this.context.audio._infoList;for(let t=0,i=n.length;ti){this.closeLoading();const n="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+i/1e3+"KB";return void(("function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(n,{limitSize:i,currentSize:e,uploadSize:t},this))&&this.functions.noticeOpen(n))}}const l=this.context.audio;l._uploadFileLength=n.length;const s={isUpdate:this.context.dialog.updateModal,element:l._element};if("function"==typeof this.functions.onAudioUploadBefore){const e=this.functions.onAudioUploadBefore(n,s,this,function(e){e&&this._w.Array.isArray(e.result)?this.plugins.audio.register.call(this,s,e):this.plugins.audio.upload.call(this,s,e)}.bind(this));if(void 0===e)return;if(!e)return void this.closeLoading();"object"==typeof e&&e.length>0&&(n=e)}this.plugins.audio.upload.call(this,s,n)},error:function(e,t){if(this.closeLoading(),"function"!=typeof this.functions.onAudioUploadError||this.functions.onAudioUploadError(e,t,this))throw this.functions.noticeOpen(e),Error("[SUNEDITOR.plugin.audio.exception] response: "+e)},upload:function(e,t){if(!t)return void this.closeLoading();if("string"==typeof t)return void this.plugins.audio.error.call(this,t,null);const n=this.options.audioUploadUrl,i=this.context.dialog.updateModal?1:t.length,l=new FormData;for(let e=0;e'+e.icons.cancel+''+t.dialogBox.mathBox.title+'

    ",e.context.math.defaultFontSize=l,n.innerHTML=s,n},setController_MathButton:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},managedTags:function(){return{className:"katex",method:function(e){if(!e.getAttribute("data-exp")||!this.options.katex)return;const t=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(e.getAttribute("data-exp"))));e.innerHTML=t.querySelector(".katex").innerHTML}}},_renderer:function(e){let t="";try{this.util.removeClass(this.context.math.focusElement,"se-error"),t=this.options.katex.src.renderToString(e,{throwOnError:!0,displayMode:!0})}catch(e){this.util.addClass(this.context.math.focusElement,"se-error"),t='Katex syntax error. (Refer KaTeX)',console.warn("[SUNEDITOR.math.Katex.error] ",e)}return t},_renderMathExp:function(e,t){e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.className="__se__katex "+n.className,n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",this.util.HTMLEncoder(t)),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=this.util.getParentElement(e._mathExp,".katex");t.parentNode.replaceChild(n,t),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);if(t.appendChild(n),!this.insertNode(t,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController;this.setControllerPosition(t,e,"bottom",{left:0,top:0}),this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.util.HTMLDecoder(this.context.math._mathExp.getAttribute("data-exp")),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}},w=n("JhlZ"),x=n.n(w),E={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_itemMenu:null,_alignList:null,currentAlign:"",defaultDir:e.options.rtl?"right":"left",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu(e),s=i.align._itemMenu=l.querySelector("ul");s.addEventListener("click",this.pickup.bind(e)),i.align._alignList=s.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,s=null},setSubmenu:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV"),l=e.options.alignItems;let s="";for(let e,i,o=0;o";return i.className="se-submenu se-list-layer se-list-align",i.innerHTML='
      '+s+"
    ",i},active:function(e){const t=this.context.align,n=t.targetButton,i=n.firstElementChild;if(e){if(this.util.isFormatElement(e)){const l=e.style.textAlign;if(l)return this.util.changeElement(i,t.icons[l]||t.icons[t.defaultDir]),n.setAttribute("data-focus",l),!0}}else this.util.changeElement(i,t.icons[t.defaultDir]),n.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||e.defaultDir;if(n!==e.currentAlign){for(let e=0,i=t.length;e
    • ";for(s=0,o=a.length;s";return r+="
    ",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,this.lang.toolbar.font+" ("+i+")"),!0}}else{const e=this.hasFocus?this.wwComputedStyle.fontFamily:this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,this.hasFocus?this.lang.toolbar.font+(e?" ("+e+")":""):e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+n.toolbar.default+")";for(let e,n=0,i=t.fontSizeUnit,o=l.length;n";return s+="",i.innerHTML=s,i},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,this._convertFontSize.call(this,this.options.fontSizeUnit,e.style.fontSize)),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.hasFocus?this._convertFontSize.call(this,this.options.fontSizeUnit,this.wwComputedStyle.fontSize):this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e";return n.className="se-submenu se-list-layer se-list-line",n.innerHTML='
      '+l+"
    ",n},active:function(e){if(e){if(/HR/i.test(e.nodeName))return this.context.horizontalRule.currentHR=e,this.util.hasClass(e,"on")||(this.util.addClass(e,"on"),this.controllersOn("hr",this.util.removeClass.bind(this.util,e,"on"))),!0}else this.util.hasClass(this.context.horizontalRule.currentHR,"on")&&this.controllersOff();return!1},appendHr:function(e){return this.focus(),this.insertComponent(e.cloneNode(!1),!1,!0,!1)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=t.getAttribute("data-command");for(;!n&&!/UL/i.test(t.tagName);)t=t.parentNode,n=t.getAttribute("data-command");if(!n)return;const i=this.plugins.horizontalRule.appendHr.call(this,t.firstElementChild);i&&(this.setRange(i,0,i,0),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(e){const t=e.lang,n=e.util.createElement("DIV");return n.className="se-submenu se-list-layer",n.innerHTML='
    ",n},active:function(e){const t=this.context.list.targetButton,n=t.firstElementChild,i=this.util;if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeElement(n,this.context.list.icons.bullets):i.changeElement(n,this.context.list.icons.number),!0}return t.removeAttribute("data-focus"),i.changeElement(n,this.context.list.icons.number),i.removeClass(t,"active"),!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}a.appendChild(t),r||(h=a),r&&f===p&&!s.isRangeFormatElement(_)||(d||(d=a),i&&r&&f===p||r&&s.isList(p)&&p===c||a.parentNode!==f&&f.insertBefore(a,_)),s.removeItem(n),i&&null===g&&(g=a.children.length-1),r&&(s.getRangeFormatElement(p,m)!==s.getRangeFormatElement(c,m)||s.isList(p)&&s.isList(c)&&s.getElementDepth(p)!==s.getElementDepth(c))&&(a=s.createElement(e)),b&&0===b.children.length&&s.removeItem(b)}else s.removeItem(n);g&&(d=d.children[g]),o&&(p=a.children.length-1,a.innerHTML+=c.innerHTML,h=a.children[p],s.removeItem(c))}else{if(n)for(let e=0,t=l.length;e=0;n--)if(l[n].contains(l[e])){l.splice(e,1),e--,t--;break}const t=s.getRangeFormatElement(o),i=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(s);i||(r=s.createElement(e));for(let t,o,d=0,u=l.length;d0){const e=l.cloneNode(!1),t=l.childNodes,s=this.util.getPositionIndex(i);for(;t[s];)e.appendChild(t[s]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(o);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],s=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;s=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),o=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,s=0,c=n;s span > span"),i.columnFixedButton=o.querySelector("._se_table_fixed_column"),i.headerButton=o.querySelector("._se_table_header");let a=this.setController_tableEditor(e,i.cellControllerTop);i.resizeDiv=a,i.splitMenu=a.querySelector(".se-btn-group-sub"),i.mergeButton=a.querySelector("._se_table_merge_button"),i.splitButton=a.querySelector("._se_table_split_button"),i.insertRowAboveButton=a.querySelector("._se_table_insert_row_a"),i.insertRowBelowButton=a.querySelector("._se_table_insert_row_b"),s.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e,i)),s.addEventListener("click",this.appendTable.bind(e)),a.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,l),n.element.relative.appendChild(a),n.element.relative.appendChild(o),l=null,s=null,a=null,o=null,i=null},setSubmenu:function(e){const t=e.util.createElement("DIV");return t.className="se-submenu se-selector-table",t.innerHTML='
    1 x 1
    ',t},setController_table:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-table",i.innerHTML='
    ",i},setController_tableEditor:function(e,t){const n=e.lang,i=e.icons,l=e.util.createElement("DIV");return l.className="se-controller se-controller-table-cell",l.innerHTML=(t?"":'
    ')+'
    • '+n.controller.VerticalSplit+'
    • '+n.controller.HorizontalSplit+"
    ",l},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l;if(this.insertComponent(e,!1,!0,!1)){const t=e.querySelector("td div");this.setRange(t,0,t,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e,t){t.stopPropagation();let n=this._w.Math.ceil(t.offsetX/18),i=this._w.Math.ceil(t.offsetY/18);n=n<1?1:n,i=i<1?1:i,e._rtl&&(e.tableHighlight.style.left=18*n-13+"px",n=11-n),e.tableHighlight.style.width=n+"em",e.tableHighlight.style.height=i+"em",this.util.changeTxt(e.tableDisplay,n+" x "+i),e._tableXY=[n,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="10em",t.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;ts||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)));if(s===o&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,s="row"===e;if(s){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(s)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,s=l.length;no&&o>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[s+1];if(e){const t=[];let n=r[s].cells,i=0;for(let e,l,s=0,o=n.length;s1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let s,o,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,s),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!s[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+o?h.push(e):p<=t+o&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+o,p,p+r):n>0&&(pt+o)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&s.length>0&&(p=this.plugins.table.createCells.call(this,s[0].nodeName,0,!0),p=e.insertBefore(p,s[t]))}}if(l){let e,t;for(let n,l=0,s=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,o.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let o,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:s+1,rs:d,row:-1}),i!==l&&u<=a&&u+s>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=s}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}o.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(s,o)+n;for(let e,t,n=0;n=a));c++)l=e[c],s=l.rowSpan-1,s>0&&s+n>=r&&o=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||s===o-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=o.cells;for(let e=0,t=a.length;e0&&o+s>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,o,o+s));else s.push(e[o]);for(let e=0,t=s.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(e){const t=this.context.table,n=t._element;let i,l,s,o;e.indexOf("width")>-1&&(i=t.resizeButton.firstElementChild,l=t.resizeText,t._maxWidth?(s=t.icons.reduction,o=t.minText,t.columnFixedButton.style.display="block",this.util.removeClass(n,"se-table-size-auto"),this.util.addClass(n,"se-table-size-100")):(s=t.icons.expansion,o=t.maxText,t.columnFixedButton.style.display="none",this.util.removeClass(n,"se-table-size-100"),this.util.addClass(n,"se-table-size-auto")),this.util.changeElement(i,s),this.util.changeTxt(l,o)),e.indexOf("column")>-1&&(t._fixedColumn?(this.util.removeClass(n,"se-table-layout-auto"),this.util.addClass(n,"se-table-layout-fixed"),this.util.addClass(t.columnFixedButton,"active")):(this.util.removeClass(n,"se-table-layout-fixed"),this.util.addClass(n,"se-table-layout-auto"),this.util.removeClass(t.columnFixedButton,"active")))},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,s=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=s.length;e0)for(let e,t=0;td||(u>=e.index?(s+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(o){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){o=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==s){c.cs=e,c.ce=t,c.rs=n,c.re=s,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),s+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(t=e.toLowerCase(),i="blockquote"===t?"range":"pre"===t?"free":"replace",r=/^h/.test(t)?t.match(/\d+/)[0]:"",a=n["tag_"+(r?"h":t)]+r,d="",c=""):(t=e.tag.toLowerCase(),i=e.command,a=e.name||t,d=e.class,c=d?' class="'+d+'"':""),o+='
  • ";return o+="",i.innerHTML=o,i},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText;if(e){if(this.util.isFormatElement(e)){const i=this.context.formatBlock._formatList,l=e.nodeName.toLowerCase(),s=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,o=i.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=r.isComponent(i),s=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),o=r.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(r.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,o?o.nextSibling:null),t=i.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!s||!c||/
    $/i.test(s)?s:s+"
    ")+c,0===u){t.insertBefore(n,i),a=i.nextSibling,a&&n.nodeName===a.nodeName&&r.isSameAttributes(n,a)&&(n.innerHTML+="
    "+a.innerHTML,r.removeItem(a));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&r.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,r.removeItem(n))}d||r.removeItem(i),s&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,o=p.length;n('+n.toolbar.default+")";for(let e,t=0,n=l.length;t";return s+="",i.innerHTML=s,i},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()),i=n?n.style.lineHeight+"":"";if(i!==e.currentSize){for(let e=0,n=t.length;e"}return o+="",n.innerHTML=o,n},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return s+="",n.innerHTML=s,n},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,s,o=0,a=t.length;o'+(e.alt||t)+'
    '+(e.name||t)+"
    "},setImage:function(e){this.callPlugin("image",function(){const t={name:e.parentNode.querySelector(".__se__img_name").textContent,size:0};this.plugins.image.create_image.call(this,e.getAttribute("data-value"),null,this.context.image._origin_w,this.context.image._origin_h,"none",t,e.alt)}.bind(this),null)}}},S={rtl:{italic:'',indent:'',outdent:'',list_bullets:'',list_number:'',link:'',unlink:''},redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',fixed_column_width:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',line_break:'',audio:'',image_gallery:'',bookmark:'',download:'',dir_ltr:'',dir_rtl:'',alert_outline:'',more_text:'',more_paragraph:'',more_plus:'',more_horizontal:'',more_vertical:'',attachment:'',map:'',magic_stick:'',empty_file:''},N=n("P6u4"),T=n.n(N);const k={_d:null,_w:null,isIE:null,isIE_Edge:null,isOSX_IOS:null,isChromium:null,isResizeObserverSupported:null,_propertiesInit:function(){this._d||(this._d=document,this._w=window,this.isIE=navigator.userAgent.indexOf("Trident")>-1,this.isIE_Edge=navigator.userAgent.indexOf("Trident")>-1||navigator.appVersion.indexOf("Edge")>-1,this.isOSX_IOS=/(Mac|iPhone|iPod|iPad)/.test(navigator.platform),this.isChromium=!!window.chrome,this.isResizeObserverSupported="function"==typeof ResizeObserver)},_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas",_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return e.replace(/&|\u00A0|'|"|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:String.fromCharCode(8203),zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),fontValueMap:{"xx-small":1,"x-small":2,small:3,medium:4,large:5,"x-large":6,"xx-large":7},onlyZeroWidthSpace:function(e){return null!=e&&("string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e))},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},getValues:function(e){return e?this._w.Object.keys(e).map((function(t){return e[t]})):[]},camelToKebabCase:function(e){return"string"==typeof e?e.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},kebabToCamelCase:function(e){return"string"==typeof e?e.replace(/-[a-zA-Z]/g,(function(e){return e.replace("-","").toUpperCase()})):e.map((function(e){return k.camelToKebabCase(e)}))},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},HTMLEncoder:function(e){const t={"<":"$lt;",">":"$gt;"};return e.replace(/<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},HTMLDecoder:function(e){const t={"$lt;":"<","$gt;":">"};return e.replace(/\$lt;|\$gt;/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},hasOwn:function(e,t){return this._hasOwn.call(e,t)},_hasOwn:Object.prototype.hasOwnProperty,getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",s="js"===t?"src":"href";let o="(?:";for(let t=0,n=e.length;t0?i[0][s]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){if(!e||!e.toString)return 0;e=e.toString();const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e)).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e).length,n=0,null!==t(e).match(/(%0A|%0D)/gi)&&(n=t(e).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return e&&1===e.nodeType&&(this.hasClass(e,"se-wrapper-wysiwyg")||/^BODY$/i.test(e.nodeName))},isNonEditable:function(e){return e&&1===e.nodeType&&"false"===e.getAttribute("contenteditable")},isTextStyleElement:function(e){return e&&3!==e.nodeType&&/^(strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)$/i.test(e.nodeName)},isFormatElement:function(e){return e&&1===e.nodeType&&(/^(P|DIV|H[1-6]|PRE|LI|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD|DETAILS)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isClosureRangeFormatElement:function(e){return e&&1===e.nodeType&&(/^(TH|TD)$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__range__closure_.+(\\s|$)"))},isFreeFormatElement:function(e){return e&&1===e.nodeType&&(/^PRE$/i.test(e.nodeName)||this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)"))&&!this.isComponent(e)&&!this.isWysiwygDiv(e)},isClosureFreeFormatElement:function(e){return e&&1===e.nodeType&&this.hasClass(e,"(\\s|^)__se__format__free__closure_.+(\\s|$)")},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isUneditableComponent:function(e){return e&&this.hasClass(e,"__se__uneditable")},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},isNotCheckingNode:function(e){return e&&/katex|__se__tag/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getClosureFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isClosureFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t,n){t.style.cssText&&(e.style.cssText+=t.style.cssText);const i=t.attributes;for(let t=0,l=i.length;t-1||e.setAttribute(i[t].name,i[t].value);const l=e.attributes;for(let t=0,n=l.length;to?1:s0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const s=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==s;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const o=t&&/iframe/i.test(t.nodeName);return{left:n+(o?t.parentElement.offsetLeft:0),top:i-(s?s.scrollTop:0)+(o?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;let n=!1;const i=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");return i.test(e.className)?e.className=e.className.replace(i," ").trim():(e.className+=" "+t,n=!0),e.className.trim()||e.removeAttribute("class"),n},isImportantDisabled:function(e){return e.hasAttribute("data-important-disabled")},setDisabledButtons:function(e,t,n){for(let i=0,l=t.length;ii))continue;s.appendChild(n[e])}e--,t--,i--}return l.childNodes.length>0&&e.parentNode.insertBefore(l,e),s.childNodes.length>0&&e.parentNode.insertBefore(s,e.nextElementSibling),e}const i=e.parentNode;let l,s,o,a=0,r=!0;if((!n||n<0)&&(n=0),3===e.nodeType){if(a=this.getPositionIndex(e),t>=0&&e.length!==t){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,o=l,l=c.cloneNode(!1),s=c.childNodes,o&&(this.isListCell(l)&&this.isList(o)&&o.firstElementChild?(l.innerHTML=o.firstElementChild.innerHTML,k.removeItem(o.firstElementChild),o.children.length>0&&l.appendChild(o)):l.appendChild(o));s[a];)l.appendChild(s[a]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="
    ");const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this,l=t?t.length:0;let s=null;return l&&(s=this._w.Array.apply(null,new this._w.Array(l)).map(this._w.Number.prototype.valueOf,0)),function e(o,a,r){const c=o.childNodes;for(let d,u,h=0,g=c.length;h=0;){if(i.getArrayIndex(s.childNodes,n)!==e[r]){c=!1;break}n=d.parentNode,s=n.parentNode,r--}c&&(e.splice(a,1),e[a]=h)}}i.copyTagAttributes(d,o),o.parentNode.insertBefore(d,o),i.removeItem(o)}if(!u){1===d.nodeType&&e(d,a+1,h);break}if(d.nodeName===u.nodeName&&i.isSameAttributes(d,u)&&d.href===u.href){const e=d.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const o=d.lastChild,c=u.firstChild;let g=0;if(o&&c){const e=3===o.nodeType&&3===c.nodeType;g=o.textContent.length;let i=o.previousSibling;for(;i&&3===i.nodeType;)g+=i.textContent.length,i=i.previousSibling;if(n>0&&3===o.nodeType&&3===c.nodeType&&(o.textContent.length>0||c.textContent.length>0)&&n--,l){let i=null;for(let d=0;dh){if(a>0&&i[a-1]!==r)continue;i[a]-=1,i[a+1]>=0&&i[a]===h&&(i[a+1]+=n,e&&o&&3===o.nodeType&&c&&3===c.nodeType&&(s[d]+=g))}}}if(3===d.nodeType){if(g=d.textContent.length,d.textContent+=u.textContent,l){let e=null;for(let i=0;ih){if(a>0&&e[a-1]!==r)continue;e[a]-=1,e[a+1]>=0&&e[a]===h&&(e[a+1]+=n,s[i]+=g)}}}else d.innerHTML+=u.innerHTML;i.removeItem(u),h--}else 1===d.nodeType&&e(d,a+1,h)}}(e,0,0),s},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary)[^>^<]+>\s+(?=<)/gi,(function(e){return e.replace(/\n/g,"").replace(/\s+/," ")})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e]*>","gi")},createTagsBlacklist:function(e){return new RegExp("<\\/?\\b(?:\\b"+(e||"^").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},_consistencyCheckOfHTML:function(e,t,n,i){const l=[],s=[],o=[],a=[],r=this.getListChildNodes(e,function(r){if(1!==r.nodeType)return this.isList(r.parentElement)&&l.push(r),!1;if(n.test(r.nodeName)||!t.test(r.nodeName)&&0===r.childNodes.length&&this.isNotCheckingNode(r))return l.push(r),!1;const c=!this.getParentElement(r,this.isNotCheckingNode);if(!this.isTable(r)&&!this.isListCell(r)&&!this.isAnchor(r)&&(this.isFormatElement(r)||this.isRangeFormatElement(r)||this.isTextStyleElement(r))&&0===r.childNodes.length&&c)return s.push(r),!1;if(this.isList(r.parentNode)&&!this.isList(r)&&!this.isListCell(r))return o.push(r),!1;if(this.isCell(r)){const e=r.firstElementChild;if(!this.isFormatElement(e)&&!this.isRangeFormatElement(e)&&!this.isComponent(e))return a.push(r),!1}if(i&&c&&r.className){const e=new this._w.Array(r.classList).map(this._classNameFilter).join(" ").trim();e?r.className=e:r.removeAttribute("class")}return r.parentNode!==e&&c&&(this.isListCell(r)&&!this.isList(r.parentNode)||i&&(this.isFormatElement(r)||this.isComponent(r))&&!this.isRangeFormatElement(r.parentNode)&&!this.getParentElement(r,this.isComponent))}.bind(this));for(let e=0,t=l.length;e=0;l--)t.insertBefore(e,n[l]);c.push(e)}else t.parentNode.insertBefore(e,t),c.push(t);for(let e,t=0,n=c.length;t":e.innerHTML,e.innerHTML=t.outerHTML},_classNameFilter:function(e){return/(^__se__|^se-|katex)/.test(e)?e:""},_setDefaultOptionStyle:function(e,t){let n="";e.height&&(n+="height:"+e.height+";"),e.minHeight&&(n+="min-height:"+e.minHeight+";"),e.maxHeight&&(n+="max-height:"+e.maxHeight+";"),e.position&&(n+="position:"+e.position+";"),e.width&&(n+="width:"+e.width+";"),e.minWidth&&(n+="min-width:"+e.minWidth+";"),e.maxWidth&&(n+="max-width:"+e.maxWidth+";");let i="",l="",s="";const o=(t=n+t).split(";");for(let t,n=0,a=o.length;n'+this._setIframeCssTags(t),e.contentDocument.body.className=t._editableClass,e.contentDocument.body.setAttribute("contenteditable",!0)},_setIframeCssTags:function(e){const t=e.iframeCSSFileName,n=this._w.RegExp;let i="";for(let e,l=0,s=t.length;l'}return i+("auto"===e.height?"":"")}};var L=k,B={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor"+(t.rtl?" se-rtl":""),e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const s=this._createToolBar(n,t.buttonList,t.plugins,t),o=s.element.cloneNode(!1);o.className+=" se-toolbar-shadow",s.element.style.visibility="hidden",s.pluginCallButtons.math&&this._checkKatexMath(t.katex);const a=n.createElement("DIV");a.className="se-arrow";const r=n.createElement("DIV");r.className="se-toolbar-sticky-dummy";const c=n.createElement("DIV");c.className="se-wrapper";const d=this._initElements(t,i,s.element,a),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;const m=u.resizingBar,f=u.navigation,_=u.charWrapper,b=u.charCounter,v=n.createElement("DIV");v.className="se-loading-box sun-editor-common",v.innerHTML='
    ';const y=n.createElement("DIV");y.className="se-line-breaker",y.innerHTML='";const C=n.createElement("DIV");C.className+="se-line-breaker-component";const w=C.cloneNode(!0);C.innerHTML=w.innerHTML=t.icons.line_break;const x=n.createElement("DIV");x.className="se-resizing-back";const E=t.toolbarContainer;E&&(E.appendChild(s.element),E.appendChild(o));const S=t.resizingBarContainer;return m&&S&&S.appendChild(m),c.appendChild(p),g&&c.appendChild(g),E||(l.appendChild(s.element),l.appendChild(o)),l.appendChild(r),l.appendChild(c),l.appendChild(x),l.appendChild(v),l.appendChild(y),l.appendChild(C),l.appendChild(w),m&&!S&&l.appendChild(m),i.appendChild(l),p=this._checkCodeMirror(t,p),{constructed:{_top:i,_relative:l,_toolBar:s.element,_toolbarShadow:o,_menuTray:s._menuTray,_editorArea:c,_wysiwygArea:h,_codeArea:p,_placeholder:g,_resizingBar:m,_navigation:f,_charWrapper:_,_charCounter:b,_loading:v,_lineBreaker:y,_lineBreaker_t:C,_lineBreaker_b:w,_resizeBack:x,_stickyDummy:r,_arrow:a},options:t,plugins:s.plugins,pluginCallButtons:s.pluginCallButtons,_responsiveButtons:s.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n){this._initOptions(t.element.originElement,e);const i=t.element,l=i.relative,s=i.editorArea,o=e.toolbarContainer&&e.toolbarContainer!==n.toolbarContainer,a=e.lang!==n.lang||e.buttonList!==n.buttonList||e.mode!==n.mode||o,r=this._createToolBar(document,a?e.buttonList:n.buttonList,e.plugins,e);r.pluginCallButtons.math&&this._checkKatexMath(e.katex);const c=document.createElement("DIV");c.className="se-arrow",a&&(r.element.style.visibility="hidden",o?(e.toolbarContainer.appendChild(r.element),i.toolbar.parentElement.removeChild(i.toolbar)):i.toolbar.parentElement.replaceChild(r.element,i.toolbar),i.toolbar=r.element,i._menuTray=r._menuTray,i._arrow=c);const d=this._initElements(e,i.topArea,a?r.element:i.toolbar,c),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;return i.resizingBar&&L.removeItem(i.resizingBar),u.resizingBar&&(e.resizingBarContainer&&e.resizingBarContainer!==n.resizingBarContainer?e.resizingBarContainer.appendChild(u.resizingBar):l.appendChild(u.resizingBar)),s.innerHTML="",s.appendChild(p),g&&s.appendChild(g),p=this._checkCodeMirror(e,p),i.resizingBar=u.resizingBar,i.navigation=u.navigation,i.charWrapper=u.charWrapper,i.charCounter=u.charCounter,i.wysiwygFrame=h,i.code=p,i.placeholder=g,e.rtl?L.addClass(i.topArea,"se-rtl"):L.removeClass(i.topArea,"se-rtl"),{callButtons:r.pluginCallButtons,plugins:r.plugins,toolbar:r}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");if(l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe)l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame,l.className+=e.className;else{l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto");for(let t in e.iframeAttributes)l.setAttribute(t,e.iframeAttributes[t]);l.className+=" "+e._editableClass,l.style.cssText=e._editorStyles.frame+e._editorStyles.editor,l.className+=e.className}const s=document.createElement("TEXTAREA");s.className="se-wrapper-inner se-wrapper-code"+e.className,s.style.cssText=e._editorStyles.frame,s.style.display="none","auto"===e.height&&(s.style.overflow="hidden");let o=null,a=null,r=null,c=null;if(e.resizingBar&&(o=document.createElement("DIV"),o.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",o.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}o.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:o,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:s,placeholder:d}},_initOptions:function(e,t){const n={};if(t.plugins){const e=t.plugins,i=e.length?e:Object.keys(e).map((function(t){return e[t]}));for(let e,t=0,l=i.length;t0?t.defaultTag:"p";const i=t.textTags=[{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",sub:"SUB",sup:"SUP"},t.textTags||{}].reduce((function(e,t){for(let n in t)e[n]=t[n];return e}),{});t._textTagsMap={strong:i.bold.toLowerCase(),b:i.bold.toLowerCase(),u:i.underline.toLowerCase(),ins:i.underline.toLowerCase(),em:i.italic.toLowerCase(),i:i.italic.toLowerCase(),del:i.strike.toLowerCase(),strike:i.strike.toLowerCase(),s:i.strike.toLowerCase(),sub:i.sub.toLowerCase(),sup:i.sup.toLowerCase()},t._defaultCommand={bold:t.textTags.bold,underline:t.textTags.underline,italic:t.textTags.italic,strike:t.textTags.strike,subscript:t.textTags.sub,superscript:t.textTags.sup};t.tagsBlacklist=t.tagsBlacklist||"",t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",t._editorTagsWhitelist="*"===t.addTagsWhitelist?"*":this._setWhitelist(t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.tagsBlacklist),t.pasteTagsBlacklist=t.tagsBlacklist+(t.tagsBlacklist&&t.pasteTagsBlacklist?"|"+t.pasteTagsBlacklist:t.pasteTagsBlacklist||""),t.pasteTagsWhitelist="*"===t.pasteTagsWhitelist?"*":this._setWhitelist("string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.pasteTagsBlacklist),t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.attributesBlacklist=t.attributesBlacklist&&"object"==typeof t.attributesBlacklist?t.attributesBlacklist:null,t.mode=t.mode||"classic",t.rtl=!!t.rtl,t.lineAttrReset="string"==typeof t.lineAttrReset&&t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):null,t._editableClass="sun-editor-editable"+(t.rtl?" se-rtl":""),t._printClass="string"==typeof t._printClass?t._printClass:null,t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer="string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.hideToolbar=!!t.hideToolbar,t.fullScreenOffset=void 0===t.fullScreenOffset?0:/^\d+/.test(t.fullScreenOffset)?L.getNumber(t.fullScreenOffset,0):0,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||!!t.iframe,t.iframeAttributes=t.iframeAttributes||{},t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.previewTemplate="string"==typeof t.previewTemplate?t.previewTemplate:null,t.printTemplate="string"==typeof t.printTemplate?t.printTemplate:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.mathFontSize=t.mathFontSize?t.mathFontSize:[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.resizeEnable=void 0===t.resizeEnable||!!t.resizeEnable,t.resizingBarContainer="string"==typeof t.resizingBarContainer?document.querySelector(t.resizingBarContainer):t.resizingBarContainer,t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.className="string"==typeof t.className&&t.className.length>0?" "+t.className:"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim().toLowerCase()||"px",t.alignItems="object"==typeof t.alignItems?t.alignItems:t.rtl?["right","center","left","justify"]:["left","center","right","justify"],t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageAlignShow=void 0===t.imageAlignShow||!!t.imageAlignShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.imageGalleryHeader=t.imageGalleryHeader||null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoAlignShow=void 0===t.videoAlignShow||!!t.videoAlignShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.linkTargetNewWindow=!!t.linkTargetNewWindow,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.linkRel=Array.isArray(t.linkRel)?t.linkRel:[],t.linkRelDefault=t.linkRelDefault||{},t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)?t.shortcutsDisable:[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.mediaAutoSelect=void 0===t.mediaAutoSelect||!!t.mediaAutoSelect,t.buttonList=t.buttonList?t.buttonList:[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.rtl&&(t.buttonList=t.buttonList.reverse()),t.icons=t.icons&&"object"==typeof t.icons?[S,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):S,t.icons=t.rtl?[t.icons,t.icons.rtl].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):t.icons,t.__listCommonStyle=t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"],t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_setWhitelist:function(e,t){if("string"!=typeof t)return e;t=t.split("|"),e=e.split("|");for(let n,i=0,l=t.length;i-1&&e.splice(n,1);return e.join("|")},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=L.isOSX_IOS?"⇧":"+SHIFT",s=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent","save"],o=e.rtl?["[","]"]:["]","["],a=e.rtl?[t.outdent,t.indent]:[t.indent,t.outdent];return{bold:["",n.toolbar.bold+''+(s.indexOf("bold")>-1?"":i+'+B')+"","bold","",t.bold],underline:["",n.toolbar.underline+''+(s.indexOf("underline")>-1?"":i+'+U')+"","underline","",t.underline],italic:["",n.toolbar.italic+''+(s.indexOf("italic")>-1?"":i+'+I')+"","italic","",t.italic],strike:["",n.toolbar.strike+''+(s.indexOf("strike")>-1?"":i+l+'+S')+"","strike","",t.strike],subscript:["",n.toolbar.subscript,"SUB","",t.subscript],superscript:["",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["",n.toolbar.indent+''+(s.indexOf("indent")>-1?"":i+'+'+o[0]+"")+"","indent","",a[0]],outdent:["",n.toolbar.outdent+''+(s.indexOf("indent")>-1?"":i+'+'+o[1]+"")+"","outdent","",a[1]],fullScreen:["se-code-view-enabled se-resizing-enabled",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled",n.toolbar.codeView,"codeView","",t.code_view],undo:["",n.toolbar.undo+''+(s.indexOf("undo")>-1?"":i+'+Z')+"","undo","",t.undo],redo:["",n.toolbar.redo+''+(s.indexOf("undo")>-1?"":i+'+Y / '+i+l+'+Z')+"","redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],dir:["",n.toolbar[e.rtl?"dir_ltr":"dir_rtl"],"dir","",t[e.rtl?"dir_ltr":"dir_rtl"]],dir_ltr:["",n.toolbar.dir_ltr,"dir_ltr","",t.dir_ltr],dir_rtl:["",n.toolbar.dir_rtl,"dir_rtl","",t.dir_rtl],save:["se-resizing-enabled",n.toolbar.save+''+(s.indexOf("save")>-1?"":i+'+S')+"","save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",e.rtl?t.align_right:t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,s,o){const a=L.createElement("LI"),r=L.createElement("BUTTON"),c=t||n;return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("aria-label",c.replace(//,"")),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=o[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+c+"",s&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const s=e.createElement("DIV");s.className="se-toolbar sun-editor-common";const o=e.createElement("DIV");o.className="se-btn-tray",s.appendChild(o),t=JSON.parse(JSON.stringify(t));const a=i.icons,r=this._defaultButtons(i),c={},d=[];let u=null,h=null,g=null,p=null,m="",f=!1;const _=L.createElement("DIV");_.className="se-toolbar-more-layer";e:for(let i,s,b,v,y,C=0;C",_.appendChild(s),s=s.firstElementChild.firstElementChild)}if(f){const e=l.cloneNode(!1);o.appendChild(e)}o.appendChild(g.div),f=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",o.appendChild(t),f=!1}switch(o.children.length){case 0:o.style.display="none";break;case 1:L.removeClass(o.firstElementChild,"se-btn-module-border");break;default:if(i.rtl){const e=l.cloneNode(!1);e.style.float=o.lastElementChild.style.float,o.appendChild(e)}}d.length>0&&d.unshift(t),_.children.length>0&&o.appendChild(_);const b=e.createElement("DIV");b.className="se-menu-tray",s.appendChild(b);const v=e.createElement("DIV");return v.className="se-toolbar-cover",s.appendChild(v),i.hideToolbar&&(s.style.display="none"),{element:s,plugins:n,pluginCallButtons:c,responsiveButtons:d,_menuTray:b,_buttonTray:o}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_toolbarShadow:t._toolbarShadow,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector('[data-command="bold"]'),underline:t._toolBar.querySelector('[data-command="underline"]'),italic:t._toolBar.querySelector('[data-command="italic"]'),strike:t._toolBar.querySelector('[data-command="strike"]'),sub:t._toolBar.querySelector('[data-command="SUB"]'),sup:t._toolBar.querySelector('[data-command="SUP"]'),undo:t._toolBar.querySelector('[data-command="undo"]'),redo:t._toolBar.querySelector('[data-command="redo"]'),save:t._toolBar.querySelector('[data-command="save"]'),outdent:t._toolBar.querySelector('[data-command="outdent"]'),indent:t._toolBar.querySelector('[data-command="indent"]'),fullScreen:t._toolBar.querySelector('[data-command="fullScreen"]'),showBlocks:t._toolBar.querySelector('[data-command="showBlocks"]'),codeView:t._toolBar.querySelector('[data-command="codeView"]'),dir:t._toolBar.querySelector('[data-command="dir"]'),dir_ltr:t._toolBar.querySelector('[data-command="dir_ltr"]'),dir_rtl:t._toolBar.querySelector('[data-command="dir_rtl"]')},options:n,option:n}},z={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},M={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=B.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,s){const o=e.element.originElement.ownerDocument||document,a=o.defaultView||window,r=L,c=l.icons,d={_d:o,_w:a,_parser:new a.DOMParser,_prevRtl:l.rtl,_editorHeight:0,_editorHeightPadding:0,_listCamel:l.__listCommonStyle,_listKebab:r.camelToKebabCase(l.__listCommonStyle),_wd:null,_ww:null,_shadowRoot:null,_shadowRootControllerEventTarget:null,util:r,functions:null,options:null,wwComputedStyle:null,notice:z,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:[],resizingDisabledButtons:[],_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_htmlCheckBlacklistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,editorTagsBlacklistRegExp:null,pasteTagsWhitelistRegExp:null,pasteTagsBlacklistRegExp:null,hasFocus:!1,isDisabled:!1,isReadOnly:!1,_attributesWhitelistRegExp:null,_attributesWhitelistRegExp_all_data:null,_attributesBlacklistRegExp:null,_attributesTagsWhitelist:null,_attributesTagsBlacklist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:{},_commandMapStyles:{STRONG:["font-weight"],U:["text-decoration"],EM:["font-style"],DEL:["text-decoration"]},_styleCommandMap:null,_cleanStyleRegExp:{span:new a.RegExp("\\s*[^-a-zA-Z](font-family|font-size|color|background-color)\\s*:[^;]+(?!;)*","ig"),format:new a.RegExp("\\s*[^-a-zA-Z](text-align|margin-left|margin-right)\\s*:[^;]+(?!;)*","ig"),fontSizeUnit:new a.RegExp("\\d+"+l.fontSizeUnit+"$","i")},_variable:{isChanged:!1,isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:2,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},_formatAttrsTemp:null,_saveButtonStates:function(){this.allCommandButtons||(this.allCommandButtons={});const e=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let t,n,i=0;ie?c-e:0,l=i>0?0:e-c;n.style.left=d-i+l+"px",o.left>u._getEditorOffsets(n).left&&(n.style.left="0px")}else{const e=s<=c?0:s-(d+c);n.style.left=e<0?d+e+"px":d+"px"}let h=0,g=t;for(;g&&g!==i;)h+=g.offsetTop,g=g.offsetParent;const p=h;this._isBalloon?h+=i.offsetTop+t.offsetHeight:h-=t.offsetHeight;const m=o.top,f=n.offsetHeight,_=this.getGlobalScrollOffset().top,b=a.innerHeight-(m-_+p+t.parentElement.offsetHeight);if(bb?(n.style.height=l+"px",e=-1*(l-p+3)):(n.style.height=b+"px",e=p+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=p+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0)for(let e=0;e0){for(let e=0;eu?d-u:0,i=n>0?0:u-d;t.style.left=c-n+i+"px",n>0&&h&&(h.style.left=(d-14<10+n?d-14:10+n)+"px");const l=e.element.wysiwygFrame.offsetLeft-t.offsetLeft;l>0&&(t.style.left="0px",h&&(h.style.left=l+"px"))}else{t.style.left=c+"px";const n=e.element.wysiwygFrame.offsetWidth-(t.offsetLeft+d);n<0?(t.style.left=t.offsetLeft+n+"px",h&&(h.style.left=20-n+"px")):h&&(h.style.left="20px")}t.style.visibility=""},execCommand:function(e,t,n){this._wd.execCommand(e,t,"formatBlock"===e?"<"+n+">":n),this.history.push(!0)},nativeFocus:function(){this.__focus(),this._editorRange()},__focus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const n=t.commonAncestorContainer.children[t.startOffset];if(!r.isFormatElement(n)&&!r.isComponent(n)){const t=r.createElement(l.defaultTag),i=r.createElement("BR");return t.appendChild(i),e.element.wysiwyg.insertBefore(t,n),void this.setRange(i,0,i,0)}}this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},blur:function(){l.iframe?e.element.wysiwygFrame.blur():e.element.wysiwyg.blur()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length),r.isFormatElement(e)&&(e=e.childNodes[t]||e.childNodes[t-1]||e,t=t>0?1===e.nodeType?1:e.textContent?e.textContent.length:0:0),r.isFormatElement(n)&&(n=n.childNodes[i]||n.childNodes[i-1]||n,i=i>0?1===n.nodeType?1:n.textContent?n.textContent.length:0:0);const s=this._wd.createRange();try{s.setStart(e,t),s.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const o=this.getSelection();return o.removeAllRanges&&o.removeAllRanges(),o.addRange(s),this._rangeInfo(s,this.getSelection()),l.iframe&&this.__focus(),s},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.hasFocus&&this.getSelection().removeAllRanges(),this._setKeyEffect([])},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,s=r.compareElements(e,t),o=s.ancestor&&(0===s.result?i<=l:s.result>1);return this.setRange(o?e:t,o?i:l,o?t:e,o?l:i)}},getRange_addLine:function(t,n){if(this._selectionVoid(t)){const i=e.element.wysiwyg,s=r.createElement(l.defaultTag);s.innerHTML="
    ",i.insertBefore(s,n&&n!==i?n.nextElementSibling:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){const t=this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection();return this._variable._range||e.element.wysiwyg.contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t},getSelectionNode:function(){if(e.element.wysiwyg.contains(this._variable._selectionNode)||this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this.getSelection();if(!e)return null;let t=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),r.isFormatElement(t.endContainer)&&0===t.endOffset&&(t=this.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.length)),this._rangeInfo(t,e)},_rangeInfo:function(e,t){let n=null;this._variable._range=e,n=e.collapsed?r.isWysiwygDiv(e.commonAncestorContainer)&&e.commonAncestorContainer.children[e.startOffset]||e.commonAncestorContainer:t.extentNode||t.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg,n=this._wd.createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=r.createElement("BR"),i.appendChild(s))):(i=r.createElement(l.defaultTag),s=r.createElement("BR"),i.appendChild(s),t.appendChild(i)),n.setStart(s,0),n.setEnd(s,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;let n,i,s,o=t.startContainer,a=t.startOffset,c=t.endContainer,d=t.endOffset;if(r.isFormatElement(o))for(o.childNodes[a]?(o=o.childNodes[a]||o,a=0):(o=o.lastChild||o,a=o.textContent.length);o&&1===o.nodeType&&o.firstChild;)o=o.firstChild||o,a=0;if(r.isFormatElement(c)){for(c=c.childNodes[d]||c.lastChild||c;c&&1===c.nodeType&&c.lastChild;)c=c.lastChild;d=c.textContent.length}if(n=r.isWysiwygDiv(o)?e.element.wysiwyg.firstChild:o,i=a,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&o===c&&(c=n,d=1)}}if(o=n,a=i,n=r.isWysiwygDiv(c)?e.element.wysiwyg.lastChild:c,i=d,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(s=n.childNodes,0!==s.length);)n=s[i>0?i-1:i]||!/FIGURE/i.test(s[0].nodeName)?s[0]:n.previousElementSibling||n.previousSibling||o,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":l.defaultTag),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&!n.previousSibling&&r.removeItem(c)}}return c=n,d=i,this.setRange(o,a,c,d),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,s=n.commonAncestorContainer,o=r.getListChildren(s,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(s)||r.isRangeFormatElement(s)||o.unshift(r.getFormatElement(s,null)),i===l||1===o.length)return o;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=o.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t,n){return"end"!==n&&0===t||(!n||"front"!==n)&&!e.nodeValue&&1===t||(!n||"end"===n)&&!!e.nodeValue&&t===e.nodeValue.length},_isEdgeFormat:function(e,t,n){if(!this.isEdgePoint(e,t,n))return!1;const i=[];for(n="front"===n?"previousSibling":"nextSibling";e&&!r.isFormatElement(e)&&!r.isWysiwygDiv(e);){if(e[n]&&(!r.isBreak(e[n])||e[n][n]))return null;1===e.nodeType&&i.push(e.cloneNode(!1)),e=e.parentNode}return i},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){if(!e||!e.parentNode)return null;const n=r.getFormatElement(this.getSelectionNode(),null);let i=null;if(!r.isFormatElement(e)&&r.isFreeFormatElement(n||e.parentNode))i=r.createElement("BR");else{const e=t?"string"==typeof t?t:t.nodeName:!r.isFormatElement(n)||r.isRangeFormatElement(n)||r.isFreeFormatElement(n)?l.defaultTag:n.nodeName;i=r.createElement(e),i.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(i,t||n,["id"])}return r.isCell(e)?e.insertBefore(i,e.nextElementSibling):e.parentNode.insertBefore(i,e.nextElementSibling),i},insertComponent:function(e,t,n,i){if(this.isReadOnly||n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange(),l.container);let s=null,o=this.getSelectionNode(),a=r.getFormatElement(o,null);if(r.isListCell(a))this.insertNode(e,o===a?null:l.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));s=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),s&&(a=s.previousSibling)}this.insertNode(e,r.isRangeFormatElement(a)?null:a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){this.setRange(e,0,e,0);const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):s&&(s=r.getEdgeChildNodes(s,null).sc||s,this.setRange(s,0,s,0))}return t||this.history.push(1),s||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){if(r.isUneditableComponent(r.getParentElement(e,r.isComponent))||r.isUneditableComponent(e))return!1;this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent),i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,s="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,o=r.isListCell(n.parentNode);let a,c,d;(o?n.previousSibling:r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(s).left+d+"px",i.display="block"),(o?n.nextSibling:r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=s.offsetWidth/2/2),l.top=a+s.offsetHeight-c-12+"px",l.left=r.getOffset(s).left+s.offsetWidth-d-24+"px",l.display="block")},_checkDuplicateNode:function(e,t){!function e(n){d._dupleCheck(n,t);const i=n.childNodes;for(let t=0,n=i.length;t-1&&n.splice(e,1);for(let t=0,n=s.classList.length;t_?m.splitText(_):m.nextSibling;else if(r.isBreak(s))n=s,s=s.parentNode;else{let e=s.childNodes[f];const i=e&&3===e.nodeType&&r.onlyZeroWidthSpace(e)&&r.isBreak(e.nextSibling)?e.nextSibling:e;i?!i.nextSibling&&r.isBreak(i)?(s.removeChild(i),n=null):n=r.isBreak(i)&&!r.isBreak(t)?i:i.nextSibling:n=null}else{if(v===y){n=this.isEdgePoint(y,_)?y.nextSibling:y.splitText(_);let e=v;this.isEdgePoint(v,f)||(e=v.splitText(f)),s.removeChild(e),0===s.childNodes.length&&p&&(s.innerHTML="
    ")}else{const e=this.removeNode(),i=e.container,o=e.prevContainer;if(i&&0===i.childNodes.length&&p&&(r.isFormatElement(i)?i.innerHTML="
    ":r.isRangeFormatElement(i)&&(i.innerHTML="<"+l.defaultTag+">
    ")),r.isListCell(i)&&3===t.nodeType)s=i,n=null;else if(!p&&o)if(s=3===o.nodeType?o.parentNode:o,s.contains(i)){let e=!0;for(n=i;n.parentNode&&n.parentNode!==s;)n=n.parentNode,e=!1;e&&i===o&&(n=n.nextSibling)}else n=null;else r.isWysiwygDiv(i)&&!r.isFormatElement(t)?(s=i.appendChild(r.createElement(l.defaultTag)),n=null):s=(n=p?y:i===o?i.nextSibling:i)&&n.parentNode?n.parentNode:m;for(;n&&!r.isFormatElement(n)&&n.parentNode!==m;)n=n.parentNode}}try{if(!u){if((r.isWysiwygDiv(n)||s===e.element.wysiwyg.parentNode)&&(s=e.element.wysiwyg,n=null),r.isFormatElement(t)||r.isRangeFormatElement(t)||!r.isListCell(s)&&r.isComponent(t)){const e=s;if(r.isList(n))s=n,n=null;else if(r.isListCell(n))s=n.previousElementSibling||n;else if(!o&&!n){const e=this.removeNode(),t=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(t)||r.isRangeFormatElement(t);s=i?t:t.parentNode,n=i?null:t.nextSibling}0===e.childNodes.length&&s!==e&&r.removeItem(e)}if(!p||g||r.isRangeFormatElement(s)||r.isListCell(s)||r.isWysiwygDiv(s)||(n=s.nextElementSibling,s=s.parentNode),r.isWysiwygDiv(s)&&(3===t.nodeType||r.isBreak(t))){const e=r.createElement(l.defaultTag);e.appendChild(t),t=e}}if(u?h.parentNode?(s=h,n=a):(s=e.element.wysiwyg,n=null):n=s===n?s.lastChild:n,r.isListCell(t)&&!r.isList(s)){if(r.isListCell(s))n=s.nextElementSibling,s=s.parentNode;else{const e=r.createElement("ol");s.insertBefore(e,n),s=e,n=null}u=!0}if(this._checkDuplicateNode(t,s),s.insertBefore(t,n),u)if(r.onlyZeroWidthSpace(d.textContent.trim()))r.removeItem(d),t=t.lastChild;else{const e=r.getArrayItem(d.children,r.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(s.appendChild(t),t=s),r.onlyZeroWidthSpace(d.textContent.trim())&&r.removeItem(d))}}catch(e){s.appendChild(t),console.warn("[SUNEDITOR.insertNode.warn] "+e)}finally{const e=s.querySelectorAll("[data-se-duple]");if(e.length>0)for(let n,i,l,s,o=0,a=e.length;o0&&(t.textContent=i+t.textContent,r.removeItem(e)),n&&n.length>0&&(t.textContent+=l,r.removeItem(n));const s={container:t,startOffset:i.length,endOffset:t.textContent.length-l.length};return this.setRange(t,s.startOffset,t,s.endOffset),s}if(!r.isBreak(t)&&!r.isListCell(t)&&r.isFormatElement(s)){let n=null;t.previousSibling&&!r.isBreak(t.previousSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t)),t.nextSibling&&!r.isBreak(t.nextSibling)||(n=r.createTextNode(r.zeroWidthSpace),t.parentNode.insertBefore(n,t.nextSibling)),r._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0)}this.setRange(t,e,t,e)}return this.history.push(!0),t}},_setIntoFreeFormat:function(e){const t=e.parentNode;let n,i;for(;r.isFormatElement(e)||r.isRangeFormatElement(e);){for(n=e.childNodes,i=null;n[0];)if(i=n[0],r.isFormatElement(i)||r.isRangeFormatElement(i)){if(this._setIntoFreeFormat(i),!e.parentNode)break;n=e.childNodes}else t.insertBefore(i,e);0===e.childNodes.length&&r.removeItem(e),e=r.createElement("BR"),t.insertBefore(e,i.nextSibling)}return e},removeNode:function(){this._resetRangeToTextNode();const t=this.getRange();let n,i=0,l=t.startContainer,s=t.endContainer,o=t.startOffset,a=t.endOffset;const c=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===l.parentNode?l.parentNode:t.commonAncestorContainer;if(c===l&&c===s&&(l=c.children[o],s=c.children[a],o=a=0),!l||!s)return{container:c,offset:0};if(l===s&&t.collapsed&&l.textContent&&r.onlyZeroWidthSpace(l.textContent.substr(o)))return{container:l,offset:o,prevContainer:l&&l.parentNode?l:null};let d=null,u=null;const h=r.getListChildNodes(c,null);let g=r.getArrayIndex(h,l),p=r.getArrayIndex(h,s);if(h.length>0&&g>-1&&p>-1){for(let e=g+1,t=l;e>=0;e--)h[e]===t.parentNode&&h[e].firstChild===t&&0===o&&(g=e,t=t.parentNode);for(let e=p-1,t=s;e>g;e--)h[e]===t.parentNode&&1===h[e].nodeType&&(h.splice(e,1),t=t.parentNode,--p)}else{if(0===h.length){if(r.isFormatElement(c)||r.isRangeFormatElement(c)||r.isWysiwygDiv(c)||r.isBreak(c)||r.isMedia(c))return{container:c,offset:0};if(3===c.nodeType)return{container:c,offset:a};h.push(c),l=s=c}else if(l=s=h[0],r.isBreak(l)||r.onlyZeroWidthSpace(l))return{container:r.isMedia(c)?c:l,offset:0};g=p=0}for(let e=g;e<=p;e++){const t=h[e];if(0===t.length||3===t.nodeType&&void 0===t.data)this._nodeRemoveListItem(t);else if(t!==l)if(t!==s)this._nodeRemoveListItem(t);else{if(1===s.nodeType){if(r.isComponent(s))continue;u=r.createTextNode(s.textContent)}else u=r.createTextNode(s.substringData(a,s.length-a));u.length>0?s.data=u.data:this._nodeRemoveListItem(s)}else{if(1===l.nodeType){if(r.isComponent(l))continue;d=r.createTextNode(l.textContent)}else t===s?(d=r.createTextNode(l.substringData(0,o)+s.substringData(a,s.length-a)),i=o):d=r.createTextNode(l.substringData(0,o));if(d.length>0?l.data=d.data:this._nodeRemoveListItem(l),t===s)break}}const m=r.getParentElement(s,"ul"),f=r.getParentElement(l,"li");if(m&&f&&f.contains(m)?(n=m.previousSibling,i=n.textContent.length):n=s&&s.parentNode?s:l&&l.parentNode?l:t.endContainer||t.startContainer,!r.isWysiwygDiv(n)&&0===n.childNodes.length){const t=r.removeItemAllParents(n,null,null);t&&(n=t.sc||t.ec||e.element.wysiwyg)}return this.setRange(n,i,n,i),this.history.push(!0),{container:n,offset:i,prevContainer:l&&l.parentNode?l:null}},_nodeRemoveListItem:function(e){const t=r.getFormatElement(e,null);r.removeItem(e),r.isListCell(t)&&(r.removeItemAllParents(t,null,null),t&&r.isList(t.firstChild)&&t.insertBefore(r.createTextNode(r.zeroWidthSpace),t.firstChild))},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange(),null);const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,s,o,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,s=t.indexOf(i),o=t.indexOf(l),t.splice(s,o-s+1),c=t.length}else;let n,i,l,s=t[t.length-1];n=r.isRangeFormatElement(s)||r.isFormatElement(s)?s:r.getRangeFormatElement(s,null)||r.getFormatElement(s,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let o=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,s,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],s=n.parentNode,s&&!e.contains(s))if(u=r.getElementDepth(n),r.isList(s)){if(null===a&&(p?(a=p,m=!0,p=null):a=s.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==s){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=s.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(s,c,null,!0,!0);o>=u?(o=u,l=_.cc,i=d(l,s,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(o=u,l=s,i=n.nextSibling),e.appendChild(n),l!==s&&(h=d(l,s),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,s){const o=this.getRange();let a=o.startOffset,c=o.endOffset,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),u=e.parentNode,h=null,g=null,p=e.cloneNode(!1);const m=[],f=r.isList(n);let _=!1,b=!1,v=!1;function y(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace,a=c=1),3===n.nodeType)return t.insertBefore(n,i),n;const s=(v?n:l).childNodes;let o=n.cloneNode(!1),d=null,u=null;for(;s[0];)u=s[0],!r._notTextNode(u)||r.isBreak(u)||r.isListCell(o)?o.appendChild(u):(o.childNodes.length>0&&(d||(d=o),t.insertBefore(o,i),o=n.cloneNode(!1)),t.insertBefore(u,i),d||(d=u));if(o.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(o)&&r.isList(i))if(f){for(d=i;i;)o.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(o,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=o.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,b=!0}}else t.insertBefore(o,i);d||(d=o)}return d}for(let s,o,a,c=0,C=d.length;c0&&(u.insertBefore(p,e),p=null),!f&&r.isListCell(s))if(a&&r.getElementDepth(s)!==r.getElementDepth(a)&&(r.isListCell(u)||r.getArrayItem(s.children,r.isList,!1))){const t=s.nextElementSibling,n=r.detachNestedList(s,!1);e===n&&t===s.nextElementSibling||(e=n,b=!0)}else{const t=s;s=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":l.defaultTag);const n=r.isListCell(s),o=t.childNodes;for(;o[0]&&(!r.isList(o[0])||n);)s.appendChild(o[0]);r.copyFormatAttributes(s,t),v=!0}else s=s.cloneNode(!1);if(!b&&(i?(m.push(s),r.removeItem(d[c])):(n?(_||(u.insertBefore(n,e),_=!0),s=y(n,s,null,d[c])):s=y(u,s,e,d[c]),b||(t?(g=s,h||(h=s)):h||(h=g=s))),b)){b=v=!1,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),p=e.cloneNode(!1),u=e.parentNode,c=-1,C=d.length;continue}}const C=e.parentNode;let w=e.nextSibling;p&&p.children.length>0&&C.insertBefore(p,w),n?h=n.previousSibling:h||(h=e.previousSibling),w=e.nextSibling!==p?e.nextSibling:p?p.nextSibling:null,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null,!1);let x=null;if(i)x={cc:C,sc:h,so:a,ec:w,eo:c,removeArray:m};else{h||(h=g),g||(g=h);const e=r.getEdgeChildNodes(h,g.parentNode?h:g);x={cc:(e.sc||e.ec).parentNode,sc:e.sc,so:a,ec:e.ec,eo:c,removeArray:null}}if(this.effectNode=null,s)return x;!i&&x&&(t?this.setRange(x.sc,a,x.ec,c):this.setRange(x.sc,0,x.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,s=null,o=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const s=!e,o=s&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(o&&l.collapsed&&r.isFormatElement(c.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c)){const e=c.parentNode;if(!r.isListCell(e)||!r.getValues(e.style).some(function(e){return this._listKebab.indexOf(e)>-1}.bind(this)))return}if(l.collapsed&&!o&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),s&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!o&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!s||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=o||s&&function(e){for(let t=0,n=e.length;t0&&this._resetCommonListCell(E[N],t)&&(n=!0),this._resetCommonListCell(E[0],t)&&(n=!0),n&&this.setRange(c,d,u,h),N>0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,o,s,w,L,B));for(let n,i=N-1;i>0;i--)this._resetCommonListCell(E[i],t),m=e.cloneNode(!1),n=this._nodeChange_middleLine(E[i],m,x,o,s,w,_.container),n.endContainer&&n.ancestor.contains(n.endContainer)&&(_.ancestor=null,_.container=n.endContainer),this._setCommonListStyle(n.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,o,s,w,L,B,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_resetCommonListCell:function(e,t){if(!r.isListCell(e))return;t||(t=this._listKebab);const n=r.getArrayItem(e.childNodes,(function(e){return!r.isBreak(e)}),!0),i=e.style,s=[],o=[],a=r.getValues(i);for(let e=0,n=this._listKebab.length;e-1&&t.indexOf(this._listKebab[e])>-1&&(s.push(this._listCamel[e]),o.push(this._listKebab[e]));if(!s.length)return;const c=r.createElement("SPAN");for(let e=0,t=s.length;e0&&(e.insertBefore(d,u),d=c.cloneNode(!1),u=null,h=!0));return d.childNodes.length>0&&(e.insertBefore(d,u),h=!0),i.length||e.removeAttribute("style"),h},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)}),!0);if(!(t=n[0])||n.length>1||1!==t.nodeType)return;const i=t.style,s=e.style,o=t.nodeName.toLowerCase();let a=!1;l._textTagsMap[o]===l._defaultCommand.bold.toLowerCase()&&(s.fontWeight="bold"),l._textTagsMap[o]===l._defaultCommand.italic.toLowerCase()&&(s.fontStyle="italic");const c=r.getValues(i);if(c.length>0)for(let e=0,t=this._listCamel.length;e-1&&(s[this._listCamel[e]]=i[this._listCamel[e]],i.removeProperty(this._listKebab[e]),a=!0);if(this._setCommonListStyle(e,t),a&&!i.length){const e=t.childNodes,n=t.parentNode,i=t.nextSibling;for(;e.length>0;)n.insertBefore(e[0],i);r.removeItem(t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,s,o,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===s.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(s.textContent.slice(o))){const n=m.childNodes;let a=!0;for(let e,t,l,o,c=0,d=n.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o=N?k-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(s)||l.appendChild(s);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||o;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=o,N=0,L=!0,C!==o&&C.appendChild(S),!v)continue}if(B||a!==T){if(L){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const s=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=B?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||s.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(s);const o=y.pop()||a;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!p(t.parentNode)||p(o)||r.onlyZeroWidthSpace(t)||(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),B||E||!p(o))o===a?l=B?b:t:B?(b.appendChild(o),l=C):(t.appendChild(o),l=C);else{t=t.cloneNode(!1);const e=o.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(k,T.length-k)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,k));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const s=y.pop()||l;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(s),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(s),T=l,k=l.data.length,B=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:s,endOffset:o};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t,!1),u&&(N=S.textContent.length,k=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),k=M?T.textContent.length:k;const I={s:0,e:0},H=r.getNodePath(S,b,I),R=!T.parentNode;R&&(T=S);const O={s:0,e:0},D=r.getNodePath(T,b,R||M?null:O);N+=I.s,k=u?N:R?S.textContent.length:M?k+I.s:k+O.s;const F=r.mergeSameTags(b,[H,D],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(H,b),T=r.getNodeFromPath(D,b),{ancestor:b,startContainer:S,startOffset:N+F[0],endContainer:T,endOffset:k+F[1]}},_nodeChange_startLine:function(e,t,n,i,l,s,o,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!o&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,s=i.previousSibling;for(;s;){if(!r.onlyZeroWidthSpace(s)){n=!1;break}s=s.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const s=i.childNodes;for(let i,o,a=0,h=s.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=o,C=0,w=!0,l.appendChild(y)}}}(e,m),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(s=s&&o)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}s.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const s=i.childNodes;for(let i,u,h=0,g=s.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,o&&g.contains(o)){const e=r.getNodePath(o,g);o=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!s.v)return{ancestor:e,endContainer:o};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else o?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),s=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const o=m.pop()||l;for(_=f=o;m.length>0;)f=m.pop(),_.appendChild(f),_=f;o!==l?(t.insertBefore(o,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=s,y=s.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),o&&!s&&!a.v)return{ancestor:e,container:i,offset:l};if(s=s&&o)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,this._commandMapStyles[n]||null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],s="indent"!==e,o=l.rtl?"marginRight":"marginLeft";let a=t.startContainer,c=t.endContainer,d=t.startOffset,u=t.endOffset;for(let e,t,l=0,a=n.length;l0&&this.plugins.list.editInsideList.call(this,s,i),this.effectNode=null,this.setRange(a,d,c,u),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(r.isNonEditable(e.element.wysiwygFrame)||this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),r.isNonEditable(e.element.wysiwygFrame)||(this.history.push(!1),this.history._resetCachingButton())):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable.isFullScreen?e.element.code.style.height="100%":"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),this.isReadOnly&&r.setDisabledButtons(!0,this.resizingDisabledButtons),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"<"+l.defaultTag+">
    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg,!1);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,s=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff();const m="none"===i.style.display||this._isInline&&!this._inlineToolbarAttr.isShow;p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",s.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,o.body.style.overflow=p._bodyOverflow,"auto"!==l.height||l.codeMirrorEditor||u._codeViewAutoHeight(),l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),t&&r.changeElement(t.firstElementChild,c.expansion),e.element.topArea.style.marginTop="",r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,s),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=o.body.style.overflow,o.body.style.overflow="hidden",p._editorAreaOriginCssText=s.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,s.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+l._editorStyles.editor,g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,s.style.height=p.innerHeight_fullScreen-l.fullScreenOffset+"px",t&&r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(s.style.overflow="auto",this._iframeAutoHeight()),e.element.topArea.style.marginTop=l.fullScreenOffset+"px",r.addClass(this._styleCommandMap.fullScreen,"active")),m&&h.toolbar.hide(),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",o.body.appendChild(e);const t=l.printTemplate?l.printTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),n=r.getIframeDocument(e),i=this._wd;if(l.iframe){const e=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="'+l._editableClass+'"';n.write(""+i.head.innerHTML+""+t+"")}else{const e=o.head.getElementsByTagName("link"),i=o.head.getElementsByTagName("style");let s="";for(let t=0,n=e.length;t"+s+''+t+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||r.isChromium||o.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const e=l.previewTemplate?l.previewTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),t=a.open("","_blank");t.mimeType="text/html";const n=this._wd;if(l.iframe){const i=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(n.body,["contenteditable"]):'class="'+l._editableClass+'"';t.document.write(""+n.head.innerHTML+""+e+"")}else{const n=o.head.getElementsByTagName("link"),s=o.head.getElementsByTagName("style");let a="";for(let e=0,t=n.length;e'+i.toolbar.preview+""+a+''+e+"")}},setDir:function(t){const n="rtl"===t,s=this._prevRtl!==n;this._prevRtl=l.rtl=n,s&&(this.plugins.align&&this.plugins.align.exchangeDir.call(this),e.tool.indent&&r.changeElement(e.tool.indent.firstElementChild,c.indent),e.tool.outdent&&r.changeElement(e.tool.outdent.firstElementChild,c.outdent));const o=e.element;n?(r.addClass(o.topArea,"se-rtl"),r.addClass(o.wysiwygFrame,"se-rtl")):(r.removeClass(o.topArea,"se-rtl"),r.removeClass(o.wysiwygFrame,"se-rtl"));const a=r.getListChildren(o.wysiwyg,(function(e){return r.isFormatElement(e)&&(e.style.marginRight||e.style.marginLeft||e.style.textAlign)}));for(let e,t,n,i=0,l=a.length;i[\s\S]*<\/script>/gi,"")),e.body&&(this._wd.body.innerHTML=this.convertContentsForEditor(e.body)),this._resetComponents()},getContents:function(t){const n=this.cleanHTML(e.element.wysiwyg.innerHTML,null,null),i=r.createElement("DIV");i.innerHTML=n;const s=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=s.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},getFullContents:function(e){return'
    '+this.getContents(e)+"
    "},_makeLine:function(e,t){const n=l.defaultTag;if(1===e.nodeType){if(r._disallowedTags(e))return"";if(/__se__tag/.test(e.className))return e.outerHTML;const i=r.getListChildNodes(e,(function(e){return r.isSpanWithoutAttr(e)&&!r.getParentElement(e,r.isNotCheckingNode)}))||[];for(let e=i.length-1;e>=0;e--)i[e].outerHTML=i[e].innerHTML;return!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isMedia(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML:"<"+n+">"+(r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML)+""}if(3===e.nodeType){if(!t)return r._HTMLConvertor(e.textContent);const i=e.textContent.split(/\n/g);let l="";for(let e,t=0,s=i.length;t0&&(l+="<"+n+">"+r._HTMLConvertor(e)+"");return l}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t=l._textTagsMap;return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i,l){return n+("string"==typeof t[i]?t[i]:i)+(l?" "+l:"")}))},_deleteDisallowedTags:function(e){return e=e.replace(/<(script|style)[\s\S]*>[\s\S]*<\/(script|style)>/gi,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,""),/\bfont\b/i.test(this.options._editorTagsWhitelist)||(e=e.replace(/(<\/?)font(\s?)/gi,"$1span$2")),e.replace(this.editorTagsWhitelistRegExp,"").replace(this.editorTagsBlacklistRegExp,"")},_convertFontSize:function(e,t){const n=this._w.Math,i=t.match(/(\d+(?:\.\d+)?)(.+)/),l=i?1*i[1]:r.fontValueMap[t],s=i?i[2]:"rem";let o=l;switch(/em/.test(s)?o=n.round(l/.0625):"pt"===s?o=n.round(1.333*l):"%"===s&&(o=l/100),e){case"em":case"rem":case"%":return(.0625*o).toFixed(2)+e;case"pt":return n.floor(o/1.333)+e;default:return o+e}},_cleanStyle:function(e,t,n){let i=(e.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(/span/i.test(n)&&!i&&(e.match(/0&&t.push('style="'+n.join(";")+'"')}}return t},_cleanTags:function(e,t,n){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(t))return t;let i=null;const l=n.match(/(?!<)[a-zA-Z0-9\-]+/)[0].toLowerCase(),s=this._attributesTagsBlacklist[l];t=t.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),t=s?t.replace(s,""):t.replace(this._attributesBlacklistRegExp,"");const o=this._attributesTagsWhitelist[l];if(i=o?t.match(o):t.match(e?this._attributesWhitelistRegExp:this._attributesWhitelistRegExp_all_data),e||"span"===l)if("a"===l){const e=t.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);e&&(i||(i=[]),i.push(e[0]))}else i&&/style=/i.test(i.toString())||("span"===l?i=this._cleanStyle(t,i,"span"):/^(P|DIV|H[1-6]|PRE)$/i.test(l)&&(i=this._cleanStyle(t,i,"format")));else{const e=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);e&&!i?i=[e[0]]:e&&!i.some((function(e){return/^style/.test(e.trim())}))&&i.push(e[0])}if(r.isFigures(l)){const e=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);if(i||(i=[]),e){const t=e[0].match(/width\s?:\s?(\d+)(px|%)/),n=e[0].match(/height\s?:\s?(\d+)(px|%)/),l=t&&t[1]&&t[2]?t[1]+t[2]:"auto",s=n&&n[1]&&n[2]?n[1]+n[2]:"auto";i.push('style="width:'+l+"; height:"+s+';"')}}if(i)for(let e=0,t=i.length;e"+(n.innerHTML.trim()||"
    ")+"":r.isRangeFormatElement(n)&&!r.isTable(n)?t+=this._convertListCell(n):t+="
  • "+n.outerHTML+"
  • ":t+="
  • "+(n.textContent||"
    ")+"
  • ";return t},_isFormatData:function(e){let t=!1;for(let n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!0));const i=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(i,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!0)}catch(e){console.warn("[SUNEDITOR.cleanHTML.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=i.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!1));const t=o.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(t,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,!1)}catch(e){console.warn("[SUNEDITOR.convertContentsForEditor.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=t.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i
    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e,t){let n="";const i=a.RegExp,l=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),s="string"==typeof e?o.createRange().createContextualFragment(e):e,c=function(e){return this.isFormatElement(e)||this.isComponent(e)}.bind(r),d=t?"":"\n";let u=t?0:1*this._variable.codeIndent;return u=u>0?new a.Array(u+1).join(" "):"",function e(t,s){const o=t.childNodes,h=l.test(t.nodeName),g=h?s:"";for(let p,m,f,_,b,v,y=0,C=o.length;y]*>","i"))[0]+m,e(p,s+u),n+=(/\n$/.test(n)?v:"")+""+(f||m||h||/^(TH|TD)$/i.test(p.nodeName)?d:"")):n+=(new a.XMLSerializer).serializeToString(p):n+=(/^HR$/i.test(p.nodeName)?d:"")+(/^PRE$/i.test(p.parentElement.nodeName)&&/^BR$/i.test(p.nodeName)?"":g)+p.outerHTML+m:r.isList(p.parentElement)||(n+=r._HTMLConvertor(/^\n+$/.test(p.data)?"":p.data)):n+="\n\x3c!-- "+p.textContent.trim()+" --\x3e"+m}(s,""),n.trim()+d},addDocEvent:function(e,t,n){o.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){o.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,s=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,s<0?0:s)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML&&1===e.nodeType?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},resetResponsiveToolbar:function(){d.controllersOff();const t=u._responsiveButtonSize;if(t){let n=0;n=(d._isBalloon||d._isInline)&&"auto"===l.toolbarWidth?e.element.topArea.offsetWidth:e.element.toolbar.offsetWidth;let i="default";for(let e=1,l=t.length;e-1||!r.hasOwn(t,l)||(i.indexOf(l)>-1?n[l].active.call(this,null):t.OUTDENT&&/^OUTDENT$/i.test(l)?r.isImportantDisabled(t.OUTDENT)||t.OUTDENT.setAttribute("disabled",!0):t.INDENT&&/^INDENT$/i.test(l)?r.isImportantDisabled(t.INDENT)||t.INDENT.removeAttribute("disabled"):r.removeClass(t[l],"active"))},_init:function(i,s){const c=a.RegExp;if(this._ww=l.iframe?e.element.wysiwygFrame.contentWindow:a,this._wd=o,this._charTypeHTML="byte-html"===l.charCounterType,this.wwComputedStyle=a.getComputedStyle(e.element.wysiwyg),this._editorHeight=e.element.wysiwygFrame.offsetHeight,this._editorHeightPadding=r.getNumber(this.wwComputedStyle.getPropertyValue("padding-top"))+r.getNumber(this.wwComputedStyle.getPropertyValue("padding-bottom")),!l.iframe&&"function"==typeof a.ShadowRoot){let t=e.element.wysiwygFrame;for(;t;){if(t.shadowRoot){this._shadowRoot=t.shadowRoot;break}if(t instanceof a.ShadowRoot){this._shadowRoot=t;break}t=t.parentNode}this._shadowRoot&&(this._shadowRootControllerEventTarget=[])}const d=a.Object.keys(l._textTagsMap),u=l.addTagsWhitelist?l.addTagsWhitelist.split("|").filter((function(e){return/b|i|ins|s|strike/i.test(e)})):[];for(let e=0;e^<]+)?\\s*(?=>)","gi");const h=function(e,t){return e?"*"===e?"[a-z-]+":t?e+"|"+t:e:"^"},g="contenteditable|colspan|rowspan|target|href|download|rel|src|alt|class|type|controls|origin-size";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1||"*"===l._editorTagsWhitelist,this._htmlCheckWhitelistRegExp=new c("^("+h(l._editorTagsWhitelist.replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new c("^("+(l.tagsBlacklist||"^")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(h(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e"),"")),this.editorTagsBlacklistRegExp=r.createTagsBlacklist(l.tagsBlacklist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(h(l.pasteTagsWhitelist,"")),this.pasteTagsBlacklistRegExp=r.createTagsBlacklist(l.pasteTagsBlacklist);const p='\\s*=\\s*(")[^"]*\\1',m=l.attributesWhitelist;let f={},_="";if(m)for(let e in m)r.hasOwn(m,e)&&!/^on[a-z]+$/i.test(m[e])&&("all"===e?_=h(m[e],g):f[e]=new c("\\s(?:"+h(m[e],"")+")"+p,"ig"));this._attributesWhitelistRegExp=new c("\\s(?:"+(_||g+"|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|data-exp|data-font-size")+")"+p,"ig"),this._attributesWhitelistRegExp_all_data=new c("\\s(?:"+(_||g)+"|data-[a-z0-9\\-]+)"+p,"ig"),this._attributesTagsWhitelist=f;const b=l.attributesBlacklist;if(f={},_="",b)for(let e in b)r.hasOwn(b,e)&&("all"===e?_=h(b[e],""):f[e]=new c("\\s(?:"+h(b[e],"")+")"+p,"ig"));this._attributesBlacklistRegExp=new c("\\s(?:"+(_||"^")+")"+p,"ig"),this._attributesTagsBlacklist=f,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const v=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let y,C,w=[];for(let e in n)if(r.hasOwn(n,e)){if(y=n[e],C=t[e],(y.active||y.action)&&C&&this.callPlugin(e,null,C),"function"==typeof y.checkFileInfo&&"function"==typeof y.resetFileInfo&&(this.callPlugin(e,null,C),this._fileInfoPluginsCheck.push(y.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(y.resetFileInfo.bind(this))),a.Array.isArray(y.fileTags)){const t=y.fileTags;this.callPlugin(e,null,C),this._fileManager.tags=this._fileManager.tags.concat(t),w.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&o&&o.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},getCurrentIndex:function(){return c},reset:function(n){o&&o.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){s=e.context.element,o=e.context.tool.undo,a=e.context.tool.redo,0===c?(o&&o.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([z]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,s)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-code-view-enabled"]):not([data-display="MORE"])'),this.resizingDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-resizing-enabled"]):not([data-display="MORE"])');const t=e.tool,n=this.commandMap;n.INDENT=t.indent,n.OUTDENT=t.outdent,n[l.textTags.bold.toUpperCase()]=t.bold,n[l.textTags.underline.toUpperCase()]=t.underline,n[l.textTags.italic.toUpperCase()]=t.italic,n[l.textTags.strike.toUpperCase()]=t.strike,n[l.textTags.sub.toUpperCase()]=t.subscript,n[l.textTags.sup.toUpperCase()]=t.superscript,this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView},this._saveButtonStates()},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor("string"==typeof n?n:e.element.originElement.value)},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){this.hasFocus&&u._applyTagEffects(),this._variable.isChanged=!0,e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this),"block"===e.element.toolbar.style.display&&u._showToolbarBalloon()},_iframeAutoHeight:function(){this._iframeAuto?a.setTimeout((function(){const t=d._iframeAuto.offsetHeight;e.element.wysiwygFrame.style.height=t+"px",r.isResizeObserverSupported||d.__callResizeFunction(t,null)})):r.isResizeObserverSupported||d.__callResizeFunction(e.element.wysiwygFrame.offsetHeight,null)},__callResizeFunction:function(e,t){e=-1===e?t.borderBoxSize&&t.borderBoxSize[0]?t.borderBoxSize[0].blockSize:t.contentRect.height+this._editorHeightPadding:e,this._editorHeight!==e&&("function"==typeof h.onResizeEditor&&h.onResizeEditor(e,this._editorHeight,d,t),this._editorHeight=e)},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(r._allowedEmptyNodeList)||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,s=r.getRangeFormatElement(n,null);let o,a,c;const d=r.getParentElement(n,r.isComponent);if(!d||r.isTable(d)){if(1===n.nodeType&&"true"===n.getAttribute("data-se-embed")){let e=n.nextElementSibling;return r.isFormatElement(e)||(e=this.appendFormatTag(n,l.defaultTag)),void this.setRange(e.firstChild,0,e.firstChild,0)}if(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.children[t.startOffset])&&!r.isComponent(i.children[t.startOffset-1])){if(r.getParentElement(n,r.isNotCheckingNode))return null;if(s)return c=r.createElement(e||l.defaultTag),c.innerHTML=s.innerHTML,0===c.childNodes.length&&(c.innerHTML=r.zeroWidthSpace),s.innerHTML=c.outerHTML,c=s.firstChild,o=r.getEdgeChildNodes(c,null).sc,o||(o=r.createTextNode(r.zeroWidthSpace),c.insertBefore(o,c.firstChild)),a=o.textContent.length,void this.setRange(o,a,o,a);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}if(this.execCommand("formatBlock",!1,e||l.defaultTag),o=r.getEdgeChildNodes(n,n),o=o?o.ec:n,c=r.getFormatElement(o,null),!c)return this.removeRange(),void this._editorRange();if(r.isBreak(c.nextSibling)&&r.removeItem(c.nextSibling),r.isBreak(c.previousSibling)&&r.removeItem(c.previousSibling),r.isBreak(o)){const e=r.createTextNode(r.zeroWidthSpace);o.parentNode.insertBefore(e,o),o=e}this.effectNode=null,this.nativeFocus()}}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="";const i=l.frameAttrbutes;for(let t in i)e.element.wysiwyg.setAttribute(t,i[t]);this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),a.setTimeout(function(){u._resizeObserver&&u._resizeObserver.observe(e.element.wysiwygFrame),u._toolbarObserver&&u._toolbarObserver.observe(e.element._toolbarShadow),this._resourcesStateChange(),"function"==typeof h.onload&&h.onload(d,t)}.bind(this))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_toolbarShadow:e._toolbarShadow,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^("+a.Object.keys(l._textTagsMap).join("|")+")$","i"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;const i=u._keyCodeShortcut[e];switch(i){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="bold");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")?n="strike":t||-1!==l.shortcutsDisable.indexOf("save")||(n="save");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="underline");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="italic");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"indent":"outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"outdent":"indent")}return n?(d.commandHandler(d.commandMap[n],n),!0):!!i},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=l.rtl?"marginRight":"marginLeft",s=d.commandMap,o=u._onButtonsCheck,a=[],c=[],h=d.activePlugins,g=h.length;let p="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){if(p=e.nodeName.toUpperCase(),c.push(p),!d.isReadOnly)for(let t,i=0;i0)&&(a.push("OUTDENT"),s.OUTDENT.removeAttribute("disabled")),-1===a.indexOf("INDENT")&&s.INDENT&&!r.isImportantDisabled(s.INDENT)&&(a.push("INDENT"),r.isListCell(e)&&!e.previousElementSibling?s.INDENT.setAttribute("disabled",!0):s.INDENT.removeAttribute("disabled"))):o&&o.test(p)&&(a.push(p),r.addClass(s[p],"active"))}d._setKeyEffect(a),d._variable.currentNodes=c.reverse(),d._variable.currentNodesMap=a,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(d.controllersOff();t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||d.actionCall(i,n,t))},onMouseDown_wysiwyg:function(t){if(d.isReadOnly||r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onMouseDown&&!1===h.onMouseDown(t,d))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar(),/FIGURE/i.test(t.target.nodeName)&&t.preventDefault()},onClick_wysiwyg:function(t){const n=t.target;if(d.isReadOnly)return t.preventDefault(),r.isAnchor(n)&&a.open(n.href,n.target),!1;if(r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onClick&&!1===h.onClick(t,d))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const s=r.getParentElement(n,"FIGCAPTION");if(s&&(r.isNonEditable(s)||!s.getAttribute("contenteditable"))&&(t.preventDefault(),s.setAttribute("contenteditable",!0),s.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),s.removeEventListener("blur",e)};s.addEventListener("blur",e)}a.setTimeout(d._editorRange.bind(d)),d._editorRange();const o=d.getSelectionNode(),c=r.getFormatElement(o,null),g=r.getRangeFormatElement(o,null);if(c||r.isNonEditable(n)||r.isList(g))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer))if(r.isList(g)){t.preventDefault();const e=r.createElement("LI"),n=o.nextElementSibling;e.appendChild(o),g.insertBefore(e,n),d.focus()}else r.isWysiwygDiv(o)||r.isComponent(o)||r.isTable(o)&&!r.isCell(o)||null===d._setDefaultFormat(r.isRangeFormatElement(g)?"DIV":l.defaultTag)?u._applyTagEffects():(t.preventDefault(),d.focus())}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,s=e.element.topArea,o=d.getSelection();let c;if(d._isBalloonAlways&&n.collapsed)c=!0;else if(o.focusNode===o.anchorNode)c=o.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name)}else{const e=r.createElement(l.defaultTag);e.innerHTML="
    ",f.parentElement.replaceChild(e,f)}return d.nativeFocus(),!1}}if(f&&g.startContainer===g.endContainer&&3===c.nodeType&&!r.isFormatElement(c.parentNode)&&(g.collapsed?1===c.textContent.length:g.endOffset-g.startOffset===c.textContent.length)){t.preventDefault();let e=null,n=c.parentNode.previousSibling;const i=c.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),f.appendChild(n))),c.textContent="",r.removeItemAllParents(c,null,f),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}if(u._isUneditableNode(g,!0)){t.preventDefault(),t.stopPropagation();break}!p&&d._isEdgeFormat(g.startContainer,g.startOffset,"start")&&r.isFormatElement(f.previousElementSibling)&&(d._formatAttrsTemp=f.previousElementSibling.attributes);const n=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(c===f||3===c.nodeType&&(!c.previousSibling||r.isList(c.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,s=f.childNodes;let o=i,a=s[0];for(;a=s[0];)e.insertBefore(a,o.nextSibling),o=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,i=n;for(;i&&i!==_&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&f&&(0===g.startOffset||c===f&&f.childNodes[g.startOffset])){const e=c===f?f.childNodes[g.startOffset]:c,i=f.previousSibling,l=(3===n.nodeType||r.isBreak(n))&&!n.previousSibling&&0===g.startOffset;if(e&&!e.previousSibling&&(n&&r.isComponent(n.previousSibling)||l&&r.isComponent(i))){const e=d.getFileComponent(i);e?(t.preventDefault(),t.stopPropagation(),0===f.textContent.length&&r.removeItem(f),!1===d.selectComponent(e.target,e.pluginName)&&d.blur()):r.isComponent(i)&&(t.preventDefault(),t.stopPropagation(),r.removeItem(i));break}if(e&&r.isNonEditable(e.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if(u._isUneditableNode(g,!1)){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(c)||null===c.nextSibling||r.onlyZeroWidthSpace(c.nextSibling)&&null===c.nextSibling.nextSibling)&&g.startOffset===c.textContent.length){const e=f.nextElementSibling;if(!e)break;if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n?(t.stopPropagation(),!1===d.selectComponent(n.target,n.pluginName)&&d.blur()):r.isComponent(e)&&(t.stopPropagation(),r.removeItem(e));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||c===f&&f.childNodes[g.startOffset])){const e=c===f&&f.childNodes[g.startOffset]||c;if(e&&r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}if(r.isComponent(e)){t.preventDefault(),t.stopPropagation(),r.removeItem(e);break}}if(!p&&d._isEdgeFormat(g.endContainer,g.endOffset,"end")&&r.isFormatElement(f.nextElementSibling)&&(d._formatAttrsTemp=f.attributes),f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(c===f||3===c.nodeType&&(!c.nextSibling||r.isList(c.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===c.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||_.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),s||o||r.isWysiwygDiv(c))break;const b=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),v=d.getSelectedElements(null);c=d.getSelectionNode();const y=[];let C=[],w=r.isListCell(v[0]),x=r.isListCell(v[v.length-1]),E={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=v.length;t0&&b&&d.plugins.list)E=d.plugins.list.editInsideList.call(d,i,y);else{const e=r.getParentElement(c,r.isCell);if(e&&b){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let s=n[l];if(!s)break;s=s.firstElementChild||s,d.setRange(s,0,s,0);break}C=C.concat(y),w=x=null}if(C.length>0)if(i){const e=C.length-1;for(let t,n=0;n<=e;n++){t=C[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!i){const e=d._isEdgeFormat(g.endContainer,g.endOffset,"end"),n=d._isEdgeFormat(g.startContainer,g.startOffset,"start");if(e&&(/^H[1-6]$/i.test(f.nodeName)||/^HR$/i.test(f.nodeName))){t.preventDefault();let n=null;const i=d.appendFormatTag(f,l.defaultTag);if(e&&e.length>0){n=e.pop();const t=n;for(;e.length>0;)n=n.appendChild(e.pop());i.appendChild(t)}n=n?n.appendChild(i.firstChild):i.firstChild,d.setRange(n,0,n,0);break}if(n||e){t.preventDefault();const i=r.createElement("BR"),s=r.createElement(f.nodeName);s.appendChild(i),r.copyTagAttributes(s,f,["id"].concat(l.lineAttrReset)),f.parentNode.insertBefore(s,n?f:f.nextElementSibling),e&&d.setRange(i,1,i,1);break}if(d._formatAttrsTemp=f.attributes,l.lineAttrReset&&f&&!r.isListCell(f)){let e;if(t.preventDefault(),t.stopPropagation(),g.collapsed)e=r.onlyZeroWidthSpace(f)?d.appendFormatTag(f,f.cloneNode(!1)):r.splitElement(g.endContainer,g.endOffset,0);else{const t=r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null),n=d.removeNode();if(t)if(e=r.getFormatElement(n.container,null),n.prevContainer)e!==f&&e.nextElementSibling===f&&(e=f);else{const t=f.cloneNode(!1);t.innerHTML="
    ",e.parentNode.insertBefore(t,e)}else e=r.splitElement(n.container,n.offset,0)}const n=l.lineAttrReset,i=e.attributes;let s=0;for(;i[s];)n&&n.indexOf(i[s].name.toLowerCase())>-1?s++:e.removeAttribute(i[s].name);d.setRange(e.firstChild,0,e.firstChild,0);break}if(S){t.preventDefault();const e=c===S,n=d.getSelection(),i=c.childNodes,l=n.focusOffset,s=c.previousElementSibling,o=c.nextSibling;if(!r.isClosureFreeFormatElement(S)&&i&&(e&&g.collapsed&&i.length-1<=l+1&&r.isBreak(i[l])&&(!i[l+1]||(!i[l+2]||r.onlyZeroWidthSpace(i[l+2].textContent))&&3===i[l+1].nodeType&&r.onlyZeroWidthSpace(i[l+1].textContent))&&l>0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(c.textContent)&&r.isBreak(s)&&(r.isBreak(s.previousSibling)||!r.onlyZeroWidthSpace(s.previousSibling.textContent))&&(!o||!r.isBreak(o)&&r.onlyZeroWidthSpace(o.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(c);const t=d.appendFormatTag(S,r.isFormatElement(S.nextElementSibling)&&!r.isRangeFormatElement(S.nextElementSibling)?S.nextElementSibling:null);r.copyFormatAttributes(t,S),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

    ",!0,!1);let e=n.focusNode;const t=n.focusOffset;S===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null,!1);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}}if(p)break;if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(c.nextSibling)){t.preventDefault();const e=r.createElement("LI"),n=r.createElement("BR");e.appendChild(n),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(c.nextSibling),d.setRange(n,1,n,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(_.parentNode)){if(_=f.parentNode.parentNode.parentNode,e=r.splitElement(f,null,r.getElementDepth(f)-2),!e){const t=r.createElement("LI");t.innerHTML="
    ",_.insertBefore(t,e),e=t}}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)&&!r.isRangeFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)&&!r.isRangeFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:l.defaultTag;e=r.createElement(t);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(_&&r.getParentElement(_,"FIGCAPTION")&&r.getParentElement(_,r.isList)&&(t.preventDefault(),f=d.appendFormatTag(f,null),d.setRange(f,0,f,0)),m){t.preventDefault(),t.stopPropagation();const n=e[m],i=n._container,s=i.previousElementSibling||i.nextElementSibling;let o=null;r.isListCell(i.parentNode)?o=r.createElement("BR"):(o=r.createElement(r.isFormatElement(s)&&!r.isRangeFormatElement(s)?s.nodeName:l.defaultTag),o.innerHTML="
    "),i.parentNode.insertBefore(o,i),d.callPlugin(m,(function(){!1===d.selectComponent(n._element,m)&&d.blur()}),null)}break;case 27:if(m)return t.preventDefault(),t.stopPropagation(),d.controllersOff(),!1}if(i&&16===n){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(f,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}else if(i&&(r.isOSX_IOS?o:s)&&32===n){t.preventDefault(),t.stopPropagation();const e=d.insertNode(r.createTextNode(" "));if(e&&e.container)return void d.setRange(e.container,e.endOffset,e.container,e.endOffset)}if(r.isIE&&!s&&!o&&!p&&!u._nonTextKeyCode.test(n)&&r.isBreak(g.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null,!1),d.setRange(e,1,e,1)}},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=e.keyCode,n=e.ctrlKey||e.metaKey||91===t||92===t||224===t,i=e.altKey;if(d.isReadOnly)return void(!n&&u._directionKeyCode.test(t)&&u._applyTagEffects());const s=d.getRange();let o=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==t||!s.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();27!==t&&u._showToolbarBalloonDelay()}if(8===t&&r.isWysiwygDiv(o)&&""===o.textContent&&0===o.children.length){e.preventDefault(),e.stopPropagation(),o.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:l.defaultTag);return t.innerHTML="
    ",o.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),void d.history.push(!1)}const a=r.getFormatElement(o,null),c=r.getRangeFormatElement(o,null),g=d._formatAttrsTemp;if(g){for(let e=0,n=g.length;e0?i-s-e.element.toolbar.offsetHeight:0;i=n+s?(d._sticky||u._onStickyToolbar(a),t.toolbar.style.top=a+n+s+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=s&&u._onStickyToolbar(a)},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,s=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,s+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:s}},_getPageBottomSpace:function(){return o.documentElement.scrollHeight-(u._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(t){const n=e.element;d._isInline||l.toolbarContainer||(n._stickyDummy.style.height=n.toolbar.offsetHeight+"px",n._stickyDummy.style.display="block"),n.toolbar.style.top=l.stickyToolbar+t+"px",n.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:n.toolbar.offsetWidth+"px",r.addClass(n.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){d._variable.isFullScreen||(e.element.code.style.height=e.element.code.scrollHeight+"px")},_hardDelete:function(){const e=d.getRange(),t=e.startContainer,n=e.endContainer,i=r.getRangeFormatElement(t),l=r.getRangeFormatElement(n),s=r.isCell(i),o=r.isCell(l),a=e.commonAncestorContainer;if((s&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||o&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(s){if(o)return r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode}))),d.nativeFocus(),!0;r.removeItem(r.getParentElement(i,(function(e){return a===e.parentNode})))}else r.removeItem(r.getParentElement(l,(function(e){return a===e.parentNode})));const c=1===t.nodeType?r.getParentElement(t,".se-component"):null,u=1===n.nodeType?r.getParentElement(n,".se-component"):null;return c&&r.removeItem(c),u&&r.removeItem(u),!1},onPaste_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;return!t||u._dataTransferAction("paste",e,t)},_setClipboardComponent:function(e,t,n){e.preventDefault(),e.stopPropagation(),n.setData("text/html",t.component.outerHTML)},onCopy_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCopy&&!1===h.onCopy(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.addClass(n.component,"se-component-copy"),a.setTimeout((function(){r.removeClass(n.component,"se-component-copy")}),150))},onSave_wysiwyg:function(e){"function"!=typeof h.onSave||h.onSave(e,d)},onCut_wysiwyg:function(e){const t=r.isIE?a.clipboardData:e.clipboardData;if("function"==typeof h.onCut&&!1===h.onCut(e,t,d))return e.preventDefault(),e.stopPropagation(),!1;const n=d.currentFileComponentInfo;n&&!r.isIE&&(u._setClipboardComponent(e,n,t),r.removeItem(n.component),d.controllersOff()),a.setTimeout((function(){d.history.push(!1)}))},onDrop_wysiwyg:function(e){if(d.isReadOnly||r.isIE)return e.preventDefault(),e.stopPropagation(),!1;const t=e.dataTransfer;return!t||(d.removeNode(),u._setDropLocationSelection(e),u._dataTransferAction("drop",e,t))},_setDropLocationSelection:function(e){if(e.rangeParent)d.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(d._wd.caretRangeFromPoint){const t=d._wd.caretRangeFromPoint(e.clientX,e.clientY);d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=d.getRange();d.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,s;if(r.isIE){l=i.getData("Text");const o=d.getRange(),c=r.createElement("DIV"),h={sc:o.startContainer,so:o.startOffset,ec:o.endContainer,eo:o.endOffset};return c.setAttribute("contenteditable",!0),c.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(c),c.focus(),a.setTimeout((function(){s=c.innerHTML,r.removeItem(c),d.setRange(h.sc,h.so,h.ec,h.eo),u._setClipboardData(t,n,l,s,i)})),!0}if(l=i.getData("text/plain"),s=i.getData("text/html"),!1===u._setClipboardData(t,n,l,s,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){const s=/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)||/content=["']*Excel.Sheet/i.test(i);!i?i=r._HTMLConvertor(n).replace(/\n/g,"
    "):(i=i.replace(/^\r?\n?\r?\n?\x3C!--StartFragment--\>|\x3C!--EndFragment-->\r?\n?<\/body\>\r?\n?<\/html>$/g,""),s&&(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")),i=d.cleanHTML(i,d.pasteTagsWhitelistRegExp,d.pasteTagsBlacklistRegExp));const o=d._charCount(d._charTypeHTML?i:n);if("paste"===e&&"function"==typeof h.onPaste){const e=h.onPaste(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}if("drop"===e&&"function"==typeof h.onDrop){const e=h.onDrop(t,i,o,d);if(!1===e)return!1;if("string"==typeof e){if(!e)return!1;i=e}}const a=l.files;return a.length>0&&!s?(/^image/.test(a[0].type)&&d.plugins.image&&h.insertImage(a),!1):!!o&&(i?(h.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(d.isDisabled||d.isReadOnly)return!1;const n=r.getParentElement(t.target,r.isComponent),i=d._lineBreaker.style;if(n&&!d.currentControllerName){const s=e.element;let o=0,a=s.wysiwyg;do{o+=a.scrollTop,a=a.parentElement}while(a&&!/^(BODY|HTML)$/i.test(a.nodeName));const c=s.wysiwyg.scrollTop,h=u._getEditorOffsets(null),g=r.getOffset(n,s.wysiwygFrame).top+c,p=t.pageY+o+(l.iframe&&!l.toolbarContainer?s.toolbar.offsetHeight:0),m=g+(l.iframe?o:h.top),f=r.isListCell(n.parentNode);let _="",b="";if((f?!n.previousSibling:!r.isFormatElement(n.previousElementSibling))&&pm+n.offsetHeight-20))return void(i.display="none");b=g+n.offsetHeight,_="b"}d._variable._lineBreakComp=n,d._variable._lineBreakDir=_,i.top=b-c+"px",d._lineBreakerButton.style.left=r.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=d._variable._lineBreakComp,n=this?this:d._variable._lineBreakDir,i=r.isListCell(t.parentNode),s=r.createElement(i?"BR":r.isCell(t.parentNode)?"DIV":l.defaultTag);if(i||(s.innerHTML="
    "),d._charTypeHTML&&!d.checkCharCount(s.outerHTML,"byte-html"))return;t.parentNode.insertBefore(s,"t"===n?t:t.nextSibling),d._lineBreaker.style.display="none",d._variable._lineBreakComp=null;const o=i?s:s.firstChild;d.setRange(o,1,o,1),d.history.push(!1)},_resizeObserver:null,_toolbarObserver:null,_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;r.isResizeObserverSupported&&(this._resizeObserver=new a.ResizeObserver((function(e){d.__callResizeFunction(-1,e[0])}))),e.element.toolbar.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",u._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("copy",u.onCopy_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),u._lineBreakerBind={a:u._onLineBreak.bind(""),t:u._onLineBreak.bind("t"),b:u._onLineBreak.bind("b")},t.addEventListener("mousemove",u.onMouseMove_wysiwyg,!1),d._lineBreakerButton.addEventListener("mousedown",u._onMouseDown_lineBreak,!1),d._lineBreakerButton.addEventListener("click",u._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",u._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",u._lineBreakerBind.b,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)&&l.resizeEnable?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),u._setResponsiveToolbar(),r.isResizeObserverSupported&&(this._toolbarObserver=new a.ResizeObserver(d.resetResponsiveToolbar)),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",u._buttonsEventHandler),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("copy",u.onCopy_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousemove",u.onMouseMove_wysiwyg),d._lineBreakerButton.removeEventListener("mousedown",u._onMouseDown_lineBreak),d._lineBreakerButton.removeEventListener("click",u._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",u._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",u._lineBreakerBind.b),u._lineBreakerBind=null,t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),u._resizeObserver&&(u._resizeObserver.unobserve(e.element.wysiwygFrame),u._resizeObserver=null),u._toolbarObserver&&(u._toolbarObserver.unobserve(e.element._toolbarShadow),u._toolbarObserver=null),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)},_setResponsiveToolbar:function(){if(0===s.length)return void(s=null);u._responsiveCurrentSize="default";const e=u._responsiveButtonSize=[],t=u._responsiveButtons={default:s[0]};for(let n,i,l=1,o=s.length;l",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button(e);n.resizing.resizeButton=l;let s=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),s[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),s[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,s=null},setController_resize:function(e){const t=e.util.createElement("DIV");return t.className="se-controller se-resizing-container",t.style.display="none",t.innerHTML='
    ',t},setController_button:function(e){const t=e.lang,n=e.icons,i=e.util.createElement("DIV");return i.className="se-controller se-controller-resizing",i.innerHTML='
    ",i},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,s=n.resizeDiv,o=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=o.top,u=o.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",s.style.top="0px",s.style.left="0px",s.style.width=r+"px",s.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;o.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,o,null,null),this.selectComponent(o,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(o,l);break;case"caption":const g=!s._captionChecked;if(a.openModify.call(this,!0),s._captionChecked=s.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(s._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):s._caption.focus(),this.controllersOff()}else this.selectComponent(o,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(o,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,s=1*e.getAttribute("data-rotate");let o="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";o=90===s||-270===s?t:e}}e.style.transformOrigin=o,this.plugins.resizing._setTransForm(e,s.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),s="";if(/[1-9]/.test(t)&&(n||i))switch(s=n?"Y":"X",t){case"90":s=n&&i?"X":i?s:"";break;case"270":l*=-1,s=n&&i?"Y":n?s:"";break;case"-90":s=n&&i?"Y":n?s:"";break;case"-270":l*=-1,s=n&&i?"X":i?s:"";break;default:s=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(s?" translate"+s+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const s=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),s&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,s=i.clientY;let o=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?s-e._resizeClientY:e._resizeClientY-s),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=o,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(o)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),t&&this.plugins.resizing.setTransformSize.call(this,this.context[this.context.resizing._resize_plugin]._element,n,i),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,_checkMediaComponent:function(e){return!/IMG/i.test(e)||!/FIGURE/i.test(e.parentElement.nodeName)||!/FIGURE/i.test(e.parentElement.parentElement.nodeName)},upload:function(e,t,n,i,l){this.showLoading();const s=this.plugins.fileManager,o=s._xmlHttp=this.util.getXMLHttpRequest();if(o.onreadystatechange=s._callBackUpload.bind(this,o,i,l),o.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)o.setRequestHeader(e,t[e]);o.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let s=[];for(let e=0,n=t.length;e0;){const t=s.shift();this.util.getParentElement(t,this.util.isMediaComponent)&&o._checkMediaComponent(t)?!t.getAttribute("data-index")||h.indexOf(1*t.getAttribute("data-index"))<0?(u.push(a._infoIndex),t.removeAttribute("data-index"),c(e,t,n,null,l)):u.push(1*t.getAttribute("data-index")):(u.push(a._infoIndex),i(t))}for(let e,t=0;t-1||(r.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=d)},setInfo:function(e,t,n,i,l){const s=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const o=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e