@wangeditor-next/core 1.9.8 → 1.10.0
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/core/src/index.d.ts +3 -1
- package/dist/core/src/to-html/index.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@uppy/core"),require("@uppy/xhr-upload"),require("lodash.foreach"),require("nanoid"),require("slate"),require("lodash.clonedeep"),require("dom7"),require("lodash.toarray"),require("lodash.debounce"),require("lodash.throttle"),require("is-hotkey"),require("snabbdom"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","@uppy/core","@uppy/xhr-upload","lodash.foreach","nanoid","slate","lodash.clonedeep","dom7","lodash.toarray","lodash.debounce","lodash.throttle","is-hotkey","snabbdom","lodash.camelcase"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WangEditorCore={},e.Uppy,e.XHRUpload,e.forEach,null,e.require$$0,e.cloneDeep,e.$,e.toArray,e.debounce,e.throttle,e.isHotkey,e.snabbdom,e.camelCase)}(this,function(e,t,n,r,o,i,a,s,l,c,u,d,f,h){"use strict";var p=function(e,t){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},p(e,t)};function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};function m(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function b(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function w(e){Promise.resolve().then(e)}function E(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}"function"==typeof SuppressedError&&SuppressedError;var x=function(e){return Object.prototype.toString.call(e)};function S(e){return e||{name:""}}function C(e){return Object.keys(e).reduce(function(t,n){return t[n]=String(e[n]),t},{})}function k(e){var o=e.server,i=void 0===o?"":o,a=e.fieldName,s=void 0===a?"":a,l=e.maxFileSize,c=void 0===l?10485760:l,u=e.maxNumberOfFiles,d=void 0===u?100:u,f=e.meta,h=void 0===f?{}:f,p=e.metaWithUrl,g=void 0!==p&&p,b=e.headers,w=void 0===b?{}:b,E=e.withCredentials,x=void 0!==E&&E,k=e.timeout,O=void 0===k?1e4:k,N=e.onBeforeUpload,T=void 0===N?function(e){return e}:N,M=e.onSuccess,L=void 0===M?function(e,t){}:M,D=e.onError,R=void 0===D?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:D,P=e.onProgress,A=void 0===P?function(e){}:P;if(!i)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!s)throw new Error("Cannot get fieldName\n没有配置 fieldName");var $=i;g&&($=function(e,t){var n=y(e.split("#"),2),o=n[0],i=n[1],a=o,s=[];r(t,function(e,t){s.push("".concat(t,"=").concat(e))});var l=s.join("&");return a=a.indexOf("?")>0?"".concat(a,"&").concat(l):"".concat(a,"?").concat(l),i?"".concat(a,"#").concat(i):a}($,h)),function(){if("undefined"!=typeof AbortSignal){var e=AbortSignal;"function"!=typeof e.any&&(e.any=function(e){var t,n,r=new AbortController,o=function(t){e.forEach(function(e){return e.removeEventListener("abort",o)});var n=t.target.reason;r.abort(n)};try{for(var i=m(e),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.aborted){var l=s.reason;return r.abort(l),r.signal}s.addEventListener("abort",o,{once:!0})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.signal})}}();var F=function(e){if(e)return"function"==typeof e?function(t){return C(e(t))}:C(e)}(w),I=new t(v({onBeforeUpload:function(e){return T(e)},restrictions:{maxFileSize:c,maxNumberOfFiles:d},meta:h},e.uppyConfig)).use(n,v({endpoint:$,headers:F,formData:!0,fieldName:s,bundle:!1,withCredentials:x,timeout:O},e.xhrConfig));return I.on("upload-success",function(e,t){var n=(null!=t?t:{}).body,r=void 0===n?{}:n,o=S(e);try{L(o,r)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),I.on("progress",function(e){e<1||A(e)}),I.on("upload-error",function(e,t,n){var r=S(e);try{R(r,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),I.on("restriction-failed",function(e,t){var n=S(e);try{R(n,t,void 0)}catch(e){console.error("wangEditor upload file - onError error",e)}}),I}var O=new Set(["base","embed","math","meta","object","script","svg"]),N=new Set(["href","poster","src","xlink:href"]),T=["java","script:"].join("");function M(e,t,n){var r=function(e){return Array.from(e).filter(function(e){return e>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith(T)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==t&&"xlink:href"!==t&&(("img"===e||"poster"===t)&&r.startsWith("data:image/")))}function L(e){if(void 0===e&&(e=""),!e)return"";var t=document.createElement("div");t.innerHTML=e;var n=function(e){Array.from(e.childNodes).forEach(function(e){if(e instanceof Element){var t=e,r=t.tagName.toLowerCase();if("template"===r){var o=t,i=L(o.innerHTML);return i?(o.insertAdjacentHTML("beforebegin",i),void o.remove()):void o.remove()}O.has(r)?t.remove():(Array.from(t.attributes).forEach(function(e){var n=e.name.toLowerCase(),o=e.value||"";("srcdoc"===n||n.startsWith("on")||N.has(n)&&!M(r,n,o))&&t.removeAttribute(e.name)}),n(t))}})};return n(t),t.innerHTML}var D={};var R="created",P="destroyed",A="change",$="scroll",F="fullscreen",I="unFullScreen",B="modalOrPanelShow",j="modalOrPanelHide",_={};var H=new WeakMap,W=new WeakMap,V=new WeakMap,U=new WeakMap,z=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakMap,G=new WeakMap,Y=new WeakMap,X=new WeakMap,Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,re=new WeakMap,oe=new WeakMap,ie=new WeakMap,ae=new WeakMap,se=new WeakMap,le=new WeakMap,ce=new WeakMap,ue=new WeakMap,de=new WeakMap,fe=new WeakMap,he=new WeakMap,pe=new WeakMap,ge=new WeakMap,ve=function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in _)e.push(t);return e},t.getConfig=function(){var e=Y.get(t);if(null==e)throw new Error("Can not get editor config");return e},t.getMenuConfig=function(e){var n=t.getConfig().MENU_CONF;return(void 0===n?{}:n)[e]||{}},t.alert=function(e,n){void 0===n&&(n="info");var r=t.getConfig().customAlert;r&&r(e,n)},t},me=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);const ye=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var be,we=globalThis.Node,Ee=globalThis.Comment,xe=globalThis.Element,Se=globalThis.Text,Ce=globalThis.Range,ke=globalThis.Selection,Oe=globalThis.StaticRange;s.css&&(s.fn.css=s.css),s.append&&(s.fn.append=s.append),s.addClass&&(s.fn.addClass=s.addClass),s.removeClass&&(s.fn.removeClass=s.removeClass),s.hasClass&&(s.fn.hasClass=s.hasClass),s.on&&(s.fn.on=s.on),s.focus&&(s.fn.focus=s.focus),s.attr&&(s.fn.attr=s.attr),s.removeAttr&&(s.fn.removeAttr=s.removeAttr),s.hide&&(s.fn.hide=s.hide),s.show&&(s.fn.show=s.show),s.offset&&(s.fn.offset=s.offset),s.width&&(s.fn.width=s.width),s.height&&(s.fn.height=s.height),s.parent&&(s.fn.parent=s.parent),s.parents&&(s.fn.parents=s.parents),s.is&&(s.fn.is=s.is),s.dataset&&(s.fn.dataset=s.dataset),s.val&&(s.fn.val=s.val),s.text&&(s.fn.text=s.text),s.html&&(s.fn.html=s.html),s.children&&(s.fn.children=s.children),s.remove&&(s.fn.remove=s.remove),s.find&&(s.fn.find=s.find),s.each&&(s.fn.each=s.each),s.empty&&(s.fn.empty=s.empty),e.NodeType=void 0,(be=e.NodeType||(e.NodeType={}))[be.ELEMENT_NODE=1]="ELEMENT_NODE",be[be.TEXT_NODE=3]="TEXT_NODE",be[be.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",be[be.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",be[be.COMMENT_NODE=8]="COMMENT_NODE",be[be.DOCUMENT_NODE=9]="DOCUMENT_NODE",be[be.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",be[be.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";var Ne=function(e){return"[object HTMLDocument]"===x(e)},Te=function(e){return"[object ShadowRoot]"===x(e)},Me=function(e){return"[object DataTransfer]"===x(e)},Le=/\[object HTML([A-Z][a-z]*)*Element\]/,De=function(e){return"matches"in e&&/^[ou]l$/i.test(e.tagName)&&!e.hasAttribute("data-w-e-type")},Re=function(e){return Le.test(x(e))},Pe=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},Ae=function(e){return null!=e&&"number"==typeof e.nodeType},$e=function(t){return Ae(t)&&t.nodeType===e.NodeType.COMMENT_NODE},Fe=function(t){return Ae(t)&&t.nodeType===e.NodeType.ELEMENT_NODE},Ie=function(e){return"[object Selection]"===x(e)},Be=function(t){return Ae(t)&&t.nodeType===e.NodeType.TEXT_NODE},je=function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length},_e=function(e){var t,n=y(e,2),r=n[0],o=n[1];if(Fe(r)&&r.childNodes.length){var i=o===r.childNodes.length,a=i?o-1:o;for(r=(t=y(Ve(r,a,i?"backward":"forward"),2))[0],i=(a=t[1])<o;Fe(r)&&r.childNodes.length;){var s=i?r.childNodes.length-1:0;r=Ue(r,s,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},He=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},We=function(e){var t,n,r;return null!==(t=window&&window.document.getElementById(e))&&void 0!==t?t:window&&(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},Ve=function(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,s=!1;($e(o)||Fe(o)&&0===o.childNodes.length||Fe(o)&&"false"===o.getAttribute("contenteditable"))&&(!a||!s);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(s=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},Ue=function(e,t,n){return y(Ve(e,t,n),1)[0]},ze=function(e){var t,n,r="";if(Be(e)&&e.nodeValue)return e.nodeValue;if(Fe(e)){try{for(var o=m(Array.from(e.childNodes)),i=o.next();!i.done;i=o.next()){var a=i.value;r+=ze(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}var s=getComputedStyle(e).getPropertyValue("display");"block"!==s&&"list"!==s&&"table-row"!==s&&"BR"!==e.tagName||(r+="\n")}return r};function Ke(t){var n=[];n.push(t);for(var r=0;n.length>0;){var o=n.pop();if(null==o)break;if((r+=1)>1e4)break;var i=o.nodeName;if(o.nodeType===e.NodeType.ELEMENT_NODE){var a=i.toLowerCase();if(ye.includes(a)||"iframe"===a||"video"===a)return o;var s=o.children||[],l=s.length;if(l)for(var c=l-1;c>=0;c-=1)n.push(s[c])}}return null}function qe(t,n){if(!Re(t)||"true"!==t.dataset.slateVoid)for(var r=t.childNodes,o=r.length;o-=1;){var i=r[o],a=i.nodeType;Be(i)?n(i,t):[e.NodeType.ELEMENT_NODE,e.NodeType.DOCUMENT_NODE,e.NodeType.DOCUMENT_FRAGMENT_NODE].includes(a)&&qe(i,n)}}function Je(t){if(0===t.length)return"";var n=t[0];return n.nodeType!==e.NodeType.ELEMENT_NODE?"":n.tagName.toLowerCase()}var Ge=new RegExp(String.fromCharCode(160),"g");function Ye(e){return e.replace(Ge," ")}var Xe=["span","b","strong","i","em","s","strike","u","font","sub","sup"],Ze=[];var Qe=[];var et={};function tt(e,t){var n=e.length;if(n){var r=e[n-1];if(i.Text.isText(r)){var o=Object.keys(r);if(1===o.length&&"text"===o[0])return r.text+=t,!0}}return!1}function nt(e,t,n){return{type:"paragraph",children:[{text:s(e).text().replace(/\s+/gm," ")}]}}function rt(e,t){var n=function(e,t){var n=[];if(null!=e.attr("data-w-e-is-void"))return n;var r=e[0].childNodes;return 1===r.length&&"BR"===r[0].nodeName?(n.push({text:""}),n):(r.forEach(function(e){if(Fe(e)){if("BR"===e.nodeName)return void(tt(n,"\n")||n.push({text:"\n"}));var r=ct(s(e),t);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}else if(Be(e)){var o=e.textContent||"";if(""===o.trim()&&o.indexOf("\n")>=0)return;o&&(o=Ye(o),tt(n,o)||n.push({text:o}))}}),n)}(e,t),r=function(e){for(var t in et)if(e[0].matches(t))return et[t];return nt}(e),o=r(e[0],n,t);return Array.isArray(o)||(o=[o]),o.forEach(function(r){i.Editor.isVoid(t,r)||(0===n.length&&(r.children=[{text:e.text().replace(/\s+/gm," ")}]),Qe.forEach(function(n){r=n(e[0],r,t)}))}),o}function ot(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/[\r\n\t]+/g,"").replace(/<br>/g,"\n"));var n=e[0].textContent||"",r={text:n=Ye(n=E(n))};return Qe.forEach(function(n){r=n(e[0],r,t)}),r}function it(e,t){var n={text:""};return Qe.forEach(function(r){n=r(e[0],n,t)}),n}function at(e,t){var n=t.parentElement;return null==n?e:(null==n.closest("pre")&&(e=e.replace(/[\r\n\t]+/g,"")),e=Ye(e=E(e)))}function st(e,t){var n=v(v({},e),t);return Object.keys(t).forEach(function(e){!1===t[e]&&delete n[e]}),n}function lt(e,t,n){var r=e[0];if(Fe(r)){var o=ct(e,n),i=v({},t);return delete i.text,Array.isArray(o)?o.map(function(e){return st(i,e)}):[st(i,o)]}return $e(r)?null:[st(t,Be(r)?{text:at(r.textContent||"",r)}:ot(e,n))]}function ct(e,t){Ze.forEach(function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=s(r(e[0])))});var n=Je(e);if("span"===n){if(e.attr("data-w-e-type"))return rt(e,t);if((o=Array.from(e[0].childNodes)).some(function(e){return!Be(e)&&!$e(e)})){var r=it(s(e[0]),t);return o.flatMap(function(e){return lt(s(e),r,t)||[]})}return ot(e,t)}if("code"===n)return"pre"===Je(e.parent())?rt(e,t):ot(e,t);if(Xe.includes(n)){var o;if((o=Array.from(e[0].childNodes)).some(function(e){return!Be(e)&&!$e(e)})){var i=it(s(e[0]),t);return o.flatMap(function(e){return lt(s(e),i,t)||[]})}return ot(e,t)}return rt(e,t)}function ut(e,t,n){var r=s(n);return!!r.attr(t)||(r.attr(t,"true"),e.on(P,function(){r.removeAttr(t)}),!1)}function dt(e,t){void 0===t&&(t="");var n=[],r=e.getConfig().sanitizeHtml;""===t&&(t="<p><br></p>"),0!==t.indexOf("<")&&(t=t.split(/\n/).map(function(e){return"<p>".concat(e,"</p>")}).join("")),t=r?r(t):t;var o=s("<div>".concat(t,"</div>"));return Array.from(o.children()).forEach(function(t){var r=ct(s(t),e);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}),n}function ft(e,t){return"w-e-element-".concat(e,"-").concat(t)}var ht=0,pt=function(){this.id="".concat(ht),ht+=1},gt="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),vt="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),mt="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),yt="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),bt="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),wt="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),Et=!bt&&!yt&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,xt=function(e,t){return Boolean(e.compareDocumentPosition(t)&we.DOCUMENT_POSITION_PRECEDING)},St=function(e,t){return Boolean(e.compareDocumentPosition(t)&we.DOCUMENT_POSITION_FOLLOWING)},Ct={getWindow:function(e){var t=ce.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},findKey:function(e,t){var n=le.get(t);return n||(n=new pt,le.set(t,n)),n},setNewKey:function(e){var t=new pt;le.set(e,t)},findPath:function(e,t){for(var n=[],r=t;;){var o=re.get(r);if(null==o){if(i.Editor.isEditor(r))return n;break}var a=ne.get(r);if(null==a)break;n.unshift(a),r=o}throw new Error("Unable to find the path for Slate node: ".concat(JSON.stringify(t)))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=Ct.toDOMNode(e,e),n=t.getRootNode();return(Ne(n)||Te(n))&&null!=Reflect.get(n,"getSelection")?n:t.ownerDocument},getParentNode:function(e,t){return re.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=Ct.getParentNode(e,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(e,t){var n=[Ct.findPath(e,t)[0]];return i.Node.get(e,n)},toDOMNode:function(e,t){var n;if(i.Editor.isEditor(t))n=oe.get(e);else{var r=Ct.findKey(e,t);n=ae.get(r)}if(!n)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(JSON.stringify(t)));return n},hasDOMNodeBySlateNode:function(e,t){if(i.Editor.isEditor(t))return!!oe.get(e);var n=Ct.findKey(e,t);return!!ae.get(n)},canResolveDOMRange:function(e,t){try{var n=y(i.Editor.node(e,t.anchor.path),1)[0],r=y(i.Range.isCollapsed(t)?[n]:i.Editor.node(e,t.focus.path),1)[0];return Ct.hasDOMNodeBySlateNode(e,n)&&Ct.hasDOMNodeBySlateNode(e,r)}catch(e){return!1}},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Ct.toDOMNode(e,e);try{r=Fe(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!r&&(r.closest("[data-slate-editor]")===a&&(!i||r.isContentEditable||r.closest('[contenteditable="false"]')===a||!!r.getAttribute("data-slate-zero-width"))||!!r.getAttribute("data-slate-string"))},toDOMRange:function(e,t){var n=t.anchor,r=t.focus,o=i.Range.isBackward(t),a=Ct.toDOMPoint(e,n),s=i.Range.isCollapsed(t)?a:Ct.toDOMPoint(e,r),l=Ct.getWindow(e).document.createRange(),c=y(o?s:a,2),u=c[0],d=c[1],f=y(o?a:s,2),h=f[0],p=f[1],g=!!(Fe(u)?u:u.parentElement).getAttribute("data-slate-zero-width"),v=!!(Fe(h)?h:h.parentElement).getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(h,v?1:p),l},toDOMPoint:function(e,t){var n,r,o,a=y(i.Editor.node(e,t.path),1)[0],s=Ct.toDOMNode(e,a);i.Editor.void(e,{at:t})&&(t={path:t.path,offset:0});var l=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),c=0;try{for(var u=m(l),d=u.next();!d.done;d=u.next()){var f=d.value,h=f.childNodes[0];if(null!=h&&null!=h.textContent){var p=h.textContent.length,g=f.getAttribute("data-slate-length"),v=c+(null==g?p:parseInt(g,10));if(t.offset<=v){o=[h,Math.min(p,Math.max(0,t.offset-c))];break}c=v}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}if(!o)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(JSON.stringify(t)));return o},toSlateNode:function(e,t){var n=Fe(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?ie.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},findEventRange:function(e,t){"nativeEvent"in t&&(t=t.nativeEvent);var n=t.clientX,r=t.clientY,o=t.target;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var a,s=Ct.toSlateNode(e,t.target),l=Ct.findPath(e,s);if(i.Element.isElement(s)&&i.Editor.isVoid(e,s)){var c=o.getBoundingClientRect(),u=e.isInline(s)?n-c.left<c.left+c.width-n:r-c.top<c.top+c.height-r,d=i.Editor.point(e,l,{edge:u?"start":"end"}),f=u?i.Editor.before(e,d):i.Editor.after(e,d);if(f)return i.Editor.range(e,f)}var h=this.getWindow(e).document;if(h.caretRangeFromPoint)a=h.caretRangeFromPoint(n,r);else{var p=h.caretPositionFromPoint(n,r);p&&((a=h.createRange()).setStart(p.offsetNode,p.offset),a.setEnd(p.offsetNode,p.offset))}if(!a)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return Ct.toSlateRange(e,a,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,t,n){var r,o,a,s,l,c=n.exactMatch,u=n.suppressThrow;if((Ie(t)?t.anchorNode:t.startContainer)&&(Ie(t)?(r=t.anchorNode,o=t.anchorOffset,a=t.focusNode,s=t.focusOffset,l=wt&&He()?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed):(r=t.startContainer,o=t.startOffset,a=t.endContainer,s=t.endOffset,l=t.collapsed)),null==r||null==a||null==o||null==s){if(u)return null;throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t))}var d=Ct.toSlatePoint(e,[r,o],{exactMatch:c,suppressThrow:u});if(!d)return null;var f=l?d:Ct.toSlatePoint(e,[a,s],{exactMatch:c,suppressThrow:u,searchDirection:xt(r,a)||r===a&&s<o?"forward":"backward"});if(!f)return null;var h={anchor:d,focus:f};return i.Range.isExpanded(h)&&i.Range.isForward(h)&&Fe(a)&&i.Editor.void(e,{at:h.focus,mode:"highest"})&&(h=i.Editor.unhangRange(e,h,{voids:!0})),h},toSlatePoint:function(e,t,n){var r,o,i,a,s=n.exactMatch,c=n.suppressThrow,u=y(s?t:_e(t),2),d=u[0],f=u[1],h=d.parentNode,p=n.searchDirection,g=null,v=0;if(h){var w=Ct.toDOMNode(e,e),E=h.closest('[data-slate-void="true"]'),x=E&&w.contains(E)?E:null,S=h.closest('[contenteditable="false"]'),C=S&&w.contains(S)?S:null,k=h.closest("[data-slate-leaf]"),O=null,N=Ct.getWindow(e);if(k&&N.document.createRange){g=k.closest('[data-slate-node="text"]');var T=N.document.createRange();T.setStart(g,0),T.setEnd(d,f);var M=T.cloneContents();b(b([],y(l(M.querySelectorAll("[data-slate-zero-width]"))),!1),y(l(M.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(e){e.parentNode.removeChild(e)}),v=M.textContent.length,O=g}else if(x)(k=Array.from(x.querySelectorAll("[data-slate-leaf]")).find(function(t){return Ct.hasDOMNode(e,t)})||null)?(g=k.closest('[data-slate-node="text"]'),v=(O=k).textContent.length,O.querySelectorAll("[data-slate-zero-width]").forEach(function(e){v-=e.textContent.length})):v=1;else if(C){var L=Boolean(C.closest("[data-w-e-reserve]"));!p&&L&&(p="forward");var D=p,R=function(t){return t?Array.from(t.querySelectorAll("[data-slate-leaf]")).filter(function(t){return Ct.hasDOMNode(e,t)}):[]},P=C.closest('[data-slate-node="element"]');if("backward"===p||!p)for(var A=(F=b(b([],y(R(null==P?void 0:P.previousElementSibling)),!1),y(R(P)),!1)).length-1;A>=0;A-=1){var $=F[A];if(xt(C,$)){k=$,p="backward";break}}if(!k&&("forward"===p||!p||L)){var F=b(b([],y(R(P)),!1),y(R(null==P?void 0:P.nextElementSibling)),!1);try{for(var I=m(F),B=I.next();!B.done;B=I.next()){$=B.value;if(St(C,$)){k=$,D="backward"===p&&L?"backward":"forward";break}}}catch(e){r={error:e}}finally{try{B&&!B.done&&(o=I.return)&&o.call(I)}finally{if(r)throw r.error}}}k&&(g=k.closest('[data-slate-node="text"]'),O=k,"forward"===D?v=0:(v=O.textContent.length,O.querySelectorAll("[data-slate-zero-width]").forEach(function(e){v-=e.textContent.length})))}O&&v===O.textContent.length&&(h.hasAttribute("data-slate-zero-width")||vt&&(null===(i=O.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(v-=1)}if(!g){if(c)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}try{var j=Ct.toSlateNode(e,g);a=Ct.findPath(e,j)}catch(e){if(c)return null;throw e}return{path:a,offset:v}},hasRange:function(e,t){var n=t.anchor,r=t.focus;return i.Editor.hasPath(e,n.path)&&i.Editor.hasPath(e,r.path)},getNodeType:function(e){return i.Element.isElement(e)?e.type:""},checkNodeType:function(e,t){return this.getNodeType(e)===t},getNodesStr:function(e){return e.map(function(e){return i.Node.string(e)}).join("")},getSelectedVoidNode:function(e){var t=e.selection;if(!t)return null;var n=i.Editor.void(e,{at:t});if(!n)return null;var r=y(n,1)[0];return i.Element.isElement(r)?r:null},getSelectedElems:function(e){var t,n,r=[],o=Ct.getSelectedVoidNode(e);o&&r.push(o);var a=i.Editor.nodes(e,{universal:!0});try{for(var s=m(a),l=s.next();!l.done;l=s.next()){var c=y(l.value,1)[0];i.Element.isElement(c)&&c!==o&&r.push(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r},getSelectedNodeByType:function(e,t){var n=this,r=Ct.getSelectedVoidNode(e);if(r&&this.checkNodeType(r,t))return r;var o=y(i.Editor.nodes(e,{match:function(e){return n.checkNodeType(e,t)},universal:!0}),1),a=o[0];return null==a?null:a[0]},getSelectedTextNode:function(e){var t=y(i.Editor.nodes(e,{match:function(e){return i.Text.isText(e)},universal:!0}),1),n=t[0];return null==n?null:n[0]},isNodeSelected:function(e,t){if(Ct.getSelectedVoidNode(e)===t)return!0;var n=y(i.Editor.nodes(e,{match:function(e){return e===t},universal:!0}),1),r=n[0];return null!=r&&y(r,1)[0]===t},isSelectionAtLineEnd:function(e,t){var n=e.selection;return!!n&&(i.Editor.isEnd(e,n.anchor,t)||i.Editor.isEnd(e,n.focus,t))},getTextarea:function(e){var t=H.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return U.get(e)||null},getHoverbar:function(e){return K.get(e)||null},normalizeContent:function(e){e.children.forEach(function(t,n){e.normalizeNode([t,[n]])})},getLeftLengthOfMaxLength:function(e){var t=e.getConfig(),n=t.maxLength,r=t.onMaxLength;if("number"!=typeof n||n<=0)return 1/0;var o=n-e.getText().replace(/\r|\n|(\r\n)|(\n\r)/g,"").length;return o<=0&&r&&r(e),o},cleanExposedTexNodeInSelectionBlock:function(e){var t,n,r,o,a=Ct.getTextarea(e).$textArea,l=null==a?void 0:a[0].childNodes;if(l)try{for(var c=m(Array.from(l)),u=c.next();!u.done;u=c.next()){var d=u.value;if(!Be(d))break;d.remove()}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}var f=i.Editor.nodes(e,{match:function(t){return!(!i.Element.isElement(t)||e.isInline(t))},universal:!0});try{for(var h=m(f),p=h.next();!p.done;p=h.next()){var g=p.value;if(null!=g){var v=g[0];if(!Ct.hasDOMNodeBySlateNode(e,v))continue;qe(Ct.toDOMNode(e,v),function(e,t){var n=s(t);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||t.removeChild(e)})}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(r)throw r.error}}},isLastNode:function(e,t){var n=e.children||[];return n[n.length-1]===t},genEmptyParagraph:function(){return{type:"paragraph",children:[{text:""}]}},isSelectedVoidNode:function(e){return null!=Ct.getSelectedVoidNode(e)},isSelectedEmptyParagraph:function(e){var t=e.selection;if(null==t)return!1;if(i.Range.isExpanded(t))return!1;var n=[t.focus.path[0]];if(!i.Editor.hasPath(e,n))return!1;var r=y(i.Editor.node(e,n),1)[0];if(!i.Element.isElement(r)||"paragraph"!==r.type)return!1;var o=r.children;return 1===o.length&&(""===o[0].text||void 0)},isEmptyPath:function(e,t){var n=i.Editor.node(e,t);if(null==n)return!1;var r=y(n,1)[0].children;if(1===r.length&&""===r[0].text)return!0;return!1}},kt=[];var Ot={};function Nt(e,t,n){var r=n.isInline(e)?"span":"div";return"<".concat(r,">").concat(t,"</").concat(r,">")}var Tt="data-w-e-id",Mt=/^[A-Za-z_:-][A-Za-z0-9_:.-]*$/;function Lt(e,t,n,r){if(!r.includeId)return e;var o=function(e){return e&&Mt.test(e)?e:Tt}(r.idKey),i=Ct.findKey(n,t);return function(e,t,n){if(!e)return e;var r=e.match(/^<([A-Za-z][A-Za-z0-9-]*)([^>]*)>/);if(!r)return e;var o=y(r,3),i=o[0],a=o[1],s=o[2],l=void 0===s?"":s;if(new RegExp("\\s".concat(t,"=")).test(l))return e;var c=/\/\s*$/.test(l),u=l.replace(/\s*\/\s*$/,""),d=u.trim()?" ".concat(u.trim()):"",f=c?" /":"";return"<".concat(a).concat(d," ").concat(t,'="').concat(n,'"').concat(f,">")+e.slice(i.length)}(e,o,ft(Ct.getNodeType(t),i.id))}function Dt(e,t,n){void 0===n&&(n={});var r=e.type,o=void 0===r?"":r,a=e.children,s=void 0===a?[]:a,l=i.Editor.isVoid(t,e),c="";l||(c=s.map(function(e){return Rt(e,t,n)}).join(""));var u=function(e){return Ot[e]||Nt}(o),d=u(e,c,t),f="";if(f="string"==typeof d?d:d.html||"",l||kt.forEach(function(n){return f=n(e,f,t)}),f=Lt(f,e,t,n),"string"==typeof d)return f;var h=d.prefix,p=void 0===h?"":h,g=d.suffix,v=void 0===g?"":g;return p&&(f=p+f),v&&(f+=v),f}function Rt(e,t,n){return void 0===n&&(n={}),i.Element.isElement(e)?Dt(e,t,n):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=n;r=function(e){return e.replace(/ {2}/g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™")}(r);var o=Ct.getParentsNodes(t,e).some(function(e){return"pre"===Ct.getNodeType(e)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/ /g," ")),""===r){var i=Ct.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>"}return kt.forEach(function(n){return r=n(e,r,t)}),r}(e,t)}var Pt=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},At=function(e,t,n){var r=Ct.toDOMRange(e,t).getBoundingClientRect(),o=Ct.toDOMRange(e,n).getBoundingClientRect();return Pt(r,o)&&Pt(o,r)},$t=function(e,t){var n,r,o=[];try{for(var a=m(i.Editor.levels(e,{at:t})),s=a.next();!s.done;s=a.next()){var l=y(s.value,2),c=l[0],u=l[1],d=Ct.findKey(e,c);o.push([u,d])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o};var Ft=function(e){var t=e,n=t.onChange,r=t.insertText,o=t.apply,a=t.deleteBackward,l=t.deleteFragment;return t.insertText=function(e){t.getConfig().readOnly||r(e)},t.apply=function(e){var n,r,a,s,l,c,u,d,f=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":case"split_node":f.push.apply(f,b([],y($t(t,e.path)),!1));break;case"insert_node":case"remove_node":f.push.apply(f,b([],y($t(t,i.Path.parent(e.path))),!1));break;case"merge_node":var h=i.Path.previous(e.path);f.push.apply(f,b([],y($t(t,h)),!1));break;case"move_node":var p=i.Path.common(i.Path.parent(e.path),i.Path.parent(e.newPath));f.push.apply(f,b([],y($t(t,p)),!1));break;case"set_selection":(null===(s=null===(a=e.newProperties)||void 0===a?void 0:a.focus)||void 0===s?void 0:s.path)&&(f.push.apply(f,b([],y($t(t,null===(c=null===(l=e.newProperties)||void 0===l?void 0:l.focus)||void 0===c?void 0:c.path)),!1)),f.push.apply(f,b([],y($t(t,null===(d=null===(u=e.properties)||void 0===u?void 0:u.focus)||void 0===d?void 0:d.path)),!1)))}o(e);try{for(var g=m(f),v=g.next();!v.done;v=g.next()){var w=y(v.value,2),E=w[0],x=w[1],S=y(i.Editor.node(t,E),1)[0];le.set(S,x),"type"in S&&(ee.has(S)&&ee.delete(S),te.has(S)&&te.delete(S))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}},t.deleteBackward=function(n){if("line"!==n)return a(n);if(e.selection&&i.Range.isCollapsed(e.selection)){var r=i.Editor.above(e,{match:function(t){return i.Element.isElement(t)&&i.Editor.isBlock(e,t)},at:e.selection});if(r){var o=y(r,2)[1],s=i.Editor.range(e,o,e.selection.anchor),l=function(e,t){var n=i.Editor.range(e,i.Range.end(t)),r=Array.from(i.Editor.positions(e,{at:t})),o=0,a=r.length,s=Math.floor(a/2);if(At(e,i.Editor.range(e,r[o]),n))return i.Editor.range(e,r[o],n);if(r.length<2)return i.Editor.range(e,r[r.length-1],n);for(;s!==r.length&&s!==o;)At(e,i.Editor.range(e,r[s]),n)?a=s:o=s,s=Math.floor((o+a)/2);return i.Editor.range(e,r[a],n)}(t,s);i.Range.isCollapsed(l)||i.Transforms.delete(e,{at:l})}}},t.deleteFragment=function(e){var n=function(e){var t=e.selection;if(null==t||i.Range.isCollapsed(t))return!1;var n=y(i.Range.edges(t),2),r=n[0],o=n[1],a=y(i.Editor.edges(e,[]),2),s=a[0],l=a[1];return i.Point.equals(r,s)&&i.Point.equals(o,l)}(t);l(e),n&&(!function(e){var t=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){for(var n=e.children.length-1;n>=0;n-=1)i.Transforms.removeNodes(e,{at:[n]});i.Transforms.insertNodes(e,t,{at:[0]})})}(t),t.children.length>0&&i.Transforms.select(t,i.Editor.start(t,[])))},t.onChange=function(){var e=t.selection;null!=e&&de.set(t,e),t.emit(A),n()},t.handleTab=function(){t.insertText(" ")},t.getHtml=function(){var e=t.children,n=void 0===e?[]:e,r=t.getConfig().skipCacheTypes,o=void 0===r?["list-item"]:r;return n.map(function(e){var n=Ct.getNodeType(e);if(o.includes(n))return Rt(e,t);var r=te.get(e);if(r)return r;var i=Rt(e,t);return te.set(e,i),i}).join("")},t.getHtmlWithId=function(e){void 0===e&&(e="data-w-e-id");var n=t.children;return(void 0===n?[]:n).map(function(n){return Rt(n,t,{includeId:!0,idKey:e})}).join("")},t.getText=function(){var e=t.children;return(void 0===e?[]:e).map(function(e){return i.Node.string(e)}).join("\n")},t.getSelectionText=function(){var n=t.selection;return null==n?"":i.Editor.string(e,n)},t.getElemsByType=function(e,n){var r,o;void 0===n&&(n=!1);var a=[],s=i.Editor.nodes(t,{at:[],universal:!0});try{for(var l=m(s),c=l.next();!c.done;c=l.next()){var u=y(c.value,1)[0];if(i.Element.isElement(u))if(n?u.type.indexOf(e)>=0:u.type===e){var d=Ct.findKey(t,u),f=ft(u.type,d.id);a.push(v(v({},u),{id:f}))}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return a},t.getElemsByTypePrefix=function(e){return t.getElemsByType(e,!0)},t.isEmpty=function(){var e=t.children,n=void 0===e?[]:e;if(n.length>1)return!1;var r=n[0];if(null==r)return!0;if(!i.Element.isElement(r)||"paragraph"!==r.type)return!1;var o=r.children,a=void 0===o?[]:o;if(a.length>1)return!1;var s=a[0];return null==s||i.Text.isText(s)&&""===s.text},t.clear=function(){for(var e=t.children.length-1;e>=0;e-=1)i.Transforms.removeNodes(t,{at:[e]});0!==t.children.length?function(e){var t=e.children[0];if(1===e.children.length&&i.Element.isElement(t)&&("paragraph"!==t.type||""!==i.Node.string(t))&&""===i.Node.string(t)){var n=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){i.Transforms.removeNodes(e,{at:[0]}),i.Transforms.insertNodes(e,n,{at:[0]})})}}(t):i.Transforms.insertNodes(t,[{type:"paragraph",children:[{text:""}]}])},t.getParentNode=function(e){return Ct.getParentNode(t,e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e){var r=document.createElement("div");r.innerHTML=e;var o=Array.from(r.childNodes);if(o=o.filter(function(e){var t=e.nodeName;return!!Be(e)||!!Fe(e)&&!me.has(t.toLowerCase())}),0!==o.length){var a=t.selection;if(null!=a){var l=null;if(Ct.isSelectedEmptyParagraph(t)&&!n)l=[a.focus.path[0]];r.setAttribute("hidden","true"),document.body.appendChild(r);var c=0;o.forEach(function(e,n){var r=e.nodeName,a=e.textContent,l=void 0===a?"":a;if(Be(e)){if(!l||!l.trim())return;t.insertNode({text:l})}else if("BR"!==r){var u=e,d=!1;if(Xe.includes(r.toLowerCase()))d=!0;else for(var f in et)if(u.matches(f)){d=!0;break}if(d){var h=ct(s(u),t),p=Array.isArray(h)?h:[h];if(p.forEach(function(e){return function(e,t){if(i.Text.isText(t))e.insertNode(t);else if(i.Element.isElement(t))if(e.isInline(t))e.insertNode(t),"link"===t.type&&e.insertFragment([{text:""}]);else{var n=e.selection;if(!n)return;var r=[n.focus.path[0]];if(Ct.isSelectedEmptyParagraph(e))return i.Transforms.removeNodes(e,{at:r}),i.Transforms.insertNodes(e,t,{at:r}),void i.Transforms.select(e,i.Editor.end(e,r));var o=i.Path.next(r);i.Transforms.insertNodes(e,t,{at:o}),i.Transforms.select(e,i.Editor.end(e,o))}}(t,e)}),c+=p.length,Ct.isSelectedVoidNode(t)&&t.move(1),p.some(function(e){return!!i.Element.isElement(e)&&(!!t.isInline(e)||e.children.some(function(e){return i.Element.isElement(e)&&t.isInline(e)}))})&&t.selection){var g=i.Editor.nodes(t,{at:t.selection,match:function(e){return i.Element.isElement(e)&&t.isInline(e)},universal:!0}).next().value;if(g){var v=y(g,2)[1],m=i.Path.next(v);i.Editor.hasPath(t,m)?i.Transforms.select(t,{anchor:{path:m,offset:0},focus:{path:m,offset:0}}):t.move(1)}}}else{var b=window.getComputedStyle(u).display;if(!Ct.isSelectedEmptyParagraph(t)&&b.indexOf("inline")<0){if(n>=1){var w=o[n-1];De(w)&&t.insertBreak()}t.insertBreak()}t.dangerouslyInsertHtml(u.innerHTML,!0)}}else t.insertText("\n")}),c&&l&&Ct.isEmptyPath(t,l)&&i.Transforms.removeNodes(t,{at:l}),r.remove()}}}},t.setHtml=function(e){void 0===e&&(e="");var n=t.isDisabled(),r=t.isFocused(),o=JSON.stringify(t.selection);t.enable(),de.delete(t),t.focus(),t.clear();var a=dt(t,null==e?"":e);if(i.Transforms.insertFragment(t,a),r||(t.deselect(),t.blur()),n&&(t.deselect(),t.disable()),t.isFocused())try{var s=JSON.parse(o);i.Range.isRange(s)&&Ct.hasRange(t,s)?t.select(s):t.select(i.Editor.start(t,[]))}catch(e){t.select(i.Editor.start(t,[]))}},t},It=1,Bt=function(e){var t=e;return t.id="wangEditor-".concat(It),It+=1,t.isDestroyed=!1,t.isFullScreen=!1,t.focus=function(e){if(Ct.toDOMNode(t,t).focus({preventScroll:!0}),ue.set(t,!0),e){var n=i.Editor.end(t,[]);i.Transforms.select(t,n)}else{var r=de.get(t);r?i.Transforms.select(t,r):i.Transforms.select(t,i.Editor.start(t,[]))}},t.isFocused=function(){return!!ue.get(t)},t.blur=function(){Ct.toDOMNode(t,t).blur(),i.Transforms.deselect(t),ue.set(t,!1)},t.updateView=function(){Ct.getTextarea(t).changeViewState();var e=Ct.getToolbar(t);e&&e.changeToolbarState();var n=Ct.getHoverbar(t);n&&n.changeHoverbarState()},t.destroy=function(){if(!t.isDestroyed){var e=Ct.getTextarea(t);e.destroy(),H.delete(t),W.delete(e);var n=Ct.getToolbar(t);n&&(n.destroy(),U.delete(t),V.delete(n));var r=Ct.getHoverbar(t);r&&(r.destroy(),K.delete(t),z.delete(r)),t.isDestroyed=!0,t.emit(P)}},t.scrollToElem=function(e){if(!t.getConfig().scroll){var n="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return n+="\nYou has disabled editor scroll, please do this yourself",void console.warn(n)}var r=s("#".concat(e));if(0!==r.length){var o=r[0];if(!Ct.hasDOMNode(t,o)){n="Element (found by id is '".concat(e,"') is not in editor DOM");return n+="\n 通过 id '".concat(e,"' 找到的 element 不在 editor DOM 之内"),void console.error(n,o)}var i=Ct.getTextarea(t),a=i.$textAreaContainer,l=i.$scroll,c=r.offset().top,u=a.offset().top;l[0].scrollBy({top:c-u,behavior:"smooth"})}},t.showProgressBar=function(e){e<1||Ct.getTextarea(t).changeProgress(e)},t.hidePanelOrModal=function(){var e=J.get(t);null!=e&&e.forEach(function(e){return e.hide()})},t.enable=function(){t.getConfig().readOnly=!1,t.updateView()},t.disable=function(){t.getConfig().readOnly=!0,t.updateView()},t.isDisabled=function(){return t.getConfig().readOnly},t.toDOMNode=function(e){return Ct.toDOMNode(t,e)},t.fullScreen=function(){if(!t.isFullScreen){var e=null,n=Ct.getToolbar(t);n&&(e=n.$box);var r=Ct.getTextarea(t).$box.parent();if(e&&e.parent()[0]!==r[0]){throw new Error("Can not set full screen, cause toolbar DOM parent is not equal to textarea DOM parent\n不能设置全屏,因为 toolbar DOM 父节点和 textarea DOM 父节点不一致")}r.addClass("w-e-full-screen-container");var o=r.css("z-index");r.attr("data-z-index",o.toString()),t.isFullScreen=!0,t.emit(F)}},t.unFullScreen=function(){if(t.isFullScreen){var e=Ct.getTextarea(t).$box.parent();setTimeout(function(){e.removeClass("w-e-full-screen-container"),t.isFullScreen=!1,t.emit(I)},200)}},t.getEditableContainer=function(){return Ct.getTextarea(t).$textAreaContainer[0]},t};function jt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _t,Ht,Wt,Vt,Ut,zt,Kt,qt,Jt,Gt,Yt,Xt,Zt,Qt,en,tn,nn,rn,on,an,sn,ln,cn,un,dn,fn,hn,pn,gn,vn,mn,yn,bn,wn,En,xn,Sn,Cn,kn,On,Nn={exports:{}},Tn={exports:{}};function Mn(){if(Ht)return _t;Ht=1;return _t=function(e){return null!=e}}function Ln(){if(zt)return Ut;zt=1;var e=function(){if(Vt)return Wt;Vt=1;var e=Mn(),t={object:!0,function:!0,undefined:!0};return Wt=function(n){return!!e(n)&&hasOwnProperty.call(t,typeof n)}}();return Ut=function(t){if(!e(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(e){return!1}}}function Dn(){if(Gt)return Jt;Gt=1;var e=function(){if(qt)return Kt;qt=1;var e=Ln();return Kt=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(e){return!1}return!e(t)}}(),t=/^\s*class[\s{/}]/,n=Function.prototype.toString;return Jt=function(r){return!!e(r)&&!t.test(n.call(r))}}function Rn(){if(rn)return nn;rn=1;var e=(tn?en:(tn=1,en=function(){}))();return nn=function(t){return t!==e&&null!==t}}function Pn(){return ln||(ln=1,sn=(Qt?Zt:(Qt=1,Zt=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(an)return on;an=1;var e=Rn(),t=Object.keys;return on=function(n){return t(e(n)?Object(n):n)}}()),sn}function An(){if(fn)return dn;fn=1;var e=Pn(),t=function(){if(un)return cn;un=1;var e=Rn();return cn=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return dn=function(r,o){var i,a,s,l=n(arguments.length,2);for(r=Object(t(r)),s=function(e){try{r[e]=o[e]}catch(e){i||(i=e)}},a=1;a<l;++a)e(o=arguments[a]).forEach(s);if(void 0!==i)throw i;return r},dn}function $n(){return pn?hn:(pn=1,hn=(Xt||(Xt=1,Yt=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}),Yt)()?Object.assign:An())}function Fn(){return xn||(xn=1,En=function(){if(yn)return mn;yn=1;var e="razdwatrzy";return mn=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}}()()?String.prototype.contains:function(){if(wn)return bn;wn=1;var e=String.prototype.indexOf;return bn=function(t){return e.call(this,t,arguments[1])>-1},bn}()),En}function In(){if(Sn)return Tn.exports;Sn=1;var e=Mn(),t=Dn(),n=$n(),r=function(){if(vn)return gn;vn=1;var e=Rn(),t=Array.prototype.forEach,n=Object.create;return gn=function(r){var o=n(null);return t.call(arguments,function(t){e(t)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(t),o)}),o},gn}(),o=Fn(),i=Tn.exports=function(t,i){var a,s,l,c,u;return arguments.length<2||"string"!=typeof t?(c=i,i=t,t=null):c=arguments[2],e(t)?(a=o.call(t,"c"),s=o.call(t,"e"),l=o.call(t,"w")):(a=l=!0,s=!1),u={value:i,configurable:a,enumerable:s,writable:l},c?n(r(c),u):u};return i.gs=function(i,a,s){var l,c,u,d;return"string"!=typeof i?(u=s,s=a,a=i,i=null):u=arguments[3],e(a)?t(a)?e(s)?t(s)||(u=s,s=void 0):s=void 0:(u=a,a=s=void 0):a=void 0,e(i)?(l=o.call(i,"c"),c=o.call(i,"e")):(l=!0,c=!1),d={get:a,set:s,configurable:l,enumerable:c},u?n(r(u),d):d},Tn.exports}var Bn=(On||(On=1,function(e,t){var n,r,o,i,a,s,l,c=In(),u=kn?Cn:(kn=1,Cn=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}),d=Function.prototype.apply,f=Function.prototype.call,h=Object.create,p=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var r,i;return u(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},i=function(e){var t,n,r,o,i;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;r=o[t];++t)d.call(r,this,i)}else switch(arguments.length){case 1:f.call(o,this);break;case 2:f.call(o,this,arguments[1]);break;case 3:f.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];d.call(o,this,i)}},a={on:n=function(e,t){var n;return u(t),v.call(this,"__ee__")?n=this.__ee__:(n=m.value=h(null),p(this,"__ee__",m),m.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:r,off:o=function(e,t){var n,r,o,i;if(u(t),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(i=0;o=r[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===r.length?n[e]=r[i?0:1]:r.splice(i,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},emit:i},s={on:c(n),once:c(r),off:c(o),emit:c(i)},l=g({},s),e.exports=t=function(e){return null==e?h(l):g(Object(e),s)},t.methods=a}(Nn,Nn.exports)),Nn.exports),jn=jt(Bn);function _n(e){var t=fe.get(e);return null==t&&(t=jn(),fe.set(e,t)),t}var Hn=new WeakMap;function Wn(e,t){var n=Hn.get(e);null==n&&(n=new Set,Hn.set(e,n)),n.add(t)}var Vn=function(e){var t=e;return t.on=function(e,n){var r=_n(t);if(r.on(e,n),"destroyed"===e&&Wn(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),Wn(t,o)}},t.once=function(e,n){_n(t).once(e,n)},t.off=function(e,n){_n(t).off(e,n)},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=_n(t);if(o.emit.apply(o,b([e],y(n),!1)),"destroyed"===e){var i=function(e){return Hn.get(e)||new Set}(t);i.forEach(function(e){return o.off("destroyed",e)}),function(e){Hn.set(e,new Set)}(t)}},t};var Un,zn=function(e){var t=e;return t.setFragmentData=function(e){var n=t.selection;if(n){var r=y(i.Range.edges(n),2),o=r[0],a=r[1],s=i.Editor.void(t,{at:o.path}),l=i.Editor.void(t,{at:a.path});if(!i.Range.isCollapsed(n)||s){var c=Ct.toDOMRange(t,n),u=c.cloneContents(),d=u.childNodes[0];if(u.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(d=e)}),l){var f=y(l,1)[0],h=c.cloneRange(),p=Ct.toDOMNode(t,f);h.setEndAfter(p),u=h.cloneContents()}if(s&&(d=u.querySelector("[data-slate-spacer]")),Array.from(u.querySelectorAll("[data-slate-zero-width]")).forEach(function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":""}),Be(d)){var g=d.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(d),u.appendChild(g),d=g}var v=t.getFragment(),m=JSON.stringify(v),b=window.btoa(encodeURIComponent(m));d.setAttribute("data-slate-fragment",b),e.setData("application/x-slate-fragment",b);var w=u.ownerDocument.createElement("div");return w.appendChild(u),w.setAttribute("hidden","true"),u.ownerDocument.body.appendChild(w),e.setData("text/html",w.innerHTML),e.setData("text/plain",ze(w)),u.ownerDocument.body.removeChild(w),e}}},t.insertData=function(e){var n=e.getData("application/x-slate-fragment");if(n){var r=decodeURIComponent(window.atob(n)),o=JSON.parse(r);t.insertFragment(o)}else{var i=e.getData("text/plain"),a=e.getData("text/html");if(a){var s=t.getConfig().sanitizeHtml;t.dangerouslyInsertHtml(s?s(a):a)}else if(i){if(!/[\r\n]/.test(i))return void t.insertText(i);var l=function(e){return e.replace(/\n\r|\r\n|\r/g,"\n").split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}})}(i);t.insertFragment(l)}}},t},Kn={};function qn(){if(Un)return Kn;Un=1;var e=i,t={isHistory:function(t){return e.isObject(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(0===t.redos.length||e.Operation.isOperationList(t.redos[0].operations))&&(0===t.undos.length||e.Operation.isOperationList(t.undos[0].operations))}},n=new WeakMap,r=new WeakMap,o=new WeakMap,a=new WeakMap,s={isHistoryEditor:function(n){return t.isHistory(n.history)&&e.Editor.isEditor(n)},isMerging:function(e){return o.get(e)},isSplittingOnce:function(e){return a.get(e)},setSplittingOnce:function(e,t){a.set(e,t)},isSaving:function(e){return r.get(e)},redo:function(e){e.redo()},undo:function(e){e.undo()},withMerging:function(e,t){var n=s.isMerging(e);o.set(e,!0),t(),o.set(e,n)},withNewBatch:function(e,t){var n=s.isMerging(e);o.set(e,!0),a.set(e,!0),t(),o.set(e,n),a.delete(e)},withoutMerging:function(e,t){var n=s.isMerging(e);o.set(e,!1),t(),o.set(e,n)},withoutSaving:function(e,t){var n=s.isSaving(e);r.set(e,!1);try{t()}finally{r.set(e,n)}}};function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(t,n){return!(!n||"insert_text"!==t.type||"insert_text"!==n.type||t.offset!==n.offset+n.text.length||!e.Path.equals(t.path,n.path))||!(!n||"remove_text"!==t.type||"remove_text"!==n.type||t.offset+t.text.length!==n.offset||!e.Path.equals(t.path,n.path))},d=function(e,t){return"set_selection"!==e.type};return Kn.HISTORY=n,Kn.History=t,Kn.HistoryEditor=s,Kn.MERGING=o,Kn.SAVING=r,Kn.SPLITTING_ONCE=a,Kn.withHistory=function(t){var n=t,r=n.apply;return n.history={undos:[],redos:[]},n.redo=function(){var t=n.history,r=t.redos;if(r.length>0){var o=r[r.length-1];o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore),s.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var e,t=l(o.operations);try{for(t.s();!(e=t.n()).done;){var r=e.value;n.apply(r)}}catch(e){t.e(e)}finally{t.f()}})}),t.redos.pop(),n.writeHistory("undos",o)}},n.undo=function(){var t=n.history,r=t.undos;if(r.length>0){var o=r[r.length-1];s.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var t,r=l(o.operations.map(e.Operation.inverse).reverse());try{for(r.s();!(t=r.n()).done;){var i=t.value;n.apply(i)}}catch(e){r.e(e)}finally{r.f()}o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore)})}),n.writeHistory("redos",o),t.undos.pop()}},n.apply=function(e){var t=n.operations,o=n.history,i=o.undos,a=i[i.length-1],l=a&&a.operations[a.operations.length-1],c=s.isSaving(n),f=s.isMerging(n);if(null==c&&(c=d(e)),c){if(null==f&&(f=null!=a&&(!!t.includes(l)||u(e,l))),s.isSplittingOnce(n)&&(f=!1,s.setSplittingOnce(n,void 0)),a&&f)a.operations.push(e);else{var h={operations:[e],selectionBefore:n.selection};n.writeHistory("undos",h)}for(;i.length>100;)i.shift();o.redos=[]}r(e)},n.writeHistory=function(e,t){n.history[e].push(t)},n},Kn}var Jn=qn(),Gn=function(e){var t=Jn.withHistory(e);return t.clearHistory=function(){t.history.undos=[],t.history.redos=[]},t};function Yn(e){return e.replace(/\n\r|\r\n|\r|\n/g,"").length}function Xn(e,t){var n,r;if(t<=0)return"";var o=t,i="";try{for(var a=m(e),s=a.next();!s.done;s=a.next()){var l=s.value;if(/\r|\n/.test(l))i+=l;else{if(o<=0)break;i+=l,o-=1}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}var Zn=function(e){var t=e,n=t.insertText,r=t.insertNode,o=t.insertFragment,a=t.dangerouslyInsertHtml;return t.insertText=function(e){if(t.getConfig().maxLength){var r=Ct.getLeftLengthOfMaxLength(t);r<=0||(r<e.length?n(e.slice(0,r)):n(e))}else n(e)},t.insertNode=function(e){if(t.getConfig().maxLength){var n=Ct.getLeftLengthOfMaxLength(t);if(!(n<=0))n<i.Node.string(e).length||r(e)}else r(e)},t.insertFragment=function(e){if(t.getConfig().maxLength){if(e.length>0){var n=e[0];if(Ct.getLeftLengthOfMaxLength(t)<i.Node.string(n).length)return;o([n]);for(var r=1;r<e.length;r+=1)t.insertNode(e[r])}}else o(e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e)if(t.getConfig().maxLength){var r=Ct.getLeftLengthOfMaxLength(t);if(!(r<=0)){var o=function(e,t){if(t<=0)return"";var n=document.createElement("div");n.innerHTML=e;var r=function(e){e.forEach(function(e){return e.remove()})},o=function(e){for(var n=Array.from(e.childNodes),i=0;i<n.length;i+=1){var a=n[i];if(Be(a)){var s=a.textContent||"",l=Yn(s);if(l<=t){t-=l;continue}return a.textContent=Xn(s,t),t=0,r(n.slice(i+1)),!1}if(Fe(a)){if(me.has(a.nodeName.toLowerCase())){a.remove();continue}if(!o(a))return r(n.slice(i+1)),!1}else a.remove()}return t>0};return o(n),n.innerHTML}(e,r);o&&a(o,n)}}else a(e,n)},t};function Qn(e){return e<0?0:e}function er(e){var t=Ct.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return{top:o.top,left:o.left,width:n,height:r}}function tr(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=er(e);if(null==r)return t;var o=r.top,i=r.left,a=r.width,s=r.height,l=Ct.toDOMRange(e,n).getClientRects(),c=l?l[0]:null;if(null==c)return t;var u={},d=c.top-o,f=c.left-i;if(f>a/2){var h=Qn(a-f);u.right="".concat(h+5,"px")}else{var p=Qn(f);u.left="".concat(p+5,"px")}if(d>s/2){var g=Qn(s-d);u.bottom="".concat(g+5,"px")}else{var v=l[l.length-1],m=v.top-o+v.height;m<0&&(m=0),u.top="".concat(m+5,"px")}return u}function nr(e,t,n){void 0===n&&(n="modal");var r={top:"0",left:"0"};if(null==e.selection)return r;var o=i.Element.isElement(t)&&e.isVoid(t),a=i.Element.isElement(t)&&e.isInline(t),s=se.get(t);if(null==s)return r;var l=s.getBoundingClientRect(),c=l.top,u=l.left,d=l.height,f=l.width;if(o){var h=Ke(s);if(null!=h){var p=h.getBoundingClientRect();c=p.top,d=p.height}}var g=er(e);if(null==g)return r;var v=g.top,m=g.left,y=g.width,b=g.height,w={},E=c-v,x=u-m;if("bar"===n){if(w.left="".concat(Qn(x),"px"),E>40){var S=Qn(b-E);w.bottom="".concat(S+5,"px")}else w.top="".concat(E+d+5,"px");return w}if("modal"===n){if(o)if(a)if(x>(y-f)/2){var C=Qn(y-x);w.right="".concat(C+5,"px")}else{var k=Qn(x+f);w.left="".concat(k+5,"px")}else w.left="20px";else w.left="".concat(Qn(x),"px");if(o)(O=E)<0&&(O=0),w.top="".concat(O,"px");else if(E>(b-d)/2){S=Qn(b-E);w.bottom="".concat(S+5,"px")}else{var O;(O=E+d)<0&&(O=0),w.top="".concat(O+5,"px")}return w}throw new Error("type '".concat(n,"' is invalid"))}function rr(e,t){w(function(){var n=er(e);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,l=t.offset(),c=l.top,u=l.left,d=t.width(),f=t.height(),h=c-o,p=u-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=h+f-s)>0){var v=t.css("top"),m=parseInt(v.toString(),10)-r;m<0&&(m=0),t.css("top","".concat(m,"px"))}if(g.indexOf("bottom")>=0&&c<0){var y=t.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(c);t.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=p+d-a)>0){var w=t.css("left"),E=parseInt(w.toString(),10)-r;E<0&&(E=0),t.css("left","".concat(E,"px"))}if(g.indexOf("right")>=0&&p<0){var x=t.css("right"),S=parseInt(x.toString(),10)-Math.abs(p);t.css("right","".concat(S,"px"))}}})}var or=function(e){var t=e,n=t.select,r=t.deselect,o=t.move;return t.select=function(e){n(e)},t.deselect=function(){var e=t.selection,n=Ct.findDocumentOrShadowRoot(t).getSelection();n&&n.rangeCount>0&&Ct.hasDOMNode(t,n.anchorNode)&&Ct.hasDOMNode(t,n.focusNode)&&n.removeAllRanges(),e&&r()},t.move=function(e,t){void 0===t&&(t=!1),"number"==typeof e?e&&(e<0||o({distance:e,unit:"character",reverse:t})):o(e)},t.moveReverse=function(e){t.move(e,!0)},t.restoreSelection=function(){var e=de.get(t);null!=e&&(t.focus(),n(e))},t.getSelectionPosition=function(){return tr(t)},t.getNodePosition=function(e){return nr(t,e)},t.isSelectedAll=function(){var e=t.selection;if(null==e)return!1;var n=y(i.Range.edges(e),2),r=n[0],o=n[1],a=y(i.Editor.edges(t,[]),2),s=a[0],l=a[1];return!(!i.Point.equals(r,s)||!i.Point.equals(o,l))},t.selectAll=function(){var e=i.Editor.start(t,[]),r=i.Editor.end(t,[]);n({anchor:e,focus:r})},t};const ir=e=>"string"==typeof e,ar=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},sr=e=>null==e?"":""+e,lr=/###/g,cr=e=>e&&e.indexOf("###")>-1?e.replace(lr,"."):e,ur=e=>!e||ir(e),dr=(e,t,n)=>{const r=ir(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(ur(e))return{};const t=cr(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return ur(e)?{}:{obj:e,k:cr(r[o])}},fr=(e,t,n)=>{const{obj:r,k:o}=dr(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let i=t[t.length-1],a=t.slice(0,t.length-1),s=dr(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),s=dr(e,a,Object),s&&s.obj&&void 0!==s.obj[`${s.k}.${i}`]&&(s.obj=void 0);s.obj[`${s.k}.${i}`]=n},hr=(e,t)=>{const{obj:n,k:r}=dr(e,t);if(n)return n[r]},pr=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?ir(e[r])||e[r]instanceof String||ir(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):pr(e[r],t[r],n):e[r]=t[r]);return e},gr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var vr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const mr=e=>ir(e)?e.replace(/[&<>"'\/]/g,e=>vr[e]):e;const yr=[" ",",","?","!",";"],br=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),wr=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let o=e;for(let e=0;e<r.length;){if(!o||"object"!=typeof o)return;let t,i="";for(let a=e;a<r.length;++a)if(a!==e&&(i+=n),i+=r[a],t=o[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<r.length-1)continue;e+=a-e+1;break}o=t}return o},Er=e=>e&&e.replace("_","-"),xr={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Sr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||xr,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(ir(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Sr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new Sr(this.logger,e)}}var Cr=new Sr;class kr{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(e=>{let[t,r]=e;for(let e=0;e<r;e++)t(...n)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(t=>{let[r,o]=t;for(let t=0;t<o;t++)r.apply(r,[e,...n])})}}}class Or extends kr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],n&&(Array.isArray(n)?a.push(...n):ir(n)&&o?a.push(...n.split(o)):a.push(n)));const s=hr(this.data,a);return!s&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),!s&&i&&ir(n)?wr(this.data&&this.data[e]&&this.data[e][t],n,o):s}addResource(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."),r=t,t=a[1]),this.addNamespaces(t),fr(this.data,a,r),o.silent||this.emit("added",e,t,n,r)}addResources(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const r in n)(ir(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),r=n,n=t,t=a[1]),this.addNamespaces(t);let s=hr(this.data,a)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?pr(s,n,o):s={...s,...n},fr(this.data,a,s),i.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var Nr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(e=>{this.processors[e]&&(t=this.processors[e].process(t,n,r,o))}),t}};const Tr={};class Mr extends kr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=Cr.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const n=this.resolve(e,t);return n&&void 0!==n.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=yr.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===r.length)return!0;const o=br.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!o.test(e);if(!i){const t=e.indexOf(n);t>0&&!o.test(e.substring(0,t))&&(i=!0)}return i})(e,n,r));if(i&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:ir(o)?[o]:o};const i=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),e=i.join(r)}return{key:e,namespaces:ir(o)?[o]:o}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const r=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:i,namespaces:a}=this.extractFromKey(e[e.length-1],t),s=a[a.length-1],l=t.lng||this.language,c=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(c){const e=t.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:`${s}${e}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:i}const u=this.resolve(e,t);let d=u&&u.res;const f=u&&u.usedKey||i,h=u&&u.exactUsedKey||i,p=Object.prototype.toString.apply(d),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!ir(d)&&"boolean"!=typeof d&&"number"!=typeof d;if(!(v&&d&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(p)<0)||ir(g)&&Array.isArray(d))if(v&&ir(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,e,t,n));else{let r=!1,a=!1;const c=void 0!==t.count&&!ir(t.count),f=Mr.hasDefaultValue(t),h=c?this.pluralResolver.getSuffix(l,t.count,t):"",p=t.ordinal&&c?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",g=c&&!t.ordinal&&0===t.count&&this.pluralResolver.shouldUseIntlApi(),v=g&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${h}`]||t[`defaultValue${p}`]||t.defaultValue;!this.isValidLookup(d)&&f&&(r=!0,d=v),this.isValidLookup(d)||(a=!0,d=i);const m=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:d,y=f&&v!==d&&this.options.updateMissing;if(a||r||y){if(this.logger.log(y?"updateKey":"missingKey",l,s,i,y?v:d),o){const e=this.resolve(i,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const r=(e,n,r)=>{const o=f&&r!==d?r:m;this.options.missingKeyHandler?this.options.missingKeyHandler(e,s,n,o,y,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,s,n,o,y,t),this.emit("missingKey",e,s,n,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&c?e.forEach(e=>{const n=this.pluralResolver.getSuffixes(e,t);g&&t[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{r([e],i+n,t[`defaultValue${n}`]||v)})}):r(e,i,v))}d=this.extendTranslation(d,e,t,u,n),a&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${s}:${i}`),(a||r)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${i}`:i,r?d:void 0):this.options.parseMissingKeyHandler(d))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,d,{...t,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(u.res=e,u.usedParams=this.getUsedParamsDetails(t),u):e}if(o){const e=Array.isArray(d),n=e?[]:{},r=e?h:f;for(const e in d)if(Object.prototype.hasOwnProperty.call(d,e)){const i=`${r}${o}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:a}),n[e]===i&&(n[e]=d[e])}d=n}}return r?(u.res=d,u.usedParams=this.getUsedParamsDetails(t),u):d}extendTranslation(e,t,n,r,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const a=ir(e)&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(a){const t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let l=n.replace&&!ir(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||r.usedLng,n),a){const t=e.match(this.interpolator.nestingRegexp);s<(t&&t.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return o&&o[0]===r[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${r[0]} in key: ${t[0]}`),null):i.translate(...r,t)},n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,s=ir(a)?[a]:a;return null!=e&&s&&s.length&&!1!==n.applyPostProcessor&&(e=Nr.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t,n,r,o,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ir(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;const s=this.extractFromKey(e,a),l=s.key;n=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==a.count&&!ir(a.count),d=u&&!a.ordinal&&0===a.count&&this.pluralResolver.shouldUseIntlApi(),f=void 0!==a.context&&(ir(a.context)||"number"==typeof a.context)&&""!==a.context,h=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);c.forEach(e=>{this.isValidLookup(t)||(i=e,!Tr[`${h[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(Tr[`${h[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${h.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach(n=>{if(this.isValidLookup(t))return;o=n;const i=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,a);else{let e;u&&(e=this.pluralResolver.getSuffix(n,a.count,a));const t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(i.push(l+e),a.ordinal&&0===e.indexOf(r)&&i.push(l+e.replace(r,this.options.pluralSeparator)),d&&i.push(l+t)),f){const n=`${l}${this.options.contextSeparator}${a.context}`;i.push(n),u&&(i.push(n+e),a.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),d&&i.push(n+t))}}let s;for(;s=i.pop();)this.isValidLookup(t)||(r=s,t=this.getResource(n,e,s,a))}))})}),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!ir(e.replace);let r=n?e.replace:e;if(n&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}const Lr=e=>e.charAt(0).toUpperCase()+e.slice(1);class Dr{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Cr.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Er(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=Er(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(ir(e)&&e.indexOf("-")>-1){if("undefined"!=typeof Intl&&void 0!==Intl.getCanonicalLocales)try{let t=Intl.getCanonicalLocales(e)[0];if(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)return t}catch(e){}const t=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map(e=>e.toLowerCase()):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Lr(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Lr(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Lr(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),ir(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return ir(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):ir(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&o(this.formatLanguageCode(e))}),r}}let Rr=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Pr={1:e=>Number(e>1),2:e=>Number(1!=e),3:e=>0,4:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),5:e=>Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5),6:e=>Number(1==e?0:e>=2&&e<=4?1:2),7:e=>Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),8:e=>Number(1==e?0:2==e?1:8!=e&&11!=e?2:3),9:e=>Number(e>=2),10:e=>Number(1==e?0:2==e?1:e<7?2:e<11?3:4),11:e=>Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3),12:e=>Number(e%10!=1||e%100==11),13:e=>Number(0!==e),14:e=>Number(1==e?0:2==e?1:3==e?2:3),15:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2),16:e=>Number(e%10==1&&e%100!=11?0:0!==e?1:2),17:e=>Number(1==e||e%10==1&&e%100!=11?0:1),18:e=>Number(0==e?0:1==e?1:2),19:e=>Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3),20:e=>Number(1==e?0:0==e||e%100>0&&e%100<20?1:2),21:e=>Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0),22:e=>Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)};const Ar=["v1","v2","v3"],$r=["v4"],Fr={zero:0,one:1,two:2,few:3,many:4,other:5};class Ir{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Cr.create("pluralResolver"),this.options.compatibilityJSON&&!$r.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(()=>{const e={};return Rr.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Pr[t.fc]}})}),e})(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi()){const n=Er("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:r})}catch(n){if(!e.match(/-|_/))return;const r=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(r,t)}return this.pluralRulesCache[o]=i,i}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}getPluralFormsOfKey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((e,t)=>Fr[e]-Fr[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):n.numbers.map(n=>this.getSuffix(e,n,t)):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:this.getSuffixRetroCompatible(r,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let r=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===r?r="plural":1===r&&(r=""));const o=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?`_plural_${r.toString()}`:o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Ar.includes(this.options.compatibilityJSON)}}const Br=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=((e,t,n)=>{const r=hr(e,n);return void 0!==r?r:hr(t,n)})(e,t,n);return!i&&o&&ir(n)&&(i=wr(e,n,r),void 0===i&&(i=wr(t,n,r))),i},jr=e=>e.replace(/\$/g,"$$$$");class _r{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Cr.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:h,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=e.interpolation;this.escape=void 0!==t?t:mr,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?gr(o):i||"{{",this.suffix=a?gr(a):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?gr(d):f||gr("$t("),this.nestingSuffix=h?gr(h):p||gr(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=v||1e3,this.alwaysFormat=void 0!==m&&m,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e&&e.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let o,i,a;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const o=Br(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...t,interpolationkey:e}):o}const o=e.split(this.formatSeparator),i=o.shift().trim(),a=o.join(this.formatSeparator).trim();return this.format(Br(t,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,n,{...r,...t,interpolationkey:i})};this.resetRegExp();const c=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>jr(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?jr(this.escape(e)):jr(e)}].forEach(t=>{for(a=0;o=t.regex.exec(e);){const n=o[1].trim();if(i=l(n),void 0===i)if("function"==typeof c){const t=c(e,o,r);i=ir(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(u){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else ir(i)||this.useRawValueToEscape||(i=sr(i));const s=t.safeValue(i);if(e=e.replace(o[0],s),u?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=(e,t)=>{const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const r=e.split(new RegExp(`${n}[ ]*{`));let i=`{${r[1]}`;e=r[0],i=this.interpolate(i,o);const a=i.match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let s=[];o={...i},o=o.replace&&!ir(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map(e=>e.trim());n[1]=e.shift(),s=e,l=!0}if(r=t(a.call(this,n[1].trim(),o),o),r&&n[0]===e&&!ir(r))return r;ir(r)||(r=sr(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),l&&(r=s.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:n[1].trim()}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}const Hr=e=>{const t={};return(n,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const a=r+JSON.stringify(i);let s=t[a];return s||(s=e(Er(r),o),t[a]=s),s(n)}};class Wr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Cr.create("formatter"),this.options=e,this.formats={number:Hr((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:Hr((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:Hr((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:Hr((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:Hr((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Hr(t)}format(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(e=>e.indexOf(")")>-1)){const e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}const i=o.reduce((e,t)=>{const{formatName:o,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();n[i]||(n[i]=o),"false"===o&&(n[i]=!1),"true"===o&&(n[i]=!0),isNaN(o)||(n[i]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[o]){let t=e;try{const a=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},s=a.locale||a.lng||r.locale||r.lng||n;t=this.formats[o](e,s,{...i,...r,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e);return i}}class Vr extends kr{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Cr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,r.backend,r)}queueLoad(e,t,n,r){const o={},i={},a={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const a=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,r=!1,void 0===i[a]&&(i[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===s[t]&&(s[t]=!0)))}),r||(a[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){const r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),!t&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const a={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=dr(e,t,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{a[e]||(a[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:i});this.readingCalls++;const a=(a,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*o,i)},o):i(a,s)},s=this.backend[n].bind(this.backend);if(2!==s.length)return s(e,t,a);try{const n=s(e,t);n&&"function"==typeof n.then?n.then(e=>a(null,e)).catch(a):a(null,n)}catch(e){a(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();ir(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ir(t)&&(t=[t]);const o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,i)=>{n&&this.logger.warn(`${t}loading namespace ${o} for language ${r} failed`,n),!n&&i&&this.logger.log(`${t}loaded namespace ${o} for language ${r}`,i),this.loaded(e,n,i)})}saveMissing(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const s={...i,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;o=5===l.length?l(e,t,n,r,s):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>a(null,e)).catch(a):a(null,o)}catch(e){a(e)}else l(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}const Ur=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),ir(e[1])&&(t.defaultValue=e[1]),ir(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),zr=e=>(ir(e.ns)&&(e.ns=[e.ns]),ir(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ir(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Kr=()=>{};class qr extends kr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=zr(e),this.services={},this.logger=Cr,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&(ir(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Ur();this.options={...r,...this.options,...zr(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?Cr.init(o(this.modules.logger),this.options):Cr.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Wr);const n=new Dr(this.options);this.store=new Or(this.options.resources,this.options);const i=this.services;i.logger=Cr,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Ir(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=o(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new _r(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Vr(o(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.languageDetector&&(i.languageDetector=o(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=o(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Mr(this.services,this.options),this.translator.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Kr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(t=>{this[t]=function(){return e.store[t](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(t=>{this[t]=function(){return e.store[t](...arguments),e}});const i=ar(),a=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),n(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?a():setTimeout(a,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kr;const n=ir(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],r=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)r(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>r(e))}this.options.preload&&this.options.preload.forEach(e=>r(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)})}else t(null)}reloadResources(e,t,n){const r=ar();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=Kr),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Nr.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const r=ar();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(e,i)=>{i?(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,r.resolve(function(){return n.t(...arguments)}),t&&t(e,function(){return n.t(...arguments)})},a=t=>{e||t||!this.services.languageDetector||(t=[]);const n=ir(t)?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||o(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,e=>{i(e,n)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),r}getFixedT(e,t,n){var r=this;const o=function(e,t){let i;if("object"!=typeof t){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];i=r.options.overloadTranslationOptionHandler([e,t].concat(s))}else i={...t};i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);const c=r.options.keySeparator||".";let u;return u=i.keyPrefix&&Array.isArray(e)?e.map(e=>`${i.keyPrefix}${c}${e}`):i.keyPrefix?`${i.keyPrefix}${c}${e}`:e,r.t(u,i)};return ir(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,e)||r&&!i(o,e)))}loadNamespaces(e,t){const n=ar();return this.options.ns?(ir(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=ar();ir(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new Dr(Ur());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new qr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kr;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new qr(r);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));return["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n&&(o.store=new Or(this.store.data,r),o.services.resourceStore=o.store),o.translator=new Mr(o.services,r),o.translator.on("*",function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit(e,...n)}),o.init(r,t),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Jr=qr.createInstance();Jr.createInstance=qr.createInstance,Jr.createInstance,Jr.dir,Jr.init,Jr.loadResources,Jr.reloadResources,Jr.use,Jr.changeLanguage,Jr.getFixedT,Jr.t,Jr.exists,Jr.setDefaultNamespace,Jr.hasLoadedNamespace,Jr.loadNamespaces,Jr.loadLanguages;var Gr="translation";function Yr(e){return Jr.on("languageChanged",e),function(){return Jr.off("languageChanged",e)}}Jr.init({lng:"zh-CN",resources:{}});var Xr=Jr.t.bind(Jr);function Zr(e){if(e.removeAttr){e.removeAttr("width"),e.removeAttr("height"),e.removeAttr("fill"),e.removeAttr("class"),e.removeAttr("t"),e.removeAttr("p-id");var t=e.children();t.length&&Zr(t)}}function Qr(){return s('<svg viewBox="0 0 1024 1024"><path d="M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z"></path></svg>')}function eo(){return s('<div class="w-e-bar-divider"></div>')}var to=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e)}return e.prototype.record=function(e){var t=J.get(e);null==t&&(t=new Set,J.set(e,t)),t.add(this),G.set(this,e)},e.prototype.renderContent=function(e){var t=this.$elem;t.empty(),t.append(e);var n=this.genSelfElem();n&&t.append(n)},e.prototype.appendTo=function(e){var t=this.$elem;e.append(t)},e.prototype.show=function(){if(!this.isShow){this.showTime=Date.now(),this.$elem.show(),this.isShow=!0;var e=G.get(this);e&&e.emit(B,this)}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=G.get(this);e&&e.emit(j)}},e}(),no=function(e){function t(){var t=e.apply(this,b([],y(arguments),!1))||this;return t.type="dropPanel",t.$elem=s('<div class="w-e-drop-panel"></div>'),t}return g(t,e),t.prototype.genSelfElem=function(){return null},t}(to);function ro(e,t,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),t){if(r){var i=gt?"cmd":"ctrl";r=r.replace("mod",i)}if(o)r&&(e.attr("data-tooltip",r),e.addClass("w-e-menu-tooltip-v5"),e.addClass("tooltip-right"));else{var a=r?"".concat(n,"\n").concat(r):n;e.attr("data-tooltip",a),e.addClass("w-e-menu-tooltip-v5")}}}var oo=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=s('<div class="w-e-bar-item"></div>'),this.$button=s('<button type="button"></button>'),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'button'"));var a=t.title,l=t.hotkey,c=void 0===l?"":l,u=t.iconSvg,d=void 0===u?"":u,f=this.$button;if(d){var h=s(d);Zr(h),f.append(h)}else f.text(a);ro(f,d,a,c,n),n&&d&&f.append(s('<span class="title">'.concat(a,"</span>"))),i&&f.css("width","".concat(i,"px")),f.attr("data-menu-key",e),this.$elem.append(f),w(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(t){t.preventDefault(),po(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick())})},e.prototype.exec=function(){var e=po(this),t=this.menu,n=t.getValue(e);t.exec(e,n),this.changeMenuState()},e.prototype.setActive=function(){var e=po(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n)},e.prototype.setDisabled=function(){var e=po(this),t=this.$button,n=this.menu.isDisabled(e);(null==e.selection||e.isDisabled())&&(n=!0),this.menu.alwaysEnable&&(n=!1);var r="disabled";n?t.addClass(r):t.removeClass(r),this.disabled=n},e.prototype.setIcon=function(){var e=po(this),t=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(e);if(n){t.find("svg").remove();var r=s(n);Zr(r),t.append(r)}}},e.prototype.setTooltip=function(){var e=po(this),t=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(e),r=this.menu.iconSvg;n&&r&&ro(t,r,n)}},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},e}(),io=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;if(o.dropPanel=null,o.menu=n,n.showDropPanel){var i=Qr();o.$button.append(i)}return o}return g(t,e),t.prototype.onButtonClick=function(){this.menu.showDropPanel&&this.handleDropPanel()},t.prototype.handleDropPanel=function(){var e=this.menu;if(null!=e.getPanelContentElem){var t=po(this);if(null==this.dropPanel){var n=new no(t),r=e.getPanelContentElem(t);n.renderContent(r),n.appendTo(this.$elem),n.show(),this.dropPanel=n}else{var o=this.dropPanel;if(o.isShow)o.hide();else{r=e.getPanelContentElem(t);o.renderContent(r),o.show()}}var i=this.dropPanel;if(i.isShow){var a=this.$elem,s=a.offset().left,l=a.parents(".w-e-bar");s-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"})}}},t}(oo),ao=function(){function e(e){this.$elem=s('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=s('<div class="w-e-bar-item-menus-container"></div>'),this.$button=s('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var a=s(n);Zr(a),i.append(a)}else i.text(r);i.attr("data-menu-key",t);var l=Qr();i.append(l),o.append(i);var c=this.$container;o.append(c);var u=this.createObserver();this.observe(u)}return e.prototype.appendBarItem=function(e){var t=e.$elem;this.$container.append(t)},e.prototype.observe=function(e){var t=this.$container;e.observe(t[0],{childList:!0,subtree:!0,attributes:!0})},e.prototype.createObserver=function(){var e=this,t=this.$container,n=this.$button,r=new MutationObserver(function(){var o=t.find("button"),i=o.length;if(0!==i){var a=0;o.each(function(e){s(e).hasClass("disabled")&&(a+=1)}),r.disconnect(),a===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r)}});return r},e}(),so=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=s('<div class="w-e-modal"></div>'),r.width=0,n&&(r.width=n);var o=r.$elem;return o.on("click",function(e){return e.stopPropagation()}),o.on("keyup",function(e){"Escape"===e.code&&(r.hide(),t.restoreSelection())}),r}return g(t,e),t.prototype.genSelfElem=function(){var e=this,t=s('<span class="btn-close">'.concat('<svg viewBox="0 0 1024 1024"><path d="M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z"></path></svg>',"</span>")),n=G.get(this);return t.on("click",function(){e.hide(),null==n||n.restoreSelection()}),t},t.prototype.setStyle=function(e){var t=this.width,n=this.$elem;n.attr("style",""),t&&n.css("width","".concat(t,"px")),n.css(e)},t}(to);var lo=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=s("body"),o.modal=null,o.menu=n,o}return g(t,e),t.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal()},t.prototype.getPosition=function(){var e=po(this),t=this.menu.getModalPositionNode(e);return i.Element.isElement(t)?nr(e,t,"modal"):tr(e)},t.prototype.handleModal=function(){var e=po(this),t=this.menu;if(null==this.modal){var n=new so(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n}else{(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1)}},t.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=po(this),r=this.menu;if(null!=r.getModalContentElem){var o=Ct.getTextarea(n),i=Ct.getToolbar(n),a=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,s=r.getModalContentElem(n);if(e.renderContent(s),a)e.setStyle({left:"0",right:"0"});else{var l=this.getPosition();e.setStyle(l)}t&&(a?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),a||rr(n,e.$elem),setTimeout(function(){n.blur()})}},t}(oo);var co=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=s('<div class="w-e-select-list"></div>'),n&&r.$elem.css("width","".concat(n,"px")),r.$elem.on("click",function(e){e.stopPropagation()}),r}return g(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=s("<ul></ul>");e.forEach(function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,a=s('<li data-value="'.concat(t,'"></li>'));if(i&&a.css(i),o){var l=s('<svg viewBox="0 0 1446 1024"><path d="M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z"></path></svg>');a.append(l),a.addClass("selected")}a.append(s('<span data-value="'.concat(t,'">').concat(r,"</span>"))),a.attr("title",r),n.append(a)}),t.append(n)},t.prototype.genSelfElem=function(){return null},t}(to);var uo=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=s('<div class="w-e-bar-item"></div>'),this.$button=s('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,a=t.width,l=t.iconSvg,c=void 0===l?"":l,u=t.hotkey,d=void 0===u?"":u;if("select"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'select'"));var f=this.$button;a&&f.css("width","".concat(a,"px")),f.attr("data-menu-key",e),ro(f,c,i,d,n),this.$elem.append(f),this.menu=t,w(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",function(t){t.preventDefault(),po(e).hidePanelOrModal(),e.trigger()})},e.prototype.trigger=function(){var e=this,t=po(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new co(t,n.selectPanelWidth);var r=this.selectList,o=n.getOptions(t);r.renderList(o),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",function(t){var n=t.target;if(null!=n){t.preventDefault();var r=s(n).attr("data-value");e.onChange(r)}})}else{if((r=this.selectList).isShow)r.hide();else{o=n.getOptions(t);r.renderList(o),r.show()}}}},e.prototype.onChange=function(e){var t=po(this),n=this.menu;null!=n.exec&&n.exec(t,e)},e.prototype.setSelectedValue=function(){var e=po(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o+=1){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=Qr();o.empty(),o.text(r),o.append(i)},e.prototype.setDisabled=function(){var e=po(this),t=this.menu.isDisabled(e),n=this.$button;(null==e.selection||e.isDisabled())&&(t=!0);var r="disabled";t?n.addClass(r):n.removeClass(r),this.disabled=t},e.prototype.changeMenuState=function(){this.setSelectedValue(),this.setDisabled()},e}(),fo=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return g(t,e),t.prototype.onButtonClick=function(){},t}(oo),ho=new WeakMap;function po(e){var t=q.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function go(e,t,n){void 0===n&&(n=!1);var r=ho.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,a=t.showModal;r=i?new io(e,t,n):a?new lo(e,t,n):new fo(e,t,n)}if("select"===o&&(r=new uo(e,t,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(t)));return ho.set(t,r),r}function vo(e,t){var n=e.selection;return null!=n&&(!i.Range.isCollapsed(n)&&(!Ct.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})&&!!i.Text.isText(t)))}var mo=function(){function e(){var e=this;this.$elem=s('<div class="w-e-bar w-e-bar-hidden w-e-hover-bar"></div>'),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.lngListen=function(){},this.changeHoverbarState=c(function(){var t=e.isShow,n=e.getSelectedNodeAndMenuKeys()||{},r=n.node,o=void 0===r?null:r,a=n.menuKeys,s=void 0===a?[]:a,l=e.getEditorInstance();if(null!=o&&e.changeItemsState(),o&&i.Element.isElement(o)&&t){var c=e.isSamePath(o,e.prevSelectedNode);if(!i.Editor.isBlock(l,o)&&c)return}e.hideAndClean(),null!=o&&(e.registerItems(s),e.setPosition(o),e.show()),e.prevSelectedNode=o},200),w(function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),Ct.getTextarea(t).$textAreaContainer.append(n),t.on(A,e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on($,r),t.on(F,r),t.on(I,r)}),this.lngListen=Yr(function(){e.menus={},e.hideAndClean(),e.getEditorInstance().deselect()})}return e.prototype.getMenus=function(){return this.menus},e.prototype.hideAndClean=function(){var e=this.$elem;e.removeClass("w-e-bar-show").addClass("w-e-bar-hidden"),this.hoverbarItems=[],e.empty(),this.isShow=!1},e.prototype.checkPositionBottom=function(){var e=this.$elem,t=!1,n="undefined"!=typeof window?window.innerHeight:null;n&&n>=360&&(n-e[0].getBoundingClientRect().bottom<360&&(t=!0));t?e.addClass("w-e-bar-bottom"):e.removeClass("w-e-bar-bottom")},e.prototype.show=function(){this.$elem.removeClass("w-e-bar-hidden").addClass("w-e-bar-show"),this.isShow=!0,this.checkPositionBottom()},e.prototype.changeItemsState=function(){var e=this;w(function(){e.hoverbarItems.forEach(function(e){e.changeMenuState()})})},e.prototype.registerItems=function(e){var t=this,n=this.$elem;e.forEach(function(e){if("|"!==e)t.registerSingleItem(e);else{var r=eo();n.append(r)}})},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=_[e];if(null==o)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof o)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));r=o(),n[e]=r}var i=t.getMenuConfig(e);i&&void 0!==i.iconSvg&&(r.iconSvg=i.iconSvg);var a=go(e,r);this.hoverbarItems.push(a),q.set(a,t),this.$elem.append(a.$elem)},e.prototype.setPosition=function(e){var t=this.getEditorInstance(),n=this.$elem;if(n.attr("style",""),i.Element.isElement(e)){var r=nr(t,e,"bar");return n.css(r),void rr(t,n)}if(i.Text.isText(e)){r=tr(t);return n.css(r),void rr(t,n)}throw new Error("hoverbar.setPosition error, current selected node is not elem nor text")},e.prototype.getSelectedNodeAndMenuKeys=function(){var e=this.getEditorInstance();if(null==e.selection)return null;var t=this.getHoverbarKeysConf(),n=null,r=[],o=function(o){var a=t[o],s=a.match,l=a.menuKeys,c=void 0===l?[]:l,u=s||function(e,t){return Ct.checkNodeType(t,o)},d=s?null:Ct.getSelectedNodeByType(e,o),f=y(d?[[d]]:i.Editor.nodes(e,{match:function(t){return u(e,t)},universal:!0}),1),h=f[0];if(null!=h)return n=h[0],r=c,"break"};for(var a in t){if("break"===o(a))break}return null==n||0===r.length?null:{node:n,menuKeys:r}},e.prototype.getEditorInstance=function(){var e=z.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.getHoverbarKeysConf=function(){var e=this.getEditorInstance().getConfig().hoverbarKeys,t=void 0===e?{}:e,n=t.text;return n&&null==n.match&&(n.match=vo),t},e.prototype.isSamePath=function(e,t){if(null==e||null==t)return!1;var n=Ct.findPath(null,e),r=Ct.findPath(null,t);return i.Path.equals(n,r)},e.prototype.destroy=function(){var e;this.changeHoverbarState.cancel(),this.$elem.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null},e}();function yo(e,t){return Ae(t)&&Ct.hasDOMNode(e,t,{editable:!0})}function bo(e,t){return Ae(t)&&Ct.hasDOMNode(e,t)}function wo(e,t){if(yo(e,t))return!0;if(!bo(e,t))return!1;var n=null;return Fe(t)?n=t:Be(t)&&(n=t.parentElement),!!(null==n?void 0:n.closest("[data-w-e-reserve]"))||function(e,t){if(e.getConfig().readOnly)return!1;var n=bo(e,t)&&Ct.toSlateNode(e,t);return!!n&&i.Element.isElement(n)&&i.Editor.isVoid(e,n)}(e,t)}const Eo=e=>"object"==typeof e&&null!=e&&1===e.nodeType,xo=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,So=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return xo(n.overflowY,t)||xo(n.overflowX,t)||(e=>{const t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},Co=(e,t,n,r,o,i,a,s)=>i<e&&a>t||i>e&&a<t?0:i<=e&&s<=n||a>=t&&s>=n?i-e-r:a>t&&s<n||i<e&&s>n?a-t+o:0,ko=e=>{const t=e.parentElement;return null==t?e.getRootNode().host||null:t},Oo=(e,t)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:a,block:s,inline:l,boundary:c,skipOverflowHiddenElements:u}=t,d="function"==typeof c?c:e=>e!==c;if(!Eo(e))throw new TypeError("Invalid target");const f=document.scrollingElement||document.documentElement,h=[];let p=e;for(;Eo(p)&&d(p);){if(p=ko(p),p===f){h.push(p);break}null!=p&&p===document.body&&So(p)&&!So(document.documentElement)||null!=p&&So(p,u)&&h.push(p)}const g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,v=null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:innerHeight,{scrollX:m,scrollY:y}=window,{height:b,width:w,top:E,right:x,bottom:S,left:C}=e.getBoundingClientRect(),{top:k,right:O,bottom:N,left:T}=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);let M="start"===s||"nearest"===s?E-k:"end"===s?S+N:E+b/2-k+N,L="center"===l?C+w/2-T+O:"end"===l?x+O:C-T;const D=[];for(let e=0;e<h.length;e++){const t=h[e],{height:n,width:r,top:o,right:i,bottom:c,left:u}=t.getBoundingClientRect();if("if-needed"===a&&E>=0&&C>=0&&S<=v&&x<=g&&(t===f&&!So(t)||E>=o&&S<=c&&C>=u&&x<=i))return D;const d=getComputedStyle(t),p=parseInt(d.borderLeftWidth,10),k=parseInt(d.borderTopWidth,10),O=parseInt(d.borderRightWidth,10),N=parseInt(d.borderBottomWidth,10);let T=0,R=0;const P="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-O:0,A="offsetHeight"in t?t.offsetHeight-t.clientHeight-k-N:0,$="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,F="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(f===t)T="start"===s?M:"end"===s?M-v:"nearest"===s?Co(y,y+v,v,k,N,y+M,y+M+b,b):M-v/2,R="start"===l?L:"center"===l?L-g/2:"end"===l?L-g:Co(m,m+g,g,p,O,m+L,m+L+w,w),T=Math.max(0,T+y),R=Math.max(0,R+m);else{T="start"===s?M-o-k:"end"===s?M-c+N+A:"nearest"===s?Co(o,c,n,k,N+A,M,M+b,b):M-(o+n/2)+A/2,R="start"===l?L-u-p:"center"===l?L-(u+r/2)+P/2:"end"===l?L-i+O+P:Co(u,i,r,p,O+P,L,L+w,w);const{scrollLeft:e,scrollTop:a}=t;T=0===F?0:Math.max(0,Math.min(a+T/F,t.scrollHeight-n/F+A)),R=0===$?0:Math.max(0,Math.min(e+R/$,t.scrollWidth-r/$+P)),M+=a-T,L+=e-R}D.push({el:t,top:T,left:R})}return D};function No(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;const n=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if((e=>"object"==typeof e&&"function"==typeof e.behavior)(t))return t.behavior(Oo(e,t));const r="boolean"==typeof t||null==t?void 0:t.behavior;for(const{el:o,top:i,left:a}of Oo(e,(e=>!1===e?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&0!==Object.keys(e).length)(e)?e:{block:"start",inline:"nearest"})(t))){const e=i-n.top+n.bottom,t=a-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}function To(e){null!=e.selection&&(e.selection=null,e.onChange())}function Mo(e,t,n){void 0===n&&(n=!1);var r=t.selection,o=t.getConfig(),a=Ct.findDocumentOrShadowRoot(t).getSelection();if(a&&(!e.isComposing||n)&&t.isFocused()){var s="None"!==a.type;if(r||s){var l=oe.get(t),c=!1;if(l.contains(a.anchorNode)&&l.contains(a.focusNode)&&(c=!0),s&&c&&r){var u=Ct.toSlateRange(t,a,{exactMatch:!0,suppressThrow:!0});if(u&&i.Range.equals(u,r)){var d=!0;if(i.Range.isCollapsed(r)){var f=a.anchorNode,h=a.anchorOffset;if(f===l){var p=l.childNodes,g=void 0;(g=p[h])&&g.matches("table")&&(d=!1),(g=p[h-1])&&g.matches("table")&&(d=!1)}}if(d)return}}if(!r||Ct.hasRange(t,r)){e.isUpdatingSelection=!0;var v=null;try{v=r&&Ct.toDOMRange(t,r)}catch(e){v=null}if(v){i.Range.isBackward(r)?a.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):a.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var m=v.startContainer.parentElement;if(!m.closest("[data-slate-spacer]")&&v.getBoundingClientRect){var y=v.getBoundingClientRect.bind(v)();0===y.top&&0===y.right&&0===y.bottom&&0===y.left&&0===y.height&&0===y.width||(m.getBoundingClientRect=v.getBoundingClientRect.bind(v));var b=document.body;if(No(m,{scrollMode:"if-needed",boundary:o.scroll&&l.parentElement||b,block:"end",behavior:"auto"}),o.scroll){var w=l.parentElement;if(w){var E=function(){var e=v.getBoundingClientRect(),t=w.getBoundingClientRect(),n=e.bottom-t.bottom,r=t.top-e.top;n>0?w.scrollTop+=n+1:r>0&&(w.scrollTop-=r+1)};E(),requestAnimationFrame(E)}}delete m.getBoundingClientRect}}else a.removeAllRanges();setTimeout(function(){v&&vt&&l.focus(),e.isUpdatingSelection=!1})}else t.selection=Ct.toSlateRange(t,a,{exactMatch:!1,suppressThrow:!0})}}}var Lo=new WeakMap,Do=new WeakMap;function Ro(e){var t;try{t=Ct.findDocumentOrShadowRoot(e)}catch(e){return null}var n=t.getSelection();if(!n||n.rangeCount<=0)return null;try{return n.getRangeAt(0).startContainer}catch(e){return null}}var Po={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z",tab:"tab",selectAll:"mod+a"},Ao={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},$o={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Fo=function(e){var t=Po[e],n=Ao[e],r=$o[e],o=t&&d.isKeyHotkey(t),i=n&&d.isKeyHotkey(n),a=r&&d.isKeyHotkey(r);return function(e){return!(!o||!o(e))||(!!(gt&&i&&i(e))||!(gt||!a||!a(e)))}},Io={isBold:Fo("bold"),isCompose:Fo("compose"),isMoveBackward:Fo("moveBackward"),isMoveForward:Fo("moveForward"),isDeleteBackward:Fo("deleteBackward"),isDeleteForward:Fo("deleteForward"),isDeleteLineBackward:Fo("deleteLineBackward"),isDeleteLineForward:Fo("deleteLineForward"),isDeleteWordBackward:Fo("deleteWordBackward"),isDeleteWordForward:Fo("deleteWordForward"),isExtendBackward:Fo("extendBackward"),isExtendForward:Fo("extendForward"),isExtendLineBackward:Fo("extendLineBackward"),isExtendLineForward:Fo("extendLineForward"),isItalic:Fo("italic"),isMoveLineBackward:Fo("moveLineBackward"),isMoveLineForward:Fo("moveLineForward"),isMoveWordBackward:Fo("moveWordBackward"),isMoveWordForward:Fo("moveWordForward"),isRedo:Fo("redo"),isSplitBlock:Fo("splitBlock"),isTransposeCharacter:Fo("transposeCharacter"),isUndo:Fo("undo"),isTab:Fo("tab"),isSelectAll:Fo("selectAll")};function Bo(e){e.preventDefault()}var jo={beforeinput:function(e,t,n){var r,o,a=e,s=n.getConfig().readOnly;if(Et&&!s&&yo(n,a.target)){null===(r=t.flushDOMSelectionChange)||void 0===r||r.call(t);var l=n.selection,c=a.inputType,u=a.dataTransfer||a.data||void 0;if("insertCompositionText"!==c&&"deleteCompositionText"!==c){if(a.preventDefault(),!c.startsWith("delete")||c.startsWith("deleteBy")){var d=y(a.getTargetRanges(),1)[0];if(d){var f=null;try{f=Ct.toSlateRange(n,d,{exactMatch:!1,suppressThrow:!0})}catch(e){f=null}!f||l&&i.Range.equals(l,f)||(i.Transforms.select(n,f),l=f)}}if(l&&i.Range.isExpanded(l)){var h=Ct.getSelectedElems(n),p="table"===h[0].type,g="table-cell"!==h[h.length-1].type;if(p&&g)return;if(c.startsWith("delete")){var v=c.endsWith("Backward")?"backward":"forward";return void i.Editor.deleteFragment(n,{direction:v})}}if(null==l&&c.startsWith("insert")){var m=Ct.findDocumentOrShadowRoot(n).getSelection();if(m){var b=Ct.toSlateRange(n,m,{exactMatch:!1,suppressThrow:!0});b&&(i.Transforms.select(n,b),l=b)}if(null==l){try{null===(o=n.restoreSelection)||void 0===o||o.call(n)}catch(e){}l=n.selection}if(null==l){var w=i.Editor.end(n,[]),E={anchor:w,focus:w};i.Transforms.select(n,E),l=E}}switch(c){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":i.Editor.deleteFragment(n);break;case"deleteContent":case"deleteContentForward":i.Editor.deleteForward(n);break;case"deleteContentBackward":i.Editor.deleteBackward(n);break;case"deleteEntireSoftLine":i.Editor.deleteBackward(n,{unit:"line"}),i.Editor.deleteForward(n,{unit:"line"});break;case"deleteHardLineBackward":i.Editor.deleteBackward(n,{unit:"block"});break;case"deleteSoftLineBackward":i.Editor.deleteBackward(n,{unit:"line"});break;case"deleteHardLineForward":i.Editor.deleteForward(n,{unit:"block"});break;case"deleteSoftLineForward":i.Editor.deleteForward(n,{unit:"line"});break;case"deleteWordBackward":i.Editor.deleteBackward(n,{unit:"word"});break;case"deleteWordForward":i.Editor.deleteForward(n,{unit:"word"});break;case"insertLineBreak":i.Editor.insertText(n,"\n");break;case"insertParagraph":i.Editor.insertBreak(n);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===c&&(t.isComposing=!1,pe.set(n,!0)),"insertFromPaste"===c&&!he.get(n))break;Me(u)?n.insertData(u):"string"==typeof u&&i.Editor.insertText(n,u)}}}},blur:function(e,t,n){var r=e,o=t.isUpdatingSelection,a=t.latestElement;if(!n.getConfig().readOnly&&!o&&yo(n,r.target)){var s=Ct.findDocumentOrShadowRoot(n);if(a!==s.activeElement){var l=r.relatedTarget;if(!(l===Ct.toDOMNode(n,n)||Fe(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&Ae(l)&&Ct.hasDOMNode(n,l)){var c=Ct.toSlateNode(n,l);if(i.Element.isElement(c)&&!n.isVoid(c))return}if(mt){var u=s.getSelection();null==u||u.removeAllRanges()}ue.delete(n)}}}},focus:function(e,t,n){var r=Ct.toDOMNode(n,n),o=Ct.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,vt&&e.target!==r?r.focus():ue.set(n,!0)},click:function(e,t,n){if(!n.getConfig().readOnly&&bo(n,e.target)&&Ae(e.target)){var r=Ct.toSlateNode(n,e.target),o=Ct.findPath(n,r);if(i.Editor.hasPath(n,o))if(i.Node.get(n,o)===r){var a=i.Editor.start(n,o),s=i.Editor.end(n,o),l=i.Editor.void(n,{at:a}),c=i.Editor.void(n,{at:s});if(l&&c&&i.Path.equals(l[1],c[1])){var u=i.Editor.range(n,a);i.Transforms.select(n,u)}}}},compositionstart:function(e,t,n){if(yo(n,e.target)){ge.delete(n),t.isComposing=!0;var r=n.selection;if(r&&i.Range.isCollapsed(r)){var o=Ro(n);if(o){var a=o.textContent||"";Lo.set(n,a),Do.set(n,o)}}r&&i.Range.isExpanded(r)&&(i.Editor.deleteFragment(n),t.changeViewState(),Promise.resolve().then(function(){Mo(t,n,!0)})),function(e,t){var n;t.getConfig().placeholder&&t.isEmpty()&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1)}(t,n)}},compositionend:function(e,t,n){var r=e;if(yo(n,r.target)){t.isComposing=!1;var o=!0===pe.get(n);o?(pe.delete(n),ge.delete(n)):ge.delete(n);var a=function(e){var t,n=e.selection;if(n)return n;try{var r=Ct.findDocumentOrShadowRoot(e).getSelection();if(r){var o=Ct.toSlateRange(e,r,{exactMatch:!1,suppressThrow:!0});o&&(i.Transforms.select(e,o),n=o)}}catch(e){}if(!n){try{null===(t=e.restoreSelection)||void 0===t||t.call(e)}catch(e){}n=e.selection}if(!n){var a=i.Editor.end(e,[]),s={anchor:a,focus:a};i.Transforms.select(e,s),n=s}return n}(n);if(null!=a){(wt||vt)&&Ct.cleanExposedTexNodeInSelectionBlock(n);for(var s=i.Range.isBackward(a)?a.focus:a.anchor,l=y(i.Editor.node(n,[s.path[0]]),1)[0],c=0;c<s.path.length;c+=1){var u=y(i.Editor.node(n,s.path.slice(0,c+1)),1)[0];if(i.Element.isElement(u)&&((mt||vt)&&"link"===u.type||"code"===u.type)){Ct.setNewKey(l);break}}var d=r.data;if(d&&!o){if(n.getConfig().maxLength){var f=Ct.getLeftLengthOfMaxLength(n);if(f<d.length){var h=Ro(n);h&&h.nodeType===Node.TEXT_NODE&&(h.textContent=Lo.get(n)||""),f>0&&i.Editor.insertText(n,d.slice(0,f)),t.changeViewState()}else i.Editor.insertText(n,d)}else{var p=Ct.findDocumentOrShadowRoot(n).getSelection();if(p&&function(e,t){if(i.Range.isCollapsed(t)){var n=t.anchor,r=t.focus;if([2,3].includes(n.path.length)&&[2,3].includes(r.path.length)&&(0===n.offset||0===r.offset)){var o=i.Editor.node(e,n.path),a=0===n.offset?n.path:r.path,s=[a[0],a[1]-1];if(0===a[1])return!1;var l=i.Editor.node(e,s);if(i.Text.isText(l[0])&&i.Text.isText(o[0]))return!0}}}(n,a)){var g=Ct.toSlateRange(n,p,{exactMatch:!1,suppressThrow:!1});g&&(n.selection=g)}i.Editor.insertText(n,d)}mt||setTimeout(function(){if(null!=n.selection){var e=Do.get(n);if(null!=e&&e.nodeType===Node.TEXT_NODE){var t=Ro(n);null!=t&&t.nodeType===Node.TEXT_NODE&&t!==e&&(e.textContent=Lo.get(n)||"")}}})}}}},compositionupdate:function(e,t,n){yo(n,e.target)&&(t.isComposing=!0)},keydown:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&!t.isComposing&&yo(n,r.target)){if(function(e,t){var n,r,o=U.get(e),i=o&&o.getMenus(),a=K.get(e),s=a&&a.getMenus(),l=v(v({},i),s);try{for(var c=m(Object.keys(l)),u=c.next();!u.done;u=c.next()){var f=l[u.value],h=f.hotkey;if(h&&d.isHotkey(h,t)&&!f.isDisabled(e)){var p=f.getValue(e);f.exec(e,p)}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}(n,r),Io.isTab(r))return Bo(r),void n.handleTab();if(Io.isRedo(r))return Bo(r),void("function"==typeof n.redo&&n.redo());if(Io.isUndo(r))return Bo(r),void("function"==typeof n.undo&&n.undo());if(Io.isMoveLineBackward(r))return Bo(r),void i.Transforms.move(n,{unit:"line",reverse:!0});if(Io.isMoveLineForward(r))return Bo(r),void i.Transforms.move(n,{unit:"line"});if(Io.isExtendLineBackward(r))return Bo(r),void i.Transforms.move(n,{unit:"line",edge:"focus",reverse:!0});if(Io.isExtendLineForward(r))return Bo(r),void i.Transforms.move(n,{unit:"line",edge:"focus"});if(Io.isMoveBackward(r))return Bo(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n,{reverse:!0}):i.Transforms.collapse(n,{edge:"start"}));if(Io.isMoveForward(r))return Bo(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n):i.Transforms.collapse(n,{edge:"end"}));if(Io.isMoveWordBackward(r))return Bo(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word",reverse:!0});if(Io.isMoveWordForward(r))return Bo(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word"});if(Io.isSelectAll(r))return Bo(r),void n.selectAll();if(Et){if((wt||mt)&&o&&(Io.isDeleteBackward(r)||Io.isDeleteForward(r))&&i.Range.isCollapsed(o)){var a=i.Node.parent(n,o.anchor.path);i.Element.isElement(a)&&i.Editor.isVoid(n,a)&&i.Editor.isInline(n,a)&&(r.preventDefault(),i.Transforms.delete(n,{unit:"block"}))}}else{if(Io.isBold(r)||Io.isItalic(r)||Io.isTransposeCharacter(r))return void Bo(r);if(Io.isSplitBlock(r))return Bo(r),void(r.shiftKey?i.Editor.insertText(n,"\n"):i.Editor.insertBreak(n));if(Io.isDeleteBackward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n));if(Io.isDeleteForward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n));if(Io.isDeleteLineBackward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"line"}));if(Io.isDeleteLineForward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"line"}));if(Io.isDeleteWordBackward(r))return Bo(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"word"}));Io.isDeleteWordForward(r)&&(Bo(r),o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"word"}))}}},keypress:function(e,t,n){if(!Et&&!n.getConfig().readOnly&&yo(n,e.target)){e.preventDefault();var r=e.key;i.Editor.insertText(n,r)}},copy:function(e,t,n){var r=e;if(yo(n,r.target)){n.getConfig().readOnly||r.preventDefault();var o=r.clipboardData;if(null!=o){n.setFragmentData(o);var i=n.getConfig().customCopy;i&&i(n,r)}}},cut:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&(r.preventDefault(),yo(n,r.target))){var a=r.clipboardData;if(null!=a&&(n.setFragmentData(a),o))if(i.Range.isExpanded(o))i.Editor.deleteFragment(n);else{var s=i.Node.parent(n,o.anchor.path);i.Element.isElement(s)&&i.Editor.isVoid(n,s)&&i.Transforms.delete(n)}}},paste:function(e,t,n){he.set(n,!0);var r=e;if(!n.getConfig().readOnly&&yo(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return he.set(n,!1),void r.preventDefault();if(mt||!Et||je(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(e,t,n){if(bo(n,e.target)){var r=Ct.toSlateNode(n,e.target);i.Element.isElement(r)&&i.Editor.isVoid(n,r)&&e.preventDefault()}},dragstart:function(e,t,n){var r=e;if(bo(n,r.target)&&!n.getConfig().readOnly){var o=Ct.toSlateNode(n,r.target),a=Ct.findPath(n,o);if(i.Element.isElement(o)&&i.Editor.isVoid(n,o)||i.Editor.void(n,{at:a,voids:!0})){var s=i.Editor.range(n,a);i.Transforms.select(n,s)}var l=r.dataTransfer;if(null!=l)Ct.getSelectedNodeByType(n,"table")||(t.isDraggingInternally=!0,n.setFragmentData(l))}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&bo(n,r.target)&&(t.isDraggingInternally=!1)},drop:function(e,t,n){var r=e,o=r.dataTransfer;if(!n.getConfig().readOnly&&bo(n,r.target)&&null!=o&&!(Et&&mt&&o.files.length>0)){r.preventDefault();var a=n.selection,s=Ct.findEventRange(n,r);i.Transforms.select(n,s),t.isDraggingInternally&&(a&&i.Transforms.delete(n,{at:a}),t.isDraggingInternally=!1),n.insertData(o),n.isFocused()||n.focus()}}},_o=[];var Ho={};function Wo(e,t,n){var r=n.isInline(e)?"span":"div";return f.jsx(r,null,t)}function Vo(e,t){var n,r=Ct.findKey(t,e),o=t.isInline(e),a=i.Editor.isVoid(t,e),s=ft(e.type,r.id),l={id:s,key:r.id,"data-slate-node":"element","data-slate-inline":o},c=e.type,u=e.children,d=void 0===u?[]:u,h=function(e){return Ho[e]||Wo}(c);n=a?null:d.map(function(n,r){return qo(n,r,e,t)});var p=h(e,n,t);if(a){l["data-slate-void"]=!0;var g=o?"span":"div",v=y(i.Node.texts(e),1),m=y(v[0],1)[0],b=qo(m,0,e,t),E=f.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},b);p=f.jsx(g,{style:{position:"relative"}},p,E),ne.set(m,0),re.set(m,e)}return null==p.data&&(p.data={}),Object.assign(p.data,l),a||o||(p=function(e,t,n){var r=t;return _o.forEach(function(t){r=t(e,r,n)}),r}(e,p,t)),w(function(){var n=oe.get(t),o=null==n?void 0:n.querySelector("#".concat(s));null!=o&&(ae.set(r,o),se.set(e,o),ie.set(o,e))}),p}function Uo(e,t){return void 0===t&&(t=!1),f.jsx("span",{"data-slate-string":!0},t?"".concat(e,"\n"):e)}function zo(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),f.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?f.jsx("br",null):null)}function Ko(e,t,n){if(null==e.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=Ct.findKey(n,e),o=n.getConfig().decorate;if(null==o)throw new Error("Can not get config.decorate");var a,s=Ct.findPath(n,e),l=o([e,s]),c=i.Text.decorations(e,l),u=c.map(function(r){var o,a=r.leaf,s=r.position,l=null!==(o=null==s?void 0:s.isLast)&&void 0!==o?o:1===c.length,u=function(e,t,n,r,o){void 0===o&&(o=!1);var a=e.text,s=Ct.findPath(r,t),l=i.Path.parent(s);if(i.Editor.isEditor(n))throw new Error("Text node ".concat(JSON.stringify(t)," parent is Editor"));return r.isVoid(n)?zo(i.Node.string(n).length):""!==a||n.children[n.children.length-1]!==t||r.isInline(n)||""!==i.Editor.string(r,l)?""===a?zo():o&&"\n"===a.slice(-1)?Uo(a,!0):Uo(a):zo(0,!0)}(a,e,t,n,l);return u=function(e,t,n){var r=t;return _o.forEach(function(t){r=t(e,r,n)}),r}(a,u,n),f.jsx("span",{"data-slate-leaf":!0},u)}),d=(a=r.id,"w-e-text-".concat(a)),h=f.jsx("span",{"data-slate-node":"text",id:d,key:r.id},u);return w(function(){var t=oe.get(n),o=null==t?void 0:t.querySelector("#".concat(d));null!=o&&(ae.set(r,o),se.set(e,o),ie.set(o,e))}),h}function qo(e,t,n,r){return ne.set(e,t),re.set(e,n),i.Element.isElement(e)?Vo(e,r):Ko(e,n,r)}var Jo=["props","attrs","style","dataset","on","hook","ns"];function Go(e){var t=e.data,n=void 0===t?{}:t,r=e.children,o=void 0===r?[]:r;Object.keys(n).forEach(function(t){var r,o,i=n[t];if("key"!==t){if(!Jo.includes(t)){if(t.startsWith("data-")){var a=t.slice(5);return a=h(a),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={}),Object.assign(n.dataset,t)}(e,((r={})[a]=i,r)),void delete n[t]}!function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.props&&(n.props={}),Object.assign(n.props,t)}(e,(o={},o[t]=i,o)),delete n[t]}}else e.key=i}),o.length>0&&o.forEach(function(e){"string"!=typeof e&&Go(e)})}function Yo(e,t){var n,r,o=e.$scroll,a=(n=e.id,"w-e-textarea-".concat(n)),l=t.getConfig(),c=l.readOnly,u=l.autoFocus,d=function(e,t){return void 0===t&&(t=!1),f.h("div#".concat(e),{props:{contentEditable:!t}})}(a,c),h=t.children||[];d.children=h.map(function(e,n){if(ee.has(e)){var r=ee.get(e);if(r){var o=y(r,2),a=o[0],s=o[1];if(s)return a!==n&&(ne.set(e,n),ee.set(e,[n,s])),s}}var l=qo(e,n,t,t);Go(l);var c=t.getConfig().skipCacheTypes,u=void 0===c?["list-item"]:c;return i.Element.isElement(e)&&u.includes(e.type)||ee.set(e,[n,l]),l});var p=X.get(e);if(null==p&&(p=!0),p){var g=function(e){return s('<div\n id="'.concat(e,'"\n data-slate-editor\n data-slate-node="value"\n suppressContentEditableWarning\n role="textarea"\n spellCheck="true"\n autoCorrect="true"\n autoCapitalize="true"\n ></div>'))}(a);o.append(g),e.$textArea=g,r=g[0],oe.set(t,r),se.set(t,r),ie.set(r,t),(m=f.init([f.classModule,f.propsModule,f.styleModule,f.datasetModule,f.eventListenersModule,f.attributesModule]))(r,d),X.set(e,!1),Z.set(e,m)}else{var v=Q.get(e),m=Z.get(e);if(null==v||null==m)return;r=v.elm,m(v,d)}if(null==r){var b=o[0];if(null==(r=(null==b?void 0:b.querySelector("#".concat(a)))||We(a)))return}if((p?u:t.isFocused())&&r.focus({preventScroll:!0}),p){var w=Pe(r);w&&ce.set(t,w)}oe.set(t,r),se.set(t,r),ie.set(r,t),Q.set(e,d)}var Xo=1,Zo=function(){function e(e){var t=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=Xo++,this.$textArea=null,this.$progressBar=s('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=s('<div class="w-e-max-length-info"></div>'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=u(function(e){var n=Fe(null==e?void 0:e.target)?e.target:null,r=null==n?void 0:n.tagName;if("INPUT"!==r&&"TEXTAREA"!==r){var o=t.getActiveEditor();null!=o&&function(e,t){var n=e.isComposing,r=e.isUpdatingSelection,o=e.isDraggingInternally,a=t.getConfig();if(!r&&!o){var s=Ct.findDocumentOrShadowRoot(t),l=s.activeElement,c=Ct.toDOMNode(t,t),u=s.getSelection();if(l!==c)return ue.delete(t),void To(t);if(e.latestElement=l,ue.set(t,!0),!u)return To(t);var d=u.anchorNode,f=u.focusNode,h=wo(t,d),p=bo(t,f);if(!n)if(h&&p){var g=Ct.toSlateRange(t,u,{exactMatch:!1,suppressThrow:!0});g&&i.Transforms.select(t,g)}else a.readOnly&&To(t)}}(t,o)}},100);var n=s(e);if(0===n.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=n;var r=s('<div class="w-e-text-container"></div>');r.append(this.$progressBar),r.append(this.$maxLengthInfo),n.append(r);var o=s('<div class="w-e-scroll"></div>');r.append(o),this.$scroll=o,this.$textAreaContainer=r,w(function(){var e=t.getActiveEditor();if(null!=e){t.bindSelectionChange(e),r.on("click",function(){return e.hidePanelOrModal()}),e.on(A,t.changeViewState.bind(t));var o=e.getConfig(),i=o.onChange,a=o.scroll;i&&e.on(A,function(){return i(e)}),a||(n.css("position","relative"),r.addClass("no-scroll")),t.onFocusAndOnBlur(),e.on(A,t.changeMaxLengthInfo.bind(t)),t.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=W.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.getActiveEditor=function(){if(this.destroyed)return null;var e=W.get(this);return null==e||e.isDestroyed?null:e},e.prototype.bindSelectionChange=function(e,t){var n=this;if(void 0===t&&(t=5),null==this.selectionChangeRoot&&!e.isDestroyed){try{var r=Ct.findDocumentOrShadowRoot(e);r.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=r}catch(r){if(t>0)return void setTimeout(function(){return n.bindSelectionChange(e,t-1)},0);window.document.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=window.document}e.on(P,function(){var e;null===(e=n.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",n.onDOMSelectionChange),n.selectionChangeRoot=null})}},e.prototype.flushDOMSelectionChange=function(){this.onDOMSelectionChange.flush()},e.prototype.bindEvent=function(){var e=this,t=this.$textArea,n=this.$scroll,o=this.editorInstance;null!=t&&(r(jo,function(n,r){t.on(r,function(t){n(t,e,o)})}),o.getConfig().scroll&&(n.css("overflow-y","auto"),n.on("scroll",u(function(){o.emit($)},100))))},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.getActiveEditor();if(null!=t){var n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on(A,function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout(function(){e.destroyed||t.isDestroyed||o&&o(t)}):null!=e.latestEditorSelection&&null==t.selection&&setTimeout(function(){e.destroyed||t.isDestroyed||r&&r(t)}),e.latestEditorSelection=t.selection})}},e.prototype.changeMaxLengthInfo=function(){var e=this.getActiveEditor();if(null!=e){var t=e.getConfig().maxLength;if(t){var n=t-Ct.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML="".concat(n,"/").concat(t)}}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width","".concat(e,"%")),e>=100&&setTimeout(function(){t.hide(),t.css("width","0"),t.show()},1e3)},e.prototype.changeViewState=function(){var e=this,t=this.getActiveEditor();null!=t&&(Yo(this,t),function(e,t){var n,r=t.getConfig().placeholder;if(r){var o=t.isEmpty();if(o&&!e.showPlaceholder&&!e.isComposing){if(null==e.$placeholder){var i=s('<div class="w-e-text-placeholder">'.concat(r,"</div>"));e.$textAreaContainer.append(i),e.$placeholder=i}return e.$placeholder.show(),void(e.showPlaceholder=!0)}!o&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1)}}(this,t),w(function(){e.destroyed||t.isDestroyed||Mo(e,t)}))},e.prototype.destroy=function(){var e;this.destroyed=!0,this.onDOMSelectionChange.cancel(),null===(e=this.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=null,this.$textAreaContainer.remove()},e}();function Qo(e,t,n,r){if(ne.set(e,t),re.set(e,n),i.Element.isElement(e)){var o=e.children;if((void 0===o?[]:o).forEach(function(t,n){return Qo(t,n,e,r)}),i.Editor.isVoid(r,e)){var a=y(i.Node.texts(e),1),s=y(a[0],1)[0];ne.set(s,0),re.set(s,e)}}}var ei=function(){function e(e,t){var n=this;this.$toolbar=s('<div class="w-e-bar w-e-bar-show w-e-toolbar"></div>'),this.menus={},this.toolbarItems=[],this.config={},this.lngListen=function(){},this.syncToolbarState=function(){n.toolbarItems.forEach(function(e){e.changeMenuState()})},this.changeToolbarState=c(function(){n.syncToolbarState()},200),this.config=t;var r=s(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '".concat(e,"'"));this.$box=r;var o=this.$toolbar;o.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),r.append(o),w(function(){n.initToolbar(),n.lngListen=Yr(function(){return n.initToolbar()});var e=n.getEditorInstance();e.on(A,n.changeToolbarState),e.on(F,n.syncToolbarState),e.on(I,n.syncToolbarState)})}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.initToolbar=function(){this.menus={};var e=this.$toolbar;null==e||e.empty(),this.registerItems(),this.changeToolbarState()},e.prototype.registerItems=function(){var e=this,t="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,s=r.insertKeys,l=void 0===s?{index:0,keys:[]}:s,c=r.excludeKeys,u=void 0===c?[]:c,d=a(i),f=[];f=Array.isArray(l)?l:[l];var h=0;f.forEach(function(e){var t=e.index+h;if(e.replaceFn&&d[t]){var n=e.replaceFn(d[t]);if(!n)throw new Error("This function needs to return the menu configuration: IToolbarMenuKey");d[t]=n}e.keys.length>0&&("string"==typeof e.keys&&(e.keys=[e.keys]),e.keys.forEach(function(e,n){d.splice(t+n,0,e)}),h+=e.keys.length)});var p=d.filter(function(e){var t="string"==typeof e?e:e.key;return!u.includes(t)}),g=p.length;p.forEach(function(r,o){if("|"===r){if(0===o)return;if(o+1===g)return;if("|"===t)return;var i=eo();return n.append(i),void(t=r)}return"string"==typeof r?(e.registerSingleItem(r,e),void(t=r)):e.isMenuGroup(r)?(e.registerGroup(r),void(t="group")):(e.registerSingleMenuByConf(r),void(t=r.key))})},e.prototype.isMenuGroup=function(e){return"string"!=typeof e&&Array.isArray(e.menuKeys)},e.prototype.registerSingleMenuByConf=function(e){var t=e.key,n=e.title,r=e.iconSvg;this.registerSingleItem(t,this,{title:n,iconSvg:r})},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new ao(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,a=this.config.excludeKeys,s=void 0===a?[]:a;i.forEach(function(e){s.includes(e)||t.registerSingleItem(e,r)}),n.append(r.$elem)},e.prototype.registerSingleItem=function(e,t,n){void 0===n&&(n={});var r=this.getEditorInstance(),o=t instanceof ao,i=this.menus,a=i[e];if(null==a){var s=_[e];if(null==s)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof s)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));a=s(),i[e]=a}else console.warn("Duplicated toolbar menu key '".concat(e,"'\n重复注册了菜单栏 menu '").concat(e,"'"));var l=r.getMenuConfig(e);l&&void 0!==l.iconSvg&&(a.iconSvg=l.iconSvg),void 0!==n.iconSvg&&(a.iconSvg=n.iconSvg),void 0!==n.title&&(a.title=n.title);var c=go(e,a,o);(this.toolbarItems.push(c),q.set(c,r),o)?t.appendBarItem(c):t.$toolbar.append(c.$elem)},e.prototype.getEditorInstance=function(){var e=V.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){var e;this.$toolbar.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.toolbarItems=[]},e}();var ti=!1,ni=!1;function ri(e){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("[wangeditor-next] `@wangeditor-next/core` export `".concat(e,"` is deprecated.")+" Please import it from `@wangeditor-next/core/upload`.")}e.DOMComment=Ee,e.DOMElement=xe,e.DOMNode=we,e.DOMRange=Ce,e.DOMSelection=ke,e.DOMStaticRange=Oe,e.DOMText=Se,e.DomEditor=Ct,e.ELEM_TO_HTML_CONF=Ot,e.PARSE_ELEM_HTML_CONF=et,e.PARSE_STYLE_HTML_FN_LIST=Qe,e.PRE_PARSE_HTML_CONF_LIST=Ze,e.RENDER_ELEM_CONF=Ho,e.RENDER_STYLE_HANDLER_LIST=_o,e.STYLE_TO_HTML_FN_LIST=kt,e.TEXT_TAGS=Xe,e.Toolbar=ei,e.coreCreateEditor=function(e){var t=e.selector,n=void 0===t?"":t,o=e.config,s=void 0===o?{}:o,l=e.content,c=e.html,u=e.plugins,d=void 0===u?[]:u,f=function(e){return[zn,Bt,ve,Ft,or,Vn,Zn,Gn].reduce(function(e,t){return t(e)},e)}(i.createEditor());if(n&&function(e,t){return ut(e,"data-w-e-textarea",t)}(f,n))throw new Error("Repeated create editor by selector '".concat(n,"'"));var h=function(e){void 0===e&&(e={});var t=a(D),n={},o=e.MENU_CONF,i=void 0===o?{}:o;return r(t,function(e,t){n[t]=v(v({},e),i[t]||{})}),delete e.MENU_CONF,v({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return[]},maxLength:0,MENU_CONF:n,hoverbarKeys:{},textStyleMode:"inline",classStylePolicy:"preserve-data",sanitizeHtml:L,customAlert:function(e,t){window.alert("".concat(t,":\n").concat(e))}},e)}(s);Y.set(f,h);var p=h.hoverbarKeys,g=void 0===p?{}:p;if(d.forEach(function(e){f=e(f)}),function(e,t){var n=t.html,r=t.content;null!=n?e.children=dt(e,n):r&&r.length&&(e.children=r),0===e.children.length&&(e.children=[{type:"paragraph",children:[{text:""}]}])}(f,{html:c,content:l}),n){var m=new Zo(n);H.set(f,m),W.set(m,f),m.changeViewState();var y=void 0;Object.keys(g).length>0&&(y=new mo,z.set(y,f),K.set(f,y)),f.on(A,function(){f.hidePanelOrModal()}),f.on($,function(){f.hidePanelOrModal()})}else f.children.forEach(function(e,t){return Qo(e,t,f,f)});var b=h.onCreated,E=h.onDestroyed;return b&&f.on(R,function(){return b(f)}),E&&f.on(P,function(){return E(f)}),w(function(){return f.emit(R)}),f},e.coreCreateToolbar=function(e,t){if(null==e)throw new Error("Cannot create toolbar, because editor is null");var n=t.selector,r=t.config,o=void 0===r?{}:r;if(function(e,t){return ut(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '".concat(n,"'"));var i=v({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new ei(n,i);return V.set(a,e),U.set(e,a),a},e.createUploader=function(e,t){return ti||(ti=!0,ri("createUploader")),function(e,t){return e.uploadAdapter?e.uploadAdapter({config:e,editor:t}):k(e)}(e,t)},e.createUppyUploader=function(e){return ni||(ni=!0,ri("createUppyUploader")),k(e)},e.genModalButtonElems=function(e,t){var n=s('<div class="button-container"></div>'),r=s('<button type="button" id="'.concat(e,'">').concat(t,"</button>"));return n.append(r),[n[0],r[0]]},e.genModalInputElems=function(e,t,n){var r=s('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=s('<input type="text" id="'.concat(t,'" placeholder="').concat(n||"",'">'));return r.append(o),[r[0],o[0]]},e.genModalTextareaElems=function(e,t,n){var r=s('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=s('<textarea type="text" id="'.concat(t,'" placeholder="').concat(n||"",'"></textarea>'));return r.append(o),[r[0],o[0]]},e.getClassStylePolicy=function(e){if(!e)return"preserve-data";var t=e.getConfig().classStylePolicy;return"fallback-inline"===t?"fallback-inline":"strict"===t?"strict":"preserve-data"},e.getDefaultView=Pe,e.getEditableChild=Ue,e.getEditableChildAndIndex=Ve,e.getElementById=We,e.getFirstVoidChild=Ke,e.getPlainText=ze,e.getTagName=Je,e.getTextStyleMode=function(e){return e&&"class"===e.getConfig().textStyleMode?"class":"inline"},e.hasShadowRoot=He,e.i18nAddResources=function(e,t){Jr.addResourceBundle(e,Gr,t,!0,!0)},e.i18nChangeLanguage=function(e){Jr.changeLanguage(e)},e.i18nGetResources=function(e){return Jr.getResourceBundle(e,Gr)},e.i18nListenLanguage=Yr,e.isDOMComment=$e,e.isDOMElement=Fe,e.isDOMNode=Ae,e.isDOMSelection=Ie,e.isDOMText=Be,e.isDataTransfer=Me,e.isDocument=Ne,e.isHTMLElememt=Re,e.isPlainTextOnlyPaste=je,e.isShadowRoot=Te,e.isUnprocessedListElement=De,e.normalizeDOMPoint=_e,e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;Ot[t||""]=n},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=v(v({},o),t||{});if(null!=_[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));_[n]=r,function(e,t){null!=t&&(D[e]=t)}(n,i)},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;et[t]=n},e.registerParseStyleHtmlHandler=function(e){Qe.push(e)},e.registerPreParseHtmlConf=function(e){Ze.push(e)},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Ho[t||""]=n},e.registerStyleHandler=function(e){_o.push(e)},e.registerStyleToHtmlHandler=function(e){kt.push(e)},e.reportUnsupportedClassStyle=function(e,t){var n=null==e?void 0:e.getConfig().onClassStyleUnsupported;n?n(t):console.warn(t.message)},e.t=Xr,e.walkTextNodes=qe});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@uppy/core"),require("@uppy/xhr-upload"),require("lodash.foreach"),require("nanoid"),require("slate"),require("lodash.clonedeep"),require("dom7"),require("lodash.toarray"),require("lodash.debounce"),require("lodash.throttle"),require("is-hotkey"),require("snabbdom"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","@uppy/core","@uppy/xhr-upload","lodash.foreach","nanoid","slate","lodash.clonedeep","dom7","lodash.toarray","lodash.debounce","lodash.throttle","is-hotkey","snabbdom","lodash.camelcase"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WangEditorCore={},e.Uppy,e.XHRUpload,e.forEach,null,e.require$$0,e.cloneDeep,e.$,e.toArray,e.debounce,e.throttle,e.isHotkey,e.snabbdom,e.camelCase)}(this,function(e,t,n,r,o,i,a,s,l,c,u,d,f,h){"use strict";var p=function(e,t){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},p(e,t)};function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};function m(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function b(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function w(e){Promise.resolve().then(e)}function E(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}"function"==typeof SuppressedError&&SuppressedError;var x=function(e){return Object.prototype.toString.call(e)};function S(e){return e||{name:""}}function C(e){return Object.keys(e).reduce(function(t,n){return t[n]=String(e[n]),t},{})}function O(e){var o=e.server,i=void 0===o?"":o,a=e.fieldName,s=void 0===a?"":a,l=e.maxFileSize,c=void 0===l?10485760:l,u=e.maxNumberOfFiles,d=void 0===u?100:u,f=e.meta,h=void 0===f?{}:f,p=e.metaWithUrl,g=void 0!==p&&p,b=e.headers,w=void 0===b?{}:b,E=e.withCredentials,x=void 0!==E&&E,O=e.timeout,N=void 0===O?1e4:O,k=e.onBeforeUpload,T=void 0===k?function(e){return e}:k,L=e.onSuccess,M=void 0===L?function(e,t){}:L,D=e.onError,R=void 0===D?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:D,P=e.onProgress,A=void 0===P?function(e){}:P;if(!i)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!s)throw new Error("Cannot get fieldName\n没有配置 fieldName");var $=i;g&&($=function(e,t){var n=y(e.split("#"),2),o=n[0],i=n[1],a=o,s=[];r(t,function(e,t){s.push("".concat(t,"=").concat(e))});var l=s.join("&");return a=a.indexOf("?")>0?"".concat(a,"&").concat(l):"".concat(a,"?").concat(l),i?"".concat(a,"#").concat(i):a}($,h)),function(){if("undefined"!=typeof AbortSignal){var e=AbortSignal;"function"!=typeof e.any&&(e.any=function(e){var t,n,r=new AbortController,o=function(t){e.forEach(function(e){return e.removeEventListener("abort",o)});var n=t.target.reason;r.abort(n)};try{for(var i=m(e),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.aborted){var l=s.reason;return r.abort(l),r.signal}s.addEventListener("abort",o,{once:!0})}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.signal})}}();var F=function(e){if(e)return"function"==typeof e?function(t){return C(e(t))}:C(e)}(w),I=new t(v({onBeforeUpload:function(e){return T(e)},restrictions:{maxFileSize:c,maxNumberOfFiles:d},meta:h},e.uppyConfig)).use(n,v({endpoint:$,headers:F,formData:!0,fieldName:s,bundle:!1,withCredentials:x,timeout:N},e.xhrConfig));return I.on("upload-success",function(e,t){var n=(null!=t?t:{}).body,r=void 0===n?{}:n,o=S(e);try{M(o,r)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),I.on("progress",function(e){e<1||A(e)}),I.on("upload-error",function(e,t,n){var r=S(e);try{R(r,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),I.on("restriction-failed",function(e,t){var n=S(e);try{R(n,t,void 0)}catch(e){console.error("wangEditor upload file - onError error",e)}}),I}var N=new Set(["base","embed","math","meta","object","script","svg"]),k=new Set(["href","poster","src","xlink:href"]),T=["java","script:"].join("");function L(e,t,n){var r=function(e){return Array.from(e).filter(function(e){return e>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith(T)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==t&&"xlink:href"!==t&&(("img"===e||"poster"===t)&&r.startsWith("data:image/")))}function M(e){if(void 0===e&&(e=""),!e)return"";var t=document.createElement("div");t.innerHTML=e;var n=function(e){Array.from(e.childNodes).forEach(function(e){if(e instanceof Element){var t=e,r=t.tagName.toLowerCase();if("template"===r){var o=t,i=M(o.innerHTML);return i?(o.insertAdjacentHTML("beforebegin",i),void o.remove()):void o.remove()}N.has(r)?t.remove():(Array.from(t.attributes).forEach(function(e){var n=e.name.toLowerCase(),o=e.value||"";("srcdoc"===n||n.startsWith("on")||k.has(n)&&!L(r,n,o))&&t.removeAttribute(e.name)}),n(t))}})};return n(t),t.innerHTML}var D={};var R={CREATED:"created",DESTROYED:"destroyed",CHANGE:"change",SCROLL:"scroll",FULLSCREEN:"fullscreen",UNFULLSCREEN:"unFullScreen",MODALORPANELSHOW:"modalOrPanelShow",MODALORPANELHIDE:"modalOrPanelHide"},P={};var A=new WeakMap,$=new WeakMap,F=new WeakMap,I=new WeakMap,B=new WeakMap,j=new WeakMap,_=new WeakMap,H=new WeakMap,W=new WeakMap,U=new WeakMap,V=new WeakMap,z=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakMap,G=new WeakMap,Y=new WeakMap,X=new WeakMap,Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,re=new WeakMap,oe=new WeakMap,ie=new WeakMap,ae=new WeakMap,se=new WeakMap,le=new WeakMap,ce=function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in P)e.push(t);return e},t.getConfig=function(){var e=U.get(t);if(null==e)throw new Error("Can not get editor config");return e},t.getMenuConfig=function(e){var n=t.getConfig().MENU_CONF;return(void 0===n?{}:n)[e]||{}},t.alert=function(e,n){void 0===n&&(n="info");var r=t.getConfig().customAlert;r&&r(e,n)},t},ue=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);const de=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var fe,he=globalThis.Node,pe=globalThis.Comment,ge=globalThis.Element,ve=globalThis.Text,me=globalThis.Range,ye=globalThis.Selection,be=globalThis.StaticRange;s.css&&(s.fn.css=s.css),s.append&&(s.fn.append=s.append),s.addClass&&(s.fn.addClass=s.addClass),s.removeClass&&(s.fn.removeClass=s.removeClass),s.hasClass&&(s.fn.hasClass=s.hasClass),s.on&&(s.fn.on=s.on),s.focus&&(s.fn.focus=s.focus),s.attr&&(s.fn.attr=s.attr),s.removeAttr&&(s.fn.removeAttr=s.removeAttr),s.hide&&(s.fn.hide=s.hide),s.show&&(s.fn.show=s.show),s.offset&&(s.fn.offset=s.offset),s.width&&(s.fn.width=s.width),s.height&&(s.fn.height=s.height),s.parent&&(s.fn.parent=s.parent),s.parents&&(s.fn.parents=s.parents),s.is&&(s.fn.is=s.is),s.dataset&&(s.fn.dataset=s.dataset),s.val&&(s.fn.val=s.val),s.text&&(s.fn.text=s.text),s.html&&(s.fn.html=s.html),s.children&&(s.fn.children=s.children),s.remove&&(s.fn.remove=s.remove),s.find&&(s.fn.find=s.find),s.each&&(s.fn.each=s.each),s.empty&&(s.fn.empty=s.empty),e.NodeType=void 0,(fe=e.NodeType||(e.NodeType={}))[fe.ELEMENT_NODE=1]="ELEMENT_NODE",fe[fe.TEXT_NODE=3]="TEXT_NODE",fe[fe.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",fe[fe.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",fe[fe.COMMENT_NODE=8]="COMMENT_NODE",fe[fe.DOCUMENT_NODE=9]="DOCUMENT_NODE",fe[fe.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",fe[fe.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";var we=function(e){return"[object HTMLDocument]"===x(e)},Ee=function(e){return"[object ShadowRoot]"===x(e)},xe=function(e){return"[object DataTransfer]"===x(e)},Se=/\[object HTML([A-Z][a-z]*)*Element\]/,Ce=function(e){return"matches"in e&&/^[ou]l$/i.test(e.tagName)&&!e.hasAttribute("data-w-e-type")},Oe=function(e){return Se.test(x(e))},Ne=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},ke=function(e){return null!=e&&"number"==typeof e.nodeType},Te=function(t){return ke(t)&&t.nodeType===e.NodeType.COMMENT_NODE},Le=function(t){return ke(t)&&t.nodeType===e.NodeType.ELEMENT_NODE},Me=function(e){return"[object Selection]"===x(e)},De=function(t){return ke(t)&&t.nodeType===e.NodeType.TEXT_NODE},Re=function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length},Pe=function(e){var t,n=y(e,2),r=n[0],o=n[1];if(Le(r)&&r.childNodes.length){var i=o===r.childNodes.length,a=i?o-1:o;for(r=(t=y(Fe(r,a,i?"backward":"forward"),2))[0],i=(a=t[1])<o;Le(r)&&r.childNodes.length;){var s=i?r.childNodes.length-1:0;r=Ie(r,s,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},Ae=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},$e=function(e){var t,n,r;return null!==(t=window&&window.document.getElementById(e))&&void 0!==t?t:window&&(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},Fe=function(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,s=!1;(Te(o)||Le(o)&&0===o.childNodes.length||Le(o)&&"false"===o.getAttribute("contenteditable"))&&(!a||!s);)i>=r.length?(a=!0,i=t-1,n="backward"):i<0?(s=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},Ie=function(e,t,n){return y(Fe(e,t,n),1)[0]},Be=function(e){var t,n,r="";if(De(e)&&e.nodeValue)return e.nodeValue;if(Le(e)){try{for(var o=m(Array.from(e.childNodes)),i=o.next();!i.done;i=o.next()){var a=i.value;r+=Be(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}var s=getComputedStyle(e).getPropertyValue("display");"block"!==s&&"list"!==s&&"table-row"!==s&&"BR"!==e.tagName||(r+="\n")}return r};function je(t){var n=[];n.push(t);for(var r=0;n.length>0;){var o=n.pop();if(null==o)break;if((r+=1)>1e4)break;var i=o.nodeName;if(o.nodeType===e.NodeType.ELEMENT_NODE){var a=i.toLowerCase();if(de.includes(a)||"iframe"===a||"video"===a)return o;var s=o.children||[],l=s.length;if(l)for(var c=l-1;c>=0;c-=1)n.push(s[c])}}return null}function _e(t,n){if(!Oe(t)||"true"!==t.dataset.slateVoid)for(var r=t.childNodes,o=r.length;o-=1;){var i=r[o],a=i.nodeType;De(i)?n(i,t):[e.NodeType.ELEMENT_NODE,e.NodeType.DOCUMENT_NODE,e.NodeType.DOCUMENT_FRAGMENT_NODE].includes(a)&&_e(i,n)}}function He(t){if(0===t.length)return"";var n=t[0];return n.nodeType!==e.NodeType.ELEMENT_NODE?"":n.tagName.toLowerCase()}var We=new RegExp(String.fromCharCode(160),"g");function Ue(e){return e.replace(We," ")}var Ve=["span","b","strong","i","em","s","strike","u","font","sub","sup"],ze=[];var Ke=[];var qe={};function Je(e,t){var n=e.length;if(n){var r=e[n-1];if(i.Text.isText(r)){var o=Object.keys(r);if(1===o.length&&"text"===o[0])return r.text+=t,!0}}return!1}function Ge(e,t,n){return{type:"paragraph",children:[{text:s(e).text().replace(/\s+/gm," ")}]}}function Ye(e,t){var n=function(e,t){var n=[];if(null!=e.attr("data-w-e-is-void"))return n;var r=e[0].childNodes;return 1===r.length&&"BR"===r[0].nodeName?(n.push({text:""}),n):(r.forEach(function(e){if(Le(e)){if("BR"===e.nodeName)return void(Je(n,"\n")||n.push({text:"\n"}));var r=nt(s(e),t);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}else if(De(e)){var o=e.textContent||"";if(""===o.trim()&&o.indexOf("\n")>=0)return;o&&(o=Ue(o),Je(n,o)||n.push({text:o}))}}),n)}(e,t),r=function(e){for(var t in qe)if(e[0].matches(t))return qe[t];return Ge}(e),o=r(e[0],n,t);return Array.isArray(o)||(o=[o]),o.forEach(function(r){i.Editor.isVoid(t,r)||(0===n.length&&(r.children=[{text:e.text().replace(/\s+/gm," ")}]),Ke.forEach(function(n){r=n(e[0],r,t)}))}),o}function Xe(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/[\r\n\t]+/g,"").replace(/<br>/g,"\n"));var n=e[0].textContent||"",r={text:n=Ue(n=E(n))};return Ke.forEach(function(n){r=n(e[0],r,t)}),r}function Ze(e,t){var n={text:""};return Ke.forEach(function(r){n=r(e[0],n,t)}),n}function Qe(e,t){var n=t.parentElement;return null==n?e:(null==n.closest("pre")&&(e=e.replace(/[\r\n\t]+/g,"")),e=Ue(e=E(e)))}function et(e,t){var n=v(v({},e),t);return Object.keys(t).forEach(function(e){!1===t[e]&&delete n[e]}),n}function tt(e,t,n){var r=e[0];if(Le(r)){var o=nt(e,n),i=v({},t);return delete i.text,Array.isArray(o)?o.map(function(e){return et(i,e)}):[et(i,o)]}return Te(r)?null:[et(t,De(r)?{text:Qe(r.textContent||"",r)}:Xe(e,n))]}function nt(e,t){ze.forEach(function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=s(r(e[0])))});var n=He(e);if("span"===n){if(e.attr("data-w-e-type"))return Ye(e,t);if((o=Array.from(e[0].childNodes)).some(function(e){return!De(e)&&!Te(e)})){var r=Ze(s(e[0]),t);return o.flatMap(function(e){return tt(s(e),r,t)||[]})}return Xe(e,t)}if("code"===n)return"pre"===He(e.parent())?Ye(e,t):Xe(e,t);if(Ve.includes(n)){var o;if((o=Array.from(e[0].childNodes)).some(function(e){return!De(e)&&!Te(e)})){var i=Ze(s(e[0]),t);return o.flatMap(function(e){return tt(s(e),i,t)||[]})}return Xe(e,t)}return Ye(e,t)}function rt(e,t,n){var r=s(n);return!!r.attr(t)||(r.attr(t,"true"),e.on(R.DESTROYED,function(){r.removeAttr(t)}),!1)}function ot(e,t){void 0===t&&(t="");var n=[],r=e.getConfig().sanitizeHtml;""===t&&(t="<p><br></p>"),0!==t.indexOf("<")&&(t=t.split(/\n/).map(function(e){return"<p>".concat(e,"</p>")}).join("")),t=r?r(t):t;var o=s("<div>".concat(t,"</div>"));return Array.from(o.children()).forEach(function(t){var r=nt(s(t),e);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}),n}function it(e,t){return"w-e-element-".concat(e,"-").concat(t)}var at=[];var st=[];function lt(e,t,n,r){return void 0===r&&(r={}),st.reduce(function(e,o){return o(e,t,n,r)},e)}var ct={};var ut=0,dt=function(){this.id="".concat(ut),ut+=1},ft="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),ht="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),pt="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),gt="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),vt="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),mt="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),yt=!vt&&!gt&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,bt=function(e,t){return Boolean(e.compareDocumentPosition(t)&he.DOCUMENT_POSITION_PRECEDING)},wt=function(e,t){return Boolean(e.compareDocumentPosition(t)&he.DOCUMENT_POSITION_FOLLOWING)},Et={getWindow:function(e){var t=ne.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},findKey:function(e,t){var n=te.get(t);return n||(n=new dt,te.set(t,n)),n},setNewKey:function(e){var t=new dt;te.set(e,t)},findPath:function(e,t){for(var n=[],r=t;;){var o=Y.get(r);if(null==o){if(i.Editor.isEditor(r))return n;break}var a=G.get(r);if(null==a)break;n.unshift(a),r=o}throw new Error("Unable to find the path for Slate node: ".concat(JSON.stringify(t)))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=Et.toDOMNode(e,e),n=t.getRootNode();return(we(n)||Ee(n))&&null!=Reflect.get(n,"getSelection")?n:t.ownerDocument},getParentNode:function(e,t){return Y.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=Et.getParentNode(e,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(e,t){var n=[Et.findPath(e,t)[0]];return i.Node.get(e,n)},toDOMNode:function(e,t){var n;if(i.Editor.isEditor(t))n=X.get(e);else{var r=Et.findKey(e,t);n=Q.get(r)}if(!n)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(JSON.stringify(t)));return n},hasDOMNodeBySlateNode:function(e,t){if(i.Editor.isEditor(t))return!!X.get(e);var n=Et.findKey(e,t);return!!Q.get(n)},canResolveDOMRange:function(e,t){try{var n=y(i.Editor.node(e,t.anchor.path),1)[0],r=y(i.Range.isCollapsed(t)?[n]:i.Editor.node(e,t.focus.path),1)[0];return Et.hasDOMNodeBySlateNode(e,n)&&Et.hasDOMNodeBySlateNode(e,r)}catch(e){return!1}},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Et.toDOMNode(e,e);try{r=Le(t)?t:t.parentElement}catch(e){if(e instanceof Error&&!e.message.includes('Permission denied to access property "nodeType"'))throw e}return!!r&&(r.closest("[data-slate-editor]")===a&&(!i||r.isContentEditable||r.closest('[contenteditable="false"]')===a||!!r.getAttribute("data-slate-zero-width"))||!!r.getAttribute("data-slate-string"))},toDOMRange:function(e,t){var n=t.anchor,r=t.focus,o=i.Range.isBackward(t),a=Et.toDOMPoint(e,n),s=i.Range.isCollapsed(t)?a:Et.toDOMPoint(e,r),l=Et.getWindow(e).document.createRange(),c=y(o?s:a,2),u=c[0],d=c[1],f=y(o?a:s,2),h=f[0],p=f[1],g=!!(Le(u)?u:u.parentElement).getAttribute("data-slate-zero-width"),v=!!(Le(h)?h:h.parentElement).getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(h,v?1:p),l},toDOMPoint:function(e,t){var n,r,o,a=y(i.Editor.node(e,t.path),1)[0],s=Et.toDOMNode(e,a);i.Editor.void(e,{at:t})&&(t={path:t.path,offset:0});var l=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),c=0;try{for(var u=m(l),d=u.next();!d.done;d=u.next()){var f=d.value,h=f.childNodes[0];if(null!=h&&null!=h.textContent){var p=h.textContent.length,g=f.getAttribute("data-slate-length"),v=c+(null==g?p:parseInt(g,10));if(t.offset<=v){o=[h,Math.min(p,Math.max(0,t.offset-c))];break}c=v}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}if(!o)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(JSON.stringify(t)));return o},toSlateNode:function(e,t){var n=Le(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Z.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},findEventRange:function(e,t){"nativeEvent"in t&&(t=t.nativeEvent);var n=t.clientX,r=t.clientY,o=t.target;if(null==n||null==r)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var a,s=Et.toSlateNode(e,t.target),l=Et.findPath(e,s);if(i.Element.isElement(s)&&i.Editor.isVoid(e,s)){var c=o.getBoundingClientRect(),u=e.isInline(s)?n-c.left<c.left+c.width-n:r-c.top<c.top+c.height-r,d=i.Editor.point(e,l,{edge:u?"start":"end"}),f=u?i.Editor.before(e,d):i.Editor.after(e,d);if(f)return i.Editor.range(e,f)}var h=this.getWindow(e).document;if(h.caretRangeFromPoint)a=h.caretRangeFromPoint(n,r);else{var p=h.caretPositionFromPoint(n,r);p&&((a=h.createRange()).setStart(p.offsetNode,p.offset),a.setEnd(p.offsetNode,p.offset))}if(!a)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return Et.toSlateRange(e,a,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,t,n){var r,o,a,s,l,c=n.exactMatch,u=n.suppressThrow;if((Me(t)?t.anchorNode:t.startContainer)&&(Me(t)?(r=t.anchorNode,o=t.anchorOffset,a=t.focusNode,s=t.focusOffset,l=mt&&Ae()?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed):(r=t.startContainer,o=t.startOffset,a=t.endContainer,s=t.endOffset,l=t.collapsed)),null==r||null==a||null==o||null==s){if(u)return null;throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t))}var d=Et.toSlatePoint(e,[r,o],{exactMatch:c,suppressThrow:u});if(!d)return null;var f=l?d:Et.toSlatePoint(e,[a,s],{exactMatch:c,suppressThrow:u,searchDirection:bt(r,a)||r===a&&s<o?"forward":"backward"});if(!f)return null;var h={anchor:d,focus:f};return i.Range.isExpanded(h)&&i.Range.isForward(h)&&Le(a)&&i.Editor.void(e,{at:h.focus,mode:"highest"})&&(h=i.Editor.unhangRange(e,h,{voids:!0})),h},toSlatePoint:function(e,t,n){var r,o,i,a,s=n.exactMatch,c=n.suppressThrow,u=y(s?t:Pe(t),2),d=u[0],f=u[1],h=d.parentNode,p=n.searchDirection,g=null,v=0;if(h){var w=Et.toDOMNode(e,e),E=h.closest('[data-slate-void="true"]'),x=E&&w.contains(E)?E:null,S=h.closest('[contenteditable="false"]'),C=S&&w.contains(S)?S:null,O=h.closest("[data-slate-leaf]"),N=null,k=Et.getWindow(e);if(O&&k.document.createRange){g=O.closest('[data-slate-node="text"]');var T=k.document.createRange();T.setStart(g,0),T.setEnd(d,f);var L=T.cloneContents();b(b([],y(l(L.querySelectorAll("[data-slate-zero-width]"))),!1),y(l(L.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(e){e.parentNode.removeChild(e)}),v=L.textContent.length,N=g}else if(x)(O=Array.from(x.querySelectorAll("[data-slate-leaf]")).find(function(t){return Et.hasDOMNode(e,t)})||null)?(g=O.closest('[data-slate-node="text"]'),v=(N=O).textContent.length,N.querySelectorAll("[data-slate-zero-width]").forEach(function(e){v-=e.textContent.length})):v=1;else if(C){var M=Boolean(C.closest("[data-w-e-reserve]"));!p&&M&&(p="forward");var D=p,R=function(t){return t?Array.from(t.querySelectorAll("[data-slate-leaf]")).filter(function(t){return Et.hasDOMNode(e,t)}):[]},P=C.closest('[data-slate-node="element"]');if("backward"===p||!p)for(var A=(F=b(b([],y(R(null==P?void 0:P.previousElementSibling)),!1),y(R(P)),!1)).length-1;A>=0;A-=1){var $=F[A];if(bt(C,$)){O=$,p="backward";break}}if(!O&&("forward"===p||!p||M)){var F=b(b([],y(R(P)),!1),y(R(null==P?void 0:P.nextElementSibling)),!1);try{for(var I=m(F),B=I.next();!B.done;B=I.next()){$=B.value;if(wt(C,$)){O=$,D="backward"===p&&M?"backward":"forward";break}}}catch(e){r={error:e}}finally{try{B&&!B.done&&(o=I.return)&&o.call(I)}finally{if(r)throw r.error}}}O&&(g=O.closest('[data-slate-node="text"]'),N=O,"forward"===D?v=0:(v=N.textContent.length,N.querySelectorAll("[data-slate-zero-width]").forEach(function(e){v-=e.textContent.length})))}N&&v===N.textContent.length&&(h.hasAttribute("data-slate-zero-width")||ht&&(null===(i=N.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(v-=1)}if(!g){if(c)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}try{var j=Et.toSlateNode(e,g);a=Et.findPath(e,j)}catch(e){if(c)return null;throw e}return{path:a,offset:v}},hasRange:function(e,t){var n=t.anchor,r=t.focus;return i.Editor.hasPath(e,n.path)&&i.Editor.hasPath(e,r.path)},getNodeType:function(e){return i.Element.isElement(e)?e.type:""},checkNodeType:function(e,t){return this.getNodeType(e)===t},getNodesStr:function(e){return e.map(function(e){return i.Node.string(e)}).join("")},getSelectedVoidNode:function(e){var t=e.selection;if(!t)return null;var n=i.Editor.void(e,{at:t});if(!n)return null;var r=y(n,1)[0];return i.Element.isElement(r)?r:null},getSelectedElems:function(e){var t,n,r=[],o=Et.getSelectedVoidNode(e);o&&r.push(o);var a=i.Editor.nodes(e,{universal:!0});try{for(var s=m(a),l=s.next();!l.done;l=s.next()){var c=y(l.value,1)[0];i.Element.isElement(c)&&c!==o&&r.push(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r},getSelectedNodeByType:function(e,t){var n=this,r=Et.getSelectedVoidNode(e);if(r&&this.checkNodeType(r,t))return r;var o=y(i.Editor.nodes(e,{match:function(e){return n.checkNodeType(e,t)},universal:!0}),1),a=o[0];return null==a?null:a[0]},getSelectedTextNode:function(e){var t=y(i.Editor.nodes(e,{match:function(e){return i.Text.isText(e)},universal:!0}),1),n=t[0];return null==n?null:n[0]},isNodeSelected:function(e,t){if(Et.getSelectedVoidNode(e)===t)return!0;var n=y(i.Editor.nodes(e,{match:function(e){return e===t},universal:!0}),1),r=n[0];return null!=r&&y(r,1)[0]===t},isSelectionAtLineEnd:function(e,t){var n=e.selection;return!!n&&(i.Editor.isEnd(e,n.anchor,t)||i.Editor.isEnd(e,n.focus,t))},getTextarea:function(e){var t=A.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return I.get(e)||null},getHoverbar:function(e){return j.get(e)||null},normalizeContent:function(e){e.children.forEach(function(t,n){e.normalizeNode([t,[n]])})},getLeftLengthOfMaxLength:function(e){var t=e.getConfig(),n=t.maxLength,r=t.onMaxLength;if("number"!=typeof n||n<=0)return 1/0;var o=n-e.getText().replace(/\r|\n|(\r\n)|(\n\r)/g,"").length;return o<=0&&r&&r(e),o},cleanExposedTexNodeInSelectionBlock:function(e){var t,n,r,o,a=Et.getTextarea(e).$textArea,l=null==a?void 0:a[0].childNodes;if(l)try{for(var c=m(Array.from(l)),u=c.next();!u.done;u=c.next()){var d=u.value;if(!De(d))break;d.remove()}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}var f=i.Editor.nodes(e,{match:function(t){return!(!i.Element.isElement(t)||e.isInline(t))},universal:!0});try{for(var h=m(f),p=h.next();!p.done;p=h.next()){var g=p.value;if(null!=g){var v=g[0];if(!Et.hasDOMNodeBySlateNode(e,v))continue;_e(Et.toDOMNode(e,v),function(e,t){var n=s(t);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||t.removeChild(e)})}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(r)throw r.error}}},isLastNode:function(e,t){var n=e.children||[];return n[n.length-1]===t},genEmptyParagraph:function(){return{type:"paragraph",children:[{text:""}]}},isSelectedVoidNode:function(e){return null!=Et.getSelectedVoidNode(e)},isSelectedEmptyParagraph:function(e){var t=e.selection;if(null==t)return!1;if(i.Range.isExpanded(t))return!1;var n=[t.focus.path[0]];if(!i.Editor.hasPath(e,n))return!1;var r=y(i.Editor.node(e,n),1)[0];if(!i.Element.isElement(r)||"paragraph"!==r.type)return!1;var o=r.children;return 1===o.length&&(""===o[0].text||void 0)},isEmptyPath:function(e,t){var n=i.Editor.node(e,t);if(null==n)return!1;var r=y(n,1)[0].children;if(1===r.length&&""===r[0].text)return!0;return!1}};function xt(e,t,n){var r=n.isInline(e)?"span":"div";return"<".concat(r,">").concat(t,"</").concat(r,">")}var St="data-w-e-id",Ct=/^[A-Za-z_:-][A-Za-z0-9_:.-]*$/;function Ot(e,t,n,r){if(!r.includeId)return e;var o=function(e){return e&&Ct.test(e)?e:St}(r.idKey),i=Et.findKey(n,t);return function(e,t,n){if(!e)return e;var r=e.match(/^<([A-Za-z][A-Za-z0-9-]*)([^>]*)>/);if(!r)return e;var o=y(r,3),i=o[0],a=o[1],s=o[2],l=void 0===s?"":s;if(new RegExp("\\s".concat(t,"=")).test(l))return e;var c=/\/\s*$/.test(l),u=l.replace(/\s*\/\s*$/,""),d=u.trim()?" ".concat(u.trim()):"",f=c?" /":"";return"<".concat(a).concat(d," ").concat(t,'="').concat(n,'"').concat(f,">")+e.slice(i.length)}(e,o,it(Et.getNodeType(t),i.id))}function Nt(e,t,n){void 0===n&&(n={});var r=e.type,o=void 0===r?"":r,a=e.children,s=void 0===a?[]:a,l=i.Editor.isVoid(t,e),c="";l||(c=s.map(function(e){return kt(e,t,n)}).join(""));var u=function(e){return ct[e]||xt}(o),d=u(e,c,t),f="";if(f="string"==typeof d?d:d.html||"",l||at.forEach(function(n){return f=n(e,f,t)}),f=Ot(f,e,t,n),"string"==typeof d)return f;var h=d.prefix,p=void 0===h?"":h,g=d.suffix,v=void 0===g?"":g;return p&&(f=p+f),v&&(f+=v),f}function kt(e,t,n){return void 0===n&&(n={}),i.Element.isElement(e)?Nt(e,t,n):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=n;r=function(e){return e.replace(/ {2}/g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™")}(r);var o=Et.getParentsNodes(t,e).some(function(e){return"pre"===Et.getNodeType(e)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/ /g," ")),""===r){var i=Et.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>"}return at.forEach(function(n){return r=n(e,r,t)}),r}(e,t)}var Tt=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Lt=function(e,t,n){var r=Et.toDOMRange(e,t).getBoundingClientRect(),o=Et.toDOMRange(e,n).getBoundingClientRect();return Tt(r,o)&&Tt(o,r)},Mt=function(e,t){var n,r,o=[];try{for(var a=m(i.Editor.levels(e,{at:t})),s=a.next();!s.done;s=a.next()){var l=y(s.value,2),c=l[0],u=l[1],d=Et.findKey(e,c);o.push([u,d])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o};var Dt=function(e){var t=e,n=t.onChange,r=t.insertText,o=t.apply,a=t.deleteBackward,l=t.deleteFragment;return t.insertText=function(e){t.getConfig().readOnly||r(e)},t.apply=function(e){var n,r,a,s,l,c,u,d,f=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":case"split_node":f.push.apply(f,b([],y(Mt(t,e.path)),!1));break;case"insert_node":case"remove_node":f.push.apply(f,b([],y(Mt(t,i.Path.parent(e.path))),!1));break;case"merge_node":var h=i.Path.previous(e.path);f.push.apply(f,b([],y(Mt(t,h)),!1));break;case"move_node":var p=i.Path.common(i.Path.parent(e.path),i.Path.parent(e.newPath));f.push.apply(f,b([],y(Mt(t,p)),!1));break;case"set_selection":(null===(s=null===(a=e.newProperties)||void 0===a?void 0:a.focus)||void 0===s?void 0:s.path)&&(f.push.apply(f,b([],y(Mt(t,null===(c=null===(l=e.newProperties)||void 0===l?void 0:l.focus)||void 0===c?void 0:c.path)),!1)),f.push.apply(f,b([],y(Mt(t,null===(d=null===(u=e.properties)||void 0===u?void 0:u.focus)||void 0===d?void 0:d.path)),!1)))}o(e);try{for(var g=m(f),v=g.next();!v.done;v=g.next()){var w=y(v.value,2),E=w[0],x=w[1],S=y(i.Editor.node(t,E),1)[0];te.set(S,x),"type"in S&&(q.has(S)&&q.delete(S),J.has(S)&&J.delete(S))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}},t.deleteBackward=function(n){if("line"!==n)return a(n);if(e.selection&&i.Range.isCollapsed(e.selection)){var r=i.Editor.above(e,{match:function(t){return i.Element.isElement(t)&&i.Editor.isBlock(e,t)},at:e.selection});if(r){var o=y(r,2)[1],s=i.Editor.range(e,o,e.selection.anchor),l=function(e,t){var n=i.Editor.range(e,i.Range.end(t)),r=Array.from(i.Editor.positions(e,{at:t})),o=0,a=r.length,s=Math.floor(a/2);if(Lt(e,i.Editor.range(e,r[o]),n))return i.Editor.range(e,r[o],n);if(r.length<2)return i.Editor.range(e,r[r.length-1],n);for(;s!==r.length&&s!==o;)Lt(e,i.Editor.range(e,r[s]),n)?a=s:o=s,s=Math.floor((o+a)/2);return i.Editor.range(e,r[a],n)}(t,s);i.Range.isCollapsed(l)||i.Transforms.delete(e,{at:l})}}},t.deleteFragment=function(e){var n=function(e){var t=e.selection;if(null==t||i.Range.isCollapsed(t))return!1;var n=y(i.Range.edges(t),2),r=n[0],o=n[1],a=y(i.Editor.edges(e,[]),2),s=a[0],l=a[1];return i.Point.equals(r,s)&&i.Point.equals(o,l)}(t);l(e),n&&(!function(e){var t=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){for(var n=e.children.length-1;n>=0;n-=1)i.Transforms.removeNodes(e,{at:[n]});i.Transforms.insertNodes(e,t,{at:[0]})})}(t),t.children.length>0&&i.Transforms.select(t,i.Editor.start(t,[])))},t.onChange=function(){var e=t.selection;null!=e&&oe.set(t,e),t.emit(R.CHANGE),n()},t.handleTab=function(){t.insertText(" ")},t.getHtml=function(){var e=t.children,n=void 0===e?[]:e,r=t.getConfig().skipCacheTypes,o=void 0===r?["list-item"]:r;return lt(n.map(function(e){var n=Et.getNodeType(e);if(o.includes(n))return kt(e,t);var r=J.get(e);if(r)return r.toString();var i=kt(e,t);return J.set(e,i),i}),n,t).join("")},t.getHtmlWithId=function(e){void 0===e&&(e="data-w-e-id");var n=t.children,r=void 0===n?[]:n;return lt(r.map(function(n){return kt(n,t,{includeId:!0,idKey:e})}),r,t,{includeId:!0,idKey:e}).join("")},t.getText=function(){var e=t.children;return(void 0===e?[]:e).map(function(e){return i.Node.string(e)}).join("\n")},t.getSelectionText=function(){var n=t.selection;return null==n?"":i.Editor.string(e,n)},t.getElemsByType=function(e,n){var r,o;void 0===n&&(n=!1);var a=[],s=i.Editor.nodes(t,{at:[],universal:!0});try{for(var l=m(s),c=l.next();!c.done;c=l.next()){var u=y(c.value,1)[0];if(i.Element.isElement(u))if(n?u.type.indexOf(e)>=0:u.type===e){var d=Et.findKey(t,u),f=it(u.type,d.id);a.push(v(v({},u),{id:f}))}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return a},t.getElemsByTypePrefix=function(e){return t.getElemsByType(e,!0)},t.isEmpty=function(){var e=t.children,n=void 0===e?[]:e;if(n.length>1)return!1;var r=n[0];if(null==r)return!0;if(!i.Element.isElement(r)||"paragraph"!==r.type)return!1;var o=r.children,a=void 0===o?[]:o;if(a.length>1)return!1;var s=a[0];return null==s||i.Text.isText(s)&&""===s.text},t.clear=function(){for(var e=t.children.length-1;e>=0;e-=1)i.Transforms.removeNodes(t,{at:[e]});0!==t.children.length?function(e){var t=e.children[0];if(1===e.children.length&&i.Element.isElement(t)&&("paragraph"!==t.type||""!==i.Node.string(t))&&""===i.Node.string(t)){var n=[{type:"paragraph",children:[{text:""}]}];i.Editor.withoutNormalizing(e,function(){i.Transforms.removeNodes(e,{at:[0]}),i.Transforms.insertNodes(e,n,{at:[0]})})}}(t):i.Transforms.insertNodes(t,[{type:"paragraph",children:[{text:""}]}])},t.getParentNode=function(e){return Et.getParentNode(t,e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e){var r=document.createElement("div");r.innerHTML=e;var o=Array.from(r.childNodes);if(o=o.filter(function(e){var t=e.nodeName;return!!De(e)||!!Le(e)&&!ue.has(t.toLowerCase())}),0!==o.length){var a=t.selection;if(null!=a){var l=null;if(Et.isSelectedEmptyParagraph(t)&&!n)l=[a.focus.path[0]];r.setAttribute("hidden","true"),document.body.appendChild(r);var c=0;o.forEach(function(e,n){var r=e.nodeName,a=e.textContent,l=void 0===a?"":a;if(De(e)){if(!l||!l.trim())return;t.insertNode({text:l})}else if("BR"!==r){var u=e,d=!1;if(Ve.includes(r.toLowerCase()))d=!0;else for(var f in qe)if(u.matches(f)){d=!0;break}if(d){var h=nt(s(u),t),p=Array.isArray(h)?h:[h];if(p.forEach(function(e){return function(e,t){if(i.Text.isText(t))e.insertNode(t);else if(i.Element.isElement(t))if(e.isInline(t))e.insertNode(t),"link"===t.type&&e.insertFragment([{text:""}]);else{var n=e.selection;if(!n)return;var r=[n.focus.path[0]];if(Et.isSelectedEmptyParagraph(e))return i.Transforms.removeNodes(e,{at:r}),i.Transforms.insertNodes(e,t,{at:r}),void i.Transforms.select(e,i.Editor.end(e,r));var o=i.Path.next(r);i.Transforms.insertNodes(e,t,{at:o}),i.Transforms.select(e,i.Editor.end(e,o))}}(t,e)}),c+=p.length,Et.isSelectedVoidNode(t)&&t.move(1),p.some(function(e){return!!i.Element.isElement(e)&&(!!t.isInline(e)||e.children.some(function(e){return i.Element.isElement(e)&&t.isInline(e)}))})&&t.selection){var g=i.Editor.nodes(t,{at:t.selection,match:function(e){return i.Element.isElement(e)&&t.isInline(e)},universal:!0}).next().value;if(g){var v=y(g,2)[1],m=i.Path.next(v);i.Editor.hasPath(t,m)?i.Transforms.select(t,{anchor:{path:m,offset:0},focus:{path:m,offset:0}}):t.move(1)}}}else{var b=window.getComputedStyle(u).display;if(!Et.isSelectedEmptyParagraph(t)&&b.indexOf("inline")<0){if(n>=1){var w=o[n-1];Ce(w)&&t.insertBreak()}t.insertBreak()}t.dangerouslyInsertHtml(u.innerHTML,!0)}}else t.insertText("\n")}),c&&l&&Et.isEmptyPath(t,l)&&i.Transforms.removeNodes(t,{at:l}),r.remove()}}}},t.setHtml=function(e){void 0===e&&(e="");var n=t.isDisabled(),r=t.isFocused(),o=JSON.stringify(t.selection);t.enable(),oe.delete(t),t.focus(),t.clear();var a=ot(t,null==e?"":e);if(i.Transforms.insertFragment(t,a),r||(t.deselect(),t.blur()),n&&(t.deselect(),t.disable()),t.isFocused())try{var s=JSON.parse(o);i.Range.isRange(s)&&Et.hasRange(t,s)?t.select(s):t.select(i.Editor.start(t,[]))}catch(e){t.select(i.Editor.start(t,[]))}},t},Rt=1,Pt=function(e){var t=e;return t.id="wangEditor-".concat(Rt),Rt+=1,t.isDestroyed=!1,t.isFullScreen=!1,t.focus=function(e){if(Et.toDOMNode(t,t).focus({preventScroll:!0}),re.set(t,!0),e){var n=i.Editor.end(t,[]);i.Transforms.select(t,n)}else{var r=oe.get(t);r?i.Transforms.select(t,r):i.Transforms.select(t,i.Editor.start(t,[]))}},t.isFocused=function(){return!!re.get(t)},t.blur=function(){Et.toDOMNode(t,t).blur(),i.Transforms.deselect(t),re.set(t,!1)},t.updateView=function(){Et.getTextarea(t).changeViewState();var e=Et.getToolbar(t);e&&e.changeToolbarState();var n=Et.getHoverbar(t);n&&n.changeHoverbarState()},t.destroy=function(){if(!t.isDestroyed){var e=Et.getTextarea(t);e.destroy(),A.delete(t),$.delete(e);var n=Et.getToolbar(t);n&&(n.destroy(),I.delete(t),F.delete(n));var r=Et.getHoverbar(t);r&&(r.destroy(),j.delete(t),B.delete(r)),t.isDestroyed=!0,t.emit(R.DESTROYED)}},t.scrollToElem=function(e){if(!t.getConfig().scroll){var n="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return n+="\nYou has disabled editor scroll, please do this yourself",void console.warn(n)}var r=s("#".concat(e));if(0!==r.length){var o=r[0];if(!Et.hasDOMNode(t,o)){n="Element (found by id is '".concat(e,"') is not in editor DOM");return n+="\n 通过 id '".concat(e,"' 找到的 element 不在 editor DOM 之内"),void console.error(n,o)}var i=Et.getTextarea(t),a=i.$textAreaContainer,l=i.$scroll,c=r.offset().top,u=a.offset().top;l[0].scrollBy({top:c-u,behavior:"smooth"})}},t.showProgressBar=function(e){e<1||Et.getTextarea(t).changeProgress(e)},t.hidePanelOrModal=function(){var e=H.get(t);null!=e&&e.forEach(function(e){return e.hide()})},t.enable=function(){t.getConfig().readOnly=!1,t.updateView()},t.disable=function(){t.getConfig().readOnly=!0,t.updateView()},t.isDisabled=function(){return t.getConfig().readOnly},t.toDOMNode=function(e){return Et.toDOMNode(t,e)},t.fullScreen=function(){if(!t.isFullScreen){var e=null,n=Et.getToolbar(t);n&&(e=n.$box);var r=Et.getTextarea(t).$box.parent();if(e&&e.parent()[0]!==r[0]){throw new Error("Can not set full screen, cause toolbar DOM parent is not equal to textarea DOM parent\n不能设置全屏,因为 toolbar DOM 父节点和 textarea DOM 父节点不一致")}r.addClass("w-e-full-screen-container");var o=r.css("z-index");r.attr("data-z-index",o.toString()),t.isFullScreen=!0,t.emit(R.FULLSCREEN)}},t.unFullScreen=function(){if(t.isFullScreen){var e=Et.getTextarea(t).$box.parent();setTimeout(function(){e.removeClass("w-e-full-screen-container"),t.isFullScreen=!1,t.emit(R.UNFULLSCREEN)},200)}},t.getEditableContainer=function(){return Et.getTextarea(t).$textAreaContainer[0]},t};function At(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $t,Ft,It,Bt,jt,_t,Ht,Wt,Ut,Vt,zt,Kt,qt,Jt,Gt,Yt,Xt,Zt,Qt,en,tn,nn,rn,on,an,sn,ln,cn,un,dn,fn,hn,pn,gn,vn,mn,yn,bn,wn,En,xn={exports:{}},Sn={exports:{}};function Cn(){if(Ft)return $t;Ft=1;return $t=function(e){return null!=e}}function On(){if(_t)return jt;_t=1;var e=function(){if(Bt)return It;Bt=1;var e=Cn(),t={object:!0,function:!0,undefined:!0};return It=function(n){return!!e(n)&&hasOwnProperty.call(t,typeof n)}}();return jt=function(t){if(!e(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(e){return!1}}}function Nn(){if(Vt)return Ut;Vt=1;var e=function(){if(Wt)return Ht;Wt=1;var e=On();return Ht=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(e){return!1}return!e(t)}}(),t=/^\s*class[\s{/}]/,n=Function.prototype.toString;return Ut=function(r){return!!e(r)&&!t.test(n.call(r))}}function kn(){if(Zt)return Xt;Zt=1;var e=(Yt?Gt:(Yt=1,Gt=function(){}))();return Xt=function(t){return t!==e&&null!==t}}function Tn(){return nn||(nn=1,tn=(Jt?qt:(Jt=1,qt=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(en)return Qt;en=1;var e=kn(),t=Object.keys;return Qt=function(n){return t(e(n)?Object(n):n)}}()),tn}function Ln(){if(sn)return an;sn=1;var e=Tn(),t=function(){if(on)return rn;on=1;var e=kn();return rn=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return an=function(r,o){var i,a,s,l=n(arguments.length,2);for(r=Object(t(r)),s=function(e){try{r[e]=o[e]}catch(e){i||(i=e)}},a=1;a<l;++a)e(o=arguments[a]).forEach(s);if(void 0!==i)throw i;return r},an}function Mn(){return cn?ln:(cn=1,ln=(Kt||(Kt=1,zt=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}),zt)()?Object.assign:Ln())}function Dn(){return mn||(mn=1,vn=function(){if(hn)return fn;hn=1;var e="razdwatrzy";return fn=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}}()()?String.prototype.contains:function(){if(gn)return pn;gn=1;var e=String.prototype.indexOf;return pn=function(t){return e.call(this,t,arguments[1])>-1},pn}()),vn}function Rn(){if(yn)return Sn.exports;yn=1;var e=Cn(),t=Nn(),n=Mn(),r=function(){if(dn)return un;dn=1;var e=kn(),t=Array.prototype.forEach,n=Object.create;return un=function(r){var o=n(null);return t.call(arguments,function(t){e(t)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(t),o)}),o},un}(),o=Dn(),i=Sn.exports=function(t,i){var a,s,l,c,u;return arguments.length<2||"string"!=typeof t?(c=i,i=t,t=null):c=arguments[2],e(t)?(a=o.call(t,"c"),s=o.call(t,"e"),l=o.call(t,"w")):(a=l=!0,s=!1),u={value:i,configurable:a,enumerable:s,writable:l},c?n(r(c),u):u};return i.gs=function(i,a,s){var l,c,u,d;return"string"!=typeof i?(u=s,s=a,a=i,i=null):u=arguments[3],e(a)?t(a)?e(s)?t(s)||(u=s,s=void 0):s=void 0:(u=a,a=s=void 0):a=void 0,e(i)?(l=o.call(i,"c"),c=o.call(i,"e")):(l=!0,c=!1),d={get:a,set:s,configurable:l,enumerable:c},u?n(r(u),d):d},Sn.exports}var Pn=(En||(En=1,function(e,t){var n,r,o,i,a,s,l,c=Rn(),u=wn?bn:(wn=1,bn=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}),d=Function.prototype.apply,f=Function.prototype.call,h=Object.create,p=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var r,i;return u(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},i=function(e){var t,n,r,o,i;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;r=o[t];++t)d.call(r,this,i)}else switch(arguments.length){case 1:f.call(o,this);break;case 2:f.call(o,this,arguments[1]);break;case 3:f.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];d.call(o,this,i)}},a={on:n=function(e,t){var n;return u(t),v.call(this,"__ee__")?n=this.__ee__:(n=m.value=h(null),p(this,"__ee__",m),m.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:r,off:o=function(e,t){var n,r,o,i;if(u(t),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(i=0;o=r[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===r.length?n[e]=r[i?0:1]:r.splice(i,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},emit:i},s={on:c(n),once:c(r),off:c(o),emit:c(i)},l=g({},s),e.exports=t=function(e){return null==e?h(l):g(Object(e),s)},t.methods=a}(xn,xn.exports)),xn.exports),An=At(Pn);function $n(e){var t=ie.get(e);return null==t&&(t=An(),ie.set(e,t)),t}var Fn=new WeakMap;function In(e,t){var n=Fn.get(e);null==n&&(n=new Set,Fn.set(e,n)),n.add(t)}var Bn=function(e){var t=e;return t.on=function(e,n){var r=$n(t);if(r.on(e,n),"destroyed"===e&&In(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),In(t,o)}},t.once=function(e,n){$n(t).once(e,n)},t.off=function(e,n){$n(t).off(e,n)},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=$n(t);if(o.emit.apply(o,b([e],y(n),!1)),"destroyed"===e){var i=function(e){return Fn.get(e)||new Set}(t);i.forEach(function(e){return o.off("destroyed",e)}),function(e){Fn.set(e,new Set)}(t)}},t};var jn,_n=function(e){var t=e;return t.setFragmentData=function(e){var n=t.selection;if(n){var r=y(i.Range.edges(n),2),o=r[0],a=r[1],s=i.Editor.void(t,{at:o.path}),l=i.Editor.void(t,{at:a.path});if(!i.Range.isCollapsed(n)||s){var c=Et.toDOMRange(t,n),u=c.cloneContents(),d=u.childNodes[0];if(u.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(d=e)}),l){var f=y(l,1)[0],h=c.cloneRange(),p=Et.toDOMNode(t,f);h.setEndAfter(p),u=h.cloneContents()}if(s&&(d=u.querySelector("[data-slate-spacer]")),Array.from(u.querySelectorAll("[data-slate-zero-width]")).forEach(function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":""}),De(d)){var g=d.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(d),u.appendChild(g),d=g}var v=t.getFragment(),m=JSON.stringify(v),b=window.btoa(encodeURIComponent(m));d.setAttribute("data-slate-fragment",b),e.setData("application/x-slate-fragment",b);var w=u.ownerDocument.createElement("div");return w.appendChild(u),w.setAttribute("hidden","true"),u.ownerDocument.body.appendChild(w),e.setData("text/html",w.innerHTML),e.setData("text/plain",Be(w)),u.ownerDocument.body.removeChild(w),e}}},t.insertData=function(e){var n=e.getData("application/x-slate-fragment");if(n){var r=decodeURIComponent(window.atob(n)),o=JSON.parse(r);t.insertFragment(o)}else{var i=e.getData("text/plain"),a=e.getData("text/html");if(a){var s=t.getConfig().sanitizeHtml;t.dangerouslyInsertHtml(s?s(a):a)}else if(i){if(!/[\r\n]/.test(i))return void t.insertText(i);var l=function(e){return e.replace(/\n\r|\r\n|\r/g,"\n").split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}})}(i);t.insertFragment(l)}}},t},Hn={};function Wn(){if(jn)return Hn;jn=1;var e=i,t={isHistory:function(t){return e.isObject(t)&&Array.isArray(t.redos)&&Array.isArray(t.undos)&&(0===t.redos.length||e.Operation.isOperationList(t.redos[0].operations))&&(0===t.undos.length||e.Operation.isOperationList(t.undos[0].operations))}},n=new WeakMap,r=new WeakMap,o=new WeakMap,a=new WeakMap,s={isHistoryEditor:function(n){return t.isHistory(n.history)&&e.Editor.isEditor(n)},isMerging:function(e){return o.get(e)},isSplittingOnce:function(e){return a.get(e)},setSplittingOnce:function(e,t){a.set(e,t)},isSaving:function(e){return r.get(e)},redo:function(e){e.redo()},undo:function(e){e.undo()},withMerging:function(e,t){var n=s.isMerging(e);o.set(e,!0),t(),o.set(e,n)},withNewBatch:function(e,t){var n=s.isMerging(e);o.set(e,!0),a.set(e,!0),t(),o.set(e,n),a.delete(e)},withoutMerging:function(e,t){var n=s.isMerging(e);o.set(e,!1),t(),o.set(e,n)},withoutSaving:function(e,t){var n=s.isSaving(e);r.set(e,!1);try{t()}finally{r.set(e,n)}}};function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(t,n){return!(!n||"insert_text"!==t.type||"insert_text"!==n.type||t.offset!==n.offset+n.text.length||!e.Path.equals(t.path,n.path))||!(!n||"remove_text"!==t.type||"remove_text"!==n.type||t.offset+t.text.length!==n.offset||!e.Path.equals(t.path,n.path))},d=function(e,t){return"set_selection"!==e.type};return Hn.HISTORY=n,Hn.History=t,Hn.HistoryEditor=s,Hn.MERGING=o,Hn.SAVING=r,Hn.SPLITTING_ONCE=a,Hn.withHistory=function(t){var n=t,r=n.apply;return n.history={undos:[],redos:[]},n.redo=function(){var t=n.history,r=t.redos;if(r.length>0){var o=r[r.length-1];o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore),s.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var e,t=l(o.operations);try{for(t.s();!(e=t.n()).done;){var r=e.value;n.apply(r)}}catch(e){t.e(e)}finally{t.f()}})}),t.redos.pop(),n.writeHistory("undos",o)}},n.undo=function(){var t=n.history,r=t.undos;if(r.length>0){var o=r[r.length-1];s.withoutSaving(n,function(){e.Editor.withoutNormalizing(n,function(){var t,r=l(o.operations.map(e.Operation.inverse).reverse());try{for(r.s();!(t=r.n()).done;){var i=t.value;n.apply(i)}}catch(e){r.e(e)}finally{r.f()}o.selectionBefore&&e.Transforms.setSelection(n,o.selectionBefore)})}),n.writeHistory("redos",o),t.undos.pop()}},n.apply=function(e){var t=n.operations,o=n.history,i=o.undos,a=i[i.length-1],l=a&&a.operations[a.operations.length-1],c=s.isSaving(n),f=s.isMerging(n);if(null==c&&(c=d(e)),c){if(null==f&&(f=null!=a&&(!!t.includes(l)||u(e,l))),s.isSplittingOnce(n)&&(f=!1,s.setSplittingOnce(n,void 0)),a&&f)a.operations.push(e);else{var h={operations:[e],selectionBefore:n.selection};n.writeHistory("undos",h)}for(;i.length>100;)i.shift();o.redos=[]}r(e)},n.writeHistory=function(e,t){n.history[e].push(t)},n},Hn}var Un=Wn(),Vn=function(e){var t=Un.withHistory(e);return t.clearHistory=function(){t.history.undos=[],t.history.redos=[]},t};function zn(e){return e.replace(/\n\r|\r\n|\r|\n/g,"").length}function Kn(e,t){var n,r;if(t<=0)return"";var o=t,i="";try{for(var a=m(e),s=a.next();!s.done;s=a.next()){var l=s.value;if(/\r|\n/.test(l))i+=l;else{if(o<=0)break;i+=l,o-=1}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}var qn=function(e){var t=e,n=t.insertText,r=t.insertNode,o=t.insertFragment,a=t.dangerouslyInsertHtml;return t.insertText=function(e){if(t.getConfig().maxLength){var r=Et.getLeftLengthOfMaxLength(t);r<=0||(r<e.length?n(e.slice(0,r)):n(e))}else n(e)},t.insertNode=function(e){if(t.getConfig().maxLength){var n=Et.getLeftLengthOfMaxLength(t);if(!(n<=0))n<i.Node.string(e).length||r(e)}else r(e)},t.insertFragment=function(e){if(t.getConfig().maxLength){if(e.length>0){var n=e[0];if(Et.getLeftLengthOfMaxLength(t)<i.Node.string(n).length)return;o([n]);for(var r=1;r<e.length;r+=1)t.insertNode(e[r])}}else o(e)},t.dangerouslyInsertHtml=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=!1),e)if(t.getConfig().maxLength){var r=Et.getLeftLengthOfMaxLength(t);if(!(r<=0)){var o=function(e,t){if(t<=0)return"";var n=document.createElement("div");n.innerHTML=e;var r=function(e){e.forEach(function(e){return e.remove()})},o=function(e){for(var n=Array.from(e.childNodes),i=0;i<n.length;i+=1){var a=n[i];if(De(a)){var s=a.textContent||"",l=zn(s);if(l<=t){t-=l;continue}return a.textContent=Kn(s,t),t=0,r(n.slice(i+1)),!1}if(Le(a)){if(ue.has(a.nodeName.toLowerCase())){a.remove();continue}if(!o(a))return r(n.slice(i+1)),!1}else a.remove()}return t>0};return o(n),n.innerHTML}(e,r);o&&a(o,n)}}else a(e,n)},t};function Jn(e){return e<0?0:e}function Gn(e){var t=Et.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return{top:o.top,left:o.left,width:n,height:r}}function Yn(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=Gn(e);if(null==r)return t;var o=r.top,i=r.left,a=r.width,s=r.height,l=Et.toDOMRange(e,n).getClientRects(),c=l?l[0]:null;if(null==c)return t;var u={},d=c.top-o,f=c.left-i;if(f>a/2){var h=Jn(a-f);u.right="".concat(h+5,"px")}else{var p=Jn(f);u.left="".concat(p+5,"px")}if(d>s/2){var g=Jn(s-d);u.bottom="".concat(g+5,"px")}else{var v=l[l.length-1],m=v.top-o+v.height;m<0&&(m=0),u.top="".concat(m+5,"px")}return u}function Xn(e,t,n){void 0===n&&(n="modal");var r={top:"0",left:"0"};if(null==e.selection)return r;var o=i.Element.isElement(t)&&e.isVoid(t),a=i.Element.isElement(t)&&e.isInline(t),s=ee.get(t);if(null==s)return r;var l=s.getBoundingClientRect(),c=l.top,u=l.left,d=l.height,f=l.width;if(o){var h=je(s);if(null!=h){var p=h.getBoundingClientRect();c=p.top,d=p.height}}var g=Gn(e);if(null==g)return r;var v=g.top,m=g.left,y=g.width,b=g.height,w={},E=c-v,x=u-m;if("bar"===n){if(w.left="".concat(Jn(x),"px"),E>40){var S=Jn(b-E);w.bottom="".concat(S+5,"px")}else w.top="".concat(E+d+5,"px");return w}if("modal"===n){if(o)if(a)if(x>(y-f)/2){var C=Jn(y-x);w.right="".concat(C+5,"px")}else{var O=Jn(x+f);w.left="".concat(O+5,"px")}else w.left="20px";else w.left="".concat(Jn(x),"px");if(o)(N=E)<0&&(N=0),w.top="".concat(N,"px");else if(E>(b-d)/2){S=Jn(b-E);w.bottom="".concat(S+5,"px")}else{var N;(N=E+d)<0&&(N=0),w.top="".concat(N+5,"px")}return w}throw new Error("type '".concat(n,"' is invalid"))}function Zn(e,t){w(function(){var n=Gn(e);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,l=t.offset(),c=l.top,u=l.left,d=t.width(),f=t.height(),h=c-o,p=u-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=h+f-s)>0){var v=t.css("top"),m=parseInt(v.toString(),10)-r;m<0&&(m=0),t.css("top","".concat(m,"px"))}if(g.indexOf("bottom")>=0&&c<0){var y=t.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(c);t.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=p+d-a)>0){var w=t.css("left"),E=parseInt(w.toString(),10)-r;E<0&&(E=0),t.css("left","".concat(E,"px"))}if(g.indexOf("right")>=0&&p<0){var x=t.css("right"),S=parseInt(x.toString(),10)-Math.abs(p);t.css("right","".concat(S,"px"))}}})}var Qn=function(e){var t=e,n=t.select,r=t.deselect,o=t.move;return t.select=function(e){n(e)},t.deselect=function(){var e=t.selection,n=Et.findDocumentOrShadowRoot(t).getSelection();n&&n.rangeCount>0&&Et.hasDOMNode(t,n.anchorNode)&&Et.hasDOMNode(t,n.focusNode)&&n.removeAllRanges(),e&&r()},t.move=function(e,t){void 0===t&&(t=!1),"number"==typeof e?e&&(e<0||o({distance:e,unit:"character",reverse:t})):o(e)},t.moveReverse=function(e){t.move(e,!0)},t.restoreSelection=function(){var e=oe.get(t);null!=e&&(t.focus(),n(e))},t.getSelectionPosition=function(){return Yn(t)},t.getNodePosition=function(e){return Xn(t,e)},t.isSelectedAll=function(){var e=t.selection;if(null==e)return!1;var n=y(i.Range.edges(e),2),r=n[0],o=n[1],a=y(i.Editor.edges(t,[]),2),s=a[0],l=a[1];return!(!i.Point.equals(r,s)||!i.Point.equals(o,l))},t.selectAll=function(){var e=i.Editor.start(t,[]),r=i.Editor.end(t,[]);n({anchor:e,focus:r})},t};const er=e=>"string"==typeof e,tr=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},nr=e=>null==e?"":""+e,rr=/###/g,or=e=>e&&e.indexOf("###")>-1?e.replace(rr,"."):e,ir=e=>!e||er(e),ar=(e,t,n)=>{const r=er(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(ir(e))return{};const t=or(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return ir(e)?{}:{obj:e,k:or(r[o])}},sr=(e,t,n)=>{const{obj:r,k:o}=ar(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let i=t[t.length-1],a=t.slice(0,t.length-1),s=ar(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),s=ar(e,a,Object),s&&s.obj&&void 0!==s.obj[`${s.k}.${i}`]&&(s.obj=void 0);s.obj[`${s.k}.${i}`]=n},lr=(e,t)=>{const{obj:n,k:r}=ar(e,t);if(n)return n[r]},cr=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?er(e[r])||e[r]instanceof String||er(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):cr(e[r],t[r],n):e[r]=t[r]);return e},ur=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var dr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const fr=e=>er(e)?e.replace(/[&<>"'\/]/g,e=>dr[e]):e;const hr=[" ",",","?","!",";"],pr=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),gr=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let o=e;for(let e=0;e<r.length;){if(!o||"object"!=typeof o)return;let t,i="";for(let a=e;a<r.length;++a)if(a!==e&&(i+=n),i+=r[a],t=o[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<r.length-1)continue;e+=a-e+1;break}o=t}return o},vr=e=>e&&e.replace("_","-"),mr={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class yr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||mr,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,r){return r&&!this.debug?null:(er(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new yr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new yr(this.logger,e)}}var br=new yr;class wr{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(e=>{let[t,r]=e;for(let e=0;e<r;e++)t(...n)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(t=>{let[r,o]=t;for(let t=0;t<o;t++)r.apply(r,[e,...n])})}}}class Er extends wr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],n&&(Array.isArray(n)?a.push(...n):er(n)&&o?a.push(...n.split(o)):a.push(n)));const s=lr(this.data,a);return!s&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),!s&&i&&er(n)?gr(this.data&&this.data[e]&&this.data[e][t],n,o):s}addResource(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."),r=t,t=a[1]),this.addNamespaces(t),sr(this.data,a,r),o.silent||this.emit("added",e,t,n,r)}addResources(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const r in n)(er(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),r=n,n=t,t=a[1]),this.addNamespaces(t);let s=lr(this.data,a)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?cr(s,n,o):s={...s,...n},sr(this.data,a,s),i.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var xr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(e=>{this.processors[e]&&(t=this.processors[e].process(t,n,r,o))}),t}};const Sr={};class Cr extends wr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=br.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const n=this.resolve(e,t);return n&&void 0!==n.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=hr.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===r.length)return!0;const o=pr.getRegExp(`(${r.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!o.test(e);if(!i){const t=e.indexOf(n);t>0&&!o.test(e.substring(0,t))&&(i=!0)}return i})(e,n,r));if(i&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:er(o)?[o]:o};const i=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(i[0])>-1)&&(o=i.shift()),e=i.join(r)}return{key:e,namespaces:er(o)?[o]:o}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const r=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:i,namespaces:a}=this.extractFromKey(e[e.length-1],t),s=a[a.length-1],l=t.lng||this.language,c=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(c){const e=t.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:`${s}${e}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:i}const u=this.resolve(e,t);let d=u&&u.res;const f=u&&u.usedKey||i,h=u&&u.exactUsedKey||i,p=Object.prototype.toString.apply(d),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!er(d)&&"boolean"!=typeof d&&"number"!=typeof d;if(!(v&&d&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(p)<0)||er(g)&&Array.isArray(d))if(v&&er(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,e,t,n));else{let r=!1,a=!1;const c=void 0!==t.count&&!er(t.count),f=Cr.hasDefaultValue(t),h=c?this.pluralResolver.getSuffix(l,t.count,t):"",p=t.ordinal&&c?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",g=c&&!t.ordinal&&0===t.count&&this.pluralResolver.shouldUseIntlApi(),v=g&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${h}`]||t[`defaultValue${p}`]||t.defaultValue;!this.isValidLookup(d)&&f&&(r=!0,d=v),this.isValidLookup(d)||(a=!0,d=i);const m=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:d,y=f&&v!==d&&this.options.updateMissing;if(a||r||y){if(this.logger.log(y?"updateKey":"missingKey",l,s,i,y?v:d),o){const e=this.resolve(i,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const r=(e,n,r)=>{const o=f&&r!==d?r:m;this.options.missingKeyHandler?this.options.missingKeyHandler(e,s,n,o,y,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,s,n,o,y,t),this.emit("missingKey",e,s,n,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&c?e.forEach(e=>{const n=this.pluralResolver.getSuffixes(e,t);g&&t[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach(n=>{r([e],i+n,t[`defaultValue${n}`]||v)})}):r(e,i,v))}d=this.extendTranslation(d,e,t,u,n),a&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${s}:${i}`),(a||r)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${i}`:i,r?d:void 0):this.options.parseMissingKeyHandler(d))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,d,{...t,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(u.res=e,u.usedParams=this.getUsedParamsDetails(t),u):e}if(o){const e=Array.isArray(d),n=e?[]:{},r=e?h:f;for(const e in d)if(Object.prototype.hasOwnProperty.call(d,e)){const i=`${r}${o}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:a}),n[e]===i&&(n[e]=d[e])}d=n}}return r?(u.res=d,u.usedParams=this.getUsedParamsDetails(t),u):d}extendTranslation(e,t,n,r,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const a=er(e)&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(a){const t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let l=n.replace&&!er(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||r.usedLng,n),a){const t=e.match(this.interpolator.nestingRegexp);s<(t&&t.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=this.language||r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return o&&o[0]===r[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${r[0]} in key: ${t[0]}`),null):i.translate(...r,t)},n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,s=er(a)?[a]:a;return null!=e&&s&&s.length&&!1!==n.applyPostProcessor&&(e=xr.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t,n,r,o,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return er(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;const s=this.extractFromKey(e,a),l=s.key;n=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==a.count&&!er(a.count),d=u&&!a.ordinal&&0===a.count&&this.pluralResolver.shouldUseIntlApi(),f=void 0!==a.context&&(er(a.context)||"number"==typeof a.context)&&""!==a.context,h=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);c.forEach(e=>{this.isValidLookup(t)||(i=e,!Sr[`${h[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(Sr[`${h[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${h.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach(n=>{if(this.isValidLookup(t))return;o=n;const i=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,a);else{let e;u&&(e=this.pluralResolver.getSuffix(n,a.count,a));const t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(i.push(l+e),a.ordinal&&0===e.indexOf(r)&&i.push(l+e.replace(r,this.options.pluralSeparator)),d&&i.push(l+t)),f){const n=`${l}${this.options.contextSeparator}${a.context}`;i.push(n),u&&(i.push(n+e),a.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),d&&i.push(n+t))}}let s;for(;s=i.pop();)this.isValidLookup(t)||(r=s,t=this.getResource(n,e,s,a))}))})}),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!er(e.replace);let r=n?e.replace:e;if(n&&void 0!==e.count&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(const e of t)delete r[e]}return r}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}const Or=e=>e.charAt(0).toUpperCase()+e.slice(1);class Nr{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=br.create("languageUtils")}getScriptPartFromCode(e){if(!(e=vr(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=vr(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(er(e)&&e.indexOf("-")>-1){if("undefined"!=typeof Intl&&void 0!==Intl.getCanonicalLocales)try{let t=Intl.getCanonicalLocales(e)[0];if(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)return t}catch(e){}const t=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map(e=>e.toLowerCase()):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Or(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Or(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Or(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),er(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],o=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return er(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):er(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&o(this.formatLanguageCode(e))}),r}}let kr=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Tr={1:e=>Number(e>1),2:e=>Number(1!=e),3:e=>0,4:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),5:e=>Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5),6:e=>Number(1==e?0:e>=2&&e<=4?1:2),7:e=>Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),8:e=>Number(1==e?0:2==e?1:8!=e&&11!=e?2:3),9:e=>Number(e>=2),10:e=>Number(1==e?0:2==e?1:e<7?2:e<11?3:4),11:e=>Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3),12:e=>Number(e%10!=1||e%100==11),13:e=>Number(0!==e),14:e=>Number(1==e?0:2==e?1:3==e?2:3),15:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2),16:e=>Number(e%10==1&&e%100!=11?0:0!==e?1:2),17:e=>Number(1==e||e%10==1&&e%100!=11?0:1),18:e=>Number(0==e?0:1==e?1:2),19:e=>Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3),20:e=>Number(1==e?0:0==e||e%100>0&&e%100<20?1:2),21:e=>Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0),22:e=>Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)};const Lr=["v1","v2","v3"],Mr=["v4"],Dr={zero:0,one:1,two:2,few:3,many:4,other:5};class Rr{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=br.create("pluralResolver"),this.options.compatibilityJSON&&!Mr.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(()=>{const e={};return kr.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Tr[t.fc]}})}),e})(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi()){const n=vr("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:r})}catch(n){if(!e.match(/-|_/))return;const r=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(r,t)}return this.pluralRulesCache[o]=i,i}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}getPluralFormsOfKey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((e,t)=>Dr[e]-Dr[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):n.numbers.map(n=>this.getSuffix(e,n,t)):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:this.getSuffixRetroCompatible(r,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let r=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===r?r="plural":1===r&&(r=""));const o=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?`_plural_${r.toString()}`:o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Lr.includes(this.options.compatibilityJSON)}}const Pr=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=((e,t,n)=>{const r=lr(e,n);return void 0!==r?r:lr(t,n)})(e,t,n);return!i&&o&&er(n)&&(i=gr(e,n,r),void 0===i&&(i=gr(t,n,r))),i},Ar=e=>e.replace(/\$/g,"$$$$");class $r{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=br.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:o,prefixEscaped:i,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:h,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=e.interpolation;this.escape=void 0!==t?t:fr,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?ur(o):i||"{{",this.suffix=a?ur(a):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?ur(d):f||ur("$t("),this.nestingSuffix=h?ur(h):p||ur(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=v||1e3,this.alwaysFormat=void 0!==m&&m,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e&&e.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let o,i,a;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const o=Pr(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(o,void 0,n,{...r,...t,interpolationkey:e}):o}const o=e.split(this.formatSeparator),i=o.shift().trim(),a=o.join(this.formatSeparator).trim();return this.format(Pr(t,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,n,{...r,...t,interpolationkey:i})};this.resetRegExp();const c=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ar(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ar(this.escape(e)):Ar(e)}].forEach(t=>{for(a=0;o=t.regex.exec(e);){const n=o[1].trim();if(i=l(n),void 0===i)if("function"==typeof c){const t=c(e,o,r);i=er(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(u){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else er(i)||this.useRawValueToEscape||(i=nr(i));const s=t.safeValue(i);if(e=e.replace(o[0],s),u?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=(e,t)=>{const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const r=e.split(new RegExp(`${n}[ ]*{`));let i=`{${r[1]}`;e=r[0],i=this.interpolate(i,o);const a=i.match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let s=[];o={...i},o=o.replace&&!er(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map(e=>e.trim());n[1]=e.shift(),s=e,l=!0}if(r=t(a.call(this,n[1].trim(),o),o),r&&n[0]===e&&!er(r))return r;er(r)||(r=nr(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),l&&(r=s.reduce((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:n[1].trim()}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}const Fr=e=>{const t={};return(n,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const a=r+JSON.stringify(i);let s=t[a];return s||(s=e(vr(r),o),t[a]=s),s(n)}};class Ir{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=br.create("formatter"),this.options=e,this.formats={number:Fr((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:Fr((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:Fr((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:Fr((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:Fr((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Fr(t)}format(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(e=>e.indexOf(")")>-1)){const e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}const i=o.reduce((e,t)=>{const{formatName:o,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(e=>{if(e){const[t,...r]=e.split(":"),o=r.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();n[i]||(n[i]=o),"false"===o&&(n[i]=!1),"true"===o&&(n[i]=!0),isNaN(o)||(n[i]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}})(t);if(this.formats[o]){let t=e;try{const a=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},s=a.locale||a.lng||r.locale||r.lng||n;t=this.formats[o](e,s,{...i,...r,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e);return i}}class Br extends wr{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=br.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,r.backend,r)}queueLoad(e,t,n,r){const o={},i={},a={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const a=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,r=!1,void 0===i[a]&&(i[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===s[t]&&(s[t]=!0)))}),r||(a[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){const r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),!t&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const a={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=ar(e,t,Object);r[o]=r[o]||[],r[o].push(n)})(n.loaded,[o],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{a[e]||(a[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:i});this.readingCalls++;const a=(a,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&s&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*o,i)},o):i(a,s)},s=this.backend[n].bind(this.backend);if(2!==s.length)return s(e,t,a);try{const n=s(e,t);n&&"function"==typeof n.then?n.then(e=>a(null,e)).catch(a):a(null,n)}catch(e){a(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();er(e)&&(e=this.languageUtils.toResolveHierarchy(e)),er(t)&&(t=[t]);const o=this.queueLoad(e,t,n,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),r=n[0],o=n[1];this.read(r,o,"read",void 0,void 0,(n,i)=>{n&&this.logger.warn(`${t}loading namespace ${o} for language ${r} failed`,n),!n&&i&&this.logger.log(`${t}loaded namespace ${o} for language ${r}`,i),this.loaded(e,n,i)})}saveMissing(e,t,n,r,o){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const s={...i,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let o;o=5===l.length?l(e,t,n,r,s):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>a(null,e)).catch(a):a(null,o)}catch(e){a(e)}else l(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}const jr=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),er(e[1])&&(t.defaultValue=e[1]),er(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),_r=e=>(er(e.ns)&&(e.ns=[e.ns]),er(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),er(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Hr=()=>{};class Wr extends wr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=_r(e),this.services={},this.logger=br,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&(er(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=jr();this.options={...r,...this.options,..._r(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?br.init(o(this.modules.logger),this.options):br.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Ir);const n=new Nr(this.options);this.store=new Er(this.options.resources,this.options);const i=this.services;i.logger=br,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Rr(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=o(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new $r(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Br(o(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.languageDetector&&(i.languageDetector=o(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=o(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Cr(this.services,this.options),this.translator.on("*",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit(t,...r)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Hr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(t=>{this[t]=function(){return e.store[t](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(t=>{this[t]=function(){return e.store[t](...arguments),e}});const i=tr(),a=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),n(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?a():setTimeout(a,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hr;const n=er(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],r=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)r(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>r(e))}this.options.preload&&this.options.preload.forEach(e=>r(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)})}else t(null)}reloadResources(e,t,n){const r=tr();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=Hr),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&xr.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const r=tr();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(e,i)=>{i?(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,r.resolve(function(){return n.t(...arguments)}),t&&t(e,function(){return n.t(...arguments)})},a=t=>{e||t||!this.services.languageDetector||(t=[]);const n=er(t)?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||o(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,e=>{i(e,n)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),r}getFixedT(e,t,n){var r=this;const o=function(e,t){let i;if("object"!=typeof t){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];i=r.options.overloadTranslationOptionHandler([e,t].concat(s))}else i={...t};i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||n||o.keyPrefix);const c=r.options.keySeparator||".";let u;return u=i.keyPrefix&&Array.isArray(e)?e.map(e=>`${i.keyPrefix}${c}${e}`):i.keyPrefix?`${i.keyPrefix}${c}${e}`:e,r.t(u,i)};return er(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,e)||r&&!i(o,e)))}loadNamespaces(e,t){const n=tr();return this.options.ns?(er(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=tr();er(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=r.concat(o),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new Nr(jr());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new Wr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hr;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new Wr(r);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));return["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n&&(o.store=new Er(this.store.data,r),o.services.resourceStore=o.store),o.translator=new Cr(o.services,r),o.translator.on("*",function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit(e,...n)}),o.init(r,t),o.translator.options=r,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ur=Wr.createInstance();Ur.createInstance=Wr.createInstance,Ur.createInstance,Ur.dir,Ur.init,Ur.loadResources,Ur.reloadResources,Ur.use,Ur.changeLanguage,Ur.getFixedT,Ur.t,Ur.exists,Ur.setDefaultNamespace,Ur.hasLoadedNamespace,Ur.loadNamespaces,Ur.loadLanguages;var Vr="translation";function zr(e){return Ur.on("languageChanged",e),function(){return Ur.off("languageChanged",e)}}Ur.init({lng:"zh-CN",resources:{}});var Kr=Ur.t.bind(Ur);function qr(e){if(e.removeAttr){e.removeAttr("width"),e.removeAttr("height"),e.removeAttr("fill"),e.removeAttr("class"),e.removeAttr("t"),e.removeAttr("p-id");var t=e.children();t.length&&qr(t)}}function Jr(){return s('<svg viewBox="0 0 1024 1024"><path d="M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z"></path></svg>')}function Gr(){return s('<div class="w-e-bar-divider"></div>')}var Yr=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e)}return e.prototype.record=function(e){var t=H.get(e);null==t&&(t=new Set,H.set(e,t)),t.add(this),W.set(this,e)},e.prototype.renderContent=function(e){var t=this.$elem;t.empty(),t.append(e);var n=this.genSelfElem();n&&t.append(n)},e.prototype.appendTo=function(e){var t=this.$elem;e.append(t)},e.prototype.show=function(){if(!this.isShow){this.showTime=Date.now(),this.$elem.show(),this.isShow=!0;var e=W.get(this);e&&e.emit(R.MODALORPANELSHOW,this)}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=W.get(this);e&&e.emit(R.MODALORPANELHIDE)}},e}(),Xr=function(e){function t(){var t=e.apply(this,b([],y(arguments),!1))||this;return t.type="dropPanel",t.$elem=s('<div class="w-e-drop-panel"></div>'),t}return g(t,e),t.prototype.genSelfElem=function(){return null},t}(Yr);function Zr(e,t,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),t){if(r){var i=ft?"cmd":"ctrl";r=r.replace("mod",i)}if(o)r&&(e.attr("data-tooltip",r),e.addClass("w-e-menu-tooltip-v5"),e.addClass("tooltip-right"));else{var a=r?"".concat(n,"\n").concat(r):n;e.attr("data-tooltip",a),e.addClass("w-e-menu-tooltip-v5")}}}var Qr=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=s('<div class="w-e-bar-item"></div>'),this.$button=s('<button type="button"></button>'),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'button'"));var a=t.title,l=t.hotkey,c=void 0===l?"":l,u=t.iconSvg,d=void 0===u?"":u,f=this.$button;if(d){var h=s(d);qr(h),f.append(h)}else f.text(a);Zr(f,d,a,c,n),n&&d&&f.append(s('<span class="title">'.concat(a,"</span>"))),i&&f.css("width","".concat(i,"px")),f.attr("data-menu-key",e),this.$elem.append(f),w(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(t){t.preventDefault(),lo(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick())})},e.prototype.exec=function(){var e=lo(this),t=this.menu,n=t.getValue(e);t.exec(e,n),this.changeMenuState()},e.prototype.setActive=function(){var e=lo(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n)},e.prototype.setDisabled=function(){var e=lo(this),t=this.$button,n=this.menu.isDisabled(e);(null==e.selection||e.isDisabled())&&(n=!0),this.menu.alwaysEnable&&(n=!1);var r="disabled";n?t.addClass(r):t.removeClass(r),this.disabled=n},e.prototype.setIcon=function(){var e=lo(this),t=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(e);if(n){t.find("svg").remove();var r=s(n);qr(r),t.append(r)}}},e.prototype.setTooltip=function(){var e=lo(this),t=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(e),r=this.menu.iconSvg;n&&r&&Zr(t,r,n)}},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},e}(),eo=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;if(o.dropPanel=null,o.menu=n,n.showDropPanel){var i=Jr();o.$button.append(i)}return o}return g(t,e),t.prototype.onButtonClick=function(){this.menu.showDropPanel&&this.handleDropPanel()},t.prototype.handleDropPanel=function(){var e=this.menu;if(null!=e.getPanelContentElem){var t=lo(this);if(null==this.dropPanel){var n=new Xr(t),r=e.getPanelContentElem(t);n.renderContent(r),n.appendTo(this.$elem),n.show(),this.dropPanel=n}else{var o=this.dropPanel;if(o.isShow)o.hide();else{r=e.getPanelContentElem(t);o.renderContent(r),o.show()}}var i=this.dropPanel;if(i.isShow){var a=this.$elem,s=a.offset().left,l=a.parents(".w-e-bar");s-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"})}}},t}(Qr),to=function(){function e(e){this.$elem=s('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=s('<div class="w-e-bar-item-menus-container"></div>'),this.$button=s('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var a=s(n);qr(a),i.append(a)}else i.text(r);i.attr("data-menu-key",t);var l=Jr();i.append(l),o.append(i);var c=this.$container;o.append(c);var u=this.createObserver();this.observe(u)}return e.prototype.appendBarItem=function(e){var t=e.$elem;this.$container.append(t)},e.prototype.observe=function(e){var t=this.$container;e.observe(t[0],{childList:!0,subtree:!0,attributes:!0})},e.prototype.createObserver=function(){var e=this,t=this.$container,n=this.$button,r=new MutationObserver(function(){var o=t.find("button"),i=o.length;if(0!==i){var a=0;o.each(function(e){s(e).hasClass("disabled")&&(a+=1)}),r.disconnect(),a===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r)}});return r},e}(),no=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=s('<div class="w-e-modal"></div>'),r.width=0,n&&(r.width=n);var o=r.$elem;return o.on("click",function(e){return e.stopPropagation()}),o.on("keyup",function(e){"Escape"===e.code&&(r.hide(),t.restoreSelection())}),r}return g(t,e),t.prototype.genSelfElem=function(){var e=this,t=s('<span class="btn-close">'.concat('<svg viewBox="0 0 1024 1024"><path d="M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z"></path></svg>',"</span>")),n=W.get(this);return t.on("click",function(){e.hide(),null==n||n.restoreSelection()}),t},t.prototype.setStyle=function(e){var t=this.width,n=this.$elem;n.attr("style",""),t&&n.css("width","".concat(t,"px")),n.css(e)},t}(Yr);var ro=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=s("body"),o.modal=null,o.menu=n,o}return g(t,e),t.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal()},t.prototype.getPosition=function(){var e=lo(this),t=this.menu.getModalPositionNode(e);return i.Element.isElement(t)?Xn(e,t,"modal"):Yn(e)},t.prototype.handleModal=function(){var e=lo(this),t=this.menu;if(null==this.modal){var n=new no(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n}else{(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1)}},t.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=lo(this),r=this.menu;if(null!=r.getModalContentElem){var o=Et.getTextarea(n),i=Et.getToolbar(n),a=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,s=r.getModalContentElem(n);if(e.renderContent(s),a)e.setStyle({left:"0",right:"0"});else{var l=this.getPosition();e.setStyle(l)}t&&(a?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),a||Zn(n,e.$elem),setTimeout(function(){n.blur()})}},t}(Qr);var oo=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=s('<div class="w-e-select-list"></div>'),n&&r.$elem.css("width","".concat(n,"px")),r.$elem.on("click",function(e){e.stopPropagation()}),r}return g(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=s("<ul></ul>");e.forEach(function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,a=s('<li data-value="'.concat(t,'"></li>'));if(i&&a.css(i),o){var l=s('<svg viewBox="0 0 1446 1024"><path d="M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z"></path></svg>');a.append(l),a.addClass("selected")}a.append(s('<span data-value="'.concat(t,'">').concat(r,"</span>"))),a.attr("title",r),n.append(a)}),t.append(n)},t.prototype.genSelfElem=function(){return null},t}(Yr);var io=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=s('<div class="w-e-bar-item"></div>'),this.$button=s('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,a=t.width,l=t.iconSvg,c=void 0===l?"":l,u=t.hotkey,d=void 0===u?"":u;if("select"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'select'"));var f=this.$button;a&&f.css("width","".concat(a,"px")),f.attr("data-menu-key",e),Zr(f,c,i,d,n),this.$elem.append(f),this.menu=t,w(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",function(t){t.preventDefault(),lo(e).hidePanelOrModal(),e.trigger()})},e.prototype.trigger=function(){var e=this,t=lo(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new oo(t,n.selectPanelWidth);var r=this.selectList,o=n.getOptions(t);r.renderList(o),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",function(t){var n=t.target;if(null!=n){t.preventDefault();var r=s(n).attr("data-value");e.onChange(r)}})}else{if((r=this.selectList).isShow)r.hide();else{o=n.getOptions(t);r.renderList(o),r.show()}}}},e.prototype.onChange=function(e){var t=lo(this),n=this.menu;null!=n.exec&&n.exec(t,e)},e.prototype.setSelectedValue=function(){var e=lo(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o+=1){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=Jr();o.empty(),o.text(r),o.append(i)},e.prototype.setDisabled=function(){var e=lo(this),t=this.menu.isDisabled(e),n=this.$button;(null==e.selection||e.isDisabled())&&(t=!0);var r="disabled";t?n.addClass(r):n.removeClass(r),this.disabled=t},e.prototype.changeMenuState=function(){this.setSelectedValue(),this.setDisabled()},e}(),ao=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return g(t,e),t.prototype.onButtonClick=function(){},t}(Qr),so=new WeakMap;function lo(e){var t=_.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function co(e,t,n){void 0===n&&(n=!1);var r=so.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,a=t.showModal;r=i?new eo(e,t,n):a?new ro(e,t,n):new ao(e,t,n)}if("select"===o&&(r=new io(e,t,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(t)));return so.set(t,r),r}function uo(e,t){var n=e.selection;return null!=n&&(!i.Range.isCollapsed(n)&&(!Et.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})&&!!i.Text.isText(t)))}var fo=function(){function e(){var e=this;this.$elem=s('<div class="w-e-bar w-e-bar-hidden w-e-hover-bar"></div>'),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.lngListen=function(){},this.changeHoverbarState=c(function(){var t=e.isShow,n=e.getSelectedNodeAndMenuKeys()||{},r=n.node,o=void 0===r?null:r,a=n.menuKeys,s=void 0===a?[]:a,l=e.getEditorInstance();if(null!=o&&e.changeItemsState(),o&&i.Element.isElement(o)&&t){var c=e.isSamePath(o,e.prevSelectedNode);if(!i.Editor.isBlock(l,o)&&c)return}e.hideAndClean(),null!=o&&(e.registerItems(s),e.setPosition(o),e.show()),e.prevSelectedNode=o},200),w(function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),Et.getTextarea(t).$textAreaContainer.append(n),t.on(R.CHANGE,e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on(R.SCROLL,r),t.on(R.FULLSCREEN,r),t.on(R.UNFULLSCREEN,r)}),this.lngListen=zr(function(){e.menus={},e.hideAndClean(),e.getEditorInstance().deselect()})}return e.prototype.getMenus=function(){return this.menus},e.prototype.hideAndClean=function(){var e=this.$elem;e.removeClass("w-e-bar-show").addClass("w-e-bar-hidden"),this.hoverbarItems=[],e.empty(),this.isShow=!1},e.prototype.checkPositionBottom=function(){var e=this.$elem,t=!1,n="undefined"!=typeof window?window.innerHeight:null;n&&n>=360&&(n-e[0].getBoundingClientRect().bottom<360&&(t=!0));t?e.addClass("w-e-bar-bottom"):e.removeClass("w-e-bar-bottom")},e.prototype.show=function(){this.$elem.removeClass("w-e-bar-hidden").addClass("w-e-bar-show"),this.isShow=!0,this.checkPositionBottom()},e.prototype.changeItemsState=function(){var e=this;w(function(){e.hoverbarItems.forEach(function(e){e.changeMenuState()})})},e.prototype.registerItems=function(e){var t=this,n=this.$elem;e.forEach(function(e){if("|"!==e)t.registerSingleItem(e);else{var r=Gr();n.append(r)}})},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=P[e];if(null==o)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof o)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));r=o(),n[e]=r}var i=t.getMenuConfig(e);i&&void 0!==i.iconSvg&&(r.iconSvg=i.iconSvg);var a=co(e,r);this.hoverbarItems.push(a),_.set(a,t),this.$elem.append(a.$elem)},e.prototype.setPosition=function(e){var t=this.getEditorInstance(),n=this.$elem;if(n.attr("style",""),i.Element.isElement(e)){var r=Xn(t,e,"bar");return n.css(r),void Zn(t,n)}if(i.Text.isText(e)){r=Yn(t);return n.css(r),void Zn(t,n)}throw new Error("hoverbar.setPosition error, current selected node is not elem nor text")},e.prototype.getSelectedNodeAndMenuKeys=function(){var e=this.getEditorInstance();if(null==e.selection)return null;var t=this.getHoverbarKeysConf(),n=null,r=[],o=function(o){var a=t[o],s=a.match,l=a.menuKeys,c=void 0===l?[]:l,u=s||function(e,t){return Et.checkNodeType(t,o)},d=s?null:Et.getSelectedNodeByType(e,o),f=y(d?[[d]]:i.Editor.nodes(e,{match:function(t){return u(e,t)},universal:!0}),1),h=f[0];if(null!=h)return n=h[0],r=c,"break"};for(var a in t){if("break"===o(a))break}return null==n||0===r.length?null:{node:n,menuKeys:r}},e.prototype.getEditorInstance=function(){var e=B.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.getHoverbarKeysConf=function(){var e=this.getEditorInstance().getConfig().hoverbarKeys,t=void 0===e?{}:e,n=t.text;return n&&null==n.match&&(n.match=uo),t},e.prototype.isSamePath=function(e,t){if(null==e||null==t)return!1;var n=Et.findPath(null,e),r=Et.findPath(null,t);return i.Path.equals(n,r)},e.prototype.destroy=function(){var e;this.changeHoverbarState.cancel(),this.$elem.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null},e}();function ho(e,t){return ke(t)&&Et.hasDOMNode(e,t,{editable:!0})}function po(e,t){return ke(t)&&Et.hasDOMNode(e,t)}function go(e,t){if(ho(e,t))return!0;if(!po(e,t))return!1;var n=null;return Le(t)?n=t:De(t)&&(n=t.parentElement),!!(null==n?void 0:n.closest("[data-w-e-reserve]"))||function(e,t){if(e.getConfig().readOnly)return!1;var n=po(e,t)&&Et.toSlateNode(e,t);return!!n&&i.Element.isElement(n)&&i.Editor.isVoid(e,n)}(e,t)}const vo=e=>"object"==typeof e&&null!=e&&1===e.nodeType,mo=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,yo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return mo(n.overflowY,t)||mo(n.overflowX,t)||(e=>{const t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},bo=(e,t,n,r,o,i,a,s)=>i<e&&a>t||i>e&&a<t?0:i<=e&&s<=n||a>=t&&s>=n?i-e-r:a>t&&s<n||i<e&&s>n?a-t+o:0,wo=e=>{const t=e.parentElement;return null==t?e.getRootNode().host||null:t},Eo=(e,t)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:a,block:s,inline:l,boundary:c,skipOverflowHiddenElements:u}=t,d="function"==typeof c?c:e=>e!==c;if(!vo(e))throw new TypeError("Invalid target");const f=document.scrollingElement||document.documentElement,h=[];let p=e;for(;vo(p)&&d(p);){if(p=wo(p),p===f){h.push(p);break}null!=p&&p===document.body&&yo(p)&&!yo(document.documentElement)||null!=p&&yo(p,u)&&h.push(p)}const g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,v=null!=(i=null==(o=window.visualViewport)?void 0:o.height)?i:innerHeight,{scrollX:m,scrollY:y}=window,{height:b,width:w,top:E,right:x,bottom:S,left:C}=e.getBoundingClientRect(),{top:O,right:N,bottom:k,left:T}=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);let L="start"===s||"nearest"===s?E-O:"end"===s?S+k:E+b/2-O+k,M="center"===l?C+w/2-T+N:"end"===l?x+N:C-T;const D=[];for(let e=0;e<h.length;e++){const t=h[e],{height:n,width:r,top:o,right:i,bottom:c,left:u}=t.getBoundingClientRect();if("if-needed"===a&&E>=0&&C>=0&&S<=v&&x<=g&&(t===f&&!yo(t)||E>=o&&S<=c&&C>=u&&x<=i))return D;const d=getComputedStyle(t),p=parseInt(d.borderLeftWidth,10),O=parseInt(d.borderTopWidth,10),N=parseInt(d.borderRightWidth,10),k=parseInt(d.borderBottomWidth,10);let T=0,R=0;const P="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-N:0,A="offsetHeight"in t?t.offsetHeight-t.clientHeight-O-k:0,$="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,F="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(f===t)T="start"===s?L:"end"===s?L-v:"nearest"===s?bo(y,y+v,v,O,k,y+L,y+L+b,b):L-v/2,R="start"===l?M:"center"===l?M-g/2:"end"===l?M-g:bo(m,m+g,g,p,N,m+M,m+M+w,w),T=Math.max(0,T+y),R=Math.max(0,R+m);else{T="start"===s?L-o-O:"end"===s?L-c+k+A:"nearest"===s?bo(o,c,n,O,k+A,L,L+b,b):L-(o+n/2)+A/2,R="start"===l?M-u-p:"center"===l?M-(u+r/2)+P/2:"end"===l?M-i+N+P:bo(u,i,r,p,N+P,M,M+w,w);const{scrollLeft:e,scrollTop:a}=t;T=0===F?0:Math.max(0,Math.min(a+T/F,t.scrollHeight-n/F+A)),R=0===$?0:Math.max(0,Math.min(e+R/$,t.scrollWidth-r/$+P)),L+=a-T,M+=e-R}D.push({el:t,top:T,left:R})}return D};function xo(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;const n=(e=>{const t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if((e=>"object"==typeof e&&"function"==typeof e.behavior)(t))return t.behavior(Eo(e,t));const r="boolean"==typeof t||null==t?void 0:t.behavior;for(const{el:o,top:i,left:a}of Eo(e,(e=>!1===e?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&0!==Object.keys(e).length)(e)?e:{block:"start",inline:"nearest"})(t))){const e=i-n.top+n.bottom,t=a-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}function So(e){null!=e.selection&&(e.selection=null,e.onChange())}function Co(e,t,n){void 0===n&&(n=!1);var r=t.selection,o=t.getConfig(),a=Et.findDocumentOrShadowRoot(t).getSelection();if(a&&(!e.isComposing||n)&&t.isFocused()){var s="None"!==a.type;if(r||s){var l=X.get(t),c=!1;if(l.contains(a.anchorNode)&&l.contains(a.focusNode)&&(c=!0),s&&c&&r){var u=Et.toSlateRange(t,a,{exactMatch:!0,suppressThrow:!0});if(u&&i.Range.equals(u,r)){var d=!0;if(i.Range.isCollapsed(r)){var f=a.anchorNode,h=a.anchorOffset;if(f===l){var p=l.childNodes,g=void 0;(g=p[h])&&g.matches("table")&&(d=!1),(g=p[h-1])&&g.matches("table")&&(d=!1)}}if(d)return}}if(!r||Et.hasRange(t,r)){e.isUpdatingSelection=!0;var v=null;try{v=r&&Et.toDOMRange(t,r)}catch(e){v=null}if(v){i.Range.isBackward(r)?a.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):a.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var m=v.startContainer.parentElement;if(!m.closest("[data-slate-spacer]")&&v.getBoundingClientRect){var y=v.getBoundingClientRect.bind(v)();0===y.top&&0===y.right&&0===y.bottom&&0===y.left&&0===y.height&&0===y.width||(m.getBoundingClientRect=v.getBoundingClientRect.bind(v));var b=document.body;if(xo(m,{scrollMode:"if-needed",boundary:o.scroll&&l.parentElement||b,block:"end",behavior:"auto"}),o.scroll){var w=l.parentElement;if(w){var E=function(){var e=v.getBoundingClientRect(),t=w.getBoundingClientRect(),n=e.bottom-t.bottom,r=t.top-e.top;n>0?w.scrollTop+=n+1:r>0&&(w.scrollTop-=r+1)};E(),requestAnimationFrame(E)}}delete m.getBoundingClientRect}}else a.removeAllRanges();setTimeout(function(){v&&ht&&l.focus(),e.isUpdatingSelection=!1})}else t.selection=Et.toSlateRange(t,a,{exactMatch:!1,suppressThrow:!0})}}}var Oo=new WeakMap,No=new WeakMap;function ko(e){var t;try{t=Et.findDocumentOrShadowRoot(e)}catch(e){return null}var n=t.getSelection();if(!n||n.rangeCount<=0)return null;try{return n.getRangeAt(0).startContainer}catch(e){return null}}var To={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z",tab:"tab",selectAll:"mod+a"},Lo={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Mo={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Do=function(e){var t=To[e],n=Lo[e],r=Mo[e],o=t&&d.isKeyHotkey(t),i=n&&d.isKeyHotkey(n),a=r&&d.isKeyHotkey(r);return function(e){return!(!o||!o(e))||(!!(ft&&i&&i(e))||!(ft||!a||!a(e)))}},Ro={isBold:Do("bold"),isCompose:Do("compose"),isMoveBackward:Do("moveBackward"),isMoveForward:Do("moveForward"),isDeleteBackward:Do("deleteBackward"),isDeleteForward:Do("deleteForward"),isDeleteLineBackward:Do("deleteLineBackward"),isDeleteLineForward:Do("deleteLineForward"),isDeleteWordBackward:Do("deleteWordBackward"),isDeleteWordForward:Do("deleteWordForward"),isExtendBackward:Do("extendBackward"),isExtendForward:Do("extendForward"),isExtendLineBackward:Do("extendLineBackward"),isExtendLineForward:Do("extendLineForward"),isItalic:Do("italic"),isMoveLineBackward:Do("moveLineBackward"),isMoveLineForward:Do("moveLineForward"),isMoveWordBackward:Do("moveWordBackward"),isMoveWordForward:Do("moveWordForward"),isRedo:Do("redo"),isSplitBlock:Do("splitBlock"),isTransposeCharacter:Do("transposeCharacter"),isUndo:Do("undo"),isTab:Do("tab"),isSelectAll:Do("selectAll")};function Po(e){e.preventDefault()}var Ao={beforeinput:function(e,t,n){var r,o,a=e,s=n.getConfig().readOnly;if(yt&&!s&&ho(n,a.target)){null===(r=t.flushDOMSelectionChange)||void 0===r||r.call(t);var l=n.selection,c=a.inputType,u=a.dataTransfer||a.data||void 0;if("insertCompositionText"!==c&&"deleteCompositionText"!==c){if(a.preventDefault(),!c.startsWith("delete")||c.startsWith("deleteBy")){var d=y(a.getTargetRanges(),1)[0];if(d){var f=null;try{f=Et.toSlateRange(n,d,{exactMatch:!1,suppressThrow:!0})}catch(e){f=null}!f||l&&i.Range.equals(l,f)||(i.Transforms.select(n,f),l=f)}}if(l&&i.Range.isExpanded(l)){var h=Et.getSelectedElems(n),p="table"===h[0].type,g="table-cell"!==h[h.length-1].type;if(p&&g)return;if(c.startsWith("delete")){var v=c.endsWith("Backward")?"backward":"forward";return void i.Editor.deleteFragment(n,{direction:v})}}if(null==l&&c.startsWith("insert")){var m=Et.findDocumentOrShadowRoot(n).getSelection();if(m){var b=Et.toSlateRange(n,m,{exactMatch:!1,suppressThrow:!0});b&&(i.Transforms.select(n,b),l=b)}if(null==l){try{null===(o=n.restoreSelection)||void 0===o||o.call(n)}catch(e){}l=n.selection}if(null==l){var w=i.Editor.end(n,[]),E={anchor:w,focus:w};i.Transforms.select(n,E),l=E}}switch(c){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":i.Editor.deleteFragment(n);break;case"deleteContent":case"deleteContentForward":i.Editor.deleteForward(n);break;case"deleteContentBackward":i.Editor.deleteBackward(n);break;case"deleteEntireSoftLine":i.Editor.deleteBackward(n,{unit:"line"}),i.Editor.deleteForward(n,{unit:"line"});break;case"deleteHardLineBackward":i.Editor.deleteBackward(n,{unit:"block"});break;case"deleteSoftLineBackward":i.Editor.deleteBackward(n,{unit:"line"});break;case"deleteHardLineForward":i.Editor.deleteForward(n,{unit:"block"});break;case"deleteSoftLineForward":i.Editor.deleteForward(n,{unit:"line"});break;case"deleteWordBackward":i.Editor.deleteBackward(n,{unit:"word"});break;case"deleteWordForward":i.Editor.deleteForward(n,{unit:"word"});break;case"insertLineBreak":i.Editor.insertText(n,"\n");break;case"insertParagraph":i.Editor.insertBreak(n);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===c&&(t.isComposing=!1,se.set(n,!0)),"insertFromPaste"===c&&!ae.get(n))break;xe(u)?n.insertData(u):"string"==typeof u&&i.Editor.insertText(n,u)}}}},blur:function(e,t,n){var r=e,o=t.isUpdatingSelection,a=t.latestElement;if(!n.getConfig().readOnly&&!o&&ho(n,r.target)){var s=Et.findDocumentOrShadowRoot(n);if(a!==s.activeElement){var l=r.relatedTarget;if(!(l===Et.toDOMNode(n,n)||Le(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&ke(l)&&Et.hasDOMNode(n,l)){var c=Et.toSlateNode(n,l);if(i.Element.isElement(c)&&!n.isVoid(c))return}if(pt){var u=s.getSelection();null==u||u.removeAllRanges()}re.delete(n)}}}},focus:function(e,t,n){var r=Et.toDOMNode(n,n),o=Et.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,ht&&e.target!==r?r.focus():re.set(n,!0)},click:function(e,t,n){if(!n.getConfig().readOnly&&po(n,e.target)&&ke(e.target)){var r=Et.toSlateNode(n,e.target),o=Et.findPath(n,r);if(i.Editor.hasPath(n,o))if(i.Node.get(n,o)===r){var a=i.Editor.start(n,o),s=i.Editor.end(n,o),l=i.Editor.void(n,{at:a}),c=i.Editor.void(n,{at:s});if(l&&c&&i.Path.equals(l[1],c[1])){var u=i.Editor.range(n,a);i.Transforms.select(n,u)}}}},compositionstart:function(e,t,n){if(ho(n,e.target)){le.delete(n),t.isComposing=!0;var r=n.selection;if(r&&i.Range.isCollapsed(r)){var o=ko(n);if(o){var a=o.textContent||"";Oo.set(n,a),No.set(n,o)}}r&&i.Range.isExpanded(r)&&(i.Editor.deleteFragment(n),t.changeViewState(),Promise.resolve().then(function(){Co(t,n,!0)})),function(e,t){var n;t.getConfig().placeholder&&t.isEmpty()&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1)}(t,n)}},compositionend:function(e,t,n){var r=e;if(ho(n,r.target)){t.isComposing=!1;var o=!0===se.get(n);o?(se.delete(n),le.delete(n)):le.delete(n);var a=function(e){var t,n=e.selection;if(n)return n;try{var r=Et.findDocumentOrShadowRoot(e).getSelection();if(r){var o=Et.toSlateRange(e,r,{exactMatch:!1,suppressThrow:!0});o&&(i.Transforms.select(e,o),n=o)}}catch(e){}if(!n){try{null===(t=e.restoreSelection)||void 0===t||t.call(e)}catch(e){}n=e.selection}if(!n){var a=i.Editor.end(e,[]),s={anchor:a,focus:a};i.Transforms.select(e,s),n=s}return n}(n);if(null!=a){(mt||ht)&&Et.cleanExposedTexNodeInSelectionBlock(n);for(var s=i.Range.isBackward(a)?a.focus:a.anchor,l=y(i.Editor.node(n,[s.path[0]]),1)[0],c=0;c<s.path.length;c+=1){var u=y(i.Editor.node(n,s.path.slice(0,c+1)),1)[0];if(i.Element.isElement(u)&&((pt||ht)&&"link"===u.type||"code"===u.type)){Et.setNewKey(l);break}}var d=r.data;if(d&&!o){if(n.getConfig().maxLength){var f=Et.getLeftLengthOfMaxLength(n);if(f<d.length){var h=ko(n);h&&h.nodeType===Node.TEXT_NODE&&(h.textContent=Oo.get(n)||""),f>0&&i.Editor.insertText(n,d.slice(0,f)),t.changeViewState()}else i.Editor.insertText(n,d)}else{var p=Et.findDocumentOrShadowRoot(n).getSelection();if(p&&function(e,t){if(i.Range.isCollapsed(t)){var n=t.anchor,r=t.focus;if([2,3].includes(n.path.length)&&[2,3].includes(r.path.length)&&(0===n.offset||0===r.offset)){var o=i.Editor.node(e,n.path),a=0===n.offset?n.path:r.path,s=[a[0],a[1]-1];if(0===a[1])return!1;var l=i.Editor.node(e,s);if(i.Text.isText(l[0])&&i.Text.isText(o[0]))return!0}}}(n,a)){var g=Et.toSlateRange(n,p,{exactMatch:!1,suppressThrow:!1});g&&(n.selection=g)}i.Editor.insertText(n,d)}pt||setTimeout(function(){if(null!=n.selection){var e=No.get(n);if(null!=e&&e.nodeType===Node.TEXT_NODE){var t=ko(n);null!=t&&t.nodeType===Node.TEXT_NODE&&t!==e&&(e.textContent=Oo.get(n)||"")}}})}}}},compositionupdate:function(e,t,n){ho(n,e.target)&&(t.isComposing=!0)},keydown:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&!t.isComposing&&ho(n,r.target)){if(function(e,t){var n,r,o=I.get(e),i=o&&o.getMenus(),a=j.get(e),s=a&&a.getMenus(),l=v(v({},i),s);try{for(var c=m(Object.keys(l)),u=c.next();!u.done;u=c.next()){var f=l[u.value],h=f.hotkey;if(h&&d.isHotkey(h,t)&&!f.isDisabled(e)){var p=f.getValue(e);f.exec(e,p)}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}(n,r),Ro.isTab(r))return Po(r),void n.handleTab();if(Ro.isRedo(r))return Po(r),void("function"==typeof n.redo&&n.redo());if(Ro.isUndo(r))return Po(r),void("function"==typeof n.undo&&n.undo());if(Ro.isMoveLineBackward(r))return Po(r),void i.Transforms.move(n,{unit:"line",reverse:!0});if(Ro.isMoveLineForward(r))return Po(r),void i.Transforms.move(n,{unit:"line"});if(Ro.isExtendLineBackward(r))return Po(r),void i.Transforms.move(n,{unit:"line",edge:"focus",reverse:!0});if(Ro.isExtendLineForward(r))return Po(r),void i.Transforms.move(n,{unit:"line",edge:"focus"});if(Ro.isMoveBackward(r))return Po(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n,{reverse:!0}):i.Transforms.collapse(n,{edge:"start"}));if(Ro.isMoveForward(r))return Po(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n):i.Transforms.collapse(n,{edge:"end"}));if(Ro.isMoveWordBackward(r))return Po(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word",reverse:!0});if(Ro.isMoveWordForward(r))return Po(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word"});if(Ro.isSelectAll(r))return Po(r),void n.selectAll();if(yt){if((mt||pt)&&o&&(Ro.isDeleteBackward(r)||Ro.isDeleteForward(r))&&i.Range.isCollapsed(o)){var a=i.Node.parent(n,o.anchor.path);i.Element.isElement(a)&&i.Editor.isVoid(n,a)&&i.Editor.isInline(n,a)&&(r.preventDefault(),i.Transforms.delete(n,{unit:"block"}))}}else{if(Ro.isBold(r)||Ro.isItalic(r)||Ro.isTransposeCharacter(r))return void Po(r);if(Ro.isSplitBlock(r))return Po(r),void(r.shiftKey?i.Editor.insertText(n,"\n"):i.Editor.insertBreak(n));if(Ro.isDeleteBackward(r))return Po(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n));if(Ro.isDeleteForward(r))return Po(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n));if(Ro.isDeleteLineBackward(r))return Po(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"line"}));if(Ro.isDeleteLineForward(r))return Po(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"line"}));if(Ro.isDeleteWordBackward(r))return Po(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"word"}));Ro.isDeleteWordForward(r)&&(Po(r),o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"word"}))}}},keypress:function(e,t,n){if(!yt&&!n.getConfig().readOnly&&ho(n,e.target)){e.preventDefault();var r=e.key;i.Editor.insertText(n,r)}},copy:function(e,t,n){var r=e;if(ho(n,r.target)){n.getConfig().readOnly||r.preventDefault();var o=r.clipboardData;if(null!=o){n.setFragmentData(o);var i=n.getConfig().customCopy;i&&i(n,r)}}},cut:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&(r.preventDefault(),ho(n,r.target))){var a=r.clipboardData;if(null!=a&&(n.setFragmentData(a),o))if(i.Range.isExpanded(o))i.Editor.deleteFragment(n);else{var s=i.Node.parent(n,o.anchor.path);i.Element.isElement(s)&&i.Editor.isVoid(n,s)&&i.Transforms.delete(n)}}},paste:function(e,t,n){ae.set(n,!0);var r=e;if(!n.getConfig().readOnly&&ho(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return ae.set(n,!1),void r.preventDefault();if(pt||!yt||Re(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(e,t,n){if(po(n,e.target)){var r=Et.toSlateNode(n,e.target);i.Element.isElement(r)&&i.Editor.isVoid(n,r)&&e.preventDefault()}},dragstart:function(e,t,n){var r=e;if(po(n,r.target)&&!n.getConfig().readOnly){var o=Et.toSlateNode(n,r.target),a=Et.findPath(n,o);if(i.Element.isElement(o)&&i.Editor.isVoid(n,o)||i.Editor.void(n,{at:a,voids:!0})){var s=i.Editor.range(n,a);i.Transforms.select(n,s)}var l=r.dataTransfer;if(null!=l)Et.getSelectedNodeByType(n,"table")||(t.isDraggingInternally=!0,n.setFragmentData(l))}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&po(n,r.target)&&(t.isDraggingInternally=!1)},drop:function(e,t,n){var r=e,o=r.dataTransfer;if(!n.getConfig().readOnly&&po(n,r.target)&&null!=o&&!(yt&&pt&&o.files.length>0)){r.preventDefault();var a=n.selection,s=Et.findEventRange(n,r);i.Transforms.select(n,s),t.isDraggingInternally&&(a&&i.Transforms.delete(n,{at:a}),t.isDraggingInternally=!1),n.insertData(o),n.isFocused()||n.focus()}}},$o=[];var Fo={};function Io(e,t,n){var r=n.isInline(e)?"span":"div";return f.jsx(r,null,t)}function Bo(e,t){var n,r=Et.findKey(t,e),o=t.isInline(e),a=i.Editor.isVoid(t,e),s=it(e.type,r.id),l={id:s,key:r.id,"data-slate-node":"element","data-slate-inline":o},c=e.type,u=e.children,d=void 0===u?[]:u,h=function(e){return Fo[e]||Io}(c);n=a?null:d.map(function(n,r){return Wo(n,r,e,t)});var p=h(e,n,t);if(a){l["data-slate-void"]=!0;var g=o?"span":"div",v=y(i.Node.texts(e),1),m=y(v[0],1)[0],b=Wo(m,0,e,t),E=f.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},b);p=f.jsx(g,{style:{position:"relative"}},p,E),G.set(m,0),Y.set(m,e)}return null==p.data&&(p.data={}),Object.assign(p.data,l),a||o||(p=function(e,t,n){var r=t;return $o.forEach(function(t){r=t(e,r,n)}),r}(e,p,t)),w(function(){var n=X.get(t),o=null==n?void 0:n.querySelector("#".concat(s));null!=o&&(Q.set(r,o),ee.set(e,o),Z.set(o,e))}),p}function jo(e,t){return void 0===t&&(t=!1),f.jsx("span",{"data-slate-string":!0},t?"".concat(e,"\n"):e)}function _o(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),f.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?f.jsx("br",null):null)}function Ho(e,t,n){if(null==e.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=Et.findKey(n,e),o=n.getConfig().decorate;if(null==o)throw new Error("Can not get config.decorate");var a,s=Et.findPath(n,e),l=o([e,s]),c=i.Text.decorations(e,l),u=c.map(function(r){var o,a=r.leaf,s=r.position,l=null!==(o=null==s?void 0:s.isLast)&&void 0!==o?o:1===c.length,u=function(e,t,n,r,o){void 0===o&&(o=!1);var a=e.text,s=Et.findPath(r,t),l=i.Path.parent(s);if(i.Editor.isEditor(n))throw new Error("Text node ".concat(JSON.stringify(t)," parent is Editor"));return r.isVoid(n)?_o(i.Node.string(n).length):""!==a||n.children[n.children.length-1]!==t||r.isInline(n)||""!==i.Editor.string(r,l)?""===a?_o():o&&"\n"===a.slice(-1)?jo(a,!0):jo(a):_o(0,!0)}(a,e,t,n,l);return u=function(e,t,n){var r=t;return $o.forEach(function(t){r=t(e,r,n)}),r}(a,u,n),f.jsx("span",{"data-slate-leaf":!0},u)}),d=(a=r.id,"w-e-text-".concat(a)),h=f.jsx("span",{"data-slate-node":"text",id:d,key:r.id},u);return w(function(){var t=X.get(n),o=null==t?void 0:t.querySelector("#".concat(d));null!=o&&(Q.set(r,o),ee.set(e,o),Z.set(o,e))}),h}function Wo(e,t,n,r){return G.set(e,t),Y.set(e,n),i.Element.isElement(e)?Bo(e,r):Ho(e,n,r)}var Uo=["props","attrs","style","dataset","on","hook","ns"];function Vo(e){var t=e.data,n=void 0===t?{}:t,r=e.children,o=void 0===r?[]:r;Object.keys(n).forEach(function(t){var r,o,i=n[t];if("key"!==t){if(!Uo.includes(t)){if(t.startsWith("data-")){var a=t.slice(5);return a=h(a),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={}),Object.assign(n.dataset,t)}(e,((r={})[a]=i,r)),void delete n[t]}!function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.props&&(n.props={}),Object.assign(n.props,t)}(e,(o={},o[t]=i,o)),delete n[t]}}else e.key=i}),o.length>0&&o.forEach(function(e){"string"!=typeof e&&Vo(e)})}function zo(e,t){var n,r,o=e.$scroll,a=(n=e.id,"w-e-textarea-".concat(n)),l=t.getConfig(),c=l.readOnly,u=l.autoFocus,d=function(e,t){return void 0===t&&(t=!1),f.h("div#".concat(e),{props:{contentEditable:!t}})}(a,c),h=t.children||[];d.children=h.map(function(e,n){if(q.has(e)){var r=q.get(e);if(r){var o=y(r,2),a=o[0],s=o[1];if(s)return a!==n&&(G.set(e,n),q.set(e,[n,s])),s}}var l=Wo(e,n,t,t);Vo(l);var c=t.getConfig().skipCacheTypes,u=void 0===c?["list-item"]:c;return i.Element.isElement(e)&&u.includes(e.type)||q.set(e,[n,l]),l});var p=V.get(e);if(null==p&&(p=!0),p){var g=function(e){return s('<div\n id="'.concat(e,'"\n data-slate-editor\n data-slate-node="value"\n suppressContentEditableWarning\n role="textarea"\n spellCheck="true"\n autoCorrect="true"\n autoCapitalize="true"\n ></div>'))}(a);o.append(g),e.$textArea=g,r=g[0],X.set(t,r),ee.set(t,r),Z.set(r,t),(m=f.init([f.classModule,f.propsModule,f.styleModule,f.datasetModule,f.eventListenersModule,f.attributesModule]))(r,d),V.set(e,!1),z.set(e,m)}else{var v=K.get(e),m=z.get(e);if(null==v||null==m)return;r=v.elm,m(v,d)}if(null==r){var b=o[0];if(null==(r=(null==b?void 0:b.querySelector("#".concat(a)))||$e(a)))return}if((p?u:t.isFocused())&&r.focus({preventScroll:!0}),p){var w=Ne(r);w&&ne.set(t,w)}X.set(t,r),ee.set(t,r),Z.set(r,t),K.set(e,d)}var Ko=1,qo=function(){function e(e){var t=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=Ko++,this.$textArea=null,this.$progressBar=s('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=s('<div class="w-e-max-length-info"></div>'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=u(function(e){var n=Le(null==e?void 0:e.target)?e.target:null,r=null==n?void 0:n.tagName;if("INPUT"!==r&&"TEXTAREA"!==r){var o=t.getActiveEditor();null!=o&&function(e,t){var n=e.isComposing,r=e.isUpdatingSelection,o=e.isDraggingInternally,a=t.getConfig();if(!r&&!o){var s=Et.findDocumentOrShadowRoot(t),l=s.activeElement,c=Et.toDOMNode(t,t),u=s.getSelection();if(l!==c)return re.delete(t),void So(t);if(e.latestElement=l,re.set(t,!0),!u)return So(t);var d=u.anchorNode,f=u.focusNode,h=go(t,d),p=po(t,f);if(!n)if(h&&p){var g=Et.toSlateRange(t,u,{exactMatch:!1,suppressThrow:!0});g&&i.Transforms.select(t,g)}else a.readOnly&&So(t)}}(t,o)}},100);var n=s(e);if(0===n.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=n;var r=s('<div class="w-e-text-container"></div>');r.append(this.$progressBar),r.append(this.$maxLengthInfo),n.append(r);var o=s('<div class="w-e-scroll"></div>');r.append(o),this.$scroll=o,this.$textAreaContainer=r,w(function(){var e=t.getActiveEditor();if(null!=e){t.bindSelectionChange(e),r.on("click",function(){return e.hidePanelOrModal()}),e.on(R.CHANGE,t.changeViewState.bind(t));var o=e.getConfig(),i=o.onChange,a=o.scroll;i&&e.on(R.CHANGE,function(){return i(e)}),a||(n.css("position","relative"),r.addClass("no-scroll")),t.onFocusAndOnBlur(),e.on(R.CHANGE,t.changeMaxLengthInfo.bind(t)),t.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=$.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.getActiveEditor=function(){if(this.destroyed)return null;var e=$.get(this);return null==e||e.isDestroyed?null:e},e.prototype.bindSelectionChange=function(e,t){var n=this;if(void 0===t&&(t=5),null==this.selectionChangeRoot&&!e.isDestroyed){try{var r=Et.findDocumentOrShadowRoot(e);r.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=r}catch(r){if(t>0)return void setTimeout(function(){return n.bindSelectionChange(e,t-1)},0);window.document.addEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=window.document}e.on(R.DESTROYED,function(){var e;null===(e=n.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",n.onDOMSelectionChange),n.selectionChangeRoot=null})}},e.prototype.flushDOMSelectionChange=function(){this.onDOMSelectionChange.flush()},e.prototype.bindEvent=function(){var e=this,t=this.$textArea,n=this.$scroll,o=this.editorInstance;null!=t&&(r(Ao,function(n,r){t.on(r,function(t){n(t,e,o)})}),o.getConfig().scroll&&(n.css("overflow-y","auto"),n.on("scroll",u(function(){o.emit(R.SCROLL)},100))))},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.getActiveEditor();if(null!=t){var n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on(R.CHANGE,function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout(function(){e.destroyed||t.isDestroyed||o&&o(t)}):null!=e.latestEditorSelection&&null==t.selection&&setTimeout(function(){e.destroyed||t.isDestroyed||r&&r(t)}),e.latestEditorSelection=t.selection})}},e.prototype.changeMaxLengthInfo=function(){var e=this.getActiveEditor();if(null!=e){var t=e.getConfig().maxLength;if(t){var n=t-Et.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML="".concat(n,"/").concat(t)}}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width","".concat(e,"%")),e>=100&&setTimeout(function(){t.hide(),t.css("width","0"),t.show()},1e3)},e.prototype.changeViewState=function(){var e=this,t=this.getActiveEditor();null!=t&&(zo(this,t),function(e,t){var n,r=t.getConfig().placeholder;if(r){var o=t.isEmpty();if(o&&!e.showPlaceholder&&!e.isComposing){if(null==e.$placeholder){var i=s('<div class="w-e-text-placeholder">'.concat(r,"</div>"));e.$textAreaContainer.append(i),e.$placeholder=i}return e.$placeholder.show(),void(e.showPlaceholder=!0)}!o&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1)}}(this,t),w(function(){e.destroyed||t.isDestroyed||Co(e,t)}))},e.prototype.destroy=function(){var e;this.destroyed=!0,this.onDOMSelectionChange.cancel(),null===(e=this.selectionChangeRoot)||void 0===e||e.removeEventListener("selectionchange",this.onDOMSelectionChange),this.selectionChangeRoot=null,this.$textAreaContainer.remove()},e}();function Jo(e,t,n,r){if(G.set(e,t),Y.set(e,n),i.Element.isElement(e)){var o=e.children;if((void 0===o?[]:o).forEach(function(t,n){return Jo(t,n,e,r)}),i.Editor.isVoid(r,e)){var a=y(i.Node.texts(e),1),s=y(a[0],1)[0];G.set(s,0),Y.set(s,e)}}}var Go=function(){function e(e,t){var n=this;this.$toolbar=s('<div class="w-e-bar w-e-bar-show w-e-toolbar"></div>'),this.menus={},this.toolbarItems=[],this.config={},this.lngListen=function(){},this.syncToolbarState=function(){n.toolbarItems.forEach(function(e){e.changeMenuState()})},this.changeToolbarState=c(function(){n.syncToolbarState()},200),this.config=t;var r=s(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '".concat(e,"'"));this.$box=r;var o=this.$toolbar;o.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),r.append(o),w(function(){n.initToolbar(),n.lngListen=zr(function(){return n.initToolbar()});var e=n.getEditorInstance();e.on(R.CHANGE,n.changeToolbarState),e.on(R.FULLSCREEN,n.syncToolbarState),e.on(R.UNFULLSCREEN,n.syncToolbarState)})}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.initToolbar=function(){this.menus={};var e=this.$toolbar;null==e||e.empty(),this.registerItems(),this.changeToolbarState()},e.prototype.registerItems=function(){var e=this,t="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,s=r.insertKeys,l=void 0===s?{index:0,keys:[]}:s,c=r.excludeKeys,u=void 0===c?[]:c,d=a(i),f=[];f=Array.isArray(l)?l:[l];var h=0;f.forEach(function(e){var t=e.index+h;if(e.replaceFn&&d[t]){var n=e.replaceFn(d[t]);if(!n)throw new Error("This function needs to return the menu configuration: IToolbarMenuKey");d[t]=n}e.keys.length>0&&("string"==typeof e.keys&&(e.keys=[e.keys]),e.keys.forEach(function(e,n){d.splice(t+n,0,e)}),h+=e.keys.length)});var p=d.filter(function(e){var t="string"==typeof e?e:e.key;return!u.includes(t)}),g=p.length;p.forEach(function(r,o){if("|"===r){if(0===o)return;if(o+1===g)return;if("|"===t)return;var i=Gr();return n.append(i),void(t=r)}return"string"==typeof r?(e.registerSingleItem(r,e),void(t=r)):e.isMenuGroup(r)?(e.registerGroup(r),void(t="group")):(e.registerSingleMenuByConf(r),void(t=r.key))})},e.prototype.isMenuGroup=function(e){return"string"!=typeof e&&Array.isArray(e.menuKeys)},e.prototype.registerSingleMenuByConf=function(e){var t=e.key,n=e.title,r=e.iconSvg;this.registerSingleItem(t,this,{title:n,iconSvg:r})},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new to(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,a=this.config.excludeKeys,s=void 0===a?[]:a;i.forEach(function(e){s.includes(e)||t.registerSingleItem(e,r)}),n.append(r.$elem)},e.prototype.registerSingleItem=function(e,t,n){void 0===n&&(n={});var r=this.getEditorInstance(),o=t instanceof to,i=this.menus,a=i[e];if(null==a){var s=P[e];if(null==s)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof s)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));a=s(),i[e]=a}else console.warn("Duplicated toolbar menu key '".concat(e,"'\n重复注册了菜单栏 menu '").concat(e,"'"));var l=r.getMenuConfig(e);l&&void 0!==l.iconSvg&&(a.iconSvg=l.iconSvg),void 0!==n.iconSvg&&(a.iconSvg=n.iconSvg),void 0!==n.title&&(a.title=n.title);var c=co(e,a,o);(this.toolbarItems.push(c),_.set(c,r),o)?t.appendBarItem(c):t.$toolbar.append(c.$elem)},e.prototype.getEditorInstance=function(){var e=F.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){var e;this.$toolbar.remove(),null===(e=this.lngListen)||void 0===e||e.call(this),this.menus={},this.toolbarItems=[]},e}();var Yo=!1,Xo=!1;function Zo(e){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("[wangeditor-next] `@wangeditor-next/core` export `".concat(e,"` is deprecated.")+" Please import it from `@wangeditor-next/core/upload`.")}e.DOMComment=pe,e.DOMElement=ge,e.DOMNode=he,e.DOMRange=me,e.DOMSelection=ye,e.DOMStaticRange=be,e.DOMText=ve,e.DomEditor=Et,e.ELEM_TO_HTML_CONF=ct,e.EditorEvents=R,e.HTML_TRANSFORM_HANDLER_LIST=st,e.PARSE_ELEM_HTML_CONF=qe,e.PARSE_STYLE_HTML_FN_LIST=Ke,e.PRE_PARSE_HTML_CONF_LIST=ze,e.RENDER_ELEM_CONF=Fo,e.RENDER_STYLE_HANDLER_LIST=$o,e.STYLE_TO_HTML_FN_LIST=at,e.TEXT_TAGS=Ve,e.Toolbar=Go,e.coreCreateEditor=function(e){var t=e.selector,n=void 0===t?"":t,o=e.config,s=void 0===o?{}:o,l=e.content,c=e.html,u=e.plugins,d=void 0===u?[]:u,f=function(e){return[_n,Pt,ce,Dt,Qn,Bn,qn,Vn].reduce(function(e,t){return t(e)},e)}(i.createEditor());if(n&&function(e,t){return rt(e,"data-w-e-textarea",t)}(f,n))throw new Error("Repeated create editor by selector '".concat(n,"'"));var h=function(e){void 0===e&&(e={});var t=a(D),n={},o=e.MENU_CONF,i=void 0===o?{}:o;return r(t,function(e,t){n[t]=v(v({},e),i[t]||{})}),delete e.MENU_CONF,v({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return[]},maxLength:0,MENU_CONF:n,hoverbarKeys:{},textStyleMode:"inline",classStylePolicy:"preserve-data",sanitizeHtml:M,customAlert:function(e,t){window.alert("".concat(t,":\n").concat(e))}},e)}(s);U.set(f,h);var p=h.hoverbarKeys,g=void 0===p?{}:p;if(d.forEach(function(e){f=e(f)}),function(e,t){var n=t.html,r=t.content;null!=n?e.children=ot(e,n):r&&r.length&&(e.children=r),0===e.children.length&&(e.children=[{type:"paragraph",children:[{text:""}]}])}(f,{html:c,content:l}),n){var m=new qo(n);A.set(f,m),$.set(m,f),m.changeViewState();var y=void 0;Object.keys(g).length>0&&(y=new fo,B.set(y,f),j.set(f,y)),f.on(R.CHANGE,function(){f.hidePanelOrModal()}),f.on(R.SCROLL,function(){f.hidePanelOrModal()})}else f.children.forEach(function(e,t){return Jo(e,t,f,f)});var b=h.onCreated,E=h.onDestroyed;return b&&f.on(R.CREATED,function(){return b(f)}),E&&f.on(R.DESTROYED,function(){return E(f)}),w(function(){return f.emit(R.CREATED)}),f},e.coreCreateToolbar=function(e,t){if(null==e)throw new Error("Cannot create toolbar, because editor is null");var n=t.selector,r=t.config,o=void 0===r?{}:r;if(function(e,t){return rt(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '".concat(n,"'"));var i=v({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new Go(n,i);return F.set(a,e),I.set(e,a),a},e.createUploader=function(e,t){return Yo||(Yo=!0,Zo("createUploader")),function(e,t){return e.uploadAdapter?e.uploadAdapter({config:e,editor:t}):O(e)}(e,t)},e.createUppyUploader=function(e){return Xo||(Xo=!0,Zo("createUppyUploader")),O(e)},e.genModalButtonElems=function(e,t){var n=s('<div class="button-container"></div>'),r=s('<button type="button" id="'.concat(e,'">').concat(t,"</button>"));return n.append(r),[n[0],r[0]]},e.genModalInputElems=function(e,t,n){var r=s('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=s('<input type="text" id="'.concat(t,'" placeholder="').concat(n||"",'">'));return r.append(o),[r[0],o[0]]},e.genModalTextareaElems=function(e,t,n){var r=s('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=s('<textarea type="text" id="'.concat(t,'" placeholder="').concat(n||"",'"></textarea>'));return r.append(o),[r[0],o[0]]},e.getClassStylePolicy=function(e){if(!e)return"preserve-data";var t=e.getConfig().classStylePolicy;return"fallback-inline"===t?"fallback-inline":"strict"===t?"strict":"preserve-data"},e.getDefaultView=Ne,e.getEditableChild=Ie,e.getEditableChildAndIndex=Fe,e.getElementById=$e,e.getFirstVoidChild=je,e.getPlainText=Be,e.getTagName=He,e.getTextStyleMode=function(e){return e&&"class"===e.getConfig().textStyleMode?"class":"inline"},e.hasShadowRoot=Ae,e.i18nAddResources=function(e,t){Ur.addResourceBundle(e,Vr,t,!0,!0)},e.i18nChangeLanguage=function(e){Ur.changeLanguage(e)},e.i18nGetResources=function(e){return Ur.getResourceBundle(e,Vr)},e.i18nListenLanguage=zr,e.isDOMComment=Te,e.isDOMElement=Le,e.isDOMNode=ke,e.isDOMSelection=Me,e.isDOMText=De,e.isDataTransfer=xe,e.isDocument=we,e.isHTMLElememt=Oe,e.isPlainTextOnlyPaste=Re,e.isShadowRoot=Ee,e.isUnprocessedListElement=Ce,e.normalizeDOMPoint=Pe,e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;ct[t||""]=n},e.registerHtmlTransformHandler=function(e){st.push(e)},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=v(v({},o),t||{});if(null!=P[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));P[n]=r,function(e,t){null!=t&&(D[e]=t)}(n,i)},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;qe[t]=n},e.registerParseStyleHtmlHandler=function(e){Ke.push(e)},e.registerPreParseHtmlConf=function(e){ze.push(e)},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Fo[t||""]=n},e.registerStyleHandler=function(e){$o.push(e)},e.registerStyleToHtmlHandler=function(e){at.push(e)},e.reportUnsupportedClassStyle=function(e,t){var n=null==e?void 0:e.getConfig().onClassStyleUnsupported;n?n(t):console.warn(t.message)},e.t=Kr,e.transformHtml=lt,e.walkTextNodes=_e});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|