import{g as Y,d as T,c as nt,r as Tt}from"./vendor-8efd6c0a.js";import{s as At}from"./suneditor-c3991ade.js";import{d as Dt}from"./@react-pdf/renderer-e56aa971.js";var j={},K={};const st={name:"blockquote",display:"command",add:function(t,e){const i=t.context;i.blockquote={targetButton:e,tag:t.util.createElement("BLOCKQUOTE")}},active:function(t){if(!t)this.util.removeClass(this.context.blockquote.targetButton,"active");else if(/blockquote/i.test(t.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0;return!1},action:function(){const t=this.util.getParentElement(this.getSelectionNode(),"blockquote");t?this.detachRangeFormatElement(t,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},ot={name:"align",display:"submenu",add:function(t,e){const i=t.icons,l=t.context;l.align={targetButton:e,_itemMenu:null,_alignList:null,currentAlign:"",defaultDir:t.options.rtl?"right":"left",icons:{justify:i.align_justify,left:i.align_left,right:i.align_right,center:i.align_center}};let n=this.setSubmenu(t),s=l.align._itemMenu=n.querySelector("ul");s.addEventListener("click",this.pickup.bind(t)),l.align._alignList=s.querySelectorAll("li button"),t.initMenuTarget(this.name,e,n),n=null,s=null},setSubmenu:function(t){const e=t.lang,i=t.icons,l=t.util.createElement("DIV"),n=t.options.alignItems;let s="";for(let o=0,a,r;o";return l.className="se-submenu se-list-layer se-list-align",l.innerHTML='
",l},active:function(t){const e=this.context.align,i=e.targetButton,l=i.firstElementChild;if(!t)this.util.changeElement(l,e.icons[e.defaultDir]),i.removeAttribute("data-focus");else if(this.util.isFormatElement(t)){const n=t.style.textAlign;if(n)return this.util.changeElement(l,e.icons[n]||e.icons[e.defaultDir]),i.setAttribute("data-focus",n),!0}return!1},on:function(){const t=this.context.align,e=t._alignList,i=t.targetButton.getAttribute("data-focus")||t.defaultDir;if(i!==t.currentAlign){for(let l=0,n=e.length;l",i.innerHTML=r,i},active:function(t){const e=this.context.font.targetText,i=this.context.font.targetTooltip;if(t){if(t.style&&t.style.fontFamily.length>0){const l=t.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(e,l),this.util.changeTxt(i,this.lang.toolbar.font+" ("+l+")"),!0}}else{const l=this.hasFocus?this.wwComputedStyle.fontFamily:this.lang.toolbar.font;this.util.changeTxt(e,l),this.util.changeTxt(i,this.hasFocus?this.lang.toolbar.font+(l?" ("+l+")":""):l)}return!1},on:function(){const t=this.context.font,e=t._fontList,i=t.targetText.textContent;if(i!==t.currentFont){for(let l=0,n=e.length;l('+i.toolbar.default+")";for(let o=0,a=e.fontSizeUnit,r=n.length,c;o";return s+="",l.innerHTML=s,l},active:function(t){if(!t)this.util.changeTxt(this.context.fontSize.targetText,this.hasFocus?this._convertFontSize.call(this,this.options.fontSizeUnit,this.wwComputedStyle.fontSize):this.lang.toolbar.fontSize);else if(t.style&&t.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,this._convertFontSize.call(this,this.options.fontSizeUnit,t.style.fontSize)),!0;return!1},on:function(){const t=this.context.fontSize,e=t._sizeList,i=t.targetText.textContent;if(i!==t.currentSize){for(let l=0,n=e.length;l';for(let a=0,r=n.length,c;a0&&(o+='
'+e(s)+"
",s=[]),typeof c=="object"&&(o+='
'+e(c)+"
")));return o+='
",o},_makeColorList:function(t){let e="";e+='
    ';for(let i=0,l=t.length,n;i');return e+="
",e},init:function(t,e){const i=this.plugins.colorPicker;let l=e||i.getColorInNode.call(this,t)||this.context.colorPicker._defaultColor;l=i.isHexColor(l)?l:i.rgb2hex(l)||l;const n=this.context.colorPicker._colorList;if(n)for(let s=0,o=n.length;s=3?"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substr(1):!1}},ut={name:"fontColor",display:"submenu",add:function(t,e){t.addModule([ct]);const i=t.context;i.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(t);i.fontColor.colorInput=l.querySelector("._se_color_picker_input"),i.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(t)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(t)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(t)),l.addEventListener("click",this.pickup.bind(t)),i.fontColor.colorList=l.querySelectorAll("li button"),t.initMenuTarget(this.name,e,l),l=null},setSubmenu:function(t){const e=t.context.colorPicker.colorListHTML,i=t.util.createElement("DIV");return i.className="se-submenu se-list-layer",i.innerHTML=e,i},on:function(){const t=this.context.colorPicker,e=this.context.fontColor;t._colorInput=e.colorInput;const i=this.wwComputedStyle.color;t._defaultColor=i?this.plugins.colorPicker.isHexColor(i)?i:this.plugins.colorPicker.rgb2hex(i):"#333333",t._styleProperty="color",t._colorList=e.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(t){this.plugins.colorPicker.setCurrentColor.call(this,t.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(t){t.preventDefault(),t.stopPropagation(),this.plugins.fontColor.applyColor.call(this,t.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(t){if(!t)return;const e=this.util.createElement("SPAN");e.style.color=t,this.nodeChange(e,["color"],null,null),this.submenuOff()}},dt={name:"hiliteColor",display:"submenu",add:function(t,e){t.addModule([ct]);const i=t.context;i.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu(t);i.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),i.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(t)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(t)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(t)),l.addEventListener("click",this.pickup.bind(t)),i.hiliteColor.colorList=l.querySelectorAll("li button"),t.initMenuTarget(this.name,e,l),l=null},setSubmenu:function(t){const e=t.context.colorPicker.colorListHTML,i=t.util.createElement("DIV");return i.className="se-submenu se-list-layer",i.innerHTML=e,i},on:function(){const t=this.context.colorPicker,e=this.context.hiliteColor;t._colorInput=e.colorInput;const i=this.wwComputedStyle.backgroundColor;t._defaultColor=i?this.plugins.colorPicker.isHexColor(i)?i:this.plugins.colorPicker.rgb2hex(i):"#ffffff",t._styleProperty="backgroundColor",t._colorList=e.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(t){this.plugins.colorPicker.setCurrentColor.call(this,t.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(t){t.preventDefault(),t.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,t.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(t){if(!t)return;const e=this.util.createElement("SPAN");e.style.backgroundColor=t,this.nodeChange(e,["background-color"],null,null),this.submenuOff()}},ht={name:"horizontalRule",display:"submenu",add:function(t,e){t.context.horizontalRule={currentHR:null};let i=this.setSubmenu(t);i.querySelector("ul").addEventListener("click",this.horizontalRulePick.bind(t)),t.initMenuTarget(this.name,e,i),i=null},setSubmenu:function(t){const e=t.lang,i=t.util.createElement("DIV"),l=t.options.hrItems||[{name:e.toolbar.hr_solid,class:"__se__solid"},{name:e.toolbar.hr_dashed,class:"__se__dashed"},{name:e.toolbar.hr_dotted,class:"__se__dotted"}];let n="";for(let s=0,o=l.length;s";return i.className="se-submenu se-list-layer se-list-line",i.innerHTML='
    '+n+"
",i},active:function(t){if(!t)this.util.hasClass(this.context.horizontalRule.currentHR,"on")&&this.controllersOff();else if(/HR/i.test(t.nodeName))return this.context.horizontalRule.currentHR=t,this.util.hasClass(t,"on")||(this.util.addClass(t,"on"),this.controllersOn("hr",this.util.removeClass.bind(this.util,t,"on"))),!0;return!1},appendHr:function(t){return this.focus(),this.insertComponent(t.cloneNode(!1),!1,!0,!1)},horizontalRulePick:function(t){t.preventDefault(),t.stopPropagation();let e=t.target,i=e.getAttribute("data-command");for(;!i&&!/UL/i.test(e.tagName);)e=e.parentNode,i=e.getAttribute("data-command");if(!i)return;const l=this.plugins.horizontalRule.appendHr.call(this,e.firstElementChild);l&&(this.setRange(l,0,l,0),this.submenuOff())}},ft={name:"list",display:"submenu",add:function(t,e){const i=t.context;i.list={targetButton:e,_list:null,currentList:"",icons:{bullets:t.icons.list_bullets,number:t.icons.list_number}};let l=this.setSubmenu(t),n=l.querySelector("ul");n.addEventListener("click",this.pickup.bind(t)),i.list._list=n.querySelectorAll("li button"),t.initMenuTarget(this.name,e,l),l=null,n=null},setSubmenu:function(t){const e=t.lang,i=t.util.createElement("DIV");return i.className="se-submenu se-list-layer",i.innerHTML='
",i},active:function(t){const e=this.context.list.targetButton,i=e.firstElementChild,l=this.util;if(l.isList(t)){const n=t.nodeName;return e.setAttribute("data-focus",n),l.addClass(e,"active"),/UL/i.test(n)?l.changeElement(i,this.context.list.icons.bullets):l.changeElement(i,this.context.list.icons.number),!0}else e.removeAttribute("data-focus"),l.changeElement(i,this.context.list.icons.number),l.removeClass(e,"active");return!1},on:function(){const t=this.context.list,e=t._list,i=t.targetButton.getAttribute("data-focus")||"";if(i!==t.currentList){for(let l=0,n=e.length;l=0;y--)if(n[y].contains(n[v])){n.splice(v,1),v--,x--;break}}const d=s.getRangeFormatElement(o),_=d&&d.tagName===t;let g,h;const b=(function(v){return!this.isComponent(v)}).bind(s);_||(h=s.createElement(t));for(let v=0,x=n.length,y,w;v"),z.innerHTML+=L.outerHTML,A&&(z.innerHTML+="
")}else{const A=L.childNodes;for(;A[0];)z.appendChild(A[0])}b.appendChild(z),(!E||k!==M||s.isRangeFormatElement(O))&&(v||(v=b),(!g||!E||k!==M)&&!(E&&s.isList(M)&&M===S)&&b.parentNode!==k&&k.insertBefore(b,O)),s.removeItem(L),g&&x===null&&(x=b.children.length-1),E&&(s.getRangeFormatElement(M,w)!==s.getRangeFormatElement(S,w)||s.isList(M)&&s.isList(S)&&s.getElementDepth(M)!==s.getElementDepth(S))&&(b=s.createElement(t)),I&&I.children.length===0&&s.removeItem(I)}x&&(v=v.children[x]),h&&(y=b.children.length-1,b.innerHTML+=c.innerHTML,b.children[y],s.removeItem(c))}return this.effectNode=null,u?p:f},_detachNested:function(t){const e=t[0],i=t[t.length-1],l=i.nextElementSibling,n=e.parentNode,s=n.parentNode.nextElementSibling,o=n.parentNode.parentNode;for(let r=0,c=t.length;r0){const r=n.cloneNode(!1),c=n.childNodes,u=this.util.getPositionIndex(l);for(;c[u];)r.appendChild(c[u]);i.appendChild(r)}n.children.length===0&&this.util.removeItem(n),this.util.mergeSameTags(o);const a=this.util.getEdgeChildNodes(e,i);return{cc:e.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(t,e){e=e||this.getSelectedElements().filter((function(o){return this.isListCell(o)}).bind(this.util));const i=e.length;if(i===0||!t&&!this.util.isListCell(e[0].previousElementSibling)&&!this.util.isListCell(e[i-1].nextElementSibling))return{sc:e[0],so:0,ec:e[i-1],eo:1};let l=e[0].parentNode,n=e[i-1],s=null;if(t){if(l!==n.parentNode&&this.util.isList(n.parentNode.parentNode)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)e.push(n),n=n.nextElementSibling;s=this.plugins.list.editList.call(this,l.nodeName.toUpperCase(),e,!0)}else{let o=this.util.createElement(l.nodeName),a=e[0].previousElementSibling,r=n.nextElementSibling;const c={s:null,e:null,sl:l,el:l};for(let p=0,m=i,d;p span > span"),l.columnFixedButton=o.querySelector("._se_table_fixed_column"),l.headerButton=o.querySelector("._se_table_header");let a=this.setController_tableEditor(t,l.cellControllerTop);l.resizeDiv=a,l.splitMenu=a.querySelector(".se-btn-group-sub"),l.mergeButton=a.querySelector("._se_table_merge_button"),l.splitButton=a.querySelector("._se_table_split_button"),l.insertRowAboveButton=a.querySelector("._se_table_insert_row_a"),l.insertRowBelowButton=a.querySelector("._se_table_insert_row_b"),s.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(t,l)),s.addEventListener("click",this.appendTable.bind(t)),a.addEventListener("click",this.onClick_tableController.bind(t)),o.addEventListener("click",this.onClick_tableController.bind(t)),t.initMenuTarget(this.name,e,n),i.element.relative.appendChild(a),i.element.relative.appendChild(o),n=null,s=null,a=null,o=null,l=null},setSubmenu:function(t){const e=t.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
1 x 1
',e},setController_table:function(t){const e=t.lang,i=t.icons,l=t.util.createElement("DIV");return l.className="se-controller se-controller-table",l.innerHTML='
",l},setController_tableEditor:function(t,e){const i=t.lang,l=t.icons,n=t.util.createElement("DIV");return n.className="se-controller se-controller-table-cell",n.innerHTML=(e?"":'
')+'
  • '+i.controller.VerticalSplit+'
  • '+i.controller.HorizontalSplit+"
",n},appendTable:function(){const t=this.util.createElement("TABLE"),e=this.plugins.table.createCells,i=this.context.table._tableXY[0];let l=this.context.table._tableXY[1],n="";for(;l>0;)n+=""+e.call(this,"td",i)+"",--l;if(n+="",t.innerHTML=n,this.insertComponent(t,!1,!0,!1)){const o=t.querySelector("td div");this.setRange(o,0,o,0),this.plugins.table.reset_table_picker.call(this)}},createCells:function(t,e,i){if(t=t.toLowerCase(),i){const l=this.util.createElement(t);return l.innerHTML="

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

",e--;return l}},onMouseMove_tablePicker:function(t,e){e.stopPropagation();let i=this._w.Math.ceil(e.offsetX/18),l=this._w.Math.ceil(e.offsetY/18);i=i<1?1:i,l=l<1?1:l,t._rtl&&(t.tableHighlight.style.left=i*18-13+"px",i=11-i),t.tableHighlight.style.width=i+"em",t.tableHighlight.style.height=l+"em",this.util.changeTxt(t.tableDisplay,i+" x "+l),t._tableXY=[i,l]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const t=this.context.table.tableHighlight.style,e=this.context.table.tableUnHighlight.style;t.width="1em",t.height="1em",e.width="10em",e.height="10em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const t=this.context.table,e=this.plugins.table;if(e._removeEvents.call(this),e._selectedTable){const i=e._selectedTable.querySelectorAll(".se-table-selected-cell");for(let l=0,n=i.length;l0)for(let v=0,x;vu)&&(b>=x.index?(p+=x.cs,b+=x.cs,x.rs-=1,x.row=u+1,x.rs<1&&(c.splice(v,1),v--)):m===d-1&&(x.rs-=1,x.row=u+1,x.rs<1&&(c.splice(v,1),v--)));if(u===a&&m===s){i._logical_cellIndex=b;break}h>0&&r.push({index:b,cs:g+1,rs:h,row:-1}),p+=g}c=c.concat(r).sort(function(m,d){return m.index-d.index}),r=[]}r=null,c=null}},editTable:function(t,e){const i=this.plugins.table,l=this.context.table,n=l._element,s=t==="row";if(s){const o=l._trElement.parentNode;if(/^THEAD$/i.test(o.nodeName)){if(e==="up")return;if(!o.nextElementSibling||!/^TBODY$/i.test(o.nextElementSibling.nodeName)){n.innerHTML+=""+i.createCells.call(this,"td",l._logical_cellCnt,!1)+"";return}}}if(i._ref){const o=l._tdElement,a=i._selectedCells;if(s)if(e)i.setCellInfo.call(this,e==="up"?a[0]:a[a.length-1],!0),i.editRow.call(this,e,o);else{let r=a[0].parentNode;const c=[a[0]];for(let u=1,f=a.length,p;uo&&o>u&&(p[m].rowSpan=_+a,c-=g)}if(l){const u=r[s+1];if(u){const f=[];let p=r[s].cells,m=0;for(let d=0,_=p.length,g,h;d<_;d++)g=p[d],h=d+m,m+=g.colSpan-1,g.rowSpan>1&&(g.rowSpan-=1,f.push({cell:g.cloneNode(!1),index:h}));if(f.length>0){let d=f.shift();p=u.cells,m=0;for(let _=0,g=p.length,h,b;_=d.index&&(_--,m--,m+=d.cell.colSpan-1,u.insertBefore(d.cell,h),d=f.shift(),!d)));_++);if(d){u.appendChild(d.cell);for(let _=0,g=f.length;_0){const E=!b[w+1];for(let S=0,M;Sd)&&(N>=M.index?(y+=M.cs,N=w+y,M.rs-=1,M.row=d+1,M.rs<1&&(u.splice(S,1),S--)):E&&(M.rs-=1,M.row=d+1,M.rs<1&&(u.splice(S,1),S--)))}z>0&&c.push({rs:z,cs:L+1,index:N,row:-1}),N>=h&&N+L<=h+o?p.push(C):N<=h+o&&N+L>=h?C.colSpan-=l.getOverlapRangeAtIndex(a,a+o,N,N+L):z>0&&(Nh+o)&&m.push({cell:C,i:d,rs:d+z}),y+=L}else{if(w>=h)break;if(L>0){if(f<1&&L+w>=h){C.colSpan+=1,h=null,f=z+1;break}h-=L}if(!x){for(let E=0,S;E0){f-=1;continue}h!==null&&b.length>0&&(v=this.plugins.table.createCells.call(this,b[0].nodeName,0,!0),v=g.insertBefore(v,b[h]))}}if(n){let d,_;for(let g=0,h=p.length,b;g1)c.colSpan=this._w.Math.floor(u/2),n.colSpan=u-c.colSpan,o.insertBefore(c,n.nextElementSibling);else{let f=[],p=[];for(let m=0,d=l._rowCnt,_,g;m0)for(let C=0,B;Cm)&&(w>=B.index?(g+=B.cs,w+=B.cs,B.rs-=1,B.row=m+1,B.rs<1&&(p.splice(C,1),C--)):h===b-1&&(B.rs-=1,B.row=m+1,B.rs<1&&(p.splice(C,1),C--)));if(w<=a&&y>0&&f.push({index:w,cs:x+1,rs:y,row:-1}),v!==n&&w<=a&&w+x>=a+u-1){v.colSpan+=1;break}if(w>a)break;g+=x}p=p.concat(f).sort(function(h,b){return h.index-b.index}),f=[]}o.insertBefore(c,n.nextElementSibling)}}else{const u=n.rowSpan;if(c.colSpan=n.colSpan,u>1){c.rowSpan=this._w.Math.floor(u/2);const f=u-c.rowSpan,p=[],m=e.getArrayIndex(s,o)+f;for(let h=0,b,v;h=a));x++)w=b[x],C=w.rowSpan-1,C>0&&C+h>=m&&B=g.index&&(v+=g.cs,C+=g.cs,g=p.shift()),C>=a||h===b-1){d.insertBefore(c,x.nextElementSibling);break}v+=y}n.rowSpan=f}else{c.rowSpan=n.rowSpan;const f=e.createElement("TR");f.appendChild(c);for(let d=0,_;d=r&&(_[g].rowSpan+=1)}const p=l._physical_cellIndex,m=o.cells;for(let d=0,_=m.length;d<_;d++)d!==p&&(m[d].rowSpan+=1);o.parentNode.insertBefore(f,o.nextElementSibling)}}this.focusEdge(n),this.plugins.table.setPositionControllerDiv.call(this,n,!0)},mergeCells:function(){const t=this.plugins.table,e=this.context.table,i=this.util,l=t._ref,n=t._selectedCells,s=n[0];let o=null,a=null,r=l.ce-l.cs+1,c=l.re-l.rs+1,u="",f=null;for(let p=1,m=n.length,d,_;p0&&g+y>=m&&(x.rowSpan-=i.getOverlapRangeAtIndex(m,d,g,g+y))}for(let g=0,h=_.length;g"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",l.insertBefore(n,l.firstElementChild)}t.toggleClass(e,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},setTableStyle:function(t){const e=this.context.table,i=e._element;let l,n,s,o;t.indexOf("width")>-1&&(l=e.resizeButton.firstElementChild,n=e.resizeText,e._maxWidth?(s=e.icons.reduction,o=e.minText,e.columnFixedButton.style.display="block",this.util.removeClass(i,"se-table-size-auto"),this.util.addClass(i,"se-table-size-100")):(s=e.icons.expansion,o=e.maxText,e.columnFixedButton.style.display="none",this.util.removeClass(i,"se-table-size-100"),this.util.addClass(i,"se-table-size-auto")),this.util.changeElement(l,s),this.util.changeTxt(n,o)),t.indexOf("column")>-1&&(e._fixedColumn?(this.util.removeClass(i,"se-table-layout-auto"),this.util.addClass(i,"se-table-layout-fixed"),this.util.addClass(e.columnFixedButton,"active")):(this.util.removeClass(i,"se-table-layout-fixed"),this.util.addClass(i,"se-table-layout-auto"),this.util.removeClass(e.columnFixedButton,"active")))},setActiveButton:function(t,e){const i=this.context.table;/^TH$/i.test(t.nodeName)?(i.insertRowAboveButton.setAttribute("disabled",!0),i.insertRowBelowButton.setAttribute("disabled",!0)):(i.insertRowAboveButton.removeAttribute("disabled"),i.insertRowBelowButton.removeAttribute("disabled")),!e||t===e?(i.splitButton.removeAttribute("disabled"),i.mergeButton.setAttribute("disabled",!0)):(i.splitButton.setAttribute("disabled",!0),i.mergeButton.removeAttribute("disabled"))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(t){this.context.element.wysiwyg.setAttribute("contenteditable",t),t?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(t){t.stopPropagation();const e=this.plugins.table;e._shift?e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null):(e._removeEvents.call(this),e._toggleEditor.call(this,!0)),!(!e._fixedCell||!e._selectedTable)&&(e.setActiveButton.call(this,e._fixedCell,e._selectedCell),e.call_controller_tableEdit.call(this,e._selectedCell||e._fixedCell),e._selectedCells=e._selectedTable.querySelectorAll(".se-table-selected-cell"),e._selectedCell&&e._fixedCell&&this.focusEdge(e._selectedCell),e._shift||(e._fixedCell=null,e._selectedCell=null,e._fixedCellName=null))},_onCellMultiSelect:function(t){this._antiBlur=!0;const e=this.plugins.table,i=this.util.getParentElement(t.target,this.util.isCell);if(e._shift)i===e._fixedCell?e._toggleEditor.call(this,!0):e._toggleEditor.call(this,!1);else if(!e._ref){if(i===e._fixedCell)return;e._toggleEditor.call(this,!1)}!i||i===e._selectedCell||e._fixedCellName!==i.nodeName||e._selectedTable!==this.util.getParentElement(i,"TABLE")||(e._selectedCell=i,e._setMultiCells.call(this,e._fixedCell,i))},_setMultiCells:function(t,e){const i=this.plugins.table,l=i._selectedTable.rows,n=this.util,s=i._selectedTable.querySelectorAll(".se-table-selected-cell");for(let u=0,f=s.length;u0)for(let x=0,y;xu)&&(h>=y.index?(m+=y.cs,h+=y.cs,y.rs-=1,y.row=u+1,y.rs<1&&(a.splice(x,1),x--)):d===_-1&&(y.rs-=1,y.row=u+1,y.rs<1&&(a.splice(x,1),x--)));if(o){if((g===t||g===e)&&(c.cs=c.cs!==null&&c.csh+b?c.ce:h+b,c.rs=c.rs!==null&&c.rsu+v?c.re:u+v,c._i+=1),c._i===2){o=!1,a=[],r=[],u=-1;break}}else if(n.getOverlapRangeAtIndex(c.cs,c.ce,h,h+b)&&n.getOverlapRangeAtIndex(c.rs,c.re,u,u+v)){const x=c.csh+b?c.ce:h+b,w=c.rsu+v?c.re:u+v;if(c.cs!==x||c.ce!==y||c.rs!==w||c.re!==C){c.cs=x,c.ce=y,c.rs=w,c.re=C,u=-1,a=[],r=[];break}n.addClass(g,"se-table-selected-cell")}v>0&&r.push({index:h,cs:b+1,rs:v,row:-1}),m+=g.colSpan-1}a=a.concat(r).sort(function(d,_){return d.index-_.index}),r=[]}},_removeEvents:function(){const t=this.plugins.table;t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null),t._bindOnSelect&&(this._wd.removeEventListener("mousedown",t._bindOnSelect),this._wd.removeEventListener("mousemove",t._bindOnSelect),t._bindOnSelect=null),t._bindOffSelect&&(this._wd.removeEventListener("mouseup",t._bindOffSelect),t._bindOffSelect=null),t._bindOffShift&&(this._wd.removeEventListener("keyup",t._bindOffShift),t._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(t,e){const i=this.plugins.table;i._removeEvents.call(this),this.controllersOff(),i._shift=e,i._fixedCell=t,i._fixedCellName=t.nodeName,i._selectedTable=this.util.getParentElement(t,"TABLE");const l=i._selectedTable.querySelectorAll(".se-table-selected-cell");for(let n=0,s=l.length;n-1?(u=c.toLowerCase(),f=u==="blockquote"?"range":u==="pre"?"free":"replace",m=/^h/.test(u)?u.match(/\d+/)[0]:"",p=i["tag_"+(m?"h":u)]+m,_="",d=""):(u=c.tag.toLowerCase(),f=c.command,p=c.name||u,_=c.class,d=_?' class="'+_+'"':""),o+='
  • ";return o+="",l.innerHTML=o,l},active:function(t){let e=this.lang.toolbar.formats;const i=this.context.formatBlock.targetText;if(!t)this.util.changeTxt(i,e);else if(this.util.isFormatElement(t)){const n=this.context.formatBlock._formatList,s=t.nodeName.toLowerCase(),o=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let a=0,r=n.length,c;a=0;y--)if(w=g[y],w!==(g[y+1]?g[y+1].parentNode:null)){if(N=u.isComponent(w),C=N?"":w.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),B=u.getParentElement(w,function(S){return S.parentNode===b}),(b!==w.parentNode||N)&&(u.isFormatElement(b)?(b.parentNode.insertBefore(v,b.nextSibling),b=b.parentNode):(b.insertBefore(v,B?B.nextSibling:null),b=w.parentNode),z=v.nextSibling,z&&v.nodeName===z.nodeName&&u.isSameAttributes(v,z)&&(v.innerHTML+="
    "+z.innerHTML,u.removeItem(z)),v=n.cloneNode(!1),E=!0),L=v.innerHTML,v.innerHTML=(E||!C||!L||/
    $/i.test(C)?C:C+"
    ")+L,y===0){b.insertBefore(v,w),z=w.nextSibling,z&&v.nodeName===z.nodeName&&u.isSameAttributes(v,z)&&(v.innerHTML+="
    "+z.innerHTML,u.removeItem(z));const S=v.previousSibling;S&&v.nodeName===S.nodeName&&u.isSameAttributes(v,S)&&(S.innerHTML+="
    "+v.innerHTML,u.removeItem(v))}N||u.removeItem(w),C&&(E=!1)}this.setRange(x,0,x,0)}else{for(let h=0,b=g.length,v,x;h('+i.toolbar.default+")";for(let o=0,a=n.length,r;o";return s+="",l.innerHTML=s,l},on:function(){const t=this.context.lineHeight,e=t._sizeList,i=this.util.getFormatElement(this.getSelectionNode()),l=i?i.style.lineHeight+"":"";if(l!==t.currentSize){for(let n=0,s=e.length;n";return l+="",i.innerHTML=l,i},pickup:function(t){if(!/^BUTTON$/i.test(t.target.tagName))return!1;t.preventDefault(),t.stopPropagation(),this.context.template.selectedIndex=t.target.getAttribute("data-value")*1;const e=this.options.templates[this.context.template.selectedIndex];if(e.html)this.setContents(e.html);else throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.submenuOff()}},bt={name:"paragraphStyle",display:"submenu",add:function(t,e){const i=t.context;i.paragraphStyle={_classList:null};let l=this.setSubmenu(t);l.querySelector("ul").addEventListener("click",this.pickUp.bind(t)),i.paragraphStyle._classList=l.querySelectorAll("li button"),t.initMenuTarget(this.name,e,l),l=null},setSubmenu:function(t){const e=t.options,i=t.util.createElement("DIV");i.className="se-submenu se-list-layer se-list-format";const l=t.lang.menu,n={spaced:{name:l.spaced,class:"__se__p-spaced",_class:""},bordered:{name:l.bordered,class:"__se__p-bordered",_class:""},neon:{name:l.neon,class:"__se__p-neon",_class:""}},s=!e.paragraphStyles||e.paragraphStyles.length===0?["spaced","bordered","neon"]:e.paragraphStyles;let o='
      ';for(let a=0,r=s.length,c,u,f,p;a
    "}return o+="",i.innerHTML=o,i},on:function(){const e=this.context.paragraphStyle._classList,i=this.util.getFormatElement(this.getSelectionNode());for(let l=0,n=e.length;l"}return s+="",i.innerHTML=s,i},on:function(){const t=this.util,i=this.context.textStyle._styleList,l=this.getSelectionNode();for(let n=0,s=i.length,o,a,r;n"u"&&(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:l})),l})})(yt);var Rt=yt.exports;const X=Y(Rt),Ut={name:"selectMenu",add:function(t){t.context.selectMenu={caller:{},callerContext:null}},setForm:function(){return'
    '},createList:function(t,e,i){t.form.innerHTML="
      "+i+"
    ",t.items=e,t.menus=t.form.querySelectorAll("li")},initEvent:function(t,e){const i=e.querySelector(".se-select-list"),l=this.context.selectMenu.caller[t]={form:i,items:[],menus:[],index:-1,item:null,clickMethod:null,callerName:t};i.addEventListener("mousedown",this.plugins.selectMenu.onMousedown_list),i.addEventListener("mousemove",this.plugins.selectMenu.onMouseMove_list.bind(this,l)),i.addEventListener("click",this.plugins.selectMenu.onClick_list.bind(this,l))},onMousedown_list:function(t){t.preventDefault(),t.stopPropagation()},onMouseMove_list:function(t,e){this.util.addClass(t.form,"__se_select-menu-mouse-move");const i=e.target.getAttribute("data-index");i&&(t.index=i*1)},onClick_list:function(t,e){const i=e.target.getAttribute("data-index");i&&t.clickMethod.call(this,t.items[i])},moveItem:function(t,e){this.util.removeClass(t.form,"__se_select-menu-mouse-move"),e=t.index+e;const i=t.menus,l=i.length,n=t.index=e>=l?0:e<0?l-1:e;for(let s=0;s
    "+t.plugins.selectMenu.setForm()+'
    '+n.bookmark+''+n.download+'
    ",s.innerHTML=o,s},initEvent:function(t,e){const i=this.plugins.anchor,l=this.context.anchor.caller[t]={modal:e,urlInput:null,linkDefaultRel:this.options.linkRelDefault,defaultRel:this.options.linkRelDefault.default||"",currentRel:[],linkAnchor:null,linkValue:"",_change:!1,callerName:t};typeof l.linkDefaultRel.default=="string"&&(l.linkDefaultRel.default=l.linkDefaultRel.default.trim()),typeof l.linkDefaultRel.check_new_window=="string"&&(l.linkDefaultRel.check_new_window=l.linkDefaultRel.check_new_window.trim()),typeof l.linkDefaultRel.check_bookmark=="string"&&(l.linkDefaultRel.check_bookmark=l.linkDefaultRel.check_bookmark.trim()),l.urlInput=e.querySelector(".se-input-url"),l.anchorText=e.querySelector("._se_anchor_text"),l.newWindowCheck=e.querySelector("._se_anchor_check"),l.downloadCheck=e.querySelector("._se_anchor_download"),l.download=e.querySelector("._se_anchor_download_icon"),l.preview=e.querySelector(".se-link-preview"),l.bookmark=e.querySelector("._se_anchor_bookmark_icon"),l.bookmarkButton=e.querySelector("._se_bookmark_button"),this.plugins.selectMenu.initEvent.call(this,t,e);const n=this.context.selectMenu.caller[t];this.options.linkRel.length>0&&(l.relButton=e.querySelector(".se-anchor-rel-btn"),l.relList=e.querySelector(".se-list-layer"),l.relPreview=e.querySelector(".se-anchor-rel-preview"),l.relButton.addEventListener("click",i.onClick_relButton.bind(this,l)),l.relList.addEventListener("click",i.onClick_relList.bind(this,l))),l.newWindowCheck.addEventListener("change",i.onChange_newWindowCheck.bind(this,l)),l.downloadCheck.addEventListener("change",i.onChange_downloadCheck.bind(this,l)),l.anchorText.addEventListener("input",i.onChangeAnchorText.bind(this,l)),l.urlInput.addEventListener("input",i.onChangeUrlInput.bind(this,l)),l.urlInput.addEventListener("keydown",i.onKeyDownUrlInput.bind(this,n)),l.urlInput.addEventListener("focus",i.onFocusUrlInput.bind(this,l,n)),l.urlInput.addEventListener("blur",i.onBlurUrlInput.bind(this,n)),l.bookmarkButton.addEventListener("click",i.onClick_bookmarkButton.bind(this,l))},on:function(t,e){const i=this.plugins.anchor;if(!e)i.init.call(this,t),t.anchorText.value=this.getSelection().toString().trim(),t.newWindowCheck.checked=this.options.linkTargetNewWindow;else if(t.linkAnchor){this.context.dialog.updateModal=!0;const l=t.linkAnchor.getAttribute("href");t.linkValue=t.preview.textContent=t.urlInput.value=i.selfPathBookmark.call(this,l)?l.substr(l.lastIndexOf("#")):l,t.anchorText.value=t.linkAnchor.textContent,t.newWindowCheck.checked=!!/_blank/i.test(t.linkAnchor.target),t.downloadCheck.checked=t.linkAnchor.download}this.context.anchor.callerContext=t,i.setRel.call(this,t,e&&t.linkAnchor?t.linkAnchor.rel:t.defaultRel),i.setLinkPreview.call(this,t,t.linkValue),this.plugins.selectMenu.on.call(this,t.callerName,this.plugins.anchor.setHeaderBookmark)},selfPathBookmark:function(t){const e=this._w.location.href.replace(/\/$/,"");return t.indexOf("#")===0||t.indexOf(e)===0&&t.indexOf("#")===(e.indexOf("#")===-1?e.length:e.substr(0,e.indexOf("#")).length)},_closeRelMenu:null,toggleRelList:function(t,e){if(!e)this.plugins.anchor._closeRelMenu&&this.plugins.anchor._closeRelMenu();else{const i=t.relButton,l=t.relList;this.util.addClass(i,"active"),l.style.visibility="hidden",l.style.display="block",this.options.rtl?l.style.left=i.offsetLeft-l.offsetWidth-1+"px":l.style.left=i.offsetLeft+i.offsetWidth+1+"px",l.style.top=i.offsetTop+i.offsetHeight/2-l.offsetHeight/2+"px",l.style.visibility="",this.plugins.anchor._closeRelMenu=(function(n,s,o){o&&(n.relButton.contains(o.target)||n.relList.contains(o.target))||(this.util.removeClass(s,"active"),n.relList.style.display="none",this.modalForm.removeEventListener("click",this.plugins.anchor._closeRelMenu),this.plugins.anchor._closeRelMenu=null)}).bind(this,t,i),this.modalForm.addEventListener("click",this.plugins.anchor._closeRelMenu)}},onClick_relButton:function(t,e){this.plugins.anchor.toggleRelList.call(this,t,!this.util.hasClass(e.target,"active"))},onClick_relList:function(t,e){const i=e.target,l=i.getAttribute("data-command");if(!l)return;const n=t.currentRel,s=this.util.toggleClass(i,"se-checked"),o=n.indexOf(l);s?o===-1&&n.push(l):o>-1&&n.splice(o,1),t.relPreview.title=t.relPreview.textContent=n.join(" ")},setRel:function(t,e){const i=t.relList,l=t.currentRel=e?e.split(" "):[];if(!i)return;const n=i.querySelectorAll("button");for(let s=0,o=n.length,a;s-1?this.util.addClass(n[s],"se-checked"):this.util.removeClass(n[s],"se-checked");t.relPreview.title=t.relPreview.textContent=l.join(" ")},createHeaderList:function(t,e,i){const l=this.util.getListChildren(this.context.element.wysiwyg,function(a){return/h[1-6]/i.test(a.nodeName)});if(l.length===0)return;const n=new this._w.RegExp("^"+i.replace(/^#/,""),"i"),s=[];let o="";for(let a=0,r=l.length,c;a'+c.textContent+"");s.length===0?this.plugins.selectMenu.close.call(this,e):(this.plugins.selectMenu.createList(e,s,o),this.plugins.selectMenu.open.call(this,e,this.plugins.anchor._setMenuListPosition.bind(this,t)))},_setMenuListPosition:function(t,e){e.style.top=t.urlInput.offsetHeight+1+"px"},onKeyDownUrlInput:function(t,e){switch(e.keyCode){case 38:e.preventDefault(),e.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,t,-1);break;case 40:e.preventDefault(),e.stopPropagation(),this.plugins.selectMenu.moveItem.call(this,t,1);break;case 13:t.index>-1&&(e.preventDefault(),e.stopPropagation(),this.plugins.anchor.setHeaderBookmark.call(this,this.plugins.selectMenu.getItem(t,null)));break}},setHeaderBookmark:function(t){const e=this.context.anchor.callerContext,i=t.id||"h_"+this._w.Math.random().toString().replace(/.+\./,"");t.id=i,e.urlInput.value="#"+i,(!e.anchorText.value.trim()||!e._change)&&(e.anchorText.value=t.textContent),this.plugins.anchor.setLinkPreview.call(this,e,e.urlInput.value),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext),this.context.anchor.callerContext.urlInput.focus()},onChangeAnchorText:function(t,e){t._change=!!e.target.value.trim()},onChangeUrlInput:function(t,e){const i=e.target.value.trim();this.plugins.anchor.setLinkPreview.call(this,t,i),this.plugins.anchor.selfPathBookmark.call(this,i)?this.plugins.anchor.createHeaderList.call(this,t,this.context.selectMenu.callerContext,i):this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)},onFocusUrlInput:function(t,e){const i=t.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,i)&&this.plugins.anchor.createHeaderList.call(this,t,e,i)},onBlurUrlInput:function(t){this.plugins.selectMenu.close.call(this,t)},setLinkPreview:function(t,e){const i=t.preview,l=this.options.linkProtocol,n=this.options.linkNoPrefix,s=/^(mailto\:|tel\:|sms\:|https*\:\/\/|#)/.test(e)||e.indexOf(l)===0,o=l?this._w.RegExp("^"+this.util.escapeStringRegexp(e.substr(0,l.length))).test(l):!1;e=t.linkValue=i.textContent=e?n?e:l&&!s&&!o?l+e:s?e:/^www\./.test(e)?"http://"+e:this.context.anchor.host+(/^\//.test(e)?"":"/")+e:"",this.plugins.anchor.selfPathBookmark.call(this,e)?(t.bookmark.style.display="block",this.util.addClass(t.bookmarkButton,"active")):(t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active")),!this.plugins.anchor.selfPathBookmark.call(this,e)&&t.downloadCheck.checked?t.download.style.display="block":t.download.style.display="none"},setCtx:function(t,e){t&&(e.linkAnchor=t,e.linkValue=t.href,e.currentRel=t.rel.split(" "))},updateAnchor:function(t,e,i,l,n){!this.plugins.anchor.selfPathBookmark.call(this,e)&&l.downloadCheck.checked?t.setAttribute("download",i||e):t.removeAttribute("download"),l.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const s=l.currentRel.join(" ");s?t.rel=s:t.removeAttribute("rel"),t.href=e,n?t.children.length===0&&(t.textContent=""):t.textContent=i},createAnchor:function(t,e){if(t.linkValue.length===0)return null;const i=t.linkValue,l=t.anchorText,n=l.value.length===0?i:l.value,s=t.linkAnchor||this.util.createElement("A");return this.plugins.anchor.updateAnchor.call(this,s,i,n,t,e),t.linkValue=t.preview.textContent=t.urlInput.value=t.anchorText.value="",s},onClick_bookmarkButton:function(t){let e=t.urlInput.value;this.plugins.anchor.selfPathBookmark.call(this,e)?(e=e.substr(1),t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active"),this.plugins.selectMenu.close.call(this,this.context.selectMenu.callerContext)):(e="#"+e,t.bookmark.style.display="block",this.util.addClass(t.bookmarkButton,"active"),t.downloadCheck.checked=!1,t.download.style.display="none",this.plugins.anchor.createHeaderList.call(this,t,this.context.selectMenu.callerContext,e)),t.urlInput.value=e,this.plugins.anchor.setLinkPreview.call(this,t,e),t.urlInput.focus()},onChange_newWindowCheck:function(t,e){typeof t.linkDefaultRel.check_new_window=="string"&&(e.target.checked?this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relMerge.call(this,t,t.linkDefaultRel.check_new_window)):this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relDelete.call(this,t,t.linkDefaultRel.check_new_window)))},onChange_downloadCheck:function(t,e){e.target.checked?(t.download.style.display="block",t.bookmark.style.display="none",this.util.removeClass(t.bookmarkButton,"active"),t.linkValue=t.preview.textContent=t.urlInput.value=t.urlInput.value.replace(/^\#+/,""),typeof t.linkDefaultRel.check_bookmark=="string"&&this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relMerge.call(this,t,t.linkDefaultRel.check_bookmark))):(t.download.style.display="none",typeof t.linkDefaultRel.check_bookmark=="string"&&this.plugins.anchor.setRel.call(this,t,this.plugins.anchor._relDelete.call(this,t,t.linkDefaultRel.check_bookmark)))},_relMerge:function(t,e){const i=t.currentRel;if(!e)return i.join(" ");if(/^only\:/.test(e))return e=e.replace(/^only\:/,"").trim(),t.currentRel=e.split(" "),e;const l=e.split(" ");for(let n=0,s=l.length,o;n'+l.cancel+''+e.dialogBox.linkBox.title+""+t.context.anchor.forms.innerHTML+'";return i.innerHTML=n,i},setController_LinkButton:function(t){const e=t.lang,i=t.icons,l=t.util.createElement("DIV");return l.className="se-controller se-controller-link",l.innerHTML='
    ",l},open:function(){this.plugins.dialog.open.call(this,"link",this.currentControllerName==="link")},submit:function(t){this.showLoading(),t.preventDefault(),t.stopPropagation();try{const e=this.plugins.anchor.createAnchor.call(this,this.context.anchor.caller.link,!1);if(e===null)return;if(this.context.dialog.updateModal){const i=this.context.link._linkAnchor.childNodes[0];this.setRange(i,0,i,i.textContent.length)}else{const i=this.getSelectedElements();if(i.length>1){const l=this.util.createElement(i[0].nodeName);if(l.appendChild(e),!this.insertNode(l,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(t){if(!t)this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();else if(this.util.isAnchor(t)&&t.getAttribute("data-image-link")===null)return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,t),!0;return!1},on:function(t){this.plugins.anchor.on.call(this,this.context.anchor.caller.link,t)},call_controller:function(t){this.editLink=this.context.link._linkAnchor=this.context.anchor.caller.link.linkAnchor=t;const e=this.context.link.linkController,i=e.querySelector("a");i.href=t.href,i.title=t.textContent,i.textContent=t.textContent,this.util.addClass(t,"on"),this.setControllerPosition(e,t,"bottom",{left:0,top:0}),this.controllersOn(e,t,"link",this.util.removeClass.bind(this.util,this.context.link._linkAnchor,"on"))},onClick_linkController:function(t){t.stopPropagation();const e=t.target.getAttribute("data-command")||t.target.parentNode.getAttribute("data-command");if(e){if(t.preventDefault(),/update/.test(e))this.plugins.dialog.open.call(this,"link",!0);else if(/unlink/.test(e)){const i=this.util.getChildElement(this.context.link._linkAnchor,function(n){return n.childNodes.length===0||n.nodeType===3},!1),l=this.util.getChildElement(this.context.link._linkAnchor,function(n){return n.childNodes.length===0||n.nodeType===3},!0);this.setRange(i,0,l,l.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)}};var Ct={exports:{}};(function(t){(function(e,i){t.exports=e.document?i(e,!0):function(l){if(!l.document)throw new Error("SUNEDITOR_MODULES a window with a document");return i(l)}})(typeof window<"u"?window:T,function(e,i){const l={name:"component",set_container:function(n,s){const o=this.util.createElement("DIV");return o.className="se-component "+s,o.appendChild(n),o},set_cover:function(n){const s=this.util.createElement("FIGURE");return s.appendChild(n),s},create_caption:function(){const n=this.util.createElement("FIGCAPTION");return n.innerHTML="
    "+this.lang.dialogBox.caption+"
    ",n}};return typeof i>"u"&&(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:l})),l})})(Ct);var Ot=Ct.exports;const Q=Y(Ot);var St={exports:{}};(function(t){(function(e,i){t.exports=e.document?i(e,!0):function(l){if(!l.document)throw new Error("SUNEDITOR_MODULES a window with a document");return i(l)}})(typeof window<"u"?window:T,function(e,i){const l={name:"resizing",add:function(n){const s=n.icons,o=n.context;o.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:s.align_justify,left:s.align_left,right:s.align_right,center:s.align_center}};let a=this.setController_resize(n);o.resizing.resizeContainer=a,o.resizing.resizeDiv=a.querySelector(".se-modal-resize"),o.resizing.resizeDot=a.querySelector(".se-resize-dot"),o.resizing.resizeDisplay=a.querySelector(".se-resize-display");let r=this.setController_button(n);o.resizing.resizeButton=r;let c=o.resizing.resizeHandles=o.resizing.resizeDot.querySelectorAll("span");o.resizing.resizeButtonGroup=r.querySelector("._se_resizing_btn_group"),o.resizing.rotationButtons=r.querySelectorAll("._se_resizing_btn_group ._se_rotation"),o.resizing.percentageButtons=r.querySelectorAll("._se_resizing_btn_group ._se_percentage"),o.resizing.alignMenu=r.querySelector(".se-resizing-align-list"),o.resizing.alignMenuList=o.resizing.alignMenu.querySelectorAll("button"),o.resizing.alignButton=r.querySelector("._se_resizing_align_button"),o.resizing.autoSizeButton=r.querySelector("._se_resizing_btn_group ._se_auto_size"),o.resizing.captionButton=r.querySelector("._se_resizing_caption_button"),a.addEventListener("mousedown",function(u){u.preventDefault()}),c[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),c[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),c[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),c[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),c[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),c[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),c[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),c[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(n)),r.addEventListener("click",this.onClick_resizeButton.bind(n)),o.element.relative.appendChild(a),o.element.relative.appendChild(r),a=null,r=null,c=null},setController_resize:function(n){const s=n.util.createElement("DIV");return s.className="se-controller se-resizing-container",s.style.display="none",s.innerHTML='
    ',s},setController_button:function(n){const s=n.lang,o=n.icons,a=n.util.createElement("DIV");return a.className="se-controller se-controller-resizing",a.innerHTML='
    ",a},_module_getSizeX:function(n,s,o,a){return s||(s=n._element),o||(o=n._cover),a||(a=n._container),s?/%$/.test(s.style.width)?(a&&this.util.getNumber(a.style.width,2)||100)+"%":s.style.width:""},_module_getSizeY:function(n,s,o,a){return s||(s=n._element),o||(o=n._cover),a||(a=n._container),!a||!o?s&&s.style.height||"":this.util.getNumber(o.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?o.style.height:!/%$/.test(s.style.height)||!/%$/.test(s.style.width)?s.style.height:(a&&this.util.getNumber(a.style.height,2)||100)+"%"},_module_setModifyInputSize:function(n,s){const o=n._onlyPercentage&&this.context.resizing._rotateVertical;n.proportion.checked=n._proportionChecked=n._element.getAttribute("data-proportion")!=="false";let a=o?"":this.plugins.resizing._module_getSizeX.call(this,n);if(a===n._defaultSizeX&&(a=""),n._onlyPercentage&&(a=this.util.getNumber(a,2)),n.inputX.value=a,s.setInputSize.call(this,"x"),!n._onlyPercentage){let r=o?"":this.plugins.resizing._module_getSizeY.call(this,n);r===n._defaultSizeY&&(r=""),n._onlyPercentage&&(r=this.util.getNumber(r,2)),n.inputY.value=r}n.inputX.disabled=!!o,n.inputY.disabled=!!o,n.proportion.disabled=!!o,s.setRatio.call(this)},_module_setInputSize:function(n,s){if(n._onlyPercentage){s==="x"&&n.inputX.value>100&&(n.inputX.value=100);return}if(n.proportion.checked&&n._ratio&&/\d/.test(n.inputX.value)&&/\d/.test(n.inputY.value)){const o=n.inputX.value.replace(/\d+|\./g,"")||n.sizeUnit,a=n.inputY.value.replace(/\d+|\./g,"")||n.sizeUnit;if(o!==a)return;const r=o==="%"?2:0;s==="x"?n.inputY.value=this.util.getNumber(n._ratioY*this.util.getNumber(n.inputX.value,r),r)+a:n.inputX.value=this.util.getNumber(n._ratioX*this.util.getNumber(n.inputY.value,r),r)+o}},_module_setRatio:function(n){const s=n.inputX.value,o=n.inputY.value;if(n.proportion.checked&&/\d+/.test(s)&&/\d+/.test(o)){const a=s.replace(/\d+|\./g,"")||n.sizeUnit,r=o.replace(/\d+|\./g,"")||n.sizeUnit;if(a!==r)n._ratio=!1;else if(!n._ratio){const c=this.util.getNumber(s,0),u=this.util.getNumber(o,0);n._ratio=!0,n._ratioX=c/u,n._ratioY=u/c}}else n._ratio=!1},_module_sizeRevert:function(n){n._onlyPercentage?n.inputX.value=n._origin_w>100?100:n._origin_w:(n.inputX.value=n._origin_w,n.inputY.value=n._origin_h)},_module_saveCurrentSize:function(n){const s=this.plugins.resizing._module_getSizeX.call(this,n),o=this.plugins.resizing._module_getSizeY.call(this,n);n._element.setAttribute("width",s.replace("px","")),n._element.setAttribute("height",o.replace("px","")),n._element.setAttribute("data-size",s+","+o),n._videoRatio&&(n._videoRatio=o)},call_controller_resize:function(n,s){const o=this.context.resizing,a=this.context[s];o._resize_plugin=s;const r=o.resizeContainer,c=o.resizeDiv,u=this.util.getOffset(n,this.context.element.wysiwygFrame),f=o._rotateVertical=/^(90|270)$/.test(Math.abs(n.getAttribute("data-rotate")).toString()),p=f?n.offsetHeight:n.offsetWidth,m=f?n.offsetWidth:n.offsetHeight,d=u.top,_=u.left-this.context.element.wysiwygFrame.scrollLeft;r.style.top=d+"px",r.style.left=_+"px",r.style.width=p+"px",r.style.height=m+"px",c.style.top="0px",c.style.left="0px",c.style.width=p+"px",c.style.height=m+"px";let g=n.getAttribute("data-align")||"basic";g=g==="none"?"basic":g;const h=this.util.getParentElement(n,this.util.isComponent),b=this.util.getParentElement(n,"FIGURE"),v=this.plugins.resizing._module_getSizeX.call(this,a,n,b,h)||"auto",x=a._onlyPercentage&&s==="image"?"":", "+(this.plugins.resizing._module_getSizeY.call(this,a,n,b,h)||"auto");this.util.changeTxt(o.resizeDisplay,this.lang.dialogBox[g]+" ("+v+x+")"),o.resizeButtonGroup.style.display=a._resizing?"":"none";const y=a._resizing&&!a._resizeDotHide&&!a._onlyPercentage?"flex":"none",w=o.resizeHandles;for(let E=0,S=w.length;E=360?0:h;u.setAttribute("data-rotate",b),g._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(b).toString()),this.plugins.resizing.setTransformSize.call(this,u,null,null),this.selectComponent(u,r);break;case"onalign":this.plugins.resizing.openAlignMenu.call(this);return;case"align":const v=a==="basic"?"none":a;f.setAlign.call(this,v,null,null,null),this.selectComponent(u,r);break;case"caption":const x=!c._captionChecked;if(f.openModify.call(this,!0),c._captionChecked=c.captionCheckEl.checked=x,f.update_image.call(this,!1,!1,!1),x){const y=this.util.getChildElement(c._caption,function(w){return w.nodeType===3});y?this.setRange(y,0,y,y.textContent.length):c._caption.focus(),this.controllersOff()}else this.selectComponent(u,r),f.openModify.call(this,!0);break;case"revert":f.setOriginSize.call(this),this.selectComponent(u,r);break;case"update":f.openModify.call(this),this.controllersOff();break;case"delete":f.destroy.call(this);break}this.history.push(!1)}},resetTransform:function(n){const s=(n.getAttribute("data-size")||n.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,n.style.maxWidth="",n.style.transform="",n.style.transformOrigin="",n.setAttribute("data-rotate",""),n.setAttribute("data-rotateX",""),n.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,s[0]?s[0]:"auto",s[1]?s[1]:"",!0)},setTransformSize:function(n,s,o){let a=n.getAttribute("data-percentage");const r=this.context.resizing._rotateVertical,c=n.getAttribute("data-rotate")*1;let u="";if(a&&!r)a=a.split(","),a[0]==="auto"&&a[1]==="auto"?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,a[0],a[1]);else{const f=this.util.getParentElement(n,"FIGURE"),p=s||n.offsetWidth,m=o||n.offsetHeight,d=(r?m:p)+"px",_=(r?p:m)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,p+"px",m+"px",!0),f.style.width=d,f.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":_,r){let g=p/2+"px "+p/2+"px 0",h=m/2+"px "+m/2+"px 0";u=c===90||c===-270?h:g}}n.style.transformOrigin=u,this.plugins.resizing._setTransForm(n,c.toString(),n.getAttribute("data-rotateX")||"",n.getAttribute("data-rotateY")||""),r?n.style.maxWidth="none":n.style.maxWidth="",this.plugins.resizing.setCaptionPosition.call(this,n)},_setTransForm:function(n,s,o,a){let r=(n.offsetWidth-n.offsetHeight)*(/-/.test(s)?1:-1),c="";if(/[1-9]/.test(s)&&(o||a))switch(c=o?"Y":"X",s){case"90":c=o&&a?"X":a?c:"";break;case"270":r*=-1,c=o&&a?"Y":o?c:"";break;case"-90":c=o&&a?"Y":o?c:"";break;case"-270":r*=-1,c=o&&a?"X":a?c:"";break;default:c=""}s%180===0&&(n.style.maxWidth=""),n.style.transform="rotate("+s+"deg)"+(o?" rotateX("+o+"deg)":"")+(a?" rotateY("+a+"deg)":"")+(c?" translate"+c+"("+r+"px)":"")},setCaptionPosition:function(n){const s=this.util.getChildElement(this.util.getParentElement(n,"FIGURE"),"FIGCAPTION");s&&(s.style.marginTop=(this.context.resizing._rotateVertical?n.offsetWidth-n.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(n){n.stopPropagation(),n.preventDefault();const s=this.context.resizing,o=s._resize_direction=n.target.classList[0];s._resizeClientX=n.clientX,s._resizeClientY=n.clientY,this.context.element.resizeBackground.style.display="block",s.resizeButton.style.display="none",s.resizeDiv.style.float=/l/.test(o)?"right":/r/.test(o)?"left":"none";const a=(function(u){if(u.type==="keydown"&&u.keyCode!==27)return;const f=s._isChange;s._isChange=!1,this.removeDocEvent("mousemove",r),this.removeDocEvent("mouseup",a),this.removeDocEvent("keydown",a),u.type==="keydown"?(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,o),f&&this.history.push(!1))}).bind(this),r=this.plugins.resizing.resizing_element.bind(this,s,o,this.context[s._resize_plugin]);this.addDocEvent("mousemove",r),this.addDocEvent("mouseup",a),this.addDocEvent("keydown",a)},resizing_element:function(n,s,o,a){const r=a.clientX,c=a.clientY;let u=o._element_w,f=o._element_h;const p=o._element_w+(/r/.test(s)?r-n._resizeClientX:n._resizeClientX-r),m=o._element_h+(/b/.test(s)?c-n._resizeClientY:n._resizeClientY-c),d=o._element_h/o._element_w*p;/t/.test(s)&&(n.resizeDiv.style.top=o._element_h-(/h/.test(s)?m:d)+"px"),/l/.test(s)&&(n.resizeDiv.style.left=o._element_w-p+"px"),/r|l/.test(s)&&(n.resizeDiv.style.width=p+"px",u=p),/^(t|b)[^h]$/.test(s)?(n.resizeDiv.style.height=d+"px",f=d):/^(t|b)h$/.test(s)&&(n.resizeDiv.style.height=m+"px",f=m),n._resize_w=u,n._resize_h=f,this.util.changeTxt(n.resizeDisplay,this._w.Math.round(u)+" x "+this._w.Math.round(f)),n._isChange=!0},cancel_controller_resize:function(n){const s=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let o=this._w.Math.round(s?this.context.resizing._resize_h:this.context.resizing._resize_w),a=this._w.Math.round(s?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!s&&!/%$/.test(o)){const u=this.context.element.wysiwygFrame.clientWidth-32-2;this.util.getNumber(o,0)>u&&(a=this._w.Math.round(a/o*u),o=u)}const r=this.context.resizing._resize_plugin;this.plugins[r].setSize.call(this,o,a,!1,n),s&&this.plugins.resizing.setTransformSize.call(this,this.context[this.context.resizing._resize_plugin]._element,o,a),this.selectComponent(this.context[r]._element,r)}};return typeof i>"u"&&(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:l})),l})})(St);var Ft=St.exports;const kt=Y(Ft);var Et={exports:{}};(function(t){(function(e,i){t.exports=e.document?i(e,!0):function(l){if(!l.document)throw new Error("SUNEDITOR_MODULES a window with a document");return i(l)}})(typeof window<"u"?window:T,function(e,i){const l={name:"fileManager",_xmlHttp:null,_checkMediaComponent:function(n){return/IMG/i.test(n)?!/FIGURE/i.test(n.parentElement.nodeName)||!/FIGURE/i.test(n.parentElement.parentElement.nodeName):!0},upload:function(n,s,o,a,r){this.showLoading();const c=this.plugins.fileManager,u=c._xmlHttp=this.util.getXMLHttpRequest();if(u.onreadystatechange=c._callBackUpload.bind(this,u,a,r),u.open("post",n,!0),s!==null&&typeof s=="object"&&this._w.Object.keys(s).length>0)for(let f in s)u.setRequestHeader(f,s[f]);u.send(o)},_callBackUpload:function(n,s,o){if(n.readyState===4)if(n.status===200)try{s(n)}catch(a){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+a.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const a=n.responseText?JSON.parse(n.responseText):n;if(typeof o!="function"||o("",a,this)){const r="[SUNEDITOR.fileManager.upload.serverException] status: "+n.status+", response: "+(a.errorMessage||n.responseText);throw this.functions.noticeOpen(r),Error(r)}}},checkInfo:function(n,s,o,a,r){let c=[];for(let h=0,b=s.length;h0;){const h=c.shift();!this.util.getParentElement(h,this.util.isMediaComponent)||!u._checkMediaComponent(h)?(_.push(f._infoIndex),a(h)):!h.getAttribute("data-index")||g.indexOf(h.getAttribute("data-index")*1)<0?(_.push(f._infoIndex),h.removeAttribute("data-index"),m(n,h,o,null,r)):_.push(h.getAttribute("data-index")*1)}for(let h=0,b;h-1)&&(p.splice(h,1),typeof o=="function"&&o(null,b,"delete",null,0,this),h--);r&&(this.context.resizing._resize_plugin=d)},setInfo:function(n,s,o,a,r){const c=r?this.context.resizing._resize_plugin:"";r&&(this.context.resizing._resize_plugin=n);const u=this.plugins[n],f=this.context[n],p=f._infoList;let m=s.getAttribute("data-index"),d=null,_="";if(a||(a={name:s.getAttribute("data-file-name")||(typeof s.src=="string"?s.src.split("/").pop():""),size:s.getAttribute("data-file-size")||0}),!m||this._componentsInfoInit)_="create",m=f._infoIndex++,s.setAttribute("data-index",m),s.setAttribute("data-file-name",a.name),s.setAttribute("data-file-size",a.size),d={src:s.src,index:m*1,name:a.name,size:a.size},p.push(d);else{_="update",m*=1;for(let g=0,h=p.length;g=0){const a=this.context[n]._infoList;for(let r=0,c=a.length;r"u"&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"fileManager",{enumerable:!0,writable:!1,configurable:!1,value:l})),l})})(Et);var Pt=Et.exports;const J=Y(Pt),zt={name:"image",display:"dialog",add:function(t){t.addModule([X,xt,Q,kt,J]);const e=t.options,i=t.context,l=i.image={_infoList:[],_infoIndex:0,_uploadFileLength:0,focusElement:null,sizeUnit:e._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:e.imageWidth==="auto"?"":e.imageWidth,_origin_h:e.imageHeight==="auto"?"":e.imageHeight,_proportionChecked:!0,_resizing:e.imageResizing,_resizeDotHide:!e.imageHeightShow,_rotation:e.imageRotation,_alignHide:!e.imageAlignShow,_onlyPercentage:e.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1,_captionShow:!0,_captionChecked:!1,_caption:null,captionCheckEl:null};let n=this.setDialog(t);l.modal=n,l.imgInputFile=n.querySelector("._se_image_file"),l.imgUrlFile=n.querySelector("._se_image_url"),l.focusElement=l.imgInputFile||l.imgUrlFile,l.altText=n.querySelector("._se_image_alt"),l.captionCheckEl=n.querySelector("._se_image_check_caption"),l.previewSrc=n.querySelector("._se_tab_content_image .se-link-preview"),n.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(t)),n.querySelector("form").addEventListener("submit",this.submit.bind(t)),l.imgInputFile&&n.querySelector(".se-file-remove").addEventListener("click",this._removeSelectedFiles.bind(l.imgInputFile,l.imgUrlFile,l.previewSrc)),l.imgUrlFile&&l.imgUrlFile.addEventListener("input",this._onLinkPreview.bind(l.previewSrc,l._v_src,e.linkProtocol)),l.imgInputFile&&l.imgUrlFile&&l.imgInputFile.addEventListener("change",this._fileInputChange.bind(l));const s=n.querySelector(".__se__gallery");s&&s.addEventListener("click",this._openGallery.bind(t)),l.proportion={},l.inputX={},l.inputY={},e.imageResizing&&(l.proportion=n.querySelector("._se_image_check_proportion"),l.inputX=n.querySelector("._se_image_size_x"),l.inputY=n.querySelector("._se_image_size_y"),l.inputX.value=e.imageWidth,l.inputY.value=e.imageHeight,l.inputX.addEventListener("keyup",this.setInputSize.bind(t,"x")),l.inputY.addEventListener("keyup",this.setInputSize.bind(t,"y")),l.inputX.addEventListener("change",this.setRatio.bind(t)),l.inputY.addEventListener("change",this.setRatio.bind(t)),l.proportion.addEventListener("change",this.setRatio.bind(t)),n.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(t))),i.dialog.modal.appendChild(n),t.plugins.anchor.initEvent.call(t,"image",n.querySelector("._se_tab_content_url")),l.anchorCtx=t.context.anchor.caller.image,n=null},setDialog:function(t){const e=t.options,i=t.lang,l=t.util.createElement("DIV");l.className="se-dialog-content se-dialog-image",l.style.display="none";let n='
    '+i.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(n+='
    "),e.imageUrlInput&&(n+='
    '+(e.imageGalleryUrl&&t.plugins.imageGallery?'":"")+'
    '),n+='
    ',e.imageResizing){const s=e.imageSizeOnlyPercentage,o=s?' style="display: none !important;"':"",a=e.imageHeightShow?"":' style="display: none !important;"';n+='
    ',s||!e.imageHeightShow?n+='
    ":n+='
    ",n+=' '+i.dialogBox.proportion+'
    "}return n+='
    ",l.innerHTML=n,l},_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(t,e){this.value="",t&&(t.removeAttribute("disabled"),e.style.textDecoration="")},_openGallery:function(){this.callPlugin("imageGallery",this.plugins.imageGallery.open.bind(this,this.plugins.image._setUrlInput.bind(this.context.image)),null)},_setUrlInput:function(t){this.altText.value=t.alt,this._v_src._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-value")||t.src,this.imgUrlFile.focus()},_onLinkPreview:function(t,e,i){const l=i.target.value.trim();t._linkValue=this.textContent=l?e&&l.indexOf("://")===-1&&l.indexOf("#")!==0?e+l:l.indexOf("://")===-1?"/"+l:l:""},fileTags:["img"],select:function(t){this.plugins.image.onModifyMode.call(this,t,this.plugins.resizing.call_controller_resize.call(this,t,"image"))},destroy:function(t){const e=t||this.context.image._element,i=this.util.getParentElement(e,this.util.isMediaComponent)||e,l=e.getAttribute("data-index")*1;if(typeof this.functions.onImageDeleteBefore=="function"&&this.functions.onImageDeleteBefore(e,i,l,this)===!1)return;let n=i.previousElementSibling||i.nextElementSibling;const s=i.parentNode;this.util.removeItem(i),this.plugins.image.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,function(o){return o.childNodes.length===0},null),this.focusEdge(n),this.plugins.fileManager.deleteInfo.call(this,"image",l,this.functions.onImageUpload),this.history.push(!1)},on:function(t){const e=this.context.image;t?e.imgInputFile&&this.options.imageMultipleFile&&e.imgInputFile.removeAttribute("multiple"):(e.inputX.value=e._origin_w=this.options.imageWidth===e._defaultSizeX?"":this.options.imageWidth,e.inputY.value=e._origin_h=this.options.imageHeight===e._defaultSizeY?"":this.options.imageHeight,e.imgInputFile&&this.options.imageMultipleFile&&e.imgInputFile.setAttribute("multiple","multiple")),this.plugins.anchor.on.call(this,e.anchorCtx,t)},open:function(){this.plugins.dialog.open.call(this,"image",this.currentControllerName==="image")},openTab:function(t){const e=this.context.image.modal,i=t==="init"?e.querySelector("._se_tab_link"):t.target;if(!/^BUTTON$/i.test(i.tagName))return!1;const l=i.getAttribute("data-tab-link"),n="_se_tab_content";let s,o,a;for(o=e.getElementsByClassName(n),s=0;s0?(this.showLoading(),i.submitAction.call(this,this.context.image.imgInputFile.files)):e.imgUrlFile&&e._v_src._linkValue.length>0&&(this.showLoading(),i.onRender_imgUrl.call(this,e._v_src._linkValue))}catch(l){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+l.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let e=0,i=[];for(let a=0,r=t.length;a0){let a=0;const r=this.context.image._infoList;for(let c=0,u=r.length;cl){this.closeLoading();const c="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+l/1e3+"KB";(typeof this.functions.onImageUploadError!="function"||this.functions.onImageUploadError(c,{limitSize:l,currentSize:a,uploadSize:e},this))&&this.functions.noticeOpen(c);return}}const n=this.context.image;n._uploadFileLength=i.length;const o={anchor:this.plugins.anchor.createAnchor.call(this,n.anchorCtx,!0),inputWidth:n.inputX.value,inputHeight:n.inputY.value,align:n._align,isUpdate:this.context.dialog.updateModal,alt:n._altText,element:n._element};if(typeof this.functions.onImageUploadBefore=="function"){const a=this.functions.onImageUploadBefore(i,o,this,(function(r){r&&this._w.Array.isArray(r.result)?this.plugins.image.register.call(this,o,r):this.plugins.image.upload.call(this,o,r)}).bind(this));if(typeof a>"u")return;if(!a){this.closeLoading();return}this._w.Array.isArray(a)&&a.length>0&&(i=a)}this.plugins.image.upload.call(this,o,i)},error:function(t,e){if(this.closeLoading(),typeof this.functions.onImageUploadError!="function"||this.functions.onImageUploadError(t,e,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.image.error] response: "+t)},upload:function(t,e){if(!e){this.closeLoading();return}if(typeof e=="string"){this.plugins.image.error.call(this,e,null);return}const i=this.options.imageUploadUrl,l=this.context.dialog.updateModal?1:e.length;if(typeof i=="string"&&i.length>0){const n=new FormData;for(let s=0;s'+t.icons.cancel+''+i.dialogBox.videoBox.title+'
    ';if(e.videoFileInput&&(n+='
    "),e.videoUrlInput&&(n+='
    '),e.videoResizing){const s=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],o=e.videoRatio,a=e.videoSizeOnlyPercentage,r=a?' style="display: none !important;"':"",c=e.videoHeightShow?"":' style="display: none !important;"',u=e.videoRatioShow?"":' style="display: none !important;"',f=!a&&!e.videoHeightShow&&!e.videoRatioShow?' style="display: none !important;"':"";n+='
    "}return n+='
    ",l.innerHTML=n,l},_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(t,e){this.value="",t&&(t.removeAttribute("disabled"),e.style.textDecoration="")},_onLinkPreview:function(t,e,i){const l=i.target.value.trim();/^$/.test(l)?(t._linkValue=l,this.textContent=''):t._linkValue=this.textContent=l?e&&l.indexOf("://")===-1&&l.indexOf("#")!==0?e+l:l.indexOf("://")===-1?"/"+l:l:""},_setTagAttrs:function(t){t.setAttribute("controls",!0);const e=this.options.videoTagAttrs;if(e)for(let i in e)this.util.hasOwn(e,i)&&t.setAttribute(i,e[i])},createVideoTag:function(){const t=this.util.createElement("VIDEO");return this.plugins.video._setTagAttrs.call(this,t),t},_setIframeAttrs:function(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.options.videoIframeAttrs;if(e)for(let i in e)this.util.hasOwn(e,i)&&t.setAttribute(i,e[i])},createIframeTag:function(){const t=this.util.createElement("IFRAME");return this.plugins.video._setIframeAttrs.call(this,t),t},fileTags:["iframe","video"],select:function(t){this.plugins.video.onModifyMode.call(this,t,this.plugins.resizing.call_controller_resize.call(this,t,"video"))},destroy:function(t){const e=t||this.context.video._element,i=this.context.video._container,l=e.getAttribute("data-index")*1;if(typeof this.functions.onVideoDeleteBefore=="function"&&this.functions.onVideoDeleteBefore(e,i,l,this)===!1)return;let n=i.previousElementSibling||i.nextElementSibling;const s=i.parentNode;this.util.removeItem(i),this.plugins.video.init.call(this),this.controllersOff(),s!==this.context.element.wysiwyg&&this.util.removeItemAllParents(s,function(o){return o.childNodes.length===0},null),this.focusEdge(n),this.plugins.fileManager.deleteInfo.call(this,"video",l,this.functions.onVideoUpload),this.history.push(!1)},on:function(t){const e=this.context.video;t?e.videoInputFile&&this.options.videoMultipleFile&&e.videoInputFile.removeAttribute("multiple"):(e.inputX.value=e._origin_w=this.options.videoWidth===e._defaultSizeX?"":this.options.videoWidth,e.inputY.value=e._origin_h=this.options.videoHeight===e._defaultSizeY?"":this.options.videoHeight,e.proportion.disabled=!0,e.videoInputFile&&this.options.videoMultipleFile&&e.videoInputFile.setAttribute("multiple","multiple")),e._resizing&&this.plugins.video.setVideoRatioSelect.call(this,e._origin_h||e._defaultRatio)},open:function(){this.plugins.dialog.open.call(this,"video",this.currentControllerName==="video")},setVideoRatio:function(t){const e=this.context.video,i=t.target.options[t.target.selectedIndex].value;e._defaultSizeY=e._videoRatio=i?i*100+"%":e._defaultSizeY,e.inputY.placeholder=i?i*100+"%":"",e.inputY.value=""},setInputSize:function(t,e){if(e&&e.keyCode===32){e.preventDefault();return}const i=this.context.video;this.plugins.resizing._module_setInputSize.call(this,i,t),t==="y"&&this.plugins.video.setVideoRatioSelect.call(this,e.target.value||i._defaultRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},submit:function(t){const e=this.context.video,i=this.plugins.video;t.preventDefault(),t.stopPropagation(),e._align=e.modal.querySelector('input[name="suneditor_video_radio"]:checked').value;try{e.videoInputFile&&e.videoInputFile.files.length>0?(this.showLoading(),i.submitAction.call(this,this.context.video.videoInputFile.files)):e.videoUrlFile&&e._linkValue.length>0&&(this.showLoading(),i.setup_url.call(this,e._linkValue))}catch(l){throw this.closeLoading(),Error('[SUNEDITOR.video.submit.fail] cause : "'+l.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let e=0,i=[];for(let o=0,a=t.length;o0){let o=0;const a=this.context.video._infoList;for(let r=0,c=a.length;rl){this.closeLoading();const r="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+l/1e3+"KB";(typeof this.functions.onVideoUploadError!="function"||this.functions.onVideoUploadError(r,{limitSize:l,currentSize:o,uploadSize:e},this))&&this.functions.noticeOpen(r);return}}const n=this.context.video;n._uploadFileLength=i.length;const s={inputWidth:n.inputX.value,inputHeight:n.inputY.value,align:n._align,isUpdate:this.context.dialog.updateModal,element:n._element};if(typeof this.functions.onVideoUploadBefore=="function"){const o=this.functions.onVideoUploadBefore(i,s,this,(function(a){a&&this._w.Array.isArray(a.result)?this.plugins.video.register.call(this,s,a):this.plugins.video.upload.call(this,s,a)}).bind(this));if(typeof o>"u")return;if(!o){this.closeLoading();return}typeof o=="object"&&o.length>0&&(i=o)}this.plugins.video.upload.call(this,s,i)},error:function(t,e){if(this.closeLoading(),typeof this.functions.onVideoUploadError!="function"||this.functions.onVideoUploadError(t,e,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.video.error] response: "+t)},upload:function(t,e){if(!e){this.closeLoading();return}if(typeof e=="string"){this.plugins.video.error.call(this,e,null);return}const i=this.options.videoUploadUrl,l=this.context.dialog.updateModal?1:e.length;if(typeof i=="string"&&i.length>0){const n=new FormData;for(let s=0;s$/.test(t)&&(t=new this._w.DOMParser().parseFromString(t,"text/html").querySelector("iframe").src,t.length===0))return!1;if(/youtu\.?be/.test(t)){if(/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),e._youtubeQuery.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e._youtubeQuery+"&"+i[1]}else t+="?"+e._youtubeQuery}else if(/vimeo\.com/.test(t)&&(t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1),e._vimeoQuery.length>0))if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e._vimeoQuery+"&"+i[1]}else t+="?"+e._vimeoQuery;this.plugins.video.create_video.call(this,this.plugins.video[!/embed|iframe|player|\/e\/|\.php|\.html?/.test(t)&&!/vimeo\.com/.test(t)?"createVideoTag":"createIframeTag"].call(this),t,e.inputX.value,e.inputY.value,e._align,null,this.context.dialog.updateModal)}catch(e){throw Error('[SUNEDITOR.video.upload.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}},create_video:function(t,e,i,l,n,s,o){this.context.resizing._resize_plugin="video";const a=this.context.video;let r=null,c=null,u=!1;if(o){if(t=a._element,t.src!==e){u=!0;const _=/youtu\.?be/.test(e),g=/vimeo\.com/.test(e);if((_||g)&&!/^iframe$/i.test(t.nodeName)){const h=this.plugins.video.createIframeTag.call(this);h.src=e,t.parentNode.replaceChild(h,t),a._element=t=h}else if(!_&&!g&&!/^video$/i.test(t.nodeName)){const h=this.plugins.video.createVideoTag.call(this);h.src=e,t.parentNode.replaceChild(h,t),a._element=t=h}else t.src=e}c=a._container,r=this.util.getParentElement(t,"FIGURE")}else u=!0,t.src=e,a._element=t,r=this.plugins.component.set_cover.call(this,t),c=this.plugins.component.set_container.call(this,r,"se-video-container");a._cover=r,a._container=c;const f=this.plugins.resizing._module_getSizeX.call(this,a)!==(i||a._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,a)!==(l||a._videoRatio),p=!o||f;a._resizing&&(this.context.video._proportionChecked=a.proportion.checked,t.setAttribute("data-proportion",a._proportionChecked));let m=!1;p&&(m=this.plugins.video.applySize.call(this)),m&&n==="center"||this.plugins.video.setAlign.call(this,null,t,r,c);let d=!0;if(o)a._resizing&&this.context.resizing._rotateVertical&&p&&this.plugins.resizing.setTransformSize.call(this,t,null,null);else if(d=this.insertComponent(c,!1,!0,!this.options.mediaAutoSelect),!this.options.mediaAutoSelect){const _=this.appendFormatTag(c,null);_&&this.setRange(_,0,_,0)}d&&(u&&this.plugins.fileManager.setInfo.call(this,"video",t,this.functions.onVideoUpload,s,!0),o&&(this.selectComponent(t,"video"),this.history.push(!1))),this.context.resizing._resize_plugin=""},_update_videoCover:function(t){if(!t)return;const e=this.context.video;/^video$/i.test(t.nodeName)?this.plugins.video._setTagAttrs.call(this,t):this.plugins.video._setIframeAttrs.call(this,t);let i=this.util.isRangeFormatElement(t.parentNode)||this.util.isWysiwygDiv(t.parentNode)?t:this.util.getFormatElement(t)||t;const l=t;e._element=t=t.cloneNode(!0);const n=e._cover=this.plugins.component.set_cover.call(this,t),s=e._container=this.plugins.component.set_container.call(this,n,"se-video-container");try{const o=i.querySelector("figcaption");let a=null;o&&(a=this.util.createElement("DIV"),a.innerHTML=o.innerHTML,this.util.removeItem(o));const r=(t.getAttribute("data-size")||t.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,r[0]||l.style.width||l.width||"",r[1]||l.style.height||l.height||"");const c=this.util.getFormatElement(l);if(c&&(e._align=c.style.textAlign||c.style.float),this.plugins.video.setAlign.call(this,null,t,n,s),this.util.getParentElement(l,this.util.isNotCheckingNode))l.parentNode.replaceChild(s,l);else if(this.util.isListCell(i)){const u=this.util.getParentElement(l,function(f){return f.parentNode===i});i.insertBefore(s,u),this.util.removeItem(l),this.util.removeEmptyNode(u,null,!0)}else if(this.util.isFormatElement(i)){const u=this.util.getParentElement(l,function(f){return f.parentNode===i});i=this.util.splitElement(i,u),i.parentNode.insertBefore(s,i),this.util.removeItem(l),this.util.removeEmptyNode(i,null,!0),i.children.length===0&&(i.innerHTML=this.util.htmlRemoveWhiteSpace(i.innerHTML))}else i.parentNode.replaceChild(s,i);a&&i.parentNode.insertBefore(a,s.nextElementSibling)}catch(o){console.warn("[SUNEDITOR.video.error] Maybe the video tag is nested.",o)}this.plugins.fileManager.setInfo.call(this,"video",t,this.functions.onVideoUpload,null,!0),this.plugins.video.init.call(this)},onModifyMode:function(t,e){const i=this.context.video;i._element=t,i._cover=this.util.getParentElement(t,"FIGURE"),i._container=this.util.getParentElement(t,this.util.isMediaComponent),i._align=t.style.float||t.getAttribute("data-align")||"none",t.style.float="",e&&(i._element_w=e.w,i._element_h=e.h,i._element_t=e.t,i._element_l=e.l);let l=i._element.getAttribute("data-size")||i._element.getAttribute("data-origin"),n,s;l?(l=l.split(","),n=l[0],s=l[1]):e&&(n=e.w,s=e.h),i._origin_w=n||t.style.width||t.width||"",i._origin_h=s||t.style.height||t.height||""},openModify:function(t){const e=this.context.video;if(e.videoUrlFile&&(e._linkValue=e.preview.textContent=e.videoUrlFile.value=e._element.src||(e._element.querySelector("source")||"").src||""),(e.modal.querySelector('input[name="suneditor_video_radio"][value="'+e._align+'"]')||e.modal.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,e._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,e,this.plugins.video);const i=e._videoRatio=this.plugins.resizing._module_getSizeY.call(this,e);this.plugins.video.setVideoRatioSelect.call(this,i)||(e.inputY.value=e._onlyPercentage?this.util.getNumber(i,2):i)}t||this.plugins.dialog.open.call(this,"video",!0)},setVideoRatioSelect:function(t){let e=!1;const i=this.context.video,l=i.videoRatioOption.options;/%$/.test(t)||i._onlyPercentage?t=this.util.getNumber(t,2)/100+"":(!this.util.isNumber(t)||t*1>=1)&&(t=""),i.inputY.placeholder="";for(let n=0,s=l.length;n'+t.icons.cancel+''+i.dialogBox.audioBox.title+'
    ';return e.audioFileInput&&(n+='
    "),e.audioUrlInput&&(n+='
    '),n+='
    ",l.innerHTML=n,l},setController:function(t){const e=t.lang,i=t.icons,l=t.util.createElement("DIV");return l.className="se-controller se-controller-link",l.innerHTML='
    ",l},_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(t,e){this.value="",t&&(t.removeAttribute("disabled"),e.style.textDecoration="")},_createAudioTag:function(){const t=this.util.createElement("AUDIO");this.plugins.audio._setTagAttrs.call(this,t);const e=this.context.audio._origin_w,i=this.context.audio._origin_h;return t.setAttribute("origin-size",e+","+i),t.style.cssText=(e?"width:"+e+"; ":"")+(i?"height:"+i+";":""),t},_setTagAttrs:function(t){t.setAttribute("controls",!0);const e=this.options.audioTagAttrs;if(e)for(let i in e)this.util.hasOwn(e,i)&&t.setAttribute(i,e[i])},_onLinkPreview:function(t,e,i){const l=i.target.value.trim();t._linkValue=this.textContent=l?e&&l.indexOf("://")===-1&&l.indexOf("#")!==0?e+l:l.indexOf("://")===-1?"/"+l:l:""},fileTags:["audio"],select:function(t){this.plugins.audio.onModifyMode.call(this,t)},destroy:function(t){t=t||this.context.audio._element;const e=this.util.getParentElement(t,this.util.isComponent)||t,i=t.getAttribute("data-index")*1;if(typeof this.functions.onAudioDeleteBefore=="function"&&this.functions.onAudioDeleteBefore(t,e,i,this)===!1)return;const l=e.previousElementSibling||e.nextElementSibling,n=e.parentNode;this.util.removeItem(e),this.plugins.audio.init.call(this),this.controllersOff(),n!==this.context.element.wysiwyg&&this.util.removeItemAllParents(n,function(s){return s.childNodes.length===0},null),this.focusEdge(l),this.plugins.fileManager.deleteInfo.call(this,"audio",i,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(t){const e=this.context.audio;t?e._element?(this.context.dialog.updateModal=!0,e._linkValue=e.preview.textContent=e.audioUrlFile.value=e._element.src,e.audioInputFile&&this.options.audioMultipleFile&&e.audioInputFile.removeAttribute("multiple")):e.audioInputFile&&this.options.audioMultipleFile&&e.audioInputFile.removeAttribute("multiple"):(this.plugins.audio.init.call(this),e.audioInputFile&&this.options.audioMultipleFile&&e.audioInputFile.setAttribute("multiple","multiple"))},open:function(){this.plugins.dialog.open.call(this,"audio",this.currentControllerName==="audio")},submit:function(t){const e=this.context.audio;t.preventDefault(),t.stopPropagation();try{e.audioInputFile&&e.audioInputFile.files.length>0?(this.showLoading(),this.plugins.audio.submitAction.call(this,e.audioInputFile.files)):e.audioUrlFile&&e._linkValue.length>0&&(this.showLoading(),this.plugins.audio.setupUrl.call(this,e._linkValue))}catch(i){throw this.closeLoading(),Error('[SUNEDITOR.audio.submit.fail] cause : "'+i.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},submitAction:function(t){if(t.length===0)return;let e=0,i=[];for(let o=0,a=t.length;o0){let o=0;const a=this.context.audio._infoList;for(let r=0,c=a.length;rl){this.closeLoading();const r="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+l/1e3+"KB";(typeof this.functions.onAudioUploadError!="function"||this.functions.onAudioUploadError(r,{limitSize:l,currentSize:o,uploadSize:e},this))&&this.functions.noticeOpen(r);return}}const n=this.context.audio;n._uploadFileLength=i.length;const s={isUpdate:this.context.dialog.updateModal,element:n._element};if(typeof this.functions.onAudioUploadBefore=="function"){const o=this.functions.onAudioUploadBefore(i,s,this,(function(a){a&&this._w.Array.isArray(a.result)?this.plugins.audio.register.call(this,s,a):this.plugins.audio.upload.call(this,s,a)}).bind(this));if(typeof o>"u")return;if(!o){this.closeLoading();return}typeof o=="object"&&o.length>0&&(i=o)}this.plugins.audio.upload.call(this,s,i)},error:function(t,e){if(this.closeLoading(),typeof this.functions.onAudioUploadError!="function"||this.functions.onAudioUploadError(t,e,this))throw this.functions.noticeOpen(t),Error("[SUNEDITOR.plugin.audio.exception] response: "+t)},upload:function(t,e){if(!e){this.closeLoading();return}if(typeof e=="string"){this.plugins.audio.error.call(this,e,null);return}const i=this.options.audioUploadUrl,l=this.context.dialog.updateModal?1:e.length,n=new FormData;for(let s=0;s'+t.icons.cancel+''+e.dialogBox.mathBox.title+'

    ",t.context.math.defaultFontSize=n,i.innerHTML=s,i},setController_MathButton:function(t){const e=t.lang,i=t.util.createElement("DIV");return i.className="se-controller se-controller-link",i.innerHTML='
    ",i},open:function(){this.plugins.dialog.open.call(this,"math",this.currentControllerName==="math")},managedTags:function(){return{className:"katex",method:function(t){if(!t.getAttribute("data-exp")||!this.options.katex)return;const e=this._d.createRange().createContextualFragment(this.plugins.math._renderer.call(this,this.util.HTMLDecoder(t.getAttribute("data-exp"))));t.innerHTML=e.querySelector(".katex").innerHTML,t.setAttribute("contenteditable",!1)}}},_renderer:function(t){let e="";try{this.util.removeClass(this.context.math.focusElement,"se-error"),e=this.options.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0})}catch(i){this.util.addClass(this.context.math.focusElement,"se-error"),e='Katex syntax error. (Refer KaTeX)',console.warn("[SUNEDITOR.math.Katex.error] ",i)}return e},_renderMathExp:function(t,e){t.previewElement.innerHTML=this.plugins.math._renderer.call(this,e.target.value)},submit:function(t){this.showLoading(),t.preventDefault(),t.stopPropagation();const e=(function(){if(this.context.math.focusElement.value.trim().length===0)return!1;const i=this.context.math,l=i.focusElement.value,n=i.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(l)),n.setAttribute("data-font-size",i.fontSizeElement.value),n.style.fontSize=i.fontSizeElement.value,this.context.dialog.updateModal){const s=this.util.getParentElement(i._mathExp,".katex");s.parentNode.replaceChild(n,s),this.setRange(n,0,n,1)}else{const s=this.getSelectedElements();if(s.length>1){const a=this.util.createElement(s[0].nodeName);if(a.appendChild(n),!this.insertNode(a,null,!0))return!1}else if(!this.insertNode(n,null,!0))return!1;const o=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(o,n.nextSibling),this.setRange(n,0,n,1)}return i.focusElement.value="",i.fontSizeElement.value="1em",i.previewElement.style.fontSize="1em",i.previewElement.innerHTML="",!0}).bind(this);try{e()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch{this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(t){if(!t)this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();else if(t.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(t,0,t,1),this.plugins.math.call_controller.call(this,t)),!0;return!1},on:function(t){if(!t)this.plugins.math.init.call(this);else{const e=this.context.math;if(e._mathExp){const i=this.util.HTMLDecoder(e._mathExp.getAttribute("data-exp")),l=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=i,e.fontSizeElement.value=l,e.previewElement.innerHTML=this.plugins.math._renderer.call(this,i),e.previewElement.style.fontSize=l}}},call_controller:function(t){this.context.math._mathExp=t;const e=this.context.math.mathController;this.setControllerPosition(e,t,"bottom",{left:0,top:0}),this.controllersOn(e,t,"math")},onClick_mathController:function(t){t.stopPropagation();const e=t.target.getAttribute("data-command")||t.target.parentNode.getAttribute("data-command");e&&(t.preventDefault(),/update/.test(e)?(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 t=this.context.math;t.mathController.style.display="none",t._mathExp=null,t.focusElement.value="",t.previewElement.innerHTML=""}};var Nt={exports:{}};(function(t){(function(e,i){t.exports=e.document?i(e,!0):function(l){if(!l.document)throw new Error("SUNEDITOR_MODULES a window with a document");return i(l)}})(typeof window<"u"?window:T,function(e,i){const l={name:"fileBrowser",_xmlHttp:null,_loading:null,add:function(n){const s=n.context;s.fileBrowser={_closeSignal:!1,area:null,header:null,tagArea:null,body:null,list:null,tagElements:null,items:[],selectedTags:[],selectorHandler:null,contextPlugin:"",columnSize:4};let o=n.util.createElement("DIV");o.className="se-file-browser sun-editor-common";let a=n.util.createElement("DIV");a.className="se-file-browser-back";let r=n.util.createElement("DIV");r.className="se-file-browser-inner",r.innerHTML=this.set_browser(n),o.appendChild(a),o.appendChild(r),this._loading=o.querySelector(".se-loading-box"),s.fileBrowser.area=o,s.fileBrowser.header=r.querySelector(".se-file-browser-header"),s.fileBrowser.titleArea=r.querySelector(".se-file-browser-title"),s.fileBrowser.tagArea=r.querySelector(".se-file-browser-tags"),s.fileBrowser.body=r.querySelector(".se-file-browser-body"),s.fileBrowser.list=r.querySelector(".se-file-browser-list"),s.fileBrowser.tagArea.addEventListener("click",this.onClickTag.bind(n)),s.fileBrowser.list.addEventListener("click",this.onClickFile.bind(n)),r.addEventListener("mousedown",this._onMouseDown_browser.bind(n)),r.addEventListener("click",this._onClick_browser.bind(n)),s.element.relative.appendChild(o),o=null,a=null,r=null},set_browser:function(n){const s=n.lang;return'
    '},_onMouseDown_browser:function(n){/se-file-browser-inner/.test(n.target.className)?this.context.fileBrowser._closeSignal=!0:this.context.fileBrowser._closeSignal=!1},_onClick_browser:function(n){n.stopPropagation(),(/close/.test(n.target.getAttribute("data-command"))||this.context.fileBrowser._closeSignal)&&this.plugins.fileBrowser.close.call(this)},open:function(n,s){this.plugins.fileBrowser._bindClose&&(this._d.removeEventListener("keydown",this.plugins.fileBrowser._bindClose),this.plugins.fileBrowser._bindClose=null),this.plugins.fileBrowser._bindClose=(function(c){/27/.test(c.keyCode)&&this.plugins.fileBrowser.close.call(this)}).bind(this),this._d.addEventListener("keydown",this.plugins.fileBrowser._bindClose);const o=this.context.fileBrowser;o.contextPlugin=n,o.selectorHandler=s;const a=this.context[n],r=a.listClass;this.util.hasClass(o.list,r)||(o.list.className="se-file-browser-list "+r),this.options.popupDisplay==="full"?o.area.style.position="fixed":o.area.style.position="absolute",o.titleArea.textContent=a.title,o.area.style.display="block",this.plugins.fileBrowser._drawFileList.call(this,this.context[n].url,this.context[n].header)},_bindClose:null,close:function(){const n=this.plugins.fileBrowser;n._xmlHttp&&n._xmlHttp.abort(),n._bindClose&&(this._d.removeEventListener("keydown",n._bindClose),n._bindClose=null);const s=this.context.fileBrowser;s.area.style.display="none",s.selectorHandler=null,s.selectedTags=[],s.items=[],s.list.innerHTML=s.tagArea.innerHTML=s.titleArea.textContent="",typeof this.plugins[s.contextPlugin].init=="function"&&this.plugins[s.contextPlugin].init.call(this),s.contextPlugin=""},showBrowserLoading:function(){this._loading.style.display="block"},closeBrowserLoading:function(){this._loading.style.display="none"},_drawFileList:function(n,s){const o=this.plugins.fileBrowser,a=o._xmlHttp=this.util.getXMLHttpRequest();if(a.onreadystatechange=o._callBackGet.bind(this,a),a.open("get",n,!0),s!==null&&typeof s=="object"&&this._w.Object.keys(s).length>0)for(let r in s)a.setRequestHeader(r,s[r]);a.send(null),this.plugins.fileBrowser.showBrowserLoading()},_callBackGet:function(n){if(n.readyState===4){if(this.plugins.fileBrowser._xmlHttp=null,n.status===200)try{const s=JSON.parse(n.responseText);s.result.length>0?this.plugins.fileBrowser._drawListItem.call(this,s.result,!0):s.nullMessage&&(this.context.fileBrowser.list.innerHTML=s.nullMessage)}catch(s){throw Error('[SUNEDITOR.fileBrowser.drawList.fail] cause : "'+s.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(),n.status!==0){const s=n.responseText?JSON.parse(n.responseText):n,o="[SUNEDITOR.fileBrowser.get.serverException] status: "+n.status+", response: "+(s.errorMessage||n.responseText);throw Error(o)}}},_drawListItem:function(n,s){const o=this.context.fileBrowser,a=this.context[o.contextPlugin],r=[],c=n.length,u=a.columnSize||o.columnSize,f=u<=1?1:Math.round(c/u)||1,p=a.itemTemplateHandler;let m="",d='
    ',_=1;for(let g=0,h,b;g
    '),s&&b.length>0)for(let v=0,x=b.length,y;v'+y+"");d+="
    ",o.list.innerHTML=d,s&&(o.items=n,o.tagArea.innerHTML=m,o.tagElements=o.tagArea.querySelectorAll("A"))},onClickTag:function(n){const s=n.target;if(!this.util.isAnchor(s))return;const o=s.textContent,a=this.plugins.fileBrowser,r=this.context.fileBrowser,c=r.tagArea.querySelector('a[title="'+o+'"]'),u=r.selectedTags,f=u.indexOf(o);f>-1?(u.splice(f,1),this.util.removeClass(c,"on")):(u.push(o),this.util.addClass(c,"on")),a._drawListItem.call(this,u.length===0?r.items:r.items.filter(function(p){return p.tag.some(function(m){return u.indexOf(m)>-1})}),!1)},onClickFile:function(n){n.preventDefault(),n.stopPropagation();const s=this.context.fileBrowser,o=s.list;let a=n.target,r=null;if(a===o)return;for(;o!==a.parentNode&&(r=a.getAttribute("data-command"),!r);)a=a.parentNode;if(!r)return;(s.selectorHandler||this.context[s.contextPlugin].selectorHandler)(a,a.parentNode.querySelector(".__se__img_name").textContent),this.plugins.fileBrowser.close.call(this)}};return typeof i>"u"&&(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:l})),l})})(Nt);var Ht=Nt.exports;const qt=Y(Ht),Mt={name:"imageGallery",add:function(t){t.addModule([qt]);const e=t.context;e.imageGallery={title:t.lang.toolbar.imageGallery,url:t.options.imageGalleryUrl,header:t.options.imageGalleryHeader,listClass:"se-image-list",itemTemplateHandler:this.drawItems,selectorHandler:this.setImage.bind(t),columnSize:4}},open:function(t){this.plugins.fileBrowser.open.call(this,"imageGallery",t)},drawItems:function(t){const e=t.src.split("/").pop();return'
    '+(t.alt||e)+'
    '+(t.name||e)+"
    "},setImage:function(t,e){this.callPlugin("image",(function(){const i={name:e,size:0};this.plugins.image.create_image.call(this,t.getAttribute("data-value"),null,this.context.image._origin_w,this.context.image._origin_h,"none",i,t.alt)}).bind(this),null)}},Vt={blockquote:st,align:ot,font:at,fontSize:rt,fontColor:ut,hiliteColor:dt,horizontalRule:ht,list:ft,table:pt,formatBlock:gt,lineHeight:mt,template:_t,paragraphStyle:bt,textStyle:vt,link:wt,image:zt,video:Lt,audio:It,math:Bt,imageGallery:Mt},Wt=Object.freeze(Object.defineProperty({__proto__:null,align:ot,audio:It,blockquote:st,default:Vt,font:at,fontColor:ut,fontSize:rt,formatBlock:gt,hiliteColor:dt,horizontalRule:ht,image:zt,imageGallery:Mt,lineHeight:mt,link:wt,list:ft,math:Bt,paragraphStyle:bt,table:pt,template:_t,textStyle:vt,video:Lt},Symbol.toStringTag,{value:"Module"})),Yt=nt(Wt),Xt=nt(At);var Z={};Object.defineProperty(Z,"__esModule",{value:!0});var $t=function(t){switch(typeof t){case"object":return t;case"string":return Dt("suneditor/src/lang/".concat(t,".js"));default:return}};Z.default=$t;var P={};Object.defineProperty(P,"__esModule",{value:!0});P.uploadBeforeEvents=P.events=void 0;P.events=["onMouseDown","onScroll","onInput","onClick","onKeyUp","onKeyDown","onFocus","onImageUpload","onAudioUpload","onVideoUpload","onImageUploadError","onVideoUploadError","onAudioUploadError","onSave","onSetToolbarButtons","imageUploadHandler","toggleCodeView","toggleFullScreen","showInline","showController","onCopy","onCut","onDrop","onPaste"];P.uploadBeforeEvents=["onImageUploadBefore","onVideoUploadBefore","onAudioUploadBefore"];var W=T&&T.__assign||function(){return W=Object.assign||function(t){for(var e,i=1,l=arguments.length;i