]*>","gi")},createTagsBlacklist:function(n){return new RegExp("<\\/?\\b(?:\\b"+(n||"^").replace(/\|/g,"\\b|\\b")+"\\b)[^>]*>","gi")},_consistencyCheckOfHTML:function(n,l,g,C){const o=[],w=[],L=[],E=[],t=this.getListChildNodes(n,(function(a){if(a.nodeType!==1)return this.isList(a.parentElement)&&o.push(a),!1;if(g.test(a.nodeName)||!l.test(a.nodeName)&&a.childNodes.length===0&&this.isNotCheckingNode(a))return o.push(a),!1;const p=!this.getParentElement(a,this.isNotCheckingNode);if(!this.isTable(a)&&!this.isListCell(a)&&!this.isAnchor(a)&&(this.isFormatElement(a)||this.isRangeFormatElement(a)||this.isTextStyleElement(a))&&a.childNodes.length===0&&p)return w.push(a),!1;if(this.isList(a.parentNode)&&!this.isList(a)&&!this.isListCell(a))return L.push(a),!1;if(this.isCell(a)){const I=a.firstElementChild;if(!this.isFormatElement(I)&&!this.isRangeFormatElement(I)&&!this.isComponent(I))return E.push(a),!1}if(p&&a.className){const I=new this._w.Array(a.classList).map(C).join(" ").trim();I?a.className=I:a.removeAttribute("class")}return a.parentNode!==n&&p&&(this.isListCell(a)&&!this.isList(a.parentNode)||(this.isFormatElement(a)||this.isComponent(a))&&!this.isRangeFormatElement(a.parentNode)&&!this.getParentElement(a,this.isComponent))}).bind(this));for(let a=0,p=o.length;a=0;G--)I.insertBefore(F,K[G]);R.push(F)}else I.parentNode.insertBefore(F,I),R.push(I);for(let a=0,p=R.length,F;a
":F.innerHTML,F.innerHTML=I.outerHTML},_setDefaultOptionStyle:function(n,l){let g="";n.height&&(g+="height:"+n.height+";"),n.minHeight&&(g+="min-height:"+n.minHeight+";"),n.maxHeight&&(g+="max-height:"+n.maxHeight+";"),n.position&&(g+="position:"+n.position+";"),n.width&&(g+="width:"+n.width+";"),n.minWidth&&(g+="min-width:"+n.minWidth+";"),n.maxWidth&&(g+="max-width:"+n.maxWidth+";");let C="",o="",w="";l=g+l;const L=l.split(";");for(let E=0,t=L.length,R;E'+this._setIframeCssTags(l),n.contentDocument.body.className=l._editableClass,n.contentDocument.body.setAttribute("contenteditable",!0),n.contentDocument.body.setAttribute("autocorrect","off")},_setIframeCssTags:function(n){const l=n.iframeCSSFileName,g=this._w.RegExp;let C="";for(let o=0,w=l.length,L;o'}return C+(n.height==="auto"?``:"")}},j=me,be={init:function(n,l){typeof l!="object"&&(l={});const g=document;this._initOptions(n,l);const C=g.createElement("DIV");C.className="sun-editor"+(l.rtl?" se-rtl":""),n.id&&(C.id="suneditor_"+n.id);const o=g.createElement("DIV");o.className="se-container";const w=this._createToolBar(g,l.buttonList,l.plugins,l),L=w.element.cloneNode(!1);L.className+=" se-toolbar-shadow",w.element.style.visibility="hidden",w.pluginCallButtons.math&&this._checkKatexMath(l.katex);const E=g.createElement("DIV");E.className="se-arrow";const t=g.createElement("DIV");t.className="se-toolbar-sticky-dummy";const R=g.createElement("DIV");R.className="se-wrapper";const a=this._initElements(l,C,w.element,E),p=a.bottomBar,F=a.wysiwygFrame,I=a.placeholder;let K=a.codeView;const G=p.resizingBar,e=p.navigation,i=p.charWrapper,s=p.charCounter,r=g.createElement("DIV");r.className="se-loading-box sun-editor-common",r.innerHTML='';const c=g.createElement("DIV");c.className="se-line-breaker",c.innerHTML='";const d=g.createElement("DIV");d.className+="se-line-breaker-component";const f=d.cloneNode(!0);d.innerHTML=f.innerHTML=l.icons.line_break;const u=g.createElement("DIV");u.className="se-resizing-back";const m=g.createElement("INPUT");m.tabIndex=-1,m.style.cssText="position: fixed !important; top: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;";const h=l.toolbarContainer;h&&(h.appendChild(w.element),h.appendChild(L));const y=l.resizingBarContainer;return G&&y&&y.appendChild(G),R.appendChild(K),I&&R.appendChild(I),h||(o.appendChild(w.element),o.appendChild(L)),o.appendChild(t),o.appendChild(R),o.appendChild(u),o.appendChild(r),o.appendChild(c),o.appendChild(d),o.appendChild(f),o.appendChild(m),G&&!y&&o.appendChild(G),C.appendChild(o),K=this._checkCodeMirror(l,K),{constructed:{_top:C,_relative:o,_toolBar:w.element,_toolbarShadow:L,_menuTray:w._menuTray,_editorArea:R,_wysiwygArea:F,_codeArea:K,_placeholder:I,_resizingBar:G,_navigation:e,_charWrapper:i,_charCounter:s,_loading:r,_lineBreaker:c,_lineBreaker_t:d,_lineBreaker_b:f,_resizeBack:u,_stickyDummy:t,_arrow:E,_focusTemp:m},options:l,plugins:w.plugins,pluginCallButtons:w.pluginCallButtons,_responsiveButtons:w.responsiveButtons}},_checkCodeMirror:function(n,l){if(n.codeMirror){const g=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},n.codeMirror.options||{}].reduce(function(o,w){for(let L in w)j.hasOwn(w,L)&&(o[L]=w[L]);return o},{});n.height==="auto"&&(g.viewportMargin=1/0,g.height="auto");const C=n.codeMirror.src.fromTextArea(l,g);C.display.wrapper.style.cssText=l.style.cssText,n.codeMirrorEditor=C,l=C.display.wrapper,l.className+=" se-wrapper-code-mirror"}return l},_checkKatexMath:function(n){if(!n)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const l=[{throwOnError:!1},n.options||{}].reduce(function(g,C){for(let o in C)j.hasOwn(C,o)&&(g[o]=C[o]);return g},{});n.options=l},_setOptions:function(n,l,g){this._initOptions(l.element.originElement,n);const C=l.element,o=C.relative,w=C.editorArea,L=n.toolbarContainer&&n.toolbarContainer!==g.toolbarContainer,E=n.lang!==g.lang||n.buttonList!==g.buttonList||n.mode!==g.mode||L,t=this._createToolBar(document,E?n.buttonList:g.buttonList,n.plugins,n);t.pluginCallButtons.math&&this._checkKatexMath(n.katex);const R=document.createElement("DIV");R.className="se-arrow",E&&(t.element.style.visibility="hidden",L?(n.toolbarContainer.appendChild(t.element),C.toolbar.parentElement.removeChild(C.toolbar)):C.toolbar.parentElement.replaceChild(t.element,C.toolbar),C.toolbar=t.element,C._menuTray=t._menuTray,C._arrow=R);const a=this._initElements(n,C.topArea,E?t.element:C.toolbar,R),p=a.bottomBar,F=a.wysiwygFrame,I=a.placeholder;let K=a.codeView;return C.resizingBar&&j.removeItem(C.resizingBar),p.resizingBar&&(n.resizingBarContainer&&n.resizingBarContainer!==g.resizingBarContainer?n.resizingBarContainer.appendChild(p.resizingBar):o.appendChild(p.resizingBar)),w.innerHTML="",w.appendChild(K),I&&w.appendChild(I),K=this._checkCodeMirror(n,K),C.resizingBar=p.resizingBar,C.navigation=p.navigation,C.charWrapper=p.charWrapper,C.charCounter=p.charCounter,C.wysiwygFrame=F,C.code=K,C.placeholder=I,n.rtl?j.addClass(C.topArea,"se-rtl"):j.removeClass(C.topArea,"se-rtl"),{callButtons:t.pluginCallButtons,plugins:t.plugins,toolbar:t}},_initElements:function(n,l,g,C){l.style.cssText=n._editorStyles.top,/inline/i.test(n.mode)?(g.className+=" se-toolbar-inline",g.style.width=n.toolbarWidth):/balloon/i.test(n.mode)&&(g.className+=" se-toolbar-balloon",g.style.width=n.toolbarWidth,g.appendChild(C));const o=document.createElement(n.iframe?"IFRAME":"DIV");if(o.className="se-wrapper-inner se-wrapper-wysiwyg",n.iframe)o.allowFullscreen=!0,o.frameBorder=0,o.style.cssText=n._editorStyles.frame,o.className+=n.className;else{o.setAttribute("contenteditable",!0),o.setAttribute("autocorrect","off"),o.setAttribute("scrolling","auto");for(let p in n.iframeAttributes)o.setAttribute(p,n.iframeAttributes[p]);o.className+=" "+n._editableClass,o.style.cssText=n._editorStyles.frame+n._editorStyles.editor,o.className+=n.className}const w=document.createElement("TEXTAREA");w.className="se-wrapper-inner se-wrapper-code"+n.className,w.style.cssText=n._editorStyles.frame,w.style.display="none",n.height==="auto"&&(w.style.overflow="hidden");let L=null,E=null,t=null,R=null;if(n.resizingBar&&(L=document.createElement("DIV"),L.className="se-resizing-bar sun-editor-common",E=document.createElement("DIV"),E.className="se-navigation sun-editor-common",L.appendChild(E),n.charCounter)){if(t=document.createElement("DIV"),t.className="se-char-counter-wrapper",n.charCounterLabel){const p=document.createElement("SPAN");p.className="se-char-label",p.textContent=n.charCounterLabel,t.appendChild(p)}if(R=document.createElement("SPAN"),R.className="se-char-counter",R.textContent="0",t.appendChild(R),n.maxCharCount>0){const p=document.createElement("SPAN");p.textContent=" / "+n.maxCharCount,t.appendChild(p)}L.appendChild(t)}let a=null;return n.placeholder&&(a=document.createElement("SPAN"),a.className="se-placeholder",a.innerText=n.placeholder),{bottomBar:{resizingBar:L,navigation:E,charWrapper:t,charCounter:R},wysiwygFrame:o,codeView:w,placeholder:a}},_initOptions:function(n,l){const g={};if(l.plugins){const w=l.plugins,L=w.length?w:Object.keys(w).map(function(E){return w[E]});for(let E=0,t=L.length,R;E0?l.defaultTag:"p";const C=l.textTags=[{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",sub:"SUB",sup:"SUP"},l.textTags||{}].reduce(function(w,L){for(let E in L)w[E]=L[E];return w},{});l._textTagsMap={strong:C.bold.toLowerCase(),b:C.bold.toLowerCase(),u:C.underline.toLowerCase(),ins:C.underline.toLowerCase(),em:C.italic.toLowerCase(),i:C.italic.toLowerCase(),del:C.strike.toLowerCase(),strike:C.strike.toLowerCase(),s:C.strike.toLowerCase(),sub:C.sub.toLowerCase(),sup:C.sup.toLowerCase()},l._defaultCommand={bold:l.textTags.bold,underline:l.textTags.underline,italic:l.textTags.italic,strike:l.textTags.strike,subscript:l.textTags.sub,superscript:l.textTags.sup},l.__allowedScriptTag=l.__allowedScriptTag===!0;const o="br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary";l.tagsBlacklist=l.tagsBlacklist||"",l._defaultTagsWhitelist=(typeof l._defaultTagsWhitelist=="string"?l._defaultTagsWhitelist:o)+(l.__allowedScriptTag?"|script":""),l._editorTagsWhitelist=l.addTagsWhitelist==="*"?"*":this._setWhitelist(l._defaultTagsWhitelist+(typeof l.addTagsWhitelist=="string"&&l.addTagsWhitelist.length>0?"|"+l.addTagsWhitelist:""),l.tagsBlacklist),l.pasteTagsBlacklist=l.tagsBlacklist+(l.tagsBlacklist&&l.pasteTagsBlacklist?"|"+l.pasteTagsBlacklist:l.pasteTagsBlacklist||""),l.pasteTagsWhitelist=l.pasteTagsWhitelist==="*"?"*":this._setWhitelist(typeof l.pasteTagsWhitelist=="string"?l.pasteTagsWhitelist:l._editorTagsWhitelist,l.pasteTagsBlacklist),l.attributesWhitelist=!l.attributesWhitelist||typeof l.attributesWhitelist!="object"?null:l.attributesWhitelist,l.attributesBlacklist=!l.attributesBlacklist||typeof l.attributesBlacklist!="object"?null:l.attributesBlacklist,l.mode=l.mode||"classic",l.rtl=!!l.rtl,l.lineAttrReset=["id"].concat(l.lineAttrReset&&typeof l.lineAttrReset=="string"?l.lineAttrReset.toLowerCase().split("|"):[]),l._editableClass="sun-editor-editable"+(l.rtl?" se-rtl":""),l._printClass=typeof l._printClass=="string"?l._printClass:null,l.toolbarWidth=l.toolbarWidth?j.isNumber(l.toolbarWidth)?l.toolbarWidth+"px":l.toolbarWidth:"auto",l.toolbarContainer=typeof l.toolbarContainer=="string"?document.querySelector(l.toolbarContainer):l.toolbarContainer,l.stickyToolbar=/balloon/i.test(l.mode)||l.toolbarContainer?-1:l.stickyToolbar===void 0?0:/^\d+/.test(l.stickyToolbar)?j.getNumber(l.stickyToolbar,0):-1,l.hideToolbar=!!l.hideToolbar,l.fullScreenOffset=l.fullScreenOffset===void 0?0:/^\d+/.test(l.fullScreenOffset)?j.getNumber(l.fullScreenOffset,0):0,l.fullPage=!!l.fullPage,l.iframe=l.fullPage||!!l.iframe,l.iframeAttributes=l.iframeAttributes||{},l.iframeCSSFileName=l.iframe?typeof l.iframeCSSFileName=="string"?[l.iframeCSSFileName]:l.iframeCSSFileName||["suneditor"]:null,l.previewTemplate=typeof l.previewTemplate=="string"?l.previewTemplate:null,l.printTemplate=typeof l.printTemplate=="string"?l.printTemplate:null,l.codeMirror=l.codeMirror?l.codeMirror.src?l.codeMirror:{src:l.codeMirror}:null,l.katex=l.katex?l.katex.src?l.katex:{src:l.katex}:null,l.mathFontSize=l.mathFontSize?l.mathFontSize:[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],l.position=typeof l.position=="string"?l.position:null,l.display=l.display||(n.style.display==="none"||!n.style.display?"block":n.style.display),l.popupDisplay=l.popupDisplay||"full",l.resizingBar=l.resizingBar===void 0?!/inline|balloon/i.test(l.mode):l.resizingBar,l.showPathLabel=l.resizingBar?typeof l.showPathLabel=="boolean"?l.showPathLabel:!0:!1,l.resizeEnable=l.resizeEnable===void 0?!0:!!l.resizeEnable,l.resizingBarContainer=typeof l.resizingBarContainer=="string"?document.querySelector(l.resizingBarContainer):l.resizingBarContainer,l.charCounter=l.maxCharCount>0?!0:typeof l.charCounter=="boolean"?l.charCounter:!1,l.charCounterType=typeof l.charCounterType=="string"?l.charCounterType:"char",l.charCounterLabel=typeof l.charCounterLabel=="string"?l.charCounterLabel.trim():null,l.maxCharCount=j.isNumber(l.maxCharCount)&&l.maxCharCount>-1?l.maxCharCount*1:null,l.width=l.width?j.isNumber(l.width)?l.width+"px":l.width:n.clientWidth?n.clientWidth+"px":"100%",l.minWidth=(j.isNumber(l.minWidth)?l.minWidth+"px":l.minWidth)||"",l.maxWidth=(j.isNumber(l.maxWidth)?l.maxWidth+"px":l.maxWidth)||"",l.height=l.height?j.isNumber(l.height)?l.height+"px":l.height:n.clientHeight?n.clientHeight+"px":"auto",l.minHeight=(j.isNumber(l.minHeight)?l.minHeight+"px":l.minHeight)||"",l.maxHeight=(j.isNumber(l.maxHeight)?l.maxHeight+"px":l.maxHeight)||"",l.className=typeof l.className=="string"&&l.className.length>0?" "+l.className:"",l.defaultStyle=typeof l.defaultStyle=="string"?l.defaultStyle:"",l.font=l.font?l.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],l.fontSize=l.fontSize?l.fontSize:null,l.formats=l.formats?l.formats:null,l.colorList=l.colorList?l.colorList:null,l.lineHeights=l.lineHeights?l.lineHeights:null,l.paragraphStyles=l.paragraphStyles?l.paragraphStyles:null,l.textStyles=l.textStyles?l.textStyles:null,l.fontSizeUnit=typeof l.fontSizeUnit=="string"&&l.fontSizeUnit.trim().toLowerCase()||"px",l.alignItems=typeof l.alignItems=="object"?l.alignItems:l.rtl?["right","center","left","justify"]:["left","center","right","justify"],l.imageResizing=l.imageResizing===void 0?!0:l.imageResizing,l.imageHeightShow=l.imageHeightShow===void 0?!0:!!l.imageHeightShow,l.imageAlignShow=l.imageAlignShow===void 0?!0:!!l.imageAlignShow,l.imageWidth=l.imageWidth?j.isNumber(l.imageWidth)?l.imageWidth+"px":l.imageWidth:"auto",l.imageHeight=l.imageHeight?j.isNumber(l.imageHeight)?l.imageHeight+"px":l.imageHeight:"auto",l.imageSizeOnlyPercentage=!!l.imageSizeOnlyPercentage,l._imageSizeUnit=l.imageSizeOnlyPercentage?"%":"px",l.imageRotation=l.imageRotation!==void 0?l.imageRotation:!(l.imageSizeOnlyPercentage||!l.imageHeightShow),l.imageFileInput=l.imageFileInput===void 0?!0:l.imageFileInput,l.imageUrlInput=l.imageUrlInput===void 0||!l.imageFileInput?!0:l.imageUrlInput,l.imageUploadHeader=l.imageUploadHeader||null,l.imageUploadUrl=typeof l.imageUploadUrl=="string"?l.imageUploadUrl:null,l.imageUploadSizeLimit=/\d+/.test(l.imageUploadSizeLimit)?j.getNumber(l.imageUploadSizeLimit,0):null,l.imageMultipleFile=!!l.imageMultipleFile,l.imageAccept=typeof l.imageAccept!="string"||l.imageAccept.trim()==="*"?"image/*":l.imageAccept.trim()||"image/*",l.imageGalleryUrl=typeof l.imageGalleryUrl=="string"?l.imageGalleryUrl:null,l.imageGalleryHeader=l.imageGalleryHeader||null,l.videoResizing=l.videoResizing===void 0?!0:l.videoResizing,l.videoHeightShow=l.videoHeightShow===void 0?!0:!!l.videoHeightShow,l.videoAlignShow=l.videoAlignShow===void 0?!0:!!l.videoAlignShow,l.videoRatioShow=l.videoRatioShow===void 0?!0:!!l.videoRatioShow,l.videoWidth=!l.videoWidth||!j.getNumber(l.videoWidth,0)?"":j.isNumber(l.videoWidth)?l.videoWidth+"px":l.videoWidth,l.videoHeight=!l.videoHeight||!j.getNumber(l.videoHeight,0)?"":j.isNumber(l.videoHeight)?l.videoHeight+"px":l.videoHeight,l.videoSizeOnlyPercentage=!!l.videoSizeOnlyPercentage,l._videoSizeUnit=l.videoSizeOnlyPercentage?"%":"px",l.videoRotation=l.videoRotation!==void 0?l.videoRotation:!(l.videoSizeOnlyPercentage||!l.videoHeightShow),l.videoRatio=j.getNumber(l.videoRatio,4)||.5625,l.videoRatioList=l.videoRatioList?l.videoRatioList:null,l.youtubeQuery=(l.youtubeQuery||"").replace("?",""),l.vimeoQuery=(l.vimeoQuery||"").replace("?",""),l.videoFileInput=!!l.videoFileInput,l.videoUrlInput=l.videoUrlInput===void 0||!l.videoFileInput?!0:l.videoUrlInput,l.videoUploadHeader=l.videoUploadHeader||null,l.videoUploadUrl=typeof l.videoUploadUrl=="string"?l.videoUploadUrl:null,l.videoUploadSizeLimit=/\d+/.test(l.videoUploadSizeLimit)?j.getNumber(l.videoUploadSizeLimit,0):null,l.videoMultipleFile=!!l.videoMultipleFile,l.videoTagAttrs=l.videoTagAttrs||null,l.videoIframeAttrs=l.videoIframeAttrs||null,l.videoAccept=typeof l.videoAccept!="string"||l.videoAccept.trim()==="*"?"video/*":l.videoAccept.trim()||"video/*",l.audioWidth=l.audioWidth?j.isNumber(l.audioWidth)?l.audioWidth+"px":l.audioWidth:"",l.audioHeight=l.audioHeight?j.isNumber(l.audioHeight)?l.audioHeight+"px":l.audioHeight:"",l.audioFileInput=!!l.audioFileInput,l.audioUrlInput=l.audioUrlInput===void 0||!l.audioFileInput?!0:l.audioUrlInput,l.audioUploadHeader=l.audioUploadHeader||null,l.audioUploadUrl=typeof l.audioUploadUrl=="string"?l.audioUploadUrl:null,l.audioUploadSizeLimit=/\d+/.test(l.audioUploadSizeLimit)?j.getNumber(l.audioUploadSizeLimit,0):null,l.audioMultipleFile=!!l.audioMultipleFile,l.audioTagAttrs=l.audioTagAttrs||null,l.audioAccept=typeof l.audioAccept!="string"||l.audioAccept.trim()==="*"?"audio/*":l.audioAccept.trim()||"audio/*",l.tableCellControllerPosition=typeof l.tableCellControllerPosition=="string"?l.tableCellControllerPosition.toLowerCase():"cell",l.linkTargetNewWindow=!!l.linkTargetNewWindow,l.linkProtocol=typeof l.linkProtocol=="string"?l.linkProtocol:null,l.linkRel=Array.isArray(l.linkRel)?l.linkRel:[],l.linkRelDefault=l.linkRelDefault||{},l.tabDisable=!!l.tabDisable,l.shortcutsDisable=Array.isArray(l.shortcutsDisable)?l.shortcutsDisable:[],l.shortcutsHint=l.shortcutsHint===void 0?!0:!!l.shortcutsHint,l.callBackSave=l.callBackSave?l.callBackSave:null,l.templates=l.templates?l.templates:null,l.placeholder=typeof l.placeholder=="string"?l.placeholder:null,l.mediaAutoSelect=l.mediaAutoSelect===void 0?!0:!!l.mediaAutoSelect,l.buttonList=l.buttonList?l.buttonList:[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],l.rtl&&(l.buttonList=l.buttonList.reverse()),l.icons=!l.icons||typeof l.icons!="object"?we:[we,l.icons].reduce(function(w,L){for(let E in L)j.hasOwn(L,E)&&(w[E]=L[E]);return w},{}),l.icons=l.rtl?[l.icons,l.icons.rtl].reduce(function(w,L){for(let E in L)j.hasOwn(L,E)&&(w[E]=L[E]);return w},{}):l.icons,l.__listCommonStyle=l.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"],l._editorStyles=j._setDefaultOptionStyle(l,l.defaultStyle)},_setWhitelist:function(n,l){if(typeof l!="string")return n;l=l.split("|"),n=n.split("|");for(let g=0,C=l.length,o;g-1&&n.splice(o,1);return n.join("|")},_defaultButtons:function(n){const l=n.icons,g=n.lang,C=j.isOSX_IOS?"⌘":"CTRL",o=j.isOSX_IOS?"⇧":"+SHIFT",w=n.shortcutsHint?n.shortcutsDisable:["bold","strike","underline","italic","undo","indent","save"],L=n.rtl?["[","]"]:["]","["],E=n.rtl?[l.outdent,l.indent]:[l.indent,l.outdent];return{bold:["",g.toolbar.bold+''+(w.indexOf("bold")>-1?"":C+'+B')+"","bold","",l.bold],underline:["",g.toolbar.underline+''+(w.indexOf("underline")>-1?"":C+'+U')+"","underline","",l.underline],italic:["",g.toolbar.italic+''+(w.indexOf("italic")>-1?"":C+'+I')+"","italic","",l.italic],strike:["",g.toolbar.strike+''+(w.indexOf("strike")>-1?"":C+o+'+S')+"","strike","",l.strike],subscript:["",g.toolbar.subscript,"SUB","",l.subscript],superscript:["",g.toolbar.superscript,"SUP","",l.superscript],removeFormat:["",g.toolbar.removeFormat,"removeFormat","",l.erase],indent:["",g.toolbar.indent+''+(w.indexOf("indent")>-1?"":C+'+'+L[0]+"")+"","indent","",E[0]],outdent:["",g.toolbar.outdent+''+(w.indexOf("indent")>-1?"":C+'+'+L[1]+"")+"","outdent","",E[1]],fullScreen:["se-code-view-enabled se-resizing-enabled",g.toolbar.fullScreen,"fullScreen","",l.expansion],showBlocks:["",g.toolbar.showBlocks,"showBlocks","",l.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled",g.toolbar.codeView,"codeView","",l.code_view],undo:["",g.toolbar.undo+''+(w.indexOf("undo")>-1?"":C+'+Z')+"","undo","",l.undo],redo:["",g.toolbar.redo+''+(w.indexOf("undo")>-1?"":C+'+Y / '+C+o+'+Z')+"","redo","",l.redo],preview:["se-resizing-enabled",g.toolbar.preview,"preview","",l.preview],print:["se-resizing-enabled",g.toolbar.print,"print","",l.print],dir:["",g.toolbar[n.rtl?"dir_ltr":"dir_rtl"],"dir","",l[n.rtl?"dir_ltr":"dir_rtl"]],dir_ltr:["",g.toolbar.dir_ltr,"dir_ltr","",l.dir_ltr],dir_rtl:["",g.toolbar.dir_rtl,"dir_rtl","",l.dir_rtl],save:["se-resizing-enabled",g.toolbar.save+''+(w.indexOf("save")>-1?"":C+'+S')+"","save","",l.save],blockquote:["",g.toolbar.tag_blockquote,"blockquote","command",l.blockquote],font:["se-btn-select se-btn-tool-font",g.toolbar.font,"font","submenu",''+g.toolbar.font+""+l.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",g.toolbar.formats,"formatBlock","submenu",''+g.toolbar.formats+""+l.arrow_down],fontSize:["se-btn-select se-btn-tool-size",g.toolbar.fontSize,"fontSize","submenu",''+g.toolbar.fontSize+""+l.arrow_down],fontColor:["",g.toolbar.fontColor,"fontColor","submenu",l.font_color],hiliteColor:["",g.toolbar.hiliteColor,"hiliteColor","submenu",l.highlight_color],align:["se-btn-align",g.toolbar.align,"align","submenu",n.rtl?l.align_right:l.align_left],list:["",g.toolbar.list,"list","submenu",l.list_number],horizontalRule:["btn_line",g.toolbar.horizontalRule,"horizontalRule","submenu",l.horizontal_rule],table:["",g.toolbar.table,"table","submenu",l.table],lineHeight:["",g.toolbar.lineHeight,"lineHeight","submenu",l.line_height],template:["",g.toolbar.template,"template","submenu",l.template],paragraphStyle:["",g.toolbar.paragraphStyle,"paragraphStyle","submenu",l.paragraph_style],textStyle:["",g.toolbar.textStyle,"textStyle","submenu",l.text_style],link:["",g.toolbar.link,"link","dialog",l.link],image:["",g.toolbar.image,"image","dialog",l.image],video:["",g.toolbar.video,"video","dialog",l.video],audio:["",g.toolbar.audio,"audio","dialog",l.audio],math:["",g.toolbar.math,"math","dialog",l.math],imageGallery:["",g.toolbar.imageGallery,"imageGallery","fileBrowser",l.image_gallery]}},_createModuleGroup:function(){const n=j.createElement("DIV");n.className="se-btn-module se-btn-module-border";const l=j.createElement("UL");return l.className="se-menu-list",n.appendChild(l),{div:n,ul:l}},_createButton:function(n,l,g,C,o,w,L){const E=j.createElement("LI"),t=j.createElement("BUTTON"),R=l||g;return t.setAttribute("type","button"),t.setAttribute("class","se-btn"+(n?" "+n:"")+" se-tooltip"),t.setAttribute("data-command",g),t.setAttribute("data-display",C),t.setAttribute("aria-label",R.replace(//,"")),t.setAttribute("tabindex","-1"),o||(o='!'),/^default\./i.test(o)&&(o=L[o.replace(/^default\./i,"")]),/^text\./i.test(o)&&(o=o.replace(/^text\./i,""),t.className+=" se-btn-more-text"),o+=''+R+"",w&&t.setAttribute("disabled",!0),t.innerHTML=o,E.appendChild(t),{li:E,button:t}},_createToolBar:function(n,l,g,C){const o=n.createElement("DIV");o.className="se-toolbar-separator-vertical";const w=n.createElement("DIV");w.className="se-toolbar sun-editor-common";const L=n.createElement("DIV");L.className="se-btn-tray",w.appendChild(L),l=JSON.parse(JSON.stringify(l));const E=C.icons,t=this._defaultButtons(C),R={},a=[];let p=null,F=null,I=null,K=null,G="",e=!1;const i=j.createElement("DIV");i.className="se-toolbar-more-layer";e:for(let c=0,d,f,u,m,h;c",i.appendChild(f),f=f.firstElementChild.firstElementChild)}if(e){const y=o.cloneNode(!1);L.appendChild(y)}L.appendChild(I.div),e=!0}else if(/^\/$/.test(m)){const y=n.createElement("DIV");y.className="se-btn-module-enter",L.appendChild(y),e=!1}switch(L.children.length){case 0:L.style.display="none";break;case 1:j.removeClass(L.firstElementChild,"se-btn-module-border");break;default:if(C.rtl){const c=o.cloneNode(!1);c.style.float=L.lastElementChild.style.float,L.appendChild(c)}}a.length>0&&a.unshift(l),i.children.length>0&&L.appendChild(i);const s=n.createElement("DIV");s.className="se-menu-tray",w.appendChild(s);const r=n.createElement("DIV");return r.className="se-toolbar-cover",w.appendChild(r),C.hideToolbar&&(w.style.display="none"),{element:w,plugins:g,pluginCallButtons:R,responsiveButtons:a,_menuTray:s,_buttonTray:L}}},Be=function(n,l,g){return{element:{originElement:n,topArea:l._top,relative:l._relative,toolbar:l._toolBar,_toolbarShadow:l._toolbarShadow,_buttonTray:l._toolBar.querySelector(".se-btn-tray"),_menuTray:l._menuTray,resizingBar:l._resizingBar,navigation:l._navigation,charWrapper:l._charWrapper,charCounter:l._charCounter,editorArea:l._editorArea,wysiwygFrame:l._wysiwygArea,wysiwyg:l._wysiwygArea,code:l._codeArea,placeholder:l._placeholder,loading:l._loading,lineBreaker:l._lineBreaker,lineBreaker_t:l._lineBreaker_t,lineBreaker_b:l._lineBreaker_b,resizeBackground:l._resizeBack,_stickyDummy:l._stickyDummy,_arrow:l._arrow,_focusTemp:l._focusTemp},tool:{cover:l._toolBar.querySelector(".se-toolbar-cover"),bold:l._toolBar.querySelector('[data-command="bold"]'),underline:l._toolBar.querySelector('[data-command="underline"]'),italic:l._toolBar.querySelector('[data-command="italic"]'),strike:l._toolBar.querySelector('[data-command="strike"]'),sub:l._toolBar.querySelector('[data-command="SUB"]'),sup:l._toolBar.querySelector('[data-command="SUP"]'),undo:l._toolBar.querySelector('[data-command="undo"]'),redo:l._toolBar.querySelector('[data-command="redo"]'),save:l._toolBar.querySelector('[data-command="save"]'),outdent:l._toolBar.querySelector('[data-command="outdent"]'),indent:l._toolBar.querySelector('[data-command="indent"]'),fullScreen:l._toolBar.querySelector('[data-command="fullScreen"]'),showBlocks:l._toolBar.querySelector('[data-command="showBlocks"]'),codeView:l._toolBar.querySelector('[data-command="codeView"]'),dir:l._toolBar.querySelector('[data-command="dir"]'),dir_ltr:l._toolBar.querySelector('[data-command="dir_ltr"]'),dir_rtl:l._toolBar.querySelector('[data-command="dir_rtl"]')},options:g,option:g}},ve=Be;function ke(n,l){const g=n._w,C=n.util,o=n.options.historyStackDelayTime;let w=n.context.element,L=n.context.tool.undo,E=n.context.tool.redo,t=null,R=0,a=[];function p(){const I=a[R];w.wysiwyg.innerHTML=I.contents,n.setRange(C.getNodeFromPath(I.s.path,w.wysiwyg),I.s.offset,C.getNodeFromPath(I.e.path,w.wysiwyg),I.e.offset),n.focus(),a.length<=1?(L&&L.setAttribute("disabled",!0),E&&E.setAttribute("disabled",!0)):R===0?(L&&L.setAttribute("disabled",!0),E&&E.removeAttribute("disabled")):R===a.length-1?(L&&L.removeAttribute("disabled"),E&&E.setAttribute("disabled",!0)):(L&&L.removeAttribute("disabled"),E&&E.removeAttribute("disabled")),n.controllersOff(),n._checkComponents(),n._setCharCount(),n._resourcesStateChange(),l()}function F(){n._checkComponents();const I=w.wysiwyg.innerHTML;if(!I||a[R]&&I===a[R].contents)return;R++;const K=n._variable._range;a.length>R&&(a=a.slice(0,R),E&&E.setAttribute("disabled",!0)),K?a[R]={contents:I,s:{path:C.getNodePath(K.startContainer,null,null),offset:K.startOffset},e:{path:C.getNodePath(K.endContainer,null,null),offset:K.endOffset}}:a[R]={contents:I,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},R===1&&L&&L.removeAttribute("disabled"),n._setCharCount(),l()}return{stack:a,push:function(I){g.setTimeout(n._resourcesStateChange.bind(n));const K=typeof I=="number"?I>0?I:0:I?o:0;if((!K||t)&&(g.clearTimeout(t),!K)){F();return}t=g.setTimeout(function(){g.clearTimeout(t),t=null,F()},K)},undo:function(){R>0&&(R--,p())},redo:function(){a.length-1>R&&(R++,p())},go:function(I){R=I<0?a.length-1:I,p()},getCurrentIndex:function(){return R},reset:function(I){L&&L.setAttribute("disabled",!0),E&&E.setAttribute("disabled",!0),n._variable.isChanged=!1,n.context.tool.save&&n.context.tool.save.setAttribute("disabled",!0),a.splice(0),R=0,a[R]={contents:n.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},I||l()},_resetCachingButton:function(){w=n.context.element,L=n.context.tool.undo,E=n.context.tool.redo,R===0?(L&&L.setAttribute("disabled",!0),E&&R===a.length-1&&E.setAttribute("disabled",!0),n._variable.isChanged=!1,n.context.tool.save&&n.context.tool.save.setAttribute("disabled",!0)):R===a.length-1&&E&&E.setAttribute("disabled",!0)},_destroy:function(){t&&g.clearTimeout(t),a=null}}}const Te={name:"notice",add:function(n){const l=n.context;l.notice={};let g=n.util.createElement("DIV"),C=n.util.createElement("SPAN"),o=n.util.createElement("BUTTON");g.className="se-notice",o.className="close",o.setAttribute("aria-label","Close"),o.setAttribute("title",n.lang.dialogBox.close),o.innerHTML=n.icons.cancel,g.appendChild(C),g.appendChild(o),l.notice.modal=g,l.notice.message=C,o.addEventListener("click",this.onClick_cancel.bind(n)),l.element.editorArea.appendChild(g),g=null},onClick_cancel:function(n){n.preventDefault(),n.stopPropagation(),this.plugins.notice.close.call(this)},open:function(n){this.context.notice.message.textContent=n,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}};function He(n,l,g,C,o,w){const L=n.element.originElement.ownerDocument||document,E=L.defaultView||window,t=j,R=o.icons,a={_d:L,_w:E,_parser:new E.DOMParser,_prevRtl:o.rtl,_editorHeight:0,_editorHeightPadding:0,_listCamel:o.__listCommonStyle,_listKebab:t.camelToKebabCase(o.__listCommonStyle),__focusTemp:n.element._focusTemp,_wd:null,_ww:null,_shadowRoot:null,_shadowRootControllerEventTarget:null,util:t,functions:null,options:null,wwComputedStyle:null,notice:Te,icons:R,history:null,context:n,pluginCallButtons:l,plugins:g||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:C,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:[],resizingDisabledButtons:[],_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_htmlCheckBlacklistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,editorTagsBlacklistRegExp:null,pasteTagsWhitelistRegExp:null,pasteTagsBlacklistRegExp:null,hasFocus:!1,isDisabled:!1,isReadOnly:!1,_attributesWhitelistRegExp:null,_attributesWhitelistRegExp_all_data:null,_attributesBlacklistRegExp:null,_attributesTagsWhitelist:null,_attributesTagsBlacklist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:{},_commandMapStyles:{STRONG:["font-weight"],U:["text-decoration"],EM:["font-style"],DEL:["text-decoration"]},_styleCommandMap:null,_cleanStyleRegExp:{div:new E.RegExp("\\s*[^-a-zA-Z](.+)\\s*:[^;]+(?!;)*","ig"),span:new E.RegExp("\\s*[^-a-zA-Z](font-family|font-size|color|background-color)\\s*:[^;]+(?!;)*","ig"),format:new E.RegExp("\\s*[^-a-zA-Z](text-align|margin-left|margin-right|width|height|line-height)\\s*:[^;]+(?!;)*","ig"),fontSizeUnit:new E.RegExp("\\d+"+o.fontSizeUnit+"$","i")},_variable:{isChanged:!1,isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:2,minResizingSize:t.getNumber(n.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:n.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},_formatAttrsTemp:null,_saveButtonStates:function(){this.allCommandButtons||(this.allCommandButtons={});const e=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let i=0,s,r;ix?d-x:0,z=D>0?0:x-d;i.style.left=f-D+z+"px",c.left>p._getEditorOffsets(i).left&&(i.style.left="0px")}else{const x=r<=d?0:r-(f+d);x<0?i.style.left=f+x+"px":i.style.left=f+"px"}let u=0,m=e;for(;m&&m!==s;)u+=m.offsetTop,m=m.offsetParent;const h=u;this._isBalloon?u+=s.offsetTop+e.offsetHeight:u-=e.offsetHeight;const y=c.top,B=i.offsetHeight,b=this.getGlobalScrollOffset().top,S=E.innerHeight-(y-b+h+e.parentElement.offsetHeight);if(SS?(i.style.height=z+"px",x=-1*(z-h+3)):(i.style.height=S+"px",x=h+e.parentElement.offsetHeight),i.style.top=x+"px"}else i.style.top=h+e.parentElement.offsetHeight+"px";i.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e=0,i;e0){for(let s=0;s0){for(let s=0;sm?u-m:0,B=y>0?0:m-u;e.style.left=f-y+B+"px",y>0&&h&&(h.style.left=(u-14<10+y?u-14:10+y)+"px");const b=n.element.wysiwygFrame.offsetLeft-e.offsetLeft;b>0&&(e.style.left="0px",h&&(h.style.left=b+"px"))}else{e.style.left=f+"px";const y=n.element.wysiwygFrame.offsetWidth-(e.offsetLeft+u);y<0?(e.style.left=e.offsetLeft+y+"px",h&&(h.style.left=20-y+"px")):h&&(h.style.left="20px")}e.style.visibility=""},execCommand:function(e,i,s){this._wd.execCommand(e,i,e==="formatBlock"?"<"+s+">":s),this.history.push(!0)},nativeFocus:function(){this.__focus(),this._editorRange()},__focus:function(){const e=t.getParentElement(this.getSelectionNode(),"figcaption");e?e.focus():n.element.wysiwyg.focus()},focus:function(){if(n.element.wysiwygFrame.style.display!=="none"){if(o.iframe)this.nativeFocus();else try{const e=this.getRange();if(e.startContainer===e.endContainer&&t.isWysiwygDiv(e.startContainer)){const i=e.commonAncestorContainer.children[e.startOffset];if(!t.isFormatElement(i)&&!t.isComponent(i)){const s=t.createElement(o.defaultTag),r=t.createElement("BR");s.appendChild(r),n.element.wysiwyg.insertBefore(s,i),this.setRange(r,0,r,0);return}}this.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}catch{this.nativeFocus()}p._applyTagEffects(),this._isBalloon&&p._toggleToolbarBalloon()}},focusEdge:function(e){e||(e=n.element.wysiwyg.lastElementChild);const i=this.getFileComponent(e);i?this.selectComponent(i.target,i.pluginName):e?(e=t.getChildElement(e,function(s){return s.childNodes.length===0||s.nodeType===3},!0),e?this.setRange(e,e.textContent.length,e,e.textContent.length):this.nativeFocus()):this.focus()},blur:function(){o.iframe?n.element.wysiwygFrame.blur():n.element.wysiwyg.blur()},setRange:function(e,i,s,r){if(!e||!s)return;i>e.textContent.length&&(i=e.textContent.length),r>s.textContent.length&&(r=s.textContent.length),t.isFormatElement(e)&&(e=e.childNodes[i]||e.childNodes[i-1]||e,i=i>0?e.nodeType===1?1:e.textContent?e.textContent.length:0:0),t.isFormatElement(s)&&(s=s.childNodes[r]||s.childNodes[r-1]||s,r=r>0?s.nodeType===1?1:s.textContent?s.textContent.length:0:0);const c=this._wd.createRange();try{c.setStart(e,i),c.setEnd(s,r)}catch(f){console.warn("[SUNEDITOR.core.focus.error] "+f),this.nativeFocus();return}const d=this.getSelection();return d.removeAllRanges&&d.removeAllRanges(),d.addRange(c),this._rangeInfo(c,this.getSelection()),o.iframe&&this.__focus(),c},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.hasFocus&&this.getSelection().removeAllRanges(),this._setKeyEffect([])},getRange:function(){const e=this._variable._range||this._createDefaultRange(),i=this.getSelection();if(e.collapsed===i.isCollapsed||!n.element.wysiwyg.contains(i.focusNode))return e;if(i.rangeCount>0)return this._variable._range=i.getRangeAt(0),this._variable._range;{const s=i.anchorNode,r=i.focusNode,c=i.anchorOffset,d=i.focusOffset,f=t.compareElements(s,r),u=f.ancestor&&(f.result===0?c<=d:f.result>1);return this.setRange(u?s:r,u?c:d,u?r:s,u?d:c)}},getRange_addLine:function(e,i){if(this._selectionVoid(e)){const s=n.element.wysiwyg,r=t.createElement(o.defaultTag);r.innerHTML="
",s.insertBefore(r,i&&i!==s?i.nextElementSibling:s.firstElementChild),this.setRange(r.firstElementChild,0,r.firstElementChild,1),e=this._variable._range}return e},getSelection:function(){const e=this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection();return!this._variable._range&&!n.element.wysiwyg.contains(e.focusNode)&&(e.removeAllRanges(),e.addRange(this._createDefaultRange())),e},getSelectionNode:function(){if(n.element.wysiwyg.contains(this._variable._selectionNode)||this._editorRange(),!this._variable._selectionNode){const e=t.getChildElement(n.element.wysiwyg.firstChild,function(i){return i.childNodes.length===0||i.nodeType===3},!1);if(!e)this._editorRange();else return this._variable._selectionNode=e,e}return this._variable._selectionNode},_editorRange:function(){const e=this._wd.activeElement;if(t.isInputElement(e))return this._variable._selectionNode=e,e;const i=this.getSelection();if(!i)return null;let s=null;i.rangeCount>0?s=i.getRangeAt(0):s=this._createDefaultRange(),this._rangeInfo(s,i)},_rangeInfo:function(e,i){let s=null;this._variable._range=e,e.collapsed?t.isWysiwygDiv(e.commonAncestorContainer)?s=e.commonAncestorContainer.children[e.startOffset]||e.commonAncestorContainer:s=e.commonAncestorContainer:s=i.extentNode||i.anchorNode,this._variable._selectionNode=s},_createDefaultRange:function(){const e=n.element.wysiwyg,i=this._wd.createRange();let s=e.firstElementChild,r=null;return s?(r=s.firstChild,r||(r=t.createElement("BR"),s.appendChild(r))):(s=t.createElement(o.defaultTag),r=t.createElement("BR"),s.appendChild(r),e.appendChild(s)),i.setStart(r,0),i.setEnd(r,0),i},_selectionVoid:function(e){const i=e.commonAncestorContainer;return t.isWysiwygDiv(e.startContainer)&&t.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(i.nodeName)||this._fileManager.regExp.test(i.nodeName)||t.isMediaComponent(i)},_resetRangeToTextNode:function(){const e=this.getRange();if(this._selectionVoid(e))return!1;let i=e.startContainer,s=e.startOffset,r=e.endContainer,c=e.endOffset,d,f,u;if(t.isFormatElement(i))for(i.childNodes[s]?(i=i.childNodes[s]||i,s=0):(i=i.lastChild||i,s=i.textContent.length);i&&i.nodeType===1&&i.firstChild;)i=i.firstChild||i,s=0;if(t.isFormatElement(r)){for(r=r.childNodes[c]||r.lastChild||r;r&&r.nodeType===1&&r.lastChild;)r=r.lastChild;c=r.textContent.length}if(d=t.isWysiwygDiv(i)?n.element.wysiwyg.firstChild:i,f=s,t.isBreak(d)||d.nodeType===1&&d.childNodes.length>0){const m=t.isBreak(d);if(!m){for(;d&&!t.isBreak(d)&&d.nodeType===1;)d=d.childNodes[f]||d.nextElementSibling||d.nextSibling,f=0;let h=t.getFormatElement(d,null);h===t.getRangeFormatElement(h,null)&&(h=t.createElement(t.getParentElement(d,t.isCell)?"DIV":o.defaultTag),d.parentNode.insertBefore(h,d),h.appendChild(d))}if(t.isBreak(d)){const h=t.createTextNode(t.zeroWidthSpace);d.parentNode.insertBefore(h,d),d=h,m&&i===r&&(r=d,c=1)}}if(i=d,s=f,d=t.isWysiwygDiv(r)?n.element.wysiwyg.lastChild:r,f=c,t.isBreak(d)||d.nodeType===1&&d.childNodes.length>0){const m=t.isBreak(d);if(!m){for(;d&&!t.isBreak(d)&&d.nodeType===1&&(u=d.childNodes,u.length!==0);)d=u[f>0?f-1:f]||!/FIGURE/i.test(u[0].nodeName)?u[0]:d.previousElementSibling||d.previousSibling||i,f=f>0?d.textContent.length:f;let h=t.getFormatElement(d,null);h===t.getRangeFormatElement(h,null)&&(h=t.createElement(t.isCell(h)?"DIV":o.defaultTag),d.parentNode.insertBefore(h,d),h.appendChild(d))}if(t.isBreak(d)){const h=t.createTextNode(t.zeroWidthSpace);d.parentNode.insertBefore(h,d),d=h,f=1,m&&!d.previousSibling&&t.removeItem(r)}}return r=d,c=f,this.setRange(i,s,r,c),!0},getSelectedElements:function(e){if(!this._resetRangeToTextNode())return[];let i=this.getRange();if(t.isWysiwygDiv(i.startContainer)){const x=n.element.wysiwyg.children;if(x.length===0)return[];this.setRange(x[0],0,x[x.length-1],x[x.length-1].textContent.trim().length),i=this.getRange()}const s=i.startContainer,r=i.endContainer,c=i.commonAncestorContainer,d=t.getListChildren(c,function(x){return e?e(x):t.isFormatElement(x)});if(!t.isWysiwygDiv(c)&&!t.isRangeFormatElement(c)&&d.unshift(t.getFormatElement(c,null)),s===r||d.length===1)return d;let f=t.getFormatElement(s,null),u=t.getFormatElement(r,null),m=null,h=null;const y=function(x){return t.isTable(x)?/^TABLE$/i.test(x.nodeName):!0};let B=t.getRangeFormatElement(f,y),b=t.getRangeFormatElement(u,y);t.isTable(B)&&t.isListCell(B.parentNode)&&(B=B.parentNode),t.isTable(b)&&t.isListCell(b.parentNode)&&(b=b.parentNode);const S=B===b;for(let x=0,D=d.length,z;x=0;f--)if(r[f].contains(r[c])){r.splice(c,1),c--,d--;break}}return r},isEdgePoint:function(e,i,s){return s!=="end"&&i===0||(!s||s!=="front")&&!e.nodeValue&&i===1||(!s||s==="end")&&!!e.nodeValue&&i===e.nodeValue.length},_isEdgeFormat:function(e,i,s){if(!this.isEdgePoint(e,i,s))return!1;const r=[];for(s=s==="front"?"previousSibling":"nextSibling";e&&!t.isFormatElement(e)&&!t.isWysiwygDiv(e);)if(!e[s]||t.isBreak(e[s])&&!e[s][s])e.nodeType===1&&r.push(e.cloneNode(!1)),e=e.parentNode;else return null;return r},showLoading:function(){n.element.loading.style.display="block"},closeLoading:function(){n.element.loading.style.display="none"},appendFormatTag:function(e,i){if(!e||!e.parentNode)return null;const s=t.getFormatElement(this.getSelectionNode(),null);let r=null;if(!t.isFormatElement(e)&&t.isFreeFormatElement(s||e.parentNode))r=t.createElement("BR");else{const c=i?typeof i=="string"?i:i.nodeName:t.isFormatElement(s)&&!t.isRangeFormatElement(s)&&!t.isFreeFormatElement(s)?s.nodeName:o.defaultTag;r=t.createElement(c),r.innerHTML="
",(i&&typeof i!="string"||!i&&t.isFormatElement(s))&&t.copyTagAttributes(r,i||s,["id"])}return t.isCell(e)?e.insertBefore(r,e.nextElementSibling):e.parentNode.insertBefore(r,e.nextElementSibling),r},insertComponent:function(e,i,s,r){if(this.isReadOnly||s&&!this.checkCharCount(e,null))return null;const c=this.removeNode();this.getRange_addLine(this.getRange(),c.container);let d=null,f=this.getSelectionNode(),u=t.getFormatElement(f,null);if(t.isListCell(u))this.insertNode(e,f===u?null:c.container.nextSibling,!1),e.nextSibling||e.parentNode.appendChild(t.createElement("BR"));else{if(this.getRange().collapsed&&(c.container.nodeType===3||t.isBreak(c.container))){const m=t.getParentElement(c.container,(function(h){return this.isRangeFormatElement(h)}).bind(t));d=t.splitElement(c.container,c.offset,m?t.getElementDepth(m)+1:0),d&&(u=d.previousSibling)}this.insertNode(e,t.isRangeFormatElement(u)?null:u,!1),u&&t.onlyZeroWidthSpace(u)&&t.removeItem(u)}if(!r){this.setRange(e,0,e,0);const m=this.getFileComponent(e);m?this.selectComponent(m.target,m.pluginName):d&&(d=t.getEdgeChildNodes(d,null).sc||d,this.setRange(d,0,d,0))}return i||this.history.push(1),d||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let i,s;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(i=e.querySelector(this._fileManager.queryString)),!i&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(i=e),i&&(s=this._fileManager.pluginMap[i.nodeName.toLowerCase()],s)?{target:i,component:t.getParentElement(i,t.isComponent),pluginName:s}:null},selectComponent:function(e,i){if(t.isUneditableComponent(t.getParentElement(e,t.isComponent))||t.isUneditableComponent(e))return!1;this.hasFocus||this.focus();const s=this.plugins[i];s&&E.setTimeout((function(){typeof s.select=="function"&&this.callPlugin(i,s.select.bind(this,e),null),this._setComponentLineBreaker(e)}).bind(this))},_setComponentLineBreaker:function(e){this._lineBreaker.style.display="none";const i=t.getParentElement(e,t.isComponent),s=n.element.lineBreaker_t.style,r=n.element.lineBreaker_b.style,c=this.context.resizing.resizeContainer.style.display==="block"?this.context.resizing.resizeContainer:e,d=t.isListCell(i.parentNode);let f,u,m;(d?!i.previousSibling:!t.isFormatElement(i.previousElementSibling))?(this._variable._lineBreakComp=i,u=n.element.wysiwyg.scrollTop,f=t.getOffset(e,n.element.wysiwygFrame).top+u,m=c.offsetWidth/2/2,s.top=f-u-12+"px",s.left=t.getOffset(c).left+m+"px",s.display="block"):s.display="none",(d?!i.nextSibling:!t.isFormatElement(i.nextElementSibling))?(f||(this._variable._lineBreakComp=i,u=n.element.wysiwyg.scrollTop,f=t.getOffset(e,n.element.wysiwygFrame).top+u,m=c.offsetWidth/2/2),r.top=f+c.offsetHeight-u-12+"px",r.left=t.getOffset(c).left+c.offsetWidth-m-24+"px",r.display="block"):r.display="none"},_checkDuplicateNode:function(e,i){(function s(r){a._dupleCheck(r,i);const c=r.childNodes;for(let d=0,f=c.length;d-1&&s.splice(y,1);for(let m=0,h=f.classList.length;mD?i=S.splitText(D):i=S.nextSibling;else if(t.isBreak(u))i=u,u=u.parentNode;else{let M=u.childNodes[x];const T=M&&M.nodeType===3&&t.onlyZeroWidthSpace(M)&&t.isBreak(M.nextSibling)?M.nextSibling:M;T?!T.nextSibling&&t.isBreak(T)?(u.removeChild(T),i=null):i=t.isBreak(T)&&!t.isBreak(e)?T:T.nextSibling:i=null}else if(O===H){this.isEdgePoint(H,D)?i=H.nextSibling:i=H.splitText(D);let T=O;this.isEdgePoint(O,x)||(T=O.splitText(x)),u.removeChild(T),u.childNodes.length===0&&b&&(u.innerHTML="
")}else{const T=this.removeNode(),k=T.container,_=T.prevContainer;if(k&&k.childNodes.length===0&&b&&(t.isFormatElement(k)?k.innerHTML="
":t.isRangeFormatElement(k)&&(k.innerHTML="<"+o.defaultTag+">
"+o.defaultTag+">")),t.isListCell(k)&&e.nodeType===3)u=k,i=null;else if(!b&&_)if(u=_.nodeType===3?_.parentNode:_,u.contains(k)){let A=!0;for(i=k;i.parentNode&&i.parentNode!==u;)i=i.parentNode,A=!1;A&&k===_&&(i=i.nextSibling)}else i=null;else t.isWysiwygDiv(k)&&!t.isFormatElement(e)?(u=k.appendChild(t.createElement(o.defaultTag)),i=null):(i=b?H:k===_?k.nextSibling:k,u=!i||!i.parentNode?S:i.parentNode);for(;i&&!t.isFormatElement(i)&&i.parentNode!==S;)i=i.parentNode}try{if(!f){if((t.isWysiwygDiv(i)||u===n.element.wysiwyg.parentNode)&&(u=n.element.wysiwyg,i=null),t.isFormatElement(e)||t.isRangeFormatElement(e)||!t.isListCell(u)&&t.isComponent(e)){const M=u;if(t.isList(i))u=i,i=null;else if(t.isListCell(i))u=i.previousElementSibling||i;else if(!m&&!i){const T=this.removeNode(),k=T.container.nodeType===3?t.isListCell(t.getFormatElement(T.container,null))?T.container:t.getFormatElement(T.container,null)||T.container.parentNode:T.container,_=t.isWysiwygDiv(k)||t.isRangeFormatElement(k);u=_?k:k.parentNode,i=_?null:k.nextSibling}M.childNodes.length===0&&u!==M&&t.removeItem(M)}if(b&&!B&&!t.isRangeFormatElement(u)&&!t.isListCell(u)&&!t.isWysiwygDiv(u)&&(i=u.nextElementSibling,u=u.parentNode),t.isWysiwygDiv(u)&&(e.nodeType===3||t.isBreak(e))){const M=t.createElement(o.defaultTag);M.appendChild(e),r=e,e=M}}if(f?y.parentNode?(u=y,i=h):(u=n.element.wysiwyg,i=null):i=u===i?u.lastChild:i,t.isListCell(e)&&!t.isList(u)){if(t.isListCell(u))i=u.nextElementSibling,u=u.parentNode;else{const M=t.createElement("ol");u.insertBefore(M,i),u=M,i=null}f=!0}if(this._checkDuplicateNode(e,u),u.insertBefore(e,i),f)if(t.onlyZeroWidthSpace(d.textContent.trim()))t.removeItem(d),e=e.lastChild;else{const M=t.getArrayItem(d.children,t.isList);M&&(e!==M?(e.appendChild(M),e=M.previousSibling):(u.appendChild(e),e=u),t.onlyZeroWidthSpace(d.textContent.trim())&&t.removeItem(d))}}catch(M){u.appendChild(e),console.warn("[SUNEDITOR.insertNode.warn] "+M)}finally{r&&(e=r);const M=u.querySelectorAll("[data-se-duple]");if(M.length>0)for(let T=0,k=M.length,_,A,v,N;T0&&z>-1&&O>-1){for(let T=z+1,k=m;T>=0;T--)D[T]===k.parentNode&&D[T].firstChild===k&&y===0&&(z=T,k=k.parentNode);for(let T=O-1,k=h;T>z;T--)D[T]===k.parentNode&&D[T].nodeType===1&&(D.splice(T,1),k=k.parentNode,--O)}else{if(D.length===0){if(t.isFormatElement(b)||t.isRangeFormatElement(b)||t.isWysiwygDiv(b)||t.isBreak(b)||t.isMedia(b))return{container:b,offset:0};if(b.nodeType===3)return{container:b,offset:B};D.push(b),m=h=b}else if(m=h=D[0],t.isBreak(m)||t.onlyZeroWidthSpace(m))return{container:t.isMedia(b)?b:m,offset:0};z=O=0}for(let T=z;T<=O;T++){const k=D[T];if(k.length===0||k.nodeType===3&&k.data===void 0){this._nodeRemoveListItem(k);continue}if(k===m){if(m.nodeType===1){if(t.isComponent(m))continue;S=t.createTextNode(m.textContent)}else k===h?(S=t.createTextNode(m.substringData(0,y)+h.substringData(B,h.length-B)),u=y):S=t.createTextNode(m.substringData(0,y));if(S.length>0?m.data=S.data:this._nodeRemoveListItem(m),k===h)break;continue}if(k===h){if(h.nodeType===1){if(t.isComponent(h))continue;x=t.createTextNode(h.textContent)}else x=t.createTextNode(h.substringData(B,h.length-B));x.length>0?h.data=x.data:this._nodeRemoveListItem(h);continue}this._nodeRemoveListItem(k)}const H=t.getParentElement(h,"ul"),M=t.getParentElement(m,"li");if(H&&M&&M.contains(H)?(f=H.previousSibling,u=f.textContent.length):(f=h&&h.parentNode?h:m&&m.parentNode?m:e.endContainer||e.startContainer,u=!i&&!s?u:s?f.textContent.length:0),!t.isWysiwygDiv(f)&&f.childNodes.length===0){const T=t.removeItemAllParents(f,null,null);T&&(f=T.sc||T.ec||n.element.wysiwyg)}return!t.getFormatElement(f)&&!(m&&m.parentNode)&&(d?(f=d,u=0):c&&(f=c,u=1)),this.setRange(f,u,f,u),this.history.push(!0),{container:f,offset:u,prevContainer:r}},_nodeRemoveListItem:function(e){const i=t.getFormatElement(e,null);t.removeItem(e),t.isListCell(i)&&(t.removeItemAllParents(i,null,null),i&&t.isList(i.firstChild)&&i.insertBefore(t.createTextNode(t.zeroWidthSpace),i.firstChild))},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange(),null);const i=this.getSelectedElementsAndComponents(!1);if(!i||i.length===0)return;e:for(let B=0,b=i.length,S,x,D,z,O,H;B-1&&(z=x.lastElementChild,i.indexOf(z)>-1))){let M=null;for(;M=z.lastElementChild;)if(t.isList(M))if(i.indexOf(M.lastElementChild)>-1)z=M.lastElementChild;else continue e;D=x.firstElementChild,O=i.indexOf(D),H=i.indexOf(z),i.splice(O,H-O+1),b=i.length;continue}let s=i[i.length-1],r,c,d;t.isRangeFormatElement(s)||t.isFormatElement(s)?r=s:r=t.getRangeFormatElement(s,null)||t.getFormatElement(s,null),t.isCell(r)?(c=null,d=r):(c=r.nextSibling,d=r.parentNode);let f=t.getElementDepth(r),u=null;const m=[],h=function(B,b,S){let x=null;if(B!==b&&!t.isTable(b)){if(b&&t.getElementDepth(B)===t.getElementDepth(b))return S;x=t.removeItemAllParents(b,null,B)}return x?x.ec:S};for(let B=0,b=i.length,S,x,D,z,O,H,M;B=D?(f=D,d=_.cc,c=h(d,x,_.ec),c&&(d=c.parentNode)):d===_.cc&&(c=_.ec),d!==_.cc&&(z=h(d,_.cc,z),z!==void 0?c=z:c=_.cc);for(let A=0,v=_.removeArray.length;A=D&&(f=D,d=x,c=S.nextSibling),e.appendChild(S),d!==x&&(z=h(d,x),z!==void 0&&(c=z));if(this.effectNode=null,t.mergeSameTags(e,null,!1),t.mergeNestedTags(e,(function(B){return this.isList(B)}).bind(t)),c&&t.getElementDepth(c)>0&&(t.isList(c.parentNode)||t.isList(c.parentNode.parentNode))){const B=t.getParentElement(c,(function(S){return this.isRangeFormatElement(S)&&!this.isList(S)}).bind(t)),b=t.splitElement(c,null,B?t.getElementDepth(B)+1:0);b.parentNode.insertBefore(e,b)}else d.insertBefore(e,c),h(e,c);const y=t.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);i.length>1?this.setRange(y.sc,0,y.ec,y.ec.textContent.length):this.setRange(y.ec,y.ec.textContent.length,y.ec,y.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,i,s,r,c){const d=this.getRange();let f=d.startOffset,u=d.endOffset,m=t.getListChildNodes(e,function(_){return _.parentNode===e}),h=e.parentNode,y=null,B=null,b=e.cloneNode(!1);const S=[],x=t.isList(s);let D=!1,z=!1,O=!1;function H(_,A,v,N){if(t.onlyZeroWidthSpace(A)&&(A.innerHTML=t.zeroWidthSpace,f=u=1),A.nodeType===3)return _.insertBefore(A,v),A;const P=(O?A:N).childNodes;let V=A.cloneNode(!1),U=null,Z=null;for(;P[0];)Z=P[0],t._notTextNode(Z)&&!t.isBreak(Z)&&!t.isListCell(V)?(V.childNodes.length>0&&(U||(U=V),_.insertBefore(V,v),V=A.cloneNode(!1)),_.insertBefore(Z,v),U||(U=Z)):V.appendChild(Z);if(V.childNodes.length>0){if(t.isListCell(_)&&t.isListCell(V)&&t.isList(v))if(x){for(U=v;v;)V.appendChild(v),v=v.nextSibling;_.parentNode.insertBefore(V,_.nextElementSibling)}else{const W=N.nextElementSibling,$=t.detachNestedList(N,!1);if(e!==$||W!==N.nextElementSibling){const q=V.childNodes;for(;q[0];)N.appendChild(q[0]);e=$,z=!0}}else _.insertBefore(V,v);U||(U=V)}return U}for(let _=0,A=m.length,v,N,P;_0&&(h.insertBefore(b,e),b=null),!x&&t.isListCell(v))if(P&&t.getElementDepth(v)!==t.getElementDepth(P)&&(t.isListCell(h)||t.getArrayItem(v.children,t.isList,!1))){const V=v.nextElementSibling,U=t.detachNestedList(v,!1);(e!==U||V!==v.nextElementSibling)&&(e=U,z=!0)}else{const V=v;v=t.createElement(r?V.nodeName:t.isList(e.parentNode)||t.isListCell(e.parentNode)?"LI":t.isCell(e.parentNode)?"DIV":o.defaultTag);const U=t.isListCell(v),Z=V.childNodes;for(;Z[0]&&!(t.isList(Z[0])&&!U);)v.appendChild(Z[0]);t.copyFormatAttributes(v,V),O=!0}else v=v.cloneNode(!1);if(!z&&(r?(S.push(v),t.removeItem(m[_])):(s?(D||(h.insertBefore(s,e),D=!0),v=H(s,v,null,m[_])):v=H(h,v,e,m[_]),z||(i?(B=v,y||(y=v)):y||(y=B=v))),z)){z=O=!1,m=t.getListChildNodes(e,function(V){return V.parentNode===e}),b=e.cloneNode(!1),h=e.parentNode,_=-1,A=m.length;continue}}const M=e.parentNode;let T=e.nextSibling;b&&b.children.length>0&&M.insertBefore(b,T),s?y=s.previousSibling:y||(y=e.previousSibling),T=e.nextSibling!==b?e.nextSibling:b?b.nextSibling:null,e.children.length===0||e.textContent.length===0?t.removeItem(e):t.removeEmptyNode(e,null,!1);let k=null;if(r)k={cc:M,sc:y,so:f,ec:T,eo:u,removeArray:S};else{y||(y=B),B||(B=y);const _=t.getEdgeChildNodes(y,B.parentNode?y:B);k={cc:(_.sc||_.ec).parentNode,sc:_.sc,so:f,ec:_.ec,eo:u,removeArray:null}}if(this.effectNode=null,c)return k;!r&&k&&(i?this.setRange(k.sc,f,k.ec,u):this.setRange(k.sc,0,k.sc,0)),this.history.push(!1)},detachList:function(e,i){let s={},r=!1,c=!1,d=null,f=null;const u=(function(m){return!this.isComponent(m)}).bind(t);for(let m=0,h=e.length,y,B,b,S;m0?i:!1,s=s&&s.length>0?s:!1;const d=!e,f=d&&!s&&!i;let u=c.startContainer,m=c.startOffset,h=c.endContainer,y=c.endOffset;if(f&&c.collapsed&&t.isFormatElement(u.parentNode)||u===h&&u.nodeType===1&&t.isNonEditable(u)){const Z=u.parentNode;if(!t.isListCell(Z)||!t.getValues(Z.style).some((function(W){return this._listKebab.indexOf(W)>-1}).bind(this)))return}if(c.collapsed&&!f&&u.nodeType===1&&!t.isBreak(u)&&!t.isComponent(u)){let Z=null;const W=u.childNodes[m];W&&(W.nextSibling?Z=t.isBreak(W)?W:W.nextSibling:Z=null);const $=t.createTextNode(t.zeroWidthSpace);u.insertBefore($,Z),this.setRange($,1,$,1),c=this.getRange(),u=c.startContainer,m=c.startOffset,h=c.endContainer,y=c.endOffset}t.isFormatElement(u)&&(u=u.childNodes[m]||u.firstChild,m=0),t.isFormatElement(h)&&(h=h.childNodes[y]||h.lastChild,y=h.textContent.length),d&&(e=t.createElement("DIV"));const B=E.RegExp,b=e.nodeName;if(!f&&u===h&&!s&&e){let Z=u,W=0;const $=[],q=e.style;for(let X=0,Q=q.length;X0){for(;!t.isFormatElement(Z)&&!t.isWysiwygDiv(Z);){for(let X=0;X<$.length;X++)if(Z.nodeType===1){const Q=$[X],ne=/^\./.test(Q)?new B("\\s*"+Q.replace(/^\./,"")+"(\\s+|$)","ig"):!1,fe=d?!!Z.style[Q]:!!Z.style[Q]&&!!e.style[Q]&&Z.style[Q]===e.style[Q],J=ne===!1?!1:d?!!Z.className.match(ne):!!Z.className.match(ne)&&!!e.className.match(ne);(fe||J)&&W++}Z=Z.parentNode}if(W>=$.length)return}}let S={},x={},D,z="",O="",H="";if(i){for(let Z=0,W=i.length,$;Z0&&(Y=q.replace(z,"").trim(),Y!==q&&(T.v=!0));const X=W.className;let Q="";return O&&X.length>0&&(Q=X.replace(O,"").trim(),Q!==X&&(T.v=!0)),d&&(O||!X)&&(z||!q)&&!Y&&!Q&&$?(T.v=!0,null):Y||Q||W.nodeName!==b||M(z)!==M(q)||M(O)!==M(X)?(z&&q.length>0&&(W.style.cssText=Y),W.style.cssText||W.removeAttribute("style"),O&&X.length>0&&(W.className=Q.trim()),W.className.trim()||W.removeAttribute("class"),!W.style.cssText&&!W.className&&(W.nodeName===b||$)?(T.v=!0,null):W):(T.v=!0,null)},_=this.getSelectedElements(null);c=this.getRange(),u=c.startContainer,m=c.startOffset,h=c.endContainer,y=c.endOffset,t.getFormatElement(u,null)||(u=t.getChildElement(_[0],function(Z){return Z.nodeType===3},!1),m=0),t.getFormatElement(h,null)||(h=t.getChildElement(_[_.length-1],function(Z){return Z.nodeType===3},!1),y=h.textContent.length);const A=t.getFormatElement(u,null)===t.getFormatElement(h,null),v=_.length-(A?0:1);D=e.cloneNode(!1);const N=f||d&&function(Z){for(let W=0,$=Z.length;W<$;W++)if(t._isMaintainedNode(Z[W])||t._isSizeNode(Z[W]))return!0;return!1}(s),P=d||t._isSizeNode(D),V=this._util_getMaintainedNode.bind(t,N,P),U=this._util_isMaintainedNode.bind(t,N,P);if(A){this._resetCommonListCell(_[0],i)&&(c=this.setRange(u,m,h,y));const Z=this._nodeChange_oneLine(_[0],D,k,u,m,h,y,f,d,c.collapsed,T,V,U);S.container=Z.startContainer,S.offset=Z.startOffset,x.container=Z.endContainer,x.offset=Z.endOffset,S.container===x.container&&t.onlyZeroWidthSpace(S.container)&&(S.offset=x.offset=1),this._setCommonListStyle(Z.ancestor,null)}else{let Z=!1;v>0&&this._resetCommonListCell(_[v],i)&&(Z=!0),this._resetCommonListCell(_[0],i)&&(Z=!0),Z&&this.setRange(u,m,h,y),v>0&&(D=e.cloneNode(!1),x=this._nodeChange_endLine(_[v],D,k,h,y,f,d,T,V,U));for(let W=v-1,$;W>0;W--)this._resetCommonListCell(_[W],i),D=e.cloneNode(!1),$=this._nodeChange_middleLine(_[W],D,k,f,d,T,x.container),$.endContainer&&$.ancestor.contains($.endContainer)&&(x.ancestor=null,x.container=$.endContainer),this._setCommonListStyle($.ancestor,null);D=e.cloneNode(!1),S=this._nodeChange_startLine(_[0],D,k,u,m,f,d,T,V,U,x.container),S.endContainer&&(x.ancestor=null,x.container=S.endContainer),v<=0?x=S:x.container||(x.ancestor=null,x.container=S.container,x.offset=S.container.textContent.length),this._setCommonListStyle(S.ancestor,null),this._setCommonListStyle(x.ancestor||t.getFormatElement(x.container),null)}this.controllersOff(),this.setRange(S.container,S.offset,x.container,x.offset),this.history.push(!1)},_resetCommonListCell:function(e,i){if(!t.isListCell(e))return;i||(i=this._listKebab);const s=t.getArrayItem(e.childNodes,function(B){return!t.isBreak(B)},!0),r=e.style,c=[],d=[],f=t.getValues(r);for(let B=0,b=this._listKebab.length;B-1&&i.indexOf(this._listKebab[B])>-1&&(c.push(this._listCamel[B]),d.push(this._listKebab[B]));if(!c.length)return;const u=t.createElement("SPAN");for(let B=0,b=c.length;B0&&(e.insertBefore(m,h),m=u.cloneNode(!1),h=null,y=!0));return m.childNodes.length>0&&(e.insertBefore(m,h),y=!0),r.length||e.removeAttribute("style"),y},_setCommonListStyle:function(e,i){if(!t.isListCell(e))return;const s=t.getArrayItem((i||e).childNodes,function(m){return!t.isBreak(m)},!0);if(i=s[0],!i||s.length>1||i.nodeType!==1)return;const r=i.style,c=e.style,d=i.nodeName.toLowerCase();let f=!1;o._textTagsMap[d]===o._defaultCommand.bold.toLowerCase()&&(c.fontWeight="bold"),o._textTagsMap[d]===o._defaultCommand.italic.toLowerCase()&&(c.fontStyle="italic");const u=t.getValues(r);if(u.length>0)for(let m=0,h=this._listCamel.length;m-1&&(c[this._listCamel[m]]=r[this._listCamel[m]],r.removeProperty(this._listKebab[m]),f=!0);if(this._setCommonListStyle(e,i),!!f&&!r.length){const m=i.childNodes,h=i.parentNode,y=i.nextSibling;for(;m.length>0;)h.insertBefore(m[0],y);t.removeItem(i)}},_stripRemoveNode:function(e){const i=e.parentNode;if(!e||e.nodeType===3||!i)return;const s=e.childNodes;for(;s[0];)i.insertBefore(s[0],e);i.removeChild(e)},_util_getMaintainedNode:function(e,i,s){return!s||e?null:this.getParentElement(s,this._isMaintainedNode.bind(this))||(i?null:this.getParentElement(s,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,i,s){if(!s||e||s.nodeType!==1)return!1;const r=this._isMaintainedNode(s);return this.getParentElement(s,this._isMaintainedNode.bind(this))?r:r||(i?!1:this._isSizeNode(s))},_nodeChange_oneLine:function(e,i,s,r,c,d,f,u,m,h,y,B,b){let S=r.parentNode;for(;!S.nextSibling&&!S.previousSibling&&!t.isFormatElement(S.parentNode)&&!t.isWysiwygDiv(S.parentNode)&&S.nodeName!==i.nodeName;)S=S.parentNode;if(!m&&S===d.parentNode&&S.nodeName===i.nodeName&&t.onlyZeroWidthSpace(r.textContent.slice(0,c))&&t.onlyZeroWidthSpace(d.textContent.slice(f))){const J=S.childNodes;let le=!0;for(let te=0,ue=J.length,oe,de,ae,ee;te0&&(te=le.test(J.style.cssText)),!te}if(function J(le,te){const ue=le.childNodes;for(let oe=0,de=ue.length,ae;oe=M?k-M:H.data.length-M));if(U){const ye=B(te);if(ye&&ye.parentNode!==ce){let he=ye,Ce=null;for(;he.parentNode!==ce;){for(te=Ce=he.parentNode.cloneNode(!1);he.childNodes[0];)Ce.appendChild(he.childNodes[0]);he.appendChild(Ce),he=he.parentNode}he.parentNode.appendChild(ye)}U=U.cloneNode(!1)}t.onlyZeroWidthSpace(ie)||te.appendChild(ie);const se=B(te);for(se&&(U=se),U&&(ce=U),N=ee,v=[],V="";N!==ce&&N!==x&&N!==null;)ae=b(N)?null:s(N),ae&&N.nodeType===1&&W(N)&&(v.push(ae),V+=N.style.cssText.substr(0,N.style.cssText.indexOf(":"))+"|"),N=N.parentNode;const pe=v.pop()||re;for(P=N=pe;v.length>0;)N=v.pop(),P.appendChild(N),P=N;if(i.appendChild(pe),ce.appendChild(i),U&&!B(T)&&(i=i.cloneNode(!1),z.appendChild(i),D.push(i)),H=re,M=0,_=!0,N!==re&&N.appendChild(H),!O)continue}if(!A&&ee===T){U=B(ee);const ce=t.createTextNode(T.nodeType===1?"":T.substringData(k,T.length-k)),ie=t.createTextNode(O||T.nodeType===1?"":T.substringData(0,k));if(U?U=U.cloneNode(!1):b(i.parentNode)&&!U&&(i=i.cloneNode(!1),z.appendChild(i),D.push(i)),!t.onlyZeroWidthSpace(ce)){N=ee,V="",v=[];const se=[];for(;N!==z&&N!==x&&N!==null;)N.nodeType===1&&W(N)&&(b(N)?se.push(N.cloneNode(!1)):v.push(N.cloneNode(!1)),V+=N.style.cssText.substr(0,N.style.cssText.indexOf(":"))+"|"),N=N.parentNode;for(v=v.concat(se),ge=P=N=v.pop()||ce;v.length>0;)N=v.pop(),P.appendChild(N),P=N;z.appendChild(ge),N.textContent=ce.data}if(U&&ge){const se=B(ge);se&&(U=se)}for(N=ee,v=[],V="";N!==z&&N!==x&&N!==null;)ae=b(N)?null:s(N),ae&&N.nodeType===1&&W(N)&&(v.push(ae),V+=N.style.cssText.substr(0,N.style.cssText.indexOf(":"))+"|"),N=N.parentNode;const re=v.pop()||ie;for(P=N=re;v.length>0;)N=v.pop(),P.appendChild(N),P=N;U?(i=i.cloneNode(!1),i.appendChild(re),U.insertBefore(i,U.firstChild),z.appendChild(U),D.push(i),U=null):i.appendChild(re),T=ie,k=ie.data.length,A=!0,!u&&h&&(i=ie,ie.textContent=t.zeroWidthSpace),N!==ie&&N.appendChild(T);continue}if(_){if(ee.nodeType===1&&!t.isBreak(ee)){t._isIgnoreNodeChange(ee)?(z.appendChild(ee.cloneNode(!0)),h||(i=i.cloneNode(!1),z.appendChild(i),D.push(i))):J(ee,ee);continue}N=ee,v=[],V="";const ce=[];for(;N.parentNode!==null&&N!==x&&N!==i;)ae=A?N.cloneNode(!1):s(N),N.nodeType===1&&!t.isBreak(ee)&&ae&&W(N)&&(b(N)?U||ce.push(ae):v.push(ae),V+=N.style.cssText.substr(0,N.style.cssText.indexOf(":"))+"|"),N=N.parentNode;v=v.concat(ce);const ie=v.pop()||ee;for(P=N=ie;v.length>0;)N=v.pop(),P.appendChild(N),P=N;if(b(i.parentNode)&&!b(ie)&&!t.onlyZeroWidthSpace(i)&&(i=i.cloneNode(!1),z.appendChild(i),D.push(i)),!A&&!U&&b(ie)){i=i.cloneNode(!1);const re=ie.childNodes;for(let se=0,pe=re.length;se0?te=N:te=i}else ie===ee?A?te=z:te=i:A?(z.appendChild(ie),te=N):(i.appendChild(ie),te=N);if(U&&ee.nodeType===3)if(B(ee)){const re=t.getParentElement(te,(function(se){return this._isMaintainedNode(se.parentNode)||se.parentNode===z}).bind(t));U.appendChild(re),i=re.cloneNode(!1),D.push(i),z.appendChild(i)}else U=null}ge=ee.cloneNode(!1),te.appendChild(ge),ee.nodeType===1&&!t.isBreak(ee)&&(_e=ge),J(ee,_e)}}(e,z),m&&!u&&!y.v)return{ancestor:e,startContainer:r,startOffset:c,endContainer:d,endOffset:f};if(u=u&&m,u)for(let J=0;J0,X=H.pop()||W;for(T=M=X;H.length>0;)M=H.pop(),T.appendChild(M),T=M;if(h(i.parentNode)&&!h(X)&&(i=i.cloneNode(!1),x.appendChild(i),S.push(i)),!k&&h(X)){i=i.cloneNode(!1);const Q=X.childNodes;for(let ne=0,fe=Q.length;ne0;)M=H.pop(),T.appendChild(M),T=M;ne!==v?(i.appendChild(ne),v=M):v=i,t.isBreak(W)&&i.appendChild(W.cloneNode(!1)),q.appendChild(i),D=X,z=0,O=!0,v.appendChild(D);continue}U=O?s(W):W.cloneNode(!1),U&&(v.appendChild(U),W.nodeType===1&&!t.isBreak(W)&&($=U)),_(W,$)}}(e,x),f&&!d&&!u.v)return{ancestor:e,container:r,offset:c,endContainer:y};if(d=d&&f,d)for(let _=0;_0&&z===O)return e.innerHTML=B.innerHTML,{ancestor:e,endContainer:y?t.getNodeFromPath(y,e):null}}d.v=!1;const u=e.cloneNode(!1),m=[i];let h=!0;if(function y(B,b){const S=B.childNodes;for(let x=0,D=S.length,z,O;x0&&(u.appendChild(i),i=i.cloneNode(!1)),O=H.cloneNode(!0),u.appendChild(O),u.appendChild(i),m.push(i),b=i,f&&H.contains(f)){const T=t.getNodePath(f,H);f=t.getNodeFromPath(T,O)}continue}else z=s(H),z&&(h=!1,b.appendChild(z),H.nodeType===1&&(M=z));t.isBreak(H)||y(H,M)}}(e,i),h||c&&!r&&!d.v)return{ancestor:e,endContainer:f};if(u.appendChild(i),r&&c)for(let y=0;y0,$=O.pop()||V;for(M=H=$;O.length>0;)H=O.pop(),M.appendChild(H),M=H;if(h(i.parentNode)&&!h($)&&(i=i.cloneNode(!1),S.insertBefore(i,S.firstChild),b.push(i)),!T&&h($)){i=i.cloneNode(!1);const q=$.childNodes;for(let Y=0,X=q.length;Y0?A=H:A=i}else W?(i.insertBefore($,i.firstChild),A=H):A=i;if(T&&V.nodeType===3)if(m(V)){const q=t.getParentElement(A,(function(Y){return this._isMaintainedNode(Y.parentNode)||Y.parentNode===S}).bind(t));T.appendChild(q),i=q.cloneNode(!1),b.push(i),S.insertBefore(i,S.firstChild)}else T=null}if(!z&&V===x){T=m(V);const Z=t.createTextNode(x.nodeType===1?"":x.substringData(D,x.length-D)),W=t.createTextNode(x.nodeType===1?"":x.substringData(0,D));if(T){T=T.cloneNode(!1);const q=m(A);if(q&&q.parentNode!==S){let Y=q,X=null;for(;Y.parentNode!==S;){for(A=X=Y.parentNode.cloneNode(!1);Y.childNodes[0];)X.appendChild(Y.childNodes[0]);Y.appendChild(X),Y=Y.parentNode}Y.parentNode.insertBefore(q,Y.parentNode.firstChild)}T=T.cloneNode(!1)}else h(i.parentNode)&&!T&&(i=i.cloneNode(!1),S.appendChild(i),b.push(i));for(t.onlyZeroWidthSpace(Z)||A.insertBefore(Z,A.firstChild),H=A,O=[];H!==S&&H!==null;)P=h(H)?null:s(H),P&&H.nodeType===1&&O.push(P),H=H.parentNode;const $=O.pop()||A;for(M=H=$;O.length>0;)H=O.pop(),M.appendChild(H),M=H;$!==A?(i.insertBefore($,i.firstChild),A=H):A=i,t.isBreak(V)&&i.appendChild(V.cloneNode(!1)),T?(T.insertBefore(i,T.firstChild),S.insertBefore(T,S.firstChild),T=null):S.insertBefore(i,S.firstChild),x=W,D=W.data.length,z=!0,A.insertBefore(x,A.firstChild);continue}P=z?s(V):V.cloneNode(!1),P&&(A.insertBefore(P,A.firstChild),V.nodeType===1&&!t.isBreak(V)&&(U=P)),k(V,U)}}(e,S),f&&!d&&!u.v)return{ancestor:e,container:r,offset:c};if(d=d&&f,d)for(let k=0;k-1?null:t.createElement(i);let u=i;/^SUB$/i.test(i)&&d.indexOf("SUP")>-1?u="SUP":/^SUP$/i.test(i)&&d.indexOf("SUB")>-1&&(u="SUB"),this.nodeChange(f,this._commandMapStyles[i]||null,[u],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const i=this.getRange(),s=this.getSelectedElements(null),r=[],c=e!=="indent",d=o.rtl?"marginRight":"marginLeft";let f=i.startContainer,u=i.endContainer,m=i.startOffset,h=i.endOffset;for(let y=0,B=s.length,b,S;y0&&this.plugins.list.editInsideList.call(this,c,r),this.effectNode=null,this.setRange(f,m,u,h),this.history.push(!1)},toggleDisplayBlocks:function(){const e=n.element.wysiwyg;t.toggleClass(e,"se-show-block"),t.hasClass(e,"se-show-block")?t.addClass(this._styleCommandMap.showBlocks,"active"):t.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const e=this._variable.isCodeView;this.controllersOff(),t.setDisabledButtons(!e,this.codeViewDisabledButtons),e?(t.isNonEditable(n.element.wysiwygFrame)||this._setCodeDataToEditor(),n.element.wysiwygFrame.scrollTop=0,n.element.code.style.display="none",n.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),o.height==="auto"&&!o.codeMirrorEditor&&(n.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(o.mode)&&(n.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,p._hideToolbar())),this.nativeFocus(),t.removeClass(this._styleCommandMap.codeView,"active"),t.isNonEditable(n.element.wysiwygFrame)||(this.history.push(!1),this.history._resetCachingButton())):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable.isFullScreen?n.element.code.style.height="100%":o.height==="auto"&&!o.codeMirrorEditor&&(n.element.code.style.height=n.element.code.scrollHeight>0?n.element.code.scrollHeight+"px":"auto"),o.codeMirrorEditor&&o.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(n.element._arrow.style.display="none",n.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,p._showToolbarInline())),this._variable._range=null,n.element.code.focus(),t.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),this.isReadOnly&&t.setDisabledButtons(!0,this.resizingDisabledButtons),typeof F.toggleCodeView=="function"&&F.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const e=this._getCodeView();if(o.fullPage){const i=this._parser.parseFromString(e,"text/html");if(!this.options.__allowedScriptTag){const c=i.head.children;for(let d=0,f=c.length;d0?this.convertContentsForEditor(e):"<"+o.defaultTag+">
"+o.defaultTag+">"},_setEditorDataToCodeView:function(){const e=this.convertHTMLForCodeView(n.element.wysiwyg,!1);let i="";if(o.fullPage){const s=t.getAttributesToString(this._wd.body,null);i=`
`+this._wd.head.outerHTML.replace(/>(?!\n)/g,`>
`)+"
`+e+`
`}else i=e;n.element.code.style.display="block",n.element.wysiwygFrame.style.display="none",this._setCodeView(i)},toggleFullScreen:function(e){const i=n.element.topArea,s=n.element.toolbar,r=n.element.editorArea,c=n.element.wysiwygFrame,d=n.element.code,f=this._variable;this.controllersOff();const u=s.style.display==="none"||this._isInline&&!this._inlineToolbarAttr.isShow;f.isFullScreen?(f.isFullScreen=!1,c.style.cssText=f._wysiwygOriginCssText,d.style.cssText=f._codeOriginCssText,s.style.cssText="",r.style.cssText=f._editorAreaOriginCssText,i.style.cssText=f._originCssText,L.body.style.overflow=f._bodyOverflow,o.height==="auto"&&!o.codeMirrorEditor&&p._codeViewAutoHeight(),o.toolbarContainer&&o.toolbarContainer.appendChild(s),o.stickyToolbar>-1&&t.removeClass(s,"se-toolbar-sticky"),f._fullScreenAttrs.sticky&&!o.toolbarContainer&&(f._fullScreenAttrs.sticky=!1,n.element._stickyDummy.style.display="block",t.addClass(s,"se-toolbar-sticky")),this._isInline=f._fullScreenAttrs.inline,this._isBalloon=f._fullScreenAttrs.balloon,this._isInline&&p._showToolbarInline(),o.toolbarContainer&&t.removeClass(s,"se-toolbar-balloon"),p.onScroll_window(),e&&t.changeElement(e.firstElementChild,R.expansion),n.element.topArea.style.marginTop="",t.removeClass(this._styleCommandMap.fullScreen,"active")):(f.isFullScreen=!0,f._fullScreenAttrs.inline=this._isInline,f._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),o.toolbarContainer&&n.element.relative.insertBefore(s,r),i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.maxWidth="100%",i.style.height="100%",i.style.zIndex="2147483647",n.element._stickyDummy.style.display!==""&&(f._fullScreenAttrs.sticky=!0,n.element._stickyDummy.style.display="none",t.removeClass(s,"se-toolbar-sticky")),f._bodyOverflow=L.body.style.overflow,L.body.style.overflow="hidden",f._editorAreaOriginCssText=r.style.cssText,f._wysiwygOriginCssText=c.style.cssText,f._codeOriginCssText=d.style.cssText,r.style.cssText=s.style.cssText="",c.style.cssText=(c.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+o._editorStyles.editor,d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],s.style.width=c.style.height=d.style.height="100%",s.style.position="relative",s.style.display="block",f.innerHeight_fullScreen=E.innerHeight-s.offsetHeight,r.style.height=f.innerHeight_fullScreen-o.fullScreenOffset+"px",e&&t.changeElement(e.firstElementChild,R.reduction),o.iframe&&o.height==="auto"&&(r.style.overflow="auto",this._iframeAutoHeight()),n.element.topArea.style.marginTop=o.fullScreenOffset+"px",t.addClass(this._styleCommandMap.fullScreen,"active")),u&&F.toolbar.hide(),typeof F.toggleFullScreen=="function"&&F.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=t.createElement("IFRAME");e.style.display="none",L.body.appendChild(e);const i=o.printTemplate?o.printTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),s=t.getIframeDocument(e),r=this._wd;if(o.iframe){const c=o._printClass!==null?'class="'+o._printClass+'"':o.fullPage?t.getAttributesToString(r.body,["contenteditable"]):'class="'+o._editableClass+'"';s.write(""+r.head.innerHTML+""+i+"")}else{const c=L.head.getElementsByTagName("link"),d=L.head.getElementsByTagName("style");let f="";for(let u=0,m=c.length;u"+f+''+i+"")}this.showLoading(),E.setTimeout(function(){try{if(e.focus(),t.isIE_Edge||t.isChromium||L.documentMode||E.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch{e.contentWindow.print()}else e.contentWindow.print()}catch(c){throw Error("[SUNEDITOR.core.print.fail] error: "+c)}finally{a.closeLoading(),t.removeItem(e)}},1e3)},preview:function(){a.submenuOff(),a.containerOff(),a.controllersOff();const e=o.previewTemplate?o.previewTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),i=E.open("","_blank");i.mimeType="text/html";const s=this._wd;if(o.iframe){const r=o._printClass!==null?'class="'+o._printClass+'"':o.fullPage?t.getAttributesToString(s.body,["contenteditable"]):'class="'+o._editableClass+'"';i.document.write(""+s.head.innerHTML+""+e+"")}else{const r=L.head.getElementsByTagName("link"),c=L.head.getElementsByTagName("style");let d="";for(let f=0,u=r.length;f'+C.toolbar.preview+""+d+''+e+"")}},setDir:function(e){const i=e==="rtl",s=this._prevRtl!==i;this._prevRtl=o.rtl=i,s&&(this.plugins.align&&this.plugins.align.exchangeDir.call(this),n.tool.indent&&t.changeElement(n.tool.indent.firstElementChild,R.indent),n.tool.outdent&&t.changeElement(n.tool.outdent.firstElementChild,R.outdent));const r=n.element;i?(t.addClass(r.topArea,"se-rtl"),t.addClass(r.wysiwygFrame,"se-rtl")):(t.removeClass(r.topArea,"se-rtl"),t.removeClass(r.wysiwygFrame,"se-rtl"));const c=t.getListChildren(r.wysiwyg,function(f){return t.isFormatElement(f)&&(f.style.marginRight||f.style.marginLeft||f.style.textAlign)});for(let f=0,u=c.length,m,h,y;f"+this._wd.head.outerHTML+""+s.innerHTML+""}else return s.innerHTML},getFullContents:function(e){return''+this.getContents(e)+"
"},_makeLine:function(e,i){const s=o.defaultTag;if(e.nodeType===1){if(this.__disallowedTagNameRegExp.test(e.nodeName))return"";if(/__se__tag/.test(e.className))return e.outerHTML;const r=t.getListChildNodes(e,function(c){return t.isSpanWithoutAttr(c)&&!t.getParentElement(c,t.isNotCheckingNode)})||[];for(let c=r.length-1;c>=0;c--)r[c].outerHTML=r[c].innerHTML;return!i||t.isFormatElement(e)||t.isRangeFormatElement(e)||t.isComponent(e)||t.isFigures(e)||t.isAnchor(e)&&t.isMedia(e.firstElementChild)?t.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML:"<"+s+">"+(t.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML)+""+s+">"}if(e.nodeType===3){if(!i)return t._HTMLConvertor(e.textContent);const r=e.textContent.split(/\n/g);let c="";for(let d=0,f=r.length,u;d0&&(c+="<"+s+">"+t._HTMLConvertor(u)+""+s+">");return c}return e.nodeType===8&&this._allowHTMLComments?"":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const i=o._textTagsMap;return e.replace(this._disallowedTextTagsRegExp,function(s,r,c,d){return r+(typeof i[c]=="string"?i[c]:c)+(d?" "+d:"")})},_deleteDisallowedTags:function(e){return e=e.replace(this.__disallowedTagsRegExp,"").replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi,""),/\bfont\b/i.test(this.options._editorTagsWhitelist)||(e=e.replace(/(<\/?)font(\s?)/gi,"$1span$2")),e.replace(this.editorTagsWhitelistRegExp,"").replace(this.editorTagsBlacklistRegExp,"")},_convertFontSize:function(e,i){const s=this._w.Math,r=i.match(/(\d+(?:\.\d+)?)(.+)/),c=r?r[1]*1:t.fontValueMap[i],d=r?r[2]:"rem";let f=c;switch(/em/.test(d)?f=s.round(c/.0625):d==="pt"?f=s.round(c*1.333):d==="%"&&(f=c/100),e){case"em":case"rem":case"%":return(f*.0625).toFixed(2)+e;case"pt":return s.floor(f/1.333)+e;default:return f+e}},_cleanStyle:function(e,i,s){let r=(e.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(/span/i.test(s)&&!r&&(e.match(/<[^\s]+\s(.+)/)||[])[1]){const c=(e.match(/\ssize="([^"]+)"/i)||[])[1],d=(e.match(/\sface="([^"]+)"/i)||[])[1],f=(e.match(/\scolor="([^"]+)"/i)||[])[1];(c||d||f)&&(r='style="'+(c?"font-size:"+this.util.getNumber(c/3.333,1)+"rem;":"")+(d?"font-family:"+d+";":"")+(f?"color:"+f+";":"")+'"')}if(r){i||(i=[]);const c=r.replace(/"/g,"").match(this._cleanStyleRegExp[s]);if(c){const d=[];for(let f=0,u=c.length,m;f0&&i.push('style="'+d.join(";")+'"')}}return i},_cleanTags:function(e,i,s){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(i))return i;let r=null;const c=s.match(/(?!<)[a-zA-Z0-9\-]+/)[0].toLowerCase(),d=this._attributesTagsBlacklist[c];i=i.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/ig,""),d?i=i.replace(d,""):i=i.replace(this._attributesBlacklistRegExp,"");const f=this._attributesTagsWhitelist[c];if(f?r=i.match(f):r=i.match(e?this._attributesWhitelistRegExp:this._attributesWhitelistRegExp_all_data),e||c==="span"||c==="li"||this._cleanStyleRegExp[c])if(c==="a"){const u=i.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);u&&(r||(r=[]),r.push(u[0]))}else(!r||!/style=/i.test(r.toString()))&&((c==="span"||c==="li")&&(r=this._cleanStyle(i,r,"span")),this._cleanStyleRegExp[c]?r=this._cleanStyle(i,r,c):/^(P|DIV|H[1-6]|PRE)$/i.test(c)&&(r=this._cleanStyle(i,r,"format")));else{const u=i.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);u&&!r?r=[u[0]]:u&&!r.some(function(m){return/^style/.test(m.trim())})&&r.push(u[0])}if(t.isFigures(c)){const u=i.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);r||(r=[]),u&&r.push(u[0])}if(r)for(let u=0,m=r.length,h;u":!t.isFormatElement(f)&&!t.isRangeFormatElement(f)&&!t.isComponent(f)&&!/meta/i.test(f.nodeName)?(s||(s=t.createElement(o.defaultTag)),s.appendChild(f),c--,d--):(s&&(i+=s.outerHTML,s=null),i+=f.outerHTML);return s&&(i+=s.outerHTML),L.createRange().createContextualFragment(i)},_convertListCell:function(e){let i="";for(let s=0,r=e.length,c;s"+(c.innerHTML.trim()||"
")+"":t.isRangeFormatElement(c)&&!t.isTable(c)?i+=this._convertListCell(c):i+=""+c.outerHTML+"":i+=""+(c.textContent||"
")+"";return i},_isFormatData:function(e){let i=!1;for(let s=0,r=e.length,c;s]*(?=>)/g,this._cleanTags.bind(this,!0)).replace(/
$/i,"");const r=L.createRange().createContextualFragment(e);try{t._consistencyCheckOfHTML(r,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,this._classNameFilter)}catch(u){console.warn("[SUNEDITOR.cleanHTML.consistencyCheck.fail] "+u)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const u=r.querySelectorAll(this.managedTagsInfo.query);for(let m=0,h=u.length,y,B;m]*(?=>)/g,this._cleanTags.bind(this,!0));const i=L.createRange().createContextualFragment(e);try{t._consistencyCheckOfHTML(i,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,this._classNameFilter)}catch(d){console.warn("[SUNEDITOR.convertContentsForEditor.consistencyCheck.fail] "+d)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const d=i.querySelectorAll(this.managedTagsInfo.query);for(let f=0,u=d.length,m,h;f
"+o.defaultTag+">":(r=t.htmlRemoveWhiteSpace(r),this._tagConvertor(r))},convertHTMLForCodeView:function(e,i){let s="";const r=E.RegExp,c=new r("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),d=typeof e=="string"?L.createRange().createContextualFragment(e):e,f=(function(h){return this.isFormatElement(h)||this.isComponent(h)}).bind(t),u=i?"":`
`;let m=i?0:this._variable.codeIndent*1;return m=m>0?new E.Array(m+1).join(" "):"",function h(y,B){const b=y.childNodes,S=c.test(y.nodeName),x=S?B:"";for(let D=0,z=b.length,O,H,M,T,k,_;D"+H;continue}if(O.nodeType===3){t.isList(O.parentElement)||(s+=t._HTMLConvertor(/^\n+$/.test(O.data)?"":O.data));continue}if(O.childNodes.length===0){s+=(/^HR$/i.test(O.nodeName)?u:"")+(/^PRE$/i.test(O.parentElement.nodeName)&&/^BR$/i.test(O.nodeName)?"":x)+O.outerHTML+H;continue}O.outerHTML?(k=O.nodeName.toLowerCase(),_=x||T?B:"",s+=(M||(S?"":H))+_+O.outerHTML.match(r("<"+k+"[^>]*>","i"))[0]+H,h(O,B+m),s+=(/\n$/.test(s)?_:"")+""+k+">"+(M||H||S||/^(TH|TD)$/i.test(O.nodeName)?u:"")):s+=new E.XMLSerializer().serializeToString(O)}}(d,""),s.trim()+u},addDocEvent:function(e,i,s){L.addEventListener(e,i,s),o.iframe&&this._wd.addEventListener(e,i)},removeDocEvent:function(e,i){L.removeEventListener(e,i),o.iframe&&this._wd.removeEventListener(e,i)},_charCount:function(e){const i=o.maxCharCount,s=o.charCounterType;let r=0;if(e&&(r=this.getCharLength(e,s)),this._setCharCount(),i>0){let c=!1;const d=F.getCharCount(s);if(d>i){if(c=!0,r>0){this._editorRange();const f=this.getRange(),u=f.endOffset-1,m=this.getSelectionNode().textContent,h=f.endOffset-(d-i);this.getSelectionNode().textContent=m.slice(0,h<0?0:h)+m.slice(f.endOffset,m.length),this.setRange(f.endContainer,u,f.endContainer,u)}}else d+r>i&&(c=!0);if(c&&(this._callCounterBlink(),r>0))return!1}return!0},checkCharCount:function(e,i){if(o.maxCharCount){const s=i||o.charCounterType,r=this.getCharLength(typeof e=="string"?e:this._charTypeHTML&&e.nodeType===1?e.outerHTML:e.textContent,s);if(r>0&&r+F.getCharCount(s)>o.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,i){return/byte/.test(i)?t.getByteLength(e):e.length},resetResponsiveToolbar:function(){a.controllersOff();const e=p._responsiveButtonSize;if(e){let i=0;(a._isBalloon||a._isInline)&&o.toolbarWidth==="auto"?i=n.element.topArea.offsetWidth:i=n.element.toolbar.offsetWidth;let s="default";for(let r=1,c=e.length;r-1||!t.hasOwn(i,r)||(s.indexOf(r)>-1?g[r].active.call(this,null):i.OUTDENT&&/^OUTDENT$/i.test(r)?t.isImportantDisabled(i.OUTDENT)||i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(r)?t.isImportantDisabled(i.INDENT)||i.INDENT.removeAttribute("disabled"):t.removeClass(i[r],"active"))},_init:function(e,i){const s=E.RegExp;this._ww=o.iframe?n.element.wysiwygFrame.contentWindow:E,this._wd=L,this._charTypeHTML=o.charCounterType==="byte-html",this.wwComputedStyle=E.getComputedStyle(n.element.wysiwyg),this._editorHeight=n.element.wysiwygFrame.offsetHeight,this._editorHeightPadding=t.getNumber(this.wwComputedStyle.getPropertyValue("padding-top"))+t.getNumber(this.wwComputedStyle.getPropertyValue("padding-bottom")),this._classNameFilter=(function(T){return this.test(T)?T:""}).bind(o.allowedClassNames);const r=o.__allowedScriptTag?"":"script|";if(this.__scriptTagRegExp=new s("<(script)[^>]*>([\\s\\S]*?)<\\/\\1>|