suneditor 3.0.0-beta.13 → 3.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/suneditor.min.js +1 -1
- package/package.json +1 -1
- package/src/core/editor.js +2 -1
- package/src/core/section/constructor.js +0 -113
- package/src/core/section/options.js +113 -0
- package/src/suneditor.js +19 -12
- package/types/core/section/constructor.d.ts +3 -16
- package/types/core/section/options.d.ts +227 -38
- package/types/suneditor.d.ts +11 -7
package/dist/suneditor.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var t={cfbI:function(t){var e,i;e="undefined"!=typeof window?window:this,i=function(t,e){const i={code:"en",align:"Align",alignBottom:"Align bottom",alignCenter:"Align center",alignJustify:"Align justify",alignLeft:"Align left",alignMiddle:"Align middle",alignRight:"Align right",alignTop:"Align top",anchor:"Anchor",asBlock:"As a block",asInline:"As a inline",asLink:"As a link",audio:"Audio",audioGallery:"Audio gallery",audio_modal_file:"Select from files",audio_modal_title:"Insert Audio",audio_modal_url:"Audio URL",autoSize:"Auto size",backgroundColor:"Background color",basic:"Basic",blockStyle:"Block style",bold:"Bold",border:"Border",border_all:"Border all",border_inside:"Border inside",border_horizontal:"Border horizontal",border_vertical:"Border vertical",border_outside:"Border outside",border_left:"Border left",border_top:"Border top",border_right:"Border right",border_bottom:"Border bottom",border_none:"Border none",bulletedList:"Bulleted list",cancel:"Cancel",caption:"Insert description",cellProperties:"Cell properties",center:"Center",close:"Close",codeView:"Code view",color:"Color",colorPicker:"Color picker",column:"Column",comment:"Comments",commentAdd:"Add comment",commentShow:"Show comments",copy:"Copy",copyFormat:"Paint Formatting",cut:"Cut",default:"Default",deleteColumn:"Delete column",deleteRow:"Delete row",dir_ltr:"Left to right",dir_rtl:"Right to left",download:"Download",drag:"Drag",drawing:"Drawing",drawing_modal_title:"Drawing",edit:"Edit",embed:"Embed",embed_modal_title:"Embed",embed_modal_source:"Embed Source / URL",exportPDF:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",fileBrowser:"File browser",fileGallery:"File gallery",fileUpload:"File upload",fixedColumnWidth:"Fixed column width",font:"Font",fontColor:"Font color",fontSize:"Size",formats:"Formats",fullScreen:"Full screen",height:"Height",horizontalLine:"Horizontal line",horizontalSplit:"Horizontal split",hr_dashed:"Dashed",hr_dotted:"Dotted",hr_solid:"Solid",id:"ID",image:"Image",imageGallery:"Image gallery",image_modal_altText:"Alternative text",image_modal_file:"Select from files",image_modal_title:"Insert image",image_modal_url:"Image URL",importWord:"Import from Word",indent:"Indent",inlineStyle:"Inline style",insertColumnAfter:"Insert column after",insertColumnBefore:"Insert column before",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertLine:"Insert line",italic:"Italic",layout:"Layout",left:"Left",lineHeight:"Line height",link:"Link",link_modal_bookmark:"Bookmark",link_modal_downloadLinkCheck:"Download link",link_modal_newWindowCheck:"Open in new window",link_modal_text:"Text to display",link_modal_title:"Insert Link",link_modal_url:"URL to link",link_modal_relAttribute:"Rel attribute",list:"List",math:"Math",math_modal_fontSizeLabel:"Font Size",math_modal_inputLabel:"Mathematical Notation",math_modal_previewLabel:"Preview",math_modal_title:"Math",maxSize:"Max size",mediaGallery:"Media gallery",mention:"Mention",menu_bordered:"Bordered",menu_code:"Code",menu_neon:"Neon",menu_shadow:"Shadow",menu_spaced:"Spaced",menu_translucent:"Translucent",mergeCells:"Merge cells",minSize:"Min size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",newDocument:"New document",numberedList:"Numbered list",outdent:"Outdent",pageBreak:"Page break",pageDown:"Page down",pageNumber:"Page number",pageUp:"Page up",paragraphStyle:"Paragraph style",preview:"Preview",print:"print",proportion:"Constrain proportions",ratio:"Ratio",redo:"Redo",remove:"Remove",removeFormat:"Remove Format",replace:"Replace",replaceAll:"Replace all",resize100:"Zoom 100%",resize25:"Zoom 25%",resize50:"Zoom 50%",resize75:"Zoom 75%",resize:"Resize",revert:"Revert",revisionHistory:"Revision History",right:"Right",rotateLeft:"Rotate left",rotateRight:"Rotate right",row:"Row",save:"Save",search:"Search",selectAll:"Select All",showBlocks:"Show blocks",size:"Size",splitCells:"Split cells",strike:"Strike",submitButton:"Submit",subscript:"Subscript",superscript:"Superscript",table:"Table",tableHeader:"Table header",tableProperties:"Table properties",tags:"Tags",tag_blockquote:"Quote",tag_div:"Normal (DIV)",tag_h:"Header",tag_p:"Paragraph",tag_pre:"Code",template:"Template",textStyle:"Text style",title:"Title",underline:"Underline",undo:"Undo",unmergeCells:"Unmerge cells",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",videoGallery:"Video gallery",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width",message_copy_success:"Copied to clipboard",message_copy_fail:"Copy failed. Please copy manually."};return void 0===e&&(t.SUNEDITOR_LANG||Object.defineProperty(t,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(t.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:i})),i},"object"==typeof t.exports?t.exports=e.document?i(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return i(t)}:i(e)},JybH:(t,e,i)=>{"use strict";i.r(e)},"+qkj":(t,e,i)=>{"use strict";i.r(e)}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";const t=window,e=document,s=Symbol("noEventHandler"),n=Symbol("onOverComponent"),o=navigator.userAgent.toLowerCase();const l="function"==typeof ResizeObserver,r="function"==typeof navigator.clipboard?.write,a=/Edg/.test(navigator.userAgent),h=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),c=o.includes("chrome/")&&!o.includes("edge/"),d=!!o.match(/gecko\/\d+/),u=!!t.chrome,p=o.includes("applewebkit/")&&!o.includes("chrome"),g=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(o)||navigator.maxTouchPoints>0&&"ontouchstart"in t,m=o.includes("android"),f=h?"⌘":"CTRL",_=h?"⇧":"+SHIFT",b=t.devicePixelRatio,y={_w:t,_d:e,NO_EVENT:s,ON_OVER_COMPONENT:n,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let i="";const s=(t||e).styleSheets;for(let t,e=0,n=s.length;e<n;e++){try{t=s[e].cssRules}catch(t){continue}if(t)for(let e=0,s=t.length;e<s;e++)i+=t[e].cssText}return i},getIncludePath:function(t,i){let s="";const n=[],o="js"===i?"script":"link",l="js"===i?"src":"href";let r="(?:";for(let e=0,i=t.length;e<i;e++)r+=t[e]+(e<i-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${i}(?:\\?.*|;.*)?$`,"i"),h=new RegExp(`.+\\.${i}(?:\\?.*|;.*)?$`,"i");for(let t=e.getElementsByTagName(o),i=0;i<t.length;i++)h.test(t[i][l])&&n.push(t[i]);for(let t=0;t<n.length;t++){const e=n[t][l].match(a);if(e){s=e[0];break}}if(""===s&&(s=n.length>0?n[0][l]:""),s.includes(":/")||"//"===s.slice(0,2)||(s=!1===s.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+s:location.href.match(/^[^?]*\/(?:)/)[0]+s),!s)throw"[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+s+", extension: "+i+")";return s},isResizeObserverSupported:l,isClipboardSupported:r,isEdge:a,isBlink:c,isGecko:d,isChromium:u,isSafari:p,isOSX_IOS:h,isAndroid:m,isMobile:g,cmdIcon:f,shiftIcon:_,DPI:b,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},v=8203,C=String.fromCharCode(v),w=new RegExp(String.fromCharCode(v),"g"),x=new RegExp("^"+String.fromCharCode(v)+"+$");const k={zeroWidthSpace:C,zeroWidthRegExp:w,onlyZeroWidthRegExp:x,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},E=/https?:\/\/[^\s]+/g,S={"xx-small":.5625,"x-small":.625,small:.8333,medium:1,large:1.125,"x-large":1.5,"xx-large":2,"xxx-large":2.5};function T(t){if(3===t.nodeType){const e=t.nodeValue.trim();return e?{type:"text",content:e}:null}if(1===t.nodeType){const e={type:"element",tag:t.tagName.toLowerCase(),attributes:{},children:[]};for(const i of t.attributes)e.attributes[i.name]=i.value;for(const i of t.childNodes){const t=T(i);t&&e.children.push(t)}return e}return null}function H(t){const e={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,(t=>"string"==typeof e[t]?e[t]:t))}function L(t){return"string"==typeof t?t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())):t.map((function(t){return L(t)}))}function M(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const N={htmlToJson:function(t){return T((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return H(e.content||"");if("element"===e.type){const{tag:i,attributes:s={},children:n=[]}=e,o=Object.entries(s).map((([t,e])=>`${t}="${H(e)}"`)).join(" "),l=`</${i}>`;return`${o?`<${i} ${o}>`:`<${i}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:H,entityToHTML:function(t){const e={"&":"&"," ":" ","'":"'",""":'"',"<":"<",">":">"};return t.replace(/&| |'|"|\$lt;|\$gt;/g,(t=>"string"==typeof e[t]?e[t]:t))},debounce:function(e,i){let s;return function(...n){t.clearTimeout(s),s=t.setTimeout((()=>{t.clearTimeout(s),e(...n)}),i)}},syncMaps:function(t,e){e.forEach(((e,i)=>{t.set(i,e)})),t.forEach(((i,s)=>{e.has(s)||t.delete(s)}))},mergeMaps:function(...t){const e=t.filter((t=>t instanceof Map)).flatMap((t=>[...t]));return new Map(e)},getValues:function(t){return t?Object.keys(t).map((function(e){return t[e]})):[]},camelToKebabCase:L,kebabToCamelCase:function(t){return"string"==typeof t?t.replace(/-[a-zA-Z]/g,(t=>t.replace("-","").toUpperCase())):t.map((function(t){return L(t)}))},toFontUnit:function(t,e){const i=e.match(/(\d+(?:\.\d+)?)(.+)/),s=i?Number(i[1]):S[e],n=i?i[2]:"rem";let o=s;switch(/em/.test(n)?o=Math.round(s/.0625):"pt"===n?o=Math.round(1.333*s):"%"===n&&(o=s/100),t){case"em":case"rem":return(.0625*o).toFixed(2)+t;case"%":return 100*Number((.0625*o).toFixed(2))+t;case"pt":return Math.round(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={},i=Object.prototype.hasOwnProperty;for(const s in t)i.call(t,s)&&(e[t[s]]=s);return e},createElementWhitelist:function(t){return new RegExp(`<\\/?\\b(?!\\b${(t||"").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},createElementBlacklist:function(t){return new RegExp(`<\\/?\\b(?:\\b${(t||"^").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},isHexColor:M,rgb2hex:function(t){if(M(t)||!t)return t;const e=t.match(/^rgba?[\s+]?\(([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?/i);if(e&&e.length>=4){const i=("0"+parseInt(e[1],10).toString(16)).slice(-2),s=("0"+parseInt(e[2],10).toString(16)).slice(-2),n=("0"+parseInt(e[3],10).toString(16)).slice(-2);let o="";if(t.includes("rgba")){const e=t.match(/[\s+]?([\d]+\.?[\d]*)[\s+]?/i);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${i}${s}${n}${o}`}return t},getWidthInPercentage:function(e,i){const s=i||e.parentElement,n=t.getComputedStyle(s),o=parseFloat(n.paddingLeft),l=parseFloat(n.paddingRight),r=s.offsetWidth-s.clientWidth,a=s.offsetWidth-o-l-r;return e.offsetWidth/a*100},textToAnchor:function(t){if(3===t.nodeType&&E.test(t.textContent)&&!/^A$/i.test(t.parentNode?.nodeName)){const i=t.textContent,s=e.createDocumentFragment();let n=0;return i.replace(E,((t,o)=>{o>0&&s.appendChild(e.createTextNode(i.slice(0,o)));const l=e.createElement("a");return l.href=t,l.target="_blank",l.textContent=t,s.appendChild(l),n=o+t.length,n<i.length&&s.appendChild(e.createTextNode(i.slice(n))),t})),t.parentNode.replaceChild(s,t),!0}return!1},spanToStyleNode:function(t,i){if(1===i.nodeType&&/^SPAN$/i.test(i.nodeName)&&i.hasAttribute("style")){const s=i.getAttribute("style"),n=[];if(Object.keys(t).forEach((i=>{if(t[i].regex.test(s)){const s=e.createElement(t[i].tag);n.push(s)}})),n.length>0){const t=e.createElement("span");let s=i.firstChild;n.forEach(((e,i)=>{0===i?t.appendChild(e):n[i-1].appendChild(e)}));const o=n[n.length-1];for(;s;){const t=s.nextSibling;o.appendChild(s),s=t}for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let i="";t.get("height")&&(i+="height:"+t.get("height")+";"),t.get("minHeight")&&(i+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(i+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(i+="width:"+t.get("width")+";"),t.get("minWidth")&&(i+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(i+="max-width:"+t.get("maxWidth")+";");let s="",n="",o="";const l=(e=i+e).split(";");for(let e,i=0,r=l.length;i<r;i++)e=l[i].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?s+=e+";":/^(min-|max-)?height\s*:/.test(e)?(/^height/.test(e)&&"auto"===e.split(":")[1].trim()&&t.set("height","auto"),n+=e+";"):o+=e+";");return{top:s,frame:n,editor:o}},_setIframeStyleLinks:function(t){let i="";if(t)for(let s,n=0,o=t.length;n<o;n++){if(s=[],/(^https?:\/\/)|(^data:text\/css,)/.test(t[n]))s.push(t[n]);else{const i=new RegExp(`(^|.*[\\/])${t[n]}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let t,n=e.getElementsByTagName("link"),o=0,l=n.length;o<l;o++)t=n[o].href.match(i),t&&s.push(t[0])}if(!s||0===s.length)throw'[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframe_cssFileName" before creating editor instances.';for(let t=0,e=s.length;t<e;t++)i+='<link href="'+s[t]+'" rel="stylesheet">'}return i},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},A=N;function B(t){return null!=t&&("string"!=typeof t&&(t=t.textContent),""===t||x.test(t))}function I(t){return 1===t?.nodeType}function V(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function O(t){return 1===t?.nodeType&&(G.hasClass(t,"se-wrapper-wysiwyg|sun-editor-carrier-wrapper|se-wrapper")||/^BODY$/i.test(t.nodeName))}const R={isZeroWidth:B,isEdgePoint:function(t,e,i){return"end"!==i&&0===e||(!i||"front"!==i)&&!t.nodeValue&&1===e||(!i||"end"===i)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:I,isInputElement:function(t){return I(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return I(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:function(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)},isListCell:function(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)},isTable:function(t){return/^TABLE$/i.test("string"==typeof t?t:t?.nodeName)},isTableElements:function(t){return/^(TABLE|THEAD|TBODY|TR|TH|TD|COL)$/i.test("string"==typeof t?t:t?.nodeName)},isTableCell:function(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)},isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:V,isAnchor:function(t){return/^A$/i.test("string"==typeof t?t:t?.nodeName)},isMedia:function(t){return/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test("string"==typeof t?t:t?.nodeName)},isIFrame:function(t){return/^IFRAME$/i.test("string"==typeof t?t:t?.nodeName)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isContentLess:function(t){return/^(BR|COLGROUP|COL|THEAD|TBODY|TFOOT|TR|AREA|BASE|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/i.test("string"==typeof t?t:t?.nodeName)},isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||V(e.firstElementChild))&&B(e.textContent)},isWysiwygFrame:O,isNonEditable:function(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")},isSpanWithoutAttr:function(t){if(1!==t?.nodeType)return!1;const e=t;return/^SPAN$/i.test(e.nodeName)&&!e.className&&!e.style.cssText},isSameAttributes:function(t,e){if(3===t.nodeType&&3===e.nodeType)return!0;if(3===t.nodeType||3===e.nodeType)return!1;const i=t,s=e,n=i.style,o=s.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=i.classList,a=s.classList,h=RegExp;let c=0;for(let t=0,e=r.length;t<e;t++)h("(s|^)"+r[t]+"(s|$)").test(a.value)&&c++;return l===o.length&&l===n.length&&c===a.length&&c===r.length},isExcludeFormat:function(t){return/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/.test(t?.className)},isUneditable:function(t){return G.hasClass(t,"__se__uneditable")},isImportantDisabled:function(t){return t.hasAttribute("data-important-disabled")}},z=R;function $(t,i,s){const n=e.createElement(t);if(i)for(const t in i)void 0!==i[t]&&null!==i[t]&&n.setAttribute(t,i[t]);return s&&("string"==typeof s?n.innerHTML=s:"object"==typeof s&&n.appendChild(s)),n}function F(t,e){let i=-1;for(let s=0,n=t.length;s<n;s++)if(t[s]===e){i=s;break}return i}function P(t,e,i){const s=t,n=e;if(n.style.cssText){const t=n.style;for(let e=0,i=t.length;e<i;e++)s.style[t[e]]=t[t[e]]}const o=n.attributes;for(let t,e=0,n=o.length;e<n;e++)t=o[e].name.toLowerCase(),i?.includes(t)||!o[e].value?s.removeAttribute(t):"style"!==t&&s.setAttribute(o[e].name,o[e].value)}function D(t,e){if(!t||1!==t.nodeType)return;return new RegExp(`(\\s|^)${e}(\\s|$)`).test(t.className)}function q(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.add(t)}}function W(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.remove(t)}}function U(t=e){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const G={clone:function(t,e=!1){return t.cloneNode(e)},createElement:$,createTextNode:function(t){return e.createTextNode(t||"")},getAttributesToString:function(t,e){const i=t.attributes;if(!i)return"";let s="";for(let t=0,n=i.length;t<n;t++)e?.includes(i[t].name)||(s+=i[t].name+'="'+i[t].value+'" ');return s},arrayFilter:function(t,e){if(!t||0===t.length)return null;e=e||function(){return!0};const i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],e(s)&&i.push(s);return i},arrayFind:function(t,e){if(!t||0===t.length)return null;e=e||function(){return!0};for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],e(i))return i;return null},arrayIncludes:function(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},getArrayIndex:F,nextIndex:function(t,e){const i=F(t,e);return-1===i?-1:i+1},prevIndex:function(t,e){const i=F(t,e);return-1===i?-1:i-1},copyTagAttributes:P,copyFormatAttributes:function(t,e){const i=e.cloneNode(!1);i.className=i.className.replace(/(\s|^)__se__format__[^\s]+/g,""),P(t,i)},removeItem:function(t){t&&("remove"in t&&"function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))},changeElement:function(t,e){if(t)if("string"==typeof e)if("outerHTML"in t)t.outerHTML=e;else{const i=$("DIV");i.innerHTML=e,t.parentNode.replaceChild(i.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,i){for(let s,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)s=t[n],s.style[e]=i,s.style.cssText||s.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,i){for(let s=0,n=t.length;s<n;s++){const n=t[s];!i&&z.isImportantDisabled(n)||(n.disabled=e),i&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:D,addClass:q,removeClass:W,toggleClass:function(t,e){if(!t||1!==t.nodeType)return;const i=t;let s=!1;const n=new RegExp(`(\\s|^)${e}(\\s|$)`);return n.test(i.className)?i.className=i.className.replace(n," ").trim():(i.className+=" "+e,s=!0),i.className.trim()||i.removeAttribute("class"),s},flashClass:function(e,i,s=120){q(e,i),t.setTimeout((()=>{W(e,i)}),s)},getClientSize:U,getViewportSize:function(){return"visualViewport"in t?{top:t.visualViewport.pageTop,left:t.visualViewport.pageLeft,scale:t.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(i,s,n){if(!i)return console.warn('"parentTarget" is not exist'),null;let o=i;const l=e.createElement("DIV");if(l.style.display="none",/body/i.test(o.nodeName)){const t=e.createElement("DIV"),i=o.attributes;for(let e=0,s=i.length;e<s;e++)t.setAttribute(i[e].name,i[e].value);t.innerHTML=o.innerHTML,o=t}else o=o.cloneNode(!0);l.appendChild(o),e.body.appendChild(l);const r=Array.from(o.querySelectorAll("*")),a=s?[o].concat(r):r;for(let e,i=0;e=a[i];i++){if(1!==e.nodeType)continue;const i=t.getComputedStyle(e),s=e.style;for(const t of n)s.setProperty(t,i.getPropertyValue(t)||"")}return e.body.removeChild(l),o},waitForMediaLoad:function(i,s=5e3){const n=i||e;return new Promise((e=>{const i=["img","video","audio","iframe"].flatMap((t=>Array.from(n.querySelectorAll(t))));if(0===i.length)return void e();const o=i.map((t=>{if(t instanceof HTMLImageElement){if(t.complete)return Promise.resolve()}else if(t instanceof HTMLMediaElement){if(t.readyState>=2)return Promise.resolve()}else if(t instanceof HTMLIFrameElement)try{if("complete"===t.contentDocument?.readyState)return Promise.resolve()}catch(t){console.warn(["[SUNEDITOR] Iframe load error",t])}return new Promise((e=>{t.addEventListener("load",e,{once:!0}),t.addEventListener("error",e,{once:!0})}))}));Promise.race([Promise.all(o),new Promise((e=>t.setTimeout(e,s)))]).then((()=>{e()}))}))},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function Z(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function Y(t,e,i){const s=[];let n=!0;return J(t,(t=>{if(t===e&&(n=!1),n&&!z.isWysiwygFrame(t)){if(i&&3===t.nodeType){let e=null,s=null;i.s=i.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)s=n.textContent.replace(w,""),i.s+=s.length,t.textContent=s+t.textContent,e=n,n=n.previousSibling,G.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)s=o.textContent.replace(w,""),i.e+=s.length,t.textContent+=s,e=o,o=o.nextSibling,G.removeItem(e)}s.push(t)}return!1})),s.map(Z).reverse()}function X(t,e){let i,s=e;for(let e=0,n=t.length;e<n&&(i=s.childNodes,0!==i.length);e++)s=i.length<=t[e]?i[i.length-1]:i[t[e]];return s}function j(t,e){const i=[];return t&&0!==t.childNodes.length?(e=e||function(){return!0},function s(n){t!==n&&e(n)&&i.push(n);for(let t=0,e=n.childNodes.length;t<e;t++)s(n.childNodes[t])}(t),i):i}function K(t){if(!t||z.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!z.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function J(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const i=new RegExp(e,"i");s=e=>i.test(e[t])}i||(i=1/0);let n=0;for(;t&&!s(t);){if(n>=i||z.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const Q={getPositionIndex:Z,getNodePath:Y,getNodeFromPath:X,getListChildren:function(t,e){const i=[];if(!t)return i;const s=t;return s.children&&0!==s.children.length?(e=e||function(){return!0},function t(n){if(s!==n&&e(n)&&i.push(n),n.children)for(let e=0,i=n.children.length;e<i;e++)t(n.children[e])}(s),i):i},getListChildNodes:j,getNodeDepth:K,sortNodeByDepth:function(t,e){const i=e?1:-1,s=-1*i;t.sort((function(t,e){if(!z.isListCell(t)||!z.isListCell(e))return 0;const n=K(t),o=K(e);return n>o?i:n<o?s:0}))},compareElements:function(t,e){let i=t,s=e;for(;i&&s&&i.parentElement!==s.parentElement;)i=i.parentElement,s=s.parentElement;if(!i||!s)return{ancestor:null,a:t,b:e,result:0};const n=i.parentNode.childNodes,o=G.getArrayIndex(n,i),l=G.getArrayIndex(n,s);return{ancestor:i.parentElement,a:i,b:s,result:o>l?1:o<l?-1:0}},getParentElement:J,getParentElements:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const i=new RegExp(e,"i");s=e=>i.test(e[t])}const n=[];i||(i=1/0);let o=0;for(;o<=i&&t&&!z.isWysiwygFrame(t);)s(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!G.hasClass(e,"sun-editor");){if(e.hasAttribute("data-command"))return e;e=e.parentElement}return null},getEventTarget:function(t){return t.target},getEdgeChild:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=function(t){return t===e};else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+("text"===e?"#"+e:e)+"$");const i=new RegExp(e,"i");s=function(e){return i.test(e[t])}}const n=j(t,(t=>s(t)));return n[i?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||(e=t);t&&1===t.nodeType&&t.childNodes.length>0&&!z.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!z.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let i=t.previousSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.previousSibling){i=s.previousSibling;break}}if(!i)return null}if(z.isNonEditable(i))return i;for(;i.lastChild;)i=i.lastChild;return i},getNextDeepestNode:function(t,e){let i=t.nextSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.nextSibling){i=s.nextSibling;break}}if(!i)return null}if(z.isNonEditable(i))return i;for(;i.firstChild;)i=i.firstChild;return i},findTextIndexOnLine:function(t,e,i,s){if(!t)return 0;s||(s=()=>!0);let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!s(l))if(3===l.nodeType){if(l===e)return n+=i,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let i=0,s=e.length;i<s;i++)if(t(e[i]),o)return}}(t),n},findTabEndIndex:function(t,e,i){if(!t)return 0;const s=t.textContent,n=new RegExp(`((\\u00A0|\\s){${i},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(s));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(s.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+i}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let i=null,s=-1,n=-1;for(const o of t){const t=o.parentElement.rowIndex,l=o.rowSpan||1,r=o.colSpan||1;e[t]||(e[t]=[]);let a=0;const h=e[t];for(;h[a];)a++;for(let t=0;t<r;t++)h[a+t]=!0;for(let i=1;i<l;i++){const s=t+i;e[s]||(e[s]=[]);for(let t=0;t<r;t++)e[s][a+t]=!0}const c=t+l-1,d=a+r-1;(c>s||c===s&&d>n)&&(s=c,n=d,i=o)}return i},getScrollParent:function t(e){if(!e||/^(body|html)$/i.test(e.nodeName))return null;const i=e;return i.scrollHeight>i.clientHeight?i:t(i.parentNode)},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}},tt={query:Q,check:z,utils:G};function et(t,e=0){if(!t)return 0;const i=(t+"").match(/-?\d+(\.\d+)?/);if(!i||!i[0])return 0;const s=Number(i[0]);return e<0?s:0===e?Math.round(s):Number(s.toFixed(e))}const it={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:et,getOverlapRangeAtIndex:function(t,e,i,s){if(t<=s?e<i:e>i)return 0;const n=(t>i?t:i)-(e<s?e:s);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},st="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",nt="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",ot=st.split("|"),lt="Backspace|Delete".split("|"),rt=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${st}|Insert|Delete|${nt}|NumLock|ScrollLock`.split("|"),at="Backspace|Enter|Delete".split("|"),ht="Backspace|Enter|Delete".split("|"),ct=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${nt}|NumLock|ScrollLock`.split("|");const dt=y,ut=k,pt=A,gt=tt,mt=it,ft={isShift:function(t){return t.shiftKey||16===t.keyCode},isCtrl:function(t){const e=t.code;return t.ctrlKey||t.metaKey||"MetaLeft"===e||"MetaRight"===e},isAlt:function(t){return t.altKey},isComposing:function(t){return t.isComposing||229===t.keyCode},isBackspace:function(t){return"Backspace"===t},isTab:function(t){return"Tab"===t},isEnter:function(t){return"Enter"===t},isEsc:function(t){return"Escape"===t},isSpace:function(t){return"Space"===t},isDirectionKey:function(t){return ot.includes(t)},isRemoveKey:function(t){return lt.includes(t)},isNonTextKey:function(t){return rt.includes(t)},isHistoryRelevantKey:function(t){return at.includes(t)},isDocumentTypeObserverKey:function(t){return ht.includes(t)},isNonResponseKey:function(t){return ct.includes(t)}},_t={write:async function(t){if(!r)return void console.error("Clipboard is not supported in this browser.");let e="",i="";"string"==typeof t?(e=t,i=t):I(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),i={};for(const e of Array.from(t.attributes))i[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(i)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,i=t.textContent):(e=t.textContent,i=t.textContent),await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([i],{type:"text/plain"})})])}},bt={env:dt,unicode:ut,converter:pt,dom:gt,numbers:mt,keyCodeMap:ft,clipboard:_t},yt={redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z" /></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" /></svg>',bold:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"/></svg>',underline:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.2 9.8C6 7.5 7.7 4.8 10.1 4.3C13.2 3.3 17.7 4.7 17.6 8.5H14.6C14.6 8.2 14.5 7.9 14.5 7.7C14.3 7.1 13.9 6.8 13.3 6.6C12.5 6.3 11.2 6.4 10.5 6.9C9 8.2 10.4 9.5 12 10H7.4C7.3 9.9 7.3 9.8 7.2 9.8M21 13V11H3V13H12.6C12.8 13.1 13 13.1 13.2 13.2C13.8 13.5 14.3 13.7 14.5 14.3C14.6 14.7 14.7 15.2 14.5 15.6C14.3 16.1 13.9 16.3 13.4 16.5C11.6 17 9.4 16.3 9.5 14.1H6.5C6.4 16.7 8.6 18.5 11 18.8C14.8 19.6 19.3 17.2 17.3 12.9L21 13Z" /></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,21.03H16.97V20.03L17.86,19.23C18.62,18.58 19.18,18.04 19.56,17.6C19.93,17.16 20.12,16.75 20.13,16.36C20.14,16.08 20.05,15.85 19.86,15.66C19.68,15.5 19.39,15.38 19,15.38C18.69,15.38 18.42,15.44 18.16,15.56L17.5,15.94L17.05,14.77C17.32,14.56 17.64,14.38 18.03,14.24C18.42,14.1 18.85,14 19.32,14C20.1,14.04 20.7,14.25 21.1,14.66C21.5,15.07 21.72,15.59 21.72,16.23C21.71,16.79 21.53,17.31 21.18,17.78C20.84,18.25 20.42,18.7 19.91,19.14L19.27,19.66V19.68H21.85V21.03Z" /></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,9H16.97V8L17.86,7.18C18.62,6.54 19.18,6 19.56,5.55C19.93,5.11 20.12,4.7 20.13,4.32C20.14,4.04 20.05,3.8 19.86,3.62C19.68,3.43 19.39,3.34 19,3.33C18.69,3.34 18.42,3.4 18.16,3.5L17.5,3.89L17.05,2.72C17.32,2.5 17.64,2.33 18.03,2.19C18.42,2.05 18.85,2 19.32,2C20.1,2 20.7,2.2 21.1,2.61C21.5,3 21.72,3.54 21.72,4.18C21.71,4.74 21.53,5.26 21.18,5.73C20.84,6.21 20.42,6.66 19.91,7.09L19.27,7.61V7.63H21.85V9Z" /></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22.11 21.46L2.39 1.73L1.11 3L7.65 9.54C6.74 11.03 6 12.65 6 14.23C6 17.54 8.69 20.23 12 20.23C13.74 20.23 15.3 19.5 16.4 18.29L20.84 22.73L22.11 21.46M12 18.23C9.78 18.23 8 16.45 8 14.23C8 13.5 8.5 12.27 9.14 11.03L15 16.88C14.26 17.71 13.2 18.23 12 18.23M11.14 7.94L9.71 6.5C10.57 5.38 11.25 4.61 11.25 4.61L12 3.77L12.75 4.61C12.75 4.61 14.03 6.06 15.32 7.94S18 12.07 18 14.23C18 14.41 18 14.59 17.97 14.77L15.46 12.26C15 11.23 14.37 10.07 13.68 9.07C12.84 7.85 12.44 7.42 12 6.9C11.73 7.21 11.5 7.5 11.14 7.94Z" /></svg>',remove_format:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5V5.18L8.82,8H11.22L10.5,9.68L12.6,11.78L14.21,8H20V5H6M3.27,5L2,6.27L8.97,13.24L6.5,19H9.5L11.07,15.34L16.73,21L18,19.73L3.55,5.27L3.27,5Z" /></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M11,17H21V15H11M3,8V16L7,12M3,21H21V19H3V21Z" /></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M3,21H21V19H3M3,12L7,16V8M11,17H21V15H11V17Z" /></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z" /></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5,3.09L15,7.59V4H13V11H20V9H16.41L20.91,4.5L19.5,3.09M4,13V15H7.59L3.09,19.5L4.5,20.91L9,16.41V20H11V13H4Z" /></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" /></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" /></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,7.5H18V9.5H13V7.5M13,14.5H18V16.5H13V14.5M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M19,19V5H5V19H19M11,6V11H6V6H11M10,10V7H7V10H10M11,13V18H6V13H11M10,17V14H7V17H10Z" /></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21H11V13H3M5 15H9V19H5M3 11H11V3H3M5 5H9V9H5M13 3V11H21V3M19 9H15V5H19M18 16H21V18H18V21H16V18H13V16H16V13H18Z" /></svg>',new_document:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',select_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,9H15V15H9M7,17H17V7H7M15,5H17V3H15M15,21H17V19H15M19,17H21V15H19M19,9H21V7H19M19,21A2,2 0 0,0 21,19H19M19,13H21V11H19M11,21H13V19H11M9,3H7V5H9M3,17H5V15H3M5,21V19H3A2,2 0 0,0 5,21M19,3V5H21A2,2 0 0,0 19,3M13,3H11V5H13M3,9H5V7H3M7,21H9V19H7M3,13H5V11H3M3,5H5V3A2,2 0 0,0 3,5Z" /></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 22H3V20H21V22M21 4H3V2H21V4M10 13.7H14L12 8.3L10 13.7M11.2 6H12.9L17.6 18H15.6L14.7 15.4H9.4L8.5 18H6.5L11.2 6Z" /></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,11A4,4 0 0,1 6,7A4,4 0 0,1 10,3H18V5H16V21H14V5H12V21H10V11Z" /></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,3H16V6H11V18H8V6H3V3M12,7H14V9H12V7M15,7H17V9H15V7M18,7H20V9H18V7M12,10H14V12H12V10M12,13H14V15H12V13M12,16H14V18H12V16M12,19H14V21H12V19Z" /></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" /></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 18V10H9.12L11.12 6H5.38L3 10.76V18M9 16H5V11.24L6.62 8H7.88L5.88 12H9M21 18V10H19.12L21.12 6H15.38L13 10.76V18M19 16H15V11.24L16.62 8H17.88L15.88 12H19Z" /></svg>',arrow_down:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,11H11V21H13V11H16L12,7L8,11M4,3V5H20V3H4Z" /></svg>',align_middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,19H11V23H13V19H16L12,15L8,19M16,5H13V1H11V5H8L12,9L16,5M4,11V13H20V11H4Z" /></svg>',align_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,13H13V3H11V13H8L12,17L16,13M4,19V21H20V19H4Z" /></svg>',format_float_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,7V9H11V7H21M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,7H21V13H15V7M3,3H21V5H3V3M13,7V9H3V7H13M9,11V13H3V11H9M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,7H15V13H9V7M3,3H21V5H3V3M3,15H21V17H3V15M3,19H17V21H3V19Z" /></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',background_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M4,17L6.75,14.25L6.72,14.23C6.14,13.64 6.14,12.69 6.72,12.11L11.46,7.37L15.7,11.61L10.96,16.35C10.39,16.93 9.46,16.93 8.87,16.37L8.24,17H4M15.91,2.91C16.5,2.33 17.45,2.33 18.03,2.91L20.16,5.03C20.74,5.62 20.74,6.57 20.16,7.16L16.86,10.45L12.62,6.21L15.91,2.91Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',list_bulleted:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_numbered:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',table:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',table_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.88 12L2.2 16.06L6.26 17.74L7.94 21.8L11 20.53V18.36L9 19.19L7.79 16.21L4.81 15L6.05 12L4.81 9L7.79 7.79L9 4.81L12 6.05L15 4.81L16.21 7.79L19.19 9L17.95 12L18 12.13L19.38 10.75C19.82 10.3 20.38 10.06 20.94 10L21.8 7.94L17.74 6.26L16.06 2.2L12 3.88L7.94 2.2L6.26 6.26L2.2 7.94L3.88 12M22.85 13.47L21.53 12.15C21.33 11.95 21 11.95 20.81 12.15L19.83 13.13L21.87 15.17L22.85 14.19C23.05 14 23.05 13.67 22.85 13.47M13 19.96V22H15.04L21.17 15.88L19.13 13.83L13 19.96Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.58,17L12,14.84L8.42,17L9.37,12.93L6.21,10.2L10.38,9.84L12,6L13.62,9.83L17.79,10.19L14.63,12.92L15.58,17M19,3A2,2 0 0,1 21,5V19C21,20.11 20.1,21 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',table_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,2H16A2,2 0 0,1 18,4V20A2,2 0 0,1 16,22H8A2,2 0 0,1 6,20V4A2,2 0 0,1 8,2M8,10V14H16V10H8M8,16V20H16V16H8M8,4V8H16V4H8Z" /></svg>',table_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,1 20,16H4A2,2 0 0,1 2,14V10A2,2 0 0,1 4,8H20A2,2 0 0,1 22,10V14M4,14H8V10H4V14M10,14H14V10H10V14M16,14H20V10H16V14Z" /></svg>',color_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg>',color_palette:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" /></svg>',border_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,11H13V5H19M19,19H13V13H19M11,11H5V5H11M11,19H5V13H11M3,21H21V3H3V21Z" /></svg>',border_inside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,17H21V15H19M19,21H21V19H19M13,3H11V11H3V13H11V21H13V13H21V11H13M15,21H17V19H15M19,5H21V3H19M19,9H21V7H19M17,3H15V5H17M5,3H3V5H5M9,3H7V5H9M3,17H5V15H3M5,7H3V9H5M7,21H9V19H7M3,21H5V19H3V21Z" /></svg>',border_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H21V19H19M15,21H17V19H15M11,17H13V15H11M19,9H21V7H19M19,5H21V3H19M3,13H21V11H3M11,21H13V19H11M19,17H21V15H19M13,3H11V5H13M13,7H11V9H13M17,3H15V5H17M9,3H7V5H9M5,3H3V5H5M7,21H9V19H7M3,17H5V15H3M5,7H3V9H5M3,21H5V19H3V21Z" /></svg>',border_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M15,21H17V19H15M15,5H17V3H15M19,9H21V7H19M19,5H21V3H19M19,13H21V11H19M19,21H21V19H19M11,21H13V3H11M19,17H21V15H19M7,5H9V3H7M3,17H5V15H3M3,21H5V19H3M3,13H5V11H3M7,13H9V11H7M7,21H9V19H7M3,5H5V3H3M3,9H5V7H3V9Z" /></svg>',border_outside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,11H7V13H9M13,15H11V17H13M19,19H5V5H19M3,21H21V3H3M17,11H15V13H17M13,11H11V13H13M13,7H11V9H13V7Z" /></svg>',border_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M19,21H21V19H19M19,13H21V11H19M19,5H21V3H19M19,17H21V15H19M15,21H17V19H15M19,9H21V7H19M3,21H5V3H3M7,13H9V11H7M7,5H9V3H7M7,21H9V19H7M11,13H13V11H11M11,9H13V7H11M11,5H13V3H11M11,17H13V15H11M11,21H13V19H11V21Z" /></svg>',border_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M19,21H21V19H19M11,9H13V7H11M15,21H17V19H15M19,17H21V15H19M3,5H21V3H3M19,13H21V11H19M19,9H21V7H19M11,17H13V15H11M3,9H5V7H3M3,13H5V11H3M3,21H5V19H3M3,17H5V15H3M11,21H13V19H11M11,13H13V11H11M7,13H9V11H7M7,21H9V19H7V21Z" /></svg>',border_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,5H13V3H11M15,5H17V3H15M15,21H17V19H15M19,21H21V3H19M3,9H5V7H3M3,17H5V15H3M3,13H5V11H3M11,21H13V19H11M3,21H5V19H3M7,5H9V3H7M3,5H5V3H3M7,21H9V19H7V21Z" /></svg>',border_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,15H3V17H5M3,21H21V19H3M5,11H3V13H5M19,9H21V7H19M19,5H21V3H19M5,7H3V9H5M19,17H21V15H19M19,13H21V11H19M17,3H15V5H17M13,3H11V5H13M5,3H3V5H5M9,3H7V5H9" /></svg>',border_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M15,21H17V19H15M11,5H13V3H11M19,5H21V3H19M11,9H13V7H11M19,9H21V7H19M19,21H21V19H19M19,13H21V11H19M19,17H21V15H19M11,13H13V11H11M3,5H5V3H3M3,9H5V7H3M3,13H5V11H3M3,17H5V15H3M3,21H5V19H3M11,21H13V19H11M11,17H13V15H11M7,21H9V19H7M7,13H9V11H7M7,5H9V3H7V5Z" /></svg>',horizontal_line:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 3C3.9 3 3 3.9 3 5S2.1 7 1 7V9C2.1 9 3 9.9 3 11S3.9 13 5 13H7V11H5V10C5 8.9 4.1 8 3 8C4.1 8 5 7.1 5 6V5H7V3M11 3C12.1 3 13 3.9 13 5S13.9 7 15 7V9C13.9 9 13 9.9 13 11S12.1 13 11 13H9V11H11V10C11 8.9 11.9 8 13 8C11.9 8 11 7.1 11 6V5H9V3H11M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V15H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',selection_remove:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 20V17H22V20C22 21.11 21.1 22 20 22H17V20H20M2 20V17H4V20H7V22H4C2.9 22 2 21.1 2 20M10 20H14V22H10V20M14.59 8L12 10.59L9.41 8L8 9.41L10.59 12L8 14.59L9.41 16L12 13.41L14.59 16L16 14.59L13.41 12L16 9.41L14.59 8M20 10H22V14H20V10M2 10H4V14H2V10M2 4C2 2.89 2.9 2 4 2H7V4H4V7H2V4M22 4V7H20V4H17V2H20C21.1 2 22 2.9 22 4M10 2H14V4H10V2Z" /></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" /></svg>',image_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M17,13V19H7L12,14L14,16M10,10.5A1.5,1.5 0 0,1 8.5,12A1.5,1.5 0 0,1 7,10.5A1.5,1.5 0 0,1 8.5,9A1.5,1.5 0 0,1 10,10.5Z" /></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,8V16L15,12L10,8Z" /></svg>',video_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M16,18L13.5,16.3V18H8V13H13.5V14.7L16,13V18Z" /></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',link_rel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 1C1.89 1 1 1.89 1 3V14C1 15.11 1.89 16 3 16H14C15.11 16 16 15.11 16 14V11H14V14H3V3H14V5H16V3C16 1.89 15.11 1 14 1M9 7C7.89 7 7 7.89 7 9V12H9V9H20V20H9V18H7V20C7 21.11 7.89 22 9 22H20C21.11 22 22 21.11 22 20V9C22 7.89 21.11 7 20 7H9" /></svg>',math:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" /></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4M8,13V15L11,12L8,9V11H3V13H8M16,11V9L13,12L16,15V13H21V11H16Z" /></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 14H21V20H3V14H5V18H19V14M3 4V10H5V6H19V10H21V4H3M11 11V13H8V15L5 12L8 9V11H11M16 11V9L19 12L16 15V13H13V11H16Z" /></svg>',unmerge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4"/><line x1="7.5" y1="12" x2="16.5" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',caption:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',revert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',resize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23,15H21V17H23V15M23,11H21V13H23V11M23,19H21V21C22,21 23,20 23,19M15,3H13V5H15V3M23,7H21V9H23V7M21,3V5H23C23,4 22,3 21,3M3,21H11V15H1V19A2,2 0 0,0 3,21M3,7H1V9H3V7M15,19H13V21H15V19M19,3H17V5H19V3M19,19H17V21H19V19M3,3C2,3 1,4 1,5H3V3M3,11H1V13H3V11M11,3H9V5H11V3M7,3H5V5H7V3Z" /></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z" /></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,0 20,12H4A2,2 0 0,0 2,14V21H4V19H8V21H10V19H14V21H16V19H20V21H22V14M4,14H8V17H4V14M10,14H14V17H10V14M20,14V17H16V14H20M11,10H13V7H16V5H13V2H11V5H8V7H11V10Z" /></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,2A2,2 0 0,0 11,4V20A2,2 0 0,0 13,22H22V2H13M20,10V14H13V10H20M20,16V20H13V16H20M20,4V8H13V4H20M9,11H6V8H4V11H1V13H4V16H6V13H9V11Z" /></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z" /></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z" /></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z" /></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,8H19A2,2 0 0,1 21,10V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V10A2,2 0 0,1 5,8M5,12V15H11V12H5M13,12V15H19V12H13M5,17V20H11V17H5M13,17V20H19V17H13M11,2H21V6H19V4H13V6H11V2Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z" /></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z" /></svg>',mirror_horizontal:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,9H13V14.5A2.5,2.5 0 0,1 10.5,17A2.5,2.5 0 0,1 8,14.5A2.5,2.5 0 0,1 10.5,12C11.07,12 11.58,12.19 12,12.5V7H16V9M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',audio_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M7.76,16.24L6.35,17.65C4.78,16.1 4,14.05 4,12C4,9.95 4.78,7.9 6.34,6.34L7.75,7.75C6.59,8.93 6,10.46 6,12C6,13.54 6.59,15.07 7.76,16.24M12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16M17.66,17.66L16.25,16.25C17.41,15.07 18,13.54 18,12C18,10.46 17.41,8.93 16.24,7.76L17.65,6.35C19.22,7.9 20,9.95 20,12C20,14.05 19.22,16.1 17.66,17.66M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z" /></svg>',audio_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M20,16H8V4H20M12.5,15A2.5,2.5 0 0,0 15,12.5V7H18V5H14V10.5C13.58,10.19 13.07,10 12.5,10A2.5,2.5 0 0,0 10,12.5A2.5,2.5 0 0,0 12.5,15M4,6H2V20A2,2 0 0,0 4,22H18V20H4" /></svg>',video_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6M20 4V16H8V4H20M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M12 14.5V5.5L18 10L12 14.5Z" /></svg>',file_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,15H9V13H16V15M19,11H9V9H19V11M19,7H9V5H19V7M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3M21,1A2,2 0 0,1 23,3V17C23,18.11 22.11,19 21,19H7A2,2 0 0,1 5,17V3C5,1.89 5.89,1 7,1H21M7,3V17H21V3H7Z" /></svg>',file_browser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 6V20H20V22H2C.895 22 0 21.11 0 20V6H2M12.78 10.05L15.81 9.79L17 7L18.19 9.79L21.22 10.05L18.92 12.04L19.61 15L17 13.47L14.39 15L15.08 12.04L12.78 10.05M24 6V16C24 17.11 23.11 18 22 18H6C4.9 18 4 17.11 4 16V4C4 2.89 4.9 2 6 2H12L14 4H22C23.11 4 24 4.9 24 6M22 6H6V16H22V6Z" /></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',bookmark_anchor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,18L12,15.82L7,18V5H17M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',file_upload:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M12,12L16,16H13.5V19H10.5V16H8L12,12Z" /></svg>',file_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',file_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.81 22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H14L20 8V13.09C19.67 13.04 19.34 13 19 13S18.33 13.04 18 13.09V9H13V4H6V20H13.09C13.21 20.72 13.46 21.39 13.81 22M23 18H20V15H18V18H15V20H18V23H20V20H23V18Z" /></svg>',upload_tray:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 2L6.46 7.46L7.88 8.88L11 5.75V15H13V5.75L16.13 8.88L17.55 7.45L12 2Z" /></svg>',folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z" /></svg>',plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>',minus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H5V11H19V13Z" /></svg>',selection:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,4C2,2.89 2.9,2 4,2H7V4H4V7H2V4M22,4V7H20V4H17V2H20A2,2 0 0,1 22,4M20,20V17H22V20C22,21.11 21.1,22 20,22H17V20H20M2,20V17H4V20H7V22H4A2,2 0 0,1 2,20M10,2H14V4H10V2M10,20H14V22H10V20M20,10H22V14H20V10M2,10H4V14H2V10Z" /></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /></svg>',cut:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z" /></svg>',PDF:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9.5 11.5C9.5 12.3 8.8 13 8 13H7V15H5.5V9H8C8.8 9 9.5 9.7 9.5 10.5V11.5M14.5 13.5C14.5 14.3 13.8 15 13 15H10.5V9H13C13.8 9 14.5 9.7 14.5 10.5V13.5M18.5 10.5H17V11.5H18.5V13H17V15H15.5V9H18.5V10.5M12 10.5H13V13.5H12V10.5M7 10.5H8V11.5H7V10.5Z" /></svg>',format_paint:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,4V3A1,1 0 0,0 17,2H5A1,1 0 0,0 4,3V7A1,1 0 0,0 5,8H17A1,1 0 0,0 18,7V6H19V10H9V21A1,1 0 0,0 10,22H12A1,1 0 0,0 13,21V12H21V4H18Z" /></svg>',find_replace:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6C12.38,6 13.63,6.56 14.54,7.46L12,10H18V4L15.95,6.05C14.68,4.78 12.93,4 11,4C7.47,4 4.57,6.61 4.08,10H6.1C6.56,7.72 8.58,6 11,6M16.64,15.14C17.3,14.24 17.76,13.17 17.92,12H15.9C15.44,14.28 13.42,16 11,16C9.62,16 8.37,15.44 7.46,14.54L10,12H4V18L6.05,15.95C7.32,17.22 9.07,18 11,18C12.55,18 14,17.5 15.14,16.64L20,21.5L21.5,20L16.64,15.14Z" /></svg>',drawing:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.75 20.85C11.53 20.15 11.14 18.22 10.24 17C9.35 15.75 8.12 14.89 6.88 14.06C6 13.5 5.19 12.8 4.54 12C4.26 11.67 3.69 11.06 4.27 10.94C4.86 10.82 5.88 11.4 6.4 11.62C7.31 12 8.21 12.44 9.05 12.96L10.06 11.26C8.5 10.23 6.5 9.32 4.64 9.05C3.58 8.89 2.46 9.11 2.1 10.26C1.78 11.25 2.29 12.25 2.87 13.03C4.24 14.86 6.37 15.74 7.96 17.32C8.3 17.65 8.71 18.04 8.91 18.5C9.12 18.94 9.07 18.97 8.6 18.97C7.36 18.97 5.81 18 4.8 17.36L3.79 19.06C5.32 20 7.88 21.47 9.75 20.85M20.84 5.25C21.06 5.03 21.06 4.67 20.84 4.46L19.54 3.16C19.33 2.95 18.97 2.95 18.76 3.16L17.74 4.18L19.82 6.26M11 10.92V13H13.08L19.23 6.85L17.15 4.77L11 10.92Z" /></svg>',eraser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14,3C14.63,3 14.12,3.2 13.73,3.59L2.59,14.73C1.81,15.5 1.81,16.77 2.59,17.56L5.03,20H12.69L21.41,11.27C22.2,10.5 22.2,9.23 21.41,8.44L16.56,3.59C16.17,3.2 15.65,3 15.14,3M17,18L15,20H22V18" /></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>',selection_search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.27 18.9C19.7 18.21 19.95 17.38 19.95 16.5C19.95 14 17.95 12 15.46 12S10.96 14 10.96 16.5 12.96 21 15.46 21C16.33 21 17.15 20.75 17.84 20.32L20.96 23.39L22.35 22L19.27 18.9M15.46 19C14.07 19 12.96 17.88 12.96 16.5S14.07 14 15.46 14 17.95 15.12 17.95 16.5 16.84 19 15.46 19M22 14H21.45C21.12 13.19 20.62 12.47 20 11.86V10H22V14M20 4H17V2H20C21.11 2 22 2.9 22 4V7H20V4M14 4H10V2H14V4M4 2H7V4H4V7H2V4C2 2.89 2.9 2 4 2M12 22H10V20C10.5 20.82 11.2 21.5 12 22M4 20H7V22H4C2.9 22 2 21.11 2 20V17H4V20M4 14H2V10H4V14Z" /></svg>',embed:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 19H15V21H19C20.1 21 21 20.1 21 19V15H19M19 3H15V5H19V9H21V5C21 3.9 20.1 3 19 3M5 5H9V3H5C3.9 3 3 3.9 3 5V9H5M5 15H3V19C3 20.1 3.9 21 5 21H9V19H5V15M7 11H9V13H7V11M11 11H13V13H11V11M15 11H17V13H15V11Z" /></svg>',menu_arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>',menu_arrow_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>',menu_arrow_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,17L15,12L10,7V17Z" /></svg>',menu_arrow_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,7L9,12L14,17V7Z" /></svg>',side_menu_hamburger:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg>',side_menu_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4A2,2 0 0,1 24,6V16A2,2 0 0,1 22,18H6A2,2 0 0,1 4,16V4A2,2 0 0,1 6,2H12L14,4H22M2,6V20H20V22H2A2,2 0 0,1 0,20V11H0V6H2M6,6V16H22V6H6Z" /></svg>',side_menu_folder_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4H14L12,2H6A2,2 0 0,0 4,4V16A2,2 0 0,0 6,18H22A2,2 0 0,0 24,16V6A2,2 0 0,0 22,4M2,6H0V11H0V20A2,2 0 0,0 2,22H20V20H2V6Z" /></svg>',side_menu_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>',side_menu_folder_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 19C13 19.34 13.04 19.67 13.09 20H4C2.9 20 2 19.11 2 18V6C2 4.89 2.89 4 4 4H10L12 6H20C21.1 6 22 6.89 22 8V13.81C21.12 13.3 20.1 13 19 13C15.69 13 13 15.69 13 19M20 18V15H18V18H15V20H18V23H20V20H23V18H20Z" /></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_text:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z" /></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /></svg>',as_inline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,7L13,17H3L8,7M3,3H21V5H3V3M21,15V17H14V15H21M3,19H21V21H3V19Z" /></svg>',as_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,7L17,17H7L12,7M3,3H21V5H3V3M3,19H21V21H3V19Z" /></svg>',page_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,20H6V18H4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V18H18V20M14,2H6A2,2 0 0,0 4,4V12H6V4H14V8H18V12H20V8L14,2M11,16H8V14H11V16M16,16H13V14H16V16M3,14H6V16H3V14M21,16H18V14H21V16Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6H13V14L16.5,10.5L17.92,11.92L12,17.84L6.08,11.92L7.5,10.5L11,14V6M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,18H11V10L7.5,13.5L6.08,12.08L12,6.16L17.92,12.08L16.5,13.5L13,10V18M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" /></svg>',collapse_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.92,19.92L4,12L11.92,4.08L13.33,5.5L7.83,11H22V13H7.83L13.34,18.5L11.92,19.92M4,12V2H2V22H4V12Z" /></svg>',collapse_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.08,4.08L20,12L12.08,19.92L10.67,18.5L16.17,13H2V11H16.17L10.67,5.5L12.08,4.08M20,12V22H22V2H20V12Z" /></svg>',map:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',open_in_new:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" /></svg>'};var vt=i("cfbI"),Ct=i.n(vt);function wt(t,e,i,s,n,o,l,r){const a=new Map([["key",r],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["documentTypeInner",l.inner],["documentTypePage",l.page],["documentTypePageMirror",l.pageMirror],["wysiwygFrame",i],["wysiwyg",i],["codeWrapper",s],["code",n],["codeNumbers",s?.querySelector(".se-code-view-line")],["lineBreaker_t",e.querySelector(".se-line-breaker-component-t")],["lineBreaker_b",e.querySelector(".se-line-breaker-component-b")],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",et(i.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",-1],["historyIndex",-1],["savedIndex",-1],["eventwysiwyg",null]]);o&&xt(o,a);const h=e.querySelector(".se-placeholder");return h&&a.set("placeholder",h),a}function xt(t,e){t?e.set("statusbar",t):e.delete("statusbar");const i=t?t.querySelector(".se-navigation"):null,s=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;i?e.set("navigation",i):e.delete("navigation"),s?e.set("charWrapper",s):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter")}function kt(t,e,i,s,n){const o=new Map([["menuTray",i],["toolbar.main",t],["toolbar.buttonTray",t.querySelector(".se-btn-tray")],["toolbar._arrow",t.querySelector(".se-arrow")]]);return s&&(o.set("toolbar.sub.main",s),o.set("toolbar.sub.buttonTray",s.querySelector(".se-btn-tray")),o.set("toolbar.sub._arrow",s.querySelector(".se-arrow")),o.set("toolbar.sub._wrapper",s.parentElement.parentElement)),e&&(o.set("toolbar._wrapper",e.querySelector(".sun-editor")),o.set("_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy"))),n&&o.set("statusbar._wrapper",n.querySelector(".sun-editor")),o}const Et={BUTTON_LIST:[["undo","redo"],"|",["bold","underline","italic","strike","|","subscript","superscript"],"|",["removeFormat"],"|",["outdent","indent"],"|",["fullScreen","showBlocks","codeView"],"|",["preview","print"]],REQUIRED_FORMAT_LINE:"div",REQUIRED_ELEMENT_WHITELIST:"br|div",ELEMENT_WHITELIST:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",TEXT_STYLE_TAGS:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary",SCOPE_SELECTION_TAGS:["td","table","li","ol","ul","pre","figcaption","blockquote","dl","dt","dd"],ATTRIBUTE_WHITELIST:"contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling",FORMAT_LINE:"P|H[1-6]|LI|TH|TD|DETAILS",FORMAT_BR_LINE:"PRE",FORMAT_CLOSURE_BR_LINE:"",FORMAT_BLOCK:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS",FORMAT_CLOSURE_BLOCK:"TH|TD",ALLOWED_EMPTY_NODE_LIST:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details",SIZE_UNITS:["px","pt","em","rem"],CLASS_NAME:"^__se__|^se-|^katex|^MathJax",CLASS_MJX:"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover",EXTRA_TAG_MAP:{script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},CONTENT_STYLES:"background|background-clip|background-color|border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|box-shadow|box-sizing|caption-side|color|content|direction|display|float|font|font-family|font-size|font-style|font-weight|height|left|letter-spacing|line-height|list-style-position|list-style-type|margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|max-width|min-width|outline|overflow|position|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|page-break-before|page-break-after|page-break-inside|rotate|rotateX|rotateY|table-layout|text-align|text-decoration|text-shadow|text-transform|top|text-indent|text-rendering|vertical-align|visibility|white-space|width|word-break|word-wrap",TAG_STYLES:{"table|th|td":"border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align|text-align","table|td":"width",tr:"height",col:"width","ol|ul":"list-style-type"},TEXT_STYLES:"font-family|font-size|color|background-color",LINE_STYLES:"text-align|margin-left|margin-right|line-height",RETAIN_STYLE_MODE:["repeat","always","none"]},St=dt._d,Tt={value:"fixed",placeholder:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,height:!0,minHeight:!0,maxHeight:!0,editorStyle:!0,iframe:"fixed",iframe_fullPage:"fixed",iframe_attributes:!0,iframe_cssFileName:!0,statusbar:!0,statusbar_showPathLabel:!0,statusbar_resizeEnable:"fixed",charCounter:!0,charCounter_max:!0,charCounter_label:!0,charCounter_type:!0},Ht={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"fixed",type:"fixed",theme:!0,lang:"fixed",fontSizeUnits:"fixed",allowedClassName:"fixed",closeModalOutsideClick:"fixed",copyFormatKeepOn:!0,syncTabIndent:!0,tabDisable:!0,autoLinkify:!0,autoStyleify:!0,scrollToOptions:!0,componentScrollToOptions:!0,retainStyleMode:!0,allowedExtraTags:"fixed",events:!0,__textStyleTags:"fixed",textStyleTags:"fixed",convertTextTags:"fixed",__tagStyles:"fixed",tagStyles:"fixed",spanStyles:"fixed",lineStyles:"fixed",textDirection:!0,reverseButtons:"fixed",historyStackDelayTime:!0,lineAttrReset:!0,printClass:!0,defaultLine:"fixed",defaultLineBreakFormat:!0,scopeSelectionTags:!0,__defaultElementWhitelist:"fixed",elementWhitelist:"fixed",elementBlacklist:"fixed",__defaultAttributeWhitelist:"fixed",attributeWhitelist:"fixed",attributeBlacklist:"fixed",__defaultFormatLine:"fixed",formatLine:"fixed",__defaultFormatBrLine:"fixed",formatBrLine:"fixed",__defaultFormatClosureBrLine:"fixed",formatClosureBrLine:"fixed",__defaultFormatBlock:"fixed",formatBlock:"fixed",__defaultFormatClosureBlock:"fixed",formatClosureBlock:"fixed",allowedEmptyTags:!0,toolbar_width:!0,toolbar_container:"fixed",toolbar_sticky:!0,toolbar_hide:!0,subToolbar:"fixed",statusbar_container:"fixed",shortcutsHint:!0,shortcutsDisable:"fixed",shortcuts:"fixed",fullScreenOffset:!0,previewTemplate:!0,printTemplate:!0,componentAutoSelect:!0,defaultUrlProtocol:!0,allUsedStyles:"fixed",toastMessageTime:!0,icons:"fixed",freeCodeViewMode:!0,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"};function Lt(t,e,i,s,n,o){if(!i||i.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let h,c,d,u,p,g,m,f,_,b,y,v,C,w,x=0;x<i.length;x+=2+w){if(w=0,h=i[x].split("+"),_=null,b=h[h.length-1].trim?.(),b.startsWith("~"))_=t,b=h.pop().trim().substring(1);else if(b.startsWith("$~")){const t=h.pop().trim().substring(2).split(".");_=t[0],b=t[1]}else b.startsWith("$")?(w=1,b=i[x+2]):b="";d=u=p=g=m=f=c=null;for(const t of h)switch(t.trim()){case"c":d=!0;break;case"!":p=!0;break;case"s":u=!0;break;case"_":g=!0;break;case"=":f=!0;break;case"/":m=!0;break;default:c=t}c=c.split("|");for(let i=0,l=c.length;i<l;i++)v=d?c[i]+(u?"1000":""):c[i],s.has(v)||(C=n.indexOf(t),C=-1===C?"":mt.isOdd(C)?n[C+1]:n[C-1],C&&o.push(v),s.set(v,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:_,command:t,method:b,r:C,type:e?.getAttribute("data-type"),button:e,key:v}));(y=i[x+1])&&(l&&(r=u,a=y,l.appendChild(gt.utils.createElement("SPAN",{class:"se-shortcut"},dt.cmdIcon+(r?dt.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function Mt(t,e){return[t,e].reduce(((t,e)=>{for(const i in e)t[i]=(e[i]||"").toLowerCase();return t}),{})}function Nt(t,e,i){const s=t.buttonList||Et.BUTTON_LIST,n=new Map;if(e.length>1&&!t.toolbar_container&&!/inline|balloon/i.test(t.mode))throw Error('[SUNEDITOR.create.fail] In multi root, The "mode" option cannot be "classic" without using the "toolbar_container" option.');n.set("v2Migration",!!t.v2Migration),n.set("buttons",new Set(s.toString().split(",")));const o=!1!==t.strictMode;n.set("strictMode",{tagFilter:o,formatFilter:o,classFilter:o,textStyleTagFilter:o,attrFilter:o,styleFilter:o,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0),n.set("mode",t.mode||"classic"),n.set("type",t.type?.split(":")[0]||""),n.set("theme",t.theme||""),n.set("_themeClass",t.theme?` se-theme-${t.theme}`:""),n.set("_type_options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):Et.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${Et.CLASS_NAME}`)),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!i.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]),n.set("scrollToOptions",{behavior:"auto",block:"nearest",...t.scrollToOptions}),n.set("componentScrollToOptions",{behavior:"smooth",block:"center",...t.componentScrollToOptions});let l=t.retainStyleMode;"string"!=typeof l||Et.RETAIN_STYLE_MODE.includes(l)||(console.error(`Invalid retainStyleMode: ${l}. Valid options are ${Et.RETAIN_STYLE_MODE.join(", ")}. Using default 'once'.`),l="repeat"),n.set("retainStyleMode",l);const r={...Et.EXTRA_TAG_MAP,...t.allowedExtraTags,"-":!0},a=Object.keys(r),h=a.filter((t=>r[t])).join("|"),c=a.filter((t=>!r[t])).join("|");n.set("_allowedExtraTag",h),n.set("_disallowedExtraTag",c),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:Et.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const d=Mt({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",d),n.set("_textStyleTags",Object.values(d).concat(["span","li"])),n.set("tagStyles",[{...Et.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Et.TEXT_STYLES}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Et.LINE_STYLES}${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_defaultStyleTagMap",{strong:d.bold,b:d.bold,u:d.underline,ins:d.underline,em:d.italic,i:d.italic,del:d.strike,strike:d.strike,s:d.strike,sub:d.subscript,sup:d.superscript}),n.set("_styleCommandMap",Mt(pt.swapKeyValue(d),{strong:"bold",b:"bold",u:"underline",ins:"underline",em:"italic",i:"italic",del:"strike",strike:"strike",s:"strike",sub:"subscript",sup:"superscript"})),n.set("_defaultTagCommand",{bold:d.bold,underline:d.underline,italic:d.italic,strike:d.strike,subscript:d.sub,superscript:d.sup}),n.set("textDirection","string"!=typeof t.textDirection?"ltr":t.textDirection),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),mt.isEven(n.get("_reverseCommandArray").length)&&console.warn('[SUNEDITOR.create.warning] The "reverseCommands" option is invalid, Shortcuts key may not work properly.'),n.set("historyStackDelayTime","number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400),n.set("_editableClass","sun-editor-editable"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")+("document"===n.get("type")?" se-type-document-editable":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass+" "+n.get("_editableClass"):null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p"),n.set("defaultLineBreakFormat",t.defaultLineBreakFormat||"line"),n.set("scopeSelectionTags",t.scopeSelectionTags||Et.SCOPE_SELECTION_TAGS);const u=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),p=n.get("externalLibs").mathjax?Et.CLASS_MJX+"|":"";n.set("elementWhitelist",u+(u?"|":"")+p+n.get("_allowedExtraTag"));const g=(m=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),f=(f=n.get("defaultLine")).toLowerCase(),m.split("|").filter((function(t){return t!==f||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${f}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var m,f;if(n.set("elementBlacklist",g+(g?"|":"")+n.get("_disallowedExtraTag")),n.set("attributeWhitelist",t.attributeWhitelist&&"object"==typeof t.attributeWhitelist?t.attributeWhitelist:null),n.set("attributeBlacklist",t.attributeBlacklist&&"object"==typeof t.attributeBlacklist?t.attributeBlacklist:null),n.set("formatClosureBrLine",Ot(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:Et.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",Ot((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:Et.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",Ot(Et.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:Et.FORMAT_LINE).toLowerCase(),n.get("elementBlacklist"))),!n.get("formatLine").reg.test(n.get("defaultLine")))throw Error(`[SUNEDITOR.create.fail] The "defaultLine(${n.get("defaultLine")})" option must be included in the "formatLine(${n.get("formatLine").str})" option.`);n.set("formatClosureBlock",Ot(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:Et.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",Ot((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:Et.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",Et.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",Et.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:Et.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:Et.ATTRIBUTE_WHITELIST).toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),i=(t.get("__defaultElementWhitelist")+"|"+t.get("elementWhitelist")+"|"+t.get("formatLine").str+"|"+t.get("formatBrLine").str+"|"+t.get("formatClosureBlock").str+"|"+t.get("formatClosureBrLine").str).replace(/(^\||\|$)/g,"").split("|").filter(((t,i,s)=>t&&s.indexOf(t)===i&&!e.includes(t)));return i.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?mt.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?St.querySelector(t.toolbar_container):t.toolbar_container:null),n.set("toolbar_sticky",/balloon/i.test(n.get("mode"))?-1:void 0===t.toolbar_sticky?0:mt.is(t.toolbar_sticky)?mt.get(t.toolbar_sticky,0):-1),n.set("toolbar_hide",!!t.toolbar_hide);let _=null;const b=t.subToolbar;b?.buttonList?.length>0&&(/balloon/.test(n.get("mode"))?console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.'):(n.set("_subMode",b.mode||"balloon"),n.set("toolbar.sub_width",b.width?mt.is(b.width)?b.width+"px":b.width:"auto"),_=n.get("_rtl")?b.buttonList.reverse():b.buttonList,n.set("buttons_sub",new Set(_.toString().split(",")))));const y=new Map;for(let i=0,s=e.length;i<s;i++)y.set(e[i].key,Bt(e[i].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const v=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],link:["c+KeyK","K"],hr:["!+---+=+~shortcut",""],list_numbered:["!+1.+_+~shortcut",""],list_bulleted:["!+*.+_+~shortcut",""],_h1:["c+s+Digit1|Numpad1+$~formatBlock.applyHeaderByShortcut",""],_h2:["c+s+Digit2|Numpad2+$~formatBlock.applyHeaderByShortcut",""],_h3:["c+s+Digit3|Numpad3+$~formatBlock.applyHeaderByShortcut",""]},t.shortcuts||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):{};n.set("shortcuts",v),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:mt.is(t.fullScreenOffset)?mt.get(t.fullScreenOffset,0):0),n.set("previewTemplate","string"==typeof t.previewTemplate?t.previewTemplate:null),n.set("printTemplate","string"==typeof t.printTemplate?t.printTemplate:null),n.set("componentAutoSelect",void 0!==t.componentAutoSelect&&!!t.componentAutoSelect),n.set("defaultUrlProtocol","string"==typeof t.defaultUrlProtocol?t.defaultUrlProtocol:null);const C=n.get("externalLibs").codeMirror;C&&(n.set("codeMirror",C),C.EditorView?n.set("codeMirror6Editor",!0):C.src?n.set("codeMirror5Editor",!0):(console.warn("[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly."),n.set("codeMirror",null))),n.set("__listCommonStyle",t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"]);const w=t.icons&&"object"==typeof t.icons?[yt,t.icons].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):yt;n.set("icons",w);const x=new Set(Et.CONTENT_STYLES.split("|")),k=t.spanStyles?.split("|")||[],E=n.get("__listCommonStyle"),S=Et.TEXT_STYLES.split("|");for(let t=0,e=S.length;t<e;t++)x.add(S[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,i=e.length;t<i;t++)x.add(e[t])}for(let t=0,e=k.length;t<e;t++)x.add(k[t]);for(let t=0,e=E.length;t<e;t++)x.add(E[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)x.add(T[t]);return n.set("allUsedStyles",x),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:w,l:t.lang||Ct(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?s.reverse():s,subButtons:_,statusbarContainer:"string"==typeof t.statusbar_container?St.querySelector(t.statusbar_container):t.statusbar_container,frameMap:y}}function At(t,e){let i=null,s=null,n=null;if(t.get("statusbar")&&(i=(e=e||gt.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"})).querySelector(".se-navigation")||gt.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(i),t.get("charCounter"))){if(s=e.querySelector(".se-char-counter-wrapper")||gt.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=s.querySelector(".se-char-label")||gt.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),s.appendChild(e)}if(n=s.querySelector(".se-char-counter")||gt.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",s.appendChild(n),t.get("charCounter_max")>0){const e=s.querySelector(".se-char-max")||gt.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),s.appendChild(e)}e.appendChild(s)}return{statusbar:e,navigation:i,charWrapper:s,charCounter:n}}function Bt(t,e){const i=new Map;i.set("_origin",t);const s=e.statusbar_container,n=void 0===t.value?e.value:t.value,o=void 0===t.placeholder?e.placeholder:t.placeholder,l=void 0===t.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,r=void 0===t.width?e.width:t.width,a=void 0===t.minWidth?e.minWidth:t.minWidth,h=void 0===t.maxWidth?e.maxWidth:t.maxWidth,c=void 0===t.height?e.height:t.height,d=void 0===t.minHeight?e.minHeight:t.minHeight,u=void 0===t.maxHeight?e.maxHeight:t.maxHeight,p=void 0===t.editorStyle?e.editorStyle:t.editorStyle,g=void 0===t.iframe?e.iframe:t.iframe,m=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,f=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,_=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,b=s||void 0===t.statusbar?e.statusbar:t.statusbar,y=s||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,v=!s&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),C=s||void 0===t.charCounter?e.charCounter:t.charCounter,w=s||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=s||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,k=s||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;i.set("value",n),i.set("placeholder",o),i.set("editableFrameAttributes",l||{}),i.set("width",r?mt.is(r)?r+"px":r:"100%"),i.set("minWidth",(mt.is(a)?a+"px":a)||""),i.set("maxWidth",(mt.is(h)?h+"px":h)||""),i.set("height",c?mt.is(c)?c+"px":c:"auto"),i.set("minHeight",(mt.is(d)?d+"px":d)||""),i.set("maxHeight",(mt.is(u)?u+"px":u)||""),i.set("editorStyle",p),i.set("_defaultStyles",pt._setDefaultOptionStyle(i,"string"==typeof p?p:"")),i.set("iframe",!(!m&&!g)),i.set("iframe_fullPage",!!m),i.set("iframe_attributes",f||{}),i.set("iframe_cssFileName",g?"string"==typeof _?[_]:_||["suneditor"]:null);const E=void 0===b||!!b;return i.set("statusbar",E),i.set("statusbar_showPathLabel",!!E&&("boolean"!=typeof y||y)),i.set("statusbar_resizeEnable",!!E&&(void 0===v||!!v)),i.set("charCounter",w>0||"boolean"==typeof C&&C),i.set("charCounter_max",mt.is(w)&&w>-1?1*w:null),i.set("charCounter_label","string"==typeof x?x.trim():null),i.set("charCounter_type","string"==typeof k?k:"char"),i}function It(t,e,i,s){const n=s.get("_defaultStyles");i.style.cssText=n.top;const o=gt.utils.createElement(s.get("iframe")?"IFRAME":"DIV",{class:"se-wrapper-inner se-wrapper-wysiwyg","data-root-key":t});if(s.get("iframe")){const t=s.get("iframe_attributes");for(const e in t)o.setAttribute(e,t[e]);const e=o;e.allowFullscreen=!0,e.frameBorder="0",e.style.cssText=n.frame}else o.setAttribute("contenteditable","true"),o.setAttribute("scrolling","auto"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=gt.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=gt.utils.createElement("SPAN",{class:"se-placeholder"});return s.get("placeholder")&&(r.textContent=s.get("placeholder")),{bottomBar:At(s,null),wysiwygFrame:o,codeView:l,placeholder:r}}function Vt(t,e,i){let s=null,n=!1;if(t.get("codeMirror6Editor")){const o=t.get("codeMirror"),l=i.style.cssText,r=new o.EditorView({parent:i.parentElement,extensions:o.extensions,state:o.state});e.set("codeMirror6Editor",r),s=r.dom,s.style.cssText=l,n=!0}else if(t.get("codeMirror5Editor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},o.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=i.style.cssText,a=o.src.fromTextArea(i,l);e.set("codeMirror5Editor",a),s=a.display.wrapper,s.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),s?(gt.utils.removeItem(i),s.className+=" se-code-viewer-mirror",s):i}function Ot(t,e,i){const s=i.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!s.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function Rt(){const t=gt.utils.createElement("UL",{class:"se-menu-list"});return{div:gt.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function zt(t,e,i,s,n,o,l){n||(n="");const r=gt.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(s),c="se-toolbar-separator-vertical"===t?gt.utils.createElement("DIV",{class:t,tabindex:"-1"},null):gt.utils.createElement(h?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":i,"data-type":s,"aria-label":a.replace(/<span .+<\/span>/,""),tabindex:"-1"});return h||c.setAttribute("type","button"),/^default\./i.test(n)&&(n=l[n.replace(/^default\./i,"")]),/^text\./i.test(n)&&(n=n.replace(/^text\./i,""),c.className+=" se-btn-more-text"),o&&(c.disabled=!0),/^FIELD$/i.test(s)&>.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=gt.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function $t(t,e,i,s){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||i[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(s[e.title]||e.title)+"</span></span>",t.setAttribute("aria-label",e.title),e.type&&t.setAttribute("data-type",e.type),e.className&&(t.className+=" "+e.className),e.afterItem&&(gt.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),gt.utils.addClass(t,"se-side-btn-a"),gt.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(gt.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(gt.utils.addClass(t,"se-side-btn"),gt.utils.removeClass(t,"se-side-btn-a")):gt.utils.addClass(t,"se-side-btn-b"),gt.utils.addClass(e.beforeItem,"se-side-btn-before")),e.replaceButton&&(t.parentElement.appendChild(e.replaceButton),t.style.display="none"),!e.replaceButton&&/^INPUT$/i.test(t.getAttribute("data-type"))){const e=t.querySelector("input");e&&(gt.utils.addClass(e,"se-toolbar-btn"),e.setAttribute("data-command",t.getAttribute("data-command")),e.setAttribute("data-type",t.getAttribute("data-type")),t.hasAttribute("disabled")&&(e.disabled=!0))}}function Ft(t,e,i,s,n,o){t=JSON.parse(JSON.stringify(t));const l=function(t,e,i){const s=t.get("_rtl");return{bold:["",i.bold,"bold","",e.bold],underline:["",i.underline,"underline","",e.underline],italic:["",i.italic,"italic","",e.italic],strike:["",i.strike,"strike","",e.strike],subscript:["",i.subscript,"subscript","",e.subscript],superscript:["",i.superscript,"superscript","",e.superscript],removeFormat:["",i.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",i.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",i.indent,"indent","",s?e.outdent:e.indent],outdent:["se-icon-flip-rtl",i.outdent,"outdent","",s?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",i.fullScreen,"fullScreen","",e.expansion],showBlocks:["",i.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",i.codeView,"codeView","",e.code_view],undo:["se-component-enabled",i.undo,"undo","",e.undo],redo:["se-component-enabled",i.redo,"redo","",e.redo],preview:["se-component-enabled",i.preview,"preview","",e.preview],print:["se-component-enabled",i.print,"print","",e.print],copy:["",i.copy,"copy","",e.copy],dir:["",i[s?"dir_ltr":"dir_rtl"],"dir","",e[s?"dir_ltr":"dir_rtl"]],dir_ltr:["",i.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",i.dir_rtl,"dir_rtl","",e.dir_rtl],save:["se-component-enabled",i.save,"save","",e.save],newDocument:["se-component-enabled",i.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",i.selectAll,"selectAll","",e.select_all],pageBreak:["se-component-enabled",i.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",i.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",i.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}(i,s,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=gt.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=gt.utils.createElement("DIV",{class:"se-btn-tray"}),_=gt.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let i,b,y,v,C,w=0;w<t.length;w++)if(i=!1,C="",v=t[w],p=Rt(),"object"==typeof v){for(let f,_=0;_<v.length;_++){if(d=v[_],f=!1,u=e[d],/^%\d+/.test(d)&&0===_){v[0]=d.replace(/[^\d]/g,""),a.push(v),t.splice(w--,1);continue t}if("function"==typeof u)c=[u.className,u.title,d,u.type,u.innerHTML,u._disabled];else if("object"==typeof u){const t=u.constructor;c=[u.className||t.className,u.title||t.title,d,u.type||t.type,u.innerHTML||t.innerHTML,u._disabled||t._disabled]}else{if(/^-/.test(d)){C=d.substring(1),p.div.className+=" module-float-"+C;continue}if(/^#/.test(d)){"fix"===d.substring(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);y="__se__more_"+w;const e=t[1].trim(),i=t[2].trim();c=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,y,"MORE",i]}else if("|"===d)c=["se-toolbar-separator-vertical","","","separator",""];else{if("copy"===d&&!dt.isClipboardSupported){console.warn("[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered.");continue}c=l[d]}if(!c){if(!u)throw Error(`[SUNEDITOR.create.toolbar.fail] The button name of a plugin that does not exist. [${d}]`);u="object"==typeof u?u.constructor:u,c=[u.className,u.title,u.key,u.type,u.innerHTML,u._disabled]}}g=zt(c[0],c[1],c[2],c[3],c[4],c[5],s),(i?b:p.ul).appendChild(g.li),u&&(r[d]?r[d].push(g.button):r[d]=[g.button],o&&h.push({button:g.button,plugin:u,key:d})),f&&(i=!0,b=gt.utils.createElement("DIV"),b.className="se-more-layer "+y,b.setAttribute("data-ref",y),b.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(C?' style="float: '+C+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===v){const t=_.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(v)){const t=gt.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:gt.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=gt.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(i.get("shortcutsHint")?"":" se-shortcut-hide")},f);return i.get("toolbar_hide")&&(b.style.display="none"),{element:b,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const Pt=function(t,e){"object"!=typeof e&&(e={});const i={};if(e.plugins){const t=e.excludedPlugins||[],s=e.plugins,n=(Array.isArray(s)?s:Object.keys(s)).filter((e=>!t.includes(e))).map((t=>s[t]));for(let t,e=0,s=n.length;e<s;e++)t=n[e].default||n[e],i[t.key]=t}const s=Nt(e,t,i),n=s.o,o=s.i,l=s.l,r=gt.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=gt.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=gt.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=gt.utils.createElement("INPUT",{class:"__se__focus__temp__",style:"position: fixed !important; top: -10000px !important; left: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;"});c.tabIndex=0,a.appendChild(c);const d=gt.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=gt.utils.createElement("DIV",{class:"se-modal-back"}),p=gt.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=gt.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=gt.utils.createElement("DIV",{class:"se-modal-back"}),f=gt.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(gt.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const _=gt.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(_),St.body.appendChild(a);let b=null,y=null;const v=Ft(s.buttons,i,n,o,l,!1),C=v.element;C.style.visibility="hidden",/inline/i.test(n.get("mode"))?(C.className+=" se-toolbar-inline",C.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(C.className+=" se-toolbar-balloon",C.style.width=n.get("toolbar_width"),C.appendChild(gt.utils.createElement("DIV",{class:"se-arrow"}))),s.subButtons&&(y=Ft(s.subButtons,i,n,o,l,!1),b=y.element,b.style.visibility="hidden",b.className+=" se-toolbar-balloon se-toolbar-sub",b.style.width=n.get("toolbar.sub_width"),b.appendChild(gt.utils.createElement("DIV",{class:"se-arrow"})));const w=t[0].key||null,x=[],k=new Map,E=s.statusbarContainer;let S=null;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=s.frameMap.get(i.key),h=gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=gt.utils.createElement("DIV",{class:"se-container"}),d=gt.utils.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")});c.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=It(i.key,n,h,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const _=gt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),b=gt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(_),d.appendChild(b),m&&d.appendChild(m),c.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),c.appendChild(d),p&&(E?S||(E.appendChild(gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),S=p):c.appendChild(p)),c.appendChild(r.cloneNode(!0));const y=i.key||null,v=gt.utils.createElement("DIV",{class:"se-code-wrapper"},f);v.style.setProperty("display","none","important"),d.appendChild(v);const C=Vt(n,a,f);if(f===C){const t=gt.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);v.insertBefore(t,f)}else f=C;const w={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(w.inner=gt.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${a.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(w.page=gt.utils.createElement("DIV",{class:"se-document-page"},null),w.pageMirror=gt.utils.createElement("DIV",{class:"sun-editor-editable se-document-page-mirror-a4",style:"position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;"},null)),h.appendChild(c),x.push(y),k.set(y,wt({target:i.target,key:i.key,options:a},h,g,v,f,S||p,w,y))}const T=n.get("toolbar_container");if(T){const t=gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=gt.utils.createElement("DIV",{class:"se-container"});e.appendChild(C),b&&e.appendChild(b),t.appendChild(e),T.appendChild(t),T.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=k.get(w).get("container");t.insertBefore(C,t.firstElementChild),b&&t.insertBefore(b,t.firstElementChild)}return{context:kt(C,T,h,b,E),carrierWrapper:a,options:n,plugins:i,icons:o,lang:l,value:s.v,rootId:w,rootKeys:x,frameRoots:k,pluginCallButtons:v.pluginCallButtons,responsiveButtons:v.responsiveButtons,pluginCallButtons_sub:y?y.pluginCallButtons:[],responsiveButtons_sub:y?y.responsiveButtons:[]}},{NO_EVENT:Dt}=dt,qt={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};let Wt=null,Ut=null;const Gt=function(t,e){return Wt=this.eventManager.removeGlobalEvent("keydown",Wt),Ut=this.eventManager.removeGlobalEvent("mousedown",Ut),this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,gt.utils.removeClass(t,"se-copy-format-cursor"),gt.utils.removeClass(e,"on"),!0},Zt=function(t){const e=gt.check.isContentLess,i=gt.check.isTable;return{first:gt.query.getEdgeChild(gt.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||i(t)),!1)||t.firstChild,last:gt.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||i(t)),!0)||t.lastChild}},Yt=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],Xt=Yt.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);function jt(t,e){if("function"==typeof t._onCopyFormatInitMethod)return void t._onCopyFormatInitMethod();const i=t.frameContext.get("wysiwyg");t._onCopyFormatInfo=[...t.eventManager.__cacheStyleNodes],t._onCopyFormatInitMethod=Gt.bind(t,i,e),gt.utils.addClass(i,"se-copy-format-cursor"),gt.utils.addClass(e,"on"),Wt=t.eventManager.addGlobalEvent("keydown",(e=>{ft.isEsc(e.code)&&t._onCopyFormatInitMethod?.()})),Ut=t.eventManager.addGlobalEvent("mousedown",(s=>{i.contains(s.target)||s.target===e||t._onCopyFormatInitMethod?.()}))}function Kt(e){const i=e.frameRoots;let s,n,o,l,r=e.options.get("historyStackDelayTime"),a=null,h=!1,c=null;function d(t,i,s){s&&e.status.hasFocus&&e.eventManager.applyTagEffect(),e.history.resetButtons(t.get("key"),i),e.triggerEvent("onChange",{frameContext:t,data:t.get("wysiwyg").innerHTML}),"block"===e.context.get("toolbar.main").style.display?e.toolbar._showBalloon():e.isSubBalloon&&"block"===e.context.get("toolbar.sub.main").style.display&&e.subToolbar._showBalloon()}function u(t){const l=n[s],r=o[l],a=e.frameContext;s+=t;const h=t<0&&l!==n[s]&&r.index>0?l:n[s],c=o[h];c.index+=t;const u=c.value[c.index];i.get(h).get("wysiwyg").innerHTML=u.content,l!==h&&t<0&&1===s?s=0:l!==h&&t>0&&1===c.index?s++:(t<0&&c.index<1||t>0&&c.index>c.value.length)&&(s+=t);let p=h,g=u;if(t<0&&s>0&&0===c.index){const e=n[s+t];if(e!==h){const t=o[e];p=e,g=t.value[t.index]}}e.changeFrameContext(p),e.selection.setRange(X(g.s.path,g.frame),g.s.offset,X(g.e.path,g.frame),g.e.offset),e.focus(),s<0?s=0:s>=n.length&&(s=n.length-1),e.ui._offCurrentController(),e._checkComponents(!1),e.char.display(),e._resourcesStateChange(a),a.has("documentType-use-header")&&a.get("documentType").reHeader(),d(a,c.index,!0)}function p(t,e,l,r){let a,h;e?(a={path:Y(e.startContainer,null,null),offset:e.startOffset},h={path:Y(e.endContainer,null,null),offset:e.endOffset}):(a={path:[0,0],offset:[0,0]},h={path:0,offset:0}),s+=r,n[s]=l;const c=o[l];c.index+=r,c.value[c.index]={content:t,s:a,e:h,frame:i.get(l).get("wysiwyg")}}function g(t){o[t]={value:[],index:-1},l[t]=i.get(t).get("wysiwyg").innerHTML}function m(t,r){e._checkComponents(!1);const a=i.get(t),h=a.get("wysiwyg").innerHTML,c=o[t];!h||c.value[c.index]&&h===c.value[c.index].content||(n.length>s+1&&function(t){const i=[];for(let t=s+1,e=n.length;t<e;t++)i.includes(n[t])||i.push(n[t]);n=n.slice(0,s+1),t.value.splice(s+1),e.applyCommandTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=i.length;t<e;t++)n.includes(i[t])||g(i[t])}(c),0===c.value.length&&function(t){s++,n[s]=t;const e=o[t];e.index=0,e.value[0]={content:l[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:i.get(t).get("wysiwyg")}}(t),p(h,r,t,1),1===s&&e.applyCommandTargets("undo",(t=>{t.disabled=!1})),e.char.display(),d(a,c.index,!1))}return{push(s,n){if(h)return;n=n||e.status.rootKey;const o=e.status._range;t.setTimeout(e._resourcesStateChange.bind(e,i.get(n)),0);const l="number"==typeof s?s>0?s:0:s?r:0;l&&!a||(t.clearTimeout(a),l)?a=t.setTimeout((()=>{t.clearTimeout(a),a=null,m(n,o)}),l):m(n,o)},check(e,i){a&&(t.clearTimeout(a),a=null,m(e,i))},undo(){s>0&&u(-1)},redo(){n.length-1>s&&u(1)},overwrite(t){p(i.get(t||e.status.rootKey).get("wysiwyg").innerHTML,null,e.status.rootKey,0)},pause(){h=!0,c&&(t.clearTimeout(c),c=null),c=t.setTimeout((()=>{h=!1}),5e3)},resume(){c&&(t.clearTimeout(c),c=null),h=!1},reset(){e.applyCommandTargets("undo",(t=>t.disabled=!0)),e.applyCommandTargets("redo",(t=>t.disabled=!0)),e.applyCommandTargets("save",(t=>t.disabled=!0)),e.applyFrameRoots((t=>t.set("historyIndex",-1))),e.applyFrameRoots((t=>t.set("isChanged",!1))),s=-1,n=[],o={},l={},h=!1;const t=e.rootKeys;for(let e=0,i=t.length;e<i;e++)g(t[e])},resetButtons(t,i){const l=!mt.is(i),r=o[void 0===t?n[s]:t];i=l?r.index:i;const a=e.frameRoots.get(t),h=r.value.length-1;e.applyCommandTargets("undo",(t=>{t.disabled=!(i>0&&i<=h)})),e.applyCommandTargets("redo",(t=>{t.disabled=!(i>-1&&i<h)}));const c=a.get("savedIndex"),d=a.get("historyIndex"),u=c>-1?c!==i:l?r.index>0:i>0&&d!==i;a.set("historyIndex",i),a.set("isChanged",u),e.applyCommandTargets("save",(t=>{t.disabled=!u})),e.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>o,resetDelayTime(t){r=t},destroy(){a&&t.clearTimeout(a),s=n=o=l=null}}}function Jt(t){this.editor=t,this.eventManager=t.eventManager,this.history=t.history,this.events=t.events,this.triggerEvent=t.triggerEvent,this.carrierWrapper=t.carrierWrapper,this.plugins=t.plugins,this.status=t.status,this.context=t.context,this.options=t.options,this.icons=t.icons,this.lang=t.lang,this.frameRoots=t.frameRoots,this._w=t._w,this._d=t._d}const Qt=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),{isMobile:te}=dt;function ee(t){const e=gt.query.getEventTarget(t);let i=e;this.editor.isSubBalloon&&!this.context.get("toolbar.sub.main")?.contains(i)&&this._hideToolbar_sub();const s=gt.check.isInputElement(i);if(s?this.editor._preventBlur=!1:this.editor.frameContext.get("wysiwyg").contains(this.selection.getNode())||this.editor.focus(),gt.query.getParentElement(i,".se-dropdown"))t.stopPropagation(),this.editor._notHideToolbar=!0;else{let n=i.getAttribute("data-command"),o=i.className;for(;i&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)i=i.parentElement,n=i.getAttribute("data-command"),o=i.className;if(s&&/^INPUT$/i.test(i?.getAttribute("data-type"))){if(this.editor._preventBlur=this._inputFocus=!0,this.status.hasFocus||this.applyTagEffect(),!gt.check.isInputElement(e)||e.disabled)return;const t=this.plugins[n];if(!t)return;if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof t.onInputChange&&(this.__inputPlugin={obj:t,target:e,value:e.value}),this.__inputBlurEvent=this.addEvent(e,"blur",(i=>{if(!t.isInputActive)try{const s=e.value.trim();"function"==typeof t.onInputChange&&s!==this.__inputPlugin.value&&t.onInputChange({target:e,value:s,event:i})}finally{this._w.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.onInputKeyDown&&(this.__inputKeyEvent=this.addEvent(e,"keydown",(i=>{t.onInputKeyDown({target:e,event:i})})))}else{if(this.__inputBlurEvent&&this.__inputPlugin){const e=this.__inputPlugin.target.value.trim();return e!==this.__inputPlugin.value&&this.__inputPlugin.obj.onInputChange({target:this.__inputPlugin.target,value:e,event:t}),void this.__removeInput()}this.editor.frameContext.get("isCodeView")||(te?this.editor._preventBlur=!0:(t.preventDefault(),dt.isGecko&&n&&this._injectActiveEvent(i)))}n!==this.menu.currentDropdownName&&n!==this.menu.currentContainerName||t.stopPropagation()}}function ie(t){const e=gt.query.getEventTarget(t),i=gt.query.getCommandTarget(e);if(!i)return;let s=i,n="";for(;s&&!/se-menu-tray/.test(s.className)&&!n;)s=s.parentElement,n=s.getAttribute("data-key");if(!n)return;const o=this.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(i))}function se(t){const e=gt.query.getEventTarget(t);this.editor.runFromTarget(e)}const{_w:ne}=dt;let oe=null;function le(){this.editor.status._onMousedown=!1,oe=this.removeGlobalEvent(oe)}async function re(t,e){const i=gt.query.getEventTarget(e);this.editor.status._onMousedown=!0,oe&&le.call(this),oe=this.addGlobalEvent("mouseup",le.bind(this)),t.get("isReadOnly")||gt.check.isNonEditable(t.get("wysiwyg"))||(this.format._isExcludeSelectionElement(i)?e.preventDefault():(this._setSelectionSync(),this._w.setTimeout(this.selection._init.bind(this.selection),0),!1!==await this.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onMouseDown",{frameContext:t,event:e})&&(this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(i.nodeName)&&e.preventDefault())))}async function ae(t,e){!1!==await this.triggerEvent("onMouseUp",{frameContext:t,event:e})&&this._callPluginEvent("onMouseUp",{frameContext:t,event:e})}async function he(t,e){const i=gt.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),gt.check.isAnchor(i)&&ne.open(i.href,i.target),!1;if(gt.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===this._callPluginEvent("onClick",{frameContext:t,event:e}))return;const s=this.component.get(i);if(s)return e.preventDefault(),void this.component.select(s.target,s.pluginName);if(this.selection._init(),3===e.detail){let t=this.selection.getRange();this.format.isLine(t.endContainer)&&0===t.endOffset&&(t=this.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length),this.selection._rangeInfo(t,this.selection.get()))}const n=this.selection.getNode(),o=this.format.getLine(n,null),l=this.format.getBlock(n,null);if(!o&&!gt.check.isNonEditable(i)&&!gt.check.isList(l)){const t=this.selection.getRange();if(this.format.getLine(t.startContainer)===this.format.getLine(t.endContainer))if(gt.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,i=gt.utils.createElement("LI",null,n);l.insertBefore(i,t),this.editor.focus()}else gt.check.isWysiwygFrame(n)||this.component.is(n)||gt.check.isTableElements(n)&&!gt.check.isTableCell(n)||null===this._setDefaultLine(this.format.isBlock(l)?"DIV":this.options.get("defaultLine"))||(e.preventDefault(),this.editor.focus())}if(this.editor._onCopyFormatInfo)try{const t=[...this.editor._onCopyFormatInfo],e=t.pop();if(this.format.removeInlineElement(),e){const i=this.format.applyInlineElement(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:s,inner:n}=this.nodeTransform.createNestedNode(t);i.parentNode.insertBefore(s,i),n.appendChild(i),this.selection.setRange(i,gt.check.isZeroWidth(i)?1:0,i,1)}if(this.options.get("copyFormatKeepOn"))return;this.editor._onCopyFormatInitMethod()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.editor._onCopyFormatInitMethod?.()||(this.editor._onCopyFormatInfo=null,this.editor._onCopyFormatInitMethod=null)}(this.editor.isBalloon||this.editor.isSubBalloon)&&this._w.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function ce(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const i=gt.query.getEventTarget(e);!1!==Qt.get("__overInfo")&&this._overComponentSelect(i),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function de(t,e){!1!==await this.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&this._callPluginEvent("onMouseLeave",{frameContext:t,event:e})}const{_w:ue,isOSX_IOS:pe}=dt,ge=new RegExp(ut.zeroWidthSpace+"+",""),me={ctrl:!1,alt:!1};let fe=null;function _e(t){const e=t.lastChild,i=t.nextElementSibling;if(!i)return e;if(gt.check.isZeroWidth(i))return gt.utils.removeItem(i),e;const s=i.childNodes;for(;s[0];)t.appendChild(s[0]);return gt.utils.removeItem(i),e}function be(t){const e=t.childNodes,i=t.previousElementSibling;let s=e[0],n=0;if(!i)return{focusNode:s,focusOffset:n};if(gt.check.isZeroWidth(i))return gt.utils.removeItem(i),{focusNode:s,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)i.appendChild(e[0]);else s=i.lastChild,n=s.textContent.length;return gt.utils.removeItem(t),{focusNode:s,focusOffset:n}}async function ye(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const i=this.selection.getRange(),s=this.selection.getNode();if(!this.format.getLine(s,null)&&i.collapsed&&!this.component.is(s)&&!gt.check.isList(s)){const t=this.format.getBlock(s,null);this._setDefaultLine(this.format.isBlock(t)?"DIV":this.options.get("defaultLine"))}this.selection._init();const n=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this.char.test(n,!0))return e.preventDefault(),e.stopPropagation(),!1;!1!==await this.triggerEvent("onInput",{frameContext:t,event:e,data:n})&&!1!==this._callPluginEvent("onInput",{frameContext:t,event:e,data:n})&&this.history.push(!0)}async function ve(t,e){if(this.editor.selectMenuOn||!e.isTrusted)return;let i=this.selection.getNode();if(gt.check.isInputElement(i))return;if(this.menu.currentDropdownName)return;const s=e.code,n=ft.isShift(e),o=me.ctrl=ft.isCtrl(e),l=me.alt=ft.isAlt(e);if(this.isComposing=ft.isComposing(e),!o&&t.get("isReadOnly")&&!ft.isDirectionKey(s))return e.preventDefault(),!1;if(this.menu.dropdownOff(),this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),!1===await this.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;ft.isEnter(s)&&this.format.isLine(this.selection.getRange()?.startContainer)&&(this.selection._resetRangeToTextNode(),i=this.selection.getNode());const r=this.selection.getRange(),a=!r.collapsed||r.startContainer!==r.endContainer;let h=this.format.getLine(i,null)||i,c=this.format.getBlock(h,null);if(o&&!ft.isNonTextKey(s)&&this.shortcuts.command(e,o,n,s,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!ft.isNonTextKey(s)&&this.format.isLine(h)&&r.collapsed&>.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.shortcuts.command(e,!1,n,s,t,!0,h,r))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);if(!1===this._callPluginEvent("onKeyDown",{frameContext:t,event:e,range:r,line:h}))return;switch(s){case"Backspace":{if(this.component.deselect(),fe=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(!this.format.isLine(h)&&!t.get("wysiwyg").firstElementChild&&!this.component.is(i)&&null!==this._setDefaultLine(this.options.get("defaultLine")))return e.preventDefault(),e.stopPropagation(),!1;if(this.format.isLine(h)&&(!r.collapsed||gt.check.isEdgePoint(r.endContainer,r.endOffset,"front"))&&!r.endContainer.previousSibling&&this.format.isLine(h.previousElementSibling)){let t;if(e.preventDefault(),e.stopPropagation(),!r.collapsed){const e=this.html.remove();if(e.commonCon!==e.container&&h.parentElement)if(h.contains(r.startContainer))t=_e(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length);else{const t=be(h);this.selection.setRange(t.focusNode,t.focusOffset,t.focusNode,t.focusOffset)}return void this.history.push(!0)}const i=be(h);return this.selection.setRange(i.focusNode,i.focusOffset,i.focusNode,i.focusOffset),void this.history.push(!0)}if(!a&&!h.previousElementSibling&&0===r.startOffset&&!i.previousSibling&&!gt.check.isListCell(h)&&this.format.isLine(h)&&(!this.format.isBrLine(h)||this.format.isClosureBrLine(h))){if(this.format.isClosureBlock(h.parentNode))return e.preventDefault(),e.stopPropagation(),!1;if(gt.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||gt.check.isZeroWidth(h.textContent))){if(e.preventDefault(),e.stopPropagation(),h.nodeName.toUpperCase()===this.options.get("defaultLine").toUpperCase()){h.innerHTML="<br>";const t=h.attributes;for(;t[0];)h.removeAttribute(t[0].name)}else h.parentNode.replaceChild(gt.utils.createElement(this.options.get("defaultLine"),null,"<br>"),h);return this.editor._nativeFocus(),!1}}const s=r.startContainer;if(h&&!h.previousElementSibling&&0===r.startOffset&&3===s.nodeType&>.check.isZeroWidth(s)){let t=s.parentNode.previousSibling;const e=s.parentNode.nextSibling;t||(e?t=e:(t=gt.utils.createElement("BR"),h.appendChild(t)));let i=s;for(;h.contains(i)&&!i.previousSibling;)i=i.parentNode;if(!h.contains(i)){s.textContent="",this.nodeTransform.removeAllParents(s,null,h);break}}if(!a&&h&&(0===r.startOffset||i===h)){const t=i===h?this._isUneditableNode(r,!0):gt.check.isEdgePoint(r.startContainer,r.startOffset)?gt.query.getPreviousDeepestNode(r.startContainer):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!0)){e.preventDefault(),e.stopPropagation();break}!a&&this.format.isEdgeLine(r.startContainer,r.startOffset,"front")&&this.format.isLine(h.previousElementSibling)&&(this._formatAttrsTemp=h.previousElementSibling.attributes);const n=r.commonAncestorContainer;if(h=this.format.getLine(r.startContainer,null),c=this.format.getBlock(h,null),c&&h&&!gt.check.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){if(gt.check.isListCell(h)&>.check.isList(c)&&(gt.check.isListCell(c.parentElement)||h.previousElementSibling)&&(i===h||3===i.nodeType&&(!i.previousSibling||gt.check.isList(i.previousSibling)))&&(this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null)?c.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)e.preventDefault(),this.html.remove(),3===r.startContainer.nodeType&&this.selection.setRange(r.startContainer,r.startContainer.textContent.length,r.startContainer,r.startContainer.textContent.length),this.history.push(!0);else{let t=h.previousElementSibling||c.parentElement;if(gt.check.isListCell(t)){e.preventDefault();let i=t;if(!t.contains(h)&>.check.isListCell(i)&>.check.isList(i.lastElementChild)){for(i=i.lastElementChild.lastElementChild;gt.check.isListCell(i)&>.check.isList(i.lastElementChild);)i=i.lastElementChild&&i.lastElementChild.lastElementChild;t=i}let s=t===c.parentNode?c.previousSibling:t.lastChild;s||(s=gt.utils.createTextNode(ut.zeroWidthSpace),c.parentNode.insertBefore(s,c.parentNode.firstChild));const n=3===s.nodeType?s.textContent.length:1,o=h.childNodes;let l=s,r=o[0];for(;r=o[0];)t.insertBefore(r,l.nextSibling),l=r;gt.utils.removeItem(h),0===c.children.length&>.utils.removeItem(c),this.selection.setRange(s,n,s,n),this.history.push(!0)}}break}if(!a&&0===r.startOffset){let t=!0,i=n;for(;i&&i!==c&&!gt.check.isWysiwygFrame(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!gt.check.isZeroWidth(i.previousSibling.textContent.trim()))){t=!1;break}i=i.parentNode}if(t&&c.parentNode){e.preventDefault(),this.format.removeBlock(c,{selectedFormats:gt.check.isListCell(h)?[h]:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}),this.history.push(!0);break}}}if(!a&&h&&(0===r.startOffset||i===h&&h.childNodes[r.startOffset])){const t=i===h?h.childNodes[r.startOffset]:i,s=h.previousSibling,o=(3===n.nodeType||gt.check.isBreak(n))&&!n.previousSibling&&0===r.startOffset;if(t&&!t.previousSibling&&(n&&this.component.is(n.previousSibling)||o&&this.component.is(s))){const t=this.component.get(s);t?(e.preventDefault(),e.stopPropagation(),0===h.textContent.length&>.utils.removeItem(h),!1===this.component.select(t.target,t.pluginName)&&this.editor.blur()):this.component.is(s)&&(e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(s));break}if(t&>.check.isNonEditable(t.previousSibling)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t.previousSibling);break}}break}case"Delete":if(this.component.deselect(),fe=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(!a&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end")&&!h.nextSibling)return e.preventDefault(),void e.stopPropagation();if(this.format.isLine(h)&&(!r.collapsed||gt.check.isEdgePoint(r.startContainer,r.endOffset,"end"))&&!r.startContainer.nextSibling&&this.format.isLine(h.nextElementSibling)){let t;if(e.preventDefault(),e.stopPropagation(),!r.collapsed){const e=this.html.remove();if(e.commonCon!==e.container&&h.parentElement)if(h.contains(r.startContainer))t=_e(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length);else{const t=be(h);this.selection.setRange(t.focusNode,t.focusOffset,t.focusNode,t.focusOffset)}return void this.history.push(!0)}return _e(h),void this.history.push(!0)}if(!a&&h&&(r.endOffset===r.endContainer.textContent.length||i===h)){const t=i===h?this._isUneditableNode(r,!1):gt.check.isEdgePoint(r.endContainer,r.endOffset)?gt.query.getNextDeepestNode(r.endContainer,null):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),gt.check.isZeroWidth(h.textContent)&>.utils.removeItem(h),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!1)){e.preventDefault(),e.stopPropagation();break}if((this.format.isLine(i)||null===i.nextSibling||gt.check.isZeroWidth(i.nextSibling)&&null===i.nextSibling.nextSibling)&&r.startOffset===i.textContent.length){const t=h.nextElementSibling;if(!t)break;if(this.component.is(t)){if(e.preventDefault(),gt.check.isZeroWidth(h)&&(gt.utils.removeItem(h),gt.check.isTable(t))){let e=gt.query.getEdgeChild(t,gt.check.isTableCell,!1);e=e.firstElementChild||e,this.selection.setRange(e,0,e,0);break}const i=this.component.get(t);i?(e.stopPropagation(),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur()):this.component.is(t)&&(e.stopPropagation(),gt.utils.removeItem(t));break}}if(!a&&(gt.check.isEdgePoint(r.endContainer,r.endOffset)||i===h&&h.childNodes[r.startOffset])){const t=i===h&&h.childNodes[r.startOffset]||i;if(t&>.check.isNonEditable(t.nextSibling)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t.nextSibling);break}if(this.component.is(t)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t);break}}if(!a&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end")&&this.format.isLine(h.nextElementSibling)&&(this._formatAttrsTemp=h.attributes),h=this.format.getLine(r.startContainer,null),c=this.format.getBlock(h,null),gt.check.isListCell(h)&>.check.isList(c)&&(i===h||3===i.nodeType&&(!i.nextSibling||gt.check.isList(i.nextSibling))&&(this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null)?c.contains(r.endContainer):r.endOffset===i.textContent.length&&r.collapsed))){r.startContainer!==r.endContainer&&this.html.remove();const t=gt.utils.arrayFind(h.children,gt.check.isList)||h.nextElementSibling||c.parentElement.nextElementSibling;if(t&&(gt.check.isList(t)||gt.utils.arrayFind(t.children,gt.check.isList))){let i,s;if(e.preventDefault(),gt.check.isList(t)){const e=t.firstElementChild;for(s=e.childNodes,i=s[0];s[0];)h.insertBefore(s[0],t);gt.utils.removeItem(e)}else{for(i=t.firstChild,s=t.childNodes;s[0];)h.appendChild(s[0]);gt.utils.removeItem(t)}this.selection.setRange(i,0,i,0),this.history.push(!0)}break}break;case"Tab":{if(this.options.get("tabDisable"))break;if(e.preventDefault(),o||l||gt.check.isWysiwygFrame(i))break;const t=!r.collapsed||gt.check.isEdgePoint(r.startContainer,r.startOffset),s=this.format.getLines(null);i=this.selection.getNode();const a=[],c=[],d=gt.check.isListCell(s[0]),u=gt.check.isListCell(s[s.length-1]);let p={sc:r.startContainer,so:r.startOffset,ec:r.endContainer,eo:r.endOffset};for(let t,e=0,i=s.length;e<i;e++)if(t=s[e],gt.check.isListCell(t)){if(!t.previousElementSibling&&!n)continue;a.push(t)}else c.push(t);if(a.length>0&&t&&(p=this.format._applyNestedList(a,n)),c.length>0)if(n){const t=c.length-1;for(let e,i=0;i<=t;i++){e=c[i].childNodes;for(let t,i=0,s=e.length;i<s&&(t=e[i],t);i++)if(!gt.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?gt.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=gt.query.getEdgeChild(c[0],"text",!1),i=gt.query.getEdgeChild(c[t],"text",!0);!d&&e&&(p.sc=e,p.so=0),!u&&i&&(p.ec=i,p.eo=i.textContent.length)}else if(1===c.length){let t=this.status.tabSize+1;if(this.options.get("syncTabIndent")){const e=gt.query.findTextIndexOnLine(h,r.startContainer,r.startOffset,this.component.is.bind(this.component)),i=this.format.isLine(h.previousElementSibling)?gt.query.findTabEndIndex(h.previousElementSibling,e,2):0;i>e&&(t=i-e)}const e=gt.utils.createTextNode(new Array(t).join(" "));if(!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;d||(p.sc=e,p.so=e.length),u||(p.ec=e,p.eo=e.length)}else{const t=gt.utils.createTextNode(new Array(this.status.tabSize+1).join(" ")),e=c.length-1;for(let i,s=0;s<=e;s++)i=c[s].firstChild,i&&(gt.check.isBreak(i)?c[s].insertBefore(t.cloneNode(!1),i):i.textContent=t.textContent+i.textContent);const i=gt.query.getEdgeChild(c[0],"text",!1),s=gt.query.getEdgeChild(c[e],"text",!0);!d&&i&&(p.sc=i,p.so=0),!u&&s&&(p.ec=s,p.eo=s.textContent.length)}this.selection.setRange(p.sc,p.so,p.ec,p.eo),this.history.push(!1);break}case"Enter":{this.component.deselect();const s=this.format.getBrLine(i,null);if("byte-html"===this.editor.frameOptions.get("charCounter_type")){let t="";if(t=!n&&s||n?"<br>":"<"+h.nodeName+"><br></"+h.nodeName+">",!this.char.check(t))return e.preventDefault(),!1}if(!n){const n=!r.endContainer.nextSibling&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end"),o=!r.startContainer.previousSibling&&this.format.isEdgeLine(r.startContainer,r.startOffset,"front");if(n&&(/^H[1-6]$/i.test(h.nodeName)||/^HR$/i.test(h.nodeName))){this.__enterPrevent(e);const t=this.format.addLine(h,this.options.get("defaultLine")).firstChild;if(gt.check.isBreak(t)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t),this.selection.setRange(e,1,e,1)}else this.selection.setRange(t,0,t,0);this.__enterScrollTo(r);break}if(c&&h&&!gt.check.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){const t=this.selection.getRange();if(gt.check.isEdgePoint(t.endContainer,t.endOffset)&>.check.isList(i.nextSibling)){this.__enterPrevent(e);const t=gt.utils.createElement("BR"),s=gt.utils.createElement("LI",null,t);h.parentNode.insertBefore(s,h.nextElementSibling),s.appendChild(i.nextSibling),this.selection.setRange(t,1,t,1),this.__enterScrollTo(r);break}if((3!==t.commonAncestorContainer.nodeType||!t.commonAncestorContainer.nextElementSibling)&>.check.isZeroWidth(h.innerText.trim())&&!gt.check.isListCell(h.nextElementSibling)){this.__enterPrevent(e);let t=null;if(gt.check.isListCell(c.parentElement)){const e=h.parentNode.parentElement;c=e.parentElement;const i=gt.utils.createElement("LI");i.innerHTML="<br>",gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),t=i,c.insertBefore(t,e.nextElementSibling)}else{let e;e=gt.check.isTableCell(c.parentElement)?"DIV":gt.check.isList(c.parentElement)?"LI":this.format.isLine(c.nextElementSibling)?c.nextElementSibling.nodeName:this.format.isLine(c.previousElementSibling)?c.previousElementSibling.nodeName:this.options.get("defaultLine"),t=gt.utils.createElement(e);const i=this.format.removeBlock(c,{selectedFormats:[h],newBlockElement:null,shouldDelete:!0,skipHistory:!0});i.cc.insertBefore(t,i.ec)}t.innerHTML="<br>",this.nodeTransform.removeAllParents(h,null,null),this.selection.setRange(t,1,t,1);break}}if(s){this.__enterPrevent(e);const t=i===s,n=this.selection.get(),o=i.childNodes,l=n.focusOffset,a=i.previousElementSibling,h=i.nextSibling;if(!this.format.isClosureBrLine(s)&&o&&(t&&r.collapsed&&o.length-1<=l+1&>.check.isBreak(o[l])&&(!o[l+1]||(!o[l+2]||gt.check.isZeroWidth(o[l+2].textContent))&&3===o[l+1].nodeType&>.check.isZeroWidth(o[l+1].textContent))&&l>0&>.check.isBreak(o[l-1])||!t&>.check.isZeroWidth(i.textContent)&>.check.isBreak(a)&&(gt.check.isBreak(a.previousSibling)||!gt.check.isZeroWidth(a.previousSibling?.textContent))&&(!h||!gt.check.isBreak(h)&>.check.isZeroWidth(h.textContent)))){t?gt.utils.removeItem(o[l-1]):gt.utils.removeItem(i);const e=s.nextElementSibling,n=this.format.addLine(s,this.format.isLine(e)?e:null);gt.utils.copyFormatAttributes(n,s),this.selection.setRange(n,1,n,1),this.__enterScrollTo(r);break}if(t){this.html.insert(r.collapsed&>.check.isBreak(r.startContainer.childNodes[r.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let t=n.focusNode;const e=n.focusOffset;s===t&&(t=t.childNodes[e-l>1?e-1:e]),this.selection.setRange(t,1,t,1)}else{const t=n.focusNode.nextSibling,e=gt.utils.createElement("BR");this.html.insertNode(e,{afterNode:null,skipCharCount:!0});const i=e.previousSibling,s=e.nextSibling;gt.check.isBreak(t)||gt.check.isBreak(i)||s&&!gt.check.isZeroWidth(s)?this.selection.setRange(s,0,s,0):(e.parentNode.insertBefore(e.cloneNode(!1),e),this.selection.setRange(e,1,e,1))}this._onShortcutKey=!0,this.__enterScrollTo(r);break}if(r.collapsed&&(o||n)){this.__enterPrevent(e);const t=gt.utils.createElement("BR"),s=gt.utils.createElement(h.nodeName,null,t);gt.utils.copyTagAttributes(s,h,this.options.get("lineAttrReset"));let l=t;do{if(!gt.check.isBreak(i)&&1===i.nodeType){const t=i.cloneNode(!1);t.appendChild(l),l=t}i=i.parentElement}while(h!==i&&h.contains(i));if(s.appendChild(l),h.parentNode.insertBefore(s,o&&!n?h:h.nextElementSibling),n)this.selection.setRange(t,1,t,1);else{const t=h.firstChild||h;this.selection.setRange(t,0,t,0)}this.__enterScrollTo(r);break}if(h){let i;e.stopPropagation();let s=0;if(r.collapsed)i=gt.check.isZeroWidth(h)?this.format.addLine(h,h.cloneNode(!1)):this.nodeTransform.split(r.endContainer,r.endOffset,gt.query.getNodeDepth(h));else{const l=this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null),a=h.cloneNode(!1);a.innerHTML="<br>";const c=r.commonAncestorContainer,d=c===r.startContainer&&c===r.endContainer&>.check.isZeroWidth(c)?{container:c,offset:r.endOffset,prevContainer:c.previousElementSibling,commonCon:c}:this.html.remove();if(i=this.format.getLine(d.container,null),!i){gt.check.isWysiwygFrame(d.container)&&(this.__enterPrevent(e),t.get("wysiwyg").appendChild(a),i=a,gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s)),this.__enterScrollTo(r);break}const u=this.format.getBlock(d.container);if(i=i.contains(u)?gt.query.getEdgeChild(u,this.format.getLine.bind(this.format),!1):i,l){if(n&&!o)i.parentNode.insertBefore(a,d.prevContainer&&d.container!==d.prevContainer?i:i.nextElementSibling),i=a,s=0;else if(s=d.offset,o){const t=i.parentNode.insertBefore(a,i);n&&(i=t,s=0)}}else n&&o?(i.parentNode.insertBefore(a,d.prevContainer&&d.container===d.prevContainer?i.nextElementSibling:i),i=a,s=0):n?(i=i.parentNode.insertBefore(a,i.nextElementSibling),i=a,s=0):i=this.nodeTransform.split(d.container,d.offset,gt.query.getNodeDepth(h))}this.__enterPrevent(e),gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s),this.__enterScrollTo(r);break}}if(a){this.__enterScrollTo(r);break}c&>.query.getParentElement(c,"FIGCAPTION")&>.query.getParentElement(c,gt.check.isList)&&(this.__enterPrevent(e),h=this.format.addLine(h,null),this.selection.setRange(h,0,h,0),this.__enterScrollTo(r));break}}if(n&&(pe?l:o)&&ft.isSpace(s)){e.preventDefault(),e.stopPropagation();const t=this.html.insertNode(gt.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});if(t)return void this.selection.setRange(t,t.length,t,t.length)}if(!o&&!l&&!a&&!ft.isNonTextKey(s)&>.check.isBreak(r.commonAncestorContainer)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.selection.setRange(t,1,t,1)}if(t.has("documentType-use-header")&&!r.collapsed&&!o&&!l&&!n&&!ft.isDirectionKey(s))return void ue.setTimeout((()=>{t.get("documentType").reHeader()}),0);let d=null;switch(s){case"ArrowUp":this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling));break;case"ArrowLeft":if(gt.check.isEdgePoint(i,r.startOffset,"front")){const t=i.previousElementSibling||gt.query.getPreviousDeepestNode(i);t?this.component.is(t)&&(d=this.component.get(t)):this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling))}break;case"ArrowDown":this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling));break;case"ArrowRight":if(gt.check.isEdgePoint(i,r.endOffset,"end")){const t=i.nextElementSibling||gt.query.getNextDeepestNode(i);t?this.component.is(t)&&(d=this.component.get(t)):this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling))}}d&&!d.options?.isInputComponent&&(e.preventDefault(),!1===this.component.select(d.target,d.pluginName)&&this.editor.blur())}async function Ce(t,e){if(this._onShortcutKey||this.menu.currentDropdownName)return;const i=e.code,s=ft.isCtrl(e),n=ft.isAlt(e);if(s&&(me.ctrl=!1),n&&(me.alt=!1),t.get("isReadOnly"))return;const o=this.selection.getRange();let l=this.selection.getNode();if((this.editor.isBalloon||this.editor.isSubBalloon)&&((this.editor.isBalloonAlways||this.editor.isSubBalloonAlways)&&!ft.isEsc(i)||!o.collapsed)){if(!this.editor.isBalloonAlways&&!this.editor.isSubBalloonAlways)return void(this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon());ft.isEsc(i)||this._showToolbarBalloonDelay()}if(ft.isBackspace(i)&>.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const s=gt.utils.createElement(this.format.isLine(this.status.currentNodes[0])&&!gt.check.isListCell(this.status.currentNodes[0])?this.status.currentNodes[0]:this.options.get("defaultLine"),null,"<br>");return l.appendChild(s),this.selection.setRange(s,0,s,0),this.applyTagEffect(),this.history.push(!1),void(t.has("documentType-use-header")&&ft.isDocumentTypeObserverKey(i)&&t.get("documentType").reHeader())}const r=this.format.getLine(l,null),a=this.format.getBlock(l,null),h=this._formatAttrsTemp;if(r&&h){for(let t=0,e=h.length;t<e;t++)ft.isEnter(i)&&/^id$/i.test(h[t].name)?r.removeAttribute("id"):r.setAttribute(h[t].name,h[t].value);this._formatAttrsTemp=null}r||!o.collapsed||this.component.is(l)||gt.check.isList(l)||null===this._setDefaultLine(this.format.isBlock(a)?"DIV":this.options.get("defaultLine"))||(l=this.selection.getNode());if(!me.ctrl&&!me.alt&&!ft.isNonTextKey(i)&&3===l.nodeType&&ut.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const i=(l.textContent.substring(0,e).match(ge)||"").length;t=o.startOffset-i,e=o.endOffset-i,l.textContent=l.textContent.replace(ut.zeroWidthRegExp,""),this.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(ft.isRemoveKey(i)&>.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling){const t=this.options.get("retainStyleMode");"none"!==t&&fe?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=ue.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=ue.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,fe)):(this.__retainTimer=null,this._retainStyleNodes(r,fe)):this._clearRetainStyleNodes(r)}if(this.char.test("",!1),t.has("documentType-use-header"))if(ft.isDocumentTypeObserverKey(i)){t.get("documentType").reHeader();const e=gt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}else{const e=gt.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&ft.isHistoryRelevantKey(i)&&this.history.push(!0)}function we(t,e){const i=e.clipboardData;return!i||this._dataTransferAction("paste",e,i,t)}async function xe(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString()}async function ke(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString(),this._w.setTimeout((()=>{this.history.push(!1)}),0)}function Ee(t,e,i,s,n){const{sc:o,so:l,ec:r,eo:a}=this.selection.getDragEventLocationRange(n);if(!o)return;n.preventDefault();const h=t.get("_wd").createRange();h.setStart(o,l),h.setEnd(r,a);const c={y:0,x:0};if(i){const t=this.offset.getGlobal(i),e=s?this.context.get("toolbar.main").offsetHeight:0;c.y=t.top+e-this._w.scrollY,c.x=t.left-this._w.scrollX}const d=h.getBoundingClientRect();if(d.height>0){const i=t.get("wysiwygFrame");let s=0,n=0;/^iframe$/i.test(i.nodeName)&&(s=i.offsetLeft,n=i.offsetTop),e.style.left=`${d.right+this._w.scrollX+c.x+s}px`,e.style.top=`${d.top+this._w.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function Se(t){t.style.display="none"}function Te(t,e,i){try{if(t.get("isReadOnly"))return i.preventDefault(),i.stopPropagation(),!1;const e=i.dataTransfer;if(!e)return!0;const{sc:s,so:n,ec:o,eo:l}=this.selection.getDragEventLocationRange(i);if(!s)return;if(gt.query.getParentElement(s,".se-disable-pointer"))return void i.preventDefault();if(Qt.get("__dragContainer")){if(i.preventDefault(),Qt.get("__dragContainer").contains(i.target))return void this.component.deselect();const e=Qt.get("__dragContainer");return this.component.deselect(),this.selection.setRange(s,n,o,l),this.html.insertNode(e,{afterNode:null,skipCharCount:!0}),void(t.has("documentType-use-page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}return this.html.remove(),this.selection.setRange(s,n,o,l),this._dataTransferAction("drop",i,e,t)}finally{e.style.display="none"}}const{_w:He,ON_OVER_COMPONENT:Le,isMobile:Me}=dt;function Ne(t){Jt.call(this,t),this.isComposing=!1,this._events=[],this._onButtonsCheck=new RegExp(`^(${Object.keys(t.options.get("_defaultStyleTagMap")).join("|")})$`,"i"),this._onShortcutKey=!1,this._balloonDelay=null,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__resize_editor=null,this.__close_move=null,this.__geckoActiveEvent=null,this.__scrollparents=[],this.__cacheStyleNodes=[],this.__selectionSyncEvent=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=this.carrierWrapper.querySelector(".__se__focus__temp__"),this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null}function Ae(t,e,i){this._moveContainer(e),this._scrollContainer(),this._callPluginEvent("onScroll",{frameContext:t,event:i}),t.has("documentType-use-page")&&t.get("documentType").scrollPage(),this.triggerEvent("onScroll",{frameContext:t,event:i})}function Be(t,e){if(this.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.status.hasFocus=!0,this.component.__prevent=!1,this.triggerEvent("onNativeFocus",{frameContext:t,event:e});const i=t.get("key");if(this._inputFocus)return void(this.editor.isInline&&this._w.setTimeout((()=>{this.toolbar._showInline()}),0));if(this.status.rootKey===i&&this.editor._preventBlur||this.editor._preventFocus)return;this.editor._preventFocus=!0;const s=this.editor.status.onSelected||this.editor.opendModal;this.ui._offCurrentController(),gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,!1),this.editor.changeFrameContext(i),this.history.resetButtons(i,null),s||this.applyTagEffect(),this._w.setTimeout((()=>{this.__postFocusEvent(t,e)}),0)}function Ie(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.status.hasFocus=!1,this.editor.effectNode=null,this.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.editor._preventBlur||(this.editor._preventFocus=!1,this._setKeyEffect([]),this.status.currentNodes=[],this.status.currentNodesMap=[],this.editor.applyFrameRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.history.check(t.get("key"),this.status._range),this.__postBlurEvent(t,e)))}function Ve(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.ui.enableBackWrapper("ns-resize"),this.__resize_editor=this.addGlobalEvent("mousemove",Oe.bind(this)),this.__close_move=this.addGlobalEvent("mouseup",Re.bind(this))}function Oe(t){const e=this.editor.frameContext,i=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),s=i<e.get("_minHeight")?e.get("_minHeight"):i;e.get("wysiwygFrame").style.height=e.get("code").style.height=s+"px",this._resizeClientY=t.clientY,dt.isResizeObserverSupported||this.editor.__callResizeFunction(e,s,null)}function Re(){this.ui.disableBackWrapper(),this.__resize_editor&&(this.__resize_editor=this.removeGlobalEvent(this.__resize_editor)),this.__close_move&&(this.__close_move=this.removeGlobalEvent(this.__close_move))}function ze(t,e){e.preventDefault();const i=this._lineBreakComp;if(!i)return;const s=gt.check.isListCell(i.parentElement),n=gt.utils.createElement(s?"BR":gt.check.isTableCell(i.parentElement)?"DIV":this.options.get("defaultLine"));if(s||(n.innerHTML="<br>"),"byte-html"!==this.editor.frameOptions.get("charCounter_type")||this.char.check(n.outerHTML)){i.parentNode.insertBefore(n,"t"===t?i:i.nextSibling),this.component.deselect();try{const t=s?n:n.firstChild;this.selection.setRange(t,1,t,1),this.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}function $e(){Me?this._scrollContainer():this.ui._offCurrentController(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this._resetFrameStatus()}function Fe(){this.options.get("toolbar_sticky")>-1&&this.toolbar._resetSticky(),this.editor.isBalloon&&"block"===this.context.get("toolbar.main").style.display?this.toolbar._setBalloonOffset("top"===this.toolbar._balloonOffset.position):this.editor.isSubBalloon&&"block"===this.context.get("toolbar.sub.main").style.display&&this.subToolbar._setBalloonOffset("top"===this.subToolbar._balloonOffset.position),this._scrollContainer(),this.editor.frameContext.has("documentType-use-page")&&this.editor.frameContext.get("documentType").scrollWindow()}function Pe(){this.options.get("toolbar_sticky")>-1&&(this.toolbar._resetSticky(),this.editor.menu._restoreMenuPosition())}function De(t){if(this.editor._preventSelection)return;let e=t.getSelection().anchorNode;this.editor.applyFrameRoots((t=>{if(e&&t.get("wysiwyg").contains(e)){if(t.get("isReadOnly")||t.get("isDisabled"))return;if(e=null,this.selection._init(),this.applyTagEffect(),t.has("documentType-use-header")){const e=gt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}}}))}function qe(){this._scrollContainer()}function We(t){this.editor.changeFrameContext(t.get("key")),gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,!0)}Ne.prototype={addEvent(t,e,i,s){if(!t)return null;if((!mt.is(t.length)||t.nodeName||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return null;const n=t.length;for(let o=0;o<n;o++)t[o].addEventListener(e,i,s),this._events.push({target:t[o],type:e,listener:i,useCapture:s});return{target:n>1?t:t[0],type:e,listener:i,useCapture:s}},removeEvent(t){if(!t)return;let e=t.target;const i=t.type,s=t.listener,n=t.useCapture;if(e&&((!mt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(i,s,n);return null}},addGlobalEvent(t,e,i){return this.editor.frameOptions.get("iframe")&&this.editor.frameContext.get("_ww").addEventListener(t,e,i),this._w.addEventListener(t,e,i),{type:t,listener:e,useCapture:i}},removeGlobalEvent(t,e,i){if(t)return"object"==typeof t&&(e=t.listener,i=t.useCapture,t=t.type),this.editor.frameOptions.get("iframe")&&this.editor.frameContext.get("_ww").removeEventListener(t,e,i),this._w.removeEventListener(t,e,i),null},applyTagEffect(t){if((t=t||this.selection.getNode())===this.editor.effectNode)return;this.editor.effectNode=t;const e=this.options.get("_rtl")?"marginRight":"marginLeft",i=this.plugins,s=this.editor.commandTargets,n=this._onButtonsCheck,o=this.options.get("_styleCommandMap"),l=[],r=[],a=this.options.get("_textStyleTags"),h=[],c=[],d=this.editor.activeCommands,u=d.length;let p="";if(this.component.is(t)&&!this.component.__selectionSelected){const e=this.component.get(t);if(!e)return;return void this.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.editor.frameContext,m=!g.get("isReadOnly");for(let g=t;!gt.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!gt.check.isBreak(g)){if(this._isNonFocusNode(g))return void this.editor.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.format.isLine(p)&&h.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!c.includes(t)&&s.get(t)&&s.get(t).filter((e=>{const s=i[t]?.active(g,e);return void 0===s&&c.push(t),s})).length>0&&l.push(t);if(this.format.isLine(g)){if(!l.includes("outdent")&&s.has("outdent")&&(gt.check.isListCell(g)||g.style[e]&&mt.get(g.style[e],0)>0)&&s.get("outdent").filter((t=>!gt.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&s.has("indent")){const t=gt.check.isListCell(g)&&!g.previousElementSibling;s.get("indent").filter((e=>!gt.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),gt.utils.addClass(s.get(p),"active"))}return this._setKeyEffect(l),this.__cacheStyleNodes=h.reverse(),this.status.currentNodes=r.reverse(),this.status.currentNodesMap=l,this.editor.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.options.get("_rtl")?this.status.currentNodes.reverse().join(" < "):this.status.currentNodes.join(" > ")),t},_injectActiveEvent(t){gt.utils.addClass(t,"__se__active"),this.__geckoActiveEvent=this.addGlobalEvent("mouseup",(()=>{gt.utils.removeClass(t,"__se__active"),this.__geckoActiveEvent=this.removeGlobalEvent(this.__geckoActiveEvent)}))},_setKeyEffect(t){const e=this.editor.activeCommands,i=this.editor.commandTargets,s=this.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=i.get(n))){l=s[n];for(let t,e=0,i=o.length;e<i;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?gt.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?gt.check.isImportantDisabled(t)||(t.disabled=!1):gt.utils.removeClass(t,"active"))}},_showToolbarBalloonDelay(){this._balloonDelay&&He.clearTimeout(this._balloonDelay),this._balloonDelay=He.setTimeout((()=>{He.clearTimeout(this._balloonDelay),this._balloonDelay=null,this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon()}),250)},_toggleToolbarBalloon(){this.selection._init();const t=this.selection.getRange(),e=this.options.has("_subMode");!(e?this.editor.isSubBalloonAlways:this.editor.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.subToolbar._showBalloon(t):this.toolbar._showBalloon(t)},_hideToolbar(){this.editor._notHideToolbar||this.editor.frameContext.get("isFullScreen")||this.toolbar.hide()},_hideToolbar_sub(){this.subToolbar&&!this.editor._notHideToolbar&&this.subToolbar.hide()},_isNonFocusNode:t=>gt.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus"),_isUneditableNode(t,e){const i=e?t.startContainer:t.endContainer,s=e?t.startOffset:t.endOffset,n=e?"previousSibling":"nextSibling";let o;return 1===i.nodeType?(o=this._isUneditableNode_getSibling(i.childNodes[s],n,i),o&&1===o.nodeType&&"false"===o.getAttribute("contenteditable")?o:null):(o=this._isUneditableNode_getSibling(i,n,i),gt.check.isEdgePoint(i,s,e?"front":"end")&&o&&1===o.nodeType&&"false"===o.getAttribute("contenteditable")?o:null)},_isUneditableNode_getSibling(t,e,i){if(!t)return null;let s=t[e];if(!s){if(s=this.format.getLine(i),s=s?s[e]:null,!s||this.component.is(s))return null;s="previousSibling"===e?s.firstChild:s.lastChild}return s},_hardDelete(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=this.format.getBlock(e),n=this.format.getBlock(i),o=gt.check.isTableCell(s),l=gt.check.isTableCell(n);if((o&&!s.previousElementSibling&&!s.parentElement.previousElementSibling||l&&!n.nextElementSibling&&!n.parentElement.nextElementSibling)&&s!==n){const e=gt.query.getParentElement(t.commonAncestorContainer,gt.check.isFigure)?.parentElement||t.commonAncestorContainer;if(o){if(l)return gt.utils.removeItem(gt.query.getParentElement(s,(t=>e===t.parentNode))),this.editor._nativeFocus(),!0;gt.utils.removeItem(gt.query.getParentElement(s,(t=>e===t.parentNode)))}else gt.utils.removeItem(gt.query.getParentElement(n,(t=>e===t.parentNode)))}const r=1===e.nodeType?gt.query.getParentElement(e,".se-component"):null,a=1===i.nodeType?gt.query.getParentElement(i,".se-component"):null;return r&>.utils.removeItem(r),a&>.utils.removeItem(a),!1},_setDefaultLine(t){if(!this.options.get("__lineFormatFilter"))return null;if(this.editor._fileManager.pluginRegExp.test(this.editor.currentControllerName))return;const e=this.selection.getRange(),i=e.commonAncestorContainer,s=e.startContainer,n=this.format.getBlock(i,null);let o,l,r;if(n)return r=gt.utils.createElement(t||this.options.get("defaultLine")),r.innerHTML=n.innerHTML,0===r.childNodes.length&&(r.innerHTML=ut.zeroWidthSpace),n.innerHTML=r.outerHTML,r=n.firstChild,o=gt.query.getEdgeChildNodes(r,null).sc,o||(o=gt.utils.createTextNode(ut.zeroWidthSpace),r.insertBefore(o,r.firstChild)),l=o.textContent.length,void this.selection.setRange(o,l,o,l);if(3===i.nodeType&&this.component.is(i.parentElement)){const t=this.component.get(i.parentElement);if(!t)return;const e=t.container;if(i.parentElement===e){const t=i.nextElementSibling?e:e.nextElementSibling,s=gt.utils.createElement(this.options.get("defaultLine"),null,i);return e.parentElement.insertBefore(s,t),void this.editor.focusEdge(s)}return this.component.select(t.target,t.pluginName),null}if(1===i.nodeType&&"true"===i.getAttribute("data-se-embed")){let t=i.nextElementSibling;return this.format.isLine(t)||(t=this.format.addLine(i,this.options.get("defaultLine"))),void this.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.format.isBlock(s)&&!gt.check.isWysiwygFrame(s)||!this.component.is(s.children[e.startOffset])&&!this.component.is(s.children[e.startOffset-1])){if(gt.query.getParentElement(i,gt.check.isExcludeFormat))return null;if(this.format.isBlock(i)&&i.childNodes.length<=1){let t=null;return 1===i.childNodes.length&>.check.isBreak(i.firstChild)?t=i.firstChild:(t=gt.utils.createTextNode(ut.zeroWidthSpace),i.appendChild(t)),void this.selection.setRange(t,1,t,1)}try{if(3===i.nodeType&&(r=gt.utils.createElement(t||this.options.get("defaultLine")),i.parentNode.insertBefore(r,i),r.appendChild(i)),gt.check.isBreak(r.nextSibling)&>.utils.removeItem(r.nextSibling),gt.check.isBreak(r.previousSibling)&>.utils.removeItem(r.previousSibling),gt.check.isBreak(o)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}}catch(e){return this.editor.execCommand("formatBlock",!1,t||this.options.get("defaultLine")),this.selection.removeRange(),this.selection._init(),void(this.editor.effectNode=null)}if(r&&(gt.check.isBreak(r.nextSibling)&>.utils.removeItem(r.nextSibling),gt.check.isBreak(r.previousSibling)&>.utils.removeItem(r.previousSibling),gt.check.isBreak(o))){const t=gt.utils.createTextNode(ut.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}this.editor.effectNode=null,s?this.selection.setRange(s,1,s,1):this.editor._nativeFocus()}},async _dataTransferAction(t,e,i,s){try{return this.ui.showLoading(),await this._setClipboardData(t,e,i,s),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.ui.hideLoading()}},async _setClipboardData(t,e,i,s){e.preventDefault(),e.stopPropagation();let n=i.getData("text/plain"),o=i.getData("text/html");const l=!o,r=this.__secopy===n,a=/class=["']*Mso(Normal|List)/i.test(o)||/content=["']*Word.Document/i.test(o)||/content=["']*OneNote.File/i.test(o)||/content=["']*Excel.Sheet/i.test(o),h=r?"SE":a?"MS":"";if(l?o=pt.htmlToEntity(n).replace(/\n/g,"<br>"):(o=o.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),a&&(o=o.replace(/\n/g," "),n=n.replace(/\n/g," "))),!r){if(this.options.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");gt.query.getListChildNodes(t.body,pt.textToAnchor),o=t.body.innerHTML}}l||(o=this.html.clean(o,{forceFormat:!1,whitelist:null,blacklist:null}));const c=this.char.test("byte-html"===this.editor.frameOptions.get("charCounter_type")?o:n,!1);if("paste"===t){const t=await this.triggerEvent("onPaste",{frameContext:s,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}if("drop"===t){const t=await this.triggerEvent("onDrop",{frameContext:s,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}const d=i.files;if(d.length>0&&!a){for(let t=0,i=d.length;t<i;t++)this._callPluginEvent("onFilePasteAndDrop",{frameContext:s,event:e,file:d[t]});return!1}if(!c)return!1;if(o){const t=(new DOMParser).parseFromString(o,"text/html");return!0!==this._callPluginEvent("onPaste",{frameContext:s,event:e,data:o,doc:t})&&this.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),s.has("documentType-use-header")&&s.get("documentType").reHeader(),!1}},_addCommonEvents(){const t=ee.bind(this),e=se.bind(this);this.addEvent(this.context.get("menuTray"),"mousedown",t,!1),this.addEvent(this.context.get("menuTray"),"click",ie.bind(this),!0),this.addEvent(this.context.get("toolbar.main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar.main"),"click",e,!1),this.options.has("_subMode")&&(this.addEvent(this.context.get("toolbar.sub.main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar.sub.main"),"click",e,!1)),this.toolbar._setResponsive(),dt.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{He.setTimeout((()=>{this.toolbar.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{He.setTimeout((()=>{t.forEach((t=>{this.editor.__callResizeFunction(this.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.options.get("closeModalOutsideClick")&&this.addEvent(this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.ui._offCurrentModal()}),!1),this.addEvent(He,"resize",$e.bind(this),!1),this.addEvent(He,"scroll",Fe.bind(this),!1),dt.isMobile&&(this.addEvent(He.visualViewport,"resize",Pe.bind(this),!1),this.addEvent(He.visualViewport,"scroll",Pe.bind(this),!1))},_addFrameEvents(t){const e=t.get("options").get("iframe"),i=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",i);const s=t.get("code"),n=this.editor.carrierWrapper.querySelector(".se-drag-cursor"),o=ce.bind(this,t);this.addEvent(i,"mousemove",o,!1),this.addEvent(i,"mouseleave",de.bind(this,t),!1),this.addEvent(i,"mousedown",re.bind(this,t),!1),this.addEvent(i,"mouseup",ae.bind(this,t),!1),this.addEvent(i,"click",he.bind(this,t),!1),this.addEvent(i,"input",ye.bind(this,t),!1),this.addEvent(i,"keydown",ve.bind(this,t),!1),this.addEvent(i,"keyup",Ce.bind(this,t),!1),this.addEvent(i,"paste",we.bind(this,t),!1),this.addEvent(i,"copy",xe.bind(this,t),!1),this.addEvent(i,"cut",ke.bind(this,t),!1),this.addEvent(i,"dragover",Ee.bind(this,t,n,e?this.editor.frameContext.get("topArea"):null,!this.options.get("toolbar_container")&&!this.editor.isBalloon&&!this.editor.isInline),!1),this.addEvent(i,"dragend",Se.bind(this,n),!1),this.addEvent(i,"drop",Te.bind(this,t,n),!1),this.addEvent(i,"scroll",Ae.bind(this,t,i),{passive:!0,capture:!1}),this.addEvent(i,"focus",Be.bind(this,t),!1),this.addEvent(i,"blur",Ie.bind(this,t),!1),this.addEvent(s,"mousedown",We.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");this.addEvent(l,"wheel",(t=>{t.preventDefault(),this.component.deselect()}),!1);const r=Me?"touchstart":"mousedown";if(this.addEvent(t.get("lineBreaker_t"),r,ze.bind(this,"t"),!1),this.addEvent(t.get("lineBreaker_b"),r,ze.bind(this,"b"),!1),Me&&this.addEvent(i,"touchstart",o,{passive:!0,capture:!1}),!this.options.get("hasCodeMirror")){const e=t.get("codeNumbers"),i=this.viewer._codeViewAutoHeight.bind(this.viewer,t.get("code"),e,"auto"===this.editor.frameOptions.get("height"));this.addEvent(s,"keydown",i,!1),this.addEvent(s,"keyup",i,!1),this.addEvent(s,"paste",i,!1),e&&this.addEvent(s,"scroll",this.viewer._scrollLineNumbers.bind(s,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const a=qe.bind(this);let h=t.get("originElement");for(;h=gt.query.getScrollParent(h.parentElement);)this.__scrollparents.push(h),this.addEvent(h,"scroll",a,!1);this.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.addEvent(this.__eventDoc,"selectionchange",De.bind(this,this.__eventDoc),!1))},__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.addEvent(t.get("statusbar"),"mousedown",Ve.bind(this),!1)):gt.utils.addClass(t.get("statusbar"),"se-resizing-none")},_removeAllEvents(){for(let t,e=0,i=this._events.length;e<i;e++)t=this._events[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this._events=[],this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null)},_moveContainer(t){const e=t.scrollTop||0,i=t.scrollLeft||0;if(this.editor.isBalloon?(this.context.get("toolbar.main").style.top=this.toolbar._balloonOffset.top-e+"px",this.context.get("toolbar.main").style.left=this.toolbar._balloonOffset.left-i+"px"):this.editor.isSubBalloon&&(this.context.get("toolbar.sub.main").style.top=this.subToolbar._balloonOffset.top-e+"px",this.context.get("toolbar.sub.main").style.left=this.subToolbar._balloonOffset.left-i+"px"),this.editor._controllerTargetContext!==this.editor.frameContext.get("topArea")&&this.ui._offCurrentController(),this.editor._lineBreaker_t){const t=this.editor._lineBreaker_t.style;if("none"!==t.display){const s=(this.editor._lineBreaker_t.getAttribute("data-offset")||",").split(",");t.top=mt.get(t.top,0)-(e-mt.get(s[0],0))+"px",t.left=mt.get(t.left,0)-(i-mt.get(s[1],0))+"px",this.editor._lineBreaker_t.setAttribute("data-offset",e+","+i)}}if(this.editor._lineBreaker_b){const t=this.editor._lineBreaker_b.style;if("none"!==t.display){const s=(this.editor._lineBreaker_b.getAttribute("data-offset")||",").split(",");t.top=mt.get(t.top,0)-(e-mt.get(s[0],0))+"px",t[s[1]]=mt.get(t[s[1]],0)-(i-mt.get(s[2],0))+"px",this.editor._lineBreaker_b.setAttribute("data-offset",e+","+s[1]+","+i)}}const s=this.editor.opendControllers;for(let t=0;t<s.length;t++)s[t].notInCarrier&&(s[t].form.style.top=s[t].inst.__offset.top-e+"px",s[t].form.style.left=s[t].inst.__offset.left-i+"px")},_scrollContainer(){const t=this.editor.opendControllers;t.length&&this.__rePositionController(t)},__rePositionController(t){Qt.get("__dragMove")&&Qt.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?.show()},_resetFrameStatus(){dt.isResizeObserverSupported||(this.toolbar.resetResponsiveToolbar(),this.options.get("_subMode")&&this.subToolbar.resetResponsiveToolbar());const t=this.context.get("toolbar.main"),e="none"===t.style.display||this.editor.isInline&&!this.toolbar._inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const i=this.editor.opendBrowser;if(i&&"block"===i.area.style.display&&(i.body.style.maxHeight=gt.utils.getClientSize().h-i.header.offsetHeight-50+"px"),this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._setMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown),this.viewer._resetFullScreenHeight())return;const s=this.editor.frameContext;s.get("isCodeView")&&this.editor.isInline?this.toolbar._showInline():(this.editor._iframeAutoHeight(s),this.toolbar._sticky&&(this.context.get("toolbar.main").style.width=s.get("topArea").offsetWidth-2+"px",this.toolbar._resetSticky()))},_setSelectionSync(){this.removeGlobalEvent(this.__selectionSyncEvent),this.__selectionSyncEvent=this.addGlobalEvent("mouseup",(()=>{this.selection._init(),this.removeGlobalEvent(this.__selectionSyncEvent)}))},_retainStyleNodes(t,e){let i=e[0].cloneNode(!1);for(let t,s=1,n=e.length;s<n;s++)t=e[s].cloneNode(!1),i.appendChild(t),i=t;const{parent:s,inner:n}=this.nodeTransform.createNestedNode(e,null),o=gt.utils.createTextNode(ut.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(s),this.selection.setRange(o,1,o,1)},_clearRetainStyleNodes(t){t.innerHTML="<br>",this.selection.setRange(t,0,t,0)},_callPluginEvent(t,e){const i=this.editor._onPluginEvents.get(t);for(let t,s=0;s<i.length;s++)if(t=i[s](e),"boolean"==typeof t)return t},_overComponentSelect(t){const e=gt.query.getParentElement(t,gt.check.isFigure);let i=this.component.get(t);i||e?(i||(i=this.component.get(e)),i&&!gt.utils.hasClass(i.container,"se-component-selected")&&(this.ui._offCurrentController(),Qt.set("__overInfo",Le),this.component.select(i.target,i.pluginName))):null===Qt.get("__overInfo")||gt.utils.hasClass(t,"se-drag-handle")||(this.component.__deselect(),Qt.set("__overInfo",null))},__removeInput(){this._inputFocus=this.editor._preventBlur=!1,this.__inputBlurEvent=this.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null},__enterPrevent(t){t.preventDefault(),Me&&(this.__focusTemp.focus({preventScroll:!0}),this.editor.frameContext.get("wysiwyg").focus({preventScroll:!0}))},__enterScrollTo(t){dt.isMobile||this.editor.selection.scrollTo(t)},__postFocusEvent(t,e){(this.editor.isInline||this.editor.isBalloonAlways)&&this.toolbar.show(),this.editor.isSubBalloonAlways&&this.subToolbar.show(),this.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})},__postBlurEvent(t,e){(this.editor.isInline||this.editor.isBalloon)&&this._hideToolbar(),this.editor.isSubBalloon&&this._hideToolbar_sub(),this.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})},constructor:Ne};const Ue=Ne,Ge={onload:null,onScroll:null,onMouseDown:null,onClick:null,onInput:null,onMouseLeave:null,onKeyDown:null,onKeyUp:null,onFocus:null,onNativeFocus:null,onBlur:null,onNativeBlur:null,onCopy:null,onCut:null,onChange:null,onShowToolbar:null,onShowController:null,onBeforeShowController:null,onToggleCodeView:null,onToggleFullScreen:null,onResizeEditor:null,onSetToolbarButtons:null,onSave:null,onDrop:null,onPaste:null,imageUploadHandler:null,onImageUploadBefore:null,onImageLoad:null,onImageAction:null,onImageUploadError:null,onImageDeleteBefore:null,videoUploadHandler:null,onVideoUploadBefore:null,onVideoLoad:null,onVideoAction:null,onVideoUploadError:null,onVideoDeleteBefore:null,audioUploadHandler:null,onAudioUploadBefore:null,onAudioUploadError:null,onAudioLoad:null,onAudioAction:null,onAudioDeleteBefore:null,onFileUploadBefore:null,onFileLoad:null,onFileAction:null,onFileUploadError:null,onFileDeleteBefore:null,onExportPDFBefore:null,onFileManagerAction:null,onEmbedInputBefore:null,onEmbedDeleteBefore:null},{_w:Ze}=dt,Ye=Math.floor(96/72*841.89105);function Xe(t,e){this.editor=t,this.context=t.context,this.selection=t.selection,this.offset=t.offset,this.fc=e,this.ww=e.get("wysiwyg"),this.wwFrame=e.get("wysiwygFrame"),this.wwWidth=-1,this.wwHeight=-1,this.isAutoHeight="auto"===e.get("options").get("height"),this.displayPage=this.isAutoHeight?Ze:e.get("wysiwyg"),this.innerHeaders=[],this._wwHeaders=[],this.documentTypeInner=e.get("documentTypeInner"),this.inner=null,this.page=null,this.totalPages=0,this.pageNum=0,this.pageHeight=-1,this.pageBreaksCnt=0,this.pages=[],this.pages_line=[],this.prevScrollTop=0,this.useHeader=t.options.get("_type_options").includes("header"),this.usePage=t.options.get("_type_options").includes("page"),this.navigatorButtons=[],this.pageNavigator=null,this._mirror=e.get("documentTypePageMirror"),this._mirrorCache=0,this._positionCache=new Map,this._rePageTimeout=null;const i=Ze.getComputedStyle(this._mirror);if(this._paddingTop=mt.get(i.paddingTop),this._paddingBottom=mt.get(i.paddingBottom),this.useHeader){const t=this._getHeaders(),e=this.inner=this.documentTypeInner.querySelector(".se-document-lines-inner");let i="";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i+=`<div class="se-doc-item se-doc-h${mt.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.innerHeaders=e.querySelectorAll("div"),this.editor.eventManager.addEvent(e,"click",je.bind(this,this.ww))}this.usePage&&(this.page=e.get("documentTypePage"),this.pageNavigator=t.plugins.pageNavigator)}function je(t,e){e.preventDefault();try{this.editor._preventBlur=!0;const t=gt.query.getEventTarget(e);if(gt.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.innerHeaders,t);if(-1===e)return;const i=this._wwHeaders[e];i&&this.selection.scrollTo(i)}}finally{this.editor._preventBlur=!1}}Xe.prototype={reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.inner,i=this.innerHeaders;for(let s,n,o,l=0,r=t.length;l<r;l++)if(s=t[l],n=`se-doc-h${mt.get(s.nodeName)}`,o=i[l],l<i.length)o.classList.contains(n)&&o.textContent===s.textContent||(o.textContent=o.title=s.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=s.textContent,e.appendChild(t)}if(i.length>t.length)for(let s=t.length;s<i.length;s++)e.removeChild(i[s]);this.innerHeaders=e.querySelectorAll("div")},async rePage(t){this.page&&(this._rePageTimeout&&Ze.clearTimeout(this._rePageTimeout),this._rePageTimeout=Ze.setTimeout((async()=>{await gt.utils.waitForMediaLoad(this._mirror,1500);const e=this._mirror.scrollHeight,i=this._mirror.querySelectorAll(".se-page-break");if(!t&&this.pageHeight===e&&this.pageBreaksCnt===i.length)return;this.pageHeight=e,this.pageBreaksCnt=i.length;let s=0,n=0,o=0;if(i.length>0){s=i[0].offsetHeight;for(let t=0;t<i.length;t++){const e=i[t].offsetTop;(e-n)%Ye!=0&&o++,n=e}const t=e-n;t>0&&t%Ye!=0&&o++}const l=this.isAutoHeight?0:this._getWWScrollTop(),r=Math.ceil(e/Ye)+o,a=this.wwFrame.offsetWidth+1,h=[];for(let t=0;t<i.length;t++)h.push({number:t,top:i[t].offsetTop+s-l});this._mirrorCache=0;const c=this.ww.children,d=this._mirror.children;this._initializeCache(d),h.push({number:0,top:0});for(let t=1,e=0;t<r;t++)if(e+=Ye+(1===t?this._paddingTop+this._paddingBottom:this._paddingTop),!h.some((t=>Math.abs(t.top-e)<1))){const{ci:i,cm:s,ch:n}=this._getElementAtPosition(e,d),o=c[i];if(!o)break;c[this._mirrorCache]&&(e+=mt.get(Ze.getComputedStyle(c[this._mirrorCache]).marginBottom));const l=o.offsetTop+o.offsetHeight+s+(o.offsetHeight-n);h.push({number:t,top:l})}if(0===h.length)return this.pages_line=[],this.totalPages=1,void this._displayCurrentPage();h.sort(((t,e)=>t.top-e.top)),this.page.innerHTML="",this.pages=[];for(let t,i=0;i<r;i++){if(!h[i])continue;if(t=h[i].top,e<t)break;const s=gt.utils.createElement("DIV",{style:`top:${t-l}px`,innerHTML:String(i+1)},`<div class="se-document-page-line" style="width: ${a}px;"></div>${i+1}`);this.page.appendChild(s),this.pages.push(s)}this.pages_line=this.page.querySelectorAll(".se-document-page-line"),this.totalPages=this.pages.length,this._displayCurrentPage()}),400))},_initializeCache(t){this._positionCache.clear();for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.offsetTop,n=i.offsetHeight,o=s+n;this._positionCache.set(e,{top:s,height:n,bottom:o})}},_getElementAtPosition(t,e){let i=this._mirrorCache,s=e.length-1;for(;i<=s;){const e=Math.floor((i+s)/2),{top:n,height:o,bottom:l}=this._positionCache.get(e);if(t>=n&&t<=l)return this._mirrorCache=e,{ci:e,cm:t-l,ch:o};t<n?s=e-1:i=e+1}const n=e[i]?i:s;this._mirrorCache=n;const o=this._positionCache.get(n);return{ci:n,cm:t-o.bottom,ch:o.height}},resizePage(){const t=this.wwFrame.offsetWidth+1,e=this.wwFrame.offsetHeight+1;let i=!1;if(t===this.wwWidth&&(i=e===this.wwHeight))return;t>800?gt.utils.removeClass(this.documentTypeInner,"se-document-responsible"):gt.utils.addClass(this.documentTypeInner,"se-document-responsible"),this.wwWidth=t,this.wwHeight=e;const s=this.pages_line;for(let e=0,i=s.length;e<i;e++)s[e].style.width=`${t}px`;i||this.rePage(!0),this._displayCurrentPage()},scrollPage(){const t=this.prevScrollTop,e=this._getWWScrollTop();if(t===e)return;const i=this.pages;for(let s=0,n=i.length;s<n;s++)i[s].style.top=mt.get(i[s].style.top)-(e-t)+"px";this.prevScrollTop=e,this._displayCurrentPage()},scrollWindow(){this.isAutoHeight&&this._displayCurrentPage()},getCurrentPageNumber(){if(this.totalPages<=1)return 1;let t=0;if(this.isAutoHeight){const e=this._getGlobalTop();if(t=Ze.scrollY-e+Ye/2,t<=0)return 1}else t=this.wwHeight/2;const e=this.pages;for(let i=0,s=e.length;i<s;i++)if(e[i].offsetTop>=t)return this.pageNum=i;return this.pageNum=this.totalPages},pageUp(){const t=this.pageNum-1<=1?1:this.pageNum-1;this._movePage(t,!1)},pageDown(){const t=this.pageNum+1>this.pages.length?this.pages.length:this.pageNum+1;this._movePage(t,!1)},pageGo(t){t<1?t=1:t>this.pages.length&&(t=this.pages.length),this._movePage(t,!0)},on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(gt.utils.removeClass(this.innerHeaders,"active"),gt.utils.addClass(e,"active"))},onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)},_displayCurrentPage(){const t=this.getCurrentPageNumber();this.pageNavigator?.display(t,this.totalPages)},_getWWScrollTop(){return this.displayPage.scrollTop||this.displayPage.scrollY||0},_movePage(t,e){const i=this._getGlobalTop(),s=pt.nodeListToArray(this.ww.children),n=this.page.offsetTop+mt.get(this.pages[t-1].style.top)+(this.isAutoHeight?0:this._getWWScrollTop());for(let o,l=0,r=s.length;l<r;l++)if(o=s[l],o.offsetTop>=n){e||this.selection.setRange(o,0,o,0);const s=0!==l||this.isAutoHeight?o.offsetTop-this.page.offsetTop-o.offsetHeight+i:0;this._applyPageScroll(s,(()=>{this.editor.toolbar._sticky&&this.displayPage.scrollTo({top:s-this.context.get("toolbar.main").offsetHeight,behavior:"smooth"})})),this.pageNum=t;break}},_applyPageScroll(t,e){this.displayPage.scrollTo({top:t,behavior:"smooth"});const i=()=>{Math.abs((this.displayPage.scrollY??this.displayPage.scrollTop)-t)<1?e():Ze.requestAnimationFrame(i)};Ze.requestAnimationFrame(i)},_getGlobalTop(){return this.isAutoHeight?this.offset.getGlobal(this.wwFrame).top:0},_findItem(t){const e=this._wwHeaders,i=Array.prototype.indexOf.call(e,t);return-1!==i&&this.innerHeaders[i]?this.innerHeaders[i]:null},_findLinesHeader(t){for(;t&&t!==this.ww;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null},_is:t=>/^h[1-6]$/i.test(t?.nodeName),_getHeaders(){return this._wwHeaders=this.ww.querySelectorAll("h1, h2, h3, h4, h5, h6")},constructor:Xe};const Ke=Xe;const Je=function(t){this.toolbar=t.toolbar,this.subToolbar=null,t.subToolbar&&(this.subToolbar=t.subToolbar),this.char=t.char,this.component=t.component,this.format=t.format,this.html=t.html,this.menu=t.menu,this.nodeTransform=t.nodeTransform,this.offset=t.offset,this.selection=t.selection,this.shortcuts=t.shortcuts,this.ui=t.ui,this.viewer=t.viewer};function Qe(t){Jt.call(this,t)}function ti(e){e&&!D(e,"se-blink")&&(q(e,"se-blink"),t.setTimeout((()=>{W(e,"se-blink")}),600))}Qe.prototype={check(t){const e=this.editor.frameOptions.get("charCounter_max");if(e){const i=this.getLength("string"==typeof t?t:"byte-html"===this.editor.frameOptions.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(i>0&&i+this.getLength()>e)return ti(this.editor.frameContext.get("charWrapper")),!1}return!0},getLength(t){return"string"!=typeof t&&(t="byte-html"===this.editor.frameOptions.get("charCounter_type")?this.editor.frameContext.get("wysiwyg").innerHTML:this.editor.frameContext.get("wysiwyg").textContent),/byte/.test(this.editor.frameOptions.get("charCounter_type"))?this.getByteLength(t):t.length},getByteLength(t){if(!t||!t.toString)return 0;let e,i;return t=t.toString(),a?(i=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e):(i=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e)},display(e){const i=(e||this.editor.frameContext).get("charCounter");i&&t.setTimeout((()=>{i.textContent=this.getLength()}),0)},test(t,e){let i=0;t&&(i=this.getLength(t)),this.display();const s=this.editor.frameOptions.get("charCounter_max");if(s>0){let t=!1;const n=this.getLength();if(n>s){if(t=!0,i>0&&e){this.selection._init();const t=this.selection.getRange(),e=t.endOffset-1,i=this.selection.getNode().textContent,s=t.endOffset-1;this.selection.getNode().textContent=i.slice(0,s<0?0:s)+i.slice(t.endOffset,i.length),this.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+i>s&&(t=!0);if(t&&(ti(this.editor.frameContext.get("charWrapper")),i>0))return!1}return!0},constructor:Qe};const ei=Qe;const ii=function(t){this.editor,this.eventManager,this.history,this.events,this.triggerEvent,this.carrierWrapper,this.plugins,this.status,this.context,this.options,this.icons,this.lang,this.frameRoots,this._w,this._d,this.toolbar,this.subToolbar,this.char,this.component,this.format,this.html,this.menu,this.nodeTransform,this.offset,this.selection,this.shortcuts,this.ui,this.viewer,Jt.call(this,t),Je.call(this,t)},{_w:si,ON_OVER_COMPONENT:ni}=dt,oi="2147483646",li="2147483645",ri="2147483641",ai="2147483640";const hi=class extends ii{constructor(t,e,i,s){super(t.editor),this.kind=s||t.constructor.key||t.constructor.name,this.inst=t,this.form=e,this.isOpen=!1,this.currentTarget=null,this.currentPositionTarget=null,this.isWWTarget=i.isWWTarget??!0,this.position=i.position||"bottom",this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsHide=!!i.parentsHide,this.sibling=i.sibling||null,this.siblingPosition=["top","side"].includes(i.siblingPosition)?i.siblingPosition:"top",this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this.toTop=!1,this._reserveIndex=!1,this._initMethod="function"==typeof i.initMethod?i.initMethod:null,this.__globalEventHandlers={keydown:this.#t.bind(this),mousedown:this.#e.bind(this)},this._bindClose_key=null,this._bindClose_mouse=null,this.__offset={},this.__addOffset={left:0,top:0},this.__shadowRootEventForm=null,this.__shadowRootEventListener=null,this.carrierWrapper.appendChild(e),this.eventManager.addEvent(e,"click",this.#i.bind(this)),this.eventManager.addEvent(e,"mouseenter",this.#s.bind(this)),this.eventManager.addEvent(e,"mouseleave",this.#n.bind(this))}open(t,e,{isWWTarget:i,initMethod:s,disabled:n,addOffset:o}={}){if(Qt.get("__overInfo")===ni)return;if(!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this.status.hasFocus||(n??this.disabled?this.ui.setControllerOnDisabledButtons(!0):this.ui.setControllerOnDisabledButtons(!1)),this.currentPositionTarget=e||t,this.isWWTarget=i??this.isWWTarget,"function"==typeof s&&(this._initMethod=s),this.editor.currentControllerName=this.kind,this.__addOffset={left:0,top:0},o&&(this.__addOffset={...this.__addOffset,...o});const l=this.isOutsideForm?this.parents:[];this.editor.opendControllers?.forEach((t=>{l.includes(t.form)||(t.form.style.zIndex=ai)})),this.parentsHide&&this.parents.forEach((t=>{t.style.display="none"})),this.__addGlobalEvent(),this.sibling&&("top"===this.siblingPosition?this.__addOffset.top+=1-this.sibling.offsetHeight:this.__addOffset.left+=this.form.offsetWidth+this.sibling.offsetWidth-1),this._setControllerPosition(this.form,this.currentPositionTarget,!1);const r=t instanceof Range;this.currentTarget=r?null:t,this._controllerOn(this.form,t,r),this._w.setTimeout((()=>Qt.set("__overInfo",!1)),0)}close(t){this.isOpen&&(this.toTop=!1,this.isOpen=!1,this.__offset={},this.__addOffset={left:0,top:0},this.__removeGlobalEvent(),"function"==typeof this._initMethod&&this._initMethod(),this._controllerOff(),this.parentsHide&&!t&&this.parents.forEach((t=>{t.style.display="block"})),this.parents.length>0||("function"==typeof this.inst.close&&this.inst.close(),this.component.deselect()))}hide(){this.form.style.display="none"}show(){this._setControllerPosition(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?oi:li}resetPosition(t){this._setControllerPosition(this.form,t||this.currentPositionTarget,!0)}async _controllerOn(t,e,i){const s={position:this.position,inst:this,form:t,target:e,isRangeTarget:i,notInCarrier:!this.carrierWrapper.contains(t)};!1!==await this.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.editor.frameContext,info:s})&&(t.style.display="block",this.editor._shadowRoot&&(this.__shadowRootEventForm=t,this.__shadowRootEventListener=t=>t.stopPropagation(),t.addEventListener("mousedown",this.__shadowRootEventListener)),this.editor._controllerTargetContext=this.editor.frameContext.get("topArea"),this.isOpen||this.editor.opendControllers.push(s),this.isOpen=!0,this.editor._preventBlur=!0,this.editor.status.onSelected=!0,this.triggerEvent("onShowController",{caller:this.kind,frameContext:this.editor.frameContext,info:s}))}_controllerOff(){this.form.style.display="none",this.editor.opendControllers=this.editor.opendControllers.filter((t=>t.form!==this.form)),this.editor.currentControllerName!==this.kind&&this.editor.opendControllers.length>0||(this.ui.setControllerOnDisabledButtons(!1),this.editor.frameContext.get("lineBreaker_t").style.display=this.editor.frameContext.get("lineBreaker_b").style.display="none",this.editor.effectNode=null,this.editor.currentControllerName="",this.editor._preventBlur=!1,this.editor._controllerTargetContext=null,si.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__shadowRootEventForm&&(this.__shadowRootEventForm.removeEventListener("mousedown",this.__shadowRootEventListener),this.__shadowRootEventForm=this.__shadowRootEventListener=null),"function"==typeof this.inst.reset&&this.inst.reset())}_setControllerPosition(t,e,i){if(t.style.visibility="hidden",t.style.display="block",this.selection.isRange(e)){if(!this.offset.setRangePosition(this.form,e,{position:"bottom"}))return void this.hide()}else if(e){const s=this.offset.setAbsPosition(t,e,{addOffset:this.__addOffset,position:this.position,isWWTarget:this.isWWTarget,inst:this});if(!s)return void this.hide();if(!i&&this.sibling&&"top"===this.siblingPosition&&s.position!==this.position){const e=t.offsetTop-this.__addOffset.top;"bottom"===s.position?(this._reserveIndex=!0,t.style.top=e+this.sibling.offsetHeight-2+"px"):t.style.top=e-this.sibling.offsetHeight+2+"px"}else this._reserveIndex=!1}t.style.zIndex=this.toTop?li:this._reserveIndex?ri:ai,t.style.visibility=""}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandlers.keydown,!0),this._bindClose_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandlers.mousedown,!0)}__removeGlobalEvent(){this.component.__removeGlobalEvent(),this._bindClose_key&&(this._bindClose_key=this.eventManager.removeGlobalEvent(this._bindClose_key)),this._bindClose_mouse&&(this._bindClose_mouse=this.eventManager.removeGlobalEvent(this._bindClose_mouse))}_checkFixed(){if(this.editor.selectMenuOn)return!0;const t=this.editor.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}_checkForm(t){if(gt.check.isWysiwygFrame(t))return!1;if(gt.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;return this.isInsideForm&&this.parents?.length>0&&this.parents.some((i=>{if(i.contains(t))return e=!0,!0})),!e&&(!!gt.query.getParentElement(t,".se-controller")||t?.contains(this.inst._element))}#i(t){const e=gt.query.getEventTarget(t),i=gt.query.getCommandTarget(e);i&&(t.stopPropagation(),t.preventDefault(),this.inst.controllerAction(i))}#s(t){if(this.editor.currentControllerName=this.kind,this.parents.length>0&&this.isInsideForm)return;gt.query.getEventTarget(t).style.zIndex=this.toTop?oi:li}#n(t){if(this.parents.length>0&&this.isInsideForm)return;gt.query.getEventTarget(t).style.zIndex=this.toTop?li:this._reserveIndex?ri:ai}#t(t){if(this._checkFixed())return;const e=t.code;if(ft.isCtrl(t)||!ft.isNonResponseKey(e))return;const i=gt.query.getEventTarget(t);this.form.contains(i)||this._checkForm(i)||this.editor._fileManager.pluginRegExp.test(this.kind)&&!ft.isEsc(e)||(this.#o(i),this.close())}#e(t){const e=gt.query.getEventTarget(t);this.inst?._element?.contains(e)?this.isOpen=!1:(this.isOpen=!0,e===this.inst._element||e===this.currentTarget||this._checkFixed()||this.form.contains(e)||this._checkForm(e)||gt.query.getParentElement(e,".se-line-breaker-component")||(this.#o(e),this.close(!0)))}#o(t){this.editor.frameContext.get("wysiwyg").contains(t)||(this.component.__prevent=!1)}};const ci=class extends Jt{constructor(t,e){super(t.editor),this.kink=t.constructor.key||t.constructor.name,this.inst=t;const i=e.position.split("-");this.form=null,this.items=[],this.menus=null,this.menuLen=0,this.index=-1,this.item=null,this.isOpen=!1,this.checkList=!!e.checkList,this.position=i[0],this.subPosition=i[1],this._dirPosition=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this._dirSubPosition=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this._textDirDiff="ltr"!==e.dir&&("rtl"===e.dir||null),this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this._refer=null,this._keydownTarget=null,this._selectMethod=null,this._bindClose_key=null,this._bindClose_mousedown=null,this._bindClose_click=null,this._closeSignal=!1,this.__events=null,this.__eventHandlers={mousedown:this.#l.bind(this),mousemove:this.#r.bind(this),click:this.#a.bind(this),keydown:this.#h.bind(this)},this.__globalEventHandlers={keydown:this.#c.bind(this),mousedown:this.#e.bind(this),click:this.#d.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="";let i="";for(let s=0,n=(e=e||t).length;s<n;s++)s>0&&s%this.splitNum==0&&(this._createFormat(i),i=""),i+=`<li class="se-select-item" data-index="${s}">${"string"==typeof e[s]?e[s]:e[s].outerHTML}</li>`;this._createFormat(i),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,i){i||(i={}),this._refer=t,this._keydownTarget=gt.check.isInputElement(t)?t:this._w,this._selectMethod=e,this.form=gt.utils.createElement("DIV",{class:"se-select-menu"+(i.class?" "+i.class:""),style:i.style||""},'<div class="se-list-inner"></div>'),t.parentNode.insertBefore(this.form,t)}open(t,e){this.editor.selectMenuOn=!0,"function"==typeof this.openMethod&&this.openMethod(),this.__addEvents(),this.__addGlobalEvent();const i=t?t.split("-"):[],s=i[0]||(null!==this._textDirDiff&&this._textDirDiff!==this.options.get("_rtl")?this._dirPosition:this.position),n=i[1]||(null!==this._textDirDiff&&this._textDirDiff!==this.options.get("_rtl")?this._dirSubPosition:this.subPosition);this._setPosition(s,n,e),this.isOpen=!0}close(){this.editor.selectMenuOn=!1,gt.utils.removeClass(this._refer,"on"),this._init(),this.form&&(this.form.style.cssText=""),this.isOpen=!1,"function"==typeof this.closeMethod&&this.closeMethod()}getItem(t){return this.items[t]}setItem(t){this._selectItem(t)}_createFormat(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}_init(){this.__removeEvents(),this.__removeGlobalEvent(),this.index=-1,this.item=null,this._onItem&&(gt.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}_moveItem(t){t=this.index+t;const e=this.menuLen,i=this.index=t>=e?0:t<0?e-1:t;this._selectItem(i)}_selectItem(t){gt.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let i=0;i<e;i++)i===t?gt.utils.addClass(this.menus[i],"active"):gt.utils.removeClass(this.menus[i],"active");this.index=t,this.item=this.items[t]}_setPosition(t,e,i,s){const n=t,o=this.form,l=this._refer;o.style.visibility="hidden",o.style.display="block",gt.utils.removeClass(o,"se-select-menu-scroll"),gt.utils.addClass(l,"on");const r=o.offsetWidth,a=l.offsetWidth,h=l.offsetLeft;let c=!1,d=0,u=0;"left"===t?(d=h-r-1,t=e,c=!0):"right"===t&&(d=h+a+1,t=e,c=!0);const p=this.editor.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,_=gt.utils.getClientSize().h-(m-this._w.scrollY+f),b=c?f:0;let y=1e4;switch(t){case"middle":{let t=o.offsetHeight;const e=f/2;u=g-t/2+e,m<t/2&&(u+=t/2-m-e+4,o.style.top=u+"px");let i=this.editor.offset.getGlobal(o).top;const s=t-(m-i)-_-f;s>0&&(u-=s+4,o.style.top=u+"px"),i=this.editor.offset.getGlobal(o).top,i<0&&(t+=i-4,u-=i-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-b){if(!s){y=0;break}y=m-4+b,y>=38&&(o.style.height=y+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(_<o.offsetHeight+b){if(!s){y=0;break}y=_-4+b,y>=38&&(o.style.height=y+"px")}u=g+(c?0:f)}if(y<38&&!s&&"middle"!==t)return void this._setPosition("top"===t?"bottpm":"top",e,i,!0);if(!c)switch(e){case"center":d=h+a/2-r/2;break;case"left":d=h;break;case"right":d=h-(r-a)}o.style.left=d+"px";const v=this.editor.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-this._w.scrollX+v,C<0&&(d=d=h+a+1);break;case"true-right":C=this._w.innerWidth-(v+r),C<0&&(d=h-r-1);break;case"false-center":{C=this._w.innerWidth-(v+r),C<0&&(d+=C-4),o.style.left=d+"px";const t=this.editor.offset.getGlobal(o).left;t<0&&(d-=t-4);break}case"false-left":C=this._w.innerWidth-(p.left-this._w.scrollX+r),C<0&&(d+=C-4);break;case"false-right":v<0&&(d-=v-4)}if(i){const t=o.firstElementChild.querySelector(i);t&&(this._onItem=t,gt.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}_select(t){this.checkList&>.utils.toggleClass(this.menus[t],"se-checked"),this._selectMethod(this.getItem(t))}__addEvents(){this.__removeEvents(),this.__events=this.__eventHandlers,this.form.addEventListener("mousedown",this.__events.mousedown),this.form.addEventListener("mousemove",this.__events.mousemove),this.form.addEventListener("click",this.__events.click),this._keydownTarget.addEventListener("keydown",this.__events.keydown)}__removeEvents(){this.__events&&(this.form.removeEventListener("mousedown",this.__events.mousedown),this.form.removeEventListener("mousemove",this.__events.mousemove),this.form.removeEventListener("click",this.__events.click),this._keydownTarget.removeEventListener("keydown",this.__events.keydown),this.__events=null)}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandlers.keydown,!0),this._bindClose_mousedown=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandlers.mousedown,!0)}__removeGlobalEvent(){this._bindClose_key&&(this._bindClose_key=this.eventManager.removeGlobalEvent(this._bindClose_key)),this._bindClose_mousedown&&(this._bindClose_mousedown=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)),this._bindClose_click&&(this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click))}#h(t){let e;switch(t.code){case"ArrowUp":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index-t<0?t:-t}else e=-1;break;case"ArrowDown":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index+t>this.menuLen?-t:t}else e=1;break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),e=-1;break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),e=1;break;case"Enter":case"Space":this.index>-1?(t.preventDefault(),t.stopPropagation(),this._select(this.index)):this.close()}e&&this._moveItem(e)}#l(t){if(dt.isGecko){const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,".se-select-item");i&&this.eventManager._injectActiveEvent(i)}}#r(t){const e=gt.query.getEventTarget(t);gt.utils.addClass(this.form,"se-select-menu-mouse-move");const i=e.getAttribute("data-index");i&&(this.index=Number(i))}#a(t){let e=gt.query.getEventTarget(t),i=null;for(;!i&&!/UL/i.test(e.tagName)&&!gt.utils.hasClass(e,"se-select-menu");)i=e.getAttribute("data-index"),e=e.parentElement;i&&this._select(Number(i))}#c(t){ft.isEsc(t.code)&&this.close()}#e(t){const e=gt.query.getEventTarget(t);this.form.contains(e)||(t.target!==this._refer?this.close():gt.check.isInputElement(e)||(this._bindClose_click=this.eventManager.addGlobalEvent("click",this.__globalEventHandlers.click,!0)))}#d(t){this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click),t.target===this._refer&&(t.stopPropagation(),this.close())}},{ON_OVER_COMPONENT:di}=dt,ui={tl:"nwse-resize",tr:"nesw-resize",bl:"nesw-resize",br:"nwse-resize",lw:"ew-resize",th:"ns-resize",rw:"ew-resize",bh:"ns-resize"};let pi=!1,gi=!1,mi=0,fi=0;class _i extends ii{constructor(t,e,i){super(t.editor),this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.icons.format_float_none,left:this.icons.format_float_left,right:this.icons.format_float_right,center:this.icons.format_float_center},this._action={};const s=function(t,e){let i=null;if(e?.length>0){const{lang:s,icons:n}=t;i='<div class="se-arrow se-arrow-up"></div>';for(let o,l=0;l<e.length;l++){o=e[l],i+='<div class="se-btn-group">';for(let e,l=0,r=o.length;l<r;l++){if(e=o[l],"function"==typeof e?.action){const i=e;e={c:`__c__${i.command}`,v:i.value||"",l:i.title,i:i.icon},t._action[e.c]=i.action}else if(e=bi(e),!e)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${e.c}" data-value="${e.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${n[e.i]||e.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${s[e.l]||e.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return gt.utils.createElement("DIV",{class:"se-controller se-controller-resizing"+(i?"":" se-empty-controller")},i)}(this,e||[]);this.controller=new hi(this,s,{position:"bottom",disabled:!0},this.kind),this.alignButton=s.querySelector('[data-command="onalign"]');const n=function(t,e){if(!e)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],s=[t.lang.basic,t.lang.left,t.lang.center,t.lang.right],n=["none","left","center","right"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.alignButton);n&&(this.selectMenu_align=new ci(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#u.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(n.items,n.html)),this.asButton=s.querySelector('[data-command="onas"]');const o=function(t,e){if(!e)return null;const i=[t.icons.as_block,t.icons.as_inline],s=[t.lang.asBlock,t.lang.asInline],n=["block","inline"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.asButton);o&&(this.selectMenu_as=new ci(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#p.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(o.items,o.html)),this.resizeButton=s.querySelector('[data-command="onresize"]');const l=function(t,e){if(!e)return null;const i=e.getAttribute("data-value").split(","),s=[];for(let e,n,o,l,r=0;r<i.length;r++)o=i[r],e=mt.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,s.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:s,items:i}}(this,this.resizeButton);l&&(this.selectMenu_resize=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#g.bind(this)),this.selectMenu_resize.create(l.items,l.html)),this.inst=t,this.sizeUnit=i.sizeUnit||"px",this.autoRatio=i.autoRatio,this.isVertical=!1,this.percentageButtons=s.querySelectorAll('[data-command="resize_percent"]'),this.captionButton=s.querySelector('[data-command="caption"]'),this.align="none",this.as="block",this._element=null,this._cover=null,this._inlineCover=null,this._container=null,this._caption=null,this._width="",this._height="",this._resize_w=0,this._resize_h=0,this._element_w=0,this._element_h=0,this._element_l=0,this._element_t=0,this._resizeClientX=0,this._resizeClientY=0,this._resize_direction="",this._floatClassStr="__se__float-none|__se__float-left|__se__float-center|__se__float-right",this.__preventSizechange=!1,this.__revertSize={w:"",h:""},this.__offset={},this.__offContainer=this.#m.bind(this),this.__containerResizing=this.#f.bind(this),this.__containerResizingOff=this.#_.bind(this),this.__containerResizingESC=this.#b.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.__onResizeESCEvent=null,this.__fileManagerInfo=!1,this.eventManager.addEvent(this.alignButton,"click",this.#y.bind(this)),this.eventManager.addEvent(this.asButton,"click",this.#v.bind(this)),this.eventManager.addEvent(this.resizeButton,"click",this.#C.bind(this)),this.editor.applyFrameRoots((t=>{if(!t.get("wrapper").querySelector(".se-controller.se-resizing-container")){const e=function(){const t='\n\t\t<div class="se-resize-dot">\n\t\t\t<span class="tl"></span>\n\t\t\t<span class="tr"></span>\n\t\t\t<span class="bl"></span>\n\t\t\t<span class="br"></span>\n\t\t\t<span class="lw"></span>\n\t\t\t<span class="th"></span>\n\t\t\t<span class="rw"></span>\n\t\t\t<span class="bh"></span>\n\t\t\t<div class="se-resize-display"></div>\n\t\t</div>';return gt.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),i=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:i}),t.get("wrapper").appendChild(e),this.eventManager.addEvent(i,"mousedown",this.#w.bind(this))}}))}static CreateContainer(t,e){return gt.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},gt.utils.createElement("FIGURE",null,t)),_i.GetContainer(t)}static CreateInlineContainer(t,e){return gt.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),_i.GetContainer(t)}static CreateCaption(t,e){const i=gt.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(i),i}static GetContainer(t){const e=gt.query.getParentElement(t,"FIGURE",2),i=gt.query.getParentElement(t,"SPAN",2);return{target:t,container:gt.query.getParentElement(t,_i.is,2)||e,cover:e,inlineCover:gt.utils.hasClass(i,"se-inline-component")?i:null,caption:gt.query.getEdgeChild(t.parentElement,"FIGCAPTION",!1)}}static GetRatio(t,e,i){let s=1,n=1;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!mt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px")===(!mt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px")){const i=mt.get(t,4),o=mt.get(e,4);s=i/o,n=o/i}}return{w:mt.get(s,4),h:mt.get(n,4)}}static CalcRatio(t,e,i,s){if(/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!mt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px",o=!mt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px";if(n===o){const i="%"===n?2:0,l=t,r=e;e=mt.get(s.h*mt.get(l,i),i)+o,t=mt.get(s.w*mt.get(r,i),i)+n}}return{w:t,h:e}}static is(t){return gt.utils.hasClass(t,"se-component")||/^(HR)$/.test(t?.nodeName)}close(){this.editor._preventBlur=!1,gt.utils.removeClass(this._cover,"se-figure-selected"),this.controller.close(),this.component._removeDragEvent()}open(t,{nonResizing:e,nonSizeInfo:i,nonBorder:s,figureTarget:n,__fileManagerInfo:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');Qt.get("__overInfo")!==di?this.ui._offCurrentController():s=!0;const l=_i.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.options.get("strictMode").formatFilter)return{container:null,cover:null,width:r.style.width||r.width||"",height:r.style.height||r.height||""};l.container=r,l.cover=r,a=!0}Qt.set("__figureInst",this),this._setFigureInfo(l);const h=n&&(this._cover||this._container)||r,c=h.offsetWidth||null,d=h.offsetHeight||null,{top:u,left:p,scrollX:g,scrollY:m}=this.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(","),_=_i.GetRatio(f[0]||mt.get(r.style.width,2)||c,f[1]||mt.get(r.style.height,2)||d,this.sizeUnit),b={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:_,w:c||"",h:d||"",t:u,l:p,width:f[0]||"auto",height:f[1]||"auto",originWidth:r.naturalWidth||r.offsetWidth,originHeight:r.naturalHeight||r.offsetHeight};if(this._width=b.width,this._height=b.height,o||this.__fileManagerInfo)return b;const y=this.editor.frameContext.get("_figure");this.editor._figureContainer=y.main,y.main.style.top=u+"px",y.main.style.left=p+"px",y.main.style.width=(this.isVertical?d:c)+"px",y.main.style.height=(this.isVertical?c:d)+"px",y.border.style.top="0px",y.border.style.left="0px",y.border.style.width=(this.isVertical?d:c)+"px",y.border.style.height=(this.isVertical?c:d)+"px",this.__offset={left:p+g,top:u+m},this.editor.opendControllers.push({position:"none",form:y.main,target:h,inst:this,notInCarrier:!0});const v=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?mt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===v?gt.utils.addClass(this.percentageButtons[t],"active"):gt.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?gt.utils.addClass(this.captionButton,"active"):gt.utils.removeClass(this.captionButton,"active")),y.display.style.display=i||this._inlineCover?"none":"",y.border.style.display=s?"none":"",y.main.style.display="block",Qt.get("__overInfo")!==di){this._setAlignIcon(),this._setAsIcon(),this.ui._visibleControllers(!0,!0);const t=this.getSize(r);gt.utils.changeTxt(y.display,this.lang["none"===this.align?"basic":this.align]+" ("+t.w+", "+t.h+")"),this._displayResizeHandles(!e);const i=this.controller.form.querySelectorAll('[data-command="rotate"][data-value="90"], [data-command="rotate"][data-value="-90"], [data-command="caption"], [data-command="onalign"], [data-command="onresize"]'),s=this._inlineCover||a?"none":"";i.forEach((t=>{t.style.display=s}));const n=this.controller.form.querySelector('[data-command="onas"]');n&&(n.style.display=a?"none":""),gt.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller.open(y.main,null,{initMethod:this.__offContainer,isWWTarget:!1,addOffset:null}),this._w.setTimeout((()=>Qt.set("__overInfo",!1)),0)}else gt.utils.addClass(this._cover,"se-figure-over-selected");return gt.utils.addClass(this._cover,"se-figure-selected"),this._element_w=this._resize_w=c,this._element_h=this._resize_h=d,this._element_l=p,this._element_t=u,this._inlineCover||Qt.get("__overInfo")===di&&!gt.utils.hasClass(l.container,"se-input-component")||this._setDragEvent(y.main),b}controllerHide(){this.controller.hide()}controllerShow(){this.controller.show()}controllerOpen(t,e){this._element=t,this.controller.open(t,null,e)}setSize(t,e){/%$/.test(t+"")?this._setPercentSize(t,e):t&&"auto"!==t||e&&"auto"!==e?this._applySize(t,e,""):this.autoRatio?this._setPercentSize(100,this.autoRatio.default||this.autoRatio.current):this._setAutoSize()}getSize(t){if(t||(t=this._element),!t)return{w:"",h:""};const e=_i.GetContainer(t),i=e.target;if(!e.container)return this.options.get("strictMode").formatFilter?{w:"",h:i.style.height}:{w:i.style.width||"auto",h:i.style.height||"auto"};return{w:(/%$/.test(i.style.width)?(e.container&&mt.get(e.container.style.width,2)||100)+"%":i.style.width)||"auto",h:(e.inlineCover?e.inlineCover.style.height:mt.get(e.cover.style.paddingBottom,0)>0&&!this.isVertical?e.cover.style.height:/%$/.test(i.style.height)&&/%$/.test(i.style.width)?(e.container&&mt.get(e.container.style.height,2)||100)+"%":i.style.height)||"auto"}}setAlign(t,e){t||(t=this._element),this.align=e=e||"none";const i=_i.GetContainer(t);if(!i.cover)return;const s=i.target,n=i.container,o=i.cover;if(/%$/.test(s.style.width)&&"center"===e&&!this.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?s.style.height||s.offsetHeight+"px":s.style.width&&"auto"!==s.style.width?s.style.width||"100%":""),gt.utils.hasClass(n,"__se__float-"+e)||(gt.utils.removeClass(n,this._floatClassStr),gt.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this._setAlignIcon()}convertAsFormat(t,e){t||(t=this._element),this.as=e||"block";const{container:i,inlineCover:s,target:n}=_i.GetContainer(t),{w:o,h:l}=this.getSize(n),r=n.cloneNode(!1);switch(e){case"inline":{if(s)break;this.component.deselect();const t=i.nextElementSibling,e=i.parentElement;r.style.width="",r.style.height="";const n=_i.CreateInlineContainer(r);gt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(n,o,l);const a=gt.utils.createElement(this.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),gt.utils.removeItem(i);break}case"block":{if(!s)break;this.component.deselect(),this.selection.setRange(i,0,i,1);const t=this.html.remove(),e=this.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&>.check.isZeroWidth(e.previousElementSibling)&>.utils.removeItem(e.previousElementSibling),r.style.width="",r.style.height="";const n=_i.CreateContainer(r);gt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}}_asFormatChange(t,e,i){const s=this.kind;t.target.onload=()=>this.component.select(t.target,s),this._setFigureInfo(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setSize(e,i)}controllerAction(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value"),s=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==s){switch(e){case"mirror":{const t=this.#x(n);let e=t.x,s=t.y;"h"===i&&!this.isVertical||"v"===i&&this.isVertical?s=s?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,s);break}case"rotate":this.setTransform(n,null,null,i);break;case"caption":if(this._caption)gt.utils.removeItem(this._caption),this._w.setTimeout(this.component.select.bind(this.component,n,this.kind),0);else{const t=_i.CreateCaption(this._cover,this.lang.caption),e=gt.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.selection.setRange(e,0,e,e.textContent.length):t.focus(),this.controller.close()}this._caption=!this._caption,(/\d+/.test(n.style.height)||this.isVertical&&this._caption)&&(/%$/.test(n.style.width)||/auto/.test(n.style.height)?this.deleteTransform():this.setTransform(n,n.style.width,n.style.height,0));break;case"revert":this._setRevert();break;case"edit":this.inst.edit(n);break;case"copy":this.component.copy(this._container);break;case"remove":this.inst.destroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,i,t):/^edit$/.test(e)||(this.history.push(!1),/^remove|caption$/.test(e)||this.component.select(n,this.kind))}}retainFigureFormat(t,e,i,s){const n=this.component.isInline(t);let o=this.format.isBlock(e.parentNode)||gt.check.isWysiwygFrame(e.parentNode)?e:gt.check.isAnchor(e.parentNode)?e.parentNode:this.format.getLine(e)||e;if(gt.query.getParentElement(e,gt.check.isExcludeFormat))o=i&&i!==e?i:e,o.parentNode.replaceChild(t,o);else if(n&&this.format.isLine(o)){const i=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;i.parentElement.replaceChild(t,i)}else if(gt.check.isListCell(o)){const i=gt.query.getParentElement(e,(t=>t.parentNode===o));o.insertBefore(t,i),gt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(i,null,!0)}else if(this.format.isLine(o)){const i=gt.query.getParentElement(e,(t=>t.parentNode===o));o=this.nodeTransform.split(o,i),o.parentNode.insertBefore(t,o),gt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(o,null,!0)}else if(this.format.isLine(o.parentNode)){const e=o.parentNode;e.parentNode.insertBefore(t,o.previousSibling?e.nextElementSibling:e),(0===s?.__updateTags.map((t=>o.contains(t))).length||gt.check.isZeroWidth(o))&>.utils.removeItem(o)}else o=gt.check.isFigure(o.parentNode)?gt.query.getParentElement(o.parentNode,_i.is):o,o.parentNode.replaceChild(t,o)}deleteTransform(t){t||(t=this._element);const e=t,i=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this._deleteCaptionPosition(e),this._applySize(i[0]||"auto",i[1]||"","")}setTransform(t,e,i,s){try{this.__preventSizechange=!0;const n=this.#x(t),o=n.r+1*(s||0);s=Math.abs(o)>=360?0:o;const l=this.isVertical=/^(90|270)$/.test(Math.abs(s).toString());e=mt.get(e,0),i=mt.get(i,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");let h="";if(/auto|%$/.test(a[0])&&!l)"auto"===a[0]&&"auto"===a[1]?this._setAutoSize():this._setPercentSize(a[0],a[1]);else{const t=_i.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=i||r.offsetHeight,c=(l?a:o)+"px",d=(l?o:a)+"px";if(this._deletePercentSize(),this._applySize(o+"px",a+"px",""),n.style.width=c,n.style.height=t.caption||t.inlineCover?"":d,l){h=90===s||-270===s?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=h,this._setRotate(r,s,n.x,n.y),r.style.maxWidth=l?"none":"",this._setCaptionPosition(r)}finally{this.__preventSizechange=!1}}_setFigureInfo(t){this._inlineCover=t.inlineCover,this._cover=t.cover||this._inlineCover,this._container=t.container,this._caption=t.caption,this._element=t.target,this.align=(this._container.className.match(/(?:^|\s)__se__float-(none|left|center|right)(?:$|\s)/)||[])[1]||t.target.style.float||"none",this.as=this._inlineCover?"inline":"block",this.isVertical=/^(90|270)$/.test(Math.abs(this.#x(t.target).r).toString())}_setRotate(t,e,i,s){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(i||s))switch(o=i?"Y":"X",e+""){case"90":o=i&&s?"X":s?o:"";break;case"270":n*=-1,o=i&&s?"Y":i?o:"";break;case"-90":o=i&&s?"Y":i?o:"";break;case"-270":n*=-1,o=i&&s?"X":s?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(i?" rotateX("+i+"deg)":"")+(s?" rotateY("+s+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,i){const s=/^(rw|lw)$/.test(i)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(i)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=mt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||s||n||this._deletePercentSize();const o=this._cover||this._element;this.autoRatio&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),s||(e=mt.is(e)?e+this.sizeUnit:e,o.style.height=this._element.style.height=this.autoRatio&&!this.isVertical?"100%":e,this.autoRatio&&(this._cover.style.height=e,this.__setCoverPaddingBottom(t,e))),"center"===this.align&&this.setAlign(this._element,this.align),this._saveCurrentSize()}__setCoverPaddingBottom(t,e){this._inlineCover!==this._cover&&(this._cover.style.height=e,/%$/.test(t)&&"center"===this.align?this._cover.style.paddingBottom=/%$/.test(e)?mt.get(mt.get(e,2)/100*mt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this._deletePercentSize(),this.autoRatio?this._setPercentSize("100%",this.autoRatio.current||this.autoRatio.default):(this._element.style.maxWidth="",this._element.style.width="",this._element.style.height="",this._cover.style.width="",this._cover.style.height=""),this.setAlign(this._element,this.align),this._saveCurrentSize()}_setPercentSize(t,e){e||(e=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e),e=!e||/%$/.test(e+"")||mt.get(e,0)?mt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):mt.is(e)?e+"%":e;const i=/%$/.test(e+"");this._container.style.width=String(mt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.options.get("strictMode").formatFilter?(this._inlineCover!==this._cover&&(this._cover.style.width="100%",this._cover.style.height=String(e)),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=String(this.autoRatio?"100%":i?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this._setCaptionPosition(this._element),this._saveCurrentSize()):this._saveCurrentSize()}_deletePercentSize(){this._cover.style.width="",this._cover.style.height="",this._container.style.width="",this._container.style.height="",gt.utils.removeClass(this._container,this._floatClassStr),gt.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setSize(this.__revertSize.w,this.__revertSize.h)}_setAlignIcon(){this.alignButton&>.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}_setAsIcon(){this.asButton&>.utils.changeElement(this.asButton.firstElementChild,this.icons[`as_${this.as}`])}_saveCurrentSize(){if(this.__preventSizechange)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.__revertSize.w=t[0],this.__revertSize.h=t[1];const e=this.getSize(this._element);this._element.setAttribute("width",e.w.replace("px","")),this._element.setAttribute("height",e.h.replace("px","")),this._element.setAttribute("data-se-size",e.w+","+e.h),this.autoRatio&&(this.autoRatio.current=/%$/.test(e.h)?e.h:"")}_setCaptionPosition(t){const e=gt.query.getEdgeChild(gt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop=(this.isVertical?t.offsetWidth-t.offsetHeight:0)+"px")}_deleteCaptionPosition(t){const e=gt.query.getEdgeChild(gt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}_displayResizeHandles(t){const e=t?"flex":"none";this.controller.form.style.display=e;const i=this.editor.frameContext.get("_figure"),s=i.handles;for(let t=0,i=s.length;t<i;t++)s[t].style.display=e;"none"===e?(gt.utils.addClass(i.main,"se-resize-ing"),this.__onResizeESCEvent=this.eventManager.addGlobalEvent("keydown",this.__containerResizingESC)):gt.utils.removeClass(i.main,"se-resize-ing")}_offResizeEvent(){this.component._removeDragEvent(),this.eventManager.removeGlobalEvent(this.__onContainerEvent),this.eventManager.removeGlobalEvent(this.__offContainerEvent),this.eventManager.removeGlobalEvent(this.__onResizeESCEvent),this._displayResizeHandles(!0),this.ui._offCurrentController(),this.ui.disableBackWrapper()}_setDragEvent(t){const e=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");gt.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",Qt.set("__dragHandler",e),Qt.set("__dragContainer",this._container),Qt.set("__dragCover",this._cover),Qt.set("__dragMove",this.#k.bind(this,e,t)),Qt.get("__dragMove")(),e.style.display="block"}#k(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+"px"}#w(t){t.stopPropagation(),t.preventDefault();const e=gt.query.getEventTarget(t),i=Qt.get("__figureInst"),s=i._resize_direction=e.classList[0];i._resizeClientX=t.clientX,i._resizeClientY=t.clientY,i.editor.frameContext.get("_figure").main.style.float=/l/.test(s)?"right":/r/.test(s)?"left":"none",this.ui.enableBackWrapper(ui[s]);const{w:n,h:o}=this.getSize(i._element);if(pi=gi=!1,mi=fi=0,!this.isVertical){const t=!n||/auto|%$/.test(n),e=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(s)&&t&&e?pi=!0:"lw|rw".includes(s)&&t&&(gi=!0),pi||gi){const t=i._cover||i._element;fi=t.offsetWidth,mi=pt.getWidthInPercentage(t,this.editor.frameContext.get("wysiwygFrame"))/100}}i.__onContainerEvent=i.eventManager.addGlobalEvent("mousemove",i.__containerResizing),i.__offContainerEvent=i.eventManager.addGlobalEvent("mouseup",i.__containerResizingOff),i._displayResizeHandles(!1);const l=this.editor.frameContext.get("_figure").display;l.style.display="block",gt.utils.changeTxt(l,n+" x "+o)}#f(t){const e=this._resize_direction,i=t.clientX,s=t.clientY;let n=this._element_w,o=this._element_h;const l=n+(/r/.test(e)?i-this._resizeClientX:this._resizeClientX-i),r=o+(/b/.test(e)?s-this._resizeClientY:this._resizeClientY-s),a=o/n*l,h=this.editor.frameContext.get("_figure").border;/t/.test(e)&&(h.style.top=o-(/h/.test(e)?r:a)+"px"),/l/.test(e)&&(h.style.left=n-l+"px"),/r|l/.test(e)&&(h.style.width=l+"px",n=l),/^(t|b)[^h]$/.test(e)?(h.style.height=a+"px",o=a):/^(t|b)h$/.test(e)&&(h.style.height=r+"px",o=r),this._resize_w=/h$/.test(e)?this._width:Math.round(n),this._resize_h=/w$/.test(e)?this._height:Math.round(o);const c=mi?this._resize_w/fi*mi*100:this._resize_w;gt.utils.changeTxt(this.editor.frameContext.get("_figure").display,mi?mt.get(c>100?100:c,2).toFixed(2)+"%":c+" x "+this._resize_h)}#_(){this._offResizeEvent();let t=this.isVertical?this._resize_h:this._resize_w,e=this.isVertical?this._resize_w:this._resize_h;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const i=this.editor.frameContext.get("wysiwygFrame").clientWidth-mt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+mt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;mt.get(t,0)>i&&(e=Math.round(e/t*i),t=i)}if(pi||gi){t=t/(this._cover||this._element).offsetWidth*mi*100;const e=mt.get(t>100?100:t,2)+"%";this._setPercentSize(e,gi?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.history.push(!1),this.component.select(this._element,this.kind)}#b(t){ft.isEsc(t.code)&&(this._offResizeEvent(),this.component.select(this._element,this.kind))}#u(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.component.select(this._element,this.kind)}#p(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#g(t){if("auto"===t)this.deleteTransform(),this._setAutoSize();else{let e=this.getSize(this._element).h;if(this.isVertical){const t=(this._element.getAttribute("data-se-size")||",").split(",");t[1]&&(e=t[1])}this.deleteTransform(),this._setPercentSize(1*t,null!==mt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.component.select(this._element,this.kind)}#m(){this.editor.frameContext.get("_figure").main.style.display="none",this.editor._figureContainer=null}#y(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#v(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#C(){const t=this.getSize(this._element),e=t.w,i=t.h;let s="";if(this.autoRatio){if(i===this.autoRatio.default&&/%$/.test(e)){const t=mt.get(e);s=100===t?"auto":"resize_percent"+t}}else"auto"===i&&("auto"===e?s="auto":/%$/.test(e)&&(s="resize_percent"+mt.get(e)));this.selectMenu_resize.open("",'[data-command="'+s+'"]')}#x(t){const e=t.style.transform;return e?{r:Number((e.match(/rotate\(([-0-9]+)deg\)/)||[])[1]||0),x:(e.match(/rotateX\(([-0-9]+)deg\)/)||[])[1]||"",y:(e.match(/rotateY\(([-0-9]+)deg\)/)||[])[1]||""}:{r:0,x:"",y:""}}}function bi(t){const e=t.split("_"),i=e[0],s=e[1];let n,o,l,r;switch(i){case"resize":n="onresize",o=s,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===s?-90:"r"===s?90:mt.get(s),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=s,l="h"===s?"mirrorHorizontal":"mirrorVertical",r="h"===s?"mirror_horizontal":"mirror_vertical";break;case"align":n="onalign",l="align",r="align_justify";break;case"caption":n="caption",l="caption",r="caption";break;case"revert":n="revert",l="revert",r="revert";break;case"edit":n="edit",l="edit",r="edit";break;case"as":n="onas",l="blockStyle",r="as_block";break;case"copy":n="copy",l="copy",r="copy";break;case"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:undefined,i:r}:null}const yi=_i,{_w:vi,ON_OVER_COMPONENT:Ci,isMobile:wi}=dt,xi=/^Arrow(Left|Up|Right|Down)$/,ki=/^Arrow(Left|Up)$/;function Ei(t){Jt.call(this,t),this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.__globalEvents={copy:Ai.bind(this),cut:Bi.bind(this),keydown:Ii.bind(this),mousedown:Ni.bind(this)},this._bindClose_copy=null,this._bindClose_cut=null,this._bindClose_keydown=null,this._bindClose_mousedown=null,this._bindClose_touchstart=null,this.__selectionSelected=!1,this.__prevent=!1,this.editor.applyFrameRoots((t=>{const e=gt.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.icons.selection);t.get("wrapper").appendChild(e),this.eventManager.addEvent(e,"mouseenter",Si.bind(this)),this.eventManager.addEvent(e,"mouseleave",Ti.bind(this)),this.eventManager.addEvent(e,"dragstart",Hi.bind(this)),this.eventManager.addEvent(e,"dragend",Li.bind(this)),this.eventManager.addEvent(e,"click",Mi.bind(this))}))}function Si(){this.editor._preventBlur=!0,this.ui._visibleControllers(!1,gt.utils.hasClass(Qt.get("__dragHandler"),"se-drag-handle-full")),gt.utils.addClass(Qt.get("__dragCover")||Qt.get("__dragContainer"),"se-drag-over")}function Ti(){this.editor._preventBlur=!1,gt.utils.hasClass(Qt.get("__dragHandler"),"se-drag-handle-full")||this.ui._visibleControllers(!0,!0),gt.utils.removeClass([Qt.get("__dragCover"),Qt.get("__dragContainer")],"se-drag-over")}function Hi(t){const e=Qt.get("__dragCover")||Qt.get("__dragContainer");e?(this.editor._preventBlur=!1,gt.utils.addClass(Qt.get("__dragHandler"),"se-dragging"),gt.utils.addClass(Qt.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.options.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}function Li(){this.editor._preventBlur=!1,gt.utils.removeClass([Qt.get("__dragHandler"),Qt.get("__dragContainer")],"se-dragging"),this._removeDragEvent()}function Mi(t){const e=gt.query.getEventTarget(t);if(!gt.utils.hasClass(e,"se-drag-handle-full"))return;const i=Qt.get("__dragInst");this._removeDragEvent(),this.select(i.currentTarget,i.currentPluginName)}function Ni(t){const e=gt.query.getEventTarget(t);this.currentTarget?.contains(e)||gt.query.getParentElement(e,".se-controller")||gt.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.editor.currentControllerName&&this.editor.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}function Ai(t){const e=gt.query.getEventTarget(t);if(gt.check.isInputElement(e)&>.query.getParentElement(e,".se-modal"))return;const i=this.info;if(!i)return;const s=i.container.cloneNode(!0);gt.utils.removeClass(s,"se-component-selected"),"function"==typeof this.plugins[i.pluginName]?.onCopyComponent&&!1!==this.plugins[i.pluginName].onCopyComponent({event:t,cloneContainer:s,info:i})||Vi(t,s,t.clipboardData),gt.utils.flashClass(i.container,"se-copy")}function Bi(t){const e=this.info;if(!e)return;const i=e.container.cloneNode(!0);gt.utils.removeClass(i,"se-component-selected"),Vi(t,i,t.clipboardData),this.deselect(),gt.utils.removeItem(e.container)}async function Ii(t){if(this.editor.selectMenuOn)return;const e=t.code;if(ft.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const i=this.editor.shortcutsKeyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(i?.c)&&(t.preventDefault(),t.stopPropagation(),this.editor.run(i.c,i.t,i.e))}}else{if(ft.isRemoveKey(e)&&(t.preventDefault(),t.stopPropagation(),"function"==typeof this.currentPlugin?.destroy))return await this.currentPlugin.destroy(this.currentTarget),this.deselect(),void this.editor.focus();if(ft.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),i=e.container||e.target,s=i.previousElementSibling||i.nextElementSibling;let n=null;n=gt.check.isListCell(i.parentNode)?gt.utils.createElement("BR"):gt.utils.createElement(this.format.isLine(s)?s.nodeName:this.options.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),i.parentNode.insertBefore(n,i),!1===this.select(e.target,o)&&this.editor.blur(),void this.history.push(!1)}if(xi.test(e)){const{container:i}=this.get(this.currentTarget);let s=null,n=1;if(this.isInline(i||this.currentTarget))switch(e){case"ArrowLeft":s=i.previousSibling,n=3===s?.nodeType?s.textContent.length:1;break;case"ArrowRight":s=i.nextSibling,n=0;break;case"ArrowUp":{const t=this.format.getLine(i,null);s=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.format.getLine(i,null);s=t?.nextElementSibling;break}}else ki.test(e)?s=i.previousElementSibling:(s=i.nextElementSibling,n=0);if(!s)return;this.deselect();const o=this.get(s);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.editor._preventBlur=!0,t.stopPropagation(),t.preventDefault(),this.selection.setRange(s,n,s,n)}finally{this.editor._preventBlur=!1}}else ft.isEsc(e)&&this.deselect()}}function Vi(t,e,i){t.preventDefault(),t.stopPropagation(),e.querySelectorAll(".se-figure-selected").forEach((t=>gt.utils.removeClass(t,"se-figure-selected"))),i.setData("text/html",e.outerHTML)}Ei.prototype={insert(t,{skipCharCount:e,skipSelection:i,skipHistory:s}={}){if(this.editor.frameContext.get("isReadOnly")||!e&&!this.char.check(t))return null;const n=this.html.remove(),o=this.isInline(t);this.selection.getRangeAndAddLine(this.selection.getRange(),n.container);const l=this.selection.getNode();let r=null,a=this.format.getLine(l,null);if(gt.check.isListCell(a))this.html.insertNode(t,{afterNode:o||l===a?null:n.container.nextSibling,skipCharCount:!0}),o||t.nextSibling||t.parentNode.appendChild(gt.utils.createElement("BR"));else{if(!o&&this.selection.getRange().collapsed&&(3===n.container.nodeType||gt.check.isBreak(n.container))){const t=gt.query.getParentElement(n.container,this.format.isBlock.bind(this.format));r=this.nodeTransform.split(n.container,n.offset,t?gt.query.getNodeDepth(t)+1:0),r&&(a=r.previousSibling)}this.html.insertNode(t,{afterNode:o||this.format.isBlock(a)?null:a,skipCharCount:!0}),!o&&a&>.check.isZeroWidth(a)&>.utils.removeItem(a)}if(o){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}if(s||this.history.push(!1),!i){this.selection.setRange(t,0,t,0);const e=this.get(t);e?this.select(e.target,e.pluginName):r&&(r=gt.query.getEdgeChildNodes(r,null).sc||r,this.selection.setRange(r,0,r,0))}return this.editor.frameContext.has("documentType-use-header")&&this.editor.frameContext.get("documentType").reHeader(),r||t},get(t){if(!t)return null;let e,i="",s={},n=!1,o=null;if(this.is(t)){if(gt.utils.hasClass(t,"se-component")&&!gt.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!n)return null;e=n.target,i=n.pluginName,s=n.options,o=n.launcher}if(!e&&t.nodeName){this.__isFiles(t)&&(n=!0);const l=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!l)return null;e=l.target,i=l.pluginName,s=l.options,o=l.launcher}if(!e)return null;const l=yi.GetContainer(e),r=l.container||l.cover||e;return this.info={target:e,pluginName:i,options:s,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:gt.utils.hasClass(r,"se-input-component")}},select(t,e,{isInput:i=!1}={}){const s=this.get(t);if(!s||gt.check.isUneditable(gt.query.getParentElement(t,this.is.bind(this)))||gt.check.isUneditable(t))return!1;const n=s.launcher||this.plugins[e];if(!n)return;const o=Qt.get("__overInfo")!==Ci;if(!i&&o){if(this.editor.status._onMousedown)return;this.editor._preventBlur=!0,this.__selectionSelected=!0,this.isInline(s.container)&&this.selection.setRange(s.container,0,s.container,0),this.editor.blur(),vi.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.select&&(l=n.select(t));const r=gt.utils.hasClass(s.target,"se-component-line-break");(r||!l&&!gt.utils.hasClass(s.container,"se-inline-component"))&&this._setComponentLineBreaker(s.container||s.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=s,Qt.set("__dragInst",this);const a=Qt.get("__overInfo");if(vi.setTimeout((()=>{Qt.set("__overInfo",a===Ci&&void 0),a!==Ci&&this.__addGlobalEvent(),s.isFile||this.__addNotFileGlobalEvent()}),0),pt.debounce((()=>{gt.utils.addClass(s.container,"se-component-selected")}),0)(),!o||this.status.hasFocus||this.editor._preventFocus||(this.eventManager.__postFocusEvent(this.editor.frameContext,null),this.editor._preventFocus=!0),r||a===Ci){if(r||!gt.utils.hasClass(s.container,"se-input-component")){const t=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");gt.utils.addClass(t,"se-drag-handle-full"),this.ui._visibleControllers(!1,!1);const e=s.caption?s.target:s.cover||s.container||s.target,i=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.offset.getLocal(e);t.style.opacity=0,t.style.width=i+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",Qt.set("__dragHandler",t),Qt.set("__dragContainer",s.container),Qt.set("__dragCover",s.cover),t.style.display="block"}}else{if(!this.isInline(s.container))return;const t=s.container;let e=null;t.previousSibling&&!gt.check.isBreak(t.previousSibling)||(e=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!gt.check.isBreak(t.nextSibling)||(e=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.editor.status.onSelected=!0}},deselect(){vi.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__deselect(),this.ui.setControllerOnDisabledButtons(!1),!this.editor._preventFocus||this.status.hasFocus||this.__prevent||(this.eventManager.__postBlurEvent(this.editor.frameContext,null),this.editor._preventFocus=!1)},is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!gt.utils.hasClass(t,"se-component"))||!!this.editor._componentManager.find((e=>e(t))))},isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),gt.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.editor._componentManager.find((e=>e(t)))||!gt.utils.hasClass(t,"se-inline-component"))},isBasic(t){return this.is(t)&&!this.isInline(t)},copy(t){const e=gt.utils.clone(t,!0);gt.utils.removeClass(e,"se-component-selected"),gt.utils.removeClass(e.querySelectorAll(".se-figure-selected"),"se-figure-selected"),gt.utils.removeClass(e.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),gt.utils.removeClass(e.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus"),this.html.copy(e),gt.utils.flashClass(t,"se-copy")},__isFiles(t){const e=t.nodeName.toLowerCase();return this.editor._fileManager.regExp.test(e)&&(!this.editor._fileManager.tagAttrs[e]||this.editor._fileManager.tagAttrs[e]?.every((e=>t.hasAttribute(e))))},__deselect(){if(this.editor._preventBlur=!1,Qt.set("__overInfo",null),this._removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;pt.debounce((()=>{gt.utils.removeClass(t,"se-component-selected"),gt.utils.removeClass(e,"se-figure-over-selected")}),0)()}const{frameContext:t}=this.editor;t.get("lineBreaker_t").style.display=t.get("lineBreaker_b").style.display="none",this.currentPlugin&&"function"==typeof this.currentPlugin.deselect&&this.currentPlugin.deselect(this.currentTarget),this.isSelected=!1,this.currentPlugin=null,this.currentTarget=null,this.currentPluginName="",this.currentInfo=null,this.__removeGlobalEvent(),this.ui.__offControllers()},_setComponentLineBreaker(t){const e=Qt.get("__overInfo")===Ci;this.eventManager._lineBreakComp=null;const i=this.get(t);if(!i)return;const s=this.editor.frameContext,n=i.container,o=gt.utils.hasClass(n,"se-flex-component"),l=s.get("lineBreaker_t"),r=s.get("lineBreaker_b"),a=l.style,h=r.style,c=n.offsetWidth<t.offsetWidth?n:t,d="block"===this.editor._figureContainer?.style.display?this.editor._figureContainer:c,u=gt.check.isListCell(n.parentNode);let p,g;const m=this.options.get("_rtl"),f=m?["right","left"]:["left","right"],{top:_,left:b,right:y,scrollX:v,scrollY:C}=this.offset.getLocal(c),w=m?y:b;if(u?n.previousSibling:this.format.isLine(n.previousElementSibling))a.display="none";else{const t=vi.getComputedStyle(l),i=mt.get(t.height,1),s=mt.get(t.width,1);this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2,a.top=p-C-i/2+"px",a[f[0]]=(o?w-s/2:w+g)+"px",a[f[1]]="",l.setAttribute("data-offset",C+","+v),e?gt.utils.removeClass(l,"se-on-selected"):gt.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}if(u?n.nextSibling:this.format.isLine(n.nextElementSibling))h.display="none";else{const t=vi.getComputedStyle(r),i=mt.get(t.height,1),s=mt.get(t.width,1);p||(this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-C-i/2+"px",h[f[0]]=w+d.offsetWidth-(o?0:g)-(o?s/2:s)+"px",h[f[1]]="",r.setAttribute("data-offset",C+","+f[0]+","+v),e?gt.utils.removeClass(r,"se-on-selected"):gt.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}},__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_copy=this.eventManager.addGlobalEvent("copy",this.__globalEvents.copy),this._bindClose_cut=this.eventManager.addGlobalEvent("cut",this.__globalEvents.cut),this._bindClose_keydown=this.eventManager.addGlobalEvent("keydown",this.__globalEvents.keydown)},__removeGlobalEvent(){this.__removeNotFileGlobalEvent(),this._bindClose_copy&&(this._bindClose_copy=this.eventManager.removeGlobalEvent(this._bindClose_copy)),this._bindClose_cut&&(this._bindClose_cut=this.eventManager.removeGlobalEvent(this._bindClose_cut)),this._bindClose_keydown&&(this._bindClose_keydown=this.eventManager.removeGlobalEvent(this._bindClose_keydown))},__addNotFileGlobalEvent(){this.__removeNotFileGlobalEvent(),wi?this._bindClose_touchstart=this.eventManager.addGlobalEvent("touchstart",this.__globalEvents.mousedown,!0):this._bindClose_mousedown=this.eventManager.addGlobalEvent("mousedown",this.__globalEvents.mousedown,!0)},__removeNotFileGlobalEvent(){this._bindClose_mousedown&&(this._bindClose_mousedown=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)),this._bindClose_touchstart&&(this._bindClose_touchstart=this.eventManager.removeGlobalEvent(this._bindClose_touchstart))},_removeDragEvent(){this.carrierWrapper.querySelector(".se-drag-cursor").style.left="-10000px",Qt.get("__dragHandler")&&(Qt.get("__dragHandler").style.display="none"),gt.utils.removeClass([Qt.get("__dragHandler"),Qt.get("__dragContainer")],"se-dragging"),gt.utils.removeClass([Qt.get("__dragCover"),Qt.get("__dragContainer")],"se-drag-over"),Qt.set("__figureInst",null),Qt.set("__dragInst",null),Qt.set("__dragHandler",null),Qt.set("__dragContainer",null),Qt.set("__dragCover",null),Qt.set("__dragMove",null),Qt.set("__overInfo",null)},constructor:Ei};const Oi=Ei;function Ri(t){Jt.call(this,t),this._listCamel=this.options.get("__listCommonStyle"),this._listKebab=pt.camelToKebabCase(this.options.get("__listCommonStyle")),this._formatLineCheck=this.options.get("formatLine").reg,this._formatBrLineCheck=this.options.get("formatBrLine").reg,this._formatBlockCheck=this.options.get("formatBlock").reg,this._formatClosureBlockCheck=this.options.get("formatClosureBlock").reg,this._formatClosureBrLineCheck=this.options.get("formatClosureBrLine").reg,this._textStyleTagsCheck=new RegExp("^("+this.options.get("textStyleTags")+")$","i"),this._brLineBreak=null,this.__resetBrLineBreak(this.options.get("defaultLineBreakFormat"))}function zi(t){const e=t.parentNode;let i,s,n,o,l,r=e.parentNode,a=e;for(;gt.check.isListCell(r);){for(o=gt.query.getPositionIndex(t),i=r.nextElementSibling,s=r.parentNode,n=a;n;){if(a=a.nextSibling,gt.check.isList(n)){for(l=n.childNodes;l[o];)s.insertBefore(l[o],i);0===l.length&>.utils.removeItem(n)}else s.appendChild(n);n=a}r=s.parentNode}return 0===e.children.length&>.utils.removeItem(e),s}function $i(t,e,i){const s=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],gt.check.isListCell(n)?(e<0||n.previousElementSibling)&&s.push(n):(o=/\d+/.test(n.style[i])?mt.get(n.style[i],0):0,o+=e,gt.utils.setStyle(n,i,o<=0?"":o+"px"));return s}function Fi(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const i=t.childNodes;for(;i[0];)e.insertBefore(i[0],t);e.removeChild(t)}Ri.prototype={setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this._lineWork(),i=e.lines,s=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===s||this.component.is(e)||(r=t.cloneNode(!1),gt.utils.copyFormatAttributes(r,e),r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e)),0===a&&(o=r||e),a===h-1&&(l=r||e),r=null;this.selection.setRange(gt.query.getNodeFromPath(e.firstPath,o),e.startOffset,gt.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.history.push(!1),this.editor.frameContext.has("documentType-use-header")&&this.editor.frameContext.get("documentType").reHeader()},getLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBlock(t))return t.firstElementChild;if(this.isLine(t)&&e(t))return t;t=t.parentNode}return null},setBrLine(t){if(!this.isBrLine(t))throw new Error('[SUNEDITOR.format.setBrLine.fail] The "element" must satisfy "format.isBrLine()".');const e=this._lineWork().lines,i=e.length-1;let s=e[i].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,h,c,d=i,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(c=this.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=gt.query.getParentElement(o,(t=>t.parentNode===s)),(s!==o.parentNode||c)&&(this.isLine(s)?(s.parentNode.insertBefore(n,s.nextSibling),s=s.parentNode):(s.insertBefore(n,r?r.nextSibling:null),s=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&>.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,gt.utils.removeItem(a)),n=t.cloneNode(!1),u=!0),h=n.innerHTML,n.innerHTML=(u||!l||!h||/<br>$/i.test(l)?l:l+"<BR>")+h,0===d){s.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&>.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,gt.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&>.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,gt.utils.removeItem(n))}c||gt.utils.removeItem(o),l&&(u=!1)}this.selection.setRange(o,0,o,0),this.history.push(!1)},getBrLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBrLine(t)&&e(t))return t;t=t.parentNode}return null},addLine(t,e){if(!t||!t.parentNode)return null;const i=this.getLine(this.selection.getNode(),null);let s=null;if(this.isBrLine(t)||!this.isBrLine(i||t.parentNode)||this.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isLineOnly(i)?i.nodeName:this.options.get("defaultLine");s=gt.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(i))&>.utils.copyTagAttributes(s,e||i,["id"])}else s=gt.utils.createElement("BR");return gt.check.isTableCell(t)?t.insertBefore(s,t.nextElementSibling):t.parentNode.insertBefore(s,t.nextElementSibling),s},getBlock(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBlock(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&e(t))return t;t=t.parentNode}return null},applyBlock(t){this.selection.getRangeAndAddLine(this.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,i,s,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],gt.check.isListCell(t))if(i=t.lastElementChild,i&>.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=i.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(gt.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}s=i.firstElementChild,o=e.indexOf(s),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const i=e[e.length-1];let s,n,o;s=this.isBlock(i)||this.isLine(i)?i:this.getBlock(i,null)||this.getLine(i,null),gt.check.isTableCell(s)?(n=null,o=s):(n=s.nextSibling,o=s.parentNode);const l=t.cloneNode(!1);let r=gt.query.getNodeDepth(s),a=null;const h=[],c=(t,e,i)=>{let s=null;if(t!==e&&!gt.check.isTableElements(e)){if(e&>.query.getNodeDepth(t)===gt.query.getNodeDepth(e))return i;s=this.nodeTransform.removeAllParents(e,null,t)}return s?s.ec:i};for(let t,i,s,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],i=t.parentNode,i&&!l.contains(i))if(s=gt.query.getNodeDepth(t),gt.check.isList(i)){if(null===a&&(p?(a=p,g=!0,p=null):a=i.cloneNode(!1)),h.push(t),u=e[m+1],m===f-1||u?.parentNode!==i){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=i.parentNode;for(;gt.check.isList(m);)e=gt.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(i,{selectedFormats:h,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=s?(r=s,o=f.cc,n=c(o,i,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=c(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)a.appendChild(f.removeArray[t]);g||l.appendChild(a),p&&f.removeArray[f.removeArray.length-1].appendChild(p),a=null,g=!1}}else r>=s&&(r=s,o=i,n=t.nextSibling),l.appendChild(t),o!==i&&(d=c(o,i),void 0!==d&&(n=d));if(this.editor.effectNode=null,this.nodeTransform.mergeSameTags(l,null,!1),this.nodeTransform.mergeNestedTags(l,(t=>gt.check.isList(t))),n&>.query.getNodeDepth(n)>0&&(gt.check.isList(n.parentNode)||gt.check.isList(n.parentNode.parentNode))){const t=gt.query.getParentElement(n,(t=>this.isBlock(t)&&!gt.check.isList(t))),e=this.nodeTransform.split(n,null,t?gt.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=gt.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.history.push(!1)},removeBlock(t,{selectedFormats:e,newBlockElement:i,shouldDelete:s,skipHistory:n}={}){const o=this.selection.getRange();let l=o.startOffset,r=o.endOffset,a=gt.query.getListChildNodes(t,(e=>e.parentNode===t)),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=gt.check.isList(i);let m=!1,f=!1,_=!1;const b=(e,i,s,n)=>{if(gt.check.isZeroWidth(i)&&(i.innerHTML=ut.zeroWidthSpace,l=r=1),3===i.nodeType)return e.insertBefore(i,s),i;const o=(_?i:n).childNodes;let a=i.cloneNode(!1),h=null,c=null;for(;o[0];)c=o[0],!this._notTextNode(c)||gt.check.isBreak(c)||gt.check.isListCell(a)?a.appendChild(c):(a.childNodes.length>0&&(h||(h=a),e.insertBefore(a,s),a=i.cloneNode(!1)),e.insertBefore(c,s),h||(h=c));if(a.childNodes.length>0){if(gt.check.isListCell(e)&>.check.isListCell(a)&>.check.isList(s))if(g){for(h=s;s;)a.appendChild(s),s=s.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,i=this._removeNestedList(n,!1);if(t!==i||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=i,f=!0}}else e.insertBefore(a,s);h||(h=a)}return h};for(let n,o,l,r=0,y=a.length;r<y;r++)if(n=a[r],3!==n.nodeType||!gt.check.isList(u))if(_=!1,s&&0===r&&(c=e&&e.length!==y&&e[0]!==n?u:t.previousSibling),e&&(o=e.indexOf(n)),e&&-1===o)u||(u=t.cloneNode(!1)),u.appendChild(n);else{if(e&&(l=e[o+1]),u&&u.children.length>0&&(h.insertBefore(u,t),u=null),!g&>.check.isListCell(n))if(l&>.query.getNodeDepth(n)!==gt.query.getNodeDepth(l)&&(gt.check.isListCell(h)||gt.utils.arrayFind(n.children,gt.check.isList))){const e=n.nextElementSibling,i=this._removeNestedList(n,!1);t===i&&e===n.nextElementSibling||(t=i,f=!0)}else{const e=n;n=gt.utils.createElement(s?e.nodeName:gt.check.isList(t.parentNode)||gt.check.isListCell(t.parentNode)?"LI":gt.check.isTableCell(t.parentNode)?"DIV":this.options.get("defaultLine"));const i=gt.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!gt.check.isList(o[0])||i);)n.appendChild(o[0]);gt.utils.copyFormatAttributes(n,e),_=!0}else n=n.cloneNode(!1);if(!f&&(s?(p.push(n),gt.utils.removeItem(a[r])):(i?(m||(h.insertBefore(i,t),m=!0),n=b(i,n,null,a[r])):n=b(h,n,t,a[r]),f||(e?(d=n,c||(c=n)):c||(c=d=n))),f)){f=_=!1,a=gt.query.getListChildNodes(t,(e=>e.parentNode===t)),u=t.cloneNode(!1),h=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let v=t.nextSibling;u?.children.length>0&&y.insertBefore(u,v),i?c=i.previousSibling:c||(c=t.previousSibling),v=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?gt.utils.removeItem(t):this.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(s)C={cc:y,sc:c,so:l,ec:v,eo:r,removeArray:p};else{c||(c=d),d||(d=c);const t=gt.query.getEdgeChildNodes(c,d.parentNode?c:d);C={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}}if(this.editor.effectNode=null,n)return C;!s&&C&&(e?this.selection.setRange(C.sc,l,C.ec,r):this.selection.setRange(C.sc,0,C.sc,0)),this.history.push(!1)},applyList(t,e,i){const s=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.selection.getRange(),l=e||this.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.selection.getRangeAndAddLine(o,null),l=this.getLinesAndComponents(!1),0===l.length)return}gt.query.sortNodeByDepth(l,!0);const r=l[0],a=l[l.length-1];let h=!gt.check.isListCell(r)&&!this.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!gt.check.isListCell(a)&&!this.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&>.check.isZeroWidth(o.startContainer)&&0===o.startOffset&&1===o.endOffset?o.endOffset:o.startOffset,ec:o.endContainer,eo:o.endOffset};let p=null,g=!0;for(let t=0,e=l.length;t<e;t++)if(!gt.check.isList(this.getBlock(l[t],(e=>this.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||h&&r.tagName===h.tagName&&s===h.tagName.toUpperCase()||c&&a.tagName===c.tagName&&s===c.tagName.toUpperCase()){const t=h?h.parentNode:h,e=c?c.parentNode:c;h=t&&!gt.check.isWysiwygFrame(t)&&t.nodeName===s?t:h,c=e&&!gt.check.isWysiwygFrame(e)&&e.nodeName===s?e:c;const i=h?.tagName===s,o=c?.tagName===s;let r=i?h:gt.utils.createElement(s,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!this.component.is(t)&&!gt.check.isList(t);for(let t,e,o,h,c,p,g,m,f,_=0,b=l.length;_<b;_++)if(e=l[_],0!==e.childNodes.length||this._isIgnoreNodeChange(e)){if(h=l[_+1],c=e.parentNode,p=h?h.parentNode:null,o=gt.check.isListCell(e),f=this.isBlock(c)?c:null,g=o&&!gt.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!gt.check.isWysiwygFrame(c)?!h||gt.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=gt.utils.createElement("LI"),gt.utils.copyFormatAttributes(t,e),this.component.is(e)){const i=/^HR$/i.test(e.nodeName);i||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,i&&(t.innerHTML+="<br>")}else{const i=e.childNodes;for(;i[0];)t.appendChild(i[0])}r.appendChild(t),h&&g===p&&!this.isBlock(m)||(a||(a=r),i&&h&&g===p||h&>.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),gt.utils.removeItem(e),i&&null===d&&(d=r.children.length-1),h&&(this.getBlock(p,u)!==this.getBlock(c,u)||gt.check.isList(p)&>.check.isList(c)&>.query.getNodeDepth(p)!==gt.query.getNodeDepth(c))&&(r=gt.utils.createElement(s,{style:"list-style-type: "+n})),0===f?.children.length&>.utils.removeItem(f)}else gt.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,gt.utils.removeItem(c))}else{if(i)for(let t=0,e=l.length;t<e;t++)for(let i=t-1;i>=0;i--)if(l[i].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.getBlock(r),e=t?.tagName===s;let o,a;const h=t=>!this.component.is(t);e||(a=gt.utils.createElement(s,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.getBlock(l[c],h),r&>.check.isList(r)&&(t?t!==r?(i&>.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=gt.utils.createElement(s,{style:"list-style-type: "+n})),t=r,o={r:t,f:[gt.query.getParentElement(l[c],"LI")]}):o.f.push(gt.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[gt.query.getParentElement(l[c],"LI")]}),c===d-1&&(i&>.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.editor.effectNode=null,g&&d&&p||u},removeList(t,e){let i={},s=!1,n=!1,o=null,l=null;const r=t=>!this.component.is(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.getBlock(t[u],r),d=gt.check.isList(h),!a&&d)a=h,i={r:a,f:[gt.query.getParentElement(t[u],"LI")]},0===u&&(s=!0);else if(a&&d)if(a!==h){const r=this.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});h=t[u].parentNode,s&&(o=r.sc,s=!1),c&&(l=r.ec),d?(a=h,i={r:a,f:[gt.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else i.f.push(gt.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&>.check.isList(a)){const t=this.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),s&&(o=t.sc||l)}}return{sc:o,ec:l}},indent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=$i(this.getLines(null),this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this._applyNestedList(o,!1),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},outdent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=$i(this.getLines(null),-1*this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this._applyNestedList(o,!0),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},applyInlineElement(t,{stylesToModify:e,nodesToRemove:i,strictRemove:s}={}){if(gt.query.getParentElement(this.selection.getNode(),gt.check.isNonEditable))return;this.selection._resetRangeToTextNode();let n=this.selection.getRangeAndAddLine(this.selection.getRange(),null);e=e?.length>0?e:null,i=i?.length>0?i:null;const o=!t,l=o&&!i&&!e;let r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset;if(l&&n.collapsed&&this.isLine(r.parentNode)&&this.isLine(h.parentNode)||r===h&&1===r.nodeType&>.check.isNonEditable(r)){const t=r.parentNode;return void(!gt.check.isListCell(t)||pt.getValues(t.style).some((t=>this._listKebab.includes(t))))}if(n.collapsed&&!l&&1===r.nodeType&&!gt.check.isBreak(r)&&!this.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?gt.check.isBreak(e)?e:e.nextSibling:null);const i=gt.utils.createTextNode(ut.zeroWidthSpace);r.insertBefore(i,t),this.selection.setRange(i,1,i,1),n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=gt.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===h&&!i&&t){let e=r,i=0;const s=[],n=t.style;for(let t=0,e=n.length;t<e;t++)s.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)s.push("."+a[t]);if(s.length>0){for(;!this.isLine(e)&&!gt.check.isWysiwygFrame(e);){for(let t=0;t<s.length;t++)if(1===e.nodeType){const r=s[t],a=!!/^\./.test(r)&&new d("\\s*"+r.replace(/^\./,"")+"(\\s+|$)","ig"),h=e.style,c=e.className,u=o?!!h[r]:!!h[r]&&!!n[r]&&h[r]===n[r],p=!1!==a&&(o?!!c.match(a):!!c.match(a)&&!!l.match(a));(u||p)&&i++}e=e.parentNode}if(i>=s.length)return}}let p,g,m={},f={},_="",b="";if(e){for(let t,i=0,s=e.length;i<s;i++)t=e[i],/^\./.test(t)?b+=(b?"|":"\\s*(?:")+t.replace(/^\./,""):_+=(_?"|":"(?:;|^|\\s)(?:")+t;_&&(_+=")\\s*:[^;]*\\s*(?:;|$)",_=new d(_,"ig")),b&&(b+=")(?=\\s+|$)",b=new d(b,"ig"))}if(i){g="^(?:"+i[0];for(let t=1;t<i.length;t++)g+="|"+i[t];g+=")$",g=new d(g,"i")}const y={v:!1},v=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||gt.check.isBreak(e))return e;if(l)return null;const i=!g&&o||g?.test(e.nodeName);if(i&&!s)return y.v=!0,null;const n=e.style.cssText;let r="";_&&n.length>0&&(r=n.replace(_,"").trim(),r!==n&&(y.v=!0));const a=e.className;let h="";return b&&a.length>0&&(h=a.replace(b,"").trim(),h!==a&&(y.v=!0)),(!o||!b&&a||!_&&n||r||h||!i)&&(r||h||e.nodeName!==u||Boolean(_)!==Boolean(n)||Boolean(b)!==Boolean(a))?(_&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),b&&a.length>0&&(e.className=h.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!i?e:(y.v=!0,null)):(y.v=!0,null)},C=this.getLines(null);n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.getLine(r,null)||(r=gt.query.getEdgeChild(C[0],(function(t){return 3===t.nodeType}),!1),a=0),this.getLine(h,null)||(h=gt.query.getEdgeChild(C[C.length-1],(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const w=this.getLine(r,null)===this.getLine(h,null),x=C.length-(w?0:1);p=t.cloneNode(!1);const k=l||o&&function(t,e){for(let i=0,s=e.length;i<s;i++)if(t._isNonSplitNode(e[i]))return!0;return!1}(this,i),E=o||this._sn_isSizeNode(p),S=this._sn_getMaintainedNode.bind(this,k,E),T=this._sn_isMaintainedNode.bind(this,k,E);if(w){this._sn_resetCommonListCell(C[0],e)&&(n=this.selection.setRange(r,a,h,c));const t=this._setNode_oneLine(C[0],p,v,r,a,h,c,l,o,n.collapsed,y,S,T);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&>.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this._sn_setCommonListStyle(t.ancestor,null)}else{let i=!1;x>0&&this._sn_resetCommonListCell(C[x],e)&&(i=!0),this._sn_resetCommonListCell(C[0],e)&&(i=!0),i&&this.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this._setNode_endLine(C[x],p,v,h,c,l,o,y,S,T));for(let i,s=x-1;s>0;s--)this._sn_resetCommonListCell(C[s],e),p=t.cloneNode(!1),i=this._setNode_middleLine(C[s],p,v,l,o,y,f.container),i.endContainer&&i.ancestor.contains(i.endContainer)&&(f.ancestor=null,f.container=i.endContainer),this._sn_setCommonListStyle(i.ancestor,null);p=t.cloneNode(!1),m=this._setNode_startLine(C[0],p,v,r,a,l,o,y,S,T,f.container),m.endContainer&&(f.ancestor=null,f.container=m.endContainer),x<=0?f=m:f.container||(f.ancestor=null,f.container=m.container,f.offset=m.container.textContent.length),this._sn_setCommonListStyle(m.ancestor,null),this._sn_setCommonListStyle(f.ancestor||this.getLine(f.container),null)}return this.ui._offCurrentController(),this.selection.setRange(m.container,m.offset,f.container,f.offset),this.history.push(!1),p},removeInlineElement(){this.applyInlineElement(null,{stylesToModify:null,nodesToRemove:null,strictRemove:null})},isEdgeLine(t,e,i){if(!gt.check.isEdgePoint(t,e,i))return!1;let s=!1;const n="front"===i?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!gt.check.isWysiwygFrame(t);){if(t[n]&&(!gt.check.isBreak(t[n])||t[n][n]))return!1;s=!0,t=t.parentNode}return s},isTextStyleNode(t){return"string"==typeof t?this._textStyleTagsCheck.test(t):t&&1===t.nodeType&&this._textStyleTagsCheck.test(t.nodeName)},isLine(t){return!this.isBlock(t)&&("string"==typeof t?this._formatLineCheck.test(t):t&&1===t.nodeType&&(this._formatLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this._nonFormat(t))},isLineOnly(t){return this.isLine(t)&&(this._brLineBreak||!this.isBrLine(t))},isBrLine(t){return this._brLineBreak&&this.isLine(t)||("string"==typeof t?this._formatBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatBrLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__br_line_.+"))&&!this._nonFormat(t))},isBlock(t){return"string"==typeof t?this._formatBlockCheck.test(t):t&&1===t.nodeType&&(this._formatBlockCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__block_.+"))&&!this._nonFormat(t)},isClosureBlock(t){return"string"==typeof t?this._formatClosureBlockCheck.test(t):t&&1===t.nodeType&&(this._formatClosureBlockCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this._nonFormat(t)},isClosureBrLine(t){return"string"==typeof t?this._formatClosureBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatClosureBrLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this._nonFormat(t)},getLines(t){if(!this.selection._resetRangeToTextNode())return[];let e=this.selection.getRange();if(gt.check.isWysiwygFrame(e.startContainer)){const t=this.editor.frameContext.get("wysiwyg").children;if(0===t.length)return[];this.selection.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),e=this.selection.getRange()}const i=e.startContainer,s=e.endContainer,n=e.commonAncestorContainer,o=gt.query.getListChildren(n,(e=>t?t(e):this.isLine(e)));if(gt.check.isWysiwygFrame(n)||this.isBlock(n)||o.unshift(this.getLine(n,null)),i===s||1===o.length)return o;const l=this.getLine(i,null),r=this.getLine(s,null);let a=null,h=null;const c=function(t){return!gt.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);gt.check.isTableElements(d)&>.check.isListCell(d.parentNode)&&(d=d.parentNode),gt.check.isTableElements(u)&>.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,i=o.length;e<i;e++)if(t=o[e],l===t||!p&&t===d)a=e;else if(r===t||!p&&t===u){h=e;break}return null===a&&(a=0),null===h&&(h=o.length-1),o.slice(a,h+1)},getLinesAndComponents(t){const e=this.selection.getRange().commonAncestorContainer,i=gt.query.getParentElement(e,this.component.is.bind(this.component)),s=gt.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=gt.query.getParentElement(t,this.component.is.bind(this.component));return this.isLine(t)&&(!e||e===i)||this.component.is(t)&&!this.getLine(t)}));if(t)for(let t=0,e=s.length;t<e;t++)for(let i=t-1;i>=0;i--)if(s[i].contains(s[t])){s.splice(t,1),t--,e--;break}return s},_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.component.is(t)||/FIGURE/i.test(t.nodeName))},_nonFormat(t){return gt.check.isExcludeFormat(t)||this.component.is(t)||gt.check.isWysiwygFrame(t)},_isNonSplitNode(t){if(!t)return!1;const e=/^(a|label|code|summary)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&e.test(t.nodeName)},_notTextNode(t){if(!t)return!1;const e=/^(br|input|select|canvas|img|iframe|audio|video)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&(this.component.is(t)||e.test(t.nodeName))},_isIgnoreNodeChange(t){return t&&1===t.nodeType&&(gt.check.isNonEditable(t)||!this.isTextStyleNode(t)||this.component.is(t))},_lineWork(){let t=this.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const i=t.startOffset,s=t.endOffset;let n=e[0],o=e[e.length-1];const l=gt.query.getNodePath(t.startContainer,n,null),r=gt.query.getNodePath(t.endContainer,o,null),a=this.removeList(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.selection.setRange(gt.query.getNodeFromPath(l,n),i,gt.query.getNodeFromPath(r,o),s),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:i,endOffset:s}},_attachNested(t,e,i,s,n){let o=!1;if(e.tagName===i?.tagName){const t=e.children;for(;t[0];)i.appendChild(t[0]);e=i,o=!0}if(e.tagName===s?.tagName){const t=s.children;for(;t[0];)e.appendChild(t[0]);const i=s.nextElementSibling;s.parentNode.removeChild(s),s=i}if(!o){gt.check.isListCell(i)&&(t=i,s=null),t.insertBefore(e,s),n.s||(n.s=gt.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?gt.query.getNodePath(n.sl,t):null;n.e=gt.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.nodeTransform.mergeNestedTags(t),o&&(n.sl=gt.query.getNodeFromPath(o,t))}return e},_detachNested(t){const e=t[0],i=t[t.length-1],s=i.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,i=t.length;e<i;e++)l.insertBefore(t[e],o);if(s&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=gt.query.getPositionIndex(s);for(;e[o];)t.appendChild(e[o]);i.appendChild(t)}0===n.children.length&>.utils.removeItem(n),this.nodeTransform.mergeSameTags(l);const r=gt.query.getEdgeChildNodes(e,i);return{cc:e.parentNode,sc:r.sc,ec:r.ec}},_applyNestedList(t,e){const i=(t=t||this.getLines().filter((function(t){return gt.check.isListCell(t)}))).length;if(0===i||!e&&!gt.check.isListCell(t[0].previousElementSibling)&&!gt.check.isListCell(t[i-1].nextElementSibling))return{sc:t[0],so:0,ec:t[i-1],eo:1};let s=t[0].parentNode,n=t[i-1],o=null;if(e){if(s!==n.parentNode&>.check.isList(n.parentNode.parentNode)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.applyList(s.nodeName+":"+s.style.listStyleType,t,!0)}else{let e=gt.utils.createElement(s.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:s,el:s};for(let n,o=0,h=i;o<h;o++)n=t[o],n.parentNode!==s&&(this._attachNested(s,e,l,r,a),s=n.parentNode,e=gt.utils.createElement(s.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);this._attachNested(s,e,l,r,a);const h=gt.query.getNodeFromPath(a.s,a.sl),c=gt.query.getNodeFromPath(a.e,a.el);o={sc:h,so:0,ec:c,eo:c.textContent.length}}return o},_removeNestedList(t,e){const i=zi(t);let s,n,o;if(i){s=i.cloneNode(!1),n=i.childNodes;const e=gt.query.getPositionIndex(t);for(;n[e];)s.appendChild(n[e])}else s=t;if(e)o=gt.query.getListChildren(s,(t=>gt.check.isListCell(t)&&!t.previousElementSibling));else{const e=gt.query.getNodeDepth(t)+2;o=gt.query.getListChildren(t,(t=>gt.check.isListCell(t)&&!t.previousElementSibling&>.query.getNodeDepth(t)===e))}for(let t=0,e=o.length;t<e;t++)zi(o[t]);return i&&(i.parentNode.insertBefore(s,i.nextSibling),0===n?.length&>.utils.removeItem(i)),s===t?s.parentNode:s},_setNode_oneLine(t,e,i,s,n,o,l,r,a,h,c,d,u){let p=s.parentNode;for(;!(p.nextSibling||p.previousSibling||this.isLine(p.parentNode)||gt.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&p===o.parentNode&&p.nodeName===e.nodeName&>.check.isZeroWidth(s.textContent.slice(0,n))&>.check.isZeroWidth(o.textContent.slice(l))){const i=p.childNodes;let r=!1;for(let t,e,n,l,a=0,h=i.length;a<h;a++)if(t=i[a],l=!gt.check.isZeroWidth(t),t!==s)if(t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else n=!0;else e=!0;if(r)return gt.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l}}c.v=!1;const g=this,m=t,f=[e],_=t.cloneNode(!1),b=s===o;let y,v,C,w,x,k=s,E=n,S=o,T=l,H=!1,L=!1;const M=RegExp;function N(t){const e=new M("(?:;|^|\\s)(?:"+w+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let i=!1;return e&&t.style.cssText.length>0&&(i=e.test(t.style.cssText)),!i}if(function t(s,n){const o=s.childNodes;for(let s,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let c,p=n;if(!H&&a===k){let t=_;x=d(a);let o="",l="";if(3===k.nodeType){const t=k;o=t.substringData(0,E),l=t.substringData(E,b&&T>=E?T-E:t.data.length-E)}const r=gt.utils.createTextNode(o),h=gt.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}x=x.cloneNode(!1)}gt.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),v=a,y=[],w="";v!==t&&v!==m&&null!==v;)s=u(v)?null:i(v),s&&1===v.nodeType&&N(v)&&(y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;const p=y.pop()||h;for(C=v=p;y.length>0;)v=y.pop(),C.appendChild(v),C=v;if(e.appendChild(p),t.appendChild(e),x&&!d(S)&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),k=h,E=0,H=!0,v!==h&&v.appendChild(k),!b)continue}if(L||a!==S){if(H){if(1===a.nodeType&&!gt.check.isBreak(a)){g._isIgnoreNodeChange(a)?(_.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),_.appendChild(e),f.push(e))):t(a,a);continue}v=a,y=[],w="";const o=[];for(;null!==v.parentNode&&v!==m&&v!==e;)s=L?v.cloneNode(!1):i(v),1===v.nodeType&&!gt.check.isBreak(a)&&s&&N(v)&&(u(v)?x||o.push(s):y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;y=y.concat(o);const l=y.pop()||a;for(C=v=l;y.length>0;)v=y.pop(),C.appendChild(v),C=v;if(!u(e.parentNode)||u(l)||gt.check.isZeroWidth(e)||(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),L||x||!u(l))l===a?n=L?_:e:L?(_.appendChild(l),n=v):(e.appendChild(l),n=v);else{e=e.cloneNode(!1);const t=l.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);l.appendChild(e),_.appendChild(l),f.push(e),n=e.children.length>0?v:e}if(x&&3===a.nodeType)if(d(a)){const t=gt.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===_));x.appendChild(t),e=t.cloneNode(!1),f.push(e),_.appendChild(e)}else x=null}c=a.cloneNode(!1),n.appendChild(c),1!==a.nodeType||gt.check.isBreak(a)||(p=c),t(a,p)}else{x=d(a);let t="",n="";if(3===S.nodeType){const e=S;t=e.substringData(T,e.length-T),n=b?"":e.substringData(0,T)}const o=gt.utils.createTextNode(t),l=gt.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),!gt.check.isZeroWidth(o)){v=a,w="",y=[];const t=[];for(;v!==_&&v!==m&&null!==v;)1===v.nodeType&&N(v)&&(u(v)?t.push(v.cloneNode(!1)):y.push(v.cloneNode(!1)),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;for(y=y.concat(t),c=C=v=y.pop()||o;y.length>0;)v=y.pop(),C.appendChild(v),C=v;_.appendChild(c),v.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(v=a,y=[],w="";v!==_&&v!==m&&null!==v;)s=u(v)?null:i(v),s&&1===v.nodeType&&N(v)&&(y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;const p=y.pop()||l;for(C=v=p;y.length>0;)v=y.pop(),C.appendChild(v),C=v;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),_.appendChild(x),f.push(e),x=null):e.appendChild(p),S=l,T=l.data.length,L=!0,!r&&h&&(e=l,l.textContent=ut.zeroWidthSpace),v!==l&&v.appendChild(S)}}}(t,_),a&&!r&&!c.v)return{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l};if(r=r&&a)for(let t=0;t<f.length;t++){const e=f[t];let i,s,n;if(h)i=gt.utils.createTextNode(ut.zeroWidthSpace),_.replaceChild(i,e);else{const t=e.childNodes;for(s=t[0];t[0];)n=t[0],_.insertBefore(n,e);gt.utils.removeItem(e)}0===t&&(h?k=S=i:(k=s,S=n))}else{if(a)for(let t=0;t<f.length;t++)Fi(f[t]);h&&(k=S=e)}this.nodeTransform.removeEmptyNode(_,e,!1),h&&(E=k.textContent.length,T=S.textContent.length);const A=r||0===S.textContent.length;gt.check.isBreak(S)||0!==S.textContent.length||(gt.utils.removeItem(S),S=k),T=A?S.textContent.length:T;const B={s:0,e:0},I=gt.query.getNodePath(k,_,B),V=!S.parentNode;V&&(S=k);const O={s:0,e:0},R=gt.query.getNodePath(S,_,V||A?null:O);E+=B.s,T=h?E:V?k.textContent.length:A?T+B.s:T+O.s;const z=this.nodeTransform.mergeSameTags(_,[I,R],!0);return t.parentNode.replaceChild(_,t),k=gt.query.getNodeFromPath(I,_),S=gt.query.getNodeFromPath(R,_),{ancestor:_,startContainer:k,startOffset:E+z[0],endContainer:S,endOffset:T+z[1]}},_setNode_startLine(t,e,i,s,n,o,l,r,a,h,c){let d=s.parentNode;for(;!(d.nextSibling||d.previousSibling||this.isLine(d.parentNode)||gt.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&d.nodeName===e.nodeName&&!this.isLine(d)&&!d.nextSibling&>.check.isZeroWidth(s.textContent.slice(0,n))){let i=!1,o=s.previousSibling;for(;o;){if(!gt.check.isZeroWidth(o)){i=!1;break}o=o.previousSibling}if(i)return gt.utils.copyTagAttributes(d,e),{ancestor:t,container:s,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,_,b,y,v=s,C=n,w=!1;if(function t(s,n){const o=s.childNodes;for(let s,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(w&&!gt.check.isBreak(d)){if(1===d.nodeType){if(u._isIgnoreNodeChange(d)){if(e=e.cloneNode(!1),l=d.cloneNode(!0),m.appendChild(l),m.appendChild(e),g.push(e),c&&d.contains(c)){const t=gt.query.getNodePath(c,d);c=gt.query.getNodeFromPath(t,l)}}else t(d,d);continue}_=d,f=[];const o=[];for(;null!==_.parentNode&&_!==p&&_!==e;)s=i(_),1===_.nodeType&&s&&(h(_)?y||o.push(s):f.push(s)),_=_.parentNode;f=f.concat(o);const r=f.length>0,v=f.pop()||d;for(b=_=v;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(h(e.parentNode)&&!h(v)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&h(v)){e=e.cloneNode(!1);const t=v.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);v.appendChild(e),m.appendChild(v),n=h(_)?e:_,g.push(e)}else r?(e.appendChild(v),n=_):n=e;if(y&&3===d.nodeType)if(a(d)){const t=gt.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));y.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else y=null}if(w||d!==v)s=w?i(d):d.cloneNode(!1),s&&(n.appendChild(s),1!==d.nodeType||gt.check.isBreak(d)||(x=s)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===v.nodeType){const t=v;o=t.substringData(0,C),l=t.substringData(C,t.length-C)}const r=gt.utils.createTextNode(o),h=gt.utils.createTextNode(l);if(y){const e=a(n);if(e&&e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}y=y.cloneNode(!1)}gt.check.isZeroWidth(r)||n.appendChild(r);const c=a(n);for(c&&(y=c),y&&(t=y),_=n,f=[];_!==t&&null!==_;)s=i(_),1===_.nodeType&&s&&f.push(s),_=_.parentNode;const u=f.pop()||n;for(b=_=u;f.length>0;)_=f.pop(),b.appendChild(_),b=_;u!==n?(e.appendChild(u),n=_):n=e,gt.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),v=h,C=0,w=!0,n.appendChild(v)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n,endContainer:c};if(o=o&&l)for(let t=0;t<g.length;t++){const e=g[t],i=e.childNodes,s=i[0];for(;i[0];)m.insertBefore(i[0],e);gt.utils.removeItem(e),0===t&&(v=s)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Fi(g[t])}if(o||0!==m.childNodes.length){this.nodeTransform.removeEmptyNode(m,e,!1),gt.check.isZeroWidth(m.textContent)&&(v=m.firstChild,C=0);const i={s:0,e:0},s=gt.query.getNodePath(v,m,i);C+=i.s;const n=this.nodeTransform.mergeSameTags(m,[s],!0);t.parentNode.replaceChild(m,t),v=gt.query.getNodeFromPath(s,m),C+=n[0]}else t.childNodes?v=t.childNodes[0]:(v=gt.utils.createTextNode(ut.zeroWidthSpace),t.appendChild(v));return{ancestor:m,container:v,offset:C,endContainer:c}},_setNode_middleLine(t,e,i,s,n,o,l){if(!n){let i=null;l&&t.contains(l)&&(i=gt.query.getNodePath(l,t));const s=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=s.childNodes,h=0,c=a.length;for(let t;h<c&&(t=a[h],3!==t.nodeType);h++){if(t.nodeName!==n){if(!gt.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,gt.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=s.innerHTML,{ancestor:t,endContainer:i?gt.query.getNodeFromPath(i,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),h=[e];let c=!0;if(function t(s,n){const o=s.childNodes;for(let s,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(gt.check.isBreak(p)||!r._isIgnoreNodeChange(p))s=i(p),s&&(c=!1,n.appendChild(s),1===p.nodeType&&(g=s)),gt.check.isBreak(p)||t(p,g);else if(e.childNodes.length>0&&(a.appendChild(e),e=e.cloneNode(!1)),d=p.cloneNode(!0),a.appendChild(d),a.appendChild(e),h.push(e),n=e,l&&p.contains(l)){const t=gt.query.getNodePath(l,p);l=gt.query.getNodeFromPath(t,d)}}}(t,e),c||n&&!s&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),s&&n)for(let t=0;t<h.length;t++){const e=h[t],i=e.childNodes;for(;i[0];)a.insertBefore(i[0],e);gt.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Fi(h[t])}return this.nodeTransform.removeEmptyNode(a,e,!1),this.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}},_setNode_endLine(t,e,i,s,n,o,l,r,a,h){let c=s.parentNode;for(;!(c.nextSibling||c.previousSibling||this.isLine(c.parentNode)||gt.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&c.nodeName===e.nodeName&&!this.isLine(c)&&!c.previousSibling&>.check.isZeroWidth(s.textContent.slice(n))){let i=!1,o=s.nextSibling;for(;o;){if(!gt.check.isZeroWidth(o)){i=!1;break}o=o.nextSibling}if(i)return gt.utils.copyTagAttributes(c,e),{ancestor:t,container:s,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,_,b,y=s,v=n,C=!1;if(function t(s,n){const o=s.childNodes;for(let s,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let c=n;if(C&&!gt.check.isBreak(r)){if(1===r.nodeType){if(d._isIgnoreNodeChange(r)){e=e.cloneNode(!1);const t=r.cloneNode(!0);g.insertBefore(t,n),g.insertBefore(e,t),p.push(e)}else t(r,r);continue}f=r,m=[];const o=[];for(;null!==f.parentNode&&f!==u&&f!==e;)s=i(f),s&&1===f.nodeType&&(h(f)?b||o.push(s):m.push(s)),f=f.parentNode;m=m.concat(o);const l=m.length>0,c=m.pop()||r;for(_=f=c;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(h(e.parentNode)&&!h(c)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!b&&h(c)){e=e.cloneNode(!1);const t=c.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);c.appendChild(e),g.insertBefore(c,g.firstChild),p.push(e),n=e.children.length>0?f:e}else l?(e.insertBefore(c,e.firstChild),n=f):n=e;if(b&&3===r.nodeType)if(a(r)){const t=gt.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));b.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else b=null}if(C||r!==y)s=C?i(r):r.cloneNode(!1),s&&(n.insertBefore(s,n.firstChild),1!==r.nodeType||gt.check.isBreak(r)||(c=s)),t(r,c);else{b=a(r);let t="",o="";if(3===y.nodeType){const e=y;t=e.substringData(v,e.length-v),o=e.substringData(0,v)}const l=gt.utils.createTextNode(t),c=gt.utils.createTextNode(o);if(b){b=b.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,i=null;for(;e.parentNode!==g;){for(n=i=e.parentNode.cloneNode(!1);e.childNodes[0];)i.appendChild(e.childNodes[0]);e.appendChild(i),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}b=b.cloneNode(!1)}else h(e.parentNode)&&!b&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(gt.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)s=h(f)?null:i(f),s&&1===f.nodeType&&m.push(s),f=f.parentNode;const d=m.pop()||n;for(_=f=d;m.length>0;)f=m.pop(),_.appendChild(f),_=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,gt.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),b?(b.insertBefore(e,b.firstChild),g.insertBefore(b,g.firstChild),b=null):g.insertBefore(e,g.firstChild),y=c,v=c.data.length,C=!0,n.insertBefore(y,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n};if(o=o&&l)for(let t=0;t<p.length;t++){const e=p[t],i=e.childNodes;let s=null;for(;i[0];)s=i[0],g.insertBefore(s,e);gt.utils.removeItem(e),t===p.length-1&&(y=s,v=s.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Fi(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.nodeTransform.removeEmptyNode(g,e,!1),gt.check.isZeroWidth(g.textContent)?(y=g.firstChild,v=y.textContent.length):gt.check.isZeroWidth(y)&&(y=e,v=1);const i={s:0,e:0},s=gt.query.getNodePath(y,g,i);v+=i.s;const n=this.nodeTransform.mergeSameTags(g,[s],!0);t.parentNode.replaceChild(g,t),y=gt.query.getNodeFromPath(s,g),v+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=gt.utils.createTextNode(ut.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===v?y.childNodes.length:v}},_sn_isSizeNode(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.isTextStyleNode(t)&&!!t.style.fontSize},_sn_getMaintainedNode(t,e,i){return!i||t?null:gt.query.getParentElement(i,this._isNonSplitNode.bind(this))||(e?null:gt.query.getParentElement(i,this._sn_isSizeNode.bind(this)))},_sn_isMaintainedNode(t,e,i){if(!i||t||1!==i.nodeType)return!1;const s=this._isNonSplitNode(i);return gt.query.getParentElement(i,this._isNonSplitNode.bind(this))?s:s||!e&&this._sn_isSizeNode(i)},_sn_setCommonListStyle(t,e){if(!gt.check.isListCell(t))return;const i=gt.utils.arrayFilter((e||t).childNodes,(t=>!gt.check.isBreak(t)));if(e=i[0],!gt.check.isElement(e)||i.length>1)return;const s=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=pt.getValues(s);if(r.length>0)for(let t=0,e=this._listCamel.length;t<e;t++)r.includes(this._listKebab[t])&&(n[this._listCamel[t]]=s[this._listCamel[t]],s.removeProperty(this._listKebab[t]),l=!0);if(this._sn_setCommonListStyle(t,e),l&&!s.length){const t=e.childNodes,i=e.parentNode,s=e.nextSibling;for(;t.length>0;)i.insertBefore(t[0],s);gt.utils.removeItem(e)}},_sn_resetCommonListCell(t,e){if(!gt.check.isListCell(t))return;e||(e=this._listKebab);const i=gt.utils.arrayFilter(t.childNodes,(t=>!gt.check.isBreak(t))),s=t.style,n=[],o=[],l=pt.getValues(s);for(let t=0,i=this._listKebab.length;t<i;t++)l.includes(this._listKebab[t])&&e.includes(this._listKebab[t])&&(n.push(this._listCamel[t]),o.push(this._listKebab[t]));if(!n.length)return;const r=gt.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=s[o[t]],s.removeProperty(o[t]);let a=r.cloneNode(!1),h=null,c=!1;for(let e,s,o=0,l=i.length;o<l;o++)e=i[o],this.options.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(s=pt.getValues(e.style),0===s.length||n.some((function(t){return!s.includes(t)}))&&s.some((function(t){n.includes(t)}))?(h=e.nextSibling,a.appendChild(e)):a.childNodes.length>0&&(t.insertBefore(a,h),a=r.cloneNode(!1),h=null,c=!0));return a.childNodes.length>0&&(t.insertBefore(a,h),c=!0),s.length||t.removeAttribute("style"),c},__resetBrLineBreak(t){this._brLineBreak="br"===t},constructor:Ri};const Pi=Ri;function Di(t){Jt.call(this,t);const e=this.options;this.fontSizeUnitRegExp=null,this._isAllowedClassName=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this._allowHTMLComment=null,this._disallowedStyleNodesRegExp=null,this._htmlCheckWhitelistRegExp=null,this._htmlCheckBlacklistRegExp=null,this._elementWhitelistRegExp=null,this._elementBlacklistRegExp=null,this._attributeWhitelist=null,this._attributeBlacklist=null,this._attributeWhitelistRegExp=null,this._attributeBlacklistRegExp=null,this._cleanStyleTagKeyRegExp=null,this._cleanStyleRegExpMap=null,this._textStyleTags=e.get("_textStyleTags"),this._autoStyleify=null,this.__disallowedTagsRegExp=null,this.__disallowedTagNameRegExp=null,this.__allowedTagNameRegExp=null;const i=e.get("tagStyles"),s={};for(const t in i){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],s[n]?s[n]+="|":s[n]="",s[n]+=i[t]}for(const t in s)s[t]=new RegExp(`\\s*[^-a-zA-Z](${s[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map,o={...s,line:e.get("_lineStylesRegExp")};this._textStyleTags.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this._cleanStyleTagKeyRegExp=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this._cleanStyleRegExpMap=n,this.fontSizeUnitRegExp=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.__disallowedTagsRegExp=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.__disallowedTagNameRegExp=new RegExp(`^(${r})$`,"i"),this.__allowedTagNameRegExp=new RegExp(`^(${l})$`,"i");const a=Object.keys(e.get("_defaultStyleTagMap")),h=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<h.length;t++)a.splice(a.indexOf(h[t].toLowerCase()),1);this._disallowedStyleNodesRegExp=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const c=e.get("__defaultAttributeWhitelist");this._allowHTMLComment=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this._htmlCheckWhitelistRegExp=new RegExp("^("+Wi(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this._elementWhitelistRegExp=pt.createElementWhitelist(Wi(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this._elementBlacklistRegExp=pt.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const d='\\s*=\\s*(")[^"]*\\1',u=e.get("attributeWhitelist");let p={},g="";if(u)for(const t in u)/^on[a-z]+$/i.test(u[t])||("*"===t?g=Wi(u[t],c):p[t]=new RegExp("\\s(?:"+Wi(u[t],"")+")"+d,"ig"));this._attributeWhitelistRegExp=new RegExp("\\s(?:"+(g||c)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+d,"ig"),this._attributeWhitelist=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=Wi(m[t],""):p[t]=new RegExp("\\s(?:"+Wi(m[t],"")+")"+d,"ig");this._attributeBlacklistRegExp=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this._attributeBlacklist=p,this.__resetAutoStyleify(e.get("autoStyleify"))}function qi(t,e,i,s){if(/^<[a-z0-9]+:[a-z0-9]+/i.test(i))return i;let n=null;const o=s.match(/(?!<)[a-zA-Z0-9-]+/)[0].toLowerCase();if(t){const t=this._attributeBlacklist[o];i=i.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),i=t?i.replace(t,""):i.replace(this._attributeBlacklistRegExp,"");const e=this._attributeWhitelist[o];n=e?i.match(e):i.match(this._attributeWhitelistRegExp)}if(!e)return i;if("a"===o){const t=i.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||(n=[]),n.push(t[0]))}else n&&/style=/i.test(n.toString())||(this._textStyleTags.includes(o)?n=this._cleanStyle(i,n,o):this.format.isLine(o)?n=this._cleanStyle(i,n,"line"):this._cleanStyleTagKeyRegExp.test(o)&&(n=this._cleanStyle(i,n,o)));if(gt.check.isMedia(o)||gt.check.isFigure(o)){const t=i.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);n||(n=[]),t&&n.push(t[0])}if(n)for(let t,e=0,i=n.length;e<i;e++)t=/^(?:href|src)\s*=\s*('|"|\s)*javascript\s*:/i.test(n[e].trim())?"":n[e],s+=(/^\s/.test(t)?"":" ")+t;return s}function Wi(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}Di.prototype={filter(t,{tagWhitelist:e,tagBlacklist:i,validate:s,validateAll:n}){if(e&&(t=t.replace(pt.createElementWhitelist(e),"")),i&&(t=t.replace(pt.createElementBlacklist(i),"")),s){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=s(t);null===e?t.remove():e instanceof Node?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}else if(n){const e=(new DOMParser).parseFromString(t,"text/html"),i=[".se-component",".se-flex-component"],n=t=>i.some((e=>t.closest(e)));e.body.querySelectorAll("*").forEach((t=>{if(!n(t)){const e=s(t);null===e?t.remove():e instanceof Node?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t},clean(t,{forceFormat:e,whitelist:i,blacklist:s,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,textStyleTagFilter:a,attrFilter:h,styleFilter:c}=this.options.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.__disallowedTagsRegExp,""),t=this._deleteDisallowedTags(t,this._elementWhitelistRegExp,this._elementBlacklistRegExp).replace(/<br\/?>$/i,"")),this._autoStyleify){const e=(new DOMParser).parseFromString(t,"text/html");gt.query.getListChildNodes(e.body,pt.spanToStyleNode.bind(null,this._autoStyleify)),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,qi.bind(this,h,c)));const u=this._d.createRange().createContextualFragment(t);if(o)try{this._consistencyCheckOfHTML(u,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,o,l,r,n)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}const p=u.querySelectorAll("[data-se-iframe-holder]");for(let t=0,e=p.length;t<e;t++){const e=gt.utils.createElement("iframe"),i=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,s]of Object.entries(i))e.setAttribute(t,s);p[t].replaceWith(e)}let g;if((g=this.options.get("__pluginRetainFilter"))&&this.editor._MELInfo.forEach(((t,e)=>{const i=u.querySelectorAll(e);for(let e=0,s=i.length;e<s;e++)!0!==g&&!1===g[t.key]||t.method(i[e])})),l){let t=u.childNodes;e||(e=this._isFormatData(t)),e&&(t=this._editFormat(u).childNodes);for(let i,s=0,n=t.length;s<n;s++)i=t[s],this.__allowedTagNameRegExp.test(i.nodeName)?d+=i.outerHTML:d+=this._makeLine(i,e)}return d||(d=t),o&&(i&&(d=d.replace("string"==typeof i?pt.createElementWhitelist(i):i,"")),s&&(d=d.replace("string"==typeof s?pt.createElementBlacklist(s):s,""))),a&&(d=this._styleNodeConvertor(d)),d},insert(t,{selectInserted:e,skipCharCount:i,skipCleaning:s}={}){if(this.editor.frameContext.get("wysiwyg").contains(this.selection.get().focusNode)||this.editor.focus(),"string"==typeof t){s||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(gt.check.isListCell(this.format.getLine(this.selection.getNode(),null))){const e=this._d.createRange().createContextualFragment(t).childNodes;this._isFormatData(e)&&(t=this._convertListCell(e))}const s=this._d.createRange().createContextualFragment(t).childNodes;if(!i){const t="byte-html"===this.editor.frameOptions.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let i=0,n=s.length;i<n;i++)e+=s[i][t];if(!this.char.check(e))return}let n,o,l,r,a;for(;n=s[0];)3===r?.nodeType&&1===o?.nodeType&>.check.isBreak(n)?(r=n,gt.utils.removeItem(n)):(l=this.insertNode(n,{afterNode:o,skipCharCount:!0}),o=l.container||l,a||(a=l),r=n);3===r?.nodeType&&1===o?.nodeType&&(o=r);const h=3===o.nodeType?l.endOffset||o.textContent.length:o.childNodes.length;e?this.selection.setRange(a.container||a,a.startOffset||0,o,h):this.component.is(o)||this.selection.setRange(o,h,o,h)}catch(t){if(this.editor.frameContext.get("isReadOnly")||this.editor.frameContext.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.component.is(t))this.component.insert(t,{skipCharCount:i,skipSelection:!1,skipHistory:!1});else{let e=null;(this.format.isLine(t)||gt.check.isMedia(t))&&(e=this.format.getLine(this.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:i})}this.editor.effectNode=null,this.editor.focus(),this.history.push(!1)},insertNode(t,{afterNode:e,skipCharCount:i}={}){let s=null;if(this.editor.frameContext.get("isReadOnly")||!i&&!this.char.check(t))return s;let n,o,l,r=null,a=this.selection.getRange(),h=gt.check.isListCell(a.commonAncestorContainer)?a.commonAncestorContainer:this.format.getLine(this.selection.getNode(),null),c=gt.check.isListCell(h)&&(gt.check.isListCell(t)||gt.check.isList(t)),d=null;const u=this.format.isBrLine(h),p=!u&&(this.format.isLine(t)||this.format.isBlock(t))||this.component.isBasic(t);if(c&&(l=e||gt.check.isList(t)?h.lastChild:h.nextElementSibling,d=gt.check.isList(t)?h:(l||h).parentNode),!e&&(p||this.component.isBasic(t)||gt.check.isMedia(t))){const t=gt.check.isEdgePoint(a.endContainer,a.endOffset,"end"),i=this.remove(),s=i.container,n=s===i.prevContainer&&a.collapsed?null:i.prevContainer;if(c&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(s)){let t=!0;for(l=s;l.parentNode&&l.parentNode!==d;)l=l.parentNode,t=!1;t&&s===n&&(l=l.nextSibling)}else l=null;else if(c&>.check.isListCell(s)&&!h.parentElement)h=gt.utils.createElement("LI"),d.appendChild(h),s.appendChild(d),l=null;else if(3===s.nodeType||gt.check.isBreak(s)||c){const n=gt.query.getParentElement(s,(t=>this.format.isBlock(t)||gt.check.isListCell(t)));if(e=this.nodeTransform.split(s,i.offset,n?gt.query.getNodeDepth(n)+1:0))if(c){if(h.contains(s)){const i=gt.check.isList(h.lastElementChild);let s=null;t||(s=h.cloneNode(!1),s.appendChild(e.textContent.trim()?e:gt.utils.createTextNode(ut.zeroWidthSpace))),i&&(s||(s=h.cloneNode(!1),s.appendChild(gt.utils.createTextNode(ut.zeroWidthSpace))),s.appendChild(h.lastElementChild)),s&&(h.parentNode.insertBefore(s,h.nextElementSibling),l=e=s)}}else e=e.previousSibling;else l=e=h}}a=e||p?this.selection.getRange():this.selection.getRangeAndAddLine(this.selection.getRange(),null);const g=a.commonAncestorContainer,m=a.startOffset,f=a.endOffset,_=a.startContainer===g&&this.format.isLine(g),b=_&&(g.childNodes[m]||g.childNodes[0])||a.startContainer,y=_&&(g.childNodes[f]||g.childNodes[g.childNodes.length-1])||a.endContainer;if(!c)if(e)n=e.parentNode,e=e.nextSibling,o=!0;else if(n=b,3===b.nodeType&&(n=b.parentNode),a.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(gt.check.isBreak(n))e=n,n=n.parentNode;else{const i=n.childNodes[m],s=3===i?.nodeType&>.check.isZeroWidth(i)&>.check.isBreak(i.nextSibling)?i.nextSibling:i;s?!s.nextSibling&>.check.isBreak(s)?(n.removeChild(s),e=null):e=gt.check.isBreak(s)&&!gt.check.isBreak(t)?s:s.nextSibling:e=null}else{if(b===y){e=gt.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;gt.check.isEdgePoint(b,m)||(t=b.splitText(m)),n.removeChild(t),0===n.childNodes.length&&p&&(n.innerHTML="<br>")}else{const i=this.remove(),s=i.container,o=i.prevContainer;if(0===s?.childNodes.length&&p&&(this.format.isLine(s)?s.innerHTML="<br>":this.format.isBlock(s)&&(s.innerHTML="<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">")),gt.check.isListCell(s)&&3===t.nodeType)n=s,e=null;else if(!p&&o)if(n=3===o.nodeType?o.parentNode:o,n.contains(s)){let t=!0;for(e=s;e.parentNode&&e.parentNode!==n;)e=e.parentNode,t=!1;t&&s===o&&(e=e.nextSibling)}else e=null;else gt.check.isWysiwygFrame(s)&&!this.format.isLine(t)?(n=s.appendChild(gt.utils.createElement(this.options.get("defaultLine"))),e=null):n=(e=p?y:s===o?s.nextSibling:s)&&e.parentNode?e.parentNode:g;for(;e&&!this.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const i=this.editor.frameContext.get("wysiwyg");if(!c){if((gt.check.isWysiwygFrame(e)||n===i.parentNode)&&(n=i,e=null),this.format.isLine(t)||this.format.isBlock(t)||!gt.check.isListCell(n)&&this.component.isBasic(t)){const t=n;if(gt.check.isList(e))n=e,e=null;else if(gt.check.isListCell(e))n=e.previousElementSibling||e;else if(!o&&!e){const t=this.remove(),i=3===t.container.nodeType?gt.check.isListCell(this.format.getLine(t.container,null))?t.container:this.format.getLine(t.container,null)||t.container.parentNode:t.container,s=gt.check.isWysiwygFrame(i)||this.format.isBlock(i);n=s?i:i.parentNode,e=s?null:i.nextSibling}0===t.childNodes.length&&n!==t&>.utils.removeItem(t)}if(!p||u||this.format.isBlock(n)||gt.check.isListCell(n)||gt.check.isWysiwygFrame(n)||(e=n.nextElementSibling,n=n.parentNode),gt.check.isWysiwygFrame(n)&&(3===t.nodeType||gt.check.isBreak(t))){const e=gt.utils.createElement(this.options.get("defaultLine"),null,t);r=t,t=e}}if(c?d.parentNode?(n=d,e=l):(n=i,e=null):e=n===e?n.lastChild:e,gt.check.isListCell(t)&&!gt.check.isList(n)){if(gt.check.isListCell(n))e=n.nextElementSibling,n=n.parentNode;else{const t=gt.utils.createElement("ol");n.insertBefore(t,e),n=t,e=null}c=!0}if(this._checkDuplicateNode(t,n),n.insertBefore(t,e),c)if(gt.check.isZeroWidth(h.textContent.trim()))gt.utils.removeItem(h),t=t.lastChild;else{const e=gt.utils.arrayFind(h.children,gt.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(n.appendChild(t),t=n),gt.check.isZeroWidth(h.textContent.trim())&>.utils.removeItem(h))}}catch(e){n.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{r&&(t=r);const e=n.querySelectorAll("[data-duple]");if(e.length>0)for(let i,s,n,o,l=0,r=e.length;l<r;l++){for(i=e[l],n=i.childNodes,o=i.parentNode;n[0];)s=n[0],o.insertBefore(s,i);i===t&&(t=s),gt.utils.removeItem(i)}if((this.format.isLine(t)||this.component.isBasic(t))&&b===y){const t=this.format.getLine(g,null);1===t?.nodeType&>.check.isEmptyLine(t)&>.utils.removeItem(t)}if(u&&(this.format.isLine(t)||this.format.isBlock(t))&&(t=this._setIntoFreeFormat(t)),!this.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.selection.setRange(t,e,t,e);else if(!gt.check.isBreak(t)&&!gt.check.isListCell(t)&&this.format.isLine(n)){let i=null;t.previousSibling&&!gt.check.isBreak(t.previousSibling)||(i=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(i,t)),t.nextSibling&&!gt.check.isBreak(t.nextSibling)||(i=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(i,t.nextSibling)),this.format._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.selection.setRange(t,e,t,e)}}s=t}return s},remove(){this.selection._resetRangeToTextNode();const t=this.selection.getRange(),e=0===t.startOffset,i=gt.check.isEdgePoint(t.endContainer,t.endOffset,"end");let s=null,n=null,o=null;e&&(n=this.format.getLine(t.startContainer),s=n?n.previousElementSibling:null,n=n?s:n),i&&(o=this.format.getLine(t.endContainer),o=o?o.nextElementSibling:o);let l,r=0,a=t.startContainer,h=t.endContainer,c=t.startOffset,d=t.endOffset;const u=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===a.parentNode?a.parentNode:t.commonAncestorContainer;if(u===a&&u===h){if(this.component.isBasic(u)){const t=this.component.get(u).container,e=t.parentElement,i=t.nextSibling||t.previousSibling,s=i===t.previousSibling?i?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return gt.utils.removeItem(t),this.format.isLine(e)?0===e.childNodes.length?(gt.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:i,offset:s,commonCon:u}:{container:n,offset:o,commonCon:u}}if(1===u.nodeType&&0===c&&1===d||3===u.nodeType&&0===c&&d===u.textContent.length){const t=gt.query.getNextDeepestNode(u,this.editor.frameContext.get("wysiwyg")),e=gt.query.getPreviousDeepestNode(u,this.editor.frameContext.get("wysiwyg")),i=this.format.getLine(u);gt.utils.removeItem(u);let s=t||e,n=t?0:3===s?.nodeType?s.textContent.length:1;const o=this.format.getLine(s)||this.component.get(s);return i!==o&&(s=o,n=0===n?0:1),gt.check.isZeroWidth(i)&&!i.contains(s)&>.utils.removeItem(i),{container:s,offset:n,commonCon:u}}a=u.children[c],h=u.children[d],c=d=0}if(!a||!h)return{container:u,offset:0,commonCon:u};if(a===h&&t.collapsed&>.check.isZeroWidth(a.textContent?.substring(c)))return{container:a,offset:c,prevContainer:a&&a.parentNode?a:null,commonCon:u};let p=null,g=null;const m=gt.query.getListChildNodes(u,null);let f=gt.utils.getArrayIndex(m,a),_=gt.utils.getArrayIndex(m,h);if(m.length>0&&f>-1&&_>-1){for(let t=f+1,e=a;t>=0;t--)m[t]===e.parentNode&&m[t].firstChild===e&&0===c&&(f=t,e=e.parentNode);for(let t=_-1,e=h;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--_)}else{if(0===m.length){if(this.format.isLine(u)||this.format.isBlock(u)||gt.check.isWysiwygFrame(u)||gt.check.isBreak(u)||gt.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(gt.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],gt.check.isBreak(a)||gt.check.isZeroWidth(a))return{container:gt.check.isMedia(u)?u:a,offset:0,commonCon:u};f=_=0}const b=gt.check.isText,y=gt.check.isElement;for(let t=f;t<=_;t++){const e=m[t];if(!b(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==h)this._nodeRemoveListItem(e);else{if(b(h))g=gt.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.component.is(h))continue;g=gt.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:this._nodeRemoveListItem(h)}else{if(y(a)){if(this.component.is(a))continue;p=gt.utils.createTextNode(a.textContent)}else{const t=a,i=h;e===h?(p=gt.utils.createTextNode(t.substringData(0,c)+i.substringData(d,i.length-d)),r=c):p=gt.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:this._nodeRemoveListItem(a),e===h)break}else this._nodeRemoveListItem(e)}const v=gt.query.getParentElement(h,"ul"),C=gt.query.getParentElement(a,"li");if(v&&C&&C.contains(v)?(l=v.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||i)&&(i?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(gt.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!gt.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.editor.frameContext.get("wysiwyg"))}return this.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:s,commonCon:u}},get({withFrame:t,includeFullPage:e,rootKey:i}={}){i?Array.isArray(i)||(i=[i]):i=[this.status.rootKey];const s=this.status.rootKey,n={};for(let s,o=0,l=i.length;o<l;o++){this.editor.changeFrameContext(i[o]);const l=this.editor.frameContext,r=gt.utils.createElement("DIV",null,this._convertToCode(l.get("wysiwyg"),!0)),a=gt.check.isTableCell,h=gt.check.isEmptyLine,c=[],d=[];gt.query.getListChildren(r,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return a(e)&&e.children.length<=1&&h(t)&&d.push(e),!1}));for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=d.length;t<e;t++)d[t].innerHTML="<br>";const u=r.innerHTML;if(this.editor.frameOptions.get("iframe_fullPage"))if(e){const t=gt.utils.getAttributesToString(l.get("_wd").body,["contenteditable"]);s=`<!DOCTYPE html><html>${l.get("_wd").head.outerHTML}<body ${t}>${u}</body></html>`}else s=u;else s=t?`<div class="${this.options.get("_editableClass")+""+(this.options.get("_rtl")?" se-rtl":"")}">${u}</div>`:r.innerHTML;n[i[o]]=s}return this.editor.changeFrameContext(s),i.length>1?n:n[i[0]]},set(t,{rootKey:e}={}){this.selection.removeRange();const i=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let t=0;t<e.length;t++)if(this.editor.changeFrameContext(e[t]),this.editor.frameContext.get("isCodeView")){const t=this._convertToCode(i,!1);this.viewer._setCodeView(t)}else this.editor.frameContext.get("wysiwyg").innerHTML=i,this.editor._resetComponents(),this.history.push(!1,e[t])},add(t,{rootKey:e}={}){e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++){this.editor.changeFrameContext(e[i]);const s=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.editor.frameContext.get("isCodeView"))this.viewer._setCodeView(this.viewer._getCodeView()+"\n"+this._convertToCode(s,!1));else{const t=gt.utils.createElement("DIV",null,s).children,n=t.length;for(let e=0;e<n;e++)t[e]&&this.editor.frameContext.get("wysiwyg").appendChild(t[e]);this.history.push(!1,e[i]),this.selection.scrollTo(t[n-1])}}},getJson({withFrame:t,rootKey:e}={}){return pt.htmlToJson(this.get({withFrame:t,rootKey:e}))},setJson(t,{rootKey:e}={}){this.set(pt.jsonToHtml(t),{rootKey:e})},async copy(t){try{return await _t.write(t),this.editor.ui.showToast(this.lang.message_copy_success,this.options.get("toastMessageTime").copy),!0}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.editor.ui.showToast(this.lang.message_copy_fail,this.options.get("toastMessageTime").copy,"error"),!1}},setFullPage(t,{rootKey:e}={}){if(!this.editor.frameOptions.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++)this.editor.changeFrameContext(e[i]),t.head&&(this.editor.frameContext.get("_wd").head.innerHTML=t.head.replace(this.__disallowedTagsRegExp,"")),t.body&&(this.editor.frameContext.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.editor._resetComponents()},compress:t=>t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim(),_convertToCode(t,e){let i="";const s=RegExp,n=new s("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),o="string"==typeof t?this._d.createRange().createContextualFragment(t):t,l=t=>this.format.isLine(t)||this.component.is(t),r=e?"":"\n",a=e?0:1*this.status.codeIndentSize,h=a>0?new Array(a+1).join(" "):"";return function t(e,o){const a=e.childNodes,c=n.test(e.nodeName),d=c?o:"";for(let u,p,g,m,f,_,b=0,y=a.length;b<y;b++)u=a[b],m=n.test(u.nodeName),p=m?r:"",g=!l(u)||c||/^(TH|TD)$/i.test(e.nodeName)?"":r,8!==u.nodeType?3!==u.nodeType?0!==u.childNodes.length?u.outerHTML?(f=u.nodeName.toLowerCase(),_=d||m?o:"",i+=(g||(c?"":p))+_+u.outerHTML.match(s("<"+f+"[^>]*>","i"))[0]+p,t(u,o+h+""),i+=(/\n$/.test(i)?_:"")+"</"+f+">"+(g||p||c||/^(TH|TD)$/i.test(u.nodeName)?r:"")):i+=(new XMLSerializer).serializeToString(u):i+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:gt.check.isList(u.parentElement)||(i+=pt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):i+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),i.trim()+r},_nodeRemoveListItem(t){const e=this.format.getLine(t,null);gt.utils.removeItem(t),gt.check.isListCell(e)&&(this.nodeTransform.removeAllParents(e,null,null),gt.check.isList(e?.firstChild)&&e.insertBefore(gt.utils.createTextNode(ut.zeroWidthSpace),e.firstChild))},_setIntoFreeFormat(t){const e=t.parentNode;let i,s;for(;this.format.isLine(t)||this.format.isBlock(t);){for(i=t.childNodes,s=null;i[0];)if(s=i[0],this.format.isLine(s)||this.format.isBlock(s)){if(this._setIntoFreeFormat(s),!t.parentNode)break;i=t.childNodes}else e.insertBefore(s,t);0===t.childNodes.length&>.utils.removeItem(t),t=gt.utils.createElement("BR"),e.insertBefore(t,s.nextSibling)}return t},_makeLine(t,e){const i=this.options.get("defaultLine");if(1===t.nodeType){if(this.__disallowedTagNameRegExp.test(t.nodeName))return"";if(gt.check.isExcludeFormat(t))return t.outerHTML;const s=gt.query.getListChildNodes(t,(t=>gt.check.isSpanWithoutAttr(t)&&!gt.query.getParentElement(t,gt.check.isExcludeFormat)))||[];for(let t,e=s.length-1;e>=0;e--)t=s[e],t.outerHTML=t.innerHTML;if(!e||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||gt.check.isMedia(t)||gt.check.isFigure(t)||gt.check.isAnchor(t)&>.check.isMedia(t.firstElementChild)){const e=t;return gt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+i+">"+(gt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+i+">"}}if(3===t.nodeType){if(!e)return pt.htmlToEntity(t.textContent);const s=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=s.length;e<o;e++)t=s[e].trim(),t.length>0&&(n+="<"+i+">"+pt.htmlToEntity(t)+"</"+i+">");return n}return 8===t.nodeType&&this._allowHTMLComment?"\x3c!--"+t.textContent.trim()+"--\x3e":""},_consistencyCheckOfHTML(t,e,i,s,n,o,l){const r=[],a=[],h=[],c=[],d=gt.query.getListChildNodes(t,(d=>{if(n&&1!==d.nodeType)return gt.check.isList(d.parentElement)&&r.push(d),!1;if(s&&(i.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&>.check.isExcludeFormat(d)))return r.push(d),!1;const u=!gt.query.getParentElement(d,gt.check.isExcludeFormat);if(n){if(!gt.check.isTableElements(d)&&!gt.check.isListCell(d)&&!gt.check.isAnchor(d)&&(this.format.isLine(d)||this.format.isBlock(d)||this.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(gt.check.isList(d.parentNode)&&!gt.check.isList(d)&&!gt.check.isListCell(d))return h.push(d),!1;if(gt.check.isTableCell(d)){const t=d.firstElementChild;if(!this.format.isLine(t)&&!this.format.isBlock(t)&&!this.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=new Array(d.classList).map(this._isAllowedClassName).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(gt.check.isListCell(d)&&!gt.check.isList(d.parentNode)||(this.format.isLine(d)||this.component.is(d))&&!this.format.isBlock(d.parentNode)&&!gt.query.getParentElement(d,this.component.is.bind(this.component)))}));for(let t=0,e=r.length;t<e;t++)gt.utils.removeItem(r[t]);const u=[];for(let t,e,i=0,s=d.length;i<s;i++)if(t=d[i],e=t.parentNode,e&&e.parentNode)if(gt.query.getParentElement(t,gt.check.isListCell)){const i=t.childNodes;for(let n=i.length-1;s>=0;n--)e.insertBefore(t,i[n]);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,i=u.length;e<i;e++)t=u[e],gt.check.isZeroWidth(t.textContent.trim())&>.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)gt.utils.removeItem(a[t]);for(let t,e,i,s,n=0,o=h.length;n<o;n++)if(t=h[n],s=t.parentNode,s)if(e=gt.utils.createElement("LI"),this.format.isLine(t)){for(i=t.childNodes;i[0];)e.appendChild(i[0]);s.insertBefore(e,t),gt.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(h[n]),s.insertBefore(e,t);for(let t,e,i=0,s=c.length;i<s;i++)t=c[i],e=gt.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML},_styleNodeConvertor(t){if(!this._disallowedStyleNodesRegExp)return t;const e=this.options.get("_defaultStyleTagMap");return t.replace(this._disallowedStyleNodesRegExp,((t,i,s,n)=>i+("string"==typeof e[s]?e[s]:s)+(n?" "+n:"")))},_editFormat(t){let e,i="";const s=t.childNodes;for(let t,n=0,o=s.length;n<o;n++)t=s[n],this.__allowedTagNameRegExp.test(t.nodeName)?i+=t.outerHTML:8===t.nodeType?i+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||gt.check.isExcludeFormat(t)?(e&&(i+=e.outerHTML,e=null),i+=t.outerHTML):(e||(e=gt.utils.createElement(this.options.get("defaultLine"))),this.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(i+=e.outerHTML),this._d.createRange().createContextualFragment(i)},_convertListCell(t){let e="";for(let i,s=0,n=t.length;s<n;s++)i=t[s],1===i.nodeType?gt.check.isList(i)?e+=i.innerHTML:gt.check.isListCell(i)?e+=i.outerHTML:this.format.isLine(i)?e+="<li>"+(i.innerHTML.trim()||"<br>")+"</li>":this.format.isBlock(i)&&!gt.check.isTableElements(i)?e+=this._convertListCell(i.children):e+="<li>"+i.outerHTML+"</li>":e+="<li>"+(i.textContent||"<br>")+"</li>";return e},_isFormatData(t){let e=!1;for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],1===i.nodeType&&!this.format.isTextStyleNode(i)&&!gt.check.isBreak(i)&&!this.__disallowedTagNameRegExp.test(i.nodeName)){e=!0;break}return e},_cleanStyle(t,e,i){let s=(t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(this._textStyleTags.includes(i)&&!s&&(t.match(/<[^\s]+\s(.+)/)||[])[1]){const e=(t.match(/\ssize="([^"]+)"/i)||[])[1],i=(t.match(/\sface="([^"]+)"/i)||[])[1],n=(t.match(/\scolor="([^"]+)"/i)||[])[1];(e||i||n)&&(s='style="'+(e?"font-size:"+mt.get(Number(e)/3.333,1)+"rem;":"")+(i?"font-family:"+i+";":"")+(n?"color:"+n+";":"")+'"')}if(s){let t;e||(e=[]);for(const[e,s]of this._cleanStyleRegExpMap)if(e.test(i)){t=s;break}if(!t)return e;const n=s.replace(/"/g,"").match(t);if(!n)return e;const o=[];for(let t,e=0,i=n.length;e<i;e++)if(t=n[e].match(/([a-zA-Z0-9-]+)(:)([^"']+)/),t&&!/inherit|initial|revert|unset/i.test(t[3])){const e=pt.kebabToCamelCase(t[1].trim()),i=this.editor.frameContext.get("wwComputedStyle")[e]?.replace(/"/g,""),s=t[3].trim();switch(e){case"fontFamily":if(!this.plugins.font||!this.plugins.font.fontArray.includes(s))continue;break;case"fontSize":if(!this.plugins.fontSize)continue;this.fontSizeUnitRegExp.test(t[0])||(t[0]=t[0].replace((t[0].match(/:\s*([^;]+)/)||[])[1],pt.toFontUnit.bind(null,this.options.get("fontSizeUnits")[0])));break;case"color":if(!this.plugins.fontColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue;break;case"backgroundColor":if(!this.plugins.backgroundColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue}i!==s&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e},_deleteDisallowedTags:(t,e,i)=>(e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(i,"")),_checkDuplicateNode(t,e){const i=this;!function t(s){i._dupleCheck(s,e);const n=s.childNodes;for(let e=0,i=n.length;e<i;e++)t(n[e])}(t)},_dupleCheck(t,e){if(!this.format.isTextStyleNode(t))return;const i=(t.style.cssText.match(/[^;]+;/g)||[]).map((function(t){return t.trim()})),s=t.nodeName;if(/^span$/i.test(s)&&0===i.length)return t;const n=this.format;let o=!1;return function e(l){if(!gt.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===s){o=!0;const e=l.style.cssText.match(/[^;]+;/g)||[];for(let t,s=0,n=e.length;s<n;s++)(t=i.indexOf(e[s].trim()))>-1&&i.splice(t,1);for(let e=0,i=l.classList.length;e<i;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=i.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),t.attributes.length||t.setAttribute("data-duple","true")),t},__resetAutoStyleify(t){if(t.length>0){const e=this.options.get("convertTextTags"),i={};t.forEach((t=>{switch(t){case"bold":i.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":i.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":i.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":i.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this._autoStyleify=i}else this._autoStyleify=null},constructor:Di};const Ui=Di;function Gi(t){Jt.call(this,t),this.targetMap={},this.index=-1,this.menus=[],this.currentDropdown=null,this.currentDropdownActiveButton=null,this.currentDropdownName="",this.currentDropdownType="",this.currentContainer=null,this.currentContainerActiveButton=null,this.currentContainerName="",this._dropdownCommands=[],this.__globalEventHandler={mousedown:Zi.bind(this),containerDown:this.containerOff.bind(this),keydown:Xi.bind(this),mousemove:ji.bind(this),mouseout:Yi.bind(this)},this._bindClose_dropdown_mouse=null,this._bindClose_dropdown_key=null,this._bindClose_cons_mouse=null,this.currentDropdownPlugin=null,this.__menuBtn=null,this.__menuContainer=null}function Zi(t){const e=gt.query.getEventTarget(t);gt.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}function Yi(){this.index=-1}function Xi(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this._moveItem(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this._moveItem(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}function ji(t){gt.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),gt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}Gi.prototype={initDropdownTarget({key:t,type:e},i){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");/free$/.test(e)||(i.setAttribute("data-key",t),this._dropdownCommands.push(t)),this.context.get("menuTray").appendChild(i),this.targetMap[t]=i},dropdownOn(t){this.__removeGlobalEvent();const e=this._checkMoreLayer(t);if(e){const i=gt.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(i)return this.editor.runFromTarget(i),void this.dropdownOn(t)}const i=t,s=this.currentDropdownName=i.getAttribute("data-command");this.currentDropdownType=i.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[s];this.currentDropdownActiveButton=i,this._setMenuPosition(i,n),this._bindClose_dropdown_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.mousedown,!1),this._dropdownCommands.includes(s)&&(this.menus=pt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this._bindClose_dropdown_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler.keydown,!1),n.addEventListener("mousemove",this.__globalEventHandler.mousemove,!1),n.addEventListener("mouseout",this.__globalEventHandler.mouseout,!1))),this.currentDropdownPlugin=this.plugins[s],"function"==typeof this.currentDropdownPlugin?.on&&this.currentDropdownPlugin.on(i),this.editor._preventBlur=!0},dropdownOff(){this.__removeGlobalEvent(),this.index=-1,this.menus=[],this.__menuBtn=null,this.__menuContainer=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&>.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1,"function"==typeof this.currentDropdownPlugin?.off&&this.currentDropdownPlugin.off(),this.currentDropdownPlugin=null},containerOn(t){this.__removeGlobalEvent(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this._setMenuPosition(t,this.currentContainer=this.targetMap[e]),this._bindClose_cons_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.containerDown,!1),this.plugins[e].on&&this.plugins[e].on(t),this.editor._preventBlur=!0},containerOff(){this.__removeGlobalEvent(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,gt.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1},_setMenuPosition(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",gt.utils.addClass(t.parentElement.children,"on"),this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,gt.query.getParentElement(t,".se-toolbar"),!1),e.style.visibility="",this.__menuBtn=t,this.__menuContainer=e},_restoreMenuPosition(){this.__menuBtn&&this.__menuContainer&&this._setMenuPosition(this.__menuBtn,this.__menuContainer)},_checkMoreLayer(t){const e=gt.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null},_moveItem(t){gt.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),gt.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,i=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===i?gt.utils.addClass(this.menus[t],"on"):gt.utils.removeClass(this.menus[t],"on")},__removeGlobalEvent(){this._bindClose_dropdown_mouse&&(this._bindClose_dropdown_mouse=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_mouse)),this._bindClose_cons_mouse&&(this._bindClose_cons_mouse=this.eventManager.removeGlobalEvent(this._bindClose_cons_mouse)),this._bindClose_dropdown_key&&(this._bindClose_dropdown_key=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_key),gt.utils.removeClass(this.menus,"on"),gt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"),this.currentDropdown.removeEventListener("mousemove",this.__globalEventHandler.mousemove,!1),this.currentDropdown.removeEventListener("mouseout",this.__globalEventHandler.mouseout,!1))},constructor:Gi};const Ki=Gi;function Ji(t){Jt.call(this,t)}Ji.prototype={split(t,e,i){if(gt.check.isWysiwygFrame(t)||this.component.is(t)||!t)return t;if(e&&!mt.is(e)){const i=t.childNodes;let s=gt.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=i.length;t<e;t++){if(t<s)n.appendChild(i[t]);else{if(!(t>s))continue;o.appendChild(i[t])}t--,e--,s--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const s=t.parentNode;let n,o,l,r=0,a=1,h=!0;if((!i||i<0)&&(i=0),gt.check.isText(t)){if(r=gt.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const i=gt.query.getNodeFromPath([r+1],s);gt.check.isZeroWidth(i)&&(i.data=ut.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:gt.query.getNodeDepth(t)===i&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;gt.query.getNodeDepth(c)>i;)for(r=gt.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(gt.check.isListCell(n)&>.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,gt.utils.removeItem(l.firstElementChild),l.children.length>0&&n.appendChild(l)):n.appendChild(l));o[r];)n.appendChild(o[r]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="<br>");const d=c.parentNode;return h&&(c=c.nextSibling),n?(this.mergeSameTags(n,null,!1),this.mergeNestedTags(n,gt.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,gt.check.isListCell(n)&&n.children&>.check.isList(n.children[0])&&n.insertBefore(gt.utils.createElement("BR"),n.children[0]),0===s.childNodes.length&>.utils.removeItem(s),n):c},mergeSameTags(t,e,i){const s=this,n=e?e.length:0;let o=null;return n&&(o=Array.apply(null,new Array(n)).map(Number.prototype.valueOf,0)),function t(l,r,a){const h=l.childNodes;for(let c,d,u=0,p=h.length;u<p&&(c=h[u],d=h[u+1],c);u++)if(!(gt.check.isBreak(c)||gt.check.isMedia(c)||gt.check.isInputElement(c)))if(i&&s.format._isIgnoreNodeChange(c)||!i&&(gt.check.isTableElements(c)||gt.check.isListCell(c)||s.format.isLine(c)&&!s.format.isBrLine(c)))(gt.check.isTableElements(c)||gt.check.isListCell(c))&&t(c,r+1,u);else{if(1===p&&l.nodeName===c.nodeName&&l.parentNode){if(n){let t,i,s,o,a;for(let h=0;h<n;h++)if(t=e[h],t&&t[r]===u){for(i=c,s=l,o=r,a=!0;o>=0;){if(gt.utils.getArrayIndex(s.childNodes,i)!==t[o]){a=!1;break}i=c.parentNode,s=i.parentNode,o--}a&&(t.splice(r,1),t[r]=u)}}gt.utils.copyTagAttributes(c,l),l.parentNode.insertBefore(c,l),gt.utils.removeItem(l)}if(!d){1===c.nodeType&&t(c,r+1,u);break}if(c.nodeName===d.nodeName&>.check.isSameAttributes(c,d)&&c.getAttribute?.("href")===d.getAttribute?.("href")){const t=c.childNodes;let i=0;for(let e=0,s=t.length;e<s;e++)t[e].textContent.length>0&&i++;const s=c.lastChild,l=d.firstChild;let h=0;if(s&&l){const t=3===s.nodeType&&3===l.nodeType;h=s.textContent.length;let c=s.previousSibling;for(;c&&3===c.nodeType;)h+=c.textContent.length,c=c.previousSibling;if(i>0&&3===s.nodeType&&3===l.nodeType&&(s.textContent.length>0||l.textContent.length>0)&&i--,n){let c=null;for(let d=0;d<n;d++)if(c=e[d],c&&c[r]>u){if(r>0&&c[r-1]!==a)continue;c[r]-=1,c[r+1]>=0&&c[r]===u&&(c[r+1]+=i,t&&s&&3===s.nodeType&&l&&3===l.nodeType&&(o[d]+=h))}}}if(3===c.nodeType){if(h=c.textContent.length,c.textContent+=d.textContent,n){let t=null;for(let s=0;s<n;s++)if(t=e[s],t&&t[r]>u){if(r>0&&t[r-1]!==a)continue;t[r]-=1,t[r+1]>=0&&t[r]===u&&(t[r+1]+=i,o[s]+=h)}}}else c.innerHTML+=d.innerHTML;gt.utils.removeItem(d),u--}else 1===c.nodeType&&t(c,r+1,u)}}(t,0,0),o},mergeNestedTags(t,e){if("string"==typeof e){const t=new RegExp(`^(${e||".+"})$`,"i");e=e=>t.test(e.nodeName)}else"function"!=typeof e&&(e=()=>!0);!function t(i){let s=i.children;if(1===s.length&&s[0].nodeName===i.nodeName&&e(i)){const t=s[0];for(s=t.children;s[0];)i.appendChild(s[0]);i.removeChild(t)}for(let e=0,s=i.children.length;e<s;e++)t(i.children[e])}(t)},removeAllParents(t,e,i){if(!t)return null;let s=null;return e||(e=t=>{if(t===i||this.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)}),function t(i){if(!gt.check.isWysiwygFrame(i)){const n=i.parentNode;n&&e(i)&&(s={sc:i.previousElementSibling,ec:i.nextElementSibling},gt.utils.removeItem(i),t(n))}}(t),s},removeEmptyNode(t,e,i){const s=this,n=this.options.get("allowedEmptyTags");e&&(e=gt.query.getParentElement(e,(e=>t===e.parentElement))),function i(o){if(s.format._notTextNode(o)||o===e||gt.check.isNonEditable(o))return 0;if(o===t||!gt.check.isZeroWidth(o.textContent)||o.firstChild&>.check.isBreak(o.firstChild)||o.querySelector(n)){const t=o.children;for(let e=0,n=t.length,o=0;e<n;e++)t[e+o]&&!s.component.is(t[e+o])&&(o+=i(t[e+o]))}else if(o.parentNode)return o.parentNode.removeChild(o),-1;return 0}(t),0===t.childNodes.length&&(i?gt.utils.removeItem(t):t.innerHTML="<br>")},createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const i=t[0].cloneNode(!1);let s=i;for(let i,n=1,o=t.length;n<o;n++)e(t[n])&&(i=t[n].cloneNode(!1),s.appendChild(i),s=i);return s.innerHTML="",{parent:i,inner:s}},constructor:Ji};const Qi=Ji;function ts(t){Jt.call(this,t),this._scrollEvent=null,this._elTop=0,this._scrollY=0,this._isFixed=!1}function es(e,i,s,n){const o=/^fixed$/i.test(t.getComputedStyle(n).position);this._isFixed?o?e.style.top=this._elTop-(this._scrollY-t.scrollY-n.offsetTop)+"px":this.setRelPosition(e,i,s,n,!0):o&&this.setRelPosition(e,i,s,n,!0)}ts.prototype={get(t){const e=this.editor.frameContext.get("wysiwygFrame"),i=/iframe/i.test(e?.nodeName),s=this.getLocal(t);return{left:s.left+(i?e.parentElement.offsetLeft:0),top:s.top+(i?e.parentElement.offsetTop:0)}},getLocal(t){const e=t;let i=0,s=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,h=J(e,O.bind(this)),c=r;for(;r&&!D(r,"se-wrapper")&&r!==h;)i+=r.offsetLeft-(c!==r?r.scrollLeft:0),s+=r.offsetTop+(c!==r?r.scrollTop:0),r=r.offsetParent;const d=this.editor.frameContext.get("wysiwygFrame");this.editor.frameContext.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.editor.frameContext.get("eventWysiwyg");return i+=n,s+=o-(h?h.scrollTop:0),{left:i,top:s,right:r?.offsetWidth?r.offsetWidth-(i-n+a)+l:0,scrollX:u.scrollX||u.scrollLeft||0,scrollY:u.scrollY||u.scrollTop||0}},getGlobal(e){const i=this.editor.frameContext.get("topArea"),s=this.editor.frameContext.get("wysiwygFrame");let n=!1,o=!1;e||(e=i),e===i&&(n=!0),!n&&I(e)&&(o="absolute"===t.getComputedStyle(e).position);let l=e;const r=l.offsetWidth,a=l.offsetHeight;let h=0,c=0,d=0,u=0;for(;l;)h+=l.offsetTop,c+=l.offsetLeft,d+=l.scrollTop,u+=l.scrollLeft,l=l.offsetParent;if(!o&&!n&&/^iframe$/i.test(s.nodeName)&&this.editor.frameContext.get("wysiwyg").contains(l))for(l=this.editor.frameContext.get("wrapper");l;)h+=l.offsetTop,c+=l.offsetLeft,l=l.offsetParent;return{top:h+d,left:c+u,width:r,height:a,scrollTop:d,scrollLeft:u}},getGlobalScroll(e){const i=this.editor.frameContext.get("topArea");let s=!1,n=!1;e||(e=i),e===i&&(s=!0),!s&&I(e)&&(n="absolute"===t.getComputedStyle(e).position);let o=0,l=0,r=0,a=0,h=0,c=0,d=0,u=0,p=null,g=null,m=null,f=null,_=e;for(;_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),p=m||p||_,m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),g=f||g||_,f=_),_=_.parentElement;if(!n&&!s&&/^iframe$/i.test(this.editor.frameContext.get("wysiwygFrame").nodeName))for(_=this.editor.frameContext.get("wrapper"),p=g=i;_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),f=_),_=_.parentElement;for(_=this.editor._shadowRoot?.host,_&&(p=g=i);_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),f=_),_=_.parentElement;const b=i.contains(p),y=i.contains(g);p=b?i:p,g=y?i:g;const v=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?t.scrollY:0):0,C=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?t.scrollX:0):0;d=b?i.clientHeight:d,u=y?i.clientWidth:u;const w=U(this.editor.frameContext.get("_wd"));return{top:o,left:l,ts:v,ls:C,width:a,height:r,x:h,y:c,ohOffsetEl:n?window:p,owOffsetEl:n?window:g,oh:n?w.h:d,ow:n?w.w:u,heightEditorRefer:b,widthEditorRefer:y}},getWWScroll(){const t=this.editor.frameContext.get("wysiwyg"),e=this.selection.getRects(t,"start").rects,i=t.scrollY||t.scrollTop||0,s=t.scrollHeight||0;return{top:i,left:t.scrollX||t.scrollLeft||0,width:t.scrollWidth||0,height:s,bottom:i+s,rects:e}},setRelPosition(i,s,n,o,l){this._scrollY=t.scrollY;let r=0,a=o;do{if(this._isFixed=/^fixed$/i.test(t.getComputedStyle(a).position)){r+=this._scrollY;break}}while(!D(a,"sun-editor")&&(a=a.parentElement));l||(this.__removeGlobalEvent(),this._scrollEvent=this.editor.eventManager.addGlobalEvent("scroll",es.bind(this,i,s,n,o),!1));const h=i.offsetWidth,c=n.offsetWidth,d=this.getGlobal(n).left,u=this.getGlobal(o).left;if(this.options.get("_rtl")){const t=h>c?h-c:0,e=t>0?0:c-h;i.style.left=`${d-t+e+u}px`,u>this.getGlobal(i).left&&(i.style.left=u+"px")}else{const t=o.offsetWidth+u,e=t<=h?0:t-(d+h);i.style.left=e<0?`${d+e+u}px`:`${d}px`}const p=o.contains(i)?this.getGlobal(s).top:0,g=i.offsetHeight,m=this.getGlobalScroll().top;let f=r,_=n;for(;_&&_!==s;)f+=_.offsetTop,_=_.offsetParent;const b=U(e).h-(p-m+f+n.offsetHeight);if(b<g){let t=-1*(g-f+3);const e=p-m+t,s=g+(e<0?e:0);s>b?(i.style.height=`${s}px`,t=-1*(s-f+3)):(i.style.height=`${b}px`,t=f+n.offsetHeight),i.style.top=`${t}px`}else i.style.top=`${f+n.offsetHeight}px`;this._isFixed&&(this._elTop=i.offsetTop)},setAbsPosition(i,s,n){const o={left:0,top:0,...n.addOffset},l=n.position||"bottom",r=n.inst,a=!this.options.get("_rtl");a||(o.left*=-1);const h=this.editor.frameContext.get("wrapper").contains(s)||n.isWWTarget,c=J(s,".se-controller"),d=h&&!c,u=U(e),p=d?this.getWWScroll():this._getWindowScroll(),g=c?s.getBoundingClientRect():this.selection.getRects(s,"start").rects,m=this.getGlobal(s),f=D(i.firstElementChild,"se-arrow")?i.firstElementChild:null,_=f?f.offsetHeight:0,b=i.offsetHeight,y=s.offsetHeight,v=g.top,C=u.h-g.bottom,w=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:x,rmb:k,rt:E}=this._getVMargin(v,C,w,u,g,d,p);if(h&&(k+y<=0||x+E+y<=0))return;let S=o.top,T=0,H="";"bottom"===l?(H="up",S+=g.bottom+_+t.scrollY,T=k-(b+_),T<0&&(H="down",S-=y+b+2*_,T=w+x-(b+_),T<0&&(H="",S-=T))):(H="down",S+=g.top-b-_+t.scrollY,T=x-(b+_),T<0&&(H="up",S+=y+b+2*_,T=k-(b+_),T<0&&(H="",S+=T))),this._setArrow(f,H),i.style.top=`${S}px`;const L=(1===i.nodeType?mt.get(t.getComputedStyle(i).borderRadius):0)||0,M=m.width,N=i.offsetWidth,A=f?f.offsetWidth:0,B=g.left,I=u.w-g.right;let V,O;if(this.editor.frameContext.get("isFullScreen")?(V=B,O=I):(V=g.left,O=u.w-g.right),h&&(V+M<=0||O+M<=0))return;f&&(f.style.left="",f.style.right="");let R=o.left,z=0,$=0,F=0;return a?(R+=g.left+t.scrollX-(V<0?V:0),z=M+V,z<A&&(F=A/2-1+(L<=2?0:L-2),$=F),z=M+O-N,z<0&&(R+=z,F=N-1-(A/2+(L<=2?0:L-2)),$=-(z-A/2),$=$>F?F:$),f&&$>0&&(f.style.left=$+"px")):(R+=g.right-N+t.scrollX+(O<0?O:0),z=M+O,z<A&&(F=A/2-1+(L<=2?0:L-2),$=F),z=M+V-N,z<0&&(R-=z,F=A/2-1+(L<=2?0:L-2),$=-(z-A/2),$=$<F?F:$>N-F?N-F:$),f&&$>0&&(f.style.right=$+"px")),i.style.left=`${R}px`,r.__offset={left:i.offsetLeft+p.left,top:i.offsetTop+p.top,addOffset:o},{position:"up"===H?"bottom":"top"}},setRangePosition(i,s,{position:n,addTop:o}={}){i.style.top="-10000px",i.style.visibility="hidden",i.style.display="block";let l="top"===n;s=s||this.selection.getRange();const r=this.selection.getRects(s,l?"start":"end");l="start"===r.position;const a=this.editor.frameContext.get("isFullScreen"),h=this.editor.frameContext.get("topArea"),c=r.rects,d=a?0:r.scrollLeft,u=a?0:r.scrollTop,p=h.offsetWidth,g=this.getGlobal(h),m=g.left,f=i.offsetWidth,_=i.offsetHeight;this._setOffsetOnRange(l,c,i,m,p,d,u,o),this.getGlobal(i).top-g.top<0&&(l=!l,this._setOffsetOnRange(l,c,i,m,p,d,u,o)),f===i.offsetWidth&&_===i.offsetHeight||this._setOffsetOnRange(l,c,i,m,p,d,u,o);const b=!this.carrierWrapper.contains(i),y=U(e),v=b?this.getWWScroll():this._getWindowScroll(),C=c.height,w=c.top,x=y.h-c.bottom,k=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:E,rmb:S,rt:T}=this._getVMargin(w,x,k,y,c,b,v);if(!(S+C<=0||E+T+C<=0))return t.setTimeout((()=>{i.style.visibility=""}),0),!0},_setOffsetOnRange(t,i,s,n,o,l,r,a=0){const h=s.querySelector(".se-arrow "),c=Math.round(h.offsetWidth/2),d=s.offsetWidth,u=i.noText&&!t?0:s.offsetHeight,p=(t?i.left:i.right)-n-d/2+l,g=p+d-o;let m=(t?i.top-u-c:i.bottom+c)-(i.noText?0:a)+r;const f=p<0?1:g<0?p:p-g-1-1;let _=!1;const b=m+(t?this.getGlobal(this.editor.frameContext.get("topArea")).top:s.offsetHeight-this.editor.frameContext.get("wysiwyg").offsetHeight);!t&&b>0&&this._getPageBottomSpace()<b?(t=!0,_=!0):t&&e.documentElement.offsetTop>b&&(t=!1,_=!0),_&&(m=(t?i.top-u-c:i.bottom+c)-(i.noText?0:a)+r),s.style.left=Math.floor(f)+"px",s.style.top=Math.floor(m)+"px",t?(W(h,"se-arrow-up"),q(h,"se-arrow-down")):(W(h,"se-arrow-down"),q(h,"se-arrow-up"));const y=Math.floor(d/2+(p-f));h.style.left=(y+c>s.offsetWidth?s.offsetWidth-c:y<c?c:y)+"px"},_getPageBottomSpace(){const t=this.editor.frameContext.get("topArea");return e.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)},_getVMargin(e,i,s,n,o,l,r){let a=0,h=0,c=0;if(this.editor.frameContext.get("isFullScreen"))a=e-s,h=i;else{const e=l&&this.editor.frameOptions.get("iframe"),i=o.top,d=n.h-o.bottom,u=this.getGlobal(),p=this.getGlobalScroll(),g=this.editor.frameContext.get("statusbar")?.offsetHeight||0;if(e){const t=u.top-p.top-p.ts,e=this.editor.frameContext.get("topArea").offsetHeight;a=o.top-t,h=d-(p.oh-(e+t)+g)}else{c=this.editor.toolbar._sticky||this.options.get("toolbar_container")?0:s;const e=!l&&/\d+/.test(this.editor.frameOptions.get("height"))?u.top-t.scrollY+c:0,i=!l&&/\d+/.test(this.editor.frameOptions.get("height"))?t.innerHeight-(u.top+u.height-t.scrollY):0;let n=e;s>e?this.editor.toolbar._sticky?(n=s,s=0):n=e+s:this.options.get("toolbar_container")?s=0:n=e+(this.editor.toolbar._sticky?s:0),a=o.top-n,h=r.rects.bottom-o.bottom-i-g}a=(a>0?i:a)-s,h=h>0?d:h}return{rmt:a,rmb:h,rt:c}},_setArrow(t,e){"up"===e?(t&&(t.style.visibility=""),q(t,"se-arrow-up"),W(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),q(t,"se-arrow-down"),W(t,"se-arrow-up")):t&&(t.style.visibility="hidden")},_getWindowScroll(){const i=U(e);return{top:t.scrollY,left:t.scrollX,width:i.w,height:i.h,bottom:t.scrollY+i.h,rects:{left:0,top:0,right:t.innerWidth,bottom:t.innerHeight,noText:!0}}},__removeGlobalEvent(){this._scrollEvent&&(this._scrollEvent=this.editor.eventManager.removeGlobalEvent(this._scrollEvent),this._scrollY=0,this._elTop=null)},constructor:ts};const is=ts;function ss(t){Jt.call(this,t),this.range=null,this.selectionNode=null,this.__iframeFocus=!1}ss.prototype={get(){let t=null;return t="function"==typeof this.editor._shadowRoot?.getSelection?this.editor._shadowRoot.getSelection():this.editor.frameContext.get("_ww").getSelection(),t?(this.status._range||this.editor.frameContext.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t):null},isRange:t=>t instanceof Range,getRange(){const t=this.status._range||this._createDefaultRange(),e=this.get();if(t.collapsed===e.isCollapsed||!this.editor.frameContext.get("wysiwyg").contains(e.focusNode)){if(this.component.is(t.startContainer)){const e=this.component.get(t.startContainer),i=e?.container;return i?this.setRange(i,0,i,1):t}return t}if(e.rangeCount>0)return this.status._range=e.getRangeAt(0),this.status._range;{const t=e.anchorNode,i=e.focusNode,s=e.anchorOffset,n=e.focusOffset,o=gt.query.compareElements(t,i),l=o.ancestor&&(0===o.result?s<=n:o.result>1);return this.setRange(l?t:i,l?s:n,l?i:t,l?n:s)}},setRange(t,e,i,s){let n,o,l,r;if(this.isRange(t)){const e=t;n=e.startContainer,o=e.startOffset,l=e.endContainer,r=e.endOffset}else n=t,o=e,l=i,r=s;if(!n||!l)return;(gt.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(gt.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||gt.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||gt.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.editor.frameContext.get("_wd").createRange();try{a.setStart(n,o),a.setEnd(l,r),this.status.hasFocus=!0}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.editor._nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.status._range=a,this._rangeInfo(a,this.get()),this.editor.frameOptions.get("iframe")&&this.__focus(),a},removeRange(){this.status._range=null,this.selectionNode=null,this.editor.effectNode=null,this.status.hasFocus&&this.get().removeAllRanges(),this.eventManager._setKeyEffect([])},getNearRange(t){const e=t.nextSibling,i=t.previousSibling;return e?{container:e,offset:0}:i?{container:i,offset:1}:null},getRangeAndAddLine(t,e){if(this._isNone(t)){const i=e?.parentElement||this.editor.frameContext.get("wysiwyg"),s=gt.utils.createElement(this.options.get("defaultLine"),null,"<br>");i.insertBefore(s,e&&e!==i?e.previousElementSibling?e.nextElementSibling:e:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this.status._range}return t},getNode(){if(this.editor.frameContext.get("wysiwyg").contains(this.selectionNode)||this._init(),!this.selectionNode){const t=gt.query.getEdgeChild(this.editor.frameContext.get("wysiwyg").firstChild,(t=>0===t.childNodes.length||3===t.nodeType),!1);if(t)return this.selectionNode=t,t;this._init()}return this.selectionNode},getRects(t,e){const i=!!gt.check.isElement(t)&&"absolute"===this._w.getComputedStyle(t).position;t=!t||gt.check.isText(t)?this.getRange():t;const s=this.offset.getGlobalScroll();let n="start"===e,o=s.left,l=s.top,r=t.getClientRects();if(r=r[n?0:r.length-1],!r){const t=this.getNode();if(this.format.isLine(t)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this._init(),r=this.getRange().getClientRects(),r=r[n?0:r.length-1]}if(!r){const e=this.offset.get(t);r={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},o=0,l=0}n=!0}const a=/^iframe$/i.test(this.editor.frameContext.get("wysiwygFrame").nodeName)?this.editor.frameContext.get("wysiwygFrame").getClientRects()[0]:null;return!i&&a&&(r={left:r.left+a.left,top:r.top+a.top,right:r.right+a.right-a.width,bottom:r.bottom+a.bottom-a.height}),{rects:r,position:n?"start":"end",scrollLeft:o,scrollTop:l}},getDragEventLocationRange(t){const e=this.editor.frameContext.get("_wd");let i,s,n,o,l;return e.caretPositionFromPoint?(i=e.caretPositionFromPoint(t.clientX,t.clientY),s=i.offsetNode,n=i.offset,o=i.offsetNode,l=i.offset):e.caretRangeFromPoint&&(i=e.caretRangeFromPoint(t.clientX,t.clientY),s=i.startContainer,n=i.startOffset,o=i.endContainer,l=i.endOffset),{sc:s,so:n,ec:o,eo:l}},scrollTo(t,e){t instanceof Selection?t=t.getRangeAt(0):t instanceof Node?t=this.setRange(t,1,t,1):void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t);const i=t.getBoundingClientRect();if(i.top>=0&&i.bottom<=this.editor.frameContext.get("wysiwygFrame").innerHeight)return;const s=gt.query.getParentElement(t.startContainer,(t=>1===t.nodeType));s?.scrollIntoView?.(e||this.options.get("scrollToOptions"))},_isNone(t){const e=t.commonAncestorContainer;return gt.check.isWysiwygFrame(t.startContainer)&>.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.editor._fileManager.regExp.test(e.nodeName)&&(!this.editor._fileManager.tagAttrs[e.nodeName]||this.editor._fileManager.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.component.is(e)},_createDefaultRange(){const t=this.editor.frameContext.get("wysiwyg"),e=this.editor.frameContext.get("_wd").createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=gt.utils.createElement("BR"),i.appendChild(s))):(s=gt.utils.createElement("BR"),i=gt.utils.createElement(this.options.get("defaultLine"),null,s),t.appendChild(i)),e.setStart(s,0),e.setEnd(s,0),e},_rangeInfo(t,e){let i=null;this.status._range=t,i=t.collapsed?gt.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=i},_init(){const t=this.editor.frameContext.get("_wd").activeElement;if(gt.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let i=null;i=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._rangeInfo(i,e)},__focus(){try{this.__iframeFocus=!0;const t=gt.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.editor.frameContext.get("wysiwyg").focus()}finally{dt._w.setTimeout((()=>this.__iframeFocus=!1),0)}},_resetRangeToTextNode(){let t=this.getRange();if(this._isNone(t)){if(!gt.check.isWysiwygFrame(t.startContainer)||!gt.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,i=e.children[t.startOffset],s=e.children[t.endOffset];if(!(t=this.setRange(i,0,s,i===s?0:1)))return!1}const e=t,i=e.collapsed;let s,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,h=e.endOffset;if(this.format.isLine(l))for(l.childNodes[r]?(l=l.childNodes[r]||l,r=0):(l=l.lastChild||l,r=l.textContent.length);1===l?.nodeType&&l.firstChild;)l=l.firstChild||l,r=0;if(this.format.isLine(a)){for(a=a.childNodes[h]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;i?h=0:h>0&&(h=a.textContent.length)}if(s=gt.check.isWysiwygFrame(l)?this.editor.frameContext.get("wysiwyg").firstChild:l,n=r,gt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=gt.check.isBreak(s);if(!t){const t=s;for(;s&&!gt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let e=this.format.getLine(s,null);e===this.format.getBlock(e,null)&&(s=s||t,e=gt.utils.createElement(gt.query.getParentElement(s,gt.check.isTableCell)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(e,s),s!==t&&e.appendChild(s))}if(gt.check.isBreak(s)||this.component.is(s)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,t&&l===a&&(a=s,h=1)}}if(l=s,r=n,s=gt.check.isWysiwygFrame(a)?this.editor.frameContext.get("wysiwyg").lastChild:a,n=h,gt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=gt.check.isBreak(s);if(!t){for(;s&&!gt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let t=this.format.getLine(s,null);t===this.format.getBlock(t,null)&&(t=gt.utils.createElement(gt.check.isTableCell(t)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(t,s),t.appendChild(s))}if(gt.check.isBreak(s)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,n=1,t&&!s.previousSibling&>.utils.removeItem(a)}}return a=s,h=n,this.setRange(l,r,a,h),!0},constructor:ss};const ns=ss;function os(t){this.editor=t,this.isDisabled=!1}os.prototype={command(t,e,i,s,n,o,l,r){if(this.isDisabled)return!1;let a=null;return a=e?this.editor.shortcutsKeyMap.get(s+(i?"1000":"")):this.editor.shortcutsKeyMap.get(n)||this.editor.shortcutsKeyMap.get(n+t.key),!(!a||!i&&a.s||a.space&&!ft.isSpace(s)||a.enter&&!ft.isEnter(s)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.editor.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:s}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:s,editor:this.editor}):this.editor.run(a.command,a.type,a.button),!0)},disable(){this.isDisabled=!0},enable(){this.isDisabled=!1},constructor:os};const ls=os,{_w:rs}=dt;function as(t,{keyName:e,balloon:i,inline:s,balloonAlways:n,res:o}){Jt.call(this,t),this.keyName=e,this.isSub=/sub/.test(e),this.currentMoreLayerActiveButton=null,this._isBalloon=i,this._isInline=s,this._isBalloonAlways=n,this._responsiveCurrentSize="default",this._originRes=o,this._rButtonArray=o,this._rButtonsInfo=null,this._rButtonsize=null,this._sticky=!1,this._isViewPortSize="visualViewport"in rs,this._inlineToolbarAttr={top:"",width:"",isShow:!1},this._balloonOffset={top:0,left:0},this._setResponsive()}as.prototype={disable(){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff(),gt.utils.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)},enable(){gt.utils.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)},show(){this._isInline?this._showInline():this._isBalloon?this._showBalloon():(this.context.get(this.keyName+".main").style.display="",this.isSub||(this.editor.frameContext.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()},hide(){this._isInline?(this.context.get(this.keyName+".main").style.display="none",this.context.get(this.keyName+".main").style.top="0px",this._inlineToolbarAttr.isShow=!1):(this.context.get(this.keyName+".main").style.display="none",this.isSub||(this.editor.frameContext.get("_stickyDummy").style.display="none"),this._isBalloon&&(this._balloonOffset={top:0,left:0}))},resetResponsiveToolbar(){this.menu.containerOff();const t=this._rButtonsize;if(t){let e=0;e=(this._isBalloon||this._isInline)&&"auto"===this.options.get("toolbar_width")||this.editor.isSubBalloon&&"auto"===this.options.get("toolbar.sub_width")?this.editor.frameContext.get("topArea").offsetWidth:this.context.get(this.keyName+".main").offsetWidth;let i="default";for(let s=1,n=t.length;s<n;s++)if(e<t[s]){i=t[s]+"";break}this._responsiveCurrentSize!==i&&(this._responsiveCurrentSize=i,this.setButtons(this._rButtonsInfo[i]))}},setButtons(t){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff();const{options:e,icons:i,lang:s}=this,n=Ft(t,this.plugins,e,i,s,!0);n.updateButtons.forEach((t=>$t(t.button,t.plugin,this.icons,this.lang))),this.context.get(this.keyName+".main").replaceChild(n.buttonTray,this.context.get(this.keyName+".buttonTray")),this.context.set(this.keyName+".buttonTray",n.buttonTray),this._resetButtonInfo(),this.triggerEvent("onSetToolbarButtons",{buttonTray:n.buttonTray,frameContext:this.editor.frameContext})},_resetButtonInfo(){this.editor.allCommandButtons=new Map,this.editor.subAllCommandButtons=new Map,this.editor.commandTargets=new Map,this.editor.shortcutsKeyMap=new Map,this.editor.__cachingButtons(),this.editor.__cachingShortcuts(),this.history.resetButtons(this.editor.frameContext.get("key"),null),this._resetSticky(),this.editor.effectNode=null,this.viewer._setButtonsActive(),this.status.hasFocus&&this.eventManager.applyTagEffect(),this.editor.frameContext.get("isReadOnly")&&this.ui.setControllerOnDisabledButtons(!0)},_resetSticky(){const t=this.editor.frameContext.get("wrapper");if(!t)return;const e=this.context.get(this.keyName+".main");if(this.editor.frameContext.get("isFullScreen")||0===e.offsetWidth||this.options.get("toolbar_sticky")<0)return;const i=this._isViewPortSize?rs.visualViewport.pageTop:rs.scrollY,s=this.editor.frameContext.get("_minHeight"),n=t.offsetHeight,o=this.offset.getGlobal(this.editor.frameContext.get("topArea")),l=i+this.options.get("toolbar_sticky"),r=(this._isBalloon||this._isInline?o.top:this.offset.getGlobal(this.options.get("toolbar_container")).top)-(this._isInline?e.offsetHeight:0),a=this.options.get("toolbar_container")?o.top-i+n-s-this.options.get("toolbar_sticky")-e.offsetHeight:n+r+this.options.get("toolbar_sticky")-l-s;l<r?this._offSticky():a<0?(this._sticky||this._onSticky(1),e.style.top=1+a+this.__getViewportTop()+"px"):this._onSticky(1)},_onSticky(t){const e=this.context.get(this.keyName+".main");if(!this._isInline){const t=this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.editor.frameContext.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}const i=this.options.get("toolbar_sticky")+t+this.__getViewportTop();e.style.top=`${i}px`,e.style.width=this._isInline?this._inlineToolbarAttr.width:e.offsetWidth+"px",gt.utils.addClass(e,"se-toolbar-sticky"),this._sticky=!0},__getViewportTop(){return this._isViewPortSize?rs.visualViewport.offsetTop:0},_offSticky(){(this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.editor.frameContext.get("_stickyDummy")).style.display="none";const t=this.context.get(this.keyName+".main");t.style.top=this._isInline?this._inlineToolbarAttr.top:"",t.style.width=this._isInline?this._inlineToolbarAttr.width:"",this.editor.frameContext.get("wrapper").style.marginTop="",gt.utils.removeClass(t,"se-toolbar-sticky"),this._sticky=!1},_setResponsive(){if(0===this._rButtonArray?.length)return void(this._rButtonArray=null);this._responsiveCurrentSize="default";const t=this._rButtonsize=[],e=this._originRes,i=this._rButtonsInfo={default:e[0]};for(let s,n,o=1,l=e.length;o<l;o++)n=e[o],s=1*n[0],t.push(s),i[s]=n[1];t.sort(((t,e)=>t-e)).unshift("default")},_showBalloon(t){if(!this._isBalloon)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.selection.getRange(),i=this.context.get(this.keyName+".main"),s=this.selection.get();let n;if(this._isBalloonAlways&&e.collapsed)n=!0;else if(s.focusNode===s.anchorNode)n=s.focusOffset<s.anchorOffset;else{const t=gt.query.getListChildNodes(e.commonAncestorContainer,null);n=gt.utils.getArrayIndex(t,s.focusNode)<gt.utils.getArrayIndex(t,s.anchorNode)}this._setBalloonOffset(n,e),this.triggerEvent("onShowToolbar",{toolbar:i,mode:"balloon",frameContext:this.editor.frameContext})},_setBalloonOffset(t,e){const i=this.context.get(this.keyName+".main"),s=this.editor.frameContext.get("topArea"),n=this.offset.getGlobal(s).top;if(!this.offset.setRangePosition(i,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.options.get("toolbar_container")){const t=s.parentElement;let e=this.options.get("toolbar_container"),n=e.offsetLeft,o=e.offsetTop;for(;!e.parentElement.contains(t)||!/^(BODY|HTML)$/i.test(e.parentElement.nodeName);)e=e.offsetParent,n+=e.offsetLeft,o+=e.offsetTop;i.style.left=i.offsetLeft-n+s.offsetLeft+"px",i.style.top=i.offsetTop-o+s.offsetTop+"px"}const o=this.offset.getWWScroll();this._balloonOffset={top:i.offsetTop+o.top,left:i.offsetLeft+o.left,position:t?"top":"bottom"}},_showInline(){if(!this._isInline)return;const t=this.context.get(this.keyName+".main");t.style.visibility="hidden",this._offSticky(),t.style.display="block",t.style.top="0px",this._inlineToolbarAttr.width=t.style.width=this.options.get(this.keyName+"_width"),this._inlineToolbarAttr.top=t.style.top=this.offset.getGlobal(this.editor.frameContext.get("topArea")).top-this.offset.getGlobal(t).top-t.offsetHeight-1+"px",this._resetSticky(),this._inlineToolbarAttr.isShow=!0,this.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline"}),t.style.visibility=""},_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"},_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.context.get(this.keyName+".main").querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",gt.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}},constructor:as};const hs=as,{_w:cs}=dt;function ds(t){Jt.call(this,t),this._controllerOnBtnDisabled=!1;const e=function({lang:t,icons:e}){const i='<div><button class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return gt.utils.createElement("DIV",{class:"se-alert-content"},i)}(t);this.alertModal=e,this.alertMessage=e.querySelector("span"),this._alertArea=this.carrierWrapper.querySelector(".se-alert"),this._alertInner=this.carrierWrapper.querySelector(".se-alert .se-modal-inner"),this._alertInner.appendChild(e),this._closeListener=[ps.bind(this),us.bind(this)],this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._bindClose=null,this._backWrapper=this.carrierWrapper.querySelector(".se-back-wrapper");const i=function(){const t='<div class="se-toast-container"><span></span></div>';return gt.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=i,this.toastContainer=i.querySelector(".se-toast-container"),this.toastMessage=i.querySelector("span"),this.carrierWrapper.appendChild(i),this._toastToggle=null}function us(t){const e=gt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._alertInner)&&this.alertClose()}function ps(t){ft.isEsc(t.code)&&this.alertClose()}ds.prototype={setEditorStyle(t,e){const i=(e=e||this.editor.frameContext).get("options");i.set("editorStyle",t);const s=pt._setDefaultOptionStyle(i,t);i.set("_defaultStyles",s),e.get("topArea").style.cssText=s.top;const n=e.get("code");n.style.cssText=i.get("_defaultStyles").frame,n.style.display="none",i.get("iframe")?(e.get("wysiwygFrame").style.cssText=s.frame,e.get("wysiwyg").style.cssText=s.editor):e.get("wysiwygFrame").style.cssText=s.frame+s.editor},setTheme(t){if("string"!=typeof t)return;const e=this.options,i=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const s=e=>{e&&(i&>.utils.removeClass(e,i),t&>.utils.addClass(e,t))};s(this.carrierWrapper),this.editor.applyFrameRoots((t=>{s(t.get("topArea")),s(t.get("wysiwyg"))})),s(this.context.get("statusbar._wrapper")),s(this.context.get("toolbar._wrapper"))},readOnly(t,e){const i=e?this.frameRoots.get(e):this.editor.frameContext;i.set("isReadOnly",!!t),gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!!t),t?(this._offCurrentController(),this._offCurrentModal(),this.toolbar?.currentMoreLayerActiveButton?.disabled&&this.toolbar._moreLayerOff(),this.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.subToolbar._moreLayerOff(),this.menu?.currentDropdownActiveButton?.disabled&&this.menu.dropdownOff(),this.menu?.currentContainerActiveButton?.disabled&&this.menu.containerOff(),i.get("code").setAttribute("readOnly","true"),gt.utils.addClass(i.get("wysiwyg"),"se-read-only")):(i.get("code").removeAttribute("readOnly"),gt.utils.removeClass(i.get("wysiwyg"),"se-read-only")),this.options.get("hasCodeMirror")&&this.viewer._codeMirrorEditor("readonly",!!t,e)},disable(t){const e=t?this.frameRoots.get(t):this.editor.frameContext;this.toolbar.disable(),this._offCurrentController(),this._offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable",!1),e.set("isDisabled",!0),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0},enable(t){const e=t?this.frameRoots.get(t):this.editor.frameContext;this.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable",!0),e.set("isDisabled",!1),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1},show(t){const e=(t?this.frameRoots.get(t):this.editor.frameContext).get("topArea").style;"none"===e.display&&(e.display="block")},hide(t){(t?this.frameRoots.get(t):this.editor.frameContext).get("topArea").style.display="none"},showLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="block"},hideLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="none"},setControllerOnDisabledButtons(t){t&&!this._controllerOnBtnDisabled?(gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!0),this._controllerOnBtnDisabled=!0):!t&&this._controllerOnBtnDisabled&&(gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!1),this._controllerOnBtnDisabled=!1)},enableBackWrapper(t){this._backWrapper.style.cursor=t,this._backWrapper.style.display="block"},disableBackWrapper(){this._backWrapper.style.display="none",this._backWrapper.style.cursor="default"},alertOpen(t,e){this.alertMessage.textContent=t,gt.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&>.utils.addClass(this.alertModal,`se-alert-${e}`),this._closeSignal&&this._alertInner.addEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this._alertArea.style.display="block",gt.utils.addClass(this.alertModal,"se-modal-show")},alertClose(){gt.utils.removeClass(this.alertModal,"se-modal-show"),gt.utils.removeClass(this.alertModal,"se-alert-*"),this._alertArea.style.display="none",this._closeSignal&&this._alertInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))},showToast(t,e=1e3,i){gt.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),gt.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),i&>.utils.addClass(this.toastPopup,`se-toast-${i}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,gt.utils.addClass(this.toastContainer,"se-toast-show"),this._toastToggle=cs.setTimeout((()=>{this.closeToast()}),e)},closeToast(){this._toastToggle&&cs.clearTimeout(this._toastToggle),this._toastToggle=null,gt.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"},_visibleControllers(t,e){const i=t?"":"hidden",s=e??i?"":"hidden",n=this.editor.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=i);this.editor._lineBreaker_t.style.visibility=s,this.editor._lineBreaker_b.style.visibility=s},_offCurrentController(){this.component.__deselect()},__offControllers(){const t=this.editor.opendControllers,e=[];for(let i,s=0;s<t.length;s++)i=t[s],i.fixed?e.push(i):("function"==typeof i.inst.close&&i.inst.close(),i.form&&(i.form.style.display="none"));this.editor.opendControllers=e,this.editor.currentControllerName="",this.editor._preventBlur=!1},_offCurrentModal(){this.editor.opendModal&&this.editor.opendModal.close()},constructor:ds};const gs=ds;function ms(t){Jt.call(this,t),this.bodyOverflow="",this.editorAreaOriginCssText="",this.wysiwygOriginCssText="",this.codeWrapperOriginCssText="",this.codeOriginCssText="",this.codeNumberOriginCssText="",this.toolbarOriginCssText="",this.arrowOriginCssText="",this.fullScreenInnerHeight=0,this.fullScreenSticky=!1,this.fullScreenBalloon=!1,this.fullScreenInline=!1,this.toolbarParent=null}function fs(t){const e=dt._w.getComputedStyle(t).lineHeight;let i;if(mt.is(e))i=mt.get(e);else{const e=dt._w.getComputedStyle(t).fontSize;i=1.2*mt.get(e)}return i}ms.prototype={codeView(t){const e=this.editor.frameContext;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;e.set("isCodeView",t),this.ui._offCurrentController(),this.ui._offCurrentModal();const i=e.get("codeWrapper"),s=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this._setEditorDataToCodeView(),i.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?s.style.height="100%":"auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||(s.style.height=s.scrollHeight>0?s.scrollHeight+"px":"auto"),this.options.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.editor._notHideToolbar=!0,this.editor.isBalloon&&(this.context.get("toolbar._arrow").style.display="none",this.context.get("toolbar.main").style.left="",this.editor.isInline=this.toolbar._isInline=!0,this.editor.isBalloon=this.toolbar._isBalloon=!1,this.toolbar._showInline())),this.editor.isSubBalloon&&this.subToolbar.hide(),function(t){const e=t.get("codeNumbers");if(!e)return;const i=fs(e),s=t.get("code").scrollHeight/i;let n="";for(let t=1;t<=s;t++)n+=`${t}\n`;const{padding:o,margin:l}=dt._w.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.status._range=null,s.focus(),gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.addClass(o,"se-code-view-status")):(gt.check.isNonEditable(n)||this._setCodeDataToEditor(),n.scrollTop=0,i.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.editor._notHideToolbar=!1,/balloon/.test(this.options.get("mode"))&&(this.context.get("toolbar._arrow").style.display="",this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!0,this.eventManager._hideToolbar())),this.editor._nativeFocus(),gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),gt.check.isNonEditable(n)||(this.history.push(!1),this.history.resetButtons(e.get("key"),null)),gt.utils.removeClass(o,"se-code-view-status")),this.editor._checkPlaceholder(e),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,t),e.has("documentType-use-header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})},fullScreen(t){const e=this.editor.frameContext;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const i=e.get("topArea"),s=this.context.get("toolbar.main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),h=this.editor.frameContext.get("isCodeView"),c=this.context.get("toolbar._arrow");this.ui._offCurrentController();const d="none"===s.style.display||this.editor.isInline&&!this.editor.toolbar._inlineToolbarAttr.isShow;if(t){this._originCssText=i.style.cssText,this.editorAreaOriginCssText=n.style.cssText,this.wysiwygOriginCssText=o.style.cssText,this.codeWrapperOriginCssText=l.style.cssText,this.codeOriginCssText=r.style.cssText,this.codeNumberOriginCssText=a?.style.cssText,this.toolbarOriginCssText=s.style.cssText,c&&(this.arrowOriginCssText=c.style.cssText),(this.editor.isBalloon||this.editor.isInline)&&(c&&(c.style.display="none"),this.fullScreenInline=this.editor.isInline,this.fullScreenBalloon=this.editor.isBalloon,this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!1),this.options.get("toolbar_container")&&(this.toolbarParent=s.parentElement,e.get("container").insertBefore(s,n)),i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.maxWidth="100%",i.style.height="100%",i.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.fullScreenSticky=!0,e.get("_stickyDummy").style.display="none",gt.utils.removeClass(s,"se-toolbar-sticky")),this.bodyOverflow=this._d.body.style.overflow,this._d.body.style.overflow="hidden",n.style.cssText=s.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.editor.frameOptions.get("_defaultStyles").editor+(h?"display: none;":""),l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${h?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%",r.style.height="",s.style.width=o.style.height="100%",s.style.position="relative",s.style.display="block",this.fullScreenInnerHeight=this._w.innerHeight-s.offsetHeight,n.style.height=this.fullScreenInnerHeight-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.options.get("fullScreenOffset")+"px",this.editor.frameOptions.get("iframe")&&"auto"===this.editor.frameOptions.get("height")&&(n.style.overflow="auto",this.editor._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.options.get("fullScreenOffset")+"px";const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.addClass(e,"active")}))}else{o.style.cssText=this.wysiwygOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(h?"display: none;":""),l.style.cssText=this.codeWrapperOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${h?"flex":"none"} !important;`,r.style.cssText=this.codeOriginCssText,a&&(a.style.cssText=this.codeNumberOriginCssText),s.style.cssText=this.toolbarOriginCssText,n.style.cssText=this.editorAreaOriginCssText,i.style.cssText=this._originCssText,c&&(c.style.cssText=this.arrowOriginCssText),this._d.body.style.overflow=this.bodyOverflow,"auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.toolbarParent&&(this.toolbarParent.appendChild(s),this.toolbarParent=null),this.options.get("toolbar_sticky")>-1&>.utils.removeClass(s,"se-toolbar-sticky"),this.fullScreenSticky&&!this.options.get("toolbar_container")&&(this.fullScreenSticky=!1,e.get("_stickyDummy").style.display="block",gt.utils.addClass(s,"se-toolbar-sticky")),this.editor.isInline=this.toolbar._isInline=this.fullScreenInline,this.editor.isBalloon=this.toolbar._isBalloon=this.fullScreenBalloon,e.get("isCodeView")||(this.editor.isInline?this.editor.toolbar._showInline():this.editor.isBalloon&&this.editor.toolbar._showBalloon()),this.editor.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.removeClass(e,"active")}))}d&&!e.get("isCodeView")&&this.editor.toolbar.hide(),this.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})},showBlocks(t){const e=this.editor.frameContext;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(gt.utils.addClass(e.get("wysiwyg"),"se-show-block"),gt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active")):(gt.utils.removeClass(e.get("wysiwyg"),"se-show-block"),gt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")),this.editor._resourcesStateChange(e)},_setButtonsActive(){const t=this.editor.frameContext;if(t.get("isCodeView")?gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"):gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.addClass(e,"active")}))}else{const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.removeClass(e,"active")}))}t.get("isShowBlocks")?gt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active"):gt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")},print(){const t=gt.utils.createElement("IFRAME",{style:"display: none;"});this._d.body.appendChild(t);const e=this._w.getComputedStyle(this.editor.frameContext.get("wysiwyg")).padding,i=this.options.get("printTemplate")?this.options.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get()):this.html.get(),s=gt.query.getIframeDocument(t),n=this.editor.frameContext.get("_wd"),o=this.options.get("_rtl")?" se-rtl":"",l=`\n\t\t\t<style>\n\t\t\t\t@page {\n\t\t\t\t\tsize: A4;\n\t\t\t\t\tmargin: ${e};\n\t\t\t\t}\n\t\t\t</style>`;if(this.editor.frameOptions.get("iframe")){const t=this.options.get("printClass")?'class="'+this.options.get("printClass")+o+'"':this.editor.frameOptions.get("iframe_fullPage")?gt.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+o+'"';s.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n.head.innerHTML}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${t} style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=this._d.head.getElementsByTagName("link"),e=this._d.head.getElementsByTagName("style");let n="";for(let e=0,i=t.length;e<i;e++)n+=t[e].outerHTML;for(let t=0,i=e.length;t<i;t++)n+=e[t].outerHTML;s.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.options.get("printClass")||this.options.get("_editableClass"))+o}" style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.ui.showLoading(),this._w.setTimeout((()=>{try{if(t.focus(),dt.isEdge||dt.isChromium||"StyleMedia"in dt._w)try{t.contentWindow.document.execCommand("print",!1,null)}catch(e){console.warn("[SUNEDITOR.print.warn]",e),t.contentWindow.print()}else t.contentWindow.print()}catch(t){throw Error(`[SUNEDITOR.print.fail] error: ${t.message}`)}finally{this.ui.hideLoading(),gt.utils.removeItem(t)}}),1e3)},preview(){this.menu.dropdownOff(),this.menu.containerOff(),this.ui._offCurrentController(),this.ui._offCurrentModal();const t=this.options.get("previewTemplate")?this.options.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get({withFrame:!0})):this.html.get({withFrame:!0}),e=this._w.open("","_blank"),i=this.editor.frameContext.get("_wd"),s=this.options.get("_rtl")?" se-rtl":"";if(this.editor.frameOptions.get("iframe")){const n=this.options.get("printClass")?'class="'+this.options.get("printClass")+s+'"':this.editor.frameOptions.get("iframe_fullPage")?gt.utils.getAttributesToString(i.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+s+'"';e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${i.head.innerHTML}\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tbody {overflow:auto !important; height:auto !important;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${n}>\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const i=this._d.head.getElementsByTagName("link"),n=this._d.head.getElementsByTagName("style");let o="";for(let t=0,e=i.length;t<e;t++)o+=i[t].outerHTML;for(let t=0,e=n.length;t<e;t++)o+=n[t].outerHTML;e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<meta charset="utf-8" />\n\t\t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">\n\t\t\t\t\t\t<title>${this.lang.preview}</title>\n\t\t\t\t\t\t${o}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.options.get("printClass")?this.options.get("printClass"):this.options.get("_editableClass"))+s}" style="height:auto">\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}},_resetFullScreenHeight(){if(this.editor.frameContext.get("isFullScreen"))return this.fullScreenInnerHeight+=this._w.innerHeight-this.context.get("toolbar.main").offsetHeight-(this.editor.frameContext.has("statusbar")?this.editor.frameContext.get("statusbar").offsetHeight:0)-this.fullScreenInnerHeight,this.editor.frameContext.get("wrapper").style.height=this.fullScreenInnerHeight+"px",!0},_codeMirrorEditor(t,e,i){const s=i?this.frameRoots.get(i).get("options"):this.editor.frameOptions;switch(t){case"set":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").getDoc().setValue(e):s.has("codeMirror6Editor")&&s.get("codeMirror6Editor").dispatch({changes:{from:0,to:s.get("codeMirror6Editor").state.doc.length,insert:e}});break;case"get":if(s.has("codeMirror5Editor"))return s.get("codeMirror5Editor").getDoc().getValue();if(s.has("codeMirror6Editor"))return s.get("codeMirror6Editor").state.doc.toString();break;case"readonly":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").setOption("readOnly",e):s.has("codeMirror6Editor")&&(e?s.get("codeMirror6Editor").contentDOM.removeAttribute("contenteditable"):s.get("codeMirror6Editor").contentDOM.setAttribute("contenteditable",!0));break;case"refresh":s.has("codeMirror5Editor")&&s.get("codeMirror5Editor").refresh()}},_setCodeView(t){this.options.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.editor.frameContext.get("code").value=t},_getCodeView(){return this.options.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.editor.frameContext.get("code").value},_setCodeDataToEditor(){const t=this._getCodeView();if(this.editor.frameOptions.get("iframe_fullPage")){const e=this.editor.frameContext.get("_wd"),i=(new DOMParser).parseFromString(t,"text/html");if(!this.options.get("__allowedScriptTag")){const t=i.head.children;for(let e=0,s=t.length;e<s;e++)/^script$/i.test(t[e].tagName)&&(i.head.removeChild(t[e]),e--,s--)}let s=i.head.innerHTML;i.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.editor.frameOptions.get("height")||i.head.querySelector("style"))||(s+=pt._setIframeStyleLinks(this.editor.frameOptions.get("iframe_cssFileName"))+pt._setAutoHeightStyle(this.editor.frameOptions.get("height"))),e.head.innerHTML=s,e.body.innerHTML=this.html.clean(i.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")});const n=i.body.attributes;for(let t=0,i=n.length;t<i;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!gt.utils.hasClass(e.body,"sun-editor-editable")){const t=this.options.get("_editableClass").split(" ");for(let i=0;i<t.length;i++)gt.utils.addClass(e.body,this.options.get("_editableClass")[i])}}else this.editor.frameContext.get("wysiwyg").innerHTML=t.length>0?this.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")}):"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">"},_setEditorDataToCodeView(){const t=this.html._convertToCode(this.editor.frameContext.get("wysiwyg"),!1);let e="";if(this.editor.frameOptions.get("iframe_fullPage")){const i=gt.utils.getAttributesToString(this.editor.frameContext.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.editor.frameContext.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+i+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)},_codeViewAutoHeight(t,e,i){i&&(t.style.height=t.scrollHeight+"px"),this._updateLineNumbers(e,t)},_updateLineNumbers(t,e){if(!t)return;const i=fs(t),s=Math.ceil(e.scrollHeight/i),n=(t.value.match(/\n/g)||[]).length;if(s>n){let e="";for(let t=n+1;t<=s;t++)e+=`${t}\n`;t.value+=e}},_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft},constructor:ms};const _s=ms,bs=".se-menu-list .se-toolbar-btn[data-command]",ys=`${bs}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,vs=`${bs}:not([class~="se-component-enabled"]):not([data-type="MORE"])`;function Cs(t,e){const i=t[0].target.ownerDocument||dt._d,s=i.defaultView||dt._w,n=Pt(t,e);this.rootKeys=n.rootKeys,this.frameRoots=n.frameRoots,this.context=n.context,this.frameContext=new Map,this.frameOptions=new Map,this._d=i,this._w=s,this.carrierWrapper=n.carrierWrapper,this.options=n.options,this.plugins=n.plugins||{},this.events=null,this.triggerEvent=null,this.icons=n.icons,this.lang=n.lang,this.status={hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],onSelected:!1,rootKey:n.rootId,_range:null,_onMousedown:!1},this.isClassic=!1,this.isInline=!1,this.isBalloon=!1,this.isBalloonAlways=!1,this.isSubBalloon=!1,this.isSubBalloonAlways=!1,this.allCommandButtons=new Map,this.subAllCommandButtons=new Map,this.shortcutsKeyMap=new Map,this.reverseKeys=[],this.commandTargets=new Map,this.activeCommands=null,this.effectNode=null,this.opendModal=null,this.opendControllers=[],this.currentControllerName="",this.opendBrowser=null,this.selectMenuOn=!1,this.history=null,this.eventManager=null,this.toolbar=null,this.subToolbar=null,this.char=null,this.component=null,this.format=null,this.html=null,this.menu=null,this.nodeTransform=null,this.offset=null,this.selection=null,this.shortcuts=null,this.ui=null,this.viewer=null,this._lineBreaker_t=null,this._lineBreaker_b=null,this._shadowRoot=null,this._onPluginEvents=null,this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,this._controllerTargetContext=null,this._controllerOnDisabledButtons=[],this._codeViewDisabledButtons=[],this._pluginCallButtons=n.pluginCallButtons,this._pluginCallButtons_sub=n.pluginCallButtons_sub,this._responsiveButtons=n.responsiveButtons,this._responsiveButtons_sub=n.responsiveButtons_sub,this._notHideToolbar=!1,this._preventBlur=!1,this._preventFocus=!1,this._preventSelection=!1,this._componentsInfoInit=!0,this._componentsInfoReset=!1,this._MELInfo=null,this._fileInfoPluginsCheck=null,this._fileInfoPluginsReset=null,this._fileManager={tags:null,regExp:null,pluginRegExp:null,pluginMap:null},this._componentManager=[],this._figureContainer=null,this._originOptions=e,this.__Create(e)}function ws(t,e,i,s,n,o){const l=e[t],r=Object.keys(l);if(ks(r,null,t+"."),0===r.length)return!1;const a=t||null;s.set(a,new Map);const h=i.get(a).get("options").get("_origin"),c={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(Tt,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(s.get(a).set(xs(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}function xs(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}function ks(t,e,i){for(let s,n=0,o=t.length;n<o;n++)s=t[n],("fixed"===Ht[s]||"fixed"===Tt[s]||e&&e[s])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${i+s}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}Cs.prototype={registerPlugin(t,e,i){let s=this.plugins[t];if(!s)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.plugins[t]&&(s=this.plugins[t]=new this.plugins[t](this,i||{}),"function"==typeof s.init&&s.init()),e){for(let t=0,i=e.length;t<i;t++)$t(e[t],s,this.icons,this.lang);this.activeCommands.includes(t)||"function"!=typeof this.plugins[t].active||this.activeCommands.push(t)}},run(t,e,i){if(e){if(/more/i.test(e)){const e=gt.query.getParentElement(i,".se-toolbar"),s=gt.utils.hasClass(e,"se-toolbar-sub")?this.subToolbar:this.toolbar;if(i!==s.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(s._moreLayerOn(i,n),s._showBalloon(),s._showInline()),gt.utils.addClass(i,"on")}else s.currentMoreLayerActiveButton&&(s._moreLayerOff(),s._showBalloon(),s._showInline());return void this.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentContainerActiveButton))return void this.menu.containerOn(i);if(this.frameContext.get("isReadOnly")&>.utils.arrayIncludes(this._controllerOnDisabledButtons,i))return;if(/dropdown/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentDropdownActiveButton))return void this.menu.dropdownOn(i);if(/modal/.test(e))return void this.plugins[t].open(i);/command/.test(e)?this.plugins[t].action(i):/browser/.test(e)?this.plugins[t].open(null):/popup/.test(e)&&this.plugins[t].show()}else t&&this.commandHandler(t,i);/dropdown/.test(e)?this.menu.dropdownOff():/command/.test(e)||(this.menu.dropdownOff(),this.menu.containerOff())},async commandHandler(t,e){if(!this.frameContext.get("isReadOnly")||/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(t))switch(t){case"selectAll":!function(t){t.ui._offCurrentController(),t.menu.containerOff();const e=t.frameContext.get("wysiwyg");let i=null,s="";const n=t.options.get("scopeSelectionTags"),o=t.selection.getRange();if(!o.collapsed){let t=o.commonAncestorContainer,l=t.nodeName?.toLowerCase();for(;t&&(!t.nextSibling&&!t.previousSibling&&!n.includes(l)||gt.check.isContentLess(l))&&t!==e;)t=t.parentElement,l=t.nodeName?.toLowerCase();n.includes(l)&&(i=t,s=l)}const l=n.filter((t=>t!==s));let r=gt.query.getParentElement(i||t.selection.getNode(),(t=>l.includes(t.nodeName?.toLowerCase())))||e,{first:a,last:h}=Zt(r);if(!a||!h)return;const c=gt.check.isZeroWidth;for(;c(a)&&c(h)&&r!==e;)r=r.parentElement,({first:a,last:h}=Zt(gt.query.getParentElement(r,(t=>l.includes(t.nodeName?.toLowerCase())))||e));if(!a||!h)return;let d=null;if(gt.check.isMedia(a)||(d=t.component.get(a.parentElement))||gt.check.isTableElements(a)){const e=gt.utils.createElement("BR"),i=gt.utils.createElement(t.options.get("defaultLine"),null,e);a=d?d.container||d.cover:a,a.parentElement.insertBefore(i,a),a=e}if(gt.check.isMedia(h)||(d=t.component.get(h.parentElement))||gt.check.isTableElements(h)){const e=gt.utils.createElement("BR"),i=gt.utils.createElement(t.options.get("defaultLine"),null,e);h=d?d.container||d.cover:h,h.parentElement.appendChild(i),h=e}t.toolbar._showBalloon(t.selection.setRange(a,0,h,h.textContent.length))}(this);break;case"copy":{const t=this.selection.getRange();if(t.collapsed)break;const e=gt.utils.createElement("div",null,t.cloneContents());await this.html.copy(e.innerHTML);break}case"newDocument":this.html.set(`<${this.options.get("defaultLine")}><br></${this.options.get("defaultLine")}>`),this.focus(),this.history.push(!1);break;case"codeView":this.viewer.codeView(!this.frameContext.get("isCodeView"));break;case"fullScreen":this.viewer.fullScreen(!this.frameContext.get("isFullScreen"));break;case"indent":this.format.indent();break;case"outdent":this.format.outdent();break;case"undo":this.history.undo();break;case"redo":this.history.redo();break;case"removeFormat":this.format.removeInlineElement(),this.focus();break;case"print":this.viewer.print();break;case"preview":this.viewer.preview();break;case"showBlocks":this.viewer.showBlocks(!this.frameContext.get("isShowBlocks"));break;case"dir":this.setDir(this.options.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.setDir("ltr");break;case"dir_rtl":this.setDir("rtl");break;case"save":await async function(t){const e=t.frameContext;if(!e.get("isChanged"))return;const i=t.html.get(),s=await t.triggerEvent("onSave",{frameContext:e,data:i});if(s===Dt){const t=e.get("originElement");/^TEXTAREA$/i.test(t.nodeName)?t.value=i:t.innerHTML=i}else if(!1===s)return;e.set("isChanged",!1),e.set("savedIndex",t.history.getRootStack()[t.status.rootKey].index),t.applyCommandTargets("save",(t=>{t.disabled=!0}))}(this);break;case"copyFormat":jt(this,e);break;case"pageBreak":!function(t){const e=gt.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});t.component.insert(e,{skipCharCount:!0,skipSelection:!0,skipHistory:!1});const i=e.nextElementSibling||t.format.addLine(e);t.selection.setRange(i,1,i,1),t.history.push(!1)}(this);break;case"pageUp":this.frameContext.get("documentType").pageUp();break;case"pageDown":this.frameContext.get("documentType").pageDown();break;default:!function(t,e){e=t.options.get("_defaultTagCommand")[e.toLowerCase()]||e;let i=t.options.get("convertTextTags")[e]||e;const s=t.status.currentNodesMap,n=s.includes(t.options.get("_styleCommandMap")[i])?null:gt.utils.createElement(i);/^sub$/i.test(i)&&s.includes("superscript")?i="sup":/^sup$/i.test(i)&&s.includes("subscript")&&(i="sub"),t.format.applyInlineElement(n,{stylesToModify:qt[e]||null,nodesToRemove:[i],strictRemove:!1}),t.focus()}(this,t)}},runFromTarget(t){if(gt.check.isInputElement(t))return;const e=gt.query.getCommandTarget(t);if(!e)return;const i=e.getAttribute("data-command"),s=e.getAttribute("data-type");(i||s)&&(e.disabled||this.run(i,s,t))},applyCommandTargets(t,e){this.commandTargets.has(t)&&this.commandTargets.get(t).forEach(e)},applyFrameRoots(t){this.frameRoots.forEach(t)},isEmpty(t){const e=(t=t||this.frameContext).get("wysiwyg");return gt.check.isZeroWidth(e.textContent)&&!e.querySelector(this.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1},setDir(t){const e="rtl"===t;if(this.options.get("_rtl")!==e){try{this.options.set("_rtl",e),this.ui._offCurrentController();const i=this.frameContext,s=this.plugins;for(const e in s)"function"==typeof s[e].setDir&&s[e].setDir(t);const n=this.context.get("toolbar._wrapper"),o=this.context.get("statusbar._wrapper");e?(this.applyFrameRoots((t=>{gt.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),gt.utils.addClass([this.carrierWrapper,n,o],"se-rtl")):(this.applyFrameRoots((t=>{gt.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),gt.utils.removeClass([this.carrierWrapper,n,o],"se-rtl"));const l=gt.query.getListChildren(i.get("wysiwyg"),(t=>this.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)));for(let t,e,i,s=0;t=l[s];s++)t=l[s],i=t.style.marginRight,e=t.style.marginLeft,(i||e)&&(t.style.marginRight=e,t.style.marginLeft=i),i=t.style.textAlign,"left"===i?t.style.textAlign="right":"right"===i&&(t.style.textAlign="left");!function(t,e){const i=t.icons,s=t.commandTargets,n=t.shortcutsKeyMap;t.reverseKeys.forEach((t=>{const e=n.get(t);if(!e)return;const i=e.c;e.c=e.r,e.r=i})),t.applyCommandTargets("dir",(s=>{gt.utils.changeTxt(s.querySelector(".se-tooltip-text"),t.lang[e?"dir_ltr":"dir_rtl"]),gt.utils.changeElement(s.firstElementChild,i[e?"dir_ltr":"dir_rtl"])})),e?(gt.utils.addClass(s.get("dir_rtl"),"active"),gt.utils.removeClass(s.get("dir_ltr"),"active")):(gt.utils.addClass(s.get("dir_ltr"),"active"),gt.utils.removeClass(s.get("dir_rtl"),"active"))}(this,e),i.has("documentType-use-header")&&(e?i.get("wrapper").appendChild(i.get("documentTypeInner")):i.get("wrapper").insertBefore(i.get("documentTypeInner"),i.get("wysiwygFrame"))),i.has("documentType-use-page")&&(e?i.get("wrapper").insertBefore(i.get("documentTypePage"),i.get("wysiwygFrame")):i.get("wrapper").appendChild(i.get("documentTypePage"))),this.isBalloon?this.toolbar._showBalloon():this.isSubBalloon&&this.subToolbar._showBalloon()}catch(t){this.options.set("_rtl",!e),console.warn(`[SUNEDITOR.setDir.fail] ${t.toString()}`)}this.effectNode=null,this.eventManager.applyTagEffect()}},resetOptions(t){this.viewer.codeView(!1),this.viewer.showBlocks(!1);const e=new Map,i=this.frameRoots,s=[],n=new Map,o={};for(const e in t)void 0!==Tt[e]&&(o[e]=t[e],delete t[e]);for(const e of i.keys())t[e||""]={...o,...t[e||""]};const l=Object.keys(t);if(ks(l,this.plugins,""),0===l.length)return;1===i.size&&l.unshift(null);const r=[this._originOptions,t].reduce(((t,o)=>{for(const l in o)i.has(l||null)?ws(l,o,i,e,n,s):t[l]=o[l];return t}),{}),a=this.options,h=Nt(r,s,this.plugins),c=h.o,d=h.frameMap;for(let t,s=0,o=l.length;s<o;s++)if(t=l[s]||null,n.has(t)){const s=e.get(t),n=i.get(t),o=n.get("options"),l=d.get(t);if(n.set("options",l),s.has("statusbar-changed")){if(gt.utils.removeItem(n.get("statusbar")),l.get("statusbar")){const t=At(l,null).statusbar;n.get("container").appendChild(t),xt(t,n),this.eventManager.__addStatusbarEvent(n,l)}else this.eventManager.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),xt(null,n);n.get("statusbar")&&this.char.display(n)}if(s.has("iframe_attributes")){const t=n.get("wysiwygFrame"),e=o.get("iframe_attributes"),i=l.get("iframe_attributes");for(const i in e)t.removeAttribute(i,e[i]);for(const e in i)t.setAttribute(e,i[e])}if(s.has("iframe_cssFileName")){const t=n.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const i=(new DOMParser).parseFromString(pt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,s=t.querySelector("style");for(;i[0];)t.insertBefore(i[0],s)}s.has("placeholder")&&(n.get("placeholder").textContent=l.get("placeholder")),this.ui.setEditorStyle(l.get("editorStyle"),n);const r=n.get("wysiwyg"),a=o.get("editableFrameAttributes"),h=l.get("editableFrameAttributes");for(const t in a)r.removeAttribute(t,a[t]);for(const t in h)r.setAttribute(t,h[t])}else switch(a.set(t,c.get(t)),t){case"theme":this.ui.setTheme(a.get("theme"));break;case"events":{const t=a.get("events");for(const e in t)this.events[e]=t[e];break}case"autoStyleify":this.html.__resetAutoStyleify(a.get("autoStyleify"));break;case"textDirection":this.setDir(a.get("_rtl")?"ltr":"rtl");break;case"historyStackDelayTime":this.history.resetDelayTime(a.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":this.format.__resetBrLineBreak(a.get("defaultLineBreakFormat"))}this._originOptions=r;const u=this.context.get("toolbar.main");/inline|balloon/i.test(a.get("mode"))&&l.includes("toolbar_width")&&(u.style.width=a.get("toolbar_width")),a.get("toolbar_hide")?u.style.display="none":u.style.display="",a.get("shortcutsHint")?gt.utils.removeClass(u,"se-shortcut-hide"):gt.utils.addClass(u,"se-shortcut-hide"),this.effectNode=null,this._setFrameInfo(this.frameRoots.get(this.status.rootKey))},changeFrameContext(t){t!==this.status.rootKey&&(this.status.rootKey=t,this._setFrameInfo(this.frameRoots.get(t)),this.toolbar._resetSticky())},execCommand(t,e,i){this.frameContext.get("_wd").execCommand(t,e,"formatBlock"===t?"<"+i+">":i),this.history.push(!0)},focus(t){if(t&&this.changeFrameContext(t),"none"!==this.frameContext.get("wysiwygFrame").style.display){if(this._preventBlur=!1,this.frameOptions.get("iframe")||!this.frameContext.get("wysiwyg").contains(this.selection.getNode()))this._nativeFocus();else try{const t=this.selection.getRange();if(t.startContainer===t.endContainer&>.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.format.isLine(e)&&!this.component.is(e)){const t=gt.utils.createElement("BR"),i=gt.utils.createElement(this.options.get("defaultLine"),null,t);return this.frameContext.get("wysiwyg").insertBefore(i,e),void this.selection.setRange(t,0,t,0)}}this.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this._nativeFocus()}this.isBalloon&&this.eventManager._toggleToolbarBalloon()}},focusEdge(t){this._preventBlur=!1,t||(t=this.frameContext.get("wysiwyg").lastElementChild);const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=gt.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.selection.setRange(t,t.textContent.length,t,t.textContent.length):this._nativeFocus()):this.focus()},blur(){this.frameOptions.get("iframe")?this.frameContext.get("wysiwygFrame").blur():this.frameContext.get("wysiwyg").blur()},destroy(){this.history.destroy(),this.eventManager._removeAllEvents(),this.options.get("codeMirror6Editor")&&this.options.get("codeMirror6Editor").destroy(),gt.utils.removeItem(this.carrierWrapper),gt.utils.removeItem(this.context.get("toolbar._wrapper")),gt.utils.removeItem(this.context.get("toolbar.sub._wrapper")),gt.utils.removeItem(this.context.get("statusbar._wrapper")),this.applyFrameRoots((t=>{gt.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.options.clear(),this.context.clear();let t=this.plugins;for(const e in t){const i=t[e];"function"==typeof i._destroy&&i._destroy();for(const t in i)delete i[t];delete t[e]}t=this.events;for(const e in t)delete t[e];t=["eventManager","char","component","format","html","menu","nodeTransform","offset","selection","shortcuts","toolbar","ui","viewer"];for(let e,i=0,s=t.length;i<s;i++){e=this[t[i]];for(const t in e)delete e[t]}if(t=this.subToolbar,t)for(const e in t)delete t[e];t=null;for(const t in this)delete this[t];return null},_setFrameInfo(t){this.frameContext=t,this.frameOptions=t.get("options"),t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this._lineBreaker_t=t.get("lineBreaker_t"),this._lineBreaker_b=t.get("lineBreaker_b")},_nativeFocus(){this.selection.__focus(),this.selection._init()},_checkComponents(t){for(let e=0,i=this._fileInfoPluginsCheck.length;e<i;e++)this._fileInfoPluginsCheck[e](t)},_resetComponents(){for(let t=0,e=this._fileInfoPluginsReset.length;t<e;t++)this._fileInfoPluginsReset[t]()},_initWysiwygArea(t,e){t.get("wysiwyg").innerHTML=this.html.clean("string"==typeof e?e:(/^TEXTAREA$/i.test(t.get("originElement").nodeName)?t.get("originElement").value:t.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")})||"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">",t.has("charCounter")&&(t.get("charCounter").textContent=this.char.getLength()),"document"===this.options.get("type")&&(t.set("documentType",new Ke(this,t)),t.get("documentType").useHeader&&t.set("documentType-use-header",!0),t.get("documentType").usePage&&(t.set("documentType-use-page",!0),t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML))},_resourcesStateChange(t){this._iframeAutoHeight(t),this._checkPlaceholder(t),"document"===this.options.get("type")&&t.get("documentType").usePage&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML)},_iframeAutoHeight(t){const e=t.get("_iframeAuto");e?this._w.setTimeout((()=>{const i=e.offsetHeight;t.get("wysiwygFrame").style.height=i+"px",dt.isResizeObserverSupported||this.__callResizeFunction(t,i,null)}),0):dt.isResizeObserverSupported||this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null)},__callResizeFunction(t,e,i){e=-1===e?i?.borderBoxSize&&i.borderBoxSize[0]?i.borderBoxSize[0].blockSize:i.contentRect.height+mt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+mt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:i}),t.set("_editorHeight",e)),t.has("documentType-use-page")&&t.get("documentType").resizePage()},_checkPlaceholder(t){const e=(t=t||this.frameContext).get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.isEmpty(t)?e.style.display="block":e.style.display="none"}},__editorInit(t){this.applyFrameRoots((t=>{this.__setEditorParams(t)})),this._setFrameInfo(this.frameRoots.get(this.status.rootKey)),this.__init(t);for(const t of this._onPluginEvents.values())t.sort(((t,e)=>t.index-e.index));this.applyFrameRoots((t=>{this.eventManager._addFrameEvents(t),this._initWysiwygArea(t,t.get("options").get("value"))})),this.eventManager.__eventDoc=null,this._componentsInfoInit=!1,this._componentsInfoReset=!1,this._checkComponents(!0),this._w.setTimeout((()=>{this.context.get("toolbar.main").style.visibility="",this.applyFrameRoots((t=>{"function"==typeof this._resourcesStateChange&&(this.eventManager._wwFrameObserver&&this.eventManager._wwFrameObserver.observe(t.get("wysiwygFrame")),this.eventManager._toolbarObserver&&this.eventManager._toolbarObserver.observe(t.get("_toolbarShadow")),this._resourcesStateChange(t))})),this.history.reset(),this.triggerEvent("onload",{})}),0)},__init(t){this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this._MELInfo=new Map,this.activeCommands=Yt,this._onPluginEvents=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]),this._fileManager.tags=[],this._fileManager.pluginMap={},this._fileManager.tagAttrs={};const e=this.plugins,i=[];let s;for(const n in e){if(this.registerPlugin(n,this._pluginCallButtons[n],t[n]),this.registerPlugin(n,this._pluginCallButtons_sub[n],t[n]),s=this.plugins[n],"object"==typeof s.__fileManagement){const t=s.__fileManagement;if(this._fileInfoPluginsCheck.push(t._checkInfo.bind(t)),this._fileInfoPluginsReset.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this._fileManager.tags=this._fileManager.tags.concat(e),i.push(n);for(let i,s=0,o=e.length;s<o;s++)i=e[s].toLowerCase(),this._fileManager.pluginMap[i]=n,t.tagAttrs&&(this._fileManager.tagAttrs[i]=t.tagAttrs)}}"function"==typeof s.constructor.component&&this._componentManager.push(function(t,e){return e&&(e=t.component?.call(this,e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(s,s.constructor));const e=s.constructor.options||{};if(this._onPluginEvents.forEach(((t,i)=>{if("function"==typeof s[i]){const n=s[i].bind(s);n.index=e[`eventIndex_${i}`]||e.eventIndex||0,t.push(n)}})),s.retainFormat){const t=s.retainFormat();this._MELInfo.set(t.query,{key:s.constructor.key,method:t.method})}}(this.options.get("buttons").has("pageBreak")||this.options.get("buttons_sub")?.has("pageBreak"))&&this._componentManager.push((t=>t&>.utils.hasClass(t,"se-page-break")?{target:t,launcher:{destroy:t=>{const e=t.previousElementSibling||t.nextElementSibling;gt.utils.removeItem(t),this.focusEdge(e),this.history.push(!1)}}}:null)),this._fileManager.regExp=new RegExp(`^(${this._fileManager.tags.join("|")||"\\^"})$`,"i"),this._fileManager.pluginRegExp=new RegExp(`^(${0===i.length?"\\^":i.join("|")})$`,"i"),delete this._pluginCallButtons,delete this._pluginCallButtons_sub,this.__cachingButtons(),this.__cachingShortcuts()},__cachingButtons(){const t=this.context;this.__setDisabledButtons(),this.__saveCommandButtons(this.allCommandButtons,t.get("toolbar.buttonTray")),this.options.has("_subMode")&&this.__saveCommandButtons(this.subAllCommandButtons,t.get("toolbar.sub.buttonTray"))},__setDisabledButtons(){const t=this.context;this._codeViewDisabledButtons=pt.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(ys)),this._controllerOnDisabledButtons=pt.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(vs)),this.options.has("_subMode")&&(this._codeViewDisabledButtons=this._codeViewDisabledButtons.concat(pt.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(ys))),this._controllerOnDisabledButtons=this._controllerOnDisabledButtons.concat(pt.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(vs))))},__saveCommandButtons(t,e){const i=e.querySelectorAll(bs),s=this.options.get("shortcuts"),n=this.options.get("_reverseCommandArray"),o=this.shortcutsKeyMap,l=this.reverseKeys;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],r=e.getAttribute("data-command"),t.set(r,e),this.__setCommandTargets(r,e),Lt(r,e,s[r],o,n,l)},__cachingShortcuts(){const t=this.options.get("shortcuts"),e=this.options.get("_reverseCommandArray"),i=this.shortcutsKeyMap,s=this.reverseKeys;for(const n of Object.keys(t))n.startsWith("_")&&Lt("",null,t[n],i,e,s)},__setCommandTargets(t,e){if(!t||!e)return;(Xt.includes(t)||this.plugins[t])&&(this.commandTargets.get(t)?this.commandTargets.get(t).includes(e)||this.commandTargets.get(t).push(e):this.commandTargets.set(t,[e]))},__setIframeDocument(t,e,i){t.setAttribute("scrolling","auto"),t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+pt._setIframeStyleLinks(i.get("iframe_cssFileName"))+pt._setAutoHeightStyle(i.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")},__setEditorParams(t){const e=t.get("options"),i=this._w;if(t.set("wwComputedStyle",i.getComputedStyle(t.get("wysiwyg"))),!e.get("iframe")&&"function"==typeof ShadowRoot){let e=t.get("wysiwygFrame");for(;e;){if(e.shadowRoot){this._shadowRoot=e.shadowRoot;break}if(e instanceof ShadowRoot){this._shadowRoot=e;break}e=e.parentNode}}const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e]);e.get("iframe")?(t.set("_ww",t.get("wysiwygFrame").contentWindow),t.set("_wd",t.get("wysiwygFrame").contentDocument),t.set("wysiwyg",t.get("_wd").body),e.get("_defaultStyles").editor&&(t.get("wysiwyg").style.cssText=e.get("_defaultStyles").editor),"auto"===e.get("height")&&t.set("_iframeAuto",t.get("_wd").body)):(t.set("_ww",i),t.set("_wd",this._d))},__registerClass(){this.events={...Ge,...this.options.get("events")},this.triggerEvent=async(t,e)=>{if("false"===e?.frameContext?.get("wysiwyg").getAttribute("contenteditable"))return!1;const i=this.events[t];return"function"==typeof i?await i({editor:this,...e}):dt.NO_EVENT},this.history=Kt(this),this.eventManager=new Ue(this),this.offset=new is(this),this.shortcuts=new ls(this),this.toolbar=new hs(this,{keyName:"toolbar",balloon:this.isBalloon,balloonAlways:this.isBalloonAlways,inline:this.isInline,res:this._responsiveButtons}),this.options.has("_subMode")&&(this.subToolbar=new hs(this,{keyName:"toolbar.sub",balloon:this.isSubBalloon,balloonAlways:this.isSubBalloonAlways,inline:!1,res:this._responsiveButtons_sub})),this.selection=new ns(this),this.html=new Ui(this),this.nodeTransform=new Qi(this),this.component=new Oi(this),this.format=new Pi(this),this.menu=new Ki(this),this.char=new ei(this),this.ui=new gs(this),this.viewer=new _s(this),Je.call(this.eventManager,this),Je.call(this.char,this),Je.call(this.component,this),Je.call(this.format,this),Je.call(this.html,this),Je.call(this.menu,this),Je.call(this.nodeTransform,this),Je.call(this.offset,this),Je.call(this.selection,this),Je.call(this.shortcuts,this),Je.call(this.toolbar,this),Je.call(this.ui,this),Je.call(this.viewer,this),this.options.has("_subMode")&&Je.call(this.subToolbar,this),delete this.eventManager.eventManager,delete this.char.char,delete this.component.component,delete this.format.format,delete this.html.html,delete this.menu.menu,delete this.nodeTransform.nodeTransform,delete this.offset.offset,delete this.selection.selection,delete this.shortcuts.shortcuts,delete this.toolbar.toolbar,delete this.ui.ui,delete this.viewer.viewer,this.subToolbar&&delete this.subToolbar.subToolbar,this._responsiveButtons=this._responsiveButtons_sub=null},async __Create(t){this.isInline=/inline/i.test(this.options.get("mode")),this.isBalloon=/balloon/i.test(this.options.get("mode")),this.isBalloonAlways=/balloon-always/i.test(this.options.get("mode")),this.isClassic=/classic/i.test(this.options.get("mode")),this.isSubBalloon=/balloon/i.test(this.options.get("_subMode")),this.isSubBalloonAlways=/balloon-always/i.test(this.options.get("_subMode")),this.__registerClass(),this.eventManager._addCommonEvents();const e=[];this.applyFrameRoots((t=>{const i=t.get("originElement"),s=t.get("topArea");if(i.style.display="none",s.style.display="block",i.parentNode.insertBefore(s,i.nextElementSibling),t.get("options").get("iframe")){const i=new Promise((e=>{this.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:i})=>{this.__setIframeDocument(i,this.options,t.get("options")),e()}))}));e.push(i)}})),this.applyFrameRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&(this.options.get("_rtl")?t.get("wrapper").appendChild(t.get("documentTypeInner")):t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame"))),t.get("documentTypePage")&&(this.options.get("_rtl")?t.get("wrapper").insertBefore(t.get("documentTypePage"),t.get("wysiwygFrame")):t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror")))})),e.length>0&&await Promise.all(e),this.__editorInit(t)},Constructor:Cs};const Es=Cs,Ss={init(t){return{create:(e,i)=>this.create(e,i,t)}},create(t,e,i){if("object"!=typeof e&&(e={}),i&&(e=[i,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,i])=>{if("plugins"===e&&i&&t[e]){const s=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(i)?i:Object.values(i);t[e]=[...n.filter((t=>!s.includes(t))),...s]}else t[e]=i})),t)),{})),!t)throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element");const s=[];if(1===t.nodeType)s.push({key:null,target:t});else{let e;for(const i in t){if(e=t[i],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=i,s.push(e)}}return new Es(s,e)}};const Ts=class extends ii{static key="blockquote";static type="command";static className="";constructor(t){super(t),this.title=this.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=gt.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}action(){const t=gt.query.getParentElement(this.selection.getNode(),"blockquote");t?this.format.removeBlock(t,{selectedFormats:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}):this.format.applyBlock(this.quoteTag.cloneNode(!1))}};async function Hs(t,e,i){if(4===t.readyState)if(200===t.status)try{await e(t)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=t.responseText?JSON.parse(t.responseText):t;let s="";"function"==typeof i&&(s=await i(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${s||e.errorMessage||t.responseText}`;this.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}}}const Ls=class{constructor(t,e){this.editor=t.editor,this.ui=this.editor.ui,this.kind=t.constructor.key||t.constructor.name,this._xhr=dt.getXMLHttpRequest(),this.method=e?.method,this.url=e?.url,this.headers=e?.headers,this.data=e?.data,this.callBack=e?.callBack,this.errorCallBack=e?.errorCallBack,this.responseType=e?.responseType}call({method:t,url:e,headers:i,data:s,callBack:n,errorCallBack:o,responseType:l}){this.cancel(),t=t||this.method,e=this._normalizeUrl(e||this.url),i=i||this.headers,s=s||this.data,n=n||this.callBack,o=o||this.errorCallBack,l=l||this.responseType;const r=this._xhr;if(l&&(r.responseType=l),r.onreadystatechange=Hs.bind(this,r,n,o),r.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)r.setRequestHeader(t,i[t]);r.send(s)}asyncCall({method:t,url:e,headers:i,data:s,responseType:n}){this.cancel(),t=t||this.method,e=this._normalizeUrl(e||this.url),i=i||this.headers,s=s||this.data,n=n||this.responseType;const o=this._xhr;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)o.setRequestHeader(t,i[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.ui.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t)}finally{this.ui.hideLoading()}},o.onerror=()=>{l(new Error("Network error"))},o.send(s)}))}cancel(){this._xhr&&this._xhr.abort()}_normalizeUrl(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}},{_w:Ms,_d:Ns}=dt;const As=class extends ii{static key="exportPDF";static type="command";static className="se-component-enabled";constructor(t,e){super(t),this.title=this.lang.exportPDF,this.icon="PDF",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.apiUrl?this.apiManager=new Ls(this,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"}):console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.')}async action(){if(!this.apiUrl)return void console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.');this.ui.showLoading();let t=null;try{const e=this.editor.frameContext.get("documentTypePageMirror")||this.editor.frameContext.get("wysiwygFrame"),i=gt.utils.createElement("div",{class:e.className},e.innerHTML);t=gt.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},i);const s=this._w.getComputedStyle(e).padding,n=gt.utils.applyInlineStylesAll(i,!0,this.options.get("allUsedStyles"));if(n.style.padding=n.style.paddingTop=n.style.paddingBottom=n.style.paddingLeft=n.style.paddingRight="0",t.innerHTML=`\n\t\t\t\t<style>\n\t\t\t\t\t@page {\n\t\t\t\t\t\tsize: A4;\n\t\t\t\t\t\tmargin: ${s};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${n.outerHTML}`,Ns.body.appendChild(t),!1===await this.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this._createByServer(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{gt.utils.removeItem(t),this.ui.hideLoading()}}async _createByServer(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},i=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==i.status){const t=i.responseText?JSON.parse(i.responseText):i;throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t.errorMessage}`)}const s=new Blob([i.response],{type:"application/pdf"}),n=i.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(s),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=gt.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Ns.body.appendChild(r),r.click()}finally{Ms.setTimeout((()=>{gt.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}};function Bs(t,e){const i=t.getAttribute(`data-se-${e}`);if(i)return i;const s=t.getAttribute(`data-${e}`);return s?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,s),s):null}const Is=class extends Jt{constructor(t,e){super(t.editor),this.ui=this.editor.ui,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.component=t.editor.component,this.query=e.query,this.loadHandler=e.loadHandler,this.eventHandler=e.eventHandler,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new Ls(this,null),this._resetInfo,this._checkInfo}upload(t,e,i,s,n){this.ui.showLoading();let o=null;if("length"in i){o=new FormData;for(let t=0,e=i.length;t<e;t++)o.append("file-"+t,i[t]);this.uploadFileLength=i.length}else o=i.formData,this.uploadFileLength=i.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:s,errorCallBack:n})}async asyncUpload(t,e,i){this.ui.showLoading();let s=null;if("length"in i){s=new FormData;for(let t=0,e=i.length;t<e;t++)s.append("file-"+t,i[t]);this.uploadFileLength=i.length}else s=i.formData,this.uploadFileLength=i.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:s})}setFileData(t,{name:e,size:i}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",i+""))}_setInfo(t,e){let i=Number(Bs(t,"index")),s=null,n="";if(e||(e={name:Bs(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(Bs(t,"file-size"))||0}),!i||this.editor._componentsInfoInit)n="create",i=this.infoIndex++,t.setAttribute("data-se-index",i+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),s={src:t.src,index:i,name:e.name,size:e.size},this.infoList.push(s);else{n="update",i*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(i===this.infoList[t].index){s=this.infoList[t];break}s||(i=this.infoIndex++,s={index:i},this.infoList.push(s)),s.src=t.src,s.name=Bs(t,"file-name"),s.size=Number(Bs(t,"file-size"))}s.element=t,s.delete=function(t){"function"==typeof this.inst.destroy&&this.inst.destroy.call(this.inst,t),this._deleteInfo(Number(Bs(t,"index")))}.bind(this,t),this._deleteInfo,s.select=function(t){t.scrollIntoView(this.options.get("componentScrollToOptions"));const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):"function"==typeof this.inst.select&&this.inst.select(t)}.bind(this,t);const o={editor:this.editor,element:t,index:i,state:n,info:s,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};"function"==typeof this.eventHandler&&this.eventHandler(o),this.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}getSize(){let t=0;for(let e=0,i=this.infoList.length;e<i;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.editor.frameContext.get("wysiwyg").querySelectorAll(this.query)),i=this.infoList;if(e.length===i.length){if(this.editor._componentsInfoReset){for(let t=0,i=e.length;t<i;t++)this._setInfo(e[t],null);return}{let t=!1;for(let s,n=0,o=i.length;n<o;n++)if(s=i[n],0===e.filter((function(t){return s.src===t.src&&s.index.toString()===Bs(t,"index")})).length){t=!0;break}if(!t)return}}const s=[],n=[];for(let t=0,e=i.length;t<e;t++)n[t]=i[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();Bs(t,"index")&&n.includes(Number(Bs(t,"index")))?s.push(Number(Bs(t,"index"))):(s.push(this.infoIndex),t.removeAttribute("data-se-index"),this._setInfo(t,null))}if(t&&"function"==typeof this.loadHandler)this.loadHandler(i);else for(let t,e=0;e<i.length;e++){if(t=i[e].index,s.includes(t))continue;i.splice(e,1);const n={editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};"function"==typeof this.eventHandler&&this.eventHandler(n),this.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t="function"==typeof this.eventHandler,e={editor:this.editor,element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let i=0,s=this.infoList.length;i<s;i++)t&&this.eventHandler({...e,index:this.infoList[i].index,pluginName:this.kind}),this.triggerEvent("onFileManagerAction",{...e,index:this.infoList[i].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}_deleteInfo(t){if(t>=0)for(let e=0,i=this.infoList.length;e<i;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void("function"==typeof this.eventHandler&&this.eventHandler({editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}},{NO_EVENT:Vs}=dt;class Os extends ii{static key="fileUpload";static type="command";static className="";static options={eventIndex:1e4};static component(t){return gt.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}constructor(t,e){super(t),this.title=this.lang.fileUpload,this.icon="file_upload",e.uploadUrl||console.warn('[SUNEDITOR.fileUpload.warn] "fileUpload" plugin must be have "uploadUrl" option.'),this.uploadUrl=e.uploadUrl,this.uploadHeaders=e.uploadHeaders,this.uploadSizeLimit=mt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=mt.get(e.uploadSingleSizeLimit,0),this.allowMultiple=!!e.allowMultiple,this.acceptedFormats="string"!=typeof e.acceptedFormats?"*":e.acceptedFormats.trim()||"*",this._acceptedCheck=this.acceptedFormats.split(", "),this.as=e.as||"box",this.input=gt.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this._element=null;const i={"custom-download":{command:"download",title:this.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&>.utils.createElement("A",{href:e},null).click()}},"custom-as":{command:"as",value:"link",title:this.lang.asLink,icon:"reduction",action:(t,e)=>{this.convertFormat(t,e)}}},s=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?i[t]:t))));if(this.figure=new yi(this,s,{}),this.fileManager=new Is(this,{query:"a[download][data-se-file-download]",loadHandler:this.events.onFileLoad,eventHandler:this.events.onFileAction}),/\bedit\b/.test(JSON.stringify(s))){const t=function({lang:t,icons:e}){const i=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" />\n\t\t\t\t<button type="submit" data-command="edit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.controller=new hi(this,t,{position:"bottom",disabled:!0},Os.key),this.editInput=t.querySelector("input")}this.eventManager.addEvent(this.input,"change",this.#E.bind(this))}action(){this.editor._preventBlur=!0,this.input.click()}select(t){this._element=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(!gt.check.isFigure(t.parentElement))return e.innerHTML=this.icons.expansion+gt.utils.createTooltipInner(this.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0;e.innerHTML=this.icons.reduction+gt.utils.createTooltipInner(this.lang.asLink),e.setAttribute("data-value","link"),this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})}onFilePasteAndDrop({file:t}){const e=t.type;if(this._acceptedCheck.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0))))return this.submitFile([t]),this.editor.focus(),!1}edit(t){this.editInput.value=t.textContent,this.figure.controllerHide(),this.controller.open(t,null,{isWWTarget:!gt.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this._element.textContent=this.editInput.value}this.controller.close(),this.component.select(this._element,Os.key)}}async destroy(t){if(!t)return;const e=yi.GetContainer(t),i=gt.query.getParentElement(t,".se-component")||t;if(!1===await this.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const s=this.component.isInline(i)?i.previousSibling||i.nextSibling:i.previousElementSibling||i.nextElementSibling;gt.utils.removeItem(i),this.ui._offCurrentController(),this.editor.focusEdge(s),this.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,s&&s>o){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onFileUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Vs?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable total files: "+n/1e3+"KB",i=await this.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Vs?t:i||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:i},r=async function(t,e,i){e=i||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#S.bind(this),l),a=await this.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Vs||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=yi.GetContainer(t),i=e.nextElementSibling,s=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),gt.utils.addClass(t,"se-component|se-inline-component");const n=gt.utils.createElement(this.options.get("defaultLine"),null,t);s.insertBefore(n,i),gt.utils.removeItem(e)}else{this.selection.setRange(t,0,t,1);const e=this.html.remove(),i=this.nodeTransform.split(e.container,e.offset,0);i?.previousElementSibling&>.check.isZeroWidth(i.previousElementSibling)&>.utils.removeItem(i.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),gt.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const s=yi.CreateContainer(t,"se-file-figure se-flex-component");(i||e.container).parentElement.insertBefore(s.container,i)}this.history.push(!1),this.component.select(t,Os.key)}create(t,e,i){const s=e.name||t,n=gt.utils.createElement("A",{href:t,title:s,download:s,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},s);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.component.insert(n,{skipCharCount:!1,skipSelection:!1,skipHistory:!1});const o=yi.CreateContainer(n);if(gt.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.component.insert(o.container,{skipCharCount:!1,skipSelection:!i||!this.options.get("componentAutoSelect"),skipHistory:!1})){if(i)if(this.options.get("componentAutoSelect"))this.component.select(n,Os.key);else{const t=this.format.addLine(o.container,null);t&&this.selection.setRange(t,0,t,0)}}else this.editor.focus()}_register(t){t.result.forEach(((t,e,i)=>{this.create(t.url,{name:t.name,size:t.size},e===i.length-1)}))}async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Vs?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}#S(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)}async#E(t){const e=gt.query.getEventTarget(t);await this.submitFile(e.files)}}const Rs=Os;class zs extends ii{static key="list_bulleted";static type="command";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.bulletedList,this.icon="list_bulleted",this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":zs.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.bulletedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${e=["disc","circle","square"],e.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ul style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}\n\t\t</ul>\n\t</div>`;var e;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ul"),this.menu.initDropdownTarget({key:zs.key,type:"dropdown"},e)}active(t,e){return gt.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"disc":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?gt.utils.addClass(e.parentElement,"active"):gt.utils.removeClass(e.parentElement,"active")}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ul")?.style.listStyleType;gt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}shortcut({range:t,info:e}){const{startContainer:i}=t;if(gt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.textContent=t}this.submit()}submit(t){const e=this.format.applyList(`ul:${t||""}`,null,!1);e&&this.selection.setRange(e.sc,e.so,e.ec,e.eo),this.editor.focus(),this.history.push(!1)}}const $s=zs;class Fs extends ii{static key="list_numbered";static type="command";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.numberedList,this.icon="list_numbered",this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Fs.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.numberedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${Ps(["decimal","upper-roman","lower-roman"])}\n\t\t</ul>\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t${Ps(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ol"),this.menu.initDropdownTarget({key:Fs.key,type:"dropdown"},e)}active(t,e){return gt.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"decimal":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?gt.utils.addClass(e.parentElement,"active"):gt.utils.removeClass(e.parentElement,"active")}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ol")?.style.listStyleType;gt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}shortcut({range:t,info:e}){const{startContainer:i}=t;if(gt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.textContent=t}this.submit()}submit(t){const e=this.format.applyList(`ol:${t||""}`,null,!1);e&&this.selection.setRange(e.sc,e.so,e.ec,e.eo),this.editor.focus(),this.history.push(!1)}}function Ps(t){return t.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ol style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ol>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}const Ds=Fs,{debounce:qs}=pt;const Ws=class extends ii{static key="mention";static type="field";static className="";constructor(t,e){super(t),this.title=this.lang.mention,this.icon="mention",this.triggerText=e.triggerText||"@",this.limitSize=e.limitSize||5,this.searchStartLength=e.searchStartLength||0,this.delayTime="number"==typeof e.delayTime?e.delayTime:200,this.directData=e.data,this.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(this.limitSize))||"",this._delay=0,this._lastAtPos=0,this._anchorOffset=0,this._anchorNode=null,this.apiManager=new Ls(this,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null;const i=gt.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new ci(this,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new hi(this,i,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(i.firstElementChild,this.#T.bind(this)),this.onInput=qs(this.onInput.bind(this),this.delayTime)}async onInput(){this.directData||this.apiManager.cancel();const t=this.selection.get();if(!t.rangeCount)return this.selectMenu.close(),!0;const e=t.anchorNode,i=t.anchorOffset,s=e.textContent.substring(0,i),n=s.lastIndexOf(this.triggerText);if(n>-1){const t=s.substring(n+1,i),o=s[n-1]?.trim();if(!/\s/.test(t)&&(!o||gt.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return!0;const s=e.parentNode;if(gt.check.isAnchor(s)&&!s.getAttribute("data-se-mention"))return!0;try{const s=await this._createMentionList(t,e);return this._lastAtPos=n,this._anchorNode=e,this._anchorOffset=i,!s}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}return this.selectMenu.close(),!0}async _createMentionList(t,e){const i=this.limitSize,s=t.toLowerCase();let n=null;if(this.cachingData&&(n=this.cachingData.get(t)),!n)if(this.directData)n=this.directData.filter((t=>t.key.toLowerCase().startsWith(s))).slice(0,i);else{const e=await this.apiManager.asyncCall({method:"GET",url:this._createUrl(t)});n=JSON.parse(e.responseText)}if(this.cachingFieldData){const t=new Set;n=this.cachingFieldData.concat(n).filter((({key:e})=>!t.has(e)&&(t.add(e),e.toLowerCase().startsWith(s)))).slice(0,i)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,i=n.length;e<i;e++)t=n[e],o.push(t),l.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===o.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(o,l),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,o),!0)}_createUrl(t){return this.apiUrl.replace(/\{key\}/i,t)}#T(t){if(!t)return!1;let e=null;const{key:i,name:s,url:n}=t,o=this._anchorNode.parentNode;if(gt.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",i),e.setAttribute("href",n),e.setAttribute("title",s),e.textContent=this.triggerText+i;else if(this.selection.setRange(this._anchorNode,this._lastAtPos,this._anchorNode,this._anchorOffset),e=gt.utils.createElement("A",{"data-se-mention":i,href:n,title:s,target:"_blank"},this.triggerText+i),!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=gt.utils.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.selection.setRange(l,1,l,1),this.cachingFieldData&&!this.cachingFieldData.some((e=>e.key===t.key))&&this.cachingFieldData.push(t)}};class Us extends ii{static key="align";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.align,this.icon=this.options.get("_rtl")?"align_right":"align_left";const i=function({lang:t,icons:e,options:i},s){const n=Array.isArray(s)?s:i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let i,s,l=0;l<n.length;l++)i=n[l],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${i}" title="${s}" aria-label="${s}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+i]}</span>${s}\n\t\t\t</button>\n\t\t</li>`;return gt.utils.createElement("div",{class:"se-dropdown se-list-layer se-list-align"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${o}</ul>\n\t\t</div>`)}(t,e.items),s=this._itemMenu=i.querySelector("ul");this.defaultDir=t.options.get("_rtl")?"right":"left",this.alignIcons={justify:t.icons.align_justify,left:t.icons.align_left,right:t.icons.align_right,center:t.icons.align_center},this.alignList=s.querySelectorAll("li button"),this.menu.initDropdownTarget(Us,i)}active(t,e){const i=e.firstElementChild;if(t){if(this.format.isLine(t)){const s=t.style.textAlign;return s?(gt.utils.changeElement(i,this.alignIcons[s]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",s),!0):void 0}}else gt.utils.changeElement(i,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const i=this.alignList;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?gt.utils.addClass(i[t],"active"):gt.utils.removeClass(i[t],"active")}setDir(t){const e="rtl"===t?"right":"left";if(this.defaultDir===e)return;this.defaultDir=e;const i=this._itemMenu.querySelector('[data-command="left"]'),s=this._itemMenu.querySelector('[data-command="right"]');if(i&&s){const t=i.parentElement,e=s.parentElement;t.appendChild(s),e.appendChild(i)}}action(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.defaultDir,s=this.format.getLines();for(let t=0,n=s.length;t<n;t++)gt.utils.setStyle(s[t],"textAlign",e===i?"":e);this.editor.effectNode=null,this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)}}const Gs=Us;class Zs extends ii{static key="font";static type="dropdown";static className="se-btn-select se-btn-tool-font";constructor(t,e){super(t),this.title=this.lang.font,this.inner='<span class="se-txt">'+this.lang.font+"</span>"+this.icons.arrow_down;const i=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],s=function({lang:t},e){let i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">(${t.default})</button>\n\t\t\t</li>`;for(let t,s,n=0,o=e.length;n<o;n++)t=e[n],s=t.split(",")[0],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${s}" title="${s}" aria-label="${s}" style="font-family:${t};">${s}</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},i)}(t,i);this.currentFont="",this.fontList=s.querySelectorAll("ul li button"),this.fontArray=i,this.menu.initDropdownTarget(Zs,s)}active(t,e){const i=e.querySelector(".se-txt"),s=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.format.isLine(t))return;if(n=gt.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return gt.utils.changeTxt(i,t),gt.utils.changeTxt(s,this.lang.font+" ("+t+")"),!0}}else{const t=this.status.hasFocus?this.editor.frameContext.get("wwComputedStyle").fontFamily:this.lang.font;gt.utils.changeTxt(i,t),gt.utils.changeTxt(s,this.status.hasFocus?this.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,i=t.querySelector(".se-txt").textContent;if(i!==this.currentFont){for(let t=0,s=e.length;t<s;t++)i===(e[t].getAttribute("data-command")||"").replace(/'|"/g,"")?gt.utils.addClass(e[t],"active"):gt.utils.removeClass(e[t],"active");this.currentFont=i}}async action(t){let e=t.getAttribute("data-command");if(e){if(/[\s\d\W]/.test(e)&&!/^['"].*['"]$/.test(e)&&(e=`"${e}"`),!1===await this.triggerEvent("onFontActionBefore",{value:e}))return;const t=gt.utils.createElement("SPAN",{style:"font-family: "+e+";"});this.format.applyInlineElement(t,{stylesToModify:["font-family"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["font-family"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const Ys=Zs,{isMobile:Xs}=dt,js=240,Ks=120,Js={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Qs,tn=0,en=!1,sn=!1,nn=120,on=120,ln=Js;const{slider:rn,offscreenCanvas:an,offscreenCtx:hn,wheel:cn,wheelCtx:dn,wheelPointer:un,gradientBar:pn,gradientPointer:gn,fanalColorHex:mn,fanalColorBackground:fn}=function(){const t=document.createElement("canvas");t.width=js,t.height=js;const e=`\n\t<div class="se-hue-slider-container" style="width: 240px; height: 240px;">\n <canvas class="se-hue-wheel" width="240" height="240"></canvas>\n <div class="se-hue-wheel-pointer"></div>\n </div>\n <div class="se-hue-gradient-container">\n <canvas class="se-hue-gradient" width="240" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:240px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${Js.hex}</div>\n\t\t<div style="flex: 1; height: 100%; border: 1px solid #fff; outline: 1px solid #000;"></div>\n\t</div>\n\t`,i=gt.utils.createElement("DIV",{class:"se-hue-slider"},e),s=i.querySelector(".se-hue-wheel"),n=i.querySelector(".se-hue-gradient"),o=i.querySelector(".se-hue-final-hex").children;return{slider:i,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:s,wheelCtx:s.getContext("2d"),wheelPointer:i.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:i.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function _n(t){const{target:e,touches:i}=t,s=i[0].clientX,n=i[0].clientY;e===cn?(t.preventDefault(),sn=!1,en=!0,Cn(s,n)):e===pn&&(t.preventDefault(),sn=!0,en=!1,wn(s))}function bn(t){t.preventDefault();const{touches:e}=t,i=e[0].clientX,s=e[0].clientY;en?Cn(i,s):sn&&wn(i)}function yn({target:t,clientX:e,clientY:i}){t===cn?(sn=!1,en=!0,Cn(e,i)):t===pn&&(sn=!0,en=!1,wn(e))}function vn({clientX:t,clientY:e}){en?Cn(t,e):sn&&wn(t)}function Cn(t,e){const i=cn.getBoundingClientRect();t=t-i.left-Ks,e=e-i.top-Ks;const s=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),Ks),o=Ks+n*Math.cos(s*Math.PI/180),l=Ks+n*Math.sin(s*Math.PI/180);un.style.left=`${o}px`,un.style.top=`${l}px`,function(t,e){nn=t,on=e,xn(kn())}(o,l),En()}function wn(t){const e=pn.getBoundingClientRect();let i=t-e.left;i=Math.max(14,Math.min(i,e.width-14)),gn.style.left=`${i}px`,function(t){const e=pn.getBoundingClientRect();let i=t-e.left;i<0&&(i=0);i>e.width&&(i=e.width);const s=14;i>=pn.width-s?i=pn.width:i<=s&&(i=0);const n=1-i/e.width;tn=n,Hn()}(t),En()}function xn(t){const e=pn.getContext("2d"),i=e.createLinearGradient(0,0,pn.width,0);i.addColorStop(0,"black"),i.addColorStop(1,t.hex),e.fillStyle=i,e.fillRect(0,0,pn.width,pn.height)}function kn(){return Tn(hn)}function En(){Qs.color=ln=Tn(dn),Sn(ln.hex)}function Sn(t){fn.style.backgroundColor=mn.textContent=t}function Tn(t){const e=t.getImageData(nn,on,1,1).data;let[i,s,n]=function([t,e,i]){t/=255,e/=255,i/=255;const s=Math.max(t,e,i),n=Math.min(t,e,i);let o,l;const r=(s+n)/2;if(s===n)o=l=0;else{const a=s-n;switch(l=r>.5?a/(2-s-n):a/(s+n),s){case t:o=(e-i)/a+(e<i?6:0);break;case e:o=(i-t)/a+2;break;case i:o=(t-e)/a+4}o/=6}return[Mn(o),Mn(l),Mn(r)]}(e);const o=nn-Ks,l=on-Ks;Math.sqrt(o*o+l*l)<3&&(n=1-tn),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:h}=function([t,e,i]){let s,n,o;if(0===e)s=n=o=i;else{const l=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},r=i<.5?i*(1+e):i+e-i*e,a=2*i-r;s=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*s),g:Math.round(255*n),b:Math.round(255*o)}}([i,s,n]),c=`#${function({r:t,g:e,b:i}){let s=Math.floor(t).toString(16);t<16&&(s=`0${s}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(i).toString(16);i<16&&(o=`0${o}`);return`${s}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:i,s,l:Mn(n)}}function Hn(){dn.clearRect(0,0,js,js),dn.drawImage(an,0,0),dn.globalAlpha=tn,dn.fillStyle="black",dn.beginPath(),dn.arc(Ks,Ks,Ks,0,2*Math.PI),dn.fill(),dn.globalAlpha=1}function Ln(t){return t*Math.PI/180}function Mn(t){const e=Math.pow(10,10);return Math.round(t*e)/e}!function(t){if(!t)throw new Error("Context not found.");for(let e=0;e<=360;e+=.5)for(let i=0;i<=Ks;i+=1){t.beginPath();const s=50+(Ks-i)/Ks*50;t.fillStyle=`hsl(${e}, 100%, ${s}%)`;const n=Ks+Math.cos(Ln(e))*i,o=Ks-Math.sin(Ln(e))*i;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}}(hn),Hn();const Nn=class{constructor(t,e,i){if(e||(e={}),this.editor=t.editor,this.eventManager=t.eventManager,this.inst=t,this.form=e.form,this.ctx={wheelX:nn,wheelY:on,lightness:tn,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:Js},this.isOpen=!1,this.controlle=null,this.__globalMouseDown=null,this.__globalMouseMove=null,this.__globalMouseUp=null,!e.isNewForm){const s=function({lang:t,icons:e},i){const s=gt.utils.createElement("DIV",{class:`se-controller ${i}`},`\n\t\t<div class="se-hue"></div>\n\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t<button type="button" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t<button type="button" class="se-btn se-btn-danger" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t</div>\n\t`);return s}(t.editor,i);this.form=s.querySelector(".se-hue"),this.controller=new hi(this,s,{position:"top",isWWTarget:!1,...e.controllerOptions}),this.eventManager.addEvent(s.querySelector(".se-btn-success"),"click",(()=>{t.hueSliderAction(this.get()),this.close()})),this.eventManager.addEvent(s.querySelector(".se-btn-danger"),"click",(()=>{this.close()}))}}get(){return ln}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}off(){this.ctx={gradientPointerX:gn.style.left,wheelPointerX:un.style.left,wheelPointerY:un.style.top,wheelX:nn,wheelY:on,lightness:tn,color:Qs?.color||Tn(dn)},this.controller.close(),this.init()}close(){this.off(),this.inst.hueSliderCancelAction()}attach(t){this.init(),(t||this.form).appendChild(rn),Qs=this.ctx,Qs&&(nn=Qs.wheelX,on=Qs.wheelY,tn=Qs.lightness,un.style.left=Qs.wheelPointerX,un.style.top=Qs.wheelPointerY,gn.style.left=Qs.gradientPointerX,Sn(Qs.color.hex),Hn(),xn(kn()));const e={name:"mousedown",func:yn},i={name:"mousemove",func:vn,option:!0},s={name:"mouseup",func:()=>{en=!1,sn=!1}};Xs&&(e.name="touchstart",i.name="touchmove",s.name="touchend",e.func=_n,i.func=bn),this.__globalMouseDown=this.eventManager.addGlobalEvent(e.name,e.func,{passive:!1,capture:!0}),this.__globalMouseMove=this.eventManager.addGlobalEvent(i.name,i.func,!0),this.__globalMouseUp=this.eventManager.addGlobalEvent(s.name,s.func,!0),this.isOpen=!0}init(){this.isOpen=!1,en=!1,sn=!1,this.__globalMouseDown&&(this.__globalMouseDown=this.eventManager.removeGlobalEvent(this.__globalMouseDown)),this.__globalMouseMove&&(this.__globalMouseMove=this.eventManager.removeGlobalEvent(this.__globalMouseMove)),this.__globalMouseUp&&(this.__globalMouseUp=this.eventManager.removeGlobalEvent(this.__globalMouseUp))}},An=["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];function Bn(t,e){const i=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let s=i;for(let n,o,l,r=0,a=t.length;r<a;r++)n=t[r],"string"==typeof n?(o=n,l=n):"object"==typeof n&&(o=n.value,l=n.name||o),r>0&&r%e==0&&(s+=`</ul>${i}`),s+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return s+="</ul>",s}const In=class extends Jt{constructor(t,e,i){const s=t.editor;super(s),this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.target=function({lang:t,icons:e},{colorList:i,disableHEXInput:s,disableRemove:n,splitNum:o}){o=(i=i||An)===An?9:o;let l="";for(let t,e=0,s=i.length,n=[];e<s;e++)t=i[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<s-1)||(n.length>0&&(l+=`<div class="se-selector-color">${Bn(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${Bn(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${s?"":`<button type="button" class="se-btn se-btn-info" title="${t.colorPicker}" aria-label="${t.colorPicker}">${e.color_palette}</button>`}\n\t\t\t<input type="text" class="se-color-input" ${s?"readonly":""} placeholder="${t.color}" />\n\t\t\t${s?"":`<button type="submit" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>`}\n\t\t\t${n?"":`<button type="button" class="se-btn __se_remove" title="${t.remove}" aria-label="${t.remove}">${e.remove_color}</button>`}\n\t\t</form>`,gt.utils.createElement("DIV",{class:"se-list-inner"},l)}(s,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=e,this.splitNum=i.splitNum||0,this.defaultColor=i.defaultColor||"",this.hueSliderOptions=i.hueSliderOptions,this.parentDisplay="",this.currentColor="",this.parentForm=null,this.colorList=this.target.querySelectorAll("li button")||[],this.hueSlider=null;const n=(new DOMParser).parseFromString(this.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Nn(this,i.hueSliderOptions,"se-dropdown"),this.parentFormDisplay=[],this.parentForm=i.hueSliderOptions?.controllerOptions?.parents?.length>0&&!i.hueSliderOptions?.controllerOptions?.isInsideForm?i.hueSliderOptions.controllerOptions.parents:null,this.eventManager.addEvent(this.target.querySelector(".se-btn-info"),"click",this.#H.bind(this)),this.eventManager.addEvent(this.inputElement,"input",this.#L.bind(this)),this.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#M.bind(this))),i.disableRemove||this.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#N.bind(this)),this.eventManager.addEvent(this.target,"click",this.#A.bind(this))}init(t,e,i){this.targetButton=e,"function"!=typeof i&&(i=()=>!1);let s=("string"==typeof t?t:this._getColorInNode(t,i))||this.defaultColor;s=pt.isHexColor(s)?s:pt.rgb2hex(s)||s||"";const n=this.colorList;for(let t,e=0,i=n.length;e<i;e++)t=n[e],s.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),gt.utils.addClass(t,"active")):(gt.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&>.utils.removeItem(this.checkedIcon));this._setInputText(this._colorName2hex(s))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.off()}_setInputText(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}_getColorInNode(t,e){let i="";const s=this.styleProperties;for(;t&&!e(t)&&!gt.check.isWysiwygFrame(t)&&0===i.length;)I(t)&&t.style[s]&&(i=t.style[s]),t=t.parentNode;return i}_colorName2hex(t){if(!t||/^#/.test(t))return t;const e=gt.utils.createElement("div",{style:"display: none; color: "+t}),i=this._w.getComputedStyle(this._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return gt.utils.removeItem(e),i.length>=3?"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substring(1):""}hueSliderAction(t){this._setInputText(t.hex)}hueSliderCancelAction(){this.parentForm?.length>0&&this.parentFormDisplay.forEach((t=>t[0].style.display=t[1]))}#H(){this.parentForm?.length>0&&this.parentForm.forEach((t=>{this.parentFormDisplay.push([t,t.style.display]),t.style.display="none"})),this.hueSlider.open(this.targetButton)}#M(t){t.preventDefault(),"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(this.currentColor)}#A(t){const e=gt.query.getEventTarget(t).getAttribute("data-value");e&&"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(e)}#N(){"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(null)}#L(t){const e=gt.query.getEventTarget(t);this.setHexColor(e.value)}};class Vn extends ii{static key="fontColor";static type="dropdown-free";static className="";constructor(t,e){super(t),this.title=this.lang.fontColor,this.icon="font_color";const i=gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new In(this,"color",{colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{parents:[i],isOutsideForm:!0}}}),i.appendChild(this.colorPicker.target),this.menu.initDropdownTarget(Vn,i)}active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=gt.utils.getStyle(t,"color"))return i.style.color=s,!0}else i.style.color=s;return!1}on(t){this.colorPicker.init(this.selection.getNode(),t,(t=>this.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=gt.utils.createElement("SPAN",{style:"color: "+t+";"});this.format.applyInlineElement(e,{stylesToModify:["color"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["color"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const On=Vn;class Rn extends ii{static key="backgroundColor";static type="dropdown-free";static className="";constructor(t,e){super(t),this.title=this.lang.backgroundColor,this.icon="background_color";const i=gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new In(this,"backgroundColor",{colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{parents:[i],isOutsideForm:!0}}}),i.appendChild(this.colorPicker.target),this.menu.initDropdownTarget(Rn,i)}active(t,e){const i=e.querySelector("path.se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=gt.utils.getStyle(t,"backgroundColor"))return i.style.color=s,!0}else i.style.color=s;return!1}on(t){this.colorPicker.init(this.selection.getNode(),t,(t=>this.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=gt.utils.createElement("SPAN",{style:"background-color: "+t+";"});this.format.applyInlineElement(e,{stylesToModify:["background-color"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["background-color"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const zn=Rn;class $n extends ii{static key="hr";static type="dropdown";static className="";static component(t){return/^hr$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.lang.horizontalLine,this.icon="horizontal_line";const i=function({lang:t},e){const i=e||[{name:t.hr_solid,class:"__se__solid"},{name:t.hr_dashed,class:"__se__dashed"},{name:t.hr_dotted,class:"__se__dotted"}];let s="";for(let t=0,e=i.length;t<e;t++)s+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${i[t].name}" aria-label="${i[t].name}">\n\t\t\t\t<hr${i[t].class?` class="${i[t].class}"`:""}${i[t].style?` style="${i[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-line"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${s}</ul>\n\t\t</div>`)}(t,e.items);this.list=i.querySelectorAll("button"),this.menu.initDropdownTarget($n,i)}select(t){gt.utils.addClass(t,"on")}deselect(t){gt.utils.removeClass(t,"on")}destroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;gt.utils.removeItem(t),this.editor.focusEdge(e),this.history.push(!1)}action(t){const e=this.submit(t.firstElementChild.className),i=this.format.addLine(e);this.selection.setRange(i,1,i,1),this.menu.dropdownOff()}shortcut({line:t,range:e}){const i=this.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),gt.utils.removeItem(t),this.selection.setRange(i,0,i,0)}submit(t){const e=gt.utils.createElement("hr",{class:t});return this.editor.focus(),this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1}),e}}const Fn=$n;class Pn extends ii{static key="list";static type="dropdown";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ol" title="${t.numberedList}" aria-label="${t.numberedList}">\n\t\t\t\t\t${e.list_numbered}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ul" title="${t.bulletedList}" aria-label="${t.bulletedList}">\n\t\t\t\t\t${e.list_bulleted}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(t);this.listItems=e.querySelectorAll("li button"),this.icons={bulleted:t.icons.list_bulleted,numbered:t.icons.list_numbered},this.menu.initDropdownTarget(Pn,e)}active(t,e){const i=e.firstElementChild;if(gt.check.isList(t)){const s=t.nodeName.toLowerCase();return e.setAttribute("data-focus",s),gt.utils.addClass(e,"active"),/^ul$/.test(s)?gt.utils.changeElement(i,this.icons.bulleted):gt.utils.changeElement(i,this.icons.numbered),!0}return e.removeAttribute("data-focus"),gt.utils.changeElement(i,this.icons.number),gt.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",i=this.listItems;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?gt.utils.addClass(i[t],"active"):gt.utils.removeClass(i[t],"active")}action(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value")||"",s=this.format.applyList(`${e}:${i}`,null,!1);s&&this.selection.setRange(s.sc,s.so,s.ec,s.eo),this.menu.dropdownOff(),this.history.push(!1)}}const Dn=Pn,{_w:qn,ON_OVER_COMPONENT:Wn}=dt,Un=".se-table-resize-line",Gn=".se-table-resize-line-prev",Zn=".se-table-resize-row",Yn=".se-table-resize-row-prev",Xn=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],jn={all:"border_all",inside:"border_inside",horizon:"border_horizontal",vertical:"border_vertical",outside:"border_outside",left:"border_left",top:"border_top",right:"border_right",bottom:"border_bottom",none:"border_none"},Kn=["all","inside","horizon","vertical"],Jn="borderLeft",Qn="borderTop",to="borderRight",eo="borderBottom",io=["#b0dbb0","#efef7e","#f2acac","#dcb0f6","#99bdff","#5dbd5d","#e7c301","#f64444","#e57ff4","#4387f1","#27836a","#f69915","#ba0808","#a90bed","#134299","#e4e4e4","#B3B3B3","#808080","#4D4D4D","#000000"];class so extends ii{static key="table";static type="dropdown-free";static className="";static options={isInputComponent:!0};static component(t){return gt.check.isTable(t)?t:null}constructor(t,e){super(t),this.title=this.lang.table,this.icon="table",this.figureScrollList=["se-scroll-figure-xy","se-scroll-figure-x","se-scroll-figure-y"],this.figureScroll="string"==typeof e.scrollType?e.scrollType.toLowerCase():"x",this.captionPosition="bottom"!==e.captionPosition?"top":"bottom",this.cellControllerTop="table"==("cell"!==e.cellControllerPosition?"table":"cell");const i=function(){const t='\n\t<div class="se-table-size">\n\t\t<div class="se-table-size-picker se-controller-table-picker"></div>\n\t\t<div class="se-table-size-highlighted"></div>\n\t\t<div class="se-table-size-unhighlighted"></div>\n\t</div>\n\t<div class="se-table-size-display">1 x 1</div>';return gt.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},t)}(),s=i.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-down se-visible-hidden"></div>\n\t<div class="se-btn-group">\n\t\t<button type="button" data-command="openTableProperties" class="se-btn se-tooltip">\n\t\t\t${e.table_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableProperties}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">\n\t\t\t${e.fixed_column_width}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.fixedColumnWidth}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">\n\t\t\t${e.table_header}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableHeader}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="caption" class="se-btn se-tooltip _se_table_caption">\n\t\t\t${e.caption}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.caption}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">\n\t\t\t${e.reduction}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.minSize}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="copy" class="se-btn se-tooltip">\n\t\t\t${e.copy}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="remove" class="se-btn se-tooltip">\n\t\t\t${e.delete}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t</span>\n\t\t</button>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-table"},i)}(t),o=function({lang:t,icons:e},i){const s=`\n\t<div class="se-arrow se-arrow-${i?"down se-visible-hidden":"up"}"></div>\n <div class="se-btn-group">\n\t\t<button type="button" data-command="openCellProperties" class="se-btn se-tooltip">\n\t\t\t${e.cell_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.cellProperties}</span>\n\t\t\t</span>\n\t\t</button>\n <button type="button" data-command="oncolumn" class="se-btn se-tooltip">\n ${e.table_column}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.column}</span>\n </span>\n </button>\n <button type="button" data-command="onrow" class="se-btn se-tooltip">\n ${e.table_row}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.row}</span>\n </span>\n </button>\n <button type="button" data-command="merge" class="se-btn se-tooltip" style="display: none;">\n ${e.merge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.mergeCells}</span>\n </span>\n </button>\n <button type="button" data-command="onsplit" class="se-btn se-tooltip">\n ${e.split_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.splitCells}</span>\n </span>\n </button>\n\t\t<button type="button" data-command="unmerge" class="se-btn se-tooltip">\n ${e.unmerge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.unmergeCells}</span>\n </span>\n </button>\n </div>`,n=gt.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},s);return{html:n,splitButton:n.querySelector('[data-command="onsplit"]'),columnButton:n.querySelector('[data-command="oncolumn"]'),rowButton:n.querySelector('[data-command="onrow"]'),mergeButton:n.querySelector('[data-command="merge"]'),unmergeButton:n.querySelector('[data-command="unmerge"]')}}(t,this.cellControllerTop),l=function({lang:t,icons:e,options:i}){const s=i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let i,o,l=0;l<s.length;l++)i=s[l],o=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${i}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t</span>\n\t\t</button>`;const o=["top","middle","bottom"];let l="";for(let i,s,n=0;n<o.length;n++)i=o[n],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${i}" title="${s}" aria-label="${s}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s}</span>\n\t\t\t</span>\n\t\t</button>`;const r=`\n\t\t<div class="se-controller-content">\n\t\t\t<div class="se-controller-header">\n\t\t\t\t<button type="button" data-command="close_props" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t\t<span class="se-controller-title">${t.tableProperties}</span>\n\t\t\t</div>\n\t\t\t<div class="se-controller-body">\n\n\t\t\t\t<label>${t.border}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onborder_format" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e[jn.all]}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_onborder_style" class="se-btn se-btn-select se-tooltip se-border-style">\n\t\t\t\t\t\t<span class="se-txt"></span>\n\t\t\t\t\t\t${e.arrow_down}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_border_color" placeholder="${t.color}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="border" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.color_palette}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.colorPicker}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-input-control __se__border_size" placeholder="${t.width}" />\n\t\t\t\t</div>\n\n\t\t\t\t<label>${t.color}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="font" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.font_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.fontColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_font_color" placeholder="${t.fontColor}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="back" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.background_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.backgroundColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_back_color" placeholder="${t.backgroundColor}" />\n\t\t\t\t</div>\n\n\t\t\t\t<label>${t.font}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="bold" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.bold}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.bold}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="underline" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.underline}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.underline}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="italic" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.italic}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.italic}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="strike" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.strike}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.strike}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class="se-table-props-align">\n\t\t\t\t\t<label>${t.align} <span class="__se__a_table_t">( ${t.table} )</span></label>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner">\n\t\t\t\t\t\t<div class="__se__a_h">\n\t\t\t\t\t\t\t${n}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="__se__a_v">\n\t\t\t\t\t\t\t${l}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t\t<button type="button" class="se-btn se-btn-success" data-command="props_submit" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t\t<button type="button" class="se-btn se-btn-danger" data-command="revert" title="${t.revert}" aria-label="${t.revert}">${e.revert}</button>\n\t\t\t</div>\n\t\t</div>`,a=gt.utils.createElement("DIV",{class:"se-controller se-table-props"},r);return{html:a,controller_props_title:a.querySelector(".se-controller-title"),borderButton:a.querySelector('[data-command="props_onborder_style"]'),borderFormatButton:a.querySelector('[data-command="props_onborder_format"]'),cell_alignment:a.querySelector(".se-table-props-align .__se__a_h"),cell_alignment_vertical:a.querySelector(".se-table-props-align .__se__a_v"),cell_alignment_table_text:a.querySelector(".se-table-props-align .__se__a_table_t"),border_style:a.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:a.querySelector(".__se_border_color"),border_width:a.querySelector(".__se__border_size"),back_color:a.querySelector(".__se_back_color"),font_color:a.querySelector(".__se_font_color"),palette_border_button:a.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:a.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:a.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:a.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:a.querySelector('[data-command="props_font_style"][data-value="strike"]')}}(t);t.applyFrameRoots((t=>{t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Un.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Gn.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Zn.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Yn.replace(/^\./,"")}))})),this.controller_cell=new hi(this,o.html,{position:this.cellControllerTop?"top":"bottom"}),this.controller_table=new hi(this,n,{position:"top"}),this.cellControllerTop&&(this.controller_cell.sibling=this.controller_table.form,this.controller_cell.siblingPosition="top");const r=[this.controller_table.form,this.controller_cell.form];this.controller_props=new hi(this,l.html,{position:"bottom",parents:r,isInsideForm:!0}),this.controller_props_title=l.controller_props_title;const a=gt.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.colorPicker=new In(this,"",{colorList:e.colorList||io,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{parents:[a],isOutsideForm:!0}}}),a.appendChild(this.colorPicker.target),this.controller_colorPicker=new hi(this,a,{position:"bottom",parents:[this.controller_props.form].concat(r),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),gt.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.figure=new yi(this,null,{}),this.sliderType="";const h=uo.bind(this,!0),c=uo.bind(this,!1),d=(u=this.lang,{items:["vertical","horizontal"],menus:gt.utils.createElement("DIV",null,`\n\t\t<div title="${u.verticalSplit}" aria-label="${u.verticalSplit}">\n\t\t\t${u.verticalSplit}\n\t\t</div>\n\t\t<div title="${u.horizontalSplit}" aria-label="${u.horizontalSplit}">\n\t\t\t${u.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var u;this.splitButton=o.splitButton,this.selectMenu_split=new ci(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_split.on(this.splitButton,this.#B.bind(this)),this.selectMenu_split.create(d.items,d.menus);const p=function(t,e){const i=gt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertColumnBefore}" aria-label="${t.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${e.insert_column_left}</span><span class="se-txt">${t.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${t.insertColumnAfter}" aria-label="${t.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${e.insert_column_right}</span><span class="se-txt">${t.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${t.deleteColumn}" aria-label="${t.deleteColumn}">\n\t\t\t<span class="se-list-icon">${e.delete_column}</span><span class="se-txt">${t.deleteColumn}</span>\n\t\t</div>`);return{items:["insert-left","insert-right","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),g=o.columnButton;this.selectMenu_column=new ci(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_column.on(g,this.#I.bind(this)),this.selectMenu_column.create(p.items,p.menus);const m=function(t,e){const i=gt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertRowAbove}" aria-label="${t.insertRowAbove}">\n\t\t\t<span class="se-list-icon">${e.insert_row_above}</span><span class="se-txt">${t.insertRowAbove}</span>\n\t\t</div>\n\t\t<div title="${t.insertRowBelow}" aria-label="${t.insertRowBelow}">\n\t\t\t<span class="se-list-icon">${e.insert_row_below}</span><span class="se-txt">${t.insertRowBelow}</span>\n\t\t</div>\n\t\t<div title="${t.deleteRow}" aria-label="${t.deleteRow}">\n\t\t\t<span class="se-list-icon">${e.delete_row}</span><span class="se-txt">${t.deleteRow}</span>\n\t\t</div>`);return{items:["insert-above","insert-below","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),f=o.rowButton;this.selectMenu_row=new ci(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_row.on(f,this.#V.bind(this)),this.selectMenu_row.create(m.items,m.menus);const _=function(){let t="";for(let e,i=0,s=Xn.length;i<s;i++)e=Xn[i],t+=`\n\t\t<div title="${e}" aria-label="${e}" style="padding: 0 12px;">\n\t\t\t<span class="se-txt">${e}</span>\n\t\t</div>`;const e=gt.utils.createElement("DIV",null,t);return{items:Xn,menus:e.querySelectorAll("div")}}(),b=l.borderButton;this.selectMenu_props_border=new ci(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(b,ho.bind(this)),this.selectMenu_props_border.create(_.items,_.menus);const y=po(this.lang,this.icons,[]),v=l.borderFormatButton;this.selectMenu_props_border_format=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(v,co.bind(this,"all")),this.selectMenu_props_border_format.create(y.items,y.menus);const C=po(this.lang,this.icons,Kn);this.selectMenu_props_border_format_oneCell=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(v,co.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(C.items,C.menus),this.maxText=this.lang.maxSize,this.minText=this.lang.minSize,this.propTargets={cell_alignment:l.cell_alignment,cell_alignment_vertical:l.cell_alignment_vertical,cell_alignment_table_text:l.cell_alignment_table_text,border_format:v,border_style:l.border_style,border_color:l.border_color,border_width:l.border_width,back_color:l.back_color,font_color:l.font_color,palette_border_button:l.palette_border_button,font_bold:l.font_bold,font_underline:l.font_underline,font_italic:l.font_italic,font_strike:l.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache="",this.tableHighlight=i.querySelector(".se-table-size-highlighted"),this.tableUnHighlight=i.querySelector(".se-table-size-unhighlighted"),this.tableDisplay=i.querySelector(".se-table-size-display"),this.resizeButton=n.querySelector("._se_table_resize"),this.resizeText=n.querySelector("._se_table_resize > span > span"),this.columnFixedButton=n.querySelector("._se_table_fixed_column"),this.headerButton=n.querySelector("._se_table_header"),this.captionButton=n.querySelector("._se_table_caption"),this.mergeButton=o.mergeButton,this.unmergeButton=o.unmergeButton,this._resizing=!1,this._resizeLine=null,this._resizeLinePrev=null,this._figure=null,this._element=null,this._tdElement=null,this._trElement=null,this._trElements=null,this._tableXY=[],this._maxWidth=!0,this._fixedColumn=!1,this._physical_cellCnt=0,this._logical_cellCnt=0,this._cellCnt=0,this._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._selectedTable=null,this._fixedCell=null,this._selectedCell=null,this._selectedCells=null,this._shift=!1,this.__s=!1,this._fixedCellName=null,this._ref=null,this._bindMultiOn=this.#O.bind(this),this._bindMultiOff=this.#R.bind(this),this._bindShiftOff=this.#z.bind(this),this._bindTouchOff=this.#$.bind(this),this.__globalEvents={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null},this.menu.initDropdownTarget(so,i),this.eventManager.addEvent(s,"mousemove",this.#F.bind(this)),this.eventManager.addEvent(s,"click",this.#P.bind(this))}action(){const t=gt.utils.createElement("TABLE"),e=this._tableXY[0],i=this._tableXY[1],s=`<tbody>${`<tr>${ro("td",e)}</tr>`.repeat(i)}</tbody>`,n=`<colgroup>${`<col style="width: ${mt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+s;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=gt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this._maxWidth=!0,this.component.insert(l,{skipCharCount:!1,skipSelection:!1,skipHistory:!1})){this._resetTablePicker();const e=t.querySelector("td div");this.selection.setRange(e,0,e,0)}}select(t){if(this._figureOpen(t),this._figure||this.setTableInfo(t),this._maxWidth="100%"===this._figure?.style.width,this._fixedColumn=gt.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this._setTableStyle(this._maxWidth?"width|column":"width",!0),Qt.get("__overInfo")===Wn)return;if(!this._tdElement)return;this.setCellInfo(this._tdElement,!0);const e=this._selectedCells?.length>1,i=gt.query.getParentElement(t,gt.check.isFigure);this.controller_table.open(i,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}),this._fixedCell&&(this._setUnMergeButton(),this.controller_cell.open(this._tdElement,this.cellControllerTop?i:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}))}onCopyComponent({event:t,cloneContainer:e}){const i=e.querySelectorAll(".se-selected-table-cell");gt.utils.removeClass(i,"se-selected-table-cell|se-selected-cell-focus"),i.length>0&&(!function(t,e,i){t.preventDefault(),t.stopPropagation();const s=i[0].closest("table"),n=s.cloneNode(!1),o=gt.utils.createElement("tbody");n.appendChild(o);const l=new Map;i.forEach((t=>{l.set(t,!0)}));const r=s.rows,a=r.length,h=Array.from(r[0].cells).reduce(((t,e)=>t+(e.colSpan||1)),0),c=Array.from({length:a},(()=>Array(h).fill(null)));for(let t=0,e=0;t<a;t++,e++){const i=r[t].cells;for(let t=0,s=0,n=i.length;t<n;t++){for(;c[e][s];)s++;const n=i[t],o=n.rowSpan||1,l=n.colSpan||1;for(let t=0;t<o;t++)for(let i=0;i<l;i++)c[e+t][s+i]=n;s+=l}}for(let t=0;t<a;t++){let e;for(let i=0;i<h;i++){const s=c[t][i];if(!s||!l.has(s))continue;if(e||(e=gt.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&c[t][i-1]===s)continue;if(t>0&&c[t-1][i]===s)continue;const n=s.cloneNode(!0);let r=1,d=1;for(;t+r<a&&c[t+r][i]===s;)r++;for(;i+d<h&&c[t][i+d]===s;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=gt.utils.createElement("figure");d.className=e.className,d.appendChild(n);const u=`<html><body>\x3c!--StartFragment--\x3e${d.outerHTML}\x3c!--EndFragment--\x3e</body></html>`;t.clipboardData.setData("text/html",u)}(t,e,i),this.editor.ui.showToast(this.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const i=gt.query.getParentElement(gt.query.getEventTarget(t),gt.check.isTableCell);if(!i)return;const s=e.body;if(1!==s.childElementCount)return;const n=this.component.get(s.firstElementChild);if(n.pluginName!==so.key)return;const o=n.target;return this.pasteTableCellMatrix(o,i),!0}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let i=gt.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows[0],i=function(t){const e=t.rows;let i=0;for(let t=0,s=e.length;t<s;t++){const s=e[t].cells;let n=0;for(let t=0,e=s.length;t<e;t++)n+=s[t].colSpan;i=Math.max(i,n)}return i}(t),s=[];for(let t=0;t<i;t++){let i="";if(e&&e.cells[t]){const s=e.cells[t].style.width;s&&(i=` style="width: ${s};"`,gt.utils.setStyle(e.cells[t],"width",""))}s.push(`<col${i}>`)}const n=gt.utils.createElement("colgroup",null,s.join(""));t.insertBefore(n,t.firstElementChild)}i?gt.utils.addClass(i,"se-flex-component|se-input-component"):(i=gt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(i,t),i.appendChild(t));const s=t.style.width;if(s&&(i.style.width="auto"===s?"max-content":s,gt.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;gt.utils.addClass(i,t),gt.utils.removeClass(i,this.figureScrollList.filter((e=>e!==t)).join("|"))}else gt.utils.removeClass(i,this.figureScrollList.join("|"))}}}setDir(t){this.tableHighlight.style.left="rtl"===t?"167px":"",this._resetTablePicker(),this._resetPropsAlign()}onMouseMove({event:t}){if(this._resizing)return;const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,no);if(!i||1===t.buttons)return void this.__hideResizeLine();const s=oo(t,i);if(s.is)return this._element&&(this._element.style.cursor=""),this.__removeGlobalEvents(),"block"===this._resizeLine?.style.display&&(this._resizeLine.style.display="none"),this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Un),this._setResizeLinePosition(gt.query.getParentElement(i,gt.check.isTable),i,this._resizeLine,s.isLeft),void(this._resizeLine.style.display="block");if(lo(t,i).is)return this.__removeGlobalEvents(),this._element=gt.query.getParentElement(i,gt.check.isTable),this._element.style.cursor="ns-resize","block"===this._resizeLine?.style.display&&(this._resizeLine.style.display="none"),this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Zn),this._setResizeRowPosition(gt.query.getParentElement(i,gt.check.isTable),i,this._resizeLine),void(this._resizeLine.style.display="block");this._element&&(this._element.style.cursor=""),this.__hideResizeLine()}onScroll(){"block"===this._resizeLine?.style.display&&(this._element&&(this._element.style.cursor=""),this._resizeLine.style.display="none")}onMouseDown({event:t}){this._ref=this._selectedCell=null;const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,no);if(!i)return;this.cellControllerTop||this.controller_cell.hide();const s=oo(t,i);if(s.is){try{this._deleteStyleSelectedCells(),this.setCellInfo(i,!0);const t=this._logical_cellIndex+this._current_colSpan-(s.isLeft?1:0);if(this.ui.enableBackWrapper("ew-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Un)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(Gn),t<0||t===this._logical_cellCnt-1)return void this._startFigureResizing(s.startX,t<0);const e=this._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(e,s.startX,mt.get(qn.getComputedStyle(e).width,0),s.isLeft),this._toggleEditor(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}finally{this._fixedCell=this._selectedCell=null}return}const n=lo(t,i);if(n.is)try{let t=gt.query.getParentElement(i,gt.check.isTableRow),e=i.rowSpan;if(e>1)for(;gt.check.isTableRow(t)&&e>1;)t=t.nextElementSibling,--e;this._deleteStyleSelectedCells(),this.setRowInfo(t),this.ui.enableBackWrapper("ns-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Zn)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(Yn),this._startRowResizing(t,n.startY,mt.get(qn.getComputedStyle(t).height,0)),this._toggleEditor(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}finally{this._fixedCell=this._selectedCell=null}else this._shift&&i!==this._fixedCell||(this._deleteStyleSelectedCells(),/^TR$/i.test(i.nodeName)||this.#D(i,!1))}onMouseUp(){this._shift=!1,this.cellControllerTop||this.controller_cell.resetPosition(this._fixedCell)}onMouseLeave(){this.__hideResizeLine()}onKeyDown({event:t,range:e,line:i}){this._ref=null;const s=t.code,n=ft.isTab(s);if(this.editor.selectMenuOn||this._resizing||!n&&this.__s||ft.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.__s=ft.isShift(t),n){this._deleteStyleSelectedCells();const s=gt.query.getParentElement(i,gt.check.isTableCell);if(s&&e.collapsed&>.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.__s;this._shift=this.__s=!1;const i=gt.query.getParentElement(s,"table"),n=gt.query.getListChildren(i,gt.check.isTableCell),o=e?gt.utils.prevIndex(n,s):gt.utils.nextIndex(n,s);if(o===n.length&&!e){if(!gt.query.getParentElement(s,"thead")){const t=i.rows,e=this.insertBodyRow(i,t.length,this._cellCnt).querySelector("td div");this.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return!1;const l=n[o];if(!l)return;const r=l.firstElementChild||l;return this.selection.setRange(r,0,r,0),t.preventDefault(),t.stopPropagation(),!1}}let o=null;if(!ft.isShift(t)){if(o=gt.query.getParentElement(i,gt.check.isTableCell),!gt.utils.hasClass(o,"se-selected-cell-focus"))return;return this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents(),void this._closeController()}return this._shift||this._ref?void 0:(o=o||gt.query.getParentElement(i,gt.check.isTableCell),o?(this.__s=!1,this._fixedCell=o,this._closeController(),this.#D(o,t.shiftKey),!1):void 0)}onKeyUp({line:t}){this.__s=!1,this._shift&>.query.getParentElement(t,gt.check.isTableCell)===this._fixedCell&&(this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents()),this._shift=!1}colorPickerAction(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const{back_color:i,font_color:s,border_color:n}=this.propTargets,o=t.getAttribute("data-value");switch(e){case"header":this.toggleHeader(),this._historyPush();break;case"caption":this.toggleCaption(),this._historyPush();break;case"onsplit":this.selectMenu_split.open();break;case"oncolumn":this.selectMenu_column.open();break;case"onrow":this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this._tdElement?.nodeName)?"none":"",this.selectMenu_row.open();break;case"openTableProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.tableProperties,this._setCtrlProps("table"),this.controller_props.open(t,this.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"openCellProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.cellProperties,this._setCtrlProps("cell"),this.controller_props.open(t,this.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"props_onborder_format":1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open();break;case"props_onborder_style":this.selectMenu_props_border.open();break;case"props_onpalette":this._onColorPalette(t,o,"border"===o?n:"back"===o?i:s);break;case"props_font_style":gt.utils.toggleClass(this.propTargets[`font_${o}`],"on");break;case"props_submit":this._submitProps(t);break;case"revert":{const t=this._propsCache;for(let e=0,i=t.length;e<i;e++)t[e][0].style.cssText=t[e][1];this._setAlignProps(this.propTargets.cell_alignment,this._propsAlignCache,!0),this._setAlignProps(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),gt.check.isTable(t[0][0])&&this._figure&&(this._figure.style.float=this._propsAlignCache);break}case"close_props":this.controller_props.close();break;case"props_align":this._setAlignProps(this.propTargets.cell_alignment,t.getAttribute("data-value"),!1);break;case"props_align_vertical":this._setAlignProps(this.propTargets.cell_alignment_vertical,t.getAttribute("data-value"),!1);break;case"merge":this.mergeCells(this._selectedCells);break;case"unmerge":this.unmergeCells(this._selectedCells);break;case"resize":this._maxWidth=!this._maxWidth,this._setTableStyle("width",!1),this._historyPush(),this.component.select(this._element,so.key,{isInput:!0});break;case"layout":this._fixedColumn=!this._fixedColumn,this._setTableStyle("column",!1),this._historyPush(),this.component.select(this._element,so.key,{isInput:!0});break;case"copy":this.component.copy(this._figure);break;case"remove":{const t=this._figure?.parentNode;gt.utils.removeItem(this._figure),this._closeTableSelectInfo(),t!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(t,(function(t){return 0===t.childNodes.length}),null),this.editor.focus(),this.history.push(!1)}}/(^props_|^revert|Properties$)/.test(e)||(this.controller_props.close(),this.controller_colorPicker.close()),/^(remove|props_|on|open|merge)/.test(e)||this._setCellControllerPosition(this._tdElement,this._shift)}close(){this.__removeGlobalEvents(),this._deleteStyleSelectedCells(),this._toggleEditor(!0),this._figure=null,this._element=null,this._trElement=null,this._trElements=null,this._tableXY=[],this._maxWidth=!1,this._fixedColumn=!1,this._physical_cellCnt=0,this._logical_cellCnt=0,this._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._shift=!1,this._selectedCells=null,this._selectedTable=null,this._ref=null,this._fixedCell=null,this._selectedCell=null,this._fixedCellName=null;const{border_format:t,border_color:e,border_style:i,border_width:s,back_color:n,font_color:o,cell_alignment:l,cell_alignment_vertical:r,font_bold:a,font_underline:h,font_italic:c,font_strike:d}=this.propTargets;gt.utils.removeClass([t,e,i,s,n,o,l,r,a,h,c,d],"on")}selectCells(t){const e=t[0],i=gt.query.findVisualLastCell(t);this._selectedCells=t,this._fixedCell=e,this._selectedCell=i,this._fixedCellName=e.nodeName,this._selectedTable=gt.query.getParentElement(e,"TABLE"),this._setMultiCells(e,i)}setTableInfo(t){const e=this._element=this._selectedTable=gt.query.getParentElement(t,"TABLE");return this._figure=gt.query.getParentElement(e,gt.check.isFigure)||e,e}setCellInfo(t,e){const i=this.setTableInfo(t);if(i&&(this._fixedCell=t,this._trElement=t.parentNode,i.querySelector("thead")?gt.utils.addClass(this.headerButton,"active"):gt.utils.removeClass(this.headerButton,"active"),i.querySelector("caption")?gt.utils.addClass(this.captionButton,"active"):gt.utils.removeClass(this.captionButton,"active"),e||0===this._physical_cellCnt)){this._tdElement!==t&&(this._tdElement=t,this._trElement=t.parentNode),this._selectedCells?.length||(this._selectedCells=[t]);const e=this._trElements=i.rows,s=t.cellIndex;let n=0;for(let t=0,i=e[0].cells,s=e[0].cells.length;t<s;t++)n+=i[t].colSpan;const o=this._rowIndex=this._trElement.rowIndex;this._rowCnt=e.length,this._physical_cellCnt=this._trElement.cells.length,this._logical_cellCnt=this._cellCnt=n,this._physical_cellIndex=s,this._current_colSpan=this._tdElement.colSpan-1,this._current_rowSpan=this._trElement.cells[s].rowSpan-1;let l=[],r=[];for(let t,i,n=0;n<=o;n++){t=e[n].cells,i=0;for(let e,a,h,c,d=0,u=t.length;d<u;d++){if(e=t[d],a=e.colSpan-1,h=e.rowSpan-1,c=d+i,r.length>0)for(let t,e=0;e<r.length;e++)t=r[e],t.row>n||(c>=t.index?(i+=t.cs,c+=t.cs,t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)):d===u-1&&(t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)));if(n===o&&d===s){this._logical_cellIndex=c;break}h>0&&l.push({index:c,cs:a+1,rs:h,row:-1}),i+=a}r=r.concat(l).sort((function(t,e){return t.index-e.index})),l=[]}l=null,r=null}}setRowInfo(t){const e=this.setTableInfo(t),i=this._trElements=e.rows;this._rowCnt=i.length,this._rowIndex=t.rowIndex}editTable(t,e){const i=this._element,s="row"===t;if(s){const t=this._trElement.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?i.innerHTML+="<tbody><tr>"+ro("td",this._logical_cellCnt)+"</tr></tbody>":(gt.utils.removeItem(this._figure),this._closeTableSelectInfo()))}}if(this._ref){const t=this._tdElement,i=this._selectedCells;if(s)if(e)this.setCellInfo("up"===e?i[0]:i[i.length-1],!0),this.editRow(e,null,t);else{let t=i[0].parentNode;const s=[i[0]];for(let e,n=1,o=i.length;n<o;n++)e=i[n],t!==e.parentNode&&(s.push(e),t=e.parentNode);for(let t=0,i=s.length;t<i;t++)this.setCellInfo(s[t],!0),this.editRow(e)}else{const s=i[0].parentNode;if(e){let n=null;for(let t=0,e=i.length-1;t<e;t++)if(s!==i[t+1].parentNode){n=i[t];break}this.setCellInfo("left"===e?i[0]:n||i[0],!0),this.editCell(e,null,t)}else{const t=[i[0]];for(let e,n=1,o=i.length;n<o&&(e=i[n],s===e.parentNode);n++)t.push(e);for(let i=0,s=t.length;i<s;i++)this.setCellInfo(t[i],!0),this.editCell(e)}}e||this.close()}else this[s?"editRow":"editCell"](e);if(!e){const t=i.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(gt.utils.removeItem(t[e]),e--);0===i.children.length&>.utils.removeItem(i)}}editRow(t,e,i){this._deleteStyleSelectedCells(),e&&this.setCellInfo(e,!0);const s=!t,n="up"===t,o=this._rowIndex,l=s||n?o:o+this._current_rowSpan+1,r=s?-1:1,a=this._trElements;let h=this._logical_cellCnt;for(let t,e=0,i=o+(s?-1:0);e<=i;e++){if(t=a[e].cells,0===t.length)return;for(let i,s,n=0,o=t.length;n<o;n++)i=t[n].rowSpan,s=t[n].colSpan,i<2&&s<2||i+e>l&&l>e&&(t[n].rowSpan=i+r,h-=s)}if(s){const t=a[o+1];if(t){const e=[];let i=a[o].cells,s=0;for(let t,n,o=0,l=i.length;o<l;o++)t=i[o],n=o+s,s+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!1),index:n}));if(e.length>0){let n=e.shift();i=t.cells,s=0;for(let o,l,r=0,a=i.length;r<a&&(o=i[r],l=r+s,s+=o.colSpan-1,!(l>=n.index)||(r--,s--,s+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let i=0,s=e.length;i<s;i++)t.appendChild(e[i].cell)}}}this._element.deleteRow(l)}else this.insertBodyRow(this._element,l,h);s?this._closeController():this._setCellControllerPosition(i||this._tdElement,!0)}editCell(t,e,i){e&&this.setCellInfo(e,!0);const s=!t,n="left"===t,o=this._current_colSpan,l=s||n?this._logical_cellIndex:this._logical_cellIndex+o+1,r=this._trElements;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,i,n,g,m=0,f=this._rowCnt;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,i,r,f,_=0,b=e.length;_<b&&(t=e[_],t);_++)if(i=t.rowSpan-1,r=t.colSpan-1,s){if(f=_+g,c.length>0){const t=!e[_+1];for(let e,i=0;i<c.length;i++)e=c[i],e.row>m||(f>=e.index?(g+=e.cs,f=_+g,e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)))}i>0&&h.push({rs:i,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=mt.getOverlapRangeAtIndex(l,l+o,f,f+r):i>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+i}),g+=r}else{if(_>=a)break;if(r>0){if(d<1&&r+_>=a){t.colSpan+=1,a=null,d=i+1;break}a-=r}if(!n){for(let t,e=0;e<c.length;e++)t=c[e],a-=t.cs,t.rs-=1,t.rs<1&&(c.splice(e,1),e--);n=!0}}if(c=c.concat(h).sort((function(t,e){return t.index-e.index})),h=[],!s){if(d>0){d-=1;continue}null!==a&&e.length>0&&(i=ao(e[0].nodeName),i=t.insertBefore(i,e[a]))}}const g=this._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(s)gt.utils.removeItem(t[a]);else{let e=0;for(let i,s=0,n=t.length;s<n;s++)i=mt.get(t[s].style.width),i-=Math.round(i*n*.1/2),e+=i,t[s].style.width=`${i}%`;const i=gt.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(i,t[a])}}if(s){let t,e;for(let i,s=0,n=u.length;s<n;s++)i=u[s].parentNode,gt.utils.removeItem(u[s]),0===i.cells.length&&(t||(t=gt.utils.getArrayIndex(r,i)),e=gt.utils.getArrayIndex(r,i),gt.utils.removeItem(i));for(let i,s=0,n=p.length;s<n;s++)i=p[s],i.cell.rowSpan=mt.getOverlapRangeAtIndex(t,e,i.i,i.rs);this._closeController()}else this._setCellControllerPosition(i||this._tdElement,!0);return i||this._tdElement}pasteTableCellMatrix(t,e){if(!t||!e)return;const i=t.rows;let s=0;const n=[];for(let t=0;t<i.length;t++){const e=i[t].cells;let o=0;for(let i=0;i<e.length;i++){const l=e[i];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(s+=r);for(let e=0;e<r;e++)for(let i=0;i<a;i++)n[t+e]||(n[t+e]=[]),n[t+e][o+i]=!0;o+=a}}let o=0;for(let t=0,e=i[0].cells,s=e.length;t<s;t++){o+=e[t].colSpan||1}const l={rowCnt:s,logicalCellCnt:o};this._deleteStyleSelectedCells();const r=e.closest("table"),{cloneTable:a,clonedSelectedCells:h}=this.#q(r,[e]),c=a;e=h[0];let d=c.rows;this.setTableInfo(c),this.setCellInfo(e,!0);const u={physicalCellCnt:this._physical_cellCnt,logicalCellCnt:this._logical_cellCnt,rowCnt:this._rowCnt,rowInex:this._rowIndex,physicalCellIndex:this._physical_cellIndex,logicalCellIndex:this._logical_cellIndex,currentColSpan:this._current_colSpan,currentRowSpan:this._current_rowSpan},p=l.rowCnt-(u.rowCnt-(u.rowInex+1))-1,g=l.logicalCellCnt-(u.logicalCellCnt-(u.logicalCellIndex+1))-1;if(u.rowCnt+=p,u.logicalCellCnt+=g,u.physicalCellCnt+=g,p>0||g>0){const t=d[d.length-1],e=t.cells[t.cells.length-1];for(let t=0;t<p;t++)this.editRow("down",e);for(let t=0;t<g;t++)this.editCell("right",e);d=this._trElements=c.rows}const m=u.rowInex,f=u.logicalCellIndex,_=f+l.logicalCellCnt-1,b=[],y=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let i=0,s=0;for(let n=0;n<e.length;n++){for(;y[t]?.[i];)i++;const n=e[s++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=i,a=i+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const s=t+e;y[s]||(y[s]=[]);for(let t=0;t<o;t++)y[s][i+t]=!0}r<=_&&a>=f&&(o>1||l>1)&&b.push(n),i+=o}}b.length>0&&(this.unmergeCells(b,!0),d=this._trElements=c.rows);const v=[],C=[],w=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=i[t]?.cells;if(!e)break;let s=0;for(let i=0;i<e.length;i++){const n=e[i],o=n.colSpan||1,l=n.rowSpan||1;for(;C[t]?.[s];)s++;for(let e=1;e<l;e++){const i=t+e;C[i]||(C[i]=[]);for(let t=0;t<o;t++)C[i][s+t]=!0}if(o<=1&&l<=1){s+=o;continue}const r=s+u.logicalCellIndex,a=r+o-1,h=[];for(let e=u.rowInex+t,i=e+l,s=0;e<i;e++,s++){const t=d[e].cells;let i=0,s=0;for(;s<t.length&&i<=a;){for(;w[e]?.[i];)i++;const n=t[s++],o=n.colSpan||1,l=n.rowSpan||1,c=i,d=i+o-1;if(l>1)for(let t=1;t<l;t++){const s=e+t;w[s]||(w[s]=[]);for(let t=0;t<o;t++)w[s][i+t]=!0}d>=r&&c<=a&&h.push(n),i+=o}}h.length>0&&v.push(h),s+=o}}if(v.length>0){for(const t of v)this._ref=null,this._trElements=c.rows,this.mergeCells(t,!0);d=this._trElements=c.rows}const x=[],k=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowInex+t],s=i[t];if(!e||!s)break;const n=e.cells,o=s.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=_;){for(;k[t]?.[l];)l++;const e=n[r++],i=o[a];if(!e||!i)break;const s=e.colSpan||1,h=e.rowSpan||1;if(h>1)for(let e=1;e<h;e++){const i=t+e;k[i]||(k[i]=[]);for(let t=0;t<s;t++)k[i][l+t]=!0}l>=f&&l+s-1<=_&&(e.innerHTML=i.innerHTML,x.push(e),a++),l+=s}}r.replaceWith(c),this._closeTableSelectInfo(),this.setTableInfo(c),this.selectCells(x),this._setMergeSplitButton(),this._setUnMergeButton(),this.#W(x[0]),this._historyPush()}insertBodyRow(t,e,i){const s=t.insertRow(e);return s.innerHTML=ro("td",i),s}mergeCells(t,e=!1){const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this.#q(i,t);this.setTableInfo(s),t=n,this._ref=null,this._setMultiCells(t[0],gt.query.findVisualLastCell(t));const o=this._ref,l=t[0];let r=null,a=null;const h=o.ce-o.cs+1;let c=o.re-o.rs+1,d="",u=null;for(let e,i,s=1,n=t.length;s<n;s++){e=t[s],u!==e.parentNode&&(u=e.parentNode),i=e.children;for(let t=0,e=i.length;t<e;t++)this.format.isLine(i[t])&>.check.isZeroWidth(i[t].textContent)&>.utils.removeItem(i[t]);d+=e.innerHTML,gt.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this._trElements,e=gt.utils.getArrayIndex(t,r),i=gt.utils.getArrayIndex(t,a||r),s=[];for(let n,o=0;o<=i;o++)if(n=t[o].cells,0!==n.length)for(let t,s,l=0,r=n.length;l<r;l++)t=n[l],s=t.rowSpan-1,s>0&&o+s>=e&&(t.rowSpan-=mt.getOverlapRangeAtIndex(e,i,o,o+s));else s.push(t[o]);for(let t=0,e=s.length;t<e;t++)gt.utils.removeItem(s[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(i.replaceWith(s),this._closeTableSelectInfo(),this._setMergeSplitButton(),this._setController(l),this.#W(l),this._historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this.#q(i,t);this._ref=null,this.setTableInfo(s);let o=(t=n)[0],l=gt.query.findVisualLastCell(t),r=null;const a=o.closest("table"),h=a.rows;for(const e of t){const t=e.parentElement.rowIndex,i=e.cellIndex,s=e.rowSpan,n=e.colSpan;if(1===s&&1===n)continue;this.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let c=0;c<s;c++){const s=h[t+c];for(let t=0;t<n;t++){const n=ao("td");0===c&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,s.insertBefore(n,s.cells[i])):(s.insertBefore(n,s.cells[i+t]),r=n)}}}this._selectedCells=null,e||(i.replaceWith(s),this._closeTableSelectInfo(),this.setTableInfo(s),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this._setMultiCells(o,l),this._selectedCells=Array.from(a.querySelectorAll(".se-selected-table-cell"))):this.setCellInfo(l,!0),this._fixedCell=o,this._selectedCell=l,gt.utils.addClass(l,"se-selected-cell-focus"),this._setUnMergeButton(),this.controller_cell.resetPosition(l),this._historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}toggleHeader(){const t=this.headerButton,e=gt.utils.hasClass(t,"active"),i=this._element;if(e)gt.utils.removeItem(i.querySelector("thead"));else{const t=gt.utils.createElement("THEAD");t.innerHTML="<tr>"+ro("th",this._logical_cellCnt)+"</tr>",i.insertBefore(t,i.firstElementChild)}gt.utils.toggleClass(t,"active"),/TH/i.test(this._tdElement.nodeName)?this._closeController():this._setCellControllerPosition(this._tdElement,!1)}toggleCaption(){const t=this.captionButton,e=gt.utils.hasClass(t,"active"),i=this._element;if(e)gt.utils.removeItem(i.querySelector("caption"));else{const t=gt.utils.createElement("CAPTION",{class:`se-table-caption-${this.captionPosition}`});t.innerHTML="<div><br></div>",i.insertBefore(t,i.firstElementChild)}gt.utils.toggleClass(t,"active"),this._setCellControllerPosition(this._tdElement,!1)}_setTableStyle(t,e){if(t.includes("width")){const t=this._figure;if(!t)return;let i,s;this._maxWidth?(i=this.icons.reduction,s=this.minText,e||(t.style.width="100%")):(i=this.icons.expansion,s=this.maxText,e||(t.style.width="max-content")),gt.utils.changeElement(this.resizeButton.firstElementChild,i),gt.utils.changeTxt(this.resizeText,s)}t.includes("column")&&(this._fixedColumn?(gt.utils.removeClass(this._element,"se-table-layout-auto"),gt.utils.addClass(this._element,"se-table-layout-fixed"),gt.utils.addClass(this.columnFixedButton,"active")):(gt.utils.removeClass(this._element,"se-table-layout-fixed"),gt.utils.addClass(this._element,"se-table-layout-auto"),gt.utils.removeClass(this.columnFixedButton,"active")))}_setMergeSplitButton(){this._ref?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}_setUnMergeButton(){this.findMergedCells(this._selectedCells?.length?this._selectedCells:[this._fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_setController(t){if(!this.selection.get().isCollapsed&&!this._selectedCell)return void this._deleteStyleSelectedCells();this._setUnMergeButton(),this._tdElement=t,this._fixedCell===t&>.utils.addClass(t,"se-selected-cell-focus"),this._selectedCells?.length||(this._selectedCells=[t]);const e=this._selectedTable||this._element||gt.query.getParentElement(t,"TABLE");this.component.select(e,so.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.controller_cell.resetPosition(this.cellControllerTop?gt.query.getParentElement(t,gt.check.isTable):t)}_historyPush(){this._deleteStyleSelectedCells(),this.history.push(!1),this._recallStyleSelectedCells()}_figureOpen(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})}_resizePercentCol(){const t=this._element.querySelector("colgroup").querySelectorAll("col"),e=this._element.offsetWidth;t.forEach((t=>{const i=qn.getComputedStyle(t).getPropertyValue("width");if(!i.endsWith("%")){const s=mt.get(i,1)/e*100;t.style.width=s+"%"}}))}_startCellResizing(t,e,i,s){this._resizePercentCol(),this._setResizeLinePosition(this._figure,this._tdElement,this._resizeLinePrev,s),this._resizeLinePrev.style.display="block";const n=t.style.width,o=t.nextElementSibling,l=o.style.width,r=gt.utils.hasClass(this._element,"se-table-layout-fixed")?l:pt.getWidthInPercentage(o||t);Qt.get("__dragHandler")&&(Qt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._cellResize.bind(this,t,o,this._figure,this._tdElement,this._resizeLine,s,e,i,mt.get(n,0),mt.get(r,0),this._element.offsetWidth),(()=>{this.__removeGlobalEvents(),this._resizePercentCol(),this.history.push(!0),this.component.select(this._element,so.key,{isInput:!0})}),(e=>{this._stopResize(t,n,"width",e),this._stopResize(o,l,"width",e)}))}_cellResize(t,e,i,s,n,o,l,r,a,h,c,d){const u=(r+(d.clientX-l))/c*100;if(u>0){t.style.width=`${u}%`;const l=a-u;e.style.width=`${h+l}%`,this._setResizeLinePosition(i,s,n,o)}}_startRowResizing(t,e,i){this._setResizeRowPosition(this._figure,t,this._resizeLinePrev),this._resizeLinePrev.style.display="block";const s=t.style.height;this._addResizeGlobalEvents(this._rowResize.bind(this,t,this._figure,this._resizeLine,e,i),(()=>{this.__removeGlobalEvents(),this.history.push(!0)}),this._stopResize.bind(this,t,s,"height"))}_rowResize(t,e,i,s,n,o){const l=n+(o.clientY-s);t.style.height=`${l}px`,this._setResizeRowPosition(e,t,i)}_startFigureResizing(t,e){const i=this._figure;this._setResizeLinePosition(i,i,this._resizeLinePrev,e),this._resizeLinePrev.style.display="block";const s=pt.getWidthInPercentage(i);Qt.get("__dragHandler")&&(Qt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._figureResize.bind(this,i,this._resizeLine,e,t,i.offsetWidth,mt.get(s,0)),(()=>{this.__removeGlobalEvents(),mt.get(i.style.width,0)>100&&(i.style.width="100%"),this.component.select(this._element,so.key,{isInput:!0})}),this._stopResize.bind(this,i,i.style.width,"width"))}_figureResize(t,e,i,s,n,o,l){const r=(n+(i?s-l.clientX:l.clientX-s))/n*o;r>0&&(t.style.width=`${r}%`,this._setResizeLinePosition(t,t,e,i))}_setResizeLinePosition(t,e,i,s){const n=this.offset.getLocal(e),o=this.offset.getLocal(t);i.style.left=`${n.left+(s?0:e.offsetWidth)}px`,i.style.top=`${o.top}px`,i.style.height=`${t.offsetHeight}px`}_setResizeRowPosition(t,e,i){const s=this.offset.getLocal(e),n=this.offset.getLocal(t);i.style.top=`${s.top+e.offsetHeight}px`,i.style.left=`${n.left}px`,i.style.width=`${t.offsetWidth}px`}_stopResize(t,e,i,s){ft.isEsc(s.code)&&(this.__removeGlobalEvents(),t.style[i]=e,"width"===i&&this.component.select(this._element,so.key,{isInput:!0}))}_deleteStyleSelectedCells(){gt.utils.removeClass([this._fixedCell,this._selectedCell],"se-selected-cell-focus");const t=this._fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,i=e.length;t<i;t++)gt.utils.removeClass(e[t],"se-selected-table-cell")}}_recallStyleSelectedCells(){if(this._selectedCells){const t=this._selectedCells;for(let e=0,i=t.length;e<i;e++)gt.utils.addClass(t[e],"se-selected-table-cell")}}_addResizeGlobalEvents(t,e,i){this.__globalEvents.resize=this.eventManager.addGlobalEvent("mousemove",t,!1),this.__globalEvents.resizeStop=this.eventManager.addGlobalEvent("mouseup",e,!1),this.__globalEvents.resizeKeyDown=this.eventManager.addGlobalEvent("keydown",i,!1),this._resizing=!0}_toggleEditor(t){const e=this.editor.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?gt.utils.removeClass(e,"se-disabled"):gt.utils.addClass(e,"se-disabled")}_setCtrlProps(t){this._typeCache=t;const e="table"===t,i=e?[this._element]:this._selectedCells;if(!i||0===i.length)return;const{border_format:s,border_color:n,border_style:o,border_width:l,back_color:r,font_color:a,cell_alignment:h,cell_alignment_vertical:c,cell_alignment_table_text:d,font_bold:u,font_underline:p,font_italic:g,font_strike:m}=this.propTargets,{border:f,backgroundColor:_,color:b,textAlign:y,verticalAlign:v,fontWeight:C,textDecoration:w,fontStyle:x}=qn.getComputedStyle(i[0]),k=this._getBorderStyle(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let E=pt.rgb2hex(k.c),S=k.s,T=k.w,H=pt.rgb2hex(_),L=pt.rgb2hex(b),M=/.+/.test(C),N=/underline/i.test(w),A=/line-through/i.test(w),B=/italic/i.test(x),I=e?this._figure?.style.float:y,V=v;this._propsCache=[];const O=qn.getComputedStyle(this.eventManager.__focusTemp);for(let t,s,n=0;t=i[n];n++){const{cssText:i,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:h,textDecoration:c,fontStyle:d}=t.style;if(this._propsCache.push([t,i]),s)continue;const{c:u,s:p,w:g}=this._getBorderStyle(n);let m=o,f=l;m&&(this.eventManager.__focusTemp.style.backgroundColor=m,m=O.backgroundColor),f&&(this.eventManager.__focusTemp.style.color=f,f=O.color),E&&k.c!==u&&(E=""),S&&k.s!==p&&(S=""),T&&k.w!==g&&(T=""),H!==pt.rgb2hex(m)&&(H=""),L!==pt.rgb2hex(f)&&(L=""),I!==(e?this._figure?.style.float:r)&&(I=""),V&&V!==a&&(V=""),M&&M!==/.+/.test(h)&&(M=!1),N&&N!==/underline/i.test(c)&&(N=!1),A&&A!==/line-through/i.test(c)&&(A=!1),B&&B!==/italic/i.test(d)&&(B=!1),E&&S&&T&&H&&L||(s=!0)}s.firstElementChild.innerHTML=this.icons[jn[1===i.length?"outside":"all"]],s.setAttribute("se-border-format","all"),gt.utils.removeClass(s,"active"),S=S||Xn[0],o.textContent=S,n.style.borderColor=n.value=E,l.value=T,this._disableBorderProps(S===Xn[0]),r.value=r.style.borderColor=H,a.value=a.style.borderColor=L,M&>.utils.addClass(u,"on"),N&>.utils.addClass(p,"on"),A&>.utils.addClass(m,"on"),B&>.utils.addClass(g,"on"),this._setAlignProps(h,this._propsAlignCache=I,!0),this._setAlignProps(c,this._propsVerticalAlignCache=V,!0)}_setAlignProps(t,e,i){gt.utils.removeClass(t.querySelectorAll("button"),"on"),i||t.getAttribute("se-cell-align")!==e?(gt.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}_disableBorderProps(t){const{border_color:e,border_width:i,palette_border_button:s}=this.propTargets;t?(e.disabled=!0,i.disabled=!0,s.disabled=!0,i.disabled=!0):(e.disabled=!1,i.disabled=!1,s.disabled=!1,i.disabled=!1)}_getBorderStyle(t){const e=t.split(/\s(?![^()]*\))/);let i="",s="",n="";return 3===e.length?(i=e[0],s=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(i=e[0],s=e[1]):(s=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?i=e[0]:s=e[0]),{w:i,s,c:pt.rgb2hex(n)}}_submitProps(t){try{t.disabled=!0;const e=this.controller_table.form.contains(this.controller_props.currentTarget),i=e?[this._element]:this._selectedCells,s=i[0],n=qn.getComputedStyle(s),{border_format:o,border_color:l,border_style:r,border_width:a,back_color:h,font_color:c,cell_alignment:d,cell_alignment_vertical:u}=this.propTargets,p=o.getAttribute("se-border-format")||"",g="all"!==p,m=("none"===r.textContent?"":r.textContent)||"",f="none"===p||!m,_=d.getAttribute("se-cell-align")||"",b=u.getAttribute("se-cell-align")||"",y=f?"":l.value.trim()||n.borderColor;let v=f?"":a.value.trim()||n.borderWidth;v+=mt.is(v)?"px":"";const C=h.value.trim(),w=c.value.trim(),x=g&&!f&&v,k=`${v} ${m} ${y}`,E={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=s.style;this._figure&&(this._figure.style.float=_,this._figure.style.verticalAlign=b),t.backgroundColor=C,t.color=w,this._setFontStyle(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":k),E.left=E.top=E.right=E.bottom=i}else{const t=s.parentElement;let{rs:e,re:n,cs:o,ce:l}=this._ref||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:s.cellIndex||0,ce:s.cellIndex||0};const r=new Array(n-e+1).fill(0).map((()=>new Array(l-o+1).fill(0))),a=o;n-=e,e-=e,l-=o,o-=o;let h=t;for(let t,s,c,d,u,p=0,g=0,m=i.length,y=0;p<m;p++,g++){t=i[p],d=t.colSpan,u=t.rowSpan,c=t.cellIndex-a,h!==t.parentElement&&(y++,g=0,h=t.parentElement);let m=0;for(;m<=c;)c+=r[y][m]||0,m++;try{if(u>1){const t=u-1;for(let e=y;e<=y+t;e++)r[e][c]+=d-(y===e?1:0)}else d>1&&(r[y][c]+=d-1)}catch(t){}const v=y+u-1===n;y===e&&E.top.push(t),(y===n||v)&&E.bottom.push(t),c===o&&E.left.push(t),c!==l&&c+d-1!==l||E.right.push(t),v||y===e||y===n||c===o||c===l||E.middle.push(t),s=t.style,s.textAlign=_,s.verticalAlign=b,s.backgroundColor=C,s.color=w,this._setFontStyle(s),x||(s.border=f?s.borderLeft=s.borderTop=s.borderRight=s.borderBottom="":k)}0===E.middle.length&&(E.middle=i)}E.all=i,x&&this._setBorderStyles(E,p,k),this._historyPush(),this.controller_props.close(),this._tdElement&&(this._recallStyleSelectedCells(),this.setCellInfo(this._tdElement,!0),gt.utils.addClass(this._tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}_setFontStyle(t){const{font_bold:e,font_italic:i,font_strike:s,font_underline:n}=this.propTargets;t.fontWeight=gt.utils.hasClass(e,"on")?"bold":"",t.fontStyle=gt.utils.hasClass(i,"on")?"italic":"",t.textDecoration=((gt.utils.hasClass(s,"on")?"line-through ":"")+(gt.utils.hasClass(n,"on")?"underline":"")).trim()}_setBorderStyles(t,e,i){const{left:s,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!l.includes(t))),eo,i),gt.utils.setStyle(r.filter((t=>!o.includes(t))),to,i);break;case"horizon":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!l.includes(t))),eo,i);break;case"vertical":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!o.includes(t))),to,i);break;case"outside":gt.utils.setStyle(s,Jn,i),gt.utils.setStyle(n,Qn,i),gt.utils.setStyle(o,to,i),gt.utils.setStyle(l,eo,i);break;case"left":gt.utils.setStyle(s,Jn,i);break;case"top":gt.utils.setStyle(n,Qn,i);break;case"right":gt.utils.setStyle(o,to,i);break;case"bottom":gt.utils.setStyle(l,eo,i)}}_setMultiCells(t,e){const i=this._selectedTable.rows;if(this._deleteStyleSelectedCells(),gt.utils.addClass(t,"se-selected-table-cell"),t===e&&!this._shift)return;let s=!0,n=[],o=[];const l=this._ref={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,h=0,c=i.length;h<c;h++){r=i[h].cells,a=0;for(let i,c,d,u,p=0,g=r.length;p<g;p++){if(i=r[p],d=i.colSpan-1,u=i.rowSpan-1,c=p+a,n.length>0)for(let t,e=0;e<n.length;e++)t=n[e],t.row>h||(c>=t.index?(a+=t.cs,c+=t.cs,t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)):p===g-1&&(t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)));if(s){if(i!==t&&i!==e||(l.cs=null!==l.cs&&l.cs<c?l.cs:c,l.ce=null!==l.ce&&l.ce>c+d?l.ce:c+d,l.rs=null!==l.rs&&l.rs<h?l.rs:h,l.re=null!==l.re&&l.re>h+u?l.re:h+u,l._i+=1),2===l._i){s=!1,n=[],o=[],h=-1;break}}else if(mt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&mt.getOverlapRangeAtIndex(l.rs,l.re,h,h+u)){const t=l.cs<c?l.cs:c,e=l.ce>c+d?l.ce:c+d,s=l.rs<h?l.rs:h,r=l.re>h+u?l.re:h+u;if(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==r){l.cs=t,l.ce=e,l.rs=s,l.re=r,h=-1,n=[],o=[];break}gt.utils.addClass(i,"se-selected-table-cell")}u>0&&o.push({index:c,cs:d+1,rs:u,row:-1}),a+=i.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}}_resetTablePicker(){if(!this.tableHighlight)return;const t=this.tableHighlight.style,e=this.tableUnHighlight.style;t.width="1em",t.height="1em",e.width="10em",e.height="10em",gt.utils.changeTxt(this.tableDisplay,"1 x 1"),this.menu.dropdownOff()}_resetPropsAlign(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),i=t.querySelector('[data-value="right"]'),s=e.parentElement,n=i.parentElement;s.appendChild(i),n.appendChild(e)}_onColorPalette(t,e,i){this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,gt.utils.addClass(t,"on"),this.colorPicker.init(i?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}_closeController(){this.controller_table.close(),this.controller_cell.close()}_closeTableSelectInfo(){this.component.deselect(),this._closeController()}__hideResizeLine(){this._resizeLine&&(this._resizeLine.style.display="none",this._resizeLine=null)}__removeGlobalEvents(){this._toggleEditor(!0),this._resizing=!1,this.ui.disableBackWrapper(),this.__hideResizeLine(),this._resizeLinePrev&&(this._resizeLinePrev.style.display="none",this._resizeLinePrev=null);const t=this.__globalEvents;for(const e in t)t[e]&&(t[e]=this.eventManager.removeGlobalEvent(t[e]))}#q(t,e){const i=gt.utils.clone(t,!0),s=Array.from(t.querySelectorAll("td, th")),n=Array.from(i.querySelectorAll("td, th"));return{cloneTable:i,clonedSelectedCells:e.map((t=>{const e=s.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}#D(t,e){this.__s=e,this._shift||this._ref||this.__removeGlobalEvents(),this._shift=e,this._fixedCell=t,this._selectedCells?.length||(this._selectedCells=[t]),this._fixedCellName=t.nodeName,this._selectedTable=gt.query.getParentElement(t,"TABLE"),this._deleteStyleSelectedCells(),gt.utils.addClass(t,"se-selected-cell-focus"),e?(this.__globalEvents.shiftOff=this.eventManager.addGlobalEvent("keyup",this._bindShiftOff,!1),this.__globalEvents.on=this.eventManager.addGlobalEvent("mousedown",this._bindMultiOn,!1)):this.__globalEvents.on=this.eventManager.addGlobalEvent("mousemove",this._bindMultiOn,!1),this.__globalEvents.off=this.eventManager.addGlobalEvent("mouseup",this._bindMultiOff,!1),this.__globalEvents.touchOff=this.eventManager.addGlobalEvent("touchmove",this._bindTouchOff,!1)}#B(t){const e="vertical"===t,i=this._tdElement,s=this._trElements,n=this._trElement,o=this._logical_cellIndex,l=this._rowIndex,r=ao(i.nodeName);if(e){const t=i.colSpan;if(r.rowSpan=i.rowSpan,t>1)r.colSpan=Math.floor(t/2),i.colSpan=t-r.colSpan,n.insertBefore(r,i.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,h=this._rowCnt;a<h;a++){n=s[a].cells,r=0;for(let s,h,c,d,u=0,p=n.length;u<p;u++){if(s=n[u],h=s.colSpan-1,c=s.rowSpan-1,d=u+r,l.length>0)for(let t,e=0;e<l.length;e++)t=l[e],t.row>a||(d>=t.index?(r+=t.cs,d+=t.cs,t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)):u===p-1&&(t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)));if(d<=o&&c>0&&e.push({index:d,cs:h+1,rs:c,row:-1}),s!==i&&d<=o&&d+h>=o+t-1){s.colSpan+=1;break}if(d>o)break;r+=h}l=l.concat(e).sort((function(t,e){return t.index-e.index})),e=[]}n.insertBefore(r,i.nextElementSibling)}}else{const t=i.rowSpan;if(r.colSpan=i.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=gt.utils.getArrayIndex(s,n)+e;for(let t,e,i=0;i<a;i++){t=s[i].cells,e=0;for(let s,n,r,h=0,c=t.length;h<c&&(r=h+e,!(r>=o));h++)s=t[h],n=s.rowSpan-1,n>0&&n+i>=a&&r<o&&l.push({index:r,cs:s.colSpan}),e+=s.colSpan-1}const h=s[a],c=h.cells;let d=l.shift();for(let t,e,i,s,n=0,a=c.length,u=0;n<a;n++){if(i=n+u,t=c[n],e=t.colSpan-1,s=i+e+1,d&&s>=d.index&&(u+=d.cs,s+=d.cs,d=l.shift()),s>=o||n===a-1){h.insertBefore(r,t.nextElementSibling);break}u+=e}i.rowSpan=e}else{r.rowSpan=i.rowSpan;const t=gt.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=s[e].cells,0===t.length)return;for(let i=0,s=t.length;i<s;i++)e+t[i].rowSpan-1>=l&&(t[i].rowSpan+=1)}const e=this._physical_cellIndex,o=n.cells;for(let t=0,i=o.length;t<i;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#W(i),this._deleteStyleSelectedCells(),this.history.push(!1),this._setController(i),this._selectedCell=this._fixedCell=i,this._selectedCells?.length||(this._selectedCells=[i])}#I(t){switch(t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this._historyPush()}#V(t){switch(t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this._historyPush()}#F(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),i=Math.ceil(t.offsetY/18);e=e<1?1:e,i=i<1?1:i,this.options.get("_rtl")&&(this.tableHighlight.style.left=18*e-13+"px",e=11-e),this.tableHighlight.style.width=e+"em",this.tableHighlight.style.height=i+"em";const s=e<5?5:e>8?10:e+2,n=i<5?5:i>8?10:i+2;this.tableUnHighlight.style.width=s+"em",this.tableUnHighlight.style.height=n+"em",gt.utils.changeTxt(this.tableDisplay,e+" x "+i),this._tableXY=[e,i]}#P(){this.action()}#O(t){this.editor._preventBlur=!0;const e=gt.query.getParentElement(gt.query.getEventTarget(t),gt.check.isTableCell);if(this._shift){if(e===this._fixedCell)return this._shift=!1,this._deleteStyleSelectedCells(),this._toggleEditor(!0),void this.__removeGlobalEvents();this._toggleEditor(!1)}else if(!this._ref){if(e===this._fixedCell)return;this._toggleEditor(!1)}e&&e!==this._selectedCell&&this._fixedCellName===e.nodeName&&this._selectedTable===gt.query.getParentElement(e,"TABLE")&&this._setMultiCells(this._fixedCell,this._selectedCell=e)}#R(t){if(t.stopPropagation(),this._shift?this.__globalEvents.touchOff&&(this.__globalEvents.touchOff=this.eventManager.removeGlobalEvent(this.__globalEvents.touchOff)):(this._toggleEditor(!0),this.__removeGlobalEvents()),!this._fixedCell||!this._selectedTable)return;if(this._setMergeSplitButton(),this._selectedCells=Array.from(this._selectedTable.querySelectorAll(".se-selected-table-cell")),this._shift)return;this._fixedCell&&this._selectedCell&&(this.#W(this._fixedCell),this._fixedCell===this._selectedCell&>.utils.removeClass(this._fixedCell,"se-selected-table-cell"));const e=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this._setController(e)}#z(){if(this._ref){this.__removeGlobalEvents(),this._toggleEditor(!0),this.#W(this._fixedCell);const t=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this._setController(t)}else this._closeController()}#$(){this.close()}#W(t){dt.isMobile||this.editor.focusEdge(t)}}function no(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function oo(t,e){const i=t.clientX,s=mt.get(qn.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(i-n.left),l=o<=2;return{is:l||s-o<=2,isLeft:l,startX:i}}function lo(t,e){const i=t.clientY,s=mt.get(qn.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(s+n.top-i)<=5,startY:i}}function ro(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function ao(t){return t=t.toLowerCase(),gt.utils.createElement(t,null,"<div><br></div>")}function ho(t){this.propTargets.border_style.textContent=t,this._disableBorderProps(t===Xn[0]),this.selectMenu_props_border.close()}function co(t,e){const{border_format:i}=this.propTargets;i.setAttribute("se-border-format",e),i.firstElementChild.innerHTML=this.icons[jn[e]],e!==t?gt.utils.addClass(i,"active"):gt.utils.removeClass(i,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}function uo(t){this.controller_cell.bringToTop(t)}function po(t,e,i){const s=[];let n="";for(const o in jn){if(i.includes(o))continue;const l=jn[o];s.push(o),n+=`\n\t\t\t<button type="button" class="se-btn se-tooltip">\n\t\t\t\t${e[l]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t[l]}</span>\n\t\t\t\t</span>\n\t\t\t</button>`}return{items:s,menus:gt.utils.createElement("DIV",null,n).querySelectorAll("button")}}const go=so;class mo extends ii{static key="formatBlock";static type="dropdown";static className="se-btn-select se-btn-tool-format";constructor(t,e){super(t),this.title=this.lang.formats,this.inner='<span class="se-txt">'+this.lang.formats+"</span>"+this.icons.arrow_down;const i=function({lang:t},e){const i=["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],s=e&&0!==e.length?e:i;let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let e,o,l,r,a,h,c,d=0,u=s.length;d<u;d++)e=s[d],"string"==typeof e&&i.includes(e)?(o=e.toLowerCase(),l="blockquote"===o?"block":"pre"===o?"br-line":"line",a=/^h/.test(o)?o.match(/\d+/)[0]:"",r=t["tag_"+(a?"h":o)]+a,c="",h=""):(o=e.tag.toLowerCase(),l=e.command,r=e.name||o,c=e.class,h=c?' class="'+c+'"':""),n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${l}" data-value="${o}" data-class="${c}" title="${r}" aria-label="${r}">\n\t\t\t\t\t<${o}${h}>${r}</${o}>\n\t\t\t\t</button>\n\t\t\t</li>`;return n+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.formatList=i.querySelectorAll("li button"),this.currentFormat="",this.menu.initDropdownTarget(mo,i)}active(t,e){let i=this.lang.formats;const s=e.querySelector(".se-txt");if(t){if(this.format.isLine(t)){const e=this.formatList,n=t.nodeName.toLowerCase(),o=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let t,s=0,l=e.length;s<l;s++)if(t=e[s],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){i=t.title;break}return gt.utils.changeTxt(s,i),s.setAttribute("data-value",n),s.setAttribute("data-class",o),!0}}else gt.utils.changeTxt(s,i);return!1}on(t){const e=this.formatList,i=t.querySelector(".se-txt"),s=(i.getAttribute("data-value")||"")+(i.getAttribute("data-class")||"");if(s!==this.currentFormat){for(let t,i=0,n=e.length;i<n;i++)t=e[i],s===t.getAttribute("data-value")+t.getAttribute("data-class")?gt.utils.addClass(t,"active"):gt.utils.removeClass(t,"active");this.currentFormat=s}}action(t){const e=t.getAttribute("data-command"),i=t.firstElementChild;"block"===e?this.format.applyBlock(i):"br-line"===e?this.format.setBrLine(i):this.format.setLine(i),this.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],i=gt.utils.createElement(`H${e}`);this.format.setLine(i)}}const fo=mo;class _o extends ii{static key="layout";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.layout,this.icon="layout",this.selectedIndex=-1,this.items=e.items;const i=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');let e='\n\t<div class="se-dropdown se-list-inner">\n\t\t<ul class="se-list-basic">';for(let i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${s}" title="${i.name}" aria-label="${i.name}">\n\t\t\t\t\t${i.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(_o,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.html.set(i.html),this.menu.dropdownOff()}}const bo=_o;class yo extends ii{static key="lineHeight";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.lineHeight,this.icon="line_height";const i=function({lang:t},e){const i=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];let s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t(${t.default})\n\t\t\t\t</button>\n\t\t\t</li>`;for(let t,e=0,n=i.length;e<n;e++)t=i[e],s+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t.value}" title="${t.text}" aria-label="${t.text}">\n\t\t\t\t\t${t.text}\n\t\t\t\t</button>\n\t\t\t</li>`;return s+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(t,e.items);this.sizeList=i.querySelectorAll("li button"),this.currentSize=null,this.menu.initDropdownTarget(yo,i)}active(t,e){return this.format.isLine(t)&&t.style.lineHeight.length>0?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.format.getLine(this.selection.getNode()),e=t?t.style.lineHeight+"":"";if(e!==this.currentSize){const t=this.sizeList;for(let i=0,s=t.length;i<s;i++)e===t[i].getAttribute("data-command")?gt.utils.addClass(t[i],"active"):gt.utils.removeClass(t[i],"active");this.currentSize=e}}action(t){const e=t.getAttribute("data-command")||"",i=this.format.getLines();for(let t=0,s=i.length;t<s;t++)i[t].style.lineHeight=e;this.menu.dropdownOff(),this.editor.effectNode=null,this.history.push(!1)}}const vo=yo;class Co extends ii{static key="template";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.template,this.icon="template",this.selectedIndex=-1,this.items=e.items;const i=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');let e='<div class="se-dropdown se-list-inner"><ul class="se-list-basic">';for(let i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-value="${s}" \n\t\t\t\ttitle="${i.name}" \n\t\t\t\taria-label="${i.name}"\n\t\t\t>\n\t\t\t\t${i.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",gt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(Co,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.html.insert(i.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.menu.dropdownOff()}}const wo=Co;class xo extends ii{static key="paragraphStyle";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.paragraphStyle,this.icon="paragraph_style";const i=function({lang:t},e){const i={spaced:{name:t.menu_spaced,class:"__se__p-spaced",_class:""},bordered:{name:t.menu_bordered,class:"__se__p-bordered",_class:""},neon:{name:t.menu_neon,class:"__se__p-neon",_class:""}},s=e&&0!==e.length?e:["spaced","bordered","neon"];let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,o,l,r=0,a=s.length;r<a;r++){if(t=s[r],"string"==typeof t){const e=i[t.toLowerCase()];if(!e)continue;t=e}e=t.name,o=t.class?` class="${t.class}"`:"",l=t._class,n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${l?" "+l:""}" data-command="${t.class}" title="${e}" aria-label="${e}">\n\t\t\t\t\t<div${o}>${e}</div>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.classList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(xo,i)}on(){const t=this.classList,e=this.format.getLine(this.selection.getNode());for(let i=0,s=t.length;i<s;i++)gt.utils.hasClass(e,t[i].getAttribute("data-command"))?gt.utils.addClass(t[i],"active"):gt.utils.removeClass(t[i],"active")}action(t){const e=t.getAttribute("data-command");let i=this.format.getLines();if(0===i.length&&(this.selection.getRangeAndAddLine(this.selection.getRange(),null),i=this.format.getLines(),0===i.length))return;const s=gt.utils.hasClass(t,"active")?gt.utils.removeClass:gt.utils.addClass;for(let t=0,n=i.length;t<n;t++)s(i[t],e);this.menu.dropdownOff(),this.history.push(!1)}}const ko=xo;class Eo extends ii{static key="textStyle";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.textStyle,this.icon="text_style";const i=function({lang:t},e){const i={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},s=e||Object.keys(i);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,h=0,c=s.length;h<c;h++){if(t=s[h],l="",a="",r=[],"string"==typeof t){const e=i[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l+=` class="${t.class}"`,a+=`.${t.class.trim().replace(/\s+/g,",.")}`,r.push("class"),a=a.replace(/,$/,""),n+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-command="${e}" \n\t\t\t\tdata-value="${a}" \n\t\t\t\ttitle="${o}" \n\t\t\t\taria-label="${o}"\n\t\t\t>\n\t\t\t\t<${e}${l}>${o}</${e}>\n\t\t\t</button>\n\t\t</li>`}return n+="</ul></div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.styleList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(Eo,i)}on(){const t=this.styleList,e=this.selection.getNode();for(let i,s,n,o=0,l=t.length;o<l;o++){i=t[o],s=i.getAttribute("data-value").split(",");for(let t,o,l=0;l<s.length;l++){for(t=e,n=!1;t&&!this.format.isLine(t)&&!this.component.is(t);){if(t.nodeName.toLowerCase()===i.getAttribute("data-command").toLowerCase()&&(o=s[l],/^\./.test(o)?gt.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?gt.utils.addClass(i,"active"):gt.utils.removeClass(i,"active")}}action(t){const e=t.firstElementChild,i=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");i.pop();const s=e.classList;for(let t=0,e=s.length;t<e;t++)i.push("."+s[t]);const n=gt.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.format.applyInlineElement(n,{stylesToModify:i,nodesToRemove:o,strictRemove:!0}),this.menu.dropdownOff()}}const So=Eo,{NO_EVENT:To}=dt;const Ho=class extends ii{constructor(t,e,i){super(t.editor),this.openNewWindow=!!i.openNewWindow,this.relList=Array.isArray(i.relList)?i.relList:[],this.defaultRel=i.defaultRel||{},this.noAutoPrefix=!!i.noAutoPrefix,i.enableFileUpload&&(this.uploadUrl="string"==typeof i.uploadUrl?i.uploadUrl:null,this.uploadHeaders=i.uploadHeaders||null,this.uploadSizeLimit=mt.get(i.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=mt.get(i.uploadSingleSizeLimit,0)||null,this.input=gt.utils.createElement("input",{type:"file",accept:i.acceptedFormats||"*"}),this.eventManager.addEvent(this.input,"change",this.#E.bind(this)),this.fileManager=new Is(this,{query:"a[download]:not([data-se-file-download])",loadHandler:this.events.onFileLoad,eventHandler:this.events.onFileAction}));const s=function(t,e,i){const s=t.lang,n=t.icons,o=e.textToDisplay?"":'style="display: none;"',l=e.title?"":'style="display: none;"';let r=`\n\t\t<div class="se-modal-body">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${s.link_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input data-focus class="se-input-form se-input-url" type="text" placeholder="${t.options.get("protocol")||""}" />\n\t\t\t\t\t${e.enableFileUpload?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_upload_button" aria-label="${s.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(s.fileUpload)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t\t<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_bookmark_button" aria-label="${s.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${gt.utils.createTooltipInner(s.link_modal_bookmark)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div class="se-anchor-preview-form">\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">${n.bookmark}</span>\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">${n.download}</span>\n\t\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t\t</div>\n\t\t\t\t<label ${o}>${s.link_modal_text}</label>\n\t\t\t\t<input class="se-input-form _se_display_text" type="text" ${o} />\n\t\t\t\t<label ${l}>${s.title}</label>\n\t\t\t\t<input class="se-input-form _se_title" type="text" ${l} />\n\t\t\t</div>\n\t\t\t<div class="se-modal-form-footer">\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_check" /> ${s.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" /> ${s.link_modal_downloadLinkCheck}</label>`;i.length>0&&(r+=`\n\t\t\t<div class="se-anchor-rel">\n\t\t\t\t<button type="button" class="se-btn se-tooltip se-anchor-rel-btn" title="${s.link_modal_relAttribute}" aria-label="${s.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${gt.utils.createTooltipInner(s.link_modal_relAttribute)}\n\t\t\t\t</button>\n\t\t\t\t<div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div>\n\t\t\t</div>\n\t\t</div>`);return r+="</div></div>",gt.utils.createElement("DIV",null,r)}(t.editor,i,this.relList);if(this.kink=t.constructor.key||t.constructor.name,this.inst=t,this.modalForm=e,this.host=(this._w.location.origin+this._w.location.pathname).replace(/\/$/,""),this.urlInput=s.querySelector(".se-input-url"),this.displayInput=s.querySelector("._se_display_text"),this.titleInput=s.querySelector("._se_title"),this.newWindowCheck=s.querySelector("._se_anchor_check"),this.downloadCheck=s.querySelector("._se_anchor_download"),this.download=s.querySelector("._se_anchor_download_icon"),this.preview=s.querySelector(".se-link-preview"),this.bookmark=s.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=s.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this._change=!1,this._isRel=this.relList.length>0,this._isRel){this.relButton=s.querySelector(".se-anchor-rel-btn"),this.relPreview=s.querySelector(".se-anchor-rel-preview");const t=this.relList,e=(this.defaultRel.default||"").split(" "),i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],i.push(gt.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(e.includes(s)?" se-checked":""),"data-command":s,title:s,"aria-label":s},s+'<span class="se-svg">'+this.icons.checked+"</span>"));this.selectMenu_rel=new ci(this,{checkList:!0,position:"right-middle",dir:"ltr"}),this.selectMenu_rel.on(this.relButton,this.#U.bind(this)),this.selectMenu_rel.create(i),this.eventManager.addEvent(this.relButton,"click",this.#G.bind(this))}this.modalForm.querySelector(".se-anchor-editor").appendChild(s),this.selectMenu_bookmark=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_bookmark.on(this.urlInput,this.#Z.bind(this)),this.eventManager.addEvent(this.newWindowCheck,"change",this.#Y.bind(this)),this.eventManager.addEvent(this.downloadCheck,"change",this.#X.bind(this)),this.eventManager.addEvent(this.displayInput,"input",this.#j.bind(this)),this.eventManager.addEvent(this.urlInput,"input",this.#K.bind(this)),this.eventManager.addEvent(this.urlInput,"focus",this.#J.bind(this)),this.eventManager.addEvent(this.bookmarkButton,"click",this.#Q.bind(this)),this.eventManager.addEvent(s.querySelector("._se_upload_button"),"click",(()=>this.input.click()))}set(t){this.currentTarget=t}on(t){if(t){if(this.currentTarget){const t=this.currentTarget.href;this.linkValue=this.preview.textContent=this.urlInput.value=this._selfPathBookmark(t)?t.substring(t.lastIndexOf("#")):t,this.displayInput.value=this.currentTarget.textContent,this.titleInput.value=this.currentTarget.title,this.newWindowCheck.checked=!!/_blank/i.test(this.currentTarget.target),this.downloadCheck.checked=!!this.currentTarget.download}}else this.init(),this.displayInput.value=this.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this._setRel(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this._setLinkPreview(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,i=0===this.displayInput.value.length?e:this.displayInput.value,s=this.currentTarget||gt.utils.createElement("A");return this._updateAnchor(s,e,i,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",s}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this._change=!1,this._setRel(this.defaultRel.default||"")}_updateAnchor(t,e,i,s,n){!this._selfPathBookmark(e)&&this.downloadCheck.checked?t.setAttribute("download",i||e):t.removeAttribute("download"),this.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=this.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=e,s?t.title=s:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=i}_selfPathBookmark(t){const e=this._w.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}_setRel(t){if(!this._isRel)return;const e=this.currentRel=t?t.split(" "):[],i=this.selectMenu_rel.form.querySelectorAll("button");for(let t,s=0,n=i.length;s<n;s++)t=i[s].getAttribute("data-command"),e.includes(t)?gt.utils.addClass(i[s],"se-checked"):gt.utils.removeClass(i[s],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?gt.utils.addClass(this.relButton,"on"):gt.utils.removeClass(this.relButton,"on")}_createBookmarkList(t){const e=gt.query.getListChildren(this.editor.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||gt.check.isAnchor(t)&&!!t.id));if(0===e.length)return;const i=new RegExp(`^${t.replace(/^#/,"")}`,"i"),s=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],i.test(t.textContent)&&(s.push(t),n.push(gt.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===s.length?this.selectMenu_bookmark.close():(this.selectMenu_bookmark.create(s,n),this.selectMenu_bookmark.open(this.options.get("_rtl")?"bottom-right":""))}_setLinkPreview(t){const e=this.preview,i=this.options.get("defaultUrlProtocol"),s=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(i),o=!!i&&RegExp("^"+ut.escapeStringRegexp(t.substring(0,i.length))).test(i);t=this.linkValue=e.textContent=t?s?t:!i||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:i+t:"",this._selfPathBookmark(t)?(this.bookmark.style.display="block",gt.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active")),!this._selfPathBookmark(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}_relMerge(t){const e=this.currentRel;if(!t)return e.join(" ");if(/^only:/.test(t))return t=t.replace(/^only:/,"").trim(),this.currentRel=t.split(" "),t;const i=t.split(" ");for(let t=0,s=i.length;t<s;t++)e.includes(i[t])||e.push(i[t]);return e.join(" ")}_relDelete(t){if(!t)return this.currentRel.join(" ");/^only:/.test(t)&&(t=t.replace(/^only:/,"").trim());const e=this.currentRel.join(" ").replace(RegExp(t+"\\s*"),"");return this.currentRel=e.split(" "),e}_register(t){const e=t.result[0];this.linkValue=this.preview.textContent=this.urlInput.value=e.url,this.displayInput.value=e.name,this.downloadCheck.checked=!0,this.download.style.display="block"}async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===To?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}_uploadCallBack(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)}async#E(t){const e=gt.query.getEventTarget(t).files;if(!e[0])return;const i={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},s=async function(t,e){t=e||t;const i=await this.fileManager.asyncUpload(t.url,t.uploadHeaders,t.files);this._uploadCallBack(i)}.bind(this,i);this._uploadCallBack;const n=await this.triggerEvent("onFileUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),void(!0!==n&&n!==To||s(null)))}#G(){this.selectMenu_rel.open(this.options.get("_rtl")?"left-middle":"")}#Z(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this._setLinkPreview(this.urlInput.value),this.selectMenu_bookmark.close(),this.urlInput.focus()}#U(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.currentRel,s=i.indexOf(e);-1===s?i.push(e):i.splice(s,1),this.relPreview.title=this.relPreview.textContent=i.join(", ")}#j(t){const e=gt.query.getEventTarget(t);this._change=!!e.value.trim()}#K(t){const e=gt.query.getEventTarget(t).value.trim();this._setLinkPreview(e),this._selfPathBookmark(e)?this._createBookmarkList(e):this.selectMenu_bookmark.close()}#J(){const t=this.urlInput.value;this._selfPathBookmark(t)&&this._createBookmarkList(t)}#Q(){let t=this.urlInput.value;this._selfPathBookmark(t)?(t=t.substring(1),this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",gt.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this._createBookmarkList(t)),this.urlInput.value=t,this._setLinkPreview(t),this.urlInput.focus()}#Y(t){if("string"!=typeof this.defaultRel.check_new_window)return;gt.query.getEventTarget(t).checked?this._setRel(this._relMerge(this.defaultRel.check_new_window)):this._setRel(this._relDelete(this.defaultRel.check_new_window))}#X(t){gt.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this._setRel(this._relMerge(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this._setRel(this._relDelete(this.defaultRel.check_bookmark)))}},{_w:Lo}=dt,Mo={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const No=class extends Jt{constructor(t,e){super(t.editor),this.offset=this.editor.offset,this.ui=this.editor.ui,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=e,this.isUpdate=!1,this.focusElement=e.querySelector("[data-focus]"),this._modalArea=this.carrierWrapper.querySelector(".se-modal"),this._modalInner=this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this._closeListener=[this.#tt.bind(this),this.#et.bind(this)],this._bindClose=null,this._onClickEvent=null,this._closeSignal=!1,this._resizeBody=null,this._modalInner.appendChild(e),this.eventManager.addEvent(e.querySelector("form"),"submit",this.#i.bind(this)),this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(e.querySelector(".se-modal-resize-handle-w")||e.querySelector(".se-modal-resize-handle-h")||e.querySelector(".se-modal-resize-handle-c")||e.querySelector(".se-modal-resize-form"))&&!(this._resizeBody=e.querySelector(".se-modal-resize-form"))&&(this._resizeBody=e.querySelector(".se-modal-body"))&&(this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#it.bind(this,"w")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#it.bind(this,"h")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#it.bind(this,"c")),this._currentHandle=null,this.__resizeDir="",this.__offetTop=0,this.__offetLeft=0,this.__globalEventHandlers={mousemove:this.#st.bind(this),mouseup:this.#nt.bind(this)},this._bindClose_mousemove=null,this._bindClose_mouseup=null)}static CreateFileInput({icons:t,lang:e},{acceptedFormats:i,allowMultiple:s}){return`\n\t\t<div class="se-modal-form-files">\n\t\t\t<div class="se-flex-input-wrapper">\n\t\t\t\t<div class="se-input-form-abs">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${i}"${s?' multiple="multiple"':""}/>\n\t\t\t</div>\n\t\t\t<button type="button" class="se-btn se-modal-files-edge-button se-file-remove se-tooltip" aria-label="${e.remove}">\n\t\t\t\t${t.selection_remove}\n\t\t\t\t${gt.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const i=t.querySelector(".se-input-file-cnt"),s=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(s.style.display="none",n.style.display="inline-block",i.style.display="",i.textContent=` ..${e.length}`):e.length>0?(s.style.display="none",n.style.display="none",i.style.display="block",i.textContent=e[0].name):(s.style.display="inline-block",n.style.display="none",i.style.display="",i.textContent="")}open(){if(this.ui._offCurrentModal(),this._fixCurrentController(!0),this._closeSignal&&this._modalInner.addEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this.isUpdate=this.kind===this.editor.currentControllerName,this.editor.opendModal=this,this.isUpdate||"function"!=typeof this.inst.init||this.inst.init(),"function"==typeof this.inst.on&&this.inst.on(this.isUpdate),gt.utils.addClass(this._modalArea,"se-backdrop-show"),gt.utils.addClass(this.form,"se-modal-show"),this._resizeBody){const t=this._saveOffset(),{maxWidth:e,maxHeight:i}=Lo.getComputedStyle(this.form),s=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this._resizeBody.offsetHeight)}px`;e&&"string"==typeof this.__resizeDir&>.utils.setStyle(this._resizeBody,"max-width",`calc(${e} - ${s})`),i&>.utils.setStyle(this._resizeBody,"max-height",`calc(${i} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.__removeGlobalEvent(),this._fixCurrentController(!1),Lo.setTimeout((()=>{this.editor.opendModal=null}),0),this._closeSignal&&this._modalInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),gt.utils.removeClass(this._modalArea,"se-backdrop-show"),gt.utils.removeClass(this.form,"se-modal-show"),"function"==typeof this.inst.init&&this.inst.init(),"function"==typeof this.inst.off&&this.inst.off(this.isUpdate),this.editor.focus()}_fixCurrentController(t){const e=this.editor.opendControllers;for(let i=0;i<e.length;i++)e[i].fixed=t,e[i].form.style.display=t?"none":"block"}_saveOffset(){const t=this.offset.getGlobal(this._resizeBody);return this.__offetTop=t.top,this.__offetLeft=t.left,t}__addGlobalEvent(t){this.__removeGlobalEvent(),this.ui.enableBackWrapper(Mo[t]),this._bindClose_mousemove=this.eventManager.addGlobalEvent("mousemove",this.__globalEventHandlers.mousemove,!0),this._bindClose_mouseup=this.eventManager.addGlobalEvent("mouseup",this.__globalEventHandlers.mouseup,!0)}__removeGlobalEvent(){this.ui.disableBackWrapper(),this._bindClose_mousemove&&(this._bindClose_mousemove=this.eventManager.removeGlobalEvent(this._bindClose_mousemove)),this._bindClose_mouseup&&(this._bindClose_mouseup=this.eventManager.removeGlobalEvent(this._bindClose_mouseup))}async#i(t){t.preventDefault(),t.stopPropagation(),this.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.ui.hideLoading():void 0===t?this.close():(this.close(),this.ui.hideLoading())}catch(t){throw this.close(),this.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#et(t){const e=gt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._modalInner)&&this.close()}#tt(t){ft.isEsc(t.code)&&this.close()}#it(t,e){this._currentHandle=gt.query.getEventTarget(e),gt.utils.addClass(this._currentHandle,"active"),this.__addGlobalEvent(this.__resizeDir=t+(this.options.get("_rtl")?"RTL":""))}#st(t){switch(this.__resizeDir){case"w":case"wRTL":{const e=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.height=this._resizeBody.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.__offetLeft-this._resizeBody.offsetWidth;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px";break}case"hRTL":{const e=this.__offetLeft-t.clientX;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.__offetLeft-this._resizeBody.offsetWidth,i=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px",this._resizeBody.style.height=this._resizeBody.offsetHeight+i+"px";break}case"cRTL":{const e=this.__offetLeft-t.clientX,i=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px",this._resizeBody.style.height=this._resizeBody.offsetHeight+i+"px";break}}this._saveOffset(),"function"==typeof this.inst.modalResize&&this.inst.modalResize()}#nt(){gt.utils.removeClass(this._currentHandle,"active"),this._currentHandle=null,this.__removeGlobalEvent()}};const Ao=class extends ii{static key="link";static type="modal";static className="se-icon-flip-rtl";constructor(t,e){super(t),this.title=this.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const i=function({lang:t,icons:e}){const i=`\n\t<form>\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.link_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-anchor-editor"></div>\n\t\t<div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n\t\t</div>\n\t</form>`;return gt.utils.createElement("DIV",{class:"se-modal-content"},i)}(t),s=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<span><a target="_blank" href=""></a> </span>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip se-icon-flip-rtl">\n\t\t\t\t${e.unlink}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.unlink}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Ho(this,i,this.pluginOptions),this.modal=new No(this,i),this.controller=new hi(this,s,{position:"bottom",disabled:!1})}active(t){if(gt.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.controller.form.querySelector("a");return e.href=t.href,e.title=t.textContent,e.textContent=t.textContent,gt.utils.addClass(t,"on"),this.anchor.set(t),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}),!0}return this.controller.close(),!1}open(){this.modal.open()}on(t){this.isUpdateState=t,this.anchor.on(t)}modalAction(){const t=this.anchor.create(!1);if(null===t)return!1;if(this.isUpdateState){const t=this.controller.currentTarget.childNodes[0];this.selection.setRange(t,0,t,t.textContent.length)}else{const e=this.format.getLines();if(e.length>1){if(!this.html.insertNode(gt.utils.createElement(e[0].nodeName,null,t),{afterNode:null,skipCharCount:!1}))return!0}else if(!this.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!0;this.selection.setRange(t.childNodes[0],0,t.childNodes[0],t.textContent.length)}return!0}init(){this.controller.close(),this.anchor.init()}controllerAction(t){const e=t.getAttribute("data-command");if(/update/.test(e))this.modal.open();else if(/unlink/.test(e)){const t=gt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=gt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0);this.selection.setRange(t,0,e,e.textContent.length),this.format.applyInlineElement(null,{stylesToModify:null,nodesToRemove:["A"],strictRemove:!1})}else gt.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.editor.focus(),this.history.push(!1)}close(){gt.utils.removeClass(this.controller.currentTarget,"on")}},{NO_EVENT:Bo}=dt;class Io extends ii{static key="image";static type="modal";static className="";static component(t){const e=gt.check.isFigure(t)||/^span$/i.test(t.nodeName)&>.utils.hasClass(t,"se-component")?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:gt.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}constructor(t,e){super(t),this.title=this.lang.image,this.icon="image",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"auto",defaultHeight:e.defaultHeight?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"auto",percentageOnlySize:!!e.percentageOnlySize,createFileInput:void 0===e.createFileInput||e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"image/*":e.acceptedFormats.trim()||"image/*",useFormatType:e.useFormatType??!0,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){const n=s.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${No.CreateFileInput({icons:e,lang:t},s)}\n\t\t</div>`:"",o=s.createUrlInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${i.imageGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.imageGallery}">\n\t\t\t\t\t\t\t${e.image_gallery}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.imageGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n\t\t\t<pre class="se-link-preview"></pre>\n\t\t</div>`:"",l=s.canResize?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-size-text">\n\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t<label class="size-h">${t.height}</label>\n\t\t\t</div>\n\t\t\t<input class="se-input-control _se_size_x" placeholder="auto" type="text" />\n\t\t\t<label class="se-modal-size-x">x</label>\n\t\t\t<input type="text" class="se-input-control _se_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_check_proportion" checked/> ${t.proportion}</label>\n\t\t\t<button type="button" aria-label="${t.revert}" class="se-btn se-tooltip se-modal-btn-revert">\n\t\t\t\t${e.revert}\n\t\t\t\t${gt.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=s.useFormatType?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t<button type="button" data-command="asBlock" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_block}\n\t\t\t\t\t${gt.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="asInline" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t${gt.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>`:"",a=`\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t<span class="se-modal-title">${t.image_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-tabs">\n\t\t\t<button type="button" class="_se_tab_link active" data-tab-link="image">${t.image}</button>\n\t\t\t<button type="button" class="_se_tab_link" data-tab-link="url">${t.link}</button>\n\t\t</div>\n\t\t<form method="post" enctype="multipart/form-data">\n\t\t\t<div class="_se_tab_content _se_tab_content_image">\n\t\t\t\t<div class="se-modal-body">\n\t\t\t\t\t${n}\n\t\t\t\t\t${o}\n\t\t\t\t\t<div style="border-bottom: 1px dashed #ccc;"></div>\n\t\t\t\t\t<div class="se-modal-form">\n\t\t\t\t\t\t<label>${t.image_modal_altText}</label><input class="se-input-form _se_image_alt" type="text" />\n\t\t\t\t\t</div>\n\t\t\t\t\t${l}\n\t\t\t\t\t${r}\n\t\t\t\t\t<div class="se-modal-form se-modal-form-footer">\n\t\t\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_check_caption" /> ${t.caption}</label>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-anchor-editor _se_tab_content _se_tab_content_url" style="display: none;">\n\t\t\t</div>\n\t\t\t<div class="se-modal-footer">\n\t\t\t\t<div class="se-figure-align">\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t\t</div>\n\t\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t\t</div>\n\t\t</form>`,h=gt.utils.createElement("DIV",{class:"se-modal-content"},a);return{html:h,alignForm:h.querySelector(".se-figure-align"),fileModalWrapper:h.querySelector(".se-flex-input-wrapper"),imgInputFile:h.querySelector(".__se__file_input"),imgUrlFile:h.querySelector(".se-input-url"),altText:h.querySelector("._se_image_alt"),captionCheckEl:h.querySelector("._se_image_check_caption"),previewSrc:h.querySelector("._se_tab_content_image .se-link-preview"),tabs:h.querySelector(".se-modal-tabs"),galleryButton:h.querySelector(".__se__gallery"),proportion:h.querySelector("._se_check_proportion"),inputX:h.querySelector("._se_size_x"),inputY:h.querySelector("._se_size_y"),revertBtn:h.querySelector(".se-modal-btn-revert"),asBlock:h.querySelector('[data-command="asBlock"]'),asInline:h.querySelector('[data-command="asInline"]'),fileRemoveBtn:h.querySelector(".se-file-remove")}}(t,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||!this.pluginOptions.canResize?[[n,"mirror_h","mirror_v","align","caption","edit","revert","copy","remove"]]:[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["align","caption","edit","revert","copy","remove"]];this.alignForm=s.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.plugins.link?this.plugins.link.pluginOptions:{};this.anchor=new Ho(this,s.html,{textToDisplay:!1,title:!0,openNewWindow:l.openNewWindow,relList:l.relList,defaultRel:l.defaultRel,noAutoPrefix:l.noAutoPrefix,enableFileUpload:e.linkEnableFileUpload}),this.modal=new No(this,s.html),this.figure=new yi(this,o,{sizeUnit:i}),this.fileManager=new Is(this,{query:"img",loadHandler:this.events.onImageLoad,eventHandler:this.events.onImageAction}),this.fileModalWrapper=s.fileModalWrapper,this.imgInputFile=s.imgInputFile,this.imgUrlFile=s.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=s.altText,this.captionCheckEl=s.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.as="block",this.proportion=null,this.inputX=null,this.inputY=null,this._linkElement=null,this._linkValue="",this._align="none",this._svgDefaultSize="30%",this._base64RenderIndex=0,this._element=null,this._cover=null,this._container=null,this._caption=null,this._ratio={w:1,h:1},this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.eventManager.addEvent(s.tabs,"click",this.#ot.bind(this)),this.imgInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#lt.bind(this)),this.imgUrlFile&&this.eventManager.addEvent(this.imgUrlFile,"input",this.#rt.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.eventManager.addEvent(this.imgInputFile,"change",this.#at.bind(this));const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#ht.bind(this)),this._resizing){this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#ct.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this))}this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=s.asBlock,this.asInline=s.asInline,this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#pt.bind(this)))}open(){this.modal.open()}edit(){this.modal.open()}on(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this._resizing&&(this.inputX.value=this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}onFilePasteAndDrop({file:t}){if(/^image/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){return this._align=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this._update(this.inputX?.value,this.inputY?.value),this.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this._linkValue.length>0)&&await this.submitURL(this._linkValue)}retainFormat(){return{query:"img",method:t=>{const e=yi.GetContainer(t);e&&e.container&&e.cover||(this._ready(t),this._fileCheck(this._origin_w,this._origin_h))}}}init(){No.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.altText.value="",this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,this.captionCheckEl.checked=!1,this._element=null,this._ratio={w:1,h:1},this.#ot("init"),this._resizing&&(this.inputX.value="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.checked=!0),this.pluginOptions.useFormatType&&this._activeAsInline("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.anchor.init()}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this.anchor.set(gt.check.isAnchor(t.parentNode)?t.parentNode:null),this._linkElement=this.anchor.currentTarget,this._element=t,this._cover=e.cover,this._container=e.container,this._caption=e.caption,this._align=e.align,t.style.float="",this._origin_w=String(e.originWidth||e.w||""),this._origin_h=String(e.originHeight||e.h||""),this.altText.value=this._element.alt,this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=this._element.src);if((this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this._caption,!this._resizing)return;const i=this._onlyPercentage&&this.figure.isVertical;let s=i?"":e.width;if(this._onlyPercentage&&(s=mt.get(s,2),s>100&&(s=100)),this.inputX.value=String("auto"===s?"":s),!this._onlyPercentage){const t=i?"":e.height;this.inputY.value=String("auto"===t?"":t)}this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1},this.pluginOptions.useFormatType&&this._activeAsInline(this.component.isInline(e.container))}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,yi.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onImageDeleteBefore",{element:e,container:i,align:this._align,alt:this.altText.value,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}_getInfo(){return{element:this._element,anchor:this.anchor.create(!0),inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,alt:this.altText.value}}_activeAsInline(t){t?(gt.utils.addClass(this.asInline,"on"),gt.utils.removeClass(this.asBlock,"on"),this.as="inline",this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(gt.utils.addClass(this.asBlock,"on"),gt.utils.removeClass(this.asInline,"on"),this.as="block",this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/image/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onImageUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Bo?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+n/1e3+"KB",i=await this.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Bo?t:i||t,"error"),!1}const l={files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l);this._serverUpload;const a=await this.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Bo||r(null)))}async submitURL(t){if(t||(t=this._linkValue),!t)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,...this._getInfo()},s=function(t,e){const i=(t=e||t).url;this.modal.isUpdate?this._updateSrc(i,t.element,t.files):this._produce(i,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt)}.bind(this,i),n=await this.triggerEvent("onImageUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==Bo||s(null),!0)}_update(t,e){t||(t=this.inputX?.value||"auto"),e||(e=this.inputY?.value||"auto");let i=this._element;const s=this._cover,n=this._container===this._cover?null:this._container;let o;const l=mt.is(t)?t+this.sizeUnit:t,r=mt.is(e)?e+this.sizeUnit:e;o=/%$/.test(i.style.width)?l!==n.style.width||r!==n.style.height:l!==i.style.width||r!==i.style.height,i.alt=this.altText.value;let a=!1;this.captionCheckEl.checked?this._caption||(this._caption=yi.CreateCaption(s,this.lang.caption),a=!0):this._caption&&(gt.utils.removeItem(this._caption),this._caption=null,a=!0);let h=!1;const c=this.anchor.create(!0);if(c)this._linkElement===c&&n.contains(c)||(this._linkElement=c.cloneNode(!1),s.insertBefore(this._setAnchor(i,this._linkElement),this._caption),h=!0);else if(null!==this._linkElement&&s.contains(this._linkElement)){const t=i.cloneNode(!0);s.removeChild(this._linkElement),s.insertBefore(t,this._caption),i=t}this._resizing&&o&&this._applySize(t,e),h&>.utils.removeItem(c),(a||!this._onlyPercentage&&o)&&(/\d+/.test(i.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(i):this.figure.setTransform(i,t,e,0)),this.figure.setAlign(i,this._align),i.onload=()=>{this.select(i)}}_fileCheck(t,e){t||(t=this.inputX?.value||"auto"),e||(e=this.inputY?.value||"auto");let i,s=this._element,n=this._cover,o=null,l=this._container===this._cover?null:this._container,r=!1;if(!n||!l){r=!0,s=this._element.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this._element.parentElement?.nodeName)||this.format.isLine(this._element.parentElement))?yi.CreateInlineContainer(s,"se-image-container"):yi.CreateContainer(s,"se-image-container");n=e.cover,l=e.container,o=e.inlineCover,this.figure.open(s,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0})}const a=mt.is(t)?t+this.sizeUnit:t,h=mt.is(e)?e+this.sizeUnit:e;i=/%$/.test(s.style.width)?a!==l.style.width||h!==l.style.height:a!==s.style.width||h!==s.style.height,s.alt=this.altText.value;let c=!1;o||(this.captionCheckEl.checked?this._caption&&!r||(this._caption=yi.CreateCaption(n,this.lang.caption),c=!0):this._caption&&(gt.utils.removeItem(this._caption),this._caption=null,c=!0));let d=null;const u=this.anchor.create(!0);if(u)(this._linkElement!==u||r&&!l.contains(u))&&(this._linkElement=u.cloneNode(!1),n.insertBefore(this._setAnchor(s,this._linkElement),this._caption),d=this._element);else if(null!==this._linkElement&&n.contains(this._linkElement)){const t=s.cloneNode(!0);n.removeChild(this._linkElement),n.insertBefore(t,this._caption),s=t}r&&(s=this._element,this.figure.retainFigureFormat(l,this._element,d?u:null,this.fileManager),this._element=s=l.querySelector("img"),this._cover=n,this._container=l),this._resizing&&i&&this._applySize(t,e),d&&(r?(gt.utils.removeItem(d),0===gt.query.getListChildren(u,(t=>/IMG/i.test(t.tagName))).length&>.utils.removeItem(u)):gt.utils.removeItem(u)),(c||!this._onlyPercentage&&i)&&(/\d+/.test(s.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(s):this.figure.setTransform(s,t,e,0)),this.figure.setAlign(s,this._align)}#ot(t){const e=this.modal.form,i="string"==typeof t?e.querySelector("._se_tab_link"):gt.query.getEventTarget(t);if(!/^BUTTON$/i.test(i.tagName))return!1;const s=i.getAttribute("data-tab-link");let n;const o=e.getElementsByClassName("_se_tab_content");for(n=0;n<o.length;n++)o[n].style.display="none";const l=e.getElementsByClassName("_se_tab_link");for(n=0;n<l.length;n++)gt.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+s).style.display="block",gt.utils.addClass(i,"active"),"init"!==t&&("image"===s?this.focusElement.focus():"url"===s&&this.anchor.urlInput.focus()),!1}_produce(t,e,i,s,n,o,l){"inline"!==this.as?this.create(t,e,i,s,n,o,l):this.createInline(t,e,i,s,o,l)}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t)&&(t+="%"):t="100%"),this.figure.setSize(t,e)}create(t,e,i,s,n,o,l){const r=gt.utils.createElement("IMG");r.src=t,r.alt=l,e=this._setAnchor(r,e?e.cloneNode(!1):null);const a=yi.CreateContainer(e,"se-image-container"),h=a.cover,c=a.container;this.captionCheckEl.checked&&(this._caption=yi.CreateCaption(h,this.lang.caption)),this._element=r,this._cover=h,this._container=c,this.figure.open(r,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),this._applySize(i,s),this.figure.setAlign(r,n),this.fileManager.setFileData(r,o),r.onload=this.#gt.bind(this,r,this._svgDefaultSize,c),this.component.insert(c,{skipCharCount:!1,skipSelection:!this.options.get("componentAutoSelect"),skipHistory:!1})}createInline(t,e,i,s,n,o){const l=gt.utils.createElement("IMG");l.src=t,l.alt=o,e=this._setAnchor(l,e?e.cloneNode(!1):null);const r=yi.CreateInlineContainer(e,"se-image-container").container;this._element=l,this._container=r,this.figure.open(l,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),this._applySize(i,s),this.fileManager.setFileData(l,n),l.onload=this.#gt.bind(this,l,this._svgDefaultSize,r),this.component.insert(r,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}_updateSrc(t,e,i){e.src=t,this.fileManager.setFileData(e,i),this.component.select(e,Io.key)}_register(t,e){const i=e.result;for(let e,s=0,n=i.length;s<n;s++){if(e={name:i[s].name,size:i[s].size},t.isUpdate){this._updateSrc(i[s].url,t.element,e);break}this._produce(i[s].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt)}}_serverUpload(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0?this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#mt.bind(this,t),this._error.bind(this)):this._setBase64(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.alt,t.isUpdate)}_setBase64(t,e,i,s,n,o,l){try{const r=this.modal.isUpdate?1:t.length;if(0===r)return this.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=r;const a=new Array(r);this._resizing&&(this.inputX.value=i,this.inputY.value=s);for(let h,c,d=0;d<r;d++)h=new FileReader,c=t[d],h.onload=function(t,l,r,h,c){a[c]={result:t.result,file:h},0==--this._base64RenderIndex&&(this._onRenderBase64(l,a,r,e,i,s,n,o),this.ui.hideLoading())}.bind(this,h,l,this._element,c,d),this._onRenderBase64,h.readAsDataURL(c)}catch(t){throw this.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}_onRenderBase64(t,e,i,s,n,o,l,r){for(let a=0,h=e.length;a<h;a++)t?this._updateSrc(e[a].result,i,e[a].file):this._produce(e[a].result,s,n,o,l,e[a].file,r)}_setAnchor(t,e){return e?(e.appendChild(t),e):t}async _error(t){const e=await this.triggerEvent("onImageUploadError",{error:t}),i=e===Bo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.image.error]",i)}async#mt(t,e){if(await this.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===Bo){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#lt(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#dt(t,e){if(ft.isSpace(e.code))e.preventDefault();else if("x"===t&&this._onlyPercentage&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=yi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}#ct(){this._ratio=this.proportion.checked?yi.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#pt({target:t}){this._activeAsInline("asInline"===t.getAttribute("data-command"))}#rt(t){const e=t.target.value.trim();this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#at({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,t.files)}#ht(){this.plugins.imageGallery.open(this.#ft.bind(this))}#ft(t){this.altText.value=t.getAttribute("data-value")||t.alt,this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#gt(t,e,i){if(0===t.offsetWidth&&this._applySize(e,""),this.options.get("componentAutoSelect"))this.component.select(t,Io.key);else if(this.component.isInline(i)){const e=this.selection.getNearRange(i);e?this.selection.setRange(e.container,e.offset,e.container,e.offset):this.component.select(t,Io.key)}else{const t=this.format.addLine(i,null);t&&this.selection.setRange(t,0,t,0)}this.editor._iframeAutoHeight(this.editor.frameContext),this.history.push(!1),delete t.onload}}const Vo=Io,{NO_EVENT:Oo}=dt;class Ro extends ii{static key="video";static type="modal";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.checkContentType(t.src)?t:null}constructor(t,e){super(t),this.title=this.lang.video,this.icon="video",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&mt.get(e.defaultWidth,0)?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&mt.get(e.defaultHeight,0)?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:mt.get(e.defaultRatio,4)||.5625,showRatioOption:void 0===e.showRatioOption||!!e.showRatioOption,ratioOptions:e.ratioOptions?e.ratioOptions:null,videoTagAttributes:e.videoTagAttributes||null,iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||""};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){let n=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;s.createFileInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_file}</label>\n\t\t\t\t${No.CreateFileInput({lang:t,icons:e},s)}\n\t\t\t</div>`);s.createUrlInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input class="se-input-form se-input-url" type="text" data-focus />\n\t\t\t\t\t${i.videoGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.videoGallery}">\n\t\t\t\t\t\t\t\t${e.video_gallery}\n\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.videoGallery)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t</div>\n\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t</div>`);if(s.canResize){const i=s.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=s.defaultRatio,l=s.percentageOnlySize,r=l?' style="display: none !important;"':"",a=s.showHeightInput?"":' style="display: none !important;"',h=s.showRatioOption?"":' style="display: none !important;"',c=l||s.showHeightInput||s.showRatioOption?"":' style="display: none !important;"';n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${a}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${h}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="100%"${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${c}>${l?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="${100*s.defaultRatio}%"\n\t\t\t\t${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}${a}/>\n\t\t\t\t<select class="se-input-select se-modal-ratio" title="${t.ratio}" aria-label="${t.ratio}"${h}>\n\t\t\t\t\t${a?"":'<option value=""> - </option>'} \n\t\t\t\t\t${i.map((t=>`<option value="${t.value}"${o.toString()===t.value.toString()?" selected":""}>${t.name}</option>`)).join("")}\n\t\t\t\t</select>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${r}${c}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}n+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const o=gt.utils.createElement("DIV",{class:"se-modal-content"},n);return{html:o,alignForm:o.querySelector(".se-figure-align"),fileModalWrapper:o.querySelector(".se-flex-input-wrapper"),videoInputFile:o.querySelector(".__se__file_input"),videoUrlFile:o.querySelector(".se-input-url"),previewSrc:o.querySelector(".se-link-preview"),galleryButton:o.querySelector(".__se__gallery"),proportion:o.querySelector("._se_check_proportion"),frameRatioOption:o.querySelector(".se-modal-ratio"),inputX:o.querySelector("._se_size_x"),inputY:o.querySelector("._se_size_y"),revertBtn:o.querySelector(".se-modal-btn-revert"),fileRemoveBtn:o.querySelector(".se-file-remove")}}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["align","edit","copy","remove"]]:[["resize_auto,75,50","align","edit","revert","copy","remove"]];n.some((t=>t.includes("align")))||(s.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new No(this,s.html),this.figure=new yi(this,n,{sizeUnit:i,autoRatio:{current:o,default:o}}),this.fileManager=new Is(this,{query:"iframe, video",loadHandler:this.events.onVideoLoad,eventHandler:this.events.onVideoAction}),this.fileModalWrapper=s.fileModalWrapper,this.videoInputFile=s.videoInputFile,this.videoUrlFile=s.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=s.previewSrc,this._linkValue="",this._align="none",this._frameRatio=o,this._defaultRatio=o,this._defaultSizeX="100%",this._defaultSizeY=100*this.pluginOptions.defaultRatio+"%",this.sizeUnit=i,this.proportion=null,this.frameRatioOption=null,this.inputX=null,this.inputY=null,this._element=null,this._cover=null,this._container=null,this._ratio={w:1,h:1},this._origin_w="100%"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h=this.pluginOptions.defaultHeight===o?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),pt.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),pt.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);this.extensions=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"].concat(this.pluginOptions.extensions||[]),this.urlPatterns=l.concat([/youtu\.?be/,/vimeo\.com\//,/dailymotion\.com\/video\//,/facebook\.com\/.+\/videos\//,/facebook\.com\/watch\/\?v=/,/twitter\.com\/.+\/status\//,/twitch\.tv\/videos\//,/twitch\.tv\/[^/]+$/,/tiktok\.com\/@[^/]+\/video\//,/instagram\.com\/p\//,/instagram\.com\/tv\//,/instagram\.com\/reel\//,/linkedin\.com\/posts\//,/\.(wistia\.com|wi\.st)\/(medias|embed)\//,/loom\.com\/share\//]).concat(e.urlPatterns||[]);const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#ht.bind(this)),this.videoInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#lt.bind(this)),this.videoUrlFile&&this.eventManager.addEvent(this.videoUrlFile,"input",this.#rt.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.eventManager.addEvent(this.videoInputFile,"change",this.#at.bind(this)),this._resizing){this.proportion=s.proportion,this.frameRatioOption=s.frameRatioOption,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#ct.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(this.frameRatioOption,"change",this.#_t.bind(this)),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this))}}open(){this.modal.open()}edit(){this.modal.open()}on(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):(this._resizing&&(this.inputX.value=this._origin_w=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0),this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple")),this._resizing&&this._setRatioSelect(this._origin_h||this._defaultRatio)}onFilePasteAndDrop({file:t}){if(/^video/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){this._align=this.modal.form.querySelector('input[name="suneditor_video_radio"]:checked').value;let t=!1;return this.videoInputFile&&this.videoInputFile.files.length>0?t=await this.submitFile(this.videoInputFile.files):this.videoUrlFile&&this._linkValue.length>0&&(t=await this.submitURL(this._linkValue)),t&&this._w.setTimeout(this.component.select.bind(this.component,this._element,Ro.key),0),t}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!this.checkContentType(t.src))return;const e=yi.GetContainer(t);if(e&&e.container&&e.cover)return;this._ready(t);const i=this.format.getLine(t);i&&(this._align=i.style.textAlign||i.style.float),this._update(t)}}}init(){No.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,this._ratio={w:1,h:1},this._nonResizing=!1,this._resizing&&(this.inputX.value=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0,this._setRatioSelect(this._defaultRatio))}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this._element=t,this._cover=e.cover,this._container=e.container,this._align=e.align,t.style.float="",this._origin_w=String(e.width||e.originWidth||e.w||""),this._origin_h=String(e.height||e.originHeight||e.h||"");let i=e.width||e.w||this._origin_w||"";const s=e.height||e.h||this._origin_h||"";this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=this._element.src||this._element.querySelector("source")?.src||"");if((this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,!this._resizing)return;const n=this._onlyPercentage&&this.figure.isVertical;if(this._onlyPercentage&&(i=mt.get(i,2),i>100&&(i=100)),this.inputX.value=String("auto"===i?"":i),!this._onlyPercentage){const t=n?"":e.height;this.inputY.value=String("auto"===t?"":t)}this._setRatioSelect(s)||(this.inputY.value=String(this._onlyPercentage?mt.get(s,2):s)),this.proportion.checked=!0,this.inputX.disabled=!!n,this.inputY.disabled=!!n,this.proportion.disabled=!!n,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1}}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,yi.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onVideoDeleteBefore",{element:e,container:i,align:this._align,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!(!this.extensions.some((e=>t.endsWith(e)))&&!this.urlPatterns.some((e=>e.test(t))))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}convertUrlYoutube(t){return/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t}convertUrlVimeo(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1)}addQuery(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t}create(t,e,i,s,n,o,l){let r=null,a=null;if(o){if((t=this._element).src!==e){const i=this.findProcessUrl(e);if(/^iframe$/i.test(i?.tag)&&!/^iframe$/i.test(t.nodeName)){const i=this.createIframeTag();i.src=e,t.replaceWith(i),this._element=t=i}else if(/^video$/i.test(i?.tag)&&!/^video$/i.test(t.nodeName)){const i=this.createVideoTag();i.src=e,t.replaceWith(i),this._element=t=i}else t.src=e}a=this._container,r=gt.query.getParentElement(t,"FIGURE")}else{t.src=e,this._element=t;const i=yi.CreateContainer(t,"se-video-container");r=i.cover,a=i.container}this._element=t,this._cover=r,this._container=a,this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),i=i||this._defaultSizeX,s=s||this._frameRatio;const h=this.figure.getSize(t),c=h.w!==i||h.h!==s,d=!o||c;if(d&&this._applySize(i,s),this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o)this._resizing&&d&&this.figure.isVertical&&this.figure.setTransform(t,i,s,0),this.history.push(!1);else if(this.component.insert(a,{skipCharCount:!1,skipSelection:!0,skipHistory:!1}),!this.options.get("componentAutoSelect")){const t=this.format.addLine(a,null);t&&this.selection.setRange(t,0,t,0)}}createIframeTag(t){const e=gt.utils.createElement("IFRAME");if(t)for(const i in t)e[i]=t[i];return this._setIframeAttrs(e),e}createVideoTag(t){const e=gt.utils.createElement("VIDEO");if(t)for(const i in t)e[i]=t[i];return this._setTagAttrs(e),e}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}_getInfo(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,element:this._element}}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/video/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Oo?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+n/1e3+"KB",i=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Oo?t:i||t,"error"),!1}const l={url:null,files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l);this._serverUpload;const a=await this.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Oo||r(null)))}async submitURL(t){if(t||(t=this._linkValue),!t)return!1;if(/^<iframe.*\/iframe>$/.test(t)){if(0===(t=(new DOMParser).parseFromString(t,"text/html").querySelector("iframe").src).length)return!1}const e=this.findProcessUrl(t);e&&(t=e.url);const i={name:t.split("/").pop(),size:0},s={url:t,files:i,...this._getInfo(),process:e},n=function(t,e){t=e||t,this.create(this[/^iframe$/i.test(t.process?.tag)?"createIframeTag":"createVideoTag"](),t.url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,t.files)}.bind(this,s),o=await this.triggerEvent("onVideoUploadBefore",{info:s,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==Oo||n(null),!0)}_update(t){if(!t)return;/^video$/i.test(t.nodeName)?this._setTagAttrs(t):/^iframe$/i.test(t.nodeName)&&this._setIframeAttrs(t);let e=this.format.isBlock(t.parentNode)||gt.check.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t,s=t.cloneNode(!0),n=yi.CreateContainer(s,"se-video-container").container,o=e.querySelector("figcaption");let l=null;o&&(l=gt.utils.createElement("DIV"),l.innerHTML=o.innerHTML,gt.utils.removeItem(o)),this.figure.open(s,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const r=(s.getAttribute("data-se-size")||",").split(",");this._applySize(r[0]||i.style.width||i.width||"",r[1]||i.style.height||i.height||"");const a=this.format.getLine(i);if(a&&(this._align=a.style.textAlign||a.style.float),this.figure.setAlign(s,this._align),gt.query.getParentElement(i,gt.check.isExcludeFormat))i.replaceWith(n);else if(gt.check.isListCell(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(n,t),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLine(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(n,e),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.replaceWith(n);return l&&e.parentNode.insertBefore(l,n.nextElementSibling),s}_register(t,e){const i=e.result,s=this.createVideoTag();for(let e=0,n=i.length;e<n;e++){const n=t.isUpdate?t.element:s.cloneNode(!1);this.create(n,i[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:i[e].name,size:i[e].size})}}_serverUpload(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0&&this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#mt.bind(this,t),this._error.bind(this))}_setTagAttrs(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_setIframeAttrs(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_setRatioSelect(t){let e=!1;const i=this.frameRatioOption.options;/%$/.test(t+"")||this._onlyPercentage?t=mt.get(t,2)/100+"":(!mt.is(t)||Number(t)>=1)&&(t=""),this.inputY.placeholder="";for(let s=0,n=i.length;s<n;s++)i[s].value===t?(e=i[s].selected=!0,this.inputY.placeholder=t?100*Number(t)+"%":""):i[s].selected=!1;return e}async _error(t){const e=await this.triggerEvent("onVideoUploadError",{error:t}),i=e===Oo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#mt(t,e){if(await this.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Oo){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#lt(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#rt(t){const e=gt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this._linkValue=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ht(){this.plugins.videoGallery.open(this.#ft.bind(this))}#ft(t){this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#at(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=gt.query.getEventTarget(t);No.OnChangeFile(this.fileModalWrapper,e.files)}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#_t(t){const e=gt.query.getEventTarget(t),i=e.options[e.selectedIndex].value;this._defaultSizeY=this.figure.autoRatio.current=this._frameRatio=i?100*Number(i)+"%":this._defaultSizeY,this.inputY.placeholder=i?100*Number(i)+"%":"",this.inputY.value=""}#ct(){this._ratio=this.proportion.checked?yi.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}#dt(t,e){if(ft.isSpace(e.code))return void e.preventDefault();const i=gt.query.getEventTarget(e);if("x"===t&&this._onlyPercentage&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=yi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}"y"===t&&this._setRatioSelect(i.value||this._defaultRatio)}}const zo=Ro,{NO_EVENT:$o,ON_OVER_COMPONENT:Fo}=dt;class Po extends ii{static key="audio";static type="modal";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"audio/*":e.acceptedFormats.trim()||"audio/*",audioTagAttributes:e.audioTagAttributes||null};const i=function({lang:t,icons:e,plugins:i},s){let n=`\n <form method="post" enctype="multipart/form-data">\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.audio_modal_title}</span>\n </div>\n <div class="se-modal-body">`;s.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${No.CreateFileInput({lang:t,icons:e},s)}\n </div>`);s.createUrlInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${i.audioGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.audioGallery}">\n\t\t\t\t\t\t\t${e.audio_gallery}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.audioGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n <pre class="se-link-preview"></pre>\n </div>`);return n+=`\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,gt.utils.createElement("DIV",{class:"se-modal-content"},n)}(t,this.pluginOptions),s=function({lang:t,icons:e}){const i=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return gt.utils.createElement("DIV",{class:"se-controller"},i)}(t);this.modal=new No(this,i),this.controller=new hi(this,s,{position:"bottom",disabled:!0}),this.fileManager=new Is(this,{query:"audio",loadHandler:this.events.onAudioLoad,eventHandler:this.events.onAudioAction}),this.figure=new yi(this,null,{}),this.fileModalWrapper=i.querySelector(".se-flex-input-wrapper"),this.audioInputFile=i.querySelector(".__se__file_input"),this.audioUrlFile=i.querySelector(".se-input-url"),this.preview=i.querySelector(".se-link-preview"),this._element=null,this.defaultWidth=this.pluginOptions.defaultWidth,this.defaultHeight=this.pluginOptions.defaultHeight,this.urlValue="";const n=i.querySelector(".__se__gallery");n&&this.eventManager.addEvent(n,"click",this.#ht.bind(this)),this.audioInputFile&&(this.eventManager.addEvent(i.querySelector(".se-modal-files-edge-button"),"click",this.#lt.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.eventManager.addEvent(this.audioInputFile,"change",this.#bt.bind(this))),this.audioUrlFile&&this.eventManager.addEvent(this.audioUrlFile,"input",this.#rt.bind(this))}open(){this.modal.open()}on(t){t?this._element?(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src,this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple")):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple"):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.setAttribute("multiple","multiple")}onFilePasteAndDrop({file:t}){if(/^audio/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?await this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.urlValue.length>0)&&await this.submitURL(this.urlValue)}init(){No.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration="")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src),this.open();break;case"copy":{const t=yi.GetContainer(this._element);this.component.copy(t.container);break}case"delete":this.destroy()}}retainFormat(){return{query:"audio",method:t=>{const e=yi.GetContainer(t);if(e&&e.container&&e.cover)return;this._setTagAttrs(t);const i=yi.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(i.container,t,null,this.fileManager)}}}select(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1}),this._ready(t)}_ready(t){Qt.get("__overInfo")!==Fo&&(this._element=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}async destroy(t){const e=t||this._element,i=yi.GetContainer(e),s=i.container||e,n=s.previousElementSibling||s.nextElementSibling;if(!1===await this.triggerEvent("onAudioDeleteBefore",{element:e,container:i,url:e.getAttribute("src")}))return;const o=s.parentNode;gt.utils.removeItem(s),this.init(),this.controller.close(),o!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(n),this.history.push(!1)}_register(t,e){const i=e.result;for(let e,s,n=0,o=i.length;n<o;n++)s=t.isUpdate?t.element:this._createAudioTag(),e={name:i[n].name,size:i[n].size},this._createComp(s,i[n].url,e,t.isUpdate)}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/audio/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===$o?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit;if(n>0&&e+this.fileManager.getSize()>n){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+n/1e3+"KB",i=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.ui.alertOpen(i===$o?t:i||t,"error"),!1}const o={files:i,isUpdate:this.modal.isUpdate,element:this._element},l=function(t,e){e=t||e,this._serverUpload(e,e.files)}.bind(this,o),r=await this.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==$o||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,isUpdate:this.modal.isUpdate,element:this._createAudioTag()},s=function(t,e){e=t||e,this._createComp(e.element,e.url,e.files,e.isUpdate)}.bind(this,i),n=await this.triggerEvent("onAudioUploadBefore",{info:i,handler:s});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==$o||s(null),!0)}_createComp(t,e,i,s){if(s){if(this._element&&(t=this._element),this.fileManager.setFileData(t,i),!t||t.src===e)return void this.component.select(t,Po.key);t.src=e,this.component.select(t,Po.key)}else{this.fileManager.setFileData(t,i),t.src=e;const s=yi.CreateContainer(t,"se-flex-component");if(!this.component.insert(s.container,{skipCharCount:!1,skipSelection:!this.options.get("componentAutoSelect"),skipHistory:!1}))return void this.editor.focus();if(!this.options.get("componentAutoSelect")){const t=this.format.addLine(s.container,null);t&&this.selection.setRange(t,0,t,0)}}s&&this.history.push(!1)}_createAudioTag(){const t=this.defaultWidth,e=this.defaultHeight,i=gt.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this._setTagAttrs(i),i}_setTagAttrs(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_serverUpload(t,e){if(!e)return;const i=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,i,this.#mt.bind(this,t),this._error.bind(this))}async _error(t){const e=await this.triggerEvent("onAudioUploadError",{error:t}),i=e===$o?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.audio.error]",i)}async#mt(t,e){if(await this.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===$o){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#rt(t){const e=gt.query.getEventTarget(t).value.trim();this.urlValue=this.preview.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ht(){this.plugins.audioGallery.open(this.#ft.bind(this))}#ft(t){this.urlValue=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#lt(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#bt(t){const e=gt.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,e.files)}}const Do=Po,{NO_EVENT:qo}=dt;class Wo extends ii{static key="embed";static type="modal";static className="";static component(t){let e="";return gt.check.isIFrame(t)&&(e=t.src),/^DIV$/i.test(t?.nodeName)&>.check.isIFrame(t.firstElementChild)&&(e=t.firstElementChild.src),e&&this.checkContentType(e)?t:null}constructor(t,e){super(t),this.title=this.lang.embed,this.icon="embed",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&mt.get(e.defaultWidth,0)?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&mt.get(e.defaultHeight,0)?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||""};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e},i){let s=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.embed_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">\n\t\t\t<div class='se-modal-form'>\n\t\t\t\t<label>${t.embed_modal_source}</label>\n\t\t\t\t<input class='se-input-form se-input-url' type='text' data-focus />\n\t\t\t\t<pre class='se-link-preview'></pre>\n\t\t\t</div>`;if(i.canResize){const n=i.percentageOnlySize,o=n?' style="display: none !important;"':"",l=i.showHeightInput?"":' style="display: none !important;"',r=i.showRatioOption?"":' style="display: none !important;"',a=n||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';s+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${l}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${r}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="auto"${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${a}>${n?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="auto"\n\t\t\t\t${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}${l}/>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${o}${a}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}s+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const n=gt.utils.createElement("DIV",{class:"se-modal-content"},s);return{html:n,figureAlignBtn:n.querySelector(".se-figure-align"),fileModalWrapper:n.querySelector(".se-flex-input-wrapper"),embedInput:n.querySelector(".se-input-url"),previewSrc:n.querySelector(".se-link-preview"),proportion:n.querySelector("._se_check_proportion"),inputX:n.querySelector("._se_size_x"),inputY:n.querySelector("._se_size_y"),revertBtn:n.querySelector(".se-modal-btn-revert")}}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["align","edit","copy","remove"]]:[["resize_auto,75,50","align","edit","revert","copy","remove"]];n.some((t=>t.includes("align")))||(s.figureAlignBtn.style.display="none"),this.modal=new No(this,s.html),this.figure=new yi(this,n,{sizeUnit:i}),this.fileModalWrapper=s.fileModalWrapper,this.embedInput=s.embedInput,this.focusElement=this.embedInput,this.previewSrc=s.previewSrc,this._linkValue="",this._align="none",this._defaultSizeX=this.pluginOptions.defaultWidth,this._defaultSizeY=this.pluginOptions.defaultHeight,this.sizeUnit=i,this.proportion=null,this.inputX=null,this.inputY=null,this._element=null,this._cover=null,this._container=null,this._ratio={w:1,h:1},this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.query={facebook:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,action:t=>`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true&width=500`,tag:"iframe"},twitter:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:twitter\.com)\/(status|embed)\/(.+)/i,action:t=>`https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(t)}`,tag:"iframe"},instagram:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:instagram\.com)\/p\/(.+)/i,action:t=>`https://www.instagram.com/p/${t.match(this.query.instagram.pattern)[1]}/embed`,tag:"iframe"},linkedin:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:linkedin\.com)\/(.+)\/(.+)/i,action:t=>`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(t.split("/").pop())}`,tag:"iframe"},pinterest:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:pinterest\.com)\/pin\/(.+)/i,action:t=>`https://assets.pinterest.com/ext/embed.html?id=${t.match(this.query.pinterest.pattern)[1]}`,tag:"iframe"},spotify:{pattern:/(?:https?:\/\/)?(?:open\.)?(?:spotify\.com)\/(track|album|playlist|show|episode)\/(.+)/i,action:t=>{const e=t.match(this.query.spotify.pattern);return`https://open.spotify.com/embed/${e[1]}/${e[2]}`},tag:"iframe"},codepen:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:codepen\.io)\/(.+)\/pen\/(.+)/i,action:t=>{const[,e,i]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${i}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);this.urlPatterns=o.concat(e.urlPatterns||[]),this.eventManager.addEvent(this.embedInput,"input",this.#rt.bind(this)),this._resizing&&(this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this)))}open(){this.modal.open()}edit(){this.modal.open()}on(t){!t&&this._resizing&&(this.inputX.value=this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0)}async modalAction(){this._align=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this._linkValue.length>0&&(t=await this.submitSRC(this._linkValue)),t&&this._w.setTimeout(this.component.select.bind(this.component,this._element,Wo.key),0),t}retainFormat(){return{query:"iframe",method:async t=>{if(!this.checkContentType(t.src))return;const e=yi.GetContainer(t);if(e&&e.container&&e.cover)return;this._ready(t);const i=this.format.getLine(t);i&&(this._align=i.style.textAlign||i.style.float),this._update(t)}}}init(){No.OnChangeFile(this.fileModalWrapper,[]),this._linkValue=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this._ratio={w:1,h:1},this._nonResizing=!1,this._resizing&&(this.inputX.value=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this._element=t,this._cover=e.cover,this._container=e.container,this._caption=e.caption,this._align=e.align,t.style.float="",this._origin_w=String(e.originWidth||e.w||""),this._origin_h=String(e.originHeight||e.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this._resizing)return;const i=this._onlyPercentage&&this.figure.isVertical;let s=i?"":e.width;if(this._onlyPercentage&&(s=mt.get(s,2),s>100&&(s=100)),this.inputX.value=String("auto"===s?"":s),!this._onlyPercentage){const t=i?"":e.height;this.inputY.value=String("auto"===t?"":t)}this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1}}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,yi.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onEmbedDeleteBefore",{element:e,container:i,align:this._align,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!!this.urlPatterns.some((e=>e.test(t)))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}async submitSRC(t){if(t||(t=this._linkValue),!t)return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const i=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===i.length)return!1;e={children:i,...this._getInfo(),process:null}}else{const i=this.findProcessUrl(t);if(!i)return!1;e={url:t=i.url,...this._getInfo(),process:i}}const i=function(t,e){t=e||t,this._create(t.process,t.url,t.children,t.inputWidth,t.inputHeight,t.align,t.isUpdate)}.bind(this,e);this._create;const s=await this.triggerEvent("onEmbedInputBefore",{...e,handler:i});return void 0===s||!1!==s&&(null!==s&&"object"==typeof s&&i(s),!0!==s&&s!==qo||i(null),!0)}_createIframeTag(){const t=gt.utils.createElement("IFRAME");return this._setIframeAttrs(t),t}_createEmbedTag(){return gt.utils.createElement("BLOCKQUOTE")}_create(t,e,i,s,n,o,l){let r=null,a=null,h=null,c=null;if(l){if(r=this._element,r.src!==e){const t=this.findProcessUrl(e);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(r.nodeName)){const t=this._createIframeTag();t.src=e,r.replaceWith(t),r=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(r.nodeName)){const t=this._createEmbedTag();t.setAttribute("src",e),r.replaceWith(t),r=t}else r.src=e}h=this._container,a=gt.query.getParentElement(r,"FIGURE")}else if(t){r=this._createIframeTag(),r.src=e;const t=yi.CreateContainer(r,"se-embed-container");a=t.cover,h=t.container}else{r=i[0];const t=yi.CreateContainer(r,"se-embed-container");a=t.cover,h=t.container;let e=null,s=0;for(;e=i[s];)/^script$/i.test(e.nodeName)?(c=gt.utils.createElement("script",{src:e.getAttribute("src"),async:"true"},null),s++):a.appendChild(e)}this._element=r,this._cover=a,this._container=h,this.figure.open(r,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),s=s||this._defaultSizeX,n=n||this._defaultSizeY;const d=this.figure.getSize(r),u=d.w!==s||d.h!==n,p=!l||u;if(p&&this._applySize(s,n),this.figure.setAlign(r,o),l)this._resizing&&p&&this.figure.isVertical&&this.figure.setTransform(r,s,n,0),c||this.history.push(!1);else{if(this.component.insert(h,{skipCharCount:!1,skipSelection:!0,skipHistory:!0}),c)try{this.history.pause(),c.onload=()=>{gt.utils.removeItem(c),c=null},a.appendChild(c);const t=new MutationObserver((e=>{for(const i of e)if("childList"===i.type&&!r.parentElement){this.history.resume(),this.history.push(!1),t.disconnect();break}}));t.observe(this.editor.frameContext.get("wysiwyg"),{subtree:!0,childList:!0})}catch(t){this.history.resume(),console.warn("[SUNEDITOR] Embed tag script load error.",t)}if(!this.options.get("componentAutoSelect")){const t=this.format.addLine(h,null);t&&this.selection.setRange(t,0,t,0)}}}_update(t){if(!t)return;this._setIframeAttrs(t);let e=this.format.isBlock(t.parentNode)||gt.check.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t;t=t.cloneNode(!0);const s=yi.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const n=(t.getAttribute("data-se-size")||",").split(",");this._applySize(n[0]||i.style.width||i.width||"",n[1]||i.style.height||i.height||"");const o=this.format.getLine(i);if(o&&(this._align=o.style.textAlign||o.style.float),this.figure.setAlign(t,this._align),gt.query.getParentElement(i,gt.check.isExcludeFormat))i.replaceWith(s);else if(gt.check.isListCell(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(s,t),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLine(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(s,e),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.replaceWith(s);return t}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}_getInfo(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,element:this._element}}_setIframeAttrs(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#rt(t){const e=gt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this._linkValue=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#dt(t,e){if(ft.isSpace(e.code))return void e.preventDefault();const i=gt.query.getEventTarget(e);if("x"===t&&this._onlyPercentage&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=yi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const Uo=Wo,{_w:Go}=dt;class Zo extends ii{static key="math";static type="modal";static className="";static component(t){return gt.utils.hasClass(t,"se-math|katex")&>.utils.hasClass(t,"se-component")?t:null}constructor(t,e){super(t),this.title=this.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#yt(t.options.get("externalLibs").katex))||(this.mathjax=this.#vt(t.options.get("externalLibs").mathjax,t))||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option.'),this.pluginOptions={formSize:{width:"460px",height:"14em",maxWidth:"",maxHeight:"",minWidth:"400px",minHeight:"40px",...e.formSize},canResize:e.canResize??!0,autoHeight:!!e.autoHeight,fontSizeList:e.fontSizeList||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],onPaste:"function"==typeof e.onPaste?e.onPaste:null},this.pluginOptions.autoHeight&&(this.pluginOptions.formSize.height=this.pluginOptions.formSize.minHeight),this.defaultFontSize=null;const i=function(t){const{lang:e,icons:i,pluginOptions:s,katex:n}=t,{formSize:o,fontSizeList:l,canResize:r,autoHeight:a}=s,{width:h,height:c,maxWidth:d,maxHeight:u,minWidth:p,minHeight:g}=o,m=r?a?"horizontal":"auto":"none";let f=l[0].value,_=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${e.close}" aria-label="${e.close}">\n ${i.cancel}\n </button>\n <span class="se-modal-title">${e.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${e.math_modal_inputLabel} ${n?`(<a href="${dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp se-modal-resize-form" type="text" data-focus style="width: ${h}; height: ${c}; min-width: ${p}; min-height: ${g}; resize: ${m};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,i=l.length;e<i;e++)t=l[e],t.default&&(f=t.value),_+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return _+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_previewLabel}</label>\n <p class="se-math-preview"></p>\n </div>\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${e.submitButton}" aria-label="${e.submitButton}">\n <span>${e.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=f,gt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${d}; max-height: ${u};`},_)}(this),s=function({lang:t,icons:e}){const i=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t);this.modal=new No(this,i),this.controller=new hi(this,s,{position:"bottom",disabled:!0}),this.textArea=i.querySelector(".se-math-exp"),this.previewElement=i.querySelector(".se-math-preview"),this.fontSizeElement=i.querySelector(".se-math-size"),this.isUpdateState=!1,this._element=null,this.previewElement.style.fontSize=this.defaultFontSize,this.eventManager.addEvent(this.textArea,"input",this.#Ct.bind(this)),this.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style)),this.pluginOptions.onPaste&&this.eventManager.addEvent(this.textArea,"paste",this.pluginOptions.onPaste.bind(this))}select(t){if(gt.utils.hasClass(t,"se-math|katex")&&Yo(t))return this._element=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this._element=null}retainFormat(){return{query:".se-math, .katex, .MathJax",method:t=>{if(!this.katex&&!this.mathjax)return;const e=Yo(t);if(!e)return;const i=this._d.createRange().createContextualFragment(this._renderer(pt.entityToHTML(this._escapeBackslashes(e,!0))));t.innerHTML=i.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),gt.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?gt.utils.addClass(t,"katex"):gt.utils.removeClass(t,"katex"),this.mathjax&&this.#wt(this.mathjax)}}}open(){this.modal.open()}on(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=pt.entityToHTML(this._escapeBackslashes(Yo(t),!0)),i=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",i),i):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=i,this.previewElement.innerHTML=this._renderer(e),this.previewElement.style.fontSize=i}}else this.init()}modalAction(){if(0===this.textArea.value.trim().length||gt.utils.hasClass(this.textArea,"se-error"))return this.textArea.focus(),!1;const t=this.textArea.value,e=this.previewElement.querySelector(".se-math, .katex");if(!e)return!1;if(gt.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",pt.htmlToEntity(this._escapeBackslashes(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(gt.utils.addClass(e,"katex"),gt.utils.removeClass(e,"MathJax")):gt.utils.removeClass(e,"katex"),this.isUpdateState){gt.query.getParentElement(this.controller.currentTarget,".se-component").replaceWith(e);const t=this.component.get(e);return this.component.select(t.target,t.pluginName),!0}{const t=this.format.getLines();if(t.length>1){const i=gt.utils.createElement(t[0].nodeName,null,e);this.component.insert(i,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}else this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}this.mathjax&&this.#wt(this.mathjax);const i=this.selection.getNearRange(e);return i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Zo.key),!0}init(){this.textArea.value="",this.previewElement.innerHTML="",gt.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#xt(this._element);break;case"delete":this.destroy(this.controller.currentTarget)}}destroy(t){gt.utils.removeItem(t),this.controller.close(),this.editor.focus(),this.history.push(!1)}_renderer(t){let e="";try{gt.utils.removeClass(this.textArea,"se-error"),this.katex?e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0}):this.mathjax&&(e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(gt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`)}catch(t){gt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}_escapeBackslashes(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#xt(t){if(navigator.clipboard&&t)try{const e=Yo(t);await this.html.copy(e),gt.utils.addClass(t,"se-copy"),Go.setTimeout((()=>{gt.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Ct(t){const e=gt.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this._renderer(e.value),this.mathjax&&this.#wt(this.mathjax)}#wt(t){t.clear(),t.updateDocument()}#yt(t){if(!t)return null;if(!t.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const e=[{throwOnError:!1},t.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});return t.options=e,t}#vt(t,e){if(!t)return null;e.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const e=t.browserAdaptor();t.RegisterHTMLHandler(e);const i=new t.TeX,s=new t.CHTML;return t.src.document(document,{InputJax:i,OutputJax:s})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function Yo(t){const e=t.getAttribute("data-se-value");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",i),i):null}const Xo=Zo,{_w:jo,isMobile:Ko}=dt;const Jo=class extends ii{static key="drawing";static type="modal";static className="";constructor(t,e){super(t),this.title=this.lang.drawing,this.icon="drawing",this.pluginOptions={outputFormat:e.outputFormat||"dataurl",useFormatType:e.useFormatType??!1,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,lineWidth:e.lineWidth||5,lineReconnect:!!e.lineReconnect,lineCap:["butt","round","square"].includes(e.lineCap)?e.lineCap:"round",lineColor:e.lineColor||"",formSize:{width:"750px",height:"50vh",maxWidth:"",maxHeight:"",minWidth:"150px",minHeight:"100px",...e.formSize},canResize:e.canResize??!0,maintainRatio:e.maintainRatio??!0},this.plugins.image?"svg"!==this.pluginOptions.outputFormat||this.plugins.image.pluginOptions.uploadUrl||console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need the "image" plugin with the "uploadUrl" option. Please add the "image" plugin with the "uploadUrl" option.'):console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need either "image" plugin. Please add the "image" plugin.');const i=function({lang:t,icons:e,pluginOptions:i}){const{width:s,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=i.formSize,h=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.drawing_modal_title}</span>\n </div>\n <div class="se-modal-body" style="width: ${s}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${i.canResize?'<div class="se-modal-resize-handle-w"></div><div class="se-modal-resize-handle-h"></div><div class="se-modal-resize-handle-c"></div>':""}\n\t\t</div>\n\t\t<div class="se-modal-body-bottom">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t\t${i.useFormatType?`\n\t\t\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asBlock" aria-label="${t.blockStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_block}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asInline" aria-label="${t.inlineStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>`:""}\n\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="remove" aria-label="${t.remove}">\n\t\t\t\t\t\t\t${e.eraser}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.remove)}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n <div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n </div>\n </form>`;return gt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this);this.modal=new No(this,i),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=i.querySelector('[data-command="asBlock"]'),this.asInline=i.querySelector('[data-command="asInline"]'),this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#pt.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.__events={mousedown:Ko?this.#kt.bind(this):this.#Et.bind(this),mousemove:Ko?this.#St.bind(this):this.#Tt.bind(this),mouseup:this.#Ht.bind(this),mouseleave:this.#Lt.bind(this),mouseenter:this.#Mt.bind(this)},this.__eventsRegister={mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.__eventNameMap={mousedown:Ko?"touchstart":"mousedown",mousemove:Ko?"touchmove":"mousemove",mouseup:Ko?"touchend":"mouseup",mouseleave:"mouseleave",mouseenter:"mouseenter"},this.eventManager.addEvent(i.querySelector('[data-command="remove"]'),"click",this.#Nt.bind(this))}open(){this.pluginOptions.useFormatType&&this._activeAsInline("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this._initDrawing()}off(){this._destroyDrawing()}modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this._getSVGFileList();this.plugins.image.init(),this.plugins.image.submitFile(t)}else{const t=this.canvas.toDataURL(),e={name:"drawing",size:0};this.plugins.image.init(),"inline"!==this.as?this.plugins.image.create(t,null,"auto","","none",e,""):this.plugins.image.createInline(t,null,"auto","","none",e,"")}return!0}_initDrawing(){const t=this.canvas=this.modal.form.querySelector(".se-drawing-canvas");this.ctx=t.getContext("2d"),t.width=t.offsetWidth,t.height=t.offsetHeight,this.points=[],this.paths=[],this._setCtx(),this.__eventsRegister.mousedown=this.eventManager.addEvent(t,this.__eventNameMap.mousedown,this.__events.mousedown,{passive:!1,capture:!0}),this.__eventsRegister.mousemove=this.eventManager.addEvent(t,this.__eventNameMap.mousemove,this.__events.mousemove,!0),this.__eventsRegister.mouseup=this.eventManager.addEvent(t,this.__eventNameMap.mouseup,this.__events.mouseup,!0),this.__eventsRegister.mouseleave=this.eventManager.addEvent(t,this.__eventNameMap.mouseleave,this.__events.mouseleave),this.__eventsRegister.mouseenter=this.eventManager.addEvent(t,this.__eventNameMap.mouseenter,this.__events.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),dt.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,i=t.height,s=t.offsetWidth,n=t.offsetHeight;t.width=s,t.height=n,e===t.width&&i===t.height||(this.pluginOptions.maintainRatio&&this._adjustPathsToNewDimensions(e,i,s,n),this._drawAll())})),this.resizeObserver.observe(t))}_destroyDrawing(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.eventManager.removeEvent(this.__eventsRegister.mousedown),this.eventManager.removeEvent(this.__eventsRegister.mousemove),this.eventManager.removeEvent(this.__eventsRegister.mouseup),this.eventManager.removeEvent(this.__eventsRegister.mouseleave),this.eventManager.removeEvent(this.__eventsRegister.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}_setCtx(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||jo.getComputedStyle(this.carrierWrapper).color}_draw(){this._setCtx(),this.ctx.beginPath(),this.points.forEach((([t,e],i)=>{0===i?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}_drawAll(){this._setCtx(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this._draw()})),this.points=[]}_adjustPathsToNewDimensions(t,e,i,s){const n=i/t,o=s/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}_clearCanvas(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}_getSVG(){const t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");return e.setAttribute("width",this.canvas.width+""),e.setAttribute("height",this.canvas.height+""),e.setAttribute("viewBox",`0 0 ${this.canvas.width} ${this.canvas.height}`),e.setAttribute("xmlns",t),this.paths.forEach((i=>{const s=i.reduce(((t,[e,i],s)=>t+(0===s?`M ${e} ${i}`:` L ${e} ${i}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",s),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}_getSVGFileList(){const t=this._getSVG(),e=(new XMLSerializer).serializeToString(t),i=new Blob([e],{type:"image/svg+xml"}),s=new File([i],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(s),n.files}_getCanvasTouchPointer(t){const{touches:e}=t,i=this.canvas.getBoundingClientRect();return{x:e[0].clientX-i.left,y:e[0].clientY-i.top}}_activeAsInline(t){t?(gt.utils.addClass(this.asInline,"on"),gt.utils.removeClass(this.asBlock,"on"),this.as="inline"):(gt.utils.addClass(this.asBlock,"on"),gt.utils.removeClass(this.asInline,"on"),this.as="block")}#Et(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this._draw()}#Tt(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this._draw())}#kt(t){t.preventDefault();const{x:e,y:i}=this._getCanvasTouchPointer(t);this.isDrawing=!0,this.points.push([e,i]),this._draw()}#St(t){t.preventDefault();const{x:e,y:i}=this._getCanvasTouchPointer(t);this.isDrawing&&(this.points.push([e,i]),this._draw())}#Ht(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#Lt(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#Mt(t){if(1===t.buttons){if(this.isDrawing=!0,this.pluginOptions.lineReconnect){const e=this.paths[this.paths.length-1],i=e[e.length-1];this.points.push([i[0],i[1]]),this.points.push([t.offsetX,t.offsetY])}else this.points.push([t.offsetX,t.offsetY]);this._draw()}}#Nt(){this._clearCanvas()}#pt(t){this._activeAsInline("asInline"===gt.query.getEventTarget(t).getAttribute("data-command"))}};function Qo(t){const e=t.src.split("/").pop(),i=t.thumbnail||"",s=i||t.src,n=this.props?.map((e=>`data-${e}="${t[e]}"`)).join(" ")||"",o=`data-type="${t.type}" data-command="${t.src}" data-name="${t.name||e}" data-thumbnail="${i}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${i||"se-browser-empty-image"}" src="${s}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!i&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${i||"se-browser-empty-image"}" ${l}>`}\n\t\t\t<div class="se-file-name-image se-file-name-back"></div>\n\t\t\t<div class="se-file-name-image">${t.name||e}</div>\n\t\t</div>`}const tl=class extends Jt{constructor(t,e){super(t.editor),this.useSearch=e.useSearch??!0;const i=gt.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(e.className?` ${e.className}`:"")}),s=function(t,e){const i=t.lang,s=t.icons,n=`\n\t\t<div class="se-browser-content">\n\t\t\t<div class="se-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-browser-close" class="close" title="${i.close}" aria-label="${i.close}">\n\t\t\t\t\t${s.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-browser-title"></span>\n\t\t\t</div>\n\t\t\t<div class="se-browser-wrapper">\n\t\t\t\t<div class="se-browser-side"></div>\n\t\t\t\t<div class="se-browser-main"> \n\t\t\t\t\t<div class="se-browser-bar">\n\t\t\t\t\t\t<div class="se-browser-search">\n\t\t\t\t\t\t\t<button class="se-btn se-side-open-btn">${s.side_menu_hamburger}</button>\n\t\t\t\t\t\t\t${e?`\n\t\t\t\t\t\t\t\t\t\t<form class="se-browser-search-form">\n\t\t\t\t\t\t\t\t\t\t\t<input type="text" class="se-input-form" placeholder="${i.search}" aria-label="${i.search}">\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${i.search}" aria-label="${i.search}">${s.search}</button>\n\t\t\t\t\t\t\t\t\t\t</form>`:""}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-browser-body">\n\t\t\t\t\t\t<div class="se-browser-tags"></div>\n\t\t\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t\t\t<div class="se-browser-menus"></div>\n\t\t\t\t\t\t<div class="se-browser-list"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`,o=gt.utils.createElement("DIV",{class:"se-browser-inner"},n);return{html:o,header:o.querySelector(".se-browser-header"),titleArea:o.querySelector(".se-browser-title"),tagArea:o.querySelector(".se-browser-tags"),body:o.querySelector(".se-browser-body"),list:o.querySelector(".se-browser-list"),side:o.querySelector(".se-browser-side"),wrapper:o.querySelector(".se-browser-wrapper"),_loading:o.querySelector(".se-loading-box")}}(t.editor,this.useSearch),n=s.html;this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.area=i,this.header=s.header,this.titleArea=s.titleArea,this.tagArea=s.tagArea,this.body=s.body,this.list=s.list,this.side=s.side,this.wrapper=s.wrapper,this._loading=s._loading,this.title=e.title,this.listClass=e.listClass||"se-preview-list",this.directData=e.data,this.url=e.url,this.urlHeader=e.headers,this.searchUrl=e.searchUrl,this.searchUrlHeader=e.searchUrlHeader,this.drawItemHandler=(e.drawItemHandler||Qo).bind({thumbnail:e.thumbnail,props:e.props||[]}),this.selectorHandler=e.selectorHandler,this.columnSize=e.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.icons.menu_arrow_right,this.openArrow=this.icons.menu_arrow_down,this.icon_folder=this.icons.side_menu_folder_item,this.icon_folder_item=this.icons.side_menu_folder,this.icon_item=this.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this._closeSignal=!1,this._bindClose=null,this.__globalEventHandler=t=>{ft.isEsc(t.code)&&this.close()},this.apiManager=new Ls(this,{method:"GET"}),i.appendChild(gt.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(n),this.carrierWrapper.appendChild(i),this.eventManager.addEvent(this.tagArea,"click",this.#At.bind(this)),this.eventManager.addEvent(this.list,"click",this.#Bt.bind(this)),this.eventManager.addEvent(this.side,"click",this.#It.bind(this)),this.eventManager.addEvent(n,"mousedown",this.#Vt.bind(this)),this.eventManager.addEvent(n,"click",this.#Ot.bind(this)),this.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Rt.bind(this)),this.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#zt.bind(this)),this.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#$t.bind(this))}open(t){t||(t={}),this.__addGlobalEvent();const e=t.listClass||this.listClass;gt.utils.hasClass(this.list,e)||(this.list.className="se-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this.editor.opendBrowser=this,this.closeArrow=this.options.get("_rtl")?this.icons.menu_arrow_left:this.icons.menu_arrow_right,this.directData?this.__drowItems(this.directData):this._drawFileList(t.url||this.url,t.urlHeader||this.urlHeader,!1)}close(){this.__removeGlobalEvent(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.editor.opendBrowser=null,this.sideInner=null,"function"==typeof this.inst.init&&this.inst.init()}search(t){this.searchUrl?(this.keyword=t,this._drawFileList(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this._drawListItem(this.items,!1))}tagfilter(t){const e=this.selectedTags;return 0===e.length?t:t.filter((t=>!Array.isArray(t.tag)||t.tag.some((t=>e.includes(t)))))}showBrowserLoading(){this._loading.style.display="block"}closeBrowserLoading(){this._loading.style.display="none"}_drawFileList(t,e,i){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Ft.bind(this),errorCallBack:this.#Pt.bind(this)}),i||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}_drawListItem(t,e){const i=this.keyword,s=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(i)>-1))).length,o=this.columnSize,l=o<=1?1:Math.round(n/o)||1,r=this.drawItemHandler;let a="",h='<div class="se-file-item-column">',c=1;for(let i,d,u=0;u<n;u++)if(i=t[u],d=i.tag?"string"==typeof i.tag?i.tag.split(","):i.tag:[],d=i.tag=d.map((t=>t.trim())),h+=r(i),(u+1)%l==0&&c<o&&u+1<n&&(c++,h+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,i=d.length;e<i;e++)t=d[e],t&&!s.includes(t)&&(s.push(t),a+=`<a title="${t}" aria-label="${t}">${t}</a>`);h+="</div>",this.list.innerHTML=h,e&&(this.items=t,this.tagArea.innerHTML=a)}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler,!0)}__removeGlobalEvent(){this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))}__drowItems(t){if(Array.isArray(t))return t.length>0&&this._drawListItem(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.__parseFolderData(t),this.side.innerHTML="";const e=this.sideInner=gt.utils.createElement("div",null);if(this.__createFolderList(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(gt.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}__parseFolderData(t,e){let i=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const s=e.split("/"),n=s.length-1;s.forEach(((t,s)=>{i[t]||(i[t]={children:{}}),s===n?(i[t].key=e,i[t].name=this.folders[e].name):i=i[t].children}))}else e&&(i[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,i])=>{if("_data"===t||!i||"object"!=typeof i)return;const s=i,n=e?`${e}/${t}`:t;this.folders[n]={name:s.name||t,meta:s.meta||{}},this.__parseFolderData(s,n)}))}__createFolderList(t,e){for(const i in t){const s=t[i];if(s)if(Object.keys(s.children).length>0){const t=gt.utils.createElement("div",s.key?{"data-command":s.key,"aria-label":s.name}:null,`<span class="se-menu-icon">${s.key?this.icon_folder:this.icon_folder_item}</span><span>${s.name}</span>`),i=gt.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(gt.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");gt.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.__createFolderList(s.children,n),i.appendChild(n),e.appendChild(i)}else{const t=gt.utils.createElement("div",{"data-command":s.key,"aria-label":s.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${s.name}</span>`);if(e===this.sideInner){const i=gt.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(i)}else e.appendChild(t)}}}#Ft(t){try{const e=JSON.parse(t.responseText),i=e.result;if(this.__drowItems(i))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading(),this.body.style.maxHeight=gt.utils.getClientSize().h-this.header.offsetHeight-50+"px"}}#Pt(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#At(t){const e=gt.query.getEventTarget(t);if(!gt.check.isAnchor(e))return;const i=e.textContent,s=this.tagArea.querySelector('a[title="'+i+'"]'),n=this.selectedTags.indexOf(i);n>-1?(this.selectedTags.splice(n,1),gt.utils.removeClass(s,"on")):(this.selectedTags.push(i),gt.utils.addClass(s,"on")),this._drawListItem(this.items,!1)}#Bt(t){const e=gt.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const i=gt.query.getCommandTarget(e);i&&(this.close(),this.selectorHandler(i))}#It(t){const e=gt.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(gt.utils.hasClass(t,"se-menu-hidden")?(gt.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(gt.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const i=gt.query.getCommandTarget(e);if(!i||gt.utils.hasClass(i,"active"))return;const s=this.data[i.getAttribute("data-command")];gt.utils.removeClass(this.side.querySelectorAll(".active"),"active"),gt.utils.addClass([i,gt.query.getParentElement(i,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof s?this._drawFileList(s,this.urlHeader,!0):this._drawListItem(s,!1)}#Vt(t){const e=gt.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this._closeSignal=!0:this._closeSignal=!1}#Ot(t){const e=gt.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this._closeSignal)&&this.close()}#Rt(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#zt(t){const e=gt.query.getEventTarget(t);gt.utils.hasClass(e,"active")?(gt.utils.removeClass(this.side,"se-side-show"),gt.utils.removeClass(e,"active")):(gt.utils.addClass(this.side,"se-side-show"),gt.utils.addClass(e,"active"))}#$t({target:t}){t!==this.sideOpenBtn&>.utils.hasClass(this.sideOpenBtn,"active")&&(gt.utils.removeClass(this.side,"se-side-show"),gt.utils.removeClass(this.sideOpenBtn,"active"))}};const el=class extends ii{static key="imageGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.imageGallery,this.icon="image_gallery",this.onSelectfunction=null,this.browser=new tl(this,{title:this.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-image-gallery"}),this.width="auto"===this.plugins.image.pluginOptions.defaultWidth?"":this.plugins.image.pluginOptions.defaultWidth,this.height="auto"===this.plugins.image.pluginOptions.defaultHeight?"":this.plugins.image.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.plugins.image.init(),this.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt)}}};const il=class extends ii{static key="videoGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.video_thumbnail;this.browser=new tl(this,{title:this.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i,props:["frame"]}),this.width="auto"===this.plugins.video.pluginOptions.defaultWidth?"":this.plugins.video.pluginOptions.defaultWidth,this.height="auto"===this.plugins.video.pluginOptions.defaultHeight?"":this.plugins.video.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const i=this.plugins.video.findProcessUrl(e);i&&(e=i.url);const s={name:t.getAttribute("data-name"),size:0};this.plugins.video.init(),this.plugins.video.create(this.plugins.video["iframe"===t.getAttribute("data-frame")?"createIframeTag":"createVideoTag"]({poster:t.getAttribute("data-thumbnail")}),e,null,this.width,this.height,!1,s)}}};const sl=class extends ii{static key="audioGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.audio_thumbnail;this.browser=new tl(this,{title:this.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){this.onSelectfunction?this.onSelectfunction(t):(this.plugins.audio.init(),this.plugins.audio.submitURL(t.getAttribute("data-command")))}};const nl=class extends ii{static key="fileGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.file_thumbnail;this.browser=new tl(this,{title:this.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.plugins.fileUpload.create(t.getAttribute("data-command"),e,!0)}}};const ol=class extends ii{static key="fileBrowser";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const i={video:this.icons.video_thumbnail,audio:this.icons.audio_thumbnail,file:this.icons.file_thumbnail},s=this.icons.file_thumbnail;this.browser=new tl(this,{title:this.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>i[t.type]||s,props:[...new Set((e.props??[]).concat(["frame"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{switch(t.getAttribute("data-type")){case"image":this.plugins.imageGallery.browser.selectorHandler(t);break;case"video":this.plugins.videoGallery.browser.selectorHandler(t);break;case"audio":this.plugins.audioGallery.browser.selectorHandler(t);break;case"file":this.plugins.fileGallery.browser.selectorHandler(t)}}}},ll={text:{default:"13px",list:[{title:"XX-Small",size:"8px"},{title:"X-Small",size:"10px"},{title:"Small",size:"13px"},{title:"Medium",size:"16px"},{title:"Large",size:"18px"},{title:"X-Large",size:"24px"},{title:"XX-Large",size:"32px"}]},px:{default:13,inc:1,min:8,max:72,list:[8,10,13,15,18,20,22,26,28,36,48,72]},pt:{default:10,inc:1,min:6,max:72,list:[6,8,10,12,14,18,22,26,32]},em:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},rem:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},vw:{inc:.1,min:.5,max:10,list:[2,3.5,4,4.5,6,8]},vh:{default:1.5,inc:.1,min:.5,max:10,list:[1,1.5,2,2.5,3,3.5,4]},"%":{default:100,inc:1,min:50,max:200,list:[50,70,90,100,120,140,160,180,200]}};class rl extends ii{static key="fontSize";static type="input";static className="se-btn-select se-btn-input se-btn-tool-font-size";constructor(t,e){super(t),this.unitMap={...ll,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.options.get("fontSizeUnits")[0];const i=function({lang:t},e,i,s){const n=e.list,o=e.default,l=s?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,s,a,h,c=0,d=n.length;c<d;c++)t=n[c],"object"==typeof t?(e=t.title,s=t.size):e=s=t+i,a=o===s?" default_value":"",h=a&&l||e,r+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${a}" data-command="${s}" data-value="${e}" title="${h}" aria-label="${h}" style="font-size:${s};">${h}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(t,this.unitMap[this.sizeUnit||"text"],this.sizeUnit,e.showDefaultSizeLabel),s=!!this.sizeUnit&&(e.showIncDecControls??!1),n=!this.sizeUnit||(e.disableInput??!1);this.title=this.lang.fontSize,this.inner=!(n&&!s)&&(n?`<span class="se-txt se-not-arrow-text __se__font_size">${this.lang.fontSize}</span>`:`<input type="text" class="__se__font_size se-not-arrow-text" placeholder="${this.lang.fontSize}" />`),s?(this.beforeItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":rl.key,"data-type":"command","data-value":"dec"},`${this.icons.minus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.decrease}</span></span>`),this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":rl.key,"data-type":"command","data-value":"inc"},`${this.icons.plus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.increase}</span></span>`)):n?n&&!s&&(this.replaceButton=gt.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":rl.key,"data-type":"dropdown"},`<span class="se-txt __se__font_size">${this.lang.fontSize}</span>${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.fontSize}</span></span>`),this.menu.initDropdownTarget({key:rl.key,type:"dropdown"},i)):(this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":rl.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.fontSize}</span></span>`),this.menu.initDropdownTarget({key:rl.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this._disableInput=n,this.menu.initDropdownTarget(rl,i)}active(t,e){if(!gt.utils.hasClass(e,"__se__font_size"))return!1;let i="";if(t){if(this.format.isLine(t))return;if(i=gt.utils.getStyle(t,"fontSize"))return this._setSize(e,i),!0}else this._setSize(e,this._getDefaultSize());return!1}onInputKeyDown({target:t,event:e}){const i=e.code;if(this._disableInput||ft.isSpace(i))return void e.preventDefault();if(!/^(38|40|13)$/.test(i))return;const{value:s,unit:n}=this._getSize(t);if(!s)return;const o=mt.get(s),l=this.unitMap[n];let r=o;switch(i){case"ArrowUp":r+=l.inc,r>l.max&&(r=o);break;case"ArrowDown":r-=l.inc,r<l.min&&(r=o)}e.preventDefault();try{this.isInputActive=!0;const e=this._setSize(t,r+n);if(this._disableInput)return;const s=gt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(s,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),ft.isEnter(i)||t.focus()}finally{this.isInputActive=!1}}onInputChange({target:t,value:e,event:i}){if(!this._disableInput)try{this.isInputActive=!0;let{value:i,unit:s}=this._getSize(e);const{max:n,min:o}=this.unitMap[s];i=i>n?n:i<o?o:i;const l=gt.utils.createElement("SPAN",{style:"font-size: "+this._setSize(t,i+s)+";"});this.format.applyInlineElement(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,i.preventDefault(),this.editor.focus()}}on(t){const{value:e,unit:i}=this._getSize(t),s=e+i;if(s===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)s===n[t].getAttribute("data-value")?gt.utils.addClass(n[t],"active"):gt.utils.removeClass(n[t],"active");this.currentSize=s}action(t){const e=t.getAttribute("data-command");if(e===rl.key){const{value:e,unit:i}=this._getSize(t);let s=mt.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[i];s=s<n?n:s>o?o:s;const l=gt.utils.createElement("SPAN",{style:"font-size: "+s+i+";"});this.format.applyInlineElement(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=gt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(t,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["font-size"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}_getDefaultSize(){return this.editor.frameContext.get("wwComputedStyle").fontSize}_getSize(t){if(!(t="string"==typeof t?t:t.parentElement.querySelector(".__se__font_size")))return{unit:this.sizeUnit,value:this.sizeUnit?0:""};const e="string"==typeof t?t:gt.check.isInputElement(t)?t.value:t.textContent,i=this.sizeUnit?e.split(/(\d+)/):[e,""];let s=(i.pop()||"").trim().toLowerCase();s=this.options.get("fontSizeUnits").includes(s)?s:this.sizeUnit;const n=i.pop();return{unit:s,value:s?Number(n):n}}_setSize(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?gt.check.isInputElement(t)?t.value=String(e):t.textContent=String(this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e):0}}const al=rl;const hl=class extends ii{static key="pageNavigator";static type="input";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.lang.pageNumber,this.inner=gt.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=gt.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.eventManager.addEvent(this.inner,"change",this.#qt.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#qt(t){if(!this.editor.frameContext.has("documentType-use-page"))return;const e=gt.query.getEventTarget(t),i=Number(e.value)||1;this.editor.frameContext.get("documentType").pageGo(i)}},{_w:cl}=dt;class dl extends ii{static key="anchor";static type="popup";static className="";static component(t){return gt.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}constructor(t){super(t),this.title=this.lang.anchor,this.icon="bookmark_anchor";const e=(new DOMParser).parseFromString(this.icons.bookmark_anchor,"image/svg+xml");this.bookmarkIcon=e.documentElement,this._element=null,this._range=null;const i=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<div class="se-controller-display"></div>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="edit" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(this);this.displayId=i.querySelector(".se-controller-display"),this.controllerSelect=new hi(this,i,{position:"bottom",disabled:!0},dl.key);const s=function({lang:t,icons:e}){const i=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-controller-display">${t.id}</div>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" required />\n\t\t\t\t<button type="submit" data-command="submit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.inputEl=s.querySelector("input"),this.controller=new hi(this,s,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},dl.key)}show(){this.controller.open(this._range=this.selection.getRange()),cl.setTimeout((()=>{this.inputEl.focus()}),0)}select(t){this._element=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}deselect(){this._init()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const i=this._element;switch(e){case"submit":if(i)this.controller.close(),i.id=this.inputEl.value,this.select(i);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=gt.utils.createElement("A",{id:t,"data-se-anchor":this.inputEl.value,"data-se-non-link":"true",contenteditable:"false",class:"se-component se-inline-component"});this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1});const i=this.selection.getNearRange(e);i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,dl.key),this._init()}break;case"cancel":this.controller.close(!i),this._range&&this.selection.setRange(this._range),this._init(),i&&this.select(i);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(i);break;case"delete":{const t=this.selection.getNearRange(i);gt.utils.removeItem(i),this.controllerSelect.close(!0),t&&this.selection.setRange(t.container,t.offset,t.container,t.offset),this._init();break}}}_init(){this._element=null,this._range=null,this.inputEl.value="",this.displayId.textContent=""}}const ul={blockquote:Ts,exportPDF:As,fileUpload:Rs,list_bulleted:$s,list_numbered:Ds,mention:Ws,align:Gs,font:Ys,fontColor:On,backgroundColor:zn,list:Dn,table:go,formatBlock:fo,hr:Fn,layout:bo,lineHeight:vo,template:wo,paragraphStyle:ko,textStyle:So,link:Ao,image:Vo,video:zo,audio:Do,embed:Uo,math:Xo,drawing:Jo,imageGallery:el,videoGallery:il,audioGallery:sl,fileGallery:nl,fileBrowser:ol,fontSize:al,pageNavigator:hl,anchor:dl},pl={_DragHandle:Qt,ApiManager:Ls,ColorPicker:In,Controller:hi,Browser:tl,FileManager:Is,HueSlider:Nn,Figure:yi,Modal:No,ModalAnchorEditor:Ho,SelectMenu:ci};i("+qkj"),i("JybH"),Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Ss,EditorInjector:ii,Plugins:ul,Modules:pl,Helper:bt}})})()})();
|
|
1
|
+
(()=>{var t={cfbI:function(t){var e,i;e="undefined"!=typeof window?window:this,i=function(t,e){const i={code:"en",align:"Align",alignBottom:"Align bottom",alignCenter:"Align center",alignJustify:"Align justify",alignLeft:"Align left",alignMiddle:"Align middle",alignRight:"Align right",alignTop:"Align top",anchor:"Anchor",asBlock:"As a block",asInline:"As a inline",asLink:"As a link",audio:"Audio",audioGallery:"Audio gallery",audio_modal_file:"Select from files",audio_modal_title:"Insert Audio",audio_modal_url:"Audio URL",autoSize:"Auto size",backgroundColor:"Background color",basic:"Basic",blockStyle:"Block style",bold:"Bold",border:"Border",border_all:"Border all",border_inside:"Border inside",border_horizontal:"Border horizontal",border_vertical:"Border vertical",border_outside:"Border outside",border_left:"Border left",border_top:"Border top",border_right:"Border right",border_bottom:"Border bottom",border_none:"Border none",bulletedList:"Bulleted list",cancel:"Cancel",caption:"Insert description",cellProperties:"Cell properties",center:"Center",close:"Close",codeView:"Code view",color:"Color",colorPicker:"Color picker",column:"Column",comment:"Comments",commentAdd:"Add comment",commentShow:"Show comments",copy:"Copy",copyFormat:"Paint Formatting",cut:"Cut",default:"Default",deleteColumn:"Delete column",deleteRow:"Delete row",dir_ltr:"Left to right",dir_rtl:"Right to left",download:"Download",drag:"Drag",drawing:"Drawing",drawing_modal_title:"Drawing",edit:"Edit",embed:"Embed",embed_modal_title:"Embed",embed_modal_source:"Embed Source / URL",exportPDF:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",fileBrowser:"File browser",fileGallery:"File gallery",fileUpload:"File upload",fixedColumnWidth:"Fixed column width",font:"Font",fontColor:"Font color",fontSize:"Size",formats:"Formats",fullScreen:"Full screen",height:"Height",horizontalLine:"Horizontal line",horizontalSplit:"Horizontal split",hr_dashed:"Dashed",hr_dotted:"Dotted",hr_solid:"Solid",id:"ID",image:"Image",imageGallery:"Image gallery",image_modal_altText:"Alternative text",image_modal_file:"Select from files",image_modal_title:"Insert image",image_modal_url:"Image URL",importWord:"Import from Word",indent:"Indent",inlineStyle:"Inline style",insertColumnAfter:"Insert column after",insertColumnBefore:"Insert column before",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertLine:"Insert line",italic:"Italic",layout:"Layout",left:"Left",lineHeight:"Line height",link:"Link",link_modal_bookmark:"Bookmark",link_modal_downloadLinkCheck:"Download link",link_modal_newWindowCheck:"Open in new window",link_modal_text:"Text to display",link_modal_title:"Insert Link",link_modal_url:"URL to link",link_modal_relAttribute:"Rel attribute",list:"List",math:"Math",math_modal_fontSizeLabel:"Font Size",math_modal_inputLabel:"Mathematical Notation",math_modal_previewLabel:"Preview",math_modal_title:"Math",maxSize:"Max size",mediaGallery:"Media gallery",mention:"Mention",menu_bordered:"Bordered",menu_code:"Code",menu_neon:"Neon",menu_shadow:"Shadow",menu_spaced:"Spaced",menu_translucent:"Translucent",mergeCells:"Merge cells",minSize:"Min size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",newDocument:"New document",numberedList:"Numbered list",outdent:"Outdent",pageBreak:"Page break",pageDown:"Page down",pageNumber:"Page number",pageUp:"Page up",paragraphStyle:"Paragraph style",preview:"Preview",print:"print",proportion:"Constrain proportions",ratio:"Ratio",redo:"Redo",remove:"Remove",removeFormat:"Remove Format",replace:"Replace",replaceAll:"Replace all",resize100:"Zoom 100%",resize25:"Zoom 25%",resize50:"Zoom 50%",resize75:"Zoom 75%",resize:"Resize",revert:"Revert",revisionHistory:"Revision History",right:"Right",rotateLeft:"Rotate left",rotateRight:"Rotate right",row:"Row",save:"Save",search:"Search",selectAll:"Select All",showBlocks:"Show blocks",size:"Size",splitCells:"Split cells",strike:"Strike",submitButton:"Submit",subscript:"Subscript",superscript:"Superscript",table:"Table",tableHeader:"Table header",tableProperties:"Table properties",tags:"Tags",tag_blockquote:"Quote",tag_div:"Normal (DIV)",tag_h:"Header",tag_p:"Paragraph",tag_pre:"Code",template:"Template",textStyle:"Text style",title:"Title",underline:"Underline",undo:"Undo",unmergeCells:"Unmerge cells",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",videoGallery:"Video gallery",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width",message_copy_success:"Copied to clipboard",message_copy_fail:"Copy failed. Please copy manually."};return void 0===e&&(t.SUNEDITOR_LANG||Object.defineProperty(t,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(t.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:i})),i},"object"==typeof t.exports?t.exports=e.document?i(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return i(t)}:i(e)},JybH:(t,e,i)=>{"use strict";i.r(e)},"+qkj":(t,e,i)=>{"use strict";i.r(e)}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";const t=window,e=document,s=Symbol("noEventHandler"),n=Symbol("onOverComponent"),o=navigator.userAgent.toLowerCase();const l="function"==typeof ResizeObserver,r="function"==typeof navigator.clipboard?.write,a=/Edg/.test(navigator.userAgent),h=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),c=o.includes("chrome/")&&!o.includes("edge/"),d=!!o.match(/gecko\/\d+/),u=!!t.chrome,p=o.includes("applewebkit/")&&!o.includes("chrome"),g=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(o)||navigator.maxTouchPoints>0&&"ontouchstart"in t,m=o.includes("android"),f=h?"⌘":"CTRL",_=h?"⇧":"+SHIFT",b=t.devicePixelRatio,y={_w:t,_d:e,NO_EVENT:s,ON_OVER_COMPONENT:n,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let i="";const s=(t||e).styleSheets;for(let t,e=0,n=s.length;e<n;e++){try{t=s[e].cssRules}catch(t){continue}if(t)for(let e=0,s=t.length;e<s;e++)i+=t[e].cssText}return i},getIncludePath:function(t,i){let s="";const n=[],o="js"===i?"script":"link",l="js"===i?"src":"href";let r="(?:";for(let e=0,i=t.length;e<i;e++)r+=t[e]+(e<i-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${i}(?:\\?.*|;.*)?$`,"i"),h=new RegExp(`.+\\.${i}(?:\\?.*|;.*)?$`,"i");for(let t=e.getElementsByTagName(o),i=0;i<t.length;i++)h.test(t[i][l])&&n.push(t[i]);for(let t=0;t<n.length;t++){const e=n[t][l].match(a);if(e){s=e[0];break}}if(""===s&&(s=n.length>0?n[0][l]:""),s.includes(":/")||"//"===s.slice(0,2)||(s=!1===s.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+s:location.href.match(/^[^?]*\/(?:)/)[0]+s),!s)throw"[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+s+", extension: "+i+")";return s},isResizeObserverSupported:l,isClipboardSupported:r,isEdge:a,isBlink:c,isGecko:d,isChromium:u,isSafari:p,isOSX_IOS:h,isAndroid:m,isMobile:g,cmdIcon:f,shiftIcon:_,DPI:b,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},v=8203,C=String.fromCharCode(v),w=new RegExp(String.fromCharCode(v),"g"),x=new RegExp("^"+String.fromCharCode(v)+"+$");const k={zeroWidthSpace:C,zeroWidthRegExp:w,onlyZeroWidthRegExp:x,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},E=/https?:\/\/[^\s]+/g,S={"xx-small":.5625,"x-small":.625,small:.8333,medium:1,large:1.125,"x-large":1.5,"xx-large":2,"xxx-large":2.5};function T(t){if(3===t.nodeType){const e=t.nodeValue.trim();return e?{type:"text",content:e}:null}if(1===t.nodeType){const e={type:"element",tag:t.tagName.toLowerCase(),attributes:{},children:[]};for(const i of t.attributes)e.attributes[i.name]=i.value;for(const i of t.childNodes){const t=T(i);t&&e.children.push(t)}return e}return null}function H(t){const e={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,(t=>"string"==typeof e[t]?e[t]:t))}function L(t){return"string"==typeof t?t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())):t.map((function(t){return L(t)}))}function M(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const N={htmlToJson:function(t){return T((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return H(e.content||"");if("element"===e.type){const{tag:i,attributes:s={},children:n=[]}=e,o=Object.entries(s).map((([t,e])=>`${t}="${H(e)}"`)).join(" "),l=`</${i}>`;return`${o?`<${i} ${o}>`:`<${i}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:H,entityToHTML:function(t){const e={"&":"&"," ":" ","'":"'",""":'"',"<":"<",">":">"};return t.replace(/&| |'|"|\$lt;|\$gt;/g,(t=>"string"==typeof e[t]?e[t]:t))},debounce:function(e,i){let s;return function(...n){t.clearTimeout(s),s=t.setTimeout((()=>{t.clearTimeout(s),e(...n)}),i)}},syncMaps:function(t,e){e.forEach(((e,i)=>{t.set(i,e)})),t.forEach(((i,s)=>{e.has(s)||t.delete(s)}))},mergeMaps:function(...t){const e=t.filter((t=>t instanceof Map)).flatMap((t=>[...t]));return new Map(e)},getValues:function(t){return t?Object.keys(t).map((function(e){return t[e]})):[]},camelToKebabCase:L,kebabToCamelCase:function(t){return"string"==typeof t?t.replace(/-[a-zA-Z]/g,(t=>t.replace("-","").toUpperCase())):t.map((function(t){return L(t)}))},toFontUnit:function(t,e){const i=e.match(/(\d+(?:\.\d+)?)(.+)/),s=i?Number(i[1]):S[e],n=i?i[2]:"rem";let o=s;switch(/em/.test(n)?o=Math.round(s/.0625):"pt"===n?o=Math.round(1.333*s):"%"===n&&(o=s/100),t){case"em":case"rem":return(.0625*o).toFixed(2)+t;case"%":return 100*Number((.0625*o).toFixed(2))+t;case"pt":return Math.round(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={},i=Object.prototype.hasOwnProperty;for(const s in t)i.call(t,s)&&(e[t[s]]=s);return e},createElementWhitelist:function(t){return new RegExp(`<\\/?\\b(?!\\b${(t||"").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},createElementBlacklist:function(t){return new RegExp(`<\\/?\\b(?:\\b${(t||"^").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},isHexColor:M,rgb2hex:function(t){if(M(t)||!t)return t;const e=t.match(/^rgba?[\s+]?\(([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?/i);if(e&&e.length>=4){const i=("0"+parseInt(e[1],10).toString(16)).slice(-2),s=("0"+parseInt(e[2],10).toString(16)).slice(-2),n=("0"+parseInt(e[3],10).toString(16)).slice(-2);let o="";if(t.includes("rgba")){const e=t.match(/[\s+]?([\d]+\.?[\d]*)[\s+]?/i);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${i}${s}${n}${o}`}return t},getWidthInPercentage:function(e,i){const s=i||e.parentElement,n=t.getComputedStyle(s),o=parseFloat(n.paddingLeft),l=parseFloat(n.paddingRight),r=s.offsetWidth-s.clientWidth,a=s.offsetWidth-o-l-r;return e.offsetWidth/a*100},textToAnchor:function(t){if(3===t.nodeType&&E.test(t.textContent)&&!/^A$/i.test(t.parentNode?.nodeName)){const i=t.textContent,s=e.createDocumentFragment();let n=0;return i.replace(E,((t,o)=>{o>0&&s.appendChild(e.createTextNode(i.slice(0,o)));const l=e.createElement("a");return l.href=t,l.target="_blank",l.textContent=t,s.appendChild(l),n=o+t.length,n<i.length&&s.appendChild(e.createTextNode(i.slice(n))),t})),t.parentNode.replaceChild(s,t),!0}return!1},spanToStyleNode:function(t,i){if(1===i.nodeType&&/^SPAN$/i.test(i.nodeName)&&i.hasAttribute("style")){const s=i.getAttribute("style"),n=[];if(Object.keys(t).forEach((i=>{if(t[i].regex.test(s)){const s=e.createElement(t[i].tag);n.push(s)}})),n.length>0){const t=e.createElement("span");let s=i.firstChild;n.forEach(((e,i)=>{0===i?t.appendChild(e):n[i-1].appendChild(e)}));const o=n[n.length-1];for(;s;){const t=s.nextSibling;o.appendChild(s),s=t}for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let i="";t.get("height")&&(i+="height:"+t.get("height")+";"),t.get("minHeight")&&(i+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(i+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(i+="width:"+t.get("width")+";"),t.get("minWidth")&&(i+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(i+="max-width:"+t.get("maxWidth")+";");let s="",n="",o="";const l=(e=i+e).split(";");for(let e,i=0,r=l.length;i<r;i++)e=l[i].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?s+=e+";":/^(min-|max-)?height\s*:/.test(e)?(/^height/.test(e)&&"auto"===e.split(":")[1].trim()&&t.set("height","auto"),n+=e+";"):o+=e+";");return{top:s,frame:n,editor:o}},_setIframeStyleLinks:function(t){let i="";if(t)for(let s,n=0,o=t.length;n<o;n++){if(s=[],/(^https?:\/\/)|(^data:text\/css,)/.test(t[n]))s.push(t[n]);else{const i=new RegExp(`(^|.*[\\/])${t[n]}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let t,n=e.getElementsByTagName("link"),o=0,l=n.length;o<l;o++)t=n[o].href.match(i),t&&s.push(t[0])}if(!s||0===s.length)throw'[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframe_cssFileName" before creating editor instances.';for(let t=0,e=s.length;t<e;t++)i+='<link href="'+s[t]+'" rel="stylesheet">'}return i},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},A=N;function B(t){return null!=t&&("string"!=typeof t&&(t=t.textContent),""===t||x.test(t))}function I(t){return 1===t?.nodeType}function V(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function O(t){return 1===t?.nodeType&&(G.hasClass(t,"se-wrapper-wysiwyg|sun-editor-carrier-wrapper|se-wrapper")||/^BODY$/i.test(t.nodeName))}const R={isZeroWidth:B,isEdgePoint:function(t,e,i){return"end"!==i&&0===e||(!i||"front"!==i)&&!t.nodeValue&&1===e||(!i||"end"===i)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:I,isInputElement:function(t){return I(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return I(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:function(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)},isListCell:function(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)},isTable:function(t){return/^TABLE$/i.test("string"==typeof t?t:t?.nodeName)},isTableElements:function(t){return/^(TABLE|THEAD|TBODY|TR|TH|TD|COL)$/i.test("string"==typeof t?t:t?.nodeName)},isTableCell:function(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)},isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:V,isAnchor:function(t){return/^A$/i.test("string"==typeof t?t:t?.nodeName)},isMedia:function(t){return/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test("string"==typeof t?t:t?.nodeName)},isIFrame:function(t){return/^IFRAME$/i.test("string"==typeof t?t:t?.nodeName)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isContentLess:function(t){return/^(BR|COLGROUP|COL|THEAD|TBODY|TFOOT|TR|AREA|BASE|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/i.test("string"==typeof t?t:t?.nodeName)},isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||V(e.firstElementChild))&&B(e.textContent)},isWysiwygFrame:O,isNonEditable:function(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")},isSpanWithoutAttr:function(t){if(1!==t?.nodeType)return!1;const e=t;return/^SPAN$/i.test(e.nodeName)&&!e.className&&!e.style.cssText},isSameAttributes:function(t,e){if(3===t.nodeType&&3===e.nodeType)return!0;if(3===t.nodeType||3===e.nodeType)return!1;const i=t,s=e,n=i.style,o=s.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=i.classList,a=s.classList,h=RegExp;let c=0;for(let t=0,e=r.length;t<e;t++)h("(s|^)"+r[t]+"(s|$)").test(a.value)&&c++;return l===o.length&&l===n.length&&c===a.length&&c===r.length},isExcludeFormat:function(t){return/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/.test(t?.className)},isUneditable:function(t){return G.hasClass(t,"__se__uneditable")},isImportantDisabled:function(t){return t.hasAttribute("data-important-disabled")}},z=R;function $(t,i,s){const n=e.createElement(t);if(i)for(const t in i)void 0!==i[t]&&null!==i[t]&&n.setAttribute(t,i[t]);return s&&("string"==typeof s?n.innerHTML=s:"object"==typeof s&&n.appendChild(s)),n}function F(t,e){let i=-1;for(let s=0,n=t.length;s<n;s++)if(t[s]===e){i=s;break}return i}function P(t,e,i){const s=t,n=e;if(n.style.cssText){const t=n.style;for(let e=0,i=t.length;e<i;e++)s.style[t[e]]=t[t[e]]}const o=n.attributes;for(let t,e=0,n=o.length;e<n;e++)t=o[e].name.toLowerCase(),i?.includes(t)||!o[e].value?s.removeAttribute(t):"style"!==t&&s.setAttribute(o[e].name,o[e].value)}function D(t,e){if(!t||1!==t.nodeType)return;return new RegExp(`(\\s|^)${e}(\\s|$)`).test(t.className)}function q(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.add(t)}}function W(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.remove(t)}}function U(t=e){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const G={clone:function(t,e=!1){return t.cloneNode(e)},createElement:$,createTextNode:function(t){return e.createTextNode(t||"")},getAttributesToString:function(t,e){const i=t.attributes;if(!i)return"";let s="";for(let t=0,n=i.length;t<n;t++)e?.includes(i[t].name)||(s+=i[t].name+'="'+i[t].value+'" ');return s},arrayFilter:function(t,e){if(!t||0===t.length)return null;e=e||function(){return!0};const i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],e(s)&&i.push(s);return i},arrayFind:function(t,e){if(!t||0===t.length)return null;e=e||function(){return!0};for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],e(i))return i;return null},arrayIncludes:function(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},getArrayIndex:F,nextIndex:function(t,e){const i=F(t,e);return-1===i?-1:i+1},prevIndex:function(t,e){const i=F(t,e);return-1===i?-1:i-1},copyTagAttributes:P,copyFormatAttributes:function(t,e){const i=e.cloneNode(!1);i.className=i.className.replace(/(\s|^)__se__format__[^\s]+/g,""),P(t,i)},removeItem:function(t){t&&("remove"in t&&"function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))},changeElement:function(t,e){if(t)if("string"==typeof e)if("outerHTML"in t)t.outerHTML=e;else{const i=$("DIV");i.innerHTML=e,t.parentNode.replaceChild(i.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,i){for(let s,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)s=t[n],s.style[e]=i,s.style.cssText||s.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,i){for(let s=0,n=t.length;s<n;s++){const n=t[s];!i&&z.isImportantDisabled(n)||(n.disabled=e),i&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:D,addClass:q,removeClass:W,toggleClass:function(t,e){if(!t||1!==t.nodeType)return;const i=t;let s=!1;const n=new RegExp(`(\\s|^)${e}(\\s|$)`);return n.test(i.className)?i.className=i.className.replace(n," ").trim():(i.className+=" "+e,s=!0),i.className.trim()||i.removeAttribute("class"),s},flashClass:function(e,i,s=120){q(e,i),t.setTimeout((()=>{W(e,i)}),s)},getClientSize:U,getViewportSize:function(){return"visualViewport"in t?{top:t.visualViewport.pageTop,left:t.visualViewport.pageLeft,scale:t.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(i,s,n){if(!i)return console.warn('"parentTarget" is not exist'),null;let o=i;const l=e.createElement("DIV");if(l.style.display="none",/body/i.test(o.nodeName)){const t=e.createElement("DIV"),i=o.attributes;for(let e=0,s=i.length;e<s;e++)t.setAttribute(i[e].name,i[e].value);t.innerHTML=o.innerHTML,o=t}else o=o.cloneNode(!0);l.appendChild(o),e.body.appendChild(l);const r=Array.from(o.querySelectorAll("*")),a=s?[o].concat(r):r;for(let e,i=0;e=a[i];i++){if(1!==e.nodeType)continue;const i=t.getComputedStyle(e),s=e.style;for(const t of n)s.setProperty(t,i.getPropertyValue(t)||"")}return e.body.removeChild(l),o},waitForMediaLoad:function(i,s=5e3){const n=i||e;return new Promise((e=>{const i=["img","video","audio","iframe"].flatMap((t=>Array.from(n.querySelectorAll(t))));if(0===i.length)return void e();const o=i.map((t=>{if(t instanceof HTMLImageElement){if(t.complete)return Promise.resolve()}else if(t instanceof HTMLMediaElement){if(t.readyState>=2)return Promise.resolve()}else if(t instanceof HTMLIFrameElement)try{if("complete"===t.contentDocument?.readyState)return Promise.resolve()}catch(t){console.warn(["[SUNEDITOR] Iframe load error",t])}return new Promise((e=>{t.addEventListener("load",e,{once:!0}),t.addEventListener("error",e,{once:!0})}))}));Promise.race([Promise.all(o),new Promise((e=>t.setTimeout(e,s)))]).then((()=>{e()}))}))},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function Z(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function Y(t,e,i){const s=[];let n=!0;return J(t,(t=>{if(t===e&&(n=!1),n&&!z.isWysiwygFrame(t)){if(i&&3===t.nodeType){let e=null,s=null;i.s=i.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)s=n.textContent.replace(w,""),i.s+=s.length,t.textContent=s+t.textContent,e=n,n=n.previousSibling,G.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)s=o.textContent.replace(w,""),i.e+=s.length,t.textContent+=s,e=o,o=o.nextSibling,G.removeItem(e)}s.push(t)}return!1})),s.map(Z).reverse()}function X(t,e){let i,s=e;for(let e=0,n=t.length;e<n&&(i=s.childNodes,0!==i.length);e++)s=i.length<=t[e]?i[i.length-1]:i[t[e]];return s}function j(t,e){const i=[];return t&&0!==t.childNodes.length?(e=e||function(){return!0},function s(n){t!==n&&e(n)&&i.push(n);for(let t=0,e=n.childNodes.length;t<e;t++)s(n.childNodes[t])}(t),i):i}function K(t){if(!t||z.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!z.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function J(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const i=new RegExp(e,"i");s=e=>i.test(e[t])}i||(i=1/0);let n=0;for(;t&&!s(t);){if(n>=i||z.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const Q={getPositionIndex:Z,getNodePath:Y,getNodeFromPath:X,getListChildren:function(t,e){const i=[];if(!t)return i;const s=t;return s.children&&0!==s.children.length?(e=e||function(){return!0},function t(n){if(s!==n&&e(n)&&i.push(n),n.children)for(let e=0,i=n.children.length;e<i;e++)t(n.children[e])}(s),i):i},getListChildNodes:j,getNodeDepth:K,sortNodeByDepth:function(t,e){const i=e?1:-1,s=-1*i;t.sort((function(t,e){if(!z.isListCell(t)||!z.isListCell(e))return 0;const n=K(t),o=K(e);return n>o?i:n<o?s:0}))},compareElements:function(t,e){let i=t,s=e;for(;i&&s&&i.parentElement!==s.parentElement;)i=i.parentElement,s=s.parentElement;if(!i||!s)return{ancestor:null,a:t,b:e,result:0};const n=i.parentNode.childNodes,o=G.getArrayIndex(n,i),l=G.getArrayIndex(n,s);return{ancestor:i.parentElement,a:i,b:s,result:o>l?1:o<l?-1:0}},getParentElement:J,getParentElements:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const i=new RegExp(e,"i");s=e=>i.test(e[t])}const n=[];i||(i=1/0);let o=0;for(;o<=i&&t&&!z.isWysiwygFrame(t);)s(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!G.hasClass(e,"sun-editor");){if(e.hasAttribute("data-command"))return e;e=e.parentElement}return null},getEventTarget:function(t){return t.target},getEdgeChild:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=function(t){return t===e};else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+("text"===e?"#"+e:e)+"$");const i=new RegExp(e,"i");s=function(e){return i.test(e[t])}}const n=j(t,(t=>s(t)));return n[i?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||(e=t);t&&1===t.nodeType&&t.childNodes.length>0&&!z.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!z.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let i=t.previousSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.previousSibling){i=s.previousSibling;break}}if(!i)return null}if(z.isNonEditable(i))return i;for(;i.lastChild;)i=i.lastChild;return i},getNextDeepestNode:function(t,e){let i=t.nextSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.nextSibling){i=s.nextSibling;break}}if(!i)return null}if(z.isNonEditable(i))return i;for(;i.firstChild;)i=i.firstChild;return i},findTextIndexOnLine:function(t,e,i,s){if(!t)return 0;s||(s=()=>!0);let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!s(l))if(3===l.nodeType){if(l===e)return n+=i,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let i=0,s=e.length;i<s;i++)if(t(e[i]),o)return}}(t),n},findTabEndIndex:function(t,e,i){if(!t)return 0;const s=t.textContent,n=new RegExp(`((\\u00A0|\\s){${i},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(s));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(s.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+i}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let i=null,s=-1,n=-1;for(const o of t){const t=o.parentElement.rowIndex,l=o.rowSpan||1,r=o.colSpan||1;e[t]||(e[t]=[]);let a=0;const h=e[t];for(;h[a];)a++;for(let t=0;t<r;t++)h[a+t]=!0;for(let i=1;i<l;i++){const s=t+i;e[s]||(e[s]=[]);for(let t=0;t<r;t++)e[s][a+t]=!0}const c=t+l-1,d=a+r-1;(c>s||c===s&&d>n)&&(s=c,n=d,i=o)}return i},getScrollParent:function t(e){if(!e||/^(body|html)$/i.test(e.nodeName))return null;const i=e;return i.scrollHeight>i.clientHeight?i:t(i.parentNode)},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}},tt={query:Q,check:z,utils:G};function et(t,e=0){if(!t)return 0;const i=(t+"").match(/-?\d+(\.\d+)?/);if(!i||!i[0])return 0;const s=Number(i[0]);return e<0?s:0===e?Math.round(s):Number(s.toFixed(e))}const it={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:et,getOverlapRangeAtIndex:function(t,e,i,s){if(t<=s?e<i:e>i)return 0;const n=(t>i?t:i)-(e<s?e:s);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},st="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",nt="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",ot=st.split("|"),lt="Backspace|Delete".split("|"),rt=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${st}|Insert|Delete|${nt}|NumLock|ScrollLock`.split("|"),at="Backspace|Enter|Delete".split("|"),ht="Backspace|Enter|Delete".split("|"),ct=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${nt}|NumLock|ScrollLock`.split("|");const dt=y,ut=k,pt=A,gt=tt,mt=it,ft={isShift:function(t){return t.shiftKey||16===t.keyCode},isCtrl:function(t){const e=t.code;return t.ctrlKey||t.metaKey||"MetaLeft"===e||"MetaRight"===e},isAlt:function(t){return t.altKey},isComposing:function(t){return t.isComposing||229===t.keyCode},isBackspace:function(t){return"Backspace"===t},isTab:function(t){return"Tab"===t},isEnter:function(t){return"Enter"===t},isEsc:function(t){return"Escape"===t},isSpace:function(t){return"Space"===t},isDirectionKey:function(t){return ot.includes(t)},isRemoveKey:function(t){return lt.includes(t)},isNonTextKey:function(t){return rt.includes(t)},isHistoryRelevantKey:function(t){return at.includes(t)},isDocumentTypeObserverKey:function(t){return ht.includes(t)},isNonResponseKey:function(t){return ct.includes(t)}},_t={write:async function(t){if(!r)return void console.error("Clipboard is not supported in this browser.");let e="",i="";"string"==typeof t?(e=t,i=t):I(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),i={};for(const e of Array.from(t.attributes))i[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(i)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,i=t.textContent):(e=t.textContent,i=t.textContent),await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([i],{type:"text/plain"})})])}},bt={env:dt,unicode:ut,converter:pt,dom:gt,numbers:mt,keyCodeMap:ft,clipboard:_t},yt={redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z" /></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" /></svg>',bold:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"/></svg>',underline:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.2 9.8C6 7.5 7.7 4.8 10.1 4.3C13.2 3.3 17.7 4.7 17.6 8.5H14.6C14.6 8.2 14.5 7.9 14.5 7.7C14.3 7.1 13.9 6.8 13.3 6.6C12.5 6.3 11.2 6.4 10.5 6.9C9 8.2 10.4 9.5 12 10H7.4C7.3 9.9 7.3 9.8 7.2 9.8M21 13V11H3V13H12.6C12.8 13.1 13 13.1 13.2 13.2C13.8 13.5 14.3 13.7 14.5 14.3C14.6 14.7 14.7 15.2 14.5 15.6C14.3 16.1 13.9 16.3 13.4 16.5C11.6 17 9.4 16.3 9.5 14.1H6.5C6.4 16.7 8.6 18.5 11 18.8C14.8 19.6 19.3 17.2 17.3 12.9L21 13Z" /></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,21.03H16.97V20.03L17.86,19.23C18.62,18.58 19.18,18.04 19.56,17.6C19.93,17.16 20.12,16.75 20.13,16.36C20.14,16.08 20.05,15.85 19.86,15.66C19.68,15.5 19.39,15.38 19,15.38C18.69,15.38 18.42,15.44 18.16,15.56L17.5,15.94L17.05,14.77C17.32,14.56 17.64,14.38 18.03,14.24C18.42,14.1 18.85,14 19.32,14C20.1,14.04 20.7,14.25 21.1,14.66C21.5,15.07 21.72,15.59 21.72,16.23C21.71,16.79 21.53,17.31 21.18,17.78C20.84,18.25 20.42,18.7 19.91,19.14L19.27,19.66V19.68H21.85V21.03Z" /></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,9H16.97V8L17.86,7.18C18.62,6.54 19.18,6 19.56,5.55C19.93,5.11 20.12,4.7 20.13,4.32C20.14,4.04 20.05,3.8 19.86,3.62C19.68,3.43 19.39,3.34 19,3.33C18.69,3.34 18.42,3.4 18.16,3.5L17.5,3.89L17.05,2.72C17.32,2.5 17.64,2.33 18.03,2.19C18.42,2.05 18.85,2 19.32,2C20.1,2 20.7,2.2 21.1,2.61C21.5,3 21.72,3.54 21.72,4.18C21.71,4.74 21.53,5.26 21.18,5.73C20.84,6.21 20.42,6.66 19.91,7.09L19.27,7.61V7.63H21.85V9Z" /></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22.11 21.46L2.39 1.73L1.11 3L7.65 9.54C6.74 11.03 6 12.65 6 14.23C6 17.54 8.69 20.23 12 20.23C13.74 20.23 15.3 19.5 16.4 18.29L20.84 22.73L22.11 21.46M12 18.23C9.78 18.23 8 16.45 8 14.23C8 13.5 8.5 12.27 9.14 11.03L15 16.88C14.26 17.71 13.2 18.23 12 18.23M11.14 7.94L9.71 6.5C10.57 5.38 11.25 4.61 11.25 4.61L12 3.77L12.75 4.61C12.75 4.61 14.03 6.06 15.32 7.94S18 12.07 18 14.23C18 14.41 18 14.59 17.97 14.77L15.46 12.26C15 11.23 14.37 10.07 13.68 9.07C12.84 7.85 12.44 7.42 12 6.9C11.73 7.21 11.5 7.5 11.14 7.94Z" /></svg>',remove_format:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5V5.18L8.82,8H11.22L10.5,9.68L12.6,11.78L14.21,8H20V5H6M3.27,5L2,6.27L8.97,13.24L6.5,19H9.5L11.07,15.34L16.73,21L18,19.73L3.55,5.27L3.27,5Z" /></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M11,17H21V15H11M3,8V16L7,12M3,21H21V19H3V21Z" /></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M3,21H21V19H3M3,12L7,16V8M11,17H21V15H11V17Z" /></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z" /></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5,3.09L15,7.59V4H13V11H20V9H16.41L20.91,4.5L19.5,3.09M4,13V15H7.59L3.09,19.5L4.5,20.91L9,16.41V20H11V13H4Z" /></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" /></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" /></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,7.5H18V9.5H13V7.5M13,14.5H18V16.5H13V14.5M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M19,19V5H5V19H19M11,6V11H6V6H11M10,10V7H7V10H10M11,13V18H6V13H11M10,17V14H7V17H10Z" /></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21H11V13H3M5 15H9V19H5M3 11H11V3H3M5 5H9V9H5M13 3V11H21V3M19 9H15V5H19M18 16H21V18H18V21H16V18H13V16H16V13H18Z" /></svg>',new_document:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',select_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,9H15V15H9M7,17H17V7H7M15,5H17V3H15M15,21H17V19H15M19,17H21V15H19M19,9H21V7H19M19,21A2,2 0 0,0 21,19H19M19,13H21V11H19M11,21H13V19H11M9,3H7V5H9M3,17H5V15H3M5,21V19H3A2,2 0 0,0 5,21M19,3V5H21A2,2 0 0,0 19,3M13,3H11V5H13M3,9H5V7H3M7,21H9V19H7M3,13H5V11H3M3,5H5V3A2,2 0 0,0 3,5Z" /></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 22H3V20H21V22M21 4H3V2H21V4M10 13.7H14L12 8.3L10 13.7M11.2 6H12.9L17.6 18H15.6L14.7 15.4H9.4L8.5 18H6.5L11.2 6Z" /></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,11A4,4 0 0,1 6,7A4,4 0 0,1 10,3H18V5H16V21H14V5H12V21H10V11Z" /></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,3H16V6H11V18H8V6H3V3M12,7H14V9H12V7M15,7H17V9H15V7M18,7H20V9H18V7M12,10H14V12H12V10M12,13H14V15H12V13M12,16H14V18H12V16M12,19H14V21H12V19Z" /></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" /></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 18V10H9.12L11.12 6H5.38L3 10.76V18M9 16H5V11.24L6.62 8H7.88L5.88 12H9M21 18V10H19.12L21.12 6H15.38L13 10.76V18M19 16H15V11.24L16.62 8H17.88L15.88 12H19Z" /></svg>',arrow_down:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,11H11V21H13V11H16L12,7L8,11M4,3V5H20V3H4Z" /></svg>',align_middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,19H11V23H13V19H16L12,15L8,19M16,5H13V1H11V5H8L12,9L16,5M4,11V13H20V11H4Z" /></svg>',align_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,13H13V3H11V13H8L12,17L16,13M4,19V21H20V19H4Z" /></svg>',format_float_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,7V9H11V7H21M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,7H21V13H15V7M3,3H21V5H3V3M13,7V9H3V7H13M9,11V13H3V11H9M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,7H15V13H9V7M3,3H21V5H3V3M3,15H21V17H3V15M3,19H17V21H3V19Z" /></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',background_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M4,17L6.75,14.25L6.72,14.23C6.14,13.64 6.14,12.69 6.72,12.11L11.46,7.37L15.7,11.61L10.96,16.35C10.39,16.93 9.46,16.93 8.87,16.37L8.24,17H4M15.91,2.91C16.5,2.33 17.45,2.33 18.03,2.91L20.16,5.03C20.74,5.62 20.74,6.57 20.16,7.16L16.86,10.45L12.62,6.21L15.91,2.91Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',list_bulleted:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_numbered:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',table:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',table_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.88 12L2.2 16.06L6.26 17.74L7.94 21.8L11 20.53V18.36L9 19.19L7.79 16.21L4.81 15L6.05 12L4.81 9L7.79 7.79L9 4.81L12 6.05L15 4.81L16.21 7.79L19.19 9L17.95 12L18 12.13L19.38 10.75C19.82 10.3 20.38 10.06 20.94 10L21.8 7.94L17.74 6.26L16.06 2.2L12 3.88L7.94 2.2L6.26 6.26L2.2 7.94L3.88 12M22.85 13.47L21.53 12.15C21.33 11.95 21 11.95 20.81 12.15L19.83 13.13L21.87 15.17L22.85 14.19C23.05 14 23.05 13.67 22.85 13.47M13 19.96V22H15.04L21.17 15.88L19.13 13.83L13 19.96Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.58,17L12,14.84L8.42,17L9.37,12.93L6.21,10.2L10.38,9.84L12,6L13.62,9.83L17.79,10.19L14.63,12.92L15.58,17M19,3A2,2 0 0,1 21,5V19C21,20.11 20.1,21 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',table_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,2H16A2,2 0 0,1 18,4V20A2,2 0 0,1 16,22H8A2,2 0 0,1 6,20V4A2,2 0 0,1 8,2M8,10V14H16V10H8M8,16V20H16V16H8M8,4V8H16V4H8Z" /></svg>',table_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,1 20,16H4A2,2 0 0,1 2,14V10A2,2 0 0,1 4,8H20A2,2 0 0,1 22,10V14M4,14H8V10H4V14M10,14H14V10H10V14M16,14H20V10H16V14Z" /></svg>',color_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg>',color_palette:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" /></svg>',border_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,11H13V5H19M19,19H13V13H19M11,11H5V5H11M11,19H5V13H11M3,21H21V3H3V21Z" /></svg>',border_inside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,17H21V15H19M19,21H21V19H19M13,3H11V11H3V13H11V21H13V13H21V11H13M15,21H17V19H15M19,5H21V3H19M19,9H21V7H19M17,3H15V5H17M5,3H3V5H5M9,3H7V5H9M3,17H5V15H3M5,7H3V9H5M7,21H9V19H7M3,21H5V19H3V21Z" /></svg>',border_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H21V19H19M15,21H17V19H15M11,17H13V15H11M19,9H21V7H19M19,5H21V3H19M3,13H21V11H3M11,21H13V19H11M19,17H21V15H19M13,3H11V5H13M13,7H11V9H13M17,3H15V5H17M9,3H7V5H9M5,3H3V5H5M7,21H9V19H7M3,17H5V15H3M5,7H3V9H5M3,21H5V19H3V21Z" /></svg>',border_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M15,21H17V19H15M15,5H17V3H15M19,9H21V7H19M19,5H21V3H19M19,13H21V11H19M19,21H21V19H19M11,21H13V3H11M19,17H21V15H19M7,5H9V3H7M3,17H5V15H3M3,21H5V19H3M3,13H5V11H3M7,13H9V11H7M7,21H9V19H7M3,5H5V3H3M3,9H5V7H3V9Z" /></svg>',border_outside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,11H7V13H9M13,15H11V17H13M19,19H5V5H19M3,21H21V3H3M17,11H15V13H17M13,11H11V13H13M13,7H11V9H13V7Z" /></svg>',border_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M19,21H21V19H19M19,13H21V11H19M19,5H21V3H19M19,17H21V15H19M15,21H17V19H15M19,9H21V7H19M3,21H5V3H3M7,13H9V11H7M7,5H9V3H7M7,21H9V19H7M11,13H13V11H11M11,9H13V7H11M11,5H13V3H11M11,17H13V15H11M11,21H13V19H11V21Z" /></svg>',border_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M19,21H21V19H19M11,9H13V7H11M15,21H17V19H15M19,17H21V15H19M3,5H21V3H3M19,13H21V11H19M19,9H21V7H19M11,17H13V15H11M3,9H5V7H3M3,13H5V11H3M3,21H5V19H3M3,17H5V15H3M11,21H13V19H11M11,13H13V11H11M7,13H9V11H7M7,21H9V19H7V21Z" /></svg>',border_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,5H13V3H11M15,5H17V3H15M15,21H17V19H15M19,21H21V3H19M3,9H5V7H3M3,17H5V15H3M3,13H5V11H3M11,21H13V19H11M3,21H5V19H3M7,5H9V3H7M3,5H5V3H3M7,21H9V19H7V21Z" /></svg>',border_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,15H3V17H5M3,21H21V19H3M5,11H3V13H5M19,9H21V7H19M19,5H21V3H19M5,7H3V9H5M19,17H21V15H19M19,13H21V11H19M17,3H15V5H17M13,3H11V5H13M5,3H3V5H5M9,3H7V5H9" /></svg>',border_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M15,21H17V19H15M11,5H13V3H11M19,5H21V3H19M11,9H13V7H11M19,9H21V7H19M19,21H21V19H19M19,13H21V11H19M19,17H21V15H19M11,13H13V11H11M3,5H5V3H3M3,9H5V7H3M3,13H5V11H3M3,17H5V15H3M3,21H5V19H3M11,21H13V19H11M11,17H13V15H11M7,21H9V19H7M7,13H9V11H7M7,5H9V3H7V5Z" /></svg>',horizontal_line:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 3C3.9 3 3 3.9 3 5S2.1 7 1 7V9C2.1 9 3 9.9 3 11S3.9 13 5 13H7V11H5V10C5 8.9 4.1 8 3 8C4.1 8 5 7.1 5 6V5H7V3M11 3C12.1 3 13 3.9 13 5S13.9 7 15 7V9C13.9 9 13 9.9 13 11S12.1 13 11 13H9V11H11V10C11 8.9 11.9 8 13 8C11.9 8 11 7.1 11 6V5H9V3H11M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V15H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',selection_remove:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 20V17H22V20C22 21.11 21.1 22 20 22H17V20H20M2 20V17H4V20H7V22H4C2.9 22 2 21.1 2 20M10 20H14V22H10V20M14.59 8L12 10.59L9.41 8L8 9.41L10.59 12L8 14.59L9.41 16L12 13.41L14.59 16L16 14.59L13.41 12L16 9.41L14.59 8M20 10H22V14H20V10M2 10H4V14H2V10M2 4C2 2.89 2.9 2 4 2H7V4H4V7H2V4M22 4V7H20V4H17V2H20C21.1 2 22 2.9 22 4M10 2H14V4H10V2Z" /></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" /></svg>',image_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M17,13V19H7L12,14L14,16M10,10.5A1.5,1.5 0 0,1 8.5,12A1.5,1.5 0 0,1 7,10.5A1.5,1.5 0 0,1 8.5,9A1.5,1.5 0 0,1 10,10.5Z" /></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,8V16L15,12L10,8Z" /></svg>',video_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M16,18L13.5,16.3V18H8V13H13.5V14.7L16,13V18Z" /></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',link_rel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 1C1.89 1 1 1.89 1 3V14C1 15.11 1.89 16 3 16H14C15.11 16 16 15.11 16 14V11H14V14H3V3H14V5H16V3C16 1.89 15.11 1 14 1M9 7C7.89 7 7 7.89 7 9V12H9V9H20V20H9V18H7V20C7 21.11 7.89 22 9 22H20C21.11 22 22 21.11 22 20V9C22 7.89 21.11 7 20 7H9" /></svg>',math:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" /></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4M8,13V15L11,12L8,9V11H3V13H8M16,11V9L13,12L16,15V13H21V11H16Z" /></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 14H21V20H3V14H5V18H19V14M3 4V10H5V6H19V10H21V4H3M11 11V13H8V15L5 12L8 9V11H11M16 11V9L19 12L16 15V13H13V11H16Z" /></svg>',unmerge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4"/><line x1="7.5" y1="12" x2="16.5" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',caption:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',revert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',resize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23,15H21V17H23V15M23,11H21V13H23V11M23,19H21V21C22,21 23,20 23,19M15,3H13V5H15V3M23,7H21V9H23V7M21,3V5H23C23,4 22,3 21,3M3,21H11V15H1V19A2,2 0 0,0 3,21M3,7H1V9H3V7M15,19H13V21H15V19M19,3H17V5H19V3M19,19H17V21H19V19M3,3C2,3 1,4 1,5H3V3M3,11H1V13H3V11M11,3H9V5H11V3M7,3H5V5H7V3Z" /></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z" /></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,0 20,12H4A2,2 0 0,0 2,14V21H4V19H8V21H10V19H14V21H16V19H20V21H22V14M4,14H8V17H4V14M10,14H14V17H10V14M20,14V17H16V14H20M11,10H13V7H16V5H13V2H11V5H8V7H11V10Z" /></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,2A2,2 0 0,0 11,4V20A2,2 0 0,0 13,22H22V2H13M20,10V14H13V10H20M20,16V20H13V16H20M20,4V8H13V4H20M9,11H6V8H4V11H1V13H4V16H6V13H9V11Z" /></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z" /></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z" /></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z" /></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,8H19A2,2 0 0,1 21,10V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V10A2,2 0 0,1 5,8M5,12V15H11V12H5M13,12V15H19V12H13M5,17V20H11V17H5M13,17V20H19V17H13M11,2H21V6H19V4H13V6H11V2Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z" /></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z" /></svg>',mirror_horizontal:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,9H13V14.5A2.5,2.5 0 0,1 10.5,17A2.5,2.5 0 0,1 8,14.5A2.5,2.5 0 0,1 10.5,12C11.07,12 11.58,12.19 12,12.5V7H16V9M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',audio_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M7.76,16.24L6.35,17.65C4.78,16.1 4,14.05 4,12C4,9.95 4.78,7.9 6.34,6.34L7.75,7.75C6.59,8.93 6,10.46 6,12C6,13.54 6.59,15.07 7.76,16.24M12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16M17.66,17.66L16.25,16.25C17.41,15.07 18,13.54 18,12C18,10.46 17.41,8.93 16.24,7.76L17.65,6.35C19.22,7.9 20,9.95 20,12C20,14.05 19.22,16.1 17.66,17.66M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z" /></svg>',audio_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M20,16H8V4H20M12.5,15A2.5,2.5 0 0,0 15,12.5V7H18V5H14V10.5C13.58,10.19 13.07,10 12.5,10A2.5,2.5 0 0,0 10,12.5A2.5,2.5 0 0,0 12.5,15M4,6H2V20A2,2 0 0,0 4,22H18V20H4" /></svg>',video_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6M20 4V16H8V4H20M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M12 14.5V5.5L18 10L12 14.5Z" /></svg>',file_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,15H9V13H16V15M19,11H9V9H19V11M19,7H9V5H19V7M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3M21,1A2,2 0 0,1 23,3V17C23,18.11 22.11,19 21,19H7A2,2 0 0,1 5,17V3C5,1.89 5.89,1 7,1H21M7,3V17H21V3H7Z" /></svg>',file_browser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 6V20H20V22H2C.895 22 0 21.11 0 20V6H2M12.78 10.05L15.81 9.79L17 7L18.19 9.79L21.22 10.05L18.92 12.04L19.61 15L17 13.47L14.39 15L15.08 12.04L12.78 10.05M24 6V16C24 17.11 23.11 18 22 18H6C4.9 18 4 17.11 4 16V4C4 2.89 4.9 2 6 2H12L14 4H22C23.11 4 24 4.9 24 6M22 6H6V16H22V6Z" /></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',bookmark_anchor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,18L12,15.82L7,18V5H17M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',file_upload:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M12,12L16,16H13.5V19H10.5V16H8L12,12Z" /></svg>',file_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',file_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.81 22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H14L20 8V13.09C19.67 13.04 19.34 13 19 13S18.33 13.04 18 13.09V9H13V4H6V20H13.09C13.21 20.72 13.46 21.39 13.81 22M23 18H20V15H18V18H15V20H18V23H20V20H23V18Z" /></svg>',upload_tray:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 2L6.46 7.46L7.88 8.88L11 5.75V15H13V5.75L16.13 8.88L17.55 7.45L12 2Z" /></svg>',folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z" /></svg>',plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>',minus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H5V11H19V13Z" /></svg>',selection:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,4C2,2.89 2.9,2 4,2H7V4H4V7H2V4M22,4V7H20V4H17V2H20A2,2 0 0,1 22,4M20,20V17H22V20C22,21.11 21.1,22 20,22H17V20H20M2,20V17H4V20H7V22H4A2,2 0 0,1 2,20M10,2H14V4H10V2M10,20H14V22H10V20M20,10H22V14H20V10M2,10H4V14H2V10Z" /></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /></svg>',cut:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z" /></svg>',PDF:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9.5 11.5C9.5 12.3 8.8 13 8 13H7V15H5.5V9H8C8.8 9 9.5 9.7 9.5 10.5V11.5M14.5 13.5C14.5 14.3 13.8 15 13 15H10.5V9H13C13.8 9 14.5 9.7 14.5 10.5V13.5M18.5 10.5H17V11.5H18.5V13H17V15H15.5V9H18.5V10.5M12 10.5H13V13.5H12V10.5M7 10.5H8V11.5H7V10.5Z" /></svg>',format_paint:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,4V3A1,1 0 0,0 17,2H5A1,1 0 0,0 4,3V7A1,1 0 0,0 5,8H17A1,1 0 0,0 18,7V6H19V10H9V21A1,1 0 0,0 10,22H12A1,1 0 0,0 13,21V12H21V4H18Z" /></svg>',find_replace:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6C12.38,6 13.63,6.56 14.54,7.46L12,10H18V4L15.95,6.05C14.68,4.78 12.93,4 11,4C7.47,4 4.57,6.61 4.08,10H6.1C6.56,7.72 8.58,6 11,6M16.64,15.14C17.3,14.24 17.76,13.17 17.92,12H15.9C15.44,14.28 13.42,16 11,16C9.62,16 8.37,15.44 7.46,14.54L10,12H4V18L6.05,15.95C7.32,17.22 9.07,18 11,18C12.55,18 14,17.5 15.14,16.64L20,21.5L21.5,20L16.64,15.14Z" /></svg>',drawing:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.75 20.85C11.53 20.15 11.14 18.22 10.24 17C9.35 15.75 8.12 14.89 6.88 14.06C6 13.5 5.19 12.8 4.54 12C4.26 11.67 3.69 11.06 4.27 10.94C4.86 10.82 5.88 11.4 6.4 11.62C7.31 12 8.21 12.44 9.05 12.96L10.06 11.26C8.5 10.23 6.5 9.32 4.64 9.05C3.58 8.89 2.46 9.11 2.1 10.26C1.78 11.25 2.29 12.25 2.87 13.03C4.24 14.86 6.37 15.74 7.96 17.32C8.3 17.65 8.71 18.04 8.91 18.5C9.12 18.94 9.07 18.97 8.6 18.97C7.36 18.97 5.81 18 4.8 17.36L3.79 19.06C5.32 20 7.88 21.47 9.75 20.85M20.84 5.25C21.06 5.03 21.06 4.67 20.84 4.46L19.54 3.16C19.33 2.95 18.97 2.95 18.76 3.16L17.74 4.18L19.82 6.26M11 10.92V13H13.08L19.23 6.85L17.15 4.77L11 10.92Z" /></svg>',eraser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14,3C14.63,3 14.12,3.2 13.73,3.59L2.59,14.73C1.81,15.5 1.81,16.77 2.59,17.56L5.03,20H12.69L21.41,11.27C22.2,10.5 22.2,9.23 21.41,8.44L16.56,3.59C16.17,3.2 15.65,3 15.14,3M17,18L15,20H22V18" /></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>',selection_search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.27 18.9C19.7 18.21 19.95 17.38 19.95 16.5C19.95 14 17.95 12 15.46 12S10.96 14 10.96 16.5 12.96 21 15.46 21C16.33 21 17.15 20.75 17.84 20.32L20.96 23.39L22.35 22L19.27 18.9M15.46 19C14.07 19 12.96 17.88 12.96 16.5S14.07 14 15.46 14 17.95 15.12 17.95 16.5 16.84 19 15.46 19M22 14H21.45C21.12 13.19 20.62 12.47 20 11.86V10H22V14M20 4H17V2H20C21.11 2 22 2.9 22 4V7H20V4M14 4H10V2H14V4M4 2H7V4H4V7H2V4C2 2.89 2.9 2 4 2M12 22H10V20C10.5 20.82 11.2 21.5 12 22M4 20H7V22H4C2.9 22 2 21.11 2 20V17H4V20M4 14H2V10H4V14Z" /></svg>',embed:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 19H15V21H19C20.1 21 21 20.1 21 19V15H19M19 3H15V5H19V9H21V5C21 3.9 20.1 3 19 3M5 5H9V3H5C3.9 3 3 3.9 3 5V9H5M5 15H3V19C3 20.1 3.9 21 5 21H9V19H5V15M7 11H9V13H7V11M11 11H13V13H11V11M15 11H17V13H15V11Z" /></svg>',menu_arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>',menu_arrow_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>',menu_arrow_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,17L15,12L10,7V17Z" /></svg>',menu_arrow_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,7L9,12L14,17V7Z" /></svg>',side_menu_hamburger:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg>',side_menu_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4A2,2 0 0,1 24,6V16A2,2 0 0,1 22,18H6A2,2 0 0,1 4,16V4A2,2 0 0,1 6,2H12L14,4H22M2,6V20H20V22H2A2,2 0 0,1 0,20V11H0V6H2M6,6V16H22V6H6Z" /></svg>',side_menu_folder_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4H14L12,2H6A2,2 0 0,0 4,4V16A2,2 0 0,0 6,18H22A2,2 0 0,0 24,16V6A2,2 0 0,0 22,4M2,6H0V11H0V20A2,2 0 0,0 2,22H20V20H2V6Z" /></svg>',side_menu_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>',side_menu_folder_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 19C13 19.34 13.04 19.67 13.09 20H4C2.9 20 2 19.11 2 18V6C2 4.89 2.89 4 4 4H10L12 6H20C21.1 6 22 6.89 22 8V13.81C21.12 13.3 20.1 13 19 13C15.69 13 13 15.69 13 19M20 18V15H18V18H15V20H18V23H20V20H23V18H20Z" /></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_text:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z" /></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /></svg>',as_inline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,7L13,17H3L8,7M3,3H21V5H3V3M21,15V17H14V15H21M3,19H21V21H3V19Z" /></svg>',as_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,7L17,17H7L12,7M3,3H21V5H3V3M3,19H21V21H3V19Z" /></svg>',page_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,20H6V18H4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V18H18V20M14,2H6A2,2 0 0,0 4,4V12H6V4H14V8H18V12H20V8L14,2M11,16H8V14H11V16M16,16H13V14H16V16M3,14H6V16H3V14M21,16H18V14H21V16Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6H13V14L16.5,10.5L17.92,11.92L12,17.84L6.08,11.92L7.5,10.5L11,14V6M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,18H11V10L7.5,13.5L6.08,12.08L12,6.16L17.92,12.08L16.5,13.5L13,10V18M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" /></svg>',collapse_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.92,19.92L4,12L11.92,4.08L13.33,5.5L7.83,11H22V13H7.83L13.34,18.5L11.92,19.92M4,12V2H2V22H4V12Z" /></svg>',collapse_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.08,4.08L20,12L12.08,19.92L10.67,18.5L16.17,13H2V11H16.17L10.67,5.5L12.08,4.08M20,12V22H22V2H20V12Z" /></svg>',map:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',open_in_new:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" /></svg>'};var vt=i("cfbI"),Ct=i.n(vt);function wt(t,e,i,s,n,o,l,r){const a=new Map([["key",r],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["documentTypeInner",l.inner],["documentTypePage",l.page],["documentTypePageMirror",l.pageMirror],["wysiwygFrame",i],["wysiwyg",i],["codeWrapper",s],["code",n],["codeNumbers",s?.querySelector(".se-code-view-line")],["lineBreaker_t",e.querySelector(".se-line-breaker-component-t")],["lineBreaker_b",e.querySelector(".se-line-breaker-component-b")],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",et(i.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",-1],["historyIndex",-1],["savedIndex",-1],["eventwysiwyg",null]]);o&&xt(o,a);const h=e.querySelector(".se-placeholder");return h&&a.set("placeholder",h),a}function xt(t,e){t?e.set("statusbar",t):e.delete("statusbar");const i=t?t.querySelector(".se-navigation"):null,s=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;i?e.set("navigation",i):e.delete("navigation"),s?e.set("charWrapper",s):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter")}function kt(t,e,i,s,n){const o=new Map([["menuTray",i],["toolbar.main",t],["toolbar.buttonTray",t.querySelector(".se-btn-tray")],["toolbar._arrow",t.querySelector(".se-arrow")]]);return s&&(o.set("toolbar.sub.main",s),o.set("toolbar.sub.buttonTray",s.querySelector(".se-btn-tray")),o.set("toolbar.sub._arrow",s.querySelector(".se-arrow")),o.set("toolbar.sub._wrapper",s.parentElement.parentElement)),e&&(o.set("toolbar._wrapper",e.querySelector(".sun-editor")),o.set("_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy"))),n&&o.set("statusbar._wrapper",n.querySelector(".sun-editor")),o}const Et={BUTTON_LIST:[["undo","redo"],"|",["bold","underline","italic","strike","|","subscript","superscript"],"|",["removeFormat"],"|",["outdent","indent"],"|",["fullScreen","showBlocks","codeView"],"|",["preview","print"]],REQUIRED_FORMAT_LINE:"div",REQUIRED_ELEMENT_WHITELIST:"br|div",ELEMENT_WHITELIST:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",TEXT_STYLE_TAGS:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary",SCOPE_SELECTION_TAGS:["td","table","li","ol","ul","pre","figcaption","blockquote","dl","dt","dd"],ATTRIBUTE_WHITELIST:"contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling",FORMAT_LINE:"P|H[1-6]|LI|TH|TD|DETAILS",FORMAT_BR_LINE:"PRE",FORMAT_CLOSURE_BR_LINE:"",FORMAT_BLOCK:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS",FORMAT_CLOSURE_BLOCK:"TH|TD",ALLOWED_EMPTY_NODE_LIST:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details",SIZE_UNITS:["px","pt","em","rem"],CLASS_NAME:"^__se__|^se-|^katex|^MathJax",CLASS_MJX:"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover",EXTRA_TAG_MAP:{script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},CONTENT_STYLES:"background|background-clip|background-color|border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|box-shadow|box-sizing|caption-side|color|content|direction|display|float|font|font-family|font-size|font-style|font-weight|height|left|letter-spacing|line-height|list-style-position|list-style-type|margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|max-width|min-width|outline|overflow|position|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|page-break-before|page-break-after|page-break-inside|rotate|rotateX|rotateY|table-layout|text-align|text-decoration|text-shadow|text-transform|top|text-indent|text-rendering|vertical-align|visibility|white-space|width|word-break|word-wrap",TAG_STYLES:{"table|th|td":"border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align|text-align","table|td":"width",tr:"height",col:"width","ol|ul":"list-style-type"},TEXT_STYLES:"font-family|font-size|color|background-color",LINE_STYLES:"text-align|margin-left|margin-right|line-height",RETAIN_STYLE_MODE:["repeat","always","none"]},St={value:"fixed",placeholder:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,height:!0,minHeight:!0,maxHeight:!0,editorStyle:!0,iframe:"fixed",iframe_fullPage:"fixed",iframe_attributes:!0,iframe_cssFileName:!0,statusbar:!0,statusbar_showPathLabel:!0,statusbar_resizeEnable:"fixed",charCounter:!0,charCounter_max:!0,charCounter_label:!0,charCounter_type:!0},Tt={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"fixed",type:"fixed",theme:!0,lang:"fixed",fontSizeUnits:"fixed",allowedClassName:"fixed",closeModalOutsideClick:"fixed",copyFormatKeepOn:!0,syncTabIndent:!0,tabDisable:!0,autoLinkify:!0,autoStyleify:!0,scrollToOptions:!0,componentScrollToOptions:!0,retainStyleMode:!0,allowedExtraTags:"fixed",events:!0,__textStyleTags:"fixed",textStyleTags:"fixed",convertTextTags:"fixed",__tagStyles:"fixed",tagStyles:"fixed",spanStyles:"fixed",lineStyles:"fixed",textDirection:!0,reverseButtons:"fixed",historyStackDelayTime:!0,lineAttrReset:!0,printClass:!0,defaultLine:"fixed",defaultLineBreakFormat:!0,scopeSelectionTags:!0,__defaultElementWhitelist:"fixed",elementWhitelist:"fixed",elementBlacklist:"fixed",__defaultAttributeWhitelist:"fixed",attributeWhitelist:"fixed",attributeBlacklist:"fixed",__defaultFormatLine:"fixed",formatLine:"fixed",__defaultFormatBrLine:"fixed",formatBrLine:"fixed",__defaultFormatClosureBrLine:"fixed",formatClosureBrLine:"fixed",__defaultFormatBlock:"fixed",formatBlock:"fixed",__defaultFormatClosureBlock:"fixed",formatClosureBlock:"fixed",allowedEmptyTags:!0,toolbar_width:!0,toolbar_container:"fixed",toolbar_sticky:!0,toolbar_hide:!0,subToolbar:"fixed",statusbar_container:"fixed",shortcutsHint:!0,shortcutsDisable:"fixed",shortcuts:"fixed",fullScreenOffset:!0,previewTemplate:!0,printTemplate:!0,componentAutoSelect:!0,defaultUrlProtocol:!0,allUsedStyles:"fixed",toastMessageTime:!0,icons:"fixed",freeCodeViewMode:!0,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"},Ht=dt._d;function Lt(t,e,i,s,n,o){if(!i||i.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let h,c,d,u,p,g,m,f,_,b,y,v,C,w,x=0;x<i.length;x+=2+w){if(w=0,h=i[x].split("+"),_=null,b=h[h.length-1].trim?.(),b.startsWith("~"))_=t,b=h.pop().trim().substring(1);else if(b.startsWith("$~")){const t=h.pop().trim().substring(2).split(".");_=t[0],b=t[1]}else b.startsWith("$")?(w=1,b=i[x+2]):b="";d=u=p=g=m=f=c=null;for(const t of h)switch(t.trim()){case"c":d=!0;break;case"!":p=!0;break;case"s":u=!0;break;case"_":g=!0;break;case"=":f=!0;break;case"/":m=!0;break;default:c=t}c=c.split("|");for(let i=0,l=c.length;i<l;i++)v=d?c[i]+(u?"1000":""):c[i],s.has(v)||(C=n.indexOf(t),C=-1===C?"":mt.isOdd(C)?n[C+1]:n[C-1],C&&o.push(v),s.set(v,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:_,command:t,method:b,r:C,type:e?.getAttribute("data-type"),button:e,key:v}));(y=i[x+1])&&(l&&(r=u,a=y,l.appendChild(gt.utils.createElement("SPAN",{class:"se-shortcut"},dt.cmdIcon+(r?dt.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function Mt(t,e){return[t,e].reduce(((t,e)=>{for(const i in e)t[i]=(e[i]||"").toLowerCase();return t}),{})}function Nt(t,e,i){const s=t.buttonList||Et.BUTTON_LIST,n=new Map;if(e.length>1&&!t.toolbar_container&&!/inline|balloon/i.test(t.mode))throw Error('[SUNEDITOR.create.fail] In multi root, The "mode" option cannot be "classic" without using the "toolbar_container" option.');n.set("v2Migration",!!t.v2Migration),n.set("buttons",new Set(s.toString().split(",")));const o=!1!==t.strictMode;n.set("strictMode",{tagFilter:o,formatFilter:o,classFilter:o,textStyleTagFilter:o,attrFilter:o,styleFilter:o,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0),n.set("mode",t.mode||"classic"),n.set("type",t.type?.split(":")[0]||""),n.set("theme",t.theme||""),n.set("_themeClass",t.theme?` se-theme-${t.theme}`:""),n.set("_type_options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):Et.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${Et.CLASS_NAME}`)),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!i.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]),n.set("scrollToOptions",{behavior:"auto",block:"nearest",...t.scrollToOptions}),n.set("componentScrollToOptions",{behavior:"smooth",block:"center",...t.componentScrollToOptions});let l=t.retainStyleMode;"string"!=typeof l||Et.RETAIN_STYLE_MODE.includes(l)||(console.error(`Invalid retainStyleMode: ${l}. Valid options are ${Et.RETAIN_STYLE_MODE.join(", ")}. Using default 'once'.`),l="repeat"),n.set("retainStyleMode",l);const r={...Et.EXTRA_TAG_MAP,...t.allowedExtraTags,"-":!0},a=Object.keys(r),h=a.filter((t=>r[t])).join("|"),c=a.filter((t=>!r[t])).join("|");n.set("_allowedExtraTag",h),n.set("_disallowedExtraTag",c),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:Et.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const d=Mt({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",d),n.set("_textStyleTags",Object.values(d).concat(["span","li"])),n.set("tagStyles",[{...Et.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Et.TEXT_STYLES}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Et.LINE_STYLES}${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_defaultStyleTagMap",{strong:d.bold,b:d.bold,u:d.underline,ins:d.underline,em:d.italic,i:d.italic,del:d.strike,strike:d.strike,s:d.strike,sub:d.subscript,sup:d.superscript}),n.set("_styleCommandMap",Mt(pt.swapKeyValue(d),{strong:"bold",b:"bold",u:"underline",ins:"underline",em:"italic",i:"italic",del:"strike",strike:"strike",s:"strike",sub:"subscript",sup:"superscript"})),n.set("_defaultTagCommand",{bold:d.bold,underline:d.underline,italic:d.italic,strike:d.strike,subscript:d.sub,superscript:d.sup}),n.set("textDirection","string"!=typeof t.textDirection?"ltr":t.textDirection),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),mt.isEven(n.get("_reverseCommandArray").length)&&console.warn('[SUNEDITOR.create.warning] The "reverseCommands" option is invalid, Shortcuts key may not work properly.'),n.set("historyStackDelayTime","number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400),n.set("_editableClass","sun-editor-editable"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")+("document"===n.get("type")?" se-type-document-editable":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass+" "+n.get("_editableClass"):null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p"),n.set("defaultLineBreakFormat",t.defaultLineBreakFormat||"line"),n.set("scopeSelectionTags",t.scopeSelectionTags||Et.SCOPE_SELECTION_TAGS);const u=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),p=n.get("externalLibs").mathjax?Et.CLASS_MJX+"|":"";n.set("elementWhitelist",u+(u?"|":"")+p+n.get("_allowedExtraTag"));const g=(m=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),f=(f=n.get("defaultLine")).toLowerCase(),m.split("|").filter((function(t){return t!==f||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${f}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var m,f;if(n.set("elementBlacklist",g+(g?"|":"")+n.get("_disallowedExtraTag")),n.set("attributeWhitelist",t.attributeWhitelist&&"object"==typeof t.attributeWhitelist?t.attributeWhitelist:null),n.set("attributeBlacklist",t.attributeBlacklist&&"object"==typeof t.attributeBlacklist?t.attributeBlacklist:null),n.set("formatClosureBrLine",Ot(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:Et.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",Ot((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:Et.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",Ot(Et.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:Et.FORMAT_LINE).toLowerCase(),n.get("elementBlacklist"))),!n.get("formatLine").reg.test(n.get("defaultLine")))throw Error(`[SUNEDITOR.create.fail] The "defaultLine(${n.get("defaultLine")})" option must be included in the "formatLine(${n.get("formatLine").str})" option.`);n.set("formatClosureBlock",Ot(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:Et.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",Ot((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:Et.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",Et.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",Et.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:Et.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:Et.ATTRIBUTE_WHITELIST).toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),i=(t.get("__defaultElementWhitelist")+"|"+t.get("elementWhitelist")+"|"+t.get("formatLine").str+"|"+t.get("formatBrLine").str+"|"+t.get("formatClosureBlock").str+"|"+t.get("formatClosureBrLine").str).replace(/(^\||\|$)/g,"").split("|").filter(((t,i,s)=>t&&s.indexOf(t)===i&&!e.includes(t)));return i.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?mt.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?Ht.querySelector(t.toolbar_container):t.toolbar_container:null),n.set("toolbar_sticky",/balloon/i.test(n.get("mode"))?-1:void 0===t.toolbar_sticky?0:mt.is(t.toolbar_sticky)?mt.get(t.toolbar_sticky,0):-1),n.set("toolbar_hide",!!t.toolbar_hide);let _=null;const b=t.subToolbar;b?.buttonList?.length>0&&(/balloon/.test(n.get("mode"))?console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.'):(n.set("_subMode",b.mode||"balloon"),n.set("toolbar.sub_width",b.width?mt.is(b.width)?b.width+"px":b.width:"auto"),_=n.get("_rtl")?b.buttonList.reverse():b.buttonList,n.set("buttons_sub",new Set(_.toString().split(",")))));const y=new Map;for(let i=0,s=e.length;i<s;i++)y.set(e[i].key,Bt(e[i].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const v=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],link:["c+KeyK","K"],hr:["!+---+=+~shortcut",""],list_numbered:["!+1.+_+~shortcut",""],list_bulleted:["!+*.+_+~shortcut",""],_h1:["c+s+Digit1|Numpad1+$~formatBlock.applyHeaderByShortcut",""],_h2:["c+s+Digit2|Numpad2+$~formatBlock.applyHeaderByShortcut",""],_h3:["c+s+Digit3|Numpad3+$~formatBlock.applyHeaderByShortcut",""]},t.shortcuts||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):{};n.set("shortcuts",v),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:mt.is(t.fullScreenOffset)?mt.get(t.fullScreenOffset,0):0),n.set("previewTemplate","string"==typeof t.previewTemplate?t.previewTemplate:null),n.set("printTemplate","string"==typeof t.printTemplate?t.printTemplate:null),n.set("componentAutoSelect",void 0!==t.componentAutoSelect&&!!t.componentAutoSelect),n.set("defaultUrlProtocol","string"==typeof t.defaultUrlProtocol?t.defaultUrlProtocol:null);const C=n.get("externalLibs").codeMirror;C&&(n.set("codeMirror",C),C.EditorView?n.set("codeMirror6Editor",!0):C.src?n.set("codeMirror5Editor",!0):(console.warn("[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly."),n.set("codeMirror",null))),n.set("__listCommonStyle",t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"]);const w=t.icons&&"object"==typeof t.icons?[yt,t.icons].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):yt;n.set("icons",w);const x=new Set(Et.CONTENT_STYLES.split("|")),k=t.spanStyles?.split("|")||[],E=n.get("__listCommonStyle"),S=Et.TEXT_STYLES.split("|");for(let t=0,e=S.length;t<e;t++)x.add(S[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,i=e.length;t<i;t++)x.add(e[t])}for(let t=0,e=k.length;t<e;t++)x.add(k[t]);for(let t=0,e=E.length;t<e;t++)x.add(E[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)x.add(T[t]);return n.set("allUsedStyles",x),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:w,l:t.lang||Ct(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?s.reverse():s,subButtons:_,statusbarContainer:"string"==typeof t.statusbar_container?Ht.querySelector(t.statusbar_container):t.statusbar_container,frameMap:y}}function At(t,e){let i=null,s=null,n=null;if(t.get("statusbar")&&(i=(e=e||gt.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"})).querySelector(".se-navigation")||gt.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(i),t.get("charCounter"))){if(s=e.querySelector(".se-char-counter-wrapper")||gt.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=s.querySelector(".se-char-label")||gt.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),s.appendChild(e)}if(n=s.querySelector(".se-char-counter")||gt.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",s.appendChild(n),t.get("charCounter_max")>0){const e=s.querySelector(".se-char-max")||gt.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),s.appendChild(e)}e.appendChild(s)}return{statusbar:e,navigation:i,charWrapper:s,charCounter:n}}function Bt(t,e){const i=new Map;i.set("_origin",t);const s=e.statusbar_container,n=void 0===t.value?e.value:t.value,o=void 0===t.placeholder?e.placeholder:t.placeholder,l=void 0===t.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,r=void 0===t.width?e.width:t.width,a=void 0===t.minWidth?e.minWidth:t.minWidth,h=void 0===t.maxWidth?e.maxWidth:t.maxWidth,c=void 0===t.height?e.height:t.height,d=void 0===t.minHeight?e.minHeight:t.minHeight,u=void 0===t.maxHeight?e.maxHeight:t.maxHeight,p=void 0===t.editorStyle?e.editorStyle:t.editorStyle,g=void 0===t.iframe?e.iframe:t.iframe,m=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,f=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,_=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,b=s||void 0===t.statusbar?e.statusbar:t.statusbar,y=s||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,v=!s&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),C=s||void 0===t.charCounter?e.charCounter:t.charCounter,w=s||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=s||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,k=s||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;i.set("value",n),i.set("placeholder",o),i.set("editableFrameAttributes",l||{}),i.set("width",r?mt.is(r)?r+"px":r:"100%"),i.set("minWidth",(mt.is(a)?a+"px":a)||""),i.set("maxWidth",(mt.is(h)?h+"px":h)||""),i.set("height",c?mt.is(c)?c+"px":c:"auto"),i.set("minHeight",(mt.is(d)?d+"px":d)||""),i.set("maxHeight",(mt.is(u)?u+"px":u)||""),i.set("editorStyle",p),i.set("_defaultStyles",pt._setDefaultOptionStyle(i,"string"==typeof p?p:"")),i.set("iframe",!(!m&&!g)),i.set("iframe_fullPage",!!m),i.set("iframe_attributes",f||{}),i.set("iframe_cssFileName",g?"string"==typeof _?[_]:_||["suneditor"]:null);const E=void 0===b||!!b;return i.set("statusbar",E),i.set("statusbar_showPathLabel",!!E&&("boolean"!=typeof y||y)),i.set("statusbar_resizeEnable",!!E&&(void 0===v||!!v)),i.set("charCounter",w>0||"boolean"==typeof C&&C),i.set("charCounter_max",mt.is(w)&&w>-1?1*w:null),i.set("charCounter_label","string"==typeof x?x.trim():null),i.set("charCounter_type","string"==typeof k?k:"char"),i}function It(t,e,i,s){const n=s.get("_defaultStyles");i.style.cssText=n.top;const o=gt.utils.createElement(s.get("iframe")?"IFRAME":"DIV",{class:"se-wrapper-inner se-wrapper-wysiwyg","data-root-key":t});if(s.get("iframe")){const t=s.get("iframe_attributes");for(const e in t)o.setAttribute(e,t[e]);const e=o;e.allowFullscreen=!0,e.frameBorder="0",e.style.cssText=n.frame}else o.setAttribute("contenteditable","true"),o.setAttribute("scrolling","auto"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=gt.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=gt.utils.createElement("SPAN",{class:"se-placeholder"});return s.get("placeholder")&&(r.textContent=s.get("placeholder")),{bottomBar:At(s,null),wysiwygFrame:o,codeView:l,placeholder:r}}function Vt(t,e,i){let s=null,n=!1;if(t.get("codeMirror6Editor")){const o=t.get("codeMirror"),l=i.style.cssText,r=new o.EditorView({parent:i.parentElement,extensions:o.extensions,state:o.state});e.set("codeMirror6Editor",r),s=r.dom,s.style.cssText=l,n=!0}else if(t.get("codeMirror5Editor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},o.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=i.style.cssText,a=o.src.fromTextArea(i,l);e.set("codeMirror5Editor",a),s=a.display.wrapper,s.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),s?(gt.utils.removeItem(i),s.className+=" se-code-viewer-mirror",s):i}function Ot(t,e,i){const s=i.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!s.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function Rt(){const t=gt.utils.createElement("UL",{class:"se-menu-list"});return{div:gt.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function zt(t,e,i,s,n,o,l){n||(n="");const r=gt.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(s),c="se-toolbar-separator-vertical"===t?gt.utils.createElement("DIV",{class:t,tabindex:"-1"},null):gt.utils.createElement(h?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":i,"data-type":s,"aria-label":a.replace(/<span .+<\/span>/,""),tabindex:"-1"});return h||c.setAttribute("type","button"),/^default\./i.test(n)&&(n=l[n.replace(/^default\./i,"")]),/^text\./i.test(n)&&(n=n.replace(/^text\./i,""),c.className+=" se-btn-more-text"),o&&(c.disabled=!0),/^FIELD$/i.test(s)&>.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=gt.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function $t(t,e,i,s){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||i[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(s[e.title]||e.title)+"</span></span>",t.setAttribute("aria-label",e.title),e.type&&t.setAttribute("data-type",e.type),e.className&&(t.className+=" "+e.className),e.afterItem&&(gt.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),gt.utils.addClass(t,"se-side-btn-a"),gt.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(gt.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(gt.utils.addClass(t,"se-side-btn"),gt.utils.removeClass(t,"se-side-btn-a")):gt.utils.addClass(t,"se-side-btn-b"),gt.utils.addClass(e.beforeItem,"se-side-btn-before")),e.replaceButton&&(t.parentElement.appendChild(e.replaceButton),t.style.display="none"),!e.replaceButton&&/^INPUT$/i.test(t.getAttribute("data-type"))){const e=t.querySelector("input");e&&(gt.utils.addClass(e,"se-toolbar-btn"),e.setAttribute("data-command",t.getAttribute("data-command")),e.setAttribute("data-type",t.getAttribute("data-type")),t.hasAttribute("disabled")&&(e.disabled=!0))}}function Ft(t,e,i,s,n,o){t=JSON.parse(JSON.stringify(t));const l=function(t,e,i){const s=t.get("_rtl");return{bold:["",i.bold,"bold","",e.bold],underline:["",i.underline,"underline","",e.underline],italic:["",i.italic,"italic","",e.italic],strike:["",i.strike,"strike","",e.strike],subscript:["",i.subscript,"subscript","",e.subscript],superscript:["",i.superscript,"superscript","",e.superscript],removeFormat:["",i.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",i.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",i.indent,"indent","",s?e.outdent:e.indent],outdent:["se-icon-flip-rtl",i.outdent,"outdent","",s?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",i.fullScreen,"fullScreen","",e.expansion],showBlocks:["",i.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",i.codeView,"codeView","",e.code_view],undo:["se-component-enabled",i.undo,"undo","",e.undo],redo:["se-component-enabled",i.redo,"redo","",e.redo],preview:["se-component-enabled",i.preview,"preview","",e.preview],print:["se-component-enabled",i.print,"print","",e.print],copy:["",i.copy,"copy","",e.copy],dir:["",i[s?"dir_ltr":"dir_rtl"],"dir","",e[s?"dir_ltr":"dir_rtl"]],dir_ltr:["",i.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",i.dir_rtl,"dir_rtl","",e.dir_rtl],save:["se-component-enabled",i.save,"save","",e.save],newDocument:["se-component-enabled",i.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",i.selectAll,"selectAll","",e.select_all],pageBreak:["se-component-enabled",i.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",i.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",i.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}(i,s,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=gt.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=gt.utils.createElement("DIV",{class:"se-btn-tray"}),_=gt.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let i,b,y,v,C,w=0;w<t.length;w++)if(i=!1,C="",v=t[w],p=Rt(),"object"==typeof v){for(let f,_=0;_<v.length;_++){if(d=v[_],f=!1,u=e[d],/^%\d+/.test(d)&&0===_){v[0]=d.replace(/[^\d]/g,""),a.push(v),t.splice(w--,1);continue t}if("function"==typeof u)c=[u.className,u.title,d,u.type,u.innerHTML,u._disabled];else if("object"==typeof u){const t=u.constructor;c=[u.className||t.className,u.title||t.title,d,u.type||t.type,u.innerHTML||t.innerHTML,u._disabled||t._disabled]}else{if(/^-/.test(d)){C=d.substring(1),p.div.className+=" module-float-"+C;continue}if(/^#/.test(d)){"fix"===d.substring(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);y="__se__more_"+w;const e=t[1].trim(),i=t[2].trim();c=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,y,"MORE",i]}else if("|"===d)c=["se-toolbar-separator-vertical","","","separator",""];else{if("copy"===d&&!dt.isClipboardSupported){console.warn("[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered.");continue}c=l[d]}if(!c){if(!u)throw Error(`[SUNEDITOR.create.toolbar.fail] The button name of a plugin that does not exist. [${d}]`);u="object"==typeof u?u.constructor:u,c=[u.className,u.title,u.key,u.type,u.innerHTML,u._disabled]}}g=zt(c[0],c[1],c[2],c[3],c[4],c[5],s),(i?b:p.ul).appendChild(g.li),u&&(r[d]?r[d].push(g.button):r[d]=[g.button],o&&h.push({button:g.button,plugin:u,key:d})),f&&(i=!0,b=gt.utils.createElement("DIV"),b.className="se-more-layer "+y,b.setAttribute("data-ref",y),b.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(C?' style="float: '+C+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===v){const t=_.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(v)){const t=gt.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:gt.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=gt.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(i.get("shortcutsHint")?"":" se-shortcut-hide")},f);return i.get("toolbar_hide")&&(b.style.display="none"),{element:b,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const Pt=function(t,e){"object"!=typeof e&&(e={});const i={};if(e.plugins){const t=e.excludedPlugins||[],s=e.plugins,n=(Array.isArray(s)?s:Object.keys(s)).filter((e=>!t.includes(e))).map((t=>s[t]));for(let t,e=0,s=n.length;e<s;e++)t=n[e].default||n[e],i[t.key]=t}const s=Nt(e,t,i),n=s.o,o=s.i,l=s.l,r=gt.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=gt.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=gt.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=gt.utils.createElement("INPUT",{class:"__se__focus__temp__",style:"position: fixed !important; top: -10000px !important; left: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;"});c.tabIndex=0,a.appendChild(c);const d=gt.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=gt.utils.createElement("DIV",{class:"se-modal-back"}),p=gt.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=gt.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=gt.utils.createElement("DIV",{class:"se-modal-back"}),f=gt.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(gt.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const _=gt.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(_),Ht.body.appendChild(a);let b=null,y=null;const v=Ft(s.buttons,i,n,o,l,!1),C=v.element;C.style.visibility="hidden",/inline/i.test(n.get("mode"))?(C.className+=" se-toolbar-inline",C.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(C.className+=" se-toolbar-balloon",C.style.width=n.get("toolbar_width"),C.appendChild(gt.utils.createElement("DIV",{class:"se-arrow"}))),s.subButtons&&(y=Ft(s.subButtons,i,n,o,l,!1),b=y.element,b.style.visibility="hidden",b.className+=" se-toolbar-balloon se-toolbar-sub",b.style.width=n.get("toolbar.sub_width"),b.appendChild(gt.utils.createElement("DIV",{class:"se-arrow"})));const w=t[0].key||null,x=[],k=new Map,E=s.statusbarContainer;let S=null;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=s.frameMap.get(i.key),h=gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=gt.utils.createElement("DIV",{class:"se-container"}),d=gt.utils.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")});c.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=It(i.key,n,h,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const _=gt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),b=gt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(_),d.appendChild(b),m&&d.appendChild(m),c.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),c.appendChild(d),p&&(E?S||(E.appendChild(gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),S=p):c.appendChild(p)),c.appendChild(r.cloneNode(!0));const y=i.key||null,v=gt.utils.createElement("DIV",{class:"se-code-wrapper"},f);v.style.setProperty("display","none","important"),d.appendChild(v);const C=Vt(n,a,f);if(f===C){const t=gt.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);v.insertBefore(t,f)}else f=C;const w={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(w.inner=gt.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${a.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(w.page=gt.utils.createElement("DIV",{class:"se-document-page"},null),w.pageMirror=gt.utils.createElement("DIV",{class:"sun-editor-editable se-document-page-mirror-a4",style:"position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;"},null)),h.appendChild(c),x.push(y),k.set(y,wt({target:i.target,key:i.key,options:a},h,g,v,f,S||p,w,y))}const T=n.get("toolbar_container");if(T){const t=gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=gt.utils.createElement("DIV",{class:"se-container"});e.appendChild(C),b&&e.appendChild(b),t.appendChild(e),T.appendChild(t),T.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=k.get(w).get("container");t.insertBefore(C,t.firstElementChild),b&&t.insertBefore(b,t.firstElementChild)}return{context:kt(C,T,h,b,E),carrierWrapper:a,options:n,plugins:i,icons:o,lang:l,value:s.v,rootId:w,rootKeys:x,frameRoots:k,pluginCallButtons:v.pluginCallButtons,responsiveButtons:v.responsiveButtons,pluginCallButtons_sub:y?y.pluginCallButtons:[],responsiveButtons_sub:y?y.responsiveButtons:[]}},{NO_EVENT:Dt}=dt,qt={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};let Wt=null,Ut=null;const Gt=function(t,e){return Wt=this.eventManager.removeGlobalEvent("keydown",Wt),Ut=this.eventManager.removeGlobalEvent("mousedown",Ut),this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,gt.utils.removeClass(t,"se-copy-format-cursor"),gt.utils.removeClass(e,"on"),!0},Zt=function(t){const e=gt.check.isContentLess,i=gt.check.isTable;return{first:gt.query.getEdgeChild(gt.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||i(t)),!1)||t.firstChild,last:gt.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||i(t)),!0)||t.lastChild}},Yt=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],Xt=Yt.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);function jt(t,e){if("function"==typeof t._onCopyFormatInitMethod)return void t._onCopyFormatInitMethod();const i=t.frameContext.get("wysiwyg");t._onCopyFormatInfo=[...t.eventManager.__cacheStyleNodes],t._onCopyFormatInitMethod=Gt.bind(t,i,e),gt.utils.addClass(i,"se-copy-format-cursor"),gt.utils.addClass(e,"on"),Wt=t.eventManager.addGlobalEvent("keydown",(e=>{ft.isEsc(e.code)&&t._onCopyFormatInitMethod?.()})),Ut=t.eventManager.addGlobalEvent("mousedown",(s=>{i.contains(s.target)||s.target===e||t._onCopyFormatInitMethod?.()}))}function Kt(e){const i=e.frameRoots;let s,n,o,l,r=e.options.get("historyStackDelayTime"),a=null,h=!1,c=null;function d(t,i,s){s&&e.status.hasFocus&&e.eventManager.applyTagEffect(),e.history.resetButtons(t.get("key"),i),e.triggerEvent("onChange",{frameContext:t,data:t.get("wysiwyg").innerHTML}),"block"===e.context.get("toolbar.main").style.display?e.toolbar._showBalloon():e.isSubBalloon&&"block"===e.context.get("toolbar.sub.main").style.display&&e.subToolbar._showBalloon()}function u(t){const l=n[s],r=o[l],a=e.frameContext;s+=t;const h=t<0&&l!==n[s]&&r.index>0?l:n[s],c=o[h];c.index+=t;const u=c.value[c.index];i.get(h).get("wysiwyg").innerHTML=u.content,l!==h&&t<0&&1===s?s=0:l!==h&&t>0&&1===c.index?s++:(t<0&&c.index<1||t>0&&c.index>c.value.length)&&(s+=t);let p=h,g=u;if(t<0&&s>0&&0===c.index){const e=n[s+t];if(e!==h){const t=o[e];p=e,g=t.value[t.index]}}e.changeFrameContext(p),e.selection.setRange(X(g.s.path,g.frame),g.s.offset,X(g.e.path,g.frame),g.e.offset),e.focus(),s<0?s=0:s>=n.length&&(s=n.length-1),e.ui._offCurrentController(),e._checkComponents(!1),e.char.display(),e._resourcesStateChange(a),a.has("documentType-use-header")&&a.get("documentType").reHeader(),d(a,c.index,!0)}function p(t,e,l,r){let a,h;e?(a={path:Y(e.startContainer,null,null),offset:e.startOffset},h={path:Y(e.endContainer,null,null),offset:e.endOffset}):(a={path:[0,0],offset:[0,0]},h={path:0,offset:0}),s+=r,n[s]=l;const c=o[l];c.index+=r,c.value[c.index]={content:t,s:a,e:h,frame:i.get(l).get("wysiwyg")}}function g(t){o[t]={value:[],index:-1},l[t]=i.get(t).get("wysiwyg").innerHTML}function m(t,r){e._checkComponents(!1);const a=i.get(t),h=a.get("wysiwyg").innerHTML,c=o[t];!h||c.value[c.index]&&h===c.value[c.index].content||(n.length>s+1&&function(t){const i=[];for(let t=s+1,e=n.length;t<e;t++)i.includes(n[t])||i.push(n[t]);n=n.slice(0,s+1),t.value.splice(s+1),e.applyCommandTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=i.length;t<e;t++)n.includes(i[t])||g(i[t])}(c),0===c.value.length&&function(t){s++,n[s]=t;const e=o[t];e.index=0,e.value[0]={content:l[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:i.get(t).get("wysiwyg")}}(t),p(h,r,t,1),1===s&&e.applyCommandTargets("undo",(t=>{t.disabled=!1})),e.char.display(),d(a,c.index,!1))}return{push(s,n){if(h)return;n=n||e.status.rootKey;const o=e.status._range;t.setTimeout(e._resourcesStateChange.bind(e,i.get(n)),0);const l="number"==typeof s?s>0?s:0:s?r:0;l&&!a||(t.clearTimeout(a),l)?a=t.setTimeout((()=>{t.clearTimeout(a),a=null,m(n,o)}),l):m(n,o)},check(e,i){a&&(t.clearTimeout(a),a=null,m(e,i))},undo(){s>0&&u(-1)},redo(){n.length-1>s&&u(1)},overwrite(t){p(i.get(t||e.status.rootKey).get("wysiwyg").innerHTML,null,e.status.rootKey,0)},pause(){h=!0,c&&(t.clearTimeout(c),c=null),c=t.setTimeout((()=>{h=!1}),5e3)},resume(){c&&(t.clearTimeout(c),c=null),h=!1},reset(){e.applyCommandTargets("undo",(t=>t.disabled=!0)),e.applyCommandTargets("redo",(t=>t.disabled=!0)),e.applyCommandTargets("save",(t=>t.disabled=!0)),e.applyFrameRoots((t=>t.set("historyIndex",-1))),e.applyFrameRoots((t=>t.set("isChanged",!1))),s=-1,n=[],o={},l={},h=!1;const t=e.rootKeys;for(let e=0,i=t.length;e<i;e++)g(t[e])},resetButtons(t,i){const l=!mt.is(i),r=o[void 0===t?n[s]:t];i=l?r.index:i;const a=e.frameRoots.get(t),h=r.value.length-1;e.applyCommandTargets("undo",(t=>{t.disabled=!(i>0&&i<=h)})),e.applyCommandTargets("redo",(t=>{t.disabled=!(i>-1&&i<h)}));const c=a.get("savedIndex"),d=a.get("historyIndex"),u=c>-1?c!==i:l?r.index>0:i>0&&d!==i;a.set("historyIndex",i),a.set("isChanged",u),e.applyCommandTargets("save",(t=>{t.disabled=!u})),e.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>o,resetDelayTime(t){r=t},destroy(){a&&t.clearTimeout(a),s=n=o=l=null}}}function Jt(t){this.editor=t,this.eventManager=t.eventManager,this.history=t.history,this.events=t.events,this.triggerEvent=t.triggerEvent,this.carrierWrapper=t.carrierWrapper,this.plugins=t.plugins,this.status=t.status,this.context=t.context,this.options=t.options,this.icons=t.icons,this.lang=t.lang,this.frameRoots=t.frameRoots,this._w=t._w,this._d=t._d}const Qt=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),{isMobile:te}=dt;function ee(t){const e=gt.query.getEventTarget(t);let i=e;this.editor.isSubBalloon&&!this.context.get("toolbar.sub.main")?.contains(i)&&this._hideToolbar_sub();const s=gt.check.isInputElement(i);if(s?this.editor._preventBlur=!1:this.editor.frameContext.get("wysiwyg").contains(this.selection.getNode())||this.editor.focus(),gt.query.getParentElement(i,".se-dropdown"))t.stopPropagation(),this.editor._notHideToolbar=!0;else{let n=i.getAttribute("data-command"),o=i.className;for(;i&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)i=i.parentElement,n=i.getAttribute("data-command"),o=i.className;if(s&&/^INPUT$/i.test(i?.getAttribute("data-type"))){if(this.editor._preventBlur=this._inputFocus=!0,this.status.hasFocus||this.applyTagEffect(),!gt.check.isInputElement(e)||e.disabled)return;const t=this.plugins[n];if(!t)return;if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof t.onInputChange&&(this.__inputPlugin={obj:t,target:e,value:e.value}),this.__inputBlurEvent=this.addEvent(e,"blur",(i=>{if(!t.isInputActive)try{const s=e.value.trim();"function"==typeof t.onInputChange&&s!==this.__inputPlugin.value&&t.onInputChange({target:e,value:s,event:i})}finally{this._w.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.onInputKeyDown&&(this.__inputKeyEvent=this.addEvent(e,"keydown",(i=>{t.onInputKeyDown({target:e,event:i})})))}else{if(this.__inputBlurEvent&&this.__inputPlugin){const e=this.__inputPlugin.target.value.trim();return e!==this.__inputPlugin.value&&this.__inputPlugin.obj.onInputChange({target:this.__inputPlugin.target,value:e,event:t}),void this.__removeInput()}this.editor.frameContext.get("isCodeView")||(te?this.editor._preventBlur=!0:(t.preventDefault(),dt.isGecko&&n&&this._injectActiveEvent(i)))}n!==this.menu.currentDropdownName&&n!==this.menu.currentContainerName||t.stopPropagation()}}function ie(t){const e=gt.query.getEventTarget(t),i=gt.query.getCommandTarget(e);if(!i)return;let s=i,n="";for(;s&&!/se-menu-tray/.test(s.className)&&!n;)s=s.parentElement,n=s.getAttribute("data-key");if(!n)return;const o=this.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(i))}function se(t){const e=gt.query.getEventTarget(t);this.editor.runFromTarget(e)}const{_w:ne}=dt;let oe=null;function le(){this.editor.status._onMousedown=!1,oe=this.removeGlobalEvent(oe)}async function re(t,e){const i=gt.query.getEventTarget(e);this.editor.status._onMousedown=!0,oe&&le.call(this),oe=this.addGlobalEvent("mouseup",le.bind(this)),t.get("isReadOnly")||gt.check.isNonEditable(t.get("wysiwyg"))||(this.format._isExcludeSelectionElement(i)?e.preventDefault():(this._setSelectionSync(),this._w.setTimeout(this.selection._init.bind(this.selection),0),!1!==await this.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onMouseDown",{frameContext:t,event:e})&&(this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(i.nodeName)&&e.preventDefault())))}async function ae(t,e){!1!==await this.triggerEvent("onMouseUp",{frameContext:t,event:e})&&this._callPluginEvent("onMouseUp",{frameContext:t,event:e})}async function he(t,e){const i=gt.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),gt.check.isAnchor(i)&&ne.open(i.href,i.target),!1;if(gt.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===this._callPluginEvent("onClick",{frameContext:t,event:e}))return;const s=this.component.get(i);if(s)return e.preventDefault(),void this.component.select(s.target,s.pluginName);if(this.selection._init(),3===e.detail){let t=this.selection.getRange();this.format.isLine(t.endContainer)&&0===t.endOffset&&(t=this.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length),this.selection._rangeInfo(t,this.selection.get()))}const n=this.selection.getNode(),o=this.format.getLine(n,null),l=this.format.getBlock(n,null);if(!o&&!gt.check.isNonEditable(i)&&!gt.check.isList(l)){const t=this.selection.getRange();if(this.format.getLine(t.startContainer)===this.format.getLine(t.endContainer))if(gt.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,i=gt.utils.createElement("LI",null,n);l.insertBefore(i,t),this.editor.focus()}else gt.check.isWysiwygFrame(n)||this.component.is(n)||gt.check.isTableElements(n)&&!gt.check.isTableCell(n)||null===this._setDefaultLine(this.format.isBlock(l)?"DIV":this.options.get("defaultLine"))||(e.preventDefault(),this.editor.focus())}if(this.editor._onCopyFormatInfo)try{const t=[...this.editor._onCopyFormatInfo],e=t.pop();if(this.format.removeInlineElement(),e){const i=this.format.applyInlineElement(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:s,inner:n}=this.nodeTransform.createNestedNode(t);i.parentNode.insertBefore(s,i),n.appendChild(i),this.selection.setRange(i,gt.check.isZeroWidth(i)?1:0,i,1)}if(this.options.get("copyFormatKeepOn"))return;this.editor._onCopyFormatInitMethod()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.editor._onCopyFormatInitMethod?.()||(this.editor._onCopyFormatInfo=null,this.editor._onCopyFormatInitMethod=null)}(this.editor.isBalloon||this.editor.isSubBalloon)&&this._w.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function ce(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const i=gt.query.getEventTarget(e);!1!==Qt.get("__overInfo")&&this._overComponentSelect(i),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function de(t,e){!1!==await this.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&this._callPluginEvent("onMouseLeave",{frameContext:t,event:e})}const{_w:ue,isOSX_IOS:pe}=dt,ge=new RegExp(ut.zeroWidthSpace+"+",""),me={ctrl:!1,alt:!1};let fe=null;function _e(t){const e=t.lastChild,i=t.nextElementSibling;if(!i)return e;if(gt.check.isZeroWidth(i))return gt.utils.removeItem(i),e;const s=i.childNodes;for(;s[0];)t.appendChild(s[0]);return gt.utils.removeItem(i),e}function be(t){const e=t.childNodes,i=t.previousElementSibling;let s=e[0],n=0;if(!i)return{focusNode:s,focusOffset:n};if(gt.check.isZeroWidth(i))return gt.utils.removeItem(i),{focusNode:s,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)i.appendChild(e[0]);else s=i.lastChild,n=s.textContent.length;return gt.utils.removeItem(t),{focusNode:s,focusOffset:n}}async function ye(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const i=this.selection.getRange(),s=this.selection.getNode();if(!this.format.getLine(s,null)&&i.collapsed&&!this.component.is(s)&&!gt.check.isList(s)){const t=this.format.getBlock(s,null);this._setDefaultLine(this.format.isBlock(t)?"DIV":this.options.get("defaultLine"))}this.selection._init();const n=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this.char.test(n,!0))return e.preventDefault(),e.stopPropagation(),!1;!1!==await this.triggerEvent("onInput",{frameContext:t,event:e,data:n})&&!1!==this._callPluginEvent("onInput",{frameContext:t,event:e,data:n})&&this.history.push(!0)}async function ve(t,e){if(this.editor.selectMenuOn||!e.isTrusted)return;let i=this.selection.getNode();if(gt.check.isInputElement(i))return;if(this.menu.currentDropdownName)return;const s=e.code,n=ft.isShift(e),o=me.ctrl=ft.isCtrl(e),l=me.alt=ft.isAlt(e);if(this.isComposing=ft.isComposing(e),!o&&t.get("isReadOnly")&&!ft.isDirectionKey(s))return e.preventDefault(),!1;if(this.menu.dropdownOff(),this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),!1===await this.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;ft.isEnter(s)&&this.format.isLine(this.selection.getRange()?.startContainer)&&(this.selection._resetRangeToTextNode(),i=this.selection.getNode());const r=this.selection.getRange(),a=!r.collapsed||r.startContainer!==r.endContainer;let h=this.format.getLine(i,null)||i,c=this.format.getBlock(h,null);if(o&&!ft.isNonTextKey(s)&&this.shortcuts.command(e,o,n,s,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!ft.isNonTextKey(s)&&this.format.isLine(h)&&r.collapsed&>.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.shortcuts.command(e,!1,n,s,t,!0,h,r))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);if(!1===this._callPluginEvent("onKeyDown",{frameContext:t,event:e,range:r,line:h}))return;switch(s){case"Backspace":{if(this.component.deselect(),fe=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(!this.format.isLine(h)&&!t.get("wysiwyg").firstElementChild&&!this.component.is(i)&&null!==this._setDefaultLine(this.options.get("defaultLine")))return e.preventDefault(),e.stopPropagation(),!1;if(this.format.isLine(h)&&(!r.collapsed||gt.check.isEdgePoint(r.endContainer,r.endOffset,"front"))&&!r.endContainer.previousSibling&&this.format.isLine(h.previousElementSibling)){let t;if(e.preventDefault(),e.stopPropagation(),!r.collapsed){const e=this.html.remove();if(e.commonCon!==e.container&&h.parentElement)if(h.contains(r.startContainer))t=_e(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length);else{const t=be(h);this.selection.setRange(t.focusNode,t.focusOffset,t.focusNode,t.focusOffset)}return void this.history.push(!0)}const i=be(h);return this.selection.setRange(i.focusNode,i.focusOffset,i.focusNode,i.focusOffset),void this.history.push(!0)}if(!a&&!h.previousElementSibling&&0===r.startOffset&&!i.previousSibling&&!gt.check.isListCell(h)&&this.format.isLine(h)&&(!this.format.isBrLine(h)||this.format.isClosureBrLine(h))){if(this.format.isClosureBlock(h.parentNode))return e.preventDefault(),e.stopPropagation(),!1;if(gt.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||gt.check.isZeroWidth(h.textContent))){if(e.preventDefault(),e.stopPropagation(),h.nodeName.toUpperCase()===this.options.get("defaultLine").toUpperCase()){h.innerHTML="<br>";const t=h.attributes;for(;t[0];)h.removeAttribute(t[0].name)}else h.parentNode.replaceChild(gt.utils.createElement(this.options.get("defaultLine"),null,"<br>"),h);return this.editor._nativeFocus(),!1}}const s=r.startContainer;if(h&&!h.previousElementSibling&&0===r.startOffset&&3===s.nodeType&>.check.isZeroWidth(s)){let t=s.parentNode.previousSibling;const e=s.parentNode.nextSibling;t||(e?t=e:(t=gt.utils.createElement("BR"),h.appendChild(t)));let i=s;for(;h.contains(i)&&!i.previousSibling;)i=i.parentNode;if(!h.contains(i)){s.textContent="",this.nodeTransform.removeAllParents(s,null,h);break}}if(!a&&h&&(0===r.startOffset||i===h)){const t=i===h?this._isUneditableNode(r,!0):gt.check.isEdgePoint(r.startContainer,r.startOffset)?gt.query.getPreviousDeepestNode(r.startContainer):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!0)){e.preventDefault(),e.stopPropagation();break}!a&&this.format.isEdgeLine(r.startContainer,r.startOffset,"front")&&this.format.isLine(h.previousElementSibling)&&(this._formatAttrsTemp=h.previousElementSibling.attributes);const n=r.commonAncestorContainer;if(h=this.format.getLine(r.startContainer,null),c=this.format.getBlock(h,null),c&&h&&!gt.check.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){if(gt.check.isListCell(h)&>.check.isList(c)&&(gt.check.isListCell(c.parentElement)||h.previousElementSibling)&&(i===h||3===i.nodeType&&(!i.previousSibling||gt.check.isList(i.previousSibling)))&&(this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null)?c.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)e.preventDefault(),this.html.remove(),3===r.startContainer.nodeType&&this.selection.setRange(r.startContainer,r.startContainer.textContent.length,r.startContainer,r.startContainer.textContent.length),this.history.push(!0);else{let t=h.previousElementSibling||c.parentElement;if(gt.check.isListCell(t)){e.preventDefault();let i=t;if(!t.contains(h)&>.check.isListCell(i)&>.check.isList(i.lastElementChild)){for(i=i.lastElementChild.lastElementChild;gt.check.isListCell(i)&>.check.isList(i.lastElementChild);)i=i.lastElementChild&&i.lastElementChild.lastElementChild;t=i}let s=t===c.parentNode?c.previousSibling:t.lastChild;s||(s=gt.utils.createTextNode(ut.zeroWidthSpace),c.parentNode.insertBefore(s,c.parentNode.firstChild));const n=3===s.nodeType?s.textContent.length:1,o=h.childNodes;let l=s,r=o[0];for(;r=o[0];)t.insertBefore(r,l.nextSibling),l=r;gt.utils.removeItem(h),0===c.children.length&>.utils.removeItem(c),this.selection.setRange(s,n,s,n),this.history.push(!0)}}break}if(!a&&0===r.startOffset){let t=!0,i=n;for(;i&&i!==c&&!gt.check.isWysiwygFrame(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!gt.check.isZeroWidth(i.previousSibling.textContent.trim()))){t=!1;break}i=i.parentNode}if(t&&c.parentNode){e.preventDefault(),this.format.removeBlock(c,{selectedFormats:gt.check.isListCell(h)?[h]:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}),this.history.push(!0);break}}}if(!a&&h&&(0===r.startOffset||i===h&&h.childNodes[r.startOffset])){const t=i===h?h.childNodes[r.startOffset]:i,s=h.previousSibling,o=(3===n.nodeType||gt.check.isBreak(n))&&!n.previousSibling&&0===r.startOffset;if(t&&!t.previousSibling&&(n&&this.component.is(n.previousSibling)||o&&this.component.is(s))){const t=this.component.get(s);t?(e.preventDefault(),e.stopPropagation(),0===h.textContent.length&>.utils.removeItem(h),!1===this.component.select(t.target,t.pluginName)&&this.editor.blur()):this.component.is(s)&&(e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(s));break}if(t&>.check.isNonEditable(t.previousSibling)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t.previousSibling);break}}break}case"Delete":if(this.component.deselect(),fe=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(!a&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end")&&!h.nextSibling)return e.preventDefault(),void e.stopPropagation();if(this.format.isLine(h)&&(!r.collapsed||gt.check.isEdgePoint(r.startContainer,r.endOffset,"end"))&&!r.startContainer.nextSibling&&this.format.isLine(h.nextElementSibling)){let t;if(e.preventDefault(),e.stopPropagation(),!r.collapsed){const e=this.html.remove();if(e.commonCon!==e.container&&h.parentElement)if(h.contains(r.startContainer))t=_e(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length);else{const t=be(h);this.selection.setRange(t.focusNode,t.focusOffset,t.focusNode,t.focusOffset)}return void this.history.push(!0)}return _e(h),void this.history.push(!0)}if(!a&&h&&(r.endOffset===r.endContainer.textContent.length||i===h)){const t=i===h?this._isUneditableNode(r,!1):gt.check.isEdgePoint(r.endContainer,r.endOffset)?gt.query.getNextDeepestNode(r.endContainer,null):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),gt.check.isZeroWidth(h.textContent)&>.utils.removeItem(h),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!1)){e.preventDefault(),e.stopPropagation();break}if((this.format.isLine(i)||null===i.nextSibling||gt.check.isZeroWidth(i.nextSibling)&&null===i.nextSibling.nextSibling)&&r.startOffset===i.textContent.length){const t=h.nextElementSibling;if(!t)break;if(this.component.is(t)){if(e.preventDefault(),gt.check.isZeroWidth(h)&&(gt.utils.removeItem(h),gt.check.isTable(t))){let e=gt.query.getEdgeChild(t,gt.check.isTableCell,!1);e=e.firstElementChild||e,this.selection.setRange(e,0,e,0);break}const i=this.component.get(t);i?(e.stopPropagation(),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur()):this.component.is(t)&&(e.stopPropagation(),gt.utils.removeItem(t));break}}if(!a&&(gt.check.isEdgePoint(r.endContainer,r.endOffset)||i===h&&h.childNodes[r.startOffset])){const t=i===h&&h.childNodes[r.startOffset]||i;if(t&>.check.isNonEditable(t.nextSibling)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t.nextSibling);break}if(this.component.is(t)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t);break}}if(!a&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end")&&this.format.isLine(h.nextElementSibling)&&(this._formatAttrsTemp=h.attributes),h=this.format.getLine(r.startContainer,null),c=this.format.getBlock(h,null),gt.check.isListCell(h)&>.check.isList(c)&&(i===h||3===i.nodeType&&(!i.nextSibling||gt.check.isList(i.nextSibling))&&(this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null)?c.contains(r.endContainer):r.endOffset===i.textContent.length&&r.collapsed))){r.startContainer!==r.endContainer&&this.html.remove();const t=gt.utils.arrayFind(h.children,gt.check.isList)||h.nextElementSibling||c.parentElement.nextElementSibling;if(t&&(gt.check.isList(t)||gt.utils.arrayFind(t.children,gt.check.isList))){let i,s;if(e.preventDefault(),gt.check.isList(t)){const e=t.firstElementChild;for(s=e.childNodes,i=s[0];s[0];)h.insertBefore(s[0],t);gt.utils.removeItem(e)}else{for(i=t.firstChild,s=t.childNodes;s[0];)h.appendChild(s[0]);gt.utils.removeItem(t)}this.selection.setRange(i,0,i,0),this.history.push(!0)}break}break;case"Tab":{if(this.options.get("tabDisable"))break;if(e.preventDefault(),o||l||gt.check.isWysiwygFrame(i))break;const t=!r.collapsed||gt.check.isEdgePoint(r.startContainer,r.startOffset),s=this.format.getLines(null);i=this.selection.getNode();const a=[],c=[],d=gt.check.isListCell(s[0]),u=gt.check.isListCell(s[s.length-1]);let p={sc:r.startContainer,so:r.startOffset,ec:r.endContainer,eo:r.endOffset};for(let t,e=0,i=s.length;e<i;e++)if(t=s[e],gt.check.isListCell(t)){if(!t.previousElementSibling&&!n)continue;a.push(t)}else c.push(t);if(a.length>0&&t&&(p=this.format._applyNestedList(a,n)),c.length>0)if(n){const t=c.length-1;for(let e,i=0;i<=t;i++){e=c[i].childNodes;for(let t,i=0,s=e.length;i<s&&(t=e[i],t);i++)if(!gt.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?gt.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=gt.query.getEdgeChild(c[0],"text",!1),i=gt.query.getEdgeChild(c[t],"text",!0);!d&&e&&(p.sc=e,p.so=0),!u&&i&&(p.ec=i,p.eo=i.textContent.length)}else if(1===c.length){let t=this.status.tabSize+1;if(this.options.get("syncTabIndent")){const e=gt.query.findTextIndexOnLine(h,r.startContainer,r.startOffset,this.component.is.bind(this.component)),i=this.format.isLine(h.previousElementSibling)?gt.query.findTabEndIndex(h.previousElementSibling,e,2):0;i>e&&(t=i-e)}const e=gt.utils.createTextNode(new Array(t).join(" "));if(!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;d||(p.sc=e,p.so=e.length),u||(p.ec=e,p.eo=e.length)}else{const t=gt.utils.createTextNode(new Array(this.status.tabSize+1).join(" ")),e=c.length-1;for(let i,s=0;s<=e;s++)i=c[s].firstChild,i&&(gt.check.isBreak(i)?c[s].insertBefore(t.cloneNode(!1),i):i.textContent=t.textContent+i.textContent);const i=gt.query.getEdgeChild(c[0],"text",!1),s=gt.query.getEdgeChild(c[e],"text",!0);!d&&i&&(p.sc=i,p.so=0),!u&&s&&(p.ec=s,p.eo=s.textContent.length)}this.selection.setRange(p.sc,p.so,p.ec,p.eo),this.history.push(!1);break}case"Enter":{this.component.deselect();const s=this.format.getBrLine(i,null);if("byte-html"===this.editor.frameOptions.get("charCounter_type")){let t="";if(t=!n&&s||n?"<br>":"<"+h.nodeName+"><br></"+h.nodeName+">",!this.char.check(t))return e.preventDefault(),!1}if(!n){const n=!r.endContainer.nextSibling&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end"),o=!r.startContainer.previousSibling&&this.format.isEdgeLine(r.startContainer,r.startOffset,"front");if(n&&(/^H[1-6]$/i.test(h.nodeName)||/^HR$/i.test(h.nodeName))){this.__enterPrevent(e);const t=this.format.addLine(h,this.options.get("defaultLine")).firstChild;if(gt.check.isBreak(t)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t),this.selection.setRange(e,1,e,1)}else this.selection.setRange(t,0,t,0);this.__enterScrollTo(r);break}if(c&&h&&!gt.check.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){const t=this.selection.getRange();if(gt.check.isEdgePoint(t.endContainer,t.endOffset)&>.check.isList(i.nextSibling)){this.__enterPrevent(e);const t=gt.utils.createElement("BR"),s=gt.utils.createElement("LI",null,t);h.parentNode.insertBefore(s,h.nextElementSibling),s.appendChild(i.nextSibling),this.selection.setRange(t,1,t,1),this.__enterScrollTo(r);break}if((3!==t.commonAncestorContainer.nodeType||!t.commonAncestorContainer.nextElementSibling)&>.check.isZeroWidth(h.innerText.trim())&&!gt.check.isListCell(h.nextElementSibling)){this.__enterPrevent(e);let t=null;if(gt.check.isListCell(c.parentElement)){const e=h.parentNode.parentElement;c=e.parentElement;const i=gt.utils.createElement("LI");i.innerHTML="<br>",gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),t=i,c.insertBefore(t,e.nextElementSibling)}else{let e;e=gt.check.isTableCell(c.parentElement)?"DIV":gt.check.isList(c.parentElement)?"LI":this.format.isLine(c.nextElementSibling)?c.nextElementSibling.nodeName:this.format.isLine(c.previousElementSibling)?c.previousElementSibling.nodeName:this.options.get("defaultLine"),t=gt.utils.createElement(e);const i=this.format.removeBlock(c,{selectedFormats:[h],newBlockElement:null,shouldDelete:!0,skipHistory:!0});i.cc.insertBefore(t,i.ec)}t.innerHTML="<br>",this.nodeTransform.removeAllParents(h,null,null),this.selection.setRange(t,1,t,1);break}}if(s){this.__enterPrevent(e);const t=i===s,n=this.selection.get(),o=i.childNodes,l=n.focusOffset,a=i.previousElementSibling,h=i.nextSibling;if(!this.format.isClosureBrLine(s)&&o&&(t&&r.collapsed&&o.length-1<=l+1&>.check.isBreak(o[l])&&(!o[l+1]||(!o[l+2]||gt.check.isZeroWidth(o[l+2].textContent))&&3===o[l+1].nodeType&>.check.isZeroWidth(o[l+1].textContent))&&l>0&>.check.isBreak(o[l-1])||!t&>.check.isZeroWidth(i.textContent)&>.check.isBreak(a)&&(gt.check.isBreak(a.previousSibling)||!gt.check.isZeroWidth(a.previousSibling?.textContent))&&(!h||!gt.check.isBreak(h)&>.check.isZeroWidth(h.textContent)))){t?gt.utils.removeItem(o[l-1]):gt.utils.removeItem(i);const e=s.nextElementSibling,n=this.format.addLine(s,this.format.isLine(e)?e:null);gt.utils.copyFormatAttributes(n,s),this.selection.setRange(n,1,n,1),this.__enterScrollTo(r);break}if(t){this.html.insert(r.collapsed&>.check.isBreak(r.startContainer.childNodes[r.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let t=n.focusNode;const e=n.focusOffset;s===t&&(t=t.childNodes[e-l>1?e-1:e]),this.selection.setRange(t,1,t,1)}else{const t=n.focusNode.nextSibling,e=gt.utils.createElement("BR");this.html.insertNode(e,{afterNode:null,skipCharCount:!0});const i=e.previousSibling,s=e.nextSibling;gt.check.isBreak(t)||gt.check.isBreak(i)||s&&!gt.check.isZeroWidth(s)?this.selection.setRange(s,0,s,0):(e.parentNode.insertBefore(e.cloneNode(!1),e),this.selection.setRange(e,1,e,1))}this._onShortcutKey=!0,this.__enterScrollTo(r);break}if(r.collapsed&&(o||n)){this.__enterPrevent(e);const t=gt.utils.createElement("BR"),s=gt.utils.createElement(h.nodeName,null,t);gt.utils.copyTagAttributes(s,h,this.options.get("lineAttrReset"));let l=t;do{if(!gt.check.isBreak(i)&&1===i.nodeType){const t=i.cloneNode(!1);t.appendChild(l),l=t}i=i.parentElement}while(h!==i&&h.contains(i));if(s.appendChild(l),h.parentNode.insertBefore(s,o&&!n?h:h.nextElementSibling),n)this.selection.setRange(t,1,t,1);else{const t=h.firstChild||h;this.selection.setRange(t,0,t,0)}this.__enterScrollTo(r);break}if(h){let i;e.stopPropagation();let s=0;if(r.collapsed)i=gt.check.isZeroWidth(h)?this.format.addLine(h,h.cloneNode(!1)):this.nodeTransform.split(r.endContainer,r.endOffset,gt.query.getNodeDepth(h));else{const l=this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null),a=h.cloneNode(!1);a.innerHTML="<br>";const c=r.commonAncestorContainer,d=c===r.startContainer&&c===r.endContainer&>.check.isZeroWidth(c)?{container:c,offset:r.endOffset,prevContainer:c.previousElementSibling,commonCon:c}:this.html.remove();if(i=this.format.getLine(d.container,null),!i){gt.check.isWysiwygFrame(d.container)&&(this.__enterPrevent(e),t.get("wysiwyg").appendChild(a),i=a,gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s)),this.__enterScrollTo(r);break}const u=this.format.getBlock(d.container);if(i=i.contains(u)?gt.query.getEdgeChild(u,this.format.getLine.bind(this.format),!1):i,l){if(n&&!o)i.parentNode.insertBefore(a,d.prevContainer&&d.container!==d.prevContainer?i:i.nextElementSibling),i=a,s=0;else if(s=d.offset,o){const t=i.parentNode.insertBefore(a,i);n&&(i=t,s=0)}}else n&&o?(i.parentNode.insertBefore(a,d.prevContainer&&d.container===d.prevContainer?i.nextElementSibling:i),i=a,s=0):n?(i=i.parentNode.insertBefore(a,i.nextElementSibling),i=a,s=0):i=this.nodeTransform.split(d.container,d.offset,gt.query.getNodeDepth(h))}this.__enterPrevent(e),gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s),this.__enterScrollTo(r);break}}if(a){this.__enterScrollTo(r);break}c&>.query.getParentElement(c,"FIGCAPTION")&>.query.getParentElement(c,gt.check.isList)&&(this.__enterPrevent(e),h=this.format.addLine(h,null),this.selection.setRange(h,0,h,0),this.__enterScrollTo(r));break}}if(n&&(pe?l:o)&&ft.isSpace(s)){e.preventDefault(),e.stopPropagation();const t=this.html.insertNode(gt.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});if(t)return void this.selection.setRange(t,t.length,t,t.length)}if(!o&&!l&&!a&&!ft.isNonTextKey(s)&>.check.isBreak(r.commonAncestorContainer)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.selection.setRange(t,1,t,1)}if(t.has("documentType-use-header")&&!r.collapsed&&!o&&!l&&!n&&!ft.isDirectionKey(s))return void ue.setTimeout((()=>{t.get("documentType").reHeader()}),0);let d=null;switch(s){case"ArrowUp":this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling));break;case"ArrowLeft":if(gt.check.isEdgePoint(i,r.startOffset,"front")){const t=i.previousElementSibling||gt.query.getPreviousDeepestNode(i);t?this.component.is(t)&&(d=this.component.get(t)):this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling))}break;case"ArrowDown":this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling));break;case"ArrowRight":if(gt.check.isEdgePoint(i,r.endOffset,"end")){const t=i.nextElementSibling||gt.query.getNextDeepestNode(i);t?this.component.is(t)&&(d=this.component.get(t)):this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling))}}d&&!d.options?.isInputComponent&&(e.preventDefault(),!1===this.component.select(d.target,d.pluginName)&&this.editor.blur())}async function Ce(t,e){if(this._onShortcutKey||this.menu.currentDropdownName)return;const i=e.code,s=ft.isCtrl(e),n=ft.isAlt(e);if(s&&(me.ctrl=!1),n&&(me.alt=!1),t.get("isReadOnly"))return;const o=this.selection.getRange();let l=this.selection.getNode();if((this.editor.isBalloon||this.editor.isSubBalloon)&&((this.editor.isBalloonAlways||this.editor.isSubBalloonAlways)&&!ft.isEsc(i)||!o.collapsed)){if(!this.editor.isBalloonAlways&&!this.editor.isSubBalloonAlways)return void(this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon());ft.isEsc(i)||this._showToolbarBalloonDelay()}if(ft.isBackspace(i)&>.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const s=gt.utils.createElement(this.format.isLine(this.status.currentNodes[0])&&!gt.check.isListCell(this.status.currentNodes[0])?this.status.currentNodes[0]:this.options.get("defaultLine"),null,"<br>");return l.appendChild(s),this.selection.setRange(s,0,s,0),this.applyTagEffect(),this.history.push(!1),void(t.has("documentType-use-header")&&ft.isDocumentTypeObserverKey(i)&&t.get("documentType").reHeader())}const r=this.format.getLine(l,null),a=this.format.getBlock(l,null),h=this._formatAttrsTemp;if(r&&h){for(let t=0,e=h.length;t<e;t++)ft.isEnter(i)&&/^id$/i.test(h[t].name)?r.removeAttribute("id"):r.setAttribute(h[t].name,h[t].value);this._formatAttrsTemp=null}r||!o.collapsed||this.component.is(l)||gt.check.isList(l)||null===this._setDefaultLine(this.format.isBlock(a)?"DIV":this.options.get("defaultLine"))||(l=this.selection.getNode());if(!me.ctrl&&!me.alt&&!ft.isNonTextKey(i)&&3===l.nodeType&&ut.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const i=(l.textContent.substring(0,e).match(ge)||"").length;t=o.startOffset-i,e=o.endOffset-i,l.textContent=l.textContent.replace(ut.zeroWidthRegExp,""),this.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(ft.isRemoveKey(i)&>.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling){const t=this.options.get("retainStyleMode");"none"!==t&&fe?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=ue.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=ue.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,fe)):(this.__retainTimer=null,this._retainStyleNodes(r,fe)):this._clearRetainStyleNodes(r)}if(this.char.test("",!1),t.has("documentType-use-header"))if(ft.isDocumentTypeObserverKey(i)){t.get("documentType").reHeader();const e=gt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}else{const e=gt.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&ft.isHistoryRelevantKey(i)&&this.history.push(!0)}function we(t,e){const i=e.clipboardData;return!i||this._dataTransferAction("paste",e,i,t)}async function xe(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString()}async function ke(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString(),this._w.setTimeout((()=>{this.history.push(!1)}),0)}function Ee(t,e,i,s,n){const{sc:o,so:l,ec:r,eo:a}=this.selection.getDragEventLocationRange(n);if(!o)return;n.preventDefault();const h=t.get("_wd").createRange();h.setStart(o,l),h.setEnd(r,a);const c={y:0,x:0};if(i){const t=this.offset.getGlobal(i),e=s?this.context.get("toolbar.main").offsetHeight:0;c.y=t.top+e-this._w.scrollY,c.x=t.left-this._w.scrollX}const d=h.getBoundingClientRect();if(d.height>0){const i=t.get("wysiwygFrame");let s=0,n=0;/^iframe$/i.test(i.nodeName)&&(s=i.offsetLeft,n=i.offsetTop),e.style.left=`${d.right+this._w.scrollX+c.x+s}px`,e.style.top=`${d.top+this._w.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function Se(t){t.style.display="none"}function Te(t,e,i){try{if(t.get("isReadOnly"))return i.preventDefault(),i.stopPropagation(),!1;const e=i.dataTransfer;if(!e)return!0;const{sc:s,so:n,ec:o,eo:l}=this.selection.getDragEventLocationRange(i);if(!s)return;if(gt.query.getParentElement(s,".se-disable-pointer"))return void i.preventDefault();if(Qt.get("__dragContainer")){if(i.preventDefault(),Qt.get("__dragContainer").contains(i.target))return void this.component.deselect();const e=Qt.get("__dragContainer");return this.component.deselect(),this.selection.setRange(s,n,o,l),this.html.insertNode(e,{afterNode:null,skipCharCount:!0}),void(t.has("documentType-use-page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}return this.html.remove(),this.selection.setRange(s,n,o,l),this._dataTransferAction("drop",i,e,t)}finally{e.style.display="none"}}const{_w:He,ON_OVER_COMPONENT:Le,isMobile:Me}=dt;function Ne(t){Jt.call(this,t),this.isComposing=!1,this._events=[],this._onButtonsCheck=new RegExp(`^(${Object.keys(t.options.get("_defaultStyleTagMap")).join("|")})$`,"i"),this._onShortcutKey=!1,this._balloonDelay=null,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__resize_editor=null,this.__close_move=null,this.__geckoActiveEvent=null,this.__scrollparents=[],this.__cacheStyleNodes=[],this.__selectionSyncEvent=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=this.carrierWrapper.querySelector(".__se__focus__temp__"),this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null}function Ae(t,e,i){this._moveContainer(e),this._scrollContainer(),this._callPluginEvent("onScroll",{frameContext:t,event:i}),t.has("documentType-use-page")&&t.get("documentType").scrollPage(),this.triggerEvent("onScroll",{frameContext:t,event:i})}function Be(t,e){if(this.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.status.hasFocus=!0,this.component.__prevent=!1,this.triggerEvent("onNativeFocus",{frameContext:t,event:e});const i=t.get("key");if(this._inputFocus)return void(this.editor.isInline&&this._w.setTimeout((()=>{this.toolbar._showInline()}),0));if(this.status.rootKey===i&&this.editor._preventBlur||this.editor._preventFocus)return;this.editor._preventFocus=!0;const s=this.editor.status.onSelected||this.editor.opendModal;this.ui._offCurrentController(),gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,!1),this.editor.changeFrameContext(i),this.history.resetButtons(i,null),s||this.applyTagEffect(),this._w.setTimeout((()=>{this.__postFocusEvent(t,e)}),0)}function Ie(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.status.hasFocus=!1,this.editor.effectNode=null,this.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.editor._preventBlur||(this.editor._preventFocus=!1,this._setKeyEffect([]),this.status.currentNodes=[],this.status.currentNodesMap=[],this.editor.applyFrameRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.history.check(t.get("key"),this.status._range),this.__postBlurEvent(t,e)))}function Ve(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.ui.enableBackWrapper("ns-resize"),this.__resize_editor=this.addGlobalEvent("mousemove",Oe.bind(this)),this.__close_move=this.addGlobalEvent("mouseup",Re.bind(this))}function Oe(t){const e=this.editor.frameContext,i=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),s=i<e.get("_minHeight")?e.get("_minHeight"):i;e.get("wysiwygFrame").style.height=e.get("code").style.height=s+"px",this._resizeClientY=t.clientY,dt.isResizeObserverSupported||this.editor.__callResizeFunction(e,s,null)}function Re(){this.ui.disableBackWrapper(),this.__resize_editor&&(this.__resize_editor=this.removeGlobalEvent(this.__resize_editor)),this.__close_move&&(this.__close_move=this.removeGlobalEvent(this.__close_move))}function ze(t,e){e.preventDefault();const i=this._lineBreakComp;if(!i)return;const s=gt.check.isListCell(i.parentElement),n=gt.utils.createElement(s?"BR":gt.check.isTableCell(i.parentElement)?"DIV":this.options.get("defaultLine"));if(s||(n.innerHTML="<br>"),"byte-html"!==this.editor.frameOptions.get("charCounter_type")||this.char.check(n.outerHTML)){i.parentNode.insertBefore(n,"t"===t?i:i.nextSibling),this.component.deselect();try{const t=s?n:n.firstChild;this.selection.setRange(t,1,t,1),this.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}function $e(){Me?this._scrollContainer():this.ui._offCurrentController(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this._resetFrameStatus()}function Fe(){this.options.get("toolbar_sticky")>-1&&this.toolbar._resetSticky(),this.editor.isBalloon&&"block"===this.context.get("toolbar.main").style.display?this.toolbar._setBalloonOffset("top"===this.toolbar._balloonOffset.position):this.editor.isSubBalloon&&"block"===this.context.get("toolbar.sub.main").style.display&&this.subToolbar._setBalloonOffset("top"===this.subToolbar._balloonOffset.position),this._scrollContainer(),this.editor.frameContext.has("documentType-use-page")&&this.editor.frameContext.get("documentType").scrollWindow()}function Pe(){this.options.get("toolbar_sticky")>-1&&(this.toolbar._resetSticky(),this.editor.menu._restoreMenuPosition())}function De(t){if(this.editor._preventSelection)return;let e=t.getSelection().anchorNode;this.editor.applyFrameRoots((t=>{if(e&&t.get("wysiwyg").contains(e)){if(t.get("isReadOnly")||t.get("isDisabled"))return;if(e=null,this.selection._init(),this.applyTagEffect(),t.has("documentType-use-header")){const e=gt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}}}))}function qe(){this._scrollContainer()}function We(t){this.editor.changeFrameContext(t.get("key")),gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,!0)}Ne.prototype={addEvent(t,e,i,s){if(!t)return null;if((!mt.is(t.length)||t.nodeName||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return null;const n=t.length;for(let o=0;o<n;o++)t[o].addEventListener(e,i,s),this._events.push({target:t[o],type:e,listener:i,useCapture:s});return{target:n>1?t:t[0],type:e,listener:i,useCapture:s}},removeEvent(t){if(!t)return;let e=t.target;const i=t.type,s=t.listener,n=t.useCapture;if(e&&((!mt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(i,s,n);return null}},addGlobalEvent(t,e,i){return this.editor.frameOptions.get("iframe")&&this.editor.frameContext.get("_ww").addEventListener(t,e,i),this._w.addEventListener(t,e,i),{type:t,listener:e,useCapture:i}},removeGlobalEvent(t,e,i){if(t)return"object"==typeof t&&(e=t.listener,i=t.useCapture,t=t.type),this.editor.frameOptions.get("iframe")&&this.editor.frameContext.get("_ww").removeEventListener(t,e,i),this._w.removeEventListener(t,e,i),null},applyTagEffect(t){if((t=t||this.selection.getNode())===this.editor.effectNode)return;this.editor.effectNode=t;const e=this.options.get("_rtl")?"marginRight":"marginLeft",i=this.plugins,s=this.editor.commandTargets,n=this._onButtonsCheck,o=this.options.get("_styleCommandMap"),l=[],r=[],a=this.options.get("_textStyleTags"),h=[],c=[],d=this.editor.activeCommands,u=d.length;let p="";if(this.component.is(t)&&!this.component.__selectionSelected){const e=this.component.get(t);if(!e)return;return void this.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.editor.frameContext,m=!g.get("isReadOnly");for(let g=t;!gt.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!gt.check.isBreak(g)){if(this._isNonFocusNode(g))return void this.editor.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.format.isLine(p)&&h.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!c.includes(t)&&s.get(t)&&s.get(t).filter((e=>{const s=i[t]?.active(g,e);return void 0===s&&c.push(t),s})).length>0&&l.push(t);if(this.format.isLine(g)){if(!l.includes("outdent")&&s.has("outdent")&&(gt.check.isListCell(g)||g.style[e]&&mt.get(g.style[e],0)>0)&&s.get("outdent").filter((t=>!gt.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&s.has("indent")){const t=gt.check.isListCell(g)&&!g.previousElementSibling;s.get("indent").filter((e=>!gt.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),gt.utils.addClass(s.get(p),"active"))}return this._setKeyEffect(l),this.__cacheStyleNodes=h.reverse(),this.status.currentNodes=r.reverse(),this.status.currentNodesMap=l,this.editor.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.options.get("_rtl")?this.status.currentNodes.reverse().join(" < "):this.status.currentNodes.join(" > ")),t},_injectActiveEvent(t){gt.utils.addClass(t,"__se__active"),this.__geckoActiveEvent=this.addGlobalEvent("mouseup",(()=>{gt.utils.removeClass(t,"__se__active"),this.__geckoActiveEvent=this.removeGlobalEvent(this.__geckoActiveEvent)}))},_setKeyEffect(t){const e=this.editor.activeCommands,i=this.editor.commandTargets,s=this.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=i.get(n))){l=s[n];for(let t,e=0,i=o.length;e<i;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?gt.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?gt.check.isImportantDisabled(t)||(t.disabled=!1):gt.utils.removeClass(t,"active"))}},_showToolbarBalloonDelay(){this._balloonDelay&&He.clearTimeout(this._balloonDelay),this._balloonDelay=He.setTimeout((()=>{He.clearTimeout(this._balloonDelay),this._balloonDelay=null,this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon()}),250)},_toggleToolbarBalloon(){this.selection._init();const t=this.selection.getRange(),e=this.options.has("_subMode");!(e?this.editor.isSubBalloonAlways:this.editor.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.subToolbar._showBalloon(t):this.toolbar._showBalloon(t)},_hideToolbar(){this.editor._notHideToolbar||this.editor.frameContext.get("isFullScreen")||this.toolbar.hide()},_hideToolbar_sub(){this.subToolbar&&!this.editor._notHideToolbar&&this.subToolbar.hide()},_isNonFocusNode:t=>gt.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus"),_isUneditableNode(t,e){const i=e?t.startContainer:t.endContainer,s=e?t.startOffset:t.endOffset,n=e?"previousSibling":"nextSibling";let o;return 1===i.nodeType?(o=this._isUneditableNode_getSibling(i.childNodes[s],n,i),o&&1===o.nodeType&&"false"===o.getAttribute("contenteditable")?o:null):(o=this._isUneditableNode_getSibling(i,n,i),gt.check.isEdgePoint(i,s,e?"front":"end")&&o&&1===o.nodeType&&"false"===o.getAttribute("contenteditable")?o:null)},_isUneditableNode_getSibling(t,e,i){if(!t)return null;let s=t[e];if(!s){if(s=this.format.getLine(i),s=s?s[e]:null,!s||this.component.is(s))return null;s="previousSibling"===e?s.firstChild:s.lastChild}return s},_hardDelete(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=this.format.getBlock(e),n=this.format.getBlock(i),o=gt.check.isTableCell(s),l=gt.check.isTableCell(n);if((o&&!s.previousElementSibling&&!s.parentElement.previousElementSibling||l&&!n.nextElementSibling&&!n.parentElement.nextElementSibling)&&s!==n){const e=gt.query.getParentElement(t.commonAncestorContainer,gt.check.isFigure)?.parentElement||t.commonAncestorContainer;if(o){if(l)return gt.utils.removeItem(gt.query.getParentElement(s,(t=>e===t.parentNode))),this.editor._nativeFocus(),!0;gt.utils.removeItem(gt.query.getParentElement(s,(t=>e===t.parentNode)))}else gt.utils.removeItem(gt.query.getParentElement(n,(t=>e===t.parentNode)))}const r=1===e.nodeType?gt.query.getParentElement(e,".se-component"):null,a=1===i.nodeType?gt.query.getParentElement(i,".se-component"):null;return r&>.utils.removeItem(r),a&>.utils.removeItem(a),!1},_setDefaultLine(t){if(!this.options.get("__lineFormatFilter"))return null;if(this.editor._fileManager.pluginRegExp.test(this.editor.currentControllerName))return;const e=this.selection.getRange(),i=e.commonAncestorContainer,s=e.startContainer,n=this.format.getBlock(i,null);let o,l,r;if(n)return r=gt.utils.createElement(t||this.options.get("defaultLine")),r.innerHTML=n.innerHTML,0===r.childNodes.length&&(r.innerHTML=ut.zeroWidthSpace),n.innerHTML=r.outerHTML,r=n.firstChild,o=gt.query.getEdgeChildNodes(r,null).sc,o||(o=gt.utils.createTextNode(ut.zeroWidthSpace),r.insertBefore(o,r.firstChild)),l=o.textContent.length,void this.selection.setRange(o,l,o,l);if(3===i.nodeType&&this.component.is(i.parentElement)){const t=this.component.get(i.parentElement);if(!t)return;const e=t.container;if(i.parentElement===e){const t=i.nextElementSibling?e:e.nextElementSibling,s=gt.utils.createElement(this.options.get("defaultLine"),null,i);return e.parentElement.insertBefore(s,t),void this.editor.focusEdge(s)}return this.component.select(t.target,t.pluginName),null}if(1===i.nodeType&&"true"===i.getAttribute("data-se-embed")){let t=i.nextElementSibling;return this.format.isLine(t)||(t=this.format.addLine(i,this.options.get("defaultLine"))),void this.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.format.isBlock(s)&&!gt.check.isWysiwygFrame(s)||!this.component.is(s.children[e.startOffset])&&!this.component.is(s.children[e.startOffset-1])){if(gt.query.getParentElement(i,gt.check.isExcludeFormat))return null;if(this.format.isBlock(i)&&i.childNodes.length<=1){let t=null;return 1===i.childNodes.length&>.check.isBreak(i.firstChild)?t=i.firstChild:(t=gt.utils.createTextNode(ut.zeroWidthSpace),i.appendChild(t)),void this.selection.setRange(t,1,t,1)}try{if(3===i.nodeType&&(r=gt.utils.createElement(t||this.options.get("defaultLine")),i.parentNode.insertBefore(r,i),r.appendChild(i)),gt.check.isBreak(r.nextSibling)&>.utils.removeItem(r.nextSibling),gt.check.isBreak(r.previousSibling)&>.utils.removeItem(r.previousSibling),gt.check.isBreak(o)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}}catch(e){return this.editor.execCommand("formatBlock",!1,t||this.options.get("defaultLine")),this.selection.removeRange(),this.selection._init(),void(this.editor.effectNode=null)}if(r&&(gt.check.isBreak(r.nextSibling)&>.utils.removeItem(r.nextSibling),gt.check.isBreak(r.previousSibling)&>.utils.removeItem(r.previousSibling),gt.check.isBreak(o))){const t=gt.utils.createTextNode(ut.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}this.editor.effectNode=null,s?this.selection.setRange(s,1,s,1):this.editor._nativeFocus()}},async _dataTransferAction(t,e,i,s){try{return this.ui.showLoading(),await this._setClipboardData(t,e,i,s),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.ui.hideLoading()}},async _setClipboardData(t,e,i,s){e.preventDefault(),e.stopPropagation();let n=i.getData("text/plain"),o=i.getData("text/html");const l=!o,r=this.__secopy===n,a=/class=["']*Mso(Normal|List)/i.test(o)||/content=["']*Word.Document/i.test(o)||/content=["']*OneNote.File/i.test(o)||/content=["']*Excel.Sheet/i.test(o),h=r?"SE":a?"MS":"";if(l?o=pt.htmlToEntity(n).replace(/\n/g,"<br>"):(o=o.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),a&&(o=o.replace(/\n/g," "),n=n.replace(/\n/g," "))),!r){if(this.options.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");gt.query.getListChildNodes(t.body,pt.textToAnchor),o=t.body.innerHTML}}l||(o=this.html.clean(o,{forceFormat:!1,whitelist:null,blacklist:null}));const c=this.char.test("byte-html"===this.editor.frameOptions.get("charCounter_type")?o:n,!1);if("paste"===t){const t=await this.triggerEvent("onPaste",{frameContext:s,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}if("drop"===t){const t=await this.triggerEvent("onDrop",{frameContext:s,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}const d=i.files;if(d.length>0&&!a){for(let t=0,i=d.length;t<i;t++)this._callPluginEvent("onFilePasteAndDrop",{frameContext:s,event:e,file:d[t]});return!1}if(!c)return!1;if(o){const t=(new DOMParser).parseFromString(o,"text/html");return!0!==this._callPluginEvent("onPaste",{frameContext:s,event:e,data:o,doc:t})&&this.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),s.has("documentType-use-header")&&s.get("documentType").reHeader(),!1}},_addCommonEvents(){const t=ee.bind(this),e=se.bind(this);this.addEvent(this.context.get("menuTray"),"mousedown",t,!1),this.addEvent(this.context.get("menuTray"),"click",ie.bind(this),!0),this.addEvent(this.context.get("toolbar.main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar.main"),"click",e,!1),this.options.has("_subMode")&&(this.addEvent(this.context.get("toolbar.sub.main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar.sub.main"),"click",e,!1)),this.toolbar._setResponsive(),dt.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{He.setTimeout((()=>{this.toolbar.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{He.setTimeout((()=>{t.forEach((t=>{this.editor.__callResizeFunction(this.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.options.get("closeModalOutsideClick")&&this.addEvent(this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.ui._offCurrentModal()}),!1),this.addEvent(He,"resize",$e.bind(this),!1),this.addEvent(He,"scroll",Fe.bind(this),!1),dt.isMobile&&(this.addEvent(He.visualViewport,"resize",Pe.bind(this),!1),this.addEvent(He.visualViewport,"scroll",Pe.bind(this),!1))},_addFrameEvents(t){const e=t.get("options").get("iframe"),i=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",i);const s=t.get("code"),n=this.editor.carrierWrapper.querySelector(".se-drag-cursor"),o=ce.bind(this,t);this.addEvent(i,"mousemove",o,!1),this.addEvent(i,"mouseleave",de.bind(this,t),!1),this.addEvent(i,"mousedown",re.bind(this,t),!1),this.addEvent(i,"mouseup",ae.bind(this,t),!1),this.addEvent(i,"click",he.bind(this,t),!1),this.addEvent(i,"input",ye.bind(this,t),!1),this.addEvent(i,"keydown",ve.bind(this,t),!1),this.addEvent(i,"keyup",Ce.bind(this,t),!1),this.addEvent(i,"paste",we.bind(this,t),!1),this.addEvent(i,"copy",xe.bind(this,t),!1),this.addEvent(i,"cut",ke.bind(this,t),!1),this.addEvent(i,"dragover",Ee.bind(this,t,n,e?this.editor.frameContext.get("topArea"):null,!this.options.get("toolbar_container")&&!this.editor.isBalloon&&!this.editor.isInline),!1),this.addEvent(i,"dragend",Se.bind(this,n),!1),this.addEvent(i,"drop",Te.bind(this,t,n),!1),this.addEvent(i,"scroll",Ae.bind(this,t,i),{passive:!0,capture:!1}),this.addEvent(i,"focus",Be.bind(this,t),!1),this.addEvent(i,"blur",Ie.bind(this,t),!1),this.addEvent(s,"mousedown",We.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");this.addEvent(l,"wheel",(t=>{t.preventDefault(),this.component.deselect()}),!1);const r=Me?"touchstart":"mousedown";if(this.addEvent(t.get("lineBreaker_t"),r,ze.bind(this,"t"),!1),this.addEvent(t.get("lineBreaker_b"),r,ze.bind(this,"b"),!1),Me&&this.addEvent(i,"touchstart",o,{passive:!0,capture:!1}),!this.options.get("hasCodeMirror")){const e=t.get("codeNumbers"),i=this.viewer._codeViewAutoHeight.bind(this.viewer,t.get("code"),e,"auto"===this.editor.frameOptions.get("height"));this.addEvent(s,"keydown",i,!1),this.addEvent(s,"keyup",i,!1),this.addEvent(s,"paste",i,!1),e&&this.addEvent(s,"scroll",this.viewer._scrollLineNumbers.bind(s,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const a=qe.bind(this);let h=t.get("originElement");for(;h=gt.query.getScrollParent(h.parentElement);)this.__scrollparents.push(h),this.addEvent(h,"scroll",a,!1);this.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.addEvent(this.__eventDoc,"selectionchange",De.bind(this,this.__eventDoc),!1))},__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.addEvent(t.get("statusbar"),"mousedown",Ve.bind(this),!1)):gt.utils.addClass(t.get("statusbar"),"se-resizing-none")},_removeAllEvents(){for(let t,e=0,i=this._events.length;e<i;e++)t=this._events[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this._events=[],this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null)},_moveContainer(t){const e=t.scrollTop||0,i=t.scrollLeft||0;if(this.editor.isBalloon?(this.context.get("toolbar.main").style.top=this.toolbar._balloonOffset.top-e+"px",this.context.get("toolbar.main").style.left=this.toolbar._balloonOffset.left-i+"px"):this.editor.isSubBalloon&&(this.context.get("toolbar.sub.main").style.top=this.subToolbar._balloonOffset.top-e+"px",this.context.get("toolbar.sub.main").style.left=this.subToolbar._balloonOffset.left-i+"px"),this.editor._controllerTargetContext!==this.editor.frameContext.get("topArea")&&this.ui._offCurrentController(),this.editor._lineBreaker_t){const t=this.editor._lineBreaker_t.style;if("none"!==t.display){const s=(this.editor._lineBreaker_t.getAttribute("data-offset")||",").split(",");t.top=mt.get(t.top,0)-(e-mt.get(s[0],0))+"px",t.left=mt.get(t.left,0)-(i-mt.get(s[1],0))+"px",this.editor._lineBreaker_t.setAttribute("data-offset",e+","+i)}}if(this.editor._lineBreaker_b){const t=this.editor._lineBreaker_b.style;if("none"!==t.display){const s=(this.editor._lineBreaker_b.getAttribute("data-offset")||",").split(",");t.top=mt.get(t.top,0)-(e-mt.get(s[0],0))+"px",t[s[1]]=mt.get(t[s[1]],0)-(i-mt.get(s[2],0))+"px",this.editor._lineBreaker_b.setAttribute("data-offset",e+","+s[1]+","+i)}}const s=this.editor.opendControllers;for(let t=0;t<s.length;t++)s[t].notInCarrier&&(s[t].form.style.top=s[t].inst.__offset.top-e+"px",s[t].form.style.left=s[t].inst.__offset.left-i+"px")},_scrollContainer(){const t=this.editor.opendControllers;t.length&&this.__rePositionController(t)},__rePositionController(t){Qt.get("__dragMove")&&Qt.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?.show()},_resetFrameStatus(){dt.isResizeObserverSupported||(this.toolbar.resetResponsiveToolbar(),this.options.get("_subMode")&&this.subToolbar.resetResponsiveToolbar());const t=this.context.get("toolbar.main"),e="none"===t.style.display||this.editor.isInline&&!this.toolbar._inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const i=this.editor.opendBrowser;if(i&&"block"===i.area.style.display&&(i.body.style.maxHeight=gt.utils.getClientSize().h-i.header.offsetHeight-50+"px"),this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._setMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown),this.viewer._resetFullScreenHeight())return;const s=this.editor.frameContext;s.get("isCodeView")&&this.editor.isInline?this.toolbar._showInline():(this.editor._iframeAutoHeight(s),this.toolbar._sticky&&(this.context.get("toolbar.main").style.width=s.get("topArea").offsetWidth-2+"px",this.toolbar._resetSticky()))},_setSelectionSync(){this.removeGlobalEvent(this.__selectionSyncEvent),this.__selectionSyncEvent=this.addGlobalEvent("mouseup",(()=>{this.selection._init(),this.removeGlobalEvent(this.__selectionSyncEvent)}))},_retainStyleNodes(t,e){let i=e[0].cloneNode(!1);for(let t,s=1,n=e.length;s<n;s++)t=e[s].cloneNode(!1),i.appendChild(t),i=t;const{parent:s,inner:n}=this.nodeTransform.createNestedNode(e,null),o=gt.utils.createTextNode(ut.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(s),this.selection.setRange(o,1,o,1)},_clearRetainStyleNodes(t){t.innerHTML="<br>",this.selection.setRange(t,0,t,0)},_callPluginEvent(t,e){const i=this.editor._onPluginEvents.get(t);for(let t,s=0;s<i.length;s++)if(t=i[s](e),"boolean"==typeof t)return t},_overComponentSelect(t){const e=gt.query.getParentElement(t,gt.check.isFigure);let i=this.component.get(t);i||e?(i||(i=this.component.get(e)),i&&!gt.utils.hasClass(i.container,"se-component-selected")&&(this.ui._offCurrentController(),Qt.set("__overInfo",Le),this.component.select(i.target,i.pluginName))):null===Qt.get("__overInfo")||gt.utils.hasClass(t,"se-drag-handle")||(this.component.__deselect(),Qt.set("__overInfo",null))},__removeInput(){this._inputFocus=this.editor._preventBlur=!1,this.__inputBlurEvent=this.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null},__enterPrevent(t){t.preventDefault(),Me&&(this.__focusTemp.focus({preventScroll:!0}),this.editor.frameContext.get("wysiwyg").focus({preventScroll:!0}))},__enterScrollTo(t){dt.isMobile||this.editor.selection.scrollTo(t)},__postFocusEvent(t,e){(this.editor.isInline||this.editor.isBalloonAlways)&&this.toolbar.show(),this.editor.isSubBalloonAlways&&this.subToolbar.show(),this.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})},__postBlurEvent(t,e){(this.editor.isInline||this.editor.isBalloon)&&this._hideToolbar(),this.editor.isSubBalloon&&this._hideToolbar_sub(),this.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})},constructor:Ne};const Ue=Ne,Ge={onload:null,onScroll:null,onMouseDown:null,onClick:null,onInput:null,onMouseLeave:null,onKeyDown:null,onKeyUp:null,onFocus:null,onNativeFocus:null,onBlur:null,onNativeBlur:null,onCopy:null,onCut:null,onChange:null,onShowToolbar:null,onShowController:null,onBeforeShowController:null,onToggleCodeView:null,onToggleFullScreen:null,onResizeEditor:null,onSetToolbarButtons:null,onSave:null,onDrop:null,onPaste:null,imageUploadHandler:null,onImageUploadBefore:null,onImageLoad:null,onImageAction:null,onImageUploadError:null,onImageDeleteBefore:null,videoUploadHandler:null,onVideoUploadBefore:null,onVideoLoad:null,onVideoAction:null,onVideoUploadError:null,onVideoDeleteBefore:null,audioUploadHandler:null,onAudioUploadBefore:null,onAudioUploadError:null,onAudioLoad:null,onAudioAction:null,onAudioDeleteBefore:null,onFileUploadBefore:null,onFileLoad:null,onFileAction:null,onFileUploadError:null,onFileDeleteBefore:null,onExportPDFBefore:null,onFileManagerAction:null,onEmbedInputBefore:null,onEmbedDeleteBefore:null},{_w:Ze}=dt,Ye=Math.floor(96/72*841.89105);function Xe(t,e){this.editor=t,this.context=t.context,this.selection=t.selection,this.offset=t.offset,this.fc=e,this.ww=e.get("wysiwyg"),this.wwFrame=e.get("wysiwygFrame"),this.wwWidth=-1,this.wwHeight=-1,this.isAutoHeight="auto"===e.get("options").get("height"),this.displayPage=this.isAutoHeight?Ze:e.get("wysiwyg"),this.innerHeaders=[],this._wwHeaders=[],this.documentTypeInner=e.get("documentTypeInner"),this.inner=null,this.page=null,this.totalPages=0,this.pageNum=0,this.pageHeight=-1,this.pageBreaksCnt=0,this.pages=[],this.pages_line=[],this.prevScrollTop=0,this.useHeader=t.options.get("_type_options").includes("header"),this.usePage=t.options.get("_type_options").includes("page"),this.navigatorButtons=[],this.pageNavigator=null,this._mirror=e.get("documentTypePageMirror"),this._mirrorCache=0,this._positionCache=new Map,this._rePageTimeout=null;const i=Ze.getComputedStyle(this._mirror);if(this._paddingTop=mt.get(i.paddingTop),this._paddingBottom=mt.get(i.paddingBottom),this.useHeader){const t=this._getHeaders(),e=this.inner=this.documentTypeInner.querySelector(".se-document-lines-inner");let i="";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i+=`<div class="se-doc-item se-doc-h${mt.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.innerHeaders=e.querySelectorAll("div"),this.editor.eventManager.addEvent(e,"click",je.bind(this,this.ww))}this.usePage&&(this.page=e.get("documentTypePage"),this.pageNavigator=t.plugins.pageNavigator)}function je(t,e){e.preventDefault();try{this.editor._preventBlur=!0;const t=gt.query.getEventTarget(e);if(gt.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.innerHeaders,t);if(-1===e)return;const i=this._wwHeaders[e];i&&this.selection.scrollTo(i)}}finally{this.editor._preventBlur=!1}}Xe.prototype={reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.inner,i=this.innerHeaders;for(let s,n,o,l=0,r=t.length;l<r;l++)if(s=t[l],n=`se-doc-h${mt.get(s.nodeName)}`,o=i[l],l<i.length)o.classList.contains(n)&&o.textContent===s.textContent||(o.textContent=o.title=s.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=s.textContent,e.appendChild(t)}if(i.length>t.length)for(let s=t.length;s<i.length;s++)e.removeChild(i[s]);this.innerHeaders=e.querySelectorAll("div")},async rePage(t){this.page&&(this._rePageTimeout&&Ze.clearTimeout(this._rePageTimeout),this._rePageTimeout=Ze.setTimeout((async()=>{await gt.utils.waitForMediaLoad(this._mirror,1500);const e=this._mirror.scrollHeight,i=this._mirror.querySelectorAll(".se-page-break");if(!t&&this.pageHeight===e&&this.pageBreaksCnt===i.length)return;this.pageHeight=e,this.pageBreaksCnt=i.length;let s=0,n=0,o=0;if(i.length>0){s=i[0].offsetHeight;for(let t=0;t<i.length;t++){const e=i[t].offsetTop;(e-n)%Ye!=0&&o++,n=e}const t=e-n;t>0&&t%Ye!=0&&o++}const l=this.isAutoHeight?0:this._getWWScrollTop(),r=Math.ceil(e/Ye)+o,a=this.wwFrame.offsetWidth+1,h=[];for(let t=0;t<i.length;t++)h.push({number:t,top:i[t].offsetTop+s-l});this._mirrorCache=0;const c=this.ww.children,d=this._mirror.children;this._initializeCache(d),h.push({number:0,top:0});for(let t=1,e=0;t<r;t++)if(e+=Ye+(1===t?this._paddingTop+this._paddingBottom:this._paddingTop),!h.some((t=>Math.abs(t.top-e)<1))){const{ci:i,cm:s,ch:n}=this._getElementAtPosition(e,d),o=c[i];if(!o)break;c[this._mirrorCache]&&(e+=mt.get(Ze.getComputedStyle(c[this._mirrorCache]).marginBottom));const l=o.offsetTop+o.offsetHeight+s+(o.offsetHeight-n);h.push({number:t,top:l})}if(0===h.length)return this.pages_line=[],this.totalPages=1,void this._displayCurrentPage();h.sort(((t,e)=>t.top-e.top)),this.page.innerHTML="",this.pages=[];for(let t,i=0;i<r;i++){if(!h[i])continue;if(t=h[i].top,e<t)break;const s=gt.utils.createElement("DIV",{style:`top:${t-l}px`,innerHTML:String(i+1)},`<div class="se-document-page-line" style="width: ${a}px;"></div>${i+1}`);this.page.appendChild(s),this.pages.push(s)}this.pages_line=this.page.querySelectorAll(".se-document-page-line"),this.totalPages=this.pages.length,this._displayCurrentPage()}),400))},_initializeCache(t){this._positionCache.clear();for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.offsetTop,n=i.offsetHeight,o=s+n;this._positionCache.set(e,{top:s,height:n,bottom:o})}},_getElementAtPosition(t,e){let i=this._mirrorCache,s=e.length-1;for(;i<=s;){const e=Math.floor((i+s)/2),{top:n,height:o,bottom:l}=this._positionCache.get(e);if(t>=n&&t<=l)return this._mirrorCache=e,{ci:e,cm:t-l,ch:o};t<n?s=e-1:i=e+1}const n=e[i]?i:s;this._mirrorCache=n;const o=this._positionCache.get(n);return{ci:n,cm:t-o.bottom,ch:o.height}},resizePage(){const t=this.wwFrame.offsetWidth+1,e=this.wwFrame.offsetHeight+1;let i=!1;if(t===this.wwWidth&&(i=e===this.wwHeight))return;t>800?gt.utils.removeClass(this.documentTypeInner,"se-document-responsible"):gt.utils.addClass(this.documentTypeInner,"se-document-responsible"),this.wwWidth=t,this.wwHeight=e;const s=this.pages_line;for(let e=0,i=s.length;e<i;e++)s[e].style.width=`${t}px`;i||this.rePage(!0),this._displayCurrentPage()},scrollPage(){const t=this.prevScrollTop,e=this._getWWScrollTop();if(t===e)return;const i=this.pages;for(let s=0,n=i.length;s<n;s++)i[s].style.top=mt.get(i[s].style.top)-(e-t)+"px";this.prevScrollTop=e,this._displayCurrentPage()},scrollWindow(){this.isAutoHeight&&this._displayCurrentPage()},getCurrentPageNumber(){if(this.totalPages<=1)return 1;let t=0;if(this.isAutoHeight){const e=this._getGlobalTop();if(t=Ze.scrollY-e+Ye/2,t<=0)return 1}else t=this.wwHeight/2;const e=this.pages;for(let i=0,s=e.length;i<s;i++)if(e[i].offsetTop>=t)return this.pageNum=i;return this.pageNum=this.totalPages},pageUp(){const t=this.pageNum-1<=1?1:this.pageNum-1;this._movePage(t,!1)},pageDown(){const t=this.pageNum+1>this.pages.length?this.pages.length:this.pageNum+1;this._movePage(t,!1)},pageGo(t){t<1?t=1:t>this.pages.length&&(t=this.pages.length),this._movePage(t,!0)},on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(gt.utils.removeClass(this.innerHeaders,"active"),gt.utils.addClass(e,"active"))},onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)},_displayCurrentPage(){const t=this.getCurrentPageNumber();this.pageNavigator?.display(t,this.totalPages)},_getWWScrollTop(){return this.displayPage.scrollTop||this.displayPage.scrollY||0},_movePage(t,e){const i=this._getGlobalTop(),s=pt.nodeListToArray(this.ww.children),n=this.page.offsetTop+mt.get(this.pages[t-1].style.top)+(this.isAutoHeight?0:this._getWWScrollTop());for(let o,l=0,r=s.length;l<r;l++)if(o=s[l],o.offsetTop>=n){e||this.selection.setRange(o,0,o,0);const s=0!==l||this.isAutoHeight?o.offsetTop-this.page.offsetTop-o.offsetHeight+i:0;this._applyPageScroll(s,(()=>{this.editor.toolbar._sticky&&this.displayPage.scrollTo({top:s-this.context.get("toolbar.main").offsetHeight,behavior:"smooth"})})),this.pageNum=t;break}},_applyPageScroll(t,e){this.displayPage.scrollTo({top:t,behavior:"smooth"});const i=()=>{Math.abs((this.displayPage.scrollY??this.displayPage.scrollTop)-t)<1?e():Ze.requestAnimationFrame(i)};Ze.requestAnimationFrame(i)},_getGlobalTop(){return this.isAutoHeight?this.offset.getGlobal(this.wwFrame).top:0},_findItem(t){const e=this._wwHeaders,i=Array.prototype.indexOf.call(e,t);return-1!==i&&this.innerHeaders[i]?this.innerHeaders[i]:null},_findLinesHeader(t){for(;t&&t!==this.ww;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null},_is:t=>/^h[1-6]$/i.test(t?.nodeName),_getHeaders(){return this._wwHeaders=this.ww.querySelectorAll("h1, h2, h3, h4, h5, h6")},constructor:Xe};const Ke=Xe;const Je=function(t){this.toolbar=t.toolbar,this.subToolbar=null,t.subToolbar&&(this.subToolbar=t.subToolbar),this.char=t.char,this.component=t.component,this.format=t.format,this.html=t.html,this.menu=t.menu,this.nodeTransform=t.nodeTransform,this.offset=t.offset,this.selection=t.selection,this.shortcuts=t.shortcuts,this.ui=t.ui,this.viewer=t.viewer};function Qe(t){Jt.call(this,t)}function ti(e){e&&!D(e,"se-blink")&&(q(e,"se-blink"),t.setTimeout((()=>{W(e,"se-blink")}),600))}Qe.prototype={check(t){const e=this.editor.frameOptions.get("charCounter_max");if(e){const i=this.getLength("string"==typeof t?t:"byte-html"===this.editor.frameOptions.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(i>0&&i+this.getLength()>e)return ti(this.editor.frameContext.get("charWrapper")),!1}return!0},getLength(t){return"string"!=typeof t&&(t="byte-html"===this.editor.frameOptions.get("charCounter_type")?this.editor.frameContext.get("wysiwyg").innerHTML:this.editor.frameContext.get("wysiwyg").textContent),/byte/.test(this.editor.frameOptions.get("charCounter_type"))?this.getByteLength(t):t.length},getByteLength(t){if(!t||!t.toString)return 0;let e,i;return t=t.toString(),a?(i=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e):(i=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e)},display(e){const i=(e||this.editor.frameContext).get("charCounter");i&&t.setTimeout((()=>{i.textContent=this.getLength()}),0)},test(t,e){let i=0;t&&(i=this.getLength(t)),this.display();const s=this.editor.frameOptions.get("charCounter_max");if(s>0){let t=!1;const n=this.getLength();if(n>s){if(t=!0,i>0&&e){this.selection._init();const t=this.selection.getRange(),e=t.endOffset-1,i=this.selection.getNode().textContent,s=t.endOffset-1;this.selection.getNode().textContent=i.slice(0,s<0?0:s)+i.slice(t.endOffset,i.length),this.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+i>s&&(t=!0);if(t&&(ti(this.editor.frameContext.get("charWrapper")),i>0))return!1}return!0},constructor:Qe};const ei=Qe;const ii=function(t){this.editor,this.eventManager,this.history,this.events,this.triggerEvent,this.carrierWrapper,this.plugins,this.status,this.context,this.options,this.icons,this.lang,this.frameRoots,this._w,this._d,this.toolbar,this.subToolbar,this.char,this.component,this.format,this.html,this.menu,this.nodeTransform,this.offset,this.selection,this.shortcuts,this.ui,this.viewer,Jt.call(this,t),Je.call(this,t)},{_w:si,ON_OVER_COMPONENT:ni}=dt,oi="2147483646",li="2147483645",ri="2147483641",ai="2147483640";const hi=class extends ii{constructor(t,e,i,s){super(t.editor),this.kind=s||t.constructor.key||t.constructor.name,this.inst=t,this.form=e,this.isOpen=!1,this.currentTarget=null,this.currentPositionTarget=null,this.isWWTarget=i.isWWTarget??!0,this.position=i.position||"bottom",this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsHide=!!i.parentsHide,this.sibling=i.sibling||null,this.siblingPosition=["top","side"].includes(i.siblingPosition)?i.siblingPosition:"top",this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this.toTop=!1,this._reserveIndex=!1,this._initMethod="function"==typeof i.initMethod?i.initMethod:null,this.__globalEventHandlers={keydown:this.#t.bind(this),mousedown:this.#e.bind(this)},this._bindClose_key=null,this._bindClose_mouse=null,this.__offset={},this.__addOffset={left:0,top:0},this.__shadowRootEventForm=null,this.__shadowRootEventListener=null,this.carrierWrapper.appendChild(e),this.eventManager.addEvent(e,"click",this.#i.bind(this)),this.eventManager.addEvent(e,"mouseenter",this.#s.bind(this)),this.eventManager.addEvent(e,"mouseleave",this.#n.bind(this))}open(t,e,{isWWTarget:i,initMethod:s,disabled:n,addOffset:o}={}){if(Qt.get("__overInfo")===ni)return;if(!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this.status.hasFocus||(n??this.disabled?this.ui.setControllerOnDisabledButtons(!0):this.ui.setControllerOnDisabledButtons(!1)),this.currentPositionTarget=e||t,this.isWWTarget=i??this.isWWTarget,"function"==typeof s&&(this._initMethod=s),this.editor.currentControllerName=this.kind,this.__addOffset={left:0,top:0},o&&(this.__addOffset={...this.__addOffset,...o});const l=this.isOutsideForm?this.parents:[];this.editor.opendControllers?.forEach((t=>{l.includes(t.form)||(t.form.style.zIndex=ai)})),this.parentsHide&&this.parents.forEach((t=>{t.style.display="none"})),this.__addGlobalEvent(),this.sibling&&("top"===this.siblingPosition?this.__addOffset.top+=1-this.sibling.offsetHeight:this.__addOffset.left+=this.form.offsetWidth+this.sibling.offsetWidth-1),this._setControllerPosition(this.form,this.currentPositionTarget,!1);const r=t instanceof Range;this.currentTarget=r?null:t,this._controllerOn(this.form,t,r),this._w.setTimeout((()=>Qt.set("__overInfo",!1)),0)}close(t){this.isOpen&&(this.toTop=!1,this.isOpen=!1,this.__offset={},this.__addOffset={left:0,top:0},this.__removeGlobalEvent(),"function"==typeof this._initMethod&&this._initMethod(),this._controllerOff(),this.parentsHide&&!t&&this.parents.forEach((t=>{t.style.display="block"})),this.parents.length>0||("function"==typeof this.inst.close&&this.inst.close(),this.component.deselect()))}hide(){this.form.style.display="none"}show(){this._setControllerPosition(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?oi:li}resetPosition(t){this._setControllerPosition(this.form,t||this.currentPositionTarget,!0)}async _controllerOn(t,e,i){const s={position:this.position,inst:this,form:t,target:e,isRangeTarget:i,notInCarrier:!this.carrierWrapper.contains(t)};!1!==await this.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.editor.frameContext,info:s})&&(t.style.display="block",this.editor._shadowRoot&&(this.__shadowRootEventForm=t,this.__shadowRootEventListener=t=>t.stopPropagation(),t.addEventListener("mousedown",this.__shadowRootEventListener)),this.editor._controllerTargetContext=this.editor.frameContext.get("topArea"),this.isOpen||this.editor.opendControllers.push(s),this.isOpen=!0,this.editor._preventBlur=!0,this.editor.status.onSelected=!0,this.triggerEvent("onShowController",{caller:this.kind,frameContext:this.editor.frameContext,info:s}))}_controllerOff(){this.form.style.display="none",this.editor.opendControllers=this.editor.opendControllers.filter((t=>t.form!==this.form)),this.editor.currentControllerName!==this.kind&&this.editor.opendControllers.length>0||(this.ui.setControllerOnDisabledButtons(!1),this.editor.frameContext.get("lineBreaker_t").style.display=this.editor.frameContext.get("lineBreaker_b").style.display="none",this.editor.effectNode=null,this.editor.currentControllerName="",this.editor._preventBlur=!1,this.editor._controllerTargetContext=null,si.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__shadowRootEventForm&&(this.__shadowRootEventForm.removeEventListener("mousedown",this.__shadowRootEventListener),this.__shadowRootEventForm=this.__shadowRootEventListener=null),"function"==typeof this.inst.reset&&this.inst.reset())}_setControllerPosition(t,e,i){if(t.style.visibility="hidden",t.style.display="block",this.selection.isRange(e)){if(!this.offset.setRangePosition(this.form,e,{position:"bottom"}))return void this.hide()}else if(e){const s=this.offset.setAbsPosition(t,e,{addOffset:this.__addOffset,position:this.position,isWWTarget:this.isWWTarget,inst:this});if(!s)return void this.hide();if(!i&&this.sibling&&"top"===this.siblingPosition&&s.position!==this.position){const e=t.offsetTop-this.__addOffset.top;"bottom"===s.position?(this._reserveIndex=!0,t.style.top=e+this.sibling.offsetHeight-2+"px"):t.style.top=e-this.sibling.offsetHeight+2+"px"}else this._reserveIndex=!1}t.style.zIndex=this.toTop?li:this._reserveIndex?ri:ai,t.style.visibility=""}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandlers.keydown,!0),this._bindClose_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandlers.mousedown,!0)}__removeGlobalEvent(){this.component.__removeGlobalEvent(),this._bindClose_key&&(this._bindClose_key=this.eventManager.removeGlobalEvent(this._bindClose_key)),this._bindClose_mouse&&(this._bindClose_mouse=this.eventManager.removeGlobalEvent(this._bindClose_mouse))}_checkFixed(){if(this.editor.selectMenuOn)return!0;const t=this.editor.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}_checkForm(t){if(gt.check.isWysiwygFrame(t))return!1;if(gt.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;return this.isInsideForm&&this.parents?.length>0&&this.parents.some((i=>{if(i.contains(t))return e=!0,!0})),!e&&(!!gt.query.getParentElement(t,".se-controller")||t?.contains(this.inst._element))}#i(t){const e=gt.query.getEventTarget(t),i=gt.query.getCommandTarget(e);i&&(t.stopPropagation(),t.preventDefault(),this.inst.controllerAction(i))}#s(t){if(this.editor.currentControllerName=this.kind,this.parents.length>0&&this.isInsideForm)return;gt.query.getEventTarget(t).style.zIndex=this.toTop?oi:li}#n(t){if(this.parents.length>0&&this.isInsideForm)return;gt.query.getEventTarget(t).style.zIndex=this.toTop?li:this._reserveIndex?ri:ai}#t(t){if(this._checkFixed())return;const e=t.code;if(ft.isCtrl(t)||!ft.isNonResponseKey(e))return;const i=gt.query.getEventTarget(t);this.form.contains(i)||this._checkForm(i)||this.editor._fileManager.pluginRegExp.test(this.kind)&&!ft.isEsc(e)||(this.#o(i),this.close())}#e(t){const e=gt.query.getEventTarget(t);this.inst?._element?.contains(e)?this.isOpen=!1:(this.isOpen=!0,e===this.inst._element||e===this.currentTarget||this._checkFixed()||this.form.contains(e)||this._checkForm(e)||gt.query.getParentElement(e,".se-line-breaker-component")||(this.#o(e),this.close(!0)))}#o(t){this.editor.frameContext.get("wysiwyg").contains(t)||(this.component.__prevent=!1)}};const ci=class extends Jt{constructor(t,e){super(t.editor),this.kink=t.constructor.key||t.constructor.name,this.inst=t;const i=e.position.split("-");this.form=null,this.items=[],this.menus=null,this.menuLen=0,this.index=-1,this.item=null,this.isOpen=!1,this.checkList=!!e.checkList,this.position=i[0],this.subPosition=i[1],this._dirPosition=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this._dirSubPosition=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this._textDirDiff="ltr"!==e.dir&&("rtl"===e.dir||null),this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this._refer=null,this._keydownTarget=null,this._selectMethod=null,this._bindClose_key=null,this._bindClose_mousedown=null,this._bindClose_click=null,this._closeSignal=!1,this.__events=null,this.__eventHandlers={mousedown:this.#l.bind(this),mousemove:this.#r.bind(this),click:this.#a.bind(this),keydown:this.#h.bind(this)},this.__globalEventHandlers={keydown:this.#c.bind(this),mousedown:this.#e.bind(this),click:this.#d.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="";let i="";for(let s=0,n=(e=e||t).length;s<n;s++)s>0&&s%this.splitNum==0&&(this._createFormat(i),i=""),i+=`<li class="se-select-item" data-index="${s}">${"string"==typeof e[s]?e[s]:e[s].outerHTML}</li>`;this._createFormat(i),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,i){i||(i={}),this._refer=t,this._keydownTarget=gt.check.isInputElement(t)?t:this._w,this._selectMethod=e,this.form=gt.utils.createElement("DIV",{class:"se-select-menu"+(i.class?" "+i.class:""),style:i.style||""},'<div class="se-list-inner"></div>'),t.parentNode.insertBefore(this.form,t)}open(t,e){this.editor.selectMenuOn=!0,"function"==typeof this.openMethod&&this.openMethod(),this.__addEvents(),this.__addGlobalEvent();const i=t?t.split("-"):[],s=i[0]||(null!==this._textDirDiff&&this._textDirDiff!==this.options.get("_rtl")?this._dirPosition:this.position),n=i[1]||(null!==this._textDirDiff&&this._textDirDiff!==this.options.get("_rtl")?this._dirSubPosition:this.subPosition);this._setPosition(s,n,e),this.isOpen=!0}close(){this.editor.selectMenuOn=!1,gt.utils.removeClass(this._refer,"on"),this._init(),this.form&&(this.form.style.cssText=""),this.isOpen=!1,"function"==typeof this.closeMethod&&this.closeMethod()}getItem(t){return this.items[t]}setItem(t){this._selectItem(t)}_createFormat(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}_init(){this.__removeEvents(),this.__removeGlobalEvent(),this.index=-1,this.item=null,this._onItem&&(gt.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}_moveItem(t){t=this.index+t;const e=this.menuLen,i=this.index=t>=e?0:t<0?e-1:t;this._selectItem(i)}_selectItem(t){gt.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let i=0;i<e;i++)i===t?gt.utils.addClass(this.menus[i],"active"):gt.utils.removeClass(this.menus[i],"active");this.index=t,this.item=this.items[t]}_setPosition(t,e,i,s){const n=t,o=this.form,l=this._refer;o.style.visibility="hidden",o.style.display="block",gt.utils.removeClass(o,"se-select-menu-scroll"),gt.utils.addClass(l,"on");const r=o.offsetWidth,a=l.offsetWidth,h=l.offsetLeft;let c=!1,d=0,u=0;"left"===t?(d=h-r-1,t=e,c=!0):"right"===t&&(d=h+a+1,t=e,c=!0);const p=this.editor.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,_=gt.utils.getClientSize().h-(m-this._w.scrollY+f),b=c?f:0;let y=1e4;switch(t){case"middle":{let t=o.offsetHeight;const e=f/2;u=g-t/2+e,m<t/2&&(u+=t/2-m-e+4,o.style.top=u+"px");let i=this.editor.offset.getGlobal(o).top;const s=t-(m-i)-_-f;s>0&&(u-=s+4,o.style.top=u+"px"),i=this.editor.offset.getGlobal(o).top,i<0&&(t+=i-4,u-=i-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-b){if(!s){y=0;break}y=m-4+b,y>=38&&(o.style.height=y+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(_<o.offsetHeight+b){if(!s){y=0;break}y=_-4+b,y>=38&&(o.style.height=y+"px")}u=g+(c?0:f)}if(y<38&&!s&&"middle"!==t)return void this._setPosition("top"===t?"bottpm":"top",e,i,!0);if(!c)switch(e){case"center":d=h+a/2-r/2;break;case"left":d=h;break;case"right":d=h-(r-a)}o.style.left=d+"px";const v=this.editor.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-this._w.scrollX+v,C<0&&(d=d=h+a+1);break;case"true-right":C=this._w.innerWidth-(v+r),C<0&&(d=h-r-1);break;case"false-center":{C=this._w.innerWidth-(v+r),C<0&&(d+=C-4),o.style.left=d+"px";const t=this.editor.offset.getGlobal(o).left;t<0&&(d-=t-4);break}case"false-left":C=this._w.innerWidth-(p.left-this._w.scrollX+r),C<0&&(d+=C-4);break;case"false-right":v<0&&(d-=v-4)}if(i){const t=o.firstElementChild.querySelector(i);t&&(this._onItem=t,gt.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}_select(t){this.checkList&>.utils.toggleClass(this.menus[t],"se-checked"),this._selectMethod(this.getItem(t))}__addEvents(){this.__removeEvents(),this.__events=this.__eventHandlers,this.form.addEventListener("mousedown",this.__events.mousedown),this.form.addEventListener("mousemove",this.__events.mousemove),this.form.addEventListener("click",this.__events.click),this._keydownTarget.addEventListener("keydown",this.__events.keydown)}__removeEvents(){this.__events&&(this.form.removeEventListener("mousedown",this.__events.mousedown),this.form.removeEventListener("mousemove",this.__events.mousemove),this.form.removeEventListener("click",this.__events.click),this._keydownTarget.removeEventListener("keydown",this.__events.keydown),this.__events=null)}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandlers.keydown,!0),this._bindClose_mousedown=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandlers.mousedown,!0)}__removeGlobalEvent(){this._bindClose_key&&(this._bindClose_key=this.eventManager.removeGlobalEvent(this._bindClose_key)),this._bindClose_mousedown&&(this._bindClose_mousedown=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)),this._bindClose_click&&(this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click))}#h(t){let e;switch(t.code){case"ArrowUp":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index-t<0?t:-t}else e=-1;break;case"ArrowDown":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index+t>this.menuLen?-t:t}else e=1;break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),e=-1;break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),e=1;break;case"Enter":case"Space":this.index>-1?(t.preventDefault(),t.stopPropagation(),this._select(this.index)):this.close()}e&&this._moveItem(e)}#l(t){if(dt.isGecko){const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,".se-select-item");i&&this.eventManager._injectActiveEvent(i)}}#r(t){const e=gt.query.getEventTarget(t);gt.utils.addClass(this.form,"se-select-menu-mouse-move");const i=e.getAttribute("data-index");i&&(this.index=Number(i))}#a(t){let e=gt.query.getEventTarget(t),i=null;for(;!i&&!/UL/i.test(e.tagName)&&!gt.utils.hasClass(e,"se-select-menu");)i=e.getAttribute("data-index"),e=e.parentElement;i&&this._select(Number(i))}#c(t){ft.isEsc(t.code)&&this.close()}#e(t){const e=gt.query.getEventTarget(t);this.form.contains(e)||(t.target!==this._refer?this.close():gt.check.isInputElement(e)||(this._bindClose_click=this.eventManager.addGlobalEvent("click",this.__globalEventHandlers.click,!0)))}#d(t){this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click),t.target===this._refer&&(t.stopPropagation(),this.close())}},{ON_OVER_COMPONENT:di}=dt,ui={tl:"nwse-resize",tr:"nesw-resize",bl:"nesw-resize",br:"nwse-resize",lw:"ew-resize",th:"ns-resize",rw:"ew-resize",bh:"ns-resize"};let pi=!1,gi=!1,mi=0,fi=0;class _i extends ii{constructor(t,e,i){super(t.editor),this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.icons.format_float_none,left:this.icons.format_float_left,right:this.icons.format_float_right,center:this.icons.format_float_center},this._action={};const s=function(t,e){let i=null;if(e?.length>0){const{lang:s,icons:n}=t;i='<div class="se-arrow se-arrow-up"></div>';for(let o,l=0;l<e.length;l++){o=e[l],i+='<div class="se-btn-group">';for(let e,l=0,r=o.length;l<r;l++){if(e=o[l],"function"==typeof e?.action){const i=e;e={c:`__c__${i.command}`,v:i.value||"",l:i.title,i:i.icon},t._action[e.c]=i.action}else if(e=bi(e),!e)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${e.c}" data-value="${e.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${n[e.i]||e.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${s[e.l]||e.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return gt.utils.createElement("DIV",{class:"se-controller se-controller-resizing"+(i?"":" se-empty-controller")},i)}(this,e||[]);this.controller=new hi(this,s,{position:"bottom",disabled:!0},this.kind),this.alignButton=s.querySelector('[data-command="onalign"]');const n=function(t,e){if(!e)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],s=[t.lang.basic,t.lang.left,t.lang.center,t.lang.right],n=["none","left","center","right"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.alignButton);n&&(this.selectMenu_align=new ci(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#u.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(n.items,n.html)),this.asButton=s.querySelector('[data-command="onas"]');const o=function(t,e){if(!e)return null;const i=[t.icons.as_block,t.icons.as_inline],s=[t.lang.asBlock,t.lang.asInline],n=["block","inline"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.asButton);o&&(this.selectMenu_as=new ci(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#p.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(o.items,o.html)),this.resizeButton=s.querySelector('[data-command="onresize"]');const l=function(t,e){if(!e)return null;const i=e.getAttribute("data-value").split(","),s=[];for(let e,n,o,l,r=0;r<i.length;r++)o=i[r],e=mt.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,s.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:s,items:i}}(this,this.resizeButton);l&&(this.selectMenu_resize=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#g.bind(this)),this.selectMenu_resize.create(l.items,l.html)),this.inst=t,this.sizeUnit=i.sizeUnit||"px",this.autoRatio=i.autoRatio,this.isVertical=!1,this.percentageButtons=s.querySelectorAll('[data-command="resize_percent"]'),this.captionButton=s.querySelector('[data-command="caption"]'),this.align="none",this.as="block",this._element=null,this._cover=null,this._inlineCover=null,this._container=null,this._caption=null,this._width="",this._height="",this._resize_w=0,this._resize_h=0,this._element_w=0,this._element_h=0,this._element_l=0,this._element_t=0,this._resizeClientX=0,this._resizeClientY=0,this._resize_direction="",this._floatClassStr="__se__float-none|__se__float-left|__se__float-center|__se__float-right",this.__preventSizechange=!1,this.__revertSize={w:"",h:""},this.__offset={},this.__offContainer=this.#m.bind(this),this.__containerResizing=this.#f.bind(this),this.__containerResizingOff=this.#_.bind(this),this.__containerResizingESC=this.#b.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.__onResizeESCEvent=null,this.__fileManagerInfo=!1,this.eventManager.addEvent(this.alignButton,"click",this.#y.bind(this)),this.eventManager.addEvent(this.asButton,"click",this.#v.bind(this)),this.eventManager.addEvent(this.resizeButton,"click",this.#C.bind(this)),this.editor.applyFrameRoots((t=>{if(!t.get("wrapper").querySelector(".se-controller.se-resizing-container")){const e=function(){const t='\n\t\t<div class="se-resize-dot">\n\t\t\t<span class="tl"></span>\n\t\t\t<span class="tr"></span>\n\t\t\t<span class="bl"></span>\n\t\t\t<span class="br"></span>\n\t\t\t<span class="lw"></span>\n\t\t\t<span class="th"></span>\n\t\t\t<span class="rw"></span>\n\t\t\t<span class="bh"></span>\n\t\t\t<div class="se-resize-display"></div>\n\t\t</div>';return gt.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),i=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:i}),t.get("wrapper").appendChild(e),this.eventManager.addEvent(i,"mousedown",this.#w.bind(this))}}))}static CreateContainer(t,e){return gt.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},gt.utils.createElement("FIGURE",null,t)),_i.GetContainer(t)}static CreateInlineContainer(t,e){return gt.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),_i.GetContainer(t)}static CreateCaption(t,e){const i=gt.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(i),i}static GetContainer(t){const e=gt.query.getParentElement(t,"FIGURE",2),i=gt.query.getParentElement(t,"SPAN",2);return{target:t,container:gt.query.getParentElement(t,_i.is,2)||e,cover:e,inlineCover:gt.utils.hasClass(i,"se-inline-component")?i:null,caption:gt.query.getEdgeChild(t.parentElement,"FIGCAPTION",!1)}}static GetRatio(t,e,i){let s=1,n=1;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!mt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px")===(!mt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px")){const i=mt.get(t,4),o=mt.get(e,4);s=i/o,n=o/i}}return{w:mt.get(s,4),h:mt.get(n,4)}}static CalcRatio(t,e,i,s){if(/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!mt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px",o=!mt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px";if(n===o){const i="%"===n?2:0,l=t,r=e;e=mt.get(s.h*mt.get(l,i),i)+o,t=mt.get(s.w*mt.get(r,i),i)+n}}return{w:t,h:e}}static is(t){return gt.utils.hasClass(t,"se-component")||/^(HR)$/.test(t?.nodeName)}close(){this.editor._preventBlur=!1,gt.utils.removeClass(this._cover,"se-figure-selected"),this.controller.close(),this.component._removeDragEvent()}open(t,{nonResizing:e,nonSizeInfo:i,nonBorder:s,figureTarget:n,__fileManagerInfo:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');Qt.get("__overInfo")!==di?this.ui._offCurrentController():s=!0;const l=_i.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.options.get("strictMode").formatFilter)return{container:null,cover:null,width:r.style.width||r.width||"",height:r.style.height||r.height||""};l.container=r,l.cover=r,a=!0}Qt.set("__figureInst",this),this._setFigureInfo(l);const h=n&&(this._cover||this._container)||r,c=h.offsetWidth||null,d=h.offsetHeight||null,{top:u,left:p,scrollX:g,scrollY:m}=this.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(","),_=_i.GetRatio(f[0]||mt.get(r.style.width,2)||c,f[1]||mt.get(r.style.height,2)||d,this.sizeUnit),b={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:_,w:c||"",h:d||"",t:u,l:p,width:f[0]||"auto",height:f[1]||"auto",originWidth:r.naturalWidth||r.offsetWidth,originHeight:r.naturalHeight||r.offsetHeight};if(this._width=b.width,this._height=b.height,o||this.__fileManagerInfo)return b;const y=this.editor.frameContext.get("_figure");this.editor._figureContainer=y.main,y.main.style.top=u+"px",y.main.style.left=p+"px",y.main.style.width=(this.isVertical?d:c)+"px",y.main.style.height=(this.isVertical?c:d)+"px",y.border.style.top="0px",y.border.style.left="0px",y.border.style.width=(this.isVertical?d:c)+"px",y.border.style.height=(this.isVertical?c:d)+"px",this.__offset={left:p+g,top:u+m},this.editor.opendControllers.push({position:"none",form:y.main,target:h,inst:this,notInCarrier:!0});const v=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?mt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===v?gt.utils.addClass(this.percentageButtons[t],"active"):gt.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?gt.utils.addClass(this.captionButton,"active"):gt.utils.removeClass(this.captionButton,"active")),y.display.style.display=i||this._inlineCover?"none":"",y.border.style.display=s?"none":"",y.main.style.display="block",Qt.get("__overInfo")!==di){this._setAlignIcon(),this._setAsIcon(),this.ui._visibleControllers(!0,!0);const t=this.getSize(r);gt.utils.changeTxt(y.display,this.lang["none"===this.align?"basic":this.align]+" ("+t.w+", "+t.h+")"),this._displayResizeHandles(!e);const i=this.controller.form.querySelectorAll('[data-command="rotate"][data-value="90"], [data-command="rotate"][data-value="-90"], [data-command="caption"], [data-command="onalign"], [data-command="onresize"]'),s=this._inlineCover||a?"none":"";i.forEach((t=>{t.style.display=s}));const n=this.controller.form.querySelector('[data-command="onas"]');n&&(n.style.display=a?"none":""),gt.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller.open(y.main,null,{initMethod:this.__offContainer,isWWTarget:!1,addOffset:null}),this._w.setTimeout((()=>Qt.set("__overInfo",!1)),0)}else gt.utils.addClass(this._cover,"se-figure-over-selected");return gt.utils.addClass(this._cover,"se-figure-selected"),this._element_w=this._resize_w=c,this._element_h=this._resize_h=d,this._element_l=p,this._element_t=u,this._inlineCover||Qt.get("__overInfo")===di&&!gt.utils.hasClass(l.container,"se-input-component")||this._setDragEvent(y.main),b}controllerHide(){this.controller.hide()}controllerShow(){this.controller.show()}controllerOpen(t,e){this._element=t,this.controller.open(t,null,e)}setSize(t,e){/%$/.test(t+"")?this._setPercentSize(t,e):t&&"auto"!==t||e&&"auto"!==e?this._applySize(t,e,""):this.autoRatio?this._setPercentSize(100,this.autoRatio.default||this.autoRatio.current):this._setAutoSize()}getSize(t){if(t||(t=this._element),!t)return{w:"",h:""};const e=_i.GetContainer(t),i=e.target;if(!e.container)return this.options.get("strictMode").formatFilter?{w:"",h:i.style.height}:{w:i.style.width||"auto",h:i.style.height||"auto"};return{w:(/%$/.test(i.style.width)?(e.container&&mt.get(e.container.style.width,2)||100)+"%":i.style.width)||"auto",h:(e.inlineCover?e.inlineCover.style.height:mt.get(e.cover.style.paddingBottom,0)>0&&!this.isVertical?e.cover.style.height:/%$/.test(i.style.height)&&/%$/.test(i.style.width)?(e.container&&mt.get(e.container.style.height,2)||100)+"%":i.style.height)||"auto"}}setAlign(t,e){t||(t=this._element),this.align=e=e||"none";const i=_i.GetContainer(t);if(!i.cover)return;const s=i.target,n=i.container,o=i.cover;if(/%$/.test(s.style.width)&&"center"===e&&!this.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?s.style.height||s.offsetHeight+"px":s.style.width&&"auto"!==s.style.width?s.style.width||"100%":""),gt.utils.hasClass(n,"__se__float-"+e)||(gt.utils.removeClass(n,this._floatClassStr),gt.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this._setAlignIcon()}convertAsFormat(t,e){t||(t=this._element),this.as=e||"block";const{container:i,inlineCover:s,target:n}=_i.GetContainer(t),{w:o,h:l}=this.getSize(n),r=n.cloneNode(!1);switch(e){case"inline":{if(s)break;this.component.deselect();const t=i.nextElementSibling,e=i.parentElement;r.style.width="",r.style.height="";const n=_i.CreateInlineContainer(r);gt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(n,o,l);const a=gt.utils.createElement(this.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),gt.utils.removeItem(i);break}case"block":{if(!s)break;this.component.deselect(),this.selection.setRange(i,0,i,1);const t=this.html.remove(),e=this.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&>.check.isZeroWidth(e.previousElementSibling)&>.utils.removeItem(e.previousElementSibling),r.style.width="",r.style.height="";const n=_i.CreateContainer(r);gt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}}_asFormatChange(t,e,i){const s=this.kind;t.target.onload=()=>this.component.select(t.target,s),this._setFigureInfo(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setSize(e,i)}controllerAction(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value"),s=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==s){switch(e){case"mirror":{const t=this.#x(n);let e=t.x,s=t.y;"h"===i&&!this.isVertical||"v"===i&&this.isVertical?s=s?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,s);break}case"rotate":this.setTransform(n,null,null,i);break;case"caption":if(this._caption)gt.utils.removeItem(this._caption),this._w.setTimeout(this.component.select.bind(this.component,n,this.kind),0);else{const t=_i.CreateCaption(this._cover,this.lang.caption),e=gt.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.selection.setRange(e,0,e,e.textContent.length):t.focus(),this.controller.close()}this._caption=!this._caption,(/\d+/.test(n.style.height)||this.isVertical&&this._caption)&&(/%$/.test(n.style.width)||/auto/.test(n.style.height)?this.deleteTransform():this.setTransform(n,n.style.width,n.style.height,0));break;case"revert":this._setRevert();break;case"edit":this.inst.edit(n);break;case"copy":this.component.copy(this._container);break;case"remove":this.inst.destroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,i,t):/^edit$/.test(e)||(this.history.push(!1),/^remove|caption$/.test(e)||this.component.select(n,this.kind))}}retainFigureFormat(t,e,i,s){const n=this.component.isInline(t);let o=this.format.isBlock(e.parentNode)||gt.check.isWysiwygFrame(e.parentNode)?e:gt.check.isAnchor(e.parentNode)?e.parentNode:this.format.getLine(e)||e;if(gt.query.getParentElement(e,gt.check.isExcludeFormat))o=i&&i!==e?i:e,o.parentNode.replaceChild(t,o);else if(n&&this.format.isLine(o)){const i=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;i.parentElement.replaceChild(t,i)}else if(gt.check.isListCell(o)){const i=gt.query.getParentElement(e,(t=>t.parentNode===o));o.insertBefore(t,i),gt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(i,null,!0)}else if(this.format.isLine(o)){const i=gt.query.getParentElement(e,(t=>t.parentNode===o));o=this.nodeTransform.split(o,i),o.parentNode.insertBefore(t,o),gt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(o,null,!0)}else if(this.format.isLine(o.parentNode)){const e=o.parentNode;e.parentNode.insertBefore(t,o.previousSibling?e.nextElementSibling:e),(0===s?.__updateTags.map((t=>o.contains(t))).length||gt.check.isZeroWidth(o))&>.utils.removeItem(o)}else o=gt.check.isFigure(o.parentNode)?gt.query.getParentElement(o.parentNode,_i.is):o,o.parentNode.replaceChild(t,o)}deleteTransform(t){t||(t=this._element);const e=t,i=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this._deleteCaptionPosition(e),this._applySize(i[0]||"auto",i[1]||"","")}setTransform(t,e,i,s){try{this.__preventSizechange=!0;const n=this.#x(t),o=n.r+1*(s||0);s=Math.abs(o)>=360?0:o;const l=this.isVertical=/^(90|270)$/.test(Math.abs(s).toString());e=mt.get(e,0),i=mt.get(i,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");let h="";if(/auto|%$/.test(a[0])&&!l)"auto"===a[0]&&"auto"===a[1]?this._setAutoSize():this._setPercentSize(a[0],a[1]);else{const t=_i.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=i||r.offsetHeight,c=(l?a:o)+"px",d=(l?o:a)+"px";if(this._deletePercentSize(),this._applySize(o+"px",a+"px",""),n.style.width=c,n.style.height=t.caption||t.inlineCover?"":d,l){h=90===s||-270===s?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=h,this._setRotate(r,s,n.x,n.y),r.style.maxWidth=l?"none":"",this._setCaptionPosition(r)}finally{this.__preventSizechange=!1}}_setFigureInfo(t){this._inlineCover=t.inlineCover,this._cover=t.cover||this._inlineCover,this._container=t.container,this._caption=t.caption,this._element=t.target,this.align=(this._container.className.match(/(?:^|\s)__se__float-(none|left|center|right)(?:$|\s)/)||[])[1]||t.target.style.float||"none",this.as=this._inlineCover?"inline":"block",this.isVertical=/^(90|270)$/.test(Math.abs(this.#x(t.target).r).toString())}_setRotate(t,e,i,s){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(i||s))switch(o=i?"Y":"X",e+""){case"90":o=i&&s?"X":s?o:"";break;case"270":n*=-1,o=i&&s?"Y":i?o:"";break;case"-90":o=i&&s?"Y":i?o:"";break;case"-270":n*=-1,o=i&&s?"X":s?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(i?" rotateX("+i+"deg)":"")+(s?" rotateY("+s+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,i){const s=/^(rw|lw)$/.test(i)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(i)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=mt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||s||n||this._deletePercentSize();const o=this._cover||this._element;this.autoRatio&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),s||(e=mt.is(e)?e+this.sizeUnit:e,o.style.height=this._element.style.height=this.autoRatio&&!this.isVertical?"100%":e,this.autoRatio&&(this._cover.style.height=e,this.__setCoverPaddingBottom(t,e))),"center"===this.align&&this.setAlign(this._element,this.align),this._saveCurrentSize()}__setCoverPaddingBottom(t,e){this._inlineCover!==this._cover&&(this._cover.style.height=e,/%$/.test(t)&&"center"===this.align?this._cover.style.paddingBottom=/%$/.test(e)?mt.get(mt.get(e,2)/100*mt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this._deletePercentSize(),this.autoRatio?this._setPercentSize("100%",this.autoRatio.current||this.autoRatio.default):(this._element.style.maxWidth="",this._element.style.width="",this._element.style.height="",this._cover.style.width="",this._cover.style.height=""),this.setAlign(this._element,this.align),this._saveCurrentSize()}_setPercentSize(t,e){e||(e=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e),e=!e||/%$/.test(e+"")||mt.get(e,0)?mt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):mt.is(e)?e+"%":e;const i=/%$/.test(e+"");this._container.style.width=String(mt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.options.get("strictMode").formatFilter?(this._inlineCover!==this._cover&&(this._cover.style.width="100%",this._cover.style.height=String(e)),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=String(this.autoRatio?"100%":i?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this._setCaptionPosition(this._element),this._saveCurrentSize()):this._saveCurrentSize()}_deletePercentSize(){this._cover.style.width="",this._cover.style.height="",this._container.style.width="",this._container.style.height="",gt.utils.removeClass(this._container,this._floatClassStr),gt.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setSize(this.__revertSize.w,this.__revertSize.h)}_setAlignIcon(){this.alignButton&>.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}_setAsIcon(){this.asButton&>.utils.changeElement(this.asButton.firstElementChild,this.icons[`as_${this.as}`])}_saveCurrentSize(){if(this.__preventSizechange)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.__revertSize.w=t[0],this.__revertSize.h=t[1];const e=this.getSize(this._element);this._element.setAttribute("width",e.w.replace("px","")),this._element.setAttribute("height",e.h.replace("px","")),this._element.setAttribute("data-se-size",e.w+","+e.h),this.autoRatio&&(this.autoRatio.current=/%$/.test(e.h)?e.h:"")}_setCaptionPosition(t){const e=gt.query.getEdgeChild(gt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop=(this.isVertical?t.offsetWidth-t.offsetHeight:0)+"px")}_deleteCaptionPosition(t){const e=gt.query.getEdgeChild(gt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}_displayResizeHandles(t){const e=t?"flex":"none";this.controller.form.style.display=e;const i=this.editor.frameContext.get("_figure"),s=i.handles;for(let t=0,i=s.length;t<i;t++)s[t].style.display=e;"none"===e?(gt.utils.addClass(i.main,"se-resize-ing"),this.__onResizeESCEvent=this.eventManager.addGlobalEvent("keydown",this.__containerResizingESC)):gt.utils.removeClass(i.main,"se-resize-ing")}_offResizeEvent(){this.component._removeDragEvent(),this.eventManager.removeGlobalEvent(this.__onContainerEvent),this.eventManager.removeGlobalEvent(this.__offContainerEvent),this.eventManager.removeGlobalEvent(this.__onResizeESCEvent),this._displayResizeHandles(!0),this.ui._offCurrentController(),this.ui.disableBackWrapper()}_setDragEvent(t){const e=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");gt.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",Qt.set("__dragHandler",e),Qt.set("__dragContainer",this._container),Qt.set("__dragCover",this._cover),Qt.set("__dragMove",this.#k.bind(this,e,t)),Qt.get("__dragMove")(),e.style.display="block"}#k(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+"px"}#w(t){t.stopPropagation(),t.preventDefault();const e=gt.query.getEventTarget(t),i=Qt.get("__figureInst"),s=i._resize_direction=e.classList[0];i._resizeClientX=t.clientX,i._resizeClientY=t.clientY,i.editor.frameContext.get("_figure").main.style.float=/l/.test(s)?"right":/r/.test(s)?"left":"none",this.ui.enableBackWrapper(ui[s]);const{w:n,h:o}=this.getSize(i._element);if(pi=gi=!1,mi=fi=0,!this.isVertical){const t=!n||/auto|%$/.test(n),e=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(s)&&t&&e?pi=!0:"lw|rw".includes(s)&&t&&(gi=!0),pi||gi){const t=i._cover||i._element;fi=t.offsetWidth,mi=pt.getWidthInPercentage(t,this.editor.frameContext.get("wysiwygFrame"))/100}}i.__onContainerEvent=i.eventManager.addGlobalEvent("mousemove",i.__containerResizing),i.__offContainerEvent=i.eventManager.addGlobalEvent("mouseup",i.__containerResizingOff),i._displayResizeHandles(!1);const l=this.editor.frameContext.get("_figure").display;l.style.display="block",gt.utils.changeTxt(l,n+" x "+o)}#f(t){const e=this._resize_direction,i=t.clientX,s=t.clientY;let n=this._element_w,o=this._element_h;const l=n+(/r/.test(e)?i-this._resizeClientX:this._resizeClientX-i),r=o+(/b/.test(e)?s-this._resizeClientY:this._resizeClientY-s),a=o/n*l,h=this.editor.frameContext.get("_figure").border;/t/.test(e)&&(h.style.top=o-(/h/.test(e)?r:a)+"px"),/l/.test(e)&&(h.style.left=n-l+"px"),/r|l/.test(e)&&(h.style.width=l+"px",n=l),/^(t|b)[^h]$/.test(e)?(h.style.height=a+"px",o=a):/^(t|b)h$/.test(e)&&(h.style.height=r+"px",o=r),this._resize_w=/h$/.test(e)?this._width:Math.round(n),this._resize_h=/w$/.test(e)?this._height:Math.round(o);const c=mi?this._resize_w/fi*mi*100:this._resize_w;gt.utils.changeTxt(this.editor.frameContext.get("_figure").display,mi?mt.get(c>100?100:c,2).toFixed(2)+"%":c+" x "+this._resize_h)}#_(){this._offResizeEvent();let t=this.isVertical?this._resize_h:this._resize_w,e=this.isVertical?this._resize_w:this._resize_h;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const i=this.editor.frameContext.get("wysiwygFrame").clientWidth-mt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+mt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;mt.get(t,0)>i&&(e=Math.round(e/t*i),t=i)}if(pi||gi){t=t/(this._cover||this._element).offsetWidth*mi*100;const e=mt.get(t>100?100:t,2)+"%";this._setPercentSize(e,gi?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.history.push(!1),this.component.select(this._element,this.kind)}#b(t){ft.isEsc(t.code)&&(this._offResizeEvent(),this.component.select(this._element,this.kind))}#u(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.component.select(this._element,this.kind)}#p(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#g(t){if("auto"===t)this.deleteTransform(),this._setAutoSize();else{let e=this.getSize(this._element).h;if(this.isVertical){const t=(this._element.getAttribute("data-se-size")||",").split(",");t[1]&&(e=t[1])}this.deleteTransform(),this._setPercentSize(1*t,null!==mt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.component.select(this._element,this.kind)}#m(){this.editor.frameContext.get("_figure").main.style.display="none",this.editor._figureContainer=null}#y(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#v(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#C(){const t=this.getSize(this._element),e=t.w,i=t.h;let s="";if(this.autoRatio){if(i===this.autoRatio.default&&/%$/.test(e)){const t=mt.get(e);s=100===t?"auto":"resize_percent"+t}}else"auto"===i&&("auto"===e?s="auto":/%$/.test(e)&&(s="resize_percent"+mt.get(e)));this.selectMenu_resize.open("",'[data-command="'+s+'"]')}#x(t){const e=t.style.transform;return e?{r:Number((e.match(/rotate\(([-0-9]+)deg\)/)||[])[1]||0),x:(e.match(/rotateX\(([-0-9]+)deg\)/)||[])[1]||"",y:(e.match(/rotateY\(([-0-9]+)deg\)/)||[])[1]||""}:{r:0,x:"",y:""}}}function bi(t){const e=t.split("_"),i=e[0],s=e[1];let n,o,l,r;switch(i){case"resize":n="onresize",o=s,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===s?-90:"r"===s?90:mt.get(s),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=s,l="h"===s?"mirrorHorizontal":"mirrorVertical",r="h"===s?"mirror_horizontal":"mirror_vertical";break;case"align":n="onalign",l="align",r="align_justify";break;case"caption":n="caption",l="caption",r="caption";break;case"revert":n="revert",l="revert",r="revert";break;case"edit":n="edit",l="edit",r="edit";break;case"as":n="onas",l="blockStyle",r="as_block";break;case"copy":n="copy",l="copy",r="copy";break;case"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:undefined,i:r}:null}const yi=_i,{_w:vi,ON_OVER_COMPONENT:Ci,isMobile:wi}=dt,xi=/^Arrow(Left|Up|Right|Down)$/,ki=/^Arrow(Left|Up)$/;function Ei(t){Jt.call(this,t),this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.__globalEvents={copy:Ai.bind(this),cut:Bi.bind(this),keydown:Ii.bind(this),mousedown:Ni.bind(this)},this._bindClose_copy=null,this._bindClose_cut=null,this._bindClose_keydown=null,this._bindClose_mousedown=null,this._bindClose_touchstart=null,this.__selectionSelected=!1,this.__prevent=!1,this.editor.applyFrameRoots((t=>{const e=gt.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.icons.selection);t.get("wrapper").appendChild(e),this.eventManager.addEvent(e,"mouseenter",Si.bind(this)),this.eventManager.addEvent(e,"mouseleave",Ti.bind(this)),this.eventManager.addEvent(e,"dragstart",Hi.bind(this)),this.eventManager.addEvent(e,"dragend",Li.bind(this)),this.eventManager.addEvent(e,"click",Mi.bind(this))}))}function Si(){this.editor._preventBlur=!0,this.ui._visibleControllers(!1,gt.utils.hasClass(Qt.get("__dragHandler"),"se-drag-handle-full")),gt.utils.addClass(Qt.get("__dragCover")||Qt.get("__dragContainer"),"se-drag-over")}function Ti(){this.editor._preventBlur=!1,gt.utils.hasClass(Qt.get("__dragHandler"),"se-drag-handle-full")||this.ui._visibleControllers(!0,!0),gt.utils.removeClass([Qt.get("__dragCover"),Qt.get("__dragContainer")],"se-drag-over")}function Hi(t){const e=Qt.get("__dragCover")||Qt.get("__dragContainer");e?(this.editor._preventBlur=!1,gt.utils.addClass(Qt.get("__dragHandler"),"se-dragging"),gt.utils.addClass(Qt.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.options.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}function Li(){this.editor._preventBlur=!1,gt.utils.removeClass([Qt.get("__dragHandler"),Qt.get("__dragContainer")],"se-dragging"),this._removeDragEvent()}function Mi(t){const e=gt.query.getEventTarget(t);if(!gt.utils.hasClass(e,"se-drag-handle-full"))return;const i=Qt.get("__dragInst");this._removeDragEvent(),this.select(i.currentTarget,i.currentPluginName)}function Ni(t){const e=gt.query.getEventTarget(t);this.currentTarget?.contains(e)||gt.query.getParentElement(e,".se-controller")||gt.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.editor.currentControllerName&&this.editor.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}function Ai(t){const e=gt.query.getEventTarget(t);if(gt.check.isInputElement(e)&>.query.getParentElement(e,".se-modal"))return;const i=this.info;if(!i)return;const s=i.container.cloneNode(!0);gt.utils.removeClass(s,"se-component-selected"),"function"==typeof this.plugins[i.pluginName]?.onCopyComponent&&!1!==this.plugins[i.pluginName].onCopyComponent({event:t,cloneContainer:s,info:i})||Vi(t,s,t.clipboardData),gt.utils.flashClass(i.container,"se-copy")}function Bi(t){const e=this.info;if(!e)return;const i=e.container.cloneNode(!0);gt.utils.removeClass(i,"se-component-selected"),Vi(t,i,t.clipboardData),this.deselect(),gt.utils.removeItem(e.container)}async function Ii(t){if(this.editor.selectMenuOn)return;const e=t.code;if(ft.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const i=this.editor.shortcutsKeyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(i?.c)&&(t.preventDefault(),t.stopPropagation(),this.editor.run(i.c,i.t,i.e))}}else{if(ft.isRemoveKey(e)&&(t.preventDefault(),t.stopPropagation(),"function"==typeof this.currentPlugin?.destroy))return await this.currentPlugin.destroy(this.currentTarget),this.deselect(),void this.editor.focus();if(ft.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),i=e.container||e.target,s=i.previousElementSibling||i.nextElementSibling;let n=null;n=gt.check.isListCell(i.parentNode)?gt.utils.createElement("BR"):gt.utils.createElement(this.format.isLine(s)?s.nodeName:this.options.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),i.parentNode.insertBefore(n,i),!1===this.select(e.target,o)&&this.editor.blur(),void this.history.push(!1)}if(xi.test(e)){const{container:i}=this.get(this.currentTarget);let s=null,n=1;if(this.isInline(i||this.currentTarget))switch(e){case"ArrowLeft":s=i.previousSibling,n=3===s?.nodeType?s.textContent.length:1;break;case"ArrowRight":s=i.nextSibling,n=0;break;case"ArrowUp":{const t=this.format.getLine(i,null);s=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.format.getLine(i,null);s=t?.nextElementSibling;break}}else ki.test(e)?s=i.previousElementSibling:(s=i.nextElementSibling,n=0);if(!s)return;this.deselect();const o=this.get(s);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.editor._preventBlur=!0,t.stopPropagation(),t.preventDefault(),this.selection.setRange(s,n,s,n)}finally{this.editor._preventBlur=!1}}else ft.isEsc(e)&&this.deselect()}}function Vi(t,e,i){t.preventDefault(),t.stopPropagation(),e.querySelectorAll(".se-figure-selected").forEach((t=>gt.utils.removeClass(t,"se-figure-selected"))),i.setData("text/html",e.outerHTML)}Ei.prototype={insert(t,{skipCharCount:e,skipSelection:i,skipHistory:s}={}){if(this.editor.frameContext.get("isReadOnly")||!e&&!this.char.check(t))return null;const n=this.html.remove(),o=this.isInline(t);this.selection.getRangeAndAddLine(this.selection.getRange(),n.container);const l=this.selection.getNode();let r=null,a=this.format.getLine(l,null);if(gt.check.isListCell(a))this.html.insertNode(t,{afterNode:o||l===a?null:n.container.nextSibling,skipCharCount:!0}),o||t.nextSibling||t.parentNode.appendChild(gt.utils.createElement("BR"));else{if(!o&&this.selection.getRange().collapsed&&(3===n.container.nodeType||gt.check.isBreak(n.container))){const t=gt.query.getParentElement(n.container,this.format.isBlock.bind(this.format));r=this.nodeTransform.split(n.container,n.offset,t?gt.query.getNodeDepth(t)+1:0),r&&(a=r.previousSibling)}this.html.insertNode(t,{afterNode:o||this.format.isBlock(a)?null:a,skipCharCount:!0}),!o&&a&>.check.isZeroWidth(a)&>.utils.removeItem(a)}if(o){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}if(s||this.history.push(!1),!i){this.selection.setRange(t,0,t,0);const e=this.get(t);e?this.select(e.target,e.pluginName):r&&(r=gt.query.getEdgeChildNodes(r,null).sc||r,this.selection.setRange(r,0,r,0))}return this.editor.frameContext.has("documentType-use-header")&&this.editor.frameContext.get("documentType").reHeader(),r||t},get(t){if(!t)return null;let e,i="",s={},n=!1,o=null;if(this.is(t)){if(gt.utils.hasClass(t,"se-component")&&!gt.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!n)return null;e=n.target,i=n.pluginName,s=n.options,o=n.launcher}if(!e&&t.nodeName){this.__isFiles(t)&&(n=!0);const l=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!l)return null;e=l.target,i=l.pluginName,s=l.options,o=l.launcher}if(!e)return null;const l=yi.GetContainer(e),r=l.container||l.cover||e;return this.info={target:e,pluginName:i,options:s,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:gt.utils.hasClass(r,"se-input-component")}},select(t,e,{isInput:i=!1}={}){const s=this.get(t);if(!s||gt.check.isUneditable(gt.query.getParentElement(t,this.is.bind(this)))||gt.check.isUneditable(t))return!1;const n=s.launcher||this.plugins[e];if(!n)return;const o=Qt.get("__overInfo")!==Ci;if(!i&&o){if(this.editor.status._onMousedown)return;this.editor._preventBlur=!0,this.__selectionSelected=!0,this.isInline(s.container)&&this.selection.setRange(s.container,0,s.container,0),this.editor.blur(),vi.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.select&&(l=n.select(t));const r=gt.utils.hasClass(s.target,"se-component-line-break");(r||!l&&!gt.utils.hasClass(s.container,"se-inline-component"))&&this._setComponentLineBreaker(s.container||s.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=s,Qt.set("__dragInst",this);const a=Qt.get("__overInfo");if(vi.setTimeout((()=>{Qt.set("__overInfo",a===Ci&&void 0),a!==Ci&&this.__addGlobalEvent(),s.isFile||this.__addNotFileGlobalEvent()}),0),pt.debounce((()=>{gt.utils.addClass(s.container,"se-component-selected")}),0)(),!o||this.status.hasFocus||this.editor._preventFocus||(this.eventManager.__postFocusEvent(this.editor.frameContext,null),this.editor._preventFocus=!0),r||a===Ci){if(r||!gt.utils.hasClass(s.container,"se-input-component")){const t=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");gt.utils.addClass(t,"se-drag-handle-full"),this.ui._visibleControllers(!1,!1);const e=s.caption?s.target:s.cover||s.container||s.target,i=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.offset.getLocal(e);t.style.opacity=0,t.style.width=i+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",Qt.set("__dragHandler",t),Qt.set("__dragContainer",s.container),Qt.set("__dragCover",s.cover),t.style.display="block"}}else{if(!this.isInline(s.container))return;const t=s.container;let e=null;t.previousSibling&&!gt.check.isBreak(t.previousSibling)||(e=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!gt.check.isBreak(t.nextSibling)||(e=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.editor.status.onSelected=!0}},deselect(){vi.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__deselect(),this.ui.setControllerOnDisabledButtons(!1),!this.editor._preventFocus||this.status.hasFocus||this.__prevent||(this.eventManager.__postBlurEvent(this.editor.frameContext,null),this.editor._preventFocus=!1)},is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!gt.utils.hasClass(t,"se-component"))||!!this.editor._componentManager.find((e=>e(t))))},isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),gt.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.editor._componentManager.find((e=>e(t)))||!gt.utils.hasClass(t,"se-inline-component"))},isBasic(t){return this.is(t)&&!this.isInline(t)},copy(t){const e=gt.utils.clone(t,!0);gt.utils.removeClass(e,"se-component-selected"),gt.utils.removeClass(e.querySelectorAll(".se-figure-selected"),"se-figure-selected"),gt.utils.removeClass(e.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),gt.utils.removeClass(e.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus"),this.html.copy(e),gt.utils.flashClass(t,"se-copy")},__isFiles(t){const e=t.nodeName.toLowerCase();return this.editor._fileManager.regExp.test(e)&&(!this.editor._fileManager.tagAttrs[e]||this.editor._fileManager.tagAttrs[e]?.every((e=>t.hasAttribute(e))))},__deselect(){if(this.editor._preventBlur=!1,Qt.set("__overInfo",null),this._removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;pt.debounce((()=>{gt.utils.removeClass(t,"se-component-selected"),gt.utils.removeClass(e,"se-figure-over-selected")}),0)()}const{frameContext:t}=this.editor;t.get("lineBreaker_t").style.display=t.get("lineBreaker_b").style.display="none",this.currentPlugin&&"function"==typeof this.currentPlugin.deselect&&this.currentPlugin.deselect(this.currentTarget),this.isSelected=!1,this.currentPlugin=null,this.currentTarget=null,this.currentPluginName="",this.currentInfo=null,this.__removeGlobalEvent(),this.ui.__offControllers()},_setComponentLineBreaker(t){const e=Qt.get("__overInfo")===Ci;this.eventManager._lineBreakComp=null;const i=this.get(t);if(!i)return;const s=this.editor.frameContext,n=i.container,o=gt.utils.hasClass(n,"se-flex-component"),l=s.get("lineBreaker_t"),r=s.get("lineBreaker_b"),a=l.style,h=r.style,c=n.offsetWidth<t.offsetWidth?n:t,d="block"===this.editor._figureContainer?.style.display?this.editor._figureContainer:c,u=gt.check.isListCell(n.parentNode);let p,g;const m=this.options.get("_rtl"),f=m?["right","left"]:["left","right"],{top:_,left:b,right:y,scrollX:v,scrollY:C}=this.offset.getLocal(c),w=m?y:b;if(u?n.previousSibling:this.format.isLine(n.previousElementSibling))a.display="none";else{const t=vi.getComputedStyle(l),i=mt.get(t.height,1),s=mt.get(t.width,1);this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2,a.top=p-C-i/2+"px",a[f[0]]=(o?w-s/2:w+g)+"px",a[f[1]]="",l.setAttribute("data-offset",C+","+v),e?gt.utils.removeClass(l,"se-on-selected"):gt.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}if(u?n.nextSibling:this.format.isLine(n.nextElementSibling))h.display="none";else{const t=vi.getComputedStyle(r),i=mt.get(t.height,1),s=mt.get(t.width,1);p||(this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-C-i/2+"px",h[f[0]]=w+d.offsetWidth-(o?0:g)-(o?s/2:s)+"px",h[f[1]]="",r.setAttribute("data-offset",C+","+f[0]+","+v),e?gt.utils.removeClass(r,"se-on-selected"):gt.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}},__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_copy=this.eventManager.addGlobalEvent("copy",this.__globalEvents.copy),this._bindClose_cut=this.eventManager.addGlobalEvent("cut",this.__globalEvents.cut),this._bindClose_keydown=this.eventManager.addGlobalEvent("keydown",this.__globalEvents.keydown)},__removeGlobalEvent(){this.__removeNotFileGlobalEvent(),this._bindClose_copy&&(this._bindClose_copy=this.eventManager.removeGlobalEvent(this._bindClose_copy)),this._bindClose_cut&&(this._bindClose_cut=this.eventManager.removeGlobalEvent(this._bindClose_cut)),this._bindClose_keydown&&(this._bindClose_keydown=this.eventManager.removeGlobalEvent(this._bindClose_keydown))},__addNotFileGlobalEvent(){this.__removeNotFileGlobalEvent(),wi?this._bindClose_touchstart=this.eventManager.addGlobalEvent("touchstart",this.__globalEvents.mousedown,!0):this._bindClose_mousedown=this.eventManager.addGlobalEvent("mousedown",this.__globalEvents.mousedown,!0)},__removeNotFileGlobalEvent(){this._bindClose_mousedown&&(this._bindClose_mousedown=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)),this._bindClose_touchstart&&(this._bindClose_touchstart=this.eventManager.removeGlobalEvent(this._bindClose_touchstart))},_removeDragEvent(){this.carrierWrapper.querySelector(".se-drag-cursor").style.left="-10000px",Qt.get("__dragHandler")&&(Qt.get("__dragHandler").style.display="none"),gt.utils.removeClass([Qt.get("__dragHandler"),Qt.get("__dragContainer")],"se-dragging"),gt.utils.removeClass([Qt.get("__dragCover"),Qt.get("__dragContainer")],"se-drag-over"),Qt.set("__figureInst",null),Qt.set("__dragInst",null),Qt.set("__dragHandler",null),Qt.set("__dragContainer",null),Qt.set("__dragCover",null),Qt.set("__dragMove",null),Qt.set("__overInfo",null)},constructor:Ei};const Oi=Ei;function Ri(t){Jt.call(this,t),this._listCamel=this.options.get("__listCommonStyle"),this._listKebab=pt.camelToKebabCase(this.options.get("__listCommonStyle")),this._formatLineCheck=this.options.get("formatLine").reg,this._formatBrLineCheck=this.options.get("formatBrLine").reg,this._formatBlockCheck=this.options.get("formatBlock").reg,this._formatClosureBlockCheck=this.options.get("formatClosureBlock").reg,this._formatClosureBrLineCheck=this.options.get("formatClosureBrLine").reg,this._textStyleTagsCheck=new RegExp("^("+this.options.get("textStyleTags")+")$","i"),this._brLineBreak=null,this.__resetBrLineBreak(this.options.get("defaultLineBreakFormat"))}function zi(t){const e=t.parentNode;let i,s,n,o,l,r=e.parentNode,a=e;for(;gt.check.isListCell(r);){for(o=gt.query.getPositionIndex(t),i=r.nextElementSibling,s=r.parentNode,n=a;n;){if(a=a.nextSibling,gt.check.isList(n)){for(l=n.childNodes;l[o];)s.insertBefore(l[o],i);0===l.length&>.utils.removeItem(n)}else s.appendChild(n);n=a}r=s.parentNode}return 0===e.children.length&>.utils.removeItem(e),s}function $i(t,e,i){const s=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],gt.check.isListCell(n)?(e<0||n.previousElementSibling)&&s.push(n):(o=/\d+/.test(n.style[i])?mt.get(n.style[i],0):0,o+=e,gt.utils.setStyle(n,i,o<=0?"":o+"px"));return s}function Fi(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const i=t.childNodes;for(;i[0];)e.insertBefore(i[0],t);e.removeChild(t)}Ri.prototype={setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this._lineWork(),i=e.lines,s=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===s||this.component.is(e)||(r=t.cloneNode(!1),gt.utils.copyFormatAttributes(r,e),r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e)),0===a&&(o=r||e),a===h-1&&(l=r||e),r=null;this.selection.setRange(gt.query.getNodeFromPath(e.firstPath,o),e.startOffset,gt.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.history.push(!1),this.editor.frameContext.has("documentType-use-header")&&this.editor.frameContext.get("documentType").reHeader()},getLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBlock(t))return t.firstElementChild;if(this.isLine(t)&&e(t))return t;t=t.parentNode}return null},setBrLine(t){if(!this.isBrLine(t))throw new Error('[SUNEDITOR.format.setBrLine.fail] The "element" must satisfy "format.isBrLine()".');const e=this._lineWork().lines,i=e.length-1;let s=e[i].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,h,c,d=i,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(c=this.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=gt.query.getParentElement(o,(t=>t.parentNode===s)),(s!==o.parentNode||c)&&(this.isLine(s)?(s.parentNode.insertBefore(n,s.nextSibling),s=s.parentNode):(s.insertBefore(n,r?r.nextSibling:null),s=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&>.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,gt.utils.removeItem(a)),n=t.cloneNode(!1),u=!0),h=n.innerHTML,n.innerHTML=(u||!l||!h||/<br>$/i.test(l)?l:l+"<BR>")+h,0===d){s.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&>.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,gt.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&>.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,gt.utils.removeItem(n))}c||gt.utils.removeItem(o),l&&(u=!1)}this.selection.setRange(o,0,o,0),this.history.push(!1)},getBrLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBrLine(t)&&e(t))return t;t=t.parentNode}return null},addLine(t,e){if(!t||!t.parentNode)return null;const i=this.getLine(this.selection.getNode(),null);let s=null;if(this.isBrLine(t)||!this.isBrLine(i||t.parentNode)||this.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isLineOnly(i)?i.nodeName:this.options.get("defaultLine");s=gt.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(i))&>.utils.copyTagAttributes(s,e||i,["id"])}else s=gt.utils.createElement("BR");return gt.check.isTableCell(t)?t.insertBefore(s,t.nextElementSibling):t.parentNode.insertBefore(s,t.nextElementSibling),s},getBlock(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBlock(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&e(t))return t;t=t.parentNode}return null},applyBlock(t){this.selection.getRangeAndAddLine(this.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,i,s,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],gt.check.isListCell(t))if(i=t.lastElementChild,i&>.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=i.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(gt.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}s=i.firstElementChild,o=e.indexOf(s),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const i=e[e.length-1];let s,n,o;s=this.isBlock(i)||this.isLine(i)?i:this.getBlock(i,null)||this.getLine(i,null),gt.check.isTableCell(s)?(n=null,o=s):(n=s.nextSibling,o=s.parentNode);const l=t.cloneNode(!1);let r=gt.query.getNodeDepth(s),a=null;const h=[],c=(t,e,i)=>{let s=null;if(t!==e&&!gt.check.isTableElements(e)){if(e&>.query.getNodeDepth(t)===gt.query.getNodeDepth(e))return i;s=this.nodeTransform.removeAllParents(e,null,t)}return s?s.ec:i};for(let t,i,s,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],i=t.parentNode,i&&!l.contains(i))if(s=gt.query.getNodeDepth(t),gt.check.isList(i)){if(null===a&&(p?(a=p,g=!0,p=null):a=i.cloneNode(!1)),h.push(t),u=e[m+1],m===f-1||u?.parentNode!==i){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=i.parentNode;for(;gt.check.isList(m);)e=gt.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(i,{selectedFormats:h,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=s?(r=s,o=f.cc,n=c(o,i,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=c(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)a.appendChild(f.removeArray[t]);g||l.appendChild(a),p&&f.removeArray[f.removeArray.length-1].appendChild(p),a=null,g=!1}}else r>=s&&(r=s,o=i,n=t.nextSibling),l.appendChild(t),o!==i&&(d=c(o,i),void 0!==d&&(n=d));if(this.editor.effectNode=null,this.nodeTransform.mergeSameTags(l,null,!1),this.nodeTransform.mergeNestedTags(l,(t=>gt.check.isList(t))),n&>.query.getNodeDepth(n)>0&&(gt.check.isList(n.parentNode)||gt.check.isList(n.parentNode.parentNode))){const t=gt.query.getParentElement(n,(t=>this.isBlock(t)&&!gt.check.isList(t))),e=this.nodeTransform.split(n,null,t?gt.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=gt.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.history.push(!1)},removeBlock(t,{selectedFormats:e,newBlockElement:i,shouldDelete:s,skipHistory:n}={}){const o=this.selection.getRange();let l=o.startOffset,r=o.endOffset,a=gt.query.getListChildNodes(t,(e=>e.parentNode===t)),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=gt.check.isList(i);let m=!1,f=!1,_=!1;const b=(e,i,s,n)=>{if(gt.check.isZeroWidth(i)&&(i.innerHTML=ut.zeroWidthSpace,l=r=1),3===i.nodeType)return e.insertBefore(i,s),i;const o=(_?i:n).childNodes;let a=i.cloneNode(!1),h=null,c=null;for(;o[0];)c=o[0],!this._notTextNode(c)||gt.check.isBreak(c)||gt.check.isListCell(a)?a.appendChild(c):(a.childNodes.length>0&&(h||(h=a),e.insertBefore(a,s),a=i.cloneNode(!1)),e.insertBefore(c,s),h||(h=c));if(a.childNodes.length>0){if(gt.check.isListCell(e)&>.check.isListCell(a)&>.check.isList(s))if(g){for(h=s;s;)a.appendChild(s),s=s.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,i=this._removeNestedList(n,!1);if(t!==i||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=i,f=!0}}else e.insertBefore(a,s);h||(h=a)}return h};for(let n,o,l,r=0,y=a.length;r<y;r++)if(n=a[r],3!==n.nodeType||!gt.check.isList(u))if(_=!1,s&&0===r&&(c=e&&e.length!==y&&e[0]!==n?u:t.previousSibling),e&&(o=e.indexOf(n)),e&&-1===o)u||(u=t.cloneNode(!1)),u.appendChild(n);else{if(e&&(l=e[o+1]),u&&u.children.length>0&&(h.insertBefore(u,t),u=null),!g&>.check.isListCell(n))if(l&>.query.getNodeDepth(n)!==gt.query.getNodeDepth(l)&&(gt.check.isListCell(h)||gt.utils.arrayFind(n.children,gt.check.isList))){const e=n.nextElementSibling,i=this._removeNestedList(n,!1);t===i&&e===n.nextElementSibling||(t=i,f=!0)}else{const e=n;n=gt.utils.createElement(s?e.nodeName:gt.check.isList(t.parentNode)||gt.check.isListCell(t.parentNode)?"LI":gt.check.isTableCell(t.parentNode)?"DIV":this.options.get("defaultLine"));const i=gt.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!gt.check.isList(o[0])||i);)n.appendChild(o[0]);gt.utils.copyFormatAttributes(n,e),_=!0}else n=n.cloneNode(!1);if(!f&&(s?(p.push(n),gt.utils.removeItem(a[r])):(i?(m||(h.insertBefore(i,t),m=!0),n=b(i,n,null,a[r])):n=b(h,n,t,a[r]),f||(e?(d=n,c||(c=n)):c||(c=d=n))),f)){f=_=!1,a=gt.query.getListChildNodes(t,(e=>e.parentNode===t)),u=t.cloneNode(!1),h=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let v=t.nextSibling;u?.children.length>0&&y.insertBefore(u,v),i?c=i.previousSibling:c||(c=t.previousSibling),v=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?gt.utils.removeItem(t):this.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(s)C={cc:y,sc:c,so:l,ec:v,eo:r,removeArray:p};else{c||(c=d),d||(d=c);const t=gt.query.getEdgeChildNodes(c,d.parentNode?c:d);C={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}}if(this.editor.effectNode=null,n)return C;!s&&C&&(e?this.selection.setRange(C.sc,l,C.ec,r):this.selection.setRange(C.sc,0,C.sc,0)),this.history.push(!1)},applyList(t,e,i){const s=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.selection.getRange(),l=e||this.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.selection.getRangeAndAddLine(o,null),l=this.getLinesAndComponents(!1),0===l.length)return}gt.query.sortNodeByDepth(l,!0);const r=l[0],a=l[l.length-1];let h=!gt.check.isListCell(r)&&!this.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!gt.check.isListCell(a)&&!this.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&>.check.isZeroWidth(o.startContainer)&&0===o.startOffset&&1===o.endOffset?o.endOffset:o.startOffset,ec:o.endContainer,eo:o.endOffset};let p=null,g=!0;for(let t=0,e=l.length;t<e;t++)if(!gt.check.isList(this.getBlock(l[t],(e=>this.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||h&&r.tagName===h.tagName&&s===h.tagName.toUpperCase()||c&&a.tagName===c.tagName&&s===c.tagName.toUpperCase()){const t=h?h.parentNode:h,e=c?c.parentNode:c;h=t&&!gt.check.isWysiwygFrame(t)&&t.nodeName===s?t:h,c=e&&!gt.check.isWysiwygFrame(e)&&e.nodeName===s?e:c;const i=h?.tagName===s,o=c?.tagName===s;let r=i?h:gt.utils.createElement(s,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!this.component.is(t)&&!gt.check.isList(t);for(let t,e,o,h,c,p,g,m,f,_=0,b=l.length;_<b;_++)if(e=l[_],0!==e.childNodes.length||this._isIgnoreNodeChange(e)){if(h=l[_+1],c=e.parentNode,p=h?h.parentNode:null,o=gt.check.isListCell(e),f=this.isBlock(c)?c:null,g=o&&!gt.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!gt.check.isWysiwygFrame(c)?!h||gt.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=gt.utils.createElement("LI"),gt.utils.copyFormatAttributes(t,e),this.component.is(e)){const i=/^HR$/i.test(e.nodeName);i||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,i&&(t.innerHTML+="<br>")}else{const i=e.childNodes;for(;i[0];)t.appendChild(i[0])}r.appendChild(t),h&&g===p&&!this.isBlock(m)||(a||(a=r),i&&h&&g===p||h&>.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),gt.utils.removeItem(e),i&&null===d&&(d=r.children.length-1),h&&(this.getBlock(p,u)!==this.getBlock(c,u)||gt.check.isList(p)&>.check.isList(c)&>.query.getNodeDepth(p)!==gt.query.getNodeDepth(c))&&(r=gt.utils.createElement(s,{style:"list-style-type: "+n})),0===f?.children.length&>.utils.removeItem(f)}else gt.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,gt.utils.removeItem(c))}else{if(i)for(let t=0,e=l.length;t<e;t++)for(let i=t-1;i>=0;i--)if(l[i].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.getBlock(r),e=t?.tagName===s;let o,a;const h=t=>!this.component.is(t);e||(a=gt.utils.createElement(s,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.getBlock(l[c],h),r&>.check.isList(r)&&(t?t!==r?(i&>.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=gt.utils.createElement(s,{style:"list-style-type: "+n})),t=r,o={r:t,f:[gt.query.getParentElement(l[c],"LI")]}):o.f.push(gt.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[gt.query.getParentElement(l[c],"LI")]}),c===d-1&&(i&>.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.editor.effectNode=null,g&&d&&p||u},removeList(t,e){let i={},s=!1,n=!1,o=null,l=null;const r=t=>!this.component.is(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.getBlock(t[u],r),d=gt.check.isList(h),!a&&d)a=h,i={r:a,f:[gt.query.getParentElement(t[u],"LI")]},0===u&&(s=!0);else if(a&&d)if(a!==h){const r=this.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});h=t[u].parentNode,s&&(o=r.sc,s=!1),c&&(l=r.ec),d?(a=h,i={r:a,f:[gt.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else i.f.push(gt.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&>.check.isList(a)){const t=this.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),s&&(o=t.sc||l)}}return{sc:o,ec:l}},indent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=$i(this.getLines(null),this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this._applyNestedList(o,!1),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},outdent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=$i(this.getLines(null),-1*this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this._applyNestedList(o,!0),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},applyInlineElement(t,{stylesToModify:e,nodesToRemove:i,strictRemove:s}={}){if(gt.query.getParentElement(this.selection.getNode(),gt.check.isNonEditable))return;this.selection._resetRangeToTextNode();let n=this.selection.getRangeAndAddLine(this.selection.getRange(),null);e=e?.length>0?e:null,i=i?.length>0?i:null;const o=!t,l=o&&!i&&!e;let r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset;if(l&&n.collapsed&&this.isLine(r.parentNode)&&this.isLine(h.parentNode)||r===h&&1===r.nodeType&>.check.isNonEditable(r)){const t=r.parentNode;return void(!gt.check.isListCell(t)||pt.getValues(t.style).some((t=>this._listKebab.includes(t))))}if(n.collapsed&&!l&&1===r.nodeType&&!gt.check.isBreak(r)&&!this.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?gt.check.isBreak(e)?e:e.nextSibling:null);const i=gt.utils.createTextNode(ut.zeroWidthSpace);r.insertBefore(i,t),this.selection.setRange(i,1,i,1),n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=gt.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===h&&!i&&t){let e=r,i=0;const s=[],n=t.style;for(let t=0,e=n.length;t<e;t++)s.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)s.push("."+a[t]);if(s.length>0){for(;!this.isLine(e)&&!gt.check.isWysiwygFrame(e);){for(let t=0;t<s.length;t++)if(1===e.nodeType){const r=s[t],a=!!/^\./.test(r)&&new d("\\s*"+r.replace(/^\./,"")+"(\\s+|$)","ig"),h=e.style,c=e.className,u=o?!!h[r]:!!h[r]&&!!n[r]&&h[r]===n[r],p=!1!==a&&(o?!!c.match(a):!!c.match(a)&&!!l.match(a));(u||p)&&i++}e=e.parentNode}if(i>=s.length)return}}let p,g,m={},f={},_="",b="";if(e){for(let t,i=0,s=e.length;i<s;i++)t=e[i],/^\./.test(t)?b+=(b?"|":"\\s*(?:")+t.replace(/^\./,""):_+=(_?"|":"(?:;|^|\\s)(?:")+t;_&&(_+=")\\s*:[^;]*\\s*(?:;|$)",_=new d(_,"ig")),b&&(b+=")(?=\\s+|$)",b=new d(b,"ig"))}if(i){g="^(?:"+i[0];for(let t=1;t<i.length;t++)g+="|"+i[t];g+=")$",g=new d(g,"i")}const y={v:!1},v=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||gt.check.isBreak(e))return e;if(l)return null;const i=!g&&o||g?.test(e.nodeName);if(i&&!s)return y.v=!0,null;const n=e.style.cssText;let r="";_&&n.length>0&&(r=n.replace(_,"").trim(),r!==n&&(y.v=!0));const a=e.className;let h="";return b&&a.length>0&&(h=a.replace(b,"").trim(),h!==a&&(y.v=!0)),(!o||!b&&a||!_&&n||r||h||!i)&&(r||h||e.nodeName!==u||Boolean(_)!==Boolean(n)||Boolean(b)!==Boolean(a))?(_&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),b&&a.length>0&&(e.className=h.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!i?e:(y.v=!0,null)):(y.v=!0,null)},C=this.getLines(null);n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.getLine(r,null)||(r=gt.query.getEdgeChild(C[0],(function(t){return 3===t.nodeType}),!1),a=0),this.getLine(h,null)||(h=gt.query.getEdgeChild(C[C.length-1],(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const w=this.getLine(r,null)===this.getLine(h,null),x=C.length-(w?0:1);p=t.cloneNode(!1);const k=l||o&&function(t,e){for(let i=0,s=e.length;i<s;i++)if(t._isNonSplitNode(e[i]))return!0;return!1}(this,i),E=o||this._sn_isSizeNode(p),S=this._sn_getMaintainedNode.bind(this,k,E),T=this._sn_isMaintainedNode.bind(this,k,E);if(w){this._sn_resetCommonListCell(C[0],e)&&(n=this.selection.setRange(r,a,h,c));const t=this._setNode_oneLine(C[0],p,v,r,a,h,c,l,o,n.collapsed,y,S,T);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&>.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this._sn_setCommonListStyle(t.ancestor,null)}else{let i=!1;x>0&&this._sn_resetCommonListCell(C[x],e)&&(i=!0),this._sn_resetCommonListCell(C[0],e)&&(i=!0),i&&this.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this._setNode_endLine(C[x],p,v,h,c,l,o,y,S,T));for(let i,s=x-1;s>0;s--)this._sn_resetCommonListCell(C[s],e),p=t.cloneNode(!1),i=this._setNode_middleLine(C[s],p,v,l,o,y,f.container),i.endContainer&&i.ancestor.contains(i.endContainer)&&(f.ancestor=null,f.container=i.endContainer),this._sn_setCommonListStyle(i.ancestor,null);p=t.cloneNode(!1),m=this._setNode_startLine(C[0],p,v,r,a,l,o,y,S,T,f.container),m.endContainer&&(f.ancestor=null,f.container=m.endContainer),x<=0?f=m:f.container||(f.ancestor=null,f.container=m.container,f.offset=m.container.textContent.length),this._sn_setCommonListStyle(m.ancestor,null),this._sn_setCommonListStyle(f.ancestor||this.getLine(f.container),null)}return this.ui._offCurrentController(),this.selection.setRange(m.container,m.offset,f.container,f.offset),this.history.push(!1),p},removeInlineElement(){this.applyInlineElement(null,{stylesToModify:null,nodesToRemove:null,strictRemove:null})},isEdgeLine(t,e,i){if(!gt.check.isEdgePoint(t,e,i))return!1;let s=!1;const n="front"===i?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!gt.check.isWysiwygFrame(t);){if(t[n]&&(!gt.check.isBreak(t[n])||t[n][n]))return!1;s=!0,t=t.parentNode}return s},isTextStyleNode(t){return"string"==typeof t?this._textStyleTagsCheck.test(t):t&&1===t.nodeType&&this._textStyleTagsCheck.test(t.nodeName)},isLine(t){return!this.isBlock(t)&&("string"==typeof t?this._formatLineCheck.test(t):t&&1===t.nodeType&&(this._formatLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this._nonFormat(t))},isLineOnly(t){return this.isLine(t)&&(this._brLineBreak||!this.isBrLine(t))},isBrLine(t){return this._brLineBreak&&this.isLine(t)||("string"==typeof t?this._formatBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatBrLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__br_line_.+"))&&!this._nonFormat(t))},isBlock(t){return"string"==typeof t?this._formatBlockCheck.test(t):t&&1===t.nodeType&&(this._formatBlockCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__block_.+"))&&!this._nonFormat(t)},isClosureBlock(t){return"string"==typeof t?this._formatClosureBlockCheck.test(t):t&&1===t.nodeType&&(this._formatClosureBlockCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this._nonFormat(t)},isClosureBrLine(t){return"string"==typeof t?this._formatClosureBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatClosureBrLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this._nonFormat(t)},getLines(t){if(!this.selection._resetRangeToTextNode())return[];let e=this.selection.getRange();if(gt.check.isWysiwygFrame(e.startContainer)){const t=this.editor.frameContext.get("wysiwyg").children;if(0===t.length)return[];this.selection.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),e=this.selection.getRange()}const i=e.startContainer,s=e.endContainer,n=e.commonAncestorContainer,o=gt.query.getListChildren(n,(e=>t?t(e):this.isLine(e)));if(gt.check.isWysiwygFrame(n)||this.isBlock(n)||o.unshift(this.getLine(n,null)),i===s||1===o.length)return o;const l=this.getLine(i,null),r=this.getLine(s,null);let a=null,h=null;const c=function(t){return!gt.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);gt.check.isTableElements(d)&>.check.isListCell(d.parentNode)&&(d=d.parentNode),gt.check.isTableElements(u)&>.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,i=o.length;e<i;e++)if(t=o[e],l===t||!p&&t===d)a=e;else if(r===t||!p&&t===u){h=e;break}return null===a&&(a=0),null===h&&(h=o.length-1),o.slice(a,h+1)},getLinesAndComponents(t){const e=this.selection.getRange().commonAncestorContainer,i=gt.query.getParentElement(e,this.component.is.bind(this.component)),s=gt.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=gt.query.getParentElement(t,this.component.is.bind(this.component));return this.isLine(t)&&(!e||e===i)||this.component.is(t)&&!this.getLine(t)}));if(t)for(let t=0,e=s.length;t<e;t++)for(let i=t-1;i>=0;i--)if(s[i].contains(s[t])){s.splice(t,1),t--,e--;break}return s},_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.component.is(t)||/FIGURE/i.test(t.nodeName))},_nonFormat(t){return gt.check.isExcludeFormat(t)||this.component.is(t)||gt.check.isWysiwygFrame(t)},_isNonSplitNode(t){if(!t)return!1;const e=/^(a|label|code|summary)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&e.test(t.nodeName)},_notTextNode(t){if(!t)return!1;const e=/^(br|input|select|canvas|img|iframe|audio|video)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&(this.component.is(t)||e.test(t.nodeName))},_isIgnoreNodeChange(t){return t&&1===t.nodeType&&(gt.check.isNonEditable(t)||!this.isTextStyleNode(t)||this.component.is(t))},_lineWork(){let t=this.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const i=t.startOffset,s=t.endOffset;let n=e[0],o=e[e.length-1];const l=gt.query.getNodePath(t.startContainer,n,null),r=gt.query.getNodePath(t.endContainer,o,null),a=this.removeList(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.selection.setRange(gt.query.getNodeFromPath(l,n),i,gt.query.getNodeFromPath(r,o),s),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:i,endOffset:s}},_attachNested(t,e,i,s,n){let o=!1;if(e.tagName===i?.tagName){const t=e.children;for(;t[0];)i.appendChild(t[0]);e=i,o=!0}if(e.tagName===s?.tagName){const t=s.children;for(;t[0];)e.appendChild(t[0]);const i=s.nextElementSibling;s.parentNode.removeChild(s),s=i}if(!o){gt.check.isListCell(i)&&(t=i,s=null),t.insertBefore(e,s),n.s||(n.s=gt.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?gt.query.getNodePath(n.sl,t):null;n.e=gt.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.nodeTransform.mergeNestedTags(t),o&&(n.sl=gt.query.getNodeFromPath(o,t))}return e},_detachNested(t){const e=t[0],i=t[t.length-1],s=i.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,i=t.length;e<i;e++)l.insertBefore(t[e],o);if(s&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=gt.query.getPositionIndex(s);for(;e[o];)t.appendChild(e[o]);i.appendChild(t)}0===n.children.length&>.utils.removeItem(n),this.nodeTransform.mergeSameTags(l);const r=gt.query.getEdgeChildNodes(e,i);return{cc:e.parentNode,sc:r.sc,ec:r.ec}},_applyNestedList(t,e){const i=(t=t||this.getLines().filter((function(t){return gt.check.isListCell(t)}))).length;if(0===i||!e&&!gt.check.isListCell(t[0].previousElementSibling)&&!gt.check.isListCell(t[i-1].nextElementSibling))return{sc:t[0],so:0,ec:t[i-1],eo:1};let s=t[0].parentNode,n=t[i-1],o=null;if(e){if(s!==n.parentNode&>.check.isList(n.parentNode.parentNode)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.applyList(s.nodeName+":"+s.style.listStyleType,t,!0)}else{let e=gt.utils.createElement(s.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:s,el:s};for(let n,o=0,h=i;o<h;o++)n=t[o],n.parentNode!==s&&(this._attachNested(s,e,l,r,a),s=n.parentNode,e=gt.utils.createElement(s.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);this._attachNested(s,e,l,r,a);const h=gt.query.getNodeFromPath(a.s,a.sl),c=gt.query.getNodeFromPath(a.e,a.el);o={sc:h,so:0,ec:c,eo:c.textContent.length}}return o},_removeNestedList(t,e){const i=zi(t);let s,n,o;if(i){s=i.cloneNode(!1),n=i.childNodes;const e=gt.query.getPositionIndex(t);for(;n[e];)s.appendChild(n[e])}else s=t;if(e)o=gt.query.getListChildren(s,(t=>gt.check.isListCell(t)&&!t.previousElementSibling));else{const e=gt.query.getNodeDepth(t)+2;o=gt.query.getListChildren(t,(t=>gt.check.isListCell(t)&&!t.previousElementSibling&>.query.getNodeDepth(t)===e))}for(let t=0,e=o.length;t<e;t++)zi(o[t]);return i&&(i.parentNode.insertBefore(s,i.nextSibling),0===n?.length&>.utils.removeItem(i)),s===t?s.parentNode:s},_setNode_oneLine(t,e,i,s,n,o,l,r,a,h,c,d,u){let p=s.parentNode;for(;!(p.nextSibling||p.previousSibling||this.isLine(p.parentNode)||gt.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&p===o.parentNode&&p.nodeName===e.nodeName&>.check.isZeroWidth(s.textContent.slice(0,n))&>.check.isZeroWidth(o.textContent.slice(l))){const i=p.childNodes;let r=!1;for(let t,e,n,l,a=0,h=i.length;a<h;a++)if(t=i[a],l=!gt.check.isZeroWidth(t),t!==s)if(t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else n=!0;else e=!0;if(r)return gt.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l}}c.v=!1;const g=this,m=t,f=[e],_=t.cloneNode(!1),b=s===o;let y,v,C,w,x,k=s,E=n,S=o,T=l,H=!1,L=!1;const M=RegExp;function N(t){const e=new M("(?:;|^|\\s)(?:"+w+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let i=!1;return e&&t.style.cssText.length>0&&(i=e.test(t.style.cssText)),!i}if(function t(s,n){const o=s.childNodes;for(let s,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let c,p=n;if(!H&&a===k){let t=_;x=d(a);let o="",l="";if(3===k.nodeType){const t=k;o=t.substringData(0,E),l=t.substringData(E,b&&T>=E?T-E:t.data.length-E)}const r=gt.utils.createTextNode(o),h=gt.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}x=x.cloneNode(!1)}gt.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),v=a,y=[],w="";v!==t&&v!==m&&null!==v;)s=u(v)?null:i(v),s&&1===v.nodeType&&N(v)&&(y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;const p=y.pop()||h;for(C=v=p;y.length>0;)v=y.pop(),C.appendChild(v),C=v;if(e.appendChild(p),t.appendChild(e),x&&!d(S)&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),k=h,E=0,H=!0,v!==h&&v.appendChild(k),!b)continue}if(L||a!==S){if(H){if(1===a.nodeType&&!gt.check.isBreak(a)){g._isIgnoreNodeChange(a)?(_.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),_.appendChild(e),f.push(e))):t(a,a);continue}v=a,y=[],w="";const o=[];for(;null!==v.parentNode&&v!==m&&v!==e;)s=L?v.cloneNode(!1):i(v),1===v.nodeType&&!gt.check.isBreak(a)&&s&&N(v)&&(u(v)?x||o.push(s):y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;y=y.concat(o);const l=y.pop()||a;for(C=v=l;y.length>0;)v=y.pop(),C.appendChild(v),C=v;if(!u(e.parentNode)||u(l)||gt.check.isZeroWidth(e)||(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),L||x||!u(l))l===a?n=L?_:e:L?(_.appendChild(l),n=v):(e.appendChild(l),n=v);else{e=e.cloneNode(!1);const t=l.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);l.appendChild(e),_.appendChild(l),f.push(e),n=e.children.length>0?v:e}if(x&&3===a.nodeType)if(d(a)){const t=gt.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===_));x.appendChild(t),e=t.cloneNode(!1),f.push(e),_.appendChild(e)}else x=null}c=a.cloneNode(!1),n.appendChild(c),1!==a.nodeType||gt.check.isBreak(a)||(p=c),t(a,p)}else{x=d(a);let t="",n="";if(3===S.nodeType){const e=S;t=e.substringData(T,e.length-T),n=b?"":e.substringData(0,T)}const o=gt.utils.createTextNode(t),l=gt.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),!gt.check.isZeroWidth(o)){v=a,w="",y=[];const t=[];for(;v!==_&&v!==m&&null!==v;)1===v.nodeType&&N(v)&&(u(v)?t.push(v.cloneNode(!1)):y.push(v.cloneNode(!1)),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;for(y=y.concat(t),c=C=v=y.pop()||o;y.length>0;)v=y.pop(),C.appendChild(v),C=v;_.appendChild(c),v.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(v=a,y=[],w="";v!==_&&v!==m&&null!==v;)s=u(v)?null:i(v),s&&1===v.nodeType&&N(v)&&(y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;const p=y.pop()||l;for(C=v=p;y.length>0;)v=y.pop(),C.appendChild(v),C=v;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),_.appendChild(x),f.push(e),x=null):e.appendChild(p),S=l,T=l.data.length,L=!0,!r&&h&&(e=l,l.textContent=ut.zeroWidthSpace),v!==l&&v.appendChild(S)}}}(t,_),a&&!r&&!c.v)return{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l};if(r=r&&a)for(let t=0;t<f.length;t++){const e=f[t];let i,s,n;if(h)i=gt.utils.createTextNode(ut.zeroWidthSpace),_.replaceChild(i,e);else{const t=e.childNodes;for(s=t[0];t[0];)n=t[0],_.insertBefore(n,e);gt.utils.removeItem(e)}0===t&&(h?k=S=i:(k=s,S=n))}else{if(a)for(let t=0;t<f.length;t++)Fi(f[t]);h&&(k=S=e)}this.nodeTransform.removeEmptyNode(_,e,!1),h&&(E=k.textContent.length,T=S.textContent.length);const A=r||0===S.textContent.length;gt.check.isBreak(S)||0!==S.textContent.length||(gt.utils.removeItem(S),S=k),T=A?S.textContent.length:T;const B={s:0,e:0},I=gt.query.getNodePath(k,_,B),V=!S.parentNode;V&&(S=k);const O={s:0,e:0},R=gt.query.getNodePath(S,_,V||A?null:O);E+=B.s,T=h?E:V?k.textContent.length:A?T+B.s:T+O.s;const z=this.nodeTransform.mergeSameTags(_,[I,R],!0);return t.parentNode.replaceChild(_,t),k=gt.query.getNodeFromPath(I,_),S=gt.query.getNodeFromPath(R,_),{ancestor:_,startContainer:k,startOffset:E+z[0],endContainer:S,endOffset:T+z[1]}},_setNode_startLine(t,e,i,s,n,o,l,r,a,h,c){let d=s.parentNode;for(;!(d.nextSibling||d.previousSibling||this.isLine(d.parentNode)||gt.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&d.nodeName===e.nodeName&&!this.isLine(d)&&!d.nextSibling&>.check.isZeroWidth(s.textContent.slice(0,n))){let i=!1,o=s.previousSibling;for(;o;){if(!gt.check.isZeroWidth(o)){i=!1;break}o=o.previousSibling}if(i)return gt.utils.copyTagAttributes(d,e),{ancestor:t,container:s,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,_,b,y,v=s,C=n,w=!1;if(function t(s,n){const o=s.childNodes;for(let s,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(w&&!gt.check.isBreak(d)){if(1===d.nodeType){if(u._isIgnoreNodeChange(d)){if(e=e.cloneNode(!1),l=d.cloneNode(!0),m.appendChild(l),m.appendChild(e),g.push(e),c&&d.contains(c)){const t=gt.query.getNodePath(c,d);c=gt.query.getNodeFromPath(t,l)}}else t(d,d);continue}_=d,f=[];const o=[];for(;null!==_.parentNode&&_!==p&&_!==e;)s=i(_),1===_.nodeType&&s&&(h(_)?y||o.push(s):f.push(s)),_=_.parentNode;f=f.concat(o);const r=f.length>0,v=f.pop()||d;for(b=_=v;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(h(e.parentNode)&&!h(v)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&h(v)){e=e.cloneNode(!1);const t=v.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);v.appendChild(e),m.appendChild(v),n=h(_)?e:_,g.push(e)}else r?(e.appendChild(v),n=_):n=e;if(y&&3===d.nodeType)if(a(d)){const t=gt.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));y.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else y=null}if(w||d!==v)s=w?i(d):d.cloneNode(!1),s&&(n.appendChild(s),1!==d.nodeType||gt.check.isBreak(d)||(x=s)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===v.nodeType){const t=v;o=t.substringData(0,C),l=t.substringData(C,t.length-C)}const r=gt.utils.createTextNode(o),h=gt.utils.createTextNode(l);if(y){const e=a(n);if(e&&e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}y=y.cloneNode(!1)}gt.check.isZeroWidth(r)||n.appendChild(r);const c=a(n);for(c&&(y=c),y&&(t=y),_=n,f=[];_!==t&&null!==_;)s=i(_),1===_.nodeType&&s&&f.push(s),_=_.parentNode;const u=f.pop()||n;for(b=_=u;f.length>0;)_=f.pop(),b.appendChild(_),b=_;u!==n?(e.appendChild(u),n=_):n=e,gt.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),v=h,C=0,w=!0,n.appendChild(v)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n,endContainer:c};if(o=o&&l)for(let t=0;t<g.length;t++){const e=g[t],i=e.childNodes,s=i[0];for(;i[0];)m.insertBefore(i[0],e);gt.utils.removeItem(e),0===t&&(v=s)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Fi(g[t])}if(o||0!==m.childNodes.length){this.nodeTransform.removeEmptyNode(m,e,!1),gt.check.isZeroWidth(m.textContent)&&(v=m.firstChild,C=0);const i={s:0,e:0},s=gt.query.getNodePath(v,m,i);C+=i.s;const n=this.nodeTransform.mergeSameTags(m,[s],!0);t.parentNode.replaceChild(m,t),v=gt.query.getNodeFromPath(s,m),C+=n[0]}else t.childNodes?v=t.childNodes[0]:(v=gt.utils.createTextNode(ut.zeroWidthSpace),t.appendChild(v));return{ancestor:m,container:v,offset:C,endContainer:c}},_setNode_middleLine(t,e,i,s,n,o,l){if(!n){let i=null;l&&t.contains(l)&&(i=gt.query.getNodePath(l,t));const s=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=s.childNodes,h=0,c=a.length;for(let t;h<c&&(t=a[h],3!==t.nodeType);h++){if(t.nodeName!==n){if(!gt.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,gt.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=s.innerHTML,{ancestor:t,endContainer:i?gt.query.getNodeFromPath(i,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),h=[e];let c=!0;if(function t(s,n){const o=s.childNodes;for(let s,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(gt.check.isBreak(p)||!r._isIgnoreNodeChange(p))s=i(p),s&&(c=!1,n.appendChild(s),1===p.nodeType&&(g=s)),gt.check.isBreak(p)||t(p,g);else if(e.childNodes.length>0&&(a.appendChild(e),e=e.cloneNode(!1)),d=p.cloneNode(!0),a.appendChild(d),a.appendChild(e),h.push(e),n=e,l&&p.contains(l)){const t=gt.query.getNodePath(l,p);l=gt.query.getNodeFromPath(t,d)}}}(t,e),c||n&&!s&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),s&&n)for(let t=0;t<h.length;t++){const e=h[t],i=e.childNodes;for(;i[0];)a.insertBefore(i[0],e);gt.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Fi(h[t])}return this.nodeTransform.removeEmptyNode(a,e,!1),this.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}},_setNode_endLine(t,e,i,s,n,o,l,r,a,h){let c=s.parentNode;for(;!(c.nextSibling||c.previousSibling||this.isLine(c.parentNode)||gt.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&c.nodeName===e.nodeName&&!this.isLine(c)&&!c.previousSibling&>.check.isZeroWidth(s.textContent.slice(n))){let i=!1,o=s.nextSibling;for(;o;){if(!gt.check.isZeroWidth(o)){i=!1;break}o=o.nextSibling}if(i)return gt.utils.copyTagAttributes(c,e),{ancestor:t,container:s,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,_,b,y=s,v=n,C=!1;if(function t(s,n){const o=s.childNodes;for(let s,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let c=n;if(C&&!gt.check.isBreak(r)){if(1===r.nodeType){if(d._isIgnoreNodeChange(r)){e=e.cloneNode(!1);const t=r.cloneNode(!0);g.insertBefore(t,n),g.insertBefore(e,t),p.push(e)}else t(r,r);continue}f=r,m=[];const o=[];for(;null!==f.parentNode&&f!==u&&f!==e;)s=i(f),s&&1===f.nodeType&&(h(f)?b||o.push(s):m.push(s)),f=f.parentNode;m=m.concat(o);const l=m.length>0,c=m.pop()||r;for(_=f=c;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(h(e.parentNode)&&!h(c)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!b&&h(c)){e=e.cloneNode(!1);const t=c.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);c.appendChild(e),g.insertBefore(c,g.firstChild),p.push(e),n=e.children.length>0?f:e}else l?(e.insertBefore(c,e.firstChild),n=f):n=e;if(b&&3===r.nodeType)if(a(r)){const t=gt.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));b.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else b=null}if(C||r!==y)s=C?i(r):r.cloneNode(!1),s&&(n.insertBefore(s,n.firstChild),1!==r.nodeType||gt.check.isBreak(r)||(c=s)),t(r,c);else{b=a(r);let t="",o="";if(3===y.nodeType){const e=y;t=e.substringData(v,e.length-v),o=e.substringData(0,v)}const l=gt.utils.createTextNode(t),c=gt.utils.createTextNode(o);if(b){b=b.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,i=null;for(;e.parentNode!==g;){for(n=i=e.parentNode.cloneNode(!1);e.childNodes[0];)i.appendChild(e.childNodes[0]);e.appendChild(i),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}b=b.cloneNode(!1)}else h(e.parentNode)&&!b&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(gt.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)s=h(f)?null:i(f),s&&1===f.nodeType&&m.push(s),f=f.parentNode;const d=m.pop()||n;for(_=f=d;m.length>0;)f=m.pop(),_.appendChild(f),_=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,gt.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),b?(b.insertBefore(e,b.firstChild),g.insertBefore(b,g.firstChild),b=null):g.insertBefore(e,g.firstChild),y=c,v=c.data.length,C=!0,n.insertBefore(y,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n};if(o=o&&l)for(let t=0;t<p.length;t++){const e=p[t],i=e.childNodes;let s=null;for(;i[0];)s=i[0],g.insertBefore(s,e);gt.utils.removeItem(e),t===p.length-1&&(y=s,v=s.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Fi(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.nodeTransform.removeEmptyNode(g,e,!1),gt.check.isZeroWidth(g.textContent)?(y=g.firstChild,v=y.textContent.length):gt.check.isZeroWidth(y)&&(y=e,v=1);const i={s:0,e:0},s=gt.query.getNodePath(y,g,i);v+=i.s;const n=this.nodeTransform.mergeSameTags(g,[s],!0);t.parentNode.replaceChild(g,t),y=gt.query.getNodeFromPath(s,g),v+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=gt.utils.createTextNode(ut.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===v?y.childNodes.length:v}},_sn_isSizeNode(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.isTextStyleNode(t)&&!!t.style.fontSize},_sn_getMaintainedNode(t,e,i){return!i||t?null:gt.query.getParentElement(i,this._isNonSplitNode.bind(this))||(e?null:gt.query.getParentElement(i,this._sn_isSizeNode.bind(this)))},_sn_isMaintainedNode(t,e,i){if(!i||t||1!==i.nodeType)return!1;const s=this._isNonSplitNode(i);return gt.query.getParentElement(i,this._isNonSplitNode.bind(this))?s:s||!e&&this._sn_isSizeNode(i)},_sn_setCommonListStyle(t,e){if(!gt.check.isListCell(t))return;const i=gt.utils.arrayFilter((e||t).childNodes,(t=>!gt.check.isBreak(t)));if(e=i[0],!gt.check.isElement(e)||i.length>1)return;const s=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=pt.getValues(s);if(r.length>0)for(let t=0,e=this._listCamel.length;t<e;t++)r.includes(this._listKebab[t])&&(n[this._listCamel[t]]=s[this._listCamel[t]],s.removeProperty(this._listKebab[t]),l=!0);if(this._sn_setCommonListStyle(t,e),l&&!s.length){const t=e.childNodes,i=e.parentNode,s=e.nextSibling;for(;t.length>0;)i.insertBefore(t[0],s);gt.utils.removeItem(e)}},_sn_resetCommonListCell(t,e){if(!gt.check.isListCell(t))return;e||(e=this._listKebab);const i=gt.utils.arrayFilter(t.childNodes,(t=>!gt.check.isBreak(t))),s=t.style,n=[],o=[],l=pt.getValues(s);for(let t=0,i=this._listKebab.length;t<i;t++)l.includes(this._listKebab[t])&&e.includes(this._listKebab[t])&&(n.push(this._listCamel[t]),o.push(this._listKebab[t]));if(!n.length)return;const r=gt.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=s[o[t]],s.removeProperty(o[t]);let a=r.cloneNode(!1),h=null,c=!1;for(let e,s,o=0,l=i.length;o<l;o++)e=i[o],this.options.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(s=pt.getValues(e.style),0===s.length||n.some((function(t){return!s.includes(t)}))&&s.some((function(t){n.includes(t)}))?(h=e.nextSibling,a.appendChild(e)):a.childNodes.length>0&&(t.insertBefore(a,h),a=r.cloneNode(!1),h=null,c=!0));return a.childNodes.length>0&&(t.insertBefore(a,h),c=!0),s.length||t.removeAttribute("style"),c},__resetBrLineBreak(t){this._brLineBreak="br"===t},constructor:Ri};const Pi=Ri;function Di(t){Jt.call(this,t);const e=this.options;this.fontSizeUnitRegExp=null,this._isAllowedClassName=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this._allowHTMLComment=null,this._disallowedStyleNodesRegExp=null,this._htmlCheckWhitelistRegExp=null,this._htmlCheckBlacklistRegExp=null,this._elementWhitelistRegExp=null,this._elementBlacklistRegExp=null,this._attributeWhitelist=null,this._attributeBlacklist=null,this._attributeWhitelistRegExp=null,this._attributeBlacklistRegExp=null,this._cleanStyleTagKeyRegExp=null,this._cleanStyleRegExpMap=null,this._textStyleTags=e.get("_textStyleTags"),this._autoStyleify=null,this.__disallowedTagsRegExp=null,this.__disallowedTagNameRegExp=null,this.__allowedTagNameRegExp=null;const i=e.get("tagStyles"),s={};for(const t in i){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],s[n]?s[n]+="|":s[n]="",s[n]+=i[t]}for(const t in s)s[t]=new RegExp(`\\s*[^-a-zA-Z](${s[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map,o={...s,line:e.get("_lineStylesRegExp")};this._textStyleTags.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this._cleanStyleTagKeyRegExp=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this._cleanStyleRegExpMap=n,this.fontSizeUnitRegExp=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.__disallowedTagsRegExp=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.__disallowedTagNameRegExp=new RegExp(`^(${r})$`,"i"),this.__allowedTagNameRegExp=new RegExp(`^(${l})$`,"i");const a=Object.keys(e.get("_defaultStyleTagMap")),h=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<h.length;t++)a.splice(a.indexOf(h[t].toLowerCase()),1);this._disallowedStyleNodesRegExp=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const c=e.get("__defaultAttributeWhitelist");this._allowHTMLComment=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this._htmlCheckWhitelistRegExp=new RegExp("^("+Wi(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this._elementWhitelistRegExp=pt.createElementWhitelist(Wi(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this._elementBlacklistRegExp=pt.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const d='\\s*=\\s*(")[^"]*\\1',u=e.get("attributeWhitelist");let p={},g="";if(u)for(const t in u)/^on[a-z]+$/i.test(u[t])||("*"===t?g=Wi(u[t],c):p[t]=new RegExp("\\s(?:"+Wi(u[t],"")+")"+d,"ig"));this._attributeWhitelistRegExp=new RegExp("\\s(?:"+(g||c)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+d,"ig"),this._attributeWhitelist=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=Wi(m[t],""):p[t]=new RegExp("\\s(?:"+Wi(m[t],"")+")"+d,"ig");this._attributeBlacklistRegExp=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this._attributeBlacklist=p,this.__resetAutoStyleify(e.get("autoStyleify"))}function qi(t,e,i,s){if(/^<[a-z0-9]+:[a-z0-9]+/i.test(i))return i;let n=null;const o=s.match(/(?!<)[a-zA-Z0-9-]+/)[0].toLowerCase();if(t){const t=this._attributeBlacklist[o];i=i.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),i=t?i.replace(t,""):i.replace(this._attributeBlacklistRegExp,"");const e=this._attributeWhitelist[o];n=e?i.match(e):i.match(this._attributeWhitelistRegExp)}if(!e)return i;if("a"===o){const t=i.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||(n=[]),n.push(t[0]))}else n&&/style=/i.test(n.toString())||(this._textStyleTags.includes(o)?n=this._cleanStyle(i,n,o):this.format.isLine(o)?n=this._cleanStyle(i,n,"line"):this._cleanStyleTagKeyRegExp.test(o)&&(n=this._cleanStyle(i,n,o)));if(gt.check.isMedia(o)||gt.check.isFigure(o)){const t=i.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);n||(n=[]),t&&n.push(t[0])}if(n)for(let t,e=0,i=n.length;e<i;e++)t=/^(?:href|src)\s*=\s*('|"|\s)*javascript\s*:/i.test(n[e].trim())?"":n[e],s+=(/^\s/.test(t)?"":" ")+t;return s}function Wi(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}Di.prototype={filter(t,{tagWhitelist:e,tagBlacklist:i,validate:s,validateAll:n}){if(e&&(t=t.replace(pt.createElementWhitelist(e),"")),i&&(t=t.replace(pt.createElementBlacklist(i),"")),s){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=s(t);null===e?t.remove():e instanceof Node?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}else if(n){const e=(new DOMParser).parseFromString(t,"text/html"),i=[".se-component",".se-flex-component"],n=t=>i.some((e=>t.closest(e)));e.body.querySelectorAll("*").forEach((t=>{if(!n(t)){const e=s(t);null===e?t.remove():e instanceof Node?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t},clean(t,{forceFormat:e,whitelist:i,blacklist:s,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,textStyleTagFilter:a,attrFilter:h,styleFilter:c}=this.options.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.__disallowedTagsRegExp,""),t=this._deleteDisallowedTags(t,this._elementWhitelistRegExp,this._elementBlacklistRegExp).replace(/<br\/?>$/i,"")),this._autoStyleify){const e=(new DOMParser).parseFromString(t,"text/html");gt.query.getListChildNodes(e.body,pt.spanToStyleNode.bind(null,this._autoStyleify)),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,qi.bind(this,h,c)));const u=this._d.createRange().createContextualFragment(t);if(o)try{this._consistencyCheckOfHTML(u,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,o,l,r,n)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}const p=u.querySelectorAll("[data-se-iframe-holder]");for(let t=0,e=p.length;t<e;t++){const e=gt.utils.createElement("iframe"),i=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,s]of Object.entries(i))e.setAttribute(t,s);p[t].replaceWith(e)}let g;if((g=this.options.get("__pluginRetainFilter"))&&this.editor._MELInfo.forEach(((t,e)=>{const i=u.querySelectorAll(e);for(let e=0,s=i.length;e<s;e++)!0!==g&&!1===g[t.key]||t.method(i[e])})),l){let t=u.childNodes;e||(e=this._isFormatData(t)),e&&(t=this._editFormat(u).childNodes);for(let i,s=0,n=t.length;s<n;s++)i=t[s],this.__allowedTagNameRegExp.test(i.nodeName)?d+=i.outerHTML:d+=this._makeLine(i,e)}return d||(d=t),o&&(i&&(d=d.replace("string"==typeof i?pt.createElementWhitelist(i):i,"")),s&&(d=d.replace("string"==typeof s?pt.createElementBlacklist(s):s,""))),a&&(d=this._styleNodeConvertor(d)),d},insert(t,{selectInserted:e,skipCharCount:i,skipCleaning:s}={}){if(this.editor.frameContext.get("wysiwyg").contains(this.selection.get().focusNode)||this.editor.focus(),"string"==typeof t){s||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(gt.check.isListCell(this.format.getLine(this.selection.getNode(),null))){const e=this._d.createRange().createContextualFragment(t).childNodes;this._isFormatData(e)&&(t=this._convertListCell(e))}const s=this._d.createRange().createContextualFragment(t).childNodes;if(!i){const t="byte-html"===this.editor.frameOptions.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let i=0,n=s.length;i<n;i++)e+=s[i][t];if(!this.char.check(e))return}let n,o,l,r,a;for(;n=s[0];)3===r?.nodeType&&1===o?.nodeType&>.check.isBreak(n)?(r=n,gt.utils.removeItem(n)):(l=this.insertNode(n,{afterNode:o,skipCharCount:!0}),o=l.container||l,a||(a=l),r=n);3===r?.nodeType&&1===o?.nodeType&&(o=r);const h=3===o.nodeType?l.endOffset||o.textContent.length:o.childNodes.length;e?this.selection.setRange(a.container||a,a.startOffset||0,o,h):this.component.is(o)||this.selection.setRange(o,h,o,h)}catch(t){if(this.editor.frameContext.get("isReadOnly")||this.editor.frameContext.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.component.is(t))this.component.insert(t,{skipCharCount:i,skipSelection:!1,skipHistory:!1});else{let e=null;(this.format.isLine(t)||gt.check.isMedia(t))&&(e=this.format.getLine(this.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:i})}this.editor.effectNode=null,this.editor.focus(),this.history.push(!1)},insertNode(t,{afterNode:e,skipCharCount:i}={}){let s=null;if(this.editor.frameContext.get("isReadOnly")||!i&&!this.char.check(t))return s;let n,o,l,r=null,a=this.selection.getRange(),h=gt.check.isListCell(a.commonAncestorContainer)?a.commonAncestorContainer:this.format.getLine(this.selection.getNode(),null),c=gt.check.isListCell(h)&&(gt.check.isListCell(t)||gt.check.isList(t)),d=null;const u=this.format.isBrLine(h),p=!u&&(this.format.isLine(t)||this.format.isBlock(t))||this.component.isBasic(t);if(c&&(l=e||gt.check.isList(t)?h.lastChild:h.nextElementSibling,d=gt.check.isList(t)?h:(l||h).parentNode),!e&&(p||this.component.isBasic(t)||gt.check.isMedia(t))){const t=gt.check.isEdgePoint(a.endContainer,a.endOffset,"end"),i=this.remove(),s=i.container,n=s===i.prevContainer&&a.collapsed?null:i.prevContainer;if(c&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(s)){let t=!0;for(l=s;l.parentNode&&l.parentNode!==d;)l=l.parentNode,t=!1;t&&s===n&&(l=l.nextSibling)}else l=null;else if(c&>.check.isListCell(s)&&!h.parentElement)h=gt.utils.createElement("LI"),d.appendChild(h),s.appendChild(d),l=null;else if(3===s.nodeType||gt.check.isBreak(s)||c){const n=gt.query.getParentElement(s,(t=>this.format.isBlock(t)||gt.check.isListCell(t)));if(e=this.nodeTransform.split(s,i.offset,n?gt.query.getNodeDepth(n)+1:0))if(c){if(h.contains(s)){const i=gt.check.isList(h.lastElementChild);let s=null;t||(s=h.cloneNode(!1),s.appendChild(e.textContent.trim()?e:gt.utils.createTextNode(ut.zeroWidthSpace))),i&&(s||(s=h.cloneNode(!1),s.appendChild(gt.utils.createTextNode(ut.zeroWidthSpace))),s.appendChild(h.lastElementChild)),s&&(h.parentNode.insertBefore(s,h.nextElementSibling),l=e=s)}}else e=e.previousSibling;else l=e=h}}a=e||p?this.selection.getRange():this.selection.getRangeAndAddLine(this.selection.getRange(),null);const g=a.commonAncestorContainer,m=a.startOffset,f=a.endOffset,_=a.startContainer===g&&this.format.isLine(g),b=_&&(g.childNodes[m]||g.childNodes[0])||a.startContainer,y=_&&(g.childNodes[f]||g.childNodes[g.childNodes.length-1])||a.endContainer;if(!c)if(e)n=e.parentNode,e=e.nextSibling,o=!0;else if(n=b,3===b.nodeType&&(n=b.parentNode),a.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(gt.check.isBreak(n))e=n,n=n.parentNode;else{const i=n.childNodes[m],s=3===i?.nodeType&>.check.isZeroWidth(i)&>.check.isBreak(i.nextSibling)?i.nextSibling:i;s?!s.nextSibling&>.check.isBreak(s)?(n.removeChild(s),e=null):e=gt.check.isBreak(s)&&!gt.check.isBreak(t)?s:s.nextSibling:e=null}else{if(b===y){e=gt.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;gt.check.isEdgePoint(b,m)||(t=b.splitText(m)),n.removeChild(t),0===n.childNodes.length&&p&&(n.innerHTML="<br>")}else{const i=this.remove(),s=i.container,o=i.prevContainer;if(0===s?.childNodes.length&&p&&(this.format.isLine(s)?s.innerHTML="<br>":this.format.isBlock(s)&&(s.innerHTML="<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">")),gt.check.isListCell(s)&&3===t.nodeType)n=s,e=null;else if(!p&&o)if(n=3===o.nodeType?o.parentNode:o,n.contains(s)){let t=!0;for(e=s;e.parentNode&&e.parentNode!==n;)e=e.parentNode,t=!1;t&&s===o&&(e=e.nextSibling)}else e=null;else gt.check.isWysiwygFrame(s)&&!this.format.isLine(t)?(n=s.appendChild(gt.utils.createElement(this.options.get("defaultLine"))),e=null):n=(e=p?y:s===o?s.nextSibling:s)&&e.parentNode?e.parentNode:g;for(;e&&!this.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const i=this.editor.frameContext.get("wysiwyg");if(!c){if((gt.check.isWysiwygFrame(e)||n===i.parentNode)&&(n=i,e=null),this.format.isLine(t)||this.format.isBlock(t)||!gt.check.isListCell(n)&&this.component.isBasic(t)){const t=n;if(gt.check.isList(e))n=e,e=null;else if(gt.check.isListCell(e))n=e.previousElementSibling||e;else if(!o&&!e){const t=this.remove(),i=3===t.container.nodeType?gt.check.isListCell(this.format.getLine(t.container,null))?t.container:this.format.getLine(t.container,null)||t.container.parentNode:t.container,s=gt.check.isWysiwygFrame(i)||this.format.isBlock(i);n=s?i:i.parentNode,e=s?null:i.nextSibling}0===t.childNodes.length&&n!==t&>.utils.removeItem(t)}if(!p||u||this.format.isBlock(n)||gt.check.isListCell(n)||gt.check.isWysiwygFrame(n)||(e=n.nextElementSibling,n=n.parentNode),gt.check.isWysiwygFrame(n)&&(3===t.nodeType||gt.check.isBreak(t))){const e=gt.utils.createElement(this.options.get("defaultLine"),null,t);r=t,t=e}}if(c?d.parentNode?(n=d,e=l):(n=i,e=null):e=n===e?n.lastChild:e,gt.check.isListCell(t)&&!gt.check.isList(n)){if(gt.check.isListCell(n))e=n.nextElementSibling,n=n.parentNode;else{const t=gt.utils.createElement("ol");n.insertBefore(t,e),n=t,e=null}c=!0}if(this._checkDuplicateNode(t,n),n.insertBefore(t,e),c)if(gt.check.isZeroWidth(h.textContent.trim()))gt.utils.removeItem(h),t=t.lastChild;else{const e=gt.utils.arrayFind(h.children,gt.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(n.appendChild(t),t=n),gt.check.isZeroWidth(h.textContent.trim())&>.utils.removeItem(h))}}catch(e){n.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{r&&(t=r);const e=n.querySelectorAll("[data-duple]");if(e.length>0)for(let i,s,n,o,l=0,r=e.length;l<r;l++){for(i=e[l],n=i.childNodes,o=i.parentNode;n[0];)s=n[0],o.insertBefore(s,i);i===t&&(t=s),gt.utils.removeItem(i)}if((this.format.isLine(t)||this.component.isBasic(t))&&b===y){const t=this.format.getLine(g,null);1===t?.nodeType&>.check.isEmptyLine(t)&>.utils.removeItem(t)}if(u&&(this.format.isLine(t)||this.format.isBlock(t))&&(t=this._setIntoFreeFormat(t)),!this.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.selection.setRange(t,e,t,e);else if(!gt.check.isBreak(t)&&!gt.check.isListCell(t)&&this.format.isLine(n)){let i=null;t.previousSibling&&!gt.check.isBreak(t.previousSibling)||(i=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(i,t)),t.nextSibling&&!gt.check.isBreak(t.nextSibling)||(i=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(i,t.nextSibling)),this.format._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.selection.setRange(t,e,t,e)}}s=t}return s},remove(){this.selection._resetRangeToTextNode();const t=this.selection.getRange(),e=0===t.startOffset,i=gt.check.isEdgePoint(t.endContainer,t.endOffset,"end");let s=null,n=null,o=null;e&&(n=this.format.getLine(t.startContainer),s=n?n.previousElementSibling:null,n=n?s:n),i&&(o=this.format.getLine(t.endContainer),o=o?o.nextElementSibling:o);let l,r=0,a=t.startContainer,h=t.endContainer,c=t.startOffset,d=t.endOffset;const u=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===a.parentNode?a.parentNode:t.commonAncestorContainer;if(u===a&&u===h){if(this.component.isBasic(u)){const t=this.component.get(u).container,e=t.parentElement,i=t.nextSibling||t.previousSibling,s=i===t.previousSibling?i?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return gt.utils.removeItem(t),this.format.isLine(e)?0===e.childNodes.length?(gt.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:i,offset:s,commonCon:u}:{container:n,offset:o,commonCon:u}}if(1===u.nodeType&&0===c&&1===d||3===u.nodeType&&0===c&&d===u.textContent.length){const t=gt.query.getNextDeepestNode(u,this.editor.frameContext.get("wysiwyg")),e=gt.query.getPreviousDeepestNode(u,this.editor.frameContext.get("wysiwyg")),i=this.format.getLine(u);gt.utils.removeItem(u);let s=t||e,n=t?0:3===s?.nodeType?s.textContent.length:1;const o=this.format.getLine(s)||this.component.get(s);return i!==o&&(s=o,n=0===n?0:1),gt.check.isZeroWidth(i)&&!i.contains(s)&>.utils.removeItem(i),{container:s,offset:n,commonCon:u}}a=u.children[c],h=u.children[d],c=d=0}if(!a||!h)return{container:u,offset:0,commonCon:u};if(a===h&&t.collapsed&>.check.isZeroWidth(a.textContent?.substring(c)))return{container:a,offset:c,prevContainer:a&&a.parentNode?a:null,commonCon:u};let p=null,g=null;const m=gt.query.getListChildNodes(u,null);let f=gt.utils.getArrayIndex(m,a),_=gt.utils.getArrayIndex(m,h);if(m.length>0&&f>-1&&_>-1){for(let t=f+1,e=a;t>=0;t--)m[t]===e.parentNode&&m[t].firstChild===e&&0===c&&(f=t,e=e.parentNode);for(let t=_-1,e=h;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--_)}else{if(0===m.length){if(this.format.isLine(u)||this.format.isBlock(u)||gt.check.isWysiwygFrame(u)||gt.check.isBreak(u)||gt.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(gt.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],gt.check.isBreak(a)||gt.check.isZeroWidth(a))return{container:gt.check.isMedia(u)?u:a,offset:0,commonCon:u};f=_=0}const b=gt.check.isText,y=gt.check.isElement;for(let t=f;t<=_;t++){const e=m[t];if(!b(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==h)this._nodeRemoveListItem(e);else{if(b(h))g=gt.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.component.is(h))continue;g=gt.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:this._nodeRemoveListItem(h)}else{if(y(a)){if(this.component.is(a))continue;p=gt.utils.createTextNode(a.textContent)}else{const t=a,i=h;e===h?(p=gt.utils.createTextNode(t.substringData(0,c)+i.substringData(d,i.length-d)),r=c):p=gt.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:this._nodeRemoveListItem(a),e===h)break}else this._nodeRemoveListItem(e)}const v=gt.query.getParentElement(h,"ul"),C=gt.query.getParentElement(a,"li");if(v&&C&&C.contains(v)?(l=v.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||i)&&(i?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(gt.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!gt.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.editor.frameContext.get("wysiwyg"))}return this.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:s,commonCon:u}},get({withFrame:t,includeFullPage:e,rootKey:i}={}){i?Array.isArray(i)||(i=[i]):i=[this.status.rootKey];const s=this.status.rootKey,n={};for(let s,o=0,l=i.length;o<l;o++){this.editor.changeFrameContext(i[o]);const l=this.editor.frameContext,r=gt.utils.createElement("DIV",null,this._convertToCode(l.get("wysiwyg"),!0)),a=gt.check.isTableCell,h=gt.check.isEmptyLine,c=[],d=[];gt.query.getListChildren(r,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return a(e)&&e.children.length<=1&&h(t)&&d.push(e),!1}));for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=d.length;t<e;t++)d[t].innerHTML="<br>";const u=r.innerHTML;if(this.editor.frameOptions.get("iframe_fullPage"))if(e){const t=gt.utils.getAttributesToString(l.get("_wd").body,["contenteditable"]);s=`<!DOCTYPE html><html>${l.get("_wd").head.outerHTML}<body ${t}>${u}</body></html>`}else s=u;else s=t?`<div class="${this.options.get("_editableClass")+""+(this.options.get("_rtl")?" se-rtl":"")}">${u}</div>`:r.innerHTML;n[i[o]]=s}return this.editor.changeFrameContext(s),i.length>1?n:n[i[0]]},set(t,{rootKey:e}={}){this.selection.removeRange();const i=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let t=0;t<e.length;t++)if(this.editor.changeFrameContext(e[t]),this.editor.frameContext.get("isCodeView")){const t=this._convertToCode(i,!1);this.viewer._setCodeView(t)}else this.editor.frameContext.get("wysiwyg").innerHTML=i,this.editor._resetComponents(),this.history.push(!1,e[t])},add(t,{rootKey:e}={}){e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++){this.editor.changeFrameContext(e[i]);const s=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.editor.frameContext.get("isCodeView"))this.viewer._setCodeView(this.viewer._getCodeView()+"\n"+this._convertToCode(s,!1));else{const t=gt.utils.createElement("DIV",null,s).children,n=t.length;for(let e=0;e<n;e++)t[e]&&this.editor.frameContext.get("wysiwyg").appendChild(t[e]);this.history.push(!1,e[i]),this.selection.scrollTo(t[n-1])}}},getJson({withFrame:t,rootKey:e}={}){return pt.htmlToJson(this.get({withFrame:t,rootKey:e}))},setJson(t,{rootKey:e}={}){this.set(pt.jsonToHtml(t),{rootKey:e})},async copy(t){try{return await _t.write(t),this.editor.ui.showToast(this.lang.message_copy_success,this.options.get("toastMessageTime").copy),!0}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.editor.ui.showToast(this.lang.message_copy_fail,this.options.get("toastMessageTime").copy,"error"),!1}},setFullPage(t,{rootKey:e}={}){if(!this.editor.frameOptions.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++)this.editor.changeFrameContext(e[i]),t.head&&(this.editor.frameContext.get("_wd").head.innerHTML=t.head.replace(this.__disallowedTagsRegExp,"")),t.body&&(this.editor.frameContext.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.editor._resetComponents()},compress:t=>t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim(),_convertToCode(t,e){let i="";const s=RegExp,n=new s("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),o="string"==typeof t?this._d.createRange().createContextualFragment(t):t,l=t=>this.format.isLine(t)||this.component.is(t),r=e?"":"\n",a=e?0:1*this.status.codeIndentSize,h=a>0?new Array(a+1).join(" "):"";return function t(e,o){const a=e.childNodes,c=n.test(e.nodeName),d=c?o:"";for(let u,p,g,m,f,_,b=0,y=a.length;b<y;b++)u=a[b],m=n.test(u.nodeName),p=m?r:"",g=!l(u)||c||/^(TH|TD)$/i.test(e.nodeName)?"":r,8!==u.nodeType?3!==u.nodeType?0!==u.childNodes.length?u.outerHTML?(f=u.nodeName.toLowerCase(),_=d||m?o:"",i+=(g||(c?"":p))+_+u.outerHTML.match(s("<"+f+"[^>]*>","i"))[0]+p,t(u,o+h+""),i+=(/\n$/.test(i)?_:"")+"</"+f+">"+(g||p||c||/^(TH|TD)$/i.test(u.nodeName)?r:"")):i+=(new XMLSerializer).serializeToString(u):i+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:gt.check.isList(u.parentElement)||(i+=pt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):i+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),i.trim()+r},_nodeRemoveListItem(t){const e=this.format.getLine(t,null);gt.utils.removeItem(t),gt.check.isListCell(e)&&(this.nodeTransform.removeAllParents(e,null,null),gt.check.isList(e?.firstChild)&&e.insertBefore(gt.utils.createTextNode(ut.zeroWidthSpace),e.firstChild))},_setIntoFreeFormat(t){const e=t.parentNode;let i,s;for(;this.format.isLine(t)||this.format.isBlock(t);){for(i=t.childNodes,s=null;i[0];)if(s=i[0],this.format.isLine(s)||this.format.isBlock(s)){if(this._setIntoFreeFormat(s),!t.parentNode)break;i=t.childNodes}else e.insertBefore(s,t);0===t.childNodes.length&>.utils.removeItem(t),t=gt.utils.createElement("BR"),e.insertBefore(t,s.nextSibling)}return t},_makeLine(t,e){const i=this.options.get("defaultLine");if(1===t.nodeType){if(this.__disallowedTagNameRegExp.test(t.nodeName))return"";if(gt.check.isExcludeFormat(t))return t.outerHTML;const s=gt.query.getListChildNodes(t,(t=>gt.check.isSpanWithoutAttr(t)&&!gt.query.getParentElement(t,gt.check.isExcludeFormat)))||[];for(let t,e=s.length-1;e>=0;e--)t=s[e],t.outerHTML=t.innerHTML;if(!e||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||gt.check.isMedia(t)||gt.check.isFigure(t)||gt.check.isAnchor(t)&>.check.isMedia(t.firstElementChild)){const e=t;return gt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+i+">"+(gt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+i+">"}}if(3===t.nodeType){if(!e)return pt.htmlToEntity(t.textContent);const s=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=s.length;e<o;e++)t=s[e].trim(),t.length>0&&(n+="<"+i+">"+pt.htmlToEntity(t)+"</"+i+">");return n}return 8===t.nodeType&&this._allowHTMLComment?"\x3c!--"+t.textContent.trim()+"--\x3e":""},_consistencyCheckOfHTML(t,e,i,s,n,o,l){const r=[],a=[],h=[],c=[],d=gt.query.getListChildNodes(t,(d=>{if(n&&1!==d.nodeType)return gt.check.isList(d.parentElement)&&r.push(d),!1;if(s&&(i.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&>.check.isExcludeFormat(d)))return r.push(d),!1;const u=!gt.query.getParentElement(d,gt.check.isExcludeFormat);if(n){if(!gt.check.isTableElements(d)&&!gt.check.isListCell(d)&&!gt.check.isAnchor(d)&&(this.format.isLine(d)||this.format.isBlock(d)||this.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(gt.check.isList(d.parentNode)&&!gt.check.isList(d)&&!gt.check.isListCell(d))return h.push(d),!1;if(gt.check.isTableCell(d)){const t=d.firstElementChild;if(!this.format.isLine(t)&&!this.format.isBlock(t)&&!this.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=new Array(d.classList).map(this._isAllowedClassName).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(gt.check.isListCell(d)&&!gt.check.isList(d.parentNode)||(this.format.isLine(d)||this.component.is(d))&&!this.format.isBlock(d.parentNode)&&!gt.query.getParentElement(d,this.component.is.bind(this.component)))}));for(let t=0,e=r.length;t<e;t++)gt.utils.removeItem(r[t]);const u=[];for(let t,e,i=0,s=d.length;i<s;i++)if(t=d[i],e=t.parentNode,e&&e.parentNode)if(gt.query.getParentElement(t,gt.check.isListCell)){const i=t.childNodes;for(let n=i.length-1;s>=0;n--)e.insertBefore(t,i[n]);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,i=u.length;e<i;e++)t=u[e],gt.check.isZeroWidth(t.textContent.trim())&>.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)gt.utils.removeItem(a[t]);for(let t,e,i,s,n=0,o=h.length;n<o;n++)if(t=h[n],s=t.parentNode,s)if(e=gt.utils.createElement("LI"),this.format.isLine(t)){for(i=t.childNodes;i[0];)e.appendChild(i[0]);s.insertBefore(e,t),gt.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(h[n]),s.insertBefore(e,t);for(let t,e,i=0,s=c.length;i<s;i++)t=c[i],e=gt.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML},_styleNodeConvertor(t){if(!this._disallowedStyleNodesRegExp)return t;const e=this.options.get("_defaultStyleTagMap");return t.replace(this._disallowedStyleNodesRegExp,((t,i,s,n)=>i+("string"==typeof e[s]?e[s]:s)+(n?" "+n:"")))},_editFormat(t){let e,i="";const s=t.childNodes;for(let t,n=0,o=s.length;n<o;n++)t=s[n],this.__allowedTagNameRegExp.test(t.nodeName)?i+=t.outerHTML:8===t.nodeType?i+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||gt.check.isExcludeFormat(t)?(e&&(i+=e.outerHTML,e=null),i+=t.outerHTML):(e||(e=gt.utils.createElement(this.options.get("defaultLine"))),this.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(i+=e.outerHTML),this._d.createRange().createContextualFragment(i)},_convertListCell(t){let e="";for(let i,s=0,n=t.length;s<n;s++)i=t[s],1===i.nodeType?gt.check.isList(i)?e+=i.innerHTML:gt.check.isListCell(i)?e+=i.outerHTML:this.format.isLine(i)?e+="<li>"+(i.innerHTML.trim()||"<br>")+"</li>":this.format.isBlock(i)&&!gt.check.isTableElements(i)?e+=this._convertListCell(i.children):e+="<li>"+i.outerHTML+"</li>":e+="<li>"+(i.textContent||"<br>")+"</li>";return e},_isFormatData(t){let e=!1;for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],1===i.nodeType&&!this.format.isTextStyleNode(i)&&!gt.check.isBreak(i)&&!this.__disallowedTagNameRegExp.test(i.nodeName)){e=!0;break}return e},_cleanStyle(t,e,i){let s=(t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(this._textStyleTags.includes(i)&&!s&&(t.match(/<[^\s]+\s(.+)/)||[])[1]){const e=(t.match(/\ssize="([^"]+)"/i)||[])[1],i=(t.match(/\sface="([^"]+)"/i)||[])[1],n=(t.match(/\scolor="([^"]+)"/i)||[])[1];(e||i||n)&&(s='style="'+(e?"font-size:"+mt.get(Number(e)/3.333,1)+"rem;":"")+(i?"font-family:"+i+";":"")+(n?"color:"+n+";":"")+'"')}if(s){let t;e||(e=[]);for(const[e,s]of this._cleanStyleRegExpMap)if(e.test(i)){t=s;break}if(!t)return e;const n=s.replace(/"/g,"").match(t);if(!n)return e;const o=[];for(let t,e=0,i=n.length;e<i;e++)if(t=n[e].match(/([a-zA-Z0-9-]+)(:)([^"']+)/),t&&!/inherit|initial|revert|unset/i.test(t[3])){const e=pt.kebabToCamelCase(t[1].trim()),i=this.editor.frameContext.get("wwComputedStyle")[e]?.replace(/"/g,""),s=t[3].trim();switch(e){case"fontFamily":if(!this.plugins.font||!this.plugins.font.fontArray.includes(s))continue;break;case"fontSize":if(!this.plugins.fontSize)continue;this.fontSizeUnitRegExp.test(t[0])||(t[0]=t[0].replace((t[0].match(/:\s*([^;]+)/)||[])[1],pt.toFontUnit.bind(null,this.options.get("fontSizeUnits")[0])));break;case"color":if(!this.plugins.fontColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue;break;case"backgroundColor":if(!this.plugins.backgroundColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue}i!==s&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e},_deleteDisallowedTags:(t,e,i)=>(e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(i,"")),_checkDuplicateNode(t,e){const i=this;!function t(s){i._dupleCheck(s,e);const n=s.childNodes;for(let e=0,i=n.length;e<i;e++)t(n[e])}(t)},_dupleCheck(t,e){if(!this.format.isTextStyleNode(t))return;const i=(t.style.cssText.match(/[^;]+;/g)||[]).map((function(t){return t.trim()})),s=t.nodeName;if(/^span$/i.test(s)&&0===i.length)return t;const n=this.format;let o=!1;return function e(l){if(!gt.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===s){o=!0;const e=l.style.cssText.match(/[^;]+;/g)||[];for(let t,s=0,n=e.length;s<n;s++)(t=i.indexOf(e[s].trim()))>-1&&i.splice(t,1);for(let e=0,i=l.classList.length;e<i;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=i.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),t.attributes.length||t.setAttribute("data-duple","true")),t},__resetAutoStyleify(t){if(t.length>0){const e=this.options.get("convertTextTags"),i={};t.forEach((t=>{switch(t){case"bold":i.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":i.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":i.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":i.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this._autoStyleify=i}else this._autoStyleify=null},constructor:Di};const Ui=Di;function Gi(t){Jt.call(this,t),this.targetMap={},this.index=-1,this.menus=[],this.currentDropdown=null,this.currentDropdownActiveButton=null,this.currentDropdownName="",this.currentDropdownType="",this.currentContainer=null,this.currentContainerActiveButton=null,this.currentContainerName="",this._dropdownCommands=[],this.__globalEventHandler={mousedown:Zi.bind(this),containerDown:this.containerOff.bind(this),keydown:Xi.bind(this),mousemove:ji.bind(this),mouseout:Yi.bind(this)},this._bindClose_dropdown_mouse=null,this._bindClose_dropdown_key=null,this._bindClose_cons_mouse=null,this.currentDropdownPlugin=null,this.__menuBtn=null,this.__menuContainer=null}function Zi(t){const e=gt.query.getEventTarget(t);gt.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}function Yi(){this.index=-1}function Xi(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this._moveItem(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this._moveItem(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}function ji(t){gt.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),gt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}Gi.prototype={initDropdownTarget({key:t,type:e},i){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");/free$/.test(e)||(i.setAttribute("data-key",t),this._dropdownCommands.push(t)),this.context.get("menuTray").appendChild(i),this.targetMap[t]=i},dropdownOn(t){this.__removeGlobalEvent();const e=this._checkMoreLayer(t);if(e){const i=gt.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(i)return this.editor.runFromTarget(i),void this.dropdownOn(t)}const i=t,s=this.currentDropdownName=i.getAttribute("data-command");this.currentDropdownType=i.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[s];this.currentDropdownActiveButton=i,this._setMenuPosition(i,n),this._bindClose_dropdown_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.mousedown,!1),this._dropdownCommands.includes(s)&&(this.menus=pt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this._bindClose_dropdown_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler.keydown,!1),n.addEventListener("mousemove",this.__globalEventHandler.mousemove,!1),n.addEventListener("mouseout",this.__globalEventHandler.mouseout,!1))),this.currentDropdownPlugin=this.plugins[s],"function"==typeof this.currentDropdownPlugin?.on&&this.currentDropdownPlugin.on(i),this.editor._preventBlur=!0},dropdownOff(){this.__removeGlobalEvent(),this.index=-1,this.menus=[],this.__menuBtn=null,this.__menuContainer=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&>.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1,"function"==typeof this.currentDropdownPlugin?.off&&this.currentDropdownPlugin.off(),this.currentDropdownPlugin=null},containerOn(t){this.__removeGlobalEvent(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this._setMenuPosition(t,this.currentContainer=this.targetMap[e]),this._bindClose_cons_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.containerDown,!1),this.plugins[e].on&&this.plugins[e].on(t),this.editor._preventBlur=!0},containerOff(){this.__removeGlobalEvent(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,gt.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1},_setMenuPosition(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",gt.utils.addClass(t.parentElement.children,"on"),this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,gt.query.getParentElement(t,".se-toolbar"),!1),e.style.visibility="",this.__menuBtn=t,this.__menuContainer=e},_restoreMenuPosition(){this.__menuBtn&&this.__menuContainer&&this._setMenuPosition(this.__menuBtn,this.__menuContainer)},_checkMoreLayer(t){const e=gt.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null},_moveItem(t){gt.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),gt.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,i=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===i?gt.utils.addClass(this.menus[t],"on"):gt.utils.removeClass(this.menus[t],"on")},__removeGlobalEvent(){this._bindClose_dropdown_mouse&&(this._bindClose_dropdown_mouse=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_mouse)),this._bindClose_cons_mouse&&(this._bindClose_cons_mouse=this.eventManager.removeGlobalEvent(this._bindClose_cons_mouse)),this._bindClose_dropdown_key&&(this._bindClose_dropdown_key=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_key),gt.utils.removeClass(this.menus,"on"),gt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"),this.currentDropdown.removeEventListener("mousemove",this.__globalEventHandler.mousemove,!1),this.currentDropdown.removeEventListener("mouseout",this.__globalEventHandler.mouseout,!1))},constructor:Gi};const Ki=Gi;function Ji(t){Jt.call(this,t)}Ji.prototype={split(t,e,i){if(gt.check.isWysiwygFrame(t)||this.component.is(t)||!t)return t;if(e&&!mt.is(e)){const i=t.childNodes;let s=gt.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=i.length;t<e;t++){if(t<s)n.appendChild(i[t]);else{if(!(t>s))continue;o.appendChild(i[t])}t--,e--,s--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const s=t.parentNode;let n,o,l,r=0,a=1,h=!0;if((!i||i<0)&&(i=0),gt.check.isText(t)){if(r=gt.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const i=gt.query.getNodeFromPath([r+1],s);gt.check.isZeroWidth(i)&&(i.data=ut.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:gt.query.getNodeDepth(t)===i&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;gt.query.getNodeDepth(c)>i;)for(r=gt.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(gt.check.isListCell(n)&>.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,gt.utils.removeItem(l.firstElementChild),l.children.length>0&&n.appendChild(l)):n.appendChild(l));o[r];)n.appendChild(o[r]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="<br>");const d=c.parentNode;return h&&(c=c.nextSibling),n?(this.mergeSameTags(n,null,!1),this.mergeNestedTags(n,gt.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,gt.check.isListCell(n)&&n.children&>.check.isList(n.children[0])&&n.insertBefore(gt.utils.createElement("BR"),n.children[0]),0===s.childNodes.length&>.utils.removeItem(s),n):c},mergeSameTags(t,e,i){const s=this,n=e?e.length:0;let o=null;return n&&(o=Array.apply(null,new Array(n)).map(Number.prototype.valueOf,0)),function t(l,r,a){const h=l.childNodes;for(let c,d,u=0,p=h.length;u<p&&(c=h[u],d=h[u+1],c);u++)if(!(gt.check.isBreak(c)||gt.check.isMedia(c)||gt.check.isInputElement(c)))if(i&&s.format._isIgnoreNodeChange(c)||!i&&(gt.check.isTableElements(c)||gt.check.isListCell(c)||s.format.isLine(c)&&!s.format.isBrLine(c)))(gt.check.isTableElements(c)||gt.check.isListCell(c))&&t(c,r+1,u);else{if(1===p&&l.nodeName===c.nodeName&&l.parentNode){if(n){let t,i,s,o,a;for(let h=0;h<n;h++)if(t=e[h],t&&t[r]===u){for(i=c,s=l,o=r,a=!0;o>=0;){if(gt.utils.getArrayIndex(s.childNodes,i)!==t[o]){a=!1;break}i=c.parentNode,s=i.parentNode,o--}a&&(t.splice(r,1),t[r]=u)}}gt.utils.copyTagAttributes(c,l),l.parentNode.insertBefore(c,l),gt.utils.removeItem(l)}if(!d){1===c.nodeType&&t(c,r+1,u);break}if(c.nodeName===d.nodeName&>.check.isSameAttributes(c,d)&&c.getAttribute?.("href")===d.getAttribute?.("href")){const t=c.childNodes;let i=0;for(let e=0,s=t.length;e<s;e++)t[e].textContent.length>0&&i++;const s=c.lastChild,l=d.firstChild;let h=0;if(s&&l){const t=3===s.nodeType&&3===l.nodeType;h=s.textContent.length;let c=s.previousSibling;for(;c&&3===c.nodeType;)h+=c.textContent.length,c=c.previousSibling;if(i>0&&3===s.nodeType&&3===l.nodeType&&(s.textContent.length>0||l.textContent.length>0)&&i--,n){let c=null;for(let d=0;d<n;d++)if(c=e[d],c&&c[r]>u){if(r>0&&c[r-1]!==a)continue;c[r]-=1,c[r+1]>=0&&c[r]===u&&(c[r+1]+=i,t&&s&&3===s.nodeType&&l&&3===l.nodeType&&(o[d]+=h))}}}if(3===c.nodeType){if(h=c.textContent.length,c.textContent+=d.textContent,n){let t=null;for(let s=0;s<n;s++)if(t=e[s],t&&t[r]>u){if(r>0&&t[r-1]!==a)continue;t[r]-=1,t[r+1]>=0&&t[r]===u&&(t[r+1]+=i,o[s]+=h)}}}else c.innerHTML+=d.innerHTML;gt.utils.removeItem(d),u--}else 1===c.nodeType&&t(c,r+1,u)}}(t,0,0),o},mergeNestedTags(t,e){if("string"==typeof e){const t=new RegExp(`^(${e||".+"})$`,"i");e=e=>t.test(e.nodeName)}else"function"!=typeof e&&(e=()=>!0);!function t(i){let s=i.children;if(1===s.length&&s[0].nodeName===i.nodeName&&e(i)){const t=s[0];for(s=t.children;s[0];)i.appendChild(s[0]);i.removeChild(t)}for(let e=0,s=i.children.length;e<s;e++)t(i.children[e])}(t)},removeAllParents(t,e,i){if(!t)return null;let s=null;return e||(e=t=>{if(t===i||this.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)}),function t(i){if(!gt.check.isWysiwygFrame(i)){const n=i.parentNode;n&&e(i)&&(s={sc:i.previousElementSibling,ec:i.nextElementSibling},gt.utils.removeItem(i),t(n))}}(t),s},removeEmptyNode(t,e,i){const s=this,n=this.options.get("allowedEmptyTags");e&&(e=gt.query.getParentElement(e,(e=>t===e.parentElement))),function i(o){if(s.format._notTextNode(o)||o===e||gt.check.isNonEditable(o))return 0;if(o===t||!gt.check.isZeroWidth(o.textContent)||o.firstChild&>.check.isBreak(o.firstChild)||o.querySelector(n)){const t=o.children;for(let e=0,n=t.length,o=0;e<n;e++)t[e+o]&&!s.component.is(t[e+o])&&(o+=i(t[e+o]))}else if(o.parentNode)return o.parentNode.removeChild(o),-1;return 0}(t),0===t.childNodes.length&&(i?gt.utils.removeItem(t):t.innerHTML="<br>")},createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const i=t[0].cloneNode(!1);let s=i;for(let i,n=1,o=t.length;n<o;n++)e(t[n])&&(i=t[n].cloneNode(!1),s.appendChild(i),s=i);return s.innerHTML="",{parent:i,inner:s}},constructor:Ji};const Qi=Ji;function ts(t){Jt.call(this,t),this._scrollEvent=null,this._elTop=0,this._scrollY=0,this._isFixed=!1}function es(e,i,s,n){const o=/^fixed$/i.test(t.getComputedStyle(n).position);this._isFixed?o?e.style.top=this._elTop-(this._scrollY-t.scrollY-n.offsetTop)+"px":this.setRelPosition(e,i,s,n,!0):o&&this.setRelPosition(e,i,s,n,!0)}ts.prototype={get(t){const e=this.editor.frameContext.get("wysiwygFrame"),i=/iframe/i.test(e?.nodeName),s=this.getLocal(t);return{left:s.left+(i?e.parentElement.offsetLeft:0),top:s.top+(i?e.parentElement.offsetTop:0)}},getLocal(t){const e=t;let i=0,s=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,h=J(e,O.bind(this)),c=r;for(;r&&!D(r,"se-wrapper")&&r!==h;)i+=r.offsetLeft-(c!==r?r.scrollLeft:0),s+=r.offsetTop+(c!==r?r.scrollTop:0),r=r.offsetParent;const d=this.editor.frameContext.get("wysiwygFrame");this.editor.frameContext.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.editor.frameContext.get("eventWysiwyg");return i+=n,s+=o-(h?h.scrollTop:0),{left:i,top:s,right:r?.offsetWidth?r.offsetWidth-(i-n+a)+l:0,scrollX:u.scrollX||u.scrollLeft||0,scrollY:u.scrollY||u.scrollTop||0}},getGlobal(e){const i=this.editor.frameContext.get("topArea"),s=this.editor.frameContext.get("wysiwygFrame");let n=!1,o=!1;e||(e=i),e===i&&(n=!0),!n&&I(e)&&(o="absolute"===t.getComputedStyle(e).position);let l=e;const r=l.offsetWidth,a=l.offsetHeight;let h=0,c=0,d=0,u=0;for(;l;)h+=l.offsetTop,c+=l.offsetLeft,d+=l.scrollTop,u+=l.scrollLeft,l=l.offsetParent;if(!o&&!n&&/^iframe$/i.test(s.nodeName)&&this.editor.frameContext.get("wysiwyg").contains(l))for(l=this.editor.frameContext.get("wrapper");l;)h+=l.offsetTop,c+=l.offsetLeft,l=l.offsetParent;return{top:h+d,left:c+u,width:r,height:a,scrollTop:d,scrollLeft:u}},getGlobalScroll(e){const i=this.editor.frameContext.get("topArea");let s=!1,n=!1;e||(e=i),e===i&&(s=!0),!s&&I(e)&&(n="absolute"===t.getComputedStyle(e).position);let o=0,l=0,r=0,a=0,h=0,c=0,d=0,u=0,p=null,g=null,m=null,f=null,_=e;for(;_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),p=m||p||_,m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),g=f||g||_,f=_),_=_.parentElement;if(!n&&!s&&/^iframe$/i.test(this.editor.frameContext.get("wysiwygFrame").nodeName))for(_=this.editor.frameContext.get("wrapper"),p=g=i;_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),f=_),_=_.parentElement;for(_=this.editor._shadowRoot?.host,_&&(p=g=i);_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),f=_),_=_.parentElement;const b=i.contains(p),y=i.contains(g);p=b?i:p,g=y?i:g;const v=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?t.scrollY:0):0,C=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?t.scrollX:0):0;d=b?i.clientHeight:d,u=y?i.clientWidth:u;const w=U(this.editor.frameContext.get("_wd"));return{top:o,left:l,ts:v,ls:C,width:a,height:r,x:h,y:c,ohOffsetEl:n?window:p,owOffsetEl:n?window:g,oh:n?w.h:d,ow:n?w.w:u,heightEditorRefer:b,widthEditorRefer:y}},getWWScroll(){const t=this.editor.frameContext.get("wysiwyg"),e=this.selection.getRects(t,"start").rects,i=t.scrollY||t.scrollTop||0,s=t.scrollHeight||0;return{top:i,left:t.scrollX||t.scrollLeft||0,width:t.scrollWidth||0,height:s,bottom:i+s,rects:e}},setRelPosition(i,s,n,o,l){this._scrollY=t.scrollY;let r=0,a=o;do{if(this._isFixed=/^fixed$/i.test(t.getComputedStyle(a).position)){r+=this._scrollY;break}}while(!D(a,"sun-editor")&&(a=a.parentElement));l||(this.__removeGlobalEvent(),this._scrollEvent=this.editor.eventManager.addGlobalEvent("scroll",es.bind(this,i,s,n,o),!1));const h=i.offsetWidth,c=n.offsetWidth,d=this.getGlobal(n).left,u=this.getGlobal(o).left;if(this.options.get("_rtl")){const t=h>c?h-c:0,e=t>0?0:c-h;i.style.left=`${d-t+e+u}px`,u>this.getGlobal(i).left&&(i.style.left=u+"px")}else{const t=o.offsetWidth+u,e=t<=h?0:t-(d+h);i.style.left=e<0?`${d+e+u}px`:`${d}px`}const p=o.contains(i)?this.getGlobal(s).top:0,g=i.offsetHeight,m=this.getGlobalScroll().top;let f=r,_=n;for(;_&&_!==s;)f+=_.offsetTop,_=_.offsetParent;const b=U(e).h-(p-m+f+n.offsetHeight);if(b<g){let t=-1*(g-f+3);const e=p-m+t,s=g+(e<0?e:0);s>b?(i.style.height=`${s}px`,t=-1*(s-f+3)):(i.style.height=`${b}px`,t=f+n.offsetHeight),i.style.top=`${t}px`}else i.style.top=`${f+n.offsetHeight}px`;this._isFixed&&(this._elTop=i.offsetTop)},setAbsPosition(i,s,n){const o={left:0,top:0,...n.addOffset},l=n.position||"bottom",r=n.inst,a=!this.options.get("_rtl");a||(o.left*=-1);const h=this.editor.frameContext.get("wrapper").contains(s)||n.isWWTarget,c=J(s,".se-controller"),d=h&&!c,u=U(e),p=d?this.getWWScroll():this._getWindowScroll(),g=c?s.getBoundingClientRect():this.selection.getRects(s,"start").rects,m=this.getGlobal(s),f=D(i.firstElementChild,"se-arrow")?i.firstElementChild:null,_=f?f.offsetHeight:0,b=i.offsetHeight,y=s.offsetHeight,v=g.top,C=u.h-g.bottom,w=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:x,rmb:k,rt:E}=this._getVMargin(v,C,w,u,g,d,p);if(h&&(k+y<=0||x+E+y<=0))return;let S=o.top,T=0,H="";"bottom"===l?(H="up",S+=g.bottom+_+t.scrollY,T=k-(b+_),T<0&&(H="down",S-=y+b+2*_,T=w+x-(b+_),T<0&&(H="",S-=T))):(H="down",S+=g.top-b-_+t.scrollY,T=x-(b+_),T<0&&(H="up",S+=y+b+2*_,T=k-(b+_),T<0&&(H="",S+=T))),this._setArrow(f,H),i.style.top=`${S}px`;const L=(1===i.nodeType?mt.get(t.getComputedStyle(i).borderRadius):0)||0,M=m.width,N=i.offsetWidth,A=f?f.offsetWidth:0,B=g.left,I=u.w-g.right;let V,O;if(this.editor.frameContext.get("isFullScreen")?(V=B,O=I):(V=g.left,O=u.w-g.right),h&&(V+M<=0||O+M<=0))return;f&&(f.style.left="",f.style.right="");let R=o.left,z=0,$=0,F=0;return a?(R+=g.left+t.scrollX-(V<0?V:0),z=M+V,z<A&&(F=A/2-1+(L<=2?0:L-2),$=F),z=M+O-N,z<0&&(R+=z,F=N-1-(A/2+(L<=2?0:L-2)),$=-(z-A/2),$=$>F?F:$),f&&$>0&&(f.style.left=$+"px")):(R+=g.right-N+t.scrollX+(O<0?O:0),z=M+O,z<A&&(F=A/2-1+(L<=2?0:L-2),$=F),z=M+V-N,z<0&&(R-=z,F=A/2-1+(L<=2?0:L-2),$=-(z-A/2),$=$<F?F:$>N-F?N-F:$),f&&$>0&&(f.style.right=$+"px")),i.style.left=`${R}px`,r.__offset={left:i.offsetLeft+p.left,top:i.offsetTop+p.top,addOffset:o},{position:"up"===H?"bottom":"top"}},setRangePosition(i,s,{position:n,addTop:o}={}){i.style.top="-10000px",i.style.visibility="hidden",i.style.display="block";let l="top"===n;s=s||this.selection.getRange();const r=this.selection.getRects(s,l?"start":"end");l="start"===r.position;const a=this.editor.frameContext.get("isFullScreen"),h=this.editor.frameContext.get("topArea"),c=r.rects,d=a?0:r.scrollLeft,u=a?0:r.scrollTop,p=h.offsetWidth,g=this.getGlobal(h),m=g.left,f=i.offsetWidth,_=i.offsetHeight;this._setOffsetOnRange(l,c,i,m,p,d,u,o),this.getGlobal(i).top-g.top<0&&(l=!l,this._setOffsetOnRange(l,c,i,m,p,d,u,o)),f===i.offsetWidth&&_===i.offsetHeight||this._setOffsetOnRange(l,c,i,m,p,d,u,o);const b=!this.carrierWrapper.contains(i),y=U(e),v=b?this.getWWScroll():this._getWindowScroll(),C=c.height,w=c.top,x=y.h-c.bottom,k=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:E,rmb:S,rt:T}=this._getVMargin(w,x,k,y,c,b,v);if(!(S+C<=0||E+T+C<=0))return t.setTimeout((()=>{i.style.visibility=""}),0),!0},_setOffsetOnRange(t,i,s,n,o,l,r,a=0){const h=s.querySelector(".se-arrow "),c=Math.round(h.offsetWidth/2),d=s.offsetWidth,u=i.noText&&!t?0:s.offsetHeight,p=(t?i.left:i.right)-n-d/2+l,g=p+d-o;let m=(t?i.top-u-c:i.bottom+c)-(i.noText?0:a)+r;const f=p<0?1:g<0?p:p-g-1-1;let _=!1;const b=m+(t?this.getGlobal(this.editor.frameContext.get("topArea")).top:s.offsetHeight-this.editor.frameContext.get("wysiwyg").offsetHeight);!t&&b>0&&this._getPageBottomSpace()<b?(t=!0,_=!0):t&&e.documentElement.offsetTop>b&&(t=!1,_=!0),_&&(m=(t?i.top-u-c:i.bottom+c)-(i.noText?0:a)+r),s.style.left=Math.floor(f)+"px",s.style.top=Math.floor(m)+"px",t?(W(h,"se-arrow-up"),q(h,"se-arrow-down")):(W(h,"se-arrow-down"),q(h,"se-arrow-up"));const y=Math.floor(d/2+(p-f));h.style.left=(y+c>s.offsetWidth?s.offsetWidth-c:y<c?c:y)+"px"},_getPageBottomSpace(){const t=this.editor.frameContext.get("topArea");return e.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)},_getVMargin(e,i,s,n,o,l,r){let a=0,h=0,c=0;if(this.editor.frameContext.get("isFullScreen"))a=e-s,h=i;else{const e=l&&this.editor.frameOptions.get("iframe"),i=o.top,d=n.h-o.bottom,u=this.getGlobal(),p=this.getGlobalScroll(),g=this.editor.frameContext.get("statusbar")?.offsetHeight||0;if(e){const t=u.top-p.top-p.ts,e=this.editor.frameContext.get("topArea").offsetHeight;a=o.top-t,h=d-(p.oh-(e+t)+g)}else{c=this.editor.toolbar._sticky||this.options.get("toolbar_container")?0:s;const e=!l&&/\d+/.test(this.editor.frameOptions.get("height"))?u.top-t.scrollY+c:0,i=!l&&/\d+/.test(this.editor.frameOptions.get("height"))?t.innerHeight-(u.top+u.height-t.scrollY):0;let n=e;s>e?this.editor.toolbar._sticky?(n=s,s=0):n=e+s:this.options.get("toolbar_container")?s=0:n=e+(this.editor.toolbar._sticky?s:0),a=o.top-n,h=r.rects.bottom-o.bottom-i-g}a=(a>0?i:a)-s,h=h>0?d:h}return{rmt:a,rmb:h,rt:c}},_setArrow(t,e){"up"===e?(t&&(t.style.visibility=""),q(t,"se-arrow-up"),W(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),q(t,"se-arrow-down"),W(t,"se-arrow-up")):t&&(t.style.visibility="hidden")},_getWindowScroll(){const i=U(e);return{top:t.scrollY,left:t.scrollX,width:i.w,height:i.h,bottom:t.scrollY+i.h,rects:{left:0,top:0,right:t.innerWidth,bottom:t.innerHeight,noText:!0}}},__removeGlobalEvent(){this._scrollEvent&&(this._scrollEvent=this.editor.eventManager.removeGlobalEvent(this._scrollEvent),this._scrollY=0,this._elTop=null)},constructor:ts};const is=ts;function ss(t){Jt.call(this,t),this.range=null,this.selectionNode=null,this.__iframeFocus=!1}ss.prototype={get(){let t=null;return t="function"==typeof this.editor._shadowRoot?.getSelection?this.editor._shadowRoot.getSelection():this.editor.frameContext.get("_ww").getSelection(),t?(this.status._range||this.editor.frameContext.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t):null},isRange:t=>t instanceof Range,getRange(){const t=this.status._range||this._createDefaultRange(),e=this.get();if(t.collapsed===e.isCollapsed||!this.editor.frameContext.get("wysiwyg").contains(e.focusNode)){if(this.component.is(t.startContainer)){const e=this.component.get(t.startContainer),i=e?.container;return i?this.setRange(i,0,i,1):t}return t}if(e.rangeCount>0)return this.status._range=e.getRangeAt(0),this.status._range;{const t=e.anchorNode,i=e.focusNode,s=e.anchorOffset,n=e.focusOffset,o=gt.query.compareElements(t,i),l=o.ancestor&&(0===o.result?s<=n:o.result>1);return this.setRange(l?t:i,l?s:n,l?i:t,l?n:s)}},setRange(t,e,i,s){let n,o,l,r;if(this.isRange(t)){const e=t;n=e.startContainer,o=e.startOffset,l=e.endContainer,r=e.endOffset}else n=t,o=e,l=i,r=s;if(!n||!l)return;(gt.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(gt.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||gt.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||gt.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.editor.frameContext.get("_wd").createRange();try{a.setStart(n,o),a.setEnd(l,r),this.status.hasFocus=!0}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.editor._nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.status._range=a,this._rangeInfo(a,this.get()),this.editor.frameOptions.get("iframe")&&this.__focus(),a},removeRange(){this.status._range=null,this.selectionNode=null,this.editor.effectNode=null,this.status.hasFocus&&this.get().removeAllRanges(),this.eventManager._setKeyEffect([])},getNearRange(t){const e=t.nextSibling,i=t.previousSibling;return e?{container:e,offset:0}:i?{container:i,offset:1}:null},getRangeAndAddLine(t,e){if(this._isNone(t)){const i=e?.parentElement||this.editor.frameContext.get("wysiwyg"),s=gt.utils.createElement(this.options.get("defaultLine"),null,"<br>");i.insertBefore(s,e&&e!==i?e.previousElementSibling?e.nextElementSibling:e:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this.status._range}return t},getNode(){if(this.editor.frameContext.get("wysiwyg").contains(this.selectionNode)||this._init(),!this.selectionNode){const t=gt.query.getEdgeChild(this.editor.frameContext.get("wysiwyg").firstChild,(t=>0===t.childNodes.length||3===t.nodeType),!1);if(t)return this.selectionNode=t,t;this._init()}return this.selectionNode},getRects(t,e){const i=!!gt.check.isElement(t)&&"absolute"===this._w.getComputedStyle(t).position;t=!t||gt.check.isText(t)?this.getRange():t;const s=this.offset.getGlobalScroll();let n="start"===e,o=s.left,l=s.top,r=t.getClientRects();if(r=r[n?0:r.length-1],!r){const t=this.getNode();if(this.format.isLine(t)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this._init(),r=this.getRange().getClientRects(),r=r[n?0:r.length-1]}if(!r){const e=this.offset.get(t);r={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},o=0,l=0}n=!0}const a=/^iframe$/i.test(this.editor.frameContext.get("wysiwygFrame").nodeName)?this.editor.frameContext.get("wysiwygFrame").getClientRects()[0]:null;return!i&&a&&(r={left:r.left+a.left,top:r.top+a.top,right:r.right+a.right-a.width,bottom:r.bottom+a.bottom-a.height}),{rects:r,position:n?"start":"end",scrollLeft:o,scrollTop:l}},getDragEventLocationRange(t){const e=this.editor.frameContext.get("_wd");let i,s,n,o,l;return e.caretPositionFromPoint?(i=e.caretPositionFromPoint(t.clientX,t.clientY),s=i.offsetNode,n=i.offset,o=i.offsetNode,l=i.offset):e.caretRangeFromPoint&&(i=e.caretRangeFromPoint(t.clientX,t.clientY),s=i.startContainer,n=i.startOffset,o=i.endContainer,l=i.endOffset),{sc:s,so:n,ec:o,eo:l}},scrollTo(t,e){t instanceof Selection?t=t.getRangeAt(0):t instanceof Node?t=this.setRange(t,1,t,1):void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t);const i=t.getBoundingClientRect();if(i.top>=0&&i.bottom<=this.editor.frameContext.get("wysiwygFrame").innerHeight)return;const s=gt.query.getParentElement(t.startContainer,(t=>1===t.nodeType));s?.scrollIntoView?.(e||this.options.get("scrollToOptions"))},_isNone(t){const e=t.commonAncestorContainer;return gt.check.isWysiwygFrame(t.startContainer)&>.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.editor._fileManager.regExp.test(e.nodeName)&&(!this.editor._fileManager.tagAttrs[e.nodeName]||this.editor._fileManager.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.component.is(e)},_createDefaultRange(){const t=this.editor.frameContext.get("wysiwyg"),e=this.editor.frameContext.get("_wd").createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=gt.utils.createElement("BR"),i.appendChild(s))):(s=gt.utils.createElement("BR"),i=gt.utils.createElement(this.options.get("defaultLine"),null,s),t.appendChild(i)),e.setStart(s,0),e.setEnd(s,0),e},_rangeInfo(t,e){let i=null;this.status._range=t,i=t.collapsed?gt.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=i},_init(){const t=this.editor.frameContext.get("_wd").activeElement;if(gt.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let i=null;i=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._rangeInfo(i,e)},__focus(){try{this.__iframeFocus=!0;const t=gt.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.editor.frameContext.get("wysiwyg").focus()}finally{dt._w.setTimeout((()=>this.__iframeFocus=!1),0)}},_resetRangeToTextNode(){let t=this.getRange();if(this._isNone(t)){if(!gt.check.isWysiwygFrame(t.startContainer)||!gt.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,i=e.children[t.startOffset],s=e.children[t.endOffset];if(!(t=this.setRange(i,0,s,i===s?0:1)))return!1}const e=t,i=e.collapsed;let s,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,h=e.endOffset;if(this.format.isLine(l))for(l.childNodes[r]?(l=l.childNodes[r]||l,r=0):(l=l.lastChild||l,r=l.textContent.length);1===l?.nodeType&&l.firstChild;)l=l.firstChild||l,r=0;if(this.format.isLine(a)){for(a=a.childNodes[h]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;i?h=0:h>0&&(h=a.textContent.length)}if(s=gt.check.isWysiwygFrame(l)?this.editor.frameContext.get("wysiwyg").firstChild:l,n=r,gt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=gt.check.isBreak(s);if(!t){const t=s;for(;s&&!gt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let e=this.format.getLine(s,null);e===this.format.getBlock(e,null)&&(s=s||t,e=gt.utils.createElement(gt.query.getParentElement(s,gt.check.isTableCell)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(e,s),s!==t&&e.appendChild(s))}if(gt.check.isBreak(s)||this.component.is(s)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,t&&l===a&&(a=s,h=1)}}if(l=s,r=n,s=gt.check.isWysiwygFrame(a)?this.editor.frameContext.get("wysiwyg").lastChild:a,n=h,gt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=gt.check.isBreak(s);if(!t){for(;s&&!gt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let t=this.format.getLine(s,null);t===this.format.getBlock(t,null)&&(t=gt.utils.createElement(gt.check.isTableCell(t)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(t,s),t.appendChild(s))}if(gt.check.isBreak(s)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,n=1,t&&!s.previousSibling&>.utils.removeItem(a)}}return a=s,h=n,this.setRange(l,r,a,h),!0},constructor:ss};const ns=ss;function os(t){this.editor=t,this.isDisabled=!1}os.prototype={command(t,e,i,s,n,o,l,r){if(this.isDisabled)return!1;let a=null;return a=e?this.editor.shortcutsKeyMap.get(s+(i?"1000":"")):this.editor.shortcutsKeyMap.get(n)||this.editor.shortcutsKeyMap.get(n+t.key),!(!a||!i&&a.s||a.space&&!ft.isSpace(s)||a.enter&&!ft.isEnter(s)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.editor.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:s}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:s,editor:this.editor}):this.editor.run(a.command,a.type,a.button),!0)},disable(){this.isDisabled=!0},enable(){this.isDisabled=!1},constructor:os};const ls=os,{_w:rs}=dt;function as(t,{keyName:e,balloon:i,inline:s,balloonAlways:n,res:o}){Jt.call(this,t),this.keyName=e,this.isSub=/sub/.test(e),this.currentMoreLayerActiveButton=null,this._isBalloon=i,this._isInline=s,this._isBalloonAlways=n,this._responsiveCurrentSize="default",this._originRes=o,this._rButtonArray=o,this._rButtonsInfo=null,this._rButtonsize=null,this._sticky=!1,this._isViewPortSize="visualViewport"in rs,this._inlineToolbarAttr={top:"",width:"",isShow:!1},this._balloonOffset={top:0,left:0},this._setResponsive()}as.prototype={disable(){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff(),gt.utils.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)},enable(){gt.utils.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)},show(){this._isInline?this._showInline():this._isBalloon?this._showBalloon():(this.context.get(this.keyName+".main").style.display="",this.isSub||(this.editor.frameContext.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()},hide(){this._isInline?(this.context.get(this.keyName+".main").style.display="none",this.context.get(this.keyName+".main").style.top="0px",this._inlineToolbarAttr.isShow=!1):(this.context.get(this.keyName+".main").style.display="none",this.isSub||(this.editor.frameContext.get("_stickyDummy").style.display="none"),this._isBalloon&&(this._balloonOffset={top:0,left:0}))},resetResponsiveToolbar(){this.menu.containerOff();const t=this._rButtonsize;if(t){let e=0;e=(this._isBalloon||this._isInline)&&"auto"===this.options.get("toolbar_width")||this.editor.isSubBalloon&&"auto"===this.options.get("toolbar.sub_width")?this.editor.frameContext.get("topArea").offsetWidth:this.context.get(this.keyName+".main").offsetWidth;let i="default";for(let s=1,n=t.length;s<n;s++)if(e<t[s]){i=t[s]+"";break}this._responsiveCurrentSize!==i&&(this._responsiveCurrentSize=i,this.setButtons(this._rButtonsInfo[i]))}},setButtons(t){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff();const{options:e,icons:i,lang:s}=this,n=Ft(t,this.plugins,e,i,s,!0);n.updateButtons.forEach((t=>$t(t.button,t.plugin,this.icons,this.lang))),this.context.get(this.keyName+".main").replaceChild(n.buttonTray,this.context.get(this.keyName+".buttonTray")),this.context.set(this.keyName+".buttonTray",n.buttonTray),this._resetButtonInfo(),this.triggerEvent("onSetToolbarButtons",{buttonTray:n.buttonTray,frameContext:this.editor.frameContext})},_resetButtonInfo(){this.editor.allCommandButtons=new Map,this.editor.subAllCommandButtons=new Map,this.editor.commandTargets=new Map,this.editor.shortcutsKeyMap=new Map,this.editor.__cachingButtons(),this.editor.__cachingShortcuts(),this.history.resetButtons(this.editor.frameContext.get("key"),null),this._resetSticky(),this.editor.effectNode=null,this.viewer._setButtonsActive(),this.status.hasFocus&&this.eventManager.applyTagEffect(),this.editor.frameContext.get("isReadOnly")&&this.ui.setControllerOnDisabledButtons(!0)},_resetSticky(){const t=this.editor.frameContext.get("wrapper");if(!t)return;const e=this.context.get(this.keyName+".main");if(this.editor.frameContext.get("isFullScreen")||0===e.offsetWidth||this.options.get("toolbar_sticky")<0)return;const i=this._isViewPortSize?rs.visualViewport.pageTop:rs.scrollY,s=this.editor.frameContext.get("_minHeight"),n=t.offsetHeight,o=this.offset.getGlobal(this.editor.frameContext.get("topArea")),l=i+this.options.get("toolbar_sticky"),r=(this._isBalloon||this._isInline?o.top:this.offset.getGlobal(this.options.get("toolbar_container")).top)-(this._isInline?e.offsetHeight:0),a=this.options.get("toolbar_container")?o.top-i+n-s-this.options.get("toolbar_sticky")-e.offsetHeight:n+r+this.options.get("toolbar_sticky")-l-s;l<r?this._offSticky():a<0?(this._sticky||this._onSticky(1),e.style.top=1+a+this.__getViewportTop()+"px"):this._onSticky(1)},_onSticky(t){const e=this.context.get(this.keyName+".main");if(!this._isInline){const t=this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.editor.frameContext.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}const i=this.options.get("toolbar_sticky")+t+this.__getViewportTop();e.style.top=`${i}px`,e.style.width=this._isInline?this._inlineToolbarAttr.width:e.offsetWidth+"px",gt.utils.addClass(e,"se-toolbar-sticky"),this._sticky=!0},__getViewportTop(){return this._isViewPortSize?rs.visualViewport.offsetTop:0},_offSticky(){(this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.editor.frameContext.get("_stickyDummy")).style.display="none";const t=this.context.get(this.keyName+".main");t.style.top=this._isInline?this._inlineToolbarAttr.top:"",t.style.width=this._isInline?this._inlineToolbarAttr.width:"",this.editor.frameContext.get("wrapper").style.marginTop="",gt.utils.removeClass(t,"se-toolbar-sticky"),this._sticky=!1},_setResponsive(){if(0===this._rButtonArray?.length)return void(this._rButtonArray=null);this._responsiveCurrentSize="default";const t=this._rButtonsize=[],e=this._originRes,i=this._rButtonsInfo={default:e[0]};for(let s,n,o=1,l=e.length;o<l;o++)n=e[o],s=1*n[0],t.push(s),i[s]=n[1];t.sort(((t,e)=>t-e)).unshift("default")},_showBalloon(t){if(!this._isBalloon)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.selection.getRange(),i=this.context.get(this.keyName+".main"),s=this.selection.get();let n;if(this._isBalloonAlways&&e.collapsed)n=!0;else if(s.focusNode===s.anchorNode)n=s.focusOffset<s.anchorOffset;else{const t=gt.query.getListChildNodes(e.commonAncestorContainer,null);n=gt.utils.getArrayIndex(t,s.focusNode)<gt.utils.getArrayIndex(t,s.anchorNode)}this._setBalloonOffset(n,e),this.triggerEvent("onShowToolbar",{toolbar:i,mode:"balloon",frameContext:this.editor.frameContext})},_setBalloonOffset(t,e){const i=this.context.get(this.keyName+".main"),s=this.editor.frameContext.get("topArea"),n=this.offset.getGlobal(s).top;if(!this.offset.setRangePosition(i,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.options.get("toolbar_container")){const t=s.parentElement;let e=this.options.get("toolbar_container"),n=e.offsetLeft,o=e.offsetTop;for(;!e.parentElement.contains(t)||!/^(BODY|HTML)$/i.test(e.parentElement.nodeName);)e=e.offsetParent,n+=e.offsetLeft,o+=e.offsetTop;i.style.left=i.offsetLeft-n+s.offsetLeft+"px",i.style.top=i.offsetTop-o+s.offsetTop+"px"}const o=this.offset.getWWScroll();this._balloonOffset={top:i.offsetTop+o.top,left:i.offsetLeft+o.left,position:t?"top":"bottom"}},_showInline(){if(!this._isInline)return;const t=this.context.get(this.keyName+".main");t.style.visibility="hidden",this._offSticky(),t.style.display="block",t.style.top="0px",this._inlineToolbarAttr.width=t.style.width=this.options.get(this.keyName+"_width"),this._inlineToolbarAttr.top=t.style.top=this.offset.getGlobal(this.editor.frameContext.get("topArea")).top-this.offset.getGlobal(t).top-t.offsetHeight-1+"px",this._resetSticky(),this._inlineToolbarAttr.isShow=!0,this.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline"}),t.style.visibility=""},_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"},_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.context.get(this.keyName+".main").querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",gt.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}},constructor:as};const hs=as,{_w:cs}=dt;function ds(t){Jt.call(this,t),this._controllerOnBtnDisabled=!1;const e=function({lang:t,icons:e}){const i='<div><button class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return gt.utils.createElement("DIV",{class:"se-alert-content"},i)}(t);this.alertModal=e,this.alertMessage=e.querySelector("span"),this._alertArea=this.carrierWrapper.querySelector(".se-alert"),this._alertInner=this.carrierWrapper.querySelector(".se-alert .se-modal-inner"),this._alertInner.appendChild(e),this._closeListener=[ps.bind(this),us.bind(this)],this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._bindClose=null,this._backWrapper=this.carrierWrapper.querySelector(".se-back-wrapper");const i=function(){const t='<div class="se-toast-container"><span></span></div>';return gt.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=i,this.toastContainer=i.querySelector(".se-toast-container"),this.toastMessage=i.querySelector("span"),this.carrierWrapper.appendChild(i),this._toastToggle=null}function us(t){const e=gt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._alertInner)&&this.alertClose()}function ps(t){ft.isEsc(t.code)&&this.alertClose()}ds.prototype={setEditorStyle(t,e){const i=(e=e||this.editor.frameContext).get("options");i.set("editorStyle",t);const s=pt._setDefaultOptionStyle(i,t);i.set("_defaultStyles",s),e.get("topArea").style.cssText=s.top;const n=e.get("code");n.style.cssText=i.get("_defaultStyles").frame,n.style.display="none",i.get("iframe")?(e.get("wysiwygFrame").style.cssText=s.frame,e.get("wysiwyg").style.cssText=s.editor):e.get("wysiwygFrame").style.cssText=s.frame+s.editor},setTheme(t){if("string"!=typeof t)return;const e=this.options,i=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const s=e=>{e&&(i&>.utils.removeClass(e,i),t&>.utils.addClass(e,t))};s(this.carrierWrapper),this.editor.applyFrameRoots((t=>{s(t.get("topArea")),s(t.get("wysiwyg"))})),s(this.context.get("statusbar._wrapper")),s(this.context.get("toolbar._wrapper"))},readOnly(t,e){const i=e?this.frameRoots.get(e):this.editor.frameContext;i.set("isReadOnly",!!t),gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!!t),t?(this._offCurrentController(),this._offCurrentModal(),this.toolbar?.currentMoreLayerActiveButton?.disabled&&this.toolbar._moreLayerOff(),this.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.subToolbar._moreLayerOff(),this.menu?.currentDropdownActiveButton?.disabled&&this.menu.dropdownOff(),this.menu?.currentContainerActiveButton?.disabled&&this.menu.containerOff(),i.get("code").setAttribute("readOnly","true"),gt.utils.addClass(i.get("wysiwyg"),"se-read-only")):(i.get("code").removeAttribute("readOnly"),gt.utils.removeClass(i.get("wysiwyg"),"se-read-only")),this.options.get("hasCodeMirror")&&this.viewer._codeMirrorEditor("readonly",!!t,e)},disable(t){const e=t?this.frameRoots.get(t):this.editor.frameContext;this.toolbar.disable(),this._offCurrentController(),this._offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable",!1),e.set("isDisabled",!0),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0},enable(t){const e=t?this.frameRoots.get(t):this.editor.frameContext;this.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable",!0),e.set("isDisabled",!1),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1},show(t){const e=(t?this.frameRoots.get(t):this.editor.frameContext).get("topArea").style;"none"===e.display&&(e.display="block")},hide(t){(t?this.frameRoots.get(t):this.editor.frameContext).get("topArea").style.display="none"},showLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="block"},hideLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="none"},setControllerOnDisabledButtons(t){t&&!this._controllerOnBtnDisabled?(gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!0),this._controllerOnBtnDisabled=!0):!t&&this._controllerOnBtnDisabled&&(gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!1),this._controllerOnBtnDisabled=!1)},enableBackWrapper(t){this._backWrapper.style.cursor=t,this._backWrapper.style.display="block"},disableBackWrapper(){this._backWrapper.style.display="none",this._backWrapper.style.cursor="default"},alertOpen(t,e){this.alertMessage.textContent=t,gt.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&>.utils.addClass(this.alertModal,`se-alert-${e}`),this._closeSignal&&this._alertInner.addEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this._alertArea.style.display="block",gt.utils.addClass(this.alertModal,"se-modal-show")},alertClose(){gt.utils.removeClass(this.alertModal,"se-modal-show"),gt.utils.removeClass(this.alertModal,"se-alert-*"),this._alertArea.style.display="none",this._closeSignal&&this._alertInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))},showToast(t,e=1e3,i){gt.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),gt.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),i&>.utils.addClass(this.toastPopup,`se-toast-${i}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,gt.utils.addClass(this.toastContainer,"se-toast-show"),this._toastToggle=cs.setTimeout((()=>{this.closeToast()}),e)},closeToast(){this._toastToggle&&cs.clearTimeout(this._toastToggle),this._toastToggle=null,gt.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"},_visibleControllers(t,e){const i=t?"":"hidden",s=e??i?"":"hidden",n=this.editor.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=i);this.editor._lineBreaker_t.style.visibility=s,this.editor._lineBreaker_b.style.visibility=s},_offCurrentController(){this.component.__deselect()},__offControllers(){const t=this.editor.opendControllers,e=[];for(let i,s=0;s<t.length;s++)i=t[s],i.fixed?e.push(i):("function"==typeof i.inst.close&&i.inst.close(),i.form&&(i.form.style.display="none"));this.editor.opendControllers=e,this.editor.currentControllerName="",this.editor._preventBlur=!1},_offCurrentModal(){this.editor.opendModal&&this.editor.opendModal.close()},constructor:ds};const gs=ds;function ms(t){Jt.call(this,t),this.bodyOverflow="",this.editorAreaOriginCssText="",this.wysiwygOriginCssText="",this.codeWrapperOriginCssText="",this.codeOriginCssText="",this.codeNumberOriginCssText="",this.toolbarOriginCssText="",this.arrowOriginCssText="",this.fullScreenInnerHeight=0,this.fullScreenSticky=!1,this.fullScreenBalloon=!1,this.fullScreenInline=!1,this.toolbarParent=null}function fs(t){const e=dt._w.getComputedStyle(t).lineHeight;let i;if(mt.is(e))i=mt.get(e);else{const e=dt._w.getComputedStyle(t).fontSize;i=1.2*mt.get(e)}return i}ms.prototype={codeView(t){const e=this.editor.frameContext;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;e.set("isCodeView",t),this.ui._offCurrentController(),this.ui._offCurrentModal();const i=e.get("codeWrapper"),s=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this._setEditorDataToCodeView(),i.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?s.style.height="100%":"auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||(s.style.height=s.scrollHeight>0?s.scrollHeight+"px":"auto"),this.options.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.editor._notHideToolbar=!0,this.editor.isBalloon&&(this.context.get("toolbar._arrow").style.display="none",this.context.get("toolbar.main").style.left="",this.editor.isInline=this.toolbar._isInline=!0,this.editor.isBalloon=this.toolbar._isBalloon=!1,this.toolbar._showInline())),this.editor.isSubBalloon&&this.subToolbar.hide(),function(t){const e=t.get("codeNumbers");if(!e)return;const i=fs(e),s=t.get("code").scrollHeight/i;let n="";for(let t=1;t<=s;t++)n+=`${t}\n`;const{padding:o,margin:l}=dt._w.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.status._range=null,s.focus(),gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.addClass(o,"se-code-view-status")):(gt.check.isNonEditable(n)||this._setCodeDataToEditor(),n.scrollTop=0,i.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.editor._notHideToolbar=!1,/balloon/.test(this.options.get("mode"))&&(this.context.get("toolbar._arrow").style.display="",this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!0,this.eventManager._hideToolbar())),this.editor._nativeFocus(),gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),gt.check.isNonEditable(n)||(this.history.push(!1),this.history.resetButtons(e.get("key"),null)),gt.utils.removeClass(o,"se-code-view-status")),this.editor._checkPlaceholder(e),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,t),e.has("documentType-use-header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})},fullScreen(t){const e=this.editor.frameContext;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const i=e.get("topArea"),s=this.context.get("toolbar.main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),h=this.editor.frameContext.get("isCodeView"),c=this.context.get("toolbar._arrow");this.ui._offCurrentController();const d="none"===s.style.display||this.editor.isInline&&!this.editor.toolbar._inlineToolbarAttr.isShow;if(t){this._originCssText=i.style.cssText,this.editorAreaOriginCssText=n.style.cssText,this.wysiwygOriginCssText=o.style.cssText,this.codeWrapperOriginCssText=l.style.cssText,this.codeOriginCssText=r.style.cssText,this.codeNumberOriginCssText=a?.style.cssText,this.toolbarOriginCssText=s.style.cssText,c&&(this.arrowOriginCssText=c.style.cssText),(this.editor.isBalloon||this.editor.isInline)&&(c&&(c.style.display="none"),this.fullScreenInline=this.editor.isInline,this.fullScreenBalloon=this.editor.isBalloon,this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!1),this.options.get("toolbar_container")&&(this.toolbarParent=s.parentElement,e.get("container").insertBefore(s,n)),i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.maxWidth="100%",i.style.height="100%",i.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.fullScreenSticky=!0,e.get("_stickyDummy").style.display="none",gt.utils.removeClass(s,"se-toolbar-sticky")),this.bodyOverflow=this._d.body.style.overflow,this._d.body.style.overflow="hidden",n.style.cssText=s.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.editor.frameOptions.get("_defaultStyles").editor+(h?"display: none;":""),l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${h?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%",r.style.height="",s.style.width=o.style.height="100%",s.style.position="relative",s.style.display="block",this.fullScreenInnerHeight=this._w.innerHeight-s.offsetHeight,n.style.height=this.fullScreenInnerHeight-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.options.get("fullScreenOffset")+"px",this.editor.frameOptions.get("iframe")&&"auto"===this.editor.frameOptions.get("height")&&(n.style.overflow="auto",this.editor._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.options.get("fullScreenOffset")+"px";const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.addClass(e,"active")}))}else{o.style.cssText=this.wysiwygOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(h?"display: none;":""),l.style.cssText=this.codeWrapperOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${h?"flex":"none"} !important;`,r.style.cssText=this.codeOriginCssText,a&&(a.style.cssText=this.codeNumberOriginCssText),s.style.cssText=this.toolbarOriginCssText,n.style.cssText=this.editorAreaOriginCssText,i.style.cssText=this._originCssText,c&&(c.style.cssText=this.arrowOriginCssText),this._d.body.style.overflow=this.bodyOverflow,"auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.toolbarParent&&(this.toolbarParent.appendChild(s),this.toolbarParent=null),this.options.get("toolbar_sticky")>-1&>.utils.removeClass(s,"se-toolbar-sticky"),this.fullScreenSticky&&!this.options.get("toolbar_container")&&(this.fullScreenSticky=!1,e.get("_stickyDummy").style.display="block",gt.utils.addClass(s,"se-toolbar-sticky")),this.editor.isInline=this.toolbar._isInline=this.fullScreenInline,this.editor.isBalloon=this.toolbar._isBalloon=this.fullScreenBalloon,e.get("isCodeView")||(this.editor.isInline?this.editor.toolbar._showInline():this.editor.isBalloon&&this.editor.toolbar._showBalloon()),this.editor.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.removeClass(e,"active")}))}d&&!e.get("isCodeView")&&this.editor.toolbar.hide(),this.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})},showBlocks(t){const e=this.editor.frameContext;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(gt.utils.addClass(e.get("wysiwyg"),"se-show-block"),gt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active")):(gt.utils.removeClass(e.get("wysiwyg"),"se-show-block"),gt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")),this.editor._resourcesStateChange(e)},_setButtonsActive(){const t=this.editor.frameContext;if(t.get("isCodeView")?gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"):gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.addClass(e,"active")}))}else{const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.removeClass(e,"active")}))}t.get("isShowBlocks")?gt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active"):gt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")},print(){const t=gt.utils.createElement("IFRAME",{style:"display: none;"});this._d.body.appendChild(t);const e=this._w.getComputedStyle(this.editor.frameContext.get("wysiwyg")).padding,i=this.options.get("printTemplate")?this.options.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get()):this.html.get(),s=gt.query.getIframeDocument(t),n=this.editor.frameContext.get("_wd"),o=this.options.get("_rtl")?" se-rtl":"",l=`\n\t\t\t<style>\n\t\t\t\t@page {\n\t\t\t\t\tsize: A4;\n\t\t\t\t\tmargin: ${e};\n\t\t\t\t}\n\t\t\t</style>`;if(this.editor.frameOptions.get("iframe")){const t=this.options.get("printClass")?'class="'+this.options.get("printClass")+o+'"':this.editor.frameOptions.get("iframe_fullPage")?gt.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+o+'"';s.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n.head.innerHTML}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${t} style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=this._d.head.getElementsByTagName("link"),e=this._d.head.getElementsByTagName("style");let n="";for(let e=0,i=t.length;e<i;e++)n+=t[e].outerHTML;for(let t=0,i=e.length;t<i;t++)n+=e[t].outerHTML;s.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.options.get("printClass")||this.options.get("_editableClass"))+o}" style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.ui.showLoading(),this._w.setTimeout((()=>{try{if(t.focus(),dt.isEdge||dt.isChromium||"StyleMedia"in dt._w)try{t.contentWindow.document.execCommand("print",!1,null)}catch(e){console.warn("[SUNEDITOR.print.warn]",e),t.contentWindow.print()}else t.contentWindow.print()}catch(t){throw Error(`[SUNEDITOR.print.fail] error: ${t.message}`)}finally{this.ui.hideLoading(),gt.utils.removeItem(t)}}),1e3)},preview(){this.menu.dropdownOff(),this.menu.containerOff(),this.ui._offCurrentController(),this.ui._offCurrentModal();const t=this.options.get("previewTemplate")?this.options.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get({withFrame:!0})):this.html.get({withFrame:!0}),e=this._w.open("","_blank"),i=this.editor.frameContext.get("_wd"),s=this.options.get("_rtl")?" se-rtl":"";if(this.editor.frameOptions.get("iframe")){const n=this.options.get("printClass")?'class="'+this.options.get("printClass")+s+'"':this.editor.frameOptions.get("iframe_fullPage")?gt.utils.getAttributesToString(i.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+s+'"';e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${i.head.innerHTML}\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tbody {overflow:auto !important; height:auto !important;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${n}>\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const i=this._d.head.getElementsByTagName("link"),n=this._d.head.getElementsByTagName("style");let o="";for(let t=0,e=i.length;t<e;t++)o+=i[t].outerHTML;for(let t=0,e=n.length;t<e;t++)o+=n[t].outerHTML;e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<meta charset="utf-8" />\n\t\t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">\n\t\t\t\t\t\t<title>${this.lang.preview}</title>\n\t\t\t\t\t\t${o}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.options.get("printClass")?this.options.get("printClass"):this.options.get("_editableClass"))+s}" style="height:auto">\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}},_resetFullScreenHeight(){if(this.editor.frameContext.get("isFullScreen"))return this.fullScreenInnerHeight+=this._w.innerHeight-this.context.get("toolbar.main").offsetHeight-(this.editor.frameContext.has("statusbar")?this.editor.frameContext.get("statusbar").offsetHeight:0)-this.fullScreenInnerHeight,this.editor.frameContext.get("wrapper").style.height=this.fullScreenInnerHeight+"px",!0},_codeMirrorEditor(t,e,i){const s=i?this.frameRoots.get(i).get("options"):this.editor.frameOptions;switch(t){case"set":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").getDoc().setValue(e):s.has("codeMirror6Editor")&&s.get("codeMirror6Editor").dispatch({changes:{from:0,to:s.get("codeMirror6Editor").state.doc.length,insert:e}});break;case"get":if(s.has("codeMirror5Editor"))return s.get("codeMirror5Editor").getDoc().getValue();if(s.has("codeMirror6Editor"))return s.get("codeMirror6Editor").state.doc.toString();break;case"readonly":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").setOption("readOnly",e):s.has("codeMirror6Editor")&&(e?s.get("codeMirror6Editor").contentDOM.removeAttribute("contenteditable"):s.get("codeMirror6Editor").contentDOM.setAttribute("contenteditable",!0));break;case"refresh":s.has("codeMirror5Editor")&&s.get("codeMirror5Editor").refresh()}},_setCodeView(t){this.options.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.editor.frameContext.get("code").value=t},_getCodeView(){return this.options.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.editor.frameContext.get("code").value},_setCodeDataToEditor(){const t=this._getCodeView();if(this.editor.frameOptions.get("iframe_fullPage")){const e=this.editor.frameContext.get("_wd"),i=(new DOMParser).parseFromString(t,"text/html");if(!this.options.get("__allowedScriptTag")){const t=i.head.children;for(let e=0,s=t.length;e<s;e++)/^script$/i.test(t[e].tagName)&&(i.head.removeChild(t[e]),e--,s--)}let s=i.head.innerHTML;i.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.editor.frameOptions.get("height")||i.head.querySelector("style"))||(s+=pt._setIframeStyleLinks(this.editor.frameOptions.get("iframe_cssFileName"))+pt._setAutoHeightStyle(this.editor.frameOptions.get("height"))),e.head.innerHTML=s,e.body.innerHTML=this.html.clean(i.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")});const n=i.body.attributes;for(let t=0,i=n.length;t<i;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!gt.utils.hasClass(e.body,"sun-editor-editable")){const t=this.options.get("_editableClass").split(" ");for(let i=0;i<t.length;i++)gt.utils.addClass(e.body,this.options.get("_editableClass")[i])}}else this.editor.frameContext.get("wysiwyg").innerHTML=t.length>0?this.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")}):"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">"},_setEditorDataToCodeView(){const t=this.html._convertToCode(this.editor.frameContext.get("wysiwyg"),!1);let e="";if(this.editor.frameOptions.get("iframe_fullPage")){const i=gt.utils.getAttributesToString(this.editor.frameContext.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.editor.frameContext.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+i+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)},_codeViewAutoHeight(t,e,i){i&&(t.style.height=t.scrollHeight+"px"),this._updateLineNumbers(e,t)},_updateLineNumbers(t,e){if(!t)return;const i=fs(t),s=Math.ceil(e.scrollHeight/i),n=(t.value.match(/\n/g)||[]).length;if(s>n){let e="";for(let t=n+1;t<=s;t++)e+=`${t}\n`;t.value+=e}},_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft},constructor:ms};const _s=ms,bs=".se-menu-list .se-toolbar-btn[data-command]",ys=`${bs}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,vs=`${bs}:not([class~="se-component-enabled"]):not([data-type="MORE"])`;function Cs(t,e){const i=t[0].target.ownerDocument||dt._d,s=i.defaultView||dt._w,n=Pt(t,e);this.rootKeys=n.rootKeys,this.frameRoots=n.frameRoots,this.context=n.context,this.frameContext=new Map,this.frameOptions=new Map,this._d=i,this._w=s,this.carrierWrapper=n.carrierWrapper,this.options=n.options,this.plugins=n.plugins||{},this.events=null,this.triggerEvent=null,this.icons=n.icons,this.lang=n.lang,this.status={hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],onSelected:!1,rootKey:n.rootId,_range:null,_onMousedown:!1},this.isClassic=!1,this.isInline=!1,this.isBalloon=!1,this.isBalloonAlways=!1,this.isSubBalloon=!1,this.isSubBalloonAlways=!1,this.allCommandButtons=new Map,this.subAllCommandButtons=new Map,this.shortcutsKeyMap=new Map,this.reverseKeys=[],this.commandTargets=new Map,this.activeCommands=null,this.effectNode=null,this.opendModal=null,this.opendControllers=[],this.currentControllerName="",this.opendBrowser=null,this.selectMenuOn=!1,this.history=null,this.eventManager=null,this.toolbar=null,this.subToolbar=null,this.char=null,this.component=null,this.format=null,this.html=null,this.menu=null,this.nodeTransform=null,this.offset=null,this.selection=null,this.shortcuts=null,this.ui=null,this.viewer=null,this._lineBreaker_t=null,this._lineBreaker_b=null,this._shadowRoot=null,this._onPluginEvents=null,this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,this._controllerTargetContext=null,this._controllerOnDisabledButtons=[],this._codeViewDisabledButtons=[],this._pluginCallButtons=n.pluginCallButtons,this._pluginCallButtons_sub=n.pluginCallButtons_sub,this._responsiveButtons=n.responsiveButtons,this._responsiveButtons_sub=n.responsiveButtons_sub,this._notHideToolbar=!1,this._preventBlur=!1,this._preventFocus=!1,this._preventSelection=!1,this._componentsInfoInit=!0,this._componentsInfoReset=!1,this._MELInfo=null,this._fileInfoPluginsCheck=null,this._fileInfoPluginsReset=null,this._fileManager={tags:null,regExp:null,pluginRegExp:null,pluginMap:null},this._componentManager=[],this._figureContainer=null,this._originOptions=e,this.__Create(e)}function ws(t,e,i,s,n,o){const l=e[t],r=Object.keys(l);if(ks(r,null,t+"."),0===r.length)return!1;const a=t||null;s.set(a,new Map);const h=i.get(a).get("options").get("_origin"),c={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(St,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(s.get(a).set(xs(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}function xs(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}function ks(t,e,i){for(let s,n=0,o=t.length;n<o;n++)s=t[n],("fixed"===Tt[s]||"fixed"===St[s]||e&&e[s])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${i+s}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}Cs.prototype={registerPlugin(t,e,i){let s=this.plugins[t];if(!s)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.plugins[t]&&(s=this.plugins[t]=new this.plugins[t](this,i||{}),"function"==typeof s.init&&s.init()),e){for(let t=0,i=e.length;t<i;t++)$t(e[t],s,this.icons,this.lang);this.activeCommands.includes(t)||"function"!=typeof this.plugins[t].active||this.activeCommands.push(t)}},run(t,e,i){if(e){if(/more/i.test(e)){const e=gt.query.getParentElement(i,".se-toolbar"),s=gt.utils.hasClass(e,"se-toolbar-sub")?this.subToolbar:this.toolbar;if(i!==s.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(s._moreLayerOn(i,n),s._showBalloon(),s._showInline()),gt.utils.addClass(i,"on")}else s.currentMoreLayerActiveButton&&(s._moreLayerOff(),s._showBalloon(),s._showInline());return void this.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentContainerActiveButton))return void this.menu.containerOn(i);if(this.frameContext.get("isReadOnly")&>.utils.arrayIncludes(this._controllerOnDisabledButtons,i))return;if(/dropdown/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentDropdownActiveButton))return void this.menu.dropdownOn(i);if(/modal/.test(e))return void this.plugins[t].open(i);/command/.test(e)?this.plugins[t].action(i):/browser/.test(e)?this.plugins[t].open(null):/popup/.test(e)&&this.plugins[t].show()}else t&&this.commandHandler(t,i);/dropdown/.test(e)?this.menu.dropdownOff():/command/.test(e)||(this.menu.dropdownOff(),this.menu.containerOff())},async commandHandler(t,e){if(!this.frameContext.get("isReadOnly")||/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(t))switch(t){case"selectAll":!function(t){t.ui._offCurrentController(),t.menu.containerOff();const e=t.frameContext.get("wysiwyg");let i=null,s="";const n=t.options.get("scopeSelectionTags"),o=t.selection.getRange();if(!o.collapsed){let t=o.commonAncestorContainer,l=t.nodeName?.toLowerCase();for(;t&&(!t.nextSibling&&!t.previousSibling&&!n.includes(l)||gt.check.isContentLess(l))&&t!==e;)t=t.parentElement,l=t.nodeName?.toLowerCase();n.includes(l)&&(i=t,s=l)}const l=n.filter((t=>t!==s));let r=gt.query.getParentElement(i||t.selection.getNode(),(t=>l.includes(t.nodeName?.toLowerCase())))||e,{first:a,last:h}=Zt(r);if(!a||!h)return;const c=gt.check.isZeroWidth;for(;c(a)&&c(h)&&r!==e;)r=r.parentElement,({first:a,last:h}=Zt(gt.query.getParentElement(r,(t=>l.includes(t.nodeName?.toLowerCase())))||e));if(!a||!h)return;let d=null;if(gt.check.isMedia(a)||(d=t.component.get(a.parentElement))||gt.check.isTableElements(a)){const e=gt.utils.createElement("BR"),i=gt.utils.createElement(t.options.get("defaultLine"),null,e);a=d?d.container||d.cover:a,a.parentElement.insertBefore(i,a),a=e}if(gt.check.isMedia(h)||(d=t.component.get(h.parentElement))||gt.check.isTableElements(h)){const e=gt.utils.createElement("BR"),i=gt.utils.createElement(t.options.get("defaultLine"),null,e);h=d?d.container||d.cover:h,h.parentElement.appendChild(i),h=e}t.toolbar._showBalloon(t.selection.setRange(a,0,h,h.textContent.length))}(this);break;case"copy":{const t=this.selection.getRange();if(t.collapsed)break;const e=gt.utils.createElement("div",null,t.cloneContents());await this.html.copy(e.innerHTML);break}case"newDocument":this.html.set(`<${this.options.get("defaultLine")}><br></${this.options.get("defaultLine")}>`),this.focus(),this.history.push(!1);break;case"codeView":this.viewer.codeView(!this.frameContext.get("isCodeView"));break;case"fullScreen":this.viewer.fullScreen(!this.frameContext.get("isFullScreen"));break;case"indent":this.format.indent();break;case"outdent":this.format.outdent();break;case"undo":this.history.undo();break;case"redo":this.history.redo();break;case"removeFormat":this.format.removeInlineElement(),this.focus();break;case"print":this.viewer.print();break;case"preview":this.viewer.preview();break;case"showBlocks":this.viewer.showBlocks(!this.frameContext.get("isShowBlocks"));break;case"dir":this.setDir(this.options.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.setDir("ltr");break;case"dir_rtl":this.setDir("rtl");break;case"save":await async function(t){const e=t.frameContext;if(!e.get("isChanged"))return;const i=t.html.get(),s=await t.triggerEvent("onSave",{frameContext:e,data:i});if(s===Dt){const t=e.get("originElement");/^TEXTAREA$/i.test(t.nodeName)?t.value=i:t.innerHTML=i}else if(!1===s)return;e.set("isChanged",!1),e.set("savedIndex",t.history.getRootStack()[t.status.rootKey].index),t.applyCommandTargets("save",(t=>{t.disabled=!0}))}(this);break;case"copyFormat":jt(this,e);break;case"pageBreak":!function(t){const e=gt.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});t.component.insert(e,{skipCharCount:!0,skipSelection:!0,skipHistory:!1});const i=e.nextElementSibling||t.format.addLine(e);t.selection.setRange(i,1,i,1),t.history.push(!1)}(this);break;case"pageUp":this.frameContext.get("documentType").pageUp();break;case"pageDown":this.frameContext.get("documentType").pageDown();break;default:!function(t,e){e=t.options.get("_defaultTagCommand")[e.toLowerCase()]||e;let i=t.options.get("convertTextTags")[e]||e;const s=t.status.currentNodesMap,n=s.includes(t.options.get("_styleCommandMap")[i])?null:gt.utils.createElement(i);/^sub$/i.test(i)&&s.includes("superscript")?i="sup":/^sup$/i.test(i)&&s.includes("subscript")&&(i="sub"),t.format.applyInlineElement(n,{stylesToModify:qt[e]||null,nodesToRemove:[i],strictRemove:!1}),t.focus()}(this,t)}},runFromTarget(t){if(gt.check.isInputElement(t))return;const e=gt.query.getCommandTarget(t);if(!e)return;const i=e.getAttribute("data-command"),s=e.getAttribute("data-type");(i||s)&&(e.disabled||this.run(i,s,t))},applyCommandTargets(t,e){this.commandTargets.has(t)&&this.commandTargets.get(t).forEach(e)},applyFrameRoots(t){this.frameRoots.forEach(t)},isEmpty(t){const e=(t=t||this.frameContext).get("wysiwyg");return gt.check.isZeroWidth(e.textContent)&&!e.querySelector(this.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1},setDir(t){const e="rtl"===t;if(this.options.get("_rtl")!==e){try{this.options.set("_rtl",e),this.ui._offCurrentController();const i=this.frameContext,s=this.plugins;for(const e in s)"function"==typeof s[e].setDir&&s[e].setDir(t);const n=this.context.get("toolbar._wrapper"),o=this.context.get("statusbar._wrapper");e?(this.applyFrameRoots((t=>{gt.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),gt.utils.addClass([this.carrierWrapper,n,o],"se-rtl")):(this.applyFrameRoots((t=>{gt.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),gt.utils.removeClass([this.carrierWrapper,n,o],"se-rtl"));const l=gt.query.getListChildren(i.get("wysiwyg"),(t=>this.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)));for(let t,e,i,s=0;t=l[s];s++)t=l[s],i=t.style.marginRight,e=t.style.marginLeft,(i||e)&&(t.style.marginRight=e,t.style.marginLeft=i),i=t.style.textAlign,"left"===i?t.style.textAlign="right":"right"===i&&(t.style.textAlign="left");!function(t,e){const i=t.icons,s=t.commandTargets,n=t.shortcutsKeyMap;t.reverseKeys.forEach((t=>{const e=n.get(t);if(!e)return;const i=e.c;e.c=e.r,e.r=i})),t.applyCommandTargets("dir",(s=>{gt.utils.changeTxt(s.querySelector(".se-tooltip-text"),t.lang[e?"dir_ltr":"dir_rtl"]),gt.utils.changeElement(s.firstElementChild,i[e?"dir_ltr":"dir_rtl"])})),e?(gt.utils.addClass(s.get("dir_rtl"),"active"),gt.utils.removeClass(s.get("dir_ltr"),"active")):(gt.utils.addClass(s.get("dir_ltr"),"active"),gt.utils.removeClass(s.get("dir_rtl"),"active"))}(this,e),i.has("documentType-use-header")&&(e?i.get("wrapper").appendChild(i.get("documentTypeInner")):i.get("wrapper").insertBefore(i.get("documentTypeInner"),i.get("wysiwygFrame"))),i.has("documentType-use-page")&&(e?i.get("wrapper").insertBefore(i.get("documentTypePage"),i.get("wysiwygFrame")):i.get("wrapper").appendChild(i.get("documentTypePage"))),this.isBalloon?this.toolbar._showBalloon():this.isSubBalloon&&this.subToolbar._showBalloon()}catch(t){this.options.set("_rtl",!e),console.warn(`[SUNEDITOR.setDir.fail] ${t.toString()}`)}this.effectNode=null,this.eventManager.applyTagEffect()}},resetOptions(t){this.viewer.codeView(!1),this.viewer.showBlocks(!1);const e=new Map,i=this.frameRoots,s=[],n=new Map,o={};for(const e in t)void 0!==St[e]&&(o[e]=t[e],delete t[e]);for(const e of i.keys())t[e||""]={...o,...t[e||""]};const l=Object.keys(t);if(ks(l,this.plugins,""),0===l.length)return;1===i.size&&l.unshift(null);const r=[this._originOptions,t].reduce(((t,o)=>{for(const l in o)i.has(l||null)?ws(l,o,i,e,n,s):t[l]=o[l];return t}),{}),a=this.options,h=Nt(r,s,this.plugins),c=h.o,d=h.frameMap;for(let t,s=0,o=l.length;s<o;s++)if(t=l[s]||null,n.has(t)){const s=e.get(t),n=i.get(t),o=n.get("options"),l=d.get(t);if(n.set("options",l),s.has("statusbar-changed")){if(gt.utils.removeItem(n.get("statusbar")),l.get("statusbar")){const t=At(l,null).statusbar;n.get("container").appendChild(t),xt(t,n),this.eventManager.__addStatusbarEvent(n,l)}else this.eventManager.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),xt(null,n);n.get("statusbar")&&this.char.display(n)}if(s.has("iframe_attributes")){const t=n.get("wysiwygFrame"),e=o.get("iframe_attributes"),i=l.get("iframe_attributes");for(const i in e)t.removeAttribute(i,e[i]);for(const e in i)t.setAttribute(e,i[e])}if(s.has("iframe_cssFileName")){const t=n.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const i=(new DOMParser).parseFromString(pt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,s=t.querySelector("style");for(;i[0];)t.insertBefore(i[0],s)}s.has("placeholder")&&(n.get("placeholder").textContent=l.get("placeholder")),this.ui.setEditorStyle(l.get("editorStyle"),n);const r=n.get("wysiwyg"),a=o.get("editableFrameAttributes"),h=l.get("editableFrameAttributes");for(const t in a)r.removeAttribute(t,a[t]);for(const t in h)r.setAttribute(t,h[t])}else switch(a.set(t,c.get(t)),t){case"theme":this.ui.setTheme(a.get("theme"));break;case"events":{const t=a.get("events");for(const e in t)this.events[e]=t[e];break}case"autoStyleify":this.html.__resetAutoStyleify(a.get("autoStyleify"));break;case"textDirection":this.setDir(a.get("_rtl")?"ltr":"rtl");break;case"historyStackDelayTime":this.history.resetDelayTime(a.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":this.format.__resetBrLineBreak(a.get("defaultLineBreakFormat"))}this._originOptions=r;const u=this.context.get("toolbar.main");/inline|balloon/i.test(a.get("mode"))&&l.includes("toolbar_width")&&(u.style.width=a.get("toolbar_width")),a.get("toolbar_hide")?u.style.display="none":u.style.display="",a.get("shortcutsHint")?gt.utils.removeClass(u,"se-shortcut-hide"):gt.utils.addClass(u,"se-shortcut-hide"),this.effectNode=null,this._setFrameInfo(this.frameRoots.get(this.status.rootKey))},changeFrameContext(t){t!==this.status.rootKey&&(this.status.rootKey=t,this._setFrameInfo(this.frameRoots.get(t)),this.toolbar._resetSticky())},execCommand(t,e,i){this.frameContext.get("_wd").execCommand(t,e,"formatBlock"===t?"<"+i+">":i),this.history.push(!0)},focus(t){if(t&&this.changeFrameContext(t),"none"!==this.frameContext.get("wysiwygFrame").style.display){if(this._preventBlur=!1,this.frameOptions.get("iframe")||!this.frameContext.get("wysiwyg").contains(this.selection.getNode()))this._nativeFocus();else try{const t=this.selection.getRange();if(t.startContainer===t.endContainer&>.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.format.isLine(e)&&!this.component.is(e)){const t=gt.utils.createElement("BR"),i=gt.utils.createElement(this.options.get("defaultLine"),null,t);return this.frameContext.get("wysiwyg").insertBefore(i,e),void this.selection.setRange(t,0,t,0)}}this.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this._nativeFocus()}this.isBalloon&&this.eventManager._toggleToolbarBalloon()}},focusEdge(t){this._preventBlur=!1,t||(t=this.frameContext.get("wysiwyg").lastElementChild);const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=gt.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.selection.setRange(t,t.textContent.length,t,t.textContent.length):this._nativeFocus()):this.focus()},blur(){this.frameOptions.get("iframe")?this.frameContext.get("wysiwygFrame").blur():this.frameContext.get("wysiwyg").blur()},destroy(){this.history.destroy(),this.eventManager._removeAllEvents(),this.options.get("codeMirror6Editor")&&this.options.get("codeMirror6Editor").destroy(),gt.utils.removeItem(this.carrierWrapper),gt.utils.removeItem(this.context.get("toolbar._wrapper")),gt.utils.removeItem(this.context.get("toolbar.sub._wrapper")),gt.utils.removeItem(this.context.get("statusbar._wrapper")),this.applyFrameRoots((t=>{gt.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.options.clear(),this.context.clear();let t=this.plugins;for(const e in t){const i=t[e];"function"==typeof i._destroy&&i._destroy();for(const t in i)delete i[t];delete t[e]}t=this.events;for(const e in t)delete t[e];t=["eventManager","char","component","format","html","menu","nodeTransform","offset","selection","shortcuts","toolbar","ui","viewer"];for(let e,i=0,s=t.length;i<s;i++){e=this[t[i]];for(const t in e)delete e[t]}if(t=this.subToolbar,t)for(const e in t)delete t[e];t=null;for(const t in this)delete this[t];return null},_setFrameInfo(t){this.frameContext=t,this.frameOptions=t.get("options"),t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this._lineBreaker_t=t.get("lineBreaker_t"),this._lineBreaker_b=t.get("lineBreaker_b")},_nativeFocus(){this.selection.__focus(),this.selection._init()},_checkComponents(t){for(let e=0,i=this._fileInfoPluginsCheck.length;e<i;e++)this._fileInfoPluginsCheck[e](t)},_resetComponents(){for(let t=0,e=this._fileInfoPluginsReset.length;t<e;t++)this._fileInfoPluginsReset[t]()},_initWysiwygArea(t,e){t.get("wysiwyg").innerHTML=this.html.clean("string"==typeof e?e:(/^TEXTAREA$/i.test(t.get("originElement").nodeName)?t.get("originElement").value:t.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")})||"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">",t.has("charCounter")&&(t.get("charCounter").textContent=this.char.getLength()),"document"===this.options.get("type")&&(t.set("documentType",new Ke(this,t)),t.get("documentType").useHeader&&t.set("documentType-use-header",!0),t.get("documentType").usePage&&(t.set("documentType-use-page",!0),t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML))},_resourcesStateChange(t){this._iframeAutoHeight(t),this._checkPlaceholder(t),"document"===this.options.get("type")&&t.get("documentType").usePage&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML)},_iframeAutoHeight(t){const e=t.get("_iframeAuto");e?this._w.setTimeout((()=>{const i=e.offsetHeight;t.get("wysiwygFrame").style.height=i+"px",dt.isResizeObserverSupported||this.__callResizeFunction(t,i,null)}),0):dt.isResizeObserverSupported||this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null)},__callResizeFunction(t,e,i){e=-1===e?i?.borderBoxSize&&i.borderBoxSize[0]?i.borderBoxSize[0].blockSize:i.contentRect.height+mt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+mt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:i}),t.set("_editorHeight",e)),t.has("documentType-use-page")&&t.get("documentType").resizePage()},_checkPlaceholder(t){const e=(t=t||this.frameContext).get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.isEmpty(t)?e.style.display="block":e.style.display="none"}},__editorInit(t){this.applyFrameRoots((t=>{this.__setEditorParams(t)})),this._setFrameInfo(this.frameRoots.get(this.status.rootKey)),this.__init(t);for(const t of this._onPluginEvents.values())t.sort(((t,e)=>t.index-e.index));this.applyFrameRoots((t=>{this.eventManager._addFrameEvents(t),this._initWysiwygArea(t,t.get("options").get("value"))})),this.eventManager.__eventDoc=null,this._componentsInfoInit=!1,this._componentsInfoReset=!1,this._checkComponents(!0),this._w.setTimeout((()=>{this.context.get("toolbar.main").style.visibility="",this.applyFrameRoots((t=>{"function"==typeof this._resourcesStateChange&&(this.eventManager._wwFrameObserver&&this.eventManager._wwFrameObserver.observe(t.get("wysiwygFrame")),this.eventManager._toolbarObserver&&this.eventManager._toolbarObserver.observe(t.get("_toolbarShadow")),this._resourcesStateChange(t))})),this.history.reset(),this.triggerEvent("onload",{})}),0)},__init(t){this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this._MELInfo=new Map,this.activeCommands=Yt,this._onPluginEvents=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]),this._fileManager.tags=[],this._fileManager.pluginMap={},this._fileManager.tagAttrs={};const e=this.plugins,i=[];let s;for(const n in e){if(this.registerPlugin(n,this._pluginCallButtons[n],t[n]),this.registerPlugin(n,this._pluginCallButtons_sub[n],t[n]),s=this.plugins[n],"object"==typeof s.__fileManagement){const t=s.__fileManagement;if(this._fileInfoPluginsCheck.push(t._checkInfo.bind(t)),this._fileInfoPluginsReset.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this._fileManager.tags=this._fileManager.tags.concat(e),i.push(n);for(let i,s=0,o=e.length;s<o;s++)i=e[s].toLowerCase(),this._fileManager.pluginMap[i]=n,t.tagAttrs&&(this._fileManager.tagAttrs[i]=t.tagAttrs)}}"function"==typeof s.constructor.component&&this._componentManager.push(function(t,e){return e&&(e=t.component?.call(this,e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(s,s.constructor));const e=s.constructor.options||{};if(this._onPluginEvents.forEach(((t,i)=>{if("function"==typeof s[i]){const n=s[i].bind(s);n.index=e[`eventIndex_${i}`]||e.eventIndex||0,t.push(n)}})),s.retainFormat){const t=s.retainFormat();this._MELInfo.set(t.query,{key:s.constructor.key,method:t.method})}}(this.options.get("buttons").has("pageBreak")||this.options.get("buttons_sub")?.has("pageBreak"))&&this._componentManager.push((t=>t&>.utils.hasClass(t,"se-page-break")?{target:t,launcher:{destroy:t=>{const e=t.previousElementSibling||t.nextElementSibling;gt.utils.removeItem(t),this.focusEdge(e),this.history.push(!1)}}}:null)),this._fileManager.regExp=new RegExp(`^(${this._fileManager.tags.join("|")||"\\^"})$`,"i"),this._fileManager.pluginRegExp=new RegExp(`^(${0===i.length?"\\^":i.join("|")})$`,"i"),delete this._pluginCallButtons,delete this._pluginCallButtons_sub,this.__cachingButtons(),this.__cachingShortcuts()},__cachingButtons(){const t=this.context;this.__setDisabledButtons(),this.__saveCommandButtons(this.allCommandButtons,t.get("toolbar.buttonTray")),this.options.has("_subMode")&&this.__saveCommandButtons(this.subAllCommandButtons,t.get("toolbar.sub.buttonTray"))},__setDisabledButtons(){const t=this.context;this._codeViewDisabledButtons=pt.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(ys)),this._controllerOnDisabledButtons=pt.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(vs)),this.options.has("_subMode")&&(this._codeViewDisabledButtons=this._codeViewDisabledButtons.concat(pt.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(ys))),this._controllerOnDisabledButtons=this._controllerOnDisabledButtons.concat(pt.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(vs))))},__saveCommandButtons(t,e){const i=e.querySelectorAll(bs),s=this.options.get("shortcuts"),n=this.options.get("_reverseCommandArray"),o=this.shortcutsKeyMap,l=this.reverseKeys;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],r=e.getAttribute("data-command"),t.set(r,e),this.__setCommandTargets(r,e),Lt(r,e,s[r],o,n,l)},__cachingShortcuts(){const t=this.options.get("shortcuts"),e=this.options.get("_reverseCommandArray"),i=this.shortcutsKeyMap,s=this.reverseKeys;for(const n of Object.keys(t))n.startsWith("_")&&Lt("",null,t[n],i,e,s)},__setCommandTargets(t,e){if(!t||!e)return;(Xt.includes(t)||this.plugins[t])&&(this.commandTargets.get(t)?this.commandTargets.get(t).includes(e)||this.commandTargets.get(t).push(e):this.commandTargets.set(t,[e]))},__setIframeDocument(t,e,i){t.setAttribute("scrolling","auto"),t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+pt._setIframeStyleLinks(i.get("iframe_cssFileName"))+pt._setAutoHeightStyle(i.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")},__setEditorParams(t){const e=t.get("options"),i=this._w;if(t.set("wwComputedStyle",i.getComputedStyle(t.get("wysiwyg"))),!e.get("iframe")&&"function"==typeof ShadowRoot){let e=t.get("wysiwygFrame");for(;e;){if(e.shadowRoot){this._shadowRoot=e.shadowRoot;break}if(e instanceof ShadowRoot){this._shadowRoot=e;break}e=e.parentNode}}const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e]);e.get("iframe")?(t.set("_ww",t.get("wysiwygFrame").contentWindow),t.set("_wd",t.get("wysiwygFrame").contentDocument),t.set("wysiwyg",t.get("_wd").body),e.get("_defaultStyles").editor&&(t.get("wysiwyg").style.cssText=e.get("_defaultStyles").editor),"auto"===e.get("height")&&t.set("_iframeAuto",t.get("_wd").body)):(t.set("_ww",i),t.set("_wd",this._d))},__registerClass(){this.events={...Ge,...this.options.get("events")},this.triggerEvent=async(t,e)=>{if("false"===e?.frameContext?.get("wysiwyg").getAttribute("contenteditable"))return!1;const i=this.events[t];return"function"==typeof i?await i({editor:this,...e}):dt.NO_EVENT},this.history=Kt(this),this.eventManager=new Ue(this),this.offset=new is(this),this.shortcuts=new ls(this),this.toolbar=new hs(this,{keyName:"toolbar",balloon:this.isBalloon,balloonAlways:this.isBalloonAlways,inline:this.isInline,res:this._responsiveButtons}),this.options.has("_subMode")&&(this.subToolbar=new hs(this,{keyName:"toolbar.sub",balloon:this.isSubBalloon,balloonAlways:this.isSubBalloonAlways,inline:!1,res:this._responsiveButtons_sub})),this.selection=new ns(this),this.html=new Ui(this),this.nodeTransform=new Qi(this),this.component=new Oi(this),this.format=new Pi(this),this.menu=new Ki(this),this.char=new ei(this),this.ui=new gs(this),this.viewer=new _s(this),Je.call(this.eventManager,this),Je.call(this.char,this),Je.call(this.component,this),Je.call(this.format,this),Je.call(this.html,this),Je.call(this.menu,this),Je.call(this.nodeTransform,this),Je.call(this.offset,this),Je.call(this.selection,this),Je.call(this.shortcuts,this),Je.call(this.toolbar,this),Je.call(this.ui,this),Je.call(this.viewer,this),this.options.has("_subMode")&&Je.call(this.subToolbar,this),delete this.eventManager.eventManager,delete this.char.char,delete this.component.component,delete this.format.format,delete this.html.html,delete this.menu.menu,delete this.nodeTransform.nodeTransform,delete this.offset.offset,delete this.selection.selection,delete this.shortcuts.shortcuts,delete this.toolbar.toolbar,delete this.ui.ui,delete this.viewer.viewer,this.subToolbar&&delete this.subToolbar.subToolbar,this._responsiveButtons=this._responsiveButtons_sub=null},async __Create(t){this.isInline=/inline/i.test(this.options.get("mode")),this.isBalloon=/balloon/i.test(this.options.get("mode")),this.isBalloonAlways=/balloon-always/i.test(this.options.get("mode")),this.isClassic=/classic/i.test(this.options.get("mode")),this.isSubBalloon=/balloon/i.test(this.options.get("_subMode")),this.isSubBalloonAlways=/balloon-always/i.test(this.options.get("_subMode")),this.__registerClass(),this.eventManager._addCommonEvents();const e=[];this.applyFrameRoots((t=>{const i=t.get("originElement"),s=t.get("topArea");if(i.style.display="none",s.style.display="block",i.parentNode.insertBefore(s,i.nextElementSibling),t.get("options").get("iframe")){const i=new Promise((e=>{this.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:i})=>{this.__setIframeDocument(i,this.options,t.get("options")),e()}))}));e.push(i)}})),this.applyFrameRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&(this.options.get("_rtl")?t.get("wrapper").appendChild(t.get("documentTypeInner")):t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame"))),t.get("documentTypePage")&&(this.options.get("_rtl")?t.get("wrapper").insertBefore(t.get("documentTypePage"),t.get("wysiwygFrame")):t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror")))})),e.length>0&&await Promise.all(e),this.__editorInit(t)},Constructor:Cs};const Es=Cs,Ss={init(t){return{create:(e,i)=>this.create(e,i,t)}},create(t,e,i){if("object"!=typeof e&&(e={}),i&&(e=[i,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,i])=>{if("plugins"===e&&i&&t[e]){const s=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(i)?i:Object.values(i);t[e]=[...n.filter((t=>!s.includes(t))),...s]}else t[e]=i})),t)),{})),!t)throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element");const s=[];if("string"==typeof t){const e=document.querySelector(t);if(!e)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${t})] Cannot find target element. Make sure "${t}" is a valid selector and exists in the document.`);s.push({key:null,target:e})}else if(1===t.nodeType)s.push({key:null,target:t});else{let e;for(const i in t){if(e=t[i],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=i,s.push(e)}}return new Es(s,e)}};const Ts=class extends ii{static key="blockquote";static type="command";static className="";constructor(t){super(t),this.title=this.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=gt.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}action(){const t=gt.query.getParentElement(this.selection.getNode(),"blockquote");t?this.format.removeBlock(t,{selectedFormats:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}):this.format.applyBlock(this.quoteTag.cloneNode(!1))}};async function Hs(t,e,i){if(4===t.readyState)if(200===t.status)try{await e(t)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=t.responseText?JSON.parse(t.responseText):t;let s="";"function"==typeof i&&(s=await i(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${s||e.errorMessage||t.responseText}`;this.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}}}const Ls=class{constructor(t,e){this.editor=t.editor,this.ui=this.editor.ui,this.kind=t.constructor.key||t.constructor.name,this._xhr=dt.getXMLHttpRequest(),this.method=e?.method,this.url=e?.url,this.headers=e?.headers,this.data=e?.data,this.callBack=e?.callBack,this.errorCallBack=e?.errorCallBack,this.responseType=e?.responseType}call({method:t,url:e,headers:i,data:s,callBack:n,errorCallBack:o,responseType:l}){this.cancel(),t=t||this.method,e=this._normalizeUrl(e||this.url),i=i||this.headers,s=s||this.data,n=n||this.callBack,o=o||this.errorCallBack,l=l||this.responseType;const r=this._xhr;if(l&&(r.responseType=l),r.onreadystatechange=Hs.bind(this,r,n,o),r.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)r.setRequestHeader(t,i[t]);r.send(s)}asyncCall({method:t,url:e,headers:i,data:s,responseType:n}){this.cancel(),t=t||this.method,e=this._normalizeUrl(e||this.url),i=i||this.headers,s=s||this.data,n=n||this.responseType;const o=this._xhr;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)o.setRequestHeader(t,i[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.ui.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t)}finally{this.ui.hideLoading()}},o.onerror=()=>{l(new Error("Network error"))},o.send(s)}))}cancel(){this._xhr&&this._xhr.abort()}_normalizeUrl(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}},{_w:Ms,_d:Ns}=dt;const As=class extends ii{static key="exportPDF";static type="command";static className="se-component-enabled";constructor(t,e){super(t),this.title=this.lang.exportPDF,this.icon="PDF",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.apiUrl?this.apiManager=new Ls(this,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"}):console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.')}async action(){if(!this.apiUrl)return void console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.');this.ui.showLoading();let t=null;try{const e=this.editor.frameContext.get("documentTypePageMirror")||this.editor.frameContext.get("wysiwygFrame"),i=gt.utils.createElement("div",{class:e.className},e.innerHTML);t=gt.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},i);const s=this._w.getComputedStyle(e).padding,n=gt.utils.applyInlineStylesAll(i,!0,this.options.get("allUsedStyles"));if(n.style.padding=n.style.paddingTop=n.style.paddingBottom=n.style.paddingLeft=n.style.paddingRight="0",t.innerHTML=`\n\t\t\t\t<style>\n\t\t\t\t\t@page {\n\t\t\t\t\t\tsize: A4;\n\t\t\t\t\t\tmargin: ${s};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${n.outerHTML}`,Ns.body.appendChild(t),!1===await this.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this._createByServer(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{gt.utils.removeItem(t),this.ui.hideLoading()}}async _createByServer(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},i=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==i.status){const t=i.responseText?JSON.parse(i.responseText):i;throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t.errorMessage}`)}const s=new Blob([i.response],{type:"application/pdf"}),n=i.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(s),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=gt.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Ns.body.appendChild(r),r.click()}finally{Ms.setTimeout((()=>{gt.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}};function Bs(t,e){const i=t.getAttribute(`data-se-${e}`);if(i)return i;const s=t.getAttribute(`data-${e}`);return s?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,s),s):null}const Is=class extends Jt{constructor(t,e){super(t.editor),this.ui=this.editor.ui,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.component=t.editor.component,this.query=e.query,this.loadHandler=e.loadHandler,this.eventHandler=e.eventHandler,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new Ls(this,null),this._resetInfo,this._checkInfo}upload(t,e,i,s,n){this.ui.showLoading();let o=null;if("length"in i){o=new FormData;for(let t=0,e=i.length;t<e;t++)o.append("file-"+t,i[t]);this.uploadFileLength=i.length}else o=i.formData,this.uploadFileLength=i.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:s,errorCallBack:n})}async asyncUpload(t,e,i){this.ui.showLoading();let s=null;if("length"in i){s=new FormData;for(let t=0,e=i.length;t<e;t++)s.append("file-"+t,i[t]);this.uploadFileLength=i.length}else s=i.formData,this.uploadFileLength=i.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:s})}setFileData(t,{name:e,size:i}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",i+""))}_setInfo(t,e){let i=Number(Bs(t,"index")),s=null,n="";if(e||(e={name:Bs(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(Bs(t,"file-size"))||0}),!i||this.editor._componentsInfoInit)n="create",i=this.infoIndex++,t.setAttribute("data-se-index",i+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),s={src:t.src,index:i,name:e.name,size:e.size},this.infoList.push(s);else{n="update",i*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(i===this.infoList[t].index){s=this.infoList[t];break}s||(i=this.infoIndex++,s={index:i},this.infoList.push(s)),s.src=t.src,s.name=Bs(t,"file-name"),s.size=Number(Bs(t,"file-size"))}s.element=t,s.delete=function(t){"function"==typeof this.inst.destroy&&this.inst.destroy.call(this.inst,t),this._deleteInfo(Number(Bs(t,"index")))}.bind(this,t),this._deleteInfo,s.select=function(t){t.scrollIntoView(this.options.get("componentScrollToOptions"));const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):"function"==typeof this.inst.select&&this.inst.select(t)}.bind(this,t);const o={editor:this.editor,element:t,index:i,state:n,info:s,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};"function"==typeof this.eventHandler&&this.eventHandler(o),this.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}getSize(){let t=0;for(let e=0,i=this.infoList.length;e<i;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.editor.frameContext.get("wysiwyg").querySelectorAll(this.query)),i=this.infoList;if(e.length===i.length){if(this.editor._componentsInfoReset){for(let t=0,i=e.length;t<i;t++)this._setInfo(e[t],null);return}{let t=!1;for(let s,n=0,o=i.length;n<o;n++)if(s=i[n],0===e.filter((function(t){return s.src===t.src&&s.index.toString()===Bs(t,"index")})).length){t=!0;break}if(!t)return}}const s=[],n=[];for(let t=0,e=i.length;t<e;t++)n[t]=i[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();Bs(t,"index")&&n.includes(Number(Bs(t,"index")))?s.push(Number(Bs(t,"index"))):(s.push(this.infoIndex),t.removeAttribute("data-se-index"),this._setInfo(t,null))}if(t&&"function"==typeof this.loadHandler)this.loadHandler(i);else for(let t,e=0;e<i.length;e++){if(t=i[e].index,s.includes(t))continue;i.splice(e,1);const n={editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};"function"==typeof this.eventHandler&&this.eventHandler(n),this.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t="function"==typeof this.eventHandler,e={editor:this.editor,element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let i=0,s=this.infoList.length;i<s;i++)t&&this.eventHandler({...e,index:this.infoList[i].index,pluginName:this.kind}),this.triggerEvent("onFileManagerAction",{...e,index:this.infoList[i].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}_deleteInfo(t){if(t>=0)for(let e=0,i=this.infoList.length;e<i;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void("function"==typeof this.eventHandler&&this.eventHandler({editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}},{NO_EVENT:Vs}=dt;class Os extends ii{static key="fileUpload";static type="command";static className="";static options={eventIndex:1e4};static component(t){return gt.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}constructor(t,e){super(t),this.title=this.lang.fileUpload,this.icon="file_upload",e.uploadUrl||console.warn('[SUNEDITOR.fileUpload.warn] "fileUpload" plugin must be have "uploadUrl" option.'),this.uploadUrl=e.uploadUrl,this.uploadHeaders=e.uploadHeaders,this.uploadSizeLimit=mt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=mt.get(e.uploadSingleSizeLimit,0),this.allowMultiple=!!e.allowMultiple,this.acceptedFormats="string"!=typeof e.acceptedFormats?"*":e.acceptedFormats.trim()||"*",this._acceptedCheck=this.acceptedFormats.split(", "),this.as=e.as||"box",this.input=gt.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this._element=null;const i={"custom-download":{command:"download",title:this.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&>.utils.createElement("A",{href:e},null).click()}},"custom-as":{command:"as",value:"link",title:this.lang.asLink,icon:"reduction",action:(t,e)=>{this.convertFormat(t,e)}}},s=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?i[t]:t))));if(this.figure=new yi(this,s,{}),this.fileManager=new Is(this,{query:"a[download][data-se-file-download]",loadHandler:this.events.onFileLoad,eventHandler:this.events.onFileAction}),/\bedit\b/.test(JSON.stringify(s))){const t=function({lang:t,icons:e}){const i=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" />\n\t\t\t\t<button type="submit" data-command="edit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.controller=new hi(this,t,{position:"bottom",disabled:!0},Os.key),this.editInput=t.querySelector("input")}this.eventManager.addEvent(this.input,"change",this.#E.bind(this))}action(){this.editor._preventBlur=!0,this.input.click()}select(t){this._element=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(!gt.check.isFigure(t.parentElement))return e.innerHTML=this.icons.expansion+gt.utils.createTooltipInner(this.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0;e.innerHTML=this.icons.reduction+gt.utils.createTooltipInner(this.lang.asLink),e.setAttribute("data-value","link"),this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})}onFilePasteAndDrop({file:t}){const e=t.type;if(this._acceptedCheck.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0))))return this.submitFile([t]),this.editor.focus(),!1}edit(t){this.editInput.value=t.textContent,this.figure.controllerHide(),this.controller.open(t,null,{isWWTarget:!gt.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this._element.textContent=this.editInput.value}this.controller.close(),this.component.select(this._element,Os.key)}}async destroy(t){if(!t)return;const e=yi.GetContainer(t),i=gt.query.getParentElement(t,".se-component")||t;if(!1===await this.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const s=this.component.isInline(i)?i.previousSibling||i.nextSibling:i.previousElementSibling||i.nextElementSibling;gt.utils.removeItem(i),this.ui._offCurrentController(),this.editor.focusEdge(s),this.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,s&&s>o){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onFileUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Vs?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable total files: "+n/1e3+"KB",i=await this.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Vs?t:i||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:i},r=async function(t,e,i){e=i||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#S.bind(this),l),a=await this.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Vs||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=yi.GetContainer(t),i=e.nextElementSibling,s=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),gt.utils.addClass(t,"se-component|se-inline-component");const n=gt.utils.createElement(this.options.get("defaultLine"),null,t);s.insertBefore(n,i),gt.utils.removeItem(e)}else{this.selection.setRange(t,0,t,1);const e=this.html.remove(),i=this.nodeTransform.split(e.container,e.offset,0);i?.previousElementSibling&>.check.isZeroWidth(i.previousElementSibling)&>.utils.removeItem(i.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),gt.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const s=yi.CreateContainer(t,"se-file-figure se-flex-component");(i||e.container).parentElement.insertBefore(s.container,i)}this.history.push(!1),this.component.select(t,Os.key)}create(t,e,i){const s=e.name||t,n=gt.utils.createElement("A",{href:t,title:s,download:s,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},s);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.component.insert(n,{skipCharCount:!1,skipSelection:!1,skipHistory:!1});const o=yi.CreateContainer(n);if(gt.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.component.insert(o.container,{skipCharCount:!1,skipSelection:!i||!this.options.get("componentAutoSelect"),skipHistory:!1})){if(i)if(this.options.get("componentAutoSelect"))this.component.select(n,Os.key);else{const t=this.format.addLine(o.container,null);t&&this.selection.setRange(t,0,t,0)}}else this.editor.focus()}_register(t){t.result.forEach(((t,e,i)=>{this.create(t.url,{name:t.name,size:t.size},e===i.length-1)}))}async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Vs?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}#S(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)}async#E(t){const e=gt.query.getEventTarget(t);await this.submitFile(e.files)}}const Rs=Os;class zs extends ii{static key="list_bulleted";static type="command";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.bulletedList,this.icon="list_bulleted",this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":zs.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.bulletedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${e=["disc","circle","square"],e.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ul style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}\n\t\t</ul>\n\t</div>`;var e;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ul"),this.menu.initDropdownTarget({key:zs.key,type:"dropdown"},e)}active(t,e){return gt.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"disc":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?gt.utils.addClass(e.parentElement,"active"):gt.utils.removeClass(e.parentElement,"active")}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ul")?.style.listStyleType;gt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}shortcut({range:t,info:e}){const{startContainer:i}=t;if(gt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.textContent=t}this.submit()}submit(t){const e=this.format.applyList(`ul:${t||""}`,null,!1);e&&this.selection.setRange(e.sc,e.so,e.ec,e.eo),this.editor.focus(),this.history.push(!1)}}const $s=zs;class Fs extends ii{static key="list_numbered";static type="command";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.numberedList,this.icon="list_numbered",this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Fs.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.numberedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${Ps(["decimal","upper-roman","lower-roman"])}\n\t\t</ul>\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t${Ps(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ol"),this.menu.initDropdownTarget({key:Fs.key,type:"dropdown"},e)}active(t,e){return gt.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"decimal":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?gt.utils.addClass(e.parentElement,"active"):gt.utils.removeClass(e.parentElement,"active")}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ol")?.style.listStyleType;gt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}shortcut({range:t,info:e}){const{startContainer:i}=t;if(gt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.textContent=t}this.submit()}submit(t){const e=this.format.applyList(`ol:${t||""}`,null,!1);e&&this.selection.setRange(e.sc,e.so,e.ec,e.eo),this.editor.focus(),this.history.push(!1)}}function Ps(t){return t.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ol style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ol>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}const Ds=Fs,{debounce:qs}=pt;const Ws=class extends ii{static key="mention";static type="field";static className="";constructor(t,e){super(t),this.title=this.lang.mention,this.icon="mention",this.triggerText=e.triggerText||"@",this.limitSize=e.limitSize||5,this.searchStartLength=e.searchStartLength||0,this.delayTime="number"==typeof e.delayTime?e.delayTime:200,this.directData=e.data,this.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(this.limitSize))||"",this._delay=0,this._lastAtPos=0,this._anchorOffset=0,this._anchorNode=null,this.apiManager=new Ls(this,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null;const i=gt.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new ci(this,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new hi(this,i,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(i.firstElementChild,this.#T.bind(this)),this.onInput=qs(this.onInput.bind(this),this.delayTime)}async onInput(){this.directData||this.apiManager.cancel();const t=this.selection.get();if(!t.rangeCount)return this.selectMenu.close(),!0;const e=t.anchorNode,i=t.anchorOffset,s=e.textContent.substring(0,i),n=s.lastIndexOf(this.triggerText);if(n>-1){const t=s.substring(n+1,i),o=s[n-1]?.trim();if(!/\s/.test(t)&&(!o||gt.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return!0;const s=e.parentNode;if(gt.check.isAnchor(s)&&!s.getAttribute("data-se-mention"))return!0;try{const s=await this._createMentionList(t,e);return this._lastAtPos=n,this._anchorNode=e,this._anchorOffset=i,!s}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}return this.selectMenu.close(),!0}async _createMentionList(t,e){const i=this.limitSize,s=t.toLowerCase();let n=null;if(this.cachingData&&(n=this.cachingData.get(t)),!n)if(this.directData)n=this.directData.filter((t=>t.key.toLowerCase().startsWith(s))).slice(0,i);else{const e=await this.apiManager.asyncCall({method:"GET",url:this._createUrl(t)});n=JSON.parse(e.responseText)}if(this.cachingFieldData){const t=new Set;n=this.cachingFieldData.concat(n).filter((({key:e})=>!t.has(e)&&(t.add(e),e.toLowerCase().startsWith(s)))).slice(0,i)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,i=n.length;e<i;e++)t=n[e],o.push(t),l.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===o.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(o,l),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,o),!0)}_createUrl(t){return this.apiUrl.replace(/\{key\}/i,t)}#T(t){if(!t)return!1;let e=null;const{key:i,name:s,url:n}=t,o=this._anchorNode.parentNode;if(gt.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",i),e.setAttribute("href",n),e.setAttribute("title",s),e.textContent=this.triggerText+i;else if(this.selection.setRange(this._anchorNode,this._lastAtPos,this._anchorNode,this._anchorOffset),e=gt.utils.createElement("A",{"data-se-mention":i,href:n,title:s,target:"_blank"},this.triggerText+i),!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=gt.utils.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.selection.setRange(l,1,l,1),this.cachingFieldData&&!this.cachingFieldData.some((e=>e.key===t.key))&&this.cachingFieldData.push(t)}};class Us extends ii{static key="align";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.align,this.icon=this.options.get("_rtl")?"align_right":"align_left";const i=function({lang:t,icons:e,options:i},s){const n=Array.isArray(s)?s:i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let i,s,l=0;l<n.length;l++)i=n[l],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${i}" title="${s}" aria-label="${s}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+i]}</span>${s}\n\t\t\t</button>\n\t\t</li>`;return gt.utils.createElement("div",{class:"se-dropdown se-list-layer se-list-align"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${o}</ul>\n\t\t</div>`)}(t,e.items),s=this._itemMenu=i.querySelector("ul");this.defaultDir=t.options.get("_rtl")?"right":"left",this.alignIcons={justify:t.icons.align_justify,left:t.icons.align_left,right:t.icons.align_right,center:t.icons.align_center},this.alignList=s.querySelectorAll("li button"),this.menu.initDropdownTarget(Us,i)}active(t,e){const i=e.firstElementChild;if(t){if(this.format.isLine(t)){const s=t.style.textAlign;return s?(gt.utils.changeElement(i,this.alignIcons[s]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",s),!0):void 0}}else gt.utils.changeElement(i,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const i=this.alignList;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?gt.utils.addClass(i[t],"active"):gt.utils.removeClass(i[t],"active")}setDir(t){const e="rtl"===t?"right":"left";if(this.defaultDir===e)return;this.defaultDir=e;const i=this._itemMenu.querySelector('[data-command="left"]'),s=this._itemMenu.querySelector('[data-command="right"]');if(i&&s){const t=i.parentElement,e=s.parentElement;t.appendChild(s),e.appendChild(i)}}action(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.defaultDir,s=this.format.getLines();for(let t=0,n=s.length;t<n;t++)gt.utils.setStyle(s[t],"textAlign",e===i?"":e);this.editor.effectNode=null,this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)}}const Gs=Us;class Zs extends ii{static key="font";static type="dropdown";static className="se-btn-select se-btn-tool-font";constructor(t,e){super(t),this.title=this.lang.font,this.inner='<span class="se-txt">'+this.lang.font+"</span>"+this.icons.arrow_down;const i=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],s=function({lang:t},e){let i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">(${t.default})</button>\n\t\t\t</li>`;for(let t,s,n=0,o=e.length;n<o;n++)t=e[n],s=t.split(",")[0],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${s}" title="${s}" aria-label="${s}" style="font-family:${t};">${s}</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},i)}(t,i);this.currentFont="",this.fontList=s.querySelectorAll("ul li button"),this.fontArray=i,this.menu.initDropdownTarget(Zs,s)}active(t,e){const i=e.querySelector(".se-txt"),s=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.format.isLine(t))return;if(n=gt.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return gt.utils.changeTxt(i,t),gt.utils.changeTxt(s,this.lang.font+" ("+t+")"),!0}}else{const t=this.status.hasFocus?this.editor.frameContext.get("wwComputedStyle").fontFamily:this.lang.font;gt.utils.changeTxt(i,t),gt.utils.changeTxt(s,this.status.hasFocus?this.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,i=t.querySelector(".se-txt").textContent;if(i!==this.currentFont){for(let t=0,s=e.length;t<s;t++)i===(e[t].getAttribute("data-command")||"").replace(/'|"/g,"")?gt.utils.addClass(e[t],"active"):gt.utils.removeClass(e[t],"active");this.currentFont=i}}async action(t){let e=t.getAttribute("data-command");if(e){if(/[\s\d\W]/.test(e)&&!/^['"].*['"]$/.test(e)&&(e=`"${e}"`),!1===await this.triggerEvent("onFontActionBefore",{value:e}))return;const t=gt.utils.createElement("SPAN",{style:"font-family: "+e+";"});this.format.applyInlineElement(t,{stylesToModify:["font-family"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["font-family"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const Ys=Zs,{isMobile:Xs}=dt,js=240,Ks=120,Js={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Qs,tn=0,en=!1,sn=!1,nn=120,on=120,ln=Js;const{slider:rn,offscreenCanvas:an,offscreenCtx:hn,wheel:cn,wheelCtx:dn,wheelPointer:un,gradientBar:pn,gradientPointer:gn,fanalColorHex:mn,fanalColorBackground:fn}=function(){const t=document.createElement("canvas");t.width=js,t.height=js;const e=`\n\t<div class="se-hue-slider-container" style="width: 240px; height: 240px;">\n <canvas class="se-hue-wheel" width="240" height="240"></canvas>\n <div class="se-hue-wheel-pointer"></div>\n </div>\n <div class="se-hue-gradient-container">\n <canvas class="se-hue-gradient" width="240" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:240px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${Js.hex}</div>\n\t\t<div style="flex: 1; height: 100%; border: 1px solid #fff; outline: 1px solid #000;"></div>\n\t</div>\n\t`,i=gt.utils.createElement("DIV",{class:"se-hue-slider"},e),s=i.querySelector(".se-hue-wheel"),n=i.querySelector(".se-hue-gradient"),o=i.querySelector(".se-hue-final-hex").children;return{slider:i,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:s,wheelCtx:s.getContext("2d"),wheelPointer:i.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:i.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function _n(t){const{target:e,touches:i}=t,s=i[0].clientX,n=i[0].clientY;e===cn?(t.preventDefault(),sn=!1,en=!0,Cn(s,n)):e===pn&&(t.preventDefault(),sn=!0,en=!1,wn(s))}function bn(t){t.preventDefault();const{touches:e}=t,i=e[0].clientX,s=e[0].clientY;en?Cn(i,s):sn&&wn(i)}function yn({target:t,clientX:e,clientY:i}){t===cn?(sn=!1,en=!0,Cn(e,i)):t===pn&&(sn=!0,en=!1,wn(e))}function vn({clientX:t,clientY:e}){en?Cn(t,e):sn&&wn(t)}function Cn(t,e){const i=cn.getBoundingClientRect();t=t-i.left-Ks,e=e-i.top-Ks;const s=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),Ks),o=Ks+n*Math.cos(s*Math.PI/180),l=Ks+n*Math.sin(s*Math.PI/180);un.style.left=`${o}px`,un.style.top=`${l}px`,function(t,e){nn=t,on=e,xn(kn())}(o,l),En()}function wn(t){const e=pn.getBoundingClientRect();let i=t-e.left;i=Math.max(14,Math.min(i,e.width-14)),gn.style.left=`${i}px`,function(t){const e=pn.getBoundingClientRect();let i=t-e.left;i<0&&(i=0);i>e.width&&(i=e.width);const s=14;i>=pn.width-s?i=pn.width:i<=s&&(i=0);const n=1-i/e.width;tn=n,Hn()}(t),En()}function xn(t){const e=pn.getContext("2d"),i=e.createLinearGradient(0,0,pn.width,0);i.addColorStop(0,"black"),i.addColorStop(1,t.hex),e.fillStyle=i,e.fillRect(0,0,pn.width,pn.height)}function kn(){return Tn(hn)}function En(){Qs.color=ln=Tn(dn),Sn(ln.hex)}function Sn(t){fn.style.backgroundColor=mn.textContent=t}function Tn(t){const e=t.getImageData(nn,on,1,1).data;let[i,s,n]=function([t,e,i]){t/=255,e/=255,i/=255;const s=Math.max(t,e,i),n=Math.min(t,e,i);let o,l;const r=(s+n)/2;if(s===n)o=l=0;else{const a=s-n;switch(l=r>.5?a/(2-s-n):a/(s+n),s){case t:o=(e-i)/a+(e<i?6:0);break;case e:o=(i-t)/a+2;break;case i:o=(t-e)/a+4}o/=6}return[Mn(o),Mn(l),Mn(r)]}(e);const o=nn-Ks,l=on-Ks;Math.sqrt(o*o+l*l)<3&&(n=1-tn),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:h}=function([t,e,i]){let s,n,o;if(0===e)s=n=o=i;else{const l=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},r=i<.5?i*(1+e):i+e-i*e,a=2*i-r;s=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*s),g:Math.round(255*n),b:Math.round(255*o)}}([i,s,n]),c=`#${function({r:t,g:e,b:i}){let s=Math.floor(t).toString(16);t<16&&(s=`0${s}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(i).toString(16);i<16&&(o=`0${o}`);return`${s}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:i,s,l:Mn(n)}}function Hn(){dn.clearRect(0,0,js,js),dn.drawImage(an,0,0),dn.globalAlpha=tn,dn.fillStyle="black",dn.beginPath(),dn.arc(Ks,Ks,Ks,0,2*Math.PI),dn.fill(),dn.globalAlpha=1}function Ln(t){return t*Math.PI/180}function Mn(t){const e=Math.pow(10,10);return Math.round(t*e)/e}!function(t){if(!t)throw new Error("Context not found.");for(let e=0;e<=360;e+=.5)for(let i=0;i<=Ks;i+=1){t.beginPath();const s=50+(Ks-i)/Ks*50;t.fillStyle=`hsl(${e}, 100%, ${s}%)`;const n=Ks+Math.cos(Ln(e))*i,o=Ks-Math.sin(Ln(e))*i;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}}(hn),Hn();const Nn=class{constructor(t,e,i){if(e||(e={}),this.editor=t.editor,this.eventManager=t.eventManager,this.inst=t,this.form=e.form,this.ctx={wheelX:nn,wheelY:on,lightness:tn,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:Js},this.isOpen=!1,this.controlle=null,this.__globalMouseDown=null,this.__globalMouseMove=null,this.__globalMouseUp=null,!e.isNewForm){const s=function({lang:t,icons:e},i){const s=gt.utils.createElement("DIV",{class:`se-controller ${i}`},`\n\t\t<div class="se-hue"></div>\n\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t<button type="button" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t<button type="button" class="se-btn se-btn-danger" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t</div>\n\t`);return s}(t.editor,i);this.form=s.querySelector(".se-hue"),this.controller=new hi(this,s,{position:"top",isWWTarget:!1,...e.controllerOptions}),this.eventManager.addEvent(s.querySelector(".se-btn-success"),"click",(()=>{t.hueSliderAction(this.get()),this.close()})),this.eventManager.addEvent(s.querySelector(".se-btn-danger"),"click",(()=>{this.close()}))}}get(){return ln}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}off(){this.ctx={gradientPointerX:gn.style.left,wheelPointerX:un.style.left,wheelPointerY:un.style.top,wheelX:nn,wheelY:on,lightness:tn,color:Qs?.color||Tn(dn)},this.controller.close(),this.init()}close(){this.off(),this.inst.hueSliderCancelAction()}attach(t){this.init(),(t||this.form).appendChild(rn),Qs=this.ctx,Qs&&(nn=Qs.wheelX,on=Qs.wheelY,tn=Qs.lightness,un.style.left=Qs.wheelPointerX,un.style.top=Qs.wheelPointerY,gn.style.left=Qs.gradientPointerX,Sn(Qs.color.hex),Hn(),xn(kn()));const e={name:"mousedown",func:yn},i={name:"mousemove",func:vn,option:!0},s={name:"mouseup",func:()=>{en=!1,sn=!1}};Xs&&(e.name="touchstart",i.name="touchmove",s.name="touchend",e.func=_n,i.func=bn),this.__globalMouseDown=this.eventManager.addGlobalEvent(e.name,e.func,{passive:!1,capture:!0}),this.__globalMouseMove=this.eventManager.addGlobalEvent(i.name,i.func,!0),this.__globalMouseUp=this.eventManager.addGlobalEvent(s.name,s.func,!0),this.isOpen=!0}init(){this.isOpen=!1,en=!1,sn=!1,this.__globalMouseDown&&(this.__globalMouseDown=this.eventManager.removeGlobalEvent(this.__globalMouseDown)),this.__globalMouseMove&&(this.__globalMouseMove=this.eventManager.removeGlobalEvent(this.__globalMouseMove)),this.__globalMouseUp&&(this.__globalMouseUp=this.eventManager.removeGlobalEvent(this.__globalMouseUp))}},An=["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];function Bn(t,e){const i=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let s=i;for(let n,o,l,r=0,a=t.length;r<a;r++)n=t[r],"string"==typeof n?(o=n,l=n):"object"==typeof n&&(o=n.value,l=n.name||o),r>0&&r%e==0&&(s+=`</ul>${i}`),s+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return s+="</ul>",s}const In=class extends Jt{constructor(t,e,i){const s=t.editor;super(s),this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.target=function({lang:t,icons:e},{colorList:i,disableHEXInput:s,disableRemove:n,splitNum:o}){o=(i=i||An)===An?9:o;let l="";for(let t,e=0,s=i.length,n=[];e<s;e++)t=i[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<s-1)||(n.length>0&&(l+=`<div class="se-selector-color">${Bn(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${Bn(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${s?"":`<button type="button" class="se-btn se-btn-info" title="${t.colorPicker}" aria-label="${t.colorPicker}">${e.color_palette}</button>`}\n\t\t\t<input type="text" class="se-color-input" ${s?"readonly":""} placeholder="${t.color}" />\n\t\t\t${s?"":`<button type="submit" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>`}\n\t\t\t${n?"":`<button type="button" class="se-btn __se_remove" title="${t.remove}" aria-label="${t.remove}">${e.remove_color}</button>`}\n\t\t</form>`,gt.utils.createElement("DIV",{class:"se-list-inner"},l)}(s,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=e,this.splitNum=i.splitNum||0,this.defaultColor=i.defaultColor||"",this.hueSliderOptions=i.hueSliderOptions,this.parentDisplay="",this.currentColor="",this.parentForm=null,this.colorList=this.target.querySelectorAll("li button")||[],this.hueSlider=null;const n=(new DOMParser).parseFromString(this.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Nn(this,i.hueSliderOptions,"se-dropdown"),this.parentFormDisplay=[],this.parentForm=i.hueSliderOptions?.controllerOptions?.parents?.length>0&&!i.hueSliderOptions?.controllerOptions?.isInsideForm?i.hueSliderOptions.controllerOptions.parents:null,this.eventManager.addEvent(this.target.querySelector(".se-btn-info"),"click",this.#H.bind(this)),this.eventManager.addEvent(this.inputElement,"input",this.#L.bind(this)),this.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#M.bind(this))),i.disableRemove||this.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#N.bind(this)),this.eventManager.addEvent(this.target,"click",this.#A.bind(this))}init(t,e,i){this.targetButton=e,"function"!=typeof i&&(i=()=>!1);let s=("string"==typeof t?t:this._getColorInNode(t,i))||this.defaultColor;s=pt.isHexColor(s)?s:pt.rgb2hex(s)||s||"";const n=this.colorList;for(let t,e=0,i=n.length;e<i;e++)t=n[e],s.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),gt.utils.addClass(t,"active")):(gt.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&>.utils.removeItem(this.checkedIcon));this._setInputText(this._colorName2hex(s))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.off()}_setInputText(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}_getColorInNode(t,e){let i="";const s=this.styleProperties;for(;t&&!e(t)&&!gt.check.isWysiwygFrame(t)&&0===i.length;)I(t)&&t.style[s]&&(i=t.style[s]),t=t.parentNode;return i}_colorName2hex(t){if(!t||/^#/.test(t))return t;const e=gt.utils.createElement("div",{style:"display: none; color: "+t}),i=this._w.getComputedStyle(this._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return gt.utils.removeItem(e),i.length>=3?"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substring(1):""}hueSliderAction(t){this._setInputText(t.hex)}hueSliderCancelAction(){this.parentForm?.length>0&&this.parentFormDisplay.forEach((t=>t[0].style.display=t[1]))}#H(){this.parentForm?.length>0&&this.parentForm.forEach((t=>{this.parentFormDisplay.push([t,t.style.display]),t.style.display="none"})),this.hueSlider.open(this.targetButton)}#M(t){t.preventDefault(),"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(this.currentColor)}#A(t){const e=gt.query.getEventTarget(t).getAttribute("data-value");e&&"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(e)}#N(){"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(null)}#L(t){const e=gt.query.getEventTarget(t);this.setHexColor(e.value)}};class Vn extends ii{static key="fontColor";static type="dropdown-free";static className="";constructor(t,e){super(t),this.title=this.lang.fontColor,this.icon="font_color";const i=gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new In(this,"color",{colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{parents:[i],isOutsideForm:!0}}}),i.appendChild(this.colorPicker.target),this.menu.initDropdownTarget(Vn,i)}active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=gt.utils.getStyle(t,"color"))return i.style.color=s,!0}else i.style.color=s;return!1}on(t){this.colorPicker.init(this.selection.getNode(),t,(t=>this.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=gt.utils.createElement("SPAN",{style:"color: "+t+";"});this.format.applyInlineElement(e,{stylesToModify:["color"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["color"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const On=Vn;class Rn extends ii{static key="backgroundColor";static type="dropdown-free";static className="";constructor(t,e){super(t),this.title=this.lang.backgroundColor,this.icon="background_color";const i=gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new In(this,"backgroundColor",{colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{parents:[i],isOutsideForm:!0}}}),i.appendChild(this.colorPicker.target),this.menu.initDropdownTarget(Rn,i)}active(t,e){const i=e.querySelector("path.se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=gt.utils.getStyle(t,"backgroundColor"))return i.style.color=s,!0}else i.style.color=s;return!1}on(t){this.colorPicker.init(this.selection.getNode(),t,(t=>this.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=gt.utils.createElement("SPAN",{style:"background-color: "+t+";"});this.format.applyInlineElement(e,{stylesToModify:["background-color"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["background-color"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const zn=Rn;class $n extends ii{static key="hr";static type="dropdown";static className="";static component(t){return/^hr$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.lang.horizontalLine,this.icon="horizontal_line";const i=function({lang:t},e){const i=e||[{name:t.hr_solid,class:"__se__solid"},{name:t.hr_dashed,class:"__se__dashed"},{name:t.hr_dotted,class:"__se__dotted"}];let s="";for(let t=0,e=i.length;t<e;t++)s+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${i[t].name}" aria-label="${i[t].name}">\n\t\t\t\t<hr${i[t].class?` class="${i[t].class}"`:""}${i[t].style?` style="${i[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-line"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${s}</ul>\n\t\t</div>`)}(t,e.items);this.list=i.querySelectorAll("button"),this.menu.initDropdownTarget($n,i)}select(t){gt.utils.addClass(t,"on")}deselect(t){gt.utils.removeClass(t,"on")}destroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;gt.utils.removeItem(t),this.editor.focusEdge(e),this.history.push(!1)}action(t){const e=this.submit(t.firstElementChild.className),i=this.format.addLine(e);this.selection.setRange(i,1,i,1),this.menu.dropdownOff()}shortcut({line:t,range:e}){const i=this.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),gt.utils.removeItem(t),this.selection.setRange(i,0,i,0)}submit(t){const e=gt.utils.createElement("hr",{class:t});return this.editor.focus(),this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1}),e}}const Fn=$n;class Pn extends ii{static key="list";static type="dropdown";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ol" title="${t.numberedList}" aria-label="${t.numberedList}">\n\t\t\t\t\t${e.list_numbered}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ul" title="${t.bulletedList}" aria-label="${t.bulletedList}">\n\t\t\t\t\t${e.list_bulleted}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(t);this.listItems=e.querySelectorAll("li button"),this.icons={bulleted:t.icons.list_bulleted,numbered:t.icons.list_numbered},this.menu.initDropdownTarget(Pn,e)}active(t,e){const i=e.firstElementChild;if(gt.check.isList(t)){const s=t.nodeName.toLowerCase();return e.setAttribute("data-focus",s),gt.utils.addClass(e,"active"),/^ul$/.test(s)?gt.utils.changeElement(i,this.icons.bulleted):gt.utils.changeElement(i,this.icons.numbered),!0}return e.removeAttribute("data-focus"),gt.utils.changeElement(i,this.icons.number),gt.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",i=this.listItems;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?gt.utils.addClass(i[t],"active"):gt.utils.removeClass(i[t],"active")}action(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value")||"",s=this.format.applyList(`${e}:${i}`,null,!1);s&&this.selection.setRange(s.sc,s.so,s.ec,s.eo),this.menu.dropdownOff(),this.history.push(!1)}}const Dn=Pn,{_w:qn,ON_OVER_COMPONENT:Wn}=dt,Un=".se-table-resize-line",Gn=".se-table-resize-line-prev",Zn=".se-table-resize-row",Yn=".se-table-resize-row-prev",Xn=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],jn={all:"border_all",inside:"border_inside",horizon:"border_horizontal",vertical:"border_vertical",outside:"border_outside",left:"border_left",top:"border_top",right:"border_right",bottom:"border_bottom",none:"border_none"},Kn=["all","inside","horizon","vertical"],Jn="borderLeft",Qn="borderTop",to="borderRight",eo="borderBottom",io=["#b0dbb0","#efef7e","#f2acac","#dcb0f6","#99bdff","#5dbd5d","#e7c301","#f64444","#e57ff4","#4387f1","#27836a","#f69915","#ba0808","#a90bed","#134299","#e4e4e4","#B3B3B3","#808080","#4D4D4D","#000000"];class so extends ii{static key="table";static type="dropdown-free";static className="";static options={isInputComponent:!0};static component(t){return gt.check.isTable(t)?t:null}constructor(t,e){super(t),this.title=this.lang.table,this.icon="table",this.figureScrollList=["se-scroll-figure-xy","se-scroll-figure-x","se-scroll-figure-y"],this.figureScroll="string"==typeof e.scrollType?e.scrollType.toLowerCase():"x",this.captionPosition="bottom"!==e.captionPosition?"top":"bottom",this.cellControllerTop="table"==("cell"!==e.cellControllerPosition?"table":"cell");const i=function(){const t='\n\t<div class="se-table-size">\n\t\t<div class="se-table-size-picker se-controller-table-picker"></div>\n\t\t<div class="se-table-size-highlighted"></div>\n\t\t<div class="se-table-size-unhighlighted"></div>\n\t</div>\n\t<div class="se-table-size-display">1 x 1</div>';return gt.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},t)}(),s=i.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-down se-visible-hidden"></div>\n\t<div class="se-btn-group">\n\t\t<button type="button" data-command="openTableProperties" class="se-btn se-tooltip">\n\t\t\t${e.table_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableProperties}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">\n\t\t\t${e.fixed_column_width}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.fixedColumnWidth}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">\n\t\t\t${e.table_header}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableHeader}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="caption" class="se-btn se-tooltip _se_table_caption">\n\t\t\t${e.caption}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.caption}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">\n\t\t\t${e.reduction}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.minSize}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="copy" class="se-btn se-tooltip">\n\t\t\t${e.copy}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="remove" class="se-btn se-tooltip">\n\t\t\t${e.delete}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t</span>\n\t\t</button>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-table"},i)}(t),o=function({lang:t,icons:e},i){const s=`\n\t<div class="se-arrow se-arrow-${i?"down se-visible-hidden":"up"}"></div>\n <div class="se-btn-group">\n\t\t<button type="button" data-command="openCellProperties" class="se-btn se-tooltip">\n\t\t\t${e.cell_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.cellProperties}</span>\n\t\t\t</span>\n\t\t</button>\n <button type="button" data-command="oncolumn" class="se-btn se-tooltip">\n ${e.table_column}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.column}</span>\n </span>\n </button>\n <button type="button" data-command="onrow" class="se-btn se-tooltip">\n ${e.table_row}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.row}</span>\n </span>\n </button>\n <button type="button" data-command="merge" class="se-btn se-tooltip" style="display: none;">\n ${e.merge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.mergeCells}</span>\n </span>\n </button>\n <button type="button" data-command="onsplit" class="se-btn se-tooltip">\n ${e.split_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.splitCells}</span>\n </span>\n </button>\n\t\t<button type="button" data-command="unmerge" class="se-btn se-tooltip">\n ${e.unmerge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.unmergeCells}</span>\n </span>\n </button>\n </div>`,n=gt.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},s);return{html:n,splitButton:n.querySelector('[data-command="onsplit"]'),columnButton:n.querySelector('[data-command="oncolumn"]'),rowButton:n.querySelector('[data-command="onrow"]'),mergeButton:n.querySelector('[data-command="merge"]'),unmergeButton:n.querySelector('[data-command="unmerge"]')}}(t,this.cellControllerTop),l=function({lang:t,icons:e,options:i}){const s=i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let i,o,l=0;l<s.length;l++)i=s[l],o=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${i}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t</span>\n\t\t</button>`;const o=["top","middle","bottom"];let l="";for(let i,s,n=0;n<o.length;n++)i=o[n],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${i}" title="${s}" aria-label="${s}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s}</span>\n\t\t\t</span>\n\t\t</button>`;const r=`\n\t\t<div class="se-controller-content">\n\t\t\t<div class="se-controller-header">\n\t\t\t\t<button type="button" data-command="close_props" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t\t<span class="se-controller-title">${t.tableProperties}</span>\n\t\t\t</div>\n\t\t\t<div class="se-controller-body">\n\n\t\t\t\t<label>${t.border}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onborder_format" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e[jn.all]}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_onborder_style" class="se-btn se-btn-select se-tooltip se-border-style">\n\t\t\t\t\t\t<span class="se-txt"></span>\n\t\t\t\t\t\t${e.arrow_down}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_border_color" placeholder="${t.color}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="border" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.color_palette}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.colorPicker}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-input-control __se__border_size" placeholder="${t.width}" />\n\t\t\t\t</div>\n\n\t\t\t\t<label>${t.color}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="font" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.font_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.fontColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_font_color" placeholder="${t.fontColor}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="back" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.background_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.backgroundColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_back_color" placeholder="${t.backgroundColor}" />\n\t\t\t\t</div>\n\n\t\t\t\t<label>${t.font}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="bold" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.bold}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.bold}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="underline" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.underline}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.underline}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="italic" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.italic}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.italic}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="strike" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.strike}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.strike}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class="se-table-props-align">\n\t\t\t\t\t<label>${t.align} <span class="__se__a_table_t">( ${t.table} )</span></label>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner">\n\t\t\t\t\t\t<div class="__se__a_h">\n\t\t\t\t\t\t\t${n}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="__se__a_v">\n\t\t\t\t\t\t\t${l}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t\t<button type="button" class="se-btn se-btn-success" data-command="props_submit" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t\t<button type="button" class="se-btn se-btn-danger" data-command="revert" title="${t.revert}" aria-label="${t.revert}">${e.revert}</button>\n\t\t\t</div>\n\t\t</div>`,a=gt.utils.createElement("DIV",{class:"se-controller se-table-props"},r);return{html:a,controller_props_title:a.querySelector(".se-controller-title"),borderButton:a.querySelector('[data-command="props_onborder_style"]'),borderFormatButton:a.querySelector('[data-command="props_onborder_format"]'),cell_alignment:a.querySelector(".se-table-props-align .__se__a_h"),cell_alignment_vertical:a.querySelector(".se-table-props-align .__se__a_v"),cell_alignment_table_text:a.querySelector(".se-table-props-align .__se__a_table_t"),border_style:a.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:a.querySelector(".__se_border_color"),border_width:a.querySelector(".__se__border_size"),back_color:a.querySelector(".__se_back_color"),font_color:a.querySelector(".__se_font_color"),palette_border_button:a.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:a.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:a.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:a.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:a.querySelector('[data-command="props_font_style"][data-value="strike"]')}}(t);t.applyFrameRoots((t=>{t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Un.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Gn.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Zn.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Yn.replace(/^\./,"")}))})),this.controller_cell=new hi(this,o.html,{position:this.cellControllerTop?"top":"bottom"}),this.controller_table=new hi(this,n,{position:"top"}),this.cellControllerTop&&(this.controller_cell.sibling=this.controller_table.form,this.controller_cell.siblingPosition="top");const r=[this.controller_table.form,this.controller_cell.form];this.controller_props=new hi(this,l.html,{position:"bottom",parents:r,isInsideForm:!0}),this.controller_props_title=l.controller_props_title;const a=gt.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.colorPicker=new In(this,"",{colorList:e.colorList||io,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{parents:[a],isOutsideForm:!0}}}),a.appendChild(this.colorPicker.target),this.controller_colorPicker=new hi(this,a,{position:"bottom",parents:[this.controller_props.form].concat(r),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),gt.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.figure=new yi(this,null,{}),this.sliderType="";const h=uo.bind(this,!0),c=uo.bind(this,!1),d=(u=this.lang,{items:["vertical","horizontal"],menus:gt.utils.createElement("DIV",null,`\n\t\t<div title="${u.verticalSplit}" aria-label="${u.verticalSplit}">\n\t\t\t${u.verticalSplit}\n\t\t</div>\n\t\t<div title="${u.horizontalSplit}" aria-label="${u.horizontalSplit}">\n\t\t\t${u.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var u;this.splitButton=o.splitButton,this.selectMenu_split=new ci(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_split.on(this.splitButton,this.#B.bind(this)),this.selectMenu_split.create(d.items,d.menus);const p=function(t,e){const i=gt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertColumnBefore}" aria-label="${t.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${e.insert_column_left}</span><span class="se-txt">${t.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${t.insertColumnAfter}" aria-label="${t.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${e.insert_column_right}</span><span class="se-txt">${t.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${t.deleteColumn}" aria-label="${t.deleteColumn}">\n\t\t\t<span class="se-list-icon">${e.delete_column}</span><span class="se-txt">${t.deleteColumn}</span>\n\t\t</div>`);return{items:["insert-left","insert-right","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),g=o.columnButton;this.selectMenu_column=new ci(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_column.on(g,this.#I.bind(this)),this.selectMenu_column.create(p.items,p.menus);const m=function(t,e){const i=gt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertRowAbove}" aria-label="${t.insertRowAbove}">\n\t\t\t<span class="se-list-icon">${e.insert_row_above}</span><span class="se-txt">${t.insertRowAbove}</span>\n\t\t</div>\n\t\t<div title="${t.insertRowBelow}" aria-label="${t.insertRowBelow}">\n\t\t\t<span class="se-list-icon">${e.insert_row_below}</span><span class="se-txt">${t.insertRowBelow}</span>\n\t\t</div>\n\t\t<div title="${t.deleteRow}" aria-label="${t.deleteRow}">\n\t\t\t<span class="se-list-icon">${e.delete_row}</span><span class="se-txt">${t.deleteRow}</span>\n\t\t</div>`);return{items:["insert-above","insert-below","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),f=o.rowButton;this.selectMenu_row=new ci(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_row.on(f,this.#V.bind(this)),this.selectMenu_row.create(m.items,m.menus);const _=function(){let t="";for(let e,i=0,s=Xn.length;i<s;i++)e=Xn[i],t+=`\n\t\t<div title="${e}" aria-label="${e}" style="padding: 0 12px;">\n\t\t\t<span class="se-txt">${e}</span>\n\t\t</div>`;const e=gt.utils.createElement("DIV",null,t);return{items:Xn,menus:e.querySelectorAll("div")}}(),b=l.borderButton;this.selectMenu_props_border=new ci(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(b,ho.bind(this)),this.selectMenu_props_border.create(_.items,_.menus);const y=po(this.lang,this.icons,[]),v=l.borderFormatButton;this.selectMenu_props_border_format=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(v,co.bind(this,"all")),this.selectMenu_props_border_format.create(y.items,y.menus);const C=po(this.lang,this.icons,Kn);this.selectMenu_props_border_format_oneCell=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(v,co.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(C.items,C.menus),this.maxText=this.lang.maxSize,this.minText=this.lang.minSize,this.propTargets={cell_alignment:l.cell_alignment,cell_alignment_vertical:l.cell_alignment_vertical,cell_alignment_table_text:l.cell_alignment_table_text,border_format:v,border_style:l.border_style,border_color:l.border_color,border_width:l.border_width,back_color:l.back_color,font_color:l.font_color,palette_border_button:l.palette_border_button,font_bold:l.font_bold,font_underline:l.font_underline,font_italic:l.font_italic,font_strike:l.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache="",this.tableHighlight=i.querySelector(".se-table-size-highlighted"),this.tableUnHighlight=i.querySelector(".se-table-size-unhighlighted"),this.tableDisplay=i.querySelector(".se-table-size-display"),this.resizeButton=n.querySelector("._se_table_resize"),this.resizeText=n.querySelector("._se_table_resize > span > span"),this.columnFixedButton=n.querySelector("._se_table_fixed_column"),this.headerButton=n.querySelector("._se_table_header"),this.captionButton=n.querySelector("._se_table_caption"),this.mergeButton=o.mergeButton,this.unmergeButton=o.unmergeButton,this._resizing=!1,this._resizeLine=null,this._resizeLinePrev=null,this._figure=null,this._element=null,this._tdElement=null,this._trElement=null,this._trElements=null,this._tableXY=[],this._maxWidth=!0,this._fixedColumn=!1,this._physical_cellCnt=0,this._logical_cellCnt=0,this._cellCnt=0,this._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._selectedTable=null,this._fixedCell=null,this._selectedCell=null,this._selectedCells=null,this._shift=!1,this.__s=!1,this._fixedCellName=null,this._ref=null,this._bindMultiOn=this.#O.bind(this),this._bindMultiOff=this.#R.bind(this),this._bindShiftOff=this.#z.bind(this),this._bindTouchOff=this.#$.bind(this),this.__globalEvents={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null},this.menu.initDropdownTarget(so,i),this.eventManager.addEvent(s,"mousemove",this.#F.bind(this)),this.eventManager.addEvent(s,"click",this.#P.bind(this))}action(){const t=gt.utils.createElement("TABLE"),e=this._tableXY[0],i=this._tableXY[1],s=`<tbody>${`<tr>${ro("td",e)}</tr>`.repeat(i)}</tbody>`,n=`<colgroup>${`<col style="width: ${mt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+s;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=gt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this._maxWidth=!0,this.component.insert(l,{skipCharCount:!1,skipSelection:!1,skipHistory:!1})){this._resetTablePicker();const e=t.querySelector("td div");this.selection.setRange(e,0,e,0)}}select(t){if(this._figureOpen(t),this._figure||this.setTableInfo(t),this._maxWidth="100%"===this._figure?.style.width,this._fixedColumn=gt.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this._setTableStyle(this._maxWidth?"width|column":"width",!0),Qt.get("__overInfo")===Wn)return;if(!this._tdElement)return;this.setCellInfo(this._tdElement,!0);const e=this._selectedCells?.length>1,i=gt.query.getParentElement(t,gt.check.isFigure);this.controller_table.open(i,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}),this._fixedCell&&(this._setUnMergeButton(),this.controller_cell.open(this._tdElement,this.cellControllerTop?i:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}))}onCopyComponent({event:t,cloneContainer:e}){const i=e.querySelectorAll(".se-selected-table-cell");gt.utils.removeClass(i,"se-selected-table-cell|se-selected-cell-focus"),i.length>0&&(!function(t,e,i){t.preventDefault(),t.stopPropagation();const s=i[0].closest("table"),n=s.cloneNode(!1),o=gt.utils.createElement("tbody");n.appendChild(o);const l=new Map;i.forEach((t=>{l.set(t,!0)}));const r=s.rows,a=r.length,h=Array.from(r[0].cells).reduce(((t,e)=>t+(e.colSpan||1)),0),c=Array.from({length:a},(()=>Array(h).fill(null)));for(let t=0,e=0;t<a;t++,e++){const i=r[t].cells;for(let t=0,s=0,n=i.length;t<n;t++){for(;c[e][s];)s++;const n=i[t],o=n.rowSpan||1,l=n.colSpan||1;for(let t=0;t<o;t++)for(let i=0;i<l;i++)c[e+t][s+i]=n;s+=l}}for(let t=0;t<a;t++){let e;for(let i=0;i<h;i++){const s=c[t][i];if(!s||!l.has(s))continue;if(e||(e=gt.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&c[t][i-1]===s)continue;if(t>0&&c[t-1][i]===s)continue;const n=s.cloneNode(!0);let r=1,d=1;for(;t+r<a&&c[t+r][i]===s;)r++;for(;i+d<h&&c[t][i+d]===s;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=gt.utils.createElement("figure");d.className=e.className,d.appendChild(n);const u=`<html><body>\x3c!--StartFragment--\x3e${d.outerHTML}\x3c!--EndFragment--\x3e</body></html>`;t.clipboardData.setData("text/html",u)}(t,e,i),this.editor.ui.showToast(this.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const i=gt.query.getParentElement(gt.query.getEventTarget(t),gt.check.isTableCell);if(!i)return;const s=e.body;if(1!==s.childElementCount)return;const n=this.component.get(s.firstElementChild);if(n.pluginName!==so.key)return;const o=n.target;return this.pasteTableCellMatrix(o,i),!0}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let i=gt.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows[0],i=function(t){const e=t.rows;let i=0;for(let t=0,s=e.length;t<s;t++){const s=e[t].cells;let n=0;for(let t=0,e=s.length;t<e;t++)n+=s[t].colSpan;i=Math.max(i,n)}return i}(t),s=[];for(let t=0;t<i;t++){let i="";if(e&&e.cells[t]){const s=e.cells[t].style.width;s&&(i=` style="width: ${s};"`,gt.utils.setStyle(e.cells[t],"width",""))}s.push(`<col${i}>`)}const n=gt.utils.createElement("colgroup",null,s.join(""));t.insertBefore(n,t.firstElementChild)}i?gt.utils.addClass(i,"se-flex-component|se-input-component"):(i=gt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(i,t),i.appendChild(t));const s=t.style.width;if(s&&(i.style.width="auto"===s?"max-content":s,gt.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;gt.utils.addClass(i,t),gt.utils.removeClass(i,this.figureScrollList.filter((e=>e!==t)).join("|"))}else gt.utils.removeClass(i,this.figureScrollList.join("|"))}}}setDir(t){this.tableHighlight.style.left="rtl"===t?"167px":"",this._resetTablePicker(),this._resetPropsAlign()}onMouseMove({event:t}){if(this._resizing)return;const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,no);if(!i||1===t.buttons)return void this.__hideResizeLine();const s=oo(t,i);if(s.is)return this._element&&(this._element.style.cursor=""),this.__removeGlobalEvents(),"block"===this._resizeLine?.style.display&&(this._resizeLine.style.display="none"),this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Un),this._setResizeLinePosition(gt.query.getParentElement(i,gt.check.isTable),i,this._resizeLine,s.isLeft),void(this._resizeLine.style.display="block");if(lo(t,i).is)return this.__removeGlobalEvents(),this._element=gt.query.getParentElement(i,gt.check.isTable),this._element.style.cursor="ns-resize","block"===this._resizeLine?.style.display&&(this._resizeLine.style.display="none"),this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Zn),this._setResizeRowPosition(gt.query.getParentElement(i,gt.check.isTable),i,this._resizeLine),void(this._resizeLine.style.display="block");this._element&&(this._element.style.cursor=""),this.__hideResizeLine()}onScroll(){"block"===this._resizeLine?.style.display&&(this._element&&(this._element.style.cursor=""),this._resizeLine.style.display="none")}onMouseDown({event:t}){this._ref=this._selectedCell=null;const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,no);if(!i)return;this.cellControllerTop||this.controller_cell.hide();const s=oo(t,i);if(s.is){try{this._deleteStyleSelectedCells(),this.setCellInfo(i,!0);const t=this._logical_cellIndex+this._current_colSpan-(s.isLeft?1:0);if(this.ui.enableBackWrapper("ew-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Un)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(Gn),t<0||t===this._logical_cellCnt-1)return void this._startFigureResizing(s.startX,t<0);const e=this._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(e,s.startX,mt.get(qn.getComputedStyle(e).width,0),s.isLeft),this._toggleEditor(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}finally{this._fixedCell=this._selectedCell=null}return}const n=lo(t,i);if(n.is)try{let t=gt.query.getParentElement(i,gt.check.isTableRow),e=i.rowSpan;if(e>1)for(;gt.check.isTableRow(t)&&e>1;)t=t.nextElementSibling,--e;this._deleteStyleSelectedCells(),this.setRowInfo(t),this.ui.enableBackWrapper("ns-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Zn)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(Yn),this._startRowResizing(t,n.startY,mt.get(qn.getComputedStyle(t).height,0)),this._toggleEditor(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}finally{this._fixedCell=this._selectedCell=null}else this._shift&&i!==this._fixedCell||(this._deleteStyleSelectedCells(),/^TR$/i.test(i.nodeName)||this.#D(i,!1))}onMouseUp(){this._shift=!1,this.cellControllerTop||this.controller_cell.resetPosition(this._fixedCell)}onMouseLeave(){this.__hideResizeLine()}onKeyDown({event:t,range:e,line:i}){this._ref=null;const s=t.code,n=ft.isTab(s);if(this.editor.selectMenuOn||this._resizing||!n&&this.__s||ft.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.__s=ft.isShift(t),n){this._deleteStyleSelectedCells();const s=gt.query.getParentElement(i,gt.check.isTableCell);if(s&&e.collapsed&>.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.__s;this._shift=this.__s=!1;const i=gt.query.getParentElement(s,"table"),n=gt.query.getListChildren(i,gt.check.isTableCell),o=e?gt.utils.prevIndex(n,s):gt.utils.nextIndex(n,s);if(o===n.length&&!e){if(!gt.query.getParentElement(s,"thead")){const t=i.rows,e=this.insertBodyRow(i,t.length,this._cellCnt).querySelector("td div");this.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return!1;const l=n[o];if(!l)return;const r=l.firstElementChild||l;return this.selection.setRange(r,0,r,0),t.preventDefault(),t.stopPropagation(),!1}}let o=null;if(!ft.isShift(t)){if(o=gt.query.getParentElement(i,gt.check.isTableCell),!gt.utils.hasClass(o,"se-selected-cell-focus"))return;return this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents(),void this._closeController()}return this._shift||this._ref?void 0:(o=o||gt.query.getParentElement(i,gt.check.isTableCell),o?(this.__s=!1,this._fixedCell=o,this._closeController(),this.#D(o,t.shiftKey),!1):void 0)}onKeyUp({line:t}){this.__s=!1,this._shift&>.query.getParentElement(t,gt.check.isTableCell)===this._fixedCell&&(this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents()),this._shift=!1}colorPickerAction(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const{back_color:i,font_color:s,border_color:n}=this.propTargets,o=t.getAttribute("data-value");switch(e){case"header":this.toggleHeader(),this._historyPush();break;case"caption":this.toggleCaption(),this._historyPush();break;case"onsplit":this.selectMenu_split.open();break;case"oncolumn":this.selectMenu_column.open();break;case"onrow":this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this._tdElement?.nodeName)?"none":"",this.selectMenu_row.open();break;case"openTableProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.tableProperties,this._setCtrlProps("table"),this.controller_props.open(t,this.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"openCellProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.cellProperties,this._setCtrlProps("cell"),this.controller_props.open(t,this.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"props_onborder_format":1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open();break;case"props_onborder_style":this.selectMenu_props_border.open();break;case"props_onpalette":this._onColorPalette(t,o,"border"===o?n:"back"===o?i:s);break;case"props_font_style":gt.utils.toggleClass(this.propTargets[`font_${o}`],"on");break;case"props_submit":this._submitProps(t);break;case"revert":{const t=this._propsCache;for(let e=0,i=t.length;e<i;e++)t[e][0].style.cssText=t[e][1];this._setAlignProps(this.propTargets.cell_alignment,this._propsAlignCache,!0),this._setAlignProps(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),gt.check.isTable(t[0][0])&&this._figure&&(this._figure.style.float=this._propsAlignCache);break}case"close_props":this.controller_props.close();break;case"props_align":this._setAlignProps(this.propTargets.cell_alignment,t.getAttribute("data-value"),!1);break;case"props_align_vertical":this._setAlignProps(this.propTargets.cell_alignment_vertical,t.getAttribute("data-value"),!1);break;case"merge":this.mergeCells(this._selectedCells);break;case"unmerge":this.unmergeCells(this._selectedCells);break;case"resize":this._maxWidth=!this._maxWidth,this._setTableStyle("width",!1),this._historyPush(),this.component.select(this._element,so.key,{isInput:!0});break;case"layout":this._fixedColumn=!this._fixedColumn,this._setTableStyle("column",!1),this._historyPush(),this.component.select(this._element,so.key,{isInput:!0});break;case"copy":this.component.copy(this._figure);break;case"remove":{const t=this._figure?.parentNode;gt.utils.removeItem(this._figure),this._closeTableSelectInfo(),t!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(t,(function(t){return 0===t.childNodes.length}),null),this.editor.focus(),this.history.push(!1)}}/(^props_|^revert|Properties$)/.test(e)||(this.controller_props.close(),this.controller_colorPicker.close()),/^(remove|props_|on|open|merge)/.test(e)||this._setCellControllerPosition(this._tdElement,this._shift)}close(){this.__removeGlobalEvents(),this._deleteStyleSelectedCells(),this._toggleEditor(!0),this._figure=null,this._element=null,this._trElement=null,this._trElements=null,this._tableXY=[],this._maxWidth=!1,this._fixedColumn=!1,this._physical_cellCnt=0,this._logical_cellCnt=0,this._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._shift=!1,this._selectedCells=null,this._selectedTable=null,this._ref=null,this._fixedCell=null,this._selectedCell=null,this._fixedCellName=null;const{border_format:t,border_color:e,border_style:i,border_width:s,back_color:n,font_color:o,cell_alignment:l,cell_alignment_vertical:r,font_bold:a,font_underline:h,font_italic:c,font_strike:d}=this.propTargets;gt.utils.removeClass([t,e,i,s,n,o,l,r,a,h,c,d],"on")}selectCells(t){const e=t[0],i=gt.query.findVisualLastCell(t);this._selectedCells=t,this._fixedCell=e,this._selectedCell=i,this._fixedCellName=e.nodeName,this._selectedTable=gt.query.getParentElement(e,"TABLE"),this._setMultiCells(e,i)}setTableInfo(t){const e=this._element=this._selectedTable=gt.query.getParentElement(t,"TABLE");return this._figure=gt.query.getParentElement(e,gt.check.isFigure)||e,e}setCellInfo(t,e){const i=this.setTableInfo(t);if(i&&(this._fixedCell=t,this._trElement=t.parentNode,i.querySelector("thead")?gt.utils.addClass(this.headerButton,"active"):gt.utils.removeClass(this.headerButton,"active"),i.querySelector("caption")?gt.utils.addClass(this.captionButton,"active"):gt.utils.removeClass(this.captionButton,"active"),e||0===this._physical_cellCnt)){this._tdElement!==t&&(this._tdElement=t,this._trElement=t.parentNode),this._selectedCells?.length||(this._selectedCells=[t]);const e=this._trElements=i.rows,s=t.cellIndex;let n=0;for(let t=0,i=e[0].cells,s=e[0].cells.length;t<s;t++)n+=i[t].colSpan;const o=this._rowIndex=this._trElement.rowIndex;this._rowCnt=e.length,this._physical_cellCnt=this._trElement.cells.length,this._logical_cellCnt=this._cellCnt=n,this._physical_cellIndex=s,this._current_colSpan=this._tdElement.colSpan-1,this._current_rowSpan=this._trElement.cells[s].rowSpan-1;let l=[],r=[];for(let t,i,n=0;n<=o;n++){t=e[n].cells,i=0;for(let e,a,h,c,d=0,u=t.length;d<u;d++){if(e=t[d],a=e.colSpan-1,h=e.rowSpan-1,c=d+i,r.length>0)for(let t,e=0;e<r.length;e++)t=r[e],t.row>n||(c>=t.index?(i+=t.cs,c+=t.cs,t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)):d===u-1&&(t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)));if(n===o&&d===s){this._logical_cellIndex=c;break}h>0&&l.push({index:c,cs:a+1,rs:h,row:-1}),i+=a}r=r.concat(l).sort((function(t,e){return t.index-e.index})),l=[]}l=null,r=null}}setRowInfo(t){const e=this.setTableInfo(t),i=this._trElements=e.rows;this._rowCnt=i.length,this._rowIndex=t.rowIndex}editTable(t,e){const i=this._element,s="row"===t;if(s){const t=this._trElement.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?i.innerHTML+="<tbody><tr>"+ro("td",this._logical_cellCnt)+"</tr></tbody>":(gt.utils.removeItem(this._figure),this._closeTableSelectInfo()))}}if(this._ref){const t=this._tdElement,i=this._selectedCells;if(s)if(e)this.setCellInfo("up"===e?i[0]:i[i.length-1],!0),this.editRow(e,null,t);else{let t=i[0].parentNode;const s=[i[0]];for(let e,n=1,o=i.length;n<o;n++)e=i[n],t!==e.parentNode&&(s.push(e),t=e.parentNode);for(let t=0,i=s.length;t<i;t++)this.setCellInfo(s[t],!0),this.editRow(e)}else{const s=i[0].parentNode;if(e){let n=null;for(let t=0,e=i.length-1;t<e;t++)if(s!==i[t+1].parentNode){n=i[t];break}this.setCellInfo("left"===e?i[0]:n||i[0],!0),this.editCell(e,null,t)}else{const t=[i[0]];for(let e,n=1,o=i.length;n<o&&(e=i[n],s===e.parentNode);n++)t.push(e);for(let i=0,s=t.length;i<s;i++)this.setCellInfo(t[i],!0),this.editCell(e)}}e||this.close()}else this[s?"editRow":"editCell"](e);if(!e){const t=i.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(gt.utils.removeItem(t[e]),e--);0===i.children.length&>.utils.removeItem(i)}}editRow(t,e,i){this._deleteStyleSelectedCells(),e&&this.setCellInfo(e,!0);const s=!t,n="up"===t,o=this._rowIndex,l=s||n?o:o+this._current_rowSpan+1,r=s?-1:1,a=this._trElements;let h=this._logical_cellCnt;for(let t,e=0,i=o+(s?-1:0);e<=i;e++){if(t=a[e].cells,0===t.length)return;for(let i,s,n=0,o=t.length;n<o;n++)i=t[n].rowSpan,s=t[n].colSpan,i<2&&s<2||i+e>l&&l>e&&(t[n].rowSpan=i+r,h-=s)}if(s){const t=a[o+1];if(t){const e=[];let i=a[o].cells,s=0;for(let t,n,o=0,l=i.length;o<l;o++)t=i[o],n=o+s,s+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!1),index:n}));if(e.length>0){let n=e.shift();i=t.cells,s=0;for(let o,l,r=0,a=i.length;r<a&&(o=i[r],l=r+s,s+=o.colSpan-1,!(l>=n.index)||(r--,s--,s+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let i=0,s=e.length;i<s;i++)t.appendChild(e[i].cell)}}}this._element.deleteRow(l)}else this.insertBodyRow(this._element,l,h);s?this._closeController():this._setCellControllerPosition(i||this._tdElement,!0)}editCell(t,e,i){e&&this.setCellInfo(e,!0);const s=!t,n="left"===t,o=this._current_colSpan,l=s||n?this._logical_cellIndex:this._logical_cellIndex+o+1,r=this._trElements;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,i,n,g,m=0,f=this._rowCnt;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,i,r,f,_=0,b=e.length;_<b&&(t=e[_],t);_++)if(i=t.rowSpan-1,r=t.colSpan-1,s){if(f=_+g,c.length>0){const t=!e[_+1];for(let e,i=0;i<c.length;i++)e=c[i],e.row>m||(f>=e.index?(g+=e.cs,f=_+g,e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)))}i>0&&h.push({rs:i,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=mt.getOverlapRangeAtIndex(l,l+o,f,f+r):i>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+i}),g+=r}else{if(_>=a)break;if(r>0){if(d<1&&r+_>=a){t.colSpan+=1,a=null,d=i+1;break}a-=r}if(!n){for(let t,e=0;e<c.length;e++)t=c[e],a-=t.cs,t.rs-=1,t.rs<1&&(c.splice(e,1),e--);n=!0}}if(c=c.concat(h).sort((function(t,e){return t.index-e.index})),h=[],!s){if(d>0){d-=1;continue}null!==a&&e.length>0&&(i=ao(e[0].nodeName),i=t.insertBefore(i,e[a]))}}const g=this._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(s)gt.utils.removeItem(t[a]);else{let e=0;for(let i,s=0,n=t.length;s<n;s++)i=mt.get(t[s].style.width),i-=Math.round(i*n*.1/2),e+=i,t[s].style.width=`${i}%`;const i=gt.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(i,t[a])}}if(s){let t,e;for(let i,s=0,n=u.length;s<n;s++)i=u[s].parentNode,gt.utils.removeItem(u[s]),0===i.cells.length&&(t||(t=gt.utils.getArrayIndex(r,i)),e=gt.utils.getArrayIndex(r,i),gt.utils.removeItem(i));for(let i,s=0,n=p.length;s<n;s++)i=p[s],i.cell.rowSpan=mt.getOverlapRangeAtIndex(t,e,i.i,i.rs);this._closeController()}else this._setCellControllerPosition(i||this._tdElement,!0);return i||this._tdElement}pasteTableCellMatrix(t,e){if(!t||!e)return;const i=t.rows;let s=0;const n=[];for(let t=0;t<i.length;t++){const e=i[t].cells;let o=0;for(let i=0;i<e.length;i++){const l=e[i];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(s+=r);for(let e=0;e<r;e++)for(let i=0;i<a;i++)n[t+e]||(n[t+e]=[]),n[t+e][o+i]=!0;o+=a}}let o=0;for(let t=0,e=i[0].cells,s=e.length;t<s;t++){o+=e[t].colSpan||1}const l={rowCnt:s,logicalCellCnt:o};this._deleteStyleSelectedCells();const r=e.closest("table"),{cloneTable:a,clonedSelectedCells:h}=this.#q(r,[e]),c=a;e=h[0];let d=c.rows;this.setTableInfo(c),this.setCellInfo(e,!0);const u={physicalCellCnt:this._physical_cellCnt,logicalCellCnt:this._logical_cellCnt,rowCnt:this._rowCnt,rowInex:this._rowIndex,physicalCellIndex:this._physical_cellIndex,logicalCellIndex:this._logical_cellIndex,currentColSpan:this._current_colSpan,currentRowSpan:this._current_rowSpan},p=l.rowCnt-(u.rowCnt-(u.rowInex+1))-1,g=l.logicalCellCnt-(u.logicalCellCnt-(u.logicalCellIndex+1))-1;if(u.rowCnt+=p,u.logicalCellCnt+=g,u.physicalCellCnt+=g,p>0||g>0){const t=d[d.length-1],e=t.cells[t.cells.length-1];for(let t=0;t<p;t++)this.editRow("down",e);for(let t=0;t<g;t++)this.editCell("right",e);d=this._trElements=c.rows}const m=u.rowInex,f=u.logicalCellIndex,_=f+l.logicalCellCnt-1,b=[],y=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let i=0,s=0;for(let n=0;n<e.length;n++){for(;y[t]?.[i];)i++;const n=e[s++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=i,a=i+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const s=t+e;y[s]||(y[s]=[]);for(let t=0;t<o;t++)y[s][i+t]=!0}r<=_&&a>=f&&(o>1||l>1)&&b.push(n),i+=o}}b.length>0&&(this.unmergeCells(b,!0),d=this._trElements=c.rows);const v=[],C=[],w=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=i[t]?.cells;if(!e)break;let s=0;for(let i=0;i<e.length;i++){const n=e[i],o=n.colSpan||1,l=n.rowSpan||1;for(;C[t]?.[s];)s++;for(let e=1;e<l;e++){const i=t+e;C[i]||(C[i]=[]);for(let t=0;t<o;t++)C[i][s+t]=!0}if(o<=1&&l<=1){s+=o;continue}const r=s+u.logicalCellIndex,a=r+o-1,h=[];for(let e=u.rowInex+t,i=e+l,s=0;e<i;e++,s++){const t=d[e].cells;let i=0,s=0;for(;s<t.length&&i<=a;){for(;w[e]?.[i];)i++;const n=t[s++],o=n.colSpan||1,l=n.rowSpan||1,c=i,d=i+o-1;if(l>1)for(let t=1;t<l;t++){const s=e+t;w[s]||(w[s]=[]);for(let t=0;t<o;t++)w[s][i+t]=!0}d>=r&&c<=a&&h.push(n),i+=o}}h.length>0&&v.push(h),s+=o}}if(v.length>0){for(const t of v)this._ref=null,this._trElements=c.rows,this.mergeCells(t,!0);d=this._trElements=c.rows}const x=[],k=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowInex+t],s=i[t];if(!e||!s)break;const n=e.cells,o=s.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=_;){for(;k[t]?.[l];)l++;const e=n[r++],i=o[a];if(!e||!i)break;const s=e.colSpan||1,h=e.rowSpan||1;if(h>1)for(let e=1;e<h;e++){const i=t+e;k[i]||(k[i]=[]);for(let t=0;t<s;t++)k[i][l+t]=!0}l>=f&&l+s-1<=_&&(e.innerHTML=i.innerHTML,x.push(e),a++),l+=s}}r.replaceWith(c),this._closeTableSelectInfo(),this.setTableInfo(c),this.selectCells(x),this._setMergeSplitButton(),this._setUnMergeButton(),this.#W(x[0]),this._historyPush()}insertBodyRow(t,e,i){const s=t.insertRow(e);return s.innerHTML=ro("td",i),s}mergeCells(t,e=!1){const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this.#q(i,t);this.setTableInfo(s),t=n,this._ref=null,this._setMultiCells(t[0],gt.query.findVisualLastCell(t));const o=this._ref,l=t[0];let r=null,a=null;const h=o.ce-o.cs+1;let c=o.re-o.rs+1,d="",u=null;for(let e,i,s=1,n=t.length;s<n;s++){e=t[s],u!==e.parentNode&&(u=e.parentNode),i=e.children;for(let t=0,e=i.length;t<e;t++)this.format.isLine(i[t])&>.check.isZeroWidth(i[t].textContent)&>.utils.removeItem(i[t]);d+=e.innerHTML,gt.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this._trElements,e=gt.utils.getArrayIndex(t,r),i=gt.utils.getArrayIndex(t,a||r),s=[];for(let n,o=0;o<=i;o++)if(n=t[o].cells,0!==n.length)for(let t,s,l=0,r=n.length;l<r;l++)t=n[l],s=t.rowSpan-1,s>0&&o+s>=e&&(t.rowSpan-=mt.getOverlapRangeAtIndex(e,i,o,o+s));else s.push(t[o]);for(let t=0,e=s.length;t<e;t++)gt.utils.removeItem(s[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(i.replaceWith(s),this._closeTableSelectInfo(),this._setMergeSplitButton(),this._setController(l),this.#W(l),this._historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this.#q(i,t);this._ref=null,this.setTableInfo(s);let o=(t=n)[0],l=gt.query.findVisualLastCell(t),r=null;const a=o.closest("table"),h=a.rows;for(const e of t){const t=e.parentElement.rowIndex,i=e.cellIndex,s=e.rowSpan,n=e.colSpan;if(1===s&&1===n)continue;this.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let c=0;c<s;c++){const s=h[t+c];for(let t=0;t<n;t++){const n=ao("td");0===c&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,s.insertBefore(n,s.cells[i])):(s.insertBefore(n,s.cells[i+t]),r=n)}}}this._selectedCells=null,e||(i.replaceWith(s),this._closeTableSelectInfo(),this.setTableInfo(s),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this._setMultiCells(o,l),this._selectedCells=Array.from(a.querySelectorAll(".se-selected-table-cell"))):this.setCellInfo(l,!0),this._fixedCell=o,this._selectedCell=l,gt.utils.addClass(l,"se-selected-cell-focus"),this._setUnMergeButton(),this.controller_cell.resetPosition(l),this._historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}toggleHeader(){const t=this.headerButton,e=gt.utils.hasClass(t,"active"),i=this._element;if(e)gt.utils.removeItem(i.querySelector("thead"));else{const t=gt.utils.createElement("THEAD");t.innerHTML="<tr>"+ro("th",this._logical_cellCnt)+"</tr>",i.insertBefore(t,i.firstElementChild)}gt.utils.toggleClass(t,"active"),/TH/i.test(this._tdElement.nodeName)?this._closeController():this._setCellControllerPosition(this._tdElement,!1)}toggleCaption(){const t=this.captionButton,e=gt.utils.hasClass(t,"active"),i=this._element;if(e)gt.utils.removeItem(i.querySelector("caption"));else{const t=gt.utils.createElement("CAPTION",{class:`se-table-caption-${this.captionPosition}`});t.innerHTML="<div><br></div>",i.insertBefore(t,i.firstElementChild)}gt.utils.toggleClass(t,"active"),this._setCellControllerPosition(this._tdElement,!1)}_setTableStyle(t,e){if(t.includes("width")){const t=this._figure;if(!t)return;let i,s;this._maxWidth?(i=this.icons.reduction,s=this.minText,e||(t.style.width="100%")):(i=this.icons.expansion,s=this.maxText,e||(t.style.width="max-content")),gt.utils.changeElement(this.resizeButton.firstElementChild,i),gt.utils.changeTxt(this.resizeText,s)}t.includes("column")&&(this._fixedColumn?(gt.utils.removeClass(this._element,"se-table-layout-auto"),gt.utils.addClass(this._element,"se-table-layout-fixed"),gt.utils.addClass(this.columnFixedButton,"active")):(gt.utils.removeClass(this._element,"se-table-layout-fixed"),gt.utils.addClass(this._element,"se-table-layout-auto"),gt.utils.removeClass(this.columnFixedButton,"active")))}_setMergeSplitButton(){this._ref?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}_setUnMergeButton(){this.findMergedCells(this._selectedCells?.length?this._selectedCells:[this._fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_setController(t){if(!this.selection.get().isCollapsed&&!this._selectedCell)return void this._deleteStyleSelectedCells();this._setUnMergeButton(),this._tdElement=t,this._fixedCell===t&>.utils.addClass(t,"se-selected-cell-focus"),this._selectedCells?.length||(this._selectedCells=[t]);const e=this._selectedTable||this._element||gt.query.getParentElement(t,"TABLE");this.component.select(e,so.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.controller_cell.resetPosition(this.cellControllerTop?gt.query.getParentElement(t,gt.check.isTable):t)}_historyPush(){this._deleteStyleSelectedCells(),this.history.push(!1),this._recallStyleSelectedCells()}_figureOpen(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})}_resizePercentCol(){const t=this._element.querySelector("colgroup").querySelectorAll("col"),e=this._element.offsetWidth;t.forEach((t=>{const i=qn.getComputedStyle(t).getPropertyValue("width");if(!i.endsWith("%")){const s=mt.get(i,1)/e*100;t.style.width=s+"%"}}))}_startCellResizing(t,e,i,s){this._resizePercentCol(),this._setResizeLinePosition(this._figure,this._tdElement,this._resizeLinePrev,s),this._resizeLinePrev.style.display="block";const n=t.style.width,o=t.nextElementSibling,l=o.style.width,r=gt.utils.hasClass(this._element,"se-table-layout-fixed")?l:pt.getWidthInPercentage(o||t);Qt.get("__dragHandler")&&(Qt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._cellResize.bind(this,t,o,this._figure,this._tdElement,this._resizeLine,s,e,i,mt.get(n,0),mt.get(r,0),this._element.offsetWidth),(()=>{this.__removeGlobalEvents(),this._resizePercentCol(),this.history.push(!0),this.component.select(this._element,so.key,{isInput:!0})}),(e=>{this._stopResize(t,n,"width",e),this._stopResize(o,l,"width",e)}))}_cellResize(t,e,i,s,n,o,l,r,a,h,c,d){const u=(r+(d.clientX-l))/c*100;if(u>0){t.style.width=`${u}%`;const l=a-u;e.style.width=`${h+l}%`,this._setResizeLinePosition(i,s,n,o)}}_startRowResizing(t,e,i){this._setResizeRowPosition(this._figure,t,this._resizeLinePrev),this._resizeLinePrev.style.display="block";const s=t.style.height;this._addResizeGlobalEvents(this._rowResize.bind(this,t,this._figure,this._resizeLine,e,i),(()=>{this.__removeGlobalEvents(),this.history.push(!0)}),this._stopResize.bind(this,t,s,"height"))}_rowResize(t,e,i,s,n,o){const l=n+(o.clientY-s);t.style.height=`${l}px`,this._setResizeRowPosition(e,t,i)}_startFigureResizing(t,e){const i=this._figure;this._setResizeLinePosition(i,i,this._resizeLinePrev,e),this._resizeLinePrev.style.display="block";const s=pt.getWidthInPercentage(i);Qt.get("__dragHandler")&&(Qt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._figureResize.bind(this,i,this._resizeLine,e,t,i.offsetWidth,mt.get(s,0)),(()=>{this.__removeGlobalEvents(),mt.get(i.style.width,0)>100&&(i.style.width="100%"),this.component.select(this._element,so.key,{isInput:!0})}),this._stopResize.bind(this,i,i.style.width,"width"))}_figureResize(t,e,i,s,n,o,l){const r=(n+(i?s-l.clientX:l.clientX-s))/n*o;r>0&&(t.style.width=`${r}%`,this._setResizeLinePosition(t,t,e,i))}_setResizeLinePosition(t,e,i,s){const n=this.offset.getLocal(e),o=this.offset.getLocal(t);i.style.left=`${n.left+(s?0:e.offsetWidth)}px`,i.style.top=`${o.top}px`,i.style.height=`${t.offsetHeight}px`}_setResizeRowPosition(t,e,i){const s=this.offset.getLocal(e),n=this.offset.getLocal(t);i.style.top=`${s.top+e.offsetHeight}px`,i.style.left=`${n.left}px`,i.style.width=`${t.offsetWidth}px`}_stopResize(t,e,i,s){ft.isEsc(s.code)&&(this.__removeGlobalEvents(),t.style[i]=e,"width"===i&&this.component.select(this._element,so.key,{isInput:!0}))}_deleteStyleSelectedCells(){gt.utils.removeClass([this._fixedCell,this._selectedCell],"se-selected-cell-focus");const t=this._fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,i=e.length;t<i;t++)gt.utils.removeClass(e[t],"se-selected-table-cell")}}_recallStyleSelectedCells(){if(this._selectedCells){const t=this._selectedCells;for(let e=0,i=t.length;e<i;e++)gt.utils.addClass(t[e],"se-selected-table-cell")}}_addResizeGlobalEvents(t,e,i){this.__globalEvents.resize=this.eventManager.addGlobalEvent("mousemove",t,!1),this.__globalEvents.resizeStop=this.eventManager.addGlobalEvent("mouseup",e,!1),this.__globalEvents.resizeKeyDown=this.eventManager.addGlobalEvent("keydown",i,!1),this._resizing=!0}_toggleEditor(t){const e=this.editor.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?gt.utils.removeClass(e,"se-disabled"):gt.utils.addClass(e,"se-disabled")}_setCtrlProps(t){this._typeCache=t;const e="table"===t,i=e?[this._element]:this._selectedCells;if(!i||0===i.length)return;const{border_format:s,border_color:n,border_style:o,border_width:l,back_color:r,font_color:a,cell_alignment:h,cell_alignment_vertical:c,cell_alignment_table_text:d,font_bold:u,font_underline:p,font_italic:g,font_strike:m}=this.propTargets,{border:f,backgroundColor:_,color:b,textAlign:y,verticalAlign:v,fontWeight:C,textDecoration:w,fontStyle:x}=qn.getComputedStyle(i[0]),k=this._getBorderStyle(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let E=pt.rgb2hex(k.c),S=k.s,T=k.w,H=pt.rgb2hex(_),L=pt.rgb2hex(b),M=/.+/.test(C),N=/underline/i.test(w),A=/line-through/i.test(w),B=/italic/i.test(x),I=e?this._figure?.style.float:y,V=v;this._propsCache=[];const O=qn.getComputedStyle(this.eventManager.__focusTemp);for(let t,s,n=0;t=i[n];n++){const{cssText:i,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:h,textDecoration:c,fontStyle:d}=t.style;if(this._propsCache.push([t,i]),s)continue;const{c:u,s:p,w:g}=this._getBorderStyle(n);let m=o,f=l;m&&(this.eventManager.__focusTemp.style.backgroundColor=m,m=O.backgroundColor),f&&(this.eventManager.__focusTemp.style.color=f,f=O.color),E&&k.c!==u&&(E=""),S&&k.s!==p&&(S=""),T&&k.w!==g&&(T=""),H!==pt.rgb2hex(m)&&(H=""),L!==pt.rgb2hex(f)&&(L=""),I!==(e?this._figure?.style.float:r)&&(I=""),V&&V!==a&&(V=""),M&&M!==/.+/.test(h)&&(M=!1),N&&N!==/underline/i.test(c)&&(N=!1),A&&A!==/line-through/i.test(c)&&(A=!1),B&&B!==/italic/i.test(d)&&(B=!1),E&&S&&T&&H&&L||(s=!0)}s.firstElementChild.innerHTML=this.icons[jn[1===i.length?"outside":"all"]],s.setAttribute("se-border-format","all"),gt.utils.removeClass(s,"active"),S=S||Xn[0],o.textContent=S,n.style.borderColor=n.value=E,l.value=T,this._disableBorderProps(S===Xn[0]),r.value=r.style.borderColor=H,a.value=a.style.borderColor=L,M&>.utils.addClass(u,"on"),N&>.utils.addClass(p,"on"),A&>.utils.addClass(m,"on"),B&>.utils.addClass(g,"on"),this._setAlignProps(h,this._propsAlignCache=I,!0),this._setAlignProps(c,this._propsVerticalAlignCache=V,!0)}_setAlignProps(t,e,i){gt.utils.removeClass(t.querySelectorAll("button"),"on"),i||t.getAttribute("se-cell-align")!==e?(gt.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}_disableBorderProps(t){const{border_color:e,border_width:i,palette_border_button:s}=this.propTargets;t?(e.disabled=!0,i.disabled=!0,s.disabled=!0,i.disabled=!0):(e.disabled=!1,i.disabled=!1,s.disabled=!1,i.disabled=!1)}_getBorderStyle(t){const e=t.split(/\s(?![^()]*\))/);let i="",s="",n="";return 3===e.length?(i=e[0],s=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(i=e[0],s=e[1]):(s=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?i=e[0]:s=e[0]),{w:i,s,c:pt.rgb2hex(n)}}_submitProps(t){try{t.disabled=!0;const e=this.controller_table.form.contains(this.controller_props.currentTarget),i=e?[this._element]:this._selectedCells,s=i[0],n=qn.getComputedStyle(s),{border_format:o,border_color:l,border_style:r,border_width:a,back_color:h,font_color:c,cell_alignment:d,cell_alignment_vertical:u}=this.propTargets,p=o.getAttribute("se-border-format")||"",g="all"!==p,m=("none"===r.textContent?"":r.textContent)||"",f="none"===p||!m,_=d.getAttribute("se-cell-align")||"",b=u.getAttribute("se-cell-align")||"",y=f?"":l.value.trim()||n.borderColor;let v=f?"":a.value.trim()||n.borderWidth;v+=mt.is(v)?"px":"";const C=h.value.trim(),w=c.value.trim(),x=g&&!f&&v,k=`${v} ${m} ${y}`,E={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=s.style;this._figure&&(this._figure.style.float=_,this._figure.style.verticalAlign=b),t.backgroundColor=C,t.color=w,this._setFontStyle(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":k),E.left=E.top=E.right=E.bottom=i}else{const t=s.parentElement;let{rs:e,re:n,cs:o,ce:l}=this._ref||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:s.cellIndex||0,ce:s.cellIndex||0};const r=new Array(n-e+1).fill(0).map((()=>new Array(l-o+1).fill(0))),a=o;n-=e,e-=e,l-=o,o-=o;let h=t;for(let t,s,c,d,u,p=0,g=0,m=i.length,y=0;p<m;p++,g++){t=i[p],d=t.colSpan,u=t.rowSpan,c=t.cellIndex-a,h!==t.parentElement&&(y++,g=0,h=t.parentElement);let m=0;for(;m<=c;)c+=r[y][m]||0,m++;try{if(u>1){const t=u-1;for(let e=y;e<=y+t;e++)r[e][c]+=d-(y===e?1:0)}else d>1&&(r[y][c]+=d-1)}catch(t){}const v=y+u-1===n;y===e&&E.top.push(t),(y===n||v)&&E.bottom.push(t),c===o&&E.left.push(t),c!==l&&c+d-1!==l||E.right.push(t),v||y===e||y===n||c===o||c===l||E.middle.push(t),s=t.style,s.textAlign=_,s.verticalAlign=b,s.backgroundColor=C,s.color=w,this._setFontStyle(s),x||(s.border=f?s.borderLeft=s.borderTop=s.borderRight=s.borderBottom="":k)}0===E.middle.length&&(E.middle=i)}E.all=i,x&&this._setBorderStyles(E,p,k),this._historyPush(),this.controller_props.close(),this._tdElement&&(this._recallStyleSelectedCells(),this.setCellInfo(this._tdElement,!0),gt.utils.addClass(this._tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}_setFontStyle(t){const{font_bold:e,font_italic:i,font_strike:s,font_underline:n}=this.propTargets;t.fontWeight=gt.utils.hasClass(e,"on")?"bold":"",t.fontStyle=gt.utils.hasClass(i,"on")?"italic":"",t.textDecoration=((gt.utils.hasClass(s,"on")?"line-through ":"")+(gt.utils.hasClass(n,"on")?"underline":"")).trim()}_setBorderStyles(t,e,i){const{left:s,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!l.includes(t))),eo,i),gt.utils.setStyle(r.filter((t=>!o.includes(t))),to,i);break;case"horizon":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!l.includes(t))),eo,i);break;case"vertical":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!o.includes(t))),to,i);break;case"outside":gt.utils.setStyle(s,Jn,i),gt.utils.setStyle(n,Qn,i),gt.utils.setStyle(o,to,i),gt.utils.setStyle(l,eo,i);break;case"left":gt.utils.setStyle(s,Jn,i);break;case"top":gt.utils.setStyle(n,Qn,i);break;case"right":gt.utils.setStyle(o,to,i);break;case"bottom":gt.utils.setStyle(l,eo,i)}}_setMultiCells(t,e){const i=this._selectedTable.rows;if(this._deleteStyleSelectedCells(),gt.utils.addClass(t,"se-selected-table-cell"),t===e&&!this._shift)return;let s=!0,n=[],o=[];const l=this._ref={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,h=0,c=i.length;h<c;h++){r=i[h].cells,a=0;for(let i,c,d,u,p=0,g=r.length;p<g;p++){if(i=r[p],d=i.colSpan-1,u=i.rowSpan-1,c=p+a,n.length>0)for(let t,e=0;e<n.length;e++)t=n[e],t.row>h||(c>=t.index?(a+=t.cs,c+=t.cs,t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)):p===g-1&&(t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)));if(s){if(i!==t&&i!==e||(l.cs=null!==l.cs&&l.cs<c?l.cs:c,l.ce=null!==l.ce&&l.ce>c+d?l.ce:c+d,l.rs=null!==l.rs&&l.rs<h?l.rs:h,l.re=null!==l.re&&l.re>h+u?l.re:h+u,l._i+=1),2===l._i){s=!1,n=[],o=[],h=-1;break}}else if(mt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&mt.getOverlapRangeAtIndex(l.rs,l.re,h,h+u)){const t=l.cs<c?l.cs:c,e=l.ce>c+d?l.ce:c+d,s=l.rs<h?l.rs:h,r=l.re>h+u?l.re:h+u;if(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==r){l.cs=t,l.ce=e,l.rs=s,l.re=r,h=-1,n=[],o=[];break}gt.utils.addClass(i,"se-selected-table-cell")}u>0&&o.push({index:c,cs:d+1,rs:u,row:-1}),a+=i.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}}_resetTablePicker(){if(!this.tableHighlight)return;const t=this.tableHighlight.style,e=this.tableUnHighlight.style;t.width="1em",t.height="1em",e.width="10em",e.height="10em",gt.utils.changeTxt(this.tableDisplay,"1 x 1"),this.menu.dropdownOff()}_resetPropsAlign(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),i=t.querySelector('[data-value="right"]'),s=e.parentElement,n=i.parentElement;s.appendChild(i),n.appendChild(e)}_onColorPalette(t,e,i){this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,gt.utils.addClass(t,"on"),this.colorPicker.init(i?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}_closeController(){this.controller_table.close(),this.controller_cell.close()}_closeTableSelectInfo(){this.component.deselect(),this._closeController()}__hideResizeLine(){this._resizeLine&&(this._resizeLine.style.display="none",this._resizeLine=null)}__removeGlobalEvents(){this._toggleEditor(!0),this._resizing=!1,this.ui.disableBackWrapper(),this.__hideResizeLine(),this._resizeLinePrev&&(this._resizeLinePrev.style.display="none",this._resizeLinePrev=null);const t=this.__globalEvents;for(const e in t)t[e]&&(t[e]=this.eventManager.removeGlobalEvent(t[e]))}#q(t,e){const i=gt.utils.clone(t,!0),s=Array.from(t.querySelectorAll("td, th")),n=Array.from(i.querySelectorAll("td, th"));return{cloneTable:i,clonedSelectedCells:e.map((t=>{const e=s.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}#D(t,e){this.__s=e,this._shift||this._ref||this.__removeGlobalEvents(),this._shift=e,this._fixedCell=t,this._selectedCells?.length||(this._selectedCells=[t]),this._fixedCellName=t.nodeName,this._selectedTable=gt.query.getParentElement(t,"TABLE"),this._deleteStyleSelectedCells(),gt.utils.addClass(t,"se-selected-cell-focus"),e?(this.__globalEvents.shiftOff=this.eventManager.addGlobalEvent("keyup",this._bindShiftOff,!1),this.__globalEvents.on=this.eventManager.addGlobalEvent("mousedown",this._bindMultiOn,!1)):this.__globalEvents.on=this.eventManager.addGlobalEvent("mousemove",this._bindMultiOn,!1),this.__globalEvents.off=this.eventManager.addGlobalEvent("mouseup",this._bindMultiOff,!1),this.__globalEvents.touchOff=this.eventManager.addGlobalEvent("touchmove",this._bindTouchOff,!1)}#B(t){const e="vertical"===t,i=this._tdElement,s=this._trElements,n=this._trElement,o=this._logical_cellIndex,l=this._rowIndex,r=ao(i.nodeName);if(e){const t=i.colSpan;if(r.rowSpan=i.rowSpan,t>1)r.colSpan=Math.floor(t/2),i.colSpan=t-r.colSpan,n.insertBefore(r,i.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,h=this._rowCnt;a<h;a++){n=s[a].cells,r=0;for(let s,h,c,d,u=0,p=n.length;u<p;u++){if(s=n[u],h=s.colSpan-1,c=s.rowSpan-1,d=u+r,l.length>0)for(let t,e=0;e<l.length;e++)t=l[e],t.row>a||(d>=t.index?(r+=t.cs,d+=t.cs,t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)):u===p-1&&(t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)));if(d<=o&&c>0&&e.push({index:d,cs:h+1,rs:c,row:-1}),s!==i&&d<=o&&d+h>=o+t-1){s.colSpan+=1;break}if(d>o)break;r+=h}l=l.concat(e).sort((function(t,e){return t.index-e.index})),e=[]}n.insertBefore(r,i.nextElementSibling)}}else{const t=i.rowSpan;if(r.colSpan=i.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=gt.utils.getArrayIndex(s,n)+e;for(let t,e,i=0;i<a;i++){t=s[i].cells,e=0;for(let s,n,r,h=0,c=t.length;h<c&&(r=h+e,!(r>=o));h++)s=t[h],n=s.rowSpan-1,n>0&&n+i>=a&&r<o&&l.push({index:r,cs:s.colSpan}),e+=s.colSpan-1}const h=s[a],c=h.cells;let d=l.shift();for(let t,e,i,s,n=0,a=c.length,u=0;n<a;n++){if(i=n+u,t=c[n],e=t.colSpan-1,s=i+e+1,d&&s>=d.index&&(u+=d.cs,s+=d.cs,d=l.shift()),s>=o||n===a-1){h.insertBefore(r,t.nextElementSibling);break}u+=e}i.rowSpan=e}else{r.rowSpan=i.rowSpan;const t=gt.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=s[e].cells,0===t.length)return;for(let i=0,s=t.length;i<s;i++)e+t[i].rowSpan-1>=l&&(t[i].rowSpan+=1)}const e=this._physical_cellIndex,o=n.cells;for(let t=0,i=o.length;t<i;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#W(i),this._deleteStyleSelectedCells(),this.history.push(!1),this._setController(i),this._selectedCell=this._fixedCell=i,this._selectedCells?.length||(this._selectedCells=[i])}#I(t){switch(t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this._historyPush()}#V(t){switch(t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this._historyPush()}#F(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),i=Math.ceil(t.offsetY/18);e=e<1?1:e,i=i<1?1:i,this.options.get("_rtl")&&(this.tableHighlight.style.left=18*e-13+"px",e=11-e),this.tableHighlight.style.width=e+"em",this.tableHighlight.style.height=i+"em";const s=e<5?5:e>8?10:e+2,n=i<5?5:i>8?10:i+2;this.tableUnHighlight.style.width=s+"em",this.tableUnHighlight.style.height=n+"em",gt.utils.changeTxt(this.tableDisplay,e+" x "+i),this._tableXY=[e,i]}#P(){this.action()}#O(t){this.editor._preventBlur=!0;const e=gt.query.getParentElement(gt.query.getEventTarget(t),gt.check.isTableCell);if(this._shift){if(e===this._fixedCell)return this._shift=!1,this._deleteStyleSelectedCells(),this._toggleEditor(!0),void this.__removeGlobalEvents();this._toggleEditor(!1)}else if(!this._ref){if(e===this._fixedCell)return;this._toggleEditor(!1)}e&&e!==this._selectedCell&&this._fixedCellName===e.nodeName&&this._selectedTable===gt.query.getParentElement(e,"TABLE")&&this._setMultiCells(this._fixedCell,this._selectedCell=e)}#R(t){if(t.stopPropagation(),this._shift?this.__globalEvents.touchOff&&(this.__globalEvents.touchOff=this.eventManager.removeGlobalEvent(this.__globalEvents.touchOff)):(this._toggleEditor(!0),this.__removeGlobalEvents()),!this._fixedCell||!this._selectedTable)return;if(this._setMergeSplitButton(),this._selectedCells=Array.from(this._selectedTable.querySelectorAll(".se-selected-table-cell")),this._shift)return;this._fixedCell&&this._selectedCell&&(this.#W(this._fixedCell),this._fixedCell===this._selectedCell&>.utils.removeClass(this._fixedCell,"se-selected-table-cell"));const e=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this._setController(e)}#z(){if(this._ref){this.__removeGlobalEvents(),this._toggleEditor(!0),this.#W(this._fixedCell);const t=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this._setController(t)}else this._closeController()}#$(){this.close()}#W(t){dt.isMobile||this.editor.focusEdge(t)}}function no(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function oo(t,e){const i=t.clientX,s=mt.get(qn.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(i-n.left),l=o<=2;return{is:l||s-o<=2,isLeft:l,startX:i}}function lo(t,e){const i=t.clientY,s=mt.get(qn.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(s+n.top-i)<=5,startY:i}}function ro(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function ao(t){return t=t.toLowerCase(),gt.utils.createElement(t,null,"<div><br></div>")}function ho(t){this.propTargets.border_style.textContent=t,this._disableBorderProps(t===Xn[0]),this.selectMenu_props_border.close()}function co(t,e){const{border_format:i}=this.propTargets;i.setAttribute("se-border-format",e),i.firstElementChild.innerHTML=this.icons[jn[e]],e!==t?gt.utils.addClass(i,"active"):gt.utils.removeClass(i,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}function uo(t){this.controller_cell.bringToTop(t)}function po(t,e,i){const s=[];let n="";for(const o in jn){if(i.includes(o))continue;const l=jn[o];s.push(o),n+=`\n\t\t\t<button type="button" class="se-btn se-tooltip">\n\t\t\t\t${e[l]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t[l]}</span>\n\t\t\t\t</span>\n\t\t\t</button>`}return{items:s,menus:gt.utils.createElement("DIV",null,n).querySelectorAll("button")}}const go=so;class mo extends ii{static key="formatBlock";static type="dropdown";static className="se-btn-select se-btn-tool-format";constructor(t,e){super(t),this.title=this.lang.formats,this.inner='<span class="se-txt">'+this.lang.formats+"</span>"+this.icons.arrow_down;const i=function({lang:t},e){const i=["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],s=e&&0!==e.length?e:i;let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let e,o,l,r,a,h,c,d=0,u=s.length;d<u;d++)e=s[d],"string"==typeof e&&i.includes(e)?(o=e.toLowerCase(),l="blockquote"===o?"block":"pre"===o?"br-line":"line",a=/^h/.test(o)?o.match(/\d+/)[0]:"",r=t["tag_"+(a?"h":o)]+a,c="",h=""):(o=e.tag.toLowerCase(),l=e.command,r=e.name||o,c=e.class,h=c?' class="'+c+'"':""),n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${l}" data-value="${o}" data-class="${c}" title="${r}" aria-label="${r}">\n\t\t\t\t\t<${o}${h}>${r}</${o}>\n\t\t\t\t</button>\n\t\t\t</li>`;return n+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.formatList=i.querySelectorAll("li button"),this.currentFormat="",this.menu.initDropdownTarget(mo,i)}active(t,e){let i=this.lang.formats;const s=e.querySelector(".se-txt");if(t){if(this.format.isLine(t)){const e=this.formatList,n=t.nodeName.toLowerCase(),o=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let t,s=0,l=e.length;s<l;s++)if(t=e[s],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){i=t.title;break}return gt.utils.changeTxt(s,i),s.setAttribute("data-value",n),s.setAttribute("data-class",o),!0}}else gt.utils.changeTxt(s,i);return!1}on(t){const e=this.formatList,i=t.querySelector(".se-txt"),s=(i.getAttribute("data-value")||"")+(i.getAttribute("data-class")||"");if(s!==this.currentFormat){for(let t,i=0,n=e.length;i<n;i++)t=e[i],s===t.getAttribute("data-value")+t.getAttribute("data-class")?gt.utils.addClass(t,"active"):gt.utils.removeClass(t,"active");this.currentFormat=s}}action(t){const e=t.getAttribute("data-command"),i=t.firstElementChild;"block"===e?this.format.applyBlock(i):"br-line"===e?this.format.setBrLine(i):this.format.setLine(i),this.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],i=gt.utils.createElement(`H${e}`);this.format.setLine(i)}}const fo=mo;class _o extends ii{static key="layout";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.layout,this.icon="layout",this.selectedIndex=-1,this.items=e.items;const i=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');let e='\n\t<div class="se-dropdown se-list-inner">\n\t\t<ul class="se-list-basic">';for(let i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${s}" title="${i.name}" aria-label="${i.name}">\n\t\t\t\t\t${i.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(_o,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.html.set(i.html),this.menu.dropdownOff()}}const bo=_o;class yo extends ii{static key="lineHeight";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.lineHeight,this.icon="line_height";const i=function({lang:t},e){const i=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];let s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t(${t.default})\n\t\t\t\t</button>\n\t\t\t</li>`;for(let t,e=0,n=i.length;e<n;e++)t=i[e],s+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t.value}" title="${t.text}" aria-label="${t.text}">\n\t\t\t\t\t${t.text}\n\t\t\t\t</button>\n\t\t\t</li>`;return s+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(t,e.items);this.sizeList=i.querySelectorAll("li button"),this.currentSize=null,this.menu.initDropdownTarget(yo,i)}active(t,e){return this.format.isLine(t)&&t.style.lineHeight.length>0?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.format.getLine(this.selection.getNode()),e=t?t.style.lineHeight+"":"";if(e!==this.currentSize){const t=this.sizeList;for(let i=0,s=t.length;i<s;i++)e===t[i].getAttribute("data-command")?gt.utils.addClass(t[i],"active"):gt.utils.removeClass(t[i],"active");this.currentSize=e}}action(t){const e=t.getAttribute("data-command")||"",i=this.format.getLines();for(let t=0,s=i.length;t<s;t++)i[t].style.lineHeight=e;this.menu.dropdownOff(),this.editor.effectNode=null,this.history.push(!1)}}const vo=yo;class Co extends ii{static key="template";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.template,this.icon="template",this.selectedIndex=-1,this.items=e.items;const i=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');let e='<div class="se-dropdown se-list-inner"><ul class="se-list-basic">';for(let i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-value="${s}" \n\t\t\t\ttitle="${i.name}" \n\t\t\t\taria-label="${i.name}"\n\t\t\t>\n\t\t\t\t${i.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",gt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(Co,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.html.insert(i.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.menu.dropdownOff()}}const wo=Co;class xo extends ii{static key="paragraphStyle";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.paragraphStyle,this.icon="paragraph_style";const i=function({lang:t},e){const i={spaced:{name:t.menu_spaced,class:"__se__p-spaced",_class:""},bordered:{name:t.menu_bordered,class:"__se__p-bordered",_class:""},neon:{name:t.menu_neon,class:"__se__p-neon",_class:""}},s=e&&0!==e.length?e:["spaced","bordered","neon"];let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,o,l,r=0,a=s.length;r<a;r++){if(t=s[r],"string"==typeof t){const e=i[t.toLowerCase()];if(!e)continue;t=e}e=t.name,o=t.class?` class="${t.class}"`:"",l=t._class,n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${l?" "+l:""}" data-command="${t.class}" title="${e}" aria-label="${e}">\n\t\t\t\t\t<div${o}>${e}</div>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.classList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(xo,i)}on(){const t=this.classList,e=this.format.getLine(this.selection.getNode());for(let i=0,s=t.length;i<s;i++)gt.utils.hasClass(e,t[i].getAttribute("data-command"))?gt.utils.addClass(t[i],"active"):gt.utils.removeClass(t[i],"active")}action(t){const e=t.getAttribute("data-command");let i=this.format.getLines();if(0===i.length&&(this.selection.getRangeAndAddLine(this.selection.getRange(),null),i=this.format.getLines(),0===i.length))return;const s=gt.utils.hasClass(t,"active")?gt.utils.removeClass:gt.utils.addClass;for(let t=0,n=i.length;t<n;t++)s(i[t],e);this.menu.dropdownOff(),this.history.push(!1)}}const ko=xo;class Eo extends ii{static key="textStyle";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.textStyle,this.icon="text_style";const i=function({lang:t},e){const i={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},s=e||Object.keys(i);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,h=0,c=s.length;h<c;h++){if(t=s[h],l="",a="",r=[],"string"==typeof t){const e=i[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l+=` class="${t.class}"`,a+=`.${t.class.trim().replace(/\s+/g,",.")}`,r.push("class"),a=a.replace(/,$/,""),n+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-command="${e}" \n\t\t\t\tdata-value="${a}" \n\t\t\t\ttitle="${o}" \n\t\t\t\taria-label="${o}"\n\t\t\t>\n\t\t\t\t<${e}${l}>${o}</${e}>\n\t\t\t</button>\n\t\t</li>`}return n+="</ul></div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.styleList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(Eo,i)}on(){const t=this.styleList,e=this.selection.getNode();for(let i,s,n,o=0,l=t.length;o<l;o++){i=t[o],s=i.getAttribute("data-value").split(",");for(let t,o,l=0;l<s.length;l++){for(t=e,n=!1;t&&!this.format.isLine(t)&&!this.component.is(t);){if(t.nodeName.toLowerCase()===i.getAttribute("data-command").toLowerCase()&&(o=s[l],/^\./.test(o)?gt.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?gt.utils.addClass(i,"active"):gt.utils.removeClass(i,"active")}}action(t){const e=t.firstElementChild,i=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");i.pop();const s=e.classList;for(let t=0,e=s.length;t<e;t++)i.push("."+s[t]);const n=gt.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.format.applyInlineElement(n,{stylesToModify:i,nodesToRemove:o,strictRemove:!0}),this.menu.dropdownOff()}}const So=Eo,{NO_EVENT:To}=dt;const Ho=class extends ii{constructor(t,e,i){super(t.editor),this.openNewWindow=!!i.openNewWindow,this.relList=Array.isArray(i.relList)?i.relList:[],this.defaultRel=i.defaultRel||{},this.noAutoPrefix=!!i.noAutoPrefix,i.enableFileUpload&&(this.uploadUrl="string"==typeof i.uploadUrl?i.uploadUrl:null,this.uploadHeaders=i.uploadHeaders||null,this.uploadSizeLimit=mt.get(i.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=mt.get(i.uploadSingleSizeLimit,0)||null,this.input=gt.utils.createElement("input",{type:"file",accept:i.acceptedFormats||"*"}),this.eventManager.addEvent(this.input,"change",this.#E.bind(this)),this.fileManager=new Is(this,{query:"a[download]:not([data-se-file-download])",loadHandler:this.events.onFileLoad,eventHandler:this.events.onFileAction}));const s=function(t,e,i){const s=t.lang,n=t.icons,o=e.textToDisplay?"":'style="display: none;"',l=e.title?"":'style="display: none;"';let r=`\n\t\t<div class="se-modal-body">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${s.link_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input data-focus class="se-input-form se-input-url" type="text" placeholder="${t.options.get("protocol")||""}" />\n\t\t\t\t\t${e.enableFileUpload?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_upload_button" aria-label="${s.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(s.fileUpload)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t\t<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_bookmark_button" aria-label="${s.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${gt.utils.createTooltipInner(s.link_modal_bookmark)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div class="se-anchor-preview-form">\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">${n.bookmark}</span>\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">${n.download}</span>\n\t\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t\t</div>\n\t\t\t\t<label ${o}>${s.link_modal_text}</label>\n\t\t\t\t<input class="se-input-form _se_display_text" type="text" ${o} />\n\t\t\t\t<label ${l}>${s.title}</label>\n\t\t\t\t<input class="se-input-form _se_title" type="text" ${l} />\n\t\t\t</div>\n\t\t\t<div class="se-modal-form-footer">\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_check" /> ${s.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" /> ${s.link_modal_downloadLinkCheck}</label>`;i.length>0&&(r+=`\n\t\t\t<div class="se-anchor-rel">\n\t\t\t\t<button type="button" class="se-btn se-tooltip se-anchor-rel-btn" title="${s.link_modal_relAttribute}" aria-label="${s.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${gt.utils.createTooltipInner(s.link_modal_relAttribute)}\n\t\t\t\t</button>\n\t\t\t\t<div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div>\n\t\t\t</div>\n\t\t</div>`);return r+="</div></div>",gt.utils.createElement("DIV",null,r)}(t.editor,i,this.relList);if(this.kink=t.constructor.key||t.constructor.name,this.inst=t,this.modalForm=e,this.host=(this._w.location.origin+this._w.location.pathname).replace(/\/$/,""),this.urlInput=s.querySelector(".se-input-url"),this.displayInput=s.querySelector("._se_display_text"),this.titleInput=s.querySelector("._se_title"),this.newWindowCheck=s.querySelector("._se_anchor_check"),this.downloadCheck=s.querySelector("._se_anchor_download"),this.download=s.querySelector("._se_anchor_download_icon"),this.preview=s.querySelector(".se-link-preview"),this.bookmark=s.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=s.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this._change=!1,this._isRel=this.relList.length>0,this._isRel){this.relButton=s.querySelector(".se-anchor-rel-btn"),this.relPreview=s.querySelector(".se-anchor-rel-preview");const t=this.relList,e=(this.defaultRel.default||"").split(" "),i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],i.push(gt.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(e.includes(s)?" se-checked":""),"data-command":s,title:s,"aria-label":s},s+'<span class="se-svg">'+this.icons.checked+"</span>"));this.selectMenu_rel=new ci(this,{checkList:!0,position:"right-middle",dir:"ltr"}),this.selectMenu_rel.on(this.relButton,this.#U.bind(this)),this.selectMenu_rel.create(i),this.eventManager.addEvent(this.relButton,"click",this.#G.bind(this))}this.modalForm.querySelector(".se-anchor-editor").appendChild(s),this.selectMenu_bookmark=new ci(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_bookmark.on(this.urlInput,this.#Z.bind(this)),this.eventManager.addEvent(this.newWindowCheck,"change",this.#Y.bind(this)),this.eventManager.addEvent(this.downloadCheck,"change",this.#X.bind(this)),this.eventManager.addEvent(this.displayInput,"input",this.#j.bind(this)),this.eventManager.addEvent(this.urlInput,"input",this.#K.bind(this)),this.eventManager.addEvent(this.urlInput,"focus",this.#J.bind(this)),this.eventManager.addEvent(this.bookmarkButton,"click",this.#Q.bind(this)),this.eventManager.addEvent(s.querySelector("._se_upload_button"),"click",(()=>this.input.click()))}set(t){this.currentTarget=t}on(t){if(t){if(this.currentTarget){const t=this.currentTarget.href;this.linkValue=this.preview.textContent=this.urlInput.value=this._selfPathBookmark(t)?t.substring(t.lastIndexOf("#")):t,this.displayInput.value=this.currentTarget.textContent,this.titleInput.value=this.currentTarget.title,this.newWindowCheck.checked=!!/_blank/i.test(this.currentTarget.target),this.downloadCheck.checked=!!this.currentTarget.download}}else this.init(),this.displayInput.value=this.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this._setRel(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this._setLinkPreview(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,i=0===this.displayInput.value.length?e:this.displayInput.value,s=this.currentTarget||gt.utils.createElement("A");return this._updateAnchor(s,e,i,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",s}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this._change=!1,this._setRel(this.defaultRel.default||"")}_updateAnchor(t,e,i,s,n){!this._selfPathBookmark(e)&&this.downloadCheck.checked?t.setAttribute("download",i||e):t.removeAttribute("download"),this.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=this.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=e,s?t.title=s:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=i}_selfPathBookmark(t){const e=this._w.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}_setRel(t){if(!this._isRel)return;const e=this.currentRel=t?t.split(" "):[],i=this.selectMenu_rel.form.querySelectorAll("button");for(let t,s=0,n=i.length;s<n;s++)t=i[s].getAttribute("data-command"),e.includes(t)?gt.utils.addClass(i[s],"se-checked"):gt.utils.removeClass(i[s],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?gt.utils.addClass(this.relButton,"on"):gt.utils.removeClass(this.relButton,"on")}_createBookmarkList(t){const e=gt.query.getListChildren(this.editor.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||gt.check.isAnchor(t)&&!!t.id));if(0===e.length)return;const i=new RegExp(`^${t.replace(/^#/,"")}`,"i"),s=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],i.test(t.textContent)&&(s.push(t),n.push(gt.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===s.length?this.selectMenu_bookmark.close():(this.selectMenu_bookmark.create(s,n),this.selectMenu_bookmark.open(this.options.get("_rtl")?"bottom-right":""))}_setLinkPreview(t){const e=this.preview,i=this.options.get("defaultUrlProtocol"),s=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(i),o=!!i&&RegExp("^"+ut.escapeStringRegexp(t.substring(0,i.length))).test(i);t=this.linkValue=e.textContent=t?s?t:!i||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:i+t:"",this._selfPathBookmark(t)?(this.bookmark.style.display="block",gt.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active")),!this._selfPathBookmark(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}_relMerge(t){const e=this.currentRel;if(!t)return e.join(" ");if(/^only:/.test(t))return t=t.replace(/^only:/,"").trim(),this.currentRel=t.split(" "),t;const i=t.split(" ");for(let t=0,s=i.length;t<s;t++)e.includes(i[t])||e.push(i[t]);return e.join(" ")}_relDelete(t){if(!t)return this.currentRel.join(" ");/^only:/.test(t)&&(t=t.replace(/^only:/,"").trim());const e=this.currentRel.join(" ").replace(RegExp(t+"\\s*"),"");return this.currentRel=e.split(" "),e}_register(t){const e=t.result[0];this.linkValue=this.preview.textContent=this.urlInput.value=e.url,this.displayInput.value=e.name,this.downloadCheck.checked=!0,this.download.style.display="block"}async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===To?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}_uploadCallBack(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)}async#E(t){const e=gt.query.getEventTarget(t).files;if(!e[0])return;const i={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},s=async function(t,e){t=e||t;const i=await this.fileManager.asyncUpload(t.url,t.uploadHeaders,t.files);this._uploadCallBack(i)}.bind(this,i);this._uploadCallBack;const n=await this.triggerEvent("onFileUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),void(!0!==n&&n!==To||s(null)))}#G(){this.selectMenu_rel.open(this.options.get("_rtl")?"left-middle":"")}#Z(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this._setLinkPreview(this.urlInput.value),this.selectMenu_bookmark.close(),this.urlInput.focus()}#U(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.currentRel,s=i.indexOf(e);-1===s?i.push(e):i.splice(s,1),this.relPreview.title=this.relPreview.textContent=i.join(", ")}#j(t){const e=gt.query.getEventTarget(t);this._change=!!e.value.trim()}#K(t){const e=gt.query.getEventTarget(t).value.trim();this._setLinkPreview(e),this._selfPathBookmark(e)?this._createBookmarkList(e):this.selectMenu_bookmark.close()}#J(){const t=this.urlInput.value;this._selfPathBookmark(t)&&this._createBookmarkList(t)}#Q(){let t=this.urlInput.value;this._selfPathBookmark(t)?(t=t.substring(1),this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",gt.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this._createBookmarkList(t)),this.urlInput.value=t,this._setLinkPreview(t),this.urlInput.focus()}#Y(t){if("string"!=typeof this.defaultRel.check_new_window)return;gt.query.getEventTarget(t).checked?this._setRel(this._relMerge(this.defaultRel.check_new_window)):this._setRel(this._relDelete(this.defaultRel.check_new_window))}#X(t){gt.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this._setRel(this._relMerge(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this._setRel(this._relDelete(this.defaultRel.check_bookmark)))}},{_w:Lo}=dt,Mo={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const No=class extends Jt{constructor(t,e){super(t.editor),this.offset=this.editor.offset,this.ui=this.editor.ui,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=e,this.isUpdate=!1,this.focusElement=e.querySelector("[data-focus]"),this._modalArea=this.carrierWrapper.querySelector(".se-modal"),this._modalInner=this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this._closeListener=[this.#tt.bind(this),this.#et.bind(this)],this._bindClose=null,this._onClickEvent=null,this._closeSignal=!1,this._resizeBody=null,this._modalInner.appendChild(e),this.eventManager.addEvent(e.querySelector("form"),"submit",this.#i.bind(this)),this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(e.querySelector(".se-modal-resize-handle-w")||e.querySelector(".se-modal-resize-handle-h")||e.querySelector(".se-modal-resize-handle-c")||e.querySelector(".se-modal-resize-form"))&&!(this._resizeBody=e.querySelector(".se-modal-resize-form"))&&(this._resizeBody=e.querySelector(".se-modal-body"))&&(this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#it.bind(this,"w")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#it.bind(this,"h")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#it.bind(this,"c")),this._currentHandle=null,this.__resizeDir="",this.__offetTop=0,this.__offetLeft=0,this.__globalEventHandlers={mousemove:this.#st.bind(this),mouseup:this.#nt.bind(this)},this._bindClose_mousemove=null,this._bindClose_mouseup=null)}static CreateFileInput({icons:t,lang:e},{acceptedFormats:i,allowMultiple:s}){return`\n\t\t<div class="se-modal-form-files">\n\t\t\t<div class="se-flex-input-wrapper">\n\t\t\t\t<div class="se-input-form-abs">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${i}"${s?' multiple="multiple"':""}/>\n\t\t\t</div>\n\t\t\t<button type="button" class="se-btn se-modal-files-edge-button se-file-remove se-tooltip" aria-label="${e.remove}">\n\t\t\t\t${t.selection_remove}\n\t\t\t\t${gt.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const i=t.querySelector(".se-input-file-cnt"),s=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(s.style.display="none",n.style.display="inline-block",i.style.display="",i.textContent=` ..${e.length}`):e.length>0?(s.style.display="none",n.style.display="none",i.style.display="block",i.textContent=e[0].name):(s.style.display="inline-block",n.style.display="none",i.style.display="",i.textContent="")}open(){if(this.ui._offCurrentModal(),this._fixCurrentController(!0),this._closeSignal&&this._modalInner.addEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this.isUpdate=this.kind===this.editor.currentControllerName,this.editor.opendModal=this,this.isUpdate||"function"!=typeof this.inst.init||this.inst.init(),"function"==typeof this.inst.on&&this.inst.on(this.isUpdate),gt.utils.addClass(this._modalArea,"se-backdrop-show"),gt.utils.addClass(this.form,"se-modal-show"),this._resizeBody){const t=this._saveOffset(),{maxWidth:e,maxHeight:i}=Lo.getComputedStyle(this.form),s=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this._resizeBody.offsetHeight)}px`;e&&"string"==typeof this.__resizeDir&>.utils.setStyle(this._resizeBody,"max-width",`calc(${e} - ${s})`),i&>.utils.setStyle(this._resizeBody,"max-height",`calc(${i} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.__removeGlobalEvent(),this._fixCurrentController(!1),Lo.setTimeout((()=>{this.editor.opendModal=null}),0),this._closeSignal&&this._modalInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),gt.utils.removeClass(this._modalArea,"se-backdrop-show"),gt.utils.removeClass(this.form,"se-modal-show"),"function"==typeof this.inst.init&&this.inst.init(),"function"==typeof this.inst.off&&this.inst.off(this.isUpdate),this.editor.focus()}_fixCurrentController(t){const e=this.editor.opendControllers;for(let i=0;i<e.length;i++)e[i].fixed=t,e[i].form.style.display=t?"none":"block"}_saveOffset(){const t=this.offset.getGlobal(this._resizeBody);return this.__offetTop=t.top,this.__offetLeft=t.left,t}__addGlobalEvent(t){this.__removeGlobalEvent(),this.ui.enableBackWrapper(Mo[t]),this._bindClose_mousemove=this.eventManager.addGlobalEvent("mousemove",this.__globalEventHandlers.mousemove,!0),this._bindClose_mouseup=this.eventManager.addGlobalEvent("mouseup",this.__globalEventHandlers.mouseup,!0)}__removeGlobalEvent(){this.ui.disableBackWrapper(),this._bindClose_mousemove&&(this._bindClose_mousemove=this.eventManager.removeGlobalEvent(this._bindClose_mousemove)),this._bindClose_mouseup&&(this._bindClose_mouseup=this.eventManager.removeGlobalEvent(this._bindClose_mouseup))}async#i(t){t.preventDefault(),t.stopPropagation(),this.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.ui.hideLoading():void 0===t?this.close():(this.close(),this.ui.hideLoading())}catch(t){throw this.close(),this.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#et(t){const e=gt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._modalInner)&&this.close()}#tt(t){ft.isEsc(t.code)&&this.close()}#it(t,e){this._currentHandle=gt.query.getEventTarget(e),gt.utils.addClass(this._currentHandle,"active"),this.__addGlobalEvent(this.__resizeDir=t+(this.options.get("_rtl")?"RTL":""))}#st(t){switch(this.__resizeDir){case"w":case"wRTL":{const e=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.height=this._resizeBody.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.__offetLeft-this._resizeBody.offsetWidth;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px";break}case"hRTL":{const e=this.__offetLeft-t.clientX;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.__offetLeft-this._resizeBody.offsetWidth,i=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px",this._resizeBody.style.height=this._resizeBody.offsetHeight+i+"px";break}case"cRTL":{const e=this.__offetLeft-t.clientX,i=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px",this._resizeBody.style.height=this._resizeBody.offsetHeight+i+"px";break}}this._saveOffset(),"function"==typeof this.inst.modalResize&&this.inst.modalResize()}#nt(){gt.utils.removeClass(this._currentHandle,"active"),this._currentHandle=null,this.__removeGlobalEvent()}};const Ao=class extends ii{static key="link";static type="modal";static className="se-icon-flip-rtl";constructor(t,e){super(t),this.title=this.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const i=function({lang:t,icons:e}){const i=`\n\t<form>\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.link_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-anchor-editor"></div>\n\t\t<div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n\t\t</div>\n\t</form>`;return gt.utils.createElement("DIV",{class:"se-modal-content"},i)}(t),s=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<span><a target="_blank" href=""></a> </span>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip se-icon-flip-rtl">\n\t\t\t\t${e.unlink}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.unlink}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Ho(this,i,this.pluginOptions),this.modal=new No(this,i),this.controller=new hi(this,s,{position:"bottom",disabled:!1})}active(t){if(gt.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.controller.form.querySelector("a");return e.href=t.href,e.title=t.textContent,e.textContent=t.textContent,gt.utils.addClass(t,"on"),this.anchor.set(t),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}),!0}return this.controller.close(),!1}open(){this.modal.open()}on(t){this.isUpdateState=t,this.anchor.on(t)}modalAction(){const t=this.anchor.create(!1);if(null===t)return!1;if(this.isUpdateState){const t=this.controller.currentTarget.childNodes[0];this.selection.setRange(t,0,t,t.textContent.length)}else{const e=this.format.getLines();if(e.length>1){if(!this.html.insertNode(gt.utils.createElement(e[0].nodeName,null,t),{afterNode:null,skipCharCount:!1}))return!0}else if(!this.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!0;this.selection.setRange(t.childNodes[0],0,t.childNodes[0],t.textContent.length)}return!0}init(){this.controller.close(),this.anchor.init()}controllerAction(t){const e=t.getAttribute("data-command");if(/update/.test(e))this.modal.open();else if(/unlink/.test(e)){const t=gt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=gt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0);this.selection.setRange(t,0,e,e.textContent.length),this.format.applyInlineElement(null,{stylesToModify:null,nodesToRemove:["A"],strictRemove:!1})}else gt.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.editor.focus(),this.history.push(!1)}close(){gt.utils.removeClass(this.controller.currentTarget,"on")}},{NO_EVENT:Bo}=dt;class Io extends ii{static key="image";static type="modal";static className="";static component(t){const e=gt.check.isFigure(t)||/^span$/i.test(t.nodeName)&>.utils.hasClass(t,"se-component")?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:gt.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}constructor(t,e){super(t),this.title=this.lang.image,this.icon="image",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"auto",defaultHeight:e.defaultHeight?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"auto",percentageOnlySize:!!e.percentageOnlySize,createFileInput:void 0===e.createFileInput||e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"image/*":e.acceptedFormats.trim()||"image/*",useFormatType:e.useFormatType??!0,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){const n=s.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${No.CreateFileInput({icons:e,lang:t},s)}\n\t\t</div>`:"",o=s.createUrlInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${i.imageGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.imageGallery}">\n\t\t\t\t\t\t\t${e.image_gallery}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.imageGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n\t\t\t<pre class="se-link-preview"></pre>\n\t\t</div>`:"",l=s.canResize?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-size-text">\n\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t<label class="size-h">${t.height}</label>\n\t\t\t</div>\n\t\t\t<input class="se-input-control _se_size_x" placeholder="auto" type="text" />\n\t\t\t<label class="se-modal-size-x">x</label>\n\t\t\t<input type="text" class="se-input-control _se_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_check_proportion" checked/> ${t.proportion}</label>\n\t\t\t<button type="button" aria-label="${t.revert}" class="se-btn se-tooltip se-modal-btn-revert">\n\t\t\t\t${e.revert}\n\t\t\t\t${gt.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=s.useFormatType?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t<button type="button" data-command="asBlock" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_block}\n\t\t\t\t\t${gt.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="asInline" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t${gt.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>`:"",a=`\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t<span class="se-modal-title">${t.image_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-tabs">\n\t\t\t<button type="button" class="_se_tab_link active" data-tab-link="image">${t.image}</button>\n\t\t\t<button type="button" class="_se_tab_link" data-tab-link="url">${t.link}</button>\n\t\t</div>\n\t\t<form method="post" enctype="multipart/form-data">\n\t\t\t<div class="_se_tab_content _se_tab_content_image">\n\t\t\t\t<div class="se-modal-body">\n\t\t\t\t\t${n}\n\t\t\t\t\t${o}\n\t\t\t\t\t<div style="border-bottom: 1px dashed #ccc;"></div>\n\t\t\t\t\t<div class="se-modal-form">\n\t\t\t\t\t\t<label>${t.image_modal_altText}</label><input class="se-input-form _se_image_alt" type="text" />\n\t\t\t\t\t</div>\n\t\t\t\t\t${l}\n\t\t\t\t\t${r}\n\t\t\t\t\t<div class="se-modal-form se-modal-form-footer">\n\t\t\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_check_caption" /> ${t.caption}</label>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-anchor-editor _se_tab_content _se_tab_content_url" style="display: none;">\n\t\t\t</div>\n\t\t\t<div class="se-modal-footer">\n\t\t\t\t<div class="se-figure-align">\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t\t</div>\n\t\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t\t</div>\n\t\t</form>`,h=gt.utils.createElement("DIV",{class:"se-modal-content"},a);return{html:h,alignForm:h.querySelector(".se-figure-align"),fileModalWrapper:h.querySelector(".se-flex-input-wrapper"),imgInputFile:h.querySelector(".__se__file_input"),imgUrlFile:h.querySelector(".se-input-url"),altText:h.querySelector("._se_image_alt"),captionCheckEl:h.querySelector("._se_image_check_caption"),previewSrc:h.querySelector("._se_tab_content_image .se-link-preview"),tabs:h.querySelector(".se-modal-tabs"),galleryButton:h.querySelector(".__se__gallery"),proportion:h.querySelector("._se_check_proportion"),inputX:h.querySelector("._se_size_x"),inputY:h.querySelector("._se_size_y"),revertBtn:h.querySelector(".se-modal-btn-revert"),asBlock:h.querySelector('[data-command="asBlock"]'),asInline:h.querySelector('[data-command="asInline"]'),fileRemoveBtn:h.querySelector(".se-file-remove")}}(t,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||!this.pluginOptions.canResize?[[n,"mirror_h","mirror_v","align","caption","edit","revert","copy","remove"]]:[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["align","caption","edit","revert","copy","remove"]];this.alignForm=s.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.plugins.link?this.plugins.link.pluginOptions:{};this.anchor=new Ho(this,s.html,{textToDisplay:!1,title:!0,openNewWindow:l.openNewWindow,relList:l.relList,defaultRel:l.defaultRel,noAutoPrefix:l.noAutoPrefix,enableFileUpload:e.linkEnableFileUpload}),this.modal=new No(this,s.html),this.figure=new yi(this,o,{sizeUnit:i}),this.fileManager=new Is(this,{query:"img",loadHandler:this.events.onImageLoad,eventHandler:this.events.onImageAction}),this.fileModalWrapper=s.fileModalWrapper,this.imgInputFile=s.imgInputFile,this.imgUrlFile=s.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=s.altText,this.captionCheckEl=s.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.as="block",this.proportion=null,this.inputX=null,this.inputY=null,this._linkElement=null,this._linkValue="",this._align="none",this._svgDefaultSize="30%",this._base64RenderIndex=0,this._element=null,this._cover=null,this._container=null,this._caption=null,this._ratio={w:1,h:1},this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.eventManager.addEvent(s.tabs,"click",this.#ot.bind(this)),this.imgInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#lt.bind(this)),this.imgUrlFile&&this.eventManager.addEvent(this.imgUrlFile,"input",this.#rt.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.eventManager.addEvent(this.imgInputFile,"change",this.#at.bind(this));const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#ht.bind(this)),this._resizing){this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#ct.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this))}this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=s.asBlock,this.asInline=s.asInline,this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#pt.bind(this)))}open(){this.modal.open()}edit(){this.modal.open()}on(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this._resizing&&(this.inputX.value=this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}onFilePasteAndDrop({file:t}){if(/^image/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){return this._align=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this._update(this.inputX?.value,this.inputY?.value),this.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this._linkValue.length>0)&&await this.submitURL(this._linkValue)}retainFormat(){return{query:"img",method:t=>{const e=yi.GetContainer(t);e&&e.container&&e.cover||(this._ready(t),this._fileCheck(this._origin_w,this._origin_h))}}}init(){No.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.altText.value="",this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,this.captionCheckEl.checked=!1,this._element=null,this._ratio={w:1,h:1},this.#ot("init"),this._resizing&&(this.inputX.value="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.checked=!0),this.pluginOptions.useFormatType&&this._activeAsInline("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.anchor.init()}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this.anchor.set(gt.check.isAnchor(t.parentNode)?t.parentNode:null),this._linkElement=this.anchor.currentTarget,this._element=t,this._cover=e.cover,this._container=e.container,this._caption=e.caption,this._align=e.align,t.style.float="",this._origin_w=String(e.originWidth||e.w||""),this._origin_h=String(e.originHeight||e.h||""),this.altText.value=this._element.alt,this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=this._element.src);if((this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this._caption,!this._resizing)return;const i=this._onlyPercentage&&this.figure.isVertical;let s=i?"":e.width;if(this._onlyPercentage&&(s=mt.get(s,2),s>100&&(s=100)),this.inputX.value=String("auto"===s?"":s),!this._onlyPercentage){const t=i?"":e.height;this.inputY.value=String("auto"===t?"":t)}this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1},this.pluginOptions.useFormatType&&this._activeAsInline(this.component.isInline(e.container))}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,yi.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onImageDeleteBefore",{element:e,container:i,align:this._align,alt:this.altText.value,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}_getInfo(){return{element:this._element,anchor:this.anchor.create(!0),inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,alt:this.altText.value}}_activeAsInline(t){t?(gt.utils.addClass(this.asInline,"on"),gt.utils.removeClass(this.asBlock,"on"),this.as="inline",this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(gt.utils.addClass(this.asBlock,"on"),gt.utils.removeClass(this.asInline,"on"),this.as="block",this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/image/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onImageUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Bo?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+n/1e3+"KB",i=await this.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Bo?t:i||t,"error"),!1}const l={files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l);this._serverUpload;const a=await this.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Bo||r(null)))}async submitURL(t){if(t||(t=this._linkValue),!t)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,...this._getInfo()},s=function(t,e){const i=(t=e||t).url;this.modal.isUpdate?this._updateSrc(i,t.element,t.files):this._produce(i,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt)}.bind(this,i),n=await this.triggerEvent("onImageUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==Bo||s(null),!0)}_update(t,e){t||(t=this.inputX?.value||"auto"),e||(e=this.inputY?.value||"auto");let i=this._element;const s=this._cover,n=this._container===this._cover?null:this._container;let o;const l=mt.is(t)?t+this.sizeUnit:t,r=mt.is(e)?e+this.sizeUnit:e;o=/%$/.test(i.style.width)?l!==n.style.width||r!==n.style.height:l!==i.style.width||r!==i.style.height,i.alt=this.altText.value;let a=!1;this.captionCheckEl.checked?this._caption||(this._caption=yi.CreateCaption(s,this.lang.caption),a=!0):this._caption&&(gt.utils.removeItem(this._caption),this._caption=null,a=!0);let h=!1;const c=this.anchor.create(!0);if(c)this._linkElement===c&&n.contains(c)||(this._linkElement=c.cloneNode(!1),s.insertBefore(this._setAnchor(i,this._linkElement),this._caption),h=!0);else if(null!==this._linkElement&&s.contains(this._linkElement)){const t=i.cloneNode(!0);s.removeChild(this._linkElement),s.insertBefore(t,this._caption),i=t}this._resizing&&o&&this._applySize(t,e),h&>.utils.removeItem(c),(a||!this._onlyPercentage&&o)&&(/\d+/.test(i.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(i):this.figure.setTransform(i,t,e,0)),this.figure.setAlign(i,this._align),i.onload=()=>{this.select(i)}}_fileCheck(t,e){t||(t=this.inputX?.value||"auto"),e||(e=this.inputY?.value||"auto");let i,s=this._element,n=this._cover,o=null,l=this._container===this._cover?null:this._container,r=!1;if(!n||!l){r=!0,s=this._element.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this._element.parentElement?.nodeName)||this.format.isLine(this._element.parentElement))?yi.CreateInlineContainer(s,"se-image-container"):yi.CreateContainer(s,"se-image-container");n=e.cover,l=e.container,o=e.inlineCover,this.figure.open(s,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0})}const a=mt.is(t)?t+this.sizeUnit:t,h=mt.is(e)?e+this.sizeUnit:e;i=/%$/.test(s.style.width)?a!==l.style.width||h!==l.style.height:a!==s.style.width||h!==s.style.height,s.alt=this.altText.value;let c=!1;o||(this.captionCheckEl.checked?this._caption&&!r||(this._caption=yi.CreateCaption(n,this.lang.caption),c=!0):this._caption&&(gt.utils.removeItem(this._caption),this._caption=null,c=!0));let d=null;const u=this.anchor.create(!0);if(u)(this._linkElement!==u||r&&!l.contains(u))&&(this._linkElement=u.cloneNode(!1),n.insertBefore(this._setAnchor(s,this._linkElement),this._caption),d=this._element);else if(null!==this._linkElement&&n.contains(this._linkElement)){const t=s.cloneNode(!0);n.removeChild(this._linkElement),n.insertBefore(t,this._caption),s=t}r&&(s=this._element,this.figure.retainFigureFormat(l,this._element,d?u:null,this.fileManager),this._element=s=l.querySelector("img"),this._cover=n,this._container=l),this._resizing&&i&&this._applySize(t,e),d&&(r?(gt.utils.removeItem(d),0===gt.query.getListChildren(u,(t=>/IMG/i.test(t.tagName))).length&>.utils.removeItem(u)):gt.utils.removeItem(u)),(c||!this._onlyPercentage&&i)&&(/\d+/.test(s.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(s):this.figure.setTransform(s,t,e,0)),this.figure.setAlign(s,this._align)}#ot(t){const e=this.modal.form,i="string"==typeof t?e.querySelector("._se_tab_link"):gt.query.getEventTarget(t);if(!/^BUTTON$/i.test(i.tagName))return!1;const s=i.getAttribute("data-tab-link");let n;const o=e.getElementsByClassName("_se_tab_content");for(n=0;n<o.length;n++)o[n].style.display="none";const l=e.getElementsByClassName("_se_tab_link");for(n=0;n<l.length;n++)gt.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+s).style.display="block",gt.utils.addClass(i,"active"),"init"!==t&&("image"===s?this.focusElement.focus():"url"===s&&this.anchor.urlInput.focus()),!1}_produce(t,e,i,s,n,o,l){"inline"!==this.as?this.create(t,e,i,s,n,o,l):this.createInline(t,e,i,s,o,l)}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t)&&(t+="%"):t="100%"),this.figure.setSize(t,e)}create(t,e,i,s,n,o,l){const r=gt.utils.createElement("IMG");r.src=t,r.alt=l,e=this._setAnchor(r,e?e.cloneNode(!1):null);const a=yi.CreateContainer(e,"se-image-container"),h=a.cover,c=a.container;this.captionCheckEl.checked&&(this._caption=yi.CreateCaption(h,this.lang.caption)),this._element=r,this._cover=h,this._container=c,this.figure.open(r,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),this._applySize(i,s),this.figure.setAlign(r,n),this.fileManager.setFileData(r,o),r.onload=this.#gt.bind(this,r,this._svgDefaultSize,c),this.component.insert(c,{skipCharCount:!1,skipSelection:!this.options.get("componentAutoSelect"),skipHistory:!1})}createInline(t,e,i,s,n,o){const l=gt.utils.createElement("IMG");l.src=t,l.alt=o,e=this._setAnchor(l,e?e.cloneNode(!1):null);const r=yi.CreateInlineContainer(e,"se-image-container").container;this._element=l,this._container=r,this.figure.open(l,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),this._applySize(i,s),this.fileManager.setFileData(l,n),l.onload=this.#gt.bind(this,l,this._svgDefaultSize,r),this.component.insert(r,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}_updateSrc(t,e,i){e.src=t,this.fileManager.setFileData(e,i),this.component.select(e,Io.key)}_register(t,e){const i=e.result;for(let e,s=0,n=i.length;s<n;s++){if(e={name:i[s].name,size:i[s].size},t.isUpdate){this._updateSrc(i[s].url,t.element,e);break}this._produce(i[s].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt)}}_serverUpload(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0?this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#mt.bind(this,t),this._error.bind(this)):this._setBase64(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.alt,t.isUpdate)}_setBase64(t,e,i,s,n,o,l){try{const r=this.modal.isUpdate?1:t.length;if(0===r)return this.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=r;const a=new Array(r);this._resizing&&(this.inputX.value=i,this.inputY.value=s);for(let h,c,d=0;d<r;d++)h=new FileReader,c=t[d],h.onload=function(t,l,r,h,c){a[c]={result:t.result,file:h},0==--this._base64RenderIndex&&(this._onRenderBase64(l,a,r,e,i,s,n,o),this.ui.hideLoading())}.bind(this,h,l,this._element,c,d),this._onRenderBase64,h.readAsDataURL(c)}catch(t){throw this.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}_onRenderBase64(t,e,i,s,n,o,l,r){for(let a=0,h=e.length;a<h;a++)t?this._updateSrc(e[a].result,i,e[a].file):this._produce(e[a].result,s,n,o,l,e[a].file,r)}_setAnchor(t,e){return e?(e.appendChild(t),e):t}async _error(t){const e=await this.triggerEvent("onImageUploadError",{error:t}),i=e===Bo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.image.error]",i)}async#mt(t,e){if(await this.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===Bo){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#lt(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#dt(t,e){if(ft.isSpace(e.code))e.preventDefault();else if("x"===t&&this._onlyPercentage&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=yi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}#ct(){this._ratio=this.proportion.checked?yi.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#pt({target:t}){this._activeAsInline("asInline"===t.getAttribute("data-command"))}#rt(t){const e=t.target.value.trim();this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#at({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,t.files)}#ht(){this.plugins.imageGallery.open(this.#ft.bind(this))}#ft(t){this.altText.value=t.getAttribute("data-value")||t.alt,this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#gt(t,e,i){if(0===t.offsetWidth&&this._applySize(e,""),this.options.get("componentAutoSelect"))this.component.select(t,Io.key);else if(this.component.isInline(i)){const e=this.selection.getNearRange(i);e?this.selection.setRange(e.container,e.offset,e.container,e.offset):this.component.select(t,Io.key)}else{const t=this.format.addLine(i,null);t&&this.selection.setRange(t,0,t,0)}this.editor._iframeAutoHeight(this.editor.frameContext),this.history.push(!1),delete t.onload}}const Vo=Io,{NO_EVENT:Oo}=dt;class Ro extends ii{static key="video";static type="modal";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.checkContentType(t.src)?t:null}constructor(t,e){super(t),this.title=this.lang.video,this.icon="video",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&mt.get(e.defaultWidth,0)?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&mt.get(e.defaultHeight,0)?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:mt.get(e.defaultRatio,4)||.5625,showRatioOption:void 0===e.showRatioOption||!!e.showRatioOption,ratioOptions:e.ratioOptions?e.ratioOptions:null,videoTagAttributes:e.videoTagAttributes||null,iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||""};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){let n=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;s.createFileInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_file}</label>\n\t\t\t\t${No.CreateFileInput({lang:t,icons:e},s)}\n\t\t\t</div>`);s.createUrlInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input class="se-input-form se-input-url" type="text" data-focus />\n\t\t\t\t\t${i.videoGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.videoGallery}">\n\t\t\t\t\t\t\t\t${e.video_gallery}\n\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.videoGallery)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t</div>\n\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t</div>`);if(s.canResize){const i=s.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=s.defaultRatio,l=s.percentageOnlySize,r=l?' style="display: none !important;"':"",a=s.showHeightInput?"":' style="display: none !important;"',h=s.showRatioOption?"":' style="display: none !important;"',c=l||s.showHeightInput||s.showRatioOption?"":' style="display: none !important;"';n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${a}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${h}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="100%"${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${c}>${l?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="${100*s.defaultRatio}%"\n\t\t\t\t${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}${a}/>\n\t\t\t\t<select class="se-input-select se-modal-ratio" title="${t.ratio}" aria-label="${t.ratio}"${h}>\n\t\t\t\t\t${a?"":'<option value=""> - </option>'} \n\t\t\t\t\t${i.map((t=>`<option value="${t.value}"${o.toString()===t.value.toString()?" selected":""}>${t.name}</option>`)).join("")}\n\t\t\t\t</select>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${r}${c}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}n+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const o=gt.utils.createElement("DIV",{class:"se-modal-content"},n);return{html:o,alignForm:o.querySelector(".se-figure-align"),fileModalWrapper:o.querySelector(".se-flex-input-wrapper"),videoInputFile:o.querySelector(".__se__file_input"),videoUrlFile:o.querySelector(".se-input-url"),previewSrc:o.querySelector(".se-link-preview"),galleryButton:o.querySelector(".__se__gallery"),proportion:o.querySelector("._se_check_proportion"),frameRatioOption:o.querySelector(".se-modal-ratio"),inputX:o.querySelector("._se_size_x"),inputY:o.querySelector("._se_size_y"),revertBtn:o.querySelector(".se-modal-btn-revert"),fileRemoveBtn:o.querySelector(".se-file-remove")}}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["align","edit","copy","remove"]]:[["resize_auto,75,50","align","edit","revert","copy","remove"]];n.some((t=>t.includes("align")))||(s.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new No(this,s.html),this.figure=new yi(this,n,{sizeUnit:i,autoRatio:{current:o,default:o}}),this.fileManager=new Is(this,{query:"iframe, video",loadHandler:this.events.onVideoLoad,eventHandler:this.events.onVideoAction}),this.fileModalWrapper=s.fileModalWrapper,this.videoInputFile=s.videoInputFile,this.videoUrlFile=s.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=s.previewSrc,this._linkValue="",this._align="none",this._frameRatio=o,this._defaultRatio=o,this._defaultSizeX="100%",this._defaultSizeY=100*this.pluginOptions.defaultRatio+"%",this.sizeUnit=i,this.proportion=null,this.frameRatioOption=null,this.inputX=null,this.inputY=null,this._element=null,this._cover=null,this._container=null,this._ratio={w:1,h:1},this._origin_w="100%"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h=this.pluginOptions.defaultHeight===o?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),pt.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),pt.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);this.extensions=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"].concat(this.pluginOptions.extensions||[]),this.urlPatterns=l.concat([/youtu\.?be/,/vimeo\.com\//,/dailymotion\.com\/video\//,/facebook\.com\/.+\/videos\//,/facebook\.com\/watch\/\?v=/,/twitter\.com\/.+\/status\//,/twitch\.tv\/videos\//,/twitch\.tv\/[^/]+$/,/tiktok\.com\/@[^/]+\/video\//,/instagram\.com\/p\//,/instagram\.com\/tv\//,/instagram\.com\/reel\//,/linkedin\.com\/posts\//,/\.(wistia\.com|wi\.st)\/(medias|embed)\//,/loom\.com\/share\//]).concat(e.urlPatterns||[]);const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#ht.bind(this)),this.videoInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#lt.bind(this)),this.videoUrlFile&&this.eventManager.addEvent(this.videoUrlFile,"input",this.#rt.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.eventManager.addEvent(this.videoInputFile,"change",this.#at.bind(this)),this._resizing){this.proportion=s.proportion,this.frameRatioOption=s.frameRatioOption,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#ct.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(this.frameRatioOption,"change",this.#_t.bind(this)),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this))}}open(){this.modal.open()}edit(){this.modal.open()}on(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):(this._resizing&&(this.inputX.value=this._origin_w=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0),this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple")),this._resizing&&this._setRatioSelect(this._origin_h||this._defaultRatio)}onFilePasteAndDrop({file:t}){if(/^video/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){this._align=this.modal.form.querySelector('input[name="suneditor_video_radio"]:checked').value;let t=!1;return this.videoInputFile&&this.videoInputFile.files.length>0?t=await this.submitFile(this.videoInputFile.files):this.videoUrlFile&&this._linkValue.length>0&&(t=await this.submitURL(this._linkValue)),t&&this._w.setTimeout(this.component.select.bind(this.component,this._element,Ro.key),0),t}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!this.checkContentType(t.src))return;const e=yi.GetContainer(t);if(e&&e.container&&e.cover)return;this._ready(t);const i=this.format.getLine(t);i&&(this._align=i.style.textAlign||i.style.float),this._update(t)}}}init(){No.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,this._ratio={w:1,h:1},this._nonResizing=!1,this._resizing&&(this.inputX.value=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0,this._setRatioSelect(this._defaultRatio))}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this._element=t,this._cover=e.cover,this._container=e.container,this._align=e.align,t.style.float="",this._origin_w=String(e.width||e.originWidth||e.w||""),this._origin_h=String(e.height||e.originHeight||e.h||"");let i=e.width||e.w||this._origin_w||"";const s=e.height||e.h||this._origin_h||"";this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=this._element.src||this._element.querySelector("source")?.src||"");if((this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,!this._resizing)return;const n=this._onlyPercentage&&this.figure.isVertical;if(this._onlyPercentage&&(i=mt.get(i,2),i>100&&(i=100)),this.inputX.value=String("auto"===i?"":i),!this._onlyPercentage){const t=n?"":e.height;this.inputY.value=String("auto"===t?"":t)}this._setRatioSelect(s)||(this.inputY.value=String(this._onlyPercentage?mt.get(s,2):s)),this.proportion.checked=!0,this.inputX.disabled=!!n,this.inputY.disabled=!!n,this.proportion.disabled=!!n,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1}}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,yi.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onVideoDeleteBefore",{element:e,container:i,align:this._align,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!(!this.extensions.some((e=>t.endsWith(e)))&&!this.urlPatterns.some((e=>e.test(t))))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}convertUrlYoutube(t){return/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t}convertUrlVimeo(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1)}addQuery(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t}create(t,e,i,s,n,o,l){let r=null,a=null;if(o){if((t=this._element).src!==e){const i=this.findProcessUrl(e);if(/^iframe$/i.test(i?.tag)&&!/^iframe$/i.test(t.nodeName)){const i=this.createIframeTag();i.src=e,t.replaceWith(i),this._element=t=i}else if(/^video$/i.test(i?.tag)&&!/^video$/i.test(t.nodeName)){const i=this.createVideoTag();i.src=e,t.replaceWith(i),this._element=t=i}else t.src=e}a=this._container,r=gt.query.getParentElement(t,"FIGURE")}else{t.src=e,this._element=t;const i=yi.CreateContainer(t,"se-video-container");r=i.cover,a=i.container}this._element=t,this._cover=r,this._container=a,this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),i=i||this._defaultSizeX,s=s||this._frameRatio;const h=this.figure.getSize(t),c=h.w!==i||h.h!==s,d=!o||c;if(d&&this._applySize(i,s),this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o)this._resizing&&d&&this.figure.isVertical&&this.figure.setTransform(t,i,s,0),this.history.push(!1);else if(this.component.insert(a,{skipCharCount:!1,skipSelection:!0,skipHistory:!1}),!this.options.get("componentAutoSelect")){const t=this.format.addLine(a,null);t&&this.selection.setRange(t,0,t,0)}}createIframeTag(t){const e=gt.utils.createElement("IFRAME");if(t)for(const i in t)e[i]=t[i];return this._setIframeAttrs(e),e}createVideoTag(t){const e=gt.utils.createElement("VIDEO");if(t)for(const i in t)e[i]=t[i];return this._setTagAttrs(e),e}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}_getInfo(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,element:this._element}}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/video/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Oo?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+n/1e3+"KB",i=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Oo?t:i||t,"error"),!1}const l={url:null,files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l);this._serverUpload;const a=await this.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Oo||r(null)))}async submitURL(t){if(t||(t=this._linkValue),!t)return!1;if(/^<iframe.*\/iframe>$/.test(t)){if(0===(t=(new DOMParser).parseFromString(t,"text/html").querySelector("iframe").src).length)return!1}const e=this.findProcessUrl(t);e&&(t=e.url);const i={name:t.split("/").pop(),size:0},s={url:t,files:i,...this._getInfo(),process:e},n=function(t,e){t=e||t,this.create(this[/^iframe$/i.test(t.process?.tag)?"createIframeTag":"createVideoTag"](),t.url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,t.files)}.bind(this,s),o=await this.triggerEvent("onVideoUploadBefore",{info:s,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==Oo||n(null),!0)}_update(t){if(!t)return;/^video$/i.test(t.nodeName)?this._setTagAttrs(t):/^iframe$/i.test(t.nodeName)&&this._setIframeAttrs(t);let e=this.format.isBlock(t.parentNode)||gt.check.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t,s=t.cloneNode(!0),n=yi.CreateContainer(s,"se-video-container").container,o=e.querySelector("figcaption");let l=null;o&&(l=gt.utils.createElement("DIV"),l.innerHTML=o.innerHTML,gt.utils.removeItem(o)),this.figure.open(s,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const r=(s.getAttribute("data-se-size")||",").split(",");this._applySize(r[0]||i.style.width||i.width||"",r[1]||i.style.height||i.height||"");const a=this.format.getLine(i);if(a&&(this._align=a.style.textAlign||a.style.float),this.figure.setAlign(s,this._align),gt.query.getParentElement(i,gt.check.isExcludeFormat))i.replaceWith(n);else if(gt.check.isListCell(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(n,t),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLine(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(n,e),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.replaceWith(n);return l&&e.parentNode.insertBefore(l,n.nextElementSibling),s}_register(t,e){const i=e.result,s=this.createVideoTag();for(let e=0,n=i.length;e<n;e++){const n=t.isUpdate?t.element:s.cloneNode(!1);this.create(n,i[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:i[e].name,size:i[e].size})}}_serverUpload(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0&&this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#mt.bind(this,t),this._error.bind(this))}_setTagAttrs(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_setIframeAttrs(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_setRatioSelect(t){let e=!1;const i=this.frameRatioOption.options;/%$/.test(t+"")||this._onlyPercentage?t=mt.get(t,2)/100+"":(!mt.is(t)||Number(t)>=1)&&(t=""),this.inputY.placeholder="";for(let s=0,n=i.length;s<n;s++)i[s].value===t?(e=i[s].selected=!0,this.inputY.placeholder=t?100*Number(t)+"%":""):i[s].selected=!1;return e}async _error(t){const e=await this.triggerEvent("onVideoUploadError",{error:t}),i=e===Oo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#mt(t,e){if(await this.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Oo){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#lt(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#rt(t){const e=gt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this._linkValue=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ht(){this.plugins.videoGallery.open(this.#ft.bind(this))}#ft(t){this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#at(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=gt.query.getEventTarget(t);No.OnChangeFile(this.fileModalWrapper,e.files)}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#_t(t){const e=gt.query.getEventTarget(t),i=e.options[e.selectedIndex].value;this._defaultSizeY=this.figure.autoRatio.current=this._frameRatio=i?100*Number(i)+"%":this._defaultSizeY,this.inputY.placeholder=i?100*Number(i)+"%":"",this.inputY.value=""}#ct(){this._ratio=this.proportion.checked?yi.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}#dt(t,e){if(ft.isSpace(e.code))return void e.preventDefault();const i=gt.query.getEventTarget(e);if("x"===t&&this._onlyPercentage&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=yi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}"y"===t&&this._setRatioSelect(i.value||this._defaultRatio)}}const zo=Ro,{NO_EVENT:$o,ON_OVER_COMPONENT:Fo}=dt;class Po extends ii{static key="audio";static type="modal";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"audio/*":e.acceptedFormats.trim()||"audio/*",audioTagAttributes:e.audioTagAttributes||null};const i=function({lang:t,icons:e,plugins:i},s){let n=`\n <form method="post" enctype="multipart/form-data">\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.audio_modal_title}</span>\n </div>\n <div class="se-modal-body">`;s.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${No.CreateFileInput({lang:t,icons:e},s)}\n </div>`);s.createUrlInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${i.audioGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.audioGallery}">\n\t\t\t\t\t\t\t${e.audio_gallery}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.audioGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n <pre class="se-link-preview"></pre>\n </div>`);return n+=`\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,gt.utils.createElement("DIV",{class:"se-modal-content"},n)}(t,this.pluginOptions),s=function({lang:t,icons:e}){const i=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return gt.utils.createElement("DIV",{class:"se-controller"},i)}(t);this.modal=new No(this,i),this.controller=new hi(this,s,{position:"bottom",disabled:!0}),this.fileManager=new Is(this,{query:"audio",loadHandler:this.events.onAudioLoad,eventHandler:this.events.onAudioAction}),this.figure=new yi(this,null,{}),this.fileModalWrapper=i.querySelector(".se-flex-input-wrapper"),this.audioInputFile=i.querySelector(".__se__file_input"),this.audioUrlFile=i.querySelector(".se-input-url"),this.preview=i.querySelector(".se-link-preview"),this._element=null,this.defaultWidth=this.pluginOptions.defaultWidth,this.defaultHeight=this.pluginOptions.defaultHeight,this.urlValue="";const n=i.querySelector(".__se__gallery");n&&this.eventManager.addEvent(n,"click",this.#ht.bind(this)),this.audioInputFile&&(this.eventManager.addEvent(i.querySelector(".se-modal-files-edge-button"),"click",this.#lt.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.eventManager.addEvent(this.audioInputFile,"change",this.#bt.bind(this))),this.audioUrlFile&&this.eventManager.addEvent(this.audioUrlFile,"input",this.#rt.bind(this))}open(){this.modal.open()}on(t){t?this._element?(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src,this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple")):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple"):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.setAttribute("multiple","multiple")}onFilePasteAndDrop({file:t}){if(/^audio/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?await this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.urlValue.length>0)&&await this.submitURL(this.urlValue)}init(){No.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration="")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src),this.open();break;case"copy":{const t=yi.GetContainer(this._element);this.component.copy(t.container);break}case"delete":this.destroy()}}retainFormat(){return{query:"audio",method:t=>{const e=yi.GetContainer(t);if(e&&e.container&&e.cover)return;this._setTagAttrs(t);const i=yi.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(i.container,t,null,this.fileManager)}}}select(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1}),this._ready(t)}_ready(t){Qt.get("__overInfo")!==Fo&&(this._element=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}async destroy(t){const e=t||this._element,i=yi.GetContainer(e),s=i.container||e,n=s.previousElementSibling||s.nextElementSibling;if(!1===await this.triggerEvent("onAudioDeleteBefore",{element:e,container:i,url:e.getAttribute("src")}))return;const o=s.parentNode;gt.utils.removeItem(s),this.init(),this.controller.close(),o!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(n),this.history.push(!1)}_register(t,e){const i=e.result;for(let e,s,n=0,o=i.length;n<o;n++)s=t.isUpdate?t.element:this._createAudioTag(),e={name:i[n].name,size:i[n].size},this._createComp(s,i[n].url,e,t.isUpdate)}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/audio/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===$o?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit;if(n>0&&e+this.fileManager.getSize()>n){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+n/1e3+"KB",i=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.ui.alertOpen(i===$o?t:i||t,"error"),!1}const o={files:i,isUpdate:this.modal.isUpdate,element:this._element},l=function(t,e){e=t||e,this._serverUpload(e,e.files)}.bind(this,o),r=await this.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==$o||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,isUpdate:this.modal.isUpdate,element:this._createAudioTag()},s=function(t,e){e=t||e,this._createComp(e.element,e.url,e.files,e.isUpdate)}.bind(this,i),n=await this.triggerEvent("onAudioUploadBefore",{info:i,handler:s});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==$o||s(null),!0)}_createComp(t,e,i,s){if(s){if(this._element&&(t=this._element),this.fileManager.setFileData(t,i),!t||t.src===e)return void this.component.select(t,Po.key);t.src=e,this.component.select(t,Po.key)}else{this.fileManager.setFileData(t,i),t.src=e;const s=yi.CreateContainer(t,"se-flex-component");if(!this.component.insert(s.container,{skipCharCount:!1,skipSelection:!this.options.get("componentAutoSelect"),skipHistory:!1}))return void this.editor.focus();if(!this.options.get("componentAutoSelect")){const t=this.format.addLine(s.container,null);t&&this.selection.setRange(t,0,t,0)}}s&&this.history.push(!1)}_createAudioTag(){const t=this.defaultWidth,e=this.defaultHeight,i=gt.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this._setTagAttrs(i),i}_setTagAttrs(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_serverUpload(t,e){if(!e)return;const i=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,i,this.#mt.bind(this,t),this._error.bind(this))}async _error(t){const e=await this.triggerEvent("onAudioUploadError",{error:t}),i=e===$o?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.audio.error]",i)}async#mt(t,e){if(await this.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===$o){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#rt(t){const e=gt.query.getEventTarget(t).value.trim();this.urlValue=this.preview.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ht(){this.plugins.audioGallery.open(this.#ft.bind(this))}#ft(t){this.urlValue=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#lt(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,[])}#bt(t){const e=gt.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),No.OnChangeFile(this.fileModalWrapper,e.files)}}const Do=Po,{NO_EVENT:qo}=dt;class Wo extends ii{static key="embed";static type="modal";static className="";static component(t){let e="";return gt.check.isIFrame(t)&&(e=t.src),/^DIV$/i.test(t?.nodeName)&>.check.isIFrame(t.firstElementChild)&&(e=t.firstElementChild.src),e&&this.checkContentType(e)?t:null}constructor(t,e){super(t),this.title=this.lang.embed,this.icon="embed",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&mt.get(e.defaultWidth,0)?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&mt.get(e.defaultHeight,0)?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||""};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e},i){let s=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.embed_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">\n\t\t\t<div class='se-modal-form'>\n\t\t\t\t<label>${t.embed_modal_source}</label>\n\t\t\t\t<input class='se-input-form se-input-url' type='text' data-focus />\n\t\t\t\t<pre class='se-link-preview'></pre>\n\t\t\t</div>`;if(i.canResize){const n=i.percentageOnlySize,o=n?' style="display: none !important;"':"",l=i.showHeightInput?"":' style="display: none !important;"',r=i.showRatioOption?"":' style="display: none !important;"',a=n||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';s+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${l}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${r}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="auto"${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${a}>${n?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="auto"\n\t\t\t\t${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}${l}/>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${o}${a}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}s+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const n=gt.utils.createElement("DIV",{class:"se-modal-content"},s);return{html:n,figureAlignBtn:n.querySelector(".se-figure-align"),fileModalWrapper:n.querySelector(".se-flex-input-wrapper"),embedInput:n.querySelector(".se-input-url"),previewSrc:n.querySelector(".se-link-preview"),proportion:n.querySelector("._se_check_proportion"),inputX:n.querySelector("._se_size_x"),inputY:n.querySelector("._se_size_y"),revertBtn:n.querySelector(".se-modal-btn-revert")}}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["align","edit","copy","remove"]]:[["resize_auto,75,50","align","edit","revert","copy","remove"]];n.some((t=>t.includes("align")))||(s.figureAlignBtn.style.display="none"),this.modal=new No(this,s.html),this.figure=new yi(this,n,{sizeUnit:i}),this.fileModalWrapper=s.fileModalWrapper,this.embedInput=s.embedInput,this.focusElement=this.embedInput,this.previewSrc=s.previewSrc,this._linkValue="",this._align="none",this._defaultSizeX=this.pluginOptions.defaultWidth,this._defaultSizeY=this.pluginOptions.defaultHeight,this.sizeUnit=i,this.proportion=null,this.inputX=null,this.inputY=null,this._element=null,this._cover=null,this._container=null,this._ratio={w:1,h:1},this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.query={facebook:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,action:t=>`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true&width=500`,tag:"iframe"},twitter:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:twitter\.com)\/(status|embed)\/(.+)/i,action:t=>`https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(t)}`,tag:"iframe"},instagram:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:instagram\.com)\/p\/(.+)/i,action:t=>`https://www.instagram.com/p/${t.match(this.query.instagram.pattern)[1]}/embed`,tag:"iframe"},linkedin:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:linkedin\.com)\/(.+)\/(.+)/i,action:t=>`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(t.split("/").pop())}`,tag:"iframe"},pinterest:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:pinterest\.com)\/pin\/(.+)/i,action:t=>`https://assets.pinterest.com/ext/embed.html?id=${t.match(this.query.pinterest.pattern)[1]}`,tag:"iframe"},spotify:{pattern:/(?:https?:\/\/)?(?:open\.)?(?:spotify\.com)\/(track|album|playlist|show|episode)\/(.+)/i,action:t=>{const e=t.match(this.query.spotify.pattern);return`https://open.spotify.com/embed/${e[1]}/${e[2]}`},tag:"iframe"},codepen:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:codepen\.io)\/(.+)\/pen\/(.+)/i,action:t=>{const[,e,i]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${i}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);this.urlPatterns=o.concat(e.urlPatterns||[]),this.eventManager.addEvent(this.embedInput,"input",this.#rt.bind(this)),this._resizing&&(this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this)))}open(){this.modal.open()}edit(){this.modal.open()}on(t){!t&&this._resizing&&(this.inputX.value=this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0)}async modalAction(){this._align=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this._linkValue.length>0&&(t=await this.submitSRC(this._linkValue)),t&&this._w.setTimeout(this.component.select.bind(this.component,this._element,Wo.key),0),t}retainFormat(){return{query:"iframe",method:async t=>{if(!this.checkContentType(t.src))return;const e=yi.GetContainer(t);if(e&&e.container&&e.cover)return;this._ready(t);const i=this.format.getLine(t);i&&(this._align=i.style.textAlign||i.style.float),this._update(t)}}}init(){No.OnChangeFile(this.fileModalWrapper,[]),this._linkValue=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this._ratio={w:1,h:1},this._nonResizing=!1,this._resizing&&(this.inputX.value=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this._element=t,this._cover=e.cover,this._container=e.container,this._caption=e.caption,this._align=e.align,t.style.float="",this._origin_w=String(e.originWidth||e.w||""),this._origin_h=String(e.originHeight||e.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this._resizing)return;const i=this._onlyPercentage&&this.figure.isVertical;let s=i?"":e.width;if(this._onlyPercentage&&(s=mt.get(s,2),s>100&&(s=100)),this.inputX.value=String("auto"===s?"":s),!this._onlyPercentage){const t=i?"":e.height;this.inputY.value=String("auto"===t?"":t)}this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1}}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,yi.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onEmbedDeleteBefore",{element:e,container:i,align:this._align,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!!this.urlPatterns.some((e=>e.test(t)))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}async submitSRC(t){if(t||(t=this._linkValue),!t)return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const i=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===i.length)return!1;e={children:i,...this._getInfo(),process:null}}else{const i=this.findProcessUrl(t);if(!i)return!1;e={url:t=i.url,...this._getInfo(),process:i}}const i=function(t,e){t=e||t,this._create(t.process,t.url,t.children,t.inputWidth,t.inputHeight,t.align,t.isUpdate)}.bind(this,e);this._create;const s=await this.triggerEvent("onEmbedInputBefore",{...e,handler:i});return void 0===s||!1!==s&&(null!==s&&"object"==typeof s&&i(s),!0!==s&&s!==qo||i(null),!0)}_createIframeTag(){const t=gt.utils.createElement("IFRAME");return this._setIframeAttrs(t),t}_createEmbedTag(){return gt.utils.createElement("BLOCKQUOTE")}_create(t,e,i,s,n,o,l){let r=null,a=null,h=null,c=null;if(l){if(r=this._element,r.src!==e){const t=this.findProcessUrl(e);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(r.nodeName)){const t=this._createIframeTag();t.src=e,r.replaceWith(t),r=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(r.nodeName)){const t=this._createEmbedTag();t.setAttribute("src",e),r.replaceWith(t),r=t}else r.src=e}h=this._container,a=gt.query.getParentElement(r,"FIGURE")}else if(t){r=this._createIframeTag(),r.src=e;const t=yi.CreateContainer(r,"se-embed-container");a=t.cover,h=t.container}else{r=i[0];const t=yi.CreateContainer(r,"se-embed-container");a=t.cover,h=t.container;let e=null,s=0;for(;e=i[s];)/^script$/i.test(e.nodeName)?(c=gt.utils.createElement("script",{src:e.getAttribute("src"),async:"true"},null),s++):a.appendChild(e)}this._element=r,this._cover=a,this._container=h,this.figure.open(r,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),s=s||this._defaultSizeX,n=n||this._defaultSizeY;const d=this.figure.getSize(r),u=d.w!==s||d.h!==n,p=!l||u;if(p&&this._applySize(s,n),this.figure.setAlign(r,o),l)this._resizing&&p&&this.figure.isVertical&&this.figure.setTransform(r,s,n,0),c||this.history.push(!1);else{if(this.component.insert(h,{skipCharCount:!1,skipSelection:!0,skipHistory:!0}),c)try{this.history.pause(),c.onload=()=>{gt.utils.removeItem(c),c=null},a.appendChild(c);const t=new MutationObserver((e=>{for(const i of e)if("childList"===i.type&&!r.parentElement){this.history.resume(),this.history.push(!1),t.disconnect();break}}));t.observe(this.editor.frameContext.get("wysiwyg"),{subtree:!0,childList:!0})}catch(t){this.history.resume(),console.warn("[SUNEDITOR] Embed tag script load error.",t)}if(!this.options.get("componentAutoSelect")){const t=this.format.addLine(h,null);t&&this.selection.setRange(t,0,t,0)}}}_update(t){if(!t)return;this._setIframeAttrs(t);let e=this.format.isBlock(t.parentNode)||gt.check.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t;t=t.cloneNode(!0);const s=yi.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const n=(t.getAttribute("data-se-size")||",").split(",");this._applySize(n[0]||i.style.width||i.width||"",n[1]||i.style.height||i.height||"");const o=this.format.getLine(i);if(o&&(this._align=o.style.textAlign||o.style.float),this.figure.setAlign(t,this._align),gt.query.getParentElement(i,gt.check.isExcludeFormat))i.replaceWith(s);else if(gt.check.isListCell(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(s,t),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLine(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(s,e),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.replaceWith(s);return t}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}_getInfo(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,element:this._element}}_setIframeAttrs(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#rt(t){const e=gt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this._linkValue=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#dt(t,e){if(ft.isSpace(e.code))return void e.preventDefault();const i=gt.query.getEventTarget(e);if("x"===t&&this._onlyPercentage&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=yi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const Uo=Wo,{_w:Go}=dt;class Zo extends ii{static key="math";static type="modal";static className="";static component(t){return gt.utils.hasClass(t,"se-math|katex")&>.utils.hasClass(t,"se-component")?t:null}constructor(t,e){super(t),this.title=this.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#yt(t.options.get("externalLibs").katex))||(this.mathjax=this.#vt(t.options.get("externalLibs").mathjax,t))||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option.'),this.pluginOptions={formSize:{width:"460px",height:"14em",maxWidth:"",maxHeight:"",minWidth:"400px",minHeight:"40px",...e.formSize},canResize:e.canResize??!0,autoHeight:!!e.autoHeight,fontSizeList:e.fontSizeList||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],onPaste:"function"==typeof e.onPaste?e.onPaste:null},this.pluginOptions.autoHeight&&(this.pluginOptions.formSize.height=this.pluginOptions.formSize.minHeight),this.defaultFontSize=null;const i=function(t){const{lang:e,icons:i,pluginOptions:s,katex:n}=t,{formSize:o,fontSizeList:l,canResize:r,autoHeight:a}=s,{width:h,height:c,maxWidth:d,maxHeight:u,minWidth:p,minHeight:g}=o,m=r?a?"horizontal":"auto":"none";let f=l[0].value,_=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${e.close}" aria-label="${e.close}">\n ${i.cancel}\n </button>\n <span class="se-modal-title">${e.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${e.math_modal_inputLabel} ${n?`(<a href="${dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp se-modal-resize-form" type="text" data-focus style="width: ${h}; height: ${c}; min-width: ${p}; min-height: ${g}; resize: ${m};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,i=l.length;e<i;e++)t=l[e],t.default&&(f=t.value),_+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return _+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_previewLabel}</label>\n <p class="se-math-preview"></p>\n </div>\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${e.submitButton}" aria-label="${e.submitButton}">\n <span>${e.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=f,gt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${d}; max-height: ${u};`},_)}(this),s=function({lang:t,icons:e}){const i=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t);this.modal=new No(this,i),this.controller=new hi(this,s,{position:"bottom",disabled:!0}),this.textArea=i.querySelector(".se-math-exp"),this.previewElement=i.querySelector(".se-math-preview"),this.fontSizeElement=i.querySelector(".se-math-size"),this.isUpdateState=!1,this._element=null,this.previewElement.style.fontSize=this.defaultFontSize,this.eventManager.addEvent(this.textArea,"input",this.#Ct.bind(this)),this.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style)),this.pluginOptions.onPaste&&this.eventManager.addEvent(this.textArea,"paste",this.pluginOptions.onPaste.bind(this))}select(t){if(gt.utils.hasClass(t,"se-math|katex")&&Yo(t))return this._element=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this._element=null}retainFormat(){return{query:".se-math, .katex, .MathJax",method:t=>{if(!this.katex&&!this.mathjax)return;const e=Yo(t);if(!e)return;const i=this._d.createRange().createContextualFragment(this._renderer(pt.entityToHTML(this._escapeBackslashes(e,!0))));t.innerHTML=i.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),gt.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?gt.utils.addClass(t,"katex"):gt.utils.removeClass(t,"katex"),this.mathjax&&this.#wt(this.mathjax)}}}open(){this.modal.open()}on(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=pt.entityToHTML(this._escapeBackslashes(Yo(t),!0)),i=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",i),i):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=i,this.previewElement.innerHTML=this._renderer(e),this.previewElement.style.fontSize=i}}else this.init()}modalAction(){if(0===this.textArea.value.trim().length||gt.utils.hasClass(this.textArea,"se-error"))return this.textArea.focus(),!1;const t=this.textArea.value,e=this.previewElement.querySelector(".se-math, .katex");if(!e)return!1;if(gt.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",pt.htmlToEntity(this._escapeBackslashes(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(gt.utils.addClass(e,"katex"),gt.utils.removeClass(e,"MathJax")):gt.utils.removeClass(e,"katex"),this.isUpdateState){gt.query.getParentElement(this.controller.currentTarget,".se-component").replaceWith(e);const t=this.component.get(e);return this.component.select(t.target,t.pluginName),!0}{const t=this.format.getLines();if(t.length>1){const i=gt.utils.createElement(t[0].nodeName,null,e);this.component.insert(i,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}else this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}this.mathjax&&this.#wt(this.mathjax);const i=this.selection.getNearRange(e);return i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Zo.key),!0}init(){this.textArea.value="",this.previewElement.innerHTML="",gt.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#xt(this._element);break;case"delete":this.destroy(this.controller.currentTarget)}}destroy(t){gt.utils.removeItem(t),this.controller.close(),this.editor.focus(),this.history.push(!1)}_renderer(t){let e="";try{gt.utils.removeClass(this.textArea,"se-error"),this.katex?e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0}):this.mathjax&&(e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(gt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`)}catch(t){gt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}_escapeBackslashes(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#xt(t){if(navigator.clipboard&&t)try{const e=Yo(t);await this.html.copy(e),gt.utils.addClass(t,"se-copy"),Go.setTimeout((()=>{gt.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Ct(t){const e=gt.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this._renderer(e.value),this.mathjax&&this.#wt(this.mathjax)}#wt(t){t.clear(),t.updateDocument()}#yt(t){if(!t)return null;if(!t.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const e=[{throwOnError:!1},t.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});return t.options=e,t}#vt(t,e){if(!t)return null;e.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const e=t.browserAdaptor();t.RegisterHTMLHandler(e);const i=new t.TeX,s=new t.CHTML;return t.src.document(document,{InputJax:i,OutputJax:s})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function Yo(t){const e=t.getAttribute("data-se-value");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",i),i):null}const Xo=Zo,{_w:jo,isMobile:Ko}=dt;const Jo=class extends ii{static key="drawing";static type="modal";static className="";constructor(t,e){super(t),this.title=this.lang.drawing,this.icon="drawing",this.pluginOptions={outputFormat:e.outputFormat||"dataurl",useFormatType:e.useFormatType??!1,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,lineWidth:e.lineWidth||5,lineReconnect:!!e.lineReconnect,lineCap:["butt","round","square"].includes(e.lineCap)?e.lineCap:"round",lineColor:e.lineColor||"",formSize:{width:"750px",height:"50vh",maxWidth:"",maxHeight:"",minWidth:"150px",minHeight:"100px",...e.formSize},canResize:e.canResize??!0,maintainRatio:e.maintainRatio??!0},this.plugins.image?"svg"!==this.pluginOptions.outputFormat||this.plugins.image.pluginOptions.uploadUrl||console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need the "image" plugin with the "uploadUrl" option. Please add the "image" plugin with the "uploadUrl" option.'):console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need either "image" plugin. Please add the "image" plugin.');const i=function({lang:t,icons:e,pluginOptions:i}){const{width:s,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=i.formSize,h=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.drawing_modal_title}</span>\n </div>\n <div class="se-modal-body" style="width: ${s}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${i.canResize?'<div class="se-modal-resize-handle-w"></div><div class="se-modal-resize-handle-h"></div><div class="se-modal-resize-handle-c"></div>':""}\n\t\t</div>\n\t\t<div class="se-modal-body-bottom">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t\t${i.useFormatType?`\n\t\t\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asBlock" aria-label="${t.blockStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_block}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asInline" aria-label="${t.inlineStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>`:""}\n\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="remove" aria-label="${t.remove}">\n\t\t\t\t\t\t\t${e.eraser}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.remove)}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n <div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n </div>\n </form>`;return gt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this);this.modal=new No(this,i),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=i.querySelector('[data-command="asBlock"]'),this.asInline=i.querySelector('[data-command="asInline"]'),this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#pt.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.__events={mousedown:Ko?this.#kt.bind(this):this.#Et.bind(this),mousemove:Ko?this.#St.bind(this):this.#Tt.bind(this),mouseup:this.#Ht.bind(this),mouseleave:this.#Lt.bind(this),mouseenter:this.#Mt.bind(this)},this.__eventsRegister={mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.__eventNameMap={mousedown:Ko?"touchstart":"mousedown",mousemove:Ko?"touchmove":"mousemove",mouseup:Ko?"touchend":"mouseup",mouseleave:"mouseleave",mouseenter:"mouseenter"},this.eventManager.addEvent(i.querySelector('[data-command="remove"]'),"click",this.#Nt.bind(this))}open(){this.pluginOptions.useFormatType&&this._activeAsInline("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this._initDrawing()}off(){this._destroyDrawing()}modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this._getSVGFileList();this.plugins.image.init(),this.plugins.image.submitFile(t)}else{const t=this.canvas.toDataURL(),e={name:"drawing",size:0};this.plugins.image.init(),"inline"!==this.as?this.plugins.image.create(t,null,"auto","","none",e,""):this.plugins.image.createInline(t,null,"auto","","none",e,"")}return!0}_initDrawing(){const t=this.canvas=this.modal.form.querySelector(".se-drawing-canvas");this.ctx=t.getContext("2d"),t.width=t.offsetWidth,t.height=t.offsetHeight,this.points=[],this.paths=[],this._setCtx(),this.__eventsRegister.mousedown=this.eventManager.addEvent(t,this.__eventNameMap.mousedown,this.__events.mousedown,{passive:!1,capture:!0}),this.__eventsRegister.mousemove=this.eventManager.addEvent(t,this.__eventNameMap.mousemove,this.__events.mousemove,!0),this.__eventsRegister.mouseup=this.eventManager.addEvent(t,this.__eventNameMap.mouseup,this.__events.mouseup,!0),this.__eventsRegister.mouseleave=this.eventManager.addEvent(t,this.__eventNameMap.mouseleave,this.__events.mouseleave),this.__eventsRegister.mouseenter=this.eventManager.addEvent(t,this.__eventNameMap.mouseenter,this.__events.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),dt.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,i=t.height,s=t.offsetWidth,n=t.offsetHeight;t.width=s,t.height=n,e===t.width&&i===t.height||(this.pluginOptions.maintainRatio&&this._adjustPathsToNewDimensions(e,i,s,n),this._drawAll())})),this.resizeObserver.observe(t))}_destroyDrawing(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.eventManager.removeEvent(this.__eventsRegister.mousedown),this.eventManager.removeEvent(this.__eventsRegister.mousemove),this.eventManager.removeEvent(this.__eventsRegister.mouseup),this.eventManager.removeEvent(this.__eventsRegister.mouseleave),this.eventManager.removeEvent(this.__eventsRegister.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}_setCtx(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||jo.getComputedStyle(this.carrierWrapper).color}_draw(){this._setCtx(),this.ctx.beginPath(),this.points.forEach((([t,e],i)=>{0===i?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}_drawAll(){this._setCtx(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this._draw()})),this.points=[]}_adjustPathsToNewDimensions(t,e,i,s){const n=i/t,o=s/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}_clearCanvas(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}_getSVG(){const t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");return e.setAttribute("width",this.canvas.width+""),e.setAttribute("height",this.canvas.height+""),e.setAttribute("viewBox",`0 0 ${this.canvas.width} ${this.canvas.height}`),e.setAttribute("xmlns",t),this.paths.forEach((i=>{const s=i.reduce(((t,[e,i],s)=>t+(0===s?`M ${e} ${i}`:` L ${e} ${i}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",s),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}_getSVGFileList(){const t=this._getSVG(),e=(new XMLSerializer).serializeToString(t),i=new Blob([e],{type:"image/svg+xml"}),s=new File([i],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(s),n.files}_getCanvasTouchPointer(t){const{touches:e}=t,i=this.canvas.getBoundingClientRect();return{x:e[0].clientX-i.left,y:e[0].clientY-i.top}}_activeAsInline(t){t?(gt.utils.addClass(this.asInline,"on"),gt.utils.removeClass(this.asBlock,"on"),this.as="inline"):(gt.utils.addClass(this.asBlock,"on"),gt.utils.removeClass(this.asInline,"on"),this.as="block")}#Et(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this._draw()}#Tt(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this._draw())}#kt(t){t.preventDefault();const{x:e,y:i}=this._getCanvasTouchPointer(t);this.isDrawing=!0,this.points.push([e,i]),this._draw()}#St(t){t.preventDefault();const{x:e,y:i}=this._getCanvasTouchPointer(t);this.isDrawing&&(this.points.push([e,i]),this._draw())}#Ht(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#Lt(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#Mt(t){if(1===t.buttons){if(this.isDrawing=!0,this.pluginOptions.lineReconnect){const e=this.paths[this.paths.length-1],i=e[e.length-1];this.points.push([i[0],i[1]]),this.points.push([t.offsetX,t.offsetY])}else this.points.push([t.offsetX,t.offsetY]);this._draw()}}#Nt(){this._clearCanvas()}#pt(t){this._activeAsInline("asInline"===gt.query.getEventTarget(t).getAttribute("data-command"))}};function Qo(t){const e=t.src.split("/").pop(),i=t.thumbnail||"",s=i||t.src,n=this.props?.map((e=>`data-${e}="${t[e]}"`)).join(" ")||"",o=`data-type="${t.type}" data-command="${t.src}" data-name="${t.name||e}" data-thumbnail="${i}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${i||"se-browser-empty-image"}" src="${s}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!i&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${i||"se-browser-empty-image"}" ${l}>`}\n\t\t\t<div class="se-file-name-image se-file-name-back"></div>\n\t\t\t<div class="se-file-name-image">${t.name||e}</div>\n\t\t</div>`}const tl=class extends Jt{constructor(t,e){super(t.editor),this.useSearch=e.useSearch??!0;const i=gt.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(e.className?` ${e.className}`:"")}),s=function(t,e){const i=t.lang,s=t.icons,n=`\n\t\t<div class="se-browser-content">\n\t\t\t<div class="se-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-browser-close" class="close" title="${i.close}" aria-label="${i.close}">\n\t\t\t\t\t${s.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-browser-title"></span>\n\t\t\t</div>\n\t\t\t<div class="se-browser-wrapper">\n\t\t\t\t<div class="se-browser-side"></div>\n\t\t\t\t<div class="se-browser-main"> \n\t\t\t\t\t<div class="se-browser-bar">\n\t\t\t\t\t\t<div class="se-browser-search">\n\t\t\t\t\t\t\t<button class="se-btn se-side-open-btn">${s.side_menu_hamburger}</button>\n\t\t\t\t\t\t\t${e?`\n\t\t\t\t\t\t\t\t\t\t<form class="se-browser-search-form">\n\t\t\t\t\t\t\t\t\t\t\t<input type="text" class="se-input-form" placeholder="${i.search}" aria-label="${i.search}">\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${i.search}" aria-label="${i.search}">${s.search}</button>\n\t\t\t\t\t\t\t\t\t\t</form>`:""}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-browser-body">\n\t\t\t\t\t\t<div class="se-browser-tags"></div>\n\t\t\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t\t\t<div class="se-browser-menus"></div>\n\t\t\t\t\t\t<div class="se-browser-list"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`,o=gt.utils.createElement("DIV",{class:"se-browser-inner"},n);return{html:o,header:o.querySelector(".se-browser-header"),titleArea:o.querySelector(".se-browser-title"),tagArea:o.querySelector(".se-browser-tags"),body:o.querySelector(".se-browser-body"),list:o.querySelector(".se-browser-list"),side:o.querySelector(".se-browser-side"),wrapper:o.querySelector(".se-browser-wrapper"),_loading:o.querySelector(".se-loading-box")}}(t.editor,this.useSearch),n=s.html;this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.area=i,this.header=s.header,this.titleArea=s.titleArea,this.tagArea=s.tagArea,this.body=s.body,this.list=s.list,this.side=s.side,this.wrapper=s.wrapper,this._loading=s._loading,this.title=e.title,this.listClass=e.listClass||"se-preview-list",this.directData=e.data,this.url=e.url,this.urlHeader=e.headers,this.searchUrl=e.searchUrl,this.searchUrlHeader=e.searchUrlHeader,this.drawItemHandler=(e.drawItemHandler||Qo).bind({thumbnail:e.thumbnail,props:e.props||[]}),this.selectorHandler=e.selectorHandler,this.columnSize=e.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.icons.menu_arrow_right,this.openArrow=this.icons.menu_arrow_down,this.icon_folder=this.icons.side_menu_folder_item,this.icon_folder_item=this.icons.side_menu_folder,this.icon_item=this.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this._closeSignal=!1,this._bindClose=null,this.__globalEventHandler=t=>{ft.isEsc(t.code)&&this.close()},this.apiManager=new Ls(this,{method:"GET"}),i.appendChild(gt.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(n),this.carrierWrapper.appendChild(i),this.eventManager.addEvent(this.tagArea,"click",this.#At.bind(this)),this.eventManager.addEvent(this.list,"click",this.#Bt.bind(this)),this.eventManager.addEvent(this.side,"click",this.#It.bind(this)),this.eventManager.addEvent(n,"mousedown",this.#Vt.bind(this)),this.eventManager.addEvent(n,"click",this.#Ot.bind(this)),this.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Rt.bind(this)),this.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#zt.bind(this)),this.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#$t.bind(this))}open(t){t||(t={}),this.__addGlobalEvent();const e=t.listClass||this.listClass;gt.utils.hasClass(this.list,e)||(this.list.className="se-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this.editor.opendBrowser=this,this.closeArrow=this.options.get("_rtl")?this.icons.menu_arrow_left:this.icons.menu_arrow_right,this.directData?this.__drowItems(this.directData):this._drawFileList(t.url||this.url,t.urlHeader||this.urlHeader,!1)}close(){this.__removeGlobalEvent(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.editor.opendBrowser=null,this.sideInner=null,"function"==typeof this.inst.init&&this.inst.init()}search(t){this.searchUrl?(this.keyword=t,this._drawFileList(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this._drawListItem(this.items,!1))}tagfilter(t){const e=this.selectedTags;return 0===e.length?t:t.filter((t=>!Array.isArray(t.tag)||t.tag.some((t=>e.includes(t)))))}showBrowserLoading(){this._loading.style.display="block"}closeBrowserLoading(){this._loading.style.display="none"}_drawFileList(t,e,i){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Ft.bind(this),errorCallBack:this.#Pt.bind(this)}),i||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}_drawListItem(t,e){const i=this.keyword,s=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(i)>-1))).length,o=this.columnSize,l=o<=1?1:Math.round(n/o)||1,r=this.drawItemHandler;let a="",h='<div class="se-file-item-column">',c=1;for(let i,d,u=0;u<n;u++)if(i=t[u],d=i.tag?"string"==typeof i.tag?i.tag.split(","):i.tag:[],d=i.tag=d.map((t=>t.trim())),h+=r(i),(u+1)%l==0&&c<o&&u+1<n&&(c++,h+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,i=d.length;e<i;e++)t=d[e],t&&!s.includes(t)&&(s.push(t),a+=`<a title="${t}" aria-label="${t}">${t}</a>`);h+="</div>",this.list.innerHTML=h,e&&(this.items=t,this.tagArea.innerHTML=a)}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler,!0)}__removeGlobalEvent(){this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))}__drowItems(t){if(Array.isArray(t))return t.length>0&&this._drawListItem(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.__parseFolderData(t),this.side.innerHTML="";const e=this.sideInner=gt.utils.createElement("div",null);if(this.__createFolderList(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(gt.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}__parseFolderData(t,e){let i=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const s=e.split("/"),n=s.length-1;s.forEach(((t,s)=>{i[t]||(i[t]={children:{}}),s===n?(i[t].key=e,i[t].name=this.folders[e].name):i=i[t].children}))}else e&&(i[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,i])=>{if("_data"===t||!i||"object"!=typeof i)return;const s=i,n=e?`${e}/${t}`:t;this.folders[n]={name:s.name||t,meta:s.meta||{}},this.__parseFolderData(s,n)}))}__createFolderList(t,e){for(const i in t){const s=t[i];if(s)if(Object.keys(s.children).length>0){const t=gt.utils.createElement("div",s.key?{"data-command":s.key,"aria-label":s.name}:null,`<span class="se-menu-icon">${s.key?this.icon_folder:this.icon_folder_item}</span><span>${s.name}</span>`),i=gt.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(gt.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");gt.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.__createFolderList(s.children,n),i.appendChild(n),e.appendChild(i)}else{const t=gt.utils.createElement("div",{"data-command":s.key,"aria-label":s.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${s.name}</span>`);if(e===this.sideInner){const i=gt.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(i)}else e.appendChild(t)}}}#Ft(t){try{const e=JSON.parse(t.responseText),i=e.result;if(this.__drowItems(i))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading(),this.body.style.maxHeight=gt.utils.getClientSize().h-this.header.offsetHeight-50+"px"}}#Pt(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#At(t){const e=gt.query.getEventTarget(t);if(!gt.check.isAnchor(e))return;const i=e.textContent,s=this.tagArea.querySelector('a[title="'+i+'"]'),n=this.selectedTags.indexOf(i);n>-1?(this.selectedTags.splice(n,1),gt.utils.removeClass(s,"on")):(this.selectedTags.push(i),gt.utils.addClass(s,"on")),this._drawListItem(this.items,!1)}#Bt(t){const e=gt.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const i=gt.query.getCommandTarget(e);i&&(this.close(),this.selectorHandler(i))}#It(t){const e=gt.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(gt.utils.hasClass(t,"se-menu-hidden")?(gt.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(gt.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const i=gt.query.getCommandTarget(e);if(!i||gt.utils.hasClass(i,"active"))return;const s=this.data[i.getAttribute("data-command")];gt.utils.removeClass(this.side.querySelectorAll(".active"),"active"),gt.utils.addClass([i,gt.query.getParentElement(i,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof s?this._drawFileList(s,this.urlHeader,!0):this._drawListItem(s,!1)}#Vt(t){const e=gt.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this._closeSignal=!0:this._closeSignal=!1}#Ot(t){const e=gt.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this._closeSignal)&&this.close()}#Rt(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#zt(t){const e=gt.query.getEventTarget(t);gt.utils.hasClass(e,"active")?(gt.utils.removeClass(this.side,"se-side-show"),gt.utils.removeClass(e,"active")):(gt.utils.addClass(this.side,"se-side-show"),gt.utils.addClass(e,"active"))}#$t({target:t}){t!==this.sideOpenBtn&>.utils.hasClass(this.sideOpenBtn,"active")&&(gt.utils.removeClass(this.side,"se-side-show"),gt.utils.removeClass(this.sideOpenBtn,"active"))}};const el=class extends ii{static key="imageGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.imageGallery,this.icon="image_gallery",this.onSelectfunction=null,this.browser=new tl(this,{title:this.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-image-gallery"}),this.width="auto"===this.plugins.image.pluginOptions.defaultWidth?"":this.plugins.image.pluginOptions.defaultWidth,this.height="auto"===this.plugins.image.pluginOptions.defaultHeight?"":this.plugins.image.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.plugins.image.init(),this.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt)}}};const il=class extends ii{static key="videoGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.video_thumbnail;this.browser=new tl(this,{title:this.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i,props:["frame"]}),this.width="auto"===this.plugins.video.pluginOptions.defaultWidth?"":this.plugins.video.pluginOptions.defaultWidth,this.height="auto"===this.plugins.video.pluginOptions.defaultHeight?"":this.plugins.video.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const i=this.plugins.video.findProcessUrl(e);i&&(e=i.url);const s={name:t.getAttribute("data-name"),size:0};this.plugins.video.init(),this.plugins.video.create(this.plugins.video["iframe"===t.getAttribute("data-frame")?"createIframeTag":"createVideoTag"]({poster:t.getAttribute("data-thumbnail")}),e,null,this.width,this.height,!1,s)}}};const sl=class extends ii{static key="audioGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.audio_thumbnail;this.browser=new tl(this,{title:this.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){this.onSelectfunction?this.onSelectfunction(t):(this.plugins.audio.init(),this.plugins.audio.submitURL(t.getAttribute("data-command")))}};const nl=class extends ii{static key="fileGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.file_thumbnail;this.browser=new tl(this,{title:this.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.plugins.fileUpload.create(t.getAttribute("data-command"),e,!0)}}};const ol=class extends ii{static key="fileBrowser";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const i={video:this.icons.video_thumbnail,audio:this.icons.audio_thumbnail,file:this.icons.file_thumbnail},s=this.icons.file_thumbnail;this.browser=new tl(this,{title:this.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>i[t.type]||s,props:[...new Set((e.props??[]).concat(["frame"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{switch(t.getAttribute("data-type")){case"image":this.plugins.imageGallery.browser.selectorHandler(t);break;case"video":this.plugins.videoGallery.browser.selectorHandler(t);break;case"audio":this.plugins.audioGallery.browser.selectorHandler(t);break;case"file":this.plugins.fileGallery.browser.selectorHandler(t)}}}},ll={text:{default:"13px",list:[{title:"XX-Small",size:"8px"},{title:"X-Small",size:"10px"},{title:"Small",size:"13px"},{title:"Medium",size:"16px"},{title:"Large",size:"18px"},{title:"X-Large",size:"24px"},{title:"XX-Large",size:"32px"}]},px:{default:13,inc:1,min:8,max:72,list:[8,10,13,15,18,20,22,26,28,36,48,72]},pt:{default:10,inc:1,min:6,max:72,list:[6,8,10,12,14,18,22,26,32]},em:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},rem:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},vw:{inc:.1,min:.5,max:10,list:[2,3.5,4,4.5,6,8]},vh:{default:1.5,inc:.1,min:.5,max:10,list:[1,1.5,2,2.5,3,3.5,4]},"%":{default:100,inc:1,min:50,max:200,list:[50,70,90,100,120,140,160,180,200]}};class rl extends ii{static key="fontSize";static type="input";static className="se-btn-select se-btn-input se-btn-tool-font-size";constructor(t,e){super(t),this.unitMap={...ll,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.options.get("fontSizeUnits")[0];const i=function({lang:t},e,i,s){const n=e.list,o=e.default,l=s?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,s,a,h,c=0,d=n.length;c<d;c++)t=n[c],"object"==typeof t?(e=t.title,s=t.size):e=s=t+i,a=o===s?" default_value":"",h=a&&l||e,r+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${a}" data-command="${s}" data-value="${e}" title="${h}" aria-label="${h}" style="font-size:${s};">${h}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(t,this.unitMap[this.sizeUnit||"text"],this.sizeUnit,e.showDefaultSizeLabel),s=!!this.sizeUnit&&(e.showIncDecControls??!1),n=!this.sizeUnit||(e.disableInput??!1);this.title=this.lang.fontSize,this.inner=!(n&&!s)&&(n?`<span class="se-txt se-not-arrow-text __se__font_size">${this.lang.fontSize}</span>`:`<input type="text" class="__se__font_size se-not-arrow-text" placeholder="${this.lang.fontSize}" />`),s?(this.beforeItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":rl.key,"data-type":"command","data-value":"dec"},`${this.icons.minus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.decrease}</span></span>`),this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":rl.key,"data-type":"command","data-value":"inc"},`${this.icons.plus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.increase}</span></span>`)):n?n&&!s&&(this.replaceButton=gt.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":rl.key,"data-type":"dropdown"},`<span class="se-txt __se__font_size">${this.lang.fontSize}</span>${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.fontSize}</span></span>`),this.menu.initDropdownTarget({key:rl.key,type:"dropdown"},i)):(this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":rl.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.fontSize}</span></span>`),this.menu.initDropdownTarget({key:rl.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this._disableInput=n,this.menu.initDropdownTarget(rl,i)}active(t,e){if(!gt.utils.hasClass(e,"__se__font_size"))return!1;let i="";if(t){if(this.format.isLine(t))return;if(i=gt.utils.getStyle(t,"fontSize"))return this._setSize(e,i),!0}else this._setSize(e,this._getDefaultSize());return!1}onInputKeyDown({target:t,event:e}){const i=e.code;if(this._disableInput||ft.isSpace(i))return void e.preventDefault();if(!/^(38|40|13)$/.test(i))return;const{value:s,unit:n}=this._getSize(t);if(!s)return;const o=mt.get(s),l=this.unitMap[n];let r=o;switch(i){case"ArrowUp":r+=l.inc,r>l.max&&(r=o);break;case"ArrowDown":r-=l.inc,r<l.min&&(r=o)}e.preventDefault();try{this.isInputActive=!0;const e=this._setSize(t,r+n);if(this._disableInput)return;const s=gt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(s,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),ft.isEnter(i)||t.focus()}finally{this.isInputActive=!1}}onInputChange({target:t,value:e,event:i}){if(!this._disableInput)try{this.isInputActive=!0;let{value:i,unit:s}=this._getSize(e);const{max:n,min:o}=this.unitMap[s];i=i>n?n:i<o?o:i;const l=gt.utils.createElement("SPAN",{style:"font-size: "+this._setSize(t,i+s)+";"});this.format.applyInlineElement(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,i.preventDefault(),this.editor.focus()}}on(t){const{value:e,unit:i}=this._getSize(t),s=e+i;if(s===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)s===n[t].getAttribute("data-value")?gt.utils.addClass(n[t],"active"):gt.utils.removeClass(n[t],"active");this.currentSize=s}action(t){const e=t.getAttribute("data-command");if(e===rl.key){const{value:e,unit:i}=this._getSize(t);let s=mt.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[i];s=s<n?n:s>o?o:s;const l=gt.utils.createElement("SPAN",{style:"font-size: "+s+i+";"});this.format.applyInlineElement(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=gt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(t,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["font-size"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}_getDefaultSize(){return this.editor.frameContext.get("wwComputedStyle").fontSize}_getSize(t){if(!(t="string"==typeof t?t:t.parentElement.querySelector(".__se__font_size")))return{unit:this.sizeUnit,value:this.sizeUnit?0:""};const e="string"==typeof t?t:gt.check.isInputElement(t)?t.value:t.textContent,i=this.sizeUnit?e.split(/(\d+)/):[e,""];let s=(i.pop()||"").trim().toLowerCase();s=this.options.get("fontSizeUnits").includes(s)?s:this.sizeUnit;const n=i.pop();return{unit:s,value:s?Number(n):n}}_setSize(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?gt.check.isInputElement(t)?t.value=String(e):t.textContent=String(this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e):0}}const al=rl;const hl=class extends ii{static key="pageNavigator";static type="input";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.lang.pageNumber,this.inner=gt.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=gt.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.eventManager.addEvent(this.inner,"change",this.#qt.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#qt(t){if(!this.editor.frameContext.has("documentType-use-page"))return;const e=gt.query.getEventTarget(t),i=Number(e.value)||1;this.editor.frameContext.get("documentType").pageGo(i)}},{_w:cl}=dt;class dl extends ii{static key="anchor";static type="popup";static className="";static component(t){return gt.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}constructor(t){super(t),this.title=this.lang.anchor,this.icon="bookmark_anchor";const e=(new DOMParser).parseFromString(this.icons.bookmark_anchor,"image/svg+xml");this.bookmarkIcon=e.documentElement,this._element=null,this._range=null;const i=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<div class="se-controller-display"></div>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="edit" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(this);this.displayId=i.querySelector(".se-controller-display"),this.controllerSelect=new hi(this,i,{position:"bottom",disabled:!0},dl.key);const s=function({lang:t,icons:e}){const i=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-controller-display">${t.id}</div>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" required />\n\t\t\t\t<button type="submit" data-command="submit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.inputEl=s.querySelector("input"),this.controller=new hi(this,s,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},dl.key)}show(){this.controller.open(this._range=this.selection.getRange()),cl.setTimeout((()=>{this.inputEl.focus()}),0)}select(t){this._element=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}deselect(){this._init()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const i=this._element;switch(e){case"submit":if(i)this.controller.close(),i.id=this.inputEl.value,this.select(i);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=gt.utils.createElement("A",{id:t,"data-se-anchor":this.inputEl.value,"data-se-non-link":"true",contenteditable:"false",class:"se-component se-inline-component"});this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1});const i=this.selection.getNearRange(e);i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,dl.key),this._init()}break;case"cancel":this.controller.close(!i),this._range&&this.selection.setRange(this._range),this._init(),i&&this.select(i);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(i);break;case"delete":{const t=this.selection.getNearRange(i);gt.utils.removeItem(i),this.controllerSelect.close(!0),t&&this.selection.setRange(t.container,t.offset,t.container,t.offset),this._init();break}}}_init(){this._element=null,this._range=null,this.inputEl.value="",this.displayId.textContent=""}}const ul={blockquote:Ts,exportPDF:As,fileUpload:Rs,list_bulleted:$s,list_numbered:Ds,mention:Ws,align:Gs,font:Ys,fontColor:On,backgroundColor:zn,list:Dn,table:go,formatBlock:fo,hr:Fn,layout:bo,lineHeight:vo,template:wo,paragraphStyle:ko,textStyle:So,link:Ao,image:Vo,video:zo,audio:Do,embed:Uo,math:Xo,drawing:Jo,imageGallery:el,videoGallery:il,audioGallery:sl,fileGallery:nl,fileBrowser:ol,fontSize:al,pageNavigator:hl,anchor:dl},pl={_DragHandle:Qt,ApiManager:Ls,ColorPicker:In,Controller:hi,Browser:tl,FileManager:Is,HueSlider:Nn,Figure:yi,Modal:No,ModalAnchorEditor:Ho,SelectMenu:ci};i("+qkj"),i("JybH"),Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Ss,editorInjector:ii,plugins:ul,modules:pl,helper:bt}})})()})();
|