@wangeditor-next/core 1.8.0 → 1.8.2
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/config/interface.d.ts +1 -1
- package/dist/core/src/editor/dom-editor.d.ts +9 -0
- package/dist/core/src/index.d.ts +11 -1
- package/dist/core/src/upload.d.ts +5 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/dist/upload.js +13 -0
- package/dist/upload.js.map +1 -0
- package/dist/upload.mjs +13 -0
- package/dist/upload.mjs.map +1 -0
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("slate"),require("lodash.clonedeep"),require("lodash.foreach"),require("dom7"),require("nanoid"),require("lodash.toarray"),require("lodash.debounce"),require("lodash.throttle"),require("is-hotkey"),require("snabbdom"),require("lodash.camelcase"),require("@uppy/core"),require("@uppy/xhr-upload")):"function"==typeof define&&define.amd?define(["exports","slate","lodash.clonedeep","lodash.foreach","dom7","nanoid","lodash.toarray","lodash.debounce","lodash.throttle","is-hotkey","snabbdom","lodash.camelcase","@uppy/core","@uppy/xhr-upload"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WangEditorCore={},e.require$$0,e.cloneDeep,e.forEach,e.$,null,e.toArray,e.debounce,e.throttle,e.isHotkey,e.snabbdom,e.camelCase,e.Uppy,e.XHRUpload)}(this,function(e,t,n,r,o,i,a,s,u,l,c,f,d,h){"use strict";var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var v,m,y={};function b(){if(m)return v;m=1;var e=function(e){return e&&e.Math===Math&&e};return v=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof p&&p)||e("object"==typeof v&&v)||function(){return this}()||Function("return this")()}var w,x,E,S,O,C,k,T,N={};function R(){return x?w:(x=1,w=function(e){try{return!!e()}catch(e){return!0}})}function M(){if(S)return E;S=1;var e=R();return E=!e(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function L(){if(C)return O;C=1;var e=R();return O=!e(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})}function P(){if(T)return k;T=1;var e=L(),t=Function.prototype.call;return k=e?t.bind(t):function(){return t.apply(t,arguments)},k}var D,A,I,j,$,F,_,B,W,H,U,z,V,K,q,J,G,Y,X,Q,Z,ee,te,ne,re,oe,ie,ae,se,ue,le,ce,fe,de,he,pe,ge,ve,me,ye,be,we={};function xe(){if(D)return we;D=1;var e={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,n=t&&!e.call({1:2},1);return we.f=n?function(e){var n=t(this,e);return!!n&&n.enumerable}:e,we}function Ee(){return I?A:(I=1,A=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}})}function Se(){if($)return j;$=1;var e=L(),t=Function.prototype,n=t.call,r=e&&t.bind.bind(n,n);return j=e?r:function(e){return function(){return n.apply(e,arguments)}},j}function Oe(){if(_)return F;_=1;var e=Se(),t=e({}.toString),n=e("".slice);return F=function(e){return n(t(e),8,-1)}}function Ce(){if(W)return B;W=1;var e=Se(),t=R(),n=Oe(),r=Object,o=e("".split);return B=t(function(){return!r("z").propertyIsEnumerable(0)})?function(e){return"String"===n(e)?o(e,""):r(e)}:r}function ke(){return U?H:(U=1,H=function(e){return null==e})}function Te(){if(V)return z;V=1;var e=ke(),t=TypeError;return z=function(n){if(e(n))throw new t("Can't call method on "+n);return n}}function Ne(){if(q)return K;q=1;var e=Ce(),t=Te();return K=function(n){return e(t(n))}}function Re(){if(G)return J;G=1;var e="object"==typeof document&&document.all;return J=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(e){return"function"==typeof e}}function Me(){if(X)return Y;X=1;var e=Re();return Y=function(t){return"object"==typeof t?null!==t:e(t)}}function Le(){if(Z)return Q;Z=1;var e=b(),t=Re();return Q=function(n,r){return arguments.length<2?(o=e[n],t(o)?o:void 0):e[n]&&e[n][r];var o},Q}function Pe(){if(te)return ee;te=1;var e=Se();return ee=e({}.isPrototypeOf)}function De(){if(re)return ne;re=1;var e=b().navigator,t=e&&e.userAgent;return ne=t?String(t):""}function Ae(){if(ie)return oe;ie=1;var e,t,n=b(),r=De(),o=n.process,i=n.Deno,a=o&&o.versions||i&&i.version,s=a&&a.v8;return s&&(t=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&r&&(!(e=r.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=r.match(/Chrome\/(\d+)/))&&(t=+e[1]),oe=t}function Ie(){if(se)return ae;se=1;var e=Ae(),t=R(),n=b().String;return ae=!!Object.getOwnPropertySymbols&&!t(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41})}function je(){if(le)return ue;le=1;var e=Ie();return ue=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function $e(){if(fe)return ce;fe=1;var e=Le(),t=Re(),n=Pe(),r=je(),o=Object;return ce=r?function(e){return"symbol"==typeof e}:function(r){var i=e("Symbol");return t(i)&&n(i.prototype,o(r))}}function Fe(){if(he)return de;he=1;var e=String;return de=function(t){try{return e(t)}catch(e){return"Object"}}}function _e(){if(ge)return pe;ge=1;var e=Re(),t=Fe(),n=TypeError;return pe=function(r){if(e(r))return r;throw new n(t(r)+" is not a function")}}function Be(){if(me)return ve;me=1;var e=_e(),t=ke();return ve=function(n,r){var o=n[r];return t(o)?void 0:e(o)}}function We(){if(be)return ye;be=1;var e=P(),t=Re(),n=Me(),r=TypeError;return ye=function(o,i){var a,s;if("string"===i&&t(a=o.toString)&&!n(s=e(a,o)))return s;if(t(a=o.valueOf)&&!n(s=e(a,o)))return s;if("string"!==i&&t(a=o.toString)&&!n(s=e(a,o)))return s;throw new r("Can't convert object to primitive value")}}var He,Ue,ze,Ve,Ke,qe,Je,Ge,Ye,Xe,Qe,Ze,et,tt,nt,rt,ot,it,at,st,ut,lt,ct,ft,dt={exports:{}};function ht(){return Ue?He:(Ue=1,He=!1)}function pt(){if(Ve)return ze;Ve=1;var e=b(),t=Object.defineProperty;return ze=function(n,r){try{t(e,n,{value:r,configurable:!0,writable:!0})}catch(t){e[n]=r}return r}}function gt(){if(Ke)return dt.exports;Ke=1;var e=ht(),t=b(),n=pt(),r="__core-js_shared__",o=dt.exports=t[r]||n(r,{});return(o.versions||(o.versions=[])).push({version:"3.47.0",mode:e?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"}),dt.exports}function vt(){if(Je)return qe;Je=1;var e=gt();return qe=function(t,n){return e[t]||(e[t]=n||{})}}function mt(){if(Ye)return Ge;Ye=1;var e=Te(),t=Object;return Ge=function(n){return t(e(n))}}function yt(){if(Qe)return Xe;Qe=1;var e=Se(),t=mt(),n=e({}.hasOwnProperty);return Xe=Object.hasOwn||function(e,r){return n(t(e),r)}}function bt(){if(et)return Ze;et=1;var e=Se(),t=0,n=Math.random(),r=e(1.1.toString);return Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+r(++t+n,36)}}function wt(){if(nt)return tt;nt=1;var e=b(),t=vt(),n=yt(),r=bt(),o=Ie(),i=je(),a=e.Symbol,s=t("wks"),u=i?a.for||a:a&&a.withoutSetter||r;return tt=function(e){return n(s,e)||(s[e]=o&&n(a,e)?a[e]:u("Symbol."+e)),s[e]}}function xt(){if(ot)return rt;ot=1;var e=P(),t=Me(),n=$e(),r=Be(),o=We(),i=wt(),a=TypeError,s=i("toPrimitive");return rt=function(i,u){if(!t(i)||n(i))return i;var l,c=r(i,s);if(c){if(void 0===u&&(u="default"),l=e(c,i,u),!t(l)||n(l))return l;throw new a("Can't convert object to primitive value")}return void 0===u&&(u="number"),o(i,u)}}function Et(){if(at)return it;at=1;var e=xt(),t=$e();return it=function(n){var r=e(n,"string");return t(r)?r:r+""}}function St(){if(ut)return st;ut=1;var e=b(),t=Me(),n=e.document,r=t(n)&&t(n.createElement);return st=function(e){return r?n.createElement(e):{}}}function Ot(){if(ct)return lt;ct=1;var e=M(),t=R(),n=St();return lt=!e&&!t(function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a})}function Ct(){if(ft)return N;ft=1;var e=M(),t=P(),n=xe(),r=Ee(),o=Ne(),i=Et(),a=yt(),s=Ot(),u=Object.getOwnPropertyDescriptor;return N.f=e?u:function(e,l){if(e=o(e),l=i(l),s)try{return u(e,l)}catch(e){}if(a(e,l))return r(!t(n.f,e,l),e[l])},N}var kt,Tt,Nt,Rt,Mt,Lt,Pt,Dt={};function At(){if(Tt)return kt;Tt=1;var e=M(),t=R();return kt=e&&t(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function It(){if(Rt)return Nt;Rt=1;var e=Me(),t=String,n=TypeError;return Nt=function(r){if(e(r))return r;throw new n(t(r)+" is not an object")}}function jt(){if(Mt)return Dt;Mt=1;var e=M(),t=Ot(),n=At(),r=It(),o=Et(),i=TypeError,a=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",c="writable";return Dt.f=e?n?function(e,t,n){if(r(e),t=o(t),r(n),"function"==typeof e&&"prototype"===t&&"value"in n&&c in n&&!n[c]){var i=s(e,t);i&&i[c]&&(e[t]=n.value,n={configurable:l in n?n[l]:i[l],enumerable:u in n?n[u]:i[u],writable:!1})}return a(e,t,n)}:a:function(e,n,s){if(r(e),n=o(n),r(s),t)try{return a(e,n,s)}catch(e){}if("get"in s||"set"in s)throw new i("Accessors not supported");return"value"in s&&(e[n]=s.value),e},Dt}function $t(){if(Pt)return Lt;Pt=1;var e=M(),t=jt(),n=Ee();return Lt=e?function(e,r,o){return t.f(e,r,n(1,o))}:function(e,t,n){return e[t]=n,e}}var Ft,_t,Bt,Wt,Ht,Ut,zt,Vt,Kt,qt,Jt,Gt,Yt,Xt,Qt,Zt={exports:{}};function en(){if(_t)return Ft;_t=1;var e=M(),t=yt(),n=Function.prototype,r=e&&Object.getOwnPropertyDescriptor,o=t(n,"name"),i=o&&"something"===function(){}.name,a=o&&(!e||e&&r(n,"name").configurable);return Ft={EXISTS:o,PROPER:i,CONFIGURABLE:a}}function tn(){if(Wt)return Bt;Wt=1;var e=Se(),t=Re(),n=gt(),r=e(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(e){return r(e)}),Bt=n.inspectSource}function nn(){if(Ut)return Ht;Ut=1;var e=b(),t=Re(),n=e.WeakMap;return Ht=t(n)&&/native code/.test(String(n))}function rn(){if(Vt)return zt;Vt=1;var e=vt(),t=bt(),n=e("keys");return zt=function(e){return n[e]||(n[e]=t(e))}}function on(){return qt?Kt:(qt=1,Kt={})}function an(){if(Gt)return Jt;Gt=1;var e,t,n,r=nn(),o=b(),i=Me(),a=$t(),s=yt(),u=gt(),l=rn(),c=on(),f="Object already initialized",d=o.TypeError,h=o.WeakMap;if(r||u.state){var p=u.state||(u.state=new h);p.get=p.get,p.has=p.has,p.set=p.set,e=function(e,t){if(p.has(e))throw new d(f);return t.facade=e,p.set(e,t),t},t=function(e){return p.get(e)||{}},n=function(e){return p.has(e)}}else{var g=l("state");c[g]=!0,e=function(e,t){if(s(e,g))throw new d(f);return t.facade=e,a(e,g,t),t},t=function(e){return s(e,g)?e[g]:{}},n=function(e){return s(e,g)}}return Jt={set:e,get:t,has:n,enforce:function(r){return n(r)?t(r):e(r,{})},getterFor:function(e){return function(n){var r;if(!i(n)||(r=t(n)).type!==e)throw new d("Incompatible receiver, "+e+" required");return r}}}}function sn(){if(Yt)return Zt.exports;Yt=1;var e=Se(),t=R(),n=Re(),r=yt(),o=M(),i=en().CONFIGURABLE,a=tn(),s=an(),u=s.enforce,l=s.get,c=String,f=Object.defineProperty,d=e("".slice),h=e("".replace),p=e([].join),g=o&&!t(function(){return 8!==f(function(){},"length",{value:8}).length}),v=String(String).split("String"),m=Zt.exports=function(e,t,n){"Symbol("===d(c(t),0,7)&&(t="["+h(c(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!r(e,"name")||i&&e.name!==t)&&(o?f(e,"name",{value:t,configurable:!0}):e.name=t),g&&n&&r(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?o&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var a=u(e);return r(a,"source")||(a.source=p(v,"string"==typeof t?t:"")),e};return Function.prototype.toString=m(function(){return n(this)&&l(this).source||a(this)},"toString"),Zt.exports}function un(){if(Qt)return Xt;Qt=1;var e=Re(),t=jt(),n=sn(),r=pt();return Xt=function(o,i,a,s){s||(s={});var u=s.enumerable,l=void 0!==s.name?s.name:i;if(e(a)&&n(a,l,s),s.global)u?o[i]=a:r(i,a);else{try{s.unsafe?o[i]&&(u=!0):delete o[i]}catch(e){}u?o[i]=a:t.f(o,i,{value:a,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return o}}var ln,cn,fn,dn,hn,pn,gn,vn,mn,yn,bn,wn,xn,En,Sn,On,Cn,kn={};function Tn(){if(dn)return fn;dn=1;var e=function(){if(cn)return ln;cn=1;var e=Math.ceil,t=Math.floor;return ln=Math.trunc||function(n){var r=+n;return(r>0?t:e)(r)},ln}();return fn=function(t){var n=+t;return n!=n||0===n?0:e(n)}}function Nn(){if(pn)return hn;pn=1;var e=Tn(),t=Math.max,n=Math.min;return hn=function(r,o){var i=e(r);return i<0?t(i+o,0):n(i,o)}}function Rn(){if(vn)return gn;vn=1;var e=Tn(),t=Math.min;return gn=function(n){var r=e(n);return r>0?t(r,9007199254740991):0}}function Mn(){if(yn)return mn;yn=1;var e=Rn();return mn=function(t){return e(t.length)}}function Ln(){if(wn)return bn;wn=1;var e=Ne(),t=Nn(),n=Mn(),r=function(r){return function(o,i,a){var s=e(o),u=n(s);if(0===u)return!r&&-1;var l,c=t(a,u);if(r&&i!=i){for(;u>c;)if((l=s[c++])!=l)return!0}else for(;u>c;c++)if((r||c in s)&&s[c]===i)return r||c||0;return!r&&-1}};return bn={includes:r(!0),indexOf:r(!1)}}function Pn(){if(En)return xn;En=1;var e=Se(),t=yt(),n=Ne(),r=Ln().indexOf,o=on(),i=e([].push);return xn=function(e,a){var s,u=n(e),l=0,c=[];for(s in u)!t(o,s)&&t(u,s)&&i(c,s);for(;a.length>l;)t(u,s=a[l++])&&(~r(c,s)||i(c,s));return c}}function Dn(){return On?Sn:(On=1,Sn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function An(){if(Cn)return kn;Cn=1;var e=Pn(),t=Dn().concat("length","prototype");return kn.f=Object.getOwnPropertyNames||function(n){return e(n,t)},kn}var In,jn,$n,Fn,_n,Bn,Wn,Hn,Un,zn,Vn,Kn,qn={};function Jn(){return In||(In=1,qn.f=Object.getOwnPropertySymbols),qn}function Gn(){if($n)return jn;$n=1;var e=Le(),t=Se(),n=An(),r=Jn(),o=It(),i=t([].concat);return jn=e("Reflect","ownKeys")||function(e){var t=n.f(o(e)),a=r.f;return a?i(t,a(e)):t},jn}function Yn(){if(_n)return Fn;_n=1;var e=yt(),t=Gn(),n=Ct(),r=jt();return Fn=function(o,i,a){for(var s=t(i),u=r.f,l=n.f,c=0;c<s.length;c++){var f=s[c];e(o,f)||a&&e(a,f)||u(o,f,l(i,f))}},Fn}function Xn(){if(Wn)return Bn;Wn=1;var e=R(),t=Re(),n=/#|\.prototype\./,r=function(n,r){var u=i[o(n)];return u===s||u!==a&&(t(r)?e(r):!!r)},o=r.normalize=function(e){return String(e).replace(n,".").toLowerCase()},i=r.data={},a=r.NATIVE="N",s=r.POLYFILL="P";return Bn=r}function Qn(){if(Un)return Hn;Un=1;var e=b(),t=Ct().f,n=$t(),r=un(),o=pt(),i=Yn(),a=Xn();return Hn=function(s,u){var l,c,f,d,h,p=s.target,g=s.global,v=s.stat;if(l=g?e:v?e[p]||o(p,{}):e[p]&&e[p].prototype)for(c in u){if(d=u[c],f=s.dontCallGetSet?(h=t(l,c))&&h.value:l[c],!a(g?c:p+(v?".":"#")+c,s.forced)&&void 0!==f){if(typeof d==typeof f)continue;i(d,f)}(s.sham||f&&f.sham)&&n(d,"sham",!0),r(l,c,d,s)}}}function Zn(){if(Vn)return zn;Vn=1;var e=Pn(),t=Dn();return zn=Object.keys||function(n){return e(n,t)}}!function(){if(Kn)return y;Kn=1;var e=Qn(),t=mt(),n=Zn();e({target:"Object",stat:!0,forced:R()(function(){n(1)})},{keys:function(e){return n(t(e))}})}();var er,tr,nr,rr,or,ir,ar,sr={};function ur(){if(tr)return er;tr=1;var e={};return e[wt()("toStringTag")]="z",er="[object z]"===String(e)}function lr(){if(rr)return nr;rr=1;var e=ur(),t=Re(),n=Oe(),r=wt()("toStringTag"),o=Object,i="Arguments"===n(function(){return arguments}());return nr=e?n:function(e){var a,s,u;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(s=function(e,t){try{return e[t]}catch(e){}}(a=o(e),r))?s:i?n(a):"Object"===(u=n(a))&&t(a.callee)?"Arguments":u}}!function(){if(ar)return sr;ar=1;var e=ur(),t=un(),n=function(){if(ir)return or;ir=1;var e=ur(),t=lr();return or=e?{}.toString:function(){return"[object "+t(this)+"]"}}();e||t(Object.prototype,"toString",n,{unsafe:!0})}();var cr,fr,dr,hr,pr,gr,vr,mr,yr,br,wr,xr,Er,Sr,Or,Cr,kr,Tr,Nr,Rr,Mr,Lr,Pr,Dr={};function Ar(){return fr?cr:(fr=1,cr={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0})}function Ir(){if(hr)return dr;hr=1;var e=St()("span").classList,t=e&&e.constructor&&e.constructor.prototype;return dr=t===Object.prototype?void 0:t}function jr(){if(gr)return pr;gr=1;var e=Oe(),t=Se();return pr=function(n){if("Function"===e(n))return t(n)}}function $r(){if(mr)return vr;mr=1;var e=jr(),t=_e(),n=L(),r=e(e.bind);return vr=function(e,o){return t(e),void 0===o?e:n?r(e,o):function(){return e.apply(o,arguments)}},vr}function Fr(){if(br)return yr;br=1;var e=Oe();return yr=Array.isArray||function(t){return"Array"===e(t)}}function _r(){if(xr)return wr;xr=1;var e=Se(),t=R(),n=Re(),r=lr(),o=Le(),i=tn(),a=function(){},s=o("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=e(u.exec),c=!u.test(a),f=function(e){if(!n(e))return!1;try{return s(a,[],e),!0}catch(e){return!1}},d=function(e){if(!n(e))return!1;switch(r(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return c||!!l(u,i(e))}catch(e){return!0}};return d.sham=!0,wr=!s||t(function(){var e;return f(f.call)||!f(Object)||!f(function(){e=!0})||e})?d:f}function Br(){if(Sr)return Er;Sr=1;var e=Fr(),t=_r(),n=Me(),r=wt()("species"),o=Array;return Er=function(i){var a;return e(i)&&(a=i.constructor,(t(a)&&(a===o||e(a.prototype))||n(a)&&null===(a=a[r]))&&(a=void 0)),void 0===a?o:a}}function Wr(){if(Cr)return Or;Cr=1;var e=Br();return Or=function(t,n){return new(e(t))(0===n?0:n)}}function Hr(){if(Tr)return kr;Tr=1;var e=$r(),t=Se(),n=Ce(),r=mt(),o=Mn(),i=Wr(),a=t([].push),s=function(t){var s=1===t,u=2===t,l=3===t,c=4===t,f=6===t,d=7===t,h=5===t||f;return function(p,g,v,m){for(var y,b,w=r(p),x=n(w),E=o(x),S=e(g,v),O=0,C=m||i,k=s?C(p,E):u||d?C(p,0):void 0;E>O;O++)if((h||O in x)&&(b=S(y=x[O],O,w),t))if(s)k[O]=b;else if(b)switch(t){case 3:return!0;case 5:return y;case 6:return O;case 2:a(k,y)}else switch(t){case 4:return!1;case 7:a(k,y)}return f?-1:l||c?c:k}};return kr={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}}function Ur(){if(Rr)return Nr;Rr=1;var e=R();return Nr=function(t,n){var r=[][t];return!!r&&e(function(){r.call(null,n||function(){return 1},1)})}}!function(){if(Pr)return Dr;Pr=1;var e=b(),t=Ar(),n=Ir(),r=function(){if(Lr)return Mr;Lr=1;var e=Hr().forEach,t=Ur()("forEach");return Mr=t?[].forEach:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)},Mr}(),o=$t(),i=function(e){if(e&&e.forEach!==r)try{o(e,"forEach",r)}catch(t){e.forEach=r}};for(var a in t)t[a]&&i(e[a]&&e[a].prototype);i(n)}();var zr,Vr={};function Kr(){if(zr)return Vr;zr=1;var e=t,n={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))}},r=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakMap,s={isHistoryEditor:function(t){return n.isHistory(t.history)&&e.Editor.isEditor(t)},isMerging:function(e){return i.get(e)},isSplittingOnce:function(e){return a.get(e)},setSplittingOnce:function(e,t){a.set(e,t)},isSaving:function(e){return o.get(e)},redo:function(e){e.redo()},undo:function(e){e.undo()},withMerging:function(e,t){var n=s.isMerging(e);i.set(e,!0),t(),i.set(e,n)},withNewBatch:function(e,t){var n=s.isMerging(e);i.set(e,!0),a.set(e,!0),t(),i.set(e,n),a.delete(e)},withoutMerging:function(e,t){var n=s.isMerging(e);i.set(e,!1),t(),i.set(e,n)},withoutSaving:function(e,t){var n=s.isSaving(e);o.set(e,!1);try{t()}finally{o.set(e,n)}}};function u(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 l(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 l(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 l(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 c=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))},f=function(e,t){return"set_selection"!==e.type};return Vr.HISTORY=r,Vr.History=n,Vr.HistoryEditor=s,Vr.MERGING=i,Vr.SAVING=o,Vr.SPLITTING_ONCE=a,Vr.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=u(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=u(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],u=a&&a.operations[a.operations.length-1],l=s.isSaving(n),d=s.isMerging(n);if(null==l&&(l=f(e)),l){if(null==d&&(d=null!=a&&(!!t.includes(u)||c(e,u))),s.isSplittingOnce(n)&&(d=!1,s.setSplittingOnce(n,void 0)),a&&d)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},Vr}var qr,Jr,Gr,Yr,Xr,Qr,Zr,eo=Kr(),to={};function no(){if(Jr)return qr;Jr=1;var e=TypeError;return qr=function(t){if(t>9007199254740991)throw e("Maximum allowed index exceeded");return t}}function ro(){if(Yr)return Gr;Yr=1;var e=M(),t=jt(),n=Ee();return Gr=function(r,o,i){e?t.f(r,o,n(0,i)):r[o]=i}}function oo(){if(Qr)return Xr;Qr=1;var e=R(),t=wt(),n=Ae(),r=t("species");return Xr=function(t){return n>=51||!e(function(){var e=[];return(e.constructor={})[r]=function(){return{foo:1}},1!==e[t](Boolean).foo})}}!function(){if(Zr)return to;Zr=1;var e=Qn(),t=R(),n=Fr(),r=Me(),o=mt(),i=Mn(),a=no(),s=ro(),u=Wr(),l=oo(),c=wt(),f=Ae(),d=c("isConcatSpreadable"),h=f>=51||!t(function(){var e=[];return e[d]=!1,e.concat()[0]!==e}),p=function(e){if(!r(e))return!1;var t=e[d];return void 0!==t?!!t:n(e)};e({target:"Array",proto:!0,arity:1,forced:!h||!l("concat")},{concat:function(e){var t,n,r,l,c,f=o(this),d=u(f,0),h=0;for(t=-1,r=arguments.length;t<r;t++)if(p(c=-1===t?f:arguments[t]))for(l=i(c),a(h+l),n=0;n<l;n++,h++)n in c&&s(d,h,c[n]);else a(h+1),s(d,h++,c);return d.length=h,d}})}();var io=function(e,t){return io=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])},io(e,t)};function ao(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}io(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var so=function(){return so=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},so.apply(this,arguments)};function uo(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 lo(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 co(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"==typeof SuppressedError&&SuppressedError;var fo,ho={};!function(){if(fo)return ho;fo=1;var e=Qn(),t=Hr().filter;e({target:"Array",proto:!0,forced:!oo()("filter")},{filter:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}})}();var po,go,vo,mo,yo,bo,wo,xo,Eo,So,Oo,Co,ko,To,No,Ro,Mo,Lo={};function Po(){if(go)return po;go=1;var e=P(),t=It(),n=Be();return po=function(r,o,i){var a,s;t(r);try{if(!(a=n(r,"return"))){if("throw"===o)throw i;return i}a=e(a,r)}catch(e){s=!0,a=e}if("throw"===o)throw i;if(s)throw a;return t(a),i}}function Do(){if(mo)return vo;mo=1;var e=It(),t=Po();return vo=function(n,r,o,i){try{return i?r(e(o)[0],o[1]):r(o)}catch(e){t(n,"throw",e)}}}function Ao(){return bo?yo:(bo=1,yo={})}function Io(){if(xo)return wo;xo=1;var e=wt(),t=Ao(),n=e("iterator"),r=Array.prototype;return wo=function(e){return void 0!==e&&(t.Array===e||r[n]===e)}}function jo(){if(So)return Eo;So=1;var e=lr(),t=Be(),n=ke(),r=Ao(),o=wt()("iterator");return Eo=function(i){if(!n(i))return t(i,o)||t(i,"@@iterator")||r[e(i)]}}function $o(){if(Co)return Oo;Co=1;var e=P(),t=_e(),n=It(),r=Fe(),o=jo(),i=TypeError;return Oo=function(a,s){var u=arguments.length<2?o(a):s;if(t(u))return n(e(u,a));throw new i(r(a)+" is not iterable")},Oo}function Fo(){if(Ro)return No;Ro=1;var e=wt()("iterator"),t=!1;try{var n=0,r={next:function(){return{done:!!n++}},return:function(){t=!0}};r[e]=function(){return this},Array.from(r,function(){throw 2})}catch(e){}return No=function(n,r){try{if(!r&&!t)return!1}catch(e){return!1}var o=!1;try{var i={};i[e]=function(){return{next:function(){return{done:o=!0}}}},n(i)}catch(e){}return o}}!function(){if(Mo)return Lo;Mo=1;var e=Qn(),t=function(){if(To)return ko;To=1;var e=$r(),t=P(),n=mt(),r=Do(),o=Io(),i=_r(),a=Mn(),s=ro(),u=$o(),l=jo(),c=Array;return ko=function(f){var d=n(f),h=i(this),p=arguments.length,g=p>1?arguments[1]:void 0,v=void 0!==g;v&&(g=e(g,p>2?arguments[2]:void 0));var m,y,b,w,x,E,S=l(d),O=0;if(!S||this===c&&o(S))for(m=a(d),y=h?new this(m):c(m);m>O;O++)E=v?g(d[O],O):d[O],s(y,O,E);else for(y=h?new this:[],x=(w=u(d,S)).next;!(b=t(x,w)).done;O++)E=v?r(w,g,[b.value,O],!0):b.value,s(y,O,E);return y.length=O,y},ko}();e({target:"Array",stat:!0,forced:!Fo()(function(e){Array.from(e)})},{from:t})}();var _o,Bo,Wo,Ho,Uo,zo,Vo,Ko,qo,Jo,Go,Yo,Xo,Qo,Zo,ei,ti,ni,ri,oi,ii,ai,si,ui,li,ci,fi,di,hi,pi,gi,vi={};function mi(){if(Wo)return Bo;Wo=1;var e=Le();return Bo=e("document","documentElement")}function yi(){if(Uo)return Ho;Uo=1;var e,t=It(),n=function(){if(_o)return vi;_o=1;var e=M(),t=At(),n=jt(),r=It(),o=Ne(),i=Zn();return vi.f=e&&!t?Object.defineProperties:function(e,t){r(e);for(var a,s=o(t),u=i(t),l=u.length,c=0;l>c;)n.f(e,a=u[c++],s[a]);return e},vi}(),r=Dn(),o=on(),i=mi(),a=St(),s=rn(),u="prototype",l="script",c=s("IE_PROTO"),f=function(){},d=function(e){return"<"+l+">"+e+"</"+l+">"},h=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},p=function(){try{e=new ActiveXObject("htmlfile")}catch(e){}var t,n,o;p="undefined"!=typeof document?document.domain&&e?h(e):(n=a("iframe"),o="java"+l+":",n.style.display="none",i.appendChild(n),n.src=String(o),(t=n.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F):h(e);for(var s=r.length;s--;)delete p[u][r[s]];return p()};return o[c]=!0,Ho=Object.create||function(e,r){var o;return null!==e?(f[u]=t(e),o=new f,f[u]=null,o[c]=e):o=p(),void 0===r?o:n.f(o,r)}}function bi(){if(Vo)return zo;Vo=1;var e=wt(),t=yi(),n=jt().f,r=e("unscopables"),o=Array.prototype;return void 0===o[r]&&n(o,r,{configurable:!0,value:t(null)}),zo=function(e){o[r][e]=!0}}function wi(){if(Go)return Jo;Go=1;var e=yt(),t=Re(),n=mt(),r=rn(),o=function(){if(qo)return Ko;qo=1;var e=R();return Ko=!e(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})}(),i=r("IE_PROTO"),a=Object,s=a.prototype;return Jo=o?a.getPrototypeOf:function(r){var o=n(r);if(e(o,i))return o[i];var u=o.constructor;return t(u)&&o instanceof u?u.prototype:o instanceof a?s:null}}function xi(){if(Xo)return Yo;Xo=1;var e,t,n,r=R(),o=Re(),i=Me(),a=yi(),s=wi(),u=un(),l=wt(),c=ht(),f=l("iterator"),d=!1;return[].keys&&("next"in(n=[].keys())?(t=s(s(n)))!==Object.prototype&&(e=t):d=!0),!i(e)||r(function(){var t={};return e[f].call(t)!==t})?e={}:c&&(e=a(e)),o(e[f])||u(e,f,function(){return this}),Yo={IteratorPrototype:e,BUGGY_SAFARI_ITERATORS:d}}function Ei(){if(Zo)return Qo;Zo=1;var e=jt().f,t=yt(),n=wt()("toStringTag");return Qo=function(r,o,i){r&&!i&&(r=r.prototype),r&&!t(r,n)&&e(r,n,{configurable:!0,value:o})}}function Si(){if(ii)return oi;ii=1;var e=Me();return oi=function(t){return e(t)||null===t}}function Oi(){if(si)return ai;si=1;var e=Si(),t=String,n=TypeError;return ai=function(r){if(e(r))return r;throw new n("Can't set "+t(r)+" as a prototype")}}function Ci(){if(li)return ui;li=1;var e=function(){if(ri)return ni;ri=1;var e=Se(),t=_e();return ni=function(n,r,o){try{return e(t(Object.getOwnPropertyDescriptor(n,r)[o]))}catch(e){}}}(),t=Me(),n=Te(),r=Oi();return ui=Object.setPrototypeOf||("__proto__"in{}?function(){var o,i=!1,a={};try{(o=e(Object.prototype,"__proto__","set"))(a,[]),i=a instanceof Array}catch(e){}return function(e,a){return n(e),r(a),t(e)?(i?o(e,a):e.__proto__=a,e):e}}():void 0)}function ki(){if(fi)return ci;fi=1;var e=Qn(),t=P(),n=ht(),r=en(),o=Re(),i=function(){if(ti)return ei;ti=1;var e=xi().IteratorPrototype,t=yi(),n=Ee(),r=Ei(),o=Ao(),i=function(){return this};return ei=function(a,s,u,l){var c=s+" Iterator";return a.prototype=t(e,{next:n(+!l,u)}),r(a,c,!1,!0),o[c]=i,a}}(),a=wi(),s=Ci(),u=Ei(),l=$t(),c=un(),f=wt(),d=Ao(),h=xi(),p=r.PROPER,g=r.CONFIGURABLE,v=h.IteratorPrototype,m=h.BUGGY_SAFARI_ITERATORS,y=f("iterator"),b="keys",w="values",x="entries",E=function(){return this};return ci=function(r,f,h,S,O,C,k){i(h,f,S);var T,N,R,M=function(e){if(e===O&&I)return I;if(!m&&e&&e in D)return D[e];switch(e){case b:case w:case x:return function(){return new h(this,e)}}return function(){return new h(this)}},L=f+" Iterator",P=!1,D=r.prototype,A=D[y]||D["@@iterator"]||O&&D[O],I=!m&&A||M(O),j="Array"===f&&D.entries||A;if(j&&(T=a(j.call(new r)))!==Object.prototype&&T.next&&(n||a(T)===v||(s?s(T,v):o(T[y])||c(T,y,E)),u(T,L,!0,!0),n&&(d[L]=E)),p&&O===w&&A&&A.name!==w&&(!n&&g?l(D,"name",w):(P=!0,I=function(){return t(A,this)})),O)if(N={values:M(w),keys:C?I:M(b),entries:M(x)},k)for(R in N)(m||P||!(R in D))&&c(D,R,N[R]);else e({target:f,proto:!0,forced:m||P},N);return n&&!k||D[y]===I||c(D,y,I,{name:O}),d[f]=I,N}}function Ti(){return hi?di:(hi=1,di=function(e,t){return{value:e,done:t}})}function Ni(){if(gi)return pi;gi=1;var e=Ne(),t=bi(),n=Ao(),r=an(),o=jt().f,i=ki(),a=Ti(),s=ht(),u=M(),l="Array Iterator",c=r.set,f=r.getterFor(l);pi=i(Array,"Array",function(t,n){c(this,{type:l,target:e(t),index:0,kind:n})},function(){var e=f(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,a(void 0,!0);switch(e.kind){case"keys":return a(n,!1);case"values":return a(t[n],!1)}return a([n,t[n]],!1)},"values");var d=n.Arguments=n.Array;if(t("keys"),t("values"),t("entries"),!s&&u&&"values"!==d.name)try{o(d,"name",{value:"values"})}catch(e){}return pi}Ni();var Ri,Mi={};!function(){if(Ri)return Mi;Ri=1;var e=Qn(),t=Se(),n=Ce(),r=Ne(),o=Ur(),i=t([].join);e({target:"Array",proto:!0,forced:n!==Object||!o("join",",")},{join:function(e){return i(r(this),void 0===e?",":e)}})}();var Li,Pi,Di,Ai={};function Ii(){if(Pi)return Li;Pi=1;var e=sn(),t=jt();return Li=function(n,r,o){return o.get&&e(o.get,r,{getter:!0}),o.set&&e(o.set,r,{setter:!0}),t.f(n,r,o)}}!function(){if(Di)return Ai;Di=1;var e=M(),t=en().EXISTS,n=Se(),r=Ii(),o=Function.prototype,i=n(o.toString),a=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,s=n(a.exec);e&&!t&&r(o,"name",{configurable:!0,get:function(){try{return s(a,i(this))[1]}catch(e){return""}}})}();var ji,$i,Fi,_i,Bi,Wi,Hi,Ui,zi,Vi,Ki,qi,Ji,Gi,Yi,Xi,Qi,Zi,ea,ta,na,ra,oa,ia,aa,sa,ua={exports:{}},la={};function ca(){if($i)return ji;$i=1;var e=Se();return ji=e([].slice)}function fa(){if(Fi)return la;Fi=1;var e=Oe(),t=Ne(),n=An().f,r=ca(),o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return la.f=function(i){return o&&"Window"===e(i)?function(e){try{return n(e)}catch(e){return r(o)}}(i):n(t(i))},la}function da(){if(Hi)return Wi;Hi=1;var e=R(),t=Me(),n=Oe(),r=function(){if(Bi)return _i;Bi=1;var e=R();return _i=e(function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})}(),o=Object.isExtensible,i=e(function(){});return Wi=i||r?function(e){return!!t(e)&&((!r||"ArrayBuffer"!==n(e))&&(!o||o(e)))}:o}function ha(){if(zi)return Ui;zi=1;var e=R();return Ui=!e(function(){return Object.isExtensible(Object.preventExtensions({}))})}function pa(){if(Vi)return ua.exports;Vi=1;var e=Qn(),t=Se(),n=on(),r=Me(),o=yt(),i=jt().f,a=An(),s=fa(),u=da(),l=bt(),c=ha(),f=!1,d=l("meta"),h=0,p=function(e){i(e,d,{value:{objectID:"O"+h++,weakData:{}}})},g=ua.exports={enable:function(){g.enable=function(){},f=!0;var n=a.f,r=t([].splice),o={};o[d]=1,n(o).length&&(a.f=function(e){for(var t=n(e),o=0,i=t.length;o<i;o++)if(t[o]===d){r(t,o,1);break}return t},e({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:s.f}))},fastKey:function(e,t){if(!r(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,d)){if(!u(e))return"F";if(!t)return"E";p(e)}return e[d].objectID},getWeakData:function(e,t){if(!o(e,d)){if(!u(e))return!0;if(!t)return!1;p(e)}return e[d].weakData},onFreeze:function(e){return c&&f&&u(e)&&!o(e,d)&&p(e),e}};return n[d]=!0,ua.exports}function ga(){if(qi)return Ki;qi=1;var e=$r(),t=P(),n=It(),r=Fe(),o=Io(),i=Mn(),a=Pe(),s=$o(),u=jo(),l=Po(),c=TypeError,f=function(e,t){this.stopped=e,this.result=t},d=f.prototype;return Ki=function(h,p,g){var v,m,y,b,w,x,E,S=g&&g.that,O=!(!g||!g.AS_ENTRIES),C=!(!g||!g.IS_RECORD),k=!(!g||!g.IS_ITERATOR),T=!(!g||!g.INTERRUPTED),N=e(p,S),R=function(e){return v&&l(v,"normal"),new f(!0,e)},M=function(e){return O?(n(e),T?N(e[0],e[1],R):N(e[0],e[1])):T?N(e,R):N(e)};if(C)v=h.iterator;else if(k)v=h;else{if(!(m=u(h)))throw new c(r(h)+" is not iterable");if(o(m)){for(y=0,b=i(h);b>y;y++)if((w=M(h[y]))&&a(d,w))return w;return new f(!1)}v=s(h,m)}for(x=C?h.next:v.next;!(E=t(x,v)).done;){try{w=M(E.value)}catch(e){l(v,"throw",e)}if("object"==typeof w&&w&&a(d,w))return w}return new f(!1)}}function va(){if(Gi)return Ji;Gi=1;var e=Pe(),t=TypeError;return Ji=function(n,r){if(e(r,n))return n;throw new t("Incorrect invocation")}}function ma(){if(Xi)return Yi;Xi=1;var e=Re(),t=Me(),n=Ci();return Yi=function(r,o,i){var a,s;return n&&e(a=o.constructor)&&a!==i&&t(s=a.prototype)&&s!==i.prototype&&n(r,s),r}}function ya(){if(Zi)return Qi;Zi=1;var e=Qn(),t=b(),n=Se(),r=Xn(),o=un(),i=pa(),a=ga(),s=va(),u=Re(),l=ke(),c=Me(),f=R(),d=Fo(),h=Ei(),p=ma();return Qi=function(g,v,m){var y=-1!==g.indexOf("Map"),b=-1!==g.indexOf("Weak"),w=y?"set":"add",x=t[g],E=x&&x.prototype,S=x,O={},C=function(e){var t=n(E[e]);o(E,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(b&&!c(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return b&&!c(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(b&&!c(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(r(g,!u(x)||!(b||E.forEach&&!f(function(){(new x).entries().next()}))))S=m.getConstructor(v,g,y,w),i.enable();else if(r(g,!0)){var k=new S,T=k[w](b?{}:-0,1)!==k,N=f(function(){k.has(1)}),R=d(function(e){new x(e)}),M=!b&&f(function(){for(var e=new x,t=5;t--;)e[w](t,t);return!e.has(-0)});R||((S=v(function(e,t){s(e,E);var n=p(new x,e,S);return l(t)||a(t,n[w],{that:n,AS_ENTRIES:y}),n})).prototype=E,E.constructor=S),(N||M)&&(C("delete"),C("has"),y&&C("get")),(M||T)&&C(w),b&&E.clear&&delete E.clear}return O[g]=S,e({global:!0,constructor:!0,forced:S!==x},O),h(S,g),b||m.setStrong(S,g,y),S},Qi}function ba(){if(ta)return ea;ta=1;var e=un();return ea=function(t,n,r){for(var o in n)e(t,o,n[o],r);return t}}function wa(){if(ra)return na;ra=1;var e=Le(),t=Ii(),n=wt(),r=M(),o=n("species");return na=function(n){var i=e(n);r&&i&&!i[o]&&t(i,o,{configurable:!0,get:function(){return this}})}}sa||(sa=1,aa||(aa=1,ya()("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},function(){if(ia)return oa;ia=1;var e=yi(),t=Ii(),n=ba(),r=$r(),o=va(),i=ke(),a=ga(),s=ki(),u=Ti(),l=wa(),c=M(),f=pa().fastKey,d=an(),h=d.set,p=d.getterFor;return oa={getConstructor:function(s,u,l,d){var g=s(function(t,n){o(t,v),h(t,{type:u,index:e(null),first:null,last:null,size:0}),c||(t.size=0),i(n)||a(n,t[d],{that:t,AS_ENTRIES:l})}),v=g.prototype,m=p(u),y=function(e,t,n){var r,o,i=m(e),a=b(e,t);return a?a.value=n:(i.last=a={index:o=f(t,!0),key:t,value:n,previous:r=i.last,next:null,removed:!1},i.first||(i.first=a),r&&(r.next=a),c?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},b=function(e,t){var n,r=m(e),o=f(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key===t)return n};return n(v,{clear:function(){for(var t=m(this),n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=null),n=n.next;t.first=t.last=null,t.index=e(null),c?t.size=0:this.size=0},delete:function(e){var t=this,n=m(t),r=b(t,e);if(r){var o=r.next,i=r.previous;delete n.index[r.index],r.removed=!0,i&&(i.next=o),o&&(o.previous=i),n.first===r&&(n.first=o),n.last===r&&(n.last=i),c?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=m(this),o=r(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(o(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!b(this,e)}}),n(v,l?{get:function(e){var t=b(this,e);return t&&t.value},set:function(e,t){return y(this,0===e?0:e,t)}}:{add:function(e){return y(this,e=0===e?0:e,e)}}),c&&t(v,"size",{configurable:!0,get:function(){return m(this).size}}),g},setStrong:function(e,t,n){var r=t+" Iterator",o=p(t),i=p(r);s(e,t,function(e,t){h(this,{type:r,target:e,state:o(e),kind:t,last:null})},function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?u("keys"===t?n.key:"values"===t?n.value:[n.key,n.value],!1):(e.target=null,u(void 0,!0))},n?"entries":"values",!n,!0),l(t)}},oa}())));var xa,Ea,Sa,Oa,Ca,ka={};function Ta(){if(Ea)return xa;Ea=1;var e=lr(),t=String;return xa=function(n){if("Symbol"===e(n))throw new TypeError("Cannot convert a Symbol value to a string");return t(n)}}function Na(){if(Oa)return Sa;Oa=1;var e=Se(),t=Tn(),n=Ta(),r=Te(),o=e("".charAt),i=e("".charCodeAt),a=e("".slice),s=function(e){return function(s,u){var l,c,f=n(r(s)),d=t(u),h=f.length;return d<0||d>=h?e?"":void 0:(l=i(f,d))<55296||l>56319||d+1===h||(c=i(f,d+1))<56320||c>57343?e?o(f,d):l:e?a(f,d,d+2):c-56320+(l-55296<<10)+65536}};return Sa={codeAt:s(!1),charAt:s(!0)}}!function(){if(Ca)return ka;Ca=1;var e=Na().charAt,t=Ta(),n=an(),r=ki(),o=Ti(),i="String Iterator",a=n.set,s=n.getterFor(i);r(String,"String",function(e){a(this,{type:i,string:t(e),index:0})},function(){var t,n=s(this),r=n.string,i=n.index;return i>=r.length?o(void 0,!0):(t=e(r,i),n.index+=t.length,o(t,!1))})}();var Ra,Ma,La,Pa,Da,Aa,Ia,ja={};function $a(){if(Ma)return Ra;Ma=1;var e=Me(),t=Oe(),n=wt()("match");return Ra=function(r){var o;return e(r)&&(void 0!==(o=r[n])?!!o:"RegExp"===t(r))}}function Fa(){if(Pa)return La;Pa=1;var e=$a(),t=TypeError;return La=function(n){if(e(n))throw new t("The method doesn't accept regular expressions");return n}}function _a(){if(Aa)return Da;Aa=1;var e=wt()("match");return Da=function(t){var n=/./;try{"/./"[t](n)}catch(r){try{return n[e]=!1,"/./"[t](n)}catch(e){}}return!1}}!function(){if(Ia)return ja;Ia=1;var e,t=Qn(),n=jr(),r=Ct().f,o=Rn(),i=Ta(),a=Fa(),s=Te(),u=_a(),l=ht(),c=n("".slice),f=Math.min,d=u("startsWith");t({target:"String",proto:!0,forced:!!(l||d||(e=r(String.prototype,"startsWith"),!e||e.writable))&&!d},{startsWith:function(e){var t=i(s(this));a(e);var n=o(f(arguments.length>1?arguments[1]:void 0,t.length)),r=i(e);return c(t,n,n+r.length)===r}})}();var Ba,Wa={};!function(){if(Ba)return Wa;Ba=1;var e=b(),t=Ar(),n=Ir(),r=Ni(),o=$t(),i=Ei(),a=wt()("iterator"),s=r.values,u=function(e,n){if(e){if(e[a]!==s)try{o(e,a,s)}catch(t){e[a]=s}if(i(e,n,!0),t[n])for(var u in r)if(e[u]!==r[u])try{o(e,u,r[u])}catch(t){e[u]=r[u]}}};for(var l in t)u(e[l]&&e[l].prototype,l);u(n,"DOMTokenList")}();var Ha=new Set(["base","embed","math","meta","object","script","svg","template"]),Ua=new Set(["href","poster","src","xlink:href"]),za=["java","script:"].join("");function Va(e,t,n){var r=function(e){return Array.from(e).filter(function(e){return e>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith(za)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==t&&"xlink:href"!==t&&(("img"===e||"poster"===t)&&r.startsWith("data:image/")))}function Ka(e){if(void 0===e&&(e=""),!e)return"";var t=(new DOMParser).parseFromString(e,"text/html");return Array.from(t.body.querySelectorAll("*")).forEach(function(e){var t=e.tagName.toLowerCase();Ha.has(t)?e.remove():Array.from(e.attributes).forEach(function(n){var r=n.name.toLowerCase(),o=n.value||"";("srcdoc"===r||r.startsWith("on")||Ua.has(r)&&!Va(t,r,o))&&e.removeAttribute(n.name)})}),t.body.innerHTML}var qa={};var Ja="created",Ga="destroyed",Ya="change",Xa="scroll",Qa="fullscreen",Za="unFullScreen",es="modalOrPanelShow",ts="modalOrPanelHide",ns={};var rs,os,is,as,ss={};function us(){if(os)return rs;os=1;var e=Se(),t=ba(),n=pa().getWeakData,r=va(),o=It(),i=ke(),a=Me(),s=ga(),u=Hr(),l=yt(),c=an(),f=c.set,d=c.getterFor,h=u.find,p=u.findIndex,g=e([].splice),v=0,m=function(e){return e.frozen||(e.frozen=new y)},y=function(){this.entries=[]},b=function(e,t){return h(e.entries,function(e){return e[0]===t})};return y.prototype={get:function(e){var t=b(this,e);if(t)return t[1]},has:function(e){return!!b(this,e)},set:function(e,t){var n=b(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=p(this.entries,function(t){return t[0]===e});return~t&&g(this.entries,t,1),!!~t}},rs={getConstructor:function(e,u,c,h){var p=e(function(e,t){r(e,g),f(e,{type:u,id:v++,frozen:null}),i(t)||s(t,e[h],{that:e,AS_ENTRIES:c})}),g=p.prototype,y=d(u),b=function(e,t,r){var i=y(e),a=n(o(t),!0);return!0===a?m(i).set(t,r):a[i.id]=r,e};return t(g,{delete:function(e){var t=y(this);if(!a(e))return!1;var r=n(e);return!0===r?m(t).delete(e):r&&l(r,t.id)&&delete r[t.id]},has:function(e){var t=y(this);if(!a(e))return!1;var r=n(e);return!0===r?m(t).has(e):r&&l(r,t.id)}}),t(g,c?{get:function(e){var t=y(this);if(a(e)){var r=n(e);if(!0===r)return m(t).get(e);if(r)return r[t.id]}},set:function(e,t){return b(this,e,t)}}:{add:function(e){return b(this,e,!0)}}),p}}}as||(as=1,function(){if(is)return ss;is=1;var e,t=ha(),n=b(),r=Se(),o=ba(),i=pa(),a=ya(),s=us(),u=Me(),l=an().enforce,c=R(),f=nn(),d=Object,h=Array.isArray,p=d.isExtensible,g=d.isFrozen,v=d.isSealed,m=d.freeze,y=d.seal,w=!n.ActiveXObject&&"ActiveXObject"in n,x=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},E=a("WeakMap",x,s),S=E.prototype,O=r(S.set);if(f)if(w){e=s.getConstructor(x,"WeakMap",!0),i.enable();var C=r(S.delete),k=r(S.has),T=r(S.get);o(S,{delete:function(t){if(u(t)&&!p(t)){var n=l(this);return n.frozen||(n.frozen=new e),C(this,t)||n.frozen.delete(t)}return C(this,t)},has:function(t){if(u(t)&&!p(t)){var n=l(this);return n.frozen||(n.frozen=new e),k(this,t)||n.frozen.has(t)}return k(this,t)},get:function(t){if(u(t)&&!p(t)){var n=l(this);return n.frozen||(n.frozen=new e),k(this,t)?T(this,t):n.frozen.get(t)}return T(this,t)},set:function(t,n){if(u(t)&&!p(t)){var r=l(this);r.frozen||(r.frozen=new e),k(this,t)?O(this,t,n):r.frozen.set(t,n)}else O(this,t,n);return this}})}else t&&c(function(){var e=m([]);return O(new E,e,1),!g(e)})&&o(S,{set:function(e,t){var n;return h(e)&&(g(e)?n=m:v(e)&&(n=y)),O(this,e,t),n&&n(e),this}})}());var ls,cs=new WeakMap,fs=new WeakMap,ds=new WeakMap,hs=new WeakMap,ps=new WeakMap,gs=new WeakMap,vs=new WeakMap,ms=new WeakMap,ys=new WeakMap,bs=new WeakMap,ws=new WeakMap,xs=new WeakMap,Es=new WeakMap,Ss=new WeakMap,Os=new WeakMap,Cs=new WeakMap,ks=new WeakMap,Ts=new WeakMap,Ns=new WeakMap,Rs=new WeakMap,Ms=new WeakMap,Ls=new WeakMap,Ps=new WeakMap,Ds=new WeakMap,As=new WeakMap,Is=new WeakMap,js=new WeakMap,$s=new WeakMap,Fs=new WeakMap,_s=function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in ns)e.push(t);return e},t.getConfig=function(){var e=bs.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},Bs={};!function(){if(ls)return Bs;ls=1;var e=Qn(),t=Ln().includes,n=R(),r=bi();e({target:"Array",proto:!0,forced:n(function(){return!Array(1).includes()})},{includes:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),r("includes")}();var Ws,Hs={};!function(){if(Ws)return Hs;Ws=1;var e=Qn(),t=Hr().map;e({target:"Array",proto:!0,forced:!oo()("map")},{map:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}})}();var Us,zs={};!function(){if(Us)return zs;Us=1;var e=Qn(),t=Se(),n=Fa(),r=Te(),o=Ta(),i=_a(),a=t("".indexOf);e({target:"String",proto:!0,forced:!i("includes")},{includes:function(e){return!!~a(o(r(this)),o(n(e)),arguments.length>1?arguments[1]:void 0)}})}();var Vs,Ks,qs,Js,Gs,Ys,Xs,Qs={};function Zs(){return Ks?Vs:(Ks=1,Vs="\t\n\v\f\r \u2028\u2029\ufeff")}!function(){if(Xs)return Qs;Xs=1;var e=Qn(),t=function(){if(Js)return qs;Js=1;var e=Se(),t=Te(),n=Ta(),r=Zs(),o=e("".replace),i=RegExp("^["+r+"]+"),a=RegExp("(^|[^"+r+"])["+r+"]+$"),s=function(e){return function(r){var s=n(t(r));return 1&e&&(s=o(s,i,"")),2&e&&(s=o(s,a,"$1")),s}};return qs={start:s(1),end:s(2),trim:s(3)}}().trim,n=function(){if(Ys)return Gs;Ys=1;var e=en().PROPER,t=R(),n=Zs();return Gs=function(r){return t(function(){return!!n[r]()||"
"!=="
"[r]()||e&&n[r].name!==r})}}();e({target:"String",proto:!0,forced:n("trim")},{trim:function(){return t(this)}})}();var eu,tu,nu,ru,ou,iu={};!function(){if(ou)return iu;ou=1;var e=Qn(),t=function(){if(tu)return eu;tu=1;var e=Se(),t=Te(),n=Ta(),r=/"/g,o=e("".replace);return eu=function(e,i,a,s){var u=n(t(e)),l="<"+i;return""!==a&&(l+=" "+a+'="'+o(n(s),r,""")+'"'),l+">"+u+"</"+i+">"}}(),n=function(){if(ru)return nu;ru=1;var e=R();return nu=function(t){return e(function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3})}}();e({target:"String",proto:!0,forced:n("anchor")},{anchor:function(e){return t(this,"a","name",e)}})}();var au,su,uu,lu,cu,fu,du,hu,pu,gu,vu,mu=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]),yu={};function bu(){if(su)return au;su=1;var e=It();return au=function(){var t=e(this),n="";return t.hasIndices&&(n+="d"),t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.dotAll&&(n+="s"),t.unicode&&(n+="u"),t.unicodeSets&&(n+="v"),t.sticky&&(n+="y"),n}}function wu(){if(lu)return uu;lu=1;var e=R(),t=b().RegExp,n=e(function(){var e=t("a","y");return e.lastIndex=2,null!==e.exec("abcd")}),r=n||e(function(){return!t("a","y").sticky}),o=n||e(function(){var e=t("^r","gy");return e.lastIndex=2,null!==e.exec("str")});return uu={BROKEN_CARET:o,MISSED_STICKY:r,UNSUPPORTED_Y:n}}function xu(){if(fu)return cu;fu=1;var e=R(),t=b().RegExp;return cu=e(function(){var e=t(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})}function Eu(){if(hu)return du;hu=1;var e=R(),t=b().RegExp;return du=e(function(){var e=t("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})}function Su(){if(gu)return pu;gu=1;var e,t,n=P(),r=Se(),o=Ta(),i=bu(),a=wu(),s=vt(),u=yi(),l=an().get,c=xu(),f=Eu(),d=s("native-string-replace",String.prototype.replace),h=RegExp.prototype.exec,p=h,g=r("".charAt),v=r("".indexOf),m=r("".replace),y=r("".slice),b=(t=/b*/g,n(h,e=/a/,"a"),n(h,t,"a"),0!==e.lastIndex||0!==t.lastIndex),w=a.BROKEN_CARET,x=void 0!==/()??/.exec("")[1];return(b||x||w||c||f)&&(p=function(e){var t,r,a,s,c,f,E,S=this,O=l(S),C=o(e),k=O.raw;if(k)return k.lastIndex=S.lastIndex,t=n(p,k,C),S.lastIndex=k.lastIndex,t;var T=O.groups,N=w&&S.sticky,R=n(i,S),M=S.source,L=0,P=C;if(N&&(R=m(R,"y",""),-1===v(R,"g")&&(R+="g"),P=y(C,S.lastIndex),S.lastIndex>0&&(!S.multiline||S.multiline&&"\n"!==g(C,S.lastIndex-1))&&(M="(?: "+M+")",P=" "+P,L++),r=new RegExp("^(?:"+M+")",R)),x&&(r=new RegExp("^"+M+"$(?!\\s)",R)),b&&(a=S.lastIndex),s=n(h,N?r:S,P),N?s?(s.input=y(s.input,L),s[0]=y(s[0],L),s.index=S.lastIndex,S.lastIndex+=s[0].length):S.lastIndex=0:b&&s&&(S.lastIndex=S.global?s.index+s[0].length:a),x&&s&&s.length>1&&n(d,s[0],r,function(){for(c=1;c<arguments.length-2;c++)void 0===arguments[c]&&(s[c]=void 0)}),s&&T)for(s.groups=f=u(null),c=0;c<T.length;c++)f[(E=T[c])[0]]=s[E[1]];return s}),pu=p}function Ou(){if(vu)return yu;vu=1;var e=Qn(),t=Su();return e({target:"RegExp",proto:!0,forced:/./.exec!==t},{exec:t}),yu}Ou();var Cu,ku,Tu,Nu,Ru,Mu,Lu,Pu,Du,Au,Iu,ju={};function $u(){if(ku)return Cu;ku=1,Ou();var e=P(),t=un(),n=Su(),r=R(),o=wt(),i=$t(),a=o("species"),s=RegExp.prototype;return Cu=function(u,l,c,f){var d=o(u),h=!r(function(){var e={};return e[d]=function(){return 7},7!==""[u](e)}),p=h&&!r(function(){var e=!1,t=/a/;if("split"===u){var n={};n[a]=function(){return t},(t={constructor:n,flags:""})[d]=/./[d]}return t.exec=function(){return e=!0,null},t[d](""),!e});if(!h||!p||c){var g=/./[d],v=l(d,""[u],function(t,r,o,i,a){var u=r.exec;return u===n||u===s.exec?h&&!a?{done:!0,value:e(g,r,o,i)}:{done:!0,value:e(t,o,r,i)}:{done:!1}});t(String.prototype,u,v[0]),t(s,d,v[1])}f&&i(s[d],"sham",!0)},Cu}function Fu(){if(Nu)return Tu;Nu=1;var e=_r(),t=Fe(),n=TypeError;return Tu=function(r){if(e(r))return r;throw new n(t(r)+" is not a constructor")}}function _u(){if(Mu)return Ru;Mu=1;var e=It(),t=Fu(),n=ke(),r=wt()("species");return Ru=function(o,i){var a,s=e(o).constructor;return void 0===s||n(a=e(s)[r])?i:t(a)}}function Bu(){if(Pu)return Lu;Pu=1;var e=Na().charAt;return Lu=function(t,n,r){return n+(r?e(t,n).length:1)}}function Wu(){if(Au)return Du;Au=1;var e=P(),t=It(),n=Re(),r=Oe(),o=Su(),i=TypeError;return Du=function(a,s){var u=a.exec;if(n(u)){var l=e(u,a,s);return null!==l&&t(l),l}if("RegExp"===r(a))return e(o,a,s);throw new i("RegExp#exec called on incompatible receiver")}}!function(){if(Iu)return ju;Iu=1;var e=P(),t=Se(),n=$u(),r=It(),o=Me(),i=Te(),a=_u(),s=Bu(),u=Rn(),l=Ta(),c=Be(),f=Wu(),d=wu(),h=R(),p=d.UNSUPPORTED_Y,g=Math.min,v=t([].push),m=t("".slice),y=!h(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}),b="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;n("split",function(t,n,d){var h="0".split(void 0,0).length?function(t,r){return void 0===t&&0===r?[]:e(n,this,t,r)}:n;return[function(n,r){var a=i(this),s=o(n)?c(n,t):void 0;return s?e(s,n,a,r):e(h,l(a),n,r)},function(e,t){var o=r(this),i=l(e);if(!b){var c=d(h,o,i,t,h!==n);if(c.done)return c.value}var y=a(o,RegExp),w=o.unicode,x=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(p?"g":"y"),E=new y(p?"^(?:"+o.source+")":o,x),S=void 0===t?4294967295:t>>>0;if(0===S)return[];if(0===i.length)return null===f(E,i)?[i]:[];for(var O=0,C=0,k=[];C<i.length;){E.lastIndex=p?0:C;var T,N=f(E,p?m(i,C):i);if(null===N||(T=g(u(E.lastIndex+(p?C:0)),i.length))===O)C=s(i,C,w);else{if(v(k,m(i,O,C)),k.length===S)return k;for(var R=1;R<=N.length-1;R++)if(v(k,N[R]),k.length===S)return k;C=O=T}}return v(k,m(i,O)),k}]},b||!y,p)}();var Hu,Uu,zu,Vu={};!function(){if(zu)return Vu;zu=1;var e=Qn(),t=function(){if(Uu)return Hu;Uu=1;var e=Fr(),t=Mn(),n=no(),r=$r(),o=function(i,a,s,u,l,c,f,d){for(var h,p,g=l,v=0,m=!!f&&r(f,d);v<u;)v in s&&(h=m?m(s[v],v,a):s[v],c>0&&e(h)?(p=t(h),g=o(i,a,h,p,g,c-1)-1):(n(g+1),i[g]=h),g++),v++;return g};return Hu=o}(),n=_e(),r=mt(),o=Mn(),i=Wr();e({target:"Array",proto:!0},{flatMap:function(e){var a,s=r(this),u=o(s);return n(e),(a=i(s,0)).length=t(a,s,s,u,0,1,e,arguments.length>1?arguments[1]:void 0),a}})}();var Ku;Ku||(Ku=1,bi()("flatMap"));var qu,Ju,Gu,Yu,Xu,Qu,Zu,el,tl,nl={};function rl(){if(Ju)return qu;Ju=1;var e=L(),t=Function.prototype,n=t.apply,r=t.call;return qu="object"==typeof Reflect&&Reflect.apply||(e?r.bind(n):function(){return r.apply(n,arguments)}),qu}function ol(){if(Yu)return Gu;Yu=1;var e=Se(),t=mt(),n=Math.floor,r=e("".charAt),o=e("".replace),i=e("".slice),a=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,s=/\$([$&'`]|\d{1,2})/g;return Gu=function(e,u,l,c,f,d){var h=l+e.length,p=c.length,g=s;return void 0!==f&&(f=t(f),g=a),o(d,g,function(t,o){var a;switch(r(o,0)){case"$":return"$";case"&":return e;case"`":return i(u,0,l);case"'":return i(u,h);case"<":a=f[i(o,1,-1)];break;default:var s=+o;if(0===s)return t;if(s>p){var d=n(s/10);return 0===d?t:d<=p?void 0===c[d-1]?r(o,1):c[d-1]+r(o,1):t}a=c[s-1]}return void 0===a?"":a})},Gu}function il(){if(el)return Zu;el=1;var e=P(),t=yt(),n=Pe(),r=function(){if(Qu)return Xu;Qu=1;var e=b(),t=R(),n=e.RegExp,r=!t(function(){var e=!0;try{n(".","d")}catch(t){e=!1}var t={},r="",o=e?"dgimsy":"gimsy",i=function(e,n){Object.defineProperty(t,e,{get:function(){return r+=n,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var s in e&&(a.hasIndices="d"),a)i(s,a[s]);return Object.getOwnPropertyDescriptor(n.prototype,"flags").get.call(t)!==o||r!==o});return Xu={correct:r}}(),o=bu(),i=RegExp.prototype;return Zu=r.correct?function(e){return e.flags}:function(a){return r.correct||!n(i,a)||t(a,"flags")?a.flags:e(o,a)}}!function(){if(tl)return nl;tl=1;var e=rl(),t=P(),n=Se(),r=$u(),o=R(),i=It(),a=Re(),s=Me(),u=Tn(),l=Rn(),c=Ta(),f=Te(),d=Bu(),h=Be(),p=ol(),g=il(),v=Wu(),m=wt()("replace"),y=Math.max,b=Math.min,w=n([].concat),x=n([].push),E=n("".indexOf),S=n("".slice),O=function(e){return void 0===e?e:String(e)},C="$0"==="a".replace(/./,"$0"),k=!!/./[m]&&""===/./[m]("a","$0");r("replace",function(n,r,o){var C=k?"$":"$0";return[function(e,n){var o=f(this),i=s(e)?h(e,m):void 0;return i?t(i,e,o,n):t(r,c(o),e,n)},function(t,n){var s=i(this),f=c(t);if("string"==typeof n&&-1===E(n,C)&&-1===E(n,"$<")){var h=o(r,s,f,n);if(h.done)return h.value}var m=a(n);m||(n=c(n));var k,T=c(g(s)),N=-1!==E(T,"g");N&&(k=-1!==E(T,"u"),s.lastIndex=0);for(var R,M=[];null!==(R=v(s,f))&&(x(M,R),N);){""===c(R[0])&&(s.lastIndex=d(f,l(s.lastIndex),k))}for(var L="",P=0,D=0;D<M.length;D++){for(var A,I=c((R=M[D])[0]),j=y(b(u(R.index),f.length),0),$=[],F=1;F<R.length;F++)x($,O(R[F]));var _=R.groups;if(m){var B=w([I],$,j,f);void 0!==_&&x(B,_),A=c(e(n,void 0,B))}else A=p(I,f,j,$,_,n);j>=P&&(L+=S(f,P,j)+A,P=j+I.length)}return L+S(f,P)}]},!!o(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})||!C||k)}();var al,sl={};!function(){if(al)return sl;al=1;var e=Qn(),t=Hr().find,n=bi(),r="find",o=!0;r in[]&&Array(1)[r](function(){o=!1}),e({target:"Array",proto:!0,forced:o},{find:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),n(r)}();var ul,ll,cl={};ll||(ll=1,function(){if(ul)return cl;ul=1;var e=Qn(),t=b();e({global:!0,forced:t.globalThis!==t},{globalThis:t})}());const fl=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var dl,hl,pl,gl,vl,ml,yl,bl,wl,xl,El,Sl,Ol,Cl,kl,Tl,Nl,Rl,Ml,Ll,Pl,Dl,Al,Il,jl,$l,Fl,_l,Bl,Wl,Hl={};function Ul(){if(hl)return dl;hl=1;var e=b(),t=De(),n=Oe(),r=function(e){return t.slice(0,e.length)===e};return dl=r("Bun/")?"BUN":r("Cloudflare-Workers")?"CLOUDFLARE":r("Deno/")?"DENO":r("Node.js/")?"NODE":e.Bun&&"string"==typeof Bun.version?"BUN":e.Deno&&"object"==typeof Deno.version?"DENO":"process"===n(e.process)?"NODE":e.window&&e.document?"BROWSER":"REST"}function zl(){if(gl)return pl;gl=1;var e=Ul();return pl="NODE"===e}function Vl(){if(ml)return vl;ml=1;var e=b();return vl=e}function Kl(){if(bl)return yl;bl=1;var e=TypeError;return yl=function(t,n){if(t<n)throw new e("Not enough arguments");return t}}function ql(){if(xl)return wl;xl=1;var e=De();return wl=/(?:ipad|iphone|ipod).*applewebkit/i.test(e)}function Jl(){if(Sl)return El;Sl=1;var e,t,n,r,o=b(),i=rl(),a=$r(),s=Re(),u=yt(),l=R(),c=mi(),f=ca(),d=St(),h=Kl(),p=ql(),g=zl(),v=o.setImmediate,m=o.clearImmediate,y=o.process,w=o.Dispatch,x=o.Function,E=o.MessageChannel,S=o.String,O=0,C={},k="onreadystatechange";l(function(){e=o.location});var T=function(e){if(u(C,e)){var t=C[e];delete C[e],t()}},N=function(e){return function(){T(e)}},M=function(e){T(e.data)},L=function(t){o.postMessage(S(t),e.protocol+"//"+e.host)};return v&&m||(v=function(e){h(arguments.length,1);var n=s(e)?e:x(e),r=f(arguments,1);return C[++O]=function(){i(n,void 0,r)},t(O),O},m=function(e){delete C[e]},g?t=function(e){y.nextTick(N(e))}:w&&w.now?t=function(e){w.now(N(e))}:E&&!p?(r=(n=new E).port2,n.port1.onmessage=M,t=a(r.postMessage,r)):o.addEventListener&&s(o.postMessage)&&!o.importScripts&&e&&"file:"!==e.protocol&&!l(L)?(t=L,o.addEventListener("message",M,!1)):t=k in d("script")?function(e){c.appendChild(d("script"))[k]=function(){c.removeChild(this),T(e)}}:function(e){setTimeout(N(e),0)}),El={set:v,clear:m}}function Gl(){if(Cl)return Ol;Cl=1;var e=b(),t=M(),n=Object.getOwnPropertyDescriptor;return Ol=function(r){if(!t)return e[r];var o=n(e,r);return o&&o.value}}function Yl(){if(Tl)return kl;Tl=1;var e=function(){this.head=null,this.tail=null};return e.prototype={add:function(e){var t={item:e,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},kl=e}function Xl(){if(Dl)return Pl;Dl=1;var e,t,n,r,o,i=b(),a=Gl(),s=$r(),u=Jl().set,l=Yl(),c=ql(),f=function(){if(Rl)return Nl;Rl=1;var e=De();return Nl=/ipad|iphone|ipod/i.test(e)&&"undefined"!=typeof Pebble}(),d=function(){if(Ll)return Ml;Ll=1;var e=De();return Ml=/web0s(?!.*chrome)/i.test(e)}(),h=zl(),p=i.MutationObserver||i.WebKitMutationObserver,g=i.document,v=i.process,m=i.Promise,y=a("queueMicrotask");if(!y){var w=new l,x=function(){var t,n;for(h&&(t=v.domain)&&t.exit();n=w.get();)try{n()}catch(t){throw w.head&&e(),t}t&&t.enter()};c||h||d||!p||!g?!f&&m&&m.resolve?((r=m.resolve(void 0)).constructor=m,o=s(r.then,r),e=function(){o(x)}):h?e=function(){v.nextTick(x)}:(u=s(u,i),e=function(){u(x)}):(t=!0,n=g.createTextNode(""),new p(x).observe(n,{characterData:!0}),e=function(){n.data=t=!t}),y=function(t){w.head||e(),w.add(t)}}return Pl=y}function Ql(){return Il||(Il=1,Al=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}),Al}function Zl(){return $l?jl:($l=1,jl=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}})}function ec(){if(_l)return Fl;_l=1;var e=b();return Fl=e.Promise}function tc(){if(Wl)return Bl;Wl=1;var e=b(),t=ec(),n=Re(),r=Xn(),o=tn(),i=wt(),a=Ul(),s=ht(),u=Ae(),l=t&&t.prototype,c=i("species"),f=!1,d=n(e.PromiseRejectionEvent),h=r("Promise",function(){var e=o(t),n=e!==String(t);if(!n&&66===u)return!0;if(s&&(!l.catch||!l.finally))return!0;if(!u||u<51||!/native code/.test(e)){var r=new t(function(e){e(1)}),i=function(e){e(function(){},function(){})};if((r.constructor={})[c]=i,!(f=r.then(function(){})instanceof i))return!0}return!(n||"BROWSER"!==a&&"DENO"!==a||d)});return Bl={CONSTRUCTOR:h,REJECTION_EVENT:d,SUBCLASSING:f}}var nc,rc,oc={};function ic(){if(nc)return oc;nc=1;var e=_e(),t=TypeError,n=function(n){var r,o;this.promise=new n(function(e,n){if(void 0!==r||void 0!==o)throw new t("Bad Promise constructor");r=e,o=n}),this.resolve=e(r),this.reject=e(o)};return oc.f=function(e){return new n(e)},oc}var ac,sc,uc,lc={};function cc(){if(sc)return ac;sc=1;var e=ec(),t=Fo(),n=tc().CONSTRUCTOR;return ac=n||!t(function(t){e.all(t).then(void 0,function(){})})}var fc,dc={};var hc,pc={};var gc,vc={};var mc,yc,bc,wc,xc={};function Ec(){if(yc)return mc;yc=1;var e=It(),t=Me(),n=ic();return mc=function(r,o){if(e(r),t(o)&&o.constructor===r)return o;var i=n.f(r);return(0,i.resolve)(o),i.promise}}wc||(wc=1,function(){if(rc)return Hl;rc=1;var e,t,n,r,o=Qn(),i=ht(),a=zl(),s=b(),u=Vl(),l=P(),c=un(),f=Ci(),d=Ei(),h=wa(),p=_e(),g=Re(),v=Me(),m=va(),y=_u(),w=Jl().set,x=Xl(),E=Ql(),S=Zl(),O=Yl(),C=an(),k=ec(),T=tc(),N=ic(),R="Promise",M=T.CONSTRUCTOR,L=T.REJECTION_EVENT,D=T.SUBCLASSING,A=C.getterFor(R),I=C.set,j=k&&k.prototype,$=k,F=j,_=s.TypeError,B=s.document,W=s.process,H=N.f,U=H,z=!!(B&&B.createEvent&&s.dispatchEvent),V="unhandledrejection",K=function(e){var t;return!(!v(e)||!g(t=e.then))&&t},q=function(e,t){var n,r,o,i=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,f=e.domain;try{s?(a||(2===t.rejection&&Q(t),t.rejection=1),!0===s?n=i:(f&&f.enter(),n=s(i),f&&(f.exit(),o=!0)),n===e.promise?c(new _("Promise-chain cycle")):(r=K(n))?l(r,n,u,c):u(n)):c(i)}catch(e){f&&!o&&f.exit(),c(e)}},J=function(e,t){e.notified||(e.notified=!0,x(function(){for(var n,r=e.reactions;n=r.get();)q(n,e);e.notified=!1,t&&!e.rejection&&Y(e)}))},G=function(e,t,n){var r,o;z?((r=B.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),s.dispatchEvent(r)):r={promise:t,reason:n},!L&&(o=s["on"+e])?o(r):e===V&&E("Unhandled promise rejection",n)},Y=function(e){l(w,s,function(){var t,n=e.facade,r=e.value;if(X(e)&&(t=S(function(){a?W.emit("unhandledRejection",r,n):G(V,n,r)}),e.rejection=a||X(e)?2:1,t.error))throw t.value})},X=function(e){return 1!==e.rejection&&!e.parent},Q=function(e){l(w,s,function(){var t=e.facade;a?W.emit("rejectionHandled",t):G("rejectionhandled",t,e.value)})},Z=function(e,t,n){return function(r){e(t,r,n)}},ee=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,J(e,!0))},te=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw new _("Promise can't be resolved itself");var r=K(t);r?x(function(){var n={done:!1};try{l(r,t,Z(te,n,e),Z(ee,n,e))}catch(t){ee(n,t,e)}}):(e.value=t,e.state=1,J(e,!1))}catch(t){ee({done:!1},t,e)}}};if(M&&(F=($=function(t){m(this,F),p(t),l(e,this);var n=A(this);try{t(Z(te,n),Z(ee,n))}catch(e){ee(n,e)}}).prototype,(e=function(e){I(this,{type:R,done:!1,notified:!1,parent:!1,reactions:new O,rejection:!1,state:0,value:null})}).prototype=c(F,"then",function(e,t){var n=A(this),r=H(y(this,$));return n.parent=!0,r.ok=!g(e)||e,r.fail=g(t)&&t,r.domain=a?W.domain:void 0,0===n.state?n.reactions.add(r):x(function(){q(r,n)}),r.promise}),t=function(){var t=new e,n=A(t);this.promise=t,this.resolve=Z(te,n),this.reject=Z(ee,n)},N.f=H=function(e){return e===$||e===n?new t(e):U(e)},!i&&g(k)&&j!==Object.prototype)){r=j.then,D||c(j,"then",function(e,t){var n=this;return new $(function(e,t){l(r,n,e,t)}).then(e,t)},{unsafe:!0});try{delete j.constructor}catch(e){}f&&f(j,F)}o({global:!0,constructor:!0,wrap:!0,forced:M},{Promise:$}),n=u.Promise,d($,R,!1,!0),h(R)}(),function(){if(uc)return lc;uc=1;var e=Qn(),t=P(),n=_e(),r=ic(),o=Zl(),i=ga();e({target:"Promise",stat:!0,forced:cc()},{all:function(e){var a=this,s=r.f(a),u=s.resolve,l=s.reject,c=o(function(){var r=n(a.resolve),o=[],s=0,c=1;i(e,function(e){var n=s++,i=!1;c++,t(r,a,e).then(function(e){i||(i=!0,o[n]=e,--c||u(o))},l)}),--c||u(o)});return c.error&&l(c.value),s.promise}})}(),function(){if(fc)return dc;fc=1;var e=Qn(),t=ht(),n=tc().CONSTRUCTOR,r=ec(),o=Le(),i=Re(),a=un(),s=r&&r.prototype;if(e({target:"Promise",proto:!0,forced:n,real:!0},{catch:function(e){return this.then(void 0,e)}}),!t&&i(r)){var u=o("Promise").prototype.catch;s.catch!==u&&a(s,"catch",u,{unsafe:!0})}}(),function(){if(hc)return pc;hc=1;var e=Qn(),t=P(),n=_e(),r=ic(),o=Zl(),i=ga();e({target:"Promise",stat:!0,forced:cc()},{race:function(e){var a=this,s=r.f(a),u=s.reject,l=o(function(){var r=n(a.resolve);i(e,function(e){t(r,a,e).then(s.resolve,u)})});return l.error&&u(l.value),s.promise}})}(),function(){if(gc)return vc;gc=1;var e=Qn(),t=ic();e({target:"Promise",stat:!0,forced:tc().CONSTRUCTOR},{reject:function(e){var n=t.f(this);return(0,n.reject)(e),n.promise}})}(),function(){if(bc)return xc;bc=1;var e=Qn(),t=Le(),n=ht(),r=ec(),o=tc().CONSTRUCTOR,i=Ec(),a=t("Promise"),s=n&&!o;e({target:"Promise",stat:!0,forced:n||o},{resolve:function(e){return i(s&&this===a?r:this,e)}})}());var Sc,Oc={};function Cc(e){Promise.resolve().then(e)}function kc(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}!function(){if(Sc)return Oc;Sc=1;var e=en().PROPER,t=un(),n=It(),r=Ta(),o=R(),i=il(),a="toString",s=RegExp.prototype,u=s[a],l=o(function(){return"/a/b"!==u.call({source:"a",flags:"b"})}),c=e&&u.name!==a;(l||c)&&t(s,a,function(){var e=n(this);return"/"+r(e.source)+"/"+r(i(e))},{unsafe:!0})}();var Tc,Nc=function(e){return Object.prototype.toString.call(e)},Rc=globalThis.Node,Mc=globalThis.Comment,Lc=globalThis.Element,Pc=globalThis.Text,Dc=globalThis.Range,Ac=globalThis.Selection,Ic=globalThis.StaticRange;o.css&&(o.fn.css=o.css),o.append&&(o.fn.append=o.append),o.addClass&&(o.fn.addClass=o.addClass),o.removeClass&&(o.fn.removeClass=o.removeClass),o.hasClass&&(o.fn.hasClass=o.hasClass),o.on&&(o.fn.on=o.on),o.focus&&(o.fn.focus=o.focus),o.attr&&(o.fn.attr=o.attr),o.removeAttr&&(o.fn.removeAttr=o.removeAttr),o.hide&&(o.fn.hide=o.hide),o.show&&(o.fn.show=o.show),o.offset&&(o.fn.offset=o.offset),o.width&&(o.fn.width=o.width),o.height&&(o.fn.height=o.height),o.parent&&(o.fn.parent=o.parent),o.parents&&(o.fn.parents=o.parents),o.is&&(o.fn.is=o.is),o.dataset&&(o.fn.dataset=o.dataset),o.val&&(o.fn.val=o.val),o.text&&(o.fn.text=o.text),o.html&&(o.fn.html=o.html),o.children&&(o.fn.children=o.children),o.remove&&(o.fn.remove=o.remove),o.find&&(o.fn.find=o.find),o.each&&(o.fn.each=o.each),o.empty&&(o.fn.empty=o.empty),e.NodeType=void 0,(Tc=e.NodeType||(e.NodeType={}))[Tc.ELEMENT_NODE=1]="ELEMENT_NODE",Tc[Tc.TEXT_NODE=3]="TEXT_NODE",Tc[Tc.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",Tc[Tc.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",Tc[Tc.COMMENT_NODE=8]="COMMENT_NODE",Tc[Tc.DOCUMENT_NODE=9]="DOCUMENT_NODE",Tc[Tc.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",Tc[Tc.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";var jc=function(e){return"[object HTMLDocument]"===Nc(e)},$c=function(e){return"[object ShadowRoot]"===Nc(e)},Fc=function(e){return"[object DataTransfer]"===Nc(e)},_c=/\[object HTML([A-Z][a-z]*)*Element\]/,Bc=function(e){return"matches"in e&&/^[ou]l$/i.test(e.tagName)&&!e.hasAttribute("data-w-e-type")},Wc=function(e){return _c.test(Nc(e))},Hc=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},Uc=function(e){return null!=e&&"number"==typeof e.nodeType},zc=function(t){return Uc(t)&&t.nodeType===e.NodeType.COMMENT_NODE},Vc=function(t){return Uc(t)&&t.nodeType===e.NodeType.ELEMENT_NODE},Kc=function(e){return"[object Selection]"===Nc(e)},qc=function(t){return Uc(t)&&t.nodeType===e.NodeType.TEXT_NODE},Jc=function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length},Gc=function(e){var t,n=lo(e,2),r=n[0],o=n[1];if(Vc(r)&&r.childNodes.length){var i=o===r.childNodes.length,a=i?o-1:o;for(r=(t=lo(Qc(r,a,i?"backward":"forward"),2))[0],i=(a=t[1])<o;Vc(r)&&r.childNodes.length;){var s=i?r.childNodes.length-1:0;r=Zc(r,s,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},Yc=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},Xc=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},Qc=function(e,t,n){for(var r=e.childNodes,o=r[t],i=t,a=!1,s=!1;(zc(o)||Vc(o)&&0===o.childNodes.length||Vc(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]},Zc=function(e,t,n){return lo(Qc(e,t,n),1)[0]},ef=function(e){var t,n,r="";if(qc(e)&&e.nodeValue)return e.nodeValue;if(Vc(e)){try{for(var o=uo(Array.from(e.childNodes)),i=o.next();!i.done;i=o.next()){var a=i.value;r+=ef(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 tf(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(fl.includes(a)||"iframe"===a||"video"===a)return o;var s=o.children||[],u=s.length;if(u)for(var l=u-1;l>=0;l-=1)n.push(s[l])}}return null}function nf(t,n){if(!Wc(t)||"true"!==t.dataset.slateVoid)for(var r=t.childNodes,o=r.length;o-=1;){var i=r[o],a=i.nodeType;qc(i)?n(i,t):[e.NodeType.ELEMENT_NODE,e.NodeType.DOCUMENT_NODE,e.NodeType.DOCUMENT_FRAGMENT_NODE].includes(a)&&nf(i,n)}}function rf(t){if(0===t.length)return"";var n=t[0];return n.nodeType!==e.NodeType.ELEMENT_NODE?"":n.tagName.toLowerCase()}var of,af,sf,uf={};function lf(){if(af)return of;af=1;var e=jt().f;return of=function(t,n,r){r in t||e(t,r,{configurable:!0,get:function(){return n[r]},set:function(e){n[r]=e}})}}!function(){if(sf)return uf;sf=1;var e=M(),t=b(),n=Se(),r=Xn(),o=ma(),i=$t(),a=yi(),s=An().f,u=Pe(),l=$a(),c=Ta(),f=il(),d=wu(),h=lf(),p=un(),g=R(),v=yt(),m=an().enforce,y=wa(),w=wt(),x=xu(),E=Eu(),S=w("match"),O=t.RegExp,C=O.prototype,k=t.SyntaxError,T=n(C.exec),N=n("".charAt),L=n("".replace),P=n("".indexOf),D=n("".slice),A=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,I=/a/g,j=/a/g,$=new O(I)!==I,F=d.MISSED_STICKY,_=d.UNSUPPORTED_Y,B=e&&(!$||F||x||E||g(function(){return j[S]=!1,O(I)!==I||O(j)===j||"/a/i"!==String(O(I,"i"))}));if(r("RegExp",B)){for(var W=function(e,t){var n,r,s,d,h,p,g=u(C,this),y=l(e),b=void 0===t,w=[],S=e;if(!g&&y&&b&&e.constructor===W)return e;if((y||u(C,e))&&(e=e.source,b&&(t=f(S))),e=void 0===e?"":c(e),t=void 0===t?"":c(t),S=e,x&&"dotAll"in I&&(r=!!t&&P(t,"s")>-1)&&(t=L(t,/s/g,"")),n=t,F&&"sticky"in I&&(s=!!t&&P(t,"y")>-1)&&_&&(t=L(t,/y/g,"")),E&&(d=function(e){for(var t,n=e.length,r=0,o="",i=[],s=a(null),u=!1,l=!1,c=0,f="";r<=n;r++){if("\\"===(t=N(e,r)))t+=N(e,++r);else if("]"===t)u=!1;else if(!u)switch(!0){case"["===t:u=!0;break;case"("===t:if(o+=t,"?:"===D(e,r+1,r+3))continue;T(A,D(e,r+1))&&(r+=2,l=!0),c++;continue;case">"===t&&l:if(""===f||v(s,f))throw new k("Invalid capture group name");s[f]=!0,i[i.length]=[f,c],l=!1,f="";continue}l?f+=t:o+=t}return[o,i]}(e),e=d[0],w=d[1]),h=o(O(e,t),g?this:C,W),(r||s||w.length)&&(p=m(h),r&&(p.dotAll=!0,p.raw=W(function(e){for(var t,n=e.length,r=0,o="",i=!1;r<=n;r++)"\\"!==(t=N(e,r))?i||"."!==t?("["===t?i=!0:"]"===t&&(i=!1),o+=t):o+="[\\s\\S]":o+=t+N(e,++r);return o}(e),n)),s&&(p.sticky=!0),w.length&&(p.groups=w)),e!==S)try{i(h,"source",""===S?"(?:)":S)}catch(e){}return h},H=s(O),U=0;H.length>U;)h(W,O,H[U++]);C.constructor=W,W.prototype=C,p(t,"RegExp",W,{constructor:!0})}y("RegExp")}();var cf=new RegExp(String.fromCharCode(160),"g");function ff(e){return e.replace(cf," ")}var df=["span","b","strong","i","em","s","strike","u","font","sub","sup"],hf=[];var pf=[];var gf={};function vf(e,n){var r=e.length;if(r){var o=e[r-1];if(t.Text.isText(o)){var i=Object.keys(o);if(1===i.length&&"text"===i[0])return o.text+=n,!0}}return!1}function mf(e,t,n){return{type:"paragraph",children:[{text:o(e).text().replace(/\s+/gm," ")}]}}function yf(e,n){var r=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(Vc(e)){if("BR"===e.nodeName)return void(vf(n,"\n")||n.push({text:"\n"}));var r=Sf(o(e),t);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}else if(qc(e)){var i=e.textContent||"";if(""===i.trim()&&i.indexOf("\n")>=0)return;i&&(i=ff(i),vf(n,i)||n.push({text:i}))}}),n)}(e,n),i=function(e){for(var t in gf)if(e[0].matches(t))return gf[t];return mf}(e),a=i(e[0],r,n);return Array.isArray(a)||(a=[a]),a.forEach(function(o){t.Editor.isVoid(n,o)||(0===r.length&&(o.children=[{text:e.text().replace(/\s+/gm," ")}]),pf.forEach(function(t){o=t(e[0],o,n)}))}),a}function bf(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=ff(n=kc(n))};return pf.forEach(function(n){r=n(e[0],r,t)}),r}function wf(e,t){var n={text:""};return pf.forEach(function(r){n=r(e[0],n,t)}),n}function xf(e,t){var n=t.parentElement;return null==n?e:(null==n.closest("pre")&&(e=e.replace(/[\r\n\t]+/g,"")),e=ff(e=kc(e)))}function Ef(e,t,n){var r=e[0];if(Vc(r)){var o=Sf(e,n);return delete t.text,Array.isArray(o)?o.map(function(e){return so(so({},t),e)}):[so(so({},t),o)]}if(zc(r))return null;var i=qc(r)?{text:xf(r.textContent||"",r)}:bf(e,n);return[so(so({},t),i)]}function Sf(e,t){hf.forEach(function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=o(r(e[0])))});var n=rf(e);if("span"===n){if(e.attr("data-w-e-type"))return yf(e,t);if((i=Array.from(e[0].childNodes)).some(function(e){return!qc(e)&&!zc(e)})){var r=wf(o(e[0]),t);return i.flatMap(function(e){return Ef(o(e),r,t)||[]})}return bf(e,t)}if("code"===n)return"pre"===rf(e.parent())?yf(e,t):bf(e,t);if(df.includes(n)){var i;if((i=Array.from(e[0].childNodes)).some(function(e){return!qc(e)&&!zc(e)})){var a=wf(o(e[0]),t);return i.flatMap(function(e){return Ef(o(e),a,t)||[]})}return bf(e,t)}return yf(e,t)}function Of(e,t,n){var r=o(n);return!!r.attr(t)||(r.attr(t,"true"),e.on(Ga,function(){r.removeAttr(t)}),!1)}function Cf(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 i=o("<div>".concat(t,"</div>"));return Array.from(i.children()).forEach(function(t){var r=Sf(o(t),e);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}),n}function kf(e,t){return"w-e-element-".concat(e,"-").concat(t)}var Tf=[];var Nf={};function Rf(e,t,n){var r=n.isInline(e)?"span":"div";return"<".concat(r,">").concat(t,"</").concat(r,">")}function Mf(e,n){var r=e.type,o=void 0===r?"":r,i=e.children,a=void 0===i?[]:i,s=t.Editor.isVoid(n,e),u="";s||(u=a.map(function(e){return Yf(e,n)}).join(""));var l=function(e){return Nf[e]||Rf}(o),c=l(e,u,n),f="";if(f="string"==typeof c?c:c.html||"",s||Tf.forEach(function(t){return f=t(e,f,n)}),"string"==typeof c)return f;var d=c.prefix,h=void 0===d?"":d,p=c.suffix,g=void 0===p?"":p;return h&&(f=h+f),g&&(f+=g),f}var Lf,Pf,Df,Af={};function If(){if(Pf)return Lf;Pf=1;var e=yt();return Lf=function(t){return void 0!==t&&(e(t,"value")||e(t,"writable"))}}!function(){if(Df)return Af;Df=1;var e=Qn(),t=P(),n=Me(),r=It(),o=If(),i=Ct(),a=wi();e({target:"Reflect",stat:!0},{get:function e(s,u){var l,c,f=arguments.length<3?s:arguments[2];return r(s)===f?s[u]:(l=i.f(s,u))?o(l)?l.value:void 0===l.get?void 0:t(l.get,f):n(c=a(s))?e(c,u,f):void 0}})}();var jf,$f={};!function(){if(jf)return $f;jf=1;var e,t=Qn(),n=jr(),r=Ct().f,o=Rn(),i=Ta(),a=Fa(),s=Te(),u=_a(),l=ht(),c=n("".slice),f=Math.min,d=u("endsWith");t({target:"String",proto:!0,forced:!!(l||d||(e=r(String.prototype,"endsWith"),!e||e.writable))&&!d},{endsWith:function(e){var t=i(s(this));a(e);var n=arguments.length>1?arguments[1]:void 0,r=t.length,u=void 0===n?r:f(o(n),r),l=i(e);return c(t,u-l.length,u)===l}})}();var Ff=0,_f=function(){this.id="".concat(Ff++)},Bf="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),Wf="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Hf="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),Uf="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),zf="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Vf="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),Kf=!zf&&!Uf&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,qf=function(e,t){return Boolean(e.compareDocumentPosition(t)&Rc.DOCUMENT_POSITION_PRECEDING)},Jf=function(e,t){return Boolean(e.compareDocumentPosition(t)&Rc.DOCUMENT_POSITION_FOLLOWING)},Gf={getWindow:function(e){var t=Ps.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=Ls.get(t);return n||(n=new _f,Ls.set(t,n)),n},setNewKey:function(e){var t=new _f;Ls.set(e,t)},findPath:function(e,n){for(var r=[],o=n;;){var i=ks.get(o);if(null==i){if(t.Editor.isEditor(o))return r;break}var a=Cs.get(o);if(null==a)break;r.unshift(a),o=i}throw new Error("Unable to find the path for Slate node: ".concat(JSON.stringify(n)))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=Gf.toDOMNode(e,e),n=t.getRootNode();return(jc(n)||$c(n))&&null!=Reflect.get(n,"getSelection")?n:t.ownerDocument},getParentNode:function(e,t){return ks.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=Gf.getParentNode(e,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(e,n){var r=[Gf.findPath(e,n)[0]];return t.Node.get(e,r)},toDOMNode:function(e,n){var r;if(t.Editor.isEditor(n))r=Ts.get(e);else{var o=Gf.findKey(e,n);r=Rs.get(o)}if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(JSON.stringify(n)));return r},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Gf.toDOMNode(e,e);try{r=Vc(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,n){var r=n.anchor,o=n.focus,i=t.Range.isBackward(n),a=Gf.toDOMPoint(e,r),s=t.Range.isCollapsed(n)?a:Gf.toDOMPoint(e,o),u=Gf.getWindow(e).document.createRange(),l=lo(i?s:a,2),c=l[0],f=l[1],d=lo(i?a:s,2),h=d[0],p=d[1],g=!!(Vc(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(Vc(h)?h:h.parentElement).getAttribute("data-slate-zero-width");return u.setStart(c,g?1:f),u.setEnd(h,v?1:p),u},toDOMPoint:function(e,n){var r,o,i,a=lo(t.Editor.node(e,n.path),1)[0],s=Gf.toDOMNode(e,a);t.Editor.void(e,{at:n})&&(n={path:n.path,offset:0});var u=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),l=0;try{for(var c=uo(u),f=c.next();!f.done;f=c.next()){var d=f.value,h=d.childNodes[0];if(null!=h&&null!=h.textContent){var p=h.textContent.length,g=d.getAttribute("data-slate-length"),v=l+(null==g?p:parseInt(g,10));if(n.offset<=v){i=[h,Math.min(p,Math.max(0,n.offset-l))];break}l=v}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(JSON.stringify(n)));return i},toSlateNode:function(e,t){var n=Vc(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Ns.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},findEventRange:function(e,n){"nativeEvent"in n&&(n=n.nativeEvent);var r=n.clientX,o=n.clientY,i=n.target;if(null==r||null==o)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(n));var a,s=Gf.toSlateNode(e,n.target),u=Gf.findPath(e,s);if(t.Element.isElement(s)&&t.Editor.isVoid(e,s)){var l=i.getBoundingClientRect(),c=e.isInline(s)?r-l.left<l.left+l.width-r:o-l.top<l.top+l.height-o,f=t.Editor.point(e,u,{edge:c?"start":"end"}),d=c?t.Editor.before(e,f):t.Editor.after(e,f);if(d)return t.Editor.range(e,d)}var h=this.getWindow(e).document;if(h.caretRangeFromPoint)a=h.caretRangeFromPoint(r,o);else{var p=h.caretPositionFromPoint(r,o);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(n));return Gf.toSlateRange(e,a,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,n,r){var o,i,a,s,u,l=r.exactMatch,c=r.suppressThrow;if((Kc(n)?n.anchorNode:n.startContainer)&&(Kc(n)?(o=n.anchorNode,i=n.anchorOffset,a=n.focusNode,s=n.focusOffset,u=Vf&&Yc()?n.anchorNode===n.focusNode&&n.anchorOffset===n.focusOffset:n.isCollapsed):(o=n.startContainer,i=n.startOffset,a=n.endContainer,s=n.endOffset,u=n.collapsed)),null==o||null==a||null==i||null==s)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(n));var f=Gf.toSlatePoint(e,[o,i],{exactMatch:l,suppressThrow:c});if(!f)return null;var d=u?f:Gf.toSlatePoint(e,[a,s],{exactMatch:l,suppressThrow:c,searchDirection:qf(o,a)||o===a&&s<i?"forward":"backward"});if(!d)return null;var h={anchor:f,focus:d};return t.Range.isExpanded(h)&&t.Range.isForward(h)&&Vc(a)&&t.Editor.void(e,{at:h.focus,mode:"highest"})&&(h=t.Editor.unhangRange(e,h,{voids:!0})),h},toSlatePoint:function(e,t,n){var r,o,i,s=n.exactMatch,u=n.suppressThrow,l=lo(s?t:Gc(t),2),c=l[0],f=l[1],d=c.parentNode,h=n.searchDirection,p=null,g=0;if(d){var v=Gf.toDOMNode(e,e),m=d.closest('[data-slate-void="true"]'),y=m&&v.contains(m)?m:null,b=d.closest('[contenteditable="false"]'),w=b&&v.contains(b)?b:null,x=d.closest("[data-slate-leaf]"),E=null,S=Gf.getWindow(e);if(x&&S.document.createRange){p=x.closest('[data-slate-node="text"]');var O=S.document.createRange();O.setStart(p,0),O.setEnd(c,f);var C=O.cloneContents();co(co([],lo(a(C.querySelectorAll("[data-slate-zero-width]"))),!1),lo(a(C.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(e){e.parentNode.removeChild(e)}),g=C.textContent.length,E=p}else if(y)(x=Array.from(y.querySelectorAll("[data-slate-leaf]")).find(function(t){return Gf.hasDOMNode(e,t)})||null)?(p=x.closest('[data-slate-node="text"]'),g=(E=x).textContent.length,E.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})):g=1;else if(w){var k=function(t){return t?Array.from(t.querySelectorAll("[data-slate-leaf]")).filter(function(t){return Gf.hasDOMNode(e,t)}):[]},T=w.closest('[data-slate-node="element"]');if("backward"===h||!h)for(var N=(M=co(co([],lo(k(null==T?void 0:T.previousElementSibling)),!1),lo(k(T)),!1)).length-1;N>=0;N-=1){var R=M[N];if(qf(w,R)){x=R,h="backward";break}}if(!(x||"forward"!==h&&h)){var M=co(co([],lo(k(T)),!1),lo(k(null==T?void 0:T.nextElementSibling)),!1);try{for(var L=uo(M),P=L.next();!P.done;P=L.next()){R=P.value;if(Jf(w,R)){x=R,h="forward";break}}}catch(e){r={error:e}}finally{try{P&&!P.done&&(o=L.return)&&o.call(L)}finally{if(r)throw r.error}}}x&&(p=x.closest('[data-slate-node="text"]'),E=x,"forward"===h?g=0:(g=E.textContent.length,E.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})))}E&&g===E.textContent.length&&(d.hasAttribute("data-slate-zero-width")||Wf&&(null===(i=E.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(g-=1)}if(!p){if(u)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var D,A=Gf.toSlateNode(e,p);try{D=Gf.findPath(e,A)}catch(e){if(u)return null;throw e}return{path:D,offset:g}},hasRange:function(e,n){var r=n.anchor,o=n.focus;return t.Editor.hasPath(e,r.path)&&t.Editor.hasPath(e,o.path)},getNodeType:function(e){return t.Element.isElement(e)?e.type:""},checkNodeType:function(e,t){return this.getNodeType(e)===t},getNodesStr:function(e){return e.map(function(e){return t.Node.string(e)}).join("")},getSelectedElems:function(e){var n,r,o=[],i=t.Editor.nodes(e,{universal:!0});try{for(var a=uo(i),s=a.next();!s.done;s=a.next()){var u=lo(s.value,1)[0];t.Element.isElement(u)&&o.push(u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o},getSelectedNodeByType:function(e,n){var r=this,o=lo(t.Editor.nodes(e,{match:function(e){return r.checkNodeType(e,n)},universal:!0}),1),i=o[0];return null==i?null:i[0]},getSelectedTextNode:function(e){var n=lo(t.Editor.nodes(e,{match:function(e){return t.Text.isText(e)},universal:!0}),1),r=n[0];return null==r?null:r[0]},isNodeSelected:function(e,n){var r=lo(t.Editor.nodes(e,{match:function(e){return e===n},universal:!0}),1),o=r[0];return null!=o&&lo(o,1)[0]===n},isSelectionAtLineEnd:function(e,n){var r=e.selection;return!!r&&(t.Editor.isEnd(e,r.anchor,n)||t.Editor.isEnd(e,r.focus,n))},getTextarea:function(e){var t=cs.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return hs.get(e)||null},getHoverbar:function(e){return gs.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 n,r,i,a,s=Gf.getTextarea(e).$textArea,u=null==s?void 0:s[0].childNodes;if(u)try{for(var l=uo(Array.from(u)),c=l.next();!c.done;c=l.next()){var f=c.value;if(!qc(f))break;f.remove()}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}var d=t.Editor.nodes(e,{match:function(n){return!(!t.Element.isElement(n)||e.isInline(n))},universal:!0});try{for(var h=uo(d),p=h.next();!p.done;p=h.next()){var g=p.value;if(null!=g){var v=g[0];nf(Gf.toDOMNode(e,v),function(e,t){var n=o(t);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||t.removeChild(e)})}}}catch(e){i={error:e}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.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){var n,r,o=t.Editor.nodes(e,{match:function(t){return e.isVoid(t)}}),i=0;try{for(var a=uo(o),s=a.next();!s.done;s=a.next()){s.value&&(i+=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>0},isSelectedEmptyParagraph:function(e){var n=e.selection;if(null==n)return!1;if(t.Range.isExpanded(n))return!1;var r=Gf.getSelectedNodeByType(e,"paragraph");if(null===r)return!1;var o=r.children;return 1===o.length&&(""===o[0].text||void 0)},isEmptyPath:function(e,n){var r=t.Editor.node(e,n);if(null==r)return!1;var o=lo(r,1)[0].children;if(1===o.length&&""===o[0].text)return!0;return!1}};function Yf(e,n){return t.Element.isElement(e)?Mf(e,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=Gf.getParentsNodes(t,e).some(function(e){return"pre"===Gf.getNodeType(e)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/ /g," ")),""===r){var i=Gf.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>"}return Tf.forEach(function(n){return r=n(e,r,t)}),r}(e,n)}var Xf=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Qf=function(e,t,n){var r=Gf.toDOMRange(e,t).getBoundingClientRect(),o=Gf.toDOMRange(e,n).getBoundingClientRect();return Xf(r,o)&&Xf(o,r)},Zf=function(e,n){var r,o,i=[];try{for(var a=uo(t.Editor.levels(e,{at:n})),s=a.next();!s.done;s=a.next()){var u=lo(s.value,2),l=u[0],c=u[1],f=Gf.findKey(e,l);i.push([c,f])}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i};function ed(e,n){e.isInline(n)?(e.insertNode(n),"link"===n.type&&e.insertFragment([{text:""}])):t.Transforms.insertNodes(e,n,{mode:"highest"})}var td,nd,rd,od,id,ad,sd,ud,ld,cd,fd,dd,hd,pd,gd,vd,md,yd,bd,wd,xd,Ed,Sd,Od,Cd,kd,Td,Nd,Rd,Md,Ld,Pd,Dd,Ad,Id,jd,$d,Fd,_d,Bd,Wd=function(e){var n=e,r=n.onChange,i=n.insertText,a=n.apply,s=n.deleteBackward,u=n.deleteFragment;return n.insertText=function(e){n.getConfig().readOnly||i(e)},n.apply=function(e){var r,o,i,s,u,l,c,f,d=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":case"split_node":d.push.apply(d,co([],lo(Zf(n,e.path)),!1));break;case"insert_node":case"remove_node":d.push.apply(d,co([],lo(Zf(n,t.Path.parent(e.path))),!1));break;case"merge_node":var h=t.Path.previous(e.path);d.push.apply(d,co([],lo(Zf(n,h)),!1));break;case"move_node":var p=t.Path.common(t.Path.parent(e.path),t.Path.parent(e.newPath));d.push.apply(d,co([],lo(Zf(n,p)),!1));break;case"set_selection":(null===(s=null===(i=e.newProperties)||void 0===i?void 0:i.focus)||void 0===s?void 0:s.path)&&(d.push.apply(d,co([],lo(Zf(n,null===(l=null===(u=e.newProperties)||void 0===u?void 0:u.focus)||void 0===l?void 0:l.path)),!1)),d.push.apply(d,co([],lo(Zf(n,null===(f=null===(c=e.properties)||void 0===c?void 0:c.focus)||void 0===f?void 0:f.path)),!1)))}a(e);try{for(var g=uo(d),v=g.next();!v.done;v=g.next()){var m=lo(v.value,2),y=m[0],b=m[1],w=lo(t.Editor.node(n,y),1)[0];Ls.set(w,b),"type"in w&&(Ss.has(w)&&Ss.delete(w),Os.has(w)&&Os.delete(w))}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(r)throw r.error}}},n.deleteBackward=function(r){if("line"!==r)return s(r);if(e.selection&&t.Range.isCollapsed(e.selection)){var o=t.Editor.above(e,{match:function(n){return t.Element.isElement(n)&&t.Editor.isBlock(e,n)},at:e.selection});if(o){var i=lo(o,2)[1],a=t.Editor.range(e,i,e.selection.anchor),u=function(e,n){var r=t.Editor.range(e,t.Range.end(n)),o=Array.from(t.Editor.positions(e,{at:n})),i=0,a=o.length,s=Math.floor(a/2);if(Qf(e,t.Editor.range(e,o[i]),r))return t.Editor.range(e,o[i],r);if(o.length<2)return t.Editor.range(e,o[o.length-1],r);for(;s!==o.length&&s!==i;)Qf(e,t.Editor.range(e,o[s]),r)?a=s:i=s,s=Math.floor((i+a)/2);return t.Editor.range(e,o[a],r)}(n,a);t.Range.isCollapsed(u)||t.Transforms.delete(e,{at:u})}}},n.deleteFragment=function(e){var r=function(e){var n=e.selection;if(null==n||t.Range.isCollapsed(n))return!1;var r=lo(t.Range.edges(n),2),o=r[0],i=r[1],a=lo(t.Editor.edges(e,[]),2),s=a[0],u=a[1];return t.Point.equals(o,s)&&t.Point.equals(i,u)}(n);u(e),r&&(!function(e){var n=[{type:"paragraph",children:[{text:""}]}];t.Editor.withoutNormalizing(e,function(){for(var r=e.children.length-1;r>=0;r-=1)t.Transforms.removeNodes(e,{at:[r]});t.Transforms.insertNodes(e,n,{at:[0]})})}(n),n.children.length>0&&t.Transforms.select(n,t.Editor.start(n,[])))},n.onChange=function(){var e=n.selection;null!=e&&As.set(n,e),n.emit(Ya),r()},n.handleTab=function(){n.insertText(" ")},n.getHtml=function(){var e=n.children,t=void 0===e?[]:e,r=n.getConfig().skipCacheTypes,o=void 0===r?["list-item"]:r;return t.map(function(e){var t=Gf.getNodeType(e);if(o.includes(t))return Yf(e,n);var r=Os.get(e);if(r)return r;var i=Yf(e,n);return Os.set(e,i),i}).join("")},n.getText=function(){var e=n.children;return(void 0===e?[]:e).map(function(e){return t.Node.string(e)}).join("\n")},n.getSelectionText=function(){var r=n.selection;return null==r?"":t.Editor.string(e,r)},n.getElemsByType=function(e,r){var o,i;void 0===r&&(r=!1);var a=[],s=t.Editor.nodes(n,{at:[],universal:!0});try{for(var u=uo(s),l=u.next();!l.done;l=u.next()){var c=lo(l.value,1)[0];if(t.Element.isElement(c))if(r?c.type.indexOf(e)>=0:c.type===e){var f=Gf.findKey(n,c),d=kf(c.type,f.id);a.push(so(so({},c),{id:d}))}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return a},n.getElemsByTypePrefix=function(e){return n.getElemsByType(e,!0)},n.isEmpty=function(){var e=n.children,r=void 0===e?[]:e;if(r.length>1)return!1;var o=r[0];if(null==o)return!0;if(!t.Element.isElement(o)||"paragraph"!==o.type)return!1;var i=o.children,a=void 0===i?[]:i;if(a.length>1)return!1;var s=a[0];return null==s||t.Text.isText(s)&&""===s.text},n.clear=function(){t.Transforms.delete(n,{at:{anchor:t.Editor.start(n,[]),focus:t.Editor.end(n,[])}}),0!==n.children.length?function(e){var n=e.children[0];if(1===e.children.length&&t.Element.isElement(n)&&("paragraph"!==n.type||""!==t.Node.string(n))&&""===t.Node.string(n)){var r=[{type:"paragraph",children:[{text:""}]}];t.Editor.withoutNormalizing(e,function(){t.Transforms.removeNodes(e,{at:[0]}),t.Transforms.insertNodes(e,r,{at:[0]})})}}(n):t.Transforms.insertNodes(n,[{type:"paragraph",children:[{text:""}]}])},n.getParentNode=function(e){return Gf.getParentNode(n,e)},n.dangerouslyInsertHtml=function(e,r){if(void 0===e&&(e=""),void 0===r&&(r=!1),e){var i=document.createElement("div");i.innerHTML=e;var a=Array.from(i.childNodes);if(a=a.filter(function(e){var t=e.nodeName;return!!qc(e)||!!Vc(e)&&!mu.has(t.toLowerCase())}),0!==a.length){var s=n.selection;if(null!=s){var u=null;if(Gf.isSelectedEmptyParagraph(n)&&!r)u=[s.focus.path[0]];i.setAttribute("hidden","true"),document.body.appendChild(i);var l=0;a.forEach(function(e,t){var r=e.nodeName,i=e.textContent,s=void 0===i?"":i;if(qc(e)){if(!s||!s.trim())return;n.insertNode({text:s})}else if("BR"!==r){var u=e,c=!1;if(df.includes(r.toLowerCase()))c=!0;else for(var f in gf)if(u.matches(f)){c=!0;break}if(c){var d=Sf(o(u),n);return Array.isArray(d)?(d.forEach(function(e){return ed(n,e)}),l+=1):(ed(n,d),l+=1),void(Gf.isSelectedVoidNode(n)&&n.move(1))}var h=window.getComputedStyle(u).display;if(!Gf.isSelectedEmptyParagraph(n)&&h.indexOf("inline")<0){if(t>=1){var p=a[t-1];Bc(p)&&n.insertBreak()}n.insertBreak()}n.dangerouslyInsertHtml(u.innerHTML,!0)}else n.insertText("\n")}),l&&u&&Gf.isEmptyPath(n,u)&&t.Transforms.removeNodes(n,{at:u}),i.remove()}}}},n.setHtml=function(e){void 0===e&&(e="");var r=n.isDisabled(),o=n.isFocused(),i=JSON.stringify(n.selection);n.enable(),As.delete(n),n.focus(),n.clear();var a=Cf(n,null==e?"":e);if(t.Transforms.insertFragment(n,a),o||(n.deselect(),n.blur()),r&&(n.deselect(),n.disable()),n.isFocused())try{var s=JSON.parse(i);t.Range.isRange(s)&&Gf.hasRange(n,s)?n.select(s):n.select(t.Editor.start(n,[]))}catch(e){n.select(t.Editor.start(n,[]))}},n},Hd=1,Ud=function(e){var n=e;return n.id="wangEditor-".concat(Hd),Hd+=1,n.isDestroyed=!1,n.isFullScreen=!1,n.focus=function(e){if(Gf.toDOMNode(n,n).focus({preventScroll:!0}),Ds.set(n,!0),e){var r=t.Editor.end(n,[]);t.Transforms.select(n,r)}else{var o=As.get(n);o?t.Transforms.select(n,o):t.Transforms.select(n,t.Editor.start(n,[]))}},n.isFocused=function(){return!!Ds.get(n)},n.blur=function(){Gf.toDOMNode(n,n).blur(),t.Transforms.deselect(n),Ds.set(n,!1)},n.updateView=function(){Gf.getTextarea(n).changeViewState();var e=Gf.getToolbar(n);e&&e.changeToolbarState();var t=Gf.getHoverbar(n);t&&t.changeHoverbarState()},n.destroy=function(){if(!n.isDestroyed){var e=Gf.getTextarea(n);e.destroy(),cs.delete(n),fs.delete(e);var t=Gf.getToolbar(n);t&&(t.destroy(),hs.delete(n),ds.delete(t));var r=Gf.getHoverbar(n);r&&(r.destroy(),gs.delete(n),ps.delete(r)),n.isDestroyed=!0,n.emit(Ga)}},n.scrollToElem=function(e){if(!n.getConfig().scroll){var t="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return t+="\nYou has disabled editor scroll, please do this yourself",void console.warn(t)}var r=o("#".concat(e));if(0!==r.length){var i=r[0];if(!Gf.hasDOMNode(n,i)){t="Element (found by id is '".concat(e,"') is not in editor DOM");return t+="\n 通过 id '".concat(e,"' 找到的 element 不在 editor DOM 之内"),void console.error(t,i)}var a=Gf.getTextarea(n),s=a.$textAreaContainer,u=a.$scroll,l=r.offset().top,c=s.offset().top;u[0].scrollBy({top:l-c,behavior:"smooth"})}},n.showProgressBar=function(e){e<1||Gf.getTextarea(n).changeProgress(e)},n.hidePanelOrModal=function(){var e=ms.get(n);null!=e&&e.forEach(function(e){return e.hide()})},n.enable=function(){n.getConfig().readOnly=!1,n.updateView()},n.disable=function(){n.getConfig().readOnly=!0,n.updateView()},n.isDisabled=function(){return n.getConfig().readOnly},n.toDOMNode=function(e){return Gf.toDOMNode(n,e)},n.fullScreen=function(){if(!n.isFullScreen){var e=null,t=Gf.getToolbar(n);t&&(e=t.$box);var r=Gf.getTextarea(n).$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()),n.isFullScreen=!0,n.emit(Qa)}},n.unFullScreen=function(){if(n.isFullScreen){var e=Gf.getTextarea(n).$box.parent();setTimeout(function(){e.removeClass("w-e-full-screen-container"),n.isFullScreen=!1,n.emit(Za)},200)}},n.getEditableContainer=function(){return Gf.getTextarea(n).$textAreaContainer[0]},n},zd={exports:{}},Vd={exports:{}};function Kd(){if(nd)return td;nd=1;return td=function(e){return null!=e}}function qd(){if(ad)return id;ad=1;var e=function(){if(od)return rd;od=1;var e=Kd(),t={object:!0,function:!0,undefined:!0};return rd=function(n){return!!e(n)&&hasOwnProperty.call(t,typeof n)}}();return id=function(t){if(!e(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(e){return!1}}}function Jd(){if(cd)return ld;cd=1;var e=function(){if(ud)return sd;ud=1;var e=qd();return sd=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 ld=function(r){return!!e(r)&&!t.test(n.call(r))}}function Gd(){if(yd)return md;yd=1;var e=(vd?gd:(vd=1,gd=function(){}))();return md=function(t){return t!==e&&null!==t}}function Yd(){return Ed||(Ed=1,xd=(pd?hd:(pd=1,hd=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(wd)return bd;wd=1;var e=Gd(),t=Object.keys;return bd=function(n){return t(e(n)?Object(n):n)}}()),xd}function Xd(){if(kd)return Cd;kd=1;var e=Yd(),t=function(){if(Od)return Sd;Od=1;var e=Gd();return Sd=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return Cd=function(r,o){var i,a,s,u=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<u;++a)e(o=arguments[a]).forEach(s);if(void 0!==i)throw i;return r},Cd}function Qd(){return Nd?Td:(Nd=1,Td=(dd||(dd=1,fd=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")}),fd)()?Object.assign:Xd())}function Zd(){return jd||(jd=1,Id=function(){if(Pd)return Ld;Pd=1;var e="razdwatrzy";return Ld=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}}()()?String.prototype.contains:function(){if(Ad)return Dd;Ad=1;var e=String.prototype.indexOf;return Dd=function(t){return e.call(this,t,arguments[1])>-1},Dd}()),Id}function eh(){if($d)return Vd.exports;$d=1;var e=Kd(),t=Jd(),n=Qd(),r=function(){if(Md)return Rd;Md=1;var e=Gd(),t=Array.prototype.forEach,n=Object.create;return Rd=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},Rd}(),o=Zd(),i=Vd.exports=function(t,i){var a,s,u,l,c;return arguments.length<2||"string"!=typeof t?(l=i,i=t,t=null):l=arguments[2],e(t)?(a=o.call(t,"c"),s=o.call(t,"e"),u=o.call(t,"w")):(a=u=!0,s=!1),c={value:i,configurable:a,enumerable:s,writable:u},l?n(r(l),c):c};return i.gs=function(i,a,s){var u,l,c,f;return"string"!=typeof i?(c=s,s=a,a=i,i=null):c=arguments[3],e(a)?t(a)?e(s)?t(s)||(c=s,s=void 0):s=void 0:(c=a,a=s=void 0):a=void 0,e(i)?(u=o.call(i,"c"),l=o.call(i,"e")):(u=!0,l=!1),f={get:a,set:s,configurable:u,enumerable:l},c?n(r(c),f):f},Vd.exports}var th=(Bd||(Bd=1,function(e,t){var n,r,o,i,a,s,u,l=eh(),c=_d?Fd:(_d=1,Fd=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}),f=Function.prototype.apply,d=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 c(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),f.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)f.call(r,this,i)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.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];f.call(o,this,i)}},a={on:n=function(e,t){var n;return c(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(c(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:l(n),once:l(r),off:l(o),emit:l(i)},u=g({},s),e.exports=t=function(e){return null==e?h(u):g(Object(e),s)},t.methods=a}(zd,zd.exports)),zd.exports),nh=g(th);function rh(e){var t=Is.get(e);return null==t&&(t=nh(),Is.set(e,t)),t}var oh=new WeakMap;function ih(e,t){var n=oh.get(e);null==n&&(n=new Set,oh.set(e,n)),n.add(t)}var ah=function(e){var t=e;return t.on=function(e,n){var r=rh(t);if(r.on(e,n),"destroyed"===e&&ih(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),ih(t,o)}},t.once=function(e,n){rh(t).once(e,n)},t.off=function(e,n){rh(t).off(e,n)},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=rh(t);if(o.emit.apply(o,co([e],lo(n),!1)),"destroyed"===e){var i=function(e){return oh.get(e)||new Set}(t);i.forEach(function(e){return o.off("destroyed",e)}),function(e){oh.set(e,new Set)}(t)}},t};var sh,uh=function(e){var n=e;return n.setFragmentData=function(e){var r=n.selection;if(r){var o=lo(t.Range.edges(r),2),i=o[0],a=o[1],s=t.Editor.void(n,{at:i.path}),u=t.Editor.void(n,{at:a.path});if(!t.Range.isCollapsed(r)||s){var l=Gf.toDOMRange(n,r),c=l.cloneContents(),f=c.childNodes[0];if(c.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(f=e)}),u){var d=lo(u,1)[0],h=l.cloneRange(),p=Gf.toDOMNode(n,d);h.setEndAfter(p),c=h.cloneContents()}if(s&&(f=c.querySelector("[data-slate-spacer]")),Array.from(c.querySelectorAll("[data-slate-zero-width]")).forEach(function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":""}),qc(f)){var g=f.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(f),c.appendChild(g),f=g}var v=n.getFragment(),m=JSON.stringify(v),y=window.btoa(encodeURIComponent(m));f.setAttribute("data-slate-fragment",y),e.setData("application/x-slate-fragment",y);var b=c.ownerDocument.createElement("div");return b.appendChild(c),b.setAttribute("hidden","true"),c.ownerDocument.body.appendChild(b),e.setData("text/html",b.innerHTML),e.setData("text/plain",ef(b)),c.ownerDocument.body.removeChild(b),e}}},n.insertData=function(e){var t=e.getData("application/x-slate-fragment");if(t){var r=decodeURIComponent(window.atob(t)),o=JSON.parse(r);n.insertFragment(o)}else{var i=e.getData("text/plain"),a=e.getData("text/html");if(a){var s=n.getConfig().sanitizeHtml;n.dangerouslyInsertHtml(s?s(a):a)}else if(i){if(!/[\r\n]/.test(i))return void n.insertText(i);var u=function(e){return e.replace(/\n\r|\r\n|\r/g,"\n").split("\n").map(function(e){return{type:"paragraph",children:[{text:e}]}})}(i);n.insertFragment(u)}}},n},lh={};function ch(e){return e.replace(/\n\r|\r\n|\r|\n/g,"").length}function fh(e,t){var n,r;if(t<=0)return"";var o=t,i="";try{for(var a=uo(e),s=a.next();!s.done;s=a.next()){var u=s.value;if(/\r|\n/.test(u))i+=u;else{if(o<=0)break;i+=u,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}!function(){if(sh)return lh;sh=1;var e=Qn(),t=Fr(),n=_r(),r=Me(),o=Nn(),i=Mn(),a=Ne(),s=ro(),u=wt(),l=oo(),c=ca(),f=l("slice"),d=u("species"),h=Array,p=Math.max;e({target:"Array",proto:!0,forced:!f},{slice:function(e,u){var l,f,g,v=a(this),m=i(v),y=o(e,m),b=o(void 0===u?m:u,m);if(t(v)&&(l=v.constructor,(n(l)&&(l===h||t(l.prototype))||r(l)&&null===(l=l[d]))&&(l=void 0),l===h||void 0===l))return c(v,y,b);for(f=new(void 0===l?h:l)(p(b-y,0)),g=0;y<b;y++,g++)y in v&&s(f,g,v[y]);return f.length=g,f}})}();var dh=function(e){var n=e,r=n.insertText,o=n.insertNode,i=n.insertFragment,a=n.dangerouslyInsertHtml;return n.insertText=function(e){if(n.getConfig().maxLength){var t=Gf.getLeftLengthOfMaxLength(n);t<=0||(t<e.length?r(e.slice(0,t)):r(e))}else r(e)},n.insertNode=function(e){if(n.getConfig().maxLength){var r=Gf.getLeftLengthOfMaxLength(n);if(!(r<=0))r<t.Node.string(e).length||o(e)}else o(e)},n.insertFragment=function(e){if(n.getConfig().maxLength){if(e.length>0){var r=e[0];if(Gf.getLeftLengthOfMaxLength(n)<t.Node.string(r).length)return;i([r]);for(var o=1;o<e.length;o+=1)n.insertNode(e[o])}}else i(e)},n.dangerouslyInsertHtml=function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=!1),e)if(n.getConfig().maxLength){var r=Gf.getLeftLengthOfMaxLength(n);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(qc(a)){var s=a.textContent||"",u=ch(s);if(u<=t){t-=u;continue}return a.textContent=fh(s,t),t=0,r(n.slice(i+1)),!1}if(Vc(a)){if(mu.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,t)}}else a(e,t)},n};function hh(e){var t=Gf.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return{top:o.top,left:o.left,width:n,height:r}}function ph(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=hh(e);if(null==r)return t;var o=r.top,i=r.left,a=r.width,s=r.height,u=Gf.toDOMRange(e,n).getClientRects(),l=u?u[0]:null;if(null==l)return t;var c={},f=l.top-o,d=l.left-i;if(d>a/2){var h=a-d;c.right="".concat(h+5,"px")}else c.left="".concat(d+5,"px");if(f>s/2){var p=s-f;c.bottom="".concat(p+5,"px")}else{var g=u[u.length-1],v=g.top-o+g.height;v<0&&(v=0),c.top="".concat(v+5,"px")}return c}function gh(e,n,r){void 0===r&&(r="modal");var o={top:"0",left:"0"};if(null==e.selection)return o;var i=t.Element.isElement(n)&&e.isVoid(n),a=t.Element.isElement(n)&&e.isInline(n),s=Ms.get(n);if(null==s)return o;var u=s.getBoundingClientRect(),l=u.top,c=u.left,f=u.height,d=u.width;if(i){var h=tf(s);if(null!=h){var p=h.getBoundingClientRect();l=p.top,f=p.height}}var g=hh(e);if(null==g)return o;var v=g.top,m=g.left,y=g.width,b=g.height,w={},x=l-v,E=c-m;if("bar"===r)return w.left="".concat(E,"px"),x>40?w.bottom="".concat(b-x+5,"px"):w.top="".concat(x+f+5,"px"),w;if("modal"===r){if(i?a?E>(y-d)/2?w.right="".concat(y-E+5,"px"):w.left="".concat(E+d+5,"px"):w.left="20px":w.left="".concat(E,"px"),i)(S=x)<0&&(S=0),w.top="".concat(S,"px");else if(x>(b-f)/2)w.bottom="".concat(b-x+5,"px");else{var S;(S=x+f)<0&&(S=0),w.top="".concat(S+5,"px")}return w}throw new Error("type '".concat(r,"' is invalid"))}function vh(e,t){Cc(function(){var n=hh(e);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,u=t.offset(),l=u.top,c=u.left,f=t.width(),d=t.height(),h=l-o,p=c-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=h+d-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&&l<0){var y=t.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(l);t.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=p+f-a)>0){var w=t.css("left"),x=parseInt(w.toString(),10)-r;x<0&&(x=0),t.css("left","".concat(x,"px"))}if(g.indexOf("right")>=0&&c<0){var E=t.css("right"),S=parseInt(E.toString(),10)-Math.abs(c);t.css("right","".concat(S,"px"))}}})}var mh,yh=function(e){var n=e,r=n.select,o=n.deselect,i=n.move;return n.select=function(e){r(e)},n.deselect=function(){var e=n.selection,t=Gf.findDocumentOrShadowRoot(n).getSelection();t&&t.rangeCount>0&&Gf.hasDOMNode(n,t.anchorNode)&&Gf.hasDOMNode(n,t.focusNode)&&t.removeAllRanges(),e&&o()},n.move=function(e,t){void 0===t&&(t=!1),"number"==typeof e?e&&(e<0||i({distance:e,unit:"character",reverse:t})):i(e)},n.moveReverse=function(e){n.move(e,!0)},n.restoreSelection=function(){var e=As.get(n);null!=e&&(n.focus(),r(e))},n.getSelectionPosition=function(){return ph(n)},n.getNodePosition=function(e){return gh(n,e)},n.isSelectedAll=function(){var e=n.selection;if(null==e)return!1;var r=lo(t.Range.edges(e),2),o=r[0],i=r[1],a=lo(t.Editor.edges(n,[]),2),s=a[0],u=a[1];return!(!t.Point.equals(o,s)||!t.Point.equals(i,u))},n.selectAll=function(){var e=t.Editor.start(n,[]),o=t.Editor.end(n,[]);r({anchor:e,focus:o})},n},bh={};!function(){if(mh)return bh;mh=1;var e=P(),t=Se(),n=$u(),r=It(),o=Me(),i=Rn(),a=Ta(),s=Te(),u=Be(),l=Bu(),c=il(),f=Wu(),d=t("".indexOf);n("match",function(t,n,h){return[function(n){var r=s(this),i=o(n)?u(n,t):void 0;return i?e(i,n,r):new RegExp(n)[t](a(r))},function(e){var t=r(this),o=a(e),s=h(n,t,o);if(s.done)return s.value;var u=a(c(t));if(-1===d(u,"g"))return f(t,o);var p=-1!==d(u,"u");t.lastIndex=0;for(var g,v=[],m=0;null!==(g=f(t,o));){var y=a(g[0]);v[m]=y,""===y&&(t.lastIndex=l(o,i(t.lastIndex),p)),m++}return 0===m?null:v}]})}();const wh=e=>"string"==typeof e,xh=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Eh=e=>null==e?"":""+e,Sh=/###/g,Oh=e=>e&&e.indexOf("###")>-1?e.replace(Sh,"."):e,Ch=e=>!e||wh(e),kh=(e,t,n)=>{const r=wh(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(Ch(e))return{};const t=Oh(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return Ch(e)?{}:{obj:e,k:Oh(r[o])}},Th=(e,t,n)=>{const{obj:r,k:o}=kh(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=kh(e,a,Object);for(;void 0===s.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),s=kh(e,a,Object),s&&s.obj&&void 0!==s.obj[`${s.k}.${i}`]&&(s.obj=void 0);s.obj[`${s.k}.${i}`]=n},Nh=(e,t)=>{const{obj:n,k:r}=kh(e,t);if(n)return n[r]},Rh=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?wh(e[r])||e[r]instanceof String||wh(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Rh(e[r],t[r],n):e[r]=t[r]);return e},Mh=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Lh={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Ph=e=>wh(e)?e.replace(/[&<>"'\/]/g,e=>Lh[e]):e;const Dh=[" ",",","?","!",";"],Ah=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),Ih=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},jh=e=>e&&e.replace("_","-"),$h={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 Fh{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||$h,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:(wh(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Fh(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new Fh(this.logger,e)}}var _h=new Fh;class Bh{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 Wh extends Bh{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):wh(n)&&o?a.push(...n.split(o)):a.push(n)));const s=Nh(this.data,a);return!s&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),!s&&i&&wh(n)?Ih(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),Th(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)(wh(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=Nh(this.data,a)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Rh(s,n,o):s={...s,...n},Th(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 Hh={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 Uh={};class zh extends Bh{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=_h.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=Dh.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===r.length)return!0;const o=Ah.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:wh(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:wh(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],u=t.lng||this.language,l=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&"cimode"===u.toLowerCase()){if(l){const e=t.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:`${s}${e}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:s,usedParams:this.getUsedParamsDetails(t)}:i}const c=this.resolve(e,t);let f=c&&c.res;const d=c&&c.usedKey||i,h=c&&c.exactUsedKey||i,p=Object.prototype.toString.apply(f),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!wh(f)&&"boolean"!=typeof f&&"number"!=typeof f;if(!(v&&f&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(p)<0)||wh(g)&&Array.isArray(f))if(v&&wh(g)&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,e,t,n));else{let r=!1,a=!1;const l=void 0!==t.count&&!wh(t.count),d=zh.hasDefaultValue(t),h=l?this.pluralResolver.getSuffix(u,t.count,t):"",p=t.ordinal&&l?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",g=l&&!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(f)&&d&&(r=!0,f=v),this.isValidLookup(f)||(a=!0,f=i);const m=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&a?void 0:f,y=d&&v!==f&&this.options.updateMissing;if(a||r||y){if(this.logger.log(y?"updateKey":"missingKey",u,s,i,y?v:f),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=d&&r!==f?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,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&l?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))}f=this.extendTranslation(f,e,t,c,n),a&&f===i&&this.options.appendNamespaceToMissingKey&&(f=`${s}:${i}`),(a||r)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${i}`:i,r?f:void 0):this.options.parseMissingKeyHandler(f))}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(d,f,{...t,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(c.res=e,c.usedParams=this.getUsedParamsDetails(t),c):e}if(o){const e=Array.isArray(f),n=e?[]:{},r=e?h:d;for(const e in f)if(Object.prototype.hasOwnProperty.call(f,e)){const i=`${r}${o}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:a}),n[e]===i&&(n[e]=f[e])}f=n}}return r?(c.res=f,c.usedParams=this.getUsedParamsDetails(t),c):f}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=wh(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 u=n.replace&&!wh(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,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=wh(a)?[a]:a;return null!=e&&s&&s.length&&!1!==n.applyPostProcessor&&(e=Hh.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 wh(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;const s=this.extractFromKey(e,a),u=s.key;n=u;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));const c=void 0!==a.count&&!wh(a.count),f=c&&!a.ordinal&&0===a.count&&this.pluralResolver.shouldUseIntlApi(),d=void 0!==a.context&&(wh(a.context)||"number"==typeof a.context)&&""!==a.context,h=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);l.forEach(e=>{this.isValidLookup(t)||(i=e,!Uh[`${h[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(Uh[`${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=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,u,n,e,a);else{let e;c&&(e=this.pluralResolver.getSuffix(n,a.count,a));const t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(i.push(u+e),a.ordinal&&0===e.indexOf(r)&&i.push(u+e.replace(r,this.options.pluralSeparator)),f&&i.push(u+t)),d){const n=`${u}${this.options.contextSeparator}${a.context}`;i.push(n),c&&(i.push(n+e),a.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),f&&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&&!wh(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 Vh=e=>e.charAt(0).toUpperCase()+e.slice(1);class Kh{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=_h.create("languageUtils")}getScriptPartFromCode(e){if(!(e=jh(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=jh(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(wh(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]=Vh(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]=Vh(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Vh(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)),wh(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 wh(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))):wh(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&o(this.formatLanguageCode(e))}),r}}let qh=[{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}],Jh={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 Gh=["v1","v2","v3"],Yh=["v4"],Xh={zero:0,one:1,two:2,few:3,many:4,other:5};class Qh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=_h.create("pluralResolver"),this.options.compatibilityJSON&&!Yh.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 qh.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Jh[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=jh("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)=>Xh[e]-Xh[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!Gh.includes(this.options.compatibilityJSON)}}const Zh=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=Nh(e,n);return void 0!==r?r:Nh(t,n)})(e,t,n);return!i&&o&&wh(n)&&(i=Ih(e,n,r),void 0===i&&(i=Ih(t,n,r))),i},ep=e=>e.replace(/\$/g,"$$$$");class tp{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=_h.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:u,unescapeSuffix:l,unescapePrefix:c,nestingPrefix:f,nestingPrefixEscaped:d,nestingSuffix:h,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=e.interpolation;this.escape=void 0!==t?t:Ph,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?Mh(o):i||"{{",this.suffix=a?Mh(a):s||"}}",this.formatSeparator=u||",",this.unescapePrefix=l?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=f?Mh(f):d||Mh("$t("),this.nestingSuffix=h?Mh(h):p||Mh(")"),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||{},u=e=>{if(e.indexOf(this.formatSeparator)<0){const o=Zh(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(Zh(t,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,n,{...r,...t,interpolationkey:i})};this.resetRegExp();const l=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>ep(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?ep(this.escape(e)):ep(e)}].forEach(t=>{for(a=0;o=t.regex.exec(e);){const n=o[1].trim();if(i=u(n),void 0===i)if("function"==typeof l){const t=l(e,o,r);i=wh(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(c){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else wh(i)||this.useRawValueToEscape||(i=Eh(i));const s=t.safeValue(i);if(e=e.replace(o[0],s),c?(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&&!wh(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!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,u=!0}if(r=t(a.call(this,n[1].trim(),o),o),r&&n[0]===e&&!wh(r))return r;wh(r)||(r=Eh(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),u&&(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 np=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(jh(r),o),t[a]=s),s(n)}};class rp{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=_h.create("formatter"),this.options=e,this.formats={number:np((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:np((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:np((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:np((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:np((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()]=np(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 op extends Bh{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=_h.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}=kh(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();wh(e)&&(e=this.languageUtils.toResolveHierarchy(e)),wh(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},u=this.backend.create.bind(this.backend);if(u.length<6)try{let o;o=5===u.length?u(e,t,n,r,s):u(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 u(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}const ip=()=>({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]),wh(e[1])&&(t.defaultValue=e[1]),wh(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}}),ap=e=>(wh(e.ns)&&(e.ns=[e.ns]),wh(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),wh(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),sp=()=>{};class up extends Bh{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=ap(e),this.services={},this.logger=_h,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&&(wh(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=ip();this.options={...r,...this.options,...ap(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?_h.init(o(this.modules.logger),this.options):_h.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=rp);const n=new Kh(this.options);this.store=new Wh(this.options.resources,this.options);const i=this.services;i.logger=_h,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Qh(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 tp(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new op(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 zh(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=sp),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=xh(),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]:sp;const n=wh(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=xh();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=sp),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&&Hh.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=xh();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=wh(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),u=2;u<a;u++)s[u-2]=arguments[u];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 l=r.options.keySeparator||".";let c;return c=i.keyPrefix&&Array.isArray(e)?e.map(e=>`${i.keyPrefix}${l}${e}`):i.keyPrefix?`${i.keyPrefix}${l}${e}`:e,r.t(c,i)};return wh(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=xh();return this.options.ns?(wh(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=xh();wh(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 Kh(ip());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 up(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]:sp;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new up(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 Wh(this.store.data,r),o.services.resourceStore=o.store),o.translator=new zh(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 lp=up.createInstance();lp.createInstance=up.createInstance,lp.createInstance,lp.dir,lp.init,lp.loadResources,lp.reloadResources,lp.use,lp.changeLanguage,lp.getFixedT,lp.t,lp.exists,lp.setDefaultNamespace,lp.hasLoadedNamespace,lp.loadNamespaces,lp.loadLanguages;var cp="translation";function fp(e){return lp.on("languageChanged",e),function(){return lp.off("languageChanged",e)}}lp.init({lng:"zh-CN",resources:{}});var dp=lp.t.bind(lp);function hp(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&&hp(t)}}function pp(){return o('<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 gp(){return o('<div class="w-e-bar-divider"></div>')}function vp(e,t,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),t){if(r){var i=Bf?"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 mp=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=o('<div class="w-e-bar-item"></div>'),this.$button=o('<button type="button"></button>'),this.disabled=!1,this.menu=t;var i=t.tag,a=t.width;if("button"!==i)throw new Error("Invalid tag '".concat(i,"', expected 'button'"));var s=t.title,u=t.hotkey,l=void 0===u?"":u,c=t.iconSvg,f=void 0===c?"":c,d=this.$button;if(f){var h=o(f);hp(h),d.append(h)}else d.text(s);vp(d,f,s,l,n),n&&f&&d.append(o('<span class="title">'.concat(s,"</span>"))),a&&d.css("width","".concat(a,"px")),d.attr("data-menu-key",e),this.$elem.append(d),Cc(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(t){t.preventDefault(),Np(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick())})},e.prototype.exec=function(){var e=Np(this),t=this.menu,n=t.getValue(e);t.exec(e,n),this.changeMenuState()},e.prototype.setActive=function(){var e=Np(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n)},e.prototype.setDisabled=function(){var e=Np(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=Np(this),t=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(e);if(n){t.find("svg").remove();var r=o(n);hp(r),t.append(r)}}},e.prototype.setTooltip=function(){var e=Np(this),t=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(e),r=this.menu.iconSvg;n&&r&&vp(t,r,n)}},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},e}(),yp=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return ao(t,e),t.prototype.onButtonClick=function(){},t}(mp),bp=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e)}return e.prototype.record=function(e){var t=ms.get(e);null==t&&(t=new Set,ms.set(e,t)),t.add(this),ys.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=ys.get(this);e&&e.emit(es,this)}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=ys.get(this);e&&e.emit(ts)}},e}(),wp=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=o('<div class="w-e-drop-panel"></div>'),n}return ao(t,e),t.prototype.genSelfElem=function(){return null},t}(bp),xp=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=pp();o.$button.append(i)}return o}return ao(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=Np(this);if(null==this.dropPanel){var n=new wp(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,u=a.parents(".w-e-bar");s-u.offset().left>=u.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"})}}},t}(mp),Ep=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=o('<div class="w-e-modal"></div>'),r.width=0,n&&(r.width=n);var i=r.$elem;return i.on("click",function(e){return e.stopPropagation()}),i.on("keyup",function(e){"Escape"===e.code&&(r.hide(),t.restoreSelection())}),r}return ao(t,e),t.prototype.genSelfElem=function(){var e=this,t=o('<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=ys.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}(bp);var Sp=function(e){function n(t,n,r){void 0===r&&(r=!1);var i=e.call(this,t,n,r)||this;return i.$body=o("body"),i.modal=null,i.menu=n,i}return ao(n,e),n.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal()},n.prototype.getPosition=function(){var e=Np(this),n=this.menu.getModalPositionNode(e);return t.Element.isElement(n)?gh(e,n,"modal"):ph(e)},n.prototype.handleModal=function(){var e=Np(this),t=this.menu;if(null==this.modal){var n=new Ep(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n}else{(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1)}},n.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=Np(this),r=this.menu;if(null!=r.getModalContentElem){var o=Gf.getTextarea(n),i=Gf.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 u=this.getPosition();e.setStyle(u)}t&&(a?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),a||vh(n,e.$elem),setTimeout(function(){n.blur()})}},n}(mp);var Op=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=o('<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 ao(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=o("<ul></ul>");e.forEach(function(e){var t=e.value,r=e.text,i=e.selected,a=e.styleForRenderMenuList,s=o('<li data-value="'.concat(t,'"></li>'));if(a&&s.css(a),i){var u=o('<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>');s.append(u),s.addClass("selected")}s.append(o('<span data-value="'.concat(t,'">').concat(r,"</span>"))),s.attr("title",r),n.append(s)}),t.append(n)},t.prototype.genSelfElem=function(){return null},t}(bp);var Cp=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=o('<div class="w-e-bar-item"></div>'),this.$button=o('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var i=t.tag,a=t.title,s=t.width,u=t.iconSvg,l=void 0===u?"":u,c=t.hotkey,f=void 0===c?"":c;if("select"!==i)throw new Error("Invalid tag '".concat(i,"', expected 'select'"));var d=this.$button;s&&d.css("width","".concat(s,"px")),d.attr("data-menu-key",e),vp(d,l,a,f,n),this.$elem.append(d),this.menu=t,Cc(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",function(t){t.preventDefault(),Np(e).hidePanelOrModal(),e.trigger()})},e.prototype.trigger=function(){var e=this,t=Np(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new Op(t,n.selectPanelWidth);var r=this.selectList,i=n.getOptions(t);r.renderList(i),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",function(t){var n=t.target;if(null!=n){t.preventDefault();var r=o(n).attr("data-value");e.onChange(r)}})}else{if((r=this.selectList).isShow)r.hide();else{i=n.getOptions(t);r.renderList(i),r.show()}}}},e.prototype.onChange=function(e){var t=Np(this),n=this.menu;n.exec&&n.exec(t,e)},e.prototype.setSelectedValue=function(){var e=Np(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o++){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=pp();o.empty(),o.text(r),o.append(i)},e.prototype.setDisabled=function(){var e=Np(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}(),kp=function(){function e(e){this.$elem=o('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=o('<div class="w-e-bar-item-menus-container"></div>'),this.$button=o('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,i=this.$elem,a=this.$button;if(n){var s=o(n);hp(s),a.append(s)}else a.text(r);a.attr("data-menu-key",t);var u=pp();a.append(u),i.append(a);var l=this.$container;i.append(l);var c=this.createObserver();this.observe(c)}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 i=t.find("button"),a=i.length;if(0!==a){var s=0;i.each(function(e){o(e).hasClass("disabled")&&s++}),r.disconnect(),s===a?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r)}});return r},e}(),Tp=new WeakMap;function Np(e){var t=vs.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function Rp(e,t,n){void 0===n&&(n=!1);var r=Tp.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,a=t.showModal;r=i?new xp(e,t,n):a?new Sp(e,t,n):new yp(e,t,n)}if("select"===o&&(r=new Cp(e,t,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(t)));return Tp.set(t,r),r}function Mp(e,n){var r=e.selection;return null!=r&&(!t.Range.isCollapsed(r)&&(!Gf.getSelectedElems(e).some(function(t){if(e.isVoid(t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)})&&!!t.Text.isText(n)))}var Lp=function(){function e(){var e=this;this.$elem=o('<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=s(function(){var n=e.isShow,r=e.getSelectedNodeAndMenuKeys()||{},o=r.node,i=void 0===o?null:o,a=r.menuKeys,s=void 0===a?[]:a,u=e.getEditorInstance();if(null!=i&&e.changeItemsState(),i&&t.Element.isElement(i)&&n){var l=e.isSamePath(i,e.prevSelectedNode);if(!t.Editor.isBlock(u,i)&&l)return}e.hideAndClean(),null!=i&&(e.registerItems(s),e.setPosition(i),e.show()),e.prevSelectedNode=i},200),Cc(function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),Gf.getTextarea(t).$textAreaContainer.append(n),t.on(Ya,e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on(Xa,r),t.on(Qa,r),t.on(Za,r)}),this.lngListen=fp(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;Cc(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=gp();n.append(r)}})},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=ns[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=Rp(e,r);this.hoverbarItems.push(a),vs.set(a,t),this.$elem.append(a.$elem)},e.prototype.setPosition=function(e){var n=this.getEditorInstance(),r=this.$elem;if(r.attr("style",""),t.Element.isElement(e)){var o=gh(n,e,"bar");return r.css(o),void vh(n,r)}if(t.Text.isText(e)){o=ph(n);return r.css(o),void vh(n,r)}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 n=this.getHoverbarKeysConf(),r=null,o=[],i=function(i){var a=n[i],s=a.match,u=a.menuKeys,l=void 0===u?[]:u,c=s||function(e,t){return Gf.checkNodeType(t,i)},f=lo(t.Editor.nodes(e,{match:function(t){return c(e,t)},universal:!0}),1),d=f[0];if(null!=d)return r=d[0],o=l,"break"};for(var a in n){if("break"===i(a))break}return null==r||0===o.length?null:{node:r,menuKeys:o}},e.prototype.getEditorInstance=function(){var e=ps.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=Mp),t},e.prototype.isSamePath=function(e,n){if(null==e||null==n)return!1;var r=Gf.findPath(null,e),o=Gf.findPath(null,n);return t.Path.equals(r,o)},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 Pp(e,t){return Uc(t)&&Gf.hasDOMNode(e,t,{editable:!0})}function Dp(e,t){return Uc(t)&&Gf.hasDOMNode(e,t)}function Ap(e,n){return Pp(e,n)||function(e,n){if(e.getConfig().readOnly)return!1;var r=Dp(e,n)&&Gf.toSlateNode(e,n);return!!r&&t.Element.isElement(r)&&t.Editor.isVoid(e,r)}(e,n)}const Ip=e=>"object"==typeof e&&null!=e&&1===e.nodeType,jp=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,$p=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return jp(n.overflowY,t)||jp(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},Fp=(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,_p=e=>{const t=e.parentElement;return null==t?e.getRootNode().host||null:t},Bp=(e,t)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:a,block:s,inline:u,boundary:l,skipOverflowHiddenElements:c}=t,f="function"==typeof l?l:e=>e!==l;if(!Ip(e))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,h=[];let p=e;for(;Ip(p)&&f(p);){if(p=_p(p),p===d){h.push(p);break}null!=p&&p===document.body&&$p(p)&&!$p(document.documentElement)||null!=p&&$p(p,c)&&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:x,right:E,bottom:S,left:O}=e.getBoundingClientRect(),{top:C,right:k,bottom:T,left: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);let R="start"===s||"nearest"===s?x-C:"end"===s?S+T:x+b/2-C+T,M="center"===u?O+w/2-N+k:"end"===u?E+k:O-N;const L=[];for(let e=0;e<h.length;e++){const t=h[e],{height:n,width:r,top:o,right:i,bottom:l,left:c}=t.getBoundingClientRect();if("if-needed"===a&&x>=0&&O>=0&&S<=v&&E<=g&&(t===d&&!$p(t)||x>=o&&S<=l&&O>=c&&E<=i))return L;const f=getComputedStyle(t),p=parseInt(f.borderLeftWidth,10),C=parseInt(f.borderTopWidth,10),k=parseInt(f.borderRightWidth,10),T=parseInt(f.borderBottomWidth,10);let N=0,P=0;const D="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-k:0,A="offsetHeight"in t?t.offsetHeight-t.clientHeight-C-T:0,I="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,j="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(d===t)N="start"===s?R:"end"===s?R-v:"nearest"===s?Fp(y,y+v,v,C,T,y+R,y+R+b,b):R-v/2,P="start"===u?M:"center"===u?M-g/2:"end"===u?M-g:Fp(m,m+g,g,p,k,m+M,m+M+w,w),N=Math.max(0,N+y),P=Math.max(0,P+m);else{N="start"===s?R-o-C:"end"===s?R-l+T+A:"nearest"===s?Fp(o,l,n,C,T+A,R,R+b,b):R-(o+n/2)+A/2,P="start"===u?M-c-p:"center"===u?M-(c+r/2)+D/2:"end"===u?M-i+k+D:Fp(c,i,r,p,k+D,M,M+w,w);const{scrollLeft:e,scrollTop:a}=t;N=0===j?0:Math.max(0,Math.min(a+N/j,t.scrollHeight-n/j+A)),P=0===I?0:Math.max(0,Math.min(e+P/I,t.scrollWidth-r/I+D)),R+=a-N,M+=e-P}L.push({el:t,top:N,left:P})}return L};function Wp(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(Bp(e,t));const r="boolean"==typeof t||null==t?void 0:t.behavior;for(const{el:o,top:i,left:a}of Bp(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 Hp(e){null!=e.selection&&(e.selection=null,e.onChange())}function Up(e,n,r){void 0===r&&(r=!1);var o=n.selection,i=n.getConfig(),a=Gf.findDocumentOrShadowRoot(n).getSelection();if(a&&(!e.isComposing||r)&&n.isFocused()){var s="None"!==a.type;if(o||s){var u=Ts.get(n),l=!1;if(u.contains(a.anchorNode)&&u.contains(a.focusNode)&&(l=!0),s&&l&&o){var c=Gf.toSlateRange(n,a,{exactMatch:!0,suppressThrow:!0});if(c&&t.Range.equals(c,o)){var f=!0;if(t.Range.isCollapsed(o)){var d=a.anchorNode,h=a.anchorOffset;if(d===u){var p=u.childNodes,g=void 0;(g=p[h])&&g.matches("table")&&(f=!1),(g=p[h-1])&&g.matches("table")&&(f=!1)}}if(f)return}}if(!o||Gf.hasRange(n,o)){e.isUpdatingSelection=!0;var v=o&&Gf.toDOMRange(n,o);if(v){t.Range.isBackward(o)?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;Wp(m,{scrollMode:"if-needed",boundary:i.scroll&&u.parentElement||b,block:"end",behavior:"smooth"}),delete m.getBoundingClientRect}}else a.removeAllRanges();setTimeout(function(){v&&Wf&&u.focus(),e.isUpdatingSelection=!1})}else n.selection=Gf.toSlateRange(n,a,{exactMatch:!1,suppressThrow:!1})}}}var zp=new WeakMap,Vp=new WeakMap;var Kp={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"},qp={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"},Jp={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Gp=function(e){var t=Kp[e],n=qp[e],r=Jp[e],o=t&&l.isKeyHotkey(t),i=n&&l.isKeyHotkey(n),a=r&&l.isKeyHotkey(r);return function(e){return!(!o||!o(e))||(!!(Bf&&i&&i(e))||!(Bf||!a||!a(e)))}},Yp={isBold:Gp("bold"),isCompose:Gp("compose"),isMoveBackward:Gp("moveBackward"),isMoveForward:Gp("moveForward"),isDeleteBackward:Gp("deleteBackward"),isDeleteForward:Gp("deleteForward"),isDeleteLineBackward:Gp("deleteLineBackward"),isDeleteLineForward:Gp("deleteLineForward"),isDeleteWordBackward:Gp("deleteWordBackward"),isDeleteWordForward:Gp("deleteWordForward"),isExtendBackward:Gp("extendBackward"),isExtendForward:Gp("extendForward"),isExtendLineBackward:Gp("extendLineBackward"),isExtendLineForward:Gp("extendLineForward"),isItalic:Gp("italic"),isMoveLineBackward:Gp("moveLineBackward"),isMoveLineForward:Gp("moveLineForward"),isMoveWordBackward:Gp("moveWordBackward"),isMoveWordForward:Gp("moveWordForward"),isRedo:Gp("redo"),isSplitBlock:Gp("splitBlock"),isTransposeCharacter:Gp("transposeCharacter"),isUndo:Gp("undo"),isTab:Gp("tab"),isSelectAll:Gp("selectAll")};function Xp(e){e.preventDefault()}var Qp,Zp,eg,tg={beforeinput:function(e,n,r){var o,i=e,a=r.getConfig().readOnly;if(Kf&&!a&&Pp(r,i.target)){null===(o=n.flushDOMSelectionChange)||void 0===o||o.call(n);var s=r.selection,u=i.inputType,l=i.dataTransfer||i.data||void 0;if("insertCompositionText"!==u&&"deleteCompositionText"!==u){if(i.preventDefault(),!u.startsWith("delete")||u.startsWith("deleteBy")){var c=lo(i.getTargetRanges(),1)[0];if(c){var f=Gf.toSlateRange(r,c,{exactMatch:!1,suppressThrow:!1});s&&t.Range.equals(s,f)||t.Transforms.select(r,f)}}if(s&&t.Range.isExpanded(s)){var d=Gf.getSelectedElems(r),h="table"===d[0].type,p="table-cell"!==d[d.length-1].type;if(h&&p)return;if(u.startsWith("delete")){var g=u.endsWith("Backward")?"backward":"forward";return void t.Editor.deleteFragment(r,{direction:g})}}switch(u){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":t.Editor.deleteFragment(r);break;case"deleteContent":case"deleteContentForward":t.Editor.deleteForward(r);break;case"deleteContentBackward":t.Editor.deleteBackward(r);break;case"deleteEntireSoftLine":t.Editor.deleteBackward(r,{unit:"line"}),t.Editor.deleteForward(r,{unit:"line"});break;case"deleteHardLineBackward":t.Editor.deleteBackward(r,{unit:"block"});break;case"deleteSoftLineBackward":t.Editor.deleteBackward(r,{unit:"line"});break;case"deleteHardLineForward":t.Editor.deleteForward(r,{unit:"block"});break;case"deleteSoftLineForward":t.Editor.deleteForward(r,{unit:"line"});break;case"deleteWordBackward":t.Editor.deleteBackward(r,{unit:"word"});break;case"deleteWordForward":t.Editor.deleteForward(r,{unit:"word"});break;case"insertLineBreak":case"insertParagraph":t.Editor.insertBreak(r);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===u&&(n.isComposing=!1,$s.set(r,!0)),"insertFromPaste"===u&&!js.get(r))break;Fc(l)?r.insertData(l):"string"==typeof l&&t.Editor.insertText(r,l)}}}},blur:function(e,n,r){var o=e,i=n.isUpdatingSelection,a=n.latestElement;if(!r.getConfig().readOnly&&!i&&Pp(r,o.target)){var s=Gf.findDocumentOrShadowRoot(r);if(a!==s.activeElement){var u=o.relatedTarget;if(!(u===Gf.toDOMNode(r,r)||Vc(u)&&u.hasAttribute("data-slate-spacer"))){if(null!=u&&Uc(u)&&Gf.hasDOMNode(r,u)){var l=Gf.toSlateNode(r,u);if(t.Element.isElement(l)&&!r.isVoid(l))return}if(Hf){var c=s.getSelection();null==c||c.removeAllRanges()}Ds.delete(r)}}}},focus:function(e,t,n){var r=Gf.toDOMNode(n,n),o=Gf.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,Wf&&e.target!==r?r.focus():Ds.set(n,!0)},click:function(e,n,r){if(!r.getConfig().readOnly&&Dp(r,e.target)&&Uc(e.target)){var o=Gf.toSlateNode(r,e.target),i=Gf.findPath(r,o);if(t.Editor.hasPath(r,i))if(t.Node.get(r,i)===o){var a=t.Editor.start(r,i),s=t.Editor.end(r,i),u=t.Editor.void(r,{at:a}),l=t.Editor.void(r,{at:s});if(u&&l&&t.Path.equals(u[1],l[1])){var c=t.Editor.range(r,a);t.Transforms.select(r,c)}}}},compositionstart:function(e,n,r){if(Pp(r,e.target)){Fs.delete(r);var o=r.selection;if(o&&t.Range.isExpanded(o)&&(t.Editor.deleteFragment(r),Promise.resolve().then(function(){Up(n,r,!0)})),r.selection){var i=Gf.toDOMRange(r,r.selection).startContainer,a=i.textContent||"";zp.set(r,a),Vp.set(r,i)}n.isComposing=!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)}(n,r)}},compositionend:function(e,n,r){var o=e;if(Pp(r,o.target)){n.isComposing=!1;var i=!0===$s.get(r);i?($s.delete(r),Fs.delete(r)):Fs.delete(r);var a=r.selection;if(null!=a){(Vf||Wf)&&Gf.cleanExposedTexNodeInSelectionBlock(r);for(var s=t.Range.isBackward(a)?a.focus:a.anchor,u=lo(t.Editor.node(r,[s.path[0]]),1)[0],l=0;l<s.path.length;l+=1){var c=lo(t.Editor.node(r,s.path.slice(0,l+1)),1)[0];if(t.Element.isElement(c)&&((Hf||Wf)&&"link"===c.type||"code"===c.type)){Gf.setNewKey(u);break}}var f=o.data;if(f&&!i){if(r.getConfig().maxLength){var d=Gf.getLeftLengthOfMaxLength(r);if(d<f.length){var h=Gf.toDOMRange(r,a);h.startContainer.nodeType===Node.TEXT_NODE&&(h.startContainer.textContent=zp.get(r)||""),d>0&&t.Editor.insertText(r,f.slice(0,d)),n.changeViewState()}else t.Editor.insertText(r,f)}else{var p=Gf.findDocumentOrShadowRoot(r).getSelection();p&&function(e,n){if(t.Range.isCollapsed(n)){var r=n.anchor,o=n.focus;if([2,3].includes(r.path.length)&&[2,3].includes(o.path.length)&&(0===r.offset||0===o.offset)){var i=t.Editor.node(e,r.path),a=0===r.offset?r.path:o.path,s=[a[0],a[1]-1];if(0===a[1])return!1;var u=t.Editor.node(e,s);if(t.Text.isText(u[0])&&t.Text.isText(i[0]))return!0}}}(r,a)&&(r.selection=Gf.toSlateRange(r,p,{exactMatch:!1,suppressThrow:!1})),t.Editor.insertText(r,f)}Hf||setTimeout(function(){var e=r.selection;if(null!=e){var t=Vp.get(r);if(null!=t)Gf.toDOMRange(r,e).startContainer!==t&&(t.textContent=zp.get(r)||"")}})}}}},compositionupdate:function(e,t,n){Pp(n,e.target)&&(t.isComposing=!0)},keydown:function(e,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&!n.isComposing&&Pp(r,o.target)){if(function(e,t){var n=hs.get(e),r=n&&n.getMenus(),o=gs.get(e),i=o&&o.getMenus(),a=so(so({},r),i);for(var s in a){var u=a[s],c=u.hotkey;if(c&&l.isHotkey(c,t)&&!u.isDisabled(e)){var f=u.getValue(e);u.exec(e,f)}}}(r,o),Yp.isTab(o))return Xp(o),void r.handleTab();if(Yp.isRedo(o))return Xp(o),void("function"==typeof r.redo&&r.redo());if(Yp.isUndo(o))return Xp(o),void("function"==typeof r.undo&&r.undo());if(Yp.isMoveLineBackward(o))return Xp(o),void t.Transforms.move(r,{unit:"line",reverse:!0});if(Yp.isMoveLineForward(o))return Xp(o),void t.Transforms.move(r,{unit:"line"});if(Yp.isExtendLineBackward(o))return Xp(o),void t.Transforms.move(r,{unit:"line",edge:"focus",reverse:!0});if(Yp.isExtendLineForward(o))return Xp(o),void t.Transforms.move(r,{unit:"line",edge:"focus"});if(Yp.isMoveBackward(o))return Xp(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r,{reverse:!0}):t.Transforms.collapse(r,{edge:"start"}));if(Yp.isMoveForward(o))return Xp(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r):t.Transforms.collapse(r,{edge:"end"}));if(Yp.isMoveWordBackward(o))return Xp(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word",reverse:!0});if(Yp.isMoveWordForward(o))return Xp(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word"});if(Yp.isSelectAll(o))return Xp(o),void r.selectAll();if(Kf){if((Vf||Hf)&&i&&(Yp.isDeleteBackward(o)||Yp.isDeleteForward(o))&&t.Range.isCollapsed(i)){var a=t.Node.parent(r,i.anchor.path);if(t.Element.isElement(a)&&t.Editor.isVoid(r,a)&&t.Editor.isInline(r,a))return o.preventDefault(),void t.Transforms.delete(r,{unit:"block"})}}else{if(Yp.isBold(o)||Yp.isItalic(o)||Yp.isTransposeCharacter(o))return void Xp(o);if(Yp.isSplitBlock(o))return Xp(o),void t.Editor.insertBreak(r);if(Yp.isDeleteBackward(o))return Xp(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r));if(Yp.isDeleteForward(o))return Xp(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r));if(Yp.isDeleteLineBackward(o))return Xp(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"line"}));if(Yp.isDeleteLineForward(o))return Xp(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"line"}));if(Yp.isDeleteWordBackward(o))return Xp(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"word"}));if(Yp.isDeleteWordForward(o))return Xp(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"word"}))}}},keypress:function(e,n,r){if(!Kf&&!r.getConfig().readOnly&&Pp(r,e.target)){e.preventDefault();var o=e.key;t.Editor.insertText(r,o)}},copy:function(e,t,n){var r=e;if(Pp(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,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&(o.preventDefault(),Pp(r,o.target))){var a=o.clipboardData;if(null!=a&&(r.setFragmentData(a),i))if(t.Range.isExpanded(i))t.Editor.deleteFragment(r);else{var s=t.Node.parent(r,i.anchor.path);t.Element.isElement(s)&&t.Editor.isVoid(r,s)&&t.Transforms.delete(r)}}},paste:function(e,t,n){js.set(n,!0);var r=e;if(!n.getConfig().readOnly&&Pp(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return js.set(n,!1),void r.preventDefault();if(Hf||!Kf||Jc(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(e,n,r){if(Dp(r,e.target)){var o=Gf.toSlateNode(r,e.target);t.Element.isElement(o)&&t.Editor.isVoid(r,o)&&e.preventDefault()}},dragstart:function(e,n,r){var o=e;if(Dp(r,o.target)&&!r.getConfig().readOnly){var i=Gf.toSlateNode(r,o.target),a=Gf.findPath(r,i);if(t.Element.isElement(i)&&t.Editor.isVoid(r,i)||t.Editor.void(r,{at:a,voids:!0})){var s=t.Editor.range(r,a);t.Transforms.select(r,s)}var u=o.dataTransfer;if(null!=u)Gf.getSelectedNodeByType(r,"table")||(n.isDraggingInternally=!0,r.setFragmentData(u))}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&Dp(n,r.target)&&(t.isDraggingInternally=!1)},drop:function(e,n,r){var o=e,i=o.dataTransfer;if(!r.getConfig().readOnly&&Dp(r,o.target)&&null!=i&&!(Kf&&Hf&&i.files.length>0)){o.preventDefault();var a=r.selection,s=Gf.findEventRange(r,o);t.Transforms.select(r,s),n.isDraggingInternally&&(a&&t.Transforms.delete(r,{at:a}),n.isDraggingInternally=!1),r.insertData(i),r.isFocused()||r.focus()}}},ng={};!function(){if(eg)return ng;eg=1;var e=Qn(),t=function(){if(Zp)return Qp;Zp=1;var e=M(),t=Se(),n=P(),r=R(),o=Zn(),i=Jn(),a=xe(),s=mt(),u=Ce(),l=Object.assign,c=Object.defineProperty,f=t([].concat);return Qp=!l||r(function(){if(e&&1!==l({b:1},l(c({},"a",{enumerable:!0,get:function(){c(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},n={},r=Symbol("assign detection"),i="abcdefghijklmnopqrst";return t[r]=7,i.split("").forEach(function(e){n[e]=e}),7!==l({},t)[r]||o(l({},n)).join("")!==i})?function(t,r){for(var l=s(t),c=arguments.length,d=1,h=i.f,p=a.f;c>d;)for(var g,v=u(arguments[d++]),m=h?f(o(v),h(v)):o(v),y=m.length,b=0;y>b;)g=m[b++],e&&!n(p,v,g)||(l[g]=v[g]);return l}:l,Qp}();e({target:"Object",stat:!0,arity:2,forced:Object.assign!==t},{assign:t})}();var rg=[];var og={};function ig(e,t,n){var r=n.isInline(e)?"span":"div";return c.jsx(r,null,t)}function ag(e,n){var r,o=Gf.findKey(n,e),i=n.isInline(e),a=t.Editor.isVoid(n,e),s=kf(e.type,o.id),u={id:s,key:o.id,"data-slate-node":"element","data-slate-inline":i},l=e.type,f=e.children,d=void 0===f?[]:f,h=function(e){return og[e]||ig}(l);r=a?null:d.map(function(t,r){return cg(t,r,e,n)});var p=h(e,r,n);if(a){u["data-slate-void"]=!0;var g=i?"span":"div",v=lo(t.Node.texts(e),1),m=lo(v[0],1)[0],y=cg(m,0,e,n),b=c.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y);p=c.jsx(g,{style:{position:"relative"}},p,b),Cs.set(m,0),ks.set(m,e)}return null==p.data&&(p.data={}),Object.assign(p.data,u),a||i||(p=function(e,t,n){var r=t;return rg.forEach(function(t){r=t(e,r,n)}),r}(e,p,n)),Cc(function(){var t=Xc(s);null!=t&&(Rs.set(o,t),Ms.set(e,t),Ns.set(t,e))}),p}function sg(e,t){return void 0===t&&(t=!1),c.jsx("span",{"data-slate-string":!0},t?e+"\n":e)}function ug(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),c.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?c.jsx("br",null):null)}function lg(e,n,r){if(null==e.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var o=Gf.findKey(r,e),i=r.getConfig().decorate;if(null==i)throw new Error("Can not get config.decorate");var a,s=Gf.findPath(r,e),u=i([e,s]),l=t.Text.decorations(e,u),f=l.map(function(o){var i,a=o.leaf,s=o.position,u=function(e,n,r,o,i){void 0===n&&(n=!1);var a=e.text,s=Gf.findPath(i,r),u=t.Path.parent(s);if(t.Editor.isEditor(o))throw new Error("Text node ".concat(JSON.stringify(r)," parent is Editor"));return i.isVoid(o)?ug(t.Node.string(o).length):""!==a||o.children[o.children.length-1]!==r||i.isInline(o)||""!==t.Editor.string(i,u)?""===a?ug():n&&"\n"===a.slice(-1)?sg(a,!0):sg(a):ug(0,!0)}(a,null!==(i=null==s?void 0:s.isLast)&&void 0!==i?i:1===l.length,e,n,r);return u=function(e,t,n){var r=t;return rg.forEach(function(t){r=t(e,r,n)}),r}(a,u,r),c.jsx("span",{"data-slate-leaf":!0},u)}),d=(a=o.id,"w-e-text-".concat(a)),h=c.jsx("span",{"data-slate-node":"text",id:d,key:o.id},f);return Cc(function(){var t=Xc(d);null!=t&&(Rs.set(o,t),Ms.set(e,t),Ns.set(t,e))}),h}function cg(e,n,r,o){return Cs.set(e,n),ks.set(e,r),t.Element.isElement(e)?ag(e,o):lg(e,r,o)}var fg=["props","attrs","style","dataset","on","hook"];function dg(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(!fg.includes(t)){if(t.startsWith("data-")){var a=t.slice(5);return a=f(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&&dg(e)})}function hg(e,n){var r,i,a=e.$scroll,s=(r=e.id,"w-e-textarea-".concat(r)),u=n.getConfig(),l=u.readOnly,f=u.autoFocus,d=function(e,t){return void 0===t&&(t=!1),c.h("div#".concat(e),{props:{contentEditable:!t}})}(s,l),h=n.children||[];d.children=h.map(function(e,r){if(Ss.has(e)){var o=Ss.get(e);if(o){var i=lo(o,2),a=i[0],s=i[1];if(s)return a!==r&&(Cs.set(e,r),Ss.set(e,[r,s])),s}}var u=cg(e,r,n,n);dg(u);var l=n.getConfig().skipCacheTypes,c=void 0===l?["list-item"]:l;return t.Element.isElement(e)&&c.includes(e.type)||Ss.set(e,[r,u]),u});var p=ws.get(e);if(null==p&&(p=!0),p){var g=function(e){return o('<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>'))}(s);a.append(g),e.$textArea=g,i=g[0],(m=c.init([c.classModule,c.propsModule,c.styleModule,c.datasetModule,c.eventListenersModule,c.attributesModule]))(i,d),ws.set(e,!1),xs.set(e,m)}else{var v=Es.get(e),m=xs.get(e);if(null==v||null==m)return;i=v.elm,m(v,d)}if(null!=i||null!=(i=Xc(s))){if((p?f:n.isFocused())&&i.focus({preventScroll:!0}),p){var y=Hc(i);y&&Ps.set(n,y)}Ts.set(n,i),Ms.set(n,i),Ns.set(i,n),Es.set(e,d)}}var pg=1,gg=function(){function e(e){var n=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=pg++,this.$textArea=null,this.$progressBar=o('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=o('<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 r=Vc(null==e?void 0:e.target)?e.target:null,o=null==r?void 0:r.tagName;if("INPUT"!==o&&"TEXTAREA"!==o){var i=n.getActiveEditor();null!=i&&function(e,n){var r=e.isComposing,o=e.isUpdatingSelection,i=e.isDraggingInternally,a=n.getConfig();if(!o&&!i){var s=Gf.findDocumentOrShadowRoot(n),u=s.activeElement,l=Gf.toDOMNode(n,n),c=s.getSelection();if(u!==l)return Ds.delete(n),void Hp(n);if(e.latestElement=u,Ds.set(n,!0),!c)return Hp(n);var f=c.anchorNode,d=c.focusNode,h=Ap(n,f),p=Dp(n,d);if(!r)if(h&&p){var g=Gf.toSlateRange(n,c,{exactMatch:!1,suppressThrow:!0});g&&t.Transforms.select(n,g)}else a.readOnly&&Hp(n)}}(n,i)}},100);var r=o(e);if(0===r.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=r;var i=o('<div class="w-e-text-container"></div>');i.append(this.$progressBar),i.append(this.$maxLengthInfo),r.append(i);var a=o('<div class="w-e-scroll"></div>');i.append(a),this.$scroll=a,this.$textAreaContainer=i,Cc(function(){var e=n.getActiveEditor();if(null!=e){n.bindSelectionChange(e),i.on("click",function(){return e.hidePanelOrModal()}),e.on(Ya,n.changeViewState.bind(n));var t=e.getConfig(),o=t.onChange,a=t.scroll;o&&e.on(Ya,function(){return o(e)}),a||(r.css("position","relative"),i.addClass("no-scroll")),n.onFocusAndOnBlur(),e.on(Ya,n.changeMaxLengthInfo.bind(n)),n.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=fs.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=fs.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=Gf.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(Ga,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(tg,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(Xa)},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(Ya,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-Gf.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&&(hg(this,t),function(e,t){var n,r=t.getConfig().placeholder;if(r){var i=t.isEmpty();if(i&&!e.showPlaceholder&&!e.isComposing){if(null==e.$placeholder){var a=o('<div class="w-e-text-placeholder">'.concat(r,"</div>"));e.$textAreaContainer.append(a),e.$placeholder=a}return e.$placeholder.show(),void(e.showPlaceholder=!0)}!i&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1)}}(this,t),Cc(function(){e.destroyed||t.isDestroyed||Up(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 vg(e,n,r,o){if(Cs.set(e,n),ks.set(e,r),t.Element.isElement(e)){var i=e.children;if((void 0===i?[]:i).forEach(function(t,n){return vg(t,n,e,o)}),t.Editor.isVoid(o,e)){var a=lo(t.Node.texts(e),1),s=lo(a[0],1)[0];Cs.set(s,0),ks.set(s,e)}}}var mg,yg,bg,wg,xg,Eg={};function Sg(){if(wg)return bg;wg=1;var e=Fe(),t=TypeError;return bg=function(n,r){if(!delete n[r])throw new t("Cannot delete property "+e(r)+" of "+e(n))}}!function(){if(xg)return Eg;xg=1;var e=Qn(),t=mt(),n=Nn(),r=Tn(),o=Mn(),i=function(){if(yg)return mg;yg=1;var e=M(),t=Fr(),n=TypeError,r=Object.getOwnPropertyDescriptor,o=e&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();return mg=o?function(e,o){if(t(e)&&!r(e,"length").writable)throw new n("Cannot set read only .length");return e.length=o}:function(e,t){return e.length=t}}(),a=no(),s=Wr(),u=ro(),l=Sg(),c=oo()("splice"),f=Math.max,d=Math.min;e({target:"Array",proto:!0,forced:!c},{splice:function(e,c){var h,p,g,v,m,y,b=t(this),w=o(b),x=n(e,w),E=arguments.length;for(0===E?h=p=0:1===E?(h=0,p=w-x):(h=E-2,p=d(f(r(c),0),w-x)),a(w+h-p),g=s(b,p),v=0;v<p;v++)(m=x+v)in b&&u(g,v,b[m]);if(g.length=p,h<p){for(v=x;v<w-p;v++)y=v+h,(m=v+p)in b?b[y]=b[m]:l(b,y);for(v=w;v>w-p+h;v--)l(b,v-1)}else if(h>p)for(v=w-p;v>x;v--)y=v+h-1,(m=v+p-1)in b?b[y]=b[m]:l(b,y);for(v=0;v<h;v++)b[v+x]=arguments[v+2];return i(b,w-p+h),g}})}();var Og=function(){function e(e,t){var n=this;this.$toolbar=o('<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=s(function(){n.syncToolbarState()},200),this.config=t;var r=o(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '".concat(e,"'"));this.$box=r;var i=this.$toolbar;i.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),r.append(i),Cc(function(){n.initToolbar(),n.lngListen=fp(function(){return n.initToolbar()});var e=n.getEditorInstance();e.on(Ya,n.changeToolbarState),e.on(Qa,n.syncToolbarState),e.on(Za,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="",r=this.$toolbar,o=this.config,i=o.toolbarKeys,a=void 0===i?[]:i,s=o.insertKeys,u=void 0===s?{index:0,keys:[]}:s,l=o.excludeKeys,c=void 0===l?[]:l,f=n(a),d=[];d=Array.isArray(u)?u:[u];var h=0;d.forEach(function(e){var t=e.index+h;if(e.replaceFn&&f[t]){var n=e.replaceFn(f[t]);if(!n)throw new Error("This function needs to return the menu configuration:string | IMenuGroup");f[t]=n}e.keys.length>0&&("string"==typeof e.keys&&(e.keys=[e.keys]),e.keys.forEach(function(e,n){f.splice(t+n,0,e)}),h+=e.keys.length)});var p=f.filter(function(e){var t="string"==typeof e?e:e.key;return!c.includes(t)}),g=p.length;p.forEach(function(n,o){if("|"===n){if(0===o)return;if(o+1===g)return;if("|"===t)return;var i=gp();return r.append(i),void(t=n)}if("string"==typeof n)return e.registerSingleItem(n,e),void(t=n);e.registerGroup(n),t="group"})},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new kp(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){var n=this.getEditorInstance(),r=t instanceof kp,o=this.menus,i=o[e];if(null==i){var a=ns[e];if(null==a)throw new Error("Not found menu item factory by key '".concat(e,"'"));if("function"!=typeof a)throw new Error("Menu item factory (key='".concat(e,"') is not a function"));i=a(),o[e]=i}else console.warn("Duplicated toolbar menu key '".concat(e,"'\n重复注册了菜单栏 menu '").concat(e,"'"));var s=n.getMenuConfig(e);s&&void 0!==s.iconSvg&&(i.iconSvg=s.iconSvg);var u=Rp(e,i,r);(this.toolbarItems.push(u),vs.set(u,n),r)?t.appendBarItem(u):t.$toolbar.append(u.$elem)},e.prototype.getEditorInstance=function(){var e=ds.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}();function Cg(e){return e||{name:""}}function kg(e){var t=e.server,n=void 0===t?"":t,o=e.fieldName,i=void 0===o?"":o,a=e.maxFileSize,s=void 0===a?10485760:a,u=e.maxNumberOfFiles,l=void 0===u?100:u,c=e.meta,f=void 0===c?{}:c,p=e.metaWithUrl,g=void 0!==p&&p,v=e.headers,m=void 0===v?{}:v,y=e.withCredentials,b=void 0!==y&&y,w=e.timeout,x=void 0===w?1e4:w,E=e.onBeforeUpload,S=void 0===E?function(e){return e}:E,O=e.onSuccess,C=void 0===O?function(e,t){}:O,k=e.onError,T=void 0===k?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:k,N=e.onProgress,R=void 0===N?function(e){}:N;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!i)throw new Error("Cannot get fieldName\n没有配置 fieldName");var M=n;g&&(M=function(e,t){var n=lo(e.split("#"),2),o=n[0],i=n[1],a=[];r(t,function(e,t){a.push("".concat(t,"=").concat(e))});var s=a.join("&");return o=o.indexOf("?")>0?"".concat(o,"&").concat(s):"".concat(o,"?").concat(s),i?"".concat(o,"#").concat(i):o}(M,f));var L=new d(so({onBeforeUpload:function(e){return S(e)},restrictions:{maxFileSize:s,maxNumberOfFiles:l},meta:f},e.uppyConfig)).use(h,so({endpoint:M,headers:m,formData:!0,fieldName:i,bundle:!1,withCredentials:b,timeout:x},e.xhrConfig));return L.on("upload-success",function(e,t){var n=(null!=t?t:{}).body,r=void 0===n?{}:n,o=Cg(e);try{C(o,r)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),L.on("progress",function(e){e<1||R(e)}),L.on("upload-error",function(e,t,n){var r=Cg(e);try{T(r,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),L.on("restriction-failed",function(e,t){var n=Cg(e);try{T(n,t,void 0)}catch(e){console.error("wangEditor upload file - onError error",e)}}),L}e.DOMComment=Mc,e.DOMElement=Lc,e.DOMNode=Rc,e.DOMRange=Dc,e.DOMSelection=Ac,e.DOMStaticRange=Ic,e.DOMText=Pc,e.DomEditor=Gf,e.ELEM_TO_HTML_CONF=Nf,e.PARSE_ELEM_HTML_CONF=gf,e.PARSE_STYLE_HTML_FN_LIST=pf,e.PRE_PARSE_HTML_CONF_LIST=hf,e.RENDER_ELEM_CONF=og,e.RENDER_STYLE_HANDLER_LIST=rg,e.STYLE_TO_HTML_FN_LIST=Tf,e.TEXT_TAGS=df,e.Toolbar=Og,e.coreCreateEditor=function(e){var o=e.selector,i=void 0===o?"":o,a=e.config,s=void 0===a?{}:a,u=e.content,l=e.html,c=e.plugins,f=void 0===c?[]:c,d=function(e){return[uh,Ud,_s,Wd,yh,ah,dh,eo.withHistory].reduce(function(e,t){return t(e)},e)}(t.createEditor());if(i&&function(e,t){return Of(e,"data-w-e-textarea",t)}(d,i))throw new Error("Repeated create editor by selector '".concat(i,"'"));var h=function(e){void 0===e&&(e={});var t=n(qa),o={},i=e.MENU_CONF,a=void 0===i?{}:i;return r(t,function(e,t){o[t]=so(so({},e),a[t]||{})}),delete e.MENU_CONF,so({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return[]},maxLength:0,MENU_CONF:o,hoverbarKeys:{},textStyleMode:"inline",classStylePolicy:"preserve-data",sanitizeHtml:Ka,customAlert:function(e,t){window.alert("".concat(t,":\n").concat(e))}},e)}(s);bs.set(d,h);var p=h.hoverbarKeys,g=void 0===p?{}:p;if(f.forEach(function(e){d=e(d)}),function(e,t){var n=t.html,r=t.content;null!=n?e.children=Cf(e,n):r&&r.length&&(e.children=r),0===e.children.length&&(e.children=[{type:"paragraph",children:[{text:""}]}])}(d,{html:l,content:u}),i){var v=new gg(i);cs.set(d,v),fs.set(v,d),v.changeViewState();var m=void 0;Object.keys(g).length>0&&(m=new Lp,ps.set(m,d),gs.set(d,m)),d.on(Ya,function(){d.hidePanelOrModal()}),d.on(Xa,function(){d.hidePanelOrModal()})}else d.children.forEach(function(e,t){return vg(e,t,d,d)});var y=h.onCreated,b=h.onDestroyed;return y&&d.on(Ja,function(){return y(d)}),b&&d.on(Ga,function(){return b(d)}),Cc(function(){return d.emit(Ja)}),d},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 Of(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '".concat(n,"'"));var i=so({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new Og(n,i);return ds.set(a,e),hs.set(e,a),a},e.createUploader=function(e,t){return e.uploadAdapter?e.uploadAdapter({config:e,editor:t}):kg(e)},e.createUppyUploader=kg,e.genModalButtonElems=function(e,t){var n=o('<div class="button-container"></div>'),r=o('<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=o('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var i=o('<input type="text" id="'.concat(t,'" placeholder="').concat(n||"",'">'));return r.append(i),[r[0],i[0]]},e.genModalTextareaElems=function(e,t,n){var r=o('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var i=o('<textarea type="text" id="'.concat(t,'" placeholder="').concat(n||"",'"></textarea>'));return r.append(i),[r[0],i[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=Hc,e.getEditableChild=Zc,e.getEditableChildAndIndex=Qc,e.getElementById=Xc,e.getFirstVoidChild=tf,e.getPlainText=ef,e.getTagName=rf,e.getTextStyleMode=function(e){return e&&"class"===e.getConfig().textStyleMode?"class":"inline"},e.hasShadowRoot=Yc,e.i18nAddResources=function(e,t){lp.addResourceBundle(e,cp,t,!0,!0)},e.i18nChangeLanguage=function(e){lp.changeLanguage(e)},e.i18nGetResources=function(e){return lp.getResourceBundle(e,cp)},e.i18nListenLanguage=fp,e.isDOMComment=zc,e.isDOMElement=Vc,e.isDOMNode=Uc,e.isDOMSelection=Kc,e.isDOMText=qc,e.isDataTransfer=Fc,e.isDocument=jc,e.isHTMLElememt=Wc,e.isPlainTextOnlyPaste=Jc,e.isShadowRoot=$c,e.isUnprocessedListElement=Bc,e.normalizeDOMPoint=Gc,e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;Nf[t||""]=n},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=so(so({},o),t||{});if(null!=ns[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));ns[n]=r,function(e,t){null!=t&&(qa[e]=t)}(n,i)},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;gf[t]=n},e.registerParseStyleHtmlHandler=function(e){pf.push(e)},e.registerPreParseHtmlConf=function(e){hf.push(e)},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;og[t||""]=n},e.registerStyleHandler=function(e){rg.push(e)},e.registerStyleToHtmlHandler=function(e){Tf.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=dp,e.walkTextNodes=nf});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("nanoid/non-secure"),require("lodash.throttle"),require("lodash.foreach"),require("nanoid"),require("slate"),require("lodash.clonedeep"),require("dom7"),require("lodash.toarray"),require("lodash.debounce"),require("is-hotkey"),require("snabbdom"),require("lodash.camelcase")):"function"==typeof define&&define.amd?define(["exports","nanoid/non-secure","lodash.throttle","lodash.foreach","nanoid","slate","lodash.clonedeep","dom7","lodash.toarray","lodash.debounce","is-hotkey","snabbdom","lodash.camelcase"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WangEditorCore={},e.nonSecure,e.throttle,e.forEach,null,e.require$$0$2,e.cloneDeep,e.$$1,e.toArray,e.debounce,e.isHotkey,e.snabbdom,e.camelCase)}(this,function(e,t,n,r,o,i,s,a,l,u,c,d,h){"use strict";function p(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var f=function(e,t){return f=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])},f(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}f(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),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.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 s}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){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function E(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}"function"==typeof SuppressedError&&SuppressedError;var x,S,_,O={exports:{}},k={};function C(){if(_)return k;_=1,Object.defineProperty(k,"__esModule",{value:!0}),k.justErrorsLogger=k.debugLogger=void 0;const e=function(){if(S)return x;function e(e){return e<10?`0${e}`:e.toString()}return S=1,x=function(){const t=new Date;return`${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`}}(),t={debug:()=>{},warn:()=>{},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};k.justErrorsLogger=t;const n={debug:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.debug(`[Uppy] [${e()}]`,...n)},warn:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.warn(`[Uppy] [${e()}]`,...n)},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.error(`[Uppy] [${e()}]`,...n)}};return k.debugLogger=n,k}var T,N,P,R,M,L,$,D,F,A,j,I,U,B,H,z,W,V,q,K,J,G,X,Y,Q,Z,ee,te,ne,re,oe,ie=E(p(t)),se={};function ae(){return N?T:(N=1,T=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/Math.pow(1024,r));var o=n[r];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+o:(t?"-":"")+e.toFixed(1)+" "+o})}function le(){if(R)return P;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return R=1,e.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t<i;t++)"*"!==o[t]&&(r=t<n.length&&o[t]===n[t]);r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var s in r={},e)this.match(s)&&(r[s]=e[s]);return r},P=function(t,n,r){var o=new e(t,r||/[\/\.]/);return void 0!==n?o.match(n):o}}function ue(){if($)return se;$=1,Object.defineProperty(se,"__esModule",{value:!0}),se.defaultOptions=se.RestrictionError=se.Restricter=void 0;const e=ae(),t=function(){if(L)return M;L=1;var e=le(),t=/[\/\+\.]/;return M=function(n,r){function o(r){var o=e(r,n,t);return o&&o.length>=2}return r?o(r.split(";")[0]):o}}();se.defaultOptions={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class n extends Error{constructor(){super(...arguments),this.isRestriction=!0}}se.RestrictionError=n,"undefined"==typeof AggregateError&&(globalThis.AggregateError=class extends Error{constructor(e,t){super(t),this.errors=e}});return se.Restricter=class{constructor(e,t){this.i18n=t,this.getOpts=()=>{const t=e();if(null!=t.restrictions.allowedFileTypes&&!Array.isArray(t.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return t}}validate(r,o){const{maxFileSize:i,minFileSize:s,maxTotalFileSize:a,maxNumberOfFiles:l,allowedFileTypes:u}=this.getOpts().restrictions;if(l){const e=o.filter(e=>!e.isGhost);if(e.length+1>l)throw new n(`${this.i18n("youCanOnlyUploadX",{smart_count:l})}`)}if(u){if(!u.some(e=>e.includes("/")?!!r.type&&t(r.type.replace(/;.*?$/,""),e):!("."!==e[0]||!r.extension)&&r.extension.toLowerCase()===e.slice(1).toLowerCase())){const e=u.join(", ");throw new n(this.i18n("youCanOnlyUploadFileTypes",{types:e}))}}if(a&&null!=r.size){const t=o.reduce((e,t)=>e+t.size,r.size);if(t>a)throw new n(this.i18n("exceedsSize",{size:e(a),file:r.name}))}if(i&&null!=r.size&&r.size>i)throw new n(this.i18n("exceedsSize",{size:e(i),file:r.name}));if(s&&null!=r.size&&r.size<s)throw new n(this.i18n("inferiorSize",{size:e(s)}))}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(Object.keys(e).length<t)throw new n(this.i18n("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new n(this.i18n("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:r}=this.getOpts().restrictions,o=Object.prototype.hasOwnProperty,i=[];for(const t of r)o.call(e.meta,t)&&""!==e.meta[t]||i.push(t);return{missingFields:i,error:t}}},se}function ce(){if(F)return D;return F=1,D=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}function de(){if(j)return A;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}j=1;var t=0;function n(e){return"__private_"+t+++"_"+e}const r=ce();function o(e,t,n){const r=[];return e.forEach(e=>"string"!=typeof e?r.push(e):t[Symbol.split](e).forEach((e,t,o)=>{""!==e&&r.push(e),t<o.length-1&&r.push(n)})),r}
|
|
2
|
+
/**
|
|
3
|
+
* Takes a string with placeholder variables like `%{smart_count} file selected`
|
|
4
|
+
* and replaces it with values from options `{smart_count: 5}`
|
|
5
|
+
*
|
|
6
|
+
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
|
|
7
|
+
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
|
|
8
|
+
*
|
|
9
|
+
* @param {string} phrase that needs interpolation, with placeholders
|
|
10
|
+
* @param {object} options with values that will be used to replace placeholders
|
|
11
|
+
* @returns {any[]} interpolated
|
|
12
|
+
*/function i(e,t){const n=/\$/g;let r=[e];if(null==t)return r;for(const e of Object.keys(t))if("_"!==e){let i=t[e];"string"==typeof i&&(i=n[Symbol.replace](i,"$$$$")),r=o(r,new RegExp(`%\\{${e}\\}`,"g"),i)}return r}var s=n("apply");function a(e){if(null==e||!e.strings)return;const t=this.locale;this.locale={...t,strings:{...t.strings,...e.strings}},this.locale.pluralize=e.pluralize||t.pluralize}return A=class{constructor(t){Object.defineProperty(this,s,{value:a}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(t)?t.forEach(e(this,s)[s],this):e(this,s)[s](t)}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){if(!r(this.locale.strings,e))throw new Error(`missing string: ${e}`);const n=this.locale.strings[e];if("object"==typeof n){if(t&&void 0!==t.smart_count){return i(n[this.locale.pluralize(t.smart_count)],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}return i(n,t)}},A}function he(){return U||(U=1,I=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,s,a){var l=function(e){var n=t[e]?t[e]:[],r=e.indexOf(":"),o=-1===r?[e]:[e.substring(0,r),e.substring(r+1)],i=Object.keys(t),s=0,a=i.length;for(;s<a;s++){var l=i[s];if("*"===l&&(n=n.concat(t[l])),2===o.length&&o[0]===l){n=n.concat(t[l]);break}}return n}(e);l.length&&function(e,t,n){var r=0,o=t.length;for(;r<o&&t[r];r++)t[r].event=e,t[r].apply(t[r],n)}(e,l,[n,r,o,i,s,a])},e.on=function(e,n){t[e]||(t[e]=[]),t[e].push(n)},e.once=function(t,n){this.on(t,function r(){n.apply(this,arguments),e.off(t,r)})},e.off=function(e,t){var n=[];if(e&&t)for(var r=this._fns[e],o=0,i=r?r.length:0;o<i;o++)r[o]!==t&&n.push(r[o]);n.length?this._fns[e]=n:delete this._fns[e]},e}),I}function pe(){if(H)return B;H=1;var e=0;function t(t){return"__private_"+e+++"_"+t}var n=t("publish");class r{constructor(){Object.defineProperty(this,n,{value:o}),this.state={},this.callbacks=[]}getState(){return this.state}setState(e){const t={...this.state},r={...this.state,...e};this.state=r,function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(this,n)[n](t,r,e)}subscribe(e){return this.callbacks.push(e),()=>{this.callbacks.splice(this.callbacks.indexOf(e),1)}}}function o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.callbacks.forEach(e=>{e(...t)})}return r.VERSION="2.1.1",B=function(){return new r}}function fe(){if(W)return z;return W=1,z=function(e){const t=e.lastIndexOf(".");return-1===t||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}}function ge(){return q?V:(q=1,V={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"})}function ve(){if(oe)return re;oe=1;var e=ie,t=C(),r=ue();let o,i;function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var a=0;function l(e){return"__private_"+a+++"_"+e}const u=de(),c=he(),d=n,h=pe(),p=function(){if(J)return K;J=1;const e=fe(),t=ge();return K=function(n){var r;if(n.type)return n.type;const o=n.name?null==(r=e(n.name).extension)?void 0:r.toLowerCase():null;return o&&o in t?t[o]:"application/octet-stream"}}(),f=fe(),g=function(){if(X)return G;function e(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}return X=1,G=function(t){let n="uppy";return"string"==typeof t.name&&(n+=`-${e(t.name.toLowerCase())}`),void 0!==t.type&&(n+=`-${t.type}`),t.meta&&"string"==typeof t.meta.relativePath&&(n+=`-${e(t.meta.relativePath.toLowerCase())}`),void 0!==t.data.size&&(n+=`-${t.data.size}`),void 0!==t.data.lastModified&&(n+=`-${t.data.lastModified}`),n}}(),v=(Q||(Q=1,Y=function(e){if(null==e&&"undefined"!=typeof navigator&&(e=navigator.userAgent),!e)return!0;const t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;const n=t[1];let[r,o]=n.split(".");return r=parseInt(r,10),o=parseInt(o,10),r<15||15===r&&o<15063||r>18||18===r&&o>=18218}),Y),m=ee?Z:(ee=1,Z=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}),y=ne?te:(ne=1,te={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",emptyFolderAdded:"No files were added from empty folder",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"}}});var b=l("plugins"),w=l("restricter"),E=l("storeUnsubscribe"),x=l("emitter"),S=l("preProcessors"),_=l("uploaders"),O=l("postProcessors"),k=l("informAndEmit"),T=l("checkRequiredMetaFieldsOnFile"),N=l("checkRequiredMetaFields"),P=l("assertNewUploadAllowed"),R=l("checkAndCreateFileStateObject"),M=l("startIfAutoProceed"),L=l("addListeners"),$=l("updateOnlineStatus"),D=l("createUpload"),F=l("getUpload"),A=l("removeUpload"),j=l("runUpload");o=Symbol.for("uppy test: getPlugins"),i=Symbol.for("uppy test: createUpload");class I{constructor(e){Object.defineProperty(this,j,{value:ce}),Object.defineProperty(this,A,{value:le}),Object.defineProperty(this,F,{value:ae}),Object.defineProperty(this,D,{value:se}),Object.defineProperty(this,L,{value:q}),Object.defineProperty(this,M,{value:V}),Object.defineProperty(this,R,{value:W}),Object.defineProperty(this,P,{value:z}),Object.defineProperty(this,N,{value:H}),Object.defineProperty(this,T,{value:B}),Object.defineProperty(this,k,{value:U}),Object.defineProperty(this,b,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,w,{writable:!0,value:void 0}),Object.defineProperty(this,E,{writable:!0,value:void 0}),Object.defineProperty(this,x,{writable:!0,value:c()}),Object.defineProperty(this,S,{writable:!0,value:new Set}),Object.defineProperty(this,_,{writable:!0,value:new Set}),Object.defineProperty(this,O,{writable:!0,value:new Set}),Object.defineProperty(this,$,{writable:!0,value:this.updateOnlineStatus.bind(this)}),this.defaultLocale=y;const n={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,allowMultipleUploadBatches:!0,debug:!1,restrictions:r.defaultOptions,meta:{},onBeforeFileAdded:e=>e,onBeforeUpload:e=>e,store:h(),logger:t.justErrorsLogger,infoTimeout:5e3};this.opts={...n,...e,restrictions:{...n.restrictions,...e&&e.restrictions}},e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=t.debugLogger),this.log(`Using Core v${this.constructor.VERSION}`),this.i18nInit(),this.calculateProgress=d(this.calculateProgress.bind(this),500,{leading:!0,trailing:!0}),this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},allowNewUpload:!0,capabilities:{uploadProgress:v(),individualCancellation:!0,resumableUploads:!1},totalProgress:0,meta:{...this.opts.meta},info:[],recoveredState:null}),s(this,w)[w]=new r.Restricter(()=>this.opts,this.i18n),s(this,E)[E]=this.store.subscribe((e,t,n)=>{this.emit("state-update",e,t,n),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),s(this,L)[L]()}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];s(this,x)[x].emit(e,...n)}on(e,t){return s(this,x)[x].on(e,t),this}once(e,t){return s(this,x)[x].once(e,t),this}off(e,t){return s(this,x)[x].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}get state(){return this.getState()}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.setState({files:{...this.getState().files,[e]:{...this.getState().files[e],...t}}})}i18nInit(){const e=new u([this.defaultLocale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.locale=e.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e&&e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(e=>{e.setOptions()}),this.setState()}resetProgress(){const e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},n={};Object.keys(t).forEach(r=>{const o={...t[r]};o.progress={...o.progress,...e},n[r]=o}),this.setState({files:n,totalProgress:0}),this.emit("reset-progress")}addPreProcessor(e){s(this,S)[S].add(e)}removePreProcessor(e){return s(this,S)[S].delete(e)}addPostProcessor(e){s(this,O)[O].add(e)}removePostProcessor(e){return s(this,O)[O].delete(e)}addUploader(e){s(this,_)[_].add(e)}removeUploader(e){return s(this,_)[_].delete(e)}setMeta(e){const t={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(t=>{n[t]={...n[t],meta:{...n[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:n})}setFileMeta(e,t){const n={...this.getState().files};if(!n[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const r={...n[e].meta,...t};n[e]={...n[e],meta:r},this.setState({files:n})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:n}=this.getState(),r=Object.values(e),o=r.filter(e=>{let{progress:t}=e;return!t.uploadComplete&&t.uploadStarted}),i=r.filter(e=>!e.progress.uploadStarted),s=r.filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess),a=r.filter(e=>e.progress.uploadStarted),l=r.filter(e=>e.isPaused),u=r.filter(e=>e.progress.uploadComplete),c=r.filter(e=>e.error),d=o.filter(e=>!e.isPaused),h=r.filter(e=>e.progress.preprocess||e.progress.postprocess);return{newFiles:i,startedFiles:s,uploadStartedFiles:a,pausedFiles:l,completeFiles:u,erroredFiles:c,inProgressFiles:o,inProgressNotPausedFiles:d,processingFiles:h,isUploadStarted:a.length>0,isAllComplete:100===t&&u.length===r.length&&0===h.length,isAllErrored:!!n&&c.length===r.length,isAllPaused:0!==o.length&&l.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:r.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{return s(this,w)[w].validate(e,t),{result:!0}}catch(e){return{result:!1,reason:e.message}}}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){s(this,P)[P](e);const{files:t}=this.getState();let n=s(this,R)[R](t,e);return t[n.id]&&t[n.id].isGhost&&(n={...t[n.id],data:e.data,isGhost:!1},this.log(`Replaced the blob in the restored ghost file: ${n.name}, ${n.id}`)),this.setState({files:{...t,[n.id]:n}}),this.emit("file-added",n),this.emit("files-added",[n]),this.log(`Added file: ${n.name}, ${n.id}, mime type: ${n.type}`),s(this,M)[M](),n.id}addFiles(e){s(this,P)[P]();const t={...this.getState().files},n=[],r=[];for(let o=0;o<e.length;o++)try{let r=s(this,R)[R](t,e[o]);t[r.id]&&t[r.id].isGhost&&(r={...t[r.id],data:e[o].data,isGhost:!1},this.log(`Replaced blob in a ghost file: ${r.name}, ${r.id}`)),t[r.id]=r,n.push(r)}catch(e){e.isRestriction||r.push(e)}if(this.setState({files:t}),n.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",n),n.length>5?this.log(`Added batch of ${n.length} files`):Object.keys(n).forEach(e=>{this.log(`Added file: ${n[e].name}\n id: ${n[e].id}\n type: ${n[e].type}`)}),n.length>0&&s(this,M)[M](),r.length>0){let e="Multiple errors occurred while adding files:\n";if(r.forEach(t=>{e+=`\n * ${t.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:r.length}),details:e},"error",this.opts.infoTimeout),"function"==typeof AggregateError)throw new AggregateError(r,e);{const t=new Error(e);throw t.errors=r,t}}}removeFiles(e,t){const{files:n,currentUploads:r}=this.getState(),o={...n},i={...r},s=Object.create(null);function a(e){return void 0===s[e]}e.forEach(e=>{n[e]&&(s[e]=n[e],delete o[e])}),Object.keys(i).forEach(e=>{const t=r[e].fileIDs.filter(a);if(0===t.length)return void delete i[e];const{capabilities:n}=this.getState();if(t.length!==r[e].fileIDs.length&&!n.individualCancellation)throw new Error("individualCancellation is disabled");i[e]={...r[e],fileIDs:t}});const l={currentUploads:i,files:o};0===Object.keys(o).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const u=Object.keys(s);u.forEach(e=>{this.emit("file-removed",s[e],t)}),u.length>5?this.log(`Removed ${u.length} files`):this.log(`Removed files: ${u.join(", ")}`)}removeFile(e,t){void 0===t&&(t=null),this.removeFiles([e],t)}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).uploadComplete)return;const t=!(this.getFile(e).isPaused||!1);return this.setFileState(e,{isPaused:t}),this.emit("upload-pause",e,t),t}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const n={...e[t],isPaused:!0};e[t]=n}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e}),this.emit("resume-all")}retryAll(){const e={...this.getState().files},t=Object.keys(e).filter(t=>e[t].error);if(t.forEach(t=>{const n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const n=s(this,D)[D](t,{forceAllowNewUpload:!0});return s(this,j)[j](n)}cancelAll(e){let{reason:t="user"}=void 0===e?{}:e;if(this.emit("cancel-all",{reason:t}),"user"===t){const{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t,"cancel-all"),this.setState({totalProgress:0,error:null,recoveredState:null})}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=s(this,D)[D]([e],{forceAllowNewUpload:!0});return s(this,j)[j](t)}reset(){this.cancelAll(...arguments)}logout(){this.iteratePlugins(e=>{e.provider&&e.provider.logout&&e.provider.logout()})}calculateProgress(e,t){if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const n=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:n?Math.round(t.bytesUploaded/t.bytesTotal*100):0}}),this.calculateTotalProgress()}calculateTotalProgress(){const e=this.getFiles().filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess);if(0===e.length)return this.emit("progress",0),void this.setState({totalProgress:0});const t=e.filter(e=>null!=e.progress.bytesTotal),n=e.filter(e=>null==e.progress.bytesTotal);if(0===t.length){const t=100*e.length,r=n.reduce((e,t)=>e+t.progress.percentage,0),o=Math.round(r/t*100);return void this.setState({totalProgress:o})}let r=t.reduce((e,t)=>e+t.progress.bytesTotal,0);const o=r/t.length;r+=o*n.length;let i=0;t.forEach(e=>{i+=e.progress.bytesUploaded}),n.forEach(e=>{i+=o*(e.progress.percentage||0)/100});let s=0===r?0:Math.round(i/r*100);s>100&&(s=100),this.setState({totalProgress:s}),this.emit("progress",s)}updateOnlineStatus(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e,t){if("function"!=typeof e){throw new TypeError(`Expected a plugin class, but got ${null===e?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`)}const n=new e(this,t),r=n.id;if(!r)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");const o=this.getPlugin(r);if(o){const e=`Already found a plugin named '${o.id}'. Tried to use: '${r}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${r} v${e.VERSION}`),n.type in s(this,b)[b]?s(this,b)[b][n.type].push(n):s(this,b)[b][n.type]=[n],n.install(),this}getPlugin(e){for(const t of Object.values(s(this,b)[b])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[o](e){return s(this,b)[b][e]}iteratePlugins(e){Object.values(s(this,b)[b]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=s(this,b)[b][e.type],n=t.findIndex(t=>t.id===e.id);-1!==n&&t.splice(n,1);const r={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(r)}close(e){let{reason:t}=void 0===e?{}:e;this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll({reason:t}),s(this,E)[E](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",s(this,$)[$]),window.removeEventListener("offline",s(this,$)[$]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,n){void 0===t&&(t="info"),void 0===n&&(n=3e3);const r="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:r?e.message:e,details:r?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,t){const{logger:n}=this.opts;switch(t){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e)}}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?s(this,j)[j](e):(s(this,A)[A](e),Promise.reject(new Error("Nonexistent upload")))}[i](){return s(this,D)[D](...arguments)}addResultData(e,t){if(!s(this,F)[F](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:n}=this.getState(),r={...n[e],result:{...n[e].result,...t}};this.setState({currentUploads:{...n,[e]:r}})}upload(){var e;null!=(e=s(this,b)[b].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const n=this.opts.onBeforeUpload(t);return!1===n?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(n&&"object"==typeof n&&(t=n,this.setState({files:t})),Promise.resolve().then(()=>s(this,w)[w].validateMinNumberOfFiles(t)).catch(e=>{throw s(this,k)[k](e),e}).then(()=>{if(!s(this,N)[N](t))throw new r.RestrictionError(this.i18n("missingRequiredMetaField"))}).catch(e=>{throw e}).then(()=>{const{currentUploads:e}=this.getState(),n=Object.values(e).flatMap(e=>e.fileIDs),r=[];Object.keys(t).forEach(e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==n.indexOf(e)||r.push(t.id)});const o=s(this,D)[D](r);return s(this,j)[j](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function U(e,t){const{message:n,details:r=""}=e;e.isRestriction?this.emit("restriction-failed",t,e):this.emit("error",e),this.info({message:n,details:r},"error",this.opts.infoTimeout),this.log(`${n} ${r}`.trim(),"error")}function B(e){const{missingFields:t,error:n}=s(this,w)[w].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(n.message),this.emit("restriction-failed",e,n),!1)}function H(e){let t=!0;for(const n of Object.values(e))s(this,T)[T](n)||(t=!1);return t}function z(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new r.RestrictionError(this.i18n("noMoreFilesAllowed"));throw s(this,k)[k](t,e),t}}function W(e,t){const n=p(t),o=m(n,t),i=f(o).extension,a=Boolean(t.isRemote),l=g({...t,type:n});if(this.checkIfFileAlreadyExists(l)){const e=new r.RestrictionError(this.i18n("noDuplicates",{fileName:o}));throw s(this,k)[k](e,t),e}const u=t.meta||{};u.name=o,u.type=n;const c=Number.isFinite(t.data.size)?t.data.size:null;let d={source:t.source||"",id:l,name:o,extension:i||"",meta:{...this.getState().meta,...u},type:n,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:c,uploadComplete:!1,uploadStarted:null},size:c,isRemote:a,remote:t.remote||"",preview:t.preview};const h=this.opts.onBeforeFileAdded(d,e);if(!1===h){const e=new r.RestrictionError("Cannot add the file because onBeforeFileAdded returned false.");throw this.emit("restriction-failed",t,e),e}"object"==typeof h&&null!==h&&(d=h);try{const t=Object.keys(e).map(t=>e[t]);s(this,w)[w].validate(d,t)}catch(e){throw s(this,k)[k](e,d),e}return d}function V(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}function q(){const e=(e,t,n)=>{let r=e.message||"Unknown error";e.details&&(r+=` ${e.details}`),this.setState({error:r}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:r,response:n})};this.on("error",e),this.on("upload-error",(t,n,r)=>{if(e(n,t,r),"object"==typeof n&&n.message){const e=new Error(n.message);e.details=n.message,n.details&&(e.details+=` ${n.details}`),e.message=this.i18n("failedToUpload",{file:null==t?void 0:t.name}),s(this,k)[k](e)}else s(this,k)[k](n)}),this.on("upload",()=>{this.setState({error:null})}),this.on("upload-started",e=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("upload-progress",this.calculateProgress),this.on("upload-success",(e,t)=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const n=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...n,postprocess:s(this,O)[O].size>0?{mode:"indeterminate"}:null,uploadComplete:!0,percentage:100,bytesUploaded:n.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||n.bytesTotal}),this.calculateTotalProgress()}),this.on("preprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,preprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("preprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.preprocess,this.setState({files:t})}),this.on("postprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getState().files[e.id].progress,postprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("postprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.postprocess,this.setState({files:t})}),this.on("restored",()=>{this.calculateTotalProgress()}),this.on("dashboard:file-edit-complete",e=>{e&&s(this,T)[T](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",s(this,$)[$]),window.addEventListener("offline",s(this,$)[$]),setTimeout(s(this,$)[$],3e3))}function se(t,n){void 0===n&&(n={});const{forceAllowNewUpload:r=!1}=n,{allowNewUpload:o,currentUploads:i}=this.getState();if(!o&&!r)throw new Error("Cannot create a new upload: already uploading.");const s=(0,e.nanoid)();return this.emit("upload",{id:s,fileIDs:t}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...i,[s]:{fileIDs:t,step:0,result:{}}}}),s}function ae(e){const{currentUploads:t}=this.getState();return t[e]}function le(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function ce(e){let{currentUploads:t}=this.getState(),n=t[e];const r=n.step||0,o=[...s(this,S)[S],...s(this,_)[_],...s(this,O)[O]];try{for(let i=r;i<o.length&&n;i++){const r=o[i],s={...n,step:i};this.setState({currentUploads:{...t,[e]:s}}),await r(s.fileIDs,e),t=this.getState().currentUploads,n=t[e]}}catch(t){throw s(this,A)[A](e),t}if(n){n.fileIDs.forEach(e=>{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)});const r=n.fileIDs.map(e=>this.getFile(e)),o=r.filter(e=>!e.error),i=r.filter(e=>e.error);await this.addResultData(e,{successful:o,failed:i,uploadID:e}),t=this.getState().currentUploads,n=t[e]}let i;return n&&(i=n.result,this.emit("complete",i),s(this,A)[A](e)),null==i&&this.log(`Not setting result for an upload that has been removed: ${e}`),i}return I.VERSION="2.3.4",re=I}var me,ye,be,we,Ee,xe,Se,_e,Oe,ke,Ce,Te,Ne,Pe={},Re=[],Me=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Le=Array.isArray;function $e(e,t){for(var n in t)e[n]=t[n];return e}function De(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fe(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?me.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return Ae(e,s,r,o,null)}function Ae(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++be:o,__i:-1,__u:0};return null==o&&null!=ye.vnode&&ye.vnode(i),i}function je(e){return e.children}function Ie(e,t){this.props=e,this.context=t}function Ue(e,t){if(null==t)return e.__?Ue(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?Ue(e):null}function Be(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return Be(e)}}function He(e){(!e.__d&&(e.__d=!0)&&Ee.push(e)&&!ze.__r++||xe!=ye.debounceRendering)&&((xe=ye.debounceRendering)||Se)(ze)}function ze(){for(var e,t,n,r,o,i,s,a=1;Ee.length;)Ee.length>a&&Ee.sort(_e),e=Ee.shift(),a=Ee.length,e.__d&&(n=void 0,r=void 0,o=(r=(t=e).__v).__e,i=[],s=[],t.__P&&((n=$e({},r)).__v=r.__v+1,ye.vnode&&ye.vnode(n),Ye(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,i,null==o?Ue(r):o,!!(32&r.__u),s),n.__v=r.__v,n.__.__k[n.__i]=n,Ze(i,n,s),r.__e=r.__=null,n.__e!=o&&Be(n)));ze.__r=0}function We(e,t,n,r,o,i,s,a,l,u,c){var d,h,p,f,g,v,m,y=r&&r.__k||Re,b=t.length;for(l=Ve(n,t,y,l,b),d=0;d<b;d++)null!=(p=n.__k[d])&&(h=-1==p.__i?Pe:y[p.__i]||Pe,p.__i=d,v=Ye(e,p,h,o,i,s,a,l,u,c),f=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&nt(h.ref,null,p),c.push(p.ref,p.__c||f,p)),null==g&&null!=f&&(g=f),(m=!!(4&p.__u))||h.__k===p.__k?l=qe(p,l,e,m):"function"==typeof p.type&&void 0!==v?l=v:f&&(l=f.nextSibling),p.__u&=-7);return n.__e=g,l}function Ve(e,t,n,r,o){var i,s,a,l,u,c=n.length,d=c,h=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?(l=i+h,(s=e.__k[i]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?Ae(null,s,null,null,null):Le(s)?Ae(je,{children:s},null,null,null):null==s.constructor&&s.__b>0?Ae(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,-1!=(u=s.__i=Ke(s,n,l,d))&&(d--,(a=n[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(o>c?h--:o<c&&h++),"function"!=typeof s.type&&(s.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<c;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==r&&(r=Ue(a)),rt(a,a));return r}function qe(e,t,n,r){var o,i;if("function"==typeof e.type){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=qe(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ue(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Ke(e,t,n,r){var o,i,s,a=e.key,l=e.type,u=t[n],c=null!=u&&!(2&u.__u);if(null===u&&null==e.key||c&&a==u.key&&l==u.type)return n;if(r>(c?1:0))for(o=n-1,i=n+1;o>=0||i<t.length;)if(null!=(u=t[s=o>=0?o--:i++])&&!(2&u.__u)&&a==u.key&&l==u.type)return s;return-1}function Je(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||Me.test(t)?n:n+"px"}function Ge(e,t,n,r,o){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Je(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Je(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(Oe,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=ke,e.addEventListener(t,i?Te:Ce,i)):e.removeEventListener(t,i?Te:Ce,i);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Xe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=ke++;else if(t.t<n.u)return;return n(ye.event?ye.event(t):t)}}}function Ye(e,t,n,r,o,i,s,a,l,u){var c,d,h,p,f,g,v,m,y,b,w,E,x,S,_,O,k,C=t.type;if(null!=t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=t.__e=n.__e]),(c=ye.__b)&&c(t);e:if("function"==typeof C)try{if(m=t.props,y="prototype"in C&&C.prototype.render,b=(c=C.contextType)&&r[c.__c],w=c?b?b.props.value:c.__:r,n.__c?v=(d=t.__c=n.__c).__=d.__E:(y?t.__c=d=new C(m,w):(t.__c=d=new Ie(m,w),d.constructor=C,d.render=ot),b&&b.sub(d),d.props=m,d.state||(d.state={}),d.context=w,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),y&&null==d.__s&&(d.__s=d.state),y&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=$e({},d.__s)),$e(d.__s,C.getDerivedStateFromProps(m,d.__s))),p=d.props,f=d.state,d.__v=t,h)y&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),y&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(y&&null==C.getDerivedStateFromProps&&m!==p&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,w),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,w)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,w),y&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(p,f,g)})}if(d.context=w,d.props=m,d.__P=e,d.__e=!1,x=ye.__r,S=0,y){for(d.state=d.__s,d.__d=!1,x&&x(t),c=d.render(d.props,d.state,d.context),_=0;_<d._sb.length;_++)d.__h.push(d._sb[_]);d._sb=[]}else do{d.__d=!1,x&&x(t),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=$e($e({},r),d.getChildContext())),y&&!h&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(p,f)),O=c,null!=c&&c.type===je&&null==c.key&&(O=et(c.props.children)),a=We(e,Le(O)?O:[O],t,n,r,o,i,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,l||null!=i)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__e=a}else{for(k=i.length;k--;)De(i[k]);Qe(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Qe(t);ye.__e(e,t,n)}else null==i&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=tt(n.__e,t,n,r,o,i,s,l,u);return(c=ye.diffed)&&c(t),128&t.__u?void 0:a}function Qe(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Qe)}function Ze(e,t,n){for(var r=0;r<n.length;r++)nt(n[r],n[++r],n[++r]);ye.__c&&ye.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){ye.__e(e,t.__v)}})}function et(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:Le(e)?e.map(et):$e({},e)}function tt(e,t,n,r,o,i,s,a,l){var u,c,d,h,p,f,g,v=n.props,m=t.props,y=t.type;if("svg"==y?o="http://www.w3.org/2000/svg":"math"==y?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!y&&(y?p.localName==y:3==p.nodeType)){e=p,i[u]=null;break}if(null==e){if(null==y)return document.createTextNode(m);e=document.createElementNS(o,y,m.is&&m),a&&(ye.__m&&ye.__m(t,i),a=!1),i=null}if(null==y)v===m||a&&e.data==m||(e.data=m);else{if(i=i&&me.call(e.childNodes),v=n.props||Pe,!a&&null!=i)for(v={},u=0;u<e.attributes.length;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)if(p=v[u],"children"==u);else if("dangerouslySetInnerHTML"==u)d=p;else if(!(u in m)){if("value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m)continue;Ge(e,u,null,p,o)}for(u in m)p=m[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?f=p:"checked"==u?g=p:a&&"function"!=typeof p||v[u]===p||Ge(e,u,p,v[u],o);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),We("template"==t.type?e.content:e,Le(h)?h:[h],t,n,r,"foreignObject"==y?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&Ue(n,0),a,l),null!=i)for(u=i.length;u--;)De(i[u]);a||(u="value","progress"==y&&null==f?e.removeAttribute("value"):null!=f&&(f!==e[u]||"progress"==y&&!f||"option"==y&&f!=v[u])&&Ge(e,u,f,v[u],o),u="checked",null!=g&&g!=e[u]&&Ge(e,u,g,v[u],o))}return e}function nt(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(e){ye.__e(e,n)}}function rt(e,t,n){var r,o;if(ye.unmount&&ye.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||nt(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){ye.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&rt(r[o],t,n||"function"!=typeof e.type);n||De(e.__e),e.__c=e.__=e.__e=void 0}function ot(e,t,n){return this.constructor(e,n)}function it(e,t,n){var r,o,i,s;t==document&&(t=document.documentElement),ye.__&&ye.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,i=[],s=[],Ye(t,e=(!r&&n||t).__k=Fe(je,null,[e]),o||Pe,Pe,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?me.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,s),Ze(i,e,s)}me=Re.slice,ye={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},be=0,we=function(e){return null!=e&&null==e.constructor},Ie.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=$e({},this.state),"function"==typeof e&&(e=e($e({},n),this.props)),e&&$e(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),He(this))},Ie.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),He(this))},Ie.prototype.render=je,Ee=[],Se="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_e=function(e,t){return e.__v.__b-t.__v.__b},ze.__r=0,Oe=/(PointerCapture)$|Capture$/i,ke=0,Ce=Xe(!1),Te=Xe(!0),Ne=0;var st,at,lt,ut,ct,dt,ht,pt,ft,gt,vt,mt=Object.freeze({__proto__:null,Component:Ie,Fragment:je,cloneElement:function(e,t,n){var r,o,i,s,a=$e({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=void 0===t[i]&&null!=s?s[i]:t[i];return arguments.length>2&&(a.children=arguments.length>3?me.call(arguments,2):n),Ae(e.type,a,r||e.key,o||e.ref,null)},createContext:function(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,He(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+Ne++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createElement:Fe,createRef:function(){return{current:null}},h:Fe,hydrate:function e(t,n){it(t,n,e)},get isValidElement(){return we},get options(){return ye},render:it,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(Le(t)?t.some(function(t){e(t,n)}):n.push(t)),n}}),yt=E(mt);function bt(){if(ut)return lt;ut=1;const e=at?st:(at=1,st=function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE});return lt=function(t,n){return void 0===n&&(n=document),"string"==typeof t?n.querySelector(t):e(t)?t:null}}function wt(){if(pt)return ht;pt=1;const e=de();return ht=class{constructor(e,t){void 0===t&&(t={}),this.uppy=e,this.opts=t}getPluginState(){const{plugins:e}=this.uppy.getState();return e[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(),this.i18nInit()}i18nInit(){const t=new e([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.setPluginState()}addTarget(){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}render(){throw new Error("Extend the render method to add your plugin to a DOM element")}update(){}afterUpdate(){}}}function Et(){if(gt)return ft;gt=1;var e=yt;function t(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var n=0;function r(e){return"__private_"+n+++"_"+e}const o=bt(),i=dt?ct:(dt=1,ct=function(e){for(var t;e&&!e.dir;)e=e.parentNode;return null==(t=e)?void 0:t.dir}),s=wt();var a=r("updateUI");class l extends s{constructor(){super(...arguments),Object.defineProperty(this,a,{writable:!0,value:void 0})}mount(n,r){const s=r.id,u=o(n);if(u){this.isTargetDOMEl=!0;const r=document.createElement("div");return r.classList.add("uppy-Root"),t(this,a)[a]=function(e){let t=null,n=null;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=o,t||(t=Promise.resolve().then(()=>(t=null,e(...n)))),t}}(t=>{this.uppy.getPlugin(this.id)&&((0,e.render)(this.render(t),r),this.afterUpdate())}),this.uppy.log(`Installing ${s} to a DOM element '${n}'`),this.opts.replaceTargetContent&&(u.innerHTML=""),(0,e.render)(this.render(this.uppy.getState()),r),this.el=r,u.appendChild(r),r.dir=this.opts.direction||i(r)||"ltr",this.onMount(),this.el}let c;if("object"==typeof n&&n instanceof l)c=n;else if("function"==typeof n){const e=n;this.uppy.iteratePlugins(t=>{t instanceof e&&(c=t)})}if(c)return this.uppy.log(`Installing ${s} to ${c.id}`),this.parent=c,this.el=c.addTarget(r),this.onMount(),this.el;this.uppy.log(`Not installing ${s}`);let d=`Invalid target option given to ${s}.`;throw d+="function"==typeof n?" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":"If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(d)}update(e){var n,r;null!=this.el&&(null==(n=(r=t(this,a))[a])||n.call(r,e))}unmount(){var e;this.isTargetDOMEl&&(null==(e=this.el)||e.remove());this.onUnmount()}onMount(){}onUnmount(){}}return ft=l}var xt,St,_t,Ot,kt,Ct,Tt,Nt,Pt,Rt,Mt=(vt||(vt=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Uppy=t.UIPlugin=t.BasePlugin=void 0,Object.defineProperty(t,"debugLogger",{enumerable:!0,get:function(){return n.debugLogger}});var n=C();e.exports=ve();const r=Et();t.UIPlugin=r;const o=wt();t.BasePlugin=o;const i=ve();t.Uppy=i;const s=Et(),a=wt();i.Uppy=i,i.UIPlugin=s,i.BasePlugin=a,i.debugLogger=n.debugLogger}(O,O.exports)),O.exports),Lt=w(Mt),$t={};function Dt(){if(St)return xt;St=1;class e extends Error{constructor(e,t){void 0===t&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}}return xt=e}function Ft(){if(Rt)return Pt;let e;function t(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Rt=1;var n=0;function r(e){return"__private_"+n+++"_"+e}const o=function(){if(Ot)return _t;Ot=1;const e=Dt();return _t=function(){return fetch(...arguments).catch(t=>{throw"AbortError"===t.name?t:new e(t)})},_t}(),i=function(){if(Ct)return kt;Ct=1;const e=ce();class t extends Error{constructor(t,n){void 0===n&&(n={}),super(t),this.cause=n.cause,this.cause&&e(this.cause,"isNetworkError")&&(this.isNetworkError=this.cause.isNetworkError)}}return kt=t}(),s=function(){if(Nt)return Tt;Nt=1;class e extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}return Tt=e}();async function a(e){if(401===e.status)throw new s;const t=e.json();if(e.status<200||e.status>300){let n=`Failed request with status: ${e.status}. ${e.statusText}`;try{const e=await t;n=e.message?`${n} message: ${e.message}`:n,n=e.requestId?`${n} request-Id: ${e.requestId}`:n}finally{throw new Error(n)}}return t}var l=r("companionHeaders"),u=r("getPostResponseFunc"),c=r("getUrl"),d=r("errorHandler");e=Symbol.for("uppy test: getCompanionHeaders");class h{constructor(e,n){Object.defineProperty(this,d,{value:f}),Object.defineProperty(this,c,{value:p}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:e=>t=>e?t:this.onReceiveResponse(t)}),this.uppy=e,this.opts=n,this.onReceiveResponse=this.onReceiveResponse.bind(this),this.allowedHeaders=["accept","content-type","uppy-auth-token"],this.preflightDone=!1,t(this,l)[l]=null==n?void 0:n.companionHeaders}setCompanionHeaders(e){t(this,l)[l]=e}[e](){return t(this,l)[l]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return(e&&e[t]?e[t]:t).replace(/\/$/,"")}headers(){return Promise.resolve({...h.defaultHeaders,...t(this,l)[l]})}onReceiveResponse(e){const t=this.uppy.getState().companion||{},n=this.opts.companionUrl,{headers:r}=e;return r.has("i-am")&&r.get("i-am")!==t[n]&&this.uppy.setState({companion:{...t,[n]:r.get("i-am")}}),e}preflight(e){return this.preflightDone?Promise.resolve(this.allowedHeaders.slice()):fetch(t(this,c)[c](e),{method:"OPTIONS"}).then(e=>(e.headers.has("access-control-allow-headers")&&(this.allowedHeaders=e.headers.get("access-control-allow-headers").split(",").map(e=>e.trim().toLowerCase())),this.preflightDone=!0,this.allowedHeaders.slice())).catch(e=>(this.uppy.log(`[CompanionClient] unable to make preflight request ${e}`,"warning"),this.preflightDone=!0,this.allowedHeaders.slice()))}preflightAndHeaders(e){return Promise.all([this.preflight(e),this.headers()]).then(e=>{let[t,n]=e;return Object.keys(n).forEach(e=>{t.includes(e.toLowerCase())||(this.uppy.log(`[CompanionClient] excluding disallowed header ${e}`),delete n[e])}),n})}get(e,n){return this.preflightAndHeaders(e).then(n=>o(t(this,c)[c](e),{method:"get",headers:n,credentials:this.opts.companionCookiesRule||"same-origin"})).then(t(this,u)[u](n)).then(a).catch(t(this,d)[d]("get",e))}post(e,n,r){const i="post";return this.preflightAndHeaders(e).then(r=>o(t(this,c)[c](e),{method:i,headers:r,credentials:this.opts.companionCookiesRule||"same-origin",body:JSON.stringify(n)})).then(t(this,u)[u](r)).then(a).catch(t(this,d)[d](i,e))}delete(e,n,r){const i="delete";return this.preflightAndHeaders(e).then(t=>o(`${this.hostname}/${e}`,{method:i,headers:t,credentials:this.opts.companionCookiesRule||"same-origin",body:n?JSON.stringify(n):null})).then(t(this,u)[u](r)).then(a).catch(t(this,d)[d](i,e))}}function p(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}function f(e,n){return r=>{var o;return null!=(o=r)&&o.isAuthError||(r=new i(`Could not ${e} ${t(this,c)[c](n)}`,{cause:r})),Promise.reject(r)}}return h.VERSION="2.2.2",h.defaultHeaders={Accept:"application/json","Content-Type":"application/json","Uppy-Versions":`@uppy/companion-client=${h.VERSION}`},Pt=h}var At,jt,It,Ut,Bt,Ht,zt,Wt,Vt={};function qt(){if(At)return Vt;return At=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.getItem=function(e){return Promise.resolve(localStorage.getItem(e))},Vt.removeItem=function(e){return new Promise(t=>{localStorage.removeItem(e),t()})},Vt.setItem=function(e,t){return new Promise(n=>{localStorage.setItem(e,t),n()})},Vt}function Kt(){if(Wt)return $t;Wt=1,Object.defineProperty($t,"__esModule",{value:!0}),$t.Socket=$t.SearchProvider=$t.RequestClient=$t.Provider=void 0;const e=Ft();$t.RequestClient=e;const t=function(){if(It)return jt;It=1;var e=qt();const t=Ft();return jt=class extends t{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),this.pluginId=this.opts.pluginId,this.tokenKey=`companion-${this.pluginId}-auth-token`,this.companionKeysParams=this.opts.companionKeysParams,this.preAuthToken=null}headers(){return Promise.all([super.headers(),this.getAuthToken()]).then(e=>{let[t,n]=e;const r={};return n&&(r["uppy-auth-token"]=n),this.companionKeysParams&&(r["uppy-credentials-params"]=btoa(JSON.stringify({params:this.companionKeysParams}))),{...t,...r}})}onReceiveResponse(e){e=super.onReceiveResponse(e);const t=this.uppy.getPlugin(this.pluginId),n=t.getPluginState().authenticated?401!==e.status:e.status<400;return t.setPluginState({authenticated:n}),e}setAuthToken(e){return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey,e)}getAuthToken(){return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey)}async ensurePreAuth(){if(this.companionKeysParams&&!this.preAuthToken&&(await this.fetchPreAuthToken(),!this.preAuthToken))throw new Error("Could not load authentication data required for third-party login. Please try again later.")}authUrl(e){void 0===e&&(e={});const t=new URLSearchParams(e);return this.preAuthToken&&t.set("uppyPreAuthToken",this.preAuthToken),`${this.hostname}/${this.id}/connect?${t}`}fileUrl(e){return`${this.hostname}/${this.id}/get/${e}`}async fetchPreAuthToken(){if(this.companionKeysParams)try{const e=await this.post(`${this.id}/preauth/`,{params:this.companionKeysParams});this.preAuthToken=e.token}catch(e){this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${e}`,"warning")}}list(e){return this.get(`${this.id}/list/${e||""}`)}logout(){return this.get(`${this.id}/logout`).then(e=>Promise.all([e,this.uppy.getPlugin(this.pluginId).storage.removeItem(this.tokenKey)])).then(e=>{let[t]=e;return t})}static initPlugin(t,n,r){if(t.type="acquirer",t.files=[],r&&(t.opts={...r,...n}),n.serverUrl||n.serverPattern)throw new Error("`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`");if(n.companionAllowedHosts){const e=n.companionAllowedHosts;if(!("string"==typeof e||Array.isArray(e)||e instanceof RegExp))throw new TypeError(`${t.id}: the option "companionAllowedHosts" must be one of string, Array, RegExp`);t.opts.companionAllowedHosts=e}else/^(?!https?:\/\/).*$/i.test(n.companionUrl)?t.opts.companionAllowedHosts=`https://${n.companionUrl.replace(/^\/\//,"")}`:t.opts.companionAllowedHosts=new URL(n.companionUrl).origin;t.storage=t.opts.storage||e}},jt}();$t.Provider=t;const n=function(){if(Bt)return Ut;Bt=1;const e=Ft();return Ut=class extends e{constructor(e,t){super(e,t),this.provider=t.provider,this.id=this.provider,this.name=this.opts.name||this.id.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),this.pluginId=this.opts.pluginId}fileUrl(e){return`${this.hostname}/search/${this.id}/get/${e}`}search(e,t){return this.get(`search/${this.id}/list?q=${encodeURIComponent(e)}${t?`&${t}`:""}`)}},Ut}();$t.SearchProvider=n;const r=function(){if(zt)return Ht;let e,t;function n(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}zt=1;var r=0;function o(e){return"__private_"+r+++"_"+e}const i=he();var s=o("queued"),a=o("emitter"),l=o("isOpen"),u=o("socket"),c=o("handleMessage");return e=Symbol.for("uppy test: getSocket"),t=Symbol.for("uppy test: getQueued"),Ht=class{constructor(e){Object.defineProperty(this,s,{writable:!0,value:[]}),Object.defineProperty(this,a,{writable:!0,value:i()}),Object.defineProperty(this,l,{writable:!0,value:!1}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:e=>{try{const t=JSON.parse(e.data);this.emit(t.action,t.payload)}catch(e){console.log(e)}}}),this.opts=e,e&&!1===e.autoOpen||this.open()}get isOpen(){return n(this,l)[l]}[e](){return n(this,u)[u]}[t](){return n(this,s)[s]}open(){n(this,u)[u]=new WebSocket(this.opts.target),n(this,u)[u].onopen=()=>{for(n(this,l)[l]=!0;n(this,s)[s].length>0&&n(this,l)[l];){const e=n(this,s)[s].shift();this.send(e.action,e.payload)}},n(this,u)[u].onclose=()=>{n(this,l)[l]=!1},n(this,u)[u].onmessage=n(this,c)[c]}close(){var e;null==(e=n(this,u)[u])||e.close()}send(e,t){n(this,l)[l]?n(this,u)[u].send(JSON.stringify({action:e,payload:t})):n(this,s)[s].push({action:e,payload:t})}on(e,t){n(this,a)[a].on(e,t)}emit(e,t){n(this,a)[a].emit(e,t)}once(e,t){n(this,a)[a].once(e,t)}},Ht}();return $t.Socket=r,$t}var Jt,Gt,Xt,Yt,Qt,Zt,en,tn,nn,rn,on,sn,an,ln,un,cn,dn,hn={};function pn(){if(Jt)return hn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Jt=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.internalRateLimitedQueue=hn.RateLimitedQueue=void 0;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("activeRequests"),o=n("queuedHandlers"),i=n("paused"),s=n("pauseTimer"),a=n("downLimit"),l=n("upperLimit"),u=n("rateLimitingTimer"),c=n("call"),d=n("queueNext"),h=n("next"),p=n("queue"),f=n("dequeue"),g=n("resume"),v=n("increaseLimit");function m(t){e(this,r)[r]+=1;let n,o=!1;try{n=t()}catch(t){throw e(this,r)[r]-=1,t}return{abort:()=>{o||(o=!0,e(this,r)[r]-=1,n(),e(this,d)[d]())},done:()=>{o||(o=!0,e(this,r)[r]-=1,e(this,d)[d]())}}}function y(){queueMicrotask(()=>e(this,h)[h]())}function b(){if(e(this,i)[i]||e(this,r)[r]>=this.limit)return;if(0===e(this,o)[o].length)return;const t=e(this,o)[o].shift(),n=e(this,c)[c](t.fn);t.abort=n.abort,t.done=n.done}function w(t,n){void 0===n&&(n={});const r={fn:t,priority:n.priority||0,abort:()=>{e(this,f)[f](r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},i=e(this,o)[o].findIndex(e=>r.priority>e.priority);return-1===i?e(this,o)[o].push(r):e(this,o)[o].splice(i,0,r),r}function E(t){const n=e(this,o)[o].indexOf(t);-1!==n&&e(this,o)[o].splice(n,1)}hn.RateLimitedQueue=class{constructor(t){Object.defineProperty(this,f,{value:E}),Object.defineProperty(this,p,{value:w}),Object.defineProperty(this,h,{value:b}),Object.defineProperty(this,d,{value:y}),Object.defineProperty(this,c,{value:m}),Object.defineProperty(this,r,{writable:!0,value:0}),Object.defineProperty(this,o,{writable:!0,value:[]}),Object.defineProperty(this,i,{writable:!0,value:!1}),Object.defineProperty(this,s,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:1}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,g,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,v,{writable:!0,value:()=>{if(e(this,i)[i])e(this,u)[u]=setTimeout(e(this,v)[v],0);else{e(this,a)[a]=this.limit,this.limit=Math.ceil((e(this,l)[l]+e(this,a)[a])/2);for(let t=e(this,a)[a];t<=this.limit;t++)e(this,d)[d]();e(this,l)[l]-e(this,a)[a]>3?e(this,u)[u]=setTimeout(e(this,v)[v],2e3):e(this,a)[a]=Math.floor(e(this,a)[a]/2)}}}),this.limit="number"!=typeof t||0===t?1/0:t}run(t,n){return!e(this,i)[i]&&e(this,r)[r]<this.limit?e(this,c)[c](t):e(this,p)[p](t,n)}wrapPromiseFunction(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];let s;const a=new Promise((r,i)=>{s=n.run(()=>{let t,n;try{n=Promise.resolve(e(...o))}catch(e){n=Promise.reject(e)}return n.then(e=>{t?i(t):(s.done(),r(e))},e=>{t?i(t):(s.done(),i(e))}),()=>{t=new Error("Cancelled")}},t)});return a.abort=()=>{s.abort()},a}}resume(){e(this,i)[i]=!1,clearTimeout(e(this,s)[s]);for(let t=0;t<this.limit;t++)e(this,d)[d]()}pause(t){void 0===t&&(t=null),e(this,i)[i]=!0,clearTimeout(e(this,s)[s]),null!=t&&(e(this,s)[s]=setTimeout(e(this,g)[g],t))}rateLimit(t){clearTimeout(e(this,u)[u]),this.pause(t),this.limit>1&&Number.isFinite(this.limit)&&(e(this,l)[l]=this.limit-1,this.limit=e(this,a)[a],e(this,u)[u]=setTimeout(e(this,v)[v],t))}get isPaused(){return e(this,i)[i]}};const x=Symbol("__queue");return hn.internalRateLimitedQueue=x,hn}function fn(){return un?ln:(un=1,ln={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}})}var gn=function(){if(dn)return cn;dn=1;var e=ie,t=Kt(),r=pn();const o=wt(),i=Xt?Gt:(Xt=1,Gt=n(function(e,t,n){const{progress:r,bytesUploaded:o,bytesTotal:i}=t;r&&(e.uppy.log(`Upload progress: ${r}`),e.uppy.emit("upload-progress",n,{uploader:e,bytesUploaded:o,bytesTotal:i}))},300,{leading:!0,trailing:!0})),s=Qt?Yt:(Qt=1,Yt=function(e){const t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e)[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${t}`}),a=en?Zt:(en=1,Zt=function(e){const t=[],n=[];function r(e){t.push(e)}function o(e){n.push(e)}return Promise.all(e.map(e=>e.then(r,o))).then(()=>({successful:t,failed:n}))}),l=function(){if(nn)return tn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}nn=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("emitter"),o=n("events");return tn=class{constructor(t){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,o,{writable:!0,value:[]}),e(this,r)[r]=t}on(t,n){return e(this,o)[o].push([t,n]),e(this,r)[r].on(t,n)}remove(){for(const[t,n]of e(this,o)[o].splice(0))e(this,r)[r].off(t,n)}}}(),u=function(){if(on)return rn;function e(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}on=1;var t=0;function n(e){return"__private_"+t+++"_"+e}var r=n("aliveTimer"),o=n("isDone"),i=n("onTimedOut"),s=n("timeout");return rn=class{constructor(t,n){Object.defineProperty(this,r,{writable:!0,value:void 0}),Object.defineProperty(this,o,{writable:!0,value:!1}),Object.defineProperty(this,i,{writable:!0,value:void 0}),Object.defineProperty(this,s,{writable:!0,value:void 0}),e(this,s)[s]=t,e(this,i)[i]=n}progress(){e(this,o)[o]||e(this,s)[s]>0&&(clearTimeout(e(this,r)[r]),e(this,r)[r]=setTimeout(e(this,i)[i],e(this,s)[s]))}done(){e(this,o)[o]||(clearTimeout(e(this,r)[r]),e(this,r)[r]=null,e(this,o)[o]=!0)}}}(),c=Dt(),d=an?sn:(an=1,sn=function(e){return!!e&&(0!==e.readyState&&4!==e.readyState||0===e.status)}),h=fn();function p(e,t){let n=t;return n||(n=new Error("Upload error")),"string"==typeof n&&(n=new Error(n)),n instanceof Error||(n=Object.assign(new Error("Upload error"),{data:n})),d(e)?(n=new c(n,e),n):(n.request=e,n)}function f(e){return e.data.slice(0,e.data.size,e.meta.type)}class g extends o{constructor(e,t){super(e,t),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.title="XHRUpload",this.defaultLocale=h;const n={formData:!0,fieldName:t.bundle?"files[]":"file",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:3e4,limit:5,withCredentials:!1,responseType:"",getResponseData(t){let n={};try{n=JSON.parse(t)}catch(t){e.log(t)}return n},getResponseError(e,t){let n=new Error("Upload error");return d(t)&&(n=new c(n,t)),n},validateStatus:e=>e>=200&&e<300};if(this.opts={...n,...t},this.i18nInit(),this.handleUpload=this.handleUpload.bind(this),r.internalRateLimitedQueue in this.opts?this.requests=this.opts[r.internalRateLimitedQueue]:this.requests=new r.RateLimitedQueue(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");this.uploaderEvents=Object.create(null)}getOptions(e){const t=this.uppy.getState().xhrUpload,{headers:n}=this.opts,r={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return"function"==typeof n?r.headers=n(e):Object.assign(r.headers,this.opts.headers),t&&Object.assign(r.headers,t.headers),e.xhrUpload&&Object.assign(r.headers,e.xhrUpload.headers),r}addMetadata(e,t,n){(Array.isArray(n.metaFields)?n.metaFields:Object.keys(t)).forEach(n=>{e.append(n,t[n])})}createFormDataUpload(e,t){const n=new FormData;this.addMetadata(n,e.meta,t);const r=f(e);return e.name?n.append(t.fieldName,r,e.meta.name):n.append(t.fieldName,r),n}createBundledUpload(e,t){const n=new FormData,{meta:r}=this.uppy.getState();return this.addMetadata(n,r,t),e.forEach(e=>{const t=this.getOptions(e),r=f(e);e.name?n.append(t.fieldName,r,e.name):n.append(t.fieldName,r)}),n}upload(t,n,r){const o=this.getOptions(t);return this.uppy.log(`uploading ${n} of ${r}`),new Promise((n,r)=>{this.uppy.emit("upload-started",t);const i=o.formData?this.createFormDataUpload(t,o):t.data,s=new XMLHttpRequest;let a;this.uploaderEvents[t.id]=new l(this.uppy);const c=new u(o.timeout,()=>{s.abort(),a.done();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(o.timeout/1e3)}));this.uppy.emit("upload-error",t,e),r(e)}),d=(0,e.nanoid)();s.upload.addEventListener("loadstart",()=>{this.uppy.log(`[XHRUpload] ${d} started`)}),s.upload.addEventListener("progress",e=>{this.uppy.log(`[XHRUpload] ${d} progress: ${e.loaded} / ${e.total}`),c.progress(),e.lengthComputable&&this.uppy.emit("upload-progress",t,{uploader:this,bytesUploaded:e.loaded,bytesTotal:e.total})}),s.addEventListener("load",()=>{if(this.uppy.log(`[XHRUpload] ${d} finished`),c.done(),a.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null),o.validateStatus(s.status,s.responseText,s)){const e=o.getResponseData(s.responseText,s),r=e[o.responseUrlFieldName],i={status:s.status,body:e,uploadURL:r};return this.uppy.emit("upload-success",t,i),r&&this.uppy.log(`Download ${t.name} from ${r}`),n(t)}const e=o.getResponseData(s.responseText,s),i=p(s,o.getResponseError(s.responseText,s)),l={status:s.status,body:e};return this.uppy.emit("upload-error",t,i,l),r(i)}),s.addEventListener("error",()=>{this.uppy.log(`[XHRUpload] ${d} errored`),c.done(),a.done(),this.uploaderEvents[t.id]&&(this.uploaderEvents[t.id].remove(),this.uploaderEvents[t.id]=null);const e=p(s,o.getResponseError(s.responseText,s));return this.uppy.emit("upload-error",t,e),r(e)}),s.open(o.method.toUpperCase(),o.endpoint,!0),s.withCredentials=o.withCredentials,""!==o.responseType&&(s.responseType=o.responseType),a=this.requests.run(()=>{this.uppy.emit("upload-started",t);const e=this.getOptions(t);return Object.keys(e.headers).forEach(t=>{s.setRequestHeader(t,e.headers[t])}),s.send(i),()=>{c.done(),s.abort()}}),this.onFileRemove(t.id,()=>{a.abort(),r(new Error("File removed"))}),this.onCancelAll(t.id,e=>{let{reason:t}=e;"user"===t&&a.abort(),r(new Error("Upload cancelled"))})})}uploadRemote(e){const n=this.getOptions(e);return new Promise((r,o)=>{this.uppy.emit("upload-started",e);const a={};(Array.isArray(n.metaFields)?n.metaFields:Object.keys(e.meta)).forEach(t=>{a[t]=e.meta[t]});new(e.remote.providerOptions.provider?t.Provider:t.RequestClient)(this.uppy,e.remote.providerOptions).post(e.remote.url,{...e.remote.body,endpoint:n.endpoint,size:e.data.size,fieldname:n.fieldName,metadata:a,httpMethod:n.method,useFormData:n.formData,headers:n.headers}).then(a=>{const{token:u}=a,c=s(e.remote.companionUrl),d=new t.Socket({target:`${c}/api/${u}`,autoOpen:!1});let h;this.uploaderEvents[e.id]=new l(this.uppy),this.onFileRemove(e.id,()=>{d.send("cancel",{}),h.abort(),r(`upload ${e.id} was removed`)}),this.onCancelAll(e.id,function(t){let{reason:n}=void 0===t?{}:t;"user"===n&&(d.send("cancel",{}),h.abort()),r(`upload ${e.id} was canceled`)}),this.onRetry(e.id,()=>{d.send("pause",{}),d.send("resume",{})}),this.onRetryAll(e.id,()=>{d.send("pause",{}),d.send("resume",{})}),d.on("progress",t=>i(this,t,e)),d.on("success",t=>{const o=n.getResponseData(t.response.responseText,t.response),i=o[n.responseUrlFieldName],s={status:t.response.status,body:o,uploadURL:i};return this.uppy.emit("upload-success",e,s),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),r()}),d.on("error",t=>{const r=t.response,i=r?n.getResponseError(r.responseText,r):Object.assign(new Error(t.error.message),{cause:t.error});this.uppy.emit("upload-error",e,i),h.done(),this.uploaderEvents[e.id]&&(this.uploaderEvents[e.id].remove(),this.uploaderEvents[e.id]=null),o(i)}),h=this.requests.run(()=>(d.open(),e.isPaused&&d.send("pause",{}),()=>d.close()))}).catch(t=>{this.uppy.emit("upload-error",e,t),o(t)})})}uploadBundle(e){return new Promise((t,n)=>{const{endpoint:r}=this.opts,{method:o}=this.opts,i=this.uppy.getState().xhrUpload,s=this.createBundledUpload(e,{...this.opts,...i||{}}),a=new XMLHttpRequest,l=t=>{e.forEach(e=>{this.uppy.emit("upload-error",e,t)})},c=new u(this.opts.timeout,()=>{a.abort();const e=new Error(this.i18n("timedOut",{seconds:Math.ceil(this.opts.timeout/1e3)}));l(e),n(e)});a.upload.addEventListener("loadstart",()=>{this.uppy.log("[XHRUpload] started uploading bundle"),c.progress()}),a.upload.addEventListener("progress",t=>{c.progress(),t.lengthComputable&&e.forEach(e=>{this.uppy.emit("upload-progress",e,{uploader:this,bytesUploaded:t.loaded/t.total*e.size,bytesTotal:e.size})})}),a.addEventListener("load",r=>{if(c.done(),this.opts.validateStatus(r.target.status,a.responseText,a)){const n=this.opts.getResponseData(a.responseText,a),o={status:r.target.status,body:n};return e.forEach(e=>{this.uppy.emit("upload-success",e,o)}),t()}const o=this.opts.getResponseError(a.responseText,a)||new Error("Upload error");return o.request=a,l(o),n(o)}),a.addEventListener("error",()=>{c.done();const e=this.opts.getResponseError(a.responseText,a)||new Error("Upload error");return l(e),n(e)}),this.uppy.on("cancel-all",function(e){let{reason:t}=void 0===e?{}:e;"user"===t&&(c.done(),a.abort())}),a.open(o.toUpperCase(),r,!0),a.withCredentials=this.opts.withCredentials,""!==this.opts.responseType&&(a.responseType=this.opts.responseType),Object.keys(this.opts.headers).forEach(e=>{a.setRequestHeader(e,this.opts.headers[e])}),a.send(s),e.forEach(e=>{this.uppy.emit("upload-started",e)})})}uploadFiles(e){const t=e.map((t,n)=>{const r=parseInt(n,10)+1,o=e.length;return t.error?Promise.reject(new Error(t.error)):t.isRemote?this.uploadRemote(t,r,o):this.upload(t,r,o)});return a(t)}onFileRemove(e,t){this.uploaderEvents[e].on("file-removed",n=>{e===n.id&&t(n.id)})}onRetry(e,t){this.uploaderEvents[e].on("upload-retry",n=>{e===n&&t()})}onRetryAll(e,t){this.uploaderEvents[e].on("retry-all",()=>{this.uppy.getFile(e)&&t()})}onCancelAll(e,t){var n=this;this.uploaderEvents[e].on("cancel-all",function(){n.uppy.getFile(e)&&t(...arguments)})}handleUpload(e){if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts[r.internalRateLimitedQueue]||this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");const t=e.map(e=>this.uppy.getFile(e));if(this.opts.bundle){if(t.some(e=>e.isRemote))throw new Error("Can’t upload remote files when the `bundle: true` option is set");if("function"==typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(t)}return this.uploadFiles(t).then(()=>null)}install(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(this.handleUpload)}uninstall(){if(this.opts.bundle){const{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(this.handleUpload)}}return g.VERSION="2.1.3",cn=g}(),vn=w(gn);function mn(e){Promise.resolve().then(e)}function yn(e){return e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/g,'"')}var bn=function(e){return Object.prototype.toString.call(e)};function wn(e){return e||{name:""}}function En(e){var t=e.server,n=void 0===t?"":t,o=e.fieldName,i=void 0===o?"":o,s=e.maxFileSize,a=void 0===s?10485760:s,l=e.maxNumberOfFiles,u=void 0===l?100:l,c=e.meta,d=void 0===c?{}:c,h=e.metaWithUrl,p=void 0!==h&&h,f=e.headers,g=void 0===f?{}:f,m=e.withCredentials,b=void 0!==m&&m,w=e.timeout,E=void 0===w?1e4:w,x=e.onBeforeUpload,S=void 0===x?function(e){return e}:x,_=e.onSuccess,O=void 0===_?function(e,t){}:_,k=e.onError,C=void 0===k?function(e,t,n){console.error("".concat(e.name," upload error"),t,n)}:k,T=e.onProgress,N=void 0===T?function(e){}:T;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!i)throw new Error("Cannot get fieldName\n没有配置 fieldName");var P=n;p&&(P=function(e,t){var n=y(e.split("#"),2),o=n[0],i=n[1],s=[];r(t,function(e,t){s.push("".concat(t,"=").concat(e))});var a=s.join("&");return o=o.indexOf("?")>0?"".concat(o,"&").concat(a):"".concat(o,"?").concat(a),i?"".concat(o,"#").concat(i):o}(P,d));var R=new Lt(v({onBeforeUpload:function(e){return S(e)},restrictions:{maxFileSize:a,maxNumberOfFiles:u},meta:d},e.uppyConfig)).use(vn,v({endpoint:P,headers:g,formData:!0,fieldName:i,bundle:!1,withCredentials:b,timeout:E},e.xhrConfig));return R.on("upload-success",function(e,t){var n=(null!=t?t:{}).body,r=void 0===n?{}:n,o=wn(e);try{O(o,r)}catch(e){console.error("wangEditor upload file - onSuccess error",e)}}),R.on("progress",function(e){e<1||N(e)}),R.on("upload-error",function(e,t,n){var r=wn(e);try{C(r,t,n)}catch(e){console.error("wangEditor upload file - onError error",e)}}),R.on("restriction-failed",function(e,t){var n=wn(e);try{C(n,t,void 0)}catch(e){console.error("wangEditor upload file - onError error",e)}}),R}var xn,Sn={};function _n(){if(xn)return Sn;xn=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,s=new WeakMap,a={isHistoryEditor:function(n){return t.isHistory(n.history)&&e.Editor.isEditor(n)},isMerging:function(e){return o.get(e)},isSplittingOnce:function(e){return s.get(e)},setSplittingOnce:function(e,t){s.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=a.isMerging(e);o.set(e,!0),t(),o.set(e,n)},withNewBatch:function(e,t){var n=a.isMerging(e);o.set(e,!0),s.set(e,!0),t(),o.set(e,n),s.delete(e)},withoutMerging:function(e,t){var n=a.isMerging(e);o.set(e,!1),t(),o.set(e,n)},withoutSaving:function(e,t){var n=a.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 u(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 u(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,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function u(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 c=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 Sn.HISTORY=n,Sn.History=t,Sn.HistoryEditor=a,Sn.MERGING=o,Sn.SAVING=r,Sn.SPLITTING_ONCE=s,Sn.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),a.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];a.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,s=i[i.length-1],l=s&&s.operations[s.operations.length-1],u=a.isSaving(n),h=a.isMerging(n);if(null==u&&(u=d(e)),u){if(null==h&&(h=null!=s&&(!!t.includes(l)||c(e,l))),a.isSplittingOnce(n)&&(h=!1,a.setSplittingOnce(n,void 0)),s&&h)s.operations.push(e);else{var p={operations:[e],selectionBefore:n.selection};n.writeHistory("undos",p)}for(;i.length>100;)i.shift();o.redos=[]}r(e)},n.writeHistory=function(e,t){n.history[e].push(t)},n},Sn}var On=_n(),kn=new Set(["base","embed","math","meta","object","script","svg","template"]),Cn=new Set(["href","poster","src","xlink:href"]),Tn=["java","script:"].join("");function Nn(e,t,n){var r=function(e){return Array.from(e).filter(function(e){return e>" "}).join("").toLowerCase()}(n);return!r||!r.startsWith(Tn)&&!r.startsWith("vbscript:")&&(!r.startsWith("data:")||"href"!==t&&"xlink:href"!==t&&(("img"===e||"poster"===t)&&r.startsWith("data:image/")))}function Pn(e){if(void 0===e&&(e=""),!e)return"";var t=(new DOMParser).parseFromString(e,"text/html");return Array.from(t.body.querySelectorAll("*")).forEach(function(e){var t=e.tagName.toLowerCase();kn.has(t)?e.remove():Array.from(e.attributes).forEach(function(n){var r=n.name.toLowerCase(),o=n.value||"";("srcdoc"===r||r.startsWith("on")||Cn.has(r)&&!Nn(t,r,o))&&e.removeAttribute(n.name)})}),t.body.innerHTML}var Rn={};var Mn="created",Ln="destroyed",$n="change",Dn="scroll",Fn="fullscreen",An="unFullScreen",jn="modalOrPanelShow",In="modalOrPanelHide",Un={};var Bn=new WeakMap,Hn=new WeakMap,zn=new WeakMap,Wn=new WeakMap,Vn=new WeakMap,qn=new WeakMap,Kn=new WeakMap,Jn=new WeakMap,Gn=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,Qn=new WeakMap,Zn=new WeakMap,er=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,or=new WeakMap,ir=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakMap,ur=new WeakMap,cr=new WeakMap,dr=new WeakMap,hr=new WeakMap,pr=new WeakMap,fr=new WeakMap,gr=new WeakMap,vr=function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in Un)e.push(t);return e},t.getConfig=function(){var e=Xn.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},mr=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);const yr=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var br,wr=globalThis.Node,Er=globalThis.Comment,xr=globalThis.Element,Sr=globalThis.Text,_r=globalThis.Range,Or=globalThis.Selection,kr=globalThis.StaticRange;a.css&&(a.fn.css=a.css),a.append&&(a.fn.append=a.append),a.addClass&&(a.fn.addClass=a.addClass),a.removeClass&&(a.fn.removeClass=a.removeClass),a.hasClass&&(a.fn.hasClass=a.hasClass),a.on&&(a.fn.on=a.on),a.focus&&(a.fn.focus=a.focus),a.attr&&(a.fn.attr=a.attr),a.removeAttr&&(a.fn.removeAttr=a.removeAttr),a.hide&&(a.fn.hide=a.hide),a.show&&(a.fn.show=a.show),a.offset&&(a.fn.offset=a.offset),a.width&&(a.fn.width=a.width),a.height&&(a.fn.height=a.height),a.parent&&(a.fn.parent=a.parent),a.parents&&(a.fn.parents=a.parents),a.is&&(a.fn.is=a.is),a.dataset&&(a.fn.dataset=a.dataset),a.val&&(a.fn.val=a.val),a.text&&(a.fn.text=a.text),a.html&&(a.fn.html=a.html),a.children&&(a.fn.children=a.children),a.remove&&(a.fn.remove=a.remove),a.find&&(a.fn.find=a.find),a.each&&(a.fn.each=a.each),a.empty&&(a.fn.empty=a.empty),e.NodeType=void 0,(br=e.NodeType||(e.NodeType={}))[br.ELEMENT_NODE=1]="ELEMENT_NODE",br[br.TEXT_NODE=3]="TEXT_NODE",br[br.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",br[br.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",br[br.COMMENT_NODE=8]="COMMENT_NODE",br[br.DOCUMENT_NODE=9]="DOCUMENT_NODE",br[br.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",br[br.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";var Cr=function(e){return"[object HTMLDocument]"===bn(e)},Tr=function(e){return"[object ShadowRoot]"===bn(e)},Nr=function(e){return"[object DataTransfer]"===bn(e)},Pr=/\[object HTML([A-Z][a-z]*)*Element\]/,Rr=function(e){return"matches"in e&&/^[ou]l$/i.test(e.tagName)&&!e.hasAttribute("data-w-e-type")},Mr=function(e){return Pr.test(bn(e))},Lr=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},$r=function(e){return null!=e&&"number"==typeof e.nodeType},Dr=function(t){return $r(t)&&t.nodeType===e.NodeType.COMMENT_NODE},Fr=function(t){return $r(t)&&t.nodeType===e.NodeType.ELEMENT_NODE},Ar=function(e){return"[object Selection]"===bn(e)},jr=function(t){return $r(t)&&t.nodeType===e.NodeType.TEXT_NODE},Ir=function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length},Ur=function(e){var t,n=y(e,2),r=n[0],o=n[1];if(Fr(r)&&r.childNodes.length){var i=o===r.childNodes.length,s=i?o-1:o;for(r=(t=y(zr(r,s,i?"backward":"forward"),2))[0],i=(s=t[1])<o;Fr(r)&&r.childNodes.length;){var a=i?r.childNodes.length-1:0;r=Wr(r,a,i?"backward":"forward")}o=i&&null!=r.textContent?r.textContent.length:0}return[r,o]},Br=function(){return!(!window.document.activeElement||!window.document.activeElement.shadowRoot)},Hr=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},zr=function(e,t,n){for(var r=e.childNodes,o=r[t],i=t,s=!1,a=!1;(Dr(o)||Fr(o)&&0===o.childNodes.length||Fr(o)&&"false"===o.getAttribute("contenteditable"))&&(!s||!a);)i>=r.length?(s=!0,i=t-1,n="backward"):i<0?(a=!0,i=t+1,n="forward"):(o=r[i],t=i,i+="forward"===n?1:-1);return[o,t]},Wr=function(e,t,n){return y(zr(e,t,n),1)[0]},Vr=function(e){var t,n,r="";if(jr(e)&&e.nodeValue)return e.nodeValue;if(Fr(e)){try{for(var o=m(Array.from(e.childNodes)),i=o.next();!i.done;i=o.next()){var s=i.value;r+=Vr(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}var a=getComputedStyle(e).getPropertyValue("display");"block"!==a&&"list"!==a&&"table-row"!==a&&"BR"!==e.tagName||(r+="\n")}return r};function qr(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 s=i.toLowerCase();if(yr.includes(s)||"iframe"===s||"video"===s)return o;var a=o.children||[],l=a.length;if(l)for(var u=l-1;u>=0;u-=1)n.push(a[u])}}return null}function Kr(t,n){if(!Mr(t)||"true"!==t.dataset.slateVoid)for(var r=t.childNodes,o=r.length;o-=1;){var i=r[o],s=i.nodeType;jr(i)?n(i,t):[e.NodeType.ELEMENT_NODE,e.NodeType.DOCUMENT_NODE,e.NodeType.DOCUMENT_FRAGMENT_NODE].includes(s)&&Kr(i,n)}}function Jr(t){if(0===t.length)return"";var n=t[0];return n.nodeType!==e.NodeType.ELEMENT_NODE?"":n.tagName.toLowerCase()}var Gr=new RegExp(String.fromCharCode(160),"g");function Xr(e){return e.replace(Gr," ")}var Yr=["span","b","strong","i","em","s","strike","u","font","sub","sup"],Qr=[];var Zr=[];var eo={};function to(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 no(e,t,n){return{type:"paragraph",children:[{text:a(e).text().replace(/\s+/gm," ")}]}}function ro(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(Fr(e)){if("BR"===e.nodeName)return void(to(n,"\n")||n.push({text:"\n"}));var r=lo(a(e),t);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}else if(jr(e)){var o=e.textContent||"";if(""===o.trim()&&o.indexOf("\n")>=0)return;o&&(o=Xr(o),to(n,o)||n.push({text:o}))}}),n)}(e,t),r=function(e){for(var t in eo)if(e[0].matches(t))return eo[t];return no}(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," ")}]),Zr.forEach(function(n){r=n(e[0],r,t)}))}),o}function oo(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=Xr(n=yn(n))};return Zr.forEach(function(n){r=n(e[0],r,t)}),r}function io(e,t){var n={text:""};return Zr.forEach(function(r){n=r(e[0],n,t)}),n}function so(e,t){var n=t.parentElement;return null==n?e:(null==n.closest("pre")&&(e=e.replace(/[\r\n\t]+/g,"")),e=Xr(e=yn(e)))}function ao(e,t,n){var r=e[0];if(Fr(r)){var o=lo(e,n);return delete t.text,Array.isArray(o)?o.map(function(e){return v(v({},t),e)}):[v(v({},t),o)]}if(Dr(r))return null;var i=jr(r)?{text:so(r.textContent||"",r)}:oo(e,n);return[v(v({},t),i)]}function lo(e,t){Qr.forEach(function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=a(r(e[0])))});var n=Jr(e);if("span"===n){if(e.attr("data-w-e-type"))return ro(e,t);if((o=Array.from(e[0].childNodes)).some(function(e){return!jr(e)&&!Dr(e)})){var r=io(a(e[0]),t);return o.flatMap(function(e){return ao(a(e),r,t)||[]})}return oo(e,t)}if("code"===n)return"pre"===Jr(e.parent())?ro(e,t):oo(e,t);if(Yr.includes(n)){var o;if((o=Array.from(e[0].childNodes)).some(function(e){return!jr(e)&&!Dr(e)})){var i=io(a(e[0]),t);return o.flatMap(function(e){return ao(a(e),i,t)||[]})}return oo(e,t)}return ro(e,t)}function uo(e,t,n){var r=a(n);return!!r.attr(t)||(r.attr(t,"true"),e.on(Ln,function(){r.removeAttr(t)}),!1)}function co(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=a("<div>".concat(t,"</div>"));return Array.from(o.children()).forEach(function(t){var r=lo(a(t),e);Array.isArray(r)?r.forEach(function(e){return n.push(e)}):n.push(r)}),n}function ho(e,t){return"w-e-element-".concat(e,"-").concat(t)}var po=[];var fo={};function go(e,t,n){var r=n.isInline(e)?"span":"div";return"<".concat(r,">").concat(t,"</").concat(r,">")}function vo(e,t){var n=e.type,r=void 0===n?"":n,o=e.children,s=void 0===o?[]:o,a=i.Editor.isVoid(t,e),l="";a||(l=s.map(function(e){return No(e,t)}).join(""));var u=function(e){return fo[e]||go}(r),c=u(e,l,t),d="";if(d="string"==typeof c?c:c.html||"",a||po.forEach(function(n){return d=n(e,d,t)}),"string"==typeof c)return d;var h=c.prefix,p=void 0===h?"":h,f=c.suffix,g=void 0===f?"":f;return p&&(d=p+d),g&&(d+=g),d}var mo=0,yo=function(){this.id="".concat(mo++)},bo="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),wo="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Eo="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),xo="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),So="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),_o="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent),Oo=!So&&!xo&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,ko=function(e,t){return Boolean(e.compareDocumentPosition(t)&wr.DOCUMENT_POSITION_PRECEDING)},Co=function(e,t){return Boolean(e.compareDocumentPosition(t)&wr.DOCUMENT_POSITION_FOLLOWING)},To={getWindow:function(e){var t=ur.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=lr.get(t);return n||(n=new yo,lr.set(t,n)),n},setNewKey:function(e){var t=new yo;lr.set(e,t)},findPath:function(e,t){for(var n=[],r=t;;){var o=rr.get(r);if(null==o){if(i.Editor.isEditor(r))return n;break}var s=nr.get(r);if(null==s)break;n.unshift(s),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=To.toDOMNode(e,e),n=t.getRootNode();return(Cr(n)||Tr(n))&&null!=Reflect.get(n,"getSelection")?n:t.ownerDocument},getParentNode:function(e,t){return rr.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=To.getParentNode(e,r);if(null==o)break;n.push(o),r=o}return n},getTopNode:function(e,t){var n=[To.findPath(e,t)[0]];return i.Node.get(e,n)},toDOMNode:function(e,t){var n;if(i.Editor.isEditor(t))n=or.get(e);else{var r=To.findKey(e,t);n=sr.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!!or.get(e);var n=To.findKey(e,t);return!!sr.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 To.hasDOMNodeBySlateNode(e,n)&&To.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,s=To.toDOMNode(e,e);try{r=Fr(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]")===s&&(!i||r.isContentEditable||r.closest('[contenteditable="false"]')===s||!!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),s=To.toDOMPoint(e,n),a=i.Range.isCollapsed(t)?s:To.toDOMPoint(e,r),l=To.getWindow(e).document.createRange(),u=y(o?a:s,2),c=u[0],d=u[1],h=y(o?s:a,2),p=h[0],f=h[1],g=!!(Fr(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(Fr(p)?p:p.parentElement).getAttribute("data-slate-zero-width");return l.setStart(c,g?1:d),l.setEnd(p,v?1:f),l},toDOMPoint:function(e,t){var n,r,o,s=y(i.Editor.node(e,t.path),1)[0],a=To.toDOMNode(e,s);i.Editor.void(e,{at:t})&&(t={path:t.path,offset:0});var l=Array.from(a.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),u=0;try{for(var c=m(l),d=c.next();!d.done;d=c.next()){var h=d.value,p=h.childNodes[0];if(null!=p&&null!=p.textContent){var f=p.textContent.length,g=h.getAttribute("data-slate-length"),v=u+(null==g?f:parseInt(g,10));if(t.offset<=v){o=[p,Math.min(f,Math.max(0,t.offset-u))];break}u=v}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}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=Fr(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?ir.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 s,a=To.toSlateNode(e,t.target),l=To.findPath(e,a);if(i.Element.isElement(a)&&i.Editor.isVoid(e,a)){var u=o.getBoundingClientRect(),c=e.isInline(a)?n-u.left<u.left+u.width-n:r-u.top<u.top+u.height-r,d=i.Editor.point(e,l,{edge:c?"start":"end"}),h=c?i.Editor.before(e,d):i.Editor.after(e,d);if(h)return i.Editor.range(e,h)}var p=this.getWindow(e).document;if(p.caretRangeFromPoint)s=p.caretRangeFromPoint(n,r);else{var f=p.caretPositionFromPoint(n,r);f&&((s=p.createRange()).setStart(f.offsetNode,f.offset),s.setEnd(f.offsetNode,f.offset))}if(!s)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));return To.toSlateRange(e,s,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,t,n){var r,o,s,a,l,u=n.exactMatch,c=n.suppressThrow;if((Ar(t)?t.anchorNode:t.startContainer)&&(Ar(t)?(r=t.anchorNode,o=t.anchorOffset,s=t.focusNode,a=t.focusOffset,l=_o&&Br()?t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:t.isCollapsed):(r=t.startContainer,o=t.startOffset,s=t.endContainer,a=t.endOffset,l=t.collapsed)),null==r||null==s||null==o||null==a)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));var d=To.toSlatePoint(e,[r,o],{exactMatch:u,suppressThrow:c});if(!d)return null;var h=l?d:To.toSlatePoint(e,[s,a],{exactMatch:u,suppressThrow:c,searchDirection:ko(r,s)||r===s&&a<o?"forward":"backward"});if(!h)return null;var p={anchor:d,focus:h};return i.Range.isExpanded(p)&&i.Range.isForward(p)&&Fr(s)&&i.Editor.void(e,{at:p.focus,mode:"highest"})&&(p=i.Editor.unhangRange(e,p,{voids:!0})),p},toSlatePoint:function(e,t,n){var r,o,i,s=n.exactMatch,a=n.suppressThrow,u=y(s?t:Ur(t),2),c=u[0],d=u[1],h=c.parentNode,p=n.searchDirection,f=null,g=0;if(h){var v=To.toDOMNode(e,e),w=h.closest('[data-slate-void="true"]'),E=w&&v.contains(w)?w:null,x=h.closest('[contenteditable="false"]'),S=x&&v.contains(x)?x:null,_=h.closest("[data-slate-leaf]"),O=null,k=To.getWindow(e);if(_&&k.document.createRange){f=_.closest('[data-slate-node="text"]');var C=k.document.createRange();C.setStart(f,0),C.setEnd(c,d);var T=C.cloneContents();b(b([],y(l(T.querySelectorAll("[data-slate-zero-width]"))),!1),y(l(T.querySelectorAll("[contenteditable=false]"))),!1).forEach(function(e){e.parentNode.removeChild(e)}),g=T.textContent.length,O=f}else if(E)(_=Array.from(E.querySelectorAll("[data-slate-leaf]")).find(function(t){return To.hasDOMNode(e,t)})||null)?(f=_.closest('[data-slate-node="text"]'),g=(O=_).textContent.length,O.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})):g=1;else if(S){var N=function(t){return t?Array.from(t.querySelectorAll("[data-slate-leaf]")).filter(function(t){return To.hasDOMNode(e,t)}):[]},P=S.closest('[data-slate-node="element"]');if("backward"===p||!p)for(var R=(L=b(b([],y(N(null==P?void 0:P.previousElementSibling)),!1),y(N(P)),!1)).length-1;R>=0;R-=1){var M=L[R];if(ko(S,M)){_=M,p="backward";break}}if(!(_||"forward"!==p&&p)){var L=b(b([],y(N(P)),!1),y(N(null==P?void 0:P.nextElementSibling)),!1);try{for(var $=m(L),D=$.next();!D.done;D=$.next()){M=D.value;if(Co(S,M)){_=M,p="forward";break}}}catch(e){r={error:e}}finally{try{D&&!D.done&&(o=$.return)&&o.call($)}finally{if(r)throw r.error}}}_&&(f=_.closest('[data-slate-node="text"]'),O=_,"forward"===p?g=0:(g=O.textContent.length,O.querySelectorAll("[data-slate-zero-width]").forEach(function(e){g-=e.textContent.length})))}O&&g===O.textContent.length&&(h.hasAttribute("data-slate-zero-width")||wo&&(null===(i=O.textContent)||void 0===i?void 0:i.endsWith("\n")))&&(g-=1)}if(!f){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var F,A=To.toSlateNode(e,f);try{F=To.findPath(e,A)}catch(e){if(a)return null;throw e}return{path:F,offset:g}},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("")},getSelectedElems:function(e){var t,n,r=[],o=i.Editor.nodes(e,{universal:!0});try{for(var s=m(o),a=s.next();!a.done;a=s.next()){var l=y(a.value,1)[0];i.Element.isElement(l)&&r.push(l)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r},getSelectedNodeByType:function(e,t){var n=this,r=y(i.Editor.nodes(e,{match:function(e){return n.checkNodeType(e,t)},universal:!0}),1),o=r[0];return null==o?null:o[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){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=Bn.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return Wn.get(e)||null},getHoverbar:function(e){return qn.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,s=To.getTextarea(e).$textArea,l=null==s?void 0:s[0].childNodes;if(l)try{for(var u=m(Array.from(l)),c=u.next();!c.done;c=u.next()){var d=c.value;if(!jr(d))break;d.remove()}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var h=i.Editor.nodes(e,{match:function(t){return!(!i.Element.isElement(t)||e.isInline(t))},universal:!0});try{for(var p=m(h),f=p.next();!f.done;f=p.next()){var g=f.value;if(null!=g){var v=g[0];if(!To.hasDOMNodeBySlateNode(e,v))continue;Kr(To.toDOMNode(e,v),function(e,t){var n=a(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{f&&!f.done&&(o=p.return)&&o.call(p)}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){var t,n,r=i.Editor.nodes(e,{match:function(t){return e.isVoid(t)}}),o=0;try{for(var s=m(r),a=s.next();!a.done;a=s.next()){a.value&&(o+=1)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o>0},isSelectedEmptyParagraph:function(e){var t=e.selection;if(null==t)return!1;if(i.Range.isExpanded(t))return!1;var n=To.getSelectedNodeByType(e,"paragraph");if(null===n)return!1;var r=n.children;return 1===r.length&&(""===r[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 No(e,t){return i.Element.isElement(e)?vo(e,t):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=To.getParentsNodes(t,e).some(function(e){return"pre"===To.getNodeType(e)});if(o||(r=r.replace(/\n\r|\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/ /g," ")),""===r){var i=To.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>"}return po.forEach(function(n){return r=n(e,r,t)}),r}(e,t)}var Po=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ro=function(e,t,n){var r=To.toDOMRange(e,t).getBoundingClientRect(),o=To.toDOMRange(e,n).getBoundingClientRect();return Po(r,o)&&Po(o,r)},Mo=function(e,t){var n,r,o=[];try{for(var s=m(i.Editor.levels(e,{at:t})),a=s.next();!a.done;a=s.next()){var l=y(a.value,2),u=l[0],c=l[1],d=To.findKey(e,u);o.push([c,d])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o};function Lo(e,t){e.isInline(t)?(e.insertNode(t),"link"===t.type&&e.insertFragment([{text:""}])):i.Transforms.insertNodes(e,t,{mode:"highest"})}var $o,Do,Fo,Ao,jo,Io,Uo,Bo,Ho,zo,Wo,Vo,qo,Ko,Jo,Go,Xo,Yo,Qo,Zo,ei,ti,ni,ri,oi,ii,si,ai,li,ui,ci,di,hi,pi,fi,gi,vi,mi,yi,bi,wi=function(e){var t=e,n=t.onChange,r=t.insertText,o=t.apply,s=t.deleteBackward,l=t.deleteFragment;return t.insertText=function(e){t.getConfig().readOnly||r(e)},t.apply=function(e){var n,r,s,a,l,u,c,d,h=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":case"split_node":h.push.apply(h,b([],y(Mo(t,e.path)),!1));break;case"insert_node":case"remove_node":h.push.apply(h,b([],y(Mo(t,i.Path.parent(e.path))),!1));break;case"merge_node":var p=i.Path.previous(e.path);h.push.apply(h,b([],y(Mo(t,p)),!1));break;case"move_node":var f=i.Path.common(i.Path.parent(e.path),i.Path.parent(e.newPath));h.push.apply(h,b([],y(Mo(t,f)),!1));break;case"set_selection":(null===(a=null===(s=e.newProperties)||void 0===s?void 0:s.focus)||void 0===a?void 0:a.path)&&(h.push.apply(h,b([],y(Mo(t,null===(u=null===(l=e.newProperties)||void 0===l?void 0:l.focus)||void 0===u?void 0:u.path)),!1)),h.push.apply(h,b([],y(Mo(t,null===(d=null===(c=e.properties)||void 0===c?void 0:c.focus)||void 0===d?void 0:d.path)),!1)))}o(e);try{for(var g=m(h),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];lr.set(S,x),"type"in S&&(er.has(S)&&er.delete(S),tr.has(S)&&tr.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 s(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],a=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,s=r.length,a=Math.floor(s/2);if(Ro(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(;a!==r.length&&a!==o;)Ro(e,i.Editor.range(e,r[a]),n)?s=a:o=a,a=Math.floor((o+s)/2);return i.Editor.range(e,r[s],n)}(t,a);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],s=y(i.Editor.edges(e,[]),2),a=s[0],l=s[1];return i.Point.equals(r,a)&&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&&dr.set(t,e),t.emit($n),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=To.getNodeType(e);if(o.includes(n))return No(e,t);var r=tr.get(e);if(r)return r;var i=No(e,t);return tr.set(e,i),i}).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 s=[],a=i.Editor.nodes(t,{at:[],universal:!0});try{for(var l=m(a),u=l.next();!u.done;u=l.next()){var c=y(u.value,1)[0];if(i.Element.isElement(c))if(n?c.type.indexOf(e)>=0:c.type===e){var d=To.findKey(t,c),h=ho(c.type,d.id);s.push(v(v({},c),{id:h}))}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return s},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,s=void 0===o?[]:o;if(s.length>1)return!1;var a=s[0];return null==a||i.Text.isText(a)&&""===a.text},t.clear=function(){i.Transforms.delete(t,{at:{anchor:i.Editor.start(t,[]),focus:i.Editor.end(t,[])}}),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 To.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!!jr(e)||!!Fr(e)&&!mr.has(t.toLowerCase())}),0!==o.length){var s=t.selection;if(null!=s){var l=null;if(To.isSelectedEmptyParagraph(t)&&!n)l=[s.focus.path[0]];r.setAttribute("hidden","true"),document.body.appendChild(r);var u=0;o.forEach(function(e,n){var r=e.nodeName,i=e.textContent,s=void 0===i?"":i;if(jr(e)){if(!s||!s.trim())return;t.insertNode({text:s})}else if("BR"!==r){var l=e,c=!1;if(Yr.includes(r.toLowerCase()))c=!0;else for(var d in eo)if(l.matches(d)){c=!0;break}if(c){var h=lo(a(l),t);return Array.isArray(h)?(h.forEach(function(e){return Lo(t,e)}),u+=1):(Lo(t,h),u+=1),void(To.isSelectedVoidNode(t)&&t.move(1))}var p=window.getComputedStyle(l).display;if(!To.isSelectedEmptyParagraph(t)&&p.indexOf("inline")<0){if(n>=1){var f=o[n-1];Rr(f)&&t.insertBreak()}t.insertBreak()}t.dangerouslyInsertHtml(l.innerHTML,!0)}else t.insertText("\n")}),u&&l&&To.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(),dr.delete(t),t.focus(),t.clear();var s=co(t,null==e?"":e);if(i.Transforms.insertFragment(t,s),r||(t.deselect(),t.blur()),n&&(t.deselect(),t.disable()),t.isFocused())try{var a=JSON.parse(o);i.Range.isRange(a)&&To.hasRange(t,a)?t.select(a):t.select(i.Editor.start(t,[]))}catch(e){t.select(i.Editor.start(t,[]))}},t},Ei=1,xi=function(e){var t=e;return t.id="wangEditor-".concat(Ei),Ei+=1,t.isDestroyed=!1,t.isFullScreen=!1,t.focus=function(e){if(To.toDOMNode(t,t).focus({preventScroll:!0}),cr.set(t,!0),e){var n=i.Editor.end(t,[]);i.Transforms.select(t,n)}else{var r=dr.get(t);r?i.Transforms.select(t,r):i.Transforms.select(t,i.Editor.start(t,[]))}},t.isFocused=function(){return!!cr.get(t)},t.blur=function(){To.toDOMNode(t,t).blur(),i.Transforms.deselect(t),cr.set(t,!1)},t.updateView=function(){To.getTextarea(t).changeViewState();var e=To.getToolbar(t);e&&e.changeToolbarState();var n=To.getHoverbar(t);n&&n.changeHoverbarState()},t.destroy=function(){if(!t.isDestroyed){var e=To.getTextarea(t);e.destroy(),Bn.delete(t),Hn.delete(e);var n=To.getToolbar(t);n&&(n.destroy(),Wn.delete(t),zn.delete(n));var r=To.getHoverbar(t);r&&(r.destroy(),qn.delete(t),Vn.delete(r)),t.isDestroyed=!0,t.emit(Ln)}},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=a("#".concat(e));if(0!==r.length){var o=r[0];if(!To.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=To.getTextarea(t),s=i.$textAreaContainer,l=i.$scroll,u=r.offset().top,c=s.offset().top;l[0].scrollBy({top:u-c,behavior:"smooth"})}},t.showProgressBar=function(e){e<1||To.getTextarea(t).changeProgress(e)},t.hidePanelOrModal=function(){var e=Jn.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 To.toDOMNode(t,e)},t.fullScreen=function(){if(!t.isFullScreen){var e=null,n=To.getToolbar(t);n&&(e=n.$box);var r=To.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(Fn)}},t.unFullScreen=function(){if(t.isFullScreen){var e=To.getTextarea(t).$box.parent();setTimeout(function(){e.removeClass("w-e-full-screen-container"),t.isFullScreen=!1,t.emit(An)},200)}},t.getEditableContainer=function(){return To.getTextarea(t).$textAreaContainer[0]},t},Si={exports:{}},_i={exports:{}};function Oi(){if(Do)return $o;Do=1;return $o=function(e){return null!=e}}function ki(){if(Io)return jo;Io=1;var e=function(){if(Ao)return Fo;Ao=1;var e=Oi(),t={object:!0,function:!0,undefined:!0};return Fo=function(n){return!!e(n)&&hasOwnProperty.call(t,typeof n)}}();return jo=function(t){if(!e(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(e){return!1}}}function Ci(){if(zo)return Ho;zo=1;var e=function(){if(Bo)return Uo;Bo=1;var e=ki();return Uo=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 Ho=function(r){return!!e(r)&&!t.test(n.call(r))}}function Ti(){if(Yo)return Xo;Yo=1;var e=(Go?Jo:(Go=1,Jo=function(){}))();return Xo=function(t){return t!==e&&null!==t}}function Ni(){return ti||(ti=1,ei=(Ko?qo:(Ko=1,qo=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}))()?Object.keys:function(){if(Zo)return Qo;Zo=1;var e=Ti(),t=Object.keys;return Qo=function(n){return t(e(n)?Object(n):n)}}()),ei}function Pi(){if(ii)return oi;ii=1;var e=Ni(),t=function(){if(ri)return ni;ri=1;var e=Ti();return ni=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}(),n=Math.max;return oi=function(r,o){var i,s,a,l=n(arguments.length,2);for(r=Object(t(r)),a=function(e){try{r[e]=o[e]}catch(e){i||(i=e)}},s=1;s<l;++s)e(o=arguments[s]).forEach(a);if(void 0!==i)throw i;return r},oi}function Ri(){return ai?si:(ai=1,si=(Vo||(Vo=1,Wo=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")}),Wo)()?Object.assign:Pi())}function Mi(){return gi||(gi=1,fi=function(){if(di)return ci;di=1;var e="razdwatrzy";return ci=function(){return"function"==typeof e.contains&&!0===e.contains("dwa")&&!1===e.contains("foo")}}()()?String.prototype.contains:function(){if(pi)return hi;pi=1;var e=String.prototype.indexOf;return hi=function(t){return e.call(this,t,arguments[1])>-1},hi}()),fi}function Li(){if(vi)return _i.exports;vi=1;var e=Oi(),t=Ci(),n=Ri(),r=function(){if(ui)return li;ui=1;var e=Ti(),t=Array.prototype.forEach,n=Object.create;return li=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},li}(),o=Mi(),i=_i.exports=function(t,i){var s,a,l,u,c;return arguments.length<2||"string"!=typeof t?(u=i,i=t,t=null):u=arguments[2],e(t)?(s=o.call(t,"c"),a=o.call(t,"e"),l=o.call(t,"w")):(s=l=!0,a=!1),c={value:i,configurable:s,enumerable:a,writable:l},u?n(r(u),c):c};return i.gs=function(i,s,a){var l,u,c,d;return"string"!=typeof i?(c=a,a=s,s=i,i=null):c=arguments[3],e(s)?t(s)?e(a)?t(a)||(c=a,a=void 0):a=void 0:(c=s,s=a=void 0):s=void 0,e(i)?(l=o.call(i,"c"),u=o.call(i,"e")):(l=!0,u=!1),d={get:s,set:a,configurable:l,enumerable:u},c?n(r(c),d):d},_i.exports}var $i=(bi||(bi=1,function(e,t){var n,r,o,i,s,a,l,u=Li(),c=yi?mi:(yi=1,mi=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}),d=Function.prototype.apply,h=Function.prototype.call,p=Object.create,f=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var r,i;return c(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),d.call(t,this,arguments)}),r.__eeOnceListener__=t,this},o=function(e,t){var n,r,o,i;if(c(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},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:h.call(o,this);break;case 2:h.call(o,this,arguments[1]);break;case 3:h.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)}},s={on:n=function(e,t){var n;return c(t),v.call(this,"__ee__")?n=this.__ee__:(n=m.value=p(null),f(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,emit:i},a={on:u(n),once:u(r),off:u(o),emit:u(i)},l=g({},a),e.exports=t=function(e){return null==e?p(l):g(Object(e),a)},t.methods=s}(Si,Si.exports)),Si.exports),Di=w($i);function Fi(e){var t=hr.get(e);return null==t&&(t=Di(),hr.set(e,t)),t}var Ai=new WeakMap;function ji(e,t){var n=Ai.get(e);null==n&&(n=new Set,Ai.set(e,n)),n.add(t)}var Ii=function(e){var t=e;return t.on=function(e,n){var r=Fi(t);if(r.on(e,n),"destroyed"===e&&ji(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),ji(t,o)}},t.once=function(e,n){Fi(t).once(e,n)},t.off=function(e,n){Fi(t).off(e,n)},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=Fi(t);if(o.emit.apply(o,b([e],y(n),!1)),"destroyed"===e){var i=function(e){return Ai.get(e)||new Set}(t);i.forEach(function(e){return o.off("destroyed",e)}),function(e){Ai.set(e,new Set)}(t)}},t};var Ui=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],s=r[1],a=i.Editor.void(t,{at:o.path}),l=i.Editor.void(t,{at:s.path});if(!i.Range.isCollapsed(n)||a){var u=To.toDOMRange(t,n),c=u.cloneContents(),d=c.childNodes[0];if(c.childNodes.forEach(function(e){e.textContent&&""!==e.textContent.trim()&&(d=e)}),l){var h=y(l,1)[0],p=u.cloneRange(),f=To.toDOMNode(t,h);p.setEndAfter(f),c=p.cloneContents()}if(a&&(d=c.querySelector("[data-slate-spacer]")),Array.from(c.querySelectorAll("[data-slate-zero-width]")).forEach(function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":""}),jr(d)){var g=d.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(d),c.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=c.ownerDocument.createElement("div");return w.appendChild(c),w.setAttribute("hidden","true"),c.ownerDocument.body.appendChild(w),e.setData("text/html",w.innerHTML),e.setData("text/plain",Vr(w)),c.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"),s=e.getData("text/html");if(s){var a=t.getConfig().sanitizeHtml;t.dangerouslyInsertHtml(a?a(s):s)}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};function Bi(e){return e.replace(/\n\r|\r\n|\r|\n/g,"").length}function Hi(e,t){var n,r;if(t<=0)return"";var o=t,i="";try{for(var s=m(e),a=s.next();!a.done;a=s.next()){var l=a.value;if(/\r|\n/.test(l))i+=l;else{if(o<=0)break;i+=l,o-=1}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}var zi=function(e){var t=e,n=t.insertText,r=t.insertNode,o=t.insertFragment,s=t.dangerouslyInsertHtml;return t.insertText=function(e){if(t.getConfig().maxLength){var r=To.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=To.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(To.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=To.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 s=n[i];if(jr(s)){var a=s.textContent||"",l=Bi(a);if(l<=t){t-=l;continue}return s.textContent=Hi(a,t),t=0,r(n.slice(i+1)),!1}if(Fr(s)){if(mr.has(s.nodeName.toLowerCase())){s.remove();continue}if(!o(s))return r(n.slice(i+1)),!1}else s.remove()}return t>0};return o(n),n.innerHTML}(e,r);o&&s(o,n)}}else s(e,n)},t};function Wi(e){var t=To.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return{top:o.top,left:o.left,width:n,height:r}}function Vi(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=Wi(e);if(null==r)return t;var o=r.top,i=r.left,s=r.width,a=r.height,l=To.toDOMRange(e,n).getClientRects(),u=l?l[0]:null;if(null==u)return t;var c={},d=u.top-o,h=u.left-i;if(h>s/2){var p=s-h;c.right="".concat(p+5,"px")}else c.left="".concat(h+5,"px");if(d>a/2){var f=a-d;c.bottom="".concat(f+5,"px")}else{var g=l[l.length-1],v=g.top-o+g.height;v<0&&(v=0),c.top="".concat(v+5,"px")}return c}function qi(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),s=i.Element.isElement(t)&&e.isInline(t),a=ar.get(t);if(null==a)return r;var l=a.getBoundingClientRect(),u=l.top,c=l.left,d=l.height,h=l.width;if(o){var p=qr(a);if(null!=p){var f=p.getBoundingClientRect();u=f.top,d=f.height}}var g=Wi(e);if(null==g)return r;var v=g.top,m=g.left,y=g.width,b=g.height,w={},E=u-v,x=c-m;if("bar"===n)return w.left="".concat(x,"px"),E>40?w.bottom="".concat(b-E+5,"px"):w.top="".concat(E+d+5,"px"),w;if("modal"===n){if(o?s?x>(y-h)/2?w.right="".concat(y-x+5,"px"):w.left="".concat(x+h+5,"px"):w.left="20px":w.left="".concat(x,"px"),o)(S=E)<0&&(S=0),w.top="".concat(S,"px");else if(E>(b-d)/2)w.bottom="".concat(b-E+5,"px");else{var S;(S=E+d)<0&&(S=0),w.top="".concat(S+5,"px")}return w}throw new Error("type '".concat(n,"' is invalid"))}function Ki(e,t){mn(function(){var n=Wi(e);if(null!=n){var r,o=n.top,i=n.left,s=n.width,a=n.height,l=t.offset(),u=l.top,c=l.left,d=t.width(),h=t.height(),p=u-o,f=c-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=p+h-a)>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&&u<0){var y=t.css("bottom"),b=parseInt(y.toString(),10)-Math.abs(u);t.css("bottom","".concat(b,"px"))}if(g.indexOf("left")>=0)if((r=f+d-s)>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&&c<0){var x=t.css("right"),S=parseInt(x.toString(),10)-Math.abs(c);t.css("right","".concat(S,"px"))}}})}var Ji=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=To.findDocumentOrShadowRoot(t).getSelection();n&&n.rangeCount>0&&To.hasDOMNode(t,n.anchorNode)&&To.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=dr.get(t);null!=e&&(t.focus(),n(e))},t.getSelectionPosition=function(){return Vi(t)},t.getNodePosition=function(e){return qi(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],s=y(i.Editor.edges(t,[]),2),a=s[0],l=s[1];return!(!i.Point.equals(r,a)||!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 Gi=e=>"string"==typeof e,Xi=()=>{let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Yi=e=>null==e?"":""+e,Qi=/###/g,Zi=e=>e&&e.indexOf("###")>-1?e.replace(Qi,"."):e,es=e=>!e||Gi(e),ts=(e,t,n)=>{const r=Gi(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(es(e))return{};const t=Zi(r[o]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++o}return es(e)?{}:{obj:e,k:Zi(r[o])}},ns=(e,t,n)=>{const{obj:r,k:o}=ts(e,t,Object);if(void 0!==r||1===t.length)return void(r[o]=n);let i=t[t.length-1],s=t.slice(0,t.length-1),a=ts(e,s,Object);for(;void 0===a.obj&&s.length;)i=`${s[s.length-1]}.${i}`,s=s.slice(0,s.length-1),a=ts(e,s,Object),a&&a.obj&&void 0!==a.obj[`${a.k}.${i}`]&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n},rs=(e,t)=>{const{obj:n,k:r}=ts(e,t);if(n)return n[r]},os=(e,t,n)=>{for(const r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?Gi(e[r])||e[r]instanceof String||Gi(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):os(e[r],t[r],n):e[r]=t[r]);return e},is=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var ss={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const as=e=>Gi(e)?e.replace(/[&<>"'\/]/g,e=>ss[e]):e;const ls=[" ",",","?","!",";"],us=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),cs=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 s=e;s<r.length;++s)if(s!==e&&(i+=n),i+=r[s],t=o[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&s<r.length-1)continue;e+=s-e+1;break}o=t}return o},ds=e=>e&&e.replace("_","-"),hs={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 ps{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||hs,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:(Gi(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new ps(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new ps(this.logger,e)}}var fs=new ps;class gs{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 vs extends gs{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 s;e.indexOf(".")>-1?s=e.split("."):(s=[e,t],n&&(Array.isArray(n)?s.push(...n):Gi(n)&&o?s.push(...n.split(o)):s.push(n)));const a=rs(this.data,s);return!a&&!t&&!n&&e.indexOf(".")>-1&&(e=s[0],t=s[1],n=s.slice(2).join(".")),!a&&i&&Gi(n)?cs(this.data&&this.data[e]&&this.data[e][t],n,o):a}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 s=[e,t];n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."),r=t,t=s[1]),this.addNamespaces(t),ns(this.data,s,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)(Gi(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},s=[e,t];e.indexOf(".")>-1&&(s=e.split("."),r=n,n=t,t=s[1]),this.addNamespaces(t);let a=rs(this.data,s)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?os(a,n,o):a={...a,...n},ns(this.data,s,a),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 ms={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 ys={};class bs extends gs{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=fs.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,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const r=ls.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(0===r.length)return!0;const o=us.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&&!s){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Gi(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:Gi(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:s}=this.extractFromKey(e[e.length-1],t),a=s[s.length-1],l=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(u){const e=t.nsSeparator||this.options.nsSeparator;return r?{res:`${a}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:`${a}${e}${i}`}return r?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:i}const c=this.resolve(e,t);let d=c&&c.res;const h=c&&c.usedKey||i,p=c&&c.exactUsedKey||i,f=Object.prototype.toString.apply(d),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!Gi(d)&&"boolean"!=typeof d&&"number"!=typeof d;if(!(v&&d&&m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(f)<0)||Gi(g)&&Array.isArray(d))if(v&&Gi(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,e,t,n));else{let r=!1,s=!1;const u=void 0!==t.count&&!Gi(t.count),h=bs.hasDefaultValue(t),p=u?this.pluralResolver.getSuffix(l,t.count,t):"",f=t.ordinal&&u?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",g=u&&!t.ordinal&&0===t.count&&this.pluralResolver.shouldUseIntlApi(),v=g&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${p}`]||t[`defaultValue${f}`]||t.defaultValue;!this.isValidLookup(d)&&h&&(r=!0,d=v),this.isValidLookup(d)||(s=!0,d=i);const m=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&s?void 0:d,y=h&&v!==d&&this.options.updateMissing;if(s||r||y){if(this.logger.log(y?"updateKey":"missingKey",l,a,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=h&&r!==d?r:m;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,n,o,y,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,a,n,o,y,t),this.emit("missingKey",e,a,n,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&u?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,c,n),s&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${a}:${i}`),(s||r)&&this.options.parseMissingKeyHandler&&(d="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${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(h,d,{...t,ns:s}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(c.res=e,c.usedParams=this.getUsedParamsDetails(t),c):e}if(o){const e=Array.isArray(d),n=e?[]:{},r=e?p:h;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:s}),n[e]===i&&(n[e]=d[e])}d=n}}return r?(c.res=d,c.usedParams=this.getUsedParamsDetails(t),c):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 s=Gi(e)&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(s){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=n.replace&&!Gi(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),s){const t=e.match(this.interpolator.nestingRegexp);a<(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),s=0;s<e;s++)r[s]=arguments[s];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 s=n.postProcess||this.options.postProcess,a=Gi(s)?[s]:s;return null!=e&&a&&a.length&&!1!==n.applyPostProcessor&&(e=ms.handle(a,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,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Gi(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(t))return;const a=this.extractFromKey(e,s),l=a.key;n=l;let u=a.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const c=void 0!==s.count&&!Gi(s.count),d=c&&!s.ordinal&&0===s.count&&this.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&(Gi(s.context)||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);u.forEach(e=>{this.isValidLookup(t)||(i=e,!ys[`${p[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(ys[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${p.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!!!")),p.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,s);else{let e;c&&(e=this.pluralResolver.getSuffix(n,s.count,s));const t=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(i.push(l+e),s.ordinal&&0===e.indexOf(r)&&i.push(l+e.replace(r,this.options.pluralSeparator)),d&&i.push(l+t)),h){const n=`${l}${this.options.contextSeparator}${s.context}`;i.push(n),c&&(i.push(n+e),s.ordinal&&0===e.indexOf(r)&&i.push(n+e.replace(r,this.options.pluralSeparator)),d&&i.push(n+t))}}let a;for(;a=i.pop();)this.isValidLookup(t)||(r=a,t=this.getResource(n,e,a,s))}))})}),{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&&!Gi(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 ws=e=>e.charAt(0).toUpperCase()+e.slice(1);class Es{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=fs.create("languageUtils")}getScriptPartFromCode(e){if(!(e=ds(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=ds(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Gi(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]=ws(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]=ws(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=ws(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)),Gi(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 Gi(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))):Gi(e)&&o(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&o(this.formatLanguageCode(e))}),r}}let xs=[{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}],Ss={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 _s=["v1","v2","v3"],Os=["v4"],ks={zero:0,one:1,two:2,few:3,many:4,other:5};class Cs{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=fs.create("pluralResolver"),this.options.compatibilityJSON&&!Os.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 xs.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Ss[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=ds("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)=>ks[e]-ks[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!_s.includes(this.options.compatibilityJSON)}}const Ts=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=rs(e,n);return void 0!==r?r:rs(t,n)})(e,t,n);return!i&&o&&Gi(n)&&(i=cs(e,n,r),void 0===i&&(i=cs(t,n,r))),i},Ns=e=>e.replace(/\$/g,"$$$$");class Ps{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=fs.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:s,suffixEscaped:a,formatSeparator:l,unescapeSuffix:u,unescapePrefix:c,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:p,nestingSuffixEscaped:f,nestingOptionsSeparator:g,maxReplaces:v,alwaysFormat:m}=e.interpolation;this.escape=void 0!==t?t:as,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==r&&r,this.prefix=o?is(o):i||"{{",this.suffix=s?is(s):a||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=d?is(d):h||is("$t("),this.nestingSuffix=p?is(p):f||is(")"),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,s;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const o=Ts(t,a,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(),s=o.join(this.formatSeparator).trim();return this.format(Ts(t,a,i,this.options.keySeparator,this.options.ignoreJSONStructure),s,n,{...r,...t,interpolationkey:i})};this.resetRegExp();const u=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,c=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Ns(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Ns(this.escape(e)):Ns(e)}].forEach(t=>{for(s=0;o=t.regex.exec(e);){const n=o[1].trim();if(i=l(n),void 0===i)if("function"==typeof u){const t=u(e,o,r);i=Gi(t)?t:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))i="";else{if(c){i=o[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else Gi(i)||this.useRawValueToEscape||(i=Yi(i));const a=t.safeValue(i);if(e=e.replace(o[0],a),c?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,t){let n,r,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=(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 s=i.match(/'/g),a=i.match(/"/g);(s&&s.length%2==0&&!a||a.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 a=[];o={...i},o=o.replace&&!Gi(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(),a=e,l=!0}if(r=t(s.call(this,n[1].trim(),o),o),r&&n[0]===e&&!Gi(r))return r;Gi(r)||(r=Yi(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),l&&(r=a.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 Rs=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 s=r+JSON.stringify(i);let a=t[s];return a||(a=e(ds(r),o),t[s]=a),a(n)}};class Ms{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=fs.create("formatter"),this.options=e,this.formats={number:Rs((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:Rs((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:Rs((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:Rs((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:Rs((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()]=Rs(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 s=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},a=s.locale||s.lng||r.locale||r.lng||n;t=this.formats[o](e,a,{...i,...r,...s})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e);return i}}class Ls extends gs{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=fs.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={},s={},a={};return e.forEach(e=>{let r=!0;t.forEach(t=>{const s=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[s]=2:this.state[s]<0||(1===this.state[s]?void 0===i[s]&&(i[s]=!0):(this.state[s]=1,r=!1,void 0===i[s]&&(i[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===a[t]&&(a[t]=!0)))}),r||(s[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(s),toLoadNamespaces:Object.keys(a)}}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 s={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:r,k:o}=ts(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=>{s[e]||(s[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===s[e][t]&&(s[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",s),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 s=(s,a)=>{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)}s&&a&&r<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,n,r+1,2*o,i)},o):i(s,a)},a=this.backend[n].bind(this.backend);if(2!==a.length)return a(e,t,s);try{const n=a(e,t);n&&"function"==typeof n.then?n.then(e=>s(null,e)).catch(s):s(null,n)}catch(e){s(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();Gi(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Gi(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]:{},s=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 a={...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,a):l(e,t,n,r),o&&"function"==typeof o.then?o.then(e=>s(null,e)).catch(s):s(null,o)}catch(e){s(e)}else l(e,t,n,r,s,a)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}const $s=()=>({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]),Gi(e[1])&&(t.defaultValue=e[1]),Gi(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}}),Ds=e=>(Gi(e.ns)&&(e.ns=[e.ns]),Gi(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Gi(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Fs=()=>{};class As extends gs{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=Ds(e),this.services={},this.logger=fs,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&&(Gi(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=$s();this.options={...r,...this.options,...Ds(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?fs.init(o(this.modules.logger),this.options):fs.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Ms);const n=new Es(this.options);this.store=new vs(this.options.resources,this.options);const i=this.services;i.logger=fs,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new Cs(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 Ps(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Ls(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 bs(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=Fs),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=Xi(),s=()=>{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?s():setTimeout(s,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fs;const n=Gi(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=Xi();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=Fs),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&&ms.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=Xi();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)})},s=t=>{e||t||!this.services.languageDetector||(t=[]);const n=Gi(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(s):this.services.languageDetector.detect(s):s(e):s(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 s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];i=r.options.overloadTranslationOptionHandler([e,t].concat(a))}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 u=r.options.keySeparator||".";let c;return c=i.keyPrefix&&Array.isArray(e)?e.map(e=>`${i.keyPrefix}${u}${e}`):i.keyPrefix?`${i.keyPrefix}${u}${e}`:e,r.t(c,i)};return Gi(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=Xi();return this.options.ns?(Gi(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=Xi();Gi(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 Es($s());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 As(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]:Fs;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new As(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 vs(this.store.data,r),o.services.resourceStore=o.store),o.translator=new bs(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 js=As.createInstance();js.createInstance=As.createInstance,js.createInstance,js.dir,js.init,js.loadResources,js.reloadResources,js.use,js.changeLanguage,js.getFixedT,js.t,js.exists,js.setDefaultNamespace,js.hasLoadedNamespace,js.loadNamespaces,js.loadLanguages;var Is="translation";function Us(e){return js.on("languageChanged",e),function(){return js.off("languageChanged",e)}}js.init({lng:"zh-CN",resources:{}});var Bs=js.t.bind(js);function Hs(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&&Hs(t)}}function zs(){return a('<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 Ws(){return a('<div class="w-e-bar-divider"></div>')}function Vs(e,t,n,r,o){if(void 0===r&&(r=""),void 0===o&&(o=!1),t){if(r){var i=bo?"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 s=r?"".concat(n,"\n").concat(r):n;e.attr("data-tooltip",s),e.addClass("w-e-menu-tooltip-v5")}}}var qs=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=a('<div class="w-e-bar-item"></div>'),this.$button=a('<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 s=t.title,l=t.hotkey,u=void 0===l?"":l,c=t.iconSvg,d=void 0===c?"":c,h=this.$button;if(d){var p=a(d);Hs(p),h.append(p)}else h.text(s);Vs(h,d,s,u,n),n&&d&&h.append(a('<span class="title">'.concat(s,"</span>"))),i&&h.css("width","".concat(i,"px")),h.attr("data-menu-key",e),this.$elem.append(h),mn(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",function(t){t.preventDefault(),ra(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick())})},e.prototype.exec=function(){var e=ra(this),t=this.menu,n=t.getValue(e);t.exec(e,n),this.changeMenuState()},e.prototype.setActive=function(){var e=ra(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n)},e.prototype.setDisabled=function(){var e=ra(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=ra(this),t=this.$button;if(this.menu.getIcon){var n=this.menu.getIcon(e);if(n){t.find("svg").remove();var r=a(n);Hs(r),t.append(r)}}},e.prototype.setTooltip=function(){var e=ra(this),t=this.$button;if(this.menu.getTitle){var n=this.menu.getTitle(e),r=this.menu.iconSvg;n&&r&&Vs(t,r,n)}},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled(),this.setIcon(),this.setTooltip()},e}(),Ks=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}(qs),Js=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e)}return e.prototype.record=function(e){var t=Jn.get(e);null==t&&(t=new Set,Jn.set(e,t)),t.add(this),Gn.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=Gn.get(this);e&&e.emit(jn,this)}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=Gn.get(this);e&&e.emit(In)}},e}(),Gs=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=a('<div class="w-e-drop-panel"></div>'),n}return g(t,e),t.prototype.genSelfElem=function(){return null},t}(Js),Xs=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=zs();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=ra(this);if(null==this.dropPanel){var n=new Gs(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 s=this.$elem,a=s.offset().left,l=s.parents(".w-e-bar");a-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"})}}},t}(qs),Ys=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=a('<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=a('<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=Gn.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}(Js);var Qs=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=a("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=ra(this),t=this.menu.getModalPositionNode(e);return i.Element.isElement(t)?qi(e,t,"modal"):Vi(e)},t.prototype.handleModal=function(){var e=ra(this),t=this.menu;if(null==this.modal){var n=new Ys(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=ra(this),r=this.menu;if(null!=r.getModalContentElem){var o=To.getTextarea(n),i=To.getToolbar(n),s=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,a=r.getModalContentElem(n);if(e.renderContent(a),s)e.setStyle({left:"0",right:"0"});else{var l=this.getPosition();e.setStyle(l)}t&&(s?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),s||Ki(n,e.$elem),setTimeout(function(){n.blur()})}},t}(qs);var Zs=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=a('<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=a("<ul></ul>");e.forEach(function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,s=a('<li data-value="'.concat(t,'"></li>'));if(i&&s.css(i),o){var l=a('<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>');s.append(l),s.addClass("selected")}s.append(a('<span data-value="'.concat(t,'">').concat(r,"</span>"))),s.attr("title",r),n.append(s)}),t.append(n)},t.prototype.genSelfElem=function(){return null},t}(Js);var ea=function(){function e(e,t,n){void 0===n&&(n=!1);var r=this;this.$elem=a('<div class="w-e-bar-item"></div>'),this.$button=a('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,s=t.width,l=t.iconSvg,u=void 0===l?"":l,c=t.hotkey,d=void 0===c?"":c;if("select"!==o)throw new Error("Invalid tag '".concat(o,"', expected 'select'"));var h=this.$button;s&&h.css("width","".concat(s,"px")),h.attr("data-menu-key",e),Vs(h,u,i,d,n),this.$elem.append(h),this.menu=t,mn(function(){return r.init()})}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",function(t){t.preventDefault(),ra(e).hidePanelOrModal(),e.trigger()})},e.prototype.trigger=function(){var e=this,t=ra(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new Zs(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=a(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=ra(this),n=this.menu;n.exec&&n.exec(t,e)},e.prototype.setSelectedValue=function(){var e=ra(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o++){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=zs();o.empty(),o.text(r),o.append(i)},e.prototype.setDisabled=function(){var e=ra(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}(),ta=function(){function e(e){this.$elem=a('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=a('<div class="w-e-bar-item-menus-container"></div>'),this.$button=a('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var s=a(n);Hs(s),i.append(s)}else i.text(r);i.attr("data-menu-key",t);var l=zs();i.append(l),o.append(i);var u=this.$container;o.append(u);var c=this.createObserver();this.observe(c)}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 s=0;o.each(function(e){a(e).hasClass("disabled")&&s++}),r.disconnect(),s===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r)}});return r},e}(),na=new WeakMap;function ra(e){var t=Kn.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function oa(e,t,n){void 0===n&&(n=!1);var r=na.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,s=t.showModal;r=i?new Xs(e,t,n):s?new Qs(e,t,n):new Ks(e,t,n)}if("select"===o&&(r=new ea(e,t,n)),null==r)throw new Error("Invalid tag in menu ".concat(JSON.stringify(t)));return na.set(t,r),r}function ia(e,t){var n=e.selection;return null!=n&&(!i.Range.isCollapsed(n)&&(!To.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 sa=function(){function e(){var e=this;this.$elem=a('<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=u(function(){var t=e.isShow,n=e.getSelectedNodeAndMenuKeys()||{},r=n.node,o=void 0===r?null:r,s=n.menuKeys,a=void 0===s?[]:s,l=e.getEditorInstance();if(null!=o&&e.changeItemsState(),o&&i.Element.isElement(o)&&t){var u=e.isSamePath(o,e.prevSelectedNode);if(!i.Editor.isBlock(l,o)&&u)return}e.hideAndClean(),null!=o&&(e.registerItems(a),e.setPosition(o),e.show()),e.prevSelectedNode=o},200),mn(function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",function(e){return e.preventDefault()},{passive:!1}),To.getTextarea(t).$textAreaContainer.append(n),t.on($n,e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on(Dn,r),t.on(Fn,r),t.on(An,r)}),this.lngListen=Us(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;mn(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=Ws();n.append(r)}})},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=Un[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 s=oa(e,r);this.hoverbarItems.push(s),Kn.set(s,t),this.$elem.append(s.$elem)},e.prototype.setPosition=function(e){var t=this.getEditorInstance(),n=this.$elem;if(n.attr("style",""),i.Element.isElement(e)){var r=qi(t,e,"bar");return n.css(r),void Ki(t,n)}if(i.Text.isText(e)){r=Vi(t);return n.css(r),void Ki(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 s=t[o],a=s.match,l=s.menuKeys,u=void 0===l?[]:l,c=a||function(e,t){return To.checkNodeType(t,o)},d=y(i.Editor.nodes(e,{match:function(t){return c(e,t)},universal:!0}),1),h=d[0];if(null!=h)return n=h[0],r=u,"break"};for(var s in t){if("break"===o(s))break}return null==n||0===r.length?null:{node:n,menuKeys:r}},e.prototype.getEditorInstance=function(){var e=Vn.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=ia),t},e.prototype.isSamePath=function(e,t){if(null==e||null==t)return!1;var n=To.findPath(null,e),r=To.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 aa(e,t){return $r(t)&&To.hasDOMNode(e,t,{editable:!0})}function la(e,t){return $r(t)&&To.hasDOMNode(e,t)}function ua(e,t){return aa(e,t)||function(e,t){if(e.getConfig().readOnly)return!1;var n=la(e,t)&&To.toSlateNode(e,t);return!!n&&i.Element.isElement(n)&&i.Editor.isVoid(e,n)}(e,t)}const ca=e=>"object"==typeof e&&null!=e&&1===e.nodeType,da=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,ha=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return da(n.overflowY,t)||da(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},pa=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,fa=e=>{const t=e.parentElement;return null==t?e.getRootNode().host||null:t},ga=(e,t)=>{var n,r,o,i;if("undefined"==typeof document)return[];const{scrollMode:s,block:a,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,d="function"==typeof u?u:e=>e!==u;if(!ca(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let f=e;for(;ca(f)&&d(f);){if(f=fa(f),f===h){p.push(f);break}null!=f&&f===document.body&&ha(f)&&!ha(document.documentElement)||null!=f&&ha(f,c)&&p.push(f)}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:_}=e.getBoundingClientRect(),{top:O,right:k,bottom:C,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 N="start"===a||"nearest"===a?E-O:"end"===a?S+C:E+b/2-O+C,P="center"===l?_+w/2-T+k:"end"===l?x+k:_-T;const R=[];for(let e=0;e<p.length;e++){const t=p[e],{height:n,width:r,top:o,right:i,bottom:u,left:c}=t.getBoundingClientRect();if("if-needed"===s&&E>=0&&_>=0&&S<=v&&x<=g&&(t===h&&!ha(t)||E>=o&&S<=u&&_>=c&&x<=i))return R;const d=getComputedStyle(t),f=parseInt(d.borderLeftWidth,10),O=parseInt(d.borderTopWidth,10),k=parseInt(d.borderRightWidth,10),C=parseInt(d.borderBottomWidth,10);let T=0,M=0;const L="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-k:0,$="offsetHeight"in t?t.offsetHeight-t.clientHeight-O-C:0,D="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,F="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(h===t)T="start"===a?N:"end"===a?N-v:"nearest"===a?pa(y,y+v,v,O,C,y+N,y+N+b,b):N-v/2,M="start"===l?P:"center"===l?P-g/2:"end"===l?P-g:pa(m,m+g,g,f,k,m+P,m+P+w,w),T=Math.max(0,T+y),M=Math.max(0,M+m);else{T="start"===a?N-o-O:"end"===a?N-u+C+$:"nearest"===a?pa(o,u,n,O,C+$,N,N+b,b):N-(o+n/2)+$/2,M="start"===l?P-c-f:"center"===l?P-(c+r/2)+L/2:"end"===l?P-i+k+L:pa(c,i,r,f,k+L,P,P+w,w);const{scrollLeft:e,scrollTop:s}=t;T=0===F?0:Math.max(0,Math.min(s+T/F,t.scrollHeight-n/F+$)),M=0===D?0:Math.max(0,Math.min(e+M/D,t.scrollWidth-r/D+L)),N+=s-T,P+=e-M}R.push({el:t,top:T,left:M})}return R};function va(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(ga(e,t));const r="boolean"==typeof t||null==t?void 0:t.behavior;for(const{el:o,top:i,left:s}of ga(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=s-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}function ma(e){null!=e.selection&&(e.selection=null,e.onChange())}function ya(e,t,n){void 0===n&&(n=!1);var r=t.selection,o=t.getConfig(),s=To.findDocumentOrShadowRoot(t).getSelection();if(s&&(!e.isComposing||n)&&t.isFocused()){var a="None"!==s.type;if(r||a){var l=or.get(t),u=!1;if(l.contains(s.anchorNode)&&l.contains(s.focusNode)&&(u=!0),a&&u&&r){var c=To.toSlateRange(t,s,{exactMatch:!0,suppressThrow:!0});if(c&&i.Range.equals(c,r)){var d=!0;if(i.Range.isCollapsed(r)){var h=s.anchorNode,p=s.anchorOffset;if(h===l){var f=l.childNodes,g=void 0;(g=f[p])&&g.matches("table")&&(d=!1),(g=f[p-1])&&g.matches("table")&&(d=!1)}}if(d)return}}if(!r||To.hasRange(t,r)){e.isUpdatingSelection=!0;var v=null;try{v=r&&To.toDOMRange(t,r)}catch(e){v=null}if(v){i.Range.isBackward(r)?s.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):s.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;va(m,{scrollMode:"if-needed",boundary:o.scroll&&l.parentElement||b,block:"end",behavior:"smooth"}),delete m.getBoundingClientRect}}else s.removeAllRanges();setTimeout(function(){v&&wo&&l.focus(),e.isUpdatingSelection=!1})}else t.selection=To.toSlateRange(t,s,{exactMatch:!1,suppressThrow:!0})}}}var ba=new WeakMap,wa=new WeakMap;function Ea(e){var t;try{t=To.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 xa={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"},Sa={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"},_a={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Oa=function(e){var t=xa[e],n=Sa[e],r=_a[e],o=t&&c.isKeyHotkey(t),i=n&&c.isKeyHotkey(n),s=r&&c.isKeyHotkey(r);return function(e){return!(!o||!o(e))||(!!(bo&&i&&i(e))||!(bo||!s||!s(e)))}},ka={isBold:Oa("bold"),isCompose:Oa("compose"),isMoveBackward:Oa("moveBackward"),isMoveForward:Oa("moveForward"),isDeleteBackward:Oa("deleteBackward"),isDeleteForward:Oa("deleteForward"),isDeleteLineBackward:Oa("deleteLineBackward"),isDeleteLineForward:Oa("deleteLineForward"),isDeleteWordBackward:Oa("deleteWordBackward"),isDeleteWordForward:Oa("deleteWordForward"),isExtendBackward:Oa("extendBackward"),isExtendForward:Oa("extendForward"),isExtendLineBackward:Oa("extendLineBackward"),isExtendLineForward:Oa("extendLineForward"),isItalic:Oa("italic"),isMoveLineBackward:Oa("moveLineBackward"),isMoveLineForward:Oa("moveLineForward"),isMoveWordBackward:Oa("moveWordBackward"),isMoveWordForward:Oa("moveWordForward"),isRedo:Oa("redo"),isSplitBlock:Oa("splitBlock"),isTransposeCharacter:Oa("transposeCharacter"),isUndo:Oa("undo"),isTab:Oa("tab"),isSelectAll:Oa("selectAll")};function Ca(e){e.preventDefault()}var Ta={beforeinput:function(e,t,n){var r,o=e,s=n.getConfig().readOnly;if(Oo&&!s&&aa(n,o.target)){null===(r=t.flushDOMSelectionChange)||void 0===r||r.call(t);var a=n.selection,l=o.inputType,u=o.dataTransfer||o.data||void 0;if("insertCompositionText"!==l&&"deleteCompositionText"!==l){if(o.preventDefault(),!l.startsWith("delete")||l.startsWith("deleteBy")){var c=y(o.getTargetRanges(),1)[0];if(c){var d=To.toSlateRange(n,c,{exactMatch:!1,suppressThrow:!1});a&&i.Range.equals(a,d)||i.Transforms.select(n,d)}}if(a&&i.Range.isExpanded(a)){var h=To.getSelectedElems(n),p="table"===h[0].type,f="table-cell"!==h[h.length-1].type;if(p&&f)return;if(l.startsWith("delete")){var g=l.endsWith("Backward")?"backward":"forward";return void i.Editor.deleteFragment(n,{direction:g})}}switch(l){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":case"insertParagraph":i.Editor.insertBreak(n);break;case"insertFromDrop":case"insertFromComposition":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromComposition"===l&&(t.isComposing=!1,fr.set(n,!0)),"insertFromPaste"===l&&!pr.get(n))break;Nr(u)?n.insertData(u):"string"==typeof u&&i.Editor.insertText(n,u)}}}},blur:function(e,t,n){var r=e,o=t.isUpdatingSelection,s=t.latestElement;if(!n.getConfig().readOnly&&!o&&aa(n,r.target)){var a=To.findDocumentOrShadowRoot(n);if(s!==a.activeElement){var l=r.relatedTarget;if(!(l===To.toDOMNode(n,n)||Fr(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&$r(l)&&To.hasDOMNode(n,l)){var u=To.toSlateNode(n,l);if(i.Element.isElement(u)&&!n.isVoid(u))return}if(Eo){var c=a.getSelection();null==c||c.removeAllRanges()}cr.delete(n)}}}},focus:function(e,t,n){var r=To.toDOMNode(n,n),o=To.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,wo&&e.target!==r?r.focus():cr.set(n,!0)},click:function(e,t,n){if(!n.getConfig().readOnly&&la(n,e.target)&&$r(e.target)){var r=To.toSlateNode(n,e.target),o=To.findPath(n,r);if(i.Editor.hasPath(n,o))if(i.Node.get(n,o)===r){var s=i.Editor.start(n,o),a=i.Editor.end(n,o),l=i.Editor.void(n,{at:s}),u=i.Editor.void(n,{at:a});if(l&&u&&i.Path.equals(l[1],u[1])){var c=i.Editor.range(n,s);i.Transforms.select(n,c)}}}},compositionstart:function(e,t,n){if(aa(n,e.target)){gr.delete(n);var r=n.selection;if(r&&i.Range.isCollapsed(r)){var o=Ea(n);if(o){var s=o.textContent||"";ba.set(n,s),wa.set(n,o)}}r&&i.Range.isExpanded(r)&&(i.Editor.deleteFragment(n),Promise.resolve().then(function(){ya(t,n,!0)})),t.isComposing=!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(aa(n,r.target)){t.isComposing=!1;var o=!0===fr.get(n);o?(fr.delete(n),gr.delete(n)):gr.delete(n);var s=n.selection;if(null!=s){(_o||wo)&&To.cleanExposedTexNodeInSelectionBlock(n);for(var a=i.Range.isBackward(s)?s.focus:s.anchor,l=y(i.Editor.node(n,[a.path[0]]),1)[0],u=0;u<a.path.length;u+=1){var c=y(i.Editor.node(n,a.path.slice(0,u+1)),1)[0];if(i.Element.isElement(c)&&((Eo||wo)&&"link"===c.type||"code"===c.type)){To.setNewKey(l);break}}var d=r.data;if(d&&!o){if(n.getConfig().maxLength){var h=To.getLeftLengthOfMaxLength(n);if(h<d.length){var p=Ea(n);p&&p.nodeType===Node.TEXT_NODE&&(p.textContent=ba.get(n)||""),h>0&&i.Editor.insertText(n,d.slice(0,h)),t.changeViewState()}else i.Editor.insertText(n,d)}else{var f=To.findDocumentOrShadowRoot(n).getSelection();if(f&&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),s=0===n.offset?n.path:r.path,a=[s[0],s[1]-1];if(0===s[1])return!1;var l=i.Editor.node(e,a);if(i.Text.isText(l[0])&&i.Text.isText(o[0]))return!0}}}(n,s)){var g=To.toSlateRange(n,f,{exactMatch:!1,suppressThrow:!1});g&&(n.selection=g)}i.Editor.insertText(n,d)}Eo||setTimeout(function(){if(null!=n.selection){var e=wa.get(n);if(null!=e){var t=Ea(n);null!=t&&t!==e&&(e.textContent=ba.get(n)||"")}}})}}}},compositionupdate:function(e,t,n){aa(n,e.target)&&(t.isComposing=!0)},keydown:function(e,t,n){var r=e,o=n.selection;if(!n.getConfig().readOnly&&!t.isComposing&&aa(n,r.target)){if(function(e,t){var n=Wn.get(e),r=n&&n.getMenus(),o=qn.get(e),i=o&&o.getMenus(),s=v(v({},r),i);for(var a in s){var l=s[a],u=l.hotkey;if(u&&c.isHotkey(u,t)&&!l.isDisabled(e)){var d=l.getValue(e);l.exec(e,d)}}}(n,r),ka.isTab(r))return Ca(r),void n.handleTab();if(ka.isRedo(r))return Ca(r),void("function"==typeof n.redo&&n.redo());if(ka.isUndo(r))return Ca(r),void("function"==typeof n.undo&&n.undo());if(ka.isMoveLineBackward(r))return Ca(r),void i.Transforms.move(n,{unit:"line",reverse:!0});if(ka.isMoveLineForward(r))return Ca(r),void i.Transforms.move(n,{unit:"line"});if(ka.isExtendLineBackward(r))return Ca(r),void i.Transforms.move(n,{unit:"line",edge:"focus",reverse:!0});if(ka.isExtendLineForward(r))return Ca(r),void i.Transforms.move(n,{unit:"line",edge:"focus"});if(ka.isMoveBackward(r))return Ca(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n,{reverse:!0}):i.Transforms.collapse(n,{edge:"start"}));if(ka.isMoveForward(r))return Ca(r),void(o&&i.Range.isCollapsed(o)?i.Transforms.move(n):i.Transforms.collapse(n,{edge:"end"}));if(ka.isMoveWordBackward(r))return Ca(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word",reverse:!0});if(ka.isMoveWordForward(r))return Ca(r),o&&i.Range.isExpanded(o)&&i.Transforms.collapse(n,{edge:"focus"}),void i.Transforms.move(n,{unit:"word"});if(ka.isSelectAll(r))return Ca(r),void n.selectAll();if(Oo){if((_o||Eo)&&o&&(ka.isDeleteBackward(r)||ka.isDeleteForward(r))&&i.Range.isCollapsed(o)){var s=i.Node.parent(n,o.anchor.path);if(i.Element.isElement(s)&&i.Editor.isVoid(n,s)&&i.Editor.isInline(n,s))return r.preventDefault(),void i.Transforms.delete(n,{unit:"block"})}}else{if(ka.isBold(r)||ka.isItalic(r)||ka.isTransposeCharacter(r))return void Ca(r);if(ka.isSplitBlock(r))return Ca(r),void i.Editor.insertBreak(n);if(ka.isDeleteBackward(r))return Ca(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n));if(ka.isDeleteForward(r))return Ca(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n));if(ka.isDeleteLineBackward(r))return Ca(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"line"}));if(ka.isDeleteLineForward(r))return Ca(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"line"}));if(ka.isDeleteWordBackward(r))return Ca(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"backward"}):i.Editor.deleteBackward(n,{unit:"word"}));if(ka.isDeleteWordForward(r))return Ca(r),void(o&&i.Range.isExpanded(o)?i.Editor.deleteFragment(n,{direction:"forward"}):i.Editor.deleteForward(n,{unit:"word"}))}}},keypress:function(e,t,n){if(!Oo&&!n.getConfig().readOnly&&aa(n,e.target)){e.preventDefault();var r=e.key;i.Editor.insertText(n,r)}},copy:function(e,t,n){var r=e;if(aa(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(),aa(n,r.target))){var s=r.clipboardData;if(null!=s&&(n.setFragmentData(s),o))if(i.Range.isExpanded(o))i.Editor.deleteFragment(n);else{var a=i.Node.parent(n,o.anchor.path);i.Element.isElement(a)&&i.Editor.isVoid(n,a)&&i.Transforms.delete(n)}}},paste:function(e,t,n){pr.set(n,!0);var r=e;if(!n.getConfig().readOnly&&aa(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return pr.set(n,!1),void r.preventDefault();if(Eo||!Oo||Ir(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i)}}},dragover:function(e,t,n){if(la(n,e.target)){var r=To.toSlateNode(n,e.target);i.Element.isElement(r)&&i.Editor.isVoid(n,r)&&e.preventDefault()}},dragstart:function(e,t,n){var r=e;if(la(n,r.target)&&!n.getConfig().readOnly){var o=To.toSlateNode(n,r.target),s=To.findPath(n,o);if(i.Element.isElement(o)&&i.Editor.isVoid(n,o)||i.Editor.void(n,{at:s,voids:!0})){var a=i.Editor.range(n,s);i.Transforms.select(n,a)}var l=r.dataTransfer;if(null!=l)To.getSelectedNodeByType(n,"table")||(t.isDraggingInternally=!0,n.setFragmentData(l))}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&la(n,r.target)&&(t.isDraggingInternally=!1)},drop:function(e,t,n){var r=e,o=r.dataTransfer;if(!n.getConfig().readOnly&&la(n,r.target)&&null!=o&&!(Oo&&Eo&&o.files.length>0)){r.preventDefault();var s=n.selection,a=To.findEventRange(n,r);i.Transforms.select(n,a),t.isDraggingInternally&&(s&&i.Transforms.delete(n,{at:s}),t.isDraggingInternally=!1),n.insertData(o),n.isFocused()||n.focus()}}},Na=[];var Pa={};function Ra(e,t,n){var r=n.isInline(e)?"span":"div";return d.jsx(r,null,t)}function Ma(e,t){var n,r=To.findKey(t,e),o=t.isInline(e),s=i.Editor.isVoid(t,e),a=ho(e.type,r.id),l={id:a,key:r.id,"data-slate-node":"element","data-slate-inline":o},u=e.type,c=e.children,h=void 0===c?[]:c,p=function(e){return Pa[e]||Ra}(u);n=s?null:h.map(function(n,r){return Fa(n,r,e,t)});var f=p(e,n,t);if(s){l["data-slate-void"]=!0;var g=o?"span":"div",v=y(i.Node.texts(e),1),m=y(v[0],1)[0],b=Fa(m,0,e,t),w=d.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},b);f=d.jsx(g,{style:{position:"relative"}},f,w),nr.set(m,0),rr.set(m,e)}return null==f.data&&(f.data={}),Object.assign(f.data,l),s||o||(f=function(e,t,n){var r=t;return Na.forEach(function(t){r=t(e,r,n)}),r}(e,f,t)),mn(function(){var t=Hr(a);null!=t&&(sr.set(r,t),ar.set(e,t),ir.set(t,e))}),f}function La(e,t){return void 0===t&&(t=!1),d.jsx("span",{"data-slate-string":!0},t?e+"\n":e)}function $a(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),d.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?d.jsx("br",null):null)}function Da(e,t,n){if(null==e.text)throw new Error("Current node is not slate Text ".concat(JSON.stringify(e)));var r=To.findKey(n,e),o=n.getConfig().decorate;if(null==o)throw new Error("Can not get config.decorate");var s,a=To.findPath(n,e),l=o([e,a]),u=i.Text.decorations(e,l),c=u.map(function(r){var o,s=r.leaf,a=r.position,l=function(e,t,n,r,o){void 0===t&&(t=!1);var s=e.text,a=To.findPath(o,n),l=i.Path.parent(a);if(i.Editor.isEditor(r))throw new Error("Text node ".concat(JSON.stringify(n)," parent is Editor"));return o.isVoid(r)?$a(i.Node.string(r).length):""!==s||r.children[r.children.length-1]!==n||o.isInline(r)||""!==i.Editor.string(o,l)?""===s?$a():t&&"\n"===s.slice(-1)?La(s,!0):La(s):$a(0,!0)}(s,null!==(o=null==a?void 0:a.isLast)&&void 0!==o?o:1===u.length,e,t,n);return l=function(e,t,n){var r=t;return Na.forEach(function(t){r=t(e,r,n)}),r}(s,l,n),d.jsx("span",{"data-slate-leaf":!0},l)}),h=(s=r.id,"w-e-text-".concat(s)),p=d.jsx("span",{"data-slate-node":"text",id:h,key:r.id},c);return mn(function(){var t=Hr(h);null!=t&&(sr.set(r,t),ar.set(e,t),ir.set(t,e))}),p}function Fa(e,t,n,r){return nr.set(e,t),rr.set(e,n),i.Element.isElement(e)?Ma(e,r):Da(e,n,r)}var Aa=["props","attrs","style","dataset","on","hook"];function ja(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(!Aa.includes(t)){if(t.startsWith("data-")){var s=t.slice(5);return s=h(s),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={});Object.assign(n.dataset,t)}(e,((r={})[s]=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&&ja(e)})}function Ia(e,t){var n,r,o=e.$scroll,s=(n=e.id,"w-e-textarea-".concat(n)),l=t.getConfig(),u=l.readOnly,c=l.autoFocus,h=function(e,t){return void 0===t&&(t=!1),d.h("div#".concat(e),{props:{contentEditable:!t}})}(s,u),p=t.children||[];h.children=p.map(function(e,n){if(er.has(e)){var r=er.get(e);if(r){var o=y(r,2),s=o[0],a=o[1];if(a)return s!==n&&(nr.set(e,n),er.set(e,[n,a])),a}}var l=Fa(e,n,t,t);ja(l);var u=t.getConfig().skipCacheTypes,c=void 0===u?["list-item"]:u;return i.Element.isElement(e)&&c.includes(e.type)||er.set(e,[n,l]),l});var f=Yn.get(e);if(null==f&&(f=!0),f){var g=function(e){return a('<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>'))}(s);o.append(g),e.$textArea=g,r=g[0],(m=d.init([d.classModule,d.propsModule,d.styleModule,d.datasetModule,d.eventListenersModule,d.attributesModule]))(r,h),Yn.set(e,!1),Qn.set(e,m)}else{var v=Zn.get(e),m=Qn.get(e);if(null==v||null==m)return;r=v.elm,m(v,h)}if(null!=r||null!=(r=Hr(s))){if((f?c:t.isFocused())&&r.focus({preventScroll:!0}),f){var b=Lr(r);b&&ur.set(t,b)}or.set(t,r),ar.set(t,r),ir.set(r,t),Zn.set(e,h)}}var Ua=1,Ba=function(){function e(e){var t=this;this.selectionChangeRoot=null,this.destroyed=!1,this.id=Ua++,this.$textArea=null,this.$progressBar=a('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=a('<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=n(function(e){var n=Fr(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,s=t.getConfig();if(!r&&!o){var a=To.findDocumentOrShadowRoot(t),l=a.activeElement,u=To.toDOMNode(t,t),c=a.getSelection();if(l!==u)return cr.delete(t),void ma(t);if(e.latestElement=l,cr.set(t,!0),!c)return ma(t);var d=c.anchorNode,h=c.focusNode,p=ua(t,d),f=la(t,h);if(!n)if(p&&f){var g=To.toSlateRange(t,c,{exactMatch:!1,suppressThrow:!0});g&&i.Transforms.select(t,g)}else s.readOnly&&ma(t)}}(t,o)}},100);var r=a(e);if(0===r.length)throw new Error("Cannot find textarea DOM by selector '".concat(e,"'"));this.$box=r;var o=a('<div class="w-e-text-container"></div>');o.append(this.$progressBar),o.append(this.$maxLengthInfo),r.append(o);var s=a('<div class="w-e-scroll"></div>');o.append(s),this.$scroll=s,this.$textAreaContainer=o,mn(function(){var e=t.getActiveEditor();if(null!=e){t.bindSelectionChange(e),o.on("click",function(){return e.hidePanelOrModal()}),e.on($n,t.changeViewState.bind(t));var n=e.getConfig(),i=n.onChange,s=n.scroll;i&&e.on($n,function(){return i(e)}),s||(r.css("position","relative"),o.addClass("no-scroll")),t.onFocusAndOnBlur(),e.on($n,t.changeMaxLengthInfo.bind(t)),t.bindEvent()}})}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=Hn.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=Hn.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=To.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(Ln,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,o=this.$scroll,i=this.editorInstance;null!=t&&(r(Ta,function(n,r){t.on(r,function(t){n(t,e,i)})}),i.getConfig().scroll&&(o.css("overflow-y","auto"),o.on("scroll",n(function(){i.emit(Dn)},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($n,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-To.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&&(Ia(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=a('<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),mn(function(){e.destroyed||t.isDestroyed||ya(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 Ha(e,t,n,r){if(nr.set(e,t),rr.set(e,n),i.Element.isElement(e)){var o=e.children;if((void 0===o?[]:o).forEach(function(t,n){return Ha(t,n,e,r)}),i.Editor.isVoid(r,e)){var s=y(i.Node.texts(e),1),a=y(s[0],1)[0];nr.set(a,0),rr.set(a,e)}}}var za=function(){function e(e,t){var n=this;this.$toolbar=a('<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=u(function(){n.syncToolbarState()},200),this.config=t;var r=a(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),mn(function(){n.initToolbar(),n.lngListen=Us(function(){return n.initToolbar()});var e=n.getEditorInstance();e.on($n,n.changeToolbarState),e.on(Fn,n.syncToolbarState),e.on(An,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,a=r.insertKeys,l=void 0===a?{index:0,keys:[]}:a,u=r.excludeKeys,c=void 0===u?[]:u,d=s(i),h=[];h=Array.isArray(l)?l:[l];var p=0;h.forEach(function(e){var t=e.index+p;if(e.replaceFn&&d[t]){var n=e.replaceFn(d[t]);if(!n)throw new Error("This function needs to return the menu configuration:string | IMenuGroup");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)}),p+=e.keys.length)});var f=d.filter(function(e){var t="string"==typeof e?e:e.key;return!c.includes(t)}),g=f.length;f.forEach(function(r,o){if("|"===r){if(0===o)return;if(o+1===g)return;if("|"===t)return;var i=Ws();return n.append(i),void(t=r)}if("string"==typeof r)return e.registerSingleItem(r,e),void(t=r);e.registerGroup(r),t="group"})},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new ta(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,s=this.config.excludeKeys,a=void 0===s?[]:s;i.forEach(function(e){a.includes(e)||t.registerSingleItem(e,r)}),n.append(r.$elem)},e.prototype.registerSingleItem=function(e,t){var n=this.getEditorInstance(),r=t instanceof ta,o=this.menus,i=o[e];if(null==i){var s=Un[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"));i=s(),o[e]=i}else console.warn("Duplicated toolbar menu key '".concat(e,"'\n重复注册了菜单栏 menu '").concat(e,"'"));var a=n.getMenuConfig(e);a&&void 0!==a.iconSvg&&(i.iconSvg=a.iconSvg);var l=oa(e,i,r);(this.toolbarItems.push(l),Kn.set(l,n),r)?t.appendBarItem(l):t.$toolbar.append(l.$elem)},e.prototype.getEditorInstance=function(){var e=zn.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 Wa=!1,Va=!1;function qa(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=Er,e.DOMElement=xr,e.DOMNode=wr,e.DOMRange=_r,e.DOMSelection=Or,e.DOMStaticRange=kr,e.DOMText=Sr,e.DomEditor=To,e.ELEM_TO_HTML_CONF=fo,e.PARSE_ELEM_HTML_CONF=eo,e.PARSE_STYLE_HTML_FN_LIST=Zr,e.PRE_PARSE_HTML_CONF_LIST=Qr,e.RENDER_ELEM_CONF=Pa,e.RENDER_STYLE_HANDLER_LIST=Na,e.STYLE_TO_HTML_FN_LIST=po,e.TEXT_TAGS=Yr,e.Toolbar=za,e.coreCreateEditor=function(e){var t=e.selector,n=void 0===t?"":t,o=e.config,a=void 0===o?{}:o,l=e.content,u=e.html,c=e.plugins,d=void 0===c?[]:c,h=function(e){return[Ui,xi,vr,wi,Ji,Ii,zi,On.withHistory].reduce(function(e,t){return t(e)},e)}(i.createEditor());if(n&&function(e,t){return uo(e,"data-w-e-textarea",t)}(h,n))throw new Error("Repeated create editor by selector '".concat(n,"'"));var p=function(e){void 0===e&&(e={});var t=s(Rn),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:Pn,customAlert:function(e,t){window.alert("".concat(t,":\n").concat(e))}},e)}(a);Xn.set(h,p);var f=p.hoverbarKeys,g=void 0===f?{}:f;if(d.forEach(function(e){h=e(h)}),function(e,t){var n=t.html,r=t.content;null!=n?e.children=co(e,n):r&&r.length&&(e.children=r),0===e.children.length&&(e.children=[{type:"paragraph",children:[{text:""}]}])}(h,{html:u,content:l}),n){var m=new Ba(n);Bn.set(h,m),Hn.set(m,h),m.changeViewState();var y=void 0;Object.keys(g).length>0&&(y=new sa,Vn.set(y,h),qn.set(h,y)),h.on($n,function(){h.hidePanelOrModal()}),h.on(Dn,function(){h.hidePanelOrModal()})}else h.children.forEach(function(e,t){return Ha(e,t,h,h)});var b=p.onCreated,w=p.onDestroyed;return b&&h.on(Mn,function(){return b(h)}),w&&h.on(Ln,function(){return w(h)}),mn(function(){return h.emit(Mn)}),h},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 uo(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||{}),s=new za(n,i);return zn.set(s,e),Wn.set(e,s),s},e.createUploader=function(e,t){return Wa||(Wa=!0,qa("createUploader")),function(e,t){return e.uploadAdapter?e.uploadAdapter({config:e,editor:t}):En(e)}(e,t)},e.createUppyUploader=function(e){return Va||(Va=!0,qa("createUppyUploader")),En(e)},e.genModalButtonElems=function(e,t){var n=a('<div class="button-container"></div>'),r=a('<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=a('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=a('<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=a('<label class="babel-container"></label>');r.append("<span>".concat(e,"</span>"));var o=a('<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=Lr,e.getEditableChild=Wr,e.getEditableChildAndIndex=zr,e.getElementById=Hr,e.getFirstVoidChild=qr,e.getPlainText=Vr,e.getTagName=Jr,e.getTextStyleMode=function(e){return e&&"class"===e.getConfig().textStyleMode?"class":"inline"},e.hasShadowRoot=Br,e.i18nAddResources=function(e,t){js.addResourceBundle(e,Is,t,!0,!0)},e.i18nChangeLanguage=function(e){js.changeLanguage(e)},e.i18nGetResources=function(e){return js.getResourceBundle(e,Is)},e.i18nListenLanguage=Us,e.isDOMComment=Dr,e.isDOMElement=Fr,e.isDOMNode=$r,e.isDOMSelection=Ar,e.isDOMText=jr,e.isDataTransfer=Nr,e.isDocument=Cr,e.isHTMLElememt=Mr,e.isPlainTextOnlyPaste=Ir,e.isShadowRoot=Tr,e.isUnprocessedListElement=Rr,e.normalizeDOMPoint=Ur,e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;fo[t||""]=n},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=v(v({},o),t||{});if(null!=Un[n])throw new Error("Duplicated key '".concat(n,"' in menu items"));Un[n]=r,function(e,t){null!=t&&(Rn[e]=t)}(n,i)},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;eo[t]=n},e.registerParseStyleHtmlHandler=function(e){Zr.push(e)},e.registerPreParseHtmlConf=function(e){Qr.push(e)},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Pa[t||""]=n},e.registerStyleHandler=function(e){Na.push(e)},e.registerStyleToHtmlHandler=function(e){po.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=Bs,e.walkTextNodes=Kr});
|
|
2
13
|
//# sourceMappingURL=index.js.map
|