suneditor 3.0.0-alpha.13 → 3.0.0-alpha.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 +2 -1
- package/src/core/editor.js +0 -5
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",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",edit:"Edit",exportPdf:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",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",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",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",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width"};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=t.navigator.userAgent.toLowerCase();function l(t){return"string"==typeof t?t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())):t.map((function(t){return l(t)}))}const r="function"==typeof ResizeObserver,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=!!window.chrome,p=o.includes("applewebkit/")&&!o.includes("chrome"),g=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(o)||"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,m=o.includes("android"),f=h?"⌘":"CTRL",_=h?"⇧":"+SHIFT",b=t.devicePixelRatio,v={_w:t,_d:e,NO_EVENT:s,ON_OVER_COMPONENT:n,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)}))},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=0===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:r,isEdge:a,isBlink:c,isGecko:d,isChromium:u,isSafari:p,isOSX_IOS:h,isAndroid:m,isMobile:g,cmdIcon:f,shiftIcon:_,DPI:b,_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details",KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},y=8203,C=String.fromCharCode(y),w=new RegExp(String.fromCharCode(y),"g"),x=new RegExp("^"+String.fromCharCode(y)+"+$"),E=/https?:\/\/[^\s]+/g,S={"xx-small":1,"x-small":2,small:3,medium:4,large:5,"x-large":6,"xx-large":7,"xxx-large":8};function T(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const k={htmlToEntity:function(t){const e={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,(t=>"string"==typeof e[t]?e[t]:t))},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=setTimeout((()=>{t.clearTimeout(s),e(...n)}),i)}},fontSize:function(t,e){const i=e.match(/(\d+(?:\.\d+)?)(.+)/),s=i?1*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*(.0625*o).toFixed(2)+t;case"pt":return Math.floor(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[t[i]]=i);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:T,rgb2hex:function(t){if(T(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""},getWidthInPercentage:function(e,i){const s=i||e.parentElement,n=t.getComputedStyle(s),o=t.parseFloat(n.paddingLeft),l=t.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;i.replace(E,((t,o)=>{o>0&&s.appendChild(e.createTextNode(i.slice(0,o)));const l=e.createElement("a");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.parentNode.replaceChild(s,t)}},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>":""}};function N(t){return null!=t&&("string"!=typeof t&&(t=t.textContent),""===t||x.test(t))}function L(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 H(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function M(t,e,i){const s=[];let n=!0;return V(t,(t=>{if(t===e&&(n=!1),n&&!D(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,z(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,z(e)}s.push(t)}return!1})),s.map(H).reverse()}function A(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 B(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 I(t){if(!t||D(t))return-1;let e=0;for(t=t.parentNode;t&&!D(t);)e+=1,t=t.parentNode;return e}function V(t,e){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=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="^"+e+"$");const s=new RegExp(e,"i");i=function(e){return s.test(e[t])}}for(;t&&!i(t);){if(D(t))return null;t=t.parentNode}return t}function R(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 O(t,e,i){if(e.style.cssText){const i=e.style;for(let e=0,s=i.length;e<s;e++)t.style[i[e]]=i[i[e]]}const s=e.attributes;for(let e,n=0,o=s.length;n<o;n++)e=s[n].name.toLowerCase(),i?.includes(e)||!s[n].value?t.removeAttribute(e):"style"!==e&&t.setAttribute(s[n].name,s[n].value)}function z(t){t&&("function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))}function $(t,e){if(t)return new RegExp(`(\\s|^)${e}(\\s|$)`).test(t.className)}function F(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(const t of i)if(t&&1===t.nodeType)for(const e of s)e&&t.classList.add(e)}function P(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(const t of i)if(t&&1===t.nodeType)for(const e of s)e&&t.classList.remove(e)}function D(t){return 1===t?.nodeType&&($(t,"se-wrapper-wysiwyg|sun-editor-carrier-wrapper")||/^BODY$/i.test(t.nodeName))}function W(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")}function U(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)}function Z(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function q(t){return t.hasAttribute("data-important-disabled")}function G(t=e){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const j={isZeroWith:N,createElement:L,createTextNode:function(t){return e.createTextNode(t||"")},getIframeDocument:function(t){let e=t.contentWindow||t.contentDocument;return e.document&&(e=e.document),e},getAttributesToString:function(t,e){if(!t.attributes)return"";const i=t.attributes;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},getPositionIndex:H,getNodePath:M,getNodeFromPath:A,getListChildren:function(t,e){const i=[];return t&&t.children&&0!==t.children.length?(e=e||function(){return!0},function s(n){if(t!==n&&e(n)&&i.push(n),n.children)for(let t=0,e=n.children.length;t<e;t++)s(n.children[t])}(t),i):i},getListChildNodes:B,getNodeDepth:I,sortNodeByDepth:function(t,e){const i=e?1:-1,s=-1*i;t.sort((function(t,e){return U(t)&&U(e)?(t=I(t))>(e=I(e))?i:t<e?s:0:0}))},compareElements:function(t,e){let i=t,s=e;for(;i&&s&&i.parentNode!==s.parentNode;)i=i.parentNode,s=s.parentNode;if(!i||!s)return{ancestor:null,a:t,b:e,result:0};const n=i.parentNode.childNodes,o=R(n,i),l=R(n,s);return{ancestor:i.parentNode,a:i,b:s,result:o>l?1:o<l?-1:0}},getParentElement:V,getParentElements:function(t,e){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=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="^"+e+"$");const s=new RegExp(e,"i");i=function(e){return s.test(e[t])}}const s=[];for(;t&&!D(t);)i(t)&&s.push(t),t=t.parentNode;return s},getCommandTarget:function(t){for(;!/^(UL|DIV)$/i.test(t.tagName);){if(t.hasAttribute("data-command"))return t;t=t.parentNode}return null},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=B(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(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!Z(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getArrayItem:function(t,e,i){if(!t||0===t.length)return null;e=e||function(){return!0};const s=[];for(let n,o=0,l=t.length;o<l;o++)if(n=t[o],e(n)){if(!i)return n;s.push(n)}return i?s:null},arrayIncludes:function(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},getArrayIndex:R,nextIndex:function(t,e){const i=R(t,e);return-1===i?-1:i+1},prevIndex:function(t,e){const i=R(t,e);return-1===i?-1:i-1},copyTagAttributes:O,copyFormatAttributes:function(t,e){(e=e.cloneNode(!1)).className=e.className.replace(/(\s|^)__se__format__[^\s]+/g,""),O(t,e)},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.style,s=e.style;let n=0;for(let t=0,e=i.length;t<e;t++)i[i[t]]===s[i[t]]&&n++;const o=t.classList,l=e.classList,r=RegExp;let a=0;for(let t=0,e=o.length;t<e;t++)r("(s|^)"+o[t]+"(s|$)").test(l.value)&&a++;return n===s.length&&n===i.length&&a===l.length&&a===o.length},removeItem:z,changeElement:function(t,e){if(t)if("string"==typeof e)if(t.outerHTML)t.outerHTML=e;else{const i=L("DIV");i.innerHTML=e,e=i.firstChild,t.parentNode.replaceChild(e,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,i||s.style.cssText||s.removeAttribute("style")},setDisabled:function(t,e,i){for(let s=0,n=t.length;s<n;s++){const n=t[s];!i&&q(n)||(n.disabled=e),i&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:$,addClass:F,removeClass:P,toggleClass:function(t,e){if(!t)return;if(1!==t.nodeType)return;let i=!1;const s=new RegExp(`(\\s|^)${e}(\\s|$)`);return s.test(t.className)?t.className=t.className.replace(s," ").trim():(t.className+=" "+e,i=!0),t.className.trim()||t.removeAttribute("class"),i},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},isWysiwygFrame:D,isNonEditable:W,isList:function(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)},isListCell:U,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:Z,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)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isInputElement:function(t){return 1===t?.nodeType&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isEmptyLine:function(t){return!t?.parentNode||!t.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&0===t.children.length&&N(t.textContent)},isSpanWithoutAttr:function(t){return 1===t?.nodeType&&/^SPAN$/i.test(t.nodeName)&&!t.className&&!t.style.cssText},isUneditable:function(t){return $(t,"__se__uneditable")},isImportantDisabled:q,isExcludeFormat:function(t){return/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/.test(t?.className)},getScrollParent:function t(e){return!e||/^(body|html)$/i.test(e.nodeName)?null:e.scrollHeight>e.clientHeight?e:t(e.parentNode)},getClientSize:G,getViewportSize:function(){return"visualViewport"in t?{top:t.visualViewport.pageTop,left:t.visualViewport.pageLeft,scale:t.visualViewport.scale}:{top:0,left:0,scale:1}},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(W(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(W(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)for(const e of l.childNodes)if(t(e),o)return}(t),n},findTabEndIndex:function(t,e,i){if(!t)return 0;const s=t.innerText,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},applyInlineStylesAll:function(i,s,n){if(!i)return console.warn('"parentTarget" is not exist'),null;const o=e.createElement("DIV");if(o.style.display="none",/body/i.test(i.nodeName)){const t=e.createElement("DIV"),s=i.attributes;for(let e=0,i=s.length;e<i;e++)t.setAttribute(s[e].name,s[e].value);t.innerHTML=i.innerHTML,i=t}else i=i.cloneNode(!0);o.appendChild(i),e.body.appendChild(o);const l=i.querySelectorAll("*");for(let e,i=s?0:1;e=l[i];i++){const i=t.getComputedStyle(e);for(const t of n||i)e.style[t]=i.getPropertyValue(t)||""}return e.body.removeChild(o),i}};function X(t,e){if(!t)return 0;let i=(t+"").match(/-?\d+(\.\d+)?/);return i&&i[0]?(i=i[0],e<0?1*i:0===e?Math.round(1*i):1*(1*i).toFixed(e)):0}const Y=v,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")}},J=k,Q=j,tt={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:X,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)}},et={env:Y,unicode:K,converter:J,domUtils:Q,numbers:tt},it={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 11.76 15.75"><g><path d="M6.4,3.76V19.5h6.76a5.55,5.55,0,0,0,2-.32,4.93,4.93,0,0,0,1.52-1,4.27,4.27,0,0,0,1.48-3.34,3.87,3.87,0,0,0-.69-2.37,5.74,5.74,0,0,0-.71-.83,3.44,3.44,0,0,0-1.1-.65,3.6,3.6,0,0,0,1.58-1.36,3.66,3.66,0,0,0,.53-1.93,3.7,3.7,0,0,0-1.21-2.87,4.65,4.65,0,0,0-3.25-1.1H6.4Zm2.46,6.65V5.57h3.52a4.91,4.91,0,0,1,1.36.15,2.3,2.3,0,0,1,.85.45,2.06,2.06,0,0,1,.74,1.71,2.3,2.3,0,0,1-.78,1.92,2.54,2.54,0,0,1-.86.46,4.7,4.7,0,0,1-1.32.15H8.86Zm0,7.27V12.15H12.7a4.56,4.56,0,0,1,1.38.17,3.43,3.43,0,0,1,.95.49,2.29,2.29,0,0,1,.92,2,2.73,2.73,0,0,1-.83,2.1,2.66,2.66,0,0,1-.83.58,3.25,3.25,0,0,1-1.26.2H8.86Z" transform="translate(-6.4 -3.75)"/></g></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.49 15.76"><g><path d="M17.16,3.79l.37,0-.06.38-.14.52A10,10,0,0,1,16.21,5a9.37,9.37,0,0,0-1,.32,6.68,6.68,0,0,0-.25.89c-.06.31-.11.59-.14.85-.3,1.36-.52,2.41-.68,3.14l-.61,3.18L13.1,15l-.43,2.4-.12.46a.62.62,0,0,0,0,.28c.44.1.85.17,1.23.22l.68.11a4.51,4.51,0,0,1-.08.6l-.09.42a.92.92,0,0,0-.23,0l-.43,0a1.37,1.37,0,0,1-.29,0c-.13,0-.63-.08-1.49-.16l-2,0c-.28,0-.87,0-1.78.12L7,19.5l.17-.88.8-.2A6.61,6.61,0,0,0,9.19,18,2.62,2.62,0,0,0,9.61,17l.28-1.41.58-2.75.12-.66c.05-.3.11-.58.17-.86s.12-.51.17-.69l.12-.48.12-.43.31-1.6.15-.65.31-1.91V5.14a3.86,3.86,0,0,0-1.48-.29l-.38,0,.2-1.06,3.24.14.75,0c.45,0,1.18,0,2.18-.09.23,0,.46,0,.71,0Z" transform="translate(-7.04 -3.76)"/></g></svg>',strike:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.9"><g><path d="M12.94,13a4.27,4.27,0,0,1,1.32.58,1.46,1.46,0,0,1,.55,1.2,1.87,1.87,0,0,1-.88,1.64,4.17,4.17,0,0,1-2.35.59,4.44,4.44,0,0,1-2.74-.71,2.72,2.72,0,0,1-1-2.17H5.57a4.56,4.56,0,0,0,1.55,3.7,7,7,0,0,0,4.47,1.23,6,6,0,0,0,4.07-1.3,4.24,4.24,0,0,0,1.52-3.37,4,4,0,0,0-.26-1.4h-4ZM6.37,10.24A3.27,3.27,0,0,1,6,8.68a4,4,0,0,1,1.48-3.3,5.92,5.92,0,0,1,3.88-1.21,5.58,5.58,0,0,1,3.91,1.24,4.36,4.36,0,0,1,1.45,3.17H14.44a2.12,2.12,0,0,0-.91-1.81,4.45,4.45,0,0,0-2.44-.55,3.69,3.69,0,0,0-2,.51A1.64,1.64,0,0,0,8.3,8.22a1.3,1.3,0,0,0,.48,1.11,7,7,0,0,0,2.1.78l.28.06.28.08H6.37Zm13.09.68a.73.73,0,0,1,.49.21.66.66,0,0,1,.2.48.64.64,0,0,1-.2.48.71.71,0,0,1-.49.19H5.1a.67.67,0,0,1-.49-.19.66.66,0,0,1-.2-.48.64.64,0,0,1,.2-.48.73.73,0,0,1,.49-.21H19.46Z" transform="translate(-4.41 -4.17)"/></g></svg>',subscript:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 14.61"><g><path d="M15.38,4.33H12.74L11.19,7c-.28.46-.51.87-.69,1.21L10.07,9h0l-.44-.8c-.22-.4-.45-.81-.71-1.23L7.34,4.33H4.68L8.26,10,4.4,16.08H7.1l1.69-2.83c.38-.63.72-1.22,1-1.78l.25-.46h0l.49.92c.24.45.48.89.74,1.32L13,16.08h2.61L11.84,10l1.77-2.84,1.77-2.85Zm4.77,13.75H17v-.15c0-.4.05-.64.16-.72a4.42,4.42,0,0,1,1.16-.31,3.3,3.3,0,0,0,1.54-.56A1.84,1.84,0,0,0,20.15,15a1.78,1.78,0,0,0-.44-1.41A2.8,2.8,0,0,0,18,13.25a2.71,2.71,0,0,0-1.69.37,1.83,1.83,0,0,0-.44,1.43v.23H17v-.23q0-.63.18-.78a1.62,1.62,0,0,1,.88-.15,1.59,1.59,0,0,1,.88.15q.18.15.18.75t-.18.75a3.58,3.58,0,0,1-1.18.33,3.33,3.33,0,0,0-1.52.51,1.57,1.57,0,0,0-.32,1.18v1.15h4.27v-.86Z" transform="translate(-4.4 -4.33)"/></g></svg>',superscript:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.42"><g><path d="M12,13.14l3.61-5.81H12.94L11.33,10c-.28.46-.51.88-.69,1.25l-.45.83h0l-.45-.85c-.22-.41-.45-.82-.71-1.24L7.4,7.33H4.68l3.66,5.81L4.4,19.33H7.14l1.74-2.87q.58-1,1-1.83l.25-.48h0l.51.94.75,1.37,1.72,2.87h2.67l-1.92-3.09c-1.12-1.8-1.76-2.83-1.92-3.1Zm4.84-4.41h0l0,.15h3.27v.86H15.77V8.58a1.66,1.66,0,0,1,.33-1.22,3.51,3.51,0,0,1,1.56-.51,3.68,3.68,0,0,0,1.21-.34c.13-.1.19-.36.19-.77S19,5.07,18.87,5A1.63,1.63,0,0,0,18,4.8a1.58,1.58,0,0,0-.91.17c-.13.11-.19.38-.19.8V6H15.78V5.76a1.87,1.87,0,0,1,.45-1.47A2.84,2.84,0,0,1,18,3.91a2.8,2.8,0,0,1,1.72.38,1.84,1.84,0,0,1,.45,1.44,1.91,1.91,0,0,1-.34,1.35,3.24,3.24,0,0,1-1.58.57A3.69,3.69,0,0,0,17,8c-.12.1-.17.35-.17.76Z" transform="translate(-4.4 -3.91)"/></g></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.84 22.73L16.29 18.18C15.2 19.3 13.69 20 12 20C8.69 20 6 17.31 6 14C6 12.67 6.67 11.03 7.55 9.44L1.11 3L2.39 1.73L22.11 21.46L20.84 22.73M18 14C18 10 12 3.25 12 3.25S10.84 4.55 9.55 6.35L17.95 14.75C18 14.5 18 14.25 18 14Z" /></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M4.68,14.45a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V9.1a.27.27,0,0,1,.08-.19.28.28,0,0,1,.2-.08.25.25,0,0,1,.19.07l2.54,2.54a.29.29,0,0,1,0,.4L4.88,14.36a.24.24,0,0,1-.2.09Zm15.19,1.12a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87Zm0-3.38a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm0-3.37a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm.2-3.29a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',outdent:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M19.87,15.57a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87ZM7.5,14.45a.25.25,0,0,1-.2-.09L4.76,11.84a.29.29,0,0,1,0-.4L7.3,8.9a.29.29,0,0,1,.4,0,.31.31,0,0,1,.07.2v5.06a.32.32,0,0,1-.08.21.26.26,0,0,1-.19.08ZM19.87,8.82a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm0,3.37a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm.2-6.66a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',expansion:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M11.8,13.06l-5.1,5.1H9.51V19.5H4.41V14.4H5.75v2.81L8.3,14.66q2.25-2.23,2.55-2.55Zm8.35-9.3v5.1H18.81V6.05l-5.1,5.1-1-1,5.1-5.1H15.05V3.76Z" transform="translate(-4.41 -3.76)"/></g></svg>',reduction:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M14.91,10h2.87v1.38H12.55V6.12h1.38V9l5.24-5.24.48.49.49.48ZM6.77,11.92H12v5.23H10.62V14.26L5.37,19.5l-1-1L9.63,13.3H6.77Z" transform="translate(-4.4 -3.76)"/></g></svg>',code_view:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 11.8"><g><path d="M8.09,7.94a.76.76,0,0,1,.53.22.72.72,0,0,1,.21.52.76.76,0,0,1-.22.54L6.18,11.63l2.43,2.44a.69.69,0,0,1,.2.51.66.66,0,0,1-.21.51.75.75,0,0,1-.51.22.63.63,0,0,1-.51-.21h0L4.63,12.15a.7.7,0,0,1-.22-.53.67.67,0,0,1,.25-.55L7.57,8.16a.82.82,0,0,1,.52-.22Zm12.05,3.69a.7.7,0,0,1-.23.52L17,15.1h0a.66.66,0,0,1-.51.21.73.73,0,0,1-.51-.22.75.75,0,0,1-.22-.51.63.63,0,0,1,.21-.51l2.43-2.44L15.92,9.22a.73.73,0,0,1-.22-.53A.74.74,0,0,1,17,8.18h0l2.91,2.91a.67.67,0,0,1,.27.54Zm-5.9-5.9a.73.73,0,0,1,.61.32.71.71,0,0,1,.07.68L11,17a1,1,0,0,1-.22.32.6.6,0,0,1-.35.16.75.75,0,0,1-.69-.26.69.69,0,0,1-.12-.72L13.56,6.23a.75.75,0,0,1,.26-.35.74.74,0,0,1,.42-.15Z" transform="translate(-4.41 -5.73)"/></g></svg>',preview:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.65 15.66"><g><path d="M16.19,14.43l2.49,2.49a.73.73,0,0,1,.21.52.67.67,0,0,1-.22.51.7.7,0,0,1-.52.22.69.69,0,0,1-.51-.21l-2.49-2.48a5.17,5.17,0,0,1-1.34.69,4.64,4.64,0,0,1-1.48.24,4.78,4.78,0,1,1,0-9.56,4.79,4.79,0,0,1,1.84.36,4.9,4.9,0,0,1,1.56,1,4.77,4.77,0,0,1,.46,6.18ZM10,14a3.3,3.3,0,0,0,2.34.93A3.37,3.37,0,0,0,14.7,14a3.3,3.3,0,0,0-1.08-5.41,3.47,3.47,0,0,0-2.56,0A3,3,0,0,0,10,9.28,3.31,3.31,0,0,0,10,14ZM16,4a3.86,3.86,0,0,1,2.77,1.14A3.9,3.9,0,0,1,20,7.85v4a.77.77,0,0,1-.22.53.7.7,0,0,1-.52.21.72.72,0,0,1-.74-.74v-4a2.46,2.46,0,0,0-.72-1.73A2.37,2.37,0,0,0,16,5.45H8.53A2.42,2.42,0,0,0,6.08,7.89v7.52a2.41,2.41,0,0,0,.71,1.73,2.46,2.46,0,0,0,1.74.72h4.08a.73.73,0,0,1,0,1.46H8.53a3.85,3.85,0,0,1-2.78-1.14A3.93,3.93,0,0,1,4.6,15.4V7.87A3.94,3.94,0,0,1,5.76,5.09,3.88,3.88,0,0,1,8.54,4H16Z" transform="translate(-4.45 -3.8)"/></g></svg>',print:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16.05 16.04"><g><path d="M19.76,15.84a1.29,1.29,0,0,0,.39-.92V8.35A2.05,2.05,0,0,0,19.57,7a1.93,1.93,0,0,0-1.38-.57H6.37a1.95,1.95,0,0,0-2,2v6.56a1.23,1.23,0,0,0,.38.92,1.35,1.35,0,0,0,.93.38h2V14.9l-2,0V8.35a.67.67,0,0,1,.18-.47.62.62,0,0,1,.48-.19H18.18a.6.6,0,0,1,.46.19.66.66,0,0,1,.18.47V14.9h-2v1.32h2A1.35,1.35,0,0,0,19.76,15.84ZM17.52,7.69V5.06a1.31,1.31,0,0,0-.38-.92,1.34,1.34,0,0,0-.94-.38H8.34A1.3,1.3,0,0,0,7,5.06V7.69H8.34V5.06h7.87V7.69h1.31ZM8.34,12.93h7.87l0,5.26H8.34V12.93Zm7.87,5.26v0Zm.65,1.31a.6.6,0,0,0,.46-.19.72.72,0,0,0,.2-.47V12.29a.74.74,0,0,0-.2-.47.6.6,0,0,0-.46-.19H7.68a.6.6,0,0,0-.46.19.72.72,0,0,0-.2.47v6.55a.74.74,0,0,0,.2.47.6.6,0,0,0,.46.19h9.18ZM16.67,9.28a.7.7,0,0,0-.94,0,.63.63,0,0,0-.18.46.67.67,0,0,0,.18.47.68.68,0,0,0,.94,0,.66.66,0,0,0,.18-.47A.58.58,0,0,0,16.67,9.28Z" transform="translate(-4.25 -3.61)"/></g></svg>',template:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.27 15.64"><g><path d="M18.18,19.16a1,1,0,0,0,1-1V5.73a1,1,0,0,0-1-1h-2v1h2V18.19H6.37V5.73h2v-1h-2A.94.94,0,0,0,5.68,5a1,1,0,0,0-.29.7V18.18a.94.94,0,0,0,.29.69,1,1,0,0,0,.69.29H18.18ZM9.82,10.31h4.92a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H9.82a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15Zm5.9,4.92H8.83a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h6.89a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.51.51,0,0,0-.5-.5ZM7.36,12.77a.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h8.85a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H7.85a.49.49,0,0,0-.35.15.52.52,0,0,0-.14.35Z" transform="translate(-5.14 -3.77)"/><path d="M14.24,6.71a1,1,0,0,0,1-1,1,1,0,0,0-1-1,1,1,0,0,0-1-1h-2a.94.94,0,0,0-.69.28,1,1,0,0,0-.29.7A.94.94,0,0,0,9.62,5a.91.91,0,0,0-.29.69,1,1,0,0,0,.29.7,1,1,0,0,0,.69.29h3.93Z" transform="translate(-5.14 -3.77)"/></g></svg>',layout:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="5 5 36 36"><path d="M12.5 34.05h11v-3h-11Zm6-8.55h11v-3h-11Zm6-8.55h11v-3h-11ZM9 42q-1.2 0-2.1-.9Q6 40.2 6 39V9q0-1.2.9-2.1Q7.8 6 9 6h30q1.2 0 2.1.9.9.9.9 2.1v30q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h30V9H9v30ZM9 9v30V9Z"/></svg>',new_document:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12.78 15.75"><g><path d="M14.73,3.76,18.67,7.7v9.84a2,2,0,0,1-2,2H7.84a1.89,1.89,0,0,1-1.38-.58,2,2,0,0,1-.57-1.39V5.73a1.93,1.93,0,0,1,.57-1.38,2,2,0,0,1,1.38-.58h6.62l.26,0v0Zm2.95,4.92h-2a1.93,1.93,0,0,1-1.38-.57,2,2,0,0,1-.58-1.4V6.17c0-.36,0-.84,0-1.43H7.85a1,1,0,0,0-.7.29,1,1,0,0,0-.29.7V17.54a1,1,0,0,0,.29.69,1,1,0,0,0,.69.29h8.85a1,1,0,0,0,.71-.29.92.92,0,0,0,.28-.69Zm0-1L14.73,4.74v2A1,1,0,0,0,15,7.4a1,1,0,0,0,.69.29Z" transform="translate(-5.89 -3.76)"/></g></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 13.56"><g><path d="M4.4,4.88V8.26a2,2,0,0,0,.5.39s.1,0,.18-.12a.62.62,0,0,0,.17-.28c.06-.19.13-.44.21-.74s.14-.52.19-.66a.58.58,0,0,1,.21-.3,2.41,2.41,0,0,1,.63-.21,3.83,3.83,0,0,1,.88-.12,9.15,9.15,0,0,1,1.31.06.16.16,0,0,1,.11,0,.26.26,0,0,1,.06.14,4,4,0,0,1,0,.49v2l.05,3.77c0,1.41,0,2.68-.05,3.81a1.79,1.79,0,0,1-.11.49,10.68,10.68,0,0,1-1.4.45,1.12,1.12,0,0,0-.69.43v.31l0,.22.61,0c.85-.08,1.54-.12,2.06-.12a19.76,19.76,0,0,1,2.09.08,15.08,15.08,0,0,0,1.64.08,1.4,1.4,0,0,0,.29,0,1.58,1.58,0,0,0,0-.26l-.05-.43a2.26,2.26,0,0,0-.43-.17l-.77-.22-.15,0a2.55,2.55,0,0,1-.78-.28,2.56,2.56,0,0,1-.11-.75l0-1.29,0-3.15V7.53a10.51,10.51,0,0,1,.06-1.2,3.83,3.83,0,0,1,.6,0l1.88,0a2.18,2.18,0,0,1,.38,0,.45.45,0,0,1,.23.17.9.9,0,0,1,.05.25c0,.16.06.35.1.58a3.33,3.33,0,0,0,.14.55A6.39,6.39,0,0,0,15,9a2.91,2.91,0,0,0,.6-.15,2.77,2.77,0,0,0,0-.46l0-.51,0-2.95-.25,0-.38,0L15,4.94a.71.71,0,0,1-.18.15.45.45,0,0,1-.25.07l-.29,0H8.75l-.15,0H7.45a17,17,0,0,1-1.86,0L5.36,5l-.25-.13ZM19.75,16.14h-.69v-9h.69A.4.4,0,0,0,20.13,7c.06-.11,0-.24-.1-.39L18.92,5.15a.52.52,0,0,0-.86,0L17,6.58c-.12.15-.16.28-.1.39s.18.16.38.16h.69v9h-.69a.4.4,0,0,0-.38.16c-.06.11,0,.24.1.39l1.11,1.43a.52.52,0,0,0,.86,0L20,16.69c.12-.15.16-.28.1-.39a.4.4,0,0,0-.38-.16Z" transform="translate(-4.4 -4.86)"/></g></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4A4,4 0 0,1 17,8A4,4 0 0,1 13,12H11V18H9V4H13M13,10A2,2 0 0,0 15,8A2,2 0 0,0 13,6H11V10H13Z" /></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M18.53,19.5l.2-.05A1.78,1.78,0,0,0,20.13,18l0-.09V7.14a2,2,0,0,0-.28-.64A3.18,3.18,0,0,0,19.43,6c-.5-.52-1-1-1.55-1.54A2.59,2.59,0,0,0,17.37,4a1.83,1.83,0,0,0-.61-.25H6l-.21,0a1.78,1.78,0,0,0-1.4,1.49l0,.1V17.87a2.49,2.49,0,0,0,.09.37,1.79,1.79,0,0,0,1.44,1.23l.09,0Zm-6.25-.6H6.92a.61.61,0,0,1-.68-.48.78.78,0,0,1,0-.22V12.3a.62.62,0,0,1,.69-.68H17.64a.62.62,0,0,1,.69.69V18.2a.64.64,0,0,1-.71.69H12.28ZM12,9.81H8.15a.63.63,0,0,1-.72-.71v-4a.64.64,0,0,1,.72-.72h7.66a.64.64,0,0,1,.72.72v4a.65.65,0,0,1-.74.72ZM13.5,5V9.18h1.78V5Z" transform="translate(-4.41 -3.76)"/></g></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,17H17L19,13V7H13V13H16M6,17H9L11,13V7H5V13H8L6,17Z" /></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 3H17C18.11 3 19 3.9 19 5V12.08C17.45 11.82 15.92 12.18 14.68 13H11V17H12.08C11.97 17.68 11.97 18.35 12.08 19H3C1.9 19 1 18.11 1 17V5C1 3.9 1.9 3 3 3M3 7V11H9V7H3M11 7V11H17V7H11M3 13V17H9V13H3M22.78 19.32L21.71 18.5C21.73 18.33 21.75 18.17 21.75 18S21.74 17.67 21.71 17.5L22.77 16.68C22.86 16.6 22.89 16.47 22.83 16.36L21.83 14.63C21.77 14.5 21.64 14.5 21.5 14.5L20.28 15C20 14.82 19.74 14.65 19.43 14.53L19.24 13.21C19.23 13.09 19.12 13 19 13H17C16.88 13 16.77 13.09 16.75 13.21L16.56 14.53C16.26 14.66 15.97 14.82 15.71 15L14.47 14.5C14.36 14.5 14.23 14.5 14.16 14.63L13.16 16.36C13.1 16.47 13.12 16.6 13.22 16.68L14.28 17.5C14.26 17.67 14.25 17.83 14.25 18S14.26 18.33 14.28 18.5L13.22 19.32C13.13 19.4 13.1 19.53 13.16 19.64L14.16 21.37C14.22 21.5 14.35 21.5 14.47 21.5L15.71 21C15.97 21.18 16.25 21.35 16.56 21.47L16.75 22.79C16.77 22.91 16.87 23 17 23H19C19.12 23 19.23 22.91 19.25 22.79L19.44 21.47C19.74 21.34 20 21.18 20.28 21L21.5 21.5C21.64 21.5 21.77 21.5 21.84 21.37L22.84 19.64C22.9 19.53 22.87 19.4 22.78 19.32M18 19.5C17.17 19.5 16.5 18.83 16.5 18S17.18 16.5 18 16.5 19.5 17.17 19.5 18 18.84 19.5 18 19.5Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5 8C21.43 8 23 6.43 23 4.5C23 2.57 21.43 1 19.5 1C17.57 1 16 2.57 16 4.5C16 6.43 17.57 8 19.5 8M21 16V9.79C20.5 9.93 20 10 19.5 10C19.33 10 19.17 10 19 10V16C19 17.66 17.66 19 16 19H8C6.34 19 5 17.66 5 16V8C5 6.34 6.34 5 8 5H14C14 4.84 14 4.67 14 4.5C14 4 14.07 3.5 14.21 3H8C5.24 3 3 5.24 3 8V16C3 18.76 5.24 21 8 21H16C18.76 21 21 18.76 21 16Z" /></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.66 15.67"><g><path d="M19.72,5.58a1.64,1.64,0,0,0-1.64-1.64H6.23a1.62,1.62,0,0,0-1.16.48,1.63,1.63,0,0,0-.48,1.16V9.63a1.6,1.6,0,0,0,.48,1.16,1.62,1.62,0,0,0,1.16.47H18.09a1.67,1.67,0,0,0,1.16-.47,1.62,1.62,0,0,0,.48-1.16V5.58Zm-.94,4.05a.68.68,0,0,1-.7.7H6.23a.66.66,0,0,1-.48-.2.74.74,0,0,1-.21-.5V5.58a.66.66,0,0,1,.2-.48.71.71,0,0,1,.48-.21H18.08a.74.74,0,0,1,.5.21.66.66,0,0,1,.2.48ZM6.48,7.72a.21.21,0,0,0,.17-.07.22.22,0,0,0,.07-.17V7.06a1.27,1.27,0,0,1,.11-.52.37.37,0,0,1,.36-.23H8.77A.25.25,0,0,0,9,6.17a.19.19,0,0,0,0-.23.27.27,0,0,0-.2-.12H7.19a.88.88,0,0,0-.72.39,1.51,1.51,0,0,0-.23.85v.42a.24.24,0,0,0,.24.24Zm-.19.81a.21.21,0,0,0,.17-.07.26.26,0,0,0,.07-.17.24.24,0,0,0-.24-.24.2.2,0,0,0-.16.09.2.2,0,0,0-.07.16.22.22,0,0,0,.07.17.23.23,0,0,0,.16.06Zm8.46,5.1a1.63,1.63,0,0,0-.47-1.16A1.61,1.61,0,0,0,13.12,12H6.23a1.6,1.6,0,0,0-1.16.46,1.62,1.62,0,0,0-.48,1.16v4.05a1.64,1.64,0,0,0,1.64,1.64h6.89a1.6,1.6,0,0,0,1.16-.48,1.62,1.62,0,0,0,.47-1.16Zm-.94,4a.7.7,0,0,1-.2.49.65.65,0,0,1-.5.2H6.23a.66.66,0,0,1-.48-.2.75.75,0,0,1-.21-.49v-4a.74.74,0,0,1,.21-.5.66.66,0,0,1,.48-.2h6.89a.68.68,0,0,1,.7.7v4Zm6.15,0v-4a1.6,1.6,0,0,0-.48-1.16A1.67,1.67,0,0,0,18.32,12H17.1a1.63,1.63,0,0,0-1.16.47,1.61,1.61,0,0,0-.47,1.16v4a1.67,1.67,0,0,0,.47,1.16,1.62,1.62,0,0,0,1.16.48h1.22A1.64,1.64,0,0,0,20,17.68Zm-.94-4v4a.75.75,0,0,1-.21.49.62.62,0,0,1-.48.2H17.11a.69.69,0,0,1-.5-.2.7.7,0,0,1-.2-.49v-4a.68.68,0,0,1,.7-.7h1.22a.66.66,0,0,1,.48.2.72.72,0,0,1,.21.5Z" transform="translate(-4.44 -3.79)"/></g></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.77"><g><path d="M8.77,8.72a.88.88,0,0,1-.61-.27.82.82,0,0,1-.25-.61.89.89,0,0,1,.25-.62A.82.82,0,0,1,8.77,7a.81.81,0,0,1,.61.25.83.83,0,0,1,.27.62.81.81,0,0,1-.25.61.91.91,0,0,1-.63.27Zm9.62-5a1.74,1.74,0,0,1,1.76,1.76V17.76a1.74,1.74,0,0,1-1.76,1.76H6.16A1.74,1.74,0,0,1,4.4,17.76V5.51A1.74,1.74,0,0,1,6.16,3.75H18.39Zm0,1.75H6.16v8L8.53,11.8a.94.94,0,0,1,.54-.17.86.86,0,0,1,.54.2L11.09,13l3.64-4.55a.78.78,0,0,1,.34-.25.85.85,0,0,1,.42-.07.89.89,0,0,1,.39.12.78.78,0,0,1,.28.29l2.24,3.67V5.51Zm0,12.24V15.6L15.3,10.53,11.89,14.8a.89.89,0,0,1-.59.32.82.82,0,0,1-.64-.18L9,13.62,6.16,15.74v2Z" transform="translate(-4.4 -3.75)"/></g></svg>',video:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.55"><g><path d="M20.15,10.26V18.9l-3.94-1.57v1.2H4.41V10.66H16.22v1.23l2-.81,2-.82ZM14.64,17h0V12.54h0v-.31H6V17h8.67Zm3.94-.37v-4l-2.37,1v2l1.18.48,1.19.48ZM7.94,9.86A2.77,2.77,0,0,1,5.19,7.11a2.76,2.76,0,0,1,5.51,0A2.78,2.78,0,0,1,7.94,9.86Zm0-3.93a1.21,1.21,0,0,0-.83.35,1.15,1.15,0,0,0-.34.84A1.09,1.09,0,0,0,7.11,8,1.15,1.15,0,0,0,8,8.28,1.13,1.13,0,0,0,9.11,7.12,1.16,1.16,0,0,0,7.94,5.93Zm5.9,3.93a2.34,2.34,0,0,1-1.67-.68,2.3,2.3,0,0,1-.68-1.67,2.35,2.35,0,0,1,4-1.67,2.37,2.37,0,0,1,0,3.34,2.33,2.33,0,0,1-1.68.68Zm0-3.14a.75.75,0,1,0,.55.22.73.73,0,0,0-.55-.22Z" transform="translate(-4.41 -4.35)"/></g></svg>',link:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M13.05,13.63a.24.24,0,0,1,.15.22L13.42,16a.19.19,0,0,1-.08.18l-2.12,2.14a4.08,4.08,0,0,1-1.29.85A4,4,0,0,1,4.71,17a3.92,3.92,0,0,1-.3-1.52A4,4,0,0,1,4.71,14a3.91,3.91,0,0,1,.87-1.3L7.7,10.56a.25.25,0,0,1,.2-.06l2.17.22a.21.21,0,0,1,.19.15.24.24,0,0,1,0,.25L7.12,14.23a1.81,1.81,0,0,0,0,2.58,1.78,1.78,0,0,0,1.29.52,1.74,1.74,0,0,0,1.28-.52L12.8,13.7a.24.24,0,0,1,.25-.07ZM19,4.92a4,4,0,0,1,0,5.66L16.86,12.7a.25.25,0,0,1-.17.08l-2.2-.23a.21.21,0,0,1-.19-.15.22.22,0,0,1,0-.25L17.44,9a1.81,1.81,0,0,0,0-2.58,1.78,1.78,0,0,0-1.29-.52,1.74,1.74,0,0,0-1.28.52L11.76,9.57a.21.21,0,0,1-.25,0,.24.24,0,0,1-.16-.21l-.22-2.17a.19.19,0,0,1,.08-.18l2.12-2.14a4.08,4.08,0,0,1,1.29-.85,4.05,4.05,0,0,1,3.06,0,3.85,3.85,0,0,1,1.3.85ZM5.84,9.82a.25.25,0,0,1-.18-.08.19.19,0,0,1-.07-.19l.11-.77a.2.2,0,0,1,.11-.17.24.24,0,0,1,.2,0l2.5.72a.25.25,0,0,1,.15.27.22.22,0,0,1-.23.21l-2.59,0Zm4.12-2-.73-2.5a.27.27,0,0,1,0-.2A.21.21,0,0,1,9.41,5L10.19,5a.25.25,0,0,1,.19,0,.23.23,0,0,1,.08.18l-.05,2.61a.2.2,0,0,1-.19.23h0A.22.22,0,0,1,10,7.85Zm8.76,5.58a.25.25,0,0,1,.18.08.23.23,0,0,1,.06.2l-.11.77a.25.25,0,0,1-.11.17.21.21,0,0,1-.12,0l-.08,0L16,14a.25.25,0,0,1-.15-.27.22.22,0,0,1,.22-.21l1.29,0,1.33,0Zm-4.12,2,.74,2.51a.28.28,0,0,1,0,.2.23.23,0,0,1-.18.11l-.8.11a.23.23,0,0,1-.17-.07.25.25,0,0,1-.08-.18l0-2.61a.22.22,0,0,1,.22-.22.21.21,0,0,1,.26.15Z" transform="translate(-4.41 -3.77)"/></g></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 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.42,5.29C11.32,5.19 10.35,6 10.25,7.11L10,10H12.82V12H9.82L9.38,17.07C9.18,19.27 7.24,20.9 5.04,20.7C3.79,20.59 2.66,19.9 2,18.83L3.5,17.33C3.83,18.38 4.96,18.97 6,18.63C6.78,18.39 7.33,17.7 7.4,16.89L7.82,12H4.82V10H8L8.27,6.93C8.46,4.73 10.39,3.1 12.6,3.28C13.86,3.39 15,4.09 15.66,5.17L14.16,6.67C13.91,5.9 13.23,5.36 12.42,5.29M22,13.65L20.59,12.24L17.76,15.07L14.93,12.24L13.5,13.65L16.35,16.5L13.5,19.31L14.93,20.72L17.76,17.89L20.59,20.72L22,19.31L19.17,16.5L22,13.65Z" /></svg>',unlink:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M19,18.32a4,4,0,0,0,0-5.68L15.85,9.5l-1.17,1.55L17.57,14a2,2,0,0,1,.61,1.47,2.08,2.08,0,0,1-2.09,2.09,2,2,0,0,1-1.47-.61l-.38-.37-1.74,1,.8.78a4,4,0,0,0,5.68,0ZM8,9.77a2,2,0,0,1-1.27-1,1.89,1.89,0,0,1-.21-1.57A2.1,2.1,0,0,1,7.45,6,2,2,0,0,1,9,5.76L12.27,7.2l.49-2L9.48,3.9a4,4,0,0,0-3.06.41A3.82,3.82,0,0,0,4.56,6.73a3.8,3.8,0,0,0,.4,3A3.78,3.78,0,0,0,7.39,11.6l5.38,2,.49-2-2.64-.94L8,9.77Z" transform="translate(-4.41 -3.76)"/></g></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>',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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M15.7,1.3c-0.1-0.1-0.1-0.2-0.2-0.2L15.3,1H0.4L0.3,1.1c0,0-0.1,0.1-0.1,0.1c0,0-0.1,0.1-0.1,0.1L0,1.4v7.7l0.1,0.1c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h2.3V9.3l0.1-0.5L3,8.5l0.1-0.2c-0.1,0-0.2,0-0.3,0H1.2v-6h13.3v6h-1.6c-0.1,0-0.2,0-0.3,0l0.1,0.2l0.2,0.4C12.9,9,13,9.2,13,9.3v0.1h2.3l0.2-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1V1.4L15.7,1.3z"/><path d="M10.5,7.5C9.9,7.1,9.3,6.8,8.6,6.7c-0.2,0-0.5-0.1-0.7,0c-0.2,0-0.5,0-0.7,0C6.6,6.7,6.1,6.9,5.6,7.3C5.2,7.6,4.7,8,4.4,8.4C4.3,8.6,4.2,8.8,4.2,8.9C4.1,9.1,4,9.3,3.9,9.4C3.9,9.6,3.8,9.7,3.8,9.9c0,0.2-0.1,0.3-0.1,0.5v-0.1c-0.1,0.8,0.1,1.6,0.5,2.4c0.4,0.7,1,1.3,1.7,1.7c0.3,0.2,0.6,0.3,0.9,0.3c0.3,0.1,0.7,0.1,1,0.1c0.3,0,0.7,0,1-0.1c0.3-0.1,0.6-0.2,0.9-0.3c0.5-0.3,0.9-0.6,1.3-1c0.3-0.4,0.6-0.8,0.8-1.3c0.1-0.4,0.2-0.9,0.2-1.4c0-0.5-0.1-1-0.3-1.4C11.5,8.6,11.1,8,10.5,7.5z M10.1,11.3H8.5v1.6H8H7.9H7.3v0v-0.1v-1.4H5.7v-0.4v-0.2v-0.6h0h1.5V8.5h1.2v1.6h1.6V11.3z"/></g></svg>',insert_row_above:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M0.1,14.5c0.1,0.1,0.1,0.2,0.2,0.2l0.1,0.1h14.9l0.1-0.1c0,0,0.1-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1l0.1-0.1V6.7l-0.1-0.1c0-0.1-0.1-0.1-0.2-0.2l-0.1-0.1h-2.3v0.1l-0.1,0.5l-0.2,0.4l-0.1,0.2c0.1,0,0.2,0,0.3,0h1.6v6H1.3v-6h1.6c0.1,0,0.2,0,0.3,0L3.1,7.3L2.9,6.9C2.8,6.8,2.8,6.6,2.7,6.5V6.3H0.4L0.3,6.4c-0.1,0-0.1,0.1-0.2,0.2L0,6.7v7.7L0.1,14.5z"/><path d="M5.3,8.3c0.6,0.5,1.2,0.8,1.9,0.9c0.2,0,0.5,0.1,0.7,0c0.2,0,0.5,0,0.7,0c0.6-0.1,1.1-0.3,1.6-0.6c0.5-0.3,0.9-0.7,1.2-1.2c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.4,0.2-0.5c0.1-0.1,0.1-0.3,0.1-0.4C12,5.8,12,5.6,12,5.4v0.1c0.1-0.8-0.1-1.6-0.5-2.4c-0.4-0.7-1-1.3-1.7-1.7C9.5,1.3,9.2,1.2,8.9,1.1C8.5,1,8.2,1,7.9,1c-0.3,0-0.7,0-1,0.1C6.6,1.2,6.3,1.3,6,1.4C5.5,1.7,5.1,2,4.7,2.4C4.4,2.8,4.1,3.3,3.9,3.8C3.8,4.2,3.7,4.7,3.7,5.2c0,0.5,0.1,1,0.3,1.4C4.3,7.2,4.7,7.8,5.3,8.3z M5.7,4.5h1.6V2.9h0.5h0.1h0.6v0v0.1v1.4H10v0.4v0.2v0.6h0H8.5v1.6H7.3V5.7H5.7V4.5z"/></g></svg>',insert_column_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M14.5,15.7c0.1-0.1,0.2-0.1,0.2-0.2l0.1-0.1V0.4l-0.1-0.1c0,0-0.1-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1L14.4,0H6.7L6.6,0.1c-0.1,0-0.1,0.1-0.2,0.2L6.3,0.4v2.3h0.1l0.5,0.1L7.3,3l0.2,0.1c0-0.1,0-0.2,0-0.3V1.2h6v13.3h-6v-1.6c0-0.1,0-0.2,0-0.3l-0.2,0.1l-0.4,0.2C6.7,12.9,6.6,13,6.4,13H6.3v2.3l0.1,0.2c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h7.7L14.5,15.7z"/><path d="M8.3,10.5C8.7,10,9,9.3,9.1,8.6c0-0.2,0.1-0.5,0-0.7c0-0.2,0-0.5,0-0.7C9,6.7,8.8,6.1,8.5,5.7C8.2,5.2,7.8,4.8,7.3,4.5C7.2,4.4,7,4.3,6.9,4.2C6.7,4.1,6.5,4,6.4,4C6.2,3.9,6.1,3.9,5.9,3.8c-0.2,0-0.3-0.1-0.5-0.1h0.1C4.7,3.7,3.8,3.9,3.1,4.3C2.4,4.7,1.8,5.3,1.4,6C1.3,6.3,1.2,6.6,1.1,6.9C1,7.2,1,7.6,1,7.9c0,0.3,0,0.7,0.1,1c0.1,0.3,0.2,0.6,0.3,0.9c0.3,0.5,0.6,0.9,1,1.3c0.4,0.3,0.8,0.6,1.3,0.8C4.2,12,4.7,12.1,5.1,12c0.5,0,1-0.1,1.4-0.3C7.2,11.5,7.8,11.1,8.3,10.5zM4.5,10.1V8.5H2.9V8V7.9V7.3h0H3h1.4V5.7h0.4h0.2h0.6v0v1.5h1.6v1.2H5.7v1.6H4.5z"/></g></svg>',insert_column_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M1.3,0.1C1.2,0.2,1.1,0.2,1.1,0.3L1,0.4v14.9l0.1,0.1c0,0,0.1,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1l0.1,0.1h7.7l0.1-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1v-2.3H9.3l-0.5-0.1l-0.4-0.2l-0.2-0.1c0,0.1,0,0.2,0,0.3v1.6h-6V1.3h6v1.6c0,0.1,0,0.2,0,0.3l0.2-0.1l0.4-0.2C9,2.9,9.2,2.8,9.3,2.8h0.1V0.5L9.4,0.3c0-0.1-0.1-0.1-0.2-0.2L9.1,0H1.4L1.3,0.1z"/><path d="M7.5,5.3C7,5.8,6.7,6.5,6.6,7.2c0,0.2-0.1,0.5,0,0.7c0,0.2,0,0.5,0,0.7c0.1,0.6,0.3,1.1,0.6,1.6c0.3,0.5,0.7,0.9,1.2,1.2c0.2,0.1,0.3,0.2,0.5,0.3c0.2,0.1,0.4,0.2,0.5,0.2c0.1,0.1,0.3,0.1,0.4,0.1c0.2,0,0.3,0.1,0.5,0.1h-0.1c0.8,0.1,1.6-0.1,2.4-0.5c0.7-0.4,1.3-1,1.7-1.7c0.2-0.3,0.3-0.6,0.3-0.9c0.1-0.3,0.1-0.7,0.1-1c0-0.3,0-0.7-0.1-1c-0.1-0.3-0.2-0.6-0.3-0.9c-0.3-0.5-0.6-0.9-1-1.3C13,4.4,12.5,4.2,12,4c-0.4-0.1-0.9-0.2-1.4-0.2c-0.5,0-1,0.1-1.4,0.2C8.5,4.3,7.9,4.7,7.5,5.3z M11.3,5.7v1.6h1.6v0.5v0.1v0.6h0h-0.1h-1.4v1.6h-0.4h-0.2h-0.6v0V8.5H8.5V7.3h1.6V5.7H11.3z"/></g></svg>',delete_row:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 13.83"><g><path d="M4.7,18.46l.12.08H19.73l.12-.08a.58.58,0,0,0,.22-.22l.08-.12,0-7.69-.08-.11a.77.77,0,0,0-.18-.18l-.11-.08-2.31,0-.08.28-.1.29a1.58,1.58,0,0,1-.12.29l-.14.34s0,0,.18,0H18.9v6H5.64v-6H7.35c.14,0,.2,0,.18,0l-.14-.34a2.85,2.85,0,0,1-.12-.29l-.1-.29-.07-.27-2.31,0-.11.08a.77.77,0,0,0-.18.18l-.08.11,0,7.69.08.12a.47.47,0,0,0,.09.12l.13.09ZM12.11,13a4,4,0,0,0,1.46-.21,4.51,4.51,0,0,0,1.31-.71A4,4,0,0,0,16.26,10a4.32,4.32,0,0,0-.08-2.54,4.34,4.34,0,0,0-1-1.52,4.15,4.15,0,0,0-1.54-1,4.34,4.34,0,0,0-1.35-.22A4.07,4.07,0,0,0,11,4.93,3.94,3.94,0,0,0,9.24,6.07,3.92,3.92,0,0,0,8.15,8.88a3.91,3.91,0,0,0,.12.95A4.16,4.16,0,0,0,12.11,13Zm2.35-4.14v.58H10.09V8.27h4.37v.58Z" transform="translate(-4.4 -4.71)"/></g></svg>',delete_column:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.81 15.74"><g><path d="M5.66,19.42l.12.08,7.69,0,.11-.08a.77.77,0,0,0,.18-.18l.08-.11,0-2.32-.15,0-.45-.15-.42-.18-.17-.07a1,1,0,0,0,0,.27v1.63h-6V5h6V6.62a.9.9,0,0,0,0,.26l.17-.07.42-.17a3.91,3.91,0,0,1,.45-.15l.15,0,0-2.32L13.75,4a.77.77,0,0,0-.18-.18l-.11-.08H5.79l-.13.07a.63.63,0,0,0-.21.22l-.08.12V19.08l.08.12a.47.47,0,0,0,.09.12.35.35,0,0,0,.12.1Zm9-3.67a4.16,4.16,0,0,0,2.36-.51,4.08,4.08,0,0,0,1.67-1.72,4,4,0,0,0,.35-.91,3.79,3.79,0,0,0,.1-1,4.71,4.71,0,0,0-.11-1,5,5,0,0,0-.3-.87,4.25,4.25,0,0,0-1-1.25,4.49,4.49,0,0,0-1.34-.81A4.26,4.26,0,0,0,15,7.48a3.88,3.88,0,0,0-1.41.25A4.32,4.32,0,0,0,11.86,9,4,4,0,0,0,11,10.94a4.4,4.4,0,0,0-.05.68,4.5,4.5,0,0,0,.05.68,3.93,3.93,0,0,0,.61,1.57,4.22,4.22,0,0,0,1.18,1.2,4.59,4.59,0,0,0,.48.27c.2.1.37.17.5.22a2.44,2.44,0,0,0,.45.12,4.61,4.61,0,0,0,.5.07Zm2.54-4.12v.58H12.87V11h4.37v.59Z" transform="translate(-5.37 -3.76)"/></g></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="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" /></svg>',image_gallery:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="30 30 150 150"><g><path d="M152.775,120.548V51.651c0-12.271-9.984-22.254-22.254-22.254H43.727c-12.271,0-22.254,9.983-22.254,22.254v68.896c0,12.27,9.983,22.254,22.254,22.254h86.795C142.791,142.802,152.775,132.817,152.775,120.548z M36.394,51.651c0-4.042,3.291-7.333,7.333-7.333h86.795c4.042,0,7.332,3.291,7.332,7.333v23.917l-14.938-17.767c-1.41-1.678-3.487-2.649-5.68-2.658h-0.029c-2.184,0-4.255,0.954-5.674,2.613L76.709,98.519l-9.096-9.398c-1.427-1.474-3.392-2.291-5.448-2.273c-2.052,0.025-4.004,0.893-5.396,2.4L36.394,111.32V51.651z M41.684,127.585l20.697-22.416l9.312,9.622c1.461,1.511,3.489,2.334,5.592,2.27c2.101-0.066,4.075-1.013,5.44-2.612l34.436-40.308l20.693,24.613v21.794c0,4.042-3.29,7.332-7.332,7.332H43.727C43.018,127.88,42.334,127.775,41.684,127.585z M182.616,152.5V75.657c0-4.12-3.34-7.46-7.461-7.46c-4.119,0-7.46,3.34-7.46,7.46V152.5c0,4.112-3.347,7.46-7.461,7.46h-94c-4.119,0-7.46,3.339-7.46,7.459c0,4.123,3.341,7.462,7.46,7.462h94C172.576,174.881,182.616,164.841,182.616,152.5z"/></g></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_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>',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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 3.58"><g><path d="M4.64,10.73a1.84,1.84,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0A1.79,1.79,0,0,1,8,11.63a1.84,1.84,0,0,1-.25.9,1.69,1.69,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2.08,2.08,0,0,1,4.64,10.73Zm6.09,0a1.84,1.84,0,0,1,.65-.65,1.78,1.78,0,0,1,2.67,1.55,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.76,1.76,0,0,1-1.79,0,1.79,1.79,0,0,1-.64-2.44Zm6.08,0a1.69,1.69,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0,1.79,1.79,0,0,1,.9,1.54,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2,2,0,0,1,16.81,10.73Z" transform="translate(-4.39 -9.84)"/></g></svg>',more_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3.94 15.75"><g><path d="M12.28,7.69a1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,2,2,0,0,1,1.39-.58,1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58Zm0,2a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39A1.92,1.92,0,0,1,13.67,13a2,2,0,0,1-1.39.58A1.92,1.92,0,0,1,10.89,13a2,2,0,0,1-.58-1.39,2,2,0,0,1,2-2Zm0,5.9a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58,1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,1.94,1.94,0,0,1,1.39-.58Z" transform="translate(-10.31 -3.75)"/></g></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="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z" /></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>',erase:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.76"><g><path d="M13.69,17.2h6.46v1.31H8.56L4.41,14.37,14,4.75l6.06,6.06L16.89,14l-3.2,3.19Zm-4.61,0h2.77L14.09,15,9.88,10.75,6.25,14.38l1.41,1.41c.84.82,1.31,1.29,1.42,1.41Z" transform="translate(-4.41 -4.75)"/></g></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 st=i("cfbI"),nt=i.n(st);const ot=function(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],["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",X(i.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",-1],["historyIndex",-1],["savedIndex",-1]]);o&<(o,a);const h=e.querySelector(".se-placeholder");return h&&a.set("placeholder",h),a},lt=function(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")},rt=function(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},at=Y._d,ht=[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],ct=["px","pt","em","rem"],dt={script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},ut={"table|th|td":"border|border-[a-z]+|background-color|text-align|float|font-weight|text-decoration|font-style","ol|ul":"list-style-type"},pt="font-family|font-size|color|background-color",gt=["repeat","always","none"],mt=["mode","type","externalLibs","keepStyleOnDelete","iframe","convertTextTags","textStyleTags","fontSizeUnits","spanStyles","lineStyles","tagStyles","reverseCommands","shortcutsDisable","shortcuts","buttonList","subToolbar","toolbar_container","statusbar_container","elementWhitelist","elementBlacklist","attributeWhitelist","attributeBlacklist","defaultLine","formatClosureBrLine","formatBrLine","formatLine","formatClosureBlock","formatBlock","__defaultElementWhitelist","__defaultAttributeWhitelist","__listCommonStyle","icons","lang","codeMirror"];function ft(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=0;g<i.length;g+=2)h=i[g],c=/^s/i.test(h),u=tt.get(h)+(c?1e3:0),s.has(u)||(p=n.indexOf(t),p=-1===p?"":tt.isOdd(p)?n[p+1]:n[p-1],p&&o.push(u),s.set(u,{c:t,r:p,t:e.getAttribute("data-type"),e})),(d=i[g+1])&&l&&(r=c,a=d,l.appendChild(Q.createElement("SPAN",{class:"se-shortcut"},Y.cmdIcon+(r?Y.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>")));var r,a}function _t(t,e){return[t,e].reduce(((t,e)=>{for(const i in e)t[i]=(e[i]||"").toLowerCase();return t}),{})}function bt(t,e,i){const s=t.buttonList||ht,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);const o=!1!==t.strictMode;n.set("strictMode",{tagFilter:o,formatFilter:o,classFilter:o,styleNodeFilter:o,attrFilter:o,styleFilter:o,...t.strictMode}),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("type-options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("keepStyleOnDelete",!!t.keepStyleOnDelete),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):ct),n.set("allowedClassName",new RegExp((t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":"")+"^__se__|^se-|^katex|^MathJax")),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTab",t.syncTab??!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||gt.includes(l)||(console.error(`Invalid retainStyleMode: ${l}. Valid options are ${gt.join(", ")}. Using default 'once'.`),l="repeat"),n.set("retainStyleMode",l);const r={...dt,...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:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary")+(t.textStyleTags?"|"+t.textStyleTags:""));const d=_t({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",[{...ut,...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](${pt}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](text-align|margin-left|margin-right|line-height${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",_t(J.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("-")),tt.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("_rtl")?" se-rtl":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass:null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p");const u=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),p=n.get("externalLibs").mathjax?"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover|":"";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",xt(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:"").toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",xt((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:"PRE").toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",xt("div|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:"P|H[1-6]|LI|TH|TD|DETAILS").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",xt(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:"TH|TD").toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",xt((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS").toLowerCase(),n.get("elementBlacklist"))),n.set("__defaultElementWhitelist","br|div|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary").toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:"contenteditable|target|href|title|download|rel|src|alt|class|type|controls|colspan|rowspan").toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|");return(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))).join("|")}(n)),n.set("toolbar_width",t.toolbar_width?tt.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?at.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:/^\d+/.test(t.toolbar_sticky)?tt.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?tt.is(b.width)?b.width+"px":b.width:"auto"),_=n.get("_rtl")?b.buttonList.reverse():b.buttonList));for(let i=0,s=e.length;i<s;i++)yt(e[i].options||{},t,e[i].options=new Map);n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const v=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["65","A"],bold:["66","B"],strike:["s83","S"],underline:["85","U"],italic:["73","I"],redo:["89","Y","s90","Z"],undo:["90","Z"],indent:["221","]"],outdent:["219","["],sup:["187","="],sub:["s187","="],save:["83","S"],link:["75","K"]},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:/^\d+/.test(t.fullScreenOffset)?tt.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 y=n.get("externalLibs").codeMirror;y&&(n.set("codeMirror",y),y.EditorView?n.set("codeMirror6Editor",!0):y.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 C=t.icons&&"object"==typeof t.icons?[it,t.icons].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):it;n.set("icons",C);const w=new Set("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|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".split("|")),x=t.spanStyles?.split("|")||[],E=n.get("__listCommonStyle"),S=pt.split("|");for(let t=0,e=S.length;t<e;t++)w.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++)w.add(e[t])}for(let t=0,e=x.length;t<e;t++)w.add(x[t]);for(let t=0,e=E.length;t<e;t++)w.add(E[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)w.add(T[t]);return n.set("allUsedStyles",w),{o:n,i:C,l:t.lang||nt(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?s.reverse():s,subButtons:_,statusbarContainer:"string"==typeof t.statusbar_container?at.querySelector(t.statusbar_container):t.statusbar_container}}function vt(t,e){let i=null,s=null,n=null;if(t.get("statusbar")&&(i=(e=e||Q.createElement("DIV",{class:"se-status-bar sun-editor-common"})).querySelector(".se-navigation")||Q.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(i),t.get("charCounter"))){if(s=e.querySelector(".se-char-counter-wrapper")||Q.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=s.querySelector(".se-char-label")||Q.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),s.appendChild(e)}if(n=s.querySelector(".se-char-counter")||Q.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",s.appendChild(n),t.get("charCounter_max")>0){const e=s.querySelector(".se-char-max")||Q.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 yt(t,e,i){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,v=s||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,y=!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,E=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?tt.is(r)?r+"px":r:"100%"),i.set("minWidth",(tt.is(a)?a+"px":a)||""),i.set("maxWidth",(tt.is(h)?h+"px":h)||""),i.set("height",c?tt.is(c)?c+"px":c:"auto"),i.set("minHeight",(tt.is(d)?d+"px":d)||""),i.set("maxHeight",(tt.is(u)?u+"px":u)||""),i.set("_defaultStyles",J._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 S=void 0===b||!!b;i.set("statusbar",S),i.set("statusbar_showPathLabel",!!S&&("boolean"!=typeof v||v)),i.set("statusbar_resizeEnable",!(!S||void 0!==y&&!y)),i.set("charCounter",w>0||"boolean"==typeof C&&C),i.set("charCounter_max",tt.is(w)&&w>-1?1*w:null),i.set("charCounter_label","string"==typeof x?x.trim():null),i.set("charCounter_type","string"==typeof E?E:"char")}function Ct(t,e,i,s){const n=s.get("_defaultStyles");i.style.cssText=n.top;const o=Q.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]);o.allowFullscreen=!0,o.frameBorder=0,o.style.cssText=n.frame}else o.setAttribute("contenteditable",!0),o.setAttribute("scrolling","auto"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=Q.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame});let r=null;return s.get("placeholder")&&(r=Q.createElement("SPAN",{class:"se-placeholder"}),r.innerText=s.get("placeholder")),{bottomBar:vt(s,null),wysiwygFrame:o,codeView:l,placeholder:r}}function wt(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?(Q.removeItem(i),s.className+=" se-code-viewer-mirror",s):i}function xt(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 Et(){const t=Q.createElement("UL",{class:"se-menu-list"});return{div:Q.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function St(t,e,i,s,n,o,l){const r=Q.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(s),c="se-toolbar-separator-vertical"===t?Q.createElement("DIV",{class:t,tabindex:"-1"},null):Q.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.setAttribute("disabled",!0),/^FIELD$/i.test(s)&&Q.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=Tt(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function Tt(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}function kt(t,e,i,s){if(!t)return;const n=!1===e.inner;if(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.afterButton&&(Q.addClass(e.afterButton,"se-toolbar-btn"),t.parentElement.appendChild(e.afterButton),Q.addClass(t,"se-side-btn-a"),Q.addClass(e.afterButton,"se-side-btn-after")),e.beforeButton&&(Q.addClass(e.beforeButton,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeButton,t),e.afterButton?(Q.addClass(t,"se-side-btn"),Q.removeClass(t,"se-side-btn-a")):Q.addClass(t,"se-side-btn-b"),Q.addClass(e.beforeButton,"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&&(Q.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.setAttribute("disabled",!0))}}function Nt(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],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]}}(i,s,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=Q.createElement("DIV",{class:"se-toolbar-more-layer"}),f=Q.createElement("DIV",{class:"se-btn-tray"}),_=Q.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let i,b,v,y,C,w=0;w<t.length;w++)if(i=!1,C="",y=t[w],p=Et(),"object"==typeof y){for(let f,_=0;_<y.length;_++){if(d=y[_],f=!1,u=e[d],/^%\d+/.test(d)&&0===_){y[0]=d.replace(/[^\d]/g,""),a.push(y),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.substr(1),p.div.className+=" module-float-"+C;continue}if(/^#/.test(d)){"fix"===d.substr(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);v="__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,v,"MORE",i]}else c="|"===d?["se-toolbar-separator-vertical","","","separator",""]: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=St(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=Q.createElement("DIV"),b.className="se-more-layer "+v,b.setAttribute("data-ref",v),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("|"===y){const t=_.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(y)){const t=Q.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:Q.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=Q.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{NO_EVENT:Lt}=Y,Ht={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};let Mt=null,At=null;const Bt=function(t,e){return Mt=this.eventManager.removeGlobalEvent("keydown",Mt),At=this.eventManager.removeGlobalEvent("mousedown",At),this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,Q.removeClass(t,"se-copy-format-cursor"),Q.removeClass(e,"on"),!0},It=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],Vt=It.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);function Rt(t,e){if("function"==typeof t._onCopyFormatInitMethod)return void t._onCopyFormatInitMethod();const i=t.frameContext.get("wysiwyg");t._onCopyFormatInfo=[...t.eventManager.__cacheStyleNodes],t._onCopyFormatInitMethod=Bt.bind(t,i,e),Q.addClass(i,"se-copy-format-cursor"),Q.addClass(e,"on"),Mt=t.eventManager.addGlobalEvent("keydown",(e=>{27===e.keyCode&&t._onCopyFormatInitMethod?.()})),At=t.eventManager.addGlobalEvent("mousedown",(s=>{i.contains(s.target)||s.target===e||t._onCopyFormatInitMethod?.()}))}const Ot=function(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._w=t._w,this._d=t._d,this._shadowRoot=t._shadowRoot},zt=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),{isMobile:$t}=Y;function Ft(t){let e=t.target;this.editor.isSubBalloon&&!this.context.get("toolbar.sub.main")?.contains(e)&&this._hideToolbar_sub();const i=Q.isInputElement(e);if(this.menu._bindControllersOff&&t.stopPropagation(),i?this.editor._antiBlur=!1:this.editor.frameContext.get("wysiwyg").contains(this.selection.getNode())||this.editor.focus(),Q.getParentElement(e,".se-dropdown"))t.stopPropagation(),this.editor._notHideToolbar=!0;else{let s=e.getAttribute("data-command"),n=e.className;for(;e&&!s&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(n);)e=e.parentNode,s=e.getAttribute("data-command"),n=e.className;if(i&&/^INPUT$/i.test(e?.getAttribute("data-type"))){this.editor._antiBlur=this._inputFocus=!0,this.status.hasFocus||this.applyTagEffect();const e=t.target;if(!Q.isInputElement(e)||e.disabled)return;const i=this.plugins[s];if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof i.onInputChange&&(this.__inputPlugin={obj:i,target:e,value:e.value}),this.__inputBlurEvent=this.addEvent(e,"blur",(t=>{if(!i.isInputActive)try{const s=e.value.trim();"function"==typeof i.onInputChange&&s!==this.__inputPlugin.value&&i.onInputChange({target:e,value:s,event:t})}finally{this._w.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!i)return;"function"==typeof i.onInputKeyDown&&(this.__inputKeyEvent=this.addEvent(e,"keydown",(t=>{i.onInputKeyDown({target:e,event:t})})))}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")||($t?this.editor._antiBlur=!0:(t.preventDefault(),Y.isGecko&&s&&this._injectActiveEvent(e)))}s!==this.menu.currentDropdownName&&s!==this.editor._containerName||t.stopPropagation()}}function Pt(t){const e=Q.getCommandTarget(t.target);if(!e)return;let i=e,s="";for(;i&&!/se-menu-tray/.test(i.className)&&!s;)i=i.parentElement,s=i.getAttribute("data-key");if(!s)return;const n=this.plugins[s];n&&"function"==typeof n.action&&(t.stopPropagation(),n.action(e))}function Dt(t){this.editor.runFromTarget(t.target)}const{_w:Wt}=Y;let Ut=null;function Zt(){this.editor.status._onMousedown=!1,Ut=this.removeGlobalEvent(Ut)}function qt(t,e){this.editor.status._onMousedown=!0,Ut&&Zt.call(this),Ut=this.addGlobalEvent("mouseup",Zt.bind(this)),t.get("isReadOnly")||Q.isNonEditable(t.get("wysiwyg"))||(this.format._isExcludeSelectionElement(e.target)?e.preventDefault():(this._setSelectionSync(),this._w.setTimeout(this.selection._init.bind(this.selection),0),!1!==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(e.target.nodeName)&&e.preventDefault())))}function Gt(t,e){!1!==this.triggerEvent("onMouseUp",{frameContext:t,event:e})&&this._callPluginEvent("onMouseUp",{frameContext:t,event:e})}function jt(t,e){const i=e.target;if(t.get("isReadOnly"))return e.preventDefault(),Q.isAnchor(i)&&Wt.open(i.href,i.target),!1;if(Q.isNonEditable(t.get("wysiwyg")))return;if(!1===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,!1);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.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&&!Q.isNonEditable(i)&&!Q.isList(l)){const t=this.selection.getRange();if(this.format.getLine(t.startContainer)===this.format.getLine(t.endContainer))if(Q.isList(l)){e.preventDefault();const t=n.nextElementSibling,i=Q.createElement("LI",null,n);l.insertBefore(i,t),this.editor.focus()}else Q.isWysiwygFrame(n)||this.component.is(n)||Q.isTableElements(n)&&!Q.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,null,[e.nodeName],!1),{parent:s,inner:n}=this.nodeTransform.createNestedNode(t);i.parentNode.insertBefore(s,i),n.appendChild(i),this.selection.setRange(i,Q.isZeroWith(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 Xt(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;!1!==zt.get("__overInfo")&&this._overComponentSelect(e.target),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}function Yt(t,e){!1!==this.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&this._callPluginEvent("onMouseLeave",{frameContext:t,event:e})}const{_w:Kt,isOSX_IOS:Jt}=Y,Qt=/^(8|3[2-9]|40|46)$/,te=/^(3[7-9]|40)$/,ee=/^(8|46)$/,ie=/^(8|9|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145|229)$/,se=/^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145|229)$/,ne=/^(13)$/,oe=new RegExp(K.zeroWidthSpace+"+","");let le=null;function re(t){const e=t.lastChild,i=t.nextElementSibling;if(Q.isZeroWith(i))return Q.removeItem(i),e;const s=i.childNodes;for(;s[0];)t.appendChild(s[0]);return Q.removeItem(i),e}function ae(t){const e=t.childNodes,i=t.previousElementSibling,s=e[0];if(Q.isZeroWith(i))return Q.removeItem(i),s;for(;e[0];)i.appendChild(e[0]);return Q.removeItem(t),s}function he(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;this.selection._init();const i=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this.char.test(i,!0))return e.preventDefault(),e.stopPropagation(),!1;!1!==this.triggerEvent("onInput",{frameContext:t,event:e,data:i})&&!1!==this._callPluginEvent("onInput",{frameContext:t,event:e,data:i})&&this.history.push(!0)}function ce(t,e){if(this.editor.selectMenuOn||!e.isTrusted)return;let i=this.selection.getNode();if(Q.isInputElement(i))return;if(this.menu.currentDropdownName)return;const s=e.keyCode,n=e.shiftKey,o=e.ctrlKey||e.metaKey||91===s||92===s||224===s,l=e.altKey;if(this.isComposing=229===s,!o&&t.get("isReadOnly")&&!Qt.test(s))return e.preventDefault(),!1;if(this.menu.dropdownOff(),this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),!1===this.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;if(o&&this.shortcuts.command(s,n))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;this._onShortcutKey&&(this._onShortcutKey=!1);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(!1===this._callPluginEvent("onKeyDown",{frameContext:t,event:e,range:r,line:h}))return;switch(s){case 8:{if(this.component.deselect(),le=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||Q.isEdgePoint(r.endContainer,r.endOffset,"front"))&&!r.endContainer.previousSibling&&this.format.isLine(h.previousElementSibling)){let t;return e.preventDefault(),e.stopPropagation(),r.collapsed?(t=ae(h),this.selection.setRange(t,0,t,0),void this.history.push(!0)):(this.html.remove(),h.contains(r.startContainer)?(t=re(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length)):(t=ae(h),this.selection.setRange(t,0,t,0)),void this.history.push(!0))}if(!a&&!h.previousElementSibling&&0===r.startOffset&&!i.previousSibling&&!Q.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(Q.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||Q.isZeroWith(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.parentElement.replaceChild(Q.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&&Q.isZeroWith(s)){let t=s.parentNode.previousSibling;const e=s.parentNode.nextSibling;t||(e?t=e:(t=Q.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):Q.isEdgePoint(r.startContainer,r.startOffset)?Q.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,!1)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!0)){e.preventDefault(),e.stopPropagation();break}!a&&this.format.isEdgeLine(r.startContainer,r.startOffset,"start")&&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&&!Q.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){if(Q.isListCell(h)&&Q.isList(c)&&(Q.isListCell(c.parentNode)||h.previousElementSibling)&&(i===h||3===i.nodeType&&(!i.previousSibling||Q.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.parentNode;if(Q.isListCell(t)){e.preventDefault();let i=t;if(!t.contains(h)&&Q.isListCell(i)&&Q.isList(i.lastElementChild)){for(i=i.lastElementChild.lastElementChild;Q.isListCell(i)&&Q.isList(i.lastElementChild);)i=i.lastElementChild&&i.lastElementChild.lastElementChild;t=i}let s=t===c.parentNode?c.previousSibling:t.lastChild;s||(s=Q.createTextNode(K.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;Q.removeItem(h),0===c.children.length&&Q.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&&!Q.isWysiwygFrame(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!Q.isZeroWith(i.previousSibling.textContent.trim()))){t=!1;break}i=i.parentNode}if(t&&c.parentNode){e.preventDefault(),this.format.removeBlock(c,Q.isListCell(h)?[h]:null,null,!1,!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||Q.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&&Q.removeItem(h),!1===this.component.select(t.target,t.pluginName,!1)&&this.editor.blur()):this.component.is(s)&&(e.preventDefault(),e.stopPropagation(),Q.removeItem(s));break}if(t&&Q.isNonEditable(t.previousSibling)){e.preventDefault(),e.stopPropagation(),Q.removeItem(t.previousSibling);break}}break}case 46:if(this.component.deselect(),le=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(this.format.isLine(h)&&(!r.collapsed||Q.isEdgePoint(r.startContainer,r.endOffset,"end"))&&!r.startContainer.nextSibling&&this.format.isLine(h.nextElementSibling)){let t;return e.preventDefault(),e.stopPropagation(),r.collapsed?(re(h),void this.history.push(!0)):(this.html.remove(),h.contains(r.startContainer)?(t=re(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length)):(t=ae(h),this.selection.setRange(t,0,t,0)),void this.history.push(!0))}if(!a&&h&&(r.endOffset===r.endContainer.textContent.length||i===h)){const t=i===h?this._isUneditableNode(r,!1):Q.isEdgePoint(r.endContainer,r.endOffset)?Q.getNextDeepestNode(r.endContainer,null):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),Q.isZeroWith(h.textContent)&&Q.removeItem(h),!1===this.component.select(i.target,i.pluginName,!1)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!1)){e.preventDefault(),e.stopPropagation();break}if((this.format.isLine(i)||null===i.nextSibling||Q.isZeroWith(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(),Q.isZeroWith(h)&&(Q.removeItem(h),Q.isTable(t))){let e=Q.getEdgeChild(t,Q.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,!1)&&this.editor.blur()):this.component.is(t)&&(e.stopPropagation(),Q.removeItem(t));break}}if(!a&&(Q.isEdgePoint(r.endContainer,r.endOffset)||i===h&&h.childNodes[r.startOffset])){const t=i===h&&h.childNodes[r.startOffset]||i;if(t&&Q.isNonEditable(t.nextSibling)){e.preventDefault(),e.stopPropagation(),Q.removeItem(t.nextSibling);break}if(this.component.is(t)){e.preventDefault(),e.stopPropagation(),Q.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),Q.isListCell(h)&&Q.isList(c)&&(i===h||3===i.nodeType&&(!i.nextSibling||Q.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();let t=Q.getArrayItem(h.children,Q.isList,!1);if(t=t||h.nextElementSibling||c.parentNode.nextElementSibling,t&&(Q.isList(t)||Q.getArrayItem(t.children,Q.isList,!1))){let i,s;if(e.preventDefault(),Q.isList(t)){const e=t.firstElementChild;for(s=e.childNodes,i=s[0];s[0];)h.insertBefore(s[0],t);Q.removeItem(e)}else{for(i=t.firstChild,s=t.childNodes;s[0];)h.appendChild(s[0]);Q.removeItem(t)}this.selection.setRange(i,0,i,0),this.history.push(!0)}break}break;case 9:{if(this.options.get("tabDisable"))break;if(e.preventDefault(),o||l||Q.isWysiwygFrame(i))break;const t=!r.collapsed||Q.isEdgePoint(r.startContainer,r.startOffset),s=this.format.getLines(null);i=this.selection.getNode();const a=[],c=[],d=Q.isListCell(s[0]),u=Q.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],Q.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(!Q.isZeroWith(t)){/^\s{1,4}$/.test(t.textContent)?Q.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=Q.getEdgeChild(c[0],"text",!1),i=Q.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("syncTab")){const e=Q.findTextIndexOnLine(h,r.startContainer,r.startOffset,this.component.is.bind(this.component)),i=this.format.isLine(h.previousElementSibling)?Q.findTabEndIndex(h.previousElementSibling,e,2):0;i>e&&(t=i-e+1)}const e=Q.createTextNode(new Array(t).join(" ")),i=this.html.insertNode(e,null,!1);if(!i)return!1;d||(p.sc=e,p.so=i.endOffset),u||(p.ec=e,p.eo=i.endOffset)}else{const t=Q.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&&(Q.isBreak(i)?c[s].insertBefore(t.cloneNode(!1),i):i.textContent=t.textContent+i.textContent);const i=Q.getEdgeChild(c[0],"text",!1),s=Q.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 13:{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=this.format.isEdgeLine(r.endContainer,r.endOffset,"end"),o=this.format.isEdgeLine(r.startContainer,r.startOffset,"start");if(n&&(/^H[1-6]$/i.test(h.nodeName)||/^HR$/i.test(h.nodeName))){this.__enterPrevent(e);let t=null;const i=this.format.addLine(h,this.options.get("defaultLine"));if(n&&n.length>0){t=n.pop();const e=t;for(;n.length>0;)t=t.appendChild(n.pop());i.appendChild(e)}if(t=t?t.appendChild(i.firstChild):i.firstChild,Q.isBreak(t)){const e=Q.createTextNode(K.zeroWidthSpace);t.parentNode.insertBefore(e,t),this.selection.setRange(e,1,e,1)}else this.selection.setRange(t,0,t,0);this.selection.scrollTo(r);break}if(c&&h&&!Q.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){const t=this.selection.getRange();if(Q.isEdgePoint(t.endContainer,t.endOffset)&&Q.isList(i.nextSibling)){this.__enterPrevent(e);const t=Q.createElement("BR"),s=Q.createElement("LI",null,t);h.parentNode.insertBefore(s,h.nextElementSibling),s.appendChild(i.nextSibling),this.selection.setRange(t,1,t,1),this.selection.scrollTo(r);break}if((3!==t.commonAncestorContainer.nodeType||!t.commonAncestorContainer.nextElementSibling)&&Q.isZeroWith(h.innerText.trim())&&!Q.isListCell(h.nextElementSibling)){this.__enterPrevent(e);let t=null;if(Q.isListCell(c.parentNode)){const e=h.parentNode.parentNode;c=e.parentNode;const i=Q.createElement("LI");i.innerHTML="<br>",Q.copyTagAttributes(i,h,this.options.get("lineAttrReset")),t=i,c.insertBefore(t,e.nextElementSibling)}else{let e;e=Q.isTableCell(c.parentNode)?"DIV":Q.isList(c.parentNode)?"LI":this.format.isLine(c.nextElementSibling)&&!this.format.isBlock(c.nextElementSibling)?c.nextElementSibling.nodeName:this.format.isLine(c.previousElementSibling)&&!this.format.isBlock(c.previousElementSibling)?c.previousElementSibling.nodeName:this.options.get("defaultLine"),t=Q.createElement(e);const i=this.format.removeBlock(c,[h],null,!0,!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&&Q.isBreak(o[l])&&(!o[l+1]||(!o[l+2]||Q.isZeroWith(o[l+2].textContent))&&3===o[l+1].nodeType&&Q.isZeroWith(o[l+1].textContent))&&l>0&&Q.isBreak(o[l-1])||!t&&Q.isZeroWith(i.textContent)&&Q.isBreak(a)&&(Q.isBreak(a.previousSibling)||!Q.isZeroWith(a.previousSibling.textContent))&&(!h||!Q.isBreak(h)&&Q.isZeroWith(h.textContent)))){t?Q.removeItem(o[l-1]):Q.removeItem(i);const e=this.format.addLine(s,this.format.isLine(s.nextElementSibling)&&!this.format.isBlock(s.nextElementSibling)?s.nextElementSibling:null);Q.copyFormatAttributes(e,s),this.selection.setRange(e,1,e,1),this.selection.scrollTo(r);break}if(t){this.html.insert(r.collapsed&&Q.isBreak(r.startContainer.childNodes[r.startOffset-1])?"<br>":"<br><br>",!1,!0,!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=Q.createElement("BR");this.html.insertNode(e,null,!0);const i=e.previousSibling,s=e.nextSibling;Q.isBreak(t)||Q.isBreak(i)||s&&!Q.isZeroWith(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.selection.scrollTo(r);break}if(r.collapsed&&(o||n)){this.__enterPrevent(e);const t=Q.createElement("BR"),s=Q.createElement(h.nodeName,null,t);Q.copyTagAttributes(s,h,this.options.get("lineAttrReset"));let l=t;do{if(!Q.isBreak(i)&&1===i.nodeType){const t=i.cloneNode(!1);t.appendChild(l),l=t}i=i.parentNode}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.selection.scrollTo(r);break}if(h){let i;e.stopPropagation();let s=0;if(r.collapsed)i=Q.isZeroWith(h)?this.format.addLine(h,h.cloneNode(!1)):this.nodeTransform.split(r.endContainer,r.endOffset,Q.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=this.html.remove();if(i=this.format.getLine(c.container,null),!i){Q.isWysiwygFrame(c.container)&&(this.__enterPrevent(e),t.get("wysiwyg").appendChild(a),i=a,Q.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s)),this.selection.scrollTo(r);break}const d=this.format.getBlock(c.container);if(i=i.contains(d)?Q.getEdgeChild(d,this.format.getLine.bind(this.format)):i,l){if(n&&!o)i.parentNode.insertBefore(a,c.prevContainer&&c.container!==c.prevContainer?i:i.nextElementSibling),i=a,s=0;else if(s=c.offset,o){const t=i.parentNode.insertBefore(a,i);n&&(i=t,s=0)}}else n&&o?(i.parentNode.insertBefore(a,c.prevContainer&&c.container===c.prevContainer?i.nextElementSibling:i),i=a,s=0):i=this.nodeTransform.split(c.container,c.offset,Q.getNodeDepth(h))}this.__enterPrevent(e),Q.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s),this.selection.scrollTo(r);break}}if(a){this.selection.scrollTo(r);break}c&&Q.getParentElement(c,"FIGCAPTION")&&Q.getParentElement(c,Q.isList)&&(this.__enterPrevent(e),h=this.format.addLine(h,null),this.selection.setRange(h,0,h,0),this.selection.scrollTo(r));break}}if(n&&(Jt?l:o)&&32===s){e.preventDefault(),e.stopPropagation();const t=this.html.insertNode(Q.createTextNode(" "),null,!0);if(t&&t.container)return void this.selection.setRange(t.container,t.endOffset,t.container,t.endOffset)}if(!o&&!l&&!a&&!ie.test(s)&&Q.isBreak(r.commonAncestorContainer)){const t=Q.createTextNode(K.zeroWidthSpace);this.html.insertNode(t,null,!0),this.selection.setRange(t,1,t,1)}if(t.has("documentType-use-header")&&!r.collapsed&&!o&&!l&&!n&&!te.test(s))return void Kt.setTimeout((()=>{t.get("documentType").reHeader()}));let d=null;switch(s){case 38:this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling));break;case 37:if(Q.isEdgePoint(i,r.startOffset,"front")){const t=i.previousElementSibling||Q.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 40:this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling));break;case 39:if(Q.isEdgePoint(i,r.endOffset,"end")){const t=i.nextElementSibling||Q.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,!1)&&this.editor.blur())}function de(t,e){if(this._onShortcutKey||this.menu.currentDropdownName)return;const i=e.keyCode,s=e.ctrlKey||e.metaKey||91===i||92===i||224===i,n=e.altKey;if(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)&&27!==i||!o.collapsed)){if(!this.editor.isBalloonAlways&&!this.editor.isSubBalloonAlways)return void(this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon());27!==i&&this._showToolbarBalloonDelay()}if(8===i&&Q.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const t=Q.createElement(this.format.isLine(this.status.currentNodes[0])&&!Q.isListCell(this.status.currentNodes[0])?this.status.currentNodes[0]:this.options.get("defaultLine"),null,"<br>");return l.appendChild(t),this.selection.setRange(t,0,t,0),this.applyTagEffect(),void this.history.push(!1)}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++)13===i&&/^id$/i.test(h[t].name)?r.removeAttribute("id"):r.setAttribute(h[t].name,h[t].value);this._formatAttrsTemp=null}if(r||!o.collapsed||this.component.is(l)||Q.isList(l)||null===this._setDefaultLine(this.format.isBlock(a)?"DIV":this.options.get("defaultLine"))||(l=this.selection.getNode()),!s&&!n&&!ie.test(i)&&3===l.nodeType&&K.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(oe)||"").length;t=o.startOffset-i,e=o.endOffset-i,l.textContent=l.textContent.replace(K.zeroWidthRegExp,""),this.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(ee.test(i)&&Q.isZeroWith(r?.textContent)&&!r.previousElementSibling){const t=this.options.get("retainStyleMode");"none"!==t&&le?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=Kt.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=Kt.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,le)):(this.__retainTimer=null,this._retainStyleNodes(r,le)):this._clearRetainStyleNodes(r)}if(this.char.test("",!1),t.has("documentType-use-header"))if(ne.test(i)){t.get("documentType").reHeader();const e=Q.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}else{const e=Q.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==this.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&(s||n||se.test(i)||this.history.push(!0))}function ue(t,e){const i=e.clipboardData;return!i||this._dataTransferAction("paste",e,i,t)}function pe(t,e){const i=e.clipboardData;if(!1===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()}function ge(t,e){const i=e.clipboardData;if(!1===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 me(t,e,i,s,n){n.preventDefault();const{sc:o,so:l,ec:r,eo:a}=this.selection.getEventLocationRange(n),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();d.height>0?(e.style.left=`${d.right+this._w.scrollX+c.x}px`,e.style.top=d.top+this._w.scrollY+c.y-5+"px",e.style.height=`${d.height+10}px`,e.style.display="block"):e.style.display="none"}function fe(t){t.style.display="none"}function _e(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.getEventLocationRange(i);if(Q.getParentElement(s,".se-disable-pointer"))return void i.preventDefault();if(zt.get("__dragContainer")){if(i.preventDefault(),zt.get("__dragContainer").contains(i.target))return void this.component.deselect();const t=zt.get("__dragContainer");return this.component.deselect(),this.selection.setRange(s,n,o,l),void this.html.insertNode(t,null,!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:be,ON_OVER_COMPONENT:ve,isMobile:ye}=Y,Ce=function(t){Ot.call(this,t),this._events=[],this._onButtonsCheck=new RegExp(`^(${Object.keys(t.options.get("_defaultStyleTagMap")).join("|")})$`,"i"),this._onShortcutKey=!1,this.isComposing=!1,this._balloonDelay=null,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakDir=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._vitualKeyboardHeight=0,this.__focusTemp=this.carrierWrapper.querySelector(".__se__focus__temp__"),this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null};function we(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 xe(t,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._antiBlur)return;const s=this.editor.status.onSelected||this.editor.opendModal;this.editor._offCurrentController(),this.status.hasFocus=!0,Q.removeClass(this.editor.commandTargets.get("codeView"),"active"),Q.setDisabled(this.editor._codeViewDisabledButtons,!1),this.editor.changeFrameContext(i),this.history.resetButtons(i,null),s||(this.selection.removeRange(),this.applyTagEffect()),this._w.setTimeout((()=>{this.editor.isInline&&this.toolbar._showInline(),this.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})}),0)}function Ee(t,e){this._inputFocus||this.editor._antiBlur||t.get("isCodeView")||(this.status.hasFocus=!1,this.editor.effectNode=null,(this.editor.isInline||this.editor.isBalloon)&&this._hideToolbar(),this.editor.isSubBalloon&&this._hideToolbar_sub(),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.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e}))}function Se(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.editor.enableBackWrapper("ns-resize"),this.__resize_editor=this.addGlobalEvent("mousemove",Te.bind(this)),this.__close_move=this.addGlobalEvent("mouseup",ke.bind(this))}function Te(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,Y.isResizeObserverSupported||this.editor.__callResizeFunction(e,s,null)}function ke(){this.editor.disableBackWrapper(),this.__resize_editor&&(this.__resize_editor=this.removeGlobalEvent(this.__resize_editor)),this.__close_move&&(this.__close_move=this.removeGlobalEvent(this.__close_move))}function Ne(t,e){e.preventDefault();const i=this._lineBreakComp;if(!i)return;t=t||this._lineBreakDir;const s=Q.isListCell(i.parentNode),n=Q.createElement(s?"BR":Q.isTableCell(i.parentNode)?"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{this.editor._antiBlur=!0;const t=s?n:n.firstChild;this.selection.setRange(t,1,t,1),this.history.push(!1)}finally{this.editor._antiBlur=!1}}}function Le(){ye?this._scrollContainer():this.editor._offCurrentController(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this._resetFrameStatus()}function He(){this.options.get("toolbar_sticky")>-1&&(this._vitualKeyboardHeight&&this.toolbar._sticky?this.toolbar._visible(!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()}function Me(){this._vitualKeyboardHeight=be.innerHeight-be.visualViewport.height}function Ae(){this.options.get("toolbar_sticky")>-1&&(this._vitualKeyboardHeight&&this.toolbar._sticky?this.toolbar._visible(!1):this.toolbar._resetSticky())}function Be(){this.toolbar._visible(!0),this._vitualKeyboardHeight&&this.options.get("toolbar_sticky")>-1&&this.toolbar._resetSticky()}function Ie(t){let e=t.getSelection().anchorNode;this.editor.applyFrameRoots((t=>{if(e&&t.get("wysiwyg").contains(e)&&(e=null,this.selection._init(),this.applyTagEffect(),t.has("documentType-use-header"))){const e=Q.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}}))}function Ve(){this._scrollContainer()}function Re(t){this.editor.changeFrameContext(t.get("key")),Q.addClass(this.editor.commandTargets.get("codeView"),"active"),Q.setDisabled(this.editor._codeViewDisabledButtons,!0)}Ce.prototype={addEvent(t,e,i,s){if(!t)return!1;if((!tt.is(t.length)||t.nodeName||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return!1;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,handler:i,useCapture:s});return{target:n>1?t:t[0],type:e,listener:i,handler:i,useCapture:s}},removeEvent(t){if(!t)return;let e=t.target;const i=t.type,s=t.listener,n=t.useCapture;if(!e)return!1;if((!tt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0===e.length)return!1;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){t&&("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))},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=this.editor.activeCommands,d=c.length;let u="";if(this.component.is(t)&&!this.component.__selectionSelected){const e=this.component.get(t);return void this.component.select(e.target,e.pluginName,!1)}for(;t.firstChild;)t=t.firstChild;const p=this.editor.frameContext,g=!p.get("isReadOnly");for(let p=t;!Q.isWysiwygFrame(p)&&p;p=p.parentNode)if(1===p.nodeType&&!Q.isBreak(p)){if(this._isNonFocusNode(p))return void this.editor.blur();if(u=p.nodeName.toLowerCase(),r.push(u),a.includes(u)&&!this.format.isLine(u)&&h.push(p),g)for(let t,e=0;e<d;e++)t=c[e],!l.includes(t)&&s.get(t)&&s.get(t).filter((e=>i[t]?.active(p,e))).length>0&&l.push(t);if(this.format.isLine(p)){if(!l.includes("outdent")&&s.has("outdent")&&(Q.isListCell(p)||p.style[e]&&tt.get(p.style[e],0)>0)&&s.get("outdent").filter((t=>!Q.isImportantDisabled(t)&&(t.removeAttribute("disabled"),!0))).length>0&&l.push("outdent"),!l.includes("indent")&&s.has("indent")){const t=Q.isListCell(p)&&!p.previousElementSibling;s.get("indent").filter((e=>!Q.isImportantDisabled(e)&&(t?e.setAttribute("disabled",!0):e.removeAttribute("disabled"),!0))).length>0&&l.push("indent")}}else n.test(u)&&(u=o[u]||u,l.push(u),Q.addClass(s.get(u),"active"))}return this._setKeyEffect(l),this.__cacheStyleNodes=h.reverse(),this.status.currentNodes=r.reverse(),this.status.currentNodesMap=l,this.editor.frameOptions.get("statusbar_showPathLabel")&&p.get("navigation")&&(p.get("navigation").textContent=this.options.get("_rtl")?this.status.currentNodes.reverse().join(" < "):this.status.currentNodes.join(" > ")),t},_injectActiveEvent(t){Q.addClass(t,"__se__active"),this.__geckoActiveEvent=this.addGlobalEvent("mouseup",(()=>{Q.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&&0!==t.length&&(l?l.active(null,t):/^outdent$/i.test(n)?Q.isImportantDisabled(t)||t.setAttribute("disabled",!0):/^indent$/i.test(n)?Q.isImportantDisabled(t)||t.removeAttribute("disabled"):Q.removeClass(t,"active"))}},_showToolbarBalloonDelay(){this._balloonDelay&&be.clearTimeout(this._balloonDelay),this._balloonDelay=be.setTimeout((()=>{be.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");this.menu._bindControllersOff||!(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=>1===t.nodeType&&"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),Q.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=Q.isTableCell(s),l=Q.isTableCell(n),r=t.commonAncestorContainer;if((o&&!s.previousElementSibling&&!s.parentElement.previousElementSibling||l&&!n.nextElementSibling&&!n.parentElement.nextElementSibling)&&s!==n)if(o){if(l)return Q.removeItem(Q.getParentElement(s,(t=>r===t.parentNode))),this.editor._nativeFocus(),!0;Q.removeItem(Q.getParentElement(s,(t=>r===t.parentNode)))}else Q.removeItem(Q.getParentElement(n,(t=>r===t.parentNode)));const a=1===e.nodeType?Q.getParentElement(e,".se-component"):null,h=1===i.nodeType?Q.getParentElement(i,".se-component"):null;return a&&Q.removeItem(a),h&&Q.removeItem(h),!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=Q.createElement(t||this.options.get("defaultLine")),r.innerHTML=n.innerHTML,0===r.childNodes.length&&(r.innerHTML=K.zeroWidthSpace),n.innerHTML=r.outerHTML,r=n.firstChild,o=Q.getEdgeChildNodes(r,null).sc,o||(o=Q.createTextNode(K.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),e=t.container;if(i.parentElement===e){const t=i.nextElementSibling?e:e.nextElementSibling,s=Q.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,!1),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)&&!Q.isWysiwygFrame(s)||!this.component.is(s.children[e.startOffset])&&!this.component.is(s.children[e.startOffset-1])){if(Q.getParentElement(i,Q.isExcludeFormat))return null;if(this.format.isBlock(i)&&i.childNodes.length<=1){let t=null;return 1===i.childNodes.length&&Q.isBreak(i.firstChild)?t=i.firstChild:(t=Q.createTextNode(K.zeroWidthSpace),i.appendChild(t)),void this.selection.setRange(t,1,t,1)}try{if(3===i.nodeType&&(r=Q.createElement(t||this.options.get("defaultLine")),i.parentNode.insertBefore(r,i),r.appendChild(i)),Q.isBreak(r.nextSibling)&&Q.removeItem(r.nextSibling),Q.isBreak(r.previousSibling)&&Q.removeItem(r.previousSibling),Q.isBreak(o)){const t=Q.createTextNode(K.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}}catch(e){this.editor.execCommand("formatBlock",!1,t||this.options.get("defaultLine")),this.selection.removeRange(),this.selection._init()}if(r&&(Q.isBreak(r.nextSibling)&&Q.removeItem(r.nextSibling),Q.isBreak(r.previousSibling)&&Q.removeItem(r.previousSibling),Q.isBreak(o))){const t=Q.createTextNode(K.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}this.editor.effectNode=null,this.editor._nativeFocus()}},_dataTransferAction(t,e,i,s){try{return this._setClipboardData(t,e,i,s),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}},async _setClipboardData(t,e,i,s){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=J.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&&this.options.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");Q.getListChildNodes(t.body,J.textToAnchor),o=t.body.innerHTML}l||(o=this.html.clean(o,!1,null,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,html: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,html: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("onPastAndDrop",{frameContext:s,event:e,file:d[t]});return!1}return!!c&&(o?(this.html.insert(o,!1,!0,!0),s.has("documentType-use-header")&&s.get("documentType").reHeader(),!1):void 0)},_addCommonEvents(){const t=Ft.bind(this),e=Dt.bind(this);this.addEvent(this.context.get("menuTray"),"mousedown",t,!1),this.addEvent(this.context.get("menuTray"),"click",Pt.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(),Y.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{be.setTimeout((()=>{this.toolbar.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{be.setTimeout((()=>{t.forEach((t=>{this.editor.__callResizeFunction(this.editor.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.options.get("closeModalOutsideClick")&&this.addEvent(this.carrierWrapper.querySelector(".se-modal-inner"),"click",(t=>{t.target===this.carrierWrapper.querySelector(".se-modal-inner")&&this.editor._offCurrentModal()}),!1),this.addEvent(be,"resize",Le.bind(this),!1),this.addEvent(be,"scroll",He.bind(this),!1),Y.isMobile&&(this.addEvent(be.visualViewport,"resize",Me.bind(this),!1),this.addEvent(be.visualViewport,"scroll",Ae.bind(this),!1),this.addEvent(be.visualViewport,"scroll",J.debounce(Be.bind(this),200),!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=Xt.bind(this,t);this.addEvent(i,"mousemove",o,!1),this.addEvent(i,"mouseleave",Yt.bind(this,t),!1),this.addEvent(i,"mousedown",qt.bind(this,t),!1),this.addEvent(i,"mouseup",Gt.bind(this,t),!1),this.addEvent(i,"click",jt.bind(this,t),!1),this.addEvent(i,"input",he.bind(this,t),!1),this.addEvent(i,"keydown",ce.bind(this,t),!1),this.addEvent(i,"keyup",de.bind(this,t),!1),this.addEvent(i,"paste",ue.bind(this,t),!1),this.addEvent(i,"copy",pe.bind(this,t),!1),this.addEvent(i,"cut",ge.bind(this,t),!1),this.addEvent(i,"dragover",me.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",fe.bind(this,n),!1),this.addEvent(i,"drop",_e.bind(this,t,n),!1),this.addEvent(i,"scroll",we.bind(this,t,i),{passive:!0,useCapture:!1}),this.addEvent(i,"focus",xe.bind(this,t),!1),this.addEvent(i,"blur",Ee.bind(this,t),!1),this.addEvent(s,"mousedown",Re.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=ye?"touchstart":"mousedown";if(this.addEvent([t.get("lineBreaker_t"),t.get("lineBreaker_b")],r,(t=>{t.preventDefault()}),!1),this.addEvent(t.get("lineBreaker_t"),r,Ne.bind(this,"t"),!1),this.addEvent(t.get("lineBreaker_b"),r,Ne.bind(this,"b"),!1),ye&&this.addEvent(i,"touchstart",o,{passive:!0,useCapture:!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=Ve.bind(this);let h=t.get("originElement");for(;h=Q.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",Ie.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",Se.bind(this),!1)):Q.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.handler,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.scrollY||t.scrollTop||0,i=t.scrollX||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.editor._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=tt.get(t.top,0)-(e-tt.get(s[0],0))+"px",t.left=tt.get(t.left,0)-(i-tt.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=tt.get(t.top,0)-(e-tt.get(s[0],0))+"px",t[s[1]]=tt.get(t[s[1]],0)-(i-tt.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){zt.get("__dragMove")&&zt.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?.show()},_resetFrameStatus(){Y.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.frameContext,s=i.get("fileBrowser");s&&"block"===s.area.style.display&&(s.body.style.maxHeight=Q.getClientSize().h-s.header.offsetHeight-50+"px"),this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._setMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown),this.viewer._resetFullScreenHeight()||(i.get("isCodeView")&&this.editor.isInline?this.toolbar._showInline():(this.editor._iframeAutoHeight(i),this.toolbar._sticky&&(this.context.get("toolbar.main").style.width=i.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=Q.createTextNode(K.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=0;t<i.length;t++)if(!1===i[t](e))return!1},_overComponentSelect(t){const e=Q.getParentElement(t,Q.isFigure);let i=this.component.get(t);i||e?(i||(i=this.component.get(e)),i&&!Q.hasClass(i.container,"se-component-selected")&&(this.editor._offCurrentController(),zt.set("__overInfo",ve),this.component.select(i.target,i.pluginName,!1))):null===zt.get("__overInfo")||Q.hasClass(t,"se-drag-handle")||(this.component.__deselect(),zt.set("__overInfo",null))},__removeInput(){this._inputFocus=this.editor._antiBlur=!1,this.__inputBlurEvent=this.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null},__enterPrevent(t){t.preventDefault(),ye&&this.__focusTemp.focus()},constructor:Ce};const Oe=Ce,ze=11.7*Y.DPI*96,$e=function(t,e){if(this.editor=t,this.fc=e,this.ww=e.get("wysiwyg"),this.wwFrame=e.get("wysiwygFrame"),this.wwWidth=-1,this.innerHeaders=[],this._wwHeaders=[],this.inner=null,this.page=null,this.pageHeight=-1,this.pages=[],this.pages_line=[],this.useHeader=t.options.get("type-options").includes("header"),this.usePage=t.options.get("type-options").includes("page"),this.useHeader){const t=this._getHeaders(),i=this.inner=e.get("documentTypeInner").querySelector(".se-document-lines-inner");let s="";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s+=`<div class="se-doc-item se-doc-h${tt.get(e.nodeName)}">${e.textContent}</div>`;i.innerHTML=s,this.innerHeaders=i.querySelectorAll("div"),this.editor.eventManager.addEvent(i,"click",Fe.bind(this,this.ww))}this.usePage&&(this.page=e.get("documentTypePage"))};function Fe(t,e){e.preventDefault();try{this.editor._antiBlur=!0;const t=e.target;if(Q.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.editor.selection.scrollTo(i)}}finally{this.editor._antiBlur=!1}}$e.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${tt.get(s.nodeName)}`,o=i[l],l<i.length)o.classList.contains(n)&&o.textContent===s.textContent||(o.textContent=s.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=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")},rePage(){if(!this.page)return;const t=this.wwFrame.scrollHeight;if(this.pageHeight===t)return;this.pageHeight=t;const e=this.page,i=this.ww.scrollTop,s=this.wwFrame.offsetWidth+1,n=Math.ceil(t/ze);this.page.innerHTML="",this.pages=[];for(let t=0;t<n;t++){const n=Q.createElement("DIV",{style:`top:${t*ze+i}px`,innerHTML:t+1},`<div class="se-document-page-line" style="width: ${s}px;"></div>${t+1}`);e.appendChild(n),this.pages.push(n)}this.pages_line=this.page.querySelectorAll(".se-document-page-line")},scrollPage(){const t=this.wwFrame.scrollTop,e=this.pages;for(let i=0,s=e.length;i<s;i++)e[i].style.top=i*ze-t+"px"},resizePage(){const t=this.wwFrame.offsetWidth+1;if(t===this.wwWidth)return;this.wwWidth=t;const e=this.pages_line;for(let i=0,s=e.length;i<s;i++)e[i].style.width=`${t}px`},on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(Q.removeClass(this.innerHeaders,"active"),Q.addClass(e,"active"))},onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)},_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:$e};const Pe=$e,De=function(t){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.notice=t.notice,this.offset=t.offset,this.selection=t.selection,this.shortcuts=t.shortcuts,this.toolbar=t.toolbar,this.viewer=t.viewer,t.subToolbar&&(this.subToolbar=t.subToolbar)},We=function(t){Ot.call(this,t)};function Ue(e){e&&!$(e,"se-blink")&&(F(e,"se-blink"),t.setTimeout((()=>{P(e,"se-blink")}),600))}We.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 Ue(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("utf-8").encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e)},display(){const e=this.editor.frameContext.get("charCounter");e&&t.setTimeout((()=>{e.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&&(Ue(this.editor.frameContext.get("charWrapper")),i>0))return!1}return!0},constructor:We};const Ze=We,qe=function(t){Ot.call(this,t),De.call(this,t)},{_w:Ge,ON_OVER_COMPONENT:je}=Y,Xe=/^(1[7-9]|20|27|45|11[2-9]|12[0-3]|144|145)$/,Ye=2147483645,Ke=function(t,e,i,s){qe.call(this,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,this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsHide=!!i.parentsHide,this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this._initMethod="function"==typeof i.initMethod?i.initMethod:null,this.__globalEventHandlers={keydown:ei.bind(this),mousedown:ii.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",Je.bind(this)),this.eventManager.addEvent(e,"mouseenter",Qe.bind(this)),this.eventManager.addEvent(e,"mouseleave",ti.bind(this))};function Je(t){const e=Q.getCommandTarget(t.target);e&&(t.stopPropagation(),t.preventDefault(),this.inst.controllerAction(e))}function Qe(t){this.editor.currentControllerName=this.kind,this.parents.length>0&&this.isInsideForm||(t.target.style.zIndex=2147483647)}function ti(t){this.parents.length>0&&this.isInsideForm||(t.target.style.zIndex=Ye)}function ei(t){if(this._checkFixed())return;const e=t.keyCode;!t.ctrlKey&&!t.metaKey&&91!==e&&92!==e&&224!==e&&Xe.test(e)&&(this.form.contains(t.target)||this._checkForm(t.target)||this.editor._fileManager.pluginRegExp.test(this.kind)&&27!==e||this.close())}function ii({target:t}){this.inst?._element?.contains(t)?this.isOpen=!1:(this.isOpen=!0,t===this.inst._element||t===this.currentTarget||this._checkFixed()||this.form.contains(t)||this._checkForm(t)||this.close(!0))}Ke.prototype={open(t,e,{isWWTarget:i,initMethod:s,disabled:n,addOffset:o}={}){if(zt.get("__overInfo")===je)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(),(n??this.disabled)&&Q.setDisabled(this.editor._controllerOnDisabledButtons,!0),this.currentTarget=t,this.currentPositionTarget=e||t,this.isWWTarget=i??this.isWWTarget,"function"==typeof s&&(this._initMethod=s),this.editor.currentControllerName=this.kind,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=Ye)})),this.parentsHide&&this.parents.forEach((t=>{t.style.display="none"})),this.__addGlobalEvent(),this._setControllerPosition(this.form,this.currentPositionTarget);const r=this.selection.isRange(t);this._controllerOn(this.form,t,r),this._w.setTimeout((()=>zt.set("__overInfo",!1)),0)},close(t){this.isOpen&&(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)},resetPosition(t){this._setControllerPosition(this.form,t||this.currentPositionTarget)},_controllerOn(t,e,i){const s={position:this.position,inst:this,form:t,target:e,isRangeTarget:i,notInCarrier:!this.carrierWrapper.contains(t)};!1!==this.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.editor.frameContext,params:s})&&(t.style.display="block",this._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._antiBlur=!0,this.editor.status.onSelected=!0,this.triggerEvent("onShowController",{caller:this.kind,frameContext:this.editor.frameContext,params: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.disabled&&Q.setDisabled(this.editor._controllerOnDisabledButtons,!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._antiBlur=!1,this.editor._controllerTargetContext=null,Ge.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){if(t.style.zIndex=2147483646,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(!this.offset.setAbsPosition(t,e,{addOffset:this.__addOffset,position:this.position,isWWTarget:this.isWWTarget,inst:this}))return void this.hide();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(Q.isWysiwygFrame(t))return!1;if(Q.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&&(Q.getParentElement(t,".se-controller")||t?.contains(this.inst._element))},constructor:Ke},Ke.CreateHTML=function(){return Q.createElement("DIV",{class:""},"")};const si=Ke,ni=function(t,e){Ot.call(this,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=[],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=[],this.__eventHandlers={mousedown:li.bind(this.eventManager),mousemove:ri.bind(this),click:ai.bind(this),keydown:oi.bind(this)},this.__globalEventHandlers={keydown:hi.bind(this),mousedown:ci.bind(this),click:di.bind(this)}};function oi(t){let e;switch(t.keyCode){case 38: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 40: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 37:t.preventDefault(),t.stopPropagation(),e=-1;break;case 39:t.preventDefault(),t.stopPropagation(),e=1;break;case 13:case 32:this.index>-1?(t.preventDefault(),t.stopPropagation(),this._select(this.index)):this.close()}e&&this._moveItem(e)}function li(t){if(Y.isGecko){const e=Q.getParentElement(t.target,".se-select-item");e&&this._injectActiveEvent(e)}}function ri(t){Q.addClass(this.form,"se-select-menu-mouse-move");const e=t.target.getAttribute("data-index");e&&(this.index=1*e)}function ai(t){let e=t.target,i=null;for(;!i&&!/UL/i.test(e.tagName)&&!Q.hasClass(e,"se-select-menu");)i=e.getAttribute("data-index"),e=e.parentNode;i&&this._select(1*i)}function hi(t){/27/.test(t.keyCode)&&this.close()}function ci(t){this.form.contains(t.target)||(t.target!==this._refer?this.close():Q.isInputElement(t.target)||(this._bindClose_click=this.eventManager.addGlobalEvent("click",this.__globalEventHandlers.click,!0)))}function di(t){this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click),t.target===this._refer&&(t.stopPropagation(),this.close())}ni.prototype={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=this.form.querySelectorAll("li"),this.menuLen=this.menus.length},on(t,e,i){i||(i={}),this._refer=t,this._keydownTarget=Q.isInputElement(t)?t:this._w,this._selectMethod=e,this.form=Q.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,Q.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&&(Q.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){Q.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let i=0;i<e;i++)i===t?Q.addClass(this.menus[i],"active"):Q.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",Q.removeClass(o,"se-select-menu-scroll"),Q.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,_=Q.getClientSize().h-(m-this._w.scrollY+f),b=c?f:0;let v=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){v=0;break}v=m-4+b,v>=38&&(o.style.height=v+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(_<o.offsetHeight+b){if(!s){v=0;break}v=_-4+b,v>=38&&(o.style.height=v+"px")}u=g+(c?0:f)}if(v<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 y=this.editor.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-this._w.scrollX+y,C<0&&(d=d=h+a+1);break;case"true-right":C=this._w.innerWidth-(y+r),C<0&&(d=h-r-1);break;case"false-center":{C=this._w.innerWidth-(y+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":y<0&&(d-=y-4)}if(i){const t=o.firstElementChild.querySelector(i);t&&(this._onItem=t,Q.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""},_select(t){this.checkList&&Q.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(){0!==this.__events.length&&(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=[])},__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))},constructor:ni};const ui=ni,{ON_OVER_COMPONENT:pi}=Y,gi={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize",lw:"w-resize",th:"n-resize",rw:"e-resize",bh:"s-resize"};let mi=!1,fi=!1,_i=0,bi=0;const vi=function(t,e,i){qe.call(this,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="${e.t?"se-btn-w-auto ":""}se-btn se-tooltip">\n\t\t\t\t\t\t${n[e.i]||e.t||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 Q.createElement("DIV",{class:"se-controller se-controller-resizing"+(i?"":" se-empty-controller")},i)}(this,e||[]);this.controller=new si(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 ui(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,Ti.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 ui(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,ki.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=tt.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 ui(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,Ni.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=0,this._height=0,this._element_w=0,this._element_h=0,this._element_l=0,this._element_t=0,this._resize_w=0,this._resize_h=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=Li.bind(this),this.__containerResizing=xi.bind(this),this.__containerResizingOff=Ei.bind(this),this.__containerResizingESC=Si.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.__onResizeESCEvent=null,this.__fileManagerInfo=!1,this.eventManager.addEvent(this.alignButton,"click",Hi.bind(this)),this.eventManager.addEvent(this.asButton,"click",Mi.bind(this)),this.eventManager.addEvent(this.resizeButton,"click",Ai.bind(this)),this.editor.applyFrameRoots((t=>{if(!t.get("wrapper").querySelector(".se-controller.se-resizing-container")){const e=Q.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},'\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>'),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",wi.bind(this))}}))};function yi(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"}function Ci(t){const e=t.style.transform;return e?{r:1*((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 wi(t){t.stopPropagation(),t.preventDefault();const e=zt.get("__figureInst"),i=e._resize_direction=t.target.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,e.editor.frameContext.get("_figure").main.style.float=/l/.test(i)?"right":/r/.test(i)?"left":"none",this.editor.enableBackWrapper(gi[i]);const{w:s,h:n}=this.getSize(e._element);if(mi=fi=!1,_i=bi=0,!this.isVertical){const t=!s||/auto|%$/.test(s),o=!n||/auto|%$/.test(n);if("tl|bl|tr|br".includes(i)&&t&&o?mi=!0:"lw|rw".includes(i)&&t&&(fi=!0),mi||fi){const t=e._cover||e._element;bi=t.offsetWidth,_i=J.getWidthInPercentage(t,this.editor.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=e.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=e.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const o=this.editor.frameContext.get("_figure").display;o.style.display="block",Q.changeTxt(o,s+" x "+n)}function xi(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=_i?this._resize_w/bi*_i*100:this._resize_w;Q.changeTxt(this.editor.frameContext.get("_figure").display,_i?tt.get(c>100?100:c,2).toFixed(2)+"%":c+" x "+this._resize_h)}function Ei(){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-tt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+tt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;tt.get(t,0)>i&&(e=Math.round(e/t*i),t=i)}mi||fi?(t=t/(this._cover||this._element).offsetWidth*_i*100,t=tt.get(t>100?100:t,2)+"%",this._setPercentSize(t,fi?this.getSize(this._element).h:"")):(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,!1)}function Si(t){/^27$/.test(t.keyCode)&&(this._offResizeEvent(),this.component.select(this._element,this.kind,!1))}function Ti(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.component.select(this._element,this.kind,!1)}function ki(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}function Ni(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!==tt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.component.select(this._element,this.kind,!1)}function Li(){this.editor.frameContext.get("_figure").main.style.display="none",this.editor._figureContainer=null}function Hi(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}function Mi(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}function Ai(){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=tt.get(e);s=100===t?"auto":"resize_percent"+t}}else"auto"===i&&("auto"===e?s="auto":/%$/.test(e)&&(s="resize_percent"+tt.get(e)));this.selectMenu_resize.open("",'[data-command="'+s+'"]')}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:tt.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"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:void 0,i:r}:null}vi.CreateContainer=function(t,e){return Q.createElement("DIV",{class:"se-component"+(e?" "+e:"")},Q.createElement("FIGURE",null,t)),vi.GetContainer(t)},vi.CreateInlineContainer=function(t,e){return Q.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),vi.GetContainer(t)},vi.CreateInlineContainer=function(t,e){return Q.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),vi.GetContainer(t)},vi.CreateCaption=function(t,e){const i=Q.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(i),i},vi.GetContainer=function(t){const e=Q.getParentElement(t,"FIGURE"),i=Q.getParentElement(t,"SPAN");return{target:t,container:Q.getParentElement(t,vi.__is)||e,cover:e,inlineCover:Q.hasClass(i,"se-inline-component")?i:null,caption:Q.getEdgeChild(t.parentElement,"FIGCAPTION")}},vi.GetRatio=function(t,e,i){let s=1,n=1;if(/\d+/.test(t)&&/\d+/.test(e)&&(!tt.is(t)&&t.replace(/\d+|\./g,"")||i||"px")===(!tt.is(e)&&e.replace(/\d+|\./g,"")||i||"px")){const i=tt.get(t,4),o=tt.get(e,4);s=i/o,n=o/i}return{w:tt.get(s,4),h:tt.get(n,4)}},vi.CalcRatio=function(t,e,i,s){if(/\d+/.test(t)&&/\d+/.test(e)){const n=!tt.is(t)&&t.replace(/\d+|\./g,"")||i||"px",o=!tt.is(e)&&e.replace(/\d+|\./g,"")||i||"px";if(n===o){const i="%"===n?2:0,l=t,r=e;e=tt.get(s.h*tt.get(l,i),i)+o,t=tt.get(s.w*tt.get(r,i),i)+n}}return{w:t,h:e}},vi.__is=function(t){return Q.hasClass(t,"se-component")||/^(HR)$/.test(t?.nodeName)},vi.prototype={close(){this.editor._antiBlur=!1,Q.removeClass(this._cover,"se-figure-selected"),this.controller.close(),Q.hasClass(this._w.event?.target,"se-drag-handle|sun-editor-editable")||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 target element is null.");zt.get("__overInfo")!==pi?this.editor._offCurrentController():s=!0;const l=vi.GetContainer(t);if(!l.container)return{container:null,cover:null,width:t.style.width||(tt.is(t.width)?"":t.width)||"",height:t.style.height||(tt.is(t.height)?"":t.height)||""};zt.set("__figureInst",this),this._setFigureInfo(l);const r=n&&(this._cover||this._container)||t,a=r.offsetWidth||"",h=r.offsetHeight||"",{top:c,left:d,scrollX:u,scrollY:p}=this.offset.getLocal(r),g=(t.getAttribute("data-se-size")||"").split(","),m=vi.GetRatio(g[0]||tt.get(t.style.width,2)||a,g[1]||tt.get(t.style.height,2)||h,this.sizeUnit),f={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:m,w:a,h,t:c,l:d,width:g[0]||"auto",height:g[1]||"auto",originWidth:t.naturalWidth||t.offsetWidth,originHeight:t.naturalHeight||t.offsetHeight};if(this._width=f.width,this._height=f.height,o||this.__fileManagerInfo)return f;const _=this.editor.frameContext.get("_figure");this.editor._figureContainer=_.main,_.main.style.top=c+"px",_.main.style.left=d+"px",_.main.style.width=(this.isVertical?h:a)+"px",_.main.style.height=(this.isVertical?a:h)+"px",_.border.style.top="0px",_.border.style.left="0px",_.border.style.width=(this.isVertical?h:a)+"px",_.border.style.height=(this.isVertical?a:h)+"px",this.__offset={left:d+u,top:c+p},this.editor.opendControllers.push({position:"none",form:_.main,target:r,inst:this,notInCarrier:!0});const b=/%$/.test(t.style.width)&&/%$/.test(l.container.style.width)?tt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===b?Q.addClass(this.percentageButtons[t],"active"):Q.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?Q.addClass(this.captionButton,"active"):Q.removeClass(this.captionButton,"active")),_.display.style.display=i||this._inlineCover?"none":"",_.border.style.display=s?"none":"",_.main.style.display="block",zt.get("__overInfo")!==pi){this._setAlignIcon(),this._setAsIcon(),this.editor._visibleControllers(!0,!0);const i=this.getSize(t);Q.changeTxt(_.display,this.lang["none"===this.align?"basic":this.align]+" ("+i.w+", "+i.h+")"),this._displayResizeHandles(!e);const s=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"]'),n=this._inlineCover?"none":"";s.forEach((t=>{t.style.display=n})),Q.removeClass(this._cover,"se-figure-over-selected"),this.controller.open(_.main,null,{initMethod:this.__offContainer,isWWTarget:!1,addOffset:null}),this._w.setTimeout((()=>zt.set("__overInfo",!1)),0)}else Q.addClass(this._cover,"se-figure-over-selected");return Q.addClass(this._cover,"se-figure-selected"),this._element_w=this._resize_w=a,this._element_h=this._resize_h=h,this._element_l=d,this._element_t=c,this._inlineCover||zt.get("__overInfo")===pi&&!Q.hasClass(l.container,"se-input-component")||this._setDragEvent(_.main),f},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=vi.GetContainer(t);return e.container?{w:(/%$/.test(t.style.width)?(e.container&&tt.get(e.container.style.width,2)||100)+"%":t.style.width)||"auto",h:(e.inlineCover?e.inlineCover.style.height:tt.get(e.cover.style.paddingBottom,0)>0&&!this.isVertical?e.cover.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(e.container&&tt.get(e.container.style.height,2)||100)+"%":t.style.height)||"auto"}:{w:"",h:t.style.height}},setAlign(t,e){t||(t=this._element),this.align=e=e||"none";const i=vi.GetContainer(t);if(!i.cover)return;const s=i.container,n=i.cover;if(/%$/.test(t.style.width)&&"center"===e&&!this.component.isInline(s)?(s.style.minWidth="100%",n.style.width=s.style.width):(s.style.minWidth="",n.style.width=this.isVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),Q.hasClass(s,"__se__float-"+e)||(Q.removeClass(s,this._floatClassStr),Q.addClass(s,"__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}=vi.GetContainer(t),{w:n,h:o}=this.getSize(t),l=t.cloneNode(!1);switch(e){case"inline":{if(s)break;this.component.deselect();const t=i.nextElementSibling,e=i.parentElement;l.style.width="",l.style.height="";const r=vi.CreateInlineContainer(l);Q.addClass(r.container,i.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(r,n,o);const a=Q.createElement(this.options.get("defaultLine"),null,r.container);e.insertBefore(a,t),Q.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&&Q.isZeroWith(e.previousElementSibling)&&Q.removeItem(e.previousElementSibling),l.style.width="",l.style.height="";const r=vi.CreateContainer(l);Q.addClass(r.container,i.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(r,n,o),(e||t.container).parentElement.insertBefore(r.container,e);break}}},_asFormatChange(t,e,i){const s=this.kind;t.target.onload=()=>this.component.select(t.target,s,!1),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=Ci(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)Q.removeItem(this._caption),this._w.setTimeout(this.component.select.bind(this.component,n,this.kind),0);else{const t=vi.CreateCaption(this._cover,this.lang.caption),e=Q.getEdgeChild(t,(t=>3===t.nodeType));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"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,!1))}},retainFigureFormat(t,e,i){const s=this.component.isInline(t);let n=this.format.isBlock(e.parentNode)||Q.isWysiwygFrame(e.parentNode)?e:Q.isAnchor(e.parentNode)?e.parentNode:this.format.getLine(e)||e;if(Q.getParentElement(e,Q.isExcludeFormat))n=i&&i!==e?i:e,n.parentNode.replaceChild(t,n);else if(s&&this.format.isLine(n)){const i=s&&/^SPAN$/i.test(e.parentElement)?e.parentElement:e;i.parentElement.replaceChild(t,i)}else if(Q.isListCell(n)){const i=Q.getParentElement(e,(t=>t.parentNode===n));n.insertBefore(t,i),Q.removeItem(e),this.nodeTransform.removeEmptyNode(i,null,!0)}else if(this.format.isLine(n)){const i=Q.getParentElement(e,(t=>t.parentNode===n));n=this.nodeTransform.split(n,i),n.parentNode.insertBefore(t,n),Q.removeItem(e),this.nodeTransform.removeEmptyNode(n,null,!0)}else if(this.format.isLineOnly(n.parentNode)){const e=n.parentNode;e.parentNode.insertBefore(t,n.previousSibling?e.nextElementSibling:e),0===this.fileManager.__updateTags.map((t=>n.contains(t))).length&&Q.removeItem(n)}else n=Q.isFigure(n.parentNode)?Q.getParentElement(n.parentNode,vi.__is):n,n.parentNode.replaceChild(t,n)},deleteTransform(t){t||(t=this._element);const e=(t.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,t.style.maxWidth="",t.style.transform="",t.style.transformOrigin="",this._deleteCaptionPosition(t),this._applySize(e[0]||"auto",e[1]||"","")},setTransform(t,e,i,s){try{this.__preventSizechange=!0;const n=Ci(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=tt.get(e,0),i=tt.get(i,0);const r=(t.getAttribute("data-se-size")||"auto,auto").split(",");let a="";if(/auto|%$/.test(r[0])&&!l)"auto"===r[0]&&"auto"===r[1]?this._setAutoSize():this._setPercentSize(r[0],r[1]);else{const n=vi.GetContainer(t),o=n.cover||n.inlineCover,r=e||t.offsetWidth,h=i||t.offsetHeight,c=(l?h:r)+"px",d=(l?r:h)+"px";this._deletePercentSize(),this._applySize(r+"px",h+"px",""),o.style.width=c,o.style.height=n.caption||n.inlineCover?"":d,l&&(a=90===s||-270===s?h/2+"px "+h/2+"px 0":r/2+"px "+r/2+"px 0")}t.style.transformOrigin=a,this._setRotate(t,s,n.x,n.y),t.style.maxWidth=l?"none":"",this._setCaptionPosition(t)}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(Ci(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=tt.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=tt.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)?tt.get(tt.get(e,2)/100*tt.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)||tt.get(e,0)?tt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):tt.is(e)?e+"%":e;const i=/%$/.test(e);this._container.style.width=tt.is(t)?t+"%":t,this._container.style.height="",this._inlineCover!==this._cover&&(this._cover.style.width="100%",this._cover.style.height=e),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=this.autoRatio?"100%":i?"":e,"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(t,e),this._setCaptionPosition(this._element),this._saveCurrentSize()},_deletePercentSize(){this._cover.style.width="",this._cover.style.height="",this._container.style.width="",this._container.style.height="",Q.removeClass(this._container,this._floatClassStr),Q.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&&Q.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])},_setAsIcon(){this.asButton&&Q.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=Q.getEdgeChild(Q.getParentElement(t,"FIGURE"),"FIGCAPTION");e&&(e.style.marginTop=(this.isVertical?t.offsetWidth-t.offsetHeight:0)+"px")},_deleteCaptionPosition(t){const e=Q.getEdgeChild(Q.getParentElement(t,"FIGURE"),"FIGCAPTION");e&&(e.style.marginTop="")},_displayResizeHandles(t){t=t?"flex":"none",this.controller.form.style.display=t;const e=this.editor.frameContext.get("_figure"),i=e.handles;for(let e=0,s=i.length;e<s;e++)i[e].style.display=t;"none"===t?(Q.addClass(e.main,"se-resize-ing"),this.__onResizeESCEvent=this.eventManager.addGlobalEvent("keydown",this.__containerResizingESC)):Q.removeClass(e.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.editor._offCurrentController(),this.editor.disableBackWrapper()},_setDragEvent(t){const e=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");Q.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",zt.set("__dragHandler",e),zt.set("__dragContainer",this._container),zt.set("__dragCover",this._cover),zt.set("__dragMove",yi.bind(this,e,t)),zt.get("__dragMove")(),e.style.display="block"},constructor:vi};const Ii=vi,{_w:Vi,ON_OVER_COMPONENT:Ri,isMobile:Oi}=Y,zi=/^(3[7-9]|40)$/,$i=/^3[7-8]$/,Fi=function(t){Ot.call(this,t),this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.__globalEvents={copy:Gi.bind(this),cut:ji.bind(this),keydown:Xi.bind(this),mousedown:qi.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.editor.applyFrameRoots((t=>{const e=Q.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.icons.selection);t.get("wrapper").appendChild(e),this.eventManager.addEvent(e,"mouseenter",Pi.bind(this)),this.eventManager.addEvent(e,"mouseleave",Di.bind(this)),this.eventManager.addEvent(e,"dragstart",Wi.bind(this)),this.eventManager.addEvent(e,"dragend",Ui.bind(this)),this.eventManager.addEvent(e,"click",Zi.bind(this))}))};function Pi(){this.editor._antiBlur=!0,this.editor._visibleControllers(!1,Q.hasClass(zt.get("__dragHandler"),"se-drag-handle-full")),Q.addClass(zt.get("__dragCover")||zt.get("__dragContainer"),"se-drag-over")}function Di(){this.editor._antiBlur=!1,Q.hasClass(zt.get("__dragHandler"),"se-drag-handle-full")||this.editor._visibleControllers(!0,!0),Q.removeClass([zt.get("__dragCover"),zt.get("__dragContainer")],"se-drag-over")}function Wi(t){const e=zt.get("__dragCover")||zt.get("__dragContainer");e?(this.editor._antiBlur=!1,Q.addClass(zt.get("__dragHandler"),"se-dragging"),Q.addClass(zt.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.options.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}function Ui(){this.editor._antiBlur=!1,Q.removeClass([zt.get("__dragHandler"),zt.get("__dragContainer")],"se-dragging"),this._removeDragEvent()}function Zi({target:t}){if(!Q.hasClass(t,"se-drag-handle-full"))return;const e=zt.get("__dragInst");this._removeDragEvent(),this.select(e.currentTarget,e.currentPluginName,!1)}function qi({target:t}){this.currentTarget?.contains(t)||Q.getParentElement(t,".se-controller")||Q.hasClass(t,"se-drag-handle")||this.currentPluginName===this.editor.currentControllerName&&this.editor.opendControllers.some((({form:e})=>e.contains(t)))||this.deselect()}function Gi(t){if(Q.isInputElement(t.target)&&Q.getParentElement(t.target,".se-modal"))return;const e=this.info;e&&(Yi(t,e.container,t.clipboardData),Q.addClass(e.container,"se-copy"),Vi.setTimeout((()=>{Q.removeClass(e.container,"se-copy")}),120))}function ji(t){const e=this.info;e&&(Yi(t,e.container,t.clipboardData),this.deselect(),Q.removeItem(e.container))}async function Xi(t){if(this.editor.selectMenuOn)return;const e=t.keyCode;if(t.ctrlKey||t.metaKey||91===e||92===e||224===e){if(17!==e){const i=this.editor.shortcutsKeyMap.get(e+(t.shiftKey?1e3:0));/^(redo|undo)$/.test(i?.c)&&(t.preventDefault(),t.stopPropagation(),this.editor.run(i.c,i.t,i.e))}}else{if((8===e||46===e)&&(t.preventDefault(),t.stopPropagation(),"function"==typeof this.currentPlugin?.destroy))return await this.currentPlugin.destroy(this.currentTarget),this.deselect(),void this.editor.focus();if(13===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=Q.isListCell(i.parentNode)?Q.createElement("BR"):Q.createElement(this.format.isLine(s)&&!this.format.isBlock(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(zi.test(e)){const{container:i}=this.get(this.currentTarget);let s=null,n=1;if(this.isInline(i||this.currentTarget))switch(e){case 37:s=i.previousSibling,n=3===s?.nodeType?s.textContent.length:1;break;case 39:s=i.nextSibling,n=0;break;case 38:{const t=this.format.getLine(i,null);s=t?.previousElementSibling,n=0;break}case 40:{const t=this.format.getLine(i,null);s=t?.nextElementSibling;break}}else $i.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._antiBlur=!0,t.stopPropagation(),t.preventDefault(),this.selection.setRange(s,n,s,n)}finally{this.editor._antiBlur=!1}}else 27!==e||this.deselect()}}function Yi(t,e,i){t.preventDefault(),t.stopPropagation();const s=e.cloneNode(!0);Q.removeClass(s,"se-component-selected"),s.querySelectorAll(".se-figure-selected").forEach((t=>Q.removeClass(t,"se-figure-selected"))),i.setData("text/html",s.outerHTML)}Fi.prototype={insert(t,e,i){if(this.editor.frameContext.get("isReadOnly")||!e&&!this.char.check(t))return null;const s=this.html.remove(),n=this.isInline(t);this.selection.getRangeAndAddLine(this.selection.getRange(),s.container);const o=this.selection.getNode();let l=null,r=this.format.getLine(o,null);if(Q.isListCell(r))this.html.insertNode(t,n||o===r?null:s.container.nextSibling,!0),n||t.nextSibling||t.parentNode.appendChild(Q.createElement("BR"));else{if(!n&&this.selection.getRange().collapsed&&(3===s.container.nodeType||Q.isBreak(s.container))){const t=Q.getParentElement(s.container,this.format.isBlock.bind(this.format));l=this.nodeTransform.split(s.container,s.offset,t?Q.getNodeDepth(t)+1:0),l&&(r=l.previousSibling)}this.html.insertNode(t,n||this.format.isBlock(r)?null:r,!0),!n&&r&&Q.isZeroWith(r)&&Q.removeItem(r)}if(n){const e=Q.createTextNode(K.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}if(this.history.push(!1),!i){this.selection.setRange(t,0,t,0);const e=this.get(t);e?this.select(e.target,e.pluginName):l&&(l=Q.getEdgeChildNodes(l,null).sc||l,this.selection.setRange(l,0,l,0))}return l||t},get(t){if(!t)return null;let e,i="",s={},n=!1;if(this.is(t)){if(Q.hasClass(t,"se-component")&&!Q.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}if(!e&&t.nodeName){this.__isFiles(t)&&(n=!0);const o=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!o)return null;e=o.target,i=o.pluginName,s=o.options}if(!e)return null;const o=Ii.GetContainer(e);return this.info={target:e,pluginName:i,options:s,container:o.container||o.cover||e,cover:o.cover,inlineCover:o.inlineCover,caption:o.caption,isFile:n}},select(t,e,i){const s=this.get(t);if(!s||Q.isUneditable(Q.getParentElement(t,this.is.bind(this)))||Q.isUneditable(t))return!1;const n=this.plugins[e];if(!n)return;if(!i&&zt.get("__overInfo")!==Ri){if(this.editor.status._onMousedown)return;this.editor._antiBlur=!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 o;this.isSelected=!0,"function"==typeof n.select&&(o=n.select(t)),o||Q.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,zt.set("__dragInst",this);const l=zt.get("__overInfo");if(Vi.setTimeout((()=>{zt.set("__overInfo",l===Ri&&void 0),l!==Ri&&this.__addGlobalEvent(),s.isFile||this.__addNotFileGlobalEvent()}),0),Q.addClass(s.container,"se-component-selected"),l!==Ri){if(Q.setDisabled(this.editor._controllerOnDisabledButtons,!0),!this.isInline(s.container))return;const t=s.container;let e=null;t.previousSibling&&!Q.isBreak(t.previousSibling)||(e=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!Q.isBreak(t.nextSibling)||(e=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.editor.status.onSelected=!0}else if(!Q.hasClass(s.container,"se-input-component")){const t=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");Q.addClass(t,"se-drag-handle-full"),this.editor._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",zt.set("__dragHandler",t),zt.set("__dragContainer",s.container),zt.set("__dragCover",s.cover),t.style.display="block"}},deselect(){Vi.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__deselect(),Q.setDisabled(this.editor._controllerOnDisabledButtons,!1)},is(t){return!(!t||!/^FIGURE$/i.test(t.nodeName)&&!Q.hasClass(t,"se-component")&&!this.editor._componentManager.find((e=>e(t))))},isInline(t){return!!t&&(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),!!Q.hasClass(t,"se-inline-component")||!(!this.editor._componentManager.find((e=>e(t)))||!Q.hasClass(t,"se-inline-component")))},isBasic(t){return this.is(t)&&!this.isInline(t)},__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(){this.editor._antiBlur=!1,zt.set("__overInfo",null),this._removeDragEvent(this),Q.removeClass(this.currentInfo?.container,"se-component-selected|"),Q.removeClass(this.currentInfo?.cover,"se-figure-over-selected");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.editor.__offControllers()},_setComponentLineBreaker(t){const e=zt.get("__overInfo")===Ri;this.eventManager._lineBreakComp=null;const i=this.get(t);if(!i)return;const s=this.editor.frameContext,n=i.container,o=Q.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=Q.isListCell(n.parentNode);let p,g;const m=this.options.get("_rtl"),f=m?["right","left"]:["left","right"],_=c.offsetTop,{scrollX:b,scrollY:v}=this.offset.getLocal(c);if(u?n.previousSibling:this.format.isLine(n.previousElementSibling))a.display="none";else{const t=tt.get(Vi.getComputedStyle(l).height,1);this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2,a.top=p-v-t/2+"px",a[f[0]]=(o?4:this.offset.get(d).left+g)+"px",a[f[1]]="",l.setAttribute("data-offset",v+","+b),e?Q.removeClass(l,"se-on-selected"):Q.addClass(l,"se-on-selected"),a.display="block"}if(u?n.nextSibling:this.format.isLine(n.nextElementSibling))h.display="none";else{const t=Vi.getComputedStyle(r),i=tt.get(t.height,1),s=tt.get(t.width,1);p||(this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-v-i/2+"px",h.right="",h.left=this.offset.get(d).left+(m?0:d.offsetWidth)-(o?0:g)-(o?s/2:s)+"px";const l="left";r.setAttribute("data-offset",v+","+l+","+b),e?Q.removeClass(r,"se-on-selected"):Q.addClass(r,"se-on-selected"),h.display="block"}},__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(),Oi?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",zt.get("__dragHandler")&&(zt.get("__dragHandler").style.display="none"),Q.removeClass([zt.get("__dragHandler"),zt.get("__dragContainer")],"se-dragging"),Q.removeClass([zt.get("__dragCover"),zt.get("__dragContainer")],"se-drag-over"),zt.set("__figureInst",null),zt.set("__dragInst",null),zt.set("__dragHandler",null),zt.set("__dragContainer",null),zt.set("__dragCover",null),zt.set("__dragMove",null),zt.set("__overInfo",null)},constructor:Fi};const Ki=Fi,Ji=function(t){Ot.call(this,t),this._listCamel=this.options.get("__listCommonStyle"),this._listKebab=Y.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")};function Qi(t){const e=t.parentNode;let i,s,n,o,l,r=e,a=r.parentNode;for(;Q.isListCell(a);){for(o=Q.getPositionIndex(t),i=a.nextElementSibling,s=a.parentNode,n=r;n;){if(r=r.nextSibling,Q.isList(n)){for(l=n.childNodes;l[o];)s.insertBefore(l[o],i);0===l.length&&Q.removeItem(n)}else s.appendChild(n);n=r}r=s,a=s.parentNode}return 0===e.children.length&&Q.removeItem(e),s}function ts(t,e,i){const s=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],Q.isListCell(n)?(e<0||n.previousElementSibling)&&s.push(n):(o=/\d+/.test(n.style[i])?tt.get(n.style[i],0):0,o+=e,Q.setStyle(n,i,o<=0?"":o+"px"));return s}function es(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)}Ji.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),Q.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(Q.getNodeFromPath(e.firstPath,o),e.startOffset,Q.getNodeFromPath(e.lastPath,l),e.endOffset),this.history.push(!1)},getLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(Q.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=Q.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&&Q.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Q.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&&Q.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Q.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&Q.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,Q.removeItem(n))}c||Q.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(Q.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))s=Q.createElement("BR");else{const t=e?"string"==typeof e?e:e.nodeName:!this.isLine(i)||this.isBlock(i)||this.isBrLine(i)?this.options.get("defaultLine"):i.nodeName;s=Q.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(i))&&Q.copyTagAttributes(s,e||i,["id"])}return Q.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(Q.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],Q.isListCell(t)&&(i=t.lastElementChild,i&&Q.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=i.lastElementChild,e.includes(n)))){let t=null;for(;t=n.lastElementChild;)if(Q.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}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),Q.isTableCell(s)?(n=null,o=s):(n=s.nextSibling,o=s.parentNode),t=t.cloneNode(!1);let l=Q.getNodeDepth(s),r=null;const a=[],h=(t,e,i)=>{let s=null;if(t!==e&&!Q.isTableElements(e)){if(e&&Q.getNodeDepth(t)===Q.getNodeDepth(e))return i;s=this.nodeTransform.removeAllParents(e,null,t)}return s?s.ec:i};for(let i,s,c,d,u,p,g,m=0,f=e.length;m<f;m++)if(i=e[m],s=i.parentNode,s&&!t.contains(s))if(c=Q.getNodeDepth(i),Q.isList(s)){if(null===r&&(p?(r=p,g=!0,p=null):r=s.cloneNode(!1)),a.push(i),u=e[m+1],m===f-1||u?.parentNode!==s){i.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=s.parentNode;for(;Q.isList(m);)e=Q.createElement(m.nodeName),e.appendChild(r),r=e,m=m.parentNode;const f=this.removeBlock(s,a,null,!0,!0);l>=c?(l=c,o=f.cc,n=h(o,s,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=h(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)r.appendChild(f.removeArray[t]);g||t.appendChild(r),p&&f.removeArray[f.removeArray.length-1].appendChild(p),r=null,g=!1}}else l>=c&&(l=c,o=s,n=i.nextSibling),t.appendChild(i),o!==s&&(d=h(o,s),void 0!==d&&(n=d));if(this.editor.effectNode=null,this.nodeTransform.mergeSameTags(t,null,!1),this.nodeTransform.mergeNestedTags(t,(t=>Q.isList(t))),n&&Q.getNodeDepth(n)>0&&(Q.isList(n.parentNode)||Q.isList(n.parentNode.parentNode))){const e=Q.getParentElement(n,(t=>this.isBlock(t)&&!Q.isList(t))),i=this.nodeTransform.split(n,null,e?Q.getNodeDepth(e)+1:0);i.parentNode.insertBefore(t,i)}else o.insertBefore(t,n),h(t,n);const c=Q.getEdgeChildNodes(t.firstElementChild,t.lastElementChild);e.length>1?this.selection.setRange(c.sc,0,c.ec,c.ec.textContent.length):this.selection.setRange(c.ec,c.ec.textContent.length,c.ec,c.ec.textContent.length),this.history.push(!1)},removeBlock(t,e,i,s,n){const o=this.selection.getRange();let l=o.startOffset,r=o.endOffset,a=Q.getListChildNodes(t,(e=>e.parentNode===t)),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=Q.isList(i);let m=!1,f=!1,_=!1;const b=(e,i,s,n)=>{if(Q.isZeroWith(i)&&(i.innerHTML=K.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)||Q.isBreak(c)||Q.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(Q.isListCell(e)&&Q.isListCell(a)&&Q.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,v=a.length;r<v;r++)if(n=a[r],3!==n.nodeType||!Q.isList(u))if(_=!1,s&&0===r&&(c=e&&e.length!==v&&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&&Q.isListCell(n))if(l&&Q.getNodeDepth(n)!==Q.getNodeDepth(l)&&(Q.isListCell(h)||Q.getArrayItem(n.children,Q.isList,!1))){const e=n.nextElementSibling,i=this._removeNestedList(n,!1);t===i&&e===n.nextElementSibling||(t=i,f=!0)}else{const e=n;n=Q.createElement(s?e.nodeName:Q.isList(t.parentNode)||Q.isListCell(t.parentNode)?"LI":Q.isTableCell(t.parentNode)?"DIV":this.options.get("defaultLine"));const i=Q.isListCell(n),o=e.childNodes;for(;o[0]&&(!Q.isList(o[0])||i);)n.appendChild(o[0]);Q.copyFormatAttributes(n,e),_=!0}else n=n.cloneNode(!1);if(!f&&(s?(p.push(n),Q.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=Q.getListChildNodes(t,(e=>e.parentNode===t)),u=t.cloneNode(!1),h=t.parentNode,r=-1,v=a.length;continue}}const v=t.parentNode;let y=t.nextSibling;u?.children.length>0&&v.insertBefore(u,y),i?c=i.previousSibling:c||(c=t.previousSibling),y=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?Q.removeItem(t):this.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(s)C={cc:v,sc:c,so:l,ec:y,eo:r,removeArray:p};else{c||(c=d),d||(d=c);const t=Q.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}Q.sortNodeByDepth(l,!0);const r=l[0],a=l[l.length-1];let h=!Q.isListCell(r)&&!this.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentNode.previousElementSibling,c=!Q.isListCell(a)&&!this.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentNode.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&Q.isZeroWith(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(!Q.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&&!Q.isWysiwygFrame(t)&&t.nodeName===s?t:h,c=e&&!Q.isWysiwygFrame(e)&&e.nodeName===s?e:c;const i=h?.tagName===s,o=c?.tagName===s;let r=i?h:Q.createElement(s,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!this.component.is(t)&&!Q.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=Q.isListCell(e),f=this.isBlock(c)?c:null,g=o&&!Q.isWysiwygFrame(c)?c.parentNode:c,m=o&&!Q.isWysiwygFrame(c)?!h||Q.isListCell(g)?c:c.nextSibling:e.nextSibling,t=Q.createElement("LI"),Q.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&&Q.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),Q.removeItem(e),i&&null===d&&(d=r.children.length-1),h&&(this.getBlock(p,u)!==this.getBlock(c,u)||Q.isList(p)&&Q.isList(c)&&Q.getNodeDepth(p)!==Q.getNodeDepth(c))&&(r=Q.createElement(s,{style:"list-style-type: "+n})),0===f?.children.length&&Q.removeItem(f)}else Q.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,Q.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=Q.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&&Q.isList(r)&&(t?t!==r?(i&&Q.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentNode,o.f,a,!1,!0),r=l[c].parentNode,e||(a=Q.createElement(s,{style:"list-style-type: "+n})),t=r,o={r:t,f:[Q.getParentElement(l[c],"LI")]}):o.f.push(Q.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[Q.getParentElement(l[c],"LI")]}),c===d-1&&(i&&Q.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentNode,o.f,a,!1,!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=Q.isList(h),!a&&d)a=h,i={r:a,f:[Q.getParentElement(t[u],"LI")]},0===u&&(s=!0);else if(a&&d)if(a!==h){const r=this.detachRangeFormatElement(i.f[0].parentNode,i.f,null,e,!0);h=t[u].parentNode,s&&(o=r.sc,s=!1),c&&(l=r.ec),d?(a=h,i={r:a,f:[Q.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else i.f.push(Q.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&Q.isList(a)){const t=this.detachRangeFormatElement(i.f[0].parentNode,i.f,null,e,!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=ts(this.getLines(null),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)},outdent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=ts(this.getLines(null),-1*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)},applyInlineElement(t,e,i,s){if(Q.getParentElement(this.selection.getNode(),Q.isNonEditable))return;this.selection._resetRangeToTextNode();let n=this.selection.getRangeAndAddLine(this.selection.getRange(),null);e=e?.length>0&&e,i=i?.length>0&&i;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&&Q.isNonEditable(r)){const t=r.parentNode;return void(!Q.isListCell(t)||Y.getValues(t.style).some((t=>this._listKebab.includes(t))))}if(n.collapsed&&!l&&1===r.nodeType&&!Q.isBreak(r)&&!this.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?Q.isBreak(e)?e:e.nextSibling:null);const i=Q.createTextNode(K.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=Q.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.classList;for(let t=0,e=l.length;t<e;t++)s.push("."+l[t]);if(s.length>0){for(;!this.isLine(e)&&!Q.isWysiwygFrame(e);){for(let n=0;n<s.length;n++)if(1===e.nodeType){const l=s[n],r=!!/^\./.test(l)&&new d("\\s*"+l.replace(/^\./,"")+"(\\s+|$)","ig"),a=o?!!e.style[l]:!!e.style[l]&&!!t.style[l]&&e.style[l]===t.style[l],h=!1!==r&&(o?!!e.className.match(r):!!e.className.match(r)&&!!t.className.match(r));(a||h)&&i++}e=e.parentNode}if(i>=s.length)return}}let p,g={},m={},f="",_="",b=null;if(e){for(let t,i=0,s=e.length;i<s;i++)t=e[i],/^\./.test(t)?_+=(_?"|":"\\s*(?:")+t.replace(/^\./,""):f+=(f?"|":"(?:;|^|\\s)(?:")+t;f&&(f+=")\\s*:[^;]*\\s*(?:;|$)",f=new d(f,"ig")),_&&(_+=")(?=\\s+|$)",_=new d(_,"ig"))}if(i){b="^(?:"+i[0];for(let t=1;t<i.length;t++)b+="|"+i[t];b+=")$",b=new d(b,"i")}const v=Boolean,y={v:!1},C=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||Q.isBreak(e))return e;if(l)return null;const i=!b&&o||b?.test(e.nodeName);if(i&&!s)return y.v=!0,null;const n=e.style.cssText;let r="";f&&n.length>0&&(r=n.replace(f,"").trim(),r!==n&&(y.v=!0));const a=e.className;let h="";return _&&a.length>0&&(h=a.replace(_,"").trim(),h!==a&&(y.v=!0)),(!o||!_&&a||!f&&n||r||h||!i)&&(r||h||e.nodeName!==u||v(f)!==v(n)||v(_)!==v(a))?(f&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),_&&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)},w=this.getLines(null);n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.getLine(r,null)||(r=Q.getEdgeChild(w[0],(function(t){return 3===t.nodeType}),!1),a=0),this.getLine(h,null)||(h=Q.getEdgeChild(w[w.length-1],(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const x=this.getLine(r,null)===this.getLine(h,null),E=w.length-(x?0:1);p=t.cloneNode(!1);const S=l||o&&function(t,e){for(let i=0,s=e.length;i<s;i++)if(t._isNonSplitNode(e[i])||t._sn_isSizeNode(e[i]))return!0;return!1}(this,i),T=o||this._sn_isSizeNode(p),k=this._sn_getMaintainedNode.bind(this,S,T),N=this._sn_isMaintainedNode.bind(this,S,T);if(x){this._sn_resetCommonListCell(w[0],e)&&(n=this.selection.setRange(r,a,h,c));const t=this._setNode_oneLine(w[0],p,C,r,a,h,c,l,o,n.collapsed,y,k,N);g.container=t.startContainer,g.offset=t.startOffset,m.container=t.endContainer,m.offset=t.endOffset,g.container===m.container&&Q.isZeroWith(g.container)&&(g.offset=m.offset=1),this._sn_setCommonListStyle(t.ancestor,null)}else{let i=!1;E>0&&this._sn_resetCommonListCell(w[E],e)&&(i=!0),this._sn_resetCommonListCell(w[0],e)&&(i=!0),i&&this.selection.setRange(r,a,h,c),E>0&&(p=t.cloneNode(!1),m=this._setNode_endLine(w[E],p,C,h,c,l,o,y,k,N));for(let i,s=E-1;s>0;s--)this._sn_resetCommonListCell(w[s],e),p=t.cloneNode(!1),i=this._setNode_middleLine(w[s],p,C,l,o,y,m.container),i.endContainer&&i.ancestor.contains(i.endContainer)&&(m.ancestor=null,m.container=i.endContainer),this._sn_setCommonListStyle(i.ancestor,null);p=t.cloneNode(!1),g=this._setNode_startLine(w[0],p,C,r,a,l,o,y,k,N,m.container),g.endContainer&&(m.ancestor=null,m.container=g.endContainer),E<=0?m=g:m.container||(m.ancestor=null,m.container=g.container,m.offset=g.container.textContent.length),this._sn_setCommonListStyle(g.ancestor,null),this._sn_setCommonListStyle(m.ancestor||this.getLine(m.container),null)}return this.editor._offCurrentController(),this.selection.setRange(g.container,g.offset,m.container,m.offset),this.history.push(!1),p},removeInlineElement(){this.applyInlineElement(null,null,null,null)},isEdgeLine(t,e,i){if(!Q.isEdgePoint(t,e,i))return!1;const s=[];for(i="front"===i?"previousSibling":"nextSibling";t&&!this.isLine(t)&&!Q.isWysiwygFrame(t);){if(t[i]&&(!Q.isBreak(t[i])||t[i][i]))return null;1===t.nodeType&&s.push(t.cloneNode(!1)),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"string"==typeof t?this._formatLineCheck.test(t):t&&1===t.nodeType&&(this._formatLineCheck.test(t.nodeName)||Q.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this._nonFormat(t)},isLineOnly(t){return this._formatLineCheck.test(t)&&!this._formatBlockCheck.test(t)},isBrLine(t){return"string"==typeof t?this._formatBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatBrLineCheck.test(t.nodeName)||Q.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)||Q.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)||Q.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)||Q.hasClass(t,"__se__format__br_line__closure_.+"))&&!this._nonFormat(t)},getLines(t){if(!this.selection._resetRangeToTextNode())return[];let e=this.selection.getRange();if(Q.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=Q.getListChildren(n,(e=>t?t(e):this.isLine(e)));if(Q.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!Q.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);Q.isTableElements(d)&&Q.isListCell(d.parentNode)&&(d=d.parentNode),Q.isTableElements(u)&&Q.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=Q.getParentElement(e,this.component.is.bind(this.component)),s=Q.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=Q.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 Q.isExcludeFormat(t)||this.component.is(t)||Q.isWysiwygFrame(t)},_isNonSplitNode:t=>t&&3!==t.nodeType&&/^(a|label|code|summary)$/i.test("string"==typeof t?t:t.nodeName),_notTextNode(t){return t&&3!==t.nodeType&&(this.component.is(t)||/^(br|input|select|canvas|img|iframe|audio|video)$/i.test("string"==typeof t?t:t.nodeName))},_isIgnoreNodeChange(t){return t&&3!==t.nodeType&&(Q.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=Q.getNodePath(t.startContainer,n,null,null),r=Q.getNodePath(t.endContainer,o,null,null),a=this.removeList(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.selection.setRange(Q.getNodeFromPath(l,n),i,Q.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){Q.isListCell(i)&&(t=i,s=null),t.insertBefore(e,s),n.s||(n.s=Q.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?Q.getNodePath(n.sl,t):null;n.e=Q.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=Q.getNodeFromPath(o,t))}return e},_detachNested(t){const e=t[0],i=t[t.length-1],s=i.nextElementSibling,n=e.parentNode,o=n.parentNode.nextElementSibling,l=n.parentNode.parentNode;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=Q.getPositionIndex(s);for(;e[o];)t.appendChild(e[o]);i.appendChild(t)}0===n.children.length&&Q.removeItem(n),this.nodeTransform.mergeSameTags(l);const r=Q.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 Q.isListCell(t)}))).length;if(0===i||!e&&!Q.isListCell(t[0].previousElementSibling)&&!Q.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&&Q.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=Q.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=Q.createElement(s.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);this._attachNested(s,e,l,r,a);const h=Q.getNodeFromPath(a.s,a.sl),c=Q.getNodeFromPath(a.e,a.el);o={sc:h,so:0,ec:c,eo:c.textContent.length}}return o},_removeNestedList(t,e){const i=Qi(t);let s,n,o;if(i){s=i.cloneNode(!1),n=i.childNodes;const e=Q.getPositionIndex(t);for(;n[e];)s.appendChild(n[e])}else s=t;if(e)o=Q.getListChildren(s,(t=>Q.isListCell(t)&&!t.previousElementSibling));else{const e=Q.getNodeDepth(t)+2;o=Q.getListChildren(t,(t=>Q.isListCell(t)&&!t.previousElementSibling&&Q.getNodeDepth(t)===e))}for(let t=0,e=o.length;t<e;t++)Qi(o[t]);return i&&(i.parentNode.insertBefore(s,i.nextSibling),0===n?.length&&Q.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)||Q.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&p===o.parentNode&&p.nodeName===e.nodeName&&Q.isZeroWith(s.textContent.slice(0,n))&&Q.isZeroWith(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=!Q.isZeroWith(t),t!==s)if(t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else n=!0;else e=!0;if(r)return Q.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 v,y,C,w,x,E=s,S=n,T=o,k=l,N=!1,L=!1;const H=RegExp;function M(t){const e=new H("(?:;|^|\\s)(?:"+w+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let i="";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(!N&&a===E){let t=_;x=d(a);const o=Q.createTextNode(1===E.nodeType?"":E.substringData(0,S)),l=Q.createTextNode(1===E.nodeType?"":E.substringData(S,b&&k>=S?k-S:E.data.length-S));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)}Q.isZeroWith(o)||n.appendChild(o);const r=d(n);for(r&&(x=r),x&&(t=x),y=a,v=[],w="";y!==t&&y!==m&&null!==y;)s=u(y)?null:i(y),s&&1===y.nodeType&&M(y)&&(v.push(s),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;const h=v.pop()||l;for(C=y=h;v.length>0;)y=v.pop(),C.appendChild(y),C=y;if(e.appendChild(h),t.appendChild(e),x&&!d(T)&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),E=l,S=0,N=!0,y!==l&&y.appendChild(E),!b)continue}if(L||a!==T){if(N){if(1===a.nodeType&&!Q.isBreak(a)){g._isIgnoreNodeChange(a)?(_.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),_.appendChild(e),f.push(e))):t(a,a);continue}y=a,v=[],w="";const o=[];for(;null!==y.parentNode&&y!==m&&y!==e;)s=L?y.cloneNode(!1):i(y),1===y.nodeType&&!Q.isBreak(a)&&s&&M(y)&&(u(y)?x||o.push(s):v.push(s),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;v=v.concat(o);const l=v.pop()||a;for(C=y=l;v.length>0;)y=v.pop(),C.appendChild(y),C=y;if(!u(e.parentNode)||u(l)||Q.isZeroWith(e)||(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),L||x||!u(l))l===a?n=L?_:e:L?(_.appendChild(l),n=y):(e.appendChild(l),n=y);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?y:e}if(x&&3===a.nodeType)if(d(a)){const t=Q.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||Q.isBreak(a)||(p=c),t(a,p)}else{x=d(a);const t=Q.createTextNode(1===T.nodeType?"":T.substringData(k,T.length-k)),n=Q.createTextNode(b||1===T.nodeType?"":T.substringData(0,k));if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),!Q.isZeroWith(t)){y=a,w="",v=[];const e=[];for(;y!==_&&y!==m&&null!==y;)1===y.nodeType&&M(y)&&(u(y)?e.push(y.cloneNode(!1)):v.push(y.cloneNode(!1)),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;for(v=v.concat(e),c=C=y=v.pop()||t;v.length>0;)y=v.pop(),C.appendChild(y),C=y;_.appendChild(c),y.textContent=t.data}if(x&&c){const t=d(c);t&&(x=t)}for(y=a,v=[],w="";y!==_&&y!==m&&null!==y;)s=u(y)?null:i(y),s&&1===y.nodeType&&M(y)&&(v.push(s),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;const o=v.pop()||n;for(C=y=o;v.length>0;)y=v.pop(),C.appendChild(y),C=y;x?((e=e.cloneNode(!1)).appendChild(o),x.insertBefore(e,x.firstChild),_.appendChild(x),f.push(e),x=null):e.appendChild(o),T=n,k=n.data.length,L=!0,!r&&h&&(e=n,n.textContent=K.zeroWidthSpace),y!==n&&y.appendChild(T)}}}(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=Q.createTextNode(K.zeroWidthSpace),_.replaceChild(i,e);else{const t=e.childNodes;for(s=t[0];t[0];)n=t[0],_.insertBefore(n,e);Q.removeItem(e)}0===t&&(h?E=T=i:(E=s,T=n))}else{if(a)for(let t=0;t<f.length;t++)es(f[t]);h&&(E=T=e)}this.nodeTransform.removeEmptyNode(_,e,!1),h&&(S=E.textContent.length,k=T.textContent.length);const A=r||0===T.textContent.length;Q.isBreak(T)||0!==T.textContent.length||(Q.removeItem(T),T=E),k=A?T.textContent.length:k;const B={s:0,e:0},I=Q.getNodePath(E,_,B),V=!T.parentNode;V&&(T=E);const R={s:0,e:0},O=Q.getNodePath(T,_,V||A?null:R);S+=B.s,k=h?S:V?E.textContent.length:A?k+B.s:k+R.s;const z=this.nodeTransform.mergeSameTags(_,[I,O],!0);return t.parentNode.replaceChild(_,t),E=Q.getNodeFromPath(I,_),T=Q.getNodeFromPath(O,_),{ancestor:_,startContainer:E,startOffset:S+z[0],endContainer:T,endOffset:k+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)||Q.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&d.nodeName===e.nodeName&&!this.isLine(d)&&!d.nextSibling&&Q.isZeroWith(s.textContent.slice(0,n))){let i=!1,o=s.previousSibling;for(;o;){if(!Q.isZeroWith(o)){i=!1;break}o=o.previousSibling}if(i)return Q.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,v,y=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&&!Q.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=Q.getNodePath(c,d);c=Q.getNodeFromPath(t,l)}}else t(d,d);continue}_=d,f=[];const o=[];for(;null!==_.parentNode&&_!==p&&_!==e;)s=i(_),1===_.nodeType&&s&&(h(_)?v||o.push(s):f.push(s)),_=_.parentNode;f=f.concat(o);const r=f.length>0,y=f.pop()||d;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(h(e.parentNode)&&!h(y)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!v&&h(y)){e=e.cloneNode(!1);const t=y.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);y.appendChild(e),m.appendChild(y),n=h(_)?e:_,g.push(e)}else r?(e.appendChild(y),n=_):n=e;if(v&&3===d.nodeType)if(a(d)){const t=Q.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));v.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else v=null}if(w||d!==y)s=w?i(d):d.cloneNode(!1),s&&(n.appendChild(s),1!==d.nodeType||Q.isBreak(d)||(x=s)),t(d,x);else{let t=m;v=a(d);const o=Q.createTextNode(1===y.nodeType?"":y.substringData(0,C)),l=Q.createTextNode(1===y.nodeType?"":y.substringData(C,y.length-C));if(v){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)}v=v.cloneNode(!1)}Q.isZeroWith(o)||n.appendChild(o);const r=a(n);for(r&&(v=r),v&&(t=v),_=n,f=[];_!==t&&null!==_;)s=i(_),1===_.nodeType&&s&&f.push(s),_=_.parentNode;const h=f.pop()||n;for(b=_=h;f.length>0;)_=f.pop(),b.appendChild(_),b=_;h!==n?(e.appendChild(h),n=_):n=e,Q.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),y=l,C=0,w=!0,n.appendChild(y)}}}(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);Q.removeItem(e),0===t&&(y=s)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)es(g[t])}if(o||0!==m.childNodes.length){this.nodeTransform.removeEmptyNode(m,e,!1),Q.isZeroWith(m.textContent)&&(y=m.firstChild,C=0);const i={s:0,e:0},s=Q.getNodePath(y,m,i);C+=i.s;const n=this.nodeTransform.mergeSameTags(m,[s],!0);t.parentNode.replaceChild(m,t),y=Q.getNodeFromPath(s,m),C+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=Q.createTextNode(K.zeroWidthSpace),t.appendChild(y));return{ancestor:m,container:y,offset:C,endContainer:c}},_setNode_middleLine(t,e,i,s,n,o,l){if(!n){let i=null;l&&t.contains(l)&&(i=Q.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(!Q.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,Q.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=s.innerHTML,{ancestor:t,endContainer:i?Q.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(Q.isBreak(p)||!r._isIgnoreNodeChange(p))s=i(p),s&&(c=!1,n.appendChild(s),1===p.nodeType&&(g=s)),Q.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=Q.getNodePath(l,p);l=Q.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);Q.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)es(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)||Q.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&c.nodeName===e.nodeName&&!this.isLine(c)&&!c.previousSibling&&Q.isZeroWith(s.textContent.slice(n))){let i=!1,o=s.nextSibling;for(;o;){if(!Q.isZeroWith(o)){i=!1;break}o=o.nextSibling}if(i)return Q.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,v=s,y=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&&!Q.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=Q.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!==v)s=C?i(r):r.cloneNode(!1),s&&(n.insertBefore(s,n.firstChild),1!==r.nodeType||Q.isBreak(r)||(c=s)),t(r,c);else{b=a(r);const t=Q.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=Q.createTextNode(1===v.nodeType?"":v.substringData(0,y));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(Q.isZeroWith(t)||n.insertBefore(t,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 l=m.pop()||n;for(_=f=l;m.length>0;)f=m.pop(),_.appendChild(f),_=f;l!==n?(e.insertBefore(l,e.firstChild),n=f):n=e,Q.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),v=o,y=o.data.length,C=!0,n.insertBefore(v,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);Q.removeItem(e),t===p.length-1&&(v=s,y=s.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)es(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),Q.isZeroWith(g.textContent)?(v=g.firstChild,y=v.textContent.length):Q.isZeroWith(v)&&(v=e,y=1);const i={s:0,e:0},s=Q.getNodePath(v,g,i);y+=i.s;const n=this.nodeTransform.mergeSameTags(g,[s],!0);t.parentNode.replaceChild(g,t),v=Q.getNodeFromPath(s,g),y+=n[0]}else t.childNodes?v=t.childNodes[0]:(v=Q.createTextNode(K.zeroWidthSpace),t.appendChild(v));return{ancestor:g,container:v,offset:1===v.nodeType&&1===y?v.childNodes.length:y}},_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:Q.getParentElement(i,this._isNonSplitNode.bind(this))||(e?null:Q.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 Q.getParentElement(i,this._isNonSplitNode.bind(this))?s:s||!e&&this._sn_isSizeNode(i)},_sn_setCommonListStyle(t,e){if(!Q.isListCell(t))return;const i=Q.getArrayItem((e||t).childNodes,(function(t){return!Q.isBreak(t)}),!0);if(!(e=i[0])||i.length>1||1!==e.nodeType)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=Y.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);Q.removeItem(e)}},_sn_resetCommonListCell(t,e){if(!Q.isListCell(t))return;e||(e=this._listKebab);const i=Q.getArrayItem(t.childNodes,(t=>!Q.isBreak(t)),!0),s=t.style,n=[],o=[],l=Y.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=Q.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=Y.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},constructor:Ji};const is=Ji,ss=function(t){Ot.call(this,t);const e=this.options;this._isAllowedClassName=function(t){return this.test(t)?t:""}.bind(this.options.get("allowedClassName")),this._allowHTMLComment=null,this._disallowedStyleNodesRegExp=null,this._htmlCheckWhitelistRegExp=null,this._htmlCheckBlacklistRegExp=null,this._elementWhitelistRegExp=null,this._elementBlacklistRegExp=null,this._attributeWhitelist=null,this._attributeWhitelistRegExp=null,this._attributeBlacklist=null,this._attributeBlacklistRegExp=null,this._textStyleTags=e.get("_textStyleTags"),this._autoStyleify=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+("+this.options.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("^("+os(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this._elementWhitelistRegExp=J.createElementWhitelist(os(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this._elementBlacklistRegExp=J.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=os(u[t],c):p[t]=new RegExp("\\s(?:"+os(u[t],"")+")"+d,"ig"));this._attributeWhitelistRegExp=new RegExp("\\s(?:"+(g||c)+"|data-se-[^\\s]+"+(this.options.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=os(m[t],""):p[t]=new RegExp("\\s(?:"+os(m[t],"")+")"+d,"ig");if(this._attributeBlacklistRegExp=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this._attributeBlacklist=p,this.options.get("autoStyleify").length>0){const t=this.options.get("convertTextTags"),e={};this.options.get("autoStyleify").forEach((i=>{switch(i){case"bold":e.bold={regex:/font-weight\s*:\s*bold/i,tag:t.bold};break;case"italic":e.italic={regex:/font-style\s*:\s*italic/i,tag:t.italic};break;case"underline":e.underline={regex:/text-decoration\s*:\s*underline/i,tag:t.underline};break;case"strike":e.strike={regex:/text-decoration\s*:\s*line-through/i,tag:t.strike}}})),this._autoStyleify=e}};function ns(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(Q.isMedia(o)||Q.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 os(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}ss.prototype={filter(t,{tagWhitelist:e,tagBlacklist:i,validate:s,validateAll:n}){if(e&&(t=t.replace(J.createElementWhitelist(e),"")),i&&(t=t.replace(J.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=function(t){return 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,e,i,s){const{tagFilter:n,formatFilter:o,classFilter:l,styleNodeFilter:r,attrFilter:a,styleFilter:h}=this.options.get("strictMode");let c="";if(t=this.compress(t),n&&(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");Q.getListChildNodes(e.body,J.spanToStyleNode.bind(null,this._autoStyleify)),t=e.body.innerHTML}(a||h)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,ns.bind(this,a,h)));const d=this._d.createRange().createContextualFragment(t,!0);if(n)try{this._consistencyCheckOfHTML(d,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,n,o,l)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}if(this.options.get("__pluginRetainFilter")&&this.editor._MELInfo.forEach(((t,e)=>{const i=d.querySelectorAll(e);for(let e=0,s=i.length;e<s;e++)t(i[e])})),o){let t=d.childNodes;e||(e=this._isFormatData(t)),e&&(t=this._editFormat(d).childNodes);for(let i,s=0,n=t.length;s<n;s++)i=t[s],this.__allowedTagNameRegExp.test(i.nodeName)?c+=i.outerHTML:c+=this._makeLine(i,e)}return c||(c=t),n&&(i&&(c=c.replace("string"==typeof i?J.createElementWhitelist(i):i,"")),s&&(c=c.replace("string"==typeof s?J.createElementBlacklist(s):s,""))),r&&(c=this._styleNodeConvertor(c)),c},insert(t,e,i,s){if(this.editor.frameContext.get("wysiwygFrame").contains(this.selection.get().focusNode)||this.editor.focus(),"string"==typeof t){s||(t=this.clean(t,!1,null,null));try{if(Q.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&&Q.isBreak(n)?(r=n,Q.removeItem(n)):(l=this.insertNode(n,o,!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,i,!1);else{let e=null;(this.format.isLine(t)||Q.isMedia(t))&&(e=this.format.getLine(this.selection.getNode(),null)),this.insertNode(t,e,i)}this.editor.effectNode=null,this.editor.focus(),this.history.push(!1)},insertNode(t,e,i){let s=null;if(this.editor.frameContext.get("isReadOnly")||!i&&!this.char.check(t,null))return s;let n,o,l,r=this.selection.getRange(),a=Q.isListCell(r.commonAncestorContainer)?r.commonAncestorContainer:this.format.getLine(this.selection.getNode(),null),h=Q.isListCell(a)&&(Q.isListCell(t)||Q.isList(t)),c=null;const d=this.format.isBrLine(a),u=!d&&(this.format.isLine(t)||this.format.isBlock(t))||this.component.isBasic(t);if(h&&(l=e||Q.isList(t)?a.lastChild:a.nextElementSibling,c=Q.isList(t)?a:(l||a).parentNode),!e&&(u||this.component.isBasic(t)||Q.isMedia(t))){const t=Q.isEdgePoint(r.endContainer,r.endOffset,"end"),i=this.remove(),s=i.container,n=s===i.prevContainer&&r.collapsed?null:i.prevContainer;if(h&&n)if(c=3===n.nodeType?n.parentNode:n,c.contains(s)){let t=!0;for(l=s;l.parentNode&&l.parentNode!==c;)l=l.parentNode,t=!1;t&&s===n&&(l=l.nextSibling)}else l=null;else if(h&&Q.isListCell(s)&&!a.parentElement)a=Q.createElement("LI"),c.appendChild(a),s.appendChild(c),l=null;else if(3===s.nodeType||Q.isBreak(s)||h){const n=Q.getParentElement(s,(t=>this.format.isBlock(t)||Q.isListCell(t)));if(e=this.nodeTransform.split(s,i.offset,n?Q.getNodeDepth(n)+1:0))if(h){if(a.contains(s)){const i=Q.isList(a.lastElementChild);let s=null;t||(s=a.cloneNode(!1),s.appendChild(e.textContent.trim()?e:Q.createTextNode(K.zeroWidthSpace))),i&&(s||(s=a.cloneNode(!1),s.appendChild(Q.createTextNode(K.zeroWidthSpace))),s.appendChild(a.lastElementChild)),s&&(a.parentNode.insertBefore(s,a.nextElementSibling),l=e=s)}}else e=e.previousSibling;else l=e=a}}r=e||u?this.selection.getRange():this.selection.getRangeAndAddLine(this.selection.getRange(),null);const p=r.commonAncestorContainer,g=r.startOffset,m=r.endOffset,f=r.startContainer===p&&this.format.isLine(p),_=f&&(p.childNodes[g]||p.childNodes[0])||r.startContainer,b=f&&(p.childNodes[m]||p.childNodes[p.childNodes.length-1])||r.endContainer;if(!h)if(e)n=e.parentNode,e=e.nextSibling,o=!0;else if(n=_,3===_.nodeType&&(n=_.parentNode),r.collapsed)if(3===p.nodeType)e=p.textContent.length>m?p.splitText(m):p.nextSibling;else if(Q.isBreak(n))e=n,n=n.parentNode;else{const i=n.childNodes[g],s=3===i?.nodeType&&Q.isZeroWith(i)&&Q.isBreak(i.nextSibling)?i.nextSibling:i;s?!s.nextSibling&&Q.isBreak(s)?(n.removeChild(s),e=null):e=Q.isBreak(s)&&!Q.isBreak(t)?s:s.nextSibling:e=null}else if(_===b){e=Q.isEdgePoint(b,m)?b.nextSibling:b.splitText(m);let t=_;Q.isEdgePoint(_,g)||(t=_.splitText(g)),n.removeChild(t),0===n.childNodes.length&&u&&(n.innerHTML="<br>")}else{const i=this.remove(),s=i.container,o=i.prevContainer;if(0===s?.childNodes.length&&u&&(this.format.isLine(s)?s.innerHTML="<br>":this.format.isBlock(s)&&(s.innerHTML="<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">")),Q.isListCell(s)&&3===t.nodeType)n=s,e=null;else if(!u&&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 Q.isWysiwygFrame(s)&&!this.format.isLine(t)?(n=s.appendChild(Q.createElement(this.options.get("defaultLine"))),e=null):n=(e=u?b:s===o?s.nextSibling:s)&&e.parentNode?e.parentNode:p;for(;e&&!this.format.isLine(e)&&e.parentNode!==p;)e=e.parentNode}try{const i=this.editor.frameContext.get("wysiwyg");if(!h){if((Q.isWysiwygFrame(e)||n===i.parentNode)&&(n=i,e=null),this.format.isLine(t)||this.format.isBlock(t)||!Q.isListCell(n)&&this.component.isBasic(t)){const t=n;if(Q.isList(e))n=e,e=null;else if(Q.isListCell(e))n=e.previousElementSibling||e;else if(!o&&!e){const t=this.remove(),i=3===t.container.nodeType?Q.isListCell(this.format.getLine(t.container,null))?t.container:this.format.getLine(t.container,null)||t.container.parentNode:t.container,s=Q.isWysiwygFrame(i)||this.format.isBlock(i);n=s?i:i.parentNode,e=s?null:i.nextSibling}0===t.childNodes.length&&n!==t&&Q.removeItem(t)}!u||d||this.format.isBlock(n)||Q.isListCell(n)||Q.isWysiwygFrame(n)||(e=n.nextElementSibling,n=n.parentNode),Q.isWysiwygFrame(n)&&(3===t.nodeType||Q.isBreak(t))&&(t=Q.createElement(this.options.get("defaultLine"),null,t))}if(h?c.parentNode?(n=c,e=l):(n=i,e=null):e=n===e?n.lastChild:e,Q.isListCell(t)&&!Q.isList(n)){if(Q.isListCell(n))e=n.nextElementSibling,n=n.parentNode;else{const t=Q.createElement("ol");n.insertBefore(t,e),n=t,e=null}h=!0}if(this._checkDuplicateNode(t,n),n.insertBefore(t,e),h)if(Q.isZeroWith(a.textContent.trim()))Q.removeItem(a),t=t.lastChild;else{const e=Q.getArrayItem(a.children,Q.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(n.appendChild(t),t=n),Q.isZeroWith(a.textContent.trim())&&Q.removeItem(a))}}catch(e){n.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{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),Q.removeItem(i)}if((this.format.isLine(t)||this.component.isBasic(t))&&_===b){const t=this.format.getLine(p,null);1===t?.nodeType&&Q.isEmptyLine(t)&&Q.removeItem(t)}if(d&&(this.format.isLine(t)||this.format.isBlock(t))&&(t=this._setIntoFreeFormat(t)),!this.component.isBasic(t)){let e=1;if(3===t.nodeType){const e=t.previousSibling,i=t.nextSibling,n=!e||1===e.nodeType||Q.isZeroWith(e)?"":e.textContent,o=!i||1===i.nodeType||Q.isZeroWith(i)?"":i.textContent;e&&n.length>0&&(t.textContent=n+t.textContent,Q.removeItem(e)),i&&o.length>0&&(t.textContent+=o,Q.removeItem(i));const l={container:t,startOffset:n.length,endOffset:t.textContent.length-o.length};this.selection.setRange(t,l.startOffset,t,l.endOffset),s=l}else if(!Q.isBreak(t)&&!Q.isListCell(t)&&this.format.isLine(n)){let i=null;t.previousSibling&&!Q.isBreak(t.previousSibling)||(i=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(i,t)),t.nextSibling&&!Q.isBreak(t.nextSibling)||(i=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(i,t.nextSibling)),this.format._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.selection.setRange(t,e,t,e)}}s||(this.history.push(!0),s=t)}return s},remove(){this.selection._resetRangeToTextNode();const t=this.selection.getRange(),e=0===t.startOffset,i=Q.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.parentNode,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 Q.removeItem(t),this.format.isLine(e)?0===e.childNodes.length?(Q.removeItem(e),{container:n,offset:o}):{container:i,offset:s}:{container:n,offset:o}}if(1===u.nodeType&&0===c&&1===d||3===u.nodeType&&0===c&&d===u.textContent.length){const t=Q.getNextDeepestNode(u,this.editor.frameContext.get("wysiwygFrame")),e=Q.getPreviousDeepestNode(u,this.editor.frameContext.get("wysiwygFrame")),i=this.format.getLine(u);Q.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),Q.isZeroWith(i)&&!i.contains(s)&&Q.removeItem(i),{container:s,offset:n}}a=u.children[c],h=u.children[d],c=d=0}if(!a||!h)return{container:u,offset:0};if(a===h&&t.collapsed&&Q.isZeroWith(a.textContent?.substr(c)))return{container:a,offset:c,prevContainer:a&&a.parentNode?a:null};let p=null,g=null;const m=Q.getListChildNodes(u,null);let f=Q.getArrayIndex(m,a),_=Q.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)||Q.isWysiwygFrame(u)||Q.isBreak(u)||Q.isMedia(u))return{container:u,offset:0};if(3===u.nodeType)return{container:u,offset:d};m.push(u),a=h=u}else if(a=h=m[0],Q.isBreak(a)||Q.isZeroWith(a))return{container:Q.isMedia(u)?u:a,offset:0};f=_=0}for(let t=f;t<=_;t++){const e=m[t];if(0===e.length||3===e.nodeType&&void 0===e.data)this._nodeRemoveListItem(e);else if(e!==a)if(e!==h)this._nodeRemoveListItem(e);else{if(1===h.nodeType){if(this.component.is(h))continue;g=Q.createTextNode(h.textContent)}else g=Q.createTextNode(h.substringData(d,h.length-d));g.length>0?h.data=g.data:this._nodeRemoveListItem(h)}else{if(1===a.nodeType){if(this.component.is(a))continue;p=Q.createTextNode(a.textContent)}else e===h?(p=Q.createTextNode(a.substringData(0,c)+h.substringData(d,h.length-d)),r=c):p=Q.createTextNode(a.substringData(0,c));if(p.length>0?a.data=p.data:this._nodeRemoveListItem(a),e===h)break}}const b=Q.getParentElement(h,"ul"),v=Q.getParentElement(a,"li");if(b&&v&&v.contains(b)?(l=b.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,r=e||i?i?l.textContent.length:0:r),this.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!Q.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}},get(t,e,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=Q.createElement("DIV",null,this._convertToCode(l.get("wysiwyg"),!0)),a=Q.getListChildren(r,(t=>t.hasAttribute("contenteditable")));for(let t=0,e=a.length;t<e;t++)a[t].removeAttribute("contenteditable");const h=this.clean(r.innerHTML,!1,null,null);if(this.editor.frameOptions.get("iframe_fullPage"))if(e){const t=Q.getAttributesToString(l.get("_wd").body,["contenteditable"]);s="<!DOCTYPE html><html>"+l.get("_wd").head.outerHTML+"<body "+t+">"+h+"</body></html>"}else s=h;else s=t?'<div class="sun-editor-editable'+(this.options.get("_rtl")?" se-rtl":"")+'">'+h+"</div>":r.innerHTML;n[i[o]]=s}return this.editor.changeFrameContext(s),i.length>1?n:n[i[0]]},set(t,e){this.selection.removeRange();const i=null==t?"":this.clean(t,!0,null,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,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,!0,null,null);if(this.editor.frameContext.get("isCodeView"))this.viewer._setCodeView(this.viewer._getCodeView()+"\n"+this._convertToCode(s,!1));else{const t=Q.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])}}},setFullPage(t,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,!0,null,null)),this.editor._resetComponents()},compress:t=>t.replace(/\n/g,"").replace(/(>)(?:\s+)(<)/g,"$1$2").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";let a=e?0:1*this.status.codeIndentSize;return a=a>0?new Array(a+1).join(" "):"",function t(e,o){const h=e.childNodes,c=n.test(e.nodeName),d=c?o:"";for(let u,p,g,m,f,_,b=0,v=h.length;b<v;b++)u=h[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+a),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:Q.isList(u.parentElement)||(i+=J.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);Q.removeItem(t),Q.isListCell(e)&&(this.nodeTransform.removeAllParents(e,null,null),Q.isList(e?.firstChild)&&e.insertBefore(Q.createTextNode(K.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&&Q.removeItem(t),t=Q.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(Q.isExcludeFormat(t))return t.outerHTML;const s=Q.getListChildNodes(t,(t=>Q.isSpanWithoutAttr(t)&&!Q.getParentElement(t,Q.isExcludeFormat)))||[];for(let t=s.length-1;t>=0;t--)s[t].outerHTML=s[t].innerHTML;return!e||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||Q.isMedia(t)||Q.isFigure(t)||Q.isAnchor(t)&&Q.isMedia(t.firstElementChild)?Q.isSpanWithoutAttr(t)?t.innerHTML:t.outerHTML:"<"+i+">"+(Q.isSpanWithoutAttr(t)?t.innerHTML:t.outerHTML)+"</"+i+">"}if(3===t.nodeType){if(!e)return J.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+">"+J.htmlToEntity(t)+"</"+i+">");return n}return 8===t.nodeType&&this._allowHTMLComment?"\x3c!--"+t.textContent.trim()+"--\x3e":""},_consistencyCheckOfHTML(t,e,i,s,n,o){const l=[],r=[],a=[],h=[],c=Q.getListChildNodes(t,(c=>{if(n&&1!==c.nodeType)return Q.isList(c.parentElement)&&l.push(c),!1;if(s&&(i.test(c.nodeName)||!e.test(c.nodeName)&&0===c.childNodes.length&&Q.isExcludeFormat(c)))return l.push(c),!1;const d=!Q.getParentElement(c,Q.isExcludeFormat);if(n){if(!Q.isTableElements(c)&&!Q.isListCell(c)&&!Q.isAnchor(c)&&(this.format.isLine(c)||this.format.isBlock(c)||this.format.isTextStyleNode(c))&&0===c.childNodes.length&&d)return r.push(c),!1;if(Q.isList(c.parentNode)&&!Q.isList(c)&&!Q.isListCell(c))return a.push(c),!1;if(Q.isTableCell(c)){const t=c.firstElementChild;if(!this.format.isLine(t)&&!this.format.isBlock(t)&&!this.component.is(t))return h.push(c),!1}}if(o&&d&&c.className){const t=new Array(c.classList).map(this._isAllowedClassName).join(" ").trim();t?c.className=t:c.removeAttribute("class")}return!!n&&(c.parentNode!==t&&d&&(Q.isListCell(c)&&!Q.isList(c.parentNode)||(this.format.isLine(c)||this.component.is(c))&&!this.format.isBlock(c.parentNode)&&!Q.getParentElement(c,this.component.is.bind(this.component))))}));for(let t=0,e=l.length;t<e;t++)Q.removeItem(l[t]);const d=[];for(let t,e,i=0,s=c.length;i<s;i++)if(t=c[i],e=t.parentNode,e&&e.parentNode)if(Q.getParentElement(t,Q.isListCell)){const i=t.childNodes;for(let n=i.length-1;s>=0;n--)e.insertBefore(t,i[n]);d.push(t)}else e.parentNode.insertBefore(t,e),d.push(e);for(let t,e=0,i=d.length;e<i;e++)t=d[e],Q.isZeroWith(t.textContent.trim())&&Q.removeItem(t);for(let t=0,e=r.length;t<e;t++)Q.removeItem(r[t]);for(let t,e,i,s,n=0,o=a.length;n<o;n++)if(t=a[n],s=t.parentNode,s)if(e=Q.createElement("LI"),this.format.isLine(t)){for(i=t.childNodes;i[0];)e.appendChild(i[0]);s.insertBefore(e,t),Q.removeItem(t)}else t=t.nextSibling,e.appendChild(a[n]),s.insertBefore(e,t);for(let t,e,i=0,s=h.length;i<s;i++)t=h[i],e=Q.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":this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||/meta/i.test(t.nodeName)||Q.isExcludeFormat(t)?(e&&(i+=e.outerHTML,e=null),i+=t.outerHTML):(e||(e=Q.createElement(this.options.get("defaultLine"))),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?Q.isList(i)?e+=i.innerHTML:Q.isListCell(i)?e+=i.outerHTML:this.format.isLine(i)?e+="<li>"+(i.innerHTML.trim()||"<br>")+"</li>":this.format.isBlock(i)&&!Q.isTableElements(i)?e+=this._convertListCell(i):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)&&!Q.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:"+tt.get(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=Y.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],J.fontSize.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(!Q.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},constructor:ss};const ls=ss,rs=function(t){Ot.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._dropdownCommands=[],this.__globalEventHandler={mousedown:as.bind(this),containerDown:this.containerOff.bind(this),keydown:cs.bind(this),mousemove:ds.bind(this),mouseout:hs.bind(this)},this._bindClose_dropdown_mouse=null,this._bindClose_dropdown_key=null,this._bindClose_cons_mouse=null,this.currentDropdownPlugin=null};function as(t){Q.getParentElement(t.target,".se-dropdown")||this.dropdownOff()}function hs(){this.index=-1}function cs(t){switch(t.keyCode){case 38:t.preventDefault(),t.stopPropagation(),this._moveItem(-1);break;case 40:t.preventDefault(),t.stopPropagation(),this._moveItem(1);break;case 13:case 32:{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 ds(t){Q.addClass(this.currentDropdown,"se-select-menu-mouse-move"),Q.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}rs.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=Q.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=this.currentDropdownName=t.getAttribute("data-command");this.currentDropdownType=t.getAttribute("data-type");const s=this.currentDropdown=this.targetMap[i];this.currentDropdownActiveButton=t,this._setMenuPosition(t,s),this._bindClose_dropdown_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.mousedown,!1),this._dropdownCommands.includes(i)&&(this.menus=J.nodeListToArray(s.querySelectorAll(".se-toolbar-btn[data-command]")),this.menus.length>0&&(this._bindClose_dropdown_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler.keydown,!1),s.addEventListener("mousemove",this.__globalEventHandler.mousemove,!1),s.addEventListener("mouseout",this.__globalEventHandler.mouseout,!1))),this.currentDropdownPlugin=this.plugins[i],"function"==typeof this.currentDropdownPlugin?.on&&this.currentDropdownPlugin.on(t),this.editor._antiBlur=!0},dropdownOff(){this.__removeGlobalEvent(),this.index=-1,this.menus=[],this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&Q.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.editor._notHideToolbar=!1),this.editor._antiBlur=!1,"function"==typeof this.currentDropdownPlugin?.off&&this.currentDropdownPlugin.off(),this.currentDropdownPlugin=null},containerOn(t){this.__removeGlobalEvent();const e=this._containerName=t.getAttribute("data-command");this.currentContainerActiveButton=t,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._antiBlur=!0},containerOff(){this.__removeGlobalEvent(),this.currentContainer&&(this._containerName="",this.currentContainer.style.display="none",this.currentContainer=null,Q.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.editor._notHideToolbar=!1),this.editor._antiBlur=!1},_setMenuPosition(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",Q.addClass(t.parentElement.children,"on"),this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,Q.getParentElement(t,".se-toolbar"),!1),e.style.visibility=""},_checkMoreLayer(t){const e=Q.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null},_moveItem(t){Q.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),Q.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?Q.addClass(this.menus[t],"on"):Q.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),Q.removeClass(this.menus,"on"),Q.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:rs};const us=rs,ps=function(t){Ot.call(this,t)};ps.prototype={split(t,e,i){if(Q.isWysiwygFrame(t)||this.component.is(t)||!t)return t;if(e&&!tt.is(e)){const i=t.childNodes;let s=Q.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),3===t.nodeType){if(r=Q.getPositionIndex(t),e>=0&&t.length!==e){t.splitText(e);const i=Q.getNodeFromPath([r+1],s);Q.isZeroWith(i)&&(i.data=K.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=Q.createTextNode(K.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:Q.getNodeDepth(t)===i&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;Q.getNodeDepth(c)>i;)for(r=Q.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(Q.isListCell(n)&&Q.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,Q.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,Q.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,Q.isListCell(n)&&n.children&&Q.isList(n.children[0])&&n.insertBefore(Q.createElement("BR"),n.children[0]),0===s.childNodes.length&&Q.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(i&&s.format._isIgnoreNodeChange(c)||!i&&(Q.isTableElements(c)||Q.isListCell(c)||s.format.isLine(c)&&!s.format.isBrLine(c)))(Q.isTableElements(c)||Q.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(Q.getArrayIndex(s.childNodes,i)!==t[o]){a=!1;break}i=c.parentNode,s=i.parentNode,o--}a&&(t.splice(r,1),t[r]=u)}}Q.copyTagAttributes(c,l),l.parentNode.insertBefore(c,l),Q.removeItem(l)}if(!d){1===c.nodeType&&t(c,r+1,u);break}if(c.nodeName===d.nodeName&&Q.isSameAttributes(c,d)&&c.href===d.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;Q.removeItem(d),u--}else 1===c.nodeType&&t(c,r+1,u)}}(t,0,0),o},mergeNestedTags(t,e){"string"==typeof e?e=function(t){return this.test(t.tagName)}.bind(new RegExp(`^(${e||".+"})$`,"i")):"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(!Q.isWysiwygFrame(i)){const n=i.parentNode;n&&e(i)&&(s={sc:i.previousElementSibling,ec:i.nextElementSibling},Q.removeItem(i),t(n))}}(t),s},removeEmptyNode(t,e,i){const s=this;e&&(e=Q.getParentElement(e,(e=>t===e.parentElement))),function i(n){if(s.format._notTextNode(n)||n===e||Q.isNonEditable(n))return 0;if(n===t||!Q.isZeroWith(n.textContent)||n.firstChild&&Q.isBreak(n.firstChild)||n.querySelector(Y._allowedEmptyNodeList)){const t=n.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(n.parentNode)return n.parentNode.removeChild(n),-1;return 0}(t),0===t.childNodes.length&&(i?Q.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:ps};const gs=ps,{_w:ms}=Y,fs=function(t,e){Ot.call(this,t.editor),this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=e,this.focusElement=e.querySelector("[data-focus]"),this.isUpdate=!1,this._modalArea=this.carrierWrapper.querySelector(".se-modal"),this._modalBack=this.carrierWrapper.querySelector(".se-modal-back"),this._modalInner=this.carrierWrapper.querySelector(".se-modal-inner"),this._closeListener=[vs.bind(this),bs.bind(this)],this._bindClose=null,this._onClickEvent=null,this._closeSignal=!1,this._modalInner.appendChild(e),this.eventManager.addEvent(e.querySelector("form"),"submit",_s.bind(this)),this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.close.bind(this))};async function _s(t){t.preventDefault(),t.stopPropagation(),this.editor.showLoading();try{const t=await this.inst.modalAction();!1===t?this.editor.hideLoading():void 0===t?this.close():(this.close(),this.editor.hideLoading())}catch(t){throw this.close(),this.editor.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}function bs(t){(/close/.test(t.target.getAttribute("data-command"))||t.target===this._modalInner)&&this.close()}function vs(t){/27/.test(t.keyCode)&&this.close()}fs.prototype={open(){this.editor._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),this._modalArea.style.display="block",this._modalBack.style.display="block",this._modalInner.style.display="block",this.form.style.display="block",this.focusElement&&this.focusElement.focus()},close(){this._fixCurrentController(!1),ms.setTimeout((()=>{this.editor.opendModal=null}),0),this._closeSignal&&this._modalInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this.form.style.display="none",this._modalBack.style.display="none",this._modalArea.style.display="none","function"==typeof this.inst.init&&this.inst.init(),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"},constructor:fs},fs.CreateFileInput=function({icons:t,lang:e},{acceptedFormats:i,allowMultiple:s}){return`\n\t<div class="se-modal-form-files">\n\t\t<div class="se-flex-input-wrapper">\n\t\t\t<div class="se-input-form-abs">\n\t\t\t\t<div>\n\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${i}"${s?' multiple="multiple"':""}/>\n\t\t</div>\n\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.selection_remove}\n\t\t\t${Tt(e.remove)}\n\t\t</button>\n\t</div>`},fs.OnChangeFile=function(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="")};const ys=fs,Cs=function(t){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 Q.createElement("DIV",{class:"se-notice"},i)}(t);this.editor=t,this.modal=new ys(this,e),this.message=e.querySelector("span")};Cs.prototype={open(t){this.message.textContent=t,this.modal.open()},close(){this.modal.close()},constructor:Cs};const ws=Cs,xs=function(t){Ot.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)}xs.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){let e=0,i=0,s=3===t.nodeType?t.parentElement:t;const n=V(t,D.bind(this)),o=s;for(;s&&!$(s,"se-wrapper")&&s!==n;)e+=s.offsetLeft-(o!==s?s.scrollLeft:0),i+=s.offsetTop+(o!==s?s.scrollTop:0),s=s.offsetParent;const l=this.editor.frameContext.get("eventWysiwyg");return{left:e,top:i-(n?n.scrollTop:0),scrollX:l.scrollX||l.scrollLeft||0,scrollY:l.scrollY||l.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||1!==e.nodeType||(o="absolute"===t.getComputedStyle(e).position);const l=e.offsetWidth,r=e.offsetHeight;let a=0,h=0,c=0,d=0;for(;e;)a+=e.offsetTop,h+=e.offsetLeft,c+=e.scrollTop,d+=e.scrollLeft,e=e.offsetParent;if(!o&&!n&&/^iframe$/i.test(s.nodeName)&&s.contains(e))for(e=this.editor.frameContext.get("wrapper");e;)a+=e.offsetTop,h+=e.offsetLeft,e=e.offsetParent;return{top:a+c,left:h+d,width:l,height:r,scrollTop:c,scrollLeft:d}},getGlobalScroll(e){const i=this.editor.frameContext.get("topArea");let s=!1,n=!1;e||(e=i),e===i&&(s=!0),s||1!==e.nodeType||(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._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),v=i.contains(g);p=b?i:p,g=v?i:g;const y=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=v?i.clientWidth:u;const w=G(this.editor.frameContext.get("_wd"));return{top:o,ts:y,left:l,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:v}},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(!Q.hasClass(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=G(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=n.addOffset||{left:0,top:0},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=Q.getParentElement(s,".se-controller"),d=h&&!c,u=G(e),p=d?this.getWWScroll():this._getWindowScroll(),g=c?s.getBoundingClientRect():this.selection.getRects(s,"start").rects,m=this.getGlobal(s),f=$(i.firstElementChild,"se-arrow")?i.firstElementChild:null,_=f?f.offsetHeight:0,b=i.offsetHeight,v=s.offsetHeight,y=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:E,rt:S}=this._getVMargin(y,C,w,u,g,d,p);if(h&&(E+v<=0||x+S+v<=0))return;let T=o.top,k=0,N="";"bottom"===l?(N="up",T+=g.bottom+_+t.scrollY,k=E-(b+_),k<0&&(N="down",T-=v+b+2*_,k=w+x-(b+_),k<0&&(N="",T-=k))):(N="down",T+=g.top-b-_+t.scrollY,k=x-(b+_),k<0&&(N="up",T+=v+b+2*_,k=E-(b+_),k<0&&(N="",T+=k))),this._setArrow(f,N),i.style.top=`${T}px`;const L=(1===i.nodeType?tt.get(t.getComputedStyle(i).borderRadius):0)||0,H=m.width,M=i.offsetWidth,A=f?f.offsetWidth:0,B=g.left,I=u.w-g.right;let V,R;if(this.editor.frameContext.get("isFullScreen")?(V=B,R=I):(V=g.left,R=u.w-g.right),h&&(V+H<=0||R+H<=0))return;f&&(f.style.left="",f.style.right="");let O=o.left,z=0,F=0,P=0;return a?(O+=g.left+t.scrollX-(V<0?V:0),z=H+V,z<A&&(P=A/2-1+(L<=2?0:L-2),F=P),z=H+R-M,z<0&&(O+=z,P=M-1-(A/2+(L<=2?0:L-2)),F=-(z-A/2),F=F>P?P:F),f&&F>0&&(f.style.left=F+"px")):(O+=g.right-M+t.scrollX+(R<0?R:0),z=H+R,z<A&&(P=A/2-1+(L<=2?0:L-2),F=P),z=H+V-M,z<0&&(O-=z,P=A/2-1+(L<=2?0:L-2),F=-(z-A/2),F=F<P?P:F>M-P?M-P:F),f&&F>0&&(f.style.right=F+"px")),i.style.left=`${O}px`,r.__offset={left:i.offsetLeft+p.left,top:i.offsetTop+p.top,addOffset:o},!0},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.isSub&&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),v=G(e),y=b?this.getWWScroll():this._getWindowScroll(),C=c.height,w=c.top,x=v.h-c.bottom,E=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:S,rmb:T,rt:k}=this._getVMargin(w,x,E,v,c,b,y);if(!(T+C<=0||S+k+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?(Q.removeClass(h,"se-arrow-up"),Q.addClass(h,"se-arrow-down")):(Q.removeClass(h,"se-arrow-down"),Q.addClass(h,"se-arrow-up"));const v=Math.floor(d/2+(p-f));h.style.left=(v+c>s.offsetWidth?s.offsetWidth-c:v<c?c:v)+"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=""),F(t,"se-arrow-up"),P(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),F(t,"se-arrow-down"),P(t,"se-arrow-up")):t&&(t.style.visibility="hidden")},_getWindowScroll(){const i=Q.getClientSize(e);return{top:t.scrollY,left:t.scrollX,width:i.w,height: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:xs};const Ss=xs,Ts=function(t){Ot.call(this,t),this.range=null,this.selectionNode=null};Ts.prototype={get(){const t=this._shadowRoot?.getSelection()||this.editor.frameContext.get("_ww").getSelection();return t?(this.status._range||this.editor.frameContext.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t):null},isRange:t=>/Range/.test(Object.prototype.toString.call(t?.__proto__)),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=Q.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){if(this.isRange(t)){const n=t;t=n.startContainer,e=n.startOffset,i=n.endContainer,s=n.endOffset}if(!t||!i)return;(Q.isBreak(t)||3===t.nodeType)&&e>t.textContent.length&&(e=t.textContent.length),(Q.isBreak(i)||3===i.nodeType)&&s>i.textContent.length&&(s=i.textContent.length),this.format.isLine(t)&&(t=t.childNodes[e>0?t.childNodes.length-1:0]||t,e=e>0?1!==t.nodeType||Q.isBreak(t)?t.textContent?t.textContent.length:0:1:0),this.format.isLine(i)&&(i=i.childNodes[s>0?i.childNodes.length-1:0]||i,s=s>0?1!==i.nodeType||Q.isBreak(i)?i.textContent?i.textContent.length:0:1:0);const n=this.editor.frameContext.get("_wd").createRange();try{n.setStart(t,e),n.setEnd(i,s)}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.editor._nativeFocus()}const o=this.get();return o.removeAllRanges&&o.removeAllRanges(),o.addRange(n),this.status._range=n,this._rangeInfo(n,this.get()),this.editor.frameOptions.get("iframe")&&this.__focus(),n},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=Q.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=Q.getEdgeChild(this.editor.frameContext.get("wysiwyg").firstChild,(function(t){return 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=1===t?.nodeType&&"absolute"===this._w.getComputedStyle(t).position;t=t&&3!==t.nodeType?t:this.getRange();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=Q.createTextNode(K.zeroWidthSpace);this.html.insertNode(t,null,!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.right,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}},getEventLocationRange(t){let e,i,s,n;if(t.rangeParent)e=t.rangeParent,i=t.rangeOffset,s=t.rangeParent,n=t.rangeOffset;else if(this.editor.frameContext.get("_wd").caretRangeFromPoint){let o=this.editor.frameContext.get("_wd").caretRangeFromPoint(t.clientX,t.clientY);o||(o=this.getRange()),e=o.startContainer,i=o.startOffset,s=o.endContainer,n=o.endOffset}else{const t=this.getRange();e=t.startContainer,i=t.startOffset,s=t.endContainer,n=t.endOffset}return{sc:e,so:i,ec:s,eo:n}},scrollTo(t){t instanceof Ts?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 e=t.getBoundingClientRect();if(e.top>=0&&e.bottom<=this.editor.frameContext.get("wysiwygFrame").innerHeight)return;const i=Q.getParentElement(t.startContainer,(t=>1===t.nodeType));i?.scrollIntoView?.(this.options.get("scrollToOptions"))},_isNone(t){const e=t.commonAncestorContainer;return Q.isWysiwygFrame(t.startContainer)&&Q.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=Q.createElement("BR"),i.appendChild(s))):(s=Q.createElement("BR"),i=Q.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?Q.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.extentNode||e.anchorNode,this.selectionNode=i},_init(){const t=this.editor.frameContext.get("_wd").activeElement;if(Q.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(){const t=Q.getParentElement(this.getNode(),"figcaption");t?t.focus():this.editor.frameContext.get("wysiwyg").focus()},_resetRangeToTextNode(){let t=this.getRange();if(this._isNone(t)){if(!Q.isWysiwygFrame(t.startContainer)||!Q.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;let i,s,n,o=e.startContainer,l=e.startOffset,r=e.endContainer,a=e.endOffset;if(this.format.isLine(o))for(o.childNodes[l]?(o=o.childNodes[l]||o,l=0):(o=o.lastChild||o,l=o.textContent.length);1===o?.nodeType&&o.firstChild;)o=o.firstChild||o,l=0;if(this.format.isLine(r)){for(r=r.childNodes[a]||r.lastChild||r;1===r?.nodeType&&r.lastChild;)r=r.lastChild;a=r.textContent.length}if(i=Q.isWysiwygFrame(o)?this.editor.frameContext.get("wysiwyg").firstChild:o,s=l,Q.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Q.isBreak(i);if(!t){const t=i;for(;i&&!Q.isBreak(i)&&1===i.nodeType&&(n=i.childNodes,0!==n.length);)i=n[s>0?s-1:s]||!/FIGURE/i.test(n[0].nodeName)?n[0]:i.previousElementSibling||i.previousSibling||o,s=s>0?i.textContent.length:s;let e=this.format.getLine(i,null);e===this.format.getBlock(e,null)&&(i=i||t,e=Q.createElement(Q.getParentElement(i,Q.isTableCell)?"DIV":this.options.get("defaultLine")),i.parentNode.insertBefore(e,i),i!==t&&e.appendChild(i))}if(Q.isBreak(i)||this.component.is(i)){const e=Q.createTextNode(K.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,t&&o===r&&(r=i,a=1)}}if(o=i,l=s,i=Q.isWysiwygFrame(r)?this.editor.frameContext.get("wysiwyg").lastChild:r,s=a,Q.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Q.isBreak(i);if(!t){for(;i&&!Q.isBreak(i)&&1===i.nodeType&&(n=i.childNodes,0!==n.length);)i=n[s>0?s-1:s]||!/FIGURE/i.test(n[0].nodeName)?n[0]:i.previousElementSibling||i.previousSibling||o,s=s>0?i.textContent.length:s;let t=this.format.getLine(i,null);t===this.format.getBlock(t,null)&&(t=Q.createElement(Q.isTableCell(t)?"DIV":this.options.get("defaultLine")),i.parentNode.insertBefore(t,i),t.appendChild(i))}if(Q.isBreak(i)){const e=Q.createTextNode(K.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,s=1,t&&!i.previousSibling&&Q.removeItem(r)}}return r=i,a=s,this.setRange(o,l,r,a),!0},constructor:Ts};const ks=Ts,Ns=function(t){this.editor=t,this.isDisabled=!1};Ns.prototype={command(t,e){if(this.isDisabled)return!1;const i=this.editor.shortcutsKeyMap.get(t+(e?1e3:0));return!(!i||!e&&i.s||(this.editor.run(i.c,i.t,i.e),0))},disable(){this.isDisabled=!0},enable(){this.isDisabled=!1},constructor:Ns};const Ls=Ns,{_w:Hs}=Y,Ms=function(t,{keyName:e,balloon:i,inline:s,balloonAlways:n,res:o}){Ot.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._rButtonsize=null,this._sticky=!1,this._isViewPortSize="visualViewport"in Hs,this._inlineToolbarAttr={top:"",width:"",isShow:!1},this._balloonOffset={top:0,left:0},this._setResponsive()};Ms.prototype={disable(){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff(),Q.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)},enable(){Q.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.editorisBalloon&&(this._balloonOffset={top:0,left:0}))},_visible(t){const e=this.context.get(this.keyName+".main");t?Q.removeClass(e,"se-toolbar-onscroll-hide"):Q.addClass(e,"se-toolbar-onscroll-hide")},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._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._rButtonArray[i]))}},setButtons(t){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff();const{options:e,icons:i,lang:s,isSub:n}=this,o=Nt(t,this.plugins,e,i,s,!0),l=e.get("shortcuts");let r;o.updateButtons.forEach((t=>kt(t.button,t.plugin,this.icons,this.lang,l[t.key]))),r=n?this.editor.subAllCommandButtons=new Map:this.editor.allCommandButtons=new Map,this.editor.commandTargets=new Map,this.editor.__saveCommandButtons(r,o.buttonTray),this.context.get(this.keyName+".main").replaceChild(o.buttonTray,this.context.get(this.keyName+".buttonTray")),this.context.set(this.keyName+".buttonTray",o.buttonTray),this.editor.__setDisabledButtons(),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")&&Q.setDisabled(this.editor._controllerOnDisabledButtons,!0),this.triggerEvent("onSetToolbarButtons",{buttonTray:o.buttonTray,frameContext:this.editor.frameContext})},_resetSticky(){const t=this.context.get(this.keyName+".main");if(this.editor.frameContext.get("isFullScreen")||0===t.offsetWidth||this.options.get("toolbar_sticky")<0)return;const e=this._isViewPortSize?Hs.visualViewport.pageTop:Hs.scrollY,i=this.editor.frameContext.get("_minHeight"),s=this.editor.frameContext.get("wrapper").offsetHeight,n=this.offset.getGlobal(this.editor.frameContext.get("topArea")),o=e+this.options.get("toolbar_sticky"),l=(this._isBalloon||this._isInline?n.top:this.offset.getGlobal(this.options.get("toolbar_container")).top)-(this._isInline?t.offsetHeight:0),r=this.options.get("toolbar_container")?n.top-e+s-i-this.options.get("toolbar_sticky")-t.offsetHeight:s+l+this.options.get("toolbar_sticky")-o-i;o<l?this._offSticky():r<0?(this._sticky||this._onSticky(1),t.style.top=1+r+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",Q.addClass(e,"se-toolbar-sticky"),this._sticky=!0},__getViewportTop(){return this._isViewPortSize?Hs.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="",Q.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._rButtonArray={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((function(t,e){return t-e})).unshift("default")},_showBalloon(t){if(!this._isBalloon||this.editor.opendControllers.length>0)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=Q.getListChildNodes(e.commonAncestorContainer,null);n=Q.getArrayIndex(t,s.focusNode)<Q.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(){this.currentMoreLayerActiveButton&&(this.context.get(this.keyName+".main").querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",Q.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null)},constructor:Ms};const As=Ms,Bs=function(t){Ot.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 Is(t){let e=Y._w.getComputedStyle(t).lineHeight;if(tt.is(e))e=tt.get(e);else{const i=Y._w.getComputedStyle(t).fontSize;e=1.2*tt.get(i)}return e}Bs.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.editor._offCurrentController(),this.editor._offCurrentModal();const i=e.get("codeWrapper"),s=e.get("code"),n=e.get("wysiwygFrame");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=Is(e),s=t.get("code").scrollHeight/i;let n="";for(let t=1;t<=s;t++)n+=`${t}\n`;const{padding:o,margin:l}=Y._w.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.status._range=null,s.focus(),Q.addClass(this.editor.commandTargets.get("codeView"),"active")):(Q.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(),Q.removeClass(this.editor.commandTargets.get("codeView"),"active"),Q.isNonEditable(n)||(this.history.push(!1),this.history.resetButtons(e.get("key"),null))),this.editor._checkPlaceholder(),Q.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.editor._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="2147483646","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.fullScreenSticky=!0,e.get("_stickyDummy").style.display="none",Q.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=>{Q.changeElement(e.firstElementChild,t),Q.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),this.toolbarParent&&(this.toolbarParent.appendChild(s),this.toolbarParent=null),this.options.get("toolbar_sticky")>-1&&Q.removeClass(s,"se-toolbar-sticky"),this.fullScreenSticky&&!this.options.get("toolbar_container")&&(this.fullScreenSticky=!1,e.get("_stickyDummy").style.display="block",Q.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=>{Q.changeElement(e.firstElementChild,t),Q.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?(Q.addClass(e.get("wysiwyg"),"se-show-block"),Q.addClass(this.editor.commandTargets.get("showBlocks"),"active")):(Q.removeClass(e.get("wysiwyg"),"se-show-block"),Q.removeClass(this.editor.commandTargets.get("showBlocks"),"active")),this.editor._resourcesStateChange(e)},_setButtonsActive(){const t=this.editor.frameContext;if(t.get("isCodeView")?Q.addClass(this.editor.commandTargets.get("codeView"),"active"):Q.removeClass(this.editor.commandTargets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{Q.changeElement(e.firstElementChild,t),Q.addClass(e,"active")}))}else{const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{Q.changeElement(e.firstElementChild,t),Q.removeClass(e,"active")}))}t.get("isShowBlocks")?Q.addClass(this.editor.commandTargets.get("showBlocks"),"active"):Q.removeClass(this.editor.commandTargets.get("showBlocks"),"active")},print(){const t=Q.createElement("IFRAME",{style:"display: none;"});this._d.body.appendChild(t);const e=this.options.get("printTemplate")?this.options.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get(!0)):this.html.get(!0),i=Q.getIframeDocument(t),s=this.editor.frameContext.get("_wd");if(this.editor.frameOptions.get("iframe")){const t=this.options.get("printClass")?'class="'+this.options.get("printClass")+'"':this.editor.frameOptions.get("iframe_fullPage")?Q.getAttributesToString(s.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+'"';i.write("<!DOCTYPE html><html><head>"+s.head.innerHTML+"</head><body "+t+">"+e+"</body></html>")}else{const t=this._d.head.getElementsByTagName("link"),s=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,e=s.length;t<e;t++)n+=s[t].outerHTML;i.write(`<!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</head>\n\t\t\t\t\t<body class="${this.options.get("printClass")?this.options.get("printClass"):this.options.get("_editableClass")}">\n\t\t\t\t\t\t${e} \n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.editor.showLoading(),this._w.setTimeout((()=>{try{if(t.focus(),Y.isEdge||Y.isChromium||this._d.documentMode||this._w.StyleMedia)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.editor.hideLoading(),Q.removeItem(t)}}),1e3)},preview(){this.menu.dropdownOff(),this.menu.containerOff(),this.editor._offCurrentController(),this.editor._offCurrentModal();const t=this.options.get("previewTemplate")?this.options.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get(!0)):this.html.get(!0),e=this._w.open("","_blank");e.mimeType="text/html";const i=this.editor.frameContext.get("_wd");if(this.editor.frameOptions.get("iframe")){const s=this.options.get("printClass")?'class="'+this.options.get("printClass")+'"':this.editor.frameOptions.get("iframe_fullPage")?Q.getAttributesToString(i.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+'"';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; margin: 10px auto !important; height:auto !important; outline:1px dashed #ccc;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${s}>\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"),s=this._d.head.getElementsByTagName("style");let n="";for(let t=0,e=i.length;t<e;t++)n+=i[t].outerHTML;for(let t=0,e=s.length;t<e;t++)n+=s[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${n}\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")}" style="margin:10px auto !important; height:auto !important; outline:1px dashed #ccc;">\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+=J._setIframeStyleLinks(this.editor.frameOptions.get("iframe_cssFileName"))+J._setAutoHeightStyle(this.editor.frameOptions.get("height"))),e.head.innerHTML=s,e.body.innerHTML=this.html.clean(i.body.innerHTML,!0,null,null);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(!Q.hasClass(e.body,"sun-editor-editable")){const t=this.options.get("_editableClass").split(" ");for(let i=0;i<t.length;i++)Q.addClass(e.body,this.options.get("_editableClass")[i])}}else this.editor.frameContext.get("wysiwyg").innerHTML=t.length>0?this.html.clean(t,!0,null,null):"<"+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=Q.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=Is(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:Bs};const Vs=Bs,Rs=".se-menu-list .se-toolbar-btn[data-command]",Os=`${Rs}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,zs=`${Rs}:not([class~="se-component-enabled"]):not([data-type="MORE"])`,$s=function(t,e){const i=t[0].target.ownerDocument||Y._d,s=i.defaultView||Y._w,n=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=bt(e,t,i),n=s.o,o=s.i,l=s.l,r=Q.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=Q.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+(n.get("_rtl")?" se-rtl":"")}),h=Q.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=Q.createElement("INPUT",{class:"__se__focus__temp__",style:"position: absolute !important; top: -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=Q.createElement("DIV",{class:"se-modal sun-editor-common"}),u=Q.createElement("DIV",{class:"se-modal-back",style:"display: none;"}),p=Q.createElement("DIV",{class:"se-modal-inner",style:"display: none;"});d.appendChild(u),d.appendChild(p),a.appendChild(d),a.appendChild(Q.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const g=Q.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(g),at.body.appendChild(a);let m=null,f=null;const _=Nt(s.buttons,i,n,o,l,!1),b=_.element;b.style.visibility="hidden",/inline/i.test(n.get("mode"))?(b.className+=" se-toolbar-inline",b.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(b.className+=" se-toolbar-balloon",b.style.width=n.get("toolbar_width"),b.appendChild(Q.createElement("DIV",{class:"se-arrow"}))),s.subButtons&&(f=Nt(s.subButtons,i,n,o,l,!1),m=f.element,m.style.visibility="hidden",m.className+=" se-toolbar-balloon se-toolbar-sub",m.style.width=n.get("toolbar.sub_width"),m.appendChild(Q.createElement("DIV",{class:"se-arrow"})));const v=t[0].key||null,y=[],C=new Map,w=s.statusbarContainer;let x=null;for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.options,a=Q.createElement("DIV",{class:"sun-editor"+(s.get("_rtl")?" se-rtl":"")}),h=Q.createElement("DIV",{class:"se-container"}),c=Q.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")});h.appendChild(Q.createElement("DIV",{class:"se-toolbar-shadow"}));const d=Ct(i.key,n,a,s),u=d.bottomBar.statusbar,p=d.wysiwygFrame,g=d.placeholder;let m=d.codeView;const f=Q.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),_=Q.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);c.appendChild(f),c.appendChild(_),g&&c.appendChild(g),h.appendChild(Q.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),h.appendChild(c),u&&(w?x||(w.appendChild(Q.createElement("DIV",{class:"sun-editor"},u)),x=u):h.appendChild(u)),h.appendChild(r.cloneNode(!0));const b=i.key||null,v=Q.createElement("DIV",{class:"se-code-wrapper"},m);v.style.setProperty("display","none","important"),c.appendChild(v);const E=wt(n,s,m);if(m===E){const t=Q.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);v.insertBefore(t,m)}else m=E;const S={};n.get("type-options").includes("header")&&(S.inner=Q.createElement("DIV",{class:"se-document-lines",style:`height: ${s.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("type-options").includes("page")&&(S.page=Q.createElement("DIV",{class:"se-document-page"},null)),a.appendChild(h),y.push(b),C.set(b,ot(i,a,p,v,m,x||u,S,b))}const E=n.get("toolbar_container");if(E){const t=Q.createElement("DIV",{class:"sun-editor"+(n.get("_rtl")?" se-rtl":"")}),e=Q.createElement("DIV",{class:"se-container"});e.appendChild(b),m&&e.appendChild(m),t.appendChild(e),E.appendChild(t),E.appendChild(Q.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=C.get(v).get("container");t.insertBefore(b,t.firstElementChild),m&&t.insertBefore(m,t.firstElementChild)}return{context:rt(b,E,h,m,w),carrierWrapper:a,options:n,plugins:i,icons:o,lang:l,value:s.v,rootId:v,rootKeys:y,frameRoots:C,pluginCallButtons:_.pluginCallButtons,responsiveButtons:_.responsiveButtons,pluginCallButtons_sub:f?f.pluginCallButtons:[],responsiveButtons_sub:f?f.responsiveButtons:[]}}(t,e);this.rootKeys=n.rootKeys,this.frameRoots=n.frameRoots,this.context=n.context,this.frameContext=new Map,this.frameOptions=new Map,this._lineBreaker_t=null,this._lineBreaker_b=null,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=null,this.isInline=null,this.isBalloon=null,this.isBalloonAlways=null,this.isSubBalloon=null,this.isSubBalloonAlways=null,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._shadowRoot=null,this._onPluginEvents=null,this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,this.opendModal=null,this.opendControllers=[],this.currentControllerName="",this._controllerTargetContext=null,this.selectMenuOn=!1,this._backWrapper=n.carrierWrapper.querySelector(".se-back-wrapper"),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._antiBlur=!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 Fs(t){return/^statusbar/i.test(t)?"statusbar":t}function Ps(t,e,i){for(let s,n=0,o=t.length;n<o;n++)s=t[n],(mt.includes(s)||e&&e[s])&&(console.warn(`[SUNEDITOR.warn.resetOptions] "[${i+s}]" options not available in resetOptions have no effect.`),t.splice(n--,1),o--)}$s.prototype={registerPlugin(t,e,i,s){let n=this.plugins[t];if(!n)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]&&(n=this.plugins[t]=new this.plugins[t](this,i||{}),"function"==typeof n.init&&n.init()),e){for(let t=0,i=e.length;t<i;t++)kt(e[t],n,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=Q.getParentElement(i,".se-toolbar"),s=Q.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()),Q.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")&&Q.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):/fileBrowser/.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._offCurrentController(),t.menu.containerOff();const e=Q.getParentElement(t.selection.getNode(),"FIGCAPTION")||t.frameContext.get("wysiwyg");let i=Q.getEdgeChild(e.firstChild,(t=>0===t.childNodes.length||3===t.nodeType||Q.isTable(t)),!1)||e.firstChild,s=Q.getEdgeChild(e.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||Q.isTable(t)),!0)||e.lastChild;if(i&&s){if(Q.isMedia(i)||t.component.is(i.parentElement)||Q.isTableElements(i)){const e=t.component.get(i),s=Q.createElement("BR"),n=Q.createElement(t.options.get("defaultLine"),null,s);i=e?e.container||e.cover:i,i.parentNode.insertBefore(n,i),i=s}(Q.isMedia(s)||t.component.is(s.parentElement)||Q.isTableElements(s))&&(s=Q.createElement("BR"),e.appendChild(Q.createElement(t.options.get("defaultLine"),null,s))),t.toolbar._showBalloon(t.selection.setRange(i,0,s,s.textContent.length))}}(this);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===Lt){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.setAttribute("disabled",!0)}))}(this);break;case"copyFormat":Rt(this,e);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:Q.createElement(i);/^sub$/i.test(i)&&s.includes("superscript")?i="sup":/^sup$/i.test(i)&&s.includes("subscript")&&(i="sub"),t.format.applyInlineElement(n,Ht[e]||null,[i],!1),t.focus()}(this,t)}},runFromTarget(t){if(Q.isInputElement(t)||!(t=Q.getCommandTarget(t)))return;const e=t.getAttribute("data-command"),i=t.getAttribute("data-type");(e||i)&&(t.disabled||this.run(e,i,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 Q.isZeroWith(e.textContent)&&!e.querySelector(Y._allowedEmptyNodeList)&&(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._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=>{Q.addClass([t.get("topArea"),t.get("wysiwyg")],"se-rtl")})),Q.addClass([this.carrierWrapper,n,o],"se-rtl")):(this.applyFrameRoots((t=>{Q.removeClass([t.get("topArea"),t.get("wysiwyg")],"se-rtl")})),Q.removeClass([this.carrierWrapper,n,o],"se-rtl"));const l=Q.getListChildren(i.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=>{Q.changeTxt(s.querySelector(".se-tooltip-text"),t.lang[e?"dir_ltr":"dir_rtl"]),Q.changeElement(s.firstElementChild,i[e?"dir_ltr":"dir_rtl"])})),e?(Q.addClass(s.get("dir_rtl"),"active"),Q.removeClass(s.get("dir_ltr"),"active")):(Q.addClass(s.get("dir_ltr"),"active"),Q.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){const e=Object.keys;this.viewer.codeView(!1),this.viewer.showBlocks(!1);const i=e(t);if(Ps(i,this.plugins,""),0===i.length)return;const s={},n=this.rootKeys,o=this.frameRoots,l=[],r={};this._originOptions=[t,this._originOptions].reduce((function(t,i){for(const a in i)if(n.includes(a)&&i[a]){const t=i[a],n=e(t);if(Ps(n,null,a+"."),0===n.length)continue;s[a]=new Map;const h=o.get(a).get("options").get("_origin");for(const e in t){const i=t[e];n.includes(e)&&h[e]!==i&&(s[a].set(Fs(e),!0),h[e]=i)}l.push(r[a]={options:h})}else t[a]=i[a];return t}),{});const a=this.options,h=bt(this._originOptions,l,this.plugins).o;for(let t,e=0;t=i[e];e++)if(r[t]){const e=s[t],i=o.get(t),n=i.get("options"),l=r[t].options;if(e.has("statusbar"))if(Q.removeItem(i.get("statusbar")),l.get("statusbar")){const t=vt(l,null).statusbar;i.get("container").appendChild(t),lt(t,i),this.eventManager.__addStatusbarEvent(i,l)}else this.eventManager.removeEvent(n.get("__statusbarEvent")),l.set("__statusbarEvent",null),lt(null,i);if(e.has("iframe_attributes")){const t=i.get("wysiwygFrame"),e=n.get("iframe_attributes"),s=l.get("iframe_attributes");for(const i in e)t.removeAttribute(i,e[i]);for(const e in s)t.setAttribute(e,s[e])}if(e.has("iframe_cssFileName")){const t=i.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const s=(new DOMParser).parseFromString(J._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,n=t.querySelector("style");for(;s[0];)t.insertBefore(s[0],n)}i.set("options",l),this.setEditorStyle(l.get("_defaultStyles"),i);const a=i.get("wysiwyg"),h=n.get("editableFrameAttributes"),c=l.get("editableFrameAttributes");for(const t in h)a.removeAttribute(t,h[t]);for(const t in c)a.setAttribute(t,c[t])}else a.set(t,h.get(t)),"historyStackDelayTime"!==t?"textDirection"!==t||this.setDir(a.get("_rtl")?"ltr":"rtl"):this.history.resetDelayTime(a.get("historyStackDelayTime"));const c=this.context.get("toolbar.main");/inline|balloon/i.test(a.get("mode"))&&i.includes("toolbar_width")&&(c.style.width=a.get("toolbar_width")),a.get("toolbar_hide")&&(c.style.display="none"),a.get("shortcutsHint")?Q.removeClass(c,"se-shortcut-hide"):Q.addClass(c,"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._antiBlur=!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&&Q.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.format.isLine(e)&&!this.component.is(e)){const t=Q.createElement("BR"),i=Q.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._antiBlur=!1,t||(t=this.frameContext.get("wysiwyg").lastElementChild);const e=this.component.get(t);e?this.component.select(e.target,e.pluginName,!1):t?(3!==t.nodeType&&(t=Q.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()},setEditorStyle(t,e){const i=(e=e||this.frameContext).get("options"),s=J._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},readOnly(t,e){const i=e?this.frameRoots.get(e):this.frameContext;i.set("isReadOnly",!!t),Q.setDisabled(this._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(),this.modalForm&&this.plugins.modal.close.call(this),i.get("code").setAttribute("readOnly","true"),Q.addClass(i.get("wysiwygFrame"),"se-read-only")):(i.get("code").removeAttribute("readOnly"),Q.removeClass(i.get("wysiwygFrame"),"se-read-only")),this.options.get("hasCodeMirror")&&this.viewer._codeMirrorEditor("readonly",!!t,e)},disable(t){const e=t?this.frameRoots.get(t):this.frameContext;this.toolbar.disable(),this._offCurrentController(),this._offCurrentModal(),this.modalForm&&this.plugins.modal.close.call(this),e.get("wysiwyg").setAttribute("contenteditable",!1),e.set("isDisabled",!0),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").setAttribute("disabled",!0)},enable(t){const e=t?this.frameRoots.get(t):this.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").removeAttribute("disabled")},show(t){const e=(t?this.frameRoots.get(t):this.frameContext).get("topArea").style;"none"===e.display&&(e.display="block")},hide(t){(t?this.frameRoots.get(t):this.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"},enableBackWrapper(t){this._backWrapper.style.cursor=t,this._backWrapper.style.display="block"},disableBackWrapper(){this._backWrapper.style.display="none",this._backWrapper.style.cursor="default"},destroy(){this.history.destroy(),this.eventManager._removeAllEvents(),this.options.get("codeMirror6Editor")&&this.options.get("codeMirror6Editor").destroy(),Q.removeItem(this.carrierWrapper),Q.removeItem(this.context.get("toolbar._wrapper")),Q.removeItem(this.context.get("toolbar.sub._wrapper")),Q.removeItem(this.context.get("statusbar._wrapper")),this.applyFrameRoots((t=>{Q.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","notice","offset","selection","shortcuts","toolbar","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")},_visibleControllers(t,e){const i=t?"":"hidden",s=e??i?"":"hidden",n=this.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=i);this._lineBreaker_t.style.visibility=s,this._lineBreaker_b.style.visibility=s},_offCurrentController(){this.component.__deselect()},__offControllers(){const t=this.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.opendControllers=e,this.currentControllerName="",this._antiBlur=!1},_offCurrentModal(){this.opendModal&&this.opendModal.close()},_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)||"",!0,null,null)||"<"+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 Pe(this,t)),t.get("documentType").useHeader&&t.set("documentType-use-header",!0),t.get("documentType").usePage&&t.set("documentType-use-page",!0))},_resourcesStateChange(t){this._iframeAutoHeight(t),this._checkPlaceholder(t)},_iframeAutoHeight(t){const e=t.get("_iframeAuto");e?this._w.setTimeout((()=>{const i=e.offsetHeight;t.get("wysiwygFrame").style.height=i+"px",Y.isResizeObserverSupported||this.__callResizeFunction(t,i,null)}),0):Y.isResizeObserverSupported||this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null),t.has("documentType-use-page")&&t.get("documentType").rePage()},__callResizeFunction(t,e,i){e=-1===e?i?.borderBoxSize&&i.borderBoxSize[0]?i.borderBoxSize[0].blockSize:i.contentRect.height+tt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+tt.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=It,this._onPluginEvents=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPastAndDrop",[]]]),this._fileManager.tags=[],this._fileManager.pluginMap={},this._fileManager.tagAttrs={};const e=this.plugins,i=Array.isArray,s=this.options.get("shortcuts"),n=[];let o;for(const l in e){if(this.registerPlugin(l,this._pluginCallButtons[l],t[l],s[l]),this.registerPlugin(l,this._pluginCallButtons_sub[l],t[l],s[l]),o=this.plugins[l],"object"==typeof o.__fileManagement){const t=o.__fileManagement;if(this._fileInfoPluginsCheck.push(t._checkInfo.bind(t)),this._fileInfoPluginsReset.push(t._resetInfo.bind(t)),i(t.tagNames)){const e=t.tagNames;this._fileManager.tags=this._fileManager.tags.concat(e),n.push(l);for(let i,s=0,n=e.length;s<n;s++)i=e[s].toLowerCase(),this._fileManager.pluginMap[i]=l,t.tagAttrs&&(this._fileManager.tagAttrs[i]=t.tagAttrs)}}"function"==typeof o.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(o,o.constructor));const e=o.constructor.options||{};if(this._onPluginEvents.forEach(((t,i)=>{if("function"==typeof o[i]){const s=o[i].bind(o);s.index=e[`eventIndex_${i}`]||e.eventIndex||0,t.push(s)}})),o.retainFormat){const t=o.retainFormat();this._MELInfo.set(t.query,t.method)}}this._fileManager.regExp=new RegExp(`^(${this._fileManager.tags.join("|")||"\\^"})$`,"i"),this._fileManager.pluginRegExp=new RegExp(`^(${0===n.length?"\\^":n.join("|")})$`,"i"),delete this._pluginCallButtons,delete this._pluginCallButtons_sub,this.__cachingButtons()},__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=J.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(Os)),this._controllerOnDisabledButtons=J.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(zs)),this.options.has("_subMode")&&(this._codeViewDisabledButtons=this._codeViewDisabledButtons.concat(J.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(Os))),this._controllerOnDisabledButtons=this._controllerOnDisabledButtons.concat(J.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(zs))))},__saveCommandButtons(t,e){const i=e.querySelectorAll(Rs),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),ft(r,e,s[r],o,n,l)},__setCommandTargets(t,e){t&&e&&(Vt.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">'+J._setIframeStyleLinks(i.get("iframe_cssFileName"))+J._setAutoHeightStyle(i.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable",!0)},__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={onload:null,onScroll:null,onMouseDown:null,onClick:null,onInput:null,onMouseLeave:null,onKeyDown:null,onKeyUp:null,onCopy:null,onCut:null,onFocus:null,onBlur: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,onImageDeleteBefore:null,onImageLoad:null,onImageAction:null,onImageUploadError:null,videoUploadHandler:null,onVideoUploadBefore:null,onVideoUploadError:null,onVideoLoad:null,onVideoAction:null,onVideoDeleteBefore:null,audioUploadHandler:null,onAudioUploadBefore:null,onAudioUploadError:null,onAudioAction:null,onAudioDeleteBefore:null,onAudioLoad:null,onFileAction:null,onFileDeleteBefore:null,onFileLoad:null,onFileUploadBefore:null,onFileUploadError:null,onExportPdfBefore:null,onFileManagerAction:null,...this.options.get("events")},this.triggerEvent=async(t,e)=>{const i=this.events[t];return"function"==typeof i?await i({editor:this,...e}):Y.NO_EVENT},this.history=function(e){const i=e.frameRoots;let s,n,o,l,r=e.options.get("historyStackDelayTime"),a=null;function h(t,i){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 c(t){const l=n[s],r=o[l],a=e.frameContext;s+=t;const c=t<0&&l!==n[s]&&r.index>0?l:n[s],d=o[c];d.index+=t;const u=d.value[d.index];i.get(c).get("wysiwyg").innerHTML=u.content,l!==c&&t<0&&1===s?s=0:l!==c&&t>0&&1===d.index?s++:(t<0&&d.index<1||t>0&&d.index>d.value.length)&&(s+=t);let p=c,g=u;if(t<0&&s>0&&0===d.index){const e=n[s+t];if(e!==c){const t=o[e];p=e,g=t.value[t.index]}}e.changeFrameContext(p),e.selection.setRange(A(g.s.path,g.frame),g.s.offset,A(g.e.path,g.frame),g.e.offset),e.focus(),s<0?s=0:s>=n.length&&(s=n.length-1),e._offCurrentController(),e._checkComponents(),e.char.display(),e._resourcesStateChange(a),a.has("documentType-use-header")&&a.get("documentType").reHeader(),h(a,d.index)}function d(t,e,l,r){let a,h;e?(a={path:M(e.startContainer,null,null),offset:e.startOffset},h={path:M(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 u(t){o[t]={value:[],index:-1},l[t]=i.get(t).get("wysiwyg").innerHTML}function p(t,r){e._checkComponents();const a=i.get(t),c=a.get("wysiwyg").innerHTML,p=o[t];!c||p.value[p.index]&&c===p.value[p.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.setAttribute("disabled",!0)}));for(let t=0,e=i.length;t<e;t++)n.includes(i[t])||u(i[t])}(p),0===p.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),d(c,r,t,1),1===s&&e.applyCommandTargets("undo",(t=>{t.removeAttribute("disabled")})),e.char.display(),h(a,p.index))}return{push(s,n){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,p(n,o)}),l):p(n,o)},check(e,i){a&&(t.clearTimeout(a),a=null,p(e,i))},undo(){s>0&&c(-1)},redo(){n.length-1>s&&c(1)},overwrite(t){d(i.get(t||e.status.rootKey).get("wysiwyg").innerHTML,null,e.status.rootKey,0)},reset(){e.applyCommandTargets("undo",(t=>{t.setAttribute("disabled",!0)})),e.applyCommandTargets("redo",(t=>{t.setAttribute("disabled",!0)})),e.applyCommandTargets("save",(t=>{t.setAttribute("disabled",!0)})),e.applyFrameRoots((t=>t.set("historyIndex",-1))),e.applyFrameRoots((t=>t.set("isChanged",!1))),s=-1,n=[],o={},l={};const t=e.rootKeys;for(let e=0,i=t.length;e<i;e++)u(t[e])},resetButtons(t,i){const l=!tt.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=>{i>0&&i<=h?t.removeAttribute("disabled"):t.setAttribute("disabled",!0)})),e.applyCommandTargets("redo",(t=>{i>-1&&i<h?t.removeAttribute("disabled"):t.setAttribute("disabled",!0)}));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=>{u?t.removeAttribute("disabled"):t.setAttribute("disabled",!0)})),e.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>o,resetDelayTime(t){r=t},destroy(){a&&t.clearTimeout(a),s=n=o=l=null}}}(this),this.eventManager=new Oe(this),this.offset=new Ss(this),this.shortcuts=new Ls(this),this.notice=new ws(this),this.toolbar=new As(this,{keyName:"toolbar",balloon:this.isBalloon,balloonAlways:this.isBalloonAlways,inline:this.isInline,res:this._responsiveButtons}),this.options.has("_subMode")&&(this.subToolbar=new As(this,{keyName:"toolbar.sub",balloon:this.isSubBalloon,balloonAlways:this.isSubBalloonAlways,inline:!1,res:this._responsiveButtons_sub})),this.selection=new ks(this),this.html=new ls(this),this.nodeTransform=new gs(this),this.component=new Ki(this),this.format=new is(this),this.menu=new us(this),this.char=new Ze(this),this.viewer=new Vs(this),De.call(this.eventManager,this),De.call(this.char,this),De.call(this.component,this),De.call(this.format,this),De.call(this.html,this),De.call(this.menu,this),De.call(this.nodeTransform,this),De.call(this.offset,this),De.call(this.selection,this),De.call(this.toolbar,this),De.call(this.viewer,this),this.options.has("_subMode")&&De.call(this.subToolbar,this),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.toolbar.toolbar,delete this.viewer.viewer,this.subToolbar&&delete this.subToolbar.subToolbar,this._responsiveButtons=this._responsiveButtons_res=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")))})),e.length>0&&await Promise.all(e),this.__editorInit(t)},Constructor:$s};const Ds=$s,Ws=function(t){qe.call(this,t),this.title=this.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=Q.createElement("BLOCKQUOTE")};Ws.key="blockquote",Ws.type="command",Ws.className="",Ws.prototype={active:(t,e)=>/blockquote/i.test(t?.nodeName)?(Q.addClass(e,"active"),!0):(Q.removeClass(e,"active"),!1),action(){const t=Q.getParentElement(this.selection.getNode(),"blockquote");t?this.format.removeBlock(t,null,null,!1,!1):this.format.applyBlock(this.quoteTag.cloneNode(!1))},constructor:Ws};const Us=Ws,Zs=function(t,e){this.editor=t.editor,this.kind=t.constructor.key||t.constructor.name,this._xhr=Y.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};async function qs(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.editor.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.editor.notice.open(n)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.editor.hideLoading()}}}Zs.prototype={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=qs.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.editor.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t,o)}finally{this.editor.hideLoading()}},o.onerror=()=>{l(new Error("Network error"))},o.send(s)}))},cancel(){this._xhr&&this._xhr.abort()},_normalizeUrl:t=>t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1"),constructor:Zs};const Gs=Zs,{_d:js}=Y,Xs=function(t,e){qe.call(this,t),this.title=this.lang.exportPdf,this.icon="pdf",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.jsPDFOptions=e.jsPDFOptions||{},this.html2canvasOptions=e.html2canvasOptions||{},this.apiUrl||this.options.get("externalLibs").html2canvas||this.options.get("externalLibs").jsPDF?this.apiUrl&&(this.apiManager=new Gs(this,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"})):console.warn('[SUNEDITOR.plugins.exportPdf.error] Requires "apiUrl" or externalLibs.html2canvas and externalLibs.jsPDF options.')};Xs.key="exportPdf",Xs.type="command",Xs.className="se-component-enabled",Xs.prototype={async action(){this.editor.showLoading();let t=null;try{const e=this.editor.frameContext.get("topArea"),i=Q.createElement("div",{class:this.editor.frameContext.get("wysiwygFrame").className},this.html.get());if(t=Q.createElement("div",{style:`position: absolute; left: -10000px; width: ${e.clientWidth}px; height: auto;`},i),this.apiUrl){const e=Q.applyInlineStylesAll(i,!0,this.options.get("allUsedStyles"));t.innerHTML=e.outerHTML}if(js.body.appendChild(t),!1===await this.triggerEvent("onExportPdfBefore",{editableDiv:i}))return;if(this.apiUrl)return void await this._createByServer(t);const s=async()=>{const e=t.querySelectorAll("img, audio, video"),i=Array.from(e).map((t=>{switch(t.tagName.toLowerCase()){case"img":return new Promise((e=>{t.complete&&0!==t.naturalHeight?e():(t.onload=e,t.onerror=()=>e())}));case"audio":case"video":return new Promise((e=>{t.readyState>=4?e():(t.onloadeddata=e,t.onerror=()=>e())}));default:return Promise.resolve()}}));await Promise.all(i),await this._createByHtml2canvas(t)};new MutationObserver(s).observe(t,{childList:!0,subtree:!0,attributes:!0}),await s()}catch(t){console.error(`[SUNEDITOR.plugins.exportPdf.error] ${t.message}`)}finally{this.editor.hideLoading()}},async _createByHtml2canvas(t){const e=await this.options.get("externalLibs").html2canvas(t,{useCORS:!0,logging:!0,...this.html2canvasOptions}),i=e.toDataURL("image/png"),s=new(this.options.get("externalLibs").jsPDF)({orientation:"portrait",unit:"px",format:[e.width,e.height],...this.jsPDFOptions});s.addImage(i,"PNG",0,0,e.width,e.height),s.save(`${this.fileName}.pdf`)},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=Q.createElement("A",{href:o,download:l,style:"display: none;"},null);try{js.body.appendChild(r),r.click()}finally{setTimeout((()=>{Q.removeItem(r),URL.revokeObjectURL(o)}),100)}},constructor:Xs};const Ys=Xs,Ks=function(t,e){Ot.call(this,t.editor),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 Gs(this,null)};function Js(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}Ks.prototype={upload(t,e,i,s,n){this.editor.showLoading();let o=null;if(i.length){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.editor.showLoading();let s=null;if(i.length){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=Js(t,"index"),s=null,n="";if(e||(e={name:Js(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Js(t,"file-size")||0}),!i||this._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:1*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=Js(t,"file-name"),s.size=1*Js(t,"file-size")}s.element=t,s.delete=function(t){"function"==typeof this.inst.destroy&&this.inst.destroy.call(this.inst,t),this._deleteInfo(1*Js(t,"index"))}.bind(this,t),s.select=function(t){t.scrollIntoView(this.options.get("componentScrollToOptions"));const e=this.component.get(t);e?this.component.select(e.target,e.pluginName,!1):"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};"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._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()===Js(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();Js(t,"index")&&n.includes(1*Js(t,"index"))?s.push(1*Js(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};"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};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}))},constructor:Ks};const Qs=Ks,{NO_EVENT:tn}=Y,en=function(t,e){qe.call(this,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=/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,this.uploadSingleSizeLimit=/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,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=Q.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&&Q.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)}}};let s=e.controls||[["custom-as","edit","align","remove","custom-download"]];if(s=s.map((t=>t.map((t=>t.startsWith("custom-")?i[t]:t)))),this.figure=new Ii(this,s,{}),this.fileManager=new Qs(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 Q.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.controller=new si(this,t,{position:"bottom",disabled:!0},en.key),this.editInput=t.querySelector("input")}this.eventManager.addEvent(this.input,"change",sn.bind(this))};async function sn(t){await this.submitFile(t.target.files)}en.key="fileUpload",en.type="command",en.className="",en.options={eventIndex:1e4},en.component=function(t){return Q.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null},en.prototype={action(){this.input.click()},select(t){this._element=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(!Q.isFigure(t.parentElement))return e.innerHTML=this.icons.expansion+Tt(this.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0;e.innerHTML=this.icons.reduction+Tt(this.lang.asLink),e.setAttribute("data-value","link"),this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})},onPastAndDrop({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:!Q.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,en.key,!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.notice.open(e===tn?t:e||t),!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.notice.open(i===tn?t:i||t),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:i},r=async function(t,e){t=e||t;const i=await this.fileManager.asyncUpload(t.url,t.uploadHeaders,t.files);this._uploadCallBack(i)}.bind(this,l),a=await this.triggerEvent("onFileUploadBefore",{...l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==tn||r(null)))},async destroy(t){if(!t)return;const e=Ii.GetContainer(t);if(t=Q.getParentElement(t,".se-component")||t,!1===await this.triggerEvent("onFileDeleteBefore",{target:e.target,container:e,url:e.target.getAttribute("href")}))return;const i=this.component.isInline(t)?t.previousSibling||t.nextSibling:t.previousElementSibling||t.nextElementSibling;Q.removeItem(t),this.editor._offCurrentController(),this.editor.focusEdge(i),this.history.push(!1)},convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=Ii.GetContainer(t),i=e.nextElementSibling,s=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable",!1),Q.addClass(t,"se-component|se-inline-component");const n=Q.createElement(this.options.get("defaultLine"),null,t);s.insertBefore(n,i),Q.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&&Q.isZeroWith(i.previousElementSibling)&&Q.removeItem(i.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),Q.removeClass(t,"se-component|se-component-selected|se-inline-component");const s=Ii.CreateContainer(t,"se-file-figure se-flex-component");(i||e.container).parentElement.insertBefore(s.container,i)}this.history.push(!1),this.component.select(t,en.key,!1)},_register(t){t.result.forEach(((t,e,i)=>{this._create(t.url,{name:t.name,size:t.size},e===i.length-1)}))},_create(t,e,i){const s=e.name||t,n=Q.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,!1,!1);const o=Ii.CreateContainer(n);if(Q.addClass(o.container,"se-file-figure|se-flex-component"),this.component.insert(o.container,!1,!i||!this.options.get("componentAutoSelect"))){if(i)if(this.options.get("componentAutoSelect"))this.component.select(n,en.key,!1);else{const t=this.format.addLine(o.container,null);t&&this.selection.setRange(t,0,t,0)}}else this.editor.focus()},async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===tn?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)},_uploadCallBack(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)},constructor:en};const nn=en,on=function(t){qe.call(this,t),this.title=this.lang.bulletedList,this.icon="list_bulleted",this.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":on.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 Q.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ul"),this.menu.initDropdownTarget({key:on.key,type:"dropdown"},e)};on.key="list_bulleted",on.type="command",on.className="se-icon-flip-rtl",on.prototype={active:(t,e)=>Q.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(Q.addClass(e,"active"),!0):(Q.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?Q.addClass(e.parentElement,"active"):Q.removeClass(e.parentElement,"active")},action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ul")?.style.listStyleType||"";if(Q.isList(e)&&i)e.style.listStyleType=i;else{const t=this.format.applyList(`ul:${i}`,null,!1);t&&this.selection.setRange(t.sc,t.so,t.ec,t.eo)}this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)},constructor:on};const ln=on,rn=function(t){qe.call(this,t),this.title=this.lang.numberedList,this.icon="list_numbered",this.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":rn.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${an(["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${an(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return Q.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ol"),this.menu.initDropdownTarget({key:rn.key,type:"dropdown"},e)};function an(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("")}rn.key="list_numbered",rn.type="command",rn.className="se-icon-flip-rtl",rn.prototype={active:(t,e)=>Q.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(Q.addClass(e,"active"),!0):(Q.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?Q.addClass(e.parentElement,"active"):Q.removeClass(e.parentElement,"active")},action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ol")?.style.listStyleType||"";if(Q.isList(e)&&i)e.style.listStyleType=i;else{const t=this.format.applyList(`ol:${i}`,null,!1);t&&this.selection.setRange(t.sc,t.so,t.ec,t.eo)}this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)},constructor:rn};const hn=rn,{debounce:cn}=J,dn=function(t,e){qe.call(this,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.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,this.limitSize)||"",this._delay=0,this._lastAtPos=0,this._anchorOffset=0,this._anchorNode=null,this.apiManager=new Gs(this,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?new Map([["",[]]]):null;const i=Q.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new ui(this,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new si(this,i,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(i.firstElementChild,un.bind(this)),this.onInput=cn(this.onInput.bind(this),this.delayTime)};function un(t){if(!t)return!1;let e=null;const{key:i,name:s,url:n}=t,o=this._anchorNode.parentNode;if(Q.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=Q.createElement("A",{"data-se-mention":i,href:n,title:s,target:"_blank"},this.triggerText+i),!this.html.insertNode(e,null,!1))return!1;this.selectMenu.close();const l=Q.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.selection.setRange(l,1,l,1),this.cachingFieldData&&this.cachingFieldData.get("").push(t)}dn.key="mention",dn.type="field",dn.className="",dn.prototype={async onInput(){this.apiManager.cancel();const t=this.selection.get();if(!t.rangeCount)return void this.selectMenu.close();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||Q.isZeroWith(o))){if(t.length<this.searchStartLength)return!0;const s=e.parentNode;if(Q.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){let i=null;if(this.cachingData&&(i=this.cachingData.get(t)),!i){const e=await this.apiManager.asyncCall({method:"GET",url:this._createUrl(t)});i=JSON.parse(e.responseText)}if(this.cachingFieldData&&(i=this.cachingFieldData.get("").concat(i).splice(0,this.limitSize)),!i?.length)return this.selectMenu.close(),!1;const s=[],n=[];for(let t,e=0,o=i.length;e<o;e++)t=i[e],s.push(t),n.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===s.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(s,n),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,s),!0)},_createUrl(t){return this.apiUrl.replace(/\{key\}/i,t)},constructor:dn};const pn=dn,gn=function(t,e){qe.call(this,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 Q.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(gn,i)};gn.key="align",gn.type="dropdown",gn.className="",gn.prototype={active(t,e){const i=e.firstElementChild;if(t){if(this.format.isLine(t)){const s=t.style.textAlign;if(s)return Q.changeElement(i,this.alignIcons[s]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",s),!0}}else Q.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")?Q.addClass(i[t],"active"):Q.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++)Q.setStyle(s[t],"textAlign",e===i?"":e);this.editor.effectNode=null,this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)},constructor:gn};const mn=gn,fn=function(t,e){qe.call(this,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" 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>",Q.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(fn,s)};fn.key="font",fn.type="dropdown",fn.className="se-btn-select se-btn-tool-font",fn.prototype={active(t,e){const i=e.querySelector(".se-txt"),s=e.parentNode.querySelector(".se-tooltip-text");if(t){if(t?.style.fontFamily.length>0){const e=t.style.fontFamily.replace(/["']/g,"");return Q.changeTxt(i,e),Q.changeTxt(s,this.lang.font+" ("+e+")"),!0}}else{const t=this.status.hasFocus?this.editor.frameContext.get("wwComputedStyle").fontFamily:this.lang.font;Q.changeTxt(i,t),Q.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,"")?Q.addClass(e[t],"active"):Q.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=Q.createElement("SPAN",{style:"font-family: "+e+";"});this.format.applyInlineElement(t,["font-family"],null,null)}else this.format.applyInlineElement(null,["font-family"],["span"],!0);this.menu.dropdownOff()},constructor:fn};const _n=fn,{isMobile:bn}=Y,vn=240,yn=vn/2,Cn=3,wn=10,xn=14,En={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Sn,Tn=0,kn=!1,Nn=!1,Ln=vn/2,Hn=vn/2,Mn=En;const An=function(t,e,i){if(e||(e={}),this.editor=t.editor,this.eventManager=t.eventManager,this.inst=t,this.form=e.form,this.ctx={wheelX:Ln,wheelY:Hn,lightness:Tn,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:En},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){return Q.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`)}(t.editor,i);this.form=s.querySelector(".se-hue"),this.controller=new si(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()}))}};An.prototype={get:()=>Mn,open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})},off(){this.ctx={gradientPointerX:Fn.style.left,wheelPointerX:zn.style.left,wheelPointerY:zn.style.top,wheelX:Ln,wheelY:Hn,lightness:Tn,color:Sn?.color||Qn(On)},this.controller.close(),this.init()},close(){this.off(),this.inst.hueSliderCancelAction()},attach(t){this.init(),(t||this.form).appendChild(Bn),Sn=this.ctx,Sn&&(Ln=Sn.wheelX,Hn=Sn.wheelY,Tn=Sn.lightness,zn.style.left=Sn.wheelPointerX,zn.style.top=Sn.wheelPointerY,Fn.style.left=Sn.gradientPointerX,Jn(Sn.color.hex),to(),Xn(Yn()));const e={name:"mousedown",func:Zn},i={name:"mousemove",func:qn,option:!0},s={name:"mouseup",func:()=>{kn=!1,Nn=!1}};bn&&(e.name="touchstart",i.name="touchmove",s.name="touchend",e.func=Wn,i.func=Un),this.__globalMouseDown=this.eventManager.addGlobalEvent(e.name,e.func,{passive:!1,useCapture:!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,kn=!1,Nn=!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))},constructor:An};const{slider:Bn,offscreenCanvas:In,offscreenCtx:Vn,wheel:Rn,wheelCtx:On,wheelPointer:zn,gradientBar:$n,gradientPointer:Fn,fanalColorHex:Pn,fanalColorBackground:Dn}=function(){const t=document.createElement("canvas");t.width=vn,t.height=vn;const e=`\n\t<div class="se-hue-slider-container" style="width: ${vn}px; height: ${vn}px;">\n <canvas class="se-hue-wheel" width="${vn}" height="${vn}"></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="${vn}" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:${vn}px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${En.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=Q.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 Wn(t){const{target:e,touches:i}=t,s=i[0].clientX,n=i[0].clientY;e===Rn?(t.preventDefault(),Nn=!1,kn=!0,Gn(s,n)):e===$n&&(t.preventDefault(),Nn=!0,kn=!1,jn(s))}function Un(t){t.preventDefault();const{touches:e}=t,i=e[0].clientX,s=e[0].clientY;kn?Gn(i,s):Nn&&jn(i)}function Zn({target:t,clientX:e,clientY:i}){t===Rn?(Nn=!1,kn=!0,Gn(e,i)):t===$n&&(Nn=!0,kn=!1,jn(e))}function qn({clientX:t,clientY:e}){kn?Gn(t,e):Nn&&jn(t)}function Gn(t,e){const i=Rn.getBoundingClientRect();t=t-i.left-yn,e=e-i.top-yn;const s=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),yn),o=yn+n*Math.cos(s*Math.PI/180),l=yn+n*Math.sin(s*Math.PI/180);zn.style.left=`${o}px`,zn.style.top=`${l}px`,function(t,e){Ln=t,Hn=e,Xn(Yn())}(o,l),Kn()}function jn(t){const e=$n.getBoundingClientRect();let i=t-e.left;i=Math.max(xn,Math.min(i,e.width-xn)),Fn.style.left=`${i}px`,function(t){const e=$n.getBoundingClientRect();let i=t-e.left;i<0&&(i=0),i>e.width&&(i=e.width);const s=xn;i>=$n.width-s?i=$n.width:i<=s&&(i=0);const n=1-i/e.width;Tn=n,to()}(t),Kn()}function Xn(t){const e=$n.getContext("2d"),i=e.createLinearGradient(0,0,$n.width,0);i.addColorStop(0,"black"),i.addColorStop(1,t.hex),e.fillStyle=i,e.fillRect(0,0,$n.width,$n.height)}function Yn(){return Qn(Vn)}function Kn(){Sn.color=Mn=Qn(On),Jn(Mn.hex)}function Jn(t){Dn.style.backgroundColor=Pn.textContent=t}function Qn(t){const e=t.getImageData(Ln,Hn,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[io(o),io(l),io(r)]}(e);const o=Ln-yn,l=Hn-yn;Math.sqrt(o*o+l*l)<Cn&&(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);return i<16&&(o=`0${o}`),`${s}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:i,s,l:io(n)}}function to(){On.clearRect(0,0,vn,vn),On.drawImage(In,0,0),On.globalAlpha=Tn,On.fillStyle="black",On.beginPath(),On.arc(yn,yn,yn,0,2*Math.PI),On.fill(),On.globalAlpha=1}function eo(t){return t*Math.PI/180}function io(t){const e=Math.pow(10,wn);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<=yn;i+=1){t.beginPath();const s=50+(yn-i)/yn*50;t.fillStyle=`hsl(${e}, 100%, ${s}%)`;const n=yn+Math.cos(eo(e))*i,o=yn-Math.sin(eo(e))*i;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}}(Vn),to();const so=An,no=["#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"],oo=function(t,e,i){const s=t.editor;Ot.call(this,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||no)===no?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">${uo(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${uo(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>`,Q.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 so(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",lo.bind(this)),this.eventManager.addEvent(this.inputElement,"input",co.bind(this)),this.eventManager.addEvent(this.target.querySelector("form"),"submit",ro.bind(this))),i.disableRemove||this.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",ho.bind(this)),this.eventManager.addEvent(this.target,"click",ao.bind(this))};function lo(){this.parentForm?.length>0&&this.parentForm.forEach((t=>{this.parentFormDisplay.push([t,t.style.display]),t.style.display="none"})),this.hueSlider.open(this.targetButton)}function ro(t){t.preventDefault(),"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(this.currentColor)}function ao(t){const e=t.target.getAttribute("data-value");e&&"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(e)}function ho(){"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(null)}function co(t){this.setHexColor(t.target.value)}function uo(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}oo.prototype={hueSliderAction(t){this._setInputText(t.hex)},hueSliderCancelAction(){this.parentForm?.length>0&&this.parentFormDisplay.forEach((t=>t[0].style.display=t[1]))},hueSliderClose(){this.hueSlider.off()},init(t,e){this.targetButton=e;const i=this.editor.frameContext.get("wwComputedStyle")[this.styleProperties],s=this.defaultColor||J.isHexColor(i)?i:J.rgb2hex(i);let n=("string"==typeof t?t:this._getColorInNode(t))||s;n=J.isHexColor(n)?n:J.rgb2hex(n)||n||"";const o=this.colorList;for(let t,e=0,i=o.length;e<i;e++)t=o[e],n.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),Q.addClass(t,"active")):(Q.removeClass(t,"active"),t.contains(this.checkedIcon)&&Q.removeItem(this.checkedIcon));this._setInputText(this._colorName2hex(n))},setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t},_setInputText(t){t=/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)},_getColorInNode(t){let e="";const i=this.styleProperties;for(;t&&!Q.isWysiwygFrame(t)&&0===e.length;)1===t.nodeType&&t.style[i]&&(e=t.style[i]),t=t.parentNode;return e},_colorName2hex(t){if(/^#/.test(t))return t;const e=Q.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 Q.removeItem(e),i.length>=3&&"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substr(1)},constructor:oo};const po=oo,go=function(t,e){qe.call(this,t),this.title=this.lang.fontColor,this.icon="font_color";const i=Q.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new po(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(go,i)};go.key="fontColor",go.type="dropdown-free",go.className="",go.prototype={active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return!1;if(t){if(t?.style.color.length>0)return i.style.color=t.style.color,!0}else i.style.color="";return!1},on(t){this.colorPicker.init(this.selection.getNode(),t)},onDropdownClose(){this.colorPicker.hueSliderClose()},colorPickerAction(t){this.action(t)},action(t){if(t){const e=Q.createElement("SPAN",{style:"color: "+t+";"});this.format.applyInlineElement(e,["color"],null,null)}else this.format.applyInlineElement(null,["color"],["span"],!0);this.menu.dropdownOff()},constructor:go};const mo=go,fo=function(t,e){qe.call(this,t),this.title=this.lang.backgroundColor,this.icon="background_color";const i=Q.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new po(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(fo,i)};fo.key="backgroundColor",fo.type="dropdown-free",fo.className="",fo.prototype={active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return!1;if(t){if(t?.style.backgroundColor.length>0)return i.style.color=t.style.backgroundColor,!0}else i.style.color="";return!1},on(t){this.colorPicker.init(this.selection.getNode(),t)},off(){this.colorPicker.hueSliderClose()},colorPickerAction(t){this.action(t)},action(t){if(t){const e=Q.createElement("SPAN",{style:"background-color: "+t+";"});this.format.applyInlineElement(e,["background-color"],null,null)}else this.format.applyInlineElement(null,["background-color"],["span"],!0);this.menu.dropdownOff()},constructor:fo};const _o=fo,bo=function(t,e){qe.call(this,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 Q.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(bo,i)};bo.key="hr",bo.type="dropdown",bo.className="",bo.component=function(t){return/^hr$/i.test(t?.nodeName)?t:null},bo.prototype={select(t){Q.addClass(t,"on")},deselect(t){Q.removeClass(t,"on")},destroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;Q.removeItem(t),this.editor.focusEdge(e),this.history.push(!1)},action(t){const e=t.firstElementChild.cloneNode(!1);this.editor.focus(),this.component.insert(e,!1,!1),this.menu.dropdownOff();const i=this.format.addLine(e);this.selection.setRange(i,1,i,1)},constructor:bo};const vo=bo,yo=function(t){qe.call(this,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 Q.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(yo,e)};yo.key="list",yo.type="dropdown",yo.className="se-icon-flip-rtl",yo.prototype={active(t,e){const i=e.firstElementChild;if(Q.isList(t)){const s=t.nodeName.toLowerCase();return e.setAttribute("data-focus",s),Q.addClass(e,"active"),/^ul$/.test(s)?Q.changeElement(i,this.icons.bulleted):Q.changeElement(i,this.icons.numbered),!0}return e.removeAttribute("data-focus"),Q.changeElement(i,this.icons.number),Q.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")?Q.addClass(i[t],"active"):Q.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)},constructor:yo};const Co=yo,{_w:wo,ON_OVER_COMPONENT:xo}=Y,Eo=".se-table-resize-line",So=".se-table-resize-line-prev",To=".se-table-resize-row",ko=".se-table-resize-row-prev",No=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],Lo={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"},Ho=["all","inside","horizon","vertical"],Mo="borderLeft",Ao="borderTop",Bo="borderRight",Io="borderBottom",Vo=["#b0dbb0","#efef7e","#f2acac","#dcb0f6","#99bdff","#5dbd5d","#e7c301","#f64444","#e57ff4","#4387f1","#27836a","#f69915","#ba0808","#a90bed","#134299","#e4e4e4","#B3B3B3","#808080","#4D4D4D","#000000"],Ro=function(t,e){qe.call(this,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=Q.createElement("DIV",{class:"se-dropdown se-selector-table"},'\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>'),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="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 Q.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 </div>`;return Q.createElement("DIV",{class:"se-controller se-controller-table-cell"},s)}(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<li>\n\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip" data-command="props_align" data-value="${i}" title="${o}" aria-label="${o}">\n\t\t\t\t${e["align_"+i]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</li>`;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<li>\n\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip" data-command="props_align_vertical" data-value="${i}" title="${s}" aria-label="${s}">\n\t\t\t\t${e["align_"+i]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${s}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</li>`;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[Lo.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}</label>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner __se__a_h">\n\t\t\t\t\t\t<ul class="se-form-group se-form-w0">${n}</ul>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner __se__a_v">\n\t\t\t\t\t\t<ul class="se-form-group se-form-w0">${l}</ul>\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>`;return Q.createElement("DIV",{class:"se-controller se-table-props"},r)}(t);t.applyFrameRoots((t=>{t.get("wrapper").appendChild(Q.createElement("DIV",{class:Eo.replace(/^\./,"")})),t.get("wrapper").appendChild(Q.createElement("DIV",{class:So.replace(/^\./,"")})),t.get("wrapper").appendChild(Q.createElement("DIV",{class:To.replace(/^\./,"")})),t.get("wrapper").appendChild(Q.createElement("DIV",{class:ko.replace(/^\./,"")}))})),this.controller_table=new si(this,n,{position:"top"}),this.controller_cell=new si(this,o,{position:this.cellControllerTop?"top":"bottom"});const r=[this.controller_table.form,this.controller_cell.form];this.controller_props=new si(this,l,{position:"bottom",parents:r,isInsideForm:!0}),this.controller_props_title=l.querySelector(".se-controller-title");const a=Q.createElement("DIV",{class:"se-controller se-list-layer"},null);this.colorPicker=new po(this,"",{colorList:e.colorList||Vo,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{parents:[a],isOutsideForm:!0}}}),a.appendChild(this.colorPicker.target),this.controller_colorPicker=new si(this,a,{position:"bottom",parents:[this.controller_props.form].concat(r),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),Q.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.figure=new Ii(this,null,{}),this.sliderType="";const h=(c=this.lang,{items:["vertical","horizontal"],menus:Q.createElement("DIV",null,`\n\t\t<div title="${c.verticalSplit}" aria-label="${c.verticalSplit}">\n\t\t\t${c.verticalSplit}\n\t\t</div>\n\t\t<div title="${c.horizontalSplit}" aria-label="${c.horizontalSplit}">\n\t\t\t${c.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var c;this.splitButton=o.querySelector('[data-command="onsplit"]'),this.selectMenu_split=new ui(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_split.on(this.splitButton,Fo.bind(this)),this.selectMenu_split.create(h.items,h.menus);const d=function(t,e){return{items:["insert-left","insert-right","delete"],menus:Q.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>`).querySelectorAll("div")}}(this.lang,this.icons),u=o.querySelector('[data-command="oncolumn"]');this.selectMenu_column=new ui(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_column.on(u,Po.bind(this)),this.selectMenu_column.create(d.items,d.menus);const p=function(t,e){return{items:["insert-above","insert-below","delete"],menus:Q.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>`).querySelectorAll("div")}}(this.lang,this.icons),g=o.querySelector('[data-command="onrow"]');this.selectMenu_row=new ui(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_row.on(g,Do.bind(this)),this.selectMenu_row.create(p.items,p.menus);const m=function(){let t="";for(let e,i=0,s=No.length;i<s;i++)e=No[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=Q.createElement("DIV",null,t);return{items:No,menus:e.querySelectorAll("div")}}(),f=l.querySelector('[data-command="props_onborder_style"]');this.selectMenu_props_border=new ui(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(f,Yo.bind(this)),this.selectMenu_props_border.create(m.items,m.menus);const _=Jo(this.lang,this.icons,[]),b=l.querySelector('[data-command="props_onborder_format"]');this.selectMenu_props_border_format=new ui(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(b,Ko.bind(this,"all")),this.selectMenu_props_border_format.create(_.items,_.menus);const v=Jo(this.lang,this.icons,Ho);this.selectMenu_props_border_format_oneCell=new ui(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(b,Ko.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(v.items,v.menus),this.maxText=this.lang.maxSize,this.minText=this.lang.minSize,this.propTargets={cell_alignment:l.querySelector(".se-table-props-align > .__se__a_h"),cell_alignment_vertical:l.querySelector(".se-table-props-align > .__se__a_v"),border_format:b,border_style:l.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:l.querySelector(".__se_border_color"),border_width:l.querySelector(".__se__border_size"),back_color:l.querySelector(".__se_back_color"),font_color:l.querySelector(".__se_font_color"),palette_border_button:l.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:l.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:l.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:l.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:l.querySelector('[data-command="props_font_style"][data-value="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.querySelector('[data-command="merge"]'),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._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._selectedCells=null,this._shift=!1,this._fixedCell=null,this._fixedCellName=null,this._selectedCell=null,this._selectedTable=null,this._ref=null,this._bindMultiOn=qo.bind(this),this._bindMultiOff=Go.bind(this),this._bindShiftOff=jo.bind(this),this._bindTouchOff=Xo.bind(this),this.__globalEvents={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null},this.menu.initDropdownTarget(Ro,i),this.eventManager.addEvent(s,"mousemove",Wo.bind(this)),this.eventManager.addEvent(s,"click",Uo.bind(this))};function Oo(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function zo(t,e){const i=t.clientX,s=tt.get(wo.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 $o(t,e){const i=t.clientY,s=tt.get(wo.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(s+n.top-i)<=5,startY:i}}function Fo(t){const e="vertical"===t,i=this._tdElement,s=this._trElements,n=this._trElement,o=this._logical_cellIndex,l=this._rowIndex,r=Zo(i.nodeName,0,!0);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=Q.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=Q.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.editor.focusEdge(i),this._deleteStyleSelectedCells(),this.history.push(!1),this.setController(i),this._selectedCell=this._fixedCell=i}function Po(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()}function Do(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()}function Wo(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",Q.changeTxt(this.tableDisplay,e+" x "+i),this._tableXY=[e,i]}function Uo(){this.action()}function Zo(t,e,i){return t=t.toLowerCase(),i?Q.createElement(t,null,"<div><br></div>"):`<${t}><div><br></div></${t}>`.repeat(e)}function qo(t){this.editor._antiBlur=!0;const e=Q.getParentElement(t.target,Q.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===Q.getParentElement(e,"TABLE")&&(this._selectedCell=e,this._setMultiCells(this._fixedCell,e))}function Go(t){if(t.stopPropagation(),this._shift?this.__globalEvents.touchOff&&(this.__globalEvents.touchOff=this.eventManager.removeGlobalEvent(this.__globalEvents.touchOff)):(this.__removeGlobalEvents(),this._toggleEditor(!0)),!this._fixedCell||!this._selectedTable)return;this.setMergeSplitButton(this._fixedCell,this._selectedCell),this._selectedCells=Array.from(this._selectedTable.querySelectorAll(".se-selected-table-cell"));const e=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this.setController(e)}function jo(){this._ref||this._closeController()}function Xo(){this.close()}function Yo(t){this.propTargets.border_style.textContent=t,this._disableBorderProps(t===No[0]),this.selectMenu_props_border.close()}function Ko(t,e){const{border_format:i}=this.propTargets;i.setAttribute("se-border-format",e),i.firstElementChild.innerHTML=this.icons[Lo[e]],e!==t?Q.addClass(i,"active"):Q.removeClass(i,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}function Jo(t,e,i){const s=[];let n="";for(const o in Lo){if(i.includes(o))continue;const l=Lo[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:Q.createElement("DIV",null,n).querySelectorAll("button")}}Ro.key="table",Ro.type="dropdown-free",Ro.className="",Ro.component=function(t){return Q.isTable(t)?t:null},Ro.options={isInputComponent:!0},Ro.prototype={action(){const t=Q.createElement("TABLE"),e=this._tableXY[0],i=this._tableXY[1],s=`<tbody>${`<tr>${Zo("td",e,!1)}</tr>`.repeat(i)}</tbody>`,n=`<colgroup>${`<col style="width: ${tt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+s;const o=Q.createElement("FIGURE",{class:"se-flex-component se-input-component"});if(o.appendChild(t),this.component.insert(o,!1,!1)){this._resetTablePicker();const e=t.querySelector("td div");this.selection.setRange(e,0,e,0)}},retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let i=Q.isFigure(t.parentNode)?t.parentNode:null;if(!e||!i){if(!e){const e=function(t){let e=0;for(const i of t.rows){let t=0;for(const e of i.cells)t+=e.colSpan;e=Math.max(e,t)}return e}(t),i=Q.createElement("colgroup",null,`<col style="width: ${tt.get(100/e,0)}%;">`.repeat(e));t.insertBefore(i,t.firstElementChild)}if(i?Q.addClass(i,"se-flex-component|se-input-component"):(i=Q.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(i,t),i.appendChild(t)),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;Q.addClass(i,t),Q.removeClass(i,this.figureScrollList.filter((e=>e!==t)).join("|"))}else Q.removeClass(i,this.figureScrollList.join("|"))}}}},setDir(t){this.tableHighlight.style.left="rtl"===t?"167px":"",this._resetTablePicker(),this._resetPropsAlign("rtl"===t)},onMouseMove({event:t}){if(this._resizing)return;const e=Q.getParentElement(t.target,Oo);if(!e||this._fixedCell)return void this.__hideResizeLine();const i=zo(t,e);return i.is?(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(Eo),this._setResizeLinePosition(Q.getParentElement(e,Q.isTable),e,this._resizeLine,i.isLeft),void(this._resizeLine.style.display="block")):$o(t,e).is?(this.__removeGlobalEvents(),this._element=Q.getParentElement(e,Q.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(To),this._setResizeRowPosition(Q.getParentElement(e,Q.isTable),e,this._resizeLine),void(this._resizeLine.style.display="block")):(this._element&&(this._element.style.cursor=""),void this.__hideResizeLine())},onScroll(){"block"===this._resizeLine?.style.display&&(this._element&&(this._element.style.cursor=""),this._resizeLine.style.display="none")},onMouseDown({event:t}){this._ref=null;const e=Q.getParentElement(t.target,Oo);if(!e)return;const i=zo(t,e);if(i.is){try{this._deleteStyleSelectedCells(),this.setCellInfo(e,!0);const t=this._logical_cellIndex-(i.isLeft?1:0);if(this.editor.enableBackWrapper("ew-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Eo)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(So),t<0||t===this._logical_cellCnt-1)return void this._startFigureResizing(i.startX,t<0);const s=this._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(s,i.startX,tt.get(wo.getComputedStyle(s).width,0),i.isLeft)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}return}const s=$o(t,e);if(s.is)try{let t=Q.getParentElement(e,Q.isTableRow),i=e.rowSpan;if(i>1)for(;Q.isTableRow(t)&&i>1;)t=t.nextElementSibling,--i;this._deleteStyleSelectedCells(),this.setRowInfo(t),this.editor.enableBackWrapper("ns-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(To)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(ko),this._startRowResizing(t,s.startY,tt.get(wo.getComputedStyle(t).height,0))}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}else e===this._fixedCell||this._shift||(this._deleteStyleSelectedCells(),/^TR$/i.test(e.nodeName)||this.selectCells(e,!1))},onMouseUp(){this._shift=!1},onMouseLeave(){this.__hideResizeLine()},onKeyDown({event:t,range:e,line:i}){if(this._ref=null,this.editor.selectMenuOn||this._resizing)return;const s=t.keyCode;if(9===s){const s=Q.getParentElement(i,Q.isTableCell);if(s&&e.collapsed&&Q.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=t.shiftKey,i=Q.getParentElement(s,"table"),n=Q.getListChildren(i,Q.isTableCell),o=e?Q.prevIndex(n,s):Q.nextIndex(n,s);if(o===n.length&&!e){if(!Q.getParentElement(s,"thead")){const t=i.rows,e=this.insertBodyRow(i,t.length,t[t.length-1].cells.length).querySelector("td div");this.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return;let l=n[o];if(!l)return;return l=l.firstElementChild||l,this.selection.setRange(l,0,l,0),t.preventDefault(),t.stopPropagation(),!1}}let n=null;if(!t.shiftKey||16!==s){if(n=Q.getParentElement(i,Q.isTableCell),!Q.hasClass(n,"se-selected-cell-focus"))return;return this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents(),void this._closeController()}return this._shift||this._ref?void 0:(n=n||Q.getParentElement(i,Q.isTableCell),n?(this._fixedCell=n,this._closeController(),this.selectCells(n,t.shiftKey),!1):void 0)},onKeyUp({line:t}){this._shift&&Q.getParentElement(t,Q.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":Q.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),Q.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();break;case"resize":this._maxWidth=!this._maxWidth,this.setTableStyle("width",!1),this._historyPush(),this.component.select(this._element,Ro.key,!0);break;case"layout":this._fixedColumn=!this._fixedColumn,this.setTableStyle("column",!1),this._historyPush(),this.component.select(this._element,Ro.key,!0);break;case"remove":{const t=this._figure?.parentNode;Q.removeItem(this._figure),this._closeController(),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;Q.removeClass([t,e,i,s,n,o,l,r,a,h,c,d],"on")},selectCells(t,e){this._shift||this._ref||this.__removeGlobalEvents(),this._shift=e,this._fixedCell=t,this._fixedCellName=t.nodeName,this._selectedTable=Q.getParentElement(t,"TABLE"),this._deleteStyleSelectedCells(),Q.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)},seTableInfo(t){const e=this._element=this._selectedTable||Q.getParentElement(t,"TABLE");return this._figure=Q.getParentElement(e,Q.isFigure)||e,e},setCellInfo(t,e){const i=this.seTableInfo(t);if(this._trElement=t.parentNode,i.querySelector("thead")?Q.addClass(this.headerButton,"active"):Q.removeClass(this.headerButton,"active"),i.querySelector("caption")?Q.addClass(this.captionButton,"active"):Q.removeClass(this.captionButton,"active"),e||0===this._physical_cellCnt){this._tdElement!==t&&(this._tdElement=t,this._trElement=t.parentNode),this._selectedCells&&0!==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=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.seTableInfo(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.parentNode;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>"+Zo("td",this._logical_cellCnt,!1)+"</tr></tbody>":(Q.removeItem(this._figure),this._closeController()))}}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,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,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&&(Q.removeItem(t[e]),e--);0===i.children.length&&Q.removeItem(i)}},editRow(t,e){const i=!t,s="up"===t,n=this._rowIndex,o=i||s?n:n+this._current_rowSpan+1,l=i?-1:1,r=this._trElements;let a=this._logical_cellCnt;for(let t,e=0,s=n+(i?-1:0);e<=s;e++){if(t=r[e].cells,0===t.length)return;for(let i,s,n=0,r=t.length;n<r;n++)i=t[n].rowSpan,s=t[n].colSpan,i<2&&s<2||i+e>o&&o>e&&(t[n].rowSpan=i+l,a-=s)}if(i){const t=r[n+1];if(t){const e=[];let i=r[n].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(o)}else this.insertBodyRow(this._element,o,a);i?this._closeController():this.setCellControllerPosition(e||this._tdElement,!0)},editCell(t,e){const i=!t,s="left"===t,n=this._current_colSpan,o=i||s?this._logical_cellIndex:this._logical_cellIndex+n+1,l=this._trElements;let r,a=[],h=[],c=0;const d=[],u=[];for(let t,e,s,p,g,m=0,f=this._rowCnt;m<f;m++){t=l[m],r=o,p=!1,e=t.cells,g=0;for(let t,s,l,f,_=0,b=e.length;_<b&&(t=e[_],t);_++)if(s=t.rowSpan-1,l=t.colSpan-1,i){if(f=_+g,h.length>0){const t=!e[_+1];for(let e,i=0;i<h.length;i++)e=h[i],e.row>m||(f>=e.index?(g+=e.cs,f=_+g,e.rs-=1,e.row=m+1,e.rs<1&&(h.splice(i,1),i--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(h.splice(i,1),i--)))}s>0&&a.push({rs:s,cs:l+1,index:f,row:-1}),f>=r&&f+l<=r+n?d.push(t):f<=r+n&&f+l>=r?t.colSpan-=tt.getOverlapRangeAtIndex(o,o+n,f,f+l):s>0&&(f<r||f+l>r+n)&&u.push({cell:t,i:m,rs:m+s}),g+=l}else{if(_>=r)break;if(l>0){if(c<1&&l+_>=r){t.colSpan+=1,r=null,c=s+1;break}r-=l}if(!p){for(let t,e=0;e<h.length;e++)t=h[e],r-=t.cs,t.rs-=1,t.rs<1&&(h.splice(e,1),e--);p=!0}}if(h=h.concat(a).sort((function(t,e){return t.index-e.index})),a=[],!i){if(c>0){c-=1;continue}null!==r&&e.length>0&&(s=Zo(e[0].nodeName,0,!0),s=t.insertBefore(s,e[r]))}}const p=this._element.querySelector("colgroup");if(p){const t=p.querySelectorAll("col");if(i)Q.removeItem(t[r]);else{let e=0;for(let i,s=0,n=t.length;s<n;s++)i=tt.get(t[s].style.width),i-=Math.round(i*n*.1/2,0),e+=i,t[s].style.width=`${i}%`;const i=Q.createElement("col",{style:`width:${100-e}%`});p.insertBefore(i,t[r])}}if(i){let t,e;for(let i,s=0,n=d.length;s<n;s++)i=d[s].parentNode,Q.removeItem(d[s]),0===i.cells.length&&(t||(t=Q.getArrayIndex(l,i)),e=Q.getArrayIndex(l,i),Q.removeItem(i));for(let i,s=0,n=u.length;s<n;s++)i=u[s],i.cell.rowSpan=tt.getOverlapRangeAtIndex(t,e,i.i,i.rs);this._closeController()}else this.setCellControllerPosition(e||this._tdElement,!0)},insertBodyRow(t,e,i){const s=t.insertRow(e);return s.innerHTML=Zo("td",i,!1),s},mergeCells(){const t=this._ref,e=this._selectedCells,i=e[0];let s=null,n=null;const o=t.ce-t.cs+1;let l=t.re-t.rs+1,r="",a=null;for(let t,i,o=1,h=e.length;o<h;o++){t=e[o],a!==t.parentNode&&(a=t.parentNode),i=t.children;for(let t=0,e=i.length;t<e;t++)this.format.isLine(i[t])&&Q.isZeroWith(i[t].textContent)&&Q.removeItem(i[t]);r+=t.innerHTML,Q.removeItem(t),0===a.cells.length&&(s?n=a:s=a,l-=1)}if(s){const t=this._trElements,e=Q.getArrayIndex(t,s),i=Q.getArrayIndex(t,n||s),o=[];for(let s,n=0;n<=i;n++)if(s=t[n].cells,0!==s.length)for(let t,o,l=0,r=s.length;l<r;l++)t=s[l],o=t.rowSpan-1,o>0&&n+o>=e&&(t.rowSpan-=tt.getOverlapRangeAtIndex(e,i,n,n+o));else o.push(t[n]);for(let t=0,e=o.length;t<e;t++)Q.removeItem(o[t])}i.innerHTML+=r,i.colSpan=o,i.rowSpan=l,this.setMergeSplitButton(!0,!1),this.setController(i),this.editor.focusEdge(i),this._historyPush()},toggleHeader(){const t=this.headerButton,e=Q.hasClass(t,"active"),i=this._element;if(e)Q.removeItem(i.querySelector("thead"));else{const t=Q.createElement("THEAD");t.innerHTML="<tr>"+Zo("th",this._logical_cellCnt,!1)+"</tr>",i.insertBefore(t,i.firstElementChild)}Q.toggleClass(t,"active"),/TH/i.test(this._tdElement.nodeName)?this._closeController():this.setCellControllerPosition(this._tdElement,!1)},toggleCaption(){const t=this.captionButton,e=Q.hasClass(t,"active"),i=this._element;if(e)Q.removeItem(i.querySelector("caption"));else{const t=Q.createElement("CAPTION",{class:`se-table-caption-${this.captionPosition}`});t.innerHTML="<div><br></div>",i.insertBefore(t,i.firstElementChild)}Q.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="min-content")),Q.changeElement(this.resizeButton.firstElementChild,i),Q.changeTxt(this.resizeText,s)}t.includes("column")&&(this._fixedColumn?(Q.removeClass(this._element,"se-table-layout-auto"),Q.addClass(this._element,"se-table-layout-fixed"),Q.addClass(this.columnFixedButton,"active")):(Q.removeClass(this._element,"se-table-layout-fixed"),Q.addClass(this._element,"se-table-layout-auto"),Q.removeClass(this.columnFixedButton,"active")))},setMergeSplitButton(t,e){e&&e&&t!==e?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")},select(t){this._figureOpen(t);const e=this._figure?.style.width||"100%";if(this._maxWidth="100%"===e,this._fixedColumn=Q.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.setTableStyle(this._maxWidth?"width|column":"width",!0),zt.get("__overInfo")===xo)return;if(!this._tdElement)return;this.setCellInfo(this._tdElement,!0);const i=Q.getParentElement(t,Q.isFigure);this.controller_table.open(i,null,{isWWTarget:!1,initMethod:null,addOffset:null});const s=this.cellControllerTop&&"block"===this.controller_table.form.style.display?{left:this.controller_table.form.offsetWidth+2}:null;this.controller_cell.open(this._tdElement,this.cellControllerTop?i:null,{isWWTarget:!1,initMethod:null,addOffset:s})},setController(t){if(!this.selection.get().isCollapsed&&!this._selectedCell)return void this._deleteStyleSelectedCells();this._tdElement=t,Q.addClass(t,"se-selected-cell-focus");const e=this._element||this._selectedTable||Q.getParentElement(t,"TABLE");this.component.select(e,Ro.key,!0)},setCellControllerPosition(t,e){this.setCellInfo(t,e),this.controller_cell.resetPosition(this.cellControllerTop?Q.getParentElement(t,Q.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})},_startCellResizing(t,e,i,s){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=Q.hasClass(this._element,"se-table-layout-fixed")?l:J.getWidthInPercentage(t);zt.get("__dragHandler")&&(zt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._cellResize.bind(this,t,o,this._figure,this._tdElement,this._resizeLine,s,e,i,tt.get(n,0),tt.get(r,0),this._element.offsetWidth),(()=>{this.__removeGlobalEvents(),this.history.push(!0),this.component.select(this._element,Ro.key,!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),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=J.getWidthInPercentage(i);zt.get("__dragHandler")&&(zt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._figureResize.bind(this,i,this._resizeLine,e,t,i.offsetWidth,tt.get(s,0)),(()=>{this.__removeGlobalEvents(),this.component.select(this._element,Ro.key,!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){27===s.keyCode&&(this.__removeGlobalEvents(),t.style[i]=e,"width"===i&&this.component.select(this._element,Ro.key,!0))},_deleteStyleSelectedCells(){if(Q.removeClass([this._fixedCell,this._selectedCell],"se-selected-cell-focus"),this._selectedTable){const t=this._selectedTable.querySelectorAll(".se-selected-table-cell");for(let e=0,i=t.length;e<i;e++)Q.removeClass(t[e],"se-selected-table-cell")}},_recallStyleSelectedCells(){if(this._selectedCells){const t=this._selectedCells;for(let e=0,i=t.length;e<i;e++)Q.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),t?Q.removeClass(e,"se-disabled"):Q.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,font_bold:d,font_underline:u,font_italic:p,font_strike:g}=this.propTargets,{border:m,backgroundColor:f,color:_,textAlign:b,verticalAlign:v,fontWeight:y,textDecoration:C,fontStyle:w}=wo.getComputedStyle(i[0]),x=this._getBorderStyle(m);h.querySelector('[data-value="justify"]').style.display=e?"none":"",c.style.display=e?"none":"";let E=J.rgb2hex(x.c),S=x.s,T=x.w,k=J.rgb2hex(f),N=J.rgb2hex(_),L=/.+/.test(y),H=/underline/i.test(C),M=/line-through/i.test(C),A=/italic/i.test(w),B=e?this._figure?.style.float:b,I=v;this._propsCache=[];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);E&&x.c!==u&&(E=""),S&&x.s!==p&&(S=""),T&&x.w!==g&&(T=""),k!==J.rgb2hex(o)&&(k=""),N!==J.rgb2hex(l)&&(N=""),B!==(e?this._figure?.style.float:r)&&(B=""),I&&I!==a&&(I=""),L&&L!==/.+/.test(h)&&(L=""),H&&H!==/underline/i.test(c)&&(H=!1),M&&M!==/line-through/i.test(c)&&(M=!1),A&&A!==/italic/i.test(d)&&(A=!1),E&&S&&T&&k&&N||(s=!0)}s.firstElementChild.innerHTML=this.icons[Lo[1===i.length?"outside":"all"]],s.setAttribute("se-border-format","all"),Q.removeClass(s,"active"),S=S||No[0],o.textContent=S,n.style.borderColor=n.value=E,l.value=T,this._disableBorderProps(S===No[0]),r.value=r.style.borderColor=k,a.value=a.style.borderColor=N,L&&Q.addClass(d,"on"),H&&Q.addClass(u,"on"),M&&Q.addClass(g,"on"),A&&Q.addClass(p,"on"),this._setAlignProps(h,this._propsAlignCache=B,!0),this._setAlignProps(c,this._propsVerticalAlignCache=I,!0)},_setAlignProps(t,e,i){Q.removeClass(t.querySelectorAll("button"),"on"),i||t.getAttribute("se-cell-align")!==e?(Q.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.setAttribute("disabled",!0),i.setAttribute("disabled",!0),s.setAttribute("disabled",!0),i.setAttribute("disabled",!0)):(e.removeAttribute("disabled"),i.removeAttribute("disabled"),s.removeAttribute("disabled"),i.removeAttribute("disabled"))},_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:J.rgb2hex(n)}},_submitProps(t){try{t.setAttribute("disabled",!0);const e=this.controller_table.form.contains(this.controller_props.currentTarget),i=e?[this._element]:this._selectedCells,s=i[0],n=wo.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")||"",v=f?"":l.value.trim()||n.borderColor;let y=f?"":a.value.trim()||n.borderWidth;y+=tt.is(y)?"px":"";const C=h.value.trim(),w=c.value.trim(),x=g&&!f&&y,E=`${y} ${m} ${v}`,S={left:[],top:[],right:[],bottom:[],middle:[]};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="":E),S.left=S.top=S.right=S.bottom=i}else{let{rs:t,re:e,cs:n,ce:o}=this._ref||{rs:s.parentElement.rowIndex||0,re:s.parentElement.rowIndex||0,cs:s.cellIndex||0,ce:s.cellIndex||0};const l=new Array(e-t+1).fill(0).map((()=>new Array(o-n+1).fill(0))),r=n;e-=t,t-=t,o-=n,n-=n;let a=s.parentNode;for(let s,h,c,d,u,p=0,g=0,m=i.length,v=0;p<m;p++,g++){s=i[p],d=s.colSpan,u=s.rowSpan,c=s.cellIndex-r,a!==s.parentNode&&(v++,g=0,a=s.parentNode);let m=0;for(;m<=c;)c+=l[v][m]||0,m++;try{if(u>1){const t=u-1;for(let e=v;e<=v+t;e++)l[e][c]+=d-(v===e?1:0)}else d>1&&(l[v][c]+=d-1)}catch(t){}const y=v+u-1===e;v===t&&S.top.push(s),(v===e||y)&&S.bottom.push(s),c===n&&S.left.push(s),c!==o&&c+d-1!==o||S.right.push(s),y||v===t||v===e||c===n||c===o||S.middle.push(s),h=s.style,h.textAlign=_,h.verticalAlign=b,h.backgroundColor=C,h.color=w,this._setFontStyle(h),x||(h.border=f?h.borderLeft=h.borderTop=h.borderRight=h.borderBottom="":E)}0===S.middle.length&&(S.middle=i)}S.all=i,x&&this._setBorderStyles(S,p,E),this._historyPush(),this.controller_props.close(),this._tdElement&&(this._recallStyleSelectedCells(),this.setCellInfo(this._tdElement,!0),Q.addClass(this._tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.removeAttribute("disabled")}},_setFontStyle(t){const{font_bold:e,font_italic:i,font_strike:s,font_underline:n}=this.propTargets;t.fontWeight=Q.hasClass(e,"on")?"bold":"",t.fontStyle=Q.hasClass(i,"on")?"italic":"",t.textDecoration=((Q.hasClass(s,"on")?"line-through ":"")+(Q.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===t.length)return;Q.setStyle(r.filter((t=>!l.includes(t))),Io,i),Q.setStyle(r.filter((t=>!o.includes(t))),Bo,i);break;case"horizon":if(1===t.length)return;Q.setStyle(r.filter((t=>!l.includes(t))),Io,i);break;case"vertical":if(1===t.length)return;Q.setStyle(r.filter((t=>!o.includes(t))),Bo,i);break;case"outside":Q.setStyle(s,Mo,i),Q.setStyle(n,Ao,i),Q.setStyle(o,Bo,i),Q.setStyle(l,Io,i);break;case"left":Q.setStyle(s,Mo,i);break;case"top":Q.setStyle(n,Ao,i);break;case"right":Q.setStyle(o,Bo,i);break;case"bottom":Q.setStyle(l,Io,i)}},_setMultiCells(t,e){const i=this._selectedTable.rows;if(this._deleteStyleSelectedCells(),t===e){if(!this._shift)return}else Q.addClass(t,"se-selected-table-cell");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(tt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&tt.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}Q.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",Q.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,Q.addClass(t,"on"),this.colorPicker.init(i?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))},_closeController(){this.component.deselect(),this.controller_table.close(),this.controller_cell.close()},__hideResizeLine(){this._resizeLine&&(this._resizeLine.style.display="none",this._resizeLine=null)},__removeGlobalEvents(){this._resizing=!1,this.editor.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]))},constructor:Ro};const Qo=Ro,tl=function(t,e){qe.call(this,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>",Q.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(tl,i)};tl.key="formatBlock",tl.type="dropdown",tl.className="se-btn-select se-btn-tool-format",tl.prototype={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 Q.changeTxt(s,i),s.setAttribute("data-value",n),s.setAttribute("data-class",o),!0}}else Q.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")?Q.addClass(t,"active"):Q.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()},constructor:tl};const el=tl,il=function(t,e){qe.call(this,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>",Q.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(il,i)};il.key="layout",il.type="dropdown",il.className="",il.prototype={action(t){const e=1*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()},constructor:il};const sl=il,nl=function(t,e){qe.call(this,t),this.title=this.lang.lineHeight,this.icon="line_height";const i=function({lang:t},e){const i=e||[{text:"1",value:1},{text:"1.15",value:1.15},{text:"1.5",value:1.5},{text:"2",value:2}];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="default_value se-btn-list" 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>",Q.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(t,e.items);this.sizeList=i.querySelectorAll("li button"),this.currentSize=-1,this.menu.initDropdownTarget(nl,i)};nl.key="lineHeight",nl.type="dropdown",nl.className="",nl.prototype={active:(t,e)=>t?.style?.lineHeight.length>0?(Q.addClass(e,"active"),!0):(Q.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")?Q.addClass(t[i],"active"):Q.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)},constructor:nl};const ol=nl,ll=function(t,e){qe.call(this,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>",Q.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(ll,i)};ll.key="template",ll.type="dropdown",ll.className="",ll.prototype={action(t){const e=1*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),this.menu.dropdownOff()},constructor:ll};const rl=ll,al=function(t,e){qe.call(this,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>",Q.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.classList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(al,i)};al.key="paragraphStyle",al.type="dropdown",al.className="",al.prototype={on(){const t=this.classList,e=this.format.getLine(this.selection.getNode());for(let i=0,s=t.length;i<s;i++)Q.hasClass(e,t[i].getAttribute("data-command"))?Q.addClass(t[i],"active"):Q.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=Q.hasClass(t,"active")?Q.removeClass:Q.addClass;for(let t=0,n=i.length;t<n;t++)s(i[t],e);this.menu.dropdownOff(),this.history.push(!1)},constructor:al};const hl=al,cl=function(t,e){qe.call(this,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>",Q.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.styleList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(cl,i)};cl.key="textStyle",cl.type="dropdown",cl.className="",cl.prototype={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)?Q.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?Q.addClass(i,"active"):Q.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=Q.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.format.applyInlineElement(n,i,o,!0),this.menu.dropdownOff()},constructor:cl};const dl=cl,{NO_EVENT:ul}=Y,pl=function(t,e,i){qe.call(this,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=/\d+/.test(i.uploadSizeLimit)?tt.get(i.uploadSizeLimit,0):null,this.uploadSingleSizeLimit=/\d+/.test(i.uploadSingleSizeLimit)?tt.get(i.uploadSingleSizeLimit,0):null,this.input=Q.createElement("input",{type:"file",accept:i.acceptedFormats||"*"}),this.eventManager.addEvent(this.input,"change",gl.bind(this)),this.fileManager=new Qs(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${Tt(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${Tt(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>`;return 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${Tt(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>`),r+="</div></div>",Q.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(Q.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 ui(this,{checkList:!0,position:"right-middle",dir:"ltr"}),this.selectMenu_rel.on(this.relButton,_l.bind(this)),this.selectMenu_rel.create(i),this.eventManager.addEvent(this.relButton,"click",ml.bind(this))}e.querySelector(".se-anchor-editor").appendChild(s),this.selectMenu_bookmark=new ui(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_bookmark.on(this.urlInput,fl.bind(this)),this.eventManager.addEvent(this.newWindowCheck,"change",wl.bind(this)),this.eventManager.addEvent(this.downloadCheck,"change",xl.bind(this)),this.eventManager.addEvent(this.displayInput,"input",bl.bind(this)),this.eventManager.addEvent(this.urlInput,"input",vl.bind(this)),this.eventManager.addEvent(this.urlInput,"focus",yl.bind(this)),this.eventManager.addEvent(this.bookmarkButton,"click",Cl.bind(this)),this.eventManager.addEvent(s.querySelector("._se_upload_button"),"click",(()=>this.input.click()))};async function gl(t){const e=t.target.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),n=await this.triggerEvent("onFileUploadBefore",{...i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),void(!0!==n&&n!==ul||s(null)))}function ml(){this.selectMenu_rel.open(this.options.get("_rtl")?"left-middle":"")}function fl(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()}function _l(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(", ")}function bl(t){this._change=!!t.target.value.trim()}function vl(t){const e=t.target.value.trim();this._setLinkPreview(e),this._selfPathBookmark(e)?this._createBookmarkList(e):this.selectMenu_bookmark.close()}function yl(){const t=this.urlInput.value;this._selfPathBookmark(t)&&this._createBookmarkList(t)}function Cl(){let t=this.urlInput.value;this._selfPathBookmark(t)?(t=t.substr(1),this.bookmark.style.display="none",Q.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",Q.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()}function wl(t){"string"==typeof this.defaultRel.check_new_window&&(t.target.checked?this._setRel(this._relMerge(this.defaultRel.check_new_window)):this._setRel(this._relDelete(this.defaultRel.check_new_window)))}function xl(t){t.target.checked?(this.download.style.display="block",this.bookmark.style.display="none",Q.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)))}pl.prototype={set(t){this.currentTarget=t},on(t){if(t){if(this.currentTarget){const t=this.currentTarget.getAttribute("href");this.linkValue=this.preview.textContent=this.urlInput.value=this._selfPathBookmark(t)?t.substr(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||Q.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.substr(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)?Q.addClass(i[s],"se-checked"):Q.removeClass(i[s],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?Q.addClass(this.relButton,"on"):Q.removeClass(this.relButton,"on")},_createBookmarkList(t){const e=Q.getListChildren(this.editor.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||Q.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(Q.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("^"+K.escapeStringRegexp(t.substr(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",Q.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",Q.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===ul?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)},_uploadCallBack(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)},constructor:pl};const El=pl,Sl=function(t,e){qe.call(this,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 Q.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 Q.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new El(this,i,this.pluginOptions),this.modal=new ys(this,i),this.controller=new si(this,s,{position:"bottom",disabled:!1})};Sl.key="link",Sl.type="modal",Sl.className="se-icon-flip-rtl",Sl.prototype={active(t){if(Q.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,Q.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(Q.createElement(e[0].nodeName,null,t),null,!1))return!0}else if(!this.html.insertNode(t,null,!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=Q.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=Q.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,null,["A"],!1)}else Q.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.editor.focus(),this.history.push(!1)},close(){Q.removeClass(this.controller.currentTarget,"on")},constructor:Sl};const Tl=Sl,{NO_EVENT:kl}=Y,Nl=function(t,e){qe.call(this,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?tt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"auto",defaultHeight:e.defaultHeight?tt.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,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"};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${ys.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 _se_image_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${Tt(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_image_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_image_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_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${Tt(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${Tt(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${Tt(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>`;return Q.createElement("DIV",{class:"se-modal-content"},a)}(t,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||!this.pluginOptions.canResize?[[n,"mirror_h","mirror_v","align","caption","revert","edit","remove"]]:[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["edit","align","caption","revert","remove"]];this.alignForm=s.querySelector(".se-figure-align"),o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.plugins.link?this.plugins.link.pluginOptions:{};this.anchor=new El(this,s,{textToDisplay:!1,title:!0,openNewWindow:l.openNewWindow,relList:l.relList,defaultRel:l.defaultRel,noAutoPrefix:l.noAutoPrefix,enableFileUpload:e.linkEnableFileUpload}),this.modal=new ys(this,s),this.figure=new Ii(this,o,{sizeUnit:i}),this.fileManager=new Qs(this,{query:"img",loadHandler:this.events.onImageLoad,eventHandler:this.events.onImageAction}),this.fileModalWrapper=s.querySelector(".se-flex-input-wrapper"),this.imgInputFile=s.querySelector(".__se__file_input"),this.imgUrlFile=s.querySelector("._se_image_url"),this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=s.querySelector("._se_image_alt"),this.captionCheckEl=s.querySelector("._se_image_check_caption"),this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=s.querySelector("._se_tab_content_image .se-link-preview"),this.sizeUnit=i,this.as="block",this.proportion={},this.inputX={},this.inputY={},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.querySelector(".se-modal-tabs"),"click",this._openTab.bind(this)),this.imgInputFile&&this.eventManager.addEvent(s.querySelector(".se-file-remove"),"click",Hl.bind(this)),this.imgUrlFile&&this.eventManager.addEvent(this.imgUrlFile,"input",Vl.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.eventManager.addEvent(this.imgInputFile,"change",Rl.bind(this));const r=s.querySelector(".__se__gallery");if(r&&this.eventManager.addEvent(r,"click",Ol.bind(this)),this._resizing){this.proportion=s.querySelector("._se_image_check_proportion"),this.inputX=s.querySelector("._se_image_size_x"),this.inputY=s.querySelector("._se_image_size_y"),this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=Al.bind(this);this.eventManager.addEvent(this.inputX,"keyup",Ml.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",Ml.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.querySelector(".se-modal-btn-revert"),"click",Bl.bind(this))}this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=s.querySelector('[data-command="asBlock"]'),this.asInline=s.querySelector('[data-command="asInline"]'),this.eventManager.addEvent([this.asBlock,this.asInline],"click",Il.bind(this)))};async function Ll(t,e){if(await this.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===kl){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}function Hl(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),ys.OnChangeFile(this.fileModalWrapper,[])}function Ml(t,e){if(32!==e.keyCode){if("x"===t&&this._onlyPercentage&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=Ii.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=e.h:this.inputX.value=e.w}}else e.preventDefault()}function Al(){this._ratio=this.proportion.checked?Ii.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}function Bl(){this._onlyPercentage?this.inputX.value=this._origin_w>100?100:this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}function Il({target:t}){this._activeAsInline("asInline"===t.getAttribute("data-command"))}function Vl(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:""}function Rl({target:t}){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),ys.OnChangeFile(this.fileModalWrapper,t.files)}function Ol(){this.plugins.imageGallery.open(zl.bind(this))}function zl(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()}function $l(t,e,i){if(0===t.offsetWidth&&this.applySize(e,""),this.options.get("componentAutoSelect"))this.component.select(t,Nl.key,!1);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,Nl.key,!1)}else{const t=this.format.addLine(i,null);t&&this.selection.setRange(t,0,t,0)}this.editor._iframeAutoHeight(this.editor.frameContext),delete t.onload}Nl.key="image",Nl.type="modal",Nl.component=function(t){return t=Q.isFigure(t)||/^span$/i.test(t.nodeName)&&Q.hasClass(t,"se-component")?t.firstElementChild:t,/^IMG$/i.test(t?.nodeName)?t:Q.isAnchor(t)&&/^IMG$/i.test(t?.firstElementChild?.nodeName)?t?.firstElementChild:null},Nl.className="",Nl.prototype={open(){this.modal.open()},edit(){this.modal.open()},on(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(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)},onPastAndDrop({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=Ii.GetContainer(t);e&&e.container&&e.cover||(this.ready(t),this._fileCheck(this._origin_w,this._origin_h))}}},init(){ys.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.removeAttribute("disabled"),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._openTab("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.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});if(this.anchor.set(Q.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=e.originWidth||e.w||"",this._origin_h=e.originHeight||e.h||"",this.altText.value=this._element.alt,this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=this._element.src),(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=tt.get(s,2),s>100&&(s=100)),this.inputX.value="auto"===s?"":s,!this._onlyPercentage){const t=i?"":e.height;this.inputY.value="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=Q.getParentElement(e,Ii.__is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onImageDeleteBefore",{target:e,container:i,align:this._align,alt:this.altText.value,url:this._linkValue})&&(Q.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?(Q.addClass(this.asInline,"on"),Q.removeClass(this.asBlock,"on"),this.as="inline",this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(Q.addClass(this.asBlock,"on"),Q.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.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.notice.open(e===kl?t:e||t),!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.notice.open(i===kl?t:i||t),!1}const l={files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l),a=await this.triggerEvent("onImageUploadBefore",{...l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==kl||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",{...i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==kl||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=tt.is(t)?t+this.sizeUnit:t,r=tt.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=Ii.CreateCaption(s,this.lang.caption),a=!0):this._caption&&(Q.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&&Q.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))?Ii.CreateInlineContainer(s,"se-image-container"):Ii.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=tt.is(t)?t+this.sizeUnit:t,h=tt.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=Ii.CreateCaption(n,this.lang.caption),c=!0):this._caption&&(Q.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._element=s=l.querySelector("img"),this._cover=n,this._container=l),this._resizing&&i&&this.applySize(t,e),d&&(r?(Q.removeItem(d),0===Q.getListChildren(u,(t=>/IMG/i.test(t.tagName))).length&&Q.removeItem(u)):Q.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)},_openTab(t){const e=this.modal.form,i="init"===t?e.querySelector("._se_tab_link"):t.target;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++)Q.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+s).style.display="block",Q.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,null)},create(t,e,i,s,n,o,l){const r=Q.createElement("IMG");r.src=t,r.alt=l,e=this._setAnchor(r,e?e.cloneNode(!1):null);const a=Ii.CreateContainer(e,"se-image-container"),h=a.cover,c=a.container;this.captionCheckEl.checked&&(this._caption=Ii.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=$l.bind(this,r,this._svgDefaultSize,c),this.component.insert(c,!1,!0)},createInline(t,e,i,s,n,o){const l=Q.createElement("IMG");l.src=t,l.alt=o,e=this._setAnchor(l,e?e.cloneNode(!1):null);const r=Ii.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=$l.bind(this,l,this._svgDefaultSize,r),this.component.insert(r,!1,!0)},_updateSrc(t,e,i){e.src=t,this.fileManager.setFileData(e,i),this.component.select(e,Nl.key,!1)},_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,Ll.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.editor.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=r;const a=[r];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.editor.hideLoading())}.bind(this,h,l,this._element,c,d),h.readAsDataURL(c)}catch(t){throw this.editor.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)=>e?(e.appendChild(t),e):t,async _error(t){const e=await this.triggerEvent("onImageUploadError",{error:t}),i=e===kl?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.image.error]",i)},constructor:Nl};const Fl=Nl,{NO_EVENT:Pl}=Y,Dl=function(t,e){qe.call(this,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&&tt.get(e.defaultWidth,0)?tt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&tt.get(e.defaultHeight,0)?tt.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:tt.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},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.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;if(i.createFileInput&&(s+=`\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${ys.CreateFileInput({lang:t,icons:e},i)}\n\t\t\t</div>`),i.createUrlInput&&(s+=`\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<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>`),i.canResize){const n=i.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],o=i.defaultRatio,l=i.percentageOnlySize,r=l?' style="display: none !important;"':"",a=i.showHeightInput?"":' style="display: none !important;"',h=i.showRatioOption?"":' style="display: none !important;"',c=l||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"${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_video_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_video_size_y" placeholder="${100*i.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-video-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${n.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_video_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}return 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_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>`,Q.createElement("DIV",{class:"se-modal-content"},s)}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["mirror_h","mirror_v","align","revert","edit","remove"]]:[["resize_auto,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["edit","align","revert","remove"]];n.some((t=>t.includes("align")))||(s.querySelector(".se-figure-align").style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";if(this.modal=new ys(this,s),this.figure=new Ii(this,n,{sizeUnit:i,autoRatio:{current:o,default:o}}),this.fileManager=new Qs(this,{query:"iframe, video",loadHandler:this.events.onVideoLoad,eventHandler:this.events.onVideoAction}),this.fileModalWrapper=s.querySelector(".se-flex-input-wrapper"),this.videoInputFile=s.querySelector(".__se__file_input"),this.videoUrlFile=s.querySelector(".se-input-url"),this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=s.querySelector(".se-link-preview"),this._linkValue="",this._align="none",this._videoRatio=o,this._defaultRatio=o,this._defaultSizeX="100%",this._defaultSizeY=100*this.pluginOptions.defaultRatio+"%",this.sizeUnit=i,this.proportion={},this.videoRatioOption={},this.inputX={},this.inputY={},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),J.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),J.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery},this.videoInputFile&&this.eventManager.addEvent(s.querySelector(".se-file-remove"),"click",Ul.bind(this)),this.videoUrlFile&&this.eventManager.addEvent(this.videoUrlFile,"input",Zl.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.eventManager.addEvent(this.videoInputFile,"change",ql.bind(this)),this._resizing){this.proportion=s.querySelector("._se_video_check_proportion"),this.videoRatioOption=s.querySelector(".se-video-ratio"),this.inputX=s.querySelector("._se_video_size_x"),this.inputY=s.querySelector("._se_video_size_y"),this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=Xl.bind(this);this.eventManager.addEvent(this.inputX,"keyup",Yl.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",Yl.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.videoRatioOption,"change",jl.bind(this)),this.eventManager.addEvent(s.querySelector(".se-modal-btn-revert"),"click",Gl.bind(this))}};async function Wl(t,e){if(await this.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Pl){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}function Ul(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),ys.OnChangeFile(this.fileModalWrapper,[])}function Zl(t){const e=t.target.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:""}function ql({target:t}){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),ys.OnChangeFile(this.fileModalWrapper,t.files)}function Gl(){this._onlyPercentage?this.inputX.value=this._origin_w>100?100:this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}function jl(t){const e=t.target.options[t.target.selectedIndex].value;this._defaultSizeY=this.figure.autoRatio.current=this._videoRatio=e?100*e+"%":this._defaultSizeY,this.inputY.placeholder=e?100*e+"%":"",this.inputY.value=""}function Xl(){this._ratio=this.proportion.checked?Ii.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}function Yl(t,e){if(32!==e.keyCode){if("x"===t&&this._onlyPercentage&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=Ii.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=e.h:this.inputX.value=e.w}"y"===t&&this._setVideoRatioSelect(e.target.value||this._defaultRatio)}else e.preventDefault()}Dl.key="video",Dl.type="modal",Dl.className="",Dl.component=function(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.findProcessUrl(t.src)?t:null},Dl.prototype={open(){this.modal.open()},edit(){this.modal.open()},on(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):(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._setVideoRatioSelect(this._origin_h||this._defaultRatio)},onPastAndDrop({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,"video"),0),t},retainFormat(){return{query:"iframe, video",method:t=>{const e=Ii.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(){ys.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.removeAttribute("disabled"),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._setVideoRatioSelect(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=e.width||e.originWidth||e.w||"",this._origin_h=e.height||e.originHeight||e.h||"";let i=e.width||e.w||this._origin_w||"";const s=e.height||e.h||this._origin_h||"";if(this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=this._element.src||(this._element.querySelector("source")||"").src||""),(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=tt.get(i,2),i>100&&(i=100)),this.inputX.value="auto"===i?"":i,!this._onlyPercentage){const t=n?"":e.height;this.inputY.value="auto"===t?"":t}this._setVideoRatioSelect(s)||(this.inputY.value=this._onlyPercentage?tt.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=Q.getParentElement(e,Ii.__is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onVideoDeleteBefore",{target:e,container:i,align:this._align,url:this._linkValue})&&(Q.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))},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=>(/^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=>(t.endsWith("/")&&(t=t.slice(0,-1)),"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},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){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.parentNode.replaceChild(i,t),this._element=t=i}else if(/^video$/i.test(i?.tag)&&!/^video$/i.test(t.nodeName)){const i=this.createVideoTag();i.src=e,t.parentNode.replaceChild(i,t),this._element=t=i}else t.src=e}a=this._container,r=Q.getParentElement(t,"FIGURE")}else{t.src=e,this._element=t;const i=Ii.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._videoRatio;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,!1,!0),!this.options.get("componentAutoSelect")){const t=this.format.addLine(a,null);t&&this.selection.setRange(t,0,t,0)}},createIframeTag(){const t=Q.createElement("IFRAME");return this._setIframeAttrs(t),t},createVideoTag:function(){const t=Q.createElement("VIDEO");return this._setTagAttrs(t),t},_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.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.notice.open(e===Pl?t:e||t),!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.notice.open(i===Pl?t:i||t),!1}const l={url:null,files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l),a=await this.triggerEvent("onVideoUploadBefore",{...l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Pl||r(null)))},async submitURL(t){if(t||(t=this._linkValue),!t)return!1;if(/^<iframe.*\/iframe>$/.test(t)&&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",{...s,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==Pl||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)||Q.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t;t=t.cloneNode(!0);const s=Ii.CreateContainer(t,"se-video-container").container,n=e.querySelector("figcaption");let o=null;n&&(o=Q.createElement("DIV"),o.innerHTML=n.innerHTML,Q.removeItem(n)),this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const l=(t.getAttribute("data-se-size")||",").split(",");this.applySize(l[0]||i.style.width||i.width||"",l[1]||i.style.height||i.height||"");const r=this.format.getLine(i);if(r&&(this._align=r.style.textAlign||r.style.float),this.figure.setAlign(t,this._align),Q.getParentElement(i,Q.isExcludeFormat))i.parentNode.replaceChild(s,i);else if(Q.isListCell(e)){const t=Q.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(s,t),Q.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLineOnly(e)){const t=Q.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(s,e),Q.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.parentNode.replaceChild(s,e);return o&&e.parentNode.insertBefore(o,s.nextElementSibling),t},_register(t,e){const i=e.result,s=this.createVideoTag();for(let e=0,n=i.length;e<n;e++)this.create(t.isUpdate?t.element:s.cloneNode(!1),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,Wl.bind(this,t),this._error.bind(this))},_setTagAttrs(t){t.setAttribute("controls",!0);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])},_setVideoRatioSelect(t){let e=!1;const i=this.videoRatioOption.options;/%$/.test(t)||this._onlyPercentage?t=tt.get(t,2)/100+"":(!tt.is(t)||1*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*t+"%":""):i[s].selected=!1;return e},async _error(t){const e=await this.triggerEvent("onVideoUploadError",{error:t}),i=e===Pl?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.video.error]",e)},constructor:Dl};const Kl=Dl,{NO_EVENT:Jl,ON_OVER_COMPONENT:Ql}=Y,tr=function(t,e){qe.call(this,t),this.title=this.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?tt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?tt.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,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},i){let s=`\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">`;return i.createFileInput&&(s+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${ys.CreateFileInput({lang:t,icons:e},i)}\n </div>`),i.createUrlInput&&(s+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n <input class="se-input-form se-input-url" data-focus type="text" />\n <pre class="se-link-preview"></pre>\n </div>`),s+=`\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>`,Q.createElement("DIV",{class:"se-modal-content"},s)}(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="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 Q.createElement("DIV",{class:"se-controller"},i)}(t);this.modal=new ys(this,i),this.controller=new si(this,s,{position:"bottom",disabled:!0}),this.fileManager=new Qs(this,{query:"audio",loadHandler:this.events.onAudioLoad,eventHandler:this.events.onAudioAction}),this.figure=new Ii(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.defaultWidth=this.pluginOptions.defaultWidth,this.defaultHeight=this.pluginOptions.defaultHeight,this.urlValue="",this._element=null,this.audioInputFile&&(this.eventManager.addEvent(i.querySelector(".se-modal-files-edge-button"),"click",sr.bind(this.audioInputFile,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.eventManager.addEvent(this.audioInputFile,"change",nr.bind(this))),this.audioUrlFile&&this.eventManager.addEvent(this.audioUrlFile,"input",ir.bind(this))};async function er(t,e){if(await this.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===Jl){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}function ir(t){const e=t.target.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:""}function sr(t,e){this.value="",t&&(t.removeAttribute("disabled"),e.style.textDecoration=""),ys.OnChangeFile(this.fileModalWrapper,[])}function nr({target:t}){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration=""),ys.OnChangeFile(this.fileModalWrapper,t.files)}tr.key="audio",tr.type="modal",tr.className="",tr.component=function(t){return/^AUDIO$/i.test(t?.nodeName)?t:null},tr.prototype={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")},onPastAndDrop({file:t}){if(/^audio/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1},modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.urlValue.length>0)&&this.submitURL(this.urlValue)},init(){ys.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},controllerAction(t){/update/.test(t.getAttribute("data-command"))?(this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src),this.open()):this.destroy()},retainFormat(){return{query:"audio",method:t=>{const e=Ii.GetContainer(t);if(e&&e.container&&e.cover)return;this._setTagAttrs(t);const i=Ii.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(i.container,t,null)}}},select(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1}),this.ready(t)},ready(t){zt.get("__overInfo")!==Ql&&(this._element=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))},async destroy(t){t=t||this._element;const e=Ii.GetContainer(t),i=e.container||t,s=i.previousElementSibling||i.nextElementSibling;if(!1===await this.triggerEvent("onAudioDeleteBefore",{target:t,container:e,url:t.getAttribute("src")}))return;const n=i.parentNode;Q.removeItem(i),this.init(),this.controller.close(),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)},_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.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.notice.open(e===Jl?t:e||t),!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.notice.open(i===Jl?t:i||t),!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",{...o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==Jl||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",{...i,handler:s});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==Jl||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,tr.key,!1);t.src=e,this.component.select(t,tr.key,!1)}else{this.fileManager.setFileData(t,i),t.src=e;const s=Ii.CreateContainer(t,"se-flex-component");if(!this.component.insert(s.container,!1,!this.options.get("componentAutoSelect")))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=Q.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this._setTagAttrs(i),i},_setTagAttrs(t){t.setAttribute("controls",!0);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,er.bind(this,t),this._error.bind(this))},async _error(t){const e=await this.triggerEvent("onAudioUploadError",{error:t}),i=e===Jl?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.audio.error]",i)},constructor:tr};const or=tr,lr=function(t,e){this.katex=null,this.mathjax=null,(this.katex=function(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}(t.options.get("externalLibs").katex))||(this.mathjax=function(t){if(!t)return null;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."),null}}(t.options.get("externalLibs").mathjax))||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option.'),qe.call(this,t),this.title=this.lang.math,this.icon="math";const i=function({lang:t,icons:e},i,s,n){const o=s||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}];let l=o[0].value,r=`\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.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${t.math_modal_inputLabel} ${n?`(<a href="${Y.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${Y.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp" type="text" data-focus></textarea>\n </div>\n <div class="se-modal-form">\n <label>${t.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,i=o.length;e<i;e++)t=o[e],t.default&&(l=t.value),r+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return r+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${t.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="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,i.defaultFontSize=l,Q.createElement("DIV",{class:"se-modal-content"},r)}(t,this,e.fontSizeList,this.katex),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 Q.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t);this.modal=new ys(this,i),this.controller=new si(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",rr.bind(this)),this.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style))};function rr(t){this.previewElement.innerHTML=this._renderer(t.target.value),this.mathjax&&ar(this.mathjax)}function ar(t){t.clear(),t.updateDocument()}function hr(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}lr.key="math",lr.type="modal",lr.className="",lr.component=function(t){return Q.hasClass(t,"se-math|katex")&&Q.hasClass(t,"se-component")?t:null},lr.prototype={select(t){if(Q.hasClass(t,"se-math|katex")&&hr(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=hr(t);if(!e)return;const i=this._d.createRange().createContextualFragment(this._renderer(J.entityToHTML(this._escapeBackslashes(e,!0))));t.innerHTML=i.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable",!1),Q.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?Q.addClass(t,"katex"):Q.removeClass(t,"katex"),this.mathjax&&ar(this.mathjax)}}},open(){this.modal.open()},on(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=J.entityToHTML(this._escapeBackslashes(hr(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||Q.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(Q.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable",!1),e.setAttribute("data-se-value",J.htmlToEntity(this._escapeBackslashes(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(Q.addClass(e,"katex"),Q.removeClass(e,"MathJax")):Q.removeClass(e,"katex"),this.isUpdateState){const t=Q.getParentElement(this.controller.currentTarget,".se-component");t.parentNode.replaceChild(e,t);const i=this.component.get(e);return this.component.select(i.target,i.pluginName,!1),!0}{const t=this.format.getLines();if(t.length>1){const i=Q.createElement(t[0].nodeName,null,e);this.component.insert(i,!1,!0)}else this.component.insert(e,!1,!0)}this.mathjax&&ar(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,lr.key,!1),!0},init(){this.textArea.value="",this.previewElement.innerHTML="",Q.removeClass(this.textArea,"se-error")},controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":!async function(t){if(navigator.clipboard&&t)try{const e=hr(t);await navigator.clipboard.writeText(e),Q.addClass(t,"se-copy"),Y._w.setTimeout((()=>{Q.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}(this._element);break;case"delete":this.destroy(this.controller.currentTarget)}},destroy(t){Q.removeItem(t),this.controller.close(),this.editor.focus(),this.history.push(!1)},_renderer(t){let e="";try{Q.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)?(Q.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`)}catch(t){Q.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${Y.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${Y.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e},_escapeBackslashes:(t,e)=>t.replace(/\\{2}/g,e?"\\":"\\\\"),constructor:lr};const cr=lr,dr=function(t,e){Ot.call(this,t.editor);const i=Q.createElement("DIV",{class:"se-file-browser sun-editor-common"}),s=Q.createElement("DIV",{class:"se-file-browser-inner"},function({lang:t,icons:e}){return`\n\t\t<div class="se-file-browser-content">\n\t\t\t<div class="se-file-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-file-browser-close" class="close" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-file-browser-title"></span>\n\t\t\t\t<div class="se-file-browser-tags"></div>\n\t\t\t</div>\n\t\t\t<div class="se-file-browser-body">\n\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t<div class="se-file-browser-list"></div>\n\t\t\t</div>\n\t\t</div>`}(t.editor));this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.area=i,this.header=s.querySelector(".se-file-browser-header"),this.titleArea=s.querySelector(".se-file-browser-title"),this.tagArea=s.querySelector(".se-file-browser-tags"),this.body=s.querySelector(".se-file-browser-body"),this.list=s.querySelector(".se-file-browser-list"),this._loading=s.querySelector(".se-loading-box"),this.title=e.title,this.listClass=e.listClass,this.url=e.url,this.urlHeader=e.headers,this.drawItemHandler=e.drawItemHandler,this.selectorHandler=e.selectorHandler,this.columnSize=e.columnSize||4,this.items=[],this.selectedTags=[],this._closeSignal=!1,this._bindClose=null,this.__globalEventHandler=t=>{/27/.test(t.keyCode)&&this.close()},this.apiManager=new Gs(this,{method:"GET"}),i.appendChild(Q.createElement("DIV",{class:"se-file-browser-back"})),i.appendChild(s),this.carrierWrapper.appendChild(i),this.eventManager.addEvent(this.tagArea,"click",gr.bind(this)),this.eventManager.addEvent(this.list,"click",mr.bind(this)),this.eventManager.addEvent(s,"mousedown",fr.bind(this)),this.eventManager.addEvent(s,"click",_r.bind(this))};function ur(t){try{const e=JSON.parse(t.responseText);e.result.length>0?this._drawListItem(e.result,!0):e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.fileBrowser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading(),this.body.style.maxHeight=Q.getClientSize().h-this.header.offsetHeight-50+"px"}}function pr(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.fileBrowser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}function gr(t){const e=t.target;if(!Q.isAnchor(e))return;const i=e.textContent,s=this.tagArea.querySelector('a[title="'+i+'"]'),n=this.selectedTags,o=n.indexOf(i);o>-1?(n.splice(o,1),Q.removeClass(s,"on")):(n.push(i),Q.addClass(s,"on")),this._drawListItem(0===n.length?this.items:this.items.filter((function(t){return t.tag.some((function(t){return n.includes(t)}))})),!1)}function mr(t){if(t.preventDefault(),t.stopPropagation(),t.target===this.list)return;const e=Q.getCommandTarget(t.target);e&&(this.close(),this.selectorHandler(e))}function fr(t){/se-file-browser-inner/.test(t.target.className)?this._closeSignal=!0:this._closeSignal=!1}function _r(t){t.stopPropagation(),(/close/.test(t.target.getAttribute("data-command"))||this._closeSignal)&&this.close()}dr.prototype={open(t){t||(t={}),this.__addGlobalEvent();const e=t.listClass||this.listClass;Q.hasClass(this.list,e)||(this.list.className="se-file-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this._drawFileList(t.url||this.url,t.urlHeader||this.urlHeader)},close(){this.__removeGlobalEvent(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="","function"==typeof this.inst.init&&this.inst.init()},showBrowserLoading(){this._loading.style.display="block"},closeBrowserLoading(){this._loading.style.display="none"},_drawFileList(t,e){this.apiManager.call({method:"GET",url:t,headers:e,callBack:ur.bind(this),errorCallBack:pr.bind(this)}),this.showBrowserLoading()},_drawListItem(t,e){const i=[],s=t.length,n=this.columnSize,o=n<=1?1:Math.round(s/n)||1,l=this.drawItemHandler;let r="",a='<div class="se-file-item-column">',h=1;for(let c,d,u=0;u<s;u++)if(c=t[u],d=c.tag?"string"==typeof c.tag?c.tag.split(","):c.tag:[],d=c.tag=d.map((function(t){return t.trim()})),a+=l(c),(u+1)%o==0&&h<n&&u+1<s&&(h++,a+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,s=d.length;e<s;e++)t=d[e],t&&!i.includes(t)&&(i.push(t),r+=`<a title="${t}" aria-label="${t}">${t}</a>`);a+="</div>",this.list.innerHTML=a,e&&(this.items=t,this.tagArea.innerHTML=r)},__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler,!0)},__removeGlobalEvent(){this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))},constructor:dr};const br=dr,vr=function(t,e){qe.call(this,t),this.title=this.lang.imageGallery,this.icon="image_gallery",this.fileBrowser=new br(this,{title:this.lang.imageGallery,url:e.url,headers:e.headers,listClass:"se-image-list",drawItemHandler:yr,selectorHandler:Cr.bind(this),columnSize:4}),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};function yr(t){const e=t.src.split("/").pop();return`\n\t\t<div class="se-file-item-img">\n\t\t\t<img \n\t\t\t\tsrc="${t.thumbnail||t.src}" \n\t\t\t\talt="${t.alt||e}" \n\t\t\t\tdata-command="${t.src||t.thumbnail}" \n\t\t\t\tdata-value="${t.name||e}">\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>`}function Cr(t){if(this.inputTarget)this.inputTarget(t);else{const e={name:t.getAttribute("data-value"),size:0};this.plugins.image.init(),this.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt)}}vr.key="imageGallery",vr.type="fileBrowser",vr.className="",vr.prototype={open(t){this.inputTarget=t,this.fileBrowser.open()},close(){this.inputTarget=null,this.fileBrowser.close()},constructor:vr};const wr=vr,xr={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]}},Er=function(t,e){qe.call(this,t),this.unitMap={...xr,...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>",Q.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.beforeButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Er.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.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Er.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=Q.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":Er.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:Er.key,type:"dropdown"},i)):(this.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Er.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:Er.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this._disableInput=n,this.menu.initDropdownTarget(Er,i)};Er.key="fontSize",Er.type="input",Er.className="se-btn-select se-btn-input se-btn-tool-font-size",Er.prototype={active(t,e){if(!Q.hasClass(e,"__se__font_size"))return!1;if(t){if(t?.style.fontSize.length>0)return this._setSize(e,t.style.fontSize),!0}else this._setSize(e,this._getDefaultSize());return!1},onInputKeyDown({target:t,event:e}){const i=e.keyCode;if(this._disableInput||32===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=this.unitMap[n];let l=s;switch(i){case 38:l+=o.inc,l>o.max&&(l=s);break;case 40:l-=o.inc,l<o.min&&(l=s)}e.preventDefault();try{this.isInputActive=!0;const e=this._setSize(t,l+n);if(this._disableInput)return;const s=Q.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(s,["font-size"],null,null),13!==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=Q.createElement("SPAN",{style:"font-size: "+this._setSize(t,i+s)+";"});this.format.applyInlineElement(l,["font-size"],null,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")?Q.addClass(n[t],"active"):Q.removeClass(n[t],"active");this.currentSize=s},action(t){const e=t.getAttribute("data-command");if(e===Er.key){const{value:e,unit:i}=this._getSize(t);let s=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=Q.createElement("SPAN",{style:"font-size: "+s+i+";"});this.format.applyInlineElement(l,["font-size"],null,null)}else if(e){const t=Q.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(t,["font-size"],null,null)}else this.format.applyInlineElement(null,["font-size"],["span"],!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:/^INPUT$/i.test(t.nodeName)?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;let n=i.pop();return n=s?1*n:n,{unit:s,value:n}},_setSize(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?/^INPUT$/i.test(t.nodeName)?t.value=e:t.textContent=this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e:0},constructor:Er};const Sr=Er,{_w:Tr}=Y,kr=function(t){qe.call(this,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 Q.createElement("DIV",{class:"se-controller se-controller-link"},i)}(this);this.displayId=i.querySelector(".se-controller-display"),this.controllerSelect=new si(this,i,{position:"bottom",disabled:!0},this.kind);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 Q.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.inputEl=s.querySelector("input"),this.controller=new si(this,s,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},this.kind)};kr.key="anchor",kr.type="popup",kr.component=function(t){return Q.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null},kr.className="",kr.prototype={show(){this.controller.open(this._range=this.selection.getRange()),Tr.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)switch(e){case"submit":if(this._element)this._element.id=this.inputEl.value,this.select(this._element);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=Q.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,!1,!0);const i=this.selection.getNearRange(e);i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,kr.key,!1),this.init()}break;case"cancel":this.controller.close(!this._element),this._range&&this.selection.setRange(this._range);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controller.open(this._element);break;case"delete":{const t=this.selection.getNearRange(this._element);Q.removeItem(this._element),this.controllerSelect.close(!0),t&&this.selection.setRange(t.container,t.offset,t.container,t.offset);break}}},init(){this._element=null,this._range=null,this.inputEl.value="",this.displayId.textContent=""},constructor:kr};const Nr=qe,Lr={blockquote:Us,exportPdf:Ys,fileUpload:nn,list_bulleted:ln,list_numbered:hn,mention:pn,align:mn,font:_n,fontColor:mo,backgroundColor:_o,list:Co,table:Qo,formatBlock:el,hr:vo,layout:sl,lineHeight:ol,template:rl,paragraphStyle:hl,textStyle:dl,link:Tl,image:Fl,video:Kl,audio:or,math:cr,imageGallery:wr,fontSize:Sr,anchor:kr},Hr={_DragHandle:zt,ApiManager:Gs,ColorPicker:po,Controller:si,FileBrowser:br,FileManager:Qs,HueSlider:so,Figure:Ii,Modal:ys,ModalAnchorEditor:El,SelectMenu:ui},Mr=et,Ar={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({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 Ds(s,e)}};i("+qkj"),i("JybH"),Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Ar,editorInjector:Nr,plugins:Lr,modules:Hr,helper:Mr}})})()})();
|
|
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",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",edit:"Edit",exportPdf:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",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",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",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",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width"};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=t.navigator.userAgent.toLowerCase();function l(t){return"string"==typeof t?t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())):t.map((function(t){return l(t)}))}const r="function"==typeof ResizeObserver,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=!!window.chrome,p=o.includes("applewebkit/")&&!o.includes("chrome"),g=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(o)||"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,m=o.includes("android"),f=h?"⌘":"CTRL",_=h?"⇧":"+SHIFT",b=t.devicePixelRatio,v={_w:t,_d:e,NO_EVENT:s,ON_OVER_COMPONENT:n,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)}))},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=0===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:r,isEdge:a,isBlink:c,isGecko:d,isChromium:u,isSafari:p,isOSX_IOS:h,isAndroid:m,isMobile:g,cmdIcon:f,shiftIcon:_,DPI:b,_allowedEmptyNodeList:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details",KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},y=8203,C=String.fromCharCode(y),w=new RegExp(String.fromCharCode(y),"g"),x=new RegExp("^"+String.fromCharCode(y)+"+$");const E=/https?:\/\/[^\s]+/g,S={"xx-small":1,"x-small":2,small:3,medium:4,large:5,"x-large":6,"xx-large":7,"xxx-large":8};function T(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const k={htmlToEntity:function(t){const e={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,(t=>"string"==typeof e[t]?e[t]:t))},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=setTimeout((()=>{t.clearTimeout(s),e(...n)}),i)}},fontSize:function(t,e){const i=e.match(/(\d+(?:\.\d+)?)(.+)/),s=i?1*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*(.0625*o).toFixed(2)+t;case"pt":return Math.floor(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[t[i]]=i);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:T,rgb2hex:function(t){if(T(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""},getWidthInPercentage:function(e,i){const s=i||e.parentElement,n=t.getComputedStyle(s),o=t.parseFloat(n.paddingLeft),l=t.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;i.replace(E,((t,o)=>{o>0&&s.appendChild(e.createTextNode(i.slice(0,o)));const l=e.createElement("a");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.parentNode.replaceChild(s,t)}},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>":""}};function N(t){return null!=t&&("string"!=typeof t&&(t=t.textContent),""===t||x.test(t))}function L(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 H(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function M(t,e,i){const s=[];let n=!0;return V(t,(t=>{if(t===e&&(n=!1),n&&!D(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,z(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,z(e)}s.push(t)}return!1})),s.map(H).reverse()}function A(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 B(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 I(t){if(!t||D(t))return-1;let e=0;for(t=t.parentNode;t&&!D(t);)e+=1,t=t.parentNode;return e}function V(t,e){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=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="^"+e+"$");const s=new RegExp(e,"i");i=function(e){return s.test(e[t])}}for(;t&&!i(t);){if(D(t))return null;t=t.parentNode}return t}function R(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 O(t,e,i){if(e.style.cssText){const i=e.style;for(let e=0,s=i.length;e<s;e++)t.style[i[e]]=i[i[e]]}const s=e.attributes;for(let e,n=0,o=s.length;n<o;n++)e=s[n].name.toLowerCase(),i?.includes(e)||!s[n].value?t.removeAttribute(e):"style"!==e&&t.setAttribute(s[n].name,s[n].value)}function z(t){t&&("function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))}function $(t,e){if(!t)return;return new RegExp(`(\\s|^)${e}(\\s|$)`).test(t.className)}function F(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(const t of i)if(t&&1===t.nodeType)for(const e of s)e&&t.classList.add(e)}function P(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(const t of i)if(t&&1===t.nodeType)for(const e of s)e&&t.classList.remove(e)}function D(t){return 1===t?.nodeType&&($(t,"se-wrapper-wysiwyg|sun-editor-carrier-wrapper")||/^BODY$/i.test(t.nodeName))}function W(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")}function U(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)}function Z(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function q(t){return t.hasAttribute("data-important-disabled")}function G(t=e){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const j={isZeroWith:N,createElement:L,createTextNode:function(t){return e.createTextNode(t||"")},getIframeDocument:function(t){let e=t.contentWindow||t.contentDocument;return e.document&&(e=e.document),e},getAttributesToString:function(t,e){if(!t.attributes)return"";const i=t.attributes;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},getPositionIndex:H,getNodePath:M,getNodeFromPath:A,getListChildren:function(t,e){const i=[];return t&&t.children&&0!==t.children.length?(e=e||function(){return!0},function s(n){if(t!==n&&e(n)&&i.push(n),n.children)for(let t=0,e=n.children.length;t<e;t++)s(n.children[t])}(t),i):i},getListChildNodes:B,getNodeDepth:I,sortNodeByDepth:function(t,e){const i=e?1:-1,s=-1*i;t.sort((function(t,e){return U(t)&&U(e)?(t=I(t))>(e=I(e))?i:t<e?s:0:0}))},compareElements:function(t,e){let i=t,s=e;for(;i&&s&&i.parentNode!==s.parentNode;)i=i.parentNode,s=s.parentNode;if(!i||!s)return{ancestor:null,a:t,b:e,result:0};const n=i.parentNode.childNodes,o=R(n,i),l=R(n,s);return{ancestor:i.parentNode,a:i,b:s,result:o>l?1:o<l?-1:0}},getParentElement:V,getParentElements:function(t,e){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=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="^"+e+"$");const s=new RegExp(e,"i");i=function(e){return s.test(e[t])}}const s=[];for(;t&&!D(t);)i(t)&&s.push(t),t=t.parentNode;return s},getCommandTarget:function(t){for(;!/^(UL|DIV)$/i.test(t.tagName);){if(t.hasAttribute("data-command"))return t;t=t.parentNode}return null},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=B(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(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!Z(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getArrayItem:function(t,e,i){if(!t||0===t.length)return null;e=e||function(){return!0};const s=[];for(let n,o=0,l=t.length;o<l;o++)if(n=t[o],e(n)){if(!i)return n;s.push(n)}return i?s:null},arrayIncludes:function(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},getArrayIndex:R,nextIndex:function(t,e){const i=R(t,e);return-1===i?-1:i+1},prevIndex:function(t,e){const i=R(t,e);return-1===i?-1:i-1},copyTagAttributes:O,copyFormatAttributes:function(t,e){(e=e.cloneNode(!1)).className=e.className.replace(/(\s|^)__se__format__[^\s]+/g,""),O(t,e)},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.style,s=e.style;let n=0;for(let t=0,e=i.length;t<e;t++)i[i[t]]===s[i[t]]&&n++;const o=t.classList,l=e.classList,r=RegExp;let a=0;for(let t=0,e=o.length;t<e;t++)r("(s|^)"+o[t]+"(s|$)").test(l.value)&&a++;return n===s.length&&n===i.length&&a===l.length&&a===o.length},removeItem:z,changeElement:function(t,e){if(t)if("string"==typeof e)if(t.outerHTML)t.outerHTML=e;else{const i=L("DIV");i.innerHTML=e,e=i.firstChild,t.parentNode.replaceChild(e,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,i||s.style.cssText||s.removeAttribute("style")},setDisabled:function(t,e,i){for(let s=0,n=t.length;s<n;s++){const n=t[s];!i&&q(n)||(n.disabled=e),i&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:$,addClass:F,removeClass:P,toggleClass:function(t,e){if(!t)return;if(1!==t.nodeType)return;let i=!1;const s=new RegExp(`(\\s|^)${e}(\\s|$)`);return s.test(t.className)?t.className=t.className.replace(s," ").trim():(t.className+=" "+e,i=!0),t.className.trim()||t.removeAttribute("class"),i},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},isWysiwygFrame:D,isNonEditable:W,isList:function(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)},isListCell:U,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:Z,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)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isInputElement:function(t){return 1===t?.nodeType&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isEmptyLine:function(t){return!t?.parentNode||!t.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&0===t.children.length&&N(t.textContent)},isSpanWithoutAttr:function(t){return 1===t?.nodeType&&/^SPAN$/i.test(t.nodeName)&&!t.className&&!t.style.cssText},isUneditable:function(t){return $(t,"__se__uneditable")},isImportantDisabled:q,isExcludeFormat:function(t){return/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/.test(t?.className)},getScrollParent:function t(e){return!e||/^(body|html)$/i.test(e.nodeName)?null:e.scrollHeight>e.clientHeight?e:t(e.parentNode)},getClientSize:G,getViewportSize:function(){return"visualViewport"in t?{top:t.visualViewport.pageTop,left:t.visualViewport.pageLeft,scale:t.visualViewport.scale}:{top:0,left:0,scale:1}},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(W(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(W(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)for(const e of l.childNodes)if(t(e),o)return}(t),n},findTabEndIndex:function(t,e,i){if(!t)return 0;const s=t.innerText,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},applyInlineStylesAll:function(i,s,n){if(!i)return console.warn('"parentTarget" is not exist'),null;const o=e.createElement("DIV");if(o.style.display="none",/body/i.test(i.nodeName)){const t=e.createElement("DIV"),s=i.attributes;for(let e=0,i=s.length;e<i;e++)t.setAttribute(s[e].name,s[e].value);t.innerHTML=i.innerHTML,i=t}else i=i.cloneNode(!0);o.appendChild(i),e.body.appendChild(o);const l=i.querySelectorAll("*");for(let e,i=s?0:1;e=l[i];i++){const i=t.getComputedStyle(e);for(const t of n||i)e.style[t]=i.getPropertyValue(t)||""}return e.body.removeChild(o),i}};function X(t,e){if(!t)return 0;let i=(t+"").match(/-?\d+(\.\d+)?/);return i&&i[0]?(i=i[0],e<0?1*i:0===e?Math.round(1*i):1*(1*i).toFixed(e)):0}const Y=v,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")}},J=k,Q=j,tt={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:X,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)}},et={env:Y,unicode:K,converter:J,domUtils:Q,numbers:tt},it={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 11.76 15.75"><g><path d="M6.4,3.76V19.5h6.76a5.55,5.55,0,0,0,2-.32,4.93,4.93,0,0,0,1.52-1,4.27,4.27,0,0,0,1.48-3.34,3.87,3.87,0,0,0-.69-2.37,5.74,5.74,0,0,0-.71-.83,3.44,3.44,0,0,0-1.1-.65,3.6,3.6,0,0,0,1.58-1.36,3.66,3.66,0,0,0,.53-1.93,3.7,3.7,0,0,0-1.21-2.87,4.65,4.65,0,0,0-3.25-1.1H6.4Zm2.46,6.65V5.57h3.52a4.91,4.91,0,0,1,1.36.15,2.3,2.3,0,0,1,.85.45,2.06,2.06,0,0,1,.74,1.71,2.3,2.3,0,0,1-.78,1.92,2.54,2.54,0,0,1-.86.46,4.7,4.7,0,0,1-1.32.15H8.86Zm0,7.27V12.15H12.7a4.56,4.56,0,0,1,1.38.17,3.43,3.43,0,0,1,.95.49,2.29,2.29,0,0,1,.92,2,2.73,2.73,0,0,1-.83,2.1,2.66,2.66,0,0,1-.83.58,3.25,3.25,0,0,1-1.26.2H8.86Z" transform="translate(-6.4 -3.75)"/></g></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.49 15.76"><g><path d="M17.16,3.79l.37,0-.06.38-.14.52A10,10,0,0,1,16.21,5a9.37,9.37,0,0,0-1,.32,6.68,6.68,0,0,0-.25.89c-.06.31-.11.59-.14.85-.3,1.36-.52,2.41-.68,3.14l-.61,3.18L13.1,15l-.43,2.4-.12.46a.62.62,0,0,0,0,.28c.44.1.85.17,1.23.22l.68.11a4.51,4.51,0,0,1-.08.6l-.09.42a.92.92,0,0,0-.23,0l-.43,0a1.37,1.37,0,0,1-.29,0c-.13,0-.63-.08-1.49-.16l-2,0c-.28,0-.87,0-1.78.12L7,19.5l.17-.88.8-.2A6.61,6.61,0,0,0,9.19,18,2.62,2.62,0,0,0,9.61,17l.28-1.41.58-2.75.12-.66c.05-.3.11-.58.17-.86s.12-.51.17-.69l.12-.48.12-.43.31-1.6.15-.65.31-1.91V5.14a3.86,3.86,0,0,0-1.48-.29l-.38,0,.2-1.06,3.24.14.75,0c.45,0,1.18,0,2.18-.09.23,0,.46,0,.71,0Z" transform="translate(-7.04 -3.76)"/></g></svg>',strike:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.9"><g><path d="M12.94,13a4.27,4.27,0,0,1,1.32.58,1.46,1.46,0,0,1,.55,1.2,1.87,1.87,0,0,1-.88,1.64,4.17,4.17,0,0,1-2.35.59,4.44,4.44,0,0,1-2.74-.71,2.72,2.72,0,0,1-1-2.17H5.57a4.56,4.56,0,0,0,1.55,3.7,7,7,0,0,0,4.47,1.23,6,6,0,0,0,4.07-1.3,4.24,4.24,0,0,0,1.52-3.37,4,4,0,0,0-.26-1.4h-4ZM6.37,10.24A3.27,3.27,0,0,1,6,8.68a4,4,0,0,1,1.48-3.3,5.92,5.92,0,0,1,3.88-1.21,5.58,5.58,0,0,1,3.91,1.24,4.36,4.36,0,0,1,1.45,3.17H14.44a2.12,2.12,0,0,0-.91-1.81,4.45,4.45,0,0,0-2.44-.55,3.69,3.69,0,0,0-2,.51A1.64,1.64,0,0,0,8.3,8.22a1.3,1.3,0,0,0,.48,1.11,7,7,0,0,0,2.1.78l.28.06.28.08H6.37Zm13.09.68a.73.73,0,0,1,.49.21.66.66,0,0,1,.2.48.64.64,0,0,1-.2.48.71.71,0,0,1-.49.19H5.1a.67.67,0,0,1-.49-.19.66.66,0,0,1-.2-.48.64.64,0,0,1,.2-.48.73.73,0,0,1,.49-.21H19.46Z" transform="translate(-4.41 -4.17)"/></g></svg>',subscript:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 14.61"><g><path d="M15.38,4.33H12.74L11.19,7c-.28.46-.51.87-.69,1.21L10.07,9h0l-.44-.8c-.22-.4-.45-.81-.71-1.23L7.34,4.33H4.68L8.26,10,4.4,16.08H7.1l1.69-2.83c.38-.63.72-1.22,1-1.78l.25-.46h0l.49.92c.24.45.48.89.74,1.32L13,16.08h2.61L11.84,10l1.77-2.84,1.77-2.85Zm4.77,13.75H17v-.15c0-.4.05-.64.16-.72a4.42,4.42,0,0,1,1.16-.31,3.3,3.3,0,0,0,1.54-.56A1.84,1.84,0,0,0,20.15,15a1.78,1.78,0,0,0-.44-1.41A2.8,2.8,0,0,0,18,13.25a2.71,2.71,0,0,0-1.69.37,1.83,1.83,0,0,0-.44,1.43v.23H17v-.23q0-.63.18-.78a1.62,1.62,0,0,1,.88-.15,1.59,1.59,0,0,1,.88.15q.18.15.18.75t-.18.75a3.58,3.58,0,0,1-1.18.33,3.33,3.33,0,0,0-1.52.51,1.57,1.57,0,0,0-.32,1.18v1.15h4.27v-.86Z" transform="translate(-4.4 -4.33)"/></g></svg>',superscript:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.42"><g><path d="M12,13.14l3.61-5.81H12.94L11.33,10c-.28.46-.51.88-.69,1.25l-.45.83h0l-.45-.85c-.22-.41-.45-.82-.71-1.24L7.4,7.33H4.68l3.66,5.81L4.4,19.33H7.14l1.74-2.87q.58-1,1-1.83l.25-.48h0l.51.94.75,1.37,1.72,2.87h2.67l-1.92-3.09c-1.12-1.8-1.76-2.83-1.92-3.1Zm4.84-4.41h0l0,.15h3.27v.86H15.77V8.58a1.66,1.66,0,0,1,.33-1.22,3.51,3.51,0,0,1,1.56-.51,3.68,3.68,0,0,0,1.21-.34c.13-.1.19-.36.19-.77S19,5.07,18.87,5A1.63,1.63,0,0,0,18,4.8a1.58,1.58,0,0,0-.91.17c-.13.11-.19.38-.19.8V6H15.78V5.76a1.87,1.87,0,0,1,.45-1.47A2.84,2.84,0,0,1,18,3.91a2.8,2.8,0,0,1,1.72.38,1.84,1.84,0,0,1,.45,1.44,1.91,1.91,0,0,1-.34,1.35,3.24,3.24,0,0,1-1.58.57A3.69,3.69,0,0,0,17,8c-.12.1-.17.35-.17.76Z" transform="translate(-4.4 -3.91)"/></g></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.84 22.73L16.29 18.18C15.2 19.3 13.69 20 12 20C8.69 20 6 17.31 6 14C6 12.67 6.67 11.03 7.55 9.44L1.11 3L2.39 1.73L22.11 21.46L20.84 22.73M18 14C18 10 12 3.25 12 3.25S10.84 4.55 9.55 6.35L17.95 14.75C18 14.5 18 14.25 18 14Z" /></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M4.68,14.45a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V9.1a.27.27,0,0,1,.08-.19.28.28,0,0,1,.2-.08.25.25,0,0,1,.19.07l2.54,2.54a.29.29,0,0,1,0,.4L4.88,14.36a.24.24,0,0,1-.2.09Zm15.19,1.12a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87Zm0-3.38a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm0-3.37a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm.2-3.29a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',outdent:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.36"><g><path d="M19.87,15.57a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.25.25,0,0,1-.08-.19V15.84a.27.27,0,0,1,.27-.27H19.87ZM7.5,14.45a.25.25,0,0,1-.2-.09L4.76,11.84a.29.29,0,0,1,0-.4L7.3,8.9a.29.29,0,0,1,.4,0,.31.31,0,0,1,.07.2v5.06a.32.32,0,0,1-.08.21.26.26,0,0,1-.19.08ZM19.87,8.82a.27.27,0,0,1,.19.08.25.25,0,0,1,.08.19v1.69a.27.27,0,0,1-.08.19.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.27-.27V9.1a.27.27,0,0,1,.27-.27h9.56Zm0,3.37a.27.27,0,0,1,.19.08.28.28,0,0,1,.08.21v1.68a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H10.31a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V12.48a.32.32,0,0,1,.08-.21.24.24,0,0,1,.19-.08h9.56Zm.2-6.66a.28.28,0,0,1,.08.2V7.41a.32.32,0,0,1-.08.21.25.25,0,0,1-.19.08H4.68a.27.27,0,0,1-.19-.08.3.3,0,0,1-.08-.21V5.73a.32.32,0,0,1,.08-.21.25.25,0,0,1,.19-.08H19.87a.28.28,0,0,1,.2.09Z" transform="translate(-4.41 -5.44)"/></g></svg>',expansion:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M11.8,13.06l-5.1,5.1H9.51V19.5H4.41V14.4H5.75v2.81L8.3,14.66q2.25-2.23,2.55-2.55Zm8.35-9.3v5.1H18.81V6.05l-5.1,5.1-1-1,5.1-5.1H15.05V3.76Z" transform="translate(-4.41 -3.76)"/></g></svg>',reduction:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M14.91,10h2.87v1.38H12.55V6.12h1.38V9l5.24-5.24.48.49.49.48ZM6.77,11.92H12v5.23H10.62V14.26L5.37,19.5l-1-1L9.63,13.3H6.77Z" transform="translate(-4.4 -3.76)"/></g></svg>',code_view:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 11.8"><g><path d="M8.09,7.94a.76.76,0,0,1,.53.22.72.72,0,0,1,.21.52.76.76,0,0,1-.22.54L6.18,11.63l2.43,2.44a.69.69,0,0,1,.2.51.66.66,0,0,1-.21.51.75.75,0,0,1-.51.22.63.63,0,0,1-.51-.21h0L4.63,12.15a.7.7,0,0,1-.22-.53.67.67,0,0,1,.25-.55L7.57,8.16a.82.82,0,0,1,.52-.22Zm12.05,3.69a.7.7,0,0,1-.23.52L17,15.1h0a.66.66,0,0,1-.51.21.73.73,0,0,1-.51-.22.75.75,0,0,1-.22-.51.63.63,0,0,1,.21-.51l2.43-2.44L15.92,9.22a.73.73,0,0,1-.22-.53A.74.74,0,0,1,17,8.18h0l2.91,2.91a.67.67,0,0,1,.27.54Zm-5.9-5.9a.73.73,0,0,1,.61.32.71.71,0,0,1,.07.68L11,17a1,1,0,0,1-.22.32.6.6,0,0,1-.35.16.75.75,0,0,1-.69-.26.69.69,0,0,1-.12-.72L13.56,6.23a.75.75,0,0,1,.26-.35.74.74,0,0,1,.42-.15Z" transform="translate(-4.41 -5.73)"/></g></svg>',preview:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.65 15.66"><g><path d="M16.19,14.43l2.49,2.49a.73.73,0,0,1,.21.52.67.67,0,0,1-.22.51.7.7,0,0,1-.52.22.69.69,0,0,1-.51-.21l-2.49-2.48a5.17,5.17,0,0,1-1.34.69,4.64,4.64,0,0,1-1.48.24,4.78,4.78,0,1,1,0-9.56,4.79,4.79,0,0,1,1.84.36,4.9,4.9,0,0,1,1.56,1,4.77,4.77,0,0,1,.46,6.18ZM10,14a3.3,3.3,0,0,0,2.34.93A3.37,3.37,0,0,0,14.7,14a3.3,3.3,0,0,0-1.08-5.41,3.47,3.47,0,0,0-2.56,0A3,3,0,0,0,10,9.28,3.31,3.31,0,0,0,10,14ZM16,4a3.86,3.86,0,0,1,2.77,1.14A3.9,3.9,0,0,1,20,7.85v4a.77.77,0,0,1-.22.53.7.7,0,0,1-.52.21.72.72,0,0,1-.74-.74v-4a2.46,2.46,0,0,0-.72-1.73A2.37,2.37,0,0,0,16,5.45H8.53A2.42,2.42,0,0,0,6.08,7.89v7.52a2.41,2.41,0,0,0,.71,1.73,2.46,2.46,0,0,0,1.74.72h4.08a.73.73,0,0,1,0,1.46H8.53a3.85,3.85,0,0,1-2.78-1.14A3.93,3.93,0,0,1,4.6,15.4V7.87A3.94,3.94,0,0,1,5.76,5.09,3.88,3.88,0,0,1,8.54,4H16Z" transform="translate(-4.45 -3.8)"/></g></svg>',print:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16.05 16.04"><g><path d="M19.76,15.84a1.29,1.29,0,0,0,.39-.92V8.35A2.05,2.05,0,0,0,19.57,7a1.93,1.93,0,0,0-1.38-.57H6.37a1.95,1.95,0,0,0-2,2v6.56a1.23,1.23,0,0,0,.38.92,1.35,1.35,0,0,0,.93.38h2V14.9l-2,0V8.35a.67.67,0,0,1,.18-.47.62.62,0,0,1,.48-.19H18.18a.6.6,0,0,1,.46.19.66.66,0,0,1,.18.47V14.9h-2v1.32h2A1.35,1.35,0,0,0,19.76,15.84ZM17.52,7.69V5.06a1.31,1.31,0,0,0-.38-.92,1.34,1.34,0,0,0-.94-.38H8.34A1.3,1.3,0,0,0,7,5.06V7.69H8.34V5.06h7.87V7.69h1.31ZM8.34,12.93h7.87l0,5.26H8.34V12.93Zm7.87,5.26v0Zm.65,1.31a.6.6,0,0,0,.46-.19.72.72,0,0,0,.2-.47V12.29a.74.74,0,0,0-.2-.47.6.6,0,0,0-.46-.19H7.68a.6.6,0,0,0-.46.19.72.72,0,0,0-.2.47v6.55a.74.74,0,0,0,.2.47.6.6,0,0,0,.46.19h9.18ZM16.67,9.28a.7.7,0,0,0-.94,0,.63.63,0,0,0-.18.46.67.67,0,0,0,.18.47.68.68,0,0,0,.94,0,.66.66,0,0,0,.18-.47A.58.58,0,0,0,16.67,9.28Z" transform="translate(-4.25 -3.61)"/></g></svg>',template:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.27 15.64"><g><path d="M18.18,19.16a1,1,0,0,0,1-1V5.73a1,1,0,0,0-1-1h-2v1h2V18.19H6.37V5.73h2v-1h-2A.94.94,0,0,0,5.68,5a1,1,0,0,0-.29.7V18.18a.94.94,0,0,0,.29.69,1,1,0,0,0,.69.29H18.18ZM9.82,10.31h4.92a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H9.82a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15Zm5.9,4.92H8.83a.49.49,0,0,0-.35.15.47.47,0,0,0-.15.35.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h6.89a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.51.51,0,0,0-.5-.5ZM7.36,12.77a.49.49,0,0,0,.15.35.47.47,0,0,0,.35.15h8.85a.49.49,0,0,0,.35-.15.47.47,0,0,0,.15-.35.49.49,0,0,0-.15-.35.47.47,0,0,0-.35-.15H7.85a.49.49,0,0,0-.35.15.52.52,0,0,0-.14.35Z" transform="translate(-5.14 -3.77)"/><path d="M14.24,6.71a1,1,0,0,0,1-1,1,1,0,0,0-1-1,1,1,0,0,0-1-1h-2a.94.94,0,0,0-.69.28,1,1,0,0,0-.29.7A.94.94,0,0,0,9.62,5a.91.91,0,0,0-.29.69,1,1,0,0,0,.29.7,1,1,0,0,0,.69.29h3.93Z" transform="translate(-5.14 -3.77)"/></g></svg>',layout:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="5 5 36 36"><path d="M12.5 34.05h11v-3h-11Zm6-8.55h11v-3h-11Zm6-8.55h11v-3h-11ZM9 42q-1.2 0-2.1-.9Q6 40.2 6 39V9q0-1.2.9-2.1Q7.8 6 9 6h30q1.2 0 2.1.9.9.9.9 2.1v30q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h30V9H9v30ZM9 9v30V9Z"/></svg>',new_document:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12.78 15.75"><g><path d="M14.73,3.76,18.67,7.7v9.84a2,2,0,0,1-2,2H7.84a1.89,1.89,0,0,1-1.38-.58,2,2,0,0,1-.57-1.39V5.73a1.93,1.93,0,0,1,.57-1.38,2,2,0,0,1,1.38-.58h6.62l.26,0v0Zm2.95,4.92h-2a1.93,1.93,0,0,1-1.38-.57,2,2,0,0,1-.58-1.4V6.17c0-.36,0-.84,0-1.43H7.85a1,1,0,0,0-.7.29,1,1,0,0,0-.29.7V17.54a1,1,0,0,0,.29.69,1,1,0,0,0,.69.29h8.85a1,1,0,0,0,.71-.29.92.92,0,0,0,.28-.69Zm0-1L14.73,4.74v2A1,1,0,0,0,15,7.4a1,1,0,0,0,.69.29Z" transform="translate(-5.89 -3.76)"/></g></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 13.56"><g><path d="M4.4,4.88V8.26a2,2,0,0,0,.5.39s.1,0,.18-.12a.62.62,0,0,0,.17-.28c.06-.19.13-.44.21-.74s.14-.52.19-.66a.58.58,0,0,1,.21-.3,2.41,2.41,0,0,1,.63-.21,3.83,3.83,0,0,1,.88-.12,9.15,9.15,0,0,1,1.31.06.16.16,0,0,1,.11,0,.26.26,0,0,1,.06.14,4,4,0,0,1,0,.49v2l.05,3.77c0,1.41,0,2.68-.05,3.81a1.79,1.79,0,0,1-.11.49,10.68,10.68,0,0,1-1.4.45,1.12,1.12,0,0,0-.69.43v.31l0,.22.61,0c.85-.08,1.54-.12,2.06-.12a19.76,19.76,0,0,1,2.09.08,15.08,15.08,0,0,0,1.64.08,1.4,1.4,0,0,0,.29,0,1.58,1.58,0,0,0,0-.26l-.05-.43a2.26,2.26,0,0,0-.43-.17l-.77-.22-.15,0a2.55,2.55,0,0,1-.78-.28,2.56,2.56,0,0,1-.11-.75l0-1.29,0-3.15V7.53a10.51,10.51,0,0,1,.06-1.2,3.83,3.83,0,0,1,.6,0l1.88,0a2.18,2.18,0,0,1,.38,0,.45.45,0,0,1,.23.17.9.9,0,0,1,.05.25c0,.16.06.35.1.58a3.33,3.33,0,0,0,.14.55A6.39,6.39,0,0,0,15,9a2.91,2.91,0,0,0,.6-.15,2.77,2.77,0,0,0,0-.46l0-.51,0-2.95-.25,0-.38,0L15,4.94a.71.71,0,0,1-.18.15.45.45,0,0,1-.25.07l-.29,0H8.75l-.15,0H7.45a17,17,0,0,1-1.86,0L5.36,5l-.25-.13ZM19.75,16.14h-.69v-9h.69A.4.4,0,0,0,20.13,7c.06-.11,0-.24-.1-.39L18.92,5.15a.52.52,0,0,0-.86,0L17,6.58c-.12.15-.16.28-.1.39s.18.16.38.16h.69v9h-.69a.4.4,0,0,0-.38.16c-.06.11,0,.24.1.39l1.11,1.43a.52.52,0,0,0,.86,0L20,16.69c.12-.15.16-.28.1-.39a.4.4,0,0,0-.38-.16Z" transform="translate(-4.4 -4.86)"/></g></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4A4,4 0 0,1 17,8A4,4 0 0,1 13,12H11V18H9V4H13M13,10A2,2 0 0,0 15,8A2,2 0 0,0 13,6H11V10H13Z" /></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M18.53,19.5l.2-.05A1.78,1.78,0,0,0,20.13,18l0-.09V7.14a2,2,0,0,0-.28-.64A3.18,3.18,0,0,0,19.43,6c-.5-.52-1-1-1.55-1.54A2.59,2.59,0,0,0,17.37,4a1.83,1.83,0,0,0-.61-.25H6l-.21,0a1.78,1.78,0,0,0-1.4,1.49l0,.1V17.87a2.49,2.49,0,0,0,.09.37,1.79,1.79,0,0,0,1.44,1.23l.09,0Zm-6.25-.6H6.92a.61.61,0,0,1-.68-.48.78.78,0,0,1,0-.22V12.3a.62.62,0,0,1,.69-.68H17.64a.62.62,0,0,1,.69.69V18.2a.64.64,0,0,1-.71.69H12.28ZM12,9.81H8.15a.63.63,0,0,1-.72-.71v-4a.64.64,0,0,1,.72-.72h7.66a.64.64,0,0,1,.72.72v4a.65.65,0,0,1-.74.72ZM13.5,5V9.18h1.78V5Z" transform="translate(-4.41 -3.76)"/></g></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,17H17L19,13V7H13V13H16M6,17H9L11,13V7H5V13H8L6,17Z" /></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 3H17C18.11 3 19 3.9 19 5V12.08C17.45 11.82 15.92 12.18 14.68 13H11V17H12.08C11.97 17.68 11.97 18.35 12.08 19H3C1.9 19 1 18.11 1 17V5C1 3.9 1.9 3 3 3M3 7V11H9V7H3M11 7V11H17V7H11M3 13V17H9V13H3M22.78 19.32L21.71 18.5C21.73 18.33 21.75 18.17 21.75 18S21.74 17.67 21.71 17.5L22.77 16.68C22.86 16.6 22.89 16.47 22.83 16.36L21.83 14.63C21.77 14.5 21.64 14.5 21.5 14.5L20.28 15C20 14.82 19.74 14.65 19.43 14.53L19.24 13.21C19.23 13.09 19.12 13 19 13H17C16.88 13 16.77 13.09 16.75 13.21L16.56 14.53C16.26 14.66 15.97 14.82 15.71 15L14.47 14.5C14.36 14.5 14.23 14.5 14.16 14.63L13.16 16.36C13.1 16.47 13.12 16.6 13.22 16.68L14.28 17.5C14.26 17.67 14.25 17.83 14.25 18S14.26 18.33 14.28 18.5L13.22 19.32C13.13 19.4 13.1 19.53 13.16 19.64L14.16 21.37C14.22 21.5 14.35 21.5 14.47 21.5L15.71 21C15.97 21.18 16.25 21.35 16.56 21.47L16.75 22.79C16.77 22.91 16.87 23 17 23H19C19.12 23 19.23 22.91 19.25 22.79L19.44 21.47C19.74 21.34 20 21.18 20.28 21L21.5 21.5C21.64 21.5 21.77 21.5 21.84 21.37L22.84 19.64C22.9 19.53 22.87 19.4 22.78 19.32M18 19.5C17.17 19.5 16.5 18.83 16.5 18S17.18 16.5 18 16.5 19.5 17.17 19.5 18 18.84 19.5 18 19.5Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5 8C21.43 8 23 6.43 23 4.5C23 2.57 21.43 1 19.5 1C17.57 1 16 2.57 16 4.5C16 6.43 17.57 8 19.5 8M21 16V9.79C20.5 9.93 20 10 19.5 10C19.33 10 19.17 10 19 10V16C19 17.66 17.66 19 16 19H8C6.34 19 5 17.66 5 16V8C5 6.34 6.34 5 8 5H14C14 4.84 14 4.67 14 4.5C14 4 14.07 3.5 14.21 3H8C5.24 3 3 5.24 3 8V16C3 18.76 5.24 21 8 21H16C18.76 21 21 18.76 21 16Z" /></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.66 15.67"><g><path d="M19.72,5.58a1.64,1.64,0,0,0-1.64-1.64H6.23a1.62,1.62,0,0,0-1.16.48,1.63,1.63,0,0,0-.48,1.16V9.63a1.6,1.6,0,0,0,.48,1.16,1.62,1.62,0,0,0,1.16.47H18.09a1.67,1.67,0,0,0,1.16-.47,1.62,1.62,0,0,0,.48-1.16V5.58Zm-.94,4.05a.68.68,0,0,1-.7.7H6.23a.66.66,0,0,1-.48-.2.74.74,0,0,1-.21-.5V5.58a.66.66,0,0,1,.2-.48.71.71,0,0,1,.48-.21H18.08a.74.74,0,0,1,.5.21.66.66,0,0,1,.2.48ZM6.48,7.72a.21.21,0,0,0,.17-.07.22.22,0,0,0,.07-.17V7.06a1.27,1.27,0,0,1,.11-.52.37.37,0,0,1,.36-.23H8.77A.25.25,0,0,0,9,6.17a.19.19,0,0,0,0-.23.27.27,0,0,0-.2-.12H7.19a.88.88,0,0,0-.72.39,1.51,1.51,0,0,0-.23.85v.42a.24.24,0,0,0,.24.24Zm-.19.81a.21.21,0,0,0,.17-.07.26.26,0,0,0,.07-.17.24.24,0,0,0-.24-.24.2.2,0,0,0-.16.09.2.2,0,0,0-.07.16.22.22,0,0,0,.07.17.23.23,0,0,0,.16.06Zm8.46,5.1a1.63,1.63,0,0,0-.47-1.16A1.61,1.61,0,0,0,13.12,12H6.23a1.6,1.6,0,0,0-1.16.46,1.62,1.62,0,0,0-.48,1.16v4.05a1.64,1.64,0,0,0,1.64,1.64h6.89a1.6,1.6,0,0,0,1.16-.48,1.62,1.62,0,0,0,.47-1.16Zm-.94,4a.7.7,0,0,1-.2.49.65.65,0,0,1-.5.2H6.23a.66.66,0,0,1-.48-.2.75.75,0,0,1-.21-.49v-4a.74.74,0,0,1,.21-.5.66.66,0,0,1,.48-.2h6.89a.68.68,0,0,1,.7.7v4Zm6.15,0v-4a1.6,1.6,0,0,0-.48-1.16A1.67,1.67,0,0,0,18.32,12H17.1a1.63,1.63,0,0,0-1.16.47,1.61,1.61,0,0,0-.47,1.16v4a1.67,1.67,0,0,0,.47,1.16,1.62,1.62,0,0,0,1.16.48h1.22A1.64,1.64,0,0,0,20,17.68Zm-.94-4v4a.75.75,0,0,1-.21.49.62.62,0,0,1-.48.2H17.11a.69.69,0,0,1-.5-.2.7.7,0,0,1-.2-.49v-4a.68.68,0,0,1,.7-.7h1.22a.66.66,0,0,1,.48.2.72.72,0,0,1,.21.5Z" transform="translate(-4.44 -3.79)"/></g></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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.77"><g><path d="M8.77,8.72a.88.88,0,0,1-.61-.27.82.82,0,0,1-.25-.61.89.89,0,0,1,.25-.62A.82.82,0,0,1,8.77,7a.81.81,0,0,1,.61.25.83.83,0,0,1,.27.62.81.81,0,0,1-.25.61.91.91,0,0,1-.63.27Zm9.62-5a1.74,1.74,0,0,1,1.76,1.76V17.76a1.74,1.74,0,0,1-1.76,1.76H6.16A1.74,1.74,0,0,1,4.4,17.76V5.51A1.74,1.74,0,0,1,6.16,3.75H18.39Zm0,1.75H6.16v8L8.53,11.8a.94.94,0,0,1,.54-.17.86.86,0,0,1,.54.2L11.09,13l3.64-4.55a.78.78,0,0,1,.34-.25.85.85,0,0,1,.42-.07.89.89,0,0,1,.39.12.78.78,0,0,1,.28.29l2.24,3.67V5.51Zm0,12.24V15.6L15.3,10.53,11.89,14.8a.89.89,0,0,1-.59.32.82.82,0,0,1-.64-.18L9,13.62,6.16,15.74v2Z" transform="translate(-4.4 -3.75)"/></g></svg>',video:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.55"><g><path d="M20.15,10.26V18.9l-3.94-1.57v1.2H4.41V10.66H16.22v1.23l2-.81,2-.82ZM14.64,17h0V12.54h0v-.31H6V17h8.67Zm3.94-.37v-4l-2.37,1v2l1.18.48,1.19.48ZM7.94,9.86A2.77,2.77,0,0,1,5.19,7.11a2.76,2.76,0,0,1,5.51,0A2.78,2.78,0,0,1,7.94,9.86Zm0-3.93a1.21,1.21,0,0,0-.83.35,1.15,1.15,0,0,0-.34.84A1.09,1.09,0,0,0,7.11,8,1.15,1.15,0,0,0,8,8.28,1.13,1.13,0,0,0,9.11,7.12,1.16,1.16,0,0,0,7.94,5.93Zm5.9,3.93a2.34,2.34,0,0,1-1.67-.68,2.3,2.3,0,0,1-.68-1.67,2.35,2.35,0,0,1,4-1.67,2.37,2.37,0,0,1,0,3.34,2.33,2.33,0,0,1-1.68.68Zm0-3.14a.75.75,0,1,0,.55.22.73.73,0,0,0-.55-.22Z" transform="translate(-4.41 -4.35)"/></g></svg>',link:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M13.05,13.63a.24.24,0,0,1,.15.22L13.42,16a.19.19,0,0,1-.08.18l-2.12,2.14a4.08,4.08,0,0,1-1.29.85A4,4,0,0,1,4.71,17a3.92,3.92,0,0,1-.3-1.52A4,4,0,0,1,4.71,14a3.91,3.91,0,0,1,.87-1.3L7.7,10.56a.25.25,0,0,1,.2-.06l2.17.22a.21.21,0,0,1,.19.15.24.24,0,0,1,0,.25L7.12,14.23a1.81,1.81,0,0,0,0,2.58,1.78,1.78,0,0,0,1.29.52,1.74,1.74,0,0,0,1.28-.52L12.8,13.7a.24.24,0,0,1,.25-.07ZM19,4.92a4,4,0,0,1,0,5.66L16.86,12.7a.25.25,0,0,1-.17.08l-2.2-.23a.21.21,0,0,1-.19-.15.22.22,0,0,1,0-.25L17.44,9a1.81,1.81,0,0,0,0-2.58,1.78,1.78,0,0,0-1.29-.52,1.74,1.74,0,0,0-1.28.52L11.76,9.57a.21.21,0,0,1-.25,0,.24.24,0,0,1-.16-.21l-.22-2.17a.19.19,0,0,1,.08-.18l2.12-2.14a4.08,4.08,0,0,1,1.29-.85,4.05,4.05,0,0,1,3.06,0,3.85,3.85,0,0,1,1.3.85ZM5.84,9.82a.25.25,0,0,1-.18-.08.19.19,0,0,1-.07-.19l.11-.77a.2.2,0,0,1,.11-.17.24.24,0,0,1,.2,0l2.5.72a.25.25,0,0,1,.15.27.22.22,0,0,1-.23.21l-2.59,0Zm4.12-2-.73-2.5a.27.27,0,0,1,0-.2A.21.21,0,0,1,9.41,5L10.19,5a.25.25,0,0,1,.19,0,.23.23,0,0,1,.08.18l-.05,2.61a.2.2,0,0,1-.19.23h0A.22.22,0,0,1,10,7.85Zm8.76,5.58a.25.25,0,0,1,.18.08.23.23,0,0,1,.06.2l-.11.77a.25.25,0,0,1-.11.17.21.21,0,0,1-.12,0l-.08,0L16,14a.25.25,0,0,1-.15-.27.22.22,0,0,1,.22-.21l1.29,0,1.33,0Zm-4.12,2,.74,2.51a.28.28,0,0,1,0,.2.23.23,0,0,1-.18.11l-.8.11a.23.23,0,0,1-.17-.07.25.25,0,0,1-.08-.18l0-2.61a.22.22,0,0,1,.22-.22.21.21,0,0,1,.26.15Z" transform="translate(-4.41 -3.77)"/></g></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 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.42,5.29C11.32,5.19 10.35,6 10.25,7.11L10,10H12.82V12H9.82L9.38,17.07C9.18,19.27 7.24,20.9 5.04,20.7C3.79,20.59 2.66,19.9 2,18.83L3.5,17.33C3.83,18.38 4.96,18.97 6,18.63C6.78,18.39 7.33,17.7 7.4,16.89L7.82,12H4.82V10H8L8.27,6.93C8.46,4.73 10.39,3.1 12.6,3.28C13.86,3.39 15,4.09 15.66,5.17L14.16,6.67C13.91,5.9 13.23,5.36 12.42,5.29M22,13.65L20.59,12.24L17.76,15.07L14.93,12.24L13.5,13.65L16.35,16.5L13.5,19.31L14.93,20.72L17.76,17.89L20.59,20.72L22,19.31L19.17,16.5L22,13.65Z" /></svg>',unlink:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.72"><g><path d="M19,18.32a4,4,0,0,0,0-5.68L15.85,9.5l-1.17,1.55L17.57,14a2,2,0,0,1,.61,1.47,2.08,2.08,0,0,1-2.09,2.09,2,2,0,0,1-1.47-.61l-.38-.37-1.74,1,.8.78a4,4,0,0,0,5.68,0ZM8,9.77a2,2,0,0,1-1.27-1,1.89,1.89,0,0,1-.21-1.57A2.1,2.1,0,0,1,7.45,6,2,2,0,0,1,9,5.76L12.27,7.2l.49-2L9.48,3.9a4,4,0,0,0-3.06.41A3.82,3.82,0,0,0,4.56,6.73a3.8,3.8,0,0,0,.4,3A3.78,3.78,0,0,0,7.39,11.6l5.38,2,.49-2-2.64-.94L8,9.77Z" transform="translate(-4.41 -3.76)"/></g></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>',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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M15.7,1.3c-0.1-0.1-0.1-0.2-0.2-0.2L15.3,1H0.4L0.3,1.1c0,0-0.1,0.1-0.1,0.1c0,0-0.1,0.1-0.1,0.1L0,1.4v7.7l0.1,0.1c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h2.3V9.3l0.1-0.5L3,8.5l0.1-0.2c-0.1,0-0.2,0-0.3,0H1.2v-6h13.3v6h-1.6c-0.1,0-0.2,0-0.3,0l0.1,0.2l0.2,0.4C12.9,9,13,9.2,13,9.3v0.1h2.3l0.2-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1V1.4L15.7,1.3z"/><path d="M10.5,7.5C9.9,7.1,9.3,6.8,8.6,6.7c-0.2,0-0.5-0.1-0.7,0c-0.2,0-0.5,0-0.7,0C6.6,6.7,6.1,6.9,5.6,7.3C5.2,7.6,4.7,8,4.4,8.4C4.3,8.6,4.2,8.8,4.2,8.9C4.1,9.1,4,9.3,3.9,9.4C3.9,9.6,3.8,9.7,3.8,9.9c0,0.2-0.1,0.3-0.1,0.5v-0.1c-0.1,0.8,0.1,1.6,0.5,2.4c0.4,0.7,1,1.3,1.7,1.7c0.3,0.2,0.6,0.3,0.9,0.3c0.3,0.1,0.7,0.1,1,0.1c0.3,0,0.7,0,1-0.1c0.3-0.1,0.6-0.2,0.9-0.3c0.5-0.3,0.9-0.6,1.3-1c0.3-0.4,0.6-0.8,0.8-1.3c0.1-0.4,0.2-0.9,0.2-1.4c0-0.5-0.1-1-0.3-1.4C11.5,8.6,11.1,8,10.5,7.5z M10.1,11.3H8.5v1.6H8H7.9H7.3v0v-0.1v-1.4H5.7v-0.4v-0.2v-0.6h0h1.5V8.5h1.2v1.6h1.6V11.3z"/></g></svg>',insert_row_above:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M0.1,14.5c0.1,0.1,0.1,0.2,0.2,0.2l0.1,0.1h14.9l0.1-0.1c0,0,0.1-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1l0.1-0.1V6.7l-0.1-0.1c0-0.1-0.1-0.1-0.2-0.2l-0.1-0.1h-2.3v0.1l-0.1,0.5l-0.2,0.4l-0.1,0.2c0.1,0,0.2,0,0.3,0h1.6v6H1.3v-6h1.6c0.1,0,0.2,0,0.3,0L3.1,7.3L2.9,6.9C2.8,6.8,2.8,6.6,2.7,6.5V6.3H0.4L0.3,6.4c-0.1,0-0.1,0.1-0.2,0.2L0,6.7v7.7L0.1,14.5z"/><path d="M5.3,8.3c0.6,0.5,1.2,0.8,1.9,0.9c0.2,0,0.5,0.1,0.7,0c0.2,0,0.5,0,0.7,0c0.6-0.1,1.1-0.3,1.6-0.6c0.5-0.3,0.9-0.7,1.2-1.2c0.1-0.2,0.2-0.3,0.3-0.5c0.1-0.2,0.2-0.4,0.2-0.5c0.1-0.1,0.1-0.3,0.1-0.4C12,5.8,12,5.6,12,5.4v0.1c0.1-0.8-0.1-1.6-0.5-2.4c-0.4-0.7-1-1.3-1.7-1.7C9.5,1.3,9.2,1.2,8.9,1.1C8.5,1,8.2,1,7.9,1c-0.3,0-0.7,0-1,0.1C6.6,1.2,6.3,1.3,6,1.4C5.5,1.7,5.1,2,4.7,2.4C4.4,2.8,4.1,3.3,3.9,3.8C3.8,4.2,3.7,4.7,3.7,5.2c0,0.5,0.1,1,0.3,1.4C4.3,7.2,4.7,7.8,5.3,8.3z M5.7,4.5h1.6V2.9h0.5h0.1h0.6v0v0.1v1.4H10v0.4v0.2v0.6h0H8.5v1.6H7.3V5.7H5.7V4.5z"/></g></svg>',insert_column_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M14.5,15.7c0.1-0.1,0.2-0.1,0.2-0.2l0.1-0.1V0.4l-0.1-0.1c0,0-0.1-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1L14.4,0H6.7L6.6,0.1c-0.1,0-0.1,0.1-0.2,0.2L6.3,0.4v2.3h0.1l0.5,0.1L7.3,3l0.2,0.1c0-0.1,0-0.2,0-0.3V1.2h6v13.3h-6v-1.6c0-0.1,0-0.2,0-0.3l-0.2,0.1l-0.4,0.2C6.7,12.9,6.6,13,6.4,13H6.3v2.3l0.1,0.2c0,0.1,0.1,0.1,0.2,0.2l0.1,0.1h7.7L14.5,15.7z"/><path d="M8.3,10.5C8.7,10,9,9.3,9.1,8.6c0-0.2,0.1-0.5,0-0.7c0-0.2,0-0.5,0-0.7C9,6.7,8.8,6.1,8.5,5.7C8.2,5.2,7.8,4.8,7.3,4.5C7.2,4.4,7,4.3,6.9,4.2C6.7,4.1,6.5,4,6.4,4C6.2,3.9,6.1,3.9,5.9,3.8c-0.2,0-0.3-0.1-0.5-0.1h0.1C4.7,3.7,3.8,3.9,3.1,4.3C2.4,4.7,1.8,5.3,1.4,6C1.3,6.3,1.2,6.6,1.1,6.9C1,7.2,1,7.6,1,7.9c0,0.3,0,0.7,0.1,1c0.1,0.3,0.2,0.6,0.3,0.9c0.3,0.5,0.6,0.9,1,1.3c0.4,0.3,0.8,0.6,1.3,0.8C4.2,12,4.7,12.1,5.1,12c0.5,0,1-0.1,1.4-0.3C7.2,11.5,7.8,11.1,8.3,10.5zM4.5,10.1V8.5H2.9V8V7.9V7.3h0H3h1.4V5.7h0.4h0.2h0.6v0v1.5h1.6v1.2H5.7v1.6H4.5z"/></g></svg>',insert_column_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.8 15.8"><g><path d="M1.3,0.1C1.2,0.2,1.1,0.2,1.1,0.3L1,0.4v14.9l0.1,0.1c0,0,0.1,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1l0.1,0.1h7.7l0.1-0.1c0.1,0,0.1-0.1,0.2-0.2l0.1-0.1v-2.3H9.3l-0.5-0.1l-0.4-0.2l-0.2-0.1c0,0.1,0,0.2,0,0.3v1.6h-6V1.3h6v1.6c0,0.1,0,0.2,0,0.3l0.2-0.1l0.4-0.2C9,2.9,9.2,2.8,9.3,2.8h0.1V0.5L9.4,0.3c0-0.1-0.1-0.1-0.2-0.2L9.1,0H1.4L1.3,0.1z"/><path d="M7.5,5.3C7,5.8,6.7,6.5,6.6,7.2c0,0.2-0.1,0.5,0,0.7c0,0.2,0,0.5,0,0.7c0.1,0.6,0.3,1.1,0.6,1.6c0.3,0.5,0.7,0.9,1.2,1.2c0.2,0.1,0.3,0.2,0.5,0.3c0.2,0.1,0.4,0.2,0.5,0.2c0.1,0.1,0.3,0.1,0.4,0.1c0.2,0,0.3,0.1,0.5,0.1h-0.1c0.8,0.1,1.6-0.1,2.4-0.5c0.7-0.4,1.3-1,1.7-1.7c0.2-0.3,0.3-0.6,0.3-0.9c0.1-0.3,0.1-0.7,0.1-1c0-0.3,0-0.7-0.1-1c-0.1-0.3-0.2-0.6-0.3-0.9c-0.3-0.5-0.6-0.9-1-1.3C13,4.4,12.5,4.2,12,4c-0.4-0.1-0.9-0.2-1.4-0.2c-0.5,0-1,0.1-1.4,0.2C8.5,4.3,7.9,4.7,7.5,5.3z M11.3,5.7v1.6h1.6v0.5v0.1v0.6h0h-0.1h-1.4v1.6h-0.4h-0.2h-0.6v0V8.5H8.5V7.3h1.6V5.7H11.3z"/></g></svg>',delete_row:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 13.83"><g><path d="M4.7,18.46l.12.08H19.73l.12-.08a.58.58,0,0,0,.22-.22l.08-.12,0-7.69-.08-.11a.77.77,0,0,0-.18-.18l-.11-.08-2.31,0-.08.28-.1.29a1.58,1.58,0,0,1-.12.29l-.14.34s0,0,.18,0H18.9v6H5.64v-6H7.35c.14,0,.2,0,.18,0l-.14-.34a2.85,2.85,0,0,1-.12-.29l-.1-.29-.07-.27-2.31,0-.11.08a.77.77,0,0,0-.18.18l-.08.11,0,7.69.08.12a.47.47,0,0,0,.09.12l.13.09ZM12.11,13a4,4,0,0,0,1.46-.21,4.51,4.51,0,0,0,1.31-.71A4,4,0,0,0,16.26,10a4.32,4.32,0,0,0-.08-2.54,4.34,4.34,0,0,0-1-1.52,4.15,4.15,0,0,0-1.54-1,4.34,4.34,0,0,0-1.35-.22A4.07,4.07,0,0,0,11,4.93,3.94,3.94,0,0,0,9.24,6.07,3.92,3.92,0,0,0,8.15,8.88a3.91,3.91,0,0,0,.12.95A4.16,4.16,0,0,0,12.11,13Zm2.35-4.14v.58H10.09V8.27h4.37v.58Z" transform="translate(-4.4 -4.71)"/></g></svg>',delete_column:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.81 15.74"><g><path d="M5.66,19.42l.12.08,7.69,0,.11-.08a.77.77,0,0,0,.18-.18l.08-.11,0-2.32-.15,0-.45-.15-.42-.18-.17-.07a1,1,0,0,0,0,.27v1.63h-6V5h6V6.62a.9.9,0,0,0,0,.26l.17-.07.42-.17a3.91,3.91,0,0,1,.45-.15l.15,0,0-2.32L13.75,4a.77.77,0,0,0-.18-.18l-.11-.08H5.79l-.13.07a.63.63,0,0,0-.21.22l-.08.12V19.08l.08.12a.47.47,0,0,0,.09.12.35.35,0,0,0,.12.1Zm9-3.67a4.16,4.16,0,0,0,2.36-.51,4.08,4.08,0,0,0,1.67-1.72,4,4,0,0,0,.35-.91,3.79,3.79,0,0,0,.1-1,4.71,4.71,0,0,0-.11-1,5,5,0,0,0-.3-.87,4.25,4.25,0,0,0-1-1.25,4.49,4.49,0,0,0-1.34-.81A4.26,4.26,0,0,0,15,7.48a3.88,3.88,0,0,0-1.41.25A4.32,4.32,0,0,0,11.86,9,4,4,0,0,0,11,10.94a4.4,4.4,0,0,0-.05.68,4.5,4.5,0,0,0,.05.68,3.93,3.93,0,0,0,.61,1.57,4.22,4.22,0,0,0,1.18,1.2,4.59,4.59,0,0,0,.48.27c.2.1.37.17.5.22a2.44,2.44,0,0,0,.45.12,4.61,4.61,0,0,0,.5.07Zm2.54-4.12v.58H12.87V11h4.37v.59Z" transform="translate(-5.37 -3.76)"/></g></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="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" /></svg>',image_gallery:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="30 30 150 150"><g><path d="M152.775,120.548V51.651c0-12.271-9.984-22.254-22.254-22.254H43.727c-12.271,0-22.254,9.983-22.254,22.254v68.896c0,12.27,9.983,22.254,22.254,22.254h86.795C142.791,142.802,152.775,132.817,152.775,120.548z M36.394,51.651c0-4.042,3.291-7.333,7.333-7.333h86.795c4.042,0,7.332,3.291,7.332,7.333v23.917l-14.938-17.767c-1.41-1.678-3.487-2.649-5.68-2.658h-0.029c-2.184,0-4.255,0.954-5.674,2.613L76.709,98.519l-9.096-9.398c-1.427-1.474-3.392-2.291-5.448-2.273c-2.052,0.025-4.004,0.893-5.396,2.4L36.394,111.32V51.651z M41.684,127.585l20.697-22.416l9.312,9.622c1.461,1.511,3.489,2.334,5.592,2.27c2.101-0.066,4.075-1.013,5.44-2.612l34.436-40.308l20.693,24.613v21.794c0,4.042-3.29,7.332-7.332,7.332H43.727C43.018,127.88,42.334,127.775,41.684,127.585z M182.616,152.5V75.657c0-4.12-3.34-7.46-7.461-7.46c-4.119,0-7.46,3.34-7.46,7.46V152.5c0,4.112-3.347,7.46-7.461,7.46h-94c-4.119,0-7.46,3.339-7.46,7.459c0,4.123,3.341,7.462,7.46,7.462h94C172.576,174.881,182.616,164.841,182.616,152.5z"/></g></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_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>',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 class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 3.58"><g><path d="M4.64,10.73a1.84,1.84,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0A1.79,1.79,0,0,1,8,11.63a1.84,1.84,0,0,1-.25.9,1.69,1.69,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2.08,2.08,0,0,1,4.64,10.73Zm6.09,0a1.84,1.84,0,0,1,.65-.65,1.78,1.78,0,0,1,2.67,1.55,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.76,1.76,0,0,1-1.79,0,1.79,1.79,0,0,1-.64-2.44Zm6.08,0a1.69,1.69,0,0,1,.65-.65,1.76,1.76,0,0,1,1.79,0,1.79,1.79,0,0,1,.9,1.54,1.73,1.73,0,0,1-.24.9,1.84,1.84,0,0,1-.65.65,1.8,1.8,0,0,1-2.69-1.55A2,2,0,0,1,16.81,10.73Z" transform="translate(-4.39 -9.84)"/></g></svg>',more_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3.94 15.75"><g><path d="M12.28,7.69a1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,2,2,0,0,1,1.39-.58,1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58Zm0,2a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39A1.92,1.92,0,0,1,13.67,13a2,2,0,0,1-1.39.58A1.92,1.92,0,0,1,10.89,13a2,2,0,0,1-.58-1.39,2,2,0,0,1,2-2Zm0,5.9a1.92,1.92,0,0,1,1.39.58,2,2,0,0,1,.58,1.39,1.92,1.92,0,0,1-.58,1.39,2,2,0,0,1-1.39.58,1.92,1.92,0,0,1-1.39-.58,2,2,0,0,1-.58-1.39,1.92,1.92,0,0,1,.58-1.39,1.94,1.94,0,0,1,1.39-.58Z" transform="translate(-10.31 -3.75)"/></g></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="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z" /></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>',erase:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.76"><g><path d="M13.69,17.2h6.46v1.31H8.56L4.41,14.37,14,4.75l6.06,6.06L16.89,14l-3.2,3.19Zm-4.61,0h2.77L14.09,15,9.88,10.75,6.25,14.38l1.41,1.41c.84.82,1.31,1.29,1.42,1.41Z" transform="translate(-4.41 -4.75)"/></g></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 st=i("cfbI"),nt=i.n(st);const ot=function(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],["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",X(i.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",-1],["historyIndex",-1],["savedIndex",-1]]);o&<(o,a);const h=e.querySelector(".se-placeholder");return h&&a.set("placeholder",h),a},lt=function(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")},rt=function(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},at=Y._d,ht=[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],ct=["px","pt","em","rem"],dt={script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},ut={"table|th|td":"border|border-[a-z]+|background-color|text-align|float|font-weight|text-decoration|font-style","ol|ul":"list-style-type"},pt="font-family|font-size|color|background-color",gt="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|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",mt=["repeat","always","none"],ft=["mode","type","externalLibs","keepStyleOnDelete","iframe","convertTextTags","textStyleTags","fontSizeUnits","spanStyles","lineStyles","tagStyles","reverseCommands","shortcutsDisable","shortcuts","buttonList","subToolbar","toolbar_container","statusbar_container","elementWhitelist","elementBlacklist","attributeWhitelist","attributeBlacklist","defaultLine","formatClosureBrLine","formatBrLine","formatLine","formatClosureBlock","formatBlock","__defaultElementWhitelist","__defaultAttributeWhitelist","__listCommonStyle","icons","lang","codeMirror"];function _t(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=0;g<i.length;g+=2)h=i[g],c=/^s/i.test(h),u=tt.get(h)+(c?1e3:0),s.has(u)||(p=n.indexOf(t),p=-1===p?"":tt.isOdd(p)?n[p+1]:n[p-1],p&&o.push(u),s.set(u,{c:t,r:p,t:e.getAttribute("data-type"),e})),(d=i[g+1])&&l&&(r=c,a=d,l.appendChild(Q.createElement("SPAN",{class:"se-shortcut"},Y.cmdIcon+(r?Y.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>")));var r,a}function bt(t,e){return[t,e].reduce(((t,e)=>{for(const i in e)t[i]=(e[i]||"").toLowerCase();return t}),{})}function vt(t,e,i){const s=t.buttonList||ht,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);const o=!1!==t.strictMode;n.set("strictMode",{tagFilter:o,formatFilter:o,classFilter:o,styleNodeFilter:o,attrFilter:o,styleFilter:o,...t.strictMode}),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("type-options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("keepStyleOnDelete",!!t.keepStyleOnDelete),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):ct),n.set("allowedClassName",new RegExp((t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":"")+"^__se__|^se-|^katex|^MathJax")),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTab",t.syncTab??!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||mt.includes(l)||(console.error(`Invalid retainStyleMode: ${l}. Valid options are ${mt.join(", ")}. Using default 'once'.`),l="repeat"),n.set("retainStyleMode",l);const r={...dt,...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:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary")+(t.textStyleTags?"|"+t.textStyleTags:""));const d=bt({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",[{...ut,...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](${pt}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](text-align|margin-left|margin-right|line-height${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",bt(J.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("-")),tt.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("_rtl")?" se-rtl":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass:null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p");const u=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),p=n.get("externalLibs").mathjax?"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover|":"";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",Et(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:"").toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",Et((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:"PRE").toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",Et("div|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:"P|H[1-6]|LI|TH|TD|DETAILS").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",Et(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:"TH|TD").toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",Et((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS").toLowerCase(),n.get("elementBlacklist"))),n.set("__defaultElementWhitelist","br|div|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary").toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:"contenteditable|target|href|title|download|rel|src|alt|class|type|controls|colspan|rowspan").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?tt.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?at.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:/^\d+/.test(t.toolbar_sticky)?tt.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?tt.is(b.width)?b.width+"px":b.width:"auto"),_=n.get("_rtl")?b.buttonList.reverse():b.buttonList));for(let i=0,s=e.length;i<s;i++)Ct(e[i].options||{},t,e[i].options=new Map);n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const v=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["65","A"],bold:["66","B"],strike:["s83","S"],underline:["85","U"],italic:["73","I"],redo:["89","Y","s90","Z"],undo:["90","Z"],indent:["221","]"],outdent:["219","["],sup:["187","="],sub:["s187","="],save:["83","S"],link:["75","K"]},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:/^\d+/.test(t.fullScreenOffset)?tt.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 y=n.get("externalLibs").codeMirror;y&&(n.set("codeMirror",y),y.EditorView?n.set("codeMirror6Editor",!0):y.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 C=t.icons&&"object"==typeof t.icons?[it,t.icons].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):it;n.set("icons",C);const w=new Set(gt.split("|")),x=t.spanStyles?.split("|")||[],E=n.get("__listCommonStyle"),S=pt.split("|");for(let t=0,e=S.length;t<e;t++)w.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++)w.add(e[t])}for(let t=0,e=x.length;t<e;t++)w.add(x[t]);for(let t=0,e=E.length;t<e;t++)w.add(E[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)w.add(T[t]);return n.set("allUsedStyles",w),{o:n,i:C,l:t.lang||nt(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?s.reverse():s,subButtons:_,statusbarContainer:"string"==typeof t.statusbar_container?at.querySelector(t.statusbar_container):t.statusbar_container}}function yt(t,e){let i=null,s=null,n=null;if(t.get("statusbar")&&(i=(e=e||Q.createElement("DIV",{class:"se-status-bar sun-editor-common"})).querySelector(".se-navigation")||Q.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(i),t.get("charCounter"))){if(s=e.querySelector(".se-char-counter-wrapper")||Q.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=s.querySelector(".se-char-label")||Q.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),s.appendChild(e)}if(n=s.querySelector(".se-char-counter")||Q.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",s.appendChild(n),t.get("charCounter_max")>0){const e=s.querySelector(".se-char-max")||Q.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 Ct(t,e,i){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,v=s||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,y=!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,E=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?tt.is(r)?r+"px":r:"100%"),i.set("minWidth",(tt.is(a)?a+"px":a)||""),i.set("maxWidth",(tt.is(h)?h+"px":h)||""),i.set("height",c?tt.is(c)?c+"px":c:"auto"),i.set("minHeight",(tt.is(d)?d+"px":d)||""),i.set("maxHeight",(tt.is(u)?u+"px":u)||""),i.set("_defaultStyles",J._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 S=void 0===b||!!b;i.set("statusbar",S),i.set("statusbar_showPathLabel",!!S&&("boolean"!=typeof v||v)),i.set("statusbar_resizeEnable",!!S&&(void 0===y||!!y)),i.set("charCounter",w>0||"boolean"==typeof C&&C),i.set("charCounter_max",tt.is(w)&&w>-1?1*w:null),i.set("charCounter_label","string"==typeof x?x.trim():null),i.set("charCounter_type","string"==typeof E?E:"char")}function wt(t,e,i,s){const n=s.get("_defaultStyles");i.style.cssText=n.top;const o=Q.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]);o.allowFullscreen=!0,o.frameBorder=0,o.style.cssText=n.frame}else o.setAttribute("contenteditable",!0),o.setAttribute("scrolling","auto"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=Q.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame});let r=null;return s.get("placeholder")&&(r=Q.createElement("SPAN",{class:"se-placeholder"}),r.innerText=s.get("placeholder")),{bottomBar:yt(s,null),wysiwygFrame:o,codeView:l,placeholder:r}}function xt(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?(Q.removeItem(i),s.className+=" se-code-viewer-mirror",s):i}function Et(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 St(){const t=Q.createElement("UL",{class:"se-menu-list"});return{div:Q.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function Tt(t,e,i,s,n,o,l){const r=Q.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(s),c="se-toolbar-separator-vertical"===t?Q.createElement("DIV",{class:t,tabindex:"-1"},null):Q.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.setAttribute("disabled",!0),/^FIELD$/i.test(s)&&Q.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=kt(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function kt(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}function Nt(t,e,i,s){if(!t)return;const n=!1===e.inner;if(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.afterButton&&(Q.addClass(e.afterButton,"se-toolbar-btn"),t.parentElement.appendChild(e.afterButton),Q.addClass(t,"se-side-btn-a"),Q.addClass(e.afterButton,"se-side-btn-after")),e.beforeButton&&(Q.addClass(e.beforeButton,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeButton,t),e.afterButton?(Q.addClass(t,"se-side-btn"),Q.removeClass(t,"se-side-btn-a")):Q.addClass(t,"se-side-btn-b"),Q.addClass(e.beforeButton,"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&&(Q.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.setAttribute("disabled",!0))}}function Lt(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],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]}}(i,s,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=Q.createElement("DIV",{class:"se-toolbar-more-layer"}),f=Q.createElement("DIV",{class:"se-btn-tray"}),_=Q.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let i,b,v,y,C,w=0;w<t.length;w++)if(i=!1,C="",y=t[w],p=St(),"object"==typeof y){for(let f,_=0;_<y.length;_++){if(d=y[_],f=!1,u=e[d],/^%\d+/.test(d)&&0===_){y[0]=d.replace(/[^\d]/g,""),a.push(y),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.substr(1),p.div.className+=" module-float-"+C;continue}if(/^#/.test(d)){"fix"===d.substr(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);v="__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,v,"MORE",i]}else c="|"===d?["se-toolbar-separator-vertical","","","separator",""]: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=Tt(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=Q.createElement("DIV"),b.className="se-more-layer "+v,b.setAttribute("data-ref",v),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("|"===y){const t=_.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(y)){const t=Q.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:Q.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=Q.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 Ht=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=vt(e,t,i),n=s.o,o=s.i,l=s.l,r=Q.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=Q.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+(n.get("_rtl")?" se-rtl":"")}),h=Q.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=Q.createElement("INPUT",{class:"__se__focus__temp__",style:"position: absolute !important; top: -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=Q.createElement("DIV",{class:"se-modal sun-editor-common"}),u=Q.createElement("DIV",{class:"se-modal-back",style:"display: none;"}),p=Q.createElement("DIV",{class:"se-modal-inner",style:"display: none;"});d.appendChild(u),d.appendChild(p),a.appendChild(d),a.appendChild(Q.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const g=Q.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(g),at.body.appendChild(a);let m=null,f=null;const _=Lt(s.buttons,i,n,o,l,!1),b=_.element;b.style.visibility="hidden",/inline/i.test(n.get("mode"))?(b.className+=" se-toolbar-inline",b.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(b.className+=" se-toolbar-balloon",b.style.width=n.get("toolbar_width"),b.appendChild(Q.createElement("DIV",{class:"se-arrow"}))),s.subButtons&&(f=Lt(s.subButtons,i,n,o,l,!1),m=f.element,m.style.visibility="hidden",m.className+=" se-toolbar-balloon se-toolbar-sub",m.style.width=n.get("toolbar.sub_width"),m.appendChild(Q.createElement("DIV",{class:"se-arrow"})));const v=t[0].key||null,y=[],C=new Map,w=s.statusbarContainer;let x=null;for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.options,a=Q.createElement("DIV",{class:"sun-editor"+(s.get("_rtl")?" se-rtl":"")}),h=Q.createElement("DIV",{class:"se-container"}),c=Q.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")});h.appendChild(Q.createElement("DIV",{class:"se-toolbar-shadow"}));const d=wt(i.key,n,a,s),u=d.bottomBar.statusbar,p=d.wysiwygFrame,g=d.placeholder;let m=d.codeView;const f=Q.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),_=Q.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);c.appendChild(f),c.appendChild(_),g&&c.appendChild(g),h.appendChild(Q.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),h.appendChild(c),u&&(w?x||(w.appendChild(Q.createElement("DIV",{class:"sun-editor"},u)),x=u):h.appendChild(u)),h.appendChild(r.cloneNode(!0));const b=i.key||null,v=Q.createElement("DIV",{class:"se-code-wrapper"},m);v.style.setProperty("display","none","important"),c.appendChild(v);const E=xt(n,s,m);if(m===E){const t=Q.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);v.insertBefore(t,m)}else m=E;const S={};n.get("type-options").includes("header")&&(S.inner=Q.createElement("DIV",{class:"se-document-lines",style:`height: ${s.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("type-options").includes("page")&&(S.page=Q.createElement("DIV",{class:"se-document-page"},null)),a.appendChild(h),y.push(b),C.set(b,ot(i,a,p,v,m,x||u,S,b))}const E=n.get("toolbar_container");if(E){const t=Q.createElement("DIV",{class:"sun-editor"+(n.get("_rtl")?" se-rtl":"")}),e=Q.createElement("DIV",{class:"se-container"});e.appendChild(b),m&&e.appendChild(m),t.appendChild(e),E.appendChild(t),E.appendChild(Q.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=C.get(v).get("container");t.insertBefore(b,t.firstElementChild),m&&t.insertBefore(m,t.firstElementChild)}return{context:rt(b,E,h,m,w),carrierWrapper:a,options:n,plugins:i,icons:o,lang:l,value:s.v,rootId:v,rootKeys:y,frameRoots:C,pluginCallButtons:_.pluginCallButtons,responsiveButtons:_.responsiveButtons,pluginCallButtons_sub:f?f.pluginCallButtons:[],responsiveButtons_sub:f?f.responsiveButtons:[]}},{NO_EVENT:Mt}=Y,At={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};let Bt=null,It=null;const Vt=function(t,e){return Bt=this.eventManager.removeGlobalEvent("keydown",Bt),It=this.eventManager.removeGlobalEvent("mousedown",It),this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,Q.removeClass(t,"se-copy-format-cursor"),Q.removeClass(e,"on"),!0},Rt=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],Ot=Rt.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);function zt(t,e){if("function"==typeof t._onCopyFormatInitMethod)return void t._onCopyFormatInitMethod();const i=t.frameContext.get("wysiwyg");t._onCopyFormatInfo=[...t.eventManager.__cacheStyleNodes],t._onCopyFormatInitMethod=Vt.bind(t,i,e),Q.addClass(i,"se-copy-format-cursor"),Q.addClass(e,"on"),Bt=t.eventManager.addGlobalEvent("keydown",(e=>{27===e.keyCode&&t._onCopyFormatInitMethod?.()})),It=t.eventManager.addGlobalEvent("mousedown",(s=>{i.contains(s.target)||s.target===e||t._onCopyFormatInitMethod?.()}))}function $t(e){const i=e.frameRoots;let s,n,o,l,r=e.options.get("historyStackDelayTime"),a=null;function h(t,i){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 c(t){const l=n[s],r=o[l],a=e.frameContext;s+=t;const c=t<0&&l!==n[s]&&r.index>0?l:n[s],d=o[c];d.index+=t;const u=d.value[d.index];i.get(c).get("wysiwyg").innerHTML=u.content,l!==c&&t<0&&1===s?s=0:l!==c&&t>0&&1===d.index?s++:(t<0&&d.index<1||t>0&&d.index>d.value.length)&&(s+=t);let p=c,g=u;if(t<0&&s>0&&0===d.index){const e=n[s+t];if(e!==c){const t=o[e];p=e,g=t.value[t.index]}}e.changeFrameContext(p),e.selection.setRange(A(g.s.path,g.frame),g.s.offset,A(g.e.path,g.frame),g.e.offset),e.focus(),s<0?s=0:s>=n.length&&(s=n.length-1),e._offCurrentController(),e._checkComponents(),e.char.display(),e._resourcesStateChange(a),a.has("documentType-use-header")&&a.get("documentType").reHeader(),h(a,d.index)}function d(t,e,l,r){let a,h;e?(a={path:M(e.startContainer,null,null),offset:e.startOffset},h={path:M(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 u(t){o[t]={value:[],index:-1},l[t]=i.get(t).get("wysiwyg").innerHTML}function p(t,r){e._checkComponents();const a=i.get(t),c=a.get("wysiwyg").innerHTML,p=o[t];!c||p.value[p.index]&&c===p.value[p.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.setAttribute("disabled",!0)}));for(let t=0,e=i.length;t<e;t++)n.includes(i[t])||u(i[t])}(p),0===p.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),d(c,r,t,1),1===s&&e.applyCommandTargets("undo",(t=>{t.removeAttribute("disabled")})),e.char.display(),h(a,p.index))}return{push(s,n){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,p(n,o)}),l):p(n,o)},check(e,i){a&&(t.clearTimeout(a),a=null,p(e,i))},undo(){s>0&&c(-1)},redo(){n.length-1>s&&c(1)},overwrite(t){d(i.get(t||e.status.rootKey).get("wysiwyg").innerHTML,null,e.status.rootKey,0)},reset(){e.applyCommandTargets("undo",(t=>{t.setAttribute("disabled",!0)})),e.applyCommandTargets("redo",(t=>{t.setAttribute("disabled",!0)})),e.applyCommandTargets("save",(t=>{t.setAttribute("disabled",!0)})),e.applyFrameRoots((t=>t.set("historyIndex",-1))),e.applyFrameRoots((t=>t.set("isChanged",!1))),s=-1,n=[],o={},l={};const t=e.rootKeys;for(let e=0,i=t.length;e<i;e++)u(t[e])},resetButtons(t,i){const l=!tt.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=>{i>0&&i<=h?t.removeAttribute("disabled"):t.setAttribute("disabled",!0)})),e.applyCommandTargets("redo",(t=>{i>-1&&i<h?t.removeAttribute("disabled"):t.setAttribute("disabled",!0)}));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=>{u?t.removeAttribute("disabled"):t.setAttribute("disabled",!0)})),e.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>o,resetDelayTime(t){r=t},destroy(){a&&t.clearTimeout(a),s=n=o=l=null}}}const Ft=function(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._w=t._w,this._d=t._d,this._shadowRoot=t._shadowRoot},Pt=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),{isMobile:Dt}=Y;function Wt(t){let e=t.target;this.editor.isSubBalloon&&!this.context.get("toolbar.sub.main")?.contains(e)&&this._hideToolbar_sub();const i=Q.isInputElement(e);if(this.menu._bindControllersOff&&t.stopPropagation(),i?this.editor._antiBlur=!1:this.editor.frameContext.get("wysiwyg").contains(this.selection.getNode())||this.editor.focus(),Q.getParentElement(e,".se-dropdown"))t.stopPropagation(),this.editor._notHideToolbar=!0;else{let s=e.getAttribute("data-command"),n=e.className;for(;e&&!s&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(n);)e=e.parentNode,s=e.getAttribute("data-command"),n=e.className;if(i&&/^INPUT$/i.test(e?.getAttribute("data-type"))){this.editor._antiBlur=this._inputFocus=!0,this.status.hasFocus||this.applyTagEffect();const e=t.target;if(!Q.isInputElement(e)||e.disabled)return;const i=this.plugins[s];if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof i.onInputChange&&(this.__inputPlugin={obj:i,target:e,value:e.value}),this.__inputBlurEvent=this.addEvent(e,"blur",(t=>{if(!i.isInputActive)try{const s=e.value.trim();"function"==typeof i.onInputChange&&s!==this.__inputPlugin.value&&i.onInputChange({target:e,value:s,event:t})}finally{this._w.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!i)return;"function"==typeof i.onInputKeyDown&&(this.__inputKeyEvent=this.addEvent(e,"keydown",(t=>{i.onInputKeyDown({target:e,event:t})})))}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")||(Dt?this.editor._antiBlur=!0:(t.preventDefault(),Y.isGecko&&s&&this._injectActiveEvent(e)))}s!==this.menu.currentDropdownName&&s!==this.editor._containerName||t.stopPropagation()}}function Ut(t){const e=Q.getCommandTarget(t.target);if(!e)return;let i=e,s="";for(;i&&!/se-menu-tray/.test(i.className)&&!s;)i=i.parentElement,s=i.getAttribute("data-key");if(!s)return;const n=this.plugins[s];n&&"function"==typeof n.action&&(t.stopPropagation(),n.action(e))}function Zt(t){this.editor.runFromTarget(t.target)}const{_w:qt}=Y;let Gt=null;function jt(){this.editor.status._onMousedown=!1,Gt=this.removeGlobalEvent(Gt)}function Xt(t,e){this.editor.status._onMousedown=!0,Gt&&jt.call(this),Gt=this.addGlobalEvent("mouseup",jt.bind(this)),t.get("isReadOnly")||Q.isNonEditable(t.get("wysiwyg"))||(this.format._isExcludeSelectionElement(e.target)?e.preventDefault():(this._setSelectionSync(),this._w.setTimeout(this.selection._init.bind(this.selection),0),!1!==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(e.target.nodeName)&&e.preventDefault())))}function Yt(t,e){!1!==this.triggerEvent("onMouseUp",{frameContext:t,event:e})&&this._callPluginEvent("onMouseUp",{frameContext:t,event:e})}function Kt(t,e){const i=e.target;if(t.get("isReadOnly"))return e.preventDefault(),Q.isAnchor(i)&&qt.open(i.href,i.target),!1;if(Q.isNonEditable(t.get("wysiwyg")))return;if(!1===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,!1);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.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&&!Q.isNonEditable(i)&&!Q.isList(l)){const t=this.selection.getRange();if(this.format.getLine(t.startContainer)===this.format.getLine(t.endContainer))if(Q.isList(l)){e.preventDefault();const t=n.nextElementSibling,i=Q.createElement("LI",null,n);l.insertBefore(i,t),this.editor.focus()}else Q.isWysiwygFrame(n)||this.component.is(n)||Q.isTableElements(n)&&!Q.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,null,[e.nodeName],!1),{parent:s,inner:n}=this.nodeTransform.createNestedNode(t);i.parentNode.insertBefore(s,i),n.appendChild(i),this.selection.setRange(i,Q.isZeroWith(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 Jt(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;!1!==Pt.get("__overInfo")&&this._overComponentSelect(e.target),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}function Qt(t,e){!1!==this.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&this._callPluginEvent("onMouseLeave",{frameContext:t,event:e})}const{_w:te,isOSX_IOS:ee}=Y,ie=/^(8|3[2-9]|40|46)$/,se=/^(3[7-9]|40)$/,ne=/^(8|46)$/,oe=/^(8|9|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145|229)$/,le=/^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145|229)$/,re=/^(13)$/,ae=new RegExp(K.zeroWidthSpace+"+","");let he=null;function ce(t){const e=t.lastChild,i=t.nextElementSibling;if(Q.isZeroWith(i))return Q.removeItem(i),e;const s=i.childNodes;for(;s[0];)t.appendChild(s[0]);return Q.removeItem(i),e}function de(t){const e=t.childNodes,i=t.previousElementSibling,s=e[0];if(Q.isZeroWith(i))return Q.removeItem(i),s;for(;e[0];)i.appendChild(e[0]);return Q.removeItem(t),s}function ue(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;this.selection._init();const i=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this.char.test(i,!0))return e.preventDefault(),e.stopPropagation(),!1;!1!==this.triggerEvent("onInput",{frameContext:t,event:e,data:i})&&!1!==this._callPluginEvent("onInput",{frameContext:t,event:e,data:i})&&this.history.push(!0)}function pe(t,e){if(this.editor.selectMenuOn||!e.isTrusted)return;let i=this.selection.getNode();if(Q.isInputElement(i))return;if(this.menu.currentDropdownName)return;const s=e.keyCode,n=e.shiftKey,o=e.ctrlKey||e.metaKey||91===s||92===s||224===s,l=e.altKey;if(this.isComposing=229===s,!o&&t.get("isReadOnly")&&!ie.test(s))return e.preventDefault(),!1;if(this.menu.dropdownOff(),this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),!1===this.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;if(o&&this.shortcuts.command(s,n))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;this._onShortcutKey&&(this._onShortcutKey=!1);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(!1===this._callPluginEvent("onKeyDown",{frameContext:t,event:e,range:r,line:h}))return;switch(s){case 8:{if(this.component.deselect(),he=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||Q.isEdgePoint(r.endContainer,r.endOffset,"front"))&&!r.endContainer.previousSibling&&this.format.isLine(h.previousElementSibling)){let t;return e.preventDefault(),e.stopPropagation(),r.collapsed?(t=de(h),this.selection.setRange(t,0,t,0),void this.history.push(!0)):(this.html.remove(),h.contains(r.startContainer)?(t=ce(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length)):(t=de(h),this.selection.setRange(t,0,t,0)),void this.history.push(!0))}if(!a&&!h.previousElementSibling&&0===r.startOffset&&!i.previousSibling&&!Q.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(Q.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||Q.isZeroWith(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.parentElement.replaceChild(Q.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&&Q.isZeroWith(s)){let t=s.parentNode.previousSibling;const e=s.parentNode.nextSibling;t||(e?t=e:(t=Q.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):Q.isEdgePoint(r.startContainer,r.startOffset)?Q.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,!1)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!0)){e.preventDefault(),e.stopPropagation();break}!a&&this.format.isEdgeLine(r.startContainer,r.startOffset,"start")&&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&&!Q.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){if(Q.isListCell(h)&&Q.isList(c)&&(Q.isListCell(c.parentNode)||h.previousElementSibling)&&(i===h||3===i.nodeType&&(!i.previousSibling||Q.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.parentNode;if(Q.isListCell(t)){e.preventDefault();let i=t;if(!t.contains(h)&&Q.isListCell(i)&&Q.isList(i.lastElementChild)){for(i=i.lastElementChild.lastElementChild;Q.isListCell(i)&&Q.isList(i.lastElementChild);)i=i.lastElementChild&&i.lastElementChild.lastElementChild;t=i}let s=t===c.parentNode?c.previousSibling:t.lastChild;s||(s=Q.createTextNode(K.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;Q.removeItem(h),0===c.children.length&&Q.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&&!Q.isWysiwygFrame(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!Q.isZeroWith(i.previousSibling.textContent.trim()))){t=!1;break}i=i.parentNode}if(t&&c.parentNode){e.preventDefault(),this.format.removeBlock(c,Q.isListCell(h)?[h]:null,null,!1,!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||Q.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&&Q.removeItem(h),!1===this.component.select(t.target,t.pluginName,!1)&&this.editor.blur()):this.component.is(s)&&(e.preventDefault(),e.stopPropagation(),Q.removeItem(s));break}if(t&&Q.isNonEditable(t.previousSibling)){e.preventDefault(),e.stopPropagation(),Q.removeItem(t.previousSibling);break}}break}case 46:if(this.component.deselect(),he=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(this.format.isLine(h)&&(!r.collapsed||Q.isEdgePoint(r.startContainer,r.endOffset,"end"))&&!r.startContainer.nextSibling&&this.format.isLine(h.nextElementSibling)){let t;return e.preventDefault(),e.stopPropagation(),r.collapsed?(ce(h),void this.history.push(!0)):(this.html.remove(),h.contains(r.startContainer)?(t=ce(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length)):(t=de(h),this.selection.setRange(t,0,t,0)),void this.history.push(!0))}if(!a&&h&&(r.endOffset===r.endContainer.textContent.length||i===h)){const t=i===h?this._isUneditableNode(r,!1):Q.isEdgePoint(r.endContainer,r.endOffset)?Q.getNextDeepestNode(r.endContainer,null):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),Q.isZeroWith(h.textContent)&&Q.removeItem(h),!1===this.component.select(i.target,i.pluginName,!1)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!1)){e.preventDefault(),e.stopPropagation();break}if((this.format.isLine(i)||null===i.nextSibling||Q.isZeroWith(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(),Q.isZeroWith(h)&&(Q.removeItem(h),Q.isTable(t))){let e=Q.getEdgeChild(t,Q.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,!1)&&this.editor.blur()):this.component.is(t)&&(e.stopPropagation(),Q.removeItem(t));break}}if(!a&&(Q.isEdgePoint(r.endContainer,r.endOffset)||i===h&&h.childNodes[r.startOffset])){const t=i===h&&h.childNodes[r.startOffset]||i;if(t&&Q.isNonEditable(t.nextSibling)){e.preventDefault(),e.stopPropagation(),Q.removeItem(t.nextSibling);break}if(this.component.is(t)){e.preventDefault(),e.stopPropagation(),Q.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),Q.isListCell(h)&&Q.isList(c)&&(i===h||3===i.nodeType&&(!i.nextSibling||Q.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();let t=Q.getArrayItem(h.children,Q.isList,!1);if(t=t||h.nextElementSibling||c.parentNode.nextElementSibling,t&&(Q.isList(t)||Q.getArrayItem(t.children,Q.isList,!1))){let i,s;if(e.preventDefault(),Q.isList(t)){const e=t.firstElementChild;for(s=e.childNodes,i=s[0];s[0];)h.insertBefore(s[0],t);Q.removeItem(e)}else{for(i=t.firstChild,s=t.childNodes;s[0];)h.appendChild(s[0]);Q.removeItem(t)}this.selection.setRange(i,0,i,0),this.history.push(!0)}break}break;case 9:{if(this.options.get("tabDisable"))break;if(e.preventDefault(),o||l||Q.isWysiwygFrame(i))break;const t=!r.collapsed||Q.isEdgePoint(r.startContainer,r.startOffset),s=this.format.getLines(null);i=this.selection.getNode();const a=[],c=[],d=Q.isListCell(s[0]),u=Q.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],Q.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(!Q.isZeroWith(t)){/^\s{1,4}$/.test(t.textContent)?Q.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=Q.getEdgeChild(c[0],"text",!1),i=Q.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("syncTab")){const e=Q.findTextIndexOnLine(h,r.startContainer,r.startOffset,this.component.is.bind(this.component)),i=this.format.isLine(h.previousElementSibling)?Q.findTabEndIndex(h.previousElementSibling,e,2):0;i>e&&(t=i-e+1)}const e=Q.createTextNode(new Array(t).join(" ")),i=this.html.insertNode(e,null,!1);if(!i)return!1;d||(p.sc=e,p.so=i.endOffset),u||(p.ec=e,p.eo=i.endOffset)}else{const t=Q.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&&(Q.isBreak(i)?c[s].insertBefore(t.cloneNode(!1),i):i.textContent=t.textContent+i.textContent);const i=Q.getEdgeChild(c[0],"text",!1),s=Q.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 13:{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=this.format.isEdgeLine(r.endContainer,r.endOffset,"end"),o=this.format.isEdgeLine(r.startContainer,r.startOffset,"start");if(n&&(/^H[1-6]$/i.test(h.nodeName)||/^HR$/i.test(h.nodeName))){this.__enterPrevent(e);let t=null;const i=this.format.addLine(h,this.options.get("defaultLine"));if(n&&n.length>0){t=n.pop();const e=t;for(;n.length>0;)t=t.appendChild(n.pop());i.appendChild(e)}if(t=t?t.appendChild(i.firstChild):i.firstChild,Q.isBreak(t)){const e=Q.createTextNode(K.zeroWidthSpace);t.parentNode.insertBefore(e,t),this.selection.setRange(e,1,e,1)}else this.selection.setRange(t,0,t,0);this.selection.scrollTo(r);break}if(c&&h&&!Q.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){const t=this.selection.getRange();if(Q.isEdgePoint(t.endContainer,t.endOffset)&&Q.isList(i.nextSibling)){this.__enterPrevent(e);const t=Q.createElement("BR"),s=Q.createElement("LI",null,t);h.parentNode.insertBefore(s,h.nextElementSibling),s.appendChild(i.nextSibling),this.selection.setRange(t,1,t,1),this.selection.scrollTo(r);break}if((3!==t.commonAncestorContainer.nodeType||!t.commonAncestorContainer.nextElementSibling)&&Q.isZeroWith(h.innerText.trim())&&!Q.isListCell(h.nextElementSibling)){this.__enterPrevent(e);let t=null;if(Q.isListCell(c.parentNode)){const e=h.parentNode.parentNode;c=e.parentNode;const i=Q.createElement("LI");i.innerHTML="<br>",Q.copyTagAttributes(i,h,this.options.get("lineAttrReset")),t=i,c.insertBefore(t,e.nextElementSibling)}else{let e;e=Q.isTableCell(c.parentNode)?"DIV":Q.isList(c.parentNode)?"LI":this.format.isLine(c.nextElementSibling)&&!this.format.isBlock(c.nextElementSibling)?c.nextElementSibling.nodeName:this.format.isLine(c.previousElementSibling)&&!this.format.isBlock(c.previousElementSibling)?c.previousElementSibling.nodeName:this.options.get("defaultLine"),t=Q.createElement(e);const i=this.format.removeBlock(c,[h],null,!0,!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&&Q.isBreak(o[l])&&(!o[l+1]||(!o[l+2]||Q.isZeroWith(o[l+2].textContent))&&3===o[l+1].nodeType&&Q.isZeroWith(o[l+1].textContent))&&l>0&&Q.isBreak(o[l-1])||!t&&Q.isZeroWith(i.textContent)&&Q.isBreak(a)&&(Q.isBreak(a.previousSibling)||!Q.isZeroWith(a.previousSibling.textContent))&&(!h||!Q.isBreak(h)&&Q.isZeroWith(h.textContent)))){t?Q.removeItem(o[l-1]):Q.removeItem(i);const e=this.format.addLine(s,this.format.isLine(s.nextElementSibling)&&!this.format.isBlock(s.nextElementSibling)?s.nextElementSibling:null);Q.copyFormatAttributes(e,s),this.selection.setRange(e,1,e,1),this.selection.scrollTo(r);break}if(t){this.html.insert(r.collapsed&&Q.isBreak(r.startContainer.childNodes[r.startOffset-1])?"<br>":"<br><br>",!1,!0,!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=Q.createElement("BR");this.html.insertNode(e,null,!0);const i=e.previousSibling,s=e.nextSibling;Q.isBreak(t)||Q.isBreak(i)||s&&!Q.isZeroWith(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.selection.scrollTo(r);break}if(r.collapsed&&(o||n)){this.__enterPrevent(e);const t=Q.createElement("BR"),s=Q.createElement(h.nodeName,null,t);Q.copyTagAttributes(s,h,this.options.get("lineAttrReset"));let l=t;do{if(!Q.isBreak(i)&&1===i.nodeType){const t=i.cloneNode(!1);t.appendChild(l),l=t}i=i.parentNode}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.selection.scrollTo(r);break}if(h){let i;e.stopPropagation();let s=0;if(r.collapsed)i=Q.isZeroWith(h)?this.format.addLine(h,h.cloneNode(!1)):this.nodeTransform.split(r.endContainer,r.endOffset,Q.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=this.html.remove();if(i=this.format.getLine(c.container,null),!i){Q.isWysiwygFrame(c.container)&&(this.__enterPrevent(e),t.get("wysiwyg").appendChild(a),i=a,Q.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s)),this.selection.scrollTo(r);break}const d=this.format.getBlock(c.container);if(i=i.contains(d)?Q.getEdgeChild(d,this.format.getLine.bind(this.format)):i,l){if(n&&!o)i.parentNode.insertBefore(a,c.prevContainer&&c.container!==c.prevContainer?i:i.nextElementSibling),i=a,s=0;else if(s=c.offset,o){const t=i.parentNode.insertBefore(a,i);n&&(i=t,s=0)}}else n&&o?(i.parentNode.insertBefore(a,c.prevContainer&&c.container===c.prevContainer?i.nextElementSibling:i),i=a,s=0):i=this.nodeTransform.split(c.container,c.offset,Q.getNodeDepth(h))}this.__enterPrevent(e),Q.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s),this.selection.scrollTo(r);break}}if(a){this.selection.scrollTo(r);break}c&&Q.getParentElement(c,"FIGCAPTION")&&Q.getParentElement(c,Q.isList)&&(this.__enterPrevent(e),h=this.format.addLine(h,null),this.selection.setRange(h,0,h,0),this.selection.scrollTo(r));break}}if(n&&(ee?l:o)&&32===s){e.preventDefault(),e.stopPropagation();const t=this.html.insertNode(Q.createTextNode(" "),null,!0);if(t&&t.container)return void this.selection.setRange(t.container,t.endOffset,t.container,t.endOffset)}if(!o&&!l&&!a&&!oe.test(s)&&Q.isBreak(r.commonAncestorContainer)){const t=Q.createTextNode(K.zeroWidthSpace);this.html.insertNode(t,null,!0),this.selection.setRange(t,1,t,1)}if(t.has("documentType-use-header")&&!r.collapsed&&!o&&!l&&!n&&!se.test(s))return void te.setTimeout((()=>{t.get("documentType").reHeader()}));let d=null;switch(s){case 38:this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling));break;case 37:if(Q.isEdgePoint(i,r.startOffset,"front")){const t=i.previousElementSibling||Q.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 40:this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling));break;case 39:if(Q.isEdgePoint(i,r.endOffset,"end")){const t=i.nextElementSibling||Q.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,!1)&&this.editor.blur())}function ge(t,e){if(this._onShortcutKey||this.menu.currentDropdownName)return;const i=e.keyCode,s=e.ctrlKey||e.metaKey||91===i||92===i||224===i,n=e.altKey;if(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)&&27!==i||!o.collapsed)){if(!this.editor.isBalloonAlways&&!this.editor.isSubBalloonAlways)return void(this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon());27!==i&&this._showToolbarBalloonDelay()}if(8===i&&Q.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const t=Q.createElement(this.format.isLine(this.status.currentNodes[0])&&!Q.isListCell(this.status.currentNodes[0])?this.status.currentNodes[0]:this.options.get("defaultLine"),null,"<br>");return l.appendChild(t),this.selection.setRange(t,0,t,0),this.applyTagEffect(),void this.history.push(!1)}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++)13===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)||Q.isList(l)||null===this._setDefaultLine(this.format.isBlock(a)?"DIV":this.options.get("defaultLine"))||(l=this.selection.getNode());if(!s&&!n&&!oe.test(i)&&3===l.nodeType&&K.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(ae)||"").length;t=o.startOffset-i,e=o.endOffset-i,l.textContent=l.textContent.replace(K.zeroWidthRegExp,""),this.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(ne.test(i)&&Q.isZeroWith(r?.textContent)&&!r.previousElementSibling){const t=this.options.get("retainStyleMode");"none"!==t&&he?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=te.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=te.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,he)):(this.__retainTimer=null,this._retainStyleNodes(r,he)):this._clearRetainStyleNodes(r)}if(this.char.test("",!1),t.has("documentType-use-header"))if(re.test(i)){t.get("documentType").reHeader();const e=Q.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}else{const e=Q.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==this.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&(s||n||le.test(i)||this.history.push(!0))}function me(t,e){const i=e.clipboardData;return!i||this._dataTransferAction("paste",e,i,t)}function fe(t,e){const i=e.clipboardData;if(!1===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()}function _e(t,e){const i=e.clipboardData;if(!1===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 be(t,e,i,s,n){n.preventDefault();const{sc:o,so:l,ec:r,eo:a}=this.selection.getEventLocationRange(n),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();d.height>0?(e.style.left=`${d.right+this._w.scrollX+c.x}px`,e.style.top=d.top+this._w.scrollY+c.y-5+"px",e.style.height=`${d.height+10}px`,e.style.display="block"):e.style.display="none"}function ve(t){t.style.display="none"}function ye(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.getEventLocationRange(i);if(Q.getParentElement(s,".se-disable-pointer"))return void i.preventDefault();if(Pt.get("__dragContainer")){if(i.preventDefault(),Pt.get("__dragContainer").contains(i.target))return void this.component.deselect();const t=Pt.get("__dragContainer");return this.component.deselect(),this.selection.setRange(s,n,o,l),void this.html.insertNode(t,null,!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:Ce,ON_OVER_COMPONENT:we,isMobile:xe}=Y,Ee=function(t){Ft.call(this,t),this._events=[],this._onButtonsCheck=new RegExp(`^(${Object.keys(t.options.get("_defaultStyleTagMap")).join("|")})$`,"i"),this._onShortcutKey=!1,this.isComposing=!1,this._balloonDelay=null,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakDir=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._vitualKeyboardHeight=0,this.__focusTemp=this.carrierWrapper.querySelector(".__se__focus__temp__"),this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null};function Se(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 Te(t,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._antiBlur)return;const s=this.editor.status.onSelected||this.editor.opendModal;this.editor._offCurrentController(),this.status.hasFocus=!0,Q.removeClass(this.editor.commandTargets.get("codeView"),"active"),Q.setDisabled(this.editor._codeViewDisabledButtons,!1),this.editor.changeFrameContext(i),this.history.resetButtons(i,null),s||(this.selection.removeRange(),this.applyTagEffect()),this._w.setTimeout((()=>{this.editor.isInline&&this.toolbar._showInline(),this.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})}),0)}function ke(t,e){this._inputFocus||this.editor._antiBlur||t.get("isCodeView")||(this.status.hasFocus=!1,this.editor.effectNode=null,(this.editor.isInline||this.editor.isBalloon)&&this._hideToolbar(),this.editor.isSubBalloon&&this._hideToolbar_sub(),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.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e}))}function Ne(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.editor.enableBackWrapper("ns-resize"),this.__resize_editor=this.addGlobalEvent("mousemove",Le.bind(this)),this.__close_move=this.addGlobalEvent("mouseup",He.bind(this))}function Le(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,Y.isResizeObserverSupported||this.editor.__callResizeFunction(e,s,null)}function He(){this.editor.disableBackWrapper(),this.__resize_editor&&(this.__resize_editor=this.removeGlobalEvent(this.__resize_editor)),this.__close_move&&(this.__close_move=this.removeGlobalEvent(this.__close_move))}function Me(t,e){e.preventDefault();const i=this._lineBreakComp;if(!i)return;t=t||this._lineBreakDir;const s=Q.isListCell(i.parentNode),n=Q.createElement(s?"BR":Q.isTableCell(i.parentNode)?"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{this.editor._antiBlur=!0;const t=s?n:n.firstChild;this.selection.setRange(t,1,t,1),this.history.push(!1)}finally{this.editor._antiBlur=!1}}}function Ae(){xe?this._scrollContainer():this.editor._offCurrentController(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this._resetFrameStatus()}function Be(){this.options.get("toolbar_sticky")>-1&&(this._vitualKeyboardHeight&&this.toolbar._sticky?this.toolbar._visible(!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()}function Ie(){this._vitualKeyboardHeight=Ce.innerHeight-Ce.visualViewport.height}function Ve(){this.options.get("toolbar_sticky")>-1&&(this._vitualKeyboardHeight&&this.toolbar._sticky?this.toolbar._visible(!1):this.toolbar._resetSticky())}function Re(){this.toolbar._visible(!0),this._vitualKeyboardHeight&&this.options.get("toolbar_sticky")>-1&&this.toolbar._resetSticky()}function Oe(t){let e=t.getSelection().anchorNode;this.editor.applyFrameRoots((t=>{if(e&&t.get("wysiwyg").contains(e)&&(e=null,this.selection._init(),this.applyTagEffect(),t.has("documentType-use-header"))){const e=Q.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}}))}function ze(){this._scrollContainer()}function $e(t){this.editor.changeFrameContext(t.get("key")),Q.addClass(this.editor.commandTargets.get("codeView"),"active"),Q.setDisabled(this.editor._codeViewDisabledButtons,!0)}Ee.prototype={addEvent(t,e,i,s){if(!t)return!1;if((!tt.is(t.length)||t.nodeName||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return!1;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,handler:i,useCapture:s});return{target:n>1?t:t[0],type:e,listener:i,handler:i,useCapture:s}},removeEvent(t){if(!t)return;let e=t.target;const i=t.type,s=t.listener,n=t.useCapture;if(!e)return!1;if((!tt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0===e.length)return!1;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){t&&("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))},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=this.editor.activeCommands,d=c.length;let u="";if(this.component.is(t)&&!this.component.__selectionSelected){const e=this.component.get(t);return void this.component.select(e.target,e.pluginName,!1)}for(;t.firstChild;)t=t.firstChild;const p=this.editor.frameContext,g=!p.get("isReadOnly");for(let p=t;!Q.isWysiwygFrame(p)&&p;p=p.parentNode)if(1===p.nodeType&&!Q.isBreak(p)){if(this._isNonFocusNode(p))return void this.editor.blur();if(u=p.nodeName.toLowerCase(),r.push(u),a.includes(u)&&!this.format.isLine(u)&&h.push(p),g)for(let t,e=0;e<d;e++)t=c[e],!l.includes(t)&&s.get(t)&&s.get(t).filter((e=>i[t]?.active(p,e))).length>0&&l.push(t);if(this.format.isLine(p)){if(!l.includes("outdent")&&s.has("outdent")&&(Q.isListCell(p)||p.style[e]&&tt.get(p.style[e],0)>0)&&s.get("outdent").filter((t=>!Q.isImportantDisabled(t)&&(t.removeAttribute("disabled"),!0))).length>0&&l.push("outdent"),!l.includes("indent")&&s.has("indent")){const t=Q.isListCell(p)&&!p.previousElementSibling;s.get("indent").filter((e=>!Q.isImportantDisabled(e)&&(t?e.setAttribute("disabled",!0):e.removeAttribute("disabled"),!0))).length>0&&l.push("indent")}}else n.test(u)&&(u=o[u]||u,l.push(u),Q.addClass(s.get(u),"active"))}return this._setKeyEffect(l),this.__cacheStyleNodes=h.reverse(),this.status.currentNodes=r.reverse(),this.status.currentNodesMap=l,this.editor.frameOptions.get("statusbar_showPathLabel")&&p.get("navigation")&&(p.get("navigation").textContent=this.options.get("_rtl")?this.status.currentNodes.reverse().join(" < "):this.status.currentNodes.join(" > ")),t},_injectActiveEvent(t){Q.addClass(t,"__se__active"),this.__geckoActiveEvent=this.addGlobalEvent("mouseup",(()=>{Q.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&&0!==t.length&&(l?l.active(null,t):/^outdent$/i.test(n)?Q.isImportantDisabled(t)||t.setAttribute("disabled",!0):/^indent$/i.test(n)?Q.isImportantDisabled(t)||t.removeAttribute("disabled"):Q.removeClass(t,"active"))}},_showToolbarBalloonDelay(){this._balloonDelay&&Ce.clearTimeout(this._balloonDelay),this._balloonDelay=Ce.setTimeout((()=>{Ce.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");this.menu._bindControllersOff||!(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=>1===t.nodeType&&"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),Q.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=Q.isTableCell(s),l=Q.isTableCell(n),r=t.commonAncestorContainer;if((o&&!s.previousElementSibling&&!s.parentElement.previousElementSibling||l&&!n.nextElementSibling&&!n.parentElement.nextElementSibling)&&s!==n)if(o){if(l)return Q.removeItem(Q.getParentElement(s,(t=>r===t.parentNode))),this.editor._nativeFocus(),!0;Q.removeItem(Q.getParentElement(s,(t=>r===t.parentNode)))}else Q.removeItem(Q.getParentElement(n,(t=>r===t.parentNode)));const a=1===e.nodeType?Q.getParentElement(e,".se-component"):null,h=1===i.nodeType?Q.getParentElement(i,".se-component"):null;return a&&Q.removeItem(a),h&&Q.removeItem(h),!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=Q.createElement(t||this.options.get("defaultLine")),r.innerHTML=n.innerHTML,0===r.childNodes.length&&(r.innerHTML=K.zeroWidthSpace),n.innerHTML=r.outerHTML,r=n.firstChild,o=Q.getEdgeChildNodes(r,null).sc,o||(o=Q.createTextNode(K.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),e=t.container;if(i.parentElement===e){const t=i.nextElementSibling?e:e.nextElementSibling,s=Q.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,!1),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)&&!Q.isWysiwygFrame(s)||!this.component.is(s.children[e.startOffset])&&!this.component.is(s.children[e.startOffset-1])){if(Q.getParentElement(i,Q.isExcludeFormat))return null;if(this.format.isBlock(i)&&i.childNodes.length<=1){let t=null;return 1===i.childNodes.length&&Q.isBreak(i.firstChild)?t=i.firstChild:(t=Q.createTextNode(K.zeroWidthSpace),i.appendChild(t)),void this.selection.setRange(t,1,t,1)}try{if(3===i.nodeType&&(r=Q.createElement(t||this.options.get("defaultLine")),i.parentNode.insertBefore(r,i),r.appendChild(i)),Q.isBreak(r.nextSibling)&&Q.removeItem(r.nextSibling),Q.isBreak(r.previousSibling)&&Q.removeItem(r.previousSibling),Q.isBreak(o)){const t=Q.createTextNode(K.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}}catch(e){this.editor.execCommand("formatBlock",!1,t||this.options.get("defaultLine")),this.selection.removeRange(),this.selection._init()}if(r&&(Q.isBreak(r.nextSibling)&&Q.removeItem(r.nextSibling),Q.isBreak(r.previousSibling)&&Q.removeItem(r.previousSibling),Q.isBreak(o))){const t=Q.createTextNode(K.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}this.editor.effectNode=null,this.editor._nativeFocus()}},_dataTransferAction(t,e,i,s){try{return this._setClipboardData(t,e,i,s),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}},async _setClipboardData(t,e,i,s){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=J.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");Q.getListChildNodes(t.body,J.textToAnchor),o=t.body.innerHTML}}l||(o=this.html.clean(o,!1,null,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,html: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,html: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("onPastAndDrop",{frameContext:s,event:e,file:d[t]});return!1}return!!c&&(o?(this.html.insert(o,!1,!0,!0),s.has("documentType-use-header")&&s.get("documentType").reHeader(),!1):void 0)},_addCommonEvents(){const t=Wt.bind(this),e=Zt.bind(this);this.addEvent(this.context.get("menuTray"),"mousedown",t,!1),this.addEvent(this.context.get("menuTray"),"click",Ut.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(),Y.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{Ce.setTimeout((()=>{this.toolbar.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{Ce.setTimeout((()=>{t.forEach((t=>{this.editor.__callResizeFunction(this.editor.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.options.get("closeModalOutsideClick")&&this.addEvent(this.carrierWrapper.querySelector(".se-modal-inner"),"click",(t=>{t.target===this.carrierWrapper.querySelector(".se-modal-inner")&&this.editor._offCurrentModal()}),!1),this.addEvent(Ce,"resize",Ae.bind(this),!1),this.addEvent(Ce,"scroll",Be.bind(this),!1),Y.isMobile&&(this.addEvent(Ce.visualViewport,"resize",Ie.bind(this),!1),this.addEvent(Ce.visualViewport,"scroll",Ve.bind(this),!1),this.addEvent(Ce.visualViewport,"scroll",J.debounce(Re.bind(this),200),!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=Jt.bind(this,t);this.addEvent(i,"mousemove",o,!1),this.addEvent(i,"mouseleave",Qt.bind(this,t),!1),this.addEvent(i,"mousedown",Xt.bind(this,t),!1),this.addEvent(i,"mouseup",Yt.bind(this,t),!1),this.addEvent(i,"click",Kt.bind(this,t),!1),this.addEvent(i,"input",ue.bind(this,t),!1),this.addEvent(i,"keydown",pe.bind(this,t),!1),this.addEvent(i,"keyup",ge.bind(this,t),!1),this.addEvent(i,"paste",me.bind(this,t),!1),this.addEvent(i,"copy",fe.bind(this,t),!1),this.addEvent(i,"cut",_e.bind(this,t),!1),this.addEvent(i,"dragover",be.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",ve.bind(this,n),!1),this.addEvent(i,"drop",ye.bind(this,t,n),!1),this.addEvent(i,"scroll",Se.bind(this,t,i),{passive:!0,useCapture:!1}),this.addEvent(i,"focus",Te.bind(this,t),!1),this.addEvent(i,"blur",ke.bind(this,t),!1),this.addEvent(s,"mousedown",$e.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=xe?"touchstart":"mousedown";if(this.addEvent([t.get("lineBreaker_t"),t.get("lineBreaker_b")],r,(t=>{t.preventDefault()}),!1),this.addEvent(t.get("lineBreaker_t"),r,Me.bind(this,"t"),!1),this.addEvent(t.get("lineBreaker_b"),r,Me.bind(this,"b"),!1),xe&&this.addEvent(i,"touchstart",o,{passive:!0,useCapture:!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=ze.bind(this);let h=t.get("originElement");for(;h=Q.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",Oe.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",Ne.bind(this),!1)):Q.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.handler,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.scrollY||t.scrollTop||0,i=t.scrollX||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.editor._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=tt.get(t.top,0)-(e-tt.get(s[0],0))+"px",t.left=tt.get(t.left,0)-(i-tt.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=tt.get(t.top,0)-(e-tt.get(s[0],0))+"px",t[s[1]]=tt.get(t[s[1]],0)-(i-tt.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){Pt.get("__dragMove")&&Pt.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?.show()},_resetFrameStatus(){Y.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.frameContext,s=i.get("fileBrowser");s&&"block"===s.area.style.display&&(s.body.style.maxHeight=Q.getClientSize().h-s.header.offsetHeight-50+"px"),this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._setMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown),this.viewer._resetFullScreenHeight()||(i.get("isCodeView")&&this.editor.isInline?this.toolbar._showInline():(this.editor._iframeAutoHeight(i),this.toolbar._sticky&&(this.context.get("toolbar.main").style.width=i.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=Q.createTextNode(K.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=0;t<i.length;t++)if(!1===i[t](e))return!1},_overComponentSelect(t){const e=Q.getParentElement(t,Q.isFigure);let i=this.component.get(t);i||e?(i||(i=this.component.get(e)),i&&!Q.hasClass(i.container,"se-component-selected")&&(this.editor._offCurrentController(),Pt.set("__overInfo",we),this.component.select(i.target,i.pluginName,!1))):null===Pt.get("__overInfo")||Q.hasClass(t,"se-drag-handle")||(this.component.__deselect(),Pt.set("__overInfo",null))},__removeInput(){this._inputFocus=this.editor._antiBlur=!1,this.__inputBlurEvent=this.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null},__enterPrevent(t){t.preventDefault(),xe&&this.__focusTemp.focus()},constructor:Ee};const Fe=Ee;const Pe=11.7*Y.DPI*96,De=function(t,e){if(this.editor=t,this.fc=e,this.ww=e.get("wysiwyg"),this.wwFrame=e.get("wysiwygFrame"),this.wwWidth=-1,this.innerHeaders=[],this._wwHeaders=[],this.inner=null,this.page=null,this.pageHeight=-1,this.pages=[],this.pages_line=[],this.useHeader=t.options.get("type-options").includes("header"),this.usePage=t.options.get("type-options").includes("page"),this.useHeader){const t=this._getHeaders(),i=this.inner=e.get("documentTypeInner").querySelector(".se-document-lines-inner");let s="";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s+=`<div class="se-doc-item se-doc-h${tt.get(e.nodeName)}">${e.textContent}</div>`;i.innerHTML=s,this.innerHeaders=i.querySelectorAll("div"),this.editor.eventManager.addEvent(i,"click",We.bind(this,this.ww))}this.usePage&&(this.page=e.get("documentTypePage"))};function We(t,e){e.preventDefault();try{this.editor._antiBlur=!0;const t=e.target;if(Q.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.editor.selection.scrollTo(i)}}finally{this.editor._antiBlur=!1}}De.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${tt.get(s.nodeName)}`,o=i[l],l<i.length)o.classList.contains(n)&&o.textContent===s.textContent||(o.textContent=s.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=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")},rePage(){if(!this.page)return;const t=this.wwFrame.scrollHeight;if(this.pageHeight===t)return;this.pageHeight=t;const e=this.page,i=this.ww.scrollTop,s=this.wwFrame.offsetWidth+1,n=Math.ceil(t/Pe);this.page.innerHTML="",this.pages=[];for(let t=0;t<n;t++){const n=Q.createElement("DIV",{style:`top:${t*Pe+i}px`,innerHTML:t+1},`<div class="se-document-page-line" style="width: ${s}px;"></div>${t+1}`);e.appendChild(n),this.pages.push(n)}this.pages_line=this.page.querySelectorAll(".se-document-page-line")},scrollPage(){const t=this.wwFrame.scrollTop,e=this.pages;for(let i=0,s=e.length;i<s;i++)e[i].style.top=i*Pe-t+"px"},resizePage(){const t=this.wwFrame.offsetWidth+1;if(t===this.wwWidth)return;this.wwWidth=t;const e=this.pages_line;for(let i=0,s=e.length;i<s;i++)e[i].style.width=`${t}px`},on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(Q.removeClass(this.innerHeaders,"active"),Q.addClass(e,"active"))},onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)},_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:De};const Ue=De;const Ze=function(t){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.notice=t.notice,this.offset=t.offset,this.selection=t.selection,this.shortcuts=t.shortcuts,this.toolbar=t.toolbar,this.viewer=t.viewer,t.subToolbar&&(this.subToolbar=t.subToolbar)},qe=function(t){Ft.call(this,t)};function Ge(e){e&&!$(e,"se-blink")&&(F(e,"se-blink"),t.setTimeout((()=>{P(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 Ge(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("utf-8").encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e)},display(){const e=this.editor.frameContext.get("charCounter");e&&t.setTimeout((()=>{e.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&&(Ge(this.editor.frameContext.get("charWrapper")),i>0))return!1}return!0},constructor:qe};const je=qe;const Xe=function(t){Ft.call(this,t),Ze.call(this,t)},{_w:Ye,ON_OVER_COMPONENT:Ke}=Y,Je=/^(1[7-9]|20|27|45|11[2-9]|12[0-3]|144|145)$/,Qe=2147483645,ti=function(t,e,i,s){Xe.call(this,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,this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsHide=!!i.parentsHide,this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this._initMethod="function"==typeof i.initMethod?i.initMethod:null,this.__globalEventHandlers={keydown:ni.bind(this),mousedown:oi.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",ei.bind(this)),this.eventManager.addEvent(e,"mouseenter",ii.bind(this)),this.eventManager.addEvent(e,"mouseleave",si.bind(this))};function ei(t){const e=Q.getCommandTarget(t.target);e&&(t.stopPropagation(),t.preventDefault(),this.inst.controllerAction(e))}function ii(t){this.editor.currentControllerName=this.kind,this.parents.length>0&&this.isInsideForm||(t.target.style.zIndex=2147483647)}function si(t){this.parents.length>0&&this.isInsideForm||(t.target.style.zIndex=Qe)}function ni(t){if(this._checkFixed())return;const e=t.keyCode;!(t.ctrlKey||t.metaKey||91===e||92===e||224===e)&&Je.test(e)&&(this.form.contains(t.target)||this._checkForm(t.target)||this.editor._fileManager.pluginRegExp.test(this.kind)&&27!==e||this.close())}function oi({target:t}){this.inst?._element?.contains(t)?this.isOpen=!1:(this.isOpen=!0,t===this.inst._element||t===this.currentTarget||this._checkFixed()||this.form.contains(t)||this._checkForm(t)||this.close(!0))}ti.prototype={open(t,e,{isWWTarget:i,initMethod:s,disabled:n,addOffset:o}={}){if(Pt.get("__overInfo")===Ke)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(),(n??this.disabled)&&Q.setDisabled(this.editor._controllerOnDisabledButtons,!0),this.currentTarget=t,this.currentPositionTarget=e||t,this.isWWTarget=i??this.isWWTarget,"function"==typeof s&&(this._initMethod=s),this.editor.currentControllerName=this.kind,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=Qe)})),this.parentsHide&&this.parents.forEach((t=>{t.style.display="none"})),this.__addGlobalEvent(),this._setControllerPosition(this.form,this.currentPositionTarget);const r=this.selection.isRange(t);this._controllerOn(this.form,t,r),this._w.setTimeout((()=>Pt.set("__overInfo",!1)),0)},close(t){this.isOpen&&(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)},resetPosition(t){this._setControllerPosition(this.form,t||this.currentPositionTarget)},_controllerOn(t,e,i){const s={position:this.position,inst:this,form:t,target:e,isRangeTarget:i,notInCarrier:!this.carrierWrapper.contains(t)};!1!==this.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.editor.frameContext,params:s})&&(t.style.display="block",this._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._antiBlur=!0,this.editor.status.onSelected=!0,this.triggerEvent("onShowController",{caller:this.kind,frameContext:this.editor.frameContext,params: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.disabled&&Q.setDisabled(this.editor._controllerOnDisabledButtons,!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._antiBlur=!1,this.editor._controllerTargetContext=null,Ye.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){if(t.style.zIndex=2147483646,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(!this.offset.setAbsPosition(t,e,{addOffset:this.__addOffset,position:this.position,isWWTarget:this.isWWTarget,inst:this}))return void this.hide();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(Q.isWysiwygFrame(t))return!1;if(Q.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&&(Q.getParentElement(t,".se-controller")||t?.contains(this.inst._element))},constructor:ti},ti.CreateHTML=function(){return Q.createElement("DIV",{class:""},"")};const li=ti,ri=function(t,e){Ft.call(this,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=[],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=[],this.__eventHandlers={mousedown:hi.bind(this.eventManager),mousemove:ci.bind(this),click:di.bind(this),keydown:ai.bind(this)},this.__globalEventHandlers={keydown:ui.bind(this),mousedown:pi.bind(this),click:gi.bind(this)}};function ai(t){let e;switch(t.keyCode){case 38: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 40: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 37:t.preventDefault(),t.stopPropagation(),e=-1;break;case 39:t.preventDefault(),t.stopPropagation(),e=1;break;case 13:case 32:this.index>-1?(t.preventDefault(),t.stopPropagation(),this._select(this.index)):this.close()}e&&this._moveItem(e)}function hi(t){if(Y.isGecko){const e=Q.getParentElement(t.target,".se-select-item");e&&this._injectActiveEvent(e)}}function ci(t){Q.addClass(this.form,"se-select-menu-mouse-move");const e=t.target.getAttribute("data-index");e&&(this.index=1*e)}function di(t){let e=t.target,i=null;for(;!i&&!/UL/i.test(e.tagName)&&!Q.hasClass(e,"se-select-menu");)i=e.getAttribute("data-index"),e=e.parentNode;i&&this._select(1*i)}function ui(t){/27/.test(t.keyCode)&&this.close()}function pi(t){this.form.contains(t.target)||(t.target!==this._refer?this.close():Q.isInputElement(t.target)||(this._bindClose_click=this.eventManager.addGlobalEvent("click",this.__globalEventHandlers.click,!0)))}function gi(t){this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click),t.target===this._refer&&(t.stopPropagation(),this.close())}ri.prototype={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=this.form.querySelectorAll("li"),this.menuLen=this.menus.length},on(t,e,i){i||(i={}),this._refer=t,this._keydownTarget=Q.isInputElement(t)?t:this._w,this._selectMethod=e,this.form=Q.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,Q.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&&(Q.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){Q.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let i=0;i<e;i++)i===t?Q.addClass(this.menus[i],"active"):Q.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",Q.removeClass(o,"se-select-menu-scroll"),Q.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,_=Q.getClientSize().h-(m-this._w.scrollY+f),b=c?f:0;let v=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){v=0;break}v=m-4+b,v>=38&&(o.style.height=v+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(_<o.offsetHeight+b){if(!s){v=0;break}v=_-4+b,v>=38&&(o.style.height=v+"px")}u=g+(c?0:f)}if(v<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 y=this.editor.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-this._w.scrollX+y,C<0&&(d=d=h+a+1);break;case"true-right":C=this._w.innerWidth-(y+r),C<0&&(d=h-r-1);break;case"false-center":{C=this._w.innerWidth-(y+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":y<0&&(d-=y-4)}if(i){const t=o.firstElementChild.querySelector(i);t&&(this._onItem=t,Q.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""},_select(t){this.checkList&&Q.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(){0!==this.__events.length&&(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=[])},__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))},constructor:ri};const mi=ri,{ON_OVER_COMPONENT:fi}=Y,_i={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize",lw:"w-resize",th:"n-resize",rw:"e-resize",bh:"s-resize"};let bi=!1,vi=!1,yi=0,Ci=0;const wi=function(t,e,i){Xe.call(this,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=Ri(e),!e)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${e.c}" data-value="${e.v}" class="${e.t?"se-btn-w-auto ":""}se-btn se-tooltip">\n\t\t\t\t\t\t${n[e.i]||e.t||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 Q.createElement("DIV",{class:"se-controller se-controller-resizing"+(i?"":" se-empty-controller")},i)}(this,e||[]);this.controller=new li(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 mi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,Li.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 mi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,Hi.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=tt.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 mi(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,Mi.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=0,this._height=0,this._element_w=0,this._element_h=0,this._element_l=0,this._element_t=0,this._resize_w=0,this._resize_h=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=Ai.bind(this),this.__containerResizing=Ti.bind(this),this.__containerResizingOff=ki.bind(this),this.__containerResizingESC=Ni.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.__onResizeESCEvent=null,this.__fileManagerInfo=!1,this.eventManager.addEvent(this.alignButton,"click",Bi.bind(this)),this.eventManager.addEvent(this.asButton,"click",Ii.bind(this)),this.eventManager.addEvent(this.resizeButton,"click",Vi.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 Q.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",Si.bind(this))}}))};function xi(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"}function Ei(t){const e=t.style.transform;return e?{r:1*((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 Si(t){t.stopPropagation(),t.preventDefault();const e=Pt.get("__figureInst"),i=e._resize_direction=t.target.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,e.editor.frameContext.get("_figure").main.style.float=/l/.test(i)?"right":/r/.test(i)?"left":"none",this.editor.enableBackWrapper(_i[i]);const{w:s,h:n}=this.getSize(e._element);if(bi=vi=!1,yi=Ci=0,!this.isVertical){const t=!s||/auto|%$/.test(s),o=!n||/auto|%$/.test(n);if("tl|bl|tr|br".includes(i)&&t&&o?bi=!0:"lw|rw".includes(i)&&t&&(vi=!0),bi||vi){const t=e._cover||e._element;Ci=t.offsetWidth,yi=J.getWidthInPercentage(t,this.editor.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=e.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=e.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const o=this.editor.frameContext.get("_figure").display;o.style.display="block",Q.changeTxt(o,s+" x "+n)}function Ti(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=yi?this._resize_w/Ci*yi*100:this._resize_w;Q.changeTxt(this.editor.frameContext.get("_figure").display,yi?tt.get(c>100?100:c,2).toFixed(2)+"%":c+" x "+this._resize_h)}function ki(){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-tt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+tt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;tt.get(t,0)>i&&(e=Math.round(e/t*i),t=i)}if(bi||vi){t=t/(this._cover||this._element).offsetWidth*yi*100,t=tt.get(t>100?100:t,2)+"%",this._setPercentSize(t,vi?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,!1)}function Ni(t){/^27$/.test(t.keyCode)&&(this._offResizeEvent(),this.component.select(this._element,this.kind,!1))}function Li(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.component.select(this._element,this.kind,!1)}function Hi(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}function Mi(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!==tt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.component.select(this._element,this.kind,!1)}function Ai(){this.editor.frameContext.get("_figure").main.style.display="none",this.editor._figureContainer=null}function Bi(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}function Ii(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}function Vi(){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=tt.get(e);s=100===t?"auto":"resize_percent"+t}}else"auto"===i&&("auto"===e?s="auto":/%$/.test(e)&&(s="resize_percent"+tt.get(e)));this.selectMenu_resize.open("",'[data-command="'+s+'"]')}function Ri(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:tt.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"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:undefined,i:r}:null}wi.CreateContainer=function(t,e){return Q.createElement("DIV",{class:"se-component"+(e?" "+e:"")},Q.createElement("FIGURE",null,t)),wi.GetContainer(t)},wi.CreateInlineContainer=function(t,e){return Q.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),wi.GetContainer(t)},wi.CreateInlineContainer=function(t,e){return Q.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),wi.GetContainer(t)},wi.CreateCaption=function(t,e){const i=Q.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(i),i},wi.GetContainer=function(t){const e=Q.getParentElement(t,"FIGURE"),i=Q.getParentElement(t,"SPAN");return{target:t,container:Q.getParentElement(t,wi.__is)||e,cover:e,inlineCover:Q.hasClass(i,"se-inline-component")?i:null,caption:Q.getEdgeChild(t.parentElement,"FIGCAPTION")}},wi.GetRatio=function(t,e,i){let s=1,n=1;if(/\d+/.test(t)&&/\d+/.test(e)){if((!tt.is(t)&&t.replace(/\d+|\./g,"")||i||"px")===(!tt.is(e)&&e.replace(/\d+|\./g,"")||i||"px")){const i=tt.get(t,4),o=tt.get(e,4);s=i/o,n=o/i}}return{w:tt.get(s,4),h:tt.get(n,4)}},wi.CalcRatio=function(t,e,i,s){if(/\d+/.test(t)&&/\d+/.test(e)){const n=!tt.is(t)&&t.replace(/\d+|\./g,"")||i||"px",o=!tt.is(e)&&e.replace(/\d+|\./g,"")||i||"px";if(n===o){const i="%"===n?2:0,l=t,r=e;e=tt.get(s.h*tt.get(l,i),i)+o,t=tt.get(s.w*tt.get(r,i),i)+n}}return{w:t,h:e}},wi.__is=function(t){return Q.hasClass(t,"se-component")||/^(HR)$/.test(t?.nodeName)},wi.prototype={close(){this.editor._antiBlur=!1,Q.removeClass(this._cover,"se-figure-selected"),this.controller.close(),Q.hasClass(this._w.event?.target,"se-drag-handle|sun-editor-editable")||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 target element is null.");Pt.get("__overInfo")!==fi?this.editor._offCurrentController():s=!0;const l=wi.GetContainer(t);if(!l.container)return{container:null,cover:null,width:t.style.width||(tt.is(t.width)?"":t.width)||"",height:t.style.height||(tt.is(t.height)?"":t.height)||""};Pt.set("__figureInst",this),this._setFigureInfo(l);const r=n&&(this._cover||this._container)||t,a=r.offsetWidth||"",h=r.offsetHeight||"",{top:c,left:d,scrollX:u,scrollY:p}=this.offset.getLocal(r),g=(t.getAttribute("data-se-size")||"").split(","),m=wi.GetRatio(g[0]||tt.get(t.style.width,2)||a,g[1]||tt.get(t.style.height,2)||h,this.sizeUnit),f={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:m,w:a,h,t:c,l:d,width:g[0]||"auto",height:g[1]||"auto",originWidth:t.naturalWidth||t.offsetWidth,originHeight:t.naturalHeight||t.offsetHeight};if(this._width=f.width,this._height=f.height,o||this.__fileManagerInfo)return f;const _=this.editor.frameContext.get("_figure");this.editor._figureContainer=_.main,_.main.style.top=c+"px",_.main.style.left=d+"px",_.main.style.width=(this.isVertical?h:a)+"px",_.main.style.height=(this.isVertical?a:h)+"px",_.border.style.top="0px",_.border.style.left="0px",_.border.style.width=(this.isVertical?h:a)+"px",_.border.style.height=(this.isVertical?a:h)+"px",this.__offset={left:d+u,top:c+p},this.editor.opendControllers.push({position:"none",form:_.main,target:r,inst:this,notInCarrier:!0});const b=/%$/.test(t.style.width)&&/%$/.test(l.container.style.width)?tt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===b?Q.addClass(this.percentageButtons[t],"active"):Q.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?Q.addClass(this.captionButton,"active"):Q.removeClass(this.captionButton,"active")),_.display.style.display=i||this._inlineCover?"none":"",_.border.style.display=s?"none":"",_.main.style.display="block",Pt.get("__overInfo")!==fi){this._setAlignIcon(),this._setAsIcon(),this.editor._visibleControllers(!0,!0);const i=this.getSize(t);Q.changeTxt(_.display,this.lang["none"===this.align?"basic":this.align]+" ("+i.w+", "+i.h+")"),this._displayResizeHandles(!e);const s=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"]'),n=this._inlineCover?"none":"";s.forEach((t=>{t.style.display=n})),Q.removeClass(this._cover,"se-figure-over-selected"),this.controller.open(_.main,null,{initMethod:this.__offContainer,isWWTarget:!1,addOffset:null}),this._w.setTimeout((()=>Pt.set("__overInfo",!1)),0)}else Q.addClass(this._cover,"se-figure-over-selected");return Q.addClass(this._cover,"se-figure-selected"),this._element_w=this._resize_w=a,this._element_h=this._resize_h=h,this._element_l=d,this._element_t=c,this._inlineCover||Pt.get("__overInfo")===fi&&!Q.hasClass(l.container,"se-input-component")||this._setDragEvent(_.main),f},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=wi.GetContainer(t);if(!e.container)return{w:"",h:t.style.height};return{w:(/%$/.test(t.style.width)?(e.container&&tt.get(e.container.style.width,2)||100)+"%":t.style.width)||"auto",h:(e.inlineCover?e.inlineCover.style.height:tt.get(e.cover.style.paddingBottom,0)>0&&!this.isVertical?e.cover.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(e.container&&tt.get(e.container.style.height,2)||100)+"%":t.style.height)||"auto"}},setAlign(t,e){t||(t=this._element),this.align=e=e||"none";const i=wi.GetContainer(t);if(!i.cover)return;const s=i.container,n=i.cover;if(/%$/.test(t.style.width)&&"center"===e&&!this.component.isInline(s)?(s.style.minWidth="100%",n.style.width=s.style.width):(s.style.minWidth="",n.style.width=this.isVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),Q.hasClass(s,"__se__float-"+e)||(Q.removeClass(s,this._floatClassStr),Q.addClass(s,"__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}=wi.GetContainer(t),{w:n,h:o}=this.getSize(t),l=t.cloneNode(!1);switch(e){case"inline":{if(s)break;this.component.deselect();const t=i.nextElementSibling,e=i.parentElement;l.style.width="",l.style.height="";const r=wi.CreateInlineContainer(l);Q.addClass(r.container,i.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(r,n,o);const a=Q.createElement(this.options.get("defaultLine"),null,r.container);e.insertBefore(a,t),Q.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&&Q.isZeroWith(e.previousElementSibling)&&Q.removeItem(e.previousElementSibling),l.style.width="",l.style.height="";const r=wi.CreateContainer(l);Q.addClass(r.container,i.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(r,n,o),(e||t.container).parentElement.insertBefore(r.container,e);break}}},_asFormatChange(t,e,i){const s=this.kind;t.target.onload=()=>this.component.select(t.target,s,!1),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=Ei(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)Q.removeItem(this._caption),this._w.setTimeout(this.component.select.bind(this.component,n,this.kind),0);else{const t=wi.CreateCaption(this._cover,this.lang.caption),e=Q.getEdgeChild(t,(t=>3===t.nodeType));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"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,!1))}},retainFigureFormat(t,e,i){const s=this.component.isInline(t);let n=this.format.isBlock(e.parentNode)||Q.isWysiwygFrame(e.parentNode)?e:Q.isAnchor(e.parentNode)?e.parentNode:this.format.getLine(e)||e;if(Q.getParentElement(e,Q.isExcludeFormat))n=i&&i!==e?i:e,n.parentNode.replaceChild(t,n);else if(s&&this.format.isLine(n)){const i=s&&/^SPAN$/i.test(e.parentElement)?e.parentElement:e;i.parentElement.replaceChild(t,i)}else if(Q.isListCell(n)){const i=Q.getParentElement(e,(t=>t.parentNode===n));n.insertBefore(t,i),Q.removeItem(e),this.nodeTransform.removeEmptyNode(i,null,!0)}else if(this.format.isLine(n)){const i=Q.getParentElement(e,(t=>t.parentNode===n));n=this.nodeTransform.split(n,i),n.parentNode.insertBefore(t,n),Q.removeItem(e),this.nodeTransform.removeEmptyNode(n,null,!0)}else if(this.format.isLineOnly(n.parentNode)){const e=n.parentNode;e.parentNode.insertBefore(t,n.previousSibling?e.nextElementSibling:e),0===this.fileManager.__updateTags.map((t=>n.contains(t))).length&&Q.removeItem(n)}else n=Q.isFigure(n.parentNode)?Q.getParentElement(n.parentNode,wi.__is):n,n.parentNode.replaceChild(t,n)},deleteTransform(t){t||(t=this._element);const e=(t.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,t.style.maxWidth="",t.style.transform="",t.style.transformOrigin="",this._deleteCaptionPosition(t),this._applySize(e[0]||"auto",e[1]||"","")},setTransform(t,e,i,s){try{this.__preventSizechange=!0;const n=Ei(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=tt.get(e,0),i=tt.get(i,0);const r=(t.getAttribute("data-se-size")||"auto,auto").split(",");let a="";if(/auto|%$/.test(r[0])&&!l)"auto"===r[0]&&"auto"===r[1]?this._setAutoSize():this._setPercentSize(r[0],r[1]);else{const n=wi.GetContainer(t),o=n.cover||n.inlineCover,r=e||t.offsetWidth,h=i||t.offsetHeight,c=(l?h:r)+"px",d=(l?r:h)+"px";if(this._deletePercentSize(),this._applySize(r+"px",h+"px",""),o.style.width=c,o.style.height=n.caption||n.inlineCover?"":d,l){a=90===s||-270===s?h/2+"px "+h/2+"px 0":r/2+"px "+r/2+"px 0"}}t.style.transformOrigin=a,this._setRotate(t,s,n.x,n.y),t.style.maxWidth=l?"none":"",this._setCaptionPosition(t)}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(Ei(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=tt.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=tt.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)?tt.get(tt.get(e,2)/100*tt.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)||tt.get(e,0)?tt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):tt.is(e)?e+"%":e;const i=/%$/.test(e);this._container.style.width=tt.is(t)?t+"%":t,this._container.style.height="",this._inlineCover!==this._cover&&(this._cover.style.width="100%",this._cover.style.height=e),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=this.autoRatio?"100%":i?"":e,"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(t,e),this._setCaptionPosition(this._element),this._saveCurrentSize()},_deletePercentSize(){this._cover.style.width="",this._cover.style.height="",this._container.style.width="",this._container.style.height="",Q.removeClass(this._container,this._floatClassStr),Q.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&&Q.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])},_setAsIcon(){this.asButton&&Q.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=Q.getEdgeChild(Q.getParentElement(t,"FIGURE"),"FIGCAPTION");e&&(e.style.marginTop=(this.isVertical?t.offsetWidth-t.offsetHeight:0)+"px")},_deleteCaptionPosition(t){const e=Q.getEdgeChild(Q.getParentElement(t,"FIGURE"),"FIGCAPTION");e&&(e.style.marginTop="")},_displayResizeHandles(t){t=t?"flex":"none",this.controller.form.style.display=t;const e=this.editor.frameContext.get("_figure"),i=e.handles;for(let e=0,s=i.length;e<s;e++)i[e].style.display=t;"none"===t?(Q.addClass(e.main,"se-resize-ing"),this.__onResizeESCEvent=this.eventManager.addGlobalEvent("keydown",this.__containerResizingESC)):Q.removeClass(e.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.editor._offCurrentController(),this.editor.disableBackWrapper()},_setDragEvent(t){const e=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");Q.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",Pt.set("__dragHandler",e),Pt.set("__dragContainer",this._container),Pt.set("__dragCover",this._cover),Pt.set("__dragMove",xi.bind(this,e,t)),Pt.get("__dragMove")(),e.style.display="block"},constructor:wi};const Oi=wi,{_w:zi,ON_OVER_COMPONENT:$i,isMobile:Fi}=Y,Pi=/^(3[7-9]|40)$/,Di=/^3[7-8]$/,Wi=function(t){Ft.call(this,t),this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.__globalEvents={copy:Yi.bind(this),cut:Ki.bind(this),keydown:Ji.bind(this),mousedown:Xi.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.editor.applyFrameRoots((t=>{const e=Q.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.icons.selection);t.get("wrapper").appendChild(e),this.eventManager.addEvent(e,"mouseenter",Ui.bind(this)),this.eventManager.addEvent(e,"mouseleave",Zi.bind(this)),this.eventManager.addEvent(e,"dragstart",qi.bind(this)),this.eventManager.addEvent(e,"dragend",Gi.bind(this)),this.eventManager.addEvent(e,"click",ji.bind(this))}))};function Ui(){this.editor._antiBlur=!0,this.editor._visibleControllers(!1,Q.hasClass(Pt.get("__dragHandler"),"se-drag-handle-full")),Q.addClass(Pt.get("__dragCover")||Pt.get("__dragContainer"),"se-drag-over")}function Zi(){this.editor._antiBlur=!1,Q.hasClass(Pt.get("__dragHandler"),"se-drag-handle-full")||this.editor._visibleControllers(!0,!0),Q.removeClass([Pt.get("__dragCover"),Pt.get("__dragContainer")],"se-drag-over")}function qi(t){const e=Pt.get("__dragCover")||Pt.get("__dragContainer");e?(this.editor._antiBlur=!1,Q.addClass(Pt.get("__dragHandler"),"se-dragging"),Q.addClass(Pt.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.options.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}function Gi(){this.editor._antiBlur=!1,Q.removeClass([Pt.get("__dragHandler"),Pt.get("__dragContainer")],"se-dragging"),this._removeDragEvent()}function ji({target:t}){if(!Q.hasClass(t,"se-drag-handle-full"))return;const e=Pt.get("__dragInst");this._removeDragEvent(),this.select(e.currentTarget,e.currentPluginName,!1)}function Xi({target:t}){this.currentTarget?.contains(t)||Q.getParentElement(t,".se-controller")||Q.hasClass(t,"se-drag-handle")||this.currentPluginName===this.editor.currentControllerName&&this.editor.opendControllers.some((({form:e})=>e.contains(t)))||this.deselect()}function Yi(t){if(Q.isInputElement(t.target)&&Q.getParentElement(t.target,".se-modal"))return;const e=this.info;e&&(Qi(t,e.container,t.clipboardData),Q.addClass(e.container,"se-copy"),zi.setTimeout((()=>{Q.removeClass(e.container,"se-copy")}),120))}function Ki(t){const e=this.info;e&&(Qi(t,e.container,t.clipboardData),this.deselect(),Q.removeItem(e.container))}async function Ji(t){if(this.editor.selectMenuOn)return;const e=t.keyCode;if(t.ctrlKey||t.metaKey||91===e||92===e||224===e){if(17!==e){const i=this.editor.shortcutsKeyMap.get(e+(t.shiftKey?1e3:0));/^(redo|undo)$/.test(i?.c)&&(t.preventDefault(),t.stopPropagation(),this.editor.run(i.c,i.t,i.e))}}else{if((8===e||46===e)&&(t.preventDefault(),t.stopPropagation(),"function"==typeof this.currentPlugin?.destroy))return await this.currentPlugin.destroy(this.currentTarget),this.deselect(),void this.editor.focus();if(13===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=Q.isListCell(i.parentNode)?Q.createElement("BR"):Q.createElement(this.format.isLine(s)&&!this.format.isBlock(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(Pi.test(e)){const{container:i}=this.get(this.currentTarget);let s=null,n=1;if(this.isInline(i||this.currentTarget))switch(e){case 37:s=i.previousSibling,n=3===s?.nodeType?s.textContent.length:1;break;case 39:s=i.nextSibling,n=0;break;case 38:{const t=this.format.getLine(i,null);s=t?.previousElementSibling,n=0;break}case 40:{const t=this.format.getLine(i,null);s=t?.nextElementSibling;break}}else Di.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._antiBlur=!0,t.stopPropagation(),t.preventDefault(),this.selection.setRange(s,n,s,n)}finally{this.editor._antiBlur=!1}}else 27!==e||this.deselect()}}function Qi(t,e,i){t.preventDefault(),t.stopPropagation();const s=e.cloneNode(!0);Q.removeClass(s,"se-component-selected"),s.querySelectorAll(".se-figure-selected").forEach((t=>Q.removeClass(t,"se-figure-selected"))),i.setData("text/html",s.outerHTML)}Wi.prototype={insert(t,e,i){if(this.editor.frameContext.get("isReadOnly")||!e&&!this.char.check(t))return null;const s=this.html.remove(),n=this.isInline(t);this.selection.getRangeAndAddLine(this.selection.getRange(),s.container);const o=this.selection.getNode();let l=null,r=this.format.getLine(o,null);if(Q.isListCell(r))this.html.insertNode(t,n||o===r?null:s.container.nextSibling,!0),n||t.nextSibling||t.parentNode.appendChild(Q.createElement("BR"));else{if(!n&&this.selection.getRange().collapsed&&(3===s.container.nodeType||Q.isBreak(s.container))){const t=Q.getParentElement(s.container,this.format.isBlock.bind(this.format));l=this.nodeTransform.split(s.container,s.offset,t?Q.getNodeDepth(t)+1:0),l&&(r=l.previousSibling)}this.html.insertNode(t,n||this.format.isBlock(r)?null:r,!0),!n&&r&&Q.isZeroWith(r)&&Q.removeItem(r)}if(n){const e=Q.createTextNode(K.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}if(this.history.push(!1),!i){this.selection.setRange(t,0,t,0);const e=this.get(t);e?this.select(e.target,e.pluginName):l&&(l=Q.getEdgeChildNodes(l,null).sc||l,this.selection.setRange(l,0,l,0))}return l||t},get(t){if(!t)return null;let e,i="",s={},n=!1;if(this.is(t)){if(Q.hasClass(t,"se-component")&&!Q.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}if(!e&&t.nodeName){this.__isFiles(t)&&(n=!0);const o=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!o)return null;e=o.target,i=o.pluginName,s=o.options}if(!e)return null;const o=Oi.GetContainer(e);return this.info={target:e,pluginName:i,options:s,container:o.container||o.cover||e,cover:o.cover,inlineCover:o.inlineCover,caption:o.caption,isFile:n}},select(t,e,i){const s=this.get(t);if(!s||Q.isUneditable(Q.getParentElement(t,this.is.bind(this)))||Q.isUneditable(t))return!1;const n=this.plugins[e];if(!n)return;if(!i&&Pt.get("__overInfo")!==$i){if(this.editor.status._onMousedown)return;this.editor._antiBlur=!0,this.__selectionSelected=!0,this.isInline(s.container)&&this.selection.setRange(s.container,0,s.container,0),this.editor.blur(),zi.setTimeout((()=>{this.__selectionSelected=!1}))}let o;this.isSelected=!0,"function"==typeof n.select&&(o=n.select(t)),o||Q.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,Pt.set("__dragInst",this);const l=Pt.get("__overInfo");if(zi.setTimeout((()=>{Pt.set("__overInfo",l===$i&&void 0),l!==$i&&this.__addGlobalEvent(),s.isFile||this.__addNotFileGlobalEvent()}),0),Q.addClass(s.container,"se-component-selected"),l!==$i){if(Q.setDisabled(this.editor._controllerOnDisabledButtons,!0),!this.isInline(s.container))return;const t=s.container;let e=null;t.previousSibling&&!Q.isBreak(t.previousSibling)||(e=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!Q.isBreak(t.nextSibling)||(e=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.editor.status.onSelected=!0}else if(!Q.hasClass(s.container,"se-input-component")){const t=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");Q.addClass(t,"se-drag-handle-full"),this.editor._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",Pt.set("__dragHandler",t),Pt.set("__dragContainer",s.container),Pt.set("__dragCover",s.cover),t.style.display="block"}},deselect(){zi.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__deselect(),Q.setDisabled(this.editor._controllerOnDisabledButtons,!1)},is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!Q.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),Q.hasClass(t,"se-inline-component"))return!0;return!(!this.editor._componentManager.find((e=>e(t)))||!Q.hasClass(t,"se-inline-component"))},isBasic(t){return this.is(t)&&!this.isInline(t)},__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(){this.editor._antiBlur=!1,Pt.set("__overInfo",null),this._removeDragEvent(this),Q.removeClass(this.currentInfo?.container,"se-component-selected|"),Q.removeClass(this.currentInfo?.cover,"se-figure-over-selected");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.editor.__offControllers()},_setComponentLineBreaker(t){const e=Pt.get("__overInfo")===$i;this.eventManager._lineBreakComp=null;const i=this.get(t);if(!i)return;const s=this.editor.frameContext,n=i.container,o=Q.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=Q.isListCell(n.parentNode);let p,g;const m=this.options.get("_rtl"),f=m?["right","left"]:["left","right"],_=c.offsetTop,{scrollX:b,scrollY:v}=this.offset.getLocal(c);if(u?n.previousSibling:this.format.isLine(n.previousElementSibling))a.display="none";else{const t=tt.get(zi.getComputedStyle(l).height,1);this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2,a.top=p-v-t/2+"px",a[f[0]]=(o?4:this.offset.get(d).left+g)+"px",a[f[1]]="",l.setAttribute("data-offset",v+","+b),e?Q.removeClass(l,"se-on-selected"):Q.addClass(l,"se-on-selected"),a.display="block"}if(u?n.nextSibling:this.format.isLine(n.nextElementSibling))h.display="none";else{const t=zi.getComputedStyle(r),i=tt.get(t.height,1),s=tt.get(t.width,1);p||(this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-v-i/2+"px",h.right="",h.left=this.offset.get(d).left+(m?0:d.offsetWidth)-(o?0:g)-(o?s/2:s)+"px";const l="left";r.setAttribute("data-offset",v+","+l+","+b),e?Q.removeClass(r,"se-on-selected"):Q.addClass(r,"se-on-selected"),h.display="block"}},__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(),Fi?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",Pt.get("__dragHandler")&&(Pt.get("__dragHandler").style.display="none"),Q.removeClass([Pt.get("__dragHandler"),Pt.get("__dragContainer")],"se-dragging"),Q.removeClass([Pt.get("__dragCover"),Pt.get("__dragContainer")],"se-drag-over"),Pt.set("__figureInst",null),Pt.set("__dragInst",null),Pt.set("__dragHandler",null),Pt.set("__dragContainer",null),Pt.set("__dragCover",null),Pt.set("__dragMove",null),Pt.set("__overInfo",null)},constructor:Wi};const ts=Wi,es=function(t){Ft.call(this,t),this._listCamel=this.options.get("__listCommonStyle"),this._listKebab=Y.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")};function is(t){const e=t.parentNode;let i,s,n,o,l,r=e,a=r.parentNode;for(;Q.isListCell(a);){for(o=Q.getPositionIndex(t),i=a.nextElementSibling,s=a.parentNode,n=r;n;){if(r=r.nextSibling,Q.isList(n)){for(l=n.childNodes;l[o];)s.insertBefore(l[o],i);0===l.length&&Q.removeItem(n)}else s.appendChild(n);n=r}r=s,a=s.parentNode}return 0===e.children.length&&Q.removeItem(e),s}function ss(t,e,i){const s=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],Q.isListCell(n)?(e<0||n.previousElementSibling)&&s.push(n):(o=/\d+/.test(n.style[i])?tt.get(n.style[i],0):0,o+=e,Q.setStyle(n,i,o<=0?"":o+"px"));return s}function ns(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)}es.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),Q.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(Q.getNodeFromPath(e.firstPath,o),e.startOffset,Q.getNodeFromPath(e.lastPath,l),e.endOffset),this.history.push(!1)},getLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(Q.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=Q.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&&Q.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Q.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&&Q.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Q.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&Q.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,Q.removeItem(n))}c||Q.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(Q.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))s=Q.createElement("BR");else{const t=e?"string"==typeof e?e:e.nodeName:!this.isLine(i)||this.isBlock(i)||this.isBrLine(i)?this.options.get("defaultLine"):i.nodeName;s=Q.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(i))&&Q.copyTagAttributes(s,e||i,["id"])}return Q.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(Q.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],Q.isListCell(t))if(i=t.lastElementChild,i&&Q.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=i.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(Q.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),Q.isTableCell(s)?(n=null,o=s):(n=s.nextSibling,o=s.parentNode),t=t.cloneNode(!1);let l=Q.getNodeDepth(s),r=null;const a=[],h=(t,e,i)=>{let s=null;if(t!==e&&!Q.isTableElements(e)){if(e&&Q.getNodeDepth(t)===Q.getNodeDepth(e))return i;s=this.nodeTransform.removeAllParents(e,null,t)}return s?s.ec:i};for(let i,s,c,d,u,p,g,m=0,f=e.length;m<f;m++)if(i=e[m],s=i.parentNode,s&&!t.contains(s))if(c=Q.getNodeDepth(i),Q.isList(s)){if(null===r&&(p?(r=p,g=!0,p=null):r=s.cloneNode(!1)),a.push(i),u=e[m+1],m===f-1||u?.parentNode!==s){i.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=s.parentNode;for(;Q.isList(m);)e=Q.createElement(m.nodeName),e.appendChild(r),r=e,m=m.parentNode;const f=this.removeBlock(s,a,null,!0,!0);l>=c?(l=c,o=f.cc,n=h(o,s,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=h(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)r.appendChild(f.removeArray[t]);g||t.appendChild(r),p&&f.removeArray[f.removeArray.length-1].appendChild(p),r=null,g=!1}}else l>=c&&(l=c,o=s,n=i.nextSibling),t.appendChild(i),o!==s&&(d=h(o,s),void 0!==d&&(n=d));if(this.editor.effectNode=null,this.nodeTransform.mergeSameTags(t,null,!1),this.nodeTransform.mergeNestedTags(t,(t=>Q.isList(t))),n&&Q.getNodeDepth(n)>0&&(Q.isList(n.parentNode)||Q.isList(n.parentNode.parentNode))){const e=Q.getParentElement(n,(t=>this.isBlock(t)&&!Q.isList(t))),i=this.nodeTransform.split(n,null,e?Q.getNodeDepth(e)+1:0);i.parentNode.insertBefore(t,i)}else o.insertBefore(t,n),h(t,n);const c=Q.getEdgeChildNodes(t.firstElementChild,t.lastElementChild);e.length>1?this.selection.setRange(c.sc,0,c.ec,c.ec.textContent.length):this.selection.setRange(c.ec,c.ec.textContent.length,c.ec,c.ec.textContent.length),this.history.push(!1)},removeBlock(t,e,i,s,n){const o=this.selection.getRange();let l=o.startOffset,r=o.endOffset,a=Q.getListChildNodes(t,(e=>e.parentNode===t)),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=Q.isList(i);let m=!1,f=!1,_=!1;const b=(e,i,s,n)=>{if(Q.isZeroWith(i)&&(i.innerHTML=K.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)||Q.isBreak(c)||Q.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(Q.isListCell(e)&&Q.isListCell(a)&&Q.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,v=a.length;r<v;r++)if(n=a[r],3!==n.nodeType||!Q.isList(u))if(_=!1,s&&0===r&&(c=e&&e.length!==v&&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&&Q.isListCell(n))if(l&&Q.getNodeDepth(n)!==Q.getNodeDepth(l)&&(Q.isListCell(h)||Q.getArrayItem(n.children,Q.isList,!1))){const e=n.nextElementSibling,i=this._removeNestedList(n,!1);t===i&&e===n.nextElementSibling||(t=i,f=!0)}else{const e=n;n=Q.createElement(s?e.nodeName:Q.isList(t.parentNode)||Q.isListCell(t.parentNode)?"LI":Q.isTableCell(t.parentNode)?"DIV":this.options.get("defaultLine"));const i=Q.isListCell(n),o=e.childNodes;for(;o[0]&&(!Q.isList(o[0])||i);)n.appendChild(o[0]);Q.copyFormatAttributes(n,e),_=!0}else n=n.cloneNode(!1);if(!f&&(s?(p.push(n),Q.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=Q.getListChildNodes(t,(e=>e.parentNode===t)),u=t.cloneNode(!1),h=t.parentNode,r=-1,v=a.length;continue}}const v=t.parentNode;let y=t.nextSibling;u?.children.length>0&&v.insertBefore(u,y),i?c=i.previousSibling:c||(c=t.previousSibling),y=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?Q.removeItem(t):this.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(s)C={cc:v,sc:c,so:l,ec:y,eo:r,removeArray:p};else{c||(c=d),d||(d=c);const t=Q.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}Q.sortNodeByDepth(l,!0);const r=l[0],a=l[l.length-1];let h=!Q.isListCell(r)&&!this.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentNode.previousElementSibling,c=!Q.isListCell(a)&&!this.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentNode.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&Q.isZeroWith(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(!Q.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&&!Q.isWysiwygFrame(t)&&t.nodeName===s?t:h,c=e&&!Q.isWysiwygFrame(e)&&e.nodeName===s?e:c;const i=h?.tagName===s,o=c?.tagName===s;let r=i?h:Q.createElement(s,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!this.component.is(t)&&!Q.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=Q.isListCell(e),f=this.isBlock(c)?c:null,g=o&&!Q.isWysiwygFrame(c)?c.parentNode:c,m=o&&!Q.isWysiwygFrame(c)?!h||Q.isListCell(g)?c:c.nextSibling:e.nextSibling,t=Q.createElement("LI"),Q.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&&Q.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),Q.removeItem(e),i&&null===d&&(d=r.children.length-1),h&&(this.getBlock(p,u)!==this.getBlock(c,u)||Q.isList(p)&&Q.isList(c)&&Q.getNodeDepth(p)!==Q.getNodeDepth(c))&&(r=Q.createElement(s,{style:"list-style-type: "+n})),0===f?.children.length&&Q.removeItem(f)}else Q.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,Q.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=Q.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&&Q.isList(r)&&(t?t!==r?(i&&Q.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentNode,o.f,a,!1,!0),r=l[c].parentNode,e||(a=Q.createElement(s,{style:"list-style-type: "+n})),t=r,o={r:t,f:[Q.getParentElement(l[c],"LI")]}):o.f.push(Q.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[Q.getParentElement(l[c],"LI")]}),c===d-1&&(i&&Q.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentNode,o.f,a,!1,!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=Q.isList(h),!a&&d)a=h,i={r:a,f:[Q.getParentElement(t[u],"LI")]},0===u&&(s=!0);else if(a&&d)if(a!==h){const r=this.detachRangeFormatElement(i.f[0].parentNode,i.f,null,e,!0);h=t[u].parentNode,s&&(o=r.sc,s=!1),c&&(l=r.ec),d?(a=h,i={r:a,f:[Q.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else i.f.push(Q.getParentElement(t[u],"LI")),c&&(n=!0);if(c&&Q.isList(a)){const t=this.detachRangeFormatElement(i.f[0].parentNode,i.f,null,e,!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=ss(this.getLines(null),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)},outdent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=ss(this.getLines(null),-1*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)},applyInlineElement(t,e,i,s){if(Q.getParentElement(this.selection.getNode(),Q.isNonEditable))return;this.selection._resetRangeToTextNode();let n=this.selection.getRangeAndAddLine(this.selection.getRange(),null);e=e?.length>0&&e,i=i?.length>0&&i;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&&Q.isNonEditable(r)){const t=r.parentNode;return void(!Q.isListCell(t)||Y.getValues(t.style).some((t=>this._listKebab.includes(t))))}if(n.collapsed&&!l&&1===r.nodeType&&!Q.isBreak(r)&&!this.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?Q.isBreak(e)?e:e.nextSibling:null);const i=Q.createTextNode(K.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=Q.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.classList;for(let t=0,e=l.length;t<e;t++)s.push("."+l[t]);if(s.length>0){for(;!this.isLine(e)&&!Q.isWysiwygFrame(e);){for(let n=0;n<s.length;n++)if(1===e.nodeType){const l=s[n],r=!!/^\./.test(l)&&new d("\\s*"+l.replace(/^\./,"")+"(\\s+|$)","ig"),a=o?!!e.style[l]:!!e.style[l]&&!!t.style[l]&&e.style[l]===t.style[l],h=!1!==r&&(o?!!e.className.match(r):!!e.className.match(r)&&!!t.className.match(r));(a||h)&&i++}e=e.parentNode}if(i>=s.length)return}}let p,g={},m={},f="",_="",b=null;if(e){for(let t,i=0,s=e.length;i<s;i++)t=e[i],/^\./.test(t)?_+=(_?"|":"\\s*(?:")+t.replace(/^\./,""):f+=(f?"|":"(?:;|^|\\s)(?:")+t;f&&(f+=")\\s*:[^;]*\\s*(?:;|$)",f=new d(f,"ig")),_&&(_+=")(?=\\s+|$)",_=new d(_,"ig"))}if(i){b="^(?:"+i[0];for(let t=1;t<i.length;t++)b+="|"+i[t];b+=")$",b=new d(b,"i")}const v=Boolean,y={v:!1},C=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||Q.isBreak(e))return e;if(l)return null;const i=!b&&o||b?.test(e.nodeName);if(i&&!s)return y.v=!0,null;const n=e.style.cssText;let r="";f&&n.length>0&&(r=n.replace(f,"").trim(),r!==n&&(y.v=!0));const a=e.className;let h="";return _&&a.length>0&&(h=a.replace(_,"").trim(),h!==a&&(y.v=!0)),(!o||!_&&a||!f&&n||r||h||!i)&&(r||h||e.nodeName!==u||v(f)!==v(n)||v(_)!==v(a))?(f&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),_&&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)},w=this.getLines(null);n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.getLine(r,null)||(r=Q.getEdgeChild(w[0],(function(t){return 3===t.nodeType}),!1),a=0),this.getLine(h,null)||(h=Q.getEdgeChild(w[w.length-1],(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const x=this.getLine(r,null)===this.getLine(h,null),E=w.length-(x?0:1);p=t.cloneNode(!1);const S=l||o&&function(t,e){for(let i=0,s=e.length;i<s;i++)if(t._isNonSplitNode(e[i])||t._sn_isSizeNode(e[i]))return!0;return!1}(this,i),T=o||this._sn_isSizeNode(p),k=this._sn_getMaintainedNode.bind(this,S,T),N=this._sn_isMaintainedNode.bind(this,S,T);if(x){this._sn_resetCommonListCell(w[0],e)&&(n=this.selection.setRange(r,a,h,c));const t=this._setNode_oneLine(w[0],p,C,r,a,h,c,l,o,n.collapsed,y,k,N);g.container=t.startContainer,g.offset=t.startOffset,m.container=t.endContainer,m.offset=t.endOffset,g.container===m.container&&Q.isZeroWith(g.container)&&(g.offset=m.offset=1),this._sn_setCommonListStyle(t.ancestor,null)}else{let i=!1;E>0&&this._sn_resetCommonListCell(w[E],e)&&(i=!0),this._sn_resetCommonListCell(w[0],e)&&(i=!0),i&&this.selection.setRange(r,a,h,c),E>0&&(p=t.cloneNode(!1),m=this._setNode_endLine(w[E],p,C,h,c,l,o,y,k,N));for(let i,s=E-1;s>0;s--)this._sn_resetCommonListCell(w[s],e),p=t.cloneNode(!1),i=this._setNode_middleLine(w[s],p,C,l,o,y,m.container),i.endContainer&&i.ancestor.contains(i.endContainer)&&(m.ancestor=null,m.container=i.endContainer),this._sn_setCommonListStyle(i.ancestor,null);p=t.cloneNode(!1),g=this._setNode_startLine(w[0],p,C,r,a,l,o,y,k,N,m.container),g.endContainer&&(m.ancestor=null,m.container=g.endContainer),E<=0?m=g:m.container||(m.ancestor=null,m.container=g.container,m.offset=g.container.textContent.length),this._sn_setCommonListStyle(g.ancestor,null),this._sn_setCommonListStyle(m.ancestor||this.getLine(m.container),null)}return this.editor._offCurrentController(),this.selection.setRange(g.container,g.offset,m.container,m.offset),this.history.push(!1),p},removeInlineElement(){this.applyInlineElement(null,null,null,null)},isEdgeLine(t,e,i){if(!Q.isEdgePoint(t,e,i))return!1;const s=[];for(i="front"===i?"previousSibling":"nextSibling";t&&!this.isLine(t)&&!Q.isWysiwygFrame(t);){if(t[i]&&(!Q.isBreak(t[i])||t[i][i]))return null;1===t.nodeType&&s.push(t.cloneNode(!1)),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"string"==typeof t?this._formatLineCheck.test(t):t&&1===t.nodeType&&(this._formatLineCheck.test(t.nodeName)||Q.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this._nonFormat(t)},isLineOnly(t){return this._formatLineCheck.test(t)&&!this._formatBlockCheck.test(t)},isBrLine(t){return"string"==typeof t?this._formatBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatBrLineCheck.test(t.nodeName)||Q.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)||Q.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)||Q.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)||Q.hasClass(t,"__se__format__br_line__closure_.+"))&&!this._nonFormat(t)},getLines(t){if(!this.selection._resetRangeToTextNode())return[];let e=this.selection.getRange();if(Q.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=Q.getListChildren(n,(e=>t?t(e):this.isLine(e)));if(Q.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!Q.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);Q.isTableElements(d)&&Q.isListCell(d.parentNode)&&(d=d.parentNode),Q.isTableElements(u)&&Q.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=Q.getParentElement(e,this.component.is.bind(this.component)),s=Q.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=Q.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 Q.isExcludeFormat(t)||this.component.is(t)||Q.isWysiwygFrame(t)},_isNonSplitNode:t=>t&&3!==t.nodeType&&/^(a|label|code|summary)$/i.test("string"==typeof t?t:t.nodeName),_notTextNode(t){return t&&3!==t.nodeType&&(this.component.is(t)||/^(br|input|select|canvas|img|iframe|audio|video)$/i.test("string"==typeof t?t:t.nodeName))},_isIgnoreNodeChange(t){return t&&3!==t.nodeType&&(Q.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=Q.getNodePath(t.startContainer,n,null,null),r=Q.getNodePath(t.endContainer,o,null,null),a=this.removeList(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.selection.setRange(Q.getNodeFromPath(l,n),i,Q.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){Q.isListCell(i)&&(t=i,s=null),t.insertBefore(e,s),n.s||(n.s=Q.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?Q.getNodePath(n.sl,t):null;n.e=Q.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=Q.getNodeFromPath(o,t))}return e},_detachNested(t){const e=t[0],i=t[t.length-1],s=i.nextElementSibling,n=e.parentNode,o=n.parentNode.nextElementSibling,l=n.parentNode.parentNode;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=Q.getPositionIndex(s);for(;e[o];)t.appendChild(e[o]);i.appendChild(t)}0===n.children.length&&Q.removeItem(n),this.nodeTransform.mergeSameTags(l);const r=Q.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 Q.isListCell(t)}))).length;if(0===i||!e&&!Q.isListCell(t[0].previousElementSibling)&&!Q.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&&Q.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=Q.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=Q.createElement(s.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);this._attachNested(s,e,l,r,a);const h=Q.getNodeFromPath(a.s,a.sl),c=Q.getNodeFromPath(a.e,a.el);o={sc:h,so:0,ec:c,eo:c.textContent.length}}return o},_removeNestedList(t,e){const i=is(t);let s,n,o;if(i){s=i.cloneNode(!1),n=i.childNodes;const e=Q.getPositionIndex(t);for(;n[e];)s.appendChild(n[e])}else s=t;if(e)o=Q.getListChildren(s,(t=>Q.isListCell(t)&&!t.previousElementSibling));else{const e=Q.getNodeDepth(t)+2;o=Q.getListChildren(t,(t=>Q.isListCell(t)&&!t.previousElementSibling&&Q.getNodeDepth(t)===e))}for(let t=0,e=o.length;t<e;t++)is(o[t]);return i&&(i.parentNode.insertBefore(s,i.nextSibling),0===n?.length&&Q.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)||Q.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&p===o.parentNode&&p.nodeName===e.nodeName&&Q.isZeroWith(s.textContent.slice(0,n))&&Q.isZeroWith(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=!Q.isZeroWith(t),t!==s)if(t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else n=!0;else e=!0;if(r)return Q.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 v,y,C,w,x,E=s,S=n,T=o,k=l,N=!1,L=!1;const H=RegExp;function M(t){const e=new H("(?:;|^|\\s)(?:"+w+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let i="";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(!N&&a===E){let t=_;x=d(a);const o=Q.createTextNode(1===E.nodeType?"":E.substringData(0,S)),l=Q.createTextNode(1===E.nodeType?"":E.substringData(S,b&&k>=S?k-S:E.data.length-S));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)}Q.isZeroWith(o)||n.appendChild(o);const r=d(n);for(r&&(x=r),x&&(t=x),y=a,v=[],w="";y!==t&&y!==m&&null!==y;)s=u(y)?null:i(y),s&&1===y.nodeType&&M(y)&&(v.push(s),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;const h=v.pop()||l;for(C=y=h;v.length>0;)y=v.pop(),C.appendChild(y),C=y;if(e.appendChild(h),t.appendChild(e),x&&!d(T)&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),E=l,S=0,N=!0,y!==l&&y.appendChild(E),!b)continue}if(L||a!==T){if(N){if(1===a.nodeType&&!Q.isBreak(a)){g._isIgnoreNodeChange(a)?(_.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),_.appendChild(e),f.push(e))):t(a,a);continue}y=a,v=[],w="";const o=[];for(;null!==y.parentNode&&y!==m&&y!==e;)s=L?y.cloneNode(!1):i(y),1===y.nodeType&&!Q.isBreak(a)&&s&&M(y)&&(u(y)?x||o.push(s):v.push(s),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;v=v.concat(o);const l=v.pop()||a;for(C=y=l;v.length>0;)y=v.pop(),C.appendChild(y),C=y;if(!u(e.parentNode)||u(l)||Q.isZeroWith(e)||(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),L||x||!u(l))l===a?n=L?_:e:L?(_.appendChild(l),n=y):(e.appendChild(l),n=y);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?y:e}if(x&&3===a.nodeType)if(d(a)){const t=Q.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||Q.isBreak(a)||(p=c),t(a,p)}else{x=d(a);const t=Q.createTextNode(1===T.nodeType?"":T.substringData(k,T.length-k)),n=Q.createTextNode(b||1===T.nodeType?"":T.substringData(0,k));if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),!Q.isZeroWith(t)){y=a,w="",v=[];const e=[];for(;y!==_&&y!==m&&null!==y;)1===y.nodeType&&M(y)&&(u(y)?e.push(y.cloneNode(!1)):v.push(y.cloneNode(!1)),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;for(v=v.concat(e),c=C=y=v.pop()||t;v.length>0;)y=v.pop(),C.appendChild(y),C=y;_.appendChild(c),y.textContent=t.data}if(x&&c){const t=d(c);t&&(x=t)}for(y=a,v=[],w="";y!==_&&y!==m&&null!==y;)s=u(y)?null:i(y),s&&1===y.nodeType&&M(y)&&(v.push(s),w+=y.style.cssText.substr(0,y.style.cssText.indexOf(":"))+"|"),y=y.parentNode;const o=v.pop()||n;for(C=y=o;v.length>0;)y=v.pop(),C.appendChild(y),C=y;x?((e=e.cloneNode(!1)).appendChild(o),x.insertBefore(e,x.firstChild),_.appendChild(x),f.push(e),x=null):e.appendChild(o),T=n,k=n.data.length,L=!0,!r&&h&&(e=n,n.textContent=K.zeroWidthSpace),y!==n&&y.appendChild(T)}}}(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=Q.createTextNode(K.zeroWidthSpace),_.replaceChild(i,e);else{const t=e.childNodes;for(s=t[0];t[0];)n=t[0],_.insertBefore(n,e);Q.removeItem(e)}0===t&&(h?E=T=i:(E=s,T=n))}else{if(a)for(let t=0;t<f.length;t++)ns(f[t]);h&&(E=T=e)}this.nodeTransform.removeEmptyNode(_,e,!1),h&&(S=E.textContent.length,k=T.textContent.length);const A=r||0===T.textContent.length;Q.isBreak(T)||0!==T.textContent.length||(Q.removeItem(T),T=E),k=A?T.textContent.length:k;const B={s:0,e:0},I=Q.getNodePath(E,_,B),V=!T.parentNode;V&&(T=E);const R={s:0,e:0},O=Q.getNodePath(T,_,V||A?null:R);S+=B.s,k=h?S:V?E.textContent.length:A?k+B.s:k+R.s;const z=this.nodeTransform.mergeSameTags(_,[I,O],!0);return t.parentNode.replaceChild(_,t),E=Q.getNodeFromPath(I,_),T=Q.getNodeFromPath(O,_),{ancestor:_,startContainer:E,startOffset:S+z[0],endContainer:T,endOffset:k+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)||Q.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&d.nodeName===e.nodeName&&!this.isLine(d)&&!d.nextSibling&&Q.isZeroWith(s.textContent.slice(0,n))){let i=!1,o=s.previousSibling;for(;o;){if(!Q.isZeroWith(o)){i=!1;break}o=o.previousSibling}if(i)return Q.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,v,y=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&&!Q.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=Q.getNodePath(c,d);c=Q.getNodeFromPath(t,l)}}else t(d,d);continue}_=d,f=[];const o=[];for(;null!==_.parentNode&&_!==p&&_!==e;)s=i(_),1===_.nodeType&&s&&(h(_)?v||o.push(s):f.push(s)),_=_.parentNode;f=f.concat(o);const r=f.length>0,y=f.pop()||d;for(b=_=y;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(h(e.parentNode)&&!h(y)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!v&&h(y)){e=e.cloneNode(!1);const t=y.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);y.appendChild(e),m.appendChild(y),n=h(_)?e:_,g.push(e)}else r?(e.appendChild(y),n=_):n=e;if(v&&3===d.nodeType)if(a(d)){const t=Q.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));v.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else v=null}if(w||d!==y)s=w?i(d):d.cloneNode(!1),s&&(n.appendChild(s),1!==d.nodeType||Q.isBreak(d)||(x=s)),t(d,x);else{let t=m;v=a(d);const o=Q.createTextNode(1===y.nodeType?"":y.substringData(0,C)),l=Q.createTextNode(1===y.nodeType?"":y.substringData(C,y.length-C));if(v){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)}v=v.cloneNode(!1)}Q.isZeroWith(o)||n.appendChild(o);const r=a(n);for(r&&(v=r),v&&(t=v),_=n,f=[];_!==t&&null!==_;)s=i(_),1===_.nodeType&&s&&f.push(s),_=_.parentNode;const h=f.pop()||n;for(b=_=h;f.length>0;)_=f.pop(),b.appendChild(_),b=_;h!==n?(e.appendChild(h),n=_):n=e,Q.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),y=l,C=0,w=!0,n.appendChild(y)}}}(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);Q.removeItem(e),0===t&&(y=s)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)ns(g[t])}if(o||0!==m.childNodes.length){this.nodeTransform.removeEmptyNode(m,e,!1),Q.isZeroWith(m.textContent)&&(y=m.firstChild,C=0);const i={s:0,e:0},s=Q.getNodePath(y,m,i);C+=i.s;const n=this.nodeTransform.mergeSameTags(m,[s],!0);t.parentNode.replaceChild(m,t),y=Q.getNodeFromPath(s,m),C+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=Q.createTextNode(K.zeroWidthSpace),t.appendChild(y));return{ancestor:m,container:y,offset:C,endContainer:c}},_setNode_middleLine(t,e,i,s,n,o,l){if(!n){let i=null;l&&t.contains(l)&&(i=Q.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(!Q.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,Q.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=s.innerHTML,{ancestor:t,endContainer:i?Q.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(Q.isBreak(p)||!r._isIgnoreNodeChange(p))s=i(p),s&&(c=!1,n.appendChild(s),1===p.nodeType&&(g=s)),Q.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=Q.getNodePath(l,p);l=Q.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);Q.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)ns(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)||Q.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&c.nodeName===e.nodeName&&!this.isLine(c)&&!c.previousSibling&&Q.isZeroWith(s.textContent.slice(n))){let i=!1,o=s.nextSibling;for(;o;){if(!Q.isZeroWith(o)){i=!1;break}o=o.nextSibling}if(i)return Q.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,v=s,y=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&&!Q.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=Q.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!==v)s=C?i(r):r.cloneNode(!1),s&&(n.insertBefore(s,n.firstChild),1!==r.nodeType||Q.isBreak(r)||(c=s)),t(r,c);else{b=a(r);const t=Q.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),o=Q.createTextNode(1===v.nodeType?"":v.substringData(0,y));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(Q.isZeroWith(t)||n.insertBefore(t,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 l=m.pop()||n;for(_=f=l;m.length>0;)f=m.pop(),_.appendChild(f),_=f;l!==n?(e.insertBefore(l,e.firstChild),n=f):n=e,Q.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),v=o,y=o.data.length,C=!0,n.insertBefore(v,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);Q.removeItem(e),t===p.length-1&&(v=s,y=s.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)ns(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),Q.isZeroWith(g.textContent)?(v=g.firstChild,y=v.textContent.length):Q.isZeroWith(v)&&(v=e,y=1);const i={s:0,e:0},s=Q.getNodePath(v,g,i);y+=i.s;const n=this.nodeTransform.mergeSameTags(g,[s],!0);t.parentNode.replaceChild(g,t),v=Q.getNodeFromPath(s,g),y+=n[0]}else t.childNodes?v=t.childNodes[0]:(v=Q.createTextNode(K.zeroWidthSpace),t.appendChild(v));return{ancestor:g,container:v,offset:1===v.nodeType&&1===y?v.childNodes.length:y}},_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:Q.getParentElement(i,this._isNonSplitNode.bind(this))||(e?null:Q.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 Q.getParentElement(i,this._isNonSplitNode.bind(this))?s:s||!e&&this._sn_isSizeNode(i)},_sn_setCommonListStyle(t,e){if(!Q.isListCell(t))return;const i=Q.getArrayItem((e||t).childNodes,(function(t){return!Q.isBreak(t)}),!0);if(!(e=i[0])||i.length>1||1!==e.nodeType)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=Y.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);Q.removeItem(e)}},_sn_resetCommonListCell(t,e){if(!Q.isListCell(t))return;e||(e=this._listKebab);const i=Q.getArrayItem(t.childNodes,(t=>!Q.isBreak(t)),!0),s=t.style,n=[],o=[],l=Y.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=Q.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=Y.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},constructor:es};const os=es,ls=function(t){Ft.call(this,t);const e=this.options;this._isAllowedClassName=function(t){return this.test(t)?t:""}.bind(this.options.get("allowedClassName")),this._allowHTMLComment=null,this._disallowedStyleNodesRegExp=null,this._htmlCheckWhitelistRegExp=null,this._htmlCheckBlacklistRegExp=null,this._elementWhitelistRegExp=null,this._elementBlacklistRegExp=null,this._attributeWhitelist=null,this._attributeWhitelistRegExp=null,this._attributeBlacklist=null,this._attributeBlacklistRegExp=null,this._textStyleTags=e.get("_textStyleTags"),this._autoStyleify=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+("+this.options.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("^("+as(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this._elementWhitelistRegExp=J.createElementWhitelist(as(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this._elementBlacklistRegExp=J.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=as(u[t],c):p[t]=new RegExp("\\s(?:"+as(u[t],"")+")"+d,"ig"));this._attributeWhitelistRegExp=new RegExp("\\s(?:"+(g||c)+"|data-se-[^\\s]+"+(this.options.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=as(m[t],""):p[t]=new RegExp("\\s(?:"+as(m[t],"")+")"+d,"ig");if(this._attributeBlacklistRegExp=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this._attributeBlacklist=p,this.options.get("autoStyleify").length>0){const t=this.options.get("convertTextTags"),e={};this.options.get("autoStyleify").forEach((i=>{switch(i){case"bold":e.bold={regex:/font-weight\s*:\s*bold/i,tag:t.bold};break;case"italic":e.italic={regex:/font-style\s*:\s*italic/i,tag:t.italic};break;case"underline":e.underline={regex:/text-decoration\s*:\s*underline/i,tag:t.underline};break;case"strike":e.strike={regex:/text-decoration\s*:\s*line-through/i,tag:t.strike}}})),this._autoStyleify=e}};function rs(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(Q.isMedia(o)||Q.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 as(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}ls.prototype={filter(t,{tagWhitelist:e,tagBlacklist:i,validate:s,validateAll:n}){if(e&&(t=t.replace(J.createElementWhitelist(e),"")),i&&(t=t.replace(J.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=function(t){return 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,e,i,s){const{tagFilter:n,formatFilter:o,classFilter:l,styleNodeFilter:r,attrFilter:a,styleFilter:h}=this.options.get("strictMode");let c="";if(t=this.compress(t),n&&(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");Q.getListChildNodes(e.body,J.spanToStyleNode.bind(null,this._autoStyleify)),t=e.body.innerHTML}(a||h)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,rs.bind(this,a,h)));const d=this._d.createRange().createContextualFragment(t,!0);if(n)try{this._consistencyCheckOfHTML(d,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,n,o,l)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}if(this.options.get("__pluginRetainFilter")&&this.editor._MELInfo.forEach(((t,e)=>{const i=d.querySelectorAll(e);for(let e=0,s=i.length;e<s;e++)t(i[e])})),o){let t=d.childNodes;e||(e=this._isFormatData(t)),e&&(t=this._editFormat(d).childNodes);for(let i,s=0,n=t.length;s<n;s++)i=t[s],this.__allowedTagNameRegExp.test(i.nodeName)?c+=i.outerHTML:c+=this._makeLine(i,e)}return c||(c=t),n&&(i&&(c=c.replace("string"==typeof i?J.createElementWhitelist(i):i,"")),s&&(c=c.replace("string"==typeof s?J.createElementBlacklist(s):s,""))),r&&(c=this._styleNodeConvertor(c)),c},insert(t,e,i,s){if(this.editor.frameContext.get("wysiwygFrame").contains(this.selection.get().focusNode)||this.editor.focus(),"string"==typeof t){s||(t=this.clean(t,!1,null,null));try{if(Q.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&&Q.isBreak(n)?(r=n,Q.removeItem(n)):(l=this.insertNode(n,o,!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,i,!1);else{let e=null;(this.format.isLine(t)||Q.isMedia(t))&&(e=this.format.getLine(this.selection.getNode(),null)),this.insertNode(t,e,i)}this.editor.effectNode=null,this.editor.focus(),this.history.push(!1)},insertNode(t,e,i){let s=null;if(this.editor.frameContext.get("isReadOnly")||!i&&!this.char.check(t,null))return s;let n,o,l,r=this.selection.getRange(),a=Q.isListCell(r.commonAncestorContainer)?r.commonAncestorContainer:this.format.getLine(this.selection.getNode(),null),h=Q.isListCell(a)&&(Q.isListCell(t)||Q.isList(t)),c=null;const d=this.format.isBrLine(a),u=!d&&(this.format.isLine(t)||this.format.isBlock(t))||this.component.isBasic(t);if(h&&(l=e||Q.isList(t)?a.lastChild:a.nextElementSibling,c=Q.isList(t)?a:(l||a).parentNode),!e&&(u||this.component.isBasic(t)||Q.isMedia(t))){const t=Q.isEdgePoint(r.endContainer,r.endOffset,"end"),i=this.remove(),s=i.container,n=s===i.prevContainer&&r.collapsed?null:i.prevContainer;if(h&&n)if(c=3===n.nodeType?n.parentNode:n,c.contains(s)){let t=!0;for(l=s;l.parentNode&&l.parentNode!==c;)l=l.parentNode,t=!1;t&&s===n&&(l=l.nextSibling)}else l=null;else if(h&&Q.isListCell(s)&&!a.parentElement)a=Q.createElement("LI"),c.appendChild(a),s.appendChild(c),l=null;else if(3===s.nodeType||Q.isBreak(s)||h){const n=Q.getParentElement(s,(t=>this.format.isBlock(t)||Q.isListCell(t)));if(e=this.nodeTransform.split(s,i.offset,n?Q.getNodeDepth(n)+1:0))if(h){if(a.contains(s)){const i=Q.isList(a.lastElementChild);let s=null;t||(s=a.cloneNode(!1),s.appendChild(e.textContent.trim()?e:Q.createTextNode(K.zeroWidthSpace))),i&&(s||(s=a.cloneNode(!1),s.appendChild(Q.createTextNode(K.zeroWidthSpace))),s.appendChild(a.lastElementChild)),s&&(a.parentNode.insertBefore(s,a.nextElementSibling),l=e=s)}}else e=e.previousSibling;else l=e=a}}r=e||u?this.selection.getRange():this.selection.getRangeAndAddLine(this.selection.getRange(),null);const p=r.commonAncestorContainer,g=r.startOffset,m=r.endOffset,f=r.startContainer===p&&this.format.isLine(p),_=f&&(p.childNodes[g]||p.childNodes[0])||r.startContainer,b=f&&(p.childNodes[m]||p.childNodes[p.childNodes.length-1])||r.endContainer;if(!h)if(e)n=e.parentNode,e=e.nextSibling,o=!0;else if(n=_,3===_.nodeType&&(n=_.parentNode),r.collapsed)if(3===p.nodeType)e=p.textContent.length>m?p.splitText(m):p.nextSibling;else if(Q.isBreak(n))e=n,n=n.parentNode;else{const i=n.childNodes[g],s=3===i?.nodeType&&Q.isZeroWith(i)&&Q.isBreak(i.nextSibling)?i.nextSibling:i;s?!s.nextSibling&&Q.isBreak(s)?(n.removeChild(s),e=null):e=Q.isBreak(s)&&!Q.isBreak(t)?s:s.nextSibling:e=null}else{if(_===b){e=Q.isEdgePoint(b,m)?b.nextSibling:b.splitText(m);let t=_;Q.isEdgePoint(_,g)||(t=_.splitText(g)),n.removeChild(t),0===n.childNodes.length&&u&&(n.innerHTML="<br>")}else{const i=this.remove(),s=i.container,o=i.prevContainer;if(0===s?.childNodes.length&&u&&(this.format.isLine(s)?s.innerHTML="<br>":this.format.isBlock(s)&&(s.innerHTML="<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">")),Q.isListCell(s)&&3===t.nodeType)n=s,e=null;else if(!u&&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 Q.isWysiwygFrame(s)&&!this.format.isLine(t)?(n=s.appendChild(Q.createElement(this.options.get("defaultLine"))),e=null):n=(e=u?b:s===o?s.nextSibling:s)&&e.parentNode?e.parentNode:p;for(;e&&!this.format.isLine(e)&&e.parentNode!==p;)e=e.parentNode}}try{const i=this.editor.frameContext.get("wysiwyg");if(!h){if((Q.isWysiwygFrame(e)||n===i.parentNode)&&(n=i,e=null),this.format.isLine(t)||this.format.isBlock(t)||!Q.isListCell(n)&&this.component.isBasic(t)){const t=n;if(Q.isList(e))n=e,e=null;else if(Q.isListCell(e))n=e.previousElementSibling||e;else if(!o&&!e){const t=this.remove(),i=3===t.container.nodeType?Q.isListCell(this.format.getLine(t.container,null))?t.container:this.format.getLine(t.container,null)||t.container.parentNode:t.container,s=Q.isWysiwygFrame(i)||this.format.isBlock(i);n=s?i:i.parentNode,e=s?null:i.nextSibling}0===t.childNodes.length&&n!==t&&Q.removeItem(t)}if(!u||d||this.format.isBlock(n)||Q.isListCell(n)||Q.isWysiwygFrame(n)||(e=n.nextElementSibling,n=n.parentNode),Q.isWysiwygFrame(n)&&(3===t.nodeType||Q.isBreak(t))){t=Q.createElement(this.options.get("defaultLine"),null,t)}}if(h?c.parentNode?(n=c,e=l):(n=i,e=null):e=n===e?n.lastChild:e,Q.isListCell(t)&&!Q.isList(n)){if(Q.isListCell(n))e=n.nextElementSibling,n=n.parentNode;else{const t=Q.createElement("ol");n.insertBefore(t,e),n=t,e=null}h=!0}if(this._checkDuplicateNode(t,n),n.insertBefore(t,e),h)if(Q.isZeroWith(a.textContent.trim()))Q.removeItem(a),t=t.lastChild;else{const e=Q.getArrayItem(a.children,Q.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(n.appendChild(t),t=n),Q.isZeroWith(a.textContent.trim())&&Q.removeItem(a))}}catch(e){n.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{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),Q.removeItem(i)}if((this.format.isLine(t)||this.component.isBasic(t))&&_===b){const t=this.format.getLine(p,null);1===t?.nodeType&&Q.isEmptyLine(t)&&Q.removeItem(t)}if(d&&(this.format.isLine(t)||this.format.isBlock(t))&&(t=this._setIntoFreeFormat(t)),!this.component.isBasic(t)){let e=1;if(3===t.nodeType){const e=t.previousSibling,i=t.nextSibling,n=!e||1===e.nodeType||Q.isZeroWith(e)?"":e.textContent,o=!i||1===i.nodeType||Q.isZeroWith(i)?"":i.textContent;e&&n.length>0&&(t.textContent=n+t.textContent,Q.removeItem(e)),i&&o.length>0&&(t.textContent+=o,Q.removeItem(i));const l={container:t,startOffset:n.length,endOffset:t.textContent.length-o.length};this.selection.setRange(t,l.startOffset,t,l.endOffset),s=l}else if(!Q.isBreak(t)&&!Q.isListCell(t)&&this.format.isLine(n)){let i=null;t.previousSibling&&!Q.isBreak(t.previousSibling)||(i=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(i,t)),t.nextSibling&&!Q.isBreak(t.nextSibling)||(i=Q.createTextNode(K.zeroWidthSpace),t.parentNode.insertBefore(i,t.nextSibling)),this.format._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.selection.setRange(t,e,t,e)}}s||(this.history.push(!0),s=t)}return s},remove(){this.selection._resetRangeToTextNode();const t=this.selection.getRange(),e=0===t.startOffset,i=Q.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.parentNode,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 Q.removeItem(t),this.format.isLine(e)?0===e.childNodes.length?(Q.removeItem(e),{container:n,offset:o}):{container:i,offset:s}:{container:n,offset:o}}if(1===u.nodeType&&0===c&&1===d||3===u.nodeType&&0===c&&d===u.textContent.length){const t=Q.getNextDeepestNode(u,this.editor.frameContext.get("wysiwygFrame")),e=Q.getPreviousDeepestNode(u,this.editor.frameContext.get("wysiwygFrame")),i=this.format.getLine(u);Q.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),Q.isZeroWith(i)&&!i.contains(s)&&Q.removeItem(i),{container:s,offset:n}}a=u.children[c],h=u.children[d],c=d=0}if(!a||!h)return{container:u,offset:0};if(a===h&&t.collapsed&&Q.isZeroWith(a.textContent?.substr(c)))return{container:a,offset:c,prevContainer:a&&a.parentNode?a:null};let p=null,g=null;const m=Q.getListChildNodes(u,null);let f=Q.getArrayIndex(m,a),_=Q.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)||Q.isWysiwygFrame(u)||Q.isBreak(u)||Q.isMedia(u))return{container:u,offset:0};if(3===u.nodeType)return{container:u,offset:d};m.push(u),a=h=u}else if(a=h=m[0],Q.isBreak(a)||Q.isZeroWith(a))return{container:Q.isMedia(u)?u:a,offset:0};f=_=0}for(let t=f;t<=_;t++){const e=m[t];if(0===e.length||3===e.nodeType&&void 0===e.data)this._nodeRemoveListItem(e);else if(e!==a)if(e!==h)this._nodeRemoveListItem(e);else{if(1===h.nodeType){if(this.component.is(h))continue;g=Q.createTextNode(h.textContent)}else g=Q.createTextNode(h.substringData(d,h.length-d));g.length>0?h.data=g.data:this._nodeRemoveListItem(h)}else{if(1===a.nodeType){if(this.component.is(a))continue;p=Q.createTextNode(a.textContent)}else e===h?(p=Q.createTextNode(a.substringData(0,c)+h.substringData(d,h.length-d)),r=c):p=Q.createTextNode(a.substringData(0,c));if(p.length>0?a.data=p.data:this._nodeRemoveListItem(a),e===h)break}}const b=Q.getParentElement(h,"ul"),v=Q.getParentElement(a,"li");if(b&&v&&v.contains(b)?(l=b.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,r=e||i?i?l.textContent.length:0:r),this.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!Q.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}},get(t,e,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=Q.createElement("DIV",null,this._convertToCode(l.get("wysiwyg"),!0)),a=Q.getListChildren(r,(t=>t.hasAttribute("contenteditable")));for(let t=0,e=a.length;t<e;t++)a[t].removeAttribute("contenteditable");const h=this.clean(r.innerHTML,!1,null,null);if(this.editor.frameOptions.get("iframe_fullPage"))if(e){const t=Q.getAttributesToString(l.get("_wd").body,["contenteditable"]);s="<!DOCTYPE html><html>"+l.get("_wd").head.outerHTML+"<body "+t+">"+h+"</body></html>"}else s=h;else s=t?'<div class="sun-editor-editable'+(this.options.get("_rtl")?" se-rtl":"")+'">'+h+"</div>":r.innerHTML;n[i[o]]=s}return this.editor.changeFrameContext(s),i.length>1?n:n[i[0]]},set(t,e){this.selection.removeRange();const i=null==t?"":this.clean(t,!0,null,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,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,!0,null,null);if(this.editor.frameContext.get("isCodeView"))this.viewer._setCodeView(this.viewer._getCodeView()+"\n"+this._convertToCode(s,!1));else{const t=Q.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])}}},setFullPage(t,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,!0,null,null)),this.editor._resetComponents()},compress:t=>t.replace(/\n/g,"").replace(/(>)(?:\s+)(<)/g,"$1$2").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";let a=e?0:1*this.status.codeIndentSize;return a=a>0?new Array(a+1).join(" "):"",function t(e,o){const h=e.childNodes,c=n.test(e.nodeName),d=c?o:"";for(let u,p,g,m,f,_,b=0,v=h.length;b<v;b++)u=h[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+a),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:Q.isList(u.parentElement)||(i+=J.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);Q.removeItem(t),Q.isListCell(e)&&(this.nodeTransform.removeAllParents(e,null,null),Q.isList(e?.firstChild)&&e.insertBefore(Q.createTextNode(K.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&&Q.removeItem(t),t=Q.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(Q.isExcludeFormat(t))return t.outerHTML;const s=Q.getListChildNodes(t,(t=>Q.isSpanWithoutAttr(t)&&!Q.getParentElement(t,Q.isExcludeFormat)))||[];for(let t=s.length-1;t>=0;t--)s[t].outerHTML=s[t].innerHTML;return!e||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||Q.isMedia(t)||Q.isFigure(t)||Q.isAnchor(t)&&Q.isMedia(t.firstElementChild)?Q.isSpanWithoutAttr(t)?t.innerHTML:t.outerHTML:"<"+i+">"+(Q.isSpanWithoutAttr(t)?t.innerHTML:t.outerHTML)+"</"+i+">"}if(3===t.nodeType){if(!e)return J.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+">"+J.htmlToEntity(t)+"</"+i+">");return n}return 8===t.nodeType&&this._allowHTMLComment?"\x3c!--"+t.textContent.trim()+"--\x3e":""},_consistencyCheckOfHTML(t,e,i,s,n,o){const l=[],r=[],a=[],h=[],c=Q.getListChildNodes(t,(c=>{if(n&&1!==c.nodeType)return Q.isList(c.parentElement)&&l.push(c),!1;if(s&&(i.test(c.nodeName)||!e.test(c.nodeName)&&0===c.childNodes.length&&Q.isExcludeFormat(c)))return l.push(c),!1;const d=!Q.getParentElement(c,Q.isExcludeFormat);if(n){if(!Q.isTableElements(c)&&!Q.isListCell(c)&&!Q.isAnchor(c)&&(this.format.isLine(c)||this.format.isBlock(c)||this.format.isTextStyleNode(c))&&0===c.childNodes.length&&d)return r.push(c),!1;if(Q.isList(c.parentNode)&&!Q.isList(c)&&!Q.isListCell(c))return a.push(c),!1;if(Q.isTableCell(c)){const t=c.firstElementChild;if(!this.format.isLine(t)&&!this.format.isBlock(t)&&!this.component.is(t))return h.push(c),!1}}if(o&&d&&c.className){const t=new Array(c.classList).map(this._isAllowedClassName).join(" ").trim();t?c.className=t:c.removeAttribute("class")}if(!n)return!1;return c.parentNode!==t&&d&&(Q.isListCell(c)&&!Q.isList(c.parentNode)||(this.format.isLine(c)||this.component.is(c))&&!this.format.isBlock(c.parentNode)&&!Q.getParentElement(c,this.component.is.bind(this.component)))}));for(let t=0,e=l.length;t<e;t++)Q.removeItem(l[t]);const d=[];for(let t,e,i=0,s=c.length;i<s;i++)if(t=c[i],e=t.parentNode,e&&e.parentNode)if(Q.getParentElement(t,Q.isListCell)){const i=t.childNodes;for(let n=i.length-1;s>=0;n--)e.insertBefore(t,i[n]);d.push(t)}else e.parentNode.insertBefore(t,e),d.push(e);for(let t,e=0,i=d.length;e<i;e++)t=d[e],Q.isZeroWith(t.textContent.trim())&&Q.removeItem(t);for(let t=0,e=r.length;t<e;t++)Q.removeItem(r[t]);for(let t,e,i,s,n=0,o=a.length;n<o;n++)if(t=a[n],s=t.parentNode,s)if(e=Q.createElement("LI"),this.format.isLine(t)){for(i=t.childNodes;i[0];)e.appendChild(i[0]);s.insertBefore(e,t),Q.removeItem(t)}else t=t.nextSibling,e.appendChild(a[n]),s.insertBefore(e,t);for(let t,e,i=0,s=h.length;i<s;i++)t=h[i],e=Q.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":this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||/meta/i.test(t.nodeName)||Q.isExcludeFormat(t)?(e&&(i+=e.outerHTML,e=null),i+=t.outerHTML):(e||(e=Q.createElement(this.options.get("defaultLine"))),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?Q.isList(i)?e+=i.innerHTML:Q.isListCell(i)?e+=i.outerHTML:this.format.isLine(i)?e+="<li>"+(i.innerHTML.trim()||"<br>")+"</li>":this.format.isBlock(i)&&!Q.isTableElements(i)?e+=this._convertListCell(i):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)&&!Q.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:"+tt.get(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=Y.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],J.fontSize.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(!Q.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},constructor:ls};const hs=ls,cs=function(t){Ft.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._dropdownCommands=[],this.__globalEventHandler={mousedown:ds.bind(this),containerDown:this.containerOff.bind(this),keydown:ps.bind(this),mousemove:gs.bind(this),mouseout:us.bind(this)},this._bindClose_dropdown_mouse=null,this._bindClose_dropdown_key=null,this._bindClose_cons_mouse=null,this.currentDropdownPlugin=null};function ds(t){Q.getParentElement(t.target,".se-dropdown")||this.dropdownOff()}function us(){this.index=-1}function ps(t){switch(t.keyCode){case 38:t.preventDefault(),t.stopPropagation(),this._moveItem(-1);break;case 40:t.preventDefault(),t.stopPropagation(),this._moveItem(1);break;case 13:case 32:{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 gs(t){Q.addClass(this.currentDropdown,"se-select-menu-mouse-move"),Q.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}cs.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=Q.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=this.currentDropdownName=t.getAttribute("data-command");this.currentDropdownType=t.getAttribute("data-type");const s=this.currentDropdown=this.targetMap[i];this.currentDropdownActiveButton=t,this._setMenuPosition(t,s),this._bindClose_dropdown_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.mousedown,!1),this._dropdownCommands.includes(i)&&(this.menus=J.nodeListToArray(s.querySelectorAll(".se-toolbar-btn[data-command]")),this.menus.length>0&&(this._bindClose_dropdown_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler.keydown,!1),s.addEventListener("mousemove",this.__globalEventHandler.mousemove,!1),s.addEventListener("mouseout",this.__globalEventHandler.mouseout,!1))),this.currentDropdownPlugin=this.plugins[i],"function"==typeof this.currentDropdownPlugin?.on&&this.currentDropdownPlugin.on(t),this.editor._antiBlur=!0},dropdownOff(){this.__removeGlobalEvent(),this.index=-1,this.menus=[],this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&Q.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.editor._notHideToolbar=!1),this.editor._antiBlur=!1,"function"==typeof this.currentDropdownPlugin?.off&&this.currentDropdownPlugin.off(),this.currentDropdownPlugin=null},containerOn(t){this.__removeGlobalEvent();const e=this._containerName=t.getAttribute("data-command");this.currentContainerActiveButton=t,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._antiBlur=!0},containerOff(){this.__removeGlobalEvent(),this.currentContainer&&(this._containerName="",this.currentContainer.style.display="none",this.currentContainer=null,Q.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.editor._notHideToolbar=!1),this.editor._antiBlur=!1},_setMenuPosition(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",Q.addClass(t.parentElement.children,"on"),this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,Q.getParentElement(t,".se-toolbar"),!1),e.style.visibility=""},_checkMoreLayer(t){const e=Q.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null},_moveItem(t){Q.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),Q.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?Q.addClass(this.menus[t],"on"):Q.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),Q.removeClass(this.menus,"on"),Q.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:cs};const ms=cs,fs=function(t){Ft.call(this,t)};fs.prototype={split(t,e,i){if(Q.isWysiwygFrame(t)||this.component.is(t)||!t)return t;if(e&&!tt.is(e)){const i=t.childNodes;let s=Q.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),3===t.nodeType){if(r=Q.getPositionIndex(t),e>=0&&t.length!==e){t.splitText(e);const i=Q.getNodeFromPath([r+1],s);Q.isZeroWith(i)&&(i.data=K.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=Q.createTextNode(K.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:Q.getNodeDepth(t)===i&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;Q.getNodeDepth(c)>i;)for(r=Q.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(Q.isListCell(n)&&Q.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,Q.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,Q.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,Q.isListCell(n)&&n.children&&Q.isList(n.children[0])&&n.insertBefore(Q.createElement("BR"),n.children[0]),0===s.childNodes.length&&Q.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(i&&s.format._isIgnoreNodeChange(c)||!i&&(Q.isTableElements(c)||Q.isListCell(c)||s.format.isLine(c)&&!s.format.isBrLine(c)))(Q.isTableElements(c)||Q.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(Q.getArrayIndex(s.childNodes,i)!==t[o]){a=!1;break}i=c.parentNode,s=i.parentNode,o--}a&&(t.splice(r,1),t[r]=u)}}Q.copyTagAttributes(c,l),l.parentNode.insertBefore(c,l),Q.removeItem(l)}if(!d){1===c.nodeType&&t(c,r+1,u);break}if(c.nodeName===d.nodeName&&Q.isSameAttributes(c,d)&&c.href===d.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;Q.removeItem(d),u--}else 1===c.nodeType&&t(c,r+1,u)}}(t,0,0),o},mergeNestedTags(t,e){"string"==typeof e?e=function(t){return this.test(t.tagName)}.bind(new RegExp(`^(${e||".+"})$`,"i")):"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(!Q.isWysiwygFrame(i)){const n=i.parentNode;n&&e(i)&&(s={sc:i.previousElementSibling,ec:i.nextElementSibling},Q.removeItem(i),t(n))}}(t),s},removeEmptyNode(t,e,i){const s=this;e&&(e=Q.getParentElement(e,(e=>t===e.parentElement))),function i(n){if(s.format._notTextNode(n)||n===e||Q.isNonEditable(n))return 0;if(n===t||!Q.isZeroWith(n.textContent)||n.firstChild&&Q.isBreak(n.firstChild)||n.querySelector(Y._allowedEmptyNodeList)){const t=n.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(n.parentNode)return n.parentNode.removeChild(n),-1;return 0}(t),0===t.childNodes.length&&(i?Q.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:fs};const _s=fs,{_w:bs}=Y,vs=function(t,e){Ft.call(this,t.editor),this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=e,this.focusElement=e.querySelector("[data-focus]"),this.isUpdate=!1,this._modalArea=this.carrierWrapper.querySelector(".se-modal"),this._modalBack=this.carrierWrapper.querySelector(".se-modal-back"),this._modalInner=this.carrierWrapper.querySelector(".se-modal-inner"),this._closeListener=[ws.bind(this),Cs.bind(this)],this._bindClose=null,this._onClickEvent=null,this._closeSignal=!1,this._modalInner.appendChild(e),this.eventManager.addEvent(e.querySelector("form"),"submit",ys.bind(this)),this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.close.bind(this))};async function ys(t){t.preventDefault(),t.stopPropagation(),this.editor.showLoading();try{const t=await this.inst.modalAction();!1===t?this.editor.hideLoading():void 0===t?this.close():(this.close(),this.editor.hideLoading())}catch(t){throw this.close(),this.editor.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}function Cs(t){(/close/.test(t.target.getAttribute("data-command"))||t.target===this._modalInner)&&this.close()}function ws(t){/27/.test(t.keyCode)&&this.close()}vs.prototype={open(){this.editor._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),this._modalArea.style.display="block",this._modalBack.style.display="block",this._modalInner.style.display="block",this.form.style.display="block",this.focusElement&&this.focusElement.focus()},close(){this._fixCurrentController(!1),bs.setTimeout((()=>{this.editor.opendModal=null}),0),this._closeSignal&&this._modalInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this.form.style.display="none",this._modalBack.style.display="none",this._modalArea.style.display="none","function"==typeof this.inst.init&&this.inst.init(),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"},constructor:vs},vs.CreateFileInput=function({icons:t,lang:e},{acceptedFormats:i,allowMultiple:s}){return`\n\t<div class="se-modal-form-files">\n\t\t<div class="se-flex-input-wrapper">\n\t\t\t<div class="se-input-form-abs">\n\t\t\t\t<div>\n\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${i}"${s?' multiple="multiple"':""}/>\n\t\t</div>\n\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.selection_remove}\n\t\t\t${kt(e.remove)}\n\t\t</button>\n\t</div>`},vs.OnChangeFile=function(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="")};const xs=vs,Es=function(t){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 Q.createElement("DIV",{class:"se-notice"},i)}(t);this.editor=t,this.modal=new xs(this,e),this.message=e.querySelector("span")};Es.prototype={open(t){this.message.textContent=t,this.modal.open()},close(){this.modal.close()},constructor:Es};const Ss=Es,Ts=function(t){Ft.call(this,t),this._scrollEvent=null,this._elTop=0,this._scrollY=0,this._isFixed=!1};function ks(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){let e=0,i=0,s=3===t.nodeType?t.parentElement:t;const n=V(t,D.bind(this)),o=s;for(;s&&!$(s,"se-wrapper")&&s!==n;)e+=s.offsetLeft-(o!==s?s.scrollLeft:0),i+=s.offsetTop+(o!==s?s.scrollTop:0),s=s.offsetParent;const l=this.editor.frameContext.get("eventWysiwyg");return{left:e,top:i-(n?n.scrollTop:0),scrollX:l.scrollX||l.scrollLeft||0,scrollY:l.scrollY||l.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||1!==e.nodeType||(o="absolute"===t.getComputedStyle(e).position);const l=e.offsetWidth,r=e.offsetHeight;let a=0,h=0,c=0,d=0;for(;e;)a+=e.offsetTop,h+=e.offsetLeft,c+=e.scrollTop,d+=e.scrollLeft,e=e.offsetParent;if(!o&&!n&&/^iframe$/i.test(s.nodeName)&&s.contains(e))for(e=this.editor.frameContext.get("wrapper");e;)a+=e.offsetTop,h+=e.offsetLeft,e=e.offsetParent;return{top:a+c,left:h+d,width:l,height:r,scrollTop:c,scrollLeft:d}},getGlobalScroll(e){const i=this.editor.frameContext.get("topArea");let s=!1,n=!1;e||(e=i),e===i&&(s=!0),s||1!==e.nodeType||(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._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),v=i.contains(g);p=b?i:p,g=v?i:g;const y=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=v?i.clientWidth:u;const w=G(this.editor.frameContext.get("_wd"));return{top:o,ts:y,left:l,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:v}},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(!Q.hasClass(a,"sun-editor")&&(a=a.parentElement));l||(this.__removeGlobalEvent(),this._scrollEvent=this.editor.eventManager.addGlobalEvent("scroll",ks.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=G(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=n.addOffset||{left:0,top:0},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=Q.getParentElement(s,".se-controller"),d=h&&!c,u=G(e),p=d?this.getWWScroll():this._getWindowScroll(),g=c?s.getBoundingClientRect():this.selection.getRects(s,"start").rects,m=this.getGlobal(s),f=$(i.firstElementChild,"se-arrow")?i.firstElementChild:null,_=f?f.offsetHeight:0,b=i.offsetHeight,v=s.offsetHeight,y=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:E,rt:S}=this._getVMargin(y,C,w,u,g,d,p);if(h&&(E+v<=0||x+S+v<=0))return;let T=o.top,k=0,N="";"bottom"===l?(N="up",T+=g.bottom+_+t.scrollY,k=E-(b+_),k<0&&(N="down",T-=v+b+2*_,k=w+x-(b+_),k<0&&(N="",T-=k))):(N="down",T+=g.top-b-_+t.scrollY,k=x-(b+_),k<0&&(N="up",T+=v+b+2*_,k=E-(b+_),k<0&&(N="",T+=k))),this._setArrow(f,N),i.style.top=`${T}px`;const L=(1===i.nodeType?tt.get(t.getComputedStyle(i).borderRadius):0)||0,H=m.width,M=i.offsetWidth,A=f?f.offsetWidth:0,B=g.left,I=u.w-g.right;let V,R;if(this.editor.frameContext.get("isFullScreen")?(V=B,R=I):(V=g.left,R=u.w-g.right),h&&(V+H<=0||R+H<=0))return;f&&(f.style.left="",f.style.right="");let O=o.left,z=0,F=0,P=0;return a?(O+=g.left+t.scrollX-(V<0?V:0),z=H+V,z<A&&(P=A/2-1+(L<=2?0:L-2),F=P),z=H+R-M,z<0&&(O+=z,P=M-1-(A/2+(L<=2?0:L-2)),F=-(z-A/2),F=F>P?P:F),f&&F>0&&(f.style.left=F+"px")):(O+=g.right-M+t.scrollX+(R<0?R:0),z=H+R,z<A&&(P=A/2-1+(L<=2?0:L-2),F=P),z=H+V-M,z<0&&(O-=z,P=A/2-1+(L<=2?0:L-2),F=-(z-A/2),F=F<P?P:F>M-P?M-P:F),f&&F>0&&(f.style.right=F+"px")),i.style.left=`${O}px`,r.__offset={left:i.offsetLeft+p.left,top:i.offsetTop+p.top,addOffset:o},!0},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.isSub&&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),v=G(e),y=b?this.getWWScroll():this._getWindowScroll(),C=c.height,w=c.top,x=v.h-c.bottom,E=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:S,rmb:T,rt:k}=this._getVMargin(w,x,E,v,c,b,y);if(!(T+C<=0||S+k+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?(Q.removeClass(h,"se-arrow-up"),Q.addClass(h,"se-arrow-down")):(Q.removeClass(h,"se-arrow-down"),Q.addClass(h,"se-arrow-up"));const v=Math.floor(d/2+(p-f));h.style.left=(v+c>s.offsetWidth?s.offsetWidth-c:v<c?c:v)+"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=""),F(t,"se-arrow-up"),P(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),F(t,"se-arrow-down"),P(t,"se-arrow-up")):t&&(t.style.visibility="hidden")},_getWindowScroll(){const i=Q.getClientSize(e);return{top:t.scrollY,left:t.scrollX,width:i.w,height: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 Ns=Ts,Ls=function(t){Ft.call(this,t),this.range=null,this.selectionNode=null};Ls.prototype={get(){const t=this._shadowRoot?.getSelection()||this.editor.frameContext.get("_ww").getSelection();return t?(this.status._range||this.editor.frameContext.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t):null},isRange:t=>/Range/.test(Object.prototype.toString.call(t?.__proto__)),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=Q.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){if(this.isRange(t)){const n=t;t=n.startContainer,e=n.startOffset,i=n.endContainer,s=n.endOffset}if(!t||!i)return;(Q.isBreak(t)||3===t.nodeType)&&e>t.textContent.length&&(e=t.textContent.length),(Q.isBreak(i)||3===i.nodeType)&&s>i.textContent.length&&(s=i.textContent.length),this.format.isLine(t)&&(t=t.childNodes[e>0?t.childNodes.length-1:0]||t,e=e>0?1!==t.nodeType||Q.isBreak(t)?t.textContent?t.textContent.length:0:1:0),this.format.isLine(i)&&(i=i.childNodes[s>0?i.childNodes.length-1:0]||i,s=s>0?1!==i.nodeType||Q.isBreak(i)?i.textContent?i.textContent.length:0:1:0);const n=this.editor.frameContext.get("_wd").createRange();try{n.setStart(t,e),n.setEnd(i,s)}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.editor._nativeFocus()}const o=this.get();return o.removeAllRanges&&o.removeAllRanges(),o.addRange(n),this.status._range=n,this._rangeInfo(n,this.get()),this.editor.frameOptions.get("iframe")&&this.__focus(),n},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=Q.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=Q.getEdgeChild(this.editor.frameContext.get("wysiwyg").firstChild,(function(t){return 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=1===t?.nodeType&&"absolute"===this._w.getComputedStyle(t).position;t=t&&3!==t.nodeType?t:this.getRange();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=Q.createTextNode(K.zeroWidthSpace);this.html.insertNode(t,null,!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.right,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}},getEventLocationRange(t){let e,i,s,n;if(t.rangeParent)e=t.rangeParent,i=t.rangeOffset,s=t.rangeParent,n=t.rangeOffset;else if(this.editor.frameContext.get("_wd").caretRangeFromPoint){let o=this.editor.frameContext.get("_wd").caretRangeFromPoint(t.clientX,t.clientY);o||(o=this.getRange()),e=o.startContainer,i=o.startOffset,s=o.endContainer,n=o.endOffset}else{const t=this.getRange();e=t.startContainer,i=t.startOffset,s=t.endContainer,n=t.endOffset}return{sc:e,so:i,ec:s,eo:n}},scrollTo(t){t instanceof Ls?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 e=t.getBoundingClientRect();if(e.top>=0&&e.bottom<=this.editor.frameContext.get("wysiwygFrame").innerHeight)return;const i=Q.getParentElement(t.startContainer,(t=>1===t.nodeType));i?.scrollIntoView?.(this.options.get("scrollToOptions"))},_isNone(t){const e=t.commonAncestorContainer;return Q.isWysiwygFrame(t.startContainer)&&Q.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=Q.createElement("BR"),i.appendChild(s))):(s=Q.createElement("BR"),i=Q.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?Q.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.extentNode||e.anchorNode,this.selectionNode=i},_init(){const t=this.editor.frameContext.get("_wd").activeElement;if(Q.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(){const t=Q.getParentElement(this.getNode(),"figcaption");t?t.focus():this.editor.frameContext.get("wysiwyg").focus()},_resetRangeToTextNode(){let t=this.getRange();if(this._isNone(t)){if(!Q.isWysiwygFrame(t.startContainer)||!Q.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;let i,s,n,o=e.startContainer,l=e.startOffset,r=e.endContainer,a=e.endOffset;if(this.format.isLine(o))for(o.childNodes[l]?(o=o.childNodes[l]||o,l=0):(o=o.lastChild||o,l=o.textContent.length);1===o?.nodeType&&o.firstChild;)o=o.firstChild||o,l=0;if(this.format.isLine(r)){for(r=r.childNodes[a]||r.lastChild||r;1===r?.nodeType&&r.lastChild;)r=r.lastChild;a=r.textContent.length}if(i=Q.isWysiwygFrame(o)?this.editor.frameContext.get("wysiwyg").firstChild:o,s=l,Q.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Q.isBreak(i);if(!t){const t=i;for(;i&&!Q.isBreak(i)&&1===i.nodeType&&(n=i.childNodes,0!==n.length);)i=n[s>0?s-1:s]||!/FIGURE/i.test(n[0].nodeName)?n[0]:i.previousElementSibling||i.previousSibling||o,s=s>0?i.textContent.length:s;let e=this.format.getLine(i,null);e===this.format.getBlock(e,null)&&(i=i||t,e=Q.createElement(Q.getParentElement(i,Q.isTableCell)?"DIV":this.options.get("defaultLine")),i.parentNode.insertBefore(e,i),i!==t&&e.appendChild(i))}if(Q.isBreak(i)||this.component.is(i)){const e=Q.createTextNode(K.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,t&&o===r&&(r=i,a=1)}}if(o=i,l=s,i=Q.isWysiwygFrame(r)?this.editor.frameContext.get("wysiwyg").lastChild:r,s=a,Q.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Q.isBreak(i);if(!t){for(;i&&!Q.isBreak(i)&&1===i.nodeType&&(n=i.childNodes,0!==n.length);)i=n[s>0?s-1:s]||!/FIGURE/i.test(n[0].nodeName)?n[0]:i.previousElementSibling||i.previousSibling||o,s=s>0?i.textContent.length:s;let t=this.format.getLine(i,null);t===this.format.getBlock(t,null)&&(t=Q.createElement(Q.isTableCell(t)?"DIV":this.options.get("defaultLine")),i.parentNode.insertBefore(t,i),t.appendChild(i))}if(Q.isBreak(i)){const e=Q.createTextNode(K.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,s=1,t&&!i.previousSibling&&Q.removeItem(r)}}return r=i,a=s,this.setRange(o,l,r,a),!0},constructor:Ls};const Hs=Ls,Ms=function(t){this.editor=t,this.isDisabled=!1};Ms.prototype={command(t,e){if(this.isDisabled)return!1;const i=this.editor.shortcutsKeyMap.get(t+(e?1e3:0));return!(!i||!e&&i.s)&&(this.editor.run(i.c,i.t,i.e),!0)},disable(){this.isDisabled=!0},enable(){this.isDisabled=!1},constructor:Ms};const As=Ms,{_w:Bs}=Y,Is=function(t,{keyName:e,balloon:i,inline:s,balloonAlways:n,res:o}){Ft.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._rButtonsize=null,this._sticky=!1,this._isViewPortSize="visualViewport"in Bs,this._inlineToolbarAttr={top:"",width:"",isShow:!1},this._balloonOffset={top:0,left:0},this._setResponsive()};Is.prototype={disable(){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff(),Q.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)},enable(){Q.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.editorisBalloon&&(this._balloonOffset={top:0,left:0}))},_visible(t){const e=this.context.get(this.keyName+".main");t?Q.removeClass(e,"se-toolbar-onscroll-hide"):Q.addClass(e,"se-toolbar-onscroll-hide")},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._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._rButtonArray[i]))}},setButtons(t){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff();const{options:e,icons:i,lang:s,isSub:n}=this,o=Lt(t,this.plugins,e,i,s,!0),l=e.get("shortcuts");let r;o.updateButtons.forEach((t=>Nt(t.button,t.plugin,this.icons,this.lang,l[t.key]))),r=n?this.editor.subAllCommandButtons=new Map:this.editor.allCommandButtons=new Map,this.editor.commandTargets=new Map,this.editor.__saveCommandButtons(r,o.buttonTray),this.context.get(this.keyName+".main").replaceChild(o.buttonTray,this.context.get(this.keyName+".buttonTray")),this.context.set(this.keyName+".buttonTray",o.buttonTray),this.editor.__setDisabledButtons(),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")&&Q.setDisabled(this.editor._controllerOnDisabledButtons,!0),this.triggerEvent("onSetToolbarButtons",{buttonTray:o.buttonTray,frameContext:this.editor.frameContext})},_resetSticky(){const t=this.context.get(this.keyName+".main");if(this.editor.frameContext.get("isFullScreen")||0===t.offsetWidth||this.options.get("toolbar_sticky")<0)return;const e=this._isViewPortSize?Bs.visualViewport.pageTop:Bs.scrollY,i=this.editor.frameContext.get("_minHeight"),s=this.editor.frameContext.get("wrapper").offsetHeight,n=this.offset.getGlobal(this.editor.frameContext.get("topArea")),o=e+this.options.get("toolbar_sticky"),l=(this._isBalloon||this._isInline?n.top:this.offset.getGlobal(this.options.get("toolbar_container")).top)-(this._isInline?t.offsetHeight:0),r=this.options.get("toolbar_container")?n.top-e+s-i-this.options.get("toolbar_sticky")-t.offsetHeight:s+l+this.options.get("toolbar_sticky")-o-i;o<l?this._offSticky():r<0?(this._sticky||this._onSticky(1),t.style.top=1+r+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",Q.addClass(e,"se-toolbar-sticky"),this._sticky=!0},__getViewportTop(){return this._isViewPortSize?Bs.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="",Q.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._rButtonArray={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((function(t,e){return t-e})).unshift("default")},_showBalloon(t){if(!this._isBalloon||this.editor.opendControllers.length>0)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=Q.getListChildNodes(e.commonAncestorContainer,null);n=Q.getArrayIndex(t,s.focusNode)<Q.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",Q.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}},constructor:Is};const Vs=Is,Rs=function(t){Ft.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 Os(t){let e=Y._w.getComputedStyle(t).lineHeight;if(tt.is(e))e=tt.get(e);else{const i=Y._w.getComputedStyle(t).fontSize;e=1.2*tt.get(i)}return e}Rs.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.editor._offCurrentController(),this.editor._offCurrentModal();const i=e.get("codeWrapper"),s=e.get("code"),n=e.get("wysiwygFrame");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=Os(e),s=t.get("code").scrollHeight/i;let n="";for(let t=1;t<=s;t++)n+=`${t}\n`;const{padding:o,margin:l}=Y._w.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.status._range=null,s.focus(),Q.addClass(this.editor.commandTargets.get("codeView"),"active")):(Q.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(),Q.removeClass(this.editor.commandTargets.get("codeView"),"active"),Q.isNonEditable(n)||(this.history.push(!1),this.history.resetButtons(e.get("key"),null))),this.editor._checkPlaceholder(),Q.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.editor._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="2147483646","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.fullScreenSticky=!0,e.get("_stickyDummy").style.display="none",Q.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=>{Q.changeElement(e.firstElementChild,t),Q.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),this.toolbarParent&&(this.toolbarParent.appendChild(s),this.toolbarParent=null),this.options.get("toolbar_sticky")>-1&&Q.removeClass(s,"se-toolbar-sticky"),this.fullScreenSticky&&!this.options.get("toolbar_container")&&(this.fullScreenSticky=!1,e.get("_stickyDummy").style.display="block",Q.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=>{Q.changeElement(e.firstElementChild,t),Q.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?(Q.addClass(e.get("wysiwyg"),"se-show-block"),Q.addClass(this.editor.commandTargets.get("showBlocks"),"active")):(Q.removeClass(e.get("wysiwyg"),"se-show-block"),Q.removeClass(this.editor.commandTargets.get("showBlocks"),"active")),this.editor._resourcesStateChange(e)},_setButtonsActive(){const t=this.editor.frameContext;if(t.get("isCodeView")?Q.addClass(this.editor.commandTargets.get("codeView"),"active"):Q.removeClass(this.editor.commandTargets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{Q.changeElement(e.firstElementChild,t),Q.addClass(e,"active")}))}else{const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{Q.changeElement(e.firstElementChild,t),Q.removeClass(e,"active")}))}t.get("isShowBlocks")?Q.addClass(this.editor.commandTargets.get("showBlocks"),"active"):Q.removeClass(this.editor.commandTargets.get("showBlocks"),"active")},print(){const t=Q.createElement("IFRAME",{style:"display: none;"});this._d.body.appendChild(t);const e=this.options.get("printTemplate")?this.options.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get(!0)):this.html.get(!0),i=Q.getIframeDocument(t),s=this.editor.frameContext.get("_wd");if(this.editor.frameOptions.get("iframe")){const t=this.options.get("printClass")?'class="'+this.options.get("printClass")+'"':this.editor.frameOptions.get("iframe_fullPage")?Q.getAttributesToString(s.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+'"';i.write("<!DOCTYPE html><html><head>"+s.head.innerHTML+"</head><body "+t+">"+e+"</body></html>")}else{const t=this._d.head.getElementsByTagName("link"),s=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,e=s.length;t<e;t++)n+=s[t].outerHTML;i.write(`<!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</head>\n\t\t\t\t\t<body class="${this.options.get("printClass")?this.options.get("printClass"):this.options.get("_editableClass")}">\n\t\t\t\t\t\t${e} \n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.editor.showLoading(),this._w.setTimeout((()=>{try{if(t.focus(),Y.isEdge||Y.isChromium||this._d.documentMode||this._w.StyleMedia)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.editor.hideLoading(),Q.removeItem(t)}}),1e3)},preview(){this.menu.dropdownOff(),this.menu.containerOff(),this.editor._offCurrentController(),this.editor._offCurrentModal();const t=this.options.get("previewTemplate")?this.options.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get(!0)):this.html.get(!0),e=this._w.open("","_blank");e.mimeType="text/html";const i=this.editor.frameContext.get("_wd");if(this.editor.frameOptions.get("iframe")){const s=this.options.get("printClass")?'class="'+this.options.get("printClass")+'"':this.editor.frameOptions.get("iframe_fullPage")?Q.getAttributesToString(i.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+'"';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; margin: 10px auto !important; height:auto !important; outline:1px dashed #ccc;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${s}>\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"),s=this._d.head.getElementsByTagName("style");let n="";for(let t=0,e=i.length;t<e;t++)n+=i[t].outerHTML;for(let t=0,e=s.length;t<e;t++)n+=s[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${n}\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")}" style="margin:10px auto !important; height:auto !important; outline:1px dashed #ccc;">\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+=J._setIframeStyleLinks(this.editor.frameOptions.get("iframe_cssFileName"))+J._setAutoHeightStyle(this.editor.frameOptions.get("height"))),e.head.innerHTML=s,e.body.innerHTML=this.html.clean(i.body.innerHTML,!0,null,null);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(!Q.hasClass(e.body,"sun-editor-editable")){const t=this.options.get("_editableClass").split(" ");for(let i=0;i<t.length;i++)Q.addClass(e.body,this.options.get("_editableClass")[i])}}else this.editor.frameContext.get("wysiwyg").innerHTML=t.length>0?this.html.clean(t,!0,null,null):"<"+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=Q.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=Os(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:Rs};const zs=Rs,$s=".se-menu-list .se-toolbar-btn[data-command]",Fs=`${$s}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,Ps=`${$s}:not([class~="se-component-enabled"]):not([data-type="MORE"])`,Ds=function(t,e){const i=t[0].target.ownerDocument||Y._d,s=i.defaultView||Y._w,n=Ht(t,e);this.rootKeys=n.rootKeys,this.frameRoots=n.frameRoots,this.context=n.context,this.frameContext=new Map,this.frameOptions=new Map,this._lineBreaker_t=null,this._lineBreaker_b=null,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=null,this.isInline=null,this.isBalloon=null,this.isBalloonAlways=null,this.isSubBalloon=null,this.isSubBalloonAlways=null,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._shadowRoot=null,this._onPluginEvents=null,this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,this.opendModal=null,this.opendControllers=[],this.currentControllerName="",this._controllerTargetContext=null,this.selectMenuOn=!1,this._backWrapper=n.carrierWrapper.querySelector(".se-back-wrapper"),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._antiBlur=!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){return/^statusbar/i.test(t)?"statusbar":t}function Us(t,e,i){for(let s,n=0,o=t.length;n<o;n++)s=t[n],(ft.includes(s)||e&&e[s])&&(console.warn(`[SUNEDITOR.warn.resetOptions] "[${i+s}]" options not available in resetOptions have no effect.`),t.splice(n--,1),o--)}Ds.prototype={registerPlugin(t,e,i,s){let n=this.plugins[t];if(!n)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]&&(n=this.plugins[t]=new this.plugins[t](this,i||{}),"function"==typeof n.init&&n.init()),e){for(let t=0,i=e.length;t<i;t++)Nt(e[t],n,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=Q.getParentElement(i,".se-toolbar"),s=Q.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()),Q.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")&&Q.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):/fileBrowser/.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._offCurrentController(),t.menu.containerOff();const e=Q.getParentElement(t.selection.getNode(),"FIGCAPTION")||t.frameContext.get("wysiwyg");let i=Q.getEdgeChild(e.firstChild,(t=>0===t.childNodes.length||3===t.nodeType||Q.isTable(t)),!1)||e.firstChild,s=Q.getEdgeChild(e.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||Q.isTable(t)),!0)||e.lastChild;if(i&&s){if(Q.isMedia(i)||t.component.is(i.parentElement)||Q.isTableElements(i)){const e=t.component.get(i),s=Q.createElement("BR"),n=Q.createElement(t.options.get("defaultLine"),null,s);i=e?e.container||e.cover:i,i.parentNode.insertBefore(n,i),i=s}(Q.isMedia(s)||t.component.is(s.parentElement)||Q.isTableElements(s))&&(s=Q.createElement("BR"),e.appendChild(Q.createElement(t.options.get("defaultLine"),null,s))),t.toolbar._showBalloon(t.selection.setRange(i,0,s,s.textContent.length))}}(this);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===Mt){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.setAttribute("disabled",!0)}))}(this);break;case"copyFormat":zt(this,e);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:Q.createElement(i);/^sub$/i.test(i)&&s.includes("superscript")?i="sup":/^sup$/i.test(i)&&s.includes("subscript")&&(i="sub"),t.format.applyInlineElement(n,At[e]||null,[i],!1),t.focus()}(this,t)}},runFromTarget(t){if(Q.isInputElement(t)||!(t=Q.getCommandTarget(t)))return;const e=t.getAttribute("data-command"),i=t.getAttribute("data-type");(e||i)&&(t.disabled||this.run(e,i,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 Q.isZeroWith(e.textContent)&&!e.querySelector(Y._allowedEmptyNodeList)&&(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._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=>{Q.addClass([t.get("topArea"),t.get("wysiwyg")],"se-rtl")})),Q.addClass([this.carrierWrapper,n,o],"se-rtl")):(this.applyFrameRoots((t=>{Q.removeClass([t.get("topArea"),t.get("wysiwyg")],"se-rtl")})),Q.removeClass([this.carrierWrapper,n,o],"se-rtl"));const l=Q.getListChildren(i.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=>{Q.changeTxt(s.querySelector(".se-tooltip-text"),t.lang[e?"dir_ltr":"dir_rtl"]),Q.changeElement(s.firstElementChild,i[e?"dir_ltr":"dir_rtl"])})),e?(Q.addClass(s.get("dir_rtl"),"active"),Q.removeClass(s.get("dir_ltr"),"active")):(Q.addClass(s.get("dir_ltr"),"active"),Q.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){const e=Object.keys;this.viewer.codeView(!1),this.viewer.showBlocks(!1);const i=e(t);if(Us(i,this.plugins,""),0===i.length)return;const s={},n=this.rootKeys,o=this.frameRoots,l=[],r={};this._originOptions=[t,this._originOptions].reduce((function(t,i){for(const a in i)if(n.includes(a)&&i[a]){const t=i[a],n=e(t);if(Us(n,null,a+"."),0===n.length)continue;s[a]=new Map;const h=o.get(a).get("options").get("_origin");for(const e in t){const i=t[e];n.includes(e)&&h[e]!==i&&(s[a].set(Ws(e),!0),h[e]=i)}l.push(r[a]={options:h})}else t[a]=i[a];return t}),{});const a=this.options,h=vt(this._originOptions,l,this.plugins).o;for(let t,e=0;t=i[e];e++)if(r[t]){const e=s[t],i=o.get(t),n=i.get("options"),l=r[t].options;if(e.has("statusbar"))if(Q.removeItem(i.get("statusbar")),l.get("statusbar")){const t=yt(l,null).statusbar;i.get("container").appendChild(t),lt(t,i),this.eventManager.__addStatusbarEvent(i,l)}else this.eventManager.removeEvent(n.get("__statusbarEvent")),l.set("__statusbarEvent",null),lt(null,i);if(e.has("iframe_attributes")){const t=i.get("wysiwygFrame"),e=n.get("iframe_attributes"),s=l.get("iframe_attributes");for(const i in e)t.removeAttribute(i,e[i]);for(const e in s)t.setAttribute(e,s[e])}if(e.has("iframe_cssFileName")){const t=i.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const s=(new DOMParser).parseFromString(J._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,n=t.querySelector("style");for(;s[0];)t.insertBefore(s[0],n)}i.set("options",l),this.setEditorStyle(l.get("_defaultStyles"),i);const a=i.get("wysiwyg"),h=n.get("editableFrameAttributes"),c=l.get("editableFrameAttributes");for(const t in h)a.removeAttribute(t,h[t]);for(const t in c)a.setAttribute(t,c[t])}else a.set(t,h.get(t)),"historyStackDelayTime"!==t?"textDirection"!==t||this.setDir(a.get("_rtl")?"ltr":"rtl"):this.history.resetDelayTime(a.get("historyStackDelayTime"));const c=this.context.get("toolbar.main");/inline|balloon/i.test(a.get("mode"))&&i.includes("toolbar_width")&&(c.style.width=a.get("toolbar_width")),a.get("toolbar_hide")&&(c.style.display="none"),a.get("shortcutsHint")?Q.removeClass(c,"se-shortcut-hide"):Q.addClass(c,"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._antiBlur=!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&&Q.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.format.isLine(e)&&!this.component.is(e)){const t=Q.createElement("BR"),i=Q.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._antiBlur=!1,t||(t=this.frameContext.get("wysiwyg").lastElementChild);const e=this.component.get(t);e?this.component.select(e.target,e.pluginName,!1):t?(3!==t.nodeType&&(t=Q.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()},setEditorStyle(t,e){const i=(e=e||this.frameContext).get("options"),s=J._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},readOnly(t,e){const i=e?this.frameRoots.get(e):this.frameContext;i.set("isReadOnly",!!t),Q.setDisabled(this._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(),this.modalForm&&this.plugins.modal.close.call(this),i.get("code").setAttribute("readOnly","true"),Q.addClass(i.get("wysiwygFrame"),"se-read-only")):(i.get("code").removeAttribute("readOnly"),Q.removeClass(i.get("wysiwygFrame"),"se-read-only")),this.options.get("hasCodeMirror")&&this.viewer._codeMirrorEditor("readonly",!!t,e)},disable(t){const e=t?this.frameRoots.get(t):this.frameContext;this.toolbar.disable(),this._offCurrentController(),this._offCurrentModal(),this.modalForm&&this.plugins.modal.close.call(this),e.get("wysiwyg").setAttribute("contenteditable",!1),e.set("isDisabled",!0),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").setAttribute("disabled",!0)},enable(t){const e=t?this.frameRoots.get(t):this.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").removeAttribute("disabled")},show(t){const e=(t?this.frameRoots.get(t):this.frameContext).get("topArea").style;"none"===e.display&&(e.display="block")},hide(t){(t?this.frameRoots.get(t):this.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"},enableBackWrapper(t){this._backWrapper.style.cursor=t,this._backWrapper.style.display="block"},disableBackWrapper(){this._backWrapper.style.display="none",this._backWrapper.style.cursor="default"},destroy(){this.history.destroy(),this.eventManager._removeAllEvents(),Q.removeItem(this.carrierWrapper),Q.removeItem(this.context.get("toolbar._wrapper")),Q.removeItem(this.context.get("toolbar.sub._wrapper")),Q.removeItem(this.context.get("statusbar._wrapper")),this.applyFrameRoots((t=>{Q.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","notice","offset","selection","shortcuts","toolbar","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")},_visibleControllers(t,e){const i=t?"":"hidden",s=e??i?"":"hidden",n=this.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=i);this._lineBreaker_t.style.visibility=s,this._lineBreaker_b.style.visibility=s},_offCurrentController(){this.component.__deselect()},__offControllers(){const t=this.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.opendControllers=e,this.currentControllerName="",this._antiBlur=!1},_offCurrentModal(){this.opendModal&&this.opendModal.close()},_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)||"",!0,null,null)||"<"+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 Ue(this,t)),t.get("documentType").useHeader&&t.set("documentType-use-header",!0),t.get("documentType").usePage&&t.set("documentType-use-page",!0))},_resourcesStateChange(t){this._iframeAutoHeight(t),this._checkPlaceholder(t)},_iframeAutoHeight(t){const e=t.get("_iframeAuto");e?this._w.setTimeout((()=>{const i=e.offsetHeight;t.get("wysiwygFrame").style.height=i+"px",Y.isResizeObserverSupported||this.__callResizeFunction(t,i,null)}),0):Y.isResizeObserverSupported||this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null),t.has("documentType-use-page")&&t.get("documentType").rePage()},__callResizeFunction(t,e,i){e=-1===e?i?.borderBoxSize&&i.borderBoxSize[0]?i.borderBoxSize[0].blockSize:i.contentRect.height+tt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+tt.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=Rt,this._onPluginEvents=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPastAndDrop",[]]]),this._fileManager.tags=[],this._fileManager.pluginMap={},this._fileManager.tagAttrs={};const e=this.plugins,i=Array.isArray,s=this.options.get("shortcuts"),n=[];let o;for(const l in e){if(this.registerPlugin(l,this._pluginCallButtons[l],t[l],s[l]),this.registerPlugin(l,this._pluginCallButtons_sub[l],t[l],s[l]),o=this.plugins[l],"object"==typeof o.__fileManagement){const t=o.__fileManagement;if(this._fileInfoPluginsCheck.push(t._checkInfo.bind(t)),this._fileInfoPluginsReset.push(t._resetInfo.bind(t)),i(t.tagNames)){const e=t.tagNames;this._fileManager.tags=this._fileManager.tags.concat(e),n.push(l);for(let i,s=0,n=e.length;s<n;s++)i=e[s].toLowerCase(),this._fileManager.pluginMap[i]=l,t.tagAttrs&&(this._fileManager.tagAttrs[i]=t.tagAttrs)}}"function"==typeof o.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(o,o.constructor));const e=o.constructor.options||{};if(this._onPluginEvents.forEach(((t,i)=>{if("function"==typeof o[i]){const s=o[i].bind(o);s.index=e[`eventIndex_${i}`]||e.eventIndex||0,t.push(s)}})),o.retainFormat){const t=o.retainFormat();this._MELInfo.set(t.query,t.method)}}this._fileManager.regExp=new RegExp(`^(${this._fileManager.tags.join("|")||"\\^"})$`,"i"),this._fileManager.pluginRegExp=new RegExp(`^(${0===n.length?"\\^":n.join("|")})$`,"i"),delete this._pluginCallButtons,delete this._pluginCallButtons_sub,this.__cachingButtons()},__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=J.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(Fs)),this._controllerOnDisabledButtons=J.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(Ps)),this.options.has("_subMode")&&(this._codeViewDisabledButtons=this._codeViewDisabledButtons.concat(J.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(Fs))),this._controllerOnDisabledButtons=this._controllerOnDisabledButtons.concat(J.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(Ps))))},__saveCommandButtons(t,e){const i=e.querySelectorAll($s),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),_t(r,e,s[r],o,n,l)},__setCommandTargets(t,e){if(!t||!e)return;(Ot.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">'+J._setIframeStyleLinks(i.get("iframe_cssFileName"))+J._setAutoHeightStyle(i.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable",!0)},__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={onload:null,onScroll:null,onMouseDown:null,onClick:null,onInput:null,onMouseLeave:null,onKeyDown:null,onKeyUp:null,onCopy:null,onCut:null,onFocus:null,onBlur: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,onImageDeleteBefore:null,onImageLoad:null,onImageAction:null,onImageUploadError:null,videoUploadHandler:null,onVideoUploadBefore:null,onVideoUploadError:null,onVideoLoad:null,onVideoAction:null,onVideoDeleteBefore:null,audioUploadHandler:null,onAudioUploadBefore:null,onAudioUploadError:null,onAudioAction:null,onAudioDeleteBefore:null,onAudioLoad:null,onFileAction:null,onFileDeleteBefore:null,onFileLoad:null,onFileUploadBefore:null,onFileUploadError:null,onExportPdfBefore:null,onFileManagerAction:null,...this.options.get("events")},this.triggerEvent=async(t,e)=>{const i=this.events[t];return"function"==typeof i?await i({editor:this,...e}):Y.NO_EVENT},this.history=$t(this),this.eventManager=new Fe(this),this.offset=new Ns(this),this.shortcuts=new As(this),this.notice=new Ss(this),this.toolbar=new Vs(this,{keyName:"toolbar",balloon:this.isBalloon,balloonAlways:this.isBalloonAlways,inline:this.isInline,res:this._responsiveButtons}),this.options.has("_subMode")&&(this.subToolbar=new Vs(this,{keyName:"toolbar.sub",balloon:this.isSubBalloon,balloonAlways:this.isSubBalloonAlways,inline:!1,res:this._responsiveButtons_sub})),this.selection=new Hs(this),this.html=new hs(this),this.nodeTransform=new _s(this),this.component=new ts(this),this.format=new os(this),this.menu=new ms(this),this.char=new je(this),this.viewer=new zs(this),Ze.call(this.eventManager,this),Ze.call(this.char,this),Ze.call(this.component,this),Ze.call(this.format,this),Ze.call(this.html,this),Ze.call(this.menu,this),Ze.call(this.nodeTransform,this),Ze.call(this.offset,this),Ze.call(this.selection,this),Ze.call(this.toolbar,this),Ze.call(this.viewer,this),this.options.has("_subMode")&&Ze.call(this.subToolbar,this),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.toolbar.toolbar,delete this.viewer.viewer,this.subToolbar&&delete this.subToolbar.subToolbar,this._responsiveButtons=this._responsiveButtons_res=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")))})),e.length>0&&await Promise.all(e),this.__editorInit(t)},Constructor:Ds};const Zs=Ds,qs=function(t){Xe.call(this,t),this.title=this.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=Q.createElement("BLOCKQUOTE")};qs.key="blockquote",qs.type="command",qs.className="",qs.prototype={active:(t,e)=>/blockquote/i.test(t?.nodeName)?(Q.addClass(e,"active"),!0):(Q.removeClass(e,"active"),!1),action(){const t=Q.getParentElement(this.selection.getNode(),"blockquote");t?this.format.removeBlock(t,null,null,!1,!1):this.format.applyBlock(this.quoteTag.cloneNode(!1))},constructor:qs};const Gs=qs,js=function(t,e){this.editor=t.editor,this.kind=t.constructor.key||t.constructor.name,this._xhr=Y.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};async function Xs(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.editor.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.editor.notice.open(n)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.editor.hideLoading()}}}js.prototype={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=Xs.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.editor.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t,o)}finally{this.editor.hideLoading()}},o.onerror=()=>{l(new Error("Network error"))},o.send(s)}))},cancel(){this._xhr&&this._xhr.abort()},_normalizeUrl:t=>t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1"),constructor:js};const Ys=js,{_d:Ks}=Y,Js=function(t,e){Xe.call(this,t),this.title=this.lang.exportPdf,this.icon="pdf",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.jsPDFOptions=e.jsPDFOptions||{},this.html2canvasOptions=e.html2canvasOptions||{},this.apiUrl||this.options.get("externalLibs").html2canvas||this.options.get("externalLibs").jsPDF?this.apiUrl&&(this.apiManager=new Ys(this,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"})):console.warn('[SUNEDITOR.plugins.exportPdf.error] Requires "apiUrl" or externalLibs.html2canvas and externalLibs.jsPDF options.')};Js.key="exportPdf",Js.type="command",Js.className="se-component-enabled",Js.prototype={async action(){this.editor.showLoading();let t=null;try{const e=this.editor.frameContext.get("topArea"),i=Q.createElement("div",{class:this.editor.frameContext.get("wysiwygFrame").className},this.html.get());if(t=Q.createElement("div",{style:`position: absolute; left: -10000px; width: ${e.clientWidth}px; height: auto;`},i),this.apiUrl){const e=Q.applyInlineStylesAll(i,!0,this.options.get("allUsedStyles"));t.innerHTML=e.outerHTML}if(Ks.body.appendChild(t),!1===await this.triggerEvent("onExportPdfBefore",{editableDiv:i}))return;if(this.apiUrl)return void await this._createByServer(t);const s=async()=>{const e=t.querySelectorAll("img, audio, video"),i=Array.from(e).map((t=>{switch(t.tagName.toLowerCase()){case"img":return new Promise((e=>{t.complete&&0!==t.naturalHeight?e():(t.onload=e,t.onerror=()=>e())}));case"audio":case"video":return new Promise((e=>{t.readyState>=4?e():(t.onloadeddata=e,t.onerror=()=>e())}));default:return Promise.resolve()}}));await Promise.all(i),await this._createByHtml2canvas(t)};new MutationObserver(s).observe(t,{childList:!0,subtree:!0,attributes:!0}),await s()}catch(t){console.error(`[SUNEDITOR.plugins.exportPdf.error] ${t.message}`)}finally{this.editor.hideLoading()}},async _createByHtml2canvas(t){const e=await this.options.get("externalLibs").html2canvas(t,{useCORS:!0,logging:!0,...this.html2canvasOptions}),i=e.toDataURL("image/png"),s=new(this.options.get("externalLibs").jsPDF)({orientation:"portrait",unit:"px",format:[e.width,e.height],...this.jsPDFOptions});s.addImage(i,"PNG",0,0,e.width,e.height),s.save(`${this.fileName}.pdf`)},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=Q.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Ks.body.appendChild(r),r.click()}finally{setTimeout((()=>{Q.removeItem(r),URL.revokeObjectURL(o)}),100)}},constructor:Js};const Qs=Js,tn=function(t,e){Ft.call(this,t.editor),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 Ys(this,null)};function en(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}tn.prototype={upload(t,e,i,s,n){this.editor.showLoading();let o=null;if(i.length){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.editor.showLoading();let s=null;if(i.length){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=en(t,"index"),s=null,n="";if(e||(e={name:en(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:en(t,"file-size")||0}),!i||this._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:1*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=en(t,"file-name"),s.size=1*en(t,"file-size")}s.element=t,s.delete=function(t){"function"==typeof this.inst.destroy&&this.inst.destroy.call(this.inst,t),this._deleteInfo(1*en(t,"index"))}.bind(this,t),s.select=function(t){t.scrollIntoView(this.options.get("componentScrollToOptions"));const e=this.component.get(t);e?this.component.select(e.target,e.pluginName,!1):"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};"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._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()===en(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();en(t,"index")&&n.includes(1*en(t,"index"))?s.push(1*en(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};"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};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}))},constructor:tn};const sn=tn,{NO_EVENT:nn}=Y,on=function(t,e){Xe.call(this,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=/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,this.uploadSingleSizeLimit=/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,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=Q.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&&Q.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)}}};let s=e.controls||[["custom-as","edit","align","remove","custom-download"]];if(s=s.map((t=>t.map((t=>t.startsWith("custom-")?i[t]:t)))),this.figure=new Oi(this,s,{}),this.fileManager=new sn(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 Q.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.controller=new li(this,t,{position:"bottom",disabled:!0},on.key),this.editInput=t.querySelector("input")}this.eventManager.addEvent(this.input,"change",ln.bind(this))};async function ln(t){await this.submitFile(t.target.files)}on.key="fileUpload",on.type="command",on.className="",on.options={eventIndex:1e4},on.component=function(t){return Q.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null},on.prototype={action(){this.input.click()},select(t){this._element=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(!Q.isFigure(t.parentElement))return e.innerHTML=this.icons.expansion+kt(this.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0;e.innerHTML=this.icons.reduction+kt(this.lang.asLink),e.setAttribute("data-value","link"),this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})},onPastAndDrop({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:!Q.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,on.key,!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.notice.open(e===nn?t:e||t),!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.notice.open(i===nn?t:i||t),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:i},r=async function(t,e){t=e||t;const i=await this.fileManager.asyncUpload(t.url,t.uploadHeaders,t.files);this._uploadCallBack(i)}.bind(this,l),a=await this.triggerEvent("onFileUploadBefore",{...l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==nn||r(null)))},async destroy(t){if(!t)return;const e=Oi.GetContainer(t);t=Q.getParentElement(t,".se-component")||t;if(!1===await this.triggerEvent("onFileDeleteBefore",{target:e.target,container:e,url:e.target.getAttribute("href")}))return;const i=this.component.isInline(t)?t.previousSibling||t.nextSibling:t.previousElementSibling||t.nextElementSibling;Q.removeItem(t),this.editor._offCurrentController(),this.editor.focusEdge(i),this.history.push(!1)},convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=Oi.GetContainer(t),i=e.nextElementSibling,s=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable",!1),Q.addClass(t,"se-component|se-inline-component");const n=Q.createElement(this.options.get("defaultLine"),null,t);s.insertBefore(n,i),Q.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&&Q.isZeroWith(i.previousElementSibling)&&Q.removeItem(i.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),Q.removeClass(t,"se-component|se-component-selected|se-inline-component");const s=Oi.CreateContainer(t,"se-file-figure se-flex-component");(i||e.container).parentElement.insertBefore(s.container,i)}this.history.push(!1),this.component.select(t,on.key,!1)},_register(t){t.result.forEach(((t,e,i)=>{this._create(t.url,{name:t.name,size:t.size},e===i.length-1)}))},_create(t,e,i){const s=e.name||t,n=Q.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,!1,!1);const o=Oi.CreateContainer(n);if(Q.addClass(o.container,"se-file-figure|se-flex-component"),this.component.insert(o.container,!1,!i||!this.options.get("componentAutoSelect"))){if(i)if(this.options.get("componentAutoSelect"))this.component.select(n,on.key,!1);else{const t=this.format.addLine(o.container,null);t&&this.selection.setRange(t,0,t,0)}}else this.editor.focus()},async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===nn?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)},_uploadCallBack(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)},constructor:on};const rn=on,an=function(t){Xe.call(this,t),this.title=this.lang.bulletedList,this.icon="list_bulleted",this.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":an.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 Q.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ul"),this.menu.initDropdownTarget({key:an.key,type:"dropdown"},e)};an.key="list_bulleted",an.type="command",an.className="se-icon-flip-rtl",an.prototype={active:(t,e)=>Q.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(Q.addClass(e,"active"),!0):(Q.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?Q.addClass(e.parentElement,"active"):Q.removeClass(e.parentElement,"active")},action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ul")?.style.listStyleType||"";if(Q.isList(e)&&i)e.style.listStyleType=i;else{const t=this.format.applyList(`ul:${i}`,null,!1);t&&this.selection.setRange(t.sc,t.so,t.ec,t.eo)}this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)},constructor:an};const hn=an,cn=function(t){Xe.call(this,t),this.title=this.lang.numberedList,this.icon="list_numbered",this.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":cn.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${dn(["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${dn(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return Q.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ol"),this.menu.initDropdownTarget({key:cn.key,type:"dropdown"},e)};function dn(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("")}cn.key="list_numbered",cn.type="command",cn.className="se-icon-flip-rtl",cn.prototype={active:(t,e)=>Q.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(Q.addClass(e,"active"),!0):(Q.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?Q.addClass(e.parentElement,"active"):Q.removeClass(e.parentElement,"active")},action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ol")?.style.listStyleType||"";if(Q.isList(e)&&i)e.style.listStyleType=i;else{const t=this.format.applyList(`ol:${i}`,null,!1);t&&this.selection.setRange(t.sc,t.so,t.ec,t.eo)}this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)},constructor:cn};const un=cn,{debounce:pn}=J,gn=function(t,e){Xe.call(this,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.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,this.limitSize)||"",this._delay=0,this._lastAtPos=0,this._anchorOffset=0,this._anchorNode=null,this.apiManager=new Ys(this,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?new Map([["",[]]]):null;const i=Q.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new mi(this,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new li(this,i,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(i.firstElementChild,mn.bind(this)),this.onInput=pn(this.onInput.bind(this),this.delayTime)};function mn(t){if(!t)return!1;let e=null;const{key:i,name:s,url:n}=t,o=this._anchorNode.parentNode;if(Q.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=Q.createElement("A",{"data-se-mention":i,href:n,title:s,target:"_blank"},this.triggerText+i),!this.html.insertNode(e,null,!1))return!1;this.selectMenu.close();const l=Q.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.selection.setRange(l,1,l,1),this.cachingFieldData&&this.cachingFieldData.get("").push(t)}gn.key="mention",gn.type="field",gn.className="",gn.prototype={async onInput(){this.apiManager.cancel();const t=this.selection.get();if(!t.rangeCount)return void this.selectMenu.close();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||Q.isZeroWith(o))){if(t.length<this.searchStartLength)return!0;const s=e.parentNode;if(Q.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){let i=null;if(this.cachingData&&(i=this.cachingData.get(t)),!i){const e=await this.apiManager.asyncCall({method:"GET",url:this._createUrl(t)});i=JSON.parse(e.responseText)}if(this.cachingFieldData&&(i=this.cachingFieldData.get("").concat(i).splice(0,this.limitSize)),!i?.length)return this.selectMenu.close(),!1;const s=[],n=[];for(let t,e=0,o=i.length;e<o;e++)t=i[e],s.push(t),n.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===s.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(s,n),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,s),!0)},_createUrl(t){return this.apiUrl.replace(/\{key\}/i,t)},constructor:gn};const fn=gn,_n=function(t,e){Xe.call(this,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 Q.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(_n,i)};_n.key="align",_n.type="dropdown",_n.className="",_n.prototype={active(t,e){const i=e.firstElementChild;if(t){if(this.format.isLine(t)){const s=t.style.textAlign;if(s)return Q.changeElement(i,this.alignIcons[s]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",s),!0}}else Q.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")?Q.addClass(i[t],"active"):Q.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++)Q.setStyle(s[t],"textAlign",e===i?"":e);this.editor.effectNode=null,this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)},constructor:_n};const bn=_n,vn=function(t,e){Xe.call(this,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" 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>",Q.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(vn,s)};vn.key="font",vn.type="dropdown",vn.className="se-btn-select se-btn-tool-font",vn.prototype={active(t,e){const i=e.querySelector(".se-txt"),s=e.parentNode.querySelector(".se-tooltip-text");if(t){if(t?.style.fontFamily.length>0){const e=t.style.fontFamily.replace(/["']/g,"");return Q.changeTxt(i,e),Q.changeTxt(s,this.lang.font+" ("+e+")"),!0}}else{const t=this.status.hasFocus?this.editor.frameContext.get("wwComputedStyle").fontFamily:this.lang.font;Q.changeTxt(i,t),Q.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,"")?Q.addClass(e[t],"active"):Q.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=Q.createElement("SPAN",{style:"font-family: "+e+";"});this.format.applyInlineElement(t,["font-family"],null,null)}else this.format.applyInlineElement(null,["font-family"],["span"],!0);this.menu.dropdownOff()},constructor:vn};const yn=vn,{isMobile:Cn}=Y,wn=240,xn=wn/2,En=3,Sn=10,Tn=14,kn={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Nn,Ln=0,Hn=!1,Mn=!1,An=wn/2,Bn=wn/2,In=kn;const Vn=function(t,e,i){if(e||(e={}),this.editor=t.editor,this.eventManager=t.eventManager,this.inst=t,this.form=e.form,this.ctx={wheelX:An,wheelY:Bn,lightness:Ln,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:kn},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=Q.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 li(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()}))}};Vn.prototype={get:()=>In,open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})},off(){this.ctx={gradientPointerX:Wn.style.left,wheelPointerX:Pn.style.left,wheelPointerY:Pn.style.top,wheelX:An,wheelY:Bn,lightness:Ln,color:Nn?.color||io(Fn)},this.controller.close(),this.init()},close(){this.off(),this.inst.hueSliderCancelAction()},attach(t){this.init(),(t||this.form).appendChild(Rn),Nn=this.ctx,Nn&&(An=Nn.wheelX,Bn=Nn.wheelY,Ln=Nn.lightness,Pn.style.left=Nn.wheelPointerX,Pn.style.top=Nn.wheelPointerY,Wn.style.left=Nn.gradientPointerX,eo(Nn.color.hex),so(),Jn(Qn()));const e={name:"mousedown",func:jn},i={name:"mousemove",func:Xn,option:!0},s={name:"mouseup",func:()=>{Hn=!1,Mn=!1}};Cn&&(e.name="touchstart",i.name="touchmove",s.name="touchend",e.func=qn,i.func=Gn),this.__globalMouseDown=this.eventManager.addGlobalEvent(e.name,e.func,{passive:!1,useCapture:!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,Hn=!1,Mn=!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))},constructor:Vn};const{slider:Rn,offscreenCanvas:On,offscreenCtx:zn,wheel:$n,wheelCtx:Fn,wheelPointer:Pn,gradientBar:Dn,gradientPointer:Wn,fanalColorHex:Un,fanalColorBackground:Zn}=function(){const t=document.createElement("canvas");t.width=wn,t.height=wn;const e=`\n\t<div class="se-hue-slider-container" style="width: ${wn}px; height: ${wn}px;">\n <canvas class="se-hue-wheel" width="${wn}" height="${wn}"></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="${wn}" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:${wn}px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${kn.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=Q.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 qn(t){const{target:e,touches:i}=t,s=i[0].clientX,n=i[0].clientY;e===$n?(t.preventDefault(),Mn=!1,Hn=!0,Yn(s,n)):e===Dn&&(t.preventDefault(),Mn=!0,Hn=!1,Kn(s))}function Gn(t){t.preventDefault();const{touches:e}=t,i=e[0].clientX,s=e[0].clientY;Hn?Yn(i,s):Mn&&Kn(i)}function jn({target:t,clientX:e,clientY:i}){t===$n?(Mn=!1,Hn=!0,Yn(e,i)):t===Dn&&(Mn=!0,Hn=!1,Kn(e))}function Xn({clientX:t,clientY:e}){Hn?Yn(t,e):Mn&&Kn(t)}function Yn(t,e){const i=$n.getBoundingClientRect();t=t-i.left-xn,e=e-i.top-xn;const s=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),xn),o=xn+n*Math.cos(s*Math.PI/180),l=xn+n*Math.sin(s*Math.PI/180);Pn.style.left=`${o}px`,Pn.style.top=`${l}px`,function(t,e){An=t,Bn=e,Jn(Qn())}(o,l),to()}function Kn(t){const e=Dn.getBoundingClientRect();let i=t-e.left;i=Math.max(Tn,Math.min(i,e.width-Tn)),Wn.style.left=`${i}px`,function(t){const e=Dn.getBoundingClientRect();let i=t-e.left;i<0&&(i=0);i>e.width&&(i=e.width);const s=Tn;i>=Dn.width-s?i=Dn.width:i<=s&&(i=0);const n=1-i/e.width;Ln=n,so()}(t),to()}function Jn(t){const e=Dn.getContext("2d"),i=e.createLinearGradient(0,0,Dn.width,0);i.addColorStop(0,"black"),i.addColorStop(1,t.hex),e.fillStyle=i,e.fillRect(0,0,Dn.width,Dn.height)}function Qn(){return io(zn)}function to(){Nn.color=In=io(Fn),eo(In.hex)}function eo(t){Zn.style.backgroundColor=Un.textContent=t}function io(t){const e=t.getImageData(An,Bn,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[oo(o),oo(l),oo(r)]}(e);const o=An-xn,l=Bn-xn;Math.sqrt(o*o+l*l)<En&&(n=1-Ln),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:oo(n)}}function so(){Fn.clearRect(0,0,wn,wn),Fn.drawImage(On,0,0),Fn.globalAlpha=Ln,Fn.fillStyle="black",Fn.beginPath(),Fn.arc(xn,xn,xn,0,2*Math.PI),Fn.fill(),Fn.globalAlpha=1}function no(t){return t*Math.PI/180}function oo(t){const e=Math.pow(10,Sn);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<=xn;i+=1){t.beginPath();const s=50+(xn-i)/xn*50;t.fillStyle=`hsl(${e}, 100%, ${s}%)`;const n=xn+Math.cos(no(e))*i,o=xn-Math.sin(no(e))*i;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}}(zn),so();const lo=Vn,ro=["#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"],ao=function(t,e,i){const s=t.editor;Ft.call(this,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||ro)===ro?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">${mo(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${mo(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>`,Q.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 lo(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",ho.bind(this)),this.eventManager.addEvent(this.inputElement,"input",go.bind(this)),this.eventManager.addEvent(this.target.querySelector("form"),"submit",co.bind(this))),i.disableRemove||this.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",po.bind(this)),this.eventManager.addEvent(this.target,"click",uo.bind(this))};function ho(){this.parentForm?.length>0&&this.parentForm.forEach((t=>{this.parentFormDisplay.push([t,t.style.display]),t.style.display="none"})),this.hueSlider.open(this.targetButton)}function co(t){t.preventDefault(),"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(this.currentColor)}function uo(t){const e=t.target.getAttribute("data-value");e&&"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(e)}function po(){"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(null)}function go(t){this.setHexColor(t.target.value)}function mo(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}ao.prototype={hueSliderAction(t){this._setInputText(t.hex)},hueSliderCancelAction(){this.parentForm?.length>0&&this.parentFormDisplay.forEach((t=>t[0].style.display=t[1]))},hueSliderClose(){this.hueSlider.off()},init(t,e){this.targetButton=e;const i=this.editor.frameContext.get("wwComputedStyle")[this.styleProperties],s=this.defaultColor||J.isHexColor(i)?i:J.rgb2hex(i);let n=("string"==typeof t?t:this._getColorInNode(t))||s;n=J.isHexColor(n)?n:J.rgb2hex(n)||n||"";const o=this.colorList;for(let t,e=0,i=o.length;e<i;e++)t=o[e],n.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),Q.addClass(t,"active")):(Q.removeClass(t,"active"),t.contains(this.checkedIcon)&&Q.removeItem(this.checkedIcon));this._setInputText(this._colorName2hex(n))},setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t},_setInputText(t){t=/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)},_getColorInNode(t){let e="";const i=this.styleProperties;for(;t&&!Q.isWysiwygFrame(t)&&0===e.length;)1===t.nodeType&&t.style[i]&&(e=t.style[i]),t=t.parentNode;return e},_colorName2hex(t){if(/^#/.test(t))return t;const e=Q.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 Q.removeItem(e),i.length>=3&&"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substr(1)},constructor:ao};const fo=ao,_o=function(t,e){Xe.call(this,t),this.title=this.lang.fontColor,this.icon="font_color";const i=Q.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new fo(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(_o,i)};_o.key="fontColor",_o.type="dropdown-free",_o.className="",_o.prototype={active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return!1;if(t){if(t?.style.color.length>0)return i.style.color=t.style.color,!0}else i.style.color="";return!1},on(t){this.colorPicker.init(this.selection.getNode(),t)},onDropdownClose(){this.colorPicker.hueSliderClose()},colorPickerAction(t){this.action(t)},action(t){if(t){const e=Q.createElement("SPAN",{style:"color: "+t+";"});this.format.applyInlineElement(e,["color"],null,null)}else this.format.applyInlineElement(null,["color"],["span"],!0);this.menu.dropdownOff()},constructor:_o};const bo=_o,vo=function(t,e){Xe.call(this,t),this.title=this.lang.backgroundColor,this.icon="background_color";const i=Q.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new fo(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(vo,i)};vo.key="backgroundColor",vo.type="dropdown-free",vo.className="",vo.prototype={active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return!1;if(t){if(t?.style.backgroundColor.length>0)return i.style.color=t.style.backgroundColor,!0}else i.style.color="";return!1},on(t){this.colorPicker.init(this.selection.getNode(),t)},off(){this.colorPicker.hueSliderClose()},colorPickerAction(t){this.action(t)},action(t){if(t){const e=Q.createElement("SPAN",{style:"background-color: "+t+";"});this.format.applyInlineElement(e,["background-color"],null,null)}else this.format.applyInlineElement(null,["background-color"],["span"],!0);this.menu.dropdownOff()},constructor:vo};const yo=vo,Co=function(t,e){Xe.call(this,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 Q.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(Co,i)};Co.key="hr",Co.type="dropdown",Co.className="",Co.component=function(t){return/^hr$/i.test(t?.nodeName)?t:null},Co.prototype={select(t){Q.addClass(t,"on")},deselect(t){Q.removeClass(t,"on")},destroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;Q.removeItem(t),this.editor.focusEdge(e),this.history.push(!1)},action(t){const e=t.firstElementChild.cloneNode(!1);this.editor.focus(),this.component.insert(e,!1,!1),this.menu.dropdownOff();const i=this.format.addLine(e);this.selection.setRange(i,1,i,1)},constructor:Co};const wo=Co,xo=function(t){Xe.call(this,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 Q.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(xo,e)};xo.key="list",xo.type="dropdown",xo.className="se-icon-flip-rtl",xo.prototype={active(t,e){const i=e.firstElementChild;if(Q.isList(t)){const s=t.nodeName.toLowerCase();return e.setAttribute("data-focus",s),Q.addClass(e,"active"),/^ul$/.test(s)?Q.changeElement(i,this.icons.bulleted):Q.changeElement(i,this.icons.numbered),!0}return e.removeAttribute("data-focus"),Q.changeElement(i,this.icons.number),Q.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")?Q.addClass(i[t],"active"):Q.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)},constructor:xo};const Eo=xo,{_w:So,ON_OVER_COMPONENT:To}=Y,ko=".se-table-resize-line",No=".se-table-resize-line-prev",Lo=".se-table-resize-row",Ho=".se-table-resize-row-prev",Mo=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],Ao={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"},Bo=["all","inside","horizon","vertical"],Io="borderLeft",Vo="borderTop",Ro="borderRight",Oo="borderBottom",zo=["#b0dbb0","#efef7e","#f2acac","#dcb0f6","#99bdff","#5dbd5d","#e7c301","#f64444","#e57ff4","#4387f1","#27836a","#f69915","#ba0808","#a90bed","#134299","#e4e4e4","#B3B3B3","#808080","#4D4D4D","#000000"],$o=function(t,e){Xe.call(this,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 Q.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="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 Q.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 </div>`;return Q.createElement("DIV",{class:"se-controller se-controller-table-cell"},s)}(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<li>\n\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip" data-command="props_align" data-value="${i}" title="${o}" aria-label="${o}">\n\t\t\t\t${e["align_"+i]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</li>`;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<li>\n\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip" data-command="props_align_vertical" data-value="${i}" title="${s}" aria-label="${s}">\n\t\t\t\t${e["align_"+i]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${s}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</li>`;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[Ao.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}</label>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner __se__a_h">\n\t\t\t\t\t\t<ul class="se-form-group se-form-w0">${n}</ul>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner __se__a_v">\n\t\t\t\t\t\t<ul class="se-form-group se-form-w0">${l}</ul>\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>`;return Q.createElement("DIV",{class:"se-controller se-table-props"},r)}(t);t.applyFrameRoots((t=>{t.get("wrapper").appendChild(Q.createElement("DIV",{class:ko.replace(/^\./,"")})),t.get("wrapper").appendChild(Q.createElement("DIV",{class:No.replace(/^\./,"")})),t.get("wrapper").appendChild(Q.createElement("DIV",{class:Lo.replace(/^\./,"")})),t.get("wrapper").appendChild(Q.createElement("DIV",{class:Ho.replace(/^\./,"")}))})),this.controller_table=new li(this,n,{position:"top"}),this.controller_cell=new li(this,o,{position:this.cellControllerTop?"top":"bottom"});const r=[this.controller_table.form,this.controller_cell.form];this.controller_props=new li(this,l,{position:"bottom",parents:r,isInsideForm:!0}),this.controller_props_title=l.querySelector(".se-controller-title");const a=Q.createElement("DIV",{class:"se-controller se-list-layer"},null);this.colorPicker=new fo(this,"",{colorList:e.colorList||zo,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{parents:[a],isOutsideForm:!0}}}),a.appendChild(this.colorPicker.target),this.controller_colorPicker=new li(this,a,{position:"bottom",parents:[this.controller_props.form].concat(r),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),Q.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.figure=new Oi(this,null,{}),this.sliderType="";const h=(c=this.lang,{items:["vertical","horizontal"],menus:Q.createElement("DIV",null,`\n\t\t<div title="${c.verticalSplit}" aria-label="${c.verticalSplit}">\n\t\t\t${c.verticalSplit}\n\t\t</div>\n\t\t<div title="${c.horizontalSplit}" aria-label="${c.horizontalSplit}">\n\t\t\t${c.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var c;this.splitButton=o.querySelector('[data-command="onsplit"]'),this.selectMenu_split=new mi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_split.on(this.splitButton,Wo.bind(this)),this.selectMenu_split.create(h.items,h.menus);const d=function(t,e){const i=Q.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),u=o.querySelector('[data-command="oncolumn"]');this.selectMenu_column=new mi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_column.on(u,Uo.bind(this)),this.selectMenu_column.create(d.items,d.menus);const p=function(t,e){const i=Q.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),g=o.querySelector('[data-command="onrow"]');this.selectMenu_row=new mi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_row.on(g,Zo.bind(this)),this.selectMenu_row.create(p.items,p.menus);const m=function(){let t="";for(let e,i=0,s=Mo.length;i<s;i++)e=Mo[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=Q.createElement("DIV",null,t);return{items:Mo,menus:e.querySelectorAll("div")}}(),f=l.querySelector('[data-command="props_onborder_style"]');this.selectMenu_props_border=new mi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(f,Qo.bind(this)),this.selectMenu_props_border.create(m.items,m.menus);const _=el(this.lang,this.icons,[]),b=l.querySelector('[data-command="props_onborder_format"]');this.selectMenu_props_border_format=new mi(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(b,tl.bind(this,"all")),this.selectMenu_props_border_format.create(_.items,_.menus);const v=el(this.lang,this.icons,Bo);this.selectMenu_props_border_format_oneCell=new mi(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(b,tl.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(v.items,v.menus),this.maxText=this.lang.maxSize,this.minText=this.lang.minSize,this.propTargets={cell_alignment:l.querySelector(".se-table-props-align > .__se__a_h"),cell_alignment_vertical:l.querySelector(".se-table-props-align > .__se__a_v"),border_format:b,border_style:l.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:l.querySelector(".__se_border_color"),border_width:l.querySelector(".__se__border_size"),back_color:l.querySelector(".__se_back_color"),font_color:l.querySelector(".__se_font_color"),palette_border_button:l.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:l.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:l.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:l.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:l.querySelector('[data-command="props_font_style"][data-value="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.querySelector('[data-command="merge"]'),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._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._selectedCells=null,this._shift=!1,this._fixedCell=null,this._fixedCellName=null,this._selectedCell=null,this._selectedTable=null,this._ref=null,this._bindMultiOn=Xo.bind(this),this._bindMultiOff=Yo.bind(this),this._bindShiftOff=Ko.bind(this),this._bindTouchOff=Jo.bind(this),this.__globalEvents={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null},this.menu.initDropdownTarget($o,i),this.eventManager.addEvent(s,"mousemove",qo.bind(this)),this.eventManager.addEvent(s,"click",Go.bind(this))};function Fo(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function Po(t,e){const i=t.clientX,s=tt.get(So.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 Do(t,e){const i=t.clientY,s=tt.get(So.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(s+n.top-i)<=5,startY:i}}function Wo(t){const e="vertical"===t,i=this._tdElement,s=this._trElements,n=this._trElement,o=this._logical_cellIndex,l=this._rowIndex,r=jo(i.nodeName,0,!0);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=Q.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=Q.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.editor.focusEdge(i),this._deleteStyleSelectedCells(),this.history.push(!1),this.setController(i),this._selectedCell=this._fixedCell=i}function Uo(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()}function Zo(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()}function qo(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",Q.changeTxt(this.tableDisplay,e+" x "+i),this._tableXY=[e,i]}function Go(){this.action()}function jo(t,e,i){return t=t.toLowerCase(),i?Q.createElement(t,null,"<div><br></div>"):`<${t}><div><br></div></${t}>`.repeat(e)}function Xo(t){this.editor._antiBlur=!0;const e=Q.getParentElement(t.target,Q.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===Q.getParentElement(e,"TABLE")&&(this._selectedCell=e,this._setMultiCells(this._fixedCell,e))}function Yo(t){if(t.stopPropagation(),this._shift?this.__globalEvents.touchOff&&(this.__globalEvents.touchOff=this.eventManager.removeGlobalEvent(this.__globalEvents.touchOff)):(this.__removeGlobalEvents(),this._toggleEditor(!0)),!this._fixedCell||!this._selectedTable)return;this.setMergeSplitButton(this._fixedCell,this._selectedCell),this._selectedCells=Array.from(this._selectedTable.querySelectorAll(".se-selected-table-cell"));const e=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this.setController(e)}function Ko(){this._ref||this._closeController()}function Jo(){this.close()}function Qo(t){this.propTargets.border_style.textContent=t,this._disableBorderProps(t===Mo[0]),this.selectMenu_props_border.close()}function tl(t,e){const{border_format:i}=this.propTargets;i.setAttribute("se-border-format",e),i.firstElementChild.innerHTML=this.icons[Ao[e]],e!==t?Q.addClass(i,"active"):Q.removeClass(i,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}function el(t,e,i){const s=[];let n="";for(const o in Ao){if(i.includes(o))continue;const l=Ao[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:Q.createElement("DIV",null,n).querySelectorAll("button")}}$o.key="table",$o.type="dropdown-free",$o.className="",$o.component=function(t){return Q.isTable(t)?t:null},$o.options={isInputComponent:!0},$o.prototype={action(){const t=Q.createElement("TABLE"),e=this._tableXY[0],i=this._tableXY[1],s=`<tbody>${`<tr>${jo("td",e,!1)}</tr>`.repeat(i)}</tbody>`,n=`<colgroup>${`<col style="width: ${tt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+s;const o=Q.createElement("FIGURE",{class:"se-flex-component se-input-component"});if(o.appendChild(t),this.component.insert(o,!1,!1)){this._resetTablePicker();const e=t.querySelector("td div");this.selection.setRange(e,0,e,0)}},retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let i=Q.isFigure(t.parentNode)?t.parentNode:null;if(!e||!i){if(!e){const e=function(t){let e=0;for(const i of t.rows){let t=0;for(const e of i.cells)t+=e.colSpan;e=Math.max(e,t)}return e}(t),i=Q.createElement("colgroup",null,`<col style="width: ${tt.get(100/e,0)}%;">`.repeat(e));t.insertBefore(i,t.firstElementChild)}if(i?Q.addClass(i,"se-flex-component|se-input-component"):(i=Q.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(i,t),i.appendChild(t)),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;Q.addClass(i,t),Q.removeClass(i,this.figureScrollList.filter((e=>e!==t)).join("|"))}else Q.removeClass(i,this.figureScrollList.join("|"))}}}},setDir(t){this.tableHighlight.style.left="rtl"===t?"167px":"",this._resetTablePicker(),this._resetPropsAlign("rtl"===t)},onMouseMove({event:t}){if(this._resizing)return;const e=Q.getParentElement(t.target,Fo);if(!e||this._fixedCell)return void this.__hideResizeLine();const i=Po(t,e);if(i.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(ko),this._setResizeLinePosition(Q.getParentElement(e,Q.isTable),e,this._resizeLine,i.isLeft),void(this._resizeLine.style.display="block");if(Do(t,e).is)return this.__removeGlobalEvents(),this._element=Q.getParentElement(e,Q.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(Lo),this._setResizeRowPosition(Q.getParentElement(e,Q.isTable),e,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=null;const e=Q.getParentElement(t.target,Fo);if(!e)return;const i=Po(t,e);if(i.is){try{this._deleteStyleSelectedCells(),this.setCellInfo(e,!0);const t=this._logical_cellIndex-(i.isLeft?1:0);if(this.editor.enableBackWrapper("ew-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(ko)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(No),t<0||t===this._logical_cellCnt-1)return void this._startFigureResizing(i.startX,t<0);const s=this._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(s,i.startX,tt.get(So.getComputedStyle(s).width,0),i.isLeft)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}return}const s=Do(t,e);if(s.is)try{let t=Q.getParentElement(e,Q.isTableRow),i=e.rowSpan;if(i>1)for(;Q.isTableRow(t)&&i>1;)t=t.nextElementSibling,--i;this._deleteStyleSelectedCells(),this.setRowInfo(t),this.editor.enableBackWrapper("ns-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Lo)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(Ho),this._startRowResizing(t,s.startY,tt.get(So.getComputedStyle(t).height,0))}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}else e===this._fixedCell||this._shift||(this._deleteStyleSelectedCells(),/^TR$/i.test(e.nodeName)||this.selectCells(e,!1))},onMouseUp(){this._shift=!1},onMouseLeave(){this.__hideResizeLine()},onKeyDown({event:t,range:e,line:i}){if(this._ref=null,this.editor.selectMenuOn||this._resizing)return;const s=t.keyCode;if(9===s){const s=Q.getParentElement(i,Q.isTableCell);if(s&&e.collapsed&&Q.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=t.shiftKey,i=Q.getParentElement(s,"table"),n=Q.getListChildren(i,Q.isTableCell),o=e?Q.prevIndex(n,s):Q.nextIndex(n,s);if(o===n.length&&!e){if(!Q.getParentElement(s,"thead")){const t=i.rows,e=this.insertBodyRow(i,t.length,t[t.length-1].cells.length).querySelector("td div");this.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return;let l=n[o];if(!l)return;return l=l.firstElementChild||l,this.selection.setRange(l,0,l,0),t.preventDefault(),t.stopPropagation(),!1}}let n=null;if(!t.shiftKey||16!==s){if(n=Q.getParentElement(i,Q.isTableCell),!Q.hasClass(n,"se-selected-cell-focus"))return;return this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents(),void this._closeController()}return this._shift||this._ref?void 0:(n=n||Q.getParentElement(i,Q.isTableCell),n?(this._fixedCell=n,this._closeController(),this.selectCells(n,t.shiftKey),!1):void 0)},onKeyUp({line:t}){this._shift&&Q.getParentElement(t,Q.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":Q.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),Q.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();break;case"resize":this._maxWidth=!this._maxWidth,this.setTableStyle("width",!1),this._historyPush(),this.component.select(this._element,$o.key,!0);break;case"layout":this._fixedColumn=!this._fixedColumn,this.setTableStyle("column",!1),this._historyPush(),this.component.select(this._element,$o.key,!0);break;case"remove":{const t=this._figure?.parentNode;Q.removeItem(this._figure),this._closeController(),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;Q.removeClass([t,e,i,s,n,o,l,r,a,h,c,d],"on")},selectCells(t,e){this._shift||this._ref||this.__removeGlobalEvents(),this._shift=e,this._fixedCell=t,this._fixedCellName=t.nodeName,this._selectedTable=Q.getParentElement(t,"TABLE"),this._deleteStyleSelectedCells(),Q.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)},seTableInfo(t){const e=this._element=this._selectedTable||Q.getParentElement(t,"TABLE");return this._figure=Q.getParentElement(e,Q.isFigure)||e,e},setCellInfo(t,e){const i=this.seTableInfo(t);if(this._trElement=t.parentNode,i.querySelector("thead")?Q.addClass(this.headerButton,"active"):Q.removeClass(this.headerButton,"active"),i.querySelector("caption")?Q.addClass(this.captionButton,"active"):Q.removeClass(this.captionButton,"active"),e||0===this._physical_cellCnt){this._tdElement!==t&&(this._tdElement=t,this._trElement=t.parentNode),this._selectedCells&&0!==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=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.seTableInfo(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.parentNode;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>"+jo("td",this._logical_cellCnt,!1)+"</tr></tbody>":(Q.removeItem(this._figure),this._closeController()))}}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,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,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&&(Q.removeItem(t[e]),e--);0===i.children.length&&Q.removeItem(i)}},editRow(t,e){const i=!t,s="up"===t,n=this._rowIndex,o=i||s?n:n+this._current_rowSpan+1,l=i?-1:1,r=this._trElements;let a=this._logical_cellCnt;for(let t,e=0,s=n+(i?-1:0);e<=s;e++){if(t=r[e].cells,0===t.length)return;for(let i,s,n=0,r=t.length;n<r;n++)i=t[n].rowSpan,s=t[n].colSpan,i<2&&s<2||i+e>o&&o>e&&(t[n].rowSpan=i+l,a-=s)}if(i){const t=r[n+1];if(t){const e=[];let i=r[n].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(o)}else this.insertBodyRow(this._element,o,a);i?this._closeController():this.setCellControllerPosition(e||this._tdElement,!0)},editCell(t,e){const i=!t,s="left"===t,n=this._current_colSpan,o=i||s?this._logical_cellIndex:this._logical_cellIndex+n+1,l=this._trElements;let r,a=[],h=[],c=0;const d=[],u=[];for(let t,e,s,p,g,m=0,f=this._rowCnt;m<f;m++){t=l[m],r=o,p=!1,e=t.cells,g=0;for(let t,s,l,f,_=0,b=e.length;_<b&&(t=e[_],t);_++)if(s=t.rowSpan-1,l=t.colSpan-1,i){if(f=_+g,h.length>0){const t=!e[_+1];for(let e,i=0;i<h.length;i++)e=h[i],e.row>m||(f>=e.index?(g+=e.cs,f=_+g,e.rs-=1,e.row=m+1,e.rs<1&&(h.splice(i,1),i--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(h.splice(i,1),i--)))}s>0&&a.push({rs:s,cs:l+1,index:f,row:-1}),f>=r&&f+l<=r+n?d.push(t):f<=r+n&&f+l>=r?t.colSpan-=tt.getOverlapRangeAtIndex(o,o+n,f,f+l):s>0&&(f<r||f+l>r+n)&&u.push({cell:t,i:m,rs:m+s}),g+=l}else{if(_>=r)break;if(l>0){if(c<1&&l+_>=r){t.colSpan+=1,r=null,c=s+1;break}r-=l}if(!p){for(let t,e=0;e<h.length;e++)t=h[e],r-=t.cs,t.rs-=1,t.rs<1&&(h.splice(e,1),e--);p=!0}}if(h=h.concat(a).sort((function(t,e){return t.index-e.index})),a=[],!i){if(c>0){c-=1;continue}null!==r&&e.length>0&&(s=jo(e[0].nodeName,0,!0),s=t.insertBefore(s,e[r]))}}const p=this._element.querySelector("colgroup");if(p){const t=p.querySelectorAll("col");if(i)Q.removeItem(t[r]);else{let e=0;for(let i,s=0,n=t.length;s<n;s++)i=tt.get(t[s].style.width),i-=Math.round(i*n*.1/2,0),e+=i,t[s].style.width=`${i}%`;const i=Q.createElement("col",{style:`width:${100-e}%`});p.insertBefore(i,t[r])}}if(i){let t,e;for(let i,s=0,n=d.length;s<n;s++)i=d[s].parentNode,Q.removeItem(d[s]),0===i.cells.length&&(t||(t=Q.getArrayIndex(l,i)),e=Q.getArrayIndex(l,i),Q.removeItem(i));for(let i,s=0,n=u.length;s<n;s++)i=u[s],i.cell.rowSpan=tt.getOverlapRangeAtIndex(t,e,i.i,i.rs);this._closeController()}else this.setCellControllerPosition(e||this._tdElement,!0)},insertBodyRow(t,e,i){const s=t.insertRow(e);return s.innerHTML=jo("td",i,!1),s},mergeCells(){const t=this._ref,e=this._selectedCells,i=e[0];let s=null,n=null;const o=t.ce-t.cs+1;let l=t.re-t.rs+1,r="",a=null;for(let t,i,o=1,h=e.length;o<h;o++){t=e[o],a!==t.parentNode&&(a=t.parentNode),i=t.children;for(let t=0,e=i.length;t<e;t++)this.format.isLine(i[t])&&Q.isZeroWith(i[t].textContent)&&Q.removeItem(i[t]);r+=t.innerHTML,Q.removeItem(t),0===a.cells.length&&(s?n=a:s=a,l-=1)}if(s){const t=this._trElements,e=Q.getArrayIndex(t,s),i=Q.getArrayIndex(t,n||s),o=[];for(let s,n=0;n<=i;n++)if(s=t[n].cells,0!==s.length)for(let t,o,l=0,r=s.length;l<r;l++)t=s[l],o=t.rowSpan-1,o>0&&n+o>=e&&(t.rowSpan-=tt.getOverlapRangeAtIndex(e,i,n,n+o));else o.push(t[n]);for(let t=0,e=o.length;t<e;t++)Q.removeItem(o[t])}i.innerHTML+=r,i.colSpan=o,i.rowSpan=l,this.setMergeSplitButton(!0,!1),this.setController(i),this.editor.focusEdge(i),this._historyPush()},toggleHeader(){const t=this.headerButton,e=Q.hasClass(t,"active"),i=this._element;if(e)Q.removeItem(i.querySelector("thead"));else{const t=Q.createElement("THEAD");t.innerHTML="<tr>"+jo("th",this._logical_cellCnt,!1)+"</tr>",i.insertBefore(t,i.firstElementChild)}Q.toggleClass(t,"active"),/TH/i.test(this._tdElement.nodeName)?this._closeController():this.setCellControllerPosition(this._tdElement,!1)},toggleCaption(){const t=this.captionButton,e=Q.hasClass(t,"active"),i=this._element;if(e)Q.removeItem(i.querySelector("caption"));else{const t=Q.createElement("CAPTION",{class:`se-table-caption-${this.captionPosition}`});t.innerHTML="<div><br></div>",i.insertBefore(t,i.firstElementChild)}Q.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="min-content")),Q.changeElement(this.resizeButton.firstElementChild,i),Q.changeTxt(this.resizeText,s)}t.includes("column")&&(this._fixedColumn?(Q.removeClass(this._element,"se-table-layout-auto"),Q.addClass(this._element,"se-table-layout-fixed"),Q.addClass(this.columnFixedButton,"active")):(Q.removeClass(this._element,"se-table-layout-fixed"),Q.addClass(this._element,"se-table-layout-auto"),Q.removeClass(this.columnFixedButton,"active")))},setMergeSplitButton(t,e){e&&e&&t!==e?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")},select(t){this._figureOpen(t);const e=this._figure?.style.width||"100%";if(this._maxWidth="100%"===e,this._fixedColumn=Q.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.setTableStyle(this._maxWidth?"width|column":"width",!0),Pt.get("__overInfo")===To)return;if(!this._tdElement)return;this.setCellInfo(this._tdElement,!0);const i=Q.getParentElement(t,Q.isFigure);this.controller_table.open(i,null,{isWWTarget:!1,initMethod:null,addOffset:null});const s=this.cellControllerTop&&"block"===this.controller_table.form.style.display?{left:this.controller_table.form.offsetWidth+2}:null;this.controller_cell.open(this._tdElement,this.cellControllerTop?i:null,{isWWTarget:!1,initMethod:null,addOffset:s})},setController(t){if(!this.selection.get().isCollapsed&&!this._selectedCell)return void this._deleteStyleSelectedCells();this._tdElement=t,Q.addClass(t,"se-selected-cell-focus");const e=this._element||this._selectedTable||Q.getParentElement(t,"TABLE");this.component.select(e,$o.key,!0)},setCellControllerPosition(t,e){this.setCellInfo(t,e),this.controller_cell.resetPosition(this.cellControllerTop?Q.getParentElement(t,Q.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})},_startCellResizing(t,e,i,s){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=Q.hasClass(this._element,"se-table-layout-fixed")?l:J.getWidthInPercentage(t);Pt.get("__dragHandler")&&(Pt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._cellResize.bind(this,t,o,this._figure,this._tdElement,this._resizeLine,s,e,i,tt.get(n,0),tt.get(r,0),this._element.offsetWidth),(()=>{this.__removeGlobalEvents(),this.history.push(!0),this.component.select(this._element,$o.key,!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),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=J.getWidthInPercentage(i);Pt.get("__dragHandler")&&(Pt.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._figureResize.bind(this,i,this._resizeLine,e,t,i.offsetWidth,tt.get(s,0)),(()=>{this.__removeGlobalEvents(),this.component.select(this._element,$o.key,!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){27===s.keyCode&&(this.__removeGlobalEvents(),t.style[i]=e,"width"===i&&this.component.select(this._element,$o.key,!0))},_deleteStyleSelectedCells(){if(Q.removeClass([this._fixedCell,this._selectedCell],"se-selected-cell-focus"),this._selectedTable){const t=this._selectedTable.querySelectorAll(".se-selected-table-cell");for(let e=0,i=t.length;e<i;e++)Q.removeClass(t[e],"se-selected-table-cell")}},_recallStyleSelectedCells(){if(this._selectedCells){const t=this._selectedCells;for(let e=0,i=t.length;e<i;e++)Q.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),t?Q.removeClass(e,"se-disabled"):Q.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,font_bold:d,font_underline:u,font_italic:p,font_strike:g}=this.propTargets,{border:m,backgroundColor:f,color:_,textAlign:b,verticalAlign:v,fontWeight:y,textDecoration:C,fontStyle:w}=So.getComputedStyle(i[0]),x=this._getBorderStyle(m);h.querySelector('[data-value="justify"]').style.display=e?"none":"",c.style.display=e?"none":"";let E=J.rgb2hex(x.c),S=x.s,T=x.w,k=J.rgb2hex(f),N=J.rgb2hex(_),L=/.+/.test(y),H=/underline/i.test(C),M=/line-through/i.test(C),A=/italic/i.test(w),B=e?this._figure?.style.float:b,I=v;this._propsCache=[];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);E&&x.c!==u&&(E=""),S&&x.s!==p&&(S=""),T&&x.w!==g&&(T=""),k!==J.rgb2hex(o)&&(k=""),N!==J.rgb2hex(l)&&(N=""),B!==(e?this._figure?.style.float:r)&&(B=""),I&&I!==a&&(I=""),L&&L!==/.+/.test(h)&&(L=""),H&&H!==/underline/i.test(c)&&(H=!1),M&&M!==/line-through/i.test(c)&&(M=!1),A&&A!==/italic/i.test(d)&&(A=!1),E&&S&&T&&k&&N||(s=!0)}s.firstElementChild.innerHTML=this.icons[Ao[1===i.length?"outside":"all"]],s.setAttribute("se-border-format","all"),Q.removeClass(s,"active"),S=S||Mo[0],o.textContent=S,n.style.borderColor=n.value=E,l.value=T,this._disableBorderProps(S===Mo[0]),r.value=r.style.borderColor=k,a.value=a.style.borderColor=N,L&&Q.addClass(d,"on"),H&&Q.addClass(u,"on"),M&&Q.addClass(g,"on"),A&&Q.addClass(p,"on"),this._setAlignProps(h,this._propsAlignCache=B,!0),this._setAlignProps(c,this._propsVerticalAlignCache=I,!0)},_setAlignProps(t,e,i){Q.removeClass(t.querySelectorAll("button"),"on"),i||t.getAttribute("se-cell-align")!==e?(Q.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.setAttribute("disabled",!0),i.setAttribute("disabled",!0),s.setAttribute("disabled",!0),i.setAttribute("disabled",!0)):(e.removeAttribute("disabled"),i.removeAttribute("disabled"),s.removeAttribute("disabled"),i.removeAttribute("disabled"))},_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:J.rgb2hex(n)}},_submitProps(t){try{t.setAttribute("disabled",!0);const e=this.controller_table.form.contains(this.controller_props.currentTarget),i=e?[this._element]:this._selectedCells,s=i[0],n=So.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")||"",v=f?"":l.value.trim()||n.borderColor;let y=f?"":a.value.trim()||n.borderWidth;y+=tt.is(y)?"px":"";const C=h.value.trim(),w=c.value.trim(),x=g&&!f&&y,E=`${y} ${m} ${v}`,S={left:[],top:[],right:[],bottom:[],middle:[]};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="":E),S.left=S.top=S.right=S.bottom=i}else{let{rs:t,re:e,cs:n,ce:o}=this._ref||{rs:s.parentElement.rowIndex||0,re:s.parentElement.rowIndex||0,cs:s.cellIndex||0,ce:s.cellIndex||0};const l=new Array(e-t+1).fill(0).map((()=>new Array(o-n+1).fill(0))),r=n;e-=t,t-=t,o-=n,n-=n;let a=s.parentNode;for(let s,h,c,d,u,p=0,g=0,m=i.length,v=0;p<m;p++,g++){s=i[p],d=s.colSpan,u=s.rowSpan,c=s.cellIndex-r,a!==s.parentNode&&(v++,g=0,a=s.parentNode);let m=0;for(;m<=c;)c+=l[v][m]||0,m++;try{if(u>1){const t=u-1;for(let e=v;e<=v+t;e++)l[e][c]+=d-(v===e?1:0)}else d>1&&(l[v][c]+=d-1)}catch(t){}const y=v+u-1===e;v===t&&S.top.push(s),(v===e||y)&&S.bottom.push(s),c===n&&S.left.push(s),c!==o&&c+d-1!==o||S.right.push(s),y||v===t||v===e||c===n||c===o||S.middle.push(s),h=s.style,h.textAlign=_,h.verticalAlign=b,h.backgroundColor=C,h.color=w,this._setFontStyle(h),x||(h.border=f?h.borderLeft=h.borderTop=h.borderRight=h.borderBottom="":E)}0===S.middle.length&&(S.middle=i)}S.all=i,x&&this._setBorderStyles(S,p,E),this._historyPush(),this.controller_props.close(),this._tdElement&&(this._recallStyleSelectedCells(),this.setCellInfo(this._tdElement,!0),Q.addClass(this._tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.removeAttribute("disabled")}},_setFontStyle(t){const{font_bold:e,font_italic:i,font_strike:s,font_underline:n}=this.propTargets;t.fontWeight=Q.hasClass(e,"on")?"bold":"",t.fontStyle=Q.hasClass(i,"on")?"italic":"",t.textDecoration=((Q.hasClass(s,"on")?"line-through ":"")+(Q.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===t.length)return;Q.setStyle(r.filter((t=>!l.includes(t))),Oo,i),Q.setStyle(r.filter((t=>!o.includes(t))),Ro,i);break;case"horizon":if(1===t.length)return;Q.setStyle(r.filter((t=>!l.includes(t))),Oo,i);break;case"vertical":if(1===t.length)return;Q.setStyle(r.filter((t=>!o.includes(t))),Ro,i);break;case"outside":Q.setStyle(s,Io,i),Q.setStyle(n,Vo,i),Q.setStyle(o,Ro,i),Q.setStyle(l,Oo,i);break;case"left":Q.setStyle(s,Io,i);break;case"top":Q.setStyle(n,Vo,i);break;case"right":Q.setStyle(o,Ro,i);break;case"bottom":Q.setStyle(l,Oo,i)}},_setMultiCells(t,e){const i=this._selectedTable.rows;if(this._deleteStyleSelectedCells(),t===e){if(!this._shift)return}else Q.addClass(t,"se-selected-table-cell");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(tt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&tt.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}Q.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",Q.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,Q.addClass(t,"on"),this.colorPicker.init(i?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))},_closeController(){this.component.deselect(),this.controller_table.close(),this.controller_cell.close()},__hideResizeLine(){this._resizeLine&&(this._resizeLine.style.display="none",this._resizeLine=null)},__removeGlobalEvents(){this._resizing=!1,this.editor.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]))},constructor:$o};const il=$o,sl=function(t,e){Xe.call(this,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>",Q.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(sl,i)};sl.key="formatBlock",sl.type="dropdown",sl.className="se-btn-select se-btn-tool-format",sl.prototype={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 Q.changeTxt(s,i),s.setAttribute("data-value",n),s.setAttribute("data-class",o),!0}}else Q.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")?Q.addClass(t,"active"):Q.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()},constructor:sl};const nl=sl,ol=function(t,e){Xe.call(this,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>",Q.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(ol,i)};ol.key="layout",ol.type="dropdown",ol.className="",ol.prototype={action(t){const e=1*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()},constructor:ol};const ll=ol,rl=function(t,e){Xe.call(this,t),this.title=this.lang.lineHeight,this.icon="line_height";const i=function({lang:t},e){const i=e||[{text:"1",value:1},{text:"1.15",value:1.15},{text:"1.5",value:1.5},{text:"2",value:2}];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="default_value se-btn-list" 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>",Q.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(t,e.items);this.sizeList=i.querySelectorAll("li button"),this.currentSize=-1,this.menu.initDropdownTarget(rl,i)};rl.key="lineHeight",rl.type="dropdown",rl.className="",rl.prototype={active:(t,e)=>t?.style?.lineHeight.length>0?(Q.addClass(e,"active"),!0):(Q.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")?Q.addClass(t[i],"active"):Q.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)},constructor:rl};const al=rl,hl=function(t,e){Xe.call(this,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>",Q.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(hl,i)};hl.key="template",hl.type="dropdown",hl.className="",hl.prototype={action(t){const e=1*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),this.menu.dropdownOff()},constructor:hl};const cl=hl,dl=function(t,e){Xe.call(this,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>",Q.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.classList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(dl,i)};dl.key="paragraphStyle",dl.type="dropdown",dl.className="",dl.prototype={on(){const t=this.classList,e=this.format.getLine(this.selection.getNode());for(let i=0,s=t.length;i<s;i++)Q.hasClass(e,t[i].getAttribute("data-command"))?Q.addClass(t[i],"active"):Q.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=Q.hasClass(t,"active")?Q.removeClass:Q.addClass;for(let t=0,n=i.length;t<n;t++)s(i[t],e);this.menu.dropdownOff(),this.history.push(!1)},constructor:dl};const ul=dl,pl=function(t,e){Xe.call(this,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>",Q.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.styleList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(pl,i)};pl.key="textStyle",pl.type="dropdown",pl.className="",pl.prototype={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)?Q.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?Q.addClass(i,"active"):Q.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=Q.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.format.applyInlineElement(n,i,o,!0),this.menu.dropdownOff()},constructor:pl};const gl=pl,{NO_EVENT:ml}=Y,fl=function(t,e,i){Xe.call(this,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=/\d+/.test(i.uploadSizeLimit)?tt.get(i.uploadSizeLimit,0):null,this.uploadSingleSizeLimit=/\d+/.test(i.uploadSingleSizeLimit)?tt.get(i.uploadSingleSizeLimit,0):null,this.input=Q.createElement("input",{type:"file",accept:i.acceptedFormats||"*"}),this.eventManager.addEvent(this.input,"change",_l.bind(this)),this.fileManager=new sn(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${kt(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${kt(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${kt(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>",Q.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(Q.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 mi(this,{checkList:!0,position:"right-middle",dir:"ltr"}),this.selectMenu_rel.on(this.relButton,yl.bind(this)),this.selectMenu_rel.create(i),this.eventManager.addEvent(this.relButton,"click",bl.bind(this))}e.querySelector(".se-anchor-editor").appendChild(s),this.selectMenu_bookmark=new mi(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_bookmark.on(this.urlInput,vl.bind(this)),this.eventManager.addEvent(this.newWindowCheck,"change",Sl.bind(this)),this.eventManager.addEvent(this.downloadCheck,"change",Tl.bind(this)),this.eventManager.addEvent(this.displayInput,"input",Cl.bind(this)),this.eventManager.addEvent(this.urlInput,"input",wl.bind(this)),this.eventManager.addEvent(this.urlInput,"focus",xl.bind(this)),this.eventManager.addEvent(this.bookmarkButton,"click",El.bind(this)),this.eventManager.addEvent(s.querySelector("._se_upload_button"),"click",(()=>this.input.click()))};async function _l(t){const e=t.target.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),n=await this.triggerEvent("onFileUploadBefore",{...i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),void(!0!==n&&n!==ml||s(null)))}function bl(){this.selectMenu_rel.open(this.options.get("_rtl")?"left-middle":"")}function vl(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()}function yl(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(", ")}function Cl(t){this._change=!!t.target.value.trim()}function wl(t){const e=t.target.value.trim();this._setLinkPreview(e),this._selfPathBookmark(e)?this._createBookmarkList(e):this.selectMenu_bookmark.close()}function xl(){const t=this.urlInput.value;this._selfPathBookmark(t)&&this._createBookmarkList(t)}function El(){let t=this.urlInput.value;this._selfPathBookmark(t)?(t=t.substr(1),this.bookmark.style.display="none",Q.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",Q.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()}function Sl(t){"string"==typeof this.defaultRel.check_new_window&&(t.target.checked?this._setRel(this._relMerge(this.defaultRel.check_new_window)):this._setRel(this._relDelete(this.defaultRel.check_new_window)))}function Tl(t){t.target.checked?(this.download.style.display="block",this.bookmark.style.display="none",Q.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)))}fl.prototype={set(t){this.currentTarget=t},on(t){if(t){if(this.currentTarget){const t=this.currentTarget.getAttribute("href");this.linkValue=this.preview.textContent=this.urlInput.value=this._selfPathBookmark(t)?t.substr(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||Q.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.substr(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)?Q.addClass(i[s],"se-checked"):Q.removeClass(i[s],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?Q.addClass(this.relButton,"on"):Q.removeClass(this.relButton,"on")},_createBookmarkList(t){const e=Q.getListChildren(this.editor.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||Q.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(Q.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("^"+K.escapeStringRegexp(t.substr(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",Q.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",Q.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===ml?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)},_uploadCallBack(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)},constructor:fl};const kl=fl,Nl=function(t,e){Xe.call(this,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 Q.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 Q.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new kl(this,i,this.pluginOptions),this.modal=new xs(this,i),this.controller=new li(this,s,{position:"bottom",disabled:!1})};Nl.key="link",Nl.type="modal",Nl.className="se-icon-flip-rtl",Nl.prototype={active(t){if(Q.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,Q.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(Q.createElement(e[0].nodeName,null,t),null,!1))return!0}else if(!this.html.insertNode(t,null,!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=Q.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=Q.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,null,["A"],!1)}else Q.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.editor.focus(),this.history.push(!1)},close(){Q.removeClass(this.controller.currentTarget,"on")},constructor:Nl};const Ll=Nl,{NO_EVENT:Hl}=Y,Ml=function(t,e){Xe.call(this,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?tt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"auto",defaultHeight:e.defaultHeight?tt.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,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"};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${xs.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 _se_image_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${kt(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_image_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_image_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_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${kt(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${kt(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${kt(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>`;return Q.createElement("DIV",{class:"se-modal-content"},a)}(t,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||!this.pluginOptions.canResize?[[n,"mirror_h","mirror_v","align","caption","revert","edit","remove"]]:[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["edit","align","caption","revert","remove"]];this.alignForm=s.querySelector(".se-figure-align"),o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.plugins.link?this.plugins.link.pluginOptions:{};this.anchor=new kl(this,s,{textToDisplay:!1,title:!0,openNewWindow:l.openNewWindow,relList:l.relList,defaultRel:l.defaultRel,noAutoPrefix:l.noAutoPrefix,enableFileUpload:e.linkEnableFileUpload}),this.modal=new xs(this,s),this.figure=new Oi(this,o,{sizeUnit:i}),this.fileManager=new sn(this,{query:"img",loadHandler:this.events.onImageLoad,eventHandler:this.events.onImageAction}),this.fileModalWrapper=s.querySelector(".se-flex-input-wrapper"),this.imgInputFile=s.querySelector(".__se__file_input"),this.imgUrlFile=s.querySelector("._se_image_url"),this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=s.querySelector("._se_image_alt"),this.captionCheckEl=s.querySelector("._se_image_check_caption"),this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=s.querySelector("._se_tab_content_image .se-link-preview"),this.sizeUnit=i,this.as="block",this.proportion={},this.inputX={},this.inputY={},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.querySelector(".se-modal-tabs"),"click",this._openTab.bind(this)),this.imgInputFile&&this.eventManager.addEvent(s.querySelector(".se-file-remove"),"click",Bl.bind(this)),this.imgUrlFile&&this.eventManager.addEvent(this.imgUrlFile,"input",zl.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.eventManager.addEvent(this.imgInputFile,"change",$l.bind(this));const r=s.querySelector(".__se__gallery");if(r&&this.eventManager.addEvent(r,"click",Fl.bind(this)),this._resizing){this.proportion=s.querySelector("._se_image_check_proportion"),this.inputX=s.querySelector("._se_image_size_x"),this.inputY=s.querySelector("._se_image_size_y"),this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=Vl.bind(this);this.eventManager.addEvent(this.inputX,"keyup",Il.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",Il.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.querySelector(".se-modal-btn-revert"),"click",Rl.bind(this))}this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=s.querySelector('[data-command="asBlock"]'),this.asInline=s.querySelector('[data-command="asInline"]'),this.eventManager.addEvent([this.asBlock,this.asInline],"click",Ol.bind(this)))};async function Al(t,e){if(await this.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===Hl){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}function Bl(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),xs.OnChangeFile(this.fileModalWrapper,[])}function Il(t,e){if(32!==e.keyCode){if("x"===t&&this._onlyPercentage&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=Oi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=e.h:this.inputX.value=e.w}}else e.preventDefault()}function Vl(){this._ratio=this.proportion.checked?Oi.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}function Rl(){this._onlyPercentage?this.inputX.value=this._origin_w>100?100:this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}function Ol({target:t}){this._activeAsInline("asInline"===t.getAttribute("data-command"))}function zl(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:""}function $l({target:t}){this.imgInputFile.value?(this.imgUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),xs.OnChangeFile(this.fileModalWrapper,t.files)}function Fl(){this.plugins.imageGallery.open(Pl.bind(this))}function Pl(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()}function Dl(t,e,i){if(0===t.offsetWidth&&this.applySize(e,""),this.options.get("componentAutoSelect"))this.component.select(t,Ml.key,!1);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,Ml.key,!1)}else{const t=this.format.addLine(i,null);t&&this.selection.setRange(t,0,t,0)}this.editor._iframeAutoHeight(this.editor.frameContext),delete t.onload}Ml.key="image",Ml.type="modal",Ml.component=function(t){return t=Q.isFigure(t)||/^span$/i.test(t.nodeName)&&Q.hasClass(t,"se-component")?t.firstElementChild:t,/^IMG$/i.test(t?.nodeName)?t:Q.isAnchor(t)&&/^IMG$/i.test(t?.firstElementChild?.nodeName)?t?.firstElementChild:null},Ml.className="",Ml.prototype={open(){this.modal.open()},edit(){this.modal.open()},on(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(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)},onPastAndDrop({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=Oi.GetContainer(t);e&&e.container&&e.cover||(this.ready(t),this._fileCheck(this._origin_w,this._origin_h))}}},init(){xs.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.removeAttribute("disabled"),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._openTab("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.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});if(this.anchor.set(Q.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=e.originWidth||e.w||"",this._origin_h=e.originHeight||e.h||"",this.altText.value=this._element.alt,this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=this._element.src),(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=tt.get(s,2),s>100&&(s=100)),this.inputX.value="auto"===s?"":s,!this._onlyPercentage){const t=i?"":e.height;this.inputY.value="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=Q.getParentElement(e,Oi.__is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onImageDeleteBefore",{target:e,container:i,align:this._align,alt:this.altText.value,url:this._linkValue})&&(Q.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?(Q.addClass(this.asInline,"on"),Q.removeClass(this.asBlock,"on"),this.as="inline",this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(Q.addClass(this.asBlock,"on"),Q.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.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.notice.open(e===Hl?t:e||t),!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.notice.open(i===Hl?t:i||t),!1}const l={files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l),a=await this.triggerEvent("onImageUploadBefore",{...l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Hl||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",{...i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==Hl||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=tt.is(t)?t+this.sizeUnit:t,r=tt.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=Oi.CreateCaption(s,this.lang.caption),a=!0):this._caption&&(Q.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&&Q.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))?Oi.CreateInlineContainer(s,"se-image-container"):Oi.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=tt.is(t)?t+this.sizeUnit:t,h=tt.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=Oi.CreateCaption(n,this.lang.caption),c=!0):this._caption&&(Q.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._element=s=l.querySelector("img"),this._cover=n,this._container=l),this._resizing&&i&&this.applySize(t,e),d&&(r?(Q.removeItem(d),0===Q.getListChildren(u,(t=>/IMG/i.test(t.tagName))).length&&Q.removeItem(u)):Q.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)},_openTab(t){const e=this.modal.form,i="init"===t?e.querySelector("._se_tab_link"):t.target;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++)Q.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+s).style.display="block",Q.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,null)},create(t,e,i,s,n,o,l){const r=Q.createElement("IMG");r.src=t,r.alt=l,e=this._setAnchor(r,e?e.cloneNode(!1):null);const a=Oi.CreateContainer(e,"se-image-container"),h=a.cover,c=a.container;this.captionCheckEl.checked&&(this._caption=Oi.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=Dl.bind(this,r,this._svgDefaultSize,c),this.component.insert(c,!1,!0)},createInline(t,e,i,s,n,o){const l=Q.createElement("IMG");l.src=t,l.alt=o,e=this._setAnchor(l,e?e.cloneNode(!1):null);const r=Oi.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=Dl.bind(this,l,this._svgDefaultSize,r),this.component.insert(r,!1,!0)},_updateSrc(t,e,i){e.src=t,this.fileManager.setFileData(e,i),this.component.select(e,Ml.key,!1)},_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,Al.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.editor.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=r;const a=[r];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.editor.hideLoading())}.bind(this,h,l,this._element,c,d),h.readAsDataURL(c)}catch(t){throw this.editor.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)=>e?(e.appendChild(t),e):t,async _error(t){const e=await this.triggerEvent("onImageUploadError",{error:t}),i=e===Hl?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.image.error]",i)},constructor:Ml};const Wl=Ml,{NO_EVENT:Ul}=Y,Zl=function(t,e){Xe.call(this,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&&tt.get(e.defaultWidth,0)?tt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&tt.get(e.defaultHeight,0)?tt.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:tt.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},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.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;i.createFileInput&&(s+=`\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${xs.CreateFileInput({lang:t,icons:e},i)}\n\t\t\t</div>`);i.createUrlInput&&(s+=`\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<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.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],o=i.defaultRatio,l=i.percentageOnlySize,r=l?' style="display: none !important;"':"",a=i.showHeightInput?"":' style="display: none !important;"',h=i.showRatioOption?"":' style="display: none !important;"',c=l||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"${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_video_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_video_size_y" placeholder="${100*i.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-video-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${n.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_video_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}return 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_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>`,Q.createElement("DIV",{class:"se-modal-content"},s)}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["mirror_h","mirror_v","align","revert","edit","remove"]]:[["resize_auto,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["edit","align","revert","remove"]];n.some((t=>t.includes("align")))||(s.querySelector(".se-figure-align").style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";if(this.modal=new xs(this,s),this.figure=new Oi(this,n,{sizeUnit:i,autoRatio:{current:o,default:o}}),this.fileManager=new sn(this,{query:"iframe, video",loadHandler:this.events.onVideoLoad,eventHandler:this.events.onVideoAction}),this.fileModalWrapper=s.querySelector(".se-flex-input-wrapper"),this.videoInputFile=s.querySelector(".__se__file_input"),this.videoUrlFile=s.querySelector(".se-input-url"),this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=s.querySelector(".se-link-preview"),this._linkValue="",this._align="none",this._videoRatio=o,this._defaultRatio=o,this._defaultSizeX="100%",this._defaultSizeY=100*this.pluginOptions.defaultRatio+"%",this.sizeUnit=i,this.proportion={},this.videoRatioOption={},this.inputX={},this.inputY={},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),J.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),J.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery},this.videoInputFile&&this.eventManager.addEvent(s.querySelector(".se-file-remove"),"click",Gl.bind(this)),this.videoUrlFile&&this.eventManager.addEvent(this.videoUrlFile,"input",jl.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.eventManager.addEvent(this.videoInputFile,"change",Xl.bind(this)),this._resizing){this.proportion=s.querySelector("._se_video_check_proportion"),this.videoRatioOption=s.querySelector(".se-video-ratio"),this.inputX=s.querySelector("._se_video_size_x"),this.inputY=s.querySelector("._se_video_size_y"),this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=Jl.bind(this);this.eventManager.addEvent(this.inputX,"keyup",Ql.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",Ql.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.videoRatioOption,"change",Kl.bind(this)),this.eventManager.addEvent(s.querySelector(".se-modal-btn-revert"),"click",Yl.bind(this))}};async function ql(t,e){if(await this.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Ul){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}function Gl(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),xs.OnChangeFile(this.fileModalWrapper,[])}function jl(t){const e=t.target.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:""}function Xl({target:t}){this.videoInputFile.value?(this.videoUrlFile.setAttribute("disabled",!0),this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.removeAttribute("disabled"),this.previewSrc.style.textDecoration=""),xs.OnChangeFile(this.fileModalWrapper,t.files)}function Yl(){this._onlyPercentage?this.inputX.value=this._origin_w>100?100:this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}function Kl(t){const e=t.target.options[t.target.selectedIndex].value;this._defaultSizeY=this.figure.autoRatio.current=this._videoRatio=e?100*e+"%":this._defaultSizeY,this.inputY.placeholder=e?100*e+"%":"",this.inputY.value=""}function Jl(){this._ratio=this.proportion.checked?Oi.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}function Ql(t,e){if(32!==e.keyCode){if("x"===t&&this._onlyPercentage&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=Oi.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=e.h:this.inputX.value=e.w}"y"===t&&this._setVideoRatioSelect(e.target.value||this._defaultRatio)}else e.preventDefault()}Zl.key="video",Zl.type="modal",Zl.className="",Zl.component=function(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.findProcessUrl(t.src)?t:null},Zl.prototype={open(){this.modal.open()},edit(){this.modal.open()},on(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):(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._setVideoRatioSelect(this._origin_h||this._defaultRatio)},onPastAndDrop({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,"video"),0),t},retainFormat(){return{query:"iframe, video",method:t=>{const e=Oi.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(){xs.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.removeAttribute("disabled"),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._setVideoRatioSelect(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=e.width||e.originWidth||e.w||"",this._origin_h=e.height||e.originHeight||e.h||"";let i=e.width||e.w||this._origin_w||"";const s=e.height||e.h||this._origin_h||"";if(this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=this._element.src||(this._element.querySelector("source")||"").src||""),(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=tt.get(i,2),i>100&&(i=100)),this.inputX.value="auto"===i?"":i,!this._onlyPercentage){const t=n?"":e.height;this.inputY.value="auto"===t?"":t}this._setVideoRatioSelect(s)||(this.inputY.value=this._onlyPercentage?tt.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=Q.getParentElement(e,Oi.__is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onVideoDeleteBefore",{target:e,container:i,align:this._align,url:this._linkValue})&&(Q.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))},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=>(/^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=>(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},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){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.parentNode.replaceChild(i,t),this._element=t=i}else if(/^video$/i.test(i?.tag)&&!/^video$/i.test(t.nodeName)){const i=this.createVideoTag();i.src=e,t.parentNode.replaceChild(i,t),this._element=t=i}else t.src=e}a=this._container,r=Q.getParentElement(t,"FIGURE")}else{t.src=e,this._element=t;const i=Oi.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._videoRatio;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,!1,!0),!this.options.get("componentAutoSelect")){const t=this.format.addLine(a,null);t&&this.selection.setRange(t,0,t,0)}},createIframeTag(){const t=Q.createElement("IFRAME");return this._setIframeAttrs(t),t},createVideoTag:function(){const t=Q.createElement("VIDEO");return this._setTagAttrs(t),t},_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.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.notice.open(e===Ul?t:e||t),!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.notice.open(i===Ul?t:i||t),!1}const l={url:null,files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l),a=await this.triggerEvent("onVideoUploadBefore",{...l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Ul||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",{...s,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==Ul||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)||Q.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t;t=t.cloneNode(!0);const s=Oi.CreateContainer(t,"se-video-container").container,n=e.querySelector("figcaption");let o=null;n&&(o=Q.createElement("DIV"),o.innerHTML=n.innerHTML,Q.removeItem(n)),this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const l=(t.getAttribute("data-se-size")||",").split(",");this.applySize(l[0]||i.style.width||i.width||"",l[1]||i.style.height||i.height||"");const r=this.format.getLine(i);if(r&&(this._align=r.style.textAlign||r.style.float),this.figure.setAlign(t,this._align),Q.getParentElement(i,Q.isExcludeFormat))i.parentNode.replaceChild(s,i);else if(Q.isListCell(e)){const t=Q.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(s,t),Q.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLineOnly(e)){const t=Q.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(s,e),Q.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.parentNode.replaceChild(s,e);return o&&e.parentNode.insertBefore(o,s.nextElementSibling),t},_register(t,e){const i=e.result,s=this.createVideoTag();for(let e=0,n=i.length;e<n;e++)this.create(t.isUpdate?t.element:s.cloneNode(!1),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,ql.bind(this,t),this._error.bind(this))},_setTagAttrs(t){t.setAttribute("controls",!0);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])},_setVideoRatioSelect(t){let e=!1;const i=this.videoRatioOption.options;/%$/.test(t)||this._onlyPercentage?t=tt.get(t,2)/100+"":(!tt.is(t)||1*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*t+"%":""):i[s].selected=!1;return e},async _error(t){const e=await this.triggerEvent("onVideoUploadError",{error:t}),i=e===Ul?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.video.error]",e)},constructor:Zl};const tr=Zl,{NO_EVENT:er,ON_OVER_COMPONENT:ir}=Y,sr=function(t,e){Xe.call(this,t),this.title=this.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?tt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?tt.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:/\d+/.test(e.uploadSizeLimit)?tt.get(e.uploadSizeLimit,0):null,uploadSingleSizeLimit:/\d+/.test(e.uploadSingleSizeLimit)?tt.get(e.uploadSingleSizeLimit,0):null,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},i){let s=`\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">`;i.createFileInput&&(s+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${xs.CreateFileInput({lang:t,icons:e},i)}\n </div>`);i.createUrlInput&&(s+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n <input class="se-input-form se-input-url" data-focus type="text" />\n <pre class="se-link-preview"></pre>\n </div>`);return s+=`\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>`,Q.createElement("DIV",{class:"se-modal-content"},s)}(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="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 Q.createElement("DIV",{class:"se-controller"},i)}(t);this.modal=new xs(this,i),this.controller=new li(this,s,{position:"bottom",disabled:!0}),this.fileManager=new sn(this,{query:"audio",loadHandler:this.events.onAudioLoad,eventHandler:this.events.onAudioAction}),this.figure=new Oi(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.defaultWidth=this.pluginOptions.defaultWidth,this.defaultHeight=this.pluginOptions.defaultHeight,this.urlValue="",this._element=null,this.audioInputFile&&(this.eventManager.addEvent(i.querySelector(".se-modal-files-edge-button"),"click",lr.bind(this.audioInputFile,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.eventManager.addEvent(this.audioInputFile,"change",rr.bind(this))),this.audioUrlFile&&this.eventManager.addEvent(this.audioUrlFile,"input",or.bind(this))};async function nr(t,e){if(await this.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===er){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}function or(t){const e=t.target.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:""}function lr(t,e){this.value="",t&&(t.removeAttribute("disabled"),e.style.textDecoration=""),xs.OnChangeFile(this.fileModalWrapper,[])}function rr({target:t}){this.audioInputFile.value?(this.audioUrlFile.setAttribute("disabled",!0),this.preview.style.textDecoration="line-through"):(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration=""),xs.OnChangeFile(this.fileModalWrapper,t.files)}sr.key="audio",sr.type="modal",sr.className="",sr.component=function(t){return/^AUDIO$/i.test(t?.nodeName)?t:null},sr.prototype={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")},onPastAndDrop({file:t}){if(/^audio/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1},modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.urlValue.length>0)&&this.submitURL(this.urlValue)},init(){xs.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.removeAttribute("disabled"),this.preview.style.textDecoration="")},controllerAction(t){/update/.test(t.getAttribute("data-command"))?(this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src),this.open()):this.destroy()},retainFormat(){return{query:"audio",method:t=>{const e=Oi.GetContainer(t);if(e&&e.container&&e.cover)return;this._setTagAttrs(t);const i=Oi.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(i.container,t,null)}}},select(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1}),this.ready(t)},ready(t){Pt.get("__overInfo")!==ir&&(this._element=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))},async destroy(t){t=t||this._element;const e=Oi.GetContainer(t),i=e.container||t,s=i.previousElementSibling||i.nextElementSibling;if(!1===await this.triggerEvent("onAudioDeleteBefore",{target:t,container:e,url:t.getAttribute("src")}))return;const n=i.parentNode;Q.removeItem(i),this.init(),this.controller.close(),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)},_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.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.notice.open(e===er?t:e||t),!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.notice.open(i===er?t:i||t),!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",{...o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==er||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",{...i,handler:s});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==er||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,sr.key,!1);t.src=e,this.component.select(t,sr.key,!1)}else{this.fileManager.setFileData(t,i),t.src=e;const s=Oi.CreateContainer(t,"se-flex-component");if(!this.component.insert(s.container,!1,!this.options.get("componentAutoSelect")))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=Q.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this._setTagAttrs(i),i},_setTagAttrs(t){t.setAttribute("controls",!0);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,nr.bind(this,t),this._error.bind(this))},async _error(t){const e=await this.triggerEvent("onAudioUploadError",{error:t}),i=e===er?t.errorMessage:e||t.errorMessage;this.notice.open(i),console.error("[SUNEDITOR.plugin.audio.error]",i)},constructor:sr};const ar=sr,hr=function(t,e){this.katex=null,this.mathjax=null,(this.katex=function(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}(t.options.get("externalLibs").katex))||(this.mathjax=function(t){if(!t)return null;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."),null}}(t.options.get("externalLibs").mathjax))||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option.'),Xe.call(this,t),this.title=this.lang.math,this.icon="math";const i=function({lang:t,icons:e},i,s,n){const o=s||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}];let l=o[0].value,r=`\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.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${t.math_modal_inputLabel} ${n?`(<a href="${Y.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${Y.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp" type="text" data-focus></textarea>\n </div>\n <div class="se-modal-form">\n <label>${t.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,i=o.length;e<i;e++)t=o[e],t.default&&(l=t.value),r+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return r+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${t.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="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,i.defaultFontSize=l,Q.createElement("DIV",{class:"se-modal-content"},r)}(t,this,e.fontSizeList,this.katex),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 Q.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t);this.modal=new xs(this,i),this.controller=new li(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",cr.bind(this)),this.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style))};function cr(t){this.previewElement.innerHTML=this._renderer(t.target.value),this.mathjax&&dr(this.mathjax)}function dr(t){t.clear(),t.updateDocument()}function ur(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}hr.key="math",hr.type="modal",hr.className="",hr.component=function(t){return Q.hasClass(t,"se-math|katex")&&Q.hasClass(t,"se-component")?t:null},hr.prototype={select(t){if(Q.hasClass(t,"se-math|katex")&&ur(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=ur(t);if(!e)return;const i=this._d.createRange().createContextualFragment(this._renderer(J.entityToHTML(this._escapeBackslashes(e,!0))));t.innerHTML=i.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable",!1),Q.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?Q.addClass(t,"katex"):Q.removeClass(t,"katex"),this.mathjax&&dr(this.mathjax)}}},open(){this.modal.open()},on(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=J.entityToHTML(this._escapeBackslashes(ur(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||Q.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(Q.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable",!1),e.setAttribute("data-se-value",J.htmlToEntity(this._escapeBackslashes(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(Q.addClass(e,"katex"),Q.removeClass(e,"MathJax")):Q.removeClass(e,"katex"),this.isUpdateState){const t=Q.getParentElement(this.controller.currentTarget,".se-component");t.parentNode.replaceChild(e,t);const i=this.component.get(e);return this.component.select(i.target,i.pluginName,!1),!0}{const t=this.format.getLines();if(t.length>1){const i=Q.createElement(t[0].nodeName,null,e);this.component.insert(i,!1,!0)}else this.component.insert(e,!1,!0)}this.mathjax&&dr(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,hr.key,!1),!0},init(){this.textArea.value="",this.previewElement.innerHTML="",Q.removeClass(this.textArea,"se-error")},controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":!async function(t){if(!navigator.clipboard||!t)return;try{const e=ur(t);await navigator.clipboard.writeText(e),Q.addClass(t,"se-copy"),Y._w.setTimeout((()=>{Q.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}(this._element);break;case"delete":this.destroy(this.controller.currentTarget)}},destroy(t){Q.removeItem(t),this.controller.close(),this.editor.focus(),this.history.push(!1)},_renderer(t){let e="";try{Q.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)?(Q.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`)}catch(t){Q.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${Y.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${Y.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e},_escapeBackslashes:(t,e)=>t.replace(/\\{2}/g,e?"\\":"\\\\"),constructor:hr};const pr=hr,gr=function(t,e){Ft.call(this,t.editor);const i=Q.createElement("DIV",{class:"se-file-browser sun-editor-common"}),s=Q.createElement("DIV",{class:"se-file-browser-inner"},function({lang:t,icons:e}){return`\n\t\t<div class="se-file-browser-content">\n\t\t\t<div class="se-file-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-file-browser-close" class="close" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-file-browser-title"></span>\n\t\t\t\t<div class="se-file-browser-tags"></div>\n\t\t\t</div>\n\t\t\t<div class="se-file-browser-body">\n\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t<div class="se-file-browser-list"></div>\n\t\t\t</div>\n\t\t</div>`}(t.editor));this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.area=i,this.header=s.querySelector(".se-file-browser-header"),this.titleArea=s.querySelector(".se-file-browser-title"),this.tagArea=s.querySelector(".se-file-browser-tags"),this.body=s.querySelector(".se-file-browser-body"),this.list=s.querySelector(".se-file-browser-list"),this._loading=s.querySelector(".se-loading-box"),this.title=e.title,this.listClass=e.listClass,this.url=e.url,this.urlHeader=e.headers,this.drawItemHandler=e.drawItemHandler,this.selectorHandler=e.selectorHandler,this.columnSize=e.columnSize||4,this.items=[],this.selectedTags=[],this._closeSignal=!1,this._bindClose=null,this.__globalEventHandler=t=>{/27/.test(t.keyCode)&&this.close()},this.apiManager=new Ys(this,{method:"GET"}),i.appendChild(Q.createElement("DIV",{class:"se-file-browser-back"})),i.appendChild(s),this.carrierWrapper.appendChild(i),this.eventManager.addEvent(this.tagArea,"click",_r.bind(this)),this.eventManager.addEvent(this.list,"click",br.bind(this)),this.eventManager.addEvent(s,"mousedown",vr.bind(this)),this.eventManager.addEvent(s,"click",yr.bind(this))};function mr(t){try{const e=JSON.parse(t.responseText);e.result.length>0?this._drawListItem(e.result,!0):e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.fileBrowser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading(),this.body.style.maxHeight=Q.getClientSize().h-this.header.offsetHeight-50+"px"}}function fr(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.fileBrowser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}function _r(t){const e=t.target;if(!Q.isAnchor(e))return;const i=e.textContent,s=this.tagArea.querySelector('a[title="'+i+'"]'),n=this.selectedTags,o=n.indexOf(i);o>-1?(n.splice(o,1),Q.removeClass(s,"on")):(n.push(i),Q.addClass(s,"on")),this._drawListItem(0===n.length?this.items:this.items.filter((function(t){return t.tag.some((function(t){return n.includes(t)}))})),!1)}function br(t){if(t.preventDefault(),t.stopPropagation(),t.target===this.list)return;const e=Q.getCommandTarget(t.target);e&&(this.close(),this.selectorHandler(e))}function vr(t){/se-file-browser-inner/.test(t.target.className)?this._closeSignal=!0:this._closeSignal=!1}function yr(t){t.stopPropagation(),(/close/.test(t.target.getAttribute("data-command"))||this._closeSignal)&&this.close()}gr.prototype={open(t){t||(t={}),this.__addGlobalEvent();const e=t.listClass||this.listClass;Q.hasClass(this.list,e)||(this.list.className="se-file-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this._drawFileList(t.url||this.url,t.urlHeader||this.urlHeader)},close(){this.__removeGlobalEvent(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="","function"==typeof this.inst.init&&this.inst.init()},showBrowserLoading(){this._loading.style.display="block"},closeBrowserLoading(){this._loading.style.display="none"},_drawFileList(t,e){this.apiManager.call({method:"GET",url:t,headers:e,callBack:mr.bind(this),errorCallBack:fr.bind(this)}),this.showBrowserLoading()},_drawListItem(t,e){const i=[],s=t.length,n=this.columnSize,o=n<=1?1:Math.round(s/n)||1,l=this.drawItemHandler;let r="",a='<div class="se-file-item-column">',h=1;for(let c,d,u=0;u<s;u++)if(c=t[u],d=c.tag?"string"==typeof c.tag?c.tag.split(","):c.tag:[],d=c.tag=d.map((function(t){return t.trim()})),a+=l(c),(u+1)%o==0&&h<n&&u+1<s&&(h++,a+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,s=d.length;e<s;e++)t=d[e],t&&!i.includes(t)&&(i.push(t),r+=`<a title="${t}" aria-label="${t}">${t}</a>`);a+="</div>",this.list.innerHTML=a,e&&(this.items=t,this.tagArea.innerHTML=r)},__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler,!0)},__removeGlobalEvent(){this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))},constructor:gr};const Cr=gr,wr=function(t,e){Xe.call(this,t),this.title=this.lang.imageGallery,this.icon="image_gallery",this.fileBrowser=new Cr(this,{title:this.lang.imageGallery,url:e.url,headers:e.headers,listClass:"se-image-list",drawItemHandler:xr,selectorHandler:Er.bind(this),columnSize:4}),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};function xr(t){const e=t.src.split("/").pop();return`\n\t\t<div class="se-file-item-img">\n\t\t\t<img \n\t\t\t\tsrc="${t.thumbnail||t.src}" \n\t\t\t\talt="${t.alt||e}" \n\t\t\t\tdata-command="${t.src||t.thumbnail}" \n\t\t\t\tdata-value="${t.name||e}">\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>`}function Er(t){if(this.inputTarget)this.inputTarget(t);else{const e={name:t.getAttribute("data-value"),size:0};this.plugins.image.init(),this.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt)}}wr.key="imageGallery",wr.type="fileBrowser",wr.className="",wr.prototype={open(t){this.inputTarget=t,this.fileBrowser.open()},close(){this.inputTarget=null,this.fileBrowser.close()},constructor:wr};const Sr=wr,Tr={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]}},kr=function(t,e){Xe.call(this,t),this.unitMap={...Tr,...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>",Q.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.beforeButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":kr.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.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":kr.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=Q.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":kr.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:kr.key,type:"dropdown"},i)):(this.afterButton=Q.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":kr.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:kr.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this._disableInput=n,this.menu.initDropdownTarget(kr,i)};kr.key="fontSize",kr.type="input",kr.className="se-btn-select se-btn-input se-btn-tool-font-size",kr.prototype={active(t,e){if(!Q.hasClass(e,"__se__font_size"))return!1;if(t){if(t?.style.fontSize.length>0)return this._setSize(e,t.style.fontSize),!0}else this._setSize(e,this._getDefaultSize());return!1},onInputKeyDown({target:t,event:e}){const i=e.keyCode;if(this._disableInput||32===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=this.unitMap[n];let l=s;switch(i){case 38:l+=o.inc,l>o.max&&(l=s);break;case 40:l-=o.inc,l<o.min&&(l=s)}e.preventDefault();try{this.isInputActive=!0;const e=this._setSize(t,l+n);if(this._disableInput)return;const s=Q.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(s,["font-size"],null,null),13!==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=Q.createElement("SPAN",{style:"font-size: "+this._setSize(t,i+s)+";"});this.format.applyInlineElement(l,["font-size"],null,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")?Q.addClass(n[t],"active"):Q.removeClass(n[t],"active");this.currentSize=s},action(t){const e=t.getAttribute("data-command");if(e===kr.key){const{value:e,unit:i}=this._getSize(t);let s=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=Q.createElement("SPAN",{style:"font-size: "+s+i+";"});this.format.applyInlineElement(l,["font-size"],null,null)}else if(e){const t=Q.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(t,["font-size"],null,null)}else this.format.applyInlineElement(null,["font-size"],["span"],!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:/^INPUT$/i.test(t.nodeName)?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;let n=i.pop();return n=s?1*n:n,{unit:s,value:n}},_setSize(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?/^INPUT$/i.test(t.nodeName)?t.value=e:t.textContent=this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e:0},constructor:kr};const Nr=kr,{_w:Lr}=Y,Hr=function(t){Xe.call(this,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 Q.createElement("DIV",{class:"se-controller se-controller-link"},i)}(this);this.displayId=i.querySelector(".se-controller-display"),this.controllerSelect=new li(this,i,{position:"bottom",disabled:!0},this.kind);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 Q.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.inputEl=s.querySelector("input"),this.controller=new li(this,s,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},this.kind)};Hr.key="anchor",Hr.type="popup",Hr.component=function(t){return Q.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null},Hr.className="",Hr.prototype={show(){this.controller.open(this._range=this.selection.getRange()),Lr.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)switch(e){case"submit":if(this._element)this._element.id=this.inputEl.value,this.select(this._element);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=Q.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,!1,!0);const i=this.selection.getNearRange(e);i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Hr.key,!1),this.init()}break;case"cancel":this.controller.close(!this._element),this._range&&this.selection.setRange(this._range);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controller.open(this._element);break;case"delete":{const t=this.selection.getNearRange(this._element);Q.removeItem(this._element),this.controllerSelect.close(!0),t&&this.selection.setRange(t.container,t.offset,t.container,t.offset);break}}},init(){this._element=null,this._range=null,this.inputEl.value="",this.displayId.textContent=""},constructor:Hr};const Mr=Xe,Ar={blockquote:Gs,exportPdf:Qs,fileUpload:rn,list_bulleted:hn,list_numbered:un,mention:fn,align:bn,font:yn,fontColor:bo,backgroundColor:yo,list:Eo,table:il,formatBlock:nl,hr:wo,layout:ll,lineHeight:al,template:cl,paragraphStyle:ul,textStyle:gl,link:Ll,image:Wl,video:tr,audio:ar,math:pr,imageGallery:Sr,fontSize:Nr,anchor:Hr},Br={_DragHandle:Pt,ApiManager:Ys,ColorPicker:fo,Controller:li,FileBrowser:Cr,FileManager:sn,HueSlider:lo,Figure:Oi,Modal:xs,ModalAnchorEditor:kl,SelectMenu:mi},Ir=et,Vr={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({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 Zs(s,e)}};i("+qkj"),i("JybH"),Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...Vr,editorInjector:Mr,plugins:Ar,modules:Br,helper:Ir}})})()})();
|