diff --git a/dataLaporanOperasi.php b/dataLaporanOperasi.php index ad33594..4170092 100644 --- a/dataLaporanOperasi.php +++ b/dataLaporanOperasi.php @@ -21,6 +21,9 @@ switch ($action) { case "searchTindakan": searchTindakan($db, $q); break; + case "postLaporanOperasi": + postLaporanOperasi($db, $_POST); + break; default : echo json_encode([ "error" => "invalid action" @@ -28,15 +31,15 @@ switch ($action) { } function searchDPJP(PostgresDb $db, string $q) { - $query = "SELECT kddokter, namadokter, kdsmf, kode_dpjp FROM public.m_dokter WHERE kdsmf LIKE '%BEDAH%'"; + $query = "SELECT kddokter, namadokter, kdsmf, kode_dpjp, nip FROM public.m_dokter WHERE kdsmf LIKE '%BEDAH%'"; if ($q != '') { $query .= " AND (namadokter ILIKE '%$q%' OR kode_dpjp ILIKE '%$q%')"; } + + $query .= " LIMIT 10"; $sql_dokter_bedah = $db->query($query); - - $query .= " LIMIT 10"; $arr_dokter_bedah = array(); foreach ($sql_dokter_bedah->fetchAll() as $ds) { @@ -91,4 +94,13 @@ function searchTindakan(PostgresDb $db, string $q) { "data" => $result ]); } + +function postLaporanOperasi(PostgresDb $db, $data) { + $query = "INSERT into t_operasi ()"; + echo json_encode([ + "message" => "success post laporan operasi", + "data" => $data + ]); +} + ?> \ No newline at end of file diff --git a/index.php b/index.php index dd1297e..b26728d 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,12 @@ "3/17/2026, 8:52:26 AM", + "status" => "Tervalidasi", + "operator" => " dr.SYAIFULLAH AMISRAGANI, Sp.OT" + ], +]; if ($_SERVER['REQUEST_METHOD'] == "POST") { echo "
";
     print_r($_POST);
@@ -16,7 +23,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
     Laporan Operasi
 
     
-
+    
     ":"")}};var L=k,B={init:function(e,t){"object"!=typeof t&&(t={});const n=document;this._initOptions(e,t);const i=n.createElement("DIV");i.className="sun-editor"+(t.rtl?" se-rtl":""),e.id&&(i.id="suneditor_"+e.id);const l=n.createElement("DIV");l.className="se-container";const o=this._createToolBar(n,t.buttonList,t.plugins,t),s=o.element.cloneNode(!1);s.className+=" se-toolbar-shadow",o.element.style.visibility="hidden",o.pluginCallButtons.math&&this._checkKatexMath(t.katex);const a=n.createElement("DIV");a.className="se-arrow";const r=n.createElement("DIV");r.className="se-toolbar-sticky-dummy";const c=n.createElement("DIV");c.className="se-wrapper";const d=this._initElements(t,i,o.element,a),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;const m=u.resizingBar,f=u.navigation,_=u.charWrapper,b=u.charCounter,v=n.createElement("DIV");v.className="se-loading-box sun-editor-common",v.innerHTML='
';const y=n.createElement("DIV");y.className="se-line-breaker",y.innerHTML='";const C=n.createElement("DIV");C.className+="se-line-breaker-component";const w=C.cloneNode(!0);C.innerHTML=w.innerHTML=t.icons.line_break;const x=n.createElement("DIV");x.className="se-resizing-back";const E=n.createElement("INPUT");E.tabIndex=-1,E.style.cssText="position: fixed !important; top: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;";const S=t.toolbarContainer;S&&(S.appendChild(o.element),S.appendChild(s));const N=t.resizingBarContainer;return m&&N&&N.appendChild(m),c.appendChild(p),g&&c.appendChild(g),S||(l.appendChild(o.element),l.appendChild(s)),l.appendChild(r),l.appendChild(c),l.appendChild(x),l.appendChild(v),l.appendChild(y),l.appendChild(C),l.appendChild(w),l.appendChild(E),m&&!N&&l.appendChild(m),i.appendChild(l),p=this._checkCodeMirror(t,p),{constructed:{_top:i,_relative:l,_toolBar:o.element,_toolbarShadow:s,_menuTray:o._menuTray,_editorArea:c,_wysiwygArea:h,_codeArea:p,_placeholder:g,_resizingBar:m,_navigation:f,_charWrapper:_,_charCounter:b,_loading:v,_lineBreaker:y,_lineBreaker_t:C,_lineBreaker_b:w,_resizeBack:x,_stickyDummy:r,_arrow:a,_focusTemp:E},options:t,plugins:o.plugins,pluginCallButtons:o.pluginCallButtons,_responsiveButtons:o.responsiveButtons}},_checkCodeMirror:function(e,t){if(e.codeMirror){const n=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},e.codeMirror.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});"auto"===e.height&&(n.viewportMargin=1/0,n.height="auto");const i=e.codeMirror.src.fromTextArea(t,n);i.display.wrapper.style.cssText=t.style.cssText,e.codeMirrorEditor=i,(t=i.display.wrapper).className+=" se-wrapper-code-mirror"}return t},_checkKatexMath:function(e){if(!e)throw Error('[SUNEDITOR.create.fail] To use the math button you need to add a "katex" object to the options.');const t=[{throwOnError:!1},e.options||{}].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{});e.options=t},_setOptions:function(e,t,n){this._initOptions(t.element.originElement,e);const i=t.element,l=i.relative,o=i.editorArea,s=e.toolbarContainer&&e.toolbarContainer!==n.toolbarContainer,a=e.lang!==n.lang||e.buttonList!==n.buttonList||e.mode!==n.mode||s,r=this._createToolBar(document,a?e.buttonList:n.buttonList,e.plugins,e);r.pluginCallButtons.math&&this._checkKatexMath(e.katex);const c=document.createElement("DIV");c.className="se-arrow",a&&(r.element.style.visibility="hidden",s?(e.toolbarContainer.appendChild(r.element),i.toolbar.parentElement.removeChild(i.toolbar)):i.toolbar.parentElement.replaceChild(r.element,i.toolbar),i.toolbar=r.element,i._menuTray=r._menuTray,i._arrow=c);const d=this._initElements(e,i.topArea,a?r.element:i.toolbar,c),u=d.bottomBar,h=d.wysiwygFrame,g=d.placeholder;let p=d.codeView;return i.resizingBar&&L.removeItem(i.resizingBar),u.resizingBar&&(e.resizingBarContainer&&e.resizingBarContainer!==n.resizingBarContainer?e.resizingBarContainer.appendChild(u.resizingBar):l.appendChild(u.resizingBar)),o.innerHTML="",o.appendChild(p),g&&o.appendChild(g),p=this._checkCodeMirror(e,p),i.resizingBar=u.resizingBar,i.navigation=u.navigation,i.charWrapper=u.charWrapper,i.charCounter=u.charCounter,i.wysiwygFrame=h,i.code=p,i.placeholder=g,e.rtl?L.addClass(i.topArea,"se-rtl"):L.removeClass(i.topArea,"se-rtl"),{callButtons:r.pluginCallButtons,plugins:r.plugins,toolbar:r}},_initElements:function(e,t,n,i){t.style.cssText=e._editorStyles.top,/inline/i.test(e.mode)?(n.className+=" se-toolbar-inline",n.style.width=e.toolbarWidth):/balloon/i.test(e.mode)&&(n.className+=" se-toolbar-balloon",n.style.width=e.toolbarWidth,n.appendChild(i));const l=document.createElement(e.iframe?"IFRAME":"DIV");if(l.className="se-wrapper-inner se-wrapper-wysiwyg",e.iframe)l.allowFullscreen=!0,l.frameBorder=0,l.style.cssText=e._editorStyles.frame,l.className+=e.className;else{l.setAttribute("contenteditable",!0),l.setAttribute("autocorrect","off"),l.setAttribute("scrolling","auto");for(let t in e.iframeAttributes)l.setAttribute(t,e.iframeAttributes[t]);l.className+=" "+e._editableClass,l.style.cssText=e._editorStyles.frame+e._editorStyles.editor,l.className+=e.className}const o=document.createElement("TEXTAREA");o.className="se-wrapper-inner se-wrapper-code"+e.className,o.style.cssText=e._editorStyles.frame,o.style.display="none","auto"===e.height&&(o.style.overflow="hidden");let s=null,a=null,r=null,c=null;if(e.resizingBar&&(s=document.createElement("DIV"),s.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",s.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}s.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:s,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:o,placeholder:d}},_initOptions:function(e,t){const n={};if(t.plugins){const e=t.plugins,i=e.length?e:Object.keys(e).map((function(t){return e[t]}));for(let e,t=0,l=i.length;t0?t.defaultTag:"p";const i=t.textTags=[{bold:"STRONG",underline:"U",italic:"EM",strike:"DEL",sub:"SUB",sup:"SUP"},t.textTags||{}].reduce((function(e,t){for(let n in t)e[n]=t[n];return e}),{});t._textTagsMap={strong:i.bold.toLowerCase(),b:i.bold.toLowerCase(),u:i.underline.toLowerCase(),ins:i.underline.toLowerCase(),em:i.italic.toLowerCase(),i:i.italic.toLowerCase(),del:i.strike.toLowerCase(),strike:i.strike.toLowerCase(),s:i.strike.toLowerCase(),sub:i.sub.toLowerCase(),sup:i.sup.toLowerCase()},t._defaultCommand={bold:t.textTags.bold,underline:t.textTags.underline,italic:t.textTags.italic,strike:t.textTags.strike,subscript:t.textTags.sub,superscript:t.textTags.sup},t.__allowedScriptTag=!0===t.__allowedScriptTag;t.tagsBlacklist=t.tagsBlacklist||"",t._defaultTagsWhitelist=("string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary")+(t.__allowedScriptTag?"|script":""),t._editorTagsWhitelist="*"===t.addTagsWhitelist?"*":this._setWhitelist(t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.tagsBlacklist),t.pasteTagsBlacklist=t.tagsBlacklist+(t.tagsBlacklist&&t.pasteTagsBlacklist?"|"+t.pasteTagsBlacklist:t.pasteTagsBlacklist||""),t.pasteTagsWhitelist="*"===t.pasteTagsWhitelist?"*":this._setWhitelist("string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.pasteTagsBlacklist),t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.attributesBlacklist=t.attributesBlacklist&&"object"==typeof t.attributesBlacklist?t.attributesBlacklist:null,t.mode=t.mode||"classic",t.rtl=!!t.rtl,t.lineAttrReset=["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[]),t._editableClass="sun-editor-editable"+(t.rtl?" se-rtl":""),t._printClass="string"==typeof t._printClass?t._printClass:null,t.toolbarWidth=t.toolbarWidth?L.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.toolbarContainer="string"==typeof t.toolbarContainer?document.querySelector(t.toolbarContainer):t.toolbarContainer,t.stickyToolbar=/balloon/i.test(t.mode)||t.toolbarContainer?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?L.getNumber(t.stickyToolbar,0):-1,t.hideToolbar=!!t.hideToolbar,t.fullScreenOffset=void 0===t.fullScreenOffset?0:/^\d+/.test(t.fullScreenOffset)?L.getNumber(t.fullScreenOffset,0):0,t.fullPage=!!t.fullPage,t.iframe=t.fullPage||!!t.iframe,t.iframeAttributes=t.iframeAttributes||{},t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.previewTemplate="string"==typeof t.previewTemplate?t.previewTemplate:null,t.printTemplate="string"==typeof t.printTemplate?t.printTemplate:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.mathFontSize=t.mathFontSize?t.mathFontSize:[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],t.position="string"==typeof t.position?t.position:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.resizeEnable=void 0===t.resizeEnable||!!t.resizeEnable,t.resizingBarContainer="string"==typeof t.resizingBarContainer?document.querySelector(t.resizingBarContainer):t.resizingBarContainer,t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="string"==typeof t.charCounterType?t.charCounterType:"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=L.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?L.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(L.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(L.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?L.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(L.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(L.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.className="string"==typeof t.className&&t.className.length>0?" "+t.className:"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim().toLowerCase()||"px",t.alignItems="object"==typeof t.alignItems?t.alignItems:t.rtl?["right","center","left","justify"]:["left","center","right","justify"],t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageAlignShow=void 0===t.imageAlignShow||!!t.imageAlignShow,t.imageWidth=t.imageWidth?L.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageHeight=t.imageHeight?L.isNumber(t.imageHeight)?t.imageHeight+"px":t.imageHeight:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl="string"==typeof t.imageUploadUrl?t.imageUploadUrl:null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?L.getNumber(t.imageUploadSizeLimit,0):null,t.imageMultipleFile=!!t.imageMultipleFile,t.imageAccept="string"!=typeof t.imageAccept||"*"===t.imageAccept.trim()?"image/*":t.imageAccept.trim()||"image/*",t.imageGalleryData=t.imageGalleryData||null,t.imageGalleryUrl="string"==typeof t.imageGalleryUrl?t.imageGalleryUrl:null,t.imageGalleryHeader=t.imageGalleryHeader||null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoAlignShow=void 0===t.videoAlignShow||!!t.videoAlignShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&L.getNumber(t.videoWidth,0)?L.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"",t.videoHeight=t.videoHeight&&L.getNumber(t.videoHeight,0)?L.isNumber(t.videoHeight)?t.videoHeight+"px":t.videoHeight:"",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=L.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.vimeoQuery=(t.vimeoQuery||"").replace("?",""),t.videoFileInput=!!t.videoFileInput,t.videoUrlInput=void 0===t.videoUrlInput||!t.videoFileInput||t.videoUrlInput,t.videoUploadHeader=t.videoUploadHeader||null,t.videoUploadUrl="string"==typeof t.videoUploadUrl?t.videoUploadUrl:null,t.videoUploadSizeLimit=/\d+/.test(t.videoUploadSizeLimit)?L.getNumber(t.videoUploadSizeLimit,0):null,t.videoMultipleFile=!!t.videoMultipleFile,t.videoTagAttrs=t.videoTagAttrs||null,t.videoIframeAttrs=t.videoIframeAttrs||null,t.videoAccept="string"!=typeof t.videoAccept||"*"===t.videoAccept.trim()?"video/*":t.videoAccept.trim()||"video/*",t.audioWidth=t.audioWidth?L.isNumber(t.audioWidth)?t.audioWidth+"px":t.audioWidth:"",t.audioHeight=t.audioHeight?L.isNumber(t.audioHeight)?t.audioHeight+"px":t.audioHeight:"",t.audioFileInput=!!t.audioFileInput,t.audioUrlInput=void 0===t.audioUrlInput||!t.audioFileInput||t.audioUrlInput,t.audioUploadHeader=t.audioUploadHeader||null,t.audioUploadUrl="string"==typeof t.audioUploadUrl?t.audioUploadUrl:null,t.audioUploadSizeLimit=/\d+/.test(t.audioUploadSizeLimit)?L.getNumber(t.audioUploadSizeLimit,0):null,t.audioMultipleFile=!!t.audioMultipleFile,t.audioTagAttrs=t.audioTagAttrs||null,t.audioAccept="string"!=typeof t.audioAccept||"*"===t.audioAccept.trim()?"audio/*":t.audioAccept.trim()||"audio/*",t.tableCellControllerPosition="string"==typeof t.tableCellControllerPosition?t.tableCellControllerPosition.toLowerCase():"cell",t.linkTargetNewWindow=!!t.linkTargetNewWindow,t.linkProtocol="string"==typeof t.linkProtocol?t.linkProtocol:null,t.linkRel=Array.isArray(t.linkRel)?t.linkRel:[],t.linkRelDefault=t.linkRelDefault||{},t.tabDisable=!!t.tabDisable,t.shortcutsDisable=Array.isArray(t.shortcutsDisable)?t.shortcutsDisable:[],t.shortcutsHint=void 0===t.shortcutsHint||!!t.shortcutsHint,t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.mediaAutoSelect=void 0===t.mediaAutoSelect||!!t.mediaAutoSelect,t.buttonList=t.buttonList?t.buttonList:[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],t.rtl&&(t.buttonList=t.buttonList.reverse()),t.icons=t.icons&&"object"==typeof t.icons?[S,t.icons].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):S,t.icons=t.rtl?[t.icons,t.icons.rtl].reduce((function(e,t){for(let n in t)L.hasOwn(t,n)&&(e[n]=t[n]);return e}),{}):t.icons,t.__listCommonStyle=t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"],t._editorStyles=L._setDefaultOptionStyle(t,t.defaultStyle)},_setWhitelist:function(e,t){if("string"!=typeof t)return e;t=t.split("|"),e=e.split("|");for(let n,i=0,l=t.length;i-1&&e.splice(n,1);return e.join("|")},_defaultButtons:function(e){const t=e.icons,n=e.lang,i=L.isOSX_IOS?"⌘":"CTRL",l=L.isOSX_IOS?"⇧":"+SHIFT",o=e.shortcutsHint?e.shortcutsDisable:["bold","strike","underline","italic","undo","indent","save"],s=e.rtl?["[","]"]:["]","["],a=e.rtl?[t.outdent,t.indent]:[t.indent,t.outdent];return{bold:["",n.toolbar.bold+''+(o.indexOf("bold")>-1?"":i+'+B')+"","bold","",t.bold],underline:["",n.toolbar.underline+''+(o.indexOf("underline")>-1?"":i+'+U')+"","underline","",t.underline],italic:["",n.toolbar.italic+''+(o.indexOf("italic")>-1?"":i+'+I')+"","italic","",t.italic],strike:["",n.toolbar.strike+''+(o.indexOf("strike")>-1?"":i+l+'+S')+"","strike","",t.strike],subscript:["",n.toolbar.subscript,"SUB","",t.subscript],superscript:["",n.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",n.toolbar.removeFormat,"removeFormat","",t.erase],indent:["",n.toolbar.indent+''+(o.indexOf("indent")>-1?"":i+'+'+s[0]+"")+"","indent","",a[0]],outdent:["",n.toolbar.outdent+''+(o.indexOf("indent")>-1?"":i+'+'+s[1]+"")+"","outdent","",a[1]],fullScreen:["se-code-view-enabled se-resizing-enabled",n.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["",n.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["se-code-view-enabled se-resizing-enabled",n.toolbar.codeView,"codeView","",t.code_view],undo:["",n.toolbar.undo+''+(o.indexOf("undo")>-1?"":i+'+Z')+"","undo","",t.undo],redo:["",n.toolbar.redo+''+(o.indexOf("undo")>-1?"":i+'+Y / '+i+l+'+Z')+"","redo","",t.redo],preview:["se-resizing-enabled",n.toolbar.preview,"preview","",t.preview],print:["se-resizing-enabled",n.toolbar.print,"print","",t.print],dir:["",n.toolbar[e.rtl?"dir_ltr":"dir_rtl"],"dir","",t[e.rtl?"dir_ltr":"dir_rtl"]],dir_ltr:["",n.toolbar.dir_ltr,"dir_ltr","",t.dir_ltr],dir_rtl:["",n.toolbar.dir_rtl,"dir_rtl","",t.dir_rtl],save:["se-resizing-enabled",n.toolbar.save+''+(o.indexOf("save")>-1?"":i+'+S')+"","save","",t.save],blockquote:["",n.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",n.toolbar.font,"font","submenu",''+n.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",n.toolbar.formats,"formatBlock","submenu",''+n.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",n.toolbar.fontSize,"fontSize","submenu",''+n.toolbar.fontSize+""+t.arrow_down],fontColor:["",n.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",n.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",n.toolbar.align,"align","submenu",e.rtl?t.align_right:t.align_left],list:["",n.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",n.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",n.toolbar.table,"table","submenu",t.table],lineHeight:["",n.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",n.toolbar.template,"template","submenu",t.template],paragraphStyle:["",n.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",n.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",n.toolbar.link,"link","dialog",t.link],image:["",n.toolbar.image,"image","dialog",t.image],video:["",n.toolbar.video,"video","dialog",t.video],audio:["",n.toolbar.audio,"audio","dialog",t.audio],math:["",n.toolbar.math,"math","dialog",t.math],imageGallery:["",n.toolbar.imageGallery,"imageGallery","fileBrowser",t.image_gallery]}},_createModuleGroup:function(){const e=L.createElement("DIV");e.className="se-btn-module se-btn-module-border";const t=L.createElement("UL");return t.className="se-menu-list",e.appendChild(t),{div:e,ul:t}},_createButton:function(e,t,n,i,l,o,s){const a=L.createElement("LI"),r=L.createElement("BUTTON"),c=t||n;return r.setAttribute("type","button"),r.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),r.setAttribute("data-command",n),r.setAttribute("data-display",i),r.setAttribute("aria-label",c.replace(//,"")),r.setAttribute("tabindex","-1"),l||(l='!'),/^default\./i.test(l)&&(l=s[l.replace(/^default\./i,"")]),/^text\./i.test(l)&&(l=l.replace(/^text\./i,""),r.className+=" se-btn-more-text"),l+=''+c+"",o&&r.setAttribute("disabled",!0),r.innerHTML=l,a.appendChild(r),{li:a,button:r}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const o=e.createElement("DIV");o.className="se-toolbar sun-editor-common";const s=e.createElement("DIV");s.className="se-btn-tray",o.appendChild(s),t=JSON.parse(JSON.stringify(t));const a=i.icons,r=this._defaultButtons(i),c={},d=[];let u=null,h=null,g=null,p=null,m="",f=!1;const _=L.createElement("DIV");_.className="se-toolbar-more-layer";e:for(let i,o,b,v,y,C=0;C",_.appendChild(o),o=o.firstElementChild.firstElementChild)}if(f){const e=l.cloneNode(!1);s.appendChild(e)}s.appendChild(g.div),f=!0}else if(/^\/$/.test(v)){const t=e.createElement("DIV");t.className="se-btn-module-enter",s.appendChild(t),f=!1}switch(s.children.length){case 0:s.style.display="none";break;case 1:L.removeClass(s.firstElementChild,"se-btn-module-border");break;default:if(i.rtl){const e=l.cloneNode(!1);e.style.float=s.lastElementChild.style.float,s.appendChild(e)}}d.length>0&&d.unshift(t),_.children.length>0&&s.appendChild(_);const b=e.createElement("DIV");b.className="se-menu-tray",o.appendChild(b);const v=e.createElement("DIV");return v.className="se-toolbar-cover",o.appendChild(v),i.hideToolbar&&(o.style.display="none"),{element:o,plugins:n,pluginCallButtons:c,responsiveButtons:d,_menuTray:b,_buttonTray:s}}};var A=function(e,t,n){return{element:{originElement:e,topArea:t._top,relative:t._relative,toolbar:t._toolBar,_toolbarShadow:t._toolbarShadow,_buttonTray:t._toolBar.querySelector(".se-btn-tray"),_menuTray:t._menuTray,resizingBar:t._resizingBar,navigation:t._navigation,charWrapper:t._charWrapper,charCounter:t._charCounter,editorArea:t._editorArea,wysiwygFrame:t._wysiwygArea,wysiwyg:t._wysiwygArea,code:t._codeArea,placeholder:t._placeholder,loading:t._loading,lineBreaker:t._lineBreaker,lineBreaker_t:t._lineBreaker_t,lineBreaker_b:t._lineBreaker_b,resizeBackground:t._resizeBack,_stickyDummy:t._stickyDummy,_arrow:t._arrow,_focusTemp:t._focusTemp},tool:{cover:t._toolBar.querySelector(".se-toolbar-cover"),bold:t._toolBar.querySelector('[data-command="bold"]'),underline:t._toolBar.querySelector('[data-command="underline"]'),italic:t._toolBar.querySelector('[data-command="italic"]'),strike:t._toolBar.querySelector('[data-command="strike"]'),sub:t._toolBar.querySelector('[data-command="SUB"]'),sup:t._toolBar.querySelector('[data-command="SUP"]'),undo:t._toolBar.querySelector('[data-command="undo"]'),redo:t._toolBar.querySelector('[data-command="redo"]'),save:t._toolBar.querySelector('[data-command="save"]'),outdent:t._toolBar.querySelector('[data-command="outdent"]'),indent:t._toolBar.querySelector('[data-command="indent"]'),fullScreen:t._toolBar.querySelector('[data-command="fullScreen"]'),showBlocks:t._toolBar.querySelector('[data-command="showBlocks"]'),codeView:t._toolBar.querySelector('[data-command="codeView"]'),dir:t._toolBar.querySelector('[data-command="dir"]'),dir_ltr:t._toolBar.querySelector('[data-command="dir_ltr"]'),dir_rtl:t._toolBar.querySelector('[data-command="dir_rtl"]')},options:n,option:n}},z={name:"notice",add:function(e){const t=e.context;t.notice={};let n=e.util.createElement("DIV"),i=e.util.createElement("SPAN"),l=e.util.createElement("BUTTON");n.className="se-notice",l.className="close",l.setAttribute("aria-label","Close"),l.setAttribute("title",e.lang.dialogBox.close),l.innerHTML=e.icons.cancel,n.appendChild(i),n.appendChild(l),t.notice.modal=n,t.notice.message=i,l.addEventListener("click",this.onClick_cancel.bind(e)),t.element.editorArea.appendChild(n),n=null},onClick_cancel:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.notice.close.call(this)},open:function(e){this.context.notice.message.textContent=e,this.context.notice.modal.style.display="block"},close:function(){this.context.notice.modal.style.display="none"}},M={init:function(e){return{create:function(t,n){return this.create(t,n,e)}.bind(this)}},create:function(e,t,n){L._propertiesInit(),"object"!=typeof t&&(t={}),n&&(t=[n,t].reduce((function(e,t){for(let n in t)if(L.hasOwn(t,n))if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:Object.keys(i).map((function(e){return i[e]})),l=l.length?l:Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}));const i="string"==typeof e?document.getElementById(e):e;if(!i){if("string"==typeof e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+e+'")');throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element or id value")}const l=B.init(i,t);if(l.constructed._top.id&&document.getElementById(l.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+l.constructed._top.id+'")');return function(e,t,n,i,l,o){const s=e.element.originElement.ownerDocument||document,a=s.defaultView||window,r=L,c=l.icons,d={_d:s,_w:a,_parser:new a.DOMParser,_prevRtl:l.rtl,_editorHeight:0,_editorHeightPadding:0,_listCamel:l.__listCommonStyle,_listKebab:r.camelToKebabCase(l.__listCommonStyle),__focusTemp:e.element._focusTemp,_wd:null,_ww:null,_shadowRoot:null,_shadowRootControllerEventTarget:null,util:r,functions:null,options:null,wwComputedStyle:null,notice:z,icons:c,history:null,context:e,pluginCallButtons:t,plugins:n||{},initPlugins:{},_targetPlugins:{},_menuTray:{},lang:i,effectNode:null,submenu:null,container:null,_submenuName:"",_bindedSubmenuOff:null,_bindedContainerOff:null,submenuActiveButton:null,containerActiveButton:null,controllerArray:[],currentControllerName:"",currentControllerTarget:null,currentFileComponentInfo:null,codeViewDisabledButtons:[],resizingDisabledButtons:[],_moreLayerActiveButton:null,_htmlCheckWhitelistRegExp:null,_htmlCheckBlacklistRegExp:null,_disallowedTextTagsRegExp:null,editorTagsWhitelistRegExp:null,editorTagsBlacklistRegExp:null,pasteTagsWhitelistRegExp:null,pasteTagsBlacklistRegExp:null,hasFocus:!1,isDisabled:!1,isReadOnly:!1,_attributesWhitelistRegExp:null,_attributesWhitelistRegExp_all_data:null,_attributesBlacklistRegExp:null,_attributesTagsWhitelist:null,_attributesTagsBlacklist:null,_bindControllersOff:null,_isInline:null,_isBalloon:null,_isBalloonAlways:null,_inlineToolbarAttr:{top:"",width:"",isShow:!1},_notHideToolbar:!1,_sticky:!1,_antiBlur:!1,_lineBreaker:null,_lineBreakerButton:null,_componentsInfoInit:!0,_componentsInfoReset:!1,activePlugins:null,managedTagsInfo:null,_charTypeHTML:!1,_fileInfoPluginsCheck:null,_fileInfoPluginsReset:null,_fileManager:{tags:null,regExp:null,queryString:null,pluginRegExp:null,pluginMap:null},commandMap:{},_commandMapStyles:{STRONG:["font-weight"],U:["text-decoration"],EM:["font-style"],DEL:["text-decoration"]},_styleCommandMap:null,_cleanStyleRegExp:{div:new a.RegExp("\\s*[^-a-zA-Z](.+)\\s*:[^;]+(?!;)*","ig"),span:new a.RegExp("\\s*[^-a-zA-Z](font-family|font-size|color|background-color)\\s*:[^;]+(?!;)*","ig"),format:new a.RegExp("\\s*[^-a-zA-Z](text-align|margin-left|margin-right|width|height|line-height)\\s*:[^;]+(?!;)*","ig"),fontSizeUnit:new a.RegExp("\\d+"+l.fontSizeUnit+"$","i")},_variable:{isChanged:!1,isCodeView:!1,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,codeIndent:2,minResizingSize:r.getNumber(e.element.wysiwygFrame.style.minHeight||"65",0),currentNodes:[],currentNodesMap:[],_range:null,_selectionNode:null,_originCssText:e.element.topArea.style.cssText,_bodyOverflow:"",_editorAreaOriginCssText:"",_wysiwygOriginCssText:"",_codeOriginCssText:"",_fullScreenAttrs:{sticky:!1,balloon:!1,inline:!1},_lineBreakComp:null,_lineBreakDir:""},_formatAttrsTemp:null,_saveButtonStates:function(){this.allCommandButtons||(this.allCommandButtons={});const e=this.context.element._buttonTray.querySelectorAll(".se-menu-list button[data-display]");for(let t,n,i=0;ie?c-e:0,l=i>0?0:e-c;n.style.left=d-i+l+"px",s.left>u._getEditorOffsets(n).left&&(n.style.left="0px")}else{const e=o<=c?0:o-(d+c);n.style.left=e<0?d+e+"px":d+"px"}let h=0,g=t;for(;g&&g!==i;)h+=g.offsetTop,g=g.offsetParent;const p=h;this._isBalloon?h+=i.offsetTop+t.offsetHeight:h-=t.offsetHeight;const m=s.top,f=n.offsetHeight,_=this.getGlobalScrollOffset().top,b=a.innerHeight-(m-_+p+t.parentElement.offsetHeight);if(bb?(n.style.height=l+"px",e=-1*(l-p+3)):(n.style.height=b+"px",e=p+t.parentElement.offsetHeight),n.style.top=e+"px"}else n.style.top=p+t.parentElement.offsetHeight+"px";n.style.visibility=""},controllersOn:function(){this._bindControllersOff&&this._bindControllersOff(),this.controllerArray=[];for(let e,t=0;t0)for(let e=0;e0){for(let e=0;eu?d-u:0,i=n>0?0:u-d;t.style.left=c-n+i+"px",n>0&&h&&(h.style.left=(d-14<10+n?d-14:10+n)+"px");const l=e.element.wysiwygFrame.offsetLeft-t.offsetLeft;l>0&&(t.style.left="0px",h&&(h.style.left=l+"px"))}else{t.style.left=c+"px";const n=e.element.wysiwygFrame.offsetWidth-(t.offsetLeft+d);n<0?(t.style.left=t.offsetLeft+n+"px",h&&(h.style.left=20-n+"px")):h&&(h.style.left="20px")}t.style.visibility=""},execCommand:function(e,t,n){this._wd.execCommand(e,t,"formatBlock"===e?"<"+n+">":n),this.history.push(!0)},nativeFocus:function(){this.__focus(),this._editorRange()},__focus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this.nativeFocus();else try{const t=this.getRange();if(t.startContainer===t.endContainer&&r.isWysiwygDiv(t.startContainer)){const n=t.commonAncestorContainer.children[t.startOffset];if(!r.isFormatElement(n)&&!r.isComponent(n)){const t=r.createElement(l.defaultTag),i=r.createElement("BR");return t.appendChild(i),e.element.wysiwyg.insertBefore(t,n),void this.setRange(i,0,i,0)}}this.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(e){this.nativeFocus()}u._applyTagEffects(),this._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(t){t||(t=e.element.wysiwyg.lastElementChild);const n=this.getFileComponent(t);n?this.selectComponent(n.target,n.pluginName):t?(t=r.getChildElement(t,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus():this.focus()},blur:function(){l.iframe?e.element.wysiwygFrame.blur():e.element.wysiwyg.blur()},setRange:function(e,t,n,i){if(!e||!n)return;(r.isBreak(e)||3===e.nodeType)&&t>e.textContent.length&&(t=e.textContent.length),(r.isBreak(n)||3===n.nodeType)&&i>n.textContent.length&&(i=n.textContent.length),r.isFormatElement(e)&&(e=e.childNodes[t>0?e.childNodes.length-1:0]||e,t=t>0?1!==e.nodeType||r.isBreak(e)?e.textContent?e.textContent.length:0:1:0),r.isFormatElement(n)&&(n=n.childNodes[i>0?n.childNodes.length-1:0]||n,i=i>0?1!==n.nodeType||r.isBreak(n)?n.textContent?n.textContent.length:0:1:0);const o=this._wd.createRange();try{t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length),o.setStart(e,t),o.setEnd(n,i)}catch(e){return console.warn("[SUNEDITOR.core.focus.error] "+e),void this.nativeFocus()}const s=this.getSelection();return s.removeAllRanges&&s.removeAllRanges(),s.addRange(o),this._rangeInfo(o,this.getSelection()),l.iframe&&this.__focus(),o},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.hasFocus&&this.getSelection().removeAllRanges(),this._setKeyEffect([])},getRange:function(){const t=this._variable._range||this._createDefaultRange(),n=this.getSelection();if(t.collapsed===n.isCollapsed||!e.element.wysiwyg.contains(n.focusNode))return t;if(n.rangeCount>0)return this._variable._range=n.getRangeAt(0),this._variable._range;{const e=n.anchorNode,t=n.focusNode,i=n.anchorOffset,l=n.focusOffset,o=r.compareElements(e,t),s=o.ancestor&&(0===o.result?i<=l:o.result>1);return this.setRange(s?e:t,s?i:l,s?t:e,s?l:i)}},getRange_addLine:function(t,n){if(this._selectionVoid(t)){const i=e.element.wysiwyg,o=r.createElement(l.defaultTag);o.innerHTML="
",i.insertBefore(o,n&&n!==i?n.nextElementSibling:i.firstElementChild),this.setRange(o.firstElementChild,0,o.firstElementChild,1),t=this._variable._range}return t},getSelection:function(){const t=this._shadowRoot&&this._shadowRoot.getSelection?this._shadowRoot.getSelection():this._ww.getSelection();return this._variable._range||e.element.wysiwyg.contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t},getSelectionNode:function(){if(e.element.wysiwyg.contains(this._variable._selectionNode)||this._editorRange(),!this._variable._selectionNode){const t=r.getChildElement(e.element.wysiwyg.firstChild,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1);if(t)return this._variable._selectionNode=t,t;this._editorRange()}return this._variable._selectionNode},_editorRange:function(){const e=this._wd.activeElement;if(r.isInputElement(e))return this._variable._selectionNode=e,e;const t=this.getSelection();if(!t)return null;let n=null;n=t.rangeCount>0?t.getRangeAt(0):this._createDefaultRange(),this._rangeInfo(n,t)},_rangeInfo:function(e,t){let n=null;this._variable._range=e,n=e.collapsed?r.isWysiwygDiv(e.commonAncestorContainer)&&e.commonAncestorContainer.children[e.startOffset]||e.commonAncestorContainer:t.extentNode||t.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){const t=e.element.wysiwyg,n=this._wd.createRange();let i=t.firstElementChild,o=null;return i?(o=i.firstChild,o||(o=r.createElement("BR"),i.appendChild(o))):(i=r.createElement(l.defaultTag),o=r.createElement("BR"),i.appendChild(o),t.appendChild(i)),n.setStart(o,0),n.setEnd(o,0),n},_selectionVoid:function(e){const t=e.commonAncestorContainer;return r.isWysiwygDiv(e.startContainer)&&r.isWysiwygDiv(e.endContainer)||/FIGURE/i.test(t.nodeName)||this._fileManager.regExp.test(t.nodeName)||r.isMediaComponent(t)},_resetRangeToTextNode:function(){const t=this.getRange();if(this._selectionVoid(t))return!1;const n=t.collapsed;let i,o,s,a=t.startContainer,c=t.startOffset,d=t.endContainer,u=t.endOffset;if(r.isFormatElement(a))for(a.childNodes[c]?(a=a.childNodes[c]||a,c=0):(a=a.lastChild||a,c=a.textContent.length);a&&1===a.nodeType&&a.firstChild;)a=a.firstChild||a,c=0;if(r.isFormatElement(d)){for(d=d.childNodes[u]||d.lastChild||d;d&&1===d.nodeType&&d.lastChild;)d=d.lastChild;u=n?0:d.textContent.length}if(i=r.isWysiwygDiv(a)?e.element.wysiwyg.firstChild:a,o=c,r.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const e=r.isBreak(i);if(!e){for(;i&&!r.isBreak(i)&&1===i.nodeType;)i=i.childNodes[o]||i.nextElementSibling||i.nextSibling,o=0;let e=r.getFormatElement(i,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.getParentElement(i,r.isCell)?"DIV":l.defaultTag),i.parentNode.insertBefore(e,i),e.appendChild(i))}if(r.isBreak(i)){const t=r.createTextNode(r.zeroWidthSpace);i.parentNode.insertBefore(t,i),i=t,e&&a===d&&(d=i,u=1)}}if(a=i,c=o,i=r.isWysiwygDiv(d)?e.element.wysiwyg.lastChild:d,o=u,r.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const e=r.isBreak(i);if(!e){for(;i&&!r.isBreak(i)&&1===i.nodeType&&(s=i.childNodes,0!==s.length);)i=s[o>0?o-1:o]||!/FIGURE/i.test(s[0].nodeName)?s[0]:i.previousElementSibling||i.previousSibling||a,o=o>0?i.textContent.length:o;let e=r.getFormatElement(i,null);e===r.getRangeFormatElement(e,null)&&(e=r.createElement(r.isCell(e)?"DIV":l.defaultTag),i.parentNode.insertBefore(e,i),e.appendChild(i))}if(r.isBreak(i)){const t=r.createTextNode(r.zeroWidthSpace);i.parentNode.insertBefore(t,i),i=t,o=1,e&&!i.previousSibling&&r.removeItem(d)}}return d=i,u=o,this.setRange(a,c,d,u),!0},getSelectedElements:function(t){if(!this._resetRangeToTextNode())return[];let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return[];this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,o=n.commonAncestorContainer,s=r.getListChildren(o,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(o)||r.isRangeFormatElement(o)||s.unshift(r.getFormatElement(o,null)),i===l||1===s.length)return s;let a=r.getFormatElement(i,null),c=r.getFormatElement(l,null),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=s.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t,n){return 1===e.nodeType&&!e.textContent.length||("end"!==n&&0===t||(!n||"start"!==n)&&!e.nodeValue&&1===t||(!n||"end"===n)&&!!e.nodeValue&&t===e.nodeValue.length)},_isEdgeFormat:function(e,t,n){if(!this.isEdgePoint(e,t,n))return!1;const i=[];for(n="start"===n?"previousSibling":"nextSibling";e&&!r.isFormatElement(e)&&!r.isWysiwygDiv(e);){if(e[n]&&(!r.isBreak(e[n])||e[n][n]))return null;1===e.nodeType&&i.push(e.cloneNode(!1)),e=e.parentNode}return i},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){if(!e||!e.parentNode)return null;const n=r.getFormatElement(this.getSelectionNode(),null);let i=null;if(!r.isFormatElement(e)&&r.isFreeFormatElement(n||e.parentNode))i=r.createElement("BR");else{const e=t?"string"==typeof t?t:t.nodeName:!r.isFormatElement(n)||r.isRangeFormatElement(n)||r.isFreeFormatElement(n)?l.defaultTag:n.nodeName;i=r.createElement(e),i.innerHTML="
",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(i,t||n,["id"])}return r.isCell(e)?e.insertBefore(i,e.nextElementSibling):e.parentNode.insertBefore(i,e.nextElementSibling),i},insertComponent:function(e,t,n,i){if(this.isReadOnly||n&&!this.checkCharCount(e,null))return null;const l=this.removeNode();this.getRange_addLine(this.getRange(),l.container);let o=null,s=this.getSelectionNode(),a=r.getFormatElement(s,null);if(r.isListCell(a))this.insertNode(e,s===a?null:(s||l.container).nextSibling,!1),e.nextSibling||e.parentNode.appendChild(r.createElement("BR"));else{if(this.getRange().collapsed&&(3===l.container.nodeType||r.isBreak(l.container))){const e=r.getParentElement(l.container,function(e){return this.isRangeFormatElement(e)}.bind(r));o=r.splitElement(l.container,l.offset,e?r.getElementDepth(e)+1:0),o&&(a=o.previousSibling)}this.insertNode(e,r.isRangeFormatElement(a)?null:a,!1),a&&r.onlyZeroWidthSpace(a)&&r.removeItem(a)}if(!i){this.setRange(e,0,e,0);const t=this.getFileComponent(e);t?this.selectComponent(t.target,t.pluginName):o&&(o=r.getEdgeChildNodes(o,null).sc||o,this.setRange(o,0,o,0))}return t||this.history.push(1),o||e},getFileComponent:function(e){if(!this._fileManager.queryString||!e)return null;let t,n;return(/^FIGURE$/i.test(e.nodeName)||/se-component/.test(e.className))&&(t=e.querySelector(this._fileManager.queryString)),!t&&e.nodeName&&this._fileManager.regExp.test(e.nodeName)&&(t=e),t&&(n=this._fileManager.pluginMap[t.nodeName.toLowerCase()],n)?{target:t,component:r.getParentElement(t,r.isComponent),pluginName:n}:null},selectComponent:function(e,t){if(r.isUneditableComponent(r.getParentElement(e,r.isComponent))||r.isUneditableComponent(e))return!1;this.hasFocus||this.focus();const n=this.plugins[t];n&&a.setTimeout(function(){"function"==typeof n.select&&this.callPlugin(t,n.select.bind(this,e),null),this._setComponentLineBreaker(e)}.bind(this))},_setComponentLineBreaker:function(t){this._lineBreaker.style.display="none";const n=r.getParentElement(t,r.isComponent);if(!n)return;const i=e.element.lineBreaker_t.style,l=e.element.lineBreaker_b.style,o="block"===this.context.resizing.resizeContainer.style.display?this.context.resizing.resizeContainer:t,s=r.isListCell(n.parentNode);let a,c,d;(s?n.previousSibling&&!r.isComponent(n.previousElementSibling):r.isFormatElement(n.previousElementSibling))?i.display="none":(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2,i.top=a-c-12+"px",i.left=r.getOffset(o).left+d+"px",i.display="block"),(s?n.nextSibling&&!r.isComponent(n.nextElementSibling):r.isFormatElement(n.nextElementSibling))?l.display="none":(a||(this._variable._lineBreakComp=n,c=e.element.wysiwyg.scrollTop,a=r.getOffset(t,e.element.wysiwygFrame).top+c,d=o.offsetWidth/2/2),l.top=a+o.offsetHeight-c-12+"px",l.left=r.getOffset(o).left+o.offsetWidth-d-24+"px",l.display="block")},_checkDuplicateNode:function(e,t){!function e(n){d._dupleCheck(n,t);const i=n.childNodes;for(let t=0,n=i.length;t-1&&n.splice(e,1);for(let t=0,n=o.classList.length;tb?f.splitText(b):f.nextSibling;else if(r.isBreak(o))n=o,o=o.parentNode;else{let e=o.childNodes[_];const i=e&&3===e.nodeType&&r.onlyZeroWidthSpace(e)&&r.isBreak(e.nextSibling)?e.nextSibling:e;i?!i.nextSibling&&r.isBreak(i)?(o.removeChild(i),n=null):n=r.isBreak(i)&&!r.isBreak(t)?i:i.nextSibling:n=null}else{if(y===C){n=this.isEdgePoint(C,b)?C.nextSibling:C.splitText(b);let e=y;this.isEdgePoint(y,_)||(e=y.splitText(_)),o.removeChild(e),0===o.childNodes.length&&m&&(o.innerHTML="
")}else{const e=this.removeNode(),i=e.container,s=e.prevContainer;if(i&&0===i.childNodes.length&&m&&(r.isFormatElement(i)?i.innerHTML="
":r.isRangeFormatElement(i)&&(i.innerHTML="<"+l.defaultTag+">
")),r.isListCell(i)&&3===t.nodeType)o=i,n=null;else if(!m&&s)if(o=3===s.nodeType?s.parentNode:s,o.contains(i)){let e=!0;for(n=i;n.parentNode&&n.parentNode!==o;)n=n.parentNode,e=!1;e&&i===s&&(n=n.nextSibling)}else n=null;else r.isWysiwygDiv(i)&&!r.isFormatElement(t)?(o=i.appendChild(r.createElement(l.defaultTag)),n=null):o=(n=m?C:i===s?i.nextSibling:i)&&n.parentNode?n.parentNode:f;for(;n&&!r.isFormatElement(n)&&n.parentNode!==f;)n=n.parentNode}}try{if(!h){if((r.isWysiwygDiv(n)||o===e.element.wysiwyg.parentNode)&&(o=e.element.wysiwyg,n=null),r.isFormatElement(t)||r.isRangeFormatElement(t)||!r.isListCell(o)&&r.isComponent(t)){const e=o;if(r.isList(n))o=n,n=null;else if(r.isListCell(n))o=n.previousElementSibling||n;else if(!s&&!n){const e=this.removeNode(),t=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container,null))?e.container:r.getFormatElement(e.container,null)||e.container.parentNode:e.container,i=r.isWysiwygDiv(t)||r.isRangeFormatElement(t);o=i?t:t.parentNode,n=i?null:t.nextSibling}0===e.childNodes.length&&o!==e&&r.removeItem(e)}if(!m||p||r.isRangeFormatElement(o)||r.isListCell(o)||r.isWysiwygDiv(o)||(n=o.nextElementSibling,o=o.parentNode),r.isWysiwygDiv(o)&&(3===t.nodeType||r.isBreak(t))){const e=r.createElement(l.defaultTag);e.appendChild(t),c=t,t=e}}if(h?g.parentNode?(o=g,n=a):(o=e.element.wysiwyg,n=null):n=o===n?o.lastChild:n,r.isListCell(t)&&!r.isList(o)){if(r.isListCell(o))n=o.nextElementSibling,o=o.parentNode;else{const e=r.createElement("ol");o.insertBefore(e,n),o=e,n=null}h=!0}if(this._checkDuplicateNode(t,o),o.insertBefore(t,n),h)if(r.onlyZeroWidthSpace(u.textContent.trim()))r.removeItem(u),t=t.lastChild;else{const e=r.getArrayItem(u.children,r.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(o.appendChild(t),t=o),r.onlyZeroWidthSpace(u.textContent.trim())&&r.removeItem(u))}}catch(e){o.appendChild(t),console.warn("[SUNEDITOR.insertNode.warn] "+e)}finally{c&&(t=c);const e=o.querySelectorAll("[data-se-duple]");if(e.length>0)for(let n,i,l,o,s=0,a=e.length;s0&&y>-1&&C>-1){for(let e=y+1,t=h;e>=0;e--)v[e]===t.parentNode&&v[e].firstChild===t&&0===p&&(y=e,t=t.parentNode);for(let e=C-1,t=g;e>y;e--)v[e]===t.parentNode&&1===v[e].nodeType&&(v.splice(e,1),t=t.parentNode,--C)}else{if(0===v.length){if(r.isFormatElement(f)||r.isRangeFormatElement(f)||r.isWysiwygDiv(f)||r.isBreak(f)||r.isMedia(f))return{container:f,offset:0};if(3===f.nodeType)return{container:f,offset:m};v.push(f),h=g=f}else if(h=g=v[0],r.isBreak(h)||r.onlyZeroWidthSpace(h))return{container:r.isMedia(f)?f:h,offset:0};y=C=0}for(let e=y;e<=C;e++){const t=v[e];if(0===t.length||3===t.nodeType&&void 0===t.data)this._nodeRemoveListItem(t);else if(t!==h)if(t!==g)this._nodeRemoveListItem(t);else{if(1===g.nodeType){if(r.isComponent(g))continue;b=r.createTextNode(g.textContent)}else b=r.createTextNode(g.substringData(m,g.length-m));b.length>0?g.data=b.data:this._nodeRemoveListItem(g)}else{if(1===h.nodeType){if(r.isComponent(h))continue;_=r.createTextNode(h.textContent)}else t===g?(_=r.createTextNode(h.substringData(0,p)+g.substringData(m,g.length-m)),u=p):_=r.createTextNode(h.substringData(0,p));if(_.length>0?h.data=_.data:this._nodeRemoveListItem(h),t===g)break}}const w=r.getParentElement(g,"ul"),x=r.getParentElement(h,"li");if(w&&x&&x.contains(w)?(c=w.previousSibling,u=c.textContent.length):(c=g&&g.parentNode?g:h&&h.parentNode?h:t.endContainer||t.startContainer,u=n||i?i?c.textContent.length:0:u),!r.isWysiwygDiv(c)&&0===c.childNodes.length){const t=r.removeItemAllParents(c,null,null);t&&(c=t.sc||t.ec||e.element.wysiwyg)}return r.getFormatElement(c)||h&&h.parentNode||(a?(c=a,u=0):s&&(c=s,u=1)),this.setRange(c,u,c,u),this.history.push(!0),{container:c,offset:u,prevContainer:o}},_nodeRemoveListItem:function(e){const t=r.getFormatElement(e,null);r.removeItem(e),r.isListCell(t)&&(r.removeItemAllParents(t,null,null),t&&r.isList(t.firstChild)&&t.insertBefore(r.createTextNode(r.zeroWidthSpace),t.firstChild))},applyRangeFormatElement:function(e){this.getRange_addLine(this.getRange(),null);const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,o,s,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,o=t.indexOf(i),s=t.indexOf(l),t.splice(o,s-o+1),c=t.length}else;let n,i,l,o=t[t.length-1];n=r.isRangeFormatElement(o)||r.isFormatElement(o)?o:r.getRangeFormatElement(o,null)||r.getFormatElement(o,null),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let s=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,o,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],o=n.parentNode,o&&!e.contains(o))if(u=r.getElementDepth(n),r.isList(o)){if(null===a&&(p?(a=p,m=!0,p=null):a=o.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==o){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=o.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(o,c,null,!0,!0);s>=u?(s=u,l=_.cc,i=d(l,o,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(s=u,l=o,i=n.nextSibling),e.appendChild(n),l!==o&&(h=d(l,o),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,o){const s=this.getRange();let a=s.startOffset,c=s.endOffset,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),u=e.parentNode,h=null,g=null,p=e.cloneNode(!1);const m=[],f=r.isList(n);let _=!1,b=!1,v=!1;function y(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace,a=c=1),3===n.nodeType)return t.insertBefore(n,i),n;const o=(v?n:l).childNodes;let s=n.cloneNode(!1),d=null,u=null;for(;o[0];)u=o[0],!r._notTextNode(u)||r.isBreak(u)||r.isListCell(s)?s.appendChild(u):(s.childNodes.length>0&&(d||(d=s),t.insertBefore(s,i),s=n.cloneNode(!1)),t.insertBefore(u,i),d||(d=u));if(s.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(s)&&r.isList(i))if(f){for(d=i;i;)s.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(s,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);if(e!==n||t!==l.nextElementSibling){const t=s.childNodes;for(;t[0];)l.appendChild(t[0]);e=n,b=!0}}else t.insertBefore(s,i);d||(d=s)}return d}for(let o,s,a,c=0,C=d.length;c0&&(u.insertBefore(p,e),p=null),!f&&r.isListCell(o))if(a&&r.getElementDepth(o)!==r.getElementDepth(a)&&(r.isListCell(u)||r.getArrayItem(o.children,r.isList,!1))){const t=o.nextElementSibling,n=r.detachNestedList(o,!1);e===n&&t===o.nextElementSibling||(e=n,b=!0)}else{const t=o;o=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":l.defaultTag);const n=r.isListCell(o),s=t.childNodes;for(;s[0]&&(!r.isList(s[0])||n);)o.appendChild(s[0]);r.copyFormatAttributes(o,t),v=!0}else o=o.cloneNode(!1);if(!b&&(i?(m.push(o),r.removeItem(d[c])):(n?(_||(u.insertBefore(n,e),_=!0),o=y(n,o,null,d[c])):o=y(u,o,e,d[c]),b||(t?(g=o,h||(h=o)):h||(h=g=o))),b)){b=v=!1,d=r.getListChildNodes(e,(function(t){return t.parentNode===e})),p=e.cloneNode(!1),u=e.parentNode,c=-1,C=d.length;continue}}const C=e.parentNode;let w=e.nextSibling;p&&p.children.length>0&&C.insertBefore(p,w),n?h=n.previousSibling:h||(h=e.previousSibling),w=e.nextSibling!==p?e.nextSibling:p?p.nextSibling:null,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null,!1);let x=null;if(i)x={cc:C,sc:h,so:a,ec:w,eo:c,removeArray:m};else{h||(h=g),g||(g=h);const e=r.getEdgeChildNodes(h,g.parentNode?h:g);x={cc:(e.sc||e.ec).parentNode,sc:e.sc,so:a,ec:e.ec,eo:c,removeArray:null}}if(this.effectNode=null,o)return x;!i&&x&&(t?this.setRange(x.sc,a,x.ec,c):this.setRange(x.sc,0,x.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,o=null,s=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const o=!e,s=o&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(s&&l.collapsed&&r.isFormatElement(c.parentNode)||c===u&&1===c.nodeType&&r.isNonEditable(c)){const e=c.parentNode;if(!r.isListCell(e)||!r.getValues(e.style).some(function(e){return this._listKebab.indexOf(e)>-1}.bind(this)))return}if(l.collapsed&&!s&&1===c.nodeType&&!r.isBreak(c)&&!r.isComponent(c)){let e=null;const t=c.childNodes[d];t&&(e=t.nextSibling?r.isBreak(t)?t:t.nextSibling:null);const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d]||c.firstChild,d=0),r.isFormatElement(u)&&(u=u.childNodes[h]||u.lastChild,h=u.textContent.length),o&&(e=r.createElement("DIV"));const g=a.RegExp,p=e.nodeName;if(!s&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let m,f={},_={},b="",v="",y="";if(t){for(let e,n=0,i=t.length;n0&&(a=l.replace(b,"").trim(),a!==l&&(w.v=!0));const c=t.className;let d="";return v&&c.length>0&&(d=c.replace(v,"").trim(),d!==c&&(w.v=!0)),(!o||!v&&c||!b&&l||a||d||!n)&&(a||d||t.nodeName!==p||C(b)!==C(l)||C(v)!==C(c))?(b&&l.length>0&&(t.style.cssText=a),t.style.cssText||t.removeAttribute("style"),v&&c.length>0&&(t.className=d.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==p&&!n?t:(w.v=!0,null)):(w.v=!0,null)},E=this.getSelectedElements(null);l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset,r.getFormatElement(c,null)||(c=r.getChildElement(E[0],(function(e){return 3===e.nodeType}),!1),d=0),r.getFormatElement(u,null)||(u=r.getChildElement(E[E.length-1],(function(e){return 3===e.nodeType}),!1),h=u.textContent.length);const S=r.getFormatElement(c,null)===r.getFormatElement(u,null),N=E.length-(S?0:1);m=e.cloneNode(!1);const T=s||o&&function(e){for(let t=0,n=e.length;t0&&this._resetCommonListCell(E[N],t)&&(n=!0),this._resetCommonListCell(E[0],t)&&(n=!0),n&&this.setRange(c,d,u,h),N>0&&(m=e.cloneNode(!1),_=this._nodeChange_endLine(E[N],m,x,u,h,s,o,w,L,B));for(let n,i=N-1;i>0;i--)this._resetCommonListCell(E[i],t),m=e.cloneNode(!1),n=this._nodeChange_middleLine(E[i],m,x,s,o,w,_.container),n.endContainer&&n.ancestor.contains(n.endContainer)&&(_.ancestor=null,_.container=n.endContainer),this._setCommonListStyle(n.ancestor,null);m=e.cloneNode(!1),f=this._nodeChange_startLine(E[0],m,x,c,d,s,o,w,L,B,_.container),f.endContainer&&(_.ancestor=null,_.container=f.endContainer),N<=0?_=f:_.container||(_.ancestor=null,_.container=f.container,_.offset=f.container.textContent.length),this._setCommonListStyle(f.ancestor,null),this._setCommonListStyle(_.ancestor||r.getFormatElement(_.container),null)}this.controllersOff(),this.setRange(f.container,f.offset,_.container,_.offset),this.history.push(!1)},_resetCommonListCell:function(e,t){if(!r.isListCell(e))return;t||(t=this._listKebab);const n=r.getArrayItem(e.childNodes,(function(e){return!r.isBreak(e)}),!0),i=e.style,o=[],s=[],a=r.getValues(i);for(let e=0,n=this._listKebab.length;e-1&&t.indexOf(this._listKebab[e])>-1&&(o.push(this._listCamel[e]),s.push(this._listKebab[e]));if(!o.length)return;const c=r.createElement("SPAN");for(let e=0,t=o.length;e0&&(e.insertBefore(d,u),d=c.cloneNode(!1),u=null,h=!0));return d.childNodes.length>0&&(e.insertBefore(d,u),h=!0),i.length||e.removeAttribute("style"),h},_setCommonListStyle:function(e,t){if(!r.isListCell(e))return;const n=r.getArrayItem((t||e).childNodes,(function(e){return!r.isBreak(e)}),!0);if(!(t=n[0])||n.length>1||1!==t.nodeType)return;const i=t.style,o=e.style,s=t.nodeName.toLowerCase();let a=!1;l._textTagsMap[s]===l._defaultCommand.bold.toLowerCase()&&(o.fontWeight="bold"),l._textTagsMap[s]===l._defaultCommand.italic.toLowerCase()&&(o.fontStyle="italic");const c=r.getValues(i);if(c.length>0)for(let e=0,t=this._listCamel.length;e-1&&(o[this._listCamel[e]]=i[this._listCamel[e]],i.removeProperty(this._listKebab[e]),a=!0);if(this._setCommonListStyle(e,t),a&&!i.length){const e=t.childNodes,n=t.parentNode,i=t.nextSibling;for(;e.length>0;)n.insertBefore(e[0],i);r.removeItem(t)}},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t,n){return!n||e?null:this.getParentElement(n,this._isMaintainedNode.bind(this))||(t?null:this.getParentElement(n,this._isSizeNode.bind(this)))},_util_isMaintainedNode:function(e,t,n){if(!n||e||1!==n.nodeType)return!1;const i=this._isMaintainedNode(n);return this.getParentElement(n,this._isMaintainedNode.bind(this))?i:i||!t&&this._isSizeNode(n)},_nodeChange_oneLine:function(e,t,n,i,l,o,s,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===o.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(o.textContent.slice(s))){const n=m.childNodes;let a=!0;for(let e,t,l,s,c=0,d=n.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const o=i.childNodes;for(let i,s=0,a=o.length;s=N?k-N:S.data.length-N));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(o)||l.appendChild(o);const c=g(l);for(c&&(E=c),E&&(e=E),C=a,y=[],x="";C!==e&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const d=y.pop()||s;for(w=C=d;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(t.appendChild(d),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),S=s,N=0,L=!0,C!==s&&C.appendChild(S),!v)continue}if(B||a!==T){if(L){if(1===a.nodeType&&!r.isBreak(a)){r._isIgnoreNodeChange(a)?(b.appendChild(a.cloneNode(!0)),u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(a,a);continue}C=a,y=[],x="";const o=[];for(;null!==C.parentNode&&C!==f&&C!==t;)i=B?C.cloneNode(!1):n(C),1===C.nodeType&&!r.isBreak(a)&&i&&z(C)&&(p(C)?E||o.push(i):y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;y=y.concat(o);const s=y.pop()||a;for(w=C=s;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!p(t.parentNode)||p(s)||r.onlyZeroWidthSpace(t)||(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),B||E||!p(s))s===a?l=B?b:t:B?(b.appendChild(s),l=C):(t.appendChild(s),l=C);else{t=t.cloneNode(!1);const e=s.childNodes;for(let n=0,i=e.length;n0?C:t}if(E&&3===a.nodeType)if(g(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}d=a.cloneNode(!1),l.appendChild(d),1!==a.nodeType||r.isBreak(a)||(h=d),e(a,h)}else{E=g(a);const e=r.createTextNode(1===T.nodeType?"":T.substringData(k,T.length-k)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,k));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){C=a,x="",y=[];const t=[];for(;C!==b&&C!==f&&null!==C;)1===C.nodeType&&z(C)&&(p(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;for(y=y.concat(t),d=w=C=y.pop()||e;y.length>0;)C=y.pop(),w.appendChild(C),w=C;b.appendChild(d),C.textContent=e.data}if(E&&d){const e=g(d);e&&(E=e)}for(C=a,y=[],x="";C!==b&&C!==f&&null!==C;)i=p(C)?null:n(C),i&&1===C.nodeType&&z(C)&&(y.push(i),x+=C.style.cssText.substr(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentNode;const o=y.pop()||l;for(w=C=o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;E?((t=t.cloneNode(!1)).appendChild(o),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(o),T=l,k=l.data.length,B=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),C!==l&&C.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{ancestor:e,startContainer:i,startOffset:l,endContainer:o,endOffset:s};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?S=T=t:(S=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(S=T=t)}r.removeEmptyNode(b,t,!1),u&&(N=S.textContent.length,k=T.textContent.length);const M=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=S),k=M?T.textContent.length:k;const I={s:0,e:0},H=r.getNodePath(S,b,I),R=!T.parentNode;R&&(T=S);const D={s:0,e:0},O=r.getNodePath(T,b,R||M?null:D);N+=I.s,k=u?N:R?S.textContent.length:M?k+I.s:k+D.s;const F=r.mergeSameTags(b,[H,O],!0);return e.parentNode.replaceChild(b,e),S=r.getNodeFromPath(H,b),T=r.getNodeFromPath(O,b),{ancestor:b,startContainer:S,startOffset:N+F[0],endContainer:T,endOffset:k+F[1]}},_nodeChange_startLine:function(e,t,n,i,l,o,s,a,c,d,u){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||r.isFormatElement(h.parentNode)||r.isWysiwygDiv(h.parentNode))&&h.nodeName!==t.nodeName;)h=h.parentNode;if(!s&&h.nodeName===t.nodeName&&!r.isFormatElement(h)&&!h.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let n=!0,o=i.previousSibling;for(;o;){if(!r.onlyZeroWidthSpace(o)){n=!1;break}o=o.previousSibling}if(n)return r.copyTagAttributes(h,t),{ancestor:e,container:i,offset:l}}a.v=!1;const g=e,p=[t],m=e.cloneNode(!1);let f,_,b,v,y=i,C=l,w=!1;if(function e(i,l){const o=i.childNodes;for(let i,s,a=0,h=o.length;a0,y=f.pop()||h;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),m.appendChild(t),p.push(t)),!v&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)_=f.pop(),b.appendChild(_),b=_;d!==l?(t.appendChild(d),l=_):l=t,r.isBreak(h)&&t.appendChild(h.cloneNode(!1)),e.appendChild(t),y=s,C=0,w=!0,l.appendChild(y)}}}(e,m),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l,endContainer:u};if(o=o&&s)for(let e=0;e0&&u===h)return e.innerHTML=i.innerHTML,{ancestor:e,endContainer:n?r.getNodeFromPath(n,e):null}}o.v=!1;const a=e.cloneNode(!1),c=[t];let d=!0;if(function e(i,l){const o=i.childNodes;for(let i,u,h=0,g=o.length;h0&&(a.appendChild(t),t=t.cloneNode(!1)),u=g.cloneNode(!0),a.appendChild(u),a.appendChild(t),c.push(t),l=t,s&&g.contains(s)){const e=r.getNodePath(s,g);s=r.getNodeFromPath(e,u)}}}(e,t),d||l&&!i&&!o.v)return{ancestor:e,endContainer:s};if(a.appendChild(t),i&&l)for(let e=0;e0,u=m.pop()||a;for(_=f=u;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(u)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(u)){t=t.cloneNode(!1);const e=u.childNodes;for(let n=0,i=e.length;n0?f:t}else s?(t.insertBefore(u,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(C||a!==v)i=C?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const s=m.pop()||l;for(_=f=s;m.length>0;)f=m.pop(),_.appendChild(f),_=f;s!==l?(t.insertBefore(s,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=o,y=o.data.length,C=!0,l.insertBefore(v,l.firstChild)}}}(e,p),s&&!o&&!a.v)return{ancestor:e,container:i,offset:l};if(o=o&&s)for(let e=0;e-1?null:r.createElement(n);let d=n;/^SUB$/i.test(n)&&a.indexOf("SUP")>-1?d="SUP":/^SUP$/i.test(n)&&a.indexOf("SUB")>-1&&(d="SUB"),this.nodeChange(c,this._commandMapStyles[n]||null,[d],!1),this.focus()}},removeFormat:function(){this.nodeChange(null,null,null,null)},indent:function(e){const t=this.getRange(),n=this.getSelectedElements(null),i=[],o="indent"!==e,s=l.rtl?"marginRight":"marginLeft";let a=t.startContainer,c=t.endContainer,d=t.startOffset,u=t.endOffset;for(let e,t,l=0,a=n.length;l0&&this.plugins.list.editInsideList.call(this,o,i),this.effectNode=null,this.setRange(a,d,c,u),this.history.push(!1)},toggleDisplayBlocks:function(){const t=e.element.wysiwyg;r.toggleClass(t,"se-show-block"),r.hasClass(t,"se-show-block")?r.addClass(this._styleCommandMap.showBlocks,"active"):r.removeClass(this._styleCommandMap.showBlocks,"active"),this._resourcesStateChange()},toggleCodeView:function(){const t=this._variable.isCodeView;this.controllersOff(),r.setDisabledButtons(!t,this.codeViewDisabledButtons),t?(r.isNonEditable(e.element.wysiwygFrame)||this._setCodeDataToEditor(),e.element.wysiwygFrame.scrollTop=0,e.element.code.style.display="none",e.element.wysiwygFrame.style.display="block",this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height="0px"),this._variable.isCodeView=!1,this._variable.isFullScreen||(this._notHideToolbar=!1,/balloon|balloon-always/i.test(l.mode)&&(e.element._arrow.style.display="",this._isInline=!1,this._isBalloon=!0,u._hideToolbar())),this.nativeFocus(),r.removeClass(this._styleCommandMap.codeView,"active"),r.isNonEditable(e.element.wysiwygFrame)||(this.history.push(!1),this.history._resetCachingButton())):(this._setEditorDataToCodeView(),this._variable._codeOriginCssText=this._variable._codeOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: block"),this._variable._wysiwygOriginCssText=this._variable._wysiwygOriginCssText.replace(/(\s?display(\s+)?:(\s+)?)[a-zA-Z]+(?=;)/,"display: none"),this._variable.isFullScreen?e.element.code.style.height="100%":"auto"!==l.height||l.codeMirrorEditor||(e.element.code.style.height=e.element.code.scrollHeight>0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus(),r.addClass(this._styleCommandMap.codeView,"active")),this._checkPlaceholder(),this.isReadOnly&&r.setDisabledButtons(!0,this.resizingDisabledButtons),"function"==typeof h.toggleCodeView&&h.toggleCodeView(this._variable.isCodeView,this)},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html");if(!this.options.__allowedScriptTag){const t=e.head.children;for(let n=0,i=t.length;n0?this.convertContentsForEditor(t):"<"+l.defaultTag+">
"},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg,!1);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,o=e.element.editorArea,d=e.element.wysiwygFrame,g=e.element.code,p=this._variable;this.controllersOff();const m="none"===i.style.display||this._isInline&&!this._inlineToolbarAttr.isShow;p.isFullScreen?(p.isFullScreen=!1,d.style.cssText=p._wysiwygOriginCssText,g.style.cssText=p._codeOriginCssText,i.style.cssText="",o.style.cssText=p._editorAreaOriginCssText,n.style.cssText=p._originCssText,s.body.style.overflow=p._bodyOverflow,"auto"!==l.height||l.codeMirrorEditor||u._codeViewAutoHeight(),l.toolbarContainer&&l.toolbarContainer.appendChild(i),l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),p._fullScreenAttrs.sticky&&!l.toolbarContainer&&(p._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=p._fullScreenAttrs.inline,this._isBalloon=p._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),l.toolbarContainer&&r.removeClass(i,"se-toolbar-balloon"),u.onScroll_window(),t&&r.changeElement(t.firstElementChild,c.expansion),e.element.topArea.style.marginTop="",r.removeClass(this._styleCommandMap.fullScreen,"active")):(p.isFullScreen=!0,p._fullScreenAttrs.inline=this._isInline,p._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),l.toolbarContainer&&e.element.relative.insertBefore(i,o),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.maxWidth="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(p._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),p._bodyOverflow=s.body.style.overflow,s.body.style.overflow="hidden",p._editorAreaOriginCssText=o.style.cssText,p._wysiwygOriginCssText=d.style.cssText,p._codeOriginCssText=g.style.cssText,o.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+l._editorStyles.editor,g.style.cssText=(g.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=g.style.height="100%",i.style.position="relative",i.style.display="block",p.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,o.style.height=p.innerHeight_fullScreen-l.fullScreenOffset+"px",t&&r.changeElement(t.firstElementChild,c.reduction),l.iframe&&"auto"===l.height&&(o.style.overflow="auto",this._iframeAutoHeight()),e.element.topArea.style.marginTop=l.fullScreenOffset+"px",r.addClass(this._styleCommandMap.fullScreen,"active")),m&&h.toolbar.hide(),"function"==typeof h.toggleFullScreen&&h.toggleFullScreen(this._variable.isFullScreen,this)},print:function(){const e=r.createElement("IFRAME");e.style.display="none",s.body.appendChild(e);const t=l.printTemplate?l.printTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),n=r.getIframeDocument(e),i=this._wd;if(l.iframe){const e=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="'+l._editableClass+'"';n.write(""+i.head.innerHTML+""+t+"")}else{const e=s.head.getElementsByTagName("link"),i=s.head.getElementsByTagName("style");let o="";for(let t=0,n=e.length;t"+o+''+t+"")}this.showLoading(),a.setTimeout((function(){try{if(e.focus(),r.isIE_Edge||r.isChromium||s.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{d.closeLoading(),r.removeItem(e)}}),1e3)},preview:function(){d.submenuOff(),d.containerOff(),d.controllersOff();const e=l.previewTemplate?l.previewTemplate.replace(/\{\{\s*contents\s*\}\}/i,this.getContents(!0)):this.getContents(!0),t=a.open("","_blank");t.mimeType="text/html";const n=this._wd;if(l.iframe){const i=null!==l._printClass?'class="'+l._printClass+'"':l.fullPage?r.getAttributesToString(n.body,["contenteditable"]):'class="'+l._editableClass+'"';t.document.write(""+n.head.innerHTML+""+e+"")}else{const n=s.head.getElementsByTagName("link"),o=s.head.getElementsByTagName("style");let a="";for(let e=0,t=n.length;e'+i.toolbar.preview+""+a+''+e+"")}},setDir:function(t){const n="rtl"===t,o=this._prevRtl!==n;this._prevRtl=l.rtl=n,o&&(this.plugins.align&&this.plugins.align.exchangeDir.call(this),e.tool.indent&&r.changeElement(e.tool.indent.firstElementChild,c.indent),e.tool.outdent&&r.changeElement(e.tool.outdent.firstElementChild,c.outdent));const s=e.element;n?(r.addClass(s.topArea,"se-rtl"),r.addClass(s.wysiwygFrame,"se-rtl")):(r.removeClass(s.topArea,"se-rtl"),r.removeClass(s.wysiwygFrame,"se-rtl"));const a=r.getListChildren(s.wysiwyg,(function(e){return r.isFormatElement(e)&&(e.style.marginRight||e.style.marginLeft||e.style.textAlign)}));for(let e,t,n,i=0,l=a.length;i"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},getFullContents:function(e){return'
'+this.getContents(e)+"
"},_makeLine:function(e,t){const n=l.defaultTag;if(1===e.nodeType){if(this.__disallowedTagNameRegExp.test(e.nodeName))return"";if(/__se__tag/.test(e.className))return e.outerHTML;const i=r.getListChildNodes(e,(function(e){return r.isSpanWithoutAttr(e)&&!r.getParentElement(e,r.isNotCheckingNode)}))||[];for(let e=i.length-1;e>=0;e--)i[e].outerHTML=i[e].innerHTML;return!t||r.isFormatElement(e)||r.isRangeFormatElement(e)||r.isComponent(e)||r.isFigures(e)||r.isAnchor(e)&&r.isMedia(e.firstElementChild)?r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML:"<"+n+">"+(r.isSpanWithoutAttr(e)?e.innerHTML:e.outerHTML)+""}if(3===e.nodeType){if(!t)return r._HTMLConvertor(e.textContent);const i=e.textContent.split(/\n/g);let l="";for(let e,t=0,o=i.length;t0&&(l+="<"+n+">"+r._HTMLConvertor(e)+"");return l}return 8===e.nodeType&&this._allowHTMLComments?"\x3c!--"+e.textContent.trim()+"--\x3e":""},_tagConvertor:function(e){if(!this._disallowedTextTagsRegExp)return e;const t=l._textTagsMap;return e.replace(this._disallowedTextTagsRegExp,(function(e,n,i,l){return n+("string"==typeof t[i]?t[i]:i)+(l?" "+l:"")}))},_deleteDisallowedTags:function(e){return e=e.replace(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,t){const n=this._w.Math,i=t.match(/(\d+(?:\.\d+)?)(.+)/),l=i?1*i[1]:r.fontValueMap[t],o=i?i[2]:"rem";let s=l;switch(/em/.test(o)?s=n.round(l/.0625):"pt"===o?s=n.round(1.333*l):"%"===o&&(s=l/100),e){case"em":case"rem":case"%":return(.0625*s).toFixed(2)+e;case"pt":return n.round(s/1.333)+e;default:return s+e}},_cleanStyle:function(e,t,n){let i=(e.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(/span/i.test(n)&&!i&&(e.match(/<[^\s]+\s(.+)/)||[])[1]){const t=(e.match(/\ssize="([^"]+)"/i)||[])[1],n=(e.match(/\sface="([^"]+)"/i)||[])[1],l=(e.match(/\scolor="([^"]+)"/i)||[])[1];(t||n||l)&&(i='style="'+(t?"font-size:"+this.util.getNumber(t/3.333,1)+"rem;":"")+(n?"font-family:"+n+";":"")+(l?"color:"+l+";":"")+'"')}if(i){t||(t=[]);const e=i.replace(/"/g,"").match(this._cleanStyleRegExp[n]);if(e){const n=[];for(let t,i=0,o=e.length;i0&&t.push('style="'+n.join(";")+'"')}}return t},_cleanTags:function(e,t,n){if(/^<[a-z0-9]+\:[a-z0-9]+/i.test(t))return t;let i=null;const l=n.match(/(?!<)[a-zA-Z0-9\-]+/)[0].toLowerCase(),o=this._attributesTagsBlacklist[l];t=t.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),t=o?t.replace(o,""):t.replace(this._attributesBlacklistRegExp,"");const s=this._attributesTagsWhitelist[l];if(i=s?t.match(s):t.match(e?this._attributesWhitelistRegExp:this._attributesWhitelistRegExp_all_data),e||"span"===l||"li"===l||this._cleanStyleRegExp[l])if("a"===l){const e=t.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);e&&(i||(i=[]),i.push(e[0]))}else i&&/style=/i.test(i.toString())||("span"!==l&&"li"!==l||(i=this._cleanStyle(t,i,"span")),this._cleanStyleRegExp[l]?i=this._cleanStyle(t,i,l):/^(P|DIV|H[1-6]|PRE)$/i.test(l)&&(i=this._cleanStyle(t,i,"format")));else{const e=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);e&&!i?i=[e[0]]:e&&!i.some((function(e){return/^style/.test(e.trim())}))&&i.push(e[0])}if(r.isFigures(l)){const e=t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);i||(i=[]),e&&i.push(e[0])}if(i)for(let e,t=0,l=i.length;t"+(n.innerHTML.trim()||"
")+"":r.isRangeFormatElement(n)&&!r.isTable(n)?t+=this._convertListCell(n):t+="
  • "+n.outerHTML+"
  • ":t+="
  • "+(n.textContent||"
    ")+"
  • ";return t},_isFormatData:function(e){let t=!1;for(let n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!0)).replace(/$/i,"");const i=s.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(i,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,this._classNameFilter,l.strictHTMLValidation)}catch(e){console.warn("[SUNEDITOR.cleanHTML.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=i.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i]*(?=>)/g,this._cleanTags.bind(this,!0));const t=s.createRange().createContextualFragment(e);try{r._consistencyCheckOfHTML(t,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,this._classNameFilter,l.strictHTMLValidation)}catch(e){console.warn("[SUNEDITOR.convertContentsForEditor.consistencyCheck.fail] "+e)}if(this.managedTagsInfo&&this.managedTagsInfo.query){const e=t.querySelectorAll(this.managedTagsInfo.query);for(let t,n,i=0,l=e.length;i
    ":(i=r.htmlRemoveWhiteSpace(i),this._tagConvertor(i))},convertHTMLForCodeView:function(e,t){let n="";const i=a.RegExp,l=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),o="string"==typeof e?s.createRange().createContextualFragment(e):e,c=function(e){return this.isFormatElement(e)||this.isComponent(e)}.bind(r),d=t?"":"\n";let u=t?0:1*this._variable.codeIndent;return u=u>0?new a.Array(u+1).join(" "):"",function e(t,o){const s=t.childNodes,h=l.test(t.nodeName),g=h?o:"";for(let p,m,f,_,b,v,y=0,C=s.length;y]*>","i"))[0]+m,e(p,o+u),n+=(/\n$/.test(n)?v:"")+""+(f||m||h||/^(TH|TD)$/i.test(p.nodeName)?d:"")):n+=(new a.XMLSerializer).serializeToString(p):n+=(/^HR$/i.test(p.nodeName)?d:"")+(/^PRE$/i.test(p.parentElement.nodeName)&&/^BR$/i.test(p.nodeName)?"":g)+p.outerHTML+m:r.isList(p.parentElement)||(n+=r._HTMLConvertor(/^\n+$/.test(p.data)?"":p.data)):n+="\n\x3c!-- "+p.textContent.trim()+" --\x3e"+m}(o,""),n.trim()+d},addDocEvent:function(e,t,n){s.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){s.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},_charCount:function(e){const t=l.maxCharCount,n=l.charCounterType;let i=0;if(e&&(i=this.getCharLength(e,n)),this._setCharCount(),t>0){let e=!1;const l=h.getCharCount(n);if(l>t){if(e=!0,i>0){this._editorRange();const e=this.getRange(),n=e.endOffset-1,i=this.getSelectionNode().textContent,o=e.endOffset-(l-t);this.getSelectionNode().textContent=i.slice(0,o<0?0:o)+i.slice(e.endOffset,i.length),this.setRange(e.endContainer,n,e.endContainer,n)}}else l+i>t&&(e=!0);if(e&&(this._callCounterBlink(),i>0))return!1}return!0},checkCharCount:function(e,t){if(l.maxCharCount){const n=t||l.charCounterType,i=this.getCharLength("string"==typeof e?e:this._charTypeHTML&&1===e.nodeType?e.outerHTML:e.textContent,n);if(i>0&&i+h.getCharCount(n)>l.maxCharCount)return this._callCounterBlink(),!1}return!0},getCharLength:function(e,t){return/byte/.test(t)?r.getByteLength(e):e.length},resetResponsiveToolbar:function(){d.controllersOff();const t=u._responsiveButtonSize;if(t){let n=0;n=(d._isBalloon||d._isInline)&&"auto"===l.toolbarWidth?e.element.topArea.offsetWidth:e.element.toolbar.offsetWidth;let i="default";for(let e=1,l=t.length;e-1||!r.hasOwn(t,l)||(i.indexOf(l)>-1?n[l].active.call(this,null):t.OUTDENT&&/^OUTDENT$/i.test(l)?r.isImportantDisabled(t.OUTDENT)||t.OUTDENT.setAttribute("disabled",!0):t.INDENT&&/^INDENT$/i.test(l)?r.isImportantDisabled(t.INDENT)||t.INDENT.removeAttribute("disabled"):r.removeClass(t[l],"active"))},_init:function(i,o){const c=a.RegExp;this._ww=l.iframe?e.element.wysiwygFrame.contentWindow:a,this._wd=s,this._charTypeHTML="byte-html"===l.charCounterType,this.wwComputedStyle=a.getComputedStyle(e.element.wysiwyg),this._editorHeight=e.element.wysiwygFrame.offsetHeight,this._editorHeightPadding=r.getNumber(this.wwComputedStyle.getPropertyValue("padding-top"))+r.getNumber(this.wwComputedStyle.getPropertyValue("padding-bottom")),this._classNameFilter=function(e){return this.test(e)?e:""}.bind(l.allowedClassNames);const d=l.__allowedScriptTag?"":"script|";if(this.__scriptTagRegExp=new c("<(script)[^>]*>([\\s\\S]*?)<\\/\\1>|]*\\/?>","gi"),this.__disallowedTagsRegExp=new c("<("+d+"style)[^>]*>([\\s\\S]*?)<\\/\\1>|<("+d+"style)[^>]*\\/?>","gi"),this.__disallowedTagNameRegExp=new c("^("+d+"meta|link|style|[a-z]+:[a-z]+)$","i"),this.__allowedScriptRegExp=new c("^"+(l.__allowedScriptTag?"script":"")+"$","i"),!l.iframe&&"function"==typeof a.ShadowRoot){let t=e.element.wysiwygFrame;for(;t;){if(t.shadowRoot){this._shadowRoot=t.shadowRoot;break}if(t instanceof a.ShadowRoot){this._shadowRoot=t;break}t=t.parentNode}this._shadowRoot&&(this._shadowRootControllerEventTarget=[])}const u=a.Object.keys(l._textTagsMap),h=l.addTagsWhitelist?l.addTagsWhitelist.split("|").filter((function(e){return/b|i|ins|s|strike/i.test(e)})):[];for(let e=0;e^<]+)?\\s*(?=>)","gi");const g=function(e,t){return e?"*"===e?"[a-z-]+":t?e+"|"+t:e:"^"},p="contenteditable|colspan|rowspan|target|href|download|rel|src|alt|class|type|origin-size|controls|autoplay|loop|muted|poster|preload|playsinline|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling";this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1||"*"===l._editorTagsWhitelist,this._htmlCheckWhitelistRegExp=new c("^("+g(l._editorTagsWhitelist.replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new c("^("+(l.tagsBlacklist||"^")+")$","i"),this.editorTagsWhitelistRegExp=r.createTagsWhitelist(g(l._editorTagsWhitelist.replace("|//","|\x3c!--|--\x3e"),"")),this.editorTagsBlacklistRegExp=r.createTagsBlacklist(l.tagsBlacklist.replace("|//","|\x3c!--|--\x3e")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(g(l.pasteTagsWhitelist,"")),this.pasteTagsBlacklistRegExp=r.createTagsBlacklist(l.pasteTagsBlacklist);const m='\\s*=\\s*(")[^"]*\\1',f=l.attributesWhitelist;let _={},b="";if(f)for(let e in f)r.hasOwn(f,e)&&!/^on[a-z]+$/i.test(f[e])&&("all"===e?b=g(f[e],p):_[e]=new c("\\s(?:"+g(f[e],p)+")"+m,"ig"));this._attributesWhitelistRegExp=new c("\\s(?:"+(b||p+"|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|data-exp|data-font-size")+")"+m,"ig"),this._attributesWhitelistRegExp_all_data=new c("\\s(?:"+(b||p)+"|data-[a-z0-9\\-]+)"+m,"ig"),this._attributesTagsWhitelist=_;const v=l.attributesBlacklist;if(_={},b="",v)for(let e in v)r.hasOwn(v,e)&&("all"===e?b=g(v[e],""):_[e]=new c("\\s(?:"+g(v[e],"")+")"+m,"ig"));this._attributesBlacklistRegExp=new c("\\s(?:"+(b||"^")+")"+m,"ig"),this._attributesTagsBlacklist=_,this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this._cachingButtons(),this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this.managedTagsInfo={query:"",map:{}};const y=[];this.activePlugins=[],this._fileManager.tags=[],this._fileManager.pluginMap={};let C,w,x=[];for(let e in n)if(r.hasOwn(n,e)){if(C=n[e],w=t[e],(C.active||C.action)&&w&&this.callPlugin(e,null,w),"function"==typeof C.checkFileInfo&&"function"==typeof C.resetFileInfo&&(this.callPlugin(e,null,w),this._fileInfoPluginsCheck.push(C.checkFileInfo.bind(this)),this._fileInfoPluginsReset.push(C.resetFileInfo.bind(this))),a.Array.isArray(C.fileTags)){const t=C.fileTags;this.callPlugin(e,null,w),this._fileManager.tags=this._fileManager.tags.concat(t),x.push(e);for(let n=0,i=t.length;nc&&(d=d.slice(0,c),a&&a.setAttribute("disabled",!0)),d[c]=l?{contents:n,s:{path:i.getNodePath(l.startContainer,null,null),offset:l.startOffset},e:{path:i.getNodePath(l.endContainer,null,null),offset:l.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===c&&s&&s.removeAttribute("disabled"),e._setCharCount(),t()}return{stack:d,push:function(t){n.setTimeout(e._resourcesStateChange.bind(e));const i="number"==typeof t?t>0?t:0:t?l:0;i&&!r||(n.clearTimeout(r),i)?r=n.setTimeout((function(){n.clearTimeout(r),r=null,h()}),i):h()},undo:function(){c>0&&(c--,u())},redo:function(){d.length-1>c&&(c++,u())},go:function(e){c=e<0?d.length-1:e,u()},getCurrentIndex:function(){return c},reset:function(n){s&&s.setAttribute("disabled",!0),a&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),d.splice(0),c=0,d[c]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_resetCachingButton:function(){o=e.context.element,s=e.context.tool.undo,a=e.context.tool.redo,0===c?(s&&s.setAttribute("disabled",!0),a&&c===d.length-1&&a.setAttribute("disabled",!0),e._variable.isChanged=!1,e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0)):c===d.length-1&&a&&a.setAttribute("disabled",!0)},_destroy:function(){r&&n.clearTimeout(r),d=null}}}(this,this._onChange_historyStack.bind(this)),this.addModule([z]),l.iframe&&(this._wd=e.element.wysiwygFrame.contentDocument,e.element.wysiwyg=this._wd.body,l._editorStyles.editor&&(e.element.wysiwyg.style.cssText=l._editorStyles.editor),"auto"===l.height&&(this._iframeAuto=this._wd.body)),this._initWysiwygArea(i,o)},_cachingButtons:function(){this.codeViewDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-code-view-enabled"]):not([data-display="MORE"])'),this.resizingDisabledButtons=e.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-resizing-enabled"]):not([data-display="MORE"])');const t=e.tool,n=this.commandMap;n.INDENT=t.indent,n.OUTDENT=t.outdent,n[l.textTags.bold.toUpperCase()]=t.bold,n[l.textTags.underline.toUpperCase()]=t.underline,n[l.textTags.italic.toUpperCase()]=t.italic,n[l.textTags.strike.toUpperCase()]=t.strike,n[l.textTags.sub.toUpperCase()]=t.subscript,n[l.textTags.sup.toUpperCase()]=t.superscript,this._styleCommandMap={fullScreen:t.fullScreen,showBlocks:t.showBlocks,codeView:t.codeView},this._saveButtonStates()},_initWysiwygArea:function(t,n){e.element.wysiwyg.innerHTML=t?n:this.convertContentsForEditor(("string"==typeof n?n:/^TEXTAREA$/i.test(e.element.originElement.nodeName)?e.element.originElement.value:e.element.originElement.innerHTML)||"")},_resourcesStateChange:function(){this._iframeAutoHeight(),this._checkPlaceholder()},_onChange_historyStack:function(){this.hasFocus&&u._applyTagEffects(),this._variable.isChanged=!0,e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(this.getContents(!0),this),"block"===e.element.toolbar.style.display&&u._showToolbarBalloon()},_iframeAutoHeight:function(){this._iframeAuto?a.setTimeout((function(){const t=d._iframeAuto.offsetHeight;e.element.wysiwygFrame.style.height=t+"px",r.isResizeObserverSupported||d.__callResizeFunction(t,null)})):r.isResizeObserverSupported||d.__callResizeFunction(e.element.wysiwygFrame.offsetHeight,null)},__callResizeFunction:function(e,t){e=-1===e?t.borderBoxSize&&t.borderBoxSize[0]?t.borderBoxSize[0].blockSize:t.contentRect.height+this._editorHeightPadding:e,this._editorHeight!==e&&("function"==typeof h.onResizeEditor&&h.onResizeEditor(e,this._editorHeight,d,t),this._editorHeight=e)},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(r._allowedEmptyNodeList)||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){if(this._fileManager.pluginRegExp.test(this.currentControllerName))return;const t=this.getRange(),n=t.commonAncestorContainer,i=t.startContainer,o=r.getRangeFormatElement(n,null);let s,a,c;const d=r.getParentElement(n,r.isComponent);if(!d||r.isTable(d)){if(1===n.nodeType&&"true"===n.getAttribute("data-se-embed")){let e=n.nextElementSibling;return r.isFormatElement(e)||(e=this.appendFormatTag(n,l.defaultTag)),void this.setRange(e.firstChild,0,e.firstChild,0)}if(!r.isRangeFormatElement(i)&&!r.isWysiwygDiv(i)||!r.isComponent(i.children[t.startOffset])&&!r.isComponent(i.children[t.startOffset-1])){if(r.getParentElement(n,r.isNotCheckingNode))return null;if(o)return c=r.createElement(e||l.defaultTag),c.innerHTML=o.innerHTML,0===c.childNodes.length&&(c.innerHTML=r.zeroWidthSpace),o.innerHTML=c.outerHTML,c=o.firstChild,s=r.getEdgeChildNodes(c,null).sc,s||(s=r.createTextNode(r.zeroWidthSpace),c.insertBefore(s,c.firstChild)),a=s.textContent.length,void this.setRange(s,a,s,a);if(r.isRangeFormatElement(n)&&n.childNodes.length<=1){let e=null;return 1===n.childNodes.length&&r.isBreak(n.firstChild)?e=n.firstChild:(e=r.createTextNode(r.zeroWidthSpace),n.appendChild(e)),void this.setRange(e,1,e,1)}try{if(3===n.nodeType&&(c=r.createElement(e||l.defaultTag),n.parentNode.insertBefore(c,n),c.appendChild(n)),r.isWysiwygDiv(n))return c=r.createElement(e||l.defaultTag),c.innerHTML=n.innerHTML,n.innerHTML="",n.appendChild(c),this.effectNode=null,void this.setRange(c,1,c,1);if(c&&(r.isBreak(c.nextSibling)&&r.removeItem(c.nextSibling),r.isBreak(c.previousSibling)&&r.removeItem(c.previousSibling)),r.isBreak(s)){const e=r.createTextNode(r.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e}}catch(t){return this.execCommand("formatBlock",!1,e||l.defaultTag),this.removeRange(),this._editorRange(),void(this.effectNode=null)}if(c&&(r.isBreak(c.nextSibling)&&r.removeItem(c.nextSibling),r.isBreak(c.previousSibling)&&r.removeItem(c.previousSibling),r.isBreak(s))){const e=r.createTextNode(r.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e}this.effectNode=null,i?this.setRange(i,1,i,1):this.nativeFocus()}}},_setOptionsInit:function(t,n){this.context=e=A(t.originElement,this._getConstructed(t),l),this._componentsInfoReset=!0,this._editorInit(!0,n)},_editorInit:function(t,n){this._init(t,n),u._addEvent(),this._setCharCount(),u._offStickyToolbar(),u.onResize_window(),e.element.toolbar.style.visibility="";const i=l.frameAttrbutes;for(let t in i)e.element.wysiwyg.setAttribute(t,i[t]);this._checkComponents(),this._componentsInfoInit=!1,this._componentsInfoReset=!1,this.history.reset(!0),a.setTimeout((function(){"function"==typeof d._resourcesStateChange&&(u._resizeObserver&&u._resizeObserver.observe(e.element.wysiwygFrame),u._toolbarObserver&&u._toolbarObserver.observe(e.element._toolbarShadow),d._resourcesStateChange(),"function"==typeof h.onload&&h.onload(d,t))}))},_getConstructed:function(e){return{_top:e.topArea,_relative:e.relative,_toolBar:e.toolbar,_toolbarShadow:e._toolbarShadow,_menuTray:e._menuTray,_editorArea:e.editorArea,_wysiwygArea:e.wysiwygFrame,_codeArea:e.code,_placeholder:e.placeholder,_resizingBar:e.resizingBar,_navigation:e.navigation,_charCounter:e.charCounter,_charWrapper:e.charWrapper,_loading:e.loading,_lineBreaker:e.lineBreaker,_lineBreaker_t:e.lineBreaker_t,_lineBreaker_b:e.lineBreaker_b,_resizeBack:e.resizeBackground,_stickyDummy:e._stickyDummy,_arrow:e._arrow}}},u={_IEisComposing:!1,_lineBreakerBind:null,_responsiveCurrentSize:"default",_responsiveButtonSize:null,_responsiveButtons:null,_deleteKeyCode:new a.RegExp("^(8|46)$"),_cursorMoveKeyCode:new a.RegExp("^(8|3[2-9]|40|46)$"),_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^("+a.Object.keys(l._textTagsMap).join("|")+")$","i"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;const i=u._keyCodeShortcut[e];switch(i){case"A":n="selectAll";break;case"B":-1===l.shortcutsDisable.indexOf("bold")&&(n="bold");break;case"S":t&&-1===l.shortcutsDisable.indexOf("strike")?n="strike":t||-1!==l.shortcutsDisable.indexOf("save")||(n="save");break;case"U":-1===l.shortcutsDisable.indexOf("underline")&&(n="underline");break;case"I":-1===l.shortcutsDisable.indexOf("italic")&&(n="italic");break;case"Z":-1===l.shortcutsDisable.indexOf("undo")&&(n=t?"redo":"undo");break;case"Y":-1===l.shortcutsDisable.indexOf("undo")&&(n="redo");break;case"[":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"indent":"outdent");break;case"]":-1===l.shortcutsDisable.indexOf("indent")&&(n=l.rtl?"outdent":"indent")}return n?(d.commandHandler(d.commandMap[n],n),!0):!!i},_applyTagEffects:function(){if(r.hasClass(e.element.wysiwyg,"se-read-only"))return!1;let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=l.rtl?"marginRight":"marginLeft",o=d.commandMap,s=u._onButtonsCheck,a=[],c=[],h=d.activePlugins,g=h.length;let p="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){if(p=e.nodeName.toUpperCase(),c.push(p),!d.isReadOnly)for(let t,i=0;i0)&&(a.push("OUTDENT"),o.OUTDENT.removeAttribute("disabled")),-1===a.indexOf("INDENT")&&o.INDENT&&!r.isImportantDisabled(o.INDENT)&&(a.push("INDENT"),r.isListCell(e)&&!e.previousElementSibling?o.INDENT.setAttribute("disabled",!0):o.INDENT.removeAttribute("disabled"))):s&&s.test(p)&&(a.push(p),r.addClass(o[p],"active"))}d._setKeyEffect(a),d._variable.currentNodes=c.reverse(),d._variable.currentNodesMap=a,l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_buttonsEventHandler:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^(input|textarea|select|option)$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/sun-editor-common/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},addGlobalEvent:function(e,t,n){return l.iframe&&d._ww.addEventListener(e,t,n),d._w.addEventListener(e,t,n),{type:e,listener:t,useCapture:n}},removeGlobalEvent:function(e,t,n){e&&("object"==typeof e&&(t=e.listener,n=e.useCapture,e=e.type),l.iframe&&d._ww.removeEventListener(e,t,n),d._w.removeEventListener(e,t,n))},onClick_toolbar:function(e){let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(d.controllersOff();t.parentNode&&!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||d.actionCall(i,n,t))},__selectionSyncEvent:null,onMouseDown_wysiwyg:function(t){if(d.isReadOnly||r.isNonEditable(e.element.wysiwyg))return;if(r._isExcludeSelectionElement(t.target))return void t.preventDefault();if(u.removeGlobalEvent(u.__selectionSyncEvent),u.__selectionSyncEvent=u.addGlobalEvent("mouseup",(function(){d&&d._editorRange(),u.removeGlobalEvent(u.__selectionSyncEvent)})),"function"==typeof h.onMouseDown&&!1===h.onMouseDown(t,d))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}),null)}d._isBalloon&&u._hideToolbar()},onClick_wysiwyg:function(t){const n=t.target;if(d.isReadOnly)return t.preventDefault(),r.isAnchor(n)&&a.open(n.href,n.target),!1;if(r.isNonEditable(e.element.wysiwyg))return;if("function"==typeof h.onClick&&!1===h.onClick(t,d))return;const i=d.getFileComponent(n);if(i)return t.preventDefault(),void d.selectComponent(i.target,i.pluginName);const o=r.getParentElement(n,"FIGCAPTION");if(o&&r.isNonEditable(o)&&(t.preventDefault(),o.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),o.removeEventListener("blur",e)};o.addEventListener("blur",e)}if(d._editorRange(),3===t.detail){let e=d.getRange();r.isFormatElement(e.endContainer)&&0===e.endOffset&&(e=d.setRange(e.startContainer,e.startOffset,e.startContainer,e.startContainer.length),d._rangeInfo(e,d.getSelection()))}const s=d.getSelectionNode(),c=r.getFormatElement(s,null),g=r.getRangeFormatElement(s,null);let p=s;for(;p&&p.firstChild;)p=p.firstChild;const m=d.getFileComponent(p);if(m){const e=d.getRange();g||e.startContainer!==e.endContainer||d.selectComponent(m.target,m.pluginName)}else d.currentFileComponentInfo&&d.controllersOff();if(c||r.isNonEditable(n)||r.isList(g))u._applyTagEffects();else{const e=d.getRange();if(r.getFormatElement(e.startContainer)===r.getFormatElement(e.endContainer))if(r.isList(g)){t.preventDefault();const e=r.createElement("LI"),n=s.nextElementSibling;e.appendChild(s),g.insertBefore(e,n),d.focus()}else r.isWysiwygDiv(s)||r.isComponent(s)||r.isTable(s)&&!r.isCell(s)||null===d._setDefaultFormat(r.isRangeFormatElement(g)?"DIV":l.defaultTag)?u._applyTagEffects():(t.preventDefault(),d.focus())}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){if(d){d._editorRange();const e=d.getRange();d._bindControllersOff||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)}},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,o=e.element.topArea,s=d.getSelection();let c;if(d._isBalloonAlways&&n.collapsed)c=!0;else if(s.focusNode===s.anchorNode)c=s.focusOffset0&&u._getPageBottomSpace()C&&(t=!1,y=!0),y&&(b=(t?n.top-m-g:n.bottom+g)-(n.noText?0:h)+d),i.style.left=a.Math.floor(v)+"px",i.style.top=a.Math.floor(b)+"px",t?(r.removeClass(e.element._arrow,"se-arrow-up"),r.addClass(e.element._arrow,"se-arrow-down"),e.element._arrow.style.top=m+"px"):(r.removeClass(e.element._arrow,"se-arrow-down"),r.addClass(e.element._arrow,"se-arrow-up"),e.element._arrow.style.top=-g+"px");const w=a.Math.floor(p/2+(f-v));e.element._arrow.style.left=(w+g>i.offsetWidth?i.offsetWidth-g:w";const e=f.attributes;for(;e[0];)f.removeAttribute(e[0].name)}else{const e=r.createElement(l.defaultTag);e.innerHTML="
    ",f.parentElement.replaceChild(e,f)}return d.nativeFocus(),!1}}const i=g.startContainer;if(f&&!f.previousElementSibling&&0===g.startOffset&&3===i.nodeType&&!r.isFormatElement(i.parentNode)){let e=i.parentNode.previousSibling;const t=i.parentNode.nextSibling;e||(t?e=t:(e=r.createElement("BR"),f.appendChild(e)));let n=i;for(;f.contains(n)&&!n.previousSibling;)n=n.parentNode;if(!f.contains(n)){i.textContent="",r.removeItemAllParents(i,null,f);break}}if(u._isUneditableNode(g,!0)){t.preventDefault(),t.stopPropagation();break}!p&&d._isEdgeFormat(g.startContainer,g.startOffset,"start")&&r.isFormatElement(f.previousElementSibling)&&(d._formatAttrsTemp=f.previousElementSibling.attributes);const b=g.commonAncestorContainer;if(f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){if(r.isListCell(f)&&r.isList(_)&&(r.isListCell(_.parentNode)||f.previousElementSibling)&&(n===f||3===n.nodeType&&(!n.previousSibling||r.isList(n.previousSibling)))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.startContainer):0===g.startOffset&&g.collapsed)){if(g.startContainer!==g.endContainer)t.preventDefault(),d.removeNode(),3===g.startContainer.nodeType&&d.setRange(g.startContainer,g.startContainer.textContent.length,g.startContainer,g.startContainer.textContent.length),d.history.push(!0);else{let e=f.previousElementSibling||_.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(f)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===_.parentNode?_.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),_.parentNode.insertBefore(i,_.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,o=f.childNodes;let s=i,a=o[0];for(;a=o[0];)e.insertBefore(a,s.nextSibling),s=a;r.removeItem(f),0===_.children.length&&r.removeItem(_),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!p&&0===g.startOffset){let e=!0,n=b;for(;n&&n!==_&&!r.isWysiwygDiv(n);){if(n.previousSibling&&(1===n.previousSibling.nodeType||!r.onlyZeroWidthSpace(n.previousSibling.textContent.trim()))){e=!1;break}n=n.parentNode}if(e&&_.parentNode){t.preventDefault(),d.detachRangeFormatElement(_,r.isListCell(f)?[f]:null,null,!1,!1),d.history.push(!0);break}}}if(!p&&f&&(0===g.startOffset||n===f&&f.childNodes[g.startOffset])){const e=r.isListCell(f),i=n===f?f.childNodes[g.startOffset]:n,l=e?i.previousSibling:f.previousSibling,o=e||(3===b.nodeType||r.isBreak(b))&&!b.previousSibling&&0===g.startOffset;if(i&&(e||!i.previousSibling)&&(b&&r.isComponent(b.previousSibling)||o&&r.isComponent(l))){const n=d.getFileComponent(l);n?(t.preventDefault(),t.stopPropagation(),e?r.removeItem(i):0===f.textContent.length&&r.removeItem(f),!1===d.selectComponent(n.target,n.pluginName)&&d.blur()):r.isComponent(l)&&(t.preventDefault(),t.stopPropagation(),r.removeItem(l));break}if(i&&r.isNonEditable(i.previousSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(i.previousSibling);break}}break;case 46:if(m){t.preventDefault(),t.stopPropagation(),d.plugins[m].destroy.call(d);break}if(p&&u._hardDelete()){t.preventDefault(),t.stopPropagation();break}if(!p&&d._isEdgeFormat(g.endContainer,g.endOffset,"end")&&!f.nextSibling)return t.preventDefault(),void t.stopPropagation();if(u._isUneditableNode(g,!1)){t.preventDefault(),t.stopPropagation();break}if((r.isFormatElement(n)||null===n.nextSibling||r.onlyZeroWidthSpace(n.nextSibling)&&null===n.nextSibling.nextSibling)&&g.startOffset===n.textContent.length){const e=f.nextElementSibling;if(!e)break;if(r.isComponent(e)){if(t.preventDefault(),r.onlyZeroWidthSpace(f)&&(r.removeItem(f),r.isTable(e))){let t=r.getChildElement(e,r.isCell,!1);t=t.firstElementChild||t,d.setRange(t,0,t,0);break}const n=d.getFileComponent(e);n?(t.stopPropagation(),!1===d.selectComponent(n.target,n.pluginName)&&d.blur()):r.isComponent(e)&&(t.stopPropagation(),r.removeItem(e));break}}if(!p&&(d.isEdgePoint(g.endContainer,g.endOffset)||n===f&&f.childNodes[g.startOffset])){const e=n===f&&f.childNodes[g.startOffset]||n;if(e&&r.isNonEditable(e.nextSibling)){t.preventDefault(),t.stopPropagation(),r.removeItem(e.nextSibling);break}if(r.isComponent(e)){t.preventDefault(),t.stopPropagation(),r.removeItem(e);break}}if(!p&&d._isEdgeFormat(g.endContainer,g.endOffset,"end")&&r.isFormatElement(f.nextElementSibling)&&(d._formatAttrsTemp=f.attributes),f=r.getFormatElement(g.startContainer,null),_=r.getRangeFormatElement(f,null),r.isListCell(f)&&r.isList(_)&&(n===f||3===n.nodeType&&(!n.nextSibling||r.isList(n.nextSibling))&&(r.getFormatElement(g.startContainer,null)!==r.getFormatElement(g.endContainer,null)?_.contains(g.endContainer):g.endOffset===n.textContent.length&&g.collapsed))){g.startContainer!==g.endContainer&&d.removeNode();let e=r.getArrayItem(f.children,r.isList,!1);if(e=e||f.nextElementSibling||(_.parentNode?_.parentNode.nextElementSibling:null),e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)f.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)f.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}break;case 9:if(m||l.tabDisable)break;if(t.preventDefault(),s||c||r.isWysiwygDiv(n))break;const v=!g.collapsed||d.isEdgePoint(g.startContainer,g.startOffset),y=d.getSelectedElements(null);n=d.getSelectionNode();const C=[];let w=[],x=r.isListCell(y[0]),E=r.isListCell(y[y.length-1]),S={sc:g.startContainer,so:g.startOffset,ec:g.endContainer,eo:g.endOffset};for(let e,t=0,n=y.length;t0&&v&&d.plugins.list)S=d.plugins.list.editInsideList.call(d,o,C);else{const e=r.getParentElement(n,r.isCell);if(e&&v){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let i=o?r.prevIdx(n,e):r.nextIdx(n,e);i!==n.length||o||(i=0),-1===i&&o&&(i=n.length-1);let l=n[i];if(!l)break;l=l.firstElementChild||l,d.setRange(l,0,l,0);break}w=w.concat(C),x=E=null}if(w.length>0)if(o){const e=w.length-1;for(let t,n=0;n<=e;n++){t=w[n].childNodes;for(let e,n=0,i=t.length;n":"<"+f.nodeName+">
    ",!d.checkCharCount(e,"byte-html"))return t.preventDefault(),!1}if(!o&&!m){const i=d._isEdgeFormat(g.endContainer,g.endOffset,"end"),o=d._isEdgeFormat(g.startContainer,g.startOffset,"start");if(i&&(/^H[1-6]$/i.test(f.nodeName)||/^HR$/i.test(f.nodeName))){u._enterPrevent(t);let e=null;const n=d.appendFormatTag(f,l.defaultTag);if(i&&i.length>0){e=i.pop();const t=e;for(;i.length>0;)e=e.appendChild(i.pop());n.appendChild(t)}if(e=e?e.appendChild(n.firstChild):n.firstChild,r.isBreak(e)){const t=r.createTextNode(r.zeroWidthSpace);e.parentNode.insertBefore(t,e),d.setRange(t,1,t,1)}else d.setRange(e,0,e,0);break}if(_&&f&&!r.isCell(_)&&!/^FIGCAPTION$/i.test(_.nodeName)){const e=d.getRange();if(d.isEdgePoint(e.endContainer,e.endOffset)&&r.isList(n.nextSibling)){u._enterPrevent(t);const e=r.createElement("LI"),i=r.createElement("BR");e.appendChild(i),f.parentNode.insertBefore(e,f.nextElementSibling),e.appendChild(n.nextSibling),d.setRange(i,1,i,1);break}if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(f.innerText.trim())&&!r.isListCell(f.nextElementSibling)){u._enterPrevent(t);let e=null;if(r.isListCell(_.parentNode)){const t=f.parentNode.parentNode;_=t.parentNode;const n=r.createElement("LI");n.innerHTML="
    ",r.copyTagAttributes(n,f,l.lineAttrReset),e=n,_.insertBefore(e,t.nextElementSibling)}else{const t=r.isCell(_.parentNode)?"DIV":r.isList(_.parentNode)?"LI":r.isFormatElement(_.nextElementSibling)&&!r.isRangeFormatElement(_.nextElementSibling)?_.nextElementSibling.nodeName:r.isFormatElement(_.previousElementSibling)&&!r.isRangeFormatElement(_.previousElementSibling)?_.previousElementSibling.nodeName:l.defaultTag;e=r.createElement(t),r.copyTagAttributes(e,f,l.lineAttrReset);const n=d.detachRangeFormatElement(_,[f],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.removeItemAllParents(f,null,null),d.setRange(e,1,e,1);break}}if(N){u._enterPrevent(t);const e=n===N,i=d.getSelection(),l=n.childNodes,o=i.focusOffset,s=n.previousElementSibling,a=n.nextSibling;if(!r.isClosureFreeFormatElement(N)&&l&&(e&&g.collapsed&&l.length-1<=o+1&&r.isBreak(l[o])&&(!l[o+1]||(!l[o+2]||r.onlyZeroWidthSpace(l[o+2].textContent))&&3===l[o+1].nodeType&&r.onlyZeroWidthSpace(l[o+1].textContent))&&o>0&&r.isBreak(l[o-1])||!e&&r.onlyZeroWidthSpace(n.textContent)&&r.isBreak(s)&&(r.isBreak(s.previousSibling)||!r.onlyZeroWidthSpace(s.previousSibling.textContent))&&(!a||!r.isBreak(a)&&r.onlyZeroWidthSpace(a.textContent)))){e?r.removeItem(l[o-1]):r.removeItem(n);const t=d.appendFormatTag(N,r.isFormatElement(N.nextElementSibling)&&!r.isRangeFormatElement(N.nextElementSibling)?N.nextElementSibling:null);r.copyFormatAttributes(t,N),d.setRange(t,1,t,1);break}if(e){h.insertHTML(g.collapsed&&r.isBreak(g.startContainer.childNodes[g.startOffset-1])?"
    ":"

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